@automagik/genie 4.260418.1 → 4.260418.2
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/genie.js
CHANGED
|
@@ -654,7 +654,7 @@ ${body}`;writeFileSync9(filePath,output,"utf-8")}function serializeSdkConfig(sdk
|
|
|
654
654
|
LIMIT $${values2.length+1}
|
|
655
655
|
`,[...values2,limit])).map(rowToRuntimeEvent)}async function getLatestRuntimeEventId(){let rows=await(await getConnection())`
|
|
656
656
|
SELECT COALESCE(MAX(id), 0) AS max_id FROM genie_runtime_events
|
|
657
|
-
`;return Number(rows[0]?.max_id??0)}async function followRuntimeEvents(query,onEvent,options){let sql=await getConnection(),active=!0,lastSeenId=query.afterId??await getLatestRuntimeEventId(),drainChain=Promise.resolve(),drain=async()=>{if(!active)return;let events=await listRuntimeEvents({...query,afterId:lastSeenId});for(let event of events)lastSeenId=event.id,onEvent(event)},queueDrain=(context)=>{drainChain=drainChain.then(drain).catch((error2)=>{logFollowDrainError(context,error2,active)})},listener=await sql.listen("genie_runtime_event",()=>{queueDrain("notify")});await drain();let pollIntervalMs=options?.pollIntervalMs??1000,pollTimer=setInterval(()=>{queueDrain("poll")},pollIntervalMs);return{mode:"pg",stop:async()=>{active=!1,clearInterval(pollTimer)
|
|
657
|
+
`;return Number(rows[0]?.max_id??0)}async function followRuntimeEvents(query,onEvent,options){let sql=await getConnection(),active=!0,lastSeenId=query.afterId??await getLatestRuntimeEventId(),drainChain=Promise.resolve(),drain=async()=>{if(!active)return;let events=await listRuntimeEvents({...query,afterId:lastSeenId});for(let event of events)lastSeenId=event.id,onEvent(event)},queueDrain=(context)=>{drainChain=drainChain.then(drain).catch((error2)=>{logFollowDrainError(context,error2,active)})},listener=await sql.listen("genie_runtime_event",()=>{queueDrain("notify")});await drain();let pollIntervalMs=options?.pollIntervalMs??1000,pollTimer=setInterval(()=>{queueDrain("poll")},pollIntervalMs);return{mode:"pg",stop:async()=>{active=!1,clearInterval(pollTimer);try{await drainChain}catch{}try{await listener.unlisten()}catch{}}}}async function waitForRuntimeEvent(query,timeoutMs,predicate){let afterId=query.afterId??0;return new Promise((resolve4,reject)=>{let settled=!1,handle=null,timer2=null,finish=async(event)=>{if(settled)return;if(settled=!0,timer2)clearTimeout(timer2);try{if(handle)await handle.stop()}catch{}resolve4(event)};(async()=>{try{if(handle=await followRuntimeEvents({...query,afterId},(event)=>{if(predicate&&!predicate(event))return;finish(event)},{pollIntervalMs:250}),settled){try{await handle.stop()}catch{}return}timer2=setTimeout(()=>{finish(null)},timeoutMs)}catch(err){if(!settled)settled=!0,reject(err)}})()})}var circuitBreaker,eventsEmitted=0,eventsFailed=0,lastEmitDuration=0;var init_runtime_events=__esm(()=>{init_db();circuitBreaker=new EventCircuitBreaker});var exports_workspace={};__export(exports_workspace,{validateWorkspaceDefaults:()=>validateWorkspaceDefaults,scanAgents:()=>scanAgents2,migrateWorkspaceConfig:()=>migrateWorkspaceConfig,getWorkspaceConfig:()=>getWorkspaceConfig,genieHome:()=>genieHome2,findWorkspace:()=>findWorkspace,AgentDefaultsSchema:()=>AgentDefaultsSchema});import{existsSync as existsSync22,mkdirSync as mkdirSync9,readFileSync as readFileSync14,readdirSync as readdirSync5,realpathSync as realpathSync2,writeFileSync as writeFileSync10}from"fs";import{homedir as homedir18,tmpdir as tmpdir2}from"os";import{dirname as dirname4,join as join24,resolve as resolve4,sep}from"path";function findWorkspace(cwd){let startDir=resolve4(cwd??process.cwd()),current=startDir;while(!0){let candidate=join24(current,WORKSPACE_MARKER);if(existsSync22(candidate)){saveWorkspaceRoot(current);let agent=detectAgent(startDir,current);return{root:current,agent:agent??void 0}}let parent=dirname4(current);if(parent===current)break;current=parent}let savedRoot=loadWorkspaceRoot();if(savedRoot&&existsSync22(join24(savedRoot,WORKSPACE_MARKER))){let agent=detectAgent(startDir,savedRoot);return{root:savedRoot,agent:agent??void 0}}return null}function genieHome2(){return process.env.GENIE_HOME??join24(homedir18(),".genie")}function isTempPath(root){try{let canonicalTmp=realpathSync2(tmpdir2()),canonicalRoot=realpathSync2(root);return canonicalRoot===canonicalTmp||canonicalRoot.startsWith(canonicalTmp+sep)}catch{return!0}}function saveWorkspaceRoot(root){if(isTempPath(root))return;try{let home=genieHome2(),configPath2=join24(home,"config.json"),config=existsSync22(configPath2)?JSON.parse(readFileSync14(configPath2,"utf-8")):{};if(config.workspaceRoot===root)return;config.workspaceRoot=root,mkdirSync9(home,{recursive:!0}),writeFileSync10(configPath2,`${JSON.stringify(config,null,2)}
|
|
658
658
|
`,"utf-8")}catch{}}function clearWorkspaceRoot(){try{let configPath2=join24(genieHome2(),"config.json");if(!existsSync22(configPath2))return;let config=JSON.parse(readFileSync14(configPath2,"utf-8"));if(config.workspaceRoot===void 0)return;config.workspaceRoot=void 0,writeFileSync10(configPath2,`${JSON.stringify(config,null,2)}
|
|
659
659
|
`,"utf-8")}catch{}}function loadWorkspaceRoot(){try{let configPath2=join24(genieHome2(),"config.json");if(!existsSync22(configPath2))return null;let config=JSON.parse(readFileSync14(configPath2,"utf-8")),saved=typeof config.workspaceRoot==="string"?config.workspaceRoot:null;if(!saved)return null;if(!existsSync22(join24(saved,WORKSPACE_MARKER)))return clearWorkspaceRoot(),null;return saved}catch{return null}}function detectAgent(startDir,workspaceRoot){let agentsDir=join24(workspaceRoot,"agents"),relative=startDir.slice(agentsDir.length);if(!startDir.startsWith(agentsDir)||relative.length>0&&relative[0]!==sep)return null;let parts=relative.split(sep).filter(Boolean);if(parts.length===0)return null;let agentName=parts[0],agentsMd=join24(agentsDir,agentName,"AGENTS.md");if(existsSync22(agentsMd))return agentName;return null}function getWorkspaceConfig(root){let configPath2=join24(root,WORKSPACE_MARKER),raw=readFileSync14(configPath2,"utf-8"),parsed=JSON.parse(raw);return migrateWorkspaceConfig(parsed)}function validateWorkspaceDefaults(config){if(!config.agents?.defaults)return;let result2=AgentDefaultsSchema.safeParse(config.agents.defaults);if(!result2.success){let issues=result2.error.issues.map((i2)=>` ${i2.path.join(".")}: ${i2.message}`).join(`
|
|
660
660
|
`);throw Error(`Invalid agents.defaults in workspace.json:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genie",
|
|
3
|
-
"version": "4.260418.
|
|
3
|
+
"version": "4.260418.2",
|
|
4
4
|
"description": "Human-AI partnership for Claude Code. Share a terminal, orchestrate workers, evolve together. Brainstorm ideas, turn them into wishes, execute with /work, validate with /review, and ship as one team.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Namastex Labs"
|