@lunora/config 1.0.0-alpha.29 → 1.0.0-alpha.291
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.
- package/LICENSE.md +135 -0
- package/README.md +3 -3
- package/dist/cloudflare/index.d.mts +1065 -0
- package/dist/cloudflare/index.d.ts +1065 -0
- package/dist/cloudflare/index.mjs +1 -0
- package/dist/index.d.mts +1024 -918
- package/dist/index.d.ts +1024 -918
- package/dist/index.mjs +1 -23
- package/dist/packem_shared/ACCENT-CotPTfv7.mjs +7 -0
- package/dist/packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs +1 -0
- package/dist/packem_shared/AGENT_RULES_DIR-C54Ta_vz.mjs +1 -0
- package/dist/packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs +1 -0
- package/dist/packem_shared/BINDING_MANIFEST_VERSION-vItUTnHk.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_DRIVER-Ci3VIqnk.mjs +1 -0
- package/dist/packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs +1 -0
- package/dist/packem_shared/COMPOSED_WORKER_ENTRY-C69wqbSP.mjs +1 -0
- package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-CfoV0tDu.mjs +1 -0
- package/dist/packem_shared/DEV_BINDINGS_FILE-pyOiNLP4.mjs +4 -0
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs +6 -0
- package/dist/packem_shared/DEV_WORKER_ENV_VALUE-DwGANZVw.mjs +1 -0
- package/dist/packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs +2 -0
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-DYdcDU9G.mjs +1 -0
- package/dist/packem_shared/LUNORA_IGNORED_PATHS-B0-PPvRp.mjs +19 -0
- package/dist/packem_shared/LUNORA_TAG-CiQM3BkI.mjs +1 -0
- package/dist/packem_shared/LunoraReporter-f277GLNT.mjs +6 -0
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-De7gLGIy.mjs +1 -0
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-0QiGKazX.mjs +1 -0
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-ikHvqvS5.mjs +1 -0
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-jTnj2MPJ.mjs +1 -0
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-Dbt0faMd.mjs +1 -0
- package/dist/packem_shared/SEED_ENDPOINT-2B56PN_H.mjs +1 -0
- package/dist/packem_shared/STUDIO_PATH-BZI8go9A.mjs +1 -0
- package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-CugcZbPf.mjs +1 -0
- package/dist/packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs +1 -0
- package/dist/packem_shared/WRANGLER_FILES-UNW-xY5u.mjs +1 -0
- package/dist/packem_shared/acceptsConnection-DHhUYGjT.mjs +2 -0
- package/dist/packem_shared/addArgsFor-CYZKhNIo.mjs +1 -0
- package/dist/packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs +6 -0
- package/dist/packem_shared/applyModify-DKP2l6S9.mjs +1 -0
- package/dist/packem_shared/applyStudioAssetCache-DHQEJuuv.mjs +1 -0
- package/dist/packem_shared/assertWranglerSatisfiesSchema-BiABHeMv.mjs +3 -0
- package/dist/packem_shared/assetContentType-CUb5bpbI.mjs +1 -0
- package/dist/packem_shared/buildPackageSecretsBlock-yv9mjKEW.mjs +19 -0
- package/dist/packem_shared/celld-config-D-L6uskI.mjs +3 -0
- package/dist/packem_shared/classifyPolicyEdit-D8NwrHxR.mjs +24 -0
- package/dist/packem_shared/collectExportGaps-CIYe_DRY.mjs +2 -0
- package/dist/packem_shared/collectWranglerSecretVariables-D-usPfT8.mjs +1 -0
- package/dist/packem_shared/createConfirm-D5mKTMHj.mjs +7 -0
- package/dist/packem_shared/describePreservedCrons-7gaDLxWx.mjs +1 -0
- package/dist/packem_shared/detectFramework-CUiVEHDQ.mjs +1 -0
- package/dist/packem_shared/discover-info-Vj9d4qYt.mjs +1 -0
- package/dist/packem_shared/discoverAgentInfo-CTdCSfYM.mjs +1 -0
- package/dist/packem_shared/discoverContainerInfo-EhZtEBQs.mjs +1 -0
- package/dist/packem_shared/discoverSchemaInfo-DJvevsCm.mjs +1 -0
- package/dist/packem_shared/discoverWorkflowInfo-BsPvlo6O.mjs +1 -0
- package/dist/packem_shared/inferLunoraBindings-DXLEJY9w.mjs +1 -0
- package/dist/packem_shared/interpretRemote-C9yJC_ZK.mjs +1 -0
- package/dist/packem_shared/lunora-manifest-v90ZUbVp.mjs +6 -0
- package/dist/packem_shared/mergeWranglerEnvironment-DOKJUNH8.mjs +1 -0
- package/dist/packem_shared/package-secrets-registry-DvtTiK4b.mjs +1 -0
- package/dist/packem_shared/parseDevVariable-teAAahVD.mjs +1 -0
- package/dist/packem_shared/parseSchema-D1Wbr1qv.mjs +1 -0
- package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.mts +86 -0
- package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.ts +86 -0
- package/dist/packem_shared/reconcile-services-3dn35zgy.mjs +1 -0
- package/dist/packem_shared/reconcileBindingsSafely-VBbLYoAx.mjs +1 -0
- package/dist/packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs +1 -0
- package/dist/packem_shared/renderStudioHtml-ByowDtMl.mjs +15 -0
- package/dist/packem_shared/runPostCodegenHook-B0T1q2YI.mjs +1 -0
- package/dist/packem_shared/schema-info.d-fEhxTb9k.d.mts +397 -0
- package/dist/packem_shared/schema-info.d-fEhxTb9k.d.ts +397 -0
- package/dist/packem_shared/serveJsonHandler-Dv0EdCb9.mjs +1 -0
- package/dist/packem_shared/startCelldDevSession-BLFsd6jG.mjs +1 -0
- package/dist/packem_shared/streamContainerLogs-0nko1qpv.mjs +2 -0
- package/dist/packem_shared/validate-bindings-Dnf1t0SY.mjs +1 -0
- package/dist/packem_shared/withTailConsumer-B1NoKIsj.mjs +1 -0
- package/dist/packem_shared/wranglerToAlchemy-BMOQYRyw.mjs +6 -0
- package/dist/packem_shared/write-atomic-9d9xs5ON.mjs +1 -0
- package/dist/studio-host/index.d.mts +314 -110
- package/dist/studio-host/index.d.ts +314 -110
- package/dist/studio-host/index.mjs +1 -7
- package/package.json +15 -7
- package/dist/packem_shared/ACCENT-DW1XJn8i.mjs +0 -40
- package/dist/packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs +0 -40
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs +0 -37
- package/dist/packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs +0 -52
- package/dist/packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs +0 -34
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-D2fDeGB6.mjs +0 -86
- package/dist/packem_shared/LunoraReporter-Ci-bDCK9.mjs +0 -70
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-B8t_SdoZ.mjs +0 -70
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-CiC2IGKx.mjs +0 -103
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-BC7_e9Bz.mjs +0 -105
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-2YYyWJUq.mjs +0 -561
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-Df-Wrix-.mjs +0 -99
- package/dist/packem_shared/SEED_ENDPOINT-DVCjaGO-.mjs +0 -61
- package/dist/packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs +0 -25
- package/dist/packem_shared/applyAdditiveEdit-C-snTFEV.mjs +0 -228
- package/dist/packem_shared/buildPackageSecretsBlock-DWDKHViT.mjs +0 -243
- package/dist/packem_shared/classifyPolicyEdit-BHeAqF8P.mjs +0 -99
- package/dist/packem_shared/createConfirm-fvpdgJ9s.mjs +0 -100
- package/dist/packem_shared/detectFramework-Br-BcPBq.mjs +0 -41
- package/dist/packem_shared/discoverContainerInfo-BXFs6Wav.mjs +0 -19
- package/dist/packem_shared/discoverSchemaInfo-BB-CKlTK.mjs +0 -25
- package/dist/packem_shared/discoverWorkflowInfo-CedvR0mn.mjs +0 -19
- package/dist/packem_shared/inferLunoraBindings-ByMwG-gH.mjs +0 -352
- package/dist/packem_shared/loadStudioAssets-Csk5RS4E.mjs +0 -28
- package/dist/packem_shared/parseDevVariable-CJiq2IwE.mjs +0 -30
- package/dist/packem_shared/parseSchema-DSeyktvG.mjs +0 -107
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.mts +0 -74
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.ts +0 -74
- package/dist/packem_shared/reconcileWranglerBindings-Cruwwx1M.mjs +0 -334
- package/dist/packem_shared/renderStudioHtml-449Ysn75.mjs +0 -37
- package/dist/packem_shared/serveJsonHandler-B4OLTGLS.mjs +0 -86
- package/dist/packem_shared/streamContainerLogs-BZ4cOZwH.mjs +0 -157
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { AgentIR, ContainerIR, QueueIR, ServiceBindingIR, WorkflowIR } from '@lunora/codegen';
|
|
2
|
+
/**
|
|
3
|
+
* `DeployDriver` — the provider-neutral seam between a Lunora command and the
|
|
4
|
+
* host CLI that carries it out (plan 114, §5.3).
|
|
5
|
+
*
|
|
6
|
+
* The seam is the **toolchain surface**: which command a host runs to deploy,
|
|
7
|
+
* serve, tail, or set a secret. A driver only *describes* that command
|
|
8
|
+
* ({@link ToolchainCommand}); it never spawns. The CLI keeps ownership of
|
|
9
|
+
* running it — package-manager resolution (`pnpm exec` / `npx --` / `bun x`)
|
|
10
|
+
* and the injected spawner its tests substitute — so the driver stays free of
|
|
11
|
+
* process concerns and remains trivially testable as a pure function.
|
|
12
|
+
*
|
|
13
|
+
* Each request type below is deliberately neutral: `preview`, `environment`,
|
|
14
|
+
* `temporary` are concepts, not wrangler flags. A second host maps the same
|
|
15
|
+
* request onto its own CLI without the caller changing.
|
|
16
|
+
*
|
|
17
|
+
* Three drivers are registered: Cloudflare (`cloudflare/cloudflare-driver.ts`)
|
|
18
|
+
* and celld (`celld/celld-driver.ts`), which ship toolchains, and Node
|
|
19
|
+
* (`node/node-driver.ts`), which has none — it is a codegen target, and
|
|
20
|
+
* `lunora deploy` / `lunora dev` refuse it at selection.
|
|
21
|
+
*
|
|
22
|
+
* **What this seam deliberately does NOT carry: configuration inference.** It
|
|
23
|
+
* used to, through an `infer`/`provision` pair over a provider-neutral
|
|
24
|
+
* `ResourceGraph`. Nothing ever called either one — every consumer reads
|
|
25
|
+
* `.toolchain` or just validates the target — and the arm rotted in place: the
|
|
26
|
+
* Node driver was *only* `infer` + `provision`, so its report of what that
|
|
27
|
+
* target cannot serve (containers, undispatched crons) could not reach an
|
|
28
|
+
* operator however wrong the app was. The reason it never got wired is worth
|
|
29
|
+
* keeping: writing real host configuration needs the host's own encodings —
|
|
30
|
+
* binding names, DO class wiring, migration tags — which a neutral graph
|
|
31
|
+
* necessarily discards, so `provision` re-derived them anyway and the graph was
|
|
32
|
+
* decorative. A second target that needs to share inference should grow the
|
|
33
|
+
* seam back with a caller attached, and with an encoding escape hatch.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* A host CLI invocation, described but not run.
|
|
37
|
+
*
|
|
38
|
+
* `tool` is the binary name only (`"wrangler"`); the caller resolves how to
|
|
39
|
+
* execute it through the project's package manager (see `toolchainExecArgs`).
|
|
40
|
+
* Keeping that split means a driver never has to know whether the project uses
|
|
41
|
+
* pnpm, npm, yarn, or bun.
|
|
42
|
+
*/
|
|
43
|
+
interface ToolchainCommand {
|
|
44
|
+
/** Arguments for {@link ToolchainCommand.tool}. */
|
|
45
|
+
args: ReadonlyArray<string>;
|
|
46
|
+
/**
|
|
47
|
+
* The tool is a standalone binary installed on `PATH`, not a project
|
|
48
|
+
* dependency: run it directly. Going through the package manager would be
|
|
49
|
+
* wrong for it — `npx --` / `bun x` fetch an npm package of the same name
|
|
50
|
+
* when none is installed locally, which for a non-npm binary is somebody
|
|
51
|
+
* else's code.
|
|
52
|
+
*/
|
|
53
|
+
onPath?: boolean;
|
|
54
|
+
/** The host CLI binary, e.g. `"wrangler"`. */
|
|
55
|
+
tool: string;
|
|
56
|
+
}
|
|
57
|
+
/** Neutral options for a deploy. */
|
|
58
|
+
interface DeployRequest {
|
|
59
|
+
/** Host config file to deploy, when the flow uses a projected one (see {@link DeployDriver.projectConfig}). */
|
|
60
|
+
configPath?: string;
|
|
61
|
+
/** Validate and bundle without publishing — nothing ships. */
|
|
62
|
+
dryRun?: boolean;
|
|
63
|
+
/** Deploy this entry file instead of the host config's default (framework composition). */
|
|
64
|
+
entry?: string;
|
|
65
|
+
/** Named deployment environment, when the host supports them. */
|
|
66
|
+
environment?: string;
|
|
67
|
+
/** Write the built bundle (and any build metadata) to this directory. */
|
|
68
|
+
outDir?: string;
|
|
69
|
+
/** Upload a preview/versioned artifact instead of taking production traffic. */
|
|
70
|
+
preview?: boolean;
|
|
71
|
+
/** Deploy to a short-lived, unauthenticated account where the host offers one. */
|
|
72
|
+
temporary?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/** Neutral options for a local dev server. */
|
|
75
|
+
interface DevRequest {
|
|
76
|
+
/** Host config file to run against, when the flow uses a generated one. */
|
|
77
|
+
configPath?: string;
|
|
78
|
+
/** Named environment. */
|
|
79
|
+
environment?: string;
|
|
80
|
+
/** Extra host-specific flags the caller has already resolved. */
|
|
81
|
+
extraArgs?: ReadonlyArray<string>;
|
|
82
|
+
}
|
|
83
|
+
/** Neutral options for tailing live logs. */
|
|
84
|
+
interface TailRequest {
|
|
85
|
+
/** Named environment. */
|
|
86
|
+
environment?: string;
|
|
87
|
+
/** Output format the host tail supports (`"json"`, `"pretty"`, …). */
|
|
88
|
+
format?: string;
|
|
89
|
+
/** Free-text filter. */
|
|
90
|
+
search?: string;
|
|
91
|
+
/** Status filter (`"error"`, `"ok"`, …). */
|
|
92
|
+
status?: string;
|
|
93
|
+
/** Tail a short-lived account's deployment. */
|
|
94
|
+
temporary?: boolean;
|
|
95
|
+
/** Tail a specific deployed worker/service by name, when the host addresses them individually. */
|
|
96
|
+
worker?: string;
|
|
97
|
+
}
|
|
98
|
+
/** Neutral options for reading or writing deployment secrets. */
|
|
99
|
+
interface SecretRequest {
|
|
100
|
+
/** Named environment. */
|
|
101
|
+
environment?: string;
|
|
102
|
+
/** The secret's name — required for `put`, unused for `list`. */
|
|
103
|
+
key?: string;
|
|
104
|
+
/** Operate against a short-lived account. */
|
|
105
|
+
temporary?: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The host's command-line surface. Optional as a whole: a host with no vendor
|
|
109
|
+
* CLI (the Node target; a hypothetical API-driven one) declares none, and
|
|
110
|
+
* `isRunnableTarget` refuses it for the commands that would have to shell out.
|
|
111
|
+
*
|
|
112
|
+
* `deploy` and `dev` are what make a target runnable. The secret and tail
|
|
113
|
+
* commands are optional on their own, because a runnable host can simply not
|
|
114
|
+
* have them — celld keeps configuration in plain `vars` and has no log tail —
|
|
115
|
+
* and the commands that need one say so rather than guessing a substitute.
|
|
116
|
+
*/
|
|
117
|
+
interface DriverToolchain {
|
|
118
|
+
/** The command that deploys the app. */
|
|
119
|
+
deploy: (request: DeployRequest) => ToolchainCommand;
|
|
120
|
+
/** The command that runs a local dev server. */
|
|
121
|
+
dev: (request: DevRequest) => ToolchainCommand;
|
|
122
|
+
/**
|
|
123
|
+
* Where `lunora dev` runs the worker. `"workerd"`: `wrangler dev`, or the
|
|
124
|
+
* Vite plugin's `@cloudflare/vite-plugin`, whichever flavor the project
|
|
125
|
+
* picks. `"own"`: the host's dev server ({@link DriverToolchain.dev}) on
|
|
126
|
+
* the projected config, always the standalone flavor — neither Vite nor a
|
|
127
|
+
* framework sidecar can serve the worker on that runtime.
|
|
128
|
+
*/
|
|
129
|
+
readonly devServer: "own" | "workerd";
|
|
130
|
+
/**
|
|
131
|
+
* Whether `lunora deploy` builds and pushes container images itself
|
|
132
|
+
* (railpack, into the host's registry) before `deploy`. `false` when the
|
|
133
|
+
* host CLI builds each image from its Dockerfile during the deploy.
|
|
134
|
+
*/
|
|
135
|
+
readonly prebuildsContainerImages: boolean;
|
|
136
|
+
/** The command that lists remote secret names, when the host has a secret store. */
|
|
137
|
+
secretList?: (request: SecretRequest) => ToolchainCommand;
|
|
138
|
+
/** The command that writes one secret, when the host has a secret store. Its value is passed on stdin, never argv. */
|
|
139
|
+
secretPut?: (request: SecretRequest) => ToolchainCommand;
|
|
140
|
+
/** The command that tails live logs, when the host has one. */
|
|
141
|
+
tail?: (request: TailRequest) => ToolchainCommand;
|
|
142
|
+
}
|
|
143
|
+
/** What a {@link DeployDriver.projectConfig} projection is for — a dev server may need a different source than a deploy. */
|
|
144
|
+
type ProjectionPurpose = "deploy" | "dev";
|
|
145
|
+
/**
|
|
146
|
+
* The result of {@link DeployDriver.projectConfig}: a plan, not yet on disk.
|
|
147
|
+
* The caller validates the request it is for (the toolchain's argv builder
|
|
148
|
+
* refuses unsupported options), then calls `write` — so a refused command
|
|
149
|
+
* changes nothing.
|
|
150
|
+
*/
|
|
151
|
+
interface ProjectedConfig {
|
|
152
|
+
/** Where the projection goes, to pass as the request's `configPath`. */
|
|
153
|
+
configPath: string;
|
|
154
|
+
/** Every key removed, as a dotted path (`observability`, `containers[0].rollout_step_percentage`). */
|
|
155
|
+
dropped: ReadonlyArray<string>;
|
|
156
|
+
/** Write the projection (and any build-artifact cleanup it planned). */
|
|
157
|
+
write: () => void;
|
|
158
|
+
}
|
|
159
|
+
/** A deploy target's implementation: an identity the registry resolves, and the host CLI surface (if any) behind it. */
|
|
160
|
+
interface DeployDriver {
|
|
161
|
+
/** The target id this driver serves (`"cloudflare"`, …) — matches codegen's `target`. */
|
|
162
|
+
readonly id: string;
|
|
163
|
+
/** Human-readable target name, for logs. */
|
|
164
|
+
readonly name: string;
|
|
165
|
+
/**
|
|
166
|
+
* Rewrite the project's wrangler config into the form this host's CLI
|
|
167
|
+
* accepts, and return the file to hand `deploy`/`dev` as `configPath`.
|
|
168
|
+
* Absent when the host reads the project's config as-is (Cloudflare).
|
|
169
|
+
*
|
|
170
|
+
* Needed because Lunora's reconcilers and templates write Cloudflare-only
|
|
171
|
+
* keys (`observability`, `limits`, …) that a Workers-compatible host with a
|
|
172
|
+
* strict config reader refuses outright. `dropped` names what was removed,
|
|
173
|
+
* so the caller can say so instead of silently deploying less than the
|
|
174
|
+
* config describes.
|
|
175
|
+
*/
|
|
176
|
+
readonly projectConfig?: (projectRoot: string, purpose: ProjectionPurpose) => ProjectedConfig;
|
|
177
|
+
/**
|
|
178
|
+
* The host's command-line surface, or `undefined` for a host that has none.
|
|
179
|
+
* Pure: these build argv, they never spawn.
|
|
180
|
+
*/
|
|
181
|
+
readonly toolchain?: DriverToolchain;
|
|
182
|
+
}
|
|
183
|
+
interface DurableObjectSpec {
|
|
184
|
+
binding: string;
|
|
185
|
+
className: string;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* The `_generated/` modules that hold a generated Durable Object / Workflow
|
|
189
|
+
* class — one per class kind a project can declare. wrangler validates every
|
|
190
|
+
* `class_name` against the worker's exports, so this is the set a worker entry
|
|
191
|
+
* re-exports (and the set the composed class-A entry star-re-exports for the
|
|
192
|
+
* kinds the project has).
|
|
193
|
+
*
|
|
194
|
+
* Owned here because four places need it and they must not drift:
|
|
195
|
+
* `@lunora/vite` emits one star re-export per entry, the wrangler validator
|
|
196
|
+
* DECIDES the composed entry's exports from it, `reconcile-bindings` types its
|
|
197
|
+
* export-gap `module` field on it, and this module's own `detectClassExports`
|
|
198
|
+
* probes the same names.
|
|
199
|
+
*
|
|
200
|
+
* `scheduler` carries no `define*` declarations of its own — codegen writes it
|
|
201
|
+
* off `hasScheduler` purely so the composed class-A entry has a `SchedulerDO`
|
|
202
|
+
* to forward. Its presence is therefore the ONLY signal the plugin and the
|
|
203
|
+
* validator need, and it is the same signal that decides whether the builder
|
|
204
|
+
* has a `.scheduler()` method at all. `@lunora/vite` depends on `@lunora/config`, so config
|
|
205
|
+
* owning it is the direction the dependency graph allows.
|
|
206
|
+
*/
|
|
207
|
+
declare const GENERATED_CLASS_MODULES: readonly ["agents", "containers", "scheduler", "shardRegistry", "workflows"];
|
|
208
|
+
/** One {@link GENERATED_CLASS_MODULES} entry. */
|
|
209
|
+
type GeneratedClassModule = (typeof GENERATED_CLASS_MODULES)[number];
|
|
210
|
+
/**
|
|
211
|
+
* The class-B composed entry. `lunora deploy` passes this file to wrangler as
|
|
212
|
+
* the positional script whenever it exists, overriding `wrangler.main` — so it
|
|
213
|
+
* is what actually gets bundled and what wrangler checks its DO/Workflow
|
|
214
|
+
* bindings against. `main` in a class-B project names the framework adapter's
|
|
215
|
+
* build output (`.svelte-kit/cloudflare/_worker.js`, `dist/_worker.js`), which
|
|
216
|
+
* exists after `vite build` and exports only the SSR fetch handler. Lexing that
|
|
217
|
+
* instead read every declared class as unexported: nothing provisioned, plus a
|
|
218
|
+
* "add `export * from …`" warning the user cannot silence.
|
|
219
|
+
*
|
|
220
|
+
* Exported, not documented-as-duplicated: the CLI's `resolveComposedWorkerEntry`
|
|
221
|
+
* imports this constant, so the deploy's positional entry and the file this
|
|
222
|
+
* module lexes for exported classes cannot drift apart.
|
|
223
|
+
*/
|
|
224
|
+
declare const COMPOSED_WORKER_ENTRY = "src/worker.ts";
|
|
225
|
+
/**
|
|
226
|
+
* A `defineContainer` declaration plus whether its generated DO class is
|
|
227
|
+
* exported by the worker entry. Only exported containers are safe to
|
|
228
|
+
* provision — wrangler rejects a `containers[].class_name` (and its Durable
|
|
229
|
+
* Object binding) that the worker doesn't export.
|
|
230
|
+
*/
|
|
231
|
+
type InferredContainer = ContainerIR & {
|
|
232
|
+
exported: boolean;
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* A `defineWorkflow` declaration plus whether its generated
|
|
236
|
+
* `WorkflowEntrypoint` class is exported by the worker entry. Only exported
|
|
237
|
+
* workflows are safe to provision — wrangler rejects an `exports.<Class>`
|
|
238
|
+
* workflow the worker doesn't export. Workflows are NOT Durable Objects, so this never
|
|
239
|
+
* implies a `durable_objects` binding or migration.
|
|
240
|
+
*/
|
|
241
|
+
interface InferredWorkflow extends WorkflowIR {
|
|
242
|
+
exported: boolean;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* A `defineAgent` declaration plus whether its generated agent
|
|
246
|
+
* `WorkflowEntrypoint` class (e.g. `SupportAgentWorkflow`) is exported by the
|
|
247
|
+
* worker entry. An agent compiles onto a Cloudflare Workflow, so — exactly like
|
|
248
|
+
* {@link InferredWorkflow} — only exported agents are safe to provision
|
|
249
|
+
* (wrangler rejects an `exports.<Class>` workflow the worker doesn't export), and
|
|
250
|
+
* an agent is NOT a Durable Object (no `durable_objects` binding or migration).
|
|
251
|
+
*/
|
|
252
|
+
interface InferredAgent extends AgentIR {
|
|
253
|
+
exported: boolean;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* A queue declared in `lunora/queues.ts`. Unlike workflows, a queue needs no
|
|
257
|
+
* worker-entry class export (its `queue()` handler rides `createWorker`), so
|
|
258
|
+
* there is no `exported` flag — every declared queue is reconcilable into the
|
|
259
|
+
* wrangler `queues.producers[]` / `queues.consumers[]`.
|
|
260
|
+
*/
|
|
261
|
+
type InferredQueue = QueueIR;
|
|
262
|
+
interface InferredBindings {
|
|
263
|
+
/** Agents declared in `lunora/agents.ts` (exported or not — see {@link InferredAgent.exported}); reconciled into wrangler `exports`. */
|
|
264
|
+
agents: InferredAgent[];
|
|
265
|
+
/** Containers declared in `lunora/containers.ts` (exported or not — see {@link InferredContainer.exported}). */
|
|
266
|
+
containers: InferredContainer[];
|
|
267
|
+
/** Durable Objects the worker entry exports → safe to bind. */
|
|
268
|
+
durableObjects: DurableObjectSpec[];
|
|
269
|
+
/**
|
|
270
|
+
* The wrangler `flagship[].binding` name implied by `lunora/flags.ts` when it
|
|
271
|
+
* uses the Flagship provider in binding mode — `undefined` for HTTP-mode
|
|
272
|
+
* Flagship, a custom OpenFeature provider, or no flags. The binding needs an
|
|
273
|
+
* un-mintable `app_id`, so it is reconciled as a hint, not auto-written.
|
|
274
|
+
*/
|
|
275
|
+
flagshipBinding?: string;
|
|
276
|
+
/** Schema declares a `.global()` table → needs the `DB` D1 binding. */
|
|
277
|
+
needsD1: boolean;
|
|
278
|
+
/** Queues declared in `lunora/queues.ts` → reconciled into `queues.producers[]` / `queues.consumers[]`. */
|
|
279
|
+
queues: InferredQueue[];
|
|
280
|
+
/**
|
|
281
|
+
* Sibling Workers declared in `lunora.config` `services` → reconciled into
|
|
282
|
+
* `services[]` (plan 457). `undefined` when the declaration is unreadable, so
|
|
283
|
+
* reconcile leaves every entry alone rather than removing the owned ones.
|
|
284
|
+
*/
|
|
285
|
+
services: ServiceBindingIR[] | undefined;
|
|
286
|
+
/** Human-readable provenance for each inferred binding / hint, for logging. */
|
|
287
|
+
signals: string[];
|
|
288
|
+
/** `@lunora/ai` is imported or `env.AI` is used → needs the `ai` Workers AI binding. */
|
|
289
|
+
usesAi: boolean;
|
|
290
|
+
/** `@lunora/bindings/analytics` is imported → self-describing `analytics_engine_datasets` binding (auto-writeable). */
|
|
291
|
+
usesAnalytics: boolean;
|
|
292
|
+
/** `@lunora/auth` is imported (sessions may be D1- or `SessionDO`-backed). */
|
|
293
|
+
usesAuth: boolean;
|
|
294
|
+
/** `@lunora/browser` is imported → self-describing `browser` binding (auto-writeable). */
|
|
295
|
+
usesBrowser: boolean;
|
|
296
|
+
/** `lunora/flags.ts` declares a feature-flag provider (any OpenFeature provider — Flagship or custom). */
|
|
297
|
+
usesFlags: boolean;
|
|
298
|
+
/** `@lunora/hyperdrive` is imported (binding needs an un-mintable remote `id`; hint-only). */
|
|
299
|
+
usesHyperdrive: boolean;
|
|
300
|
+
/** `@lunora/bindings/images` is imported → self-describing `images` binding (auto-writeable). */
|
|
301
|
+
usesImages: boolean;
|
|
302
|
+
/** `@lunora/bindings/kv` is imported (namespace binding name + id are user-defined; hint-only). */
|
|
303
|
+
usesKv: boolean;
|
|
304
|
+
/** `@lunora/mail` is imported (Resend API key must be set in `.dev.vars`; no binding). */
|
|
305
|
+
usesMail: boolean;
|
|
306
|
+
/** `@lunora/notify` is imported (Web Push needs VAPID/FCM secrets in `.dev.vars`; no binding). */
|
|
307
|
+
usesNotify: boolean;
|
|
308
|
+
/** `@lunora/payment` is imported (provider secrets must be set in `.dev.vars`; no binding). */
|
|
309
|
+
usesPayment: boolean;
|
|
310
|
+
/** `ctx.pipelines` is used (binding needs an un-mintable remote pipeline name; hint-only). */
|
|
311
|
+
usesPipelines: boolean;
|
|
312
|
+
/** `ctx.r2sql` is used (needs the `R2_SQL_*` secrets in `.dev.vars`; no binding). */
|
|
313
|
+
usesR2sql: boolean;
|
|
314
|
+
/** `@lunora/scheduler` is imported. */
|
|
315
|
+
usesScheduler: boolean;
|
|
316
|
+
/** `@lunora/storage` is imported (R2 bucket binding name is user-defined). */
|
|
317
|
+
usesStorage: boolean;
|
|
318
|
+
/** `jsCodeTool` is imported from `@lunora/agent` in `lunora/` → self-describing `worker_loaders` binding (`LOADER`). */
|
|
319
|
+
usesWorkerLoader: boolean;
|
|
320
|
+
/** `@lunora/x402/charge` is imported — the charge rail settles USDC to a recipient address (a public `[vars]` entry, user-named; hint-only). */
|
|
321
|
+
usesX402Charge: boolean;
|
|
322
|
+
/** `@lunora/x402/pay` is imported — the agent-wallet pay rail signs from a Secrets Store binding paired with a spend policy (ActionCtx-only; hint-only). */
|
|
323
|
+
usesX402Pay: boolean;
|
|
324
|
+
/** Workflows declared in `lunora/workflows.ts` (exported or not — see {@link InferredWorkflow.exported}). */
|
|
325
|
+
workflows: InferredWorkflow[];
|
|
326
|
+
}
|
|
327
|
+
interface InferOptions {
|
|
328
|
+
projectRoot: string;
|
|
329
|
+
/** Directories (relative to root) to scan. Defaults to `lunora` + `src`. */
|
|
330
|
+
scanDirs?: ReadonlyArray<string>;
|
|
331
|
+
/** Lunora source directory holding `schema.ts`. Defaults to `lunora`. */
|
|
332
|
+
schemaDir?: string;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Scan a Lunora project and report which Cloudflare bindings its code implies.
|
|
336
|
+
* Read-only: performs no writes. Binding provisioning is driven by the worker
|
|
337
|
+
* entry's Durable Object exports plus the schema's D1 need; capability imports
|
|
338
|
+
* surface as hints.
|
|
339
|
+
*/
|
|
340
|
+
declare const inferLunoraBindings: (options: InferOptions) => Promise<InferredBindings>;
|
|
341
|
+
/**
|
|
342
|
+
* Derive the list of `@lunora/*` package names that are actively used by a
|
|
343
|
+
* project, based on its already-resolved {@link InferredBindings}.
|
|
344
|
+
*
|
|
345
|
+
* This is the canonical bridge between binding inference and the package-aware
|
|
346
|
+
* `.dev.vars.example` scaffolding in `scaffold-dev-variables.ts`. The result is
|
|
347
|
+
* a stable, predictable slice of {@link CAPABILITY_SOURCES} source values,
|
|
348
|
+
* filtered to the flags that are `true` in `bindings` — in CAPABILITY_SOURCES
|
|
349
|
+
* declaration order.
|
|
350
|
+
*/
|
|
351
|
+
declare const packageNamesFromBindings: (bindings: InferredBindings) => string[];
|
|
352
|
+
/** One filterable Vectorize metadata property a schema declares. */
|
|
353
|
+
interface VectorMetadataDeclaration {
|
|
354
|
+
/** The vector index the property belongs to. */
|
|
355
|
+
index: string;
|
|
356
|
+
/**
|
|
357
|
+
* The validator kind behind the column, or `undefined` when the column
|
|
358
|
+
* isn't in the owning table's shape. Callers map it to the Vectorize
|
|
359
|
+
* metadata type; a kind that can't be filtered on is reported, not indexed.
|
|
360
|
+
*/
|
|
361
|
+
kind: string | undefined;
|
|
362
|
+
/** Column mirrored into vector metadata. */
|
|
363
|
+
property: string;
|
|
364
|
+
}
|
|
365
|
+
interface SchemaInfo {
|
|
366
|
+
/**
|
|
367
|
+
* Whether the schema declares a **D1-backed** `.global()` table — the only
|
|
368
|
+
* flavour that needs the `DB` binding and the app's `.global({ d1 })` chain.
|
|
369
|
+
* A `.global({ backend: "hyperdrive" })` table needs neither, and counting it
|
|
370
|
+
* here demanded a D1 database of a project that has none.
|
|
371
|
+
*/
|
|
372
|
+
hasD1GlobalTable: boolean;
|
|
373
|
+
/** 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. */
|
|
374
|
+
hasHyperdriveGlobalTable: boolean;
|
|
375
|
+
/** Names of vector indexes declared via `.vectorize()` / `defineVectorIndex()`. */
|
|
376
|
+
vectorIndexNames?: ReadonlyArray<string>;
|
|
377
|
+
/**
|
|
378
|
+
* Metadata properties declared filterable on a vector index. Cloudflare
|
|
379
|
+
* needs an explicit metadata index per property before a `filter` can match
|
|
380
|
+
* anything, so deploy provisions these and doctor reports them.
|
|
381
|
+
*/
|
|
382
|
+
vectorMetadata?: ReadonlyArray<VectorMetadataDeclaration>;
|
|
383
|
+
}
|
|
384
|
+
interface DiscoverSchemaInfoResult {
|
|
385
|
+
/** Parse error message, when the schema exists but could not be analyzed. */
|
|
386
|
+
error?: string;
|
|
387
|
+
/** Schema facts, or `undefined` when no `schema.ts` exists or parsing failed. */
|
|
388
|
+
info: SchemaInfo | undefined;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Discover {@link SchemaInfo} for a project. Returns `{ info: undefined }` when
|
|
392
|
+
* the project declares no `schema.ts` (not an error), or `{ info: undefined,
|
|
393
|
+
* error }` when a present schema could not be parsed — callers decide whether a
|
|
394
|
+
* parse failure is a warning (validator) or simply ignorable (inference).
|
|
395
|
+
*/
|
|
396
|
+
declare const discoverSchemaInfo: (projectRoot: string, schemaDirectory: string) => DiscoverSchemaInfoResult;
|
|
397
|
+
export { COMPOSED_WORKER_ENTRY as C, DeployDriver as D, GeneratedClassModule as G, InferredBindings as I, ProjectionPurpose as P, SchemaInfo as S, ToolchainCommand as T, DeployRequest as a, DevRequest as b, DiscoverSchemaInfoResult as c, DriverToolchain as d, GENERATED_CLASS_MODULES as e, InferOptions as f, InferredAgent as g, InferredContainer as h, InferredWorkflow as i, ProjectedConfig as j, SecretRequest as k, TailRequest as l, discoverSchemaInfo as m, inferLunoraBindings as n, packageNamesFromBindings as p };
|