agentix-cli 0.136.1 → 0.137.1

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.
Files changed (147) hide show
  1. package/apps/mac-voice/Sources/AgentXVoice/AgentClient.swift +11 -1
  2. package/apps/mac-voice/Sources/AgentXVoice/Character.swift +18 -5
  3. package/apps/mac-voice/Sources/AgentXVoice/Floor.swift +46 -0
  4. package/apps/mac-voice/Sources/AgentXVoice/FloorWatcher.swift +78 -0
  5. package/apps/mac-voice/Sources/AgentXVoice/Panel.swift +12 -1
  6. package/apps/mac-voice/Sources/AgentXVoice/StatusMenu.swift +8 -0
  7. package/apps/mac-voice/Sources/AgentXVoice/main.swift +89 -10
  8. package/dist/{App-D6W6IV2L.js → App-TOAWET76.js} +2 -2
  9. package/dist/{ChatApp-X7TNCFGW.js → ChatApp-4DRCRKFS.js} +2 -2
  10. package/dist/{absorb-eval-COPVH2M2.js → absorb-eval-OXNL5QGQ.js} +2 -2
  11. package/dist/{agent-TMTYLAOV.js → agent-GALMGMNJ.js} +2 -2
  12. package/dist/{board-dashboard-OSI4X5ZJ.js → board-dashboard-VXQYQY22.js} +4 -4
  13. package/dist/{board-dashboard-OSI4X5ZJ.js.map → board-dashboard-VXQYQY22.js.map} +1 -1
  14. package/dist/{chunk-AK3XOA5N.js → chunk-23LWLYOK.js} +2 -2
  15. package/dist/{chunk-IPMXIPTS.js → chunk-2JKKGS77.js} +2 -2
  16. package/dist/{chunk-QW3L5IIC.js → chunk-36HFRKIH.js} +2 -2
  17. package/dist/{chunk-HZZW35FY.js → chunk-3K3LRLZX.js} +2 -2
  18. package/dist/{chunk-NVZ66ITP.js → chunk-5ADXRVYT.js} +5 -5
  19. package/dist/{chunk-NVZ66ITP.js.map → chunk-5ADXRVYT.js.map} +1 -1
  20. package/dist/{chunk-GL3H7XMI.js → chunk-5RHCM3L7.js} +2 -2
  21. package/dist/{chunk-63LV77EG.js → chunk-635B6SXI.js} +2 -2
  22. package/dist/{chunk-FQLSV2C4.js → chunk-7JUISIE7.js} +2 -2
  23. package/dist/{chunk-XXIZGNLT.js → chunk-ADQUFEPJ.js} +233 -233
  24. package/dist/chunk-ADQUFEPJ.js.map +1 -0
  25. package/dist/{chunk-5J5USW2O.js → chunk-B6PMIUVV.js} +2 -2
  26. package/dist/{chunk-GRMCAO3Q.js → chunk-BWXRAPTX.js} +2 -2
  27. package/dist/{chunk-WRJFKA43.js → chunk-BXXP6DTB.js} +2 -2
  28. package/dist/{chunk-OW5EXDVY.js → chunk-E3AEOQMK.js} +2 -2
  29. package/dist/{chunk-VA24JS2S.js → chunk-GIQKQD2B.js} +2 -2
  30. package/dist/{chunk-5X37CXJF.js → chunk-IIFHX625.js} +2 -2
  31. package/dist/{chunk-EVTTAM7S.js → chunk-JC5KLH2K.js} +2 -2
  32. package/dist/{chunk-EGDY762K.js → chunk-K6UV4A2T.js} +2 -2
  33. package/dist/{chunk-EGDY762K.js.map → chunk-K6UV4A2T.js.map} +1 -1
  34. package/dist/chunk-KHYF6KTY.js +54 -0
  35. package/dist/chunk-KHYF6KTY.js.map +1 -0
  36. package/dist/chunk-KQ7KWFZY.js +4 -0
  37. package/dist/chunk-KQ7KWFZY.js.map +1 -0
  38. package/dist/{chunk-QHZFMO6M.js → chunk-LK4YO2FE.js} +2 -2
  39. package/dist/{chunk-QHZFMO6M.js.map → chunk-LK4YO2FE.js.map} +1 -1
  40. package/dist/{chunk-G26UHWS4.js → chunk-MXDWLBIA.js} +2 -2
  41. package/dist/{chunk-M5AHI2PZ.js → chunk-PLPDG6GE.js} +2 -2
  42. package/dist/{chunk-PV623BLN.js → chunk-PNYBZPPB.js} +3 -3
  43. package/dist/{chunk-4AFA6LQZ.js → chunk-RWMDDMYX.js} +2 -2
  44. package/dist/{chunk-66DPMVUC.js → chunk-SQ37I2MD.js} +2 -2
  45. package/dist/{chunk-KZXQD6ZK.js → chunk-XZIKAHFU.js} +2 -2
  46. package/dist/{chunk-HEJTE7OC.js → chunk-Z2QOQBUS.js} +2 -2
  47. package/dist/{chunk-XGOBZCYC.js → chunk-Z5OD225A.js} +2 -2
  48. package/dist/{chunk-FRTELYZ4.js → chunk-ZYUVKFX2.js} +2 -2
  49. package/dist/cli.js +1 -1
  50. package/dist/{client-SMOWSRJY.js → client-PWE4BJH4.js} +2 -2
  51. package/dist/{config-OGUDWYAA.js → config-E53FBZ47.js} +2 -2
  52. package/dist/{config-mutate-BH27TMWK.js → config-mutate-ZEHN6JMZ.js} +2 -2
  53. package/dist/config-mutator-AK775RTM.js +2 -0
  54. package/dist/{contributions-H6T65TCY.js → contributions-CLLCLS3O.js} +2 -2
  55. package/dist/{doctor-ZOXHT7ZQ.js → doctor-XKT5FWPO.js} +2 -2
  56. package/dist/{follow-up-tool-GUBBXNEZ.js → follow-up-tool-ZFRZUZLI.js} +2 -2
  57. package/dist/{hub-7AMS6ADP.js → hub-N5ADP3LO.js} +2 -2
  58. package/dist/index.d.ts +74 -35
  59. package/dist/index.js +1 -1
  60. package/dist/ntfy-ZDNBUEIX.js +2 -0
  61. package/dist/{program-IUUHETTV.js → program-MJ6S6X6T.js} +208 -208
  62. package/dist/program-MJ6S6X6T.js.map +1 -0
  63. package/dist/{promote-VCNVE5JD.js → promote-M4UBD2R6.js} +2 -2
  64. package/dist/push-HVGOC4VN.js +2 -0
  65. package/dist/push-bridge-NAQ7WQJX.js +2 -0
  66. package/dist/{query-6G27CBZQ.js → query-KMQHF5HW.js} +2 -2
  67. package/dist/{query-settings-G4M75LVQ.js → query-settings-PENAE4UG.js} +2 -2
  68. package/dist/{registry-MMNG5VZ6.js → registry-GYKSYSDD.js} +2 -2
  69. package/dist/{request-planner-T3VCZVVQ.js → request-planner-GBX6DHRQ.js} +2 -2
  70. package/dist/{review-candidates-C3O3CENL.js → review-candidates-SYMRJGI2.js} +2 -2
  71. package/dist/{routing-LD35TJM5.js → routing-S3L44JLL.js} +2 -2
  72. package/dist/schedule-tool-FXUFRZHR.js +2 -0
  73. package/dist/{scheduler-I3QB4GI3.js → scheduler-AW4F5ZKS.js} +2 -2
  74. package/dist/{seat-4Y3EW3KU.js → seat-QBBNCOFO.js} +2 -2
  75. package/dist/{select-LZKN3FER.js → select-ZCFIMYWS.js} +2 -2
  76. package/dist/{set-enabled-WSTOHJDE.js → set-enabled-4F27A3U2.js} +2 -2
  77. package/dist/{tool-NLMIUOHR.js → tool-G6XTO24J.js} +2 -2
  78. package/dist/{tool-AKXO2EJU.js → tool-M462KSMF.js} +2 -2
  79. package/dist/{wiki-ZQMDUXTE.js → wiki-JXVHIEZI.js} +2 -2
  80. package/dist/wiki-enrich-6CSUPULH.js +2 -0
  81. package/package.json +1 -1
  82. package/dist/chunk-54OORW5I.js +0 -54
  83. package/dist/chunk-54OORW5I.js.map +0 -1
  84. package/dist/chunk-KZKDVIOE.js +0 -4
  85. package/dist/chunk-KZKDVIOE.js.map +0 -1
  86. package/dist/chunk-XXIZGNLT.js.map +0 -1
  87. package/dist/config-mutator-Q62AS2TR.js +0 -2
  88. package/dist/ntfy-52EXHVMD.js +0 -2
  89. package/dist/program-IUUHETTV.js.map +0 -1
  90. package/dist/push-DID6RZYI.js +0 -2
  91. package/dist/push-bridge-325SXDGN.js +0 -2
  92. package/dist/schedule-tool-46TVGEYU.js +0 -2
  93. package/dist/wiki-enrich-NPNOSTRM.js +0 -2
  94. /package/dist/{App-D6W6IV2L.js.map → App-TOAWET76.js.map} +0 -0
  95. /package/dist/{ChatApp-X7TNCFGW.js.map → ChatApp-4DRCRKFS.js.map} +0 -0
  96. /package/dist/{absorb-eval-COPVH2M2.js.map → absorb-eval-OXNL5QGQ.js.map} +0 -0
  97. /package/dist/{agent-TMTYLAOV.js.map → agent-GALMGMNJ.js.map} +0 -0
  98. /package/dist/{chunk-AK3XOA5N.js.map → chunk-23LWLYOK.js.map} +0 -0
  99. /package/dist/{chunk-IPMXIPTS.js.map → chunk-2JKKGS77.js.map} +0 -0
  100. /package/dist/{chunk-QW3L5IIC.js.map → chunk-36HFRKIH.js.map} +0 -0
  101. /package/dist/{chunk-HZZW35FY.js.map → chunk-3K3LRLZX.js.map} +0 -0
  102. /package/dist/{chunk-GL3H7XMI.js.map → chunk-5RHCM3L7.js.map} +0 -0
  103. /package/dist/{chunk-63LV77EG.js.map → chunk-635B6SXI.js.map} +0 -0
  104. /package/dist/{chunk-FQLSV2C4.js.map → chunk-7JUISIE7.js.map} +0 -0
  105. /package/dist/{chunk-5J5USW2O.js.map → chunk-B6PMIUVV.js.map} +0 -0
  106. /package/dist/{chunk-GRMCAO3Q.js.map → chunk-BWXRAPTX.js.map} +0 -0
  107. /package/dist/{chunk-WRJFKA43.js.map → chunk-BXXP6DTB.js.map} +0 -0
  108. /package/dist/{chunk-OW5EXDVY.js.map → chunk-E3AEOQMK.js.map} +0 -0
  109. /package/dist/{chunk-VA24JS2S.js.map → chunk-GIQKQD2B.js.map} +0 -0
  110. /package/dist/{chunk-5X37CXJF.js.map → chunk-IIFHX625.js.map} +0 -0
  111. /package/dist/{chunk-EVTTAM7S.js.map → chunk-JC5KLH2K.js.map} +0 -0
  112. /package/dist/{chunk-G26UHWS4.js.map → chunk-MXDWLBIA.js.map} +0 -0
  113. /package/dist/{chunk-M5AHI2PZ.js.map → chunk-PLPDG6GE.js.map} +0 -0
  114. /package/dist/{chunk-PV623BLN.js.map → chunk-PNYBZPPB.js.map} +0 -0
  115. /package/dist/{chunk-4AFA6LQZ.js.map → chunk-RWMDDMYX.js.map} +0 -0
  116. /package/dist/{chunk-66DPMVUC.js.map → chunk-SQ37I2MD.js.map} +0 -0
  117. /package/dist/{chunk-KZXQD6ZK.js.map → chunk-XZIKAHFU.js.map} +0 -0
  118. /package/dist/{chunk-HEJTE7OC.js.map → chunk-Z2QOQBUS.js.map} +0 -0
  119. /package/dist/{chunk-XGOBZCYC.js.map → chunk-Z5OD225A.js.map} +0 -0
  120. /package/dist/{chunk-FRTELYZ4.js.map → chunk-ZYUVKFX2.js.map} +0 -0
  121. /package/dist/{client-SMOWSRJY.js.map → client-PWE4BJH4.js.map} +0 -0
  122. /package/dist/{config-OGUDWYAA.js.map → config-E53FBZ47.js.map} +0 -0
  123. /package/dist/{config-mutate-BH27TMWK.js.map → config-mutate-ZEHN6JMZ.js.map} +0 -0
  124. /package/dist/{config-mutator-Q62AS2TR.js.map → config-mutator-AK775RTM.js.map} +0 -0
  125. /package/dist/{contributions-H6T65TCY.js.map → contributions-CLLCLS3O.js.map} +0 -0
  126. /package/dist/{doctor-ZOXHT7ZQ.js.map → doctor-XKT5FWPO.js.map} +0 -0
  127. /package/dist/{follow-up-tool-GUBBXNEZ.js.map → follow-up-tool-ZFRZUZLI.js.map} +0 -0
  128. /package/dist/{hub-7AMS6ADP.js.map → hub-N5ADP3LO.js.map} +0 -0
  129. /package/dist/{ntfy-52EXHVMD.js.map → ntfy-ZDNBUEIX.js.map} +0 -0
  130. /package/dist/{promote-VCNVE5JD.js.map → promote-M4UBD2R6.js.map} +0 -0
  131. /package/dist/{push-DID6RZYI.js.map → push-HVGOC4VN.js.map} +0 -0
  132. /package/dist/{push-bridge-325SXDGN.js.map → push-bridge-NAQ7WQJX.js.map} +0 -0
  133. /package/dist/{query-6G27CBZQ.js.map → query-KMQHF5HW.js.map} +0 -0
  134. /package/dist/{query-settings-G4M75LVQ.js.map → query-settings-PENAE4UG.js.map} +0 -0
  135. /package/dist/{registry-MMNG5VZ6.js.map → registry-GYKSYSDD.js.map} +0 -0
  136. /package/dist/{request-planner-T3VCZVVQ.js.map → request-planner-GBX6DHRQ.js.map} +0 -0
  137. /package/dist/{review-candidates-C3O3CENL.js.map → review-candidates-SYMRJGI2.js.map} +0 -0
  138. /package/dist/{routing-LD35TJM5.js.map → routing-S3L44JLL.js.map} +0 -0
  139. /package/dist/{schedule-tool-46TVGEYU.js.map → schedule-tool-FXUFRZHR.js.map} +0 -0
  140. /package/dist/{scheduler-I3QB4GI3.js.map → scheduler-AW4F5ZKS.js.map} +0 -0
  141. /package/dist/{seat-4Y3EW3KU.js.map → seat-QBBNCOFO.js.map} +0 -0
  142. /package/dist/{select-LZKN3FER.js.map → select-ZCFIMYWS.js.map} +0 -0
  143. /package/dist/{set-enabled-WSTOHJDE.js.map → set-enabled-4F27A3U2.js.map} +0 -0
  144. /package/dist/{tool-NLMIUOHR.js.map → tool-G6XTO24J.js.map} +0 -0
  145. /package/dist/{tool-AKXO2EJU.js.map → tool-M462KSMF.js.map} +0 -0
  146. /package/dist/{wiki-ZQMDUXTE.js.map → wiki-JXVHIEZI.js.map} +0 -0
  147. /package/dist/{wiki-enrich-NPNOSTRM.js.map → wiki-enrich-6CSUPULH.js.map} +0 -0
@@ -0,0 +1,4 @@
1
+ var $=[1e3,3e3,8e3];function w(e){let t=e,n=t?.message??String(e),s=t?.cause;return s?.code?`${n} code=${s.code}`:s?.message&&s.message!==n?`${n} (${s.message})`:n}function b(e){return e===429||e>=500}function u(e){return/^[\x20-\x7E]*$/.test(e)?e:`=?UTF-8?B?${Buffer.from(e,"utf8").toString("base64")}?=`}function v(e){let t=e.split(`
2
+ `),n=(t[0]??"").trim(),s=t.slice(1).join(`
3
+ `).trim();return s?n.length===0||n.length>80?{body:e.trim()}:{title:n,body:s}:{body:e.trim()}}var h=class{name="ntfy";config;log;constructor(t,n=console.error.bind(console,"[ntfy]")){this.config=t,this.log=n}async start(){this.log(`ntfy: ready (${this.serverUrl()}/${this.config.topic})`)}async stop(){}onMessage(t){}serverUrl(){return(this.config.server||"https://ntfy.sh").replace(/\/+$/,"")}async send(t){let n=(t.chatId||"").trim(),s=n&&n!=="default"?n:this.config.topic;if(!s)throw new Error("ntfy: no topic (pass chatId, or set channels.ntfy.topic)");let f=v(t.text||""),y=f.title||this.config.defaultTitle||"AgentX",c={"Content-Type":"text/plain; charset=utf-8",Title:u(y),Priority:String(this.config.defaultPriority??3)};if(this.config.token&&(c.Authorization=`Bearer ${this.config.token}`),t.parseMode==="markdown"&&(c.Markdown="yes"),t.buttons?.length){let i=t.buttons.slice(0,3).map(r=>`view, ${r.label.replace(/[,;]/g," ")}, ${r.url}`).join("; ");c.Actions=u(i)}let m=`${this.serverUrl()}/${encodeURIComponent(s)}`,p=f.body||t.text||"",l=this.config.retryDelaysMs??$,g=l.length+1;for(let i=1;;i++){let r,o;try{r=await fetch(m,{method:"POST",headers:c,body:p})}catch(a){o=new Error(`ntfy: ${w(a)}`,{cause:a})}if(r){if(r.ok)return(await r.json().catch(()=>null))?.id;let a=await r.text().catch(()=>"");if(o=new Error(`ntfy: ${r.status} ${a.slice(0,200)}`),!b(r.status))throw o}if(i>=g)throw this.log(`ntfy: send failed after ${g} attempt(s): ${o.message}`),o;let d=l[i-1];this.log(`ntfy: attempt ${i}/${g} failed (${o.message}); retrying in ${d} ms`),await new Promise(a=>setTimeout(a,d))}}};export{w as a,v as b,h as c};
4
+ //# sourceMappingURL=chunk-KQ7KWFZY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/channels/ntfy.ts"],"sourcesContent":["import type { ChannelAdapter, IncomingMessage, OutgoingMessage } from \"./types\"\n\n// --- ntfy channel — push notifications to the operator's phone ---\n//\n// Outbound only. ntfy has an inbound side (SSE subscribe), but nothing here\n// wants it: a push notification is a one-way tap on the shoulder, and replies\n// come back through the channels that already carry conversation (Telegram,\n// WhatsApp) or through POST /ask when Siri asks a follow-up.\n//\n// Registering it as a ChannelAdapter rather than a bespoke notifier is what\n// makes it free everywhere: notifications.destination, POST /send, cron\n// failure pings, and the agent-facing `channel` action all funnel through\n// router.sendOutbound() and already know how to address a channel + chatId.\n//\n// Addressing: `chatId` is the ntfy topic. The literal `\"default\"` (and an\n// empty string) resolve to the configured topic instead. That indirection\n// exists so agents never have to carry the topic in their prompts — on the\n// public ntfy.sh the topic IS the credential, and every caller that funnels\n// through the router (POST /send, channel.reply) requires a non-empty chatId.\n\nexport interface NtfyConfig {\n /** Base URL of the ntfy server. Default is the public ntfy.sh. */\n server?: string\n /** Default topic when an OutgoingMessage carries no chatId. */\n topic: string\n /** Access token for protected topics (ntfy `Authorization: Bearer`). */\n token?: string\n /** 1 (min) .. 5 (max). ntfy's default is 3. */\n defaultPriority?: number\n /** Notification title. Per-message titles override it. */\n defaultTitle?: string\n /** Waits between attempts when a publish fails on the network or with a\n * 429/5xx. One attempt more than there are entries. */\n retryDelaysMs?: number[]\n}\n\nconst DEFAULT_RETRY_DELAYS_MS = [1000, 3000, 8000]\n\n/** `fetch failed` hides the reason in `cause`; surface its code so a log\n * line says ETIMEDOUT or ECONNREFUSED rather than nothing useful (#930). */\nexport function describeFetchError(e: unknown): string {\n const err = e as { message?: string; cause?: { code?: string; message?: string } }\n const message = err?.message ?? String(e)\n const cause = err?.cause\n if (cause?.code) return `${message} code=${cause.code}`\n if (cause?.message && cause.message !== message) return `${message} (${cause.message})`\n return message\n}\n\nfunction isRetryableStatus(status: number): boolean {\n return status === 429 || status >= 500\n}\n\n/**\n * ntfy requires header values to be ASCII. Titles and tags routinely aren't\n * (French accents, Arabic), so non-ASCII values go out as RFC 2047 encoded\n * words, which ntfy decodes. Pure-ASCII values are passed through untouched\n * so the common case stays readable in logs.\n */\nfunction encodeHeader(value: string): string {\n // eslint-disable-next-line no-control-regex\n if (/^[\\x20-\\x7E]*$/.test(value)) return value\n return `=?UTF-8?B?${Buffer.from(value, \"utf8\").toString(\"base64\")}?=`\n}\n\n/** First line of the body, when it reads like a title (short, no trailing\n * punctuation that implies a sentence continues). Lets an agent write a\n * single blob and still get a well-formed notification. */\nexport function splitTitle(text: string): { title?: string; body: string } {\n const lines = text.split(\"\\n\")\n const first = (lines[0] ?? \"\").trim()\n const rest = lines.slice(1).join(\"\\n\").trim()\n if (!rest) return { body: text.trim() }\n if (first.length === 0 || first.length > 80) return { body: text.trim() }\n return { title: first, body: rest }\n}\n\nexport class NtfyAdapter implements ChannelAdapter {\n readonly name = \"ntfy\"\n private config: NtfyConfig\n private log: (...args: unknown[]) => void\n\n constructor(config: NtfyConfig, log: (...args: unknown[]) => void = console.error.bind(console, \"[ntfy]\")) {\n this.config = config\n this.log = log\n }\n\n async start(): Promise<void> {\n this.log(`ntfy: ready (${this.serverUrl()}/${this.config.topic})`)\n }\n\n async stop(): Promise<void> {}\n\n /** No inbound side — the handler is accepted and never invoked, which\n * satisfies router.addChannel() without pretending to poll. */\n onMessage(_handler: (msg: IncomingMessage) => Promise<void>): void {}\n\n private serverUrl(): string {\n return (this.config.server || \"https://ntfy.sh\").replace(/\\/+$/, \"\")\n }\n\n async send(msg: OutgoingMessage): Promise<string | void> {\n const requested = (msg.chatId || \"\").trim()\n const topic = requested && requested !== \"default\" ? requested : this.config.topic\n if (!topic) throw new Error(\"ntfy: no topic (pass chatId, or set channels.ntfy.topic)\")\n\n const split = splitTitle(msg.text || \"\")\n const title = split.title || this.config.defaultTitle || \"AgentX\"\n\n const headers: Record<string, string> = {\n \"Content-Type\": \"text/plain; charset=utf-8\",\n \"Title\": encodeHeader(title),\n \"Priority\": String(this.config.defaultPriority ?? 3),\n }\n if (this.config.token) headers[\"Authorization\"] = `Bearer ${this.config.token}`\n if (msg.parseMode === \"markdown\") headers[\"Markdown\"] = \"yes\"\n\n // URL buttons map onto ntfy's view actions, so an alert can carry\n // \"open the MR\" without the operator hunting for it.\n if (msg.buttons?.length) {\n const actions = msg.buttons\n .slice(0, 3) // ntfy caps at 3\n .map(b => `view, ${b.label.replace(/[,;]/g, \" \")}, ${b.url}`)\n .join(\"; \")\n headers[\"Actions\"] = encodeHeader(actions)\n }\n\n const url = `${this.serverUrl()}/${encodeURIComponent(topic)}`\n const body = split.body || msg.text || \"\"\n const delays = this.config.retryDelaysMs ?? DEFAULT_RETRY_DELAYS_MS\n const attempts = delays.length + 1\n\n // A slow or flapping link loses pushes that a few seconds later would\n // go through. Retry network failures and server-side errors; a 4xx is\n // the request itself and fails at once.\n for (let attempt = 1; ; attempt++) {\n let res: Response | undefined\n let failure!: Error\n try {\n res = await fetch(url, { method: \"POST\", headers, body })\n } catch (e) {\n failure = new Error(`ntfy: ${describeFetchError(e)}`, { cause: e })\n }\n if (res) {\n if (res.ok) {\n const json = await res.json().catch(() => null) as { id?: string } | null\n return json?.id\n }\n const detail = await res.text().catch(() => \"\")\n failure = new Error(`ntfy: ${res.status} ${detail.slice(0, 200)}`)\n if (!isRetryableStatus(res.status)) throw failure\n }\n if (attempt >= attempts) {\n this.log(`ntfy: send failed after ${attempts} attempt(s): ${failure.message}`)\n throw failure\n }\n const wait = delays[attempt - 1]\n this.log(`ntfy: attempt ${attempt}/${attempts} failed (${failure.message}); retrying in ${wait} ms`)\n await new Promise(r => setTimeout(r, wait))\n }\n }\n}\n"],"mappings":"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","names":["DEFAULT_RETRY_DELAYS_MS","describeFetchError","err","message","cause","isRetryableStatus","status","encodeHeader","value","splitTitle","text","lines","first","rest","NtfyAdapter","config","log","_handler","msg","requested","topic","split","title","headers","actions","b","url","body","delays","attempts","attempt","res","failure","e","detail","wait","r"]}
@@ -1,4 +1,4 @@
1
- import{a as Re}from"./chunk-GTJIKXDB.js";import{a as w}from"./chunk-7LN4VKDU.js";import{a as ne}from"./chunk-IMLAPB7G.js";import{q as Kt}from"./chunk-S2GAEH2F.js";import{b as Jt}from"./chunk-WCXXXAHV.js";import{f as Yt,g as Ae,i as V,j as q,l as Zt}from"./chunk-AKWBDCMU.js";import{t as Xt,u as Gt}from"./chunk-63LV77EG.js";import{d as Ht,e as zt}from"./chunk-AQASR6KR.js";import{X as Nt,Z as te,_ as ve,aa as $e,b as Se}from"./chunk-HZZW35FY.js";import{a as Vt,b as qt,d as Bt}from"./chunk-Y4CYQV7G.js";import{a as Lt,b as Ot}from"./chunk-SHEUCITK.js";import{g as Mt,h as jt,i as Wt,k as Ft,l as Ut}from"./chunk-GL3H7XMI.js";import{q as Pt}from"./chunk-AK3XOA5N.js";import{a as Ct,b as Dt}from"./chunk-WRJFKA43.js";import{A as Rt,B as _t,ha as xe,n as ee,o as St,oa as It,p as vt,pa as Et,q as Jr,xa as Tt,y as $t,z as At}from"./chunk-54OORW5I.js";import{a as we,h as Yr}from"./chunk-BRK6M6LA.js";import{f as ke,n as Zr}from"./chunk-UIBUZ2N3.js";import{existsSync as Qr,readdirSync as ei,readFileSync as ti,statSync as ni}from"fs";import{resolve as ri}from"path";function Qt(t,e,n=Date.now(),i=7){let r=i*864e5,s=new Map;for(let o of e){let a=s.get(o.workflowId);a?a.push(o):s.set(o.workflowId,[o])}return t.map(o=>{let a=s.get(o.id)??[],l=a.filter(f=>n-f.at<=r),c=a.filter(f=>n-f.at>r&&n-f.at<=r*2),u=l.filter(f=>f.status==="failed").length,d=a.filter(f=>f.status==="paused").length,p=a.length?Math.max(...a.map(f=>f.at)):null,g=a.length?c.length>0&&l.length===0?"dormant":l.length>0&&u*2>=l.length?"failing":l.length>0?"active":"quiet":"never";return{id:o.id,name:o.name||o.id,state:g,lastRunAt:p,recent:l.length,prior:c.length,failed:u,paused:d}}).sort((o,a)=>{let l={dormant:0,failing:1,active:2,quiet:3,never:4};return l[o.state]-l[a.state]||(a.lastRunAt??0)-(o.lastRunAt??0)})}var re=new Map;function Ea(t,e=1e3){if(!Qr(t))return[];let n=ei(t).filter(s=>s.endsWith(".jsonl")).map(s=>{let o=ri(t,s);return{path:o,mtime:ni(o).mtimeMs}}).sort((s,o)=>o.mtime-s.mtime).slice(0,e),i=new Set(n.map(s=>s.path));for(let s of re.keys())i.has(s)||re.delete(s);let r=[];for(let{path:s,mtime:o}of n){let a=re.get(s);if(a&&a.mtime===o){a.summary&&r.push(a.summary);continue}let l=ii(s,o);re.set(s,{mtime:o,summary:l}),l&&r.push(l)}return r}function ii(t,e){try{let n=ti(t,"utf-8").split(`
1
+ import{a as Re}from"./chunk-GTJIKXDB.js";import{a as w}from"./chunk-7LN4VKDU.js";import{a as ne}from"./chunk-IMLAPB7G.js";import{q as Kt}from"./chunk-S2GAEH2F.js";import{b as Jt}from"./chunk-WCXXXAHV.js";import{f as Yt,g as Ae,i as V,j as q,l as Zt}from"./chunk-AKWBDCMU.js";import{t as Xt,u as Gt}from"./chunk-635B6SXI.js";import{d as Ht,e as zt}from"./chunk-AQASR6KR.js";import{X as Nt,Z as te,_ as ve,aa as $e,b as Se}from"./chunk-3K3LRLZX.js";import{a as Vt,b as qt,d as Bt}from"./chunk-Y4CYQV7G.js";import{a as Lt,b as Ot}from"./chunk-SHEUCITK.js";import{g as Mt,h as jt,i as Wt,k as Ft,l as Ut}from"./chunk-5RHCM3L7.js";import{q as Pt}from"./chunk-23LWLYOK.js";import{a as Ct,b as Dt}from"./chunk-BXXP6DTB.js";import{Aa as Tt,B as $t,C as At,D as Rt,E as _t,ka as xe,n as ee,o as St,p as vt,q as Jr,ra as It,sa as Et}from"./chunk-KHYF6KTY.js";import{a as we,h as Yr}from"./chunk-BRK6M6LA.js";import{f as ke,n as Zr}from"./chunk-UIBUZ2N3.js";import{existsSync as Qr,readdirSync as ei,readFileSync as ti,statSync as ni}from"fs";import{resolve as ri}from"path";function Qt(t,e,n=Date.now(),i=7){let r=i*864e5,s=new Map;for(let o of e){let a=s.get(o.workflowId);a?a.push(o):s.set(o.workflowId,[o])}return t.map(o=>{let a=s.get(o.id)??[],l=a.filter(f=>n-f.at<=r),c=a.filter(f=>n-f.at>r&&n-f.at<=r*2),u=l.filter(f=>f.status==="failed").length,d=a.filter(f=>f.status==="paused").length,p=a.length?Math.max(...a.map(f=>f.at)):null,g=a.length?c.length>0&&l.length===0?"dormant":l.length>0&&u*2>=l.length?"failing":l.length>0?"active":"quiet":"never";return{id:o.id,name:o.name||o.id,state:g,lastRunAt:p,recent:l.length,prior:c.length,failed:u,paused:d}}).sort((o,a)=>{let l={dormant:0,failing:1,active:2,quiet:3,never:4};return l[o.state]-l[a.state]||(a.lastRunAt??0)-(o.lastRunAt??0)})}var re=new Map;function Ea(t,e=1e3){if(!Qr(t))return[];let n=ei(t).filter(s=>s.endsWith(".jsonl")).map(s=>{let o=ri(t,s);return{path:o,mtime:ni(o).mtimeMs}}).sort((s,o)=>o.mtime-s.mtime).slice(0,e),i=new Set(n.map(s=>s.path));for(let s of re.keys())i.has(s)||re.delete(s);let r=[];for(let{path:s,mtime:o}of n){let a=re.get(s);if(a&&a.mtime===o){a.summary&&r.push(a.summary);continue}let l=ii(s,o);re.set(s,{mtime:o,summary:l}),l&&r.push(l)}return r}function ii(t,e){try{let n=ti(t,"utf-8").split(`
2
2
  `).filter(Boolean);if(!n.length)return null;let i=JSON.parse(n[0]),r=i.run?.workflowId;if(!r)return null;let s=i.run?.status??"unknown";for(let o=n.length-1;o>=0;o--){let a=JSON.parse(n[o]),l=a.status??a.run?.status;if(l){s=l;break}}return{workflowId:r,status:s,at:e}}catch{return null}}var si={failStreak:3,disabledDays:30,missedFires:2,graceMs:15*6e4},k={routines:200,summary:160,filters:6,filterValue:60,text:120},oi=(t,e,n)=>{try{return Pt(t,e,n)}catch{return null}},en=864e5;function Pa(t){let e=t.now??Date.now(),n={...si,...t.thresholds},i=t.nextFire??oi,r=[];for(let a of t.crons){let l=t.cronRuns.get(a.id)??[],c=a.timezone||"UTC",u=l.map(g=>({at:Date.parse(g.startedAt),status:g.status})),d=l[0],p={id:`cron:${a.id}`,source:"cron",kind:"schedule",name:$(a.id,k.text),trigger:{schedule:$(a.schedule,k.text),timezone:c},agent:a.agent||null,enabled:a.enabled,state:a.enabled?"enabled":"disabled",nextRunAt:a.enabled?_e(a.nextRun)??_e(i(a.schedule,new Date(e),c)):null,lastRun:d?{at:d.startedAt,status:d.status,summary:pi(d.status==="success"?void 0:d.errorSummary,k.summary)}:null,lastSuccessAt:l.find(g=>g.status==="success")?.startedAt??null,consecutiveFailures:tn(u),sampledRuns:l.length,flags:[],attention:null};p.flags=nn(p,u,a.schedule,c,null,e,n,i),r.push(rn(p))}let s=new Map(Qt(t.workflows.map(a=>({id:a.id,name:a.title})),t.workflowRuns,e).map(a=>[a.id,a])),o=new Map;for(let a of t.workflowRuns){let l=o.get(a.workflowId);l?l.push(a):o.set(a.workflowId,[a])}for(let a of t.workflows){let l=a.nodes.find(I=>I.type.startsWith("trigger."));if(!l||l.type!=="trigger.cron"&&l.type!=="trigger.hook")continue;let c=l.config??{},u=a.state||"active",d=u==="active",p=(o.get(a.id)??[]).slice().sort((I,ye)=>ye.at-I.at),g=p.map(I=>({at:I.at,status:ci(I.status)})),f=g[0],h=l.type==="trigger.cron",b=typeof c.spec=="string"?c.spec:"",C=typeof c.timezone=="string"?c.timezone:"UTC",M={id:`workflow:${a.id}`,source:"workflow",kind:h?"schedule":"event",name:$(a.title||a.id,k.text),trigger:h?{schedule:$(b,k.text),timezone:C}:{event:$(typeof c.event=="string"?c.event:"",k.text),filters:di(c.filter,a)},agent:ui(a),enabled:d,state:u,nextRunAt:h&&d&&b?_e(i(b,new Date(e),C)):null,lastRun:f?{at:new Date(f.at).toISOString(),status:f.status}:null,lastSuccessAt:(()=>{let I=g.find(ye=>ye.status==="success");return I?new Date(I.at).toISOString():null})(),consecutiveFailures:tn(g),sampledRuns:p.length,flags:[],attention:null},Q=Date.parse(a.updated||a.created||"");M.flags=h?nn(M,g,b,C,Number.isFinite(Q)?Q:null,e,n,i):ai(M,s.get(a.id)?.state==="dormant",Number.isFinite(Q)?Q:null,e,n),r.push(rn(M))}return r.sort(li).slice(0,k.routines)}function tn(t){let e=0;for(let n of t)if(!(n.status==="running"||n.status==="paused"||n.status==="unknown"))if(n.status==="failed"||n.status==="timeout")e++;else break;return e}function nn(t,e,n,i,r,s,o,a){let l=[],c=e.length?e[0].at:null;if(!t.enabled){let p=on(c,r,s,o);return p&&l.push(p),l}if(t.consecutiveFailures>=o.failStreak&&l.push({reason:"failing",detail:`${t.consecutiveFailures} failed attempts in a row`}),c===null)return l.push({reason:"never-ran",detail:"No persisted attempt"}),l;let u=new Date(c),d=null;for(let p=0;p<o.missedFires&&(d=a(n,u,i),!!d);p++)u=d;return d&&s>d.getTime()+o.graceMs&&l.push({reason:"overdue",detail:`No attempt since ${new Date(c).toISOString()}; ${o.missedFires} scheduled fires missed`}),l}function ai(t,e,n,i,r){let s=[],o=t.lastRun?Date.parse(t.lastRun.at):null;if(!t.enabled){let a=on(o,n,i,r);return a&&s.push(a),s}return t.consecutiveFailures>=r.failStreak&&s.push({reason:"failing",detail:`${t.consecutiveFailures} failed runs in a row`}),o===null?s.push({reason:"never-ran",detail:"No run recorded for this trigger"}):e&&s.push({reason:"dormant",detail:"Fired in the prior week, silent in the last one"}),s}function on(t,e,n,i){let r=Math.max(t??0,e??0);return r&&n-r<i.disabledDays*en?null:{reason:"disabled-long",detail:r?`Disabled; no activity for ${Math.floor((n-r)/en)} days`:"Disabled and never ran"}}function rn(t){let e=new Set(t.flags.map(n=>n.reason));return t.attention=e.has("failing")?"critical":e.has("overdue")||e.has("dormant")||e.has("never-ran")?"warning":e.has("disabled-long")?"info":null,t}var sn={critical:0,warning:1,info:2};function li(t,e){let n=t.attention?sn[t.attention]:3,i=e.attention?sn[e.attention]:3;return n-i||Number(e.enabled)-Number(t.enabled)||t.name.localeCompare(e.name)}function ci(t){switch(t){case"completed":case"ok":return"success";case"failed":return"failed";case"timeout":return"timeout";case"canceled":return"canceled";case"running":return"running";case"paused":return"paused";default:return"unknown"}}function ui(t){if(t.ownerAgent)return $(t.ownerAgent,k.text);let e=t.nodes.find(n=>n.type==="agent"&&typeof n.config?.agentId=="string"&&n.config.agentId);return e?$(String(e.config.agentId),k.text):null}function di(t,e){let n=[],i=e?.project;if(i&&n.push($(`project=${i}`,k.filterValue)),t&&typeof t=="object"&&!Array.isArray(t))for(let[r,s]of Object.entries(t)){let o=Array.isArray(s)?s.map(String):s==null?[]:[String(s)];o.length&&n.push($(`${r}=${o.join(",")}`,k.filterValue))}return n.slice(0,k.filters)}function _e(t){if(!t)return null;let e=t instanceof Date?t:new Date(t);return Number.isFinite(e.getTime())?e.toISOString():null}function $(t,e){return t.length<=e?t:t.slice(0,e-3)+"..."}function pi(t,e){return t===void 0?void 0:$(t,e)}import{existsSync as H,readdirSync as Pi,readFileSync as Ni}from"fs";import{resolve as R}from"path";import{randomBytes as cn}from"crypto";import{existsSync as fi,mkdirSync as mi,readdirSync as hi,readFileSync as bi,renameSync as un,unlinkSync as yi,writeFileSync as wi}from"fs";import{resolve as dn}from"path";function an(t){return[...t.account?["--account",t.account]:[],...t.store?["--store",t.store]:[]]}var gi=t=>t.trim().split(`
3
3
  `).pop()?.slice(0,300)||"no output";async function ln(t,e,n,i=Re){let r=await i(t.bin,[...an(t),"send","text","--to",e,"--message",n,"--no-preview"],{timeoutMs:6e4});return r.code===0?{ok:!0}:{ok:!1,error:`wacli send failed: ${gi(r.stderr||r.stdout)}`}}async function Oa(t,e,n,i,r=Re){return(await r(t.bin,[...an(t),"--read-only","media","download","--chat",e,"--id",n,"--output",i],{timeoutMs:12e4})).code===0}var ki=2e3,xi=t=>ln(t.wacli,t.to,t.text);function Ie(t){return dn(t,".agentx","whatsapp-triage","drafts")}var Si=t=>/^[a-z0-9-]{8,64}$/.test(t),ie=(t,e)=>dn(Ie(t),`${e}.json`);function pn(t,e){mi(Ie(t),{recursive:!0});let n=ie(t,e.id),i=`${n}.${process.pid}.tmp`;wi(i,JSON.stringify(e,null,2)+`
4
4
  `,{mode:384}),un(i,n)}function Va(t,e,n=Date.now()){let i=e.text.trim().slice(0,ki);if(!i)throw new Error("empty draft");let r={...e,text:i,id:`${n.toString(36)}-${cn(4).toString("hex")}`,status:"pending",created_at:new Date(n).toISOString()};return pn(t,r),r}function se(t,e){if(!Si(e))return null;try{return JSON.parse(bi(ie(t,e),"utf-8"))}catch{return null}}function gn(t,e){let n=Ie(t);return fi(n)?hi(n).filter(i=>i.endsWith(".json")).map(i=>se(t,i.slice(0,-5))).filter(i=>!!i&&(!e||i.status===e)).sort((i,r)=>i.created_at.localeCompare(r.created_at)):[]}async function fn(t,e,n,i={}){let r=se(t,e);if(!r||r.status!=="pending")return{ok:!1,error:`no reply draft "${e}" is waiting`};let s=`${ie(t,e)}.${process.pid}.${cn(3).toString("hex")}.claim`;try{un(ie(t,e),s)}catch{return{ok:!1,error:`reply draft "${e}" is already being decided`}}let o={...r,decided_by:i.by??"operator",decided_at:new Date(i.now??Date.now()).toISOString()};if(n==="no")o.status="rejected";else{let a=await(i.send??xi)(r).catch(l=>({ok:!1,error:String(l?.message??l)}));a.ok?o.status="sent":(o.status="failed",o.error=a.error)}pn(t,o);try{yi(s)}catch{}return o.status==="failed"?{ok:!1,error:o.error??"send failed"}:{ok:!0,draft:o}}import{mkdirSync as vi,readFileSync as $i,renameSync as Ai,writeFileSync as Ri}from"fs";import{resolve as _i}from"path";function mn(t){return _i(Ae(t),"_state.json")}function A(t){try{let e=JSON.parse($i(mn(t),"utf-8"));return{snoozed:e&&typeof e.snoozed=="object"&&e.snoozed?e.snoozed:{},...typeof e?.lastDigest=="string"?{lastDigest:e.lastDigest}:{},...e?.popped&&typeof e.popped=="object"?{popped:e.popped}:{},...typeof e?.passAt=="string"?{passAt:e.passAt}:{},...Array.isArray(e?.wanted)?{wanted:e.wanted.filter(n=>typeof n=="string")}:{}}}catch{return{snoozed:{}}}}function B(t,e){vi(Ae(t),{recursive:!0});let n=mn(t),i=`${n}.${process.pid}.tmp`;Ri(i,JSON.stringify(e,null,2)+`
@@ -529,4 +529,4 @@ Document the arguments, commands, or files the skill expects. Example:
529
529
  claude-code ${xt(t)} --arg value
530
530
  \`\`\`
531
531
  `}Tt();var zr={maxPixels:12e5,timeoutMs:5e3,intervalMs:100,changeThreshold:.015,stableMs:400,regions:{},buffer:{enabled:!1,seconds:10,fps:2,region:"screen",maxPixels:3e5}};function Xr(t){return{...zr,...t??{},regions:{...t?.regions??{}},buffer:{...zr.buffer,...t?.buffer??{}}}}function td(t){try{return Xr(Et(t).screen)}catch{return Xr(void 0)}}var Ra=/^[a-z][\w-]*$/,Gr=["window","screen","menubar","notifications"];function Z(t,e,n,i){let r=Number(t);if(t===""||t===null||!Number.isFinite(r)||!n(r))throw new Error(`${e} must be ${i}`);return r}var be=(t,e)=>Z(t,e,n=>Number.isInteger(n)&&n>0,"a whole number above 0");function Kr(t){let e=typeof t=="string"?t.split(",").map(Number):[t?.x,t?.y,t?.width,t?.height].map(Number);if(e.length!==4||!e.every(Number.isFinite)||e[2]<=0||e[3]<=0)throw new Error("a region is x,y,width,height in screen points, with width and height above 0");return{x:e[0],y:e[1],width:e[2],height:e[3]}}function nd(t,e){let n={...t??{}};if("maxPixels"in e&&(n.maxPixels=be(e.maxPixels,"maxPixels")),"timeoutMs"in e&&(n.timeoutMs=be(e.timeoutMs,"timeoutMs")),"intervalMs"in e&&(n.intervalMs=be(e.intervalMs,"intervalMs")),"stableMs"in e&&(n.stableMs=Z(e.stableMs,"stableMs",r=>Number.isInteger(r)&&r>=0,"a whole number, 0 or more")),"changeThreshold"in e&&(n.changeThreshold=Z(e.changeThreshold,"changeThreshold",r=>r>=0&&r<=1,"between 0 and 1")),e.regions&&typeof e.regions=="object"){let r={...n.regions??{}};for(let[s,o]of Object.entries(e.regions)){if(!Ra.test(s))throw new Error(`region name "${s}" must be lowercase letters, digits, - or _`);o===null?delete r[s]:r[s]=Kr(o)}n.regions=r}if(e.buffer&&typeof e.buffer=="object"){let r=e.buffer,s={...n.buffer??{}};"enabled"in r&&(s.enabled=!!r.enabled),"seconds"in r&&(s.seconds=Z(r.seconds,"buffer.seconds",o=>o>0&&o<=120,"above 0 and at most 120")),"fps"in r&&(s.fps=Z(r.fps,"buffer.fps",o=>o>0&&o<=10,"above 0 and at most 10")),"maxPixels"in r&&(s.maxPixels=be(r.maxPixels,"buffer.maxPixels")),"region"in r&&(s.region=String(r.region).trim()),n.buffer=s}let i=n.buffer?.region;if(i!==void 0&&!Gr.includes(i)&&!n.regions?.[i])try{Kr(i)}catch{throw new Error(`buffer.region "${i}" is not a region \u2014 use ${[...Gr,...Object.keys(n.regions??{})].join(", ")}, or x,y,w,h`)}return n}export{Qt as a,Ea as b,tt as c,Ks as d,Js as e,mc as f,hc as g,bc as h,ar as i,wc as j,xc as k,D as l,lr as m,k as n,Pa as o,Oa as p,xi as q,Va as r,fn as s,A as t,Xa as u,Ga as v,Ya as w,oe as x,Za as y,xn as z,il as A,z as B,wl as C,kl as D,_n as E,cr as F,$c as G,_c as H,vr as I,eu as J,tu as K,au as L,qo as M,lu as N,Sl as O,vl as P,$l as Q,Al as R,Rl as S,_l as T,El as U,Tl as V,Wl as W,Me as X,Fl as Y,Ul as Z,X as _,G as $,Ko as aa,bu as ba,yu as ca,wu as da,ku as ea,ct as fa,xu as ga,Fe as ha,Ue as ia,pe as ja,ms as ka,bs as la,zl as ma,qe as na,Be as oa,ys as pa,ws as qa,Xn as ra,Yn as sa,Xl as ta,Ss as ua,Gl as va,Ts as wa,Ps as xa,He as ya,Ls as za,Zn as Aa,P as Ba,Lr as Ca,Or as Da,Mr as Ea,_u as Fa,ia as Ga,Wr as Ha,Fr as Ia,ju as Ja,Wu as Ka,ka as La,Fu as Ma,Vr as Na,ge as Oa,oc as Pa,ir as Qa,ze as Ra,Qe as Sa,gc as Ta,Bu as Ua,Hu as Va,zu as Wa,Xu as Xa,Gu as Ya,Ku as Za,Ju as _a,Yu as $a,Zu as ab,zr as bb,Xr as cb,td as db,Gr as eb,nd as fb};
532
- //# sourceMappingURL=chunk-QHZFMO6M.js.map
532
+ //# sourceMappingURL=chunk-LK4YO2FE.js.map