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,3 @@
|
|
|
1
|
+
module.exports=[27828,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(35099);a.s(["default",0,function({summary:a,onChanged:f}){let[g,h]=(0,c.useState)(!1),[i,j]=(0,c.useState)(""),k=(0,e.stateTone)(a.state),l=(0,e.outcomeLine)(a),m=(0,e.failureAdvice)(a),n=`exchange-${a.id}-title`,o=async()=>{if(!g){h(!0),j("");try{let b=await fetch(`/api/exchanges/${encodeURIComponent(a.id)}/cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!b.ok){let a=await b.json().catch(()=>null);j("string"==typeof a?.error?.message?a.error.message:"Could not cancel. Try again.")}}catch{j("Could not cancel. Try again.")}finally{h(!1),f?.()}}};return(0,b.jsxs)("article",{id:`exchange-${a.id}`,className:`exchange-card is-${k} is-${a.state}`,"data-exchange-id":a.id,"data-exchange-state":a.state,"aria-labelledby":n,tabIndex:-1,children:[(0,b.jsxs)("p",{className:"exchange-card-line",children:[(0,b.jsx)("span",{className:"exchange-card-mode",children:(0,e.modeLabel)(a.mode)}),(0,b.jsx)("span",{id:n,className:"exchange-card-title",children:(0,e.participantsLabel)(a)}),(0,b.jsx)("span",{className:"exchange-card-state",role:"status",children:(0,e.liveStateLabel)(a)})]}),(0,b.jsx)("p",{className:"exchange-card-session",children:(0,e.sessionLabel)(a)}),(0,b.jsxs)("p",{className:"exchange-card-instruction",children:[(0,b.jsx)("span",{className:"exchange-card-key",children:(0,e.instructionHeading)(a.mode)})," ",(0,e.excerpt)(a.instruction,220)]}),l?(0,b.jsx)("p",{className:"failed"===a.state?"exchange-card-outcome is-failure":"exchange-card-outcome",children:l}):null,m?(0,b.jsx)("p",{className:"exchange-card-advice",children:m}):null,i?(0,b.jsx)("p",{className:"exchange-card-error",role:"alert",children:i}):null,(0,b.jsxs)("p",{className:"exchange-card-foot",children:[(0,b.jsxs)("span",{className:"exchange-card-time",children:["Updated ",(0,e.formatExchangeTime)(a.updated_at)]}),(0,b.jsx)(d.default,{className:"exchange-card-link",href:(0,e.detailsHref)(a.id),"aria-label":`Details: ${(0,e.modeLabel)(a.mode)} ${(0,e.participantsLabel)(a)}`,children:"Details"}),a.can_cancel?(0,b.jsx)("button",{type:"button",className:"exchange-card-cancel",disabled:g,onClick:()=>{o()},children:g?"Cancelling…":"Cancel"}):null]})]})}])},25073,4921,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(59807);a.s(["default",0,function({failure:a}){let[e,f]=(0,c.useState)("idle"),g=(0,d.severityLabel)(a.severity),h=(0,c.useId)();async function i(){try{await navigator.clipboard.writeText(a.detail),f("copied")}catch{f("failed")}}return(0,b.jsxs)("div",{className:`runtime-failure runtime-failure-${a.severity}`,role:"status","aria-labelledby":h,"data-runtime-failure":a.kind,children:[(0,b.jsxs)("p",{className:"runtime-failure-title",id:h,children:[(0,b.jsx)("span",{className:"runtime-failure-severity",children:g}),a.title]}),(0,b.jsx)("p",{className:"runtime-failure-recovery",children:a.recovery}),(0,b.jsxs)("details",{className:"runtime-failure-details",children:[(0,b.jsx)("summary",{children:"Details"}),(0,b.jsx)("code",{className:"runtime-failure-detail",children:a.detail}),(0,b.jsx)("button",{type:"button",className:"runtime-failure-copy",onClick:()=>{i()},children:"copied"===e?"Copied":"failed"===e?"Copy failed":"Copy details"})]})]})}],25073);let e={blocked:"Needs approval",rejected:"Not started",allowed:"Allowed",denied:"Denied",waiting:"Queued",stopped:"Stopped"};a.s(["default",0,function({notice:a,onDone:d}){let[f,g]=(0,c.useState)(!1),[h,i]=(0,c.useState)(""),j="blocked"!==a.tone||a.actionable?e[a.tone]:"Blocked",k=async b=>{if(!f&&a.wakeId){g(!0),i("");try{let c=await fetch(`/api/wakes/${a.wakeId}/decision`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decision:b})});if(!c.ok){let a=await c.json().catch(()=>null);i("string"==typeof a?.error?.message?a.error.message:"The decision could not be recorded.")}}catch{i("The decision could not be recorded.")}finally{g(!1),d()}}};return(0,b.jsxs)("div",{className:`wake-notice wake-notice-${a.tone}`,role:"status","data-wake-notice":a.tone,"data-wake-id":a.wakeId??void 0,children:[(0,b.jsxs)("p",{className:"wake-notice-line",children:[(0,b.jsx)("span",{className:"wake-notice-label",children:j}),a.text]}),a.actionable?(0,b.jsxs)("div",{className:"wake-notice-actions",children:[(0,b.jsx)("button",{type:"button",className:"approve-control",disabled:f,onClick:()=>{k("allow")},children:"Allow"}),(0,b.jsx)("button",{type:"button",className:"approve-control",style:{marginLeft:8},disabled:f,onClick:()=>{k("deny")},children:"Deny"})]}):null,h?(0,b.jsx)("p",{className:"wake-notice-error",role:"alert",children:h}):null]})}],4921)},20851,22151,a=>{"use strict";let b=["hermes","cursor","claude","codex","muse"],c={hermes:"Hermes",cursor:"Cursor",claude:"Claude",codex:"Codex",muse:"Muse Code"},d="hermes";function e(a){return b.includes(String(a))?c[a]:String(a??"")}b.join("|"),a.s(["AGENTS",0,b,"AGENT_LABELS",0,c,"DEFAULT_AGENT",0,d,"agentLabel",0,e],22151);let f=b.map(a=>({value:a,label:c[a]}));function g(a){return e((a.agent??"").trim()||d)}function h(a){let b=a.runtime_connection;return b&&b.label.trim()?b.label.trim():(a.runtime_connection_id??"").trim()?(a.runtime_connection_id??"").trim():null}function i(a){return`~/.botmancers/${a}`}let j="~/.botmancers/{agentID}",k=`Default: ${j} — {agentID} is this agent's ID, assigned at creation.`;function l(a){return String(a).padStart(2,"0")}let m=[{prefix:"[Agent failed]",kind:"failed",label:"Agent failed"},{prefix:"[Deck handoff]",kind:"handoff",label:"Agent launch"},{prefix:"[Deck run]",kind:"run",label:"Agent run"},{prefix:"[Deck review]",kind:"review",label:"Agent review"},{prefix:"[Deck resume]",kind:"resume",label:"Agent resume"},{prefix:"[Deck result]",kind:"result",label:"Agent result"},{prefix:"[Deck failed]",kind:"failed",label:"Agent failed"},{prefix:"[Deck needs selection]",kind:"reselection",label:"Agent needs setup"},{prefix:"[Deck needs reselection]",kind:"reselection",label:"Agent needs setup"}];a.s(["AGENT_OPTIONS",0,f,"NEW_AGENT_WORKSPACE_HINT",0,k,"WORKSPACE_TEMPLATE",0,j,"agentEventDisplay",0,function(a){let b=String(a??"").trimStart(),c=m.find(a=>b.startsWith(a.prefix));return c?{label:c.label,detail:b.slice(c.prefix.length).trim()}:null},"botAgentLabel",0,g,"botConnectionLabel",0,h,"configWorkspaceHint",0,function(a){return`Default: ${i(a)} — leave blank to use it.`},"defaultWorkdirFor",0,i,"formatClock",0,function(a){let b=new Date(a);return`${l(b.getHours())}:${l(b.getMinutes())}:${l(b.getSeconds())}`},"rosterRuntimeLine",0,function(a){let b=`Agent: ${g(a)} \xb7 `+(h(a)??"No connection");return!1===a.launchable?b+" — see Config":b}],20851)},45559,a=>{"use strict";a.s(["draftTitle",0,function(a){return"email"===a?"New Email":"New Slack Message"},"parseApprovalCode",0,function(a){let b=a.match(/approve using the code ([A-Za-z0-9][A-Za-z0-9_-]*)/i);return b?b[1]:null},"parseDraft",0,function(a){let b,c=a.match(/^\s*\[draft\]\s*([\s\S]*)$/);if(!c)return null;try{b=JSON.parse(c[1])}catch{return null}if(!b||"object"!=typeof b)return null;let d=b;return"email"!==d.channel&&"slack"!==d.channel||"open"!==d.state&&"sent"!==d.state&&"discarded"!==d.state||"string"!=typeof d.recipient||"string"!=typeof d.body?null:{channel:d.channel,recipient:d.recipient,body:d.body,state:d.state}},"parseFileNames",0,function(a){let b=[];for(let c of a.split("\n")){let a=c.match(/^\s*\[file\]\s*(\S+)\s*$/i);a&&!b.includes(a[1])&&b.push(a[1])}return b},"parseHandoff",0,function(a){let b=a.match(/^\s*\[Handing off to ([^\]]+)\]/);return b&&b[1].trim()||null}])},10209,a=>{"use strict";a.s(["DIALOG_FOCUSABLE",0,'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])',"newAgentDialogPlacement",0,function(a,b){let c=Math.min(358,b.width-32),d=Math.max(16,b.width-16-c),e=16,f=16;if(a){f=Math.min(Math.max(a.left,16),d);let c=a.bottom+8;b.height-c-16>=360&&(e=c)}return{top:e,left:f,maxHeight:Math.max(0,b.height-e-16)}},"wrapFocusTarget",0,function(a,b,c){if(0===a.length)return null;let d=a[0],e=a[a.length-1],f=null!==b&&a.includes(b);return c?f&&b!==d?null:e:f&&b!==e?null:d}])},11030,a=>{"use strict";a.s(["wakeNotices",0,function(a){let b=[],c=new Map;return a.forEach((d,e)=>{let f="string"==typeof d.data.target_name?d.data.target_name:null;d.requestId&&f&&c.set(d.requestId,f);let g=function(a){switch(a.kind){case"wake_blocked":return"blocked";case"wake_rejected":return"rejected";case"lineage_stopped":return"stopped";case"wake_accepted":return"string"==typeof a.data.reason?"allowed":null;case"request_cancelled":return"grant_denied"===a.data.reason?"denied":null;case"request_queued":return"capacity"===a.data.waiting_for?"waiting":null;default:return null}}(d);if(!g)return;let h=Array.isArray(d.data.actions)?d.data.actions:[],i=null!==d.requestId&&a.slice(e+1).some(a=>a.requestId===d.requestId);if("waiting"===g&&i)return;let j=d.requestId?c.get(d.requestId):void 0,k="denied"===g&&j?`Wake denied: ${j} — no work ran`:"waiting"===g&&j?`Queued: ${j} — waiting for capacity`:d.text;b.push({eventId:d.eventId,wakeId:d.wakeId,tone:g,text:k,actionable:"blocked"===g&&!!d.wakeId&&h.includes("allow")&&h.includes("deny")&&!i,createdAt:d.createdAt})}),b}])},33354,(a,b,c)=>{"use strict";c._=function(a){return a&&a.__esModule?a:{default:a}}},69789,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={actionAsyncStorage:function(){return f.actionAsyncStorage},workAsyncStorage:function(){return g.workAsyncStorage},workUnitAsyncStorage:function(){return h.workUnitAsyncStorage}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f=a.r(20635),g=a.r(56704),h=a.r(32319);("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=_17ngohj._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[15722,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(50944),f=a.i(36391),g=a.i(10014),h=a.i(22151),i=a.i(35832);let j=(0,c.createContext)(null),k=[{label:"Overview",segment:""},{label:"Sessions",segment:"sessions"},{label:"Conversations",segment:"conversations"},{label:"Slack",segment:"slack"},{label:"Activity",segment:"activity"}];a.s(["default",0,function({children:a}){let l=String((0,e.useParams)().id??""),m=(0,e.usePathname)(),n=(0,e.useRouter)(),o=(0,e.useSearchParams)(),[p,q]=(0,c.useState)([]),[r,s]=(0,c.useState)(null),[t,u]=(0,c.useState)(!0),[v,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)(!1),[z,A]=(0,c.useState)(()=>{let a=Number(o.get("deleted"))||0;return a>0?(0,i.deletedStatusLine)(a):""}),[B,C]=(0,c.useState)({serverNow:0,fetchedAt:0}),[D,E]=(0,c.useState)(()=>Date.now()),F=(0,c.useCallback)(async a=>{try{let[b,c]=await Promise.all([fetch("/api/bots",{cache:"no-store"}),fetch(`/api/bots/${encodeURIComponent(l)}/overview`,{cache:"no-store"})]),d=b.ok?await b.json():[];if(a())return;q(Array.isArray(d)?d:[]);let e=Date.parse(b.headers.get("date")||"");if(C({serverNow:Number.isNaN(e)?Date.now():e,fetchedAt:Date.now()}),404===c.status){y(!0),s(null),w(!1);return}if(!c.ok)throw Error("overview request failed");let f=await c.json();if(a())return;s(f),y(!1),w(!1)}catch{a()||w(!0)}finally{a()||u(!1)}},[l]);(0,c.useEffect)(()=>{let a=!1,b=()=>a,c=window.setTimeout(()=>{F(b)},0),d=window.setInterval(()=>{F(b)},2e3),e=window.setInterval(()=>E(Date.now()),1e3);return()=>{a=!0,window.clearTimeout(c),window.clearInterval(d),window.clearInterval(e)}},[F]);let G=r?.agent,H=r?.runtime;return(0,b.jsx)(j.Provider,{value:{id:l,agents:p,overview:r,loading:t,error:v,notFound:x},children:(0,b.jsxs)("div",{className:"field agent-field",children:[(0,b.jsx)(g.default,{agents:p,activeAgentId:l,beatClock:B,now:D,status:z,onAgentsChange:q,onNew:()=>n.push("/?new=1"),onManage:()=>n.push("/?manage=1"),onDeleted:a=>{A((0,i.deletedStatusLine)(a.length)),a.some(a=>a.id===l)&&n.replace(`/?deleted=${a.length}`)}}),(0,b.jsxs)("section",{className:"pane agent-pane",children:[(0,b.jsxs)("header",{className:"agent-shell-header",children:[(0,b.jsxs)("div",{className:"agent-shell-identity",children:[G?(0,b.jsx)(f.default,{bot:G,size:48,title:`${G.name} avatar`}):null,(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-shell-kicker",children:"Agent"}),(0,b.jsx)("h1",{children:G?.name??(t?"Loading…":"Unknown Agent")}),G?(0,b.jsx)("p",{children:G.role}):null]})]}),H?(0,b.jsxs)("div",{className:"agent-shell-runtime","aria-label":"Runtime and availability",children:[(0,b.jsx)("span",{className:H.available?"availability is-available":"availability is-blocked",children:H.available?"Available":"Needs setup"}),(0,b.jsxs)("span",{children:[(0,h.agentLabel)(H.agent)," · ",H.connection||"No connection"]})]}):null]}),(0,b.jsxs)("nav",{className:"agent-tabs","aria-label":"Agent",children:[k.map(a=>{let c=`/agents/${encodeURIComponent(l)}${a.segment?`/${a.segment}`:""}`,e=m===c;return(0,b.jsx)(d.default,{href:c,"aria-current":e?"page":void 0,children:a.label},a.label)}),(0,b.jsx)(d.default,{href:`/bots/${encodeURIComponent(l)}/config`,children:"Config"})]}),(0,b.jsx)("main",{className:"agent-content",children:a})]})]})})},"useAgentOverview",0,function(){let a=(0,c.useContext)(j);if(!a)throw Error("useAgentOverview must be used inside AgentShell");return a}])},20851,22151,a=>{"use strict";let b=["hermes","cursor","claude","codex","muse"],c={hermes:"Hermes",cursor:"Cursor",claude:"Claude",codex:"Codex",muse:"Muse Code"},d="hermes";function e(a){return b.includes(String(a))?c[a]:String(a??"")}b.join("|"),a.s(["AGENTS",0,b,"AGENT_LABELS",0,c,"DEFAULT_AGENT",0,d,"agentLabel",0,e],22151);let f=b.map(a=>({value:a,label:c[a]}));function g(a){return e((a.agent??"").trim()||d)}function h(a){let b=a.runtime_connection;return b&&b.label.trim()?b.label.trim():(a.runtime_connection_id??"").trim()?(a.runtime_connection_id??"").trim():null}function i(a){return`~/.botmancers/${a}`}let j="~/.botmancers/{agentID}",k=`Default: ${j} — {agentID} is this agent's ID, assigned at creation.`;function l(a){return String(a).padStart(2,"0")}let m=[{prefix:"[Agent failed]",kind:"failed",label:"Agent failed"},{prefix:"[Deck handoff]",kind:"handoff",label:"Agent launch"},{prefix:"[Deck run]",kind:"run",label:"Agent run"},{prefix:"[Deck review]",kind:"review",label:"Agent review"},{prefix:"[Deck resume]",kind:"resume",label:"Agent resume"},{prefix:"[Deck result]",kind:"result",label:"Agent result"},{prefix:"[Deck failed]",kind:"failed",label:"Agent failed"},{prefix:"[Deck needs selection]",kind:"reselection",label:"Agent needs setup"},{prefix:"[Deck needs reselection]",kind:"reselection",label:"Agent needs setup"}];a.s(["AGENT_OPTIONS",0,f,"NEW_AGENT_WORKSPACE_HINT",0,k,"WORKSPACE_TEMPLATE",0,j,"agentEventDisplay",0,function(a){let b=String(a??"").trimStart(),c=m.find(a=>b.startsWith(a.prefix));return c?{label:c.label,detail:b.slice(c.prefix.length).trim()}:null},"botAgentLabel",0,g,"botConnectionLabel",0,h,"configWorkspaceHint",0,function(a){return`Default: ${i(a)} — leave blank to use it.`},"defaultWorkdirFor",0,i,"formatClock",0,function(a){let b=new Date(a);return`${l(b.getHours())}:${l(b.getMinutes())}:${l(b.getSeconds())}`},"rosterRuntimeLine",0,function(a){let b=`Agent: ${g(a)} \xb7 `+(h(a)??"No connection");return!1===a.launchable?b+" — see Config":b}],20851)},33354,(a,b,c)=>{"use strict";c._=function(a){return a&&a.__esModule?a:{default:a}}},69789,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={actionAsyncStorage:function(){return f.actionAsyncStorage},workAsyncStorage:function(){return g.workAsyncStorage},workUnitAsyncStorage:function(){return h.workUnitAsyncStorage}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f=a.r(20635),g=a.r(56704),h=a.r(32319);("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=_1iq-7cn._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[27828,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(35099);a.s(["default",0,function({summary:a,onChanged:f}){let[g,h]=(0,c.useState)(!1),[i,j]=(0,c.useState)(""),k=(0,e.stateTone)(a.state),l=(0,e.outcomeLine)(a),m=(0,e.failureAdvice)(a),n=`exchange-${a.id}-title`,o=async()=>{if(!g){h(!0),j("");try{let b=await fetch(`/api/exchanges/${encodeURIComponent(a.id)}/cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!b.ok){let a=await b.json().catch(()=>null);j("string"==typeof a?.error?.message?a.error.message:"Could not cancel. Try again.")}}catch{j("Could not cancel. Try again.")}finally{h(!1),f?.()}}};return(0,b.jsxs)("article",{id:`exchange-${a.id}`,className:`exchange-card is-${k} is-${a.state}`,"data-exchange-id":a.id,"data-exchange-state":a.state,"aria-labelledby":n,tabIndex:-1,children:[(0,b.jsxs)("p",{className:"exchange-card-line",children:[(0,b.jsx)("span",{className:"exchange-card-mode",children:(0,e.modeLabel)(a.mode)}),(0,b.jsx)("span",{id:n,className:"exchange-card-title",children:(0,e.participantsLabel)(a)}),(0,b.jsx)("span",{className:"exchange-card-state",role:"status",children:(0,e.liveStateLabel)(a)})]}),(0,b.jsx)("p",{className:"exchange-card-session",children:(0,e.sessionLabel)(a)}),(0,b.jsxs)("p",{className:"exchange-card-instruction",children:[(0,b.jsx)("span",{className:"exchange-card-key",children:(0,e.instructionHeading)(a.mode)})," ",(0,e.excerpt)(a.instruction,220)]}),l?(0,b.jsx)("p",{className:"failed"===a.state?"exchange-card-outcome is-failure":"exchange-card-outcome",children:l}):null,m?(0,b.jsx)("p",{className:"exchange-card-advice",children:m}):null,i?(0,b.jsx)("p",{className:"exchange-card-error",role:"alert",children:i}):null,(0,b.jsxs)("p",{className:"exchange-card-foot",children:[(0,b.jsxs)("span",{className:"exchange-card-time",children:["Updated ",(0,e.formatExchangeTime)(a.updated_at)]}),(0,b.jsx)(d.default,{className:"exchange-card-link",href:(0,e.detailsHref)(a.id),"aria-label":`Details: ${(0,e.modeLabel)(a.mode)} ${(0,e.participantsLabel)(a)}`,children:"Details"}),a.can_cancel?(0,b.jsx)("button",{type:"button",className:"exchange-card-cancel",disabled:g,onClick:()=>{o()},children:g?"Cancelling…":"Cancel"}):null]})]})}])},90730,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(27828),f=a.i(35099);let g="botmancers:exchanges-navigate";function h(a){return window.addEventListener("popstate",a),window.addEventListener(g,a),()=>{window.removeEventListener("popstate",a),window.removeEventListener(g,a)}}function i(){return new URLSearchParams(window.location.search).get("id")}function j({id:a,onBack:g,onChanged:h}){let[i,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(0),p=(0,c.useRef)(null),q=(0,c.useRef)(!1),r=(0,c.useId)();(0,c.useEffect)(()=>{let b=!1,c=()=>{fetch(`/api/exchanges/${encodeURIComponent(a)}`,{cache:"no-store"}).then(async a=>{let c=await a.json().catch(()=>null);if(!b){if(!a.ok||!c?.detail)return void m(404===a.status?"This exchange no longer exists.":"Could not load this exchange.");m(""),k(c.detail)}}).catch(()=>{b||m("Could not load this exchange.")})};c();let d=setInterval(c,2e3);return()=>{b=!0,clearInterval(d)}},[a,n]),(0,c.useEffect)(()=>{i&&!q.current&&(q.current=!0,p.current?.focus())},[i]);let s=(0,b.jsx)("button",{type:"button",className:"pin-word ledger-detail-back",onClick:g,children:"← All exchanges"});if(!i)return(0,b.jsxs)("div",{className:"ledger-detail",children:[s,l?(0,b.jsxs)("div",{role:"alert",className:"ledger-state",children:[(0,b.jsx)("p",{className:"delete-error",children:l}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>o(a=>a+1),children:"Retry"})]}):(0,b.jsx)("p",{className:"ledger-state",role:"status",children:"Loading exchange…"})]});let{summary:t,events:u,packet:v}=i;return(0,b.jsxs)("article",{className:"ledger-detail","aria-labelledby":r,"data-exchange-detail":t.id,children:[s,(0,b.jsxs)("h2",{id:r,ref:p,tabIndex:-1,className:"ledger-detail-title",children:[(0,f.modeLabel)(t.mode),": ",(0,f.participantsLabel)(t)]}),(0,b.jsx)(e.default,{summary:t,onChanged:()=>{o(a=>a+1),h()}}),(0,b.jsxs)("section",{className:"ledger-section","aria-label":(0,f.instructionHeading)(t.mode),children:[(0,b.jsx)("h3",{className:"ledger-section-title",children:(0,f.instructionHeading)(t.mode)}),(0,b.jsx)("p",{className:"ledger-text",children:t.instruction})]}),i.answer?(0,b.jsxs)("section",{className:"ledger-section","aria-label":"Answer",children:[(0,b.jsx)("h3",{className:"ledger-section-title",children:"Answer"}),(0,b.jsx)("p",{className:"ledger-text",children:i.answer})]}):null,v?(0,b.jsxs)("section",{className:"ledger-section","aria-label":"Handoff packet",children:[(0,b.jsx)("h3",{className:"ledger-section-title",children:"Handoff packet"}),(0,b.jsx)("p",{className:"ledger-text",children:v.objective}),[["Decisions",v.decisions],["Constraints",v.constraints],["Artifacts and references",v.artifacts],["Open questions",v.open_questions]].filter(([,a])=>a.length>0).map(([a,c])=>(0,b.jsxs)("div",{className:"ledger-packet-list",children:[(0,b.jsx)("h4",{className:"ledger-packet-title",children:a}),(0,b.jsx)("ul",{children:c.map((a,c)=>(0,b.jsx)("li",{children:a},c))})]},a))]}):null,(0,b.jsxs)("section",{className:"ledger-section","aria-label":"Linked threads",children:[(0,b.jsx)("h3",{className:"ledger-section-title",children:"Linked threads"}),(0,b.jsx)("ul",{className:"ledger-links",children:t.links.map(a=>{let c=(0,f.threadHref)(a,t.id);return(0,b.jsxs)("li",{children:[c?(0,b.jsx)(d.default,{className:"session-link ledger-thread-link",href:c,children:a.label}):(0,b.jsxs)("span",{children:[a.label,"agent_api"===a.kind?(0,b.jsx)("span",{className:"ledger-link-role",children:" (between Agents, not an owner thread)"}):null]}),(0,b.jsxs)("span",{className:"ledger-link-role",children:[" · ",(0,f.linkRoleLabel)(a.roles)]})]},a.id)})})]}),(0,b.jsxs)("section",{className:"ledger-section","aria-label":"Timeline",children:[(0,b.jsx)("h3",{className:"ledger-section-title",children:"Timeline"}),(0,b.jsx)("ol",{className:"ledger-timeline",children:u.map(a=>(0,b.jsxs)("li",{"data-event-type":a.type,children:[(0,b.jsx)("span",{className:"ledger-timeline-time",children:(0,f.formatExchangeTime)(a.at)}),(0,b.jsx)("span",{className:"ledger-timeline-text",children:(0,f.eventLabel)(a,t)})]},a.sequence))})]}),(0,b.jsxs)("p",{className:"ledger-foot",children:[(0,f.excerpt)(`${t.source.agent_name}’s session: ${t.source.session_title}`,200),t.destination?.session_title?` \xb7 ${t.destination.agent_name}’s new session: ${t.destination.session_title}`:""]})]})}a.s(["default",0,function(){let[a,e]=(0,c.useState)(null),[k,l]=(0,c.useState)(""),[m,n]=(0,c.useState)(0),[o,p]=(0,c.useState)(f.DEFAULT_LEDGER_FILTER),q=(0,c.useSyncExternalStore)(h,i,()=>null),r=(0,c.useId)(),s=(0,c.useId)(),t=(0,c.useId)(),u=(0,c.useRef)(null),v=(0,c.useRef)(null);(0,c.useEffect)(()=>{let a=v.current;if(v.current=q,q||!a)return;let b=document.querySelector(`.ledger-row[data-exchange-id="${CSS.escape(a)}"]`);(b??u.current)?.focus()},[q]),(0,c.useEffect)(()=>{let a=!1,b=()=>{fetch("/api/exchanges",{cache:"no-store"}).then(async b=>{let c=await b.json().catch(()=>null);if(!a){if(!b.ok||!Array.isArray(c?.exchanges))return void l("string"==typeof c?.error?.message?c.error.message:"Could not load exchanges.");l(""),e(c.exchanges)}}).catch(()=>{a||l("Could not load exchanges.")})};b();let c=setInterval(b,2e3);return()=>{a=!0,clearInterval(c)}},[m]);let w=a=>{window.history.pushState(null,"",a?`/exchanges?id=${encodeURIComponent(a)}`:"/exchanges"),window.dispatchEvent(new Event(g))},x=a?(0,f.ledgerRows)(a,o):[],y=(0,f.ledgerView)(a,a?"":k,x),z=a?(0,f.ledgerAgents)(a):[];return(0,b.jsxs)("div",{className:q?"ledger-page has-detail":"ledger-page",children:[(0,b.jsxs)("header",{className:"ledger-head",children:[(0,b.jsx)(d.default,{href:"/",className:"cfg-link ledger-back",children:"← Back to chat"}),(0,b.jsx)("h1",{className:"ledger-title",children:"Agent Exchanges"}),(0,b.jsx)("p",{className:"ledger-sub",children:"Every Ask and Continue between Agent sessions, newest activity first."})]}),(0,b.jsxs)("main",{className:"ledger-main",children:[(0,b.jsxs)("section",{className:"ledger-list-pane","aria-labelledby":t,children:[(0,b.jsx)("h2",{id:t,ref:u,tabIndex:-1,className:"ledger-pane-title",children:"Exchanges"}),(0,b.jsxs)("div",{className:"ledger-filters",children:[(0,b.jsx)("div",{className:"sessions-filter ledger-mode",role:"group","aria-label":"Mode",children:f.MODE_FILTER_OPTIONS.map(a=>(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn","aria-pressed":o.mode===a.value,onClick:()=>p(b=>({...b,mode:a.value})),children:a.label},a.value))}),(0,b.jsxs)("div",{className:"ledger-selects",children:[(0,b.jsxs)("label",{className:"ledger-select-label",htmlFor:r,children:["Status",(0,b.jsx)("select",{id:r,className:"exchange-select",value:o.state,onChange:a=>p(b=>({...b,state:a.target.value})),children:f.STATE_FILTER_OPTIONS.map(a=>(0,b.jsx)("option",{value:a.value,children:a.label},a.value))})]}),(0,b.jsxs)("label",{className:"ledger-select-label",htmlFor:s,children:["Agent",(0,b.jsxs)("select",{id:s,className:"exchange-select",value:o.agentId,onChange:a=>p(b=>({...b,agentId:a.target.value})),children:[(0,b.jsx)("option",{value:"",children:"Any Agent"}),z.map(a=>(0,b.jsx)("option",{value:a.id,children:a.name},a.id))]})]})]}),(0,b.jsx)("p",{className:"manage-count ledger-count",role:"status",children:a?`${x.length} of ${a.length} shown`:""})]}),"loading"===y?(0,b.jsx)("p",{className:"ledger-state",role:"status","data-ledger-state":"loading",children:"Loading exchanges…"}):null,"error"===y?(0,b.jsxs)("div",{className:"ledger-state",role:"alert","data-ledger-state":"error",children:[(0,b.jsx)("p",{className:"delete-error",children:k}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{l(""),n(a=>a+1)},children:"Retry"})]}):null,"empty"===y?(0,b.jsx)("p",{className:"ledger-state","data-ledger-state":"empty",children:"No exchanges yet. Open an Agent’s Sessions and choose Ask from this context or Hand off to… to start one."}):null,"filtered-out"===y?(0,b.jsxs)("div",{className:"ledger-state","data-ledger-state":"filtered-out",children:[(0,b.jsx)("p",{children:"No exchanges match these filters."}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>p(f.DEFAULT_LEDGER_FILTER),children:"Clear filters"})]}):null,"rows"===y?(0,b.jsx)("ol",{className:"ledger-list","aria-label":"Exchanges, newest activity first",children:x.map(a=>(0,b.jsx)("li",{className:"ledger-row-item",children:(0,b.jsxs)("button",{type:"button",className:`ledger-row is-${(0,f.stateTone)(a.state)}`,"data-exchange-id":a.id,"aria-current":q===a.id?"true":void 0,onClick:()=>w(a.id),children:[(0,b.jsxs)("span",{className:"ledger-row-line",children:[(0,b.jsx)("span",{className:"exchange-card-mode",children:(0,f.modeLabel)(a.mode)}),(0,b.jsx)("span",{className:"ledger-row-who",children:(0,f.participantsLabel)(a)}),(0,b.jsx)("span",{className:"ledger-row-state",children:(0,f.liveStateLabel)(a)})]}),(0,b.jsx)("span",{className:"ledger-row-session",children:a.source.session_title}),(0,b.jsxs)("span",{className:"ledger-row-meta",children:["From ",a.origin?.label??"an unknown thread"," · Started ",(0,f.formatExchangeTime)(a.created_at)," · Updated ",(0,f.formatExchangeTime)(a.updated_at)]})]})},a.id))}):null]}),(0,b.jsx)("section",{className:"ledger-detail-pane","aria-label":"Exchange detail",children:q?(0,b.jsx)(j,{id:q,onBack:()=>w(null),onChanged:()=>n(a=>a+1)},q):(0,b.jsx)("p",{className:"ledger-state ledger-placeholder",children:"Choose an exchange to see its timeline and linked threads."})})]})]})}])}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=app_1-nwnha._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[66385,a=>{"use strict";a.s(["default",()=>c,"useAgentOverview",()=>d]);var b=a.i(11857);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call the default export of [project]/app/agents/[id]/AgentShell.tsx from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/app/agents/[id]/AgentShell.tsx","default"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useAgentOverview() from the server but useAgentOverview is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/app/agents/[id]/AgentShell.tsx","useAgentOverview")},54133,a=>{"use strict";var b=a.i(66385);a.n(b)},81402,a=>{"use strict";var b=a.i(7997),c=a.i(54133);a.s(["default",0,function({children:a}){return(0,b.jsx)(c.default,{children:a})}])},16875,function(a){a.n(a.i(81402))}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=app_agents_%5Bid%5D_009y8_j._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[10932,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(15722);let f=[{value:"all",label:"All"},{value:"sessions",label:"Sessions"},{value:"conversations",label:"Conversations & exchanges"},{value:"slack",label:"Slack"},{value:"errors",label:"Errors"}],g={filter:"all",requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1};function h(a,b){return"select_filter"===b.type?{...a,filter:b.filter,requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_started"===b.type?{...a,requestKey:b.key,activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_succeeded"===b.type?b.key===a.requestKey?{...a,activity:{state:"ready",items:b.items},nextCursor:b.nextCursor}:a:"request_failed"===b.type?b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null}:a:"load_started"===b.type?b.key===a.requestKey?{...a,loadingMore:!0}:a:"load_succeeded"===b.type&&b.key===a.requestKey&&"ready"===a.activity.state?{...a,activity:{state:"ready",items:[...a.activity.items,...b.items]},nextCursor:b.nextCursor,loadingMore:!1}:"load_failed"===b.type&&b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null,loadingMore:!1}:a}function i(a,b,c=null){let d=new URLSearchParams({filter:b,limit:String(20)});return c&&d.set("cursor",c),`/api/bots/${encodeURIComponent(a)}/activity?${d.toString()}`}function j({items:a,compact:d=!1}){return(0,b.jsx)("ol",{className:d?"agent-activity-list is-compact":"agent-activity-list","aria-label":"Agent activity, newest first",children:a.map(a=>(0,b.jsxs)("li",{className:`agent-activity-item is-${a.severity}`,"data-activity-kind":a.kind,children:[(0,b.jsx)("span",{className:"agent-activity-marker","aria-hidden":"true"}),(0,b.jsxs)("div",{className:"agent-activity-card",children:[(0,b.jsxs)("div",{className:"agent-activity-summary",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"agent-activity-category",children:"conversations"===a.category?"Conversations & exchanges":a.category}),(0,b.jsx)("strong",{children:a.summary}),(0,b.jsx)("time",{dateTime:new Date(a.occurred_at).toISOString(),children:new Date(a.occurred_at).toLocaleString()})]}),a.attention?(0,b.jsx)("span",{className:"agent-activity-attention",children:"Needs attention"}):null]}),(0,b.jsx)("div",{className:"agent-activity-actions",children:(0,b.jsx)(c.default,{href:a.target.href,children:a.target.label})}),!d&&Object.keys(a.details).length?(0,b.jsxs)("details",{className:"agent-activity-details",children:[(0,b.jsx)("summary",{children:"Raw details"}),(0,b.jsx)("dl",{children:Object.entries(a.details).map(([a,c])=>(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:a.replaceAll("_"," ")}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{children:String(c)})})]},a))}),(0,b.jsx)("p",{children:"Safe structured fields only. Provider transcripts and identifiers are excluded."})]}):null]})]},a.id))})}function k({activity:a,filter:c,nextCursor:d,loadingMore:e,onLoadMore:g}){return(0,b.jsxs)(b.Fragment,{children:["loading"===a.state?(0,b.jsx)("p",{className:"agent-activity-state",role:"status",children:"Loading activity…"}):null,"error"===a.state?(0,b.jsxs)("div",{className:"agent-activity-state is-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"No partial or stale timeline is shown. Refresh to try again."})]}):null,"ready"!==a.state||a.items.length?null:(0,b.jsx)("p",{className:"agent-activity-state",children:"all"===c?"No operational activity has been recorded for this Agent yet.":`No ${f.find(a=>a.value===c)?.label.toLowerCase()} activity matches this filter.`}),"ready"===a.state&&a.items.length?(0,b.jsx)(j,{items:a.items}):null,"ready"===a.state&&d?(0,b.jsx)("button",{type:"button",className:"agent-activity-more",onClick:g,disabled:e,children:e?"Loading…":"Load older activity"}):null]})}a.s(["ActivityList",0,j,"ActivityResults",0,k,"activityPageReducer",0,h,"agentActivityUrl",0,i,"default",0,function(){let{id:a,overview:j,loading:l,error:m,notFound:n}=(0,e.useAgentOverview)(),[o,p]=(0,d.useReducer)(h,g),{filter:q,activity:r,nextCursor:s,loadingMore:t}=o,u=(0,d.useRef)(0),v=(0,d.useCallback)((b=null)=>i(a,q,b),[q,a]);(0,d.useEffect)(()=>{let b=!1,c=++u.current,d=`${a}:${q}:${c}`;return p({type:"request_started",key:d}),fetch(v(),{cache:"no-store"}).then(async a=>{let e=await a.json().catch(()=>null);if(!a.ok||!Array.isArray(e?.activity))throw Error("activity");b||c!==u.current||p({type:"request_succeeded",key:d,items:e.activity,nextCursor:"string"==typeof e.next_cursor?e.next_cursor:null})}).catch(()=>{b||c!==u.current||p({type:"request_failed",key:d})}),()=>{b=!0}},[q,a,v]);let w=async()=>{if(!s||"ready"!==r.state||t)return;let a=o.requestKey;p({type:"load_started",key:a});try{let b=await fetch(v(s),{cache:"no-store"}),c=await b.json().catch(()=>null);if(!b.ok||!Array.isArray(c?.activity))throw Error("activity");p({type:"load_succeeded",key:a,items:c.activity,nextCursor:"string"==typeof c.next_cursor?c.next_cursor:null})}catch{p({type:"load_failed",key:a})}};return l?(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading Agent activity…"}):n?(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an Agent"})]}):m||!j?(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent."})]}):(0,b.jsxs)("div",{className:"agent-activity","data-agent-activity-page":!0,children:[(0,b.jsxs)("header",{className:"agent-activity-intro",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Activity"}),(0,b.jsxs)("h2",{children:["What changed for ",j.agent.name]}),(0,b.jsx)("p",{children:"Operational history from Botmancers records. Open the owning page for actions and complete detail."})]}),(0,b.jsx)("div",{className:"agent-activity-filters",role:"group","aria-label":"Filter Agent activity",children:f.map(a=>(0,b.jsx)("button",{type:"button","aria-pressed":q===a.value,onClick:()=>p({type:"select_filter",filter:a.value}),children:a.label},a.value))}),(0,b.jsx)(k,{activity:r,filter:q,nextCursor:s,loadingMore:t,onLoadMore:()=>{w()}})]})},"initialActivityPageState",0,g],10932)},88204,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(15722),e=a.i(22151),f=a.i(10932);let g={"agents:read":"Discoverable to connected coding agents","sessions:read":"Session history","conversations:read":"Conversation history","sessions:message":"Session messaging","shares:create":"Slack session sharing"};function h({rows:a,empty:c}){return a.length?(0,b.jsx)("ul",{className:"agent-work-list",children:a.map(a=>(0,b.jsx)("li",{children:(0,b.jsxs)("span",{children:[(0,b.jsx)("strong",{children:a.title}),(0,b.jsxs)("small",{children:["active"===a.status?"Active now":"Recent"," · ",new Date(a.last_activity_at).toLocaleString()]})]})},a.ref))}):(0,b.jsx)("p",{className:"agent-empty",children:c})}a.s(["default",0,function(){let{id:a,overview:i,loading:j,error:k,notFound:l}=(0,d.useAgentOverview)();if(j)return(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading Agent overview…"});if(l)return(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)("p",{children:"This Agent does not exist or was removed."}),(0,b.jsx)(c.default,{href:"/",children:"Choose an Agent"})]});if(k||!i)return(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Overview unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent. Refresh to try again."})]});let m=`/bots/${encodeURIComponent(a)}/config`,n=i.conversation?`/agents/${encodeURIComponent(a)}/conversations/${encodeURIComponent(i.conversation.id)}`:`/agents/${encodeURIComponent(a)}/conversations`,o=i.messaging.home_session_ref?"Home session configured":i.messaging.new_sessions_allowed&&i.messaging.default_workspace_set?"Can start a configured session":i.current_work.length>0?"Uses an eligible existing session":"No ready session is known";return(0,b.jsxs)("div",{className:"agent-overview","data-agent-overview":!0,children:[(0,b.jsxs)("section",{className:"agent-hero",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Overview"}),(0,b.jsx)("h2",{children:i.agent.role}),(0,b.jsx)("ul",{className:"agent-capabilities","aria-label":"Capabilities",children:i.capabilities.map(a=>(0,b.jsx)("li",{children:g[a]||a},a))})]}),(0,b.jsxs)("div",{className:"agent-overview-grid",children:[(0,b.jsxs)("section",{className:"agent-panel agent-instructions",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Standing instructions"}),(0,b.jsx)("h2",{children:"How this Agent works"})]}),(0,b.jsx)(c.default,{href:m,children:"Full Config"})]}),(0,b.jsxs)("dl",{children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Rules"}),(0,b.jsx)("dd",{children:i.instructions.rules})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Skill"}),(0,b.jsx)("dd",{children:i.instructions.skill})]})]})]}),(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Runtime"}),(0,b.jsx)("h2",{children:i.runtime.available?"Ready to work":"Setup required"})]}),(0,b.jsx)(c.default,{href:m,children:"Config"})]}),(0,b.jsx)("p",{children:i.runtime.available?`${(0,e.agentLabel)(i.runtime.agent)} is connected through ${i.runtime.connection||"the configured runtime"}.`:"This Agent cannot launch with its current registration. Open Config to resolve the connection or session scope."}),(0,b.jsxs)("dl",{className:"agent-runtime-facts",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Heartbeat"}),(0,b.jsx)("dd",{children:i.runtime.last_seen?new Date(i.runtime.last_seen).toLocaleString():"Not reported"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Messaging"}),(0,b.jsx)("dd",{children:o})]})]}),(0,b.jsx)("p",{className:"agent-muted",children:"Messages use the Agent’s configured home session or launch policy. Callers do not choose its runtime, model, or provider session."})]})]}),(0,b.jsxs)("section",{className:"agent-use","aria-labelledby":"use-this-agent",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Start here"}),(0,b.jsx)("h2",{id:"use-this-agent",children:"Use this Agent"}),(0,b.jsxs)("div",{className:"agent-use-grid",children:[(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"01"}),(0,b.jsx)("h3",{children:"Message in Botmancers"}),(0,b.jsxs)("p",{children:["Open a focused conversation when you want to talk directly with ",i.agent.name,"."]}),(0,b.jsx)(c.default,{className:"agent-primary-action",href:n,children:"Open conversation"})]}),(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"02"}),(0,b.jsx)("h3",{children:"Use from a coding agent"}),(0,b.jsxs)("p",{children:["Connect your coding agent to ",(0,b.jsx)("code",{children:"POST /api/v0/mcp"}),", then call ",(0,b.jsx)("code",{children:"botmancers_capabilities"})," and ",(0,b.jsx)("code",{children:"botmancers_list_agents"})," before messaging."]}),(0,b.jsx)("a",{href:"https://github.com/not-so-fat/botmancers/blob/main/packages/mcp-server/README.md#client-setup-and-the-collaboration-skill",target:"_blank",rel:"noreferrer",children:"Open bridge setup guidance"})]}),(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"03"}),(0,b.jsx)("h3",{children:"Share a session to Slack"}),(0,b.jsx)("p",{children:"Choose one of this Agent’s sessions and create a time-limited, read-only Slack share."}),(0,b.jsx)(c.default,{href:`/agents/${encodeURIComponent(a)}/slack`,children:"Share through Slack"})]})]})]}),(0,b.jsxs)("div",{className:"agent-overview-grid agent-work-grid",children:[(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Current work"}),(0,b.jsx)("h2",{children:"Active sessions"})]}),(0,b.jsx)(c.default,{href:`/agents/${encodeURIComponent(a)}/sessions`,children:"All sessions"})]}),(0,b.jsx)(h,{rows:i.current_work,empty:"No active work right now."})]}),(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Recent activity"}),(0,b.jsx)("h2",{children:"Latest work"})]}),(0,b.jsx)(c.default,{href:`/agents/${encodeURIComponent(a)}/activity`,children:"View activity"})]}),i.recent_activity.length?(0,b.jsx)(f.ActivityList,{items:i.recent_activity,compact:!0}):(0,b.jsx)("p",{className:"agent-empty",children:"No operational activity yet."})]})]})]})}])}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=app_agents_%5Bid%5D_0sr4fdg._.js.map
|
package/app/.next/server/chunks/ssr/app_agents_[id]_activity_AgentActivityPage_tsx_042-590._.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[10932,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(15722);let f=[{value:"all",label:"All"},{value:"sessions",label:"Sessions"},{value:"conversations",label:"Conversations & exchanges"},{value:"slack",label:"Slack"},{value:"errors",label:"Errors"}],g={filter:"all",requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1};function h(a,b){return"select_filter"===b.type?{...a,filter:b.filter,requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_started"===b.type?{...a,requestKey:b.key,activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_succeeded"===b.type?b.key===a.requestKey?{...a,activity:{state:"ready",items:b.items},nextCursor:b.nextCursor}:a:"request_failed"===b.type?b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null}:a:"load_started"===b.type?b.key===a.requestKey?{...a,loadingMore:!0}:a:"load_succeeded"===b.type&&b.key===a.requestKey&&"ready"===a.activity.state?{...a,activity:{state:"ready",items:[...a.activity.items,...b.items]},nextCursor:b.nextCursor,loadingMore:!1}:"load_failed"===b.type&&b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null,loadingMore:!1}:a}function i(a,b,c=null){let d=new URLSearchParams({filter:b,limit:String(20)});return c&&d.set("cursor",c),`/api/bots/${encodeURIComponent(a)}/activity?${d.toString()}`}function j({items:a,compact:d=!1}){return(0,b.jsx)("ol",{className:d?"agent-activity-list is-compact":"agent-activity-list","aria-label":"Agent activity, newest first",children:a.map(a=>(0,b.jsxs)("li",{className:`agent-activity-item is-${a.severity}`,"data-activity-kind":a.kind,children:[(0,b.jsx)("span",{className:"agent-activity-marker","aria-hidden":"true"}),(0,b.jsxs)("div",{className:"agent-activity-card",children:[(0,b.jsxs)("div",{className:"agent-activity-summary",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"agent-activity-category",children:"conversations"===a.category?"Conversations & exchanges":a.category}),(0,b.jsx)("strong",{children:a.summary}),(0,b.jsx)("time",{dateTime:new Date(a.occurred_at).toISOString(),children:new Date(a.occurred_at).toLocaleString()})]}),a.attention?(0,b.jsx)("span",{className:"agent-activity-attention",children:"Needs attention"}):null]}),(0,b.jsx)("div",{className:"agent-activity-actions",children:(0,b.jsx)(c.default,{href:a.target.href,children:a.target.label})}),!d&&Object.keys(a.details).length?(0,b.jsxs)("details",{className:"agent-activity-details",children:[(0,b.jsx)("summary",{children:"Raw details"}),(0,b.jsx)("dl",{children:Object.entries(a.details).map(([a,c])=>(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:a.replaceAll("_"," ")}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{children:String(c)})})]},a))}),(0,b.jsx)("p",{children:"Safe structured fields only. Provider transcripts and identifiers are excluded."})]}):null]})]},a.id))})}function k({activity:a,filter:c,nextCursor:d,loadingMore:e,onLoadMore:g}){return(0,b.jsxs)(b.Fragment,{children:["loading"===a.state?(0,b.jsx)("p",{className:"agent-activity-state",role:"status",children:"Loading activity…"}):null,"error"===a.state?(0,b.jsxs)("div",{className:"agent-activity-state is-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"No partial or stale timeline is shown. Refresh to try again."})]}):null,"ready"!==a.state||a.items.length?null:(0,b.jsx)("p",{className:"agent-activity-state",children:"all"===c?"No operational activity has been recorded for this Agent yet.":`No ${f.find(a=>a.value===c)?.label.toLowerCase()} activity matches this filter.`}),"ready"===a.state&&a.items.length?(0,b.jsx)(j,{items:a.items}):null,"ready"===a.state&&d?(0,b.jsx)("button",{type:"button",className:"agent-activity-more",onClick:g,disabled:e,children:e?"Loading…":"Load older activity"}):null]})}a.s(["ActivityList",0,j,"ActivityResults",0,k,"activityPageReducer",0,h,"agentActivityUrl",0,i,"default",0,function(){let{id:a,overview:j,loading:l,error:m,notFound:n}=(0,e.useAgentOverview)(),[o,p]=(0,d.useReducer)(h,g),{filter:q,activity:r,nextCursor:s,loadingMore:t}=o,u=(0,d.useRef)(0),v=(0,d.useCallback)((b=null)=>i(a,q,b),[q,a]);(0,d.useEffect)(()=>{let b=!1,c=++u.current,d=`${a}:${q}:${c}`;return p({type:"request_started",key:d}),fetch(v(),{cache:"no-store"}).then(async a=>{let e=await a.json().catch(()=>null);if(!a.ok||!Array.isArray(e?.activity))throw Error("activity");b||c!==u.current||p({type:"request_succeeded",key:d,items:e.activity,nextCursor:"string"==typeof e.next_cursor?e.next_cursor:null})}).catch(()=>{b||c!==u.current||p({type:"request_failed",key:d})}),()=>{b=!0}},[q,a,v]);let w=async()=>{if(!s||"ready"!==r.state||t)return;let a=o.requestKey;p({type:"load_started",key:a});try{let b=await fetch(v(s),{cache:"no-store"}),c=await b.json().catch(()=>null);if(!b.ok||!Array.isArray(c?.activity))throw Error("activity");p({type:"load_succeeded",key:a,items:c.activity,nextCursor:"string"==typeof c.next_cursor?c.next_cursor:null})}catch{p({type:"load_failed",key:a})}};return l?(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading Agent activity…"}):n?(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an Agent"})]}):m||!j?(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent."})]}):(0,b.jsxs)("div",{className:"agent-activity","data-agent-activity-page":!0,children:[(0,b.jsxs)("header",{className:"agent-activity-intro",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Activity"}),(0,b.jsxs)("h2",{children:["What changed for ",j.agent.name]}),(0,b.jsx)("p",{children:"Operational history from Botmancers records. Open the owning page for actions and complete detail."})]}),(0,b.jsx)("div",{className:"agent-activity-filters",role:"group","aria-label":"Filter Agent activity",children:f.map(a=>(0,b.jsx)("button",{type:"button","aria-pressed":q===a.value,onClick:()=>p({type:"select_filter",filter:a.value}),children:a.label},a.value))}),(0,b.jsx)(k,{activity:r,filter:q,nextCursor:s,loadingMore:t,onLoadMore:()=>{w()}})]})},"initialActivityPageState",0,g],10932)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=app_agents_%5Bid%5D_activity_AgentActivityPage_tsx_042-590._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[98295,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(15722);a.s(["default",0,function(){let{id:a,overview:f,loading:g,error:h,notFound:i}=(0,e.useAgentOverview)(),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(null),[n,o]=(0,c.useState)(""),[p,q]=(0,c.useState)(""),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(!1),[v,w]=(0,c.useState)(0),x=(0,c.useCallback)(async(b,c)=>{if(a){c&&u(!0);try{let d=new URLSearchParams({limit:"30"});p&&d.set("q",p),b&&d.set("cursor",b);let e=await fetch(`/api/bots/${encodeURIComponent(a)}/conversations?${d}`,{cache:"no-store"}),f=await e.json().catch(()=>null);if(!e.ok||!f||!Array.isArray(f.conversations))throw Error("load");k(a=>c&&a?[...a,...f.conversations]:f.conversations),m(f.next_cursor),s("")}catch{s("Could not load conversations.")}finally{u(!1)}}},[p,a]);return((0,c.useEffect)(()=>{let a=window.setTimeout(()=>{k(null),x(null,!1)},0);return()=>window.clearTimeout(a)},[x,v]),g)?(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading Agent conversations…"}):i?(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(d.default,{href:"/",children:"Choose an Agent"})]}):h||!f?(0,b.jsx)("div",{className:"agent-state",role:"alert",children:"This Agent’s conversations are unavailable."}):(0,b.jsxs)("div",{className:"conversation-index","data-agent-conversations":!0,children:[(0,b.jsxs)("header",{className:"conversation-index-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Conversations"}),(0,b.jsx)("h2",{children:"Durable history"}),(0,b.jsxs)("p",{children:["Direct messages, group rooms, Agent handoffs, and connected-service conversations involving ",f.agent.name,"."]})]}),f.conversation?(0,b.jsxs)(d.default,{className:"agent-primary-action",href:`/agents/${encodeURIComponent(a)}/conversations/${encodeURIComponent(f.conversation.id)}`,children:["Message ",f.agent.name]}):null]}),(0,b.jsxs)("form",{className:"conversation-search",role:"search",onSubmit:a=>{a.preventDefault(),q(n.trim())},children:[(0,b.jsx)("label",{htmlFor:"conversation-query",children:"Search conversations"}),(0,b.jsxs)("div",{children:[(0,b.jsx)("input",{id:"conversation-query",value:n,onChange:a=>o(a.target.value),placeholder:"Participant, origin, or type"}),(0,b.jsx)("button",{type:"submit",children:"Search"})]})]}),null!==j||r?null:(0,b.jsx)("p",{className:"conversation-state",role:"status","data-conversation-state":"loading",children:"Loading conversations…"}),r?(0,b.jsxs)("div",{className:"conversation-state",role:"alert","data-conversation-state":"error",children:[(0,b.jsx)("p",{children:r}),(0,b.jsx)("button",{type:"button",onClick:()=>w(a=>a+1),children:"Retry"})]}):null,j?.length!==0||r?null:(0,b.jsx)("p",{className:"conversation-state","data-conversation-state":"empty",children:p?"No conversations match this search.":"No conversations involve this Agent yet."}),j&&j.length>0?(0,b.jsx)("ol",{className:"conversation-list","aria-label":"Conversations, newest activity first",children:j.map(c=>(0,b.jsx)("li",{children:(0,b.jsxs)(d.default,{href:`/agents/${encodeURIComponent(a)}/conversations/${encodeURIComponent(c.conversation_id)}`,children:[(0,b.jsxs)("span",{className:"conversation-row-title",children:[(0,b.jsx)("strong",{children:c.label}),(0,b.jsx)("span",{children:"direct"===c.type?"Direct":"group"===c.type?"Group":c.origin?.kind==="service"?"External service":"Agent to Agent"})]}),(0,b.jsx)("span",{className:"conversation-row-participants",children:c.participants.map(a=>a.label).join(" · ")}),(0,b.jsxs)("span",{className:"conversation-row-meta",children:[(0,b.jsxs)("span",{children:["Origin: ",c.origin?.label??"Unknown"]}),(0,b.jsxs)("span",{children:[c.message_count," ",1===c.message_count?"message":"messages"]}),(0,b.jsx)("time",{dateTime:new Date(c.last_activity_at).toISOString(),children:new Date(c.last_activity_at).toLocaleString()})]})]})},c.conversation_id))}):null,l&&j&&!r?(0,b.jsx)("button",{className:"conversation-more",type:"button",disabled:t,onClick:()=>void x(l,!0),children:t?"Loading…":"Load older conversations"}):null]})}])}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=app_agents_%5Bid%5D_conversations_page_tsx_15zl_c8._.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
module.exports=[26847,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(50944),f=a.i(65221),g=a.i(22151),h=a.i(10209),i=a.i(35099);function j({mode:a,session:c,agents:e,origin:g,onClose:k,onStarted:l}){let m=(0,d.useId)(),n=(0,d.useId)(),o=(0,d.useId)(),p=(0,d.useId)(),[q,r]=(0,d.useState)(""),[s,t]=(0,d.useState)(""),[u,v]=(0,d.useState)(!1),[w,x]=(0,d.useState)({}),[y,z]=(0,d.useState)(""),[A,B]=(0,d.useState)(!1),C=(0,d.useRef)(!1),D=(0,d.useRef)(null),E=(0,d.useRef)(null),F=(0,d.useRef)(null),G=(0,d.useRef)(null),H=(0,d.useRef)(null),I=(0,i.sessionDialogUsesPin)(a,c.route),J=e.filter(a=>a.id!==c.agent.id);(0,d.useEffect)(()=>{("continue"===a?G.current:F.current)?.focus()},[a]),(0,d.useEffect)(()=>{let a=a=>{"Escape"===a.key&&(a.stopPropagation(),k())};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[k]);let K=async b=>{if(b.preventDefault(),C.current)return;let d={mode:"resume"===a?"ask":a,instruction:q,originConversationId:g.conversationId,destinationAgentId:s},e="resume"===a?(0,i.validateResumeDraft)(q,u):(0,i.validateDraft)(d);if(x(e),Object.keys(e).length>0)return void(e.destination?G.current?.focus():e.instruction?F.current?.focus():H.current?.focus());let f="resume"===a?"resume":"ask",h=a=>I?(0,i.pinRequestBody)(f,q,g.conversationId,u,a):(0,i.exchangeRequestBody)(d,{agentId:c.agent.id,sessionRef:c.ref},a),j=JSON.stringify(h(""));D.current&&D.current.payload===j||(D.current={payload:j,key:crypto.randomUUID()}),C.current=!0,B(!0),z("");try{let a=I?`/api/bots/${encodeURIComponent(c.agent.id)}/sessions/${encodeURIComponent(c.ref)}/pins`:"/api/exchanges",b=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h(D.current.key))}),d=await b.json().catch(()=>null);if(!b.ok){let a="string"==typeof d?.error?.code?d.error.code:null;"idempotency_conflict"===a&&(D.current=null),z((0,i.submitErrorMessage)(a,"string"==typeof d?.error?.message?d.error.message:null));return}let e=I?d?.turn?.exchange_id:d?.exchange?.id;l("string"==typeof e?e:null)}catch{z((0,i.submitErrorMessage)(null,"Botmancers could not be reached. Your draft is kept; try again."))}finally{C.current=!1,B(!1)}},L=J.find(a=>a.id===s)?.name,M="ask"===a,N="resume"===a;return(0,b.jsx)("div",{className:"modal-scrim exchange-scrim",onMouseDown:a=>{a.target===a.currentTarget&&k()},onKeyDown:a=>{if("Tab"!==a.key||!E.current)return;let b=Array.from(E.current.querySelectorAll(h.DIALOG_FOCUSABLE)),c=(0,h.wrapFocusTarget)(b,document.activeElement,a.shiftKey);c&&(a.preventDefault(),c.focus())},children:(0,b.jsxs)("div",{ref:E,className:"form-card exchange-dialog",role:"dialog","aria-modal":"true","aria-labelledby":m,"data-exchange-mode":a,children:[(0,b.jsx)("h2",{id:m,className:"delete-title",children:(0,i.sessionDialogTitle)(a)}),(0,b.jsxs)("section",{className:"exchange-source","aria-label":"Source session",children:[(0,b.jsx)("p",{className:"exchange-source-agent",children:c.agent.name}),(0,b.jsx)("p",{className:"exchange-source-title",children:c.title}),(0,b.jsxs)("p",{className:"exchange-source-meta",children:["Last activity ",(0,f.formatSessionDate)(c.last_activity_at),c.origin.conversation?` \xb7 from ${c.origin.conversation.label}`:""]})]}),(0,b.jsxs)("form",{onSubmit:K,noValidate:!0,className:"exchange-form",children:[M||N?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("label",{htmlFor:o,children:"Hand off to"}),(0,b.jsxs)("select",{ref:G,id:o,className:"exchange-select",value:s,"aria-invalid":!!w.destination||void 0,"aria-describedby":w.destination?`${o}-error`:void 0,disabled:A,onChange:a=>{t(a.target.value),x(a=>({...a,destination:void 0}))},children:[(0,b.jsx)("option",{value:"",children:"Choose an Agent"}),J.map(a=>(0,b.jsx)("option",{value:a.id,children:a.name},a.id))]}),w.destination?(0,b.jsx)("p",{id:`${o}-error`,className:"exchange-field-error",children:w.destination}):null]}),(0,b.jsx)("label",{htmlFor:n,children:M?"Question":N?"Instruction":"Objective"}),(0,b.jsx)("textarea",{ref:F,id:n,rows:4,maxLength:i.INSTRUCTION_LIMIT,value:q,readOnly:A,"aria-invalid":!!w.instruction||void 0,"aria-describedby":`${n}-hint${w.instruction?` ${n}-error`:""}`,onChange:a=>{r(a.target.value),x(a=>({...a,instruction:void 0}))}}),w.instruction?(0,b.jsx)("p",{id:`${n}-error`,className:"exchange-field-error",children:w.instruction}):null,(0,b.jsx)("p",{id:`${n}-hint`,className:"exchange-hint",children:M?`${c.agent.name} answers from this exact session, read-only. The answer arrives in ${g.label}.`:N?`${c.agent.name} resumes work in this exact session and may edit its workspace. The turn never moves to another session. Progress shows in ${g.label}.`:`${L??"The Agent you choose"} receives an extracted handoff (objective, decisions, constraints, references, open questions) and starts a new session of its own. ${c.agent.name}’s session is not shared and is not changed. Progress shows in ${g.label}.`}),N?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("label",{className:"exchange-approval",htmlFor:p,children:[(0,b.jsx)("input",{ref:H,id:p,type:"checkbox",checked:u,disabled:A,"aria-invalid":!!w.approval||void 0,"aria-describedby":w.approval?`${p}-error`:void 0,onChange:a=>{v(a.target.checked),x(a=>({...a,approval:void 0}))}})," ","I approve edits by ",c.agent.name," in this session"]}),w.approval?(0,b.jsx)("p",{id:`${p}-error`,className:"exchange-field-error",children:w.approval}):null]}):null,y?(0,b.jsx)("p",{className:"exchange-server-error",role:"alert",children:y}):null,(0,b.jsx)("p",{className:"exchange-sending",role:"status",children:A?"Sending…":""}),(0,b.jsxs)("div",{className:"form-actions",children:[(0,b.jsx)("button",{type:"button",className:"cancel-btn",onClick:k,children:"Cancel"}),(0,b.jsx)("button",{type:"submit",className:"create-btn",disabled:A,"aria-disabled":A,children:y?"Try again":"Send"})]})]})]})})}var k=a.i(23464);function l(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?`owner-share-${crypto.randomUUID()}`:`owner-share-${Date.now()}-${Math.random().toString(36).slice(2)}`}function m({row:a,shares:e,policy:f,onChanged:g}){let h=(0,d.useId)(),[i,j]=(0,d.useState)(!1),[l,p]=(0,d.useState)(!1),q=e?(0,k.sessionShares)(e,a.ref):[],r=q.filter(k.shareIsLive),s=q.filter(a=>!(0,k.shareIsLive)(a)),t="loading"===f,u="loading"===f?null:f,v=t?null:(0,k.shareCreateAvailability)(a,u),w=l?s:s.slice(0,3*!r.length);return(0,b.jsxs)("section",{className:"session-shares","aria-labelledby":h,"data-session-shares":a.ref,children:[(0,b.jsxs)("div",{className:"session-shares-head",children:[(0,b.jsx)("h3",{id:h,className:"session-shares-title",children:"Slack share"}),v?.available&&!i?(0,b.jsx)("button",{type:"button",className:"session-action","data-share-action":"create",onClick:()=>j(!0),children:"Share to Slack"}):null]}),t?(0,b.jsx)("p",{className:"session-share-note session-share-loading",role:"status",children:"Checking the share policy…"}):null,v&&!v.available?(0,b.jsxs)("p",{className:"session-share-unavailable",children:[v.reason," ",v.configHref?(0,b.jsx)(c.default,{className:"session-link",href:v.configHref,children:"Open Config"}):null]}):null,i&&u?(0,b.jsx)(o,{row:a,policy:u,onCancel:()=>j(!1),onCreated:()=>{j(!1),g()}}):null,null===e?(0,b.jsx)("p",{className:"session-share-note",role:"status",children:"Loading shares…"}):null,null===e||0!==q.length||i?null:(0,b.jsx)("p",{className:"session-share-note",children:"Not shared."}),r.length+w.length>0?(0,b.jsx)("ul",{className:"session-share-list","aria-label":`Slack shares of ${a.title}`,children:[...r,...w].map(a=>(0,b.jsx)(n,{share:a,onChanged:g},a.share_ref))}):null,s.length>w.length?(0,b.jsxs)("button",{type:"button",className:"pin-word",onClick:()=>p(!0),children:["Show ",s.length-w.length," ended share",s.length-w.length==1?"":"s"]}):null]})}function n({share:a,onChanged:c}){let[e,f]=(0,d.useState)(!1),[g,h]=(0,d.useState)(!1),[i,j]=(0,d.useState)(""),[l,m]=(0,d.useState)(!1),o=(0,k.shareIsLive)(a),p=async()=>{try{await navigator.clipboard.writeText(a.share_ref),m(!0)}catch{j("Copy failed. Select the reference instead.")}},q=async()=>{h(!0),j("");try{let b=await fetch(`/api/shares/${encodeURIComponent(a.share_ref)}/revoke`,{method:"POST"}),d=await b.json().catch(()=>null);b.ok?(f(!1),c()):j("string"==typeof d?.error?.message?d.error.message:"The share could not be revoked.")}catch{j("The share could not be revoked.")}finally{h(!1)}};return(0,b.jsxs)("li",{className:`session-share is-${a.status}`,"data-share-ref":a.share_ref,"data-share-status":a.status,children:[(0,b.jsxs)("div",{className:"session-share-head",children:[(0,b.jsx)("span",{className:`manage-tag session-share-status is-${a.status}`,children:k.SHARE_STATUS_LABELS[a.status]}),(0,b.jsx)("span",{className:"session-share-audience",children:(0,k.audienceLabel)(a.audience)})]}),(0,b.jsxs)("dl",{className:"manage-meta session-share-meta",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Expiry"}),(0,b.jsx)("dd",{children:(0,k.expiryLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Questions"}),(0,b.jsx)("dd",{children:(0,k.turnsLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Thread"}),(0,b.jsx)("dd",{children:(0,k.threadLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Reference"}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{className:"session-share-ref",children:a.share_ref})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Origin"}),(0,b.jsxs)("dd",{children:[(0,k.createdByLabel)(a)," · read-only Ask"]})]})]}),(0,b.jsx)("p",{className:"session-share-note",children:(0,k.shareStatusNote)(a)}),(0,b.jsxs)("div",{className:"session-actions",role:"group","aria-label":"Share actions",children:[(0,b.jsx)("button",{type:"button",className:"pin-word","data-share-action":"copy",onClick:()=>{p()},children:l?"Copied":"Copy reference"}),o&&!e?(0,b.jsx)("button",{type:"button",className:"session-action session-share-revoke","data-share-action":"revoke",onClick:()=>f(!0),children:"Revoke"}):null]}),e?(0,b.jsxs)("div",{className:"session-share-confirm",role:"group","aria-label":"Confirm revoke",children:[(0,b.jsx)("p",{children:"Revoke this share? The next Slack question in its thread gets the revoked notice. This can’t be undone."}),(0,b.jsxs)("div",{className:"session-actions",children:[(0,b.jsx)("button",{type:"button",className:"session-action session-share-revoke","data-share-action":"confirm-revoke",disabled:g,onClick:()=>{q()},children:g?"Revoking…":"Revoke share"}),(0,b.jsx)("button",{type:"button",className:"pin-word",disabled:g,onClick:()=>f(!1),children:"Keep it"})]})]}):null,i?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:i}):null]})}function o({row:a,policy:c,onCancel:e,onCreated:f}){let g={channel:(0,d.useId)(),duration:(0,d.useId)(),turns:(0,d.useId)()},[h,i]=(0,d.useState)(0),[j,m]=(0,d.useState)(c.limits.ttl_seconds.default),[n,p]=(0,d.useState)(String(c.limits.max_turns.default)),[q]=(0,d.useState)(l),[r,s]=(0,d.useState)(!1),[t,u]=(0,d.useState)(""),v=Number(n),w=Number.isInteger(v)&&v>=c.limits.max_turns.min&&v<=c.limits.max_turns.max,x=async b=>{if(b.preventDefault(),w){s(!0),u("");try{let b=await fetch(`/api/bots/${encodeURIComponent(a.agent.id)}/sessions/${encodeURIComponent(a.ref)}/shares`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify((0,k.shareCreateBody)(c.audiences[h],j,v,q))}),d=await b.json().catch(()=>null);b.ok?f():u("string"==typeof d?.error?.message?d.error.message:"The share could not be created.")}catch{u("The share could not be created.")}finally{s(!1)}}};return(0,b.jsxs)("form",{className:"session-share-form",onSubmit:a=>{x(a)},"aria-label":`Share ${a.title} to Slack`,children:[(0,b.jsxs)("p",{className:"session-share-note",children:["Shares ",(0,b.jsx)("strong",{children:a.title})," (",a.agent.name,") as a read-only Ask: Slack replies in the share’s thread ask exactly this session."]}),(0,b.jsx)("label",{htmlFor:g.channel,children:"Slack channel"}),(0,b.jsx)("select",{id:g.channel,value:h,onChange:a=>i(Number(a.target.value)),disabled:r,children:c.audiences.map((a,c)=>(0,b.jsx)("option",{value:c,children:(0,k.audienceLabel)(a)},`${a.team_id}:${a.channel_id}`))}),(0,b.jsx)("label",{htmlFor:g.duration,children:"Expires after"}),(0,b.jsx)("select",{id:g.duration,value:j,onChange:a=>m(Number(a.target.value)),disabled:r,children:k.SHARE_DURATIONS.map(a=>(0,b.jsx)("option",{value:a.seconds,children:a.label},a.seconds))}),(0,b.jsx)("label",{htmlFor:g.turns,children:"Questions allowed"}),(0,b.jsx)("input",{id:g.turns,type:"number",inputMode:"numeric",min:c.limits.max_turns.min,max:c.limits.max_turns.max,value:n,onChange:a=>p(a.target.value),disabled:r,"aria-invalid":!w}),w?null:(0,b.jsxs)("p",{className:"delete-error",children:["Questions allowed must be a whole number from ",c.limits.max_turns.min," to ",c.limits.max_turns.max,"."]}),t?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:t}):null,(0,b.jsxs)("div",{className:"session-actions",children:[(0,b.jsx)("button",{type:"submit",className:"session-action","data-share-action":"submit",disabled:r||!w,children:r?"Sharing…":"Create share"}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:e,disabled:r,children:"Cancel"})]})]})}function p(a,b,c,d,e){let f=new URLSearchParams({status:b}),g=c.trim();return g&&f.set("q",g),d&&f.set("workspace",d),e&&f.set("cursor",e),`/api/bots/${encodeURIComponent(a)}/sessions?${f.toString()}`}function q({agentId:a,agentName:h,agentProvider:k,agents:l,origin:m,onExchangeStarted:n}){let o=(0,e.useRouter)(),t=(0,e.useSearchParams)().get("session"),[u,v]=(0,d.useState)("all"),[w,x]=(0,d.useState)(null),[y,z]=(0,d.useState)(null),[A,B]=(0,d.useState)(!1),[C,D]=(0,d.useState)(""),[E,F]=(0,d.useState)(""),[G,H]=(0,d.useState)(0),[I,J]=(0,d.useState)(""),[K,L]=(0,d.useState)(""),[M,N]=(0,d.useState)([]),[O,P]=(0,d.useState)(null),[Q,R]=(0,d.useState)(!1),[S,T]=(0,d.useState)(""),[U,V]=(0,d.useState)(null),[W,X]=(0,d.useState)(null),[Y,Z]=(0,d.useState)(null),[$,_]=(0,d.useState)(null),[aa,ab]=(0,d.useState)("loading"),[ac,ad]=(0,d.useState)(0),ae=(0,d.useRef)(0),af=(0,d.useRef)(""),ag=(0,d.useRef)(""),ah=(0,d.useRef)(null),ai=(0,d.useRef)(null),aj=(0,d.useRef)(null),ak=(0,d.useRef)(!1),al=(0,d.useRef)(null),am=k&&(0,g.agentLabel)(k)||void 0;(0,d.useEffect)(()=>{ae.current+=1;let b=ae.current,c=`${a}
|
|
2
|
+
${u}`,d=ag.current!==c;ag.current=c;let e=250*(I!==af.current);af.current=I;let f=!1,g=setTimeout(()=>{fetch(p(a,u,I,K,null),{cache:"no-store"}).then(async c=>{let e=await c.json().catch(()=>null);if(f||ae.current!==b)return;if(!c.ok||!Array.isArray(e?.sessions))return void F("string"==typeof e?.error?e.error:"Could not load sessions.");let g=e.sessions;x(g),z(e?.sync&&"object"==typeof e.sync?e.sync:null),P("string"==typeof e?.next_cursor?e.next_cursor:null),T(`${a}
|
|
3
|
+
${u}
|
|
4
|
+
${I.trim()}
|
|
5
|
+
${K}`),F("");let h=g.map(a=>a.context.workspace).filter(a=>!!a);N(a=>[...new Set([...d?[]:a,...h])])}).catch(()=>{f||ae.current!==b||F("Could not load sessions.")})},e);return()=>{f=!0,clearTimeout(g)}},[a,u,I,K,G]),(0,d.useEffect)(()=>{if(!t||null===w)return;if(w.some(a=>a.ref===t)){al.current!==t&&(al.current=t,requestAnimationFrame(()=>requestAnimationFrame(()=>{document.querySelector(`[data-session-ref="${CSS.escape(t)}"]`)?.scrollIntoView({block:"nearest"})})));return}if("all"!==u||I.trim()||K)return;let b=!1;return fetch(`/api/bots/${encodeURIComponent(a)}/sessions/${encodeURIComponent(t)}`,{cache:"no-store"}).then(async a=>{let c=await a.json().catch(()=>null);if(b||!a.ok||!c?.session)return;let d=c.session;x(a=>!a||a.some(a=>a.ref===d.ref)?a:[d,...a])}).catch(()=>{}),()=>{b=!0}},[t,w,a,u,I,K]),(0,d.useEffect)(()=>{w&&(t&&w.some(a=>a.ref===t)?V(t):V(null))},[t,w]),(0,d.useEffect)(()=>{!w||!t||w.some(a=>a.ref===t)||("all"!==u||I.trim()||K)&&o.replace(`/agents/${encodeURIComponent(a)}/sessions`,{scroll:!1})},[w,t,u,I,K,a,o]),(0,d.useEffect)(()=>{if(!U){let a=ai.current;if(!a||ak.current)return;ai.current=null,a.isConnected&&a.focus();return}ak.current&&(ak.current=!1,aj.current?.focus())},[U]);let an=`${a}
|
|
6
|
+
${u}
|
|
7
|
+
${I.trim()}
|
|
8
|
+
${K}`,ao=null!==O&&S===an,ap=(0,d.useCallback)(async()=>{if(Q||!w||!O||S!==an)return;R(!0);let b=ae.current;try{let c=await fetch(p(a,u,I,K,O),{cache:"no-store"}),d=await c.json().catch(()=>null);if(ae.current!==b)return;if(!c.ok||!Array.isArray(d?.sessions))return void F("Could not load more sessions.");let e=d.sessions,f=new Set(w.map(a=>a.ref));x([...w,...e.filter(a=>!f.has(a.ref))]),P("string"==typeof d?.next_cursor?d.next_cursor:null),F("");let g=e.map(a=>a.context.workspace).filter(a=>!!a);g.length&&N(a=>[...new Set([...a,...g])])}catch{ae.current===b&&F("Could not load more sessions.")}finally{R(!1)}},[a,u,I,K,Q,w,O,an,S]),aq=(0,d.useCallback)(async()=>{if(!A){B(!0),D("");try{let b=await fetch(`/api/bots/${encodeURIComponent(a)}/sessions/sync`,{method:"POST"}),c=await b.json().catch(()=>null);if(409===b.status)D("A sync is already running.");else if(b.ok){let a=Array.isArray(c?.imported)?c.imported.length:0,b=Array.isArray(c?.updated)?c.updated.length:0;D(`Synced: ${a} imported, ${b} updated.`)}else D("Could not sync sessions.")}catch{D("Could not sync sessions.")}finally{B(!1),H(a=>a+1)}}},[a,A]);(0,d.useEffect)(()=>{let b=!1,c=encodeURIComponent(a);return fetch(`/api/bots/${c}/share-policy`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(a=>{b||ab(a?.policy??null)}).catch(()=>{b||ab(null)}),fetch(`/api/shares?agent_id=${c}&limit=100`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(a=>{b||_(Array.isArray(a?.shares)?a.shares:[])}).catch(()=>{b||_([])}),()=>{b=!0}},[a,ac]),(0,d.useEffect)(()=>{let a=setInterval(()=>ad(a=>a+1),15e3);return()=>clearInterval(a)},[]),(0,d.useEffect)(()=>{if(W||!ah.current)return;let a=ah.current;ah.current=null,a.isConnected&&a.focus()},[W]);let ar=(a=u)=>{x(null),F(""),v(a),H(a=>a+1)},as=""!==I.trim()||""!==K,at=w?.find(a=>a.ref===U)??null,au=(b,c)=>{ai.current=c,ak.current=!0,o.replace(`/agents/${encodeURIComponent(a)}/sessions?session=${encodeURIComponent(b.ref)}`,{scroll:!1})},av=()=>{ah.current=W?.returnTo??null,X(null)};return(0,b.jsxs)("div",{className:"agent-sessions-page","data-agent-sessions-page":!0,children:[(0,b.jsxs)("header",{className:"agent-sessions-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Sessions"}),(0,b.jsxs)("h2",{children:["Review ",h,"’s work"]}),(0,b.jsx)("p",{children:"Scan runtime sessions, then open one for actions and operational detail."})]}),(0,b.jsxs)("div",{className:"agent-sessions-sync",children:[(0,b.jsxs)("span",{children:["Last synced ",(0,f.formatSyncRelativeTime)(y?.synced_at??null)]}),(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{aq()},disabled:A,children:A?"Refreshing…":"Refresh"})]})]}),(0,b.jsxs)("div",{className:"sessions-filter",role:"group","aria-label":"Filter sessions",children:[(0,b.jsx)("div",{className:"sessions-status-filter",role:"group","aria-label":"Show sessions",children:f.SESSION_FILTER_OPTIONS.map(a=>(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn","aria-pressed":u===a.value,onClick:()=>{u!==a.value&&ar(a.value)},children:a.label},a.value))}),(0,b.jsx)("input",{type:"search",className:"sessions-search","aria-label":"Search sessions by title",placeholder:"Search by title",value:I,onChange:a=>J(a.target.value)}),(0,b.jsxs)("select",{className:"sessions-workspace","aria-label":"Filter sessions by workspace",value:K,onChange:a=>L(a.target.value),children:[(0,b.jsx)("option",{value:"",children:"All workspaces"}),(0,f.workspaceOptions)(M).map(a=>(0,b.jsx)("option",{value:a.value,title:a.value,children:a.label},a.value))]}),(0,b.jsx)("span",{className:"manage-count","aria-live":"polite",children:w?`${w.length} shown`:""})]}),(0,b.jsx)("div",{className:"exchange-started",role:"status",children:C}),(0,b.jsx)("div",{className:"exchange-started",role:"status",children:Y?(0,b.jsxs)(b.Fragment,{children:[Y.text," ",Y.id?(0,b.jsx)(c.default,{className:"session-link",href:(0,i.detailsHref)(Y.id),children:"View in Exchanges"}):null]}):null}),(0,b.jsxs)("div",{className:`sessions-review${at?" has-detail":""}`,inert:!!W,children:[(0,b.jsxs)("section",{className:"sessions-list-pane","aria-labelledby":"sessions-list-title",children:[(0,b.jsx)("h3",{id:"sessions-list-title",className:"session-sr",children:"Session list"}),E?(0,b.jsxs)("div",{className:"sessions-state",role:"alert",children:[(0,b.jsx)("p",{className:"delete-error",children:E}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>ar(),children:"Retry"})]}):null,w||E?null:(0,b.jsx)("p",{className:"delete-copy sessions-state",role:"status",children:"Loading sessions…"}),w?(0,b.jsxs)("ul",{className:"sessions-list","aria-label":`Sessions for ${h}`,children:[0===w.length?(0,b.jsx)("li",{className:"delete-copy sessions-state",children:as?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{children:(0,f.noMatchingSessionsCopy)(I,K||null)}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{J(""),L("")},children:"Clear search"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{children:(0,f.emptySessionsCopy)(u,h,y,am)}),"all"===u&&y?.last_error_code?(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{aq()},disabled:A,children:A?"Retrying…":"Retry"}):null,"all"===u&&!y?.last_error_code&&(y?.out_of_scope_count??0)>0?(0,b.jsx)(c.default,{className:"session-link",href:`/bots/${encodeURIComponent(a)}/config`,children:"Widen the scope in Config"}):null]})}):null,w.map(a=>(0,b.jsx)(r,{row:a,selected:U===a.ref,onSelect:au},a.ref))]}):null,w&&w.length>0&&ao?(0,b.jsx)("div",{className:"sessions-more",children:(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{ap()},disabled:Q,children:Q?"Loading…":"Load more"})}):null]}),(0,b.jsx)("section",{className:"sessions-detail-pane","aria-label":"Session detail",children:at?(0,b.jsx)(s,{row:at,agentId:a,headingRef:aj,origin:m,agents:l,shares:$,sharePolicy:aa,onClose:()=>{ak.current=!1,o.replace(`/agents/${encodeURIComponent(a)}/sessions`,{scroll:!1})},onAction:(a,b)=>{Z(null),X({mode:a,row:at,returnTo:b})},onSharesChanged:()=>ad(a=>a+1)},at.ref):(0,b.jsxs)("div",{className:"sessions-detail-empty",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,b.jsx)("h3",{children:"Select a session"}),(0,b.jsx)("p",{children:"Actions, usage, origin, shares, and debug detail appear here."})]})})]}),W&&m?(0,b.jsx)(j,{mode:W.mode,session:W.row,agents:l,origin:m,onClose:av,onStarted:a=>{Z({id:a,text:"ask"===W.mode?`Asked ${W.row.agent.name}’s session. The answer arrives in ${m.label}.`:"resume"===W.mode?`Resumed work in ${W.row.agent.name}’s session. Progress shows in ${m.label}.`:`Handoff started from ${W.row.agent.name}’s session. Progress shows in ${m.label}.`}),av(),n?.(a)}}):null]})}function r({row:a,selected:c,onSelect:d}){let e=(0,i.sessionRowActions)(a).filter(a=>a.availability.available).length,g=(0,f.workspaceFolderName)(a.context.workspace),h=(0,f.sessionOriginChips)(a),j=(0,f.sessionStateTags)(a);return(0,b.jsx)("li",{className:`session-scan-row is-${a.status}${c?" is-selected":""}`,"data-session-ref":a.ref,children:(0,b.jsxs)("button",{type:"button",className:"session-scan-button","aria-current":c?"true":void 0,onClick:b=>d(a,b.currentTarget),children:[(0,b.jsxs)("span",{className:"session-scan-title-line",children:[(0,b.jsx)("strong",{className:"session-title",children:a.title}),(0,b.jsx)("span",{className:`manage-tag session-status is-${a.status}`,children:(0,f.statusLabel)(a)})]}),(0,b.jsxs)("span",{className:"session-scan-context",children:[(0,b.jsx)("span",{className:"session-activity",children:(0,f.formatSessionDate)(a.last_activity_at)}),g?(0,b.jsx)("span",{className:"session-workspace",title:a.context.workspace??void 0,children:g}):null]}),h.length||j.length?(0,b.jsxs)("span",{className:"session-scan-chips",children:[h.map(a=>(0,b.jsx)("span",{className:"session-origin-chip",children:a},a)),j.map(a=>(0,b.jsx)("span",{className:`manage-tag session-state-tag is-${a.toLowerCase()}`,children:a},a))]}):null,(0,b.jsx)("span",{className:`session-attention${e?" is-actionable":""}`,children:e?`${e} action${1===e?"":"s"} available`:"Review details"})]})})}function s({row:a,agentId:e,headingRef:g,origin:h,agents:j,shares:k,sharePolicy:l,onClose:n,onAction:o,onSharesChanged:p}){let q,[r,t]=(0,d.useState)(null),[v,w]=(0,d.useState)(null),[x,y]=(0,d.useState)(""),[z,A]=(0,d.useState)(null),[B,C]=(0,d.useState)(""),[D,E]=(0,d.useState)(!1),F=`/api/bots/${encodeURIComponent(e)}/sessions/${encodeURIComponent(a.ref)}`,G=(0,i.sessionRowActions)(a),H=G.filter(a=>a.availability.available),I=G.filter(a=>!a.availability.available),J=a.origin.conversation,K=(q=a.origin.conversation)?q.thread_agent_id?`/agents/${encodeURIComponent(q.thread_agent_id)}/conversations`:"group"===q.kind?`/threads/${encodeURIComponent(q.id)}`:null:null,L=(0,f.workRequestLabel)(a),M=(0,f.sessionUsageLine)(a.usage);(0,d.useEffect)(()=>{let a=!1;return fetch(F,{cache:"no-store"}).then(async b=>{let c=await b.json().catch(()=>null);a||(b.ok&&Array.isArray(c?.session?.attempts)?(t(c.session.attempts),w({totals:c.session.usage,samples:Array.isArray(c.session.usage_samples)?c.session.usage_samples:[]})):y("Could not load session details."))}).catch(()=>{a||y("Could not load session details.")}),()=>{a=!0}},[F]);let N=(0,d.useCallback)(async()=>{if(null===z)try{let a=await fetch(`${F}?debug=external_session_id`,{cache:"no-store"}),b=await a.json().catch(()=>null),c=b?.debug?.external_session_id;a.ok&&"string"==typeof c?A(c):C("Not available.")}catch{C("Not available.")}},[F,z]),O=async()=>{if(z)try{await navigator.clipboard.writeText(z),E(!0)}catch{E(!1)}};return(0,b.jsxs)("article",{className:"session-detail","data-session-detail":a.ref,children:[(0,b.jsxs)("div",{className:"session-detail-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,b.jsx)("h3",{ref:g,tabIndex:-1,children:a.title})]}),(0,b.jsx)("button",{type:"button",className:"pin-word session-detail-close",onClick:n,children:"Back to session list"})]}),(0,b.jsxs)("div",{className:"session-detail-tags",children:[(0,b.jsx)("span",{className:`manage-tag session-status is-${a.status}`,children:(0,f.statusLabel)(a)}),(0,f.sessionStateTags)(a).map(a=>(0,b.jsx)("span",{className:`manage-tag session-state-tag is-${a.toLowerCase()}`,children:a},a))]}),(0,b.jsxs)("dl",{className:"session-detail-meta",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Last activity"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.last_activity_at)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Started"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.created_at)})]}),null!==a.ended_at?(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Ended"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.ended_at)})]}):null,(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Runtime"}),(0,b.jsx)("dd",{children:(0,f.runtimeLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Reported usage"}),(0,b.jsxs)("dd",{children:[(0,b.jsx)("span",{className:`session-usage is-${M.quality}`,"aria-hidden":"true",children:M.text}),(0,b.jsx)("span",{className:"session-sr",children:M.label}),M.partial?(0,b.jsx)("span",{className:"manage-tag session-usage-tag",children:"Partial"}):null]})]}),a.context.workspace?(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Workspace"}),(0,b.jsx)("dd",{children:a.context.workspace})]}):null,(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Origin"}),(0,b.jsx)("dd",{children:K&&J?(0,b.jsx)(c.default,{className:"session-link",href:K,children:J.label}):J?.label??"Not recorded"})]}),L?(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Work request"}),(0,b.jsx)("dd",{children:L})]}):null]}),(0,b.jsxs)("section",{className:"session-detail-section","aria-labelledby":`actions-${a.ref}`,children:[(0,b.jsx)("h4",{id:`actions-${a.ref}`,children:"Actions"}),h&&H.length?(0,b.jsx)("div",{className:"session-actions",role:"group","aria-label":`Actions for ${a.title}`,children:H.map(a=>(0,b.jsx)("button",{type:"button",className:"session-action","data-session-action":a.action,"aria-haspopup":"dialog",onClick:b=>o((0,i.sessionDialogMode)(a.action),b.currentTarget),children:a.label},a.action))}):null,!h&&H.length?(0,b.jsx)("p",{className:"session-unavailable",children:"Open this Agent’s Conversation before starting an action."}):null,I.length?(0,b.jsx)("ul",{className:"session-unavailable","aria-label":`Unavailable actions for ${a.title}`,children:I.map(a=>(0,b.jsxs)("li",{children:[(0,b.jsxs)("strong",{children:[a.label,":"]})," ",a.availability.available?"":a.availability.reason]},a.action))}):null]}),(0,b.jsx)("section",{className:"session-detail-section",children:(0,b.jsx)(m,{row:a,shares:k,policy:l,onChanged:p})}),(0,b.jsxs)("section",{className:"session-detail-section","aria-labelledby":`runs-${a.ref}`,children:[(0,b.jsx)("h4",{id:`runs-${a.ref}`,children:"Runs and usage"}),x?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:x}):null,r||x?null:(0,b.jsx)("p",{className:"delete-copy",role:"status",children:"Loading details…"}),r?(0,b.jsxs)("ol",{className:"session-attempts","aria-label":"Runs in this session",children:[0===r.length?(0,b.jsx)("li",{children:"No recorded runs."}):null,r.map(a=>(0,b.jsxs)("li",{children:[(0,f.formatSessionDate)(a.started_at)," · ",(0,f.attemptLabel)(a)]},`${a.request_id}-${a.attempt_number}`))]}):null,v?(0,b.jsx)(u,{totals:v.totals,samples:v.samples}):null]}),(0,b.jsxs)("details",{className:"session-debug session-detail-section",onToggle:a=>{a.currentTarget.open&&N()},children:[(0,b.jsx)("summary",{children:"Local debug: provider session ID"}),(0,b.jsx)("p",{className:"session-debug-note",children:"For local troubleshooting only. Botmancers resumes sessions for you; you never need to copy this."}),B?(0,b.jsx)("p",{className:"delete-error",children:B}):null,z?(0,b.jsxs)("div",{className:"session-debug-value",children:[(0,b.jsx)("code",{children:z}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{O()},children:D?"Copied":"Copy"})]}):null]})]})}let t=["input_tokens","output_tokens","cost_usd"];function u({totals:a,samples:c}){let e=(0,d.useId)();return(0,b.jsxs)("section",{className:"session-usage-detail","aria-labelledby":e,children:[(0,b.jsx)("h5",{id:e,className:"session-usage-head",children:"Reported usage"}),(0,b.jsx)("dl",{className:"session-usage-totals",children:t.map(c=>{let d=(0,f.usageMetricView)(c,a?.[c],!0);return(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:d.name}),(0,b.jsxs)("dd",{children:[(0,b.jsx)("span",{className:`session-usage is-${d.quality}`,"aria-hidden":"true",children:d.text}),(0,b.jsxs)("span",{className:"session-sr",children:[d.label,"."]}),(0,b.jsx)("span",{className:`session-usage-coverage is-${d.quality}`,children:d.coverage})]})]},c)})}),0===c.length?(0,b.jsx)("p",{className:"session-usage-none",children:"No run in this session reported usage."}):(0,b.jsx)("ol",{className:"session-usage-runs","aria-label":"Reported usage by run",children:c.map((a,c)=>{let d=(0,f.usageSampleValues)(a);return(0,b.jsxs)("li",{children:[(0,b.jsxs)("span",{className:"session-usage-run",children:[(0,f.formatSessionDate)(a.observed_at)," · ",(0,f.usageSampleLabel)(a,c)]}),(0,b.jsxs)("span",{className:"session-usage-values",children:[(0,b.jsxs)("span",{className:null===a.input_tokens?"is-unavailable":void 0,children:["In ",d.input]}),(0,b.jsxs)("span",{className:null===a.output_tokens?"is-unavailable":void 0,children:["Out ",d.output]}),(0,b.jsxs)("span",{className:null===a.cost_usd?"is-unavailable":void 0,children:["Cost ",d.cost]})]})]},`${a.observed_at}-${c}`)})})]})}var v=a.i(15722);a.s(["default",0,function(){let{id:a,agents:d,overview:e,loading:f,error:g,notFound:h}=(0,v.useAgentOverview)();return f?(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading sessions…"}):h?(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an Agent"})]}):g||!e?(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Sessions unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent. Refresh to try again."})]}):(0,b.jsx)(q,{agentId:a,agentName:e.agent.name,agentProvider:e.runtime.agent,agents:d.map(a=>({id:a.id,name:a.name})),origin:e.conversation?{conversationId:e.conversation.id,label:`${e.agent.name} conversation`}:null})}],26847)}];
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=app_agents_%5Bid%5D_sessions_page_tsx_0tfup-2._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[632,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(15722);let f=["disabled","misconfigured","connecting","connected","reconnecting","failed","stopped"],g=["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"],h={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 i(a){switch(a.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:h[a.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"===a.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 j=[{value:"all",label:"All states"},{value:"active",label:"Live"},{value:"expired",label:"Expired"},{value:"revoked",label:"Revoked"}];var k=a.i(23464);function l({agentId:a,agentName:d,relay:e,policy:f,shares:g,filter:h,nextCursor:i,refreshing:k,loadingMore:q,onFilter:r,onRefresh:s,onLoadMore:t,onSharesChanged:u}){let v=`/agents/${encodeURIComponent(a)}/sessions`,w=`/bots/${encodeURIComponent(a)}/config#session-sharing`;return(0,b.jsxs)("div",{className:"agent-slack","data-agent-slack-page":!0,children:[(0,b.jsxs)("header",{className:"agent-slack-intro",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Slack"}),(0,b.jsx)("h2",{children:"Relay health and shared sessions"}),(0,b.jsxs)("p",{children:["Botmancers runs one optional Slack relay. ",d," does not have a separate Slack app; below are only the session threads shared for this Agent."]})]}),(0,b.jsx)("button",{type:"button",className:"agent-slack-refresh",onClick:s,disabled:k,children:k?"Refreshing…":"Refresh"})]}),(0,b.jsxs)("section",{className:"agent-slack-relay","aria-labelledby":"relay-heading",children:[(0,b.jsxs)("div",{className:"agent-slack-section-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Botmancers-wide connection"}),(0,b.jsx)("h3",{id:"relay-heading",children:"Slack relay"})]}),"ready"===e.state?(0,b.jsx)(m,{health:e.value}):null]}),"loading"===e.state?(0,b.jsx)("p",{role:"status",children:"Checking the relay…"}):null,"error"===e.state?(0,b.jsxs)("div",{className:"agent-slack-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Relay health unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not read the redacted health status. Refresh to try again."})]}):null,"ready"===e.state?(0,b.jsx)(n,{health:e.value}):null]}),(0,b.jsxs)("section",{className:"agent-slack-policy","aria-labelledby":"policy-heading",children:[(0,b.jsxs)("div",{className:"agent-slack-section-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"This Agent"}),(0,b.jsx)("h3",{id:"policy-heading",children:"Sharing readiness"})]}),(0,b.jsx)(c.default,{href:w,children:"Edit in Config"})]}),"loading"===f.state?(0,b.jsx)("p",{role:"status",children:"Checking sharing policy…"}):null,"error"===f.state?(0,b.jsxs)("div",{className:"agent-slack-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Sharing policy unavailable"}),(0,b.jsx)("p",{children:"Refresh, or open Config to review this Agent’s stored policy."})]}):null,"ready"===f.state?(0,b.jsx)(o,{policy:f.value}):null]}),(0,b.jsxs)("section",{className:"agent-slack-shares","aria-labelledby":"shares-heading",children:[(0,b.jsxs)("div",{className:"agent-slack-section-head agent-slack-shares-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"This Agent"}),(0,b.jsx)("h3",{id:"shares-heading",children:"Shared session threads"}),(0,b.jsx)("p",{children:"Each share is ask-only and can reach exactly one owning session."})]}),(0,b.jsx)(c.default,{className:"agent-primary-action",href:v,children:"Share a session"})]}),(0,b.jsx)("div",{className:"agent-slack-filters",role:"group","aria-label":"Filter shares by state",children:j.map(a=>(0,b.jsx)("button",{type:"button","aria-pressed":h===a.value,onClick:()=>r(a.value),children:a.label},a.value))}),"loading"===g.state?(0,b.jsx)("p",{className:"agent-slack-empty",role:"status",children:"Loading shared sessions…"}):null,"error"===g.state?(0,b.jsxs)("div",{className:"agent-slack-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Shared sessions unavailable"}),(0,b.jsx)("p",{children:"No partial or stale list is shown. Refresh to try again."})]}):null,"ready"===g.state&&0===g.value.length?(0,b.jsx)("p",{className:"agent-slack-empty",children:"all"===h?`No sessions from ${d} have been shared to Slack yet.`:`No ${j.find(a=>a.value===h)?.label.toLowerCase()} shares for ${d}.`}):null,"ready"===g.state&&g.value.length>0?(0,b.jsx)("ul",{className:"agent-slack-share-list","aria-label":`Slack shares for ${d}`,children:g.value.map(c=>(0,b.jsx)(p,{share:c,agentId:a,onChanged:u},c.share_ref))}):null,"ready"===g.state&&i?(0,b.jsx)("button",{type:"button",className:"agent-slack-more",onClick:t,disabled:q,children:q?"Loading…":"Load more shares"}):null]})]})}function m({health:a}){let c=i(a);return(0,b.jsx)("span",{className:`agent-slack-status is-${c.tone}`,"data-relay-state":a.state,children:c.label})}function n({health:a}){let c=i(a);return(0,b.jsxs)("div",{className:"agent-slack-relay-copy",children:[(0,b.jsx)("p",{children:(0,b.jsx)("strong",{children:c.summary})}),(0,b.jsx)("p",{children:c.guidance}),"connected"===a.state&&a.connections>0?(0,b.jsxs)("p",{className:"agent-muted",children:["Connections opened this run: ",a.connections]}):null]})}function o({policy:a}){let c="loaded"===a.state&&a.audiences.length>0;return(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{children:(0,b.jsx)("strong",{children:c?"Ready to create session shares.":"invalid"===a.state?"The sharing policy needs repair.":"No Slack audience is allowlisted yet."})}),(0,b.jsxs)("p",{className:"agent-muted",children:["Share from a running Agent turn: ",a.agent.share_from_turn?"On":"Off",". Session owners can still share eligible sessions from Sessions."]}),a.audiences.length?(0,b.jsx)("ul",{className:"agent-slack-audiences","aria-label":"Allowed Slack audiences",children:a.audiences.map(a=>(0,b.jsx)("li",{children:(0,k.audienceLabel)(a)},`${a.team_id}:${a.channel_id}`))}):(0,b.jsx)("p",{className:"agent-slack-empty",children:"No allowlisted Slack channels."})]})}function p({share:a,agentId:e,onChanged:f}){let[g,h]=(0,d.useState)(!1),[i,j]=(0,d.useState)(!1),[l,m]=(0,d.useState)(""),n=(0,d.useRef)(null),o=(0,k.shareIsLive)(a),q=`/agents/${encodeURIComponent(e)}/sessions?session=${encodeURIComponent(a.session_ref)}`,r=async()=>{j(!0),m("");try{let b=await fetch(`/api/shares/${encodeURIComponent(a.share_ref)}/revoke`,{method:"POST"}),c=await b.json().catch(()=>null);if(!b.ok)throw Error("string"==typeof c?.error?.message?c.error.message:"The share could not be revoked.");h(!1),f()}catch(a){m(a instanceof Error?a.message:"The share could not be revoked.")}finally{j(!1)}};return(0,b.jsxs)("li",{className:`agent-slack-share is-${a.status}`,"data-share-ref":a.share_ref,"data-share-status":a.status,children:[(0,b.jsxs)("div",{className:"agent-slack-share-summary",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:`agent-slack-status is-share-${a.status}`,children:k.SHARE_STATUS_LABELS[a.status]}),(0,b.jsx)("strong",{children:(0,k.audienceLabel)(a.audience)}),(0,b.jsxs)("small",{children:[(0,k.turnsLabel)(a)," · ",(0,k.expiryLabel)(a)]})]}),(0,b.jsx)("span",{className:"agent-slack-detail-hint",children:"Open for details"})]}),(0,b.jsx)("p",{className:"agent-slack-state-note",children:(0,k.shareStatusNote)(a)}),(0,b.jsxs)("details",{className:"agent-slack-details",children:[(0,b.jsx)("summary",{children:"Details"}),(0,b.jsxs)("dl",{className:"agent-slack-share-details",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Owning session"}),(0,b.jsx)("dd",{children:(0,b.jsx)(c.default,{href:q,children:a.session_ref})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Posted thread"}),(0,b.jsx)("dd",{children:(0,k.threadLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Creation path"}),(0,b.jsx)("dd",{children:"current_session"===a.created_via?"Running Agent turn":"owner"===a.created_by?"Agent Sessions":"Session share API"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Created by"}),(0,b.jsx)("dd",{children:(0,k.createdByLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Authority"}),(0,b.jsx)("dd",{children:"Ask only · exact session"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Share reference"}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{children:a.share_ref})})]})]})]}),(0,b.jsxs)("div",{className:"agent-slack-share-actions",children:[(0,b.jsx)(c.default,{href:q,children:"Open owning session"}),o&&!g?(0,b.jsx)("button",{ref:n,type:"button",className:"agent-slack-revoke","data-share-action":"revoke",onClick:()=>h(!0),children:"Revoke"}):null]}),g?(0,b.jsxs)("div",{className:"agent-slack-confirm",role:"group","aria-label":"Confirm revoke",children:[(0,b.jsx)("p",{children:"Revoke this share? The next Slack question in its thread gets the revoked notice. This can’t be undone."}),(0,b.jsxs)("div",{children:[(0,b.jsx)("button",{type:"button",className:"agent-slack-revoke","data-share-action":"confirm-revoke",disabled:i,onClick:()=>{r()},children:i?"Revoking…":"Revoke share"}),(0,b.jsx)("button",{type:"button",disabled:i,onClick:()=>{h(!1),requestAnimationFrame(()=>n.current?.focus())},children:"Keep it"})]})]}):null,l?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:l}):null]})}a.s(["AgentSlackView",0,l,"default",0,function(){let{id:a,overview:h,loading:i,error:j,notFound:k}=(0,e.useAgentOverview)(),[m,n]=(0,d.useState)({state:"loading"}),[o,p]=(0,d.useState)({state:"loading"}),[q,r]=(0,d.useState)({state:"loading"}),[s,t]=(0,d.useState)("all"),[u,v]=(0,d.useState)(null),[w,x]=(0,d.useState)(!1),[y,z]=(0,d.useState)(!1),[A,B]=(0,d.useState)(0),[C,D]=(0,d.useState)(""),E=(0,d.useRef)(0),F=(0,d.useCallback)((b=null)=>{let c=new URLSearchParams({agent_id:a,limit:String(12)});return"all"!==s&&c.set("state",s),b&&c.set("cursor",b),`/api/shares?${c.toString()}`},[s,a]);(0,d.useEffect)(()=>{let b=!1,c=++E.current;return Promise.allSettled([fetch("/api/health",{cache:"no-store"}).then(async a=>(function(a){if(!a||"object"!=typeof a||!f.includes(a.state))return null;let b=null===a.reason?null:g.includes(a.reason)?a.reason:null;return{state:a.state,reason:b,since:Number.isFinite(a.since)?Number(a.since):0,connections:Number.isInteger(a.connections)&&Number(a.connections)>=0?Number(a.connections):0}})((await a.json().catch(()=>null))?.slack)),fetch(`/api/bots/${encodeURIComponent(a)}/share-policy`,{cache:"no-store"}).then(async a=>{let b=await a.json().catch(()=>null);if(!a.ok||!b?.policy)throw Error("policy");return b.policy}),fetch(F(),{cache:"no-store"}).then(async b=>{let c=await b.json().catch(()=>null);if(!b.ok||!Array.isArray(c?.shares))throw Error("shares");return{shares:c.shares.filter(b=>b.agent.id===a),cursor:"string"==typeof c.next_cursor?c.next_cursor:null}})]).then(([d,e,f])=>{b||c!==E.current||(n("fulfilled"===d.status&&d.value?{state:"ready",value:d.value}:{state:"error"}),p("fulfilled"===e.status?{state:"ready",value:e.value}:{state:"error"}),"fulfilled"===f.status?(r({state:"ready",value:f.value.shares}),v(f.value.cursor)):r({state:"error"}),D(a))}).finally(()=>{b||c!==E.current||z(!1)}),()=>{b=!0}},[a,A,F]);let G=()=>{z(!0),n({state:"loading"}),p({state:"loading"}),r({state:"loading"}),v(null),B(a=>a+1)},H=async()=>{if(u&&!w&&"ready"===q.state){x(!0);try{let b=await fetch(F(u),{cache:"no-store"}),c=await b.json().catch(()=>null);if(!b.ok||!Array.isArray(c?.shares))throw Error("shares");let d=c.shares.filter(b=>b.agent.id===a);r({state:"ready",value:[...q.value,...d]}),v("string"==typeof c.next_cursor?c.next_cursor:null)}catch{r({state:"error"})}finally{x(!1)}}};if(i)return(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading Slack operations…"});if(k)return(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an Agent"})]});if(j||!h)return(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Slack page unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent."})]});let I=C!==a;return(0,b.jsx)(l,{agentId:a,agentName:h.agent.name,relay:I?{state:"loading"}:m,policy:I?{state:"loading"}:o,shares:I?{state:"loading"}:q,filter:s,nextCursor:u,refreshing:y,loadingMore:w,onFilter:a=>{a!==s&&(r({state:"loading"}),v(null),t(a))},onRefresh:G,onLoadMore:()=>{H()},onSharesChanged:G})}],632)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=app_agents_%5Bid%5D_slack_AgentSlackPage_tsx_20njhs1._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[25209,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(50944),f=a.i(60193),g=a.i(23464);function h({agentId:a,agentName:d}){let e=(0,c.useId)(),f=(0,c.useId)(),i=(0,c.useId)(),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(0),[p,q]=(0,c.useState)("idle"),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(""),[v,w]=(0,c.useState)(""),[x,y]=(0,c.useState)(""),[z,A]=(0,c.useState)("");(0,c.useEffect)(()=>{let b=!1;return fetch(`/api/bots/${encodeURIComponent(a)}/share-policy`,{cache:"no-store"}).then(async a=>{let c=await a.json().catch(()=>null);b||(a.ok&&c?.policy?(m(""),k(c.policy)):m("Could not load the share policy."))}).catch(()=>{b||m("Could not load the share policy.")}),()=>{b=!0}},[a,n]);let B=()=>{s(""),q("idle"),o(a=>a+1)},C=async(b,c)=>{if(!j)return!1;q("saving"),s(""),u("");try{let d=await fetch(`/api/bots/${encodeURIComponent(a)}/share-policy`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({revision:j.revision,...b})}),e=await d.json().catch(()=>null);if(!d.ok||!e?.policy)return q("error"),s("string"==typeof e?.error?.message?e.error.message:"The share policy could not be saved."),!1;return k(e.policy),q("idle"),u(c("number"==typeof e.revoked_contexts?e.revoked_contexts:0)),!0}catch{return q("error"),s("The share policy could not be saved."),!1}},D=async a=>{if(a.preventDefault(),!j)return;let b=(0,g.audienceInputError)(v,x,j.audiences);if(A(b??""),b)return;let c={kind:"slack",team_id:v.trim(),channel_id:x.trim()};await C({audiences:[...j.audiences,c]},()=>`Added ${(0,g.audienceLabel)(c)}.`)&&(w(""),y(""))},E="saving"===p,F=!!j&&"invalid"!==j.state;return(0,b.jsxs)("section",{className:"cfg-card share-policy",id:"session-sharing","aria-labelledby":"cfg-sharing-title",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{id:"cfg-sharing-title",className:"cfg-title",children:"Session sharing"}),E?(0,b.jsx)("span",{className:"text-sm cfg-faint",role:"status",children:"Saving…"}):null]}),(0,b.jsxs)("p",{className:"text-sm cfg-muted mb-3",children:["A share lets people in one Slack channel ask one of ",d,"’s sessions questions, read-only, until it expires or you revoke it. Create and revoke shares from Sessions."]}),l?(0,b.jsxs)("p",{className:"text-sm cfg-error",role:"alert",children:[l," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"Retry"})]}):null,j||l?null:(0,b.jsx)("p",{className:"text-sm cfg-faint",role:"status",children:"Loading…"}),j?.state==="invalid"?(0,b.jsxs)("p",{className:"text-sm cfg-error mb-3",role:"alert",children:["The share policy file is invalid, so nothing can be shared: ",j.reason," Fix or remove config/session-shares.json, then"," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"reload"}),"."]}):null,j?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"share-policy-toggle",children:[(0,b.jsx)("input",{id:e,type:"checkbox",role:"switch",checked:j.agent.share_from_turn,"aria-checked":j.agent.share_from_turn,disabled:!F||E||!j.agent.share_current.supported&&!j.agent.share_from_turn,"data-share-policy":"share_from_turn",onChange:a=>{let b=a.target.checked;C({share_from_turn:b},a=>b?"Share from a turn is on.":`Share from a turn is off.${a?` Revoked ${a} live turn context${1===a?"":"s"}.`:""}`)}}),(0,b.jsxs)("label",{htmlFor:e,className:"text-sm",children:[(0,b.jsx)("span",{className:"font-medium",children:"Share from a turn"})," (",(0,b.jsx)("code",{className:"cfg-code",children:"share_from_turn"}),")"]})]}),(0,b.jsx)("p",{className:"text-sm cfg-faint share-policy-hint",children:(0,g.shareFromTurnNote)(j)}),j.agent.live_contexts>0?(0,b.jsxs)("p",{className:"text-sm cfg-faint share-policy-hint",children:[j.agent.live_contexts," live turn context",1===j.agent.live_contexts?"":"s"," now."]}):null,(0,b.jsx)("h3",{className:"cfg-title share-policy-sub",children:"Slack channel allowlist"}),(0,b.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===j.audiences.length?(0,b.jsx)("p",{className:"text-sm cfg-muted share-policy-empty",children:"No channel yet: nothing can be shared to Slack."}):(0,b.jsx)("ul",{className:"share-policy-list","aria-label":"Allowed Slack channels",children:j.audiences.map(a=>(0,b.jsxs)("li",{className:"share-policy-entry",children:[(0,b.jsx)("span",{className:"cfg-code",children:a.channel_id}),(0,b.jsxs)("span",{className:"cfg-faint",children:["workspace ",a.team_id]}),(0,b.jsx)("button",{type:"button",className:"cfg-link text-sm share-policy-remove",disabled:!F||E,"aria-label":`Remove ${(0,g.audienceLabel)(a)}`,onClick:()=>{j&&C({audiences:j.audiences.filter(b=>b.team_id!==a.team_id||b.channel_id!==a.channel_id)},()=>`Removed ${(0,g.audienceLabel)(a)}. Its Slack threads stop being answered.`)},children:"Remove"})]},`${a.team_id}:${a.channel_id}`))}),(0,b.jsxs)("form",{className:"share-policy-add",onSubmit:a=>{D(a)},"aria-label":"Add a Slack channel",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:f,className:"text-sm",children:"Workspace ID"}),(0,b.jsx)("input",{id:f,className:"cfg-input",value:v,placeholder:"T0123ABCD",autoComplete:"off",spellCheck:!1,disabled:!F||E,"aria-invalid":!!z,onChange:a=>{w(a.target.value),A("")}})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:i,className:"text-sm",children:"Channel ID"}),(0,b.jsx)("input",{id:i,className:"cfg-input",value:x,placeholder:"C0123ABCD",autoComplete:"off",spellCheck:!1,disabled:!F||E,"aria-invalid":!!z,onChange:a=>{y(a.target.value),A("")}})]}),(0,b.jsx)("button",{type:"submit",className:"cfg-btn-primary text-sm",disabled:!F||E||!v.trim()||!x.trim(),children:"Add channel"})]}),z?(0,b.jsx)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:z}):null,"error"===p?(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:["Couldn't save: ",r," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"Reload"})]}):null,(0,b.jsx)("p",{className:"mt-2 text-sm cfg-ok",role:"status",children:t})]}):null]})}var i=a.i(35832),j=a.i(20851),k=a.i(1160),l=a.i(22855),m=a.i(79202),n=a.i(36391);function o({attribute:a,label:d,options:e,current:f,onPick:g,className:h}){let i=(0,c.useId)(),j=`avatar-${a}`;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{id:i,className:"avatar-group-label",children:d}),(0,b.jsx)("div",{className:h?`avatar-opt-grid ${h}`:"avatar-opt-grid",role:"radiogroup","aria-labelledby":i,children:e.map(c=>(0,b.jsxs)("label",{title:c.label,className:"avatar-opt",children:[(0,b.jsx)("input",{type:"radio",name:j,value:c.id,checked:f[a]===c.id,onChange:()=>g({[a]:c.id}),className:"avatar-opt-input"}),(0,b.jsx)("span",{className:"avatar-opt-art","aria-hidden":"true",children:(0,b.jsx)(n.default,{config:{...f,[a]:c.id},size:44})}),(0,b.jsx)("span",{children:c.label})]},c.id))})]})}var p=a.i(80219);function q({phase:a,onImport:c}){let d=(0,p.marketImportView)(a);return(0,b.jsxs)("div",{className:"mt-3","data-field":"marketplace-import",children:[(0,b.jsx)("button",{type:"button",onClick:c,disabled:d.busy,"aria-busy":d.busy,"aria-describedby":"cfg-market-import-status",className:"cfg-btn-ghost text-sm w-full sm:w-auto",children:"Import from Grok Marketplace"}),(0,b.jsx)("p",{id:"cfg-market-import-status",role:"status","aria-live":"polite",className:"error"===d.tone?"mt-2 text-sm cfg-error":"mt-2 text-xs cfg-faint",children:d.message})]})}var r=a.i(5020);let s="Fix the highlighted fields.",t=[{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 u(a){return String(a).padStart(2,"0")}function v(a){let b=new Date(a);return`${b.getFullYear()}-${u(b.getMonth()+1)}-${u(b.getDate())} ${u(b.getHours())}:${u(b.getMinutes())}`}function w(a){let b=new Date(a);return`${u(b.getHours())}:${u(b.getMinutes())}:${u(b.getSeconds())}`}async function x(a){try{return await navigator.clipboard.writeText(a),!0}catch{return!1}}a.s(["default",0,function(){var a;let g=String((0,e.useParams)().id??""),u=(0,e.useRouter)(),[y,z]=(0,c.useState)(!1),[A,B]=(0,c.useState)(null),[C,D]=(0,c.useState)(!0),[E,F]=(0,c.useState)(!1),[G,H]=(0,c.useState)(!1),[I,J]=(0,c.useState)(0),[K,L]=(0,c.useState)(null),[M,N]=(0,c.useState)("clean"),[O,P]=(0,c.useState)(""),[Q,R]=(0,c.useState)(0),[S,T]=(0,c.useState)(!1),[U,V]=(0,c.useState)(""),[W,X]=(0,c.useState)("clean"),[Y,Z]=(0,c.useState)(""),[$,_]=(0,c.useState)(0),[aa,ab]=(0,c.useState)({}),[ac,ad]=(0,c.useState)(""),[ae,af]=(0,c.useState)(!1),[ag,ah]=(0,c.useState)(null),[ai,aj]=(0,c.useState)(!1),ak=(0,m.useRuntimeConnections)(),[al,am]=(0,c.useState)(void 0),[an,ao]=(0,c.useState)("clean"),[ap,aq]=(0,c.useState)(""),[ar,as]=(0,c.useState)(0),[at,au]=(0,c.useState)(null),[av,aw]=(0,c.useState)("clean"),[ax,ay]=(0,c.useState)(""),[az,aA]=(0,c.useState)(0),{phase:aB,startImport:aC}=function(a){let[b,d]=(0,c.useState)("idle");return(0,c.useEffect)(()=>{let b=window.location.search;if(null===(0,p.importedBotId)(b))return;let c=new URL(window.location.href);c.searchParams.delete(p.IMPORT_RETURN_QUERY),window.history.replaceState(null,"",c.pathname+c.search);let e=!1;return(0,p.resolveImportReturn)(b,a,async a=>(await fetch(`/api/bots/${encodeURIComponent(a)}/config`,{cache:"no-store"})).ok).then(a=>{e||("open"===a.kind?window.location.replace(a.path):"missing"===a.kind&&d("missing"))}),()=>{e=!0}},[a]),{phase:b,startImport:async function(){d("checking");try{let a=await fetch(p.HANDOFF_STATUS_PATH,{cache:"no-store"}),b=await a.json().catch(()=>null);if(!a.ok)return void d("failed");if(b?.configured!==!0)return void d("unavailable");d("redirecting"),window.location.href=(0,p.handoffStartPath)(window.location.origin,window.location.pathname),setTimeout(()=>d(a=>"redirecting"===a?"idle":a),4e3)}catch{d("failed")}}}}(g);function aD(){D(!0),F(!1),J(a=>a+1)}(0,c.useEffect)(()=>{if(!g)return;let a=!1;return fetch(`/api/bots/${encodeURIComponent(g)}/sessions?status=all`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(b=>{a||am((b?.sessions??[]).map(a=>({ref:a.ref,title:a.title,status:a.status})))}).catch(()=>{a||am([])}),()=>{a=!0}},[g,I]),(0,c.useEffect)(()=>{if(!g)return;let a=!1;return fetch(`/api/bots/${encodeURIComponent(g)}/config`).then(async b=>{if(a)return;if(404===b.status){H(!0),B(null);return}if(!b.ok)throw Error("request failed");let c=await b.json();a||(B(c),L(c.bot.description??""),H(!1),F(!1))}).catch(()=>{a||F(!0)}).finally(()=>{a||D(!1)}),()=>{a=!0}},[g,I]);let aE=A?.bot.description??"",aF=null!==K&&K!==aE,aG=A?.skill.content??"",aH=S&&U!==aG,aI=A?(0,k.registrationFormFromBot)(A.bot):null,aJ=ae&&null!==ag&&JSON.stringify(ag)!==JSON.stringify(aI),aK=A?.bot.avatar_config??(0,r.resolveAvatar)(A?.bot??{}),aL=at??aK,aM=null!==at&&JSON.stringify(at)!==JSON.stringify(aK),aN=aF||aH||aJ||aM;function aO(a,b){x(b).then(b=>{b&&(ad(a),setTimeout(()=>ad(b=>b===a?"":b),2e3))})}async function aP(){if(A&&null!==K){N("saving"),P("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A.bot.id,description:K})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),N("confirmed"),R(Date.now()),setTimeout(()=>{N(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){N("error"),P(a instanceof Error?a.message:"request failed")}}}function aQ(){A&&(ah((0,k.registrationFormFromBot)(A.bot)),af(!0),aj(!1),ao("clean"),aq(""),ak.retry())}function aR(a){ah(b=>b?{...b,...a}:b),aq(""),ao(a=>"error"===a?"clean":a)}function aS(){af(!1),ah(null),ao("clean"),aq("")}function aT(a){au({...at??aK,...a}),aw("clean"),ay("")}async function aU(){if(A&&at){aw("saving"),ay("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A.bot.id,avatar:at})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),au(null),aw("confirmed"),aA(Date.now()),setTimeout(()=>{aw(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){aw("error"),ay(a instanceof Error?a.message:"request failed")}}}async function aV(){if(A&&ag){if((0,k.hasRegistrationErrors)((0,k.registrationFormView)(ag,ak.state))){aj(!0),ao("error"),aq(s);return}ao("saving"),aq("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify((0,k.registrationPatchBody)(A.bot.id,ag))});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),af(!1),ah(null),ao("confirmed"),as(Date.now()),setTimeout(()=>{ao(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){ao("error"),aq(a instanceof Error?a.message:"request failed")}}}function aW(){V(A?.skill.content??""),T(!0),X("clean"),Z("")}async function aX(){if(A&&(U.trim()||window.confirm("Delete this skill file?"))){X("saving"),Z("");try{let a=await fetch(`/api/bots/${encodeURIComponent(g)}/skill`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:U})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await a.json();B(a=>a?{...a,skill:b.skill,currentHash:b.currentHash}:a),T(!1),X("confirmed"),_(Date.now()),setTimeout(()=>{X(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){X("error"),Z(a instanceof Error?a.message:"request failed")}}}if((0,c.useEffect)(()=>{if(!aN)return;let a=a=>{a.preventDefault()};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[aN]),G)return(0,b.jsx)("div",{className:"cfg-page flex items-center justify-center",children:(0,b.jsxs)("div",{className:"text-center",children:[(0,b.jsx)("p",{className:"mb-4",children:"Agent not found."}),(0,b.jsx)(d.default,{href:"/",className:"cfg-link",children:"← Back to chat"})]})});if(C&&!A)return(0,b.jsx)("div",{className:"cfg-page",children:(0,b.jsxs)("div",{className:"max-w-6xl mx-auto space-y-6",children:[(0,b.jsx)("div",{className:"h-6 w-32 rounded animate-pulse cfg-skel"}),(0,b.jsx)("div",{className:"h-20 rounded-lg animate-pulse cfg-skel"}),(0,b.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,b.jsx)("div",{className:"space-y-6",children:[0,1,2].map(a=>(0,b.jsx)("div",{className:"h-48 rounded-lg animate-pulse cfg-skel"},a))}),(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsx)("div",{className:"h-64 rounded-lg animate-pulse cfg-skel"}),(0,b.jsx)("div",{className:"h-80 rounded-lg animate-pulse cfg-skel"})]})]})]})});if(E&&!A)return(0,b.jsx)("div",{className:"cfg-page",children:(0,b.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,b.jsx)(d.default,{href:"/",className:"cfg-link cfg-back text-sm",children:"← Back to chat"}),(0,b.jsxs)("header",{className:"mt-3 mb-6 flex flex-wrap items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("h1",{className:"text-xl font-bold truncate",children:"Agent configuration"}),(0,b.jsx)("p",{className:"text-sm cfg-faint truncate",children:"Couldn't load agent details."})]}),(0,b.jsxs)("div",{className:"ml-auto text-right",children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Current config hash: ",(0,b.jsx)("code",{className:"cfg-code",children:"—"})]}),(0,b.jsx)("p",{className:"text-sm mt-1",children:(0,b.jsx)("span",{className:"cfg-faint",children:"○ Not loaded"})})]})]}),(0,b.jsx)("div",{className:"grid gap-6 lg:grid-cols-2 items-start",children:[["Skills","Rules","Agent","Template source"],["Launch snapshots","Avatar"]].map(a=>(0,b.jsx)("div",{className:"min-w-0 space-y-6",children:a.map(a=>(0,b.jsxs)("div",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-2",children:a}),(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Couldn't load this section."," ",(0,b.jsx)("button",{onClick:aD,className:"cfg-link",children:"Retry"})]})]},a))},a[0]))})]})});if(!A)return null;let{bot:aY,skill:aZ,currentHash:a$,snapshots:a_}=A,a0=!!(aY.source_provider||aY.template_id||aY.template_url||aY.import_schema_version||aY.import_operation_id),a1="saving"===M?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aF||"error"===M?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===M?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(Q)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a2="saving"===W?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aH||"error"===W?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===W?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w($)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a3="saving"===an?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aJ||"error"===an?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===an?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(ar)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a4="saving"===av?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aM||"error"===av?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===av?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(az)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"});return(0,b.jsxs)("div",{className:"cfg-page",children:[(0,b.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,b.jsx)(d.default,{href:"/",onClick:function(a){aN&&!window.confirm("You have unsaved changes. Leave without saving?")&&a.preventDefault()},className:"cfg-link cfg-back text-sm",children:"← Back to chat"}),(0,b.jsxs)("header",{className:"mt-3 mb-6 flex flex-wrap items-center gap-4",children:[(0,b.jsx)(n.default,{bot:aY,size:48,title:`${aY.name} avatar`}),(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("h1",{className:"text-xl font-bold truncate",children:aY.name}),(0,b.jsx)("p",{className:"text-sm cfg-faint truncate",children:aY.title||" "})]}),(0,b.jsxs)("div",{className:"ml-auto text-right",children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Current config hash:"," ",(0,b.jsx)("code",{className:"cfg-code",title:a$,children:a$.slice(0,8)})," ",(0,b.jsx)("button",{onClick:()=>aO("header",a$),className:"cfg-link text-sm",children:"header"===ac?"Copied":"Copy"})]}),(0,b.jsx)("p",{className:"text-sm mt-1",children:aN?(0,b.jsxs)("span",{className:"cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):(0,b.jsx)("span",{className:"cfg-faint",children:"● Saved"})})]})]}),(0,b.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2 items-start","data-cfg-layout":"columns",children:[(0,b.jsxs)("div",{className:"min-w-0 space-y-6","data-cfg-column":"primary",children:[(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Skills"}),a2]}),"unsupported"===aZ.status?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm cfg-muted mb-3",children:"Unsupported name"}),(0,b.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,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted mb-3",children:[aZ.path," · ","present"===aZ.status?"Present":"Not present"]}),S?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("textarea",{value:U,onChange:a=>V(a.target.value),rows:8,className:"cfg-input text-sm"}),"error"===W&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",Y,"."," ",(0,b.jsx)("button",{onClick:aX,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aX,disabled:!aH||"saving"===W,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===W?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){T(!1),X("clean"),Z("")},disabled:!aH||"saving"===W,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}):"present"===aZ.status?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("pre",{className:"text-sm cfg-pre max-h-64 overflow-y-auto",children:aZ.content}),(0,b.jsx)("button",{onClick:aW,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Edit"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"No skill file yet. Create SKILL.md to give this agent standing instructions."}),(0,b.jsx)("button",{onClick:aW,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Create"})]}),(0,b.jsx)("p",{className:"mt-3 text-xs cfg-faint",children:"Appended verbatim as a system message at launch."})]})]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Rules"}),a1]}),(0,b.jsx)("textarea",{value:K??"",onChange:a=>L(a.target.value),rows:8,className:"cfg-input cfg-input-sans text-sm"}),(0,b.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"===M&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",O,"."," ",(0,b.jsx)("button",{onClick:aP,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aP,disabled:!aF||"saving"===M,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===M?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){L(aE),N("clean"),P("")},disabled:!aF||"saving"===M,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Agent"}),a3]}),(()=>{if(!ae||!ag){let a=(0,k.registrationReadView)(aY,al);return(0,b.jsxs)("div",{"data-field":"runtime-read",children:[(0,b.jsx)("dl",{className:"text-sm",children:a.rows.map(a=>(0,b.jsxs)("div",{"data-row":a.key,className:"flex flex-col sm:flex-row sm:justify-between gap-x-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:a.label}),(0,b.jsx)("dd",{className:"sm:text-right break-words cfg-muted",children:a.value})]},a.key))}),a.notices.map(a=>(0,b.jsx)("p",{className:"text-sm cfg-dirty mt-2",children:a},a)),(0,b.jsx)("button",{onClick:aQ,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Edit"})]})}let a=(0,k.registrationFormView)(ag,ak.state);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(l.RegistrationFields,{idPrefix:"cfg",variant:"config",form:ag,onChange:aR,view:a,showErrors:ai,connections:ak.state,onRetryConnections:ak.retry,onAddConnection:ak.add,workspacePlaceholder:(0,j.defaultWorkdirFor)(aY.id),workspaceHint:(0,j.configWorkspaceHint)(aY.id),sessions:al,includeHomeSession:!0}),"error"===an&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:[ap===s?ap:`Couldn't save: ${ap}.`," ",ap===s?null:(0,b.jsx)("button",{onClick:aV,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aV,disabled:!aJ||"saving"===an||a.submitDisabled,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===an?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:aS,disabled:"saving"===an,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:aJ?"Discard":"Cancel"})]})]})})()]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-3",children:"Template source"}),!a0&&(0,b.jsx)("p",{className:"text-sm cfg-muted mb-3",children:"Created manually in Botmancers — no template source."}),(0,b.jsxs)("dl",{className:"text-sm",children:[(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Source provider"}),(0,b.jsx)("dd",{className:"text-right",children:aY.source_provider??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Template ID"}),(0,b.jsx)("dd",{className:"text-right",children:aY.template_id??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Template URL"}),(0,b.jsx)("dd",{className:"text-right break-all",children:aY.template_url?(a=aY.template_url).startsWith("http://")||a.startsWith("https://")?(0,b.jsx)("a",{href:aY.template_url,className:"cfg-link",children:aY.template_url}):aY.template_url:"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Import schema version"}),(0,b.jsx)("dd",{className:"text-right",children:aY.import_schema_version??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Import operation ID"}),(0,b.jsx)("dd",{className:"text-right break-all",children:aY.import_operation_id??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-y cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Imported at"}),(0,b.jsx)("dd",{className:"text-right",children:aY.import_timestamp?v(aY.import_timestamp):"—"})]})]}),(0,b.jsx)(q,{phase:aB,onImport:()=>{aC()}})]})]}),(0,b.jsxs)("div",{className:"min-w-0 space-y-6","data-cfg-column":"secondary",children:[(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-3",children:"Launch snapshots"}),0===a_.length?(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"No launches recorded yet."}):(0,b.jsx)("ul",{className:"space-y-3",children:a_.map(a=>{let c=a.hash===a$,d=!!aa[a.id];return(0,b.jsxs)("li",{className:"cfg-row",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,b.jsxs)("p",{className:"text-sm",children:[v(a.created_at)," · ",a.id.slice(0,4),a.transport?` \xb7 ${a.transport}`:null]}),(0,b.jsx)("button",{onClick:()=>ab(b=>({...b,[a.id]:!b[a.id]})),"aria-label":d?"Collapse snapshot detail":"Expand snapshot detail",className:"cfg-chevron px-1",children:d?"▾":"▸"})]}),(0,b.jsxs)("p",{className:"mt-1 text-sm",children:[(0,b.jsx)("code",{className:"cfg-code",children:a.hash.slice(0,12)})," ",(0,b.jsx)("button",{onClick:()=>aO(a.id,a.hash),className:"cfg-link text-sm",children:ac===a.id?"Copied":"Copy"})]}),(0,b.jsx)("p",{className:"mt-1 text-sm",children:c?(0,b.jsx)("span",{className:"cfg-ok",children:"● Matches current config"}):(0,b.jsx)("span",{className:"cfg-faint",children:"○ Config changed since"})}),d&&(0,b.jsxs)("div",{className:"mt-3 pt-3 border-t cfg-line text-sm",children:[(0,b.jsxs)("p",{className:"cfg-muted break-all",children:[(0,b.jsx)("span",{className:"font-medium",children:"Launch ID:"})," ",a.id]}),(0,b.jsxs)("p",{className:"mt-1 cfg-muted break-all",children:[(0,b.jsx)("span",{className:"font-medium",children:"Hash:"})," ",(0,b.jsx)("code",{className:"cfg-code",children:a.hash})]}),(0,b.jsx)("dl",{className:"mt-2",children:t.map(c=>{let d=a.snapshot[c.key];return(0,b.jsxs)("div",{className:"py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:c.label}),(0,b.jsx)("dd",{className:"whitespace-pre-wrap break-words",children:null==d?(0,b.jsx)("span",{className:"cfg-faint",children:"null"}):Array.isArray(d)?0===d.length?(0,b.jsx)("span",{className:"cfg-faint",children:"(none)"}):(0,b.jsx)("span",{className:"block max-h-32 overflow-y-auto",children:d.map(a=>`- ${a}`).join("\n")}):"boolean"==typeof d?String(d):""===d?(0,b.jsx)("span",{className:"cfg-faint",children:"(empty)"}):(0,b.jsx)("span",{className:"block max-h-32 overflow-y-auto",children:d})})]},c.key)})})]})]},a.id)})})]}),(0,b.jsx)(h,{agentId:aY.id,agentName:aY.name}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Avatar"}),a4]}),(0,b.jsxs)("div",{className:"flex items-center gap-4 mb-4",children:[(0,b.jsx)(n.default,{config:aL,size:96,title:"Avatar live preview"}),(0,b.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,b.jsx)(o,{attribute:"color",label:"Color",options:r.AVATAR_COLORS,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"eyes",label:"Eyes",options:r.AVATAR_EYES,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"hands",label:"Hands",options:r.AVATAR_HANDS,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"accessory",label:"Accessory",options:r.AVATAR_ACCESSORIES,current:aL,onPick:aT}),"error"===av&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",ax,"."," ",(0,b.jsx)("button",{onClick:aU,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aU,disabled:!aM||"saving"===av,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===av?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){au(null),aw("clean"),ay("")},disabled:!aM||"saving"===av,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}),(0,b.jsxs)("section",{className:"cfg-card cfg-danger","aria-labelledby":"cfg-danger-title",children:[(0,b.jsx)("h2",{id:"cfg-danger-title",className:"cfg-title mb-3",children:"Danger zone"}),(0,b.jsx)("p",{className:"text-sm cfg-muted",children:i.DELETE_REMOVES_COPY}),(0,b.jsx)("p",{className:"text-sm cfg-faint mt-2",children:i.DELETE_KEEPS_COPY}),(0,b.jsx)("button",{type:"button",onClick:()=>z(!0),className:"mt-3 delete-btn text-sm w-full sm:w-auto",children:"Delete agent"})]})]})]})]}),y?(0,b.jsx)(f.default,{ids:[aY.id],onCancel:()=>z(!1),onDeleted:a=>u.push(`/?deleted=${Math.max(a.length,1)}`)}):null]})}],25209)}];
|
|
1
|
+
module.exports=[25209,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(50944),f=a.i(60193),g=a.i(23464);function h({agentId:a,agentName:d}){let e=(0,c.useId)(),f=(0,c.useId)(),i=(0,c.useId)(),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(0),[p,q]=(0,c.useState)("idle"),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(""),[v,w]=(0,c.useState)(""),[x,y]=(0,c.useState)(""),[z,A]=(0,c.useState)("");(0,c.useEffect)(()=>{let b=!1;return fetch(`/api/bots/${encodeURIComponent(a)}/share-policy`,{cache:"no-store"}).then(async a=>{let c=await a.json().catch(()=>null);b||(a.ok&&c?.policy?(m(""),k(c.policy)):m("Could not load the share policy."))}).catch(()=>{b||m("Could not load the share policy.")}),()=>{b=!0}},[a,n]);let B=()=>{s(""),q("idle"),o(a=>a+1)},C=async(b,c)=>{if(!j)return!1;q("saving"),s(""),u("");try{let d=await fetch(`/api/bots/${encodeURIComponent(a)}/share-policy`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({revision:j.revision,...b})}),e=await d.json().catch(()=>null);if(!d.ok||!e?.policy)return q("error"),s("string"==typeof e?.error?.message?e.error.message:"The share policy could not be saved."),!1;return k(e.policy),q("idle"),u(c("number"==typeof e.revoked_contexts?e.revoked_contexts:0)),!0}catch{return q("error"),s("The share policy could not be saved."),!1}},D=async a=>{if(a.preventDefault(),!j)return;let b=(0,g.audienceInputError)(v,x,j.audiences);if(A(b??""),b)return;let c={kind:"slack",team_id:v.trim(),channel_id:x.trim()};await C({audiences:[...j.audiences,c]},()=>`Added ${(0,g.audienceLabel)(c)}.`)&&(w(""),y(""))},E="saving"===p,F=!!j&&"invalid"!==j.state;return(0,b.jsxs)("section",{className:"cfg-card share-policy",id:"session-sharing","aria-labelledby":"cfg-sharing-title",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{id:"cfg-sharing-title",className:"cfg-title",children:"Session sharing"}),E?(0,b.jsx)("span",{className:"text-sm cfg-faint",role:"status",children:"Saving…"}):null]}),(0,b.jsxs)("p",{className:"text-sm cfg-muted mb-3",children:["A share lets people in one Slack channel ask one of ",d,"’s sessions questions, read-only, until it expires or you revoke it. Create and revoke shares from Sessions."]}),l?(0,b.jsxs)("p",{className:"text-sm cfg-error",role:"alert",children:[l," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"Retry"})]}):null,j||l?null:(0,b.jsx)("p",{className:"text-sm cfg-faint",role:"status",children:"Loading…"}),j?.state==="invalid"?(0,b.jsxs)("p",{className:"text-sm cfg-error mb-3",role:"alert",children:["The share policy file is invalid, so nothing can be shared: ",j.reason," Fix or remove config/session-shares.json, then"," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"reload"}),"."]}):null,j?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"share-policy-toggle",children:[(0,b.jsx)("input",{id:e,type:"checkbox",role:"switch",checked:j.agent.share_from_turn,"aria-checked":j.agent.share_from_turn,disabled:!F||E||!j.agent.share_current.supported&&!j.agent.share_from_turn,"data-share-policy":"share_from_turn",onChange:a=>{let b=a.target.checked;C({share_from_turn:b},a=>b?"Share from a turn is on.":`Share from a turn is off.${a?` Revoked ${a} live turn context${1===a?"":"s"}.`:""}`)}}),(0,b.jsxs)("label",{htmlFor:e,className:"text-sm",children:[(0,b.jsx)("span",{className:"font-medium",children:"Share from a turn"})," (",(0,b.jsx)("code",{className:"cfg-code",children:"share_from_turn"}),")"]})]}),(0,b.jsx)("p",{className:"text-sm cfg-faint share-policy-hint",children:(0,g.shareFromTurnNote)(j)}),j.agent.live_contexts>0?(0,b.jsxs)("p",{className:"text-sm cfg-faint share-policy-hint",children:[j.agent.live_contexts," live turn context",1===j.agent.live_contexts?"":"s"," now."]}):null,(0,b.jsx)("h3",{className:"cfg-title share-policy-sub",children:"Slack channel allowlist"}),(0,b.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===j.audiences.length?(0,b.jsx)("p",{className:"text-sm cfg-muted share-policy-empty",children:"No channel yet: nothing can be shared to Slack."}):(0,b.jsx)("ul",{className:"share-policy-list","aria-label":"Allowed Slack channels",children:j.audiences.map(a=>(0,b.jsxs)("li",{className:"share-policy-entry",children:[(0,b.jsx)("span",{className:"cfg-code",children:a.channel_id}),(0,b.jsxs)("span",{className:"cfg-faint",children:["workspace ",a.team_id]}),(0,b.jsx)("button",{type:"button",className:"cfg-link text-sm share-policy-remove",disabled:!F||E,"aria-label":`Remove ${(0,g.audienceLabel)(a)}`,onClick:()=>{j&&C({audiences:j.audiences.filter(b=>b.team_id!==a.team_id||b.channel_id!==a.channel_id)},()=>`Removed ${(0,g.audienceLabel)(a)}. Its Slack threads stop being answered.`)},children:"Remove"})]},`${a.team_id}:${a.channel_id}`))}),(0,b.jsxs)("form",{className:"share-policy-add",onSubmit:a=>{D(a)},"aria-label":"Add a Slack channel",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:f,className:"text-sm",children:"Workspace ID"}),(0,b.jsx)("input",{id:f,className:"cfg-input",value:v,placeholder:"T0123ABCD",autoComplete:"off",spellCheck:!1,disabled:!F||E,"aria-invalid":!!z,onChange:a=>{w(a.target.value),A("")}})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:i,className:"text-sm",children:"Channel ID"}),(0,b.jsx)("input",{id:i,className:"cfg-input",value:x,placeholder:"C0123ABCD",autoComplete:"off",spellCheck:!1,disabled:!F||E,"aria-invalid":!!z,onChange:a=>{y(a.target.value),A("")}})]}),(0,b.jsx)("button",{type:"submit",className:"cfg-btn-primary text-sm",disabled:!F||E||!v.trim()||!x.trim(),children:"Add channel"})]}),z?(0,b.jsx)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:z}):null,"error"===p?(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:["Couldn't save: ",r," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"Reload"})]}):null,(0,b.jsx)("p",{className:"mt-2 text-sm cfg-ok",role:"status",children:t})]}):null]})}var i=a.i(35832),j=a.i(20851),k=a.i(1160),l=a.i(22855),m=a.i(79202),n=a.i(36391);function o({attribute:a,label:d,options:e,current:f,onPick:g,className:h}){let i=(0,c.useId)(),j=`avatar-${a}`;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{id:i,className:"avatar-group-label",children:d}),(0,b.jsx)("div",{className:h?`avatar-opt-grid ${h}`:"avatar-opt-grid",role:"radiogroup","aria-labelledby":i,children:e.map(c=>(0,b.jsxs)("label",{title:c.label,className:"avatar-opt",children:[(0,b.jsx)("input",{type:"radio",name:j,value:c.id,checked:f[a]===c.id,onChange:()=>g({[a]:c.id}),className:"avatar-opt-input"}),(0,b.jsx)("span",{className:"avatar-opt-art","aria-hidden":"true",children:(0,b.jsx)(n.default,{config:{...f,[a]:c.id},size:44})}),(0,b.jsx)("span",{children:c.label})]},c.id))})]})}var p=a.i(80219);function q({phase:a,onImport:c}){let d=(0,p.marketImportView)(a);return(0,b.jsxs)("div",{className:"mt-3","data-field":"marketplace-import",children:[(0,b.jsx)("button",{type:"button",onClick:c,disabled:d.busy,"aria-busy":d.busy,"aria-describedby":"cfg-market-import-status",className:"cfg-btn-ghost text-sm w-full sm:w-auto",children:"Import from Grok Marketplace"}),(0,b.jsx)("p",{id:"cfg-market-import-status",role:"status","aria-live":"polite",className:"error"===d.tone?"mt-2 text-sm cfg-error":"mt-2 text-xs cfg-faint",children:d.message})]})}var r=a.i(5020);let s="Fix the highlighted fields.",t=[{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 u(a){return String(a).padStart(2,"0")}function v(a){let b=new Date(a);return`${b.getFullYear()}-${u(b.getMonth()+1)}-${u(b.getDate())} ${u(b.getHours())}:${u(b.getMinutes())}`}function w(a){let b=new Date(a);return`${u(b.getHours())}:${u(b.getMinutes())}:${u(b.getSeconds())}`}async function x(a){try{return await navigator.clipboard.writeText(a),!0}catch{return!1}}a.s(["default",0,function(){var a;let g=String((0,e.useParams)().id??""),u=(0,e.useRouter)(),[y,z]=(0,c.useState)(!1),[A,B]=(0,c.useState)(null),[C,D]=(0,c.useState)(!0),[E,F]=(0,c.useState)(!1),[G,H]=(0,c.useState)(!1),[I,J]=(0,c.useState)(0),[K,L]=(0,c.useState)(null),[M,N]=(0,c.useState)("clean"),[O,P]=(0,c.useState)(""),[Q,R]=(0,c.useState)(0),[S,T]=(0,c.useState)(!1),[U,V]=(0,c.useState)(""),[W,X]=(0,c.useState)("clean"),[Y,Z]=(0,c.useState)(""),[$,_]=(0,c.useState)(0),[aa,ab]=(0,c.useState)({}),[ac,ad]=(0,c.useState)(""),[ae,af]=(0,c.useState)(!1),[ag,ah]=(0,c.useState)(null),[ai,aj]=(0,c.useState)(!1),ak=(0,m.useRuntimeConnections)(),[al,am]=(0,c.useState)(void 0),[an,ao]=(0,c.useState)("clean"),[ap,aq]=(0,c.useState)(""),[ar,as]=(0,c.useState)(0),[at,au]=(0,c.useState)(null),[av,aw]=(0,c.useState)("clean"),[ax,ay]=(0,c.useState)(""),[az,aA]=(0,c.useState)(0),{phase:aB,startImport:aC}=function(a){let[b,d]=(0,c.useState)("idle");return(0,c.useEffect)(()=>{let b=window.location.search;if(null===(0,p.importedBotId)(b))return;let c=new URL(window.location.href);c.searchParams.delete(p.IMPORT_RETURN_QUERY),window.history.replaceState(null,"",c.pathname+c.search);let e=!1;return(0,p.resolveImportReturn)(b,a,async a=>(await fetch(`/api/bots/${encodeURIComponent(a)}/config`,{cache:"no-store"})).ok).then(a=>{e||("open"===a.kind?window.location.replace(a.path):"missing"===a.kind&&d("missing"))}),()=>{e=!0}},[a]),{phase:b,startImport:async function(){d("checking");try{let a=await fetch(p.HANDOFF_STATUS_PATH,{cache:"no-store"}),b=await a.json().catch(()=>null);if(!a.ok)return void d("failed");if(b?.configured!==!0)return void d("unavailable");d("redirecting"),window.location.href=(0,p.handoffStartPath)(window.location.origin,window.location.pathname),setTimeout(()=>d(a=>"redirecting"===a?"idle":a),4e3)}catch{d("failed")}}}}(g);function aD(){D(!0),F(!1),J(a=>a+1)}(0,c.useEffect)(()=>{if(!g)return;let a=!1;return fetch(`/api/bots/${encodeURIComponent(g)}/sessions?status=all`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(b=>{a||am((b?.sessions??[]).map(a=>({ref:a.ref,title:a.title,status:a.status})))}).catch(()=>{a||am([])}),()=>{a=!0}},[g,I]),(0,c.useEffect)(()=>{if(!g)return;let a=!1;return fetch(`/api/bots/${encodeURIComponent(g)}/config`).then(async b=>{if(a)return;if(404===b.status){H(!0),B(null);return}if(!b.ok)throw Error("request failed");let c=await b.json();a||(B(c),L(c.bot.description??""),H(!1),F(!1))}).catch(()=>{a||F(!0)}).finally(()=>{a||D(!1)}),()=>{a=!0}},[g,I]);let aE=A?.bot.description??"",aF=null!==K&&K!==aE,aG=A?.skill.content??"",aH=S&&U!==aG,aI=A?(0,k.registrationFormFromBot)(A.bot):null,aJ=ae&&null!==ag&&JSON.stringify(ag)!==JSON.stringify(aI),aK=A?.bot.avatar_config??(0,r.resolveAvatar)(A?.bot??{}),aL=at??aK,aM=null!==at&&JSON.stringify(at)!==JSON.stringify(aK),aN=aF||aH||aJ||aM;function aO(a,b){x(b).then(b=>{b&&(ad(a),setTimeout(()=>ad(b=>b===a?"":b),2e3))})}async function aP(){if(A&&null!==K){N("saving"),P("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A.bot.id,description:K})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),N("confirmed"),R(Date.now()),setTimeout(()=>{N(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){N("error"),P(a instanceof Error?a.message:"request failed")}}}function aQ(){A&&(ah((0,k.registrationFormFromBot)(A.bot)),af(!0),aj(!1),ao("clean"),aq(""),ak.retry())}function aR(a){ah(b=>b?{...b,...a}:b),aq(""),ao(a=>"error"===a?"clean":a)}function aS(){af(!1),ah(null),ao("clean"),aq("")}function aT(a){au({...at??aK,...a}),aw("clean"),ay("")}async function aU(){if(A&&at){aw("saving"),ay("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A.bot.id,avatar:at})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),au(null),aw("confirmed"),aA(Date.now()),setTimeout(()=>{aw(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){aw("error"),ay(a instanceof Error?a.message:"request failed")}}}async function aV(){if(A&&ag){if((0,k.hasRegistrationErrors)((0,k.registrationFormView)(ag,ak.state))){aj(!0),ao("error"),aq(s);return}ao("saving"),aq("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify((0,k.registrationPatchBody)(A.bot.id,ag))});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),af(!1),ah(null),ao("confirmed"),as(Date.now()),setTimeout(()=>{ao(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){ao("error"),aq(a instanceof Error?a.message:"request failed")}}}function aW(){V(A?.skill.content??""),T(!0),X("clean"),Z("")}async function aX(){if(A&&(U.trim()||window.confirm("Delete this skill file?"))){X("saving"),Z("");try{let a=await fetch(`/api/bots/${encodeURIComponent(g)}/skill`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:U})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await a.json();B(a=>a?{...a,skill:b.skill,currentHash:b.currentHash}:a),T(!1),X("confirmed"),_(Date.now()),setTimeout(()=>{X(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){X("error"),Z(a instanceof Error?a.message:"request failed")}}}if((0,c.useEffect)(()=>{if(!aN)return;let a=a=>{a.preventDefault()};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[aN]),G)return(0,b.jsx)("div",{className:"cfg-page flex items-center justify-center",children:(0,b.jsxs)("div",{className:"text-center",children:[(0,b.jsx)("p",{className:"mb-4",children:"Agent not found."}),(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(g)}`,className:"cfg-link",children:"← Back to Overview"})]})});if(C&&!A)return(0,b.jsx)("div",{className:"cfg-page",children:(0,b.jsxs)("div",{className:"max-w-6xl mx-auto space-y-6",children:[(0,b.jsx)("div",{className:"h-6 w-32 rounded animate-pulse cfg-skel"}),(0,b.jsx)("div",{className:"h-20 rounded-lg animate-pulse cfg-skel"}),(0,b.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,b.jsx)("div",{className:"space-y-6",children:[0,1,2].map(a=>(0,b.jsx)("div",{className:"h-48 rounded-lg animate-pulse cfg-skel"},a))}),(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsx)("div",{className:"h-64 rounded-lg animate-pulse cfg-skel"}),(0,b.jsx)("div",{className:"h-80 rounded-lg animate-pulse cfg-skel"})]})]})]})});if(E&&!A)return(0,b.jsx)("div",{className:"cfg-page",children:(0,b.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(g)}`,className:"cfg-link cfg-back text-sm",children:"← Back to Overview"}),(0,b.jsxs)("header",{className:"mt-3 mb-6 flex flex-wrap items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("h1",{className:"text-xl font-bold truncate",children:"Agent configuration"}),(0,b.jsx)("p",{className:"text-sm cfg-faint truncate",children:"Couldn't load agent details."})]}),(0,b.jsxs)("div",{className:"ml-auto text-right",children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Current config hash: ",(0,b.jsx)("code",{className:"cfg-code",children:"—"})]}),(0,b.jsx)("p",{className:"text-sm mt-1",children:(0,b.jsx)("span",{className:"cfg-faint",children:"○ Not loaded"})})]})]}),(0,b.jsx)("div",{className:"grid gap-6 lg:grid-cols-2 items-start",children:[["Skills","Rules","Agent","Template source"],["Launch snapshots","Avatar"]].map(a=>(0,b.jsx)("div",{className:"min-w-0 space-y-6",children:a.map(a=>(0,b.jsxs)("div",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-2",children:a}),(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Couldn't load this section."," ",(0,b.jsx)("button",{onClick:aD,className:"cfg-link",children:"Retry"})]})]},a))},a[0]))})]})});if(!A)return null;let{bot:aY,skill:aZ,currentHash:a$,snapshots:a_}=A,a0=!!(aY.source_provider||aY.template_id||aY.template_url||aY.import_schema_version||aY.import_operation_id),a1="saving"===M?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aF||"error"===M?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===M?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(Q)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a2="saving"===W?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aH||"error"===W?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===W?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w($)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a3="saving"===an?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aJ||"error"===an?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===an?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(ar)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a4="saving"===av?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aM||"error"===av?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===av?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(az)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"});return(0,b.jsxs)("div",{className:"cfg-page",children:[(0,b.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(g)}`,onClick:function(a){aN&&!window.confirm("You have unsaved changes. Leave without saving?")&&a.preventDefault()},className:"cfg-link cfg-back text-sm",children:"← Back to Overview"}),(0,b.jsxs)("header",{className:"mt-3 mb-6 flex flex-wrap items-center gap-4",children:[(0,b.jsx)(n.default,{bot:aY,size:48,title:`${aY.name} avatar`}),(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("h1",{className:"text-xl font-bold truncate",children:aY.name}),(0,b.jsx)("p",{className:"text-sm cfg-faint truncate",children:aY.title||" "})]}),(0,b.jsxs)("div",{className:"ml-auto text-right",children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Current config hash:"," ",(0,b.jsx)("code",{className:"cfg-code",title:a$,children:a$.slice(0,8)})," ",(0,b.jsx)("button",{onClick:()=>aO("header",a$),className:"cfg-link text-sm",children:"header"===ac?"Copied":"Copy"})]}),(0,b.jsx)("p",{className:"text-sm mt-1",children:aN?(0,b.jsxs)("span",{className:"cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):(0,b.jsx)("span",{className:"cfg-faint",children:"● Saved"})})]})]}),(0,b.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2 items-start","data-cfg-layout":"columns",children:[(0,b.jsxs)("div",{className:"min-w-0 space-y-6","data-cfg-column":"primary",children:[(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Skills"}),a2]}),"unsupported"===aZ.status?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm cfg-muted mb-3",children:"Unsupported name"}),(0,b.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,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted mb-3",children:[aZ.path," · ","present"===aZ.status?"Present":"Not present"]}),S?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("textarea",{value:U,onChange:a=>V(a.target.value),rows:8,className:"cfg-input text-sm"}),"error"===W&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",Y,"."," ",(0,b.jsx)("button",{onClick:aX,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aX,disabled:!aH||"saving"===W,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===W?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){T(!1),X("clean"),Z("")},disabled:!aH||"saving"===W,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}):"present"===aZ.status?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("pre",{className:"text-sm cfg-pre max-h-64 overflow-y-auto",children:aZ.content}),(0,b.jsx)("button",{onClick:aW,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Edit"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"No skill file yet. Create SKILL.md to give this agent standing instructions."}),(0,b.jsx)("button",{onClick:aW,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Create"})]}),(0,b.jsx)("p",{className:"mt-3 text-xs cfg-faint",children:"Appended verbatim as a system message at launch."})]})]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Rules"}),a1]}),(0,b.jsx)("textarea",{value:K??"",onChange:a=>L(a.target.value),rows:8,className:"cfg-input cfg-input-sans text-sm"}),(0,b.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"===M&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",O,"."," ",(0,b.jsx)("button",{onClick:aP,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aP,disabled:!aF||"saving"===M,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===M?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){L(aE),N("clean"),P("")},disabled:!aF||"saving"===M,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Agent"}),a3]}),(()=>{if(!ae||!ag){let a=(0,k.registrationReadView)(aY,al);return(0,b.jsxs)("div",{"data-field":"runtime-read",children:[(0,b.jsx)("dl",{className:"text-sm",children:a.rows.map(a=>(0,b.jsxs)("div",{"data-row":a.key,className:"flex flex-col sm:flex-row sm:justify-between gap-x-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:a.label}),(0,b.jsx)("dd",{className:"sm:text-right break-words cfg-muted",children:a.value})]},a.key))}),a.notices.map(a=>(0,b.jsx)("p",{className:"text-sm cfg-dirty mt-2",children:a},a)),(0,b.jsx)("button",{onClick:aQ,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Edit"})]})}let a=(0,k.registrationFormView)(ag,ak.state);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(l.RegistrationFields,{idPrefix:"cfg",variant:"config",form:ag,onChange:aR,view:a,showErrors:ai,connections:ak.state,onRetryConnections:ak.retry,onAddConnection:ak.add,workspacePlaceholder:(0,j.defaultWorkdirFor)(aY.id),workspaceHint:(0,j.configWorkspaceHint)(aY.id),sessions:al,includeHomeSession:!0}),"error"===an&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:[ap===s?ap:`Couldn't save: ${ap}.`," ",ap===s?null:(0,b.jsx)("button",{onClick:aV,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aV,disabled:!aJ||"saving"===an||a.submitDisabled,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===an?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:aS,disabled:"saving"===an,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:aJ?"Discard":"Cancel"})]})]})})()]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-3",children:"Template source"}),!a0&&(0,b.jsx)("p",{className:"text-sm cfg-muted mb-3",children:"Created manually in Botmancers — no template source."}),(0,b.jsxs)("dl",{className:"text-sm",children:[(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Source provider"}),(0,b.jsx)("dd",{className:"text-right",children:aY.source_provider??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Template ID"}),(0,b.jsx)("dd",{className:"text-right",children:aY.template_id??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Template URL"}),(0,b.jsx)("dd",{className:"text-right break-all",children:aY.template_url?(a=aY.template_url).startsWith("http://")||a.startsWith("https://")?(0,b.jsx)("a",{href:aY.template_url,className:"cfg-link",children:aY.template_url}):aY.template_url:"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Import schema version"}),(0,b.jsx)("dd",{className:"text-right",children:aY.import_schema_version??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Import operation ID"}),(0,b.jsx)("dd",{className:"text-right break-all",children:aY.import_operation_id??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-y cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Imported at"}),(0,b.jsx)("dd",{className:"text-right",children:aY.import_timestamp?v(aY.import_timestamp):"—"})]})]}),(0,b.jsx)(q,{phase:aB,onImport:()=>{aC()}})]})]}),(0,b.jsxs)("div",{className:"min-w-0 space-y-6","data-cfg-column":"secondary",children:[(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-3",children:"Launch snapshots"}),0===a_.length?(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"No launches recorded yet."}):(0,b.jsx)("ul",{className:"space-y-3",children:a_.map(a=>{let c=a.hash===a$,d=!!aa[a.id];return(0,b.jsxs)("li",{className:"cfg-row",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,b.jsxs)("p",{className:"text-sm",children:[v(a.created_at)," · ",a.id.slice(0,4),a.transport?` \xb7 ${a.transport}`:null]}),(0,b.jsx)("button",{onClick:()=>ab(b=>({...b,[a.id]:!b[a.id]})),"aria-label":d?"Collapse snapshot detail":"Expand snapshot detail",className:"cfg-chevron px-1",children:d?"▾":"▸"})]}),(0,b.jsxs)("p",{className:"mt-1 text-sm",children:[(0,b.jsx)("code",{className:"cfg-code",children:a.hash.slice(0,12)})," ",(0,b.jsx)("button",{onClick:()=>aO(a.id,a.hash),className:"cfg-link text-sm",children:ac===a.id?"Copied":"Copy"})]}),(0,b.jsx)("p",{className:"mt-1 text-sm",children:c?(0,b.jsx)("span",{className:"cfg-ok",children:"● Matches current config"}):(0,b.jsx)("span",{className:"cfg-faint",children:"○ Config changed since"})}),d&&(0,b.jsxs)("div",{className:"mt-3 pt-3 border-t cfg-line text-sm",children:[(0,b.jsxs)("p",{className:"cfg-muted break-all",children:[(0,b.jsx)("span",{className:"font-medium",children:"Launch ID:"})," ",a.id]}),(0,b.jsxs)("p",{className:"mt-1 cfg-muted break-all",children:[(0,b.jsx)("span",{className:"font-medium",children:"Hash:"})," ",(0,b.jsx)("code",{className:"cfg-code",children:a.hash})]}),(0,b.jsx)("dl",{className:"mt-2",children:t.map(c=>{let d=a.snapshot[c.key];return(0,b.jsxs)("div",{className:"py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:c.label}),(0,b.jsx)("dd",{className:"whitespace-pre-wrap break-words",children:null==d?(0,b.jsx)("span",{className:"cfg-faint",children:"null"}):Array.isArray(d)?0===d.length?(0,b.jsx)("span",{className:"cfg-faint",children:"(none)"}):(0,b.jsx)("span",{className:"block max-h-32 overflow-y-auto",children:d.map(a=>`- ${a}`).join("\n")}):"boolean"==typeof d?String(d):""===d?(0,b.jsx)("span",{className:"cfg-faint",children:"(empty)"}):(0,b.jsx)("span",{className:"block max-h-32 overflow-y-auto",children:d})})]},c.key)})})]})]},a.id)})})]}),(0,b.jsx)(h,{agentId:aY.id,agentName:aY.name}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Avatar"}),a4]}),(0,b.jsxs)("div",{className:"flex items-center gap-4 mb-4",children:[(0,b.jsx)(n.default,{config:aL,size:96,title:"Avatar live preview"}),(0,b.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,b.jsx)(o,{attribute:"color",label:"Color",options:r.AVATAR_COLORS,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"eyes",label:"Eyes",options:r.AVATAR_EYES,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"hands",label:"Hands",options:r.AVATAR_HANDS,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"accessory",label:"Accessory",options:r.AVATAR_ACCESSORIES,current:aL,onPick:aT}),"error"===av&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",ax,"."," ",(0,b.jsx)("button",{onClick:aU,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aU,disabled:!aM||"saving"===av,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===av?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){au(null),aw("clean"),ay("")},disabled:!aM||"saving"===av,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}),(0,b.jsxs)("section",{className:"cfg-card cfg-danger","aria-labelledby":"cfg-danger-title",children:[(0,b.jsx)("h2",{id:"cfg-danger-title",className:"cfg-title mb-3",children:"Danger zone"}),(0,b.jsx)("p",{className:"text-sm cfg-muted",children:i.DELETE_REMOVES_COPY}),(0,b.jsx)("p",{className:"text-sm cfg-faint mt-2",children:i.DELETE_KEEPS_COPY}),(0,b.jsx)("button",{type:"button",onClick:()=>z(!0),className:"mt-3 delete-btn text-sm w-full sm:w-auto",children:"Delete agent"})]})]})]})]}),y?(0,b.jsx)(f.default,{ids:[aY.id],onCancel:()=>z(!1),onDeleted:a=>u.push(`/?deleted=${Math.max(a.length,1)}`)}):null]})}],25209)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=app_bots_%5Bid%5D_config_page_tsx_1e0uue9._.js.map
|