botmancers 0.6.1 → 0.7.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.
- package/CHANGELOG.md +26 -0
- package/README.md +13 -12
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +0 -2
- package/app/.next/build-manifest.json +3 -3
- package/app/.next/prerender-manifest.json +4 -4
- package/app/.next/required-server-files.json +2 -2
- package/app/.next/routes-manifest.json +0 -12
- package/app/.next/server/app/_global-error.html +1 -1
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/api/bots/[id]/config/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route.js +2 -2
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/shares/route.js +3 -3
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/shares/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/route.js +2 -2
- package/app/.next/server/app/api/bots/[id]/sessions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/share-policy/route.js +3 -3
- package/app/.next/server/app/api/bots/[id]/share-policy/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/skill/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/availability/route.js +3 -2
- package/app/.next/server/app/api/bots/availability/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/delete-preview/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/manage/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/name-migrations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/route.js +5 -5
- package/app/.next/server/app/api/bots/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/approve/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/deny/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/draft/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/messages/[messageId]/stop/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/messages/route.js +5 -5
- package/app/.next/server/app/api/conversations/[id]/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/stop/route.js +5 -5
- package/app/.next/server/app/api/conversations/[id]/stop/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/exchanges/[id]/cancel/route.js +2 -2
- package/app/.next/server/app/api/exchanges/[id]/cancel/route.js.nft.json +1 -1
- package/app/.next/server/app/api/exchanges/[id]/route.js +3 -3
- package/app/.next/server/app/api/exchanges/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/exchanges/route.js +3 -3
- package/app/.next/server/app/api/exchanges/route.js.nft.json +1 -1
- package/app/.next/server/app/api/files/[name]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/groups/route.js.nft.json +1 -1
- package/app/.next/server/app/api/health/route.js +3 -3
- package/app/.next/server/app/api/health/route.js.nft.json +1 -1
- package/app/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/app/.next/server/app/api/messages/[id]/between/route.js.nft.json +1 -1
- package/app/.next/server/app/api/runtime-connections/route.js.nft.json +1 -1
- package/app/.next/server/app/api/service-grants/route.js.nft.json +1 -1
- package/app/.next/server/app/api/shares/[shareRef]/revoke/route.js +3 -3
- package/app/.next/server/app/api/shares/[shareRef]/revoke/route.js.nft.json +1 -1
- package/app/.next/server/app/api/shares/route.js +3 -3
- package/app/.next/server/app/api/shares/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js +3 -3
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js +3 -3
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js +2 -2
- package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/pins/route.js +3 -3
- package/app/.next/server/app/api/v0/agents/[agentId]/pins/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/route.js +3 -3
- package/app/.next/server/app/api/v0/agents/[agentId]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js +3 -3
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js +3 -3
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/route.js +3 -3
- package/app/.next/server/app/api/v0/agents/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/capabilities/route.js +3 -3
- package/app/.next/server/app/api/v0/capabilities/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/conversations/[id]/route.js +2 -2
- package/app/.next/server/app/api/v0/conversations/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js +3 -3
- package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/exchanges/[id]/route.js +3 -3
- package/app/.next/server/app/api/v0/exchanges/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/exchanges/route.js +3 -3
- package/app/.next/server/app/api/v0/exchanges/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/mcp/route.js +3 -3
- package/app/.next/server/app/api/v0/mcp/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route.js +3 -3
- package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route.js +3 -3
- package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/pins/[pinRef]/route.js +3 -3
- package/app/.next/server/app/api/v0/pins/[pinRef]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/requests/[id]/route.js +2 -2
- package/app/.next/server/app/api/v0/requests/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js +3 -3
- package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/sessions/[ref]/pins/route.js +3 -3
- package/app/.next/server/app/api/v0/sessions/[ref]/pins/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/sessions/[ref]/shares/route.js +3 -3
- package/app/.next/server/app/api/v0/sessions/[ref]/shares/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route.js +3 -3
- package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/shares/[shareRef]/route.js +3 -3
- package/app/.next/server/app/api/v0/shares/[shareRef]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/shares/current/route.js +3 -3
- package/app/.next/server/app/api/v0/shares/current/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/shares/route.js +3 -3
- package/app/.next/server/app/api/v0/shares/route.js.nft.json +1 -1
- package/app/.next/server/app/api/wake-grants/[id]/revoke/route.js +2 -2
- package/app/.next/server/app/api/wake-grants/[id]/revoke/route.js.nft.json +1 -1
- package/app/.next/server/app/api/wakes/[id]/decision/route.js +2 -2
- package/app/.next/server/app/api/wakes/[id]/decision/route.js.nft.json +1 -1
- package/app/.next/server/app/api/wakes/[id]/retry/route.js +2 -2
- package/app/.next/server/app/api/wakes/[id]/retry/route.js.nft.json +1 -1
- package/app/.next/server/app/bots/[id]/config/page.js.nft.json +1 -1
- package/app/.next/server/app/bots/[id]/config/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/exchanges/page.js.nft.json +1 -1
- package/app/.next/server/app/exchanges/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/exchanges.html +1 -1
- package/app/.next/server/app/exchanges.rsc +3 -3
- package/app/.next/server/app/exchanges.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/exchanges.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/exchanges.segments/exchanges/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +3 -3
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/page.js.nft.json +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/settings/page.js.nft.json +1 -1
- package/app/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/settings.html +1 -1
- package/app/.next/server/app/settings.rsc +3 -3
- package/app/.next/server/app/settings.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/threads/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/threads/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +0 -2
- package/app/.next/server/chunks/[root-of-the-server]__0792yb1._.js +44 -0
- package/app/.next/server/chunks/[root-of-the-server]__0d3fjix._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0mp8bap._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0qaiqut._.js +4 -4
- package/app/.next/server/chunks/[root-of-the-server]__0zrx1iz._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__10b5-i-._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__17mum5-._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__17xl_55._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__1j8fg_n._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__1x8phwp._.js +44 -0
- package/app/.next/server/chunks/[root-of-the-server]__200ep0k._.js +1 -1
- package/app/.next/server/chunks/_0061c2q._.js +1 -1
- package/app/.next/server/chunks/_057h7zr._.js +3 -0
- package/app/.next/server/chunks/_0a2do3x._.js +1 -1
- package/app/.next/server/chunks/_1-5mthb._.js +1 -1
- package/app/.next/server/chunks/lib_0-opbv7._.js +316 -0
- package/app/.next/server/chunks/lib_0aejojj._.js +316 -0
- package/app/.next/server/chunks/lib_0il0ml1._.js +316 -0
- package/app/.next/server/chunks/lib_0iujsdg._.js +316 -0
- package/app/.next/server/chunks/lib_0kik6bx._.js +20 -20
- package/app/.next/server/chunks/lib_0pe3tiv._.js +20 -20
- package/app/.next/server/chunks/lib_15adnlz._.js +109 -126
- package/app/.next/server/chunks/lib_1dehbst._.js +316 -0
- package/app/.next/server/chunks/lib_1z4vnh4._.js +316 -0
- package/app/.next/server/chunks/lib_1zc7-gl._.js +109 -126
- package/app/.next/server/chunks/lib_db_ts_1ttuckb._.js +58 -56
- package/app/.next/server/chunks/ssr/_0_fa0na._.js +1 -1
- package/app/.next/server/chunks/ssr/_0a6r_bx._.js +3 -0
- package/app/.next/server/chunks/ssr/_14d-lxn._.js +3 -0
- package/app/.next/server/chunks/ssr/_1cvuhjt._.js +1 -1
- package/app/.next/server/chunks/ssr/_1is_iwu._.js +3 -0
- package/app/.next/server/chunks/ssr/_1n5mvo5._.js +1 -1
- package/app/.next/server/chunks/ssr/_1o94bnv._.js +1 -1
- package/app/.next/server/chunks/ssr/app_bots_[id]_config_page_tsx_1e0uue9._.js +1 -1
- package/app/.next/server/middleware-build-manifest.js +3 -3
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +1 -1
- package/app/.next/server/server-reference-manifest.js +1 -1
- package/app/.next/server/server-reference-manifest.json +1 -1
- package/app/.next/static/chunks/{22xbkclbkct3s.js → 1ouuczm-gmvxs.js} +1 -1
- package/app/.next/static/chunks/{2c953okoei6ip.js → 1w72fds3-utrx.js} +1 -1
- package/app/.next/static/chunks/2095-o17ji0fs.css +3 -0
- package/app/.next/static/chunks/2q-tgwkalrnms.js +1 -0
- package/app/.next/static/chunks/34bv9o9bjkwk0.js +3 -0
- package/app/.next/static/chunks/3rwwunh5sdjzg.js +1 -0
- package/app/.next/static/chunks/3whw2-l4a2sli.js +1 -0
- package/app/.next/static/chunks/3z3mn526_3fwd.js +1 -0
- package/app/BUILD_INFO.json +2 -2
- package/app/package.json +1 -1
- package/app/server.js +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +2 -2
- package/dist/product.d.ts +0 -1
- package/dist/product.js +12 -22
- package/dist/setup.js +9 -9
- package/package.json +1 -2
- package/schemas/botmancers.mcp.v2.tools.json +3 -3
- package/app/.next/server/app/api/agent-deck/decks/route/app-paths-manifest.json +0 -3
- package/app/.next/server/app/api/agent-deck/decks/route/build-manifest.json +0 -12
- package/app/.next/server/app/api/agent-deck/decks/route/server-reference-manifest.json +0 -4
- package/app/.next/server/app/api/agent-deck/decks/route.js +0 -9
- package/app/.next/server/app/api/agent-deck/decks/route.js.nft.json +0 -1
- package/app/.next/server/app/api/agent-deck/decks/route_client-reference-manifest.js +0 -3
- package/app/.next/server/app/api/agent-deck/settings/route/app-paths-manifest.json +0 -3
- package/app/.next/server/app/api/agent-deck/settings/route/build-manifest.json +0 -12
- package/app/.next/server/app/api/agent-deck/settings/route/server-reference-manifest.json +0 -4
- package/app/.next/server/app/api/agent-deck/settings/route.js +0 -9
- package/app/.next/server/app/api/agent-deck/settings/route.js.nft.json +0 -1
- package/app/.next/server/app/api/agent-deck/settings/route_client-reference-manifest.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__0j4pjyg._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__0mo_kn3._.js +0 -48
- package/app/.next/server/chunks/[root-of-the-server]__1bhzfu_._.js +0 -7
- package/app/.next/server/chunks/[root-of-the-server]__1g_n99l._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__1t4ybp2._.js +0 -48
- package/app/.next/server/chunks/_next-internal_server_app_api_agent-deck_decks_route_actions_0yguyfv.js +0 -3
- package/app/.next/server/chunks/_next-internal_server_app_api_agent-deck_settings_route_actions_0z_nbkb.js +0 -3
- package/app/.next/server/chunks/lib_0v4d9w0._.js +0 -339
- package/app/.next/server/chunks/lib_0zzo6zb._.js +0 -339
- package/app/.next/server/chunks/lib_1_u7n-u._.js +0 -339
- package/app/.next/server/chunks/lib_1muhwn7._.js +0 -339
- package/app/.next/server/chunks/lib_1xnxg-q._.js +0 -339
- package/app/.next/server/chunks/ssr/_1i02yyi._.js +0 -3
- package/app/.next/server/chunks/ssr/app_components_AgentDeckRuntime_tsx_024janf._.js +0 -3
- package/app/.next/server/chunks/ssr/app_settings_page_tsx_1t-rdz-._.js +0 -3
- package/app/.next/server/chunks/ssr/node_modules_@swc_helpers_cjs__interop_require_default_cjs_1ztp13a._.js +0 -3
- package/app/.next/static/chunks/0jon21u-9j2aw.css +0 -3
- package/app/.next/static/chunks/14k6cvywgknx2.js +0 -3
- package/app/.next/static/chunks/1ku9himlsx-hn.js +0 -1
- package/app/.next/static/chunks/1r5tqd-7h1xjn.js +0 -1
- package/app/.next/static/chunks/21aqekm5z0j47.js +0 -1
- package/app/.next/static/chunks/2t_2gf3xoxz_m.js +0 -1
- package/app/.next/static/chunks/34vnvo1qssbaj.js +0 -1
- /package/app/.next/static/{_yrIZIFsIbXA0Gaxkytjd → A9sQnaf9i6YzjHNoPgRfU}/_buildManifest.js +0 -0
- /package/app/.next/static/{_yrIZIFsIbXA0Gaxkytjd → A9sQnaf9i6YzjHNoPgRfU}/_clientMiddlewareManifest.js +0 -0
- /package/app/.next/static/{_yrIZIFsIbXA0Gaxkytjd → A9sQnaf9i6YzjHNoPgRfU}/_ssgManifest.js +0 -0
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module.exports=[85148,(e,t,r)=>{t.exports=e.x("better-sqlite3-90e2652d1716b047",()=>require("better-sqlite3-90e2652d1716b047"))},33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},39229,51749,29370,e=>{"use strict";var t=e.i(33405),r=e.i(62349),n=e.i(54799),s=e.i(22734),i=e.i(14747),a=e.i(52036);let o="/v1/chat/completions";class l extends Error{code;status;constructor(e,t,r){super(t),this.name="HermesError",this.code=e,this.status=r}}function u(e=process.env){var t;let r,n=(e.HERMES_API_SERVER_KEY||"").trim();if(!n)return null;let s=(e.HERMES_BASE_URL||"").trim()||"http://127.0.0.1:8642",i=(e.HERMES_SESSION_PREFIX||"").trim()||"botmancer-specialist-",a=(e.HERMES_MODEL||"").trim()||"hermes";return{baseUrl:s.replace(/\/+$/,""),apiKey:n,timeoutMs:(r=Number(t=e.HERMES_TIMEOUT_MS),void 0!==t&&""!==t&&Number.isFinite(r)&&r>0?Math.floor(r):24e4),sessionPrefix:i,model:a}}function d(e,t){return`${t.sessionPrefix}${e}`}function c(e,t){return new l("aborted","Hermes request aborted")}async function p(e){var t;let r,n,{config:s,profilePath:i,sessionId:a,messages:o,signal:u}=e,d=e.fetchImpl||((e,t)=>fetch(e,t)),p=(t=s.baseUrl,r=t.replace(/\/+$/,""),n=i.startsWith("/")?i:`/${i}`,`${r}${n}`),f=new AbortController,g=!1,h=setTimeout(()=>{g=!0,f.abort()},s.timeoutMs);h.unref&&h.unref();let _=()=>f.abort();if(u){if(u.aborted)throw clearTimeout(h),c(u,s.timeoutMs);u.addEventListener("abort",_,{once:!0})}try{let e,t;try{e=await d(p,{method:"POST",headers:{Authorization:`Bearer ${s.apiKey}`,"Content-Type":"application/json","X-Hermes-Session-Id":a},body:JSON.stringify({model:s.model,stream:!1,messages:o}),signal:f.signal})}catch(e){if(g)throw new l("timeout",`Hermes request timed out after ${s.timeoutMs} ms`);if(f.signal.aborted)throw c(u??f.signal,s.timeoutMs);throw new l("network",`Hermes request failed: ${String(e)}`)}let r="";try{r=await e.text()}catch{r=""}if(!e.ok){let t=`Hermes turn failed with status ${e.status}`;try{let e=JSON.parse(r);e?.error?.message&&(t=e.error.message)}catch{let e=r.trim().slice(0,120);e&&(t=`${t}: ${e}`)}throw new l("http",t,e.status)}try{t=JSON.parse(r)}catch{throw new l("protocol","Hermes reply was not JSON",e.status)}return t.choices?.[0]?.message?.content?.trim()||"No response"}finally{clearTimeout(h),u&&u.removeEventListener("abort",_)}}function f(e,t,r=null){return{category:e,code:r,message:t.slice(0,500)}}function g(e){let t=null,r=null;return{promise:new Promise(n=>{if(e.signal&&(r=()=>n(f("cancelled","The attempt was cancelled.")),e.signal.aborted?r():e.signal.addEventListener("abort",r,{once:!0})),"number"==typeof e.deadlineAt){let r=e.deadlineAt,s=()=>{let e=r-Date.now();e<=0?n(f("timed_out","The attempt passed its deadline.")):(t=setTimeout(s,Math.min(e,0x7fffffff))).unref&&t.unref()};s()}}),dispose:()=>{t&&clearTimeout(t),r&&e.signal&&e.signal.removeEventListener("abort",r)}}}function h(e){return e.signal?.aborted?f("cancelled","The attempt was cancelled before launch."):"number"==typeof e.deadlineAt&&Date.now()>=e.deadlineAt?f("timed_out","The attempt passed its deadline before launch."):null}e.s(["HERMES_DEFAULT_CHAT_PATH",0,o,"HermesError",0,l,"appendHermesWaitLog",0,function(e){try{let t=function(e=process.env){return(0,a.waitLogPath)(e)}();s.default.mkdirSync(i.default.dirname(t),{recursive:!0}),s.default.appendFileSync(t,JSON.stringify({at:new Date().toISOString(),...e})+"\n")}catch(e){console.error("wait log failed",e)}},"hermesChat",0,p,"hermesFreshSessionIdForBot",0,function(e,t){return`${d(e,t)}-x-${(0,n.randomUUID)()}`},"hermesProfilePathForBot",0,function(e){let t=(e.hermes_profile||"").trim();if(!t)return o;let r=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return r?`/p/${r}${o}`:o},"hermesSessionIdForBot",0,d,"loadHermesConfig",0,u],51749),e.s(["attemptFailure",0,f,"freezeAttemptInput",0,function(e){return Object.freeze({...e,target:Object.freeze({...e.target}),prompt:Object.freeze("text"===e.prompt.kind?{...e.prompt}:{...e.prompt,history:Object.freeze(e.prompt.history.map(e=>Object.freeze({...e})))}),sessionBinding:e.sessionBinding?Object.freeze({...e.sessionBinding}):null,correlation:Object.freeze({...e.correlation})})},"interruption",0,g,"preLaunchInterruption",0,h],29370);let _=["codex","claude","cursor","muse"];class m extends Error{code="invalid-runtime";constructor(e){super(`Invalid agent-deck runtime: ${JSON.stringify(String(e))}. Expected one of ${_.join("|")}.`)}}function E(e){if("string"==typeof e&&_.includes(e))return e;throw new m(e)}let w=["running","ended","error","died"],y=function(e){let[r,...n]=e;return new Promise(e=>{(0,t.execFile)(r,n,{maxBuffer:4194304},(t,n,s)=>{t&&"ENOENT"===t.code?e({stdout:"",stderr:`Command not found: ${r}`,exitCode:127}):e({stdout:String(n??""),stderr:String(s??""),exitCode:t&&"number"==typeof t.code?t.code:+!!t})})})};async function v(e){let t=function(e){let t=E(e.client);if(!e.deck)throw Error("agent-deck run requires a deck.");if(!e.cwd)throw Error("agent-deck run requires --cwd.");let r="string"==typeof e.prompt&&e.prompt.length>0,n="string"==typeof e.promptFile&&e.promptFile.length>0;if(r===n)throw Error("agent-deck run requires exactly one of --prompt/--prompt-file.");let s=["agent-deck","run",e.deck,"--client",t,"--cwd",e.cwd];return r&&s.push("--prompt",e.prompt),n&&s.push("--prompt-file",e.promptFile),s.push("--tools",e.tools??"readonly"),e.logPath&&s.push("--log",e.logPath),e.resume&&s.push("--resume",e.resume),e.detach&&s.push("--detach"),s}(e),r=await y(t);if(0!==r.exitCode)throw Error(`agent-deck run failed to start (exit ${r.exitCode}): ${r.stderr.slice(0,300)||r.stdout.slice(0,300)}`);return{...function(e){let t=e.match(/run\s+(\S+)\s+detached:\s+pid\s+(\S+)\s+log\s+(\S+)/);if(!t)throw Error(`Unrecognized agent-deck detach output: ${JSON.stringify(e.slice(0,200))}.`);return{runId:t[1],pid:t[2],logPath:t[3]}}(r.stdout),argv:t}}async function S(e){let t=await y(function(e){if(!e)throw Error("agent-deck run status requires a runId.");return["agent-deck","run","status",e,"--json"]}(e));if(0!==t.exitCode)throw Error(`agent-deck run status failed for ${e} (exit ${t.exitCode}): ${t.stderr.slice(0,300)}`);return function(e){let t;try{t=JSON.parse(e)}catch{throw Error("agent-deck run status did not return JSON.")}let r=String(t.state??"");if(!w.includes(r))throw Error(`Unknown agent-deck run state: ${JSON.stringify(r)}.`);let n=t.sessionId;return{runId:String(t.runId??""),deck:String(t.deck??""),client:String(t.client??""),state:r,sessionId:"string"==typeof n&&n.length>0?n:null,logPath:"string"==typeof t.logPath?t.logPath:null}}(t.stdout)}async function b(e,t){let r=await y(function(e,t){if(!e)throw Error("agent-deck run log requires a runId.");let r=["agent-deck","run","log",e,"--json"];return t?.tail!==void 0&&r.push("--tail",String(t.tail)),t?.follow&&r.push("--follow"),r}(e,t));if(0!==r.exitCode)throw Error(`agent-deck run log failed for ${e} (exit ${r.exitCode}): ${r.stderr.slice(0,300)}`);let n=function(e){let t=null,r=null,n=!1,s=null;for(let i of e.split("\n")){let e,a=i.trim();if(a){try{e=JSON.parse(a)}catch{continue}if("result"===e.t){let n=e.sessionId??e.session_id;"string"==typeof e.result&&e.result.length>0?(t={result:e.result,sessionId:"string"==typeof n&&n.length>0?n:null},r=null):(t=null,r=function(e){if(!Object.prototype.hasOwnProperty.call(e,"result"))return"missing";let t=e.result;return null===t?"null":Array.isArray(t)?"array":""===t?"empty string":typeof t}(e))}else if("end"===e.t)n=!0;else if("error"===e.t){let t=e.message??e.error;s="string"==typeof t&&t.length>0?t:"unknown log error"}}}return{result:t,resultMismatch:r,ended:n,errorMessage:s}}(r.stdout);return{raw:r.stdout,...n}}class k extends Error{category;constructor(e,t){super(t),this.category=e}}async function A(e){let t=await b(e,{follow:!0});if(t.errorMessage)throw new k("runtime_failed",`agent-deck run ${e} failed: ${t.errorMessage.slice(0,300)}`);if(!t.ended)throw new k("runtime_failed",`agent-deck run ${e} ended without a terminal log event; failing closed.`);let r=await S(e);if("error"===r.state||"died"===r.state)throw new k("runtime_failed",`agent-deck run ${e} ${r.state}`);if(!t.result)throw new k("result_contract",`agent-deck run ${e} result contract mismatch: expected a non-empty string result, got ${t.resultMismatch??"no result event"}.`);return{status:r,result:t.result.result,sessionId:r.sessionId??t.result.sessionId}}let $={codex:["codex","--version"],claude:["claude","--version"],cursor:["cursor","--version"],muse:["muse","--version"]},I=["agent-deck","--version"];async function x(e){let t=$[E(e)];try{let e=await y(t);if(0!==e.exitCode)return!1;let r=await y(I);return 0===r.exitCode}catch{return!1}}async function O(e){if("hermes-gateway"===(0,r.agentTransport)(e))try{return null!==u()}catch{return!1}return x(e)}async function T(){let e=[];for(let t of r.AGENTS)await O(t)&&e.push(t);return e}function N(e){if("text"===e.kind)return e.text;let t=e.history.map(e=>`[${e.fromAgent?"you":e.speakerLabel}] ${e.content}`).join("\n\n");return`${e.system}
|
|
2
|
-
|
|
3
|
-
Conversation so far (reply to the last message):
|
|
4
|
-
|
|
5
|
-
${t}`}function R(e){return e instanceof Error?e.message:String(e)}e.s(["createAgentDeckAttemptAdapter",0,function(){let e="agent-deck-run";return{name:e,async run(t,r){let n,s,i=Date.now(),a=(t,r={})=>({status:"failed",adapter:e,externalRunId:r.runId??null,externalSessionId:r.sessionId??null,output:null,artifacts:r.logPath?[{kind:"run_log",ref:r.logPath}]:[],startedAt:i,finishedAt:Date.now(),failure:t});if("readonly"!==t.toolProfile&&"edit"!==t.toolProfile)return a(f("unsupported_authority",`Unsupported tool profile: ${JSON.stringify(String(t.toolProfile))}.`));if(!t.deck)return a(f("unavailable","agent-deck run requires a deck."));if(!t.cwd)return a(f("unavailable","agent-deck run requires --cwd."));try{n=E(t.target.agent)}catch(e){return a(f("unavailable",R(e)))}let o=h(t);if(o)return a(o);let l=t.sessionBinding?.externalSessionId??null;try{s=await v({deck:t.deck,client:n,cwd:t.cwd,prompt:N(t.prompt),tools:t.toolProfile,...l?{resume:l}:{},detach:!0})}catch(e){return a(f("launch_failed",R(e)))}r?.({type:"started",adapter:e,at:Date.now(),externalRunId:s.runId,externalSessionId:null});let u=g(t),d=A(s.runId);d.catch(()=>{});let c={runId:s.runId,logPath:s.logPath};try{let t=await Promise.race([d.then(e=>({awaited:e}),e=>({error:e})),u.promise.then(e=>({interrupted:e}))]);if("interrupted"in t)return a(t.interrupted,c);if("error"in t){let e=t.error instanceof k?t.error.category:"runtime_failed";return a(f(e,R(t.error)),c)}let{awaited:r}=t,n=r.status.logPath??s.logPath;if(l&&null!==r.sessionId&&r.sessionId!==l)return a(f("session_mismatch",`resume run ${s.runId} forked the session (expected ${l}, got ${r.sessionId}); failing closed.`),{...c,sessionId:r.sessionId,logPath:n});return{status:"completed",adapter:e,externalRunId:s.runId,externalSessionId:r.sessionId??l,output:r.result,artifacts:n?[{kind:"run_log",ref:n}]:[],startedAt:i,finishedAt:Date.now(),failure:null}}finally{u.dispose()}}}},"deckPromptForAttempt",0,N,"listAvailableAgents",0,T,"parseDeckRuntime",0,E],39229)},67505,e=>{"use strict";var t=e.i(22734),r=e.i(46786),n=e.i(14747),s=e.i(62294);let i="http://127.0.0.1:1111",a="agent_deck_server_url";class o extends Error{code="invalid-agent-deck-server-url";constructor(e){super(`Invalid Agent Deck server URL: ${JSON.stringify(String(e??""))}. Expected an http(s) URL such as ${i}.`)}}function l(e){let t;if("string"!=typeof e)throw new o(e);let r=e.trim();if(!r)throw new o(e);try{t=new URL(r)}catch{throw new o(e)}if("http:"!==t.protocol&&"https:"!==t.protocol||!t.hostname)throw new o(e);return t.toString().replace(/\/+$/,"")}function u(){try{let e=s.workspaceSettings.get(a);if(null===e)return i;return l(e)}catch{return i}}function d(e){return`${l(e)}/api/launch/decks`}class c extends Error{code;attemptedUrls;constructor(e,t,r="agent-deck-discovery-failed"){super(e),this.code=r,this.attemptedUrls=t}}function p(e,t){let r=globalThis.fetch;if("function"!=typeof r)throw Error("fetch is not available in this runtime.");return r(e,t).then(e=>({json:()=>e.json()}))}function f(e){try{return JSON.stringify(e??"").includes("GRANT_REQUIRED")}catch{return!1}}async function g(e){let t,r=d(e?.serverUrl!==void 0?l(e.serverUrl):u()),n=e?.fetchImpl??p;try{let e=await n(r,{method:"GET"});t=await e.json()}catch(e){if(e instanceof c){if(0===e.attemptedUrls.length)throw new c(e.message,[r],e.code);throw e}throw new c(`Cannot reach the Agent Deck server at ${r}: ${e instanceof Error?e.message:String(e)}. Check the workspace Agent Deck URL and that the server is running.`,[r],"connection-failed")}if(f(t))throw new c("Agent Deck server refused deck discovery with GRANT_REQUIRED. Only GET /api/launch/decks is supported; GET /api/decks must not be used.",[r],"grant-required");try{var s=t;if("object"!=typeof s||null===s)throw Error('Expected {"success":true,"data":{"decks":[{"id","name"}]}}.');if(f(s))throw new c("Agent Deck server refused deck discovery with GRANT_REQUIRED. Only GET /api/launch/decks is supported; GET /api/decks must not be used.",[],"grant-required");if(!0!==s.success)throw Error('Expected {"success":true,"data":{"decks":[{"id","name"}]}}.');let e=s.data,r=e?.decks;if(!Array.isArray(r))throw Error('Expected {"success":true,"data":{"decks":[{"id","name"}]}}.');let n=r.map(e=>{if("object"!=typeof e||null===e)throw Error("Expected every deck to carry a string id and name.");let t="string"==typeof e.id?e.id.trim():"",r="string"==typeof e.name?e.name.trim():"";if(!t||!r)throw Error("Expected every deck to carry a string id and name.");return{id:t,name:r}});return n.sort((e,t)=>e.id<t.id?-1:+(e.id>t.id)),n}catch(e){if(e instanceof c)throw e;throw new c(`Agent Deck server at ${r} returned an unexpected deck payload: ${e instanceof Error?e.message:String(e)}`,[r],"invalid-payload")}}function h(e){if(e&&e.trim())return e;let t=(process.env.HOME??"").trim();return t||r.default.homedir()}e.s(["AgentDeckDiscoveryError",0,c,"DEFAULT_AGENT_DECK_SERVER_URL",0,i,"InvalidAgentDeckServerUrlError",0,o,"agentDeckDecksUrl",0,d,"getAgentDeckServerUrl",0,u,"isLocalAgentDeckUrl",0,function(e){let t;try{t=new URL("string"==typeof e?e.trim():"")}catch{return!1}let r=t.hostname.trim().toLowerCase().replace(/^\[|\]$/g,"");return!!("localhost"===r||"::1"===r||"::ffff:127.0.0.1"===r||/^127\.\d+\.\d+\.\d+$/.test(r))},"listAgentDecks",0,g,"remoteLaunchUnsupportedMessage",0,function(e){return`[Deck failed] Remote Agent Deck launch is not supported: the workspace Agent Deck server is non-local and remote \`agent-deck run\` targeting is unconfirmed. Point the workspace server URL at the local Agent Deck server to launch. (server_url=${e})`},"resolveAndEnsureBotWorkdir",0,function(e,r,s){let i=function(e,t,r){let s="string"==typeof t?t.trim():"";if(s)return"~"===s?h(r):s.startsWith("~/")||s.startsWith("~\\")?n.default.join(h(r),s.slice(2)):s;let i=String(e??"").trim();if(!i)throw Error("defaultBotWorkdir requires a bot id.");let a=h(r);return n.default.resolve(a,".botmancers",i)}(e,r,s);return t.default.mkdirSync(i,{recursive:!0}),i},"setAgentDeckServerUrl",0,function(e){let t=l(e);return s.workspaceSettings.set(a,t),t}])},91253,26571,e=>{"use strict";var t=e.i(22734),r=e.i(14747),n=e.i(54799),s=e.i(62294),i=e.i(52036);let a="BOTMANCERS_SERVICE_TOKENS",o=["botmancers-exchanges","botmancers-engine","botmancers-session-share","botmancers-session-context"],l=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,u=/^sha256:([0-9a-f]{64})$/;class d extends Error{constructor(e){super(e),this.name="ServiceTokenConfigError"}}function c(e){if(!e||!e.trim())return[];let t=[],r=new Set;for(let n of e.split(/[,\s]+/).filter(Boolean)){let e=n.indexOf("="),s=e>0?n.slice(0,e):"",i=u.exec(e>0?n.slice(e+1).toLowerCase():"");if(!l.test(s)||!i)throw new d(`${a} entries must be <service-id>=sha256:<64 hex digits>.`);if(r.has(s))throw new d(`${a} lists service ${s} twice.`);if(o.includes(s))throw new d(`${a} names the reserved engine principal ${s}.`);r.add(s),t.push({serviceId:s,digest:Buffer.from(i[1],"hex")})}return t}e.s(["RESERVED_SERVICE_IDS",0,o,"SERVICE_TOKENS_ENV",0,a,"ServiceTokenConfigError",0,d,"parseServiceTokens",0,c,"serviceTokenAuthenticatorFromEnv",0,function(e=process.env){let t=c(e[a]);return t.length?e=>{let r,s,i=(s=(r=e.headers.get("authorization"))?/^Bearer[ \t]+(\S+)[ \t]*$/i.exec(r):null)?s[1]:null;if(!i||i.length>4096)return null;let a=(0,n.createHash)("sha256").update(i,"utf8").digest(),o=null;for(let e of t)(0,n.timingSafeEqual)(a,e.digest)&&null===o&&(o=e.serviceId);return o?{kind:"service",id:o}:null}:null}],26571);let p=["agents:read","sessions:read","conversations:read","sessions:message","exchanges:read","exchanges:create","sessions:start","sessions:resume","shares:create"],f=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,g=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;class h extends Error{constructor(e){super(e),this.name="ServiceGrantsError"}}function _(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function m(e,t,r){let n=Object.keys(e).find(e=>!t.includes(e));if(void 0!==n)throw new h(`${r} has an unknown field "${n}".`)}let E=null;e.s(["EXCHANGE_KEY_PREFIX",0,"exchange:","MESSAGE_KEY_PREFIX",0,"message:","SERVICE_CAPABILITIES",0,p,"loadServiceGrants",0,function(e=process.env){let l,u=function(e=process.env){let t=(e.BOTMANCERS_SERVICE_GRANTS_PATH||"").trim();if(t)return r.default.resolve(t);let n=(0,i.botmancersHome)(e);return n?r.default.join(n,"config/service-grants.json"):null}(e);if(!u)return{state:"absent",path:null};try{l=t.default.statSync(u)}catch(e){if("ENOENT"===e.code)return{state:"absent",path:u};return{state:"invalid",path:u,reason:"The document cannot be read."}}let w=(0,n.createHash)("sha256").update(e[a]??"","utf8").digest("hex"),y=new Set(s.default.prepare("SELECT id FROM bots").all().map(e=>e.id)),v=(0,n.createHash)("sha256").update([...y].sort().join("\n"),"utf8").digest("hex"),S=[u,l.ino,l.size,l.mode,l.uid,l.mtimeMs,w,v].join(":");if(E&&E.key===S)return E.state;let b=function(e,r,n,s){let i;if(!r.isFile())return{state:"invalid",path:e,reason:"The document is not a regular file."};if("function"==typeof process.getuid&&r.uid!==process.getuid())return{state:"invalid",path:e,reason:"The document must be owned by the user running Botmancers."};if((63&r.mode)!=0)return{state:"invalid",path:e,reason:"The document must not be readable or writable by group or others (chmod 600)."};if("string"==typeof n)return{state:"invalid",path:e,reason:n};if(r.size>65536)return{state:"invalid",path:e,reason:"The document exceeds 65536 bytes."};try{i=t.default.readFileSync(e,"utf8")}catch{return{state:"invalid",path:e,reason:"The document cannot be read."}}try{return{state:"loaded",path:e,grants:function(e,t,r){let n;try{n=JSON.parse(e)}catch{throw new h("The document is not valid JSON.")}if(!_(n))throw new h("The document must be a JSON object.");if(m(n,["version","grants"],"The document"),1!==n.version)throw new h("version must be 1.");if(!Array.isArray(n.grants))throw new h("grants must be a list.");if(n.grants.length>512)throw new h("grants has more than 512 entries.");let s=new Map;return n.grants.forEach((e,n)=>{let i=`grants[${n}]`;if(!_(e))throw new h(`${i} must be an object.`);m(e,["service","agent","capabilities"],i);let{service:l,agent:u,capabilities:d}=e;if("string"!=typeof l||!f.test(l))throw new h(`${i}.service must be a configured service id (letters, digits, ".", "_", "-").`);if(o.includes(l))throw new h(`${i}.service names a reserved engine principal.`);if(t&&!t.has(l))throw new h(`${i}.service is not a configured service principal (${a}).`);if("string"!=typeof u||!g.test(u))throw new h(`${i}.agent must be one Agent id; wildcards are not allowed.`);if(r&&!r.has(u))throw new h(`${i}.agent is not a registered Agent.`);if(!Array.isArray(d)||0===d.length)throw new h(`${i}.capabilities must list at least one capability.`);let c=new Set;for(let e of d){if(!("string"==typeof e&&p.includes(e)))throw new h(`${i}.capabilities has an unknown capability.`);if(c.has(e))throw new h(`${i}.capabilities lists ${e} twice.`);c.add(e)}let E=s.get(l)??new Map;if(E.has(u))throw new h(`${i} repeats the grant of service ${l} for that Agent.`);E.set(u,c),s.set(l,E)}),s}(i,n,s)}}catch(t){if(t instanceof h)return{state:"invalid",path:e,reason:t.message};throw t}}(u,l,function(e){try{return new Set(c(e[a]).map(e=>e.serviceId))}catch(e){if(e instanceof d)return`${a} is malformed, so no grant can name a configured service.`;throw e}}(e),y);return E={key:S,state:b},b}],91253)},90027,e=>{"use strict";var t=e.i(62349),r=e.i(28420);let n=["active","ended","all"],s=["implementation","revision"],i=`
|
|
6
|
-
SELECT b.*, bot.name AS agent_name, bot.agent AS agent_runtime, r.id AS origin_request_id, c.id AS origin_conversation_id,
|
|
7
|
-
c.type AS conversation_type, c.bot_id AS conversation_bot_id, tb.name AS thread_agent_name, g.name AS group_name,
|
|
8
|
-
r.intent AS request_intent, r.execution_kind AS request_kind, r.state AS request_state,
|
|
9
|
-
r.source_conversation_id AS request_conversation_id, r.target_agent_id AS request_target_agent_id,
|
|
10
|
-
sa.launch_snapshot AS source_snapshot, sa.finished_at AS source_finished_at,
|
|
11
|
-
(SELECT MAX(COALESCE(ra.finished_at, ra.started_at)) FROM work_attempts ra WHERE ra.resumed_session_binding_id = b.id) AS resumed_last_at,
|
|
12
|
-
EXISTS (SELECT 1 FROM work_attempts oa WHERE oa.resumed_session_binding_id = b.id AND oa.finished_at IS NULL) AS attempt_running,
|
|
13
|
-
ps.availability AS ps_availability, ps.lifecycle AS ps_lifecycle, ps.resumable AS ps_resumable, ps.busy AS ps_busy,
|
|
14
|
-
ps.workspace AS ps_workspace, ps.last_synced_at AS ps_synced_at,
|
|
15
|
-
EXISTS (SELECT 1 FROM provider_session_turns pt WHERE pt.session_ref = ps.id AND pt.state = 'running') AS ps_running
|
|
16
|
-
FROM session_bindings b
|
|
17
|
-
JOIN bots bot ON bot.id = b.agent_id
|
|
18
|
-
LEFT JOIN provider_sessions ps ON ps.binding_id = b.id
|
|
19
|
-
LEFT JOIN work_attempts sa ON sa.id = b.source_attempt_id
|
|
20
|
-
LEFT JOIN work_requests r ON r.id = COALESCE(b.request_id, sa.request_id)
|
|
21
|
-
LEFT JOIN conversations c ON c.id = COALESCE(b.conversation_id, r.source_conversation_id)
|
|
22
|
-
LEFT JOIN bots tb ON tb.id = c.bot_id
|
|
23
|
-
LEFT JOIN groups g ON g.id = c.group_id
|
|
24
|
-
`,a=`
|
|
25
|
-
SELECT ps.id, ps.agent_id, bot.name AS agent_name, ps.provider_kind, ps.title, ps.workspace,
|
|
26
|
-
ps.provider_created_at, ps.provider_updated_at, ps.availability, ps.lifecycle, ps.resumable, ps.busy,
|
|
27
|
-
ps.last_synced_at, ps.created_at, ps.updated_at,
|
|
28
|
-
(SELECT MAX(COALESCE(t.finished_at, t.created_at)) FROM provider_session_turns t WHERE t.session_ref = ps.id) AS turn_last_at,
|
|
29
|
-
EXISTS (SELECT 1 FROM provider_session_turns t WHERE t.session_ref = ps.id AND t.state = 'running') AS running
|
|
30
|
-
FROM provider_sessions ps
|
|
31
|
-
JOIN bots bot ON bot.id = ps.agent_id
|
|
32
|
-
WHERE ps.binding_id IS NULL
|
|
33
|
-
`;function o(e){return`${new Date(e).toISOString().slice(0,16).replace("T"," ")} UTC`}function l(e,t){let r=e?.[t];return"string"==typeof r&&r.trim().length>0?r:null}function u(e){let t=e.origin_conversation_id;return t?"group"===e.conversation_type?{id:t,kind:"group",label:e.group_name?`Group ${e.group_name}`:"Group thread",thread_agent_id:null}:"bot"===e.conversation_type&&e.conversation_bot_id?{id:t,kind:"direct",label:e.thread_agent_name?`${e.thread_agent_name} thread`:"Agent thread",thread_agent_id:e.thread_agent_name?e.conversation_bot_id:null}:{id:t,kind:"agent_api",label:"Agent API conversation",thread_agent_id:null}:null}function d(e,n=(0,r.emptyUsage)()){let i,a=null;try{a=e.source_snapshot?JSON.parse(e.source_snapshot):null}catch{}let c=u(e),p=null===e.released_at?"active":"ended",f=((i=(e.request_intent??"").split("\n").map(e=>e.trim()).find(e=>e.length>0))?i.length>80?`${i.slice(0,79).trimEnd()}…`:i:null)??(c?.kind==="group"?c.label:null)??`${e.agent_name} \xb7 ${o(e.created_at)}`;return{ref:e.id,source:"botmancers",agent:{id:e.agent_id,name:e.agent_name,adapter:e.adapter,transport:l(a,"transport")},title:f,status:p,resumable:null===e.released_at&&null!==e.request_id&&null!==e.request_kind&&s.includes(e.request_kind)&&e.request_target_agent_id===e.agent_id&&(e.conversation_id??"")===(e.request_conversation_id??"")&&e.adapter===(0,t.resolveAgent)({agent:e.agent_runtime}).agent,state:{availability:e.ps_availability??"available",lifecycle:e.ps_lifecycle??"open",resumable:null===e.ps_resumable||void 0===e.ps_resumable?null:1===e.ps_resumable,busy:1===e.ps_busy||!!e.attempt_running||!!e.ps_running,synced_at:e.ps_synced_at??null},created_at:e.created_at,ended_at:e.released_at,last_activity_at:Math.max(e.created_at,e.released_at??0,e.source_finished_at??0,e.resumed_last_at??0),origin:{conversation:c,work_request:e.origin_request_id&&e.request_kind&&e.request_state?{id:e.origin_request_id,execution_kind:e.request_kind,state:e.request_state}:null},context:{workspace:l(a,"cwd")??e.ps_workspace??null,deck:l(a,"deck")},usage:n}}function c(e,t=(0,r.emptyUsage)()){let n=e.provider_created_at??e.created_at,s=null===e.resumable?null:1===e.resumable,i="archived"===e.lifecycle?e.provider_updated_at??e.updated_at:null;return{ref:e.id,source:"native",agent:{id:e.agent_id,name:e.agent_name,adapter:e.provider_kind,transport:null},title:e.title??`${e.agent_name} \xb7 ${o(n)}`,status:"open"===e.lifecycle?"active":"ended",resumable:!1,state:{availability:e.availability,lifecycle:e.lifecycle,resumable:s,busy:1===e.busy||!!e.running,synced_at:e.last_synced_at},created_at:n,ended_at:i,last_activity_at:Math.max(n,e.provider_updated_at??0,e.turn_last_at??0),origin:{conversation:null,work_request:null},context:{workspace:e.workspace,deck:null},usage:t}}function p(e,t){return t.last_activity_at-e.last_activity_at||t.created_at-e.created_at||(e.ref<t.ref?-1:+(e.ref>t.ref))}function f(e,t,r){return e.prepare(`${a} AND ps.id = ? AND ps.agent_id = ?`).get(r,t)}function g(e,t,r){return e.prepare(`${i} WHERE b.id = ? AND b.agent_id = ?`).get(r,t)}e.s(["agentExists",0,function(e,t){return!!e.prepare("SELECT 1 FROM bots WHERE id = ?").get(t)},"conversationRef",0,function(e,t){let r=e.prepare(`
|
|
34
|
-
SELECT c.id AS origin_conversation_id, c.type AS conversation_type, c.bot_id AS conversation_bot_id,
|
|
35
|
-
tb.name AS thread_agent_name, g.name AS group_name
|
|
36
|
-
FROM conversations c
|
|
37
|
-
LEFT JOIN bots tb ON tb.id = c.bot_id
|
|
38
|
-
LEFT JOIN groups g ON g.id = c.group_id
|
|
39
|
-
WHERE c.id = ?
|
|
40
|
-
`).get(t);return r?u(r):null},"getAgentSession",0,function(e,t,n){let s=g(e,t,n);if(!s){let s=f(e,t,n);if(!s)return;let{usage:i,samples:a}=(0,r.sessionUsageSamples)(e,t,n);return{...c(s,i),attempts:[],usage_samples:a}}let i=e.prepare(`
|
|
41
|
-
SELECT a.attempt_number, a.kind, a.request_id, a.outcome, a.started_at, a.finished_at,
|
|
42
|
-
CASE WHEN a.id = ? THEN 'source' ELSE 'resume' END AS role
|
|
43
|
-
FROM work_attempts a
|
|
44
|
-
WHERE a.id = ? OR a.resumed_session_binding_id = ?
|
|
45
|
-
ORDER BY a.started_at ASC, a.id ASC
|
|
46
|
-
`).all(s.source_attempt_id,s.source_attempt_id,s.id),{usage:a,samples:o}=(0,r.sessionUsageSamples)(e,t,n);return{...d(s,a),attempts:i,usage_samples:o}},"isSessionFilter",0,function(e){return"string"==typeof e&&n.includes(e)},"listAgentSessions",0,function(e,t,n="all"){let s=e.prepare(`${i} WHERE b.agent_id = ? ${"active"===n?"AND b.released_at IS NULL":"ended"===n?"AND b.released_at IS NOT NULL":""}`).all(t),o=e.prepare(`${a} AND ps.agent_id = ? ${"active"===n?"AND ps.lifecycle = 'open'":"ended"===n?"AND ps.lifecycle = 'archived'":""}`).all(t),l=(0,r.agentSessionUsage)(e,t);return[...s.map(e=>d(e,l.get(e.id))),...o.map(e=>c(e,l.get(e.id)))].sort(p)},"sessionDebugExternalId",0,function(e,t,r){let n=g(e,t,r)?.external_session_id;if(void 0!==n)return n;if(!f(e,t,r))return;let s=e.prepare("SELECT provider_session_id FROM provider_sessions WHERE id = ? AND agent_id = ?").get(r,t);return s?.provider_session_id},"sessionTitle",0,function(e,t,r){let n=g(e,t,r);if(n)return d(n).title;let s=f(e,t,r);return s?c(s).title:null}])}];
|
|
47
|
-
|
|
48
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__1t4ybp2._.js.map
|