@lunora/config 1.0.0-alpha.47 → 1.0.0-alpha.471

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 (170) hide show
  1. package/LICENSE.md +336 -104
  2. package/README.md +6 -6
  3. package/dist/celld/index.d.mts +77 -0
  4. package/dist/celld/index.d.ts +77 -0
  5. package/dist/celld/index.mjs +1 -0
  6. package/dist/celld-names/index.d.mts +57 -0
  7. package/dist/celld-names/index.d.ts +57 -0
  8. package/dist/celld-names/index.mjs +1 -0
  9. package/dist/cli/index.d.mts +2 -0
  10. package/dist/cli/index.d.ts +2 -0
  11. package/dist/cli/index.mjs +1 -0
  12. package/dist/cloudflare/index.d.mts +941 -0
  13. package/dist/cloudflare/index.d.ts +941 -0
  14. package/dist/cloudflare/index.mjs +1 -0
  15. package/dist/index.d.mts +1068 -1044
  16. package/dist/index.d.ts +1068 -1044
  17. package/dist/index.mjs +1 -25
  18. package/dist/packem_shared/ACCENT-CotPTfv7.mjs +7 -0
  19. package/dist/packem_shared/ADVISOR_PROCEDURES_ENDPOINT-BPnqzAgT.mjs +1 -0
  20. package/dist/packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs +1 -0
  21. package/dist/packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs +1 -0
  22. package/dist/packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs +1 -0
  23. package/dist/packem_shared/BINDING_MANIFEST_VERSION-CR06-eW7.mjs +1 -0
  24. package/dist/packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs +1 -0
  25. package/dist/packem_shared/CELLD_RELEASE_ASSETS_DIRECTORY-YBhEotjs.mjs +1 -0
  26. package/dist/packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-75Y5zVF8.mjs +1 -0
  27. package/dist/packem_shared/CLOUDFLARE_DRIVER-DbmpoIcg.mjs +1 -0
  28. package/dist/packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DWyZ_2QM.mjs +1 -0
  29. package/dist/packem_shared/COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs +1 -0
  30. package/dist/packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs +1 -0
  31. package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-BlvZ242-.mjs +1 -0
  32. package/dist/packem_shared/DEFAULT_OBSERVABILITY-CPLADr5u.mjs +1 -0
  33. package/dist/packem_shared/DEV_BINDINGS_FILE-BUTedHwq.mjs +4 -0
  34. package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs +6 -0
  35. package/dist/packem_shared/DEV_WORKER_ENV_VALUE-FoysLtF0.mjs +1 -0
  36. package/dist/packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs +1 -0
  37. package/dist/packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs +2 -0
  38. package/dist/packem_shared/LUNORA_EVENT_SOURCE-Cq0oj0_9.mjs +9 -0
  39. package/dist/packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs +19 -0
  40. package/dist/packem_shared/LUNORA_TAG-DQTGPqcJ.mjs +1 -0
  41. package/dist/packem_shared/LunoraReporter-f277GLNT.mjs +6 -0
  42. package/dist/packem_shared/MissingBuildOutputError-BAyekzof.mjs +1 -0
  43. package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs +1 -0
  44. package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-BiQ1zNsR.mjs +1 -0
  45. package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-DgmXfSuu.mjs +1 -0
  46. package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-BqFeetpX.mjs +1 -0
  47. package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-D296PlpV.mjs +1 -0
  48. package/dist/packem_shared/SEED_ENDPOINT-C1fhrehH.mjs +1 -0
  49. package/dist/packem_shared/STUDIO_PATH-CvVcvTbQ.mjs +1 -0
  50. package/dist/packem_shared/STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs +1 -0
  51. package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-BZEXldUo.mjs +1 -0
  52. package/dist/packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs +1 -0
  53. package/dist/packem_shared/WRANGLER_FILES-BF8PUjuo.mjs +1 -0
  54. package/dist/packem_shared/acceptsConnection-DHhUYGjT.mjs +2 -0
  55. package/dist/packem_shared/addArgsFor-CYZKhNIo.mjs +1 -0
  56. package/dist/packem_shared/applyAdditiveEdit-DEwPKcJg.mjs +6 -0
  57. package/dist/packem_shared/applyModify-DKP2l6S9.mjs +1 -0
  58. package/dist/packem_shared/assertBuildTargetMatches-D11J7F38.mjs +1 -0
  59. package/dist/packem_shared/assertWranglerSatisfiesSchema-_70vhvqk.mjs +3 -0
  60. package/dist/packem_shared/asset-headers-CPuEX21i.mjs +4 -0
  61. package/dist/packem_shared/assetContentType-CUb5bpbI.mjs +1 -0
  62. package/dist/packem_shared/binding-manifest.d-BRdoMhGE.d.mts +593 -0
  63. package/dist/packem_shared/binding-manifest.d-BRdoMhGE.d.ts +593 -0
  64. package/dist/packem_shared/bindingsNeedingDatabase-3KyGflIq.mjs +3 -0
  65. package/dist/packem_shared/blockingFindingsMessage-BQ9z7cie.mjs +1 -0
  66. package/dist/packem_shared/buildPackageSecretsBlock-DrSD60vH.mjs +19 -0
  67. package/dist/packem_shared/canonicalPath-DrfMiT3U.mjs +1 -0
  68. package/dist/packem_shared/celld-binding-id-9MiUoteo.mjs +1 -0
  69. package/dist/packem_shared/celld-config-Ef1RZ02t.mjs +3 -0
  70. package/dist/packem_shared/checkDevEnv-BwZSVBbB.mjs +3 -0
  71. package/dist/packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs +24 -0
  72. package/dist/packem_shared/clearApiSpecMarker-DMGpP41V.mjs +2 -0
  73. package/dist/packem_shared/collectExportGaps-DvirOIVB.mjs +2 -0
  74. package/dist/packem_shared/createConfirm-D5mKTMHj.mjs +7 -0
  75. package/dist/packem_shared/createDiscoveryCache-npJI4uej.mjs +1 -0
  76. package/dist/packem_shared/createStudioDocumentCache-XBG1aWbl.mjs +1 -0
  77. package/dist/packem_shared/deploy-driver.d-CHVNQFV2.d.mts +190 -0
  78. package/dist/packem_shared/deploy-driver.d-CHVNQFV2.d.ts +190 -0
  79. package/dist/packem_shared/describePreservedCrons-i5XT6rtl.mjs +1 -0
  80. package/dist/packem_shared/describeWithheld-CN3D-4pU.mjs +1 -0
  81. package/dist/packem_shared/detectFramework-Dfpvu6rD.mjs +1 -0
  82. package/dist/packem_shared/devTriggerHints-CN_RJxWW.mjs +1 -0
  83. package/dist/packem_shared/devVariablesStamp-BQkGEn9d.mjs +1 -0
  84. package/dist/packem_shared/discover-info-DC2MrAIM.mjs +1 -0
  85. package/dist/packem_shared/discoverAgentInfo-pqFMJBtJ.mjs +1 -0
  86. package/dist/packem_shared/discoverContainerInfo-DzXr7Vm3.mjs +1 -0
  87. package/dist/packem_shared/discoverSchemaInfo-DRPnqgif.mjs +1 -0
  88. package/dist/packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs +1 -0
  89. package/dist/packem_shared/emitProjectAssetHeaders-BdqdTVN3.mjs +1 -0
  90. package/dist/packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs +7 -0
  91. package/dist/packem_shared/env-flag-u4B05gLp.mjs +1 -0
  92. package/dist/packem_shared/hasCloudflareCredentials-ByCrwaLT.mjs +1 -0
  93. package/dist/packem_shared/index.d-BoUSSRrk.d.mts +270 -0
  94. package/dist/packem_shared/index.d-C1nVDcie.d.ts +270 -0
  95. package/dist/packem_shared/inferLunoraBindings-BUk28bSQ.mjs +1 -0
  96. package/dist/packem_shared/is-plain-object-CWxHeOY1.mjs +1 -0
  97. package/dist/packem_shared/is-within-directory-DRMw89rK.mjs +1 -0
  98. package/dist/packem_shared/isOwnedStudioAssets-CHII-uIX.mjs +1 -0
  99. package/dist/packem_shared/materializeServiceDevConfigs-CdmKflBp.mjs +1 -0
  100. package/dist/packem_shared/mergeWranglerEnvironment-CxT2PV1N.mjs +1 -0
  101. package/dist/packem_shared/parseSchema-D1Wbr1qv.mjs +1 -0
  102. package/dist/packem_shared/pendingBindingChanges-DkVojIQe.mjs +1 -0
  103. package/dist/packem_shared/placeholder-ids.d-DvGHP6bl.d.mts +338 -0
  104. package/dist/packem_shared/placeholder-ids.d-DvGHP6bl.d.ts +338 -0
  105. package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.mts +86 -0
  106. package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.ts +86 -0
  107. package/dist/packem_shared/probeCelldToolchain-DxDttfHy.mjs +1 -0
  108. package/dist/packem_shared/process-tree-once-Ou4SfxKM.mjs +1 -0
  109. package/dist/packem_shared/queue-info-D38n7YdX.mjs +1 -0
  110. package/dist/packem_shared/readManifest-Cighz3WC.mjs +6 -0
  111. package/dist/packem_shared/readProjectDependencies-l3uhUKjo.mjs +1 -0
  112. package/dist/packem_shared/reconcile-services-CjgIJKim.mjs +1 -0
  113. package/dist/packem_shared/reconcileWranglerBindings-D6B81UKU.mjs +1 -0
  114. package/dist/packem_shared/reconcileWranglerCompatibilityDate-Cj94osA-.mjs +1 -0
  115. package/dist/packem_shared/renderStudioHtml-CRDTNivi.mjs +15 -0
  116. package/dist/packem_shared/resolveLocalWorkerEnv-C1s-quRt.mjs +1 -0
  117. package/dist/packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs +1 -0
  118. package/dist/packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs +1 -0
  119. package/dist/packem_shared/scanWranglerVariablesForSecrets-DmdOBmwn.mjs +1 -0
  120. package/dist/packem_shared/secret-key-xi4VK8Jw.mjs +1 -0
  121. package/dist/packem_shared/sendStudioAsset-B81Pex91.mjs +1 -0
  122. package/dist/packem_shared/serveJsonHandler-B8_GE6QC.mjs +1 -0
  123. package/dist/packem_shared/spa-assets-wX8rTPEQ.mjs +1 -0
  124. package/dist/packem_shared/startCelldDevSession-DfuDVsha.mjs +1 -0
  125. package/dist/packem_shared/streamContainerLogs-0nko1qpv.mjs +2 -0
  126. package/dist/packem_shared/studio-assets-BKWx838V.mjs +1 -0
  127. package/dist/packem_shared/validate-bindings-DSMH8bRQ.mjs +1 -0
  128. package/dist/packem_shared/withTailConsumer-BXOIqXxv.mjs +1 -0
  129. package/dist/packem_shared/wranglerCodegenInputs-B8iRZZZw.mjs +1 -0
  130. package/dist/packem_shared/wranglerToAlchemy-ClIdvJFu.mjs +5 -0
  131. package/dist/packem_shared/write-atomic-9sY2z8DB.mjs +3 -0
  132. package/dist/packem_shared/writeAssetHeaders-C5igmezc.mjs +1 -0
  133. package/dist/studio-host/index.d.mts +371 -136
  134. package/dist/studio-host/index.d.ts +371 -136
  135. package/dist/studio-host/index.mjs +1 -7
  136. package/package.json +43 -10
  137. package/dist/packem_shared/ACCENT-DW1XJn8i.mjs +0 -40
  138. package/dist/packem_shared/AGENT_MODE_ENV-DM1Siczo.mjs +0 -17
  139. package/dist/packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs +0 -40
  140. package/dist/packem_shared/DEV_DAEMON_ENV-FIEtW7Fz.mjs +0 -163
  141. package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs +0 -37
  142. package/dist/packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs +0 -52
  143. package/dist/packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs +0 -34
  144. package/dist/packem_shared/LUNORA_EVENT_SOURCE-D2fDeGB6.mjs +0 -86
  145. package/dist/packem_shared/LunoraReporter-Ci-bDCK9.mjs +0 -70
  146. package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-B8t_SdoZ.mjs +0 -70
  147. package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-8bNMHGiu.mjs +0 -104
  148. package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-BC7_e9Bz.mjs +0 -105
  149. package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-2YYyWJUq.mjs +0 -561
  150. package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-Df-Wrix-.mjs +0 -99
  151. package/dist/packem_shared/SEED_ENDPOINT-DVCjaGO-.mjs +0 -61
  152. package/dist/packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs +0 -25
  153. package/dist/packem_shared/applyAdditiveEdit-C-snTFEV.mjs +0 -228
  154. package/dist/packem_shared/assetContentType-ByZjeV3D.mjs +0 -72
  155. package/dist/packem_shared/buildPackageSecretsBlock-B8iSX1Zo.mjs +0 -281
  156. package/dist/packem_shared/classifyPolicyEdit-BHeAqF8P.mjs +0 -99
  157. package/dist/packem_shared/createConfirm-fvpdgJ9s.mjs +0 -100
  158. package/dist/packem_shared/detectFramework-U08038Yp.mjs +0 -41
  159. package/dist/packem_shared/discoverContainerInfo-BXFs6Wav.mjs +0 -19
  160. package/dist/packem_shared/discoverSchemaInfo-BB-CKlTK.mjs +0 -25
  161. package/dist/packem_shared/discoverWorkflowInfo-CedvR0mn.mjs +0 -19
  162. package/dist/packem_shared/inferLunoraBindings-ByMwG-gH.mjs +0 -352
  163. package/dist/packem_shared/parseDevVariable-CJiq2IwE.mjs +0 -30
  164. package/dist/packem_shared/parseSchema-DSeyktvG.mjs +0 -107
  165. package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.mts +0 -74
  166. package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.ts +0 -74
  167. package/dist/packem_shared/reconcileWranglerBindings-Cruwwx1M.mjs +0 -334
  168. package/dist/packem_shared/renderStudioHtml-449Ysn75.mjs +0 -37
  169. package/dist/packem_shared/serveJsonHandler-B4OLTGLS.mjs +0 -86
  170. package/dist/packem_shared/streamContainerLogs-BZ4cOZwH.mjs +0 -157
@@ -0,0 +1,941 @@
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 { W as WranglerConfig, T as TailConsumer, a as WranglerValidationReport } from "../packem_shared/binding-manifest.d-BRdoMhGE.mjs";
4
+ export { type A as AlchemyTranslation, b as BINDING_MANIFEST_VERSION, type c as BindingManifest, type B as BindingRequirement, D as DEFAULT_OBSERVABILITY, type M as ManifestConfigShape, type O as ObservabilitySignalSampling, type d as WranglerConfigShape, type e as WranglerContainerEntry, type f as WranglerObservability, type g as WranglerObservabilityLogs, type h as WranglerObservabilityTraces, type i as WranglerWorkflowEntry, j as buildBindingManifest, r as resolveObservabilitySampling, w as wranglerToAlchemy } from "../packem_shared/binding-manifest.d-BRdoMhGE.mjs";
5
+ import { D as DeployDriver } from "../packem_shared/deploy-driver.d-CHVNQFV2.mjs";
6
+ import { WranglerQueueProducerIR, WranglerVariableIR } from '@lunora/codegen';
7
+ /** Apply one structural jsonc edit and return the rewritten text (a no-op edit returns the input). */
8
+ declare const applyModify: (text: string, path: ReadonlyArray<number | string>, value: unknown) => string;
9
+ interface Manifest {
10
+ /** The manifest's `lunora` value, when it has one and it is an object. */
11
+ lunora: Record<string, unknown> | undefined;
12
+ /**
13
+ * `true` when the manifest holds a `lunora` value that is NOT a plain object.
14
+ * {@link readManifest} normalises that to `lunora: undefined`, but the TEXT
15
+ * still has it — and `modify(text, ["lunora", "crons"], …)` throws
16
+ * `Can not add index to parent of type string` on a scalar or array parent.
17
+ */
18
+ lunoraIsForeign: boolean;
19
+ path: string;
20
+ text: string;
21
+ }
22
+ /**
23
+ * The project manifest, or `undefined` when it is missing or is not readable
24
+ * JSON.
25
+ *
26
+ * Unreadable reads as "no ownership recorded" rather than throwing: this runs
27
+ * inside a deploy and inside every dev-server schema save, where a manifest that
28
+ * broken already fails for reasons that have nothing to do with the record.
29
+ */
30
+ declare const readManifest: (projectRoot: string) => Manifest | undefined;
31
+ /**
32
+ * Set `lunora.<key>` to `value`, or drop it when `value` is `undefined` — and
33
+ * the `lunora` object with it, when nothing else lives there, so a project with
34
+ * nothing recorded keeps an unmarked manifest.
35
+ */
36
+ declare const recordManifestKey: (manifest: Manifest, key: string, value: unknown) => void;
37
+ /**
38
+ * A container/workflow that is declared (so codegen emits its class) but the
39
+ * worker entry never re-exports — the one wiring step the generators can't always
40
+ * do for the developer. wrangler rejects a `class_name` the deployed worker
41
+ * doesn't export, so a deploy fails late on this; surfacing it as structured data
42
+ * lets the Vite plugin raise it in the dev error overlay (not just the console)
43
+ * the moment the gap appears. The human-readable form is also folded into
44
+ * {@link ReconcileBindingsResult.warnings}.
45
+ */
46
+ interface ExportGap {
47
+ /** Generated class wrangler needs exported, e.g. `OrderPipelineWorkflow`. */
48
+ className: string;
49
+ /** The `lunora/{agents,containers,workflows}.ts` export name, e.g. `orderPipeline`. */
50
+ exportName: string;
51
+ /** Which declaration is unexported. */
52
+ kind: "agent" | "container" | "workflow";
53
+ /** The `_generated/{module}` to re-export from, e.g. `workflows`. */
54
+ module: GeneratedClassModule;
55
+ }
56
+ interface ReconcileBindingsResult {
57
+ /** Short labels for each binding written (e.g. `"SCHEDULER/SchedulerDO"`). */
58
+ added: string[];
59
+ /** `true` when `wrangler.jsonc` was rewritten. */
60
+ changed: boolean;
61
+ /** What was written to the SvelteKit / Nuxt dev sidecar's own config, when anything was. */
62
+ devConfig?: {
63
+ added: string[];
64
+ path: string;
65
+ updated: string[];
66
+ };
67
+ /**
68
+ * Declared containers/workflows the worker entry doesn't re-export — the
69
+ * structured form of the corresponding `warnings` entries, for the dev error
70
+ * overlay. Empty when every declaration is wired.
71
+ */
72
+ exportGaps: ExportGap[];
73
+ /** Reason reconciliation was skipped, for logging. */
74
+ reason?: string;
75
+ /**
76
+ * Short labels for each EXISTING entry whose settings were brought in line
77
+ * with its declaration (e.g. `"queues.consumers/receipt-queue (max_retries)"`).
78
+ * Kept apart from `added` so a retune is not logged as a new binding.
79
+ */
80
+ updated: string[];
81
+ /** Non-fatal hints for capabilities that cannot be auto-provisioned. */
82
+ warnings: string[];
83
+ /** Resolved wrangler path, or `undefined` when none was found. */
84
+ wranglerPath?: string;
85
+ }
86
+ /**
87
+ * The declared-but-not-re-exported containers and workflows, as structured
88
+ * {@link ExportGap}s. The same gaps `collectWarnings` renders into prose — kept
89
+ * here as data so the Vite plugin can raise them in the error overlay with a
90
+ * precise remediation, rather than re-parsing the warning strings.
91
+ *
92
+ * Exported because reconciliation is not the only caller that needs the answer:
93
+ * `lunora codegen` and `lunora doctor` both want the gaps WITHOUT rewriting
94
+ * `wrangler.jsonc`, which is the rest of what `reconcileWranglerBindings` (`apply-bindings.ts`)
95
+ * does. Deriving them again from `inferred.{containers,workflows,agents}` at each
96
+ * call site is how one kind ends up silently uncovered.
97
+ */
98
+ declare const collectExportGaps: (inferred: InferredBindings) => ExportGap[];
99
+ /** Plan and apply in one pass: what `lunora deploy` and the dev-start reconcile run. */
100
+ declare const reconcileWranglerBindings: (projectRoot: string, inferred: InferredBindings, options?: {
101
+ environment?: string;
102
+ target?: string;
103
+ }) => ReconcileBindingsResult;
104
+ /** The project coordinates the validator needs. */
105
+ interface AssertWranglerOptions {
106
+ /** Memoises the schema discovery, shared with binding inference. */
107
+ cache?: DiscoveryCache;
108
+ /** Absolute path to the project root holding `wrangler.jsonc`. */
109
+ projectRoot: string;
110
+ /** The schema directory, relative to `projectRoot` (usually `"lunora"`). */
111
+ schemaDir: string;
112
+ }
113
+ /**
114
+ * Throw unless `wrangler.jsonc` satisfies the schema's binding requirements.
115
+ *
116
+ * Non-blocking validator warnings go to `warn`. `remedy` closes both error
117
+ * messages — the caller's own "and restart the dev server" / "and rebuild" —
118
+ * since that is the only part a reader acts on differently per front-end.
119
+ *
120
+ * Must run AFTER binding provisioning: the bindings this requires are largely the
121
+ * ones Lunora writes itself, so validating first fails the very first build of any
122
+ * project that declares a `.global()` table or a container.
123
+ */
124
+ declare const assertWranglerSatisfiesSchema: (options: AssertWranglerOptions, warn: (message: string) => void, remedy: string) => void;
125
+ /** `Cross-Origin-Opener-Policy` values. `false` omits the header. */
126
+ type CrossOriginOpenerPolicy = "same-origin" | "same-origin-allow-popups" | "unsafe-none";
127
+ /** Per-header overrides for the baseline security headers. `false` omits the header. */
128
+ interface SecurityHeadersOptions {
129
+ /**
130
+ * `Cross-Origin-Opener-Policy`. Defaults to `same-origin-allow-popups`: a
131
+ * cross-origin page that opens yours gets no handle on it, while a popup your
132
+ * page opens (an OAuth provider, a payment sheet) can still message back
133
+ * through `window.opener`. `same-origin` severs that too; `false` omits the header.
134
+ */
135
+ crossOriginOpenerPolicy?: CrossOriginOpenerPolicy | false;
136
+ /**
137
+ * `Content-Security-Policy`. Omitted (`undefined`) applies a restrictive
138
+ * `default-src 'none'` policy to **non-HTML** responses, and a conservative
139
+ * hardening policy to **HTML** responses (`base-uri 'none'; object-src
140
+ * 'none'; frame-ancestors …`) — this does NOT set `default-src`/`script-src`,
141
+ * so it never blocks a page's own scripts/styles/images/fetches. Pass a string
142
+ * to apply that exact policy to every response (HTML included); `false` to
143
+ * never send one. Neither can be combined with {@link frameAncestors}: put the
144
+ * `frame-ancestors` directive in the string.
145
+ */
146
+ csp?: string | false;
147
+ /**
148
+ * Origins allowed to embed your HTML pages in a frame, besides your own
149
+ * (e.g. `["https://partner.example"]`). Sets the HTML policy's
150
+ * `frame-ancestors 'self' <origins>` and drops `X-Frame-Options`, which
151
+ * cannot express a list (browsers that understand `frame-ancestors` ignore
152
+ * it anyway). Cannot be combined with `frameOptions: "DENY"`, a `csp` string,
153
+ * or `csp: false` (which would leave no header restricting framing).
154
+ */
155
+ frameAncestors?: ReadonlyArray<string>;
156
+ /** `X-Frame-Options` (clickjacking). Defaults to `SAMEORIGIN`. `false` omits it. */
157
+ frameOptions?: "DENY" | "SAMEORIGIN" | false;
158
+ /** `Strict-Transport-Security`. The Worker sends it only over HTTPS. `false` omits it. */
159
+ hsts?: boolean | {
160
+ includeSubDomains?: boolean;
161
+ maxAge?: number;
162
+ preload?: boolean;
163
+ };
164
+ /** `Permissions-Policy`. Defaults to a minimal deny list. `false` omits it. */
165
+ permissionsPolicy?: string | false;
166
+ /** `Referrer-Policy`. Defaults to `strict-origin-when-cross-origin`. `false` omits it. */
167
+ referrerPolicy?: string | false;
168
+ }
169
+ interface AssetHeadersOptions {
170
+ /**
171
+ * The security headers to write for `/*`, in the runtime's `security.headers`
172
+ * shape: `undefined` or `true` for the defaults, `false` for none.
173
+ */
174
+ headers: boolean | SecurityHeadersOptions | undefined;
175
+ /**
176
+ * The directory, relative to the assets root, that holds only content-hashed
177
+ * files (Vite's `build.assetsDir`). Its files get {@link IMMUTABLE_CACHE_CONTROL}.
178
+ * Omit it when that cannot be promised: one unhashed file there would be
179
+ * cached for a year. Omit it too when `not_found_handling` is a fallback
180
+ * (`single-page-application`, `404-page`): `_headers` matches the request
181
+ * path, so a request for a chunk a later deploy removed would get the
182
+ * fallback page with this policy, and keep it for a year.
183
+ */
184
+ immutableDirectory?: string;
185
+ }
186
+ interface AssetHeadersResult {
187
+ /** Header names left out of the block because a rule outside it already sets them. */
188
+ deferred: string[];
189
+ /** Absolute path of the `_headers` file, or `undefined` when there is none. */
190
+ path: string | undefined;
191
+ /** Non-fatal notes for the build log. */
192
+ warnings: string[];
193
+ }
194
+ /** Rewrite `<directory>/_headers` with the managed block; a file left holding nothing is removed. */
195
+ declare const writeAssetHeaders: (directory: string, options: AssetHeadersOptions) => AssetHeadersResult;
196
+ /** Env var the once-per-process-tree guard behind {@link warnCloudflareCliConfigOnce} sets. */
197
+ declare const CLOUDFLARE_CLI_CONFIG_WARNING_ENV = "LUNORA_CF_CONFIG_WARNING_SHOWN";
198
+ /** A detected Cloudflare CLI config: what was found, and what to do about it. */
199
+ interface CloudflareCliConfigFinding {
200
+ /** What to do — `cf` resource commands are fine, lifecycle commands are not. Links the tracking issue. */
201
+ fix: string;
202
+ /** One line: which file was found, where, and why it is a problem. */
203
+ message: string;
204
+ }
205
+ /**
206
+ * Detect a Cloudflare CLI config (`cloudflare.config.{ts,mts,js,mjs}`) in
207
+ * `projectRoot`, or `undefined` when there is none. The message names the
208
+ * wrangler config actually present (`wrangler.jsonc` / `wrangler.json`), or says
209
+ * "in the project root" when there is none yet.
210
+ */
211
+ declare const detectCloudflareCliConfig: (projectRoot: string) => CloudflareCliConfigFinding | undefined;
212
+ /**
213
+ * Warn through `warn` when `projectRoot` holds a Cloudflare CLI config — once
214
+ * per process tree (a rebuild, a dev-server restart, or a child process that
215
+ * inherited the env stays quiet). The guard is read before the filesystem probe,
216
+ * and claimed only when there is something to say. Non-blocking by design: the
217
+ * risk is a separate `cf` lifecycle command, not anything Lunora runs. Returns
218
+ * whether it warned.
219
+ */
220
+ declare const warnCloudflareCliConfigOnce: (projectRoot: string, warn: (message: string) => void) => boolean;
221
+ /** The Cloudflare deploy driver. */
222
+ declare const CLOUDFLARE_DRIVER: DeployDriver;
223
+ /**
224
+ * The `global_fetch_strictly_public` compatibility flag: every global `fetch` from
225
+ * the Worker goes out to the public internet, never to a private or special-use
226
+ * address. `workersCimdFetch()` from `@lunora/auth/cimd/workers` refuses to build
227
+ * without it, and `lunora doctor` checks for it wherever that transport is imported.
228
+ */
229
+ declare const GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG = "global_fetch_strictly_public";
230
+ /** Inputs, injectable so tests never read the real home directory or env. */
231
+ interface CloudflareCredentialProbe {
232
+ env?: Record<string, string | undefined>;
233
+ home?: string;
234
+ /** Project whose `.env` files are read; omit to skip them. */
235
+ projectRoot?: string;
236
+ }
237
+ declare const hasCloudflareCredentials: (probe?: CloudflareCredentialProbe) => boolean;
238
+ /** Which kind of temp config a file is, in its name. */
239
+ type DevConfigKind = "dev" | "service";
240
+ /** A remote-only binding a logged-out dev session leaves out: which kind it is, and the name the app gave it. */
241
+ interface WithheldBinding {
242
+ binding: string;
243
+ kind: "ai" | "artifacts";
244
+ }
245
+ /** The slice of a worker config the rule reads. */
246
+ interface RemoteOnlyBindings {
247
+ ai?: {
248
+ binding?: string;
249
+ } | null;
250
+ artifacts?: ReadonlyArray<{
251
+ binding?: string;
252
+ } | null | undefined> | null;
253
+ }
254
+ /**
255
+ * The bindings to withhold from a logged-out dev session. Workers AI and Artifacts have no
256
+ * local simulator, so each opens a remote proxy session at boot that fails without a login and
257
+ * takes the dev server down. The credential probe runs only when one of them is declared.
258
+ */
259
+ declare const withheldBindings: (config: RemoteOnlyBindings | undefined, hasCredentials: () => boolean) => WithheldBinding[];
260
+ /** The one dev warning for a withheld binding, shared by `lunora dev` and `@lunora/vite`. */
261
+ declare const describeWithheld: ({ binding, kind }: WithheldBinding) => string;
262
+ /** The slice of PGlite this module drives, so a test can stand in for the WASM engine. */
263
+ interface PgliteRuntime {
264
+ createServer: (dataDirectory: string) => Promise<{
265
+ connectionString: string;
266
+ stop: () => Promise<void>;
267
+ }>;
268
+ }
269
+ interface StartLocalHyperdriveOptions {
270
+ /** Defaults to `process.env`; the connection strings are written here and removed again by `stop`. */
271
+ env?: NodeJS.ProcessEnv;
272
+ /** Injection seam; defaults to the real PGlite. Resolves `undefined` when it is not installed. */
273
+ load?: () => Promise<PgliteRuntime | undefined>;
274
+ /** Called once with a line to show the developer when the database could not be started. */
275
+ onWarning?: (message: string) => void;
276
+ projectRoot: string;
277
+ /** The wrangler config the session actually runs (the Cloudflare plugin's `configPath`); defaults to the project's own. */
278
+ wranglerConfigPath?: string;
279
+ }
280
+ interface LocalHyperdrive {
281
+ /** The bindings served by PGlite. */
282
+ bindings: string[];
283
+ stop: () => Promise<void>;
284
+ }
285
+ /** The Hyperdrive bindings in `wrangler.jsonc` that nothing local backs yet. */
286
+ declare const bindingsNeedingDatabase: (projectRoot: string, env: NodeJS.ProcessEnv, wranglerEnvironment?: string | undefined, configPath?: string) => string[];
287
+ /**
288
+ * Start a PGlite for every Hyperdrive binding with no local database, and point
289
+ * wrangler at it through its environment variable. Resolves `undefined` when
290
+ * there is nothing to serve, or when PGlite is not installed (after saying how
291
+ * to install it).
292
+ */
293
+ declare const startLocalHyperdrive: (options: StartLocalHyperdriveOptions) => Promise<LocalHyperdrive | undefined>;
294
+ interface ProjectAssetHeadersInput {
295
+ /**
296
+ * The build's directory of content-hashed files, relative to `outputDirectory`
297
+ * (Vite's `build.assetsDir`, Astro's `_astro`, Rsbuild's `static`). Pass it only when
298
+ * the integration can vouch that every file it writes there carries a content hash.
299
+ */
300
+ hashedDirectory?: string;
301
+ /**
302
+ * The file-name patterns (relative to `outputDirectory`, Rollup placeholders) the build names its hashed files
303
+ * with. Given, every file the build left in `hashedDirectory` must have such a name, or the directory is not
304
+ * cached for good: a plugin can emit a fixed name there that the patterns never see.
305
+ */
306
+ hashedNamePatterns?: ReadonlyArray<string>;
307
+ /** Absolute directory the build wrote its client output to. */
308
+ outputDirectory: string;
309
+ projectRoot: string;
310
+ /** Absolute `public/` directory the build copies verbatim into `outputDirectory`, if any. */
311
+ publicDirectory?: string;
312
+ /**
313
+ * Write only when `outputDirectory` is the `assets.directory` wrangler deploys.
314
+ * `@lunora/vite` passes `false`: with `@cloudflare/vite-plugin` in the build, the
315
+ * client `outDir` is the assets root even when wrangler declares no `assets` block.
316
+ */
317
+ requireAssetsDirectory: boolean;
318
+ /** Schema directory relative to `projectRoot`; `lunora.config` is looked up from it. Defaults to `lunora`. */
319
+ schemaDir?: string;
320
+ /** The deploy target an integration was configured with; resolved from `lunora.config` when omitted. Only `"cloudflare"` serves `_headers`. */
321
+ target?: string;
322
+ /** Absolute path of the wrangler config the build deploys (`@cloudflare/vite-plugin`'s `configPath`). Defaults to the project's own. */
323
+ wranglerPath?: string;
324
+ }
325
+ /** Where an integration's build log goes. */
326
+ interface AssetHeadersLogger {
327
+ info: (message: string) => void;
328
+ warn: (message: string) => void;
329
+ }
330
+ type ProjectAssetHeadersOutcome = {
331
+ reason: string;
332
+ written: false;
333
+ } | {
334
+ result: AssetHeadersResult;
335
+ written: true;
336
+ };
337
+ /**
338
+ * Write the managed `_headers` block for one build output and report it through
339
+ * the build's logger: the headers left to the user's own rules, then each
340
+ * warning. The single entry point every bundler integration calls after its
341
+ * client build.
342
+ */
343
+ declare const emitProjectAssetHeaders: (input: ProjectAssetHeadersInput, logger: AssetHeadersLogger) => ProjectAssetHeadersOutcome;
344
+ interface ReconcileCompatibilityDateResult {
345
+ /** `true` when `wrangler.jsonc` was rewritten. */
346
+ changed: boolean;
347
+ /** The new date value, or the existing one when unchanged. */
348
+ date: string | undefined;
349
+ /** Human-readable reason when reconciliation was skipped. */
350
+ reason?: string;
351
+ /** Resolved wrangler path, or `undefined` when none was found. */
352
+ wranglerPath?: string;
353
+ }
354
+ /**
355
+ * Reconcile the `compatibility_date` in `wrangler.jsonc` when Workers Cache
356
+ * is enabled but the date is below the minimum required.
357
+ */
358
+ declare const reconcileWranglerCompatibilityDate: (projectRoot: string) => ReconcileCompatibilityDateResult;
359
+ interface ReconcileResult {
360
+ /** `true` when the wrangler config's `triggers.crons` was rewritten. */
361
+ changed: boolean;
362
+ /**
363
+ * Entries left in `triggers.crons` that this reconciler did not generate and
364
+ * does not own — a hand-written `backupCron` trigger, or anything already
365
+ * there before ownership was first recorded. Non-empty means the array is
366
+ * NOT the codegen-derived set, which is the surprising half of what this
367
+ * does and the one thing worth printing.
368
+ */
369
+ preserved: string[];
370
+ /** Human-readable reason when reconciliation was skipped (for logging). */
371
+ reason?: string;
372
+ /**
373
+ * Problems with the ownership record itself, for the caller to `warn`. A
374
+ * damaged `lunora.crons` is not fatal — the reconciler degrades to add-only
375
+ * — but the degradation is invisible: the generated cron it wrote last pass
376
+ * is reported back as hand-written and is then kept for good. Silence is
377
+ * what turns a merge conflict into a permanent orphan.
378
+ */
379
+ warnings: string[];
380
+ /** Resolved wrangler path, or `undefined` when none was found. */
381
+ wranglerPath?: string;
382
+ }
383
+ /**
384
+ * Reconcile the codegen-derived cron schedules into the project's wrangler
385
+ * config `triggers.crons` array, preserving comments and formatting via
386
+ * `jsonc-parser`'s structural edits.
387
+ *
388
+ * **This does not own the whole array.** Two runtime cron surfaces live on
389
+ * `createWorker` rather than in `lunora/crons.ts`: `backupCron` (the nightly
390
+ * NDJSON backup) and `crons` (handlers keyed by expression). Replacing the array
391
+ * wholesale deleted both on the next `lunora deploy` or dev-server schema save,
392
+ * silently — the nightly backup simply stopped. So an entry this reconciler did
393
+ * not generate is the user's, is kept, and is reported in
394
+ * {@link ReconcileResult.preserved}.
395
+ *
396
+ * Codegen now scans the worker entry for both, so the STATIC case arrives in
397
+ * `cronTriggers` like any declared cron — kept because it is generated, and
398
+ * cleared when the entry stops declaring it. What it cannot resolve is the
399
+ * dynamic case, and that case is supported: `.extend((env) => ({ backupCron:
400
+ * env.NIGHTLY_CRON }))` is the documented escape hatch, and its value exists
401
+ * only at runtime. That residue — plus a computed `crons` key, a spread options
402
+ * object, and anything a project put in `triggers.crons` for its own reasons —
403
+ * is what the preserve rule below is for. It is not redundant with discovery; it
404
+ * is the half discovery provably cannot reach.
405
+ *
406
+ * Ownership is recorded in the project's `package.json` under `lunora.crons`,
407
+ * which is why a REMOVED generated cron still gets cleared (it is in the record
408
+ * and no longer in `cronTriggers`) while a hand-written one never is. Three
409
+ * properties pick that location:
410
+ *
411
+ * COMMITTED, so it survives a fresh clone. Gitignored `.lunora/` state does not:
412
+ * a CI-only deploy finds none, and falling back to add-only there leaves a
413
+ * removed cron firing forever.
414
+ *
415
+ * VALID JSON, so `wrangler.json` — a supported config name — behaves exactly like
416
+ * `wrangler.jsonc`. A `//` marker inside the config does not: wrangler tolerates
417
+ * one in either (both go through its JSONC parser), but the project's own
418
+ * `JSON.parse`, its deploy wrapper and its editor's JSON schema validation all
419
+ * break the moment a `.json` grows a comment. Nor can the record be a plain key
420
+ * in the wrangler config — wrangler reports unknown fields ("Unexpected fields
421
+ * found in top-level field") on every command.
422
+ *
423
+ * READ AND WRITTEN AT ONE ADDRESS. A comment has to be found textually on the way
424
+ * in and positioned structurally on the way out, and those are not the same
425
+ * place: a stale duplicate higher in the file was read as the record and deleted
426
+ * the user's backup trigger.
427
+ *
428
+ * The wrangler config is rewritten only when an entry actually moves, so
429
+ * {@link ReconcileResult.changed} means what a `synced N cron trigger(s)` log
430
+ * claims it means.
431
+ *
432
+ * A project with nothing recorded yet — one predating this, or one with no
433
+ * manifest — treats every entry as the user's, which is the safe direction: a
434
+ * wrongly-kept trigger costs one no-op invocation, a wrongly-deleted one
435
+ * silently ends the backups. It becomes precise after a codegen run that still
436
+ * declares the cron; upgrading and deleting a cron in the same change records an
437
+ * empty set, and that orphan is then kept for good.
438
+ *
439
+ * This intentionally writes the SAME `triggers.crons` shape the
440
+ * `@lunora/config` validator accepts, so the wrangler validator never fights the
441
+ * generated value.
442
+ */
443
+ declare const reconcileWranglerCrons: (projectRoot: string, cronTriggers: ReadonlyArray<string>) => ReconcileResult;
444
+ /**
445
+ * The one log line worth printing for a reconcile that kept entries it does not
446
+ * own, or `undefined` when it owned the whole array. Lives here rather than in
447
+ * each caller because `lunora deploy` and the Vite plugin print it verbatim and
448
+ * had already drifted into two copies of the same sentence.
449
+ */
450
+ declare const describePreservedCrons: (preserved: ReadonlyArray<string>) => string | undefined;
451
+ /** The project coordinates every reconciler here needs. */
452
+ interface ReconcileProject {
453
+ /** Memoises the source scans, so a caller that also validates or reconciles again parses the project once. */
454
+ cache?: DiscoveryCache;
455
+ /** Absolute path to the project root holding `wrangler.jsonc`. */
456
+ projectRoot: string;
457
+ /** The schema directory, relative to `projectRoot` (usually `"lunora"`). */
458
+ schemaDir: string;
459
+ /** The deploy target; wrangler settings only Cloudflare reads are written only for `"cloudflare"` (or when omitted). */
460
+ target?: string;
461
+ }
462
+ /** The two logger methods every reconciler here needs; `info` is optional on Vite's. */
463
+ interface ReconcileLogger {
464
+ info?: (message: string) => void;
465
+ warn: (message: string) => void;
466
+ }
467
+ /**
468
+ * Infer the Cloudflare bindings the project's code implies and reconcile them
469
+ * into `wrangler.jsonc` (Durable Objects, their migration classes, and the
470
+ * `DB` D1 binding for `.global()` schemas). Best-effort and idempotent — runs at
471
+ * dev startup (and on every `@lunora/rspack` pass) so the user never hand-writes
472
+ * binding boilerplate. A failure here must never abort codegen; the wrangler
473
+ * validator reports real problems.
474
+ *
475
+ * `onExportGaps` (dev only) is invoked when a declared container/workflow isn't
476
+ * re-exported by the worker entry, so the caller can raise it in the browser
477
+ * error overlay in addition to the console warning.
478
+ */
479
+ declare const reconcileBindingsSafely: (options: ReconcileProject, logger: ReconcileLogger, onExportGaps?: (gaps: ReadonlyArray<ExportGap>) => void) => Promise<void>;
480
+ /**
481
+ * The bindings a {@link reconcileBindingsSafely} pass would add or retune right
482
+ * now, as its log labels (a dev sidecar's prefixed with its file) — from the same plan, written
483
+ * nowhere. For a dev server that provisions only at startup: a save that
484
+ * declares a queue, reads `ctx.kv` or exports a workflow leaves the running
485
+ * worker without that binding until the server restarts, and this is how the
486
+ * watcher finds out. Empty when the config is in sync or the scan fails (a
487
+ * half-typed source must not read as a change).
488
+ *
489
+ * `cache` is required: a watcher calls this on every save, and clears it when
490
+ * the sources move.
491
+ */
492
+ declare const pendingBindingChanges: (options: ReconcileProject & {
493
+ cache: DiscoveryCache;
494
+ }) => Promise<string[]>;
495
+ /** Reconcile cron triggers and the compatibility date into `wrangler.jsonc`. */
496
+ declare const reconcileWranglerExtras: (projectRoot: string, cronTriggers: ReadonlyArray<string>, logger: ReconcileLogger) => void;
497
+ /**
498
+ * Bring the Studio documents' `assets` block in line with what codegen just
499
+ * emitted, with the same plan and edit `lunora deploy`'s reconcile uses: add the
500
+ * Lunora-owned block when codegen emitted loaders that read `ASSETS`, and remove
501
+ * it when it no longer does. Codegen calls this because a plain `wrangler
502
+ * deploy` after `lunora codegen` never runs reconcile, and without the binding
503
+ * Studio's routes serve empty documents.
504
+ *
505
+ * A block the user wrote is never touched: `studioAssetsPlan` sees it and keeps
506
+ * the documents in the bundle. Once that happens the documents an earlier run
507
+ * wrote into the owned directory are deleted, because a block the user edited
508
+ * (or their own `directory` pointing there) may serve that directory ahead of
509
+ * the Worker's admin check.
510
+ *
511
+ * A failed write throws: the loaders codegen just emitted need the binding, so
512
+ * the run must fail rather than report success with documents that never load.
513
+ */
514
+ declare const reconcileStudioAssets: (projectRoot: string, target: string | undefined, logger: ReconcileLogger) => void;
515
+ /**
516
+ * The wrangler config sections Lunora can safely flip to remote mode in dev,
517
+ * each with the human label used in logs and the structural `shape` the entry
518
+ * lives in.
519
+ *
520
+ * `"array"` is a top-level array of binding objects (`d1_databases`,
521
+ * `kv_namespaces`, `r2_buckets`, `vectorize`, `services`). `"producers"` is
522
+ * `queues.producers[]` — consumers are NOT remoted (their schema has no `remote`
523
+ * field) and the edit path is two levels deep. `"object"` is a single binding
524
+ * object, not an array (`ai`), whose edit path targets the section key directly.
525
+ *
526
+ * Every kind here was confirmed against `wrangler/config-schema.json`: the
527
+ * entry's schema declares a `remote` property. Deliberately omits
528
+ * `durable_objects` (no CF remote-DO mode; shards stay local) and sections whose
529
+ * schema has no `remote` field (`hyperdrive`, `analytics_engine_datasets`,
530
+ * `secrets_store_secrets`, queue consumers, …). Widening further is a one-line
531
+ * table edit.
532
+ */
533
+ declare const REMOTE_ELIGIBLE_KEYS: {
534
+ readonly ai: {
535
+ readonly label: "AI";
536
+ readonly shape: "object";
537
+ };
538
+ readonly ai_search: {
539
+ readonly label: "AI Search";
540
+ readonly shape: "array";
541
+ };
542
+ readonly ai_search_namespaces: {
543
+ readonly label: "AI Search namespace";
544
+ readonly shape: "array";
545
+ };
546
+ readonly analytics: {
547
+ readonly label: "Analytics SQL";
548
+ readonly shape: "object";
549
+ };
550
+ readonly d1_databases: {
551
+ readonly label: "D1";
552
+ readonly shape: "array";
553
+ };
554
+ readonly kv_namespaces: {
555
+ readonly label: "KV";
556
+ readonly shape: "array";
557
+ };
558
+ readonly queues: {
559
+ readonly label: "Queue";
560
+ readonly shape: "producers";
561
+ };
562
+ readonly r2_buckets: {
563
+ readonly label: "R2";
564
+ readonly shape: "array";
565
+ };
566
+ readonly services: {
567
+ readonly label: "Service";
568
+ readonly shape: "array";
569
+ };
570
+ readonly vectorize: {
571
+ readonly label: "Vectorize";
572
+ readonly shape: "array";
573
+ };
574
+ };
575
+ type RemoteEligibleKey = keyof typeof REMOTE_ELIGIBLE_KEYS;
576
+ /** One binding object as it appears in any eligible section. */
577
+ interface BindingEntry {
578
+ binding?: string;
579
+ id?: unknown;
580
+ remote?: boolean;
581
+ }
582
+ /** One binding entry we mark remote, with enough provenance to log + edit it. */
583
+ interface RemoteBindingPlan {
584
+ /** The binding name as declared in the config (e.g. `"DB"`, `"FILES"`). */
585
+ binding: string;
586
+ /** Short kind label for logging (`"D1"`, `"KV"`, `"R2"`, `"Vectorize"`, …). */
587
+ kind: string;
588
+ /**
589
+ * The jsonc edit path within {@link RemoteBindingPlan.section}, relative to
590
+ * the section key: `[index]` for an `"array"` section, `["producers", index]`
591
+ * for a queue producer, or `[]` for the single-object `ai` section. The
592
+ * materializer prepends the section key and appends `"remote"`.
593
+ */
594
+ path: ReadonlyArray<number | string>;
595
+ /** The wrangler config key the entry lives under. */
596
+ section: RemoteEligibleKey;
597
+ }
598
+ /** The structural slice of a wrangler config the remote planner reads. */
599
+ interface RemoteWranglerShape {
600
+ ai?: BindingEntry | null;
601
+ ai_search?: ReadonlyArray<BindingEntry | null | undefined>;
602
+ ai_search_namespaces?: ReadonlyArray<BindingEntry | null | undefined>;
603
+ analytics?: BindingEntry | null;
604
+ artifacts?: ReadonlyArray<BindingEntry | null | undefined>;
605
+ d1_databases?: ReadonlyArray<BindingEntry | null | undefined>;
606
+ kv_namespaces?: ReadonlyArray<BindingEntry | null | undefined>;
607
+ queues?: {
608
+ producers?: ReadonlyArray<BindingEntry | null | undefined>;
609
+ } | null;
610
+ r2_buckets?: ReadonlyArray<BindingEntry | null | undefined>;
611
+ services?: ReadonlyArray<BindingEntry | null | undefined>;
612
+ vectorize?: ReadonlyArray<BindingEntry | null | undefined>;
613
+ }
614
+ /**
615
+ * Inspect a parsed wrangler config and list every eligible binding that should
616
+ * be flipped to remote mode. Pure — no file-system access, no mutation. An
617
+ * entry already carrying `"remote": true` is still reported (so logging is
618
+ * complete) but the materializer's edit is a harmless no-op for it.
619
+ */
620
+ declare const planRemoteBindings: (parsed: RemoteWranglerShape) => RemoteBindingPlan[];
621
+ /**
622
+ * Inject `"remote": true` onto each planned binding in the config `text`,
623
+ * comment-preservingly via jsonc edits. Pure string→string; the edits target
624
+ * disjoint entries so applying them sequentially is safe. The edit path is
625
+ * `[section, ...plan.path, "remote"]`, which resolves to the array element, the
626
+ * `queues.producers[i]` entry, or the single `ai` object as the plan demands.
627
+ */
628
+ declare const injectRemoteFlags: (text: string, plans: ReadonlyArray<RemoteBindingPlan>) => string;
629
+ interface MaterializeDevOptions {
630
+ /** Whether wrangler can authenticate; defaults to a probe of `projectRoot`. */
631
+ hasCredentials?: () => boolean;
632
+ projectRoot: string;
633
+ /** Proxy the eligible bindings to the deployed resources (`--remote` / `LUNORA_REMOTE`). Off, only the logged-out `ai` withholding applies. */
634
+ remote: boolean;
635
+ }
636
+ interface MaterializeDevResult {
637
+ /** Removes the temp config. Always safe to call: idempotent, and a no-op when nothing was written. */
638
+ cleanup: () => void;
639
+ /** The temp config to pass to `wrangler dev --config`, or `undefined` to run the user's file unchanged. */
640
+ configPath?: string;
641
+ /** Why remote mode produced no temp config, for the dev log. Only set when nothing was written. */
642
+ reason?: string;
643
+ /** The bindings flipped to remote, for the dev banner. */
644
+ remoteBindings: RemoteBindingPlan[];
645
+ /** The `ai` binding name left out for lack of Cloudflare credentials, for the dev warning. */
646
+ withheld: WithheldBinding[];
647
+ }
648
+ /** A dev session's remote-binding decision, as `lunora dev` and `vite dev` both act on it. */
649
+ interface RemotePlan {
650
+ /** The bindings flipped to remote, as `NAME (kind)` labels for the banner. */
651
+ bindings: string[];
652
+ /** Removes the temp config. Idempotent, and a no-op when nothing was written; every shutdown path calls it. */
653
+ cleanup: () => void;
654
+ /** The temp config the worker runs with, or `undefined` to run the user's file unchanged. */
655
+ configPath?: string;
656
+ /** Whether remote mode was requested. */
657
+ enabled: boolean;
658
+ /** Why remote mode didn't take effect despite being requested, for logging. */
659
+ reason?: string;
660
+ /** Remote-only bindings (`ai`, `artifacts`) left out for lack of Cloudflare credentials, for the dev warning. */
661
+ withheld: WithheldBinding[];
662
+ }
663
+ /**
664
+ * The {@link RemotePlan} a materialization amounts to, with `enabled` saying
665
+ * whether remote mode was asked for. The one place the `NAME (kind)` banner
666
+ * labels are spelled, so `lunora dev` and `vite dev` print the same list.
667
+ */
668
+ declare const toRemotePlan: (result: MaterializeDevResult, enabled: boolean) => RemotePlan;
669
+ /**
670
+ * Write the temp wrangler config a dev session runs with: the user's file with any
671
+ * eligible bindings flipped to `"remote": true` (when `remote` is set), and the
672
+ * `ai` binding removed when the session has no Cloudflare login. See `dev-config.ts`
673
+ * for why the `ai` removal exists.
674
+ *
675
+ * The temp file sits beside the source `wrangler.jsonc`, not in an OS temp dir,
676
+ * because wrangler resolves a config's relative `main`/`assets`/`migrations_dir`
677
+ * paths against the config file's own directory. Returns no `configPath` when there
678
+ * is nothing to change, so the caller runs the user's file unchanged.
679
+ */
680
+ declare const materializeDevWranglerConfig: (options: MaterializeDevOptions) => MaterializeDevResult;
681
+ /**
682
+ * Parse a `LUNORA_REMOTE` env value into the on/off decision. Truthy when set to
683
+ * `"1"` or `"true"` (case-insensitive); anything else — unset, `"0"`, `"false"`,
684
+ * empty — is off. Mirrors the `"1" | "true"` convention used across the runtime.
685
+ */
686
+ declare const isRemoteEnvEnabled: (value: string | undefined) => boolean;
687
+ /** The three inputs that can switch remote-binding dev on, in precedence order. */
688
+ interface RemoteEnableInputs {
689
+ /**
690
+ * The `remote` preference from `lunora.config.*` (the lowest-priority signal).
691
+ * `undefined` means "no project preference"; an explicit `false` here loses
692
+ * to neither the flag nor the env when those are absent — it just stays off.
693
+ */
694
+ configPreference?: boolean;
695
+ /** The raw `LUNORA_REMOTE` env value (parsed with {@link isRemoteEnvEnabled}). */
696
+ envValue?: string;
697
+ /** The explicit `--remote` CLI flag — `true` when passed, `undefined`/`false` otherwise. */
698
+ flag?: boolean;
699
+ }
700
+ /**
701
+ * Resolve whether remote-binding dev is on, with a clear precedence:
702
+ *
703
+ * 1. an explicit `--remote` flag (highest — a deliberate per-invocation choice),
704
+ * 2. then `LUNORA_REMOTE` in the environment,
705
+ * 3. then the `remote` key in `lunora.config.*` (lowest — a project default).
706
+ *
707
+ * The flag and env are one-directional (they can only turn remote *on*); only
708
+ * the config preference carries a meaningful `false`, and it applies solely when
709
+ * neither stronger signal is present. So a project that sets `"remote": false`
710
+ * is still overridable per-run by `--remote` or `LUNORA_REMOTE=1`.
711
+ */
712
+ declare const resolveRemoteEnabled: (inputs: RemoteEnableInputs) => boolean;
713
+ /** The configs to pass as `--config`, in input order, and what was done to them. */
714
+ interface ServiceDevConfigs {
715
+ /** Unlinks every copy written. Idempotent, never throws — a no-op when none was. */
716
+ cleanup: () => void;
717
+ configPaths: string[];
718
+ /** The remote-only bindings (`ai`, `artifacts`) left out of a service copy for lack of Cloudflare credentials, for the dev warning. */
719
+ withheld: WithheldBinding[];
720
+ }
721
+ interface ServiceMaterializeOptions {
722
+ /** Whether wrangler can authenticate; defaults to a probe of `projectRoot`. */
723
+ hasCredentials?: () => boolean;
724
+ /** The app's folder, where `wrangler dev` runs and whose `.env` files it reads. */
725
+ projectRoot: string;
726
+ }
727
+ /**
728
+ * Resolve the `--config` path of each service the shared `wrangler dev` session
729
+ * runs, writing a copy only for a service that needs one (see the module doc).
730
+ */
731
+ declare const materializeServiceDevConfigs: (wranglerPaths: ReadonlyArray<string>, options: ServiceMaterializeOptions) => ServiceDevConfigs;
732
+ /** Whether `assets` is exactly the block reconcile writes. Its directory, under `.lunora/`, is what marks it as Lunora's. */
733
+ declare const isOwnedStudioAssets: (assets: unknown) => boolean;
734
+ /**
735
+ * The Cloudflare toolchain ranges a scaffolded Lunora app declares — the one
736
+ * source for `lunora init`'s overlay. The `templates/*` starters are fetched at
737
+ * runtime and cannot import this, so `tests/vis-templates` asserts that every
738
+ * template declaring one of these packages declares exactly this range.
739
+ *
740
+ * `@cloudflare/workers-types` is on the v5 line: v4 ended at 4.20260702.1, and
741
+ * v5's root entrypoint is the latest runtime (AI Search, Artifacts, Analytics
742
+ * SQL, tracing `setStatus`). `wrangler` >= 4.145.0 accepts the Analytics SQL
743
+ * `analytics` binding that `ctx.analyticsSql` makes `lunora dev` write, and
744
+ * >= 4.142.0 declares and runs Workflows in `exports`, which codegen writes.
745
+ * `@cloudflare/vite-plugin` matches the wrangler it embeds.
746
+ *
747
+ * Bump it together with the `cloudflare` / `vite` catalogs in `pnpm-workspace.yaml`.
748
+ */
749
+ declare const CLOUDFLARE_TOOLCHAIN_VERSIONS: Readonly<Record<"@cloudflare/vite-plugin" | "@cloudflare/workers-types" | "wrangler", string>>;
750
+ /**
751
+ * Return a new `WranglerConfig` with `consumer` present in `tail_consumers`,
752
+ * wiring this Worker to forward its tail events (logs/exceptions) to another
753
+ * Worker that fans them out to an external sink. Pure and idempotent: an
754
+ * existing entry with the same `service` + `environment` is left untouched
755
+ * rather than duplicated, so it is safe to call on every codegen/deploy.
756
+ */
757
+ declare const withTailConsumer: (wrangler: WranglerConfig, consumer: TailConsumer) => WranglerConfig;
758
+ /**
759
+ * Single source of truth for "does this wrangler config enable Workers
760
+ * Cache?" and "what compatibility_date does that require?".
761
+ *
762
+ * Before this module, `reconcile-compatibility-date.ts` (auto-bump) and
763
+ * `wrangler-validator.ts` (validation) each carried their own
764
+ * `WORKERS_CACHE_MIN_DATE` literal and their own top-level/`exports[]`
765
+ * cache-enabled walk — two copies of the same fact that could silently drift
766
+ * apart (a date bumped in one file without the other would either validate a
767
+ * config the reconciler wouldn't produce, or vice versa).
768
+ */
769
+ /** The `compatibility_date` Workers Cache (`cache.enabled: true`) requires. */
770
+ declare const WORKERS_CACHE_MIN_DATE = "2026-05-01";
771
+ /** The subset of a parsed `wrangler.jsonc` the cache-enabled check reads. */
772
+ interface WranglerCacheShape {
773
+ cache?: {
774
+ enabled?: boolean;
775
+ } | null;
776
+ exports?: Record<string, {
777
+ cache?: {
778
+ enabled?: boolean;
779
+ } | null;
780
+ } | null> | null;
781
+ }
782
+ /**
783
+ * Whether Workers Cache is enabled anywhere in a parsed wrangler config — the
784
+ * top-level `cache.enabled` toggle, or a per-export override in
785
+ * `exports[name].cache.enabled` (Workers can scope cache per named export).
786
+ * `undefined`/`null` (an unparsed or absent config) is treated as disabled.
787
+ */
788
+ declare const isCacheEnabled: (parsed: WranglerCacheShape | null | undefined) => boolean;
789
+ interface WranglerCodegenInputs {
790
+ /**
791
+ * The assets binding of every `assets` block (top level, then each `env.<name>`) that falls back to a single-page
792
+ * app, each name once. An environment's block replaces the top-level one whole, so each may name its own binding.
793
+ */
794
+ spaAssetsBindings?: string[];
795
+ /**
796
+ * Where Studio's documents ship as Workers Static Assets: the binding, and the assets directory relative to the
797
+ * project root. Absent keeps them in the Worker bundle (see `studio-assets.ts`).
798
+ */
799
+ studioAssets?: {
800
+ binding: string;
801
+ directory: string;
802
+ };
803
+ /**
804
+ * The worker entry file the deploy bundles, absolute: the composed `src/worker.ts` when it exists (the deploy
805
+ * passes it in place of `main`), else wrangler's `main`, else the first `WORKER_ENTRY_FALLBACKS` file. Absent when
806
+ * none exists, as for the composed `virtual:lunora/worker`. Codegen's `cloudflare:*` import gate starts from it.
807
+ */
808
+ workerEntry?: string;
809
+ /** Every well-formed `queues.producers[]` entry of the top level and each `env.<name>` block. */
810
+ wranglerQueueProducers: WranglerQueueProducerIR[];
811
+ /** Top-level `vars` entries that look like plaintext secrets. */
812
+ wranglerVariables: WranglerVariableIR[];
813
+ }
814
+ /**
815
+ * The wrangler inputs are empty when there is no wrangler config or it does not parse; `workerEntry` is still probed. Pass the `target` codegen runs with, so
816
+ * an explicit `--target` decides the Studio documents' placement the same way `reconcileStudioAssets` does.
817
+ */
818
+ declare const wranglerCodegenInputs: (projectRoot: string, target?: string) => WranglerCodegenInputs;
819
+ interface WranglerEnvironmentMerge {
820
+ /** Set when `environment` names no `env.<name>` block declared in the config — the caller should treat this as a hard validation failure. */
821
+ error?: string;
822
+ /** The env-scoped view: `wrangler` unchanged when `environment` is `undefined`, otherwise merged per {@link NON_INHERITABLE_KEYS} / {@link INHERITABLE_KEYS}. */
823
+ merged: WranglerConfig;
824
+ /**
825
+ * Keys the env block overrides whose inheritance status this validator
826
+ * cannot verify (not in either table above) — validated against the
827
+ * TOP-LEVEL value only, per the "do not guess" rule; the override is
828
+ * silently ignored for validation purposes. The caller logs this ONCE
829
+ * (not per key) so an unusual `env.<name>` block doesn't spam warnings.
830
+ */
831
+ unverifiedKeys: string[];
832
+ }
833
+ /**
834
+ * Resolve the config view `wrangler deploy --env <environment>` will actually
835
+ * use. Undefined `environment` returns `wrangler` unchanged — the top-level
836
+ * config is what a plain `wrangler deploy` reads, same as today.
837
+ *
838
+ * Deliberately independent of any other merge in this module: called fresh
839
+ * from the ORIGINAL `wrangler` each time (see both call sites), so there is
840
+ * no risk of merging an already-merged config and silently losing the
841
+ * top-level fallback a second merge pass would no longer have access to.
842
+ */
843
+ declare const mergeWranglerEnvironment: (wrangler: WranglerConfig, environment: string | undefined) => WranglerEnvironmentMerge;
844
+ /** Candidate wrangler config filenames, in the order every consumer probes them. */
845
+ declare const WRANGLER_FILES: readonly ["wrangler.jsonc", "wrangler.json"];
846
+ /** Locate the project's wrangler config, or `undefined` when none exists. */
847
+ declare const findWranglerFile: (projectRoot: string) => string | undefined;
848
+ interface ReadWranglerResult<T> {
849
+ /** Parsed config, or `undefined` when the file was not valid JSONC. */
850
+ parsed: T | undefined;
851
+ /** Raw file text — needed for comment-preserving `modify`/`applyEdits`. */
852
+ text: string;
853
+ }
854
+ /**
855
+ * Read and JSONC-parse a wrangler config file. Returns the raw `text` (for
856
+ * structural edits) alongside `parsed`, which is `undefined` when the file is
857
+ * not valid JSONC or does not parse to an object. Allows trailing commas, as
858
+ * wrangler does.
859
+ */
860
+ declare const readWranglerJsonc: <T = unknown>(wranglerPath: string) => ReadWranglerResult<T>;
861
+ interface WranglerProjectValidationOptions {
862
+ /** Memoises the schema discovery, shared with binding inference. */
863
+ cache?: DiscoveryCache;
864
+ /**
865
+ * Cloudflare environment to validate against `env.<name>` in
866
+ * wrangler.jsonc. See {@link mergeWranglerEnvironment} for which keys
867
+ * inherit the top-level value vs must be redeclared per environment.
868
+ * Omit to validate the top-level config only (unchanged default).
869
+ */
870
+ environment?: string;
871
+ projectRoot: string;
872
+ schemaDir?: string;
873
+ }
874
+ interface WranglerProjectValidationResult {
875
+ problems: ReadonlyArray<string>;
876
+ report: WranglerValidationReport;
877
+ wranglerPath: string | undefined;
878
+ }
879
+ /**
880
+ * The phrase every unexported-class error carries.
881
+ *
882
+ * Exported because it is a CONTRACT, not prose: `lunora doctor` picks these
883
+ * errors out of the report by substring to raise its own finding, and the
884
+ * validator's report is a flat `string[]`. Until the report entries carry a
885
+ * code, a copy-edit here would silently disable that check — so the copy-edit
886
+ * has to go through this constant.
887
+ */
888
+ declare const UNEXPORTED_CLASS_MARKER = "does not export it";
889
+ /**
890
+ * File-system aware variant: reads `wrangler.jsonc`/`wrangler.json` from
891
+ * the given project root, discovers the schema (if any), and delegates to
892
+ * `validateWranglerConfig`. Returns the legacy
893
+ * `{ problems, wranglerPath }` shape plus the structured `report`.
894
+ */
895
+ declare const validateWranglerProject: (options: WranglerProjectValidationOptions) => WranglerProjectValidationResult;
896
+ /**
897
+ * Pure scan of a `vars` map for plaintext secrets — the FS-free core, exported for
898
+ * unit tests. A variable is flagged when, for a **string** value that is neither a
899
+ * placeholder nor a public/publishable key, EITHER the value matches a known
900
+ * secret shape (`secretKindOf`) OR the key name strongly implies a secret and the
901
+ * value is long enough to plausibly be one. `kind` is the matched shape, or
902
+ * `secret_named_var` for the key-name path.
903
+ */
904
+ declare const scanWranglerVariablesForSecrets: (variables: Record<string, unknown> | undefined, file: string, lineOf?: (key: string) => number | undefined) => WranglerVariableIR[];
905
+ declare const REQUIRED_COMPATIBILITY_DATE: string;
906
+ declare const REQUIRED_FLAG: string;
907
+ /**
908
+ * Pure validator: given a parsed `WranglerConfig` object and an optional
909
+ * `SchemaInfo`, produce a structured report. Performs no I/O.
910
+ *
911
+ * `environment`, when set, validates the `env.<environment>` view
912
+ * ({@link mergeWranglerEnvironment}) instead of the top-level config — e.g. a
913
+ * `durable_objects` binding present only at the top level is a validation
914
+ * FAILURE for `--env production` if `env.production` doesn't repeat it,
915
+ * because `durable_objects` is non-inheritable and wrangler will not carry it
916
+ * over. Omit `environment` to validate the top level only (unchanged default).
917
+ */
918
+ declare const validateWranglerConfig: (wranglerInput: WranglerConfig | undefined, schema?: SchemaInfo, environment?: string) => WranglerValidationReport;
919
+ /**
920
+ * Convenience alias matching the original task-spec signature
921
+ * `validateWrangler(wranglerJson, schema)` returning
922
+ * `{ valid, errors, warnings }`.
923
+ */
924
+ declare const validateWrangler: typeof validateWranglerConfig;
925
+ export { type AssertWranglerOptions, type AssetHeadersLogger, type AssetHeadersOptions, type AssetHeadersResult, CLOUDFLARE_CLI_CONFIG_WARNING_ENV, CLOUDFLARE_DRIVER, CLOUDFLARE_TOOLCHAIN_VERSIONS, type CloudflareCliConfigFinding, type CloudflareCredentialProbe, type DevConfigKind, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, type LocalHyperdrive, type Manifest, type MaterializeDevOptions, type MaterializeDevResult, 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 WranglerEnvironmentMerge, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport,
926
+ /**
927
+ * `@lunora/config/cloudflare` — the wrangler layer.
928
+ *
929
+ * Everything here speaks `wrangler.jsonc`: validating it, reconciling inferred
930
+ * bindings/crons/compatibility-date into it, resolving remote bindings, and the
931
+ * `DeployDriver` that ties them together for `--target cloudflare`.
932
+ *
933
+ * Split out from the package root so `@lunora/config` itself stays
934
+ * provider-neutral. The root keeps what any target needs — the `DeployDriver`
935
+ * contract, the driver registry, project config and target resolution,
936
+ * `.dev.vars` grammar, binding *inference* — while emission and validation,
937
+ * which are wrangler-shaped by definition, live behind this subpath.
938
+ * Plan 114 §5.3 (D6): a package carrying real provider code isolates it behind a
939
+ * subpath rather than relocating wholesale.
940
+ */
941
+ applyModify, assertWranglerSatisfiesSchema, bindingsNeedingDatabase, collectExportGaps, describePreservedCrons, describeWithheld, detectCloudflareCliConfig, emitProjectAssetHeaders, findWranglerFile, hasCloudflareCredentials, injectRemoteFlags, isCacheEnabled, isOwnedStudioAssets, isRemoteEnvEnabled, materializeDevWranglerConfig, materializeServiceDevConfigs, mergeWranglerEnvironment, pendingBindingChanges, planRemoteBindings, readManifest, readWranglerJsonc, reconcileBindingsSafely, reconcileStudioAssets, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, reconcileWranglerExtras, recordManifestKey, resolveRemoteEnabled, scanWranglerVariablesForSecrets, startLocalHyperdrive, toRemotePlan, validateWrangler, validateWranglerConfig, validateWranglerProject, warnCloudflareCliConfigOnce, withTailConsumer, withheldBindings, wranglerCodegenInputs, writeAssetHeaders };