@automagik/genie 4.260421.20 → 4.260421.21
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
|
@@ -755,7 +755,7 @@ Next steps:`),console.log(" 1. Reload tmux: tmux source ~/.tmux.conf"),console.
|
|
|
755
755
|
UPDATE agents
|
|
756
756
|
SET metadata = metadata || ${sql.json(metadataPatch)}
|
|
757
757
|
WHERE role = ${name}
|
|
758
|
-
`}catch{}return updated}function loadIdentity(entry2){if(!entry2.dir)return null;let agentsPath=join26(entry2.dir,"AGENTS.md");if(existsSync24(agentsPath))return agentsPath;return null}function builtinToEntry(agent){return{name:agent.name,dir:"",promptMode:agent.promptMode??"append",model:agent.model,roles:[],registeredAt:"(built-in)"}}function roleToEntry(role,team,metadata,createdAt){if(!(metadata&&Object.keys(metadata).length>0)){let builtin=[...BUILTIN_ROLES,...BUILTIN_COUNCIL_MEMBERS].find((b2)=>b2.name===role);if(builtin)return builtinToEntry(builtin)}let registeredAt=(typeof metadata?.registeredAt==="string"?metadata.registeredAt:void 0)??createdAt??"";return{name:role,dir:metadata?.dir||"",promptMode:metadata?.promptMode||"append",model:metadata?.model,roles:[],registeredAt,description:metadata?.description,color:metadata?.color,provider:metadata?.provider,permissions:metadata?.permissions,disallowedTools:metadata?.disallowedTools,omniScopes:metadata?.omniScopes,hooks:metadata?.hooks,sdk:metadata?.sdk,bridgeTmuxSession:metadata?.bridgeTmuxSession,...metadata?.repo?{repo:metadata.repo}:team?{repo:team}:{}}}function buildMetadata(entry2){let meta={};if(entry2.dir)meta.dir=entry2.dir;if(entry2.repo)meta.repo=entry2.repo;if(entry2.model)meta.model=entry2.model;if(entry2.promptMode&&entry2.promptMode!=="append")meta.promptMode=entry2.promptMode;if(entry2.description)meta.description=entry2.description;if(entry2.color)meta.color=entry2.color;if(entry2.provider)meta.provider=entry2.provider;if(entry2.permissions)meta.permissions=entry2.permissions;if(entry2.disallowedTools)meta.disallowedTools=entry2.disallowedTools;if(entry2.omniScopes)meta.omniScopes=entry2.omniScopes;if(entry2.hooks)meta.hooks=entry2.hooks;if(entry2.sdk)meta.sdk=entry2.sdk;
|
|
758
|
+
`}catch{}return updated}function loadIdentity(entry2){if(!entry2.dir)return null;let agentsPath=join26(entry2.dir,"AGENTS.md");if(existsSync24(agentsPath))return agentsPath;return null}function builtinToEntry(agent){return{name:agent.name,dir:"",promptMode:agent.promptMode??"append",model:agent.model,roles:[],registeredAt:"(built-in)"}}function roleToEntry(role,team,metadata,createdAt){if(!(metadata&&Object.keys(metadata).length>0)){let builtin=[...BUILTIN_ROLES,...BUILTIN_COUNCIL_MEMBERS].find((b2)=>b2.name===role);if(builtin)return builtinToEntry(builtin)}let registeredAt=(typeof metadata?.registeredAt==="string"?metadata.registeredAt:void 0)??createdAt??"";return{name:role,dir:metadata?.dir||"",promptMode:metadata?.promptMode||"append",model:metadata?.model,roles:[],registeredAt,description:metadata?.description,color:metadata?.color,provider:metadata?.provider,permissions:metadata?.permissions,disallowedTools:metadata?.disallowedTools,omniScopes:metadata?.omniScopes,hooks:metadata?.hooks,sdk:metadata?.sdk,bridgeTmuxSession:metadata?.bridgeTmuxSession,...metadata?.repo?{repo:metadata.repo}:team?{repo:team}:{}}}function buildMetadata(entry2){let meta={};if(entry2.dir)meta.dir=entry2.dir;if(entry2.repo)meta.repo=entry2.repo;if(entry2.model)meta.model=entry2.model;if(entry2.promptMode&&entry2.promptMode!=="append")meta.promptMode=entry2.promptMode;if(entry2.description)meta.description=entry2.description;if(entry2.color)meta.color=entry2.color;if(entry2.provider)meta.provider=entry2.provider;if(entry2.permissions)meta.permissions=entry2.permissions;if(entry2.disallowedTools)meta.disallowedTools=entry2.disallowedTools;if(entry2.omniScopes)meta.omniScopes=entry2.omniScopes;if(entry2.hooks)meta.hooks=entry2.hooks;if(entry2.sdk)meta.sdk=entry2.sdk;return meta.bridgeTmuxSession=entry2.bridgeTmuxSession??null,meta}function parseMetadata(raw){if(!raw)return{};if(typeof raw==="object"&&!Array.isArray(raw))return raw;if(typeof raw==="string")try{return JSON.parse(raw)}catch{return{}}return{}}var init_agent_directory=__esm(()=>{init_builtin_agents()});var exports_runtime_events={};__export(exports_runtime_events,{waitForRuntimeEvent:()=>waitForRuntimeEvent,queryRuntimeEventThroughput:()=>queryRuntimeEventThroughput,publishSubjectEvent:()=>publishSubjectEvent,publishRuntimeEvent:()=>publishRuntimeEvent,listRuntimeEvents:()=>listRuntimeEvents,getLatestRuntimeEventId:()=>getLatestRuntimeEventId,followRuntimeEvents:()=>followRuntimeEvents});class EventCircuitBreaker{failures=0;lastFailure=0;loggedOpen=!1;threshold=5;cooldown=30000;isOpen(){if(this.failures<this.threshold)return!1;if(Date.now()-this.lastFailure>this.cooldown)return this.failures=0,!1;return!0}recordSuccess(){if(this.failures>=this.threshold)console.warn("[runtime-events] circuit breaker closed \u2014 PG writes resumed");this.failures=0,this.loggedOpen=!1}recordFailure(){if(this.failures++,this.lastFailure=Date.now(),this.failures>=this.threshold&&!this.loggedOpen)console.warn(`[runtime-events] circuit breaker open \u2014 skipping PG writes for ${this.cooldown/1000}s after ${this.threshold} consecutive failures`),this.loggedOpen=!0}get state(){if(this.failures<this.threshold)return"closed";if(Date.now()-this.lastFailure>this.cooldown)return"half-open";return"open"}}function logFollowDrainError(context,error2,active){if(!active)return;let message=error2 instanceof Error?error2.message:String(error2);console.error(`[runtime-events] ${context} drain failed: ${message}`)}function rowToRuntimeEvent(row){return{id:Number(row.id),repoPath:row.repo_path,timestamp:row.created_at instanceof Date?row.created_at.toISOString():String(row.created_at),kind:row.kind,agent:row.agent,team:row.team??void 0,direction:row.direction??void 0,peer:row.peer??void 0,text:row.text,data:row.data??void 0,source:row.source,subject:row.subject??void 0,threadId:row.thread_id??void 0,traceId:row.trace_id??void 0,parentEventId:row.parent_event_id!=null?Number(row.parent_event_id):void 0}}function nextParam(values2,value){return values2.push(value),`$${values2.length}`}function buildScopeClause(query,values2){let scopeClauses=[];if(query.agentIds&&query.agentIds.length>0)scopeClauses.push(`agent = ANY(${nextParam(values2,query.agentIds)})`);if(query.team)scopeClauses.push(`team = ${nextParam(values2,query.team)}`);if(query.teamPrefix)scopeClauses.push(`team LIKE ${nextParam(values2,`${query.teamPrefix}%`)}`);if(scopeClauses.length===0)return null;if(scopeClauses.length===1)return scopeClauses[0];if(query.scopeMode==="any")return`(${scopeClauses.join(" OR ")})`;return`(${scopeClauses.join(" AND ")})`}function buildWhere(query){let values2=[],clauses=[];if(query.afterId!=null)clauses.push(`id > ${nextParam(values2,query.afterId)}`);if(query.repoPath)clauses.push(`repo_path = ${nextParam(values2,query.repoPath)}`);if(query.subject)clauses.push(`subject = ${nextParam(values2,query.subject)}`);if(query.kinds&&query.kinds.length>0)clauses.push(`kind = ANY(${nextParam(values2,query.kinds)})`);if(query.since)clauses.push(`created_at >= ${nextParam(values2,query.since)}`);if(query.threadId)clauses.push(`thread_id = ${nextParam(values2,query.threadId)}`);if(query.traceId)clauses.push(`trace_id = ${nextParam(values2,query.traceId)}`);let scopeClause=buildScopeClause(query,values2);if(scopeClause)clauses.push(scopeClause);return{clause:clauses.length>0?`WHERE ${clauses.join(" AND ")}`:"",values:values2}}async function publishRuntimeEvent(input){if(circuitBreaker.isOpen())throw Error("circuit breaker open \u2014 PG event write skipped");try{let sql=await getConnection(),threadId=input.threadId??`agent:${input.agent}`,rows=await sql`
|
|
759
759
|
INSERT INTO genie_runtime_events (
|
|
760
760
|
repo_path, subject, kind, source, agent, team, direction, peer, text, data, thread_id, trace_id, parent_event_id, created_at
|
|
761
761
|
)
|
|
@@ -2175,7 +2175,7 @@ Flow: 1) \`omni say "..."\` to reply \u2192 2) \`omni done\` to close.
|
|
|
2175
2175
|
Bare text output goes nowhere \u2014 you MUST use omni verbs to reach the user.
|
|
2176
2176
|
|
|
2177
2177
|
The user's message:
|
|
2178
|
-
`.trim()}import{randomUUID as randomUUID10}from"crypto";import{homedir as homedir27}from"os";import{join as join42}from"path";function safeName(raw,maxLen=30){return raw.replace(/[^a-zA-Z0-9._-]/g,"").slice(0,maxLen)||"unknown"}function sanitizeWindowName2(chatId,chatName){let whatsappDm=chatId.match(/^(\d+)@s\.whatsapp\.net$/);if(whatsappDm)return`wa-${whatsappDm[1]}`;let whatsappGroup=chatId.match(/^(\d+)@g\.us$/);if(whatsappGroup)return`grp-${chatName?safeName(chatName):whatsappGroup[1]}`;let lid=chatId.match(/^(\d+)@lid$/);if(lid)return chatName?`wa-${safeName(chatName)}`:`lid-${lid[1]}`;return`chat-${safeName(chatId)}`}function resolveBridgeTmuxSession(agentName,entryBridgeTmuxSession,envOverride){return(
|
|
2178
|
+
`.trim()}import{randomUUID as randomUUID10}from"crypto";import{homedir as homedir27}from"os";import{join as join42}from"path";function safeName(raw,maxLen=30){return raw.replace(/[^a-zA-Z0-9._-]/g,"").slice(0,maxLen)||"unknown"}function sanitizeWindowName2(chatId,chatName){let whatsappDm=chatId.match(/^(\d+)@s\.whatsapp\.net$/);if(whatsappDm)return`wa-${whatsappDm[1]}`;let whatsappGroup=chatId.match(/^(\d+)@g\.us$/);if(whatsappGroup)return`grp-${chatName?safeName(chatName):whatsappGroup[1]}`;let lid=chatId.match(/^(\d+)@lid$/);if(lid)return chatName?`wa-${safeName(chatName)}`:`lid-${lid[1]}`;return`chat-${safeName(chatId)}`}function resolveBridgeTmuxSession(agentName,entryBridgeTmuxSession,envOverride){return(envOverride||entryBridgeTmuxSession||agentName).replace(/[\/:]/g,"-")}async function lookupChatName(chatId,_instanceId){try{let configPath2=join42(homedir27(),".omni","config.json"),{readFileSync:readFileSync22}=await import("fs"),config=JSON.parse(readFileSync22(configPath2,"utf-8")),apiUrl=config.apiUrl||"http://localhost:8882",apiKey=config.apiKey||"";if(!apiKey)return null;let url=`${apiUrl}/api/v2/chats?externalId=${encodeURIComponent(chatId)}`,res=await fetch(url,{headers:{Authorization:`Bearer ${apiKey}`},signal:AbortSignal.timeout(3000)});if(!res.ok)return null;let body=await res.json();return(body.items?.find((c)=>c.externalId===chatId)??body.items?.[0])?.name||null}catch{return null}}function buildOmniSpawnParams(agentName,chatId,entry2,env,initialMessage){let instanceId=env.OMNI_INSTANCE??"",senderName=env.OMNI_SENDER_NAME??"whatsapp-user",turnContext=buildTurnBasedPrompt(senderName,instanceId,chatId),fullInitialPrompt=initialMessage?`${turnContext}
|
|
2179
2179
|
|
|
2180
2180
|
---
|
|
2181
2181
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genie",
|
|
3
|
-
"version": "4.260421.
|
|
3
|
+
"version": "4.260421.21",
|
|
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"
|