agentix-cli 0.136.0 → 0.137.0

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 (136) 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-MCYZBCMQ.js} +2 -2
  9. package/dist/{ChatApp-X7TNCFGW.js → ChatApp-7YXDEW3H.js} +2 -2
  10. package/dist/{absorb-eval-COPVH2M2.js → absorb-eval-L72I7PKM.js} +2 -2
  11. package/dist/{agent-VCGAUBER.js → agent-TPREVZGH.js} +2 -2
  12. package/dist/{board-dashboard-JZM3FQNV.js → board-dashboard-3VBZAKYM.js} +4 -4
  13. package/dist/{board-dashboard-JZM3FQNV.js.map → board-dashboard-3VBZAKYM.js.map} +1 -1
  14. package/dist/{chunk-ZPJVDX2U.js → chunk-264762O7.js} +2 -2
  15. package/dist/{chunk-C43E3YFT.js → chunk-44N5HXYE.js} +2 -2
  16. package/dist/{chunk-EVTTAM7S.js → chunk-5CEBOUBG.js} +2 -2
  17. package/dist/{chunk-HZZW35FY.js → chunk-5EIO6S3S.js} +2 -2
  18. package/dist/{chunk-QTDKNJXD.js → chunk-64ZACYOF.js} +245 -245
  19. package/dist/chunk-64ZACYOF.js.map +1 -0
  20. package/dist/chunk-6BWVJ7UJ.js +54 -0
  21. package/dist/chunk-6BWVJ7UJ.js.map +1 -0
  22. package/dist/{chunk-5X37CXJF.js → chunk-APIANBXV.js} +2 -2
  23. package/dist/{chunk-5J5USW2O.js → chunk-AYYEY5UJ.js} +2 -2
  24. package/dist/{chunk-WRJFKA43.js → chunk-DX6RYYGP.js} +2 -2
  25. package/dist/{chunk-FQLSV2C4.js → chunk-EFUPLTQ3.js} +2 -2
  26. package/dist/{chunk-HEJTE7OC.js → chunk-ETOOT5KD.js} +2 -2
  27. package/dist/{chunk-PV623BLN.js → chunk-GW4LKNQT.js} +3 -3
  28. package/dist/{chunk-OW5EXDVY.js → chunk-HSX5LMXD.js} +2 -2
  29. package/dist/{chunk-KZXQD6ZK.js → chunk-I5QKJH7V.js} +2 -2
  30. package/dist/{chunk-M5B4QG6J.js → chunk-JXIMGK7Z.js} +2 -2
  31. package/dist/chunk-KEJGWFGS.js +105 -0
  32. package/dist/chunk-KEJGWFGS.js.map +1 -0
  33. package/dist/{chunk-66DPMVUC.js → chunk-KOKPK3OL.js} +2 -2
  34. package/dist/{chunk-K75LFQE3.js → chunk-LGM22AOB.js} +2 -2
  35. package/dist/{chunk-VA24JS2S.js → chunk-OLZL32KG.js} +2 -2
  36. package/dist/{chunk-H2N7DOPT.js → chunk-P6PTY2NP.js} +2 -2
  37. package/dist/{chunk-H2N7DOPT.js.map → chunk-P6PTY2NP.js.map} +1 -1
  38. package/dist/{chunk-M5AHI2PZ.js → chunk-PLCK4ZAG.js} +2 -2
  39. package/dist/{chunk-QCUJTAAZ.js → chunk-PYR7GKK7.js} +5 -5
  40. package/dist/{chunk-QCUJTAAZ.js.map → chunk-PYR7GKK7.js.map} +1 -1
  41. package/dist/{chunk-GL3H7XMI.js → chunk-QKILE72V.js} +2 -2
  42. package/dist/{chunk-AK3XOA5N.js → chunk-QQ67J76O.js} +2 -2
  43. package/dist/{chunk-IPMXIPTS.js → chunk-RX2ISTNT.js} +2 -2
  44. package/dist/{chunk-HH7OFAEM.js → chunk-ZX2NJGIU.js} +2 -2
  45. package/dist/{chunk-HH7OFAEM.js.map → chunk-ZX2NJGIU.js.map} +1 -1
  46. package/dist/cli.js +1 -1
  47. package/dist/{client-SMOWSRJY.js → client-G2QA4TCG.js} +2 -2
  48. package/dist/{config-OGUDWYAA.js → config-OD5W6IQE.js} +2 -2
  49. package/dist/{config-mutate-BH27TMWK.js → config-mutate-JEXLMR2L.js} +2 -2
  50. package/dist/config-mutator-4FKROX3O.js +2 -0
  51. package/dist/{contributions-H6T65TCY.js → contributions-UXLHUMF2.js} +2 -2
  52. package/dist/{doctor-ZOXHT7ZQ.js → doctor-DO2WN4TS.js} +2 -2
  53. package/dist/{follow-up-tool-GUBBXNEZ.js → follow-up-tool-QPNJD3HR.js} +2 -2
  54. package/dist/{hub-IIW2GBO5.js → hub-RFE766AM.js} +2 -2
  55. package/dist/index.d.ts +69 -36
  56. package/dist/index.js +1 -1
  57. package/dist/{program-WROQ55F5.js → program-QENG5KI7.js} +208 -208
  58. package/dist/program-QENG5KI7.js.map +1 -0
  59. package/dist/{promote-HDLU44MX.js → promote-FJ3EK2J6.js} +2 -2
  60. package/dist/{query-6G27CBZQ.js → query-KYA6YYUU.js} +2 -2
  61. package/dist/{query-settings-G4M75LVQ.js → query-settings-P3UOGMAQ.js} +2 -2
  62. package/dist/{registry-3RE5SG22.js → registry-U4S4XXUZ.js} +2 -2
  63. package/dist/{request-planner-T3VCZVVQ.js → request-planner-SYVDD4PZ.js} +2 -2
  64. package/dist/{review-candidates-C3O3CENL.js → review-candidates-QUIX4AK7.js} +2 -2
  65. package/dist/{routing-LD35TJM5.js → routing-MDZOHYYH.js} +2 -2
  66. package/dist/rules-UVUJTVOE.js +24 -0
  67. package/dist/rules-UVUJTVOE.js.map +1 -0
  68. package/dist/schedule-tool-DKBPBQ3F.js +2 -0
  69. package/dist/{scheduler-I3QB4GI3.js → scheduler-76IIRAP7.js} +2 -2
  70. package/dist/{seat-4Y3EW3KU.js → seat-TV5SK2E7.js} +2 -2
  71. package/dist/{select-LZKN3FER.js → select-HKRDVQNW.js} +2 -2
  72. package/dist/{set-enabled-WSTOHJDE.js → set-enabled-I2V3PXOA.js} +2 -2
  73. package/dist/{tool-AKXO2EJU.js → tool-5ZFM6NSO.js} +2 -2
  74. package/dist/{tool-NLMIUOHR.js → tool-J7PYS4NF.js} +2 -2
  75. package/dist/{wiki-ZS6OHOWQ.js → wiki-3VG33ZZB.js} +2 -2
  76. package/dist/wiki-enrich-2FNORKEQ.js +2 -0
  77. package/package.json +1 -1
  78. package/dist/chunk-54OORW5I.js +0 -54
  79. package/dist/chunk-54OORW5I.js.map +0 -1
  80. package/dist/chunk-OISCRNMW.js +0 -105
  81. package/dist/chunk-OISCRNMW.js.map +0 -1
  82. package/dist/chunk-QTDKNJXD.js.map +0 -1
  83. package/dist/config-mutator-Q62AS2TR.js +0 -2
  84. package/dist/program-WROQ55F5.js.map +0 -1
  85. package/dist/rules-HUUFXQD6.js +0 -24
  86. package/dist/rules-HUUFXQD6.js.map +0 -1
  87. package/dist/schedule-tool-46TVGEYU.js +0 -2
  88. package/dist/wiki-enrich-NGPFWTVA.js +0 -2
  89. /package/dist/{App-D6W6IV2L.js.map → App-MCYZBCMQ.js.map} +0 -0
  90. /package/dist/{ChatApp-X7TNCFGW.js.map → ChatApp-7YXDEW3H.js.map} +0 -0
  91. /package/dist/{absorb-eval-COPVH2M2.js.map → absorb-eval-L72I7PKM.js.map} +0 -0
  92. /package/dist/{agent-VCGAUBER.js.map → agent-TPREVZGH.js.map} +0 -0
  93. /package/dist/{chunk-ZPJVDX2U.js.map → chunk-264762O7.js.map} +0 -0
  94. /package/dist/{chunk-C43E3YFT.js.map → chunk-44N5HXYE.js.map} +0 -0
  95. /package/dist/{chunk-EVTTAM7S.js.map → chunk-5CEBOUBG.js.map} +0 -0
  96. /package/dist/{chunk-HZZW35FY.js.map → chunk-5EIO6S3S.js.map} +0 -0
  97. /package/dist/{chunk-5X37CXJF.js.map → chunk-APIANBXV.js.map} +0 -0
  98. /package/dist/{chunk-5J5USW2O.js.map → chunk-AYYEY5UJ.js.map} +0 -0
  99. /package/dist/{chunk-WRJFKA43.js.map → chunk-DX6RYYGP.js.map} +0 -0
  100. /package/dist/{chunk-FQLSV2C4.js.map → chunk-EFUPLTQ3.js.map} +0 -0
  101. /package/dist/{chunk-HEJTE7OC.js.map → chunk-ETOOT5KD.js.map} +0 -0
  102. /package/dist/{chunk-PV623BLN.js.map → chunk-GW4LKNQT.js.map} +0 -0
  103. /package/dist/{chunk-OW5EXDVY.js.map → chunk-HSX5LMXD.js.map} +0 -0
  104. /package/dist/{chunk-KZXQD6ZK.js.map → chunk-I5QKJH7V.js.map} +0 -0
  105. /package/dist/{chunk-M5B4QG6J.js.map → chunk-JXIMGK7Z.js.map} +0 -0
  106. /package/dist/{chunk-66DPMVUC.js.map → chunk-KOKPK3OL.js.map} +0 -0
  107. /package/dist/{chunk-K75LFQE3.js.map → chunk-LGM22AOB.js.map} +0 -0
  108. /package/dist/{chunk-VA24JS2S.js.map → chunk-OLZL32KG.js.map} +0 -0
  109. /package/dist/{chunk-M5AHI2PZ.js.map → chunk-PLCK4ZAG.js.map} +0 -0
  110. /package/dist/{chunk-GL3H7XMI.js.map → chunk-QKILE72V.js.map} +0 -0
  111. /package/dist/{chunk-AK3XOA5N.js.map → chunk-QQ67J76O.js.map} +0 -0
  112. /package/dist/{chunk-IPMXIPTS.js.map → chunk-RX2ISTNT.js.map} +0 -0
  113. /package/dist/{client-SMOWSRJY.js.map → client-G2QA4TCG.js.map} +0 -0
  114. /package/dist/{config-OGUDWYAA.js.map → config-OD5W6IQE.js.map} +0 -0
  115. /package/dist/{config-mutate-BH27TMWK.js.map → config-mutate-JEXLMR2L.js.map} +0 -0
  116. /package/dist/{config-mutator-Q62AS2TR.js.map → config-mutator-4FKROX3O.js.map} +0 -0
  117. /package/dist/{contributions-H6T65TCY.js.map → contributions-UXLHUMF2.js.map} +0 -0
  118. /package/dist/{doctor-ZOXHT7ZQ.js.map → doctor-DO2WN4TS.js.map} +0 -0
  119. /package/dist/{follow-up-tool-GUBBXNEZ.js.map → follow-up-tool-QPNJD3HR.js.map} +0 -0
  120. /package/dist/{hub-IIW2GBO5.js.map → hub-RFE766AM.js.map} +0 -0
  121. /package/dist/{promote-HDLU44MX.js.map → promote-FJ3EK2J6.js.map} +0 -0
  122. /package/dist/{query-6G27CBZQ.js.map → query-KYA6YYUU.js.map} +0 -0
  123. /package/dist/{query-settings-G4M75LVQ.js.map → query-settings-P3UOGMAQ.js.map} +0 -0
  124. /package/dist/{registry-3RE5SG22.js.map → registry-U4S4XXUZ.js.map} +0 -0
  125. /package/dist/{request-planner-T3VCZVVQ.js.map → request-planner-SYVDD4PZ.js.map} +0 -0
  126. /package/dist/{review-candidates-C3O3CENL.js.map → review-candidates-QUIX4AK7.js.map} +0 -0
  127. /package/dist/{routing-LD35TJM5.js.map → routing-MDZOHYYH.js.map} +0 -0
  128. /package/dist/{schedule-tool-46TVGEYU.js.map → schedule-tool-DKBPBQ3F.js.map} +0 -0
  129. /package/dist/{scheduler-I3QB4GI3.js.map → scheduler-76IIRAP7.js.map} +0 -0
  130. /package/dist/{seat-4Y3EW3KU.js.map → seat-TV5SK2E7.js.map} +0 -0
  131. /package/dist/{select-LZKN3FER.js.map → select-HKRDVQNW.js.map} +0 -0
  132. /package/dist/{set-enabled-WSTOHJDE.js.map → set-enabled-I2V3PXOA.js.map} +0 -0
  133. /package/dist/{tool-AKXO2EJU.js.map → tool-5ZFM6NSO.js.map} +0 -0
  134. /package/dist/{tool-NLMIUOHR.js.map → tool-J7PYS4NF.js.map} +0 -0
  135. /package/dist/{wiki-ZS6OHOWQ.js.map → wiki-3VG33ZZB.js.map} +0 -0
  136. /package/dist/{wiki-enrich-NGPFWTVA.js.map → wiki-enrich-2FNORKEQ.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{q as d}from"./chunk-AK3XOA5N.js";import{b as i,c as u,d as l,e as c}from"./chunk-WRJFKA43.js";import f from"cronstrue";var p=Intl.DateTimeFormat().resolvedOptions().timeZone,m=600,E='Try: "every morning at 9", "weekdays at 6pm", "every 15 minutes", "every monday at 10am", "1st of every month at noon", "daily at 9:30am", "every hour"',g=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;function w(e){return g.test(e)}function x(e){try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}function $(e){return e?e.split(",").map(r=>r.trim().toLowerCase()).filter(r=>r==="log"||r==="notify"||r==="disable"):["log"]}function S(e){let r=[...e.onError??["log"]];e.notify&&!r.includes("notify")&&r.push("notify");let t={enabled:e.enabled??!0,schedule:e.parsed.cron,timezone:e.timezone||p,agent:e.agent,prompt:e.prompt,timeout:e.timeout??m,onError:r};return e.model&&(t.model=e.model),e.notify&&(t.notify=e.notify),e.notify&&e.deliverResult===!1&&(t.deliverResult=!1),e.createdBy&&(t.createdBy=e.createdBy),e.approval&&(t.approval=e.approval),t}function P(e){try{return f.toString(e,{use24HourTimeFormat:!1})}catch{return e}}function T(e,r,t=new Date){try{return d(e,t,r)}catch{return null}}function A(e,r){if(!e)return"unknown (no match within a year)";try{return`${new Intl.DateTimeFormat("en-GB",{timeZone:r,weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)} (${r})`}catch{return e.toISOString()}}function h(e){return e?.approval?.action==="create"}async function D(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(delete a.approval,a.enabled=!0,t=`${e} approved and enabled (requested by ${s.requestedBy})`):(c(n,`crons.${e}`),t=`${e} deletion approved; job removed (requested by ${s.requestedBy})`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function I(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(c(n,`crons.${e}`),t=`${e} rejected; pending job removed`):(delete a.approval,t=`${e} deletion rejected; job kept`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function O(e,r,t={}){return i(o=>{let n=l(o,`crons.${e}`);if(!n)throw new Error(`cron "${e}" not found`);if(r&&h(n))throw new Error(`cron "${e}" is awaiting approval; run \`agentx schedule approve ${e}\``);u(o,`crons.${e}.enabled`,r)},{configPath:t.configPath,reload:t.reload})}export{p as a,E as b,w as c,x as d,$ as e,S as f,P as g,T as h,A as i,h as j,D as k,I as l,O as m};
2
- //# sourceMappingURL=chunk-GL3H7XMI.js.map
1
+ import{q as d}from"./chunk-QQ67J76O.js";import{b as i,c as u,d as l,e as c}from"./chunk-DX6RYYGP.js";import f from"cronstrue";var p=Intl.DateTimeFormat().resolvedOptions().timeZone,m=600,E='Try: "every morning at 9", "weekdays at 6pm", "every 15 minutes", "every monday at 10am", "1st of every month at noon", "daily at 9:30am", "every hour"',g=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;function w(e){return g.test(e)}function x(e){try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}function $(e){return e?e.split(",").map(r=>r.trim().toLowerCase()).filter(r=>r==="log"||r==="notify"||r==="disable"):["log"]}function S(e){let r=[...e.onError??["log"]];e.notify&&!r.includes("notify")&&r.push("notify");let t={enabled:e.enabled??!0,schedule:e.parsed.cron,timezone:e.timezone||p,agent:e.agent,prompt:e.prompt,timeout:e.timeout??m,onError:r};return e.model&&(t.model=e.model),e.notify&&(t.notify=e.notify),e.notify&&e.deliverResult===!1&&(t.deliverResult=!1),e.createdBy&&(t.createdBy=e.createdBy),e.approval&&(t.approval=e.approval),t}function P(e){try{return f.toString(e,{use24HourTimeFormat:!1})}catch{return e}}function T(e,r,t=new Date){try{return d(e,t,r)}catch{return null}}function A(e,r){if(!e)return"unknown (no match within a year)";try{return`${new Intl.DateTimeFormat("en-GB",{timeZone:r,weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)} (${r})`}catch{return e.toISOString()}}function h(e){return e?.approval?.action==="create"}async function D(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(delete a.approval,a.enabled=!0,t=`${e} approved and enabled (requested by ${s.requestedBy})`):(c(n,`crons.${e}`),t=`${e} deletion approved; job removed (requested by ${s.requestedBy})`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function I(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(c(n,`crons.${e}`),t=`${e} rejected; pending job removed`):(delete a.approval,t=`${e} deletion rejected; job kept`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function O(e,r,t={}){return i(o=>{let n=l(o,`crons.${e}`);if(!n)throw new Error(`cron "${e}" not found`);if(r&&h(n))throw new Error(`cron "${e}" is awaiting approval; run \`agentx schedule approve ${e}\``);u(o,`crons.${e}.enabled`,r)},{configPath:t.configPath,reload:t.reload})}export{p as a,E as b,w as c,x as d,$ as e,S as f,P as g,T as h,A as i,h as j,D as k,I as l,O as m};
2
+ //# sourceMappingURL=chunk-QKILE72V.js.map
@@ -1,4 +1,4 @@
1
- import{b as S,c as O}from"./chunk-WRJFKA43.js";import{h as B,j as J}from"./chunk-3UOTLMXD.js";import{a as I,b as P}from"./chunk-FCPTN6NF.js";import{a as X,b as ue}from"./chunk-7I7IEX4S.js";import{d as F}from"./chunk-QIJLFPWE.js";import{execFile as Ae}from"child_process";import{writeFileSync as ie,mkdirSync as x,existsSync as b,readFileSync as ke}from"fs";import{resolve as v}from"path";var le=["off","shadow","authoritative"],ge={telegram:"INTENT_LEDGER_MODE_TELEGRAM",slack:"INTENT_LEDGER_MODE_SLACK",whatsapp:"INTENT_LEDGER_MODE_WHATSAPP",discord:"INTENT_LEDGER_MODE_DISCORD",gitlab:"INTENT_LEDGER_MODE_GITLAB",github:"INTENT_LEDGER_MODE_GITHUB",workflow:"INTENT_LEDGER_MODE_WORKFLOW",cron:"INTENT_LEDGER_MODE_CRON",mesh:"INTENT_LEDGER_MODE_MESH"},me="INTENT_LEDGER_MODE";function G(i,e=process.env){let t=U(e[ge[i]]);if(t)return t;let n=U(e[me]);return n||"off"}function U(i){if(typeof i!="string")return null;let e=i.trim().toLowerCase();return le.includes(e)?e:null}P();import he from"better-sqlite3";import{existsSync as Ue,mkdirSync as fe}from"fs";import{dirname as pe,resolve as Ee}from"path";var T=class{db;path;constructor(e={}){this.path=Ee(process.cwd(),e.path??".agentx/intent/ledger.sqlite"),fe(pe(this.path),{recursive:!0}),this.db=new he(this.path),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),ye(this.db)}close(){this.db.close()}schemaVersion(){return this.db.prepare("SELECT MAX(v) AS v FROM schema_version").get().v??0}recordEvent(e){if(e.sourceEventId!==null){let n=this.findEventBySourceId(e.source,e.sourceEventId);if(n)return n}let t={id:e.id??I(e.ts),ts:e.ts,source:e.source,sourceEventId:e.sourceEventId,project:e.project,subject:e.subject,intent:e.intent,rawJson:e.rawJson};return this.db.prepare(`INSERT INTO intent_events (id, ts, source, source_event_id, project, subject, intent, raw_json)
1
+ import{b as S,c as O}from"./chunk-DX6RYYGP.js";import{h as B,j as J}from"./chunk-3UOTLMXD.js";import{a as I,b as P}from"./chunk-FCPTN6NF.js";import{a as X,b as ue}from"./chunk-7I7IEX4S.js";import{d as F}from"./chunk-QIJLFPWE.js";import{execFile as Ae}from"child_process";import{writeFileSync as ie,mkdirSync as x,existsSync as b,readFileSync as ke}from"fs";import{resolve as v}from"path";var le=["off","shadow","authoritative"],ge={telegram:"INTENT_LEDGER_MODE_TELEGRAM",slack:"INTENT_LEDGER_MODE_SLACK",whatsapp:"INTENT_LEDGER_MODE_WHATSAPP",discord:"INTENT_LEDGER_MODE_DISCORD",gitlab:"INTENT_LEDGER_MODE_GITLAB",github:"INTENT_LEDGER_MODE_GITHUB",workflow:"INTENT_LEDGER_MODE_WORKFLOW",cron:"INTENT_LEDGER_MODE_CRON",mesh:"INTENT_LEDGER_MODE_MESH"},me="INTENT_LEDGER_MODE";function G(i,e=process.env){let t=U(e[ge[i]]);if(t)return t;let n=U(e[me]);return n||"off"}function U(i){if(typeof i!="string")return null;let e=i.trim().toLowerCase();return le.includes(e)?e:null}P();import he from"better-sqlite3";import{existsSync as Ue,mkdirSync as fe}from"fs";import{dirname as pe,resolve as Ee}from"path";var T=class{db;path;constructor(e={}){this.path=Ee(process.cwd(),e.path??".agentx/intent/ledger.sqlite"),fe(pe(this.path),{recursive:!0}),this.db=new he(this.path),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),ye(this.db)}close(){this.db.close()}schemaVersion(){return this.db.prepare("SELECT MAX(v) AS v FROM schema_version").get().v??0}recordEvent(e){if(e.sourceEventId!==null){let n=this.findEventBySourceId(e.source,e.sourceEventId);if(n)return n}let t={id:e.id??I(e.ts),ts:e.ts,source:e.source,sourceEventId:e.sourceEventId,project:e.project,subject:e.subject,intent:e.intent,rawJson:e.rawJson};return this.db.prepare(`INSERT INTO intent_events (id, ts, source, source_event_id, project, subject, intent, raw_json)
2
2
  VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(t.id,t.ts,t.source,t.sourceEventId,t.project,t.subject,t.intent,t.rawJson),t}findEventBySourceId(e,t){let n=this.db.prepare(`SELECT id, ts, source, source_event_id, project, subject, intent, raw_json
3
3
  FROM intent_events WHERE source = ? AND source_event_id = ?`).get(e,t);return n?Y(n):null}getEventById(e){let t=this.db.prepare(`SELECT id, ts, source, source_event_id, project, subject, intent, raw_json
4
4
  FROM intent_events WHERE id = ?`).get(e);return t?Y(t):null}recordDecision(e){this.db.prepare(`INSERT INTO intent_decisions (event_id, decided_at, decided_by, agent_id, outcome, reason)
@@ -125,4 +125,4 @@ ${se(o.block,r.prompt)}`,r.maxOutputTokens),agentId:r.agent,autonomy:r.autonomy,
125
125
  `);return t.length<=e?t.join(`
126
126
  `):t.slice(-e).join(`
127
127
  `)}function Xe(i,e,t){return new Promise((n,r)=>{Ae("/bin/sh",["-c",i],{timeout:e,maxBuffer:8*1024*1024,...t?{env:t}:{}},(s,a,o)=>{if(s&&s.killed){r(new Error(`command timed out after ${Math.round(e/1e3)}s`));return}n({stdout:String(a??""),stderr:String(o??""),code:s?typeof s.code=="number"?s.code:1:0})})})}export{T as a,V as b,ot as c,we as d,at as e,ct as f,$ as g,ee as h,G as i,We as j,z as k,Q as l,lt as m,Ce as n,oe as o,ae as p,ce as q,C as r,M as s};
128
- //# sourceMappingURL=chunk-AK3XOA5N.js.map
128
+ //# sourceMappingURL=chunk-QQ67J76O.js.map
@@ -1,8 +1,8 @@
1
- import{a as D,b as _}from"./chunk-RKPAVWXF.js";import{a as R,b as q,c as O,d as B,f as k,g as v,h as E,i as w,j as y}from"./chunk-GL3H7XMI.js";import{a as T,b as C,c as I,d as x,e as P}from"./chunk-WRJFKA43.js";import{existsSync as X,readFileSync as F}from"fs";var J=new Set(["cron","heartbeat","api","a2a","mesh"]),M=160;function s(n){return typeof n=="string"&&n.trim()?n.trim():void 0}function S(n,e=M){let t=n.replace(/\s+/g," ").trim();return t.length>e?`${t.slice(0,e-1)}\u2026`:t}function V(n){let e=T(n);if(!X(e))throw new Error(`config not found at ${e}`);return JSON.parse(F(e,"utf-8"))}function W(n,e){return n?.agents?.[e]?.admin===!0}function Y(n,e,t){return W(n,t.agentId)||e?.createdBy===t.agentId}function Z(n,e){let t=e?.createdBy?`agent "${e.createdBy}"`:"the operator";return`Not allowed: "${n}" was created by ${t}. Agents manage only schedules they created (unless configured admin).`}function K(n,e){let t=s(n.notify);if(t!=="none"){if(t&&t!=="here"){let r=t.split(":");return r.length<2||!r[0]||!r[1]?"invalid":{channel:r[0],chatId:r.slice(1).join(":")}}if(e.channel&&e.chatId&&!J.has(e.channel))return{channel:e.channel,chatId:e.chatId,...e.accountId?{accountId:e.accountId}:{}}}}function Q(n,e,t){let r=e.timezone||"UTC",d=e.enabled&&!y(e)?w(E(e.schedule,r,t),r):"\u2014",h=e.approval?`pending ${e.approval.action} approval`:e.enabled?"active":"paused",f=[`- ${n} [${h}] ${e.schedule} \u2014 ${v(e.schedule)} (${r})`,` agent: ${e.agent}; created by: ${e.createdBy||"operator"}; next: ${d}`];return e.notify&&f.push(` notify: ${e.notify.channel} ${e.notify.chatId}${e.deliverResult===!1?" (failures only)":" (results and failures)"}`),e.command?f.push(` command: ${S(String(e.command))}`):e.prompt&&f.push(` prompt: ${S(String(e.prompt))}`),f.join(`
1
+ import{a as D,b as _}from"./chunk-RKPAVWXF.js";import{a as R,b as q,c as O,d as B,f as k,g as v,h as E,i as w,j as y}from"./chunk-QKILE72V.js";import{a as T,b as C,c as I,d as x,e as P}from"./chunk-DX6RYYGP.js";import{existsSync as X,readFileSync as F}from"fs";var J=new Set(["cron","heartbeat","api","a2a","mesh"]),M=160;function s(n){return typeof n=="string"&&n.trim()?n.trim():void 0}function S(n,e=M){let t=n.replace(/\s+/g," ").trim();return t.length>e?`${t.slice(0,e-1)}\u2026`:t}function V(n){let e=T(n);if(!X(e))throw new Error(`config not found at ${e}`);return JSON.parse(F(e,"utf-8"))}function W(n,e){return n?.agents?.[e]?.admin===!0}function Y(n,e,t){return W(n,t.agentId)||e?.createdBy===t.agentId}function Z(n,e){let t=e?.createdBy?`agent "${e.createdBy}"`:"the operator";return`Not allowed: "${n}" was created by ${t}. Agents manage only schedules they created (unless configured admin).`}function K(n,e){let t=s(n.notify);if(t!=="none"){if(t&&t!=="here"){let r=t.split(":");return r.length<2||!r[0]||!r[1]?"invalid":{channel:r[0],chatId:r.slice(1).join(":")}}if(e.channel&&e.chatId&&!J.has(e.channel))return{channel:e.channel,chatId:e.chatId,...e.accountId?{accountId:e.accountId}:{}}}}function Q(n,e,t){let r=e.timezone||"UTC",d=e.enabled&&!y(e)?w(E(e.schedule,r,t),r):"\u2014",h=e.approval?`pending ${e.approval.action} approval`:e.enabled?"active":"paused",f=[`- ${n} [${h}] ${e.schedule} \u2014 ${v(e.schedule)} (${r})`,` agent: ${e.agent}; created by: ${e.createdBy||"operator"}; next: ${d}`];return e.notify&&f.push(` notify: ${e.notify.channel} ${e.notify.chatId}${e.deliverResult===!1?" (failures only)":" (results and failures)"}`),e.command?f.push(` command: ${S(String(e.command))}`):e.prompt&&f.push(` prompt: ${S(String(e.prompt))}`),f.join(`
2
2
  `)}async function b(n,e,t){let r=n?.notifications?.destination;if(!r?.channel||!r?.chatId)return"No operator notification destination is configured (notifications.destination); the operator must check `agentx schedule list`.";if(!e.notifyOperator)return"Operator notification is unavailable in this context.";try{return await e.notifyOperator({channel:r.channel,chatId:r.chatId,accountId:r.accountId},t),"The operator has been notified."}catch(d){return`Could not notify the operator (${d?.message??d}); the request is still recorded.`}}async function re(n,e,t={}){let r=(s(n.action)||"list").toLowerCase(),d=t.now?t.now():new Date,h;try{h=V(t.configPath)}catch(a){return`Error: ${a.message}`}let f=h.crons||{};if(r==="list"){let a=n.mine===!0,l=Object.entries(f).filter(([,i])=>!a||e&&i?.createdBy===e.agentId);return l.length?l.map(([i,p])=>Q(i,p,d)).join(`
3
3
  `):a?"You have no schedules.":"No schedules."}if(!e?.agentId)return"Error: caller agent is unknown (AGENTX_AGENT_ID not set). Pass callerAgentId.";if(!h.agents?.[e.agentId])return`Error: caller "${e.agentId}" is not an agent on this node.`;let o=s(n.id),m=a=>C(a,{configPath:t.configPath,reload:t.reload});if(r==="create"){let a=s(n.when),l=s(n.prompt);if(!a||!l)return"Error: create needs `when` (plain English) and `prompt`.";let i=D(a);if(!i)return`Error: couldn't parse "${a}". ${q}.`;let p=s(n.agent)||e.agentId;if(!h.agents?.[p])return`Error: agent "${p}" not found on this node.`;let g=s(n.timezone)||R;if(!B(g))return`Error: unknown timezone "${g}".`;let u=o||_(i.matched,p);if(!O(u))return`Error: invalid id "${u}" (letters, digits, "-" and "_" only).`;if(f[u])return`Error: a schedule "${u}" already exists. Pick another \`id\`.`;let $=K(n,e);if($==="invalid")return'Error: `notify` must be "here", "none", or "channel:chatId".';let z={action:"create",requestedBy:e.agentId,requestedAt:d.toISOString()},L=k({parsed:i,agent:p,prompt:l,timezone:g,notify:$,enabled:!1,createdBy:e.agentId,approval:z}),A=await m(U=>I(U,`crons.${u}`,L));if(!A.success)return`Error: ${A.error}`;let N=w(E(i.cron,g,d),g),G=[`Schedule approval requested by ${e.agentId}`,`Create: ${u}`,`When: ${i.human} \u2014 cron \`${i.cron}\` (${g})`,`Next fire: ${N}`,`Agent: ${p}`,$?`Results and failures go to: ${$.channel} ${$.chatId}${$.channel==="voice"?" (as a push notification)":""}`:"Results go to: run log only (no chat)",`Prompt: ${S(l,400)}`,"",`Approve: agentx schedule approve ${u}`,`Reject: agentx schedule reject ${u}`].join(`
4
4
  `),H=await b(h,t,G);return[`Requested schedule "${u}": ${i.human} (cron ${i.cron}, ${g}); next fire would be ${N}.`,"It is saved DISABLED and will not run until the operator approves it.",H].join(`
5
5
  `)}if(!o)return`Error: ${r} needs \`id\`.`;let c=f[o];if(!c)return`Error: schedule "${o}" not found.`;if(!Y(h,c,e))return Z(o,c);if(r==="pause"||r==="resume"){let a=r==="resume";if(a&&y(c))return`"${o}" is still awaiting operator approval; it can't be resumed until approved.`;if(c.enabled===a)return`"${o}" is already ${a?"active":"paused"}.`;let l=await m(i=>I(i,`crons.${o}.enabled`,a));return l.success?`"${o}" ${a?"resumed":"paused"}.`:`Error: ${l.error}`}if(r==="delete"){if(y(c)&&c.approval.requestedBy===e.agentId){let u=await m($=>P($,`crons.${o}`));return u.success?`Withdrew the pending request "${o}".`:`Error: ${u.error}`}if(y(c))return`"${o}" is a creation request still awaiting approval; only its requester or the operator (\`agentx schedule reject ${o}\`) can drop it.`;if(c.approval?.action==="delete")return`Deletion of "${o}" is already awaiting approval.`;let a={action:"delete",requestedBy:e.agentId,requestedAt:d.toISOString()},l=await m(u=>{if(!x(u,`crons.${o}`))throw new Error(`schedule "${o}" not found`);I(u,`crons.${o}.approval`,a)});if(!l.success)return`Error: ${l.error}`;let i=c.timezone||"UTC",p=[`Schedule approval requested by ${e.agentId}`,`Delete: ${o}`,`When: ${v(c.schedule)} \u2014 cron \`${c.schedule}\` (${i})`,`Next fire: ${c.enabled?w(E(c.schedule,i,d),i):"\u2014 (paused)"}`,`Agent: ${c.agent}`,"",`Approve: agentx schedule approve ${o}`,`Reject: agentx schedule reject ${o}`].join(`
6
6
  `),g=await b(h,t,p);return[`Deletion of "${o}" requested. It keeps its current state until the operator approves.`,g].join(`
7
7
  `)}return`Error: unknown action "${r}". Use list, create, pause, resume or delete.`}function oe(n,e=process.env){let t=s(e.AGENTX_AGENT_ID)||s(n.callerAgentId);if(!t)return null;let r=!!(s(e.AGENTX_CHANNEL)&&s(e.AGENTX_CHAT_ID)),d=s(r?e.AGENTX_CHANNEL:n.channel),h=s(r?e.AGENTX_CHAT_ID:n.chatId),f=s(n.accountId);return{agentId:t,channel:d,chatId:h,...f?{accountId:f}:{}}}export{re as a,oe as b};
8
- //# sourceMappingURL=chunk-IPMXIPTS.js.map
8
+ //# sourceMappingURL=chunk-RX2ISTNT.js.map
@@ -1,4 +1,4 @@
1
- import{a as Re,b as w,c as z,d as Pe,e as ie,f as se,g as M,h as le,i as N,j as O,n as De,o as ze,p as _e,q as We}from"./chunk-H4NSB54D.js";import{b as oe}from"./chunk-MTX4UPNB.js";import{e as Ee,i as Te}from"./chunk-QAWKN2N4.js";import{c as Ie,d as ae,e as T,f as re,g as B}from"./chunk-B2QYMUTD.js";import{a as G,b as Ce}from"./chunk-VA24JS2S.js";import{a as Se}from"./chunk-7LN4VKDU.js";import{a as Ae}from"./chunk-IMLAPB7G.js";import{b as xe}from"./chunk-WCXXXAHV.js";import{c as ye,e as we}from"./chunk-LQE73AZR.js";import{b as $e}from"./chunk-MRIVENBY.js";import{i as ne,k as ke}from"./chunk-AKWBDCMU.js";import{G as K}from"./chunk-HZZW35FY.js";import{a as L,b as F}from"./chunk-WRJFKA43.js";import{a as ve}from"./chunk-C43E3YFT.js";import{a as be}from"./chunk-ROLSSYXE.js";import{B as dt,S as fe,Z as ct,ma as ee,oa as H,pa as he,w as Z,x as me,xa as te}from"./chunk-54OORW5I.js";import{existsSync as j,readFileSync as Oe,writeFileSync as Ue,appendFileSync as ut,mkdirSync as mt}from"fs";import{dirname as ft,resolve as _}from"path";import{fileURLToPath as ht}from"url";import{hostname as bt}from"os";import{spawn as vt}from"child_process";function Me(e,t){let n=e.configExists?e.agentCount===0?"Add your first agent":"Add another agent":"Set up your team",a=`<header class="ax-topbar">
1
+ import{a as Re,b as w,c as z,d as Pe,e as ie,f as se,g as M,h as le,i as N,j as O,n as De,o as ze,p as _e,q as We}from"./chunk-H4NSB54D.js";import{b as oe}from"./chunk-MTX4UPNB.js";import{e as Ee,i as Te}from"./chunk-QAWKN2N4.js";import{c as Ie,d as ae,e as T,f as re,g as B}from"./chunk-B2QYMUTD.js";import{a as G,b as Ce}from"./chunk-OLZL32KG.js";import{a as Se}from"./chunk-7LN4VKDU.js";import{a as Ae}from"./chunk-IMLAPB7G.js";import{b as xe}from"./chunk-WCXXXAHV.js";import{c as ye,e as we}from"./chunk-LQE73AZR.js";import{b as $e}from"./chunk-MRIVENBY.js";import{i as ne,k as ke}from"./chunk-AKWBDCMU.js";import{G as K}from"./chunk-5EIO6S3S.js";import{a as L,b as F}from"./chunk-DX6RYYGP.js";import{a as ve}from"./chunk-44N5HXYE.js";import{a as be}from"./chunk-ROLSSYXE.js";import{A as me,Aa as te,E as dt,V as fe,aa as ct,pa as ee,ra as H,sa as he,z as Z}from"./chunk-6BWVJ7UJ.js";import{existsSync as j,readFileSync as Oe,writeFileSync as Ue,appendFileSync as ut,mkdirSync as mt}from"fs";import{dirname as ft,resolve as _}from"path";import{fileURLToPath as ht}from"url";import{hostname as bt}from"os";import{spawn as vt}from"child_process";function Me(e,t){let n=e.configExists?e.agentCount===0?"Add your first agent":"Add another agent":"Set up your team",a=`<header class="ax-topbar">
2
2
  <div class="ax-topbar__left">
3
3
  <div class="ax-brand">
4
4
  <span class="ax-brand__mark">AX</span>
@@ -858,4 +858,4 @@ tr:hover td { background: var(--bg-hover); }
858
858
  WHERE person = ? AND state IN (${n.map(()=>"?").join(",")})
859
859
  ${a}`).all(t,...n,...o).map(i=>({id:i.id,state:i.state,channel:i.channel,agentId:i.agent_id,text:i.text,createdAt:i.created_at})):[]}function ga(e,t){return et(e,t,Z,"ORDER BY created_at")}function ua(e,t,n=50){return et(e,t,[...Z,...me],"ORDER BY created_at DESC, rowid DESC LIMIT ?",Math.max(1,Math.min(n,500)))}ct();var ue="member:",Yt=90,Vt="members",Xt="tailscale-user-login",Qt=400,Zt=60*60*1e3;function en(e){let t=e.scopes.find(n=>n.startsWith(ue));return t?t.slice(ue.length):null}function nt(e,t){if(!e)return null;let n=t.verify(e),a=n?en(n):null;return n&&a?{rec:n,personId:a}:null}function ya(e,t){let n=e.people().find(s=>s.id===t);if(!n)return{ok:!1,error:`No person "${t}". Add them first: agentx people add ${t} --name "\u2026"`};let{token:a,record:o}=e.tokens.create({name:`${n.name} (machine not paired yet)`,scopes:[`${ue}${n.id}`],expiresInDays:Yt}),{code:r,expiresAt:i}=e.codes.create({token:a,tokenId:o.id,name:n.id});return e.members.log({person:n.id,device:o.id,event:"invited"}),{ok:!0,code:r,expiresAt:i,tokenId:o.id,person:n}}var tn=Math.round(ye/6e4);function nn(e){return e==="client"?"Your project":"My work"}function wa(e){let t=nn(e.person.role),n=e.person.role==="client"?`I use AgentX to keep track of the work I do for you. It has a page for you, "${t}": what you asked us for, and where each request stands.`:`I use AgentX to give our AI agents their jobs. It has a page for you, "${t}": what you asked the agents for, and where each request stands.`;return[`Hi ${e.person.name},`,"",n,"","To open it:","1. Accept the Tailscale share I sent you. Tailscale is a small program that connects your computer to mine, privately.",`2. Open ${e.origin.replace(/\/+$/,"")}/member in Edge or Chrome, give your computer a name and type this code: ${we(e.code)}`,` The code works once, for ${tn} minutes. If it has stopped working, tell me and I will send you a new one.`,"","I then approve your machine, and the page opens by itself."].join(`
860
860
  `)}var an="The private network says someone else is connecting from this machine. Ask the person who invited you for a new code.",rn="Too many machines are waiting for the owner's answer. Try again later.",tt="That code didn't work. Check it, or ask the person who invited you for a new one.",at=(e,t)=>{let n=e.headers[t];return(Array.isArray(n)?n[0]:n||"").trim()};function rt(e){let t=e.socket?.remoteAddress||"";return t==="127.0.0.1"||t==="::1"||t==="::ffff:127.0.0.1"}function on(e){if(!rt(e))return null;let t=at(e,Xt).toLowerCase();return t?t.slice(0,80):null}function sn(e){let t=e.socket?.remoteAddress||"unknown";if(!rt(e))return t;let n=at(e,"x-forwarded-for").split(",").pop().trim();return/^[0-9a-fA-F:.]{2,45}$/.test(n)?n:t}function ln(e){return typeof e=="string"?e.replace(/[^\p{L}\p{N} ._'()-]/gu," ").replace(/\s+/g," ").trim().slice(0,60):""}function dn(e){return e.identities.map(fe).filter(t=>!!t&&t.channel==="tailscale").map(t=>t.value)}async function ka(e,t){let n=Date.now(),a=t.now??Date.now,o=t.log??(b=>console.log(b)),r=sn(e),i=t.limiter.retryAfter(r);if(i>0)return o(`[member] pair-code refused from ${r}: locked out for ${i}s more`),{status:429,body:{error:"too many attempts",retryAfter:i},retryAfter:i};let s=null,l="";try{let b=await xe(e,2048);s=b.code,l=ln(b.machine)}catch{}let c=t.codes.redeem(s),d=c?nt(c.token,t.tokens):null;if(await pn(n,t.minMs??Qt),!c||!d)return t.limiter.fail(r),o(`[member] pair-code failed from ${r}`),{status:401,body:{error:tt}};t.limiter.succeed(r);let{rec:m,personId:p}=d,k=t.people().find(b=>b.id===p);if(!k)return t.tokens.revoke(m.id),t.members.log({person:p,device:m.id,event:"refused",address:r,detail:"person no longer listed"}),o(`[member] pair-code for ${p} refused from ${r}: person no longer listed`),{status:403,body:{error:tt}};let u=on(e),f=dn(k);if(f.length&&(!u||!f.includes(u)))return t.tokens.revoke(m.id),t.members.log({person:p,device:m.id,event:"refused",address:r,detail:`network login ${u??"missing"}; expected ${f.join(" or ")}`}),o(`[member] ${p}: pairing from ${r} refused: the network says "${u??"nobody"}", expected ${f.join(" or ")}`),{status:403,body:{error:an}};let I=l||"Unnamed machine",x=k.name.slice(0,40),v=ke(t.root,{title:`New machine for ${x}`,ask:`From ${r}, ${u?`network login ${u}`:"no network login reported"}. Machine name, as typed there: "${I}". Let it see ${x}'s own work?`,recommend:`Yes if ${x} told you they just paired this machine. No if you did not expect it.`,if_silent:"discard",raised_by:Vt},{now:a()});return v.ok?(t.members.add({tokenId:m.id,personId:p,name:I,state:"pending",cardId:v.card.id,address:r,...u?{network:u}:{},createdAt:new Date(a()).toISOString()}),t.members.log({person:p,device:m.id,event:"paired",address:r,detail:I}),o(`[member] ${p} paired "${I}" from ${r}; waiting for the owner (card ${v.card.id})`),{status:200,body:{person:p,name:I,state:"pending"},token:c.token}):(t.tokens.revoke(m.id),t.members.log({person:p,device:m.id,event:"refused",address:r,detail:v.error}),o(`[member] ${p}: pairing from ${r} refused: ${v.error}`),{status:503,body:{error:rn}})}var Q="this machine is not paired",cn="waiting for the owner to approve this machine";function ot(e){return e?e.status==="decided"?e.verdict??null:e.status==="expired"?"no":null:null}function $a(e,t){return t.state==="pending"&&t.cardId?ot(ne(e,t.cardId)):null}function Aa(e,t,n){let a=t.now??Date.now,o=t.log??(d=>console.log(d)),r=nt(e,t.tokens);if(!r)return{ok:!1,status:401,error:Q};let{rec:i,personId:s}=r,l=t.members.byToken(i.id);if(!l||l.state==="removed"||l.personId!==s)return{ok:!1,status:401,error:Q};if(t.people&&!t.people().some(d=>d.id===s))return it(t,i.id,"person no longer listed"),o(`[member] ${s}: "${l.name}" ended: person no longer listed`),{ok:!1,status:401,error:Q};if(l.state==="pending"){let d=l.cardId?ne(t.root,l.cardId):null,m=ot(d);if(m==="yes")l=t.members.update(i.id,{state:"active",approvedAt:new Date(a()).toISOString()})??l,t.members.log({person:s,device:i.id,event:"approved",detail:d?.decided_by}),o(`[member] ${s}: "${l.name}" approved`);else if(m==="no"){let p=d?.status==="expired"?"the owner did not answer in time":"the owner said no";return t.tokens.revoke(i.id),t.members.update(i.id,{state:"removed",removedAt:new Date(a()).toISOString(),removedReason:p}),t.members.log({person:s,device:i.id,event:"refused",detail:p}),o(`[member] ${s}: "${l.name}" refused: ${p}`),{ok:!1,status:401,error:Q}}else return{ok:!1,status:403,error:cn,waiting:!0}}let c=l.lastSeenAt?Date.parse(l.lastSeenAt):0;return n&&(a()-c>=Zt||l.lastAddress!==n)&&(l=t.members.update(i.id,{lastSeenAt:new Date(a()).toISOString(),lastAddress:n})??l,t.members.log({person:s,device:i.id,event:"signed-in",address:n})),{ok:!0,device:l,personId:s,rec:i}}function it(e,t,n="removed by the owner"){let a=e.members.byToken(t);if(!a)return null;e.tokens.revoke(t);let o=e.members.update(t,{state:"removed",removedAt:new Date((e.now??Date.now)()).toISOString(),removedReason:n});return e.members.log({person:a.personId,device:t,event:"removed",detail:n}),o}function Sa(e,t){return e.members.devices(t).filter(n=>n.state!=="removed").map(n=>it(e,n.tokenId,"person removed by the owner")).filter(n=>!!n)}async function pn(e,t){let n=e+t-Date.now();n>0&&await new Promise(a=>setTimeout(a,n))}var st=["gitlab","github"];function gn(e,t,n){let a=String(t||"").trim().toLowerCase();if(!st.includes(a))throw new Error(`Request status works on ${st.join(" and ")}, not on "${t}".`);e.requestStatus=e.requestStatus&&typeof e.requestStatus=="object"?e.requestStatus:{};let o=Array.isArray(e.requestStatus.channels)?e.requestStatus.channels.map(r=>String(r).toLowerCase()):[];return e.requestStatus.channels=n?[...new Set([...o,a])]:o.filter(r=>r!==a),`request status on ${a} is ${n?"on":"off"}`}function Ea(e){return Array.isArray(e?.requestStatus?.channels)?e.requestStatus.channels.map(t=>String(t).toLowerCase()):[]}function Ta(e){let{summary:t}=G(n=>gn(n,e?.channel,!!e?.enabled));return{summary:t}}function Pa(e){return new Set(Object.entries(e).filter(([,t])=>t?.wiki?.absorb?.enabled===!1).map(([t])=>t))}function Da(e,t){return t.only?{agents:[t.only],skipped:[]}:{agents:e.filter(n=>!t.off.has(n)),skipped:e.filter(n=>t.off.has(n))}}function za(e,t){return`absorb is off for this agent (agents.${e}.wiki.absorb.enabled); skipped.${e===t?" It reads the wiki notes inbox, so the inbox was not read.":""} Use --agent ${e} to run it anyway.`}function _a(e,t){if(t){if(!e.wiki?.absorb)return;delete e.wiki.absorb.enabled,Object.keys(e.wiki.absorb).length===0&&delete e.wiki.absorb,Object.keys(e.wiki).length===0&&delete e.wiki;return}e.wiki??={},e.wiki.absorb??={},e.wiki.absorb.enabled=!1}var un="https://ntfy.sh";function Ma(e){return{enabled:!!e?.enabled,server:e?.server||un,topicSet:!!e?.topic,tokenSet:!!e?.token}}function Na(e,t){let n={...e??{}};if("enabled"in t&&(n.enabled=!!t.enabled),"server"in t){let a=String(t.server).trim().replace(/\/+$/,"");if(!/^https?:\/\/\S+$/.test(a))throw new Error("ntfy server must be an http(s) URL");n.server=a}if("topic"in t){let a=String(t.topic).trim();if(!a)throw new Error("ntfy topic cannot be empty");n.topic=a}if("token"in t){let a=String(t.token??"").trim();a?n.token=a:delete n.token}if(n.enabled&&!n.topic)throw new Error("set a topic before enabling ntfy");return n}export{Be as a,An as b,Sn as c,In as d,Pn as e,Dn as f,zn as g,pa as h,ga as i,ua as j,Yt as k,ya as l,tn as m,nn as n,wa as o,sn as p,ka as q,$a as r,Aa as s,it as t,Sa as u,st as v,gn as w,Ea as x,Ta as y,Pa as z,Da as A,za as B,_a as C,Ma as D,Na as E,Ht as F,ta as G,sa as H,la as I};
861
- //# sourceMappingURL=chunk-HH7OFAEM.js.map
861
+ //# sourceMappingURL=chunk-ZX2NJGIU.js.map