@lunora/config 1.0.0-alpha.84 → 1.0.0-alpha.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-B54hVQ_w.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-BJm0QtoI.mjs";import{AGENT_RULES_DIR as n,AGENT_RULES_HINT as l,AGENT_RULES_HINT_ENV as _,LUNORA_SKILL_NAMES as c,ROOT_SKILL_NAME as s,claimAgentRulesHint as m,detectAgentRules as p}from"./packem_shared/AGENT_RULES_DIR-hP9TiDNx.mjs";import{discoverContainerInfo as d}from"./packem_shared/discoverContainerInfo-CYG9j2LY.mjs";import{streamContainerLogs as A}from"./packem_shared/streamContainerLogs-BPYBNrWS.mjs";import{detectFramework as L,readProjectDependencyNames as D}from"./packem_shared/detectFramework-VTQfCNXy.mjs";import{DEV_DAEMON_ENV as I,DEV_HANDOFF_ENV as v,DEV_LOG_FILE as g,DEV_LOG_FILE_ENV as x,DEV_STATE_DIR as T,DEV_STATE_FILE as V,claimDevServerState as C,clearDevServerState as F,isProcessAlive as P,isRecordedProcessCurrent as O,readDevServerState as u,readLiveDevServerState as G,updateDevServerState as W,writeDevServerState as U}from"./packem_shared/DEV_DAEMON_ENV-D9Z83rlU.mjs";import{DEV_VARS_EXAMPLE_FILE as B,DEV_VARS_FILE as M,DEV_VARS_KEY_PATTERN as K,parseDevVariableEntries as k}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-DX6xGbpr.mjs";import{inferLunoraBindings as w,packageNamesFromBindings as h}from"./packem_shared/inferLunoraBindings-DWSabh1j.mjs";import{LINKED_PROJECT_DIR as H,LINKED_PROJECT_FILE as Y,readLinkedProject as J,writeLinkedProject as Q}from"./packem_shared/LINKED_PROJECT_DIR-CMzUvj-1.mjs";import{LUNORA_EVENT_SOURCE as z,formatLunoraEvent as X}from"./packem_shared/LUNORA_EVENT_SOURCE-ZclWASXS.mjs";import{default as $}from"./packem_shared/LunoraReporter-BnXUqh8t.mjs";import{PACKAGE_SECRETS_REGISTRY as re,secretsForPackages as oe}from"./packem_shared/PACKAGE_SECRETS_REGISTRY-BgmvEPA-.mjs";import{LUNORA_CONFIG_FILE as ae,interpretRemote as Ee,readProjectRemotePreference as ie}from"./packem_shared/LUNORA_CONFIG_FILE-3bpx6TZN.mjs";import{createConfirm as le,isInteractive as _e,promptMultiSelect as ce,promptSelect as se,promptText as me,promptYesNo as pe}from"./packem_shared/createConfirm-7IL0kZyE.mjs";import{reconcileWranglerBindings as de}from"./packem_shared/reconcileWranglerBindings-Dd3tLauZ.mjs";import{reconcileWranglerCompatibilityDate as Ae}from"./packem_shared/reconcileWranglerCompatibilityDate-BXNiEQ7p.mjs";import{reconcileWranglerCrons as Le}from"./packem_shared/reconcileWranglerCrons-BmQa_kGL.mjs";import{REMOTE_ELIGIBLE_KEYS as Ne,injectRemoteFlags as Ie,isRemoteEnvEnabled as ve,materializeRemoteWranglerConfig as ge,planRemoteBindings as xe,resolveRemoteEnabled as Te}from"./packem_shared/REMOTE_ELIGIBLE_KEYS-ws6iE0y-.mjs";import{buildPackageSecretsBlock as Ce,ensureDevVariables as Fe,ensureDevVarsExample as Pe,fillDevSecrets as Oe,generateSecretValue as ue,isMintableSecretKey as Ge,isPlaceholderValue as We,planDevSecretsFill as Ue,planDevVariablesAugment as be,planDevVariablesScaffold as Be,requiredSecrets as Me}from"./packem_shared/buildPackageSecretsBlock-BpvaZzQ8.mjs";import{applyAdditiveEdit as ke,classifyEdit as ye}from"./packem_shared/applyAdditiveEdit-BdcnSa-j.mjs";import{parseSchema as he}from"./packem_shared/parseSchema-BPmtMgmb.mjs";import{classifyPolicyEdit as He,scaffoldPolicyFile as Ye,wireRlsIntoProcedure as Je}from"./packem_shared/classifyPolicyEdit-BzC_MfYK.mjs";import{discoverSchemaInfo as qe}from"./packem_shared/discoverSchemaInfo-B2W3VrcT.mjs";import{ACCENT as Xe,BADGES as Ze,BADGE_COLUMN_WIDTH as $e,LUNA_ART as er,LUNA_BUNNY as rr,LUNA_NAME as or,LUNA_SIGNOFF as tr,STEP_BADGE_NAMES as ar,badgeLead as Er,badgeWidth as ir,padBadge as nr,paintAnswer as lr,paintBadge as _r}from"./packem_shared/ACCENT-CLeV5v0K.mjs";import{WORKERS_CACHE_MIN_DATE as sr,isCacheEnabled as mr}from"./packem_shared/WORKERS_CACHE_MIN_DATE-B1h_wNDN.mjs";import{discoverWorkflowInfo as fr}from"./packem_shared/discoverWorkflowInfo-Bbc0u2gE.mjs";import{WRANGLER_FILES as Sr,findWranglerFile as Ar,readWranglerJsonc as Rr}from"./packem_shared/WRANGLER_FILES-Bi_18Pj6.mjs";import{collectWranglerSecretVariables as Dr,scanWranglerVariablesForSecrets as Nr}from"./packem_shared/collectWranglerSecretVariables-OacEwPmL.mjs";import{REQUIRED_COMPATIBILITY_DATE as vr,REQUIRED_FLAG as gr,validateWrangler as xr,validateWranglerConfig as Tr,validateWranglerProject as Vr,withTailConsumer as Cr}from"./packem_shared/REQUIRED_COMPATIBILITY_DATE-DPcRuAhj.mjs";export{Xe as ACCENT,o as AGENT_MODE_ENV,n as AGENT_RULES_DIR,l as AGENT_RULES_HINT,_ as AGENT_RULES_HINT_ENV,Ze as BADGES,$e as BADGE_COLUMN_WIDTH,I as DEV_DAEMON_ENV,v as DEV_HANDOFF_ENV,g as DEV_LOG_FILE,x as DEV_LOG_FILE_ENV,T as DEV_STATE_DIR,V as DEV_STATE_FILE,B as DEV_VARS_EXAMPLE_FILE,M as DEV_VARS_FILE,K as DEV_VARS_KEY_PATTERN,H as LINKED_PROJECT_DIR,Y as LINKED_PROJECT_FILE,er as LUNA_ART,rr as LUNA_BUNNY,or as LUNA_NAME,tr as LUNA_SIGNOFF,ae as LUNORA_CONFIG_FILE,z as LUNORA_EVENT_SOURCE,c as LUNORA_SKILL_NAMES,$ as LunoraReporter,re as PACKAGE_SECRETS_REGISTRY,Ne as REMOTE_ELIGIBLE_KEYS,vr as REQUIRED_COMPATIBILITY_DATE,gr as REQUIRED_FLAG,s as ROOT_SKILL_NAME,ar as STEP_BADGE_NAMES,sr as WORKERS_CACHE_MIN_DATE,Sr as WRANGLER_FILES,ke as applyAdditiveEdit,Er as badgeLead,ir as badgeWidth,Ce as buildPackageSecretsBlock,m as claimAgentRulesHint,C as claimDevServerState,ye as classifyEdit,He as classifyPolicyEdit,F as clearDevServerState,Dr as collectWranglerSecretVariables,le as createConfirm,p as detectAgentRules,t as detectAiAgent,L as detectFramework,E as discoverAgentInfo,d as discoverContainerInfo,qe as discoverSchemaInfo,fr as discoverWorkflowInfo,Fe as ensureDevVariables,Pe as ensureDevVarsExample,Oe as fillDevSecrets,Ar as findWranglerFile,X as formatLunoraEvent,ue as generateSecretValue,w as inferLunoraBindings,Ie as injectRemoteFlags,Ee as interpretRemote,mr as isCacheEnabled,_e as isInteractive,Ge as isMintableSecretKey,We as isPlaceholderValue,P as isProcessAlive,O as isRecordedProcessCurrent,ve as isRemoteEnvEnabled,ge as materializeRemoteWranglerConfig,h as packageNamesFromBindings,nr as padBadge,lr as paintAnswer,_r as paintBadge,k as parseDevVariableEntries,he as parseSchema,Ue as planDevSecretsFill,be as planDevVariablesAugment,Be as planDevVariablesScaffold,xe as planRemoteBindings,ce as promptMultiSelect,se as promptSelect,me as promptText,pe as promptYesNo,u as readDevServerState,J as readLinkedProject,G as readLiveDevServerState,D as readProjectDependencyNames,ie as readProjectRemotePreference,Rr as readWranglerJsonc,de as reconcileWranglerBindings,Ae as reconcileWranglerCompatibilityDate,Le as reconcileWranglerCrons,Me as requiredSecrets,Te as resolveRemoteEnabled,Ye as scaffoldPolicyFile,Nr as scanWranglerVariablesForSecrets,oe as secretsForPackages,A as streamContainerLogs,W as updateDevServerState,xr as validateWrangler,Tr as validateWranglerConfig,Vr as validateWranglerProject,Je as wireRlsIntoProcedure,Cr as withTailConsumer,U as writeDevServerState,Q as writeLinkedProject};
1
+ import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-B54hVQ_w.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-BJm0QtoI.mjs";import{AGENT_RULES_DIR as n,AGENT_RULES_HINT as l,AGENT_RULES_HINT_ENV as _,LUNORA_SKILL_NAMES as c,ROOT_SKILL_NAME as s,claimAgentRulesHint as m,detectAgentRules as p}from"./packem_shared/AGENT_RULES_DIR-hP9TiDNx.mjs";import{discoverContainerInfo as d}from"./packem_shared/discoverContainerInfo-CYG9j2LY.mjs";import{streamContainerLogs as A}from"./packem_shared/streamContainerLogs-BPYBNrWS.mjs";import{detectFramework as L,readProjectDependencyNames as D}from"./packem_shared/detectFramework-VTQfCNXy.mjs";import{DEV_DAEMON_ENV as I,DEV_HANDOFF_ENV as v,DEV_LOG_FILE as g,DEV_LOG_FILE_ENV as x,DEV_STATE_DIR as T,DEV_STATE_FILE as V,claimDevServerState as C,clearDevServerState as F,isProcessAlive as P,isRecordedProcessCurrent as O,readDevServerState as u,readLiveDevServerState as G,updateDevServerState as W,writeDevServerState as U}from"./packem_shared/DEV_DAEMON_ENV-D9Z83rlU.mjs";import{DEV_VARS_EXAMPLE_FILE as B,DEV_VARS_FILE as M,DEV_VARS_KEY_PATTERN as K,parseDevVariableEntries as k}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-DX6xGbpr.mjs";import{inferLunoraBindings as w,packageNamesFromBindings as h}from"./packem_shared/inferLunoraBindings-DqhCZuPM.mjs";import{LINKED_PROJECT_DIR as H,LINKED_PROJECT_FILE as Y,readLinkedProject as J,writeLinkedProject as Q}from"./packem_shared/LINKED_PROJECT_DIR-CMzUvj-1.mjs";import{LUNORA_EVENT_SOURCE as z,formatLunoraEvent as X}from"./packem_shared/LUNORA_EVENT_SOURCE-ZclWASXS.mjs";import{default as $}from"./packem_shared/LunoraReporter-BnXUqh8t.mjs";import{PACKAGE_SECRETS_REGISTRY as re,secretsForPackages as oe}from"./packem_shared/PACKAGE_SECRETS_REGISTRY-BgmvEPA-.mjs";import{LUNORA_CONFIG_FILE as ae,interpretRemote as Ee,readProjectRemotePreference as ie}from"./packem_shared/LUNORA_CONFIG_FILE-3bpx6TZN.mjs";import{createConfirm as le,isInteractive as _e,promptMultiSelect as ce,promptSelect as se,promptText as me,promptYesNo as pe}from"./packem_shared/createConfirm-7IL0kZyE.mjs";import{reconcileWranglerBindings as de}from"./packem_shared/reconcileWranglerBindings-Dd3tLauZ.mjs";import{reconcileWranglerCompatibilityDate as Ae}from"./packem_shared/reconcileWranglerCompatibilityDate-BXNiEQ7p.mjs";import{reconcileWranglerCrons as Le}from"./packem_shared/reconcileWranglerCrons-BmQa_kGL.mjs";import{REMOTE_ELIGIBLE_KEYS as Ne,injectRemoteFlags as Ie,isRemoteEnvEnabled as ve,materializeRemoteWranglerConfig as ge,planRemoteBindings as xe,resolveRemoteEnabled as Te}from"./packem_shared/REMOTE_ELIGIBLE_KEYS-ws6iE0y-.mjs";import{buildPackageSecretsBlock as Ce,ensureDevVariables as Fe,ensureDevVarsExample as Pe,fillDevSecrets as Oe,generateSecretValue as ue,isMintableSecretKey as Ge,isPlaceholderValue as We,planDevSecretsFill as Ue,planDevVariablesAugment as be,planDevVariablesScaffold as Be,requiredSecrets as Me}from"./packem_shared/buildPackageSecretsBlock-BpvaZzQ8.mjs";import{applyAdditiveEdit as ke,classifyEdit as ye}from"./packem_shared/applyAdditiveEdit-BdcnSa-j.mjs";import{parseSchema as he}from"./packem_shared/parseSchema-BPmtMgmb.mjs";import{classifyPolicyEdit as He,scaffoldPolicyFile as Ye,wireRlsIntoProcedure as Je}from"./packem_shared/classifyPolicyEdit-BzC_MfYK.mjs";import{discoverSchemaInfo as qe}from"./packem_shared/discoverSchemaInfo-B2W3VrcT.mjs";import{ACCENT as Xe,BADGES as Ze,BADGE_COLUMN_WIDTH as $e,LUNA_ART as er,LUNA_BUNNY as rr,LUNA_NAME as or,LUNA_SIGNOFF as tr,STEP_BADGE_NAMES as ar,badgeLead as Er,badgeWidth as ir,padBadge as nr,paintAnswer as lr,paintBadge as _r}from"./packem_shared/ACCENT-CLeV5v0K.mjs";import{WORKERS_CACHE_MIN_DATE as sr,isCacheEnabled as mr}from"./packem_shared/WORKERS_CACHE_MIN_DATE-B1h_wNDN.mjs";import{discoverWorkflowInfo as fr}from"./packem_shared/discoverWorkflowInfo-Bbc0u2gE.mjs";import{WRANGLER_FILES as Sr,findWranglerFile as Ar,readWranglerJsonc as Rr}from"./packem_shared/WRANGLER_FILES-Bi_18Pj6.mjs";import{collectWranglerSecretVariables as Dr,scanWranglerVariablesForSecrets as Nr}from"./packem_shared/collectWranglerSecretVariables-OacEwPmL.mjs";import{REQUIRED_COMPATIBILITY_DATE as vr,REQUIRED_FLAG as gr,validateWrangler as xr,validateWranglerConfig as Tr,validateWranglerProject as Vr,withTailConsumer as Cr}from"./packem_shared/REQUIRED_COMPATIBILITY_DATE-DPcRuAhj.mjs";export{Xe as ACCENT,o as AGENT_MODE_ENV,n as AGENT_RULES_DIR,l as AGENT_RULES_HINT,_ as AGENT_RULES_HINT_ENV,Ze as BADGES,$e as BADGE_COLUMN_WIDTH,I as DEV_DAEMON_ENV,v as DEV_HANDOFF_ENV,g as DEV_LOG_FILE,x as DEV_LOG_FILE_ENV,T as DEV_STATE_DIR,V as DEV_STATE_FILE,B as DEV_VARS_EXAMPLE_FILE,M as DEV_VARS_FILE,K as DEV_VARS_KEY_PATTERN,H as LINKED_PROJECT_DIR,Y as LINKED_PROJECT_FILE,er as LUNA_ART,rr as LUNA_BUNNY,or as LUNA_NAME,tr as LUNA_SIGNOFF,ae as LUNORA_CONFIG_FILE,z as LUNORA_EVENT_SOURCE,c as LUNORA_SKILL_NAMES,$ as LunoraReporter,re as PACKAGE_SECRETS_REGISTRY,Ne as REMOTE_ELIGIBLE_KEYS,vr as REQUIRED_COMPATIBILITY_DATE,gr as REQUIRED_FLAG,s as ROOT_SKILL_NAME,ar as STEP_BADGE_NAMES,sr as WORKERS_CACHE_MIN_DATE,Sr as WRANGLER_FILES,ke as applyAdditiveEdit,Er as badgeLead,ir as badgeWidth,Ce as buildPackageSecretsBlock,m as claimAgentRulesHint,C as claimDevServerState,ye as classifyEdit,He as classifyPolicyEdit,F as clearDevServerState,Dr as collectWranglerSecretVariables,le as createConfirm,p as detectAgentRules,t as detectAiAgent,L as detectFramework,E as discoverAgentInfo,d as discoverContainerInfo,qe as discoverSchemaInfo,fr as discoverWorkflowInfo,Fe as ensureDevVariables,Pe as ensureDevVarsExample,Oe as fillDevSecrets,Ar as findWranglerFile,X as formatLunoraEvent,ue as generateSecretValue,w as inferLunoraBindings,Ie as injectRemoteFlags,Ee as interpretRemote,mr as isCacheEnabled,_e as isInteractive,Ge as isMintableSecretKey,We as isPlaceholderValue,P as isProcessAlive,O as isRecordedProcessCurrent,ve as isRemoteEnvEnabled,ge as materializeRemoteWranglerConfig,h as packageNamesFromBindings,nr as padBadge,lr as paintAnswer,_r as paintBadge,k as parseDevVariableEntries,he as parseSchema,Ue as planDevSecretsFill,be as planDevVariablesAugment,Be as planDevVariablesScaffold,xe as planRemoteBindings,ce as promptMultiSelect,se as promptSelect,me as promptText,pe as promptYesNo,u as readDevServerState,J as readLinkedProject,G as readLiveDevServerState,D as readProjectDependencyNames,ie as readProjectRemotePreference,Rr as readWranglerJsonc,de as reconcileWranglerBindings,Ae as reconcileWranglerCompatibilityDate,Le as reconcileWranglerCrons,Me as requiredSecrets,Te as resolveRemoteEnabled,Ye as scaffoldPolicyFile,Nr as scanWranglerVariablesForSecrets,oe as secretsForPackages,A as streamContainerLogs,W as updateDevServerState,xr as validateWrangler,Tr as validateWranglerConfig,Vr as validateWranglerProject,Je as wireRlsIntoProcedure,Cr as withTailConsumer,U as writeDevServerState,Q as writeLinkedProject};
@@ -0,0 +1 @@
1
+ import{existsSync as d,statSync as O,readFileSync as b,readdirSync as F}from"node:fs";import{init as T,parse as f}from"es-module-lexer";import{discoverAgentInfo as B}from"./discoverAgentInfo-BJm0QtoI.mjs";import{discoverContainerInfo as P}from"./discoverContainerInfo-CYG9j2LY.mjs";import{FLAGS_FILENAME as L,discoverFlags as K,QUEUES_FILENAME as M,discoverQueues as H}from"@lunora/codegen";import{Project as R}from"ts-morph";import{join as c}from"node:path";import{discoverSchemaInfo as q}from"./discoverSchemaInfo-B2W3VrcT.mjs";import{discoverWorkflowInfo as G}from"./discoverWorkflowInfo-Bbc0u2gE.mjs";import{WRANGLER_FILES as W,readWranglerJsonc as X}from"./WRANGLER_FILES-Bi_18Pj6.mjs";const U=(e,r)=>{const t=c(e,r,L);if(!d(t))return{};try{const s=new R({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1});return{flags:K(s,c(e,r))}}catch(s){return{error:s instanceof Error?s.message:String(s)}}},Q=(e,r)=>{const t=c(e,r,M);if(!d(t))return{queues:[]};try{const s=new R({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1});return{queues:H(s,c(e,r))}}catch(s){return{error:s instanceof Error?s.message:String(s),queues:[]}}},Y=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),z=new Set([".git",".lunora-cache",".wrangler","_generated","dist","node_modules"]),J=["lunora","src"],V=["src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],k={SchedulerDO:"SCHEDULER",SessionDO:"SESSION",ShardDO:"SHARD"},$=Object.keys(k),Z={SchedulerDO:/\btype\s+SchedulerDO\b/,SessionDO:/\btype\s+SessionDO\b/,ShardDO:/\btype\s+ShardDO\b/},ee=/\benv\s*\.\s*DB\b/,re=/\benv\s*\.\s*AI\b/,A=/\bctx\s*\.\s*pipelines\b/,_=/^\s*import\s+type\b/,se=new Set(["@lunora/agent","@lunora/agent/sandbox"]),te=e=>{const r=e.indexOf("{");if(r===-1)return"";const t=e.indexOf("}",r+1);return t===-1?e.slice(r+1):e.slice(r+1,t)},ne=/\btype\s+browserTool\b/,oe=/\bbrowserTool\b/,ae=/import\s+\{[^}]*\bbrowserTool\b[^}]*\}\s+from\s+["']@lunora\/agent(?:\/sandbox)?["']/,ie=e=>{if(_.test(e))return!1;const r=te(e);return oe.test(r)&&!ne.test(r)},ce=e=>{try{const[r]=f(e);return r.some(t=>t.n!==void 0&&se.has(t.n)&&ie(e.slice(t.ss,t.se)))}catch{return ae.test(e)}},g={usesAi:{pattern:/\bfrom\s+["']@lunora\/ai["']/,source:"@lunora/ai"},usesAnalytics:{pattern:/\bfrom\s+["']@lunora\/bindings\/analytics["']/,source:"@lunora/bindings/analytics"},usesAuth:{pattern:/\bfrom\s+["']@lunora\/auth["']/,source:"@lunora/auth"},usesBrowser:{pattern:/\bfrom\s+["']@lunora\/browser["']/,source:"@lunora/browser"},usesHyperdrive:{pattern:/\bfrom\s+["']@lunora\/hyperdrive["']/,source:"@lunora/hyperdrive"},usesImages:{pattern:/\bfrom\s+["']@lunora\/bindings\/images["']/,source:"@lunora/bindings/images"},usesKv:{pattern:/\bfrom\s+["']@lunora\/bindings\/kv["']/,source:"@lunora/bindings/kv"},usesMail:{pattern:/\bfrom\s+["']@lunora\/mail["']/,source:"@lunora/mail"},usesPayment:{pattern:/\bfrom\s+["']@lunora\/payment["']/,source:"@lunora/payment"},usesPipelines:{pattern:A,source:"@lunora/bindings/pipelines"},usesScheduler:{pattern:/\bfrom\s+["']@lunora\/scheduler["']/,source:"@lunora/scheduler"},usesStorage:{pattern:/\bfrom\s+["']@lunora\/storage["']/,source:"@lunora/storage"},usesX402Charge:{pattern:/\bfrom\s+["']@lunora\/x402\/charge["']/,source:"@lunora/x402/charge"},usesX402Pay:{pattern:/\bfrom\s+["']@lunora\/x402\/pay["']/,source:"@lunora/x402/pay"}},p=Object.keys(g),ue="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",I=[...p,"needsD1"],de=()=>{const e={};for(const r of I)e[r]=!1;return e},l=Object.freeze(de()),y=(e,r)=>{const t={};for(const s of I)t[s]=e[s]||r[s];return t},le=e=>{for(const r of p)if(g[r].source===e)return{...l,[r]:!0};return l},pe=e=>{const[r]=f(e);let t=l;for(const s of r){const n=s.n;!n||_.test(e.slice(s.ss,s.se))||(t=y(t,le(n)))}return t},me=e=>{const r={...l};for(const t of p)r[t]=g[t].pattern.test(e);return r},be=e=>{let r;try{r=pe(e)}catch{r=me(e)}return y(r,{...l,needsD1:ee.test(e),usesAi:re.test(e),usesPipelines:A.test(e)})},S=(e,r)=>{let t;try{t=F(e,{withFileTypes:!0})}catch{return}for(const s of t){if(s.isDirectory()){z.has(s.name)||S(c(e,s.name),r);continue}const n=s.name.lastIndexOf(".");n!==-1&&Y.has(s.name.slice(n))&&r.push(c(e,s.name))}},fe=e=>{for(const r of W){const t=c(e,r);if(!d(t))continue;const{parsed:s}=X(t),n=s?.main;if(typeof n=="string"&&d(c(e,n)))return c(e,n);break}for(const r of V){const t=c(e,r);if(d(t))return t}},ge=e=>{const r=b(e,"utf8");let t;try{const[,s]=f(r);t=new Set(s.map(n=>n.n))}catch{t=new Set($.filter(s=>new RegExp(String.raw`\bexport\b[^\n;]*\b${s}\b`).test(r)))}return $.filter(s=>t.has(s)&&!Z[s].test(r)).map(s=>({binding:k[s],className:s}))},j=e=>e.replaceAll(/[$()*+.?[\\\]^{|}]/gu,String.raw`\$&`),he=/(?:^|[\s,{])type$/u,ye=(e,r)=>{const t=r.ls>=0?r.ls:r.s;return he.test(e.slice(0,t).trimEnd())},Se=(e,r)=>{const t=j(r);return new RegExp(String.raw`\bexport\s+type\s+${t}\b`,"u").test(e)||new RegExp(String.raw`\bexport\s+type\s*\{[^}]*\b${t}\b`,"u").test(e)||new RegExp(String.raw`\bexport\s+\{[^}]*\btype\s+${t}\b`,"u").test(e)},w=(e,r,t)=>{if(r.length===0)return[];if(e===void 0)return r.map(o=>({...o,exported:!1}));const s=b(e,"utf8"),n=new RegExp(String.raw`\bexport\s*\*\s*from\s*["'][^"']*_generated\/${t}(?:\.js)?["']`).test(s);let a;try{const[,o]=f(s);a=new Set(o.filter(i=>!ye(s,i)).map(i=>i.n))}catch{a=new Set(r.map(o=>o.className).filter(o=>new RegExp(String.raw`\bexport\b[^\n;]*\b${j(o)}\b`,"u").test(s)&&!Se(s,o)))}return r.map(o=>{const i=n||a.has(o.className);return{...o,exported:i}})},we=(e,r)=>w(e,r,"containers"),xe=(e,r)=>w(e,r,"workflows"),ve=(e,r)=>w(e,r,"agents"),Ee=(e,r)=>q(e,r).info?.hasGlobalTable??!1,De=(e,r)=>{let t=l;for(const s of r){const n=c(e,s);if(!d(n)||!O(n).isDirectory())continue;const a=[];S(n,a);for(const o of a)t=y(t,be(b(o,"utf8")))}return t},Ne=(e,r)=>{const t=c(e,r);if(!d(t)||!O(t).isDirectory())return!1;const s=[];return S(t,s),s.some(n=>ce(b(n,"utf8")))},$e=(e,r,t)=>[...e.map(s=>s.exported?`${s.bindingName}/${s.className} (container "${s.exportName}" declared and exported)`:`hint: container "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...r.map(s=>s.exported?`${s.bindingName}/${s.className} (workflow "${s.exportName}" declared and exported)`:`hint: workflow "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...t.map(s=>s.exported?`${s.bindingName}/${s.className} (agent "${s.exportName}" declared and exported)`:`hint: agent "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],Oe=(e,r)=>[[e.usesAi,"AI (@lunora/ai imported or env.AI used)"],[e.usesAuth&&!r.has("SessionDO"),"hint: @lunora/auth is imported but no SessionDO is exported (sessions are D1-backed, or export SessionDO for DO-backed sessions)"],[e.usesScheduler&&!r.has("SchedulerDO"),"hint: @lunora/scheduler is imported but no SchedulerDO is exported by the worker entry"],[e.usesStorage,"hint: @lunora/storage is imported; add an r2_buckets binding (bucket binding names are user-defined)"],[e.usesMail,"hint: @lunora/mail is imported; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)"],[e.usesPayment,`hint: @lunora/payment is imported; set the provider secrets in .dev.vars — ${ue}`],[e.usesBrowser,"browser (@lunora/browser imported) — self-describing { binding: BROWSER }"],[e.usesImages,"images (@lunora/bindings/images imported) — self-describing { binding: IMAGES }"],[e.usesAnalytics,"analytics_engine_datasets (@lunora/bindings/analytics imported) — self-describing { binding: ANALYTICS, dataset }"],[e.usesKv,"hint: @lunora/bindings/kv is imported; add a kv_namespaces binding ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned"],[e.usesHyperdrive,"hint: @lunora/hyperdrive is imported; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned"],[e.usesPipelines,"hint: ctx.pipelines is used; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, pipeline }) — the pipeline resource can't be auto-provisioned"],[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.usesX402Pay,"hint: @lunora/x402/pay is imported (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(([t])=>t).map(([,t])=>t),Re=(e,r,t,s=[],n=[],a=[])=>{const o=new Set(e.map(u=>u.className)),i=e.map(u=>`${u.binding}/${u.className} (exported by worker entry)`);return r&&i.push("DB (.global() table declared)"),i.push(...$e(s,n,a),...Oe(t,o)),i},Le=async e=>{await T;const r=e.schemaDir??"lunora",t=e.scanDirs??J,s=De(e.projectRoot,t),n={...s,usesBrowser:s.usesBrowser||Ne(e.projectRoot,r)},a=fe(e.projectRoot),o=a?ge(a):[],i=n.needsD1||Ee(e.projectRoot,r),u=we(a,P(e.projectRoot,r).containers),x=xe(a,G(e.projectRoot,r).workflows),v=ve(a,B(e.projectRoot,r).agents),C=[...Q(e.projectRoot,r).queues],{flags:m}=U(e.projectRoot,r),h=m?.provider==="flagship"&&m.mode==="binding"?m.bindingName:void 0,E={};for(const N of p)E[N]=n[N];const D=Re(o,i,n,u,x,v);return h!==void 0&&D.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${h}", app_id }) — the app_id can't be auto-provisioned`),{agents:v,containers:u,durableObjects:o,flagshipBinding:h,needsD1:i,queues:C,signals:D,usesFlags:m!==void 0,workflows:x,...E}},Ke=e=>{const r=[];for(const t of p)e[t]&&r.push(g[t].source);return r};export{Le as inferLunoraBindings,Ke as packageNamesFromBindings};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/config",
3
- "version": "1.0.0-alpha.84",
3
+ "version": "1.0.0-alpha.86",
4
4
  "description": "Internal shared CLI + Vite config layer for Lunora: wrangler.jsonc validation, binding inference, and .dev.vars scaffolding",
5
5
  "keywords": [
6
6
  "bindings",
@@ -50,10 +50,10 @@
50
50
  "access": "public"
51
51
  },
52
52
  "dependencies": {
53
- "@lunora/codegen": "1.0.0-alpha.58",
53
+ "@lunora/codegen": "1.0.0-alpha.60",
54
54
  "@lunora/container": "1.0.0-alpha.16",
55
55
  "@lunora/errors": "1.0.0-alpha.8",
56
- "@lunora/seed": "1.0.0-alpha.33",
56
+ "@lunora/seed": "1.0.0-alpha.35",
57
57
  "@visulima/colorize": "2.0.0",
58
58
  "@visulima/find-ai-runner": "1.0.0",
59
59
  "dockerode": "^5.0.1",
@@ -1 +0,0 @@
1
- import{existsSync as u,statSync as R,readFileSync as b,readdirSync as F}from"node:fs";import{init as C,parse as f}from"es-module-lexer";import{discoverAgentInfo as T}from"./discoverAgentInfo-BJm0QtoI.mjs";import{discoverContainerInfo as P}from"./discoverContainerInfo-CYG9j2LY.mjs";import{FLAGS_FILENAME as B,discoverFlags as L,QUEUES_FILENAME as K,discoverQueues as M}from"@lunora/codegen";import{Project as k}from"ts-morph";import{join as i}from"node:path";import{discoverSchemaInfo as H}from"./discoverSchemaInfo-B2W3VrcT.mjs";import{discoverWorkflowInfo as q}from"./discoverWorkflowInfo-Bbc0u2gE.mjs";import{WRANGLER_FILES as G,readWranglerJsonc as W}from"./WRANGLER_FILES-Bi_18Pj6.mjs";const U=(e,r)=>{const t=i(e,r,B);if(!u(t))return{};try{const s=new k({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1});return{flags:L(s,i(e,r))}}catch(s){return{error:s instanceof Error?s.message:String(s)}}},X=(e,r)=>{const t=i(e,r,K);if(!u(t))return{queues:[]};try{const s=new k({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1});return{queues:M(s,i(e,r))}}catch(s){return{error:s instanceof Error?s.message:String(s),queues:[]}}},Q=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),Y=new Set([".git",".lunora-cache",".wrangler","_generated","dist","node_modules"]),z=["lunora","src"],J=["src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],$={SchedulerDO:"SCHEDULER",SessionDO:"SESSION",ShardDO:"SHARD"},O=Object.keys($),V={SchedulerDO:/\btype\s+SchedulerDO\b/,SessionDO:/\btype\s+SessionDO\b/,ShardDO:/\btype\s+ShardDO\b/},Z=/\benv\s*\.\s*DB\b/,ee=/\benv\s*\.\s*AI\b/,_=/\bctx\s*\.\s*pipelines\b/,A=/^\s*import\s+type\b/,re=new Set(["@lunora/agent","@lunora/agent/sandbox"]),se=e=>{const r=e.indexOf("{");if(r===-1)return"";const t=e.indexOf("}",r+1);return t===-1?e.slice(r+1):e.slice(r+1,t)},te=/\btype\s+browserTool\b/,ne=/\bbrowserTool\b/,oe=/import\s+\{[^}]*\bbrowserTool\b[^}]*\}\s+from\s+["']@lunora\/agent(?:\/sandbox)?["']/,ae=e=>{if(A.test(e))return!1;const r=se(e);return ne.test(r)&&!te.test(r)},ie=e=>{try{const[r]=f(e);return r.some(t=>t.n!==void 0&&re.has(t.n)&&ae(e.slice(t.ss,t.se)))}catch{return oe.test(e)}},g={usesAi:{pattern:/\bfrom\s+["']@lunora\/ai["']/,source:"@lunora/ai"},usesAnalytics:{pattern:/\bfrom\s+["']@lunora\/bindings\/analytics["']/,source:"@lunora/bindings/analytics"},usesAuth:{pattern:/\bfrom\s+["']@lunora\/auth["']/,source:"@lunora/auth"},usesBrowser:{pattern:/\bfrom\s+["']@lunora\/browser["']/,source:"@lunora/browser"},usesHyperdrive:{pattern:/\bfrom\s+["']@lunora\/hyperdrive["']/,source:"@lunora/hyperdrive"},usesImages:{pattern:/\bfrom\s+["']@lunora\/bindings\/images["']/,source:"@lunora/bindings/images"},usesKv:{pattern:/\bfrom\s+["']@lunora\/bindings\/kv["']/,source:"@lunora/bindings/kv"},usesMail:{pattern:/\bfrom\s+["']@lunora\/mail["']/,source:"@lunora/mail"},usesPayment:{pattern:/\bfrom\s+["']@lunora\/payment["']/,source:"@lunora/payment"},usesPipelines:{pattern:_,source:"@lunora/bindings/pipelines"},usesScheduler:{pattern:/\bfrom\s+["']@lunora\/scheduler["']/,source:"@lunora/scheduler"},usesStorage:{pattern:/\bfrom\s+["']@lunora\/storage["']/,source:"@lunora/storage"},usesX402Charge:{pattern:/\bfrom\s+["']@lunora\/x402\/charge["']/,source:"@lunora/x402/charge"},usesX402Pay:{pattern:/\bfrom\s+["']@lunora\/x402\/pay["']/,source:"@lunora/x402/pay"}},l=Object.keys(g),ce="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",I=[...l,"needsD1"],de=()=>{const e={};for(const r of I)e[r]=!1;return e},p=Object.freeze(de()),y=(e,r)=>{const t={};for(const s of I)t[s]=e[s]||r[s];return t},ue=e=>{for(const r of l)if(g[r].source===e)return{...p,[r]:!0};return p},pe=e=>{const[r]=f(e);let t=p;for(const s of r){const n=s.n;!n||A.test(e.slice(s.ss,s.se))||(t=y(t,ue(n)))}return t},le=e=>{const r={...p};for(const t of l)r[t]=g[t].pattern.test(e);return r},me=e=>{let r;try{r=pe(e)}catch{r=le(e)}return y(r,{...p,needsD1:Z.test(e),usesAi:ee.test(e),usesPipelines:_.test(e)})},S=(e,r)=>{let t;try{t=F(e,{withFileTypes:!0})}catch{return}for(const s of t){if(s.isDirectory()){Y.has(s.name)||S(i(e,s.name),r);continue}const n=s.name.lastIndexOf(".");n!==-1&&Q.has(s.name.slice(n))&&r.push(i(e,s.name))}},be=e=>{for(const r of G){const t=i(e,r);if(!u(t))continue;const{parsed:s}=W(t),n=s?.main;if(typeof n=="string"&&u(i(e,n)))return i(e,n);break}for(const r of J){const t=i(e,r);if(u(t))return t}},fe=e=>{const r=b(e,"utf8");let t;try{const[,s]=f(r);t=new Set(s.map(n=>n.n))}catch{t=new Set(O.filter(s=>new RegExp(String.raw`\bexport\b[^\n;]*\b${s}\b`).test(r)))}return O.filter(s=>t.has(s)&&!V[s].test(r)).map(s=>({binding:$[s],className:s}))},ge=(e,r)=>new RegExp(String.raw`\bexport\s+type\s+${r}\b`).test(e)||new RegExp(String.raw`\bexport\s+type\s*\{[^}]*\b${r}\b`).test(e)||new RegExp(String.raw`\bexport\s+\{[^}]*\btype\s+${r}\b`).test(e),w=(e,r,t)=>{if(r.length===0)return[];if(e===void 0)return r.map(o=>({...o,exported:!1}));const s=b(e,"utf8"),n=new RegExp(String.raw`\bexport\s*\*\s*from\s*["'][^"']*_generated\/${t}(?:\.js)?["']`).test(s);let a;try{const[,o]=f(s);a=new Set(o.map(c=>c.n))}catch{a=new Set(r.map(o=>o.className).filter(o=>new RegExp(String.raw`\bexport\b[^\n;]*\b${o}\b`).test(s)))}return r.map(o=>{const c=n||a.has(o.className)&&!ge(s,o.className);return{...o,exported:c}})},he=(e,r)=>w(e,r,"containers"),ye=(e,r)=>w(e,r,"workflows"),Se=(e,r)=>w(e,r,"agents"),we=(e,r)=>H(e,r).info?.hasGlobalTable??!1,xe=(e,r)=>{let t=p;for(const s of r){const n=i(e,s);if(!u(n)||!R(n).isDirectory())continue;const a=[];S(n,a);for(const o of a)t=y(t,me(b(o,"utf8")))}return t},ve=(e,r)=>{const t=i(e,r);if(!u(t)||!R(t).isDirectory())return!1;const s=[];return S(t,s),s.some(n=>ie(b(n,"utf8")))},Ee=(e,r,t)=>[...e.map(s=>s.exported?`${s.bindingName}/${s.className} (container "${s.exportName}" declared and exported)`:`hint: container "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...r.map(s=>s.exported?`${s.bindingName}/${s.className} (workflow "${s.exportName}" declared and exported)`:`hint: workflow "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...t.map(s=>s.exported?`${s.bindingName}/${s.className} (agent "${s.exportName}" declared and exported)`:`hint: agent "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],Ne=(e,r)=>[[e.usesAi,"AI (@lunora/ai imported or env.AI used)"],[e.usesAuth&&!r.has("SessionDO"),"hint: @lunora/auth is imported but no SessionDO is exported (sessions are D1-backed, or export SessionDO for DO-backed sessions)"],[e.usesScheduler&&!r.has("SchedulerDO"),"hint: @lunora/scheduler is imported but no SchedulerDO is exported by the worker entry"],[e.usesStorage,"hint: @lunora/storage is imported; add an r2_buckets binding (bucket binding names are user-defined)"],[e.usesMail,"hint: @lunora/mail is imported; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)"],[e.usesPayment,`hint: @lunora/payment is imported; set the provider secrets in .dev.vars — ${ce}`],[e.usesBrowser,"browser (@lunora/browser imported) — self-describing { binding: BROWSER }"],[e.usesImages,"images (@lunora/bindings/images imported) — self-describing { binding: IMAGES }"],[e.usesAnalytics,"analytics_engine_datasets (@lunora/bindings/analytics imported) — self-describing { binding: ANALYTICS, dataset }"],[e.usesKv,"hint: @lunora/bindings/kv is imported; add a kv_namespaces binding ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned"],[e.usesHyperdrive,"hint: @lunora/hyperdrive is imported; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned"],[e.usesPipelines,"hint: ctx.pipelines is used; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, pipeline }) — the pipeline resource can't be auto-provisioned"],[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.usesX402Pay,"hint: @lunora/x402/pay is imported (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(([t])=>t).map(([,t])=>t),De=(e,r,t,s=[],n=[],a=[])=>{const o=new Set(e.map(d=>d.className)),c=e.map(d=>`${d.binding}/${d.className} (exported by worker entry)`);return r&&c.push("DB (.global() table declared)"),c.push(...Ee(s,n,a),...Ne(t,o)),c},Te=async e=>{await C;const r=e.schemaDir??"lunora",t=e.scanDirs??z,s=xe(e.projectRoot,t),n={...s,usesBrowser:s.usesBrowser||ve(e.projectRoot,r)},a=be(e.projectRoot),o=a?fe(a):[],c=n.needsD1||we(e.projectRoot,r),d=he(a,P(e.projectRoot,r).containers),x=ye(a,q(e.projectRoot,r).workflows),v=Se(a,T(e.projectRoot,r).agents),j=[...X(e.projectRoot,r).queues],{flags:m}=U(e.projectRoot,r),h=m?.provider==="flagship"&&m.mode==="binding"?m.bindingName:void 0,E={};for(const D of l)E[D]=n[D];const N=De(o,c,n,d,x,v);return h!==void 0&&N.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${h}", app_id }) — the app_id can't be auto-provisioned`),{agents:v,containers:d,durableObjects:o,flagshipBinding:h,needsD1:c,queues:j,signals:N,usesFlags:m!==void 0,workflows:x,...E}},Pe=e=>{const r=[];for(const t of l)e[t]&&r.push(g[t].source);return r};export{Te as inferLunoraBindings,Pe as packageNamesFromBindings};