@automagik/genie 4.260504.4 → 4.260504.5

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
@@ -357,7 +357,7 @@ ${bin} set-option -w pane-active-border-style "fg=$COLOR"
357
357
  WHERE e.entity_type = 'worker'
358
358
  AND e.entity_id = a.id
359
359
  AND e.event_type = 'state_changed'
360
- AND e.details->>'reason' = 'dead_pane_zombie'
360
+ AND e.details->>'reason' IN ('dead_pane_zombie', 'stale_spawn_dead_pane')
361
361
  )
362
362
  RETURNING id
363
363
  `,auditPromises=[];for(let row of rows)console.error(`[reconcile] Archived exhausted zombie ${row.id} (TTL ${ttlHours}h)`),auditPromises.push(recordAuditEvent("worker",row.id,"state_changed","reconciler",{state:"archived",reason:"dead_pane_zombie_ttl_exhausted",ttl_hours:ttlHours}).catch(()=>{}));return await Promise.allSettled(auditPromises),rows.map((r)=>r.id)}catch{return[]}}async function listExhaustedZombies(ttlHours=DEAD_PANE_ZOMBIE_TTL_HOURS){try{return(await(await getConnection())`
@@ -370,7 +370,7 @@ ${bin} set-option -w pane-active-border-style "fg=$COLOR"
370
370
  WHERE e.entity_type = 'worker'
371
371
  AND e.entity_id = a.id
372
372
  AND e.event_type = 'state_changed'
373
- AND e.details->>'reason' = 'dead_pane_zombie'
373
+ AND e.details->>'reason' IN ('dead_pane_zombie', 'stale_spawn_dead_pane')
374
374
  )
375
375
  ORDER BY a.last_state_change ASC
376
376
  `).map((r)=>({id:r.id,lastStateChange:r.last_state_change}))}catch{return[]}}async function filterBySession(sessionName){return(await(await getConnection())`SELECT * FROM agents WHERE session = ${sessionName}`).map(rowToAgent)}async function update(id,updates){let sql=await getConnection(),s={};if(updates.paneId!==void 0)s.pane_id=updates.paneId;if(updates.session!==void 0)s.session=updates.session;if(updates.worktree!==void 0)s.worktree=updates.worktree;if(updates.taskId!==void 0)s.task_id=updates.taskId;if(updates.taskTitle!==void 0)s.task_title=updates.taskTitle;if(updates.wishSlug!==void 0)s.wish_slug=updates.wishSlug;if(updates.groupNumber!==void 0)s.group_number=updates.groupNumber;if(updates.startedAt!==void 0)s.started_at=updates.startedAt;if(updates.state!==void 0)s.state=updates.state,s.last_state_change=new Date().toISOString(),recordAuditEvent("worker",id,"state_changed",process.env.GENIE_AGENT_NAME??"cli",{state:updates.state}).catch(()=>{});if(updates.lastStateChange!==void 0)s.last_state_change=updates.lastStateChange;if(updates.repoPath!==void 0)s.repo_path=updates.repoPath;if(updates.windowName!==void 0)s.window_name=updates.windowName;if(updates.windowId!==void 0)s.window_id=updates.windowId;if(updates.role!==void 0)s.role=updates.role;if(updates.customName!==void 0)s.custom_name=updates.customName;if(updates.subPanes!==void 0)s.sub_panes=sql.json(updates.subPanes);if(updates.provider!==void 0)s.provider=updates.provider;if(updates.transport!==void 0)s.transport=updates.transport;if(updates.skill!==void 0)s.skill=updates.skill;if(updates.team!==void 0)s.team=updates.team;if(updates.window!==void 0)s.tmux_window=updates.window;if(updates.nativeAgentId!==void 0)s.native_agent_id=updates.nativeAgentId;if(updates.nativeColor!==void 0)s.native_color=updates.nativeColor;if(updates.nativeTeamEnabled!==void 0)s.native_team_enabled=updates.nativeTeamEnabled;if(updates.parentSessionId!==void 0)s.parent_session_id=updates.parentSessionId;if(updates.suspendedAt!==void 0)s.suspended_at=updates.suspendedAt;if(updates.autoResume!==void 0)s.auto_resume=updates.autoResume;if(updates.resumeAttempts!==void 0)s.resume_attempts=updates.resumeAttempts;if(updates.lastResumeAttempt!==void 0)s.last_resume_attempt=updates.lastResumeAttempt;if(updates.maxResumeAttempts!==void 0)s.max_resume_attempts=updates.maxResumeAttempts;if(updates.paneColor!==void 0)s.pane_color=updates.paneColor;if(Object.keys(s).length===0)return;await sql`UPDATE agents SET ${sql(s)} WHERE id = ${id}`}async function findByPane(paneId){let sql=await getConnection(),n=paneId.startsWith("%")?paneId:`%${paneId}`,rows=await sql`SELECT * FROM agents WHERE pane_id = ${n}`;return rows.length>0?rowToAgent(rows[0]):null}async function findByWindow(windowId){let sql=await getConnection(),n=windowId.startsWith("@")?windowId:`@${windowId}`,rows=await sql`SELECT * FROM agents WHERE window_id = ${n}`;return rows.length>0?rowToAgent(rows[0]):null}async function findByTask(taskId){let rows=await(await getConnection())`SELECT * FROM agents WHERE task_id = ${taskId} LIMIT 1`;return rows.length>0?rowToAgent(rows[0]):null}function getElapsedTime(agent){let ms=Date.now()-new Date(agent.startedAt).getTime(),m=Math.floor(ms/60000),h=Math.floor(m/60),formatted;if(h>0)formatted=`${h}h ${m%60}m`;else if(m>0)formatted=`${m}m`;else formatted="<1m";return{ms,formatted}}async function addSubPane(workerId,paneId,_registryPath){let agent=await get(workerId);if(!agent)return;let subPanes=[...agent.subPanes??[],paneId],sql=await getConnection();await sql`UPDATE agents SET sub_panes = ${sql.json(subPanes)} WHERE id = ${workerId}`}async function getPane(workerId,index,_registryPath){let agent=await get(workerId);if(!agent)return null;if(index===0)return agent.paneId;let si=index-1;if(!agent.subPanes||si>=agent.subPanes.length||si<0)return null;return agent.subPanes[si]}async function removeSubPane(workerId,paneId,_registryPath){let agent=await get(workerId);if(!agent?.subPanes)return;let filtered=agent.subPanes.filter((p)=>p!==paneId),sql=await getConnection();await sql`UPDATE agents SET sub_panes = ${sql.json(filtered)} WHERE id = ${workerId}`}async function resolveDynamicLeaderName(teamName){try{let{resolveLeaderName}=await Promise.resolve().then(() => (init_team_manager(),exports_team_manager)),name=await resolveLeaderName(teamName);return name!==teamName?name:null}catch{return null}}async function getTeamLeadEntry(teamName,session,repoPath){let sql=await getConnection();if(session)return findTeamLeadBySession(sql,teamName,session,repoPath);let legacyId=buildLegacyTeamLeadEntryId(teamName),lr=await sql`SELECT * FROM agents WHERE id = ${legacyId}`;if(lr.length>0)return rowToAgent(lr[0]);let leaderName=await resolveDynamicLeaderName(teamName),sr=leaderName?await sql`SELECT * FROM agents WHERE (role = 'team-lead' OR role = ${leaderName}) AND team = ${teamName} ORDER BY started_at DESC LIMIT 1`:await sql`SELECT * FROM agents WHERE role = 'team-lead' AND team = ${teamName} ORDER BY started_at DESC LIMIT 1`;return sr.length>0?rowToAgent(sr[0]):null}async function findLeadById(sql,id,repoPath,matchSession){let rows=await sql`SELECT * FROM agents WHERE id = ${id}`;if(rows.length===0)return null;let a=rowToAgent(rows[0]);if(matchSession&&a.session!==matchSession)return null;if(repoPath&&a.repoPath!==repoPath)return null;return a}async function scanForTeamLead(sql,teamName,session,repoPath){let leaderName=await resolveDynamicLeaderName(teamName),scanRows=leaderName?await sql`SELECT * FROM agents WHERE (role = 'team-lead' OR role = ${leaderName}) AND team = ${teamName} AND session = ${session} ${repoPath?sql`AND repo_path = ${repoPath}`:sql``} LIMIT 1`:await sql`SELECT * FROM agents WHERE role = 'team-lead' AND team = ${teamName} AND session = ${session} ${repoPath?sql`AND repo_path = ${repoPath}`:sql``} LIMIT 1`;return scanRows.length>0?rowToAgent(scanRows[0]):null}async function findTeamLeadBySession(sql,teamName,session,repoPath){if(repoPath){let byProject=await findLeadById(sql,buildProjectTeamLeadEntryId(teamName,session,repoPath));if(byProject)return byProject}let bySession=await findLeadById(sql,buildSessionTeamLeadEntryId(teamName,session),repoPath);if(bySession)return bySession;let byLegacy=await findLeadById(sql,buildLegacyTeamLeadEntryId(teamName),repoPath,session);if(byLegacy)return byLegacy;return scanForTeamLead(sql,teamName,session,repoPath)}async function saveTemplate(template){let sql=await getConnection();await sql`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/genie",
3
- "version": "4.260504.4",
3
+ "version": "4.260504.5",
4
4
  "description": "Collaborative terminal toolkit for human + AI workflows. NOTE: the npm distribution is being soft-deprecated — the canonical install is `curl -fsSL https://get.automagik.dev/genie | bash` (cosign + SLSA verified). See https://automagik.dev/genie/security/distribution-sovereignty",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genie",
3
- "version": "4.260504.4",
3
+ "version": "4.260504.5",
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"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genie-plugin",
3
- "version": "4.260504.4",
3
+ "version": "4.260504.5",
4
4
  "private": true,
5
5
  "description": "Runtime dependencies for genie bundled CLIs",
6
6
  "type": "module",