@lunora/config 1.0.0-alpha.39 → 1.0.0-alpha.390

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