botmancers 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +22 -17
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +7 -0
- package/app/.next/build-manifest.json +3 -3
- package/app/.next/prerender-manifest.json +5 -5
- package/app/.next/required-server-files.json +2 -2
- package/app/.next/routes-manifest.json +55 -0
- package/app/.next/server/app/_global-error.html +1 -1
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/api/agent-deck/decks/route.js +2 -2
- package/app/.next/server/app/api/agent-deck/decks/route.js.nft.json +1 -1
- package/app/.next/server/app/api/agent-deck/settings/route.js +2 -2
- package/app/.next/server/app/api/agent-deck/settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/config/route.js +2 -2
- package/app/.next/server/app/api/bots/[id]/config/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route.js +12 -0
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route.js.nft.json +1 -0
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route.js +2 -2
- 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/route.js +6 -3
- package/app/.next/server/app/api/bots/[id]/sessions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/skill/route.js +2 -2
- 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 +2 -2
- package/app/.next/server/app/api/bots/availability/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/delete-preview/route.js +2 -2
- 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 +2 -2
- package/app/.next/server/app/api/bots/import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/manage/route.js +2 -2
- 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 +2 -2
- package/app/.next/server/app/api/bots/name-migrations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/route.js +3 -3
- package/app/.next/server/app/api/bots/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/approve/route.js +4 -4
- 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 +4 -4
- 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 +4 -4
- 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 +2 -2
- package/app/.next/server/app/api/conversations/[id]/messages/[messageId]/stop/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/messages/route.js +5 -5
- package/app/.next/server/app/api/conversations/[id]/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/route.js +2 -2
- 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 +3 -3
- package/app/.next/server/app/api/conversations/[id]/stop/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/route.js +2 -2
- package/app/.next/server/app/api/conversations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/exchanges/[id]/cancel/route.js +4 -4
- package/app/.next/server/app/api/exchanges/[id]/cancel/route.js.nft.json +1 -1
- package/app/.next/server/app/api/exchanges/[id]/route.js +3 -3
- package/app/.next/server/app/api/exchanges/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/exchanges/route.js +3 -3
- package/app/.next/server/app/api/exchanges/route.js.nft.json +1 -1
- package/app/.next/server/app/api/files/[name]/route.js +3 -2
- package/app/.next/server/app/api/files/[name]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/groups/route.js +2 -2
- package/app/.next/server/app/api/groups/route.js.nft.json +1 -1
- package/app/.next/server/app/api/health/route.js +3 -2
- package/app/.next/server/app/api/health/route.js.nft.json +1 -1
- package/app/.next/server/app/api/mcp/route.js +2 -2
- package/app/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/app/.next/server/app/api/messages/[id]/between/route.js +2 -2
- package/app/.next/server/app/api/messages/[id]/between/route.js.nft.json +1 -1
- package/app/.next/server/app/api/runtime-connections/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/runtime-connections/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/runtime-connections/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/runtime-connections/route.js +9 -0
- package/app/.next/server/app/api/runtime-connections/route.js.nft.json +1 -0
- package/app/.next/server/app/api/runtime-connections/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/service-grants/route.js +2 -2
- package/app/.next/server/app/api/service-grants/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js +7 -6
- 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 +7 -6
- 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 +4 -4
- 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/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/pins/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/pins/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/pins/route.js +12 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/pins/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/pins/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/route.js +7 -6
- 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 +7 -6
- 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 +7 -6
- 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 +7 -6
- package/app/.next/server/app/api/v0/agents/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/capabilities/route.js +7 -6
- 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 +4 -4
- 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 +7 -6
- 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 +7 -6
- 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 +7 -6
- package/app/.next/server/app/api/v0/exchanges/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/mcp/route.js +8 -7
- 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/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route.js +12 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route.js +12 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/route.js +12 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/pins/[pinRef]/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/requests/[id]/route.js +4 -4
- 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 +7 -6
- 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/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/sessions/[ref]/pins/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/sessions/[ref]/pins/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/sessions/[ref]/pins/route.js +12 -0
- package/app/.next/server/app/api/v0/sessions/[ref]/pins/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/sessions/[ref]/pins/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/wake-grants/[id]/revoke/route.js +4 -4
- 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 +4 -4
- 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 +4 -4
- package/app/.next/server/app/api/wakes/[id]/retry/route.js.nft.json +1 -1
- package/app/.next/server/app/bots/[id]/config/page.js.nft.json +1 -1
- package/app/.next/server/app/bots/[id]/config/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/exchanges/page.js.nft.json +1 -1
- package/app/.next/server/app/exchanges/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/exchanges.html +1 -1
- package/app/.next/server/app/exchanges.rsc +3 -3
- package/app/.next/server/app/exchanges.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/exchanges.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/exchanges.segments/exchanges/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +3 -3
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/page.js.nft.json +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/settings/page.js.nft.json +1 -1
- package/app/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/settings.html +1 -1
- package/app/.next/server/app/settings.rsc +3 -3
- package/app/.next/server/app/settings.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/threads/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/threads/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +7 -0
- package/app/.next/server/chunks/1oeh_server_app_api_bots_[id]_sessions_[ref]_pins_route_actions_0e1st6o.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__02kssr-._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__06qkt0f._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__08qhrch._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__097ptn_._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__09m9-pe._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__0b7w1z3._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__0f5yqjs._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__0g4um3-._.js +44 -0
- package/app/.next/server/chunks/[root-of-the-server]__0hro5ey._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__0hwpgxq._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__0izjfmr._.js +355 -60
- package/app/.next/server/chunks/[root-of-the-server]__0lwsto-._.js +5 -0
- package/app/.next/server/chunks/[root-of-the-server]__0s1enbp._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__0uq7sci._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__0wg992i._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__13cd2fb._.js +44 -0
- package/app/.next/server/chunks/[root-of-the-server]__17mum5-._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__1879cge._.js +3 -0
- package/app/.next/server/chunks/{[root-of-the-server]__17oz13o._.js → [root-of-the-server]__1_01-13._.js} +3 -3
- package/app/.next/server/chunks/[root-of-the-server]__1a2dh11._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__1bhzfu_._.js +7 -0
- package/app/.next/server/chunks/[root-of-the-server]__1co3sok._.js +44 -0
- package/app/.next/server/chunks/[root-of-the-server]__1eh30sp._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__1fmsid0._.js +44 -0
- package/app/.next/server/chunks/[root-of-the-server]__1i388e2._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__1kvvs4u._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__1qbgs3m._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__1s6h1sj._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__1slu7d7._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__1tuqc5v._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__1v609eq._.js +44 -0
- package/app/.next/server/chunks/[root-of-the-server]__1y_j43n._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__1zdv-vb._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__1zjs2tr._.js +3 -0
- package/app/.next/server/chunks/_0061c2q._.js +3 -0
- package/app/.next/server/chunks/_023se5j._.js +44 -0
- package/app/.next/server/chunks/_02pb_qv._.js +44 -0
- package/app/.next/server/chunks/_05ro-21._.js +44 -0
- package/app/.next/server/chunks/_07on0dc._.js +44 -0
- package/app/.next/server/chunks/_08208nz._.js +44 -0
- package/app/.next/server/chunks/_0a2do3x._.js +1 -1
- package/app/.next/server/chunks/_0fe5qz5._.js +44 -0
- package/app/.next/server/chunks/_0i8_xso._.js +3 -0
- package/app/.next/server/chunks/_0qoji5a._.js +44 -0
- package/app/.next/server/chunks/_0uv2pi5._.js +44 -0
- package/app/.next/server/chunks/_0wdl90-._.js +44 -0
- package/app/.next/server/chunks/_1-5mthb._.js +1 -1
- package/app/.next/server/chunks/_11-q8k1._.js +3 -0
- package/app/.next/server/chunks/_11ijk9k._.js +44 -0
- package/app/.next/server/chunks/_198sn69._.js +44 -0
- package/app/.next/server/chunks/_1ba_5hd._.js +44 -0
- package/app/.next/server/chunks/_1ess5if._.js +3 -0
- package/app/.next/server/chunks/_1i0zod4._.js +3 -0
- package/app/.next/server/chunks/_1m89jq5._.js +44 -0
- package/app/.next/server/chunks/_1n39wr_._.js +44 -0
- package/app/.next/server/chunks/_1ryxqo1._.js +44 -0
- package/app/.next/server/chunks/_1vemgly._.js +44 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_runtime-connections_route_actions_06rulng.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_v0_agents_[agentId]_pins_route_actions_08uftk9.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_v0_pins_[pinRef]_detach_route_actions_0nk3268.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_v0_pins_[pinRef]_messages_route_actions_1wenu96.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_v0_pins_[pinRef]_route_actions_0z7fu_c.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_v0_sessions_[ref]_pins_route_actions_0y3ere3.js +3 -0
- package/app/.next/server/chunks/lib_0kik6bx._.js +1 -1
- package/app/.next/server/chunks/lib_0lqoyb4._.js +217 -0
- package/app/.next/server/chunks/lib_0pe3tiv._.js +1 -1
- package/app/.next/server/chunks/lib_0riiofz._.js +44 -0
- package/app/.next/server/chunks/lib_16j2293._.js +217 -0
- package/app/.next/server/chunks/lib_1nb_61e._.js +217 -0
- package/app/.next/server/chunks/lib_service-api-http_ts_0xzqhny._.js +5 -5
- package/app/.next/server/chunks/lib_session-pins_ts_0lmxnwj._.js +20 -0
- package/app/.next/server/chunks/ssr/_0epgorw._.js +3 -0
- package/app/.next/server/chunks/ssr/_1cvuhjt._.js +3 -0
- package/app/.next/server/chunks/ssr/_1n5mvo5._.js +3 -0
- package/app/.next/server/chunks/ssr/_1o94bnv._.js +1 -1
- package/app/.next/server/chunks/ssr/app_bots_[id]_config_page_tsx_1e0uue9._.js +1 -1
- package/app/.next/server/chunks/ssr/app_components_AgentDeckRuntime_tsx_024janf._.js +1 -1
- package/app/.next/server/chunks/ssr/app_components_ExchangeCard_tsx_1shfcgn._.js +3 -0
- package/app/.next/server/chunks/ssr/app_exchanges_page_tsx_0j-n2a1._.js +3 -0
- package/app/.next/server/chunks/ssr/node_modules_@swc_helpers_cjs__interop_require_default_cjs_1ztp13a._.js +3 -0
- 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/0bhd8eso48g27.js +1 -0
- package/app/.next/static/chunks/1ku9himlsx-hn.js +1 -0
- package/app/.next/static/chunks/21aqekm5z0j47.js +1 -0
- package/app/.next/static/chunks/2a8bomryx66oj.css +3 -0
- package/app/.next/static/chunks/3230ywnpii0s6.js +3 -0
- package/app/.next/static/chunks/35l2c95bd-jud.js +1 -0
- package/app/.next/static/chunks/3cijpn6vx3yzv.js +1 -0
- package/app/.next/static/chunks/3ue9194j59kem.js +1 -0
- package/app/.next/static/chunks/44ese2s4gzze_.js +1 -0
- package/app/BUILD_INFO.json +2 -2
- package/app/package.json +1 -1
- package/app/server.js +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +2 -2
- package/dist/clients.js +7 -3
- package/dist/config.d.ts +2 -1
- package/dist/config.js +5 -4
- package/dist/contract.d.ts +1 -0
- package/dist/contract.js +5 -0
- package/dist/home.d.ts +1 -1
- package/dist/home.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/product.js +1 -1
- package/dist/upstream.js +2 -2
- package/package.json +1 -1
- package/schemas/botmancers.mcp.v2.tools.json +1588 -4
- package/skills/botmancers-collaboration/SKILL.md +21 -6
- package/skills/botmancers-collaboration/references/workflows.md +72 -0
- package/app/.next/server/chunks/[root-of-the-server]__0ab4e_k._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__0qozubc._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__0wtzcge._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__10m3szc._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__15hknun._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__16ikszu._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__1afl75n._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__1kvvdpx._.js +0 -7
- package/app/.next/server/chunks/[root-of-the-server]__1qoa704._.js +0 -7
- package/app/.next/server/chunks/_06rti77._.js +0 -30
- package/app/.next/server/chunks/_09k38l1._.js +0 -3
- package/app/.next/server/chunks/_0dlg5kj._.js +0 -30
- package/app/.next/server/chunks/_0dyculb._.js +0 -30
- package/app/.next/server/chunks/_0eig2jc._.js +0 -30
- package/app/.next/server/chunks/_0ggf7vy._.js +0 -3
- package/app/.next/server/chunks/_0gtqbub._.js +0 -3
- package/app/.next/server/chunks/_0i7ga8c._.js +0 -3
- package/app/.next/server/chunks/_0kghtb6._.js +0 -3
- package/app/.next/server/chunks/_0orubev._.js +0 -3
- package/app/.next/server/chunks/_0sfpe9z._.js +0 -3
- package/app/.next/server/chunks/_0th2j4w._.js +0 -3
- package/app/.next/server/chunks/_0uz7r06._.js +0 -30
- package/app/.next/server/chunks/_0x05ts4._.js +0 -3
- package/app/.next/server/chunks/_0y3geoj._.js +0 -30
- package/app/.next/server/chunks/_12tq5uv._.js +0 -30
- package/app/.next/server/chunks/_147-4gl._.js +0 -3
- package/app/.next/server/chunks/_14ky6a2._.js +0 -30
- package/app/.next/server/chunks/_16kbxdt._.js +0 -30
- package/app/.next/server/chunks/_1963m2f._.js +0 -30
- package/app/.next/server/chunks/_1_34_h3._.js +0 -30
- package/app/.next/server/chunks/_1cc-2mx._.js +0 -3
- package/app/.next/server/chunks/_1ee4ej2._.js +0 -3
- package/app/.next/server/chunks/_1esxu1s._.js +0 -3
- package/app/.next/server/chunks/_1gn7eh7._.js +0 -3
- package/app/.next/server/chunks/_1gw7qwf._.js +0 -3
- package/app/.next/server/chunks/_1inyx08._.js +0 -3
- package/app/.next/server/chunks/_1kjsnlr._.js +0 -3
- package/app/.next/server/chunks/_1nurj3f._.js +0 -30
- package/app/.next/server/chunks/_1p2rf_n._.js +0 -30
- package/app/.next/server/chunks/_1p8rola._.js +0 -3
- package/app/.next/server/chunks/_1u6tw78._.js +0 -30
- package/app/.next/server/chunks/app_api_import-capabilities_route_ts_013w1kt._.js +0 -3
- package/app/.next/server/chunks/lib_0t3s3rj._.js +0 -30
- package/app/.next/server/chunks/lib_0zxi6rx._.js +0 -148
- package/app/.next/server/chunks/lib_12udr7g._.js +0 -148
- package/app/.next/server/chunks/lib_draft_ts_1atoius._.js +0 -3
- package/app/.next/server/chunks/lib_session-catalog_ts_1i7f38f._.js +0 -30
- package/app/.next/server/chunks/ssr/_00ysoah._.js +0 -3
- package/app/.next/server/chunks/ssr/_157wnb_._.js +0 -3
- package/app/.next/server/chunks/ssr/app_1-nwnha._.js +0 -3
- package/app/.next/server/chunks/ssr/app_components_0bhuhd-._.js +0 -3
- package/app/.next/server/chunks/ssr/app_components_0w2_b3t._.js +0 -3
- package/app/.next/static/chunks/0774d7ob6aze_.js +0 -1
- package/app/.next/static/chunks/0d3ein53nlgja.js +0 -1
- package/app/.next/static/chunks/1i5xroz391zkb.js +0 -1
- package/app/.next/static/chunks/1vz50l951sr9e.css +0 -3
- package/app/.next/static/chunks/24ggj819yt3y6.js +0 -1
- package/app/.next/static/chunks/2_8lcalraul5s.js +0 -3
- package/app/.next/static/chunks/30i0-l04mmdvk.js +0 -1
- package/app/.next/static/chunks/3wdlh25l1vww9.js +0 -1
- /package/app/.next/static/{ewp56HqU5-d9bpFog3bli → gh3shm8hnVqXLr75rmvsL}/_buildManifest.js +0 -0
- /package/app/.next/static/{ewp56HqU5-d9bpFog3bli → gh3shm8hnVqXLr75rmvsL}/_clientMiddlewareManifest.js +0 -0
- /package/app/.next/static/{ewp56HqU5-d9bpFog3bli → gh3shm8hnVqXLr75rmvsL}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module.exports=[68845,e=>{"use strict";var t=e.i(69936);async function n(e,{params:a}){let{ref:r}=await a;return(0,t.handlePinSession)(e,r)}e.s(["POST",0,n])},49741,e=>{"use strict";var t=e.i(47909),n=e.i(74017),a=e.i(96250),r=e.i(59756),i=e.i(61916),s=e.i(74677),o=e.i(69741),d=e.i(16795),l=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),_=e.i(70101),g=e.i(26937),h=e.i(10372),v=e.i(93695),f=e.i(9580);e.i(52474);var m=e.i(220);let E=new t.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/v0/sessions/[ref]/pins/route",pathname:"/api/v0/sessions/[ref]/pins",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/v0/sessions/[ref]/pins/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(68845),...{}}),{workAsyncStorage:A,workUnitAsyncStorage:b,serverHooks:y}=E;async function R(e,t,a){a.requestMeta&&(0,r.setRequestMeta)(e,a.requestMeta),E.isDev&&(0,r.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let A="/api/v0/sessions/[ref]/pins/route";A=A.replace(/\/index$/,"")||"/";let b=await E.prepare(e,t,{srcPage:A,multiZoneDraftMode:!1});if(!b)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:y,deploymentId:R,params:S,nextConfig:w,parsedUrl:C,isDraftMode:N,prerenderManifest:O,routerServerContext:T,isOnDemandRevalidate:k,revalidateOnlyGenerated:q,resolvedPathname:I,clientReferenceManifest:x,serverActionsManifest:P}=b,L=(0,o.normalizeAppPath)(A),M=!!O.routes[I]&&(E.isDev||(0,f.isRouteCacheOwner)(I,E.cacheOwner,O.routes[I])),H=!!(O.dynamicRoutes[L]||M),D=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,C,!1):t.end("This page could not be found"),null);if(H&&!N){let e=O.dynamicRoutes[L];if(e&&!1===e.fallback&&!M){if(w.adapterPath)return await D();throw new v.NoFallbackError}}let F=null;!H||E.isDev||N||(F="/index"===(F=I)?"/":F);let U=!0===E.isDev||!H,$=H&&!U;P&&x&&(0,s.setManifestsSingleton)({page:A,clientReferenceManifest:x,serverActionsManifest:P});let K=e.method||"GET",j=(0,i.getTracer)(),W=j.getActiveScopeSpan(),J=!!(null==T?void 0:T.isWrappedByNextServer),X=!!(0,r.getRequestMeta)(e,"minimalMode"),G=(0,r.getRequestMeta)(e,"incrementalCache")||await E.getIncrementalCache(e,w,O,X);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let B={params:S,previewProps:O.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts,useCacheTimeout:w.experimental.useCacheTimeout},cacheComponents:!!w.cacheComponents,validationLevel:w.experimental.instantInsights.validationLevel,isDraftMode:N,supportsDynamicResponse:U,incrementalCache:G,hmrRefreshHash:(0,r.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:w.cacheLife,staticPageGenerationTimeout:w.staticPageGenerationTimeout,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,n,a,r)=>E.onRequestError(e,t,a,r,T)},sharedContext:{buildId:y,deploymentId:R}},V=new d.NodeNextRequest(e),Y=new d.NodeNextResponse(t),z=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(t)),Z=async({previousCacheEntry:n})=>{try{if(!X&&k&&q&&!n)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let r=await E.handle(z,B);e.fetchMetrics=B.renderOpts.fetchMetrics;let i=B.renderOpts.pendingWaitUntil;i&&a.waitUntil&&(a.waitUntil(i),i=void 0);let s=B.renderOpts.collectedTags;if(!H)return await (0,p.sendResponse)(V,Y,r,i),null;{let e=await r.blob(),t=(0,_.toNodeOutgoingHttpHeaders)(r.headers);s&&(t[h.NEXT_CACHE_TAGS_HEADER]=s),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let n=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,a=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=h.INFINITE_CACHE?!1!==n&&n>0?w.expireTime:void 0:B.renderOpts.collectedExpire;return{value:{kind:m.CachedRouteKind.APP_ROUTE,status:r.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:n,expire:a}}}}catch(t){throw(null==n?void 0:n.isStale)&&await E.onRequestError(e,t,{routerKind:"App Router",routePath:A,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:k})},!1,T),t}},Q=async(r,s)=>{try{var o,d;let r=await E.handleResponse({req:e,nextConfig:w,cacheKey:F,routeKind:n.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:O,isRoutePPREnabled:!1,isOnDemandRevalidate:k,revalidateOnlyGenerated:q,responseGenerator:Z,waitUntil:a.waitUntil,isMinimalMode:X});if(!H)return;if((null==r||null==(o=r.value)?void 0:o.kind)!==m.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==r||null==(d=r.value)?void 0:d.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});X||t.setHeader("x-nextjs-cache",k?"REVALIDATED":r.isMiss?"MISS":r.isStale?"STALE":"HIT"),N&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let i=(0,_.fromNodeOutgoingHttpHeaders)(r.value.headers);X&&H||i.delete(h.NEXT_CACHE_TAGS_HEADER),!r.cacheControl||t.getHeader("Cache-Control")||i.get("Cache-Control")||i.set("Cache-Control",(0,g.getCacheControlHeader)(r.cacheControl)),await (0,p.sendResponse)(V,Y,new Response(r.value.body,{headers:i,status:r.value.status||200}));return}catch(t){if(t instanceof v.NoFallbackError||await E.onRequestError(e,t,{routerKind:"App Router",routePath:L,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:k})},!1,T),H)throw t;await (0,p.sendResponse)(V,Y,new Response(null,{status:500}));return}finally{(()=>{if(!r)return;let e=t.statusCode;r.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(r.setStatus({code:i.SpanStatusCode.ERROR}),r.setAttribute("error.type",e.toString()));let n=j.getRootSpanAttributes();if(!n)return;if(n.get("next.span_type")!==u.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${n.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=n.get("next.route")||L,o=`${K} ${a}`;r.setAttributes({"next.route":a,"http.route":a,"next.span_name":o}),r.updateName(o),s&&s!==r&&(s.setAttribute("http.route",a),s.updateName(o))})()}};if(J&&W)await Q(W,void 0);else{let t=j.getActiveScopeSpan();await j.withPropagatedContext(e.headers,()=>j.trace(u.BaseServerSpan.handleRequest,{spanName:`${K} ${A}`,kind:i.SpanKind.SERVER,attributes:{"http.method":K,"http.target":e.url}},e=>Q(e,t)),void 0,!J)}}e.s(["handler",0,R,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:b})},"routeModule",0,E,"serverHooks",0,y,"workAsyncStorage",0,A,"workUnitAsyncStorage",0,b])},43345,e=>{"use strict";var t=e.i(62294),n=e.i(26571),a=e.i(45383);let r=["authentication_unavailable","unauthenticated","principal_mismatch","agent_not_found","conversation_not_found","request_not_found"];async function i(e,n){let i,s=null,o=!1,d=null;try{i=await e(e=>{s=e},()=>{let e=s;n&&e&&"service"===e.kind&&t.serviceAudit.append({principal:e,operation:n.operation,capability:"participant",targetKind:n.targetKind,targetRef:n.targetRef,outcome:"allowed",code:null}),o=!0})}catch(e){if(e instanceof a.AgentApiError)d=e.code,i=Response.json({error:{code:e.code,message:e.message}},{status:e.status});else console.error("Agent conversation API error:",e),d="internal_error",i=Response.json({error:{code:"internal_error",message:"The request could not be processed."}},{status:500})}let l=s;if(o&&null===d)return i;if(n&&l&&"service"===l.kind)try{t.serviceAudit.append({principal:l,operation:n.operation,capability:"participant",targetKind:n.targetKind,targetRef:n.targetRef,outcome:null===d?"allowed":"internal_error"===d?"error":r.includes(d)?"denied":"rejected",code:d})}catch(e){return console.error("Service audit append failed:",e instanceof Error?e.message:"unknown error"),Response.json({error:{code:"internal_error",message:"The request could not be processed."}},{status:500})}return i}async function s(e){let t,r=function(){try{return(0,n.serviceTokenAuthenticatorFromEnv)()}catch(e){if(e instanceof n.ServiceTokenConfigError)return console.error(`Agent API authentication disabled: ${e.message}`),null;throw e}}();if(!r)throw new a.AgentApiError("authentication_unavailable","No authenticator is configured for the agent conversation API.");try{t=await r(e)}catch{t=null}if(!t||!(0,a.isPrincipalKind)(t.kind)||"string"!=typeof t.id||!t.id.trim())throw new a.AgentApiError("unauthenticated","Authentication failed.");return{kind:t.kind,id:t.id}}async function o(e,t){return i(async(n,r)=>{var i;let o,d=await s(e);n(d);try{let t=await e.json();if(!t||"object"!=typeof t||Array.isArray(t))throw Error("not an object");o=t}catch{throw new a.AgentApiError("invalid_request","The request body must be a JSON object.")}let l=null==(i=o.principal)?null:{kind:i.kind,id:String(i.id??"")};if(l&&!(0,a.samePrincipal)(l,d))throw new a.AgentApiError("principal_mismatch","The declared principal does not match the authenticated principal.");let u=e.headers.get("idempotency-key"),c="string"==typeof o.idempotencyKey?o.idempotencyKey:null;if(u&&c&&u!==c)throw new a.AgentApiError("invalid_request","Idempotency-Key header and body idempotencyKey differ.");let p=u??c??"";if(p.toLowerCase().startsWith(a.MCP_IDEMPOTENCY_PREFIX))throw new a.AgentApiError("invalid_request",`Idempotency keys starting with "${a.MCP_IDEMPOTENCY_PREFIX}" are reserved for the MCP bridge.`);let{accepted:_,dispatched:g}=(0,a.acceptAgentMessage)(d,{agentId:t,content:"string"==typeof o.content?o.content:"",idempotencyKey:p,conversationId:"string"==typeof o.conversationId?o.conversationId:null==o.conversationId?null:""},r);return!0===o.wait?(await g,Response.json({...(0,a.getAgentRequest)(d,_.requestId),replayed:_.replayed})):Response.json(_,{status:_.replayed?200:202})},{operation:"agents.message",targetKind:"agent",targetRef:t})}async function d(e,t){return i(async n=>{let r=await s(e);return n(r),Response.json((0,a.getConversation)(r,t))},{operation:"conversations.read",targetKind:"conversation",targetRef:t})}async function l(e,t){return i(async n=>{let r=await s(e);return n(r),Response.json((0,a.getAgentRequest)(r,t))},{operation:"requests.read",targetKind:"request",targetRef:t})}e.s(["authenticate",0,s,"handleGetAgentRequest",0,l,"handleGetConversation",0,d,"handleSendAgentMessage",0,o])},90027,e=>{"use strict";var t=e.i(62349),n=e.i(28420);let a=["active","ended","all"],r=["implementation","revision"],i=`
|
|
2
|
+
SELECT b.*, bot.name AS agent_name, bot.agent AS agent_runtime, r.id AS origin_request_id, c.id AS origin_conversation_id,
|
|
3
|
+
c.type AS conversation_type, c.bot_id AS conversation_bot_id, tb.name AS thread_agent_name, g.name AS group_name,
|
|
4
|
+
r.intent AS request_intent, r.execution_kind AS request_kind, r.state AS request_state,
|
|
5
|
+
r.source_conversation_id AS request_conversation_id, r.target_agent_id AS request_target_agent_id,
|
|
6
|
+
sa.launch_snapshot AS source_snapshot, sa.finished_at AS source_finished_at,
|
|
7
|
+
(SELECT MAX(COALESCE(ra.finished_at, ra.started_at)) FROM work_attempts ra WHERE ra.resumed_session_binding_id = b.id) AS resumed_last_at,
|
|
8
|
+
EXISTS (SELECT 1 FROM work_attempts oa WHERE oa.resumed_session_binding_id = b.id AND oa.finished_at IS NULL) AS attempt_running,
|
|
9
|
+
ps.availability AS ps_availability, ps.lifecycle AS ps_lifecycle, ps.resumable AS ps_resumable, ps.busy AS ps_busy,
|
|
10
|
+
ps.workspace AS ps_workspace, ps.last_synced_at AS ps_synced_at,
|
|
11
|
+
EXISTS (SELECT 1 FROM provider_session_turns pt WHERE pt.session_ref = ps.id AND pt.state = 'running') AS ps_running
|
|
12
|
+
FROM session_bindings b
|
|
13
|
+
JOIN bots bot ON bot.id = b.agent_id
|
|
14
|
+
LEFT JOIN provider_sessions ps ON ps.binding_id = b.id
|
|
15
|
+
LEFT JOIN work_attempts sa ON sa.id = b.source_attempt_id
|
|
16
|
+
LEFT JOIN work_requests r ON r.id = COALESCE(b.request_id, sa.request_id)
|
|
17
|
+
LEFT JOIN conversations c ON c.id = COALESCE(b.conversation_id, r.source_conversation_id)
|
|
18
|
+
LEFT JOIN bots tb ON tb.id = c.bot_id
|
|
19
|
+
LEFT JOIN groups g ON g.id = c.group_id
|
|
20
|
+
`,s=`
|
|
21
|
+
SELECT ps.id, ps.agent_id, bot.name AS agent_name, ps.provider_kind, ps.title, ps.workspace,
|
|
22
|
+
ps.provider_created_at, ps.provider_updated_at, ps.availability, ps.lifecycle, ps.resumable, ps.busy,
|
|
23
|
+
ps.last_synced_at, ps.created_at, ps.updated_at,
|
|
24
|
+
(SELECT MAX(COALESCE(t.finished_at, t.created_at)) FROM provider_session_turns t WHERE t.session_ref = ps.id) AS turn_last_at,
|
|
25
|
+
EXISTS (SELECT 1 FROM provider_session_turns t WHERE t.session_ref = ps.id AND t.state = 'running') AS running
|
|
26
|
+
FROM provider_sessions ps
|
|
27
|
+
JOIN bots bot ON bot.id = ps.agent_id
|
|
28
|
+
WHERE ps.binding_id IS NULL
|
|
29
|
+
`;function o(e){return`${new Date(e).toISOString().slice(0,16).replace("T"," ")} UTC`}function d(e,t){let n=e?.[t];return"string"==typeof n&&n.trim().length>0?n:null}function l(e){let t=e.origin_conversation_id;return t?"group"===e.conversation_type?{id:t,kind:"group",label:e.group_name?`Group ${e.group_name}`:"Group thread",thread_agent_id:null}:"bot"===e.conversation_type&&e.conversation_bot_id?{id:t,kind:"direct",label:e.thread_agent_name?`${e.thread_agent_name} thread`:"Agent thread",thread_agent_id:e.thread_agent_name?e.conversation_bot_id:null}:{id:t,kind:"agent_api",label:"Agent API conversation",thread_agent_id:null}:null}function u(e,a=(0,n.emptyUsage)()){let i,s=null;try{s=e.source_snapshot?JSON.parse(e.source_snapshot):null}catch{}let c=l(e),p=null===e.released_at?"active":"ended",_=((i=(e.request_intent??"").split("\n").map(e=>e.trim()).find(e=>e.length>0))?i.length>80?`${i.slice(0,79).trimEnd()}…`:i:null)??(c?.kind==="group"?c.label:null)??`${e.agent_name} \xb7 ${o(e.created_at)}`;return{ref:e.id,source:"botmancers",agent:{id:e.agent_id,name:e.agent_name,adapter:e.adapter,transport:d(s,"transport")},title:_,status:p,resumable:null===e.released_at&&null!==e.request_id&&null!==e.request_kind&&r.includes(e.request_kind)&&e.request_target_agent_id===e.agent_id&&(e.conversation_id??"")===(e.request_conversation_id??"")&&e.adapter===(0,t.resolveAgent)({agent:e.agent_runtime}).agent,state:{availability:e.ps_availability??"available",lifecycle:e.ps_lifecycle??"open",resumable:null===e.ps_resumable||void 0===e.ps_resumable?null:1===e.ps_resumable,busy:1===e.ps_busy||!!e.attempt_running||!!e.ps_running,synced_at:e.ps_synced_at??null},created_at:e.created_at,ended_at:e.released_at,last_activity_at:Math.max(e.created_at,e.released_at??0,e.source_finished_at??0,e.resumed_last_at??0),origin:{conversation:c,work_request:e.origin_request_id&&e.request_kind&&e.request_state?{id:e.origin_request_id,execution_kind:e.request_kind,state:e.request_state}:null},context:{workspace:d(s,"cwd")??e.ps_workspace??null,deck:d(s,"deck")},usage:a}}function c(e,t=(0,n.emptyUsage)()){let a=e.provider_created_at??e.created_at,r=null===e.resumable?null:1===e.resumable,i="archived"===e.lifecycle?e.provider_updated_at??e.updated_at:null;return{ref:e.id,source:"native",agent:{id:e.agent_id,name:e.agent_name,adapter:e.provider_kind,transport:null},title:e.title??`${e.agent_name} \xb7 ${o(a)}`,status:"open"===e.lifecycle?"active":"ended",resumable:!1,state:{availability:e.availability,lifecycle:e.lifecycle,resumable:r,busy:1===e.busy||!!e.running,synced_at:e.last_synced_at},created_at:a,ended_at:i,last_activity_at:Math.max(a,e.provider_updated_at??0,e.turn_last_at??0),origin:{conversation:null,work_request:null},context:{workspace:e.workspace,deck:null},usage:t}}function p(e,t){return t.last_activity_at-e.last_activity_at||t.created_at-e.created_at||(e.ref<t.ref?-1:+(e.ref>t.ref))}function _(e,t,n){return e.prepare(`${s} AND ps.id = ? AND ps.agent_id = ?`).get(n,t)}function g(e,t,n){return e.prepare(`${i} WHERE b.id = ? AND b.agent_id = ?`).get(n,t)}e.s(["agentExists",0,function(e,t){return!!e.prepare("SELECT 1 FROM bots WHERE id = ?").get(t)},"conversationRef",0,function(e,t){let n=e.prepare(`
|
|
30
|
+
SELECT c.id AS origin_conversation_id, c.type AS conversation_type, c.bot_id AS conversation_bot_id,
|
|
31
|
+
tb.name AS thread_agent_name, g.name AS group_name
|
|
32
|
+
FROM conversations c
|
|
33
|
+
LEFT JOIN bots tb ON tb.id = c.bot_id
|
|
34
|
+
LEFT JOIN groups g ON g.id = c.group_id
|
|
35
|
+
WHERE c.id = ?
|
|
36
|
+
`).get(t);return n?l(n):null},"getAgentSession",0,function(e,t,a){let r=g(e,t,a);if(!r){let r=_(e,t,a);if(!r)return;let{usage:i,samples:s}=(0,n.sessionUsageSamples)(e,t,a);return{...c(r,i),attempts:[],usage_samples:s}}let i=e.prepare(`
|
|
37
|
+
SELECT a.attempt_number, a.kind, a.request_id, a.outcome, a.started_at, a.finished_at,
|
|
38
|
+
CASE WHEN a.id = ? THEN 'source' ELSE 'resume' END AS role
|
|
39
|
+
FROM work_attempts a
|
|
40
|
+
WHERE a.id = ? OR a.resumed_session_binding_id = ?
|
|
41
|
+
ORDER BY a.started_at ASC, a.id ASC
|
|
42
|
+
`).all(r.source_attempt_id,r.source_attempt_id,r.id),{usage:s,samples:o}=(0,n.sessionUsageSamples)(e,t,a);return{...u(r,s),attempts:i,usage_samples:o}},"isSessionFilter",0,function(e){return"string"==typeof e&&a.includes(e)},"listAgentSessions",0,function(e,t,a="all"){let r=e.prepare(`${i} WHERE b.agent_id = ? ${"active"===a?"AND b.released_at IS NULL":"ended"===a?"AND b.released_at IS NOT NULL":""}`).all(t),o=e.prepare(`${s} AND ps.agent_id = ? ${"active"===a?"AND ps.lifecycle = 'open'":"ended"===a?"AND ps.lifecycle = 'archived'":""}`).all(t),d=(0,n.agentSessionUsage)(e,t);return[...r.map(e=>u(e,d.get(e.id))),...o.map(e=>c(e,d.get(e.id)))].sort(p)},"sessionDebugExternalId",0,function(e,t,n){let a=g(e,t,n)?.external_session_id;if(void 0!==a)return a;if(!_(e,t,n))return;let r=e.prepare("SELECT provider_session_id FROM provider_sessions WHERE id = ? AND agent_id = ?").get(n,t);return r?.provider_session_id},"sessionTitle",0,function(e,t,n){let a=g(e,t,n);if(a)return u(a).title;let r=_(e,t,n);return r?c(r).title:null}])}];
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=_0fe5qz5._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[28244,e=>{"use strict";var t=e.i(89171),a=e.i(22734),r=e.i(14747),n=e.i(25211),i=e.i(85072);async function s(e,{params:o}){try{let e,{name:s}=await o;if(!(0,n.isSafeFileName)(s))return t.NextResponse.json({error:"Invalid file name"},{status:400});let l=(0,i.filesRoot)(),u=r.default.join(l,s);if(!u.startsWith(l+r.default.sep))return t.NextResponse.json({error:"Invalid file name"},{status:400});try{e=a.default.statSync(u)}catch{return t.NextResponse.json({error:"File not found"},{status:404})}if(!e.isFile())return t.NextResponse.json({error:"File not found"},{status:404});let d=a.default.readFileSync(u),c=s.endsWith(".txt")?"text/plain; charset=utf-8":"application/octet-stream";return new t.NextResponse(new Uint8Array(d),{status:200,headers:{"Content-Type":c,"Content-Disposition":`attachment; filename="${s}"`,"Content-Length":String(d.length)}})}catch(e){return console.error("Error serving file:",e),t.NextResponse.json({error:"Failed to serve file"},{status:500})}}e.s(["GET",0,s])},36261,e=>{"use strict";var t=e.i(47909),a=e.i(74017),r=e.i(96250),n=e.i(59756),i=e.i(61916),s=e.i(74677),o=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),h=e.i(70101),R=e.i(26937),f=e.i(10372),v=e.i(93695),m=e.i(9580);e.i(52474);var g=e.i(220);let w=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/files/[name]/route",pathname:"/api/files/[name]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/files/[name]/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(28244),...{}}),{workAsyncStorage:C,workUnitAsyncStorage:E,serverHooks:x}=w;async function y(e,t,r){r.requestMeta&&(0,n.setRequestMeta)(e,r.requestMeta),w.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let C="/api/files/[name]/route";C=C.replace(/\/index$/,"")||"/";let E=await w.prepare(e,t,{srcPage:C,multiZoneDraftMode:!1});if(!E)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:x,deploymentId:y,params:A,nextConfig:T,parsedUrl:N,isDraftMode:S,prerenderManifest:P,routerServerContext:b,isOnDemandRevalidate:O,revalidateOnlyGenerated:_,resolvedPathname:q,clientReferenceManifest:H,serverActionsManifest:I}=E,M=(0,o.normalizeAppPath)(C),U=!!P.routes[q]&&(w.isDev||(0,m.isRouteCacheOwner)(q,w.cacheOwner,P.routes[q])),D=!!(P.dynamicRoutes[M]||U),F=async()=>((null==b?void 0:b.render404)?await b.render404(e,t,N,!1):t.end("This page could not be found"),null);if(D&&!S){let e=P.dynamicRoutes[M];if(e&&!1===e.fallback&&!U){if(T.adapterPath)return await F();throw new v.NoFallbackError}}let j=null;!D||w.isDev||S||(j="/index"===(j=q)?"/":j);let k=!0===w.isDev||!D,K=D&&!k;I&&H&&(0,s.setManifestsSingleton)({page:C,clientReferenceManifest:H,serverActionsManifest:I});let L=e.method||"GET",$=(0,i.getTracer)(),B=$.getActiveScopeSpan(),G=!!(null==b?void 0:b.isWrappedByNextServer),W=!!(0,n.getRequestMeta)(e,"minimalMode"),V=(0,n.getRequestMeta)(e,"incrementalCache")||await w.getIncrementalCache(e,T,P,W);null==V||V.resetRequestCache(),globalThis.__incrementalCache=V;let X={params:A,previewProps:P.preview,renderOpts:{experimental:{authInterrupts:!!T.experimental.authInterrupts,useCacheTimeout:T.experimental.useCacheTimeout},cacheComponents:!!T.cacheComponents,validationLevel:T.experimental.instantInsights.validationLevel,isDraftMode:S,supportsDynamicResponse:k,incrementalCache:V,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:T.cacheLife,staticPageGenerationTimeout:T.staticPageGenerationTimeout,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,n)=>w.onRequestError(e,t,r,n,b)},sharedContext:{buildId:x,deploymentId:y}},z=new l.NodeNextRequest(e),Z=new l.NodeNextResponse(t),J=u.NextRequestAdapter.fromNodeNextRequest(z,(0,u.signalFromNodeResponse)(t)),Q=async({previousCacheEntry:a})=>{try{if(!W&&O&&_&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await w.handle(J,X);e.fetchMetrics=X.renderOpts.fetchMetrics;let i=X.renderOpts.pendingWaitUntil;i&&r.waitUntil&&(r.waitUntil(i),i=void 0);let s=X.renderOpts.collectedTags;if(!D)return await (0,p.sendResponse)(z,Z,n,i),null;{let e=await n.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(n.headers);s&&(t[f.NEXT_CACHE_TAGS_HEADER]=s),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=f.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,r=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=f.INFINITE_CACHE?!1!==a&&a>0?T.expireTime:void 0:X.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:r}}}}catch(t){throw(null==a?void 0:a.isStale)&&await w.onRequestError(e,t,{routerKind:"App Router",routePath:C,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:O})},!1,b),t}},Y=async(n,s)=>{try{var o,l;let n=await w.handleResponse({req:e,nextConfig:T,cacheKey:j,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:P,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:_,responseGenerator:Q,waitUntil:r.waitUntil,isMinimalMode:W});if(!D)return;if((null==n||null==(o=n.value)?void 0:o.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==n||null==(l=n.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});W||t.setHeader("x-nextjs-cache",O?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),S&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let i=(0,h.fromNodeOutgoingHttpHeaders)(n.value.headers);W&&D||i.delete(f.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||i.get("Cache-Control")||i.set("Cache-Control",(0,R.getCacheControlHeader)(n.cacheControl)),await (0,p.sendResponse)(z,Z,new Response(n.value.body,{headers:i,status:n.value.status||200}));return}catch(t){if(t instanceof v.NoFallbackError||await w.onRequestError(e,t,{routerKind:"App Router",routePath:M,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:O})},!1,b),D)throw t;await (0,p.sendResponse)(z,Z,new Response(null,{status:500}));return}finally{(()=>{if(!n)return;let e=t.statusCode;n.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(n.setStatus({code:i.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let a=$.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==d.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=a.get("next.route")||M,o=`${L} ${r}`;n.setAttributes({"next.route":r,"http.route":r,"next.span_name":o}),n.updateName(o),s&&s!==n&&(s.setAttribute("http.route",r),s.updateName(o))})()}};if(G&&B)await Y(B,void 0);else{let t=$.getActiveScopeSpan();await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${L} ${C}`,kind:i.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},e=>Y(e,t)),void 0,!G)}}e.s(["handler",0,y,"patchFetch",0,function(){return(0,r.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:E})},"routeModule",0,w,"serverHooks",0,x,"workAsyncStorage",0,C,"workUnitAsyncStorage",0,E])}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=_0i8_xso._.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module.exports=[74546,e=>{"use strict";var t=e.i(69936);async function n(e,{params:a}){let{pinRef:r}=await a;return(0,t.handleReadPin)(e,r)}e.s(["GET",0,n])},70074,e=>{"use strict";var t=e.i(47909),n=e.i(74017),a=e.i(96250),r=e.i(59756),i=e.i(61916),s=e.i(74677),o=e.i(69741),d=e.i(16795),l=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),_=e.i(70101),g=e.i(26937),h=e.i(10372),v=e.i(93695),f=e.i(9580);e.i(52474);var m=e.i(220);let E=new t.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/v0/pins/[pinRef]/route",pathname:"/api/v0/pins/[pinRef]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/v0/pins/[pinRef]/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(74546),...{}}),{workAsyncStorage:A,workUnitAsyncStorage:b,serverHooks:R}=E;async function y(e,t,a){a.requestMeta&&(0,r.setRequestMeta)(e,a.requestMeta),E.isDev&&(0,r.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let A="/api/v0/pins/[pinRef]/route";A=A.replace(/\/index$/,"")||"/";let b=await E.prepare(e,t,{srcPage:A,multiZoneDraftMode:!1});if(!b)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:R,deploymentId:y,params:S,nextConfig:w,parsedUrl:C,isDraftMode:N,prerenderManifest:O,routerServerContext:T,isOnDemandRevalidate:k,revalidateOnlyGenerated:q,resolvedPathname:I,clientReferenceManifest:x,serverActionsManifest:L}=b,P=(0,o.normalizeAppPath)(A),M=!!O.routes[I]&&(E.isDev||(0,f.isRouteCacheOwner)(I,E.cacheOwner,O.routes[I])),H=!!(O.dynamicRoutes[P]||M),D=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,C,!1):t.end("This page could not be found"),null);if(H&&!N){let e=O.dynamicRoutes[P];if(e&&!1===e.fallback&&!M){if(w.adapterPath)return await D();throw new v.NoFallbackError}}let F=null;!H||E.isDev||N||(F="/index"===(F=I)?"/":F);let U=!0===E.isDev||!H,$=H&&!U;L&&x&&(0,s.setManifestsSingleton)({page:A,clientReferenceManifest:x,serverActionsManifest:L});let K=e.method||"GET",j=(0,i.getTracer)(),W=j.getActiveScopeSpan(),J=!!(null==T?void 0:T.isWrappedByNextServer),G=!!(0,r.getRequestMeta)(e,"minimalMode"),X=(0,r.getRequestMeta)(e,"incrementalCache")||await E.getIncrementalCache(e,w,O,G);null==X||X.resetRequestCache(),globalThis.__incrementalCache=X;let B={params:S,previewProps:O.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts,useCacheTimeout:w.experimental.useCacheTimeout},cacheComponents:!!w.cacheComponents,validationLevel:w.experimental.instantInsights.validationLevel,isDraftMode:N,supportsDynamicResponse:U,incrementalCache:X,hmrRefreshHash:(0,r.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:w.cacheLife,staticPageGenerationTimeout:w.staticPageGenerationTimeout,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,n,a,r)=>E.onRequestError(e,t,a,r,T)},sharedContext:{buildId:R,deploymentId:y}},V=new d.NodeNextRequest(e),Y=new d.NodeNextResponse(t),z=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(t)),Z=async({previousCacheEntry:n})=>{try{if(!G&&k&&q&&!n)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let r=await E.handle(z,B);e.fetchMetrics=B.renderOpts.fetchMetrics;let i=B.renderOpts.pendingWaitUntil;i&&a.waitUntil&&(a.waitUntil(i),i=void 0);let s=B.renderOpts.collectedTags;if(!H)return await (0,p.sendResponse)(V,Y,r,i),null;{let e=await r.blob(),t=(0,_.toNodeOutgoingHttpHeaders)(r.headers);s&&(t[h.NEXT_CACHE_TAGS_HEADER]=s),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let n=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,a=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=h.INFINITE_CACHE?!1!==n&&n>0?w.expireTime:void 0:B.renderOpts.collectedExpire;return{value:{kind:m.CachedRouteKind.APP_ROUTE,status:r.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:n,expire:a}}}}catch(t){throw(null==n?void 0:n.isStale)&&await E.onRequestError(e,t,{routerKind:"App Router",routePath:A,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:k})},!1,T),t}},Q=async(r,s)=>{try{var o,d;let r=await E.handleResponse({req:e,nextConfig:w,cacheKey:F,routeKind:n.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:O,isRoutePPREnabled:!1,isOnDemandRevalidate:k,revalidateOnlyGenerated:q,responseGenerator:Z,waitUntil:a.waitUntil,isMinimalMode:G});if(!H)return;if((null==r||null==(o=r.value)?void 0:o.kind)!==m.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==r||null==(d=r.value)?void 0:d.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});G||t.setHeader("x-nextjs-cache",k?"REVALIDATED":r.isMiss?"MISS":r.isStale?"STALE":"HIT"),N&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let i=(0,_.fromNodeOutgoingHttpHeaders)(r.value.headers);G&&H||i.delete(h.NEXT_CACHE_TAGS_HEADER),!r.cacheControl||t.getHeader("Cache-Control")||i.get("Cache-Control")||i.set("Cache-Control",(0,g.getCacheControlHeader)(r.cacheControl)),await (0,p.sendResponse)(V,Y,new Response(r.value.body,{headers:i,status:r.value.status||200}));return}catch(t){if(t instanceof v.NoFallbackError||await E.onRequestError(e,t,{routerKind:"App Router",routePath:P,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:k})},!1,T),H)throw t;await (0,p.sendResponse)(V,Y,new Response(null,{status:500}));return}finally{(()=>{if(!r)return;let e=t.statusCode;r.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(r.setStatus({code:i.SpanStatusCode.ERROR}),r.setAttribute("error.type",e.toString()));let n=j.getRootSpanAttributes();if(!n)return;if(n.get("next.span_type")!==u.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${n.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=n.get("next.route")||P,o=`${K} ${a}`;r.setAttributes({"next.route":a,"http.route":a,"next.span_name":o}),r.updateName(o),s&&s!==r&&(s.setAttribute("http.route",a),s.updateName(o))})()}};if(J&&W)await Q(W,void 0);else{let t=j.getActiveScopeSpan();await j.withPropagatedContext(e.headers,()=>j.trace(u.BaseServerSpan.handleRequest,{spanName:`${K} ${A}`,kind:i.SpanKind.SERVER,attributes:{"http.method":K,"http.target":e.url}},e=>Q(e,t)),void 0,!J)}}e.s(["handler",0,y,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:b})},"routeModule",0,E,"serverHooks",0,R,"workAsyncStorage",0,A,"workUnitAsyncStorage",0,b])},43345,e=>{"use strict";var t=e.i(62294),n=e.i(26571),a=e.i(45383);let r=["authentication_unavailable","unauthenticated","principal_mismatch","agent_not_found","conversation_not_found","request_not_found"];async function i(e,n){let i,s=null,o=!1,d=null;try{i=await e(e=>{s=e},()=>{let e=s;n&&e&&"service"===e.kind&&t.serviceAudit.append({principal:e,operation:n.operation,capability:"participant",targetKind:n.targetKind,targetRef:n.targetRef,outcome:"allowed",code:null}),o=!0})}catch(e){if(e instanceof a.AgentApiError)d=e.code,i=Response.json({error:{code:e.code,message:e.message}},{status:e.status});else console.error("Agent conversation API error:",e),d="internal_error",i=Response.json({error:{code:"internal_error",message:"The request could not be processed."}},{status:500})}let l=s;if(o&&null===d)return i;if(n&&l&&"service"===l.kind)try{t.serviceAudit.append({principal:l,operation:n.operation,capability:"participant",targetKind:n.targetKind,targetRef:n.targetRef,outcome:null===d?"allowed":"internal_error"===d?"error":r.includes(d)?"denied":"rejected",code:d})}catch(e){return console.error("Service audit append failed:",e instanceof Error?e.message:"unknown error"),Response.json({error:{code:"internal_error",message:"The request could not be processed."}},{status:500})}return i}async function s(e){let t,r=function(){try{return(0,n.serviceTokenAuthenticatorFromEnv)()}catch(e){if(e instanceof n.ServiceTokenConfigError)return console.error(`Agent API authentication disabled: ${e.message}`),null;throw e}}();if(!r)throw new a.AgentApiError("authentication_unavailable","No authenticator is configured for the agent conversation API.");try{t=await r(e)}catch{t=null}if(!t||!(0,a.isPrincipalKind)(t.kind)||"string"!=typeof t.id||!t.id.trim())throw new a.AgentApiError("unauthenticated","Authentication failed.");return{kind:t.kind,id:t.id}}async function o(e,t){return i(async(n,r)=>{var i;let o,d=await s(e);n(d);try{let t=await e.json();if(!t||"object"!=typeof t||Array.isArray(t))throw Error("not an object");o=t}catch{throw new a.AgentApiError("invalid_request","The request body must be a JSON object.")}let l=null==(i=o.principal)?null:{kind:i.kind,id:String(i.id??"")};if(l&&!(0,a.samePrincipal)(l,d))throw new a.AgentApiError("principal_mismatch","The declared principal does not match the authenticated principal.");let u=e.headers.get("idempotency-key"),c="string"==typeof o.idempotencyKey?o.idempotencyKey:null;if(u&&c&&u!==c)throw new a.AgentApiError("invalid_request","Idempotency-Key header and body idempotencyKey differ.");let p=u??c??"";if(p.toLowerCase().startsWith(a.MCP_IDEMPOTENCY_PREFIX))throw new a.AgentApiError("invalid_request",`Idempotency keys starting with "${a.MCP_IDEMPOTENCY_PREFIX}" are reserved for the MCP bridge.`);let{accepted:_,dispatched:g}=(0,a.acceptAgentMessage)(d,{agentId:t,content:"string"==typeof o.content?o.content:"",idempotencyKey:p,conversationId:"string"==typeof o.conversationId?o.conversationId:null==o.conversationId?null:""},r);return!0===o.wait?(await g,Response.json({...(0,a.getAgentRequest)(d,_.requestId),replayed:_.replayed})):Response.json(_,{status:_.replayed?200:202})},{operation:"agents.message",targetKind:"agent",targetRef:t})}async function d(e,t){return i(async n=>{let r=await s(e);return n(r),Response.json((0,a.getConversation)(r,t))},{operation:"conversations.read",targetKind:"conversation",targetRef:t})}async function l(e,t){return i(async n=>{let r=await s(e);return n(r),Response.json((0,a.getAgentRequest)(r,t))},{operation:"requests.read",targetKind:"request",targetRef:t})}e.s(["authenticate",0,s,"handleGetAgentRequest",0,l,"handleGetConversation",0,d,"handleSendAgentMessage",0,o])},90027,e=>{"use strict";var t=e.i(62349),n=e.i(28420);let a=["active","ended","all"],r=["implementation","revision"],i=`
|
|
2
|
+
SELECT b.*, bot.name AS agent_name, bot.agent AS agent_runtime, r.id AS origin_request_id, c.id AS origin_conversation_id,
|
|
3
|
+
c.type AS conversation_type, c.bot_id AS conversation_bot_id, tb.name AS thread_agent_name, g.name AS group_name,
|
|
4
|
+
r.intent AS request_intent, r.execution_kind AS request_kind, r.state AS request_state,
|
|
5
|
+
r.source_conversation_id AS request_conversation_id, r.target_agent_id AS request_target_agent_id,
|
|
6
|
+
sa.launch_snapshot AS source_snapshot, sa.finished_at AS source_finished_at,
|
|
7
|
+
(SELECT MAX(COALESCE(ra.finished_at, ra.started_at)) FROM work_attempts ra WHERE ra.resumed_session_binding_id = b.id) AS resumed_last_at,
|
|
8
|
+
EXISTS (SELECT 1 FROM work_attempts oa WHERE oa.resumed_session_binding_id = b.id AND oa.finished_at IS NULL) AS attempt_running,
|
|
9
|
+
ps.availability AS ps_availability, ps.lifecycle AS ps_lifecycle, ps.resumable AS ps_resumable, ps.busy AS ps_busy,
|
|
10
|
+
ps.workspace AS ps_workspace, ps.last_synced_at AS ps_synced_at,
|
|
11
|
+
EXISTS (SELECT 1 FROM provider_session_turns pt WHERE pt.session_ref = ps.id AND pt.state = 'running') AS ps_running
|
|
12
|
+
FROM session_bindings b
|
|
13
|
+
JOIN bots bot ON bot.id = b.agent_id
|
|
14
|
+
LEFT JOIN provider_sessions ps ON ps.binding_id = b.id
|
|
15
|
+
LEFT JOIN work_attempts sa ON sa.id = b.source_attempt_id
|
|
16
|
+
LEFT JOIN work_requests r ON r.id = COALESCE(b.request_id, sa.request_id)
|
|
17
|
+
LEFT JOIN conversations c ON c.id = COALESCE(b.conversation_id, r.source_conversation_id)
|
|
18
|
+
LEFT JOIN bots tb ON tb.id = c.bot_id
|
|
19
|
+
LEFT JOIN groups g ON g.id = c.group_id
|
|
20
|
+
`,s=`
|
|
21
|
+
SELECT ps.id, ps.agent_id, bot.name AS agent_name, ps.provider_kind, ps.title, ps.workspace,
|
|
22
|
+
ps.provider_created_at, ps.provider_updated_at, ps.availability, ps.lifecycle, ps.resumable, ps.busy,
|
|
23
|
+
ps.last_synced_at, ps.created_at, ps.updated_at,
|
|
24
|
+
(SELECT MAX(COALESCE(t.finished_at, t.created_at)) FROM provider_session_turns t WHERE t.session_ref = ps.id) AS turn_last_at,
|
|
25
|
+
EXISTS (SELECT 1 FROM provider_session_turns t WHERE t.session_ref = ps.id AND t.state = 'running') AS running
|
|
26
|
+
FROM provider_sessions ps
|
|
27
|
+
JOIN bots bot ON bot.id = ps.agent_id
|
|
28
|
+
WHERE ps.binding_id IS NULL
|
|
29
|
+
`;function o(e){return`${new Date(e).toISOString().slice(0,16).replace("T"," ")} UTC`}function d(e,t){let n=e?.[t];return"string"==typeof n&&n.trim().length>0?n:null}function l(e){let t=e.origin_conversation_id;return t?"group"===e.conversation_type?{id:t,kind:"group",label:e.group_name?`Group ${e.group_name}`:"Group thread",thread_agent_id:null}:"bot"===e.conversation_type&&e.conversation_bot_id?{id:t,kind:"direct",label:e.thread_agent_name?`${e.thread_agent_name} thread`:"Agent thread",thread_agent_id:e.thread_agent_name?e.conversation_bot_id:null}:{id:t,kind:"agent_api",label:"Agent API conversation",thread_agent_id:null}:null}function u(e,a=(0,n.emptyUsage)()){let i,s=null;try{s=e.source_snapshot?JSON.parse(e.source_snapshot):null}catch{}let c=l(e),p=null===e.released_at?"active":"ended",_=((i=(e.request_intent??"").split("\n").map(e=>e.trim()).find(e=>e.length>0))?i.length>80?`${i.slice(0,79).trimEnd()}…`:i:null)??(c?.kind==="group"?c.label:null)??`${e.agent_name} \xb7 ${o(e.created_at)}`;return{ref:e.id,source:"botmancers",agent:{id:e.agent_id,name:e.agent_name,adapter:e.adapter,transport:d(s,"transport")},title:_,status:p,resumable:null===e.released_at&&null!==e.request_id&&null!==e.request_kind&&r.includes(e.request_kind)&&e.request_target_agent_id===e.agent_id&&(e.conversation_id??"")===(e.request_conversation_id??"")&&e.adapter===(0,t.resolveAgent)({agent:e.agent_runtime}).agent,state:{availability:e.ps_availability??"available",lifecycle:e.ps_lifecycle??"open",resumable:null===e.ps_resumable||void 0===e.ps_resumable?null:1===e.ps_resumable,busy:1===e.ps_busy||!!e.attempt_running||!!e.ps_running,synced_at:e.ps_synced_at??null},created_at:e.created_at,ended_at:e.released_at,last_activity_at:Math.max(e.created_at,e.released_at??0,e.source_finished_at??0,e.resumed_last_at??0),origin:{conversation:c,work_request:e.origin_request_id&&e.request_kind&&e.request_state?{id:e.origin_request_id,execution_kind:e.request_kind,state:e.request_state}:null},context:{workspace:d(s,"cwd")??e.ps_workspace??null,deck:d(s,"deck")},usage:a}}function c(e,t=(0,n.emptyUsage)()){let a=e.provider_created_at??e.created_at,r=null===e.resumable?null:1===e.resumable,i="archived"===e.lifecycle?e.provider_updated_at??e.updated_at:null;return{ref:e.id,source:"native",agent:{id:e.agent_id,name:e.agent_name,adapter:e.provider_kind,transport:null},title:e.title??`${e.agent_name} \xb7 ${o(a)}`,status:"open"===e.lifecycle?"active":"ended",resumable:!1,state:{availability:e.availability,lifecycle:e.lifecycle,resumable:r,busy:1===e.busy||!!e.running,synced_at:e.last_synced_at},created_at:a,ended_at:i,last_activity_at:Math.max(a,e.provider_updated_at??0,e.turn_last_at??0),origin:{conversation:null,work_request:null},context:{workspace:e.workspace,deck:null},usage:t}}function p(e,t){return t.last_activity_at-e.last_activity_at||t.created_at-e.created_at||(e.ref<t.ref?-1:+(e.ref>t.ref))}function _(e,t,n){return e.prepare(`${s} AND ps.id = ? AND ps.agent_id = ?`).get(n,t)}function g(e,t,n){return e.prepare(`${i} WHERE b.id = ? AND b.agent_id = ?`).get(n,t)}e.s(["agentExists",0,function(e,t){return!!e.prepare("SELECT 1 FROM bots WHERE id = ?").get(t)},"conversationRef",0,function(e,t){let n=e.prepare(`
|
|
30
|
+
SELECT c.id AS origin_conversation_id, c.type AS conversation_type, c.bot_id AS conversation_bot_id,
|
|
31
|
+
tb.name AS thread_agent_name, g.name AS group_name
|
|
32
|
+
FROM conversations c
|
|
33
|
+
LEFT JOIN bots tb ON tb.id = c.bot_id
|
|
34
|
+
LEFT JOIN groups g ON g.id = c.group_id
|
|
35
|
+
WHERE c.id = ?
|
|
36
|
+
`).get(t);return n?l(n):null},"getAgentSession",0,function(e,t,a){let r=g(e,t,a);if(!r){let r=_(e,t,a);if(!r)return;let{usage:i,samples:s}=(0,n.sessionUsageSamples)(e,t,a);return{...c(r,i),attempts:[],usage_samples:s}}let i=e.prepare(`
|
|
37
|
+
SELECT a.attempt_number, a.kind, a.request_id, a.outcome, a.started_at, a.finished_at,
|
|
38
|
+
CASE WHEN a.id = ? THEN 'source' ELSE 'resume' END AS role
|
|
39
|
+
FROM work_attempts a
|
|
40
|
+
WHERE a.id = ? OR a.resumed_session_binding_id = ?
|
|
41
|
+
ORDER BY a.started_at ASC, a.id ASC
|
|
42
|
+
`).all(r.source_attempt_id,r.source_attempt_id,r.id),{usage:s,samples:o}=(0,n.sessionUsageSamples)(e,t,a);return{...u(r,s),attempts:i,usage_samples:o}},"isSessionFilter",0,function(e){return"string"==typeof e&&a.includes(e)},"listAgentSessions",0,function(e,t,a="all"){let r=e.prepare(`${i} WHERE b.agent_id = ? ${"active"===a?"AND b.released_at IS NULL":"ended"===a?"AND b.released_at IS NOT NULL":""}`).all(t),o=e.prepare(`${s} AND ps.agent_id = ? ${"active"===a?"AND ps.lifecycle = 'open'":"ended"===a?"AND ps.lifecycle = 'archived'":""}`).all(t),d=(0,n.agentSessionUsage)(e,t);return[...r.map(e=>u(e,d.get(e.id))),...o.map(e=>c(e,d.get(e.id)))].sort(p)},"sessionDebugExternalId",0,function(e,t,n){let a=g(e,t,n)?.external_session_id;if(void 0!==a)return a;if(!_(e,t,n))return;let r=e.prepare("SELECT provider_session_id FROM provider_sessions WHERE id = ? AND agent_id = ?").get(n,t);return r?.provider_session_id},"sessionTitle",0,function(e,t,n){let a=g(e,t,n);if(a)return u(a).title;let r=_(e,t,n);return r?c(r).title:null}])}];
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=_0qoji5a._.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module.exports=[39782,e=>{"use strict";var t=e.i(69936);async function n(e,{params:a}){let{agentId:r}=await a;return(0,t.handleMessageAgent)(e,r)}e.s(["POST",0,n])},18397,e=>{"use strict";var t=e.i(47909),n=e.i(74017),a=e.i(96250),r=e.i(59756),i=e.i(61916),s=e.i(74677),o=e.i(69741),d=e.i(16795),l=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),_=e.i(70101),g=e.i(26937),h=e.i(10372),v=e.i(93695),m=e.i(9580);e.i(52474);var f=e.i(220);let E=new t.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/v0/agents/[agentId]/pins/route",pathname:"/api/v0/agents/[agentId]/pins",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/v0/agents/[agentId]/pins/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(39782),...{}}),{workAsyncStorage:A,workUnitAsyncStorage:b,serverHooks:y}=E;async function R(e,t,a){a.requestMeta&&(0,r.setRequestMeta)(e,a.requestMeta),E.isDev&&(0,r.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let A="/api/v0/agents/[agentId]/pins/route";A=A.replace(/\/index$/,"")||"/";let b=await E.prepare(e,t,{srcPage:A,multiZoneDraftMode:!1});if(!b)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:y,deploymentId:R,params:S,nextConfig:w,parsedUrl:C,isDraftMode:N,prerenderManifest:O,routerServerContext:T,isOnDemandRevalidate:k,revalidateOnlyGenerated:q,resolvedPathname:I,clientReferenceManifest:x,serverActionsManifest:L}=b,P=(0,o.normalizeAppPath)(A),M=!!O.routes[I]&&(E.isDev||(0,m.isRouteCacheOwner)(I,E.cacheOwner,O.routes[I])),H=!!(O.dynamicRoutes[P]||M),D=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,C,!1):t.end("This page could not be found"),null);if(H&&!N){let e=O.dynamicRoutes[P];if(e&&!1===e.fallback&&!M){if(w.adapterPath)return await D();throw new v.NoFallbackError}}let F=null;!H||E.isDev||N||(F="/index"===(F=I)?"/":F);let U=!0===E.isDev||!H,$=H&&!U;L&&x&&(0,s.setManifestsSingleton)({page:A,clientReferenceManifest:x,serverActionsManifest:L});let K=e.method||"GET",j=(0,i.getTracer)(),W=j.getActiveScopeSpan(),J=!!(null==T?void 0:T.isWrappedByNextServer),X=!!(0,r.getRequestMeta)(e,"minimalMode"),G=(0,r.getRequestMeta)(e,"incrementalCache")||await E.getIncrementalCache(e,w,O,X);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let B={params:S,previewProps:O.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts,useCacheTimeout:w.experimental.useCacheTimeout},cacheComponents:!!w.cacheComponents,validationLevel:w.experimental.instantInsights.validationLevel,isDraftMode:N,supportsDynamicResponse:U,incrementalCache:G,hmrRefreshHash:(0,r.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:w.cacheLife,staticPageGenerationTimeout:w.staticPageGenerationTimeout,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,n,a,r)=>E.onRequestError(e,t,a,r,T)},sharedContext:{buildId:y,deploymentId:R}},V=new d.NodeNextRequest(e),Y=new d.NodeNextResponse(t),z=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(t)),Z=async({previousCacheEntry:n})=>{try{if(!X&&k&&q&&!n)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let r=await E.handle(z,B);e.fetchMetrics=B.renderOpts.fetchMetrics;let i=B.renderOpts.pendingWaitUntil;i&&a.waitUntil&&(a.waitUntil(i),i=void 0);let s=B.renderOpts.collectedTags;if(!H)return await (0,p.sendResponse)(V,Y,r,i),null;{let e=await r.blob(),t=(0,_.toNodeOutgoingHttpHeaders)(r.headers);s&&(t[h.NEXT_CACHE_TAGS_HEADER]=s),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let n=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,a=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=h.INFINITE_CACHE?!1!==n&&n>0?w.expireTime:void 0:B.renderOpts.collectedExpire;return{value:{kind:f.CachedRouteKind.APP_ROUTE,status:r.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:n,expire:a}}}}catch(t){throw(null==n?void 0:n.isStale)&&await E.onRequestError(e,t,{routerKind:"App Router",routePath:A,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:k})},!1,T),t}},Q=async(r,s)=>{try{var o,d;let r=await E.handleResponse({req:e,nextConfig:w,cacheKey:F,routeKind:n.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:O,isRoutePPREnabled:!1,isOnDemandRevalidate:k,revalidateOnlyGenerated:q,responseGenerator:Z,waitUntil:a.waitUntil,isMinimalMode:X});if(!H)return;if((null==r||null==(o=r.value)?void 0:o.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==r||null==(d=r.value)?void 0:d.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});X||t.setHeader("x-nextjs-cache",k?"REVALIDATED":r.isMiss?"MISS":r.isStale?"STALE":"HIT"),N&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let i=(0,_.fromNodeOutgoingHttpHeaders)(r.value.headers);X&&H||i.delete(h.NEXT_CACHE_TAGS_HEADER),!r.cacheControl||t.getHeader("Cache-Control")||i.get("Cache-Control")||i.set("Cache-Control",(0,g.getCacheControlHeader)(r.cacheControl)),await (0,p.sendResponse)(V,Y,new Response(r.value.body,{headers:i,status:r.value.status||200}));return}catch(t){if(t instanceof v.NoFallbackError||await E.onRequestError(e,t,{routerKind:"App Router",routePath:P,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:k})},!1,T),H)throw t;await (0,p.sendResponse)(V,Y,new Response(null,{status:500}));return}finally{(()=>{if(!r)return;let e=t.statusCode;r.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(r.setStatus({code:i.SpanStatusCode.ERROR}),r.setAttribute("error.type",e.toString()));let n=j.getRootSpanAttributes();if(!n)return;if(n.get("next.span_type")!==u.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${n.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=n.get("next.route")||P,o=`${K} ${a}`;r.setAttributes({"next.route":a,"http.route":a,"next.span_name":o}),r.updateName(o),s&&s!==r&&(s.setAttribute("http.route",a),s.updateName(o))})()}};if(J&&W)await Q(W,void 0);else{let t=j.getActiveScopeSpan();await j.withPropagatedContext(e.headers,()=>j.trace(u.BaseServerSpan.handleRequest,{spanName:`${K} ${A}`,kind:i.SpanKind.SERVER,attributes:{"http.method":K,"http.target":e.url}},e=>Q(e,t)),void 0,!J)}}e.s(["handler",0,R,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:b})},"routeModule",0,E,"serverHooks",0,y,"workAsyncStorage",0,A,"workUnitAsyncStorage",0,b])},43345,e=>{"use strict";var t=e.i(62294),n=e.i(26571),a=e.i(45383);let r=["authentication_unavailable","unauthenticated","principal_mismatch","agent_not_found","conversation_not_found","request_not_found"];async function i(e,n){let i,s=null,o=!1,d=null;try{i=await e(e=>{s=e},()=>{let e=s;n&&e&&"service"===e.kind&&t.serviceAudit.append({principal:e,operation:n.operation,capability:"participant",targetKind:n.targetKind,targetRef:n.targetRef,outcome:"allowed",code:null}),o=!0})}catch(e){if(e instanceof a.AgentApiError)d=e.code,i=Response.json({error:{code:e.code,message:e.message}},{status:e.status});else console.error("Agent conversation API error:",e),d="internal_error",i=Response.json({error:{code:"internal_error",message:"The request could not be processed."}},{status:500})}let l=s;if(o&&null===d)return i;if(n&&l&&"service"===l.kind)try{t.serviceAudit.append({principal:l,operation:n.operation,capability:"participant",targetKind:n.targetKind,targetRef:n.targetRef,outcome:null===d?"allowed":"internal_error"===d?"error":r.includes(d)?"denied":"rejected",code:d})}catch(e){return console.error("Service audit append failed:",e instanceof Error?e.message:"unknown error"),Response.json({error:{code:"internal_error",message:"The request could not be processed."}},{status:500})}return i}async function s(e){let t,r=function(){try{return(0,n.serviceTokenAuthenticatorFromEnv)()}catch(e){if(e instanceof n.ServiceTokenConfigError)return console.error(`Agent API authentication disabled: ${e.message}`),null;throw e}}();if(!r)throw new a.AgentApiError("authentication_unavailable","No authenticator is configured for the agent conversation API.");try{t=await r(e)}catch{t=null}if(!t||!(0,a.isPrincipalKind)(t.kind)||"string"!=typeof t.id||!t.id.trim())throw new a.AgentApiError("unauthenticated","Authentication failed.");return{kind:t.kind,id:t.id}}async function o(e,t){return i(async(n,r)=>{var i;let o,d=await s(e);n(d);try{let t=await e.json();if(!t||"object"!=typeof t||Array.isArray(t))throw Error("not an object");o=t}catch{throw new a.AgentApiError("invalid_request","The request body must be a JSON object.")}let l=null==(i=o.principal)?null:{kind:i.kind,id:String(i.id??"")};if(l&&!(0,a.samePrincipal)(l,d))throw new a.AgentApiError("principal_mismatch","The declared principal does not match the authenticated principal.");let u=e.headers.get("idempotency-key"),c="string"==typeof o.idempotencyKey?o.idempotencyKey:null;if(u&&c&&u!==c)throw new a.AgentApiError("invalid_request","Idempotency-Key header and body idempotencyKey differ.");let p=u??c??"";if(p.toLowerCase().startsWith(a.MCP_IDEMPOTENCY_PREFIX))throw new a.AgentApiError("invalid_request",`Idempotency keys starting with "${a.MCP_IDEMPOTENCY_PREFIX}" are reserved for the MCP bridge.`);let{accepted:_,dispatched:g}=(0,a.acceptAgentMessage)(d,{agentId:t,content:"string"==typeof o.content?o.content:"",idempotencyKey:p,conversationId:"string"==typeof o.conversationId?o.conversationId:null==o.conversationId?null:""},r);return!0===o.wait?(await g,Response.json({...(0,a.getAgentRequest)(d,_.requestId),replayed:_.replayed})):Response.json(_,{status:_.replayed?200:202})},{operation:"agents.message",targetKind:"agent",targetRef:t})}async function d(e,t){return i(async n=>{let r=await s(e);return n(r),Response.json((0,a.getConversation)(r,t))},{operation:"conversations.read",targetKind:"conversation",targetRef:t})}async function l(e,t){return i(async n=>{let r=await s(e);return n(r),Response.json((0,a.getAgentRequest)(r,t))},{operation:"requests.read",targetKind:"request",targetRef:t})}e.s(["authenticate",0,s,"handleGetAgentRequest",0,l,"handleGetConversation",0,d,"handleSendAgentMessage",0,o])},90027,e=>{"use strict";var t=e.i(62349),n=e.i(28420);let a=["active","ended","all"],r=["implementation","revision"],i=`
|
|
2
|
+
SELECT b.*, bot.name AS agent_name, bot.agent AS agent_runtime, r.id AS origin_request_id, c.id AS origin_conversation_id,
|
|
3
|
+
c.type AS conversation_type, c.bot_id AS conversation_bot_id, tb.name AS thread_agent_name, g.name AS group_name,
|
|
4
|
+
r.intent AS request_intent, r.execution_kind AS request_kind, r.state AS request_state,
|
|
5
|
+
r.source_conversation_id AS request_conversation_id, r.target_agent_id AS request_target_agent_id,
|
|
6
|
+
sa.launch_snapshot AS source_snapshot, sa.finished_at AS source_finished_at,
|
|
7
|
+
(SELECT MAX(COALESCE(ra.finished_at, ra.started_at)) FROM work_attempts ra WHERE ra.resumed_session_binding_id = b.id) AS resumed_last_at,
|
|
8
|
+
EXISTS (SELECT 1 FROM work_attempts oa WHERE oa.resumed_session_binding_id = b.id AND oa.finished_at IS NULL) AS attempt_running,
|
|
9
|
+
ps.availability AS ps_availability, ps.lifecycle AS ps_lifecycle, ps.resumable AS ps_resumable, ps.busy AS ps_busy,
|
|
10
|
+
ps.workspace AS ps_workspace, ps.last_synced_at AS ps_synced_at,
|
|
11
|
+
EXISTS (SELECT 1 FROM provider_session_turns pt WHERE pt.session_ref = ps.id AND pt.state = 'running') AS ps_running
|
|
12
|
+
FROM session_bindings b
|
|
13
|
+
JOIN bots bot ON bot.id = b.agent_id
|
|
14
|
+
LEFT JOIN provider_sessions ps ON ps.binding_id = b.id
|
|
15
|
+
LEFT JOIN work_attempts sa ON sa.id = b.source_attempt_id
|
|
16
|
+
LEFT JOIN work_requests r ON r.id = COALESCE(b.request_id, sa.request_id)
|
|
17
|
+
LEFT JOIN conversations c ON c.id = COALESCE(b.conversation_id, r.source_conversation_id)
|
|
18
|
+
LEFT JOIN bots tb ON tb.id = c.bot_id
|
|
19
|
+
LEFT JOIN groups g ON g.id = c.group_id
|
|
20
|
+
`,s=`
|
|
21
|
+
SELECT ps.id, ps.agent_id, bot.name AS agent_name, ps.provider_kind, ps.title, ps.workspace,
|
|
22
|
+
ps.provider_created_at, ps.provider_updated_at, ps.availability, ps.lifecycle, ps.resumable, ps.busy,
|
|
23
|
+
ps.last_synced_at, ps.created_at, ps.updated_at,
|
|
24
|
+
(SELECT MAX(COALESCE(t.finished_at, t.created_at)) FROM provider_session_turns t WHERE t.session_ref = ps.id) AS turn_last_at,
|
|
25
|
+
EXISTS (SELECT 1 FROM provider_session_turns t WHERE t.session_ref = ps.id AND t.state = 'running') AS running
|
|
26
|
+
FROM provider_sessions ps
|
|
27
|
+
JOIN bots bot ON bot.id = ps.agent_id
|
|
28
|
+
WHERE ps.binding_id IS NULL
|
|
29
|
+
`;function o(e){return`${new Date(e).toISOString().slice(0,16).replace("T"," ")} UTC`}function d(e,t){let n=e?.[t];return"string"==typeof n&&n.trim().length>0?n:null}function l(e){let t=e.origin_conversation_id;return t?"group"===e.conversation_type?{id:t,kind:"group",label:e.group_name?`Group ${e.group_name}`:"Group thread",thread_agent_id:null}:"bot"===e.conversation_type&&e.conversation_bot_id?{id:t,kind:"direct",label:e.thread_agent_name?`${e.thread_agent_name} thread`:"Agent thread",thread_agent_id:e.thread_agent_name?e.conversation_bot_id:null}:{id:t,kind:"agent_api",label:"Agent API conversation",thread_agent_id:null}:null}function u(e,a=(0,n.emptyUsage)()){let i,s=null;try{s=e.source_snapshot?JSON.parse(e.source_snapshot):null}catch{}let c=l(e),p=null===e.released_at?"active":"ended",_=((i=(e.request_intent??"").split("\n").map(e=>e.trim()).find(e=>e.length>0))?i.length>80?`${i.slice(0,79).trimEnd()}…`:i:null)??(c?.kind==="group"?c.label:null)??`${e.agent_name} \xb7 ${o(e.created_at)}`;return{ref:e.id,source:"botmancers",agent:{id:e.agent_id,name:e.agent_name,adapter:e.adapter,transport:d(s,"transport")},title:_,status:p,resumable:null===e.released_at&&null!==e.request_id&&null!==e.request_kind&&r.includes(e.request_kind)&&e.request_target_agent_id===e.agent_id&&(e.conversation_id??"")===(e.request_conversation_id??"")&&e.adapter===(0,t.resolveAgent)({agent:e.agent_runtime}).agent,state:{availability:e.ps_availability??"available",lifecycle:e.ps_lifecycle??"open",resumable:null===e.ps_resumable||void 0===e.ps_resumable?null:1===e.ps_resumable,busy:1===e.ps_busy||!!e.attempt_running||!!e.ps_running,synced_at:e.ps_synced_at??null},created_at:e.created_at,ended_at:e.released_at,last_activity_at:Math.max(e.created_at,e.released_at??0,e.source_finished_at??0,e.resumed_last_at??0),origin:{conversation:c,work_request:e.origin_request_id&&e.request_kind&&e.request_state?{id:e.origin_request_id,execution_kind:e.request_kind,state:e.request_state}:null},context:{workspace:d(s,"cwd")??e.ps_workspace??null,deck:d(s,"deck")},usage:a}}function c(e,t=(0,n.emptyUsage)()){let a=e.provider_created_at??e.created_at,r=null===e.resumable?null:1===e.resumable,i="archived"===e.lifecycle?e.provider_updated_at??e.updated_at:null;return{ref:e.id,source:"native",agent:{id:e.agent_id,name:e.agent_name,adapter:e.provider_kind,transport:null},title:e.title??`${e.agent_name} \xb7 ${o(a)}`,status:"open"===e.lifecycle?"active":"ended",resumable:!1,state:{availability:e.availability,lifecycle:e.lifecycle,resumable:r,busy:1===e.busy||!!e.running,synced_at:e.last_synced_at},created_at:a,ended_at:i,last_activity_at:Math.max(a,e.provider_updated_at??0,e.turn_last_at??0),origin:{conversation:null,work_request:null},context:{workspace:e.workspace,deck:null},usage:t}}function p(e,t){return t.last_activity_at-e.last_activity_at||t.created_at-e.created_at||(e.ref<t.ref?-1:+(e.ref>t.ref))}function _(e,t,n){return e.prepare(`${s} AND ps.id = ? AND ps.agent_id = ?`).get(n,t)}function g(e,t,n){return e.prepare(`${i} WHERE b.id = ? AND b.agent_id = ?`).get(n,t)}e.s(["agentExists",0,function(e,t){return!!e.prepare("SELECT 1 FROM bots WHERE id = ?").get(t)},"conversationRef",0,function(e,t){let n=e.prepare(`
|
|
30
|
+
SELECT c.id AS origin_conversation_id, c.type AS conversation_type, c.bot_id AS conversation_bot_id,
|
|
31
|
+
tb.name AS thread_agent_name, g.name AS group_name
|
|
32
|
+
FROM conversations c
|
|
33
|
+
LEFT JOIN bots tb ON tb.id = c.bot_id
|
|
34
|
+
LEFT JOIN groups g ON g.id = c.group_id
|
|
35
|
+
WHERE c.id = ?
|
|
36
|
+
`).get(t);return n?l(n):null},"getAgentSession",0,function(e,t,a){let r=g(e,t,a);if(!r){let r=_(e,t,a);if(!r)return;let{usage:i,samples:s}=(0,n.sessionUsageSamples)(e,t,a);return{...c(r,i),attempts:[],usage_samples:s}}let i=e.prepare(`
|
|
37
|
+
SELECT a.attempt_number, a.kind, a.request_id, a.outcome, a.started_at, a.finished_at,
|
|
38
|
+
CASE WHEN a.id = ? THEN 'source' ELSE 'resume' END AS role
|
|
39
|
+
FROM work_attempts a
|
|
40
|
+
WHERE a.id = ? OR a.resumed_session_binding_id = ?
|
|
41
|
+
ORDER BY a.started_at ASC, a.id ASC
|
|
42
|
+
`).all(r.source_attempt_id,r.source_attempt_id,r.id),{usage:s,samples:o}=(0,n.sessionUsageSamples)(e,t,a);return{...u(r,s),attempts:i,usage_samples:o}},"isSessionFilter",0,function(e){return"string"==typeof e&&a.includes(e)},"listAgentSessions",0,function(e,t,a="all"){let r=e.prepare(`${i} WHERE b.agent_id = ? ${"active"===a?"AND b.released_at IS NULL":"ended"===a?"AND b.released_at IS NOT NULL":""}`).all(t),o=e.prepare(`${s} AND ps.agent_id = ? ${"active"===a?"AND ps.lifecycle = 'open'":"ended"===a?"AND ps.lifecycle = 'archived'":""}`).all(t),d=(0,n.agentSessionUsage)(e,t);return[...r.map(e=>u(e,d.get(e.id))),...o.map(e=>c(e,d.get(e.id)))].sort(p)},"sessionDebugExternalId",0,function(e,t,n){let a=g(e,t,n)?.external_session_id;if(void 0!==a)return a;if(!_(e,t,n))return;let r=e.prepare("SELECT provider_session_id FROM provider_sessions WHERE id = ? AND agent_id = ?").get(n,t);return r?.provider_session_id},"sessionTitle",0,function(e,t,n){let a=g(e,t,n);if(a)return u(a).title;let r=_(e,t,n);return r?c(r).title:null}])}];
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=_0uv2pi5._.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module.exports=[48683,e=>{"use strict";var t=e.i(69936);async function n(e,{params:a}){let{ref:r}=await a;return(0,t.handleSendSessionMessage)(e,r)}e.s(["POST",0,n])},78219,e=>{"use strict";var t=e.i(47909),n=e.i(74017),a=e.i(96250),r=e.i(59756),i=e.i(61916),s=e.i(74677),o=e.i(69741),d=e.i(16795),l=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),_=e.i(70101),g=e.i(26937),h=e.i(10372),v=e.i(93695),m=e.i(9580);e.i(52474);var f=e.i(220);let E=new t.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/v0/sessions/[ref]/messages/route",pathname:"/api/v0/sessions/[ref]/messages",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/v0/sessions/[ref]/messages/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(48683),...{}}),{workAsyncStorage:A,workUnitAsyncStorage:b,serverHooks:y}=E;async function R(e,t,a){a.requestMeta&&(0,r.setRequestMeta)(e,a.requestMeta),E.isDev&&(0,r.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let A="/api/v0/sessions/[ref]/messages/route";A=A.replace(/\/index$/,"")||"/";let b=await E.prepare(e,t,{srcPage:A,multiZoneDraftMode:!1});if(!b)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:y,deploymentId:R,params:S,nextConfig:w,parsedUrl:C,isDraftMode:N,prerenderManifest:O,routerServerContext:T,isOnDemandRevalidate:k,revalidateOnlyGenerated:q,resolvedPathname:I,clientReferenceManifest:x,serverActionsManifest:L}=b,P=(0,o.normalizeAppPath)(A),M=!!O.routes[I]&&(E.isDev||(0,m.isRouteCacheOwner)(I,E.cacheOwner,O.routes[I])),H=!!(O.dynamicRoutes[P]||M),D=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,C,!1):t.end("This page could not be found"),null);if(H&&!N){let e=O.dynamicRoutes[P];if(e&&!1===e.fallback&&!M){if(w.adapterPath)return await D();throw new v.NoFallbackError}}let F=null;!H||E.isDev||N||(F="/index"===(F=I)?"/":F);let U=!0===E.isDev||!H,$=H&&!U;L&&x&&(0,s.setManifestsSingleton)({page:A,clientReferenceManifest:x,serverActionsManifest:L});let K=e.method||"GET",j=(0,i.getTracer)(),W=j.getActiveScopeSpan(),J=!!(null==T?void 0:T.isWrappedByNextServer),X=!!(0,r.getRequestMeta)(e,"minimalMode"),G=(0,r.getRequestMeta)(e,"incrementalCache")||await E.getIncrementalCache(e,w,O,X);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let B={params:S,previewProps:O.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts,useCacheTimeout:w.experimental.useCacheTimeout},cacheComponents:!!w.cacheComponents,validationLevel:w.experimental.instantInsights.validationLevel,isDraftMode:N,supportsDynamicResponse:U,incrementalCache:G,hmrRefreshHash:(0,r.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:w.cacheLife,staticPageGenerationTimeout:w.staticPageGenerationTimeout,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,n,a,r)=>E.onRequestError(e,t,a,r,T)},sharedContext:{buildId:y,deploymentId:R}},V=new d.NodeNextRequest(e),Y=new d.NodeNextResponse(t),z=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(t)),Z=async({previousCacheEntry:n})=>{try{if(!X&&k&&q&&!n)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let r=await E.handle(z,B);e.fetchMetrics=B.renderOpts.fetchMetrics;let i=B.renderOpts.pendingWaitUntil;i&&a.waitUntil&&(a.waitUntil(i),i=void 0);let s=B.renderOpts.collectedTags;if(!H)return await (0,p.sendResponse)(V,Y,r,i),null;{let e=await r.blob(),t=(0,_.toNodeOutgoingHttpHeaders)(r.headers);s&&(t[h.NEXT_CACHE_TAGS_HEADER]=s),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let n=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,a=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=h.INFINITE_CACHE?!1!==n&&n>0?w.expireTime:void 0:B.renderOpts.collectedExpire;return{value:{kind:f.CachedRouteKind.APP_ROUTE,status:r.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:n,expire:a}}}}catch(t){throw(null==n?void 0:n.isStale)&&await E.onRequestError(e,t,{routerKind:"App Router",routePath:A,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:k})},!1,T),t}},Q=async(r,s)=>{try{var o,d;let r=await E.handleResponse({req:e,nextConfig:w,cacheKey:F,routeKind:n.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:O,isRoutePPREnabled:!1,isOnDemandRevalidate:k,revalidateOnlyGenerated:q,responseGenerator:Z,waitUntil:a.waitUntil,isMinimalMode:X});if(!H)return;if((null==r||null==(o=r.value)?void 0:o.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==r||null==(d=r.value)?void 0:d.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});X||t.setHeader("x-nextjs-cache",k?"REVALIDATED":r.isMiss?"MISS":r.isStale?"STALE":"HIT"),N&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let i=(0,_.fromNodeOutgoingHttpHeaders)(r.value.headers);X&&H||i.delete(h.NEXT_CACHE_TAGS_HEADER),!r.cacheControl||t.getHeader("Cache-Control")||i.get("Cache-Control")||i.set("Cache-Control",(0,g.getCacheControlHeader)(r.cacheControl)),await (0,p.sendResponse)(V,Y,new Response(r.value.body,{headers:i,status:r.value.status||200}));return}catch(t){if(t instanceof v.NoFallbackError||await E.onRequestError(e,t,{routerKind:"App Router",routePath:P,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:k})},!1,T),H)throw t;await (0,p.sendResponse)(V,Y,new Response(null,{status:500}));return}finally{(()=>{if(!r)return;let e=t.statusCode;r.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(r.setStatus({code:i.SpanStatusCode.ERROR}),r.setAttribute("error.type",e.toString()));let n=j.getRootSpanAttributes();if(!n)return;if(n.get("next.span_type")!==u.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${n.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=n.get("next.route")||P,o=`${K} ${a}`;r.setAttributes({"next.route":a,"http.route":a,"next.span_name":o}),r.updateName(o),s&&s!==r&&(s.setAttribute("http.route",a),s.updateName(o))})()}};if(J&&W)await Q(W,void 0);else{let t=j.getActiveScopeSpan();await j.withPropagatedContext(e.headers,()=>j.trace(u.BaseServerSpan.handleRequest,{spanName:`${K} ${A}`,kind:i.SpanKind.SERVER,attributes:{"http.method":K,"http.target":e.url}},e=>Q(e,t)),void 0,!J)}}e.s(["handler",0,R,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:b})},"routeModule",0,E,"serverHooks",0,y,"workAsyncStorage",0,A,"workUnitAsyncStorage",0,b])},43345,e=>{"use strict";var t=e.i(62294),n=e.i(26571),a=e.i(45383);let r=["authentication_unavailable","unauthenticated","principal_mismatch","agent_not_found","conversation_not_found","request_not_found"];async function i(e,n){let i,s=null,o=!1,d=null;try{i=await e(e=>{s=e},()=>{let e=s;n&&e&&"service"===e.kind&&t.serviceAudit.append({principal:e,operation:n.operation,capability:"participant",targetKind:n.targetKind,targetRef:n.targetRef,outcome:"allowed",code:null}),o=!0})}catch(e){if(e instanceof a.AgentApiError)d=e.code,i=Response.json({error:{code:e.code,message:e.message}},{status:e.status});else console.error("Agent conversation API error:",e),d="internal_error",i=Response.json({error:{code:"internal_error",message:"The request could not be processed."}},{status:500})}let l=s;if(o&&null===d)return i;if(n&&l&&"service"===l.kind)try{t.serviceAudit.append({principal:l,operation:n.operation,capability:"participant",targetKind:n.targetKind,targetRef:n.targetRef,outcome:null===d?"allowed":"internal_error"===d?"error":r.includes(d)?"denied":"rejected",code:d})}catch(e){return console.error("Service audit append failed:",e instanceof Error?e.message:"unknown error"),Response.json({error:{code:"internal_error",message:"The request could not be processed."}},{status:500})}return i}async function s(e){let t,r=function(){try{return(0,n.serviceTokenAuthenticatorFromEnv)()}catch(e){if(e instanceof n.ServiceTokenConfigError)return console.error(`Agent API authentication disabled: ${e.message}`),null;throw e}}();if(!r)throw new a.AgentApiError("authentication_unavailable","No authenticator is configured for the agent conversation API.");try{t=await r(e)}catch{t=null}if(!t||!(0,a.isPrincipalKind)(t.kind)||"string"!=typeof t.id||!t.id.trim())throw new a.AgentApiError("unauthenticated","Authentication failed.");return{kind:t.kind,id:t.id}}async function o(e,t){return i(async(n,r)=>{var i;let o,d=await s(e);n(d);try{let t=await e.json();if(!t||"object"!=typeof t||Array.isArray(t))throw Error("not an object");o=t}catch{throw new a.AgentApiError("invalid_request","The request body must be a JSON object.")}let l=null==(i=o.principal)?null:{kind:i.kind,id:String(i.id??"")};if(l&&!(0,a.samePrincipal)(l,d))throw new a.AgentApiError("principal_mismatch","The declared principal does not match the authenticated principal.");let u=e.headers.get("idempotency-key"),c="string"==typeof o.idempotencyKey?o.idempotencyKey:null;if(u&&c&&u!==c)throw new a.AgentApiError("invalid_request","Idempotency-Key header and body idempotencyKey differ.");let p=u??c??"";if(p.toLowerCase().startsWith(a.MCP_IDEMPOTENCY_PREFIX))throw new a.AgentApiError("invalid_request",`Idempotency keys starting with "${a.MCP_IDEMPOTENCY_PREFIX}" are reserved for the MCP bridge.`);let{accepted:_,dispatched:g}=(0,a.acceptAgentMessage)(d,{agentId:t,content:"string"==typeof o.content?o.content:"",idempotencyKey:p,conversationId:"string"==typeof o.conversationId?o.conversationId:null==o.conversationId?null:""},r);return!0===o.wait?(await g,Response.json({...(0,a.getAgentRequest)(d,_.requestId),replayed:_.replayed})):Response.json(_,{status:_.replayed?200:202})},{operation:"agents.message",targetKind:"agent",targetRef:t})}async function d(e,t){return i(async n=>{let r=await s(e);return n(r),Response.json((0,a.getConversation)(r,t))},{operation:"conversations.read",targetKind:"conversation",targetRef:t})}async function l(e,t){return i(async n=>{let r=await s(e);return n(r),Response.json((0,a.getAgentRequest)(r,t))},{operation:"requests.read",targetKind:"request",targetRef:t})}e.s(["authenticate",0,s,"handleGetAgentRequest",0,l,"handleGetConversation",0,d,"handleSendAgentMessage",0,o])},90027,e=>{"use strict";var t=e.i(62349),n=e.i(28420);let a=["active","ended","all"],r=["implementation","revision"],i=`
|
|
2
|
+
SELECT b.*, bot.name AS agent_name, bot.agent AS agent_runtime, r.id AS origin_request_id, c.id AS origin_conversation_id,
|
|
3
|
+
c.type AS conversation_type, c.bot_id AS conversation_bot_id, tb.name AS thread_agent_name, g.name AS group_name,
|
|
4
|
+
r.intent AS request_intent, r.execution_kind AS request_kind, r.state AS request_state,
|
|
5
|
+
r.source_conversation_id AS request_conversation_id, r.target_agent_id AS request_target_agent_id,
|
|
6
|
+
sa.launch_snapshot AS source_snapshot, sa.finished_at AS source_finished_at,
|
|
7
|
+
(SELECT MAX(COALESCE(ra.finished_at, ra.started_at)) FROM work_attempts ra WHERE ra.resumed_session_binding_id = b.id) AS resumed_last_at,
|
|
8
|
+
EXISTS (SELECT 1 FROM work_attempts oa WHERE oa.resumed_session_binding_id = b.id AND oa.finished_at IS NULL) AS attempt_running,
|
|
9
|
+
ps.availability AS ps_availability, ps.lifecycle AS ps_lifecycle, ps.resumable AS ps_resumable, ps.busy AS ps_busy,
|
|
10
|
+
ps.workspace AS ps_workspace, ps.last_synced_at AS ps_synced_at,
|
|
11
|
+
EXISTS (SELECT 1 FROM provider_session_turns pt WHERE pt.session_ref = ps.id AND pt.state = 'running') AS ps_running
|
|
12
|
+
FROM session_bindings b
|
|
13
|
+
JOIN bots bot ON bot.id = b.agent_id
|
|
14
|
+
LEFT JOIN provider_sessions ps ON ps.binding_id = b.id
|
|
15
|
+
LEFT JOIN work_attempts sa ON sa.id = b.source_attempt_id
|
|
16
|
+
LEFT JOIN work_requests r ON r.id = COALESCE(b.request_id, sa.request_id)
|
|
17
|
+
LEFT JOIN conversations c ON c.id = COALESCE(b.conversation_id, r.source_conversation_id)
|
|
18
|
+
LEFT JOIN bots tb ON tb.id = c.bot_id
|
|
19
|
+
LEFT JOIN groups g ON g.id = c.group_id
|
|
20
|
+
`,s=`
|
|
21
|
+
SELECT ps.id, ps.agent_id, bot.name AS agent_name, ps.provider_kind, ps.title, ps.workspace,
|
|
22
|
+
ps.provider_created_at, ps.provider_updated_at, ps.availability, ps.lifecycle, ps.resumable, ps.busy,
|
|
23
|
+
ps.last_synced_at, ps.created_at, ps.updated_at,
|
|
24
|
+
(SELECT MAX(COALESCE(t.finished_at, t.created_at)) FROM provider_session_turns t WHERE t.session_ref = ps.id) AS turn_last_at,
|
|
25
|
+
EXISTS (SELECT 1 FROM provider_session_turns t WHERE t.session_ref = ps.id AND t.state = 'running') AS running
|
|
26
|
+
FROM provider_sessions ps
|
|
27
|
+
JOIN bots bot ON bot.id = ps.agent_id
|
|
28
|
+
WHERE ps.binding_id IS NULL
|
|
29
|
+
`;function o(e){return`${new Date(e).toISOString().slice(0,16).replace("T"," ")} UTC`}function d(e,t){let n=e?.[t];return"string"==typeof n&&n.trim().length>0?n:null}function l(e){let t=e.origin_conversation_id;return t?"group"===e.conversation_type?{id:t,kind:"group",label:e.group_name?`Group ${e.group_name}`:"Group thread",thread_agent_id:null}:"bot"===e.conversation_type&&e.conversation_bot_id?{id:t,kind:"direct",label:e.thread_agent_name?`${e.thread_agent_name} thread`:"Agent thread",thread_agent_id:e.thread_agent_name?e.conversation_bot_id:null}:{id:t,kind:"agent_api",label:"Agent API conversation",thread_agent_id:null}:null}function u(e,a=(0,n.emptyUsage)()){let i,s=null;try{s=e.source_snapshot?JSON.parse(e.source_snapshot):null}catch{}let c=l(e),p=null===e.released_at?"active":"ended",_=((i=(e.request_intent??"").split("\n").map(e=>e.trim()).find(e=>e.length>0))?i.length>80?`${i.slice(0,79).trimEnd()}…`:i:null)??(c?.kind==="group"?c.label:null)??`${e.agent_name} \xb7 ${o(e.created_at)}`;return{ref:e.id,source:"botmancers",agent:{id:e.agent_id,name:e.agent_name,adapter:e.adapter,transport:d(s,"transport")},title:_,status:p,resumable:null===e.released_at&&null!==e.request_id&&null!==e.request_kind&&r.includes(e.request_kind)&&e.request_target_agent_id===e.agent_id&&(e.conversation_id??"")===(e.request_conversation_id??"")&&e.adapter===(0,t.resolveAgent)({agent:e.agent_runtime}).agent,state:{availability:e.ps_availability??"available",lifecycle:e.ps_lifecycle??"open",resumable:null===e.ps_resumable||void 0===e.ps_resumable?null:1===e.ps_resumable,busy:1===e.ps_busy||!!e.attempt_running||!!e.ps_running,synced_at:e.ps_synced_at??null},created_at:e.created_at,ended_at:e.released_at,last_activity_at:Math.max(e.created_at,e.released_at??0,e.source_finished_at??0,e.resumed_last_at??0),origin:{conversation:c,work_request:e.origin_request_id&&e.request_kind&&e.request_state?{id:e.origin_request_id,execution_kind:e.request_kind,state:e.request_state}:null},context:{workspace:d(s,"cwd")??e.ps_workspace??null,deck:d(s,"deck")},usage:a}}function c(e,t=(0,n.emptyUsage)()){let a=e.provider_created_at??e.created_at,r=null===e.resumable?null:1===e.resumable,i="archived"===e.lifecycle?e.provider_updated_at??e.updated_at:null;return{ref:e.id,source:"native",agent:{id:e.agent_id,name:e.agent_name,adapter:e.provider_kind,transport:null},title:e.title??`${e.agent_name} \xb7 ${o(a)}`,status:"open"===e.lifecycle?"active":"ended",resumable:!1,state:{availability:e.availability,lifecycle:e.lifecycle,resumable:r,busy:1===e.busy||!!e.running,synced_at:e.last_synced_at},created_at:a,ended_at:i,last_activity_at:Math.max(a,e.provider_updated_at??0,e.turn_last_at??0),origin:{conversation:null,work_request:null},context:{workspace:e.workspace,deck:null},usage:t}}function p(e,t){return t.last_activity_at-e.last_activity_at||t.created_at-e.created_at||(e.ref<t.ref?-1:+(e.ref>t.ref))}function _(e,t,n){return e.prepare(`${s} AND ps.id = ? AND ps.agent_id = ?`).get(n,t)}function g(e,t,n){return e.prepare(`${i} WHERE b.id = ? AND b.agent_id = ?`).get(n,t)}e.s(["agentExists",0,function(e,t){return!!e.prepare("SELECT 1 FROM bots WHERE id = ?").get(t)},"conversationRef",0,function(e,t){let n=e.prepare(`
|
|
30
|
+
SELECT c.id AS origin_conversation_id, c.type AS conversation_type, c.bot_id AS conversation_bot_id,
|
|
31
|
+
tb.name AS thread_agent_name, g.name AS group_name
|
|
32
|
+
FROM conversations c
|
|
33
|
+
LEFT JOIN bots tb ON tb.id = c.bot_id
|
|
34
|
+
LEFT JOIN groups g ON g.id = c.group_id
|
|
35
|
+
WHERE c.id = ?
|
|
36
|
+
`).get(t);return n?l(n):null},"getAgentSession",0,function(e,t,a){let r=g(e,t,a);if(!r){let r=_(e,t,a);if(!r)return;let{usage:i,samples:s}=(0,n.sessionUsageSamples)(e,t,a);return{...c(r,i),attempts:[],usage_samples:s}}let i=e.prepare(`
|
|
37
|
+
SELECT a.attempt_number, a.kind, a.request_id, a.outcome, a.started_at, a.finished_at,
|
|
38
|
+
CASE WHEN a.id = ? THEN 'source' ELSE 'resume' END AS role
|
|
39
|
+
FROM work_attempts a
|
|
40
|
+
WHERE a.id = ? OR a.resumed_session_binding_id = ?
|
|
41
|
+
ORDER BY a.started_at ASC, a.id ASC
|
|
42
|
+
`).all(r.source_attempt_id,r.source_attempt_id,r.id),{usage:s,samples:o}=(0,n.sessionUsageSamples)(e,t,a);return{...u(r,s),attempts:i,usage_samples:o}},"isSessionFilter",0,function(e){return"string"==typeof e&&a.includes(e)},"listAgentSessions",0,function(e,t,a="all"){let r=e.prepare(`${i} WHERE b.agent_id = ? ${"active"===a?"AND b.released_at IS NULL":"ended"===a?"AND b.released_at IS NOT NULL":""}`).all(t),o=e.prepare(`${s} AND ps.agent_id = ? ${"active"===a?"AND ps.lifecycle = 'open'":"ended"===a?"AND ps.lifecycle = 'archived'":""}`).all(t),d=(0,n.agentSessionUsage)(e,t);return[...r.map(e=>u(e,d.get(e.id))),...o.map(e=>c(e,d.get(e.id)))].sort(p)},"sessionDebugExternalId",0,function(e,t,n){let a=g(e,t,n)?.external_session_id;if(void 0!==a)return a;if(!_(e,t,n))return;let r=e.prepare("SELECT provider_session_id FROM provider_sessions WHERE id = ? AND agent_id = ?").get(n,t);return r?.provider_session_id},"sessionTitle",0,function(e,t,n){let a=g(e,t,n);if(a)return u(a).title;let r=_(e,t,n);return r?c(r).title:null}])}];
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=_0wdl90-._.js.map
|