@lunora/codegen 1.0.0-alpha.243 → 1.0.0-alpha.245

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 (64) hide show
  1. package/dist/index.d.mts +132 -4
  2. package/dist/index.d.ts +132 -4
  3. package/dist/index.mjs +1 -1
  4. package/dist/packem_shared/{AGENTS_FILENAME-Bb2jxbOa.mjs → AGENTS_FILENAME-D8SgT3OR.mjs} +1 -1
  5. package/dist/packem_shared/{CONTAINERS_FILENAME-CGB4bqUr.mjs → CONTAINERS_FILENAME-CBCG6g9n.mjs} +1 -1
  6. package/dist/packem_shared/DEFAULT_TARGET-D-zkySYF.mjs +1 -0
  7. package/dist/packem_shared/{FLAGS_FILENAME-BedPDCsR.mjs → FLAGS_FILENAME-W5XQz_Po.mjs} +1 -1
  8. package/dist/packem_shared/{MUTATORS_FILENAME-B6cKrN_m.mjs → MUTATORS_FILENAME-DqWOgC5Z.mjs} +1 -1
  9. package/dist/packem_shared/{NOTIFY_FILENAME-Cri3NT5U.mjs → NOTIFY_FILENAME-C1J_47et.mjs} +1 -1
  10. package/dist/packem_shared/OPENRPC_VERSION-Cr7Zzp6s.mjs +3 -0
  11. package/dist/packem_shared/{QUEUES_FILENAME-BzOl92QK.mjs → QUEUES_FILENAME-RGwht3Xu.mjs} +1 -1
  12. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-KDyLA-v5.mjs +11 -0
  13. package/dist/packem_shared/{SHAPES_FILENAME-zJgzynXR.mjs → SHAPES_FILENAME-DRUFomCj.mjs} +1 -1
  14. package/dist/packem_shared/{WORKFLOWS_FILENAME-DNaUHGS8.mjs → WORKFLOWS_FILENAME-4-ib4HH-.mjs} +1 -1
  15. package/dist/packem_shared/buildOpenApiDocument-SxfElVzK.mjs +3 -0
  16. package/dist/packem_shared/chain-mte5djRJ.mjs +1 -0
  17. package/dist/packem_shared/{classify-procedure-call-BztLe76A.mjs → classify-procedure-call-CmcShAze.mjs} +1 -1
  18. package/dist/packem_shared/{context-property-calls-CjDzLU8p.mjs → context-property-calls-CWf9-6G5.mjs} +1 -1
  19. package/dist/packem_shared/{discoverAuthApiCalls-FxrdBeVt.mjs → discoverAuthApiCalls-DoSN_yc3.mjs} +1 -1
  20. package/dist/packem_shared/{discoverCrons-0lNudk0S.mjs → discoverCrons-BEALHx1S.mjs} +1 -1
  21. package/dist/packem_shared/{discoverFunctions-BsmX-sEq.mjs → discoverFunctions-BcBzcG5x.mjs} +1 -1
  22. package/dist/packem_shared/{discoverHttpRoutes-BcXI9CNt.mjs → discoverHttpRoutes-CJHS4llq.mjs} +1 -1
  23. package/dist/packem_shared/discoverHyperdriveCalls-Bkbh4tG7.mjs +1 -0
  24. package/dist/packem_shared/{discoverInserts-CFJ3IVeI.mjs → discoverInserts-DpuLYPPd.mjs} +1 -1
  25. package/dist/packem_shared/discoverMaskProcedures-B0w8gM0S.mjs +1 -0
  26. package/dist/packem_shared/{discoverMigrations-DbrHwcGE.mjs → discoverMigrations-Dt7ywfZv.mjs} +1 -1
  27. package/dist/packem_shared/{discoverNondeterministicCalls-CSQ_GDcA.mjs → discoverNondeterministicCalls-CNJV2BiP.mjs} +1 -1
  28. package/dist/packem_shared/discoverQueries-BcdqjYky.mjs +1 -0
  29. package/dist/packem_shared/discoverR2sqlCalls-30Wtbc0P.mjs +1 -0
  30. package/dist/packem_shared/{discoverRlsMetadata-CPmAGL0W.mjs → discoverRlsMetadata-mXBmPOGj.mjs} +1 -1
  31. package/dist/packem_shared/{discoverRlsProcedures-BO4qC77y.mjs → discoverRlsProcedures-F4Cy-kSi.mjs} +1 -1
  32. package/dist/packem_shared/{discoverSandboxUsage-CrjZ6yNg.mjs → discoverSandboxUsage-DkbwwFvO.mjs} +1 -1
  33. package/dist/packem_shared/discoverSchema-D5R60b4F.mjs +1 -0
  34. package/dist/packem_shared/{discoverStorageRulesMetadata-D8VYflWt.mjs → discoverStorageRulesMetadata-D3Ot9g5f.mjs} +1 -1
  35. package/dist/packem_shared/emitAgents-CnQEPybh.mjs +1 -0
  36. package/dist/packem_shared/{emitApp-D_9NVcvv.mjs → emitApp-DsMk4tpo.mjs} +4 -2
  37. package/dist/packem_shared/{emitServer-pF_fhA82.mjs → emitServer-nvzMxk3d.mjs} +59 -50
  38. package/dist/packem_shared/{emitShard-DID_s1FK.mjs → emitShard-BiKPSgNP.mjs} +1 -1
  39. package/dist/packem_shared/{exported-procedure-chains-CmCDiPBV.mjs → exported-procedure-chains-D48EXUVQ.mjs} +1 -1
  40. package/dist/packem_shared/{fingerprintSchemaSources-L3nGKDQt.mjs → fingerprintSchemaSources-Cl1CJFeh.mjs} +1 -1
  41. package/dist/packem_shared/{index-BoaHhVtM.mjs → index-D7dKfGPh.mjs} +1 -1
  42. package/dist/packem_shared/listLunoraSourceFiles-CSlcBYlo.mjs +1 -0
  43. package/dist/packem_shared/loadProjectConfig-6Zk3abcc.mjs +1 -0
  44. package/dist/packem_shared/modules-DyCocr1e.mjs +1 -0
  45. package/dist/packem_shared/{parse-validator-C94Yiabo.mjs → parse-validator-C6fHL7OS.mjs} +1 -1
  46. package/dist/packem_shared/readServiceBindings-D9Wi_qGU.mjs +1 -0
  47. package/dist/packem_shared/{shard-BVzXMtWg.mjs → shard-D6EZdlSg.mjs} +61 -61
  48. package/dist/packem_shared/{shard-runtime-oIXHEMU7.mjs → shard-runtime-D9GRosnD.mjs} +14 -6
  49. package/dist/packem_shared/{unwrap-handler-return-CoV_GK33.mjs → unwrap-handler-return-DVY_kFF7.mjs} +1 -1
  50. package/package.json +6 -6
  51. package/dist/packem_shared/DEFAULT_TARGET-wK6-Tado.mjs +0 -1
  52. package/dist/packem_shared/OPENRPC_VERSION-Cl6P9WGv.mjs +0 -3
  53. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-DX6sZtLG.mjs +0 -9
  54. package/dist/packem_shared/buildOpenApiDocument-nYvBhjxu.mjs +0 -3
  55. package/dist/packem_shared/chain-H2N_uKgj.mjs +0 -1
  56. package/dist/packem_shared/discoverHyperdriveCalls-D9qXqTq3.mjs +0 -1
  57. package/dist/packem_shared/discoverMaskProcedures-CV_Cc2_g.mjs +0 -1
  58. package/dist/packem_shared/discoverQueries-C7y8i_Ga.mjs +0 -1
  59. package/dist/packem_shared/discoverR2sqlCalls-fu7fC0i_.mjs +0 -1
  60. package/dist/packem_shared/discoverSchema-D8DBDHEg.mjs +0 -1
  61. package/dist/packem_shared/emitAgents-C3ygr0M8.mjs +0 -1
  62. package/dist/packem_shared/listLunoraSourceFiles-DP-5e-RE.mjs +0 -1
  63. package/dist/packem_shared/loadProjectConfig-CKsFNgn3.mjs +0 -1
  64. package/dist/packem_shared/queries-B-f4jO-x.mjs +0 -1
package/dist/index.d.mts CHANGED
@@ -385,6 +385,12 @@ interface TableIR {
385
385
  * called `.commitOrdered()` default it to `false`.
386
386
  */
387
387
  commitOrdered?: boolean;
388
+ /**
389
+ * `true` when that extension was resolved from a package in `node_modules`
390
+ * rather than from source under `lunora/` (a registry copy-in). Decides
391
+ * whether the component's module owns a `lunora/<key>/` folder.
392
+ */
393
+ extensionFromPackage?: true;
388
394
  /**
389
395
  * The `defineSchemaExtension` key that contributed this table, set when it
390
396
  * arrived through `defineSchema(...).extend(...)`. Absent for a table the app
@@ -943,6 +949,62 @@ interface TopicIR {
943
949
  /** The `lunora/queues.ts` export name, e.g. `signups`. */
944
950
  exportName: string;
945
951
  }
952
+ /**
953
+ * A module: a folder under `lunora/` whose `module.ts` default-exports
954
+ * `defineModule(...)`. Metadata for the Studio catalog, the architecture
955
+ * manifest and the `cross_module_table_write` lint — it changes no `api.*` path.
956
+ */
957
+ interface ModuleIR {
958
+ /** One-line description from `defineModule({ description })`. */
959
+ description?: string;
960
+ /**
961
+ * `true` for an installed component (a `defineSchemaExtension` key merged with
962
+ * `.extend(...)`) treated as a module: it owns its prefixed tables and the
963
+ * `lunora/<key>/` folder its copy-in code lives in. Absent for a declared module.
964
+ */
965
+ installed?: true;
966
+ /** The folder path relative to `lunora/`, e.g. `billing` — also the module's name. */
967
+ name: string;
968
+ /**
969
+ * `false` for an installed component shipped as a package: its code is in
970
+ * `node_modules`, so it owns its tables but no `lunora/<key>/` folder (an app
971
+ * folder of that name stays the app's). Absent means the module owns its folder.
972
+ */
973
+ ownsFolder?: false;
974
+ /** Tables the module declares it owns (`defineModule({ tables })`); empty when it declares none. */
975
+ tables: ReadonlyArray<string>;
976
+ }
977
+ /**
978
+ * A sibling Worker the app calls through a Cloudflare service binding, declared in
979
+ * `lunora.config.*` `services` (plan 457). Becomes a wrangler `services[]` entry,
980
+ * a typed `ctx.services.<name>` on actions, and a `service` node in the
981
+ * architecture manifest.
982
+ */
983
+ interface ServiceBindingIR {
984
+ /** The `services[].binding` Lunora writes, e.g. `SERVICE_DOCUMENT_PARSER`. */
985
+ binding: string;
986
+ /** The exported `WorkerEntrypoint` class for an RPC service; absent for a fetch service. */
987
+ entrypoint?: string;
988
+ /**
989
+ * The Worker name per `env.<name>` block the service's own wrangler config
990
+ * sets a `name` in. An environment missing here deploys as wrangler's
991
+ * default `<worker>-<env>`.
992
+ */
993
+ envWorkers: Readonly<Record<string, string>>;
994
+ /** Absolute path of the service's entry module (its wrangler `main`) — what the RPC type is read from. */
995
+ main: string;
996
+ /** The `ctx.services.<name>` key, e.g. `documentParser`. */
997
+ name: string;
998
+ /**
999
+ * The scopes in which the service still serves on `*.workers.dev` with no
1000
+ * route of its own: `""` for the top level, else the environment name.
1001
+ */
1002
+ publicScopes: ReadonlyArray<string>;
1003
+ /** The Worker's own `name` from its wrangler config — the `services[].service` target. */
1004
+ worker: string;
1005
+ /** Absolute path of the service's wrangler config. */
1006
+ wranglerPath: string;
1007
+ }
946
1008
  /**
947
1009
  * The feature-flag provider declared by the default export of `lunora/flags.ts`
948
1010
  * (`defineFlags({ provider, … })`). Discovery is **metadata-only** — codegen
@@ -1045,6 +1107,24 @@ interface AuthApiCallIR {
1045
1107
  /** The better-auth method invoked (e.g. `banUser`); empty when not statically known. */
1046
1108
  method: string;
1047
1109
  }
1110
+ /**
1111
+ * A table write other than a plain `ctx.db.insert(...)` (see {@link InsertWriteIR}):
1112
+ * a by-id `patch`/`replace`/`delete`/`hardDelete`/`restore`, a batch write, or a
1113
+ * `ctx.db.<table>.*` facade write. Feeds the architecture manifest's `write`
1114
+ * edges and the `cross_module_table_write` lint.
1115
+ */
1116
+ interface TableWriteIR {
1117
+ /** Export binding name of the function performing the write. */
1118
+ exportName: string;
1119
+ /** Source file relative to `<projectRoot>/lunora/`, without extension. */
1120
+ file: string;
1121
+ /** 1-based line of the call. */
1122
+ line: number;
1123
+ /** The writer method called, e.g. `patch`, `deleteMany`, `upsert`. */
1124
+ method: string;
1125
+ /** Target table; `""` when it can't be read (an untyped id, a non-literal name). */
1126
+ table: string;
1127
+ }
1048
1128
  /**
1049
1129
  * A `ctx.db.insert("table", …)` write discovered in a function body, attributed
1050
1130
  * to the exported function (and its file = api namespace) that performs it — the
@@ -2241,6 +2321,7 @@ interface LintSchemaOptions {
2241
2321
  mailRecipientAccesses?: ReadonlyArray<MailRecipientAccessIR>;
2242
2322
  maskProcedures?: ReadonlyArray<MaskProcedureIR>;
2243
2323
  maskStrategies?: ReadonlyArray<MaskStrategyIR>;
2324
+ modules?: ReadonlyArray<ModuleIR>;
2244
2325
  mutators?: ReadonlyArray<MutatorIR>;
2245
2326
  mutatorWrites?: ReadonlyArray<MutatorWriteIR>;
2246
2327
  nondeterministicCalls?: ReadonlyArray<NondeterministicCallIR>;
@@ -2266,6 +2347,7 @@ interface LintSchemaOptions {
2266
2347
  staleMigrationImports?: ReadonlyArray<StaleMigrationImportIR>;
2267
2348
  storageKeyAccesses?: ReadonlyArray<StorageKeyAccessIR>;
2268
2349
  storageUploads?: ReadonlyArray<StorageUploadIR>;
2350
+ tableWrites?: ReadonlyArray<TableWriteIR>;
2269
2351
  unrestrictedWhereBranches?: ReadonlyArray<UnrestrictedWhereBranchIR>;
2270
2352
  vectorNamespaceAccesses?: ReadonlyArray<VectorNamespaceAccessIR>;
2271
2353
  workflowCalls?: ReadonlyArray<WorkflowCallIR>;
@@ -3090,6 +3172,24 @@ declare const discoverSandboxUsage: (project: Project, lunoraDirectory: string)
3090
3172
  * return a structural IR. Throws if the file or call cannot be found.
3091
3173
  */
3092
3174
  declare const discoverSchema: (project: Project, schemaPath: string, projectRoot?: string) => SchemaIR;
3175
+ /**
3176
+ * Resolve every `services` entry in `lunora.config.*` (plan 457) into the binding
3177
+ * Lunora wires: the Worker name and entry module come from the service's own
3178
+ * wrangler config, so they have one source of truth. Returns `[]` when no
3179
+ * service is declared; throws, naming the entry, on anything codegen cannot wire
3180
+ * — an unreadable declaration, a missing folder or config, a nameless Worker.
3181
+ */
3182
+ declare const resolveServiceBindings: (projectRoot: string) => ServiceBindingIR[];
3183
+ /**
3184
+ * The non-throwing {@link resolveServiceBindings}, for the tools around codegen
3185
+ * (dev, deploy, doctor, the Vite plugin): a declaration codegen rejects comes back as `error`
3186
+ * with no services, so each caller decides how loud to be — codegen itself
3187
+ * already throws on it.
3188
+ */
3189
+ declare const readServiceBindings: (projectRoot: string) => {
3190
+ error?: string;
3191
+ services: ServiceBindingIR[];
3192
+ };
3093
3193
  /** The only file shapes may be declared in — mirrors `lunora/queues.ts`. */
3094
3194
  declare const SHAPES_FILENAME = "shapes.ts";
3095
3195
  /**
@@ -3271,6 +3371,8 @@ interface EmitServerOptions {
3271
3371
  * the base optional binding record — byte-identical to today.
3272
3372
  */
3273
3373
  env?: EnvIR;
3374
+ /** Absolute `_generated/` directory, so an RPC service's entry module is imported by a path relative to it. Required with `services`. */
3375
+ generatedDirectory?: string;
3274
3376
  /**
3275
3377
  * A `lunora/` source reads `ctx.access` — wires the verified Cloudflare Access
3276
3378
  * facade (`@lunora/cloudflare-access/context`) onto every ctx. Distinct from
@@ -3314,6 +3416,8 @@ interface EmitServerOptions {
3314
3416
  /** Queues declared via `defineQueue` exports — wires the typed `ctx.queues` producers onto Mutation/Action contexts. */
3315
3417
  queues?: ReadonlyArray<QueueIR>;
3316
3418
  schema?: SchemaIR;
3419
+ /** Sibling Workers declared in `lunora.config.*` `services` — wires a typed `ctx.services` onto ActionCtx (plan 457). */
3420
+ services?: ReadonlyArray<ServiceBindingIR>;
3317
3421
  storageRuleBuckets?: ReadonlyArray<string>;
3318
3422
  /** Topics declared via `defineTopic` exports — wires the typed `ctx.topics` publishers onto Mutation/Action contexts. */
3319
3423
  topics?: ReadonlyArray<TopicIR>;
@@ -3321,7 +3425,7 @@ interface EmitServerOptions {
3321
3425
  useUmbrella?: boolean;
3322
3426
  workflows?: ReadonlyArray<WorkflowIR>;
3323
3427
  }
3324
- declare const emitServer: ({ agents, containers, env, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasVectors, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasX402, identity, queues, schema, storageRuleBuckets, topics, useUmbrella, workflows }?: EmitServerOptions) => string;
3428
+ declare const emitServer: ({ agents, containers, env, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasVectors, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasX402, identity, queues, schema, generatedDirectory, services, storageRuleBuckets, topics, useUmbrella, workflows }?: EmitServerOptions) => string;
3325
3429
  interface EmitShardOptions {
3326
3430
  advisories?: ReadonlyArray<Finding>;
3327
3431
  /** Every declared procedure — the health map's denominator, served via `getAdvisorProcedures`. */
@@ -3383,6 +3487,8 @@ interface EmitShardOptions {
3383
3487
  * unchanged.
3384
3488
  */
3385
3489
  schemaSnapshot?: SchemaSnapshot;
3490
+ /** Sibling Workers declared in `lunora.config.*` `services` — wires `ctx.services` onto the action ctx (plan 457). */
3491
+ services?: ReadonlyArray<ServiceBindingIR>;
3386
3492
  /** Replication shapes declared via `defineShape` in `lunora/shapes.ts` — wires the `resolveShape` subscription override. */
3387
3493
  shapes?: ReadonlyArray<ShapeIR>;
3388
3494
  storageRules?: StorageRulesMetadataIR;
@@ -3393,7 +3499,7 @@ interface EmitShardOptions {
3393
3499
  useUmbrella?: boolean;
3394
3500
  workflows?: ReadonlyArray<WorkflowIR>;
3395
3501
  }
3396
- declare const emitShard: ({ advisories, advisorProcedures, agents, containers, env, flagKeys, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasVectors, hasX402, maskMetadata, mutators, queues, rlsMetadata, schema, schemaSnapshot, shapes, storageRules, studioFeatures, topics, useUmbrella, workflows }: EmitShardOptions) => string;
3502
+ declare const emitShard: ({ advisories, advisorProcedures, agents, containers, env, flagKeys, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasVectors, hasX402, maskMetadata, mutators, queues, rlsMetadata, schema, schemaSnapshot, shapes, storageRules, studioFeatures, services, topics, useUmbrella, workflows }: EmitShardOptions) => string;
3397
3503
  /**
3398
3504
  * Emit `_generated/containers.ts` — one container-enabled Durable Object class
3399
3505
  * per `defineContainer` export, each a thin subclass of `LunoraContainer`
@@ -3540,6 +3646,8 @@ interface EmitAppOptions {
3540
3646
  bindingName: string;
3541
3647
  exportName: string;
3542
3648
  }>;
3649
+ /** An architecture manifest is emitted (`architecture.ts`, the app declares a module) → wire `architecture` into the worker. */
3650
+ wantsArchitecture: boolean;
3543
3651
  /** An OpenAPI spec is emitted (`openapi.ts`) → wire `openApiSpec` into the worker. */
3544
3652
  wantsOpenApi: boolean;
3545
3653
  /** An OpenRPC spec is emitted (`openrpc.ts`) → wire `openRpcSpec` into the worker. */
@@ -3593,6 +3701,8 @@ declare const isHyperdriveGlobalTable: (table: TableIR) => boolean;
3593
3701
  interface OpenApiEmitInput {
3594
3702
  functions: ReadonlyArray<FunctionIR>;
3595
3703
  httpRoutes: ReadonlyArray<HttpRouteIR>;
3704
+ /** The app's modules, passed only once it declares one; an operation in a module folder is tagged with the module instead of its file namespace. */
3705
+ modules?: ReadonlyArray<ModuleIR>;
3596
3706
  /** `info.version`; defaults to `"0.0.0"` with a TODO when the project version is unknown. */
3597
3707
  version?: string;
3598
3708
  }
@@ -3608,7 +3718,8 @@ interface OpenApiEmitInput {
3608
3718
  * requestBody pinning `functionPath` + typed `args`. `internal`/`stream`
3609
3719
  * functions are excluded (unreachable / not invocable on the external RPC path).
3610
3720
  *
3611
- * Operations are grouped into `tags` by file namespace, and every operation
3721
+ * Operations are grouped into `tags` by module (when the file sits in a
3722
+ * `defineModule` folder) or else by file namespace, and every operation
3612
3723
  * references a reusable `LunoraError` error-response component enumerating the
3613
3724
  * standard error codes. Borrows oRPC's per-procedure-operation + tag-grouping +
3614
3725
  * internal-filtering structure; the JSON Schema dialect matches `@lunora/values`
@@ -3637,6 +3748,8 @@ declare const OPENRPC_VERSION = "1.3.2";
3637
3748
  /** Inputs the OpenRPC emitter needs from a codegen run. */
3638
3749
  interface OpenRpcEmitInput {
3639
3750
  functions: ReadonlyArray<FunctionIR>;
3751
+ /** The app's modules, passed only once it declares one; a method in a module folder is tagged with the module instead of its file namespace. */
3752
+ modules?: ReadonlyArray<ModuleIR>;
3640
3753
  /** `info.version`; defaults to `"0.0.0"` with a TODO when the project version is unknown. */
3641
3754
  version?: string;
3642
3755
  }
@@ -3712,6 +3825,16 @@ interface ProjectConfigLiterals {
3712
3825
  unreadable?: boolean;
3713
3826
  };
3714
3827
  remote?: boolean;
3828
+ /**
3829
+ * `services`: binding key → `{ dir, entrypoint? }` (plan 457). `unreadable`
3830
+ * when declared but not an object of string literals, kept apart from the
3831
+ * top-level `unreadable` like `advisor`: a service codegen cannot read must
3832
+ * fail loudly, not vanish from `ctx.services`.
3833
+ */
3834
+ services?: {
3835
+ declared?: Record<string, ServiceLiteral>;
3836
+ unreadable?: boolean;
3837
+ };
3715
3838
  target?: string;
3716
3839
  /**
3717
3840
  * A config file exists, but its default export could not be read as an
@@ -3721,6 +3844,11 @@ interface ProjectConfigLiterals {
3721
3844
  */
3722
3845
  unreadable?: boolean;
3723
3846
  }
3847
+ /** One `services.<key>` entry as written: the Worker's folder and, for RPC, its `WorkerEntrypoint` export. */
3848
+ interface ServiceLiteral {
3849
+ dir: string;
3850
+ entrypoint?: string;
3851
+ }
3724
3852
  /** The structural slice of `lunora.config.*` Lunora reads. Unvalidated on purpose — see {@link loadProjectConfig}. */
3725
3853
  interface LunoraProjectConfig {
3726
3854
  /** Advisor settings for codegen (`minSeverity`). Read by `runCodegen` through {@link readProjectConfigLiterals}. */
@@ -4184,4 +4312,4 @@ declare const secretKindOf: (value: string) => string | undefined;
4184
4312
  /** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
4185
4313
  declare const redact: (value: string) => string;
4186
4314
  declare const VERSION = "0.0.0";
4187
- export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, 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, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcDocument, type OpenRpcEmitInput, type OpenRpcMethod, PROJECT_CONFIG_FILENAMES, type PlatformDiagnostic, type ProjectConfigLiterals, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, type RuntimeVerb, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SDK_LANGUAGES, SDK_TARGETS, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, type ShapeIR, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, redact, refreshCodegenProject, resolveCodegenTarget, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, toAdvisorContext, validatorIrToJsonSchema };
4315
+ export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, 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, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcDocument, type OpenRpcEmitInput, type OpenRpcMethod, PROJECT_CONFIG_FILENAMES, type PlatformDiagnostic, type ProjectConfigLiterals, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, type RuntimeVerb, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SDK_LANGUAGES, SDK_TARGETS, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, type ServiceBindingIR, type ServiceLiteral, type ShapeIR, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, toAdvisorContext, validatorIrToJsonSchema };
package/dist/index.d.ts CHANGED
@@ -385,6 +385,12 @@ interface TableIR {
385
385
  * called `.commitOrdered()` default it to `false`.
386
386
  */
387
387
  commitOrdered?: boolean;
388
+ /**
389
+ * `true` when that extension was resolved from a package in `node_modules`
390
+ * rather than from source under `lunora/` (a registry copy-in). Decides
391
+ * whether the component's module owns a `lunora/<key>/` folder.
392
+ */
393
+ extensionFromPackage?: true;
388
394
  /**
389
395
  * The `defineSchemaExtension` key that contributed this table, set when it
390
396
  * arrived through `defineSchema(...).extend(...)`. Absent for a table the app
@@ -943,6 +949,62 @@ interface TopicIR {
943
949
  /** The `lunora/queues.ts` export name, e.g. `signups`. */
944
950
  exportName: string;
945
951
  }
952
+ /**
953
+ * A module: a folder under `lunora/` whose `module.ts` default-exports
954
+ * `defineModule(...)`. Metadata for the Studio catalog, the architecture
955
+ * manifest and the `cross_module_table_write` lint — it changes no `api.*` path.
956
+ */
957
+ interface ModuleIR {
958
+ /** One-line description from `defineModule({ description })`. */
959
+ description?: string;
960
+ /**
961
+ * `true` for an installed component (a `defineSchemaExtension` key merged with
962
+ * `.extend(...)`) treated as a module: it owns its prefixed tables and the
963
+ * `lunora/<key>/` folder its copy-in code lives in. Absent for a declared module.
964
+ */
965
+ installed?: true;
966
+ /** The folder path relative to `lunora/`, e.g. `billing` — also the module's name. */
967
+ name: string;
968
+ /**
969
+ * `false` for an installed component shipped as a package: its code is in
970
+ * `node_modules`, so it owns its tables but no `lunora/<key>/` folder (an app
971
+ * folder of that name stays the app's). Absent means the module owns its folder.
972
+ */
973
+ ownsFolder?: false;
974
+ /** Tables the module declares it owns (`defineModule({ tables })`); empty when it declares none. */
975
+ tables: ReadonlyArray<string>;
976
+ }
977
+ /**
978
+ * A sibling Worker the app calls through a Cloudflare service binding, declared in
979
+ * `lunora.config.*` `services` (plan 457). Becomes a wrangler `services[]` entry,
980
+ * a typed `ctx.services.<name>` on actions, and a `service` node in the
981
+ * architecture manifest.
982
+ */
983
+ interface ServiceBindingIR {
984
+ /** The `services[].binding` Lunora writes, e.g. `SERVICE_DOCUMENT_PARSER`. */
985
+ binding: string;
986
+ /** The exported `WorkerEntrypoint` class for an RPC service; absent for a fetch service. */
987
+ entrypoint?: string;
988
+ /**
989
+ * The Worker name per `env.<name>` block the service's own wrangler config
990
+ * sets a `name` in. An environment missing here deploys as wrangler's
991
+ * default `<worker>-<env>`.
992
+ */
993
+ envWorkers: Readonly<Record<string, string>>;
994
+ /** Absolute path of the service's entry module (its wrangler `main`) — what the RPC type is read from. */
995
+ main: string;
996
+ /** The `ctx.services.<name>` key, e.g. `documentParser`. */
997
+ name: string;
998
+ /**
999
+ * The scopes in which the service still serves on `*.workers.dev` with no
1000
+ * route of its own: `""` for the top level, else the environment name.
1001
+ */
1002
+ publicScopes: ReadonlyArray<string>;
1003
+ /** The Worker's own `name` from its wrangler config — the `services[].service` target. */
1004
+ worker: string;
1005
+ /** Absolute path of the service's wrangler config. */
1006
+ wranglerPath: string;
1007
+ }
946
1008
  /**
947
1009
  * The feature-flag provider declared by the default export of `lunora/flags.ts`
948
1010
  * (`defineFlags({ provider, … })`). Discovery is **metadata-only** — codegen
@@ -1045,6 +1107,24 @@ interface AuthApiCallIR {
1045
1107
  /** The better-auth method invoked (e.g. `banUser`); empty when not statically known. */
1046
1108
  method: string;
1047
1109
  }
1110
+ /**
1111
+ * A table write other than a plain `ctx.db.insert(...)` (see {@link InsertWriteIR}):
1112
+ * a by-id `patch`/`replace`/`delete`/`hardDelete`/`restore`, a batch write, or a
1113
+ * `ctx.db.<table>.*` facade write. Feeds the architecture manifest's `write`
1114
+ * edges and the `cross_module_table_write` lint.
1115
+ */
1116
+ interface TableWriteIR {
1117
+ /** Export binding name of the function performing the write. */
1118
+ exportName: string;
1119
+ /** Source file relative to `<projectRoot>/lunora/`, without extension. */
1120
+ file: string;
1121
+ /** 1-based line of the call. */
1122
+ line: number;
1123
+ /** The writer method called, e.g. `patch`, `deleteMany`, `upsert`. */
1124
+ method: string;
1125
+ /** Target table; `""` when it can't be read (an untyped id, a non-literal name). */
1126
+ table: string;
1127
+ }
1048
1128
  /**
1049
1129
  * A `ctx.db.insert("table", …)` write discovered in a function body, attributed
1050
1130
  * to the exported function (and its file = api namespace) that performs it — the
@@ -2241,6 +2321,7 @@ interface LintSchemaOptions {
2241
2321
  mailRecipientAccesses?: ReadonlyArray<MailRecipientAccessIR>;
2242
2322
  maskProcedures?: ReadonlyArray<MaskProcedureIR>;
2243
2323
  maskStrategies?: ReadonlyArray<MaskStrategyIR>;
2324
+ modules?: ReadonlyArray<ModuleIR>;
2244
2325
  mutators?: ReadonlyArray<MutatorIR>;
2245
2326
  mutatorWrites?: ReadonlyArray<MutatorWriteIR>;
2246
2327
  nondeterministicCalls?: ReadonlyArray<NondeterministicCallIR>;
@@ -2266,6 +2347,7 @@ interface LintSchemaOptions {
2266
2347
  staleMigrationImports?: ReadonlyArray<StaleMigrationImportIR>;
2267
2348
  storageKeyAccesses?: ReadonlyArray<StorageKeyAccessIR>;
2268
2349
  storageUploads?: ReadonlyArray<StorageUploadIR>;
2350
+ tableWrites?: ReadonlyArray<TableWriteIR>;
2269
2351
  unrestrictedWhereBranches?: ReadonlyArray<UnrestrictedWhereBranchIR>;
2270
2352
  vectorNamespaceAccesses?: ReadonlyArray<VectorNamespaceAccessIR>;
2271
2353
  workflowCalls?: ReadonlyArray<WorkflowCallIR>;
@@ -3090,6 +3172,24 @@ declare const discoverSandboxUsage: (project: Project, lunoraDirectory: string)
3090
3172
  * return a structural IR. Throws if the file or call cannot be found.
3091
3173
  */
3092
3174
  declare const discoverSchema: (project: Project, schemaPath: string, projectRoot?: string) => SchemaIR;
3175
+ /**
3176
+ * Resolve every `services` entry in `lunora.config.*` (plan 457) into the binding
3177
+ * Lunora wires: the Worker name and entry module come from the service's own
3178
+ * wrangler config, so they have one source of truth. Returns `[]` when no
3179
+ * service is declared; throws, naming the entry, on anything codegen cannot wire
3180
+ * — an unreadable declaration, a missing folder or config, a nameless Worker.
3181
+ */
3182
+ declare const resolveServiceBindings: (projectRoot: string) => ServiceBindingIR[];
3183
+ /**
3184
+ * The non-throwing {@link resolveServiceBindings}, for the tools around codegen
3185
+ * (dev, deploy, doctor, the Vite plugin): a declaration codegen rejects comes back as `error`
3186
+ * with no services, so each caller decides how loud to be — codegen itself
3187
+ * already throws on it.
3188
+ */
3189
+ declare const readServiceBindings: (projectRoot: string) => {
3190
+ error?: string;
3191
+ services: ServiceBindingIR[];
3192
+ };
3093
3193
  /** The only file shapes may be declared in — mirrors `lunora/queues.ts`. */
3094
3194
  declare const SHAPES_FILENAME = "shapes.ts";
3095
3195
  /**
@@ -3271,6 +3371,8 @@ interface EmitServerOptions {
3271
3371
  * the base optional binding record — byte-identical to today.
3272
3372
  */
3273
3373
  env?: EnvIR;
3374
+ /** Absolute `_generated/` directory, so an RPC service's entry module is imported by a path relative to it. Required with `services`. */
3375
+ generatedDirectory?: string;
3274
3376
  /**
3275
3377
  * A `lunora/` source reads `ctx.access` — wires the verified Cloudflare Access
3276
3378
  * facade (`@lunora/cloudflare-access/context`) onto every ctx. Distinct from
@@ -3314,6 +3416,8 @@ interface EmitServerOptions {
3314
3416
  /** Queues declared via `defineQueue` exports — wires the typed `ctx.queues` producers onto Mutation/Action contexts. */
3315
3417
  queues?: ReadonlyArray<QueueIR>;
3316
3418
  schema?: SchemaIR;
3419
+ /** Sibling Workers declared in `lunora.config.*` `services` — wires a typed `ctx.services` onto ActionCtx (plan 457). */
3420
+ services?: ReadonlyArray<ServiceBindingIR>;
3317
3421
  storageRuleBuckets?: ReadonlyArray<string>;
3318
3422
  /** Topics declared via `defineTopic` exports — wires the typed `ctx.topics` publishers onto Mutation/Action contexts. */
3319
3423
  topics?: ReadonlyArray<TopicIR>;
@@ -3321,7 +3425,7 @@ interface EmitServerOptions {
3321
3425
  useUmbrella?: boolean;
3322
3426
  workflows?: ReadonlyArray<WorkflowIR>;
3323
3427
  }
3324
- declare const emitServer: ({ agents, containers, env, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasVectors, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasX402, identity, queues, schema, storageRuleBuckets, topics, useUmbrella, workflows }?: EmitServerOptions) => string;
3428
+ declare const emitServer: ({ agents, containers, env, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasVectors, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasX402, identity, queues, schema, generatedDirectory, services, storageRuleBuckets, topics, useUmbrella, workflows }?: EmitServerOptions) => string;
3325
3429
  interface EmitShardOptions {
3326
3430
  advisories?: ReadonlyArray<Finding>;
3327
3431
  /** Every declared procedure — the health map's denominator, served via `getAdvisorProcedures`. */
@@ -3383,6 +3487,8 @@ interface EmitShardOptions {
3383
3487
  * unchanged.
3384
3488
  */
3385
3489
  schemaSnapshot?: SchemaSnapshot;
3490
+ /** Sibling Workers declared in `lunora.config.*` `services` — wires `ctx.services` onto the action ctx (plan 457). */
3491
+ services?: ReadonlyArray<ServiceBindingIR>;
3386
3492
  /** Replication shapes declared via `defineShape` in `lunora/shapes.ts` — wires the `resolveShape` subscription override. */
3387
3493
  shapes?: ReadonlyArray<ShapeIR>;
3388
3494
  storageRules?: StorageRulesMetadataIR;
@@ -3393,7 +3499,7 @@ interface EmitShardOptions {
3393
3499
  useUmbrella?: boolean;
3394
3500
  workflows?: ReadonlyArray<WorkflowIR>;
3395
3501
  }
3396
- declare const emitShard: ({ advisories, advisorProcedures, agents, containers, env, flagKeys, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasVectors, hasX402, maskMetadata, mutators, queues, rlsMetadata, schema, schemaSnapshot, shapes, storageRules, studioFeatures, topics, useUmbrella, workflows }: EmitShardOptions) => string;
3502
+ declare const emitShard: ({ advisories, advisorProcedures, agents, containers, env, flagKeys, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasVectors, hasX402, maskMetadata, mutators, queues, rlsMetadata, schema, schemaSnapshot, shapes, storageRules, studioFeatures, services, topics, useUmbrella, workflows }: EmitShardOptions) => string;
3397
3503
  /**
3398
3504
  * Emit `_generated/containers.ts` — one container-enabled Durable Object class
3399
3505
  * per `defineContainer` export, each a thin subclass of `LunoraContainer`
@@ -3540,6 +3646,8 @@ interface EmitAppOptions {
3540
3646
  bindingName: string;
3541
3647
  exportName: string;
3542
3648
  }>;
3649
+ /** An architecture manifest is emitted (`architecture.ts`, the app declares a module) → wire `architecture` into the worker. */
3650
+ wantsArchitecture: boolean;
3543
3651
  /** An OpenAPI spec is emitted (`openapi.ts`) → wire `openApiSpec` into the worker. */
3544
3652
  wantsOpenApi: boolean;
3545
3653
  /** An OpenRPC spec is emitted (`openrpc.ts`) → wire `openRpcSpec` into the worker. */
@@ -3593,6 +3701,8 @@ declare const isHyperdriveGlobalTable: (table: TableIR) => boolean;
3593
3701
  interface OpenApiEmitInput {
3594
3702
  functions: ReadonlyArray<FunctionIR>;
3595
3703
  httpRoutes: ReadonlyArray<HttpRouteIR>;
3704
+ /** The app's modules, passed only once it declares one; an operation in a module folder is tagged with the module instead of its file namespace. */
3705
+ modules?: ReadonlyArray<ModuleIR>;
3596
3706
  /** `info.version`; defaults to `"0.0.0"` with a TODO when the project version is unknown. */
3597
3707
  version?: string;
3598
3708
  }
@@ -3608,7 +3718,8 @@ interface OpenApiEmitInput {
3608
3718
  * requestBody pinning `functionPath` + typed `args`. `internal`/`stream`
3609
3719
  * functions are excluded (unreachable / not invocable on the external RPC path).
3610
3720
  *
3611
- * Operations are grouped into `tags` by file namespace, and every operation
3721
+ * Operations are grouped into `tags` by module (when the file sits in a
3722
+ * `defineModule` folder) or else by file namespace, and every operation
3612
3723
  * references a reusable `LunoraError` error-response component enumerating the
3613
3724
  * standard error codes. Borrows oRPC's per-procedure-operation + tag-grouping +
3614
3725
  * internal-filtering structure; the JSON Schema dialect matches `@lunora/values`
@@ -3637,6 +3748,8 @@ declare const OPENRPC_VERSION = "1.3.2";
3637
3748
  /** Inputs the OpenRPC emitter needs from a codegen run. */
3638
3749
  interface OpenRpcEmitInput {
3639
3750
  functions: ReadonlyArray<FunctionIR>;
3751
+ /** The app's modules, passed only once it declares one; a method in a module folder is tagged with the module instead of its file namespace. */
3752
+ modules?: ReadonlyArray<ModuleIR>;
3640
3753
  /** `info.version`; defaults to `"0.0.0"` with a TODO when the project version is unknown. */
3641
3754
  version?: string;
3642
3755
  }
@@ -3712,6 +3825,16 @@ interface ProjectConfigLiterals {
3712
3825
  unreadable?: boolean;
3713
3826
  };
3714
3827
  remote?: boolean;
3828
+ /**
3829
+ * `services`: binding key → `{ dir, entrypoint? }` (plan 457). `unreadable`
3830
+ * when declared but not an object of string literals, kept apart from the
3831
+ * top-level `unreadable` like `advisor`: a service codegen cannot read must
3832
+ * fail loudly, not vanish from `ctx.services`.
3833
+ */
3834
+ services?: {
3835
+ declared?: Record<string, ServiceLiteral>;
3836
+ unreadable?: boolean;
3837
+ };
3715
3838
  target?: string;
3716
3839
  /**
3717
3840
  * A config file exists, but its default export could not be read as an
@@ -3721,6 +3844,11 @@ interface ProjectConfigLiterals {
3721
3844
  */
3722
3845
  unreadable?: boolean;
3723
3846
  }
3847
+ /** One `services.<key>` entry as written: the Worker's folder and, for RPC, its `WorkerEntrypoint` export. */
3848
+ interface ServiceLiteral {
3849
+ dir: string;
3850
+ entrypoint?: string;
3851
+ }
3724
3852
  /** The structural slice of `lunora.config.*` Lunora reads. Unvalidated on purpose — see {@link loadProjectConfig}. */
3725
3853
  interface LunoraProjectConfig {
3726
3854
  /** Advisor settings for codegen (`minSeverity`). Read by `runCodegen` through {@link readProjectConfigLiterals}. */
@@ -4184,4 +4312,4 @@ declare const secretKindOf: (value: string) => string | undefined;
4184
4312
  /** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
4185
4313
  declare const redact: (value: string) => string;
4186
4314
  declare const VERSION = "0.0.0";
4187
- export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, 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, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcDocument, type OpenRpcEmitInput, type OpenRpcMethod, PROJECT_CONFIG_FILENAMES, type PlatformDiagnostic, type ProjectConfigLiterals, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, type RuntimeVerb, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SDK_LANGUAGES, SDK_TARGETS, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, type ShapeIR, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, redact, refreshCodegenProject, resolveCodegenTarget, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, toAdvisorContext, validatorIrToJsonSchema };
4315
+ export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, 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, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcDocument, type OpenRpcEmitInput, type OpenRpcMethod, PROJECT_CONFIG_FILENAMES, type PlatformDiagnostic, type ProjectConfigLiterals, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, type RuntimeVerb, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SDK_LANGUAGES, SDK_TARGETS, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, type ServiceBindingIR, type ServiceLiteral, type ShapeIR, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, toAdvisorContext, validatorIrToJsonSchema };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as f,toAdvisorContext as d}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as c,errorAdvisoryNames as n,errorPlatformDiagnosticNames as l,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CodegenDiagnosticError as E,diagnosticAt as u}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as v,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-Bb2jxbOa.mjs";import{listLunoraSourceFiles as C}from"./packem_shared/listLunoraSourceFiles-DP-5e-RE.mjs";import{default as R}from"./packem_shared/discoverAuthApiCalls-FxrdBeVt.mjs";import{CONTAINERS_FILENAME as T,discoverContainers as _}from"./packem_shared/CONTAINERS_FILENAME-CGB4bqUr.mjs";import{default as L}from"./packem_shared/discoverCrons-0lNudk0S.mjs";import{FLAGS_FILENAME as I,discoverFlags as P}from"./packem_shared/FLAGS_FILENAME-BedPDCsR.mjs";import{default as G}from"./packem_shared/discoverFunctions-BsmX-sEq.mjs";import{default as b}from"./packem_shared/discoverHttpRoutes-BcXI9CNt.mjs";import{default as y}from"./packem_shared/discoverHyperdriveCalls-D9qXqTq3.mjs";import{default as k}from"./packem_shared/discoverInserts-CFJ3IVeI.mjs";import{d as K}from"./packem_shared/index-BoaHhVtM.mjs";import{default as z}from"./packem_shared/discoverMigrations-DbrHwcGE.mjs";import{MUTATORS_FILENAME as q,discoverMutators as w}from"./packem_shared/MUTATORS_FILENAME-B6cKrN_m.mjs";import{default as J}from"./packem_shared/discoverNondeterministicCalls-CSQ_GDcA.mjs";import{NOTIFY_FILENAME as X,discoverNotifyCalls as Z,discoverNotifyConfig as $}from"./packem_shared/NOTIFY_FILENAME-Cri3NT5U.mjs";import{default as re}from"./packem_shared/readPackageDependencies-C6h6FZuP.mjs";import{d as te}from"./packem_shared/queries-B-f4jO-x.mjs";import{QUEUES_FILENAME as ae,discoverQueues as ie}from"./packem_shared/QUEUES_FILENAME-BzOl92QK.mjs";import{default as fe}from"./packem_shared/discoverR2sqlCalls-fu7fC0i_.mjs";import{default as pe}from"./packem_shared/discoverRlsProcedures-BO4qC77y.mjs";import{default as ne}from"./packem_shared/discoverRlsMetadata-CPmAGL0W.mjs";import{discoverSandboxUsage as xe}from"./packem_shared/discoverSandboxUsage-CrjZ6yNg.mjs";import{default as Ee}from"./packem_shared/discoverSchema-D8DBDHEg.mjs";import{SHAPES_FILENAME as Ae,discoverShapes as ve}from"./packem_shared/SHAPES_FILENAME-zJgzynXR.mjs";import{default as ge}from"./packem_shared/discoverStorageRulesMetadata-D8VYflWt.mjs";import{WORKFLOWS_FILENAME as Oe,discoverWorkflows as Re}from"./packem_shared/WORKFLOWS_FILENAME-DNaUHGS8.mjs";import{emitApp as Te}from"./packem_shared/emitApp-D_9NVcvv.mjs";import{isD1GlobalTable as he,isHyperdriveGlobalTable as Le}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Ie,emitOpenApi as Pe,emitOpenApiModule as De}from"./packem_shared/buildOpenApiDocument-nYvBhjxu.mjs";import{OPENRPC_VERSION as Ue,buildOpenRpcDocument as be,emitOpenRpc as He,emitOpenRpcModule as ye}from"./packem_shared/OPENRPC_VERSION-Cl6P9WGv.mjs";import{DEFAULT_TARGET as ke,platformMatrixIds as We,readProjectTarget as Ke,resolveCodegenTarget as Ve}from"./packem_shared/DEFAULT_TARGET-wK6-Tado.mjs";import{loadProjectConfig as Qe,readProjectConfigLiterals as qe}from"./packem_shared/loadProjectConfig-CKsFNgn3.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Be,createCodegenProject as Je,findTsconfig as Ye,refreshCodegenProject as Xe,runCodegen as Ze}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-DX6sZtLG.mjs";import{SchemaSnapshotParseError as er,buildSchemaSnapshot as rr,evaluateSchemaDrift as or,parseSchemaSnapshot as tr}from"./packem_shared/SchemaSnapshotParseError-CPOXlFhI.mjs";import{default as ar}from"./packem_shared/fingerprintSchemaSources-L3nGKDQt.mjs";import{schemaFromIr as mr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as dr,validatorIrToJsonSchema as pr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as nr,SDK_TARGETS as lr,generateSdk as xr}from"./packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs";import{redact as Er,secretKindOf as ur}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as vr}from"./packem_shared/emitDrizzleSchema-Cv0HtLR3.mjs";import{default as gr}from"./packem_shared/emitFunctions-BgNeOZt_.mjs";import{default as Or}from"./packem_shared/emitServer-pF_fhA82.mjs";import{e as Mr}from"./packem_shared/shard-BVzXMtWg.mjs";import{G as _r}from"./packem_shared/shared-DjUziztz.mjs";import{MESSAGE_SOLUTIONS as Lr,findSolutionByMessage as Fr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as Pr,findProjectConfigFile as Dr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{A as Ur,B as br,C as Hr}from"./packem_shared/shard-runtime-oIXHEMU7.mjs";import{emitApi as jr,emitCollections as kr}from"./packem_shared/emitApi-DdW9RyGG.mjs";import{emitCrons as Kr,emitScheduler as Vr,emitVectors as zr,emitWranglerCronTriggers as Qr}from"./packem_shared/emitCrons-BRKXFGFu.mjs";import{emitDataModel as wr}from"./packem_shared/emitDataModel-D3WuEZ4b.mjs";import{isTypedSchema as Jr}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{v as AGENTS_FILENAME,T as CONTAINERS_FILENAME,E as CodegenDiagnosticError,ke as DEFAULT_TARGET,I as FLAGS_FILENAME,_r as GENERATED_HEADER,dr as LUNORA_ERROR_CODES,Lr as LUNORA_SOLUTION_RULES,q as MUTATORS_FILENAME,X as NOTIFY_FILENAME,Ue as OPENRPC_VERSION,Pr as PROJECT_CONFIG_FILENAMES,ae as QUEUES_FILENAME,Be as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,nr as SDK_LANGUAGES,lr as SDK_TARGETS,Ae as SHAPES_FILENAME,er as SchemaSnapshotParseError,e as VERSION,Oe as WORKFLOWS_FILENAME,Ie as buildOpenApiDocument,be as buildOpenRpcDocument,rr as buildSchemaSnapshot,Je as createCodegenProject,c as describeErrorLevelFindings,u as diagnosticAt,s as diffSchemaSnapshots,N as discoverAgents,R as discoverAuthApiCalls,_ as discoverContainers,L as discoverCrons,P as discoverFlags,G as discoverFunctions,b as discoverHttpRoutes,y as discoverHyperdriveCalls,k as discoverInserts,K as discoverMaskProcedures,z as discoverMigrations,w as discoverMutators,J as discoverNondeterministicCalls,Z as discoverNotifyCalls,$ as discoverNotifyConfig,te as discoverQueries,ie as discoverQueues,fe as discoverR2sqlCalls,ne as discoverRlsMetadata,pe as discoverRlsProcedures,xe as discoverSandboxUsage,Ee as discoverSchema,ve as discoverShapes,ge as discoverStorageRulesMetadata,Re as discoverWorkflows,Ur as emitAgents,jr as emitApi,Te as emitApp,kr as emitCollections,br as emitContainers,Kr as emitCrons,wr as emitDataModel,vr as emitDrizzleSchema,gr as emitFunctions,Pe as emitOpenApi,De as emitOpenApiModule,He as emitOpenRpc,ye as emitOpenRpcModule,Vr as emitScheduler,Or as emitServer,Mr as emitShard,zr as emitVectors,Hr as emitWorkflows,Qr as emitWranglerCronTriggers,n as errorAdvisoryNames,l as errorPlatformDiagnosticNames,or as evaluateSchemaDrift,Fr as findLunoraSolution,Dr as findProjectConfigFile,Ye as findTsconfig,ar as fingerprintSchemaSources,m as formatAdvisories,xr as generateSdk,he as isD1GlobalTable,Le as isHyperdriveGlobalTable,Jr as isTypedSchema,f as lintSchema,C as listLunoraSourceFiles,Qe as loadProjectConfig,tr as parseSchemaSnapshot,We as platformMatrixIds,re as readPackageDependencies,qe as readProjectConfigLiterals,Ke as readProjectTarget,Er as redact,Xe as refreshCodegenProject,Ve as resolveCodegenTarget,Ze as runCodegen,mr as schemaFromIr,ur as secretKindOf,a as serializeSchemaSnapshot,x as sortedUniqueNames,d as toAdvisorContext,pr as validatorIrToJsonSchema};
1
+ import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as f,toAdvisorContext as d}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as c,errorAdvisoryNames as n,errorPlatformDiagnosticNames as l,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CodegenDiagnosticError as E,diagnosticAt as u}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as v,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-D8SgT3OR.mjs";import{listLunoraSourceFiles as C}from"./packem_shared/listLunoraSourceFiles-CSlcBYlo.mjs";import{default as R}from"./packem_shared/discoverAuthApiCalls-DoSN_yc3.mjs";import{CONTAINERS_FILENAME as T,discoverContainers as _}from"./packem_shared/CONTAINERS_FILENAME-CBCG6g9n.mjs";import{default as L}from"./packem_shared/discoverCrons-BEALHx1S.mjs";import{FLAGS_FILENAME as I,discoverFlags as P}from"./packem_shared/FLAGS_FILENAME-W5XQz_Po.mjs";import{default as G}from"./packem_shared/discoverFunctions-BcBzcG5x.mjs";import{default as b}from"./packem_shared/discoverHttpRoutes-CJHS4llq.mjs";import{default as y}from"./packem_shared/discoverHyperdriveCalls-Bkbh4tG7.mjs";import{default as k}from"./packem_shared/discoverInserts-DpuLYPPd.mjs";import{d as B}from"./packem_shared/index-D7dKfGPh.mjs";import{default as V}from"./packem_shared/discoverMigrations-Dt7ywfZv.mjs";import{MUTATORS_FILENAME as Q,discoverMutators as q}from"./packem_shared/MUTATORS_FILENAME-DqWOgC5Z.mjs";import{default as J}from"./packem_shared/discoverNondeterministicCalls-CNJV2BiP.mjs";import{NOTIFY_FILENAME as X,discoverNotifyCalls as Z,discoverNotifyConfig as $}from"./packem_shared/NOTIFY_FILENAME-C1J_47et.mjs";import{default as re}from"./packem_shared/readPackageDependencies-C6h6FZuP.mjs";import{default as te}from"./packem_shared/discoverQueries-BcdqjYky.mjs";import{QUEUES_FILENAME as ae,discoverQueues as ie}from"./packem_shared/QUEUES_FILENAME-RGwht3Xu.mjs";import{default as fe}from"./packem_shared/discoverR2sqlCalls-30Wtbc0P.mjs";import{default as pe}from"./packem_shared/discoverRlsProcedures-F4Cy-kSi.mjs";import{default as ne}from"./packem_shared/discoverRlsMetadata-mXBmPOGj.mjs";import{discoverSandboxUsage as xe}from"./packem_shared/discoverSandboxUsage-DkbwwFvO.mjs";import{default as Ee}from"./packem_shared/discoverSchema-D5R60b4F.mjs";import{readServiceBindings as Ae,resolveServiceBindings as ve}from"./packem_shared/readServiceBindings-D9Wi_qGU.mjs";import{SHAPES_FILENAME as ge,discoverShapes as Ce}from"./packem_shared/SHAPES_FILENAME-DRUFomCj.mjs";import{default as Re}from"./packem_shared/discoverStorageRulesMetadata-D3Ot9g5f.mjs";import{WORKFLOWS_FILENAME as Te,discoverWorkflows as _e}from"./packem_shared/WORKFLOWS_FILENAME-4-ib4HH-.mjs";import{emitApp as Le}from"./packem_shared/emitApp-DsMk4tpo.mjs";import{isD1GlobalTable as Ie,isHyperdriveGlobalTable as Pe}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Ge,emitOpenApi as Ue,emitOpenApiModule as be}from"./packem_shared/buildOpenApiDocument-SxfElVzK.mjs";import{OPENRPC_VERSION as ye,buildOpenRpcDocument as je,emitOpenRpc as ke,emitOpenRpcModule as We}from"./packem_shared/OPENRPC_VERSION-Cr7Zzp6s.mjs";import{DEFAULT_TARGET as Ke,platformMatrixIds as Ve,readProjectTarget as ze,resolveCodegenTarget as Qe}from"./packem_shared/DEFAULT_TARGET-D-zkySYF.mjs";import{loadProjectConfig as we,readProjectConfigLiterals as Je}from"./packem_shared/loadProjectConfig-6Zk3abcc.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Xe,createCodegenProject as Ze,findTsconfig as $e,refreshCodegenProject as er,runCodegen as rr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-KDyLA-v5.mjs";import{SchemaSnapshotParseError as tr,buildSchemaSnapshot as sr,evaluateSchemaDrift as ar,parseSchemaSnapshot as ir}from"./packem_shared/SchemaSnapshotParseError-CPOXlFhI.mjs";import{default as fr}from"./packem_shared/fingerprintSchemaSources-Cl1CJFeh.mjs";import{schemaFromIr as pr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as nr,validatorIrToJsonSchema as lr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as Sr,SDK_TARGETS as Er,generateSdk as ur}from"./packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs";import{redact as vr,secretKindOf as Nr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Cr}from"./packem_shared/emitDrizzleSchema-Cv0HtLR3.mjs";import{default as Rr}from"./packem_shared/emitFunctions-BgNeOZt_.mjs";import{default as Tr}from"./packem_shared/emitServer-nvzMxk3d.mjs";import{e as hr}from"./packem_shared/shard-D6EZdlSg.mjs";import{G as Fr}from"./packem_shared/shared-DjUziztz.mjs";import{MESSAGE_SOLUTIONS as Pr,findSolutionByMessage as Dr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as Ur,findProjectConfigFile as br}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{B as yr,C as jr,D as kr}from"./packem_shared/shard-runtime-D9GRosnD.mjs";import{emitApi as Br,emitCollections as Kr}from"./packem_shared/emitApi-DdW9RyGG.mjs";import{emitCrons as zr,emitScheduler as Qr,emitVectors as qr,emitWranglerCronTriggers as wr}from"./packem_shared/emitCrons-BRKXFGFu.mjs";import{emitDataModel as Yr}from"./packem_shared/emitDataModel-D3WuEZ4b.mjs";import{isTypedSchema as Zr}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{v as AGENTS_FILENAME,T as CONTAINERS_FILENAME,E as CodegenDiagnosticError,Ke as DEFAULT_TARGET,I as FLAGS_FILENAME,Fr as GENERATED_HEADER,nr as LUNORA_ERROR_CODES,Pr as LUNORA_SOLUTION_RULES,Q as MUTATORS_FILENAME,X as NOTIFY_FILENAME,ye as OPENRPC_VERSION,Ur as PROJECT_CONFIG_FILENAMES,ae as QUEUES_FILENAME,Xe as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Sr as SDK_LANGUAGES,Er as SDK_TARGETS,ge as SHAPES_FILENAME,tr as SchemaSnapshotParseError,e as VERSION,Te as WORKFLOWS_FILENAME,Ge as buildOpenApiDocument,je as buildOpenRpcDocument,sr as buildSchemaSnapshot,Ze as createCodegenProject,c as describeErrorLevelFindings,u as diagnosticAt,s as diffSchemaSnapshots,N as discoverAgents,R as discoverAuthApiCalls,_ as discoverContainers,L as discoverCrons,P as discoverFlags,G as discoverFunctions,b as discoverHttpRoutes,y as discoverHyperdriveCalls,k as discoverInserts,B as discoverMaskProcedures,V as discoverMigrations,q as discoverMutators,J as discoverNondeterministicCalls,Z as discoverNotifyCalls,$ as discoverNotifyConfig,te as discoverQueries,ie as discoverQueues,fe as discoverR2sqlCalls,ne as discoverRlsMetadata,pe as discoverRlsProcedures,xe as discoverSandboxUsage,Ee as discoverSchema,Ce as discoverShapes,Re as discoverStorageRulesMetadata,_e as discoverWorkflows,yr as emitAgents,Br as emitApi,Le as emitApp,Kr as emitCollections,jr as emitContainers,zr as emitCrons,Yr as emitDataModel,Cr as emitDrizzleSchema,Rr as emitFunctions,Ue as emitOpenApi,be as emitOpenApiModule,ke as emitOpenRpc,We as emitOpenRpcModule,Qr as emitScheduler,Tr as emitServer,hr as emitShard,qr as emitVectors,kr as emitWorkflows,wr as emitWranglerCronTriggers,n as errorAdvisoryNames,l as errorPlatformDiagnosticNames,ar as evaluateSchemaDrift,Dr as findLunoraSolution,br as findProjectConfigFile,$e as findTsconfig,fr as fingerprintSchemaSources,m as formatAdvisories,ur as generateSdk,Ie as isD1GlobalTable,Pe as isHyperdriveGlobalTable,Zr as isTypedSchema,f as lintSchema,C as listLunoraSourceFiles,we as loadProjectConfig,ir as parseSchemaSnapshot,Ve as platformMatrixIds,re as readPackageDependencies,Je as readProjectConfigLiterals,ze as readProjectTarget,Ae as readServiceBindings,vr as redact,er as refreshCodegenProject,Qe as resolveCodegenTarget,ve as resolveServiceBindings,rr as runCodegen,pr as schemaFromIr,Nr as secretKindOf,a as serializeSchemaSnapshot,x as sortedUniqueNames,d as toAdvisorContext,lr as validatorIrToJsonSchema};
@@ -1 +1 @@
1
- import{existsSync as p}from"node:fs";import{join as f}from"node:path";import{agentDefaultName as d,agentClassName as b,voiceBindingName as N,voiceClassName as y}from"@lunora/agent/naming";import{LunoraError as m}from"@lunora/errors";import{Node as s,SyntaxKind as u}from"ts-morph";import{diagnosticAt as l}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{unwrapToCallExpression as A,findObjectProperty as c,stringPropertyFor as w}from"./listLunoraSourceFiles-DP-5e-RE.mjs";const h="agents.ts",E=o=>{const n=o.getSymbol();if(!n)return o.getText()==="defineAgent";for(const t of n.getDeclarations())if(s.isImportSpecifier(t))return t.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/agent"?!1:t.getNameNode().getText()==="defineAgent";return!1},P=w("agent"),v=(o,n,t)=>{if(o.getKind()===u.TrueKeyword)return!0;if(o.getKind()===u.FalseKeyword)return!1;throw l(o,`agent "${n}": \`${t}\` must be a static boolean literal — it is deploy configuration codegen writes into the ctx.agents wiring spec`)},T=(o,n)=>{const t=o.getArguments()[0];if(!t||!s.isObjectLiteralExpression(t))throw l(o,`agent "${n}": defineAgent must be passed an inline object literal`);const e={className:b(n),exportName:n,name:d(n)},i=c(t,"name");i&&s.isPropertyAssignment(i)&&(e.name=P(i.getInitializerOrThrow(),n,"name"));const r=c(t,"publicRun");r&&s.isPropertyAssignment(r)&&v(r.getInitializerOrThrow(),n,"publicRun")&&(e.publicRun=!0);const a=c(t,"voice");if(a&&s.isPropertyAssignment(a)){const g=a.getInitializerOrThrow();if(!s.isObjectLiteralExpression(g))throw l(g,`agent "${n}": \`voice\` must be an inline object literal — its presence tells codegen to emit the voice-session Durable Object`);e.voice=!0,e.voiceBindingName=N(n),e.voiceClassName=y(n)}return c(t,"onEmail")&&(e.onEmail=!0),e},I=o=>{const n=[];for(const t of o.getVariableDeclarations()){if(!t.isExported())continue;const e=A(t.getInitializer());if(!e)continue;const i=e.getExpression();if(!s.isIdentifier(i)||!E(i))continue;const r=t.getNameNode();if(!s.isIdentifier(r))throw l(r,"defineAgent exports must be plain named exports (no destructuring)");n.push(T(e,r.getText()))}return n},x=o=>{const n=new Map,t=new Map;for(const e of o){const i=n.get(e.name);if(i!==void 0)throw new m("DUPLICATE_AGENT_NAME",`Duplicate agent name "${e.name}": produced by both "${i}" and "${e.exportName}". Deployed agent names must be unique across the project.`,{status:500});n.set(e.name,e.exportName);const r=t.get(e.className);if(r!==void 0)throw new m("DUPLICATE_AGENT_CLASS",`Duplicate agent class "${e.className}": produced by both "${r}" and "${e.exportName}". Agent export names must yield unique generated class names.`,{status:500});t.set(e.className,e.exportName)}},O=(o,n)=>{const t=f(n,h);if(!p(t))return[];const e=o.getSourceFile(t)??o.addSourceFileAtPath(t),i=I(e);return i.sort((r,a)=>r.exportName.localeCompare(a.exportName)),x(i),i};export{h as AGENTS_FILENAME,O as discoverAgents};
1
+ import{existsSync as p}from"node:fs";import{join as f}from"node:path";import{agentDefaultName as d,agentClassName as b,voiceBindingName as N,voiceClassName as y}from"@lunora/agent/naming";import{LunoraError as m}from"@lunora/errors";import{Node as s,SyntaxKind as u}from"ts-morph";import{diagnosticAt as l}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{unwrapToCallExpression as A,findObjectProperty as c,stringPropertyFor as w}from"./listLunoraSourceFiles-CSlcBYlo.mjs";const h="agents.ts",E=o=>{const n=o.getSymbol();if(!n)return o.getText()==="defineAgent";for(const t of n.getDeclarations())if(s.isImportSpecifier(t))return t.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/agent"?!1:t.getNameNode().getText()==="defineAgent";return!1},P=w("agent"),v=(o,n,t)=>{if(o.getKind()===u.TrueKeyword)return!0;if(o.getKind()===u.FalseKeyword)return!1;throw l(o,`agent "${n}": \`${t}\` must be a static boolean literal — it is deploy configuration codegen writes into the ctx.agents wiring spec`)},T=(o,n)=>{const t=o.getArguments()[0];if(!t||!s.isObjectLiteralExpression(t))throw l(o,`agent "${n}": defineAgent must be passed an inline object literal`);const e={className:b(n),exportName:n,name:d(n)},i=c(t,"name");i&&s.isPropertyAssignment(i)&&(e.name=P(i.getInitializerOrThrow(),n,"name"));const r=c(t,"publicRun");r&&s.isPropertyAssignment(r)&&v(r.getInitializerOrThrow(),n,"publicRun")&&(e.publicRun=!0);const a=c(t,"voice");if(a&&s.isPropertyAssignment(a)){const g=a.getInitializerOrThrow();if(!s.isObjectLiteralExpression(g))throw l(g,`agent "${n}": \`voice\` must be an inline object literal — its presence tells codegen to emit the voice-session Durable Object`);e.voice=!0,e.voiceBindingName=N(n),e.voiceClassName=y(n)}return c(t,"onEmail")&&(e.onEmail=!0),e},I=o=>{const n=[];for(const t of o.getVariableDeclarations()){if(!t.isExported())continue;const e=A(t.getInitializer());if(!e)continue;const i=e.getExpression();if(!s.isIdentifier(i)||!E(i))continue;const r=t.getNameNode();if(!s.isIdentifier(r))throw l(r,"defineAgent exports must be plain named exports (no destructuring)");n.push(T(e,r.getText()))}return n},x=o=>{const n=new Map,t=new Map;for(const e of o){const i=n.get(e.name);if(i!==void 0)throw new m("DUPLICATE_AGENT_NAME",`Duplicate agent name "${e.name}": produced by both "${i}" and "${e.exportName}". Deployed agent names must be unique across the project.`,{status:500});n.set(e.name,e.exportName);const r=t.get(e.className);if(r!==void 0)throw new m("DUPLICATE_AGENT_CLASS",`Duplicate agent class "${e.className}": produced by both "${r}" and "${e.exportName}". Agent export names must yield unique generated class names.`,{status:500});t.set(e.className,e.exportName)}},O=(o,n)=>{const t=f(n,h);if(!p(t))return[];const e=o.getSourceFile(t)??o.addSourceFileAtPath(t),i=I(e);return i.sort((r,a)=>r.exportName.localeCompare(a.exportName)),x(i),i};export{h as AGENTS_FILENAME,O as discoverAgents};