botmancers 0.7.0 → 0.9.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 +50 -0
- package/README.md +5 -5
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +12 -1
- package/app/.next/build-manifest.json +3 -3
- package/app/.next/prerender-manifest.json +4 -4
- package/app/.next/required-server-files.json +2 -2
- package/app/.next/routes-manifest.json +90 -0
- package/app/.next/server/app/_global-error.html +1 -1
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/agents/[id]/activity/page/app-paths-manifest.json +3 -0
- package/app/.next/server/app/agents/[id]/activity/page/next-font-manifest.json +11 -0
- package/app/.next/server/app/agents/[id]/activity/page.js +14 -0
- package/app/.next/server/app/agents/[id]/activity/page.js.nft.json +1 -0
- package/app/.next/server/app/agents/[id]/activity/page_client-reference-manifest.js +3 -0
- package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page/app-paths-manifest.json +3 -0
- package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page/build-manifest.json +20 -0
- package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page/next-font-manifest.json +11 -0
- package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page/react-loadable-manifest.json +1 -0
- package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page/server-reference-manifest.json +4 -0
- package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page.js +14 -0
- package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page.js.nft.json +1 -0
- package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page_client-reference-manifest.js +3 -0
- package/app/.next/server/app/agents/[id]/conversations/page/app-paths-manifest.json +3 -0
- package/app/.next/server/app/agents/[id]/conversations/page/build-manifest.json +20 -0
- package/app/.next/server/app/agents/[id]/conversations/page/next-font-manifest.json +11 -0
- package/app/.next/server/app/agents/[id]/conversations/page/react-loadable-manifest.json +1 -0
- package/app/.next/server/app/agents/[id]/conversations/page/server-reference-manifest.json +4 -0
- package/app/.next/server/app/agents/[id]/conversations/page.js +14 -0
- package/app/.next/server/app/agents/[id]/conversations/page.js.nft.json +1 -0
- package/app/.next/server/app/agents/[id]/conversations/page_client-reference-manifest.js +3 -0
- package/app/.next/server/app/agents/[id]/page/app-paths-manifest.json +3 -0
- package/app/.next/server/app/agents/[id]/page/build-manifest.json +20 -0
- package/app/.next/server/app/{threads → agents}/[id]/page/next-font-manifest.json +1 -1
- package/app/.next/server/app/agents/[id]/page/react-loadable-manifest.json +1 -0
- package/app/.next/server/app/agents/[id]/page/server-reference-manifest.json +4 -0
- package/app/.next/server/app/{threads → agents}/[id]/page.js +6 -5
- package/app/.next/server/app/{threads → agents}/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/page_client-reference-manifest.js +3 -0
- package/app/.next/server/app/agents/[id]/sessions/page/app-paths-manifest.json +3 -0
- package/app/.next/server/app/agents/[id]/sessions/page/build-manifest.json +20 -0
- package/app/.next/server/app/agents/[id]/sessions/page/next-font-manifest.json +11 -0
- package/app/.next/server/app/agents/[id]/sessions/page/react-loadable-manifest.json +1 -0
- package/app/.next/server/app/agents/[id]/sessions/page/server-reference-manifest.json +4 -0
- package/app/.next/server/app/agents/[id]/sessions/page.js +14 -0
- package/app/.next/server/app/agents/[id]/sessions/page.js.nft.json +1 -0
- package/app/.next/server/app/agents/[id]/sessions/page_client-reference-manifest.js +3 -0
- package/app/.next/server/app/agents/[id]/slack/page/app-paths-manifest.json +3 -0
- package/app/.next/server/app/agents/[id]/slack/page/build-manifest.json +20 -0
- package/app/.next/server/app/agents/[id]/slack/page/next-font-manifest.json +11 -0
- package/app/.next/server/app/agents/[id]/slack/page/react-loadable-manifest.json +1 -0
- package/app/.next/server/app/agents/[id]/slack/page/server-reference-manifest.json +4 -0
- package/app/.next/server/app/agents/[id]/slack/page.js +14 -0
- package/app/.next/server/app/agents/[id]/slack/page.js.nft.json +1 -0
- package/app/.next/server/app/agents/[id]/slack/page_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/bots/[id]/activity/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/bots/[id]/activity/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/bots/[id]/activity/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/bots/[id]/activity/route.js +9 -0
- package/app/.next/server/app/api/bots/[id]/activity/route.js.nft.json +1 -0
- package/app/.next/server/app/api/bots/[id]/activity/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/bots/[id]/config/route.js +1 -1
- package/app/.next/server/app/api/bots/[id]/config/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/conversations/[conversationId]/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/bots/[id]/conversations/[conversationId]/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/bots/[id]/conversations/[conversationId]/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/bots/[id]/conversations/[conversationId]/route.js +12 -0
- package/app/.next/server/app/api/bots/[id]/conversations/[conversationId]/route.js.nft.json +1 -0
- package/app/.next/server/app/api/bots/[id]/conversations/[conversationId]/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/bots/[id]/conversations/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/bots/[id]/conversations/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/bots/[id]/conversations/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/bots/[id]/conversations/route.js +12 -0
- package/app/.next/server/app/api/bots/[id]/conversations/route.js.nft.json +1 -0
- package/app/.next/server/app/api/bots/[id]/conversations/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/bots/[id]/overview/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/bots/[id]/overview/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/bots/[id]/overview/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/bots/[id]/overview/route.js +12 -0
- package/app/.next/server/app/api/bots/[id]/overview/route.js.nft.json +1 -0
- package/app/.next/server/app/api/bots/[id]/overview/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route.js +2 -2
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route.js +2 -2
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/shares/route.js +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/shares/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/route.js +3 -3
- package/app/.next/server/app/api/bots/[id]/sessions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/sync/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/bots/[id]/sessions/sync/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/bots/[id]/sessions/sync/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/bots/[id]/sessions/sync/route.js +11 -0
- package/app/.next/server/app/api/bots/[id]/sessions/sync/route.js.nft.json +1 -0
- package/app/.next/server/app/api/bots/[id]/sessions/sync/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/bots/[id]/share-policy/route.js +1 -1
- package/app/.next/server/app/api/bots/[id]/share-policy/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/skill/route.js +1 -1
- package/app/.next/server/app/api/bots/[id]/skill/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/availability/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/delete-preview/route.js +1 -1
- package/app/.next/server/app/api/bots/delete-preview/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/import/route.js +1 -1
- package/app/.next/server/app/api/bots/import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/manage/route.js +1 -1
- package/app/.next/server/app/api/bots/manage/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/name-migrations/route.js +1 -1
- package/app/.next/server/app/api/bots/name-migrations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/route.js +5 -5
- package/app/.next/server/app/api/bots/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/approve/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/deny/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/draft/route.js +1 -1
- package/app/.next/server/app/api/conversations/[id]/draft/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/messages/[messageId]/stop/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/messages/route.js +5 -5
- package/app/.next/server/app/api/conversations/[id]/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/route.js +1 -1
- package/app/.next/server/app/api/conversations/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/stop/route.js +6 -6
- package/app/.next/server/app/api/conversations/[id]/stop/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/route.js +1 -1
- package/app/.next/server/app/api/conversations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/exchanges/[id]/cancel/route.js +1 -1
- package/app/.next/server/app/api/exchanges/[id]/cancel/route.js.nft.json +1 -1
- package/app/.next/server/app/api/exchanges/[id]/route.js +1 -1
- package/app/.next/server/app/api/exchanges/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/exchanges/route.js +2 -2
- package/app/.next/server/app/api/exchanges/route.js.nft.json +1 -1
- package/app/.next/server/app/api/files/[name]/route.js +1 -1
- package/app/.next/server/app/api/files/[name]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/groups/route.js +1 -1
- package/app/.next/server/app/api/groups/route.js.nft.json +1 -1
- package/app/.next/server/app/api/health/route.js +1 -1
- package/app/.next/server/app/api/health/route.js.nft.json +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.nft.json +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 +1 -1
- package/app/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/app/.next/server/app/api/messages/[id]/between/route.js +1 -1
- package/app/.next/server/app/api/messages/[id]/between/route.js.nft.json +1 -1
- package/app/.next/server/app/api/runtime-connections/route.js +1 -1
- package/app/.next/server/app/api/runtime-connections/route.js.nft.json +1 -1
- package/app/.next/server/app/api/service-grants/route.js.nft.json +1 -1
- package/app/.next/server/app/api/shares/[shareRef]/revoke/route.js +1 -1
- package/app/.next/server/app/api/shares/[shareRef]/revoke/route.js.nft.json +1 -1
- package/app/.next/server/app/api/shares/route.js +1 -1
- package/app/.next/server/app/api/shares/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js +4 -3
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js +4 -3
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/pins/route.js +4 -3
- package/app/.next/server/app/api/v0/agents/[agentId]/pins/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/route.js +4 -3
- package/app/.next/server/app/api/v0/agents/[agentId]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js +4 -3
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js +4 -3
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/route.js +4 -3
- package/app/.next/server/app/api/v0/agents/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/capabilities/route.js +4 -3
- package/app/.next/server/app/api/v0/capabilities/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/conversations/[id]/route.js +1 -1
- package/app/.next/server/app/api/v0/conversations/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js +4 -3
- package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/exchanges/[id]/route.js +4 -3
- package/app/.next/server/app/api/v0/exchanges/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/exchanges/route.js +4 -3
- package/app/.next/server/app/api/v0/exchanges/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/mcp/route.js +6 -5
- package/app/.next/server/app/api/v0/mcp/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route.js +4 -3
- package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route.js +4 -3
- package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/pins/[pinRef]/route.js +4 -3
- package/app/.next/server/app/api/v0/pins/[pinRef]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/requests/[id]/route.js +1 -1
- package/app/.next/server/app/api/v0/requests/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js +4 -3
- package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/sessions/[ref]/pins/route.js +4 -3
- package/app/.next/server/app/api/v0/sessions/[ref]/pins/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/sessions/[ref]/shares/route.js +4 -3
- package/app/.next/server/app/api/v0/sessions/[ref]/shares/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route.js +4 -3
- package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/shares/[shareRef]/route.js +4 -3
- package/app/.next/server/app/api/v0/shares/[shareRef]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/shares/current/route.js +4 -3
- package/app/.next/server/app/api/v0/shares/current/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/shares/route.js +4 -3
- package/app/.next/server/app/api/v0/shares/route.js.nft.json +1 -1
- package/app/.next/server/app/api/wake-grants/[id]/revoke/route.js +1 -1
- 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 +1 -1
- 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 +1 -1
- package/app/.next/server/app/api/wakes/[id]/retry/route.js.nft.json +1 -1
- package/app/.next/server/app/bots/[id]/config/page.js.nft.json +1 -1
- package/app/.next/server/app/bots/[id]/config/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/exchanges/page.js.nft.json +1 -1
- package/app/.next/server/app/exchanges/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/exchanges.html +1 -1
- package/app/.next/server/app/exchanges.rsc +3 -3
- package/app/.next/server/app/exchanges.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/exchanges.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/exchanges.segments/exchanges/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +3 -3
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/page.js.nft.json +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/settings/page.js.nft.json +1 -1
- package/app/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/settings.html +1 -1
- package/app/.next/server/app/settings.rsc +2 -2
- package/app/.next/server/app/settings.segments/_full.segment.rsc +2 -2
- package/app/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/threads/[id]/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/threads/[id]/route/build-manifest.json +12 -0
- package/app/.next/server/app/threads/[id]/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/threads/[id]/route.js +10 -0
- package/app/.next/server/app/threads/[id]/route.js.nft.json +1 -0
- package/app/.next/server/app/threads/[id]/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app-paths-manifest.json +12 -1
- package/app/.next/server/chunks/1oeh_server_app_api_bots_[id]_conversations_[conversationId]_route_actions_11cb2lr.js +3 -0
- package/app/.next/server/chunks/{[root-of-the-server]__17xl_55._.js → [root-of-the-server]__03pk_x_._.js} +1 -1
- package/app/.next/server/chunks/{[root-of-the-server]__0mp8bap._.js → [root-of-the-server]__05ds5md._.js} +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0anfwiu._.js +52 -0
- package/app/.next/server/chunks/{[root-of-the-server]__0-w_t2y._.js → [root-of-the-server]__0atpy-s._.js} +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0hhill-._.js +3 -0
- package/app/.next/server/chunks/{[root-of-the-server]__06w5xhe._.js → [root-of-the-server]__0hiikkz._.js} +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0k8wfe2._.js +3 -0
- package/app/.next/server/chunks/{[root-of-the-server]__1eps2a4._.js → [root-of-the-server]__0pp5x67._.js} +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0qqsovi._.js +3 -0
- package/app/.next/server/chunks/{[root-of-the-server]__1dxr858._.js → [root-of-the-server]__0thkp5l._.js} +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0xhwlr4._.js +3 -0
- package/app/.next/server/chunks/{[root-of-the-server]__0-vcyi-._.js → [root-of-the-server]__11yt1hv._.js} +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__1280ke1._.js +46 -0
- package/app/.next/server/chunks/{[root-of-the-server]__0iqh5ta._.js → [root-of-the-server]__12wk406._.js} +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__13wghn3._.js +46 -0
- package/app/.next/server/chunks/{[root-of-the-server]__0lwsto-._.js → [root-of-the-server]__14cwco7._.js} +3 -3
- package/app/.next/server/chunks/{[root-of-the-server]__1kczttr._.js → [root-of-the-server]__185i_bv._.js} +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__1byhehl._.js +3 -0
- package/app/.next/server/chunks/{[root-of-the-server]__10b5-i-._.js → [root-of-the-server]__1ez_5xy._.js} +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__1jxwu9_._.js +52 -0
- package/app/.next/server/chunks/{[root-of-the-server]__0o9ijih._.js → [root-of-the-server]__1mxp6z6._.js} +1 -1
- package/app/.next/server/chunks/{[root-of-the-server]__0ey3_2x._.js → [root-of-the-server]__1s2-vw3._.js} +1 -1
- package/app/.next/server/chunks/{[root-of-the-server]__1hwy3jx._.js → [root-of-the-server]__1xq61ti._.js} +1 -1
- package/app/.next/server/chunks/{[root-of-the-server]__04b3ml2._.js → [root-of-the-server]__20om7um._.js} +1 -1
- package/app/.next/server/chunks/_0061c2q._.js +1 -1
- package/app/.next/server/chunks/_0_b7py8._.js +3 -0
- package/app/.next/server/chunks/_0a2do3x._.js +1 -1
- package/app/.next/server/chunks/_1-5mthb._.js +1 -1
- package/app/.next/server/chunks/_12i5gam._.js +7 -0
- package/app/.next/server/chunks/_1a0er16._.js +18 -0
- package/app/.next/server/chunks/_1uxmsh3._.js +18 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_bots_[id]_activity_route_actions_06oyah6.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_bots_[id]_conversations_route_actions_0op0mjv.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_bots_[id]_overview_route_actions_20nuetv.js +3 -0
- package/app/.next/server/chunks/_next-internal_server_app_api_bots_[id]_sessions_sync_route_actions_00y6n-f.js +3 -0
- package/app/.next/server/chunks/{ssr/_next-internal_server_app_threads_[id]_page_actions_1fte2n3.js → _next-internal_server_app_threads_[id]_route_actions_13zq3u6.js} +2 -2
- package/app/.next/server/chunks/lib_0-opbv7._.js +69 -55
- package/app/.next/server/chunks/lib_0aejojj._.js +69 -55
- package/app/.next/server/chunks/lib_0al5wbc._.js +330 -0
- package/app/.next/server/chunks/lib_0i8cm07._.js +3 -0
- package/app/.next/server/chunks/lib_0il0ml1._.js +69 -55
- package/app/.next/server/chunks/lib_0iujsdg._.js +69 -55
- package/app/.next/server/chunks/{lib_15adnlz._.js → lib_15a9ejf._.js} +53 -44
- package/app/.next/server/chunks/{lib_1zc7-gl._.js → lib_19pzc33._.js} +53 -44
- package/app/.next/server/chunks/lib_1a4ucxv._.js +330 -0
- package/app/.next/server/chunks/lib_1dehbst._.js +69 -55
- package/app/.next/server/chunks/lib_1z4vnh4._.js +69 -55
- package/app/.next/server/chunks/lib_1z7d95m._.js +2181 -0
- package/app/.next/server/chunks/lib_service-api-http_ts_0xzqhny._.js +1 -23
- package/app/.next/server/chunks/lib_service-api_ts_18eok4w._.js +25 -0
- package/app/.next/server/chunks/node_modules_next_1zc5q0a._.js +11 -11
- package/app/.next/server/chunks/ssr/1oeh_server_app_agents_[id]_conversations_[conversationId]_page_actions_08lev_i.js +3 -0
- package/app/.next/server/chunks/ssr/[root-of-the-server]__06s7ons._.js +3 -0
- package/app/.next/server/chunks/ssr/[root-of-the-server]__0r8nmcc._.js +3 -0
- package/app/.next/server/chunks/ssr/[root-of-the-server]__19qlmru._.js +3 -0
- package/app/.next/server/chunks/ssr/[root-of-the-server]__1dpye-p._.js +3 -0
- package/app/.next/server/chunks/ssr/[root-of-the-server]__1fxu3a8._.js +3 -0
- package/app/.next/server/chunks/ssr/[root-of-the-server]__1t9ljq3._.js +3 -0
- package/app/.next/server/chunks/ssr/_0_u9-u6._.js +3 -0
- package/app/.next/server/chunks/ssr/_0g3y1u9._.js +3 -0
- package/app/.next/server/chunks/ssr/{node_modules_next_0x3i8za._.js → _0gzxfz3._.js} +2 -2
- package/app/.next/server/chunks/ssr/_0rvu-il._.js +131 -0
- package/app/.next/server/chunks/ssr/_0u7urta._.js +5 -0
- package/app/.next/server/chunks/ssr/_17ngohj._.js +3 -0
- package/app/.next/server/chunks/ssr/_1iq-7cn._.js +3 -0
- package/app/.next/server/chunks/ssr/_next-internal_server_app_agents_[id]_activity_page_actions_1a_v567.js +3 -0
- package/app/.next/server/chunks/ssr/_next-internal_server_app_agents_[id]_conversations_page_actions_1dpbbj-.js +3 -0
- package/app/.next/server/chunks/ssr/_next-internal_server_app_agents_[id]_page_actions_0k__y7g.js +3 -0
- package/app/.next/server/chunks/ssr/_next-internal_server_app_agents_[id]_sessions_page_actions_1hft42g.js +3 -0
- package/app/.next/server/chunks/ssr/_next-internal_server_app_agents_[id]_slack_page_actions_0dmtbj_.js +3 -0
- package/app/.next/server/chunks/ssr/app_1-nwnha._.js +3 -0
- package/app/.next/server/chunks/ssr/app_agents_[id]_009y8_j._.js +3 -0
- package/app/.next/server/chunks/ssr/app_agents_[id]_0sr4fdg._.js +3 -0
- package/app/.next/server/chunks/ssr/app_agents_[id]_activity_AgentActivityPage_tsx_042-590._.js +3 -0
- package/app/.next/server/chunks/ssr/app_agents_[id]_conversations_page_tsx_15zl_c8._.js +3 -0
- package/app/.next/server/chunks/ssr/app_agents_[id]_sessions_page_tsx_0tfup-2._.js +10 -0
- package/app/.next/server/chunks/ssr/app_agents_[id]_slack_AgentSlackPage_tsx_20njhs1._.js +3 -0
- package/app/.next/server/chunks/ssr/app_bots_[id]_config_page_tsx_1e0uue9._.js +1 -1
- package/app/.next/server/chunks/ssr/app_page_tsx_0pxmutw._.js +3 -0
- package/app/.next/server/chunks/ssr/lib_0pfn9gs._.js +3 -0
- package/app/.next/server/chunks/ssr/lib_agent-registration-ui_ts_1z582mm._.js +3 -0
- package/app/.next/server/chunks/ssr/lib_exchange-view_ts_1a4q9ju._.js +3 -0
- package/app/.next/server/chunks/ssr/lib_share-view_ts_08psw5o._.js +3 -0
- package/app/.next/server/instrumentation.js +1 -1
- package/app/.next/server/middleware-build-manifest.js +3 -3
- package/app/.next/server/next-font-manifest.js +1 -1
- package/app/.next/server/next-font-manifest.json +24 -4
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +1 -1
- package/app/.next/server/server-reference-manifest.js +1 -1
- package/app/.next/server/server-reference-manifest.json +1 -1
- package/app/.next/static/chunks/02q7gb87r2ca3.css +3 -0
- package/app/.next/static/chunks/06i_6p0-ipitj.js +1 -0
- package/app/.next/static/chunks/0cjh4u-f7mlwd.js +1 -0
- package/app/.next/static/chunks/1dhk3pcv7yvm6.js +1 -0
- package/app/.next/static/chunks/1ka9dp1l6c0ga.js +3 -0
- package/app/.next/static/chunks/1ttvnc6qdye8s.js +1 -0
- package/app/.next/static/chunks/1ypwptc0fsn4w.js +1 -0
- package/app/.next/static/chunks/2-fhbx41zyanc.js +1 -0
- package/app/.next/static/chunks/2cc4uzbhs_v23.js +1 -0
- package/app/.next/static/chunks/2n1u8a2efnt88.js +1 -0
- package/app/.next/static/chunks/34v8aumua0x5n.js +1 -0
- package/app/.next/static/chunks/3aasli1i-eiio.js +1 -0
- package/app/.next/static/chunks/3p_p4gnr0d2-x.js +1 -0
- package/app/.next/static/chunks/3s9t477v-z09o.js +1 -0
- package/app/.next/static/chunks/3y5bo6syunkzn.js +8 -0
- package/app/BUILD_INFO.json +2 -2
- package/app/package.json +1 -1
- package/app/server.js +1 -1
- package/package.json +1 -1
- package/app/.next/server/app/threads/[id]/page/app-paths-manifest.json +0 -3
- package/app/.next/server/app/threads/[id]/page_client-reference-manifest.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__0792yb1._.js +0 -44
- package/app/.next/server/chunks/[root-of-the-server]__0d3fjix._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__0e_agq4._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__0qaiqut._.js +0 -44
- package/app/.next/server/chunks/[root-of-the-server]__17mum5-._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__1x8phwp._.js +0 -44
- package/app/.next/server/chunks/_0qv-4by._.js +0 -3
- package/app/.next/server/chunks/lib_0v6lblw._.js +0 -5
- package/app/.next/server/chunks/lib_agent-api_ts_0iv52-o._.js +0 -3
- package/app/.next/server/chunks/ssr/[root-of-the-server]__1t063pe._.js +0 -3
- package/app/.next/server/chunks/ssr/_0_fa0na._.js +0 -3
- package/app/.next/server/chunks/ssr/_0a6r_bx._.js +0 -3
- package/app/.next/server/chunks/ssr/_0epgorw._.js +0 -3
- package/app/.next/server/chunks/ssr/_1cvuhjt._.js +0 -3
- package/app/.next/server/chunks/ssr/_1is_iwu._.js +0 -3
- package/app/.next/server/chunks/ssr/_1n5mvo5._.js +0 -3
- package/app/.next/server/chunks/ssr/_1o94bnv._.js +0 -5
- package/app/.next/server/chunks/ssr/app_exchanges_page_tsx_0j-n2a1._.js +0 -3
- package/app/.next/static/chunks/1ouuczm-gmvxs.js +0 -1
- package/app/.next/static/chunks/1w72fds3-utrx.js +0 -1
- package/app/.next/static/chunks/2095-o17ji0fs.css +0 -3
- package/app/.next/static/chunks/2q-tgwkalrnms.js +0 -1
- package/app/.next/static/chunks/34bv9o9bjkwk0.js +0 -3
- package/app/.next/static/chunks/3rwwunh5sdjzg.js +0 -1
- package/app/.next/static/chunks/3z3mn526_3fwd.js +0 -1
- /package/app/.next/server/app/{threads/[id] → agents/[id]/activity}/page/build-manifest.json +0 -0
- /package/app/.next/server/app/{threads/[id] → agents/[id]/activity}/page/react-loadable-manifest.json +0 -0
- /package/app/.next/server/app/{threads/[id] → agents/[id]/activity}/page/server-reference-manifest.json +0 -0
- /package/app/.next/static/{A9sQnaf9i6YzjHNoPgRfU → nOdd5VXbf23ohQcBBjvHa}/_buildManifest.js +0 -0
- /package/app/.next/static/{A9sQnaf9i6YzjHNoPgRfU → nOdd5VXbf23ohQcBBjvHa}/_clientMiddlewareManifest.js +0 -0
- /package/app/.next/static/{A9sQnaf9i6YzjHNoPgRfU → nOdd5VXbf23ohQcBBjvHa}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,13978,e=>{"use strict";var s=e.i(43476),t=e.i(71645),a=e.i(22016),n=e.i(18566),i=e.i(15983),r=e.i(24204);function l({agentId:e,agentName:a}){let n=(0,t.useId)(),i=(0,t.useId)(),o=(0,t.useId)(),[c,d]=(0,t.useState)(null),[m,u]=(0,t.useState)(""),[h,p]=(0,t.useState)(0),[f,g]=(0,t.useState)("idle"),[x,b]=(0,t.useState)(""),[j,v]=(0,t.useState)(""),[k,y]=(0,t.useState)(""),[N,w]=(0,t.useState)(""),[S,_]=(0,t.useState)("");(0,t.useEffect)(()=>{let s=!1;return fetch(`/api/bots/${encodeURIComponent(e)}/share-policy`,{cache:"no-store"}).then(async e=>{let t=await e.json().catch(()=>null);s||(e.ok&&t?.policy?(u(""),d(t.policy)):u("Could not load the share policy."))}).catch(()=>{s||u("Could not load the share policy.")}),()=>{s=!0}},[e,h]);let C=()=>{b(""),g("idle"),p(e=>e+1)},$=async(s,t)=>{if(!c)return!1;g("saving"),b(""),v("");try{let a=await fetch(`/api/bots/${encodeURIComponent(e)}/share-policy`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({revision:c.revision,...s})}),n=await a.json().catch(()=>null);if(!a.ok||!n?.policy)return g("error"),b("string"==typeof n?.error?.message?n.error.message:"The share policy could not be saved."),!1;return d(n.policy),g("idle"),v(t("number"==typeof n.revoked_contexts?n.revoked_contexts:0)),!0}catch{return g("error"),b("The share policy could not be saved."),!1}},A=async e=>{if(e.preventDefault(),!c)return;let s=(0,r.audienceInputError)(k,N,c.audiences);if(_(s??""),s)return;let t={kind:"slack",team_id:k.trim(),channel_id:N.trim()};await $({audiences:[...c.audiences,t]},()=>`Added ${(0,r.audienceLabel)(t)}.`)&&(y(""),w(""))},R="saving"===f,T=!!c&&"invalid"!==c.state;return(0,s.jsxs)("section",{className:"cfg-card share-policy",id:"session-sharing","aria-labelledby":"cfg-sharing-title",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsx)("h2",{id:"cfg-sharing-title",className:"cfg-title",children:"Session sharing"}),R?(0,s.jsx)("span",{className:"text-sm cfg-faint",role:"status",children:"Saving…"}):null]}),(0,s.jsxs)("p",{className:"text-sm cfg-muted mb-3",children:["A share lets people in one Slack channel ask one of ",a,"’s sessions questions, read-only, until it expires or you revoke it. Create and revoke shares from Sessions."]}),m?(0,s.jsxs)("p",{className:"text-sm cfg-error",role:"alert",children:[m," ",(0,s.jsx)("button",{type:"button",onClick:C,className:"underline hover:no-underline",children:"Retry"})]}):null,c||m?null:(0,s.jsx)("p",{className:"text-sm cfg-faint",role:"status",children:"Loading…"}),c?.state==="invalid"?(0,s.jsxs)("p",{className:"text-sm cfg-error mb-3",role:"alert",children:["The share policy file is invalid, so nothing can be shared: ",c.reason," Fix or remove config/session-shares.json, then"," ",(0,s.jsx)("button",{type:"button",onClick:C,className:"underline hover:no-underline",children:"reload"}),"."]}):null,c?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"share-policy-toggle",children:[(0,s.jsx)("input",{id:n,type:"checkbox",role:"switch",checked:c.agent.share_from_turn,"aria-checked":c.agent.share_from_turn,disabled:!T||R||!c.agent.share_current.supported&&!c.agent.share_from_turn,"data-share-policy":"share_from_turn",onChange:e=>{let s=e.target.checked;$({share_from_turn:s},e=>s?"Share from a turn is on.":`Share from a turn is off.${e?` Revoked ${e} live turn context${1===e?"":"s"}.`:""}`)}}),(0,s.jsxs)("label",{htmlFor:n,className:"text-sm",children:[(0,s.jsx)("span",{className:"font-medium",children:"Share from a turn"})," (",(0,s.jsx)("code",{className:"cfg-code",children:"share_from_turn"}),")"]})]}),(0,s.jsx)("p",{className:"text-sm cfg-faint share-policy-hint",children:(0,r.shareFromTurnNote)(c)}),c.agent.live_contexts>0?(0,s.jsxs)("p",{className:"text-sm cfg-faint share-policy-hint",children:[c.agent.live_contexts," live turn context",1===c.agent.live_contexts?"":"s"," now."]}):null,(0,s.jsx)("h3",{className:"cfg-title share-policy-sub",children:"Slack channel allowlist"}),(0,s.jsx)("p",{className:"text-sm cfg-faint",children:"Every Agent’s shares use this list. A share can only go to a channel on it."}),0===c.audiences.length?(0,s.jsx)("p",{className:"text-sm cfg-muted share-policy-empty",children:"No channel yet: nothing can be shared to Slack."}):(0,s.jsx)("ul",{className:"share-policy-list","aria-label":"Allowed Slack channels",children:c.audiences.map(e=>(0,s.jsxs)("li",{className:"share-policy-entry",children:[(0,s.jsx)("span",{className:"cfg-code",children:e.channel_id}),(0,s.jsxs)("span",{className:"cfg-faint",children:["workspace ",e.team_id]}),(0,s.jsx)("button",{type:"button",className:"cfg-link text-sm share-policy-remove",disabled:!T||R,"aria-label":`Remove ${(0,r.audienceLabel)(e)}`,onClick:()=>{c&&$({audiences:c.audiences.filter(s=>s.team_id!==e.team_id||s.channel_id!==e.channel_id)},()=>`Removed ${(0,r.audienceLabel)(e)}. Its Slack threads stop being answered.`)},children:"Remove"})]},`${e.team_id}:${e.channel_id}`))}),(0,s.jsxs)("form",{className:"share-policy-add",onSubmit:e=>{A(e)},"aria-label":"Add a Slack channel",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{htmlFor:i,className:"text-sm",children:"Workspace ID"}),(0,s.jsx)("input",{id:i,className:"cfg-input",value:k,placeholder:"T0123ABCD",autoComplete:"off",spellCheck:!1,disabled:!T||R,"aria-invalid":!!S,onChange:e=>{y(e.target.value),_("")}})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{htmlFor:o,className:"text-sm",children:"Channel ID"}),(0,s.jsx)("input",{id:o,className:"cfg-input",value:N,placeholder:"C0123ABCD",autoComplete:"off",spellCheck:!1,disabled:!T||R,"aria-invalid":!!S,onChange:e=>{w(e.target.value),_("")}})]}),(0,s.jsx)("button",{type:"submit",className:"cfg-btn-primary text-sm",disabled:!T||R||!k.trim()||!N.trim(),children:"Add channel"})]}),S?(0,s.jsx)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:S}):null,"error"===f?(0,s.jsxs)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:["Couldn't save: ",x," ",(0,s.jsx)("button",{type:"button",onClick:C,className:"underline hover:no-underline",children:"Reload"})]}):null,(0,s.jsx)("p",{className:"mt-2 text-sm cfg-ok",role:"status",children:j})]}):null]})}var o=e.i(10718),c=e.i(74904),d=e.i(33851),m=e.i(44079),u=e.i(52900),h=e.i(87303);function p({attribute:e,label:a,options:n,current:i,onPick:r,className:l}){let o=(0,t.useId)(),c=`avatar-${e}`;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{id:o,className:"avatar-group-label",children:a}),(0,s.jsx)("div",{className:l?`avatar-opt-grid ${l}`:"avatar-opt-grid",role:"radiogroup","aria-labelledby":o,children:n.map(t=>(0,s.jsxs)("label",{title:t.label,className:"avatar-opt",children:[(0,s.jsx)("input",{type:"radio",name:c,value:t.id,checked:i[e]===t.id,onChange:()=>r({[e]:t.id}),className:"avatar-opt-input"}),(0,s.jsx)("span",{className:"avatar-opt-art","aria-hidden":"true",children:(0,s.jsx)(h.default,{config:{...i,[e]:t.id},size:44})}),(0,s.jsx)("span",{children:t.label})]},t.id))})]})}var f=e.i(68541);function g({phase:e,onImport:t}){let a=(0,f.marketImportView)(e);return(0,s.jsxs)("div",{className:"mt-3","data-field":"marketplace-import",children:[(0,s.jsx)("button",{type:"button",onClick:t,disabled:a.busy,"aria-busy":a.busy,"aria-describedby":"cfg-market-import-status",className:"cfg-btn-ghost text-sm w-full sm:w-auto",children:"Import from Grok Marketplace"}),(0,s.jsx)("p",{id:"cfg-market-import-status",role:"status","aria-live":"polite",className:"error"===a.tone?"mt-2 text-sm cfg-error":"mt-2 text-xs cfg-faint",children:a.message})]})}var x=e.i(37947);let b="Fix the highlighted fields.",j=[{key:"avatar_accessory",label:"Avatar accessory"},{key:"avatar_color",label:"Avatar color"},{key:"avatar_eyes",label:"Avatar eyes"},{key:"avatar_hands",label:"Avatar hands"},{key:"description",label:"Description (rules)"},{key:"import_operation_id",label:"Import operation ID"},{key:"import_schema_version",label:"Import schema version"},{key:"memories",label:"Remembered facts"},{key:"name",label:"Name"},{key:"skill_content",label:"Skill content"},{key:"skill_path",label:"Skill path"},{key:"skill_present",label:"Skill present"},{key:"source_provider",label:"Source provider"},{key:"template_id",label:"Template ID"},{key:"template_url",label:"Template URL"},{key:"title",label:"Title"}];function v(e){return String(e).padStart(2,"0")}function k(e){let s=new Date(e);return`${s.getFullYear()}-${v(s.getMonth()+1)}-${v(s.getDate())} ${v(s.getHours())}:${v(s.getMinutes())}`}function y(e){let s=new Date(e);return`${v(s.getHours())}:${v(s.getMinutes())}:${v(s.getSeconds())}`}async function N(e){try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}e.s(["default",0,function(){var e;let r=String((0,n.useParams)().id??""),v=(0,n.useRouter)(),[w,S]=(0,t.useState)(!1),[_,C]=(0,t.useState)(null),[$,A]=(0,t.useState)(!0),[R,T]=(0,t.useState)(!1),[E,I]=(0,t.useState)(!1),[D,O]=(0,t.useState)(0),[F,P]=(0,t.useState)(null),[W,L]=(0,t.useState)("clean"),[U,B]=(0,t.useState)(""),[H,M]=(0,t.useState)(0),[q,K]=(0,t.useState)(!1),[V,G]=(0,t.useState)(""),[J,Y]=(0,t.useState)("clean"),[z,Z]=(0,t.useState)(""),[Q,X]=(0,t.useState)(0),[ee,es]=(0,t.useState)({}),[et,ea]=(0,t.useState)(""),[en,ei]=(0,t.useState)(!1),[er,el]=(0,t.useState)(null),[eo,ec]=(0,t.useState)(!1),ed=(0,u.useRuntimeConnections)(),[em,eu]=(0,t.useState)(void 0),[eh,ep]=(0,t.useState)("clean"),[ef,eg]=(0,t.useState)(""),[ex,eb]=(0,t.useState)(0),[ej,ev]=(0,t.useState)(null),[ek,ey]=(0,t.useState)("clean"),[eN,ew]=(0,t.useState)(""),[eS,e_]=(0,t.useState)(0),{phase:eC,startImport:e$}=function(e){let[s,a]=(0,t.useState)("idle");return(0,t.useEffect)(()=>{let s=window.location.search;if(null===(0,f.importedBotId)(s))return;let t=new URL(window.location.href);t.searchParams.delete(f.IMPORT_RETURN_QUERY),window.history.replaceState(null,"",t.pathname+t.search);let n=!1;return(0,f.resolveImportReturn)(s,e,async e=>(await fetch(`/api/bots/${encodeURIComponent(e)}/config`,{cache:"no-store"})).ok).then(e=>{n||("open"===e.kind?window.location.replace(e.path):"missing"===e.kind&&a("missing"))}),()=>{n=!0}},[e]),{phase:s,startImport:async function(){a("checking");try{let e=await fetch(f.HANDOFF_STATUS_PATH,{cache:"no-store"}),s=await e.json().catch(()=>null);if(!e.ok)return void a("failed");if(s?.configured!==!0)return void a("unavailable");a("redirecting"),window.location.href=(0,f.handoffStartPath)(window.location.origin,window.location.pathname),setTimeout(()=>a(e=>"redirecting"===e?"idle":e),4e3)}catch{a("failed")}}}}(r);function eA(){A(!0),T(!1),O(e=>e+1)}(0,t.useEffect)(()=>{if(!r)return;let e=!1;return fetch(`/api/bots/${encodeURIComponent(r)}/sessions?status=all`,{cache:"no-store"}).then(e=>e.ok?e.json():null).then(s=>{e||eu((s?.sessions??[]).map(e=>({ref:e.ref,title:e.title,status:e.status})))}).catch(()=>{e||eu([])}),()=>{e=!0}},[r,D]),(0,t.useEffect)(()=>{if(!r)return;let e=!1;return fetch(`/api/bots/${encodeURIComponent(r)}/config`).then(async s=>{if(e)return;if(404===s.status){I(!0),C(null);return}if(!s.ok)throw Error("request failed");let t=await s.json();e||(C(t),P(t.bot.description??""),I(!1),T(!1))}).catch(()=>{e||T(!0)}).finally(()=>{e||A(!1)}),()=>{e=!0}},[r,D]);let eR=_?.bot.description??"",eT=null!==F&&F!==eR,eE=_?.skill.content??"",eI=q&&V!==eE,eD=_?(0,d.registrationFormFromBot)(_.bot):null,eO=en&&null!==er&&JSON.stringify(er)!==JSON.stringify(eD),eF=_?.bot.avatar_config??(0,x.resolveAvatar)(_?.bot??{}),eP=ej??eF,eW=null!==ej&&JSON.stringify(ej)!==JSON.stringify(eF),eL=eT||eI||eO||eW;function eU(e,s){N(s).then(s=>{s&&(ea(e),setTimeout(()=>ea(s=>s===e?"":s),2e3))})}async function eB(){if(_&&null!==F){L("saving"),B("");try{let e=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:_.bot.id,description:F})});if(!e.ok){let s="request failed";try{let t=await e.json();t.error&&(s=t.error)}catch{}throw Error(s)}let s=await fetch(`/api/bots/${encodeURIComponent(r)}/config`);if(!s.ok)throw Error("request failed");C(await s.json()),L("confirmed"),M(Date.now()),setTimeout(()=>{L(e=>"confirmed"===e?"clean":e)},5e3)}catch(e){L("error"),B(e instanceof Error?e.message:"request failed")}}}function eH(){_&&(el((0,d.registrationFormFromBot)(_.bot)),ei(!0),ec(!1),ep("clean"),eg(""),ed.retry())}function eM(e){el(s=>s?{...s,...e}:s),eg(""),ep(e=>"error"===e?"clean":e)}function eq(){ei(!1),el(null),ep("clean"),eg("")}function eK(e){ev({...ej??eF,...e}),ey("clean"),ew("")}async function eV(){if(_&&ej){ey("saving"),ew("");try{let e=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:_.bot.id,avatar:ej})});if(!e.ok){let s="request failed";try{let t=await e.json();t.error&&(s=t.error)}catch{}throw Error(s)}let s=await fetch(`/api/bots/${encodeURIComponent(r)}/config`);if(!s.ok)throw Error("request failed");C(await s.json()),ev(null),ey("confirmed"),e_(Date.now()),setTimeout(()=>{ey(e=>"confirmed"===e?"clean":e)},5e3)}catch(e){ey("error"),ew(e instanceof Error?e.message:"request failed")}}}async function eG(){if(_&&er){if((0,d.hasRegistrationErrors)((0,d.registrationFormView)(er,ed.state))){ec(!0),ep("error"),eg(b);return}ep("saving"),eg("");try{let e=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify((0,d.registrationPatchBody)(_.bot.id,er))});if(!e.ok){let s="request failed";try{let t=await e.json();t.error&&(s=t.error)}catch{}throw Error(s)}let s=await fetch(`/api/bots/${encodeURIComponent(r)}/config`);if(!s.ok)throw Error("request failed");C(await s.json()),ei(!1),el(null),ep("confirmed"),eb(Date.now()),setTimeout(()=>{ep(e=>"confirmed"===e?"clean":e)},5e3)}catch(e){ep("error"),eg(e instanceof Error?e.message:"request failed")}}}function eJ(){G(_?.skill.content??""),K(!0),Y("clean"),Z("")}async function eY(){if(_&&(V.trim()||window.confirm("Delete this skill file?"))){Y("saving"),Z("");try{let e=await fetch(`/api/bots/${encodeURIComponent(r)}/skill`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:V})});if(!e.ok){let s="request failed";try{let t=await e.json();t.error&&(s=t.error)}catch{}throw Error(s)}let s=await e.json();C(e=>e?{...e,skill:s.skill,currentHash:s.currentHash}:e),K(!1),Y("confirmed"),X(Date.now()),setTimeout(()=>{Y(e=>"confirmed"===e?"clean":e)},5e3)}catch(e){Y("error"),Z(e instanceof Error?e.message:"request failed")}}}if((0,t.useEffect)(()=>{if(!eL)return;let e=e=>{e.preventDefault()};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[eL]),E)return(0,s.jsx)("div",{className:"cfg-page flex items-center justify-center",children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("p",{className:"mb-4",children:"Agent not found."}),(0,s.jsx)(a.default,{href:`/agents/${encodeURIComponent(r)}`,className:"cfg-link",children:"← Back to Overview"})]})});if($&&!_)return(0,s.jsx)("div",{className:"cfg-page",children:(0,s.jsxs)("div",{className:"max-w-6xl mx-auto space-y-6",children:[(0,s.jsx)("div",{className:"h-6 w-32 rounded animate-pulse cfg-skel"}),(0,s.jsx)("div",{className:"h-20 rounded-lg animate-pulse cfg-skel"}),(0,s.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,s.jsx)("div",{className:"space-y-6",children:[0,1,2].map(e=>(0,s.jsx)("div",{className:"h-48 rounded-lg animate-pulse cfg-skel"},e))}),(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)("div",{className:"h-64 rounded-lg animate-pulse cfg-skel"}),(0,s.jsx)("div",{className:"h-80 rounded-lg animate-pulse cfg-skel"})]})]})]})});if(R&&!_)return(0,s.jsx)("div",{className:"cfg-page",children:(0,s.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,s.jsx)(a.default,{href:`/agents/${encodeURIComponent(r)}`,className:"cfg-link cfg-back text-sm",children:"← Back to Overview"}),(0,s.jsxs)("header",{className:"mt-3 mb-6 flex flex-wrap items-center gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h1",{className:"text-xl font-bold truncate",children:"Agent configuration"}),(0,s.jsx)("p",{className:"text-sm cfg-faint truncate",children:"Couldn't load agent details."})]}),(0,s.jsxs)("div",{className:"ml-auto text-right",children:[(0,s.jsxs)("p",{className:"text-sm cfg-muted",children:["Current config hash: ",(0,s.jsx)("code",{className:"cfg-code",children:"—"})]}),(0,s.jsx)("p",{className:"text-sm mt-1",children:(0,s.jsx)("span",{className:"cfg-faint",children:"○ Not loaded"})})]})]}),(0,s.jsx)("div",{className:"grid gap-6 lg:grid-cols-2 items-start",children:[["Skills","Rules","Agent","Template source"],["Launch snapshots","Avatar"]].map(e=>(0,s.jsx)("div",{className:"min-w-0 space-y-6",children:e.map(e=>(0,s.jsxs)("div",{className:"cfg-card",children:[(0,s.jsx)("h2",{className:"cfg-title mb-2",children:e}),(0,s.jsxs)("p",{className:"text-sm cfg-muted",children:["Couldn't load this section."," ",(0,s.jsx)("button",{onClick:eA,className:"cfg-link",children:"Retry"})]})]},e))},e[0]))})]})});if(!_)return null;let{bot:ez,skill:eZ,currentHash:eQ,snapshots:eX}=_,e0=!!(ez.source_provider||ez.template_id||ez.template_url||ez.import_schema_version||ez.import_operation_id),e1="saving"===W?(0,s.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):eT||"error"===W?(0,s.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,s.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===W?(0,s.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",y(H)]}):(0,s.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),e2="saving"===J?(0,s.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):eI||"error"===J?(0,s.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,s.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===J?(0,s.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",y(Q)]}):(0,s.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),e3="saving"===eh?(0,s.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):eO||"error"===eh?(0,s.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,s.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===eh?(0,s.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",y(ex)]}):(0,s.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),e4="saving"===ek?(0,s.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):eW||"error"===ek?(0,s.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,s.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===ek?(0,s.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",y(eS)]}):(0,s.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"});return(0,s.jsxs)("div",{className:"cfg-page",children:[(0,s.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,s.jsx)(a.default,{href:`/agents/${encodeURIComponent(r)}`,onClick:function(e){eL&&!window.confirm("You have unsaved changes. Leave without saving?")&&e.preventDefault()},className:"cfg-link cfg-back text-sm",children:"← Back to Overview"}),(0,s.jsxs)("header",{className:"mt-3 mb-6 flex flex-wrap items-center gap-4",children:[(0,s.jsx)(h.default,{bot:ez,size:48,title:`${ez.name} avatar`}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h1",{className:"text-xl font-bold truncate",children:ez.name}),(0,s.jsx)("p",{className:"text-sm cfg-faint truncate",children:ez.title||" "})]}),(0,s.jsxs)("div",{className:"ml-auto text-right",children:[(0,s.jsxs)("p",{className:"text-sm cfg-muted",children:["Current config hash:"," ",(0,s.jsx)("code",{className:"cfg-code",title:eQ,children:eQ.slice(0,8)})," ",(0,s.jsx)("button",{onClick:()=>eU("header",eQ),className:"cfg-link text-sm",children:"header"===et?"Copied":"Copy"})]}),(0,s.jsx)("p",{className:"text-sm mt-1",children:eL?(0,s.jsxs)("span",{className:"cfg-dirty",children:[(0,s.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):(0,s.jsx)("span",{className:"cfg-faint",children:"● Saved"})})]})]}),(0,s.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2 items-start","data-cfg-layout":"columns",children:[(0,s.jsxs)("div",{className:"min-w-0 space-y-6","data-cfg-column":"primary",children:[(0,s.jsxs)("section",{className:"cfg-card",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsx)("h2",{className:"cfg-title",children:"Skills"}),e2]}),"unsupported"===eZ.status?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"text-sm cfg-muted mb-3",children:"Unsupported name"}),(0,s.jsx)("p",{className:"text-sm cfg-muted",children:"Skill files need an agent name matching /^[A-Za-z0-9_-]+$/ — this name cannot map to a skill path."})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{className:"text-sm cfg-muted mb-3",children:[eZ.path," · ","present"===eZ.status?"Present":"Not present"]}),q?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("textarea",{value:V,onChange:e=>G(e.target.value),rows:8,className:"cfg-input text-sm"}),"error"===J&&(0,s.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",z,"."," ",(0,s.jsx)("button",{onClick:eY,className:"underline hover:no-underline",children:"Retry"})]}),(0,s.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,s.jsx)("button",{onClick:eY,disabled:!eI||"saving"===J,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===J?"Saving…":"Save"}),(0,s.jsx)("button",{onClick:function(){K(!1),Y("clean"),Z("")},disabled:!eI||"saving"===J,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}):"present"===eZ.status?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("pre",{className:"text-sm cfg-pre max-h-64 overflow-y-auto",children:eZ.content}),(0,s.jsx)("button",{onClick:eJ,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Edit"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"text-sm cfg-muted",children:"No skill file yet. Create SKILL.md to give this agent standing instructions."}),(0,s.jsx)("button",{onClick:eJ,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Create"})]}),(0,s.jsx)("p",{className:"mt-3 text-xs cfg-faint",children:"Appended verbatim as a system message at launch."})]})]}),(0,s.jsxs)("section",{className:"cfg-card",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsx)("h2",{className:"cfg-title",children:"Rules"}),e1]}),(0,s.jsx)("textarea",{value:F??"",onChange:e=>P(e.target.value),rows:8,className:"cfg-input cfg-input-sans text-sm"}),(0,s.jsx)("p",{className:"mt-2 text-xs cfg-faint",children:"Sent verbatim as the standing-rules system message on every turn. This beats the user's request for detail or length."}),"error"===W&&(0,s.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",U,"."," ",(0,s.jsx)("button",{onClick:eB,className:"underline hover:no-underline",children:"Retry"})]}),(0,s.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,s.jsx)("button",{onClick:eB,disabled:!eT||"saving"===W,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===W?"Saving…":"Save"}),(0,s.jsx)("button",{onClick:function(){P(eR),L("clean"),B("")},disabled:!eT||"saving"===W,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}),(0,s.jsxs)("section",{className:"cfg-card",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsx)("h2",{className:"cfg-title",children:"Agent"}),e3]}),(()=>{if(!en||!er){let e=(0,d.registrationReadView)(ez,em);return(0,s.jsxs)("div",{"data-field":"runtime-read",children:[(0,s.jsx)("dl",{className:"text-sm",children:e.rows.map(e=>(0,s.jsxs)("div",{"data-row":e.key,className:"flex flex-col sm:flex-row sm:justify-between gap-x-4 py-1 border-t cfg-line",children:[(0,s.jsx)("dt",{className:"cfg-faint",children:e.label}),(0,s.jsx)("dd",{className:"sm:text-right break-words cfg-muted",children:e.value})]},e.key))}),e.notices.map(e=>(0,s.jsx)("p",{className:"text-sm cfg-dirty mt-2",children:e},e)),(0,s.jsx)("button",{onClick:eH,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Edit"})]})}let e=(0,d.registrationFormView)(er,ed.state);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(m.RegistrationFields,{idPrefix:"cfg",variant:"config",form:er,onChange:eM,view:e,showErrors:eo,connections:ed.state,onRetryConnections:ed.retry,onAddConnection:ed.add,workspacePlaceholder:(0,c.defaultWorkdirFor)(ez.id),workspaceHint:(0,c.configWorkspaceHint)(ez.id),sessions:em,includeHomeSession:!0}),"error"===eh&&(0,s.jsxs)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:[ef===b?ef:`Couldn't save: ${ef}.`," ",ef===b?null:(0,s.jsx)("button",{onClick:eG,className:"underline hover:no-underline",children:"Retry"})]}),(0,s.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,s.jsx)("button",{onClick:eG,disabled:!eO||"saving"===eh||e.submitDisabled,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===eh?"Saving…":"Save"}),(0,s.jsx)("button",{onClick:eq,disabled:"saving"===eh,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:eO?"Discard":"Cancel"})]})]})})()]}),(0,s.jsxs)("section",{className:"cfg-card",children:[(0,s.jsx)("h2",{className:"cfg-title mb-3",children:"Template source"}),!e0&&(0,s.jsx)("p",{className:"text-sm cfg-muted mb-3",children:"Created manually in Botmancers — no template source."}),(0,s.jsxs)("dl",{className:"text-sm",children:[(0,s.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,s.jsx)("dt",{className:"cfg-faint",children:"Source provider"}),(0,s.jsx)("dd",{className:"text-right",children:ez.source_provider??"—"})]}),(0,s.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,s.jsx)("dt",{className:"cfg-faint",children:"Template ID"}),(0,s.jsx)("dd",{className:"text-right",children:ez.template_id??"—"})]}),(0,s.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,s.jsx)("dt",{className:"cfg-faint",children:"Template URL"}),(0,s.jsx)("dd",{className:"text-right break-all",children:ez.template_url?(e=ez.template_url).startsWith("http://")||e.startsWith("https://")?(0,s.jsx)("a",{href:ez.template_url,className:"cfg-link",children:ez.template_url}):ez.template_url:"—"})]}),(0,s.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,s.jsx)("dt",{className:"cfg-faint",children:"Import schema version"}),(0,s.jsx)("dd",{className:"text-right",children:ez.import_schema_version??"—"})]}),(0,s.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,s.jsx)("dt",{className:"cfg-faint",children:"Import operation ID"}),(0,s.jsx)("dd",{className:"text-right break-all",children:ez.import_operation_id??"—"})]}),(0,s.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-y cfg-line",children:[(0,s.jsx)("dt",{className:"cfg-faint",children:"Imported at"}),(0,s.jsx)("dd",{className:"text-right",children:ez.import_timestamp?k(ez.import_timestamp):"—"})]})]}),(0,s.jsx)(g,{phase:eC,onImport:()=>{e$()}})]})]}),(0,s.jsxs)("div",{className:"min-w-0 space-y-6","data-cfg-column":"secondary",children:[(0,s.jsxs)("section",{className:"cfg-card",children:[(0,s.jsx)("h2",{className:"cfg-title mb-3",children:"Launch snapshots"}),0===eX.length?(0,s.jsx)("p",{className:"text-sm cfg-muted",children:"No launches recorded yet."}):(0,s.jsx)("ul",{className:"space-y-3",children:eX.map(e=>{let t=e.hash===eQ,a=!!ee[e.id];return(0,s.jsxs)("li",{className:"cfg-row",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)("p",{className:"text-sm",children:[k(e.created_at)," · ",e.id.slice(0,4),e.transport?` \xb7 ${e.transport}`:null]}),(0,s.jsx)("button",{onClick:()=>es(s=>({...s,[e.id]:!s[e.id]})),"aria-label":a?"Collapse snapshot detail":"Expand snapshot detail",className:"cfg-chevron px-1",children:a?"▾":"▸"})]}),(0,s.jsxs)("p",{className:"mt-1 text-sm",children:[(0,s.jsx)("code",{className:"cfg-code",children:e.hash.slice(0,12)})," ",(0,s.jsx)("button",{onClick:()=>eU(e.id,e.hash),className:"cfg-link text-sm",children:et===e.id?"Copied":"Copy"})]}),(0,s.jsx)("p",{className:"mt-1 text-sm",children:t?(0,s.jsx)("span",{className:"cfg-ok",children:"● Matches current config"}):(0,s.jsx)("span",{className:"cfg-faint",children:"○ Config changed since"})}),a&&(0,s.jsxs)("div",{className:"mt-3 pt-3 border-t cfg-line text-sm",children:[(0,s.jsxs)("p",{className:"cfg-muted break-all",children:[(0,s.jsx)("span",{className:"font-medium",children:"Launch ID:"})," ",e.id]}),(0,s.jsxs)("p",{className:"mt-1 cfg-muted break-all",children:[(0,s.jsx)("span",{className:"font-medium",children:"Hash:"})," ",(0,s.jsx)("code",{className:"cfg-code",children:e.hash})]}),(0,s.jsx)("dl",{className:"mt-2",children:j.map(t=>{let a=e.snapshot[t.key];return(0,s.jsxs)("div",{className:"py-1 border-t cfg-line",children:[(0,s.jsx)("dt",{className:"cfg-faint",children:t.label}),(0,s.jsx)("dd",{className:"whitespace-pre-wrap break-words",children:null==a?(0,s.jsx)("span",{className:"cfg-faint",children:"null"}):Array.isArray(a)?0===a.length?(0,s.jsx)("span",{className:"cfg-faint",children:"(none)"}):(0,s.jsx)("span",{className:"block max-h-32 overflow-y-auto",children:a.map(e=>`- ${e}`).join("\n")}):"boolean"==typeof a?String(a):""===a?(0,s.jsx)("span",{className:"cfg-faint",children:"(empty)"}):(0,s.jsx)("span",{className:"block max-h-32 overflow-y-auto",children:a})})]},t.key)})})]})]},e.id)})})]}),(0,s.jsx)(l,{agentId:ez.id,agentName:ez.name}),(0,s.jsxs)("section",{className:"cfg-card",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsx)("h2",{className:"cfg-title",children:"Avatar"}),e4]}),(0,s.jsxs)("div",{className:"flex items-center gap-4 mb-4",children:[(0,s.jsx)(h.default,{config:eP,size:96,title:"Avatar live preview"}),(0,s.jsx)("p",{className:"text-sm cfg-muted",children:"Outline style: the color is the line color, nothing is filled. Pick an option to preview, then Save."})]}),(0,s.jsx)(p,{attribute:"color",label:"Color",options:x.AVATAR_COLORS,current:eP,onPick:eK,className:"mb-3"}),(0,s.jsx)(p,{attribute:"eyes",label:"Eyes",options:x.AVATAR_EYES,current:eP,onPick:eK,className:"mb-3"}),(0,s.jsx)(p,{attribute:"hands",label:"Hands",options:x.AVATAR_HANDS,current:eP,onPick:eK,className:"mb-3"}),(0,s.jsx)(p,{attribute:"accessory",label:"Accessory",options:x.AVATAR_ACCESSORIES,current:eP,onPick:eK}),"error"===ek&&(0,s.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",eN,"."," ",(0,s.jsx)("button",{onClick:eV,className:"underline hover:no-underline",children:"Retry"})]}),(0,s.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,s.jsx)("button",{onClick:eV,disabled:!eW||"saving"===ek,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===ek?"Saving…":"Save"}),(0,s.jsx)("button",{onClick:function(){ev(null),ey("clean"),ew("")},disabled:!eW||"saving"===ek,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}),(0,s.jsxs)("section",{className:"cfg-card cfg-danger","aria-labelledby":"cfg-danger-title",children:[(0,s.jsx)("h2",{id:"cfg-danger-title",className:"cfg-title mb-3",children:"Danger zone"}),(0,s.jsx)("p",{className:"text-sm cfg-muted",children:o.DELETE_REMOVES_COPY}),(0,s.jsx)("p",{className:"text-sm cfg-faint mt-2",children:o.DELETE_KEEPS_COPY}),(0,s.jsx)("button",{type:"button",onClick:()=>S(!0),className:"mt-3 delete-btn text-sm w-full sm:w-auto",children:"Delete agent"})]})]})]})]}),w?(0,s.jsx)(i.default,{ids:[ez.id],onCancel:()=>S(!1),onDeleted:e=>v.push(`/?deleted=${Math.max(e.length,1)}`)}):null]})}],13978)},33851,44079,52900,68541,e=>{"use strict";var s=e.i(3136);let t="This computer",a={read_only:"Read only",workspace_write:"Workspace write"},n={workspaces:"Selected workspaces",sessions:"Selected imported sessions",all_provider_sessions:"All sessions this runtime can see"};function i(e){return e.startsWith("/")||"~"===e||e.startsWith("~/")}function r(e){return e.length>1?e.replace(/\/+$/,""):e}s.AGENTS.join("|");let l="/api/runtime-connections",o={connection:"Runtime connection",scope:"Session scope",defaultWorkspace:"Default workspace (optional)",policy:"Policy",homeSession:"Home session (optional)"},c={connection:"The runtime installation or account this Agent uses. Several Agents can share one.",workspaces:"One absolute path per line. An empty scope never means unrestricted.",sessions:"Only this Agent’s own Botmancers sessions can be selected.",noSessions:"This Agent has no sessions yet. Choose workspaces or all sessions for now.",allSessions:"Every session this runtime can see. Choose this only on purpose.",defaultWorkspace:"Where new sessions start. Convenience only — not a permission.",resumeEdits:"Needs Workspace write.",homeSession:"A stable session to return to. Must be one of this Agent’s sessions.",addConnection:"Stores a name and host only. Credentials stay with the runtime."},d="Loading runtime connections…",m="Couldn't load runtime connections — retry.";function u(){return{status:"loading",connections:[],error:""}}function h(e){return`${e.label} \xb7 ${s.AGENT_LABELS[e.provider]??e.provider}`}function p(e){if("object"!=typeof e||null===e)return null;let s=e.connections;if(!Array.isArray(s))return null;let t=[];for(let e of s){if("object"!=typeof e||null===e||"string"!=typeof e.id||"string"!=typeof e.provider||"string"!=typeof e.label)return null;t.push({id:e.id,provider:e.provider,label:e.label,host:"string"==typeof e.host?e.host:"",agent_count:"number"==typeof e.agent_count?e.agent_count:void 0})}return t}function f(e){let s=[];for(let t of e.split("\n")){let e=t.trim();e&&!s.includes(e)&&s.push(e)}return s}function g(e){return"workspaces"===e.scopeKind?{kind:"workspaces",workspaces:f(e.workspaces)}:"sessions"===e.scopeKind?{kind:"sessions",sessions:e.sessions}:{kind:e.scopeKind}}function x(e){return{mode:e.policyMode,allow_new_sessions:e.allowNewSessions,allow_resume_with_edits:e.allowResumeWithEdits}}e.s(["CONNECTIONS_ENDPOINT",0,l,"CONNECTIONS_ERROR_COPY",0,m,"CONNECTIONS_LOADING_COPY",0,d,"DEFAULT_REGISTRATION_FORM",0,{connectionId:"",scopeKind:"",workspaces:"",sessions:[],defaultWorkspace:"",policyMode:"read_only",allowNewSessions:!0,allowResumeWithEdits:!1,homeSessionId:""},"HINTS",0,c,"LABELS",0,o,"connectionOptionLabel",0,h,"hasRegistrationErrors",0,function(e){return Object.keys(e.errors).length>0},"initialConnectionListState",0,u,"parseConnectionList",0,p,"registrationCreateBody",0,function(e,s){let t={name:String(e??"").trim(),runtime_connection_id:s.connectionId,session_scope:g(s),policy:x(s)},a=s.defaultWorkspace.trim();return a&&(t.default_workspace=a),t},"registrationFormFromBot",0,function(e){let s=e.session_scope??null;return{connectionId:e.runtime_connection_id??"",scopeKind:s?.kind??"",workspaces:s?.kind==="workspaces"?s.workspaces.join("\n"):"",sessions:s?.kind==="sessions"?[...s.sessions]:[],defaultWorkspace:e.default_workspace??"",policyMode:e.policy?.mode??"read_only",allowNewSessions:!e.policy||e.policy.allow_new_sessions,allowResumeWithEdits:!!e.policy&&e.policy.allow_resume_with_edits,homeSessionId:e.home_session_id??""}},"registrationFormView",0,function(e,s){let t={};e.connectionId||(t.connection="Pick a runtime connection.");let a=f(e.workspaces);e.scopeKind?"workspaces"===e.scopeKind?0===a.length?t.workspaces="Add at least one workspace.":a.every(i)||(t.workspaces="Workspaces must be absolute paths (or start with ~/)."):"sessions"===e.scopeKind&&0===e.sessions.length&&(t.sessions="Select at least one session."):t.scope="Choose a session scope.";let n=e.defaultWorkspace.trim();n&&(i(n)?"workspaces"!==e.scopeKind||t.workspaces||a.some(e=>{let s,t;return s=r(e),s===(t=r(n))||t.startsWith("/"===s?"/":`${s}/`)})||(t.defaultWorkspace="The default workspace must be inside one of the selected workspaces."):t.defaultWorkspace="The default workspace must be an absolute path (or start with ~/)."),e.allowResumeWithEdits&&"workspace_write"!==e.policyMode&&(t.policy="Resume with edits needs the Workspace write policy.");let l="",o=!1;return"ready"!==s.status&&(o=!0,l="error"===s.status?m:""),{errors:t,submitDisabled:o,blocker:l}},"registrationPatchBody",0,function(e,s){return{id:e,runtime_connection_id:s.connectionId,session_scope:g(s),default_workspace:s.defaultWorkspace.trim(),policy:x(s),home_session_id:s.homeSessionId}},"registrationReadView",0,function(e,t){var i;let r,l=[{key:"connection",label:o.connection,value:(r=e.runtime_connection)?`${r.label} (${(0,s.agentLabel)(r.provider)} \xb7 ${r.host})`:"Not set"},{key:"scope",label:o.scope,value:function(e,s){if(!e)return"Not set — this Agent cannot launch until a scope is chosen.";if("all_provider_sessions"===e.kind)return n.all_provider_sessions;if("workspaces"===e.kind)return`${n.workspaces}: ${e.workspaces.join(", ")}`;let t=e.sessions.map(e=>s?.find(s=>s.ref===e)?.title??e);return`${n.sessions}: ${t.join(", ")}`}(e.session_scope,t)},{key:"defaultWorkspace",label:"Default workspace",value:e.default_workspace||"None"},{key:"policy",label:o.policy,value:(i=e.policy)?[a[i.mode],i.allow_new_sessions?"new sessions allowed":"no new sessions",i.allow_resume_with_edits?"resume with edits allowed":"no resume with edits"].join(" · "):"Not set"}],c=[];return l.push({key:"homeSession",label:"Home session",value:e.home_session_id?t?.find(s=>s.ref===e.home_session_id)?.title??e.home_session_id:"None"}),"connection"===e.launch_blocker?c.push("Choose a runtime connection before this Agent can run."):"session_scope"===e.launch_blocker?c.push("Choose a session scope before this Agent can run."):"agent"===e.launch_blocker&&c.push("This Agent has an unsupported Agent type."),{rows:l,notices:c}}],33851);var b=e.i(43476),j=e.i(71645),v=e.i(74904);let k={modal:{fieldset:"agent-fieldset reg-fieldset",legend:"field-legend",label:"",picks:"runtime-picks",pick:"runtime-pick",stack:"reg-stack",control:"reg-control",input:"",hint:"runtime-hint",error:"form-error reg-error",button:"runtime-retry",note:"runtime-note"},config:{fieldset:"agent-fieldset reg-fieldset",legend:"block text-sm cfg-muted mt-3 mb-1 p-0",label:"block text-sm cfg-muted mt-3 mb-1",picks:"flex flex-wrap gap-x-4 gap-y-1 text-sm cfg-muted",pick:"text-sm cfg-muted",stack:"flex flex-col gap-1 text-sm cfg-muted",control:"cfg-input text-sm",input:"cfg-input text-sm",hint:"mt-1 text-xs cfg-faint",error:"mt-1 text-sm cfg-error",button:"cfg-link text-sm",note:"text-sm cfg-muted mt-1"}};function y({id:e,message:s,variant:t}){return s?(0,b.jsx)("p",{id:e,className:k[t].error,role:"alert",children:s}):null}function N({idPrefix:e,variant:s,onAdd:a}){let n=k[s],[i,r]=(0,j.useState)(!1),[l,o]=(0,j.useState)(v.AGENT_OPTIONS[0].value),[d,m]=(0,j.useState)(""),[u,h]=(0,j.useState)(""),[p,f]=(0,j.useState)(""),[g,x]=(0,j.useState)(!1),y=async()=>{if(g)return;x(!0),f("");let e=await a({provider:l,label:d,host:u.trim()||t});(x(!1),"string"==typeof e)?f(e):(r(!1),m(""),h(""))};return i?(0,b.jsxs)("div",{id:`${e}-add-connection`,className:"reg-add-connection",role:"group","aria-label":"Add connection",children:[(0,b.jsx)("label",{className:n.label,htmlFor:`${e}-add-provider`,children:"Provider"}),(0,b.jsx)("select",{id:`${e}-add-provider`,className:n.control,value:l,onChange:e=>o(e.target.value),children:v.AGENT_OPTIONS.map(e=>(0,b.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,b.jsx)("label",{className:n.label,htmlFor:`${e}-add-label`,children:"Connection name"}),(0,b.jsx)("input",{id:`${e}-add-label`,type:"text",className:n.input||void 0,value:d,placeholder:"Codex on my laptop",onChange:e=>m(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),y())}}),(0,b.jsx)("label",{className:n.label,htmlFor:`${e}-add-host`,children:"Host"}),(0,b.jsx)("input",{id:`${e}-add-host`,type:"text",className:n.input||void 0,value:u,placeholder:t,"aria-describedby":`${e}-add-hint`,onChange:e=>h(e.target.value)}),(0,b.jsx)("p",{id:`${e}-add-hint`,className:n.hint,children:c.addConnection}),p?(0,b.jsx)("p",{className:n.error,role:"alert",children:p}):null,(0,b.jsxs)("div",{className:"reg-actions",children:[(0,b.jsx)("button",{type:"button",className:n.button,onClick:()=>void y(),disabled:g,children:g?"Adding…":"Add"}),(0,b.jsx)("button",{type:"button",className:n.button,"aria-expanded":"true",onClick:()=>r(!1),children:"Cancel"})]})]}):(0,b.jsx)("button",{type:"button",className:n.button,"aria-expanded":"false","aria-controls":`${e}-add-connection`,onClick:()=>r(!0),children:"Add connection…"})}e.s(["RegistrationFields",0,function({idPrefix:e,variant:s,form:t,onChange:i,view:r,showErrors:l,connections:u,onRetryConnections:p,onAddConnection:f,workspacePlaceholder:g,workspaceHint:x,sessions:j,includeHomeSession:v}){let w=k[s],S=e=>l?r.errors[e]:void 0,_=s=>`${e}-${s}-error`,C=(e,...s)=>[...s,S(e)?_(e):""].filter(Boolean).join(" ")||void 0,$=!!(j&&j.length>0);return(0,b.jsxs)("div",{className:"registration-fields","data-registration":s,children:[(0,b.jsxs)("fieldset",{className:w.fieldset,"data-field":"connection","aria-describedby":C("connection",`${e}-connection-hint`),children:[(0,b.jsx)("legend",{className:w.legend,id:`${e}-connection-legend`,children:o.connection}),"loading"===u.status?(0,b.jsx)("p",{className:w.note,role:"status",children:d}):"error"===u.status?(0,b.jsxs)("p",{className:w.note,role:"status",children:[m," ",(0,b.jsx)("button",{type:"button",className:w.button,onClick:p,children:"Retry"})]}):(0,b.jsxs)("select",{id:`${e}-connection`,className:w.control,"aria-labelledby":`${e}-connection-legend`,"aria-required":"true","aria-invalid":!!S("connection")||void 0,value:t.connectionId,onChange:e=>i({connectionId:e.target.value}),children:[(0,b.jsx)("option",{value:"",disabled:!0,children:"Select a connection…"}),u.connections.map(e=>(0,b.jsx)("option",{value:e.id,children:h(e)},e.id))]}),(0,b.jsx)("p",{id:`${e}-connection-hint`,className:w.hint,children:c.connection}),(0,b.jsx)(y,{id:_("connection"),message:S("connection"),variant:s}),"ready"===u.status?(0,b.jsx)(N,{idPrefix:e,variant:s,onAdd:async e=>{let s=await f(e);return"string"!=typeof s&&i({connectionId:s.id}),s}}):null]}),(0,b.jsxs)("fieldset",{className:w.fieldset,"data-field":"scope",children:[(0,b.jsx)("legend",{className:w.legend,id:`${e}-scope-legend`,children:o.scope}),(0,b.jsx)("div",{className:w.stack,role:"radiogroup","aria-labelledby":`${e}-scope-legend`,"aria-required":"true","aria-describedby":C("scope"),children:["workspaces","sessions","all_provider_sessions"].map(s=>(0,b.jsxs)("label",{className:w.pick,children:[(0,b.jsx)("input",{type:"radio",name:`${e}-scope`,value:s,checked:t.scopeKind===s,disabled:"sessions"===s&&!$,onChange:()=>i({scopeKind:s})})," "+n[s]]},s))}),$?null:(0,b.jsx)("p",{className:w.hint,children:c.noSessions}),(0,b.jsx)(y,{id:_("scope"),message:S("scope"),variant:s}),"workspaces"===t.scopeKind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("label",{className:w.label,htmlFor:`${e}-workspaces`,children:"Workspaces"}),(0,b.jsx)("textarea",{id:`${e}-workspaces`,className:w.input||void 0,rows:2,value:t.workspaces,placeholder:"/Users/you/work/project","aria-required":"true","aria-invalid":!!S("workspaces")||void 0,"aria-describedby":C("workspaces",`${e}-workspaces-hint`),onChange:e=>i({workspaces:e.target.value})}),(0,b.jsx)("p",{id:`${e}-workspaces-hint`,className:w.hint,children:c.workspaces}),(0,b.jsx)(y,{id:_("workspaces"),message:S("workspaces"),variant:s})]}):null,"sessions"===t.scopeKind&&j?(0,b.jsxs)("div",{className:w.stack,role:"group","aria-label":"Sessions in scope","aria-describedby":C("sessions",`${e}-sessions-hint`),children:[j.map(e=>(0,b.jsxs)("label",{className:w.pick,children:[(0,b.jsx)("input",{type:"checkbox",checked:t.sessions.includes(e.ref),onChange:s=>i({sessions:s.target.checked?[...t.sessions,e.ref]:t.sessions.filter(s=>s!==e.ref)})}),` ${e.title} (${e.status})`]},e.ref)),(0,b.jsx)("p",{id:`${e}-sessions-hint`,className:w.hint,children:c.sessions}),(0,b.jsx)(y,{id:_("sessions"),message:S("sessions"),variant:s})]}):null,"all_provider_sessions"===t.scopeKind?(0,b.jsx)("p",{className:w.hint,children:c.allSessions}):null]}),(0,b.jsxs)("div",{"data-field":"default-workspace",children:[(0,b.jsx)("label",{className:w.label,htmlFor:`${e}-default-workspace`,children:o.defaultWorkspace}),(0,b.jsx)("input",{id:`${e}-default-workspace`,type:"text",className:w.input||void 0,value:t.defaultWorkspace,placeholder:g,"aria-invalid":!!S("defaultWorkspace")||void 0,"aria-describedby":C("defaultWorkspace",`${e}-default-workspace-hint`,`${e}-default-workspace-note`),onChange:e=>i({defaultWorkspace:e.target.value})}),(0,b.jsx)("p",{id:`${e}-default-workspace-hint`,className:w.hint,children:x}),(0,b.jsx)("p",{id:`${e}-default-workspace-note`,className:w.hint,children:c.defaultWorkspace}),(0,b.jsx)(y,{id:_("defaultWorkspace"),message:S("defaultWorkspace"),variant:s})]}),(0,b.jsxs)("fieldset",{className:w.fieldset,"data-field":"policy",children:[(0,b.jsx)("legend",{className:w.legend,id:`${e}-policy-legend`,children:o.policy}),(0,b.jsx)("div",{className:w.picks,role:"radiogroup","aria-labelledby":`${e}-policy-legend`,children:["read_only","workspace_write"].map(s=>(0,b.jsxs)("label",{className:w.pick,children:[(0,b.jsx)("input",{type:"radio",name:`${e}-policy`,value:s,checked:t.policyMode===s,onChange:()=>i("read_only"===s?{policyMode:s,allowResumeWithEdits:!1}:{policyMode:s})})," "+a[s]]},s))}),(0,b.jsxs)("div",{className:w.stack,children:[(0,b.jsxs)("label",{className:w.pick,children:[(0,b.jsx)("input",{type:"checkbox",checked:t.allowNewSessions,onChange:e=>i({allowNewSessions:e.target.checked})})," Allow new sessions"]}),(0,b.jsxs)("label",{className:w.pick,children:[(0,b.jsx)("input",{type:"checkbox",checked:t.allowResumeWithEdits,disabled:"workspace_write"!==t.policyMode,"aria-describedby":`${e}-resume-hint`,onChange:e=>i({allowResumeWithEdits:e.target.checked})})," Allow resume with edits"]}),(0,b.jsx)("p",{id:`${e}-resume-hint`,className:w.hint,children:c.resumeEdits})]}),(0,b.jsx)(y,{id:_("policy"),message:S("policy"),variant:s})]}),v?(0,b.jsxs)("div",{"data-field":"home-session",children:[(0,b.jsx)("label",{className:w.label,htmlFor:`${e}-home-session`,children:o.homeSession}),(0,b.jsxs)("select",{id:`${e}-home-session`,className:w.control,value:t.homeSessionId,"aria-describedby":`${e}-home-session-hint`,onChange:e=>i({homeSessionId:e.target.value}),children:[(0,b.jsx)("option",{value:"",children:"None"}),(j??[]).map(e=>(0,b.jsx)("option",{value:e.ref,children:`${e.title} (${e.status})`},e.ref))]}),(0,b.jsx)("p",{id:`${e}-home-session-hint`,className:w.hint,children:c.homeSession})]}):null]})}],44079),e.s(["useRuntimeConnections",0,function(){let[e,s]=(0,j.useState)(()=>u()),[t,a]=(0,j.useState)(0);return(0,j.useEffect)(()=>{let e=!1;return fetch(l,{cache:"no-store"}).then(async t=>{let a=t.ok?p(await t.json().catch(()=>null)):null;e||s(a?{status:"ready",connections:a,error:""}:{status:"error",connections:[],error:`HTTP ${t.status}`})}).catch(t=>{e||s({status:"error",connections:[],error:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},[t]),{state:e,retry:(0,j.useCallback)(()=>{s(u()),a(e=>e+1)},[]),add:(0,j.useCallback)(async e=>{let t=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await t.json().catch(()=>null);if(!t.ok)return"string"==typeof a?.error?a.error:"Failed to add the connection";let n=p({connections:[a]})?.[0];return n?(s(e=>({status:"ready",connections:[...e.connections,n],error:""})),n):"Failed to add the connection"},[])}}],52900);let w="imported",S=/^[A-Za-z0-9_-]{1,128}$/;function _(e){let s=new URLSearchParams(e).get(w);if(null===s)return null;let t=s.trim();return S.test(t)?t:""}function C(e){return`/bots/${encodeURIComponent(e)}/config`}async function $(e,s,t){let a=_(e);if(null===a)return{kind:"none"};if(!a)return{kind:"missing"};if(a===s)return{kind:"stay"};try{return await t(a)?{kind:"open",path:C(a)}:{kind:"missing"}}catch{return{kind:"missing"}}}e.s(["HANDOFF_STATUS_PATH",0,"/api/marketplace-handoff/status","IMPORT_RETURN_QUERY",0,w,"handoffStartPath",0,function(e,s){return`/api/marketplace-handoff?return=${encodeURIComponent(e+s)}`},"importedBotId",0,_,"importedConfigPath",0,C,"marketImportView",0,function(e){switch(e){case"checking":return{busy:!0,tone:"muted",message:"Checking Grok Marketplace…"};case"redirecting":return{busy:!0,tone:"muted",message:"Opening Grok Marketplace…"};case"unavailable":return{busy:!1,tone:"error",message:"Grok Marketplace isn't configured. Set CLONE_MARKET_URL on the Botmancers server."};case"failed":return{busy:!1,tone:"error",message:"Couldn't reach Botmancers to start the import. Try again."};case"missing":return{busy:!1,tone:"error",message:"Imported agent not found. The import may not have completed."};default:return{busy:!1,tone:"muted",message:"Imports a new agent and opens its Config. This agent is not changed."}}},"resolveImportReturn",0,$],68541)},24204,e=>{"use strict";var s=e.i(63352),t=e.i(50814);function a(e){return"active"===e.state}let n=/^T[A-Z0-9]{2,20}$/,i=/^[CG][A-Z0-9]{2,20}$/;e.s(["SHARE_DURATIONS",0,[{label:"5 minutes",seconds:300},{label:"1 hour",seconds:3600},{label:"8 hours",seconds:28800},{label:"24 hours",seconds:86400}],"SHARE_STATUS_LABELS",0,{active:"Active",exhausted:"Questions used",answering:"Answering",recovering:"Recovering",expired:"Expired",revoked:"Revoked"},"audienceInputError",0,function(e,s,t){let a=e.trim(),r=s.trim();return n.test(a)?i.test(r)?t.some(e=>e.team_id===a&&e.channel_id===r)?"That channel is already on the allowlist.":null:"Channel ID must look like C0123ABCD (a public or private channel ID; no wildcards).":"Workspace ID must look like T0123ABCD (a Slack team ID; no wildcards)."},"audienceLabel",0,function(e){return`Slack channel ${e.channel_id} \xb7 workspace ${e.team_id}`},"createdByLabel",0,function(e){return"owner"===e.created_by?"Shared by you":"current_session"===e.created_by?"Shared from a turn of this session":"Shared by a service"},"expiryLabel",0,function(e,t=Date.now()){return"revoked"===e.state?`Revoked ${(0,s.formatSessionDate)(e.revoked_at??e.expires_at)}`:"expired"===e.state||e.expires_at<=t?`Expired ${(0,s.formatSessionDate)(e.expires_at)}`:`Expires ${(0,s.formatSessionDate)(e.expires_at)} (in ${function(e){let s=Math.max(1,Math.round(e/6e4));if(s<60)return`${s} min`;let t=Math.floor(s/60),a=s%60;return a?`${t} h ${a} min`:`${t} h`}(e.expires_at-t)})`},"sessionShares",0,function(e,s){let t=e.filter(e=>e.session_ref===s);return[...t.filter(a).sort((e,s)=>s.created_at-e.created_at),...t.filter(e=>!a(e)).sort((e,s)=>(s.revoked_at??s.expires_at)-(e.revoked_at??e.expires_at))]},"shareCreateAvailability",0,function(e,s){let a=`/bots/${encodeURIComponent(e.agent.id)}/config#session-sharing`;if(!s)return{available:!1,reason:"Share to Slack is unavailable: the share policy could not be loaded.",configHref:null};let n=(0,t.sessionRowActions)(e).find(e=>"ask"===e.action);return n&&!n.availability.available?{available:!1,reason:n.availability.reason.replace(/^Ask from this context is unavailable:/,"Share to Slack is unavailable:"),configHref:null}:"invalid"===s.state?{available:!1,reason:"Share to Slack is unavailable: the share policy file is invalid. Fix it in Config.",configHref:a}:0===s.audiences.length?{available:!1,reason:"Share to Slack needs a Slack channel on the share allowlist. Add one in Config.",configHref:a}:{available:!0}},"shareCreateBody",0,function(e,s,t,a){return{audience:{team_id:e.team_id,channel_id:e.channel_id},ttl_seconds:s,max_turns:t,idempotency_key:a}},"shareFromTurnNote",0,function(e){return e.agent.share_current.supported?e.agent.share_from_turn?"On: a turn Botmancers launches for this Agent can share its own session to an allowlisted channel. Turning it off revokes every live turn context at once.":"Off: no turn of this Agent can share its own session. Sessions can still be shared from the Agent Sessions page.":e.agent.share_current.reason??"This runtime cannot share its own session from a turn."},"shareIsLive",0,a,"shareStatusNote",0,function(e){switch(e.status){case"active":return"Slack replies in its thread ask this session (read-only).";case"answering":return"A Slack question is being answered now. The next one waits until it finishes.";case"recovering":return"A question was interrupted by a Botmancers restart. The next Slack question clears it.";case"exhausted":return`All ${e.max_turns} questions are used. Slack questions get the limit notice; create a new share to keep going.`;case"expired":return"Expired: Slack questions get the expired notice. Its history stays here.";case"revoked":return"Revoked: Slack questions get the revoked notice. Its history stays here."}},"threadLabel",0,function(e){return e.thread.posted?`Slack thread posted ${(0,s.formatSessionDate)(e.thread.posted_at??0)}`:"active"===e.state?"Waiting for the Slack relay to post the thread":"No Slack thread was posted"},"turnsLabel",0,function(e){return`${e.turns_used} of ${e.max_turns} question${1===e.max_turns?"":"s"} used`}])}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,91267,e=>{"use strict";var t=e.i(43476),n=e.i(22016),a=e.i(71645),s=e.i(70925);let r=["disabled","misconfigured","connecting","connected","reconnecting","failed","stopped"],i=["slack_tokens_absent","app_token_missing","bot_token_missing","app_token_invalid","bot_token_invalid","share_config_absent","share_config_invalid","share_config_no_audience","workspace_not_allowlisted","slack_auth_failed","slack_connect_failed"],o={app_token_missing:"Add the Socket Mode app token to the Botmancers core environment, then restart Botmancers.",bot_token_missing:"Add the bot token to the Botmancers core environment, then restart Botmancers.",app_token_invalid:"Replace the Socket Mode app token with a valid value, then restart Botmancers.",bot_token_invalid:"Replace the bot token with a valid value, then restart Botmancers.",share_config_absent:"Add an allowlisted Slack channel in Agent Config, then restart Botmancers.",share_config_invalid:"Repair the session sharing policy in Agent Config, then restart Botmancers.",share_config_no_audience:"Add an allowlisted Slack channel in Agent Config, then restart Botmancers.",workspace_not_allowlisted:"Allowlist a channel from the workspace connected to the Botmancers Slack app, then restart Botmancers."};function l(e){switch(e.state){case"disabled":return{label:"Disabled",summary:"The optional Botmancers Slack relay is off.",guidance:"To use Slack sharing, configure both Slack relay credentials and at least one allowlisted channel, then restart Botmancers.",tone:"quiet"};case"misconfigured":return{label:"Needs configuration",summary:"The Botmancers Slack relay cannot start with its current configuration.",guidance:o[e.reason??"share_config_invalid"]??"Review the Slack relay credentials and sharing allowlist, then restart Botmancers.",tone:"warning"};case"connecting":return{label:"Connecting",summary:"The Botmancers Slack relay is opening its Socket Mode connection.",guidance:"Wait a moment, then refresh. Existing shares remain bounded to their exact sessions.",tone:"working"};case"connected":return{label:"Connected",summary:"The single Botmancers Slack relay is connected.",guidance:"It can post and answer eligible shared-session threads for all Agents on this Botmancers instance.",tone:"good"};case"reconnecting":return{label:"Reconnecting",summary:"The Botmancers Slack relay lost its connection and is reconnecting.",guidance:"Wait and refresh. Pending work is recovered after the connection returns; do not recreate shares just for a reconnect.",tone:"working"};case"failed":return{label:"Failed",summary:"The Botmancers Slack relay could not authenticate or connect.",guidance:"slack_auth_failed"===e.reason?"Check the configured Slack app and bot credentials, then restart Botmancers.":"Check Slack connectivity and the Socket Mode app configuration, then restart Botmancers.",tone:"warning"};case"stopped":return{label:"Stopped",summary:"The Botmancers Slack relay is not running.",guidance:"Start or restart Botmancers. Existing share records remain available for review.",tone:"quiet"}}}let c=[{value:"all",label:"All states"},{value:"active",label:"Live"},{value:"expired",label:"Expired"},{value:"revoked",label:"Revoked"}];var d=e.i(24204);function u({agentId:e,agentName:a,relay:s,policy:r,shares:i,filter:o,nextCursor:l,refreshing:d,loadingMore:p,onFilter:v,onRefresh:k,onLoadMore:_,onSharesChanged:b}){let x=`/agents/${encodeURIComponent(e)}/sessions`,y=`/bots/${encodeURIComponent(e)}/config#session-sharing`;return(0,t.jsxs)("div",{className:"agent-slack","data-agent-slack-page":!0,children:[(0,t.jsxs)("header",{className:"agent-slack-intro",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"agent-eyebrow",children:"Slack"}),(0,t.jsx)("h2",{children:"Relay health and shared sessions"}),(0,t.jsxs)("p",{children:["Botmancers runs one optional Slack relay. ",a," does not have a separate Slack app; below are only the session threads shared for this Agent."]})]}),(0,t.jsx)("button",{type:"button",className:"agent-slack-refresh",onClick:k,disabled:d,children:d?"Refreshing…":"Refresh"})]}),(0,t.jsxs)("section",{className:"agent-slack-relay","aria-labelledby":"relay-heading",children:[(0,t.jsxs)("div",{className:"agent-slack-section-head",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"agent-eyebrow",children:"Botmancers-wide connection"}),(0,t.jsx)("h3",{id:"relay-heading",children:"Slack relay"})]}),"ready"===s.state?(0,t.jsx)(h,{health:s.value}):null]}),"loading"===s.state?(0,t.jsx)("p",{role:"status",children:"Checking the relay…"}):null,"error"===s.state?(0,t.jsxs)("div",{className:"agent-slack-error",role:"alert",children:[(0,t.jsx)("strong",{children:"Relay health unavailable"}),(0,t.jsx)("p",{children:"Botmancers could not read the redacted health status. Refresh to try again."})]}):null,"ready"===s.state?(0,t.jsx)(g,{health:s.value}):null]}),(0,t.jsxs)("section",{className:"agent-slack-policy","aria-labelledby":"policy-heading",children:[(0,t.jsxs)("div",{className:"agent-slack-section-head",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"agent-eyebrow",children:"This Agent"}),(0,t.jsx)("h3",{id:"policy-heading",children:"Sharing readiness"})]}),(0,t.jsx)(n.default,{href:y,children:"Edit in Config"})]}),"loading"===r.state?(0,t.jsx)("p",{role:"status",children:"Checking sharing policy…"}):null,"error"===r.state?(0,t.jsxs)("div",{className:"agent-slack-error",role:"alert",children:[(0,t.jsx)("strong",{children:"Sharing policy unavailable"}),(0,t.jsx)("p",{children:"Refresh, or open Config to review this Agent’s stored policy."})]}):null,"ready"===r.state?(0,t.jsx)(f,{policy:r.value}):null]}),(0,t.jsxs)("section",{className:"agent-slack-shares","aria-labelledby":"shares-heading",children:[(0,t.jsxs)("div",{className:"agent-slack-section-head agent-slack-shares-head",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"agent-eyebrow",children:"This Agent"}),(0,t.jsx)("h3",{id:"shares-heading",children:"Shared session threads"}),(0,t.jsx)("p",{children:"Each share is ask-only and can reach exactly one owning session."})]}),(0,t.jsx)(n.default,{className:"agent-primary-action",href:x,children:"Share a session"})]}),(0,t.jsx)("div",{className:"agent-slack-filters",role:"group","aria-label":"Filter shares by state",children:c.map(e=>(0,t.jsx)("button",{type:"button","aria-pressed":o===e.value,onClick:()=>v(e.value),children:e.label},e.value))}),"loading"===i.state?(0,t.jsx)("p",{className:"agent-slack-empty",role:"status",children:"Loading shared sessions…"}):null,"error"===i.state?(0,t.jsxs)("div",{className:"agent-slack-error",role:"alert",children:[(0,t.jsx)("strong",{children:"Shared sessions unavailable"}),(0,t.jsx)("p",{children:"No partial or stale list is shown. Refresh to try again."})]}):null,"ready"===i.state&&0===i.value.length?(0,t.jsx)("p",{className:"agent-slack-empty",children:"all"===o?`No sessions from ${a} have been shared to Slack yet.`:`No ${c.find(e=>e.value===o)?.label.toLowerCase()} shares for ${a}.`}):null,"ready"===i.state&&i.value.length>0?(0,t.jsx)("ul",{className:"agent-slack-share-list","aria-label":`Slack shares for ${a}`,children:i.value.map(n=>(0,t.jsx)(m,{share:n,agentId:e,onChanged:b},n.share_ref))}):null,"ready"===i.state&&l?(0,t.jsx)("button",{type:"button",className:"agent-slack-more",onClick:_,disabled:p,children:p?"Loading…":"Load more shares"}):null]})]})}function h({health:e}){let n=l(e);return(0,t.jsx)("span",{className:`agent-slack-status is-${n.tone}`,"data-relay-state":e.state,children:n.label})}function g({health:e}){let n=l(e);return(0,t.jsxs)("div",{className:"agent-slack-relay-copy",children:[(0,t.jsx)("p",{children:(0,t.jsx)("strong",{children:n.summary})}),(0,t.jsx)("p",{children:n.guidance}),"connected"===e.state&&e.connections>0?(0,t.jsxs)("p",{className:"agent-muted",children:["Connections opened this run: ",e.connections]}):null]})}function f({policy:e}){let n="loaded"===e.state&&e.audiences.length>0;return(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{children:(0,t.jsx)("strong",{children:n?"Ready to create session shares.":"invalid"===e.state?"The sharing policy needs repair.":"No Slack audience is allowlisted yet."})}),(0,t.jsxs)("p",{className:"agent-muted",children:["Share from a running Agent turn: ",e.agent.share_from_turn?"On":"Off",". Session owners can still share eligible sessions from Sessions."]}),e.audiences.length?(0,t.jsx)("ul",{className:"agent-slack-audiences","aria-label":"Allowed Slack audiences",children:e.audiences.map(e=>(0,t.jsx)("li",{children:(0,d.audienceLabel)(e)},`${e.team_id}:${e.channel_id}`))}):(0,t.jsx)("p",{className:"agent-slack-empty",children:"No allowlisted Slack channels."})]})}function m({share:e,agentId:s,onChanged:r}){let[i,o]=(0,a.useState)(!1),[l,c]=(0,a.useState)(!1),[u,h]=(0,a.useState)(""),g=(0,a.useRef)(null),f=(0,d.shareIsLive)(e),p=`/agents/${encodeURIComponent(s)}/sessions?session=${encodeURIComponent(e.session_ref)}`,v=async()=>{c(!0),h("");try{let t=await fetch(`/api/shares/${encodeURIComponent(e.share_ref)}/revoke`,{method:"POST"}),n=await t.json().catch(()=>null);if(!t.ok)throw Error("string"==typeof n?.error?.message?n.error.message:"The share could not be revoked.");o(!1),r()}catch(e){h(e instanceof Error?e.message:"The share could not be revoked.")}finally{c(!1)}};return(0,t.jsxs)("li",{className:`agent-slack-share is-${e.status}`,"data-share-ref":e.share_ref,"data-share-status":e.status,children:[(0,t.jsxs)("div",{className:"agent-slack-share-summary",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:`agent-slack-status is-share-${e.status}`,children:d.SHARE_STATUS_LABELS[e.status]}),(0,t.jsx)("strong",{children:(0,d.audienceLabel)(e.audience)}),(0,t.jsxs)("small",{children:[(0,d.turnsLabel)(e)," · ",(0,d.expiryLabel)(e)]})]}),(0,t.jsx)("span",{className:"agent-slack-detail-hint",children:"Open for details"})]}),(0,t.jsx)("p",{className:"agent-slack-state-note",children:(0,d.shareStatusNote)(e)}),(0,t.jsxs)("details",{className:"agent-slack-details",children:[(0,t.jsx)("summary",{children:"Details"}),(0,t.jsxs)("dl",{className:"agent-slack-share-details",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("dt",{children:"Owning session"}),(0,t.jsx)("dd",{children:(0,t.jsx)(n.default,{href:p,children:e.session_ref})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("dt",{children:"Posted thread"}),(0,t.jsx)("dd",{children:(0,d.threadLabel)(e)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("dt",{children:"Creation path"}),(0,t.jsx)("dd",{children:"current_session"===e.created_via?"Running Agent turn":"owner"===e.created_by?"Agent Sessions":"Session share API"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("dt",{children:"Created by"}),(0,t.jsx)("dd",{children:(0,d.createdByLabel)(e)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("dt",{children:"Authority"}),(0,t.jsx)("dd",{children:"Ask only · exact session"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("dt",{children:"Share reference"}),(0,t.jsx)("dd",{children:(0,t.jsx)("code",{children:e.share_ref})})]})]})]}),(0,t.jsxs)("div",{className:"agent-slack-share-actions",children:[(0,t.jsx)(n.default,{href:p,children:"Open owning session"}),f&&!i?(0,t.jsx)("button",{ref:g,type:"button",className:"agent-slack-revoke","data-share-action":"revoke",onClick:()=>o(!0),children:"Revoke"}):null]}),i?(0,t.jsxs)("div",{className:"agent-slack-confirm",role:"group","aria-label":"Confirm revoke",children:[(0,t.jsx)("p",{children:"Revoke this share? The next Slack question in its thread gets the revoked notice. This can’t be undone."}),(0,t.jsxs)("div",{children:[(0,t.jsx)("button",{type:"button",className:"agent-slack-revoke","data-share-action":"confirm-revoke",disabled:l,onClick:()=>{v()},children:l?"Revoking…":"Revoke share"}),(0,t.jsx)("button",{type:"button",disabled:l,onClick:()=>{o(!1),requestAnimationFrame(()=>g.current?.focus())},children:"Keep it"})]})]}):null,u?(0,t.jsx)("p",{className:"delete-error",role:"alert",children:u}):null]})}e.s(["AgentSlackView",0,u,"default",0,function(){let{id:e,overview:o,loading:l,error:c,notFound:d}=(0,s.useAgentOverview)(),[h,g]=(0,a.useState)({state:"loading"}),[f,m]=(0,a.useState)({state:"loading"}),[p,v]=(0,a.useState)({state:"loading"}),[k,_]=(0,a.useState)("all"),[b,x]=(0,a.useState)(null),[y,S]=(0,a.useState)(!1),[$,w]=(0,a.useState)(!1),[j,A]=(0,a.useState)(0),[C,R]=(0,a.useState)(""),N=(0,a.useRef)(0),T=(0,a.useCallback)((t=null)=>{let n=new URLSearchParams({agent_id:e,limit:String(12)});return"all"!==k&&n.set("state",k),t&&n.set("cursor",t),`/api/shares?${n.toString()}`},[k,e]);(0,a.useEffect)(()=>{let t=!1,n=++N.current;return Promise.allSettled([fetch("/api/health",{cache:"no-store"}).then(async e=>(function(e){if(!e||"object"!=typeof e||!r.includes(e.state))return null;let t=null===e.reason?null:i.includes(e.reason)?e.reason:null;return{state:e.state,reason:t,since:Number.isFinite(e.since)?Number(e.since):0,connections:Number.isInteger(e.connections)&&Number(e.connections)>=0?Number(e.connections):0}})((await e.json().catch(()=>null))?.slack)),fetch(`/api/bots/${encodeURIComponent(e)}/share-policy`,{cache:"no-store"}).then(async e=>{let t=await e.json().catch(()=>null);if(!e.ok||!t?.policy)throw Error("policy");return t.policy}),fetch(T(),{cache:"no-store"}).then(async t=>{let n=await t.json().catch(()=>null);if(!t.ok||!Array.isArray(n?.shares))throw Error("shares");return{shares:n.shares.filter(t=>t.agent.id===e),cursor:"string"==typeof n.next_cursor?n.next_cursor:null}})]).then(([a,s,r])=>{t||n!==N.current||(g("fulfilled"===a.status&&a.value?{state:"ready",value:a.value}:{state:"error"}),m("fulfilled"===s.status?{state:"ready",value:s.value}:{state:"error"}),"fulfilled"===r.status?(v({state:"ready",value:r.value.shares}),x(r.value.cursor)):v({state:"error"}),R(e))}).finally(()=>{t||n!==N.current||w(!1)}),()=>{t=!0}},[e,j,T]);let I=()=>{w(!0),g({state:"loading"}),m({state:"loading"}),v({state:"loading"}),x(null),A(e=>e+1)},L=async()=>{if(b&&!y&&"ready"===p.state){S(!0);try{let t=await fetch(T(b),{cache:"no-store"}),n=await t.json().catch(()=>null);if(!t.ok||!Array.isArray(n?.shares))throw Error("shares");let a=n.shares.filter(t=>t.agent.id===e);v({state:"ready",value:[...p.value,...a]}),x("string"==typeof n.next_cursor?n.next_cursor:null)}catch{v({state:"error"})}finally{S(!1)}}};if(l)return(0,t.jsx)("div",{className:"agent-state",role:"status",children:"Loading Slack operations…"});if(d)return(0,t.jsxs)("div",{className:"agent-state",children:[(0,t.jsx)("h2",{children:"Agent not found"}),(0,t.jsx)(n.default,{href:"/",children:"Choose an Agent"})]});if(c||!o)return(0,t.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,t.jsx)("h2",{children:"Slack page unavailable"}),(0,t.jsx)("p",{children:"Botmancers could not load this Agent."})]});let B=C!==e;return(0,t.jsx)(u,{agentId:e,agentName:o.agent.name,relay:B?{state:"loading"}:h,policy:B?{state:"loading"}:f,shares:B?{state:"loading"}:p,filter:k,nextCursor:b,refreshing:$,loadingMore:y,onFilter:e=>{e!==k&&(v({state:"loading"}),x(null),_(e))},onRefresh:I,onLoadMore:()=>{L()},onSharesChanged:I})}],91267)},50814,63352,e=>{"use strict";function t(e){return`${new Date(e).toISOString().slice(0,16).replace("T"," ")} UTC`}function n(e){return e?e.split("/").filter(e=>e.length>0).pop()??null:null}function a(e,t){let n=function(e){if(!e)return null;let t=e.toLowerCase();return"muse code"===t?"muse":(["codex","claude","cursor","hermes","muse"].includes(t),t)}(t);switch(e){case"provider_unavailable":return n?{reason:`${n} is not installed or did not start`,fix:`Install ${n} and Retry.`}:{reason:"the runtime is not installed or did not start",fix:"Install the runtime and Retry."};case"auth_required":return{reason:"not signed in",fix:"Sign in and Retry."};case"permission_denied":return{reason:"permission denied",fix:"Check permissions and Retry."};case"incompatible_version":return{reason:"incompatible version",fix:"Update the runtime and Retry."};case"usage_limit":return{reason:"usage limit reached",fix:"Wait or upgrade and Retry."};case"scope_missing":return{reason:"no session scope is set",fix:"Choose a scope in Config."};case"provider_failed":return{reason:"the listing failed",fix:"Retry."};default:return{reason:e,fix:"Retry."}}}let s="Not reported";function r(e){return e.toFixed(1).replace(/\.0$/,"")}function i(e){return e.toLocaleString("en-US")}function o(e){return 0===e?"$0.00":e>=.01?`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`:e<1e-4?"<$0.0001":`$${e.toFixed(4)}`}let l={input_tokens:"Input tokens",output_tokens:"Output tokens",cost_usd:"Cost"};function c(e,t,n){return"cost_usd"===e?o(t):n?i(t):t<1e3?String(t):t<999950?`${r(t/1e3)}k`:t<99995e4?`${r(t/1e6)}M`:`${r(t/1e9)}B`}function d(e){return`${e} ${1===e?"run":"runs"}`}function u(e,t,n=!1){let a=l[e];if(!t||"unavailable"===t.quality||null===t.sum)return{name:a,text:s,quality:"unavailable",coverage:t&&t.total>0?`0 of ${d(t.total)} reported`:"No runs recorded",label:`${a}: not reported`};let r=c(e,t.sum,n),i=c(e,t.sum,!0);return"partial"===t.quality?{name:a,text:r,quality:"partial",coverage:`Partial: ${t.known} of ${d(t.total)} reported`,label:`${a}: at least ${i}, partial, reported by ${t.known} of ${d(t.total)}`}:{name:a,text:r,quality:"complete",coverage:`All ${d(t.total)} reported`,label:`${a}: ${i}, reported by all ${d(t.total)}`}}e.s(["SESSION_FILTER_OPTIONS",0,[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"ended",label:"Ended"}],"attemptLabel",0,function(e){let t="source"===e.role?"Started the session":"Resumed the session";return`${t} \xb7 ${e.outcome??"running"}`},"emptySessionsCopy",0,function(e,t,n,s){if("active"===e)return`${t} has no active sessions.`;if("ended"===e)return`${t} has no ended sessions.`;if(n?.last_error_code){let{reason:e,fix:t}=a(n.last_error_code,s),r=s?`${s} sessions`:"sessions";return`Could not read ${r}: ${e}. ${t}`}if(n&&null===n.synced_at)return`${t} has not synced sessions yet. Refresh to load past sessions.`;let r=n?.out_of_scope_count??0;return r>0?`${r} ${1===r?"session exists":"sessions exist"} outside ${t}'s scope. Widen the scope to see them.`:`${t} has no sessions yet. One appears after a coding run keeps its runtime context.`},"formatSessionDate",0,t,"formatSyncRelativeTime",0,function(e,t=Date.now()){if(null===e)return"never";let n=Math.max(0,t-e);if(n<6e4)return"just now";let a=Math.floor(n/6e4);if(a<60)return`${a} minute${1===a?"":"s"} ago`;let s=Math.floor(a/60);if(s<24)return`${s} hour${1===s?"":"s"} ago`;let r=Math.floor(s/24);return`${r} day${1===r?"":"s"} ago`},"noMatchingSessionsCopy",0,function(e,t){let a=e.trim();if(a)return`No sessions match “${a}”.`;let s=n(t);return s?`No sessions in ${s}.`:"No sessions match the current filters."},"registrationSessionSyncCopy",0,function(e,t){if("failed"===e.outcome){let{reason:n,fix:s}=a(e.error_code??"provider_failed",t);return`Could not read ${t} sessions: ${n}. ${s}`}if("unsupported"===e.outcome)return`Past sessions are not available for ${t}.`;let n=1===e.imported?"session":"sessions",s=`Loaded ${e.imported} ${n}`;return e.rejected_out_of_scope>0&&(s+=`, ${e.rejected_out_of_scope} outside the scope`),e.complete||(s+=", more remain"),`${s}.`},"runtimeLabel",0,function(e){return e.agent.transport?`${e.agent.adapter} \xb7 ${e.agent.transport}`:e.agent.adapter},"sessionOriginChips",0,function(e){let t=[],n=e.origin.work_request?.requester;return n?.kind==="person"?t.push("Human origin"):n?.kind==="bot"?t.push(n.name?`${n.name} Agent`:"Agent origin"):n?.kind==="service"&&t.push("Service origin"),e.origin.conversation&&t.push(e.origin.conversation.label),[...new Set(t)]},"sessionStateTags",0,function(e){let t=[];return(e.home&&t.push("Home"),e.state?.availability==="missing")?[...t,"Missing"]:(e.state?.lifecycle==="archived"&&t.push("Archived"),e.state?.busy&&t.push("Busy"),(e.resumable||e.state?.resumable===!0)&&t.push("Resumable"),t)},"sessionUsageLine",0,function(e){let t=u("input_tokens",e?.input_tokens),n=u("output_tokens",e?.output_tokens),a=u("cost_usd",e?.cost_usd),r=[t,n,a];if(r.every(e=>"unavailable"===e.quality))return{text:s,label:"Usage: not reported",quality:"unavailable",partial:!1};let i=["unavailable"===t.quality?"input not reported":`${t.text} in`,"unavailable"===n.quality?"output not reported":`${n.text} out`,"unavailable"===a.quality?"cost not reported":a.text].join(" · "),o=r.some(e=>"partial"===e.quality),l=o||r.some(e=>"unavailable"===e.quality)?"partial":"complete";return{text:i,label:`Reported usage: ${r.map(e=>e.label).join("; ")}`,quality:l,partial:o}},"statusLabel",0,function(e){return"active"===e.status?"Active":"Ended"},"usageMetricView",0,u,"usageSampleLabel",0,function(e,t){let n="turn"===e.kind?"start"===e.turn_kind?"provider turn, started":"provider turn":"resume"===e.turn_kind?"resumed":"started";return`Run ${t+1} \xb7 ${n}`},"usageSampleValues",0,function(e){return{input:null===e.input_tokens?s:i(e.input_tokens),output:null===e.output_tokens?s:i(e.output_tokens),cost:null===e.cost_usd?s:o(e.cost_usd)}},"workRequestLabel",0,function(e){var t;let n=e.origin.work_request;return n?`${(t=n.execution_kind)?t[0].toUpperCase()+t.slice(1):t} \xb7 ${n.state}`:null},"workspaceFolderName",0,n,"workspaceOptions",0,function(e){let t=[...new Set(e.filter(e=>"string"==typeof e&&e.length>0))],a=t.map(e=>n(e)??e);return t.map((e,t)=>({value:e,label:a.filter(e=>e===a[t]).length>1?e:a[t]})).sort((e,t)=>e.label<t.label?-1:+(e.label>t.label))}],63352);let h={ask:"Ask from this context",resume:"Resume work here",handoff:"Hand off to…"},g=["queued","extracting","delivering","completed","failed","cancelled"],f=["completed","failed","cancelled"];function m(e,t){switch(t){case"queued":return"Queued";case"extracting":return"ask"===e?"Asking the session":"Extracting handoff";case"delivering":return"Delivering handoff";case"completed":return"ask"===e?"Answered":"Handed off";case"failed":return"Failed";case"cancelled":return"Cancelled"}}function p(e,t=140){let n=String(e??"").split("\n").map(e=>e.trim()).filter(e=>e.length>0).join(" ");return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function v(e,t){return t.updated_at-e.updated_at||t.created_at-e.created_at||(e.id<t.id?-1:+(e.id>t.id))}e.s(["DEFAULT_LEDGER_FILTER",0,{mode:"all",state:"all",agentId:""},"INSTRUCTION_LIMIT",0,4e3,"MODE_FILTER_OPTIONS",0,[{value:"all",label:"All"},{value:"ask",label:"Ask"},{value:"continue",label:"Continue"}],"STATE_FILTER_OPTIONS",0,[{value:"all",label:"Any status"},{value:"active",label:"In progress"},{value:"queued",label:"Queued"},{value:"extracting",label:"Asking / extracting"},{value:"delivering",label:"Delivering"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"},{value:"cancelled",label:"Cancelled"}],"detailsHref",0,function(e){return`/exchanges?id=${encodeURIComponent(e)}`},"eventLabel",0,function(e,t){let n=e.data??{},a=t.source.agent_name,s=t.destination?.agent_name??"the destination Agent",r="string"==typeof n.hop?n.hop:null;switch(e.type){case"created":return"ask"===t.mode?`You asked ${a}'s session a question`:`You handed ${a}'s session to ${s}`;case"hop_queued":if("deliver"===r)return`Handoff queued for ${s}'s new session`;return"extract"===r?`Handoff extraction queued in ${a}'s session`:`Question queued for ${a}'s session`;case"hop_started":if("deliver"===r)return`${s} started a new session`;return"extract"===r?`${a}'s session started extracting the handoff`:`${a}'s session started answering`;case"state_changed":{let e="string"==typeof n.to&&g.includes(n.to)?n.to:null;return e?`Now ${m(t.mode,e).toLowerCase()}`:"State changed"}case"answer_returned":return`Answer returned to ${t.origin?.label??"the origin thread"}${n.truncated?" (shortened)":""}`;case"packet_extracted":return"Handoff packet extracted";case"packet_rejected":return`Handoff packet refused${"string"==typeof n.reason?`: ${n.reason}`:""}`;case"destination_replied":return`${s} replied in ${t.destination?.conversation?.label??"its thread"}`;case"destination_session_rejected":return`${s}'s session was not new; the handoff stopped`;case"cancel_requested":return"You asked to cancel";case"hop_result_discarded":return"A late result was discarded";default:return e.type.replace(/_/g," ")}},"excerpt",0,p,"exchangeRequestBody",0,function(e,t,n){let a={mode:e.mode,idempotency_key:n,origin_conversation_id:e.originConversationId,source:{agent_id:t.agentId,session_ref:t.sessionRef},instruction:e.instruction.trim()};return"continue"===e.mode&&(a.destination={agent_id:e.destinationAgentId}),a},"failureAdvice",0,function(e){if("failed"!==e.state)return null;switch(e.failure?.code){case"packet_invalid":case"packet_missing":return"The source session did not return a usable handoff. Start a new Continue with a clearer objective.";case"destination_session_invalid":return"The destination did not start a fresh session. Check its runtime, then start a new Continue.";case"destination_turn_failed":return"Check the destination Agent’s runtime, then start a new Continue from the source session.";case"source_turn_failed":return"Check the source Agent’s runtime, then start a new exchange from its Sessions.";default:return"Start a new exchange from the session to try again."}},"formatExchangeTime",0,function(e){return t(e)},"instructionHeading",0,function(e){return"ask"===e?"Question":"Objective"},"ledgerAgents",0,function(e){let t=new Map;for(let n of e)t.set(n.source.agent_id,n.source.agent_name),n.destination&&t.set(n.destination.agent_id,n.destination.agent_name);return[...t.entries()].map(([e,t])=>({id:e,name:t})).sort((e,t)=>e.name.localeCompare(t.name)||e.id.localeCompare(t.id))},"ledgerRows",0,function(e,t){return e.filter(e=>("all"===t.mode||e.mode===t.mode)&&("active"!==t.state||!e.terminal)&&("all"===t.state||"active"===t.state||e.state===t.state)&&(!t.agentId||e.source.agent_id===t.agentId||e.destination?.agent_id===t.agentId)).sort(v)},"ledgerView",0,function(e,t,n){return null===e?t?"error":"loading":0===e.length?"empty":0===n.length?"filtered-out":"rows"},"linkRoleLabel",0,function(e){let t={origin:"Started here",source:"Source session",destination:"Destination"};return e.map(e=>t[e]).join(" · ")},"liveStateLabel",0,function(e){var t;return e.cancel_requested&&(t=e.state,!f.includes(t))?"Cancelling…":m(e.mode,e.state)},"modeLabel",0,function(e){return"ask"===e?"Ask":"Continue"},"outcomeLine",0,function(e){if("completed"===e.state){if("ask"===e.mode){let t=e.origin?.label??"the origin thread";return e.outcome.answer?`Answer in ${t}: ${p(e.outcome.answer,200)}`:`Answered in ${t}.`}let t=e.destination?.agent_name??"The destination Agent";return e.outcome.reply?`${t} picked it up in a new session: ${p(e.outcome.reply,200)}`:`${t} picked it up in a new session.`}return"failed"===e.state?e.failure?.message||"The exchange failed.":"cancelled"===e.state?"Cancelled before it finished. Nothing more will run.":null},"participantsLabel",0,function(e){return"ask"===e.mode?`You → ${e.source.agent_name}`:`${e.source.agent_name} → ${e.destination?.agent_name??"another Agent"}`},"pinRequestBody",0,function(e,t,n,a,s){return{action:e,content:t.trim(),conversation_id:n,idempotency_key:s,..."resume"===e?{approve_write:a}:{}}},"sessionDialogMode",0,function(e){return"handoff"===e?"continue":e},"sessionDialogTitle",0,function(e){return h["continue"===e?"handoff":e]},"sessionDialogUsesPin",0,function(e,t){return"resume"===e||"ask"===e&&"provider"===t},"sessionLabel",0,function(e){return`${e.source.agent_name}'s session “${e.source.session_title}”`},"sessionRowActions",0,function(e){let t;if(e.actions)t=e.actions;else{let n="ended"===e.status?{available:!1,reason:"Ask from this context and Hand off to… are unavailable: this session has ended. Its history stays here."}:e.resumable?{available:!0}:{available:!1,reason:`Ask from this context and Hand off to… are unavailable: Botmancers can’t resume this session under ${e.agent.name}’s current runtime.`},a=n.available?{available:!0}:{available:!1,code:"ended"===e.status?"session_ended":"session_not_resumable",reason:n.reason,recovery:"choose_session"};t={ask:a,resume:{available:!1,code:"action_unavailable",reason:`${h.resume} is unavailable: this runtime can’t resume a session with edits.`,recovery:"choose_action"},handoff:a}}return["ask","resume","handoff"].map(e=>({action:e,label:h[e],availability:t[e]}))},"stateTone",0,function(e){return"completed"===e?"done":"failed"===e||"cancelled"===e?"stopped":"active"},"submitErrorMessage",0,function(e,t){switch(e){case"session_ended":return"This session has ended and can’t be resumed.";case"session_not_resumable":return"Botmancers can’t resume this session under the Agent’s current runtime.";case"source_session_busy":return"This session already has an exchange in progress. Wait for it or cancel it from its card.";case"agent_unavailable":return t||"That Agent can’t launch yet. Choose its runtime connection and session scope in Config.";case"idempotency_conflict":return"This request changed while it was being sent. Send again.";case"session_missing":return"The runtime no longer has this session. Its history stays here; choose another session.";case"approval_required":return"Resume work here needs your approval of edits. Tick the approval, then send again.";case"authority_not_allowed":return t||"This Agent’s policy doesn’t allow edits in a resumed session. Change it in Config.";case"action_unavailable":return t||"This runtime can’t do that in this session. Choose another action.";case"provider_failed":return"The runtime failed this turn. Nothing moved to another session; try again later.";default:return t||"The exchange could not be started. Your draft is kept; try again."}},"threadHref",0,function(e,t){let n=new URLSearchParams;if(e.thread_agent_id){t&&n.set("exchange",t);let a=n.toString();return`/agents/${encodeURIComponent(e.thread_agent_id)}/conversations/${encodeURIComponent(e.id)}${a?`?${a}`:""}`}if("group"!==e.kind)return null;t&&n.set("exchange",t);let a=n.toString();return`/threads/${encodeURIComponent(e.id)}${a?`?${a}`:""}`},"validateDraft",0,function(e){let t={},n=e.instruction.trim(),a="ask"===e.mode?"a question":"an objective";return n?e.instruction.length>4e3&&(t.instruction="Keep it under 4000 characters."):t.instruction=`Enter ${a}.`,e.originConversationId||(t.origin="Choose the thread that follows this exchange."),"continue"!==e.mode||e.destinationAgentId||(t.destination="Choose the Agent who continues the work."),t},"validateResumeDraft",0,function(e,t){let n={};return e.trim()?e.length>4e3&&(n.instruction="Keep it under 4000 characters."):n.instruction="Enter what to work on.",t||(n.approval="Approve edits in this session to resume work here."),n}],50814)},24204,e=>{"use strict";var t=e.i(63352),n=e.i(50814);function a(e){return"active"===e.state}let s=/^T[A-Z0-9]{2,20}$/,r=/^[CG][A-Z0-9]{2,20}$/;e.s(["SHARE_DURATIONS",0,[{label:"5 minutes",seconds:300},{label:"1 hour",seconds:3600},{label:"8 hours",seconds:28800},{label:"24 hours",seconds:86400}],"SHARE_STATUS_LABELS",0,{active:"Active",exhausted:"Questions used",answering:"Answering",recovering:"Recovering",expired:"Expired",revoked:"Revoked"},"audienceInputError",0,function(e,t,n){let a=e.trim(),i=t.trim();return s.test(a)?r.test(i)?n.some(e=>e.team_id===a&&e.channel_id===i)?"That channel is already on the allowlist.":null:"Channel ID must look like C0123ABCD (a public or private channel ID; no wildcards).":"Workspace ID must look like T0123ABCD (a Slack team ID; no wildcards)."},"audienceLabel",0,function(e){return`Slack channel ${e.channel_id} \xb7 workspace ${e.team_id}`},"createdByLabel",0,function(e){return"owner"===e.created_by?"Shared by you":"current_session"===e.created_by?"Shared from a turn of this session":"Shared by a service"},"expiryLabel",0,function(e,n=Date.now()){return"revoked"===e.state?`Revoked ${(0,t.formatSessionDate)(e.revoked_at??e.expires_at)}`:"expired"===e.state||e.expires_at<=n?`Expired ${(0,t.formatSessionDate)(e.expires_at)}`:`Expires ${(0,t.formatSessionDate)(e.expires_at)} (in ${function(e){let t=Math.max(1,Math.round(e/6e4));if(t<60)return`${t} min`;let n=Math.floor(t/60),a=t%60;return a?`${n} h ${a} min`:`${n} h`}(e.expires_at-n)})`},"sessionShares",0,function(e,t){let n=e.filter(e=>e.session_ref===t);return[...n.filter(a).sort((e,t)=>t.created_at-e.created_at),...n.filter(e=>!a(e)).sort((e,t)=>(t.revoked_at??t.expires_at)-(e.revoked_at??e.expires_at))]},"shareCreateAvailability",0,function(e,t){let a=`/bots/${encodeURIComponent(e.agent.id)}/config#session-sharing`;if(!t)return{available:!1,reason:"Share to Slack is unavailable: the share policy could not be loaded.",configHref:null};let s=(0,n.sessionRowActions)(e).find(e=>"ask"===e.action);return s&&!s.availability.available?{available:!1,reason:s.availability.reason.replace(/^Ask from this context is unavailable:/,"Share to Slack is unavailable:"),configHref:null}:"invalid"===t.state?{available:!1,reason:"Share to Slack is unavailable: the share policy file is invalid. Fix it in Config.",configHref:a}:0===t.audiences.length?{available:!1,reason:"Share to Slack needs a Slack channel on the share allowlist. Add one in Config.",configHref:a}:{available:!0}},"shareCreateBody",0,function(e,t,n,a){return{audience:{team_id:e.team_id,channel_id:e.channel_id},ttl_seconds:t,max_turns:n,idempotency_key:a}},"shareFromTurnNote",0,function(e){return e.agent.share_current.supported?e.agent.share_from_turn?"On: a turn Botmancers launches for this Agent can share its own session to an allowlisted channel. Turning it off revokes every live turn context at once.":"Off: no turn of this Agent can share its own session. Sessions can still be shared from the Agent Sessions page.":e.agent.share_current.reason??"This runtime cannot share its own session from a turn."},"shareIsLive",0,a,"shareStatusNote",0,function(e){switch(e.status){case"active":return"Slack replies in its thread ask this session (read-only).";case"answering":return"A Slack question is being answered now. The next one waits until it finishes.";case"recovering":return"A question was interrupted by a Botmancers restart. The next Slack question clears it.";case"exhausted":return`All ${e.max_turns} questions are used. Slack questions get the limit notice; create a new share to keep going.`;case"expired":return"Expired: Slack questions get the expired notice. Its history stays here.";case"revoked":return"Revoked: Slack questions get the revoked notice. Its history stays here."}},"threadLabel",0,function(e){return e.thread.posted?`Slack thread posted ${(0,t.formatSessionDate)(e.thread.posted_at??0)}`:"active"===e.state?"Waiting for the Slack relay to post the thread":"No Slack thread was posted"},"turnsLabel",0,function(e){return`${e.turns_used} of ${e.max_turns} question${1===e.max_turns?"":"s"} used`}])}]);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,49816,e=>{"use strict";var s=e.i(43476),a=e.i(22016),n=e.i(71645),t=e.i(18566),l=e.i(63352),i=e.i(3136),r=e.i(71836),o=e.i(50814);function c({mode:e,session:a,agents:t,origin:i,onClose:d,onStarted:u}){let h=(0,n.useId)(),m=(0,n.useId)(),p=(0,n.useId)(),x=(0,n.useId)(),[g,j]=(0,n.useState)(""),[f,b]=(0,n.useState)(""),[v,y]=(0,n.useState)(!1),[N,S]=(0,n.useState)({}),[k,w]=(0,n.useState)(""),[C,$]=(0,n.useState)(!1),R=(0,n.useRef)(!1),_=(0,n.useRef)(null),I=(0,n.useRef)(null),A=(0,n.useRef)(null),T=(0,n.useRef)(null),L=(0,n.useRef)(null),U=(0,o.sessionDialogUsesPin)(e,a.route),E=t.filter(e=>e.id!==a.agent.id);(0,n.useEffect)(()=>{("continue"===e?T.current:A.current)?.focus()},[e]),(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(e.stopPropagation(),d())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[d]);let O=async s=>{if(s.preventDefault(),R.current)return;let n={mode:"resume"===e?"ask":e,instruction:g,originConversationId:i.conversationId,destinationAgentId:f},t="resume"===e?(0,o.validateResumeDraft)(g,v):(0,o.validateDraft)(n);if(S(t),Object.keys(t).length>0)return void(t.destination?T.current?.focus():t.instruction?A.current?.focus():L.current?.focus());let l="resume"===e?"resume":"ask",r=e=>U?(0,o.pinRequestBody)(l,g,i.conversationId,v,e):(0,o.exchangeRequestBody)(n,{agentId:a.agent.id,sessionRef:a.ref},e),c=JSON.stringify(r(""));_.current&&_.current.payload===c||(_.current={payload:c,key:crypto.randomUUID()}),R.current=!0,$(!0),w("");try{let e=U?`/api/bots/${encodeURIComponent(a.agent.id)}/sessions/${encodeURIComponent(a.ref)}/pins`:"/api/exchanges",s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r(_.current.key))}),n=await s.json().catch(()=>null);if(!s.ok){let e="string"==typeof n?.error?.code?n.error.code:null;"idempotency_conflict"===e&&(_.current=null),w((0,o.submitErrorMessage)(e,"string"==typeof n?.error?.message?n.error.message:null));return}let t=U?n?.turn?.exchange_id:n?.exchange?.id;u("string"==typeof t?t:null)}catch{w((0,o.submitErrorMessage)(null,"Botmancers could not be reached. Your draft is kept; try again."))}finally{R.current=!1,$(!1)}},D=E.find(e=>e.id===f)?.name,F="ask"===e,P="resume"===e;return(0,s.jsx)("div",{className:"modal-scrim exchange-scrim",onMouseDown:e=>{e.target===e.currentTarget&&d()},onKeyDown:e=>{if("Tab"!==e.key||!I.current)return;let s=Array.from(I.current.querySelectorAll(r.DIALOG_FOCUSABLE)),a=(0,r.wrapFocusTarget)(s,document.activeElement,e.shiftKey);a&&(e.preventDefault(),a.focus())},children:(0,s.jsxs)("div",{ref:I,className:"form-card exchange-dialog",role:"dialog","aria-modal":"true","aria-labelledby":h,"data-exchange-mode":e,children:[(0,s.jsx)("h2",{id:h,className:"delete-title",children:(0,o.sessionDialogTitle)(e)}),(0,s.jsxs)("section",{className:"exchange-source","aria-label":"Source session",children:[(0,s.jsx)("p",{className:"exchange-source-agent",children:a.agent.name}),(0,s.jsx)("p",{className:"exchange-source-title",children:a.title}),(0,s.jsxs)("p",{className:"exchange-source-meta",children:["Last activity ",(0,l.formatSessionDate)(a.last_activity_at),a.origin.conversation?` \xb7 from ${a.origin.conversation.label}`:""]})]}),(0,s.jsxs)("form",{onSubmit:O,noValidate:!0,className:"exchange-form",children:[F||P?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("label",{htmlFor:p,children:"Hand off to"}),(0,s.jsxs)("select",{ref:T,id:p,className:"exchange-select",value:f,"aria-invalid":!!N.destination||void 0,"aria-describedby":N.destination?`${p}-error`:void 0,disabled:C,onChange:e=>{b(e.target.value),S(e=>({...e,destination:void 0}))},children:[(0,s.jsx)("option",{value:"",children:"Choose an Agent"}),E.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]}),N.destination?(0,s.jsx)("p",{id:`${p}-error`,className:"exchange-field-error",children:N.destination}):null]}),(0,s.jsx)("label",{htmlFor:m,children:F?"Question":P?"Instruction":"Objective"}),(0,s.jsx)("textarea",{ref:A,id:m,rows:4,maxLength:o.INSTRUCTION_LIMIT,value:g,readOnly:C,"aria-invalid":!!N.instruction||void 0,"aria-describedby":`${m}-hint${N.instruction?` ${m}-error`:""}`,onChange:e=>{j(e.target.value),S(e=>({...e,instruction:void 0}))}}),N.instruction?(0,s.jsx)("p",{id:`${m}-error`,className:"exchange-field-error",children:N.instruction}):null,(0,s.jsx)("p",{id:`${m}-hint`,className:"exchange-hint",children:F?`${a.agent.name} answers from this exact session, read-only. The answer arrives in ${i.label}.`:P?`${a.agent.name} resumes work in this exact session and may edit its workspace. The turn never moves to another session. Progress shows in ${i.label}.`:`${D??"The Agent you choose"} receives an extracted handoff (objective, decisions, constraints, references, open questions) and starts a new session of its own. ${a.agent.name}’s session is not shared and is not changed. Progress shows in ${i.label}.`}),P?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("label",{className:"exchange-approval",htmlFor:x,children:[(0,s.jsx)("input",{ref:L,id:x,type:"checkbox",checked:v,disabled:C,"aria-invalid":!!N.approval||void 0,"aria-describedby":N.approval?`${x}-error`:void 0,onChange:e=>{y(e.target.checked),S(e=>({...e,approval:void 0}))}})," ","I approve edits by ",a.agent.name," in this session"]}),N.approval?(0,s.jsx)("p",{id:`${x}-error`,className:"exchange-field-error",children:N.approval}):null]}):null,k?(0,s.jsx)("p",{className:"exchange-server-error",role:"alert",children:k}):null,(0,s.jsx)("p",{className:"exchange-sending",role:"status",children:C?"Sending…":""}),(0,s.jsxs)("div",{className:"form-actions",children:[(0,s.jsx)("button",{type:"button",className:"cancel-btn",onClick:d,children:"Cancel"}),(0,s.jsx)("button",{type:"submit",className:"create-btn",disabled:C,"aria-disabled":C,children:k?"Try again":"Send"})]})]})]})})}var d=e.i(24204);function u(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?`owner-share-${crypto.randomUUID()}`:`owner-share-${Date.now()}-${Math.random().toString(36).slice(2)}`}function h({row:e,shares:t,policy:l,onChanged:i}){let r=(0,n.useId)(),[o,c]=(0,n.useState)(!1),[u,x]=(0,n.useState)(!1),g=t?(0,d.sessionShares)(t,e.ref):[],j=g.filter(d.shareIsLive),f=g.filter(e=>!(0,d.shareIsLive)(e)),b="loading"===l,v="loading"===l?null:l,y=b?null:(0,d.shareCreateAvailability)(e,v),N=u?f:f.slice(0,3*!j.length);return(0,s.jsxs)("section",{className:"session-shares","aria-labelledby":r,"data-session-shares":e.ref,children:[(0,s.jsxs)("div",{className:"session-shares-head",children:[(0,s.jsx)("h3",{id:r,className:"session-shares-title",children:"Slack share"}),y?.available&&!o?(0,s.jsx)("button",{type:"button",className:"session-action","data-share-action":"create",onClick:()=>c(!0),children:"Share to Slack"}):null]}),b?(0,s.jsx)("p",{className:"session-share-note session-share-loading",role:"status",children:"Checking the share policy…"}):null,y&&!y.available?(0,s.jsxs)("p",{className:"session-share-unavailable",children:[y.reason," ",y.configHref?(0,s.jsx)(a.default,{className:"session-link",href:y.configHref,children:"Open Config"}):null]}):null,o&&v?(0,s.jsx)(p,{row:e,policy:v,onCancel:()=>c(!1),onCreated:()=>{c(!1),i()}}):null,null===t?(0,s.jsx)("p",{className:"session-share-note",role:"status",children:"Loading shares…"}):null,null===t||0!==g.length||o?null:(0,s.jsx)("p",{className:"session-share-note",children:"Not shared."}),j.length+N.length>0?(0,s.jsx)("ul",{className:"session-share-list","aria-label":`Slack shares of ${e.title}`,children:[...j,...N].map(e=>(0,s.jsx)(m,{share:e,onChanged:i},e.share_ref))}):null,f.length>N.length?(0,s.jsxs)("button",{type:"button",className:"pin-word",onClick:()=>x(!0),children:["Show ",f.length-N.length," ended share",f.length-N.length==1?"":"s"]}):null]})}function m({share:e,onChanged:a}){let[t,l]=(0,n.useState)(!1),[i,r]=(0,n.useState)(!1),[o,c]=(0,n.useState)(""),[u,h]=(0,n.useState)(!1),p=(0,d.shareIsLive)(e),x=async()=>{try{await navigator.clipboard.writeText(e.share_ref),h(!0)}catch{c("Copy failed. Select the reference instead.")}},g=async()=>{r(!0),c("");try{let s=await fetch(`/api/shares/${encodeURIComponent(e.share_ref)}/revoke`,{method:"POST"}),n=await s.json().catch(()=>null);s.ok?(l(!1),a()):c("string"==typeof n?.error?.message?n.error.message:"The share could not be revoked.")}catch{c("The share could not be revoked.")}finally{r(!1)}};return(0,s.jsxs)("li",{className:`session-share is-${e.status}`,"data-share-ref":e.share_ref,"data-share-status":e.status,children:[(0,s.jsxs)("div",{className:"session-share-head",children:[(0,s.jsx)("span",{className:`manage-tag session-share-status is-${e.status}`,children:d.SHARE_STATUS_LABELS[e.status]}),(0,s.jsx)("span",{className:"session-share-audience",children:(0,d.audienceLabel)(e.audience)})]}),(0,s.jsxs)("dl",{className:"manage-meta session-share-meta",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Expiry"}),(0,s.jsx)("dd",{children:(0,d.expiryLabel)(e)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Questions"}),(0,s.jsx)("dd",{children:(0,d.turnsLabel)(e)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Thread"}),(0,s.jsx)("dd",{children:(0,d.threadLabel)(e)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Reference"}),(0,s.jsx)("dd",{children:(0,s.jsx)("code",{className:"session-share-ref",children:e.share_ref})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Origin"}),(0,s.jsxs)("dd",{children:[(0,d.createdByLabel)(e)," · read-only Ask"]})]})]}),(0,s.jsx)("p",{className:"session-share-note",children:(0,d.shareStatusNote)(e)}),(0,s.jsxs)("div",{className:"session-actions",role:"group","aria-label":"Share actions",children:[(0,s.jsx)("button",{type:"button",className:"pin-word","data-share-action":"copy",onClick:()=>{x()},children:u?"Copied":"Copy reference"}),p&&!t?(0,s.jsx)("button",{type:"button",className:"session-action session-share-revoke","data-share-action":"revoke",onClick:()=>l(!0),children:"Revoke"}):null]}),t?(0,s.jsxs)("div",{className:"session-share-confirm",role:"group","aria-label":"Confirm revoke",children:[(0,s.jsx)("p",{children:"Revoke this share? The next Slack question in its thread gets the revoked notice. This can’t be undone."}),(0,s.jsxs)("div",{className:"session-actions",children:[(0,s.jsx)("button",{type:"button",className:"session-action session-share-revoke","data-share-action":"confirm-revoke",disabled:i,onClick:()=>{g()},children:i?"Revoking…":"Revoke share"}),(0,s.jsx)("button",{type:"button",className:"pin-word",disabled:i,onClick:()=>l(!1),children:"Keep it"})]})]}):null,o?(0,s.jsx)("p",{className:"delete-error",role:"alert",children:o}):null]})}function p({row:e,policy:a,onCancel:t,onCreated:l}){let i={channel:(0,n.useId)(),duration:(0,n.useId)(),turns:(0,n.useId)()},[r,o]=(0,n.useState)(0),[c,h]=(0,n.useState)(a.limits.ttl_seconds.default),[m,x]=(0,n.useState)(String(a.limits.max_turns.default)),[g]=(0,n.useState)(u),[j,f]=(0,n.useState)(!1),[b,v]=(0,n.useState)(""),y=Number(m),N=Number.isInteger(y)&&y>=a.limits.max_turns.min&&y<=a.limits.max_turns.max,S=async s=>{if(s.preventDefault(),N){f(!0),v("");try{let s=await fetch(`/api/bots/${encodeURIComponent(e.agent.id)}/sessions/${encodeURIComponent(e.ref)}/shares`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify((0,d.shareCreateBody)(a.audiences[r],c,y,g))}),n=await s.json().catch(()=>null);s.ok?l():v("string"==typeof n?.error?.message?n.error.message:"The share could not be created.")}catch{v("The share could not be created.")}finally{f(!1)}}};return(0,s.jsxs)("form",{className:"session-share-form",onSubmit:e=>{S(e)},"aria-label":`Share ${e.title} to Slack`,children:[(0,s.jsxs)("p",{className:"session-share-note",children:["Shares ",(0,s.jsx)("strong",{children:e.title})," (",e.agent.name,") as a read-only Ask: Slack replies in the share’s thread ask exactly this session."]}),(0,s.jsx)("label",{htmlFor:i.channel,children:"Slack channel"}),(0,s.jsx)("select",{id:i.channel,value:r,onChange:e=>o(Number(e.target.value)),disabled:j,children:a.audiences.map((e,a)=>(0,s.jsx)("option",{value:a,children:(0,d.audienceLabel)(e)},`${e.team_id}:${e.channel_id}`))}),(0,s.jsx)("label",{htmlFor:i.duration,children:"Expires after"}),(0,s.jsx)("select",{id:i.duration,value:c,onChange:e=>h(Number(e.target.value)),disabled:j,children:d.SHARE_DURATIONS.map(e=>(0,s.jsx)("option",{value:e.seconds,children:e.label},e.seconds))}),(0,s.jsx)("label",{htmlFor:i.turns,children:"Questions allowed"}),(0,s.jsx)("input",{id:i.turns,type:"number",inputMode:"numeric",min:a.limits.max_turns.min,max:a.limits.max_turns.max,value:m,onChange:e=>x(e.target.value),disabled:j,"aria-invalid":!N}),N?null:(0,s.jsxs)("p",{className:"delete-error",children:["Questions allowed must be a whole number from ",a.limits.max_turns.min," to ",a.limits.max_turns.max,"."]}),b?(0,s.jsx)("p",{className:"delete-error",role:"alert",children:b}):null,(0,s.jsxs)("div",{className:"session-actions",children:[(0,s.jsx)("button",{type:"submit",className:"session-action","data-share-action":"submit",disabled:j||!N,children:j?"Sharing…":"Create share"}),(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:t,disabled:j,children:"Cancel"})]})]})}function x(e,s,a,n,t){let l=new URLSearchParams({status:s}),i=a.trim();return i&&l.set("q",i),n&&l.set("workspace",n),t&&l.set("cursor",t),`/api/bots/${encodeURIComponent(e)}/sessions?${l.toString()}`}function g({agentId:e,agentName:r,agentProvider:d,agents:u,origin:h,onExchangeStarted:m}){let p=(0,t.useRouter)(),b=(0,t.useSearchParams)().get("session"),[v,y]=(0,n.useState)("all"),[N,S]=(0,n.useState)(null),[k,w]=(0,n.useState)(null),[C,$]=(0,n.useState)(!1),[R,_]=(0,n.useState)(""),[I,A]=(0,n.useState)(""),[T,L]=(0,n.useState)(0),[U,E]=(0,n.useState)(""),[O,D]=(0,n.useState)(""),[F,P]=(0,n.useState)([]),[q,B]=(0,n.useState)(null),[M,H]=(0,n.useState)(!1),[K,V]=(0,n.useState)(""),[Q,J]=(0,n.useState)(null),[W,G]=(0,n.useState)(null),[Y,z]=(0,n.useState)(null),[X,Z]=(0,n.useState)(null),[ee,es]=(0,n.useState)("loading"),[ea,en]=(0,n.useState)(0),et=(0,n.useRef)(0),el=(0,n.useRef)(""),ei=(0,n.useRef)(""),er=(0,n.useRef)(null),eo=(0,n.useRef)(null),ec=(0,n.useRef)(null),ed=(0,n.useRef)(!1),eu=(0,n.useRef)(null),eh=d&&(0,i.agentLabel)(d)||void 0;(0,n.useEffect)(()=>{et.current+=1;let s=et.current,a=`${e}
|
|
2
|
+
${v}`,n=ei.current!==a;ei.current=a;let t=250*(U!==el.current);el.current=U;let l=!1,i=setTimeout(()=>{fetch(x(e,v,U,O,null),{cache:"no-store"}).then(async a=>{let t=await a.json().catch(()=>null);if(l||et.current!==s)return;if(!a.ok||!Array.isArray(t?.sessions))return void A("string"==typeof t?.error?t.error:"Could not load sessions.");let i=t.sessions;S(i),w(t?.sync&&"object"==typeof t.sync?t.sync:null),B("string"==typeof t?.next_cursor?t.next_cursor:null),V(`${e}
|
|
3
|
+
${v}
|
|
4
|
+
${U.trim()}
|
|
5
|
+
${O}`),A("");let r=i.map(e=>e.context.workspace).filter(e=>!!e);P(e=>[...new Set([...n?[]:e,...r])])}).catch(()=>{l||et.current!==s||A("Could not load sessions.")})},t);return()=>{l=!0,clearTimeout(i)}},[e,v,U,O,T]),(0,n.useEffect)(()=>{if(!b||null===N)return;if(N.some(e=>e.ref===b)){eu.current!==b&&(eu.current=b,requestAnimationFrame(()=>requestAnimationFrame(()=>{document.querySelector(`[data-session-ref="${CSS.escape(b)}"]`)?.scrollIntoView({block:"nearest"})})));return}if("all"!==v||U.trim()||O)return;let s=!1;return fetch(`/api/bots/${encodeURIComponent(e)}/sessions/${encodeURIComponent(b)}`,{cache:"no-store"}).then(async e=>{let a=await e.json().catch(()=>null);if(s||!e.ok||!a?.session)return;let n=a.session;S(e=>!e||e.some(e=>e.ref===n.ref)?e:[n,...e])}).catch(()=>{}),()=>{s=!0}},[b,N,e,v,U,O]),(0,n.useEffect)(()=>{N&&(b&&N.some(e=>e.ref===b)?J(b):J(null))},[b,N]),(0,n.useEffect)(()=>{!N||!b||N.some(e=>e.ref===b)||("all"!==v||U.trim()||O)&&p.replace(`/agents/${encodeURIComponent(e)}/sessions`,{scroll:!1})},[N,b,v,U,O,e,p]),(0,n.useEffect)(()=>{if(!Q){let e=eo.current;if(!e||ed.current)return;eo.current=null,e.isConnected&&e.focus();return}ed.current&&(ed.current=!1,ec.current?.focus())},[Q]);let em=`${e}
|
|
6
|
+
${v}
|
|
7
|
+
${U.trim()}
|
|
8
|
+
${O}`,ep=null!==q&&K===em,ex=(0,n.useCallback)(async()=>{if(M||!N||!q||K!==em)return;H(!0);let s=et.current;try{let a=await fetch(x(e,v,U,O,q),{cache:"no-store"}),n=await a.json().catch(()=>null);if(et.current!==s)return;if(!a.ok||!Array.isArray(n?.sessions))return void A("Could not load more sessions.");let t=n.sessions,l=new Set(N.map(e=>e.ref));S([...N,...t.filter(e=>!l.has(e.ref))]),B("string"==typeof n?.next_cursor?n.next_cursor:null),A("");let i=t.map(e=>e.context.workspace).filter(e=>!!e);i.length&&P(e=>[...new Set([...e,...i])])}catch{et.current===s&&A("Could not load more sessions.")}finally{H(!1)}},[e,v,U,O,M,N,q,em,K]),eg=(0,n.useCallback)(async()=>{if(!C){$(!0),_("");try{let s=await fetch(`/api/bots/${encodeURIComponent(e)}/sessions/sync`,{method:"POST"}),a=await s.json().catch(()=>null);if(409===s.status)_("A sync is already running.");else if(s.ok){let e=Array.isArray(a?.imported)?a.imported.length:0,s=Array.isArray(a?.updated)?a.updated.length:0;_(`Synced: ${e} imported, ${s} updated.`)}else _("Could not sync sessions.")}catch{_("Could not sync sessions.")}finally{$(!1),L(e=>e+1)}}},[e,C]);(0,n.useEffect)(()=>{let s=!1,a=encodeURIComponent(e);return fetch(`/api/bots/${a}/share-policy`,{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{s||es(e?.policy??null)}).catch(()=>{s||es(null)}),fetch(`/api/shares?agent_id=${a}&limit=100`,{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{s||Z(Array.isArray(e?.shares)?e.shares:[])}).catch(()=>{s||Z([])}),()=>{s=!0}},[e,ea]),(0,n.useEffect)(()=>{let e=setInterval(()=>en(e=>e+1),15e3);return()=>clearInterval(e)},[]),(0,n.useEffect)(()=>{if(W||!er.current)return;let e=er.current;er.current=null,e.isConnected&&e.focus()},[W]);let ej=(e=v)=>{S(null),A(""),y(e),L(e=>e+1)},ef=""!==U.trim()||""!==O,eb=N?.find(e=>e.ref===Q)??null,ev=(s,a)=>{eo.current=a,ed.current=!0,p.replace(`/agents/${encodeURIComponent(e)}/sessions?session=${encodeURIComponent(s.ref)}`,{scroll:!1})},ey=()=>{er.current=W?.returnTo??null,G(null)};return(0,s.jsxs)("div",{className:"agent-sessions-page","data-agent-sessions-page":!0,children:[(0,s.jsxs)("header",{className:"agent-sessions-head",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"agent-eyebrow",children:"Sessions"}),(0,s.jsxs)("h2",{children:["Review ",r,"’s work"]}),(0,s.jsx)("p",{children:"Scan runtime sessions, then open one for actions and operational detail."})]}),(0,s.jsxs)("div",{className:"agent-sessions-sync",children:[(0,s.jsxs)("span",{children:["Last synced ",(0,l.formatSyncRelativeTime)(k?.synced_at??null)]}),(0,s.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{eg()},disabled:C,children:C?"Refreshing…":"Refresh"})]})]}),(0,s.jsxs)("div",{className:"sessions-filter",role:"group","aria-label":"Filter sessions",children:[(0,s.jsx)("div",{className:"sessions-status-filter",role:"group","aria-label":"Show sessions",children:l.SESSION_FILTER_OPTIONS.map(e=>(0,s.jsx)("button",{type:"button",className:"sessions-filter-btn","aria-pressed":v===e.value,onClick:()=>{v!==e.value&&ej(e.value)},children:e.label},e.value))}),(0,s.jsx)("input",{type:"search",className:"sessions-search","aria-label":"Search sessions by title",placeholder:"Search by title",value:U,onChange:e=>E(e.target.value)}),(0,s.jsxs)("select",{className:"sessions-workspace","aria-label":"Filter sessions by workspace",value:O,onChange:e=>D(e.target.value),children:[(0,s.jsx)("option",{value:"",children:"All workspaces"}),(0,l.workspaceOptions)(F).map(e=>(0,s.jsx)("option",{value:e.value,title:e.value,children:e.label},e.value))]}),(0,s.jsx)("span",{className:"manage-count","aria-live":"polite",children:N?`${N.length} shown`:""})]}),(0,s.jsx)("div",{className:"exchange-started",role:"status",children:R}),(0,s.jsx)("div",{className:"exchange-started",role:"status",children:Y?(0,s.jsxs)(s.Fragment,{children:[Y.text," ",Y.id?(0,s.jsx)(a.default,{className:"session-link",href:(0,o.detailsHref)(Y.id),children:"View in Exchanges"}):null]}):null}),(0,s.jsxs)("div",{className:`sessions-review${eb?" has-detail":""}`,inert:!!W,children:[(0,s.jsxs)("section",{className:"sessions-list-pane","aria-labelledby":"sessions-list-title",children:[(0,s.jsx)("h3",{id:"sessions-list-title",className:"session-sr",children:"Session list"}),I?(0,s.jsxs)("div",{className:"sessions-state",role:"alert",children:[(0,s.jsx)("p",{className:"delete-error",children:I}),(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:()=>ej(),children:"Retry"})]}):null,N||I?null:(0,s.jsx)("p",{className:"delete-copy sessions-state",role:"status",children:"Loading sessions…"}),N?(0,s.jsxs)("ul",{className:"sessions-list","aria-label":`Sessions for ${r}`,children:[0===N.length?(0,s.jsx)("li",{className:"delete-copy sessions-state",children:ef?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:(0,l.noMatchingSessionsCopy)(U,O||null)}),(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{E(""),D("")},children:"Clear search"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:(0,l.emptySessionsCopy)(v,r,k,eh)}),"all"===v&&k?.last_error_code?(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{eg()},disabled:C,children:C?"Retrying…":"Retry"}):null,"all"===v&&!k?.last_error_code&&(k?.out_of_scope_count??0)>0?(0,s.jsx)(a.default,{className:"session-link",href:`/bots/${encodeURIComponent(e)}/config`,children:"Widen the scope in Config"}):null]})}):null,N.map(e=>(0,s.jsx)(j,{row:e,selected:Q===e.ref,onSelect:ev},e.ref))]}):null,N&&N.length>0&&ep?(0,s.jsx)("div",{className:"sessions-more",children:(0,s.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{ex()},disabled:M,children:M?"Loading…":"Load more"})}):null]}),(0,s.jsx)("section",{className:"sessions-detail-pane","aria-label":"Session detail",children:eb?(0,s.jsx)(f,{row:eb,agentId:e,headingRef:ec,origin:h,agents:u,shares:X,sharePolicy:ee,onClose:()=>{ed.current=!1,p.replace(`/agents/${encodeURIComponent(e)}/sessions`,{scroll:!1})},onAction:(e,s)=>{z(null),G({mode:e,row:eb,returnTo:s})},onSharesChanged:()=>en(e=>e+1)},eb.ref):(0,s.jsxs)("div",{className:"sessions-detail-empty",children:[(0,s.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,s.jsx)("h3",{children:"Select a session"}),(0,s.jsx)("p",{children:"Actions, usage, origin, shares, and debug detail appear here."})]})})]}),W&&h?(0,s.jsx)(c,{mode:W.mode,session:W.row,agents:u,origin:h,onClose:ey,onStarted:e=>{z({id:e,text:"ask"===W.mode?`Asked ${W.row.agent.name}’s session. The answer arrives in ${h.label}.`:"resume"===W.mode?`Resumed work in ${W.row.agent.name}’s session. Progress shows in ${h.label}.`:`Handoff started from ${W.row.agent.name}’s session. Progress shows in ${h.label}.`}),ey(),m?.(e)}}):null]})}function j({row:e,selected:a,onSelect:n}){let t=(0,o.sessionRowActions)(e).filter(e=>e.availability.available).length,i=(0,l.workspaceFolderName)(e.context.workspace),r=(0,l.sessionOriginChips)(e),c=(0,l.sessionStateTags)(e);return(0,s.jsx)("li",{className:`session-scan-row is-${e.status}${a?" is-selected":""}`,"data-session-ref":e.ref,children:(0,s.jsxs)("button",{type:"button",className:"session-scan-button","aria-current":a?"true":void 0,onClick:s=>n(e,s.currentTarget),children:[(0,s.jsxs)("span",{className:"session-scan-title-line",children:[(0,s.jsx)("strong",{className:"session-title",children:e.title}),(0,s.jsx)("span",{className:`manage-tag session-status is-${e.status}`,children:(0,l.statusLabel)(e)})]}),(0,s.jsxs)("span",{className:"session-scan-context",children:[(0,s.jsx)("span",{className:"session-activity",children:(0,l.formatSessionDate)(e.last_activity_at)}),i?(0,s.jsx)("span",{className:"session-workspace",title:e.context.workspace??void 0,children:i}):null]}),r.length||c.length?(0,s.jsxs)("span",{className:"session-scan-chips",children:[r.map(e=>(0,s.jsx)("span",{className:"session-origin-chip",children:e},e)),c.map(e=>(0,s.jsx)("span",{className:`manage-tag session-state-tag is-${e.toLowerCase()}`,children:e},e))]}):null,(0,s.jsx)("span",{className:`session-attention${t?" is-actionable":""}`,children:t?`${t} action${1===t?"":"s"} available`:"Review details"})]})})}function f({row:e,agentId:t,headingRef:i,origin:r,agents:c,shares:d,sharePolicy:u,onClose:m,onAction:p,onSharesChanged:x}){let g,[j,b]=(0,n.useState)(null),[y,N]=(0,n.useState)(null),[S,k]=(0,n.useState)(""),[w,C]=(0,n.useState)(null),[$,R]=(0,n.useState)(""),[_,I]=(0,n.useState)(!1),A=`/api/bots/${encodeURIComponent(t)}/sessions/${encodeURIComponent(e.ref)}`,T=(0,o.sessionRowActions)(e),L=T.filter(e=>e.availability.available),U=T.filter(e=>!e.availability.available),E=e.origin.conversation,O=(g=e.origin.conversation)?g.thread_agent_id?`/agents/${encodeURIComponent(g.thread_agent_id)}/conversations`:"group"===g.kind?`/threads/${encodeURIComponent(g.id)}`:null:null,D=(0,l.workRequestLabel)(e),F=(0,l.sessionUsageLine)(e.usage);(0,n.useEffect)(()=>{let e=!1;return fetch(A,{cache:"no-store"}).then(async s=>{let a=await s.json().catch(()=>null);e||(s.ok&&Array.isArray(a?.session?.attempts)?(b(a.session.attempts),N({totals:a.session.usage,samples:Array.isArray(a.session.usage_samples)?a.session.usage_samples:[]})):k("Could not load session details."))}).catch(()=>{e||k("Could not load session details.")}),()=>{e=!0}},[A]);let P=(0,n.useCallback)(async()=>{if(null===w)try{let e=await fetch(`${A}?debug=external_session_id`,{cache:"no-store"}),s=await e.json().catch(()=>null),a=s?.debug?.external_session_id;e.ok&&"string"==typeof a?C(a):R("Not available.")}catch{R("Not available.")}},[A,w]),q=async()=>{if(w)try{await navigator.clipboard.writeText(w),I(!0)}catch{I(!1)}};return(0,s.jsxs)("article",{className:"session-detail","data-session-detail":e.ref,children:[(0,s.jsxs)("div",{className:"session-detail-head",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,s.jsx)("h3",{ref:i,tabIndex:-1,children:e.title})]}),(0,s.jsx)("button",{type:"button",className:"pin-word session-detail-close",onClick:m,children:"Back to session list"})]}),(0,s.jsxs)("div",{className:"session-detail-tags",children:[(0,s.jsx)("span",{className:`manage-tag session-status is-${e.status}`,children:(0,l.statusLabel)(e)}),(0,l.sessionStateTags)(e).map(e=>(0,s.jsx)("span",{className:`manage-tag session-state-tag is-${e.toLowerCase()}`,children:e},e))]}),(0,s.jsxs)("dl",{className:"session-detail-meta",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Last activity"}),(0,s.jsx)("dd",{children:(0,l.formatSessionDate)(e.last_activity_at)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Started"}),(0,s.jsx)("dd",{children:(0,l.formatSessionDate)(e.created_at)})]}),null!==e.ended_at?(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Ended"}),(0,s.jsx)("dd",{children:(0,l.formatSessionDate)(e.ended_at)})]}):null,(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Runtime"}),(0,s.jsx)("dd",{children:(0,l.runtimeLabel)(e)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:"Reported usage"}),(0,s.jsxs)("dd",{children:[(0,s.jsx)("span",{className:`session-usage is-${F.quality}`,"aria-hidden":"true",children:F.text}),(0,s.jsx)("span",{className:"session-sr",children:F.label}),F.partial?(0,s.jsx)("span",{className:"manage-tag session-usage-tag",children:"Partial"}):null]})]}),e.context.workspace?(0,s.jsxs)("div",{className:"is-wide",children:[(0,s.jsx)("dt",{children:"Workspace"}),(0,s.jsx)("dd",{children:e.context.workspace})]}):null,(0,s.jsxs)("div",{className:"is-wide",children:[(0,s.jsx)("dt",{children:"Origin"}),(0,s.jsx)("dd",{children:O&&E?(0,s.jsx)(a.default,{className:"session-link",href:O,children:E.label}):E?.label??"Not recorded"})]}),D?(0,s.jsxs)("div",{className:"is-wide",children:[(0,s.jsx)("dt",{children:"Work request"}),(0,s.jsx)("dd",{children:D})]}):null]}),(0,s.jsxs)("section",{className:"session-detail-section","aria-labelledby":`actions-${e.ref}`,children:[(0,s.jsx)("h4",{id:`actions-${e.ref}`,children:"Actions"}),r&&L.length?(0,s.jsx)("div",{className:"session-actions",role:"group","aria-label":`Actions for ${e.title}`,children:L.map(e=>(0,s.jsx)("button",{type:"button",className:"session-action","data-session-action":e.action,"aria-haspopup":"dialog",onClick:s=>p((0,o.sessionDialogMode)(e.action),s.currentTarget),children:e.label},e.action))}):null,!r&&L.length?(0,s.jsx)("p",{className:"session-unavailable",children:"Open this Agent’s Conversation before starting an action."}):null,U.length?(0,s.jsx)("ul",{className:"session-unavailable","aria-label":`Unavailable actions for ${e.title}`,children:U.map(e=>(0,s.jsxs)("li",{children:[(0,s.jsxs)("strong",{children:[e.label,":"]})," ",e.availability.available?"":e.availability.reason]},e.action))}):null]}),(0,s.jsx)("section",{className:"session-detail-section",children:(0,s.jsx)(h,{row:e,shares:d,policy:u,onChanged:x})}),(0,s.jsxs)("section",{className:"session-detail-section","aria-labelledby":`runs-${e.ref}`,children:[(0,s.jsx)("h4",{id:`runs-${e.ref}`,children:"Runs and usage"}),S?(0,s.jsx)("p",{className:"delete-error",role:"alert",children:S}):null,j||S?null:(0,s.jsx)("p",{className:"delete-copy",role:"status",children:"Loading details…"}),j?(0,s.jsxs)("ol",{className:"session-attempts","aria-label":"Runs in this session",children:[0===j.length?(0,s.jsx)("li",{children:"No recorded runs."}):null,j.map(e=>(0,s.jsxs)("li",{children:[(0,l.formatSessionDate)(e.started_at)," · ",(0,l.attemptLabel)(e)]},`${e.request_id}-${e.attempt_number}`))]}):null,y?(0,s.jsx)(v,{totals:y.totals,samples:y.samples}):null]}),(0,s.jsxs)("details",{className:"session-debug session-detail-section",onToggle:e=>{e.currentTarget.open&&P()},children:[(0,s.jsx)("summary",{children:"Local debug: provider session ID"}),(0,s.jsx)("p",{className:"session-debug-note",children:"For local troubleshooting only. Botmancers resumes sessions for you; you never need to copy this."}),$?(0,s.jsx)("p",{className:"delete-error",children:$}):null,w?(0,s.jsxs)("div",{className:"session-debug-value",children:[(0,s.jsx)("code",{children:w}),(0,s.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{q()},children:_?"Copied":"Copy"})]}):null]})]})}let b=["input_tokens","output_tokens","cost_usd"];function v({totals:e,samples:a}){let t=(0,n.useId)();return(0,s.jsxs)("section",{className:"session-usage-detail","aria-labelledby":t,children:[(0,s.jsx)("h5",{id:t,className:"session-usage-head",children:"Reported usage"}),(0,s.jsx)("dl",{className:"session-usage-totals",children:b.map(a=>{let n=(0,l.usageMetricView)(a,e?.[a],!0);return(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:n.name}),(0,s.jsxs)("dd",{children:[(0,s.jsx)("span",{className:`session-usage is-${n.quality}`,"aria-hidden":"true",children:n.text}),(0,s.jsxs)("span",{className:"session-sr",children:[n.label,"."]}),(0,s.jsx)("span",{className:`session-usage-coverage is-${n.quality}`,children:n.coverage})]})]},a)})}),0===a.length?(0,s.jsx)("p",{className:"session-usage-none",children:"No run in this session reported usage."}):(0,s.jsx)("ol",{className:"session-usage-runs","aria-label":"Reported usage by run",children:a.map((e,a)=>{let n=(0,l.usageSampleValues)(e);return(0,s.jsxs)("li",{children:[(0,s.jsxs)("span",{className:"session-usage-run",children:[(0,l.formatSessionDate)(e.observed_at)," · ",(0,l.usageSampleLabel)(e,a)]}),(0,s.jsxs)("span",{className:"session-usage-values",children:[(0,s.jsxs)("span",{className:null===e.input_tokens?"is-unavailable":void 0,children:["In ",n.input]}),(0,s.jsxs)("span",{className:null===e.output_tokens?"is-unavailable":void 0,children:["Out ",n.output]}),(0,s.jsxs)("span",{className:null===e.cost_usd?"is-unavailable":void 0,children:["Cost ",n.cost]})]})]},`${e.observed_at}-${a}`)})})]})}var y=e.i(70925);e.s(["default",0,function(){let{id:e,agents:n,overview:t,loading:l,error:i,notFound:r}=(0,y.useAgentOverview)();return l?(0,s.jsx)("div",{className:"agent-state",role:"status",children:"Loading sessions…"}):r?(0,s.jsxs)("div",{className:"agent-state",children:[(0,s.jsx)("h2",{children:"Agent not found"}),(0,s.jsx)(a.default,{href:"/",children:"Choose an Agent"})]}):i||!t?(0,s.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,s.jsx)("h2",{children:"Sessions unavailable"}),(0,s.jsx)("p",{children:"Botmancers could not load this Agent. Refresh to try again."})]}):(0,s.jsx)(g,{agentId:e,agentName:t.agent.name,agentProvider:t.runtime.agent,agents:n.map(e=>({id:e.id,name:e.name})),origin:t.conversation?{conversationId:t.conversation.id,label:`${t.agent.name} conversation`}:null})}],49816)}]);
|
package/app/BUILD_INFO.json
CHANGED
package/app/package.json
CHANGED
package/app/server.js
CHANGED
|
@@ -9,7 +9,7 @@ const currentPort = parseInt(process.env.PORT, 10) || 3000
|
|
|
9
9
|
const hostname = process.env.HOSTNAME || '0.0.0.0'
|
|
10
10
|
|
|
11
11
|
let keepAliveTimeout = parseInt(process.env.KEEP_ALIVE_TIMEOUT, 10)
|
|
12
|
-
const nextConfig = {"env":{"BOTMANCERS_BUILD_VERSION":"0.
|
|
12
|
+
const nextConfig = {"env":{"BOTMANCERS_BUILD_VERSION":"0.9.0","BOTMANCERS_BUILD_COMMIT":"dc129093ac85f510039ffc5281cf15224118c81e"},"webpack":null,"typescript":{"ignoreBuildErrors":false},"typedRoutes":false,"distDir":"./.next","cleanDistDir":true,"assetPrefix":"","cacheMaxMemorySize":52428800,"configOrigin":"next.config.ts","useFileSystemPublicRoutes":true,"generateEtags":true,"pageExtensions":["tsx","ts","jsx","js"],"instrumentationClientInject":[],"poweredByHeader":true,"compress":true,"images":{"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","loaderFile":"","domains":[],"disableStaticImages":false,"minimumCacheTTL":14400,"formats":["image/webp"],"maximumRedirects":3,"maximumResponseBody":50000000,"dangerouslyAllowLocalIP":false,"dangerouslyAllowSVG":false,"contentSecurityPolicy":"script-src 'none'; frame-src 'none'; sandbox;","contentDispositionType":"attachment","localPatterns":[{"pathname":"**","search":""}],"remotePatterns":[],"qualities":[75],"unoptimized":true,"customCacheHandler":false},"devIndicators":{"position":"bottom-left"},"onDemandEntries":{"maxInactiveAge":60000,"pagesBufferLength":5},"basePath":"","sassOptions":{},"trailingSlash":false,"i18n":null,"productionBrowserSourceMaps":false,"excludeDefaultMomentLocales":true,"reactProductionProfiling":false,"reactStrictMode":null,"reactMaxHeadersLength":6000,"httpAgentOptions":{"keepAlive":true},"logging":{"serverFunctions":true,"browserToTerminal":"warn"},"compiler":{},"expireTime":31536000,"staticPageGenerationTimeout":60,"output":"standalone","modularizeImports":{"@mui/icons-material":{"transform":"@mui/icons-material/{{member}}"},"lodash":{"transform":"lodash/{{member}}"}},"outputFileTracingRoot":__dirname,"enablePrerenderSourceMaps":true,"cacheComponents":false,"cacheLife":{"default":{"stale":300,"revalidate":900,"expire":4294967294},"seconds":{"stale":30,"revalidate":1,"expire":60},"minutes":{"stale":300,"revalidate":60,"expire":3600},"hours":{"stale":300,"revalidate":3600,"expire":86400},"days":{"stale":300,"revalidate":86400,"expire":604800},"weeks":{"stale":300,"revalidate":604800,"expire":2592000},"max":{"stale":300,"revalidate":2592000,"expire":31536000}},"cacheHandlers":{},"experimental":{"appNewScrollHandler":true,"coldCacheBadge":false,"devValidationWorker":true,"useSkewCookie":false,"cssChunking":true,"multiZoneDraftMode":false,"appNavFailHandling":false,"prerenderEarlyExit":true,"serverMinification":true,"linkNoTouchStart":false,"caseSensitiveRoutes":false,"cachedNavigations":false,"dynamicOnHover":false,"useOffline":false,"varyParams":true,"optimisticRouting":true,"instrumentationClientRouterTransitionEvents":false,"prefetchInlining":{"maxSize":2048,"maxBundleSize":10240},"preloadEntriesOnStart":true,"clientRouterFilter":true,"clientRouterFilterRedirects":false,"fetchCacheKeyPrefix":"","proxyPrefetch":"flexible","optimisticClientCache":true,"manualClientBasePath":false,"cpus":9,"memoryBasedWorkersCount":false,"imgOptConcurrency":null,"imgOptOperationCache":null,"imgOptTimeoutInSeconds":7,"imgOptMaxInputPixels":268402689,"imgOptSequentialRead":null,"isrFlushToDisk":true,"workerThreads":false,"optimizeCss":false,"nextScriptWorkers":false,"scrollRestoration":false,"externalDir":false,"devMemoryThresholdRestart":true,"disableOptimizedLoading":false,"gzipSize":true,"craCompat":false,"esmExternals":true,"fullySpecified":false,"swcTraceProfiling":false,"forceSwcTransforms":false,"requestInsights":false,"largePageDataBytes":128000,"typedEnv":false,"parallelServerCompiles":false,"parallelServerBuildTraces":false,"ppr":false,"authInterrupts":false,"webpackMemoryOptimizations":false,"optimizeServerReact":true,"strictRouteTypes":false,"useTypeScriptCli":true,"removeUncaughtErrorAndRejectionListeners":false,"validateRSCRequestHeaders":true,"staleTimes":{"dynamic":0,"static":300},"reactDebugChannel":true,"serverComponentsHmrCache":true,"serverComponentsHmrCancellation":false,"staticGenerationMaxConcurrency":8,"staticGenerationMinPagesPerWorker":25,"transitionIndicator":false,"gestureTransition":false,"inlineCss":false,"useCache":false,"globalNotFound":false,"browserDebugInfoInTerminal":"warn","lockDistDir":true,"proxyClientMaxBodySize":10485760,"hideLogsAfterAbort":false,"mcpServer":true,"turbopackFileSystemCacheForDev":true,"turbopackFileSystemCacheForBuild":true,"turbopackInferModuleSideEffects":true,"turbopackPluginRuntimeStrategy":"childProcesses","turbopackMemoryEvictionMode":"auto","optimizePackageImports":["lucide-react","date-fns","lodash-es","ramda","antd","react-bootstrap","ahooks","@ant-design/icons","@headlessui/react","@headlessui-float/react","@heroicons/react/20/solid","@heroicons/react/24/solid","@heroicons/react/24/outline","@visx/visx","@tremor/react","rxjs","@mui/material","@mui/icons-material","recharts","react-use","effect","@effect/schema","@effect/platform","@effect/platform-node","@effect/platform-browser","@effect/platform-bun","@effect/sql","@effect/sql-mssql","@effect/sql-mysql2","@effect/sql-pg","@effect/sql-sqlite-node","@effect/sql-sqlite-bun","@effect/sql-sqlite-wasm","@effect/sql-sqlite-react-native","@effect/rpc","@effect/rpc-http","@effect/typeclass","@effect/experimental","@effect/opentelemetry","@material-ui/core","@material-ui/icons","@tabler/icons-react","mui-core","react-icons/ai","react-icons/bi","react-icons/bs","react-icons/cg","react-icons/ci","react-icons/di","react-icons/fa","react-icons/fa6","react-icons/fc","react-icons/fi","react-icons/gi","react-icons/go","react-icons/gr","react-icons/hi","react-icons/hi2","react-icons/im","react-icons/io","react-icons/io5","react-icons/lia","react-icons/lib","react-icons/lu","react-icons/md","react-icons/pi","react-icons/ri","react-icons/rx","react-icons/si","react-icons/sl","react-icons/tb","react-icons/tfi","react-icons/ti","react-icons/vsc","react-icons/wi"],"useCacheTimeout":54,"instantInsights":{"validationLevel":"warning"},"trustHostHeader":false,"isExperimentalCompile":false},"htmlLimitedBots":"[\\w-]+-Google|Google-[\\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight","bundlePagesRouterDependencies":false,"configFileName":"next.config.ts","serverExternalPackages":["@slack/socket-mode","@slack/web-api"],"repoRoot":__dirname,"turbopack":{"root":__dirname},"distDirRoot":".next","_originalRewrites":{"beforeFiles":[],"afterFiles":[{"source":"/favicon.ico","destination":"/brand/botmancers-logo-filled-64.png"}],"fallback":[]}}
|
|
13
13
|
|
|
14
14
|
process.env.__NEXT_PRIVATE_STANDALONE_CONFIG = JSON.stringify(nextConfig)
|
|
15
15
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "botmancers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Botmancers: the UI, core engine, and authenticated MCP bridge (contracts botmancers.mcp.v1 and botmancers.mcp.v2) as one CLI-managed product. `botmancers start` runs it all; bare `botmancers` runs the bridge only.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"botmancers",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
globalThis.__RSC_MANIFEST = globalThis.__RSC_MANIFEST || {};
|
|
2
|
-
globalThis.__RSC_MANIFEST["/threads/[id]/page"] = {"moduleLoading":{"prefix":""},"clientModules":{"[project]/node_modules/next/dist/esm/client/components/layout-router.js":{"id":39756,"name":"*","chunks":["/_next/static/chunks/3fntmmi971322.js"],"async":false},"[project]/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":37457,"name":"*","chunks":["/_next/static/chunks/3fntmmi971322.js"],"async":false},"[project]/node_modules/next/dist/esm/client/components/client-page.js":{"id":47257,"name":"*","chunks":["/_next/static/chunks/3fntmmi971322.js"],"async":false},"[project]/node_modules/next/dist/esm/client/components/client-segment.js":{"id":92825,"name":"*","chunks":["/_next/static/chunks/3fntmmi971322.js"],"async":false},"[project]/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":68017,"name":"*","chunks":["/_next/static/chunks/3fntmmi971322.js"],"async":false},"[project]/node_modules/next/dist/esm/lib/framework/boundary-components.js":{"id":97367,"name":"*","chunks":["/_next/static/chunks/3fntmmi971322.js"],"async":false},"[project]/node_modules/next/dist/esm/lib/metadata/generate/icon-mark.js":{"id":27201,"name":"*","chunks":["/_next/static/chunks/3fntmmi971322.js"],"async":false},"[project]/node_modules/next/dist/client/components/builtin/global-error.js":{"id":68027,"name":"*","chunks":["/_next/static/chunks/3fntmmi971322.js"],"async":false},"[project]/app/threads/[id]/page.tsx":{"id":61138,"name":"*","chunks":["/_next/static/chunks/3fntmmi971322.js","/_next/static/chunks/1w72fds3-utrx.js"],"async":false}},"ssrModuleMapping":{"39756":{"*":{"id":2420,"name":"*","chunks":["server/chunks/ssr/[root-of-the-server]__1feicqq._.js","server/chunks/ssr/node_modules_next_dist_1v8aef8._.js"],"async":false}},"37457":{"*":{"id":24017,"name":"*","chunks":["server/chunks/ssr/[root-of-the-server]__1feicqq._.js","server/chunks/ssr/node_modules_next_dist_1v8aef8._.js"],"async":false}},"47257":{"*":{"id":77682,"name":"*","chunks":["server/chunks/ssr/[root-of-the-server]__1feicqq._.js","server/chunks/ssr/node_modules_next_dist_1v8aef8._.js"],"async":false}},"92825":{"*":{"id":97296,"name":"*","chunks":["server/chunks/ssr/[root-of-the-server]__1feicqq._.js","server/chunks/ssr/node_modules_next_dist_1v8aef8._.js"],"async":false}},"68017":{"*":{"id":61660,"name":"*","chunks":["server/chunks/ssr/[root-of-the-server]__1feicqq._.js","server/chunks/ssr/node_modules_next_dist_1v8aef8._.js"],"async":false}},"97367":{"*":{"id":90574,"name":"*","chunks":["server/chunks/ssr/[root-of-the-server]__1feicqq._.js","server/chunks/ssr/node_modules_next_dist_1v8aef8._.js"],"async":false}},"27201":{"*":{"id":60704,"name":"*","chunks":["server/chunks/ssr/[root-of-the-server]__1feicqq._.js","server/chunks/ssr/node_modules_next_dist_1v8aef8._.js"],"async":false}},"68027":{"*":{"id":40622,"name":"*","chunks":["server/chunks/ssr/[root-of-the-server]__1feicqq._.js","server/chunks/ssr/node_modules_next_dist_1v8aef8._.js","server/chunks/ssr/node_modules_1wax83z._.js"],"async":false}},"61138":{"*":{"id":63718,"name":"*","chunks":["server/chunks/ssr/[root-of-the-server]__1feicqq._.js","server/chunks/ssr/node_modules_next_dist_1v8aef8._.js","server/chunks/ssr/_0epgorw._.js","server/chunks/ssr/_0_fa0na._.js","server/chunks/ssr/node_modules_next_0x3i8za._.js","server/chunks/ssr/node_modules_1nkgb45._.js"],"async":false}}},"edgeSSRModuleMapping":{},"rscModuleMapping":{"39756":{"*":{"id":26768,"name":"*","chunks":[],"async":false}},"37457":{"*":{"id":17910,"name":"*","chunks":[],"async":false}},"47257":{"*":{"id":92977,"name":"*","chunks":[],"async":false}},"92825":{"*":{"id":48552,"name":"*","chunks":[],"async":false}},"68017":{"*":{"id":83919,"name":"*","chunks":[],"async":false}},"97367":{"*":{"id":24150,"name":"*","chunks":[],"async":false}},"27201":{"*":{"id":40771,"name":"*","chunks":[],"async":false}},"68027":{"*":{"id":82509,"name":"*","chunks":[],"async":false}},"61138":{"*":{"id":76684,"name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{},"entryCSSFiles":{"[project]/app/layout":[{"path":"static/chunks/2095-o17ji0fs.css","inlined":false}],"[project]/node_modules/next/dist/client/components/builtin/global-error":[{"path":"static/chunks/2095-o17ji0fs.css","inlined":false}],"[project]/app/threads/[id]/page":[{"path":"static/chunks/2095-o17ji0fs.css","inlined":false}]},"entryJSFiles":{"[project]/app/layout":["static/chunks/3fntmmi971322.js"],"[project]/node_modules/next/dist/client/components/builtin/global-error":["static/chunks/3fntmmi971322.js"],"[project]/app/threads/[id]/page":["static/chunks/3fntmmi971322.js","static/chunks/1w72fds3-utrx.js"]}};
|
|
3
|
-
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
module.exports=[85148,(e,t,r)=>{t.exports=e.x("better-sqlite3-90e2652d1716b047",()=>require("better-sqlite3-90e2652d1716b047"))},33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},51749,e=>{"use strict";var t=e.i(54799),r=e.i(22734),n=e.i(14747),s=e.i(52036);let a="/v1/chat/completions";class i extends Error{code;status;constructor(e,t,r){super(t),this.name="HermesError",this.code=e,this.status=r}}function o(e,t){return`${t.sessionPrefix}${e}`}function l(e,t){return new i("aborted","Hermes request aborted")}async function d(e){var t;let r,n,{config:s,profilePath:a,sessionId:o,messages:d,signal:u}=e,c=e.fetchImpl||((e,t)=>fetch(e,t)),_=(t=s.baseUrl,r=t.replace(/\/+$/,""),n=a.startsWith("/")?a:`/${a}`,`${r}${n}`),p=new AbortController,g=!1,m=setTimeout(()=>{g=!0,p.abort()},s.timeoutMs);m.unref&&m.unref();let f=()=>p.abort();if(u){if(u.aborted)throw clearTimeout(m),l(u,s.timeoutMs);u.addEventListener("abort",f,{once:!0})}try{let e,t;try{e=await c(_,{method:"POST",headers:{Authorization:`Bearer ${s.apiKey}`,"Content-Type":"application/json","X-Hermes-Session-Id":o},body:JSON.stringify({model:s.model,stream:!1,messages:d}),signal:p.signal})}catch(e){if(g)throw new i("timeout",`Hermes request timed out after ${s.timeoutMs} ms`);if(p.signal.aborted)throw l(u??p.signal,s.timeoutMs);throw new i("network",`Hermes request failed: ${String(e)}`)}let r="";try{r=await e.text()}catch{r=""}if(!e.ok){let t=`Hermes turn failed with status ${e.status}`;try{let e=JSON.parse(r);e?.error?.message&&(t=e.error.message)}catch{let e=r.trim().slice(0,120);e&&(t=`${t}: ${e}`)}throw new i("http",t,e.status)}try{t=JSON.parse(r)}catch{throw new i("protocol","Hermes reply was not JSON",e.status)}return t.choices?.[0]?.message?.content?.trim()||"No response"}finally{clearTimeout(m),u&&u.removeEventListener("abort",f)}}e.s(["HERMES_DEFAULT_CHAT_PATH",0,a,"HermesError",0,i,"appendHermesWaitLog",0,function(e){try{let t=function(e=process.env){return(0,s.waitLogPath)(e)}();r.default.mkdirSync(n.default.dirname(t),{recursive:!0}),r.default.appendFileSync(t,JSON.stringify({at:new Date().toISOString(),...e})+"\n")}catch(e){console.error("wait log failed",e)}},"hermesChat",0,d,"hermesFreshSessionIdForBot",0,function(e,r){return`${o(e,r)}-x-${(0,t.randomUUID)()}`},"hermesProfilePathForBot",0,function(e){let t=(e.hermes_profile||"").trim();if(!t)return a;let r=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return r?`/p/${r}${a}`:a},"hermesSessionIdForBot",0,o,"loadHermesConfig",0,function(e=process.env){var t;let r,n=(e.HERMES_API_SERVER_KEY||"").trim();if(!n)return null;let s=(e.HERMES_BASE_URL||"").trim()||"http://127.0.0.1:8642",a=(e.HERMES_SESSION_PREFIX||"").trim()||"botmancer-specialist-",i=(e.HERMES_MODEL||"").trim()||"hermes";return{baseUrl:s.replace(/\/+$/,""),apiKey:n,timeoutMs:(r=Number(t=e.HERMES_TIMEOUT_MS),void 0!==t&&""!==t&&Number.isFinite(r)&&r>0?Math.floor(r):24e4),sessionPrefix:a,model:i}}])},91253,26571,e=>{"use strict";var t=e.i(22734),r=e.i(14747),n=e.i(54799),s=e.i(62294),a=e.i(52036);let i="BOTMANCERS_SERVICE_TOKENS",o=["botmancers-exchanges","botmancers-engine","botmancers-session-share","botmancers-session-context"],l=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,d=/^sha256:([0-9a-f]{64})$/;class u extends Error{constructor(e){super(e),this.name="ServiceTokenConfigError"}}function c(e){if(!e||!e.trim())return[];let t=[],r=new Set;for(let n of e.split(/[,\s]+/).filter(Boolean)){let e=n.indexOf("="),s=e>0?n.slice(0,e):"",a=d.exec(e>0?n.slice(e+1).toLowerCase():"");if(!l.test(s)||!a)throw new u(`${i} entries must be <service-id>=sha256:<64 hex digits>.`);if(r.has(s))throw new u(`${i} lists service ${s} twice.`);if(o.includes(s))throw new u(`${i} names the reserved engine principal ${s}.`);r.add(s),t.push({serviceId:s,digest:Buffer.from(a[1],"hex")})}return t}e.s(["RESERVED_SERVICE_IDS",0,o,"SERVICE_TOKENS_ENV",0,i,"ServiceTokenConfigError",0,u,"parseServiceTokens",0,c,"serviceTokenAuthenticatorFromEnv",0,function(e=process.env){let t=c(e[i]);return t.length?e=>{let r,s,a=(s=(r=e.headers.get("authorization"))?/^Bearer[ \t]+(\S+)[ \t]*$/i.exec(r):null)?s[1]:null;if(!a||a.length>4096)return null;let i=(0,n.createHash)("sha256").update(a,"utf8").digest(),o=null;for(let e of t)(0,n.timingSafeEqual)(i,e.digest)&&null===o&&(o=e.serviceId);return o?{kind:"service",id:o}:null}:null}],26571);let _=["agents:read","sessions:read","conversations:read","sessions:message","exchanges:read","exchanges:create","sessions:start","sessions:resume","shares:create"],p=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,g=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;class m extends Error{constructor(e){super(e),this.name="ServiceGrantsError"}}function f(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function h(e,t,r){let n=Object.keys(e).find(e=>!t.includes(e));if(void 0!==n)throw new m(`${r} has an unknown field "${n}".`)}let E=null;e.s(["EXCHANGE_KEY_PREFIX",0,"exchange:","MESSAGE_KEY_PREFIX",0,"message:","SERVICE_CAPABILITIES",0,_,"loadServiceGrants",0,function(e=process.env){let l,d=function(e=process.env){let t=(e.BOTMANCERS_SERVICE_GRANTS_PATH||"").trim();if(t)return r.default.resolve(t);let n=(0,a.botmancersHome)(e);return n?r.default.join(n,"config/service-grants.json"):null}(e);if(!d)return{state:"absent",path:null};try{l=t.default.statSync(d)}catch(e){if("ENOENT"===e.code)return{state:"absent",path:d};return{state:"invalid",path:d,reason:"The document cannot be read."}}let b=(0,n.createHash)("sha256").update(e[i]??"","utf8").digest("hex"),S=new Set(s.default.prepare("SELECT id FROM bots").all().map(e=>e.id)),v=(0,n.createHash)("sha256").update([...S].sort().join("\n"),"utf8").digest("hex"),w=[d,l.ino,l.size,l.mode,l.uid,l.mtimeMs,b,v].join(":");if(E&&E.key===w)return E.state;let A=function(e,r,n,s){let a;if(!r.isFile())return{state:"invalid",path:e,reason:"The document is not a regular file."};if("function"==typeof process.getuid&&r.uid!==process.getuid())return{state:"invalid",path:e,reason:"The document must be owned by the user running Botmancers."};if((63&r.mode)!=0)return{state:"invalid",path:e,reason:"The document must not be readable or writable by group or others (chmod 600)."};if("string"==typeof n)return{state:"invalid",path:e,reason:n};if(r.size>65536)return{state:"invalid",path:e,reason:"The document exceeds 65536 bytes."};try{a=t.default.readFileSync(e,"utf8")}catch{return{state:"invalid",path:e,reason:"The document cannot be read."}}try{return{state:"loaded",path:e,grants:function(e,t,r){let n;try{n=JSON.parse(e)}catch{throw new m("The document is not valid JSON.")}if(!f(n))throw new m("The document must be a JSON object.");if(h(n,["version","grants"],"The document"),1!==n.version)throw new m("version must be 1.");if(!Array.isArray(n.grants))throw new m("grants must be a list.");if(n.grants.length>512)throw new m("grants has more than 512 entries.");let s=new Map;return n.grants.forEach((e,n)=>{let a=`grants[${n}]`;if(!f(e))throw new m(`${a} must be an object.`);h(e,["service","agent","capabilities"],a);let{service:l,agent:d,capabilities:u}=e;if("string"!=typeof l||!p.test(l))throw new m(`${a}.service must be a configured service id (letters, digits, ".", "_", "-").`);if(o.includes(l))throw new m(`${a}.service names a reserved engine principal.`);if(t&&!t.has(l))throw new m(`${a}.service is not a configured service principal (${i}).`);if("string"!=typeof d||!g.test(d))throw new m(`${a}.agent must be one Agent id; wildcards are not allowed.`);if(r&&!r.has(d))throw new m(`${a}.agent is not a registered Agent.`);if(!Array.isArray(u)||0===u.length)throw new m(`${a}.capabilities must list at least one capability.`);let c=new Set;for(let e of u){if(!("string"==typeof e&&_.includes(e)))throw new m(`${a}.capabilities has an unknown capability.`);if(c.has(e))throw new m(`${a}.capabilities lists ${e} twice.`);c.add(e)}let E=s.get(l)??new Map;if(E.has(d))throw new m(`${a} repeats the grant of service ${l} for that Agent.`);E.set(d,c),s.set(l,E)}),s}(a,n,s)}}catch(t){if(t instanceof m)return{state:"invalid",path:e,reason:t.message};throw t}}(d,l,function(e){try{return new Set(c(e[i]).map(e=>e.serviceId))}catch(e){if(e instanceof u)return`${i} is malformed, so no grant can name a configured service.`;throw e}}(e),S);return E={key:w,state:A},A}],91253)},90027,e=>{"use strict";var t=e.i(62349),r=e.i(28420);let n=["active","ended","all"],s=["implementation","revision"],a=`
|
|
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
|
-
`,i=`
|
|
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 l(e,t){let r=e?.[t];return"string"==typeof r&&r.trim().length>0?r:null}function d(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,n=(0,r.emptyUsage)()){let a,i=null;try{i=e.source_snapshot?JSON.parse(e.source_snapshot):null}catch{}let c=d(e),_=null===e.released_at?"active":"ended",p=((a=(e.request_intent??"").split("\n").map(e=>e.trim()).find(e=>e.length>0))?a.length>80?`${a.slice(0,79).trimEnd()}…`:a:null)??(c?.kind==="group"?c.label:null)??`${e.agent_name} \xb7 ${o(e.created_at)}`;return{ref:e.id,source:"botmancers",agent:{id:e.agent_id,name:e.agent_name,adapter:e.adapter,transport:l(i,"transport")},title:p,status:_,resumable:null===e.released_at&&null!==e.request_id&&null!==e.request_kind&&s.includes(e.request_kind)&&e.request_target_agent_id===e.agent_id&&(e.conversation_id??"")===(e.request_conversation_id??"")&&e.adapter===(0,t.resolveAgent)({agent:e.agent_runtime}).agent,state:{availability:e.ps_availability??"available",lifecycle:e.ps_lifecycle??"open",resumable:null===e.ps_resumable||void 0===e.ps_resumable?null:1===e.ps_resumable,busy:1===e.ps_busy||!!e.attempt_running||!!e.ps_running,synced_at:e.ps_synced_at??null},created_at:e.created_at,ended_at:e.released_at,last_activity_at:Math.max(e.created_at,e.released_at??0,e.source_finished_at??0,e.resumed_last_at??0),origin:{conversation:c,work_request:e.origin_request_id&&e.request_kind&&e.request_state?{id:e.origin_request_id,execution_kind:e.request_kind,state:e.request_state}:null},context:{workspace:l(i,"cwd")??e.ps_workspace??null},usage:n}}function c(e,t=(0,r.emptyUsage)()){let n=e.provider_created_at??e.created_at,s=null===e.resumable?null:1===e.resumable,a="archived"===e.lifecycle?e.provider_updated_at??e.updated_at:null;return{ref:e.id,source:"native",agent:{id:e.agent_id,name:e.agent_name,adapter:e.provider_kind,transport:null},title:e.title??`${e.agent_name} \xb7 ${o(n)}`,status:"open"===e.lifecycle?"active":"ended",resumable:!1,state:{availability:e.availability,lifecycle:e.lifecycle,resumable:s,busy:1===e.busy||!!e.running,synced_at:e.last_synced_at},created_at:n,ended_at:a,last_activity_at:Math.max(n,e.provider_updated_at??0,e.turn_last_at??0),origin:{conversation:null,work_request:null},context:{workspace:e.workspace},usage:t}}function _(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 p(e,t,r){return e.prepare(`${i} AND ps.id = ? AND ps.agent_id = ?`).get(r,t)}function g(e,t,r){return e.prepare(`${a} WHERE b.id = ? AND b.agent_id = ?`).get(r,t)}e.s(["agentExists",0,function(e,t){return!!e.prepare("SELECT 1 FROM bots WHERE id = ?").get(t)},"conversationRef",0,function(e,t){let r=e.prepare(`
|
|
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 r?d(r):null},"getAgentSession",0,function(e,t,n){let s=g(e,t,n);if(!s){let s=p(e,t,n);if(!s)return;let{usage:a,samples:i}=(0,r.sessionUsageSamples)(e,t,n);return{...c(s,a),attempts:[],usage_samples:i}}let a=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(s.source_attempt_id,s.source_attempt_id,s.id),{usage:i,samples:o}=(0,r.sessionUsageSamples)(e,t,n);return{...u(s,i),attempts:a,usage_samples:o}},"isSessionFilter",0,function(e){return"string"==typeof e&&n.includes(e)},"listAgentSessions",0,function(e,t,n="all"){let s=e.prepare(`${a} WHERE b.agent_id = ? ${"active"===n?"AND b.released_at IS NULL":"ended"===n?"AND b.released_at IS NOT NULL":""}`).all(t),o=e.prepare(`${i} AND ps.agent_id = ? ${"active"===n?"AND ps.lifecycle = 'open'":"ended"===n?"AND ps.lifecycle = 'archived'":""}`).all(t),l=(0,r.agentSessionUsage)(e,t);return[...s.map(e=>u(e,l.get(e.id))),...o.map(e=>c(e,l.get(e.id)))].sort(_)},"sessionDebugExternalId",0,function(e,t,r){let n=g(e,t,r)?.external_session_id;if(void 0!==n)return n;if(!p(e,t,r))return;let s=e.prepare("SELECT provider_session_id FROM provider_sessions WHERE id = ? AND agent_id = ?").get(r,t);return s?.provider_session_id},"sessionTitle",0,function(e,t,r){let n=g(e,t,r);if(n)return u(n).title;let s=p(e,t,r);return s?c(s).title:null}])}];
|
|
43
|
-
|
|
44
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__0792yb1._.js.map
|