@lunora/codegen 1.0.0-alpha.42 → 1.0.0-alpha.44
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/dist/index.d.mts +155 -11
- package/dist/index.d.ts +155 -11
- package/dist/index.mjs +19 -18
- package/dist/packem_shared/AGENTS_FILENAME-BksnAJgx.mjs +116 -0
- package/dist/packem_shared/{FLAGS_FILENAME-fEZtzWXi.mjs → FLAGS_FILENAME-Dg4mKUuz.mjs} +1 -1
- package/dist/packem_shared/GENERATED_HEADER-7W9f2IG3.mjs +4 -0
- package/dist/packem_shared/{OPENRPC_VERSION-CzhfvCIQ.mjs → OPENRPC_VERSION-Cyttekkt.mjs} +1 -1
- package/dist/packem_shared/{SCHEMA_SNAPSHOT_FILENAME-Cl1EBMdR.mjs → SCHEMA_SNAPSHOT_FILENAME-CMjGZSa1.mjs} +80 -21
- package/dist/packem_shared/{buildOpenApiDocument-bg-NnLka.mjs → buildOpenApiDocument-saZ_-kl4.mjs} +1 -1
- package/dist/packem_shared/{discoverAuthApiCalls-WMx8L2FG.mjs → discoverAuthApiCalls-Dx3K42rk.mjs} +1 -1
- package/dist/packem_shared/{discoverCrons-D-jrpm97.mjs → discoverCrons-_aosTRLr.mjs} +36 -21
- package/dist/packem_shared/{discoverFunctions-CZ91aenA.mjs → discoverFunctions-BJ-qR7Rg.mjs} +1 -1
- package/dist/packem_shared/{discoverHttpRoutes-DNZLDCmm.mjs → discoverHttpRoutes-daCzuTe8.mjs} +9 -1
- package/dist/packem_shared/{discoverInserts-DFRJhmCv.mjs → discoverInserts-DI4q5NxE.mjs} +1 -1
- package/dist/packem_shared/{discoverMaskProcedures-B5iFnZ-X.mjs → discoverMaskProcedures-BcTOEKNU.mjs} +1 -1
- package/dist/packem_shared/{discoverMigrations-CdKtMlBc.mjs → discoverMigrations-VNUFvCwr.mjs} +1 -1
- package/dist/packem_shared/{discoverNondeterministicCalls-C_PrQPkA.mjs → discoverNondeterministicCalls-S0N2xLCq.mjs} +1 -1
- package/dist/packem_shared/{discoverQueries-B8W9UPrt.mjs → discoverQueries-CJnnnLpd.mjs} +1 -1
- package/dist/packem_shared/{discoverR2sqlCalls-Bm7Rfnf4.mjs → discoverR2sqlCalls-pnpicWfz.mjs} +1 -1
- package/dist/packem_shared/{discoverRlsMetadata-B4GL4ZKm.mjs → discoverRlsMetadata-DppniPUH.mjs} +1 -1
- package/dist/packem_shared/{discoverStorageRulesMetadata-nosjYcvN.mjs → discoverStorageRulesMetadata-CnHl2rXD.mjs} +1 -1
- package/dist/packem_shared/{emit-31Yg1Ee5.mjs → emit-C_29WVlW.mjs} +328 -31
- package/dist/packem_shared/{emitApp-DCP7Pr6M.mjs → emitApp-C9oljiZd.mjs} +25 -2
- package/package.json +9 -8
- package/dist/packem_shared/GENERATED_HEADER-D6RK1WF1.mjs +0 -3
package/dist/index.d.mts
CHANGED
|
@@ -122,13 +122,13 @@ interface ExternalSourceIR {
|
|
|
122
122
|
binding: string;
|
|
123
123
|
/** Whether a `columns` projection allow-list was given. */
|
|
124
124
|
columns?: ReadonlyArray<string>;
|
|
125
|
-
/** `true` when a `reconcileEveryMs` was given
|
|
125
|
+
/** `true` when a `reconcileEveryMs` was given — reserved for a future incremental mode's delete-visibility lint; not on the typed `.source()` surface today. */
|
|
126
126
|
hasReconcile?: boolean;
|
|
127
127
|
/** `true` when a `tenantBy` mapper was given — the tenant-isolation boundary the `external_source_unscoped` lint checks. */
|
|
128
128
|
hasTenantBy: boolean;
|
|
129
129
|
/** The `idColumn` literal, when given (defaults to `"id"` at runtime). */
|
|
130
130
|
idColumn?: string;
|
|
131
|
-
/** Delete-detection mode literal, when given (`"full-pull"`
|
|
131
|
+
/** Delete-detection mode literal, when given (`"full-pull"` today). */
|
|
132
132
|
mode?: string;
|
|
133
133
|
/** The membership query literal, when statically knowable. */
|
|
134
134
|
query?: string;
|
|
@@ -451,6 +451,64 @@ interface WorkflowIR {
|
|
|
451
451
|
*/
|
|
452
452
|
steps: ReadonlyArray<WorkflowStepIR>;
|
|
453
453
|
}
|
|
454
|
+
/**
|
|
455
|
+
* An agent lifted from a `defineAgent()` export in `lunora/agents.ts`. A
|
|
456
|
+
* `defineAgent` compiles its durable tool-loop onto a Cloudflare Workflow, so —
|
|
457
|
+
* like {@link WorkflowIR} — an agent is NOT a Durable Object: wrangler gets only
|
|
458
|
+
* a `workflows[]` entry, never a `durable_objects` binding or a migration class.
|
|
459
|
+
* Carries what the emitters and the config layer need to wire the generated
|
|
460
|
+
* agent `WorkflowEntrypoint` class (e.g. `SupportAgentWorkflow`), the typed
|
|
461
|
+
* per-agent `ctx.agents` producer, and the reconciled wrangler `workflows[]`
|
|
462
|
+
* entry. Names are derived via `@lunora/agent`'s shared helpers so codegen and
|
|
463
|
+
* the config layer can never disagree.
|
|
464
|
+
*/
|
|
465
|
+
interface AgentIR {
|
|
466
|
+
/** The Cloudflare `Workflow` binding name, e.g. `AGENT_SUPPORT`. */
|
|
467
|
+
bindingName: string;
|
|
468
|
+
/** Generated `WorkflowEntrypoint` class name, e.g. `SupportAgentWorkflow`. */
|
|
469
|
+
className: string;
|
|
470
|
+
/** The `lunora/agents.ts` export name, e.g. `support`. */
|
|
471
|
+
exportName: string;
|
|
472
|
+
/**
|
|
473
|
+
* The stable wrangler `workflows[].name`. Defaults to the kebab-cased export
|
|
474
|
+
* name (`support` → `agent-support`); a static `name:` literal in the
|
|
475
|
+
* definition overrides it.
|
|
476
|
+
*/
|
|
477
|
+
name: string;
|
|
478
|
+
/**
|
|
479
|
+
* Whether the definition declares an `onEmail` mapper on
|
|
480
|
+
* `defineAgent({ onEmail: … })`. When `true` the emitter wires this agent
|
|
481
|
+
* onto the worker's top-level `email()` handler (via `@lunora/agent/inbound`)
|
|
482
|
+
* so inbound mail starts a durable run. Detected by AST PRESENCE — the
|
|
483
|
+
* closure is never evaluated — and written to IR only when present, so
|
|
484
|
+
* email-free agents (and agent-free projects) stay byte-identical.
|
|
485
|
+
*/
|
|
486
|
+
onEmail?: boolean;
|
|
487
|
+
/**
|
|
488
|
+
* Whether the definition opted into public run-starts via
|
|
489
|
+
* `defineAgent({ publicRun: true })` — emitted into the `ctx.agents` wiring
|
|
490
|
+
* spec so the public `agents:agentRun` mutation can gate on it fail-closed.
|
|
491
|
+
* Absent (falsy) means server-side starts only; the field is written to IR
|
|
492
|
+
* only when the literal is `true`, so agent-free and non-opted-in output is
|
|
493
|
+
* byte-identical.
|
|
494
|
+
*/
|
|
495
|
+
publicRun?: boolean;
|
|
496
|
+
/**
|
|
497
|
+
* Whether the definition opted into a real-time voice session via a `voice`
|
|
498
|
+
* block on `defineAgent({ voice: … })`. Unlike the durable loop (a Workflow),
|
|
499
|
+
* the voice path IS a Durable Object — so when this is `true` the emitter
|
|
500
|
+
* generates the `voiceClassName` `VoiceSessionDO` subclass and the
|
|
501
|
+
* `api.agents.{name}Voice` client reference, and the config layer reconciles
|
|
502
|
+
* a `durable_objects` binding (`voiceBindingName`) + `new_sqlite_classes`
|
|
503
|
+
* migration. Written to IR only when the literal is present, so voice-free
|
|
504
|
+
* agents (and agent-free projects) stay byte-identical.
|
|
505
|
+
*/
|
|
506
|
+
voice?: boolean;
|
|
507
|
+
/** The voice DO's Cloudflare `DurableObjectNamespace` binding name, e.g. `VOICE_SUPPORT`. Present only when `voice`. */
|
|
508
|
+
voiceBindingName?: string;
|
|
509
|
+
/** Generated `VoiceSessionDO` subclass name, e.g. `SupportVoiceDO`. Present only when `voice`. */
|
|
510
|
+
voiceClassName?: string;
|
|
511
|
+
}
|
|
454
512
|
/** One durable step call lifted from a workflow handler body (the use side of {@link WorkflowIR.steps}). */
|
|
455
513
|
interface WorkflowStepIR {
|
|
456
514
|
/** 1-based line of the durable step call. */
|
|
@@ -812,6 +870,15 @@ interface StorageRulesMetadataIR {
|
|
|
812
870
|
interface HttpRouteIR {
|
|
813
871
|
/** `v.*` validators decoding the JSON request body (`.body({...})`), keyed by field. */
|
|
814
872
|
body: Record<string, ValidatorIR>;
|
|
873
|
+
/**
|
|
874
|
+
* Rendered TS type of one SSE chunk — the `R` the `.stream(handler)`
|
|
875
|
+
* handler yields — inferred from the handler via the type checker. Present
|
|
876
|
+
* only when {@link HttpRouteIR.stream} is `true`; `"unknown"` when the
|
|
877
|
+
* checker can't resolve enough context. Feeds the emitted
|
|
878
|
+
* `HttpStreamRef<Chunk, …>` so the chunk type flows to the client.
|
|
879
|
+
* @experimental Part of the HTTP-SSE stream surface (the `httpStreams.*` emission).
|
|
880
|
+
*/
|
|
881
|
+
chunkType?: string;
|
|
815
882
|
/** Export binding name of the route handler (used only for diagnostics / dedupe). */
|
|
816
883
|
exportName: string;
|
|
817
884
|
/** Path relative to `<projectRoot>/lunora/` without extension, e.g. "http". */
|
|
@@ -1692,6 +1759,19 @@ declare class CodegenDiagnosticError extends LunoraError {
|
|
|
1692
1759
|
* lookup is unaffected.
|
|
1693
1760
|
*/
|
|
1694
1761
|
declare const diagnosticAt: (node: Node, detail: string, meta?: Record<string, unknown>) => CodegenDiagnosticError;
|
|
1762
|
+
/** The only file agents may be declared in — mirrors `lunora/workflows.ts`. */
|
|
1763
|
+
declare const AGENTS_FILENAME = "agents.ts";
|
|
1764
|
+
/**
|
|
1765
|
+
* Discover every agent the project declares: exported `defineAgent()` calls in
|
|
1766
|
+
* `lunora/agents.ts`. Returns `[]` when the file doesn't exist. Only four things
|
|
1767
|
+
* are read statically — the optional `name` override (wrangler `workflows[].name`),
|
|
1768
|
+
* the optional `publicRun` opt-in (the `agents:agentRun` capability gate), the
|
|
1769
|
+
* presence of a `voice` block (which turns on the voice-session Durable Object),
|
|
1770
|
+
* and the presence of an `onEmail` mapper (which wires the worker `email()`
|
|
1771
|
+
* handler); the rest of the agent config (model / tools / memory / voice models /
|
|
1772
|
+
* the `onEmail` closure body) is runtime-only, so codegen never evaluates it.
|
|
1773
|
+
*/
|
|
1774
|
+
declare const discoverAgents: (project: Project, lunoraDirectory: string) => AgentIR[];
|
|
1695
1775
|
/**
|
|
1696
1776
|
* Discover `ctx.authApi.<method>(...)` (and bare `authApi.<method>(...)`) calls
|
|
1697
1777
|
* under the lunora source directory and attribute each to the exported function
|
|
@@ -1713,10 +1793,11 @@ declare const discoverContainers: (project: Project, lunoraDirectory: string) =>
|
|
|
1713
1793
|
* (`crons.interval(...)`, `crons.daily(...)`, `crons.cron(...)`, …) and lift them
|
|
1714
1794
|
* into {@link CronJobIR}. Schedules are compiled to standard cron expressions;
|
|
1715
1795
|
* function references are resolved to their `namespace:fn` dispatch path, while a
|
|
1716
|
-
*
|
|
1717
|
-
* workflow start. Names must be unique
|
|
1796
|
+
* `workflows.NAME` / `agents.NAME` reference (or a bare identifier naming a
|
|
1797
|
+
* declared workflow) resolves to a durable workflow start. Names must be unique
|
|
1798
|
+
* across the project.
|
|
1718
1799
|
*/
|
|
1719
|
-
declare const discoverCrons: (project: Project, lunoraDirectory: string, workflows?: ReadonlyArray<WorkflowIR>) => CronJobIR[];
|
|
1800
|
+
declare const discoverCrons: (project: Project, lunoraDirectory: string, workflows?: ReadonlyArray<WorkflowIR>, agents?: ReadonlyArray<AgentIR>) => CronJobIR[];
|
|
1720
1801
|
/** The only file a feature-flag provider may be declared in — mirrors `lunora/queues.ts`. */
|
|
1721
1802
|
declare const FLAGS_FILENAME = "flags.ts";
|
|
1722
1803
|
/** One statically-discovered flag read: the key plus the value type its `ctx.flags.<type>` call implies. */
|
|
@@ -1887,13 +1968,21 @@ declare const GENERATED_HEADER = "// GENERATED by @lunora/codegen — do not edi
|
|
|
1887
1968
|
declare const emitDataModel: (schema: SchemaIR, useUmbrella?: boolean) => string;
|
|
1888
1969
|
/**
|
|
1889
1970
|
* Emit `_generated/api.ts` — the typed `api.*` registry (public functions), the
|
|
1890
|
-
* `internal.*` registry, and (when the project declares
|
|
1891
|
-
* `workflows.*` reference
|
|
1971
|
+
* `internal.*` registry, and (when the project declares them) the typed
|
|
1972
|
+
* `workflows.*` / `agents.*` scheduler-target reference objects. `api`/`internal` are the same `anyApi` proxy
|
|
1892
1973
|
* at runtime (the `__lunoraRef` is identical); visibility is enforced
|
|
1893
1974
|
* server-side at dispatch, not in the reference. Splitting the *types* keeps
|
|
1894
1975
|
* internal functions off the client-facing `api` surface.
|
|
1895
1976
|
*/
|
|
1896
|
-
|
|
1977
|
+
interface EmitApiOptions {
|
|
1978
|
+
agents?: ReadonlyArray<AgentIR>;
|
|
1979
|
+
functions: ReadonlyArray<FunctionIR>;
|
|
1980
|
+
/** Typed REST routes; only `.stream()` (SSE) routes emit a `httpStreams.*` reference. */
|
|
1981
|
+
httpRoutes?: ReadonlyArray<HttpRouteIR>;
|
|
1982
|
+
useUmbrella?: boolean;
|
|
1983
|
+
workflows?: ReadonlyArray<WorkflowIR>;
|
|
1984
|
+
}
|
|
1985
|
+
declare const emitApi: (options: EmitApiOptions) => string;
|
|
1897
1986
|
/**
|
|
1898
1987
|
* Emit `_generated/seed.ts` — a project-bound `createSeedClient` with this
|
|
1899
1988
|
* schema's `InsertModel` and runtime schema pre-applied, so a test or script
|
|
@@ -1904,7 +1993,6 @@ declare const emitApi: (functions: ReadonlyArray<FunctionIR>, workflows?: Readon
|
|
|
1904
1993
|
* Returns `""` when `@lunora/seed` is not a declared dependency, so projects
|
|
1905
1994
|
* that don't use it keep a clean `_generated/` and never import the package.
|
|
1906
1995
|
*/
|
|
1907
|
-
|
|
1908
1996
|
/**
|
|
1909
1997
|
* Emit `_generated/collections.ts` — one TanStack DB collection factory per
|
|
1910
1998
|
* `defineShape` in `lunora/shapes.ts` (the local-first partial-replication
|
|
@@ -1921,6 +2009,8 @@ declare const emitApi: (functions: ReadonlyArray<FunctionIR>, workflows?: Readon
|
|
|
1921
2009
|
*/
|
|
1922
2010
|
declare const emitCollections: (shapes: ReadonlyArray<ShapeIR>, hasDatabase: boolean, useUmbrella?: boolean) => string;
|
|
1923
2011
|
interface EmitServerOptions {
|
|
2012
|
+
/** Agents declared via `defineAgent` exports — wires the typed `ctx.agents` producers onto Mutation/Action contexts. */
|
|
2013
|
+
agents?: ReadonlyArray<AgentIR>;
|
|
1924
2014
|
containers?: ReadonlyArray<ContainerIR>;
|
|
1925
2015
|
/**
|
|
1926
2016
|
* The single `defineEnv(...)` contract declared in `lunora/env.ts`. When
|
|
@@ -1974,6 +2064,7 @@ interface EmitServerOptions {
|
|
|
1974
2064
|
workflows?: ReadonlyArray<WorkflowIR>;
|
|
1975
2065
|
}
|
|
1976
2066
|
declare const emitServer: ({
|
|
2067
|
+
agents,
|
|
1977
2068
|
containers,
|
|
1978
2069
|
env,
|
|
1979
2070
|
hasAccessFacade,
|
|
@@ -1995,7 +2086,17 @@ declare const emitServer: ({
|
|
|
1995
2086
|
useUmbrella,
|
|
1996
2087
|
workflows
|
|
1997
2088
|
}?: EmitServerOptions) => string;
|
|
1998
|
-
|
|
2089
|
+
interface EmitFunctionsOptions {
|
|
2090
|
+
agents?: ReadonlyArray<AgentIR>;
|
|
2091
|
+
functions: ReadonlyArray<FunctionIR>;
|
|
2092
|
+
migrations?: ReadonlyArray<MigrationIR>;
|
|
2093
|
+
mutators?: ReadonlyArray<MutatorIR>;
|
|
2094
|
+
shapes?: ReadonlyArray<ShapeIR>;
|
|
2095
|
+
/** Import of a sandbox tool (`browserTool`/`containerTool`) auto-registers the `sandbox:invoke` action. */
|
|
2096
|
+
usesSandbox?: boolean;
|
|
2097
|
+
useUmbrella?: boolean;
|
|
2098
|
+
}
|
|
2099
|
+
declare const emitFunctions: (options: EmitFunctionsOptions) => string;
|
|
1999
2100
|
/**
|
|
2000
2101
|
* Storage-column map per table for the file browser: `{ table: [field, …] }` for
|
|
2001
2102
|
* every field declared `v.storage(...)` (unwrapping `v.optional(...)`). The
|
|
@@ -2024,6 +2125,16 @@ declare const emitContainers: (containers: ReadonlyArray<ContainerIR>, jurisdict
|
|
|
2024
2125
|
*/
|
|
2025
2126
|
declare const emitWorkflows: (workflows: ReadonlyArray<WorkflowIR>) => string;
|
|
2026
2127
|
/**
|
|
2128
|
+
* Emit `_generated/agents.ts` — one `WorkflowEntrypoint` class per `defineAgent`
|
|
2129
|
+
* export, each a thin subclass of `LunoraWorkflow` (`@lunora/workflow/do`)
|
|
2130
|
+
* constructed with the compiled agent tool-loop (`compileAgentWorkflow`). Like
|
|
2131
|
+
* `_generated/workflows.ts`, the worker entry must re-export these classes:
|
|
2132
|
+
* wrangler requires every `workflows[].class_name` to be exported by the
|
|
2133
|
+
* deployed worker. Returns "" when the project declares no agents (the file is
|
|
2134
|
+
* not written then).
|
|
2135
|
+
*/
|
|
2136
|
+
declare const emitAgents: (agents: ReadonlyArray<AgentIR>) => string;
|
|
2137
|
+
/**
|
|
2027
2138
|
* Emit `_generated/queues.ts` — the push-consumer registry the worker `queue()`
|
|
2028
2139
|
* handler dispatches through. Maps each push queue's stable wrangler name (which
|
|
2029
2140
|
* `batch.queue` carries) to its `defineQueue` definition + export name. Pull
|
|
@@ -2033,6 +2144,8 @@ declare const emitWorkflows: (workflows: ReadonlyArray<WorkflowIR>) => string;
|
|
|
2033
2144
|
*/
|
|
2034
2145
|
interface EmitShardOptions {
|
|
2035
2146
|
advisories?: ReadonlyArray<Finding>;
|
|
2147
|
+
/** Agents declared via `defineAgent` exports in `lunora/agents.ts` — wires the typed `ctx.agents` producers. */
|
|
2148
|
+
agents?: ReadonlyArray<AgentIR>;
|
|
2036
2149
|
containers?: ReadonlyArray<ContainerIR>;
|
|
2037
2150
|
/** The single `defineEnv(...)` contract declared in `lunora/env.ts` — applies the accessor to the worker `env` to populate `ctx.env`. */
|
|
2038
2151
|
env?: EnvIR;
|
|
@@ -2080,6 +2193,7 @@ interface EmitShardOptions {
|
|
|
2080
2193
|
}
|
|
2081
2194
|
declare const emitShard: ({
|
|
2082
2195
|
advisories,
|
|
2196
|
+
agents,
|
|
2083
2197
|
containers,
|
|
2084
2198
|
env,
|
|
2085
2199
|
flagKeys,
|
|
@@ -2165,6 +2279,16 @@ declare const emitVectors: (vectorIndexes: ReadonlyArray<VectorIndexIR>) => stri
|
|
|
2165
2279
|
declare const emitWranglerCronTriggers: (crons: ReadonlyArray<CronJobIR>) => string[];
|
|
2166
2280
|
/** Which capability methods the generated `defineApp` builder exposes — one flag per package-backed feature the app actually uses. */
|
|
2167
2281
|
interface EmitAppOptions {
|
|
2282
|
+
/**
|
|
2283
|
+
* Inbound-email agents (`defineAgent({ onEmail })`) → wire the worker's
|
|
2284
|
+
* top-level `email()` handler to `dispatchAgentEmail(...)` (from
|
|
2285
|
+
* `@lunora/agent/inbound`), so received mail starts a durable run. Empty/absent
|
|
2286
|
+
* ⇒ no wiring, byte-identical output for email-free (and agent-free) projects.
|
|
2287
|
+
*/
|
|
2288
|
+
emailAgents?: ReadonlyArray<{
|
|
2289
|
+
bindingName: string;
|
|
2290
|
+
exportName: string;
|
|
2291
|
+
}>;
|
|
2168
2292
|
/** App depends on `@lunora/cloudflare-access` → emit `.access()` (wire the Cloudflare Access `resolveIdentity`, composed ahead of `@lunora/auth` when both are present). */
|
|
2169
2293
|
hasAccess: boolean;
|
|
2170
2294
|
/** App uses `@lunora/ai` / `ctx.ai` → emit `.ai()` (override the Workers AI binding backing `ctx.ai`). */
|
|
@@ -2209,6 +2333,17 @@ interface EmitAppOptions {
|
|
|
2209
2333
|
jurisdiction?: JurisdictionIR;
|
|
2210
2334
|
/** Project depends on the unscoped `lunorash` umbrella → import the runtime via `lunorash/runtime` instead of `@lunora/runtime`. */
|
|
2211
2335
|
useUmbrella: boolean;
|
|
2336
|
+
/**
|
|
2337
|
+
* Voice-enabled agents (`defineAgent({ voice: … })`) → wire
|
|
2338
|
+
* `options.voiceAgents`, mapping each agent's export name to its `VOICE_*`
|
|
2339
|
+
* Durable Object namespace binding so the runtime exposes
|
|
2340
|
+
* `/_lunora/voice/<exportName>`. Empty/absent ⇒ no wiring, byte-identical
|
|
2341
|
+
* output for voice-free (and agent-free) projects.
|
|
2342
|
+
*/
|
|
2343
|
+
voiceAgents?: ReadonlyArray<{
|
|
2344
|
+
bindingName: string;
|
|
2345
|
+
exportName: string;
|
|
2346
|
+
}>;
|
|
2212
2347
|
/** An OpenAPI spec is emitted (`openapi.ts`) → wire `openApiSpec` into the worker. */
|
|
2213
2348
|
wantsOpenApi: boolean;
|
|
2214
2349
|
/** An OpenRPC spec is emitted (`openrpc.ts`) → wire `openRpcSpec` into the worker. */
|
|
@@ -2553,6 +2688,13 @@ interface CodegenResult {
|
|
|
2553
2688
|
*/
|
|
2554
2689
|
advisories: ReadonlyArray<Finding>;
|
|
2555
2690
|
/**
|
|
2691
|
+
* Agents discovered from `defineAgent` exports in `lunora/agents.ts` — the
|
|
2692
|
+
* list the config layer reconciles into wrangler's `workflows[]` array (an
|
|
2693
|
+
* agent compiles onto a Cloudflare Workflow). Agents are NOT Durable Objects,
|
|
2694
|
+
* so this adds no binding or migration. Empty when the project declares none.
|
|
2695
|
+
*/
|
|
2696
|
+
agents: ReadonlyArray<AgentIR>;
|
|
2697
|
+
/**
|
|
2556
2698
|
* Containers discovered from `defineContainer` exports in
|
|
2557
2699
|
* `lunora/containers.ts` — the list the config layer reconciles into
|
|
2558
2700
|
* wrangler's `containers[]`, `CONTAINER_*` Durable Object bindings, and
|
|
@@ -2566,6 +2708,8 @@ interface CodegenResult {
|
|
|
2566
2708
|
*/
|
|
2567
2709
|
cronTriggers: ReadonlyArray<string>;
|
|
2568
2710
|
generated: {
|
|
2711
|
+
/** WorkflowEntrypoint classes for declared agents (`_generated/agents.ts`); `""` (and not written) when no agents are declared. */
|
|
2712
|
+
agents: string;
|
|
2569
2713
|
api: string; /** Fluent worker-composition builder (`_generated/app.ts`) — `defineApp()`. Always written. */
|
|
2570
2714
|
app: string;
|
|
2571
2715
|
/** Partial-replication collection factories (`_generated/collections.ts`); `""` (and not written) unless the project declares shapes and installs `@lunora/db`. */
|
|
@@ -2661,4 +2805,4 @@ declare const secretKindOf: (value: string) => string | undefined;
|
|
|
2661
2805
|
/** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
|
|
2662
2806
|
declare const redact: (value: string) => string;
|
|
2663
2807
|
declare const VERSION = "0.0.0";
|
|
2664
|
-
export { type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type CronJobIR, type DriftChange, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcEmitInput, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type R2sqlCallIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SHAPES_FILENAME, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type ShapeIR, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, createCodegenProject, diagnosticAt, diffSchemaSnapshots, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, evaluateSchemaDrift, formatAdvisories, lintSchema, parseSchemaSnapshot, redact, refreshCodegenProject, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, validatorIrToJsonSchema };
|
|
2808
|
+
export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type CronJobIR, type DriftChange, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcEmitInput, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type R2sqlCallIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SHAPES_FILENAME, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type ShapeIR, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, createCodegenProject, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, evaluateSchemaDrift, formatAdvisories, lintSchema, parseSchemaSnapshot, redact, refreshCodegenProject, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, validatorIrToJsonSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -122,13 +122,13 @@ interface ExternalSourceIR {
|
|
|
122
122
|
binding: string;
|
|
123
123
|
/** Whether a `columns` projection allow-list was given. */
|
|
124
124
|
columns?: ReadonlyArray<string>;
|
|
125
|
-
/** `true` when a `reconcileEveryMs` was given
|
|
125
|
+
/** `true` when a `reconcileEveryMs` was given — reserved for a future incremental mode's delete-visibility lint; not on the typed `.source()` surface today. */
|
|
126
126
|
hasReconcile?: boolean;
|
|
127
127
|
/** `true` when a `tenantBy` mapper was given — the tenant-isolation boundary the `external_source_unscoped` lint checks. */
|
|
128
128
|
hasTenantBy: boolean;
|
|
129
129
|
/** The `idColumn` literal, when given (defaults to `"id"` at runtime). */
|
|
130
130
|
idColumn?: string;
|
|
131
|
-
/** Delete-detection mode literal, when given (`"full-pull"`
|
|
131
|
+
/** Delete-detection mode literal, when given (`"full-pull"` today). */
|
|
132
132
|
mode?: string;
|
|
133
133
|
/** The membership query literal, when statically knowable. */
|
|
134
134
|
query?: string;
|
|
@@ -451,6 +451,64 @@ interface WorkflowIR {
|
|
|
451
451
|
*/
|
|
452
452
|
steps: ReadonlyArray<WorkflowStepIR>;
|
|
453
453
|
}
|
|
454
|
+
/**
|
|
455
|
+
* An agent lifted from a `defineAgent()` export in `lunora/agents.ts`. A
|
|
456
|
+
* `defineAgent` compiles its durable tool-loop onto a Cloudflare Workflow, so —
|
|
457
|
+
* like {@link WorkflowIR} — an agent is NOT a Durable Object: wrangler gets only
|
|
458
|
+
* a `workflows[]` entry, never a `durable_objects` binding or a migration class.
|
|
459
|
+
* Carries what the emitters and the config layer need to wire the generated
|
|
460
|
+
* agent `WorkflowEntrypoint` class (e.g. `SupportAgentWorkflow`), the typed
|
|
461
|
+
* per-agent `ctx.agents` producer, and the reconciled wrangler `workflows[]`
|
|
462
|
+
* entry. Names are derived via `@lunora/agent`'s shared helpers so codegen and
|
|
463
|
+
* the config layer can never disagree.
|
|
464
|
+
*/
|
|
465
|
+
interface AgentIR {
|
|
466
|
+
/** The Cloudflare `Workflow` binding name, e.g. `AGENT_SUPPORT`. */
|
|
467
|
+
bindingName: string;
|
|
468
|
+
/** Generated `WorkflowEntrypoint` class name, e.g. `SupportAgentWorkflow`. */
|
|
469
|
+
className: string;
|
|
470
|
+
/** The `lunora/agents.ts` export name, e.g. `support`. */
|
|
471
|
+
exportName: string;
|
|
472
|
+
/**
|
|
473
|
+
* The stable wrangler `workflows[].name`. Defaults to the kebab-cased export
|
|
474
|
+
* name (`support` → `agent-support`); a static `name:` literal in the
|
|
475
|
+
* definition overrides it.
|
|
476
|
+
*/
|
|
477
|
+
name: string;
|
|
478
|
+
/**
|
|
479
|
+
* Whether the definition declares an `onEmail` mapper on
|
|
480
|
+
* `defineAgent({ onEmail: … })`. When `true` the emitter wires this agent
|
|
481
|
+
* onto the worker's top-level `email()` handler (via `@lunora/agent/inbound`)
|
|
482
|
+
* so inbound mail starts a durable run. Detected by AST PRESENCE — the
|
|
483
|
+
* closure is never evaluated — and written to IR only when present, so
|
|
484
|
+
* email-free agents (and agent-free projects) stay byte-identical.
|
|
485
|
+
*/
|
|
486
|
+
onEmail?: boolean;
|
|
487
|
+
/**
|
|
488
|
+
* Whether the definition opted into public run-starts via
|
|
489
|
+
* `defineAgent({ publicRun: true })` — emitted into the `ctx.agents` wiring
|
|
490
|
+
* spec so the public `agents:agentRun` mutation can gate on it fail-closed.
|
|
491
|
+
* Absent (falsy) means server-side starts only; the field is written to IR
|
|
492
|
+
* only when the literal is `true`, so agent-free and non-opted-in output is
|
|
493
|
+
* byte-identical.
|
|
494
|
+
*/
|
|
495
|
+
publicRun?: boolean;
|
|
496
|
+
/**
|
|
497
|
+
* Whether the definition opted into a real-time voice session via a `voice`
|
|
498
|
+
* block on `defineAgent({ voice: … })`. Unlike the durable loop (a Workflow),
|
|
499
|
+
* the voice path IS a Durable Object — so when this is `true` the emitter
|
|
500
|
+
* generates the `voiceClassName` `VoiceSessionDO` subclass and the
|
|
501
|
+
* `api.agents.{name}Voice` client reference, and the config layer reconciles
|
|
502
|
+
* a `durable_objects` binding (`voiceBindingName`) + `new_sqlite_classes`
|
|
503
|
+
* migration. Written to IR only when the literal is present, so voice-free
|
|
504
|
+
* agents (and agent-free projects) stay byte-identical.
|
|
505
|
+
*/
|
|
506
|
+
voice?: boolean;
|
|
507
|
+
/** The voice DO's Cloudflare `DurableObjectNamespace` binding name, e.g. `VOICE_SUPPORT`. Present only when `voice`. */
|
|
508
|
+
voiceBindingName?: string;
|
|
509
|
+
/** Generated `VoiceSessionDO` subclass name, e.g. `SupportVoiceDO`. Present only when `voice`. */
|
|
510
|
+
voiceClassName?: string;
|
|
511
|
+
}
|
|
454
512
|
/** One durable step call lifted from a workflow handler body (the use side of {@link WorkflowIR.steps}). */
|
|
455
513
|
interface WorkflowStepIR {
|
|
456
514
|
/** 1-based line of the durable step call. */
|
|
@@ -812,6 +870,15 @@ interface StorageRulesMetadataIR {
|
|
|
812
870
|
interface HttpRouteIR {
|
|
813
871
|
/** `v.*` validators decoding the JSON request body (`.body({...})`), keyed by field. */
|
|
814
872
|
body: Record<string, ValidatorIR>;
|
|
873
|
+
/**
|
|
874
|
+
* Rendered TS type of one SSE chunk — the `R` the `.stream(handler)`
|
|
875
|
+
* handler yields — inferred from the handler via the type checker. Present
|
|
876
|
+
* only when {@link HttpRouteIR.stream} is `true`; `"unknown"` when the
|
|
877
|
+
* checker can't resolve enough context. Feeds the emitted
|
|
878
|
+
* `HttpStreamRef<Chunk, …>` so the chunk type flows to the client.
|
|
879
|
+
* @experimental Part of the HTTP-SSE stream surface (the `httpStreams.*` emission).
|
|
880
|
+
*/
|
|
881
|
+
chunkType?: string;
|
|
815
882
|
/** Export binding name of the route handler (used only for diagnostics / dedupe). */
|
|
816
883
|
exportName: string;
|
|
817
884
|
/** Path relative to `<projectRoot>/lunora/` without extension, e.g. "http". */
|
|
@@ -1692,6 +1759,19 @@ declare class CodegenDiagnosticError extends LunoraError {
|
|
|
1692
1759
|
* lookup is unaffected.
|
|
1693
1760
|
*/
|
|
1694
1761
|
declare const diagnosticAt: (node: Node, detail: string, meta?: Record<string, unknown>) => CodegenDiagnosticError;
|
|
1762
|
+
/** The only file agents may be declared in — mirrors `lunora/workflows.ts`. */
|
|
1763
|
+
declare const AGENTS_FILENAME = "agents.ts";
|
|
1764
|
+
/**
|
|
1765
|
+
* Discover every agent the project declares: exported `defineAgent()` calls in
|
|
1766
|
+
* `lunora/agents.ts`. Returns `[]` when the file doesn't exist. Only four things
|
|
1767
|
+
* are read statically — the optional `name` override (wrangler `workflows[].name`),
|
|
1768
|
+
* the optional `publicRun` opt-in (the `agents:agentRun` capability gate), the
|
|
1769
|
+
* presence of a `voice` block (which turns on the voice-session Durable Object),
|
|
1770
|
+
* and the presence of an `onEmail` mapper (which wires the worker `email()`
|
|
1771
|
+
* handler); the rest of the agent config (model / tools / memory / voice models /
|
|
1772
|
+
* the `onEmail` closure body) is runtime-only, so codegen never evaluates it.
|
|
1773
|
+
*/
|
|
1774
|
+
declare const discoverAgents: (project: Project, lunoraDirectory: string) => AgentIR[];
|
|
1695
1775
|
/**
|
|
1696
1776
|
* Discover `ctx.authApi.<method>(...)` (and bare `authApi.<method>(...)`) calls
|
|
1697
1777
|
* under the lunora source directory and attribute each to the exported function
|
|
@@ -1713,10 +1793,11 @@ declare const discoverContainers: (project: Project, lunoraDirectory: string) =>
|
|
|
1713
1793
|
* (`crons.interval(...)`, `crons.daily(...)`, `crons.cron(...)`, …) and lift them
|
|
1714
1794
|
* into {@link CronJobIR}. Schedules are compiled to standard cron expressions;
|
|
1715
1795
|
* function references are resolved to their `namespace:fn` dispatch path, while a
|
|
1716
|
-
*
|
|
1717
|
-
* workflow start. Names must be unique
|
|
1796
|
+
* `workflows.NAME` / `agents.NAME` reference (or a bare identifier naming a
|
|
1797
|
+
* declared workflow) resolves to a durable workflow start. Names must be unique
|
|
1798
|
+
* across the project.
|
|
1718
1799
|
*/
|
|
1719
|
-
declare const discoverCrons: (project: Project, lunoraDirectory: string, workflows?: ReadonlyArray<WorkflowIR>) => CronJobIR[];
|
|
1800
|
+
declare const discoverCrons: (project: Project, lunoraDirectory: string, workflows?: ReadonlyArray<WorkflowIR>, agents?: ReadonlyArray<AgentIR>) => CronJobIR[];
|
|
1720
1801
|
/** The only file a feature-flag provider may be declared in — mirrors `lunora/queues.ts`. */
|
|
1721
1802
|
declare const FLAGS_FILENAME = "flags.ts";
|
|
1722
1803
|
/** One statically-discovered flag read: the key plus the value type its `ctx.flags.<type>` call implies. */
|
|
@@ -1887,13 +1968,21 @@ declare const GENERATED_HEADER = "// GENERATED by @lunora/codegen — do not edi
|
|
|
1887
1968
|
declare const emitDataModel: (schema: SchemaIR, useUmbrella?: boolean) => string;
|
|
1888
1969
|
/**
|
|
1889
1970
|
* Emit `_generated/api.ts` — the typed `api.*` registry (public functions), the
|
|
1890
|
-
* `internal.*` registry, and (when the project declares
|
|
1891
|
-
* `workflows.*` reference
|
|
1971
|
+
* `internal.*` registry, and (when the project declares them) the typed
|
|
1972
|
+
* `workflows.*` / `agents.*` scheduler-target reference objects. `api`/`internal` are the same `anyApi` proxy
|
|
1892
1973
|
* at runtime (the `__lunoraRef` is identical); visibility is enforced
|
|
1893
1974
|
* server-side at dispatch, not in the reference. Splitting the *types* keeps
|
|
1894
1975
|
* internal functions off the client-facing `api` surface.
|
|
1895
1976
|
*/
|
|
1896
|
-
|
|
1977
|
+
interface EmitApiOptions {
|
|
1978
|
+
agents?: ReadonlyArray<AgentIR>;
|
|
1979
|
+
functions: ReadonlyArray<FunctionIR>;
|
|
1980
|
+
/** Typed REST routes; only `.stream()` (SSE) routes emit a `httpStreams.*` reference. */
|
|
1981
|
+
httpRoutes?: ReadonlyArray<HttpRouteIR>;
|
|
1982
|
+
useUmbrella?: boolean;
|
|
1983
|
+
workflows?: ReadonlyArray<WorkflowIR>;
|
|
1984
|
+
}
|
|
1985
|
+
declare const emitApi: (options: EmitApiOptions) => string;
|
|
1897
1986
|
/**
|
|
1898
1987
|
* Emit `_generated/seed.ts` — a project-bound `createSeedClient` with this
|
|
1899
1988
|
* schema's `InsertModel` and runtime schema pre-applied, so a test or script
|
|
@@ -1904,7 +1993,6 @@ declare const emitApi: (functions: ReadonlyArray<FunctionIR>, workflows?: Readon
|
|
|
1904
1993
|
* Returns `""` when `@lunora/seed` is not a declared dependency, so projects
|
|
1905
1994
|
* that don't use it keep a clean `_generated/` and never import the package.
|
|
1906
1995
|
*/
|
|
1907
|
-
|
|
1908
1996
|
/**
|
|
1909
1997
|
* Emit `_generated/collections.ts` — one TanStack DB collection factory per
|
|
1910
1998
|
* `defineShape` in `lunora/shapes.ts` (the local-first partial-replication
|
|
@@ -1921,6 +2009,8 @@ declare const emitApi: (functions: ReadonlyArray<FunctionIR>, workflows?: Readon
|
|
|
1921
2009
|
*/
|
|
1922
2010
|
declare const emitCollections: (shapes: ReadonlyArray<ShapeIR>, hasDatabase: boolean, useUmbrella?: boolean) => string;
|
|
1923
2011
|
interface EmitServerOptions {
|
|
2012
|
+
/** Agents declared via `defineAgent` exports — wires the typed `ctx.agents` producers onto Mutation/Action contexts. */
|
|
2013
|
+
agents?: ReadonlyArray<AgentIR>;
|
|
1924
2014
|
containers?: ReadonlyArray<ContainerIR>;
|
|
1925
2015
|
/**
|
|
1926
2016
|
* The single `defineEnv(...)` contract declared in `lunora/env.ts`. When
|
|
@@ -1974,6 +2064,7 @@ interface EmitServerOptions {
|
|
|
1974
2064
|
workflows?: ReadonlyArray<WorkflowIR>;
|
|
1975
2065
|
}
|
|
1976
2066
|
declare const emitServer: ({
|
|
2067
|
+
agents,
|
|
1977
2068
|
containers,
|
|
1978
2069
|
env,
|
|
1979
2070
|
hasAccessFacade,
|
|
@@ -1995,7 +2086,17 @@ declare const emitServer: ({
|
|
|
1995
2086
|
useUmbrella,
|
|
1996
2087
|
workflows
|
|
1997
2088
|
}?: EmitServerOptions) => string;
|
|
1998
|
-
|
|
2089
|
+
interface EmitFunctionsOptions {
|
|
2090
|
+
agents?: ReadonlyArray<AgentIR>;
|
|
2091
|
+
functions: ReadonlyArray<FunctionIR>;
|
|
2092
|
+
migrations?: ReadonlyArray<MigrationIR>;
|
|
2093
|
+
mutators?: ReadonlyArray<MutatorIR>;
|
|
2094
|
+
shapes?: ReadonlyArray<ShapeIR>;
|
|
2095
|
+
/** Import of a sandbox tool (`browserTool`/`containerTool`) auto-registers the `sandbox:invoke` action. */
|
|
2096
|
+
usesSandbox?: boolean;
|
|
2097
|
+
useUmbrella?: boolean;
|
|
2098
|
+
}
|
|
2099
|
+
declare const emitFunctions: (options: EmitFunctionsOptions) => string;
|
|
1999
2100
|
/**
|
|
2000
2101
|
* Storage-column map per table for the file browser: `{ table: [field, …] }` for
|
|
2001
2102
|
* every field declared `v.storage(...)` (unwrapping `v.optional(...)`). The
|
|
@@ -2024,6 +2125,16 @@ declare const emitContainers: (containers: ReadonlyArray<ContainerIR>, jurisdict
|
|
|
2024
2125
|
*/
|
|
2025
2126
|
declare const emitWorkflows: (workflows: ReadonlyArray<WorkflowIR>) => string;
|
|
2026
2127
|
/**
|
|
2128
|
+
* Emit `_generated/agents.ts` — one `WorkflowEntrypoint` class per `defineAgent`
|
|
2129
|
+
* export, each a thin subclass of `LunoraWorkflow` (`@lunora/workflow/do`)
|
|
2130
|
+
* constructed with the compiled agent tool-loop (`compileAgentWorkflow`). Like
|
|
2131
|
+
* `_generated/workflows.ts`, the worker entry must re-export these classes:
|
|
2132
|
+
* wrangler requires every `workflows[].class_name` to be exported by the
|
|
2133
|
+
* deployed worker. Returns "" when the project declares no agents (the file is
|
|
2134
|
+
* not written then).
|
|
2135
|
+
*/
|
|
2136
|
+
declare const emitAgents: (agents: ReadonlyArray<AgentIR>) => string;
|
|
2137
|
+
/**
|
|
2027
2138
|
* Emit `_generated/queues.ts` — the push-consumer registry the worker `queue()`
|
|
2028
2139
|
* handler dispatches through. Maps each push queue's stable wrangler name (which
|
|
2029
2140
|
* `batch.queue` carries) to its `defineQueue` definition + export name. Pull
|
|
@@ -2033,6 +2144,8 @@ declare const emitWorkflows: (workflows: ReadonlyArray<WorkflowIR>) => string;
|
|
|
2033
2144
|
*/
|
|
2034
2145
|
interface EmitShardOptions {
|
|
2035
2146
|
advisories?: ReadonlyArray<Finding>;
|
|
2147
|
+
/** Agents declared via `defineAgent` exports in `lunora/agents.ts` — wires the typed `ctx.agents` producers. */
|
|
2148
|
+
agents?: ReadonlyArray<AgentIR>;
|
|
2036
2149
|
containers?: ReadonlyArray<ContainerIR>;
|
|
2037
2150
|
/** The single `defineEnv(...)` contract declared in `lunora/env.ts` — applies the accessor to the worker `env` to populate `ctx.env`. */
|
|
2038
2151
|
env?: EnvIR;
|
|
@@ -2080,6 +2193,7 @@ interface EmitShardOptions {
|
|
|
2080
2193
|
}
|
|
2081
2194
|
declare const emitShard: ({
|
|
2082
2195
|
advisories,
|
|
2196
|
+
agents,
|
|
2083
2197
|
containers,
|
|
2084
2198
|
env,
|
|
2085
2199
|
flagKeys,
|
|
@@ -2165,6 +2279,16 @@ declare const emitVectors: (vectorIndexes: ReadonlyArray<VectorIndexIR>) => stri
|
|
|
2165
2279
|
declare const emitWranglerCronTriggers: (crons: ReadonlyArray<CronJobIR>) => string[];
|
|
2166
2280
|
/** Which capability methods the generated `defineApp` builder exposes — one flag per package-backed feature the app actually uses. */
|
|
2167
2281
|
interface EmitAppOptions {
|
|
2282
|
+
/**
|
|
2283
|
+
* Inbound-email agents (`defineAgent({ onEmail })`) → wire the worker's
|
|
2284
|
+
* top-level `email()` handler to `dispatchAgentEmail(...)` (from
|
|
2285
|
+
* `@lunora/agent/inbound`), so received mail starts a durable run. Empty/absent
|
|
2286
|
+
* ⇒ no wiring, byte-identical output for email-free (and agent-free) projects.
|
|
2287
|
+
*/
|
|
2288
|
+
emailAgents?: ReadonlyArray<{
|
|
2289
|
+
bindingName: string;
|
|
2290
|
+
exportName: string;
|
|
2291
|
+
}>;
|
|
2168
2292
|
/** App depends on `@lunora/cloudflare-access` → emit `.access()` (wire the Cloudflare Access `resolveIdentity`, composed ahead of `@lunora/auth` when both are present). */
|
|
2169
2293
|
hasAccess: boolean;
|
|
2170
2294
|
/** App uses `@lunora/ai` / `ctx.ai` → emit `.ai()` (override the Workers AI binding backing `ctx.ai`). */
|
|
@@ -2209,6 +2333,17 @@ interface EmitAppOptions {
|
|
|
2209
2333
|
jurisdiction?: JurisdictionIR;
|
|
2210
2334
|
/** Project depends on the unscoped `lunorash` umbrella → import the runtime via `lunorash/runtime` instead of `@lunora/runtime`. */
|
|
2211
2335
|
useUmbrella: boolean;
|
|
2336
|
+
/**
|
|
2337
|
+
* Voice-enabled agents (`defineAgent({ voice: … })`) → wire
|
|
2338
|
+
* `options.voiceAgents`, mapping each agent's export name to its `VOICE_*`
|
|
2339
|
+
* Durable Object namespace binding so the runtime exposes
|
|
2340
|
+
* `/_lunora/voice/<exportName>`. Empty/absent ⇒ no wiring, byte-identical
|
|
2341
|
+
* output for voice-free (and agent-free) projects.
|
|
2342
|
+
*/
|
|
2343
|
+
voiceAgents?: ReadonlyArray<{
|
|
2344
|
+
bindingName: string;
|
|
2345
|
+
exportName: string;
|
|
2346
|
+
}>;
|
|
2212
2347
|
/** An OpenAPI spec is emitted (`openapi.ts`) → wire `openApiSpec` into the worker. */
|
|
2213
2348
|
wantsOpenApi: boolean;
|
|
2214
2349
|
/** An OpenRPC spec is emitted (`openrpc.ts`) → wire `openRpcSpec` into the worker. */
|
|
@@ -2553,6 +2688,13 @@ interface CodegenResult {
|
|
|
2553
2688
|
*/
|
|
2554
2689
|
advisories: ReadonlyArray<Finding>;
|
|
2555
2690
|
/**
|
|
2691
|
+
* Agents discovered from `defineAgent` exports in `lunora/agents.ts` — the
|
|
2692
|
+
* list the config layer reconciles into wrangler's `workflows[]` array (an
|
|
2693
|
+
* agent compiles onto a Cloudflare Workflow). Agents are NOT Durable Objects,
|
|
2694
|
+
* so this adds no binding or migration. Empty when the project declares none.
|
|
2695
|
+
*/
|
|
2696
|
+
agents: ReadonlyArray<AgentIR>;
|
|
2697
|
+
/**
|
|
2556
2698
|
* Containers discovered from `defineContainer` exports in
|
|
2557
2699
|
* `lunora/containers.ts` — the list the config layer reconciles into
|
|
2558
2700
|
* wrangler's `containers[]`, `CONTAINER_*` Durable Object bindings, and
|
|
@@ -2566,6 +2708,8 @@ interface CodegenResult {
|
|
|
2566
2708
|
*/
|
|
2567
2709
|
cronTriggers: ReadonlyArray<string>;
|
|
2568
2710
|
generated: {
|
|
2711
|
+
/** WorkflowEntrypoint classes for declared agents (`_generated/agents.ts`); `""` (and not written) when no agents are declared. */
|
|
2712
|
+
agents: string;
|
|
2569
2713
|
api: string; /** Fluent worker-composition builder (`_generated/app.ts`) — `defineApp()`. Always written. */
|
|
2570
2714
|
app: string;
|
|
2571
2715
|
/** Partial-replication collection factories (`_generated/collections.ts`); `""` (and not written) unless the project declares shapes and installs `@lunora/db`. */
|
|
@@ -2661,4 +2805,4 @@ declare const secretKindOf: (value: string) => string | undefined;
|
|
|
2661
2805
|
/** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
|
|
2662
2806
|
declare const redact: (value: string) => string;
|
|
2663
2807
|
declare const VERSION = "0.0.0";
|
|
2664
|
-
export { type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type CronJobIR, type DriftChange, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcEmitInput, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type R2sqlCallIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SHAPES_FILENAME, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type ShapeIR, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, createCodegenProject, diagnosticAt, diffSchemaSnapshots, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, evaluateSchemaDrift, formatAdvisories, lintSchema, parseSchemaSnapshot, redact, refreshCodegenProject, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, validatorIrToJsonSchema };
|
|
2808
|
+
export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type CronJobIR, type DriftChange, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcEmitInput, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type R2sqlCallIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SHAPES_FILENAME, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type ShapeIR, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, createCodegenProject, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, evaluateSchemaDrift, formatAdvisories, lintSchema, parseSchemaSnapshot, redact, refreshCodegenProject, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, validatorIrToJsonSchema };
|