botmancers 0.3.0 → 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 +107 -1
- package/README.md +178 -32
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +27 -1
- package/app/.next/build-manifest.json +3 -3
- package/app/.next/prerender-manifest.json +33 -5
- package/app/.next/required-server-files.json +2 -2
- package/app/.next/routes-manifest.json +198 -0
- package/app/.next/server/app/_global-error/page.js +1 -1
- package/app/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- 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 +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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route.js +9 -0
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route.js.nft.json +1 -0
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/bots/[id]/sessions/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/bots/[id]/sessions/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/bots/[id]/sessions/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/bots/[id]/sessions/route.js +12 -0
- package/app/.next/server/app/api/bots/[id]/sessions/route.js.nft.json +1 -0
- package/app/.next/server/app/api/bots/[id]/sessions/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/bots/[id]/skill/route.js +3 -3
- 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 +4 -4
- 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 +3 -3
- package/app/.next/server/app/api/bots/import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/manage/route.js +3 -3
- 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 +3 -3
- package/app/.next/server/app/api/bots/name-migrations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/route.js +7 -7
- package/app/.next/server/app/api/bots/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/approve/route.js +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +6 -6
- 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 +3 -3
- package/app/.next/server/app/api/conversations/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/stop/route.js +4 -4
- package/app/.next/server/app/api/conversations/[id]/stop/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/route.js +3 -3
- package/app/.next/server/app/api/conversations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/exchanges/[id]/cancel/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/exchanges/[id]/cancel/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/exchanges/[id]/cancel/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/exchanges/[id]/cancel/route.js +11 -0
- package/app/.next/server/app/api/exchanges/[id]/cancel/route.js.nft.json +1 -0
- package/app/.next/server/app/api/exchanges/[id]/cancel/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/exchanges/[id]/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/exchanges/[id]/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/exchanges/[id]/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/exchanges/[id]/route.js +11 -0
- package/app/.next/server/app/api/exchanges/[id]/route.js.nft.json +1 -0
- package/app/.next/server/app/api/exchanges/[id]/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/exchanges/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/exchanges/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/exchanges/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/exchanges/route.js +12 -0
- package/app/.next/server/app/api/exchanges/route.js.nft.json +1 -0
- package/app/.next/server/app/api/exchanges/route_client-reference-manifest.js +3 -0
- 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 +3 -3
- 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/import-capabilities/route.js +1 -1
- package/app/.next/server/app/api/import-capabilities/route.js.nft.json +1 -1
- package/app/.next/server/app/api/marketplace-handoff/route.js +1 -1
- package/app/.next/server/app/api/marketplace-handoff/route.js.nft.json +1 -1
- package/app/.next/server/app/api/marketplace-handoff/status/route.js +1 -1
- package/app/.next/server/app/api/marketplace-handoff/status/route.js.nft.json +1 -1
- package/app/.next/server/app/api/mcp/route.js +3 -3
- package/app/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/app/.next/server/app/api/messages/[id]/between/route.js +3 -3
- 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/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/service-grants/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/service-grants/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/service-grants/route.js +9 -0
- package/app/.next/server/app/api/service-grants/route.js.nft.json +1 -0
- package/app/.next/server/app/api/service-grants/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js +12 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js +12 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js +5 -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/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/route.js +12 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js +12 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js +12 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/agents/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/agents/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/agents/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/agents/route.js +12 -0
- package/app/.next/server/app/api/v0/agents/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/agents/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/capabilities/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/capabilities/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/capabilities/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/capabilities/route.js +12 -0
- package/app/.next/server/app/api/v0/capabilities/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/capabilities/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/conversations/[id]/route.js +5 -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/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js +12 -0
- package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/exchanges/[id]/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/exchanges/[id]/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/exchanges/[id]/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/exchanges/[id]/route.js +12 -0
- package/app/.next/server/app/api/v0/exchanges/[id]/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/exchanges/[id]/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/exchanges/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/exchanges/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/exchanges/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/exchanges/route.js +12 -0
- package/app/.next/server/app/api/v0/exchanges/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/exchanges/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/v0/mcp/route.js +7 -4
- package/app/.next/server/app/api/v0/mcp/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route/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 +5 -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/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v0/sessions/[ref]/messages/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/v0/sessions/[ref]/messages/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js +12 -0
- package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v0/sessions/[ref]/messages/route_client-reference-manifest.js +3 -0
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +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/app-paths-manifest.json +3 -0
- package/app/.next/server/app/exchanges/page/build-manifest.json +20 -0
- package/app/.next/server/app/exchanges/page/next-font-manifest.json +11 -0
- package/app/.next/server/app/exchanges/page/react-loadable-manifest.json +1 -0
- package/app/.next/server/app/exchanges/page/server-reference-manifest.json +4 -0
- package/app/.next/server/app/exchanges/page.js +13 -0
- package/app/.next/server/app/exchanges/page.js.nft.json +1 -0
- package/app/.next/server/app/exchanges/page_client-reference-manifest.js +3 -0
- package/app/.next/server/app/exchanges.html +1 -0
- package/app/.next/server/app/exchanges.meta +34 -0
- package/app/.next/server/app/exchanges.rsc +22 -0
- package/app/.next/server/app/exchanges.segments/_full.segment.rsc +22 -0
- package/app/.next/server/app/exchanges.segments/_tree.segment.rsc +4 -0
- package/app/.next/server/app/exchanges.segments/exchanges/__PAGE__.segment.rsc +26 -0
- 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 +1 -1
- 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 +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/app-paths-manifest.json +3 -0
- package/app/.next/server/app/threads/[id]/page/build-manifest.json +20 -0
- package/app/.next/server/app/threads/[id]/page/next-font-manifest.json +11 -0
- package/app/.next/server/app/threads/[id]/page/react-loadable-manifest.json +1 -0
- package/app/.next/server/app/threads/[id]/page/server-reference-manifest.json +4 -0
- package/app/.next/server/app/threads/[id]/page.js +13 -0
- package/app/.next/server/app/threads/[id]/page.js.nft.json +1 -0
- package/app/.next/server/app/threads/[id]/page_client-reference-manifest.js +3 -0
- package/app/.next/server/app-paths-manifest.json +27 -1
- package/app/.next/server/chunks/0ivl_api_v0_agents_[agentId]_conversations_[conversationId]_route_actions_0lvijtu.js +3 -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/1oeh_server_app_api_v0_agents_[agentId]_conversations_route_actions_0ko3117.js +3 -0
- package/app/.next/server/chunks/1oeh_server_app_api_v0_agents_[agentId]_sessions_[ref]_route_actions_0o7q3vt.js +3 -0
- package/app/.next/server/chunks/{[externals]__18bqksw._.js → [externals]__06lqs5i._.js} +1 -1
- package/app/.next/server/chunks/{[root-of-the-server]__1vxmbdl._.js → [root-of-the-server]__0-45blq._.js} +1 -1
- 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 +582 -55
- package/app/.next/server/chunks/{[root-of-the-server]__07l_rgn._.js → [root-of-the-server]__0j0i8xz._.js} +1 -1
- 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]__1khwkvb._.js → [root-of-the-server]__1c3e2ds._.js} +1 -1
- 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 +7 -0
- 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/_20azcus._.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_bots_[id]_sessions_[ref]_route_actions_02gp9-5.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_bots_[id]_sessions_route_actions_1s_wxg4.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_exchanges_[id]_cancel_route_actions_0lh0fl4.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_exchanges_[id]_route_actions_1w4jhin.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_exchanges_route_actions_028wchg.js +3 -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_service-grants_route_actions_1459xk1.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_agents_[agentId]_route_actions_127sxvv.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_v0_agents_[agentId]_sessions_route_actions_0pm6tcu.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_v0_agents_route_actions_00azkhd.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_v0_capabilities_route_actions_0d-eefd.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_v0_exchanges_[id]_cancel_route_actions_1hb2q7i.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_v0_exchanges_[id]_route_actions_098f50-.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_v0_exchanges_route_actions_1ftmhhm.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]_messages_route_actions_1-rgf_k.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 +25 -0
- package/app/.next/server/chunks/lib_session-pins_ts_0lmxnwj._.js +20 -0
- package/app/.next/server/chunks/ssr/{[root-of-the-server]__0sq4frf._.js → [root-of-the-server]__03186rx._.js} +1 -1
- package/app/.next/server/chunks/ssr/[root-of-the-server]__03xw2d9._.js +3 -0
- package/app/.next/server/chunks/ssr/{[root-of-the-server]__1x7o-fe._.js → [root-of-the-server]__0zzcbqg._.js} +1 -1
- package/app/.next/server/chunks/ssr/{[root-of-the-server]__029oxo_._.js → [root-of-the-server]__1feicqq._.js} +1 -1
- package/app/.next/server/chunks/ssr/[root-of-the-server]__1t063pe._.js +3 -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/_next-internal_server_app_exchanges_page_actions_0hcso2x.js +3 -0
- package/app/.next/server/chunks/ssr/_next-internal_server_app_threads_[id]_page_actions_1fte2n3.js +3 -0
- package/app/.next/server/chunks/ssr/app_bots_[id]_config_page_tsx_1e0uue9._.js +3 -0
- package/app/.next/server/chunks/ssr/app_components_AgentDeckRuntime_tsx_024janf._.js +3 -0
- 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_1nkgb45._.js +23 -0
- package/app/.next/server/chunks/ssr/node_modules_next_0x3i8za._.js +131 -0
- package/app/.next/server/middleware-build-manifest.js +3 -3
- package/app/.next/server/middleware.js +1 -1
- package/app/.next/server/next-font-manifest.js +1 -1
- package/app/.next/server/next-font-manifest.json +8 -0
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +1 -1
- package/app/.next/server/prefetch-hints.json +14 -0
- 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 +35 -7
- package/dist/clients.d.ts +86 -0
- package/dist/clients.js +639 -0
- package/dist/config.d.ts +2 -1
- package/dist/config.js +7 -6
- package/dist/contract.d.ts +7 -1
- package/dist/contract.js +33 -8
- package/dist/home.d.ts +1 -1
- package/dist/home.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/managed.js +7 -0
- package/dist/product.d.ts +2 -0
- package/dist/product.js +7 -1
- package/dist/server.js +5 -4
- package/dist/upstream.js +21 -7
- package/package.json +7 -6
- package/schemas/botmancers.mcp.v2.tools.json +4565 -0
- package/skills/botmancers-collaboration/SKILL.md +114 -0
- package/skills/botmancers-collaboration/references/workflows.md +281 -0
- package/app/.next/server/chunks/[root-of-the-server]__08i4wq6._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__09d-yrq._.js +0 -3
- 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]__0za34e1._.js +0 -7
- package/app/.next/server/chunks/[root-of-the-server]__10m3szc._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__19hjzs0._.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]__1fjpie4._.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]__1qanlbg._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__1qoa704._.js +0 -7
- package/app/.next/server/chunks/[root-of-the-server]__20wve4_._.js +0 -3
- 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/_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/_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/_1p8rola._.js +0 -3
- package/app/.next/server/chunks/app_api_import-capabilities_route_ts_013w1kt._.js +0 -3
- package/app/.next/server/chunks/lib_051fv4x._.js +0 -111
- package/app/.next/server/chunks/lib_07adeq3._.js +0 -111
- package/app/.next/server/chunks/lib_draft_ts_1atoius._.js +0 -3
- package/app/.next/server/chunks/ssr/_0k_7i66._.js +0 -131
- package/app/.next/server/chunks/ssr/_1flnty7._.js +0 -23
- 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/0qbtymorcz-l9.js +0 -3
- package/app/.next/static/chunks/3wdlh25l1vww9.js +0 -1
- package/app/.next/static/chunks/3zqbpbm93yqzh.css +0 -3
- /package/app/.next/static/{u4r8RPgEfpxk-DGXeKV6g → gh3shm8hnVqXLr75rmvsL}/_buildManifest.js +0 -0
- /package/app/.next/static/{u4r8RPgEfpxk-DGXeKV6g → gh3shm8hnVqXLr75rmvsL}/_clientMiddlewareManifest.js +0 -0
- /package/app/.next/static/{u4r8RPgEfpxk-DGXeKV6g → gh3shm8hnVqXLr75rmvsL}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module.exports=[7098,e=>{"use strict";var t=e.i(69936);async function n(e,{params:a}){let{agentId:r}=await a;return(0,t.handleListConversations)(e,r)}e.s(["GET",0,n])},6573,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),v=e.i(10372),h=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]/conversations/route",pathname:"/api/v0/agents/[agentId]/conversations",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/v0/agents/[agentId]/conversations/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(7098),...{}}),{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]/conversations/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 h.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: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(!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[v.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>=v.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,a=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=v.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:G});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});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(v.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 h.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=_023se5j._.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module.exports=[30323,e=>{"use strict";var t=e.i(69936);async function n(e,{params:a}){let{id:r}=await a;return(0,t.handleGetExchange)(e,r)}e.s(["GET",0,n])},80033,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/exchanges/[id]/route",pathname:"/api/v0/exchanges/[id]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/v0/exchanges/[id]/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(30323),...{}}),{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/exchanges/[id]/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),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: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(!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: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:G});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});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,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=_02pb_qv._.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module.exports=[56989,e=>{"use strict";var t=e.i(69936);async function n(e,{params:a}){let{pinRef:r}=await a;return(0,t.handleDetachPin)(e,r)}e.s(["POST",0,n])},24761,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]/detach/route",pathname:"/api/v0/pins/[pinRef]/detach",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/v0/pins/[pinRef]/detach/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(56989),...{}}),{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]/detach/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:P}=b,L=(0,o.normalizeAppPath)(A),M=!!O.routes[I]&&(E.isDev||(0,f.isRouteCacheOwner)(I,E.cacheOwner,O.routes[I])),D=!!(O.dynamicRoutes[L]||M),H=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,C,!1):t.end("This page could not be found"),null);if(D&&!N){let e=O.dynamicRoutes[L];if(e&&!1===e.fallback&&!M){if(w.adapterPath)return await H();throw new v.NoFallbackError}}let F=null;!D||E.isDev||N||(F="/index"===(F=I)?"/":F);let U=!0===E.isDev||!D,$=D&&!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: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(!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(!D)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(!D)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&&D||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),D)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,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=_05ro-21._.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module.exports=[67794,e=>{"use strict";var t=e.i(69936);async function n(e,{params:a}){let{agentId:r,ref:i}=await a;return(0,t.handleGetSession)(e,r,i)}e.s(["GET",0,n])},25932,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/agents/[agentId]/sessions/[ref]/route",pathname:"/api/v0/agents/[agentId]/sessions/[ref]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/v0/agents/[agentId]/sessions/[ref]/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(67794),...{}}),{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]/sessions/[ref]/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,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: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(!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,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=_07on0dc._.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module.exports=[61276,e=>{"use strict";var t=e.i(69936);async function n(e,{params:a}){let{pinRef:r}=await a;return(0,t.handleSendToPin)(e,r)}e.s(["POST",0,n])},13874,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/pins/[pinRef]/messages/route",pathname:"/api/v0/pins/[pinRef]/messages",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/v0/pins/[pinRef]/messages/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(61276),...{}}),{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]/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:R,deploymentId:y,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,m.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: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(!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: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,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=_08208nz._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[64347,e=>{"use strict";var t=e.i(89171),r=e.i(62294),a=e.i(57147),n=e.i(27754),o=e.i(52694),s=e.i(62349),i=e.i(16979),l=e.i(30098);async function d(){try{let e=r.bots.getAll().map(e=>({...(0,s.serializeBot)(e),unread:+!!e.unread,hidden:+!!e.hidden,latest:r.messages.latestFromBot(e.id)}));return t.NextResponse.json(e)}catch(e){return console.error("Error fetching bots:",e),t.NextResponse.json({error:"Failed to fetch bots"},{status:500})}}async function u(e){try{let n=await e.json(),{name:l,title:d,description:u,avatar:c}=n;if(!l||!String(l).trim())return t.NextResponse.json({error:"Name is required"},{status:400});let p=(0,s.validateCreateAgent)(n);if(p.errors.length>0)return t.NextResponse.json({error:p.errors[0],errors:p.errors},{status:400});let v=null!==n.avatar&&void 0!==n.avatar&&"object"==typeof n.avatar&&!Array.isArray(n.avatar);if(void 0!==n.avatar&&null!==n.avatar&&"string"!=typeof n.avatar&&!v)return t.NextResponse.json({error:"Invalid avatar: expected an image string or an avatar config object"},{status:400});let h=(0,i.validateAvatarInput)(v?n.avatar:void 0);if(h.errors.length>0)return t.NextResponse.json({error:h.errors[0],errors:h.errors},{status:400});let g=r.bots.create({name:String(l).trim(),title:d?String(d):"",description:u?String(u):"",avatar:"string"==typeof c?c:void 0,agent:p.normalized.agent,deck_id:p.normalized.deck_id,deck_name:null,working_directory:p.normalized.working_directory,needs_deck_selection:0,avatar_color:h.fields.avatar_color??null,avatar_eyes:h.fields.avatar_eyes??null,avatar_hands:h.fields.avatar_hands??null,avatar_accessory:h.fields.avatar_accessory??null}),R=r.conversations.getByBotId(g.id);return R&&(a.uiTurns.enqueue(R.id,g.id,{reason:"greeting"}),(0,o.processUiTurns)().catch(console.error)),t.NextResponse.json((0,s.serializeBot)(g))}catch(e){if(e instanceof l.AgentNameConflictError)return t.NextResponse.json((0,l.agentNameConflictBody)(e),{status:409});return console.error("Error creating bot:",e),t.NextResponse.json({error:"Failed to create bot"},{status:500})}}async function c(e){try{let a,n=await e.json(),o=n.id?String(n.id):"";if(!o)return t.NextResponse.json({error:"Bot id is required"},{status:400});let l=r.bots.getById(o);if(!l)return t.NextResponse.json({error:"Bot not found"},{status:404});let d=e=>t.NextResponse.json({error:e[0],errors:e},{status:400}),u=null;if(void 0!==n.avatar){if(null===n.avatar||""===n.avatar)a=null;else if("object"!=typeof n.avatar||Array.isArray(n.avatar)){let e=String(n.avatar);if(!e.startsWith("data:image/"))return t.NextResponse.json({error:"Image is required"},{status:400});a=e}else if((u=(0,i.validateAvatarInput)(n.avatar)).errors.length>0)return d(u.errors)}let c=null;if(void 0!==n.name||void 0!==n.title||void 0!==n.description){let e=void 0!==n.name?String(n.name).trim():l.name;if(!e)return t.NextResponse.json({error:"Name is required"},{status:400});let r=void 0!==n.title?String(n.title):l.title,a=void 0!==n.description?String(n.description):l.description;c={name:e,title:r,description:a}}let p=(0,s.hasAgentUpdate)(n)?(0,s.validateUpdateAgent)(n):null;if(p&&p.errors.length>0)return d(p.errors);r.default.transaction(()=>{void 0!==a&&r.bots.setAvatar(o,a),u&&r.bots.updateAvatarConfig(o,u.fields),void 0!==n.pinned&&r.bots.setPinned(o,!!n.pinned),void 0!==n.hidden&&r.bots.setHidden(o,!!n.hidden),void 0!==n.unread&&(n.unread?r.bots.markUnread(o):r.bots.markRead(o)),c&&r.bots.updateIdentity(o,c.name,c.title,c.description),p&&r.bots.updateAgentSelection(o,p.fields)})();let v=r.bots.getById(o);return t.NextResponse.json(v?(0,s.serializeBot)(v):v)}catch(e){if(e instanceof l.AgentNameConflictError)return t.NextResponse.json((0,l.agentNameConflictBody)(e),{status:409});return console.error("Error setting avatar:",e),t.NextResponse.json({error:"Failed to set avatar"},{status:500})}}async function p(e){let a;try{a=await e.json()}catch{return t.NextResponse.json({error:"Expected a JSON object with id or ids."},{status:400})}let o=(0,n.parseDeleteIds)(a);if(!o.ok)return t.NextResponse.json({error:o.error},{status:400});try{let e=r.bots.removeMany(o.ids);return t.NextResponse.json({ok:!0,deleted:e.agents,groups:e.groups})}catch(e){if(e instanceof r.BotDeletionError){var s=e.preview;if(s.missing.length>0)return t.NextResponse.json({error:"Bot not found",missing:s.missing},{status:404});let r=s.blocked.map(e=>`${e.name} — ${(0,n.blockedReasonCopy)(e.reason)}`).join(" ");return t.NextResponse.json({error:`Nothing was deleted. ${r}`,blocked:s.blocked.map(e=>({...e,message:(0,n.blockedReasonCopy)(e.reason)}))},{status:409})}return console.error("Error deleting bot:",e),t.NextResponse.json({error:"Failed to delete bot"},{status:500})}}e.s(["DELETE",0,p,"GET",0,d,"PATCH",0,c,"POST",0,u])},88016,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),o=e.i(61916),s=e.i(74677),i=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),v=e.i(70101),h=e.i(26937),g=e.i(10372),R=e.i(93695),f=e.i(9580);e.i(52474);var m=e.i(220);let x=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/bots/route",pathname:"/api/bots",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/bots/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(64347),...{}}),{workAsyncStorage:y,workUnitAsyncStorage:b,serverHooks:N}=x;async function E(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),x.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let y="/api/bots/route";y=y.replace(/\/index$/,"")||"/";let b=await x.prepare(e,t,{srcPage:y,multiZoneDraftMode:!1});if(!b)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:N,deploymentId:E,params:C,nextConfig:w,parsedUrl:A,isDraftMode:j,prerenderManifest:S,routerServerContext:_,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,resolvedPathname:k,clientReferenceManifest:I,serverActionsManifest:O}=b,q=(0,i.normalizeAppPath)(y),H=!!S.routes[k]&&(x.isDev||(0,f.isRouteCacheOwner)(k,x.cacheOwner,S.routes[k])),B=!!(S.dynamicRoutes[q]||H),U=async()=>((null==_?void 0:_.render404)?await _.render404(e,t,A,!1):t.end("This page could not be found"),null);if(B&&!j){let e=S.dynamicRoutes[q];if(e&&!1===e.fallback&&!H){if(w.adapterPath)return await U();throw new R.NoFallbackError}}let D=null;!B||x.isDev||j||(D="/index"===(D=k)?"/":D);let M=!0===x.isDev||!B,F=B&&!M;O&&I&&(0,s.setManifestsSingleton)({page:y,clientReferenceManifest:I,serverActionsManifest:O});let $=e.method||"GET",K=(0,o.getTracer)(),L=K.getActiveScopeSpan(),z=!!(null==_?void 0:_.isWrappedByNextServer),G=!!(0,n.getRequestMeta)(e,"minimalMode"),V=(0,n.getRequestMeta)(e,"incrementalCache")||await x.getIncrementalCache(e,w,S,G);null==V||V.resetRequestCache(),globalThis.__incrementalCache=V;let W={params:C,previewProps:S.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts,useCacheTimeout:w.experimental.useCacheTimeout},cacheComponents:!!w.cacheComponents,validationLevel:w.experimental.instantInsights.validationLevel,isDraftMode:j,supportsDynamicResponse:M,incrementalCache:V,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:w.cacheLife,staticPageGenerationTimeout:w.staticPageGenerationTimeout,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>x.onRequestError(e,t,a,n,_)},sharedContext:{buildId:N,deploymentId:E}},X=new l.NodeNextRequest(e),J=new l.NodeNextResponse(t),Z=d.NextRequestAdapter.fromNodeNextRequest(X,(0,d.signalFromNodeResponse)(t)),Q=async({previousCacheEntry:r})=>{try{if(!G&&T&&P&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await x.handle(Z,W);e.fetchMetrics=W.renderOpts.fetchMetrics;let o=W.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let s=W.renderOpts.collectedTags;if(!B)return await (0,p.sendResponse)(X,J,n,o),null;{let e=await n.blob(),t=(0,v.toNodeOutgoingHttpHeaders)(n.headers);s&&(t[g.NEXT_CACHE_TAGS_HEADER]=s),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,a=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=g.INFINITE_CACHE?!1!==r&&r>0?w.expireTime:void 0:W.renderOpts.collectedExpire;return{value:{kind:m.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await x.onRequestError(e,t,{routerKind:"App Router",routePath:y,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:T})},!1,_),t}},Y=async(n,s)=>{try{var i,l;let n=await x.handleResponse({req:e,nextConfig:w,cacheKey:D,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:S,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,responseGenerator:Q,waitUntil:a.waitUntil,isMinimalMode:G});if(!B)return;if((null==n||null==(i=n.value)?void 0:i.kind)!==m.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});G||t.setHeader("x-nextjs-cache",T?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),j&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let o=(0,v.fromNodeOutgoingHttpHeaders)(n.value.headers);G&&B||o.delete(g.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||o.get("Cache-Control")||o.set("Cache-Control",(0,h.getCacheControlHeader)(n.cacheControl)),await (0,p.sendResponse)(X,J,new Response(n.value.body,{headers:o,status:n.value.status||200}));return}catch(t){if(t instanceof R.NoFallbackError||await x.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:T})},!1,_),B)throw t;await (0,p.sendResponse)(X,J,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:o.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let r=K.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route")||q,i=`${$} ${a}`;n.setAttributes({"next.route":a,"http.route":a,"next.span_name":i}),n.updateName(i),s&&s!==n&&(s.setAttribute("http.route",a),s.updateName(i))})()}};if(z&&L)await Y(L,void 0);else{let t=K.getActiveScopeSpan();await K.withPropagatedContext(e.headers,()=>K.trace(u.BaseServerSpan.handleRequest,{spanName:`${$} ${y}`,kind:o.SpanKind.SERVER,attributes:{"http.method":$,"http.target":e.url}},e=>Y(e,t)),void 0,!z)}}e.s(["handler",0,E,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:y,workUnitAsyncStorage:b})},"routeModule",0,x,"serverHooks",0,N,"workAsyncStorage",0,y,"workUnitAsyncStorage",0,b])}];
|
|
1
|
+
module.exports=[64347,e=>{"use strict";var t=e.i(89171),r=e.i(54799),a=e.i(62294),n=e.i(57147),s=e.i(27754),o=e.i(52694),i=e.i(62349),l=e.i(18966),d=e.i(16979),u=e.i(30098);async function c(){try{let e=a.bots.getAll().map(e=>({...(0,a.serializeAgent)(e),unread:+!!e.unread,hidden:+!!e.hidden,latest:a.messages.latestFromBot(e.id)}));return t.NextResponse.json(e)}catch(e){return console.error("Error fetching bots:",e),t.NextResponse.json({error:"Failed to fetch bots"},{status:500})}}async function p(e){try{let s=await e.json(),{name:u,title:c,description:p,avatar:v}=s;if(!u||!String(u).trim())return t.NextResponse.json({error:"Name is required"},{status:400});let g=[];if((void 0!==s.runtime||void 0!==s.agent_client)&&g.push(i.LEGACY_RUNTIME_FIELD_ERROR),void 0!==s.deck_name&&g.push(i.LEGACY_DECK_NAME_FIELD_ERROR),g.length>0)return t.NextResponse.json({error:g[0],errors:g},{status:400});let h=(0,l.validateCreateRegistration)(s,a.registrationContext);if(h.errors.length>0||!h.registration||!h.provider)return t.NextResponse.json({error:h.errors[0],errors:h.errors},{status:400});let R=h.registration,f=(0,r.randomUUID)();(0,l.isLegacyCreate)(s)&&0===R.session_scope.workspaces.length&&(R.session_scope.workspaces=[`~/.botmancers/${f}`]);let _=null!==s.avatar&&void 0!==s.avatar&&"object"==typeof s.avatar&&!Array.isArray(s.avatar);if(void 0!==s.avatar&&null!==s.avatar&&"string"!=typeof s.avatar&&!_)return t.NextResponse.json({error:"Invalid avatar: expected an image string or an avatar config object"},{status:400});let m=(0,d.validateAvatarInput)(_?s.avatar:void 0);if(m.errors.length>0)return t.NextResponse.json({error:m.errors[0],errors:m.errors},{status:400});let E=a.bots.create({name:String(u).trim(),title:c?String(c):"",description:p?String(p):"",avatar:"string"==typeof v?v:void 0,agent:h.provider,deck_id:"agent_deck"===R.launch_profile?R.deck_id:null,deck_name:null,working_directory:"agent_deck"===R.launch_profile?R.working_directory:null,needs_deck_selection:0,runtime_connection_id:R.runtime_connection_id,launch_profile:R.launch_profile,session_scope_kind:R.session_scope.kind,session_scope_items:JSON.stringify("workspaces"===R.session_scope.kind?R.session_scope.workspaces:R.session_scope.sessions),default_workspace:R.default_workspace,policy_mode:R.policy.mode,allow_new_sessions:+!!R.policy.allow_new_sessions,allow_resume_with_edits:+!!R.policy.allow_resume_with_edits,avatar_color:m.fields.avatar_color??null,avatar_eyes:m.fields.avatar_eyes??null,avatar_hands:m.fields.avatar_hands??null,avatar_accessory:m.fields.avatar_accessory??null},{id:f}),y=a.conversations.getByBotId(E.id);y&&(n.uiTurns.enqueue(y.id,E.id,{reason:"greeting"}),(0,o.processUiTurns)().catch(console.error));let w=a.bots.getById(E.id);return t.NextResponse.json(w?(0,a.serializeAgent)(w):null)}catch(e){if(e instanceof u.AgentNameConflictError)return t.NextResponse.json((0,u.agentNameConflictBody)(e),{status:409});return console.error("Error creating bot:",e),t.NextResponse.json({error:"Failed to create bot"},{status:500})}}async function v(e){try{let r,n=await e.json(),s=n.id?String(n.id):"";if(!s)return t.NextResponse.json({error:"Bot id is required"},{status:400});let o=a.bots.getById(s);if(!o)return t.NextResponse.json({error:"Bot not found"},{status:404});let u=e=>t.NextResponse.json({error:e[0],errors:e},{status:400}),c=null;if(void 0!==n.avatar){if(null===n.avatar||""===n.avatar)r=null;else if("object"!=typeof n.avatar||Array.isArray(n.avatar)){let e=String(n.avatar);if(!e.startsWith("data:image/"))return t.NextResponse.json({error:"Image is required"},{status:400});r=e}else if((c=(0,d.validateAvatarInput)(n.avatar)).errors.length>0)return u(c.errors)}let p=null;if(void 0!==n.name||void 0!==n.title||void 0!==n.description){let e=void 0!==n.name?String(n.name).trim():o.name;if(!e)return t.NextResponse.json({error:"Name is required"},{status:400});let r=void 0!==n.title?String(n.title):o.title,a=void 0!==n.description?String(n.description):o.description;p={name:e,title:r,description:a}}let v=[];if((void 0!==n.runtime||void 0!==n.agent_client)&&v.push(i.LEGACY_RUNTIME_FIELD_ERROR),void 0!==n.deck_name&&v.push(i.LEGACY_DECK_NAME_FIELD_ERROR),v.length>0)return u(v);let g=!o.launch_profile&&!(0,l.hasRegistrationUpdate)(n)&&void 0===n.deck_id&&(0,i.hasAgentUpdate)(n),h=g?(0,i.validateUpdateAgent)(n):null;if(h&&h.errors.length>0)return u(h.errors);let R=!g&&((0,i.hasAgentUpdate)(n)||(0,l.hasRegistrationUpdate)(n))?(0,l.validateUpdateRegistration)(s,o,n,a.registrationContext):null;if(R&&(R.errors.length>0||!R.registration||!R.provider))return u(R.errors);a.default.transaction(()=>{void 0!==r&&a.bots.setAvatar(s,r),c&&a.bots.updateAvatarConfig(s,c.fields),void 0!==n.pinned&&a.bots.setPinned(s,!!n.pinned),void 0!==n.hidden&&a.bots.setHidden(s,!!n.hidden),void 0!==n.unread&&(n.unread?a.bots.markUnread(s):a.bots.markRead(s)),p&&a.bots.updateIdentity(s,p.name,p.title,p.description),h&&a.bots.updateAgentSelection(s,h.fields),R?.registration&&R.provider&&a.bots.updateRegistration(s,R.provider,R.registration)})();let f=a.bots.getById(s);return t.NextResponse.json(f?(0,a.serializeAgent)(f):f)}catch(e){if(e instanceof u.AgentNameConflictError)return t.NextResponse.json((0,u.agentNameConflictBody)(e),{status:409});return console.error("Error setting avatar:",e),t.NextResponse.json({error:"Failed to set avatar"},{status:500})}}async function g(e){let r;try{r=await e.json()}catch{return t.NextResponse.json({error:"Expected a JSON object with id or ids."},{status:400})}let n=(0,s.parseDeleteIds)(r);if(!n.ok)return t.NextResponse.json({error:n.error},{status:400});try{let e=a.bots.removeMany(n.ids);return t.NextResponse.json({ok:!0,deleted:e.agents,groups:e.groups})}catch(e){if(e instanceof a.BotDeletionError){var o=e.preview;if(o.missing.length>0)return t.NextResponse.json({error:"Bot not found",missing:o.missing},{status:404});let r=o.blocked.map(e=>`${e.name} — ${(0,s.blockedReasonCopy)(e.reason)}`).join(" ");return t.NextResponse.json({error:`Nothing was deleted. ${r}`,blocked:o.blocked.map(e=>({...e,message:(0,s.blockedReasonCopy)(e.reason)}))},{status:409})}return console.error("Error deleting bot:",e),t.NextResponse.json({error:"Failed to delete bot"},{status:500})}}e.s(["DELETE",0,g,"GET",0,c,"PATCH",0,v,"POST",0,p])},88016,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),o=e.i(74677),i=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),v=e.i(70101),g=e.i(26937),h=e.i(10372),R=e.i(93695),f=e.i(9580);e.i(52474);var _=e.i(220);let m=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/bots/route",pathname:"/api/bots",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/bots/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(64347),...{}}),{workAsyncStorage:E,workUnitAsyncStorage:y,serverHooks:w}=m;async function x(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),m.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let E="/api/bots/route";E=E.replace(/\/index$/,"")||"/";let y=await m.prepare(e,t,{srcPage:E,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:w,deploymentId:x,params:N,nextConfig:b,parsedUrl:C,isDraftMode:A,prerenderManifest:k,routerServerContext:j,isOnDemandRevalidate:S,revalidateOnlyGenerated:T,resolvedPathname:I,clientReferenceManifest:O,serverActionsManifest:P}=y,U=(0,i.normalizeAppPath)(E),q=!!k.routes[I]&&(m.isDev||(0,f.isRouteCacheOwner)(I,m.cacheOwner,k.routes[I])),D=!!(k.dynamicRoutes[U]||q),H=async()=>((null==j?void 0:j.render404)?await j.render404(e,t,C,!1):t.end("This page could not be found"),null);if(D&&!A){let e=k.dynamicRoutes[U];if(e&&!1===e.fallback&&!q){if(b.adapterPath)return await H();throw new R.NoFallbackError}}let M=null;!D||m.isDev||A||(M="/index"===(M=I)?"/":M);let B=!0===m.isDev||!D,F=D&&!B;P&&O&&(0,o.setManifestsSingleton)({page:E,clientReferenceManifest:O,serverActionsManifest:P});let L=e.method||"GET",$=(0,s.getTracer)(),G=$.getActiveScopeSpan(),K=!!(null==j?void 0:j.isWrappedByNextServer),z=!!(0,n.getRequestMeta)(e,"minimalMode"),Y=(0,n.getRequestMeta)(e,"incrementalCache")||await m.getIncrementalCache(e,b,k,z);null==Y||Y.resetRequestCache(),globalThis.__incrementalCache=Y;let V={params:N,previewProps:k.preview,renderOpts:{experimental:{authInterrupts:!!b.experimental.authInterrupts,useCacheTimeout:b.experimental.useCacheTimeout},cacheComponents:!!b.cacheComponents,validationLevel:b.experimental.instantInsights.validationLevel,isDraftMode:A,supportsDynamicResponse:B,incrementalCache:Y,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:b.cacheLife,staticPageGenerationTimeout:b.staticPageGenerationTimeout,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>m.onRequestError(e,t,a,n,j)},sharedContext:{buildId:w,deploymentId:x}},W=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),J=d.NextRequestAdapter.fromNodeNextRequest(W,(0,d.signalFromNodeResponse)(t)),Z=async({previousCacheEntry:r})=>{try{if(!z&&S&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await m.handle(J,V);e.fetchMetrics=V.renderOpts.fetchMetrics;let s=V.renderOpts.pendingWaitUntil;s&&a.waitUntil&&(a.waitUntil(s),s=void 0);let o=V.renderOpts.collectedTags;if(!D)return await (0,p.sendResponse)(W,X,n,s),null;{let e=await n.blob(),t=(0,v.toNodeOutgoingHttpHeaders)(n.headers);o&&(t[h.NEXT_CACHE_TAGS_HEADER]=o),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==V.renderOpts.collectedRevalidate&&!(V.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&V.renderOpts.collectedRevalidate,a=void 0===V.renderOpts.collectedExpire||V.renderOpts.collectedExpire>=h.INFINITE_CACHE?!1!==r&&r>0?b.expireTime:void 0:V.renderOpts.collectedExpire;return{value:{kind:_.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await m.onRequestError(e,t,{routerKind:"App Router",routePath:E,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:S})},!1,j),t}},Q=async(n,o)=>{try{var i,l;let n=await m.handleResponse({req:e,nextConfig:b,cacheKey:M,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:k,isRoutePPREnabled:!1,isOnDemandRevalidate:S,revalidateOnlyGenerated:T,responseGenerator:Z,waitUntil:a.waitUntil,isMinimalMode:z});if(!D)return;if((null==n||null==(i=n.value)?void 0:i.kind)!==_.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});z||t.setHeader("x-nextjs-cache",S?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let s=(0,v.fromNodeOutgoingHttpHeaders)(n.value.headers);z&&D||s.delete(h.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||s.get("Cache-Control")||s.set("Cache-Control",(0,g.getCacheControlHeader)(n.cacheControl)),await (0,p.sendResponse)(W,X,new Response(n.value.body,{headers:s,status:n.value.status||200}));return}catch(t){if(t instanceof R.NoFallbackError||await m.onRequestError(e,t,{routerKind:"App Router",routePath:U,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:S})},!1,j),D)throw t;await (0,p.sendResponse)(W,X,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:s.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route")||U,i=`${L} ${a}`;n.setAttributes({"next.route":a,"http.route":a,"next.span_name":i}),n.updateName(i),o&&o!==n&&(o.setAttribute("http.route",a),o.updateName(i))})()}};if(K&&G)await Q(G,void 0);else{let t=$.getActiveScopeSpan();await $.withPropagatedContext(e.headers,()=>$.trace(u.BaseServerSpan.handleRequest,{spanName:`${L} ${E}`,kind:s.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},e=>Q(e,t)),void 0,!K)}}e.s(["handler",0,x,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:y})},"routeModule",0,m,"serverHooks",0,w,"workAsyncStorage",0,E,"workUnitAsyncStorage",0,y])}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=_0a2do3x._.js.map
|
|
@@ -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
|