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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/LICENSE.md +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 +1492 -0
  7. package/dist/cloudflare/index.d.ts +1492 -0
  8. package/dist/cloudflare/index.mjs +1 -0
  9. package/dist/index.d.mts +1076 -975
  10. package/dist/index.d.ts +1076 -975
  11. package/dist/index.mjs +1 -23
  12. package/dist/packem_shared/ACCENT-CotPTfv7.mjs +7 -0
  13. package/dist/packem_shared/ADVISOR_PROCEDURES_ENDPOINT-BPnqzAgT.mjs +1 -0
  14. package/dist/packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs +1 -0
  15. package/dist/packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs +1 -0
  16. package/dist/packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs +1 -0
  17. package/dist/packem_shared/BINDING_MANIFEST_VERSION-CR06-eW7.mjs +1 -0
  18. package/dist/packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs +1 -0
  19. package/dist/packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-75Y5zVF8.mjs +1 -0
  20. package/dist/packem_shared/CLOUDFLARE_DRIVER-DbmpoIcg.mjs +1 -0
  21. package/dist/packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DWyZ_2QM.mjs +1 -0
  22. package/dist/packem_shared/COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs +1 -0
  23. package/dist/packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs +1 -0
  24. package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-CAJl2nEI.mjs +1 -0
  25. package/dist/packem_shared/DEFAULT_OBSERVABILITY-CPLADr5u.mjs +1 -0
  26. package/dist/packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs +4 -0
  27. package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs +6 -0
  28. package/dist/packem_shared/DEV_WORKER_ENV_VALUE-FoysLtF0.mjs +1 -0
  29. package/dist/packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs +1 -0
  30. package/dist/packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs +2 -0
  31. package/dist/packem_shared/LUNORA_EVENT_SOURCE-Cq0oj0_9.mjs +9 -0
  32. package/dist/packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs +19 -0
  33. package/dist/packem_shared/LUNORA_TAG-DQTGPqcJ.mjs +1 -0
  34. package/dist/packem_shared/LunoraReporter-f277GLNT.mjs +6 -0
  35. package/dist/packem_shared/MissingBuildOutputError-BAyekzof.mjs +1 -0
  36. package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs +1 -0
  37. package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-UcPFeEyM.mjs +1 -0
  38. package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-D66_hwjD.mjs +1 -0
  39. package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-BPxR2Ht_.mjs +1 -0
  40. package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-C-ic_pvD.mjs +1 -0
  41. package/dist/packem_shared/SEED_ENDPOINT-C1fhrehH.mjs +1 -0
  42. package/dist/packem_shared/STUDIO_PATH-CDf-EtPs.mjs +1 -0
  43. package/dist/packem_shared/STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs +1 -0
  44. package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-Zw1oiigQ.mjs +1 -0
  45. package/dist/packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs +1 -0
  46. package/dist/packem_shared/WRANGLER_FILES-BF8PUjuo.mjs +1 -0
  47. package/dist/packem_shared/acceptsConnection-DHhUYGjT.mjs +2 -0
  48. package/dist/packem_shared/addArgsFor-CYZKhNIo.mjs +1 -0
  49. package/dist/packem_shared/applyAdditiveEdit-DEwPKcJg.mjs +6 -0
  50. package/dist/packem_shared/applyModify-DKP2l6S9.mjs +1 -0
  51. package/dist/packem_shared/assertBuildTargetMatches-tkKAa5zl.mjs +1 -0
  52. package/dist/packem_shared/assertWranglerSatisfiesSchema-CZWQnfly.mjs +3 -0
  53. package/dist/packem_shared/asset-headers-CPuEX21i.mjs +4 -0
  54. package/dist/packem_shared/assetContentType-CUb5bpbI.mjs +1 -0
  55. package/dist/packem_shared/bindingsNeedingDatabase-3KyGflIq.mjs +3 -0
  56. package/dist/packem_shared/blockingFindingsMessage-CRbg1sla.mjs +1 -0
  57. package/dist/packem_shared/buildPackageSecretsBlock-DrSD60vH.mjs +19 -0
  58. package/dist/packem_shared/canonicalPath-DrfMiT3U.mjs +1 -0
  59. package/dist/packem_shared/celld-binding-id-9MiUoteo.mjs +1 -0
  60. package/dist/packem_shared/celld-config-CpvLkAEg.mjs +3 -0
  61. package/dist/packem_shared/checkDevEnv-egiW2lSF.mjs +3 -0
  62. package/dist/packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs +24 -0
  63. package/dist/packem_shared/clearApiSpecMarker-DMGpP41V.mjs +2 -0
  64. package/dist/packem_shared/collectExportGaps-BYo3bcXi.mjs +2 -0
  65. package/dist/packem_shared/createConfirm-D5mKTMHj.mjs +7 -0
  66. package/dist/packem_shared/createDiscoveryCache-npJI4uej.mjs +1 -0
  67. package/dist/packem_shared/createStudioDocumentCache-XBG1aWbl.mjs +1 -0
  68. package/dist/packem_shared/deploy-driver.d-CHVNQFV2.d.mts +190 -0
  69. package/dist/packem_shared/deploy-driver.d-CHVNQFV2.d.ts +190 -0
  70. package/dist/packem_shared/describePreservedCrons-i5XT6rtl.mjs +1 -0
  71. package/dist/packem_shared/describeWithheld-CbyzZjZF.mjs +1 -0
  72. package/dist/packem_shared/detectFramework-Dfpvu6rD.mjs +1 -0
  73. package/dist/packem_shared/devTriggerHints-CN_RJxWW.mjs +1 -0
  74. package/dist/packem_shared/devVariablesStamp-BQkGEn9d.mjs +1 -0
  75. package/dist/packem_shared/discover-info-DC2MrAIM.mjs +1 -0
  76. package/dist/packem_shared/discoverAgentInfo-pqFMJBtJ.mjs +1 -0
  77. package/dist/packem_shared/discoverContainerInfo-DzXr7Vm3.mjs +1 -0
  78. package/dist/packem_shared/discoverSchemaInfo-DRPnqgif.mjs +1 -0
  79. package/dist/packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs +1 -0
  80. package/dist/packem_shared/emitProjectAssetHeaders-6iinmRWE.mjs +1 -0
  81. package/dist/packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs +7 -0
  82. package/dist/packem_shared/env-flag-u4B05gLp.mjs +1 -0
  83. package/dist/packem_shared/guards-CoCtgpeR.mjs +1 -0
  84. package/dist/packem_shared/hasCloudflareCredentials-ByCrwaLT.mjs +1 -0
  85. package/dist/packem_shared/index.d-BoUSSRrk.d.mts +270 -0
  86. package/dist/packem_shared/index.d-C1nVDcie.d.ts +270 -0
  87. package/dist/packem_shared/inferLunoraBindings-Biq1OW9V.mjs +1 -0
  88. package/dist/packem_shared/is-plain-object-CWxHeOY1.mjs +1 -0
  89. package/dist/packem_shared/materializeServiceDevConfigs-CI1HXv7f.mjs +1 -0
  90. package/dist/packem_shared/mergeWranglerEnvironment-D5ekKj5x.mjs +1 -0
  91. package/dist/packem_shared/parseSchema-D1Wbr1qv.mjs +1 -0
  92. package/dist/packem_shared/pendingBindingChanges-5fPhwxMt.mjs +1 -0
  93. package/dist/packem_shared/placeholder-ids.d-DvGHP6bl.d.mts +338 -0
  94. package/dist/packem_shared/placeholder-ids.d-DvGHP6bl.d.ts +338 -0
  95. package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.mts +86 -0
  96. package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.ts +86 -0
  97. package/dist/packem_shared/probeCelldToolchain-DxDttfHy.mjs +1 -0
  98. package/dist/packem_shared/process-tree-once-Ou4SfxKM.mjs +1 -0
  99. package/dist/packem_shared/queue-info-D38n7YdX.mjs +1 -0
  100. package/dist/packem_shared/readManifest-Cighz3WC.mjs +6 -0
  101. package/dist/packem_shared/readProjectDependencies-l3uhUKjo.mjs +1 -0
  102. package/dist/packem_shared/reconcile-services-CjgIJKim.mjs +1 -0
  103. package/dist/packem_shared/reconcileWranglerBindings-D7mXDfAe.mjs +1 -0
  104. package/dist/packem_shared/reconcileWranglerCompatibilityDate-Cj94osA-.mjs +1 -0
  105. package/dist/packem_shared/renderStudioHtml-CRDTNivi.mjs +15 -0
  106. package/dist/packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs +1 -0
  107. package/dist/packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs +1 -0
  108. package/dist/packem_shared/scanWranglerVariablesForSecrets-DojbojUo.mjs +1 -0
  109. package/dist/packem_shared/secret-key-xi4VK8Jw.mjs +1 -0
  110. package/dist/packem_shared/sendStudioAsset-B81Pex91.mjs +1 -0
  111. package/dist/packem_shared/serveJsonHandler-B8_GE6QC.mjs +1 -0
  112. package/dist/packem_shared/startCelldDevSession-DQ7YylR_.mjs +1 -0
  113. package/dist/packem_shared/streamContainerLogs-0nko1qpv.mjs +2 -0
  114. package/dist/packem_shared/validate-bindings-CQbR23li.mjs +1 -0
  115. package/dist/packem_shared/withTailConsumer-CKXL6P6s.mjs +1 -0
  116. package/dist/packem_shared/worker-entry-checks-DH-ApvvX.mjs +1 -0
  117. package/dist/packem_shared/wranglerCodegenInputs-Cz9ByxSo.mjs +1 -0
  118. package/dist/packem_shared/wranglerToAlchemy-CBO2ucRm.mjs +6 -0
  119. package/dist/packem_shared/write-atomic-CcNMkFsX.mjs +3 -0
  120. package/dist/packem_shared/writeAssetHeaders-C5igmezc.mjs +1 -0
  121. package/dist/studio-host/index.d.mts +371 -136
  122. package/dist/studio-host/index.d.ts +371 -136
  123. package/dist/studio-host/index.mjs +1 -7
  124. package/package.json +34 -8
  125. package/dist/packem_shared/ACCENT-DW1XJn8i.mjs +0 -40
  126. package/dist/packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs +0 -40
  127. package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs +0 -37
  128. package/dist/packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs +0 -52
  129. package/dist/packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs +0 -34
  130. package/dist/packem_shared/LUNORA_EVENT_SOURCE-D2fDeGB6.mjs +0 -86
  131. package/dist/packem_shared/LunoraReporter-Ci-bDCK9.mjs +0 -70
  132. package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-B8t_SdoZ.mjs +0 -70
  133. package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-8bNMHGiu.mjs +0 -104
  134. package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-BC7_e9Bz.mjs +0 -105
  135. package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-2YYyWJUq.mjs +0 -561
  136. package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-Df-Wrix-.mjs +0 -99
  137. package/dist/packem_shared/SEED_ENDPOINT-DVCjaGO-.mjs +0 -61
  138. package/dist/packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs +0 -25
  139. package/dist/packem_shared/applyAdditiveEdit-C-snTFEV.mjs +0 -228
  140. package/dist/packem_shared/assetContentType-ByZjeV3D.mjs +0 -72
  141. package/dist/packem_shared/buildPackageSecretsBlock-B8iSX1Zo.mjs +0 -281
  142. package/dist/packem_shared/classifyPolicyEdit-BHeAqF8P.mjs +0 -99
  143. package/dist/packem_shared/createConfirm-fvpdgJ9s.mjs +0 -100
  144. package/dist/packem_shared/detectFramework-Br-BcPBq.mjs +0 -41
  145. package/dist/packem_shared/discoverContainerInfo-BXFs6Wav.mjs +0 -19
  146. package/dist/packem_shared/discoverSchemaInfo-BB-CKlTK.mjs +0 -25
  147. package/dist/packem_shared/discoverWorkflowInfo-CedvR0mn.mjs +0 -19
  148. package/dist/packem_shared/inferLunoraBindings-ByMwG-gH.mjs +0 -352
  149. package/dist/packem_shared/parseDevVariable-CJiq2IwE.mjs +0 -30
  150. package/dist/packem_shared/parseSchema-DSeyktvG.mjs +0 -107
  151. package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.mts +0 -74
  152. package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.ts +0 -74
  153. package/dist/packem_shared/reconcileWranglerBindings-Cruwwx1M.mjs +0 -334
  154. package/dist/packem_shared/renderStudioHtml-449Ysn75.mjs +0 -37
  155. package/dist/packem_shared/serveJsonHandler-B4OLTGLS.mjs +0 -86
  156. package/dist/packem_shared/streamContainerLogs-BZ4cOZwH.mjs +0 -157
@@ -0,0 +1,338 @@
1
+ import { SchemaIR, AgentIR, ContainerIR, QueueIR, ServiceBindingIR, WorkflowIR } from '@lunora/codegen';
2
+ /**
3
+ * An invocation-scoped memo for project discovery. A CLI command creates one,
4
+ * threads it through every `discover*` / `inferLunoraBindings` call it makes,
5
+ * and clears it after anything rewrites the sources discovery reads (codegen).
6
+ * Deliberately not module-level: tests and long-lived processes never see a
7
+ * stale result.
8
+ */
9
+ interface DiscoveryCache {
10
+ /** Drop every memoised result. */
11
+ clear: () => void;
12
+ /** Return the result memoised under `key`, computing it on first use. */
13
+ memo: <T>(key: string, compute: () => T) => T;
14
+ }
15
+ declare const createDiscoveryCache: () => DiscoveryCache;
16
+ /** One filterable Vectorize metadata property a schema declares. */
17
+ interface VectorMetadataDeclaration {
18
+ /** The vector index the property belongs to. */
19
+ index: string;
20
+ /**
21
+ * The validator kind behind the column, with `v.optional(...)` and a
22
+ * nullable union unwrapped (metadata columns are usually optional), or
23
+ * `undefined` when the column isn't in the owning table's shape. Callers map it to the Vectorize
24
+ * metadata type; a kind that can't be filtered on is reported, not indexed.
25
+ */
26
+ kind: string | undefined;
27
+ /** Column mirrored into vector metadata. */
28
+ property: string;
29
+ }
30
+ interface SchemaInfo {
31
+ /**
32
+ * Whether the schema declares a **D1-backed** `.global()` table — the only
33
+ * flavour that needs the `DB` binding and the app's `.global({ d1 })` chain.
34
+ * A `.global({ backend: "hyperdrive" })` table needs neither, and counting it
35
+ * here demanded a D1 database of a project that has none.
36
+ */
37
+ hasD1GlobalTable: boolean;
38
+ /** Whether the schema declares a `.global({ backend: "hyperdrive" })` table — needs the app's `.hyperdriveGlobal(...)` chain instead. Required, not optional: the only producer always knows the answer, and `?` made every consumer read a two-valued fact as three-valued. */
39
+ hasHyperdriveGlobalTable: boolean;
40
+ /**
41
+ * Data-residency jurisdiction declared via `defineSchema(...).jurisdiction("…")`.
42
+ * It pins the app's Durable Objects only; KV namespaces and R2 buckets carry
43
+ * their own jurisdiction, set when they are created.
44
+ */
45
+ jurisdiction?: SchemaIR["jurisdiction"];
46
+ /** Names of vector indexes declared via `.vectorize()` / `defineVectorIndex()`. */
47
+ vectorIndexNames?: ReadonlyArray<string>;
48
+ /**
49
+ * Metadata properties declared filterable on a vector index. Cloudflare
50
+ * needs an explicit metadata index per property before a `filter` can match
51
+ * anything, so deploy provisions these and doctor reports them.
52
+ */
53
+ vectorMetadata?: ReadonlyArray<VectorMetadataDeclaration>;
54
+ }
55
+ interface DiscoverSchemaInfoResult {
56
+ /** Parse error message, when the schema exists but could not be analyzed. */
57
+ error?: string;
58
+ /** Schema facts, or `undefined` when no `schema.ts` exists or parsing failed. */
59
+ info: SchemaInfo | undefined;
60
+ }
61
+ /** Discover the schema facts, memoised on `cache` when one is given. */
62
+ declare const discoverSchemaInfo: (projectRoot: string, schemaDirectory: string, cache?: DiscoveryCache) => DiscoverSchemaInfoResult;
63
+ interface DurableObjectSpec {
64
+ binding: string;
65
+ className: string;
66
+ }
67
+ /**
68
+ * Canonical Durable Object class → binding name. wrangler requires the worker
69
+ * to export a class of this exact name, so detection keys on the class name.
70
+ */
71
+ declare const DURABLE_OBJECT_BINDINGS: {
72
+ readonly AdminRevocationDO: "ADMIN_REVOCATIONS";
73
+ readonly LunoraDO: "SHARD";
74
+ readonly SchedulerDO: "SCHEDULER";
75
+ readonly SessionDO: "SESSION";
76
+ readonly ShardDO: "SHARD";
77
+ readonly ShardRegistryDO: "SHARD_REGISTRY";
78
+ };
79
+ type DurableObjectClass = keyof typeof DURABLE_OBJECT_BINDINGS;
80
+ /**
81
+ * The `_generated/` modules that hold a generated Durable Object / Workflow
82
+ * class — one per class kind a project can declare. wrangler validates every
83
+ * `class_name` against the worker's exports, so this is the set a worker entry
84
+ * re-exports (and the set the composed class-A entry star-re-exports for the
85
+ * kinds the project has).
86
+ *
87
+ * Owned here because four places need it and they must not drift:
88
+ * `@lunora/vite` emits one star re-export per entry, the wrangler validator
89
+ * DECIDES the composed entry's exports from it, `reconcile-bindings` types its
90
+ * export-gap `module` field on it, and this module's own `detectClassExports`
91
+ * probes the same names.
92
+ *
93
+ * `scheduler` carries no `define*` declarations of its own — codegen writes it
94
+ * off `hasScheduler` purely so the composed class-A entry has a `SchedulerDO`
95
+ * to forward. Its presence is therefore the ONLY signal the plugin and the
96
+ * validator need, and it is the same signal that decides whether the builder
97
+ * has a `.scheduler()` method at all. `@lunora/vite` depends on `@lunora/config`, so config
98
+ * owning it is the direction the dependency graph allows.
99
+ */
100
+ declare const GENERATED_CLASS_MODULES: readonly ["adminRevocations", "agents", "containers", "scheduler", "shardRegistry", "workflows"];
101
+ /** One {@link GENERATED_CLASS_MODULES} entry. */
102
+ type GeneratedClassModule = (typeof GENERATED_CLASS_MODULES)[number];
103
+ /**
104
+ * The framework Durable Object each class module forwards, for the modules that
105
+ * carry one: codegen writes them off the same signal that gives the builder the
106
+ * matching method, so the module's existence means the composed entry exports
107
+ * the class.
108
+ */
109
+ declare const GENERATED_MODULE_DURABLE_OBJECTS: Partial<Record<GeneratedClassModule, DurableObjectClass>>;
110
+ /** The `_generated/` module codegen writes when `lunora.config` opts in to the merge. */
111
+ declare const MERGED_DURABLE_OBJECTS_MODULE: "durableObjects";
112
+ /**
113
+ * Whether the project merges its Durable Objects: codegen wrote the merge
114
+ * module. The one test the composed entry, binding inference and the export
115
+ * validator all ask — the same "module existence is the signal" rule the
116
+ * scheduler and registry modules follow.
117
+ */
118
+ declare const isMergedProject: (generatedDirectory: string) => boolean;
119
+ /** Whether `module` holds a class the merged class hosts — imported into it, never re-exported. */
120
+ declare const isMergedRoleModule: (module: string) => boolean;
121
+ /**
122
+ * The class-B composed entry. `lunora deploy` passes this file to wrangler as
123
+ * the positional script whenever it exists, overriding `wrangler.main` — so it
124
+ * is what actually gets bundled and what wrangler checks its DO/Workflow
125
+ * bindings against. `main` in a class-B project names the framework adapter's
126
+ * build output (`.svelte-kit/cloudflare/_worker.js`, `dist/_worker.js`), which
127
+ * exists after `vite build` and exports only the SSR fetch handler. Lexing that
128
+ * instead read every declared class as unexported: nothing provisioned, plus a
129
+ * "add `export * from …`" warning the user cannot silence.
130
+ *
131
+ * Exported, not documented-as-duplicated: the CLI's `resolveComposedWorkerEntry`
132
+ * imports this constant, so the deploy's positional entry and the file this
133
+ * module lexes for exported classes cannot drift apart.
134
+ */
135
+ declare const COMPOSED_WORKER_ENTRY = "src/worker.ts";
136
+ /**
137
+ * A `defineContainer` declaration plus whether its generated DO class is
138
+ * exported by the worker entry. Only exported containers are safe to
139
+ * provision — wrangler rejects a `containers[].class_name` (and its Durable
140
+ * Object binding) that the worker doesn't export.
141
+ */
142
+ type InferredContainer = ContainerIR & {
143
+ exported: boolean;
144
+ };
145
+ /**
146
+ * A `defineWorkflow` declaration plus whether its generated
147
+ * `WorkflowEntrypoint` class is exported by the worker entry. Only exported
148
+ * workflows are safe to provision — wrangler rejects an `exports.<Class>`
149
+ * workflow the worker doesn't export. Workflows are NOT Durable Objects, so this never
150
+ * implies a `durable_objects` binding or migration.
151
+ */
152
+ interface InferredWorkflow extends WorkflowIR {
153
+ exported: boolean;
154
+ }
155
+ /**
156
+ * A `defineAgent` declaration plus whether its generated agent
157
+ * `WorkflowEntrypoint` class (e.g. `SupportAgentWorkflow`) is exported by the
158
+ * worker entry. An agent compiles onto a Cloudflare Workflow, so — exactly like
159
+ * {@link InferredWorkflow} — only exported agents are safe to provision
160
+ * (wrangler rejects an `exports.<Class>` workflow the worker doesn't export), and
161
+ * an agent is NOT a Durable Object (no `durable_objects` binding or migration).
162
+ */
163
+ interface InferredAgent extends AgentIR {
164
+ exported: boolean;
165
+ }
166
+ /**
167
+ * A queue declared in `lunora/queues.ts`. Unlike workflows, a queue needs no
168
+ * worker-entry class export (its `queue()` handler rides `createWorker`), so
169
+ * there is no `exported` flag — every declared queue is reconcilable into the
170
+ * wrangler `queues.producers[]` / `queues.consumers[]`.
171
+ */
172
+ type InferredQueue = QueueIR;
173
+ interface InferredBindings {
174
+ /** Agents declared in `lunora/agents.ts` (exported or not — see {@link InferredAgent.exported}); reconciled into wrangler `exports`. */
175
+ agents: InferredAgent[];
176
+ /** Containers declared in `lunora/containers.ts` (exported or not — see {@link InferredContainer.exported}). */
177
+ containers: InferredContainer[];
178
+ /** Durable Objects the worker entry exports → safe to bind. */
179
+ durableObjects: DurableObjectSpec[];
180
+ /**
181
+ * The wrangler `flagship[].binding` name implied by `lunora/flags.ts` when it
182
+ * uses the Flagship provider in binding mode — `undefined` for HTTP-mode
183
+ * Flagship, a custom OpenFeature provider, or no flags. The binding needs an
184
+ * un-mintable `app_id`, so it is reconciled as a hint, not auto-written.
185
+ */
186
+ flagshipBinding?: string;
187
+ /** The worker entry exports `EventLogDO`, so the app mints the `LUNORA_RELAY_SECRET` the event log checks on every request. */
188
+ hostsEventLog: boolean;
189
+ /** The app hosts the registry (exports or binds `ShardRegistryDO`, or is merged with its module), so it mints the `LUNORA_RELAY_SECRET` its registry checks. */
190
+ hostsShardRegistry: boolean;
191
+ /**
192
+ * The schema's `.jurisdiction("…")`, when it declares one. Read by the binding
193
+ * hints whose resource takes its residency at creation (Artifacts), so the
194
+ * hint can name the jurisdiction to create it in.
195
+ */
196
+ jurisdiction?: SchemaInfo["jurisdiction"];
197
+ /** Schema declares a `.global()` table → needs the `DB` D1 binding. */
198
+ needsD1: boolean;
199
+ /** Queues declared in `lunora/queues.ts` → reconciled into `queues.producers[]` / `queues.consumers[]`. */
200
+ queues: InferredQueue[];
201
+ /**
202
+ * Sibling Workers declared in `lunora.config` `services` → reconciled into
203
+ * `services[]` (plan 457). `undefined` when the declaration is unreadable, so
204
+ * reconcile leaves every entry alone rather than removing the owned ones.
205
+ */
206
+ services: ServiceBindingIR[] | undefined;
207
+ /** Human-readable provenance for each inferred binding / hint, for logging. */
208
+ signals: string[];
209
+ /** `@lunora/ai` is imported, `ctx.ai` read, or `env.AI` used → needs the `ai` Workers AI binding. */
210
+ usesAi: boolean;
211
+ /** `@lunora/bindings/ai-search` is value-imported or `ctx.aiSearch` read → self-describing `ai_search_namespaces` binding (`AI_SEARCH` on namespace `default`; auto-writeable). */
212
+ usesAiSearch: boolean;
213
+ /** `@lunora/bindings/analytics` is imported or `ctx.analytics` read → self-describing `analytics_engine_datasets` binding (auto-writeable). */
214
+ usesAnalytics: boolean;
215
+ /** `@lunora/bindings/analytics-sql` is value-imported or `ctx.analyticsSql` read → self-describing `analytics` binding (`{ binding: ANALYTICS_SQL }`; auto-writeable, wrangler >= 4.145.0). */
216
+ usesAnalyticsSql: boolean;
217
+ /**
218
+ * `ctx.artifacts` is read or `@lunora/bindings/artifacts` value-imported.
219
+ * Reconcile writes the binding with the Worker's name as its namespace. The first repo
220
+ * `create()` against a missing namespace creates it UNRESTRICTED and the jurisdiction can
221
+ * never change after that, so `lunora deploy` creates a pinned schema's namespace in its
222
+ * jurisdiction, and stops when it can't.
223
+ */
224
+ usesArtifacts: boolean;
225
+ /** `@lunora/auth` is imported (sessions may be D1- or `SessionDO`-backed). */
226
+ usesAuth: boolean;
227
+ /** `@lunora/browser` is imported or `ctx.browser` read → self-describing `browser` binding (auto-writeable). */
228
+ usesBrowser: boolean;
229
+ /** `@lunora/auth/cimd/workers` is imported → needs the `global_fetch_strictly_public` compatibility flag (no binding; `lunora doctor` checks it). */
230
+ usesCimdWorkers: boolean;
231
+ /** The app constructs an `EventLogDOClient`, so it needs the `LUNORA_RELAY_SECRET` its host minted, hosting the log or not. */
232
+ usesEventLogClient: boolean;
233
+ /** `lunora/flags.ts` declares a feature-flag provider (any OpenFeature provider — Flagship or custom). */
234
+ usesFlags: boolean;
235
+ /** `@lunora/hyperdrive` is imported or `ctx.sql` read (reconcile writes `{ binding: "HYPERDRIVE" }` with a placeholder `id`; `lunora deploy` swaps in the created config's). */
236
+ usesHyperdrive: boolean;
237
+ /** `@lunora/bindings/images` is imported or `ctx.images` read → self-describing `images` binding (auto-writeable). */
238
+ usesImages: boolean;
239
+ /** `@lunora/bindings/kv` is imported or `ctx.kv` read (reconcile writes `{ binding: "KV" }` without an id and wrangler creates the namespace on deploy, unless the schema pins a jurisdiction). */
240
+ usesKv: boolean;
241
+ /** `@lunora/mail` is imported (Resend API key must be set in `.dev.vars`; no binding). No `ctx.mail` helper exists, so only the import counts. */
242
+ usesMail: boolean;
243
+ /** `@lunora/notify` is imported or `ctx.notify` read (no binding; channel secrets ride the `usesNotifyFcm*` / `usesNotifyWebPush` flags). */
244
+ usesNotify: boolean;
245
+ /** `lunora/notify.ts` configures the `fcm` channel and leaves its token to `fcmFromEnv` → `FCM_SERVICE_ACCOUNT` in `.dev.vars`. */
246
+ usesNotifyFcm: boolean;
247
+ /** The `fcm` channel passes its own `getAccessToken` but takes its project from env → `FCM_PROJECT_ID`. */
248
+ usesNotifyFcmTokenSource: boolean;
249
+ /** `lunora/notify.ts` configures the `webPush` channel → the `VAPID_*` secrets in `.dev.vars`. */
250
+ usesNotifyWebPush: boolean;
251
+ /** `@lunora/payment/autumn` is imported → the Autumn secrets in `.dev.vars` (no binding). */
252
+ usesPaymentAutumn: boolean;
253
+ /** `@lunora/payment/creem` is imported → the Creem secrets in `.dev.vars` (no binding). */
254
+ usesPaymentCreem: boolean;
255
+ /** `@lunora/payment/dodopayments` is imported → the Dodo Payments secrets in `.dev.vars` (no binding). */
256
+ usesPaymentDodopayments: boolean;
257
+ /** `@lunora/payment/polar` is imported → the Polar secrets in `.dev.vars` (no binding). */
258
+ usesPaymentPolar: boolean;
259
+ /** `@lunora/payment` is imported or `ctx.payments` read (provider secrets must be set in `.dev.vars`; no binding). */
260
+ usesPayments: boolean;
261
+ /** `@lunora/payment/stripe` is imported → the Stripe secrets in `.dev.vars` (no binding). */
262
+ usesPaymentStripe: boolean;
263
+ /** `@lunora/bindings/pipelines` is value-imported or `ctx.pipelines` read (binding needs an un-mintable remote pipeline name; hint-only). */
264
+ usesPipelines: boolean;
265
+ /** `@lunora/bindings/r2sql` is value-imported or `ctx.r2sql` read (needs the `R2_SQL_*` secrets in `.dev.vars`; no binding). */
266
+ usesR2sql: boolean;
267
+ /** `lunora/` value-imports `requestSecretTool` from `@lunora/agent` → the `LUNORA_SECRET_VALUE_KEY` secret in `.dev.vars` (no binding). Read off the same rule codegen gates on. */
268
+ usesRequestSecretTool: boolean;
269
+ /** `@lunora/scheduler` is imported or `ctx.scheduler` read. */
270
+ usesScheduler: boolean;
271
+ /** `@lunora/storage` is imported or `ctx.storage` read under `lunora/` (R2 bucket binding name is user-defined). */
272
+ usesStorage: boolean;
273
+ /** `jsCodeTool` is imported from `@lunora/agent` in `lunora/` → self-describing `worker_loaders` binding (`LOADER`). */
274
+ usesWorkerLoader: boolean;
275
+ /** `@lunora/x402/pay` is imported or `ctx.x402` read — the agent-wallet pay rail signs from a Secrets Store binding paired with a spend policy (ActionCtx-only; hint-only). */
276
+ usesX402: boolean;
277
+ /** `@lunora/x402/charge` is imported — the charge rail settles USDC to a recipient address (a public `[vars]` entry, user-named; hint-only). */
278
+ usesX402Charge: boolean;
279
+ /**
280
+ * Paths the Worker serves outside its reserved `/_lunora/*` plane, as written:
281
+ * each `httpRoute.<verb>(path)` route under `lunora/`, plus, when auth is
282
+ * imported, its base path (a literal `basePath` / `authBasePath` option, else
283
+ * `/api/auth`) and the two OAuth discovery prefixes under `/.well-known/`.
284
+ * Reconcile widens them into `assets.run_worker_first` rules. A computed
285
+ * `basePath` and routes added to a Hono `httpRouter` directly are not visible
286
+ * here. `undefined` when the files under `lunora/` could not be parsed.
287
+ */
288
+ workerRoutes: string[] | undefined;
289
+ /** Workflows declared in `lunora/workflows.ts` (exported or not — see {@link InferredWorkflow.exported}). */
290
+ workflows: InferredWorkflow[];
291
+ }
292
+ interface InferOptions {
293
+ /** Memoises the source scans, so one CLI invocation parses the project once. */
294
+ cache?: DiscoveryCache;
295
+ projectRoot: string;
296
+ /** Directories (relative to root) to scan. Defaults to `lunora` + `src`. */
297
+ scanDirs?: ReadonlyArray<string>;
298
+ /** Lunora source directory holding `schema.ts`. Defaults to `lunora`. */
299
+ schemaDir?: string;
300
+ /** Leave the `studio.companion` Worker out of the inferred services, for a run that does not deploy it. */
301
+ skipCompanion?: boolean;
302
+ }
303
+ /**
304
+ * Scan a Lunora project and report which Cloudflare bindings its code implies.
305
+ * Read-only: performs no writes. Binding provisioning is driven by the worker
306
+ * entry's Durable Object exports plus the schema's D1 need; capability imports
307
+ * surface as hints.
308
+ */
309
+ declare const inferLunoraBindings: (options: InferOptions) => Promise<InferredBindings>;
310
+ /**
311
+ * The secret sources a project uses — the {@link PACKAGE_SECRETS_REGISTRY} keys
312
+ * whose secrets it needs, derived from its already-resolved {@link InferredBindings}.
313
+ *
314
+ * This is the canonical bridge between binding inference and the
315
+ * `.dev.vars.example` scaffolding in `scaffold-dev-variables.ts`. The result is
316
+ * {@link FLAG_PACKAGES}' sources whose flag is `true` in `bindings` — in
317
+ * flag-name order — followed by the configured `@lunora/notify` channels
318
+ * ({@link SECRET_SOURCE_FLAGS}), keeping only sources that carry secrets.
319
+ */
320
+ declare const secretSourcesFromBindings: (bindings: InferredBindings) => string[];
321
+ /**
322
+ * Placeholder `database_id` written for an auto-provisioned `DB` binding. It is
323
+ * intentionally not a valid id so a deploy can't silently target the wrong
324
+ * database; reconciliation warns the user to replace it (see the D1 warning in
325
+ * `reconcileWranglerBindings`).
326
+ *
327
+ * Kept apart from `reconcile-bindings` so a module that only needs the string
328
+ * (`celld-config`, reached from `@lunora/config/cli` through the driver
329
+ * registry) does not pull codegen and ts-morph into every CLI start.
330
+ */
331
+ declare const D1_PLACEHOLDER_ID = "<replace-with-d1-create-id>";
332
+ /**
333
+ * The `id` reconcile writes on a Hyperdrive binding it adds, and the one the `hyperdrive`
334
+ * registry item ships: wrangler requires a string, and `lunora dev` serves the binding from an
335
+ * embedded Postgres whatever it is. `lunora deploy` swaps in a real id.
336
+ */
337
+ declare const HYPERDRIVE_PLACEHOLDER_ID = "<replace-with-hyperdrive-create-id>";
338
+ export { COMPOSED_WORKER_ENTRY as C, DiscoveryCache as D, GeneratedClassModule as G, HYPERDRIVE_PLACEHOLDER_ID as H, InferredBindings as I, MERGED_DURABLE_OBJECTS_MODULE as M, SchemaInfo as S, D1_PLACEHOLDER_ID as a, DURABLE_OBJECT_BINDINGS as b, DiscoverSchemaInfoResult as c, GENERATED_CLASS_MODULES as d, GENERATED_MODULE_DURABLE_OBJECTS as e, InferOptions as f, InferredAgent as g, InferredContainer as h, InferredWorkflow as i, createDiscoveryCache as j, discoverSchemaInfo as k, inferLunoraBindings as l, isMergedProject as m, isMergedRoleModule as n, secretSourcesFromBindings as s };