@lunora/config 1.0.0-alpha.42 → 1.0.0-alpha.420

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 (146) hide show
  1. package/LICENSE.md +135 -0
  2. package/README.md +3 -3
  3. package/dist/cli/index.d.mts +2 -0
  4. package/dist/cli/index.d.ts +2 -0
  5. package/dist/cli/index.mjs +1 -0
  6. package/dist/cloudflare/index.d.mts +1307 -0
  7. package/dist/cloudflare/index.d.ts +1307 -0
  8. package/dist/cloudflare/index.mjs +1 -0
  9. package/dist/index.d.mts +962 -974
  10. package/dist/index.d.ts +962 -974
  11. package/dist/index.mjs +1 -23
  12. package/dist/packem_shared/ACCENT-CotPTfv7.mjs +7 -0
  13. package/dist/packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs +1 -0
  14. package/dist/packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs +1 -0
  15. package/dist/packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs +1 -0
  16. package/dist/packem_shared/BINDING_MANIFEST_VERSION-CfXEYG8e.mjs +1 -0
  17. package/dist/packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs +1 -0
  18. package/dist/packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-BKMrOuXV.mjs +1 -0
  19. package/dist/packem_shared/CLOUDFLARE_DRIVER-CULavrYO.mjs +1 -0
  20. package/dist/packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DV5E_f_q.mjs +1 -0
  21. package/dist/packem_shared/COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs +1 -0
  22. package/dist/packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs +1 -0
  23. package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-CuEMuxSY.mjs +1 -0
  24. package/dist/packem_shared/DEFAULT_OBSERVABILITY-bN6UkTMx.mjs +1 -0
  25. package/dist/packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs +4 -0
  26. package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs +6 -0
  27. package/dist/packem_shared/DEV_WORKER_ENV_VALUE-CgozgOxh.mjs +1 -0
  28. package/dist/packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs +1 -0
  29. package/dist/packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs +2 -0
  30. package/dist/packem_shared/LUNORA_EVENT_SOURCE-B9ZVohjO.mjs +1 -0
  31. package/dist/packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs +19 -0
  32. package/dist/packem_shared/LUNORA_TAG-DQTGPqcJ.mjs +1 -0
  33. package/dist/packem_shared/LunoraReporter-f277GLNT.mjs +6 -0
  34. package/dist/packem_shared/MissingBuildOutputError-BAyekzof.mjs +1 -0
  35. package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-ByJhGJMf.mjs +1 -0
  36. package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-D5PpQPkf.mjs +1 -0
  37. package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-CuhB99R2.mjs +1 -0
  38. package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-D4UcOP_t.mjs +1 -0
  39. package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-CtxWqfDe.mjs +1 -0
  40. package/dist/packem_shared/SEED_ENDPOINT-C1fhrehH.mjs +1 -0
  41. package/dist/packem_shared/STUDIO_PATH-Dc-3nLO6.mjs +1 -0
  42. package/dist/packem_shared/STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs +1 -0
  43. package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-BV29zhUp.mjs +1 -0
  44. package/dist/packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs +1 -0
  45. package/dist/packem_shared/WRANGLER_FILES-UNW-xY5u.mjs +1 -0
  46. package/dist/packem_shared/acceptsConnection-DHhUYGjT.mjs +2 -0
  47. package/dist/packem_shared/addArgsFor-CYZKhNIo.mjs +1 -0
  48. package/dist/packem_shared/applyAdditiveEdit-DEwPKcJg.mjs +6 -0
  49. package/dist/packem_shared/applyModify-DKP2l6S9.mjs +1 -0
  50. package/dist/packem_shared/assertBuildTargetMatches-C58Lo9HU.mjs +1 -0
  51. package/dist/packem_shared/assertWranglerSatisfiesSchema-A2WCMIRa.mjs +3 -0
  52. package/dist/packem_shared/assetContentType-CUb5bpbI.mjs +1 -0
  53. package/dist/packem_shared/bindingsNeedingDatabase-6eD6Qtqf.mjs +3 -0
  54. package/dist/packem_shared/blockingFindingsMessage-CRbg1sla.mjs +1 -0
  55. package/dist/packem_shared/buildPackageSecretsBlock-GvaLgvFN.mjs +19 -0
  56. package/dist/packem_shared/canonicalPath-DrfMiT3U.mjs +1 -0
  57. package/dist/packem_shared/celld-binding-id-9MiUoteo.mjs +1 -0
  58. package/dist/packem_shared/celld-config-DoBVipuN.mjs +3 -0
  59. package/dist/packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs +24 -0
  60. package/dist/packem_shared/clearApiSpecMarker-DMGpP41V.mjs +2 -0
  61. package/dist/packem_shared/collectExportGaps-zmra4uTS.mjs +2 -0
  62. package/dist/packem_shared/createConfirm-D5mKTMHj.mjs +7 -0
  63. package/dist/packem_shared/createDiscoveryCache-npJI4uej.mjs +1 -0
  64. package/dist/packem_shared/createStudioDocumentCache-B3Sf1bIl.mjs +1 -0
  65. package/dist/packem_shared/deploy-driver.d-DraUd2R2.d.mts +186 -0
  66. package/dist/packem_shared/deploy-driver.d-DraUd2R2.d.ts +186 -0
  67. package/dist/packem_shared/describePreservedCrons-C5KPuPy3.mjs +1 -0
  68. package/dist/packem_shared/describeWithheld-CbyzZjZF.mjs +1 -0
  69. package/dist/packem_shared/detectFramework-Dfpvu6rD.mjs +1 -0
  70. package/dist/packem_shared/devVariablesStamp-Cetr3qFz.mjs +1 -0
  71. package/dist/packem_shared/discover-info-DC2MrAIM.mjs +1 -0
  72. package/dist/packem_shared/discoverAgentInfo-pqFMJBtJ.mjs +1 -0
  73. package/dist/packem_shared/discoverContainerInfo-DzXr7Vm3.mjs +1 -0
  74. package/dist/packem_shared/discoverSchemaInfo-DRPnqgif.mjs +1 -0
  75. package/dist/packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs +1 -0
  76. package/dist/packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs +7 -0
  77. package/dist/packem_shared/guards-Buu_E7mP.mjs +1 -0
  78. package/dist/packem_shared/hasCloudflareCredentials-Bak5w1_6.mjs +1 -0
  79. package/dist/packem_shared/index.d-DSqsbmlq.d.mts +270 -0
  80. package/dist/packem_shared/index.d-sZ22Dkwr.d.ts +270 -0
  81. package/dist/packem_shared/infer-bindings.d-BUdWC3tw.d.mts +323 -0
  82. package/dist/packem_shared/infer-bindings.d-BUdWC3tw.d.ts +323 -0
  83. package/dist/packem_shared/inferLunoraBindings-DvB8IpbN.mjs +1 -0
  84. package/dist/packem_shared/lunora-manifest-DuH_Cmyu.mjs +6 -0
  85. package/dist/packem_shared/materializeServiceDevConfigs-qUY4_iu1.mjs +1 -0
  86. package/dist/packem_shared/mergeWranglerEnvironment-D5ekKj5x.mjs +1 -0
  87. package/dist/packem_shared/package-secrets-registry-UQ_uEAB_.mjs +1 -0
  88. package/dist/packem_shared/parseSchema-D1Wbr1qv.mjs +1 -0
  89. package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.mts +86 -0
  90. package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.ts +86 -0
  91. package/dist/packem_shared/probeCelldToolchain-DxDttfHy.mjs +1 -0
  92. package/dist/packem_shared/process-tree-once-Ou4SfxKM.mjs +1 -0
  93. package/dist/packem_shared/readProjectDependencies-l3uhUKjo.mjs +1 -0
  94. package/dist/packem_shared/reconcile-services-DFqH4eMQ.mjs +1 -0
  95. package/dist/packem_shared/reconcileBindingsSafely-Dh2MIIWG.mjs +1 -0
  96. package/dist/packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs +1 -0
  97. package/dist/packem_shared/renderStudioHtml-ByowDtMl.mjs +15 -0
  98. package/dist/packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs +1 -0
  99. package/dist/packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs +1 -0
  100. package/dist/packem_shared/scanWranglerVariablesForSecrets-DRBYlMYb.mjs +1 -0
  101. package/dist/packem_shared/sendStudioAsset-XBmVLqiI.mjs +1 -0
  102. package/dist/packem_shared/serveJsonHandler-B8_GE6QC.mjs +1 -0
  103. package/dist/packem_shared/startCelldDevSession-BKRiLvt-.mjs +1 -0
  104. package/dist/packem_shared/streamContainerLogs-0nko1qpv.mjs +2 -0
  105. package/dist/packem_shared/validate-bindings-PVHSAU6M.mjs +1 -0
  106. package/dist/packem_shared/withTailConsumer-CF3pk_Ov.mjs +1 -0
  107. package/dist/packem_shared/worker-entry-checks-AIASCYl7.mjs +1 -0
  108. package/dist/packem_shared/wranglerCodegenInputs-BZamZrPz.mjs +1 -0
  109. package/dist/packem_shared/wranglerToAlchemy-CBO2ucRm.mjs +6 -0
  110. package/dist/packem_shared/write-atomic-DRRKWKF-.mjs +3 -0
  111. package/dist/studio-host/index.d.mts +366 -112
  112. package/dist/studio-host/index.d.ts +366 -112
  113. package/dist/studio-host/index.mjs +1 -7
  114. package/package.json +32 -7
  115. package/dist/packem_shared/ACCENT-DW1XJn8i.mjs +0 -40
  116. package/dist/packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs +0 -40
  117. package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs +0 -37
  118. package/dist/packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs +0 -52
  119. package/dist/packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs +0 -34
  120. package/dist/packem_shared/LUNORA_EVENT_SOURCE-D2fDeGB6.mjs +0 -86
  121. package/dist/packem_shared/LunoraReporter-Ci-bDCK9.mjs +0 -70
  122. package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-B8t_SdoZ.mjs +0 -70
  123. package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-CiC2IGKx.mjs +0 -103
  124. package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-BC7_e9Bz.mjs +0 -105
  125. package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-2YYyWJUq.mjs +0 -561
  126. package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-Df-Wrix-.mjs +0 -99
  127. package/dist/packem_shared/SEED_ENDPOINT-DVCjaGO-.mjs +0 -61
  128. package/dist/packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs +0 -25
  129. package/dist/packem_shared/applyAdditiveEdit-C-snTFEV.mjs +0 -228
  130. package/dist/packem_shared/buildPackageSecretsBlock-BCHtfQ2A.mjs +0 -280
  131. package/dist/packem_shared/classifyPolicyEdit-BHeAqF8P.mjs +0 -99
  132. package/dist/packem_shared/createConfirm-fvpdgJ9s.mjs +0 -100
  133. package/dist/packem_shared/detectFramework-Br-BcPBq.mjs +0 -41
  134. package/dist/packem_shared/discoverContainerInfo-BXFs6Wav.mjs +0 -19
  135. package/dist/packem_shared/discoverSchemaInfo-BB-CKlTK.mjs +0 -25
  136. package/dist/packem_shared/discoverWorkflowInfo-CedvR0mn.mjs +0 -19
  137. package/dist/packem_shared/inferLunoraBindings-ByMwG-gH.mjs +0 -352
  138. package/dist/packem_shared/loadStudioAssets-Csk5RS4E.mjs +0 -28
  139. package/dist/packem_shared/parseDevVariable-CJiq2IwE.mjs +0 -30
  140. package/dist/packem_shared/parseSchema-DSeyktvG.mjs +0 -107
  141. package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.mts +0 -74
  142. package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.ts +0 -74
  143. package/dist/packem_shared/reconcileWranglerBindings-Cruwwx1M.mjs +0 -334
  144. package/dist/packem_shared/renderStudioHtml-449Ysn75.mjs +0 -37
  145. package/dist/packem_shared/serveJsonHandler-B4OLTGLS.mjs +0 -86
  146. package/dist/packem_shared/streamContainerLogs-BZ4cOZwH.mjs +0 -157
@@ -0,0 +1,1307 @@
1
+ import { D as DiscoveryCache, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-BUdWC3tw.mjs";
2
+ export { H as HYPERDRIVE_PLACEHOLDER_ID } from "../packem_shared/infer-bindings.d-BUdWC3tw.mjs";
3
+ import { D as DeployDriver } from "../packem_shared/deploy-driver.d-DraUd2R2.mjs";
4
+ import { WranglerQueueProducerIR, WranglerVariableIR } from '@lunora/codegen';
5
+ /** Apply one structural jsonc edit and return the rewritten text (a no-op edit returns the input). */
6
+ declare const applyModify: (text: string, path: ReadonlyArray<number | string>, value: unknown) => string;
7
+ /** The project coordinates the validator needs. */
8
+ interface AssertWranglerOptions {
9
+ /** Memoises the schema discovery, shared with binding inference. */
10
+ cache?: DiscoveryCache;
11
+ /** Absolute path to the project root holding `wrangler.jsonc`. */
12
+ projectRoot: string;
13
+ /** The schema directory, relative to `projectRoot` (usually `"lunora"`). */
14
+ schemaDir: string;
15
+ }
16
+ /**
17
+ * Throw unless `wrangler.jsonc` satisfies the schema's binding requirements.
18
+ *
19
+ * Non-blocking validator warnings go to `warn`. `remedy` closes both error
20
+ * messages — the caller's own "and restart the dev server" / "and rebuild" —
21
+ * since that is the only part a reader acts on differently per front-end.
22
+ *
23
+ * Must run AFTER binding provisioning: the bindings this requires are largely the
24
+ * ones Lunora writes itself, so validating first fails the very first build of any
25
+ * project that declares a `.global()` table or a container.
26
+ */
27
+ declare const assertWranglerSatisfiesSchema: (options: AssertWranglerOptions, warn: (message: string) => void, remedy: string) => void;
28
+ /**
29
+ * Translate a `wrangler.jsonc` into an [Alchemy](https://alchemy.run) program.
30
+ *
31
+ * # Why translate rather than ask for a second config
32
+ *
33
+ * `wrangler.jsonc` is already the source of truth for what an app needs, and
34
+ * Lunora already infers and reconciles it — `inferLunoraBindings` decides that
35
+ * a project needs a shard namespace and a bucket, `reconcileWranglerBindings`
36
+ * writes them. Asking a developer to restate all of that in an
37
+ * `alchemy.run.ts` would give the project two sources of truth that drift, and
38
+ * the drift would surface as a deploy that provisions something the app does
39
+ * not bind.
40
+ *
41
+ * So Alchemy is an implementation detail of `deploy`, not a thing to configure:
42
+ * read the config, emit the program, run it.
43
+ *
44
+ * # Why this emits source rather than calling Alchemy
45
+ *
46
+ * `alchemy@0.93` has thirty dependencies, nine of them Node-shaped —
47
+ * `wrangler`, `miniflare`, `esbuild`, `execa`, `find-process`, `glob`, `open`,
48
+ * `proper-lockfile`, `signal-exit`. `@lunora/config` is imported by
49
+ * `@lunora/vite`, so importing Alchemy here would push that tree into every
50
+ * project that merely wanted to read `lunora.config.*`, and into any bundle
51
+ * targeting workerd — where none of it survives.
52
+ *
53
+ * Emitting text keeps this module pure and dependency-free. Alchemy is invoked
54
+ * as a CLI against the generated file, so it only has to exist on the machine
55
+ * that deploys.
56
+ *
57
+ * # Adoption, not re-creation
58
+ *
59
+ * Every resource is emitted with `adopt: true`. A project translated from an
60
+ * existing `wrangler.jsonc` already *has* its D1 database and its bucket, with
61
+ * data in them. Without adoption Alchemy would treat them as new and try to
62
+ * create alongside — the one outcome a deploy must never have.
63
+ */
64
+ /** A Durable Object binding as `wrangler.jsonc` spells it. */
65
+ interface WranglerDurableObjectBinding$1 {
66
+ class_name?: string;
67
+ name?: string;
68
+ script_name?: string;
69
+ }
70
+ /** The slice of `wrangler.jsonc` that translates into Alchemy resources. */
71
+ interface WranglerConfigShape {
72
+ compatibility_date?: string;
73
+ compatibility_flags?: ReadonlyArray<string>;
74
+ d1_databases?: ReadonlyArray<{
75
+ binding?: string;
76
+ database_id?: string;
77
+ database_name?: string;
78
+ }>;
79
+ durable_objects?: {
80
+ bindings?: ReadonlyArray<WranglerDurableObjectBinding$1>;
81
+ };
82
+ kv_namespaces?: ReadonlyArray<{
83
+ binding?: string;
84
+ id?: string;
85
+ }>;
86
+ main?: string;
87
+ /** `new_sqlite_classes` marks which DO classes get SQLite storage — Alchemy needs that per namespace. */
88
+ migrations?: ReadonlyArray<{
89
+ new_classes?: ReadonlyArray<string>;
90
+ new_sqlite_classes?: ReadonlyArray<string>;
91
+ }>;
92
+ name?: string;
93
+ /** Only `producers` translate; a `consumers` entry is dropped and reported as `queues.consumers`. */
94
+ queues?: {
95
+ consumers?: ReadonlyArray<{
96
+ queue?: string;
97
+ }>;
98
+ producers?: ReadonlyArray<{
99
+ binding?: string;
100
+ queue?: string;
101
+ }>;
102
+ };
103
+ r2_buckets?: ReadonlyArray<{
104
+ binding?: string;
105
+ bucket_name?: string;
106
+ }>;
107
+ triggers?: {
108
+ crons?: ReadonlyArray<string>;
109
+ };
110
+ vars?: Readonly<Record<string, unknown>>;
111
+ }
112
+ /** What the translation could not carry over, so the caller can say so out loud. */
113
+ interface AlchemyTranslation {
114
+ /** The emitted program source. */
115
+ source: string;
116
+ /**
117
+ * Bindings present in `wrangler.jsonc` that this translation drops.
118
+ *
119
+ * Reported rather than silently omitted: a deploy that quietly loses a
120
+ * Vectorize index produces a worker whose `env.POSTS_SEARCH` is undefined
121
+ * at runtime, and nothing in the build says why.
122
+ */
123
+ unsupported: ReadonlyArray<string>;
124
+ }
125
+ /**
126
+ * Translate a parsed `wrangler.jsonc` into an Alchemy program.
127
+ *
128
+ * Pure: it reads nothing and writes nothing, so the caller decides where the
129
+ * source lands and the whole thing stays testable as a string comparison.
130
+ * @param config The parsed `wrangler.jsonc`.
131
+ * @returns the program source, plus whatever could not be carried over.
132
+ */
133
+ declare const wranglerToAlchemy: (config: WranglerConfigShape) => AlchemyTranslation;
134
+ /** Schema version of the emitted document, so a consumer can gate on shape changes. */
135
+ declare const BINDING_MANIFEST_VERSION = 1;
136
+ /**
137
+ * One resource the built Worker expects to be bound to. `binding` is the name the
138
+ * Worker reads off `env`; the remaining fields are whatever identifies the
139
+ * resource for that type, omitted when the config does not carry them (an id
140
+ * Lunora could not mint is absent here exactly as it is absent from the config).
141
+ */
142
+ interface BindingRequirement {
143
+ /** The `env` property name the Worker reads. */
144
+ binding: string;
145
+ /**
146
+ * Durable Object / Workflow / Container class the Worker must export. Present
147
+ * for the class-backed binding types, so a deployer can assert the bundle
148
+ * exports it before publishing.
149
+ */
150
+ className?: string;
151
+ /** Bucket name (`r2`), database name (`d1`), dataset (`analytics_engine`), queue name (`queue`), index (`vectorize`), stream (`pipeline`), namespace (`artifacts`, `ai_search_namespace`), instance (`ai_search`), Worker name (`service`). */
152
+ resource?: string;
153
+ /** Remote resource id, when the config declares one (`d1`, `kv`, `hyperdrive`, `vpc_service`, `vpc_network`). */
154
+ resourceId?: string;
155
+ /** For `durable_object`: whether the class uses SQLite storage (`new_sqlite_classes`). */
156
+ sqlite?: boolean;
157
+ /** The kind of resource, keyed to the wrangler section it came from. */
158
+ type: "ai" | "ai_search" | "ai_search_namespace" | "analytics_engine" | "analytics_sql" | "artifacts" | "assets" | "browser" | "container" | "d1" | "durable_object" | "hyperdrive" | "images" | "kv" | "media" | "pipeline" | "queue_consumer" | "queue_producer" | "r2" | "service" | "stream" | "vectorize" | "vpc_network" | "vpc_service" | "workflow";
159
+ }
160
+ /** The document the `lunora build --emit-bindings` flag writes. */
161
+ interface BindingManifest {
162
+ /** Every resource the Worker expects, sorted by `type` then `binding` so the file is diff-stable. */
163
+ bindings: ReadonlyArray<BindingRequirement>;
164
+ /** `compatibility_date`, when declared. */
165
+ compatibilityDate?: string;
166
+ /** `compatibility_flags`, when declared. */
167
+ compatibilityFlags?: ReadonlyArray<string>;
168
+ /** Cron expressions the Worker must be triggered on (`triggers.crons`). */
169
+ crons: ReadonlyArray<string>;
170
+ /** Worker name from `wrangler.jsonc`. */
171
+ name?: string;
172
+ /**
173
+ * Wrangler sections present in the config that this version does not model,
174
+ * by field name. Empty for a fully-understood config; non-empty is a prompt to
175
+ * extend the collector, and is surfaced to the user rather than silently
176
+ * dropped.
177
+ */
178
+ unknown: ReadonlyArray<string>;
179
+ /** Names of `vars` entries. Values are deliberately excluded — a manifest is committed and read by CI, and a `vars` entry can hold a value a project would rather not publish. */
180
+ vars: ReadonlyArray<string>;
181
+ /** Schema version — {@link BINDING_MANIFEST_VERSION}. */
182
+ version: number;
183
+ }
184
+ /**
185
+ * The wider config this reads. {@link WranglerConfigShape} covers what the
186
+ * Alchemy translation models; a manifest additionally reports the sections that
187
+ * translation lists as unsupported, so those are declared here.
188
+ */
189
+ interface ManifestConfigShape extends WranglerConfigShape {
190
+ ai?: {
191
+ binding?: string;
192
+ };
193
+ ai_search?: ReadonlyArray<{
194
+ binding?: string;
195
+ instance_name?: string;
196
+ }>;
197
+ ai_search_namespaces?: ReadonlyArray<{
198
+ binding?: string;
199
+ namespace?: string;
200
+ }>;
201
+ /** The Analytics SQL binding — a parameterless `{ binding }`, distinct from `analytics_engine_datasets`. */
202
+ analytics?: {
203
+ binding?: string;
204
+ };
205
+ analytics_engine_datasets?: ReadonlyArray<{
206
+ binding?: string;
207
+ dataset?: string;
208
+ }>;
209
+ artifacts?: ReadonlyArray<{
210
+ binding?: string;
211
+ namespace?: string;
212
+ }>;
213
+ /** Static assets carry a real `binding` the Worker reads (`env.ASSETS`). */
214
+ assets?: {
215
+ binding?: string;
216
+ directory?: string;
217
+ };
218
+ browser?: {
219
+ binding?: string;
220
+ };
221
+ containers?: ReadonlyArray<{
222
+ class_name?: string;
223
+ image?: string;
224
+ max_instances?: number;
225
+ }>;
226
+ /** Top-level exports; only `type: "workflow"` entries map to a binding requirement (see {@link collectWorkflowExports}). */
227
+ exports?: Record<string, {
228
+ name?: string;
229
+ type?: string;
230
+ } | null | undefined>;
231
+ hyperdrive?: ReadonlyArray<{
232
+ binding?: string;
233
+ id?: string;
234
+ }>;
235
+ images?: {
236
+ binding?: string;
237
+ };
238
+ media?: {
239
+ binding?: string;
240
+ };
241
+ /** `pipeline` is wrangler's deprecated spelling of `stream`; both are read. */
242
+ pipelines?: ReadonlyArray<{
243
+ binding?: string;
244
+ pipeline?: string;
245
+ stream?: string;
246
+ }>;
247
+ /** Adds `consumers` — the Alchemy translation models producers only. */
248
+ queues?: {
249
+ consumers?: ReadonlyArray<{
250
+ queue?: string;
251
+ }>;
252
+ producers?: ReadonlyArray<{
253
+ binding?: string;
254
+ queue?: string;
255
+ }>;
256
+ };
257
+ /** Service bindings to sibling Workers; `service` is the Worker name. */
258
+ services?: ReadonlyArray<{
259
+ binding?: string;
260
+ entrypoint?: string;
261
+ service?: string;
262
+ }>;
263
+ stream?: {
264
+ binding?: string;
265
+ };
266
+ vectorize?: ReadonlyArray<{
267
+ binding?: string;
268
+ index_name?: string;
269
+ }>;
270
+ vpc_networks?: ReadonlyArray<{
271
+ binding?: string;
272
+ network_id?: string;
273
+ tunnel_id?: string;
274
+ }>;
275
+ vpc_services?: ReadonlyArray<{
276
+ binding?: string;
277
+ service_id?: string;
278
+ }>;
279
+ workflows?: ReadonlyArray<{
280
+ binding?: string;
281
+ class_name?: string;
282
+ name?: string;
283
+ }>;
284
+ }
285
+ /**
286
+ * Build the manifest for a parsed `wrangler.jsonc`.
287
+ *
288
+ * Pure: reads nothing and writes nothing, so the caller decides where the
289
+ * document lands and the mapping stays testable as a plain object comparison.
290
+ * @param config The parsed, already-reconciled `wrangler.jsonc`.
291
+ * @returns the requirements document.
292
+ */
293
+ declare const buildBindingManifest: (config: ManifestConfigShape) => BindingManifest;
294
+ /** Env var the once-per-process-tree guard behind {@link warnCloudflareCliConfigOnce} sets. */
295
+ declare const CLOUDFLARE_CLI_CONFIG_WARNING_ENV = "LUNORA_CF_CONFIG_WARNING_SHOWN";
296
+ /** A detected Cloudflare CLI config: what was found, and what to do about it. */
297
+ interface CloudflareCliConfigFinding {
298
+ /** What to do — `cf` resource commands are fine, lifecycle commands are not. Links the tracking issue. */
299
+ fix: string;
300
+ /** One line: which file was found, where, and why it is a problem. */
301
+ message: string;
302
+ }
303
+ /**
304
+ * Detect a Cloudflare CLI config (`cloudflare.config.{ts,mts,js,mjs}`) in
305
+ * `projectRoot`, or `undefined` when there is none. The message names the
306
+ * wrangler config actually present (`wrangler.jsonc` / `wrangler.json`), or says
307
+ * "in the project root" when there is none yet.
308
+ */
309
+ declare const detectCloudflareCliConfig: (projectRoot: string) => CloudflareCliConfigFinding | undefined;
310
+ /**
311
+ * Warn through `warn` when `projectRoot` holds a Cloudflare CLI config — once
312
+ * per process tree (a rebuild, a dev-server restart, or a child process that
313
+ * inherited the env stays quiet). The guard is read before the filesystem probe,
314
+ * and claimed only when there is something to say. Non-blocking by design: the
315
+ * risk is a separate `cf` lifecycle command, not anything Lunora runs. Returns
316
+ * whether it warned.
317
+ */
318
+ declare const warnCloudflareCliConfigOnce: (projectRoot: string, warn: (message: string) => void) => boolean;
319
+ /** The Cloudflare deploy driver. */
320
+ declare const CLOUDFLARE_DRIVER: DeployDriver;
321
+ /**
322
+ * The `global_fetch_strictly_public` compatibility flag: every global `fetch` from
323
+ * the Worker goes out to the public internet, never to a private or special-use
324
+ * address. `workersCimdFetch()` from `@lunora/auth/cimd/workers` refuses to build
325
+ * without it, and `lunora doctor` checks for it wherever that transport is imported.
326
+ */
327
+ declare const GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG = "global_fetch_strictly_public";
328
+ /** Inputs, injectable so tests never read the real home directory or env. */
329
+ interface CloudflareCredentialProbe {
330
+ env?: Record<string, string | undefined>;
331
+ home?: string;
332
+ /** Project whose `.env` files are read; omit to skip them. */
333
+ projectRoot?: string;
334
+ }
335
+ declare const hasCloudflareCredentials: (probe?: CloudflareCredentialProbe) => boolean;
336
+ /** Which kind of temp config a file is, in its name. */
337
+ type DevConfigKind = "dev" | "service";
338
+ /** A remote-only binding a logged-out dev session leaves out: which kind it is, and the name the app gave it. */
339
+ interface WithheldBinding {
340
+ binding: string;
341
+ kind: "ai" | "artifacts";
342
+ }
343
+ /** The slice of a worker config the rule reads. */
344
+ interface RemoteOnlyBindings {
345
+ ai?: {
346
+ binding?: string;
347
+ } | null;
348
+ artifacts?: ReadonlyArray<{
349
+ binding?: string;
350
+ } | null | undefined> | null;
351
+ }
352
+ /**
353
+ * The bindings to withhold from a logged-out dev session. Workers AI and Artifacts have no
354
+ * local simulator, so each opens a remote proxy session at boot that fails without a login and
355
+ * takes the dev server down. The credential probe runs only when one of them is declared.
356
+ */
357
+ declare const withheldBindings: (config: RemoteOnlyBindings | undefined, hasCredentials: () => boolean) => WithheldBinding[];
358
+ /** The one dev warning for a withheld binding, shared by `lunora dev` and `@lunora/vite`. */
359
+ declare const describeWithheld: ({ binding, kind }: WithheldBinding) => string;
360
+ /** The slice of PGlite this module drives, so a test can stand in for the WASM engine. */
361
+ interface PgliteRuntime {
362
+ createServer: (dataDirectory: string) => Promise<{
363
+ connectionString: string;
364
+ stop: () => Promise<void>;
365
+ }>;
366
+ }
367
+ interface StartLocalHyperdriveOptions {
368
+ /** Defaults to `process.env`; the connection strings are written here and removed again by `stop`. */
369
+ env?: NodeJS.ProcessEnv;
370
+ /** Injection seam; defaults to the real PGlite. Resolves `undefined` when it is not installed. */
371
+ load?: () => Promise<PgliteRuntime | undefined>;
372
+ /** Called once with a line to show the developer when the database could not be started. */
373
+ onWarning?: (message: string) => void;
374
+ projectRoot: string;
375
+ /** The wrangler config the session actually runs (the Cloudflare plugin's `configPath`); defaults to the project's own. */
376
+ wranglerConfigPath?: string;
377
+ }
378
+ interface LocalHyperdrive {
379
+ /** The bindings served by PGlite. */
380
+ bindings: string[];
381
+ stop: () => Promise<void>;
382
+ }
383
+ /** The Hyperdrive bindings in `wrangler.jsonc` that nothing local backs yet. */
384
+ declare const bindingsNeedingDatabase: (projectRoot: string, env: NodeJS.ProcessEnv, wranglerEnvironment?: string | undefined, configPath?: string) => string[];
385
+ /**
386
+ * Start a PGlite for every Hyperdrive binding with no local database, and point
387
+ * wrangler at it through its environment variable. Resolves `undefined` when
388
+ * there is nothing to serve, or when PGlite is not installed (after saying how
389
+ * to install it).
390
+ */
391
+ declare const startLocalHyperdrive: (options: StartLocalHyperdriveOptions) => Promise<LocalHyperdrive | undefined>;
392
+ /**
393
+ * A container/workflow that is declared (so codegen emits its class) but the
394
+ * worker entry never re-exports — the one wiring step the generators can't always
395
+ * do for the developer. wrangler rejects a `class_name` the deployed worker
396
+ * doesn't export, so a deploy fails late on this; surfacing it as structured data
397
+ * lets the Vite plugin raise it in the dev error overlay (not just the console)
398
+ * the moment the gap appears. The human-readable form is also folded into
399
+ * {@link ReconcileBindingsResult.warnings}.
400
+ */
401
+ interface ExportGap {
402
+ /** Generated class wrangler needs exported, e.g. `OrderPipelineWorkflow`. */
403
+ className: string;
404
+ /** The `lunora/{agents,containers,workflows}.ts` export name, e.g. `orderPipeline`. */
405
+ exportName: string;
406
+ /** Which declaration is unexported. */
407
+ kind: "agent" | "container" | "workflow";
408
+ /** The `_generated/{module}` to re-export from, e.g. `workflows`. */
409
+ module: GeneratedClassModule;
410
+ }
411
+ interface ReconcileBindingsResult {
412
+ /** Short labels for each binding written (e.g. `"SCHEDULER/SchedulerDO"`). */
413
+ added: string[];
414
+ /** `true` when `wrangler.jsonc` was rewritten. */
415
+ changed: boolean;
416
+ /** What was written to the SvelteKit / Nuxt dev sidecar's own config, when anything was. */
417
+ devConfig?: {
418
+ added: string[];
419
+ path: string;
420
+ updated: string[];
421
+ };
422
+ /**
423
+ * Declared containers/workflows the worker entry doesn't re-export — the
424
+ * structured form of the corresponding `warnings` entries, for the dev error
425
+ * overlay. Empty when every declaration is wired.
426
+ */
427
+ exportGaps: ExportGap[];
428
+ /** Reason reconciliation was skipped, for logging. */
429
+ reason?: string;
430
+ /**
431
+ * Short labels for each EXISTING entry whose settings were brought in line
432
+ * with its declaration (e.g. `"queues.consumers/receipt-queue (max_retries)"`).
433
+ * Kept apart from `added` so a retune is not logged as a new binding.
434
+ */
435
+ updated: string[];
436
+ /** Non-fatal hints for capabilities that cannot be auto-provisioned. */
437
+ warnings: string[];
438
+ /** Resolved wrangler path, or `undefined` when none was found. */
439
+ wranglerPath?: string;
440
+ }
441
+ /**
442
+ * The declared-but-not-re-exported containers and workflows, as structured
443
+ * {@link ExportGap}s. The same gaps `collectWarnings` renders into prose — kept
444
+ * here as data so the Vite plugin can raise them in the error overlay with a
445
+ * precise remediation, rather than re-parsing the warning strings.
446
+ *
447
+ * Exported because reconciliation is not the only caller that needs the answer:
448
+ * `lunora codegen` and `lunora doctor` both want the gaps WITHOUT rewriting
449
+ * `wrangler.jsonc`, which is the rest of what {@link reconcileWranglerBindings}
450
+ * does. Deriving them again from `inferred.{containers,workflows,agents}` at each
451
+ * call site is how one kind ends up silently uncovered.
452
+ */
453
+ declare const collectExportGaps: (inferred: InferredBindings) => ExportGap[];
454
+ /**
455
+ * Reconcile inferred Durable Object / D1 bindings into `wrangler.jsonc`.
456
+ *
457
+ * Writes only when something is missing; returns `changed: false` when the
458
+ * config already satisfies the inferred needs.
459
+ *
460
+ * `environment`, when passed, does NOT change where this provisions — every
461
+ * step below still only ADDS to the TOP-LEVEL config; wrangler's `env.<name>`
462
+ * blocks have no auto-provisioning path today. The one write into the block is
463
+ * {@link reconcileEnvQueues}, which retunes queue consumers the block already
464
+ * declares and adds nothing. Otherwise it is used only to emit an
465
+ * advisory warning, because bindings (`durable_objects`, `d1_databases`, …)
466
+ * are non-inheritable (see `wrangler-environment.ts`'s `NON_INHERITABLE_KEYS`):
467
+ * a `--env production` deploy needs its OWN copy of each one, and silently
468
+ * writing only to the top level would leave that gap unmentioned. Extending
469
+ * the JSONC writer itself to target `env.<name>.*` idempotently for every
470
+ * binding kind here is a separate, larger change (each of the ~10 pipeline
471
+ * steps below reads AND writes the top-level path) that this fix does not
472
+ * attempt — `lunora deploy --env <name>` now VALIDATES the env-scoped view
473
+ * (closing the reported gap), it just doesn't yet auto-provision it.
474
+ */
475
+ declare const reconcileWranglerBindings: (projectRoot: string, inferred: InferredBindings, { environment, target }?: {
476
+ environment?: string;
477
+ target?: string;
478
+ }) => ReconcileBindingsResult;
479
+ interface ReconcileCompatibilityDateResult {
480
+ /** `true` when `wrangler.jsonc` was rewritten. */
481
+ changed: boolean;
482
+ /** The new date value, or the existing one when unchanged. */
483
+ date: string | undefined;
484
+ /** Human-readable reason when reconciliation was skipped. */
485
+ reason?: string;
486
+ /** Resolved wrangler path, or `undefined` when none was found. */
487
+ wranglerPath?: string;
488
+ }
489
+ /**
490
+ * Reconcile the `compatibility_date` in `wrangler.jsonc` when Workers Cache
491
+ * is enabled but the date is below the minimum required.
492
+ */
493
+ declare const reconcileWranglerCompatibilityDate: (projectRoot: string) => ReconcileCompatibilityDateResult;
494
+ interface ReconcileResult {
495
+ /** `true` when the wrangler config's `triggers.crons` was rewritten. */
496
+ changed: boolean;
497
+ /**
498
+ * Entries left in `triggers.crons` that this reconciler did not generate and
499
+ * does not own — a hand-written `backupCron` trigger, or anything already
500
+ * there before ownership was first recorded. Non-empty means the array is
501
+ * NOT the codegen-derived set, which is the surprising half of what this
502
+ * does and the one thing worth printing.
503
+ */
504
+ preserved: string[];
505
+ /** Human-readable reason when reconciliation was skipped (for logging). */
506
+ reason?: string;
507
+ /**
508
+ * Problems with the ownership record itself, for the caller to `warn`. A
509
+ * damaged `lunora.crons` is not fatal — the reconciler degrades to add-only
510
+ * — but the degradation is invisible: the generated cron it wrote last pass
511
+ * is reported back as hand-written and is then kept for good. Silence is
512
+ * what turns a merge conflict into a permanent orphan.
513
+ */
514
+ warnings: string[];
515
+ /** Resolved wrangler path, or `undefined` when none was found. */
516
+ wranglerPath?: string;
517
+ }
518
+ /**
519
+ * Reconcile the codegen-derived cron schedules into the project's wrangler
520
+ * config `triggers.crons` array, preserving comments and formatting via
521
+ * `jsonc-parser`'s structural edits.
522
+ *
523
+ * **This does not own the whole array.** Two runtime cron surfaces live on
524
+ * `createWorker` rather than in `lunora/crons.ts`: `backupCron` (the nightly
525
+ * NDJSON backup) and `crons` (handlers keyed by expression). Replacing the array
526
+ * wholesale deleted both on the next `lunora deploy` or dev-server schema save,
527
+ * silently — the nightly backup simply stopped. So an entry this reconciler did
528
+ * not generate is the user's, is kept, and is reported in
529
+ * {@link ReconcileResult.preserved}.
530
+ *
531
+ * Codegen now scans the worker entry for both, so the STATIC case arrives in
532
+ * `cronTriggers` like any declared cron — kept because it is generated, and
533
+ * cleared when the entry stops declaring it. What it cannot resolve is the
534
+ * dynamic case, and that case is supported: `.extend((env) => ({ backupCron:
535
+ * env.NIGHTLY_CRON }))` is the documented escape hatch, and its value exists
536
+ * only at runtime. That residue — plus a computed `crons` key, a spread options
537
+ * object, and anything a project put in `triggers.crons` for its own reasons —
538
+ * is what the preserve rule below is for. It is not redundant with discovery; it
539
+ * is the half discovery provably cannot reach.
540
+ *
541
+ * Ownership is recorded in the project's `package.json` under `lunora.crons`,
542
+ * which is why a REMOVED generated cron still gets cleared (it is in the record
543
+ * and no longer in `cronTriggers`) while a hand-written one never is. Three
544
+ * properties pick that location:
545
+ *
546
+ * COMMITTED, so it survives a fresh clone. Gitignored `.lunora/` state does not:
547
+ * a CI-only deploy finds none, and falling back to add-only there leaves a
548
+ * removed cron firing forever.
549
+ *
550
+ * VALID JSON, so `wrangler.json` — a supported config name — behaves exactly like
551
+ * `wrangler.jsonc`. A `//` marker inside the config does not: wrangler tolerates
552
+ * one in either (both go through its JSONC parser), but the project's own
553
+ * `JSON.parse`, its deploy wrapper and its editor's JSON schema validation all
554
+ * break the moment a `.json` grows a comment. Nor can the record be a plain key
555
+ * in the wrangler config — wrangler reports unknown fields ("Unexpected fields
556
+ * found in top-level field") on every command.
557
+ *
558
+ * READ AND WRITTEN AT ONE ADDRESS. A comment has to be found textually on the way
559
+ * in and positioned structurally on the way out, and those are not the same
560
+ * place: a stale duplicate higher in the file was read as the record and deleted
561
+ * the user's backup trigger.
562
+ *
563
+ * The wrangler config is rewritten only when an entry actually moves, so
564
+ * {@link ReconcileResult.changed} means what a `synced N cron trigger(s)` log
565
+ * claims it means.
566
+ *
567
+ * A project with nothing recorded yet — one predating this, or one with no
568
+ * manifest — treats every entry as the user's, which is the safe direction: a
569
+ * wrongly-kept trigger costs one no-op invocation, a wrongly-deleted one
570
+ * silently ends the backups. It becomes precise after a codegen run that still
571
+ * declares the cron; upgrading and deleting a cron in the same change records an
572
+ * empty set, and that orphan is then kept for good.
573
+ *
574
+ * This intentionally writes the SAME `triggers.crons` shape the
575
+ * `@lunora/config` validator accepts, so the wrangler validator never fights the
576
+ * generated value.
577
+ */
578
+ declare const reconcileWranglerCrons: (projectRoot: string, cronTriggers: ReadonlyArray<string>) => ReconcileResult;
579
+ /**
580
+ * The one log line worth printing for a reconcile that kept entries it does not
581
+ * own, or `undefined` when it owned the whole array. Lives here rather than in
582
+ * each caller because `lunora deploy` and the Vite plugin print it verbatim and
583
+ * had already drifted into two copies of the same sentence.
584
+ */
585
+ declare const describePreservedCrons: (preserved: ReadonlyArray<string>) => string | undefined;
586
+ /** The project coordinates every reconciler here needs. */
587
+ interface ReconcileProject {
588
+ /** Memoises the source scans, so a caller that also validates or reconciles again parses the project once. */
589
+ cache?: DiscoveryCache;
590
+ /** Absolute path to the project root holding `wrangler.jsonc`. */
591
+ projectRoot: string;
592
+ /** The schema directory, relative to `projectRoot` (usually `"lunora"`). */
593
+ schemaDir: string;
594
+ /** The deploy target; wrangler settings only Cloudflare reads are written only for `"cloudflare"` (or when omitted). */
595
+ target?: string;
596
+ }
597
+ /** The two logger methods every reconciler here needs; `info` is optional on Vite's. */
598
+ interface ReconcileLogger {
599
+ info?: (message: string) => void;
600
+ warn: (message: string) => void;
601
+ }
602
+ /**
603
+ * Infer the Cloudflare bindings the project's code implies and reconcile them
604
+ * into `wrangler.jsonc` (Durable Objects, their migration classes, and the
605
+ * `DB` D1 binding for `.global()` schemas). Best-effort and idempotent — runs
606
+ * once at startup so the user never hand-writes binding boilerplate. A failure
607
+ * here must never abort codegen; the wrangler validator reports real problems.
608
+ *
609
+ * `onExportGaps` (dev only) is invoked when a declared container/workflow isn't
610
+ * re-exported by the worker entry, so the caller can raise it in the browser
611
+ * error overlay in addition to the console warning.
612
+ */
613
+ declare const reconcileBindingsSafely: (options: ReconcileProject, logger: ReconcileLogger, onExportGaps?: (gaps: ReadonlyArray<ExportGap>) => void) => Promise<void>;
614
+ /** Reconcile cron triggers and the compatibility date into `wrangler.jsonc`. */
615
+ declare const reconcileWranglerExtras: (projectRoot: string, cronTriggers: ReadonlyArray<string>, logger: ReconcileLogger) => void;
616
+ /**
617
+ * The wrangler config sections Lunora can safely flip to remote mode in dev,
618
+ * each with the human label used in logs and the structural `shape` the entry
619
+ * lives in.
620
+ *
621
+ * `"array"` is a top-level array of binding objects (`d1_databases`,
622
+ * `kv_namespaces`, `r2_buckets`, `vectorize`, `services`). `"producers"` is
623
+ * `queues.producers[]` — consumers are NOT remoted (their schema has no `remote`
624
+ * field) and the edit path is two levels deep. `"object"` is a single binding
625
+ * object, not an array (`ai`), whose edit path targets the section key directly.
626
+ *
627
+ * Every kind here was confirmed against `wrangler/config-schema.json`: the
628
+ * entry's schema declares a `remote` property. Deliberately omits
629
+ * `durable_objects` (no CF remote-DO mode; shards stay local) and sections whose
630
+ * schema has no `remote` field (`hyperdrive`, `analytics_engine_datasets`,
631
+ * `secrets_store_secrets`, queue consumers, …). Widening further is a one-line
632
+ * table edit.
633
+ */
634
+ declare const REMOTE_ELIGIBLE_KEYS: {
635
+ readonly ai: {
636
+ readonly label: "AI";
637
+ readonly shape: "object";
638
+ };
639
+ readonly ai_search: {
640
+ readonly label: "AI Search";
641
+ readonly shape: "array";
642
+ };
643
+ readonly ai_search_namespaces: {
644
+ readonly label: "AI Search namespace";
645
+ readonly shape: "array";
646
+ };
647
+ readonly analytics: {
648
+ readonly label: "Analytics SQL";
649
+ readonly shape: "object";
650
+ };
651
+ readonly d1_databases: {
652
+ readonly label: "D1";
653
+ readonly shape: "array";
654
+ };
655
+ readonly kv_namespaces: {
656
+ readonly label: "KV";
657
+ readonly shape: "array";
658
+ };
659
+ readonly queues: {
660
+ readonly label: "Queue";
661
+ readonly shape: "producers";
662
+ };
663
+ readonly r2_buckets: {
664
+ readonly label: "R2";
665
+ readonly shape: "array";
666
+ };
667
+ readonly services: {
668
+ readonly label: "Service";
669
+ readonly shape: "array";
670
+ };
671
+ readonly vectorize: {
672
+ readonly label: "Vectorize";
673
+ readonly shape: "array";
674
+ };
675
+ };
676
+ type RemoteEligibleKey = keyof typeof REMOTE_ELIGIBLE_KEYS;
677
+ /** One binding object as it appears in any eligible section. */
678
+ interface BindingEntry {
679
+ binding?: string;
680
+ id?: unknown;
681
+ remote?: boolean;
682
+ }
683
+ /** One binding entry we mark remote, with enough provenance to log + edit it. */
684
+ interface RemoteBindingPlan {
685
+ /** The binding name as declared in the config (e.g. `"DB"`, `"FILES"`). */
686
+ binding: string;
687
+ /** Short kind label for logging (`"D1"`, `"KV"`, `"R2"`, `"Vectorize"`, …). */
688
+ kind: string;
689
+ /**
690
+ * The jsonc edit path within {@link RemoteBindingPlan.section}, relative to
691
+ * the section key: `[index]` for an `"array"` section, `["producers", index]`
692
+ * for a queue producer, or `[]` for the single-object `ai` section. The
693
+ * materializer prepends the section key and appends `"remote"`.
694
+ */
695
+ path: ReadonlyArray<number | string>;
696
+ /** The wrangler config key the entry lives under. */
697
+ section: RemoteEligibleKey;
698
+ }
699
+ /** The structural slice of a wrangler config the remote planner reads. */
700
+ interface RemoteWranglerShape {
701
+ ai?: BindingEntry | null;
702
+ ai_search?: ReadonlyArray<BindingEntry | null | undefined>;
703
+ ai_search_namespaces?: ReadonlyArray<BindingEntry | null | undefined>;
704
+ analytics?: BindingEntry | null;
705
+ artifacts?: ReadonlyArray<BindingEntry | null | undefined>;
706
+ d1_databases?: ReadonlyArray<BindingEntry | null | undefined>;
707
+ kv_namespaces?: ReadonlyArray<BindingEntry | null | undefined>;
708
+ queues?: {
709
+ producers?: ReadonlyArray<BindingEntry | null | undefined>;
710
+ } | null;
711
+ r2_buckets?: ReadonlyArray<BindingEntry | null | undefined>;
712
+ services?: ReadonlyArray<BindingEntry | null | undefined>;
713
+ vectorize?: ReadonlyArray<BindingEntry | null | undefined>;
714
+ }
715
+ /**
716
+ * Inspect a parsed wrangler config and list every eligible binding that should
717
+ * be flipped to remote mode. Pure — no file-system access, no mutation. An
718
+ * entry already carrying `"remote": true` is still reported (so logging is
719
+ * complete) but the materializer's edit is a harmless no-op for it.
720
+ */
721
+ declare const planRemoteBindings: (parsed: RemoteWranglerShape) => RemoteBindingPlan[];
722
+ /**
723
+ * Inject `"remote": true` onto each planned binding in the config `text`,
724
+ * comment-preservingly via jsonc edits. Pure string→string; the edits target
725
+ * disjoint entries so applying them sequentially is safe. The edit path is
726
+ * `[section, ...plan.path, "remote"]`, which resolves to the array element, the
727
+ * `queues.producers[i]` entry, or the single `ai` object as the plan demands.
728
+ */
729
+ declare const injectRemoteFlags: (text: string, plans: ReadonlyArray<RemoteBindingPlan>) => string;
730
+ interface MaterializeDevOptions {
731
+ /** Whether wrangler can authenticate; defaults to a probe of `projectRoot`. */
732
+ hasCredentials?: () => boolean;
733
+ projectRoot: string;
734
+ /** Proxy the eligible bindings to the deployed resources (`--remote` / `LUNORA_REMOTE`). Off, only the logged-out `ai` withholding applies. */
735
+ remote: boolean;
736
+ }
737
+ interface MaterializeDevResult {
738
+ /** Removes the temp config. Always safe to call: idempotent, and a no-op when nothing was written. */
739
+ cleanup: () => void;
740
+ /** The temp config to pass to `wrangler dev --config`, or `undefined` to run the user's file unchanged. */
741
+ configPath?: string;
742
+ /** Why remote mode produced no temp config, for the dev log. Only set when nothing was written. */
743
+ reason?: string;
744
+ /** The bindings flipped to remote, for the dev banner. */
745
+ remoteBindings: RemoteBindingPlan[];
746
+ /** The `ai` binding name left out for lack of Cloudflare credentials, for the dev warning. */
747
+ withheld: WithheldBinding[];
748
+ }
749
+ /**
750
+ * Write the temp wrangler config a dev session runs with: the user's file with any
751
+ * eligible bindings flipped to `"remote": true` (when `remote` is set), and the
752
+ * `ai` binding removed when the session has no Cloudflare login. See `dev-config.ts`
753
+ * for why the `ai` removal exists.
754
+ *
755
+ * The temp file sits beside the source `wrangler.jsonc`, not in an OS temp dir,
756
+ * because wrangler resolves a config's relative `main`/`assets`/`migrations_dir`
757
+ * paths against the config file's own directory. Returns no `configPath` when there
758
+ * is nothing to change, so the caller runs the user's file unchanged.
759
+ */
760
+ declare const materializeDevWranglerConfig: (options: MaterializeDevOptions) => MaterializeDevResult;
761
+ /**
762
+ * Parse a `LUNORA_REMOTE` env value into the on/off decision. Truthy when set to
763
+ * `"1"` or `"true"` (case-insensitive); anything else — unset, `"0"`, `"false"`,
764
+ * empty — is off. Mirrors the `"1" | "true"` convention used across the runtime.
765
+ */
766
+ declare const isRemoteEnvEnabled: (value: string | undefined) => boolean;
767
+ /** The three inputs that can switch remote-binding dev on, in precedence order. */
768
+ interface RemoteEnableInputs {
769
+ /**
770
+ * The `remote` preference from `lunora.config.*` (the lowest-priority signal).
771
+ * `undefined` means "no project preference"; an explicit `false` here loses
772
+ * to neither the flag nor the env when those are absent — it just stays off.
773
+ */
774
+ configPreference?: boolean;
775
+ /** The raw `LUNORA_REMOTE` env value (parsed with {@link isRemoteEnvEnabled}). */
776
+ envValue?: string;
777
+ /** The explicit `--remote` CLI flag — `true` when passed, `undefined`/`false` otherwise. */
778
+ flag?: boolean;
779
+ }
780
+ /**
781
+ * Resolve whether remote-binding dev is on, with a clear precedence:
782
+ *
783
+ * 1. an explicit `--remote` flag (highest — a deliberate per-invocation choice),
784
+ * 2. then `LUNORA_REMOTE` in the environment,
785
+ * 3. then the `remote` key in `lunora.config.*` (lowest — a project default).
786
+ *
787
+ * The flag and env are one-directional (they can only turn remote *on*); only
788
+ * the config preference carries a meaningful `false`, and it applies solely when
789
+ * neither stronger signal is present. So a project that sets `"remote": false`
790
+ * is still overridable per-run by `--remote` or `LUNORA_REMOTE=1`.
791
+ */
792
+ declare const resolveRemoteEnabled: (inputs: RemoteEnableInputs) => boolean;
793
+ /** The configs to pass as `--config`, in input order, and what was done to them. */
794
+ interface ServiceDevConfigs {
795
+ /** Unlinks every copy written. Idempotent, never throws — a no-op when none was. */
796
+ cleanup: () => void;
797
+ configPaths: string[];
798
+ /** The remote-only bindings (`ai`, `artifacts`) left out of a service copy for lack of Cloudflare credentials, for the dev warning. */
799
+ withheld: WithheldBinding[];
800
+ }
801
+ interface ServiceMaterializeOptions {
802
+ /** Whether wrangler can authenticate; defaults to a probe of `projectRoot`. */
803
+ hasCredentials?: () => boolean;
804
+ /** The app's folder, where `wrangler dev` runs and whose `.env` files it reads. */
805
+ projectRoot: string;
806
+ }
807
+ /**
808
+ * Resolve the `--config` path of each service the shared `wrangler dev` session
809
+ * runs, writing a copy only for a service that needs one (see the module doc).
810
+ */
811
+ declare const materializeServiceDevConfigs: (wranglerPaths: ReadonlyArray<string>, options: ServiceMaterializeOptions) => ServiceDevConfigs;
812
+ /**
813
+ * The Cloudflare toolchain ranges a scaffolded Lunora app declares — the one
814
+ * source for `lunora init`'s overlay. The `templates/*` starters are fetched at
815
+ * runtime and cannot import this, so `tests/vis-templates` asserts that every
816
+ * template declaring one of these packages declares exactly this range.
817
+ *
818
+ * `@cloudflare/workers-types` is on the v5 line: v4 ended at 4.20260702.1, and
819
+ * v5's root entrypoint is the latest runtime (AI Search, Artifacts, Analytics
820
+ * SQL, tracing `setStatus`). `wrangler` >= 4.145.0 accepts the Analytics SQL
821
+ * `analytics` binding that `ctx.analyticsSql` makes `lunora dev` write, and
822
+ * >= 4.142.0 declares and runs Workflows in `exports`, which codegen writes.
823
+ * `@cloudflare/vite-plugin` matches the wrangler it embeds.
824
+ *
825
+ * Bump it together with the `cloudflare` / `vite` catalogs in `pnpm-workspace.yaml`.
826
+ */
827
+ declare const CLOUDFLARE_TOOLCHAIN_VERSIONS: Readonly<Record<"@cloudflare/vite-plugin" | "@cloudflare/workers-types" | "wrangler", string>>;
828
+ /** The `wrangler.jsonc` shape the validator reads, and the report it returns. */
829
+ interface WranglerDurableObjectBinding {
830
+ class_name?: string;
831
+ name?: string;
832
+ /** Present when the class lives in ANOTHER Worker — then it is that script's to export, not this entry's. */
833
+ script_name?: string;
834
+ }
835
+ /**
836
+ * A `tail_consumers` entry: a Worker that receives this Worker's tail events
837
+ * (logs, exceptions, fetch metadata) for forwarding to an external sink. See
838
+ * `withTailConsumer` for the wiring helper.
839
+ */
840
+ interface TailConsumer {
841
+ /** Optional Cloudflare environment of the consumer Worker. */
842
+ environment?: string;
843
+ /** Name of the Worker that consumes tail events. */
844
+ service?: string;
845
+ }
846
+ /**
847
+ * `observability.traces` — Workers Traces. `destinations` names OpenTelemetry
848
+ * export destinations configured in the dashboard; `persist: false` exports
849
+ * without also storing in Cloudflare (default `true`).
850
+ * https://developers.cloudflare.com/workers/observability/opentelemetry-export/
851
+ */
852
+ interface WranglerObservabilityTraces {
853
+ destinations?: ReadonlyArray<string>;
854
+ enabled?: boolean;
855
+ /** Fraction of requests traced, 0–1. */
856
+ head_sampling_rate?: number;
857
+ persist?: boolean;
858
+ }
859
+ /**
860
+ * `observability.logs` — Workers Logs. Same export knobs as traces, plus
861
+ * `invocation_logs` (the per-invocation summary line; default `true`).
862
+ */
863
+ interface WranglerObservabilityLogs extends WranglerObservabilityTraces {
864
+ invocation_logs?: boolean;
865
+ }
866
+ /** The wrangler `observability` block (Workers Logs + Traces). */
867
+ interface WranglerObservability {
868
+ enabled?: boolean;
869
+ /** Fraction of requests logged, 0–1 (wrangler's default is 1: every request). */
870
+ head_sampling_rate?: number;
871
+ /** Workers Issues — detects and groups production failures. */
872
+ issues?: {
873
+ enabled?: boolean;
874
+ };
875
+ logs?: WranglerObservabilityLogs;
876
+ /** Strip query strings from request URLs in logs and traces (wrangler's default is `false`). */
877
+ redact_query_string?: boolean;
878
+ traces?: WranglerObservabilityTraces;
879
+ }
880
+ /**
881
+ * The `observability` block Lunora writes when a project has none — by
882
+ * `lunora dev`'s binding reconcile and by `lunora init`'s scaffold. Logs on,
883
+ * every request sampled: the right default while an app is small, and what
884
+ * `lunora doctor`'s `observability-full-sampling` advisory then flags once
885
+ * Workers Observability is billed. One constant so the writers and the doctor
886
+ * cannot drift apart.
887
+ */
888
+ declare const DEFAULT_OBSERVABILITY: Readonly<{
889
+ enabled: true;
890
+ head_sampling_rate: 1;
891
+ }>;
892
+ /** One signal's effective sampling, as {@link resolveObservabilitySampling} resolves it. */
893
+ interface ObservabilitySignalSampling {
894
+ enabled: boolean;
895
+ /** Fraction of requests sampled, 0–1. */
896
+ headSamplingRate: number;
897
+ }
898
+ /**
899
+ * The effective logs / traces sampling an `observability` block deploys with,
900
+ * defaults applied. An absent block is {@link DEFAULT_OBSERVABILITY}, which is
901
+ * what Lunora reconciles it to. Inside a present block, logs are on unless the
902
+ * block (or its `logs` sub-block) turns them off; traces are opt-in
903
+ * (`traces.enabled: true`); and an unset rate is wrangler's own default of 1.
904
+ * `logs.*` overrides the top-level switch and rate.
905
+ */
906
+ declare const resolveObservabilitySampling: (block: WranglerObservability | undefined) => {
907
+ logs: ObservabilitySignalSampling;
908
+ traces: ObservabilitySignalSampling;
909
+ };
910
+ /** A wrangler `containers[]` entry (parsed from untrusted JSONC). */
911
+ interface WranglerContainerEntry {
912
+ class_name?: string;
913
+ image?: string;
914
+ /** Named images under the `durable_object` scheduling policy. */
915
+ images?: Record<string, {
916
+ build_context?: string;
917
+ build_vars?: Record<string, string>;
918
+ dockerfile?: string;
919
+ image?: string;
920
+ } | null | undefined>;
921
+ instance_type?: string | {
922
+ disk_mb?: number;
923
+ memory_mib?: number;
924
+ vcpu?: number;
925
+ };
926
+ max_instances?: number;
927
+ scheduling_policy?: string;
928
+ }
929
+ /**
930
+ * A wrangler `workflows[]` entry (parsed from untrusted JSONC). Unlike
931
+ * containers, workflows are NOT Durable Objects — the entry stands alone (no
932
+ * `durable_objects` binding, no migration class).
933
+ */
934
+ interface WranglerWorkflowEntry {
935
+ binding?: string;
936
+ class_name?: string;
937
+ /** `{ success_retention?, error_retention? }` durations; shape-checked by `validateWorkflowSettings`. */
938
+ default_retention?: unknown;
939
+ /** `{ steps? }`; shape-checked by `validateWorkflowSettings`. */
940
+ limits?: unknown;
941
+ name?: string;
942
+ /** Cron strings that each start an instance; shape-checked by `validateWorkflowSettings`. */
943
+ schedules?: unknown;
944
+ /** Present when the class lives in ANOTHER Worker — then it is that script's to export. */
945
+ script_name?: string;
946
+ }
947
+ /** A wrangler `queues.producers[]` entry — a `Queue` binding sending to `queue`. */
948
+ interface WranglerQueueProducer {
949
+ binding?: string;
950
+ delivery_delay?: number;
951
+ queue?: string;
952
+ }
953
+ /** A wrangler `queues.consumers[]` entry — push (worker) or `type: "http_pull"`. */
954
+ interface WranglerQueueConsumer {
955
+ dead_letter_queue?: string;
956
+ max_batch_size?: number;
957
+ max_batch_timeout?: number;
958
+ max_concurrency?: number;
959
+ max_retries?: number;
960
+ queue?: string;
961
+ retry_delay?: number;
962
+ type?: string;
963
+ }
964
+ interface WranglerConfig {
965
+ account_id?: unknown;
966
+ ai?: {
967
+ binding?: unknown;
968
+ } | null;
969
+ ai_search?: ReadonlyArray<{
970
+ binding?: string;
971
+ instance_name?: string;
972
+ remote?: boolean;
973
+ } | null | undefined>;
974
+ ai_search_namespaces?: ReadonlyArray<{
975
+ binding?: string;
976
+ namespace?: string;
977
+ remote?: boolean;
978
+ } | null | undefined>;
979
+ analytics?: {
980
+ binding?: unknown;
981
+ remote?: boolean;
982
+ } | null;
983
+ analytics_engine_datasets?: ReadonlyArray<{
984
+ binding?: string;
985
+ dataset?: string;
986
+ } | null | undefined>;
987
+ artifacts?: ReadonlyArray<{
988
+ binding?: string;
989
+ namespace?: string;
990
+ remote?: boolean;
991
+ } | null | undefined>;
992
+ assets?: {
993
+ binding?: string;
994
+ directory?: string;
995
+ html_handling?: string;
996
+ not_found_handling?: string;
997
+ };
998
+ browser?: {
999
+ binding?: string;
1000
+ };
1001
+ cache?: {
1002
+ enabled?: boolean;
1003
+ } | null;
1004
+ compatibility_date?: string;
1005
+ compatibility_flags?: ReadonlyArray<string>;
1006
+ containers?: ReadonlyArray<WranglerContainerEntry | null | undefined>;
1007
+ d1_databases?: ReadonlyArray<{
1008
+ binding?: string;
1009
+ database_id?: string;
1010
+ database_name?: string;
1011
+ migrations_dir?: string;
1012
+ migrations_pattern?: string;
1013
+ } | null | undefined>;
1014
+ dispatch_namespaces?: ReadonlyArray<{
1015
+ binding?: string;
1016
+ namespace?: string;
1017
+ outbound?: unknown;
1018
+ } | null | undefined>;
1019
+ durable_objects?: {
1020
+ bindings?: ReadonlyArray<WranglerDurableObjectBinding>;
1021
+ };
1022
+ env?: Record<string, WranglerConfig>;
1023
+ exports?: Record<string, {
1024
+ cache?: {
1025
+ enabled?: boolean;
1026
+ } | null;
1027
+ default_retention?: unknown;
1028
+ limits?: unknown;
1029
+ name?: unknown;
1030
+ schedules?: unknown;
1031
+ type?: string;
1032
+ } | null> | null;
1033
+ flagship?: ReadonlyArray<{
1034
+ app_id?: string;
1035
+ binding?: string;
1036
+ } | null | undefined>;
1037
+ hyperdrive?: ReadonlyArray<{
1038
+ binding?: string;
1039
+ id?: string;
1040
+ localConnectionString?: string;
1041
+ } | null | undefined>;
1042
+ images?: {
1043
+ binding?: string;
1044
+ };
1045
+ k2?: ReadonlyArray<unknown>;
1046
+ kv_namespaces?: ReadonlyArray<{
1047
+ binding?: string;
1048
+ id?: string;
1049
+ } | null | undefined>;
1050
+ limits?: {
1051
+ cpu_ms?: number;
1052
+ };
1053
+ logpush?: boolean;
1054
+ main?: string;
1055
+ media?: {
1056
+ binding?: string;
1057
+ };
1058
+ migrations?: ReadonlyArray<{
1059
+ deleted_classes?: ReadonlyArray<string>;
1060
+ new_classes?: ReadonlyArray<string>;
1061
+ new_sqlite_classes?: ReadonlyArray<string>;
1062
+ renamed_classes?: ReadonlyArray<{
1063
+ from?: string;
1064
+ to?: string;
1065
+ } | null | undefined>;
1066
+ } | null | undefined>;
1067
+ mtls_certificates?: ReadonlyArray<{
1068
+ binding?: string;
1069
+ certificate_id?: string;
1070
+ } | null | undefined>;
1071
+ observability?: WranglerObservability;
1072
+ pipelines?: ReadonlyArray<{
1073
+ binding?: string;
1074
+ pipeline?: string;
1075
+ stream?: string;
1076
+ } | null | undefined>;
1077
+ placement?: {
1078
+ host?: string;
1079
+ hostname?: string;
1080
+ mode?: string;
1081
+ region?: string;
1082
+ };
1083
+ queues?: {
1084
+ consumers?: ReadonlyArray<WranglerQueueConsumer | null | undefined>;
1085
+ producers?: ReadonlyArray<WranglerQueueProducer | null | undefined>;
1086
+ };
1087
+ r2_buckets?: ReadonlyArray<{
1088
+ binding?: string;
1089
+ bucket_name?: string;
1090
+ jurisdiction?: string;
1091
+ } | null | undefined>;
1092
+ secrets?: {
1093
+ required?: unknown;
1094
+ } | null;
1095
+ secrets_store_secrets?: ReadonlyArray<{
1096
+ binding?: string;
1097
+ secret_name?: string;
1098
+ store_id?: string;
1099
+ } | null | undefined>;
1100
+ send_email?: ReadonlyArray<{
1101
+ allowed_destination_addresses?: ReadonlyArray<string>;
1102
+ destination_address?: string;
1103
+ name?: string;
1104
+ } | null | undefined>;
1105
+ services?: ReadonlyArray<{
1106
+ binding?: string;
1107
+ entrypoint?: string;
1108
+ environment?: string;
1109
+ service?: string;
1110
+ } | null | undefined>;
1111
+ stream?: {
1112
+ binding?: string;
1113
+ };
1114
+ tail_consumers?: ReadonlyArray<TailConsumer | null | undefined>;
1115
+ vars?: Record<string, unknown>;
1116
+ vectorize?: ReadonlyArray<{
1117
+ binding?: string;
1118
+ index_name?: string;
1119
+ } | null | undefined>;
1120
+ vpc_networks?: ReadonlyArray<{
1121
+ binding?: string;
1122
+ network_id?: string;
1123
+ remote?: boolean;
1124
+ tunnel_id?: string;
1125
+ } | null | undefined>;
1126
+ vpc_services?: ReadonlyArray<{
1127
+ binding?: string;
1128
+ remote?: boolean;
1129
+ service_id?: string;
1130
+ } | null | undefined>;
1131
+ workflows?: ReadonlyArray<WranglerWorkflowEntry | null | undefined>;
1132
+ }
1133
+ interface WranglerValidationReport {
1134
+ errors: string[];
1135
+ valid: boolean;
1136
+ warnings: string[];
1137
+ }
1138
+ /**
1139
+ * Return a new `WranglerConfig` with `consumer` present in `tail_consumers`,
1140
+ * wiring this Worker to forward its tail events (logs/exceptions) to another
1141
+ * Worker that fans them out to an external sink. Pure and idempotent: an
1142
+ * existing entry with the same `service` + `environment` is left untouched
1143
+ * rather than duplicated, so it is safe to call on every codegen/deploy.
1144
+ */
1145
+ declare const withTailConsumer: (wrangler: WranglerConfig, consumer: TailConsumer) => WranglerConfig;
1146
+ /**
1147
+ * Single source of truth for "does this wrangler config enable Workers
1148
+ * Cache?" and "what compatibility_date does that require?".
1149
+ *
1150
+ * Before this module, `reconcile-compatibility-date.ts` (auto-bump) and
1151
+ * `wrangler-validator.ts` (validation) each carried their own
1152
+ * `WORKERS_CACHE_MIN_DATE` literal and their own top-level/`exports[]`
1153
+ * cache-enabled walk — two copies of the same fact that could silently drift
1154
+ * apart (a date bumped in one file without the other would either validate a
1155
+ * config the reconciler wouldn't produce, or vice versa).
1156
+ */
1157
+ /** The `compatibility_date` Workers Cache (`cache.enabled: true`) requires. */
1158
+ declare const WORKERS_CACHE_MIN_DATE = "2026-05-01";
1159
+ /** The subset of a parsed `wrangler.jsonc` the cache-enabled check reads. */
1160
+ interface WranglerCacheShape {
1161
+ cache?: {
1162
+ enabled?: boolean;
1163
+ } | null;
1164
+ exports?: Record<string, {
1165
+ cache?: {
1166
+ enabled?: boolean;
1167
+ } | null;
1168
+ } | null> | null;
1169
+ }
1170
+ /**
1171
+ * Whether Workers Cache is enabled anywhere in a parsed wrangler config — the
1172
+ * top-level `cache.enabled` toggle, or a per-export override in
1173
+ * `exports[name].cache.enabled` (Workers can scope cache per named export).
1174
+ * `undefined`/`null` (an unparsed or absent config) is treated as disabled.
1175
+ */
1176
+ declare const isCacheEnabled: (parsed: WranglerCacheShape | null | undefined) => boolean;
1177
+ interface WranglerCodegenInputs {
1178
+ /** Every well-formed `queues.producers[]` entry of the top level and each `env.<name>` block. */
1179
+ wranglerQueueProducers: WranglerQueueProducerIR[];
1180
+ /** Top-level `vars` entries that look like plaintext secrets. */
1181
+ wranglerVariables: WranglerVariableIR[];
1182
+ }
1183
+ /** Both inputs are empty when there is no wrangler config or it does not parse. */
1184
+ declare const wranglerCodegenInputs: (projectRoot: string) => WranglerCodegenInputs;
1185
+ interface WranglerEnvironmentMerge {
1186
+ /** Set when `environment` names no `env.<name>` block declared in the config — the caller should treat this as a hard validation failure. */
1187
+ error?: string;
1188
+ /** The env-scoped view: `wrangler` unchanged when `environment` is `undefined`, otherwise merged per {@link NON_INHERITABLE_KEYS} / {@link INHERITABLE_KEYS}. */
1189
+ merged: WranglerConfig;
1190
+ /**
1191
+ * Keys the env block overrides whose inheritance status this validator
1192
+ * cannot verify (not in either table above) — validated against the
1193
+ * TOP-LEVEL value only, per the "do not guess" rule; the override is
1194
+ * silently ignored for validation purposes. The caller logs this ONCE
1195
+ * (not per key) so an unusual `env.<name>` block doesn't spam warnings.
1196
+ */
1197
+ unverifiedKeys: string[];
1198
+ }
1199
+ /**
1200
+ * Resolve the config view `wrangler deploy --env <environment>` will actually
1201
+ * use. Undefined `environment` returns `wrangler` unchanged — the top-level
1202
+ * config is what a plain `wrangler deploy` reads, same as today.
1203
+ *
1204
+ * Deliberately independent of any other merge in this module: called fresh
1205
+ * from the ORIGINAL `wrangler` each time (see both call sites), so there is
1206
+ * no risk of merging an already-merged config and silently losing the
1207
+ * top-level fallback a second merge pass would no longer have access to.
1208
+ */
1209
+ declare const mergeWranglerEnvironment: (wrangler: WranglerConfig, environment: string | undefined) => WranglerEnvironmentMerge;
1210
+ /** Candidate wrangler config filenames, in the order every consumer probes them. */
1211
+ declare const WRANGLER_FILES: readonly ["wrangler.jsonc", "wrangler.json"];
1212
+ /** Locate the project's wrangler config, or `undefined` when none exists. */
1213
+ declare const findWranglerFile: (projectRoot: string) => string | undefined;
1214
+ interface ReadWranglerResult<T> {
1215
+ /** Parsed config, or `undefined` when the file was not valid JSONC. */
1216
+ parsed: T | undefined;
1217
+ /** Raw file text — needed for comment-preserving `modify`/`applyEdits`. */
1218
+ text: string;
1219
+ }
1220
+ /**
1221
+ * Read and JSONC-parse a wrangler config file. Returns the raw `text` (for
1222
+ * structural edits) alongside `parsed`, which is `undefined` when the file is
1223
+ * not valid JSONC or does not parse to an object. Allows trailing commas, as
1224
+ * wrangler does.
1225
+ */
1226
+ declare const readWranglerJsonc: <T = unknown>(wranglerPath: string) => ReadWranglerResult<T>;
1227
+ interface WranglerProjectValidationOptions {
1228
+ /** Memoises the schema discovery, shared with binding inference. */
1229
+ cache?: DiscoveryCache;
1230
+ /**
1231
+ * Cloudflare environment to validate against `env.<name>` in
1232
+ * wrangler.jsonc. See {@link mergeWranglerEnvironment} for which keys
1233
+ * inherit the top-level value vs must be redeclared per environment.
1234
+ * Omit to validate the top-level config only (unchanged default).
1235
+ */
1236
+ environment?: string;
1237
+ projectRoot: string;
1238
+ schemaDir?: string;
1239
+ }
1240
+ interface WranglerProjectValidationResult {
1241
+ problems: ReadonlyArray<string>;
1242
+ report: WranglerValidationReport;
1243
+ wranglerPath: string | undefined;
1244
+ }
1245
+ /**
1246
+ * The phrase every unexported-class error carries.
1247
+ *
1248
+ * Exported because it is a CONTRACT, not prose: `lunora doctor` picks these
1249
+ * errors out of the report by substring to raise its own finding, and the
1250
+ * validator's report is a flat `string[]`. Until the report entries carry a
1251
+ * code, a copy-edit here would silently disable that check — so the copy-edit
1252
+ * has to go through this constant.
1253
+ */
1254
+ declare const UNEXPORTED_CLASS_MARKER = "does not export it";
1255
+ /**
1256
+ * File-system aware variant: reads `wrangler.jsonc`/`wrangler.json` from
1257
+ * the given project root, discovers the schema (if any), and delegates to
1258
+ * `validateWranglerConfig`. Returns the legacy
1259
+ * `{ problems, wranglerPath }` shape plus the structured `report`.
1260
+ */
1261
+ declare const validateWranglerProject: (options: WranglerProjectValidationOptions) => WranglerProjectValidationResult;
1262
+ /**
1263
+ * Pure scan of a `vars` map for plaintext secrets — the FS-free core, exported for
1264
+ * unit tests. A variable is flagged when, for a **string** value that is neither a
1265
+ * placeholder nor a public/publishable key, EITHER the value matches a known
1266
+ * secret shape (`secretKindOf`) OR the key name strongly implies a secret and the
1267
+ * value is long enough to plausibly be one. `kind` is the matched shape, or
1268
+ * `secret_named_var` for the key-name path.
1269
+ */
1270
+ declare const scanWranglerVariablesForSecrets: (variables: Record<string, unknown> | undefined, file: string) => WranglerVariableIR[];
1271
+ declare const REQUIRED_COMPATIBILITY_DATE: string;
1272
+ declare const REQUIRED_FLAG: string;
1273
+ /**
1274
+ * Pure validator: given a parsed `WranglerConfig` object and an optional
1275
+ * `SchemaInfo`, produce a structured report. Performs no I/O.
1276
+ *
1277
+ * `environment`, when set, validates the `env.<environment>` view
1278
+ * ({@link mergeWranglerEnvironment}) instead of the top-level config — e.g. a
1279
+ * `durable_objects` binding present only at the top level is a validation
1280
+ * FAILURE for `--env production` if `env.production` doesn't repeat it,
1281
+ * because `durable_objects` is non-inheritable and wrangler will not carry it
1282
+ * over. Omit `environment` to validate the top level only (unchanged default).
1283
+ */
1284
+ declare const validateWranglerConfig: (wranglerInput: WranglerConfig | undefined, schema?: SchemaInfo, environment?: string) => WranglerValidationReport;
1285
+ /**
1286
+ * Convenience alias matching the original task-spec signature
1287
+ * `validateWrangler(wranglerJson, schema)` returning
1288
+ * `{ valid, errors, warnings }`.
1289
+ */
1290
+ declare const validateWrangler: typeof validateWranglerConfig;
1291
+ export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_CLI_CONFIG_WARNING_ENV, CLOUDFLARE_DRIVER, CLOUDFLARE_TOOLCHAIN_VERSIONS, type CloudflareCliConfigFinding, type CloudflareCredentialProbe, DEFAULT_OBSERVABILITY, type DevConfigKind, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, type LocalHyperdrive, type ManifestConfigShape, type MaterializeDevOptions, type MaterializeDevResult, type ObservabilitySignalSampling, REMOTE_ELIGIBLE_KEYS, REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type ReadWranglerResult, type ReconcileBindingsResult, type ReconcileCompatibilityDateResult, type ReconcileResult as ReconcileCronsResult, type ReconcileProject, type RemoteBindingPlan, type RemoteEnableInputs, type RemoteWranglerShape, type ServiceDevConfigs, type TailConsumer, UNEXPORTED_CLASS_MARKER, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WithheldBinding, type WranglerCacheShape, type WranglerCodegenInputs, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
1292
+ /**
1293
+ * `@lunora/config/cloudflare` — the wrangler layer.
1294
+ *
1295
+ * Everything here speaks `wrangler.jsonc`: validating it, reconciling inferred
1296
+ * bindings/crons/compatibility-date into it, resolving remote bindings, and the
1297
+ * `DeployDriver` that ties them together for `--target cloudflare`.
1298
+ *
1299
+ * Split out from the package root so `@lunora/config` itself stays
1300
+ * provider-neutral. The root keeps what any target needs — the `DeployDriver`
1301
+ * contract, the driver registry, project config and target resolution,
1302
+ * `.dev.vars` grammar, binding *inference* — while emission and validation,
1303
+ * which are wrangler-shaped by definition, live behind this subpath.
1304
+ * Plan 114 §5.3 (D6): a package carrying real provider code isolates it behind a
1305
+ * subpath rather than relocating wholesale.
1306
+ */
1307
+ applyModify, assertWranglerSatisfiesSchema, bindingsNeedingDatabase, buildBindingManifest, collectExportGaps, describePreservedCrons, describeWithheld, detectCloudflareCliConfig, findWranglerFile, hasCloudflareCredentials, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeDevWranglerConfig, materializeServiceDevConfigs, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileBindingsSafely, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, reconcileWranglerExtras, resolveObservabilitySampling, resolveRemoteEnabled, scanWranglerVariablesForSecrets, startLocalHyperdrive, validateWrangler, validateWranglerConfig, validateWranglerProject, warnCloudflareCliConfigOnce, withTailConsumer, withheldBindings, wranglerCodegenInputs, wranglerToAlchemy };