botmancers 0.10.0 → 0.10.2
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 +38 -1
- package/README.md +17 -15
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/build-manifest.json +3 -3
- package/app/.next/prerender-manifest.json +3 -3
- package/app/.next/required-server-files.json +2 -2
- 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/agents/[id]/activity/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/activity/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/agents/[id]/config/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/config/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/agents/[id]/conversations/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/conversations/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/agents/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/agents/[id]/sessions/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/sessions/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/agents/[id]/slack/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/slack/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/bots/[id]/activity/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/config/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/conversations/[conversationId]/route.js +3 -3
- package/app/.next/server/app/api/bots/[id]/conversations/[conversationId]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/conversations/route.js +3 -3
- package/app/.next/server/app/api/bots/[id]/conversations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/overview/route.js +2 -2
- package/app/.next/server/app/api/bots/[id]/overview/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 +2 -2
- 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]/sessions/sync/route.js +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/sync/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/share-policy/route.js +2 -2
- 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.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 +4 -4
- 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 +3 -3
- 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 +4 -4
- 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 +1 -1
- package/app/.next/server/app/api/exchanges/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/exchanges/route.js +4 -4
- 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-capacity/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 +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 +2 -2
- package/app/.next/server/app/api/shares/[shareRef]/revoke/route.js.nft.json +1 -1
- package/app/.next/server/app/api/shares/route.js +2 -2
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- package/app/.next/server/app/api/v0/agents/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/capabilities/route.js +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- package/app/.next/server/app/api/v0/exchanges/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/mcp/route.js +4 -4
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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]/route.js.nft.json +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0aincj4._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0anfwiu._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0fku-bw._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__1273j55._.js +52 -0
- package/app/.next/server/chunks/[root-of-the-server]__13wghn3._.js +4 -4
- package/app/.next/server/chunks/[root-of-the-server]__1fdy1d8._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__1n7hlu8._.js +46 -0
- package/app/.next/server/chunks/_0061c2q._.js +1 -1
- package/app/.next/server/chunks/_031id45._.js +3 -0
- package/app/.next/server/chunks/_04o493a._.js +3 -0
- package/app/.next/server/chunks/_06yp-l-._.js +3 -0
- package/app/.next/server/chunks/_0bl1uw-._.js +3 -0
- package/app/.next/server/chunks/_0gh03eo._.js +3 -0
- package/app/.next/server/chunks/_0h0j5ta._.js +3 -0
- package/app/.next/server/chunks/_0hzb8hh._.js +3 -0
- package/app/.next/server/chunks/_0oodw7g._.js +3 -0
- package/app/.next/server/chunks/_0owd_4q._.js +3 -0
- package/app/.next/server/chunks/_0venewj._.js +3 -0
- package/app/.next/server/chunks/_0wzia1p._.js +3 -0
- package/app/.next/server/chunks/_1-5mthb._.js +1 -1
- package/app/.next/server/chunks/_1-8493l._.js +3 -0
- package/app/.next/server/chunks/_1a0er16._.js +3 -3
- package/app/.next/server/chunks/_1bvoyii._.js +3 -0
- package/app/.next/server/chunks/_1gyq3w2._.js +3 -0
- package/app/.next/server/chunks/_1j3c311._.js +3 -0
- package/app/.next/server/chunks/{_1ey6l4p._.js → _1k74ggt._.js} +2 -2
- package/app/.next/server/chunks/_1l_t4_r._.js +3 -0
- package/app/.next/server/chunks/_1lac7c3._.js +3 -0
- package/app/.next/server/chunks/_1mlmzwb._.js +3 -0
- package/app/.next/server/chunks/_1rg79tr._.js +3 -0
- package/app/.next/server/chunks/_1s5qnlr._.js +3 -0
- package/app/.next/server/chunks/{_1x4dqzv._.js → _1u-wiq_._.js} +2 -2
- package/app/.next/server/chunks/_1uxmsh3._.js +3 -3
- package/app/.next/server/chunks/_1xaqb38._.js +3 -0
- package/app/.next/server/chunks/_1zw-w5h._.js +3 -0
- package/app/.next/server/chunks/lib_0-opbv7._.js +30 -30
- package/app/.next/server/chunks/lib_0aejojj._.js +30 -30
- package/app/.next/server/chunks/lib_0al5wbc._.js +30 -30
- package/app/.next/server/chunks/lib_0il0ml1._.js +30 -30
- package/app/.next/server/chunks/lib_0iujsdg._.js +30 -30
- package/app/.next/server/chunks/lib_15a9ejf._.js +35 -28
- package/app/.next/server/chunks/lib_19pzc33._.js +35 -28
- package/app/.next/server/chunks/lib_1a4ucxv._.js +30 -30
- package/app/.next/server/chunks/lib_1dehbst._.js +30 -30
- package/app/.next/server/chunks/lib_1h919zb._.js +3 -0
- package/app/.next/server/chunks/lib_1z4vnh4._.js +30 -30
- package/app/.next/server/chunks/lib_1z7d95m._.js +35 -28
- package/app/.next/server/chunks/lib_db_ts_1ttuckb._.js +9 -2
- package/app/.next/server/chunks/lib_service-api-http_ts_0xzqhny._.js +1 -1
- package/app/.next/server/chunks/lib_service-api_ts_18eok4w._.js +5 -5
- package/app/.next/server/chunks/lib_slack-runtime_ts_0fgsejy._.js +6 -6
- package/app/.next/server/chunks/ssr/_00qrupp._.js +3 -0
- package/app/.next/server/chunks/ssr/_01ngpwj._.js +1 -1
- package/app/.next/server/chunks/ssr/_0d7gv3q._.js +3 -0
- package/app/.next/server/chunks/ssr/_0iywd5g._.js +1 -1
- package/app/.next/server/chunks/ssr/_0mxifu3._.js +1 -1
- package/app/.next/server/chunks/ssr/_0u7urta._.js +1 -1
- package/app/.next/server/chunks/ssr/app_agents_[id]_0sr4fdg._.js +1 -1
- package/app/.next/server/chunks/ssr/app_agents_[id]_activity_AgentActivityPage_tsx_042-590._.js +1 -1
- package/app/.next/server/chunks/ssr/app_agents_[id]_config_page_tsx_1f_gu1l._.js +1 -1
- package/app/.next/server/chunks/ssr/app_agents_[id]_sessions_page_tsx_0tfup-2._.js +3 -3
- package/app/.next/server/chunks/ssr/app_agents_[id]_slack_AgentSlackPage_tsx_20njhs1._.js +1 -1
- package/app/.next/server/chunks/ssr/app_page_tsx_0pxmutw._.js +1 -1
- package/app/.next/server/chunks/ssr/lib_0pfn9gs._.js +1 -1
- package/app/.next/server/chunks/ssr/lib_agent-registration-ui_ts_1z582mm._.js +1 -1
- package/app/.next/server/chunks/ssr/lib_exchange-view_ts_1a4q9ju._.js +1 -1
- package/app/.next/server/chunks/ssr/lib_share-view_ts_08psw5o._.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/{2dtkykrnob8wk.js → 00pca1oa16xc5.js} +1 -1
- package/app/.next/static/chunks/{3x56k5qa012au.js → 0apccyvpyjlo7.js} +1 -1
- package/app/.next/static/chunks/{04nfr73lkk7pz.js → 0l9r-x310007w.js} +1 -1
- package/app/.next/static/chunks/{0eqgs3167zj2j.js → 0xo3nwo_nscvf.js} +1 -1
- package/app/.next/static/chunks/{326jto9l-m8vj.js → 0z_bq7h1mwcf3.js} +4 -4
- package/app/.next/static/chunks/18btj4qlun8o7.js +1 -0
- package/app/.next/static/chunks/{2cc4uzbhs_v23.js → 1k8e6j67zksws.js} +1 -1
- package/app/.next/static/chunks/{0h567k13e53r-.js → 1y9hc8qm0hqds.js} +1 -1
- package/app/.next/static/chunks/{2ebpfmg4vni8e.js → 2wbcr5n_vcynr.js} +1 -1
- package/app/.next/static/chunks/3_lwv2zgy_-bw.css +3 -0
- package/app/.next/static/chunks/3a_ffnuma49te.js +1 -0
- package/app/.next/static/chunks/{3whw2-l4a2sli.js → 3fm68xa8a4-es.js} +1 -1
- package/app/.next/static/chunks/{0cjh4u-f7mlwd.js → 3gw1ytgjq4pxu.js} +1 -1
- package/app/.next/static/chunks/3wlqn3gd_jv_r.js +1 -0
- package/app/.next/static/chunks/3xjoca0z2onuc.js +1 -0
- package/app/BUILD_INFO.json +2 -2
- package/app/package.json +1 -1
- package/app/server.js +1 -1
- package/dist/contract.js +2 -2
- package/package.json +1 -1
- package/schemas/botmancers.mcp.v2.tools.json +48 -83
- package/skills/botmancers-collaboration/SKILL.md +10 -10
- package/skills/botmancers-collaboration/references/workflows.md +20 -14
- package/app/.next/server/chunks/[root-of-the-server]__07q5mnr._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__1280ke1._.js +0 -46
- package/app/.next/server/chunks/[root-of-the-server]__1jxwu9_._.js +0 -52
- package/app/.next/server/chunks/_04e2bgj._.js +0 -3
- package/app/.next/server/chunks/_05po7b4._.js +0 -3
- package/app/.next/server/chunks/_06sxx0e._.js +0 -3
- package/app/.next/server/chunks/_0ar2ooe._.js +0 -3
- package/app/.next/server/chunks/_0fmotaz._.js +0 -3
- package/app/.next/server/chunks/_0kpfto_._.js +0 -3
- package/app/.next/server/chunks/_0lm6uis._.js +0 -3
- package/app/.next/server/chunks/_0mpu5tl._.js +0 -3
- package/app/.next/server/chunks/_0u9cfq9._.js +0 -3
- package/app/.next/server/chunks/_0ul8k7g._.js +0 -3
- package/app/.next/server/chunks/_1-60d3o._.js +0 -3
- package/app/.next/server/chunks/_11-q8k1._.js +0 -3
- package/app/.next/server/chunks/_133y3b0._.js +0 -3
- package/app/.next/server/chunks/_167960a._.js +0 -3
- package/app/.next/server/chunks/_17vgjlt._.js +0 -3
- package/app/.next/server/chunks/_1amx9_4._.js +0 -3
- package/app/.next/server/chunks/_1b01v-_._.js +0 -3
- package/app/.next/server/chunks/_1c-g4gq._.js +0 -3
- package/app/.next/server/chunks/_1ess5if._.js +0 -3
- package/app/.next/server/chunks/_1i0zod4._.js +0 -3
- package/app/.next/server/chunks/_1nlg4x_._.js +0 -3
- package/app/.next/server/chunks/_1z0qbzc._.js +0 -3
- package/app/.next/server/chunks/lib_0i8cm07._.js +0 -3
- package/app/.next/server/chunks/ssr/_0g3y1u9._.js +0 -3
- package/app/.next/server/chunks/ssr/app_agents_[id]_conversations_page_tsx_15zl_c8._.js +0 -3
- package/app/.next/static/chunks/10i-rrea371m2.js +0 -1
- package/app/.next/static/chunks/17qi6hcgg0nlz.css +0 -3
- package/app/.next/static/chunks/1ypwptc0fsn4w.js +0 -1
- package/app/.next/static/chunks/2myfan3i8z-jy.js +0 -1
- package/app/.next/static/chunks/34v8aumua0x5n.js +0 -1
- /package/app/.next/static/{92gsyY5d-nMkxJ7iQxKkY → 45V8A9u4-Y-aZNxovpZCu}/_buildManifest.js +0 -0
- /package/app/.next/static/{92gsyY5d-nMkxJ7iQxKkY → 45V8A9u4-Y-aZNxovpZCu}/_clientMiddlewareManifest.js +0 -0
- /package/app/.next/static/{92gsyY5d-nMkxJ7iQxKkY → 45V8A9u4-Y-aZNxovpZCu}/_ssgManifest.js +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,49816,e=>{"use strict";var s=e.i(43476),a=e.i(22016),n=e.i(71645),t=e.i(18566),l=e.i(63352),i=e.i(3136),r=e.i(71836),o=e.i(50814);function c({mode:e,session:a,agents:t,origin:i,onClose:d,onStarted:u}){let h=(0,n.useId)(),m=(0,n.useId)(),p=(0,n.useId)(),x=(0,n.useId)(),[g,j]=(0,n.useState)(""),[f,b]=(0,n.useState)(""),[v,y]=(0,n.useState)(!1),[N,S]=(0,n.useState)({}),[k,w]=(0,n.useState)(""),[C,$]=(0,n.useState)(!1),R=(0,n.useRef)(!1),_=(0,n.useRef)(null),I=(0,n.useRef)(null),A=(0,n.useRef)(null),T=(0,n.useRef)(null),L=(0,n.useRef)(null),U=(0,o.sessionDialogUsesPin)(e,a.route),E=t.filter(e=>e.id!==a.agent.id);(0,n.useEffect)(()=>{("continue"===e?T.current:A.current)?.focus()},[e]),(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(e.stopPropagation(),d())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[d]);let O=async s=>{if(s.preventDefault(),R.current)return;let n={mode:"resume"===e?"ask":e,instruction:g,originConversationId:i.conversationId,destinationAgentId:f},t="resume"===e?(0,o.validateResumeDraft)(g,v):(0,o.validateDraft)(n);if(S(t),Object.keys(t).length>0)return void(t.destination?T.current?.focus():t.instruction?A.current?.focus():L.current?.focus());let l="resume"===e?"resume":"ask",r=e=>U?(0,o.pinRequestBody)(l,g,i.conversationId,v,e):(0,o.exchangeRequestBody)(n,{agentId:a.agent.id,sessionRef:a.ref},e),c=JSON.stringify(r(""));_.current&&_.current.payload===c||(_.current={payload:c,key:crypto.randomUUID()}),R.current=!0,$(!0),w("");try{let e=U?`/api/bots/${encodeURIComponent(a.agent.id)}/sessions/${encodeURIComponent(a.ref)}/pins`:"/api/exchanges",s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r(_.current.key))}),n=await s.json().catch(()=>null);if(!s.ok){let e="string"==typeof n?.error?.code?n.error.code:null;"idempotency_conflict"===e&&(_.current=null),w((0,o.submitErrorMessage)(e,"string"==typeof n?.error?.message?n.error.message:null));return}let t=U?n?.turn?.exchange_id:n?.exchange?.id;u("string"==typeof t?t:null)}catch{w((0,o.submitErrorMessage)(null,"Botmancers could not be reached. Your draft is kept; try again."))}finally{R.current=!1,$(!1)}},D=E.find(e=>e.id===f)?.name,F="ask"===e,P="resume"===e;return(0,s.jsx)("div",{className:"modal-scrim exchange-scrim",onMouseDown:e=>{e.target===e.currentTarget&&d()},onKeyDown:e=>{if("Tab"!==e.key||!I.current)return;let s=Array.from(I.current.querySelectorAll(r.DIALOG_FOCUSABLE)),a=(0,r.wrapFocusTarget)(s,document.activeElement,e.shiftKey);a&&(e.preventDefault(),a.focus())},children:(0,s.jsxs)("div",{ref:I,className:"form-card exchange-dialog",role:"dialog","aria-modal":"true","aria-labelledby":h,"data-exchange-mode":e,children:[(0,s.jsx)("h2",{id:h,className:"delete-title",children:(0,o.sessionDialogTitle)(e)}),(0,s.jsxs)("section",{className:"exchange-source","aria-label":"Source session",children:[(0,s.jsx)("p",{className:"exchange-source-agent",children:a.agent.name}),(0,s.jsx)("p",{className:"exchange-source-title",children:a.title}),(0,s.jsxs)("p",{className:"exchange-source-meta",children:["Last activity ",(0,l.formatSessionDate)(a.last_activity_at),a.origin.conversation?` \xb7 from ${a.origin.conversation.label}`:""]})]}),(0,s.jsxs)("form",{onSubmit:O,noValidate:!0,className:"exchange-form",children:[F||P?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("label",{htmlFor:p,children:"Hand off to"}),(0,s.jsxs)("select",{ref:T,id:p,className:"exchange-select",value:f,"aria-invalid":!!N.destination||void 0,"aria-describedby":N.destination?`${p}-error`:void 0,disabled:C,onChange:e=>{b(e.target.value),S(e=>({...e,destination:void 0}))},children:[(0,s.jsx)("option",{value:"",children:"Choose an Agent"}),E.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]}),N.destination?(0,s.jsx)("p",{id:`${p}-error`,className:"exchange-field-error",children:N.destination}):null]}),(0,s.jsx)("label",{htmlFor:m,children:F?"Question":P?"Instruction":"Objective"}),(0,s.jsx)("textarea",{ref:A,id:m,rows:4,maxLength:o.INSTRUCTION_LIMIT,value:g,readOnly:C,"aria-invalid":!!N.instruction||void 0,"aria-describedby":`${m}-hint${N.instruction?` ${m}-error`:""}`,onChange:e=>{j(e.target.value),S(e=>({...e,instruction:void 0}))}}),N.instruction?(0,s.jsx)("p",{id:`${m}-error`,className:"exchange-field-error",children:N.instruction}):null,(0,s.jsx)("p",{id:`${m}-hint`,className:"exchange-hint",children:F?`${a.agent.name} answers from this exact session, read-only. The answer arrives in ${i.label}.`:P?`${a.agent.name} resumes work in this exact session and may edit its workspace. The turn never moves to another session. Progress shows in ${i.label}.`:`${D??"The Agent you choose"} receives an extracted handoff (objective, decisions, constraints, references, open questions) and starts a new session of its own. ${a.agent.name}’s session is not shared and is not changed. Progress shows in ${i.label}.`}),P?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("label",{className:"exchange-approval",htmlFor:x,children:[(0,s.jsx)("input",{ref:L,id:x,type:"checkbox",checked:v,disabled:C,"aria-invalid":!!N.approval||void 0,"aria-describedby":N.approval?`${x}-error`:void 0,onChange:e=>{y(e.target.checked),S(e=>({...e,approval:void 0}))}})," ","I approve edits by ",a.agent.name," in this session"]}),N.approval?(0,s.jsx)("p",{id:`${x}-error`,className:"exchange-field-error",children:N.approval}):null]}):null,k?(0,s.jsx)("p",{className:"exchange-server-error",role:"alert",children:k}):null,(0,s.jsx)("p",{className:"exchange-sending",role:"status",children:C?"Sending…":""}),(0,s.jsxs)("div",{className:"form-actions",children:[(0,s.jsx)("button",{type:"button",className:"cancel-btn",onClick:d,children:"Cancel"}),(0,s.jsx)("button",{type:"submit",className:"create-btn",disabled:C,"aria-disabled":C,children:k?"Try again":"Send"})]})]})]})})}var d=e.i(24204);function u(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?`owner-share-${crypto.randomUUID()}`:`owner-share-${Date.now()}-${Math.random().toString(36).slice(2)}`}function h({row:e,shares:t,policy:l,onChanged:i}){let r=(0,n.useId)(),[o,c]=(0,n.useState)(!1),[u,x]=(0,n.useState)(!1),g=t?(0,d.sessionShares)(t,e.ref):[],j=g.filter(d.shareIsLive),f=g.filter(e=>!(0,d.shareIsLive)(e)),b="loading"===l,v="loading"===l?null:l,y=b?null:(0,d.shareCreateAvailability)(e,v),N=u?f:f.slice(0,3*!j.length);return(0,s.jsxs)("section",{className:"session-shares","aria-labelledby":r,"data-session-shares":e.ref,children:[(0,s.jsxs)("div",{className:"session-shares-head",children:[(0,s.jsx)("h3",{id:r,className:"session-shares-title",children:"Slack share"}),y?.available&&!o?(0,s.jsx)("button",{type:"button",className:"session-action","data-share-action":"create",onClick:()=>c(!0),children:"Share to Slack"}):null]}),b?(0,s.jsx)("p",{className:"session-share-note session-share-loading",role:"status",children:"Checking the share policy…"}):null,y&&!y.available?(0,s.jsxs)("p",{className:"session-share-unavailable",children:[y.reason," ",y.configHref?(0,s.jsx)(a.default,{className:"session-link",href:y.configHref,children:"Open Config"}):null]}):null,o&&v?(0,s.jsx)(p,{row:e,policy:v,onCancel:()=>c(!1),onCreated:()=>{c(!1),i()}}):null,null===t?(0,s.jsx)("p",{className:"session-share-note",role:"status",children:"Loading shares…"}):null,null===t||0!==g.length||o?null:(0,s.jsx)("p",{className:"session-share-note",children:"Not shared."}),j.length+N.length>0?(0,s.jsx)("ul",{className:"session-share-list","aria-label":`Slack shares of ${e.title}`,children:[...j,...N].map(e=>(0,s.jsx)(m,{share:e,onChanged:i},e.share_ref))}):null,f.length>N.length?(0,s.jsxs)("button",{type:"button",className:"pin-word",onClick:()=>x(!0),children:["Show ",f.length-N.length," ended share",f.length-N.length==1?"":"s"]}):null]})}function m({share:e,onChanged:a}){let[t,l]=(0,n.useState)(!1),[i,r]=(0,n.useState)(!1),[o,c]=(0,n.useState)(""),[u,h]=(0,n.useState)(!1),p=(0,d.shareIsLive)(e),x=async()=>{try{await navigator.clipboard.writeText(e.share_ref),h(!0)}catch{c("Copy failed. Select the reference instead.")}},g=async()=>{r(!0),c("");try{let s=await fetch(`/api/shares/${encodeURIComponent(e.share_ref)}/revoke`,{method:"POST"}),n=await s.json().catch(()=>null);s.ok?(l(!1),a()):c("string"==typeof n?.error?.message?n.error.message:"The share could not be revoked.")}catch{c("The share could not be revoked.")}finally{r(!1)}};return(0,s.jsxs)("li",{className:`session-share is-${e.status}`,"data-share-ref":e.share_ref,"data-share-status":e.status,children:[(0,s.jsxs)("div",{className:"session-share-head",children:[(0,s.jsx)("span",{className:`manage-tag session-share-status is-${e.status}`,children:d.SHARE_STATUS_LABELS[e.status]}),(0,s.jsx)("span",{className:"session-share-audience",children:(0,d.audienceLabel)(e.audience)})]}),(0,s.jsxs)("dl",{className:"manage-meta session-share-meta",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Expiry"}),(0,s.jsx)("dd",{children:(0,d.expiryLabel)(e)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Questions"}),(0,s.jsx)("dd",{children:(0,d.turnsLabel)(e)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Thread"}),(0,s.jsx)("dd",{children:(0,d.threadLabel)(e)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Reference"}),(0,s.jsx)("dd",{children:(0,s.jsx)("code",{className:"session-share-ref",children:e.share_ref})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Origin"}),(0,s.jsxs)("dd",{children:[(0,d.createdByLabel)(e)," · read-only Ask"]})]})]}),(0,s.jsx)("p",{className:"session-share-note",children:(0,d.shareStatusNote)(e)}),(0,s.jsxs)("div",{className:"session-actions",role:"group","aria-label":"Share actions",children:[(0,s.jsx)("button",{type:"button",className:"pin-word","data-share-action":"copy",onClick:()=>{x()},children:u?"Copied":"Copy reference"}),p&&!t?(0,s.jsx)("button",{type:"button",className:"session-action session-share-revoke","data-share-action":"revoke",onClick:()=>l(!0),children:"Revoke"}):null]}),t?(0,s.jsxs)("div",{className:"session-share-confirm",role:"group","aria-label":"Confirm revoke",children:[(0,s.jsx)("p",{children:"Revoke this share? The next Slack question in its thread gets the revoked notice. This can’t be undone."}),(0,s.jsxs)("div",{className:"session-actions",children:[(0,s.jsx)("button",{type:"button",className:"session-action session-share-revoke","data-share-action":"confirm-revoke",disabled:i,onClick:()=>{g()},children:i?"Revoking…":"Revoke share"}),(0,s.jsx)("button",{type:"button",className:"pin-word",disabled:i,onClick:()=>l(!1),children:"Keep it"})]})]}):null,o?(0,s.jsx)("p",{className:"delete-error",role:"alert",children:o}):null]})}function p({row:e,policy:a,onCancel:t,onCreated:l}){let i={channel:(0,n.useId)(),duration:(0,n.useId)(),turns:(0,n.useId)()},[r,o]=(0,n.useState)(0),[c,h]=(0,n.useState)(a.limits.ttl_seconds.default),[m,x]=(0,n.useState)(String(a.limits.max_turns.default)),[g]=(0,n.useState)(u),[j,f]=(0,n.useState)(!1),[b,v]=(0,n.useState)(""),y=Number(m),N=Number.isInteger(y)&&y>=a.limits.max_turns.min&&y<=a.limits.max_turns.max,S=async s=>{if(s.preventDefault(),N){f(!0),v("");try{let s=await fetch(`/api/bots/${encodeURIComponent(e.agent.id)}/sessions/${encodeURIComponent(e.ref)}/shares`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify((0,d.shareCreateBody)(a.audiences[r],c,y,g))}),n=await s.json().catch(()=>null);s.ok?l():v("string"==typeof n?.error?.message?n.error.message:"The share could not be created.")}catch{v("The share could not be created.")}finally{f(!1)}}};return(0,s.jsxs)("form",{className:"session-share-form",onSubmit:e=>{S(e)},"aria-label":`Share ${e.title} to Slack`,children:[(0,s.jsxs)("p",{className:"session-share-note",children:["Shares ",(0,s.jsx)("strong",{children:e.title})," (",e.agent.name,") as a read-only Ask: Slack replies in the share’s thread ask exactly this session."]}),(0,s.jsx)("label",{htmlFor:i.channel,children:"Slack channel"}),(0,s.jsx)("select",{id:i.channel,value:r,onChange:e=>o(Number(e.target.value)),disabled:j,children:a.audiences.map((e,a)=>(0,s.jsx)("option",{value:a,children:(0,d.audienceLabel)(e)},`${e.team_id}:${e.channel_id}`))}),(0,s.jsx)("label",{htmlFor:i.duration,children:"Expires after"}),(0,s.jsx)("select",{id:i.duration,value:c,onChange:e=>h(Number(e.target.value)),disabled:j,children:d.SHARE_DURATIONS.map(e=>(0,s.jsx)("option",{value:e.seconds,children:e.label},e.seconds))}),(0,s.jsx)("label",{htmlFor:i.turns,children:"Questions allowed"}),(0,s.jsx)("input",{id:i.turns,type:"number",inputMode:"numeric",min:a.limits.max_turns.min,max:a.limits.max_turns.max,value:m,onChange:e=>x(e.target.value),disabled:j,"aria-invalid":!N}),N?null:(0,s.jsxs)("p",{className:"delete-error",children:["Questions allowed must be a whole number from ",a.limits.max_turns.min," to ",a.limits.max_turns.max,"."]}),b?(0,s.jsx)("p",{className:"delete-error",role:"alert",children:b}):null,(0,s.jsxs)("div",{className:"session-actions",children:[(0,s.jsx)("button",{type:"submit",className:"session-action","data-share-action":"submit",disabled:j||!N,children:j?"Sharing…":"Create share"}),(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:t,disabled:j,children:"Cancel"})]})]})}function x(e,s,a,n,t){let l=new URLSearchParams({status:s}),i=a.trim();return i&&l.set("q",i),n&&l.set("workspace",n),t&&l.set("cursor",t),`/api/bots/${encodeURIComponent(e)}/sessions?${l.toString()}`}function g({agentId:e,agentName:r,agentProvider:d,agents:u,origin:h,onExchangeStarted:m}){let p=(0,t.useRouter)(),b=(0,t.useSearchParams)().get("session"),[v,y]=(0,n.useState)("all"),[N,S]=(0,n.useState)(null),[k,w]=(0,n.useState)(null),[C,$]=(0,n.useState)(!1),[R,_]=(0,n.useState)(""),[I,A]=(0,n.useState)(""),[T,L]=(0,n.useState)(0),[U,E]=(0,n.useState)(""),[O,D]=(0,n.useState)(""),[F,P]=(0,n.useState)([]),[q,B]=(0,n.useState)(null),[M,H]=(0,n.useState)(!1),[K,V]=(0,n.useState)(""),[Q,J]=(0,n.useState)(null),[W,G]=(0,n.useState)(null),[Y,z]=(0,n.useState)(null),[X,Z]=(0,n.useState)(null),[ee,es]=(0,n.useState)("loading"),[ea,en]=(0,n.useState)(0),et=(0,n.useRef)(0),el=(0,n.useRef)(""),ei=(0,n.useRef)(""),er=(0,n.useRef)(null),eo=(0,n.useRef)(null),ec=(0,n.useRef)(null),ed=(0,n.useRef)(!1),eu=(0,n.useRef)(null),eh=d&&(0,i.agentLabel)(d)||void 0;(0,n.useEffect)(()=>{et.current+=1;let s=et.current,a=`${e}
|
|
2
|
-
${v}`,n=ei.current!==a;ei.current=a;let t=250*(U!==el.current);el.current=U;let l=!1,i=setTimeout(()=>{fetch(x(e,v,U,
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,49816,e=>{"use strict";var s=e.i(43476),a=e.i(22016),n=e.i(71645),t=e.i(18566),l=e.i(63352),i=e.i(3136),r=e.i(71836),o=e.i(50814);function c({mode:e,session:a,agents:t,origin:i,onClose:d,onStarted:u}){let h=(0,n.useId)(),m=(0,n.useId)(),p=(0,n.useId)(),x=(0,n.useId)(),[g,j]=(0,n.useState)(""),[f,b]=(0,n.useState)(""),[v,y]=(0,n.useState)(!1),[N,S]=(0,n.useState)({}),[k,w]=(0,n.useState)(""),[C,$]=(0,n.useState)(!1),R=(0,n.useRef)(!1),_=(0,n.useRef)(null),I=(0,n.useRef)(null),T=(0,n.useRef)(null),A=(0,n.useRef)(null),L=(0,n.useRef)(null),U=(0,o.sessionDialogUsesPin)(e,a.route),O=t.filter(e=>e.id!==a.agent.id);(0,n.useEffect)(()=>{("continue"===e?A.current:T.current)?.focus()},[e]),(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(e.stopPropagation(),d())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[d]);let E=async s=>{if(s.preventDefault(),R.current)return;let n={mode:"resume"===e?"ask":e,instruction:g,originConversationId:i.conversationId,destinationAgentId:f},t="resume"===e?(0,o.validateResumeDraft)(g,v):(0,o.validateDraft)(n);if(S(t),Object.keys(t).length>0)return void(t.destination?A.current?.focus():t.instruction?T.current?.focus():L.current?.focus());let l="resume"===e?"resume":"ask",r=e=>U?(0,o.pinRequestBody)(l,g,i.conversationId,v,e):(0,o.exchangeRequestBody)(n,{agentId:a.agent.id,sessionRef:a.ref},e),c=JSON.stringify(r(""));_.current&&_.current.payload===c||(_.current={payload:c,key:crypto.randomUUID()}),R.current=!0,$(!0),w("");try{let e=U?`/api/bots/${encodeURIComponent(a.agent.id)}/sessions/${encodeURIComponent(a.ref)}/pins`:"/api/exchanges",s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r(_.current.key))}),n=await s.json().catch(()=>null);if(!s.ok){let e="string"==typeof n?.error?.code?n.error.code:null;"idempotency_conflict"===e&&(_.current=null),w((0,o.submitErrorMessage)(e,"string"==typeof n?.error?.message?n.error.message:null));return}let t=U?n?.turn?.exchange_id:n?.exchange?.id;u("string"==typeof t?t:null)}catch{w((0,o.submitErrorMessage)(null,"Botmancers could not be reached. Your draft is kept; try again."))}finally{R.current=!1,$(!1)}},D=O.find(e=>e.id===f)?.name,F="ask"===e,P="resume"===e;return(0,s.jsx)("div",{className:"modal-scrim exchange-scrim",onMouseDown:e=>{e.target===e.currentTarget&&d()},onKeyDown:e=>{if("Tab"!==e.key||!I.current)return;let s=Array.from(I.current.querySelectorAll(r.DIALOG_FOCUSABLE)),a=(0,r.wrapFocusTarget)(s,document.activeElement,e.shiftKey);a&&(e.preventDefault(),a.focus())},children:(0,s.jsxs)("div",{ref:I,className:"form-card exchange-dialog",role:"dialog","aria-modal":"true","aria-labelledby":h,"data-exchange-mode":e,children:[(0,s.jsx)("h2",{id:h,className:"delete-title",children:(0,o.sessionDialogTitle)(e)}),(0,s.jsxs)("section",{className:"exchange-source","aria-label":"Source session",children:[(0,s.jsx)("p",{className:"exchange-source-agent",children:a.agent.name}),(0,s.jsx)("p",{className:"exchange-source-title",children:a.title}),(0,s.jsxs)("p",{className:"exchange-source-meta",children:["Last activity ",(0,l.formatSessionDate)(a.last_activity_at),a.origin.conversation?` \xb7 from ${a.origin.conversation.label}`:""]})]}),(0,s.jsxs)("form",{onSubmit:E,noValidate:!0,className:"exchange-form",children:[F||P?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("label",{htmlFor:p,children:"Hand off to"}),(0,s.jsxs)("select",{ref:A,id:p,className:"exchange-select",value:f,"aria-invalid":!!N.destination||void 0,"aria-describedby":N.destination?`${p}-error`:void 0,disabled:C,onChange:e=>{b(e.target.value),S(e=>({...e,destination:void 0}))},children:[(0,s.jsx)("option",{value:"",children:"Choose an agent"}),O.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]}),N.destination?(0,s.jsx)("p",{id:`${p}-error`,className:"exchange-field-error",children:N.destination}):null]}),(0,s.jsx)("label",{htmlFor:m,children:F?"Question":P?"Instruction":"Objective"}),(0,s.jsx)("textarea",{ref:T,id:m,rows:4,maxLength:o.INSTRUCTION_LIMIT,value:g,readOnly:C,"aria-invalid":!!N.instruction||void 0,"aria-describedby":`${m}-hint${N.instruction?` ${m}-error`:""}`,onChange:e=>{j(e.target.value),S(e=>({...e,instruction:void 0}))}}),N.instruction?(0,s.jsx)("p",{id:`${m}-error`,className:"exchange-field-error",children:N.instruction}):null,(0,s.jsx)("p",{id:`${m}-hint`,className:"exchange-hint",children:F?`${a.agent.name} answers from this exact session, read-only. The answer arrives in ${i.label}.`:P?`${a.agent.name} resumes work in this exact session and may edit its workspace. The turn never moves to another session. Progress shows in ${i.label}.`:`${D??"The agent you choose"} receives an extracted handoff (objective, decisions, constraints, references, open questions) and starts a new session of its own. ${a.agent.name}’s session is not shared and is not changed. Progress shows in ${i.label}.`}),P?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("label",{className:"exchange-approval",htmlFor:x,children:[(0,s.jsx)("input",{ref:L,id:x,type:"checkbox",checked:v,disabled:C,"aria-invalid":!!N.approval||void 0,"aria-describedby":N.approval?`${x}-error`:void 0,onChange:e=>{y(e.target.checked),S(e=>({...e,approval:void 0}))}})," ","I approve edits by ",a.agent.name," in this session"]}),N.approval?(0,s.jsx)("p",{id:`${x}-error`,className:"exchange-field-error",children:N.approval}):null]}):null,k?(0,s.jsx)("p",{className:"exchange-server-error",role:"alert",children:k}):null,(0,s.jsx)("p",{className:"exchange-sending",role:"status",children:C?"Sending…":""}),(0,s.jsxs)("div",{className:"form-actions",children:[(0,s.jsx)("button",{type:"button",className:"cancel-btn",onClick:d,children:"Cancel"}),(0,s.jsx)("button",{type:"submit",className:"create-btn",disabled:C,"aria-disabled":C,children:k?"Try again":"Send"})]})]})]})})}var d=e.i(24204);function u(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?`owner-share-${crypto.randomUUID()}`:`owner-share-${Date.now()}-${Math.random().toString(36).slice(2)}`}function h({row:e,shares:t,policy:l,onChanged:i}){let r=(0,n.useId)(),[o,c]=(0,n.useState)(!1),[u,x]=(0,n.useState)(!1),g=t?(0,d.sessionShares)(t,e.ref):[],j=g.filter(d.shareIsLive),f=g.filter(e=>!(0,d.shareIsLive)(e)),b="loading"===l,v="loading"===l?null:l,y=b?null:(0,d.shareCreateAvailability)(e,v),N=u?f:f.slice(0,3*!j.length);return(0,s.jsxs)("section",{className:"session-shares","aria-labelledby":r,"data-session-shares":e.ref,children:[(0,s.jsxs)("div",{className:"session-shares-head",children:[(0,s.jsx)("h3",{id:r,className:"session-shares-title",children:"Slack share"}),y?.available&&!o?(0,s.jsx)("button",{type:"button",className:"session-action","data-share-action":"create",onClick:()=>c(!0),children:"Share to Slack"}):null]}),b?(0,s.jsx)("p",{className:"session-share-note session-share-loading",role:"status",children:"Checking the share policy…"}):null,y&&!y.available?(0,s.jsxs)("p",{className:"session-share-unavailable",children:[y.reason," ",y.configHref?(0,s.jsx)(a.default,{className:"session-link",href:y.configHref,children:"Open Config"}):null]}):null,o&&v?(0,s.jsx)(p,{row:e,policy:v,onCancel:()=>c(!1),onCreated:()=>{c(!1),i()}}):null,null===t?(0,s.jsx)("p",{className:"session-share-note",role:"status",children:"Loading shares…"}):null,null===t||0!==g.length||o?null:(0,s.jsx)("p",{className:"session-share-note",children:"Not shared."}),j.length+N.length>0?(0,s.jsx)("ul",{className:"session-share-list","aria-label":`Slack shares of ${e.title}`,children:[...j,...N].map(e=>(0,s.jsx)(m,{share:e,onChanged:i},e.share_ref))}):null,f.length>N.length?(0,s.jsxs)("button",{type:"button",className:"pin-word",onClick:()=>x(!0),children:["Show ",f.length-N.length," ended share",f.length-N.length==1?"":"s"]}):null]})}function m({share:e,onChanged:a}){let[t,l]=(0,n.useState)(!1),[i,r]=(0,n.useState)(!1),[o,c]=(0,n.useState)(""),[u,h]=(0,n.useState)(!1),p=(0,d.shareIsLive)(e),x=async()=>{try{await navigator.clipboard.writeText(e.share_ref),h(!0)}catch{c("Copy failed. Select the reference instead.")}},g=async()=>{r(!0),c("");try{let s=await fetch(`/api/shares/${encodeURIComponent(e.share_ref)}/revoke`,{method:"POST"}),n=await s.json().catch(()=>null);s.ok?(l(!1),a()):c("string"==typeof n?.error?.message?n.error.message:"The share could not be revoked.")}catch{c("The share could not be revoked.")}finally{r(!1)}};return(0,s.jsxs)("li",{className:`session-share is-${e.status}`,"data-share-ref":e.share_ref,"data-share-status":e.status,children:[(0,s.jsxs)("div",{className:"session-share-head",children:[(0,s.jsx)("span",{className:`manage-tag session-share-status is-${e.status}`,children:d.SHARE_STATUS_LABELS[e.status]}),(0,s.jsx)("span",{className:"session-share-audience",children:(0,d.audienceLabel)(e.audience)})]}),(0,s.jsxs)("dl",{className:"manage-meta session-share-meta",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Expiry"}),(0,s.jsx)("dd",{children:(0,d.expiryLabel)(e)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Questions"}),(0,s.jsx)("dd",{children:(0,d.turnsLabel)(e)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Thread"}),(0,s.jsx)("dd",{children:(0,d.threadLabel)(e)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Reference"}),(0,s.jsx)("dd",{children:(0,s.jsx)("code",{className:"session-share-ref",children:e.share_ref})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Origin"}),(0,s.jsxs)("dd",{children:[(0,d.createdByLabel)(e)," · read-only Ask"]})]})]}),(0,s.jsx)("p",{className:"session-share-note",children:(0,d.shareStatusNote)(e)}),(0,s.jsxs)("div",{className:"session-actions",role:"group","aria-label":"Share actions",children:[(0,s.jsx)("button",{type:"button",className:"pin-word","data-share-action":"copy",onClick:()=>{x()},children:u?"Copied":"Copy reference"}),p&&!t?(0,s.jsx)("button",{type:"button",className:"session-action session-share-revoke","data-share-action":"revoke",onClick:()=>l(!0),children:"Revoke"}):null]}),t?(0,s.jsxs)("div",{className:"session-share-confirm",role:"group","aria-label":"Confirm revoke",children:[(0,s.jsx)("p",{children:"Revoke this share? The next Slack question in its thread gets the revoked notice. This can’t be undone."}),(0,s.jsxs)("div",{className:"session-actions",children:[(0,s.jsx)("button",{type:"button",className:"session-action session-share-revoke","data-share-action":"confirm-revoke",disabled:i,onClick:()=>{g()},children:i?"Revoking…":"Revoke share"}),(0,s.jsx)("button",{type:"button",className:"pin-word",disabled:i,onClick:()=>l(!1),children:"Keep it"})]})]}):null,o?(0,s.jsx)("p",{className:"delete-error",role:"alert",children:o}):null]})}function p({row:e,policy:a,onCancel:t,onCreated:l}){let i={channel:(0,n.useId)(),duration:(0,n.useId)(),turns:(0,n.useId)()},[r,o]=(0,n.useState)(0),[c,h]=(0,n.useState)(a.limits.ttl_seconds.default),[m,x]=(0,n.useState)(String(a.limits.max_turns.default)),[g]=(0,n.useState)(u),[j,f]=(0,n.useState)(!1),[b,v]=(0,n.useState)(""),y=Number(m),N=Number.isInteger(y)&&y>=a.limits.max_turns.min&&y<=a.limits.max_turns.max,S=async s=>{if(s.preventDefault(),N){f(!0),v("");try{let s=await fetch(`/api/bots/${encodeURIComponent(e.agent.id)}/sessions/${encodeURIComponent(e.ref)}/shares`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify((0,d.shareCreateBody)(a.audiences[r],c,y,g))}),n=await s.json().catch(()=>null);s.ok?l():v("string"==typeof n?.error?.message?n.error.message:"The share could not be created.")}catch{v("The share could not be created.")}finally{f(!1)}}};return(0,s.jsxs)("form",{className:"session-share-form",onSubmit:e=>{S(e)},"aria-label":`Share ${e.title} to Slack`,children:[(0,s.jsxs)("p",{className:"session-share-note",children:["Shares ",(0,s.jsx)("strong",{children:e.title})," (",e.agent.name,") as a read-only Ask: Slack replies in the share’s thread ask exactly this session."]}),(0,s.jsx)("label",{htmlFor:i.channel,children:"Slack channel"}),(0,s.jsx)("select",{id:i.channel,value:r,onChange:e=>o(Number(e.target.value)),disabled:j,children:a.audiences.map((e,a)=>(0,s.jsx)("option",{value:a,children:(0,d.audienceLabel)(e)},`${e.team_id}:${e.channel_id}`))}),(0,s.jsx)("label",{htmlFor:i.duration,children:"Expires after"}),(0,s.jsx)("select",{id:i.duration,value:c,onChange:e=>h(Number(e.target.value)),disabled:j,children:d.SHARE_DURATIONS.map(e=>(0,s.jsx)("option",{value:e.seconds,children:e.label},e.seconds))}),(0,s.jsx)("label",{htmlFor:i.turns,children:"Questions allowed"}),(0,s.jsx)("input",{id:i.turns,type:"number",inputMode:"numeric",min:a.limits.max_turns.min,max:a.limits.max_turns.max,value:m,onChange:e=>x(e.target.value),disabled:j,"aria-invalid":!N}),N?null:(0,s.jsxs)("p",{className:"delete-error",children:["Questions allowed must be a whole number from ",a.limits.max_turns.min," to ",a.limits.max_turns.max,"."]}),b?(0,s.jsx)("p",{className:"delete-error",role:"alert",children:b}):null,(0,s.jsxs)("div",{className:"session-actions",children:[(0,s.jsx)("button",{type:"submit",className:"session-action","data-share-action":"submit",disabled:j||!N,children:j?"Sharing…":"Create share"}),(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:t,disabled:j,children:"Cancel"})]})]})}function x(e,s,a,n,t){let l=new URLSearchParams({status:s}),i=a.trim();return i&&l.set("q",i),n&&l.set("workspace",n),t&&l.set("cursor",t),`/api/bots/${encodeURIComponent(e)}/sessions?${l.toString()}`}function g({agentId:e,agentName:r,agentProvider:d,agents:u,origin:h,onExchangeStarted:m}){let p=(0,t.useRouter)(),b=(0,t.useSearchParams)().get("session"),[v,y]=(0,n.useState)("all"),[N,S]=(0,n.useState)(null),[k,w]=(0,n.useState)(null),[C,$]=(0,n.useState)(!1),[R,_]=(0,n.useState)(""),[I,T]=(0,n.useState)(""),[A,L]=(0,n.useState)(0),[U,O]=(0,n.useState)(""),[E,D]=(0,n.useState)(""),[F,P]=(0,n.useState)([]),[q,B]=(0,n.useState)(null),[M,H]=(0,n.useState)(!1),[K,V]=(0,n.useState)(""),[Q,J]=(0,n.useState)(null),[W,G]=(0,n.useState)(null),[Y,z]=(0,n.useState)(null),[X,Z]=(0,n.useState)(null),[ee,es]=(0,n.useState)("loading"),[ea,en]=(0,n.useState)(0),et=(0,n.useRef)(0),el=(0,n.useRef)(""),ei=(0,n.useRef)(""),er=(0,n.useRef)(null),eo=(0,n.useRef)(null),ec=(0,n.useRef)(null),ed=(0,n.useRef)(!1),eu=(0,n.useRef)(null),eh=d&&(0,i.agentLabel)(d)||void 0;(0,n.useEffect)(()=>{et.current+=1;let s=et.current,a=`${e}
|
|
2
|
+
${v}`,n=ei.current!==a;ei.current=a;let t=250*(U!==el.current);el.current=U;let l=!1,i=setTimeout(()=>{fetch(x(e,v,U,E,null),{cache:"no-store"}).then(async a=>{let t=await a.json().catch(()=>null);if(l||et.current!==s)return;if(!a.ok||!Array.isArray(t?.sessions))return void T("string"==typeof t?.error?t.error:"Could not load sessions.");let i=t.sessions;S(i),w(t?.sync&&"object"==typeof t.sync?t.sync:null),B("string"==typeof t?.next_cursor?t.next_cursor:null),V(`${e}
|
|
3
3
|
${v}
|
|
4
4
|
${U.trim()}
|
|
5
|
-
${
|
|
5
|
+
${E}`),T("");let r=i.map(e=>e.context.workspace).filter(e=>!!e);P(e=>[...new Set([...n?[]:e,...r])])}).catch(()=>{l||et.current!==s||T("Could not load sessions.")})},t);return()=>{l=!0,clearTimeout(i)}},[e,v,U,E,A]),(0,n.useEffect)(()=>{if(!b||null===N)return;if(N.some(e=>e.ref===b)){eu.current!==b&&(eu.current=b,requestAnimationFrame(()=>requestAnimationFrame(()=>{document.querySelector(`[data-session-ref="${CSS.escape(b)}"]`)?.scrollIntoView({block:"nearest"})})));return}if("all"!==v||U.trim()||E)return;let s=!1;return fetch(`/api/bots/${encodeURIComponent(e)}/sessions/${encodeURIComponent(b)}`,{cache:"no-store"}).then(async e=>{let a=await e.json().catch(()=>null);if(s||!e.ok||!a?.session)return;let n=a.session;S(e=>!e||e.some(e=>e.ref===n.ref)?e:[n,...e])}).catch(()=>{}),()=>{s=!0}},[b,N,e,v,U,E]);let em=N?b&&N.some(e=>e.ref===b)?b:null:Q;em!==Q&&J(em),(0,n.useEffect)(()=>{!N||!b||N.some(e=>e.ref===b)||("all"!==v||U.trim()||E)&&p.replace(`/agents/${encodeURIComponent(e)}/sessions`,{scroll:!1})},[N,b,v,U,E,e,p]),(0,n.useEffect)(()=>{if(!Q){let e=eo.current;if(!e||ed.current)return;eo.current=null,e.isConnected&&e.focus();return}ed.current&&(ed.current=!1,ec.current?.focus())},[Q]);let ep=`${e}
|
|
6
6
|
${v}
|
|
7
7
|
${U.trim()}
|
|
8
|
-
${O}`,ep=null!==q&&K===em,ex=(0,n.useCallback)(async()=>{if(M||!N||!q||K!==em)return;H(!0);let s=et.current;try{let a=await fetch(x(e,v,U,O,q),{cache:"no-store"}),n=await a.json().catch(()=>null);if(et.current!==s)return;if(!a.ok||!Array.isArray(n?.sessions))return void A("Could not load more sessions.");let t=n.sessions,l=new Set(N.map(e=>e.ref));S([...N,...t.filter(e=>!l.has(e.ref))]),B("string"==typeof n?.next_cursor?n.next_cursor:null),A("");let i=t.map(e=>e.context.workspace).filter(e=>!!e);i.length&&P(e=>[...new Set([...e,...i])])}catch{et.current===s&&A("Could not load more sessions.")}finally{H(!1)}},[e,v,U,O,M,N,q,em,K]),eg=(0,n.useCallback)(async()=>{if(!C){$(!0),_("");try{let s=await fetch(`/api/bots/${encodeURIComponent(e)}/sessions/sync`,{method:"POST"}),a=await s.json().catch(()=>null);if(409===s.status)_("A sync is already running.");else if(s.ok){let e=Array.isArray(a?.imported)?a.imported.length:0,s=Array.isArray(a?.updated)?a.updated.length:0;_(`Synced: ${e} imported, ${s} updated.`)}else _("Could not sync sessions.")}catch{_("Could not sync sessions.")}finally{$(!1),L(e=>e+1)}}},[e,C]);(0,n.useEffect)(()=>{let s=!1,a=encodeURIComponent(e);return fetch(`/api/bots/${a}/share-policy`,{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{s||es(e?.policy??null)}).catch(()=>{s||es(null)}),fetch(`/api/shares?agent_id=${a}&limit=100`,{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{s||Z(Array.isArray(e?.shares)?e.shares:[])}).catch(()=>{s||Z([])}),()=>{s=!0}},[e,ea]),(0,n.useEffect)(()=>{let e=setInterval(()=>en(e=>e+1),15e3);return()=>clearInterval(e)},[]),(0,n.useEffect)(()=>{if(W||!er.current)return;let e=er.current;er.current=null,e.isConnected&&e.focus()},[W]);let ej=(e=v)=>{S(null),A(""),y(e),L(e=>e+1)},ef=""!==U.trim()||""!==O,eb=N?.find(e=>e.ref===Q)??null,ev=(s,a)=>{eo.current=a,ed.current=!0,p.replace(`/agents/${encodeURIComponent(e)}/sessions?session=${encodeURIComponent(s.ref)}`,{scroll:!1})},ey=()=>{er.current=W?.returnTo??null,G(null)};return(0,s.jsxs)("div",{className:"agent-sessions-page","data-agent-sessions-page":!0,children:[(0,s.jsxs)("header",{className:"agent-sessions-head",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"agent-eyebrow",children:"Sessions"}),(0,s.jsxs)("h2",{children:["Review ",r,"’s work"]}),(0,s.jsx)("p",{children:"Scan runtime sessions, then open one for actions and operational detail."})]}),(0,s.jsxs)("div",{className:"agent-sessions-sync",children:[(0,s.jsxs)("span",{children:["Last synced ",(0,l.formatSyncRelativeTime)(k?.synced_at??null)]}),(0,s.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{eg()},disabled:C,children:C?"Refreshing…":"Refresh"})]})]}),(0,s.jsxs)("div",{className:"sessions-filter",role:"group","aria-label":"Filter sessions",children:[(0,s.jsx)("div",{className:"sessions-status-filter",role:"group","aria-label":"Show sessions",children:l.SESSION_FILTER_OPTIONS.map(e=>(0,s.jsx)("button",{type:"button",className:"sessions-filter-btn","aria-pressed":v===e.value,onClick:()=>{v!==e.value&&ej(e.value)},children:e.label},e.value))}),(0,s.jsx)("input",{type:"search",className:"sessions-search","aria-label":"Search sessions by title",placeholder:"Search by title",value:U,onChange:e=>E(e.target.value)}),(0,s.jsxs)("select",{className:"sessions-workspace","aria-label":"Filter sessions by workspace",value:O,onChange:e=>D(e.target.value),children:[(0,s.jsx)("option",{value:"",children:"All workspaces"}),(0,l.workspaceOptions)(F).map(e=>(0,s.jsx)("option",{value:e.value,title:e.value,children:e.label},e.value))]}),(0,s.jsx)("span",{className:"manage-count","aria-live":"polite",children:N?`${N.length} shown`:""})]}),(0,s.jsx)("div",{className:"exchange-started",role:"status",children:R}),(0,s.jsx)("div",{className:"exchange-started",role:"status",children:Y?(0,s.jsxs)(s.Fragment,{children:[Y.text," ",Y.id?(0,s.jsx)(a.default,{className:"session-link",href:(0,o.detailsHref)(Y.id),children:"View in Exchanges"}):null]}):null}),(0,s.jsxs)("div",{className:`sessions-review${eb?" has-detail":""}`,inert:!!W,children:[(0,s.jsxs)("section",{className:"sessions-list-pane","aria-labelledby":"sessions-list-title",children:[(0,s.jsx)("h3",{id:"sessions-list-title",className:"session-sr",children:"Session list"}),I?(0,s.jsxs)("div",{className:"sessions-state",role:"alert",children:[(0,s.jsx)("p",{className:"delete-error",children:I}),(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:()=>ej(),children:"Retry"})]}):null,N||I?null:(0,s.jsx)("p",{className:"delete-copy sessions-state",role:"status",children:"Loading sessions…"}),N?(0,s.jsxs)("ul",{className:"sessions-list","aria-label":`Sessions for ${r}`,children:[0===N.length?(0,s.jsx)("li",{className:"delete-copy sessions-state",children:ef?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:(0,l.noMatchingSessionsCopy)(U,O||null)}),(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{E(""),D("")},children:"Clear search"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:(0,l.emptySessionsCopy)(v,r,k,eh)}),"all"===v&&k?.last_error_code?(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{eg()},disabled:C,children:C?"Retrying…":"Retry"}):null,"all"===v&&!k?.last_error_code&&(k?.out_of_scope_count??0)>0?(0,s.jsx)(a.default,{className:"session-link",href:`/agents/${encodeURIComponent(e)}/config`,children:"Widen the scope in Config"}):null]})}):null,N.map(e=>(0,s.jsx)(j,{row:e,selected:Q===e.ref,onSelect:ev},e.ref))]}):null,N&&N.length>0&&ep?(0,s.jsx)("div",{className:"sessions-more",children:(0,s.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{ex()},disabled:M,children:M?"Loading…":"Load more"})}):null]}),(0,s.jsx)("section",{className:"sessions-detail-pane","aria-label":"Session detail",children:eb?(0,s.jsx)(f,{row:eb,agentId:e,headingRef:ec,origin:h,agents:u,shares:X,sharePolicy:ee,onClose:()=>{ed.current=!1,p.replace(`/agents/${encodeURIComponent(e)}/sessions`,{scroll:!1})},onAction:(e,s)=>{z(null),G({mode:e,row:eb,returnTo:s})},onSharesChanged:()=>en(e=>e+1)},eb.ref):(0,s.jsxs)("div",{className:"sessions-detail-empty",children:[(0,s.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,s.jsx)("h3",{children:"Select a session"}),(0,s.jsx)("p",{children:"Actions, usage, origin, shares, and debug detail appear here."})]})})]}),W&&h?(0,s.jsx)(c,{mode:W.mode,session:W.row,agents:u,origin:h,onClose:ey,onStarted:e=>{z({id:e,text:"ask"===W.mode?`Asked ${W.row.agent.name}’s session. The answer arrives in ${h.label}.`:"resume"===W.mode?`Resumed work in ${W.row.agent.name}’s session. Progress shows in ${h.label}.`:`Handoff started from ${W.row.agent.name}’s session. Progress shows in ${h.label}.`}),ey(),m?.(e)}}):null]})}function j({row:e,selected:a,onSelect:n}){let t=(0,o.sessionRowActions)(e).filter(e=>e.availability.available).length,i=(0,l.workspaceFolderName)(e.context.workspace),r=(0,l.sessionOriginChips)(e),c=(0,l.sessionStateTags)(e);return(0,s.jsx)("li",{className:`session-scan-row is-${e.status}${a?" is-selected":""}`,"data-session-ref":e.ref,children:(0,s.jsxs)("button",{type:"button",className:"session-scan-button","aria-current":a?"true":void 0,onClick:s=>n(e,s.currentTarget),children:[(0,s.jsxs)("span",{className:"session-scan-title-line",children:[(0,s.jsx)("strong",{className:"session-title",children:e.title}),(0,s.jsx)("span",{className:`manage-tag session-status is-${e.status}`,children:(0,l.statusLabel)(e)})]}),(0,s.jsxs)("span",{className:"session-scan-context",children:[(0,s.jsx)("span",{className:"session-activity",children:(0,l.formatSessionDate)(e.last_activity_at)}),i?(0,s.jsx)("span",{className:"session-workspace",title:e.context.workspace??void 0,children:i}):null]}),r.length||c.length?(0,s.jsxs)("span",{className:"session-scan-chips",children:[r.map(e=>(0,s.jsx)("span",{className:"session-origin-chip",children:e},e)),c.map(e=>(0,s.jsx)("span",{className:`manage-tag session-state-tag is-${e.toLowerCase()}`,children:e},e))]}):null,(0,s.jsx)("span",{className:`session-attention${t?" is-actionable":""}`,children:t?`${t} action${1===t?"":"s"} available`:"Review details"})]})})}function f({row:e,agentId:t,headingRef:i,origin:r,agents:c,shares:d,sharePolicy:u,onClose:m,onAction:p,onSharesChanged:x}){let g,[j,b]=(0,n.useState)(null),[y,N]=(0,n.useState)(null),[S,k]=(0,n.useState)(""),[w,C]=(0,n.useState)(null),[$,R]=(0,n.useState)(""),[_,I]=(0,n.useState)(!1),A=`/api/bots/${encodeURIComponent(t)}/sessions/${encodeURIComponent(e.ref)}`,T=(0,o.sessionRowActions)(e),L=T.filter(e=>e.availability.available),U=T.filter(e=>!e.availability.available),E=e.origin.conversation,O=(g=e.origin.conversation)?g.thread_agent_id?`/agents/${encodeURIComponent(g.thread_agent_id)}/conversations`:"group"===g.kind?`/threads/${encodeURIComponent(g.id)}`:null:null,D=(0,l.workRequestLabel)(e),F=(0,l.sessionUsageLine)(e.usage);(0,n.useEffect)(()=>{let e=!1;return fetch(A,{cache:"no-store"}).then(async s=>{let a=await s.json().catch(()=>null);e||(s.ok&&Array.isArray(a?.session?.attempts)?(b(a.session.attempts),N({totals:a.session.usage,samples:Array.isArray(a.session.usage_samples)?a.session.usage_samples:[]})):k("Could not load session details."))}).catch(()=>{e||k("Could not load session details.")}),()=>{e=!0}},[A]);let P=(0,n.useCallback)(async()=>{if(null===w)try{let e=await fetch(`${A}?debug=external_session_id`,{cache:"no-store"}),s=await e.json().catch(()=>null),a=s?.debug?.external_session_id;e.ok&&"string"==typeof a?C(a):R("Not available.")}catch{R("Not available.")}},[A,w]),q=async()=>{if(w)try{await navigator.clipboard.writeText(w),I(!0)}catch{I(!1)}};return(0,s.jsxs)("article",{className:"session-detail","data-session-detail":e.ref,children:[(0,s.jsxs)("div",{className:"session-detail-head",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,s.jsx)("h3",{ref:i,tabIndex:-1,children:e.title})]}),(0,s.jsx)("button",{type:"button",className:"pin-word session-detail-close",onClick:m,children:"Back to session list"})]}),(0,s.jsxs)("div",{className:"session-detail-tags",children:[(0,s.jsx)("span",{className:`manage-tag session-status is-${e.status}`,children:(0,l.statusLabel)(e)}),(0,l.sessionStateTags)(e).map(e=>(0,s.jsx)("span",{className:`manage-tag session-state-tag is-${e.toLowerCase()}`,children:e},e))]}),(0,s.jsxs)("dl",{className:"session-detail-meta",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Last activity"}),(0,s.jsx)("dd",{children:(0,l.formatSessionDate)(e.last_activity_at)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Started"}),(0,s.jsx)("dd",{children:(0,l.formatSessionDate)(e.created_at)})]}),null!==e.ended_at?(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Ended"}),(0,s.jsx)("dd",{children:(0,l.formatSessionDate)(e.ended_at)})]}):null,(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Runtime"}),(0,s.jsx)("dd",{children:(0,l.runtimeLabel)(e)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Reported usage"}),(0,s.jsxs)("dd",{children:[(0,s.jsx)("span",{className:`session-usage is-${F.quality}`,"aria-hidden":"true",children:F.text}),(0,s.jsx)("span",{className:"session-sr",children:F.label}),F.partial?(0,s.jsx)("span",{className:"manage-tag session-usage-tag",children:"Partial"}):null]})]}),e.context.workspace?(0,s.jsxs)("div",{className:"is-wide",children:[(0,s.jsx)("dt",{children:"Workspace"}),(0,s.jsx)("dd",{children:e.context.workspace})]}):null,(0,s.jsxs)("div",{className:"is-wide",children:[(0,s.jsx)("dt",{children:"Origin"}),(0,s.jsx)("dd",{children:O&&E?(0,s.jsx)(a.default,{className:"session-link",href:O,children:E.label}):E?.label??"Not recorded"})]}),D?(0,s.jsxs)("div",{className:"is-wide",children:[(0,s.jsx)("dt",{children:"Work request"}),(0,s.jsx)("dd",{children:D})]}):null]}),(0,s.jsxs)("section",{className:"session-detail-section","aria-labelledby":`actions-${e.ref}`,children:[(0,s.jsx)("h4",{id:`actions-${e.ref}`,children:"Actions"}),r&&L.length?(0,s.jsx)("div",{className:"session-actions",role:"group","aria-label":`Actions for ${e.title}`,children:L.map(e=>(0,s.jsx)("button",{type:"button",className:"session-action","data-session-action":e.action,"aria-haspopup":"dialog",onClick:s=>p((0,o.sessionDialogMode)(e.action),s.currentTarget),children:e.label},e.action))}):null,!r&&L.length?(0,s.jsx)("p",{className:"session-unavailable",children:"Open this Agent’s Conversation before starting an action."}):null,U.length?(0,s.jsx)("ul",{className:"session-unavailable","aria-label":`Unavailable actions for ${e.title}`,children:U.map(e=>(0,s.jsxs)("li",{children:[(0,s.jsxs)("strong",{children:[e.label,":"]})," ",e.availability.available?"":e.availability.reason]},e.action))}):null]}),(0,s.jsx)("section",{className:"session-detail-section",children:(0,s.jsx)(h,{row:e,shares:d,policy:u,onChanged:x})}),(0,s.jsxs)("section",{className:"session-detail-section","aria-labelledby":`runs-${e.ref}`,children:[(0,s.jsx)("h4",{id:`runs-${e.ref}`,children:"Runs and usage"}),S?(0,s.jsx)("p",{className:"delete-error",role:"alert",children:S}):null,j||S?null:(0,s.jsx)("p",{className:"delete-copy",role:"status",children:"Loading details…"}),j?(0,s.jsxs)("ol",{className:"session-attempts","aria-label":"Runs in this session",children:[0===j.length?(0,s.jsx)("li",{children:"No recorded runs."}):null,j.map(e=>(0,s.jsxs)("li",{children:[(0,l.formatSessionDate)(e.started_at)," · ",(0,l.attemptLabel)(e)]},`${e.request_id}-${e.attempt_number}`))]}):null,y?(0,s.jsx)(v,{totals:y.totals,samples:y.samples}):null]}),(0,s.jsxs)("details",{className:"session-debug session-detail-section",onToggle:e=>{e.currentTarget.open&&P()},children:[(0,s.jsx)("summary",{children:"Local debug: provider session ID"}),(0,s.jsx)("p",{className:"session-debug-note",children:"For local troubleshooting only. Botmancers resumes sessions for you; you never need to copy this."}),$?(0,s.jsx)("p",{className:"delete-error",children:$}):null,w?(0,s.jsxs)("div",{className:"session-debug-value",children:[(0,s.jsx)("code",{children:w}),(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{q()},children:_?"Copied":"Copy"})]}):null]})]})}let b=["input_tokens","output_tokens","cost_usd"];function v({totals:e,samples:a}){let t=(0,n.useId)();return(0,s.jsxs)("section",{className:"session-usage-detail","aria-labelledby":t,children:[(0,s.jsx)("h5",{id:t,className:"session-usage-head",children:"Reported usage"}),(0,s.jsx)("dl",{className:"session-usage-totals",children:b.map(a=>{let n=(0,l.usageMetricView)(a,e?.[a],!0);return(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:n.name}),(0,s.jsxs)("dd",{children:[(0,s.jsx)("span",{className:`session-usage is-${n.quality}`,"aria-hidden":"true",children:n.text}),(0,s.jsxs)("span",{className:"session-sr",children:[n.label,"."]}),(0,s.jsx)("span",{className:`session-usage-coverage is-${n.quality}`,children:n.coverage})]})]},a)})}),0===a.length?(0,s.jsx)("p",{className:"session-usage-none",children:"No run in this session reported usage."}):(0,s.jsx)("ol",{className:"session-usage-runs","aria-label":"Reported usage by run",children:a.map((e,a)=>{let n=(0,l.usageSampleValues)(e);return(0,s.jsxs)("li",{children:[(0,s.jsxs)("span",{className:"session-usage-run",children:[(0,l.formatSessionDate)(e.observed_at)," · ",(0,l.usageSampleLabel)(e,a)]}),(0,s.jsxs)("span",{className:"session-usage-values",children:[(0,s.jsxs)("span",{className:null===e.input_tokens?"is-unavailable":void 0,children:["In ",n.input]}),(0,s.jsxs)("span",{className:null===e.output_tokens?"is-unavailable":void 0,children:["Out ",n.output]}),(0,s.jsxs)("span",{className:null===e.cost_usd?"is-unavailable":void 0,children:["Cost ",n.cost]})]})]},`${e.observed_at}-${a}`)})})]})}var y=e.i(70925);e.s(["default",0,function(){let{id:e,agents:n,overview:t,loading:l,error:i,notFound:r}=(0,y.useAgentOverview)();return l?(0,s.jsx)("div",{className:"agent-state",role:"status",children:"Loading sessions…"}):r?(0,s.jsxs)("div",{className:"agent-state",children:[(0,s.jsx)("h2",{children:"Agent not found"}),(0,s.jsx)(a.default,{href:"/",children:"Choose an Agent"})]}):i||!t?(0,s.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,s.jsx)("h2",{children:"Sessions unavailable"}),(0,s.jsx)("p",{children:"Botmancers could not load this Agent. Refresh to try again."})]}):(0,s.jsx)(g,{agentId:e,agentName:t.agent.name,agentProvider:t.runtime.agent,agents:n.map(e=>({id:e.id,name:e.name})),origin:t.conversation?{conversationId:t.conversation.id,label:`${t.agent.name} conversation`}:null})}],49816)}]);
|
|
8
|
+
${E}`,ex=null!==q&&K===ep,eg=(0,n.useCallback)(async()=>{if(M||!N||!q||K!==ep)return;H(!0);let s=et.current;try{let a=await fetch(x(e,v,U,E,q),{cache:"no-store"}),n=await a.json().catch(()=>null);if(et.current!==s)return;if(!a.ok||!Array.isArray(n?.sessions))return void T("Could not load more sessions.");let t=n.sessions,l=new Set(N.map(e=>e.ref));S([...N,...t.filter(e=>!l.has(e.ref))]),B("string"==typeof n?.next_cursor?n.next_cursor:null),T("");let i=t.map(e=>e.context.workspace).filter(e=>!!e);i.length&&P(e=>[...new Set([...e,...i])])}catch{et.current===s&&T("Could not load more sessions.")}finally{H(!1)}},[e,v,U,E,M,N,q,ep,K]),ej=(0,n.useCallback)(async()=>{if(!C){$(!0),_("");try{let s=await fetch(`/api/bots/${encodeURIComponent(e)}/sessions/sync`,{method:"POST"}),a=await s.json().catch(()=>null);if(409===s.status)_("A sync is already running.");else if(s.ok){let e=Array.isArray(a?.imported)?a.imported.length:0,s=Array.isArray(a?.updated)?a.updated.length:0;_(`Synced: ${e} imported, ${s} updated.`)}else _("Could not sync sessions.")}catch{_("Could not sync sessions.")}finally{$(!1),L(e=>e+1)}}},[e,C]);(0,n.useEffect)(()=>{let s=!1,a=encodeURIComponent(e);return fetch(`/api/bots/${a}/share-policy`,{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{s||es(e?.policy??null)}).catch(()=>{s||es(null)}),fetch(`/api/shares?agent_id=${a}&limit=100`,{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{s||Z(Array.isArray(e?.shares)?e.shares:[])}).catch(()=>{s||Z([])}),()=>{s=!0}},[e,ea]),(0,n.useEffect)(()=>{let e=setInterval(()=>en(e=>e+1),15e3);return()=>clearInterval(e)},[]),(0,n.useEffect)(()=>{if(W||!er.current)return;let e=er.current;er.current=null,e.isConnected&&e.focus()},[W]);let ef=(e=v)=>{S(null),T(""),y(e),L(e=>e+1)},eb=""!==U.trim()||""!==E,ev=N?.find(e=>e.ref===Q)??null,ey=(s,a)=>{eo.current=a,ed.current=!0,p.replace(`/agents/${encodeURIComponent(e)}/sessions?session=${encodeURIComponent(s.ref)}`,{scroll:!1})},eN=()=>{er.current=W?.returnTo??null,G(null)};return(0,s.jsxs)("div",{className:"agent-sessions-page","data-agent-sessions-page":!0,children:[(0,s.jsxs)("header",{className:"agent-sessions-head",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"agent-eyebrow",children:"Sessions"}),(0,s.jsxs)("h2",{children:["Review ",r,"’s work"]}),(0,s.jsx)("p",{children:"Scan runtime sessions, then open one for actions and operational detail."})]}),(0,s.jsxs)("div",{className:"agent-sessions-sync",children:[(0,s.jsxs)("span",{children:["Last synced ",(0,l.formatSyncRelativeTime)(k?.synced_at??null)]}),(0,s.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{ej()},disabled:C,children:C?"Refreshing…":"Refresh"})]})]}),(0,s.jsxs)("div",{className:"sessions-filter",role:"group","aria-label":"Filter sessions",children:[(0,s.jsx)("div",{className:"sessions-status-filter",role:"group","aria-label":"Show sessions",children:l.SESSION_FILTER_OPTIONS.map(e=>(0,s.jsx)("button",{type:"button",className:"sessions-filter-btn","aria-pressed":v===e.value,onClick:()=>{v!==e.value&&ef(e.value)},children:e.label},e.value))}),(0,s.jsx)("input",{type:"search",className:"sessions-search","aria-label":"Search sessions by title",placeholder:"Search by title",value:U,onChange:e=>O(e.target.value)}),(0,s.jsxs)("select",{className:"sessions-workspace","aria-label":"Filter sessions by workspace",value:E,onChange:e=>D(e.target.value),children:[(0,s.jsx)("option",{value:"",children:"All workspaces"}),(0,l.workspaceOptions)(F).map(e=>(0,s.jsx)("option",{value:e.value,title:e.value,children:e.label},e.value))]}),(0,s.jsx)("span",{className:"manage-count","aria-live":"polite",children:N?`${N.length} shown`:""})]}),(0,s.jsx)("div",{className:"exchange-started",role:"status",children:R}),(0,s.jsx)("div",{className:"exchange-started",role:"status",children:Y?(0,s.jsxs)(s.Fragment,{children:[Y.text," ",Y.id?(0,s.jsx)(a.default,{className:"session-link",href:(0,o.detailsHref)(Y.id),children:"View in Exchanges"}):null]}):null}),(0,s.jsxs)("div",{className:`sessions-review${ev?" has-detail":""}`,inert:!!W,children:[(0,s.jsxs)("section",{className:"sessions-list-pane","aria-labelledby":"sessions-list-title",children:[(0,s.jsx)("h3",{id:"sessions-list-title",className:"session-sr",children:"Session list"}),I?(0,s.jsxs)("div",{className:"sessions-state",role:"alert",children:[(0,s.jsx)("p",{className:"delete-error",children:I}),(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:()=>ef(),children:"Retry"})]}):null,N||I?null:(0,s.jsx)("p",{className:"delete-copy sessions-state",role:"status",children:"Loading sessions…"}),N?(0,s.jsxs)("ul",{className:"sessions-list","aria-label":`Sessions for ${r}`,children:[0===N.length?(0,s.jsx)("li",{className:"delete-copy sessions-state",children:eb?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:(0,l.noMatchingSessionsCopy)(U,E||null)}),(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{O(""),D("")},children:"Clear search"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:(0,l.emptySessionsCopy)(v,r,k,eh)}),"all"===v&&k?.last_error_code?(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{ej()},disabled:C,children:C?"Retrying…":"Retry"}):null,"all"===v&&!k?.last_error_code&&(k?.out_of_scope_count??0)>0?(0,s.jsx)(a.default,{className:"session-link",href:`/agents/${encodeURIComponent(e)}/config`,children:"Widen the scope in Config"}):null]})}):null,N.map(e=>(0,s.jsx)(j,{row:e,selected:Q===e.ref,onSelect:ey},e.ref))]}):null,N&&N.length>0&&ex?(0,s.jsx)("div",{className:"sessions-more",children:(0,s.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{eg()},disabled:M,children:M?"Loading…":"Load more"})}):null]}),(0,s.jsx)("section",{className:"sessions-detail-pane","aria-label":"Session detail",children:ev?(0,s.jsx)(f,{row:ev,agentId:e,headingRef:ec,origin:h,agents:u,shares:X,sharePolicy:ee,onClose:()=>{ed.current=!1,p.replace(`/agents/${encodeURIComponent(e)}/sessions`,{scroll:!1})},onAction:(e,s)=>{z(null),G({mode:e,row:ev,returnTo:s})},onSharesChanged:()=>en(e=>e+1)},ev.ref):(0,s.jsxs)("div",{className:"sessions-detail-empty",children:[(0,s.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,s.jsx)("h3",{children:"Select a session"}),(0,s.jsx)("p",{children:"Actions, usage, origin, shares, and debug detail appear here."})]})})]}),W&&h?(0,s.jsx)(c,{mode:W.mode,session:W.row,agents:u,origin:h,onClose:eN,onStarted:e=>{z({id:e,text:"ask"===W.mode?`Asked ${W.row.agent.name}’s session. The answer arrives in ${h.label}.`:"resume"===W.mode?`Resumed work in ${W.row.agent.name}’s session. Progress shows in ${h.label}.`:`Handoff started from ${W.row.agent.name}’s session. Progress shows in ${h.label}.`}),eN(),m?.(e)}}):null]})}function j({row:e,selected:a,onSelect:n}){let t=(0,o.sessionRowActions)(e).filter(e=>e.availability.available).length,i=(0,l.workspaceFolderName)(e.context.workspace),r=(0,l.sessionOriginChips)(e),c=(0,l.sessionStateTags)(e);return(0,s.jsx)("li",{className:`session-scan-row is-${e.status}${a?" is-selected":""}`,"data-session-ref":e.ref,children:(0,s.jsxs)("button",{type:"button",className:"session-scan-button","aria-current":a?"true":void 0,onClick:s=>n(e,s.currentTarget),children:[(0,s.jsxs)("span",{className:"session-scan-title-line",children:[(0,s.jsx)("strong",{className:"session-title",children:e.title}),(0,s.jsx)("span",{className:`manage-tag session-status is-${e.status}`,children:(0,l.statusLabel)(e)})]}),(0,s.jsxs)("span",{className:"session-scan-context",children:[(0,s.jsx)("span",{className:"session-activity",children:(0,l.formatSessionDate)(e.last_activity_at)}),i?(0,s.jsx)("span",{className:"session-workspace",title:e.context.workspace??void 0,children:i}):null]}),r.length||c.length?(0,s.jsxs)("span",{className:"session-scan-chips",children:[r.map(e=>(0,s.jsx)("span",{className:"session-origin-chip",children:e},e)),c.map(e=>(0,s.jsx)("span",{className:`manage-tag session-state-tag is-${e.toLowerCase()}`,children:e},e))]}):null,(0,s.jsx)("span",{className:`session-attention${t?" is-actionable":""}`,children:t?`${t} action${1===t?"":"s"} available`:"Review details"})]})})}function f({row:e,agentId:t,headingRef:i,origin:r,agents:c,shares:d,sharePolicy:u,onClose:m,onAction:p,onSharesChanged:x}){let g,[j,b]=(0,n.useState)(null),[y,N]=(0,n.useState)(null),[S,k]=(0,n.useState)(""),[w,C]=(0,n.useState)(null),[$,R]=(0,n.useState)(""),[_,I]=(0,n.useState)(!1),T=`/api/bots/${encodeURIComponent(t)}/sessions/${encodeURIComponent(e.ref)}`,A=(0,o.sessionRowActions)(e),L=A.filter(e=>e.availability.available),U=A.filter(e=>!e.availability.available),O=e.origin.conversation,E=(g=e.origin.conversation)?(0,l.sessionConversationHref)(g):null,D=(0,l.workRequestLabel)(e),F=(0,l.sessionUsageLine)(e.usage);(0,n.useEffect)(()=>{let e=!1;return fetch(T,{cache:"no-store"}).then(async s=>{let a=await s.json().catch(()=>null);e||(s.ok&&Array.isArray(a?.session?.attempts)?(b(a.session.attempts),N({totals:a.session.usage,samples:Array.isArray(a.session.usage_samples)?a.session.usage_samples:[]})):k("Could not load session details."))}).catch(()=>{e||k("Could not load session details.")}),()=>{e=!0}},[T]);let P=(0,n.useCallback)(async()=>{if(null===w)try{let e=await fetch(`${T}?debug=external_session_id`,{cache:"no-store"}),s=await e.json().catch(()=>null),a=s?.debug?.external_session_id;e.ok&&"string"==typeof a?C(a):R("Not available.")}catch{R("Not available.")}},[T,w]),q=async()=>{if(w)try{await navigator.clipboard.writeText(w),I(!0)}catch{I(!1)}};return(0,s.jsxs)("article",{className:"session-detail","data-session-detail":e.ref,children:[(0,s.jsxs)("div",{className:"session-detail-head",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,s.jsx)("h3",{ref:i,tabIndex:-1,children:e.title})]}),(0,s.jsx)("button",{type:"button",className:"pin-word session-detail-close",onClick:m,children:"Back to session list"})]}),(0,s.jsxs)("div",{className:"session-detail-tags",children:[(0,s.jsx)("span",{className:`manage-tag session-status is-${e.status}`,children:(0,l.statusLabel)(e)}),(0,l.sessionStateTags)(e).map(e=>(0,s.jsx)("span",{className:`manage-tag session-state-tag is-${e.toLowerCase()}`,children:e},e))]}),(0,s.jsxs)("dl",{className:"session-detail-meta",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Last activity"}),(0,s.jsx)("dd",{children:(0,l.formatSessionDate)(e.last_activity_at)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Started"}),(0,s.jsx)("dd",{children:(0,l.formatSessionDate)(e.created_at)})]}),null!==e.ended_at?(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Ended"}),(0,s.jsx)("dd",{children:(0,l.formatSessionDate)(e.ended_at)})]}):null,(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Runtime"}),(0,s.jsx)("dd",{children:(0,l.runtimeLabel)(e)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Reported usage"}),(0,s.jsxs)("dd",{children:[(0,s.jsx)("span",{className:`session-usage is-${F.quality}`,"aria-hidden":"true",children:F.text}),(0,s.jsx)("span",{className:"session-sr",children:F.label}),F.partial?(0,s.jsx)("span",{className:"manage-tag session-usage-tag",children:"Partial"}):null]})]}),e.context.workspace?(0,s.jsxs)("div",{className:"is-wide",children:[(0,s.jsx)("dt",{children:"Workspace"}),(0,s.jsx)("dd",{children:e.context.workspace})]}):null,(0,s.jsxs)("div",{className:"is-wide",children:[(0,s.jsx)("dt",{children:"Origin"}),(0,s.jsx)("dd",{children:E&&O?(0,s.jsx)(a.default,{className:"session-link",href:E,children:O.label}):O?.label??"Not recorded"})]}),D?(0,s.jsxs)("div",{className:"is-wide",children:[(0,s.jsx)("dt",{children:"Work request"}),(0,s.jsx)("dd",{children:D})]}):null]}),(0,s.jsxs)("section",{className:"session-detail-section","aria-labelledby":`actions-${e.ref}`,children:[(0,s.jsx)("h4",{id:`actions-${e.ref}`,children:"Actions"}),r&&L.length?(0,s.jsx)("div",{className:"session-actions",role:"group","aria-label":`Actions for ${e.title}`,children:L.map(e=>(0,s.jsx)("button",{type:"button",className:"session-action","data-session-action":e.action,"aria-haspopup":"dialog",onClick:s=>p((0,o.sessionDialogMode)(e.action),s.currentTarget),children:e.label},e.action))}):null,!r&&L.length?(0,s.jsx)("p",{className:"session-unavailable",children:"Open this agent’s Conversation before starting an action."}):null,U.length?(0,s.jsx)("ul",{className:"session-unavailable","aria-label":`Unavailable actions for ${e.title}`,children:U.map(e=>(0,s.jsxs)("li",{children:[(0,s.jsxs)("strong",{children:[e.label,":"]})," ",e.availability.available?"":e.availability.reason]},e.action))}):null]}),(0,s.jsx)("section",{className:"session-detail-section",children:(0,s.jsx)(h,{row:e,shares:d,policy:u,onChanged:x})}),(0,s.jsxs)("section",{className:"session-detail-section","aria-labelledby":`runs-${e.ref}`,children:[(0,s.jsx)("h4",{id:`runs-${e.ref}`,children:"Runs and usage"}),S?(0,s.jsx)("p",{className:"delete-error",role:"alert",children:S}):null,j||S?null:(0,s.jsx)("p",{className:"delete-copy",role:"status",children:"Loading details…"}),j?(0,s.jsxs)("ol",{className:"session-attempts","aria-label":"Runs in this session",children:[0===j.length?(0,s.jsx)("li",{children:"No recorded runs."}):null,j.map(e=>(0,s.jsxs)("li",{children:[(0,l.formatSessionDate)(e.started_at)," · ",(0,l.attemptLabel)(e)]},`${e.request_id}-${e.attempt_number}`))]}):null,y?(0,s.jsx)(v,{totals:y.totals,samples:y.samples}):null]}),(0,s.jsxs)("details",{className:"session-debug session-detail-section",onToggle:e=>{e.currentTarget.open&&P()},children:[(0,s.jsx)("summary",{children:"Local debug: provider session ID"}),(0,s.jsx)("p",{className:"session-debug-note",children:"For local troubleshooting only. Botmancers resumes sessions for you; you never need to copy this."}),$?(0,s.jsx)("p",{className:"delete-error",children:$}):null,w?(0,s.jsxs)("div",{className:"session-debug-value",children:[(0,s.jsx)("code",{children:w}),(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{q()},children:_?"Copied":"Copy"})]}):null]})]})}let b=["input_tokens","output_tokens","cost_usd"];function v({totals:e,samples:a}){let t=(0,n.useId)();return(0,s.jsxs)("section",{className:"session-usage-detail","aria-labelledby":t,children:[(0,s.jsx)("h5",{id:t,className:"session-usage-head",children:"Reported usage"}),(0,s.jsx)("dl",{className:"session-usage-totals",children:b.map(a=>{let n=(0,l.usageMetricView)(a,e?.[a],!0);return(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:n.name}),(0,s.jsxs)("dd",{children:[(0,s.jsx)("span",{className:`session-usage is-${n.quality}`,"aria-hidden":"true",children:n.text}),(0,s.jsxs)("span",{className:"session-sr",children:[n.label,"."]}),(0,s.jsx)("span",{className:`session-usage-coverage is-${n.quality}`,children:n.coverage})]})]},a)})}),0===a.length?(0,s.jsx)("p",{className:"session-usage-none",children:"No run in this session reported usage."}):(0,s.jsx)("ol",{className:"session-usage-runs","aria-label":"Reported usage by run",children:a.map((e,a)=>{let n=(0,l.usageSampleValues)(e);return(0,s.jsxs)("li",{children:[(0,s.jsxs)("span",{className:"session-usage-run",children:[(0,l.formatSessionDate)(e.observed_at)," · ",(0,l.usageSampleLabel)(e,a)]}),(0,s.jsxs)("span",{className:"session-usage-values",children:[(0,s.jsxs)("span",{className:null===e.input_tokens?"is-unavailable":void 0,children:["In ",n.input]}),(0,s.jsxs)("span",{className:null===e.output_tokens?"is-unavailable":void 0,children:["Out ",n.output]}),(0,s.jsxs)("span",{className:null===e.cost_usd?"is-unavailable":void 0,children:["Cost ",n.cost]})]})]},`${e.observed_at}-${a}`)})})]})}var y=e.i(70925);e.s(["default",0,function(){let{id:e,agents:n,overview:t,loading:l,error:i,notFound:r}=(0,y.useAgentOverview)();return l?(0,s.jsx)("div",{className:"agent-state",role:"status",children:"Loading sessions…"}):r?(0,s.jsxs)("div",{className:"agent-state",children:[(0,s.jsx)("h2",{children:"Agent not found"}),(0,s.jsx)(a.default,{href:"/",children:"Choose an agent"})]}):i||!t?(0,s.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,s.jsx)("h2",{children:"Sessions unavailable"}),(0,s.jsx)("p",{children:"Botmancers could not load this agent. Refresh to try again."})]}):(0,s.jsx)(g,{agentId:e,agentName:t.agent.name,agentProvider:t.runtime.agent,agents:n.map(e=>({id:e.id,name:e.name})),origin:t.conversation?{conversationId:t.conversation.id,label:`${t.agent.name} conversation`}:null})}],49816)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,69603,e=>{"use strict";var t=e.i(43476),n=e.i(71645),a=e.i(22016),s=e.i(18566),r=e.i(13255),i=e.i(46986),o=e.i(15366),l=e.i(70925),c=e.i(74904),d=e.i(68684),u=e.i(96594),p=e.i(64711),h=e.i(54423),m=e.i(39244);function f(e){let t=e;for(let e=0;e<4;e++){let e=t.replace(/^\s*\[(?:Message from|From) [^\]]+\]\s*(?:\r?\n)?/,"");if(e===t)break;t=e}return t.replace(/^\s+/,"")}function g(e,t){let n=new Map(e.map(e=>[e.id,e]));for(let e of t)n.set(e.id,e);return[...n.values()].sort((e,t)=>e.created_at-t.created_at||e.id.localeCompare(t.id))}function v({message:e,conversationId:a,status:s,writable:r,onDone:i}){let o=(0,d.parseDraft)(f(e.content)),[l,c]=(0,n.useState)(o?.recipient??""),[u,p]=(0,n.useState)(o?.body??""),[h,m]=(0,n.useState)(!1);if(!o)return null;let g=!r||"open"!==s,b=async t=>{g||h||(m(!0),await fetch(`/api/conversations/${encodeURIComponent(a)}/draft`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messageId:e.id,action:t,recipient:l,body:u})}),m(!1),i())};return(0,t.jsxs)("div",{className:"draft-card",children:[(0,t.jsx)("div",{className:"draft-title",children:(0,d.draftTitle)(o.channel)}),(0,t.jsx)("input",{"aria-label":"Recipient",value:g?o.recipient:l,readOnly:g,onChange:e=>c(e.target.value)}),(0,t.jsx)("textarea",{rows:3,"aria-label":"Draft body",value:g?o.body:u,readOnly:g,onChange:e=>p(e.target.value)}),"open"===s&&r?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",className:"approve-control",disabled:h||!l.trim(),onClick:()=>void b("send"),children:"Send"}),(0,t.jsx)("button",{type:"button",className:"approve-control",disabled:h,onClick:()=>void b("discard"),children:"Discard"})]}):(0,t.jsx)("span",{className:"draft-mark",children:"open"===s?"Read only":"sent"===s?"Sent":"Discarded"})]})}function b({message:e,conversationId:a,status:s,writable:r,onDone:i}){let o=(0,d.parseApprovalCode)(e.content),[l,c]=(0,n.useState)(!1);if(!o)return null;if(!r||"pending"!==s)return(0,t.jsx)("span",{className:"draft-mark",children:"pending"===s?"Approval is read only":"approved"===s?"Approved":"Denied"});let u=async t=>{l||(c(!0),await fetch(`/api/conversations/${encodeURIComponent(a)}/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:o,messageId:e.id})}),c(!1),i())};return(0,t.jsxs)("span",{className:"draft-mark",children:[(0,t.jsx)("button",{type:"button",className:"approve-control",disabled:l,onClick:()=>void u("approve"),children:"Approve"}),(0,t.jsx)("button",{type:"button",className:"approve-control",disabled:l,onClick:()=>void u("deny"),children:"Deny"})]})}function y({names:e}){return e.length?(0,t.jsx)(t.Fragment,{children:e.map(e=>(0,t.jsxs)("span",{children:[(0,t.jsx)("br",{}),(0,t.jsxs)("a",{className:"file-control",href:`/api/files/${encodeURIComponent(e)}`,download:e,children:["Download ",e]})]},e))}):null}e.s(["default",0,function(){let e=(0,s.useParams)(),x=(0,s.useSearchParams)(),w=String(e.id??""),_=String(e.conversationId??""),{overview:$}=(0,l.useAgentOverview)(),[k,j]=(0,n.useState)(null),[C,N]=(0,n.useState)([]),[S,I]=(0,n.useState)(null),[R,A]=(0,n.useState)([]),[T,q]=(0,n.useState)(""),[D,L]=(0,n.useState)(!1),[U,E]=(0,n.useState)(!1),[O,M]=(0,n.useState)(""),[F,P]=(0,n.useState)([]),[H,B]=(0,n.useState)(""),[K,Q]=(0,n.useState)(!1),[Y,J]=(0,n.useState)(0),V=(0,n.useRef)(null),W=(0,n.useRef)(null),z=(0,n.useRef)(null),Z=(0,n.useRef)(!1),G=(0,n.useRef)(!1),X=(0,n.useCallback)(async(e=null,t=!1)=>{if(w&&_){t&&E(!0);try{let n=new URLSearchParams({limit:"60"});e&&n.set("cursor",e);let[a,s]=await Promise.all([fetch(`/api/bots/${encodeURIComponent(w)}/conversations/${encodeURIComponent(_)}?${n}`,{cache:"no-store"}),fetch(`/api/exchanges?conversation=${encodeURIComponent(_)}`,{cache:"no-store"})]);if(404===a.status){L(!0),q("");return}let r=await a.json().catch(()=>null);if(!a.ok||!r||!Array.isArray(r.messages))throw Error("history");let i=await s.json().catch(()=>null);j(r),N(e=>t?g(r.messages,e):g(e,r.messages)),(t||!Z.current)&&I(r.next_cursor),s.ok&&Array.isArray(i?.exchanges)&&A(i.exchanges),q(""),L(!1)}catch{q("Could not load this conversation.")}finally{E(!1)}}},[_,w]);(0,n.useEffect)(()=>{let e=window.setTimeout(()=>{X()},0),t=window.setInterval(()=>{X()},2e3);return()=>{window.clearTimeout(e),window.clearInterval(t)}},[X,Y]),(0,n.useEffect)(()=>{k&&!Z.current&&(Z.current=!0,z.current?.lastElementChild?.scrollIntoView({block:"end"}),k.writable&&V.current?.focus({preventScroll:!0}))},[k]),(0,n.useEffect)(()=>{let e=x.get("exchange");if(!e||G.current)return;let t=document.getElementById(`exchange-${e}`);t&&(G.current=!0,t.scrollIntoView({block:"center"}),t.focus({preventScroll:!0}))},[R,x]);let ee=e=>{let t=6-F.length;B(e.length>t?"Up to six attachments.":""),P(n=>[...n,...e.slice(0,Math.max(t,0)).map((e,t)=>({id:`${e.name}-${e.size}-${n.length+t}`,name:e.name}))])},et=async()=>{if(!k?.writable||K)return;let e=[O.trim(),...F.map(e=>e.name)].filter(Boolean).join("\n");if(e){Q(!0);try{if(!(await fetch(`/api/conversations/${encodeURIComponent(_)}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e,idempotencyKey:crypto.randomUUID()})})).ok)throw Error("send");M(""),P([]),B(""),await X()}catch{B("Message could not be sent. Try again.")}finally{Q(!1)}}},en=async e=>{if(!k?.writable)return;let t=e?`/messages/${encodeURIComponent(e)}/stop`:"/stop";await fetch(`/api/conversations/${encodeURIComponent(_)}${t}`,{method:"POST"}),await X()};if(D)return(0,t.jsxs)("div",{className:"conversation-detail-state",children:[(0,t.jsx)("h2",{children:"Conversation not found"}),(0,t.jsx)("p",{children:"This conversation does not involve the selected agent or no longer exists."}),(0,t.jsx)(a.default,{href:`/agents/${encodeURIComponent(w)}/conversations`,children:"All conversations"})]});if(!k&&!T)return(0,t.jsx)("p",{className:"conversation-detail-state",role:"status","data-conversation-detail-state":"loading",children:"Loading conversation…"});if(!k&&T)return(0,t.jsxs)("div",{className:"conversation-detail-state",role:"alert","data-conversation-detail-state":"error",children:[(0,t.jsx)("p",{children:T}),(0,t.jsx)("button",{type:"button",onClick:()=>J(e=>e+1),children:"Retry"})]});if(!k)return null;let ea=(0,h.wakeNotices)(k.events).map(e=>({...e,actionable:e.actionable&&k.writable})),es=new Set,er=new Set,ei=e=>ea.filter(t=>!es.has(t.eventId)&&t.createdAt<e).map(e=>(es.add(e.eventId),(0,t.jsx)("li",{className:"msg-status",children:(0,t.jsx)(o.default,{notice:e,onDone:()=>void X()})},e.eventId))),eo=e=>R.filter(t=>!er.has(t.id)&&t.created_at<e).sort((e,t)=>e.created_at-t.created_at).map(e=>(er.add(e.id),(0,t.jsx)("li",{className:"msg-status",children:(0,t.jsx)(r.default,{summary:e,onChanged:()=>void X()})},e.id)));return(0,t.jsxs)("div",{className:"conversation-detail","data-conversation-writable":k.writable?"true":"false",children:[(0,t.jsxs)("header",{className:"conversation-detail-head",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(a.default,{href:`/agents/${encodeURIComponent(w)}/conversations`,children:"← Conversations"}),(0,t.jsx)("p",{className:"agent-eyebrow",children:(0,m.ownerConversationEyebrow)(k)}),(0,t.jsx)("h2",{children:k.label}),(0,t.jsx)("p",{className:"conversation-participant-line",children:k.participants.map(e=>e.label).join(" · ")}),(0,t.jsxs)("p",{className:"conversation-origin-line",children:["Origin: ",k.origin?.label??"Unknown"," · ",k.message_count," messages"]})]}),k.writable?(0,t.jsx)("button",{type:"button",className:"conversation-stop",onClick:()=>void en(),children:"Stop delegated turns"}):null]}),k.writable?null:(0,t.jsxs)("aside",{className:"conversation-read-only",role:"note",children:[(0,t.jsx)("strong",{children:"Read-only history"}),(0,t.jsx)("p",{children:k.read_only_reason}),$?.conversation?(0,t.jsx)(a.default,{href:`/agents/${encodeURIComponent(w)}/conversations/${encodeURIComponent($.conversation.id)}`,children:"Open direct conversation"}):null]}),T?(0,t.jsxs)("p",{className:"conversation-refresh-error",role:"alert",children:[T," Showing the last loaded history."]}):null,(0,t.jsxs)("div",{className:"conversation-history",children:[S?(0,t.jsx)("button",{className:"conversation-older",type:"button",disabled:U,onClick:()=>void X(S,!0),children:U?"Loading…":"Load older messages"}):null,(0,t.jsxs)("ol",{ref:z,className:"conversation-message-list","aria-label":"Conversation history",children:[0===C.length?(0,t.jsx)("li",{className:"conversation-empty-history",children:"No messages in this conversation yet."}):null,C.map(e=>{let a="You"===e.sender_name,s=f(e.content),r=a?null:(0,u.classifyRuntimeFailure)(s),o=a?null:(0,p.parseRun)(e.content),l=a||o?null:(0,d.parseDraft)(s),h=a||o?null:(0,d.parseApprovalCode)(e.content);return(0,t.jsxs)(n.Fragment,{children:[ei(e.created_at),eo(e.created_at),(0,t.jsxs)("li",{className:a?"msg-you":"msg-bot",children:[(0,t.jsx)("div",{className:a?"msg-name msg-name-you":"msg-name",children:e.sender_name}),r?(0,t.jsx)("div",{className:"msg-status",children:(0,t.jsx)(i.default,{failure:r})}):o?(0,t.jsxs)("div",{className:"msg-body",children:[(0,p.runLine)(o),"running"===o.state&&k.writable?(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("button",{type:"button",className:"attach-word",onClick:()=>void en(e.id),children:"Stop"})]}):null]}):l&&e.draftStatus?(0,t.jsx)("div",{className:"msg-body",children:(0,t.jsx)(v,{message:e,conversationId:_,status:e.draftStatus,writable:k.writable,onDone:()=>void X()})}):(0,t.jsxs)("div",{className:"msg-body",children:[function(e,n){let a=String(e??"").split("\n");if(!a.some(e=>null!==(0,c.agentEventDisplay)(e)))return e;let s=[];return a.forEach((e,a)=>{a>0&&s.push((0,t.jsx)("br",{},`${n}-br-${a}`));let r=(0,c.agentEventDisplay)(e);s.push(r?(0,t.jsxs)("span",{className:"agent-event",children:[(0,t.jsx)("span",{className:"agent-event-label",children:r.label}),r.detail?` ${r.detail}`:""]},`${n}-${a}`):(0,t.jsx)("span",{children:e},`${n}-${a}`))}),s}(s,e.id),h&&e.approvalStatus?(0,t.jsx)(b,{message:e,conversationId:_,status:e.approvalStatus,writable:k.writable,onDone:()=>void X()}):null,(0,t.jsx)(y,{names:(0,d.parseFileNames)(e.content)})]})]})]},e.id)}),ei(1/0),eo(1/0)]})]}),k.writable?(0,t.jsxs)("div",{className:"composer conversation-composer",onPaste:e=>{let t=Array.from(e.clipboardData.files??[]);t.length&&(e.preventDefault(),ee(t))},children:[(0,t.jsxs)("div",{className:"composer-box",children:[H?(0,t.jsx)("p",{className:"attach-error",role:"alert",children:H}):null,F.length?(0,t.jsx)("div",{className:"attach-names",children:F.map(e=>(0,t.jsx)("span",{children:e.name},e.id))}):null,(0,t.jsx)("textarea",{ref:V,rows:2,value:O,onChange:e=>M(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),et())},placeholder:`Message ${$?.agent.name??"this agent"}`,"aria-label":"Message"})]}),(0,t.jsx)("input",{ref:W,className:"attach-input",type:"file",multiple:!0,onChange:e=>{ee(Array.from(e.target.files??[])),e.target.value=""}}),(0,t.jsx)("button",{type:"button",className:"attach-word",onClick:()=>W.current?.click(),children:"Attach"}),(0,t.jsx)("button",{type:"button",className:"send-btn",disabled:K,onClick:()=>void et(),children:K?"Sending…":"Send"})]}):null]})}])},13255,e=>{"use strict";var t=e.i(43476),n=e.i(71645),a=e.i(22016),s=e.i(50814);e.s(["default",0,function({summary:e,onChanged:r}){let[i,o]=(0,n.useState)(!1),[l,c]=(0,n.useState)(""),d=(0,s.stateTone)(e.state),u=(0,s.outcomeLine)(e),p=(0,s.failureAdvice)(e),h=`exchange-${e.id}-title`,m=async()=>{if(!i){o(!0),c("");try{let t=await fetch(`/api/exchanges/${encodeURIComponent(e.id)}/cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!t.ok){let e=await t.json().catch(()=>null);c("string"==typeof e?.error?.message?e.error.message:"Could not cancel. Try again.")}}catch{c("Could not cancel. Try again.")}finally{o(!1),r?.()}}};return(0,t.jsxs)("article",{id:`exchange-${e.id}`,className:`exchange-card is-${d} is-${e.state}`,"data-exchange-id":e.id,"data-exchange-state":e.state,"aria-labelledby":h,tabIndex:-1,children:[(0,t.jsxs)("p",{className:"exchange-card-line",children:[(0,t.jsx)("span",{className:"exchange-card-mode",children:(0,s.modeLabel)(e.mode)}),(0,t.jsx)("span",{id:h,className:"exchange-card-title",children:(0,s.participantsLabel)(e)}),(0,t.jsx)("span",{className:"exchange-card-state",role:"status",children:(0,s.liveStateLabel)(e)})]}),(0,t.jsx)("p",{className:"exchange-card-session",children:(0,s.sessionLabel)(e)}),(0,t.jsxs)("p",{className:"exchange-card-instruction",children:[(0,t.jsx)("span",{className:"exchange-card-key",children:(0,s.instructionHeading)(e.mode)})," ",(0,s.excerpt)(e.instruction,220)]}),u?(0,t.jsx)("p",{className:"failed"===e.state?"exchange-card-outcome is-failure":"exchange-card-outcome",children:u}):null,p?(0,t.jsx)("p",{className:"exchange-card-advice",children:p}):null,l?(0,t.jsx)("p",{className:"exchange-card-error",role:"alert",children:l}):null,(0,t.jsxs)("p",{className:"exchange-card-foot",children:[(0,t.jsxs)("span",{className:"exchange-card-time",children:["Updated ",(0,s.formatExchangeTime)(e.updated_at)]}),(0,t.jsx)(a.default,{className:"exchange-card-link",href:(0,s.detailsHref)(e.id),"aria-label":`Details: ${(0,s.modeLabel)(e.mode)} ${(0,s.participantsLabel)(e)}`,children:"Details"}),e.can_cancel?(0,t.jsx)("button",{type:"button",className:"exchange-card-cancel",disabled:i,onClick:()=>{m()},children:i?"Cancelling…":"Cancel"}):null]})]})}])},46986,15366,e=>{"use strict";var t=e.i(43476),n=e.i(71645),a=e.i(96594);e.s(["default",0,function({failure:e}){let[s,r]=(0,n.useState)("idle"),i=(0,a.severityLabel)(e.severity),o=(0,n.useId)();async function l(){try{await navigator.clipboard.writeText(e.detail),r("copied")}catch{r("failed")}}return(0,t.jsxs)("div",{className:`runtime-failure runtime-failure-${e.severity}`,role:"status","aria-labelledby":o,"data-runtime-failure":e.kind,children:[(0,t.jsxs)("p",{className:"runtime-failure-title",id:o,children:[(0,t.jsx)("span",{className:"runtime-failure-severity",children:i}),e.title]}),(0,t.jsx)("p",{className:"runtime-failure-recovery",children:e.recovery}),(0,t.jsxs)("details",{className:"runtime-failure-details",children:[(0,t.jsx)("summary",{children:"Details"}),(0,t.jsx)("code",{className:"runtime-failure-detail",children:e.detail}),(0,t.jsx)("button",{type:"button",className:"runtime-failure-copy",onClick:()=>{l()},children:"copied"===s?"Copied":"failed"===s?"Copy failed":"Copy details"})]})]})}],46986);let s={blocked:"Needs approval",rejected:"Not started",allowed:"Allowed",denied:"Denied",waiting:"Queued",stopped:"Stopped"};e.s(["default",0,function({notice:e,onDone:a}){let[r,i]=(0,n.useState)(!1),[o,l]=(0,n.useState)(""),c="blocked"!==e.tone||e.actionable?s[e.tone]:"Blocked",d=async t=>{if(!r&&e.wakeId){i(!0),l("");try{let n=await fetch(`/api/wakes/${e.wakeId}/decision`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decision:t})});if(!n.ok){let e=await n.json().catch(()=>null);l("string"==typeof e?.error?.message?e.error.message:"The decision could not be recorded.")}}catch{l("The decision could not be recorded.")}finally{i(!1),a()}}};return(0,t.jsxs)("div",{className:`wake-notice wake-notice-${e.tone}`,role:"status","data-wake-notice":e.tone,"data-wake-id":e.wakeId??void 0,children:[(0,t.jsxs)("p",{className:"wake-notice-line",children:[(0,t.jsx)("span",{className:"wake-notice-label",children:c}),e.text]}),e.actionable?(0,t.jsxs)("div",{className:"wake-notice-actions",children:[(0,t.jsx)("button",{type:"button",className:"approve-control",disabled:r,onClick:()=>{d("allow")},children:"Allow"}),(0,t.jsx)("button",{type:"button",className:"approve-control",style:{marginLeft:8},disabled:r,onClick:()=>{d("deny")},children:"Deny"})]}):null,o?(0,t.jsx)("p",{className:"wake-notice-error",role:"alert",children:o}):null]})}],15366)},68684,e=>{"use strict";e.s(["draftTitle",0,function(e){return"email"===e?"New Email":"New Slack Message"},"parseApprovalCode",0,function(e){let t=e.match(/approve using the code ([A-Za-z0-9][A-Za-z0-9_-]*)/i);return t?t[1]:null},"parseDraft",0,function(e){let t,n=e.match(/^\s*\[draft\]\s*([\s\S]*)$/);if(!n)return null;try{t=JSON.parse(n[1])}catch{return null}if(!t||"object"!=typeof t)return null;let a=t;return"email"!==a.channel&&"slack"!==a.channel||"open"!==a.state&&"sent"!==a.state&&"discarded"!==a.state||"string"!=typeof a.recipient||"string"!=typeof a.body?null:{channel:a.channel,recipient:a.recipient,body:a.body,state:a.state}},"parseFileNames",0,function(e){let t=[];for(let n of e.split("\n")){let e=n.match(/^\s*\[file\]\s*(\S+)\s*$/i);e&&!t.includes(e[1])&&t.push(e[1])}return t},"parseHandoff",0,function(e){let t=e.match(/^\s*\[Handing off to ([^\]]+)\]/);return t&&t[1].trim()||null}])},50814,63352,e=>{"use strict";function t(e){return`${new Date(e).toISOString().slice(0,16).replace("T"," ")} UTC`}function n(e){return e?e.split("/").filter(e=>e.length>0).pop()??null:null}function a(e,t){let n=function(e){if(!e)return null;let t=e.toLowerCase();return"muse code"===t?"muse":(["codex","claude","cursor","hermes","muse"].includes(t),t)}(t);switch(e){case"provider_unavailable":return n?{reason:`${n} is not installed or did not start`,fix:`Install ${n} and Retry.`}:{reason:"the runtime is not installed or did not start",fix:"Install the runtime and Retry."};case"auth_required":return{reason:"not signed in",fix:"Sign in and Retry."};case"permission_denied":return{reason:"permission denied",fix:"Check permissions and Retry."};case"incompatible_version":return{reason:"incompatible version",fix:"Update the runtime and Retry."};case"usage_limit":return{reason:"usage limit reached",fix:"Wait or upgrade and Retry."};case"scope_missing":return{reason:"no session scope is set",fix:"Choose a scope in Config."};case"provider_failed":return{reason:"the listing failed",fix:"Retry."};default:return{reason:e,fix:"Retry."}}}let s="Not reported";function r(e){return e.toFixed(1).replace(/\.0$/,"")}function i(e){return e.toLocaleString("en-US")}function o(e){return 0===e?"$0.00":e>=.01?`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`:e<1e-4?"<$0.0001":`$${e.toFixed(4)}`}let l={input_tokens:"Input tokens",output_tokens:"Output tokens",cost_usd:"Cost"};function c(e,t,n){return"cost_usd"===e?o(t):n?i(t):t<1e3?String(t):t<999950?`${r(t/1e3)}k`:t<99995e4?`${r(t/1e6)}M`:`${r(t/1e9)}B`}function d(e){return`${e} ${1===e?"run":"runs"}`}function u(e,t,n=!1){let a=l[e];if(!t||"unavailable"===t.quality||null===t.sum)return{name:a,text:s,quality:"unavailable",coverage:t&&t.total>0?`0 of ${d(t.total)} reported`:"No runs recorded",label:`${a}: not reported`};let r=c(e,t.sum,n),i=c(e,t.sum,!0);return"partial"===t.quality?{name:a,text:r,quality:"partial",coverage:`Partial: ${t.known} of ${d(t.total)} reported`,label:`${a}: at least ${i}, partial, reported by ${t.known} of ${d(t.total)}`}:{name:a,text:r,quality:"complete",coverage:`All ${d(t.total)} reported`,label:`${a}: ${i}, reported by all ${d(t.total)}`}}e.s(["SESSION_FILTER_OPTIONS",0,[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"ended",label:"Ended"}],"attemptLabel",0,function(e){let t="source"===e.role?"Started the session":"Resumed the session";return`${t} \xb7 ${e.outcome??"running"}`},"emptySessionsCopy",0,function(e,t,n,s){if("active"===e)return`${t} has no active sessions.`;if("ended"===e)return`${t} has no ended sessions.`;if(n?.last_error_code){let{reason:e,fix:t}=a(n.last_error_code,s),r=s?`${s} sessions`:"sessions";return`Could not read ${r}: ${e}. ${t}`}if(n&&null===n.synced_at)return`${t} has not synced sessions yet. Refresh to load past sessions.`;let r=n?.out_of_scope_count??0;return r>0?`${r} ${1===r?"session exists":"sessions exist"} outside ${t}'s scope. Widen the scope to see them.`:`${t} has no sessions yet. One appears after a coding run keeps its runtime context.`},"formatSessionDate",0,t,"formatSyncRelativeTime",0,function(e,t=Date.now()){if(null===e)return"never";let n=Math.max(0,t-e);if(n<6e4)return"just now";let a=Math.floor(n/6e4);if(a<60)return`${a} minute${1===a?"":"s"} ago`;let s=Math.floor(a/60);if(s<24)return`${s} hour${1===s?"":"s"} ago`;let r=Math.floor(s/24);return`${r} day${1===r?"":"s"} ago`},"noMatchingSessionsCopy",0,function(e,t){let a=e.trim();if(a)return`No sessions match “${a}”.`;let s=n(t);return s?`No sessions in ${s}.`:"No sessions match the current filters."},"registrationSessionSyncCopy",0,function(e,t){if("failed"===e.outcome){let{reason:n,fix:s}=a(e.error_code??"provider_failed",t);return`Could not read ${t} sessions: ${n}. ${s}`}if("unsupported"===e.outcome)return`Past sessions are not available for ${t}.`;let n=1===e.imported?"session":"sessions",s=`Loaded ${e.imported} ${n}`;return e.rejected_out_of_scope>0&&(s+=`, ${e.rejected_out_of_scope} outside the scope`),e.complete||(s+=", more remain"),`${s}.`},"runtimeLabel",0,function(e){return e.agent.transport?`${e.agent.adapter} \xb7 ${e.agent.transport}`:e.agent.adapter},"sessionConversationHref",0,function(e){return e.thread_agent_id?`/agents/${encodeURIComponent(e.thread_agent_id)}/conversations`:"group"===e.kind?`/threads/${encodeURIComponent(e.id)}`:null},"sessionOriginChips",0,function(e){let t=[],n=e.origin.work_request?.requester;return n?.kind==="person"?t.push("Human origin"):n?.kind==="bot"?t.push(n.name?`${n.name} Agent`:"Agent origin"):n?.kind==="service"&&t.push("Service origin"),e.origin.conversation&&t.push(e.origin.conversation.label),[...new Set(t)]},"sessionStateTags",0,function(e){let t=[];return(e.home&&t.push("Home"),e.state?.availability==="missing")?[...t,"Missing"]:(e.state?.lifecycle==="archived"&&t.push("Archived"),e.state?.busy&&t.push("Busy"),(e.resumable||e.state?.resumable===!0)&&t.push("Resumable"),t)},"sessionUsageLine",0,function(e){let t=u("input_tokens",e?.input_tokens),n=u("output_tokens",e?.output_tokens),a=u("cost_usd",e?.cost_usd),r=[t,n,a];if(r.every(e=>"unavailable"===e.quality))return{text:s,label:"Usage: not reported",quality:"unavailable",partial:!1};let i=["unavailable"===t.quality?"input not reported":`${t.text} in`,"unavailable"===n.quality?"output not reported":`${n.text} out`,"unavailable"===a.quality?"cost not reported":a.text].join(" · "),o=r.some(e=>"partial"===e.quality),l=o||r.some(e=>"unavailable"===e.quality)?"partial":"complete";return{text:i,label:`Reported usage: ${r.map(e=>e.label).join("; ")}`,quality:l,partial:o}},"statusLabel",0,function(e){return"active"===e.status?"Active":"Ended"},"usageMetricView",0,u,"usageSampleLabel",0,function(e,t){let n="turn"===e.kind?"start"===e.turn_kind?"provider turn, started":"provider turn":"resume"===e.turn_kind?"resumed":"started";return`Run ${t+1} \xb7 ${n}`},"usageSampleValues",0,function(e){return{input:null===e.input_tokens?s:i(e.input_tokens),output:null===e.output_tokens?s:i(e.output_tokens),cost:null===e.cost_usd?s:o(e.cost_usd)}},"workRequestLabel",0,function(e){var t;let n=e.origin.work_request;return n?`${(t=n.execution_kind)?t[0].toUpperCase()+t.slice(1):t} \xb7 ${n.state}`:null},"workspaceFolderName",0,n,"workspaceOptions",0,function(e){let t=[...new Set(e.filter(e=>"string"==typeof e&&e.length>0))],a=t.map(e=>n(e)??e);return t.map((e,t)=>({value:e,label:a.filter(e=>e===a[t]).length>1?e:a[t]})).sort((e,t)=>e.label<t.label?-1:+(e.label>t.label))}],63352);let p={ask:"Ask from this context",resume:"Resume work here",handoff:"Hand off to…"},h=["queued","extracting","delivering","completed","failed","cancelled"],m=["completed","failed","cancelled"];function f(e,t){switch(t){case"queued":return"Queued";case"extracting":return"ask"===e?"Asking the session":"Extracting handoff";case"delivering":return"Delivering handoff";case"completed":return"ask"===e?"Answered":"Handed off";case"failed":return"Failed";case"cancelled":return"Cancelled"}}function g(e,t=140){let n=String(e??"").split("\n").map(e=>e.trim()).filter(e=>e.length>0).join(" ");return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function v(e,t){return t.updated_at-e.updated_at||t.created_at-e.created_at||(e.id<t.id?-1:+(e.id>t.id))}e.s(["DEFAULT_LEDGER_FILTER",0,{mode:"all",state:"all",agentId:""},"INSTRUCTION_LIMIT",0,4e3,"MODE_FILTER_OPTIONS",0,[{value:"all",label:"All"},{value:"ask",label:"Ask"},{value:"continue",label:"Continue"}],"STATE_FILTER_OPTIONS",0,[{value:"all",label:"Any status"},{value:"active",label:"In progress"},{value:"queued",label:"Queued"},{value:"extracting",label:"Asking / extracting"},{value:"delivering",label:"Delivering"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"},{value:"cancelled",label:"Cancelled"}],"detailsHref",0,function(e){return`/exchanges?id=${encodeURIComponent(e)}`},"eventLabel",0,function(e,t){let n=e.data??{},a=t.source.agent_name,s=t.destination?.agent_name??"the destination Agent",r="string"==typeof n.hop?n.hop:null;switch(e.type){case"created":return"ask"===t.mode?`You asked ${a}'s session a question`:`You handed ${a}'s session to ${s}`;case"hop_queued":if("deliver"===r)return`Handoff queued for ${s}'s new session`;return"extract"===r?`Handoff extraction queued in ${a}'s session`:`Question queued for ${a}'s session`;case"hop_started":if("deliver"===r)return`${s} started a new session`;return"extract"===r?`${a}'s session started extracting the handoff`:`${a}'s session started answering`;case"state_changed":{let e="string"==typeof n.to&&h.includes(n.to)?n.to:null;return e?`Now ${f(t.mode,e).toLowerCase()}`:"State changed"}case"answer_returned":return`Answer returned to ${t.origin?.label??"the origin thread"}${n.truncated?" (shortened)":""}`;case"packet_extracted":return"Handoff packet extracted";case"packet_rejected":return`Handoff packet refused${"string"==typeof n.reason?`: ${n.reason}`:""}`;case"destination_replied":return`${s} replied in ${t.destination?.conversation?.label??"its thread"}`;case"destination_session_rejected":return`${s}'s session was not new; the handoff stopped`;case"cancel_requested":return"You asked to cancel";case"hop_result_discarded":return"A late result was discarded";default:return e.type.replace(/_/g," ")}},"excerpt",0,g,"exchangeRequestBody",0,function(e,t,n){let a={mode:e.mode,idempotency_key:n,origin_conversation_id:e.originConversationId,source:{agent_id:t.agentId,session_ref:t.sessionRef},instruction:e.instruction.trim()};return"continue"===e.mode&&(a.destination={agent_id:e.destinationAgentId}),a},"failureAdvice",0,function(e){if("failed"!==e.state)return null;switch(e.failure?.code){case"packet_invalid":case"packet_missing":return"The source session did not return a usable handoff. Start a new Continue with a clearer objective.";case"destination_session_invalid":return"The destination did not start a fresh session. Check its runtime, then start a new Continue.";case"destination_turn_failed":return"Check the destination Agent’s runtime, then start a new Continue from the source session.";case"source_turn_failed":return"Check the source Agent’s runtime, then start a new exchange from its Sessions.";default:return"Start a new exchange from the session to try again."}},"formatExchangeTime",0,function(e){return t(e)},"instructionHeading",0,function(e){return"ask"===e?"Question":"Objective"},"ledgerAgents",0,function(e){let t=new Map;for(let n of e)t.set(n.source.agent_id,n.source.agent_name),n.destination&&t.set(n.destination.agent_id,n.destination.agent_name);return[...t.entries()].map(([e,t])=>({id:e,name:t})).sort((e,t)=>e.name.localeCompare(t.name)||e.id.localeCompare(t.id))},"ledgerRows",0,function(e,t){return e.filter(e=>("all"===t.mode||e.mode===t.mode)&&("active"!==t.state||!e.terminal)&&("all"===t.state||"active"===t.state||e.state===t.state)&&(!t.agentId||e.source.agent_id===t.agentId||e.destination?.agent_id===t.agentId)).sort(v)},"ledgerView",0,function(e,t,n){return null===e?t?"error":"loading":0===e.length?"empty":0===n.length?"filtered-out":"rows"},"linkRoleLabel",0,function(e){let t={origin:"Started here",source:"Source session",destination:"Destination"};return e.map(e=>t[e]).join(" · ")},"liveStateLabel",0,function(e){var t;return e.cancel_requested&&(t=e.state,!m.includes(t))?"Cancelling…":f(e.mode,e.state)},"modeLabel",0,function(e){return"ask"===e?"Ask":"Continue"},"outcomeLine",0,function(e){if("completed"===e.state){if("ask"===e.mode){let t=e.origin?.label??"the origin thread";return e.outcome.answer?`Answer in ${t}: ${g(e.outcome.answer,200)}`:`Answered in ${t}.`}let t=e.destination?.agent_name??"The destination Agent";return e.outcome.reply?`${t} picked it up in a new session: ${g(e.outcome.reply,200)}`:`${t} picked it up in a new session.`}return"failed"===e.state?e.failure?.message||"The exchange failed.":"cancelled"===e.state?"Cancelled before it finished. Nothing more will run.":null},"participantsLabel",0,function(e){return"ask"===e.mode?`You → ${e.source.agent_name}`:`${e.source.agent_name} → ${e.destination?.agent_name??"another Agent"}`},"pinRequestBody",0,function(e,t,n,a,s){return{action:e,content:t.trim(),conversation_id:n,idempotency_key:s,..."resume"===e?{approve_write:a}:{}}},"sessionDialogMode",0,function(e){return"handoff"===e?"continue":e},"sessionDialogTitle",0,function(e){return p["continue"===e?"handoff":e]},"sessionDialogUsesPin",0,function(e,t){return"resume"===e||"ask"===e&&"provider"===t},"sessionLabel",0,function(e){return`${e.source.agent_name}'s session “${e.source.session_title}”`},"sessionRowActions",0,function(e){let t;if(e.actions)t=e.actions;else{let n="ended"===e.status?{available:!1,reason:"Ask from this context and Hand off to… are unavailable: this session has ended. Its history stays here."}:e.resumable?{available:!0}:{available:!1,reason:`Ask from this context and Hand off to… are unavailable: Botmancers can’t resume this session under ${e.agent.name}’s current runtime.`},a=n.available?{available:!0}:{available:!1,code:"ended"===e.status?"session_ended":"session_not_resumable",reason:n.reason,recovery:"choose_session"};t={ask:a,resume:{available:!1,code:"action_unavailable",reason:`${p.resume} is unavailable: this runtime can’t resume a session with edits.`,recovery:"choose_action"},handoff:a}}return["ask","resume","handoff"].map(e=>({action:e,label:p[e],availability:t[e]}))},"stateTone",0,function(e){return"completed"===e?"done":"failed"===e||"cancelled"===e?"stopped":"active"},"submitErrorMessage",0,function(e,t){switch(e){case"session_ended":return"This session has ended and can’t be resumed.";case"session_not_resumable":return"Botmancers can’t resume this session under the agent’s current runtime.";case"source_session_busy":return"This session already has an exchange in progress. Wait for it or cancel it from its card.";case"agent_unavailable":return t||"That Agent can’t launch yet. Choose its runtime connection and session scope in Config.";case"idempotency_conflict":return"This request changed while it was being sent. Send again.";case"session_missing":return"The runtime no longer has this session. Its history stays here; choose another session.";case"approval_required":return"Resume work here needs your approval of edits. Tick the approval, then send again.";case"authority_not_allowed":return t||"This agent’s policy doesn’t allow edits in a resumed session. Change it in Config.";case"action_unavailable":return t||"This runtime can’t do that in this session. Choose another action.";case"provider_failed":return"The runtime failed this turn. Nothing moved to another session; try again later.";default:return t||"The exchange could not be started. Your draft is kept; try again."}},"threadHref",0,function(e,t){let n=new URLSearchParams;if(e.thread_agent_id){t&&n.set("exchange",t);let a=n.toString();return`/agents/${encodeURIComponent(e.thread_agent_id)}/conversations/${encodeURIComponent(e.id)}${a?`?${a}`:""}`}if("group"!==e.kind)return null;t&&n.set("exchange",t);let a=n.toString();return`/threads/${encodeURIComponent(e.id)}${a?`?${a}`:""}`},"validateDraft",0,function(e){let t={},n=e.instruction.trim(),a="ask"===e.mode?"a question":"an objective";return n?e.instruction.length>4e3&&(t.instruction="Keep it under 4000 characters."):t.instruction=`Enter ${a}.`,e.originConversationId||(t.origin="Choose the thread that follows this exchange."),"continue"!==e.mode||e.destinationAgentId||(t.destination="Choose the agent who continues the work."),t},"validateResumeDraft",0,function(e,t){let n={};return e.trim()?e.length>4e3&&(n.instruction="Keep it under 4000 characters."):n.instruction="Enter what to work on.",t||(n.approval="Approve edits in this session to resume work here."),n}],50814)},39244,e=>{"use strict";e.s(["ownerConversationEyebrow",0,function(e){return"direct"===e.type?"Direct conversation":"group"===e.type?"Shared history":e.origin?.kind==="service"?"External-service history":"Agent-to-agent history"},"ownerConversationTypeLabel",0,function(e){return"direct"===e.type?"Direct":"group"===e.type?"Shared":e.origin?.kind==="service"?"External service":"Agent to agent"}])},54423,e=>{"use strict";e.s(["wakeNotices",0,function(e){let t=[],n=new Map;return e.forEach((a,s)=>{let r="string"==typeof a.data.target_name?a.data.target_name:null;a.requestId&&r&&n.set(a.requestId,r);let i=function(e){switch(e.kind){case"wake_blocked":return"blocked";case"wake_rejected":return"rejected";case"lineage_stopped":return"stopped";case"wake_accepted":return"string"==typeof e.data.reason?"allowed":null;case"request_cancelled":return"grant_denied"===e.data.reason?"denied":null;case"request_queued":return"capacity"===e.data.waiting_for?"waiting":null;default:return null}}(a);if(!i)return;let o=Array.isArray(a.data.actions)?a.data.actions:[],l=null!==a.requestId&&e.slice(s+1).some(e=>e.requestId===a.requestId);if("waiting"===i&&l)return;let c=a.requestId?n.get(a.requestId):void 0,d="denied"===i&&c?`Wake denied: ${c} — no work ran`:"waiting"===i&&c?`Queued: ${c} — waiting for capacity`:a.text;t.push({eventId:a.eventId,wakeId:a.wakeId,tone:i,text:d,actionable:"blocked"===i&&!!a.wakeId&&o.includes("allow")&&o.includes("deny")&&!l,createdAt:a.createdAt})}),t}])}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,13255,e=>{"use strict";var t=e.i(43476),n=e.i(71645),a=e.i(22016),r=e.i(50814);e.s(["default",0,function({summary:e,onChanged:s}){let[i,o]=(0,n.useState)(!1),[l,c]=(0,n.useState)(""),u=(0,r.stateTone)(e.state),d=(0,r.outcomeLine)(e),h=(0,r.failureAdvice)(e),f=`exchange-${e.id}-title`,p=async()=>{if(!i){o(!0),c("");try{let t=await fetch(`/api/exchanges/${encodeURIComponent(e.id)}/cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!t.ok){let e=await t.json().catch(()=>null);c("string"==typeof e?.error?.message?e.error.message:"Could not cancel. Try again.")}}catch{c("Could not cancel. Try again.")}finally{o(!1),s?.()}}};return(0,t.jsxs)("article",{id:`exchange-${e.id}`,className:`exchange-card is-${u} is-${e.state}`,"data-exchange-id":e.id,"data-exchange-state":e.state,"aria-labelledby":f,tabIndex:-1,children:[(0,t.jsxs)("p",{className:"exchange-card-line",children:[(0,t.jsx)("span",{className:"exchange-card-mode",children:(0,r.modeLabel)(e.mode)}),(0,t.jsx)("span",{id:f,className:"exchange-card-title",children:(0,r.participantsLabel)(e)}),(0,t.jsx)("span",{className:"exchange-card-state",role:"status",children:(0,r.liveStateLabel)(e)})]}),(0,t.jsx)("p",{className:"exchange-card-session",children:(0,r.sessionLabel)(e)}),(0,t.jsxs)("p",{className:"exchange-card-instruction",children:[(0,t.jsx)("span",{className:"exchange-card-key",children:(0,r.instructionHeading)(e.mode)})," ",(0,r.excerpt)(e.instruction,220)]}),d?(0,t.jsx)("p",{className:"failed"===e.state?"exchange-card-outcome is-failure":"exchange-card-outcome",children:d}):null,h?(0,t.jsx)("p",{className:"exchange-card-advice",children:h}):null,l?(0,t.jsx)("p",{className:"exchange-card-error",role:"alert",children:l}):null,(0,t.jsxs)("p",{className:"exchange-card-foot",children:[(0,t.jsxs)("span",{className:"exchange-card-time",children:["Updated ",(0,r.formatExchangeTime)(e.updated_at)]}),(0,t.jsx)(a.default,{className:"exchange-card-link",href:(0,r.detailsHref)(e.id),"aria-label":`Details: ${(0,r.modeLabel)(e.mode)} ${(0,r.participantsLabel)(e)}`,children:"Details"}),e.can_cancel?(0,t.jsx)("button",{type:"button",className:"exchange-card-cancel",disabled:i,onClick:()=>{p()},children:i?"Cancelling…":"Cancel"}):null]})]})}])},87164,e=>{"use strict";var t=e.i(43476),n=e.i(71645),a=e.i(22016),r=e.i(13255),s=e.i(50814);let i="botmancers:exchanges-navigate";function o(e){return window.addEventListener("popstate",e),window.addEventListener(i,e),()=>{window.removeEventListener("popstate",e),window.removeEventListener(i,e)}}function l(){return new URLSearchParams(window.location.search).get("id")}function c({id:e,onBack:i,onChanged:o}){let[l,u]=(0,n.useState)(null),[d,h]=(0,n.useState)(""),[f,p]=(0,n.useState)(0),g=(0,n.useRef)(null),m=(0,n.useRef)(!1),x=(0,n.useId)();(0,n.useEffect)(()=>{let t=!1,n=()=>{fetch(`/api/exchanges/${encodeURIComponent(e)}`,{cache:"no-store"}).then(async e=>{let n=await e.json().catch(()=>null);if(!t){if(!e.ok||!n?.detail)return void h(404===e.status?"This exchange no longer exists.":"Could not load this exchange.");h(""),u(n.detail)}}).catch(()=>{t||h("Could not load this exchange.")})};n();let a=setInterval(n,2e3);return()=>{t=!0,clearInterval(a)}},[e,f]),(0,n.useEffect)(()=>{l&&!m.current&&(m.current=!0,g.current?.focus())},[l]);let b=(0,t.jsx)("button",{type:"button",className:"pin-word ledger-detail-back",onClick:i,children:"← All exchanges"});if(!l)return(0,t.jsxs)("div",{className:"ledger-detail",children:[b,d?(0,t.jsxs)("div",{role:"alert",className:"ledger-state",children:[(0,t.jsx)("p",{className:"delete-error",children:d}),(0,t.jsx)("button",{type:"button",className:"pin-word",onClick:()=>p(e=>e+1),children:"Retry"})]}):(0,t.jsx)("p",{className:"ledger-state",role:"status",children:"Loading exchange…"})]});let{summary:v,events:y,packet:_}=l;return(0,t.jsxs)("article",{className:"ledger-detail","aria-labelledby":x,"data-exchange-detail":v.id,children:[b,(0,t.jsxs)("h2",{id:x,ref:g,tabIndex:-1,className:"ledger-detail-title",children:[(0,s.modeLabel)(v.mode),": ",(0,s.participantsLabel)(v)]}),(0,t.jsx)(r.default,{summary:v,onChanged:()=>{p(e=>e+1),o()}}),(0,t.jsxs)("section",{className:"ledger-section","aria-label":(0,s.instructionHeading)(v.mode),children:[(0,t.jsx)("h3",{className:"ledger-section-title",children:(0,s.instructionHeading)(v.mode)}),(0,t.jsx)("p",{className:"ledger-text",children:v.instruction})]}),l.answer?(0,t.jsxs)("section",{className:"ledger-section","aria-label":"Answer",children:[(0,t.jsx)("h3",{className:"ledger-section-title",children:"Answer"}),(0,t.jsx)("p",{className:"ledger-text",children:l.answer})]}):null,_?(0,t.jsxs)("section",{className:"ledger-section","aria-label":"Handoff packet",children:[(0,t.jsx)("h3",{className:"ledger-section-title",children:"Handoff packet"}),(0,t.jsx)("p",{className:"ledger-text",children:_.objective}),[["Decisions",_.decisions],["Constraints",_.constraints],["Artifacts and references",_.artifacts],["Open questions",_.open_questions]].filter(([,e])=>e.length>0).map(([e,n])=>(0,t.jsxs)("div",{className:"ledger-packet-list",children:[(0,t.jsx)("h4",{className:"ledger-packet-title",children:e}),(0,t.jsx)("ul",{children:n.map((e,n)=>(0,t.jsx)("li",{children:e},n))})]},e))]}):null,(0,t.jsxs)("section",{className:"ledger-section","aria-label":"Linked threads",children:[(0,t.jsx)("h3",{className:"ledger-section-title",children:"Linked threads"}),(0,t.jsx)("ul",{className:"ledger-links",children:v.links.map(e=>{let n=(0,s.threadHref)(e,v.id);return(0,t.jsxs)("li",{children:[n?(0,t.jsx)(a.default,{className:"session-link ledger-thread-link",href:n,children:e.label}):(0,t.jsxs)("span",{children:[e.label,"agent_api"===e.kind?(0,t.jsx)("span",{className:"ledger-link-role",children:" (between Agents, not an owner thread)"}):null]}),(0,t.jsxs)("span",{className:"ledger-link-role",children:[" · ",(0,s.linkRoleLabel)(e.roles)]})]},e.id)})})]}),(0,t.jsxs)("section",{className:"ledger-section","aria-label":"Timeline",children:[(0,t.jsx)("h3",{className:"ledger-section-title",children:"Timeline"}),(0,t.jsx)("ol",{className:"ledger-timeline",children:y.map(e=>(0,t.jsxs)("li",{"data-event-type":e.type,children:[(0,t.jsx)("span",{className:"ledger-timeline-time",children:(0,s.formatExchangeTime)(e.at)}),(0,t.jsx)("span",{className:"ledger-timeline-text",children:(0,s.eventLabel)(e,v)})]},e.sequence))})]}),(0,t.jsxs)("p",{className:"ledger-foot",children:[(0,s.excerpt)(`${v.source.agent_name}’s session: ${v.source.session_title}`,200),v.destination?.session_title?` \xb7 ${v.destination.agent_name}’s new session: ${v.destination.session_title}`:""]})]})}e.s(["default",0,function(){let[e,r]=(0,n.useState)(null),[u,d]=(0,n.useState)(""),[h,f]=(0,n.useState)(0),[p,g]=(0,n.useState)(s.DEFAULT_LEDGER_FILTER),m=(0,n.useSyncExternalStore)(o,l,()=>null),x=(0,n.useId)(),b=(0,n.useId)(),v=(0,n.useId)(),y=(0,n.useRef)(null),_=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=_.current;if(_.current=m,m||!e)return;let t=document.querySelector(`.ledger-row[data-exchange-id="${CSS.escape(e)}"]`);(t??y.current)?.focus()},[m]),(0,n.useEffect)(()=>{let e=!1,t=()=>{fetch("/api/exchanges",{cache:"no-store"}).then(async t=>{let n=await t.json().catch(()=>null);if(!e){if(!t.ok||!Array.isArray(n?.exchanges))return void d("string"==typeof n?.error?.message?n.error.message:"Could not load exchanges.");d(""),r(n.exchanges)}}).catch(()=>{e||d("Could not load exchanges.")})};t();let n=setInterval(t,2e3);return()=>{e=!0,clearInterval(n)}},[h]);let $=e=>{window.history.pushState(null,"",e?`/exchanges?id=${encodeURIComponent(e)}`:"/exchanges"),window.dispatchEvent(new Event(i))},j=e?(0,s.ledgerRows)(e,p):[],w=(0,s.ledgerView)(e,e?"":u,j),k=e?(0,s.ledgerAgents)(e):[];return(0,t.jsxs)("div",{className:m?"ledger-page has-detail":"ledger-page",children:[(0,t.jsxs)("header",{className:"ledger-head",children:[(0,t.jsx)(a.default,{href:"/",className:"cfg-link ledger-back",children:"← Back to chat"}),(0,t.jsx)("h1",{className:"ledger-title",children:"Agent Exchanges"}),(0,t.jsx)("p",{className:"ledger-sub",children:"Every Ask and Continue between Agent sessions, newest activity first."})]}),(0,t.jsxs)("main",{className:"ledger-main",children:[(0,t.jsxs)("section",{className:"ledger-list-pane","aria-labelledby":v,children:[(0,t.jsx)("h2",{id:v,ref:y,tabIndex:-1,className:"ledger-pane-title",children:"Exchanges"}),(0,t.jsxs)("div",{className:"ledger-filters",children:[(0,t.jsx)("div",{className:"sessions-filter ledger-mode",role:"group","aria-label":"Mode",children:s.MODE_FILTER_OPTIONS.map(e=>(0,t.jsx)("button",{type:"button",className:"sessions-filter-btn","aria-pressed":p.mode===e.value,onClick:()=>g(t=>({...t,mode:e.value})),children:e.label},e.value))}),(0,t.jsxs)("div",{className:"ledger-selects",children:[(0,t.jsxs)("label",{className:"ledger-select-label",htmlFor:x,children:["Status",(0,t.jsx)("select",{id:x,className:"exchange-select",value:p.state,onChange:e=>g(t=>({...t,state:e.target.value})),children:s.STATE_FILTER_OPTIONS.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,t.jsxs)("label",{className:"ledger-select-label",htmlFor:b,children:["Agent",(0,t.jsxs)("select",{id:b,className:"exchange-select",value:p.agentId,onChange:e=>g(t=>({...t,agentId:e.target.value})),children:[(0,t.jsx)("option",{value:"",children:"Any Agent"}),k.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))]})]})]}),(0,t.jsx)("p",{className:"manage-count ledger-count",role:"status",children:e?`${j.length} of ${e.length} shown`:""})]}),"loading"===w?(0,t.jsx)("p",{className:"ledger-state",role:"status","data-ledger-state":"loading",children:"Loading exchanges…"}):null,"error"===w?(0,t.jsxs)("div",{className:"ledger-state",role:"alert","data-ledger-state":"error",children:[(0,t.jsx)("p",{className:"delete-error",children:u}),(0,t.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{d(""),f(e=>e+1)},children:"Retry"})]}):null,"empty"===w?(0,t.jsx)("p",{className:"ledger-state","data-ledger-state":"empty",children:"No exchanges yet. Open an Agent’s Sessions and choose Ask from this context or Hand off to… to start one."}):null,"filtered-out"===w?(0,t.jsxs)("div",{className:"ledger-state","data-ledger-state":"filtered-out",children:[(0,t.jsx)("p",{children:"No exchanges match these filters."}),(0,t.jsx)("button",{type:"button",className:"pin-word",onClick:()=>g(s.DEFAULT_LEDGER_FILTER),children:"Clear filters"})]}):null,"rows"===w?(0,t.jsx)("ol",{className:"ledger-list","aria-label":"Exchanges, newest activity first",children:j.map(e=>(0,t.jsx)("li",{className:"ledger-row-item",children:(0,t.jsxs)("button",{type:"button",className:`ledger-row is-${(0,s.stateTone)(e.state)}`,"data-exchange-id":e.id,"aria-current":m===e.id?"true":void 0,onClick:()=>$(e.id),children:[(0,t.jsxs)("span",{className:"ledger-row-line",children:[(0,t.jsx)("span",{className:"exchange-card-mode",children:(0,s.modeLabel)(e.mode)}),(0,t.jsx)("span",{className:"ledger-row-who",children:(0,s.participantsLabel)(e)}),(0,t.jsx)("span",{className:"ledger-row-state",children:(0,s.liveStateLabel)(e)})]}),(0,t.jsx)("span",{className:"ledger-row-session",children:e.source.session_title}),(0,t.jsxs)("span",{className:"ledger-row-meta",children:["From ",e.origin?.label??"an unknown thread"," · Started ",(0,s.formatExchangeTime)(e.created_at)," · Updated ",(0,s.formatExchangeTime)(e.updated_at)]})]})},e.id))}):null]}),(0,t.jsx)("section",{className:"ledger-detail-pane","aria-label":"Exchange detail",children:m?(0,t.jsx)(c,{id:m,onBack:()=>$(null),onChanged:()=>f(e=>e+1)},m):(0,t.jsx)("p",{className:"ledger-state ledger-placeholder",children:"Choose an exchange to see its timeline and linked threads."})})]})]})}])},50814,63352,e=>{"use strict";function t(e){return`${new Date(e).toISOString().slice(0,16).replace("T"," ")} UTC`}function n(e){return e?e.split("/").filter(e=>e.length>0).pop()??null:null}function a(e,t){let n=function(e){if(!e)return null;let t=e.toLowerCase();return"muse code"===t?"muse":(["codex","claude","cursor","hermes","muse"].includes(t),t)}(t);switch(e){case"provider_unavailable":return n?{reason:`${n} is not installed or did not start`,fix:`Install ${n} and Retry.`}:{reason:"the runtime is not installed or did not start",fix:"Install the runtime and Retry."};case"auth_required":return{reason:"not signed in",fix:"Sign in and Retry."};case"permission_denied":return{reason:"permission denied",fix:"Check permissions and Retry."};case"incompatible_version":return{reason:"incompatible version",fix:"Update the runtime and Retry."};case"usage_limit":return{reason:"usage limit reached",fix:"Wait or upgrade and Retry."};case"scope_missing":return{reason:"no session scope is set",fix:"Choose a scope in Config."};case"provider_failed":return{reason:"the listing failed",fix:"Retry."};default:return{reason:e,fix:"Retry."}}}let r="Not reported";function s(e){return e.toFixed(1).replace(/\.0$/,"")}function i(e){return e.toLocaleString("en-US")}function o(e){return 0===e?"$0.00":e>=.01?`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`:e<1e-4?"<$0.0001":`$${e.toFixed(4)}`}let l={input_tokens:"Input tokens",output_tokens:"Output tokens",cost_usd:"Cost"};function c(e,t,n){return"cost_usd"===e?o(t):n?i(t):t<1e3?String(t):t<999950?`${s(t/1e3)}k`:t<99995e4?`${s(t/1e6)}M`:`${s(t/1e9)}B`}function u(e){return`${e} ${1===e?"run":"runs"}`}function d(e,t,n=!1){let a=l[e];if(!t||"unavailable"===t.quality||null===t.sum)return{name:a,text:r,quality:"unavailable",coverage:t&&t.total>0?`0 of ${u(t.total)} reported`:"No runs recorded",label:`${a}: not reported`};let s=c(e,t.sum,n),i=c(e,t.sum,!0);return"partial"===t.quality?{name:a,text:s,quality:"partial",coverage:`Partial: ${t.known} of ${u(t.total)} reported`,label:`${a}: at least ${i}, partial, reported by ${t.known} of ${u(t.total)}`}:{name:a,text:s,quality:"complete",coverage:`All ${u(t.total)} reported`,label:`${a}: ${i}, reported by all ${u(t.total)}`}}e.s(["SESSION_FILTER_OPTIONS",0,[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"ended",label:"Ended"}],"attemptLabel",0,function(e){let t="source"===e.role?"Started the session":"Resumed the session";return`${t} \xb7 ${e.outcome??"running"}`},"emptySessionsCopy",0,function(e,t,n,r){if("active"===e)return`${t} has no active sessions.`;if("ended"===e)return`${t} has no ended sessions.`;if(n?.last_error_code){let{reason:e,fix:t}=a(n.last_error_code,r),s=r?`${r} sessions`:"sessions";return`Could not read ${s}: ${e}. ${t}`}if(n&&null===n.synced_at)return`${t} has not synced sessions yet. Refresh to load past sessions.`;let s=n?.out_of_scope_count??0;return s>0?`${s} ${1===s?"session exists":"sessions exist"} outside ${t}'s scope. Widen the scope to see them.`:`${t} has no sessions yet. One appears after a coding run keeps its runtime context.`},"formatSessionDate",0,t,"formatSyncRelativeTime",0,function(e,t=Date.now()){if(null===e)return"never";let n=Math.max(0,t-e);if(n<6e4)return"just now";let a=Math.floor(n/6e4);if(a<60)return`${a} minute${1===a?"":"s"} ago`;let r=Math.floor(a/60);if(r<24)return`${r} hour${1===r?"":"s"} ago`;let s=Math.floor(r/24);return`${s} day${1===s?"":"s"} ago`},"noMatchingSessionsCopy",0,function(e,t){let a=e.trim();if(a)return`No sessions match “${a}”.`;let r=n(t);return r?`No sessions in ${r}.`:"No sessions match the current filters."},"registrationSessionSyncCopy",0,function(e,t){if("failed"===e.outcome){let{reason:n,fix:r}=a(e.error_code??"provider_failed",t);return`Could not read ${t} sessions: ${n}. ${r}`}if("unsupported"===e.outcome)return`Past sessions are not available for ${t}.`;let n=1===e.imported?"session":"sessions",r=`Loaded ${e.imported} ${n}`;return e.rejected_out_of_scope>0&&(r+=`, ${e.rejected_out_of_scope} outside the scope`),e.complete||(r+=", more remain"),`${r}.`},"runtimeLabel",0,function(e){return e.agent.transport?`${e.agent.adapter} \xb7 ${e.agent.transport}`:e.agent.adapter},"sessionOriginChips",0,function(e){let t=[],n=e.origin.work_request?.requester;return n?.kind==="person"?t.push("Human origin"):n?.kind==="bot"?t.push(n.name?`${n.name} Agent`:"Agent origin"):n?.kind==="service"&&t.push("Service origin"),e.origin.conversation&&t.push(e.origin.conversation.label),[...new Set(t)]},"sessionStateTags",0,function(e){let t=[];return(e.home&&t.push("Home"),e.state?.availability==="missing")?[...t,"Missing"]:(e.state?.lifecycle==="archived"&&t.push("Archived"),e.state?.busy&&t.push("Busy"),(e.resumable||e.state?.resumable===!0)&&t.push("Resumable"),t)},"sessionUsageLine",0,function(e){let t=d("input_tokens",e?.input_tokens),n=d("output_tokens",e?.output_tokens),a=d("cost_usd",e?.cost_usd),s=[t,n,a];if(s.every(e=>"unavailable"===e.quality))return{text:r,label:"Usage: not reported",quality:"unavailable",partial:!1};let i=["unavailable"===t.quality?"input not reported":`${t.text} in`,"unavailable"===n.quality?"output not reported":`${n.text} out`,"unavailable"===a.quality?"cost not reported":a.text].join(" · "),o=s.some(e=>"partial"===e.quality),l=o||s.some(e=>"unavailable"===e.quality)?"partial":"complete";return{text:i,label:`Reported usage: ${s.map(e=>e.label).join("; ")}`,quality:l,partial:o}},"statusLabel",0,function(e){return"active"===e.status?"Active":"Ended"},"usageMetricView",0,d,"usageSampleLabel",0,function(e,t){let n="turn"===e.kind?"start"===e.turn_kind?"provider turn, started":"provider turn":"resume"===e.turn_kind?"resumed":"started";return`Run ${t+1} \xb7 ${n}`},"usageSampleValues",0,function(e){return{input:null===e.input_tokens?r:i(e.input_tokens),output:null===e.output_tokens?r:i(e.output_tokens),cost:null===e.cost_usd?r:o(e.cost_usd)}},"workRequestLabel",0,function(e){var t;let n=e.origin.work_request;return n?`${(t=n.execution_kind)?t[0].toUpperCase()+t.slice(1):t} \xb7 ${n.state}`:null},"workspaceFolderName",0,n,"workspaceOptions",0,function(e){let t=[...new Set(e.filter(e=>"string"==typeof e&&e.length>0))],a=t.map(e=>n(e)??e);return t.map((e,t)=>({value:e,label:a.filter(e=>e===a[t]).length>1?e:a[t]})).sort((e,t)=>e.label<t.label?-1:+(e.label>t.label))}],63352);let h={ask:"Ask from this context",resume:"Resume work here",handoff:"Hand off to…"},f=["queued","extracting","delivering","completed","failed","cancelled"],p=["completed","failed","cancelled"];function g(e,t){switch(t){case"queued":return"Queued";case"extracting":return"ask"===e?"Asking the session":"Extracting handoff";case"delivering":return"Delivering handoff";case"completed":return"ask"===e?"Answered":"Handed off";case"failed":return"Failed";case"cancelled":return"Cancelled"}}function m(e,t=140){let n=String(e??"").split("\n").map(e=>e.trim()).filter(e=>e.length>0).join(" ");return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function x(e,t){return t.updated_at-e.updated_at||t.created_at-e.created_at||(e.id<t.id?-1:+(e.id>t.id))}e.s(["DEFAULT_LEDGER_FILTER",0,{mode:"all",state:"all",agentId:""},"INSTRUCTION_LIMIT",0,4e3,"MODE_FILTER_OPTIONS",0,[{value:"all",label:"All"},{value:"ask",label:"Ask"},{value:"continue",label:"Continue"}],"STATE_FILTER_OPTIONS",0,[{value:"all",label:"Any status"},{value:"active",label:"In progress"},{value:"queued",label:"Queued"},{value:"extracting",label:"Asking / extracting"},{value:"delivering",label:"Delivering"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"},{value:"cancelled",label:"Cancelled"}],"detailsHref",0,function(e){return`/exchanges?id=${encodeURIComponent(e)}`},"eventLabel",0,function(e,t){let n=e.data??{},a=t.source.agent_name,r=t.destination?.agent_name??"the destination Agent",s="string"==typeof n.hop?n.hop:null;switch(e.type){case"created":return"ask"===t.mode?`You asked ${a}'s session a question`:`You handed ${a}'s session to ${r}`;case"hop_queued":if("deliver"===s)return`Handoff queued for ${r}'s new session`;return"extract"===s?`Handoff extraction queued in ${a}'s session`:`Question queued for ${a}'s session`;case"hop_started":if("deliver"===s)return`${r} started a new session`;return"extract"===s?`${a}'s session started extracting the handoff`:`${a}'s session started answering`;case"state_changed":{let e="string"==typeof n.to&&f.includes(n.to)?n.to:null;return e?`Now ${g(t.mode,e).toLowerCase()}`:"State changed"}case"answer_returned":return`Answer returned to ${t.origin?.label??"the origin thread"}${n.truncated?" (shortened)":""}`;case"packet_extracted":return"Handoff packet extracted";case"packet_rejected":return`Handoff packet refused${"string"==typeof n.reason?`: ${n.reason}`:""}`;case"destination_replied":return`${r} replied in ${t.destination?.conversation?.label??"its thread"}`;case"destination_session_rejected":return`${r}'s session was not new; the handoff stopped`;case"cancel_requested":return"You asked to cancel";case"hop_result_discarded":return"A late result was discarded";default:return e.type.replace(/_/g," ")}},"excerpt",0,m,"exchangeRequestBody",0,function(e,t,n){let a={mode:e.mode,idempotency_key:n,origin_conversation_id:e.originConversationId,source:{agent_id:t.agentId,session_ref:t.sessionRef},instruction:e.instruction.trim()};return"continue"===e.mode&&(a.destination={agent_id:e.destinationAgentId}),a},"failureAdvice",0,function(e){if("failed"!==e.state)return null;switch(e.failure?.code){case"packet_invalid":case"packet_missing":return"The source session did not return a usable handoff. Start a new Continue with a clearer objective.";case"destination_session_invalid":return"The destination did not start a fresh session. Check its runtime, then start a new Continue.";case"destination_turn_failed":return"Check the destination Agent’s runtime, then start a new Continue from the source session.";case"source_turn_failed":return"Check the source Agent’s runtime, then start a new exchange from its Sessions.";default:return"Start a new exchange from the session to try again."}},"formatExchangeTime",0,function(e){return t(e)},"instructionHeading",0,function(e){return"ask"===e?"Question":"Objective"},"ledgerAgents",0,function(e){let t=new Map;for(let n of e)t.set(n.source.agent_id,n.source.agent_name),n.destination&&t.set(n.destination.agent_id,n.destination.agent_name);return[...t.entries()].map(([e,t])=>({id:e,name:t})).sort((e,t)=>e.name.localeCompare(t.name)||e.id.localeCompare(t.id))},"ledgerRows",0,function(e,t){return e.filter(e=>("all"===t.mode||e.mode===t.mode)&&("active"!==t.state||!e.terminal)&&("all"===t.state||"active"===t.state||e.state===t.state)&&(!t.agentId||e.source.agent_id===t.agentId||e.destination?.agent_id===t.agentId)).sort(x)},"ledgerView",0,function(e,t,n){return null===e?t?"error":"loading":0===e.length?"empty":0===n.length?"filtered-out":"rows"},"linkRoleLabel",0,function(e){let t={origin:"Started here",source:"Source session",destination:"Destination"};return e.map(e=>t[e]).join(" · ")},"liveStateLabel",0,function(e){var t;return e.cancel_requested&&(t=e.state,!p.includes(t))?"Cancelling…":g(e.mode,e.state)},"modeLabel",0,function(e){return"ask"===e?"Ask":"Continue"},"outcomeLine",0,function(e){if("completed"===e.state){if("ask"===e.mode){let t=e.origin?.label??"the origin thread";return e.outcome.answer?`Answer in ${t}: ${m(e.outcome.answer,200)}`:`Answered in ${t}.`}let t=e.destination?.agent_name??"The destination Agent";return e.outcome.reply?`${t} picked it up in a new session: ${m(e.outcome.reply,200)}`:`${t} picked it up in a new session.`}return"failed"===e.state?e.failure?.message||"The exchange failed.":"cancelled"===e.state?"Cancelled before it finished. Nothing more will run.":null},"participantsLabel",0,function(e){return"ask"===e.mode?`You → ${e.source.agent_name}`:`${e.source.agent_name} → ${e.destination?.agent_name??"another Agent"}`},"pinRequestBody",0,function(e,t,n,a,r){return{action:e,content:t.trim(),conversation_id:n,idempotency_key:r,..."resume"===e?{approve_write:a}:{}}},"sessionDialogMode",0,function(e){return"handoff"===e?"continue":e},"sessionDialogTitle",0,function(e){return h["continue"===e?"handoff":e]},"sessionDialogUsesPin",0,function(e,t){return"resume"===e||"ask"===e&&"provider"===t},"sessionLabel",0,function(e){return`${e.source.agent_name}'s session “${e.source.session_title}”`},"sessionRowActions",0,function(e){let t;if(e.actions)t=e.actions;else{let n="ended"===e.status?{available:!1,reason:"Ask from this context and Hand off to… are unavailable: this session has ended. Its history stays here."}:e.resumable?{available:!0}:{available:!1,reason:`Ask from this context and Hand off to… are unavailable: Botmancers can’t resume this session under ${e.agent.name}’s current runtime.`},a=n.available?{available:!0}:{available:!1,code:"ended"===e.status?"session_ended":"session_not_resumable",reason:n.reason,recovery:"choose_session"};t={ask:a,resume:{available:!1,code:"action_unavailable",reason:`${h.resume} is unavailable: this runtime can’t resume a session with edits.`,recovery:"choose_action"},handoff:a}}return["ask","resume","handoff"].map(e=>({action:e,label:h[e],availability:t[e]}))},"stateTone",0,function(e){return"completed"===e?"done":"failed"===e||"cancelled"===e?"stopped":"active"},"submitErrorMessage",0,function(e,t){switch(e){case"session_ended":return"This session has ended and can’t be resumed.";case"session_not_resumable":return"Botmancers can’t resume this session under the Agent’s current runtime.";case"source_session_busy":return"This session already has an exchange in progress. Wait for it or cancel it from its card.";case"agent_unavailable":return t||"That Agent can’t launch yet. Choose its runtime connection and session scope in Config.";case"idempotency_conflict":return"This request changed while it was being sent. Send again.";case"session_missing":return"The runtime no longer has this session. Its history stays here; choose another session.";case"approval_required":return"Resume work here needs your approval of edits. Tick the approval, then send again.";case"authority_not_allowed":return t||"This Agent’s policy doesn’t allow edits in a resumed session. Change it in Config.";case"action_unavailable":return t||"This runtime can’t do that in this session. Choose another action.";case"provider_failed":return"The runtime failed this turn. Nothing moved to another session; try again later.";default:return t||"The exchange could not be started. Your draft is kept; try again."}},"threadHref",0,function(e,t){let n=new URLSearchParams;if(e.thread_agent_id){t&&n.set("exchange",t);let a=n.toString();return`/agents/${encodeURIComponent(e.thread_agent_id)}/conversations/${encodeURIComponent(e.id)}${a?`?${a}`:""}`}if("group"!==e.kind)return null;t&&n.set("exchange",t);let a=n.toString();return`/threads/${encodeURIComponent(e.id)}${a?`?${a}`:""}`},"validateDraft",0,function(e){let t={},n=e.instruction.trim(),a="ask"===e.mode?"a question":"an objective";return n?e.instruction.length>4e3&&(t.instruction="Keep it under 4000 characters."):t.instruction=`Enter ${a}.`,e.originConversationId||(t.origin="Choose the thread that follows this exchange."),"continue"!==e.mode||e.destinationAgentId||(t.destination="Choose the Agent who continues the work."),t},"validateResumeDraft",0,function(e,t){let n={};return e.trim()?e.length>4e3&&(n.instruction="Keep it under 4000 characters."):n.instruction="Enter what to work on.",t||(n.approval="Approve edits in this session to resume work here."),n}],50814)},22016,(e,t,n)=>{"use strict";e.i(47167),Object.defineProperty(n,"__esModule",{value:!0});var a={default:function(){return x},useLinkStatus:function(){return v}};for(var r in a)Object.defineProperty(n,r,{enumerable:!0,get:a[r]});let s=e.r(90809),i=e.r(43476),o=s._(e.r(71645)),l=e.r(95057),c=e.r(8372),u=e.r(18581),d=e.r(18967),h=e.r(5550),f=e.r(88540),p=e.r(91949),g=e.r(73668),m=e.r(9396);function x(t){var n;let a,r,s,[x,v]=(0,o.useOptimistic)(p.IDLE_LINK_STATUS),y=(0,o.useRef)(null),{href:_,as:$,children:j,prefetch:w=null,passHref:k,replace:N,shallow:C,scroll:S,onClick:E,onMouseEnter:T,onTouchStart:R,legacyBehavior:A=!1,onNavigate:L,transitionTypes:I,ref:O,unstable_dynamicOnHover:P,...U}=t;a=j,A&&("string"==typeof a||"number"==typeof a)&&(a=(0,i.jsx)("a",{children:a}));let q=o.default.useContext(c.AppRouterContext),D=!1!==w,F=!1===w?"none":!0===w?"full":"auto",M="none"!==F?"auto"===F?m.FetchStrategy.PPR:m.FetchStrategy.Full:m.FetchStrategy.PPR,H="string"==typeof(n=$||_)?n:(0,l.formatUrl)(n);if(A){if(a?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});r=o.default.Children.only(a)}let B=A?r&&"object"==typeof r&&r.ref:O,K,Q=o.default.useCallback(e=>(null!==q&&(y.current=(0,p.mountLinkInstance)(e,H,q,M,D,v,K)),()=>{y.current&&((0,p.unmountLinkForCurrentNavigation)(y.current),y.current=null),(0,p.unmountPrefetchableInstance)(e)}),[D,H,q,M,v,K]),z={ref:(0,u.useMergedRef)(Q,B),onClick(t){A||"function"!=typeof E||E(t),A&&r.props&&"function"==typeof r.props.onClick&&r.props.onClick(t),!q||t.defaultPrevented||function(t,n,a,r,s,i,l,c="none"){if("u">typeof window){let u,{nodeName:d}=t.currentTarget;if("A"===d.toUpperCase()&&((u=t.currentTarget.getAttribute("target"))&&"_self"!==u||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,g.isLocalURL)(n)){r&&(t.preventDefault(),location.replace(n));return}if(t.preventDefault(),i){let e=!1;if(i({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:h}=e.r(99781);o.default.startTransition(()=>{h(n,r?"replace":"push",!1===s?f.ScrollBehavior.NoScroll:f.ScrollBehavior.Default,a.current,l,c)})}}(t,H,y,N,S,L,I,F)},onMouseEnter(e){A||"function"!=typeof T||T(e),A&&r.props&&"function"==typeof r.props.onMouseEnter&&r.props.onMouseEnter(e),q&&D&&(0,p.onNavigationIntent)(e.currentTarget,!0===P)},onTouchStart:function(e){A||"function"!=typeof R||R(e),A&&r.props&&"function"==typeof r.props.onTouchStart&&r.props.onTouchStart(e),q&&D&&(0,p.onNavigationIntent)(e.currentTarget,!0===P)}};return(0,d.isAbsoluteUrl)(H)?z.href=H:A&&!k&&("a"!==r.type||"href"in r.props)||(z.href=(0,h.addBasePath)(H)),s=A?o.default.cloneElement(r,z):(0,i.jsx)("a",{...U,...z,children:a}),(0,i.jsx)(b.Provider,{value:x,children:s})}let b=(0,o.createContext)(p.IDLE_LINK_STATUS),v=()=>(0,o.useContext)(b);("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},18581,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"useMergedRef",{enumerable:!0,get:function(){return r}});let a=e.r(71645);function r(e,t){let n=(0,a.useRef)(null),r=(0,a.useRef)(null);return(0,a.useCallback)(a=>{if(null===a){let e=n.current;e&&(n.current=null,e());let t=r.current;t&&(r.current=null,t())}else e&&(n.current=s(e,a)),t&&(r.current=s(t,a))},[e,t])}function s(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let n=e(t);return"function"==typeof n?n:()=>e(null)}}("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},73668,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"isLocalURL",{enumerable:!0,get:function(){return s}});let a=e.r(18967),r=e.r(52817);function s(e){if(!(0,a.isAbsoluteUrl)(e))return!0;try{let t=(0,a.getLocationOrigin)(),n=new URL(e,t);return n.origin===t&&(0,r.hasBasePath)(n.pathname)}catch(e){return!1}}},98183,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var a={assign:function(){return l},searchParamsToUrlQuery:function(){return s},urlQueryToSearchParams:function(){return o}};for(var r in a)Object.defineProperty(n,r,{enumerable:!0,get:a[r]});function s(e){let t={};for(let[n,a]of e.entries()){let e=t[n];void 0===e?t[n]=a:Array.isArray(e)?e.push(a):t[n]=[e,a]}return t}function i(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function o(e){let t=new URLSearchParams;for(let[n,a]of Object.entries(e))if(Array.isArray(a))for(let e of a)t.append(n,i(e));else t.set(n,i(a));return t}function l(e,...t){for(let n of t){for(let t of n.keys())e.delete(t);for(let[t,a]of n.entries())e.append(t,a)}return e}},95057,(e,t,n)=>{"use strict";e.i(47167),Object.defineProperty(n,"__esModule",{value:!0});var a={formatUrl:function(){return o},formatWithValidation:function(){return c},urlObjectKeys:function(){return l}};for(var r in a)Object.defineProperty(n,r,{enumerable:!0,get:a[r]});let s=e.r(90809)._(e.r(98183)),i=/https?|ftp|gopher|file/;function o(e){let{auth:t,hostname:n}=e,a=e.protocol||"",r=e.pathname||"",o=e.hash||"",l=e.query||"",c=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?c=t+e.host:n&&(c=t+(~n.indexOf(":")?`[${n}]`:n),e.port&&(c+=":"+e.port)),l&&"object"==typeof l&&(l=String(s.urlQueryToSearchParams(l)));let u=e.search||l&&`?${l}`||"";return a&&!a.endsWith(":")&&(a+=":"),e.slashes||(!a||i.test(a))&&!1!==c?(c="//"+(c||""),r&&"/"!==r[0]&&(r="/"+r)):c||(c=""),o&&"#"!==o[0]&&(o="#"+o),u&&"?"!==u[0]&&(u="?"+u),r=r.replace(/[?#]/g,encodeURIComponent),u=u.replace("#","%23"),`${a}${c}${r}${u}${o}`}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function c(e){return o(e)}},18967,(e,t,n)=>{"use strict";e.i(47167),Object.defineProperty(n,"__esModule",{value:!0});var a={DecodeError:function(){return x},MiddlewareNotFoundError:function(){return _},MissingStaticPage:function(){return y},NormalizeError:function(){return b},PageNotFoundError:function(){return v},SP:function(){return g},ST:function(){return m},WEB_VITALS:function(){return s},execOnce:function(){return i},getDisplayName:function(){return d},getLocationOrigin:function(){return c},getURL:function(){return u},isAbsoluteUrl:function(){return l},isResSent:function(){return h},loadGetInitialProps:function(){return p},normalizeRepeatedSlashes:function(){return f},stringifyError:function(){return $}};for(var r in a)Object.defineProperty(n,r,{enumerable:!0,get:a[r]});let s=["CLS","FCP","FID","INP","LCP","TTFB"];function i(e){let t,n=!1;return(...a)=>(n||(n=!0,t=e(...a)),t)}let o=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,l=e=>{let t=e.charCodeAt(0);return!!(t>=65&&t<=90||t>=97&&t<=122)&&o.test(e)};function c(){let{protocol:e,hostname:t,port:n}=window.location;return`${e}//${t}${n?":"+n:""}`}function u(){let{href:e}=window.location,t=c();return e.substring(t.length)}function d(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function h(e){return e.finished||e.headersSent}function f(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function p(e,t){let n=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await p(t.Component,t.ctx)}:{};let a=await e.getInitialProps(t);if(n&&h(n))return a;if(!a)throw Object.defineProperty(Error(`"${d(e)}.getInitialProps()" should resolve to an object. But found "${a}" instead.`),"__NEXT_ERROR_CODE",{value:"E1025",enumerable:!1,configurable:!0});return a}let g="u">typeof performance,m=g&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class x extends Error{}class b extends Error{}class v extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class y extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class _ extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function $(e){return JSON.stringify({message:e.message,stack:e.stack})}}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,13255,e=>{"use strict";var t=e.i(43476),n=e.i(71645),a=e.i(22016),r=e.i(50814);e.s(["default",0,function({summary:e,onChanged:s}){let[i,o]=(0,n.useState)(!1),[l,c]=(0,n.useState)(""),u=(0,r.stateTone)(e.state),d=(0,r.outcomeLine)(e),h=(0,r.failureAdvice)(e),f=`exchange-${e.id}-title`,p=async()=>{if(!i){o(!0),c("");try{let t=await fetch(`/api/exchanges/${encodeURIComponent(e.id)}/cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!t.ok){let e=await t.json().catch(()=>null);c("string"==typeof e?.error?.message?e.error.message:"Could not cancel. Try again.")}}catch{c("Could not cancel. Try again.")}finally{o(!1),s?.()}}};return(0,t.jsxs)("article",{id:`exchange-${e.id}`,className:`exchange-card is-${u} is-${e.state}`,"data-exchange-id":e.id,"data-exchange-state":e.state,"aria-labelledby":f,tabIndex:-1,children:[(0,t.jsxs)("p",{className:"exchange-card-line",children:[(0,t.jsx)("span",{className:"exchange-card-mode",children:(0,r.modeLabel)(e.mode)}),(0,t.jsx)("span",{id:f,className:"exchange-card-title",children:(0,r.participantsLabel)(e)}),(0,t.jsx)("span",{className:"exchange-card-state",role:"status",children:(0,r.liveStateLabel)(e)})]}),(0,t.jsx)("p",{className:"exchange-card-session",children:(0,r.sessionLabel)(e)}),(0,t.jsxs)("p",{className:"exchange-card-instruction",children:[(0,t.jsx)("span",{className:"exchange-card-key",children:(0,r.instructionHeading)(e.mode)})," ",(0,r.excerpt)(e.instruction,220)]}),d?(0,t.jsx)("p",{className:"failed"===e.state?"exchange-card-outcome is-failure":"exchange-card-outcome",children:d}):null,h?(0,t.jsx)("p",{className:"exchange-card-advice",children:h}):null,l?(0,t.jsx)("p",{className:"exchange-card-error",role:"alert",children:l}):null,(0,t.jsxs)("p",{className:"exchange-card-foot",children:[(0,t.jsxs)("span",{className:"exchange-card-time",children:["Updated ",(0,r.formatExchangeTime)(e.updated_at)]}),(0,t.jsx)(a.default,{className:"exchange-card-link",href:(0,r.detailsHref)(e.id),"aria-label":`Details: ${(0,r.modeLabel)(e.mode)} ${(0,r.participantsLabel)(e)}`,children:"Details"}),e.can_cancel?(0,t.jsx)("button",{type:"button",className:"exchange-card-cancel",disabled:i,onClick:()=>{p()},children:i?"Cancelling…":"Cancel"}):null]})]})}])},87164,e=>{"use strict";var t=e.i(43476),n=e.i(71645),a=e.i(22016),r=e.i(13255),s=e.i(50814);let i="botmancers:exchanges-navigate";function o(e){return window.addEventListener("popstate",e),window.addEventListener(i,e),()=>{window.removeEventListener("popstate",e),window.removeEventListener(i,e)}}function l(){return new URLSearchParams(window.location.search).get("id")}function c({id:e,onBack:i,onChanged:o}){let[l,u]=(0,n.useState)(null),[d,h]=(0,n.useState)(""),[f,p]=(0,n.useState)(0),g=(0,n.useRef)(null),m=(0,n.useRef)(!1),x=(0,n.useId)();(0,n.useEffect)(()=>{let t=!1,n=()=>{fetch(`/api/exchanges/${encodeURIComponent(e)}`,{cache:"no-store"}).then(async e=>{let n=await e.json().catch(()=>null);if(!t){if(!e.ok||!n?.detail)return void h(404===e.status?"This exchange no longer exists.":"Could not load this exchange.");h(""),u(n.detail)}}).catch(()=>{t||h("Could not load this exchange.")})};n();let a=setInterval(n,2e3);return()=>{t=!0,clearInterval(a)}},[e,f]),(0,n.useEffect)(()=>{l&&!m.current&&(m.current=!0,g.current?.focus())},[l]);let b=(0,t.jsx)("button",{type:"button",className:"pin-word ledger-detail-back",onClick:i,children:"← All exchanges"});if(!l)return(0,t.jsxs)("div",{className:"ledger-detail",children:[b,d?(0,t.jsxs)("div",{role:"alert",className:"ledger-state",children:[(0,t.jsx)("p",{className:"delete-error",children:d}),(0,t.jsx)("button",{type:"button",className:"pin-word",onClick:()=>p(e=>e+1),children:"Retry"})]}):(0,t.jsx)("p",{className:"ledger-state",role:"status",children:"Loading exchange…"})]});let{summary:v,events:_,packet:y}=l;return(0,t.jsxs)("article",{className:"ledger-detail","aria-labelledby":x,"data-exchange-detail":v.id,children:[b,(0,t.jsxs)("h2",{id:x,ref:g,tabIndex:-1,className:"ledger-detail-title",children:[(0,s.modeLabel)(v.mode),": ",(0,s.participantsLabel)(v)]}),(0,t.jsx)(r.default,{summary:v,onChanged:()=>{p(e=>e+1),o()}}),(0,t.jsxs)("section",{className:"ledger-section","aria-label":(0,s.instructionHeading)(v.mode),children:[(0,t.jsx)("h3",{className:"ledger-section-title",children:(0,s.instructionHeading)(v.mode)}),(0,t.jsx)("p",{className:"ledger-text",children:v.instruction})]}),l.answer?(0,t.jsxs)("section",{className:"ledger-section","aria-label":"Answer",children:[(0,t.jsx)("h3",{className:"ledger-section-title",children:"Answer"}),(0,t.jsx)("p",{className:"ledger-text",children:l.answer})]}):null,y?(0,t.jsxs)("section",{className:"ledger-section","aria-label":"Handoff packet",children:[(0,t.jsx)("h3",{className:"ledger-section-title",children:"Handoff packet"}),(0,t.jsx)("p",{className:"ledger-text",children:y.objective}),[["Decisions",y.decisions],["Constraints",y.constraints],["Artifacts and references",y.artifacts],["Open questions",y.open_questions]].filter(([,e])=>e.length>0).map(([e,n])=>(0,t.jsxs)("div",{className:"ledger-packet-list",children:[(0,t.jsx)("h4",{className:"ledger-packet-title",children:e}),(0,t.jsx)("ul",{children:n.map((e,n)=>(0,t.jsx)("li",{children:e},n))})]},e))]}):null,(0,t.jsxs)("section",{className:"ledger-section","aria-label":"Linked threads",children:[(0,t.jsx)("h3",{className:"ledger-section-title",children:"Linked threads"}),(0,t.jsx)("ul",{className:"ledger-links",children:v.links.map(e=>{let n=(0,s.threadHref)(e,v.id);return(0,t.jsxs)("li",{children:[n?(0,t.jsx)(a.default,{className:"session-link ledger-thread-link",href:n,children:e.label}):(0,t.jsxs)("span",{children:[e.label,"agent_api"===e.kind?(0,t.jsx)("span",{className:"ledger-link-role",children:" (between agents, not an owner thread)"}):null]}),(0,t.jsxs)("span",{className:"ledger-link-role",children:[" · ",(0,s.linkRoleLabel)(e.roles)]})]},e.id)})})]}),(0,t.jsxs)("section",{className:"ledger-section","aria-label":"Timeline",children:[(0,t.jsx)("h3",{className:"ledger-section-title",children:"Timeline"}),(0,t.jsx)("ol",{className:"ledger-timeline",children:_.map(e=>(0,t.jsxs)("li",{"data-event-type":e.type,children:[(0,t.jsx)("span",{className:"ledger-timeline-time",children:(0,s.formatExchangeTime)(e.at)}),(0,t.jsx)("span",{className:"ledger-timeline-text",children:(0,s.eventLabel)(e,v)})]},e.sequence))})]}),(0,t.jsxs)("p",{className:"ledger-foot",children:[(0,s.excerpt)(`${v.source.agent_name}’s session: ${v.source.session_title}`,200),v.destination?.session_title?` \xb7 ${v.destination.agent_name}’s new session: ${v.destination.session_title}`:""]})]})}e.s(["default",0,function(){let[e,r]=(0,n.useState)(null),[u,d]=(0,n.useState)(""),[h,f]=(0,n.useState)(0),[p,g]=(0,n.useState)(s.DEFAULT_LEDGER_FILTER),m=(0,n.useSyncExternalStore)(o,l,()=>null),x=(0,n.useId)(),b=(0,n.useId)(),v=(0,n.useId)(),_=(0,n.useRef)(null),y=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=y.current;if(y.current=m,m||!e)return;let t=document.querySelector(`.ledger-row[data-exchange-id="${CSS.escape(e)}"]`);(t??_.current)?.focus()},[m]),(0,n.useEffect)(()=>{let e=!1,t=()=>{fetch("/api/exchanges",{cache:"no-store"}).then(async t=>{let n=await t.json().catch(()=>null);if(!e){if(!t.ok||!Array.isArray(n?.exchanges))return void d("string"==typeof n?.error?.message?n.error.message:"Could not load exchanges.");d(""),r(n.exchanges)}}).catch(()=>{e||d("Could not load exchanges.")})};t();let n=setInterval(t,2e3);return()=>{e=!0,clearInterval(n)}},[h]);let $=e=>{window.history.pushState(null,"",e?`/exchanges?id=${encodeURIComponent(e)}`:"/exchanges"),window.dispatchEvent(new Event(i))},j=e?(0,s.ledgerRows)(e,p):[],w=(0,s.ledgerView)(e,e?"":u,j),k=e?(0,s.ledgerAgents)(e):[];return(0,t.jsxs)("div",{className:m?"ledger-page has-detail":"ledger-page",children:[(0,t.jsxs)("header",{className:"ledger-head",children:[(0,t.jsx)(a.default,{href:"/",className:"cfg-link ledger-back",children:"← Back to chat"}),(0,t.jsx)("h1",{className:"ledger-title",children:"Agent Exchanges"}),(0,t.jsx)("p",{className:"ledger-sub",children:"Every Ask and Continue between agent sessions, newest activity first."})]}),(0,t.jsxs)("main",{className:"ledger-main",children:[(0,t.jsxs)("section",{className:"ledger-list-pane","aria-labelledby":v,children:[(0,t.jsx)("h2",{id:v,ref:_,tabIndex:-1,className:"ledger-pane-title",children:"Exchanges"}),(0,t.jsxs)("div",{className:"ledger-filters",children:[(0,t.jsx)("div",{className:"sessions-filter ledger-mode",role:"group","aria-label":"Mode",children:s.MODE_FILTER_OPTIONS.map(e=>(0,t.jsx)("button",{type:"button",className:"sessions-filter-btn","aria-pressed":p.mode===e.value,onClick:()=>g(t=>({...t,mode:e.value})),children:e.label},e.value))}),(0,t.jsxs)("div",{className:"ledger-selects",children:[(0,t.jsxs)("label",{className:"ledger-select-label",htmlFor:x,children:["Status",(0,t.jsx)("select",{id:x,className:"exchange-select",value:p.state,onChange:e=>g(t=>({...t,state:e.target.value})),children:s.STATE_FILTER_OPTIONS.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,t.jsxs)("label",{className:"ledger-select-label",htmlFor:b,children:["Agent",(0,t.jsxs)("select",{id:b,className:"exchange-select",value:p.agentId,onChange:e=>g(t=>({...t,agentId:e.target.value})),children:[(0,t.jsx)("option",{value:"",children:"Any Agent"}),k.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))]})]})]}),(0,t.jsx)("p",{className:"manage-count ledger-count",role:"status",children:e?`${j.length} of ${e.length} shown`:""})]}),"loading"===w?(0,t.jsx)("p",{className:"ledger-state",role:"status","data-ledger-state":"loading",children:"Loading exchanges…"}):null,"error"===w?(0,t.jsxs)("div",{className:"ledger-state",role:"alert","data-ledger-state":"error",children:[(0,t.jsx)("p",{className:"delete-error",children:u}),(0,t.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{d(""),f(e=>e+1)},children:"Retry"})]}):null,"empty"===w?(0,t.jsx)("p",{className:"ledger-state","data-ledger-state":"empty",children:"No exchanges yet. Open an agent’s Sessions and choose Ask from this context or Hand off to… to start one."}):null,"filtered-out"===w?(0,t.jsxs)("div",{className:"ledger-state","data-ledger-state":"filtered-out",children:[(0,t.jsx)("p",{children:"No exchanges match these filters."}),(0,t.jsx)("button",{type:"button",className:"pin-word",onClick:()=>g(s.DEFAULT_LEDGER_FILTER),children:"Clear filters"})]}):null,"rows"===w?(0,t.jsx)("ol",{className:"ledger-list","aria-label":"Exchanges, newest activity first",children:j.map(e=>(0,t.jsx)("li",{className:"ledger-row-item",children:(0,t.jsxs)("button",{type:"button",className:`ledger-row is-${(0,s.stateTone)(e.state)}`,"data-exchange-id":e.id,"aria-current":m===e.id?"true":void 0,onClick:()=>$(e.id),children:[(0,t.jsxs)("span",{className:"ledger-row-line",children:[(0,t.jsx)("span",{className:"exchange-card-mode",children:(0,s.modeLabel)(e.mode)}),(0,t.jsx)("span",{className:"ledger-row-who",children:(0,s.participantsLabel)(e)}),(0,t.jsx)("span",{className:"ledger-row-state",children:(0,s.liveStateLabel)(e)})]}),(0,t.jsx)("span",{className:"ledger-row-session",children:e.source.session_title}),(0,t.jsxs)("span",{className:"ledger-row-meta",children:["From ",e.origin?.label??"an unknown thread"," · Started ",(0,s.formatExchangeTime)(e.created_at)," · Updated ",(0,s.formatExchangeTime)(e.updated_at)]})]})},e.id))}):null]}),(0,t.jsx)("section",{className:"ledger-detail-pane","aria-label":"Exchange detail",children:m?(0,t.jsx)(c,{id:m,onBack:()=>$(null),onChanged:()=>f(e=>e+1)},m):(0,t.jsx)("p",{className:"ledger-state ledger-placeholder",children:"Choose an exchange to see its timeline and linked threads."})})]})]})}])},50814,63352,e=>{"use strict";function t(e){return`${new Date(e).toISOString().slice(0,16).replace("T"," ")} UTC`}function n(e){return e?e.split("/").filter(e=>e.length>0).pop()??null:null}function a(e,t){let n=function(e){if(!e)return null;let t=e.toLowerCase();return"muse code"===t?"muse":(["codex","claude","cursor","hermes","muse"].includes(t),t)}(t);switch(e){case"provider_unavailable":return n?{reason:`${n} is not installed or did not start`,fix:`Install ${n} and Retry.`}:{reason:"the runtime is not installed or did not start",fix:"Install the runtime and Retry."};case"auth_required":return{reason:"not signed in",fix:"Sign in and Retry."};case"permission_denied":return{reason:"permission denied",fix:"Check permissions and Retry."};case"incompatible_version":return{reason:"incompatible version",fix:"Update the runtime and Retry."};case"usage_limit":return{reason:"usage limit reached",fix:"Wait or upgrade and Retry."};case"scope_missing":return{reason:"no session scope is set",fix:"Choose a scope in Config."};case"provider_failed":return{reason:"the listing failed",fix:"Retry."};default:return{reason:e,fix:"Retry."}}}let r="Not reported";function s(e){return e.toFixed(1).replace(/\.0$/,"")}function i(e){return e.toLocaleString("en-US")}function o(e){return 0===e?"$0.00":e>=.01?`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`:e<1e-4?"<$0.0001":`$${e.toFixed(4)}`}let l={input_tokens:"Input tokens",output_tokens:"Output tokens",cost_usd:"Cost"};function c(e,t,n){return"cost_usd"===e?o(t):n?i(t):t<1e3?String(t):t<999950?`${s(t/1e3)}k`:t<99995e4?`${s(t/1e6)}M`:`${s(t/1e9)}B`}function u(e){return`${e} ${1===e?"run":"runs"}`}function d(e,t,n=!1){let a=l[e];if(!t||"unavailable"===t.quality||null===t.sum)return{name:a,text:r,quality:"unavailable",coverage:t&&t.total>0?`0 of ${u(t.total)} reported`:"No runs recorded",label:`${a}: not reported`};let s=c(e,t.sum,n),i=c(e,t.sum,!0);return"partial"===t.quality?{name:a,text:s,quality:"partial",coverage:`Partial: ${t.known} of ${u(t.total)} reported`,label:`${a}: at least ${i}, partial, reported by ${t.known} of ${u(t.total)}`}:{name:a,text:s,quality:"complete",coverage:`All ${u(t.total)} reported`,label:`${a}: ${i}, reported by all ${u(t.total)}`}}e.s(["SESSION_FILTER_OPTIONS",0,[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"ended",label:"Ended"}],"attemptLabel",0,function(e){let t="source"===e.role?"Started the session":"Resumed the session";return`${t} \xb7 ${e.outcome??"running"}`},"emptySessionsCopy",0,function(e,t,n,r){if("active"===e)return`${t} has no active sessions.`;if("ended"===e)return`${t} has no ended sessions.`;if(n?.last_error_code){let{reason:e,fix:t}=a(n.last_error_code,r),s=r?`${r} sessions`:"sessions";return`Could not read ${s}: ${e}. ${t}`}if(n&&null===n.synced_at)return`${t} has not synced sessions yet. Refresh to load past sessions.`;let s=n?.out_of_scope_count??0;return s>0?`${s} ${1===s?"session exists":"sessions exist"} outside ${t}'s scope. Widen the scope to see them.`:`${t} has no sessions yet. One appears after a coding run keeps its runtime context.`},"formatSessionDate",0,t,"formatSyncRelativeTime",0,function(e,t=Date.now()){if(null===e)return"never";let n=Math.max(0,t-e);if(n<6e4)return"just now";let a=Math.floor(n/6e4);if(a<60)return`${a} minute${1===a?"":"s"} ago`;let r=Math.floor(a/60);if(r<24)return`${r} hour${1===r?"":"s"} ago`;let s=Math.floor(r/24);return`${s} day${1===s?"":"s"} ago`},"noMatchingSessionsCopy",0,function(e,t){let a=e.trim();if(a)return`No sessions match “${a}”.`;let r=n(t);return r?`No sessions in ${r}.`:"No sessions match the current filters."},"registrationSessionSyncCopy",0,function(e,t){if("failed"===e.outcome){let{reason:n,fix:r}=a(e.error_code??"provider_failed",t);return`Could not read ${t} sessions: ${n}. ${r}`}if("unsupported"===e.outcome)return`Past sessions are not available for ${t}.`;let n=1===e.imported?"session":"sessions",r=`Loaded ${e.imported} ${n}`;return e.rejected_out_of_scope>0&&(r+=`, ${e.rejected_out_of_scope} outside the scope`),e.complete||(r+=", more remain"),`${r}.`},"runtimeLabel",0,function(e){return e.agent.transport?`${e.agent.adapter} \xb7 ${e.agent.transport}`:e.agent.adapter},"sessionConversationHref",0,function(e){return e.thread_agent_id?`/agents/${encodeURIComponent(e.thread_agent_id)}/conversations`:"group"===e.kind?`/threads/${encodeURIComponent(e.id)}`:null},"sessionOriginChips",0,function(e){let t=[],n=e.origin.work_request?.requester;return n?.kind==="person"?t.push("Human origin"):n?.kind==="bot"?t.push(n.name?`${n.name} Agent`:"Agent origin"):n?.kind==="service"&&t.push("Service origin"),e.origin.conversation&&t.push(e.origin.conversation.label),[...new Set(t)]},"sessionStateTags",0,function(e){let t=[];return(e.home&&t.push("Home"),e.state?.availability==="missing")?[...t,"Missing"]:(e.state?.lifecycle==="archived"&&t.push("Archived"),e.state?.busy&&t.push("Busy"),(e.resumable||e.state?.resumable===!0)&&t.push("Resumable"),t)},"sessionUsageLine",0,function(e){let t=d("input_tokens",e?.input_tokens),n=d("output_tokens",e?.output_tokens),a=d("cost_usd",e?.cost_usd),s=[t,n,a];if(s.every(e=>"unavailable"===e.quality))return{text:r,label:"Usage: not reported",quality:"unavailable",partial:!1};let i=["unavailable"===t.quality?"input not reported":`${t.text} in`,"unavailable"===n.quality?"output not reported":`${n.text} out`,"unavailable"===a.quality?"cost not reported":a.text].join(" · "),o=s.some(e=>"partial"===e.quality),l=o||s.some(e=>"unavailable"===e.quality)?"partial":"complete";return{text:i,label:`Reported usage: ${s.map(e=>e.label).join("; ")}`,quality:l,partial:o}},"statusLabel",0,function(e){return"active"===e.status?"Active":"Ended"},"usageMetricView",0,d,"usageSampleLabel",0,function(e,t){let n="turn"===e.kind?"start"===e.turn_kind?"provider turn, started":"provider turn":"resume"===e.turn_kind?"resumed":"started";return`Run ${t+1} \xb7 ${n}`},"usageSampleValues",0,function(e){return{input:null===e.input_tokens?r:i(e.input_tokens),output:null===e.output_tokens?r:i(e.output_tokens),cost:null===e.cost_usd?r:o(e.cost_usd)}},"workRequestLabel",0,function(e){var t;let n=e.origin.work_request;return n?`${(t=n.execution_kind)?t[0].toUpperCase()+t.slice(1):t} \xb7 ${n.state}`:null},"workspaceFolderName",0,n,"workspaceOptions",0,function(e){let t=[...new Set(e.filter(e=>"string"==typeof e&&e.length>0))],a=t.map(e=>n(e)??e);return t.map((e,t)=>({value:e,label:a.filter(e=>e===a[t]).length>1?e:a[t]})).sort((e,t)=>e.label<t.label?-1:+(e.label>t.label))}],63352);let h={ask:"Ask from this context",resume:"Resume work here",handoff:"Hand off to…"},f=["queued","extracting","delivering","completed","failed","cancelled"],p=["completed","failed","cancelled"];function g(e,t){switch(t){case"queued":return"Queued";case"extracting":return"ask"===e?"Asking the session":"Extracting handoff";case"delivering":return"Delivering handoff";case"completed":return"ask"===e?"Answered":"Handed off";case"failed":return"Failed";case"cancelled":return"Cancelled"}}function m(e,t=140){let n=String(e??"").split("\n").map(e=>e.trim()).filter(e=>e.length>0).join(" ");return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function x(e,t){return t.updated_at-e.updated_at||t.created_at-e.created_at||(e.id<t.id?-1:+(e.id>t.id))}e.s(["DEFAULT_LEDGER_FILTER",0,{mode:"all",state:"all",agentId:""},"INSTRUCTION_LIMIT",0,4e3,"MODE_FILTER_OPTIONS",0,[{value:"all",label:"All"},{value:"ask",label:"Ask"},{value:"continue",label:"Continue"}],"STATE_FILTER_OPTIONS",0,[{value:"all",label:"Any status"},{value:"active",label:"In progress"},{value:"queued",label:"Queued"},{value:"extracting",label:"Asking / extracting"},{value:"delivering",label:"Delivering"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"},{value:"cancelled",label:"Cancelled"}],"detailsHref",0,function(e){return`/exchanges?id=${encodeURIComponent(e)}`},"eventLabel",0,function(e,t){let n=e.data??{},a=t.source.agent_name,r=t.destination?.agent_name??"the destination Agent",s="string"==typeof n.hop?n.hop:null;switch(e.type){case"created":return"ask"===t.mode?`You asked ${a}'s session a question`:`You handed ${a}'s session to ${r}`;case"hop_queued":if("deliver"===s)return`Handoff queued for ${r}'s new session`;return"extract"===s?`Handoff extraction queued in ${a}'s session`:`Question queued for ${a}'s session`;case"hop_started":if("deliver"===s)return`${r} started a new session`;return"extract"===s?`${a}'s session started extracting the handoff`:`${a}'s session started answering`;case"state_changed":{let e="string"==typeof n.to&&f.includes(n.to)?n.to:null;return e?`Now ${g(t.mode,e).toLowerCase()}`:"State changed"}case"answer_returned":return`Answer returned to ${t.origin?.label??"the origin thread"}${n.truncated?" (shortened)":""}`;case"packet_extracted":return"Handoff packet extracted";case"packet_rejected":return`Handoff packet refused${"string"==typeof n.reason?`: ${n.reason}`:""}`;case"destination_replied":return`${r} replied in ${t.destination?.conversation?.label??"its thread"}`;case"destination_session_rejected":return`${r}'s session was not new; the handoff stopped`;case"cancel_requested":return"You asked to cancel";case"hop_result_discarded":return"A late result was discarded";default:return e.type.replace(/_/g," ")}},"excerpt",0,m,"exchangeRequestBody",0,function(e,t,n){let a={mode:e.mode,idempotency_key:n,origin_conversation_id:e.originConversationId,source:{agent_id:t.agentId,session_ref:t.sessionRef},instruction:e.instruction.trim()};return"continue"===e.mode&&(a.destination={agent_id:e.destinationAgentId}),a},"failureAdvice",0,function(e){if("failed"!==e.state)return null;switch(e.failure?.code){case"packet_invalid":case"packet_missing":return"The source session did not return a usable handoff. Start a new Continue with a clearer objective.";case"destination_session_invalid":return"The destination did not start a fresh session. Check its runtime, then start a new Continue.";case"destination_turn_failed":return"Check the destination Agent’s runtime, then start a new Continue from the source session.";case"source_turn_failed":return"Check the source Agent’s runtime, then start a new exchange from its Sessions.";default:return"Start a new exchange from the session to try again."}},"formatExchangeTime",0,function(e){return t(e)},"instructionHeading",0,function(e){return"ask"===e?"Question":"Objective"},"ledgerAgents",0,function(e){let t=new Map;for(let n of e)t.set(n.source.agent_id,n.source.agent_name),n.destination&&t.set(n.destination.agent_id,n.destination.agent_name);return[...t.entries()].map(([e,t])=>({id:e,name:t})).sort((e,t)=>e.name.localeCompare(t.name)||e.id.localeCompare(t.id))},"ledgerRows",0,function(e,t){return e.filter(e=>("all"===t.mode||e.mode===t.mode)&&("active"!==t.state||!e.terminal)&&("all"===t.state||"active"===t.state||e.state===t.state)&&(!t.agentId||e.source.agent_id===t.agentId||e.destination?.agent_id===t.agentId)).sort(x)},"ledgerView",0,function(e,t,n){return null===e?t?"error":"loading":0===e.length?"empty":0===n.length?"filtered-out":"rows"},"linkRoleLabel",0,function(e){let t={origin:"Started here",source:"Source session",destination:"Destination"};return e.map(e=>t[e]).join(" · ")},"liveStateLabel",0,function(e){var t;return e.cancel_requested&&(t=e.state,!p.includes(t))?"Cancelling…":g(e.mode,e.state)},"modeLabel",0,function(e){return"ask"===e?"Ask":"Continue"},"outcomeLine",0,function(e){if("completed"===e.state){if("ask"===e.mode){let t=e.origin?.label??"the origin thread";return e.outcome.answer?`Answer in ${t}: ${m(e.outcome.answer,200)}`:`Answered in ${t}.`}let t=e.destination?.agent_name??"The destination Agent";return e.outcome.reply?`${t} picked it up in a new session: ${m(e.outcome.reply,200)}`:`${t} picked it up in a new session.`}return"failed"===e.state?e.failure?.message||"The exchange failed.":"cancelled"===e.state?"Cancelled before it finished. Nothing more will run.":null},"participantsLabel",0,function(e){return"ask"===e.mode?`You → ${e.source.agent_name}`:`${e.source.agent_name} → ${e.destination?.agent_name??"another Agent"}`},"pinRequestBody",0,function(e,t,n,a,r){return{action:e,content:t.trim(),conversation_id:n,idempotency_key:r,..."resume"===e?{approve_write:a}:{}}},"sessionDialogMode",0,function(e){return"handoff"===e?"continue":e},"sessionDialogTitle",0,function(e){return h["continue"===e?"handoff":e]},"sessionDialogUsesPin",0,function(e,t){return"resume"===e||"ask"===e&&"provider"===t},"sessionLabel",0,function(e){return`${e.source.agent_name}'s session “${e.source.session_title}”`},"sessionRowActions",0,function(e){let t;if(e.actions)t=e.actions;else{let n="ended"===e.status?{available:!1,reason:"Ask from this context and Hand off to… are unavailable: this session has ended. Its history stays here."}:e.resumable?{available:!0}:{available:!1,reason:`Ask from this context and Hand off to… are unavailable: Botmancers can’t resume this session under ${e.agent.name}’s current runtime.`},a=n.available?{available:!0}:{available:!1,code:"ended"===e.status?"session_ended":"session_not_resumable",reason:n.reason,recovery:"choose_session"};t={ask:a,resume:{available:!1,code:"action_unavailable",reason:`${h.resume} is unavailable: this runtime can’t resume a session with edits.`,recovery:"choose_action"},handoff:a}}return["ask","resume","handoff"].map(e=>({action:e,label:h[e],availability:t[e]}))},"stateTone",0,function(e){return"completed"===e?"done":"failed"===e||"cancelled"===e?"stopped":"active"},"submitErrorMessage",0,function(e,t){switch(e){case"session_ended":return"This session has ended and can’t be resumed.";case"session_not_resumable":return"Botmancers can’t resume this session under the agent’s current runtime.";case"source_session_busy":return"This session already has an exchange in progress. Wait for it or cancel it from its card.";case"agent_unavailable":return t||"That Agent can’t launch yet. Choose its runtime connection and session scope in Config.";case"idempotency_conflict":return"This request changed while it was being sent. Send again.";case"session_missing":return"The runtime no longer has this session. Its history stays here; choose another session.";case"approval_required":return"Resume work here needs your approval of edits. Tick the approval, then send again.";case"authority_not_allowed":return t||"This agent’s policy doesn’t allow edits in a resumed session. Change it in Config.";case"action_unavailable":return t||"This runtime can’t do that in this session. Choose another action.";case"provider_failed":return"The runtime failed this turn. Nothing moved to another session; try again later.";default:return t||"The exchange could not be started. Your draft is kept; try again."}},"threadHref",0,function(e,t){let n=new URLSearchParams;if(e.thread_agent_id){t&&n.set("exchange",t);let a=n.toString();return`/agents/${encodeURIComponent(e.thread_agent_id)}/conversations/${encodeURIComponent(e.id)}${a?`?${a}`:""}`}if("group"!==e.kind)return null;t&&n.set("exchange",t);let a=n.toString();return`/threads/${encodeURIComponent(e.id)}${a?`?${a}`:""}`},"validateDraft",0,function(e){let t={},n=e.instruction.trim(),a="ask"===e.mode?"a question":"an objective";return n?e.instruction.length>4e3&&(t.instruction="Keep it under 4000 characters."):t.instruction=`Enter ${a}.`,e.originConversationId||(t.origin="Choose the thread that follows this exchange."),"continue"!==e.mode||e.destinationAgentId||(t.destination="Choose the agent who continues the work."),t},"validateResumeDraft",0,function(e,t){let n={};return e.trim()?e.length>4e3&&(n.instruction="Keep it under 4000 characters."):n.instruction="Enter what to work on.",t||(n.approval="Approve edits in this session to resume work here."),n}],50814)},22016,(e,t,n)=>{"use strict";e.i(47167),Object.defineProperty(n,"__esModule",{value:!0});var a={default:function(){return x},useLinkStatus:function(){return v}};for(var r in a)Object.defineProperty(n,r,{enumerable:!0,get:a[r]});let s=e.r(90809),i=e.r(43476),o=s._(e.r(71645)),l=e.r(95057),c=e.r(8372),u=e.r(18581),d=e.r(18967),h=e.r(5550),f=e.r(88540),p=e.r(91949),g=e.r(73668),m=e.r(9396);function x(t){var n;let a,r,s,[x,v]=(0,o.useOptimistic)(p.IDLE_LINK_STATUS),_=(0,o.useRef)(null),{href:y,as:$,children:j,prefetch:w=null,passHref:k,replace:N,shallow:C,scroll:S,onClick:E,onMouseEnter:T,onTouchStart:R,legacyBehavior:L=!1,onNavigate:I,transitionTypes:A,ref:O,unstable_dynamicOnHover:P,...U}=t;a=j,L&&("string"==typeof a||"number"==typeof a)&&(a=(0,i.jsx)("a",{children:a}));let q=o.default.useContext(c.AppRouterContext),D=!1!==w,F=!1===w?"none":!0===w?"full":"auto",M="none"!==F?"auto"===F?m.FetchStrategy.PPR:m.FetchStrategy.Full:m.FetchStrategy.PPR,H="string"==typeof(n=$||y)?n:(0,l.formatUrl)(n);if(L){if(a?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});r=o.default.Children.only(a)}let B=L?r&&"object"==typeof r&&r.ref:O,K,Q=o.default.useCallback(e=>(null!==q&&(_.current=(0,p.mountLinkInstance)(e,H,q,M,D,v,K)),()=>{_.current&&((0,p.unmountLinkForCurrentNavigation)(_.current),_.current=null),(0,p.unmountPrefetchableInstance)(e)}),[D,H,q,M,v,K]),z={ref:(0,u.useMergedRef)(Q,B),onClick(t){L||"function"!=typeof E||E(t),L&&r.props&&"function"==typeof r.props.onClick&&r.props.onClick(t),!q||t.defaultPrevented||function(t,n,a,r,s,i,l,c="none"){if("u">typeof window){let u,{nodeName:d}=t.currentTarget;if("A"===d.toUpperCase()&&((u=t.currentTarget.getAttribute("target"))&&"_self"!==u||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,g.isLocalURL)(n)){r&&(t.preventDefault(),location.replace(n));return}if(t.preventDefault(),i){let e=!1;if(i({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:h}=e.r(99781);o.default.startTransition(()=>{h(n,r?"replace":"push",!1===s?f.ScrollBehavior.NoScroll:f.ScrollBehavior.Default,a.current,l,c)})}}(t,H,_,N,S,I,A,F)},onMouseEnter(e){L||"function"!=typeof T||T(e),L&&r.props&&"function"==typeof r.props.onMouseEnter&&r.props.onMouseEnter(e),q&&D&&(0,p.onNavigationIntent)(e.currentTarget,!0===P)},onTouchStart:function(e){L||"function"!=typeof R||R(e),L&&r.props&&"function"==typeof r.props.onTouchStart&&r.props.onTouchStart(e),q&&D&&(0,p.onNavigationIntent)(e.currentTarget,!0===P)}};return(0,d.isAbsoluteUrl)(H)?z.href=H:L&&!k&&("a"!==r.type||"href"in r.props)||(z.href=(0,h.addBasePath)(H)),s=L?o.default.cloneElement(r,z):(0,i.jsx)("a",{...U,...z,children:a}),(0,i.jsx)(b.Provider,{value:x,children:s})}let b=(0,o.createContext)(p.IDLE_LINK_STATUS),v=()=>(0,o.useContext)(b);("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},18581,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"useMergedRef",{enumerable:!0,get:function(){return r}});let a=e.r(71645);function r(e,t){let n=(0,a.useRef)(null),r=(0,a.useRef)(null);return(0,a.useCallback)(a=>{if(null===a){let e=n.current;e&&(n.current=null,e());let t=r.current;t&&(r.current=null,t())}else e&&(n.current=s(e,a)),t&&(r.current=s(t,a))},[e,t])}function s(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let n=e(t);return"function"==typeof n?n:()=>e(null)}}("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},73668,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"isLocalURL",{enumerable:!0,get:function(){return s}});let a=e.r(18967),r=e.r(52817);function s(e){if(!(0,a.isAbsoluteUrl)(e))return!0;try{let t=(0,a.getLocationOrigin)(),n=new URL(e,t);return n.origin===t&&(0,r.hasBasePath)(n.pathname)}catch(e){return!1}}},98183,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var a={assign:function(){return l},searchParamsToUrlQuery:function(){return s},urlQueryToSearchParams:function(){return o}};for(var r in a)Object.defineProperty(n,r,{enumerable:!0,get:a[r]});function s(e){let t={};for(let[n,a]of e.entries()){let e=t[n];void 0===e?t[n]=a:Array.isArray(e)?e.push(a):t[n]=[e,a]}return t}function i(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function o(e){let t=new URLSearchParams;for(let[n,a]of Object.entries(e))if(Array.isArray(a))for(let e of a)t.append(n,i(e));else t.set(n,i(a));return t}function l(e,...t){for(let n of t){for(let t of n.keys())e.delete(t);for(let[t,a]of n.entries())e.append(t,a)}return e}},95057,(e,t,n)=>{"use strict";e.i(47167),Object.defineProperty(n,"__esModule",{value:!0});var a={formatUrl:function(){return o},formatWithValidation:function(){return c},urlObjectKeys:function(){return l}};for(var r in a)Object.defineProperty(n,r,{enumerable:!0,get:a[r]});let s=e.r(90809)._(e.r(98183)),i=/https?|ftp|gopher|file/;function o(e){let{auth:t,hostname:n}=e,a=e.protocol||"",r=e.pathname||"",o=e.hash||"",l=e.query||"",c=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?c=t+e.host:n&&(c=t+(~n.indexOf(":")?`[${n}]`:n),e.port&&(c+=":"+e.port)),l&&"object"==typeof l&&(l=String(s.urlQueryToSearchParams(l)));let u=e.search||l&&`?${l}`||"";return a&&!a.endsWith(":")&&(a+=":"),e.slashes||(!a||i.test(a))&&!1!==c?(c="//"+(c||""),r&&"/"!==r[0]&&(r="/"+r)):c||(c=""),o&&"#"!==o[0]&&(o="#"+o),u&&"?"!==u[0]&&(u="?"+u),r=r.replace(/[?#]/g,encodeURIComponent),u=u.replace("#","%23"),`${a}${c}${r}${u}${o}`}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function c(e){return o(e)}},18967,(e,t,n)=>{"use strict";e.i(47167),Object.defineProperty(n,"__esModule",{value:!0});var a={DecodeError:function(){return x},MiddlewareNotFoundError:function(){return y},MissingStaticPage:function(){return _},NormalizeError:function(){return b},PageNotFoundError:function(){return v},SP:function(){return g},ST:function(){return m},WEB_VITALS:function(){return s},execOnce:function(){return i},getDisplayName:function(){return d},getLocationOrigin:function(){return c},getURL:function(){return u},isAbsoluteUrl:function(){return l},isResSent:function(){return h},loadGetInitialProps:function(){return p},normalizeRepeatedSlashes:function(){return f},stringifyError:function(){return $}};for(var r in a)Object.defineProperty(n,r,{enumerable:!0,get:a[r]});let s=["CLS","FCP","FID","INP","LCP","TTFB"];function i(e){let t,n=!1;return(...a)=>(n||(n=!0,t=e(...a)),t)}let o=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,l=e=>{let t=e.charCodeAt(0);return!!(t>=65&&t<=90||t>=97&&t<=122)&&o.test(e)};function c(){let{protocol:e,hostname:t,port:n}=window.location;return`${e}//${t}${n?":"+n:""}`}function u(){let{href:e}=window.location,t=c();return e.substring(t.length)}function d(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function h(e){return e.finished||e.headersSent}function f(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function p(e,t){let n=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await p(t.Component,t.ctx)}:{};let a=await e.getInitialProps(t);if(n&&h(n))return a;if(!a)throw Object.defineProperty(Error(`"${d(e)}.getInitialProps()" should resolve to an object. But found "${a}" instead.`),"__NEXT_ERROR_CODE",{value:"E1025",enumerable:!1,configurable:!0});return a}let g="u">typeof performance,m=g&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class x extends Error{}class b extends Error{}class v extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class _ extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class y extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function $(e){return JSON.stringify({message:e.message,stack:e.stack})}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,70925,8880,e=>{"use strict";var a=e.i(43476),n=e.i(71645),t=e.i(22016),s=e.i(18566),i=e.i(87303);let l={cursor:"/brand/harness/cursor.svg",claude:"/brand/harness/claude.svg",codex:"/brand/harness/codex.png",muse:"/brand/harness/muse.svg"};function r({src:e,className:n,size:t=16}){return(0,a.jsx)("span",{className:n?`harness-icon ${n}`:"harness-icon",style:{width:t,height:t},"aria-hidden":"true",children:(0,a.jsx)("img",{src:e,alt:"",width:t,height:t,draggable:!1})})}function c({agent:e,className:n,size:t=16}){let s=l[String(e??"")];return s?(0,a.jsx)(r,{src:s,className:n,size:t}):null}e.s(["HarnessIcon",0,c],8880);var o=e.i(3136);let d={unsupported:"not reported by provider",missing:"no data yet",expired:"expired",unparsable:"provider data unparsable",stale:"stale"},u=new Set(["claude","codex","muse"]);function p(e,a){let n=e.remainingPercent??0,t=Math.round(n),s=e.resetAt?`, resets ${new Date(e.resetAt).toLocaleString()}`:"";return{key:e.windowKey,label:a,kind:"known",remaining:t,rawRemaining:n,title:`${a}: ${t}% remaining${s}`}}function w(e,a,n){return{key:e,label:a,kind:"unknown",reason:n,title:`${a}: N/A (${d[n]})`}}function m(e,a,n,t){let s=e.find(e=>e.criticalRole===a)??null;return s&&null===s.unavailableReason&&null!==s.remainingPercent?p(s,n):s?.unavailableReason?w(s.windowKey,n,s.unavailableReason):w(`missing-${n}`,n,t??"missing")}function h(e){if("cursor"===e.runtime){let a=e.windows.find(e=>"billing_cycle"===e.windowKey)??null;return a&&null===a.unavailableReason&&null!==a.remainingPercent?[p(a,"1M")]:a?.unavailableReason?[w(a.windowKey,"1M",a.unavailableReason)]:[w("missing-1M","1M",e.unavailableReason??"missing")]}return u.has(e.runtime)?[m(e.windows,"five_hour","5H",e.unavailableReason),m(e.windows,"weekly","1W",e.unavailableReason)]:[]}function g({row:e}){var n;if("unknown"===e.kind)return(0,a.jsxs)("span",{className:"topbar-capacity-window is-unknown","data-window":e.label,"data-window-known":"false",title:e.title,children:[(0,a.jsx)("span",{className:"topbar-capacity-window-label",children:e.label}),(0,a.jsx)("span",{children:"N/A"})]});let t=(n=e.rawRemaining)<10?"critical":n<30?"warning":"normal";return(0,a.jsxs)("span",{className:`topbar-capacity-window is-${t}`,"data-window":e.label,"data-window-known":"true","data-severity":t,title:e.title,children:[(0,a.jsx)("span",{className:"topbar-capacity-window-label",children:e.label}),(0,a.jsxs)("span",{children:[e.remaining,"%"]})]})}function b({entry:e}){let n=h(e),t=n.some(e=>"known"===e.kind),s=n.some(e=>"known"===e.kind&&0===e.rawRemaining),i=(0,o.agentLabel)(e.runtime)||e.runtime;return(0,a.jsxs)("span",{className:s?"topbar-capacity-runtime is-exhausted":"topbar-capacity-runtime","data-testid":`topbar-capacity-${e.runtime}`,"data-known":t?"true":"false","data-exhausted":s?"true":"false",role:"group","aria-label":`${i} capacity`,title:n.map(e=>e.title).join("; ")||`${i}: N/A`,children:[(0,a.jsx)(c,{agent:e.runtime,size:16}),0===n.length?(0,a.jsx)("span",{className:"topbar-capacity-window is-unknown",children:"N/A"}):(0,a.jsx)("span",{className:"topbar-capacity-windows",children:n.map(e=>(0,a.jsx)(g,{row:e},e.key))})]})}function v({state:e}){if("loading"===e.status)return(0,a.jsxs)("div",{className:"topbar-capacity","data-testid":"topbar-capacity","data-status":"loading",title:"Runtime capacity is loading",children:[(0,a.jsx)("span",{className:"topbar-capacity-eyebrow",children:"Capacity"}),(0,a.jsx)("span",{"aria-live":"polite",children:"loading…"})]});if("unavailable"===e.status)return(0,a.jsxs)("div",{className:"topbar-capacity","data-testid":"topbar-capacity","data-status":"unavailable",title:"Runtime capacity is unavailable",children:[(0,a.jsx)("span",{className:"topbar-capacity-eyebrow",children:"Capacity"}),(0,a.jsx)("span",{children:"unavailable"})]});let n=e.data.runtimes,t=0===n.length||n.every(e=>!h(e).some(e=>"known"===e.kind));return(0,a.jsxs)("div",{className:"topbar-capacity","data-testid":"topbar-capacity","data-status":t?"unknown":"ready",title:0===n.length?"No coding harness capacity reported":void 0,children:[(0,a.jsx)("span",{className:"topbar-capacity-eyebrow",children:"Capacity"}),0===n.length?(0,a.jsx)("span",{className:"topbar-capacity-empty",children:"N/A"}):n.map(e=>(0,a.jsx)(b,{entry:e},e.runtime))]})}function y({refreshMs:e=6e4}){let[t,s]=(0,n.useState)({status:"loading"});return(0,n.useEffect)(()=>{let a=!1,n=()=>{fetch("/api/runtime-capacity",{cache:"no-store"}).then(async e=>{if(!e.ok)throw Error("capacity request failed");return e.json()}).then(e=>{a||s({status:"ready",data:e})}).catch(()=>{a||s({status:"unavailable"})})};n();let t=window.setInterval(n,e);return()=>{a=!0,window.clearInterval(t)}},[e]),(0,a.jsx)(v,{state:t})}var x=e.i(89873),f=e.i(10718);let j=(0,n.createContext)(null),N=[{label:"Overview",segment:""},{label:"Sessions",segment:"sessions"},{label:"Conversations",segment:"conversations"},{label:"Slack",segment:"slack"},{label:"Activity",segment:"activity"},{label:"Config",segment:"config"}];e.s(["default",0,function({children:e}){let l=String((0,s.useParams)().id??""),r=(0,s.usePathname)(),d=(0,s.useRouter)(),u=(0,s.useSearchParams)(),[p,w]=(0,n.useState)([]),[m,h]=(0,n.useState)(null),[g,b]=(0,n.useState)(!0),[v,k]=(0,n.useState)(!1),[A,R]=(0,n.useState)(!1),[S,$]=(0,n.useState)(()=>{let e=Number(u.get("deleted"))||0;return e>0?(0,f.deletedStatusLine)(e):""}),[C,I]=(0,n.useState)({serverNow:0,fetchedAt:0}),[P,D]=(0,n.useState)(()=>Date.now()),K=(0,n.useCallback)(async e=>{try{let[a,n]=await Promise.all([fetch("/api/bots",{cache:"no-store"}),fetch(`/api/bots/${encodeURIComponent(l)}/overview`,{cache:"no-store"})]),t=a.ok?await a.json():[];if(e())return;w(Array.isArray(t)?t:[]);let s=Date.parse(a.headers.get("date")||"");if(I({serverNow:Number.isNaN(s)?Date.now():s,fetchedAt:Date.now()}),404===n.status){R(!0),h(null),k(!1);return}if(!n.ok)throw Error("overview request failed");let i=await n.json();if(e())return;h(i),R(!1),k(!1)}catch{e()||k(!0)}finally{e()||b(!1)}},[l]);(0,n.useEffect)(()=>{let e=!1,a=()=>e,n=window.setTimeout(()=>{K(a)},0),t=window.setInterval(()=>{K(a)},2e3),s=window.setInterval(()=>D(Date.now()),1e3);return()=>{e=!0,window.clearTimeout(n),window.clearInterval(t),window.clearInterval(s)}},[K]);let L=m?.agent,M=m?.runtime;return(0,a.jsx)(j.Provider,{value:{id:l,agents:p,overview:m,loading:g,error:v,notFound:A},children:(0,a.jsxs)("div",{className:"field agent-field",children:[(0,a.jsx)(x.default,{agents:p,activeAgentId:l,beatClock:C,now:P,status:S,onAgentsChange:w,onNew:()=>d.push("/?new=1"),onManage:()=>d.push("/?manage=1"),onDeleted:e=>{$((0,f.deletedStatusLine)(e.length)),e.some(e=>e.id===l)&&d.replace(`/?deleted=${e.length}`)}}),(0,a.jsxs)("section",{className:"pane agent-pane",children:[(0,a.jsx)(y,{}),(0,a.jsxs)("header",{className:"agent-shell-header",children:[(0,a.jsxs)("div",{className:"agent-shell-identity",children:[L?(0,a.jsx)(i.default,{bot:L,size:48,title:`${L.name} avatar`}):null,(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"agent-shell-kicker",children:"Agent"}),(0,a.jsx)("h1",{children:L?.name??(g?"Loading…":"Unknown
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,70925,8880,e=>{"use strict";var a=e.i(43476),n=e.i(71645),t=e.i(22016),s=e.i(18566),i=e.i(87303);let l={cursor:"/brand/harness/cursor.svg",claude:"/brand/harness/claude.svg",codex:"/brand/harness/codex.png",muse:"/brand/harness/muse.svg"};function r({src:e,className:n,size:t=16}){return(0,a.jsx)("span",{className:n?`harness-icon ${n}`:"harness-icon",style:{width:t,height:t},"aria-hidden":"true",children:(0,a.jsx)("img",{src:e,alt:"",width:t,height:t,draggable:!1})})}function c({agent:e,className:n,size:t=16}){let s=l[String(e??"")];return s?(0,a.jsx)(r,{src:s,className:n,size:t}):null}e.s(["HarnessIcon",0,c],8880);var o=e.i(3136);let d={unsupported:"not reported by provider",missing:"no data yet",expired:"expired",unparsable:"provider data unparsable",stale:"stale"},u=new Set(["claude","codex","muse"]);function p(e,a){let n=e.remainingPercent??0,t=Math.round(n),s=e.resetAt?`, resets ${new Date(e.resetAt).toLocaleString()}`:"";return{key:e.windowKey,label:a,kind:"known",remaining:t,rawRemaining:n,title:`${a}: ${t}% remaining${s}`}}function w(e,a,n){return{key:e,label:a,kind:"unknown",reason:n,title:`${a}: N/A (${d[n]})`}}function m(e,a,n,t){let s=e.find(e=>e.criticalRole===a)??null;return s&&null===s.unavailableReason&&null!==s.remainingPercent?p(s,n):s?.unavailableReason?w(s.windowKey,n,s.unavailableReason):w(`missing-${n}`,n,t??"missing")}function h(e){if("cursor"===e.runtime){let a=e.windows.find(e=>"billing_cycle"===e.windowKey)??null;return a&&null===a.unavailableReason&&null!==a.remainingPercent?[p(a,"1M")]:a?.unavailableReason?[w(a.windowKey,"1M",a.unavailableReason)]:[w("missing-1M","1M",e.unavailableReason??"missing")]}return u.has(e.runtime)?[m(e.windows,"five_hour","5H",e.unavailableReason),m(e.windows,"weekly","1W",e.unavailableReason)]:[]}function g({row:e}){var n;if("unknown"===e.kind)return(0,a.jsxs)("span",{className:"topbar-capacity-window is-unknown","data-window":e.label,"data-window-known":"false",title:e.title,children:[(0,a.jsx)("span",{className:"topbar-capacity-window-label",children:e.label}),(0,a.jsx)("span",{children:"N/A"})]});let t=(n=e.rawRemaining)<10?"critical":n<30?"warning":"normal";return(0,a.jsxs)("span",{className:`topbar-capacity-window is-${t}`,"data-window":e.label,"data-window-known":"true","data-severity":t,title:e.title,children:[(0,a.jsx)("span",{className:"topbar-capacity-window-label",children:e.label}),(0,a.jsxs)("span",{children:[e.remaining,"%"]})]})}function b({entry:e}){let n=h(e),t=n.some(e=>"known"===e.kind),s=n.some(e=>"known"===e.kind&&0===e.rawRemaining),i=(0,o.agentLabel)(e.runtime)||e.runtime;return(0,a.jsxs)("span",{className:s?"topbar-capacity-runtime is-exhausted":"topbar-capacity-runtime","data-testid":`topbar-capacity-${e.runtime}`,"data-known":t?"true":"false","data-exhausted":s?"true":"false",role:"group","aria-label":`${i} capacity`,title:n.map(e=>e.title).join("; ")||`${i}: N/A`,children:[(0,a.jsx)(c,{agent:e.runtime,size:16}),0===n.length?(0,a.jsx)("span",{className:"topbar-capacity-window is-unknown",children:"N/A"}):(0,a.jsx)("span",{className:"topbar-capacity-windows",children:n.map(e=>(0,a.jsx)(g,{row:e},e.key))})]})}function v({state:e}){if("loading"===e.status)return(0,a.jsxs)("div",{className:"topbar-capacity","data-testid":"topbar-capacity","data-status":"loading",title:"Runtime capacity is loading",children:[(0,a.jsx)("span",{className:"topbar-capacity-eyebrow",children:"Capacity"}),(0,a.jsx)("span",{"aria-live":"polite",children:"loading…"})]});if("unavailable"===e.status)return(0,a.jsxs)("div",{className:"topbar-capacity","data-testid":"topbar-capacity","data-status":"unavailable",title:"Runtime capacity is unavailable",children:[(0,a.jsx)("span",{className:"topbar-capacity-eyebrow",children:"Capacity"}),(0,a.jsx)("span",{children:"unavailable"})]});let n=e.data.runtimes,t=0===n.length||n.every(e=>!h(e).some(e=>"known"===e.kind));return(0,a.jsxs)("div",{className:"topbar-capacity","data-testid":"topbar-capacity","data-status":t?"unknown":"ready",title:0===n.length?"No coding harness capacity reported":void 0,children:[(0,a.jsx)("span",{className:"topbar-capacity-eyebrow",children:"Capacity"}),0===n.length?(0,a.jsx)("span",{className:"topbar-capacity-empty",children:"N/A"}):n.map(e=>(0,a.jsx)(b,{entry:e},e.runtime))]})}function y({refreshMs:e=6e4}){let[t,s]=(0,n.useState)({status:"loading"});return(0,n.useEffect)(()=>{let a=!1,n=()=>{fetch("/api/runtime-capacity",{cache:"no-store"}).then(async e=>{if(!e.ok)throw Error("capacity request failed");return e.json()}).then(e=>{a||s({status:"ready",data:e})}).catch(()=>{a||s({status:"unavailable"})})};n();let t=window.setInterval(n,e);return()=>{a=!0,window.clearInterval(t)}},[e]),(0,a.jsx)(v,{state:t})}var x=e.i(89873),f=e.i(10718);let j=(0,n.createContext)(null),N=[{label:"Overview",segment:""},{label:"Sessions",segment:"sessions"},{label:"Conversations",segment:"conversations"},{label:"Slack",segment:"slack"},{label:"Activity",segment:"activity"},{label:"Config",segment:"config"}];e.s(["default",0,function({children:e}){let l=String((0,s.useParams)().id??""),r=(0,s.usePathname)(),d=(0,s.useRouter)(),u=(0,s.useSearchParams)(),[p,w]=(0,n.useState)([]),[m,h]=(0,n.useState)(null),[g,b]=(0,n.useState)(!0),[v,k]=(0,n.useState)(!1),[A,R]=(0,n.useState)(!1),[S,$]=(0,n.useState)(()=>{let e=Number(u.get("deleted"))||0;return e>0?(0,f.deletedStatusLine)(e):""}),[C,I]=(0,n.useState)({serverNow:0,fetchedAt:0}),[P,D]=(0,n.useState)(()=>Date.now()),K=(0,n.useCallback)(async e=>{try{let[a,n]=await Promise.all([fetch("/api/bots",{cache:"no-store"}),fetch(`/api/bots/${encodeURIComponent(l)}/overview`,{cache:"no-store"})]),t=a.ok?await a.json():[];if(e())return;w(Array.isArray(t)?t:[]);let s=Date.parse(a.headers.get("date")||"");if(I({serverNow:Number.isNaN(s)?Date.now():s,fetchedAt:Date.now()}),404===n.status){R(!0),h(null),k(!1);return}if(!n.ok)throw Error("overview request failed");let i=await n.json();if(e())return;h(i),R(!1),k(!1)}catch{e()||k(!0)}finally{e()||b(!1)}},[l]);(0,n.useEffect)(()=>{let e=!1,a=()=>e,n=window.setTimeout(()=>{K(a)},0),t=window.setInterval(()=>{K(a)},2e3),s=window.setInterval(()=>D(Date.now()),1e3);return()=>{e=!0,window.clearTimeout(n),window.clearInterval(t),window.clearInterval(s)}},[K]);let L=m?.agent,M=m?.runtime;return(0,a.jsx)(j.Provider,{value:{id:l,agents:p,overview:m,loading:g,error:v,notFound:A},children:(0,a.jsxs)("div",{className:"field agent-field",children:[(0,a.jsx)(x.default,{agents:p,activeAgentId:l,beatClock:C,now:P,status:S,onAgentsChange:w,onNew:()=>d.push("/?new=1"),onManage:()=>d.push("/?manage=1"),onDeleted:e=>{$((0,f.deletedStatusLine)(e.length)),e.some(e=>e.id===l)&&d.replace(`/?deleted=${e.length}`)}}),(0,a.jsxs)("section",{className:"pane agent-pane",children:[(0,a.jsx)(y,{}),(0,a.jsxs)("header",{className:"agent-shell-header",children:[(0,a.jsxs)("div",{className:"agent-shell-identity",children:[L?(0,a.jsx)(i.default,{bot:L,size:48,title:`${L.name} avatar`}):null,(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"agent-shell-kicker",children:"Agent"}),(0,a.jsx)("h1",{children:L?.name??(g?"Loading…":"Unknown agent")}),L?(0,a.jsx)("p",{children:L.role}):null]})]}),M?(0,a.jsxs)("div",{className:"agent-shell-runtime","aria-label":"Runtime and availability",children:[(0,a.jsx)("span",{className:M.available?"availability is-available":"availability is-blocked",children:M.available?"Available":"Needs setup"}),(0,a.jsxs)("span",{className:"agent-shell-runtime-line",children:[(0,a.jsx)(c,{agent:M.agent,size:14}),(0,a.jsxs)("span",{children:[(0,o.agentLabel)(M.agent)," · ",M.connection||"No connection"]})]})]}):null]}),(0,a.jsx)("nav",{className:"agent-tabs","aria-label":"Agent",children:N.map(e=>{let n=`/agents/${encodeURIComponent(l)}${e.segment?`/${e.segment}`:""}`,s=r===n;return(0,a.jsx)(t.default,{href:n,"aria-current":s?"page":void 0,children:e.label},e.label)})}),(0,a.jsx)("main",{className:"agent-content",children:e})]})]})})},"useAgentOverview",0,function(){let e=(0,n.useContext)(j);if(!e)throw Error("useAgentOverview must be used inside AgentShell");return e}],70925)}]);
|