@stigmer/server-slim 3.36.0 → 3.37.1
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/console/404.html +1 -1
- package/console/__next.__PAGE__.txt +2 -2
- package/console/__next._full.txt +14 -14
- package/console/__next._head.txt +4 -4
- package/console/__next._index.txt +9 -9
- package/console/__next._tree.txt +1 -1
- package/console/_next/static/chunks/0ruvic3m1tid0.js +1 -0
- package/console/_next/static/chunks/0safj6dzm9hdx.js +1 -0
- package/console/_next/static/chunks/0vreqk5pkgf6r.js +1 -0
- package/console/_next/static/chunks/0vx4g_lnlck8u.js +1 -0
- package/console/_next/static/chunks/{0mywrwes-e5s0.js → 0yeggs7p81put.js} +3 -3
- package/console/_next/static/chunks/0~lruz9m9iasi.js +1 -0
- package/console/_next/static/chunks/{15ujs0cxvcbwz.js → 11i.dbxqrdc26.js} +1 -1
- package/console/_not-found/__next._full.txt +14 -14
- package/console/_not-found/__next._head.txt +4 -4
- package/console/_not-found/__next._index.txt +9 -9
- package/console/_not-found/__next._not-found.__PAGE__.txt +3 -3
- package/console/_not-found/__next._not-found.txt +3 -3
- package/console/_not-found/__next._tree.txt +1 -1
- package/console/_not-found.html +1 -1
- package/console/_not-found.txt +14 -14
- package/console/auth/callback/__next._full.txt +16 -16
- package/console/auth/callback/__next._head.txt +4 -4
- package/console/auth/callback/__next._index.txt +9 -9
- package/console/auth/callback/__next._tree.txt +1 -1
- package/console/auth/callback/__next.auth.callback.__PAGE__.txt +4 -4
- package/console/auth/callback/__next.auth.callback.txt +3 -3
- package/console/auth/callback/__next.auth.txt +3 -3
- package/console/auth/callback.html +1 -1
- package/console/auth/callback.txt +16 -16
- package/console/auth/github/callback/__next._full.txt +16 -16
- package/console/auth/github/callback/__next._head.txt +4 -4
- package/console/auth/github/callback/__next._index.txt +9 -9
- package/console/auth/github/callback/__next._tree.txt +1 -1
- package/console/auth/github/callback/__next.auth.github.callback.__PAGE__.txt +4 -4
- package/console/auth/github/callback/__next.auth.github.callback.txt +3 -3
- package/console/auth/github/callback/__next.auth.github.txt +3 -3
- package/console/auth/github/callback/__next.auth.txt +3 -3
- package/console/auth/github/callback.html +1 -1
- package/console/auth/github/callback.txt +16 -16
- package/console/auth/oauth/callback/__next._full.txt +16 -16
- package/console/auth/oauth/callback/__next._head.txt +4 -4
- package/console/auth/oauth/callback/__next._index.txt +9 -9
- package/console/auth/oauth/callback/__next._tree.txt +1 -1
- package/console/auth/oauth/callback/__next.auth.oauth.callback.__PAGE__.txt +4 -4
- package/console/auth/oauth/callback/__next.auth.oauth.callback.txt +3 -3
- package/console/auth/oauth/callback/__next.auth.oauth.txt +3 -3
- package/console/auth/oauth/callback/__next.auth.txt +3 -3
- package/console/auth/oauth/callback.html +1 -1
- package/console/auth/oauth/callback.txt +16 -16
- package/console/chat/__placeholder__/__placeholder__/__next._full.txt +15 -15
- package/console/chat/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/chat/__placeholder__/__placeholder__/__next._index.txt +9 -9
- package/console/chat/__placeholder__/__placeholder__/__next._tree.txt +1 -1
- package/console/chat/__placeholder__/__placeholder__/__next.chat.$d$org.$d$slug.__PAGE__.txt +3 -3
- package/console/chat/__placeholder__/__placeholder__/__next.chat.$d$org.$d$slug.txt +3 -3
- package/console/chat/__placeholder__/__placeholder__/__next.chat.$d$org.txt +3 -3
- package/console/chat/__placeholder__/__placeholder__/__next.chat.txt +3 -3
- package/console/chat/__placeholder__/__placeholder__.html +1 -1
- package/console/chat/__placeholder__/__placeholder__.txt +15 -15
- package/console/conversations/__next._full.txt +15 -15
- package/console/conversations/__next._head.txt +4 -4
- package/console/conversations/__next._index.txt +9 -9
- package/console/conversations/__next._tree.txt +1 -1
- package/console/conversations/__next.conversations.__PAGE__.txt +3 -3
- package/console/conversations/__next.conversations.txt +3 -3
- package/console/conversations/__placeholder__/__placeholder__/__next._full.txt +15 -15
- package/console/conversations/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/conversations/__placeholder__/__placeholder__/__next._index.txt +9 -9
- package/console/conversations/__placeholder__/__placeholder__/__next._tree.txt +1 -1
- package/console/conversations/__placeholder__/__placeholder__/__next.conversations.$d$channelId.$d$key.__PAGE__.txt +3 -3
- package/console/conversations/__placeholder__/__placeholder__/__next.conversations.$d$channelId.$d$key.txt +3 -3
- package/console/conversations/__placeholder__/__placeholder__/__next.conversations.$d$channelId.txt +3 -3
- package/console/conversations/__placeholder__/__placeholder__/__next.conversations.txt +3 -3
- package/console/conversations/__placeholder__/__placeholder__.html +1 -1
- package/console/conversations/__placeholder__/__placeholder__.txt +15 -15
- package/console/conversations.html +1 -1
- package/console/conversations.txt +15 -15
- package/console/dashboard/__next._full.txt +15 -15
- package/console/dashboard/__next._head.txt +4 -4
- package/console/dashboard/__next._index.txt +9 -9
- package/console/dashboard/__next._tree.txt +1 -1
- package/console/dashboard/__next.dashboard.__PAGE__.txt +3 -3
- package/console/dashboard/__next.dashboard.txt +3 -3
- package/console/dashboard.html +1 -1
- package/console/dashboard.txt +15 -15
- package/console/executions/__placeholder__/__next._full.txt +14 -14
- package/console/executions/__placeholder__/__next._head.txt +4 -4
- package/console/executions/__placeholder__/__next._index.txt +9 -9
- package/console/executions/__placeholder__/__next._tree.txt +1 -1
- package/console/executions/__placeholder__/__next.executions.$d$id.__PAGE__.txt +2 -2
- package/console/executions/__placeholder__/__next.executions.$d$id.txt +3 -3
- package/console/executions/__placeholder__/__next.executions.txt +3 -3
- package/console/executions/__placeholder__.html +1 -1
- package/console/executions/__placeholder__.txt +14 -14
- package/console/index.html +1 -1
- package/console/index.txt +14 -14
- package/console/invite/__placeholder__/__next._full.txt +15 -15
- package/console/invite/__placeholder__/__next._head.txt +4 -4
- package/console/invite/__placeholder__/__next._index.txt +9 -9
- package/console/invite/__placeholder__/__next._tree.txt +1 -1
- package/console/invite/__placeholder__/__next.invite.$d$token.__PAGE__.txt +3 -3
- package/console/invite/__placeholder__/__next.invite.$d$token.txt +3 -3
- package/console/invite/__placeholder__/__next.invite.txt +3 -3
- package/console/invite/__placeholder__.html +1 -1
- package/console/invite/__placeholder__.txt +15 -15
- package/console/library/__next._full.txt +18 -18
- package/console/library/__next._head.txt +4 -4
- package/console/library/__next._index.txt +9 -9
- package/console/library/__next._tree.txt +1 -1
- package/console/library/__next.library.__PAGE__.txt +3 -3
- package/console/library/__next.library.txt +5 -5
- package/console/library/agents/__next._full.txt +18 -18
- package/console/library/agents/__next._head.txt +4 -4
- package/console/library/agents/__next._index.txt +9 -9
- package/console/library/agents/__next._tree.txt +1 -1
- package/console/library/agents/__next.library.agents.__PAGE__.txt +3 -3
- package/console/library/agents/__next.library.agents.txt +3 -3
- package/console/library/agents/__next.library.txt +5 -5
- package/console/library/agents/__placeholder__/__placeholder__/__next._full.txt +18 -18
- package/console/library/agents/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/library/agents/__placeholder__/__placeholder__/__next._index.txt +9 -9
- package/console/library/agents/__placeholder__/__placeholder__/__next._tree.txt +1 -1
- package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.$d$org.$d$slug.__PAGE__.txt +3 -3
- package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.$d$org.$d$slug.txt +3 -3
- package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.$d$org.txt +3 -3
- package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.txt +3 -3
- package/console/library/agents/__placeholder__/__placeholder__/__next.library.txt +5 -5
- package/console/library/agents/__placeholder__/__placeholder__.html +1 -1
- package/console/library/agents/__placeholder__/__placeholder__.txt +18 -18
- package/console/library/agents/new/__next._full.txt +19 -19
- package/console/library/agents/new/__next._head.txt +4 -4
- package/console/library/agents/new/__next._index.txt +9 -9
- package/console/library/agents/new/__next._tree.txt +1 -1
- package/console/library/agents/new/__next.library.agents.new.__PAGE__.txt +4 -4
- package/console/library/agents/new/__next.library.agents.new.txt +3 -3
- package/console/library/agents/new/__next.library.agents.txt +3 -3
- package/console/library/agents/new/__next.library.txt +5 -5
- package/console/library/agents/new.html +1 -1
- package/console/library/agents/new.txt +19 -19
- package/console/library/agents.html +1 -1
- package/console/library/agents.txt +18 -18
- package/console/library/mcp-servers/__next._full.txt +18 -18
- package/console/library/mcp-servers/__next._head.txt +4 -4
- package/console/library/mcp-servers/__next._index.txt +9 -9
- package/console/library/mcp-servers/__next._tree.txt +1 -1
- package/console/library/mcp-servers/__next.library.mcp-servers.__PAGE__.txt +3 -3
- package/console/library/mcp-servers/__next.library.mcp-servers.txt +3 -3
- package/console/library/mcp-servers/__next.library.txt +5 -5
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._full.txt +18 -18
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._index.txt +9 -9
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._tree.txt +1 -1
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.$d$org.$d$slug.__PAGE__.txt +3 -3
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.$d$org.$d$slug.txt +3 -3
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.$d$org.txt +3 -3
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.txt +3 -3
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.txt +5 -5
- package/console/library/mcp-servers/__placeholder__/__placeholder__.html +1 -1
- package/console/library/mcp-servers/__placeholder__/__placeholder__.txt +18 -18
- package/console/library/mcp-servers/new/__next._full.txt +19 -19
- package/console/library/mcp-servers/new/__next._head.txt +4 -4
- package/console/library/mcp-servers/new/__next._index.txt +9 -9
- package/console/library/mcp-servers/new/__next._tree.txt +1 -1
- package/console/library/mcp-servers/new/__next.library.mcp-servers.new.__PAGE__.txt +4 -4
- package/console/library/mcp-servers/new/__next.library.mcp-servers.new.txt +3 -3
- package/console/library/mcp-servers/new/__next.library.mcp-servers.txt +3 -3
- package/console/library/mcp-servers/new/__next.library.txt +5 -5
- package/console/library/mcp-servers/new.html +1 -1
- package/console/library/mcp-servers/new.txt +19 -19
- package/console/library/mcp-servers.html +1 -1
- package/console/library/mcp-servers.txt +18 -18
- package/console/library/plugins/__next._full.txt +18 -18
- package/console/library/plugins/__next._head.txt +4 -4
- package/console/library/plugins/__next._index.txt +9 -9
- package/console/library/plugins/__next._tree.txt +1 -1
- package/console/library/plugins/__next.library.plugins.__PAGE__.txt +3 -3
- package/console/library/plugins/__next.library.plugins.txt +3 -3
- package/console/library/plugins/__next.library.txt +5 -5
- package/console/library/plugins/__placeholder__/__placeholder__/__next._full.txt +18 -18
- package/console/library/plugins/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/library/plugins/__placeholder__/__placeholder__/__next._index.txt +9 -9
- package/console/library/plugins/__placeholder__/__placeholder__/__next._tree.txt +1 -1
- package/console/library/plugins/__placeholder__/__placeholder__/__next.library.plugins.$d$org.$d$slug.__PAGE__.txt +3 -3
- package/console/library/plugins/__placeholder__/__placeholder__/__next.library.plugins.$d$org.$d$slug.txt +3 -3
- package/console/library/plugins/__placeholder__/__placeholder__/__next.library.plugins.$d$org.txt +3 -3
- package/console/library/plugins/__placeholder__/__placeholder__/__next.library.plugins.txt +3 -3
- package/console/library/plugins/__placeholder__/__placeholder__/__next.library.txt +5 -5
- package/console/library/plugins/__placeholder__/__placeholder__.html +1 -1
- package/console/library/plugins/__placeholder__/__placeholder__.txt +18 -18
- package/console/library/plugins/upload/__next._full.txt +19 -19
- package/console/library/plugins/upload/__next._head.txt +4 -4
- package/console/library/plugins/upload/__next._index.txt +9 -9
- package/console/library/plugins/upload/__next._tree.txt +1 -1
- package/console/library/plugins/upload/__next.library.plugins.txt +3 -3
- package/console/library/plugins/upload/__next.library.plugins.upload.__PAGE__.txt +4 -4
- package/console/library/plugins/upload/__next.library.plugins.upload.txt +3 -3
- package/console/library/plugins/upload/__next.library.txt +5 -5
- package/console/library/plugins/upload.html +1 -1
- package/console/library/plugins/upload.txt +19 -19
- package/console/library/plugins.html +1 -1
- package/console/library/plugins.txt +18 -18
- package/console/library/schedules/__next._full.txt +18 -18
- package/console/library/schedules/__next._head.txt +4 -4
- package/console/library/schedules/__next._index.txt +9 -9
- package/console/library/schedules/__next._tree.txt +1 -1
- package/console/library/schedules/__next.library.schedules.__PAGE__.txt +3 -3
- package/console/library/schedules/__next.library.schedules.txt +3 -3
- package/console/library/schedules/__next.library.txt +5 -5
- package/console/library/schedules/__placeholder__/__placeholder__/__next._full.txt +18 -18
- package/console/library/schedules/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/library/schedules/__placeholder__/__placeholder__/__next._index.txt +9 -9
- package/console/library/schedules/__placeholder__/__placeholder__/__next._tree.txt +1 -1
- package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.$d$org.$d$slug.__PAGE__.txt +3 -3
- package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.$d$org.$d$slug.txt +3 -3
- package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.$d$org.txt +3 -3
- package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.txt +3 -3
- package/console/library/schedules/__placeholder__/__placeholder__/__next.library.txt +5 -5
- package/console/library/schedules/__placeholder__/__placeholder__.html +1 -1
- package/console/library/schedules/__placeholder__/__placeholder__.txt +18 -18
- package/console/library/schedules/new/__next._full.txt +19 -19
- package/console/library/schedules/new/__next._head.txt +4 -4
- package/console/library/schedules/new/__next._index.txt +9 -9
- package/console/library/schedules/new/__next._tree.txt +1 -1
- package/console/library/schedules/new/__next.library.schedules.new.__PAGE__.txt +4 -4
- package/console/library/schedules/new/__next.library.schedules.new.txt +3 -3
- package/console/library/schedules/new/__next.library.schedules.txt +3 -3
- package/console/library/schedules/new/__next.library.txt +5 -5
- package/console/library/schedules/new.html +1 -1
- package/console/library/schedules/new.txt +19 -19
- package/console/library/schedules.html +1 -1
- package/console/library/schedules.txt +18 -18
- package/console/library/skills/__next._full.txt +18 -18
- package/console/library/skills/__next._head.txt +4 -4
- package/console/library/skills/__next._index.txt +9 -9
- package/console/library/skills/__next._tree.txt +1 -1
- package/console/library/skills/__next.library.skills.__PAGE__.txt +3 -3
- package/console/library/skills/__next.library.skills.txt +3 -3
- package/console/library/skills/__next.library.txt +5 -5
- package/console/library/skills/__placeholder__/__placeholder__/__next._full.txt +18 -18
- package/console/library/skills/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/library/skills/__placeholder__/__placeholder__/__next._index.txt +9 -9
- package/console/library/skills/__placeholder__/__placeholder__/__next._tree.txt +1 -1
- package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.$d$org.$d$slug.__PAGE__.txt +3 -3
- package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.$d$org.$d$slug.txt +3 -3
- package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.$d$org.txt +3 -3
- package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.txt +3 -3
- package/console/library/skills/__placeholder__/__placeholder__/__next.library.txt +5 -5
- package/console/library/skills/__placeholder__/__placeholder__.html +1 -1
- package/console/library/skills/__placeholder__/__placeholder__.txt +18 -18
- package/console/library/skills/new/__next._full.txt +19 -19
- package/console/library/skills/new/__next._head.txt +4 -4
- package/console/library/skills/new/__next._index.txt +9 -9
- package/console/library/skills/new/__next._tree.txt +1 -1
- package/console/library/skills/new/__next.library.skills.new.__PAGE__.txt +4 -4
- package/console/library/skills/new/__next.library.skills.new.txt +3 -3
- package/console/library/skills/new/__next.library.skills.txt +3 -3
- package/console/library/skills/new/__next.library.txt +5 -5
- package/console/library/skills/new.html +1 -1
- package/console/library/skills/new.txt +19 -19
- package/console/library/skills.html +1 -1
- package/console/library/skills.txt +18 -18
- package/console/library/workflows/__next._full.txt +18 -18
- package/console/library/workflows/__next._head.txt +4 -4
- package/console/library/workflows/__next._index.txt +9 -9
- package/console/library/workflows/__next._tree.txt +1 -1
- package/console/library/workflows/__next.library.txt +5 -5
- package/console/library/workflows/__next.library.workflows.__PAGE__.txt +3 -3
- package/console/library/workflows/__next.library.workflows.txt +3 -3
- package/console/library/workflows/__placeholder__/__placeholder__/__next._full.txt +18 -18
- package/console/library/workflows/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/library/workflows/__placeholder__/__placeholder__/__next._index.txt +9 -9
- package/console/library/workflows/__placeholder__/__placeholder__/__next._tree.txt +1 -1
- package/console/library/workflows/__placeholder__/__placeholder__/__next.library.txt +5 -5
- package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.$d$org.$d$slug.__PAGE__.txt +3 -3
- package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.$d$org.$d$slug.txt +3 -3
- package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.$d$org.txt +3 -3
- package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.txt +3 -3
- package/console/library/workflows/__placeholder__/__placeholder__.html +1 -1
- package/console/library/workflows/__placeholder__/__placeholder__.txt +18 -18
- package/console/library/workflows/executions/__next._full.txt +18 -18
- package/console/library/workflows/executions/__next._head.txt +4 -4
- package/console/library/workflows/executions/__next._index.txt +9 -9
- package/console/library/workflows/executions/__next._tree.txt +1 -1
- package/console/library/workflows/executions/__next.library.txt +5 -5
- package/console/library/workflows/executions/__next.library.workflows.executions.__PAGE__.txt +3 -3
- package/console/library/workflows/executions/__next.library.workflows.executions.txt +3 -3
- package/console/library/workflows/executions/__next.library.workflows.txt +3 -3
- package/console/library/workflows/executions.html +1 -1
- package/console/library/workflows/executions.txt +18 -18
- package/console/library/workflows/new/__next._full.txt +19 -19
- package/console/library/workflows/new/__next._head.txt +4 -4
- package/console/library/workflows/new/__next._index.txt +9 -9
- package/console/library/workflows/new/__next._tree.txt +1 -1
- package/console/library/workflows/new/__next.library.txt +5 -5
- package/console/library/workflows/new/__next.library.workflows.new.__PAGE__.txt +4 -4
- package/console/library/workflows/new/__next.library.workflows.new.txt +3 -3
- package/console/library/workflows/new/__next.library.workflows.txt +3 -3
- package/console/library/workflows/new.html +1 -1
- package/console/library/workflows/new.txt +19 -19
- package/console/library/workflows.html +1 -1
- package/console/library/workflows.txt +18 -18
- package/console/library.html +1 -1
- package/console/library.txt +18 -18
- package/console/login/__next._full.txt +16 -16
- package/console/login/__next._head.txt +4 -4
- package/console/login/__next._index.txt +9 -9
- package/console/login/__next._tree.txt +1 -1
- package/console/login/__next.login.__PAGE__.txt +4 -4
- package/console/login/__next.login.txt +3 -3
- package/console/login.html +1 -1
- package/console/login.txt +16 -16
- package/console/marketplace/__next._full.txt +15 -15
- package/console/marketplace/__next._head.txt +4 -4
- package/console/marketplace/__next._index.txt +9 -9
- package/console/marketplace/__next._tree.txt +1 -1
- package/console/marketplace/__next.marketplace.__PAGE__.txt +3 -3
- package/console/marketplace/__next.marketplace.txt +3 -3
- package/console/marketplace.html +1 -1
- package/console/marketplace.txt +15 -15
- package/console/oauth/slack/callback/__next._full.txt +16 -16
- package/console/oauth/slack/callback/__next._head.txt +4 -4
- package/console/oauth/slack/callback/__next._index.txt +9 -9
- package/console/oauth/slack/callback/__next._tree.txt +1 -1
- package/console/oauth/slack/callback/__next.oauth.slack.callback.__PAGE__.txt +4 -4
- package/console/oauth/slack/callback/__next.oauth.slack.callback.txt +3 -3
- package/console/oauth/slack/callback/__next.oauth.slack.txt +3 -3
- package/console/oauth/slack/callback/__next.oauth.txt +3 -3
- package/console/oauth/slack/callback.html +1 -1
- package/console/oauth/slack/callback.txt +16 -16
- package/console/sessions/__placeholder__/__next._full.txt +14 -14
- package/console/sessions/__placeholder__/__next._head.txt +4 -4
- package/console/sessions/__placeholder__/__next._index.txt +9 -9
- package/console/sessions/__placeholder__/__next._tree.txt +1 -1
- package/console/sessions/__placeholder__/__next.sessions.$d$id.__PAGE__.txt +2 -2
- package/console/sessions/__placeholder__/__next.sessions.$d$id.txt +3 -3
- package/console/sessions/__placeholder__/__next.sessions.txt +3 -3
- package/console/sessions/__placeholder__.html +1 -1
- package/console/sessions/__placeholder__.txt +14 -14
- package/console/settings/__next._full.txt +18 -18
- package/console/settings/__next._head.txt +4 -4
- package/console/settings/__next._index.txt +9 -9
- package/console/settings/__next._tree.txt +1 -1
- package/console/settings/__next.settings.__PAGE__.txt +4 -4
- package/console/settings/__next.settings.txt +5 -5
- package/console/settings/account-preferences/__next._full.txt +17 -17
- package/console/settings/account-preferences/__next._head.txt +4 -4
- package/console/settings/account-preferences/__next._index.txt +9 -9
- package/console/settings/account-preferences/__next._tree.txt +1 -1
- package/console/settings/account-preferences/__next.settings.account-preferences.__PAGE__.txt +3 -3
- package/console/settings/account-preferences/__next.settings.account-preferences.txt +3 -3
- package/console/settings/account-preferences/__next.settings.txt +5 -5
- package/console/settings/account-preferences.html +1 -1
- package/console/settings/account-preferences.txt +17 -17
- package/console/settings/api-keys/__next._full.txt +17 -17
- package/console/settings/api-keys/__next._head.txt +4 -4
- package/console/settings/api-keys/__next._index.txt +9 -9
- package/console/settings/api-keys/__next._tree.txt +1 -1
- package/console/settings/api-keys/__next.settings.api-keys.__PAGE__.txt +3 -3
- package/console/settings/api-keys/__next.settings.api-keys.txt +3 -3
- package/console/settings/api-keys/__next.settings.txt +5 -5
- package/console/settings/api-keys.html +1 -1
- package/console/settings/api-keys.txt +17 -17
- package/console/settings/billing/__next._full.txt +18 -18
- package/console/settings/billing/__next._head.txt +4 -4
- package/console/settings/billing/__next._index.txt +9 -9
- package/console/settings/billing/__next._tree.txt +1 -1
- package/console/settings/billing/__next.settings.billing.__PAGE__.txt +4 -4
- package/console/settings/billing/__next.settings.billing.txt +3 -3
- package/console/settings/billing/__next.settings.txt +5 -5
- package/console/settings/billing.html +1 -1
- package/console/settings/billing.txt +18 -18
- package/console/settings/channel-apps/__next._full.txt +17 -17
- package/console/settings/channel-apps/__next._head.txt +4 -4
- package/console/settings/channel-apps/__next._index.txt +9 -9
- package/console/settings/channel-apps/__next._tree.txt +1 -1
- package/console/settings/channel-apps/__next.settings.channel-apps.__PAGE__.txt +3 -3
- package/console/settings/channel-apps/__next.settings.channel-apps.txt +3 -3
- package/console/settings/channel-apps/__next.settings.txt +5 -5
- package/console/settings/channel-apps.html +1 -1
- package/console/settings/channel-apps.txt +17 -17
- package/console/settings/cursor-accounts/__next._full.txt +18 -18
- package/console/settings/cursor-accounts/__next._head.txt +4 -4
- package/console/settings/cursor-accounts/__next._index.txt +9 -9
- package/console/settings/cursor-accounts/__next._tree.txt +1 -1
- package/console/settings/cursor-accounts/__next.settings.cursor-accounts.__PAGE__.txt +4 -4
- package/console/settings/cursor-accounts/__next.settings.cursor-accounts.txt +3 -3
- package/console/settings/cursor-accounts/__next.settings.txt +5 -5
- package/console/settings/cursor-accounts.html +1 -1
- package/console/settings/cursor-accounts.txt +18 -18
- package/console/settings/environments/__next._full.txt +17 -17
- package/console/settings/environments/__next._head.txt +4 -4
- package/console/settings/environments/__next._index.txt +9 -9
- package/console/settings/environments/__next._tree.txt +1 -1
- package/console/settings/environments/__next.settings.environments.__PAGE__.txt +3 -3
- package/console/settings/environments/__next.settings.environments.txt +3 -3
- package/console/settings/environments/__next.settings.txt +5 -5
- package/console/settings/environments.html +1 -1
- package/console/settings/environments.txt +17 -17
- package/console/settings/identity-providers/__next._full.txt +17 -17
- package/console/settings/identity-providers/__next._head.txt +4 -4
- package/console/settings/identity-providers/__next._index.txt +9 -9
- package/console/settings/identity-providers/__next._tree.txt +1 -1
- package/console/settings/identity-providers/__next.settings.identity-providers.__PAGE__.txt +3 -3
- package/console/settings/identity-providers/__next.settings.identity-providers.txt +3 -3
- package/console/settings/identity-providers/__next.settings.txt +5 -5
- package/console/settings/identity-providers.html +1 -1
- package/console/settings/identity-providers.txt +17 -17
- package/console/settings/invitations/__next._full.txt +17 -17
- package/console/settings/invitations/__next._head.txt +4 -4
- package/console/settings/invitations/__next._index.txt +9 -9
- package/console/settings/invitations/__next._tree.txt +1 -1
- package/console/settings/invitations/__next.settings.invitations.__PAGE__.txt +3 -3
- package/console/settings/invitations/__next.settings.invitations.txt +3 -3
- package/console/settings/invitations/__next.settings.txt +5 -5
- package/console/settings/invitations.html +1 -1
- package/console/settings/invitations.txt +17 -17
- package/console/settings/licenses/__next._full.txt +19 -19
- package/console/settings/licenses/__next._head.txt +4 -4
- package/console/settings/licenses/__next._index.txt +9 -9
- package/console/settings/licenses/__next._tree.txt +1 -1
- package/console/settings/licenses/__next.settings.licenses.__PAGE__.txt +4 -4
- package/console/settings/licenses/__next.settings.licenses.txt +3 -3
- package/console/settings/licenses/__next.settings.txt +5 -5
- package/console/settings/licenses.html +1 -1
- package/console/settings/licenses.txt +19 -19
- package/console/settings/members/__next._full.txt +18 -18
- package/console/settings/members/__next._head.txt +4 -4
- package/console/settings/members/__next._index.txt +9 -9
- package/console/settings/members/__next._tree.txt +1 -1
- package/console/settings/members/__next.settings.members.__PAGE__.txt +3 -3
- package/console/settings/members/__next.settings.members.txt +3 -3
- package/console/settings/members/__next.settings.txt +5 -5
- package/console/settings/members.html +1 -1
- package/console/settings/members.txt +18 -18
- package/console/settings/memory/__next._full.txt +17 -17
- package/console/settings/memory/__next._head.txt +4 -4
- package/console/settings/memory/__next._index.txt +9 -9
- package/console/settings/memory/__next._tree.txt +1 -1
- package/console/settings/memory/__next.settings.memory.__PAGE__.txt +3 -3
- package/console/settings/memory/__next.settings.memory.txt +3 -3
- package/console/settings/memory/__next.settings.txt +5 -5
- package/console/settings/memory.html +1 -1
- package/console/settings/memory.txt +17 -17
- package/console/settings/oauth-apps/__next._full.txt +17 -17
- package/console/settings/oauth-apps/__next._head.txt +4 -4
- package/console/settings/oauth-apps/__next._index.txt +9 -9
- package/console/settings/oauth-apps/__next._tree.txt +1 -1
- package/console/settings/oauth-apps/__next.settings.oauth-apps.__PAGE__.txt +3 -3
- package/console/settings/oauth-apps/__next.settings.oauth-apps.txt +3 -3
- package/console/settings/oauth-apps/__next.settings.txt +5 -5
- package/console/settings/oauth-apps.html +1 -1
- package/console/settings/oauth-apps.txt +17 -17
- package/console/settings/org-preferences/__next._full.txt +17 -17
- package/console/settings/org-preferences/__next._head.txt +4 -4
- package/console/settings/org-preferences/__next._index.txt +9 -9
- package/console/settings/org-preferences/__next._tree.txt +1 -1
- package/console/settings/org-preferences/__next.settings.org-preferences.__PAGE__.txt +3 -3
- package/console/settings/org-preferences/__next.settings.org-preferences.txt +3 -3
- package/console/settings/org-preferences/__next.settings.txt +5 -5
- package/console/settings/org-preferences.html +1 -1
- package/console/settings/org-preferences.txt +17 -17
- package/console/settings/org-profile/__next._full.txt +17 -17
- package/console/settings/org-profile/__next._head.txt +4 -4
- package/console/settings/org-profile/__next._index.txt +9 -9
- package/console/settings/org-profile/__next._tree.txt +1 -1
- package/console/settings/org-profile/__next.settings.org-profile.__PAGE__.txt +3 -3
- package/console/settings/org-profile/__next.settings.org-profile.txt +3 -3
- package/console/settings/org-profile/__next.settings.txt +5 -5
- package/console/settings/org-profile.html +1 -1
- package/console/settings/org-profile.txt +17 -17
- package/console/settings/platform-clients/__next._full.txt +17 -17
- package/console/settings/platform-clients/__next._head.txt +4 -4
- package/console/settings/platform-clients/__next._index.txt +9 -9
- package/console/settings/platform-clients/__next._tree.txt +1 -1
- package/console/settings/platform-clients/__next.settings.platform-clients.__PAGE__.txt +3 -3
- package/console/settings/platform-clients/__next.settings.platform-clients.txt +3 -3
- package/console/settings/platform-clients/__next.settings.txt +5 -5
- package/console/settings/platform-clients.html +1 -1
- package/console/settings/platform-clients.txt +17 -17
- package/console/settings/pricing-governance/__next._full.txt +18 -18
- package/console/settings/pricing-governance/__next._head.txt +4 -4
- package/console/settings/pricing-governance/__next._index.txt +9 -9
- package/console/settings/pricing-governance/__next._tree.txt +1 -1
- package/console/settings/pricing-governance/__next.settings.pricing-governance.__PAGE__.txt +4 -4
- package/console/settings/pricing-governance/__next.settings.pricing-governance.txt +3 -3
- package/console/settings/pricing-governance/__next.settings.txt +5 -5
- package/console/settings/pricing-governance.html +1 -1
- package/console/settings/pricing-governance.txt +18 -18
- package/console/settings/provider-standing/__next._full.txt +18 -18
- package/console/settings/provider-standing/__next._head.txt +4 -4
- package/console/settings/provider-standing/__next._index.txt +9 -9
- package/console/settings/provider-standing/__next._tree.txt +1 -1
- package/console/settings/provider-standing/__next.settings.provider-standing.__PAGE__.txt +4 -4
- package/console/settings/provider-standing/__next.settings.provider-standing.txt +3 -3
- package/console/settings/provider-standing/__next.settings.txt +5 -5
- package/console/settings/provider-standing.html +1 -1
- package/console/settings/provider-standing.txt +18 -18
- package/console/settings/teams/__next._full.txt +17 -17
- package/console/settings/teams/__next._head.txt +4 -4
- package/console/settings/teams/__next._index.txt +9 -9
- package/console/settings/teams/__next._tree.txt +1 -1
- package/console/settings/teams/__next.settings.teams.__PAGE__.txt +3 -3
- package/console/settings/teams/__next.settings.teams.txt +3 -3
- package/console/settings/teams/__next.settings.txt +5 -5
- package/console/settings/teams.html +1 -1
- package/console/settings/teams.txt +17 -17
- package/console/settings/usage/__next._full.txt +17 -17
- package/console/settings/usage/__next._head.txt +4 -4
- package/console/settings/usage/__next._index.txt +9 -9
- package/console/settings/usage/__next._tree.txt +1 -1
- package/console/settings/usage/__next.settings.txt +5 -5
- package/console/settings/usage/__next.settings.usage.__PAGE__.txt +3 -3
- package/console/settings/usage/__next.settings.usage.txt +3 -3
- package/console/settings/usage.html +1 -1
- package/console/settings/usage.txt +17 -17
- package/console/settings.html +1 -1
- package/console/settings.txt +18 -18
- package/console/workflows/__next._full.txt +14 -14
- package/console/workflows/__next._head.txt +4 -4
- package/console/workflows/__next._index.txt +9 -9
- package/console/workflows/__next._tree.txt +1 -1
- package/console/workflows/__next.workflows.__PAGE__.txt +2 -2
- package/console/workflows/__next.workflows.txt +3 -3
- package/console/workflows/__placeholder__/__placeholder__/__next._full.txt +15 -15
- package/console/workflows/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/workflows/__placeholder__/__placeholder__/__next._index.txt +9 -9
- package/console/workflows/__placeholder__/__placeholder__/__next._tree.txt +1 -1
- package/console/workflows/__placeholder__/__placeholder__/__next.workflows.$d$org.$d$slug.__PAGE__.txt +3 -3
- package/console/workflows/__placeholder__/__placeholder__/__next.workflows.$d$org.$d$slug.txt +3 -3
- package/console/workflows/__placeholder__/__placeholder__/__next.workflows.$d$org.txt +3 -3
- package/console/workflows/__placeholder__/__placeholder__/__next.workflows.txt +3 -3
- package/console/workflows/__placeholder__/__placeholder__.html +1 -1
- package/console/workflows/__placeholder__/__placeholder__.txt +15 -15
- package/console/workflows/executions/__next._full.txt +14 -14
- package/console/workflows/executions/__next._head.txt +4 -4
- package/console/workflows/executions/__next._index.txt +9 -9
- package/console/workflows/executions/__next._tree.txt +1 -1
- package/console/workflows/executions/__next.workflows.executions.__PAGE__.txt +2 -2
- package/console/workflows/executions/__next.workflows.executions.txt +3 -3
- package/console/workflows/executions/__next.workflows.txt +3 -3
- package/console/workflows/executions/__placeholder__/__next._full.txt +15 -15
- package/console/workflows/executions/__placeholder__/__next._head.txt +4 -4
- package/console/workflows/executions/__placeholder__/__next._index.txt +9 -9
- package/console/workflows/executions/__placeholder__/__next._tree.txt +1 -1
- package/console/workflows/executions/__placeholder__/__next.workflows.executions.$d$id.__PAGE__.txt +3 -3
- package/console/workflows/executions/__placeholder__/__next.workflows.executions.$d$id.txt +3 -3
- package/console/workflows/executions/__placeholder__/__next.workflows.executions.txt +3 -3
- package/console/workflows/executions/__placeholder__/__next.workflows.txt +3 -3
- package/console/workflows/executions/__placeholder__.html +1 -1
- package/console/workflows/executions/__placeholder__.txt +15 -15
- package/console/workflows/executions.html +1 -1
- package/console/workflows/executions.txt +14 -14
- package/console/workflows.html +1 -1
- package/console/workflows.txt +14 -14
- package/main.js +5 -5
- package/package.json +6 -6
- package/workflow-bundle-agent-execution.js +221 -55
- package/console/_next/static/chunks/01mih7oygvobi.js +0 -1
- package/console/_next/static/chunks/0a1.8jlu1flwz.js +0 -1
- package/console/_next/static/chunks/0d9piwgvkapr0.js +0 -1
- package/console/_next/static/chunks/0o5hvott5mczz.js +0 -1
- package/console/_next/static/chunks/0qhnh~w1eoa.0.js +0 -1
- /package/console/_next/static/{P-dTqoOqKHZGbAFf4hzIE → JWLQwEmfFP9l-mMOJH0M3}/_buildManifest.js +0 -0
- /package/console/_next/static/{P-dTqoOqKHZGbAFf4hzIE → JWLQwEmfFP9l-mMOJH0M3}/_clientMiddlewareManifest.js +0 -0
- /package/console/_next/static/{P-dTqoOqKHZGbAFf4hzIE → JWLQwEmfFP9l-mMOJH0M3}/_ssgManifest.js +0 -0
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
width="400"
|
|
5
5
|
height="600"
|
|
6
6
|
style="border: 0; border-radius: 12px;"
|
|
7
|
-
></iframe>`,[e,n]);return(0,t.jsxs)("section",{children:[(0,t.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),"aria-expanded":a,className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:text-xs stg:font-medium stg:text-muted-foreground","stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:rounded"),children:[(0,t.jsx)(tQ,{className:(0,h.cn)("stg:size-3 stg:transition-transform",a&&"stg:rotate-90")}),"No-JavaScript alternative"]}),a&&(0,t.jsxs)("div",{className:"stg:mt-2 stg:flex stg:flex-col stg:gap-2",children:[(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:"For sites that can't run scripts. A blocked embed shows an empty frame instead of hiding."}),(0,t.jsx)(tX,{label:"Iframe embed",value:l,copyLabel:"Iframe code",disabled:!r,multiline:!0})]})]})}function tV({draft:e,isPending:n,commit:r}){let[a,i]=(0,s.useState)(""),[l,o]=(0,s.useState)(null),g=(0,s.useCallback)(async()=>{let t=a.trim(),s=(0,tx.validateOrigin)(t);s?o(s):e.allowedOrigins.includes(t)?o("That origin is already in the list"):e.allowedOrigins.length>=tx.MAX_ALLOWED_ORIGINS?o(`At most ${tx.MAX_ALLOWED_ORIGINS} origins are allowed`):(o(null),await r({...e,allowedOrigins:[...e.allowedOrigins,t]},"Origin added")&&i(""))},[a,e,r]),d=(0,s.useCallback)(t=>{r({...e,allowedOrigins:e.allowedOrigins.filter(e=>e!==t)},"Origin removed")},[e,r]);return(0,t.jsxs)("section",{children:[(0,t.jsx)("h3",{className:"stg:text-xs stg:font-medium stg:text-muted-foreground",children:"Allowed embed origins"}),(0,t.jsx)("p",{className:"stg:mt-0.5 stg:text-[0.65rem] stg:text-muted-foreground",children:"Sites allowed to embed this agent. An empty list allows any site; adding origins restricts embedding to those sites. The hosted link works either way."}),e.allowedOrigins.length>0&&(0,t.jsx)("ul",{className:(0,h.cn)(O.UNSTYLED_LIST,"stg:mt-2 stg:flex stg:flex-col stg:divide-y stg:divide-border stg:rounded-md stg:border stg:border-border"),children:e.allowedOrigins.map(e=>(0,t.jsxs)("li",{className:"stg:flex stg:items-center stg:justify-between stg:gap-2 stg:px-2.5 stg:py-1.5",children:[(0,t.jsx)("code",{className:"stg:truncate stg:font-mono stg:text-xs stg:text-foreground",children:e}),(0,t.jsx)("button",{type:"button",onClick:()=>d(e),disabled:n,"aria-label":`Remove ${e}`,className:(0,h.cn)("stg:inline-flex stg:size-5 stg:shrink-0 stg:items-center stg:justify-center stg:rounded stg:text-muted-foreground","stg:hover:bg-destructive-subtle stg:hover:text-destructive","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:(0,t.jsx)(tZ,{})})]},e))}),(0,t.jsxs)("div",{className:"stg:mt-2 stg:flex stg:items-start stg:gap-1.5",children:[(0,t.jsxs)("div",{className:"stg:min-w-0 stg:flex-1",children:[(0,t.jsx)("input",{type:"text",value:a,onChange:e=>{i(e.target.value),l&&o(null)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),g())},placeholder:"https://example.com","aria-label":"Add allowed origin","aria-invalid":null!=l,className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:font-mono stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),l&&(0,t.jsx)("p",{role:"alert",className:"stg:mt-1 stg:text-xs stg:text-destructive",children:l})]}),(0,t.jsx)("button",{type:"button",onClick:()=>void g(),disabled:n||!a.trim(),className:(0,h.cn)("stg:shrink-0 stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-xs stg:font-medium","stg:border stg:border-border stg:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:"Add"})]})]})}let tq=[{key:"rateLimited",label:"Rate limited",placeholder:"Shown when a visitor sends messages too quickly"},{key:"unavailable",label:"Unavailable",placeholder:"Shown when the agent is temporarily unavailable"},{key:"conversationEnded",label:"Conversation ended",placeholder:"Shown when a conversation reaches its limit"}];function tY({draft:e,isPending:n,commit:r}){let[a,i]=(0,s.useState)(!1),[l,o]=(0,s.useState)(e.messages),g=l.rateLimited!==e.messages.rateLimited||l.unavailable!==e.messages.unavailable||l.conversationEnded!==e.messages.conversationEnded,d=(0,s.useCallback)(()=>{r({...e,messages:l},"Messages saved")},[r,e,l]);return(0,t.jsxs)("section",{children:[(0,t.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),"aria-expanded":a,className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:text-xs stg:font-medium stg:text-muted-foreground","stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:rounded"),children:[(0,t.jsx)(tQ,{className:(0,h.cn)("stg:size-3 stg:transition-transform",a&&"stg:rotate-90")}),"Customize visitor messages"]}),a&&(0,t.jsxs)("div",{className:"stg:mt-2 stg:flex stg:flex-col stg:gap-3",children:[(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:"Shown to visitors when a limit is reached. Leave empty to use the platform defaults."}),tq.map(({key:e,label:s,placeholder:n})=>(0,t.jsx)(tK,{label:s,placeholder:n,value:l[e],onChange:t=>o(s=>({...s,[e]:t}))},e)),g&&(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-end stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:()=>o(e.messages),disabled:n,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:border stg:border-border stg:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Reset"}),(0,t.jsx)("button",{type:"button",onClick:d,disabled:n,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:"Save messages"})]})]})]})}function tK({label:e,placeholder:s,value:n,onChange:r}){return(0,t.jsxs)("label",{className:"stg:flex stg:flex-col stg:gap-1",children:[(0,t.jsxs)("span",{className:"stg:flex stg:items-center stg:justify-between stg:text-xs stg:font-medium stg:text-muted-foreground",children:[e,(0,t.jsxs)("span",{className:"stg:tabular-nums stg:text-[0.65rem]",children:[n.length,"/",300]})]}),(0,t.jsx)("textarea",{value:n,onChange:e=>r(e.target.value.slice(0,300)),placeholder:s,rows:2,maxLength:300,className:(0,h.cn)("stg:w-full stg:resize-y stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")})]})}function tG({org:e,slug:n}){let r=(0,s.useMemo)(()
|
|
7
|
+
></iframe>`,[e,n]);return(0,t.jsxs)("section",{children:[(0,t.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),"aria-expanded":a,className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:text-xs stg:font-medium stg:text-muted-foreground","stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:rounded"),children:[(0,t.jsx)(tQ,{className:(0,h.cn)("stg:size-3 stg:transition-transform",a&&"stg:rotate-90")}),"No-JavaScript alternative"]}),a&&(0,t.jsxs)("div",{className:"stg:mt-2 stg:flex stg:flex-col stg:gap-2",children:[(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:"For sites that can't run scripts. A blocked embed shows an empty frame instead of hiding."}),(0,t.jsx)(tX,{label:"Iframe embed",value:l,copyLabel:"Iframe code",disabled:!r,multiline:!0})]})]})}function tV({draft:e,isPending:n,commit:r}){let[a,i]=(0,s.useState)(""),[l,o]=(0,s.useState)(null),g=(0,s.useCallback)(async()=>{let t=a.trim(),s=(0,tx.validateOrigin)(t);s?o(s):e.allowedOrigins.includes(t)?o("That origin is already in the list"):e.allowedOrigins.length>=tx.MAX_ALLOWED_ORIGINS?o(`At most ${tx.MAX_ALLOWED_ORIGINS} origins are allowed`):(o(null),await r({...e,allowedOrigins:[...e.allowedOrigins,t]},"Origin added")&&i(""))},[a,e,r]),d=(0,s.useCallback)(t=>{r({...e,allowedOrigins:e.allowedOrigins.filter(e=>e!==t)},"Origin removed")},[e,r]);return(0,t.jsxs)("section",{children:[(0,t.jsx)("h3",{className:"stg:text-xs stg:font-medium stg:text-muted-foreground",children:"Allowed embed origins"}),(0,t.jsx)("p",{className:"stg:mt-0.5 stg:text-[0.65rem] stg:text-muted-foreground",children:"Sites allowed to embed this agent. An empty list allows any site; adding origins restricts embedding to those sites. The hosted link works either way."}),e.allowedOrigins.length>0&&(0,t.jsx)("ul",{className:(0,h.cn)(O.UNSTYLED_LIST,"stg:mt-2 stg:flex stg:flex-col stg:divide-y stg:divide-border stg:rounded-md stg:border stg:border-border"),children:e.allowedOrigins.map(e=>(0,t.jsxs)("li",{className:"stg:flex stg:items-center stg:justify-between stg:gap-2 stg:px-2.5 stg:py-1.5",children:[(0,t.jsx)("code",{className:"stg:truncate stg:font-mono stg:text-xs stg:text-foreground",children:e}),(0,t.jsx)("button",{type:"button",onClick:()=>d(e),disabled:n,"aria-label":`Remove ${e}`,className:(0,h.cn)("stg:inline-flex stg:size-5 stg:shrink-0 stg:items-center stg:justify-center stg:rounded stg:text-muted-foreground","stg:hover:bg-destructive-subtle stg:hover:text-destructive","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:(0,t.jsx)(tZ,{})})]},e))}),(0,t.jsxs)("div",{className:"stg:mt-2 stg:flex stg:items-start stg:gap-1.5",children:[(0,t.jsxs)("div",{className:"stg:min-w-0 stg:flex-1",children:[(0,t.jsx)("input",{type:"text",value:a,onChange:e=>{i(e.target.value),l&&o(null)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),g())},placeholder:"https://example.com","aria-label":"Add allowed origin","aria-invalid":null!=l,className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:font-mono stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),l&&(0,t.jsx)("p",{role:"alert",className:"stg:mt-1 stg:text-xs stg:text-destructive",children:l})]}),(0,t.jsx)("button",{type:"button",onClick:()=>void g(),disabled:n||!a.trim(),className:(0,h.cn)("stg:shrink-0 stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-xs stg:font-medium","stg:border stg:border-border stg:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:"Add"})]})]})}let tq=[{key:"rateLimited",label:"Rate limited",placeholder:"Shown when a visitor sends messages too quickly"},{key:"unavailable",label:"Unavailable",placeholder:"Shown when the agent is temporarily unavailable"},{key:"conversationEnded",label:"Conversation ended",placeholder:"Shown when a conversation reaches its limit"}];function tY({draft:e,isPending:n,commit:r}){let[a,i]=(0,s.useState)(!1),[l,o]=(0,s.useState)(e.messages),g=l.rateLimited!==e.messages.rateLimited||l.unavailable!==e.messages.unavailable||l.conversationEnded!==e.messages.conversationEnded,d=(0,s.useCallback)(()=>{r({...e,messages:l},"Messages saved")},[r,e,l]);return(0,t.jsxs)("section",{children:[(0,t.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),"aria-expanded":a,className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:text-xs stg:font-medium stg:text-muted-foreground","stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:rounded"),children:[(0,t.jsx)(tQ,{className:(0,h.cn)("stg:size-3 stg:transition-transform",a&&"stg:rotate-90")}),"Customize visitor messages"]}),a&&(0,t.jsxs)("div",{className:"stg:mt-2 stg:flex stg:flex-col stg:gap-3",children:[(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:"Shown to visitors when a limit is reached. Leave empty to use the platform defaults."}),tq.map(({key:e,label:s,placeholder:n})=>(0,t.jsx)(tK,{label:s,placeholder:n,value:l[e],onChange:t=>o(s=>({...s,[e]:t}))},e)),g&&(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-end stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:()=>o(e.messages),disabled:n,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:border stg:border-border stg:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Reset"}),(0,t.jsx)("button",{type:"button",onClick:d,disabled:n,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:"Save messages"})]})]})]})}function tK({label:e,placeholder:s,value:n,onChange:r}){return(0,t.jsxs)("label",{className:"stg:flex stg:flex-col stg:gap-1",children:[(0,t.jsxs)("span",{className:"stg:flex stg:items-center stg:justify-between stg:text-xs stg:font-medium stg:text-muted-foreground",children:[e,(0,t.jsxs)("span",{className:"stg:tabular-nums stg:text-[0.65rem]",children:[n.length,"/",300]})]}),(0,t.jsx)("textarea",{value:n,onChange:e=>r(e.target.value.slice(0,300)),placeholder:s,rows:2,maxLength:300,className:(0,h.cn)("stg:w-full stg:resize-y stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")})]})}function tG({org:e,slug:n}){let r=(0,U.useStigmer)(),a=(0,s.useMemo)(()=>{var t;let s;return t=r.baseUrl,s=JSON.stringify(t.replace(/\/+$/,"")),`import { createPlatformClientAuth } from "@stigmer/sdk/node";
|
|
8
8
|
|
|
9
9
|
const auth = createPlatformClientAuth({
|
|
10
|
-
baseUrl:
|
|
10
|
+
baseUrl: ${s},
|
|
11
11
|
clientId: process.env.STIGMER_CLIENT_ID,
|
|
12
12
|
clientSecret: process.env.STIGMER_CLIENT_SECRET,
|
|
13
13
|
});
|
|
@@ -15,4 +15,4 @@ const auth = createPlatformClientAuth({
|
|
|
15
15
|
// Mint tokens for your own users, then chat with ${e}/${n}
|
|
16
16
|
const { accessToken } = await auth.mintUserToken({
|
|
17
17
|
userId: "user-123",
|
|
18
|
-
});`,[e,n]);return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-3",children:[(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"Need your own auth, branding, or UI? Create a platform client and integrate this agent with the Stigmer SDK — the same runtime, full control."}),(0,t.jsx)(tX,{label:"Platform client integration",value:r,copyLabel:"Code",multiline:!0}),(0,t.jsx)("a",{href:"https://stigmer.ai/docs/guides/authentication/platform-client/overview",target:"_blank",rel:"noreferrer",className:(0,h.cn)("stg:text-xs stg:font-medium stg:text-primary stg:hover:text-primary-muted","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:rounded"),children:"Read the platform client guide →"})]})}function tX({label:e,value:s,copyLabel:n,disabled:r,multiline:a,openHref:i}){let{copy:l}=(0,tp.useCopyResource)();return(0,t.jsxs)("section",{className:(0,h.cn)(r&&"stg:opacity-50"),children:[(0,t.jsx)("h3",{className:"stg:text-xs stg:font-medium stg:text-muted-foreground",children:e}),(0,t.jsxs)("div",{className:"stg:mt-1.5 stg:flex stg:items-start stg:gap-1.5",children:[a?(0,t.jsx)("pre",{className:(0,h.cn)("stg:min-w-0 stg:flex-1 stg:overflow-x-auto stg:rounded-md stg:border stg:border-border stg:bg-muted-subtle stg:px-2.5 stg:py-2","stg:font-mono stg:text-xs stg:leading-relaxed stg:text-foreground"),children:s}):(0,t.jsx)(E.TruncatedText,{text:s,className:(0,h.cn)("stg:min-w-0 stg:flex-1 stg:rounded-md stg:border stg:border-border stg:bg-muted-subtle stg:px-2.5 stg:py-1.5","stg:font-mono stg:text-xs stg:text-foreground")}),(0,t.jsxs)("div",{className:"stg:flex stg:shrink-0 stg:flex-col stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:()=>void l(s,n),disabled:r,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-xs stg:font-medium","stg:border stg:border-border stg:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:"Copy"}),i&&(0,t.jsx)("a",{href:i,target:"_blank",rel:"noreferrer",className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-center stg:text-xs stg:font-medium","stg:border stg:border-border stg:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Open"})]})]})]})}function tJ(){return(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function tZ(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m4 4 8 8M12 4l-8 8"})})}function tQ({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m6 3 5 5-5 5"})})}function t0({agent:e,buildShareUrl:n,className:a}){let{shares:i,isLoading:l,error:o,refetch:g}=function(e,t){let s=(0,U.useStigmer)(),n=e?async()=>(await s.agentShare.getByAgent((0,P.create)(tR.GetAgentSharesByAgentRequestSchema,{agentId:e,org:t??""}))).items:null,{data:r,isLoading:a,isRefetching:i,error:l,refetch:o}=(0,W.useFetch)(n,[e,t,s],[]);return{shares:r,isLoading:a,isRefetching:i,error:l,refetch:o}}(e.metadata?.id??"",e.metadata?.org??""),{allowed:d}=function(e){let t=e?.metadata?.id??"",s=e?.metadata?.org??"",{allowed:n}=(0,C.useCheckPermission)(t?{kind:"agent",id:t}:null,"can_edit"),{allowed:r}=(0,C.useCheckPermission)(s?{kind:"organization",id:s}:null,"can_create_agent_share");return{allowed:!!e&&n&&r}}(e),{deleteShare:c}=function(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>a(null),[]);return{deleteShare:(0,s.useCallback)(async t=>{n(!0),a(null);try{return await e.agentShare.delete(t)}catch(e){throw a((0,ee.toError)(e)),e}finally{n(!1)}},[e]),isDeleting:t,error:r,clearError:i}}(),{confirmState:u,confirm:m,handleConfirm:p,handleCancel:f}=(0,w.useConfirmAction)(),[b,v]=(0,s.useState)(null),y=(0,s.useCallback)(async e=>{let t=e.metadata?.slug??"";if(await m({title:"Delete share?",description:`The link /chat/${e.metadata?.org}/${t} stops working immediately — including for visitors mid-conversation — and its configuration (origins, messages, credential bindings) is gone. To stop serving while keeping the configuration, pause it instead.`,confirmLabel:"Delete",variant:"destructive"}))try{await c(e.metadata?.id??""),r.toast.success("Share deleted"),g()}catch(e){r.toast.error((0,x.getUserMessage)(e))}},[m,c,g]);return l?(0,t.jsx)(t5,{}):o?(0,t.jsx)("div",{className:"stg:py-8 stg:text-center stg:text-sm stg:text-destructive",children:"Failed to load shares"}):(0,t.jsxs)("div",{className:(0,h.cn)("stg:space-y-3",a),children:[0===i.length?(0,t.jsx)(t2,{canCreate:d,onCreateClick:()=>v({mode:"create"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between",children:[(0,t.jsxs)("h3",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:[i.length," ",1===i.length?"share":"shares"]}),d&&(0,t.jsx)(j.Button,{variant:"outline",size:"xs",icon:(0,t.jsx)(t3,{}),onClick:()=>v({mode:"create"}),children:"Create share"})]}),(0,t.jsx)("div",{className:"stg:overflow-hidden stg:rounded-lg stg:border stg:border-border",children:(0,t.jsxs)("table",{className:"stg:w-full stg:table-fixed stg:text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"stg:border-b stg:border-border stg:bg-muted-subtle",children:[(0,t.jsx)("th",{className:"stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Name"}),(0,t.jsx)("th",{className:"stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Link"}),(0,t.jsx)("th",{className:"stg:w-28 stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Audience"}),(0,t.jsx)("th",{className:"stg:w-24 stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Status"}),(0,t.jsx)("th",{className:"stg:w-16 stg:px-4 stg:py-2 stg:text-right stg:font-medium stg:text-muted-foreground",children:"Actions"})]})}),(0,t.jsx)("tbody",{className:"stg:divide-y stg:divide-border",children:i.map(s=>(0,t.jsx)(t1,{share:s,agent:e,buildShareUrl:n,onEditClick:e=>v({mode:"edit",share:e}),onDeleteClick:y,refetch:g},s.metadata?.id))})]})})]}),b&&(0,t.jsx)(tI,{open:!0,onOpenChange:e=>{e||v(null)},agent:e,share:"edit"===b.mode?b.share:void 0,buildShareUrl:n,onSharingChanged:g}),(0,t.jsx)(S.ConfirmDialog,{state:u,onConfirm:p,onCancel:f})]})}function t1({share:e,agent:n,buildShareUrl:a,onEditClick:i,onDeleteClick:l,refetch:o}){let d,c=e.metadata,u=c?.id??"",p=c?.org??"",f=c?.slug??"",b=e.spec?.enabled??!1,j=tS(e.spec?.audience),{copy:y}=(0,tp.useCopyResource)(),{save:k,isPending:N}=tA(n),{rotateShareLink:S,isPending:w}=tM(u),{allowed:A}=(0,C.useCheckPermission)({kind:"agent_share",id:u},"can_edit"),{allowed:R}=(0,C.useCheckPermission)({kind:"agent_share",id:u},"can_delete"),M=(0,tx.chatPath)(p,f),I=(d=a?a(p,f):M,"org"===j?d:(0,tx.appendLinkToken)(d,e.status?.shareLinkToken??"")),T=(0,s.useCallback)(()=>{y(I,"Link")},[y,I]),L=(0,s.useCallback)(async()=>{try{await k({...tw(e),enabled:!b},e),r.toast.success(b?"Share paused":"Share resumed"),o()}catch(e){r.toast.error((0,x.getUserMessage)(e))}},[k,e,b,o]),$=(0,s.useCallback)(async()=>{try{await S(),r.toast.success("Link reset — the old link no longer works"),o()}catch(e){r.toast.error((0,x.getUserMessage)(e))}},[S,o]);return(0,t.jsxs)("tr",{className:"stg:cursor-pointer stg:transition-colors stg:hover:bg-accent-hover",onClick:()=>i(e),children:[(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:(0,t.jsx)("div",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-2",children:(0,t.jsx)(E.TruncatedText,{text:c?.name||f||"—",className:"stg:font-medium stg:text-foreground"})})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",onClick:e=>e.stopPropagation(),children:(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-1.5",children:[(0,t.jsx)(E.TruncatedText,{text:M,className:"stg:font-mono stg:text-xs stg:text-muted-foreground"}),(0,t.jsx)("button",{type:"button",onClick:T,"aria-label":`Copy link for ${c?.name||f}`,className:(0,h.cn)("stg:shrink-0 stg:rounded stg:p-1 stg:text-muted-foreground","stg:hover:bg-accent-hover stg:hover:text-foreground","stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-ring"),children:(0,t.jsx)(t4,{})})]})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:"org"===j?"Org members":"Public"})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:(0,t.jsxs)("span",{className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1.5 stg:text-xs",b?"stg:text-foreground":"stg:text-muted-foreground"),children:[(0,t.jsx)("span",{"aria-hidden":"true",className:(0,h.cn)("stg:size-1.5 stg:rounded-full",b?"stg:bg-success":"stg:bg-muted-foreground")}),b?"Active":"Paused"]})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5 stg:text-right",onClick:e=>e.stopPropagation(),children:(A||R)&&(0,t.jsxs)(v.ActionMenu,{children:[(0,t.jsx)(v.ActionMenu.Trigger,{className:"stg:ml-auto","aria-label":`Actions for ${c?.name||f}`,children:(0,t.jsx)(g.MoreHorizontal,{className:"stg:size-4"})}),(0,t.jsxs)(v.ActionMenu.Content,{children:[A&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(tu,{}),onSelect:()=>i(e),children:"Edit"}),(0,t.jsx)(v.ActionMenu.Item,{icon:b?(0,t.jsx)(tc.Pause,{}):(0,t.jsx)(tm.Play,{}),disabled:N,onSelect:()=>void L(),children:b?"Pause":"Resume"}),"public"===j&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(th.RotateCcw,{}),disabled:w,onSelect:()=>void $(),children:"Reset link"})]}),A&&R&&(0,t.jsx)(v.ActionMenu.Separator,{}),R&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(m.Trash2,{}),variant:"destructive",onSelect:()=>l(e),children:"Delete"})]})]})})]})}function t2({canCreate:e,onCreateClick:s}){return(0,t.jsx)(y.EmptyState,{variant:"first-use",icon:(0,t.jsx)(t6,{className:"stg:size-10"}),title:"No shares yet",description:"A share gives this agent a hosted chat link you can send or embed — each share is its own channel with its own audience, embed origins, and tool credentials.",action:e?{label:"Create share",onClick:s,icon:(0,t.jsx)(t3,{})}:void 0})}function t5(){return(0,t.jsx)("div",{className:"stg:space-y-2 stg:py-4",children:[1,2,3].map(e=>(0,t.jsx)("div",{className:"stg:h-12 stg:animate-pulse stg:rounded-md stg:bg-muted-faint"},e))})}function t3(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M6 2v8M2 6h8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function t4(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"5.5",y:"5.5",width:"8",height:"8",rx:"1.5"}),(0,t.jsx)("path",{d:"M10.5 5.5v-2a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2"})]})}function t6({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"4",cy:"8",r:"2"}),(0,t.jsx)("circle",{cx:"12",cy:"4",r:"2"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"2"}),(0,t.jsx)("path",{d:"m5.8 7.1 4.4-2.2M5.8 8.9l4.4 2.2"})]})}var t8=e.i(668093),t9=e.i(652337),t7=e.i(267912);let se={agent:"Agent","mcp-server":"MCP",skill:"Skill","sub-agent":"Sub-Agent"};function st({node:e,depth:n,onNodeClick:r,defaultExpanded:a}){let i=e.children.length>0,l="agent"===e.kind,o="sub-agent"===e.kind&&i,g=l&&i,[d,c]=(0,s.useState)(a),u=null!=e.ref&&null!=r,m=g||o&&d,x=(0,s.useCallback)(()=>{o?c(e=>!e):u&&r(e)},[o,u,r,e]),p=(0,s.useCallback)(e=>{o&&("ArrowRight"!==e.key||d?"ArrowLeft"===e.key&&d&&(e.preventDefault(),c(!1)):(e.preventDefault(),c(!0)))},[o,d]),f=(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-2",children:[o&&(0,t.jsx)(si,{className:(0,h.cn)("stg:size-3.5 stg:shrink-0 stg:text-muted-foreground stg:transition-transform",d&&"stg:rotate-90")}),(0,t.jsx)(ss,{kind:e.kind,className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground"}),!l&&(0,t.jsx)("span",{className:(0,h.cn)("stg:shrink-0 stg:rounded stg:px-1.5 stg:py-px stg:text-[10px] stg:font-medium stg:leading-tight",function(e){switch(e){case"mcp-server":return"stg:bg-[var(--stgm-status-running-subtle)] stg:text-[var(--stgm-status-running)]";case"skill":return"stg:bg-[var(--stgm-status-pending-subtle)] stg:text-[var(--stgm-status-pending)]";case"sub-agent":return"stg:bg-[var(--stgm-status-ready-subtle)] stg:text-[var(--stgm-status-ready)]";case"agent":return"stg:bg-muted stg:text-muted-foreground"}}(e.kind)),children:se[e.kind]}),(0,t.jsx)("span",{className:"stg:min-w-0 stg:truncate stg:text-sm stg:font-medium stg:text-foreground",children:e.qualifiedLabel??e.label}),e.metadata&&Object.entries(e.metadata).map(([e,s])=>(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-xs stg:text-muted-foreground",children:s},e))]}),b=o||u;return(0,t.jsxs)("li",{role:"treeitem","aria-expanded":o?d:!!g||void 0,className:(0,h.cn)("stg:list-none",n>0&&"stg:relative stg:before:absolute stg:before:left-[-12px] stg:before:top-[14px] stg:before:h-px stg:before:w-3 stg:before:bg-border stg:before:content-['']"),children:[b?(0,t.jsx)("button",{type:"button",onClick:x,onKeyDown:p,tabIndex:-1,className:(0,h.cn)("stg:flex stg:w-full stg:items-center stg:rounded-md stg:px-2 stg:py-1.5 stg:text-left stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:f}):(0,t.jsx)("div",{className:"stg:flex stg:items-center stg:px-2 stg:py-1.5",children:f}),e.description&&!l&&(0,t.jsx)("p",{className:(0,h.cn)("stg:px-2 stg:pb-1 stg:text-xs stg:text-muted-foreground",o?"stg:ml-[calc(0.5rem+14px+0.5rem)]":"stg:ml-2"),children:e.description}),m&&(0,t.jsx)("ul",{role:"group",className:(0,h.cn)(O.UNSTYLED_LIST,"stg:relative stg:ml-[11px] stg:border-l stg:border-border stg:pl-3"),children:e.children.map(e=>(0,t.jsx)(st,{node:e,depth:n+1,onNodeClick:r,defaultExpanded:a},e.id))})]})}function ss({kind:e,className:s}){switch(e){case"agent":case"sub-agent":return(0,t.jsx)(sn,{className:s});case"mcp-server":return(0,t.jsx)(sr,{className:s});case"skill":return(0,t.jsx)(sa,{className:s})}}function sn({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"3",y:"5",width:"10",height:"8",rx:"1.5"}),(0,t.jsx)("path",{d:"M6 9h.01M10 9h.01",strokeWidth:"2"}),(0,t.jsx)("path",{d:"M8 2v3"})]})}function sr({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"2",y:"2",width:"12",height:"5",rx:"1"}),(0,t.jsx)("rect",{x:"2",y:"9",width:"12",height:"5",rx:"1"}),(0,t.jsx)("circle",{cx:"5",cy:"4.5",r:"0.75",fill:"currentColor",stroke:"none"}),(0,t.jsx)("circle",{cx:"5",cy:"11.5",r:"0.75",fill:"currentColor",stroke:"none"})]})}function sa({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M9 1.5 4 9h4l-1 5.5L12 7H8l1-5.5Z"})})}function si({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m6 3 5 5-5 5"})})}function sl({tree:e,onNodeClick:n,defaultExpanded:r=!0,className:a}){let i=(0,s.useRef)(null),l=(0,s.useCallback)(e=>{let t=i.current;if(!t)return;let s=Array.from(t.querySelectorAll("[role='treeitem'] > button, [role='treeitem'] > div")).filter(e=>{let t=e.closest("[role='treeitem']")?.parentElement?.closest("[role='treeitem']");for(;t;){if("false"===t.getAttribute("aria-expanded"))return!1;t=t.parentElement?.closest("[role='treeitem']")}return!0});if(0===s.length)return;let n=document.activeElement,r=n?s.indexOf(n):-1,a=null;switch(e.key){case"ArrowDown":a=r<s.length-1?r+1:0;break;case"ArrowUp":a=r>0?r-1:s.length-1;break;case"Home":a=0;break;case"End":a=s.length-1;break;default:return}e.preventDefault(),s[a].focus()},[]),{root:o}=e;return(0,t.jsxs)("div",{className:(0,h.cn)("stg:py-2",a),children:[(0,t.jsxs)("div",{className:"stg:mb-3 stg:flex stg:items-center stg:gap-2 stg:px-2",children:[(0,t.jsx)(so,{className:"stg:size-4 stg:text-muted-foreground"}),(0,t.jsx)("h3",{className:"stg:text-xs stg:font-medium stg:uppercase stg:tracking-wider stg:text-muted-foreground",children:"Dependency Tree"}),(0,t.jsxs)("span",{className:"stg:text-xs stg:text-muted-foreground",children:[e.nodeCount," ",1===e.nodeCount?"node":"nodes"]})]}),(0,t.jsx)("ul",{ref:i,role:"tree","aria-label":`Dependencies of ${o.label}`,onKeyDown:l,className:(0,h.cn)(O.UNSTYLED_LIST,"stg:rounded-lg stg:border stg:border-border stg:p-2"),children:(0,t.jsx)(st,{node:o,depth:0,onNodeClick:n,defaultExpanded:r})})]})}function so({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M8 2v4M8 6 4 10M8 6l4 4"}),(0,t.jsx)("circle",{cx:"8",cy:"2",r:"1",fill:"currentColor",stroke:"none"}),(0,t.jsx)("circle",{cx:"4",cy:"11",r:"1.5"}),(0,t.jsx)("circle",{cx:"8",cy:"11",r:"1.5"}),(0,t.jsx)("circle",{cx:"12",cy:"11",r:"1.5"})]})}var sg=e.i(261722),sd=e.i(81346),sc=e.i(52595);function su({value:e,onSave:n,renderPicker:r,onItemClick:a,itemIcon:i,resourceLabel:l="resource",editing:o,onEditingChange:g,defaultOrg:d="",disabled:c,isSaving:u,error:m,className:x}){let[p,f]=(0,s.useState)(!1),b=o??p,v=(0,s.useCallback)(e=>{f(e),g?.(e)},[g]);(0,s.useEffect)(()=>{void 0!==o&&f(o)},[o]);let[j,y]=(0,s.useState)([...e]),[k,N]=(0,s.useState)(!1),[C,S]=(0,s.useState)(!1),[w,A]=(0,s.useState)(""),[R,M]=(0,s.useState)(d);(0,s.useCallback)(()=>{y([...e]),v(!0),N(!1),S(!1)},[e,v]);let E=(0,s.useCallback)(()=>{v(!1),y([...e]),N(!1),S(!1)},[e,v]),I=(0,s.useCallback)(async()=>{await n(j)&&(v(!1),N(!1),S(!1))},[j,n,v]),T=(0,s.useCallback)(e=>{y(t=>t.filter((t,s)=>s!==e))},[]),L=(0,s.useCallback)(e=>{y(t=>t.some(t=>t.org===e.org&&t.slug===e.slug)?t:[...t,e]),N(!1)},[]);return c||!b?(0,t.jsx)("div",{className:(0,h.cn)("stg:flex stg:flex-col",x),children:e.length>0?(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:divide-y stg:divide-border",children:e.map((e,s)=>{let n=e.label??e.slug,r=(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-3",children:[i&&(0,t.jsx)("span",{className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground",children:i}),(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:n})]});return a?(0,t.jsx)("button",{type:"button",onClick:()=>a(e),className:(0,h.cn)("stg:w-full stg:px-3 stg:py-2.5 stg:text-left stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:r},`${e.org}/${e.slug}`||s):(0,t.jsx)("div",{className:"stg:px-3 stg:py-2.5",children:r},`${e.org}/${e.slug}`||s)})}):(0,t.jsxs)("p",{className:"stg:px-3 stg:py-3 stg:text-xs stg:text-muted-foreground stg:italic",children:["No ",l,"s configured"]})}):(0,t.jsxs)("div",{className:(0,h.cn)("stg:flex stg:flex-col stg:gap-2",x),children:[j.length>0&&(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:divide-y stg:divide-border stg:rounded-md stg:border stg:border-border",children:j.map((e,s)=>(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:px-3 stg:py-1.5",children:[i&&(0,t.jsx)("span",{className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground",children:i}),(0,t.jsx)("span",{className:"stg:flex-1 stg:text-sm stg:font-medium stg:text-foreground",children:e.label??e.slug}),(0,t.jsx)("button",{type:"button",onClick:()=>T(s),"aria-label":`Remove ${e.label??e.slug}`,className:(0,h.cn)("stg:inline-flex stg:size-6 stg:items-center stg:justify-center stg:rounded-md stg:text-muted-foreground","stg:hover:bg-destructive-subtle stg:hover:text-destructive","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:(0,t.jsx)(sh,{className:"stg:size-3.5"})})]},`${e.org}/${e.slug}`))}),k&&r?(0,t.jsx)("div",{className:"stg:rounded-md stg:border stg:border-border stg:bg-muted-faint stg:p-2",children:r(L)}):C?(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:rounded-md stg:border stg:border-border stg:bg-muted-faint stg:p-2",children:[(0,t.jsx)("input",{type:"text",value:R,onChange:e=>M(e.target.value),placeholder:"org",className:(0,h.cn)("stg:w-24 stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1 stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:"/"}),(0,t.jsx)("input",{type:"text",value:w,onChange:e=>A(e.target.value),placeholder:"slug",onKeyDown:e=>{"Enter"===e.key&&w.trim()?(L({org:R.trim()||d,slug:w.trim(),label:w.trim()}),A(""),S(!1)):"Escape"===e.key&&(S(!1),A(""))},className:(0,h.cn)("stg:flex-1 stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1 stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsx)("button",{type:"button",onClick:()=>{w.trim()&&(L({org:R.trim()||d,slug:w.trim(),label:w.trim()}),A(""),S(!1))},disabled:!w.trim(),className:(0,h.cn)("stg:inline-flex stg:size-6 stg:items-center stg:justify-center stg:rounded-md","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:disabled:opacity-50","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:(0,t.jsx)(sm,{className:"stg:size-3"})})]}):(0,t.jsxs)("button",{type:"button",onClick:()=>r?N(!0):S(!0),className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-xs stg:font-medium","stg:border stg:border-dashed stg:border-border stg:text-muted-foreground","stg:hover:border-muted-foreground stg:hover:text-foreground stg:hover:bg-muted-subtle","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:transition-colors"),children:[(0,t.jsx)(sm,{className:"stg:size-3"}),"Add ",l]}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-end stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:E,disabled:u,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:border stg:border-border stg:bg-background stg:text-foreground stg:hover:bg-accent","stg:disabled:opacity-50","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Cancel"}),(0,t.jsxs)("button",{type:"button",onClick:I,disabled:u,className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:disabled:opacity-50","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:[u&&(0,t.jsx)(sx,{}),"Save changes"]})]}),m&&(0,t.jsx)("p",{className:"stg:px-1 stg:text-xs stg:text-destructive",role:"alert",children:m})]})}function sm({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 3v10M3 8h10"})})}function sh({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m4 4 8 8M12 4l-8 8"})})}function sx(){return(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",className:"stg:animate-spin","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 2a6 6 0 1 0 6 6"})})}var sp=e.i(486277),sf=e.i(348990),sb=e.i(388023);function sv({onCreateClick:e,className:s}){return(0,t.jsx)(y.EmptyState,{variant:"first-use",icon:(0,t.jsx)(sj,{}),title:"No instances yet",description:"Create instances to start sessions with this agent using different credentials and settings. Each instance binds environments (secrets, configuration) and can be shared with your team independently.",action:e?{label:"Create instance",onClick:e,icon:(0,t.jsx)(sy,{})}:void 0,className:s})}function sj(){return(0,t.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M10 2L2 6l8 4 8-4-8-4zM2 10l8 4 8-4M2 14l8 4 8-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function sy(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M6 2v8M2 6h8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function sk({agentId:e,defaultInstanceId:n,org:r,viewerOrg:a,onCreateClick:i,onInstanceClick:l,onStartSessionClick:o,onDeleteClick:g,refreshKey:d,className:c}){let{instances:u,isLoading:m,error:x,refetch:p}=function(e,t){let s=(0,U.useStigmer)(),n=e?async()=>{let n=await s.agentInstance.getByAgent((0,P.create)(sp.GetAgentInstancesByAgentRequestSchema,{agentId:e,org:t??""}));return n.items?[...n.items]:[]}:null,{data:r,isLoading:a,isRefetching:i,error:l,refetch:o}=(0,W.useFetch)(n,[e,t,s],[]);return{instances:r,isLoading:a,isRefetching:i,error:l,refetch:o}}(e,a||r),{environments:f}=(0,sf.useEnvironmentList)(r),b=(0,s.useRef)(d);(0,s.useEffect)(()=>{void 0!==d&&d!==b.current&&(b.current=d,p())},[d,p]);let v=(0,s.useMemo)(()=>u.filter(e=>e.metadata?.id!==n),[u,n]),y=(0,s.useCallback)(e=>{let t=f.find(t=>t.metadata?.slug===e);return t?.metadata?.name??e},[f]);return m?(0,t.jsx)(sC,{}):x?(0,t.jsx)("div",{className:"stg:py-8 stg:text-center stg:text-sm stg:text-destructive",children:"Failed to load instances"}):0===v.length?(0,t.jsx)(sv,{onCreateClick:i,className:c}):(0,t.jsxs)("div",{className:(0,h.cn)("stg:space-y-3",c),children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between",children:[(0,t.jsxs)("h3",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:[v.length," ",1===v.length?"instance":"instances"]}),i&&(0,t.jsx)(j.Button,{variant:"outline",size:"xs",icon:(0,t.jsx)(sS,{}),onClick:i,children:"Create instance"})]}),(0,t.jsx)("div",{className:"stg:overflow-hidden stg:rounded-lg stg:border stg:border-border",children:(0,t.jsxs)("table",{className:"stg:w-full stg:table-fixed stg:text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"stg:border-b stg:border-border stg:bg-muted-subtle",children:[(0,t.jsx)("th",{className:"stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Name"}),(0,t.jsx)("th",{className:"stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Environments"}),(0,t.jsx)("th",{className:"stg:w-36 stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Visibility"}),(0,t.jsx)("th",{className:"stg:w-16 stg:px-4 stg:py-2 stg:text-right stg:font-medium stg:text-muted-foreground",children:"Actions"})]})}),(0,t.jsx)("tbody",{className:"stg:divide-y stg:divide-border",children:v.map(e=>(0,t.jsx)(sN,{instance:e,resolveEnvName:y,onRowClick:l,onStartSessionClick:o,onDeleteClick:g,refetch:p},e.metadata?.id))})]})})]})}function sN({instance:e,resolveEnvName:s,onRowClick:n,onStartSessionClick:r,onDeleteClick:a,refetch:i}){let l=e.metadata,o=l?.id??"",d=l?.labels?.["stigmer.ai/personal"]==="true",c=e.spec?.environmentRefs??[],{allowed:u}=(0,C.useCheckPermission)({kind:"agent_instance",id:o},"can_delete"),x=!!r,p=!!a&&u;return(0,t.jsxs)("tr",{className:(0,h.cn)("stg:transition-colors",n&&"stg:cursor-pointer stg:hover:bg-accent-hover"),onClick:()=>n?.(e),children:[(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:(0,t.jsxs)("div",{className:"stg:min-w-0",children:[(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-2",children:[(0,t.jsx)(E.TruncatedText,{text:l?.name||l?.slug||"—",className:"stg:font-medium stg:text-foreground"}),d&&(0,t.jsx)("span",{className:(0,h.cn)("stg:inline-flex stg:shrink-0 stg:items-center stg:rounded-md stg:px-1.5 stg:py-0.5","stg:text-[0.6rem] stg:font-medium stg:uppercase stg:tracking-wide","stg:bg-muted stg:text-muted-foreground stg:border stg:border-border"),children:"Personal"})]}),e.spec?.description&&(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground stg:truncate",children:e.spec.description})]})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:0===c.length?(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:"None"}):(0,t.jsx)("div",{className:"stg:flex stg:flex-wrap stg:gap-1",children:c.map((e,n)=>(0,t.jsx)("span",{className:(0,h.cn)("stg:inline-flex stg:items-center stg:rounded-md stg:px-1.5 stg:py-0.5","stg:text-[0.65rem] stg:font-medium","stg:bg-muted stg:text-muted-foreground","stg:border stg:border-border"),children:s(e.slug)},`${e.slug}-${n}`))})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",onClick:e=>e.stopPropagation(),children:o?(0,t.jsx)(sb.ResourceVisibilityControl,{kind:"agentInstance",resourceId:o,visibility:l?.visibility??q.ApiResourceVisibility.visibility_private,onChanged:i}):(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:"—"})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5 stg:text-right",onClick:e=>e.stopPropagation(),children:(x||p)&&(0,t.jsxs)(v.ActionMenu,{children:[(0,t.jsx)(v.ActionMenu.Trigger,{className:"stg:ml-auto","aria-label":`Actions for ${l?.name||l?.slug}`,children:(0,t.jsx)(g.MoreHorizontal,{className:"stg:size-4"})}),(0,t.jsxs)(v.ActionMenu.Content,{children:[x&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(tm.Play,{}),onSelect:()=>r?.(e),children:"Start session"}),x&&p&&(0,t.jsx)(v.ActionMenu.Separator,{}),p&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(m.Trash2,{}),variant:"destructive",onSelect:()=>a?.(e),children:"Delete"})]})]})})]})}function sC(){return(0,t.jsx)("div",{className:"stg:space-y-2 stg:py-4",children:[1,2,3].map(e=>(0,t.jsx)("div",{className:"stg:h-12 stg:animate-pulse stg:rounded-md stg:bg-muted-faint"},e))})}function sS(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M6 2v8M2 6h8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}var sw=e.i(292420),sA=e.i(473489);let sR={id:"overview",label:"Overview"},sM={id:"instances",label:"Instances"},sE={id:"shares",label:"Shares"},sI={id:"dependencies",label:"Dependencies"};function sT({org:e,slug:n,onMcpServerClick:r,onSkillClick:a,onResourceLoad:i,primaryAction:l,actions:o,additionalTabs:g,activeTab:d,onTabChange:c,defaultTab:u,editable:m=!1,onResourceUpdated:h,buildShareUrl:x,viewerOrg:p,onCreateInstanceClick:v,onInstanceClick:j,onInstanceStartSessionClick:y,onInstanceDeleteClick:k,instancesRefreshKey:N,onPluginClick:C,className:S}){let w,{agent:A,isLoading:R,error:M,refetch:E}=(0,ti.useAgent)(e,n),T=(0,sA.useManagingPlugin)(A?.metadata?.labels),L=m&&null===T.plugin,{update:$,isUpdating:O}=(0,tl.useUpdateAgent)(),[D,z]=(0,s.useState)(null),P=(0,s.useCallback)(async(e,t)=>{if(!A)return!1;z(null);let s=(0,to.toAgentUpdateInput)(A);s[e]=t;try{let e=await $(s);return h?.(e),E(),!0}catch(t){return z({field:e,message:(0,ee.toError)(t).message}),!1}},[A,$,h,E]),B=(0,s.useCallback)(()=>z(null),[]),{tree:U,isEmpty:W}=function({agentName:e,agentOrg:t,spec:n}){return(0,s.useMemo)(()=>{if(!n)return{tree:null,isEmpty:!0};let{mcpServerUsages:s,skillRefs:r,subAgents:a}=n;if(!(s.length>0||r.length>0||a.length>0))return{tree:null,isEmpty:!0};let i=1;return{tree:{root:{id:`agent:${e}`,kind:"agent",label:e,children:[...s.filter(e=>e.mcpServerRef).map(e=>{i++;let s=e.mcpServerRef,n=e.enabledTools.length;return{id:`mcp-server:${s.slug}`,kind:"mcp-server",label:s.slug,qualifiedLabel:s.org&&s.org!==t?`${s.org}/${s.slug}`:void 0,metadata:{tools:n>0?`${n} ${1===n?"tool":"tools"}`:"all tools"},children:[],ref:{org:s.org||t,slug:s.slug}}}),...r.map(e=>(i++,{id:`skill:${e.slug}`,kind:"skill",label:e.slug,qualifiedLabel:e.org&&e.org!==t?`${e.org}/${e.slug}`:void 0,children:[],ref:{org:e.org||t,slug:e.slug}})),...a.map(e=>{i++;let s=e.mcpAccess.map(s=>{i++;let n=s.enabledTools.length;return{id:`sub-agent:${e.name}:mcp-server:${s.mcpServer}`,kind:"mcp-server",label:s.mcpServer,metadata:{tools:n>0?`${n} ${1===n?"tool":"tools"}`:"all tools"},children:[],ref:{org:t,slug:s.mcpServer}}}),n=e.skillRefs.map(s=>(i++,{id:`sub-agent:${e.name}:skill:${s.slug}`,kind:"skill",label:s.slug,qualifiedLabel:s.org&&s.org!==t?`${s.org}/${s.slug}`:void 0,children:[],ref:{org:s.org||t,slug:s.slug}})),r={};return e.modelOverride&&(r.model=e.modelOverride),{id:`sub-agent:${e.name}`,kind:"sub-agent",label:e.name,description:e.description||void 0,metadata:Object.keys(r).length>0?r:void 0,children:[...s,...n]}})]},nodeCount:i},isEmpty:!1}},[e,t,n])}({agentName:A?.metadata?.name||A?.metadata?.slug||n,agentOrg:A?.metadata?.org||e,spec:A?.spec}),_=(0,s.useMemo)(()=>W?[sR,sM,sE]:[sR,sM,sE,sI],[W]),{effectiveTabs:F,effectiveActiveTab:H,effectiveOnTabChange:V,activeAdditionalTab:q}=(0,t7.useDetailTabs)({builtInTabs:_,additionalTabs:g,activeTab:d,onTabChange:c,defaultTab:u}),Y=(0,s.useCallback)(e=>{e.ref&&("mcp-server"===e.kind?r?.(e.ref):"skill"===e.kind&&a?.(e.ref))},[r,a]),K=(0,s.useRef)(i);K.current=i,(0,s.useEffect)(()=>{A?.metadata?.name&&K.current?.({name:A.metadata.name,id:A.metadata.id})},[A]);let G=(0,b.useManageAccess)({resource:A?.metadata?{kind:f.ApiResourceKind.agent,kindString:"agent",id:A.metadata.id,org:A.metadata.org,name:A.metadata.name}:null,visibility:A?.metadata?{kind:"agent",current:A.metadata.visibility,org:A.metadata.org,onChanged:E}:void 0});if(R)return(0,t.jsx)(sU,{className:S});if(M)return(0,t.jsx)(tg.ErrorMessage,{error:M,retry:E,className:S});if(!A)return(0,t.jsx)(sW,{className:S});let X=A.metadata,J=A.spec,Z=A.status?.audit?.specAudit,Q=X?.org||e,et={name:X?.name||X?.slug||"Untitled",id:X?.id||"",org:X?.org,slug:X?.slug,description:void 0,iconUrl:L?void 0:J?.iconUrl,icon:L?(0,t.jsx)(sd.InlineEditImage,{value:J?.iconUrl??"",onSave:e=>P("iconUrl",e||void 0),isSaving:O,fallback:(0,t.jsx)(s_,{className:"stg:size-6 stg:text-muted-foreground"}),disabled:!L}):J?.iconUrl?void 0:(0,t.jsx)(s_,{className:"stg:size-6 stg:text-muted-foreground"}),createdAt:Z?.createdAt?(0,I.timestampDate)(Z.createdAt):null,updatedAt:Z?.updatedAt?(0,I.timestampDate)(Z.updatedAt):null},es=X?(0,t.jsx)(td.VisibilityBadge,{visibility:X.visibility,onClick:G.action?G.open:void 0}):void 0,en=[...o??[],...[{id:"share",label:"Share",group:"sharing",onAction:()=>V(sE.id)},G.action].filter(e=>null!=e)];return w=q?q.content:"instances"===H?(0,t.jsx)(sk,{agentId:X?.id??"",defaultInstanceId:A.status?.defaultInstanceId,org:e,viewerOrg:p,onCreateClick:v,onInstanceClick:j,onStartSessionClick:y,onDeleteClick:k,refreshKey:N}):"shares"===H?(0,t.jsx)(t0,{agent:A,buildShareUrl:x}):"dependencies"===H&&U?(0,t.jsx)(sl,{tree:U,onNodeClick:Y}):(0,t.jsx)(sL,{spec:J,agentOrg:Q,description:J?.description,onMcpServerClick:r,onSkillClick:a,editable:L,isSaving:O,saveField:P,saveError:D,clearSaveError:B}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(t8.ResourceDetailShell,{header:et,visibilityControl:es,headerBanner:(0,t.jsx)(sw.ManagedByPluginNotice,{plugin:T.plugin,onPluginClick:C}),primaryAction:l,actions:en,tabs:F,activeTab:F?H:void 0,onTabChange:F?V:void 0,tabsAriaLabel:"Agent detail sections",className:S,children:w}),G.dialog]})}function sL({spec:e,agentOrg:n,description:r,onMcpServerClick:a,onSkillClick:i,editable:l,isSaving:o,saveField:g,saveError:d,clearSaveError:c}){let u=e=>d?.field===e?d.message:void 0,m=(0,s.useCallback)(async e=>g?.("instructions",e||void 0)??!1,[g]),h=(0,s.useCallback)(async e=>g?.("mcpServerUsages",e.map(e=>({mcpServerRef:{org:e.org,slug:e.slug}})))??!1,[g]),x=(0,s.useCallback)(async e=>g?.("skillRefs",e.map(e=>({org:e.org,slug:e.slug})))??!1,[g]),p=(0,s.useCallback)(async e=>{let t={};for(let s of e)s.key.trim()&&(t[s.key.trim()]={isSecret:s.isSecret||void 0,description:s.description||void 0,optional:s.optional||void 0});return g?.("env",Object.keys(t).length>0?t:void 0)??!1},[g]),f=(0,s.useMemo)(()=>(e?.mcpServerUsages??[]).map(e=>({org:e.mcpServerRef?.org||n,slug:e.mcpServerRef?.slug??"",label:e.mcpServerRef?.org&&e.mcpServerRef.org!==n?`${e.mcpServerRef.org}/${e.mcpServerRef.slug}`:e.mcpServerRef?.slug??""})),[e?.mcpServerUsages,n]),b=(0,s.useMemo)(()=>(e?.skillRefs??[]).map(e=>({org:e.org||n,slug:e.slug,label:e.org&&e.org!==n?`${e.org}/${e.slug}`:e.slug})),[e?.skillRefs,n]),v=(0,s.useMemo)(()=>Object.entries(e?.env??{}).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({key:e,value:"",isSecret:t.isSecret,description:t.description,optional:t.optional})),[e?.env]),j=l||!!r,y=l||!!e?.instructions,k=l||e&&e.mcpServerUsages.length>0,N=l||e&&e.skillRefs.length>0,C=l||e&&e.subAgents.length>0,S=l||e?.env&&Object.keys(e.env).length>0,[w,A]=(0,s.useState)(!1),[R,M]=(0,s.useState)(!1),[E,I]=(0,s.useState)(!1),T=(0,s.useCallback)(e=>{e&&c?.(),A(e)},[c]),L=(0,s.useCallback)(e=>{e&&c?.(),M(e)},[c]),$=(0,s.useCallback)(e=>{e&&c?.(),I(e)},[c]);return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-6",children:[j&&(0,t.jsx)(t9.Section,{title:"Description",children:l?(0,t.jsx)("div",{className:"stg:max-h-20 stg:overflow-y-auto stg:p-3",children:(0,t.jsx)(sg.InlineEditTextarea,{value:e?.description||"",onSave:e=>g?.("description",e||void 0)??Promise.resolve(!1),isSaving:o,error:u("description"),placeholder:"Add a description",minRows:2})}):(0,t.jsx)("div",{className:"stg:p-3",children:(0,t.jsx)("pre",{className:"stg:whitespace-pre-wrap stg:break-words stg:text-sm stg:text-foreground stg:font-sans",children:r})})}),y&&(0,t.jsx)(t9.Section,{title:"Instructions",children:l?(0,t.jsx)("div",{className:"stg:max-h-72 stg:overflow-y-auto stg:p-3",children:(0,t.jsx)(sg.InlineEditTextarea,{value:e?.instructions??"",onSave:m,isSaving:o,error:u("instructions"),placeholder:"Add instructions for the agent",minRows:4})}):(0,t.jsx)(s$,{text:e?.instructions??""})}),k&&(0,t.jsx)(t9.Section,{title:"MCP Servers",count:e?.mcpServerUsages.length,onEdit:l?()=>T(!w):void 0,children:l?(0,t.jsx)(su,{value:f,onSave:h,isSaving:o,error:u("mcpServerUsages"),editing:w,onEditingChange:T,onItemClick:a?e=>a({org:e.org,slug:e.slug}):void 0,itemIcon:(0,t.jsx)(sF,{className:"stg:size-4"}),resourceLabel:"MCP server",defaultOrg:n}):(0,t.jsx)(sO,{usages:e?.mcpServerUsages??[],defaultOrg:n,onMcpServerClick:a})}),N&&(0,t.jsx)(t9.Section,{title:"Skills",count:e?.skillRefs.length,onEdit:l?()=>L(!R):void 0,children:l?(0,t.jsx)(su,{value:b,onSave:x,isSaving:o,error:u("skillRefs"),editing:R,onEditingChange:L,onItemClick:i?e=>i({org:e.org,slug:e.slug}):void 0,itemIcon:(0,t.jsx)(sH,{className:"stg:size-4"}),resourceLabel:"skill",defaultOrg:n}):(0,t.jsx)(sD,{refs:e?.skillRefs??[],defaultOrg:n,onSkillClick:i})}),C&&(0,t.jsx)(sz,{subAgents:e?.subAgents??[],editable:l,isSaving:o,error:u("subAgents"),onSave:e=>g?.("subAgents",e.length>0?e:void 0)??Promise.resolve(!1)}),S&&(0,t.jsx)(t9.Section,{title:"Environment Variables",count:Object.keys(e?.env??{}).length,onEdit:l?()=>$(!E):void 0,children:l?(0,t.jsx)(sc.InlineEditKeyValue,{value:v,onSave:p,isSaving:o,error:u("env"),editing:E,onEditingChange:$,showSecretToggle:!0,showOptionalToggle:!0,showDescription:!0,keyLabel:"Variable name"}):(0,t.jsx)(sB,{data:e?.env??{}})})]})}function s$({text:e}){let[n,r]=(0,s.useState)(!1),a=(0,s.useRef)(null),[i,l]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e=a.current;e&&l(e.scrollHeight>e.clientHeight)},[e]),(0,t.jsxs)("div",{className:"stg:relative stg:p-3",children:[(0,t.jsx)("pre",{ref:a,className:(0,h.cn)("stg:whitespace-pre-wrap stg:break-words stg:font-mono stg:text-sm stg:text-foreground stg:overflow-y-auto stg:transition-[max-height] stg:duration-200",!n&&"stg:overflow-hidden"),style:{maxHeight:n?"none":"12rem"},children:e}),!n&&i&&(0,t.jsx)("div",{className:"stg:pointer-events-none stg:absolute stg:inset-x-3 stg:bottom-10 stg:h-8 stg:bg-gradient-to-t stg:from-background stg:to-transparent"}),i&&(0,t.jsx)("button",{type:"button",onClick:()=>r(e=>!e),className:"stg:mt-2 stg:text-xs stg:font-medium stg:text-primary stg:transition-colors stg:hover:text-primary-muted",children:n?"Show less":"Show more"})]})}function sO({usages:e,defaultOrg:s,onMcpServerClick:n}){return(0,t.jsx)("div",{className:"stg:flex stg:flex-col",children:e.map((e,r)=>{let a=e.mcpServerRef;if(!a)return null;let i=a.org||s,l=a.org&&a.org!==s?`${a.org}/${a.slug}`:a.slug,o=e.enabledTools.length,g=e.toolApprovalOverrides.length,d=[o>0?`${o} ${1===o?"tool":"tools"}`:"all tools",g>0?`${g} approval ${1===g?"override":"overrides"}`:""].filter(Boolean).join(" · "),c=(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-3",children:[(0,t.jsx)(sF,{className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground"}),(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:l}),(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:d})]});return n?(0,t.jsx)("button",{type:"button",onClick:()=>n({org:i,slug:a.slug}),className:(0,h.cn)("stg:w-full stg:rounded-md stg:px-3 stg:py-2 stg:text-left stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:c},a.slug||r):(0,t.jsx)("div",{className:"stg:px-3 stg:py-2",children:c},a.slug||r)})})}function sD({refs:e,defaultOrg:s,onSkillClick:n}){return(0,t.jsx)("div",{className:"stg:flex stg:flex-col",children:e.map((e,r)=>{let a=e.org||s,i=e.org&&e.org!==s?`${e.org}/${e.slug}`:e.slug,l=(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-3",children:[(0,t.jsx)(sH,{className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground"}),(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:i})]});return n?(0,t.jsx)("button",{type:"button",onClick:()=>n({org:a,slug:e.slug}),className:(0,h.cn)("stg:w-full stg:rounded-md stg:px-3 stg:py-2 stg:text-left stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:l},e.slug||r):(0,t.jsx)("div",{className:"stg:px-3 stg:py-2",children:l},e.slug||r)})})}function sz({subAgents:e,editable:n,isSaving:r,error:a,onSave:i}){let[l,o]=(0,s.useState)(new Set),[g,d]=(0,s.useState)(!1),[c,u]=(0,s.useState)(!1),[m,x]=(0,s.useState)({name:"",description:"",instructions:""}),p=(0,s.useCallback)(async t=>{if(!i)return;let s=e.filter((e,s)=>s!==t).map(e=>({name:e.name,description:e.description||void 0,instructions:e.instructions||void 0,mcpAccess:e.mcpAccess.length>0?e.mcpAccess.map(e=>({mcpServer:e.mcpServer,enabledTools:e.enabledTools.length>0?[...e.enabledTools]:void 0})):void 0,skillRefs:e.skillRefs.length>0?e.skillRefs.map(e=>({org:e.org||"",slug:e.slug})):void 0,modelOverride:e.modelOverride||void 0}));await i(s)},[e,i]),f=(0,s.useCallback)(async()=>{if(!i||!m.name.trim())return;let t=e.map(e=>({name:e.name,description:e.description||void 0,instructions:e.instructions||void 0,mcpAccess:e.mcpAccess.length>0?e.mcpAccess.map(e=>({mcpServer:e.mcpServer,enabledTools:e.enabledTools.length>0?[...e.enabledTools]:void 0})):void 0,skillRefs:e.skillRefs.length>0?e.skillRefs.map(e=>({org:e.org||"",slug:e.slug})):void 0,modelOverride:e.modelOverride||void 0})),s={name:m.name.trim(),description:m.description.trim()||void 0,instructions:m.instructions.trim()||void 0};await i([...t,s])&&(x({name:"",description:"",instructions:""}),u(!1))},[e,m,i]);return(0,t.jsx)(t9.Section,{title:"Sub-Agents",count:e.length,onEdit:n?()=>d(e=>!e):void 0,children:(0,t.jsxs)("div",{className:"stg:flex stg:flex-col",children:[e.length>0?(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:divide-y stg:divide-border",children:e.map((e,s)=>{let n=l.has(s);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-3 stg:px-3 stg:py-2.5",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{o(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},"aria-expanded":n,className:(0,h.cn)("stg:flex stg:flex-1 stg:items-start stg:gap-3 stg:text-left","stg:focus-visible:outline-none"),children:[(0,t.jsx)(sV,{className:(0,h.cn)("stg:mt-0.5 stg:size-4 stg:shrink-0 stg:text-muted-foreground stg:transition-transform",n&&"stg:rotate-90")}),(0,t.jsxs)("div",{className:"stg:min-w-0 stg:flex-1",children:[(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:e.name}),e.description&&(0,t.jsx)("p",{className:"stg:mt-0.5 stg:text-xs stg:text-muted-foreground",children:e.description})]})]}),g&&(0,t.jsx)("button",{type:"button",onClick:()=>p(s),disabled:r,"aria-label":`Remove ${e.name}`,className:(0,h.cn)("stg:mt-0.5 stg:inline-flex stg:size-6 stg:items-center stg:justify-center stg:rounded-md stg:text-muted-foreground","stg:hover:bg-destructive-subtle stg:hover:text-destructive","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:(0,t.jsx)(sq,{className:"stg:size-3.5"})})]}),n&&(0,t.jsx)(sP,{subAgent:e})]},e.name||s)})}):(0,t.jsx)("p",{className:"stg:px-3 stg:py-3 stg:text-xs stg:text-muted-foreground stg:italic",children:"No sub-agents configured"}),n&&g&&!c&&(0,t.jsx)("div",{className:"stg:border-t stg:border-border stg:px-3 stg:py-2",children:(0,t.jsxs)("button",{type:"button",onClick:()=>u(!0),className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-xs stg:font-medium","stg:border stg:border-dashed stg:border-border stg:text-muted-foreground","stg:hover:border-muted-foreground stg:hover:text-foreground stg:hover:bg-muted-subtle","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:transition-colors"),children:[(0,t.jsx)(sY,{className:"stg:size-3"}),"Add sub-agent"]})}),a&&(0,t.jsx)("p",{className:"stg:border-t stg:border-border stg:px-3 stg:py-2 stg:text-xs stg:text-destructive",role:"alert",children:a}),n&&c&&(0,t.jsxs)("div",{className:"stg:border-t stg:border-border stg:p-3 stg:space-y-2",children:[(0,t.jsx)("input",{type:"text",value:m.name,onChange:e=>x(t=>({...t,name:e.target.value})),placeholder:"Sub-agent name (required)",className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:text-sm stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsx)("input",{type:"text",value:m.description,onChange:e=>x(t=>({...t,description:e.target.value})),placeholder:"Description (optional)",className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsx)("textarea",{value:m.instructions,onChange:e=>x(t=>({...t,instructions:e.target.value})),placeholder:"Instructions (optional)",rows:2,className:(0,h.cn)("stg:w-full stg:resize-y stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:font-mono stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-end stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{u(!1),x({name:"",description:"",instructions:""})},className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:border stg:border-border stg:bg-background stg:text-foreground stg:hover:bg-accent","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Cancel"}),(0,t.jsx)("button",{type:"button",onClick:f,disabled:!m.name.trim()||r,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:disabled:opacity-50","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Add"})]})]})]})})}function sP({subAgent:e}){return(0,t.jsxs)("div",{className:"stg:mb-1 stg:ml-7 stg:space-y-3 stg:border-l stg:border-border stg:pl-4 stg:pt-1",children:[e.instructions&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"stg:mb-1 stg:text-xs stg:font-medium stg:text-muted-foreground",children:"Instructions"}),(0,t.jsx)("pre",{className:"stg:whitespace-pre-wrap stg:break-words stg:rounded-md stg:bg-muted-subtle stg:p-2 stg:font-mono stg:text-xs stg:text-foreground",children:e.instructions})]}),e.mcpAccess.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"stg:mb-1 stg:text-xs stg:font-medium stg:text-muted-foreground",children:"MCP Access"}),(0,t.jsx)("div",{className:"stg:space-y-1",children:e.mcpAccess.map(e=>(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:text-xs stg:text-foreground",children:[(0,t.jsx)(sF,{className:"stg:size-3 stg:shrink-0 stg:text-muted-foreground"}),(0,t.jsx)("span",{className:"stg:font-medium",children:e.mcpServer}),(0,t.jsx)("span",{className:"stg:text-muted-foreground",children:e.enabledTools.length>0?`${e.enabledTools.length} ${1===e.enabledTools.length?"tool":"tools"}`:"all tools"})]},e.mcpServer))})]}),e.skillRefs.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"stg:mb-1 stg:text-xs stg:font-medium stg:text-muted-foreground",children:"Skills"}),(0,t.jsx)("div",{className:"stg:space-y-1",children:e.skillRefs.map(e=>(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:text-xs stg:text-foreground",children:[(0,t.jsx)(sH,{className:"stg:size-3 stg:shrink-0 stg:text-muted-foreground"}),(0,t.jsx)("span",{children:e.org?`${e.org}/${e.slug}`:e.slug})]},e.slug))})]}),e.modelOverride&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"stg:mb-1 stg:text-xs stg:font-medium stg:text-muted-foreground",children:"Model Override"}),(0,t.jsx)("span",{className:"stg:rounded stg:bg-muted stg:px-1.5 stg:py-0.5 stg:font-mono stg:text-xs stg:text-foreground",children:e.modelOverride})]})]})}function sB({data:e}){let s=Object.entries(e).sort(([e],[t])=>e.localeCompare(t));return(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:divide-y stg:divide-border",children:s.map(([e,s])=>(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-3 stg:px-3 stg:py-2",children:[(0,t.jsx)("code",{className:"stg:shrink-0 stg:font-mono stg:text-sm stg:font-medium stg:text-foreground",children:e}),(0,t.jsx)("span",{className:"stg:shrink-0 stg:rounded stg:bg-muted stg:px-1.5 stg:py-0.5 stg:text-[10px] stg:font-medium stg:text-muted-foreground",children:s.isSecret?"secret":"config"}),s.description&&(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:s.description})]},e))})}function sU({className:e}){return(0,t.jsxs)("div",{className:(0,h.cn)("stg:flex stg:flex-col stg:gap-6",e),"aria-busy":"true","aria-label":"Loading agent details",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-3",children:[(0,t.jsx)("div",{className:"stg:mt-1 stg:size-6 stg:shrink-0 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsxs)("div",{className:"stg:flex-1 stg:space-y-2",children:[(0,t.jsx)("div",{className:"stg:h-5 stg:w-48 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:h-3 stg:w-64 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:h-4 stg:w-full stg:max-w-md stg:animate-pulse stg:rounded stg:bg-muted"})]})]}),[40,24,16].map(e=>(0,t.jsxs)("div",{className:"stg:space-y-2",children:[(0,t.jsx)("div",{className:"stg:h-3 stg:w-24 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:animate-pulse stg:rounded-lg stg:border stg:border-border stg:bg-muted-faint",style:{height:`${4*e}px`}})]},e))]})}function sW({className:e}){return(0,t.jsxs)("div",{role:"status",className:(0,h.cn)("stg:flex stg:flex-col stg:items-center stg:gap-2 stg:py-12 stg:text-center",e),children:[(0,t.jsx)(s_,{className:"stg:size-10 stg:text-muted-foreground-faint"}),(0,t.jsx)("p",{className:"stg:text-sm stg:font-medium stg:text-muted-foreground",children:"Agent not found"}),(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground-subtle",children:"This agent doesn't exist or you don't have access to it."})]})}function s_({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"3",y:"5",width:"10",height:"8",rx:"1.5"}),(0,t.jsx)("path",{d:"M6 9h.01M10 9h.01",strokeWidth:"2"}),(0,t.jsx)("path",{d:"M8 2v3"})]})}function sF({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"2",y:"2",width:"12",height:"5",rx:"1"}),(0,t.jsx)("rect",{x:"2",y:"9",width:"12",height:"5",rx:"1"}),(0,t.jsx)("circle",{cx:"5",cy:"4.5",r:"0.75",fill:"currentColor",stroke:"none"}),(0,t.jsx)("circle",{cx:"5",cy:"11.5",r:"0.75",fill:"currentColor",stroke:"none"})]})}function sH({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M9 1.5 4 9h4l-1 5.5L12 7H8l1-5.5Z"})})}function sV({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m6 3 5 5-5 5"})})}function sq({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m4 4 8 8M12 4l-8 8"})})}function sY({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 3v10M3 8h10"})})}var sK=e.i(330815);function sG({open:e,onOpenChange:n,org:r,agentId:a,onCreated:i}){let{create:l,isCreating:o,error:g,clearError:d}=function(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>a(null),[]);return{create:(0,s.useCallback)(async t=>{n(!0),a(null);try{return await e.agentInstance.create(t)}catch(e){throw a((0,ee.toError)(e)),e}finally{n(!1)}},[e]),isCreating:t,error:r,clearError:i}}(),c=(0,s.useId)(),u=`${c}-title`,m=`${c}-name`,p=`${c}-description`,[f,b]=(0,s.useState)(""),[v,j]=(0,s.useState)(""),[y,k]=(0,s.useState)([]),[N,C]=(0,s.useState)(q.ApiResourceVisibility.visibility_private),S=(0,s.useCallback)(()=>{b(""),j(""),k([]),C(q.ApiResourceVisibility.visibility_private),d()},[d]),w=(0,s.useCallback)(()=>{n(!1),S()},[n,S]),A=(0,s.useCallback)(e=>{e||w()},[w]),R=(0,s.useCallback)(async e=>{if(e.preventDefault(),f.trim())try{let e=await l({name:f.trim(),org:r,agentId:a,description:v.trim()||void 0,environmentRefs:y.length>0?y:void 0,visibility:N});i?.(e),w()}catch{}},[f,r,a,v,y,N,l,i,w]);return(0,t.jsx)($.DialogShell,{open:e,onOpenChange:A,width:"lg","aria-labelledby":u,children:(0,t.jsxs)("form",{onSubmit:R,className:"stg:flex stg:flex-col",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between stg:border-b stg:border-border stg:px-6 stg:py-4",children:[(0,t.jsx)("h2",{id:u,className:"stg:text-base stg:font-semibold stg:text-foreground",children:"Create Agent Instance"}),(0,t.jsx)("button",{type:"button",onClick:w,"aria-label":"Close",className:(0,h.cn)("stg:rounded-md stg:p-1 stg:text-muted-foreground","stg:hover:text-foreground stg:hover:bg-accent-hover","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring"),children:(0,t.jsx)(sX,{})})]}),(0,t.jsxs)("div",{className:"stg:space-y-5 stg:px-6 stg:py-5",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{htmlFor:m,className:"stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5",children:["Name ",(0,t.jsx)("span",{className:"stg:text-destructive",children:"*"})]}),(0,t.jsx)("input",{id:m,type:"text",required:!0,value:f,onChange:e=>b(e.target.value),placeholder:"e.g. prod, staging, qa-team",disabled:o,className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-background stg:px-3 stg:py-2 stg:text-sm","stg:text-foreground stg:placeholder:text-muted-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring","stg:disabled:cursor-not-allowed stg:disabled:opacity-50"),autoFocus:!0}),(0,t.jsx)("p",{className:"stg:mt-1 stg:text-[0.65rem] stg:text-muted-foreground",children:"A URL-friendly slug will be generated from this name."})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{htmlFor:p,className:"stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5",children:"Description"}),(0,t.jsx)("textarea",{id:p,value:v,onChange:e=>j(e.target.value),placeholder:"What is this instance used for?",disabled:o,rows:2,className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-background stg:px-3 stg:py-2 stg:text-sm stg:resize-none","stg:text-foreground stg:placeholder:text-muted-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring","stg:disabled:cursor-not-allowed stg:disabled:opacity-50")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5",children:"Environments"}),(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground stg:mb-2",children:"Bind credentials and configuration to this instance."}),(0,t.jsx)(Y.EnvironmentPicker,{org:r,value:y,onChange:k,disabled:o})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5",children:"Visibility"}),(0,t.jsx)(sK.InstanceVisibilitySelector,{visibility:N,onVisibilityChange:C,mode:"create",disabled:o})]}),g&&(0,t.jsx)("div",{className:"stg:rounded-md stg:bg-destructive/10 stg:px-3 stg:py-2 stg:text-sm stg:text-destructive",role:"alert",children:(0,x.getUserMessage)(g)})]}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-end stg:gap-2 stg:border-t stg:border-border stg:px-6 stg:py-4",children:[(0,t.jsx)("button",{type:"button",onClick:w,disabled:o,className:(0,h.cn)("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium","stg:text-foreground stg:hover:bg-accent-hover","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring","stg:disabled:cursor-not-allowed stg:disabled:opacity-50"),children:"Cancel"}),(0,t.jsx)("button",{type:"submit",disabled:o||!f.trim(),className:(0,h.cn)("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium","stg:bg-primary stg:text-primary-foreground","stg:hover:bg-primary/90","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring stg:focus:ring-offset-2","stg:disabled:cursor-not-allowed stg:disabled:opacity-50"),children:o?"Creating...":"Create Instance"})]})]})})}function sX(){return(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}var sJ=e.i(582321),sZ=e.i(352371),sQ=e.i(310057),s0=e.i(297629),s1=e.i(451241),s2=e.i(107141),s5=e.i(336095),s3=e.i(472402);function s4({org:e,slug:a}){let i=(0,n.useRouter)(),{setLabel:l}=(0,sQ.useBreadcrumbOverride)(),o=(0,s0.useActiveOrgSlug)(),{navigateToDetail:g}=(0,s1.useLibraryNavigation)(),[d,c]=(0,s.useState)(null),[u,m]=(0,s.useState)("Agent"),{copyId:h,copyQualifiedSlug:x}=(0,tp.useCopyResource)(),{confirmState:p,confirm:f,handleConfirm:b,handleCancel:v}=(0,w.useConfirmAction)(),{deleteResource:j,isDeleting:y}=(0,sJ.useDeleteResource)("agent",d,u),{deleteInstance:k}=function(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>a(null),[]);return{deleteInstance:(0,s.useCallback)(async t=>{n(!0),a(null);try{return await e.agentInstance.delete(t)}catch(e){throw a((0,ee.toError)(e)),e}finally{n(!1)}},[e]),isDeleting:t,error:r,clearError:i}}(),{agent:N,refetch:C}=(0,ti.useAgent)(e,a),{copyYaml:R,copyJson:M,downloadYaml:E}=(0,sZ.useExportResource)({kind:"Agent",resource:N}),[I,T]=(0,s.useState)(!1),[L,$]=(0,s.useState)(!1),[O,D]=(0,s.useState)(0),[z,P]=(0,s.useState)(()=>new URLSearchParams(window.location.search).get("tab")??void 0??"overview"),B=(0,s.useMemo)(()=>N?[{id:"channels",label:"Channels",content:(0,t.jsx)(e7,{agent:N,channelAppsHref:"/settings/channel-apps",sessionHref:e=>`/sessions/${e}`})}]:[],[N]);(0,s.useEffect)(()=>()=>l(null),[l]);let W=(0,s.useCallback)(({name:e,id:t})=>{l(e),c(t),m(e)},[l]),_=(0,s.useCallback)(async()=>{if(await f({title:`Delete ${u}?`,description:"This permanently removes the agent and all of its instances. Past sessions and executions are preserved. This action cannot be undone.",confirmLabel:"Delete",variant:"destructive"}))try{await j(),i.push("/library/agents")}catch{}},[f,j,i,u]),F=(0,s.useMemo)(()=>({id:"start-session",label:"Start session",onAction:()=>i.push((0,s5.getAgentSessionUrl)(e,a))}),[i,e,a]),H=(0,s.useCallback)((e,t)=>`${(0,s3.getAppBaseUrl)()}/chat/${e}/${t}`,[]),V=(0,s.useCallback)(t=>{let s=t.metadata?.id;i.push((0,s5.getAgentSessionUrl)(e,a,s))},[i,e,a]),q=(0,s.useCallback)(async e=>{let t=e.metadata?.name||e.metadata?.slug||"this instance";if(!await f({title:`Delete ${t}?`,description:"This permanently removes the instance and its environment bindings. Sessions already started against it are preserved. This action cannot be undone.",confirmLabel:"Delete",variant:"destructive"}))return;let s=e.metadata?.id;if(s)try{await k(s),r.toast.success("Instance deleted"),D(e=>e+1)}catch{r.toast.error("Failed to delete instance")}},[f,k]),Y=(0,s.useMemo)(()=>[{id:"copy-id",label:"Copy ID",group:"clipboard",onAction:()=>{d&&h(d)},disabled:!d},{id:"copy-slug",label:"Copy slug",group:"clipboard",onAction:()=>x(e,a)},{id:"edit-yaml",label:"Edit YAML",group:"export",onAction:()=>T(!0),disabled:!N},{id:"export-yaml",label:"Export YAML",group:"export",onAction:R,disabled:!N},{id:"export-json",label:"Export JSON",group:"export",onAction:M,disabled:!N},{id:"download-yaml",label:"Download YAML",group:"export",onAction:E,disabled:!N},{id:"delete",label:"Delete",variant:"destructive",group:"danger",onAction:_,disabled:y}],[d,h,x,e,a,R,M,E,N,_,y]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(sT,{org:e,slug:a,onResourceLoad:W,onMcpServerClick:({org:e,slug:t})=>g("mcp-servers",e,t),onSkillClick:({org:e,slug:t})=>g("skills",e,t),onPluginClick:({org:e,slug:t})=>g("plugins",e,t),editable:!0,primaryAction:F,actions:Y,buildShareUrl:H,viewerOrg:o,additionalTabs:B,activeTab:z,onTabChange:P,onCreateInstanceClick:()=>$(!0),onInstanceStartSessionClick:V,onInstanceDeleteClick:q,instancesRefreshKey:O}),(0,t.jsx)(A.EditResourceYamlDialog,{open:I,onOpenChange:T,resource:N,onApplied:C}),(0,t.jsx)(S.ConfirmDialog,{state:p,onConfirm:b,onCancel:v}),d&&(0,t.jsx)(sG,{open:L,onOpenChange:$,org:e,agentId:d,onCreated:()=>{r.toast.success("Instance created"),D(e=>e+1)}})]})}e.s(["AgentDetailPage",0,function(){let e=(0,s1.useRouteDetailYieldsToOverlay)(),s=(0,s2.useStaticRouteParam)("org",2),n=(0,s2.useStaticRouteParam)("slug");return!e&&s&&n?(0,t.jsx)(s4,{org:s,slug:n}):null},"AgentDetailPageInner",0,s4],63353)}]);
|
|
18
|
+
});`},[r.baseUrl,e,n]);return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-3",children:[(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"Need your own auth, branding, or UI? Create a platform client and integrate this agent with the Stigmer SDK — the same runtime, full control."}),(0,t.jsx)(tX,{label:"Platform client integration",value:a,copyLabel:"Code",multiline:!0}),(0,t.jsx)("a",{href:"https://stigmer.ai/docs/guides/authentication/platform-client/overview",target:"_blank",rel:"noreferrer",className:(0,h.cn)("stg:text-xs stg:font-medium stg:text-primary stg:hover:text-primary-muted","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:rounded"),children:"Read the platform client guide →"})]})}function tX({label:e,value:s,copyLabel:n,disabled:r,multiline:a,openHref:i}){let{copy:l}=(0,tp.useCopyResource)();return(0,t.jsxs)("section",{className:(0,h.cn)(r&&"stg:opacity-50"),children:[(0,t.jsx)("h3",{className:"stg:text-xs stg:font-medium stg:text-muted-foreground",children:e}),(0,t.jsxs)("div",{className:"stg:mt-1.5 stg:flex stg:items-start stg:gap-1.5",children:[a?(0,t.jsx)("pre",{className:(0,h.cn)("stg:min-w-0 stg:flex-1 stg:overflow-x-auto stg:rounded-md stg:border stg:border-border stg:bg-muted-subtle stg:px-2.5 stg:py-2","stg:font-mono stg:text-xs stg:leading-relaxed stg:text-foreground"),children:s}):(0,t.jsx)(E.TruncatedText,{text:s,className:(0,h.cn)("stg:min-w-0 stg:flex-1 stg:rounded-md stg:border stg:border-border stg:bg-muted-subtle stg:px-2.5 stg:py-1.5","stg:font-mono stg:text-xs stg:text-foreground")}),(0,t.jsxs)("div",{className:"stg:flex stg:shrink-0 stg:flex-col stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:()=>void l(s,n),disabled:r,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-xs stg:font-medium","stg:border stg:border-border stg:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:"Copy"}),i&&(0,t.jsx)("a",{href:i,target:"_blank",rel:"noreferrer",className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-center stg:text-xs stg:font-medium","stg:border stg:border-border stg:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Open"})]})]})]})}function tJ(){return(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function tZ(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m4 4 8 8M12 4l-8 8"})})}function tQ({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m6 3 5 5-5 5"})})}function t0({agent:e,buildShareUrl:n,className:a}){let{shares:i,isLoading:l,error:o,refetch:g}=function(e,t){let s=(0,U.useStigmer)(),n=e?async()=>(await s.agentShare.getByAgent((0,P.create)(tR.GetAgentSharesByAgentRequestSchema,{agentId:e,org:t??""}))).items:null,{data:r,isLoading:a,isRefetching:i,error:l,refetch:o}=(0,W.useFetch)(n,[e,t,s],[]);return{shares:r,isLoading:a,isRefetching:i,error:l,refetch:o}}(e.metadata?.id??"",e.metadata?.org??""),{allowed:d}=function(e){let t=e?.metadata?.id??"",s=e?.metadata?.org??"",{allowed:n}=(0,C.useCheckPermission)(t?{kind:"agent",id:t}:null,"can_edit"),{allowed:r}=(0,C.useCheckPermission)(s?{kind:"organization",id:s}:null,"can_create_agent_share");return{allowed:!!e&&n&&r}}(e),{deleteShare:c}=function(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>a(null),[]);return{deleteShare:(0,s.useCallback)(async t=>{n(!0),a(null);try{return await e.agentShare.delete(t)}catch(e){throw a((0,ee.toError)(e)),e}finally{n(!1)}},[e]),isDeleting:t,error:r,clearError:i}}(),{confirmState:u,confirm:m,handleConfirm:p,handleCancel:f}=(0,w.useConfirmAction)(),[b,v]=(0,s.useState)(null),y=(0,s.useCallback)(async e=>{let t=e.metadata?.slug??"";if(await m({title:"Delete share?",description:`The link /chat/${e.metadata?.org}/${t} stops working immediately — including for visitors mid-conversation — and its configuration (origins, messages, credential bindings) is gone. To stop serving while keeping the configuration, pause it instead.`,confirmLabel:"Delete",variant:"destructive"}))try{await c(e.metadata?.id??""),r.toast.success("Share deleted"),g()}catch(e){r.toast.error((0,x.getUserMessage)(e))}},[m,c,g]);return l?(0,t.jsx)(t5,{}):o?(0,t.jsx)("div",{className:"stg:py-8 stg:text-center stg:text-sm stg:text-destructive",children:"Failed to load shares"}):(0,t.jsxs)("div",{className:(0,h.cn)("stg:space-y-3",a),children:[0===i.length?(0,t.jsx)(t2,{canCreate:d,onCreateClick:()=>v({mode:"create"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between",children:[(0,t.jsxs)("h3",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:[i.length," ",1===i.length?"share":"shares"]}),d&&(0,t.jsx)(j.Button,{variant:"outline",size:"xs",icon:(0,t.jsx)(t3,{}),onClick:()=>v({mode:"create"}),children:"Create share"})]}),(0,t.jsx)("div",{className:"stg:overflow-hidden stg:rounded-lg stg:border stg:border-border",children:(0,t.jsxs)("table",{className:"stg:w-full stg:table-fixed stg:text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"stg:border-b stg:border-border stg:bg-muted-subtle",children:[(0,t.jsx)("th",{className:"stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Name"}),(0,t.jsx)("th",{className:"stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Link"}),(0,t.jsx)("th",{className:"stg:w-28 stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Audience"}),(0,t.jsx)("th",{className:"stg:w-24 stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Status"}),(0,t.jsx)("th",{className:"stg:w-16 stg:px-4 stg:py-2 stg:text-right stg:font-medium stg:text-muted-foreground",children:"Actions"})]})}),(0,t.jsx)("tbody",{className:"stg:divide-y stg:divide-border",children:i.map(s=>(0,t.jsx)(t1,{share:s,agent:e,buildShareUrl:n,onEditClick:e=>v({mode:"edit",share:e}),onDeleteClick:y,refetch:g},s.metadata?.id))})]})})]}),b&&(0,t.jsx)(tI,{open:!0,onOpenChange:e=>{e||v(null)},agent:e,share:"edit"===b.mode?b.share:void 0,buildShareUrl:n,onSharingChanged:g}),(0,t.jsx)(S.ConfirmDialog,{state:u,onConfirm:p,onCancel:f})]})}function t1({share:e,agent:n,buildShareUrl:a,onEditClick:i,onDeleteClick:l,refetch:o}){let d,c=e.metadata,u=c?.id??"",p=c?.org??"",f=c?.slug??"",b=e.spec?.enabled??!1,j=tS(e.spec?.audience),{copy:y}=(0,tp.useCopyResource)(),{save:k,isPending:N}=tA(n),{rotateShareLink:S,isPending:w}=tM(u),{allowed:A}=(0,C.useCheckPermission)({kind:"agent_share",id:u},"can_edit"),{allowed:R}=(0,C.useCheckPermission)({kind:"agent_share",id:u},"can_delete"),M=(0,tx.chatPath)(p,f),I=(d=a?a(p,f):M,"org"===j?d:(0,tx.appendLinkToken)(d,e.status?.shareLinkToken??"")),T=(0,s.useCallback)(()=>{y(I,"Link")},[y,I]),L=(0,s.useCallback)(async()=>{try{await k({...tw(e),enabled:!b},e),r.toast.success(b?"Share paused":"Share resumed"),o()}catch(e){r.toast.error((0,x.getUserMessage)(e))}},[k,e,b,o]),$=(0,s.useCallback)(async()=>{try{await S(),r.toast.success("Link reset — the old link no longer works"),o()}catch(e){r.toast.error((0,x.getUserMessage)(e))}},[S,o]);return(0,t.jsxs)("tr",{className:"stg:cursor-pointer stg:transition-colors stg:hover:bg-accent-hover",onClick:()=>i(e),children:[(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:(0,t.jsx)("div",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-2",children:(0,t.jsx)(E.TruncatedText,{text:c?.name||f||"—",className:"stg:font-medium stg:text-foreground"})})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",onClick:e=>e.stopPropagation(),children:(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-1.5",children:[(0,t.jsx)(E.TruncatedText,{text:M,className:"stg:font-mono stg:text-xs stg:text-muted-foreground"}),(0,t.jsx)("button",{type:"button",onClick:T,"aria-label":`Copy link for ${c?.name||f}`,className:(0,h.cn)("stg:shrink-0 stg:rounded stg:p-1 stg:text-muted-foreground","stg:hover:bg-accent-hover stg:hover:text-foreground","stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-ring"),children:(0,t.jsx)(t4,{})})]})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:"org"===j?"Org members":"Public"})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:(0,t.jsxs)("span",{className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1.5 stg:text-xs",b?"stg:text-foreground":"stg:text-muted-foreground"),children:[(0,t.jsx)("span",{"aria-hidden":"true",className:(0,h.cn)("stg:size-1.5 stg:rounded-full",b?"stg:bg-success":"stg:bg-muted-foreground")}),b?"Active":"Paused"]})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5 stg:text-right",onClick:e=>e.stopPropagation(),children:(A||R)&&(0,t.jsxs)(v.ActionMenu,{children:[(0,t.jsx)(v.ActionMenu.Trigger,{className:"stg:ml-auto","aria-label":`Actions for ${c?.name||f}`,children:(0,t.jsx)(g.MoreHorizontal,{className:"stg:size-4"})}),(0,t.jsxs)(v.ActionMenu.Content,{children:[A&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(tu,{}),onSelect:()=>i(e),children:"Edit"}),(0,t.jsx)(v.ActionMenu.Item,{icon:b?(0,t.jsx)(tc.Pause,{}):(0,t.jsx)(tm.Play,{}),disabled:N,onSelect:()=>void L(),children:b?"Pause":"Resume"}),"public"===j&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(th.RotateCcw,{}),disabled:w,onSelect:()=>void $(),children:"Reset link"})]}),A&&R&&(0,t.jsx)(v.ActionMenu.Separator,{}),R&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(m.Trash2,{}),variant:"destructive",onSelect:()=>l(e),children:"Delete"})]})]})})]})}function t2({canCreate:e,onCreateClick:s}){return(0,t.jsx)(y.EmptyState,{variant:"first-use",icon:(0,t.jsx)(t6,{className:"stg:size-10"}),title:"No shares yet",description:"A share gives this agent a hosted chat link you can send or embed — each share is its own channel with its own audience, embed origins, and tool credentials.",action:e?{label:"Create share",onClick:s,icon:(0,t.jsx)(t3,{})}:void 0})}function t5(){return(0,t.jsx)("div",{className:"stg:space-y-2 stg:py-4",children:[1,2,3].map(e=>(0,t.jsx)("div",{className:"stg:h-12 stg:animate-pulse stg:rounded-md stg:bg-muted-faint"},e))})}function t3(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M6 2v8M2 6h8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function t4(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"5.5",y:"5.5",width:"8",height:"8",rx:"1.5"}),(0,t.jsx)("path",{d:"M10.5 5.5v-2a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2"})]})}function t6({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"4",cy:"8",r:"2"}),(0,t.jsx)("circle",{cx:"12",cy:"4",r:"2"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"2"}),(0,t.jsx)("path",{d:"m5.8 7.1 4.4-2.2M5.8 8.9l4.4 2.2"})]})}var t8=e.i(668093),t9=e.i(652337),t7=e.i(267912);let se={agent:"Agent","mcp-server":"MCP",skill:"Skill","sub-agent":"Sub-Agent"};function st({node:e,depth:n,onNodeClick:r,defaultExpanded:a}){let i=e.children.length>0,l="agent"===e.kind,o="sub-agent"===e.kind&&i,g=l&&i,[d,c]=(0,s.useState)(a),u=null!=e.ref&&null!=r,m=g||o&&d,x=(0,s.useCallback)(()=>{o?c(e=>!e):u&&r(e)},[o,u,r,e]),p=(0,s.useCallback)(e=>{o&&("ArrowRight"!==e.key||d?"ArrowLeft"===e.key&&d&&(e.preventDefault(),c(!1)):(e.preventDefault(),c(!0)))},[o,d]),f=(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-2",children:[o&&(0,t.jsx)(si,{className:(0,h.cn)("stg:size-3.5 stg:shrink-0 stg:text-muted-foreground stg:transition-transform",d&&"stg:rotate-90")}),(0,t.jsx)(ss,{kind:e.kind,className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground"}),!l&&(0,t.jsx)("span",{className:(0,h.cn)("stg:shrink-0 stg:rounded stg:px-1.5 stg:py-px stg:text-[10px] stg:font-medium stg:leading-tight",function(e){switch(e){case"mcp-server":return"stg:bg-[var(--stgm-status-running-subtle)] stg:text-[var(--stgm-status-running)]";case"skill":return"stg:bg-[var(--stgm-status-pending-subtle)] stg:text-[var(--stgm-status-pending)]";case"sub-agent":return"stg:bg-[var(--stgm-status-ready-subtle)] stg:text-[var(--stgm-status-ready)]";case"agent":return"stg:bg-muted stg:text-muted-foreground"}}(e.kind)),children:se[e.kind]}),(0,t.jsx)("span",{className:"stg:min-w-0 stg:truncate stg:text-sm stg:font-medium stg:text-foreground",children:e.qualifiedLabel??e.label}),e.metadata&&Object.entries(e.metadata).map(([e,s])=>(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-xs stg:text-muted-foreground",children:s},e))]}),b=o||u;return(0,t.jsxs)("li",{role:"treeitem","aria-expanded":o?d:!!g||void 0,className:(0,h.cn)("stg:list-none",n>0&&"stg:relative stg:before:absolute stg:before:left-[-12px] stg:before:top-[14px] stg:before:h-px stg:before:w-3 stg:before:bg-border stg:before:content-['']"),children:[b?(0,t.jsx)("button",{type:"button",onClick:x,onKeyDown:p,tabIndex:-1,className:(0,h.cn)("stg:flex stg:w-full stg:items-center stg:rounded-md stg:px-2 stg:py-1.5 stg:text-left stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:f}):(0,t.jsx)("div",{className:"stg:flex stg:items-center stg:px-2 stg:py-1.5",children:f}),e.description&&!l&&(0,t.jsx)("p",{className:(0,h.cn)("stg:px-2 stg:pb-1 stg:text-xs stg:text-muted-foreground",o?"stg:ml-[calc(0.5rem+14px+0.5rem)]":"stg:ml-2"),children:e.description}),m&&(0,t.jsx)("ul",{role:"group",className:(0,h.cn)(O.UNSTYLED_LIST,"stg:relative stg:ml-[11px] stg:border-l stg:border-border stg:pl-3"),children:e.children.map(e=>(0,t.jsx)(st,{node:e,depth:n+1,onNodeClick:r,defaultExpanded:a},e.id))})]})}function ss({kind:e,className:s}){switch(e){case"agent":case"sub-agent":return(0,t.jsx)(sn,{className:s});case"mcp-server":return(0,t.jsx)(sr,{className:s});case"skill":return(0,t.jsx)(sa,{className:s})}}function sn({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"3",y:"5",width:"10",height:"8",rx:"1.5"}),(0,t.jsx)("path",{d:"M6 9h.01M10 9h.01",strokeWidth:"2"}),(0,t.jsx)("path",{d:"M8 2v3"})]})}function sr({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"2",y:"2",width:"12",height:"5",rx:"1"}),(0,t.jsx)("rect",{x:"2",y:"9",width:"12",height:"5",rx:"1"}),(0,t.jsx)("circle",{cx:"5",cy:"4.5",r:"0.75",fill:"currentColor",stroke:"none"}),(0,t.jsx)("circle",{cx:"5",cy:"11.5",r:"0.75",fill:"currentColor",stroke:"none"})]})}function sa({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M9 1.5 4 9h4l-1 5.5L12 7H8l1-5.5Z"})})}function si({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m6 3 5 5-5 5"})})}function sl({tree:e,onNodeClick:n,defaultExpanded:r=!0,className:a}){let i=(0,s.useRef)(null),l=(0,s.useCallback)(e=>{let t=i.current;if(!t)return;let s=Array.from(t.querySelectorAll("[role='treeitem'] > button, [role='treeitem'] > div")).filter(e=>{let t=e.closest("[role='treeitem']")?.parentElement?.closest("[role='treeitem']");for(;t;){if("false"===t.getAttribute("aria-expanded"))return!1;t=t.parentElement?.closest("[role='treeitem']")}return!0});if(0===s.length)return;let n=document.activeElement,r=n?s.indexOf(n):-1,a=null;switch(e.key){case"ArrowDown":a=r<s.length-1?r+1:0;break;case"ArrowUp":a=r>0?r-1:s.length-1;break;case"Home":a=0;break;case"End":a=s.length-1;break;default:return}e.preventDefault(),s[a].focus()},[]),{root:o}=e;return(0,t.jsxs)("div",{className:(0,h.cn)("stg:py-2",a),children:[(0,t.jsxs)("div",{className:"stg:mb-3 stg:flex stg:items-center stg:gap-2 stg:px-2",children:[(0,t.jsx)(so,{className:"stg:size-4 stg:text-muted-foreground"}),(0,t.jsx)("h3",{className:"stg:text-xs stg:font-medium stg:uppercase stg:tracking-wider stg:text-muted-foreground",children:"Dependency Tree"}),(0,t.jsxs)("span",{className:"stg:text-xs stg:text-muted-foreground",children:[e.nodeCount," ",1===e.nodeCount?"node":"nodes"]})]}),(0,t.jsx)("ul",{ref:i,role:"tree","aria-label":`Dependencies of ${o.label}`,onKeyDown:l,className:(0,h.cn)(O.UNSTYLED_LIST,"stg:rounded-lg stg:border stg:border-border stg:p-2"),children:(0,t.jsx)(st,{node:o,depth:0,onNodeClick:n,defaultExpanded:r})})]})}function so({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M8 2v4M8 6 4 10M8 6l4 4"}),(0,t.jsx)("circle",{cx:"8",cy:"2",r:"1",fill:"currentColor",stroke:"none"}),(0,t.jsx)("circle",{cx:"4",cy:"11",r:"1.5"}),(0,t.jsx)("circle",{cx:"8",cy:"11",r:"1.5"}),(0,t.jsx)("circle",{cx:"12",cy:"11",r:"1.5"})]})}var sg=e.i(261722),sd=e.i(81346),sc=e.i(52595);function su({value:e,onSave:n,renderPicker:r,onItemClick:a,itemIcon:i,resourceLabel:l="resource",editing:o,onEditingChange:g,defaultOrg:d="",disabled:c,isSaving:u,error:m,className:x}){let[p,f]=(0,s.useState)(!1),b=o??p,v=(0,s.useCallback)(e=>{f(e),g?.(e)},[g]);(0,s.useEffect)(()=>{void 0!==o&&f(o)},[o]);let[j,y]=(0,s.useState)([...e]),[k,N]=(0,s.useState)(!1),[C,S]=(0,s.useState)(!1),[w,A]=(0,s.useState)(""),[R,M]=(0,s.useState)(d);(0,s.useCallback)(()=>{y([...e]),v(!0),N(!1),S(!1)},[e,v]);let E=(0,s.useCallback)(()=>{v(!1),y([...e]),N(!1),S(!1)},[e,v]),I=(0,s.useCallback)(async()=>{await n(j)&&(v(!1),N(!1),S(!1))},[j,n,v]),T=(0,s.useCallback)(e=>{y(t=>t.filter((t,s)=>s!==e))},[]),L=(0,s.useCallback)(e=>{y(t=>t.some(t=>t.org===e.org&&t.slug===e.slug)?t:[...t,e]),N(!1)},[]);return c||!b?(0,t.jsx)("div",{className:(0,h.cn)("stg:flex stg:flex-col",x),children:e.length>0?(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:divide-y stg:divide-border",children:e.map((e,s)=>{let n=e.label??e.slug,r=(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-3",children:[i&&(0,t.jsx)("span",{className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground",children:i}),(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:n})]});return a?(0,t.jsx)("button",{type:"button",onClick:()=>a(e),className:(0,h.cn)("stg:w-full stg:px-3 stg:py-2.5 stg:text-left stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:r},`${e.org}/${e.slug}`||s):(0,t.jsx)("div",{className:"stg:px-3 stg:py-2.5",children:r},`${e.org}/${e.slug}`||s)})}):(0,t.jsxs)("p",{className:"stg:px-3 stg:py-3 stg:text-xs stg:text-muted-foreground stg:italic",children:["No ",l,"s configured"]})}):(0,t.jsxs)("div",{className:(0,h.cn)("stg:flex stg:flex-col stg:gap-2",x),children:[j.length>0&&(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:divide-y stg:divide-border stg:rounded-md stg:border stg:border-border",children:j.map((e,s)=>(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:px-3 stg:py-1.5",children:[i&&(0,t.jsx)("span",{className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground",children:i}),(0,t.jsx)("span",{className:"stg:flex-1 stg:text-sm stg:font-medium stg:text-foreground",children:e.label??e.slug}),(0,t.jsx)("button",{type:"button",onClick:()=>T(s),"aria-label":`Remove ${e.label??e.slug}`,className:(0,h.cn)("stg:inline-flex stg:size-6 stg:items-center stg:justify-center stg:rounded-md stg:text-muted-foreground","stg:hover:bg-destructive-subtle stg:hover:text-destructive","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:(0,t.jsx)(sh,{className:"stg:size-3.5"})})]},`${e.org}/${e.slug}`))}),k&&r?(0,t.jsx)("div",{className:"stg:rounded-md stg:border stg:border-border stg:bg-muted-faint stg:p-2",children:r(L)}):C?(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:rounded-md stg:border stg:border-border stg:bg-muted-faint stg:p-2",children:[(0,t.jsx)("input",{type:"text",value:R,onChange:e=>M(e.target.value),placeholder:"org",className:(0,h.cn)("stg:w-24 stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1 stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:"/"}),(0,t.jsx)("input",{type:"text",value:w,onChange:e=>A(e.target.value),placeholder:"slug",onKeyDown:e=>{"Enter"===e.key&&w.trim()?(L({org:R.trim()||d,slug:w.trim(),label:w.trim()}),A(""),S(!1)):"Escape"===e.key&&(S(!1),A(""))},className:(0,h.cn)("stg:flex-1 stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1 stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsx)("button",{type:"button",onClick:()=>{w.trim()&&(L({org:R.trim()||d,slug:w.trim(),label:w.trim()}),A(""),S(!1))},disabled:!w.trim(),className:(0,h.cn)("stg:inline-flex stg:size-6 stg:items-center stg:justify-center stg:rounded-md","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:disabled:opacity-50","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:(0,t.jsx)(sm,{className:"stg:size-3"})})]}):(0,t.jsxs)("button",{type:"button",onClick:()=>r?N(!0):S(!0),className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-xs stg:font-medium","stg:border stg:border-dashed stg:border-border stg:text-muted-foreground","stg:hover:border-muted-foreground stg:hover:text-foreground stg:hover:bg-muted-subtle","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:transition-colors"),children:[(0,t.jsx)(sm,{className:"stg:size-3"}),"Add ",l]}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-end stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:E,disabled:u,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:border stg:border-border stg:bg-background stg:text-foreground stg:hover:bg-accent","stg:disabled:opacity-50","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Cancel"}),(0,t.jsxs)("button",{type:"button",onClick:I,disabled:u,className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:disabled:opacity-50","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:[u&&(0,t.jsx)(sx,{}),"Save changes"]})]}),m&&(0,t.jsx)("p",{className:"stg:px-1 stg:text-xs stg:text-destructive",role:"alert",children:m})]})}function sm({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 3v10M3 8h10"})})}function sh({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m4 4 8 8M12 4l-8 8"})})}function sx(){return(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",className:"stg:animate-spin","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 2a6 6 0 1 0 6 6"})})}var sp=e.i(486277),sf=e.i(348990),sb=e.i(388023);function sv({onCreateClick:e,className:s}){return(0,t.jsx)(y.EmptyState,{variant:"first-use",icon:(0,t.jsx)(sj,{}),title:"No instances yet",description:"Create instances to start sessions with this agent using different credentials and settings. Each instance binds environments (secrets, configuration) and can be shared with your team independently.",action:e?{label:"Create instance",onClick:e,icon:(0,t.jsx)(sy,{})}:void 0,className:s})}function sj(){return(0,t.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M10 2L2 6l8 4 8-4-8-4zM2 10l8 4 8-4M2 14l8 4 8-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function sy(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M6 2v8M2 6h8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function sk({agentId:e,defaultInstanceId:n,org:r,viewerOrg:a,onCreateClick:i,onInstanceClick:l,onStartSessionClick:o,onDeleteClick:g,refreshKey:d,className:c}){let{instances:u,isLoading:m,error:x,refetch:p}=function(e,t){let s=(0,U.useStigmer)(),n=e?async()=>{let n=await s.agentInstance.getByAgent((0,P.create)(sp.GetAgentInstancesByAgentRequestSchema,{agentId:e,org:t??""}));return n.items?[...n.items]:[]}:null,{data:r,isLoading:a,isRefetching:i,error:l,refetch:o}=(0,W.useFetch)(n,[e,t,s],[]);return{instances:r,isLoading:a,isRefetching:i,error:l,refetch:o}}(e,a||r),{environments:f}=(0,sf.useEnvironmentList)(r),b=(0,s.useRef)(d);(0,s.useEffect)(()=>{void 0!==d&&d!==b.current&&(b.current=d,p())},[d,p]);let v=(0,s.useMemo)(()=>u.filter(e=>e.metadata?.id!==n),[u,n]),y=(0,s.useCallback)(e=>{let t=f.find(t=>t.metadata?.slug===e);return t?.metadata?.name??e},[f]);return m?(0,t.jsx)(sC,{}):x?(0,t.jsx)("div",{className:"stg:py-8 stg:text-center stg:text-sm stg:text-destructive",children:"Failed to load instances"}):0===v.length?(0,t.jsx)(sv,{onCreateClick:i,className:c}):(0,t.jsxs)("div",{className:(0,h.cn)("stg:space-y-3",c),children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between",children:[(0,t.jsxs)("h3",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:[v.length," ",1===v.length?"instance":"instances"]}),i&&(0,t.jsx)(j.Button,{variant:"outline",size:"xs",icon:(0,t.jsx)(sS,{}),onClick:i,children:"Create instance"})]}),(0,t.jsx)("div",{className:"stg:overflow-hidden stg:rounded-lg stg:border stg:border-border",children:(0,t.jsxs)("table",{className:"stg:w-full stg:table-fixed stg:text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"stg:border-b stg:border-border stg:bg-muted-subtle",children:[(0,t.jsx)("th",{className:"stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Name"}),(0,t.jsx)("th",{className:"stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Environments"}),(0,t.jsx)("th",{className:"stg:w-36 stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Visibility"}),(0,t.jsx)("th",{className:"stg:w-16 stg:px-4 stg:py-2 stg:text-right stg:font-medium stg:text-muted-foreground",children:"Actions"})]})}),(0,t.jsx)("tbody",{className:"stg:divide-y stg:divide-border",children:v.map(e=>(0,t.jsx)(sN,{instance:e,resolveEnvName:y,onRowClick:l,onStartSessionClick:o,onDeleteClick:g,refetch:p},e.metadata?.id))})]})})]})}function sN({instance:e,resolveEnvName:s,onRowClick:n,onStartSessionClick:r,onDeleteClick:a,refetch:i}){let l=e.metadata,o=l?.id??"",d=l?.labels?.["stigmer.ai/personal"]==="true",c=e.spec?.environmentRefs??[],{allowed:u}=(0,C.useCheckPermission)({kind:"agent_instance",id:o},"can_delete"),x=!!r,p=!!a&&u;return(0,t.jsxs)("tr",{className:(0,h.cn)("stg:transition-colors",n&&"stg:cursor-pointer stg:hover:bg-accent-hover"),onClick:()=>n?.(e),children:[(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:(0,t.jsxs)("div",{className:"stg:min-w-0",children:[(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-2",children:[(0,t.jsx)(E.TruncatedText,{text:l?.name||l?.slug||"—",className:"stg:font-medium stg:text-foreground"}),d&&(0,t.jsx)("span",{className:(0,h.cn)("stg:inline-flex stg:shrink-0 stg:items-center stg:rounded-md stg:px-1.5 stg:py-0.5","stg:text-[0.6rem] stg:font-medium stg:uppercase stg:tracking-wide","stg:bg-muted stg:text-muted-foreground stg:border stg:border-border"),children:"Personal"})]}),e.spec?.description&&(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground stg:truncate",children:e.spec.description})]})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:0===c.length?(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:"None"}):(0,t.jsx)("div",{className:"stg:flex stg:flex-wrap stg:gap-1",children:c.map((e,n)=>(0,t.jsx)("span",{className:(0,h.cn)("stg:inline-flex stg:items-center stg:rounded-md stg:px-1.5 stg:py-0.5","stg:text-[0.65rem] stg:font-medium","stg:bg-muted stg:text-muted-foreground","stg:border stg:border-border"),children:s(e.slug)},`${e.slug}-${n}`))})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",onClick:e=>e.stopPropagation(),children:o?(0,t.jsx)(sb.ResourceVisibilityControl,{kind:"agentInstance",resourceId:o,visibility:l?.visibility??q.ApiResourceVisibility.visibility_private,onChanged:i}):(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:"—"})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5 stg:text-right",onClick:e=>e.stopPropagation(),children:(x||p)&&(0,t.jsxs)(v.ActionMenu,{children:[(0,t.jsx)(v.ActionMenu.Trigger,{className:"stg:ml-auto","aria-label":`Actions for ${l?.name||l?.slug}`,children:(0,t.jsx)(g.MoreHorizontal,{className:"stg:size-4"})}),(0,t.jsxs)(v.ActionMenu.Content,{children:[x&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(tm.Play,{}),onSelect:()=>r?.(e),children:"Start session"}),x&&p&&(0,t.jsx)(v.ActionMenu.Separator,{}),p&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(m.Trash2,{}),variant:"destructive",onSelect:()=>a?.(e),children:"Delete"})]})]})})]})}function sC(){return(0,t.jsx)("div",{className:"stg:space-y-2 stg:py-4",children:[1,2,3].map(e=>(0,t.jsx)("div",{className:"stg:h-12 stg:animate-pulse stg:rounded-md stg:bg-muted-faint"},e))})}function sS(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M6 2v8M2 6h8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}var sw=e.i(292420),sA=e.i(473489);let sR={id:"overview",label:"Overview"},sM={id:"instances",label:"Instances"},sE={id:"shares",label:"Shares"},sI={id:"dependencies",label:"Dependencies"};function sT({org:e,slug:n,onMcpServerClick:r,onSkillClick:a,onResourceLoad:i,primaryAction:l,actions:o,additionalTabs:g,activeTab:d,onTabChange:c,defaultTab:u,editable:m=!1,onResourceUpdated:h,buildShareUrl:x,viewerOrg:p,onCreateInstanceClick:v,onInstanceClick:j,onInstanceStartSessionClick:y,onInstanceDeleteClick:k,instancesRefreshKey:N,onPluginClick:C,className:S}){let w,{agent:A,isLoading:R,error:M,refetch:E}=(0,ti.useAgent)(e,n),T=(0,sA.useManagingPlugin)(A?.metadata?.labels),L=m&&null===T.plugin,{update:$,isUpdating:O}=(0,tl.useUpdateAgent)(),[D,z]=(0,s.useState)(null),P=(0,s.useCallback)(async(e,t)=>{if(!A)return!1;z(null);let s=(0,to.toAgentUpdateInput)(A);s[e]=t;try{let e=await $(s);return h?.(e),E(),!0}catch(t){return z({field:e,message:(0,ee.toError)(t).message}),!1}},[A,$,h,E]),B=(0,s.useCallback)(()=>z(null),[]),{tree:U,isEmpty:W}=function({agentName:e,agentOrg:t,spec:n}){return(0,s.useMemo)(()=>{if(!n)return{tree:null,isEmpty:!0};let{mcpServerUsages:s,skillRefs:r,subAgents:a}=n;if(!(s.length>0||r.length>0||a.length>0))return{tree:null,isEmpty:!0};let i=1;return{tree:{root:{id:`agent:${e}`,kind:"agent",label:e,children:[...s.filter(e=>e.mcpServerRef).map(e=>{i++;let s=e.mcpServerRef,n=e.enabledTools.length;return{id:`mcp-server:${s.slug}`,kind:"mcp-server",label:s.slug,qualifiedLabel:s.org&&s.org!==t?`${s.org}/${s.slug}`:void 0,metadata:{tools:n>0?`${n} ${1===n?"tool":"tools"}`:"all tools"},children:[],ref:{org:s.org||t,slug:s.slug}}}),...r.map(e=>(i++,{id:`skill:${e.slug}`,kind:"skill",label:e.slug,qualifiedLabel:e.org&&e.org!==t?`${e.org}/${e.slug}`:void 0,children:[],ref:{org:e.org||t,slug:e.slug}})),...a.map(e=>{i++;let s=e.mcpAccess.map(s=>{i++;let n=s.enabledTools.length;return{id:`sub-agent:${e.name}:mcp-server:${s.mcpServer}`,kind:"mcp-server",label:s.mcpServer,metadata:{tools:n>0?`${n} ${1===n?"tool":"tools"}`:"all tools"},children:[],ref:{org:t,slug:s.mcpServer}}}),n=e.skillRefs.map(s=>(i++,{id:`sub-agent:${e.name}:skill:${s.slug}`,kind:"skill",label:s.slug,qualifiedLabel:s.org&&s.org!==t?`${s.org}/${s.slug}`:void 0,children:[],ref:{org:s.org||t,slug:s.slug}})),r={};return e.modelOverride&&(r.model=e.modelOverride),{id:`sub-agent:${e.name}`,kind:"sub-agent",label:e.name,description:e.description||void 0,metadata:Object.keys(r).length>0?r:void 0,children:[...s,...n]}})]},nodeCount:i},isEmpty:!1}},[e,t,n])}({agentName:A?.metadata?.name||A?.metadata?.slug||n,agentOrg:A?.metadata?.org||e,spec:A?.spec}),_=(0,s.useMemo)(()=>W?[sR,sM,sE]:[sR,sM,sE,sI],[W]),{effectiveTabs:F,effectiveActiveTab:H,effectiveOnTabChange:V,activeAdditionalTab:q}=(0,t7.useDetailTabs)({builtInTabs:_,additionalTabs:g,activeTab:d,onTabChange:c,defaultTab:u}),Y=(0,s.useCallback)(e=>{e.ref&&("mcp-server"===e.kind?r?.(e.ref):"skill"===e.kind&&a?.(e.ref))},[r,a]),K=(0,s.useRef)(i);K.current=i,(0,s.useEffect)(()=>{A?.metadata?.name&&K.current?.({name:A.metadata.name,id:A.metadata.id})},[A]);let G=(0,b.useManageAccess)({resource:A?.metadata?{kind:f.ApiResourceKind.agent,kindString:"agent",id:A.metadata.id,org:A.metadata.org,name:A.metadata.name}:null,visibility:A?.metadata?{kind:"agent",current:A.metadata.visibility,org:A.metadata.org,onChanged:E}:void 0});if(R)return(0,t.jsx)(sU,{className:S});if(M)return(0,t.jsx)(tg.ErrorMessage,{error:M,retry:E,className:S});if(!A)return(0,t.jsx)(sW,{className:S});let X=A.metadata,J=A.spec,Z=A.status?.audit?.specAudit,Q=X?.org||e,et={name:X?.name||X?.slug||"Untitled",id:X?.id||"",org:X?.org,slug:X?.slug,description:void 0,iconUrl:L?void 0:J?.iconUrl,icon:L?(0,t.jsx)(sd.InlineEditImage,{value:J?.iconUrl??"",onSave:e=>P("iconUrl",e||void 0),isSaving:O,fallback:(0,t.jsx)(s_,{className:"stg:size-6 stg:text-muted-foreground"}),disabled:!L}):J?.iconUrl?void 0:(0,t.jsx)(s_,{className:"stg:size-6 stg:text-muted-foreground"}),createdAt:Z?.createdAt?(0,I.timestampDate)(Z.createdAt):null,updatedAt:Z?.updatedAt?(0,I.timestampDate)(Z.updatedAt):null},es=X?(0,t.jsx)(td.VisibilityBadge,{visibility:X.visibility,onClick:G.action?G.open:void 0}):void 0,en=[...o??[],...[{id:"share",label:"Share",group:"sharing",onAction:()=>V(sE.id)},G.action].filter(e=>null!=e)];return w=q?q.content:"instances"===H?(0,t.jsx)(sk,{agentId:X?.id??"",defaultInstanceId:A.status?.defaultInstanceId,org:e,viewerOrg:p,onCreateClick:v,onInstanceClick:j,onStartSessionClick:y,onDeleteClick:k,refreshKey:N}):"shares"===H?(0,t.jsx)(t0,{agent:A,buildShareUrl:x}):"dependencies"===H&&U?(0,t.jsx)(sl,{tree:U,onNodeClick:Y}):(0,t.jsx)(sL,{spec:J,agentOrg:Q,description:J?.description,onMcpServerClick:r,onSkillClick:a,editable:L,isSaving:O,saveField:P,saveError:D,clearSaveError:B}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(t8.ResourceDetailShell,{header:et,visibilityControl:es,headerBanner:(0,t.jsx)(sw.ManagedByPluginNotice,{plugin:T.plugin,onPluginClick:C}),primaryAction:l,actions:en,tabs:F,activeTab:F?H:void 0,onTabChange:F?V:void 0,tabsAriaLabel:"Agent detail sections",className:S,children:w}),G.dialog]})}function sL({spec:e,agentOrg:n,description:r,onMcpServerClick:a,onSkillClick:i,editable:l,isSaving:o,saveField:g,saveError:d,clearSaveError:c}){let u=e=>d?.field===e?d.message:void 0,m=(0,s.useCallback)(async e=>g?.("instructions",e||void 0)??!1,[g]),h=(0,s.useCallback)(async e=>g?.("mcpServerUsages",e.map(e=>({mcpServerRef:{org:e.org,slug:e.slug}})))??!1,[g]),x=(0,s.useCallback)(async e=>g?.("skillRefs",e.map(e=>({org:e.org,slug:e.slug})))??!1,[g]),p=(0,s.useCallback)(async e=>{let t={};for(let s of e)s.key.trim()&&(t[s.key.trim()]={isSecret:s.isSecret||void 0,description:s.description||void 0,optional:s.optional||void 0});return g?.("env",Object.keys(t).length>0?t:void 0)??!1},[g]),f=(0,s.useMemo)(()=>(e?.mcpServerUsages??[]).map(e=>({org:e.mcpServerRef?.org||n,slug:e.mcpServerRef?.slug??"",label:e.mcpServerRef?.org&&e.mcpServerRef.org!==n?`${e.mcpServerRef.org}/${e.mcpServerRef.slug}`:e.mcpServerRef?.slug??""})),[e?.mcpServerUsages,n]),b=(0,s.useMemo)(()=>(e?.skillRefs??[]).map(e=>({org:e.org||n,slug:e.slug,label:e.org&&e.org!==n?`${e.org}/${e.slug}`:e.slug})),[e?.skillRefs,n]),v=(0,s.useMemo)(()=>Object.entries(e?.env??{}).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({key:e,value:"",isSecret:t.isSecret,description:t.description,optional:t.optional})),[e?.env]),j=l||!!r,y=l||!!e?.instructions,k=l||e&&e.mcpServerUsages.length>0,N=l||e&&e.skillRefs.length>0,C=l||e&&e.subAgents.length>0,S=l||e?.env&&Object.keys(e.env).length>0,[w,A]=(0,s.useState)(!1),[R,M]=(0,s.useState)(!1),[E,I]=(0,s.useState)(!1),T=(0,s.useCallback)(e=>{e&&c?.(),A(e)},[c]),L=(0,s.useCallback)(e=>{e&&c?.(),M(e)},[c]),$=(0,s.useCallback)(e=>{e&&c?.(),I(e)},[c]);return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-6",children:[j&&(0,t.jsx)(t9.Section,{title:"Description",children:l?(0,t.jsx)("div",{className:"stg:max-h-20 stg:overflow-y-auto stg:p-3",children:(0,t.jsx)(sg.InlineEditTextarea,{value:e?.description||"",onSave:e=>g?.("description",e||void 0)??Promise.resolve(!1),isSaving:o,error:u("description"),placeholder:"Add a description",minRows:2})}):(0,t.jsx)("div",{className:"stg:p-3",children:(0,t.jsx)("pre",{className:"stg:whitespace-pre-wrap stg:break-words stg:text-sm stg:text-foreground stg:font-sans",children:r})})}),y&&(0,t.jsx)(t9.Section,{title:"Instructions",children:l?(0,t.jsx)("div",{className:"stg:max-h-72 stg:overflow-y-auto stg:p-3",children:(0,t.jsx)(sg.InlineEditTextarea,{value:e?.instructions??"",onSave:m,isSaving:o,error:u("instructions"),placeholder:"Add instructions for the agent",minRows:4})}):(0,t.jsx)(s$,{text:e?.instructions??""})}),k&&(0,t.jsx)(t9.Section,{title:"MCP Servers",count:e?.mcpServerUsages.length,onEdit:l?()=>T(!w):void 0,children:l?(0,t.jsx)(su,{value:f,onSave:h,isSaving:o,error:u("mcpServerUsages"),editing:w,onEditingChange:T,onItemClick:a?e=>a({org:e.org,slug:e.slug}):void 0,itemIcon:(0,t.jsx)(sF,{className:"stg:size-4"}),resourceLabel:"MCP server",defaultOrg:n}):(0,t.jsx)(sO,{usages:e?.mcpServerUsages??[],defaultOrg:n,onMcpServerClick:a})}),N&&(0,t.jsx)(t9.Section,{title:"Skills",count:e?.skillRefs.length,onEdit:l?()=>L(!R):void 0,children:l?(0,t.jsx)(su,{value:b,onSave:x,isSaving:o,error:u("skillRefs"),editing:R,onEditingChange:L,onItemClick:i?e=>i({org:e.org,slug:e.slug}):void 0,itemIcon:(0,t.jsx)(sH,{className:"stg:size-4"}),resourceLabel:"skill",defaultOrg:n}):(0,t.jsx)(sD,{refs:e?.skillRefs??[],defaultOrg:n,onSkillClick:i})}),C&&(0,t.jsx)(sz,{subAgents:e?.subAgents??[],editable:l,isSaving:o,error:u("subAgents"),onSave:e=>g?.("subAgents",e.length>0?e:void 0)??Promise.resolve(!1)}),S&&(0,t.jsx)(t9.Section,{title:"Environment Variables",count:Object.keys(e?.env??{}).length,onEdit:l?()=>$(!E):void 0,children:l?(0,t.jsx)(sc.InlineEditKeyValue,{value:v,onSave:p,isSaving:o,error:u("env"),editing:E,onEditingChange:$,showSecretToggle:!0,showOptionalToggle:!0,showDescription:!0,keyLabel:"Variable name"}):(0,t.jsx)(sB,{data:e?.env??{}})})]})}function s$({text:e}){let[n,r]=(0,s.useState)(!1),a=(0,s.useRef)(null),[i,l]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e=a.current;e&&l(e.scrollHeight>e.clientHeight)},[e]),(0,t.jsxs)("div",{className:"stg:relative stg:p-3",children:[(0,t.jsx)("pre",{ref:a,className:(0,h.cn)("stg:whitespace-pre-wrap stg:break-words stg:font-mono stg:text-sm stg:text-foreground stg:overflow-y-auto stg:transition-[max-height] stg:duration-200",!n&&"stg:overflow-hidden"),style:{maxHeight:n?"none":"12rem"},children:e}),!n&&i&&(0,t.jsx)("div",{className:"stg:pointer-events-none stg:absolute stg:inset-x-3 stg:bottom-10 stg:h-8 stg:bg-gradient-to-t stg:from-background stg:to-transparent"}),i&&(0,t.jsx)("button",{type:"button",onClick:()=>r(e=>!e),className:"stg:mt-2 stg:text-xs stg:font-medium stg:text-primary stg:transition-colors stg:hover:text-primary-muted",children:n?"Show less":"Show more"})]})}function sO({usages:e,defaultOrg:s,onMcpServerClick:n}){return(0,t.jsx)("div",{className:"stg:flex stg:flex-col",children:e.map((e,r)=>{let a=e.mcpServerRef;if(!a)return null;let i=a.org||s,l=a.org&&a.org!==s?`${a.org}/${a.slug}`:a.slug,o=e.enabledTools.length,g=e.toolApprovalOverrides.length,d=[o>0?`${o} ${1===o?"tool":"tools"}`:"all tools",g>0?`${g} approval ${1===g?"override":"overrides"}`:""].filter(Boolean).join(" · "),c=(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-3",children:[(0,t.jsx)(sF,{className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground"}),(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:l}),(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:d})]});return n?(0,t.jsx)("button",{type:"button",onClick:()=>n({org:i,slug:a.slug}),className:(0,h.cn)("stg:w-full stg:rounded-md stg:px-3 stg:py-2 stg:text-left stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:c},a.slug||r):(0,t.jsx)("div",{className:"stg:px-3 stg:py-2",children:c},a.slug||r)})})}function sD({refs:e,defaultOrg:s,onSkillClick:n}){return(0,t.jsx)("div",{className:"stg:flex stg:flex-col",children:e.map((e,r)=>{let a=e.org||s,i=e.org&&e.org!==s?`${e.org}/${e.slug}`:e.slug,l=(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-3",children:[(0,t.jsx)(sH,{className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground"}),(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:i})]});return n?(0,t.jsx)("button",{type:"button",onClick:()=>n({org:a,slug:e.slug}),className:(0,h.cn)("stg:w-full stg:rounded-md stg:px-3 stg:py-2 stg:text-left stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:l},e.slug||r):(0,t.jsx)("div",{className:"stg:px-3 stg:py-2",children:l},e.slug||r)})})}function sz({subAgents:e,editable:n,isSaving:r,error:a,onSave:i}){let[l,o]=(0,s.useState)(new Set),[g,d]=(0,s.useState)(!1),[c,u]=(0,s.useState)(!1),[m,x]=(0,s.useState)({name:"",description:"",instructions:""}),p=(0,s.useCallback)(async t=>{if(!i)return;let s=e.filter((e,s)=>s!==t).map(e=>({name:e.name,description:e.description||void 0,instructions:e.instructions||void 0,mcpAccess:e.mcpAccess.length>0?e.mcpAccess.map(e=>({mcpServer:e.mcpServer,enabledTools:e.enabledTools.length>0?[...e.enabledTools]:void 0})):void 0,skillRefs:e.skillRefs.length>0?e.skillRefs.map(e=>({org:e.org||"",slug:e.slug})):void 0,modelOverride:e.modelOverride||void 0}));await i(s)},[e,i]),f=(0,s.useCallback)(async()=>{if(!i||!m.name.trim())return;let t=e.map(e=>({name:e.name,description:e.description||void 0,instructions:e.instructions||void 0,mcpAccess:e.mcpAccess.length>0?e.mcpAccess.map(e=>({mcpServer:e.mcpServer,enabledTools:e.enabledTools.length>0?[...e.enabledTools]:void 0})):void 0,skillRefs:e.skillRefs.length>0?e.skillRefs.map(e=>({org:e.org||"",slug:e.slug})):void 0,modelOverride:e.modelOverride||void 0})),s={name:m.name.trim(),description:m.description.trim()||void 0,instructions:m.instructions.trim()||void 0};await i([...t,s])&&(x({name:"",description:"",instructions:""}),u(!1))},[e,m,i]);return(0,t.jsx)(t9.Section,{title:"Sub-Agents",count:e.length,onEdit:n?()=>d(e=>!e):void 0,children:(0,t.jsxs)("div",{className:"stg:flex stg:flex-col",children:[e.length>0?(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:divide-y stg:divide-border",children:e.map((e,s)=>{let n=l.has(s);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-3 stg:px-3 stg:py-2.5",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{o(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},"aria-expanded":n,className:(0,h.cn)("stg:flex stg:flex-1 stg:items-start stg:gap-3 stg:text-left","stg:focus-visible:outline-none"),children:[(0,t.jsx)(sV,{className:(0,h.cn)("stg:mt-0.5 stg:size-4 stg:shrink-0 stg:text-muted-foreground stg:transition-transform",n&&"stg:rotate-90")}),(0,t.jsxs)("div",{className:"stg:min-w-0 stg:flex-1",children:[(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:e.name}),e.description&&(0,t.jsx)("p",{className:"stg:mt-0.5 stg:text-xs stg:text-muted-foreground",children:e.description})]})]}),g&&(0,t.jsx)("button",{type:"button",onClick:()=>p(s),disabled:r,"aria-label":`Remove ${e.name}`,className:(0,h.cn)("stg:mt-0.5 stg:inline-flex stg:size-6 stg:items-center stg:justify-center stg:rounded-md stg:text-muted-foreground","stg:hover:bg-destructive-subtle stg:hover:text-destructive","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:(0,t.jsx)(sq,{className:"stg:size-3.5"})})]}),n&&(0,t.jsx)(sP,{subAgent:e})]},e.name||s)})}):(0,t.jsx)("p",{className:"stg:px-3 stg:py-3 stg:text-xs stg:text-muted-foreground stg:italic",children:"No sub-agents configured"}),n&&g&&!c&&(0,t.jsx)("div",{className:"stg:border-t stg:border-border stg:px-3 stg:py-2",children:(0,t.jsxs)("button",{type:"button",onClick:()=>u(!0),className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-xs stg:font-medium","stg:border stg:border-dashed stg:border-border stg:text-muted-foreground","stg:hover:border-muted-foreground stg:hover:text-foreground stg:hover:bg-muted-subtle","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:transition-colors"),children:[(0,t.jsx)(sY,{className:"stg:size-3"}),"Add sub-agent"]})}),a&&(0,t.jsx)("p",{className:"stg:border-t stg:border-border stg:px-3 stg:py-2 stg:text-xs stg:text-destructive",role:"alert",children:a}),n&&c&&(0,t.jsxs)("div",{className:"stg:border-t stg:border-border stg:p-3 stg:space-y-2",children:[(0,t.jsx)("input",{type:"text",value:m.name,onChange:e=>x(t=>({...t,name:e.target.value})),placeholder:"Sub-agent name (required)",className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:text-sm stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsx)("input",{type:"text",value:m.description,onChange:e=>x(t=>({...t,description:e.target.value})),placeholder:"Description (optional)",className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsx)("textarea",{value:m.instructions,onChange:e=>x(t=>({...t,instructions:e.target.value})),placeholder:"Instructions (optional)",rows:2,className:(0,h.cn)("stg:w-full stg:resize-y stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:font-mono stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-end stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{u(!1),x({name:"",description:"",instructions:""})},className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:border stg:border-border stg:bg-background stg:text-foreground stg:hover:bg-accent","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Cancel"}),(0,t.jsx)("button",{type:"button",onClick:f,disabled:!m.name.trim()||r,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:disabled:opacity-50","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Add"})]})]})]})})}function sP({subAgent:e}){return(0,t.jsxs)("div",{className:"stg:mb-1 stg:ml-7 stg:space-y-3 stg:border-l stg:border-border stg:pl-4 stg:pt-1",children:[e.instructions&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"stg:mb-1 stg:text-xs stg:font-medium stg:text-muted-foreground",children:"Instructions"}),(0,t.jsx)("pre",{className:"stg:whitespace-pre-wrap stg:break-words stg:rounded-md stg:bg-muted-subtle stg:p-2 stg:font-mono stg:text-xs stg:text-foreground",children:e.instructions})]}),e.mcpAccess.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"stg:mb-1 stg:text-xs stg:font-medium stg:text-muted-foreground",children:"MCP Access"}),(0,t.jsx)("div",{className:"stg:space-y-1",children:e.mcpAccess.map(e=>(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:text-xs stg:text-foreground",children:[(0,t.jsx)(sF,{className:"stg:size-3 stg:shrink-0 stg:text-muted-foreground"}),(0,t.jsx)("span",{className:"stg:font-medium",children:e.mcpServer}),(0,t.jsx)("span",{className:"stg:text-muted-foreground",children:e.enabledTools.length>0?`${e.enabledTools.length} ${1===e.enabledTools.length?"tool":"tools"}`:"all tools"})]},e.mcpServer))})]}),e.skillRefs.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"stg:mb-1 stg:text-xs stg:font-medium stg:text-muted-foreground",children:"Skills"}),(0,t.jsx)("div",{className:"stg:space-y-1",children:e.skillRefs.map(e=>(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:text-xs stg:text-foreground",children:[(0,t.jsx)(sH,{className:"stg:size-3 stg:shrink-0 stg:text-muted-foreground"}),(0,t.jsx)("span",{children:e.org?`${e.org}/${e.slug}`:e.slug})]},e.slug))})]}),e.modelOverride&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"stg:mb-1 stg:text-xs stg:font-medium stg:text-muted-foreground",children:"Model Override"}),(0,t.jsx)("span",{className:"stg:rounded stg:bg-muted stg:px-1.5 stg:py-0.5 stg:font-mono stg:text-xs stg:text-foreground",children:e.modelOverride})]})]})}function sB({data:e}){let s=Object.entries(e).sort(([e],[t])=>e.localeCompare(t));return(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:divide-y stg:divide-border",children:s.map(([e,s])=>(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-3 stg:px-3 stg:py-2",children:[(0,t.jsx)("code",{className:"stg:shrink-0 stg:font-mono stg:text-sm stg:font-medium stg:text-foreground",children:e}),(0,t.jsx)("span",{className:"stg:shrink-0 stg:rounded stg:bg-muted stg:px-1.5 stg:py-0.5 stg:text-[10px] stg:font-medium stg:text-muted-foreground",children:s.isSecret?"secret":"config"}),s.description&&(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:s.description})]},e))})}function sU({className:e}){return(0,t.jsxs)("div",{className:(0,h.cn)("stg:flex stg:flex-col stg:gap-6",e),"aria-busy":"true","aria-label":"Loading agent details",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-3",children:[(0,t.jsx)("div",{className:"stg:mt-1 stg:size-6 stg:shrink-0 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsxs)("div",{className:"stg:flex-1 stg:space-y-2",children:[(0,t.jsx)("div",{className:"stg:h-5 stg:w-48 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:h-3 stg:w-64 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:h-4 stg:w-full stg:max-w-md stg:animate-pulse stg:rounded stg:bg-muted"})]})]}),[40,24,16].map(e=>(0,t.jsxs)("div",{className:"stg:space-y-2",children:[(0,t.jsx)("div",{className:"stg:h-3 stg:w-24 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:animate-pulse stg:rounded-lg stg:border stg:border-border stg:bg-muted-faint",style:{height:`${4*e}px`}})]},e))]})}function sW({className:e}){return(0,t.jsxs)("div",{role:"status",className:(0,h.cn)("stg:flex stg:flex-col stg:items-center stg:gap-2 stg:py-12 stg:text-center",e),children:[(0,t.jsx)(s_,{className:"stg:size-10 stg:text-muted-foreground-faint"}),(0,t.jsx)("p",{className:"stg:text-sm stg:font-medium stg:text-muted-foreground",children:"Agent not found"}),(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground-subtle",children:"This agent doesn't exist or you don't have access to it."})]})}function s_({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"3",y:"5",width:"10",height:"8",rx:"1.5"}),(0,t.jsx)("path",{d:"M6 9h.01M10 9h.01",strokeWidth:"2"}),(0,t.jsx)("path",{d:"M8 2v3"})]})}function sF({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"2",y:"2",width:"12",height:"5",rx:"1"}),(0,t.jsx)("rect",{x:"2",y:"9",width:"12",height:"5",rx:"1"}),(0,t.jsx)("circle",{cx:"5",cy:"4.5",r:"0.75",fill:"currentColor",stroke:"none"}),(0,t.jsx)("circle",{cx:"5",cy:"11.5",r:"0.75",fill:"currentColor",stroke:"none"})]})}function sH({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M9 1.5 4 9h4l-1 5.5L12 7H8l1-5.5Z"})})}function sV({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m6 3 5 5-5 5"})})}function sq({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m4 4 8 8M12 4l-8 8"})})}function sY({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 3v10M3 8h10"})})}var sK=e.i(330815);function sG({open:e,onOpenChange:n,org:r,agentId:a,onCreated:i}){let{create:l,isCreating:o,error:g,clearError:d}=function(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>a(null),[]);return{create:(0,s.useCallback)(async t=>{n(!0),a(null);try{return await e.agentInstance.create(t)}catch(e){throw a((0,ee.toError)(e)),e}finally{n(!1)}},[e]),isCreating:t,error:r,clearError:i}}(),c=(0,s.useId)(),u=`${c}-title`,m=`${c}-name`,p=`${c}-description`,[f,b]=(0,s.useState)(""),[v,j]=(0,s.useState)(""),[y,k]=(0,s.useState)([]),[N,C]=(0,s.useState)(q.ApiResourceVisibility.visibility_private),S=(0,s.useCallback)(()=>{b(""),j(""),k([]),C(q.ApiResourceVisibility.visibility_private),d()},[d]),w=(0,s.useCallback)(()=>{n(!1),S()},[n,S]),A=(0,s.useCallback)(e=>{e||w()},[w]),R=(0,s.useCallback)(async e=>{if(e.preventDefault(),f.trim())try{let e=await l({name:f.trim(),org:r,agentId:a,description:v.trim()||void 0,environmentRefs:y.length>0?y:void 0,visibility:N});i?.(e),w()}catch{}},[f,r,a,v,y,N,l,i,w]);return(0,t.jsx)($.DialogShell,{open:e,onOpenChange:A,width:"lg","aria-labelledby":u,children:(0,t.jsxs)("form",{onSubmit:R,className:"stg:flex stg:flex-col",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between stg:border-b stg:border-border stg:px-6 stg:py-4",children:[(0,t.jsx)("h2",{id:u,className:"stg:text-base stg:font-semibold stg:text-foreground",children:"Create Agent Instance"}),(0,t.jsx)("button",{type:"button",onClick:w,"aria-label":"Close",className:(0,h.cn)("stg:rounded-md stg:p-1 stg:text-muted-foreground","stg:hover:text-foreground stg:hover:bg-accent-hover","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring"),children:(0,t.jsx)(sX,{})})]}),(0,t.jsxs)("div",{className:"stg:space-y-5 stg:px-6 stg:py-5",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{htmlFor:m,className:"stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5",children:["Name ",(0,t.jsx)("span",{className:"stg:text-destructive",children:"*"})]}),(0,t.jsx)("input",{id:m,type:"text",required:!0,value:f,onChange:e=>b(e.target.value),placeholder:"e.g. prod, staging, qa-team",disabled:o,className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-background stg:px-3 stg:py-2 stg:text-sm","stg:text-foreground stg:placeholder:text-muted-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring","stg:disabled:cursor-not-allowed stg:disabled:opacity-50"),autoFocus:!0}),(0,t.jsx)("p",{className:"stg:mt-1 stg:text-[0.65rem] stg:text-muted-foreground",children:"A URL-friendly slug will be generated from this name."})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{htmlFor:p,className:"stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5",children:"Description"}),(0,t.jsx)("textarea",{id:p,value:v,onChange:e=>j(e.target.value),placeholder:"What is this instance used for?",disabled:o,rows:2,className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-background stg:px-3 stg:py-2 stg:text-sm stg:resize-none","stg:text-foreground stg:placeholder:text-muted-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring","stg:disabled:cursor-not-allowed stg:disabled:opacity-50")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5",children:"Environments"}),(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground stg:mb-2",children:"Bind credentials and configuration to this instance."}),(0,t.jsx)(Y.EnvironmentPicker,{org:r,value:y,onChange:k,disabled:o})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5",children:"Visibility"}),(0,t.jsx)(sK.InstanceVisibilitySelector,{visibility:N,onVisibilityChange:C,mode:"create",disabled:o})]}),g&&(0,t.jsx)("div",{className:"stg:rounded-md stg:bg-destructive/10 stg:px-3 stg:py-2 stg:text-sm stg:text-destructive",role:"alert",children:(0,x.getUserMessage)(g)})]}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-end stg:gap-2 stg:border-t stg:border-border stg:px-6 stg:py-4",children:[(0,t.jsx)("button",{type:"button",onClick:w,disabled:o,className:(0,h.cn)("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium","stg:text-foreground stg:hover:bg-accent-hover","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring","stg:disabled:cursor-not-allowed stg:disabled:opacity-50"),children:"Cancel"}),(0,t.jsx)("button",{type:"submit",disabled:o||!f.trim(),className:(0,h.cn)("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium","stg:bg-primary stg:text-primary-foreground","stg:hover:bg-primary/90","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring stg:focus:ring-offset-2","stg:disabled:cursor-not-allowed stg:disabled:opacity-50"),children:o?"Creating...":"Create Instance"})]})]})})}function sX(){return(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}var sJ=e.i(582321),sZ=e.i(352371),sQ=e.i(310057),s0=e.i(297629),s1=e.i(451241),s2=e.i(107141),s5=e.i(336095),s3=e.i(472402);function s4({org:e,slug:a}){let i=(0,n.useRouter)(),{setLabel:l}=(0,sQ.useBreadcrumbOverride)(),o=(0,s0.useActiveOrgSlug)(),{navigateToDetail:g}=(0,s1.useLibraryNavigation)(),[d,c]=(0,s.useState)(null),[u,m]=(0,s.useState)("Agent"),{copyId:h,copyQualifiedSlug:x}=(0,tp.useCopyResource)(),{confirmState:p,confirm:f,handleConfirm:b,handleCancel:v}=(0,w.useConfirmAction)(),{deleteResource:j,isDeleting:y}=(0,sJ.useDeleteResource)("agent",d,u),{deleteInstance:k}=function(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>a(null),[]);return{deleteInstance:(0,s.useCallback)(async t=>{n(!0),a(null);try{return await e.agentInstance.delete(t)}catch(e){throw a((0,ee.toError)(e)),e}finally{n(!1)}},[e]),isDeleting:t,error:r,clearError:i}}(),{agent:N,refetch:C}=(0,ti.useAgent)(e,a),{copyYaml:R,copyJson:M,downloadYaml:E}=(0,sZ.useExportResource)({kind:"Agent",resource:N}),[I,T]=(0,s.useState)(!1),[L,$]=(0,s.useState)(!1),[O,D]=(0,s.useState)(0),[z,P]=(0,s.useState)(()=>new URLSearchParams(window.location.search).get("tab")??void 0??"overview"),B=(0,s.useMemo)(()=>N?[{id:"channels",label:"Channels",content:(0,t.jsx)(e7,{agent:N,channelAppsHref:"/settings/channel-apps",sessionHref:e=>`/sessions/${e}`})}]:[],[N]);(0,s.useEffect)(()=>()=>l(null),[l]);let W=(0,s.useCallback)(({name:e,id:t})=>{l(e),c(t),m(e)},[l]),_=(0,s.useCallback)(async()=>{if(await f({title:`Delete ${u}?`,description:"This permanently removes the agent and all of its instances. Past sessions and executions are preserved. This action cannot be undone.",confirmLabel:"Delete",variant:"destructive"}))try{await j(),i.push("/library/agents")}catch{}},[f,j,i,u]),F=(0,s.useMemo)(()=>({id:"start-session",label:"Start session",onAction:()=>i.push((0,s5.getAgentSessionUrl)(e,a))}),[i,e,a]),H=(0,s.useCallback)((e,t)=>`${(0,s3.getAppBaseUrl)()}/chat/${e}/${t}`,[]),V=(0,s.useCallback)(t=>{let s=t.metadata?.id;i.push((0,s5.getAgentSessionUrl)(e,a,s))},[i,e,a]),q=(0,s.useCallback)(async e=>{let t=e.metadata?.name||e.metadata?.slug||"this instance";if(!await f({title:`Delete ${t}?`,description:"This permanently removes the instance and its environment bindings. Sessions already started against it are preserved. This action cannot be undone.",confirmLabel:"Delete",variant:"destructive"}))return;let s=e.metadata?.id;if(s)try{await k(s),r.toast.success("Instance deleted"),D(e=>e+1)}catch{r.toast.error("Failed to delete instance")}},[f,k]),Y=(0,s.useMemo)(()=>[{id:"copy-id",label:"Copy ID",group:"clipboard",onAction:()=>{d&&h(d)},disabled:!d},{id:"copy-slug",label:"Copy slug",group:"clipboard",onAction:()=>x(e,a)},{id:"edit-yaml",label:"Edit YAML",group:"export",onAction:()=>T(!0),disabled:!N},{id:"export-yaml",label:"Export YAML",group:"export",onAction:R,disabled:!N},{id:"export-json",label:"Export JSON",group:"export",onAction:M,disabled:!N},{id:"download-yaml",label:"Download YAML",group:"export",onAction:E,disabled:!N},{id:"delete",label:"Delete",variant:"destructive",group:"danger",onAction:_,disabled:y}],[d,h,x,e,a,R,M,E,N,_,y]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(sT,{org:e,slug:a,onResourceLoad:W,onMcpServerClick:({org:e,slug:t})=>g("mcp-servers",e,t),onSkillClick:({org:e,slug:t})=>g("skills",e,t),onPluginClick:({org:e,slug:t})=>g("plugins",e,t),editable:!0,primaryAction:F,actions:Y,buildShareUrl:H,viewerOrg:o,additionalTabs:B,activeTab:z,onTabChange:P,onCreateInstanceClick:()=>$(!0),onInstanceStartSessionClick:V,onInstanceDeleteClick:q,instancesRefreshKey:O}),(0,t.jsx)(A.EditResourceYamlDialog,{open:I,onOpenChange:T,resource:N,onApplied:C}),(0,t.jsx)(S.ConfirmDialog,{state:p,onConfirm:b,onCancel:v}),d&&(0,t.jsx)(sG,{open:L,onOpenChange:$,org:e,agentId:d,onCreated:()=>{r.toast.success("Instance created"),D(e=>e+1)}})]})}e.s(["AgentDetailPage",0,function(){let e=(0,s1.useRouteDetailYieldsToOverlay)(),s=(0,s2.useStaticRouteParam)("org",2),n=(0,s2.useStaticRouteParam)("slug");return!e&&s&&n?(0,t.jsx)(s4,{org:s,slug:n}):null},"AgentDetailPageInner",0,s4],63353)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,261716,e=>{"use strict";var s=e.i(843476),t=e.i(271645),a=e.i(610413),r=e.i(107233),n=e.i(893976),i=e.i(610595),l=e.i(910304),o=e.i(283416),c=e.i(65642),d=e.i(170255),g=e.i(597744),u=e.i(311015),m=e.i(630983),h=e.i(266442),x=e.i(17616),p=e.i(937111);let f={[o.LicenseTerm.trial]:"Trial",[o.LicenseTerm.paid]:"Paid"},b={[p.Feature.sso_enforcement]:{label:"SSO enforcement",description:"Require members to sign in through a registered identity provider."},[p.Feature.byo_provider_keys]:{label:"Bring your own provider keys",description:"Use the customer's own LLM provider keys instead of the metered proxy."},[p.Feature.channels]:{label:"Channels",description:"Deliver agents over messaging channels through a channel runtime."},[p.Feature.sharing]:{label:"Sharing",description:"Share agents with individuals and guests through hosted links."}},j=Object.keys(b).map(Number).sort((e,s)=>e-s);function v(e){return e in b}let N=new Intl.RelativeTimeFormat("en",{numeric:"auto"});function y(e){return e===o.LicenseTerm.trial||e===o.LicenseTerm.paid?f[e]:"Unknown term"}function w(e){return e?(0,x.timestampDate)(e):void 0}function k(e){return e.toISOString().slice(0,10)}function S(e){return k(new Date(e.getTime()-1))}function C(e){return Date.parse(`${e}T00:00:00Z`)}function T(e){return`${e.toISOString().slice(0,16).replace("T"," ")} UTC`}function L(e,s){let t=Math.round((C(e)-C(k(s)))/864e5);return 60>Math.abs(t)?N.format(t,"day"):N.format(Math.round(t/30.44),"month")}function U(e,s){return void 0===e?`Unlimited ${s}s`:$(e,s)}function $(e,s){return`${e} ${s}${1===e?"":"s"}`}function E(e){return e.trim().replace(/\s+/g," ").toLowerCase()}function I(e){return w(e.status?.issuedAt)?.getTime()??-1/0}function A(e){return w(e.spec?.expiresAt)?.getTime()??-1/0}var z=e.i(766354),_=e.i(16715),B=e.i(188482),F=e.i(643531),M=e.i(174886),D=e.i(475254);let O=(0,D.default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),P=(0,D.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var R=e.i(162697),q=e.i(193799);let Y="stg:size-3.5";function G({ticket:e,isLoading:a,error:r,className:l}){let[o,d]=(0,t.useState)(!1),{copy:g,copied:u}=(0,q.useCopyFeedback)(),m=(0,t.useRef)(null),h=(0,t.useCallback)(async()=>{!e||await g(e)||(d(!0),requestAnimationFrame(()=>{m.current&&(0,R.selectElementText)(m.current)}))},[g,e]);return(0,s.jsxs)("section",{"aria-label":"Ticket",className:(0,n.cn)("stg:space-y-3 stg:rounded-lg stg:border stg:border-border stg:bg-card stg:p-4",l),children:[(0,s.jsxs)("div",{className:"stg:flex stg:flex-wrap stg:items-start stg:justify-between stg:gap-3",children:[(0,s.jsxs)("div",{className:"stg:min-w-0 stg:space-y-1",children:[(0,s.jsx)("h4",{className:"stg:m-0 stg:text-sm stg:font-semibold stg:text-foreground",children:"Ticket"}),(0,s.jsx)("p",{className:"stg:m-0 stg:text-sm stg:text-muted-foreground",children:"The signed key the customer installs on their server. Anyone holding it can run it as this customer, so send it only to their contact address."})]}),(0,s.jsxs)("div",{className:"stg:flex stg:shrink-0 stg:gap-2",children:[(0,s.jsx)(c.Button,{variant:"outline",className:"stg:w-28 stg:justify-center",disabled:!e,"aria-pressed":o,icon:o?(0,s.jsx)(P,{className:Y,"aria-hidden":"true"}):(0,s.jsx)(O,{className:Y,"aria-hidden":"true"}),onClick:()=>d(e=>!e),children:o?"Hide ticket":"Show ticket"}),(0,s.jsx)(c.Button,{className:"stg:w-28 stg:justify-center",disabled:!e,icon:u?(0,s.jsx)(F.Check,{className:Y,"aria-hidden":"true"}):(0,s.jsx)(M.Copy,{className:Y,"aria-hidden":"true"}),onClick:()=>void h(),children:u?"Copied":"Copy ticket"})]})]}),a&&(0,s.jsx)("p",{className:"stg:m-0 stg:text-sm stg:text-muted-foreground","aria-busy":"true",children:"Reading the ticket…"}),r&&(0,s.jsx)("p",{className:"stg:m-0 stg:text-sm stg:text-destructive",role:"alert",children:(0,i.getUserMessage)(r)}),o&&e&&(0,s.jsx)("code",{ref:m,className:(0,n.cn)("stg:block stg:max-h-40 stg:overflow-y-auto stg:break-all stg:select-all stg:rounded-md","stg:border stg:border-input stg:bg-background stg:px-2.5 stg:py-1.5","stg:font-mono stg:text-xs stg:text-foreground"),children:e}),(0,s.jsx)("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"stg:sr-only",children:u&&"Ticket copied to clipboard"})]})}var K=e.i(586108),V=e.i(583093);let W="stg:size-3.5";function H({license:e,issued:a,standing:r,now:i,onBack:l,onRenew:o,className:d}){let g=e.metadata?.id??"",u=a?.status?.ticket,m=function(e,s){let a=(0,K.useStigmer)(),r=(s?.enabled??!0)&&""!==e,{data:n,isLoading:i,error:l,refetch:o}=(0,V.useFetch)(r?()=>a.license.get(e):null,[r,e,a],null);return(0,t.useMemo)(()=>({license:n,isLoading:i,error:l,refetch:o}),[n,i,l,o])}(g,{enabled:!u}),x=u??m.license?.status?.ticket??null,p=e.spec,f=p?.customer,j=p?.entitlements?.limits,N=(p?.entitlements?.features??[]).filter(v),k=w(p?.expiresAt),C=w(p?.graceUntil),U=w(e.status?.issuedAt),$=e.status?.audit?.specAudit?.createdBy,E=k&&C&&C.getTime()>k.getTime()?C:void 0,I=k?S(k):void 0;return(0,s.jsxs)("div",{className:(0,n.cn)("stg:space-y-4",d),children:[(0,s.jsxs)("div",{className:"stg:space-y-2",children:[(0,s.jsx)(c.Button,{variant:"ghost",size:"xs",icon:(0,s.jsx)(z.ArrowLeft,{className:W,"aria-hidden":"true"}),onClick:l,children:"Licenses"}),(0,s.jsxs)("div",{className:"stg:flex stg:flex-wrap stg:items-start stg:justify-between stg:gap-2",children:[(0,s.jsxs)("div",{className:"stg:min-w-0",children:[(0,s.jsx)("h3",{className:"stg:m-0 stg:truncate stg:text-base stg:font-semibold stg:text-foreground",children:f?.displayName??"Unknown customer"}),(0,s.jsxs)("p",{className:"stg:m-0 stg:mt-1 stg:flex stg:flex-wrap stg:items-center stg:gap-x-2 stg:gap-y-1 stg:text-sm stg:text-muted-foreground",children:[r&&(0,s.jsx)(h.StatusBadge,{phase:r.phase,label:r.label,tooltip:r.reason}),(0,s.jsxs)("span",{children:[`${p?y(p.term):"Unknown term"} \xb7 covered through ${I??"an unknown day"}`,I&&` (${L(I,i)})`]})]})]}),o&&(0,s.jsx)(c.Button,{variant:"outline",icon:(0,s.jsx)(_.RefreshCw,{className:W,"aria-hidden":"true"}),onClick:o,children:"Renew"})]})]}),a&&(0,s.jsxs)("p",{className:"stg:m-0 stg:rounded-md stg:border stg:border-border stg:bg-muted-subtle stg:px-3 stg:py-2 stg:text-sm stg:text-foreground",role:"status",children:["License issued and signed. Copy the ticket below and send it to"," ",f?.contactEmail||"the customer","."]}),(0,s.jsx)(G,{ticket:x,isLoading:!u&&m.isLoading,error:m.error}),(0,s.jsxs)("dl",{className:"stg:m-0 stg:grid stg:grid-cols-1 stg:gap-x-6 stg:gap-y-4 stg:rounded-lg stg:border stg:border-border stg:bg-card stg:p-4 stg:sm:grid-cols-2",children:[(0,s.jsxs)(Z,{label:"Customer",children:[(0,s.jsx)("span",{className:"stg:block",children:f?.displayName}),(0,s.jsx)("span",{className:"stg:block stg:text-muted-foreground",children:f?.contactEmail}),f?.organization&&(0,s.jsx)("span",{className:"stg:block stg:text-muted-foreground",children:`Cloud organization ${f.organization}`})]}),(0,s.jsx)(Z,{label:"Term",children:p?y(p.term):"Unknown"}),(0,s.jsx)(Z,{label:"Covered through",children:k&&I?(0,s.jsx)(J,{date:k,children:`${I} (${L(I,i)})`}):"Unknown"}),(0,s.jsx)(Z,{label:"Grace",children:E?(0,s.jsx)(J,{date:E,children:`Through ${S(E)}`}):"None"}),(0,s.jsxs)(Z,{label:"Limits",children:[(0,s.jsx)("span",{className:"stg:block",children:j?.maxUsers!==void 0?`${j.maxUsers} users`:"Unlimited users"}),(0,s.jsx)("span",{className:"stg:block",children:j?.maxOrganizations!==void 0?`${j.maxOrganizations} organizations`:"Unlimited organizations"})]}),(0,s.jsx)(Z,{label:"Features",children:0===N.length?"None":N.map(e=>(0,s.jsx)("span",{className:"stg:block",children:b[e].label},e))}),(0,s.jsxs)(Z,{label:"Issued",children:[U?(0,s.jsx)(J,{date:U,children:T(U)}):"Unknown",$&&($.email||$.displayName)&&(0,s.jsx)("span",{className:"stg:block stg:text-muted-foreground",children:$.displayName&&$.email?`by ${$.displayName} (${$.email})`:`by ${$.displayName||$.email}`})]}),(0,s.jsx)(Z,{label:"Signing key",children:(0,s.jsx)("span",{className:"stg:font-mono",children:e.status?.keyId||"Unknown"})}),(0,s.jsxs)(Z,{label:"License",children:[(0,s.jsx)("span",{className:"stg:block",children:e.metadata?.name}),(0,s.jsx)("span",{className:"stg:block stg:font-mono stg:text-muted-foreground",children:g})]}),p?.notes&&(0,s.jsx)(Z,{label:"Notes",wide:!0,children:(0,s.jsx)("span",{className:"stg:whitespace-pre-wrap",children:p.notes})})]})]})}function Z({label:e,wide:t,children:a}){return(0,s.jsxs)("div",{className:(0,n.cn)("stg:min-w-0",t&&"stg:sm:col-span-2"),children:[(0,s.jsx)("dt",{className:"stg:text-xs stg:text-muted-foreground",children:e}),(0,s.jsx)("dd",{className:"stg:m-0 stg:mt-0.5 stg:break-words stg:text-sm stg:text-foreground",children:a})]})}function J({date:e,children:t}){return(0,s.jsxs)(B.Tooltip,{children:[(0,s.jsx)(B.TooltipTrigger,{render:(0,s.jsx)("span",{className:"stg:inline-flex"}),children:t}),(0,s.jsx)(B.TooltipContent,{side:"top",children:T(e)})]})}var Q=e.i(251634),X=e.i(565507),ee=e.i(494953),es=e.i(869803),et=e.i(933221),ea=e.i(891914);let er={[o.LicenseTerm.trial]:{days:30},[o.LicenseTerm.paid]:{years:1}},en={[o.LicenseTerm.trial]:0,[o.LicenseTerm.paid]:30};function ei(e,s,t){return`${f[e]} license for ${ed(s)} until ${t}`}function el(e){let s=e.trim();if(""===s)return{ok:!0,value:void 0};let t=Number(s);return!Number.isInteger(t)||t>0x7fffffff?{ok:!1,error:"Enter a whole number, or leave it empty for unlimited."}:{ok:!0,value:t}}let eo="0123456789abcdefghjkmnpqrstvwxyz";function ec(e,s){return k(new Date(C(e)+864e5*s))}function ed(e){return e.trim().replace(/\s+/g," ")}let eg="stg:size-3.5 stg:shrink-0 stg:cursor-pointer stg:accent-primary stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:focus-visible:ring-offset-1",eu={[o.LicenseTerm.trial]:"30 days",[o.LicenseTerm.paid]:"1 year"},em={"spec.customer.display_name":"Name the customer.","spec.customer.contact_email":"Enter the address renewal notices go to.","spec.entitlements.limits.max_users":"Enter at least 1, or leave it empty for unlimited.","spec.entitlements.limits.max_organizations":"Enter at least 1, or leave it empty for unlimited.","spec.notes":"Notes are limited to 4,096 characters."};function eh({customers:e,renewing:a,now:r,isSubmitting:d,submitError:g,onSubmit:u,onCancel:m,className:h}){var x,p,N,y;let T,L,$,I,A,_=(0,t.useId)(),B=a?.spec?.customer?.id??"",F=(N=a?.spec?.term)===o.LicenseTerm.trial||N===o.LicenseTerm.paid?N:void 0,[M,D]=(0,t.useState)(""!==B||e.length>0?"existing":"new"),[O,P]=(0,t.useState)(B),[R,q]=(0,t.useState)(""),[Y,G]=(0,t.useState)(""),[K,V]=(0,t.useState)(""),[W]=(0,t.useState)(()=>(function(e=Date.now(),s=e=>{globalThis.crypto.getRandomValues(e)}){let t="",a=e;for(let e=0;e<10;e+=1)t=eo.charAt(a%32)+t,a=Math.floor(a/32);let r=new Uint8Array(10);s(r);let n="",i=0,l=0;for(let e of r){for(i=i<<8|e,l+=8;l>=5;)n+=eo.charAt(i>>>l-5&31),l-=5;i&=(1<<l)-1}return`cus_${t}${n}`})()),[H,Z]=(0,t.useState)(F??o.LicenseTerm.trial),[J,ej]=(0,t.useState)(null),[ev,eN]=(0,t.useState)(()=>{let e,s;if(!a||void 0===F)return null;let t=(e=w(a.spec?.expiresAt),s=w(a.spec?.graceUntil),e&&s?Math.max(0,Math.round((s.getTime()-e.getTime())/864e5)):0);return t===en[F]?null:String(t)}),[ey,ew]=(0,t.useState)(eb(a?.spec?.entitlements?.limits?.maxUsers)),[ek,eS]=(0,t.useState)(eb(a?.spec?.entitlements?.limits?.maxOrganizations)),[eC,eT]=(0,t.useState)(()=>(a?.spec?.entitlements?.features??[]).filter(v)),[eL,eU]=(0,t.useState)(""),[e$,eE]=(0,t.useState)(!1),eI=k(r),eA=function(e,s){let t=k(e),a=w(s?.spec?.expiresAt);if(!a)return t;let r=ec(S(a),1);return r>t?r:t}(r,a),ez=J??function(e,s){let{days:t,years:a}=er[e],r=a?function(e,s){let[t,a,r]=e.split("-").map(Number);return k(new Date(Date.UTC(t+s,a-1,r)))}(s,a):ec(s,t??0);return ec(r,-1)}(H,eA),e_=ev??String(en[H]),eB=e.find(e=>e.customer.id===O),eF="existing"===M?eB&&{id:eB.customer.id,displayName:eB.customer.displayName,contactEmail:eB.customer.contactEmail,organization:eB.customer.organization}:{id:W,displayName:R,contactEmail:Y,organization:K},eM="new"===M?(L=E((x={displayName:R,contactEmail:Y}).displayName),$=E(x.contactEmail),""===L&&""===$?[]:e.filter(({customer:e})=>""!==L&&E(e.displayName)===L||""!==$&&E(e.contactEmail)===$)):[],eD=(I=Number(e_.trim()),""===e_.trim()||!Number.isInteger(I)||I<0||I>3650?{ok:!1,error:"Enter a whole number of days from 0 to 3650."}:{ok:!0,value:I}),eO=el(ey),eP=el(ek),eR=""===ez?"Choose the last day the license covers.":ez<k(r)?"The last covered day cannot be in the past.":null,eq=[];if(eF&&eD.ok&&eO.ok&&eP.ok&&null===eR){let e,s,t,a,r;s=new Date((e=new Date(C(ec((p={customer:eF,term:H,lastCoveredDay:ez,graceDays:eD.value,maxUsers:eO.value,maxOrganizations:eP.value,features:eC,notes:eL}).lastCoveredDay,1)))).getTime()+864e5*p.graceDays),t={...void 0!==p.maxUsers&&{maxUsers:p.maxUsers},...void 0!==p.maxOrganizations&&{maxOrganizations:p.maxOrganizations}},a=p.customer.organization?.trim(),r=p.notes.trim(),T={name:ei(p.term,p.customer.displayName,p.lastCoveredDay),org:"",customer:{id:p.customer.id,displayName:ed(p.customer.displayName),contactEmail:p.customer.contactEmail.trim(),...a?{organization:a}:{}},entitlements:{...Object.keys(t).length>0&&{limits:t},features:[...p.features]},term:p.term,expiresAt:e,graceUntil:s,...""!==r&&{notes:r}},eq=(0,ea.validateMessage)(ee.LicenseSchema,(0,X.buildLicenseProto)(T))}let eY=e=>{let s=eq.find(s=>(0,Q.pathToString)(s.field)===e);return s?em[e]??s.message:null},eG=(e,s)=>e||e$?s:null,eK=eq.filter(e=>!((0,Q.pathToString)(e.field)in em)),eV=void 0!==T&&0===eq.length,eW=eB?null!==eY("spec.customer.contact_email")||null!==eY("spec.customer.display_name")?"This customer's stored name or address does not pass validation. Issue to them as a new customer with corrected details.":null:"Choose a customer, or enter a new one.",eH=eF?.displayName.trim()?ei(H,eF.displayName,ez||eI):null;return(0,s.jsxs)("form",{className:(0,n.cn)("stg:max-w-xl stg:space-y-5",h),onSubmit:e=>{if(e.preventDefault(),!d){if(!eV||!T)return void eE(!0);u(T)}},noValidate:!0,"aria-labelledby":`${_}-title`,children:[(0,s.jsxs)("div",{className:"stg:space-y-2",children:[(0,s.jsx)(c.Button,{variant:"ghost",size:"xs",icon:(0,s.jsx)(z.ArrowLeft,{className:"stg:size-3.5","aria-hidden":"true"}),onClick:m,disabled:d,children:"Licenses"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{id:`${_}-title`,className:"stg:m-0 stg:text-base stg:font-semibold stg:text-foreground",children:a?"Renew license":"Issue license"}),(0,s.jsx)("p",{className:"stg:m-0 stg:mt-1 stg:text-sm stg:text-muted-foreground",children:a?"The renewal is a new license. Once it is issued, the calendar shows the current one as renewed.":"A license is final once issued. To change one, issue a new license; the calendar shows the old one as renewed."})]})]}),(0,s.jsxs)(ex,{title:"Customer",children:[a&&eB?(0,s.jsxs)("p",{className:"stg:m-0 stg:text-sm",children:[(0,s.jsx)("span",{className:"stg:block stg:text-foreground",children:eB.customer.displayName}),(0,s.jsx)("span",{className:"stg:block stg:text-muted-foreground",children:eB.customer.contactEmail})]}):null,e.length>0&&!a&&(0,s.jsxs)("fieldset",{className:(0,n.cn)(es.UNSTYLED_FIELDSET,"stg:flex stg:flex-wrap stg:gap-4"),children:[(0,s.jsx)("legend",{className:"stg:sr-only",children:"Customer"}),(0,s.jsx)(ep,{name:`${_}-mode`,checked:"existing"===M,onChange:()=>D("existing"),label:"Existing customer",disabled:d}),(0,s.jsx)(ep,{name:`${_}-mode`,checked:"new"===M,onChange:()=>D("new"),label:"New customer",disabled:d})]}),a?(0,s.jsx)(ef,{message:eW}):"existing"===M?(0,s.jsxs)(et.Field,{label:"Licensed customer",required:!0,children:[(0,s.jsxs)("select",{className:et.INPUT_CLASSES,value:O,onChange:e=>P(e.target.value),disabled:d,children:[(0,s.jsx)("option",{value:"",children:"Choose a customer"}),e.map(({customer:e,licenseCount:t})=>(0,s.jsx)("option",{value:e.id,children:`${e.displayName} — ${e.contactEmail} \xb7 ${t} ${1===t?"license":"licenses"}`},e.id))]}),(0,s.jsx)(ef,{message:eG(void 0!==eB,eW)})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(et.Field,{label:"Display name",required:!0,children:[(0,s.jsx)("input",{className:et.INPUT_CLASSES,value:R,onChange:e=>q(e.target.value),placeholder:"As the licensed server shows it, e.g. Acme Corp",disabled:d,autoComplete:"off"}),(0,s.jsx)(ef,{message:eG(""!==R,eY("spec.customer.display_name"))})]}),(0,s.jsxs)(et.Field,{label:"Contact email",required:!0,children:[(0,s.jsx)("input",{className:et.INPUT_CLASSES,type:"email",value:Y,onChange:e=>G(e.target.value),placeholder:"Where renewal and expiry notices go",disabled:d,autoComplete:"off"}),(0,s.jsx)(ef,{message:eG(""!==Y,eY("spec.customer.contact_email"))})]}),(0,s.jsx)(et.Field,{label:"Cloud organization",children:(0,s.jsx)("input",{className:et.INPUT_CLASSES,value:K,onChange:e=>V(e.target.value),placeholder:"Its slug, if the customer also holds one",disabled:d,autoComplete:"off",spellCheck:!1})}),eM.length>0&&(0,s.jsxs)("div",{role:"status",className:"stg:space-y-1.5 stg:rounded-md stg:border stg:border-border stg:bg-muted-subtle stg:px-3 stg:py-2",children:[(0,s.jsxs)("p",{className:"stg:text-xs stg:text-foreground",children:[1===eM.length?"A customer with this name or address already holds licenses.":"Customers with this name or address already hold licenses."," ","Pick them instead, so their renewals stay in one history."]}),(0,s.jsx)("div",{className:"stg:flex stg:flex-wrap stg:gap-2",children:eM.map(({customer:e})=>(0,s.jsx)(c.Button,{size:"xs",variant:"outline",onClick:()=>{P(e.id),D("existing")},children:`Use ${e.displayName}`},e.id))})]})]})]}),(0,s.jsxs)(ex,{title:"Term",children:[(0,s.jsxs)("fieldset",{className:(0,n.cn)(es.UNSTYLED_FIELDSET,"stg:flex stg:flex-wrap stg:gap-4"),children:[(0,s.jsx)("legend",{className:"stg:sr-only",children:"Term"}),[o.LicenseTerm.trial,o.LicenseTerm.paid].map(e=>(0,s.jsx)(ep,{name:`${_}-term`,checked:H===e,onChange:()=>Z(e),label:`${f[e]} \xb7 ${eu[e]}`,disabled:d},e))]}),(0,s.jsxs)("div",{className:"stg:grid stg:grid-cols-1 stg:gap-3 stg:sm:grid-cols-2",children:[(0,s.jsxs)(et.Field,{label:"Covered through (UTC)",required:!0,children:[(0,s.jsx)("input",{className:et.INPUT_CLASSES,type:"date",min:eI,value:ez,onChange:e=>ej(e.target.value),disabled:d}),(0,s.jsx)(ef,{message:eG(!0,eR)})]}),(0,s.jsxs)(et.Field,{label:"Grace period (days)",required:!0,children:[(0,s.jsx)("input",{className:et.INPUT_CLASSES,type:"number",inputMode:"numeric",min:0,step:1,value:e_,onChange:e=>eN(e.target.value),disabled:d}),(0,s.jsx)(ef,{message:eG(!0,eD.ok?null:eD.error)})]})]}),(0,s.jsxs)("p",{className:"stg:text-xs stg:text-muted-foreground",children:[null===J?a?`Continues from the renewed license: ${eu[H]} from ${eA}.`:`${eu[H]} from today.`:"Set by hand."," ","During the grace period the licensed server keeps serving and warns that the license has expired.",null!==J&&(0,s.jsxs)(s.Fragment,{children:[" ",(0,s.jsx)("button",{type:"button",className:"stg:cursor-pointer stg:font-medium stg:text-foreground stg:underline stg:underline-offset-2",onClick:()=>ej(null),disabled:d,children:`Use the ${f[H].toLowerCase()} preset`})]})]})]}),(0,s.jsxs)(ex,{title:"Entitlements",children:[(0,s.jsxs)("div",{className:"stg:grid stg:grid-cols-1 stg:gap-3 stg:sm:grid-cols-2",children:[(0,s.jsxs)(et.Field,{label:"Max users",children:[(0,s.jsx)("input",{className:et.INPUT_CLASSES,type:"number",inputMode:"numeric",min:1,step:1,value:ey,onChange:e=>ew(e.target.value),placeholder:"Unlimited",disabled:d}),(0,s.jsx)(ef,{message:eG(""!==ey,eO.ok?eY("spec.entitlements.limits.max_users"):eO.error)})]}),(0,s.jsxs)(et.Field,{label:"Max organizations",children:[(0,s.jsx)("input",{className:et.INPUT_CLASSES,type:"number",inputMode:"numeric",min:1,step:1,value:ek,onChange:e=>eS(e.target.value),placeholder:"Unlimited",disabled:d}),(0,s.jsx)(ef,{message:eG(""!==ek,eP.ok?eY("spec.entitlements.limits.max_organizations"):eP.error)})]})]}),(0,s.jsxs)("fieldset",{className:(0,n.cn)(es.UNSTYLED_FIELDSET,"stg:space-y-2"),children:[(0,s.jsx)("legend",{className:"stg:mb-1 stg:text-[11px] stg:font-medium stg:text-muted-foreground",children:"Features"}),j.map(e=>(0,s.jsxs)("label",{className:"stg:flex stg:items-start stg:gap-2 stg:text-sm",children:[(0,s.jsx)("input",{type:"checkbox",className:(0,n.cn)(eg,"stg:mt-0.5"),checked:eC.includes(e),onChange:s=>{let t;return t=s.target.checked,eT(s=>t?j.filter(t=>t===e||s.includes(t)):s.filter(s=>s!==e))},disabled:d}),(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"stg:block stg:text-foreground",children:b[e].label}),(0,s.jsx)("span",{className:"stg:block stg:text-xs stg:text-muted-foreground",children:b[e].description})]})]},e))]})]}),(0,s.jsxs)(ex,{title:"Notes",children:[(0,s.jsxs)(et.Field,{label:"Internal note",children:[(0,s.jsx)("textarea",{className:(0,n.cn)(et.INPUT_CLASSES,"stg:min-h-16"),value:eL,onChange:e=>eU(e.target.value),placeholder:"The order, the contact, the reason for a bespoke entitlement",disabled:d}),(0,s.jsx)(ef,{message:eG(""!==eL,eY("spec.notes"))})]}),(0,s.jsx)("p",{className:"stg:m-0 stg:text-xs stg:text-muted-foreground",children:"Never signed into the ticket and never shown to the customer."})]}),(0,s.jsx)("section",{"aria-label":"What will be issued",className:"stg:space-y-1 stg:rounded-lg stg:border stg:border-border stg:bg-muted-subtle stg:p-4",children:eH?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"stg:m-0 stg:text-sm stg:font-semibold stg:text-foreground",children:eH}),(0,s.jsx)("p",{className:"stg:m-0 stg:text-sm stg:text-foreground",children:[eO.ok?U(eO.value,"user"):null,eP.ok?U(eP.value,"organization"):null,0===(A=j.filter(e=>eC.includes(e)).map(e=>b[e].label)).length?"No features":A.join(", ")].filter(e=>null!==e).join(" · ")}),eD.ok&&(0,s.jsx)("p",{className:"stg:m-0 stg:text-sm stg:text-muted-foreground",children:0===eD.value?"No grace period: the licensed server stops the day after.":`Then ${eD.value} days of grace, while the licensed server keeps serving and warns.`})]}):(0,s.jsx)("p",{className:"stg:m-0 stg:text-sm stg:text-muted-foreground",children:"Choose the customer to see the license this will issue."})}),e$&&eK.length>0&&(0,s.jsx)("ul",{className:(0,n.cn)(es.UNSTYLED_LIST,"stg:space-y-1"),role:"alert",children:eK.map(e=>(0,s.jsx)("li",{className:"stg:text-xs stg:text-destructive",children:e.message},`${(0,Q.pathToString)(e.field)}:${e.ruleId}`))}),g&&(0,s.jsx)("p",{className:"stg:text-xs stg:text-destructive",role:"alert",children:(y=g)instanceof l.StigmerError&&"already-exists"===y.code?"This license was already issued: same customer, term and last covered day. Open it from the list instead of issuing it twice.":(0,i.getUserMessage)(y)}),(0,s.jsxs)("div",{className:"stg:flex stg:gap-2",children:[(0,s.jsx)(c.Button,{type:"submit",disabled:d,children:d?"Issuing…":a?"Issue renewal":"Issue license"}),(0,s.jsx)(c.Button,{variant:"outline",onClick:m,disabled:d,children:"Cancel"})]})]})}function ex({title:e,children:t}){return(0,s.jsxs)("section",{className:"stg:space-y-3 stg:rounded-lg stg:border stg:border-border stg:bg-card stg:p-4","aria-label":e,children:[(0,s.jsx)("h4",{className:"stg:m-0 stg:text-sm stg:font-semibold stg:text-foreground",children:e}),t]})}function ep({name:e,checked:t,onChange:a,label:r,disabled:n}){return(0,s.jsxs)("label",{className:"stg:flex stg:items-center stg:gap-1.5 stg:text-sm stg:text-foreground",children:[(0,s.jsx)("input",{type:"radio",className:eg,name:e,checked:t,onChange:a,disabled:n}),r]})}function ef({message:e}){return e?(0,s.jsx)("span",{className:"stg:block stg:text-xs stg:text-destructive",children:e}):null}function eb(e){return void 0===e?"":String(e)}function ej({className:e}){return(0,s.jsx)(u.EmptyState,{variant:"permission",className:e,title:"Platform operator access required",description:"Licenses are issued by Stigmer's platform operators and carry customer contracts and signed keys. Organization roles do not grant access; if you need it, ask a platform operator to grant you the platform operator role."})}var ev=e.i(326283),eN=e.i(891287),ey=e.i(740694);let ew="stg:size-3.5",ek="stg:grid stg:grid-cols-[minmax(0,2fr)_4rem_minmax(0,1.4fr)_9rem_6rem] stg:items-center stg:gap-3 stg:px-3 stg:py-2";function eS({className:e,now:h}){let x,p=(0,g.useResourceAvailable)(d.ApiResourceKind.license),f=function(e){let s=(0,K.useStigmer)(),a=e?.enabled??!0,{data:r,isLoading:n,isRefetching:i,error:l,refetch:o}=(0,V.useFetch)(a?()=>s.license.list((0,eN.create)(ey.ListLicensesInputSchema)).then(e=>e.entries):null,[a,s],null);return(0,t.useMemo)(()=>({licenses:r,isLoading:n,isRefetching:i,error:l,refetch:o}),[r,n,i,l,o])}({enabled:p}),b=function(){let e=(0,K.useStigmer)(),[s,a]=(0,t.useState)(!1),[r,n]=(0,t.useState)(null),i=(0,t.useCallback)(async s=>{a(!0),n(null);try{return await e.license.create(s)}catch(s){let e=(0,ev.toError)(s);throw n(e),e}finally{a(!1)}},[e.license]),l=(0,t.useCallback)(()=>n(null),[]);return(0,t.useMemo)(()=>({issue:i,isSubmitting:s,error:r,clearError:l}),[i,s,r,l])}(),[j,v]=(0,t.useState)({phase:"list"}),N=h??new Date,y=(0,t.useCallback)(()=>v({phase:"list"}),[]),k=(0,t.useCallback)(e=>{b.clearError(),v({phase:"issue",renewingId:e})},[b.clearError]);if(!p||f.error&&(0,l.isUnimplemented)(f.error))return(0,s.jsxs)("div",{className:(0,n.cn)("stg:space-y-3",e),children:[(0,s.jsx)(eC,{}),(0,s.jsx)(m.CloudFeatureNotice,{children:"Licenses are issued from the Stigmer Cloud console. The server this console is connected to does not issue them; sign in to Stigmer Cloud to issue or renew a license."})]});if(f.isLoading)return(0,s.jsxs)("div",{className:(0,n.cn)("stg:space-y-2",e),"aria-busy":"true",children:[(0,s.jsx)("div",{className:"stg:h-4 stg:w-40 stg:animate-pulse stg:rounded stg:bg-muted-subtle"}),Array.from({length:3},(e,t)=>(0,s.jsx)("div",{className:"stg:h-10 stg:animate-pulse stg:rounded-lg stg:bg-muted-subtle"},t))]});if(f.error)return(0,l.isPermissionDenied)(f.error)?(0,s.jsxs)("div",{className:(0,n.cn)("stg:space-y-3",e),children:[(0,s.jsx)(eC,{}),(0,s.jsx)(ej,{})]}):(0,s.jsxs)("div",{className:(0,n.cn)("stg:space-y-3",e),children:[(0,s.jsx)(eC,{}),(0,s.jsx)("p",{className:"stg:text-sm stg:text-destructive",role:"alert",children:(0,i.getUserMessage)(f.error)}),(0,s.jsx)(c.Button,{variant:"outline",onClick:f.refetch,children:"Try again"})]});let C="detail"===j.phase?j.issued:void 0,T=C&&!(f.licenses??[]).some(e=>e.metadata?.id===C.metadata?.id)?[...f.licenses??[],C]:f.licenses??[],L=function(e,s){let t=new Map;for(let s of e){let e=s.spec?.customer?.id;if(!e)continue;let a=t.get(e);(!a||A(s)>A(a))&&t.set(e,s)}let a=new Map;for(let r of e){let e=r.metadata?.id??"",n=t.get(r.spec?.customer?.id??""),i=n&&n!==r&&A(n)>A(r)?n:void 0;a.set(e,function(e,s,t){let a=w(e.spec?.expiresAt),r=a?S(a):"an unknown day";if(t){let e=w(t.spec?.expiresAt);return{timeState:s,renewedBy:t.metadata?.id,phase:"disabled",label:"Renewed",reason:e?`Renewed by a license covering through ${S(e)}`:"Renewed by a later license"}}switch(s){case o.LicenseState.valid:return{timeState:s,renewedBy:void 0,phase:"ready",label:"Active",reason:`Covered through ${r}`};case o.LicenseState.expiring:return{timeState:s,renewedBy:void 0,phase:"degraded",label:"Expiring",reason:`Covered through ${r}; renew before it lapses`};case o.LicenseState.grace:{let t=w(e.spec?.graceUntil);return{timeState:s,renewedBy:void 0,phase:"failed",label:"In grace",reason:t?`Coverage ended after ${r}; grace runs through ${S(t)}`:`Coverage ended after ${r}`}}case o.LicenseState.expired:return{timeState:s,renewedBy:void 0,phase:"disabled",label:"Expired",reason:`Coverage ended after ${r}`};default:return s}}(r,function(e,s){let t=w(e.spec?.expiresAt);if(!t)return o.LicenseState.expired;let a=w(e.spec?.graceUntil)??t,r=s.getTime();return r>=t.getTime()?r<a.getTime()?o.LicenseState.grace:o.LicenseState.expired:r>=t.getTime()-function(e,s){let t=w(e.status?.issuedAt);return t?Math.min(2592e6,.25*Math.max(0,s.getTime()-t.getTime())):2592e6}(e,t)?o.LicenseState.expiring:o.LicenseState.valid}(r,s),i))}return a}(T,N),U=e=>void 0===e?void 0:T.find(s=>s.metadata?.id===e);if("issue"===j.phase)return(0,s.jsx)(eh,{className:e,customers:function(e){let s=new Map;for(let t of e){let e=t.spec?.customer?.id;if(!e)continue;let a=s.get(e);if(!a){s.set(e,{latest:t,count:1});continue}a.count+=1,I(t)>I(a.latest)&&(a.latest=t)}let t=[];for(let{latest:e,count:a}of s.values()){let s=e.spec?.customer;s&&t.push({customer:s,licenseCount:a})}return t.sort((e,s)=>e.customer.displayName.localeCompare(s.customer.displayName))}(T),renewing:U(j.renewingId),now:N,isSubmitting:b.isSubmitting,submitError:b.error,onSubmit:e=>{b.issue(e).then(e=>{f.refetch(),v({phase:"detail",licenseId:e.metadata?.id??"",issued:e})},()=>{})},onCancel:y});if("detail"===j.phase){let t=U(j.licenseId);if(!t)return(0,s.jsxs)("div",{className:(0,n.cn)("stg:space-y-2",e),children:[(0,s.jsx)("p",{className:"stg:text-xs stg:text-destructive",role:"alert",children:"This license is no longer in the list."}),(0,s.jsx)(c.Button,{variant:"outline",onClick:y,children:"Back to licenses"})]});let a=L.get(j.licenseId);return(0,s.jsx)(H,{className:e,license:t,issued:j.issued,standing:a,now:N,onBack:y,onRenew:a&&!a.renewedBy?()=>k(j.licenseId):void 0},j.licenseId)}let $=(x=e=>{let s=L.get(e.metadata?.id??"");if(!s||s.renewedBy)return 4;switch(s.timeState){case o.LicenseState.grace:return 0;case o.LicenseState.expiring:return 1;case o.LicenseState.valid:return 2;case o.LicenseState.expired:return 3;default:return s.timeState}},[...T].sort((e,s)=>{let t=x(e)-x(s);if(0!==t)return t;let a=A(e)-A(s);return x(e)>=3?-a:a})),E=function(e){let s=0,t=0,a=0;for(let r of e.values())r.renewedBy||(r.timeState===o.LicenseState.valid?s+=1:r.timeState===o.LicenseState.expiring?t+=1:r.timeState===o.LicenseState.grace&&(a+=1));return{active:s,expiring:t,grace:a}}(L);return(0,s.jsxs)("div",{className:(0,n.cn)("stg:space-y-3",e),children:[(0,s.jsx)(eC,{summary:T.length>0?`${E.active} active \xb7 ${E.expiring} expiring \xb7 ${E.grace} in grace`:void 0,action:T.length>0?(0,s.jsx)(c.Button,{icon:(0,s.jsx)(r.Plus,{className:ew,"aria-hidden":"true"}),onClick:()=>k(),children:"Issue license"}):void 0}),0===T.length?(0,s.jsx)(u.EmptyState,{variant:"first-use",icon:(0,s.jsx)(a.FileBadge,{className:"stg:size-10","aria-hidden":"true"}),title:"No licenses issued yet",description:"Issue the first one: name the customer, choose the term and set what it unlocks. Every license appears here, ordered by when it needs renewing.",action:{label:"Issue license",onClick:()=>k(),icon:(0,s.jsx)(r.Plus,{className:ew,"aria-hidden":"true"})}}):(0,s.jsx)("div",{className:"stg:overflow-x-auto stg:rounded-lg stg:border stg:border-border stg:bg-card",children:(0,s.jsxs)("div",{role:"table","aria-label":"Licenses",className:"stg:min-w-[42rem]",children:[(0,s.jsxs)("div",{role:"row",className:(0,n.cn)(ek,"stg:border-b stg:border-border stg:text-xs stg:font-medium stg:text-muted-foreground"),children:[(0,s.jsx)("span",{role:"columnheader",children:"Customer"}),(0,s.jsx)("span",{role:"columnheader",children:"Term"}),(0,s.jsx)("span",{role:"columnheader",children:"Entitlements"}),(0,s.jsx)("span",{role:"columnheader",children:"Covered through"}),(0,s.jsx)("span",{role:"columnheader",children:"Standing"})]}),(0,s.jsx)("div",{role:"rowgroup",children:$.map(e=>(0,s.jsx)(eT,{license:e,standing:L.get(e.metadata?.id??""),now:N,onOpen:()=>v({phase:"detail",licenseId:e.metadata?.id??""})},e.metadata?.id))})]})})]})}function eC({summary:e,action:t}){return(0,s.jsxs)("div",{className:"stg:flex stg:flex-wrap stg:items-center stg:justify-between stg:gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"stg:m-0 stg:text-base stg:font-semibold stg:text-foreground",children:"Licenses"}),e&&(0,s.jsx)("p",{className:"stg:m-0 stg:text-sm stg:text-muted-foreground",children:e})]}),t]})}function eT({license:e,standing:t,now:a,onOpen:r}){var i;let l,c,d=e.spec?.customer,g=w(e.spec?.expiresAt),u=g?S(g):void 0,m=w(e.spec?.graceUntil),x=t?.phase==="disabled",p=t?.timeState===o.LicenseState.grace&&!t.renewedBy&&m;return(0,s.jsxs)("div",{role:"row",className:(0,n.cn)(ek,"stg:relative stg:border-b stg:border-border stg:text-xs stg:text-muted-foreground stg:last:border-b-0","stg:transition-colors stg:hover:bg-accent stg:motion-reduce:transition-none"),children:[(0,s.jsxs)("span",{role:"cell",className:"stg:min-w-0",children:[(0,s.jsx)("button",{type:"button",onClick:r,className:(0,n.cn)("stg:block stg:max-w-full stg:cursor-pointer stg:truncate stg:text-left stg:text-sm stg:font-medium",x?"stg:text-muted-foreground":"stg:text-foreground","stg:after:absolute stg:after:inset-0","stg:focus-visible:outline-none stg:focus-visible:after:ring-1 stg:focus-visible:after:ring-ring"),children:d?.displayName??"Unknown customer"}),(0,s.jsx)("span",{className:"stg:block stg:truncate",children:d?.contactEmail})]}),(0,s.jsx)("span",{role:"cell",children:e.spec?y(e.spec.term):"—"}),(0,s.jsx)("span",{role:"cell",className:"stg:min-w-0",children:(i=e.spec?.entitlements,l=i?.limits,c=i?.features.filter(v).length??0,[U(l?.maxUsers,"user"),U(l?.maxOrganizations,"organization"),0===c?"No features":$(c,"feature")]).map(e=>(0,s.jsx)("span",{className:"stg:block stg:truncate",children:e},e))}),(0,s.jsxs)("span",{role:"cell",className:"stg:min-w-0",children:[(0,s.jsx)("span",{className:(0,n.cn)("stg:block stg:text-sm",x?"stg:text-muted-foreground":"stg:text-foreground"),children:u??"Unknown"}),p?(0,s.jsx)("span",{className:"stg:block stg:font-medium stg:text-destructive",children:`Grace ends ${S(p)}`}):u&&(0,s.jsx)("span",{className:"stg:block",children:L(u,a)})]}),(0,s.jsx)("span",{role:"cell",className:"stg:relative stg:z-10 stg:justify-self-start",children:t&&(0,s.jsx)(h.StatusBadge,{phase:t.phase,label:t.label,tooltip:t.reason})})]})}e.s(["default",0,function(){return(0,s.jsx)(eS,{})}],261716)}]);
|