@lunora/config 1.0.0-alpha.404 → 1.0.0-alpha.406
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/cli/index.d.mts +2 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.mjs +1 -1
- package/dist/cloudflare/index.d.mts +5 -97
- package/dist/cloudflare/index.d.ts +5 -97
- package/dist/cloudflare/index.mjs +1 -1
- package/dist/index.d.mts +67 -6
- package/dist/index.d.ts +67 -6
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/D1_PLACEHOLDER_ID-BpUWE6_j.mjs +1 -0
- package/dist/packem_shared/{DEFAULT_DEPLOY_TARGET-CnovxJid.mjs → DEFAULT_DEPLOY_TARGET-T8UHP3bB.mjs} +1 -1
- package/dist/packem_shared/{DEV_WORKER_ENV_VALUE-CARjGoAv.mjs → DEV_WORKER_ENV_VALUE-Dx-b7eJB.mjs} +1 -1
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-CccA2ip9.mjs +1 -0
- package/dist/packem_shared/{POLICY_SCAFFOLD_ENDPOINT-BISd53nh.mjs → POLICY_SCAFFOLD_ENDPOINT-BLMGCD5t.mjs} +1 -1
- package/dist/packem_shared/{SCHEMA_EDIT_ENDPOINT-B-Xii8Ke.mjs → SCHEMA_EDIT_ENDPOINT-DrPTyuPd.mjs} +1 -1
- package/dist/packem_shared/{STUDIO_PATH-rjtY7n7Q.mjs → STUDIO_PATH-CttpqT9E.mjs} +1 -1
- package/dist/packem_shared/{assertBuildTargetMatches-Bw7uURKp.mjs → assertBuildTargetMatches-CJI4jNxP.mjs} +1 -1
- package/dist/packem_shared/buildPackageSecretsBlock-Cb5Ze3_1.mjs +19 -0
- package/dist/packem_shared/celld-config-DeMDgYAu.mjs +3 -0
- package/dist/packem_shared/{deploy-driver.d-Cl96-c1l.d.mts → deploy-driver.d-DraUd2R2.d.mts} +2 -0
- package/dist/packem_shared/{deploy-driver.d-Cl96-c1l.d.ts → deploy-driver.d-DraUd2R2.d.ts} +2 -0
- package/dist/packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs +7 -0
- package/dist/packem_shared/{index.d-DkNi7r6E.d.mts → index.d-DSqsbmlq.d.mts} +1 -1
- package/dist/packem_shared/{index.d-Cmx4jMFV.d.ts → index.d-sZ22Dkwr.d.ts} +1 -1
- package/dist/packem_shared/inferLunoraBindings-BHztYpw9.mjs +1 -0
- package/dist/packem_shared/package-secrets-registry-Cx0qpPjB.mjs +1 -0
- package/dist/packem_shared/probeCelldToolchain-DxDttfHy.mjs +1 -0
- package/dist/packem_shared/reconcile-bindings-B3bPJPeQ.mjs +2 -0
- package/dist/packem_shared/{infer-bindings.d-C9ktoVW4.d.ts → reconcile-bindings.d-LHrpR4kY.d.mts} +103 -1
- package/dist/packem_shared/{infer-bindings.d-C9ktoVW4.d.mts → reconcile-bindings.d-LHrpR4kY.d.ts} +103 -1
- package/dist/packem_shared/reconcileBindingsSafely-Br0hhKmd.mjs +1 -0
- package/dist/packem_shared/{scanWranglerVariablesForSecrets-CZDS9y2i.mjs → scanWranglerVariablesForSecrets-DXuYZNqq.mjs} +1 -1
- package/dist/packem_shared/startCelldDevSession-BI3x-_-q.mjs +1 -0
- package/dist/packem_shared/{wranglerCodegenInputs-UqO5e_qJ.mjs → wranglerCodegenInputs-7WopgQo4.mjs} +1 -1
- package/dist/packem_shared/{write-atomic-nFihpdk8.mjs → write-atomic-DSo8BGHA.mjs} +1 -1
- package/dist/studio-host/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/packem_shared/HYPERDRIVE_PLACEHOLDER_ID-DPgHQEDf.mjs +0 -2
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-DI99PpTL.mjs +0 -1
- package/dist/packem_shared/buildPackageSecretsBlock-C5WZfMwe.mjs +0 -19
- package/dist/packem_shared/celld-config-Iv0tK526.mjs +0 -3
- package/dist/packem_shared/inferLunoraBindings-DMvPygeU.mjs +0 -1
- package/dist/packem_shared/package-secrets-registry-BEJELdls.mjs +0 -1
- package/dist/packem_shared/reconcileBindingsSafely-xWmrGHnx.mjs +0 -1
- package/dist/packem_shared/startCelldDevSession-PHdbwtI5.mjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-pqFMJBtJ.mjs";import{AGENT_RULES_DIR as i,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as _,LUNORA_SKILL_NAMES as c,ROOT_SKILL_NAME as p,claimAgentRulesHint as l,detectAgentRules as D}from"./packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs";import{clearApiSpecMarker as A,readApiSpecMarker as S,writeApiSpecMarker as m}from"./packem_shared/clearApiSpecMarker-DMGpP41V.mjs";import{MissingBuildOutputError as f}from"./packem_shared/MissingBuildOutputError-BAyekzof.mjs";import{default as T}from"./packem_shared/canonicalPath-DrfMiT3U.mjs";import{startCelldDevSession as v}from"./packem_shared/startCelldDevSession-PHdbwtI5.mjs";import{BUILD_ROOT_ENV as g,BUILD_TARGET_ENV as V,BUNDLE_META_PATH_ENV as I,CODEGEN_ENV as u,DEFAULT_BUNDLE_META_PATH as O,LAZY_FUNCTIONS_ENV as P,STRICT_ADVISORIES_ENV as M,isCodegenDisabled as U,isLazyFunctionsEnabled as F,resolveLazyFunctions as C}from"./packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{discoverContainerInfo as G}from"./packem_shared/discoverContainerInfo-DzXr7Vm3.mjs";import{streamContainerLogs as y}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as h,projectUsesUmbrella as j}from"./packem_shared/detectFramework-Dfpvu6rD.mjs";import{acceptsConnection as K,startDevProcess as H}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as Y,DEV_DAEMON_ENV as J,DEV_HANDOFF_ENV as z,DEV_LOG_FILE as q,DEV_LOG_FILE_ENV as X,DEV_STATE_DIR as Z,DEV_STATE_FILE as Q,claimDevServerState as $,clearDevServerState as ee,isDevServerReady as re,isProcessAlive as oe,isRecordedProcessCurrent as te,readDevServerState as ae,readLiveDevServerState as Ee,updateDevServerState as se,writeDevServerState as ie}from"./packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs";import{DEV_VARS_EXAMPLE_FILE as _e,DEV_VARS_FILE as ce,DEV_VARS_KEY_PATTERN as pe,escapeRegExp as le,parseDevVariableEntries as De,removeDevVariableLine as de,upsertDevVariableLine as Ae}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEV_WORKER_ENV_VALUE as me,DEV_WORKER_ENV_VAR as Le,ensureDevWorkerEnv as fe}from"./packem_shared/DEV_WORKER_ENV_VALUE-CARjGoAv.mjs";import{createDiscoveryCache as Te}from"./packem_shared/createDiscoveryCache-npJI4uej.mjs";import{DEFAULT_DEPLOY_TARGET as ve,deployTargetIds as xe,isRunnableTarget as ge,planToolchainInvocation as Ve,resolveDeployDriver as Ie,runnableTargetIds as ue,targetRunsOwnDevServer as Oe}from"./packem_shared/DEFAULT_DEPLOY_TARGET-CnovxJid.mjs";import{inferLunoraBindings as Me,secretSourcesFromBindings as Ue}from"./packem_shared/inferLunoraBindings-DMvPygeU.mjs";import{LINKED_PROJECT_DIR as Ce,LINKED_PROJECT_FILE as Be,readLinkedProject as Ge,writeLinkedProject as be}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as ke,applyLintIgnores as he,detectLintTools as je}from"./packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs";import{blockingFindingsMessage as Ke,reportCodegenFindings as He}from"./packem_shared/blockingFindingsMessage-CRbg1sla.mjs";import{LUNORA_EVENT_SOURCE as Ye,formatLunoraEvent as Je}from"./packem_shared/LUNORA_EVENT_SOURCE-B9ZVohjO.mjs";import{LUNORA_TAG as qe,advisoryLine as Xe,lunoraLine as Ze}from"./packem_shared/LUNORA_TAG-DQTGPqcJ.mjs";import{default as $e}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as rr,detectInstalledManagers as or,detectPackageManager as tr,execArgsFor as ar,installArgsFor as Er,runScriptArgsFor as sr,runScriptCommand as ir,toolchainExecArgs as nr}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{P as cr,s as pr}from"./packem_shared/package-secrets-registry-BEJELdls.mjs";import{runPostCodegenHook as Dr}from"./packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs";import{assertBuildTargetMatches as Ar,interpretRemote as Sr,readProjectRemotePreference as mr,readProjectTarget as Lr,resolveProjectTarget as fr,resolveTargetOrThrow as Nr}from"./packem_shared/assertBuildTargetMatches-Bw7uURKp.mjs";import{readProjectDependencies as Rr,readProjectDependencyNames as vr,readProjectManifest as xr}from"./packem_shared/readProjectDependencies-l3uhUKjo.mjs";import{createConfirm as Vr,isInteractive as Ir,promptMultiSelect as ur,promptSelect as Or,promptText as Pr,promptYesNo as Mr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{default as Fr}from"./packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs";import{buildPackageSecretsBlock as Br,ensureDevVariables as Gr,ensureDevVarsExample as br,fillDevSecrets as yr,generateSecretValue as kr,isMintableSecretKey as hr,isPlaceholderValue as jr,planDevSecretsFill as wr,planDevVariablesAugment as Kr,planDevVariablesScaffold as Hr,requiredSecrets as Wr,writeDevVariablesFileAtomically as Yr}from"./packem_shared/buildPackageSecretsBlock-C5WZfMwe.mjs";import{applyAdditiveEdit as zr,classifyEdit as qr}from"./packem_shared/applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as Zr}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as $r,resolveServerModule as eo,scaffoldPolicyFile as ro,wireRlsIntoProcedure as oo}from"./packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs";import{discoverSchemaInfo as ao}from"./packem_shared/discoverSchemaInfo-BBRlXZop.mjs";import{ACCENT as so,BADGES as io,BADGE_COLUMN_WIDTH as no,LUNA_ART as _o,LUNA_BUNNY as co,LUNA_NAME as po,LUNA_SIGNOFF as lo,STEP_BADGE_NAMES as Do,badgeLead as Ao,badgeWidth as So,padBadge as mo,paintAnswer as Lo,paintBadge as fo}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as To,DURABLE_OBJECT_BINDINGS as Ro,GENERATED_CLASS_MODULES as vo,GENERATED_MODULE_DURABLE_OBJECTS as xo,MERGED_DURABLE_OBJECTS_MODULE as go,isMergedProject as Vo,isMergedRoleModule as Io}from"./packem_shared/COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as Oo}from"./packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs";export{so as ACCENT,o as AGENT_MODE_ENV,i as AGENT_RULES_DIR,n as AGENT_RULES_HINT,_ as AGENT_RULES_HINT_ENV,io as BADGES,no as BADGE_COLUMN_WIDTH,g as BUILD_ROOT_ENV,V as BUILD_TARGET_ENV,I as BUNDLE_META_PATH_ENV,u as CODEGEN_ENV,To as COMPOSED_WORKER_ENTRY,O as DEFAULT_BUNDLE_META_PATH,ve as DEFAULT_DEPLOY_TARGET,Y as DEV_BINDINGS_FILE,J as DEV_DAEMON_ENV,z as DEV_HANDOFF_ENV,q as DEV_LOG_FILE,X as DEV_LOG_FILE_ENV,Z as DEV_STATE_DIR,Q as DEV_STATE_FILE,_e as DEV_VARS_EXAMPLE_FILE,ce as DEV_VARS_FILE,pe as DEV_VARS_KEY_PATTERN,me as DEV_WORKER_ENV_VALUE,Le as DEV_WORKER_ENV_VAR,Ro as DURABLE_OBJECT_BINDINGS,vo as GENERATED_CLASS_MODULES,xo as GENERATED_MODULE_DURABLE_OBJECTS,P as LAZY_FUNCTIONS_ENV,Ce as LINKED_PROJECT_DIR,Be as LINKED_PROJECT_FILE,_o as LUNA_ART,co as LUNA_BUNNY,po as LUNA_NAME,lo as LUNA_SIGNOFF,Ye as LUNORA_EVENT_SOURCE,ke as LUNORA_IGNORED_PATHS,c as LUNORA_SKILL_NAMES,qe as LUNORA_TAG,$e as LunoraReporter,go as MERGED_DURABLE_OBJECTS_MODULE,f as MissingBuildOutputError,cr as PACKAGE_SECRETS_REGISTRY,p as ROOT_SKILL_NAME,Do as STEP_BADGE_NAMES,M as STRICT_ADVISORIES_ENV,K as acceptsConnection,rr as addArgsFor,Xe as advisoryLine,zr as applyAdditiveEdit,he as applyLintIgnores,Ar as assertBuildTargetMatches,Ao as badgeLead,So as badgeWidth,Ke as blockingFindingsMessage,Br as buildPackageSecretsBlock,T as canonicalPath,l as claimAgentRulesHint,$ as claimDevServerState,qr as classifyEdit,$r as classifyPolicyEdit,A as clearApiSpecMarker,ee as clearDevServerState,Vr as createConfirm,Te as createDiscoveryCache,xe as deployTargetIds,D as detectAgentRules,t as detectAiAgent,h as detectFramework,or as detectInstalledManagers,je as detectLintTools,tr as detectPackageManager,E as discoverAgentInfo,G as discoverContainerInfo,ao as discoverSchemaInfo,Oo as discoverWorkflowInfo,Gr as ensureDevVariables,br as ensureDevVarsExample,fe as ensureDevWorkerEnv,le as escapeRegExp,ar as execArgsFor,yr as fillDevSecrets,Je as formatLunoraEvent,kr as generateSecretValue,Me as inferLunoraBindings,Er as installArgsFor,Sr as interpretRemote,U as isCodegenDisabled,re as isDevServerReady,Ir as isInteractive,F as isLazyFunctionsEnabled,Vo as isMergedProject,Io as isMergedRoleModule,hr as isMintableSecretKey,jr as isPlaceholderValue,oe as isProcessAlive,te as isRecordedProcessCurrent,ge as isRunnableTarget,Ze as lunoraLine,mo as padBadge,Lo as paintAnswer,fo as paintBadge,De as parseDevVariableEntries,Zr as parseSchema,wr as planDevSecretsFill,Kr as planDevVariablesAugment,Hr as planDevVariablesScaffold,Ve as planToolchainInvocation,j as projectUsesUmbrella,ur as promptMultiSelect,Or as promptSelect,Pr as promptText,Mr as promptYesNo,S as readApiSpecMarker,ae as readDevServerState,Ge as readLinkedProject,Ee as readLiveDevServerState,Rr as readProjectDependencies,vr as readProjectDependencyNames,xr as readProjectManifest,mr as readProjectRemotePreference,Lr as readProjectTarget,de as removeDevVariableLine,He as reportCodegenFindings,Wr as requiredSecrets,Ie as resolveDeployDriver,C as resolveLazyFunctions,fr as resolveProjectTarget,Fr as resolveSchemaDirectory,eo as resolveServerModule,Nr as resolveTargetOrThrow,Dr as runPostCodegenHook,sr as runScriptArgsFor,ir as runScriptCommand,ue as runnableTargetIds,ro as scaffoldPolicyFile,Ue as secretSourcesFromBindings,pr as secretsForPackages,v as startCelldDevSession,H as startDevProcess,y as streamContainerLogs,Oe as targetRunsOwnDevServer,nr as toolchainExecArgs,se as updateDevServerState,Ae as upsertDevVariableLine,oo as wireRlsIntoProcedure,m as writeApiSpecMarker,ie as writeDevServerState,Yr as writeDevVariablesFileAtomically,be as writeLinkedProject};
|
|
1
|
+
import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-pqFMJBtJ.mjs";import{AGENT_RULES_DIR as i,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as _,LUNORA_SKILL_NAMES as l,ROOT_SKILL_NAME as c,claimAgentRulesHint as p,detectAgentRules as D}from"./packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs";import{clearApiSpecMarker as A,readApiSpecMarker as m,writeApiSpecMarker as S}from"./packem_shared/clearApiSpecMarker-DMGpP41V.mjs";import{MissingBuildOutputError as L}from"./packem_shared/MissingBuildOutputError-BAyekzof.mjs";import{default as T}from"./packem_shared/canonicalPath-DrfMiT3U.mjs";import{probeCelldToolchain as v}from"./packem_shared/probeCelldToolchain-DxDttfHy.mjs";import{startCelldDevSession as g,writeCelldDevProjection as I}from"./packem_shared/startCelldDevSession-BI3x-_-q.mjs";import{D as u}from"./packem_shared/reconcile-bindings-B3bPJPeQ.mjs";import{BUILD_ROOT_ENV as P,BUILD_TARGET_ENV as C,BUNDLE_META_PATH_ENV as M,CODEGEN_ENV as U,DEFAULT_BUNDLE_META_PATH as F,LAZY_FUNCTIONS_ENV as B,STRICT_ADVISORIES_ENV as G,isCodegenDisabled as b,isLazyFunctionsEnabled as y,resolveLazyFunctions as k}from"./packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{discoverContainerInfo as j}from"./packem_shared/discoverContainerInfo-DzXr7Vm3.mjs";import{streamContainerLogs as K}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as W,projectUsesUmbrella as Y}from"./packem_shared/detectFramework-Dfpvu6rD.mjs";import{acceptsConnection as z,startDevProcess as q}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as Z,DEV_DAEMON_ENV as Q,DEV_HANDOFF_ENV as $,DEV_LOG_FILE as ee,DEV_LOG_FILE_ENV as re,DEV_STATE_DIR as oe,DEV_STATE_FILE as te,claimDevServerState as ae,clearDevServerState as Ee,isDevServerReady as se,isProcessAlive as ie,isRecordedProcessCurrent as ne,readDevServerState as _e,readLiveDevServerState as le,updateDevServerState as ce,writeDevServerState as pe}from"./packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs";import{DEV_VARS_EXAMPLE_FILE as de,DEV_VARS_FILE as Ae,DEV_VARS_KEY_PATTERN as me,escapeRegExp as Se,parseDevVariableEntries as fe,removeDevVariableLine as Le,upsertDevVariableLine as Ne}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEV_WORKER_ENV_VALUE as Re,DEV_WORKER_ENV_VAR as ve,ensureDevWorkerEnv as xe}from"./packem_shared/DEV_WORKER_ENV_VALUE-Dx-b7eJB.mjs";import{createDiscoveryCache as Ie}from"./packem_shared/createDiscoveryCache-npJI4uej.mjs";import{DEFAULT_DEPLOY_TARGET as ue,deployTargetIds as Oe,isRunnableTarget as Pe,planToolchainInvocation as Ce,resolveDeployDriver as Me,runnableTargetIds as Ue,targetRunsOwnDevServer as Fe}from"./packem_shared/DEFAULT_DEPLOY_TARGET-T8UHP3bB.mjs";import{default as Ge}from"./packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs";import{inferLunoraBindings as ye,secretSourcesFromBindings as ke}from"./packem_shared/inferLunoraBindings-BHztYpw9.mjs";import{LINKED_PROJECT_DIR as je,LINKED_PROJECT_FILE as we,readLinkedProject as Ke,writeLinkedProject as He}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as Ye,applyLintIgnores as Je,detectLintTools as ze}from"./packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs";import{blockingFindingsMessage as Xe,reportCodegenFindings as Ze}from"./packem_shared/blockingFindingsMessage-CRbg1sla.mjs";import{LUNORA_EVENT_SOURCE as $e,formatLunoraEvent as er}from"./packem_shared/LUNORA_EVENT_SOURCE-B9ZVohjO.mjs";import{LUNORA_TAG as or,advisoryLine as tr,lunoraLine as ar}from"./packem_shared/LUNORA_TAG-DQTGPqcJ.mjs";import{default as sr}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as nr,detectInstalledManagers as _r,detectPackageManager as lr,execArgsFor as cr,installArgsFor as pr,runScriptArgsFor as Dr,runScriptCommand as dr,toolchainExecArgs as Ar}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{P as Sr,m as fr,s as Lr}from"./packem_shared/package-secrets-registry-Cx0qpPjB.mjs";import{runPostCodegenHook as Tr}from"./packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs";import{assertBuildTargetMatches as vr,interpretRemote as xr,readProjectRemotePreference as gr,readProjectTarget as Ir,resolveProjectTarget as Vr,resolveTargetOrThrow as ur}from"./packem_shared/assertBuildTargetMatches-CJI4jNxP.mjs";import{readProjectDependencies as Pr,readProjectDependencyNames as Cr,readProjectManifest as Mr}from"./packem_shared/readProjectDependencies-l3uhUKjo.mjs";import{createConfirm as Fr,isInteractive as Br,promptMultiSelect as Gr,promptSelect as br,promptText as yr,promptYesNo as kr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{default as jr}from"./packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs";import{buildPackageSecretsBlock as Kr,ensureDevVariables as Hr,ensureDevVarsExample as Wr,fillDevSecrets as Yr,generateSecretValue as Jr,isMintableSecretKey as zr,isPlaceholderValue as qr,planDevSecretsFill as Xr,planDevVariablesAugment as Zr,planDevVariablesScaffold as Qr,requiredSecrets as $r,writeDevVariablesFileAtomically as eo}from"./packem_shared/buildPackageSecretsBlock-Cb5Ze3_1.mjs";import{applyAdditiveEdit as oo,classifyEdit as to}from"./packem_shared/applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as Eo}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as io,resolveServerModule as no,scaffoldPolicyFile as _o,wireRlsIntoProcedure as lo}from"./packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs";import{discoverSchemaInfo as po}from"./packem_shared/discoverSchemaInfo-BBRlXZop.mjs";import{ACCENT as Ao,BADGES as mo,BADGE_COLUMN_WIDTH as So,LUNA_ART as fo,LUNA_BUNNY as Lo,LUNA_NAME as No,LUNA_SIGNOFF as To,STEP_BADGE_NAMES as Ro,badgeLead as vo,badgeWidth as xo,padBadge as go,paintAnswer as Io,paintBadge as Vo}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as Oo,DURABLE_OBJECT_BINDINGS as Po,GENERATED_CLASS_MODULES as Co,GENERATED_MODULE_DURABLE_OBJECTS as Mo,MERGED_DURABLE_OBJECTS_MODULE as Uo,isMergedProject as Fo,isMergedRoleModule as Bo}from"./packem_shared/COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as bo}from"./packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs";export{Ao as ACCENT,o as AGENT_MODE_ENV,i as AGENT_RULES_DIR,n as AGENT_RULES_HINT,_ as AGENT_RULES_HINT_ENV,mo as BADGES,So as BADGE_COLUMN_WIDTH,P as BUILD_ROOT_ENV,C as BUILD_TARGET_ENV,M as BUNDLE_META_PATH_ENV,U as CODEGEN_ENV,Oo as COMPOSED_WORKER_ENTRY,u as D1_PLACEHOLDER_ID,F as DEFAULT_BUNDLE_META_PATH,ue as DEFAULT_DEPLOY_TARGET,Z as DEV_BINDINGS_FILE,Q as DEV_DAEMON_ENV,$ as DEV_HANDOFF_ENV,ee as DEV_LOG_FILE,re as DEV_LOG_FILE_ENV,oe as DEV_STATE_DIR,te as DEV_STATE_FILE,de as DEV_VARS_EXAMPLE_FILE,Ae as DEV_VARS_FILE,me as DEV_VARS_KEY_PATTERN,Re as DEV_WORKER_ENV_VALUE,ve as DEV_WORKER_ENV_VAR,Po as DURABLE_OBJECT_BINDINGS,Co as GENERATED_CLASS_MODULES,Mo as GENERATED_MODULE_DURABLE_OBJECTS,B as LAZY_FUNCTIONS_ENV,je as LINKED_PROJECT_DIR,we as LINKED_PROJECT_FILE,fo as LUNA_ART,Lo as LUNA_BUNNY,No as LUNA_NAME,To as LUNA_SIGNOFF,$e as LUNORA_EVENT_SOURCE,Ye as LUNORA_IGNORED_PATHS,l as LUNORA_SKILL_NAMES,or as LUNORA_TAG,sr as LunoraReporter,Uo as MERGED_DURABLE_OBJECTS_MODULE,L as MissingBuildOutputError,Sr as PACKAGE_SECRETS_REGISTRY,c as ROOT_SKILL_NAME,Ro as STEP_BADGE_NAMES,G as STRICT_ADVISORIES_ENV,z as acceptsConnection,nr as addArgsFor,tr as advisoryLine,oo as applyAdditiveEdit,Je as applyLintIgnores,vr as assertBuildTargetMatches,vo as badgeLead,xo as badgeWidth,Xe as blockingFindingsMessage,Kr as buildPackageSecretsBlock,T as canonicalPath,p as claimAgentRulesHint,ae as claimDevServerState,to as classifyEdit,io as classifyPolicyEdit,A as clearApiSpecMarker,Ee as clearDevServerState,Fr as createConfirm,Ie as createDiscoveryCache,Oe as deployTargetIds,D as detectAgentRules,t as detectAiAgent,W as detectFramework,_r as detectInstalledManagers,ze as detectLintTools,lr as detectPackageManager,E as discoverAgentInfo,j as discoverContainerInfo,po as discoverSchemaInfo,bo as discoverWorkflowInfo,Hr as ensureDevVariables,Wr as ensureDevVarsExample,xe as ensureDevWorkerEnv,Ge as ensureGitignoreEntries,Se as escapeRegExp,cr as execArgsFor,Yr as fillDevSecrets,er as formatLunoraEvent,Jr as generateSecretValue,ye as inferLunoraBindings,pr as installArgsFor,xr as interpretRemote,b as isCodegenDisabled,se as isDevServerReady,Br as isInteractive,y as isLazyFunctionsEnabled,Fo as isMergedProject,Bo as isMergedRoleModule,zr as isMintableSecretKey,qr as isPlaceholderValue,ie as isProcessAlive,ne as isRecordedProcessCurrent,Pe as isRunnableTarget,ar as lunoraLine,fr as mintableSecretKeysFor,go as padBadge,Io as paintAnswer,Vo as paintBadge,fe as parseDevVariableEntries,Eo as parseSchema,Xr as planDevSecretsFill,Zr as planDevVariablesAugment,Qr as planDevVariablesScaffold,Ce as planToolchainInvocation,v as probeCelldToolchain,Y as projectUsesUmbrella,Gr as promptMultiSelect,br as promptSelect,yr as promptText,kr as promptYesNo,m as readApiSpecMarker,_e as readDevServerState,Ke as readLinkedProject,le as readLiveDevServerState,Pr as readProjectDependencies,Cr as readProjectDependencyNames,Mr as readProjectManifest,gr as readProjectRemotePreference,Ir as readProjectTarget,Le as removeDevVariableLine,Ze as reportCodegenFindings,$r as requiredSecrets,Me as resolveDeployDriver,k as resolveLazyFunctions,Vr as resolveProjectTarget,jr as resolveSchemaDirectory,no as resolveServerModule,ur as resolveTargetOrThrow,Tr as runPostCodegenHook,Dr as runScriptArgsFor,dr as runScriptCommand,Ue as runnableTargetIds,_o as scaffoldPolicyFile,ke as secretSourcesFromBindings,Lr as secretsForPackages,g as startCelldDevSession,q as startDevProcess,K as streamContainerLogs,Fe as targetRunsOwnDevServer,Ar as toolchainExecArgs,ce as updateDevServerState,Ne as upsertDevVariableLine,lo as wireRlsIntoProcedure,S as writeApiSpecMarker,I as writeCelldDevProjection,pe as writeDevServerState,eo as writeDevVariablesFileAtomically,He as writeLinkedProject};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as s,H as c,c as e,r as l}from"./reconcile-bindings-B3bPJPeQ.mjs";import"./applyModify-DKP2l6S9.mjs";import"./lunora-manifest-DuH_Cmyu.mjs";import"./reconcile-services-DFqH4eMQ.mjs";import"./validate-bindings-PVHSAU6M.mjs";import"./worker-entry-checks-AIASCYl7.mjs";import"./DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import"./WRANGLER_FILES-UNW-xY5u.mjs";export{s as D1_PLACEHOLDER_ID,c as HYPERDRIVE_PLACEHOLDER_ID,e as collectExportGaps,l as reconcileWranglerBindings};
|
package/dist/packem_shared/{DEFAULT_DEPLOY_TARGET-CnovxJid.mjs → DEFAULT_DEPLOY_TARGET-T8UHP3bB.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as a}from"./celld-config-
|
|
1
|
+
import{p as a}from"./celld-config-DeMDgYAu.mjs";import s from"./CLOUDFLARE_DRIVER-CULavrYO.mjs";const p=[["entry","`celld deploy` deploys the config's `main`; a composed framework entry has no celld equivalent yet"],["environment","celld has no Wrangler environments — deploy a separate config per environment"],["outDir","`celld deploy` does not write its bundle to disk"],["preview","celld has no preview versions — a deploy replaces the fleet's current deployment"],["temporary","celld has no short-lived accounts — it deploys to the fleet bucket in CELLD_BUCKET"]],l=e=>{if(e===void 0)throw new Error("the celld driver runs the projected wrangler config — pass `configPath` from `projectConfig`");return e},v={deploy:e=>{const o=p.find(([r])=>e[r]!==void 0&&e[r]!==!1);if(o!==void 0)throw new Error(o[1]);return{args:["deploy",l(e.configPath),...e.dryRun===!0?["--dry-run"]:[]],onPath:!0,tool:"celld"}},devServer:"own",prebuildsContainerImages:!1,dev:e=>{if(e.environment!==void 0)throw new Error("celld has no Wrangler environments — `celld dev` runs the top-level config");return{args:["dev",l(e.configPath),...e.extraArgs??[]],onPath:!0,tool:"celld"}}},f={id:"celld",name:"celld",projectConfig:a,toolchain:v},h={id:"node",name:"Node"},m="cloudflare",t={celld:f,cloudflare:s,node:h},d=()=>Object.keys(t).toSorted((e,o)=>e.localeCompare(o)),c=(e=m)=>{const o=t[e];if(o===void 0)throw new Error(`unknown deploy target "${e}" — available targets: ${d().join(", ")}`);return o},g=e=>Object.hasOwn(t,e)&&c(e).toolchain!==void 0,y=()=>d().filter(e=>g(e)),D=e=>c(e).toolchain?.devServer==="own",O=(e,o,r,i)=>{const n=e.projectConfig?.(o,r);return{command:i(n?.configPath),commit:()=>n?.write(),projection:n===void 0?void 0:{configPath:n.configPath,dropped:n.dropped}}};export{m as DEFAULT_DEPLOY_TARGET,d as deployTargetIds,g as isRunnableTarget,O as planToolchainInvocation,c as resolveDeployDriver,y as runnableTargetIds,D as targetRunsOwnDevServer};
|
package/dist/packem_shared/{DEV_WORKER_ENV_VALUE-CARjGoAv.mjs → DEV_WORKER_ENV_VALUE-Dx-b7eJB.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFileSync as l}from"node:fs";import{findWranglerFile as m,readWranglerJsonc as E}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{DEV_VARS_FILE as i,parseDevVariableEntries as V,upsertDevVariableLine as c}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{writeDevVariablesFileAtomically as p}from"./buildPackageSecretsBlock-
|
|
1
|
+
import{readFileSync as l}from"node:fs";import{findWranglerFile as m,readWranglerJsonc as E}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{DEV_VARS_FILE as i,parseDevVariableEntries as V,upsertDevVariableLine as c}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{writeDevVariablesFileAtomically as p}from"./buildPackageSecretsBlock-Cb5Ze3_1.mjs";import{join as v}from"node:path";const n="WORKER_ENV",a="development",d=e=>{const r=m(e);return r===void 0?{}:E(r).parsed?.vars??{}},W=(e,r)=>{const o=v(e,i);let t;try{t=l(o,"utf8")}catch{return}V(t).some(s=>s.key===n)||n in d(e)||(p(o,c(t,n,a)),r(`set ${n}=${a} in ${i} so the dev worker runs in development mode`))};export{a as DEV_WORKER_ENV_VALUE,n as DEV_WORKER_ENV_VAR,W as ensureDevWorkerEnv};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as s,M as R,P as a,a as _,S as e,m as A,s as C}from"./package-secrets-registry-Cx0qpPjB.mjs";export{s as CORE_SECRETS,R as MINTABLE_SECRET_KEYS,a as PACKAGE_SECRETS_REGISTRY,_ as SHARD_RELAY_HOST_PLACEHOLDER,e as SHARD_RELAY_SECRET_KEY,A as mintableSecretKeysFor,C as secretsForPackages};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as d,readFileSync as y}from"node:fs";import{join as s,isAbsolute as a,relative as m}from"node:path";import{LunoraError as p}from"@lunora/errors";import{classifyPolicyEdit as k,scaffoldPolicyFile as h,resolveServerModule as l,wireRlsIntoProcedure as v}from"./classifyPolicyEdit-DJi9Fk8G.mjs";import{w as c,r as b}from"./write-atomic-
|
|
1
|
+
import{existsSync as d,readFileSync as y}from"node:fs";import{join as s,isAbsolute as a,relative as m}from"node:path";import{LunoraError as p}from"@lunora/errors";import{classifyPolicyEdit as k,scaffoldPolicyFile as h,resolveServerModule as l,wireRlsIntoProcedure as v}from"./classifyPolicyEdit-DJi9Fk8G.mjs";import{w as c,r as b}from"./write-atomic-DSo8BGHA.mjs";const D="/__lunora/policy-scaffold",u=r=>r==="unknown-procedure"?404:r==="already-wired"||r==="destructive"?409:422,f=(r,o,e)=>{let t;try{t=b(r,o)}catch(n){return{body:{error:n instanceof Error?n.message:String(n),ok:!1},status:500}}return{body:{...e,diagnostics:t,ok:!0},status:200}},g=r=>({body:{edit:r,message:"Rewriting an existing policy predicate changes evaluation semantics and must be done by hand. The scaffolder only adds new, deny-by-default rules.",needsManualEdit:!0,ok:!1},status:409}),w=(r,o)=>{const e=h(o,l(r.projectRoot));if(!e.ok)return{body:{error:e.reason,ok:!1},status:u(e.reason)};const t=r.schemaDirectory??"lunora",n=s(r.projectRoot,t,e.fileName);return d(n)?{body:{error:"file-exists",fileName:e.fileName,ok:!1},status:409}:(c(n,e.source),f(r,{path:n,text:e.source},{fileName:e.fileName}))},R=(r,o,e)=>{if(typeof e!="string"||e.length===0||a(e)||e.includes("\\"))return;const t=s(r,o),n=s(t,`${e}.ts`),i=m(t,n);if(!(i.startsWith("..")||a(i)))return n},N=(r,o)=>{const e=R(r.projectRoot,r.schemaDirectory??"lunora",o.filePath);if(e===void 0||!d(e))return{body:{error:"unknown-procedure",ok:!1},status:404};const t=v(y(e,"utf8"),o,l(r.projectRoot));return t.ok?(c(e,t.text),f(r,{path:e,text:t.text},{exportName:o.exportName})):{body:{error:t.reason,ok:!1},status:u(t.reason)}},E=r=>{if(r.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:o}=r;if(o==null||typeof o!="object"||typeof o.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};const e=o;if(k(e)==="destructive")return g(e);if(e.kind==="scaffoldPolicy")return w(r,e);if(e.kind==="wireRls")return N(r,e);throw new p("INTERNAL",`unhandled additive policy edit kind: ${String(e.kind)}`)};export{D as POLICY_SCAFFOLD_ENDPOINT,E as handlePolicyScaffoldRequest};
|
package/dist/packem_shared/{SCHEMA_EDIT_ENDPOINT-B-Xii8Ke.mjs → SCHEMA_EDIT_ENDPOINT-DrPTyuPd.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as a,readFileSync as d}from"node:fs";import{classifyEdit as l,applyAdditiveEdit as c}from"./applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as u}from"./parseSchema-D1Wbr1qv.mjs";import{w as f,r as p}from"./write-atomic-
|
|
1
|
+
import{existsSync as a,readFileSync as d}from"node:fs";import{classifyEdit as l,applyAdditiveEdit as c}from"./applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as u}from"./parseSchema-D1Wbr1qv.mjs";import{w as f,r as p}from"./write-atomic-DSo8BGHA.mjs";import{join as m}from"node:path";const F="/__lunora/schema-edit",b=t=>t==="destructive"||t==="duplicate-table"||t==="duplicate-column"||t==="duplicate-index"?409:t==="unknown-table"?404:t==="invalid-identifier"||t==="invalid-validator"?400:422,y=t=>({body:{error:t.reason,ok:!1},status:422}),k=t=>{if(!a(t))return{response:{body:{error:"no-schema-file",ok:!1},status:404}};const e=u(d(t,"utf8"));return e.ok?{tables:e.tables}:{response:y(e)}},g=t=>({body:{edit:t,message:"This edit changes stored data and must go through a migration. Review the migration before applying.",needsMigration:!0,ok:!1},status:409}),h=(t,e)=>{const r=t.body;if(r==null||typeof r!="object"||typeof r.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};if(l(r)==="destructive")return g(r);if(!a(e))return{body:{error:"no-schema-file",ok:!1},status:404};const o=c(d(e,"utf8"),r);if(!o.ok)return{body:{error:o.reason,ok:!1},status:b(o.reason)};f(e,o.text);let i;try{i=p(t,{path:e,text:o.text})}catch(s){return{body:{error:s instanceof Error?s.message:String(s),ok:!1},status:500}}const n=u(o.text);return{body:{diagnostics:i,ok:!0,tables:n.ok?n.tables:[]},status:200}},R=t=>{const e=m(t.projectRoot,t.schemaDirectory??"lunora","schema.ts");if(t.method==="GET"){const r=k(e);return"response"in r?r.response:{body:{ok:!0,tables:r.tables},status:200}}return t.method==="POST"?h(t,e):{body:{error:"method-not-allowed",ok:!1},status:405}};export{F as SCHEMA_EDIT_ENDPOINT,R as handleSchemaEditRequest};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveAdminToken as A}from"./devVariablesStamp-Cetr3qFz.mjs";import{sendStudioDocument as D,applyStudioAssetCache as I}from"./applyStudioAssetCache-DHQEJuuv.mjs";import{isStandaloneModulePath as O,studioAssetsStamp as _,loadStudioAssets as C,readStandaloneAsset as H,assetContentType as N}from"./assetContentType-CUb5bpbI.mjs";import E from"./createStudioDocumentCache-B3Sf1bIl.mjs";import{detectAgentRules as v}from"./AGENT_RULES_DIR-Bd6JPtNa.mjs";import{handlePolicyScaffoldRequest as L,POLICY_SCAFFOLD_ENDPOINT as R}from"./POLICY_SCAFFOLD_ENDPOINT-
|
|
1
|
+
import{resolveAdminToken as A}from"./devVariablesStamp-Cetr3qFz.mjs";import{sendStudioDocument as D,applyStudioAssetCache as I}from"./applyStudioAssetCache-DHQEJuuv.mjs";import{isStandaloneModulePath as O,studioAssetsStamp as _,loadStudioAssets as C,readStandaloneAsset as H,assetContentType as N}from"./assetContentType-CUb5bpbI.mjs";import E from"./createStudioDocumentCache-B3Sf1bIl.mjs";import{detectAgentRules as v}from"./AGENT_RULES_DIR-Bd6JPtNa.mjs";import{handlePolicyScaffoldRequest as L,POLICY_SCAFFOLD_ENDPOINT as R}from"./POLICY_SCAFFOLD_ENDPOINT-BLMGCD5t.mjs";import b from"./renderStudioHtml-ByowDtMl.mjs";import{handleSchemaEditRequest as x,SCHEMA_EDIT_ENDPOINT as k}from"./SCHEMA_EDIT_ENDPOINT-DrPTyuPd.mjs";import{handleSeedRequest as $,SEED_ENDPOINT as g}from"./SEED_ENDPOINT-2B56PN_H.mjs";import{serveJsonHandler as j}from"./serveJsonHandler-Dv0EdCb9.mjs";import{transportRejectionReason as F}from"./ALLOW_FORWARDED_ENV-BUndghJx.mjs";import"./STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";const c="/__lunora",M=`${c}/studio.js`,m=`${c}/styles.css`,T=/\/$/,U={[R]:L,[k]:x,[g]:$},q=new Set(["127.0.0.1","::1","localhost"]),et=t=>t!==void 0&&t!==!1&&!q.has(t),y=t=>t===void 0||t==="/"?"":t.replace(T,""),ot=t=>`${y(t)}${c}`,h=(t,s,r)=>{t.statusCode=200,t.setHeader("Content-Type",r),t.end(s)},w=t=>{try{return new URL(t,"http://localhost").pathname}catch{const s=t.indexOf("?");return s===-1?t:t.slice(0,s)}},nt=t=>{const{logger:s,projectRoot:r}=t,u=y(t.base);let l,f;const p=E(r,()=>b({adminToken:A(r),basePath:c,dataEditable:!0,rulesInstalled:v(r).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:M,styleHref:m})),P=(o,n,e)=>{const i=_();if((l===void 0||i!==f)&&(l=C(s),f=i),l===void 0){e.statusCode=501,e.setHeader("Content-Type","text/plain"),e.end("Lunora studio assets not found — install and build @lunora/studio.");return}const a=o===m,d=o.slice(o.lastIndexOf("/")+1);if(I(n,e,d,i))return;if(a){h(e,l.styles,"text/css; charset=utf-8");return}const S=H(d);if(S===void 0){e.statusCode=404,e.setHeader("Content-Type","text/plain"),e.end("Not found");return}h(e,S,N(d))};return(o,n,e)=>{const i=w(o.url??"").replace(T,""),a=u!==""&&i.startsWith(u)?i.slice(u.length):i;if(a!==c&&!a.startsWith(`${c}/`)){e();return}if(t.isNonLoopbackBind||F(o,s)!==void 0){n.statusCode=403,n.setHeader("Content-Type","text/plain"),n.end("Lunora studio is only available on loopback hosts in dev.");return}const d=U[a];if(d!==void 0){j(o,n,d,r,{apiSpec:t.apiSpec,lazyFunctions:t.lazyFunctions,schemaDirectory:t.schemaDirectory});return}if(a===m||O(a)){P(a,o,n);return}D(n,p())}};export{c as STUDIO_PATH,M as STUDIO_SCRIPT_PATH,m as STUDIO_STYLE_PATH,nt as createStudioMiddleware,et as isNonLoopbackHost,w as requestPathname,ot as studioMountPath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readProjectConfigLiterals as s,readProjectTarget as c}from"@lunora/codegen";import n from"./canonicalPath-DrfMiT3U.mjs";import{BUILD_TARGET_ENV as i,BUILD_ROOT_ENV as a}from"./BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{DEFAULT_DEPLOY_TARGET as p,resolveDeployDriver as f}from"./DEFAULT_DEPLOY_TARGET-
|
|
1
|
+
import{readProjectConfigLiterals as s,readProjectTarget as c}from"@lunora/codegen";import n from"./canonicalPath-DrfMiT3U.mjs";import{BUILD_TARGET_ENV as i,BUILD_ROOT_ENV as a}from"./BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{DEFAULT_DEPLOY_TARGET as p,resolveDeployDriver as f}from"./DEFAULT_DEPLOY_TARGET-T8UHP3bB.mjs";const d=e=>{if(typeof e=="boolean")return e;if(e!==null&&typeof e=="object")return!0},P=e=>d(s(e).remote),T=e=>c(e),g=(e,t)=>t??T(e)??p,j=(e,t)=>{const r=g(e,t);return f(r),r},v=(e,t)=>{const r=process.env[i],o=process.env[a];if(!(o===void 0||o===""||n(o)!==n(t))&&r!==void 0&&r!==""&&r!==e)throw new Error(`the plugin resolves target "${e}" but the CLI resolved "${r}" for this run; set the same target in the plugin options and the project config`)};export{v as assertBuildTargetMatches,d as interpretRemote,P as readProjectRemotePreference,T as readProjectTarget,g as resolveProjectTarget,j as resolveTargetOrThrow};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{randomBytes as v}from"node:crypto";import{existsSync as m,readFileSync as y,writeFileSync as h,linkSync as b,rmSync as g,renameSync as R,statSync as M}from"node:fs";import{join as p}from"node:path";import{LunoraError as F}from"@lunora/errors";import{DEV_VARS_FILE as u,DEV_VARS_EXAMPLE_FILE as f,parseDevVariableLine as E,parseDevVariableEntries as S,DEV_VARS_NEWLINE as C}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{C as V,S as j,a as I,M as N,s as z}from"./package-secrets-registry-Cx0qpPjB.mjs";const D=e=>[...V,...z(e)],$=32,B=["replace","openssl","changeme","change-me","change_me","change-this","change_this","your-","your_","example","placeholder","todo","fill-me","fill_me","fill-in","fill_in","xxx"],W=/[.*+?^${}()|[\]\\]/gu,O=/[a-z0-9]$/u,X=e=>{const t=e.trim().toLowerCase();return t===""||t.startsWith("<")&&t.endsWith(">")?!0:B.some(r=>{const s=r.replaceAll(W,String.raw`\$&`),o=O.test(r)?`(^|[^a-z0-9])${s}([^a-z0-9]|$)`:`(^|[^a-z0-9])${s}`;return new RegExp(o,"u").test(t)})},x=e=>v(e).toString("hex"),Y=(e,t)=>e===j?t.trim()===""||t===I:N.has(e),P=(e,t,r)=>Y(e,t)&&X(t)?r($):void 0,de=(e=x)=>e($),H=(e,t,r)=>e.split(C).map(s=>{const n=E(s),o=n?P(n.key,n.value,t):void 0;return!n||o===void 0?s:(r.push(n.key),`${n.key}="${o}"`)}),G=e=>{if(e.devVarsExists)return{status:"exists"};if(e.exampleContent===void 0)return{status:"no-example"};const t=[];return{content:H(e.exampleContent,e.randomHex??x,t).join(`
|
|
2
|
+
`),generatedKeys:t,status:"generate"}},U=e=>e.includes('"')||e.includes("\\")?"":e.replaceAll("\r",String.raw`\r`).replaceAll(`
|
|
3
|
+
`,String.raw`\n`),w=e=>{const t=e.randomHex??x,r=new Set(S(e.existingContent).map(d=>d.key)),s=[],n=[],o=[];for(const d of e.exampleContent.split(C)){const i=E(d);if(!i||r.has(i.key))continue;const a=P(i.key,i.value,t);o.push(i.key),a===void 0?s.push(`${i.key}="${U(i.value)}"`):(n.push(i.key),s.push(`${i.key}="${a}"`))}return{additions:s,generatedKeys:n,missingKeys:o}},_=e=>e.length>0?` (generated ${e.join(", ")})`:"",L=e=>`${e}.tmp-${String(process.pid)}`,K=(e,t,r={})=>{const s=L(e);try{h(s,t,{encoding:"utf8",...r}),R(s,e)}catch(n){throw g(s,{force:!0}),n}},q=(e,t)=>{try{return h(e,t,{encoding:"utf8",flag:"wx",mode:384}),!0}catch(r){if(r.code==="EEXIST")return!1;throw r}},T=(e,t)=>{const r=L(e);try{h(r,t,{encoding:"utf8",flag:"wx",mode:384});try{return b(r,e),!0}catch(s){const{code:n}=s;if(n==="EEXIST")return!1;if(n==="EPERM"||n==="ENOTSUP")return q(e,t);throw s}}finally{g(r,{force:!0})}},le=(e,t)=>{K(e,t,{mode:384})},k=5,A=e=>{try{const t=M(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}},J=(e,t)=>e===void 0||t===void 0?!1:e.mtimeMs===t.mtimeMs&&e.size===t.size,Q=(e,t)=>{for(let r=0;r<k;r+=1){const s=A(e),n=y(e,"utf8"),o=t(n);if(o.length===0)return[];const d=n.length>0&&!n.endsWith(`
|
|
4
|
+
`)?`
|
|
5
|
+
`:"",i=`${n}${d}${o.join(`
|
|
6
|
+
`)}
|
|
7
|
+
`,a=`${e}.tmp-${String(process.pid)}-${v(6).toString("hex")}`;try{h(a,i,{encoding:"utf8",mode:384});const c=A(e);if(!J(s,c)){g(a,{force:!0});continue}return R(a,e),o}catch(c){throw g(a,{force:!0}),c}}throw new F("INTERNAL",`Failed to append to ${e} after ${String(k)} attempts — a concurrent writer kept winning the race.`)},ue=async e=>{const t=p(e.cwd,u),r=p(e.cwd,f);if(!m(r))return{addedKeys:[],generatedKeys:[],status:"no-example"};const s=y(r,"utf8");if(!m(t)){const l=G({devVarsExists:!1,exampleContent:s,randomHex:e.randomHex});return l.status!=="generate"?{addedKeys:[],generatedKeys:[],status:"no-example"}:e.yes===!0||await e.confirm(`No ${u} found. Generate it from ${f} (secrets auto-filled)?`)?T(t,l.content)?(e.info(`Created ${u}${_(l.generatedKeys)}.`),{addedKeys:[],generatedKeys:l.generatedKeys,status:"generated"}):{addedKeys:[],generatedKeys:[],status:"skipped-exists"}:(e.info(`Skipped — copy ${f} to ${u} and fill it in when you're ready.`),{addedKeys:[],generatedKeys:[],status:"declined"})}const n=w({existingContent:y(t,"utf8"),exampleContent:s,randomHex:e.randomHex});if(n.missingKeys.length===0)return{addedKeys:[],generatedKeys:[],status:"exists"};const o=n.missingKeys.join(", ");if(!(e.yes===!0||await e.confirm(`${u} is missing ${String(n.missingKeys.length)} key(s) from ${f} (${o}). Add them?`)))return e.info(`Skipped — add ${o} to ${u} when you're ready.`),{addedKeys:[],generatedKeys:[],status:"declined"};const a=Q(t,l=>w({existingContent:l,exampleContent:s,randomHex:e.randomHex}).additions).map(l=>E(l)?.key).filter(l=>l!==void 0);if(a.length===0)return{addedKeys:[],generatedKeys:[],status:"exists"};const c=n.generatedKeys.filter(l=>a.includes(l));return e.info(`Updated ${u} — added ${a.join(", ")}${_(c)}.`),{addedKeys:a,generatedKeys:c,status:"augmented"}},Z=e=>[`# ${e.description}`,`# Docs: ${e.docsUrl}`,`${e.key}="${e.placeholderValue}"`].join(`
|
|
8
|
+
`),ee=(e,t)=>{const r=D(e).filter(s=>!t.has(s.key));return r.length===0?"":r.map(s=>Z(s)).join(`
|
|
9
|
+
|
|
10
|
+
`)},fe=(e,t)=>{const r=p(e,f),s=m(r)?y(r,"utf8"):"",n=new Set(S(s).map(i=>i.key)),o=ee(t,n);if(o==="")return[];const d=s.length>0&&!s.endsWith(`
|
|
11
|
+
`)?`
|
|
12
|
+
`:"";return K(r,`${s}${d}
|
|
13
|
+
${o}
|
|
14
|
+
`),D(t).filter(i=>!n.has(i.key)).map(i=>i.key)},te=e=>{const t=e.randomHex??x,r=[],s=H(e.existingContent,t,r),n=new Set(S(e.existingContent).map(c=>c.key)),o=[],d=[];for(const c of V)n.has(c.key)||(o.push(c.key),d.push(`# ${c.description}`,`${c.key}="${t($)}"`));const i=s.join(`
|
|
15
|
+
`);if(d.length===0)return{addedKeys:o,content:i,filledKeys:r};const a=i===""||i.endsWith(`
|
|
16
|
+
`)?"":`
|
|
17
|
+
`;return{addedKeys:o,content:`${i}${a}${d.join(`
|
|
18
|
+
`)}
|
|
19
|
+
`,filledKeys:r}},ye=e=>{const t=p(e.cwd,u),r=m(t),s=r?y(t,"utf8"):"",n=te({existingContent:s,randomHex:e.randomHex});if(n.filledKeys.length===0&&n.addedKeys.length===0)return{addedKeys:[],filledKeys:[],status:"unchanged"};if(r)K(t,n.content,{mode:384});else if(!T(t,n.content))return{addedKeys:[],filledKeys:[],status:"unchanged"};const o=[...n.filledKeys,...n.addedKeys];return e.info?.(`Generated ${String(o.length)} dev secret(s) in ${u}: ${o.join(", ")}`),{addedKeys:n.addedKeys,filledKeys:n.filledKeys,status:r?"filled":"created"}};export{ee as buildPackageSecretsBlock,ue as ensureDevVariables,fe as ensureDevVarsExample,ye as fillDevSecrets,de as generateSecretValue,Y as isMintableSecretKey,X as isPlaceholderValue,te as planDevSecretsFill,w as planDevVariablesAugment,G as planDevVariablesScaffold,D as requiredSecrets,le as writeDevVariablesFileAtomically};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{writeFileSync as $,rmSync as W,existsSync as w,readFileSync as A}from"node:fs";import{dirname as E,resolve as h,join as v,sep as y,relative as _,isAbsolute as B}from"node:path";import{MissingBuildOutputError as x}from"./MissingBuildOutputError-BAyekzof.mjs";import{a as D,D as F}from"./reconcile-bindings-B3bPJPeQ.mjs";import{findWranglerFile as K,readWranglerJsonc as Y}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{DEV_VARS_FILE as G,parseDevVariableEntries as J}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import k from"./ensureGitignoreEntries-Tsk8Qkw7.mjs";const q=".celld.wrangler.json",C=[".celld/",".celld.wrangler.json",".celld.service.*.wrangler.json"],M=v(".wrangler","deploy","config.json"),U=new Set(["$schema","assets","compatibility_date","compatibility_flags","containers","d1_databases","define","durable_objects","kv_namespaces","main","migrations","name","no_bundle","queues","r2_buckets","rules","services","triggers","vars","worker_loaders","workflows"]),H=new Set(["class_name","image","instance_type","max_instances","name","runtime"]),X=new Set(["CompiledWasm","Data","Text"]),z=/\r?\n/u,Q=/[!*?[]/u,Z=/[.[]/u,ee=["deleted_classes","new_classes","renamed_classes","transferred_classes"],c=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),I=e=>Array.isArray(e)&&e.length===0||c(e)&&Object.values(e).every(s=>I(s)),re=e=>Array.isArray(e)?e.map(s=>{if(!c(s))return s;const r=ee.find(t=>s[t]!==void 0);if(r!==void 0)throw new Error(`migration "${String(s.tag)}" uses \`${r}\`, which celld refuses — celld accepts only \`new_sqlite_classes\` migrations`);return{new_sqlite_classes:s.new_sqlite_classes,tag:s.tag}}):e,se=(e,s)=>Array.isArray(e)?e.map((r,t)=>c(r)?Object.fromEntries(Object.entries(r).filter(([n])=>{const i=H.has(n);return i||s.push(`containers[${String(t)}].${n}`),i})):r):e,te=(e,s)=>Array.isArray(e)?e.filter((r,t)=>{const n=c(r)&&typeof r.type=="string"&&X.has(r.type);return n||s.push(`rules[${String(t)}]`),n}):e,ne=e=>{const s=[],r={};for(const[t,n]of Object.entries(c(e)?e:{}))c(n)&&n.type==="workflow"?s.push({binding:t,class_name:t,name:n.name}):r[t]=n;return{bindings:s,rest:r}},ie=(e,s)=>Array.isArray(e)?e.map(r=>!c(r)||r.database_id!==F?r:typeof r.database_name=="string"?{...r,database_id:r.database_name}:typeof r.binding=="string"?{...r,database_id:D(s,r.binding)}:r):e,oe=(e,s)=>Array.isArray(e)?e.map(r=>c(r)&&r.id===void 0&&typeof r.binding=="string"?{...r,id:D(s,r.binding)}:r):e,N=e=>{const s=[],r={},t=ne(e.exports),n={...e,exports:t.rest};for(const[i,o]of Object.entries(n)){if(!U.has(i)){I(o)||s.push(i);continue}switch(i){case"containers":{r[i]=se(o,s);break}case"d1_databases":{r[i]=ie(o,e.name);break}case"kv_namespaces":{r[i]=oe(o,e.name);break}case"migrations":{r[i]=re(o);break}case"rules":{r[i]=te(o,s);break}default:r[i]=o}}if(t.bindings.length>0){const i=Array.isArray(r.workflows)?r.workflows:[];r.workflows=[...i,...t.bindings]}return{config:r,dropped:s}},ae=e=>{const[s=[],...r]=e.map(n=>h(n).split(y));let t=0;for(;t<s.length&&r.every(n=>n[t]===s[t]);)t+=1;return s.slice(0,t).join(y)||y},P=(e,s,r)=>{const t=i=>_(r,h(s,i)).split(y).join("/"),n={...e};return typeof e.main=="string"&&(n.main=t(e.main)),c(e.assets)&&typeof e.assets.directory=="string"&&(n.assets={...e.assets,directory:t(e.assets.directory)}),n},ce=e=>{const s=v(e,".assetsignore");if(!w(s))return;const r=A(s,"utf8").split(z).map(t=>t.trim()).filter(t=>t!==""&&!t.startsWith("#")).filter(t=>Q.test(t)||w(v(e,t)));if(r.length>0)throw new Error(`${s} hides ${r.join(", ")} from the assets, and celld has no .assetsignore — remove those files from ${e} first`);return s},le=(e,s)=>{const r=v(e,M);if(!w(r))throw new x(`wrangler \`main\` is the Vite virtual module "${s}", so celld deploys the Vite build output — and there is none yet. Run the project's build (\`vite build\`) first`);const{configPath:t}=JSON.parse(A(r,"utf8"));if(typeof t!="string")throw new TypeError(`${r} names no configPath`);return h(E(r),t)},S=e=>{const{parsed:s}=Y(e);if(s===void 0)throw new Error(`${e} is not valid JSONC`);return s},T=(e,s,r,t)=>{const{d1_databases:n}=e;if(!Array.isArray(n)||t===r)return e;const i=Array.isArray(s.d1_databases)?s.d1_databases.filter(o=>c(o)):[];return{...e,d1_databases:n.map(o=>{if(!c(o))return o;const a=i.find(m=>m.binding===o.binding),l=a?.migrations_dir,p=h(r,typeof l=="string"?l:"migrations"),d=w(p)?{...o,migrations_dir:_(t,p).split(y).join("/")}:o,f=a?.migrations_pattern;return typeof f=="string"?{...d,migrations_pattern:_(t,h(r,f)).split(y).join("/")}:d})}},de=(e,s,r,t)=>{const{main:n}=r;if(typeof n!="string"||!n.startsWith("virtual:"))return{fromBuild:!1,source:r,sourcePath:s};if(t==="dev")throw new Error(`wrangler \`main\` is the Vite virtual module "${n}", which only a Vite build can resolve — \`celld dev\` rebuilds from a source file. Use \`vite dev\` for the dev loop and \`lunora deploy\` to ship the build to celld, or point \`main\` at a worker file`);const i=le(e,n);return{fromBuild:!0,source:S(i),sourcePath:i}},fe=(e,s,r,t,n)=>{const i=s.filter(l=>Object.hasOwn(r,l.split(Z)[0]??l));let o=e;e.no_bundle!==void 0&&(o=Object.fromEntries(Object.entries(e).filter(([l])=>l!=="no_bundle")),i.push("no_bundle (celld re-bundles the build output)"));const a=t===void 0?void 0:ce(t);return a!==void 0&&i.push(`${_(n,a)} (matched no files)`),{assetsIgnore:a,projected:o,reported:i}},R=(e,s={})=>{const r=c(e.vars)?e.vars:{};return{...e,vars:{...r,WORKER_ENV:"development",...s}}},we=(e,s)=>{const r=K(e);if(r===void 0)throw new Error(`no wrangler.jsonc or wrangler.json in ${e} — celld deploys from the project's Wrangler config`);const t=S(r),{fromBuild:n,source:i,sourcePath:o}=de(e,r,t,s),a=E(o),{config:l,dropped:p}=N(i),{assets:d}=i,f=c(d)&&typeof d.directory=="string"?h(a,d.directory):void 0,m=typeof i.main=="string"?E(h(a,i.main)):void 0,u=ae([a,m,f].filter(L=>L!==void 0));if(!n&&u!==a)throw new Error(`wrangler \`main\` and \`assets.directory\` must sit inside ${a} — celld resolves everything against the config's directory`);const b=T(P(l,a,u),t,e,u),g=n?fe(b,p,t,f,u):{assetsIgnore:void 0,projected:b,reported:p},j=s==="dev"?R(g.projected):g.projected,O=v(u,q),V=`${JSON.stringify(j,void 0,4)}
|
|
2
|
+
`;return{configPath:O,dropped:g.reported,vars:c(j.vars)?j.vars:{},write:()=>{if(!n)try{k(u,C)}catch{}$(O,V),g.assetsIgnore!==void 0&&W(g.assetsIgnore)}}},_e=(e,s)=>{const r=S(s),t=E(s),{config:n,dropped:i}=N(r),o=typeof r.name=="string"?r.name:"service",a=_(e,t);if(a===".."||a.startsWith(`..${y}`)||B(a))throw new Error(`service ${o} (${t}) must sit inside ${e} — celld dev runs it from a config beside the app's`);const l=v(t,G),p=w(l)?Object.fromEntries(J(A(l,"utf8")).map(({key:b,value:g})=>[b,g])):{},d=T(P(n,t,e),r,t,e),f=v(e,`.celld.service.${o.replaceAll(/[^\w.-]/gu,"-")}.wrangler.json`),m=R(d,p),u=`${JSON.stringify(m,void 0,4)}
|
|
3
|
+
`;return{configPath:f,dropped:i,vars:c(m.vars)?m.vars:{},write:()=>{k(e,C),$(f,u)}}};export{_e as a,we as p};
|
package/dist/packem_shared/{deploy-driver.d-Cl96-c1l.d.mts → deploy-driver.d-DraUd2R2.d.mts}
RENAMED
|
@@ -154,6 +154,8 @@ interface ProjectedConfig {
|
|
|
154
154
|
configPath: string;
|
|
155
155
|
/** Every key removed, as a dotted path (`observability`, `containers[0].rollout_step_percentage`). */
|
|
156
156
|
dropped: ReadonlyArray<string>;
|
|
157
|
+
/** The `vars` the projection deploys — for a host with no secret store, the only channel a secret has. */
|
|
158
|
+
vars: Readonly<Record<string, unknown>>;
|
|
157
159
|
/** Write the projection (and any build-artifact cleanup it planned). */
|
|
158
160
|
write: () => void;
|
|
159
161
|
}
|
|
@@ -154,6 +154,8 @@ interface ProjectedConfig {
|
|
|
154
154
|
configPath: string;
|
|
155
155
|
/** Every key removed, as a dotted path (`observability`, `containers[0].rollout_step_percentage`). */
|
|
156
156
|
dropped: ReadonlyArray<string>;
|
|
157
|
+
/** The `vars` the projection deploys — for a host with no secret store, the only channel a secret has. */
|
|
158
|
+
vars: Readonly<Record<string, unknown>>;
|
|
157
159
|
/** Write the projection (and any build-artifact cleanup it planned). */
|
|
158
160
|
write: () => void;
|
|
159
161
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{existsSync as d,readFileSync as g,writeFileSync as m}from"node:fs";import{join as u}from"node:path";const h=/\r?\n/u,I=(a,s)=>{const e=u(a,".gitignore"),n=d(e)?g(e,"utf8"):"",r=n.split(h).map(t=>t.trim()),c=r.findLastIndex(t=>t.startsWith("!")&&!s.includes(t)),i=s.filter(t=>{const o=r.lastIndexOf(t);return o===-1||!t.startsWith("!")&&o<c});if(i.length===0)return[];const l=i.some(t=>!t.startsWith("!"))?[...i.filter(t=>!t.startsWith("!")),...s.filter(t=>t.startsWith("!"))]:i,f=n.length>0&&!n.endsWith(`
|
|
2
|
+
`)?`
|
|
3
|
+
`:"";return m(e,`${n}${f}
|
|
4
|
+
# Lunora — local secrets and dev state, never commit
|
|
5
|
+
${l.join(`
|
|
6
|
+
`)}
|
|
7
|
+
`,"utf8"),i};export{I as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as ToolchainCommand, D as DeployDriver, d as ProjectionPurpose } from "./deploy-driver.d-
|
|
1
|
+
import { e as ToolchainCommand, D as DeployDriver, d as ProjectionPurpose } from "./deploy-driver.d-DraUd2R2.mjs";
|
|
2
2
|
/**
|
|
3
3
|
* Project-relative directory the Lunora agent skills ("rules") install into.
|
|
4
4
|
* This is the portable [Agent Skills](https://tanstack.com/intent/latest/docs/registry)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as ToolchainCommand, D as DeployDriver, d as ProjectionPurpose } from "./deploy-driver.d-
|
|
1
|
+
import { e as ToolchainCommand, D as DeployDriver, d as ProjectionPurpose } from "./deploy-driver.d-DraUd2R2.js";
|
|
2
2
|
/**
|
|
3
3
|
* Project-relative directory the Lunora agent skills ("rules") install into.
|
|
4
4
|
* This is the portable [Agent Skills](https://tanstack.com/intent/latest/docs/registry)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as $,statSync as k,readFileSync as L,readdirSync as B}from"node:fs";import{discoverFlags as G,FLAGS_FILENAME as W,discoverQueues as q,CAPABILITY_PROBES as w,readServiceBindings as Y,discoverNotifyChannels as K,NOTIFY_FILENAME as U,createTargetScope as M,mayReadCapabilityContext as H,sourceCapabilitySignals as V,foldCapabilitySignals as T,capabilitiesUsedBy as X}from"@lunora/codegen";import{init as Q}from"es-module-lexer";import{Project as J}from"ts-morph";import{discoverAgentInfo as z}from"./discoverAgentInfo-pqFMJBtJ.mjs";import{discoverContainerInfo as Z}from"./discoverContainerInfo-DzXr7Vm3.mjs";import{escapeRegExp as ee}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{d as I}from"./discover-info-DC2MrAIM.mjs";import{relative as se,sep as te,isAbsolute as re,join as y}from"node:path";import{P as oe}from"./package-secrets-registry-Cx0qpPjB.mjs";import{discoverSchemaInfo as ne}from"./discoverSchemaInfo-BBRlXZop.mjs";import{resolveWorkerEntry as ae,composedEntryDurableObjects as ie,GENERATED_DIRECTORY as A,DURABLE_OBJECT_BINDINGS as ce,detectExportedDurableObjects as de,detectClassExports as x,isMergedProject as D}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as ue}from"./discoverWorkflowInfo-zW7Tt0Tn.mjs";const le=(e,s)=>{const{error:r,value:t}=I(e,s,W,G);return r===void 0?{flags:t}:{error:r}},me=(e,s)=>{const r=se(s,e);return r!==""&&r!==".."&&!r.startsWith(`..${te}`)&&!re(r)},pe=(e,s)=>{const{error:r,value:t}=I(e,s,void 0,q);return r===void 0?{queues:t??[]}:{error:r,queues:[]}},he=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),fe=new Set([".git",".lunora-cache",".wrangler","dist",A,"node_modules"]),ge=["lunora","src"],ye=/\benv\s*\.\s*DB\b/,Se=/\benv\s*\.\s*AI\b/,N=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],O=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,j=[["usesAuth","@lunora/auth"],["usesCimdWorkers","@lunora/auth/cimd/workers"],["usesX402Charge","@lunora/x402/charge"],["usesPaymentAutumn","@lunora/payment/autumn"],["usesPaymentCreem","@lunora/payment/creem"],["usesPaymentDodopayments","@lunora/payment/dodopayments"],["usesPaymentPolar","@lunora/payment/polar"],["usesPaymentStripe","@lunora/payment/stripe"]],P=[...N.map(e=>[O(e),w[e].moduleSpecifier]),...j].toSorted(([e],[s])=>e.localeCompare(s)),be=[["usesNotifyFcm","@lunora/notify:fcm"],["usesNotifyWebPush","@lunora/notify:webPush"],["hostsShardRegistry","@lunora/do:shardRegistry"],["usesRequestSecretTool","@lunora/agent:requestSecretTool"]],Ee=["@lunora/agent","@lunora/agent/sandbox"],ve=new RegExp(String.raw`["'\x60](?:${[...P.map(([,e])=>e),...Ee].map(e=>ee(e)).join("|")})["'\x60]`,"u"),o=e=>{const{contextProperty:s,moduleSpecifier:r}=w[e];return s===void 0?`${r} is imported`:`${r} is imported or ctx.${s} is read`},Re="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",Ae=/\bfrom\s+["']\.{1,2}\//u,F=(e,s)=>{let r;try{r=B(e,{withFileTypes:!0})}catch{return}for(const t of r){if(t.isDirectory()){fe.has(t.name)||F(y(e,t.name),s);continue}const n=t.name.lastIndexOf(".");n!==-1&&he.has(t.name.slice(n))&&s.push(y(e,t.name))}},_e=(e,s,r)=>{const{info:t}=ne(e,s,r);return{jurisdiction:t?.jurisdiction,needsD1:t?.hasD1GlobalTable??!1}},xe=(e,s,r)=>{const t=y(e,r),n=new J({compilerOptions:{allowJs:!0},skipAddingFilesFromTsConfig:!0}),a=[],c=[],l=[],d=M();let E=!1,v=!1;for(const i of s){const m=y(e,i);if(!$(m)||!k(m).isDirectory())continue;const f=[];F(m,f);for(const u of f){const g=L(u,"utf8"),p=me(u,t);E||=Se.test(g),v||=ye.test(g),(ve.test(g)||p&&(H(g)||Ae.test(g)))&&(n.createSourceFile(u,g,{overwrite:!0}),a.push({file:u,inLunora:p}))}}for(const{file:i,inLunora:m}of a)(m?c:l).push(V(n.getSourceFileOrThrow(i),d));const h=T(c),R=T([h,...l]),S=new Set([...R.valueImports,...R.dynamicImports]),b=X({contextReads:h.contextReads,valueImports:S});return{...Object.fromEntries([...N.map(i=>[O(i),b.has(i)]),...j.map(([i,m])=>[i,S.has(m)])]),needsD1:v,usesRequestSecretTool:h.requestSecretTool,usesAi:b.has("ai")||E,usesBrowser:b.has("browser")||h.sandboxTools.usesSandboxBrowser,usesWorkerLoader:h.sandboxTools.usesSandboxLoader}},Ie=(e,s,r)=>[...e.map(t=>t.exported?`${t.bindingName}/${t.className} (container "${t.exportName}" declared and exported)`:`hint: container "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...s.map(t=>t.exported?`exports.${t.className} (workflow "${t.exportName}" declared and exported)`:`hint: workflow "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...r.map(t=>t.exported?`exports.${t.className} (agent "${t.exportName}" declared and exported)`:`hint: agent "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],Ce=(e,s,r)=>[[e.usesAi,`AI (${o("ai")}, or env.AI is used)`],[e.usesAuth&&!s.has("SessionDO"),"hint: @lunora/auth is imported; its tables are D1-backed by default. For DO-backed auth (what @better-auth/scim needs), pass `namespace` to .auth() and export the generated auth DO class"],[e.usesScheduler&&!s.has("SchedulerDO"),`hint: ${o("scheduler")}, but no SchedulerDO is exported by the worker entry`],[e.usesStorage,`hint: ${o("storage")}; add an r2_buckets binding (bucket binding names are user-defined)`],[e.usesMail,`hint: ${o("mail")}; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)`],[e.usesPayments,`hint: ${o("payments")}; set the provider secrets in .dev.vars — ${Re}`],[e.usesBrowser,`browser (${o("browser")}, or a sandbox browserTool imported in lunora/) — self-describing { binding: BROWSER }`],[e.usesImages,`images (${o("images")}) — self-describing { binding: IMAGES }`],[e.usesAnalytics,`analytics_engine_datasets (${o("analytics")}) — self-describing { binding: ANALYTICS, dataset }`],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesAiSearch,`ai_search_namespaces (${o("aiSearch")}) — self-describing { binding: AI_SEARCH, namespace: "default" }; remote-only, so \`lunora dev\` reaches the deployed AI Search service`],[e.usesAnalyticsSql,`analytics (${o("analyticsSql")}) — self-describing { binding: ANALYTICS_SQL }; needs wrangler >= 4.145.0, and is remote-only, so \`lunora dev\` queries the account's live analytics`],[e.usesKv,r.jurisdiction===void 0?`kv_namespaces (${o("kv")}) — { binding: KV } with no id; wrangler creates the namespace on the first deploy`:`hint: ${o("kv")} and the schema pins "${r.jurisdiction}"; create the namespace with --jurisdiction ${r.jurisdiction} and add a kv_namespaces binding ({ binding, id })`],[e.usesHyperdrive,`hyperdrive (${o("hyperdrive")}) — { binding: HYPERDRIVE } with a placeholder id; dev uses an embedded Postgres and \`lunora deploy\` creates the config`],[e.usesPipelines,`hint: ${o("pipelines")}; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, stream }) — the pipeline resource can't be auto-provisioned`],[e.usesArtifacts,r.jurisdiction===void 0?`artifacts (${o("artifacts")}) — { binding: ARTIFACTS, namespace }`:`hint: ${o("artifacts")}; the schema pins data to "${r.jurisdiction}", so create the namespace in that jurisdiction first and add { binding: ARTIFACTS, namespace } yourself — \`lunora deploy\` then checks it (a first create() in dev would make it unrestricted)`],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402,`hint: ${o("x402")} (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding for the agent wallet key (name it to match signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars, so the key can't be auto-provisioned`]].filter(([n])=>n).map(([,n])=>n),Te=(e,s,r,t=[],n=[],a=[])=>{const c=new Set(e.map(d=>d.className)),l=e.map(d=>`${d.binding}/${d.className} (exported by worker entry)`);return s.needsD1&&l.push("DB (.global() table declared)"),l.push(...Ie(t,n,a),...Ce(r,c,s)),l},$e=(e,s)=>e.some(r=>r.binding==="SHARD_REGISTRY")||D(s)&&$(y(s,"shardRegistry.ts")),Ye=async e=>{await Q;const s=e.schemaDir??"lunora",r=e.scanDirs??ge,t=()=>xe(e.projectRoot,r,s),n=e.cache===void 0?t():e.cache.memo(`capabilities:${e.projectRoot}:${s}:${r.join(",")}`,t),a=ae(e.projectRoot);let c;a.composed?c=ie(y(e.projectRoot,s,A)).map(C=>({binding:ce[C],className:C})):c=a.path===void 0?[]:de(a.path);const l=_e(e.projectRoot,s,e.cache),d={...l,needsD1:n.needsD1||l.needsD1},E=x(a,Z(e.projectRoot,s,e.cache).containers,"containers"),v=x(a,ue(e.projectRoot,s).workflows,"workflows"),h=x(a,z(e.projectRoot,s).agents,"agents"),R=[...pe(e.projectRoot,s).queues],{flags:S}=le(e.projectRoot,s),b=I(e.projectRoot,s,U,K),_=b.error===void 0?b.value:{hasFcm:!0,hasWebPush:!0},i=S?.provider==="flagship"&&S.mode==="binding"?S.bindingName:void 0,m=$e(c,y(e.projectRoot,s,A)),f=Te(c,d,n,E,v,h);!a.composed&&D(y(e.projectRoot,s,A))&&!c.some(p=>p.className==="LunoraDO")&&f.push("hint: durableObjects.merge is set, but the worker entry exports no LunoraDO — export one built with mergeDurableObjects, or the classes stay separate"),i!==void 0&&f.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${i}", app_id }) — the app_id can't be auto-provisioned`);const u=Y(e.projectRoot),g=u.error===void 0?u.services:void 0;return u.error!==void 0&&f.push(`hint: lunora.config \`services\` not reconciled — ${u.error}`),f.push(...u.services.map(p=>`${p.binding} → ${p.worker} (lunora.config services.${p.name})`)),{...n,agents:h,containers:E,durableObjects:c,flagshipBinding:i,...d.jurisdiction===void 0?{}:{jurisdiction:d.jurisdiction},needsD1:d.needsD1,queues:R,services:g,signals:f,usesFlags:S!==void 0,usesNotifyFcm:_?.hasFcm??!1,usesNotifyWebPush:_?.hasWebPush??!1,hostsShardRegistry:m,workflows:v}},Ke=e=>[...P,...be].filter(([s,r])=>e[s]&&oe[r]!==void 0).map(([,s])=>s);export{Ye as inferLunoraBindings,Ke as secretSourcesFromBindings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=e=>e.endsWith("S")?e.slice(0,-1):e,c=e=>e.replaceAll(/([a-z\d])([A-Z])/gu,"$1_$2").toUpperCase().split(/[_-]+/u).filter(s=>s.length>0),l=new Set(["CREDENTIAL","DSN","PASSPHRASE","PASSWD","PASSWORD","SECRET","TOKEN"]),i=["ACCESS_KEY","API_KEY","ENCRYPTION_KEY","PRIVATE_KEY","SIGNING_KEY"],d=new RegExp(`(?:${[...l,...i.map(e=>e.replaceAll("_",""))].join("|")})S?$`,"iu"),h=e=>c(e).some(s=>s==="PUBLIC"||s==="PUBLISHABLE"),u=e=>{if(h(e))return!1;const s=c(e);if(s.some(o=>l.has(r(o))))return!0;const t=r(s.join("_"));return i.some(o=>t===o||t.endsWith(`_${o}`))||d.test(e)},y=[{description:"Bearer token the local Lunora Studio uses to call the worker's admin endpoints (data browser, schema edits) in dev. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/packages/studio",key:"LUNORA_ADMIN_TOKEN",placeholderValue:"replace-with-openssl-rand-hex-32"}],a="LUNORA_RELAY_SECRET",E="replace-with-openssl-rand-hex-32",k="@lunora/do:shardRegistry",_=["BETTER_AUTH_SECRET","STORAGE_SIGNING_SECRET"],p={"@lunora/auth":[{description:"32-byte random secret used to sign sessions and tokens. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/packages/auth#secrets",key:"AUTH_SECRET",placeholderValue:"replace-with-openssl-rand-hex-32"},{description:"Public base URL of your worker (used by better-auth for redirects and cookie domain). For local dev this is typically http://localhost:8787",docsUrl:"https://lunora.sh/docs/packages/auth#secrets",key:"AUTH_URL",placeholderValue:"http://localhost:8787"}],"@lunora/agent:requestSecretTool":[{description:"AES-256 key that seals secret values held for one agent step, base64 of 32 bytes. Generate with: openssl rand -base64 32. Rotate by moving the old value to LUNORA_SECRET_VALUE_KEY_PREVIOUS first.",docsUrl:"https://lunora.sh/docs/packages/agent#secret-values",key:"LUNORA_SECRET_VALUE_KEY",placeholderValue:"<your-base64-32-byte-key>"}],"@lunora/do:shardRegistry":[{description:"Signs every request to ShardRegistryDO, which refuses unsigned ones, and the shard-to-shard control channel. Set the same value on the worker and every Durable Object. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/concepts/sharding#the-shard-registry",key:a,placeholderValue:E}],"@lunora/bindings/r2sql":[{description:"Cloudflare API token with R2 SQL read access, for `ctx.r2sql`. Create at https://dash.cloudflare.com/profile/api-tokens with the R2 SQL permission.",docsUrl:"https://lunora.sh/docs/packages/bindings#r2-sql",key:"R2_SQL_TOKEN",placeholderValue:"<your-r2-sql-api-token>"},{description:"Cloudflare account id the R2 SQL queries run against. Falls back to CLOUDFLARE_ACCOUNT_ID when unset.",docsUrl:"https://lunora.sh/docs/packages/bindings#r2-sql",key:"R2_SQL_ACCOUNT_ID",placeholderValue:"<your-cloudflare-account-id>"},{description:"Name of the R2 bucket holding the Iceberg tables `ctx.r2sql` queries.",docsUrl:"https://lunora.sh/docs/packages/bindings#r2-sql",key:"R2_SQL_BUCKET",placeholderValue:"<your-r2-sql-bucket>"}],"@lunora/mail":[{description:"Resend API key for sending transactional email via @lunora/mail. Obtain at https://resend.com/api-keys",docsUrl:"https://lunora.sh/docs/packages/mail#secrets",key:"RESEND_API_KEY",placeholderValue:"<your-resend-api-key>"}],"@lunora/notify:fcm":[{description:"Firebase project id for FCM (HTTP v1) push. Found in the Firebase console project settings.",docsUrl:"https://lunora.sh/docs/packages/notify#fcm",key:"FCM_PROJECT_ID",placeholderValue:"<your-firebase-project-id>"},{description:"OAuth2 access token for FCM (HTTP v1). Convenient for dev but expires — in production supply a getAccessToken() in defineNotify instead. Obtain via the Google Cloud SDK / a service account.",docsUrl:"https://lunora.sh/docs/packages/notify#fcm",key:"FCM_ACCESS_TOKEN",placeholderValue:"<your-fcm-access-token>"}],"@lunora/notify:webPush":[{description:"Public VAPID key (base64url) for Web Push. Generate a keypair once with: npx web-push generate-vapid-keys — the public key is also shipped to the browser to subscribe.",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_PUBLIC_KEY",placeholderValue:"<your-vapid-public-key>"},{description:"Private VAPID key (base64url) for Web Push — the application-server signing key. Generate with: npx web-push generate-vapid-keys",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_PRIVATE_KEY",placeholderValue:"<your-vapid-private-key>"},{description:"VAPID `sub` contact — a mailto: or https: URL identifying the application server (e.g. mailto:you@example.com).",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_SUBJECT",placeholderValue:"mailto:you@example.com"}],"@lunora/payment/autumn":[{description:"Autumn secret key (am_sk_…) for the Autumn payment adapter. Obtain at https://app.useautumn.com/dev",docsUrl:"https://lunora.sh/docs/packages/payment#autumn",key:"AUTUMN_SECRET_KEY",placeholderValue:"<your-autumn-secret-key>"},{description:"Autumn webhook signing secret for verifying Standard Webhooks event payloads. Obtain from your Autumn dashboard webhook settings.",docsUrl:"https://lunora.sh/docs/packages/payment#autumn",key:"AUTUMN_WEBHOOK_SECRET",placeholderValue:"<your-autumn-webhook-secret>"}],"@lunora/payment/creem":[{description:"Creem API key for the Creem payment adapter. Obtain at https://www.creem.io/dashboard/developers",docsUrl:"https://lunora.sh/docs/packages/payment#creem",key:"CREEM_API_KEY",placeholderValue:"<your-creem-api-key>"},{description:"Creem webhook signing secret for verifying the creem-signature header. Obtain from your Creem dashboard webhook settings.",docsUrl:"https://lunora.sh/docs/packages/payment#creem",key:"CREEM_WEBHOOK_SECRET",placeholderValue:"<your-creem-webhook-secret>"}],"@lunora/payment/dodopayments":[{description:"Dodo Payments API key (bearer token) for the Dodo Payments adapter. Obtain at https://app.dodopayments.com/developer/api-keys",docsUrl:"https://lunora.sh/docs/packages/payment#dodo-payments",key:"DODO_PAYMENTS_API_KEY",placeholderValue:"<your-dodo-payments-api-key>"},{description:"Dodo Payments webhook signing secret (whsec_…) for verifying event payloads. Obtain at https://app.dodopayments.com/developer/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#dodo-payments",key:"DODO_PAYMENTS_WEBHOOK_KEY",placeholderValue:"<your-dodo-payments-webhook-secret>"}],"@lunora/payment/polar":[{description:"Polar access token for the Polar payment adapter. Obtain at https://polar.sh/settings/tokens",docsUrl:"https://lunora.sh/docs/packages/payment#polar",key:"POLAR_ACCESS_TOKEN",placeholderValue:"<your-polar-access-token>"},{description:"Polar webhook secret for verifying event payloads from Polar. Obtain at https://polar.sh/settings/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#polar",key:"POLAR_WEBHOOK_SECRET",placeholderValue:"<your-polar-webhook-secret>"}],"@lunora/payment/stripe":[{description:"Stripe secret key (sk_test_…). Required when using the Stripe adapter. Obtain at https://dashboard.stripe.com/apikeys",docsUrl:"https://lunora.sh/docs/packages/payment#stripe",key:"STRIPE_SECRET_KEY",placeholderValue:"<your-stripe-secret-key>"},{description:"Stripe webhook signing secret (whsec_…) for verifying event payloads. Obtain at https://dashboard.stripe.com/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#stripe",key:"STRIPE_WEBHOOK_SECRET",placeholderValue:"<your-stripe-webhook-secret>"}]},n=new Set([..._,...[...y,...Object.values(p).flat()].filter(e=>u(e.key)&&!e.placeholderValue.startsWith("<")&&e.key!==a).map(e=>e.key)]),m=e=>e.includes(k)?new Set([...n,a]):n,S=e=>{const s=[];for(const t of e){const o=p[t];o!==void 0&&s.push(...o)}return s};export{y as C,n as M,p as P,a as S,E as a,u as b,h as i,m,S as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{execFile as m}from"node:child_process";import{existsSync as E}from"node:fs";import{win32 as w}from"node:path";const u="0.6.1",h=1e4,p="ETIMEDOUT",T=/[\s&|<>^%"]/u,b=/[/\\]/u,L=/(\d{1,6})\.(\d{1,6})\.(\d{1,6})/u,C=(e,t)=>t==="win32"?{command:T.test(e)?`"${e.replaceAll('"',"")}"`:e,shell:!0}:{command:e,shell:!1},A=(e,t,s)=>{const i=["",...(t.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";").filter(n=>n!=="")];return(b.test(e)?[""]:["",...(t.PATH??t.Path??"").split(";").map(n=>n.replaceAll('"',"")).filter(n=>n!=="")]).some(n=>i.some(l=>s(w.join(n,`${e}${l}`))))},S=async(e,t,{env:s=process.env,exists:i=E,platform:r=process.platform,timeoutMs:n=h}={})=>new Promise(l=>{if(r==="win32"&&!A(e,s,i)){l(void 0);return}const d=C(e,r);m(d.command,[...t],{env:s,killSignal:"SIGKILL",shell:d.shell,timeout:n,windowsHide:!0},(o,c)=>{if(o!==null&&o.killed===!0){l({code:1,error:p,stdout:c});return}if(o!==null&&typeof o.code=="string"){l(o.code==="ENOENT"?void 0:{code:1,error:o.code,stdout:c});return}l({code:o===null?0:Number(o.code??1),stdout:c})})}),a=e=>e.error===p?`did not exit within ${String(h/1e3)}s`:e.error===void 0?`exited with code ${String(e.code)}`:`could not start (${e.error})`,g=(e,t)=>{const[s,i,r]=t.split(".").map(Number);return e[0]!==s?e[0]<s:e[1]!==i?e[1]<i:e[2]<r},D=e=>{const t=L.exec(e);if(t===null)return"could not read a version from `celld --version`, so its version is unchecked";const s=[Number(t[1]),Number(t[2]),Number(t[3])];return g(s,u)?`celld ${s.join(".")} is older than ${u}, the version the celld capability matrix is rated against — some ratings may not hold; upgrade celld`:void 0},_=async e=>{const t=e.env??process.env,s=e.run??((c,f)=>S(c,f,{env:t})),i=[],r=[],n=await s("celld",["--version"]);if(n===void 0)i.push("celld is not on PATH — install it (curl -fsSL https://celld.dev/install.sh | sh) to run the celld target");else if(n.code===0){const c=D(n.stdout);c!==void 0&&r.push(c)}else i.push(`\`celld --version\` ${a(n)} — the celld on PATH does not run; reinstall it`);const l=(t.CELLD_ESBUILD??"").trim(),d=l===""?"esbuild":l,o=await s(d,["--version"]);return o===void 0?i.push(l===""?"esbuild is not on PATH — celld bundles the worker with it":`CELLD_ESBUILD names ${l}, which does not exist — celld bundles the worker with it`):o.code!==0&&i.push(`\`${d} --version\` ${a(o)} — the esbuild celld bundles the worker with does not run`),e.purpose==="deploy"&&e.dryRun!==!0&&(t.CELLD_BUCKET??"").trim()===""&&i.push("CELLD_BUCKET is not set — `celld deploy` writes the deployment to the fleet bucket it names"),{errors:i,warnings:r}};export{C as launchOptions,_ as probeCelldToolchain,S as runCommand};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{readFileSync as ee,writeFileSync as ne}from"node:fs";import{createRequire as se}from"node:module";import{join as Q}from"node:path";import{containerBuildTag as te}from"@lunora/container";import{readJsonSync as ie}from"@visulima/fs";import{LunoraError as oe}from"@lunora/errors";import{applyModify as w}from"./applyModify-DKP2l6S9.mjs";import{a as ae,r as Y}from"./lunora-manifest-DuH_Cmyu.mjs";import{parseTree as re,findNodeAtLocation as de}from"jsonc-parser";import{r as ce,a as le,b as ue,c as ge}from"./reconcile-services-DFqH4eMQ.mjs";import{DEV_VARS_FILE as me,parseDevVariableEntries as pe}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{secretSourcesFromBindings as fe}from"./inferLunoraBindings-BHztYpw9.mjs";import{requiredSecrets as he}from"./buildPackageSecretsBlock-Cb5Ze3_1.mjs";import{w as be,m as ve,s as U,o as P,n as I,p as we}from"./validate-bindings-PVHSAU6M.mjs";import{s as _e}from"./worker-entry-checks-AIASCYl7.mjs";import{DEFAULT_OBSERVABILITY as ye}from"./DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{findWranglerFile as Se,readWranglerJsonc as Ee}from"./WRANGLER_FILES-UNW-xY5u.mjs";const xe=(e,n)=>{if(typeof e!="string"||e.length===0)throw new oe("BAD_REQUEST",`the celld projection needs the Worker's \`name\` to give the id-less binding "${n}" a fleet-wide id; set \`name\` in wrangler.jsonc`);return`${e}-${n}`},Ae=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxConcurrency","max_concurrency"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],B=e=>Object.fromEntries(Ae.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),L="queueTuning",Oe=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,$e=/^[\t ]*,/u,ke=(e,n)=>{const s=re(e),t=s===void 0?void 0:de(s,[...n])?.parent;if(t?.type==="property"){const o=t.offset+t.length,i=e.lastIndexOf(`
|
|
2
|
+
`,t.offset-1)+1,a=Oe.exec(e.slice(o));if(a!==null&&e.slice(i,t.offset).trim()===""){const m=t.parent?.children??[],u=m.indexOf(t),d=u===m.length-1&&u>0?m[u-1]:void 0,c=d===void 0?void 0:$e.exec(e.slice(d.offset+d.length))??void 0;return(c===void 0||d===void 0?e.slice(0,i):e.slice(0,d.offset+d.length)+e.slice(d.offset+d.length+c[0].length,i))+e.slice(o+a[0].length)}}return w(e,n,void 0)},G=(e,n,s,t,o,i=new Set)=>{const a=s.join("."),m={},u=[],d=[];let c=e;return{entries:n.map((l,v)=>{const g=t(l);if(g===void 0||l.queue===void 0)return l;const h=Object.fromEntries(Object.entries(B(g)).filter(([f])=>!i.has(f))),b=Object.entries(o[l.queue]??{}).filter(([f])=>!Object.hasOwn(h,f)),_=Object.entries(h).filter(([f,y])=>l[f]!==y),E=b.filter(([f,y])=>l[f]===y).map(([f])=>f),O=Object.fromEntries(Object.entries({...l,...h}).filter(([f])=>!E.includes(f)));for(const[f,y]of _)c=w(c,[...s,v,f],y);for(const f of E)c=ke(c,[...s,v,f]);for(const[f,y]of b){const A=l[f];A!==void 0&&A!==y&&d.push(`${a}/${l.queue}: ${f} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(A)} from the declared ${JSON.stringify(y)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(_.length>0||E.length>0)&&u.push(`${a}/${l.queue} (${[..._.map(([f])=>f),...E.map(f=>`removed ${f}`)].join(", ")})`),Object.keys(h).length>0&&(m[l.queue]=h),O}),owned:m,text:c,updated:u,warnings:d}},Ne=(e,n,s,t)=>{const o=n.queues??{},i=o.producers??[],a=o.consumers??[],m=new Set(i.map(g=>g?.binding)),u=new Set(a.map(g=>g.queue)),d=s.filter(g=>!m.has(g.bindingName)),c=s.filter(g=>!u.has(g.name)),p=G(e,a,["queues","consumers"],g=>s.find(h=>h.name===g.queue),t);let l=p.text;const v={...p.owned};if(d.length>0||c.length>0){const g=[...i,...d.map(b=>({binding:b.bindingName,queue:b.name}))],h=[...p.entries,...c.map(b=>({queue:b.name,...b.mode==="pull"?{type:"http_pull"}:{},...B(b)}))];for(const b of c){const _=B(b);Object.keys(_).length>0&&(v[b.name]=_)}l=w(l,["queues"],{consumers:h,producers:g})}return{added:[...d.map(g=>`queues.producers/${g.bindingName}`),...c.map(g=>`queues.consumers/${g.name}`)],owned:v,text:l,updated:p.updated,warnings:p.warnings}},Te=(e,n,s,t,o)=>{const i=n.env?.[t],a=i?.queues?.consumers??[],m=i?.queues?.producers??[],u=l=>{const v=m.find(g=>g?.queue===l.queue)?.binding;return v!==void 0?s.find(g=>g.bindingName===v):s.find(g=>g.name===l.queue&&!m.some(h=>h?.binding===g.bindingName))},d=G(e,a,["env",t,"queues","consumers"],u,o,new Set(["dead_letter_queue"])),c=a.filter(l=>l.queue!==void 0&&u(l)===void 0).map(l=>`env.${t}.queues.consumers/${String(l.queue)}: no defineQueue export matches it — this block declares no producer mapping one of their bindings to "${String(l.queue)}", and no export is named that — so it was not retuned. A consumer for a queue another worker produces is skipped the same way.`),p=a.flatMap(l=>{const v=u(l)?.tuning.deadLetterQueue;return v===void 0||l.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(l.queue)}: defineQueue declares deadLetterQueue "${v}", but this consumer has no dead_letter_queue, so its exhausted messages are dropped. Queue names differ per environment, so reconcile does not write it here; add it by hand.`]});return{added:[],owned:d.owned,text:d.text,updated:d.updated,warnings:[...d.warnings,...p,...c]}},Ce=(e,n)=>{if(e?.lunoraIsForeign===!0)return n.push(`${e.path}: \`lunora\` is not an object, so the queue tuning ownership record cannot be read or written — an option removed from defineQueue stays deployed.`),{};const s=e?.lunora?.[L],t=o=>typeof o=="object"&&o!==null&&!Array.isArray(o);return s===void 0?{}:!t(s)||!Object.values(s).every(o=>t(o)&&Object.values(o).every(i=>t(i)))?(n.push(`${e?.path??"package.json"}: \`lunora.${L}\` is not a map of scope → queue → fields, so it is ignored — an option removed from defineQueue stays deployed until the next pass records it again.`),{}):s},Ie=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,o])=>Object.keys(o).length>0));ae(e,L,Object.keys(t).length===0?void 0:t)},je="https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/artifacts/namespaces",Re=e=>{const n='add an "artifacts" binding ({ binding: "ARTIFACTS", namespace }) — codegen reads env.ARTIFACTS unless `.artifacts()` on defineApp points ctx.artifacts at another binding';return e===void 0?`ctx.artifacts is used; ${n}. The namespace is created by the first repo create() if it does not exist yet.`:`ctx.artifacts is used and the schema pins data to "${e}"; create the namespace in that jurisdiction BEFORE the first repo, with POST ${je} and body { "namespace": "<name>", "jurisdiction": "${e}" }, then ${n}. A namespace's jurisdiction cannot be changed, and one created implicitly by the first repo create() is unrestricted. With CLOUDFLARE_API_TOKEN set, \`lunora deploy\` creates a missing namespace in that jurisdiction for a binding you have added.`},j="PIPELINES",R="ARTIFACTS",De=(e,n,s)=>{const t=n!==void 0&&(s===void 0||s==="cloudflare"),o=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(d=>d.binding===e.flagshipBinding),i=e.usesPipelines&&!(n?.pipelines??[]).some(d=>d.binding===j),a=e.usesArtifacts?n?.artifacts??[]:[],m=a.some(d=>d.binding===R)?[]:a.flatMap(d=>d.binding===void 0?[]:[d.binding]);return[[e.usesKv&&(n?.kv_namespaces?.length??0)===0&&(!t||e.jurisdiction!==void 0),e.jurisdiction===void 0?'ctx.kv is used but no kv_namespaces binding exists; add one ({ binding: "KV" }) — wrangler creates the namespace on the first deploy.':`ctx.kv is used and the schema pins data to "${e.jurisdiction}"; run \`wrangler kv namespace create <name> --jurisdiction ${e.jurisdiction}\` and add a kv_namespaces entry ({ binding: "KV", id }) — a namespace wrangler creates on deploy is unrestricted.`],[e.usesHyperdrive&&(n?.hyperdrive?.length??0)===0&&!t,'@lunora/hyperdrive is used but no hyperdrive binding exists; add one ({ binding: "HYPERDRIVE", id }) — on a Cloudflare target `lunora deploy` creates the Hyperdrive config from a connection string.'],[e.usesArtifacts&&a.length===0&&(!t||e.jurisdiction!==void 0),Re(e.jurisdiction)],[i,`ctx.pipelines is used but no "${j}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${j}", stream }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[m.length>0,`ctx.artifacts is used and ${m.map(d=>`"${d}"`).join(", ")} ${m.length===1?"is":"are"} bound, but none is named "${R}"; make sure \`.artifacts()\` on defineApp points ctx.artifacts at it — otherwise it reads env.${R} and throws.`],[o,`lunora/flags.ts uses Flagship in binding mode but no flagship binding "${e.flagshipBinding??""}" exists; add a flagship entry ({ binding: "${e.flagshipBinding??""}", app_id }) — the app_id can't be auto-provisioned.`]].filter(([d])=>d).map(([,d])=>d)},qe=e=>[[e.usesX402Charge,"@lunora/x402/charge is used; set the recipient wallet address as a [vars] entry (the var name is your choice) and pass it to the charge config — the x402 facilitator settles USDC to that address."],[e.usesX402,"@lunora/x402/pay is used (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding holding the agent wallet key (binding name == signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars."]].filter(([s])=>s).map(([,s])=>s),D=(e,n,s)=>s.filter(t=>!t.exported).map(t=>`${e} "${t.exportName}" is declared but ${t.className} is not exported by the worker entry; add \`export * from "./lunora/_generated/${n}"\` so its binding can be provisioned.`),Pe=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(i=>i.className));if(s.size===0)return[];const t=Object.entries(n.exports??{}).flatMap(([i,a])=>a?.type==="workflow"?[i]:[]),o=(n.workflows??[]).flatMap(i=>i.class_name===void 0||i.script_name!==void 0?[]:[i.class_name]);return[...new Set([...t,...o])].filter(i=>!s.has(i)).map(i=>`wrangler.jsonc declares workflow "${i}" but no defineWorkflow/defineAgent export generates that class — a leftover from a rename will fail the deploy (wrangler rejects a class the worker does not export). Remove it if it is not hand-wired.`)},Be=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(o=>o.name)),t=new Set(e.queues.map(o=>o.bindingName));return[...(n.queues?.consumers??[]).flatMap(o=>{const{queue:i}=o;return i===void 0||s.has(i)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${i}" but no defineQueue export declares that queue — a leftover from a rename keeps delivering batches this worker has no handler for (they retry to exhaustion, then drop or dead-letter). Remove it if it is not hand-wired.`]}),...(n.queues?.producers??[]).flatMap(o=>{const i=o?.binding;return i===void 0||t.has(i)?[]:[`wrangler.jsonc declares queues.producers[] binding "${i}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},Le=(e,n)=>[...Pe(e,n),...Be(e,n)],J=[{keys:["STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"],label:"Stripe"},{keys:["POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"],label:"Polar"},{keys:["CREEM_API_KEY","CREEM_WEBHOOK_SECRET"],label:"Creem"},{keys:["AUTUMN_SECRET_KEY","AUTUMN_WEBHOOK_SECRET"],label:"Autumn"},{keys:["DODO_PAYMENTS_API_KEY","DODO_PAYMENTS_WEBHOOK_KEY"],label:"Dodo Payments"}],We=()=>J.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),Me=e=>{let n;try{n=ee(Q(e,me),"utf8")}catch{return!1}const s=new Map(pe(n).map(t=>[t.key,t.value]));return J.some(({keys:t})=>t.every(o=>(s.get(o)??"")!==""))},Ke=(e,n)=>{const s=n?.secrets?.required;if(!Array.isArray(s))return[];const t=new Set(s),o=he(fe(e)).map(i=>i.key).filter(i=>!t.has(i));return o.length===0?[]:[`wrangler.jsonc declares secrets.required without ${o.join(", ")}, which this app needs — wrangler dev loads only the listed keys from .dev.vars, so add ${o.length===1?"it":"them"} to secrets.required.`]},q=(e,n,s,t)=>{const o=new Set(e.durableObjects.map(u=>u.className)),i=[],a=(s?.r2_buckets?.length??0)>0,m=(s?.d1_databases?.some(u=>u.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!a&&i.push("@lunora/storage is used but R2 bucket bindings have user-defined names; add an r2_buckets entry and pass env.<BINDING> to createStorage()."),e.usesAuth&&!o.has("SessionDO")&&!m&&i.push("@lunora/auth is used but the worker entry exports no SessionDO; sessions are D1-backed, or export SessionDO to enable DO-backed sessions."),e.usesScheduler&&!o.has("SchedulerDO")&&i.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),i.push(...D("container","containers",e.containers),...D("workflow","workflows",e.workflows),...D("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&i.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayments&&!Me(n)&&i.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${We()}.`),i.push(...qe(e),...De(e,s,t),...Ke(e,s)),s!==void 0&&i.push(...Le(e,s)),i},X="<replace-with-d1-create-id>",Fe="<replace-with-hyperdrive-create-id>",He=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,o])=>o.filter(i=>!i.exported).map(({className:i,exportName:a})=>({className:i,exportName:a,kind:s,module:t}))),Ye=e=>{const n=new Set(P(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},Ve=e=>{const n=new Set;for(const s of P(e)){for(const t of I(s.deleted_classes))n.delete(t);for(const{from:t,to:o}of P(s.renamed_classes))t!==void 0&&n.delete(t),o!==void 0&&n.add(o);for(const t of[...I(s.new_classes),...I(s.new_sqlite_classes)])n.add(t)}return n},Qe=(e,n,s)=>{const t=n.durable_objects?.bindings??[],o=new Set(t.map(c=>c.name)),i=s.filter(c=>!o.has(c.binding));let a=e;const m=[];if(i.length>0){const c=[...t,...i.map(p=>({class_name:p.className,name:p.binding}))];a=w(a,["durable_objects","bindings"],c),m.push(...i.map(p=>`${p.binding}/${p.className}`))}const u=n.migrations??[],d=s.map(c=>c.className).filter(c=>!Ve(u).has(c));if(d.length>0){const c=[...u,{new_sqlite_classes:d,tag:Ye(u)}];a=w(a,["migrations"],c)}return{added:m,text:a}},M=e=>e===void 0||e==="cloudflare",Ue=(e,n)=>e.includes("DB (D1)")&&M(n)?[`wrote a DB binding with a placeholder database_id ("${X}") — run \`wrangler d1 create <name>\` and replace it before deploying.`]:[],Ge=(e,n)=>{const s=n.d1_databases??[];if(s.some(i=>i.binding==="DB"))return{added:[],text:e};const t=typeof n.name=="string"&&n.name.length>0?n.name:"lunora",o=[...s,{binding:"DB",database_id:X,database_name:t}];return{added:["DB (D1)"],text:w(e,["d1_databases"],o)}},Je={ai:{binding:"AI",label:"AI (Workers AI)"},analytics:{binding:"ANALYTICS_SQL",label:"ANALYTICS_SQL (Analytics SQL)"},browser:{binding:"BROWSER",label:"BROWSER (Browser Rendering)"},images:{binding:"IMAGES",label:"IMAGES (Cloudflare Images)"}},k=(e,n,s)=>{const{binding:t,label:o}=Je[s],i=n[s]?.binding;return typeof i=="string"&&i.length>0?{added:[],text:e}:{added:[o],text:w(e,[s],{binding:t})}},Xe=(e,n)=>e.usesAnalyticsSql&&_e(n,new Set(["analyticsSql"]))?.chained.has("analyticsSql")!==!0,ze=new Set(["ratelimits","send_email"]),Ze=["durable_objects","logfwdr","unsafe"],en=new Set(["data_blobs","text_blobs","vars","wasm_modules"]),K=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),W=(e,n,s)=>K(e)&&e[n]===s,nn=(e,n,s)=>{if(en.has(e))return K(n)&&Object.hasOwn(n,s);const t=ze.has(e)?"name":"binding";return Array.isArray(n)?n.some(o=>W(o,t,s)):W(n,"binding",s)},N=(e,n)=>{const s=e,t=Object.entries(s).find(([i,a])=>i!=="env"&&nn(i,a,n));if(t!==void 0)return t[0];for(const i of Ze){const a=s[i];if(K(a)&&Array.isArray(a.bindings)&&a.bindings.some(m=>W(m,"name",n)))return`${i}.bindings`}if(e.queues?.producers?.some(i=>i?.binding===n)===!0)return"queues.producers";const o=e.secrets?.required;if(Array.isArray(o)&&o.includes(n))return"secrets.required"},F=(e,n,s)=>`${e}: not adding "${n}" — the name is already bound by \`${s}\` in wrangler.jsonc. Add a ${e} entry under another binding name and point the matching \`defineApp()\` override at it.`,sn=(e,n,s)=>{if(!M(s)||(n.hyperdrive?.length??0)>0)return{added:[],text:e};const t=N(n,"HYPERDRIVE");return t!==void 0?{added:[],text:e,warnings:[F("hyperdrive","HYPERDRIVE",t)]}:{added:["HYPERDRIVE (Hyperdrive, created on deploy)"],text:w(e,["hyperdrive"],[{binding:"HYPERDRIVE",id:Fe}])}},tn=new Set(["celld","cloudflare"]),on=(e,n,s,t)=>{if(t!==void 0&&!tn.has(t)||s!==void 0||(n.kv_namespaces?.length??0)>0)return{added:[],text:e};const o=N(n,"KV");return o!==void 0?{added:[],text:e,warnings:[F("kv_namespaces","KV",o)]}:{added:[t==="celld"?`KV (Workers KV, celld namespace ${xe(n.name,"KV")})`:"KV (Workers KV, created on deploy)"],text:w(e,["kv_namespaces"],[{binding:"KV"}])}},an=(e,n,s,t)=>{if(!M(t)||s!==void 0||(n.artifacts?.length??0)>0)return{added:[],text:e};const o=N(n,"ARTIFACTS");if(o!==void 0)return{added:[],text:e,warnings:[F("artifacts","ARTIFACTS",o)]};const i=typeof n.name=="string"&&n.name.length>0?n.name:"lunora";return{added:["ARTIFACTS (Cloudflare Artifacts)"],text:w(e,["artifacts"],[{binding:"ARTIFACTS",namespace:i}])}},V=(e,n,s,t,o)=>{if((n[s]?.length??0)>0)return{added:[],text:e};const i=N(n,t.binding);return i!==void 0?{added:[],text:e,warnings:[`${s}: not adding ${JSON.stringify(t)} — the name "${t.binding}" is already bound by \`${i}\` in wrangler.jsonc. Add a ${s} entry under another binding name and point the matching \`defineApp()\` override at it.`]}:{added:[o],text:w(e,[s],[t])}},rn=(e,n)=>{const s=n.worker_loaders??[];return s.some(t=>t.binding==="LOADER")?{added:[],text:e}:{added:["LOADER (Worker Loader)"],text:w(e,["worker_loaders"],[...s,{binding:"LOADER"}])}},dn=e=>{if(typeof e=="string")return e;const n={};return e.diskMb!==void 0&&(n.disk_mb=e.diskMb),e.memoryMib!==void 0&&(n.memory_mib=e.memoryMib),e.vcpu!==void 0&&(n.vcpu=e.vcpu),n},cn=e=>{const{image:n}=e;return n.kind==="dockerfile"?n.dockerfilePath:n.kind==="registry"?n.reference:te(e.exportName)},z=e=>{const n={};for(const[s,t]of Object.entries(e.images??{}))n[s]=t.kind==="registry"?{image:t.reference}:{build_context:t.buildContext,dockerfile:t.dockerfilePath,...e.buildArgs===void 0?{}:{build_vars:e.buildArgs}};return{class_name:e.className,scheduling_policy:"durable_object",...Object.keys(n).length>0?{images:n}:{},...e.name===void 0?{}:{name:e.name}}},ln=e=>{if(e.schedulingPolicy==="durable_object")return z(e);const{image:n}=e,s={class_name:e.className,image:cn(e)};return n.kind==="dockerfile"&&(s.image_build_context=n.buildContext),e.buildArgs!==void 0&&n.kind!=="registry"&&(s.image_vars=e.buildArgs),e.instanceType!==void 0&&(s.instance_type=dn(e.instanceType)),e.maxInstances!==void 0&&(s.max_instances=e.maxInstances),e.name!==void 0&&(s.name=e.name),e.rollout?.stepPercentage!==void 0&&(s.rollout_step_percentage=e.rollout.stepPercentage),e.rollout?.gracePeriodSeconds!==void 0&&(s.rollout_active_grace_period=e.rollout.gracePeriodSeconds),s},un=(e,n,s)=>{const t=n.containers??[],o=new Set(t.map(d=>d.class_name)),i=s.filter(d=>!o.has(d.className));let a=i.length===0?e:w(e,["containers"],[...t,...i.map(d=>ln(d))]);const m=[],u=[];for(const[d,c]of t.entries()){const p=s.find(g=>g.className===c.class_name);if(p===void 0)continue;const l=p.schedulingPolicy??"default";if((c.scheduling_policy??"default")!==l){u.push(`containers/${p.className} has scheduling_policy "${c.scheduling_policy??"default"}" in wrangler.jsonc but defineContainer "${p.exportName}" declares "${l}" — the policy is immutable, so replace the entry (and its container application) by hand.`);continue}const v=p.schedulingPolicy==="durable_object"?z(p).images:void 0;v!==void 0&&JSON.stringify(c.images)!==JSON.stringify(v)&&(a=w(a,["containers",d,"images"],v),m.push(`containers/${p.className}.images`))}return{added:i.map(d=>`containers/${d.className}`),text:a,updated:m,warnings:u}},gn=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=w(e,["observability"],{...ye});return{added:["observability"],text:s}},mn=(e,n)=>n.upload_source_maps!==void 0?{added:[],text:e}:{added:["upload_source_maps"],text:w(e,["upload_source_maps"],!0)},Z=[{minimum:[4,142],name:"wrangler"},{minimum:[1,61],name:"@cloudflare/vite-plugin"}],pn=Z.map(({minimum:e,name:n})=>`${n}@^${e.join(".")}.0`).join(" "),fn=(e,n)=>{try{const s=se(Q(e,"package.json")).resolve(`${n}/package.json`),[t=0,o=0]=String(ie(s).version).split(".").map(Number);return[t,o]}catch{return}},hn=e=>{const n=Z.flatMap(({minimum:s,name:t})=>{const o=fn(e,t);return o!==void 0&&(o[0]<s[0]||o[0]===s[0]&&o[1]<s[1])?[`${t} ${o.join(".")} (needs >= ${s.join(".")})`]:[]});return n.length===0?void 0:`workflows are declared in wrangler \`exports\`, which ${n.join(" and ")} cannot run — reconcile left workflows[] untouched. Upgrade (\`pnpm add -D ${pn}\`) and re-run.`},bn=e=>Object.entries(e.env??{}).flatMap(([n,s])=>Array.isArray(s?.workflows)?[`env.${n}.workflows declares workflow bindings, but Lunora now declares workflows in \`exports\` and resolves them on ctx.exports — move them to that environment's own \`exports\` by hand.`]:[]),vn=(e,n,s)=>{let t=e;const o=[],i=[];for(const a of s){const m=n[a.className];if(m?.type==="workflow")for(const{of:u,path:d}of we){const c=u(a),p=U(m,d),l=`exports/${a.className}.${d.join(".")}`;if(c===void 0){p!==void 0&&i.push(`${l} is set in wrangler.jsonc but defineWorkflow "${a.exportName}" does not declare it — reconcile leaves it in place. Remove it by hand if it was dropped from the definition.`);continue}JSON.stringify(p)!==JSON.stringify(c)&&(t=w(t,["exports",a.className,...d],c),o.push(l))}}return{text:t,updated:o,warnings:i}},wn=(e,n,s,t,o)=>{if(o!==void 0)return{added:[],text:e,warnings:[o]};const i=[...s.map(h=>({settings:be(h),workflow:h})),...t.map(h=>({settings:{},workflow:h}))],a=new Set(i.map(({workflow:h})=>h.className)),m=n.workflows??[],u=m.filter(h=>h.script_name===void 0&&h.class_name!==void 0&&a.has(h.class_name)),d=n.exports??{},c=[],p=[],l=[];let v=e;for(const{settings:h,workflow:b}of i){if(d[b.className]!==void 0&&d[b.className]!==null)continue;const _=u.find(f=>f.class_name===b.className),E=Object.fromEntries(ve.flatMap(f=>{const y=U(_,[f]);return y===void 0?[]:[[f,y]]})),O=_?.name??b.name;_?.name!==void 0&&_.name!==b.name&&l.push(`workflows/${b.className} is deployed as "${_.name}" but declared as "${b.name}" — its export keeps "${_.name}" so running instances survive. Change the declaration to match, or rename deliberately (it starts a new, empty workflow).`),v=w(v,["exports",b.className],{type:"workflow",...E,...h,name:O}),(_===void 0?c:p).push(`exports/${b.className}`)}if(u.length>0){const h=m.filter(b=>!u.includes(b));v=w(v,["workflows"],h.length===0?void 0:h),p.push(...u.map(b=>`workflows/${String(b.class_name)} → exports`))}l.push(...bn(n));const g=vn(v,d,s);return{added:c,text:g.text,updated:[...p,...g.updated],warnings:[...l,...g.warnings]}},Pn=(e,n,{environment:s,target:t}={})=>{const o=Se(e),i=He(n);if(!o)return{added:[],changed:!1,exportGaps:i,reason:"wrangler.jsonc not found",updated:[],warnings:q(n,e)};const{parsed:a,text:m}=Ee(o);if(a===void 0)return{added:[],changed:!1,exportGaps:i,reason:`failed to parse ${o} as JSONC`,updated:[],warnings:q(n,e),wranglerPath:o};const u=q(n,e,a,t);if(s!==void 0){const r=a.env?.[s]!==void 0;u.push(r?`auto-provisioned bindings are written to the top level of wrangler.jsonc only (queue consumers "env.${s}" already declares are retuned, nothing is added) — "env.${s}" has its own (non-inheritable) bindings and must be reconciled by hand; \`lunora deploy --env ${s}\` now validates them, so a gap here will be reported at deploy time.`:`--env "${s}" was requested but wrangler.jsonc declares no "env.${s}" block — auto-provisioned bindings are written to the top level only and will not apply to that environment.`)}const d=n.containers.filter(r=>r.exported),c=n.agents.filter(r=>r.exported&&r.voice===!0&&r.voiceBindingName!==void 0&&r.voiceClassName!==void 0),p=[...n.durableObjects,...d.map(r=>({binding:r.bindingName,className:r.className})),...c.map(r=>({binding:r.voiceBindingName,className:r.voiceClassName}))],l=n.workflows.filter(r=>r.exported),v=n.agents.filter(r=>r.exported),g=Y(e),h=Ce(g,u),b={},_=ce(g);let E;const O=[{enabled:!0,run:r=>Qe(r,a,p)},{enabled:n.needsD1,run:r=>Ge(r,a)},{enabled:n.usesKv,run:r=>on(r,a,n.jurisdiction,t)},{enabled:n.usesHyperdrive,run:r=>sn(r,a,t)},{enabled:n.usesArtifacts,run:r=>an(r,a,n.jurisdiction,t)},{enabled:n.usesAi,run:r=>k(r,a,"ai")},{enabled:n.usesAiSearch,run:r=>V(r,a,"ai_search_namespaces",{binding:"AI_SEARCH",namespace:"default"},"AI_SEARCH (AI Search namespace)")},{enabled:Xe(n,e),run:r=>k(r,a,"analytics")},{enabled:n.usesBrowser,run:r=>k(r,a,"browser")},{enabled:n.usesImages,run:r=>k(r,a,"images")},{enabled:n.usesAnalytics,run:r=>V(r,a,"analytics_engine_datasets",{binding:"ANALYTICS",dataset:"ANALYTICS"},"ANALYTICS (Analytics Engine)")},{enabled:n.usesWorkerLoader,run:r=>rn(r,a)},{enabled:!0,run:r=>gn(r,a)},{enabled:t===void 0||t==="cloudflare",run:r=>mn(r,a)},{enabled:d.length>0,run:r=>un(r,a,d)},{enabled:l.length>0||v.length>0,run:r=>wn(r,a,l,v,hn(e))},{enabled:n.queues.length>0,run:r=>{const S=Ne(r,a,n.queues,h.queues??{});return b.queues=S.owned,S}},{enabled:n.services!==void 0&&(n.services.length>0||Object.keys(_).length>0),run:r=>{const S=le(r,a,n.services??[],_);return E=S.owned,S}},...s===void 0||a.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:r=>{const S=`env.${s}.queues`,$=Te(r,a,n.queues,s,h[S]??{});return b[S]=$.owned,$}}]];let f=m;const y=[],A=[];for(const r of O){if(!r.enabled)continue;const S=r.run(f);f=S.text,y.push(...S.added),A.push(...S.updated??[]),u.push(...S.warnings??[])}const H=r=>{if(g===void 0)return;const S=E,$=[...Object.keys(b).length>0?[{consequence:"an option removed from defineQueue stays deployed",key:"queueTuning",label:"queue tuning",write:x=>{Ie(x,h,b)}}]:[],...S===void 0?[]:[{consequence:"a service removed from lunora.config stays bound",key:"services",label:"service bindings",write:x=>{ge(x,S)}}]];for(const x of $)try{x.write(Y(e)??g)}catch(C){u.push(`${r?"wrangler.jsonc was updated, but ":""}recording the ${x.label} reconcile owns in ${g.path} (lunora.${x.key}) failed: ${C instanceof Error?C.message:String(C)}. Until it is recorded, ${x.consequence}.`)}};let T;if(n.services!==void 0){const r=ue(e,n.services,_);u.push(...r.warnings),E={...E,...r.owned},T=r.added.length>0||r.updated.length>0?{added:r.added,path:r.path,updated:r.updated}:void 0}return u.push(...Ue(y,t)),f===m?(H(!1),{added:y,changed:!1,devConfig:T,exportGaps:i,reason:"bindings already in sync",updated:A,warnings:u,wranglerPath:o}):(ne(o,f,"utf8"),H(!0),{added:y,changed:!0,devConfig:T,exportGaps:i,updated:A,warnings:u,wranglerPath:o})};export{X as D,Fe as H,xe as a,He as c,Pn as r};
|
package/dist/packem_shared/{infer-bindings.d-C9ktoVW4.d.ts → reconcile-bindings.d-LHrpR4kY.d.mts}
RENAMED
|
@@ -183,6 +183,8 @@ interface InferredBindings {
|
|
|
183
183
|
* un-mintable `app_id`, so it is reconciled as a hint, not auto-written.
|
|
184
184
|
*/
|
|
185
185
|
flagshipBinding?: string;
|
|
186
|
+
/** The app hosts the registry (exports or binds `ShardRegistryDO`, or is merged with its module), so it mints the `LUNORA_RELAY_SECRET` its registry checks. */
|
|
187
|
+
hostsShardRegistry: boolean;
|
|
186
188
|
/**
|
|
187
189
|
* The schema's `.jurisdiction("…")`, when it declares one. Read by the binding
|
|
188
190
|
* hints whose resource takes its residency at creation (Artifacts), so the
|
|
@@ -297,4 +299,104 @@ declare const inferLunoraBindings: (options: InferOptions) => Promise<InferredBi
|
|
|
297
299
|
* ({@link SECRET_SOURCE_FLAGS}), keeping only sources that carry secrets.
|
|
298
300
|
*/
|
|
299
301
|
declare const secretSourcesFromBindings: (bindings: InferredBindings) => string[];
|
|
300
|
-
|
|
302
|
+
/**
|
|
303
|
+
* Placeholder `database_id` written for an auto-provisioned `DB` binding. It is
|
|
304
|
+
* intentionally not a valid id so a deploy can't silently target the wrong
|
|
305
|
+
* database; reconciliation warns the user to replace it (see the D1 warning in
|
|
306
|
+
* `reconcileWranglerBindings`).
|
|
307
|
+
*/
|
|
308
|
+
declare const D1_PLACEHOLDER_ID = "<replace-with-d1-create-id>";
|
|
309
|
+
/**
|
|
310
|
+
* The `id` reconcile writes on a Hyperdrive binding it adds, and the one the `hyperdrive`
|
|
311
|
+
* registry item ships: wrangler requires a string, and `lunora dev` serves the binding from an
|
|
312
|
+
* embedded Postgres whatever it is. `lunora deploy` swaps in a real id.
|
|
313
|
+
*/
|
|
314
|
+
declare const HYPERDRIVE_PLACEHOLDER_ID = "<replace-with-hyperdrive-create-id>";
|
|
315
|
+
/**
|
|
316
|
+
* A container/workflow that is declared (so codegen emits its class) but the
|
|
317
|
+
* worker entry never re-exports — the one wiring step the generators can't always
|
|
318
|
+
* do for the developer. wrangler rejects a `class_name` the deployed worker
|
|
319
|
+
* doesn't export, so a deploy fails late on this; surfacing it as structured data
|
|
320
|
+
* lets the Vite plugin raise it in the dev error overlay (not just the console)
|
|
321
|
+
* the moment the gap appears. The human-readable form is also folded into
|
|
322
|
+
* {@link ReconcileBindingsResult.warnings}.
|
|
323
|
+
*/
|
|
324
|
+
interface ExportGap {
|
|
325
|
+
/** Generated class wrangler needs exported, e.g. `OrderPipelineWorkflow`. */
|
|
326
|
+
className: string;
|
|
327
|
+
/** The `lunora/{agents,containers,workflows}.ts` export name, e.g. `orderPipeline`. */
|
|
328
|
+
exportName: string;
|
|
329
|
+
/** Which declaration is unexported. */
|
|
330
|
+
kind: "agent" | "container" | "workflow";
|
|
331
|
+
/** The `_generated/{module}` to re-export from, e.g. `workflows`. */
|
|
332
|
+
module: GeneratedClassModule;
|
|
333
|
+
}
|
|
334
|
+
interface ReconcileBindingsResult {
|
|
335
|
+
/** Short labels for each binding written (e.g. `"SCHEDULER/SchedulerDO"`). */
|
|
336
|
+
added: string[];
|
|
337
|
+
/** `true` when `wrangler.jsonc` was rewritten. */
|
|
338
|
+
changed: boolean;
|
|
339
|
+
/** What was written to the SvelteKit / Nuxt dev sidecar's own config, when anything was. */
|
|
340
|
+
devConfig?: {
|
|
341
|
+
added: string[];
|
|
342
|
+
path: string;
|
|
343
|
+
updated: string[];
|
|
344
|
+
};
|
|
345
|
+
/**
|
|
346
|
+
* Declared containers/workflows the worker entry doesn't re-export — the
|
|
347
|
+
* structured form of the corresponding `warnings` entries, for the dev error
|
|
348
|
+
* overlay. Empty when every declaration is wired.
|
|
349
|
+
*/
|
|
350
|
+
exportGaps: ExportGap[];
|
|
351
|
+
/** Reason reconciliation was skipped, for logging. */
|
|
352
|
+
reason?: string;
|
|
353
|
+
/**
|
|
354
|
+
* Short labels for each EXISTING entry whose settings were brought in line
|
|
355
|
+
* with its declaration (e.g. `"queues.consumers/receipt-queue (max_retries)"`).
|
|
356
|
+
* Kept apart from `added` so a retune is not logged as a new binding.
|
|
357
|
+
*/
|
|
358
|
+
updated: string[];
|
|
359
|
+
/** Non-fatal hints for capabilities that cannot be auto-provisioned. */
|
|
360
|
+
warnings: string[];
|
|
361
|
+
/** Resolved wrangler path, or `undefined` when none was found. */
|
|
362
|
+
wranglerPath?: string;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* The declared-but-not-re-exported containers and workflows, as structured
|
|
366
|
+
* {@link ExportGap}s. The same gaps `collectWarnings` renders into prose — kept
|
|
367
|
+
* here as data so the Vite plugin can raise them in the error overlay with a
|
|
368
|
+
* precise remediation, rather than re-parsing the warning strings.
|
|
369
|
+
*
|
|
370
|
+
* Exported because reconciliation is not the only caller that needs the answer:
|
|
371
|
+
* `lunora codegen` and `lunora doctor` both want the gaps WITHOUT rewriting
|
|
372
|
+
* `wrangler.jsonc`, which is the rest of what {@link reconcileWranglerBindings}
|
|
373
|
+
* does. Deriving them again from `inferred.{containers,workflows,agents}` at each
|
|
374
|
+
* call site is how one kind ends up silently uncovered.
|
|
375
|
+
*/
|
|
376
|
+
declare const collectExportGaps: (inferred: InferredBindings) => ExportGap[];
|
|
377
|
+
/**
|
|
378
|
+
* Reconcile inferred Durable Object / D1 bindings into `wrangler.jsonc`.
|
|
379
|
+
*
|
|
380
|
+
* Writes only when something is missing; returns `changed: false` when the
|
|
381
|
+
* config already satisfies the inferred needs.
|
|
382
|
+
*
|
|
383
|
+
* `environment`, when passed, does NOT change where this provisions — every
|
|
384
|
+
* step below still only ADDS to the TOP-LEVEL config; wrangler's `env.<name>`
|
|
385
|
+
* blocks have no auto-provisioning path today. The one write into the block is
|
|
386
|
+
* {@link reconcileEnvQueues}, which retunes queue consumers the block already
|
|
387
|
+
* declares and adds nothing. Otherwise it is used only to emit an
|
|
388
|
+
* advisory warning, because bindings (`durable_objects`, `d1_databases`, …)
|
|
389
|
+
* are non-inheritable (see `wrangler-environment.ts`'s `NON_INHERITABLE_KEYS`):
|
|
390
|
+
* a `--env production` deploy needs its OWN copy of each one, and silently
|
|
391
|
+
* writing only to the top level would leave that gap unmentioned. Extending
|
|
392
|
+
* the JSONC writer itself to target `env.<name>.*` idempotently for every
|
|
393
|
+
* binding kind here is a separate, larger change (each of the ~10 pipeline
|
|
394
|
+
* steps below reads AND writes the top-level path) that this fix does not
|
|
395
|
+
* attempt — `lunora deploy --env <name>` now VALIDATES the env-scoped view
|
|
396
|
+
* (closing the reported gap), it just doesn't yet auto-provision it.
|
|
397
|
+
*/
|
|
398
|
+
declare const reconcileWranglerBindings: (projectRoot: string, inferred: InferredBindings, { environment, target }?: {
|
|
399
|
+
environment?: string;
|
|
400
|
+
target?: string;
|
|
401
|
+
}) => ReconcileBindingsResult;
|
|
402
|
+
export { COMPOSED_WORKER_ENTRY as C, DiscoveryCache as D, ExportGap as E, GENERATED_CLASS_MODULES as G, HYPERDRIVE_PLACEHOLDER_ID as H, InferOptions as I, MERGED_DURABLE_OBJECTS_MODULE as M, ReconcileBindingsResult as R, SchemaInfo as S, D1_PLACEHOLDER_ID as a, DURABLE_OBJECT_BINDINGS as b, collectExportGaps as c, DiscoverSchemaInfoResult as d, GENERATED_MODULE_DURABLE_OBJECTS as e, GeneratedClassModule as f, InferredAgent as g, InferredBindings as h, InferredContainer as i, InferredWorkflow as j, createDiscoveryCache as k, discoverSchemaInfo as l, inferLunoraBindings as m, isMergedProject as n, isMergedRoleModule as o, reconcileWranglerBindings as r, secretSourcesFromBindings as s };
|