@lunora/config 1.0.0-alpha.46 → 1.0.0-alpha.461

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