@lunora/codegen 1.0.0-alpha.432 → 1.0.0-alpha.434

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.mjs CHANGED
@@ -1 +1 @@
1
- import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as i,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{formatAdvisories as d,lintSchema as f,toAdvisorContext as m}from"./packem_shared/formatAdvisories-Bue5tbp6.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as c,errorPlatformDiagnosticNames as l,sortedUniqueNames as S}from"./packem_shared/describeErrorLevelFindings-DlkgCw8a.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-DCzOjTN7.mjs";import{COMPANION_BINDING as u,COMPANION_SERVICE_NAME as N}from"./packem_shared/COMPANION_BINDING-Da_v9XpC.mjs";import{CodegenDiagnosticError as g,diagnosticAt as C}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as I,discoverAgents as _}from"./packem_shared/AGENTS_FILENAME-BSW65Q9R.mjs";import{isTestPath as L,listLunoraSourceFiles as M}from"./packem_shared/isTestPath-DJeZ18i9.mjs";import{default as F}from"./packem_shared/discoverAuthApiCalls-DcvsgL5u.mjs";import{CONTAINERS_FILENAME as P,discoverContainers as D}from"./packem_shared/CONTAINERS_FILENAME-Dy3qWGfI.mjs";import{default as b}from"./packem_shared/discoverCrons-MpIC14pg.mjs";import{ENV_FILENAME as U}from"./packem_shared/ENV_FILENAME-DFx_jlpa.mjs";import{capabilitiesUsedBy as H,createTargetScope as j,foldCapabilitySignals as V,mayReadCapabilityContext as k,sourceCapabilitySignals as W}from"./packem_shared/capabilitiesUsedBy-BcDkRoOu.mjs";import{FLAGS_FILENAME as K,discoverFlags as Q}from"./packem_shared/FLAGS_FILENAME-CDaIBL6L.mjs";import{d as q}from"./packem_shared/index-BwLaIVqA.mjs";import{default as J}from"./packem_shared/discoverHttpRoutes-BtMgsfzG.mjs";import{default as Z}from"./packem_shared/discoverHyperdriveCalls-B--Nvx36.mjs";import{default as ee}from"./packem_shared/discoverInserts-Dx7Lxey3.mjs";import{d as oe}from"./packem_shared/index-CQuAXbal.mjs";import{default as ie}from"./packem_shared/discoverMigrations-DaBdK1Bv.mjs";import{MUTATORS_FILENAME as se,discoverMutators as de}from"./packem_shared/MUTATORS_FILENAME-SLAN2VXq.mjs";import{default as me}from"./packem_shared/discoverNondeterministicCalls-MeKjo_UX.mjs";import{ALL_NOTIFY_CHANNELS as ne,NOTIFY_FILENAME as ce,discoverNotifyCalls as le,discoverNotifyChannels as Se,discoverNotifyConfig as xe}from"./packem_shared/ALL_NOTIFY_CHANNELS-DI0zmZGs.mjs";import{default as Ae}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as Ne}from"./packem_shared/discoverQueries-BlhMsXuk.mjs";import{QUEUES_FILENAME as ge,discoverQueues as Ce}from"./packem_shared/QUEUES_FILENAME-CVkpGqoY.mjs";import{default as Ie}from"./packem_shared/discoverR2sqlCalls-DHvclvkv.mjs";import{default as Re}from"./packem_shared/discoverRlsProcedures-CUfhUqfY.mjs";import{default as Me}from"./packem_shared/discoverRlsMetadata-CO-pRHOx.mjs";import{discoverSandboxUsage as Fe}from"./packem_shared/discoverSandboxUsage-CdrJNRFd.mjs";import{default as Pe}from"./packem_shared/discoverSchema-CL9PLdOu.mjs";import{companionServiceBinding as ye,readBoundServiceBindings as be,readDevServiceBindings as Ge,readServiceBindings as Ue,resolveServiceBindings as Be}from"./packem_shared/companionServiceBinding-BZjm486n.mjs";import{SHAPES_FILENAME as je,discoverShapes as Ve}from"./packem_shared/SHAPES_FILENAME-Cf4sum4C.mjs";import{default as We}from"./packem_shared/discoverStorageRulesMetadata-D_pYyr1i.mjs";import{WORKFLOWS_FILENAME as Ke,discoverWorkflows as Qe}from"./packem_shared/WORKFLOWS_FILENAME-Dtxo_XBw.mjs";import{emitApp as qe}from"./packem_shared/emitApp-a6xtVrpx.mjs";import{isD1GlobalTable as Je,isHyperdriveGlobalTable as Xe}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as $e,emitOpenApi as er,emitOpenApiModule as rr}from"./packem_shared/buildOpenApiDocument-C3zlve6K.mjs";import{OPENRPC_VERSION as tr,buildOpenRpcDocument as ir,emitOpenRpc as ar,emitOpenRpcModule as sr}from"./packem_shared/OPENRPC_VERSION-DkWde9eh.mjs";import{DEFAULT_TARGET as fr,platformMatrixIds as mr,readProjectTarget as pr,resolveCodegenTarget as nr}from"./packem_shared/DEFAULT_TARGET-CnglMKg_.mjs";import{b as lr,r as Sr,c as xr,d as Er}from"./packem_shared/project-config-file-DR7xrrNB.mjs";import{PROJECT_CONFIG_FILENAMES as ur,findCodegenConfigFile as Nr,findProjectConfigFile as vr,projectConfigCandidatePaths as gr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Or,runCodegen as Ir}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-DhUTli8c.mjs";import{SchemaSnapshotParseError as Rr,buildSchemaSnapshot as Lr,evaluateSchemaDrift as Mr,indexReferencesOf as Tr,parseSchemaSnapshot as Fr}from"./packem_shared/SchemaSnapshotParseError-CV7mmuPi.mjs";import{default as Pr}from"./packem_shared/fingerprintSchemaSources-BqPD3mw0.mjs";import{schemaFromIr as yr}from"./packem_shared/schemaFromIr-CByOxuZb.mjs";import{LUNORA_ERROR_CODES as Gr,validatorIrToJsonSchema as Ur}from"./packem_shared/LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{SDK_LANGUAGES as Hr,SDK_TARGETS as jr,generateSdk as Vr}from"./sdk/index.mjs";import{redact as Wr,secretKindOf as zr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Qr}from"./packem_shared/emitDrizzleSchema-lRoq3OJs.mjs";import{e as qr}from"./packem_shared/server-Dfxmm5Zw.mjs";import{e as Jr}from"./packem_shared/shard-DcWZeVPb.mjs";import{G as Zr}from"./packem_shared/shared-Cn7dMQ_u.mjs";import{MESSAGE_SOLUTIONS as eo,findSolutionByMessage as ro}from"@lunora/errors";import{createCodegenProject as to,findTsconfig as io,refreshCodegenProject as ao,tsconfigFingerprint as so}from"./packem_shared/createCodegenProject-C4XuJSap.mjs";import{t as mo,u as po,v as no}from"./packem_shared/shard-runtime-G5mZQjY0.mjs";import{emitApi as lo,emitCollections as So,emitInternalApi as xo}from"./packem_shared/emitApi-lwadq5G7.mjs";import{emitCrons as Ao,emitScheduler as uo,emitVectors as No,emitWranglerCronTriggers as vo}from"./packem_shared/emitCrons-CCRKs482.mjs";import{emitDataModel as Co}from"./packem_shared/emitDataModel-Cen7mAmM.mjs";import{emitFunctions as Io}from"./packem_shared/emitFunctions-ppMX7E3X.mjs";import{isTypedSchema as Ro}from"./packem_shared/isTypedSchema-CDv3pJB6.mjs";const e="0.0.0";export{I as AGENTS_FILENAME,ne as ALL_NOTIFY_CHANNELS,E as CAPABILITY_PROBES,u as COMPANION_BINDING,N as COMPANION_SERVICE_NAME,P as CONTAINERS_FILENAME,g as CodegenDiagnosticError,fr as DEFAULT_TARGET,U as ENV_FILENAME,K as FLAGS_FILENAME,Zr as GENERATED_HEADER,Gr as LUNORA_ERROR_CODES,eo as LUNORA_SOLUTION_RULES,se as MUTATORS_FILENAME,ce as NOTIFY_FILENAME,tr as OPENRPC_VERSION,ur as PROJECT_CONFIG_FILENAMES,ge as QUEUES_FILENAME,Or as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Hr as SDK_LANGUAGES,jr as SDK_TARGETS,je as SHAPES_FILENAME,Rr as SchemaSnapshotParseError,e as VERSION,Ke as WORKFLOWS_FILENAME,$e as buildOpenApiDocument,ir as buildOpenRpcDocument,Lr as buildSchemaSnapshot,H as capabilitiesUsedBy,ye as companionServiceBinding,to as createCodegenProject,j as createTargetScope,n as describeErrorLevelFindings,C as diagnosticAt,i as diffSchemaSnapshots,_ as discoverAgents,F as discoverAuthApiCalls,D as discoverContainers,b as discoverCrons,Q as discoverFlags,q as discoverFunctions,J as discoverHttpRoutes,Z as discoverHyperdriveCalls,ee as discoverInserts,oe as discoverMaskProcedures,ie as discoverMigrations,de as discoverMutators,me as discoverNondeterministicCalls,le as discoverNotifyCalls,Se as discoverNotifyChannels,xe as discoverNotifyConfig,Ne as discoverQueries,Ce as discoverQueues,Ie as discoverR2sqlCalls,Me as discoverRlsMetadata,Re as discoverRlsProcedures,Fe as discoverSandboxUsage,Pe as discoverSchema,Ve as discoverShapes,We as discoverStorageRulesMetadata,Qe as discoverWorkflows,mo as emitAgents,lo as emitApi,qe as emitApp,So as emitCollections,po as emitContainers,Ao as emitCrons,Co as emitDataModel,Qr as emitDrizzleSchema,Io as emitFunctions,xo as emitInternalApi,er as emitOpenApi,rr as emitOpenApiModule,ar as emitOpenRpc,sr as emitOpenRpcModule,uo as emitScheduler,qr as emitServer,Jr as emitShard,No as emitVectors,no as emitWorkflows,vo as emitWranglerCronTriggers,c as errorAdvisoryNames,l as errorPlatformDiagnosticNames,Mr as evaluateSchemaDrift,Nr as findCodegenConfigFile,ro as findLunoraSolution,vr as findProjectConfigFile,io as findTsconfig,Pr as fingerprintSchemaSources,V as foldCapabilitySignals,d as formatAdvisories,Vr as generateSdk,Tr as indexReferencesOf,Je as isD1GlobalTable,Xe as isHyperdriveGlobalTable,L as isTestPath,Ro as isTypedSchema,f as lintSchema,M as listLunoraSourceFiles,lr as loadProjectConfig,k as mayReadCapabilityContext,Fr as parseSchemaSnapshot,mr as platformMatrixIds,gr as projectConfigCandidatePaths,be as readBoundServiceBindings,Ge as readDevServiceBindings,Ae as readPackageDependencies,Sr as readProjectConfigLiterals,xr as readProjectLazyFunctions,Er as readProjectSecurityHeaders,pr as readProjectTarget,Ue as readServiceBindings,Wr as redact,ao as refreshCodegenProject,nr as resolveCodegenTarget,Be as resolveServiceBindings,Ir as runCodegen,yr as schemaFromIr,zr as secretKindOf,a as serializeSchemaSnapshot,S as sortedUniqueNames,W as sourceCapabilitySignals,m as toAdvisorContext,so as tsconfigFingerprint,Ur as validatorIrToJsonSchema};
1
+ import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as i,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{formatAdvisories as d,lintSchema as f,toAdvisorContext as m}from"./packem_shared/formatAdvisories-Bue5tbp6.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as c,errorPlatformDiagnosticNames as l,sortedUniqueNames as S}from"./packem_shared/describeErrorLevelFindings-DlkgCw8a.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-DCzOjTN7.mjs";import{COMPANION_BINDING as u,COMPANION_SERVICE_NAME as N}from"./packem_shared/COMPANION_BINDING-Da_v9XpC.mjs";import{CodegenDiagnosticError as g,diagnosticAt as C}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as I,discoverAgents as _}from"./packem_shared/AGENTS_FILENAME-BSW65Q9R.mjs";import{isTestPath as L,listLunoraSourceFiles as M}from"./packem_shared/isTestPath-DJeZ18i9.mjs";import{default as F}from"./packem_shared/discoverAuthApiCalls-DcvsgL5u.mjs";import{CONTAINERS_FILENAME as P,discoverContainers as D}from"./packem_shared/CONTAINERS_FILENAME-Dy3qWGfI.mjs";import{default as b}from"./packem_shared/discoverCrons-MpIC14pg.mjs";import{ENV_FILENAME as U}from"./packem_shared/ENV_FILENAME-DFx_jlpa.mjs";import{capabilitiesUsedBy as H,createTargetScope as j,foldCapabilitySignals as V,mayReadCapabilityContext as k,sourceCapabilitySignals as W}from"./packem_shared/capabilitiesUsedBy-BcDkRoOu.mjs";import{FLAGS_FILENAME as K,discoverFlags as Q}from"./packem_shared/FLAGS_FILENAME-CDaIBL6L.mjs";import{d as q}from"./packem_shared/index-BwLaIVqA.mjs";import{default as J}from"./packem_shared/discoverHttpRoutes-BtMgsfzG.mjs";import{default as Z}from"./packem_shared/discoverHyperdriveCalls-B--Nvx36.mjs";import{default as ee}from"./packem_shared/discoverInserts-Dx7Lxey3.mjs";import{d as oe}from"./packem_shared/index-CQuAXbal.mjs";import{default as ie}from"./packem_shared/discoverMigrations-DaBdK1Bv.mjs";import{MUTATORS_FILENAME as se,discoverMutators as de}from"./packem_shared/MUTATORS_FILENAME-SLAN2VXq.mjs";import{default as me}from"./packem_shared/discoverNondeterministicCalls-MeKjo_UX.mjs";import{ALL_NOTIFY_CHANNELS as ne,NOTIFY_FILENAME as ce,discoverNotifyCalls as le,discoverNotifyChannels as Se,discoverNotifyConfig as xe}from"./packem_shared/ALL_NOTIFY_CHANNELS-DI0zmZGs.mjs";import{default as Ae}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as Ne}from"./packem_shared/discoverQueries-BlhMsXuk.mjs";import{QUEUES_FILENAME as ge,discoverQueues as Ce}from"./packem_shared/QUEUES_FILENAME-CVkpGqoY.mjs";import{default as Ie}from"./packem_shared/discoverR2sqlCalls-DHvclvkv.mjs";import{default as Re}from"./packem_shared/discoverRlsProcedures-CUfhUqfY.mjs";import{default as Me}from"./packem_shared/discoverRlsMetadata-CO-pRHOx.mjs";import{discoverSandboxUsage as Fe}from"./packem_shared/discoverSandboxUsage-CdrJNRFd.mjs";import{default as Pe}from"./packem_shared/discoverSchema-CL9PLdOu.mjs";import{companionServiceBinding as ye,readBoundServiceBindings as be,readDevServiceBindings as Ge,readServiceBindings as Ue,resolveServiceBindings as Be}from"./packem_shared/companionServiceBinding-BZjm486n.mjs";import{SHAPES_FILENAME as je,discoverShapes as Ve}from"./packem_shared/SHAPES_FILENAME-Cf4sum4C.mjs";import{default as We}from"./packem_shared/discoverStorageRulesMetadata-D_pYyr1i.mjs";import{WORKFLOWS_FILENAME as Ke,discoverWorkflows as Qe}from"./packem_shared/WORKFLOWS_FILENAME-Dtxo_XBw.mjs";import{emitApp as qe}from"./packem_shared/emitApp-usFtAT5L.mjs";import{isD1GlobalTable as Je,isHyperdriveGlobalTable as Xe}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as $e,emitOpenApi as er,emitOpenApiModule as rr}from"./packem_shared/buildOpenApiDocument-C3zlve6K.mjs";import{OPENRPC_VERSION as tr,buildOpenRpcDocument as ir,emitOpenRpc as ar,emitOpenRpcModule as sr}from"./packem_shared/OPENRPC_VERSION-DkWde9eh.mjs";import{DEFAULT_TARGET as fr,platformMatrixIds as mr,readProjectTarget as pr,resolveCodegenTarget as nr}from"./packem_shared/DEFAULT_TARGET-CnglMKg_.mjs";import{b as lr,r as Sr,c as xr,d as Er}from"./packem_shared/project-config-file-DR7xrrNB.mjs";import{PROJECT_CONFIG_FILENAMES as ur,findCodegenConfigFile as Nr,findProjectConfigFile as vr,projectConfigCandidatePaths as gr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Or,runCodegen as Ir}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-B2r56NUA.mjs";import{SchemaSnapshotParseError as Rr,buildSchemaSnapshot as Lr,evaluateSchemaDrift as Mr,indexReferencesOf as Tr,parseSchemaSnapshot as Fr}from"./packem_shared/SchemaSnapshotParseError-CV7mmuPi.mjs";import{default as Pr}from"./packem_shared/fingerprintSchemaSources-BqPD3mw0.mjs";import{schemaFromIr as yr}from"./packem_shared/schemaFromIr-CByOxuZb.mjs";import{LUNORA_ERROR_CODES as Gr,validatorIrToJsonSchema as Ur}from"./packem_shared/LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{SDK_LANGUAGES as Hr,SDK_TARGETS as jr,generateSdk as Vr}from"./sdk/index.mjs";import{redact as Wr,secretKindOf as zr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Qr}from"./packem_shared/emitDrizzleSchema-lRoq3OJs.mjs";import{e as qr}from"./packem_shared/server-Dfxmm5Zw.mjs";import{e as Jr}from"./packem_shared/shard-DcWZeVPb.mjs";import{G as Zr}from"./packem_shared/shared-Cn7dMQ_u.mjs";import{MESSAGE_SOLUTIONS as eo,findSolutionByMessage as ro}from"@lunora/errors";import{createCodegenProject as to,findTsconfig as io,refreshCodegenProject as ao,tsconfigFingerprint as so}from"./packem_shared/createCodegenProject-C4XuJSap.mjs";import{t as mo,u as po,v as no}from"./packem_shared/shard-runtime-G5mZQjY0.mjs";import{emitApi as lo,emitCollections as So,emitInternalApi as xo}from"./packem_shared/emitApi-GMinxDEt.mjs";import{emitCrons as Ao,emitScheduler as uo,emitVectors as No,emitWranglerCronTriggers as vo}from"./packem_shared/emitCrons-CCRKs482.mjs";import{emitDataModel as Co}from"./packem_shared/emitDataModel-Cen7mAmM.mjs";import{emitFunctions as Io}from"./packem_shared/emitFunctions-BV76-xJM.mjs";import{isTypedSchema as Ro}from"./packem_shared/isTypedSchema-CDv3pJB6.mjs";const e="0.0.0";export{I as AGENTS_FILENAME,ne as ALL_NOTIFY_CHANNELS,E as CAPABILITY_PROBES,u as COMPANION_BINDING,N as COMPANION_SERVICE_NAME,P as CONTAINERS_FILENAME,g as CodegenDiagnosticError,fr as DEFAULT_TARGET,U as ENV_FILENAME,K as FLAGS_FILENAME,Zr as GENERATED_HEADER,Gr as LUNORA_ERROR_CODES,eo as LUNORA_SOLUTION_RULES,se as MUTATORS_FILENAME,ce as NOTIFY_FILENAME,tr as OPENRPC_VERSION,ur as PROJECT_CONFIG_FILENAMES,ge as QUEUES_FILENAME,Or as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Hr as SDK_LANGUAGES,jr as SDK_TARGETS,je as SHAPES_FILENAME,Rr as SchemaSnapshotParseError,e as VERSION,Ke as WORKFLOWS_FILENAME,$e as buildOpenApiDocument,ir as buildOpenRpcDocument,Lr as buildSchemaSnapshot,H as capabilitiesUsedBy,ye as companionServiceBinding,to as createCodegenProject,j as createTargetScope,n as describeErrorLevelFindings,C as diagnosticAt,i as diffSchemaSnapshots,_ as discoverAgents,F as discoverAuthApiCalls,D as discoverContainers,b as discoverCrons,Q as discoverFlags,q as discoverFunctions,J as discoverHttpRoutes,Z as discoverHyperdriveCalls,ee as discoverInserts,oe as discoverMaskProcedures,ie as discoverMigrations,de as discoverMutators,me as discoverNondeterministicCalls,le as discoverNotifyCalls,Se as discoverNotifyChannels,xe as discoverNotifyConfig,Ne as discoverQueries,Ce as discoverQueues,Ie as discoverR2sqlCalls,Me as discoverRlsMetadata,Re as discoverRlsProcedures,Fe as discoverSandboxUsage,Pe as discoverSchema,Ve as discoverShapes,We as discoverStorageRulesMetadata,Qe as discoverWorkflows,mo as emitAgents,lo as emitApi,qe as emitApp,So as emitCollections,po as emitContainers,Ao as emitCrons,Co as emitDataModel,Qr as emitDrizzleSchema,Io as emitFunctions,xo as emitInternalApi,er as emitOpenApi,rr as emitOpenApiModule,ar as emitOpenRpc,sr as emitOpenRpcModule,uo as emitScheduler,qr as emitServer,Jr as emitShard,No as emitVectors,no as emitWorkflows,vo as emitWranglerCronTriggers,c as errorAdvisoryNames,l as errorPlatformDiagnosticNames,Mr as evaluateSchemaDrift,Nr as findCodegenConfigFile,ro as findLunoraSolution,vr as findProjectConfigFile,io as findTsconfig,Pr as fingerprintSchemaSources,V as foldCapabilitySignals,d as formatAdvisories,Vr as generateSdk,Tr as indexReferencesOf,Je as isD1GlobalTable,Xe as isHyperdriveGlobalTable,L as isTestPath,Ro as isTypedSchema,f as lintSchema,M as listLunoraSourceFiles,lr as loadProjectConfig,k as mayReadCapabilityContext,Fr as parseSchemaSnapshot,mr as platformMatrixIds,gr as projectConfigCandidatePaths,be as readBoundServiceBindings,Ge as readDevServiceBindings,Ae as readPackageDependencies,Sr as readProjectConfigLiterals,xr as readProjectLazyFunctions,Er as readProjectSecurityHeaders,pr as readProjectTarget,Ue as readServiceBindings,Wr as redact,ao as refreshCodegenProject,nr as resolveCodegenTarget,Be as resolveServiceBindings,Ir as runCodegen,yr as schemaFromIr,zr as secretKindOf,a as serializeSchemaSnapshot,S as sortedUniqueNames,W as sourceCapabilitySignals,m as toAdvisorContext,so as tsconfigFingerprint,Ur as validatorIrToJsonSchema};
@@ -1,4 +1,4 @@
1
- import{existsSync as K,readFileSync as Ie,statSync as fi,realpathSync as To,mkdirSync as vt,writeFileSync as Co,rmSync as Ee,readdirSync as vs}from"node:fs";import{dirname as Se,join as E,relative as xe,sep as Es,basename as Ss,resolve as pi}from"node:path";import{performance as Vt}from"node:perf_hooks";import{RUNTIME_LINTS as Oo,STATIC_LINTS as ko,runAdvisor as Ro}from"@lunora/advisor";import{LunoraError as F}from"@lunora/errors";import{serializeSchemaSnapshot as Lo}from"./SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{toAdvisorContext as Fo}from"./formatAdvisories-Bue5tbp6.mjs";import{Node as r,SyntaxKind as u,Project as Et,VariableDeclarationKind as xs,ts as T}from"ts-morph";import{listLunoraSourceFiles as b,lunoraRelativePath as C,declarationLineOf as gi,collectCallRows as R,descendantsOfKind as S,bindingKeyName as fe,findObjectProperty as V,collectSecurityCallRows as Do,propertyInitializer as M,listSecurityScanFiles as Ue,objectLiteralFromCallbackBody as mi,limitNameOf as hi,optionsObjectLiteral as vi,handlerOf as _o,memberAccessOf as ys,chainRootOf as St,unwrapExpression as v,collectNodeRows as ce,isConstDeclaration as J,outermostValueWrapper as O,isWriteTarget as Te,isSameNode as P,returningFunctionOf as Xt,walkChain as Mo,staticNumberValue as Ei,RUN_METHODS as As,functionReferenceSegments as Ko,isTestPath as $o,isFunctionLike as pe,functionKeyOf as Si,withSourceListMemo as zo}from"./isTestPath-DJeZ18i9.mjs";import{j as se,h as ee,c as N,a as bs,w as Ns,k as Bo,d as $,l as Vo,b as xi,f as Wo,m as Uo,g as Jt,i as jo}from"./attribution-B8xa6AeK.mjs";import{i as Y,a as Ne,r as qo,b as Ho,c as yi,d as Go,s as je,e as Yo,f as Qo,g as Xo}from"./ip-reads-D8rPYtZ6.mjs";import{e as Z,f as Jo,m as Ai,b as xt,g as yt,E as bi,C as Ni,d as wi,h as Zo,j as ea,a as ta}from"./context-root-CO8PbZi5.mjs";import{a as k,i as Pi,c as le,d as Ii,e as Ti,f as sa,b as na,g as ia,h as ra}from"./classify-procedure-call-BK_MMoue.mjs";import{a as y,s as ws}from"./property-name-7cBlgK_O.mjs";import{b as oa,a as Ci}from"./module-specifiers-BctA0m_p.mjs";import{r as At,s as aa}from"./parse-validator-BisfC8bR.mjs";import ca from"./discoverAuthApiCalls-DcvsgL5u.mjs";import{i as z,r as Oi}from"./database-calls-Cug60vT9.mjs";import{i as Zt,p as ki,w as la,d as da}from"./index-BwLaIVqA.mjs";import ua from"./discoverHyperdriveCalls-B--Nvx36.mjs";import{PROJECT_CONFIG_FILENAMES as fa,findProjectConfigFile as Ri,findCodegenConfigFile as pa}from"./PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{contextPropertiesRead as ga,createTargetScope as ma,fileWiresRequestSecretTool as ha,discoverFeatureUsage as va}from"./capabilitiesUsedBy-BcDkRoOu.mjs";import{diagnosticAt as Ce}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{m as Ps,a as lt,s as Li,d as Ea}from"./index-CQuAXbal.mjs";import{MUTATORS_FILENAME as Sa,isDefineMutatorCallee as xa,mutatorServerImplOf as ya,discoverMutators as Aa}from"./MUTATORS_FILENAME-SLAN2VXq.mjs";import ba from"./discoverNondeterministicCalls-MeKjo_UX.mjs";import{discoverNotifyConfig as Na,discoverNotifyCalls as wa}from"./ALL_NOTIFY_CHANNELS-DI0zmZGs.mjs";import Pa from"./discoverR2sqlCalls-DHvclvkv.mjs";import Ia from"./discoverRlsProcedures-CUfhUqfY.mjs";import{s as Is,n as Ta}from"./dispatch-namespace-DwTjD7BU.mjs";import{secretKindOf as Ca,redact as Oa,isHeuristicSecretKind as ka,isSecretishName as Ra}from"./redact-Cy14LEnc.mjs";import{r as Fi,p as La,c as Fa,a as Da,e as _a,d as Ma}from"./project-config-file-DR7xrrNB.mjs";import{a as tt,d as Ka,r as $a}from"./modules-isOWiSYI.mjs";import{WORKFLOWS_FILENAME as za,discoverWorkflows as Ba}from"./WORKFLOWS_FILENAME-Dtxo_XBw.mjs";import{r as Va}from"./json-data-Chfs2Cz5.mjs";import{a as Wa,I as Ua,g as ja,G as Di,d as qa,i as Ha}from"./shared-Cn7dMQ_u.mjs";import{createCodegenProject as Ga}from"./createCodegenProject-C4XuJSap.mjs";import{findTsconfig as p0,refreshCodegenProject as g0,tsconfigFingerprint as m0}from"./createCodegenProject-C4XuJSap.mjs";import{wranglerString as Ya,wranglerValue as Qa,companionName as Xa,COMPANION_FILES as Ja}from"./COMPANION_BINDING-Da_v9XpC.mjs";import{CAPABILITIES as Za,usedCapabilities as ec}from"./CAPABILITY_PROBES-DCzOjTN7.mjs";import{isD1GlobalTable as _i,isHyperdriveGlobalTable as Mi}from"./isD1GlobalTable-udvHAAzD.mjs";import{discoverAgents as tc}from"./AGENTS_FILENAME-BSW65Q9R.mjs";import{discoverContainers as sc}from"./CONTAINERS_FILENAME-Dy3qWGfI.mjs";import nc from"./discoverCrons-MpIC14pg.mjs";import{discoverEnv as ic}from"./ENV_FILENAME-DFx_jlpa.mjs";import Ki from"./readPackageDependencies-RHhGiz0k.mjs";import{discoverQueueDeclarations as rc}from"./QUEUES_FILENAME-CVkpGqoY.mjs";import{discoverSandboxUsage as oc}from"./discoverSandboxUsage-CdrJNRFd.mjs";import{resolveServiceBindings as ac}from"./companionServiceBinding-BZjm486n.mjs";import cc from"./discoverStorageRulesMetadata-D_pYyr1i.mjs";import{resolveCodegenTarget as Fe,gatePlatformFeatures as lc,needsCloudflareModuleWalk as dc,readTargetDiagnostics as uc,vectorizeDimensionDiagnostics as fc,liveStreamsDeliveryAuthorizationDiagnostic as pc,socketRoutesDeliveryAuthorizationDiagnostic as gc,studioPlatformFor as mc,platformFeatureAvailable as hc,gateAdminTokenRevocation as vc}from"./DEFAULT_TARGET-CnglMKg_.mjs";import{i as Ec}from"./schema-BgM8A3XV.mjs";import{b as $i,e as Sc}from"./shard-DcWZeVPb.mjs";import{e as xc,a as yc}from"./server-Dfxmm5Zw.mjs";import{emitDataModel as Ac}from"./emitDataModel-Cen7mAmM.mjs";import{i as bc,b as Nc,e as wc,d as Pc,f as Ic,c as Tc}from"./unwrap-handler-return-BnsKyz9W.mjs";import Cc from"./discoverHttpRoutes-BtMgsfzG.mjs";import Oc from"./discoverInserts-Dx7Lxey3.mjs";import{e as zi}from"./exported-procedure-chains-ej9ozyZB.mjs";import kc from"./discoverMigrations-DaBdK1Bv.mjs";import gn from"./discoverQueries-BlhMsXuk.mjs";import Rc from"./discoverRlsMetadata-CO-pRHOx.mjs";import Lc from"./discoverSchema-CL9PLdOu.mjs";import{discoverShapes as Fc}from"./SHAPES_FILENAME-Cf4sum4C.mjs";import{i as Dc}from"./reserved-words-CW1QFbTd.mjs";import{emitAuthModule as _c,emitApp as Mc}from"./emitApp-a6xtVrpx.mjs";import{readJsonSync as Kc}from"@visulima/fs";import{indexReferencesOf as $c,buildSchemaSnapshot as zc}from"./SchemaSnapshotParseError-CV7mmuPi.mjs";import{buildOpenApiDocument as Bc,emitOpenApiModule as Vc}from"./buildOpenApiDocument-C3zlve6K.mjs";import{buildOpenRpcDocument as Wc,emitOpenRpcModule as Uc}from"./OPENRPC_VERSION-DkWde9eh.mjs";import{w as jc,u as qc,v as Hc,t as Gc,x as Yc}from"./shard-runtime-G5mZQjY0.mjs";import{emitCollections as Qc,emitSeed as Xc,emitApi as Jc,emitInternalApi as Zc}from"./emitApi-lwadq5G7.mjs";import{emitCrons as el,emitScheduler as tl,emitAdminRevocations as sl,emitShardRegistry as nl,emitDurableObjects as il,emitVectors as rl,emitWranglerCronTriggers as ol}from"./emitCrons-CCRKs482.mjs";import al from"./emitDrizzleSchema-lRoq3OJs.mjs";import{LAZY_FUNCTION_DIRECTORY as Bi,emitFunctions as cl,emitLazyFunctionModules as ll}from"./emitFunctions-ppMX7E3X.mjs";const dl=(e,t=!1)=>{if(e.length===0)return"";const s=qa(t),n=e.map(c=>{if(Wa(c.exportName,"live stream export name"),!Ua.test(c.filePath))throw new Error(`@lunora/codegen: live stream file path is not safe to import: ${JSON.stringify(c.filePath)}`);return`import type { ${c.exportName} as ${c.exportName}Stream } from "../${c.filePath}.js";`}),i=e.map(c=>{const l=c.topics.map(d=>{ja(d.name,"live topic name");const f=`(typeof ${c.exportName}Stream)["topics"]["${d.name}"]`,p=`LiveTopicRef<LiveTopicPayload<${f}>>`,g=JSON.stringify(c.id);if(d.fields.length===0)return` ${d.name}: (): ${p} => ({ __lunoraLive: ${g}, topic: ${JSON.stringify(d.name)} }),`;const h=d.fields.map(x=>`\${encodeURIComponent(key.${x})}`).join(":");return` ${d.name}: (key: LiveTopicKey<${f}>): ${p} => ({
1
+ import{existsSync as K,readFileSync as Ie,statSync as fi,realpathSync as To,mkdirSync as vt,writeFileSync as Co,rmSync as Ee,readdirSync as vs}from"node:fs";import{dirname as Se,join as E,relative as xe,sep as Es,basename as Ss,resolve as pi}from"node:path";import{performance as Vt}from"node:perf_hooks";import{RUNTIME_LINTS as Oo,STATIC_LINTS as ko,runAdvisor as Ro}from"@lunora/advisor";import{LunoraError as F}from"@lunora/errors";import{serializeSchemaSnapshot as Lo}from"./SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{toAdvisorContext as Fo}from"./formatAdvisories-Bue5tbp6.mjs";import{Node as r,SyntaxKind as u,Project as Et,VariableDeclarationKind as xs,ts as T}from"ts-morph";import{listLunoraSourceFiles as b,lunoraRelativePath as C,declarationLineOf as gi,collectCallRows as R,descendantsOfKind as S,bindingKeyName as fe,findObjectProperty as V,collectSecurityCallRows as Do,propertyInitializer as M,listSecurityScanFiles as Ue,objectLiteralFromCallbackBody as mi,limitNameOf as hi,optionsObjectLiteral as vi,handlerOf as _o,memberAccessOf as ys,chainRootOf as St,unwrapExpression as v,collectNodeRows as ce,isConstDeclaration as J,outermostValueWrapper as O,isWriteTarget as Te,isSameNode as P,returningFunctionOf as Xt,walkChain as Mo,staticNumberValue as Ei,RUN_METHODS as As,functionReferenceSegments as Ko,isTestPath as $o,isFunctionLike as pe,functionKeyOf as Si,withSourceListMemo as zo}from"./isTestPath-DJeZ18i9.mjs";import{j as se,h as ee,c as N,a as bs,w as Ns,k as Bo,d as $,l as Vo,b as xi,f as Wo,m as Uo,g as Jt,i as jo}from"./attribution-B8xa6AeK.mjs";import{i as Y,a as Ne,r as qo,b as Ho,c as yi,d as Go,s as je,e as Yo,f as Qo,g as Xo}from"./ip-reads-D8rPYtZ6.mjs";import{e as Z,f as Jo,m as Ai,b as xt,g as yt,E as bi,C as Ni,d as wi,h as Zo,j as ea,a as ta}from"./context-root-CO8PbZi5.mjs";import{a as k,i as Pi,c as le,d as Ii,e as Ti,f as sa,b as na,g as ia,h as ra}from"./classify-procedure-call-BK_MMoue.mjs";import{a as y,s as ws}from"./property-name-7cBlgK_O.mjs";import{b as oa,a as Ci}from"./module-specifiers-BctA0m_p.mjs";import{r as At,s as aa}from"./parse-validator-BisfC8bR.mjs";import ca from"./discoverAuthApiCalls-DcvsgL5u.mjs";import{i as z,r as Oi}from"./database-calls-Cug60vT9.mjs";import{i as Zt,p as ki,w as la,d as da}from"./index-BwLaIVqA.mjs";import ua from"./discoverHyperdriveCalls-B--Nvx36.mjs";import{PROJECT_CONFIG_FILENAMES as fa,findProjectConfigFile as Ri,findCodegenConfigFile as pa}from"./PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{contextPropertiesRead as ga,createTargetScope as ma,fileWiresRequestSecretTool as ha,discoverFeatureUsage as va}from"./capabilitiesUsedBy-BcDkRoOu.mjs";import{diagnosticAt as Ce}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{m as Ps,a as lt,s as Li,d as Ea}from"./index-CQuAXbal.mjs";import{MUTATORS_FILENAME as Sa,isDefineMutatorCallee as xa,mutatorServerImplOf as ya,discoverMutators as Aa}from"./MUTATORS_FILENAME-SLAN2VXq.mjs";import ba from"./discoverNondeterministicCalls-MeKjo_UX.mjs";import{discoverNotifyConfig as Na,discoverNotifyCalls as wa}from"./ALL_NOTIFY_CHANNELS-DI0zmZGs.mjs";import Pa from"./discoverR2sqlCalls-DHvclvkv.mjs";import Ia from"./discoverRlsProcedures-CUfhUqfY.mjs";import{s as Is,n as Ta}from"./dispatch-namespace-DwTjD7BU.mjs";import{secretKindOf as Ca,redact as Oa,isHeuristicSecretKind as ka,isSecretishName as Ra}from"./redact-Cy14LEnc.mjs";import{r as Fi,p as La,c as Fa,a as Da,e as _a,d as Ma}from"./project-config-file-DR7xrrNB.mjs";import{a as tt,d as Ka,r as $a}from"./modules-isOWiSYI.mjs";import{WORKFLOWS_FILENAME as za,discoverWorkflows as Ba}from"./WORKFLOWS_FILENAME-Dtxo_XBw.mjs";import{r as Va}from"./json-data-Chfs2Cz5.mjs";import{a as Wa,I as Ua,g as ja,G as Di,d as qa,i as Ha}from"./shared-Cn7dMQ_u.mjs";import{createCodegenProject as Ga}from"./createCodegenProject-C4XuJSap.mjs";import{findTsconfig as p0,refreshCodegenProject as g0,tsconfigFingerprint as m0}from"./createCodegenProject-C4XuJSap.mjs";import{wranglerString as Ya,wranglerValue as Qa,companionName as Xa,COMPANION_FILES as Ja}from"./COMPANION_BINDING-Da_v9XpC.mjs";import{CAPABILITIES as Za,usedCapabilities as ec}from"./CAPABILITY_PROBES-DCzOjTN7.mjs";import{isD1GlobalTable as _i,isHyperdriveGlobalTable as Mi}from"./isD1GlobalTable-udvHAAzD.mjs";import{discoverAgents as tc}from"./AGENTS_FILENAME-BSW65Q9R.mjs";import{discoverContainers as sc}from"./CONTAINERS_FILENAME-Dy3qWGfI.mjs";import nc from"./discoverCrons-MpIC14pg.mjs";import{discoverEnv as ic}from"./ENV_FILENAME-DFx_jlpa.mjs";import Ki from"./readPackageDependencies-RHhGiz0k.mjs";import{discoverQueueDeclarations as rc}from"./QUEUES_FILENAME-CVkpGqoY.mjs";import{discoverSandboxUsage as oc}from"./discoverSandboxUsage-CdrJNRFd.mjs";import{resolveServiceBindings as ac}from"./companionServiceBinding-BZjm486n.mjs";import cc from"./discoverStorageRulesMetadata-D_pYyr1i.mjs";import{resolveCodegenTarget as Fe,gatePlatformFeatures as lc,needsCloudflareModuleWalk as dc,readTargetDiagnostics as uc,vectorizeDimensionDiagnostics as fc,liveStreamsDeliveryAuthorizationDiagnostic as pc,socketRoutesDeliveryAuthorizationDiagnostic as gc,studioPlatformFor as mc,platformFeatureAvailable as hc,gateAdminTokenRevocation as vc}from"./DEFAULT_TARGET-CnglMKg_.mjs";import{i as Ec}from"./schema-BgM8A3XV.mjs";import{b as $i,e as Sc}from"./shard-DcWZeVPb.mjs";import{e as xc,a as yc}from"./server-Dfxmm5Zw.mjs";import{emitDataModel as Ac}from"./emitDataModel-Cen7mAmM.mjs";import{i as bc,b as Nc,e as wc,d as Pc,f as Ic,c as Tc}from"./unwrap-handler-return-BnsKyz9W.mjs";import Cc from"./discoverHttpRoutes-BtMgsfzG.mjs";import Oc from"./discoverInserts-Dx7Lxey3.mjs";import{e as zi}from"./exported-procedure-chains-ej9ozyZB.mjs";import kc from"./discoverMigrations-DaBdK1Bv.mjs";import gn from"./discoverQueries-BlhMsXuk.mjs";import Rc from"./discoverRlsMetadata-CO-pRHOx.mjs";import Lc from"./discoverSchema-CL9PLdOu.mjs";import{discoverShapes as Fc}from"./SHAPES_FILENAME-Cf4sum4C.mjs";import{i as Dc}from"./reserved-words-CW1QFbTd.mjs";import{emitAuthModule as _c,emitApp as Mc}from"./emitApp-usFtAT5L.mjs";import{readJsonSync as Kc}from"@visulima/fs";import{indexReferencesOf as $c,buildSchemaSnapshot as zc}from"./SchemaSnapshotParseError-CV7mmuPi.mjs";import{buildOpenApiDocument as Bc,emitOpenApiModule as Vc}from"./buildOpenApiDocument-C3zlve6K.mjs";import{buildOpenRpcDocument as Wc,emitOpenRpcModule as Uc}from"./OPENRPC_VERSION-DkWde9eh.mjs";import{w as jc,u as qc,v as Hc,t as Gc,x as Yc}from"./shard-runtime-G5mZQjY0.mjs";import{emitCollections as Qc,emitSeed as Xc,emitApi as Jc,emitInternalApi as Zc}from"./emitApi-GMinxDEt.mjs";import{emitCrons as el,emitScheduler as tl,emitAdminRevocations as sl,emitShardRegistry as nl,emitDurableObjects as il,emitVectors as rl,emitWranglerCronTriggers as ol}from"./emitCrons-CCRKs482.mjs";import al from"./emitDrizzleSchema-lRoq3OJs.mjs";import{LAZY_FUNCTION_DIRECTORY as Bi,emitFunctions as cl,emitLazyFunctionModules as ll}from"./emitFunctions-BV76-xJM.mjs";const dl=(e,t=!1)=>{if(e.length===0)return"";const s=qa(t),n=e.map(c=>{if(Wa(c.exportName,"live stream export name"),!Ua.test(c.filePath))throw new Error(`@lunora/codegen: live stream file path is not safe to import: ${JSON.stringify(c.filePath)}`);return`import type { ${c.exportName} as ${c.exportName}Stream } from "../${c.filePath}.js";`}),i=e.map(c=>{const l=c.topics.map(d=>{ja(d.name,"live topic name");const f=`(typeof ${c.exportName}Stream)["topics"]["${d.name}"]`,p=`LiveTopicRef<LiveTopicPayload<${f}>>`,g=JSON.stringify(c.id);if(d.fields.length===0)return` ${d.name}: (): ${p} => ({ __lunoraLive: ${g}, topic: ${JSON.stringify(d.name)} }),`;const h=d.fields.map(x=>`\${encodeURIComponent(key.${x})}`).join(":");return` ${d.name}: (key: LiveTopicKey<${f}>): ${p} => ({
2
2
  __lunoraLive: ${g},
3
3
  topic: \`${d.name}:${h}\`,
4
4
  }),`});return` ${c.exportName}: {
@@ -40,7 +40,7 @@ ${l}
40
40
  */
41
41
  const lunoraAgentRuntimeFunctions = agentComponent().functions;
42
42
  `}},V=(t,e)=>{if(!t)return{importLine:"",lines:"",prelude:""};const s=e.find(n=>g(n.filePath)==="sandbox"&&n.exportName==="invoke");if(s)throw new R("INTERNAL",`@lunora/codegen: "sandbox:invoke" is reserved for the batteries-included sandbox tool dispatcher (browserTool/containerTool) — rename the "invoke" export in ${s.filePath}`);return{importLine:`import { sandboxComponent } from "@lunora/agent/component";
43
- `,lines:' "sandbox:invoke": lunoraSandbox.invoke as unknown as RegisteredLunoraFunction,',prelude:"\n/**\n * The `@lunora/agent` sandbox dispatcher — auto-registered because `lunora/`\n * imports a sandbox tool (`browserTool`/`containerTool`). The batteries-included\n * tools dispatch to this internal action, which runs on an action ctx carrying\n * `ctx.browser` + `ctx.containers` (the durable tool step itself has neither).\n */\nconst lunoraSandbox = sandboxComponent();\n"}},E=(t,e)=>{if(t.length===0)return[];const s=v(e),n=[{args:{key:{kind:"string"},limit:{inner:{kind:"number"},kind:"optional"}},exportName:"agentMessages",filePath:"agents",kind:"query",returnType:"Record<string, unknown>[]"},{args:{limit:{inner:{kind:"number"},kind:"optional"}},exportName:"agentPendingApprovals",filePath:"agents",kind:"query",returnType:"Record<string, unknown>[]"},{args:{decision:{kind:"union",members:[{kind:"literal",literalValue:'"approve"'},{kind:"literal",literalValue:'"approve_for_thread"'},{kind:"literal",literalValue:'"reject"'}]},instanceId:{kind:"string"},note:{inner:{kind:"string"},kind:"optional"},threadKey:{kind:"string"},toolCallId:{kind:"string"}},exportName:"agentResolveApproval",filePath:"agents",kind:"mutation",returnType:"{ resolved: boolean }"},{args:{secret:{kind:"string",sensitive:!0},threadKey:{kind:"string"},toolCallId:{kind:"string"}},exportName:"agentSupplySecret",filePath:"agents",kind:"mutation",returnType:"{ resolved: boolean }"},{args:{threadKey:{kind:"string"},toolCallId:{kind:"string"}},exportName:"agentDeclineSecret",filePath:"agents",kind:"mutation",returnType:"{ resolved: boolean }"},{args:{threadKey:{kind:"string"}},exportName:"agentSecretRequests",filePath:"agents",kind:"query",returnType:'{ createdAt: number; expiresAt: number; label?: string; status: "consumed" | "declined" | "expired" | "pending" | "supplied"; toolCallId: string; toolName: string }[]'},{args:{key:{kind:"string"}},exportName:"agentApprovalGrants",filePath:"agents",kind:"query",returnType:"{ createdAt: number; toolName: string }[]"},{args:{threadKey:{kind:"string"},toolName:{kind:"string"}},exportName:"agentRevokeApprovalGrant",filePath:"agents",kind:"mutation",returnType:"{ revoked: boolean }"},{args:{agent:{kind:"string"},input:{kind:"string"},threadKey:{kind:"string"},title:{inner:{kind:"string"},kind:"optional"}},exportName:"agentRun",filePath:"agents",kind:"mutation",returnType:"{ id: string; threadKey: string }"},{args:{key:{kind:"string"}},exportName:"agentState",filePath:"agents",kind:"query",returnType:"Record<string, unknown> | undefined"},{args:{key:{kind:"string"}},exportName:"agentThread",filePath:"agents",kind:"query",returnType:"Record<string, unknown> | undefined"}];for(const o of t)o.voice&&n.push({args:{threadKey:{kind:"string"}},exportName:`${o.exportName}Voice`,filePath:"agents",kind:"stream",returnType:"Record<string, unknown>"});return n.filter(o=>!s.has(o.exportName))},F=(t,e)=>{if(t.length===0)return[];const s=new Set(e.filter(n=>g(n.filePath)==="mutators").map(n=>n.exportName));return t.filter(n=>!s.has(n.exportName)).map(n=>({args:n.args,exportName:n.exportName,filePath:n.filePath,kind:"mutation",returnType:n.returnType}))},W=t=>{const e=t.flatMap(o=>o.channel?.kind==="room"?[o.channel.name]:[]);if(e.length===0)return{block:"",importLine:""};const s=e.map(o=>` ${m(o)}: RoomRef<LunoraRoomMessages[${JSON.stringify(o)}]>;`).join(`
43
+ `,lines:' "sandbox:invoke": lunoraSandbox.invoke as unknown as RegisteredLunoraFunction,',prelude:"\n/**\n * The `@lunora/agent` sandbox dispatcher — auto-registered because `lunora/`\n * imports a sandbox tool (`browserTool`/`containerTool`). The batteries-included\n * tools dispatch to this internal action, which runs on an action ctx carrying\n * `ctx.browser` + `ctx.containers` (the durable tool step itself has neither).\n */\nconst lunoraSandbox = sandboxComponent();\n"}},E=(t,e)=>{if(t.length===0)return[];const s=v(e),n=[{args:{key:{kind:"string"},limit:{inner:{kind:"number"},kind:"optional"}},exportName:"agentMessages",filePath:"agents",kind:"query",returnType:"Record<string, unknown>[]"},{args:{limit:{inner:{kind:"number"},kind:"optional"}},exportName:"agentPendingApprovals",filePath:"agents",kind:"query",returnType:"Record<string, unknown>[]"},{args:{approvalSlot:{kind:"string"},decision:{kind:"union",members:[{kind:"literal",literalValue:'"approve"'},{kind:"literal",literalValue:'"approve_for_thread"'},{kind:"literal",literalValue:'"reject"'}]},instanceId:{kind:"string"},note:{inner:{kind:"string"},kind:"optional"},threadKey:{kind:"string"},toolCallId:{kind:"string"}},exportName:"agentResolveApproval",filePath:"agents",kind:"mutation",returnType:"{ resolved: boolean }"},{args:{secret:{kind:"string",sensitive:!0},threadKey:{kind:"string"},toolCallId:{kind:"string"}},exportName:"agentSupplySecret",filePath:"agents",kind:"mutation",returnType:"{ resolved: boolean }"},{args:{threadKey:{kind:"string"},toolCallId:{kind:"string"}},exportName:"agentDeclineSecret",filePath:"agents",kind:"mutation",returnType:"{ resolved: boolean }"},{args:{threadKey:{kind:"string"}},exportName:"agentSecretRequests",filePath:"agents",kind:"query",returnType:'{ createdAt: number; expiresAt: number; label?: string; status: "consumed" | "declined" | "expired" | "pending" | "supplied"; toolCallId: string; toolName: string }[]'},{args:{key:{kind:"string"}},exportName:"agentApprovalGrants",filePath:"agents",kind:"query",returnType:"{ createdAt: number; toolName: string }[]"},{args:{threadKey:{kind:"string"},toolName:{kind:"string"}},exportName:"agentRevokeApprovalGrant",filePath:"agents",kind:"mutation",returnType:"{ revoked: boolean }"},{args:{agent:{kind:"string"},input:{kind:"string"},threadKey:{kind:"string"},title:{inner:{kind:"string"},kind:"optional"}},exportName:"agentRun",filePath:"agents",kind:"mutation",returnType:"{ id: string; threadKey: string }"},{args:{key:{kind:"string"}},exportName:"agentState",filePath:"agents",kind:"query",returnType:"Record<string, unknown> | undefined"},{args:{key:{kind:"string"}},exportName:"agentThread",filePath:"agents",kind:"query",returnType:"Record<string, unknown> | undefined"}];for(const o of t)o.voice&&n.push({args:{threadKey:{kind:"string"}},exportName:`${o.exportName}Voice`,filePath:"agents",kind:"stream",returnType:"Record<string, unknown>"});return n.filter(o=>!s.has(o.exportName))},F=(t,e)=>{if(t.length===0)return[];const s=new Set(e.filter(n=>g(n.filePath)==="mutators").map(n=>n.exportName));return t.filter(n=>!s.has(n.exportName)).map(n=>({args:n.args,exportName:n.exportName,filePath:n.filePath,kind:"mutation",returnType:n.returnType}))},W=t=>{const e=t.flatMap(o=>o.channel?.kind==="room"?[o.channel.name]:[]);if(e.length===0)return{block:"",importLine:""};const s=e.map(o=>` ${m(o)}: RoomRef<LunoraRoomMessages[${JSON.stringify(o)}]>;`).join(`
44
44
  `),n=e.map(o=>` ${m(o)}: { name: ${JSON.stringify(o)} },`).join(`
45
45
  `);return{block:`
46
46
  /** This project's \`defineRoom\` rooms, addressable as typed references for \`client.connectRoom\`. */
@@ -1,11 +1,11 @@
1
- import{APP_METHOD_CAPABILITIES as L}from"./CAPABILITY_PROBES-DCzOjTN7.mjs";import{i as $}from"./schema-BgM8A3XV.mjs";import{a as j,I as G,G as w}from"./shared-Cn7dMQ_u.mjs";const P={configKey:"vectors",doc:"Wire the Vectorize index map backing `ctx.vectors`.",method:"vectors"},k=e=>[...L.filter(({key:t})=>e.capabilities.has(t)).map(({appMethod:t})=>t),...e.hasVectors?[P]:[]],S=e=>k(e).length>0,E=e=>(e.emailAgents?.length??0)>0,c=e=>e.tables.some(t=>$(t)),p=e=>e.liveStreams===!0&&(e.liveStreamDeclarations?.length??0)>0,_=e=>e.hasScheduler?`
1
+ import{APP_METHOD_CAPABILITIES as L}from"./CAPABILITY_PROBES-DCzOjTN7.mjs";import{i as $}from"./schema-BgM8A3XV.mjs";import{a as j,I as G,G as w}from"./shared-Cn7dMQ_u.mjs";const P={configKey:"vectors",doc:"Wire the Vectorize index map backing `ctx.vectors`.",method:"vectors"},k=e=>[...L.filter(({key:t})=>e.capabilities.has(t)).map(({appMethod:t})=>t),...e.hasVectors?[P]:[]],S=e=>k(e).length>0,E=e=>(e.emailAgents?.length??0)>0,c=e=>e.tables.some(t=>$(t)),p=e=>e.liveStreams===!0&&(e.liveStreamDeclarations?.length??0)>0,W=e=>e.hasScheduler?`
2
2
  /** Resolve the \`SchedulerDO\`-backed scheduler for this env; \`undefined\` until the namespace is wired. */
3
3
  private resolveScheduler(env: Env): ReturnType<typeof createScheduler> | undefined {
4
4
  const namespace = this.schedulerDeclaration?.namespace(env);
5
5
 
6
6
  return namespace ? createScheduler({${e.jurisdiction?` jurisdiction: ${JSON.stringify(e.jurisdiction)},`:""} namespace }) : undefined;
7
7
  }
8
- `:"",M=e=>e?`
8
+ `:"",_=e=>e?`
9
9
  /**
10
10
  * One bucket's \`Storage\`, signing under the name it is registered as.
11
11
  *
@@ -115,7 +115,7 @@ import{APP_METHOD_CAPABILITIES as L}from"./CAPABILITY_PROBES-DCzOjTN7.mjs";impor
115
115
  storageUpload: (key: string, body: ArrayBuffer, opts?: { bucket?: string; contentType?: string; customMetadata?: Record<string, string>; sha256?: string }) => pick(opts?.bucket).upload(key, body, opts),
116
116
  };
117
117
  }
118
- `:"",W=e=>e?`
118
+ `:"",M=e=>e?`
119
119
  /**
120
120
  * Adapt the raw D1 binding to \`@lunora/d1\`'s \`D1Exec\` (reads via \`all\`, writes via \`run\`, and — when the binding exposes it — several writes in one round trip via \`batch\`).
121
121
  *
@@ -730,7 +730,7 @@ ${D(e).join(`
730
730
  }`,...e.hasAuth?[` // Captured before the branch so the narrowing survives — reading
731
731
  // \`this.authDeclaration.namespace\` again below would be optional all over again.
732
732
  const authDeclaration = this.authDeclaration;
733
- const { authCredentialColumns, authCredentialTableNames, authDiscoveryPathsFor, authTableNames, createAuthAdmin, createAuthAuditReader, createDoAuthWiring, createSqlAuthDataPort, d1Executor, effectiveCookieCache, handleAuthDiscoveryRequest, handleAuthRequest, resolveSessionIdentity } = deferred.auth;
733
+ const { authCredentialColumns, authCredentialTableNames, authDiscoveryPathsFor, authTableNames, createAuthAdmin, createAuthAuditReader, createAuthAuditWriter, createDoAuthWiring, createSqlAuthDataPort, d1Executor, effectiveCookieCache, handleAuthDiscoveryRequest, handleAuthRequest, resolveSessionIdentity } = deferred.auth;
734
734
  const authNamespace = authDeclaration?.namespace;
735
735
  const authD1 = authDeclaration?.d1;
736
736
 
@@ -803,7 +803,13 @@ ${D(e).join(`
803
803
  if (authInstance) {
804
804
  options.authAdmin = createAuthAdmin(authInstance);
805
805
  }
806
- options.authAuditReader = createAuthAuditReader(d1Executor(authD1(env) as never));
806
+ // One executor for both: the audit table's provisioning is memoised per executor object.
807
+ const authAuditExecutor = d1Executor(authD1(env) as never);
808
+
809
+ options.authAuditReader = createAuthAuditReader(authAuditExecutor);
810
+ // \`authAdmin\` writes the auth tables directly, past the audit hook; its routes record through this,
811
+ // with the hook's own retention and \`onRecord\`, found through the instance.
812
+ options.authAuditWriter = createAuthAuditWriter(authAuditExecutor, authInstance);
807
813
  // better-auth's tables for the admin export / import (\`$auth\`). A table the
808
814
  // schema declares (\`authTables(...)\`) already travels as a \`.global()\` row.
809
815
  options.authData = authInstance
@@ -938,7 +944,7 @@ const loadDeferredModules = (): Promise<DeferredModules> =>
938
944
  await ensureAuth(rawEnv as Env);`:"";return e?{ensureAuthCall:a,ensureRawAuthCall:s,eventWorker:"target",eventWorkerLine:`
939
945
  const target = (await authReady(rawEnv as Env)) ? (worker ??= ${r}) : ${r};`}:{ensureAuthCall:a,ensureRawAuthCall:s,eventWorker:"worker",eventWorkerLine:`
940
946
  worker ??= ${r};`}},we=e=>A(e)?{asyncIfDeferred:"async ",deferredArgument:", deferred",deferredParameter:", deferred: DeferredModules",loadDeferredLine:`
941
- const deferred = await loadDeferredModules();`}:{asyncIfDeferred:"",deferredArgument:"",deferredParameter:"",loadDeferredLine:""},xe=e=>e?`${w}export { authCredentialColumns, authCredentialTableNames, authDiscoveryPathsFor, authTableNames, createAuth, createAuthAdmin, createAuthAuditReader, createDoAuthWiring, createSqlAuthDataPort, d1Executor, effectiveCookieCache, handleAuthDiscoveryRequest, handleAuthRequest, lunoraD1Adapter, resolveSessionIdentity } from "@lunora/auth/worker";
947
+ const deferred = await loadDeferredModules();`}:{asyncIfDeferred:"",deferredArgument:"",deferredParameter:"",loadDeferredLine:""},xe=e=>e?`${w}export { authCredentialColumns, authCredentialTableNames, authDiscoveryPathsFor, authTableNames, createAuth, createAuthAdmin, createAuthAuditReader, createAuthAuditWriter, createDoAuthWiring, createSqlAuthDataPort, d1Executor, effectiveCookieCache, handleAuthDiscoveryRequest, handleAuthRequest, lunoraD1Adapter, resolveSessionIdentity } from "@lunora/auth/worker";
942
948
  `:"",ke=e=>{const t=e.emailAgents??[];if(t.length===0)return"";const r=a=>t.map(s=>`${a}{ agent: lunoraAgentDefinitions.${s.exportName}, className: ${JSON.stringify(s.className)} },`).join(`
943
949
  `);return e.lazyFunctions!==!0?` composed.email = dispatchAgentEmail([
944
950
  ${r(" ")}
@@ -1137,7 +1143,7 @@ ${r.hasFramework?`
1137
1143
  `:""}
1138
1144
  return composed;
1139
1145
  }
1140
- ${_(r)}${M(r.hasStorage)}
1146
+ ${W(r)}${_(r.hasStorage)}
1141
1147
  /** Fan the recorded declarations into the worker-side \`createWorker\` options. */
1142
1148
  private buildWorkerOptions(env: Env, ${O}): WorkerOptions {
1143
1149
  const options: WorkerOptions = {
@@ -1162,7 +1168,7 @@ ${r.securityHeaders===void 0?"":"\n // `security.headers` from lunora.con
1162
1168
  return options;
1163
1169
  }
1164
1170
  }
1165
- ${W(r.hasGlobal)}
1171
+ ${M(r.hasGlobal)}
1166
1172
  /**
1167
1173
  * Shape of the project's root \`lunora.config.*\`.
1168
1174
  *
@@ -1,4 +1,4 @@
1
- import{LunoraError as L}from"@lunora/errors";import{L as pe,i as ge,G as U,d as J,I as F,s as fe,b as C,r as ye,c as $e}from"./shared-Cn7dMQ_u.mjs";import{v as we}from"./parse-validator-BisfC8bR.mjs";import{renderAgentFunctionRegistry as be,renderSandboxFunctionRegistry as Re}from"./emitApi-lwadq5G7.mjs";import{b as ke,a as Ne,r as j,c as ve}from"./qualifiers-qqH8fRTo.mjs";import{s as g}from"./dispatch-namespace-DwTjD7BU.mjs";const Oe=new Set(["any","bigint","boolean","date","id","null","number","storage","string","timestamp"]),B=t=>t.column!==void 0,Se=(t,r)=>{switch(t){case"bigint":return`if (typeof ${r} !== "bigint") return DEFER;
1
+ import{LunoraError as L}from"@lunora/errors";import{L as pe,i as ge,G as U,d as J,I as F,s as fe,b as C,r as ye,c as $e}from"./shared-Cn7dMQ_u.mjs";import{v as we}from"./parse-validator-BisfC8bR.mjs";import{renderAgentFunctionRegistry as be,renderSandboxFunctionRegistry as Re}from"./emitApi-GMinxDEt.mjs";import{b as ke,a as Ne,r as j,c as ve}from"./qualifiers-qqH8fRTo.mjs";import{s as g}from"./dispatch-namespace-DwTjD7BU.mjs";const Oe=new Set(["any","bigint","boolean","date","id","null","number","storage","string","timestamp"]),B=t=>t.column!==void 0,Se=(t,r)=>{switch(t){case"bigint":return`if (typeof ${r} !== "bigint") return DEFER;
2
2
  `;case"boolean":return`if (typeof ${r} !== "boolean") return DEFER;
3
3
  `;case"date":case"number":case"timestamp":return`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return DEFER;
4
4
  `;case"null":return`if (${r} !== null) return DEFER;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/codegen",
3
- "version": "1.0.0-alpha.432",
3
+ "version": "1.0.0-alpha.434",
4
4
  "description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@lunora/advisor": "^1.0.0-alpha.295",
54
- "@lunora/agent": "^1.0.0-alpha.284",
54
+ "@lunora/agent": "^1.0.0-alpha.286",
55
55
  "@lunora/container": "1.0.0-alpha.108",
56
56
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
57
57
  "@lunora/platform": "^1.0.0-alpha.83",