@stigmer/server-slim 3.17.0 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/console/404.html +1 -1
- package/console/__next.__PAGE__.txt +2 -2
- package/console/__next._full.txt +16 -16
- package/console/__next._head.txt +4 -4
- package/console/__next._index.txt +10 -10
- package/console/__next._tree.txt +2 -2
- package/console/_next/static/chunks/{04hrkprhk3cjo.js → 0.cr0e7bzkpoi.js} +3 -3
- package/console/_next/static/chunks/0.ocu5b3uajbn.js +1 -0
- package/console/_next/static/chunks/{16ukgtm3fhab~.js → 06qoer~dl1svs.js} +2 -2
- package/console/_next/static/chunks/071fdr3kvata1.js +1 -0
- package/console/_next/static/chunks/{0s5t77.~jqey1.js → 0_3utrn1at0vi.js} +1 -1
- package/console/_next/static/chunks/0_j8~rfb.1ufy.js +1 -0
- package/console/_next/static/chunks/0auyo62rglco8.js +1 -0
- package/console/_next/static/chunks/{0xp6mamoqde.n.js → 0fgcvnc-b_oz_.js} +1 -1
- package/console/_next/static/chunks/0gz8yljnjzsmu.js +1 -0
- package/console/_next/static/chunks/{107065384mt73.js → 0hc-53ypd.8xp.js} +1 -1
- package/console/_next/static/chunks/0hca-f9-nua.e.js +1 -0
- package/console/_next/static/chunks/0j~6628v9z3k-.js +1 -0
- package/console/_next/static/chunks/0pxd7smgb31vs.js +1 -0
- package/console/_next/static/chunks/0rs1tuslqwnz3.js +1 -0
- package/console/_next/static/chunks/0s6bm1sujua~8.css +1 -0
- package/console/_next/static/chunks/0xq42ojv80jqz.js +1 -0
- package/console/_next/static/chunks/{0dmmn-x2crcuv.js → 0xs_3fux3hsk3.js} +2 -2
- package/console/_next/static/chunks/{127-4s-8utcan.js → 0yheev3nzjrip.js} +1 -1
- package/console/_next/static/chunks/0yuo~koxf.2fn.js +1 -0
- package/console/_next/static/chunks/0zzf3a9srn32x.js +1 -0
- package/console/_next/static/chunks/110bry9pdkk8s.js +5 -0
- package/console/_next/static/chunks/17pusweun3t84.js +1 -0
- package/console/_not-found/__next._full.txt +16 -16
- package/console/_not-found/__next._head.txt +4 -4
- package/console/_not-found/__next._index.txt +10 -10
- 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 +2 -2
- package/console/_not-found.html +1 -1
- package/console/_not-found.txt +16 -16
- package/console/auth/callback/__next._full.txt +18 -18
- package/console/auth/callback/__next._head.txt +4 -4
- package/console/auth/callback/__next._index.txt +10 -10
- package/console/auth/callback/__next._tree.txt +2 -2
- 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 +18 -18
- package/console/auth/github/callback/__next._full.txt +18 -18
- package/console/auth/github/callback/__next._head.txt +4 -4
- package/console/auth/github/callback/__next._index.txt +10 -10
- package/console/auth/github/callback/__next._tree.txt +2 -2
- 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 +18 -18
- package/console/auth/oauth/callback/__next._full.txt +18 -18
- package/console/auth/oauth/callback/__next._head.txt +4 -4
- package/console/auth/oauth/callback/__next._index.txt +10 -10
- package/console/auth/oauth/callback/__next._tree.txt +2 -2
- 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 +18 -18
- package/console/chat/__placeholder__/__placeholder__/__next._full.txt +17 -17
- package/console/chat/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/chat/__placeholder__/__placeholder__/__next._index.txt +10 -10
- package/console/chat/__placeholder__/__placeholder__/__next._tree.txt +2 -2
- 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 +17 -17
- package/console/conversations/__next._full.txt +17 -17
- package/console/conversations/__next._head.txt +4 -4
- package/console/conversations/__next._index.txt +10 -10
- package/console/conversations/__next._tree.txt +2 -2
- 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 +17 -17
- package/console/conversations/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/conversations/__placeholder__/__placeholder__/__next._index.txt +10 -10
- package/console/conversations/__placeholder__/__placeholder__/__next._tree.txt +2 -2
- 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 +17 -17
- package/console/conversations.html +1 -1
- package/console/conversations.txt +17 -17
- package/console/dashboard/__next._full.txt +17 -17
- package/console/dashboard/__next._head.txt +4 -4
- package/console/dashboard/__next._index.txt +10 -10
- package/console/dashboard/__next._tree.txt +2 -2
- 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 +17 -17
- package/console/executions/__placeholder__/__next._full.txt +16 -16
- package/console/executions/__placeholder__/__next._head.txt +4 -4
- package/console/executions/__placeholder__/__next._index.txt +10 -10
- package/console/executions/__placeholder__/__next._tree.txt +2 -2
- 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 +16 -16
- package/console/index.html +1 -1
- package/console/index.txt +16 -16
- package/console/invite/__placeholder__/__next._full.txt +17 -17
- package/console/invite/__placeholder__/__next._head.txt +4 -4
- package/console/invite/__placeholder__/__next._index.txt +10 -10
- package/console/invite/__placeholder__/__next._tree.txt +2 -2
- 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 +17 -17
- package/console/library/__next._full.txt +21 -21
- package/console/library/__next._head.txt +4 -4
- package/console/library/__next._index.txt +10 -10
- package/console/library/__next._tree.txt +2 -2
- package/console/library/__next.library.__PAGE__.txt +3 -3
- package/console/library/__next.library.txt +5 -5
- package/console/library/agents/__next._full.txt +21 -21
- package/console/library/agents/__next._head.txt +4 -4
- package/console/library/agents/__next._index.txt +10 -10
- package/console/library/agents/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/library/agents/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/library/agents/__placeholder__/__placeholder__/__next._index.txt +10 -10
- package/console/library/agents/__placeholder__/__placeholder__/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/library/agents/new/__next._full.txt +21 -21
- package/console/library/agents/new/__next._head.txt +4 -4
- package/console/library/agents/new/__next._index.txt +10 -10
- package/console/library/agents/new/__next._tree.txt +2 -2
- 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 +21 -21
- package/console/library/agents.html +1 -1
- package/console/library/agents.txt +21 -21
- package/console/library/mcp-servers/__next._full.txt +21 -21
- package/console/library/mcp-servers/__next._head.txt +4 -4
- package/console/library/mcp-servers/__next._index.txt +10 -10
- package/console/library/mcp-servers/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._index.txt +10 -10
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/library/mcp-servers/new/__next._full.txt +21 -21
- package/console/library/mcp-servers/new/__next._head.txt +4 -4
- package/console/library/mcp-servers/new/__next._index.txt +10 -10
- package/console/library/mcp-servers/new/__next._tree.txt +2 -2
- 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 +21 -21
- package/console/library/mcp-servers.html +1 -1
- package/console/library/mcp-servers.txt +21 -21
- package/console/library/plugins/__next._full.txt +21 -21
- package/console/library/plugins/__next._head.txt +4 -4
- package/console/library/plugins/__next._index.txt +10 -10
- package/console/library/plugins/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/library/plugins/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/library/plugins/__placeholder__/__placeholder__/__next._index.txt +10 -10
- package/console/library/plugins/__placeholder__/__placeholder__/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/library/plugins/upload/__next._full.txt +41 -0
- package/console/library/plugins/upload/__next._head.txt +6 -0
- package/console/library/plugins/upload/__next._index.txt +17 -0
- package/console/library/plugins/{install → upload}/__next._tree.txt +2 -2
- package/console/library/plugins/upload/__next.library.plugins.txt +5 -0
- package/console/library/plugins/upload/__next.library.plugins.upload.__PAGE__.txt +9 -0
- package/console/library/plugins/upload/__next.library.plugins.upload.txt +5 -0
- package/console/library/plugins/upload/__next.library.txt +7 -0
- package/console/library/plugins/upload.html +1 -0
- package/console/library/plugins/upload.txt +41 -0
- package/console/library/plugins.html +1 -1
- package/console/library/plugins.txt +21 -21
- package/console/library/schedules/__next._full.txt +20 -20
- package/console/library/schedules/__next._head.txt +4 -4
- package/console/library/schedules/__next._index.txt +10 -10
- package/console/library/schedules/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/library/schedules/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/library/schedules/__placeholder__/__placeholder__/__next._index.txt +10 -10
- package/console/library/schedules/__placeholder__/__placeholder__/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/library/schedules/new/__next._full.txt +21 -21
- package/console/library/schedules/new/__next._head.txt +4 -4
- package/console/library/schedules/new/__next._index.txt +10 -10
- package/console/library/schedules/new/__next._tree.txt +2 -2
- 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 +21 -21
- package/console/library/schedules.html +1 -1
- package/console/library/schedules.txt +20 -20
- package/console/library/skills/__next._full.txt +20 -20
- package/console/library/skills/__next._head.txt +4 -4
- package/console/library/skills/__next._index.txt +10 -10
- package/console/library/skills/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/library/skills/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/library/skills/__placeholder__/__placeholder__/__next._index.txt +10 -10
- package/console/library/skills/__placeholder__/__placeholder__/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/library/skills/new/__next._full.txt +22 -22
- package/console/library/skills/new/__next._head.txt +4 -4
- package/console/library/skills/new/__next._index.txt +10 -10
- package/console/library/skills/new/__next._tree.txt +2 -2
- 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 +22 -22
- package/console/library/skills.html +1 -1
- package/console/library/skills.txt +20 -20
- package/console/library/workflows/__next._full.txt +21 -21
- package/console/library/workflows/__next._head.txt +4 -4
- package/console/library/workflows/__next._index.txt +10 -10
- package/console/library/workflows/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/library/workflows/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/library/workflows/__placeholder__/__placeholder__/__next._index.txt +10 -10
- package/console/library/workflows/__placeholder__/__placeholder__/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/library/workflows/executions/__next._full.txt +20 -20
- package/console/library/workflows/executions/__next._head.txt +4 -4
- package/console/library/workflows/executions/__next._index.txt +10 -10
- package/console/library/workflows/executions/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/library/workflows/new/__next._full.txt +22 -22
- package/console/library/workflows/new/__next._head.txt +4 -4
- package/console/library/workflows/new/__next._index.txt +10 -10
- package/console/library/workflows/new/__next._tree.txt +2 -2
- 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 +22 -22
- package/console/library/workflows.html +1 -1
- package/console/library/workflows.txt +21 -21
- package/console/library.html +1 -1
- package/console/library.txt +21 -21
- package/console/login/__next._full.txt +18 -18
- package/console/login/__next._head.txt +4 -4
- package/console/login/__next._index.txt +10 -10
- package/console/login/__next._tree.txt +2 -2
- 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 +18 -18
- package/console/marketplace/__next._full.txt +32 -0
- package/console/marketplace/__next._head.txt +6 -0
- package/console/marketplace/__next._index.txt +17 -0
- package/console/marketplace/__next._tree.txt +5 -0
- package/console/marketplace/__next.marketplace.__PAGE__.txt +6 -0
- package/console/marketplace/__next.marketplace.txt +5 -0
- package/console/marketplace.html +1 -0
- package/console/marketplace.txt +32 -0
- package/console/oauth/slack/callback/__next._full.txt +18 -18
- package/console/oauth/slack/callback/__next._head.txt +4 -4
- package/console/oauth/slack/callback/__next._index.txt +10 -10
- package/console/oauth/slack/callback/__next._tree.txt +2 -2
- 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 +18 -18
- package/console/sessions/__placeholder__/__next._full.txt +16 -16
- package/console/sessions/__placeholder__/__next._head.txt +4 -4
- package/console/sessions/__placeholder__/__next._index.txt +10 -10
- package/console/sessions/__placeholder__/__next._tree.txt +2 -2
- 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 +16 -16
- package/console/settings/__next._full.txt +20 -20
- package/console/settings/__next._head.txt +4 -4
- package/console/settings/__next._index.txt +10 -10
- package/console/settings/__next._tree.txt +2 -2
- 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 +19 -19
- package/console/settings/account-preferences/__next._head.txt +4 -4
- package/console/settings/account-preferences/__next._index.txt +10 -10
- package/console/settings/account-preferences/__next._tree.txt +2 -2
- 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 +19 -19
- package/console/settings/api-keys/__next._full.txt +19 -19
- package/console/settings/api-keys/__next._head.txt +4 -4
- package/console/settings/api-keys/__next._index.txt +10 -10
- package/console/settings/api-keys/__next._tree.txt +2 -2
- 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 +19 -19
- package/console/settings/billing/__next._full.txt +20 -20
- package/console/settings/billing/__next._head.txt +4 -4
- package/console/settings/billing/__next._index.txt +10 -10
- package/console/settings/billing/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/settings/channel-apps/__next._full.txt +19 -19
- package/console/settings/channel-apps/__next._head.txt +4 -4
- package/console/settings/channel-apps/__next._index.txt +10 -10
- package/console/settings/channel-apps/__next._tree.txt +2 -2
- 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 +19 -19
- package/console/settings/cursor-accounts/__next._full.txt +20 -20
- package/console/settings/cursor-accounts/__next._head.txt +4 -4
- package/console/settings/cursor-accounts/__next._index.txt +10 -10
- package/console/settings/cursor-accounts/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/settings/environments/__next._full.txt +19 -19
- package/console/settings/environments/__next._head.txt +4 -4
- package/console/settings/environments/__next._index.txt +10 -10
- package/console/settings/environments/__next._tree.txt +2 -2
- 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 +19 -19
- package/console/settings/identity-providers/__next._full.txt +19 -19
- package/console/settings/identity-providers/__next._head.txt +4 -4
- package/console/settings/identity-providers/__next._index.txt +10 -10
- package/console/settings/identity-providers/__next._tree.txt +2 -2
- 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 +19 -19
- package/console/settings/invitations/__next._full.txt +19 -19
- package/console/settings/invitations/__next._head.txt +4 -4
- package/console/settings/invitations/__next._index.txt +10 -10
- package/console/settings/invitations/__next._tree.txt +2 -2
- 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 +19 -19
- package/console/settings/members/__next._full.txt +19 -19
- package/console/settings/members/__next._head.txt +4 -4
- package/console/settings/members/__next._index.txt +10 -10
- package/console/settings/members/__next._tree.txt +2 -2
- 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 +19 -19
- package/console/settings/memory/__next._full.txt +19 -19
- package/console/settings/memory/__next._head.txt +4 -4
- package/console/settings/memory/__next._index.txt +10 -10
- package/console/settings/memory/__next._tree.txt +2 -2
- 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 +19 -19
- package/console/settings/oauth-apps/__next._full.txt +19 -19
- package/console/settings/oauth-apps/__next._head.txt +4 -4
- package/console/settings/oauth-apps/__next._index.txt +10 -10
- package/console/settings/oauth-apps/__next._tree.txt +2 -2
- 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 +19 -19
- package/console/settings/org-preferences/__next._full.txt +19 -19
- package/console/settings/org-preferences/__next._head.txt +4 -4
- package/console/settings/org-preferences/__next._index.txt +10 -10
- package/console/settings/org-preferences/__next._tree.txt +2 -2
- 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 +19 -19
- package/console/settings/org-profile/__next._full.txt +19 -19
- package/console/settings/org-profile/__next._head.txt +4 -4
- package/console/settings/org-profile/__next._index.txt +10 -10
- package/console/settings/org-profile/__next._tree.txt +2 -2
- 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 +19 -19
- package/console/settings/platform-clients/__next._full.txt +19 -19
- package/console/settings/platform-clients/__next._head.txt +4 -4
- package/console/settings/platform-clients/__next._index.txt +10 -10
- package/console/settings/platform-clients/__next._tree.txt +2 -2
- 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 +19 -19
- package/console/settings/pricing-governance/__next._full.txt +20 -20
- package/console/settings/pricing-governance/__next._head.txt +4 -4
- package/console/settings/pricing-governance/__next._index.txt +10 -10
- package/console/settings/pricing-governance/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/settings/provider-standing/__next._full.txt +20 -20
- package/console/settings/provider-standing/__next._head.txt +4 -4
- package/console/settings/provider-standing/__next._index.txt +10 -10
- package/console/settings/provider-standing/__next._tree.txt +2 -2
- 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 +20 -20
- package/console/settings/usage/__next._full.txt +19 -19
- package/console/settings/usage/__next._head.txt +4 -4
- package/console/settings/usage/__next._index.txt +10 -10
- package/console/settings/usage/__next._tree.txt +2 -2
- 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 +19 -19
- package/console/settings.html +1 -1
- package/console/settings.txt +20 -20
- package/console/workflows/__next._full.txt +16 -16
- package/console/workflows/__next._head.txt +4 -4
- package/console/workflows/__next._index.txt +10 -10
- package/console/workflows/__next._tree.txt +2 -2
- 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 +17 -17
- package/console/workflows/__placeholder__/__placeholder__/__next._head.txt +4 -4
- package/console/workflows/__placeholder__/__placeholder__/__next._index.txt +10 -10
- package/console/workflows/__placeholder__/__placeholder__/__next._tree.txt +2 -2
- 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 +17 -17
- package/console/workflows/executions/__next._full.txt +16 -16
- package/console/workflows/executions/__next._head.txt +4 -4
- package/console/workflows/executions/__next._index.txt +10 -10
- package/console/workflows/executions/__next._tree.txt +2 -2
- 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 +17 -17
- package/console/workflows/executions/__placeholder__/__next._head.txt +4 -4
- package/console/workflows/executions/__placeholder__/__next._index.txt +10 -10
- package/console/workflows/executions/__placeholder__/__next._tree.txt +2 -2
- 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 +17 -17
- package/console/workflows/executions.html +1 -1
- package/console/workflows/executions.txt +16 -16
- package/console/workflows.html +1 -1
- package/console/workflows.txt +16 -16
- package/main.js +6 -6
- package/package.json +6 -6
- package/workflow-bundle-agent-execution.js +1 -1
- package/workflow-bundle-workflow-execution.js +1 -1
- package/console/_next/static/chunks/0-rl_~-k4zneu.js +0 -1
- package/console/_next/static/chunks/00d~s.n2ue-_h.js +0 -1
- package/console/_next/static/chunks/03y0rf3oc7s.8.js +0 -1
- package/console/_next/static/chunks/05hwz_mbqzf1o.js +0 -1
- package/console/_next/static/chunks/08tdiho~eajic.js +0 -1
- package/console/_next/static/chunks/0h5_gexj.8ede.js +0 -1
- package/console/_next/static/chunks/0hb.-vcj2w6kf.js +0 -1
- package/console/_next/static/chunks/0n_eq4ve3k9iw.js +0 -5
- package/console/_next/static/chunks/0uvbqsa~x3_x6.js +0 -1
- package/console/_next/static/chunks/0~t6-khw6kbrz.js +0 -1
- package/console/_next/static/chunks/148.037r-t498.js +0 -1
- package/console/_next/static/chunks/16ql-tt25wyl~.css +0 -1
- package/console/_next/static/chunks/17h3h-dhcyv24.js +0 -1
- package/console/library/plugins/install/__next._full.txt +0 -41
- package/console/library/plugins/install/__next._head.txt +0 -6
- package/console/library/plugins/install/__next._index.txt +0 -17
- package/console/library/plugins/install/__next.library.plugins.install.__PAGE__.txt +0 -9
- package/console/library/plugins/install/__next.library.plugins.install.txt +0 -5
- package/console/library/plugins/install/__next.library.plugins.txt +0 -5
- package/console/library/plugins/install/__next.library.txt +0 -7
- package/console/library/plugins/install.html +0 -1
- package/console/library/plugins/install.txt +0 -41
- /package/console/_next/static/{nsysxL2UYvxTUeX1Z93Nk → 0d4BawxHa-jMy4WgCDP1P}/_buildManifest.js +0 -0
- /package/console/_next/static/{nsysxL2UYvxTUeX1Z93Nk → 0d4BawxHa-jMy4WgCDP1P}/_clientMiddlewareManifest.js +0 -0
- /package/console/_next/static/{nsysxL2UYvxTUeX1Z93Nk → 0d4BawxHa-jMy4WgCDP1P}/_ssgManifest.js +0 -0
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,16715,379185,292270,e=>{"use strict";var t=e.i(475254);let s=(0,t.default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",0,s],16715);var r=e.i(843476),n=e.i(271645),a=e.i(891287),i=e.i(893976),o=e.i(610595),l=e.i(421415),u=e.i(586108),c=e.i(326283),d=e.i(367539),g=e.i(891914),m=e.i(379410);e.s(["CreateOrganizationForm",0,function({onCreated:e,onCancel:t,className:s}){let h=(0,n.useId)(),{create:p,isCreating:f,error:x,clearError:v}=function(){let e=(0,u.useStigmer)(),[t,s]=(0,n.useState)(!1),[r,a]=(0,n.useState)(null),i=(0,n.useCallback)(()=>a(null),[]);return{create:(0,n.useCallback)(async t=>{s(!0),a(null);try{return await e.organization.create(t)}catch(e){throw a((0,c.toError)(e)),e}finally{s(!1)}},[e]),isCreating:t,error:r,clearError:i}}(),[b,y]=(0,n.useState)(""),[k,j]=(0,n.useState)(""),[w,N]=(0,n.useState)(""),C=(0,n.useRef)(!1),S=b.trim(),E=k.length>0||S.length>0?(0,g.validateMessage)(l.ApiResourceMetadataSchema,(0,a.create)(l.ApiResourceMetadataSchema,{...k.length>0&&{slug:k},...S.length>0&&{name:S}})):[],T=k.length>0?(0,g.getFieldError)(E,"slug"):null,A=S.length>0?(0,g.getFieldError)(E,"name"):null,I=""!==S&&k.length>0&&null===T&&null===A&&!f,M=(0,n.useCallback)(e=>{y(e),C.current||j((0,d.generateSlug)(e.trim()))},[]),O=(0,n.useCallback)(e=>{C.current=!0,j(e)},[]),_=(0,n.useCallback)(async t=>{if(t.preventDefault(),I){v();try{let t=await p({name:S,slug:k,org:k,description:w.trim()||void 0});e?.(t)}catch{}}},[I,S,k,w,p,v,e]);return(0,r.jsxs)("form",{onSubmit:_,className:(0,i.cn)("stg:space-y-3",s),children:[(0,r.jsxs)("div",{className:"stg:space-y-2",children:[(0,r.jsxs)("div",{className:"stg:space-y-1",children:[(0,r.jsx)("label",{htmlFor:`${h}-name`,className:"stg:text-xs stg:font-medium stg:text-foreground",children:"Name"}),(0,r.jsx)("input",{id:`${h}-name`,type:"text",value:b,onChange:e=>M(e.target.value),placeholder:"e.g. Acme Corp",disabled:f,autoFocus:!0,required:!0,maxLength:63,className:(0,i.cn)("stg:w-full stg:rounded-md stg:border stg:bg-background stg:px-2.5 stg:py-1.5 stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50",A?"stg:border-destructive":"stg:border-input")}),A?(0,r.jsx)("p",{className:"stg:text-[0.65rem] stg:text-destructive",role:"alert",children:A}):(0,r.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:"A human-readable display name for the organization."})]}),(0,r.jsxs)("div",{className:"stg:space-y-1",children:[(0,r.jsx)("label",{htmlFor:`${h}-slug`,className:"stg:text-xs stg:font-medium stg:text-foreground",children:"Slug"}),(0,r.jsx)("input",{id:`${h}-slug`,type:"text",value:k,onChange:e=>O(e.target.value),placeholder:"e.g. acme-corp",disabled:f,required:!0,className:(0,i.cn)("stg:w-full stg:rounded-md stg:border stg:bg-background stg:px-2.5 stg:py-1.5 stg:text-xs stg:text-foreground stg:font-mono","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50",T?"stg:border-destructive":"stg:border-input")}),T?(0,r.jsx)("p",{className:"stg:text-[0.65rem] stg:text-destructive",role:"alert",children:T}):(0,r.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:"URL-friendly identifier used in resource references. 2–63 characters: lowercase letters, numbers, and hyphens."})]}),(0,r.jsxs)("div",{className:"stg:space-y-1",children:[(0,r.jsxs)("label",{htmlFor:`${h}-desc`,className:"stg:text-xs stg:font-medium stg:text-muted-foreground",children:["Description"," ",(0,r.jsx)("span",{className:"stg:text-muted-foreground-subtle",children:"(optional)"})]}),(0,r.jsx)("input",{id:`${h}-desc`,type:"text",value:w,onChange:e=>N(e.target.value),placeholder:"What is this organization for?",disabled:f,className:(0,i.cn)("stg:w-full stg:rounded-md stg:border stg:border-input stg:bg-background stg:px-2.5 stg:py-1.5 stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50")})]})]}),x&&(0,r.jsx)("p",{className:"stg:text-destructive stg:text-[0.65rem]",role:"alert",children:(0,o.getUserMessage)(x)}),(0,r.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2",children:[(0,r.jsxs)("button",{type:"submit",disabled:!I,className:(0,i.cn)("stg:inline-flex stg:items-center stg:gap-1.5 stg:rounded-md stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:disabled:pointer-events-none stg:disabled:opacity-40"),children:[f&&(0,r.jsx)(m.SpinnerIcon,{size:12}),"Create organization"]}),t&&(0,r.jsx)("button",{type:"button",onClick:t,disabled:f,className:(0,i.cn)("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-xs","stg:text-muted-foreground stg:hover:text-foreground stg:hover:bg-accent-hover","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:"Cancel"})]})]})}],379185);let h=(0,t.default)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);e.s(["LogOut",0,h],292270)},693079,e=>{"use strict";let t,s,r,n,a,i;var o=e.i(843476),l=e.i(271645),u=e.i(618566);e.i(247167);var c=e.i(363178);function d(e){return(0,o.jsx)(c.ThemeProvider,{...e})}var g={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},m=new class{#e=g;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},h="u"<typeof window||"Deno"in globalThis;function p(){}function f(e,t){return"function"==typeof e?e(t):e}function x(e,t){let{type:s="all",exact:r,fetchStatus:n,predicate:a,queryKey:i,stale:o}=e;if(i){if(r){if(t.queryHash!==b(i,t.options))return!1}else if(!k(t.queryKey,i))return!1}if("all"!==s){let e=t.isActive();if("active"===s&&!e||"inactive"===s&&e)return!1}return("boolean"!=typeof o||t.isStale()===o)&&(!n||n===t.state.fetchStatus)&&(!a||!!a(t))}function v(e,t){let{exact:s,status:r,predicate:n,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(s){if(y(t.options.mutationKey)!==y(a))return!1}else if(!k(t.options.mutationKey,a))return!1}return(!r||t.state.status===r)&&(!n||!!n(t))}function b(e,t){return(t?.queryKeyHashFn||y)(e)}function y(e){return JSON.stringify(e,(e,t)=>N(t)?Object.keys(t).sort().reduce((e,s)=>(e[s]=t[s],e),{}):t)}function k(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(s=>k(e[s],t[s]))}var j=Object.prototype.hasOwnProperty;function w(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function N(e){if(!C(e))return!1;let t=e.constructor;if(void 0===t)return!0;let s=t.prototype;return!!C(s)&&!!s.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function C(e){return"[object Object]"===Object.prototype.toString.call(e)}function S(e,t,s=0){let r=[...e,t];return s&&r.length>s?r.slice(1):r}function E(e,t,s=0){let r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var T=Symbol();function A(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==T?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))}var I=(t=[],s=0,r=e=>{e()},n=e=>{e()},a=function(e){setTimeout(e,0)},{batch:e=>{let i;s++;try{i=e()}finally{let e;--s||(e=t,t=[],e.length&&a(()=>{n(()=>{e.forEach(e=>{r(e)})})}))}return i},batchCalls:e=>(...t)=>{i(()=>{e(...t)})},schedule:i=e=>{s?t.push(e):a(()=>{r(e)})},setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{a=e}}),M=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},O=new class extends M{#s;#r;#n;constructor(){super(),this.#n=e=>{if(!h&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#r||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#r?.(),this.#r=void 0)}setEventListener(e){this.#n=e,this.#r?.(),this.#r=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#s!==e&&(this.#s=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#s?this.#s:globalThis.document?.visibilityState!=="hidden"}},_=new class extends M{#a=!0;#r;#n;constructor(){super(),this.#n=e=>{if(!h&&window.addEventListener){let t=()=>e(!0),s=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#r||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#r?.(),this.#r=void 0)}setEventListener(e){this.#n=e,this.#r?.(),this.#r=e(this.setOnline.bind(this))}setOnline(e){this.#a!==e&&(this.#a=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#a}};function R(e){return Math.min(1e3*2**e,3e4)}function D(e){return(e??"online")!=="online"||_.isOnline()}var P=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function F(e){let t,s=!1,r=0,n=function(){let e,t,s=new Promise((s,r)=>{e=s,t=r});function r(e){Object.assign(s,e),delete s.resolve,delete s.reject}return s.status="pending",s.catch(()=>{}),s.resolve=t=>{r({status:"fulfilled",value:t}),e(t)},s.reject=e=>{r({status:"rejected",reason:e}),t(e)},s}(),a=()=>O.isFocused()&&("always"===e.networkMode||_.isOnline())&&e.canRun(),i=()=>D(e.networkMode)&&e.canRun(),o=e=>{"pending"===n.status&&(t?.(),n.resolve(e))},l=e=>{"pending"===n.status&&(t?.(),n.reject(e))},u=()=>new Promise(s=>{t=e=>{("pending"!==n.status||a())&&s(e)},e.onPause?.()}).then(()=>{t=void 0,"pending"===n.status&&e.onContinue?.()}),c=()=>{let t;if("pending"!==n.status)return;let i=0===r?e.initialPromise:void 0;try{t=i??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(o).catch(t=>{if("pending"!==n.status)return;let i=e.retry??3*!h,o=e.retryDelay??R,d="function"==typeof o?o(r,t):o,g=!0===i||"number"==typeof i&&r<i||"function"==typeof i&&i(r,t);s||!g?l(t):(r++,e.onFail?.(r,t),new Promise(e=>{m.setTimeout(e,d)}).then(()=>a()?void 0:u()).then(()=>{s?l(t):c()}))})};return{promise:n,status:()=>n.status,cancel:t=>{if("pending"===n.status){let s=new P(t);l(s),e.onCancel?.(s)}},continue:()=>(t?.(),n),cancelRetry:()=>{s=!0},continueRetry:()=>{s=!1},canStart:i,start:()=>(i()?c():u().then(c),n)}}var L=class{#i;destroy(){this.clearGcTimeout()}scheduleGc(){var e;this.clearGcTimeout(),"number"==typeof(e=this.gcTime)&&e>=0&&e!==1/0&&(this.#i=m.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(h?1/0:3e5))}clearGcTimeout(){this.#i&&(m.clearTimeout(this.#i),this.#i=void 0)}},W=class extends L{#o;#l;#u;#c;#d;#g;#m;constructor(e){super(),this.#m=!1,this.#g=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#c=e.client,this.#u=this.#c.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#o=U(this.options),this.state=e.state??this.#o,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#d?.promise}setOptions(e){if(this.options={...this.#g,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let e=U(this.options);void 0!==e.data&&(this.setState(K(e.data,e.dataUpdatedAt)),this.#o=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){var s,r;let n=(s=this.state.data,"function"==typeof(r=this.options).structuralSharing?r.structuralSharing(s,e):!1!==r.structuralSharing?function e(t,s,r=0){if(t===s)return t;if(r>500)return s;let n=w(t)&&w(s);if(!n&&!(N(t)&&N(s)))return s;let a=(n?t:Object.keys(t)).length,i=n?s:Object.keys(s),o=i.length,l=n?Array(o):{},u=0;for(let c=0;c<o;c++){let o=n?c:i[c],d=t[o],g=s[o];if(d===g){l[o]=d,(n?c<a:j.call(t,o))&&u++;continue}if(null===d||null===g||"object"!=typeof d||"object"!=typeof g){l[o]=g;continue}let m=e(d,g,r+1);l[o]=m,m===d&&u++}return a===o&&u===a?t:l}(s,e):e);return this.#h({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#h({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#d?.promise;return this.#d?.cancel(e),t?t.then(p).catch(p):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#o)}isActive(){return this.observers.some(e=>{var t;return!1!==(t=e.options.enabled,"function"==typeof t?t(this):t)})}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===T||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===f(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!Math.max(this.state.dataUpdatedAt+(e||0)-Date.now(),0))}onFocus(){let e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}onOnline(){let e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#d&&(this.#m?this.#d.cancel({revert:!0}):this.#d.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#h({type:"invalidate"})}async fetch(e,t){let s;if("idle"!==this.state.fetchStatus&&this.#d?.status()!=="rejected"){if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#d)return this.#d.continueRetry(),this.#d.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let r=new AbortController,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#m=!0,r.signal)})},a=()=>{let e,s=A(this.options,t),r=(n(e={client:this.#c,queryKey:this.queryKey,meta:this.meta}),e);return(this.#m=!1,this.options.persister)?this.options.persister(s,r,this):s(r)},i=(n(s={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:a}),s);this.options.behavior?.onFetch(i,this),this.#l=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#h({type:"fetch",meta:i.fetchOptions?.meta}),this.#d=F({initialPromise:t?.initialPromise,fn:i.fetchFn,onCancel:e=>{e instanceof P&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),r.abort()},onFail:(e,t)=>{this.#h({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#h({type:"pause"})},onContinue:()=>{this.#h({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0});try{let e=await this.#d.start();if(void 0===e)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof P){if(e.silent)return this.#d.promise;else if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#h({type:"error",error:e}),this.#u.config.onError?.(e,this),this.#u.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#h(e){let t=t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":var s;return{...t,...(s=t.data,{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:D(this.options.networkMode)?"fetching":"paused",...void 0===s&&{error:null,status:"pending"}}),fetchMeta:e.meta??null};case"success":let r={...t,...K(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?r:void 0,r;case"error":let n=e.error;return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),I.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function K(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function U(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,s=void 0!==t,r=s?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var B=class extends M{constructor(e={}){super(),this.config=e,this.#p=new Map}#p;build(e,t,s){let r=t.queryKey,n=t.queryHash??b(r,t),a=this.get(n);return a||(a=new W({client:e,queryKey:r,queryHash:n,options:e.defaultQueryOptions(t),state:s,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#p.has(e.queryHash)||(this.#p.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#p.get(e.queryHash);t&&(e.destroy(),t===e&&this.#p.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){I.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#p.get(e)}getAll(){return[...this.#p.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>x(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>x(e,t)):t}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){I.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){I.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},z=class extends L{#c;#f;#x;#d;constructor(e){super(),this.#c=e.client,this.mutationId=e.mutationId,this.#x=e.mutationCache,this.#f=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#f.includes(e)||(this.#f.push(e),this.clearGcTimeout(),this.#x.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#f=this.#f.filter(t=>t!==e),this.scheduleGc(),this.#x.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#f.length||("pending"===this.state.status?this.scheduleGc():this.#x.remove(this))}continue(){return this.#d?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#h({type:"continue"})},s={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#d=F({fn:()=>this.options.mutationFn?this.options.mutationFn(e,s):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#h({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#h({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#x.canRun(this)});let r="pending"===this.state.status,n=!this.#d.canStart();try{if(r)t();else{this.#h({type:"pending",variables:e,isPaused:n}),this.#x.config.onMutate&&await this.#x.config.onMutate(e,this,s);let t=await this.options.onMutate?.(e,s);t!==this.state.context&&this.#h({type:"pending",context:t,variables:e,isPaused:n})}let a=await this.#d.start();return await this.#x.config.onSuccess?.(a,e,this.state.context,this,s),await this.options.onSuccess?.(a,e,this.state.context,s),await this.#x.config.onSettled?.(a,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(a,null,e,this.state.context,s),this.#h({type:"success",data:a}),a}catch(t){try{await this.#x.config.onError?.(t,e,this.state.context,this,s)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,s)}catch(e){Promise.reject(e)}try{await this.#x.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,s)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,s)}catch(e){Promise.reject(e)}throw this.#h({type:"error",error:t}),t}finally{this.#x.runNext(this)}}#h(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),I.batch(()=>{this.#f.forEach(t=>{t.onMutationUpdate(e)}),this.#x.notify({mutation:this,type:"updated",action:e})})}},q=class extends M{constructor(e={}){super(),this.config=e,this.#v=new Set,this.#b=new Map,this.#y=0}#v;#b;#y;build(e,t,s){let r=new z({client:e,mutationCache:this,mutationId:++this.#y,options:e.defaultMutationOptions(t),state:s});return this.add(r),r}add(e){this.#v.add(e);let t=$(e);if("string"==typeof t){let s=this.#b.get(t);s?s.push(e):this.#b.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#v.delete(e)){let t=$(e);if("string"==typeof t){let s=this.#b.get(t);if(s)if(s.length>1){let t=s.indexOf(e);-1!==t&&s.splice(t,1)}else s[0]===e&&this.#b.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=$(e);if("string"!=typeof t)return!0;{let s=this.#b.get(t),r=s?.find(e=>"pending"===e.state.status);return!r||r===e}}runNext(e){let t=$(e);if("string"!=typeof t)return Promise.resolve();{let s=this.#b.get(t)?.find(t=>t!==e&&t.state.isPaused);return s?.continue()??Promise.resolve()}}clear(){I.batch(()=>{this.#v.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#v.clear(),this.#b.clear()})}getAll(){return Array.from(this.#v)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>v(t,e))}findAll(e={}){return this.getAll().filter(t=>v(e,t))}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return I.batch(()=>Promise.all(e.map(e=>e.continue().catch(p))))}};function $(e){return e.options.scope?.id}function H(e){return{onFetch:(t,s)=>{let r=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],i=t.state.data?.pageParams||[],o={pages:[],pageParams:[]},l=0,u=async()=>{let s=!1,u=A(t.options,t.fetchOptions),c=async(e,r,n)=>{if(s)return Promise.reject();if(null==r&&e.pages.length)return Promise.resolve(e);let a=(()=>{var e,a;let i,o,l={client:t.client,queryKey:t.queryKey,pageParam:r,direction:n?"backward":"forward",meta:t.options.meta};return e=()=>t.signal,a=()=>s=!0,o=!1,Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(i??=e(),o||(o=!0,i.aborted?a():i.addEventListener("abort",a,{once:!0})),i)}),l})(),i=await u(a),{maxPages:o}=t.options,l=n?E:S;return{pages:l(e.pages,i,o),pageParams:l(e.pageParams,r,o)}};if(n&&a.length){let e="backward"===n,t={pages:a,pageParams:i},s=(e?function(e,{pages:t,pageParams:s}){return t.length>0?e.getPreviousPageParam?.(t[0],t,s[0],s):void 0}:G)(r,t);o=await c(t,s,e)}else{let t=e??a.length;do{let e=0===l?i[0]??r.initialPageParam:G(r,o);if(l>0&&null==e)break;o=await c(o,e),l++}while(l<t)}return o};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s):t.fetchFn=u}}}function G(e,{pages:t,pageParams:s}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,s[r],s):void 0}var V=class{#k;#x;#g;#j;#w;#N;#C;#S;constructor(e={}){this.#k=e.queryCache||new B,this.#x=e.mutationCache||new q,this.#g=e.defaultOptions||{},this.#j=new Map,this.#w=new Map,this.#N=0}mount(){this.#N++,1===this.#N&&(this.#C=O.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#k.onFocus())}),this.#S=_.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#k.onOnline())}))}unmount(){this.#N--,0===this.#N&&(this.#C?.(),this.#C=void 0,this.#S?.(),this.#S=void 0)}isFetching(e){return this.#k.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#x.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#k.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),s=this.#k.build(this,t),r=s.state.data;return void 0===r?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(f(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#k.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,s){let r=this.defaultQueryOptions({queryKey:e}),n=this.#k.get(r.queryHash),a=n?.state.data,i="function"==typeof t?t(a):t;if(void 0!==i)return this.#k.build(this,r).setData(i,{...s,manual:!0})}setQueriesData(e,t,s){return I.batch(()=>this.#k.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,s)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#k.get(t.queryHash)?.state}removeQueries(e){let t=this.#k;I.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let s=this.#k;return I.batch(()=>(s.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let s={revert:!0,...t};return Promise.all(I.batch(()=>this.#k.findAll(e).map(e=>e.cancel(s)))).then(p).catch(p)}invalidateQueries(e,t={}){return I.batch(()=>(this.#k.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let s={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(I.batch(()=>this.#k.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,s);return s.throwOnError||(t=t.catch(p)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(p)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let s=this.#k.build(this,t);return s.isStaleByTime(f(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(p).catch(p)}fetchInfiniteQuery(e){return e.behavior=H(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(p).catch(p)}ensureInfiniteQueryData(e){return e.behavior=H(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return _.isOnline()?this.#x.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#k}getMutationCache(){return this.#x}getDefaultOptions(){return this.#g}setDefaultOptions(e){this.#g=e}setQueryDefaults(e,t){this.#j.set(y(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#j.values()],s={};return t.forEach(t=>{k(e,t.queryKey)&&Object.assign(s,t.defaultOptions)}),s}setMutationDefaults(e,t){this.#w.set(y(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#w.values()],s={};return t.forEach(t=>{k(e,t.mutationKey)&&Object.assign(s,t.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#g.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=b(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===T&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#g.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#k.clear(),this.#x.clear()}},X=l.createContext(void 0),Q=({client:e,children:t})=>(l.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,o.jsx)(X.Provider,{value:e,children:t})),Y=e.i(531278),J=e.i(610595),Z=e.i(941693),ee=e.i(297629);e.i(67407);var et=e.i(282155),es=e.i(671010),er=e.i(272012),en=e.i(163308),ea=e.i(800692),ei=e.i(472402),eo=e.i(230374);function el({children:e}){let{accessToken:t,logout:s}=(0,ea.useAuth)(),{resolvedTheme:r}=(0,c.useTheme)(),n=(0,l.useCallback)(()=>t,[t]),a=(0,l.useCallback)(()=>s(),[s]),i=(0,l.useMemo)(()=>new er.Stigmer({baseUrl:(0,ei.getApiBaseUrl)(),getAccessToken:n,onUnauthenticated:a}),[n,a]),{mode:u}=(0,eo.useDeploymentMode)(i);return(0,o.jsx)(en.StigmerProvider,{client:i,deploymentMode:u,colorMode:"dark"===r?"dark":"light",preset:"monochrome",children:e})}var eu=e.i(846696),ec=e.i(444868);function ed(e){let t=(0,ec.useColorMode)();return(0,o.jsx)(eu.Toaster,{theme:t,position:"top-right",richColors:!0,className:"toaster stg:group",toastOptions:{classNames:{toast:"stg:group toast stg:group-[.toaster]:bg-background stg:group-[.toaster]:text-foreground stg:group-[.toaster]:border-border stg:group-[.toaster]:shadow-lg",description:"stg:group-[.toast]:text-muted-foreground",actionButton:"stg:group-[.toast]:bg-primary stg:group-[.toast]:text-primary-foreground",cancelButton:"stg:group-[.toast]:bg-muted stg:group-[.toast]:text-muted-foreground"}},...e})}var eg=e.i(63209),em=e.i(16715),eh=e.i(607486),ep=e.i(292270),ef=e.i(379185);let ex=["/invite/"];function ev({children:e}){let t=(0,u.usePathname)(),{state:s,retry:r,refresh:n}=function(e){let{isBypassed:t}=e,{orgs:s,isLoading:r,error:n,retry:a,refresh:i}=(0,ee.useOrg)();return{state:t?{status:"bypassed"}:r?{status:"loading"}:n?{status:"error",message:n}:0===s.length?{status:"no-orgs"}:{status:"ready"},retry:a,refresh:i}}({isBypassed:ex.some(e=>t.startsWith(e))});switch(s.status){case"bypassed":case"ready":return(0,o.jsx)(o.Fragment,{children:e});case"loading":return(0,o.jsx)(ey,{});case"error":return(0,o.jsx)(ek,{message:s.message,onRetry:r});case"no-orgs":return(0,o.jsx)(ej,{onRefresh:n})}}function eb(){let{user:e,logout:t}=(0,ea.useAuth)();if(!e)return null;let s=(e.name??e.email).charAt(0).toUpperCase();return(0,o.jsxs)("div",{className:"absolute top-0 right-0 flex items-center gap-3 p-4",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("div",{className:"bg-muted text-muted-foreground flex size-6 shrink-0 items-center justify-center rounded-full",children:(0,o.jsx)("span",{className:"text-xs font-medium",children:s})}),(0,o.jsx)("span",{className:"text-muted-foreground text-sm",children:e.email})]}),(0,o.jsxs)("button",{onClick:t,className:"text-muted-foreground hover:text-foreground inline-flex cursor-pointer items-center gap-1.5 text-sm transition-colors",children:[(0,o.jsx)(ep.LogOut,{className:"size-3.5"}),"Sign out"]})]})}function ey(){return(0,o.jsx)("div",{className:"flex min-h-screen flex-col items-center justify-center gap-3",children:(0,o.jsx)(Y.Loader2,{className:"text-muted-foreground size-8 animate-spin"})})}function ek({message:e,onRetry:t}){return(0,o.jsxs)("div",{className:"relative flex min-h-screen flex-col items-center justify-center gap-4 p-8",children:[(0,o.jsx)(eb,{}),(0,o.jsx)(eg.AlertCircle,{className:"text-destructive size-8"}),(0,o.jsx)("p",{className:"text-destructive text-sm font-medium",children:"Failed to load organizations"}),(0,o.jsx)("p",{className:"text-muted-foreground max-w-md text-center text-sm",children:e}),(0,o.jsxs)("button",{onClick:t,className:"bg-primary text-primary-foreground hover:bg-primary-hover inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium",children:[(0,o.jsx)(em.RefreshCw,{className:"size-3"}),"Try again"]})]})}function ej({onRefresh:e}){let t=(0,l.useCallback)(t=>{e(t.metadata?.slug)},[e]);return(0,o.jsxs)("div",{className:"relative flex min-h-screen flex-col items-center justify-center p-8",children:[(0,o.jsx)(eb,{}),(0,o.jsxs)("div",{className:"w-full max-w-sm space-y-6",children:[(0,o.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center",children:[(0,o.jsx)("div",{className:"bg-muted flex size-12 items-center justify-center rounded-full",children:(0,o.jsx)(eh.Building2,{className:"text-muted-foreground size-6"})}),(0,o.jsx)("h1",{className:"text-foreground text-lg font-semibold",children:"Welcome to Stigmer"}),(0,o.jsx)("p",{className:"text-muted-foreground text-sm",children:"Create an organization to get started. Organizations are the top-level context that owns your agents, environments, and resources."})]}),(0,o.jsx)(ef.CreateOrganizationForm,{onCreated:t})]})]})}var ew=e.i(910304);async function eN(e,t){try{return{account:await e.identityAccount.whoAmI(),created:!1}}catch(e){if(!(0,ew.isNotFound)(e))throw e}return t?.onProvisioning?.(),{account:await e.identityAccount.provisionMyAccount(),created:!0}}var eC=e.i(586108),eS=e.i(326283);let eE=Object.freeze({status:"ready",account:null});var eT=e.i(707125);function eA({children:e}){let{state:t,retry:s}=function(e){let{isEnabled:t}=e,s=(0,eC.useStigmer)(),[r,n]=(0,l.useState)(t?{status:"checking"}:eE),a=(0,l.useRef)(0),i=(0,l.useCallback)(async()=>{let e=++a.current;n({status:"checking"});try{let{account:t}=await eN(s,{onProvisioning:()=>{e===a.current&&n({status:"provisioning"})}});if(e!==a.current)return;n({status:"ready",account:t})}catch(t){if(e!==a.current)return;n({status:"error",message:(0,eS.toError)(t).message})}},[s]);return(0,l.useEffect)(()=>{t?i():n(eE)},[t,i]),{state:r,retry:(0,l.useCallback)(()=>{t&&i()},[t,i])}}({isEnabled:"oidc"===(0,eT.getRuntimeConfig)().authMode});switch(t.status){case"ready":return(0,o.jsx)(o.Fragment,{children:e});case"checking":return(0,o.jsx)(eM,{});case"provisioning":return(0,o.jsx)(eO,{});case"error":return(0,o.jsx)(e_,{message:t.message,onRetry:s})}}function eI(){let{user:e,logout:t}=(0,ea.useAuth)();if(!e)return null;let s=(e.name??e.email).charAt(0).toUpperCase();return(0,o.jsxs)("div",{className:"absolute top-0 right-0 flex items-center gap-3 p-4",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("div",{className:"bg-muted text-muted-foreground flex size-6 shrink-0 items-center justify-center rounded-full",children:(0,o.jsx)("span",{className:"text-xs font-medium",children:s})}),(0,o.jsx)("span",{className:"text-muted-foreground text-sm",children:e.email})]}),(0,o.jsxs)("button",{onClick:t,className:"text-muted-foreground hover:text-foreground inline-flex cursor-pointer items-center gap-1.5 text-sm transition-colors",children:[(0,o.jsx)(ep.LogOut,{className:"size-3.5"}),"Sign out"]})]})}function eM(){return(0,o.jsx)("div",{className:"flex min-h-screen flex-col items-center justify-center gap-3",children:(0,o.jsx)(Y.Loader2,{className:"text-muted-foreground size-8 animate-spin"})})}function eO(){let{user:e}=(0,ea.useAuth)(),t=e?.name??e?.email;return(0,o.jsxs)("div",{className:"relative flex min-h-screen flex-col items-center justify-center p-8",children:[(0,o.jsx)(eI,{}),(0,o.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center",children:[e&&(0,o.jsx)("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:(0,o.jsx)("span",{className:"text-muted-foreground text-lg font-medium",children:(t??"?").charAt(0).toUpperCase()})}),(0,o.jsxs)("div",{className:"space-y-1.5",children:[(0,o.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:t?`Welcome, ${t}!`:"Welcome!"}),(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:"Setting up your account…"})]}),(0,o.jsx)(Y.Loader2,{className:"text-muted-foreground size-5 animate-spin"})]})]})}function e_({message:e,onRetry:t}){return(0,o.jsxs)("div",{className:"relative flex min-h-screen flex-col items-center justify-center gap-4 p-8",children:[(0,o.jsx)(eI,{}),(0,o.jsx)(eg.AlertCircle,{className:"text-destructive size-8"}),(0,o.jsx)("p",{className:"text-destructive text-sm font-medium",children:"Failed to set up your account"}),(0,o.jsx)("p",{className:"text-muted-foreground max-w-md text-center text-sm",children:e}),(0,o.jsxs)("button",{onClick:t,className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary-hover",children:[(0,o.jsx)(em.RefreshCw,{className:"size-3"}),"Try again"]})]})}let eR=["/login","/invite/"],eD=["/chat/"],eP=new V({defaultOptions:{queries:{staleTime:3e4,retry:(e,t)=>!!(0,J.isRetryableError)(t)&&e<1,refetchOnWindowFocus:!0},mutations:{retry:!1}}});function eF({children:e}){let t=(0,u.usePathname)(),s=eR.some(e=>t.startsWith(e)),r=eD.some(e=>t.startsWith(e));return s?(0,o.jsx)(o.Fragment,{children:e}):r?(0,o.jsx)(et.AuthProvider,{children:e}):(0,o.jsx)(et.AuthProvider,{children:(0,o.jsx)(l.Suspense,{fallback:(0,o.jsx)(eW,{}),children:(0,o.jsx)(es.AuthGuard,{children:(0,o.jsx)(Q,{client:eP,children:(0,o.jsx)(el,{children:(0,o.jsx)(eA,{children:(0,o.jsx)(Z.FetchCacheProvider,{children:(0,o.jsx)(ee.OrgProvider,{children:(0,o.jsxs)(ev,{children:[e,(0,o.jsx)(ed,{})]})})})})})})})})})}function eL({children:e}){let[t,s]=(0,l.useState)(!1),[r,n]=(0,l.useState)(null);return((0,l.useEffect)(()=>{(0,eT.loadRuntimeConfig)().then(()=>s(!0)).catch(e=>{n(e instanceof Error?e.message:"Failed to load configuration")})},[]),r)?(0,o.jsxs)("div",{className:"flex min-h-screen flex-col items-center justify-center gap-3 p-8",children:[(0,o.jsx)("p",{className:"text-destructive text-sm font-medium",children:"Configuration Error"}),(0,o.jsx)("p",{className:"text-muted-foreground max-w-md text-center text-sm",children:r})]}):t?(0,o.jsx)(o.Fragment,{children:e}):(0,o.jsx)(eW,{})}function eW(){return(0,o.jsx)("div",{className:"flex min-h-screen flex-col items-center justify-center gap-3",children:(0,o.jsx)(Y.Loader2,{className:"text-muted-foreground size-8 animate-spin"})})}e.s(["Providers",0,function({children:e}){return(0,o.jsx)(eL,{children:(0,o.jsx)(d,{attribute:"class",defaultTheme:"system",enableSystem:!0,children:(0,o.jsx)(eF,{children:e})})})}],693079)},36634,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(312056);let n=(0,s.createContext)(null),a=/^\/sessions\/(.+)/;function i(e){return"/"===e||a.test(e)}e.s(["SessionNavigationProvider",0,function({children:e}){let{currentPath:o,navigate:l}=(0,r.useAppNavigation)(),u=i(o),c=u?o.match(a)?.[1]??null:null,[d,g]=(0,s.useState)(null),m=(0,s.useRef)(o);(0,s.useEffect)(()=>{let e=m.current;i(e)&&!i(o)&&g(e),m.current=o},[o]);let h=(0,s.useCallback)(e=>{l(`/sessions/${e}`)},[l]),p=(0,s.useCallback)(()=>{l("/")},[l]),f=(0,s.useMemo)(()=>({activeSessionId:c,isSessionZone:u,lastSessionZonePath:d,navigateToSession:h,navigateToHome:p}),[c,u,d,h,p]);return(0,t.jsx)(n.Provider,{value:f,children:e})},"isSessionZonePath",0,i,"useSessionNavigation",0,function(){let e=(0,s.useContext)(n);if(!e)throw Error("useSessionNavigation must be used within <SessionNavigationProvider>");return e}])},936636,e=>{"use strict";var t,s,r,n=e.i(843476),a=e.i(271645),i=e.i(618566),o=e.i(475254);let l=(0,o.default)("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);var u=e.i(893976),c=e.i(586108),d=e.i(583093);function g(e){let t=(0,c.useStigmer)(),s=e?async()=>{let s=await t.agentExecution.get(e);return s.spec?.sessionId??null}:null,{data:r,isLoading:n,error:a}=(0,d.useFetch)(s,[e,t],null);return{sessionId:r,isLoading:n,error:a}}var m=e.i(102508),h=e.i(36634),p=e.i(635549),f=e.i(846696),x=e.i(275051),v=e.i(615987);function b(){let{account:e}=(0,v.useMyIdentityAccount)();return(0,a.useMemo)(()=>{let t=e?.spec?.preferences;if(!t)return;let s="native"===t.defaultHarness||"cursor"===t.defaultHarness?t.defaultHarness:void 0,r=t.defaultNativeModel||void 0,n=t.defaultCursorModel||void 0,a=t.defaultAutoApprove||void 0;if(s||r||n||a)return{harness:s,nativeModel:r,cursorModel:n,autoApprove:a}},[e])}var y=e.i(55389);let k=/github\.com[/:]([^/]+)\/([^/.]+?)(?:\.git)?$/;function j(e){let t=e.match(k);return t?{owner:t[1],repo:t[2]}:null}let w={path:"... (tree truncated by GitHub — repository has too many files)",isDirectory:!1,notice:!0};function N(e){let t=(0,a.useCallback)(async t=>{if("git"!==t.type||!t.gitUrl||!e)return null;let s=j(t.gitUrl);if(!s)return null;let r=t.readRef||t.gitBranch||"main",n=`https://api.github.com/repos/${s.owner}/${s.repo}/git/trees/${encodeURIComponent(r)}?recursive=1`,a=await fetch(n,{headers:{Authorization:`Bearer ${e}`}});if(!a.ok)return null;let i=await a.json(),o=i.tree.filter(e=>"blob"===e.type||"tree"===e.type).map(e=>({path:e.path,isDirectory:"tree"===e.type}));return i.truncated&&o.push(w),o},[e]);if(e)return t}var C=e.i(850429);function S(e){let t=atob(e.replace(/\s/g,""));return Uint8Array.from(t,e=>e.charCodeAt(0))}function E(e,t,s=null){if(function(e){let t=Math.min(e.length,8e3);for(let s=0;s<t;s++)if(0===e[s])return!0;return!1}(e))return{text:null,isBinary:!0,size:t,encoding:"base64",...null!==s&&e.length<=C.MAX_WORKSPACE_IMAGE_READ_BYTES?{bytes:e}:{}};let r=function(e){try{return new TextDecoder("utf-8",{fatal:!0}).decode(e)}catch{return null}}(e);if(null===r)return{text:null,isBinary:!1,size:t,encoding:"unknown"};let n=e.length>C.MAX_WORKSPACE_FILE_READ_BYTES;return{text:n?r.slice(0,C.MAX_WORKSPACE_FILE_READ_BYTES):r,isBinary:!1,size:t,encoding:"utf-8",...n?{truncated:!0}:{}}}let T="https://api.github.com/repos";function A(e){let t=(0,a.useCallback)(async(t,s)=>{if("git"!==t.type||!t.gitUrl||!e)return null;let r=j(t.gitUrl);if(!r)return null;let n=t.readRef||t.gitBranch||"main",a=`${T}/${r.owner}/${r.repo}/contents/${s.split("/").map(encodeURIComponent).join("/")}?ref=${encodeURIComponent(n)}`,i=await fetch(a,{headers:{Authorization:`Bearer ${e}`}});if(404===i.status)throw new C.WorkspaceFileNotFoundError(s);if(!i.ok)throw Error(`GitHub content fetch failed for ${s} (HTTP ${i.status})`);let o=await i.json();if(Array.isArray(o))throw Error(`Cannot read "${s}": path is a directory`);return"base64"===o.encoding?E(S(o.content),o.size,(0,C.workspaceImageMimeType)(s)):I(r,o,s,e)},[e]);if(e)return t}async function I(e,t,s,r){if(t.size>0xa00000)return{text:null,isBinary:!1,size:t.size,encoding:"none",truncated:!0};let n=`${T}/${e.owner}/${e.repo}/git/blobs/${t.sha}`,a=await fetch(n,{headers:{Authorization:`Bearer ${r}`}});if(!a.ok)throw Error(`GitHub blob fetch failed for ${t.sha} (HTTP ${a.status})`);let i=await a.json();return E(S(i.content),i.size,(0,C.workspaceImageMimeType)(s))}var M=e.i(433732),O=e.i(597744);function _(e){let t=(0,M.useExecutionTarget)(),s=(0,O.useDeploymentMode)(),r=e?.hasLocalPicker??!1;return(0,a.useMemo)(()=>"cloud"===(t??("local"===s?"local":"cloud"))?{enableGitHub:!0,enableLocal:!1}:{enableGitHub:!r,enableLocal:!0},[t,s,r])}var R=e.i(297629);function D(){let e=(0,i.useSearchParams)(),t=(0,R.useActiveOrgSlug)(),s=b(),r=(0,y.useGitHubConnection)(t),{enableGitHub:o,enableLocal:l}=_(),u=N(r.token),c=A(r.token),{navigateToSession:d}=(0,h.useSessionNavigation)(),g=e.get("agent"),m=e.get("instance"),[p,v]=(0,a.useState)(()=>P(g)),[k,j]=(0,a.useState)(()=>m??void 0);return void 0===p&&g&&(v(P(g)),j(m??void 0)),(0,a.useEffect)(()=>{g&&window.history.replaceState({},"","/")},[g]),(0,n.jsx)(x.NewSessionViewer,{org:t,onSessionCreated:d,onError:e=>f.toast.error(e),accountDefaults:s,gitHubConnection:o?r:void 0,enableGitHub:o,enableLocal:l,workspaceFileLister:u,workspaceFileReader:c,initialAgentRef:p,initialInstanceId:k,className:"h-full"})}function P(e){if(!e)return;let t=e.indexOf("/");if(!(t<=0)&&t!==e.length-1)return{org:e.slice(0,t),slug:e.slice(t+1)}}var F=e.i(766895),L=e.i(217127),W=e.i(170255);e.i(107141);var K=e.i(352082);function U({id:e}){let t=(0,R.useActiveOrgSlug)(),s=(0,R.useActiveOrgId)(),r=(0,y.useGitHubConnection)(t),{enableGitHub:a,enableLocal:i}=_(),o=N(r.token),l=A(r.token),u=b();return(0,n.jsx)("div",{className:"flex h-full w-full flex-col",children:(0,n.jsx)(F.SessionViewer,{sessionId:e,org:t,accountDefaults:u,gitHubConnection:a?r:void 0,enableGitHub:a,enableLocal:i,workspaceFileLister:o,workspaceFileReader:l,accessSlot:(0,n.jsx)(L.ManageAccessButton,{resource:{kind:W.ApiResourceKind.session,kindString:"session",id:e,org:s}})})})}var B=e.i(566022),z=e.i(735922),q=e.i(910304),$=e.i(205730);let H=new Set([B.ExecutionPhase.EXECUTION_COMPLETED,B.ExecutionPhase.EXECUTION_FAILED,B.ExecutionPhase.EXECUTION_CANCELLED,B.ExecutionPhase.EXECUTION_TERMINATED]);function G(e){let t=(0,c.useStigmer)(),s=(0,$.useRunnerAdapter)(),r=(0,M.useExecutionTarget)(),n=(0,a.useRef)(null),i=e?async()=>{try{return await t.workflowExecution.get(e)}catch(e){if((0,q.isNotFound)(e))return null;throw e}}:null,{data:o,isLoading:l,isRefetching:u,error:g,refetch:m}=(0,d.useFetch)(i,[e,t],null,{cacheKey:e?`workflow-execution:${e}`:void 0});return(0,a.useEffect)(()=>{let t=o?.status?.phase,a=o?.metadata?.id;s&&"local"===r&&e&&null!=t&&H.has(t)&&a===e&&n.current!==e&&(n.current=e,s.onWorkflowExecutionTerminated(e).catch(()=>{}))},[o?.status?.phase,o?.metadata?.id,e,s,r]),(0,a.useEffect)(()=>{n.current=null},[e]),{execution:o,isLoading:l,isRefetching:u,error:g,refetch:m}}var V=e.i(891287),X=e.i(218766),Q=e.i(610595),Y=e.i(326283),J=e.i(868278),Z=e.i(777489),ee=e.i(661438);let et={stage:"idle"},es=BigInt(0),er=BigInt(-1),en={costConsumedMicros:es,costRemainingMicros:er,tokensConsumed:es,tokensRemaining:er,thresholdBreached:!1};class ea{_events=[];_streamState=et;_listeners=new Set;_taskStatesCache=null;_costSummaryCache=null;_totalTasks=0;appendEvents(e){if(0===e.length)return;let t=this._events.length>0?this._events[this._events.length-1].sequenceNumber:es,s=e.filter(e=>e.sequenceNumber>t);if(0!==s.length){for(let e of(s.sort((e,t)=>e.sequenceNumber<t.sequenceNumber?-1:+(e.sequenceNumber>t.sequenceNumber)),this._events=[...this._events,...s],this._taskStatesCache=null,this._costSummaryCache=null,s))e.eventType===Z.WorkflowEventType.execution_started&&"executionStarted"===e.payload.case&&(this._totalTasks=e.payload.value.totalTasks);this._notify()}}setStreamState(e){var t,s;t=this._streamState,s=e,t.stage===s.stage&&("idle"===t.stage||"error"===t.stage&&"error"===s.stage&&t.executionId===s.executionId&&t.error===s.error||"reconnecting"===t.stage&&"reconnecting"===s.stage&&t.executionId===s.executionId&&t.attempt===s.attempt||"executionId"in t&&"executionId"in s&&t.executionId===s.executionId)||(this._streamState=e,this._notify())}reset(){let e=0===this._events.length&&"idle"===this._streamState.stage;this._events=[],this._streamState=et,this._taskStatesCache=null,this._costSummaryCache=null,this._totalTasks=0,e||this._notify()}subscribe=e=>(this._listeners.add(e),()=>{this._listeners.delete(e)});getEvents=()=>this._events;getStreamState=()=>this._streamState;getLatestSequence=()=>0===this._events.length?es:this._events[this._events.length-1].sequenceNumber;getTotalTasks=()=>this._totalTasks;getTaskStates=()=>(this._taskStatesCache||(this._taskStatesCache=function(e){let t=new Map;for(let n of e){let e=n.taskName;if(!e)continue;let a=t.get(e),i=n.payload;switch(i.case){case"taskStarted":t.set(e,{taskName:e,taskKind:i.value.taskKind,status:"running",durationMs:0,costMicros:a?.costMicros??es,tokensUsed:a?.tokensUsed??es,attemptNumber:i.value.attemptNumber,error:"",childExecutionId:a?.childExecutionId??"",agentSlug:a?.agentSlug??"",currentToolName:a?.currentToolName??"",messagesCount:a?.messagesCount??0,toolCallsCount:a?.toolCallsCount??0,inputSummary:i.value.inputSummary??a?.inputSummary??null,outputSummary:null,approvalRequest:null,approvalResolution:null});break;case"taskCompleted":t.set(e,{taskName:e,taskKind:i.value.taskKind,status:"completed",durationMs:Number(i.value.durationMs),costMicros:i.value.costMicros,tokensUsed:i.value.tokensUsed,attemptNumber:a?.attemptNumber??1,error:"",childExecutionId:a?.childExecutionId??"",agentSlug:a?.agentSlug??"",currentToolName:"",messagesCount:a?.messagesCount??0,toolCallsCount:a?.toolCallsCount??0,inputSummary:a?.inputSummary??null,outputSummary:i.value.outputSummary??null,approvalRequest:a?.approvalRequest??null,approvalResolution:a?.approvalResolution??null});break;case"taskFailed":t.set(e,{taskName:e,taskKind:i.value.taskKind,status:i.value.willRetry?"retrying":"failed",durationMs:Number(i.value.durationMs),costMicros:a?.costMicros??es,tokensUsed:a?.tokensUsed??es,attemptNumber:i.value.attemptNumber,error:i.value.error,childExecutionId:a?.childExecutionId??"",agentSlug:a?.agentSlug??"",currentToolName:"",messagesCount:a?.messagesCount??0,toolCallsCount:a?.toolCallsCount??0,inputSummary:a?.inputSummary??null,outputSummary:null,approvalRequest:a?.approvalRequest??null,approvalResolution:a?.approvalResolution??null});break;case"taskSkipped":t.set(e,{taskName:e,taskKind:i.value.taskKind,status:"skipped",durationMs:0,costMicros:es,tokensUsed:es,attemptNumber:0,error:"",childExecutionId:a?.childExecutionId??"",agentSlug:"",currentToolName:"",messagesCount:0,toolCallsCount:0,inputSummary:null,outputSummary:null,approvalRequest:null,approvalResolution:null});break;case"taskRetrying":a&&t.set(e,{...a,status:"retrying"});break;case"agentCallStarted":a&&t.set(e,{...a,childExecutionId:i.value.childExecutionId||a.childExecutionId,agentSlug:i.value.agentSlug||a.agentSlug});break;case"agentCallProgress":var s,r;a&&t.set(e,{...a,status:(s=a.status,r=i.value.agentPhase,"running"===s?r===ee.ExecutionPhase.EXECUTION_WAITING_FOR_APPROVAL?"waiting_approval":"running":"waiting_approval"===s?r===ee.ExecutionPhase.EXECUTION_WAITING_FOR_APPROVAL||r===ee.ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED?"waiting_approval":"running":s),childExecutionId:i.value.childExecutionId||a.childExecutionId,currentToolName:i.value.currentToolName||a.currentToolName,messagesCount:i.value.messagesCount||a.messagesCount,toolCallsCount:i.value.toolCallsCount||a.toolCallsCount,tokensUsed:i.value.tokensConsumed>es?i.value.tokensConsumed:a.tokensUsed});break;case"agentCallCompleted":a&&t.set(e,{...a,costMicros:i.value.costMicros,tokensUsed:i.value.tokensConsumed,currentToolName:""});break;case"approvalRequested":a&&t.set(e,{...a,status:"waiting_approval",approvalRequest:i.value,approvalResolution:null});break;case"approvalResolved":a&&t.set(e,{...a,status:"waiting_approval"===a.status?"running":a.status,approvalResolution:i.value})}}return t}(this._events)),this._taskStatesCache);getCostSummary=()=>(this._costSummaryCache||(this._costSummaryCache=function(e){for(let t=e.length-1;t>=0;t--){let s=e[t].payload;if("budgetCheckpoint"===s.case)return{costConsumedMicros:s.value.costConsumedMicros,costRemainingMicros:s.value.costRemainingMicros,tokensConsumed:s.value.tokensConsumed,tokensRemaining:s.value.tokensRemaining,thresholdBreached:s.value.thresholdBreached}}for(let t=e.length-1;t>=0;t--){let s=e[t].payload;if("executionCompleted"===s.case)return{costConsumedMicros:s.value.totalCostMicros,costRemainingMicros:er,tokensConsumed:s.value.totalTokens,tokensRemaining:er,thresholdBreached:!1}}let t=es,s=es;for(let r of e)"taskCompleted"===r.payload.case&&(t+=r.payload.value.costMicros,s+=r.payload.value.tokensUsed);return t>es||s>es?{costConsumedMicros:t,costRemainingMicros:er,tokensConsumed:s,tokensRemaining:er,thresholdBreached:!1}:en}(this._events)),this._costSummaryCache);_notify(){for(let e of this._listeners)e()}}let ei=new Set([B.ExecutionPhase.EXECUTION_COMPLETED,B.ExecutionPhase.EXECUTION_FAILED,B.ExecutionPhase.EXECUTION_CANCELLED,B.ExecutionPhase.EXECUTION_TERMINATED]);function eo(e,t){let s=(0,c.useStigmer)(),r=(0,a.useRef)(null);t?.store||r.current||(r.current=new ea);let n=t?.store??r.current,[i,o]=(0,a.useState)(0),l=(0,a.useCallback)(()=>{o(e=>e+1)},[]),u=t?.eventTypes,d=t?.executionPhase,g=t?.autoReconnect??!0,m=t?.reconnectOptions,h=(0,a.useRef)(n);h.current=n;let p=(0,a.useRef)(void 0),f=(0,a.useRef)(null);(0,a.useEffect)(()=>{var t;if(!e){n.reset(),p.current=void 0,f.current=null;return}let r=new AbortController,i=h.current,o=void 0!==d&&ei.has(d);return null!==f.current&&f.current!==e&&(i.reset(),p.current=void 0),f.current=e,t=p.current,void 0!==t&&void 0!==d&&ei.has(t)&&!ei.has(d)&&i.reset(),p.current=d,o?(i.setStreamState({stage:"connecting",executionId:e}),(async()=>{try{let t=BigInt(0),n=!0;for(;n&&!r.signal.aborted;){let o=await s.workflowExecution.getEventLog((0,V.create)(X.GetEventLogRequestSchema,{executionId:e,afterSequence:t,eventTypes:u?[...u]:[],pageSize:500}));if(r.signal.aborted)return;(0,a.startTransition)(()=>{i.appendEvents(o.events)}),n=o.hasMore,t=o.latestSequence}r.signal.aborted||i.setStreamState({stage:"complete",executionId:e})}catch(t){if(r.signal.aborted)return;i.setStreamState({stage:"error",executionId:e,error:(0,Y.toError)(t)})}})()):(i.setStreamState({stage:"connecting",executionId:e}),(async()=>{let t=r.signal,n=m?.maxAttempts??J.DEFAULT_RECONNECT_MAX_ATTEMPTS,o=0;for(;!t.aborted;)try{let r=i.getLatestSequence();for await(let n of s.workflowExecution.subscribeEvents((0,V.create)(X.SubscribeEventsRequestSchema,{executionId:e,afterSequence:r,eventTypes:u?[...u]:[]}),t)){if(t.aborted)return;o=0,(0,a.startTransition)(()=>{i.appendEvents([n]);let t=i.getStreamState().stage;("connecting"===t||"reconnecting"===t)&&i.setStreamState({stage:"streaming",executionId:e})})}t.aborted||i.setStreamState({stage:"complete",executionId:e});return}catch(r){if(t.aborted)return;let s=(0,Y.toError)(r);if(s.message.includes("UNIMPLEMENTED")||s.message.includes("unimplemented"))return void i.setStreamState({stage:"unsupported",executionId:e});if(!g||!(0,Q.isTransientStreamError)(s)||o>=n)return void i.setStreamState({stage:"error",executionId:e,error:s});o+=1,i.setStreamState({stage:"reconnecting",executionId:e,attempt:o,error:s});try{await (0,J.sleep)((0,J.computeBackoffDelay)(o,m),t)}catch{return}}})()),()=>{r.abort()}},[e,s,i,d]);let x=(0,a.useSyncExternalStore)(n.subscribe,n.getEvents),v=(0,a.useSyncExternalStore)(n.subscribe,n.getTaskStates),b=(0,a.useSyncExternalStore)(n.subscribe,n.getCostSummary),y=(0,a.useSyncExternalStore)(n.subscribe,n.getStreamState),k=(0,a.useSyncExternalStore)(n.subscribe,n.getTotalTasks),j="streaming"===y.stage,w="connecting"===y.stage,N="reconnecting"===y.stage,C="reconnecting"===y.stage?y.attempt:0,S="error"===y.stage?y.error:null;return{events:x,taskStates:v,costSummary:b,streamState:y,totalTasks:k,isStreaming:j,isConnecting:w,isReconnecting:N,reconnectAttempt:C,error:S,reconnect:l}}var el=e.i(202796),eu=e.i(980213);let ec=new Set(["completed","failed","skipped"]),ed=new Set([B.WorkflowTaskStatus.WORKFLOW_TASK_COMPLETED,B.WorkflowTaskStatus.WORKFLOW_TASK_FAILED,B.WorkflowTaskStatus.WORKFLOW_TASK_SKIPPED]);var eg=e.i(945850),em=e.i(565621),eh=e.i(244686),ep=e.i(267460);let ef=new Set([B.ExecutionPhase.EXECUTION_PENDING,B.ExecutionPhase.EXECUTION_IN_PROGRESS]),ex=new Set([B.ExecutionPhase.EXECUTION_COMPLETED,B.ExecutionPhase.EXECUTION_FAILED,B.ExecutionPhase.EXECUTION_CANCELLED,B.ExecutionPhase.EXECUTION_TERMINATED]),ev=(0,a.memo)(function({execution:e,streamState:t,costSummary:s,actions:r,onDiagnose:i,isDiagnosing:o,onCompare:l,headerActions:c,className:d}){let g=e.status?.phase??B.ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED,m=e.metadata?.name??e.metadata?.id??"Execution",h=e.status?.startedAt??"",p=e.status?.completedAt??"",f=(0,a.useMemo)(()=>{if(!h)return null;let e=new Date(h).getTime(),t=p?new Date(p).getTime():Date.now();return(0,ep.formatDuration)(t-e)},[h,p]),x=(0,a.useMemo)(()=>s.costConsumedMicros<=BigInt(0)?null:(0,ep.formatMicroUsd)(s.costConsumedMicros),[s.costConsumedMicros]),v=ef.has(g),b=g===B.ExecutionPhase.EXECUTION_PAUSED,y=g===B.ExecutionPhase.EXECUTION_FAILED,k="streaming"===t.stage||"connecting"===t.stage||"reconnecting"===t.stage;return(0,n.jsxs)("header",{className:(0,u.cn)("stg:flex stg:items-center stg:gap-3 stg:border-b stg:border-border stg:px-4 stg:py-3",d),children:[(0,n.jsx)(eh.WorkflowExecutionPhaseBadge,{phase:g}),(0,n.jsx)("h2",{className:"stg:min-w-0 stg:flex-1 stg:truncate stg:text-sm stg:font-semibold stg:text-foreground",children:m}),f&&(0,n.jsx)("span",{className:"stg:shrink-0 stg:text-xs stg:text-muted-foreground",children:f}),x&&(0,n.jsx)("span",{className:"stg:shrink-0 stg:text-xs stg:text-muted-foreground",children:x}),k&&(0,n.jsxs)("span",{className:"stg:flex stg:items-center stg:gap-1 stg:text-xs stg:text-muted-foreground",children:[(0,n.jsxs)("span",{className:"stg:relative stg:flex stg:h-1.5 stg:w-1.5",children:[(0,n.jsx)("span",{className:"stg:absolute stg:inline-flex stg:h-full stg:w-full stg:animate-ping stg:rounded-full stg:bg-success stg:opacity-75"}),(0,n.jsx)("span",{className:"stg:relative stg:inline-flex stg:h-1.5 stg:w-1.5 stg:rounded-full stg:bg-success"})]}),"Live"]}),(0,n.jsxs)("div",{className:"stg:flex stg:shrink-0 stg:items-center stg:gap-1.5",children:[l&&ex.has(g)&&(0,n.jsx)(eb,{label:"Compare with…",onClick:l,disabled:!1}),v&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eb,{label:"Pause",onClick:()=>r.pause(),disabled:r.isSubmitting}),(0,n.jsx)(eb,{label:"Cancel",variant:"destructive",onClick:()=>r.cancel(),disabled:r.isSubmitting})]}),b&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eb,{label:"Resume",onClick:()=>r.resume(),disabled:r.isSubmitting}),(0,n.jsx)(eb,{label:"Cancel",variant:"destructive",onClick:()=>r.cancel(),disabled:r.isSubmitting})]}),y&&(0,n.jsxs)(n.Fragment,{children:[i&&(0,n.jsx)(eb,{label:o?"Diagnosing…":"Diagnose",onClick:i,disabled:r.isSubmitting||!!o}),(0,n.jsx)(eb,{label:"Recover",onClick:()=>r.recover(),disabled:r.isSubmitting})]}),c&&(0,n.jsx)("div",{className:"stg:relative stg:flex stg:items-center",children:c})]})]})});function eb({label:e,variant:t,onClick:s,disabled:r}){return(0,n.jsx)("button",{type:"button",onClick:s,disabled:r,className:(0,u.cn)("stg:rounded stg:px-2 stg:py-1 stg:text-xs stg:font-medium stg:transition-colors","stg:disabled:pointer-events-none stg:disabled:opacity-50","destructive"===t?"stg:border stg:border-destructive/30 stg:text-destructive stg:hover:bg-destructive/10":"stg:border stg:border-border stg:text-foreground stg:hover:bg-muted"),children:e})}var ey=e.i(59309),ek=e.i(28434),ej=e.i(375954),ew=e.i(574803),eN=e.i(796545),eC=e.i(145995),eS=e.i(839329);let eE={org:"",slug:"workflow-architect"};var eT=e.i(226634),eA=e.i(953520),eI=e.i(163732),eM=e.i(379410);let eO=new Set(["ready","complete","error"]);function e_({executionId:e,org:t,currentWorkflowYaml:s,onApplyFix:r,onClose:i,className:o}){let[l,c]=(0,a.useState)(""),d=(0,a.useRef)(null),g=function(e){let{executionId:t,org:s,autoStart:r=!0,onError:n}=e,[i,o]=(0,a.useState)("idle"),[l,u]=(0,a.useState)(null),[c,d]=(0,a.useState)([]),[g,m]=(0,a.useState)(null),[h,p]=(0,a.useState)(null),f=(0,a.useRef)(s);f.current=s;let x=(0,a.useRef)(t);x.current=t;let v=(0,a.useRef)(n);v.current=n;let b=(0,a.useRef)(null),y=(0,a.useRef)(!1),k=(0,a.useRef)(!1),{create:j}=(0,ey.useCreateSession)(),{create:w}=(0,ek.useCreateAgentExecution)(),N=(0,eN.useConversationStoreRef)(),C=(0,ej.useExecutionStream)(l,{store:N}),S=(0,a.useCallback)(()=>`Diagnose the failed workflow execution \`${x.current}\`.
|
|
2
|
-
|
|
3
|
-
Analyze the failure root cause using the execution status and event log.
|
|
4
|
-
If this is a workflow definition error, generate a validated fix.
|
|
5
|
-
If this is a runtime error, explain the root cause and suggest operational remediation.`,[]);(0,a.useEffect)(()=>{if("streaming"===i&&C.phase!==ee.ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED&&(0,ew.isTerminalPhase)(C.phase)&&!y.current){y.current=!0,C.execution&&d(e=>[...e,C.execution]);let e=C.execution?.status?.structuredOutput;if(e){let t=e.action,s=e.yaml,r=e.explanation;"fix_yaml"===t&&s?(m({yaml:s,explanation:r??""}),o("complete")):o("ready")}else{let e=(0,eC.extractWorkflowYaml)(C.execution);e?(m(e),o("complete")):o("ready")}u(null)}},[i,C.phase,C.execution]),(0,a.useEffect)(()=>{if(C.error&&"streaming"===i){let e=(0,Q.getUserMessage)(C.error,"Agent stream interrupted");o("error"),p(e),v.current?.(e)}},[C.error,i]);let E=(0,a.useCallback)(async()=>{if("idle"===i||"error"===i){o("starting"),p(null),m(null),y.current=!1;try{let e=b.current;if(!e){let{sessionId:t}=await j({org:f.current,agentRef:{...eE,org:f.current}});b.current=t,e=t}let t=S(),{executionId:s}=await w({org:f.current,sessionId:e,message:t,structuredOutputSchema:eS.WORKFLOW_DIAGNOSIS_RESPONSE_SCHEMA});u(s),o("streaming")}catch(t){let e=(0,Q.getUserMessage)(t,"Failed to start the Workflow Architect agent");o("error"),p(e),v.current?.(e)}}},[i,j,w,S]),T=(0,a.useCallback)(async e=>{let t=e.trim();if(t.length<5)return void p("Follow-up must be at least 5 characters");if("ready"===i||"complete"===i||"error"===i){o("starting"),p(null),m(null),y.current=!1;try{let e=b.current;if(!e){let{sessionId:t}=await j({org:f.current,agentRef:{...eE,org:f.current}});b.current=t,e=t}let{executionId:s}=await w({org:f.current,sessionId:e,message:t,structuredOutputSchema:eS.WORKFLOW_DIAGNOSIS_RESPONSE_SCHEMA});u(s),o("streaming")}catch(t){let e=(0,Q.getUserMessage)(t,"Failed to send follow-up to the Workflow Architect agent");o("error"),p(e),v.current?.(e)}}},[i,j,w]),A=(0,a.useCallback)(()=>{if("complete"!==i||!g)return null;let e=g.yaml;return m(null),o("ready"),e},[i,g]),I=(0,a.useCallback)(()=>{"complete"===i&&(m(null),o("ready"))},[i]),M=(0,a.useCallback)(()=>{o("idle"),u(null),d([]),m(null),p(null),b.current=null,y.current=!1,k.current=!1},[]);return(0,a.useEffect)(()=>{r&&"idle"===i&&!k.current&&(k.current=!0,E())},[r,i,E]),(0,a.useMemo)(()=>({phase:i,completedExecutions:c,activeExecution:C.execution,isStreaming:C.isStreaming||C.isConnecting,extractedYaml:g?.yaml??null,explanation:g?.explanation??null,error:h,diagnose:E,sendFollowUp:T,acceptFix:A,discardFix:I,reset:M}),[i,c,C.execution,C.isStreaming,C.isConnecting,g,h,E,T,A,I,M])}({executionId:e,org:t,currentWorkflowYaml:s,autoStart:!0,onError:()=>{}}),m=eO.has(g.phase),h=g.completedExecutions.length>0||null!==g.activeExecution,p=(0,a.useCallback)(async()=>{let e=l.trim();e.length<5||(c(""),await g.sendFollowUp(e),requestAnimationFrame(()=>{d.current?.scrollTo({top:d.current.scrollHeight,behavior:"smooth"})}))},[g.sendFollowUp,l]),f=(0,a.useCallback)(()=>{let e=g.acceptFix();e&&r&&r(e)},[g.acceptFix,r]),x=(0,a.useCallback)(()=>{g.discardFix()},[g.discardFix]),v=(0,a.useCallback)(()=>{g.reset()},[g.reset]),b=(0,a.useCallback)(e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),p())},[p]);return(0,n.jsxs)("div",{className:(0,u.cn)("stg:flex stg:h-full stg:flex-col stg:bg-background",o),role:"complementary","aria-label":"Workflow diagnosis panel",children:[(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between stg:border-b stg:border-border stg:px-3 stg:py-2",children:[(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1.5",children:[(0,n.jsx)(eP,{}),(0,n.jsx)("h3",{className:"stg:text-xs stg:font-semibold stg:text-foreground",children:"AI Diagnosis"}),g.isStreaming&&(0,n.jsxs)("span",{className:"stg:inline-flex stg:items-center stg:gap-1 stg:text-[0.65rem] stg:text-muted-foreground",children:[(0,n.jsx)(eM.SpinnerIcon,{size:10}),"Analyzing…"]})]}),i&&(0,n.jsx)("button",{type:"button",onClick:i,className:"stg:rounded stg:p-0.5 stg:text-muted-foreground stg:hover:bg-muted stg:hover:text-foreground","aria-label":"Close diagnosis panel",children:(0,n.jsx)(eF,{})})]}),(0,n.jsxs)("div",{ref:d,className:"stg:flex stg:min-h-0 stg:flex-1 stg:flex-col stg:overflow-y-auto",children:["starting"===g.phase&&!h&&(0,n.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:gap-2 stg:py-8",children:[(0,n.jsx)(eM.SpinnerIcon,{size:14}),(0,n.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"Starting Workflow Architect…"})]}),h&&(0,n.jsx)(eT.MessageThread,{executions:g.completedExecutions,activeStreamExecution:g.activeExecution,className:"stg:flex-1"}),g.error&&"error"===g.phase&&(0,n.jsxs)("div",{className:"stg:mx-3 stg:mt-3 stg:space-y-2",children:[(0,n.jsx)("div",{className:"stg:rounded-md stg:border stg:border-destructive/30 stg:bg-destructive/5 stg:px-3 stg:py-2 stg:text-xs stg:text-destructive",role:"alert",children:g.error}),(0,n.jsx)("button",{type:"button",onClick:v,className:(0,u.cn)("stg:w-full stg:rounded-md stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium stg:transition-colors","stg:border stg:border-input stg:bg-background stg:text-foreground","stg:hover:bg-accent stg:hover:text-accent-foreground"),children:"Try Again"})]})]}),"complete"===g.phase&&g.extractedYaml&&(0,n.jsx)(eR,{extractedYaml:g.extractedYaml,explanation:g.explanation,beforeYaml:s,onApplyFix:r?f:void 0,onDiscard:x}),"ready"===g.phase&&!g.extractedYaml&&g.completedExecutions.length>0&&(0,n.jsx)("div",{className:"stg:border-t stg:border-border stg:px-3 stg:py-2",children:(0,n.jsx)("div",{className:"stg:rounded-md stg:border stg:border-border stg:bg-muted/50 stg:px-2.5 stg:py-2 stg:text-[0.7rem] stg:text-muted-foreground",children:"No workflow definition changes are needed. Check the analysis above for remediation steps."})}),(0,n.jsxs)("div",{className:"stg:border-t stg:border-border stg:p-3",children:[(0,n.jsx)("textarea",{value:l,onChange:e=>c(e.target.value),onKeyDown:b,placeholder:"Ask a follow-up question...",disabled:!m,rows:2,className:(0,u.cn)("stg:w-full stg:resize-none stg:rounded-md stg:border stg:border-input stg:bg-background stg:px-2.5 stg:py-1.5 stg:text-sm stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50")}),(0,n.jsxs)("div",{className:"stg:mt-2 stg:flex stg:items-center stg:justify-between",children:[(0,n.jsxs)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:["⌘","+Enter to send"]}),(0,n.jsx)("button",{type:"button",onClick:p,disabled:!m||l.trim().length<5,className:(0,u.cn)("stg:inline-flex stg:items-center stg:gap-1.5 stg:rounded-md stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium stg:transition-colors","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary/90","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-40"),children:"Send"})]})]})]})}function eR({extractedYaml:e,explanation:t,beforeYaml:s,onApplyFix:r,onDiscard:i}){let[o,l]=(0,a.useState)(!1),c=s?(0,eA.computeUnifiedDiff)(s,e):null,d=c?.some(e=>"equal"!==e.type)??!1;return(0,n.jsxs)("div",{className:"stg:border-t stg:border-border stg:px-3 stg:py-3","aria-live":"polite",children:[t&&(0,n.jsxs)("div",{className:"stg:mb-3",children:[(0,n.jsx)("h4",{className:"stg:mb-1 stg:text-[0.65rem] stg:font-medium stg:uppercase stg:tracking-wider stg:text-muted-foreground",children:"Suggested Fix"}),(0,n.jsx)("p",{className:"stg:text-xs stg:leading-relaxed stg:text-foreground",children:t})]}),d&&s&&(0,n.jsx)("div",{className:"stg:mb-3",children:(0,n.jsx)("div",{className:"stg:h-[200px] stg:overflow-hidden stg:rounded-md stg:border stg:border-border",children:(0,n.jsx)(eI.WorkflowDiffGraph,{beforeYaml:s,afterYaml:e})})}),d&&c&&(0,n.jsxs)("div",{className:"stg:mb-3",children:[(0,n.jsx)("button",{type:"button",onClick:()=>l(e=>!e),className:"stg:text-[0.65rem] stg:font-medium stg:text-muted-foreground stg:hover:text-foreground",children:o?"▾ Hide YAML diff":"▸ View YAML diff"}),o&&(0,n.jsx)("div",{className:"stg:mt-1",children:(0,n.jsx)(eD,{lines:c})})]}),(0,n.jsxs)("div",{className:"stg:flex stg:gap-2",children:[r&&(0,n.jsx)("button",{type:"button",onClick:r,className:(0,u.cn)("stg:flex-1 stg:rounded-md stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium stg:transition-colors","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary/90","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Apply Fix"}),(0,n.jsx)("button",{type:"button",onClick:i,className:(0,u.cn)("stg:flex-1 stg:rounded-md stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium stg:transition-colors","stg:border stg:border-input stg:bg-background stg:text-foreground","stg:hover:bg-accent stg:hover:text-accent-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Discard"})]})]})}function eD({lines:e}){return e.filter(e=>"equal"!==e.type||""!==e.content.trim()).length>200?(0,n.jsx)("p",{className:"stg:text-[0.7rem] stg:text-muted-foreground",children:"Diff is too large to display. Apply the fix to see the updated YAML."}):(0,n.jsx)("pre",{className:"stg:max-h-60 stg:overflow-auto stg:rounded-md stg:border stg:border-border stg:text-[0.7rem] stg:leading-relaxed",children:e.map((e,t)=>(0,n.jsxs)("div",{className:(0,u.cn)("stg:px-2","added"===e.type&&"stg:bg-success/10 stg:text-success","removed"===e.type&&"stg:bg-destructive/10 stg:text-destructive","equal"===e.type&&"stg:text-muted-foreground"),children:[(0,n.jsx)("span",{className:"stg:mr-2 stg:inline-block stg:w-3 stg:select-none stg:text-right stg:opacity-60",children:"added"===e.type?"+":"removed"===e.type?"-":" "}),e.content]},t))})}function eP(){return(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M8 2l1.5 4.5L14 8l-4.5 1.5L8 14l-1.5-4.5L2 8l4.5-1.5z"})})}function eF(){return(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M4 4l8 8M12 4l-8 8"})})}var eL=e.i(154548),eW=e.i(30590),eK=e.i(882267),eU=e.i(144905),eB=e.i(714028),ez=e.i(678321),eq=e.i(532680),e$=e.i(926059);e.i(222258);var eH=e.i(967785),eG=e.i(242792),eV=e.i(455959);let eX=new Map([["agent","agent_call"],["http","http_call"],["grpc","grpc_call"],["llm","llm_call"],["transform","transform"],["human_input","human_input"],["validate","validate"],["emit_event","emit_event"],["notification","notification"],["eval","eval"]]);var eQ=e.i(286872),eY=e.i(207425);let eJ=new Set(["running","waiting_approval","retrying"]),eZ=new Set(["completed","failed","skipped"]),e0=new Set(["completed","failed"]);async function e1(e,t,s){try{let r=await e.workflow.get(t);return{yaml:(0,e$.serializeWorkflowYaml)(r),isVersionPinned:!1,versionFetchFailed:s}}catch(e){if((0,q.isNotFound)(e))return null;throw e}}var e2=e.i(554823),e5=e.i(188482);let e3=(0,a.memo)(function({activeTask:e,isFollowing:t,onFollowToggle:s,onJumpToTask:r,className:i}){let o="waiting_approval"===e.status,l=e.concurrentCount>1,[c,d]=(0,a.useState)(e.durationMs),g=(0,a.useRef)(null);(0,a.useEffect)(()=>(d(e.durationMs),"running"===e.status&&(g.current=setInterval(()=>{d(e=>e+1e3)},1e3)),()=>{g.current&&(clearInterval(g.current),g.current=null)}),[e.taskName,e.durationMs,e.status]);let m=o?`Awaiting approval: ${e.currentToolName||e.taskName}`:l?`Running: ${e.taskName} (+${e.concurrentCount-1} parallel)`:`Running: ${e.taskName}`,h=o?`Approval required for ${e.currentToolName||e.taskName}`:`Now running: ${e.taskName}`;return(0,n.jsxs)("div",{className:(0,u.cn)("stg:absolute stg:left-3 stg:top-3 stg:z-50 stg:flex stg:items-center stg:gap-2",i),children:[(0,n.jsxs)(e5.Tooltip,{children:[(0,n.jsxs)(e5.TooltipTrigger,{render:(0,n.jsx)("button",{type:"button",onClick:r,className:(0,u.cn)("stg:flex stg:items-center stg:gap-2 stg:rounded-md stg:border stg:px-2.5 stg:py-1.5 stg:text-xs stg:font-medium stg:shadow-sm stg:backdrop-blur-sm stg:transition-colors",o?"stg:border-[var(--stgm-warning,#f59e0b)]/40 stg:bg-[var(--stgm-warning,#f59e0b)]/10 stg:text-[var(--stgm-foreground,#1a1a2e)] stg:hover:bg-[var(--stgm-warning,#f59e0b)]/20":"stg:border-[var(--stgm-primary,#6366f1)]/30 stg:bg-[var(--stgm-card,#fff)]/90 stg:text-[var(--stgm-foreground,#1a1a2e)] stg:hover:bg-[var(--stgm-primary,#6366f1)]/10")}),children:[(0,n.jsx)("span",{className:(0,u.cn)("stg:inline-block stg:h-2 stg:w-2 stg:rounded-full stg:motion-safe:animate-pulse",o?"stg:bg-[var(--stgm-warning,#f59e0b)]":"stg:bg-[var(--stgm-primary,#6366f1)]"),"aria-hidden":"true"}),(0,n.jsx)("span",{children:m}),c>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"stg:text-[var(--stgm-muted-foreground,#737373)]","aria-hidden":"true",children:"·"}),(0,n.jsx)("span",{className:"stg:tabular-nums stg:text-[var(--stgm-muted-foreground,#737373)]",children:(0,ep.formatDuration)(c)})]})]}),(0,n.jsx)(e5.TooltipContent,{side:"bottom",children:"Click to center on active task"})]}),(0,n.jsxs)(e5.Tooltip,{children:[(0,n.jsx)(e5.TooltipTrigger,{render:(0,n.jsx)("button",{type:"button",onClick:s,className:(0,u.cn)("stg:flex stg:h-7 stg:w-7 stg:items-center stg:justify-center stg:rounded-md stg:border stg:shadow-sm stg:backdrop-blur-sm stg:transition-colors",t?"stg:border-[var(--stgm-primary,#6366f1)]/40 stg:bg-[var(--stgm-primary,#6366f1)]/10 stg:text-[var(--stgm-primary,#6366f1)]":"stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-card,#fff)]/90 stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:text-[var(--stgm-foreground,#1a1a2e)]"),"aria-label":t?"Stop following active task":"Follow active task","aria-pressed":t}),children:(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:t?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("circle",{cx:"7",cy:"7",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),(0,n.jsx)("path",{d:"M7 1v2M7 11v2M1 7h2M11 7h2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("path",{d:"M1.5 7s2.2-3.5 5.5-3.5S12.5 7 12.5 7s-2.2 3.5-5.5 3.5S1.5 7 1.5 7z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),(0,n.jsx)("circle",{cx:"7",cy:"7",r:"1.5",stroke:"currentColor",strokeWidth:"1.5"})]})})}),(0,n.jsx)(e5.TooltipContent,{side:"bottom",children:t?"Following active task (click to stop)":"Follow active task"})]}),(0,n.jsx)("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"stg:sr-only",children:h})]})});function e6(e){let[t,s]=(0,a.useState)(""),r=(0,a.useRef)(new Map);return(0,a.useEffect)(()=>{let t=r.current,n=[];for(let[s,r]of e){let e=t.get(s);if(e?.status!==r.status)switch(r.status){case"running":n.push(`Task ${s} started`);break;case"completed":n.push(`Task ${s} completed`);break;case"failed":n.push(r.error?`Task ${s} failed: ${r.error.slice(0,80)}`:`Task ${s} failed`);break;case"waiting_approval":n.push(`Approval required for task ${s}`);break;case"retrying":n.push(`Task ${s} retrying, attempt ${r.attemptNumber}`)}}n.length>0&&s(n.join(". ")),r.current=e},[e]),t}let e7={[eB.CANVAS_TASK_NODE_TYPE]:eK.WorkflowNode},e4={[eB.CANVAS_TRANSITION_EDGE_TYPE]:eU.CanvasTransitionEdge},e8={markerEnd:{type:eW.MarkerType.ArrowClosed,width:16,height:16}},e9=(0,a.memo)(function(e){return(0,n.jsx)(eL.ReactFlowProvider,{children:(0,n.jsx)(tt,{...e})})}),te=new Set([3,4,5,6]);function tt({executionId:e,followExecution:t=!1,execution:s,taskStates:r,panelOffsetPx:i=0,announceTaskStates:o=!0,nodesDraggable:l=!1,className:g}){let{nodes:m,edges:h,isLoading:p,error:f,versionMismatch:x,taskStates:v,executionPhase:b}=function(e){let{executionId:t,nodesDraggable:s=!1}=e,r=(0,c.useStigmer)(),n=G(void 0!==e.execution?null:t),i=void 0!==e.execution?e.execution:n.execution,o=void 0===e.execution&&n.isLoading,l=void 0!==e.execution?null:n.error,u=i?.status?.phase,g=i?.spec?.workflowId||null,m=i?.spec?.workflowInstanceId||null,h=i?.status?.workflowVersionHash||null,p=!g&&m?async()=>{try{let e=await r.workflowInstance.get(m);return e.spec?.workflowId??null}catch{return null}}:null,{data:f}=(0,d.useFetch)(p,[m,r],null),x=g||f,v=x?async()=>{if(h)try{let e=await r.workflow.getVersion((0,V.create)(eq.GetWorkflowVersionInputSchema,{workflowId:x,versionHash:h}));if(e?.validatedYaml)return{yaml:e.validatedYaml,isVersionPinned:!0,versionFetchFailed:!1};return await e1(r,x,!0)}catch{return await e1(r,x,!0)}return await e1(r,x,!1)}:null,{data:b,isLoading:y,error:k}=(0,d.useFetch)(v,[x,h,r],null),j=b?.isVersionPinned??!1,w=(0,a.useMemo)(()=>{if(!b?.yaml)return null;try{let e=!function(e){try{let t=(0,eH.parse)(e);return null!=t&&"object"==typeof t&&!Array.isArray(t)&&"do"in t&&Array.isArray(t.do)}catch{return!1}}(b.yaml)?(0,eB.yamlToGraph)(b.yaml):function(e){let t=function(e){let t;try{t=(0,eH.parse)(e)}catch{throw Error("Failed to parse content as YAML.")}if(!t||"object"!=typeof t||Array.isArray(t))throw Error("YAML must be a mapping document.");return t}(e),s=function(e){let t=e.document;if(!t||"object"!=typeof t||Array.isArray(t))throw Error("CNCF workflow YAML is missing required field: document.");return{dsl:"string"==typeof t.dsl?t.dsl:"1.0.0",namespace:"string"==typeof t.namespace?t.namespace:"",name:"string"==typeof t.name?t.name:"",version:"string"==typeof t.version?t.version:"",..."string"==typeof t.description&&{description:t.description}}}(t),r=t.do;if(!Array.isArray(r)||0===r.length)throw Error("CNCF workflow YAML is missing required field: do (task list).");let n=function(e){let t=[];for(let s of e){if(!s||"object"!=typeof s||Array.isArray(s))continue;let e=Object.keys(s);if(1!==e.length)continue;let r=e[0],n=s[r];if(!n||"object"!=typeof n||Array.isArray(n))continue;let a=function(e,t){let s="string"==typeof t.then?t.then:void 0,r=function(e){let t=e.export;if(!t||"object"!=typeof t||Array.isArray(t))return;let s=t.as;return"string"==typeof s?s:void 0}(t);if("switch"in t&&Array.isArray(t.switch)){let n=function(e){let t=[];for(let s of e){if(!s||"object"!=typeof s||Array.isArray(s))continue;let e=Object.keys(s);if(1!==e.length)continue;let r=e[0],n=s[r];n&&"object"==typeof n&&!Array.isArray(n)?t.push({name:r,when:"string"==typeof n.when?n.when:void 0,then:"string"==typeof n.then?n.then:void 0}):t.push({name:r})}return t}(t.switch),a={cases:n.map(e=>({name:e.name,when:e.when}))};return{name:e,kind:(0,eB.stringToTaskKind)("switch_case"),kindString:"switch_case",config:a,then:s,exportAs:r,switchCases:n}}if("set"in t){let n=t.set??{};return{name:e,kind:(0,eB.stringToTaskKind)("set_vars"),kindString:"set_vars",config:n,then:s,exportAs:r}}if("for"in t){let n=t.for??{};return{name:e,kind:(0,eB.stringToTaskKind)("for_each"),kindString:"for_each",config:{for:n},then:s,exportAs:r}}if("fork"in t){let n=t.fork??{};return{name:e,kind:(0,eB.stringToTaskKind)("fork"),kindString:"fork",config:n,then:s,exportAs:r}}if("try"in t)return{name:e,kind:(0,eB.stringToTaskKind)("try_catch"),kindString:"try_catch",config:{},then:s,exportAs:r};if("run"in t){let n=t.run??{};return{name:e,kind:(0,eB.stringToTaskKind)("run_workflow"),kindString:"run_workflow",config:n,then:s,exportAs:r}}if("call"in t&&"string"==typeof t.call){var n;let a,i=(n=t.call,eX.get(n)??n),o=t.with??{};return"human_input"===i&&Array.isArray(o.outcomes)&&(a=o.outcomes.filter(e=>e&&"object"==typeof e&&"string"==typeof e.name).map(e=>({name:e.name,then:"string"==typeof e.then?e.then:void 0}))),{name:e,kind:(0,eB.stringToTaskKind)(i),kindString:i,config:o,then:s,exportAs:r,outcomeThenEdges:a}}return{name:e,kind:z.WorkflowTaskKind.workflow_task_kind_unspecified,kindString:"unknown",config:{},then:s,exportAs:r}}(r,n);a&&t.push(a)}return t}(r);if(0===n.length)throw Error("CNCF workflow YAML: do list contains no valid task entries.");let a=new Set(n.map(e=>e.name)),i=[],o=[],l=0,u=()=>`e_${l++}`;for(let e of(i.push({id:eG.START_NODE_ID,taskName:"Start",kind:z.WorkflowTaskKind.workflow_task_kind_unspecified,category:"start",config:{},position:{x:0,y:0}}),n))i.push({id:e.name,taskName:e.name,kind:e.kind,category:(0,eV.categorizeKind)(e.kindString),config:e.config,...e.exportAs&&{export:{as:e.exportAs}},...e.then&&{flow:{then:e.then}},position:{x:0,y:0}});o.push({id:u(),source:eG.START_NODE_ID,target:n[0].name});let c=new Set;for(let e=0;e<n.length;e++){let t=n[e];if("end"===t.then){c.add(t.name);continue}if(t.then&&a.has(t.then)){o.push({id:u(),source:t.name,target:t.then});continue}if("switch_case"===t.kindString&&t.switchCases){for(let e of t.switchCases)e.name&&e.then&&a.has(e.then)&&o.push({id:u(),source:t.name,target:e.then,label:e.name,sourceHandle:`case_${e.name}`});!t.switchCases.some(e=>!e.when)&&e<n.length-1&&o.push({id:u(),source:t.name,target:n[e+1].name});continue}if("human_input"===t.kindString&&t.outcomeThenEdges){let e=!1;for(let s of t.outcomeThenEdges)s.name&&s.then&&a.has(s.then)&&(o.push({id:u(),source:t.name,target:s.then,label:s.name,sourceHandle:`outcome_${s.name}`}),e=!0);if(e)continue}e<n.length-1?o.push({id:u(),source:t.name,target:n[e+1].name}):c.add(t.name)}if(c.size>0)for(let e of(i.push({id:eG.END_NODE_ID,taskName:"End",kind:z.WorkflowTaskKind.workflow_task_kind_unspecified,category:"end",config:{},position:{x:0,y:0}}),c))o.push({id:u(),source:e,target:eG.END_NODE_ID});return{document:s,nodes:i,edges:o}}(b.yaml),t=(0,eQ.applyDagreLayout)(e,eY.EXECUTION_DAGRE_CONFIG);return{elements:(0,eB.toReactFlowElements)(t),graphModel:t}}catch{return null}},[b]),N=w?.elements??null,C=w?.graphModel??null,S=eo(void 0!==e.taskStates?null:t,{executionPhase:u}),E=void 0!==e.taskStates?e.taskStates:S.taskStates,T=i?.status?.pendingApprovals,A=(0,a.useMemo)(()=>N?N.nodes.map(e=>{let t,r=e.data;if(r.isSentinel)return s?{...e,draggable:!1}:e;let n=E.get(r.taskName),a=n?{status:n.status,durationMs:n.durationMs,costMicros:n.costMicros,attemptNumber:n.attemptNumber,error:n.error||void 0}:{status:"not_reached"},i=r.kind===z.WorkflowTaskKind.fork&&r.config?function(e,t){let s=e.branches;if(!Array.isArray(s)||0===s.length)return null;let r=!0===e.compete,n=0,a=0;for(let e of s){if(!e||"object"!=typeof e)continue;let s=e.do;if(!Array.isArray(s)||0===s.length){a++;continue}a++,s.every(e=>{if(!e||"object"!=typeof e||!e.name)return!1;let s=t.get(e.name);return s?.status==="completed"})&&n++}return 0===a?null:{completed:n,total:a,compete:r}}(r.config,E):null,o=n?.status==="running"&&n.agentSlug&&(n.currentToolName||n.messagesCount>0)?{agentSlug:n.agentSlug,currentToolName:n.currentToolName,messagesCount:n.messagesCount,toolCallsCount:n.toolCallsCount}:void 0;if(n?.status==="waiting_approval"&&n.childExecutionId&&T){let e=T.find(e=>e.childAgentExecutionId===n.childExecutionId);e?.approval?.toolName&&(t=e.approval.toolName)}return{...e,data:{...r,executionState:a,...i&&{forkProgress:i},...o&&{agentActivity:o},...t&&{approvalToolName:t}},draggable:s,connectable:!1,deletable:!1}}):[],[N,E,T,s]),I=(0,a.useMemo)(()=>{if(!N||!C)return[];let e=function(e,t,s){let r=new Map(t.map(e=>[e.id,e])),n=e=>{let t=r.get(e);if(!t)return"not_reached";var n=t.taskName;if(e===eG.START_NODE_ID)return"completed";if(e===eG.END_NODE_ID)return"not_reached";let a=s.get(n);return a?.status??"not_reached"},a=new Map;for(let t of e){let e=a.get(t.source);e||(e=[],a.set(t.source,e)),e.push(t)}let i=new Set;for(let[e,t]of a)t.some(e=>null!=e.sourceHandle)&&i.add(e);let o=new Map;for(let e of i){let t=(a.get(e)??[]).some(e=>null!=e.sourceHandle&&"not_reached"!==n(e.target));o.set(e,t)}let l=new Map;for(let t of e){let e=n(t.source),s=n(t.target);if("not_reached"===e||"pending"===e){l.set(t.id,"not_reached");continue}let r=e0.has(e);if(r&&eJ.has(s)){l.set(t.id,"active");continue}if(r&&eZ.has(s)){l.set(t.id,"taken");continue}if(eJ.has(e)){l.set(t.id,"not_reached");continue}if(r&&"not_reached"===s&&null!=t.sourceHandle&&i.has(t.source)&&o.get(t.source)){l.set(t.id,"not_taken");continue}if(r&&t.target===eG.END_NODE_ID){l.set(t.id,"taken");continue}l.set(t.id,"not_reached")}return l}(C.edges,C.nodes,E);return N.edges.map(t=>{let s=e.get(t.id);return s&&"not_reached"!==s?{...t,data:{...t.data,executionState:s}}:t})},[N,C,E]),M=b?.versionFetchFailed??!1,O=(0,a.useMemo)(()=>{if(j)return null;if(M&&h)return"Unable to load the pinned workflow version. Showing the current definition as a fallback.";if(!i?.status?.tasks||!N)return null;let e=new Set(i.status.tasks.map(e=>e.taskName).filter(Boolean)),t=new Set(N.nodes.map(e=>e.data.taskName).filter(e=>"Start"!==e&&"End"!==e)),s=[...e].filter(e=>!t.has(e)),r=[...t].filter(t=>!e.has(t));return s.length>0||r.length>0?"This execution predates version tracking. The workflow has since been modified.":null},[i?.status?.tasks,N,j,M,h]),_=o||y,R=l?.message??k?.message??(_||N||!x?null:"Unable to build workflow graph")??null;return{nodes:A,edges:I,executionPhase:u,isLoading:_,error:R,versionMismatch:O,versionResolutionFailed:M,taskStates:E}}({executionId:e,execution:s,taskStates:r,nodesDraggable:l}),{fitView:y}=(0,eL.useReactFlow)(),[k,j]=(0,a.useState)(!1),w=(0,a.useRef)(!1),N=(0,a.useRef)(!1),C=(0,a.useRef)(null),[S,E]=(0,a.useState)({});(0,a.useEffect)(()=>{E({})},[e]);let T=l&&Object.keys(S).length>0,A=(0,a.useCallback)(e=>{if(!l)return;let t=e.filter(e=>"position"===e.type&&"position"in e&&null!=e.position);0!==t.length&&E(e=>{let s={...e};for(let e of t)s[e.id]=e.position;return s})},[l]),I=(0,a.useCallback)(()=>{E({})},[]),M=(0,a.useCallback)(()=>{if(N.current)return;let e=C.current;e&&0!==e.offsetWidth&&0!==e.offsetHeight&&(N.current=!0,y({padding:.15,duration:(0,e2.getAnimationDuration)(300)}),j(!0))},[y]),O=(0,a.useCallback)(()=>{w.current=!0,m.length>0&&M()},[m.length,M]);(0,a.useEffect)(()=>{w.current&&m.length>0&&M()},[m.length,M]),(0,a.useEffect)(()=>{let e=C.current;if(!e||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(()=>{w.current&&m.length>0&&M()});return t.observe(e),()=>t.disconnect()},[m.length,M]);let _=(0,a.useMemo)(()=>{let e=null,t=0;for(let[s,r]of v){if("waiting_approval"===r.status)return{taskName:s,status:"waiting_approval",durationMs:r.durationMs,agentSlug:r.agentSlug,currentToolName:r.currentToolName,concurrentCount:1};"running"===r.status&&(t++,e||(e={taskName:s,status:"running",durationMs:r.durationMs,agentSlug:r.agentSlug,currentToolName:r.currentToolName,concurrentCount:1}))}return e&&t>1?{...e,concurrentCount:t}:e},[v]),R=null!=b&&te.has(b),{isFollowing:D,enableFollow:P,disableFollow:F,handleMoveStart:L}=function(e){let{enabled:t,activeTaskName:s,nodes:r,didInitialFit:n,isTerminal:i,panelOffsetPx:o=0}=e,{setCenter:l,getZoom:u,fitView:c}=(0,eL.useReactFlow)(),[d,g]=(0,a.useState)("auto_fit"),m=(0,a.useRef)(null),h=(0,a.useRef)(null);(0,a.useEffect)(()=>{i&&"auto_fit"!==d&&(g("auto_fit"),m.current=null,c({padding:.15,duration:(0,e2.getAnimationDuration)(300)}))},[i,d,c]),(0,a.useEffect)(()=>{if(!t||!n||"following"!==d||!s||s===m.current)return;let e=r.find(e=>e.data.taskName===s);if(e)return h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{var t;let r,n,a=e.width??e.measured?.width??200,i=e.height??e.measured?.height??56,c=(r=(t={nodeX:e.position.x,nodeY:e.position.y,nodeWidth:a,nodeHeight:i,currentZoom:u(),panelOffsetPx:o}).nodeX+t.nodeWidth/2,n=t.nodeY+t.nodeHeight/2,{x:r-(t.panelOffsetPx>0?t.panelOffsetPx/2/t.currentZoom:0),y:n,zoom:Math.max(t.currentZoom,1)}),d=(0,e2.getAnimationDuration)(400);l(c.x,c.y,{zoom:c.zoom,duration:d}),m.current=s},150),()=>{h.current&&clearTimeout(h.current)}},[t,n,d,s,r,l,u,o]),(0,a.useEffect)(()=>{t&&n&&"auto_fit"===d&&s&&g("following")},[t,n,d,s]);let p=(0,a.useCallback)((e,t)=>{null!==e&&"following"===d&&g("user_control")},[d]);return{followState:d,isFollowing:"following"===d,enableFollow:(0,a.useCallback)(()=>{g("following"),m.current=null},[]),disableFollow:(0,a.useCallback)(()=>{g("user_control")},[]),handleMoveStart:p}}({enabled:t,activeTaskName:_?.taskName??null,nodes:m,didInitialFit:k,isTerminal:R,panelOffsetPx:i}),W=e6(v),K=(0,a.useCallback)((e,t)=>{L(e,t)},[L]),U=(0,a.useMemo)(()=>m.map(e=>{let t=S[e.id];return t?{...e,position:t}:e}),[m,S]);return p?(0,n.jsx)("div",{className:(0,u.cn)("stg:flex stg:h-full stg:items-center stg:justify-center",g),children:(0,n.jsx)(ts,{})}):f?(0,n.jsx)("div",{className:(0,u.cn)("stg:flex stg:h-full stg:flex-col stg:items-center stg:justify-center stg:gap-2 stg:px-6 stg:text-center",g),children:(0,n.jsx)("p",{className:"stg:text-sm stg:text-[var(--stgm-muted-foreground,#737373)]",children:f})}):0===m.length?(0,n.jsx)("div",{className:(0,u.cn)("stg:flex stg:h-full stg:items-center stg:justify-center stg:text-sm stg:text-[var(--stgm-muted-foreground,#737373)]",g),children:"No graph available for this execution"}):(0,n.jsx)(ez.WorkflowGraphModeProvider,{mode:"execution",children:(0,n.jsxs)("div",{ref:C,className:(0,u.cn)("stg:relative stg:h-full stg:w-full",g),children:[x&&(0,n.jsx)("div",{className:"stg:absolute stg:left-3 stg:right-3 stg:top-3 stg:z-50 stg:rounded-md stg:border stg:border-[var(--stgm-warning,#f59e0b)]/30 stg:bg-[var(--stgm-warning,#f59e0b)]/5 stg:px-3 stg:py-2 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)]",children:x}),t&&_&&(0,n.jsx)(e3,{activeTask:_,isFollowing:D,onFollowToggle:D?F:P,onJumpToTask:()=>P()}),T&&(0,n.jsx)("button",{type:"button",onClick:I,className:(0,u.cn)("stg:absolute stg:left-3 stg:z-50 stg:rounded-full stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-background,#fff)] stg:px-3 stg:py-1 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)] stg:shadow-sm stg:transition-colors stg:hover:bg-[var(--stgm-muted,#f5f5f5)]",x?"stg:top-12":"stg:top-3"),children:"Reset layout"}),(0,n.jsxs)(eL.ReactFlow,{nodes:U,edges:h,nodeTypes:e7,edgeTypes:e4,defaultEdgeOptions:e8,onInit:O,onMoveStart:K,onNodesChange:l?A:void 0,nodesDraggable:l,nodesConnectable:!1,nodesFocusable:!1,elementsSelectable:!1,panOnDrag:!0,zoomOnScroll:!0,fitView:!1,minZoom:.2,maxZoom:2,proOptions:{hideAttribution:!0},"aria-label":"Workflow execution graph",children:[(0,n.jsx)(eL.Background,{variant:eL.BackgroundVariant.Dots,gap:16,size:1}),(0,n.jsx)(eL.Controls,{showInteractive:!1}),(0,n.jsx)(eL.MiniMap,{nodeColor:e=>{let t=e.data,s=t.executionState?.status;return"completed"===s?"var(--stgm-success, #22c55e)":"failed"===s?"var(--stgm-destructive, #ef4444)":"running"===s?"var(--stgm-primary, #6366f1)":"var(--stgm-muted, #e5e5e5)"},pannable:!0,zoomable:!0})]}),o&&(0,n.jsx)("div",{role:"log","aria-live":"polite","aria-atomic":"false",className:"stg:sr-only",children:W})]})})}function ts(){return(0,n.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:gap-3",children:[(0,n.jsx)("div",{className:"stg:h-8 stg:w-8 stg:animate-pulse stg:rounded-full stg:bg-[var(--stgm-muted,#e5e5e5)]"}),(0,n.jsx)("div",{className:"stg:h-3 stg:w-24 stg:animate-pulse stg:rounded stg:bg-[var(--stgm-muted,#e5e5e5)]"}),(0,n.jsxs)("div",{className:"stg:mt-2 stg:flex stg:gap-4",children:[(0,n.jsx)("div",{className:"stg:h-10 stg:w-32 stg:animate-pulse stg:rounded-md stg:bg-[var(--stgm-muted,#e5e5e5)]"}),(0,n.jsx)("div",{className:"stg:h-10 stg:w-32 stg:animate-pulse stg:rounded-md stg:bg-[var(--stgm-muted,#e5e5e5)]"})]})]})}var tr=e.i(468806),tn=e.i(879738),ta=e.i(361353);let ti=new Set([B.ExecutionPhase.EXECUTION_COMPLETED,B.ExecutionPhase.EXECUTION_FAILED,B.ExecutionPhase.EXECUTION_CANCELLED,B.ExecutionPhase.EXECUTION_TERMINATED]),to=(0,a.memo)(function({open:e,workflowId:t,baseExecutionId:s,basePhase:r,onConfirm:i,onClose:o}){let[l,c]=(0,a.useState)(null),{executions:d,isLoading:g}=(0,tn.useWorkflowExecutionList)({workflowId:t,pageSize:20}),m=(0,a.useMemo)(()=>d.filter(e=>e.metadata?.id!==s&&ti.has(e.status?.phase??B.ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED)),[d,s]);(0,a.useEffect)(()=>{if(!e||0===m.length||l)return;let t=r===B.ExecutionPhase.EXECUTION_FAILED?B.ExecutionPhase.EXECUTION_COMPLETED:B.ExecutionPhase.EXECUTION_FAILED,s=m.find(e=>e.status?.phase===t),n=m[0];c((s??n)?.metadata?.id??null)},[e,m,l,r]),(0,a.useEffect)(()=>{e||c(null)},[e]);let h=(0,a.useCallback)(()=>{l&&i(l)},[l,i]),p=(0,a.useCallback)(e=>{e||o()},[o]);return(0,n.jsx)(tr.DialogShell,{open:e,onOpenChange:p,width:"md",dismissOnBackdrop:!0,className:"stgm stg:max-h-[70vh] stg:bg-[var(--stgm-background,#fff)] stg:border-[var(--stgm-border,#e5e5e5)]","aria-label":"Select execution to compare",children:(0,n.jsxs)("div",{className:"stg:flex stg:flex-col",children:[(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between stg:border-b stg:border-[var(--stgm-border,#e5e5e5)] stg:px-4 stg:py-3",children:[(0,n.jsx)("span",{className:"stg:text-sm stg:font-semibold stg:text-[var(--stgm-foreground,#1a1a2e)]",children:"Compare with..."}),(0,n.jsx)("button",{type:"button",onClick:o,className:"stg:flex stg:h-6 stg:w-6 stg:items-center stg:justify-center stg:rounded stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:bg-[var(--stgm-muted,#f5f5f5)] stg:hover:text-[var(--stgm-foreground,#1a1a2e)]","aria-label":"Close",children:(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M2 2l8 8M10 2l-8 8"})})})]}),(0,n.jsxs)("div",{className:"stg:max-h-[50vh] stg:overflow-y-auto stg:p-2",role:"listbox","aria-label":"Recent executions",children:[g&&(0,n.jsx)("div",{className:"stg:flex stg:items-center stg:justify-center stg:py-8 stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Loading executions..."}),!g&&0===m.length&&(0,n.jsx)("div",{className:"stg:flex stg:items-center stg:justify-center stg:py-8 stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:"No other completed executions found."}),m.map(e=>{let t,s=e.metadata?.id??"",r=e.metadata?.name||e.metadata?.slug||s,a=e.status?.phase??B.ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED,i=e.status?.startedAt,o=function(e,t){if(!e||!t)return null;let s=new Date(e).getTime(),r=new Date(t).getTime();return Number.isNaN(s)||Number.isNaN(r)?null:r-s}(i,e.status?.completedAt),d=s===l;return(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":d,onClick:()=>c(s),className:(0,u.cn)("stg:flex stg:w-full stg:items-center stg:gap-3 stg:rounded-md stg:px-3 stg:py-2 stg:text-left stg:text-sm stg:transition-colors",d?"stg:bg-[var(--stgm-primary,#4f46e5)]/10 stg:ring-1 stg:ring-[var(--stgm-primary,#4f46e5)]":"stg:hover:bg-[var(--stgm-muted,#f5f5f5)]"),children:[(0,n.jsx)(eh.WorkflowExecutionPhaseBadge,{phase:a}),(0,n.jsxs)("div",{className:"stg:flex stg:flex-1 stg:flex-col stg:gap-0.5 stg:overflow-hidden",children:[(0,n.jsx)("span",{className:"stg:truncate stg:text-xs stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)]",children:r}),(0,n.jsxs)("span",{className:"stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:[i?Number.isNaN((t=new Date(i)).getTime())?"—":(0,ta.formatRelativeTime)(t):"—",null!=o&&` \xb7 ${(0,ep.formatDuration)(o)}`]})]})]},s)})]}),(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-end stg:gap-2 stg:border-t stg:border-[var(--stgm-border,#e5e5e5)] stg:px-4 stg:py-3",children:[(0,n.jsx)("button",{type:"button",onClick:o,className:"stg:rounded-md stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:bg-[var(--stgm-muted,#f5f5f5)] stg:hover:text-[var(--stgm-foreground,#1a1a2e)]",children:"Cancel"}),(0,n.jsx)("button",{type:"button",onClick:h,disabled:!l,className:(0,u.cn)("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium",l?"stg:bg-[var(--stgm-primary,#4f46e5)] stg:text-[var(--stgm-primary-foreground,#fff)] stg:hover:bg-[var(--stgm-primary,#4f46e5)]/90":"stg:cursor-not-allowed stg:bg-[var(--stgm-muted,#f5f5f5)] stg:text-[var(--stgm-muted-foreground,#737373)]"),children:"Compare"})]})]})})});var tl=e.i(911237);function tu(e){if(!e)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function tc(e){let t=tu(e.startedAt),s=tu(e.completedAt);return null==t||null==s?null:s-t}function td(e){let t=new Map;for(let s of e)s.taskName&&t.set(s.taskName,s);return t}BigInt(0);let tg=BigInt(0),tm=(0,a.memo)(function({comparison:e,className:t}){let s=function(e){var t,s;let{baseRow:r,compareRow:n,durationDeltaMs:a,costDeltaMicros:i,tokensDelta:o}=e,l={label:"Duration",baseValue:null!=r.durationMs?(0,ep.formatDuration)(r.durationMs):"—",compareValue:null!=n.durationMs?(0,ep.formatDuration)(n.durationMs):"—",delta:(t=a,s=e=>(0,ep.formatDuration)(Math.abs(e)),null==t?"—":0===t?"No change":`${t>0?"+":"−"}${s(Math.abs(t))}`),deltaDirection:null==a?"neutral":a>0?"worse":a<0?"better":"neutral"},u={label:"Cost",baseValue:r.costMicros>tg?(0,ep.formatMicroUsd)(r.costMicros):"—",compareValue:n.costMicros>tg?(0,ep.formatMicroUsd)(n.costMicros):"—",delta:th(i,ep.formatMicroUsd),deltaDirection:i===tg?"neutral":i>tg?"worse":"better"},c={label:"Tokens",baseValue:r.totalTokens>tg?(0,ep.formatTokenCount)(r.totalTokens):"—",compareValue:n.totalTokens>tg?(0,ep.formatTokenCount)(n.totalTokens):"—",delta:th(o,ep.formatTokenCount),deltaDirection:o===tg?"neutral":o>tg?"worse":"better"},d=e.tasks.filter(e=>e.statusChanged).length;return[l,u,c,{label:"Task Outcomes",baseValue:`${r.completedTaskCount}/${r.taskCount}`,compareValue:`${n.completedTaskCount}/${n.taskCount}`,delta:0===d?"All identical":`${d} differ`,deltaDirection:0===d?"neutral":"worse"}]}(e);return(0,n.jsx)("div",{className:(0,u.cn)("stg:grid stg:grid-cols-2 stg:gap-3 stg:lg:grid-cols-4",t),"aria-label":"Comparison summary",children:s.map(e=>(0,n.jsxs)("div",{className:"stg:rounded-lg stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-card,#fff)] stg:p-3",children:[(0,n.jsx)("span",{className:"stg:text-[10px] stg:font-medium stg:uppercase stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",children:e.label}),(0,n.jsxs)("div",{className:"stg:mt-1.5 stg:flex stg:items-baseline stg:gap-2",children:[(0,n.jsx)("span",{className:"stg:text-sm stg:font-semibold stg:text-[var(--stgm-foreground,#1a1a2e)]",children:e.baseValue}),(0,n.jsxs)("span",{className:"stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:["vs ",e.compareValue]})]}),(0,n.jsx)("div",{className:"stg:mt-1",children:(0,n.jsx)("span",{className:(0,u.cn)("stg:text-xs stg:font-medium","better"===e.deltaDirection&&"stg:text-[var(--stgm-success,#16a34a)]","worse"===e.deltaDirection&&"stg:text-[var(--stgm-destructive,#dc2626)]","neutral"===e.deltaDirection&&"stg:text-[var(--stgm-muted-foreground,#737373)]"),children:e.delta})})]},e.label))})});function th(e,t){if(e===tg)return"No change";let s=e>tg?"+":"−";return`${s}${t(e<tg?-e:e)}`}let tp=BigInt(0),tf=(0,a.memo)(function({comparison:e,changesOnly:t=!1,className:s}){let[r,i]=(0,a.useState)(t?"changed":"all"),o=(0,a.useMemo)(()=>{switch(r){case"changed":return e.tasks.filter(e=>e.statusChanged);case"failed":return e.tasks.filter(e=>e.baseStatus===B.WorkflowTaskStatus.WORKFLOW_TASK_FAILED||e.compareStatus===B.WorkflowTaskStatus.WORKFLOW_TASK_FAILED);default:return e.tasks}},[e.tasks,r]),l=(0,a.useCallback)(e=>i(e),[]);return(0,n.jsxs)("div",{className:(0,u.cn)("stg:flex stg:flex-col stg:gap-2",s),children:[(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1",role:"tablist","aria-label":"Task filter",children:[(0,n.jsx)(tk,{label:"All",count:e.tasks.length,active:"all"===r,onClick:()=>l("all")}),(0,n.jsx)(tk,{label:"Changed",count:e.tasks.filter(e=>e.statusChanged).length,active:"changed"===r,onClick:()=>l("changed")}),(0,n.jsx)(tk,{label:"Failed",count:e.tasks.filter(e=>e.baseStatus===B.WorkflowTaskStatus.WORKFLOW_TASK_FAILED||e.compareStatus===B.WorkflowTaskStatus.WORKFLOW_TASK_FAILED).length,active:"failed"===r,onClick:()=>l("failed")})]}),(0,n.jsx)("div",{className:"stg:overflow-x-auto stg:rounded-md stg:border stg:border-[var(--stgm-border,#e5e5e5)]",children:(0,n.jsxs)("table",{className:"stg:w-full stg:text-xs","aria-label":"Task comparison",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{className:"stg:border-b stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-muted,#f5f5f5)]",children:[(0,n.jsx)("th",{className:"stg:px-3 stg:py-2 stg:text-left stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Task"}),(0,n.jsx)("th",{className:"stg:px-3 stg:py-2 stg:text-center stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Base Status"}),(0,n.jsx)("th",{className:"stg:px-3 stg:py-2 stg:text-center stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Compare Status"}),(0,n.jsx)("th",{className:"stg:px-3 stg:py-2 stg:text-right stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Duration"}),(0,n.jsx)("th",{className:"stg:px-3 stg:py-2 stg:text-right stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Cost"})]})}),(0,n.jsxs)("tbody",{children:[0===o.length&&(0,n.jsx)("tr",{children:(0,n.jsx)("td",{colSpan:5,className:"stg:px-3 stg:py-6 stg:text-center stg:text-[var(--stgm-muted-foreground,#737373)]",children:"all"===r?"No tasks to compare.":"No matching tasks."})}),o.map(t=>(0,n.jsx)(tx,{task:t,isDivergencePoint:t.taskName===e.divergencePoint},t.taskName))]})]})}),(e.tasksOnlyInBase.length>0||e.tasksOnlyInCompare.length>0)&&(0,n.jsxs)("div",{className:"stg:mt-1 stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:[e.tasksOnlyInBase.length>0&&(0,n.jsxs)("p",{children:["Only in base: ",e.tasksOnlyInBase.join(", ")]}),e.tasksOnlyInCompare.length>0&&(0,n.jsxs)("p",{children:["Only in compare: ",e.tasksOnlyInCompare.join(", ")]})]})]})}),tx=(0,a.memo)(function({task:e,isDivergencePoint:t}){return(0,n.jsxs)("tr",{className:(0,u.cn)("stg:border-b stg:border-[var(--stgm-border,#e5e5e5)] stg:last:border-b-0",e.statusChanged&&"stg:bg-[var(--stgm-destructive,#dc2626)]/5",t&&"stg:ring-1 stg:ring-inset stg:ring-[var(--stgm-warning,#f59e0b)]/50"),children:[(0,n.jsx)("td",{className:"stg:px-3 stg:py-2",children:(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1.5",children:[t&&(0,n.jsxs)(e5.Tooltip,{children:[(0,n.jsx)(e5.TooltipTrigger,{render:(0,n.jsx)("span",{className:"stg:inline-block stg:h-1.5 stg:w-1.5 stg:rounded-full stg:bg-[var(--stgm-warning,#f59e0b)]","aria-label":"Divergence point"})}),(0,n.jsx)(e5.TooltipContent,{side:"top",children:"First point of divergence"})]}),(0,n.jsx)("span",{className:"stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)]",children:e.taskName})]})}),(0,n.jsx)("td",{className:"stg:px-3 stg:py-2 stg:text-center",children:(0,n.jsx)(tv,{status:e.baseStatus})}),(0,n.jsx)("td",{className:"stg:px-3 stg:py-2 stg:text-center",children:(0,n.jsx)(tv,{status:e.compareStatus})}),(0,n.jsx)("td",{className:"stg:px-3 stg:py-2 stg:text-right",children:(0,n.jsx)(tb,{task:e})}),(0,n.jsx)("td",{className:"stg:px-3 stg:py-2 stg:text-right",children:(0,n.jsx)(ty,{task:e})})]})});function tv({status:e}){let t=tj.get(e)??{label:"Unknown",colorClass:"stg:text-[var(--stgm-muted-foreground,#737373)]"};return(0,n.jsx)("span",{className:(0,u.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:text-[10px] stg:font-medium",t.colorClass),children:t.label})}function tb({task:e}){if(null==e.baseDurationMs&&null==e.compareDurationMs)return(0,n.jsx)("span",{children:"—"});let t=null!=e.baseDurationMs?(0,ep.formatDuration)(e.baseDurationMs):"—",s=null!=e.compareDurationMs?(0,ep.formatDuration)(e.compareDurationMs):"—";if(null==e.durationDeltaMs||0===e.durationDeltaMs)return(0,n.jsx)("span",{className:"stg:text-[var(--stgm-muted-foreground,#737373)]",children:t});let r=e.durationDeltaMs>0?"+":"−",a=Math.abs(e.durationDeltaMs),i=e.durationDeltaMs>0?"stg:text-[var(--stgm-destructive,#dc2626)]":"stg:text-[var(--stgm-success,#16a34a)]";return(0,n.jsxs)("span",{className:"stg:flex stg:flex-col stg:items-end",children:[(0,n.jsxs)("span",{className:"stg:text-[var(--stgm-foreground,#1a1a2e)]",children:[t," / ",s]}),(0,n.jsxs)("span",{className:(0,u.cn)("stg:text-[10px]",i),children:[r,(0,ep.formatDuration)(a)]})]})}function ty({task:e}){if(e.baseCostMicros===tp&&e.compareCostMicros===tp)return(0,n.jsx)("span",{className:"stg:text-[var(--stgm-muted-foreground,#737373)]",children:"—"});let t=e.baseCostMicros>tp?(0,ep.formatMicroUsd)(e.baseCostMicros):"—",s=e.compareCostMicros>tp?(0,ep.formatMicroUsd)(e.compareCostMicros):"—";return e.baseCostMicros-e.compareCostMicros===tp?(0,n.jsx)("span",{className:"stg:text-[var(--stgm-muted-foreground,#737373)]",children:t}):(0,n.jsxs)("span",{className:"stg:text-[var(--stgm-foreground,#1a1a2e)]",children:[t," / ",s]})}function tk({label:e,count:t,active:s,onClick:r}){return(0,n.jsxs)("button",{type:"button",role:"tab","aria-selected":s,onClick:r,className:(0,u.cn)("stg:rounded-full stg:px-2.5 stg:py-1 stg:text-[10px] stg:font-medium stg:transition-colors",s?"stg:bg-[var(--stgm-foreground,#1a1a2e)] stg:text-[var(--stgm-background,#fff)]":"stg:bg-[var(--stgm-muted,#f5f5f5)] stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:bg-[var(--stgm-border,#e5e5e5)]"),children:[e," (",t,")"]})}let tj=new Map([[B.WorkflowTaskStatus.WORKFLOW_TASK_STATUS_UNSPECIFIED,{label:"—",colorClass:"stg:text-[var(--stgm-muted-foreground,#737373)]"}],[B.WorkflowTaskStatus.WORKFLOW_TASK_PENDING,{label:"Pending",colorClass:"stg:text-[var(--stgm-muted-foreground,#737373)]"}],[B.WorkflowTaskStatus.WORKFLOW_TASK_IN_PROGRESS,{label:"Running",colorClass:"stg:text-[var(--stgm-foreground,#1a1a2e)]"}],[B.WorkflowTaskStatus.WORKFLOW_TASK_COMPLETED,{label:"Completed",colorClass:"stg:text-[var(--stgm-success,#16a34a)]"}],[B.WorkflowTaskStatus.WORKFLOW_TASK_FAILED,{label:"Failed",colorClass:"stg:text-[var(--stgm-destructive,#dc2626)]"}],[B.WorkflowTaskStatus.WORKFLOW_TASK_SKIPPED,{label:"Skipped",colorClass:"stg:text-[var(--stgm-muted-foreground,#737373)]"}],[B.WorkflowTaskStatus.WORKFLOW_TASK_WAITING_APPROVAL,{label:"Waiting",colorClass:"stg:text-[var(--stgm-warning,#f59e0b)]"}]]);var tw=e.i(364802);let tN=(0,a.memo)(function({baseExecutionId:e,compareExecutionId:t,onBack:s,className:r}){let{comparison:i,isLoading:o,error:l}=function({baseId:e,compareId:t}){let{execution:s,isLoading:r,error:n,refetch:i}=G(e),{execution:o,isLoading:l,error:u,refetch:c}=G(t);return{comparison:(0,a.useMemo)(()=>s&&o?function(e,t){let s=(0,tl.deriveExecutionRow)(e),r=(0,tl.deriveExecutionRow)(t),n=e.status?.tasks??[],a=t.status?.tasks??[],i=td(n),o=td(a),l=new Set;i.forEach((e,t)=>l.add(t)),o.forEach((e,t)=>l.add(t));let u=[],c=[],d=[],g=null;for(let e of Array.from(l).sort((e,t)=>{let s=n.findIndex(t=>t.taskName===e),r=n.findIndex(e=>e.taskName===t);return(s>=0?s:a.findIndex(t=>t.taskName===e))-(r>=0?r:a.findIndex(e=>e.taskName===t))})){let t=i.get(e),s=o.get(e);if(t&&!s){c.push(e);continue}if(!t&&s){d.push(e);continue}if(!t||!s)continue;let r=t.status??B.WorkflowTaskStatus.WORKFLOW_TASK_STATUS_UNSPECIFIED,n=s.status??B.WorkflowTaskStatus.WORKFLOW_TASK_STATUS_UNSPECIFIED,a=r!==n,l=tc(t),m=tc(s),h=null!=l&&null!=m?l-m:null,p=BigInt(t.costMicros??0),f=BigInt(s.costMicros??0),x=BigInt(t.inputTokens??0)+BigInt(t.outputTokens??0),v=BigInt(s.inputTokens??0)+BigInt(s.outputTokens??0);a&&null===g&&(g=e),u.push({taskName:e,taskKind:null!=t.taskType?String(t.taskType):"",baseStatus:r,compareStatus:n,statusChanged:a,baseDurationMs:l,compareDurationMs:m,durationDeltaMs:h,baseCostMicros:p,compareCostMicros:f,baseTokens:x,compareTokens:v,baseError:t.error||null,compareError:s.error||null})}let m=null!=s.durationMs&&null!=r.durationMs?s.durationMs-r.durationMs:null;return{baseRow:s,compareRow:r,durationDeltaMs:m,costDeltaMicros:s.costMicros-r.costMicros,tokensDelta:s.totalTokens-r.totalTokens,tasks:u,tasksOnlyInBase:c,tasksOnlyInCompare:d,divergencePoint:g}}(s,o):null,[s,o]),isLoading:r||l,error:n??u??null,refetch:(0,a.useMemo)(()=>()=>{i(),c()},[i,c])}}({baseId:e,compareId:t});return o?(0,n.jsx)("div",{className:(0,u.cn)("stg:flex stg:items-center stg:justify-center stg:py-16",r),children:(0,n.jsx)("span",{className:"stg:text-sm stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Loading comparison..."})}):l?(0,n.jsxs)("div",{className:(0,u.cn)("stg:flex stg:flex-col stg:items-center stg:justify-center stg:gap-2 stg:py-16",r),children:[(0,n.jsx)("span",{className:"stg:text-sm stg:text-[var(--stgm-destructive,#dc2626)]",children:"Failed to load executions"}),(0,n.jsx)("span",{className:"stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:l.message})]}):i?(0,n.jsxs)("section",{className:(0,u.cn)("stg:flex stg:flex-col stg:gap-4",r),"aria-label":"Execution comparison",children:[(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-3",children:[(0,n.jsxs)("button",{type:"button",onClick:s,className:"stg:flex stg:items-center stg:gap-1.5 stg:rounded-md stg:px-2 stg:py-1 stg:text-xs stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:bg-[var(--stgm-muted,#f5f5f5)] stg:hover:text-[var(--stgm-foreground,#1a1a2e)]","aria-label":"Back to execution",children:[(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M7.5 9L4.5 6l3-3"})}),"Back"]}),(0,n.jsxs)("div",{className:"stg:flex stg:flex-1 stg:items-center stg:gap-2",children:[(0,n.jsx)(tC,{name:i.baseRow.name||e,phase:i.baseRow.phase,label:"Base"}),(0,n.jsx)("span",{className:"stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:"vs"}),(0,n.jsx)(tC,{name:i.compareRow.name||t,phase:i.compareRow.phase,label:"Compare"})]})]}),i.divergencePoint&&(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:rounded-md stg:border stg:border-[var(--stgm-warning,#f59e0b)]/30 stg:bg-[var(--stgm-warning,#f59e0b)]/5 stg:px-3 stg:py-2",children:[(0,n.jsx)("span",{className:"stg:inline-block stg:h-2 stg:w-2 stg:rounded-full stg:bg-[var(--stgm-warning,#f59e0b)]","aria-hidden":"true"}),(0,n.jsxs)("span",{className:"stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)]",children:["First divergence at ",(0,n.jsx)("strong",{children:i.divergencePoint})]})]}),(0,n.jsx)(tm,{comparison:i}),(0,n.jsx)(tf,{comparison:i})]}):null});function tC({name:e,phase:t,label:s}){return(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1.5",children:[(0,n.jsxs)("span",{className:"stg:text-[10px] stg:font-medium stg:uppercase stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",children:[s,":"]}),(0,n.jsx)(eh.WorkflowExecutionPhaseBadge,{phase:t}),(0,n.jsx)(tw.TruncatedText,{text:e,className:"stg:max-w-[10rem] stg:text-xs stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)]"})]})}var tS=e.i(776526),tE=e.i(227989),tT=e.i(503353);let tA=(0,tT.virtualEntryId)("filechange");function tI(e){return e.path||e.absolutePath}var tM=e.i(92649),tO=e.i(603115),t_=e.i(524067);let tR=(0,tT.virtualEntryId)("diagnosis"),tD="AI Diagnosis";function tP(e){let t=e.metadata?.id??"",s=e.spec?.displayName||e.metadata?.name||"Unnamed";return`${t}/${s}`}var tF=e.i(869803),tL=e.i(337249),tW=e.i(262045);function tK(e){return e.spec?.displayName||e.metadata?.name||"Unnamed"}function tU(){let e=(0,c.useStigmer)(),[t,s]=(0,a.useState)(!1),[r,n]=(0,a.useState)(null),i=(0,a.useCallback)(async r=>{if(r&&!t){s(!0),n(null);try{let t=await e.artifact.getDownloadUrl(r);t.url&&window.open(t.url,"_blank","noopener,noreferrer")}catch(e){n((0,Y.toError)(e))}finally{s(!1)}}},[e,t]);return(0,a.useMemo)(()=>({download:i,isDownloading:t,error:r}),[i,t,r])}function tB({artifacts:e,onOpen:t,onActivate:s}){let r=(0,a.useMemo)(()=>(function(e){let t=new Map;for(let s of e){let e=tK(s).toLowerCase();t.set(e,(t.get(e)??0)+1)}return[...e.map(e=>{let s=(t.get(tK(e).toLowerCase())??0)>1;return{artifact:e,item:(0,tW.fromArtifact)(e,s)}})].sort((e,t)=>e.item.name.localeCompare(t.item.name,void 0,{sensitivity:"base"}))})(e),[e]);return 0===r.length?(0,n.jsx)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:px-4 stg:py-8 stg:text-center",children:(0,n.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"No artifacts yet. Files produced by workflow tasks will appear here."})}):(0,n.jsx)("ul",{role:"list",className:`${tF.UNSTYLED_LIST} stg:flex stg:flex-col`,children:r.map(({artifact:e,item:r})=>(0,n.jsx)(tz,{artifact:e,item:r,onOpen:()=>t(e),onActivate:s?()=>s(e):void 0},e.metadata?.id??r.name))})}function tz({artifact:e,item:t,onOpen:s,onActivate:r}){let{download:a,isDownloading:i}=tU();return(0,n.jsx)(tL.ArtifactRowView,{item:t,onOpen:s,onActivate:r,onDownload:()=>a(e.metadata?.id??""),isDownloading:i})}var tq=e.i(488479);function t$({fileChanges:e,isLoading:t=!1,isRefetching:s=!1,error:r=null,activePath:i=null,onOpen:o}){let l=(0,a.useMemo)(()=>e.map(eu.toFileDiffEntry),[e]),u=(0,a.useMemo)(()=>new Map(e.map(e=>[e.path||e.absolutePath,e])),[e]);return t?(0,n.jsx)("div",{role:"status",className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:px-4 stg:py-8 stg:text-center",children:(0,n.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"Loading file changes…"})}):0===e.length?(0,n.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-2 stg:px-4 stg:py-8 stg:text-center",children:[r&&(0,n.jsx)(tH,{error:r}),(0,n.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"No file changes yet. Files edited by agent tasks will appear here."})]}):(0,n.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-2",children:[r&&(0,n.jsx)("div",{className:"stg:px-2 stg:pt-2",children:(0,n.jsx)(tH,{error:r})}),(0,n.jsx)(tq.DiffFileList,{files:l,selectedPath:i,onSelect:e=>{let t=u.get(e);t&&o(t)}}),s&&(0,n.jsx)("p",{role:"status",className:"stg:px-3 stg:pb-2 stg:text-[0.65rem] stg:text-muted-foreground-faint",children:"Updating…"})]})}function tH({error:e}){return(0,n.jsxs)("div",{role:"alert",className:"stg:rounded-md stg:border stg:border-border stg:bg-muted-subtle stg:px-3 stg:py-2 stg:text-left stg:text-xs stg:text-destructive",children:["Some task changes could not be loaded: ",e.message]})}let tG=BigInt(0),tV=BigInt(0);function tX({costSummary:e,taskStates:t}){let s=(0,a.useMemo)(()=>(function(e){let t=[];for(let s of e.values())(s.costMicros!==tG||s.tokensUsed!==tG)&&t.push({taskName:s.taskName,taskKind:s.taskKind,kindLabel:(0,eV.kindToDisplayName)((0,eB.taskKindToString)(s.taskKind)),status:s.status,costMicros:s.costMicros,tokensUsed:s.tokensUsed});return t.sort((e,t)=>e.costMicros!==t.costMicros?e.costMicros>t.costMicros?-1:1:e.tokensUsed!==t.tokensUsed?e.tokensUsed>t.tokensUsed?-1:1:e.taskName.localeCompare(t.taskName,void 0,{sensitivity:"base"}))})(t),[t]);return e.costConsumedMicros>tV||e.tokensConsumed>tV||0!==s.length?(0,n.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-4",children:[(0,n.jsx)(tQ,{costSummary:e}),s.length>0&&(0,n.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1",children:[(0,n.jsx)("h3",{className:"stg:px-2 stg:text-xs stg:font-semibold stg:uppercase stg:tracking-wider stg:text-muted-foreground",children:"By task"}),(0,n.jsx)("ul",{role:"list",className:(0,u.cn)(tF.UNSTYLED_LIST,"stg:flex stg:flex-col"),children:s.map(e=>(0,n.jsx)(tJ,{item:e},e.taskName))})]})]}):(0,n.jsx)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:px-4 stg:py-8 stg:text-center",children:(0,n.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"No usage data yet. Cost and token stats will appear here."})})}function tQ({costSummary:e}){let t=e.costRemainingMicros>=tV?e.costConsumedMicros+e.costRemainingMicros:void 0,s=e.tokensRemaining>=tV?e.tokensConsumed+e.tokensRemaining:void 0;return(0,n.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1.5 stg:px-2",role:"region","aria-label":"Execution cost summary",children:[(0,n.jsxs)("div",{className:"stg:flex stg:items-baseline stg:gap-1.5",children:[(0,n.jsx)("span",{className:"stg:text-sm stg:font-medium stg:tabular-nums stg:text-foreground",children:(0,ep.formatMicroUsd)(e.costConsumedMicros)}),void 0!==t&&(0,n.jsxs)("span",{className:"stg:text-xs stg:tabular-nums stg:text-muted-foreground",children:["of ",(0,ep.formatMicroUsd)(t)," budget"]})]}),(0,n.jsx)(tY,{consumed:e.costConsumedMicros,limit:t,breached:e.thresholdBreached,label:"Cost budget"}),(0,n.jsxs)("div",{className:"stg:text-xs stg:tabular-nums stg:text-muted-foreground",children:[(0,ep.formatTokenCount)(e.tokensConsumed)," tokens",void 0!==s&&` of ${(0,ep.formatTokenCount)(s)}`]}),(0,n.jsx)(tY,{consumed:e.tokensConsumed,limit:s,breached:e.thresholdBreached,label:"Token budget"}),e.thresholdBreached&&(0,n.jsxs)("p",{className:"stg:flex stg:items-center stg:gap-1.5 stg:text-xs stg:text-warning",children:[(0,n.jsx)(tZ,{}),"Budget threshold breached"]})]})}function tY({consumed:e,limit:t,breached:s,label:r}){if(void 0===t||t<=tV)return null;let a=Number(e*BigInt(100)/t);return(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2","aria-label":r,children:[(0,n.jsx)("div",{role:"progressbar","aria-valuenow":Math.min(a,100),"aria-valuemin":0,"aria-valuemax":100,className:"stg:h-1.5 stg:min-w-0 stg:flex-1 stg:overflow-hidden stg:rounded-full stg:bg-muted",children:(0,n.jsx)("div",{className:(0,u.cn)("stg:h-full stg:rounded-full stg:transition-all",s||a>80?"stg:bg-warning":"stg:bg-primary"),style:{width:`${Math.min(a,100)}%`}})}),(0,n.jsxs)("span",{className:"stg:shrink-0 stg:text-[10px] stg:tabular-nums stg:text-muted-foreground",children:[a.toFixed(0),"%"]})]})}function tJ({item:e}){var t,s;return(0,n.jsx)("li",{className:"stg:flex stg:items-stretch",children:(0,n.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:flex-1 stg:items-center stg:gap-2 stg:px-2 stg:py-1 stg:text-left stg:text-xs stg:text-muted-foreground",children:[(0,n.jsxs)("span",{className:"stg:min-w-0 stg:flex-1 stg:truncate stg:text-foreground",children:[e.taskName,(0,n.jsxs)("span",{className:"stg:ml-1.5 stg:text-[0.65rem] stg:text-muted-foreground",children:[e.kindLabel,("running"===(t=e.status)||"retrying"===t||"waiting_approval"===t)&&` \xb7 ${"waiting_approval"===(s=e.status)?"waiting approval":s}`]})]}),(0,n.jsx)("span",{className:"stg:shrink-0 stg:tabular-nums stg:text-foreground",children:(0,ep.formatMicroUsd)(e.costMicros)}),(0,n.jsxs)("span",{className:"stg:w-14 stg:shrink-0 stg:text-right stg:tabular-nums stg:text-[0.65rem] stg:text-muted-foreground-faint",children:[(0,ep.formatTokenCount)(e.tokensUsed)," tok"]})]})})}function tZ(){return(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),(0,n.jsx)("path",{d:"M12 9v4"}),(0,n.jsx)("path",{d:"M12 17h.01"})]})}function t0(){return(0,n.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M21 8l-9-5-9 5v8l9 5 9-5z"}),(0,n.jsx)("path",{d:"M3 8l9 5 9-5"}),(0,n.jsx)("path",{d:"M12 13v9"})]})}function t1(){return(0,n.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M14 3H7a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V7z"}),(0,n.jsx)("path",{d:"M14 3v4h4"}),(0,n.jsx)("path",{d:"M10 11h4"}),(0,n.jsx)("path",{d:"M12 9v4"}),(0,n.jsx)("path",{d:"M10 16.5h4"})]})}function t2(){return(0,n.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M3 20h18"}),(0,n.jsx)("path",{d:"M6 20v-6"}),(0,n.jsx)("path",{d:"M11 20V9"}),(0,n.jsx)("path",{d:"M16 20v-9"}),(0,n.jsx)("path",{d:"M21 20V5"})]})}var t5=e.i(509968),t3=e.i(432814);let t6={content:null,contentType:null,totalSizeBytes:BigInt(0),isTruncated:!1};var t7=e.i(193799);function t4({artifact:e,className:t}){let s,r=e.metadata?.id??"",i=e.spec?.displayName||e.metadata?.name||"Unnamed",o=e.spec?.contentType??"",l=e.status?.sizeBytes??BigInt(0),g=!!r&&((s=o.toLowerCase()).startsWith("text/")||s.includes("json")||s.includes("yaml")||s.includes("xml")||s.includes("markdown")||s.includes("csv")),{content:m,contentType:h,isTruncated:p,isLoading:f,error:x}=function(e,t){let s=(0,c.useStigmer)(),{data:r,isLoading:n,isRefetching:a,error:i,refetch:o}=(0,d.useFetch)(e?()=>s.artifact.getContent((0,V.create)(el.GetArtifactContentRequestSchema,{artifactId:e})).then(e=>({content:new TextDecoder().decode(e.content),contentType:e.contentType||null,totalSizeBytes:e.totalSizeBytes,isTruncated:e.truncated})):null,[e,s],t6,t?{cacheKey:t}:void 0);return{content:r.content,contentType:r.contentType,totalSizeBytes:r.totalSizeBytes,isTruncated:r.isTruncated,isLoading:n,isRefetching:a,error:i,refetch:o}}(g?r:null,g?`workflow-artifact-doc:${r}`:void 0),{download:v,isDownloading:b}=tU(),{copy:y,copied:k}=(0,t7.useCopyFeedback)(),j=(0,a.useCallback)(()=>{m&&y(m)},[m,y]),w=null!==m;return(0,n.jsxs)("div",{role:"article","aria-label":`Artifact ${i}`,className:(0,u.cn)("stg:flex stg:min-h-0 stg:min-w-0 stg:flex-1 stg:flex-col",t),children:[(0,n.jsxs)("div",{className:"stg:sticky stg:top-0 stg:z-10 stg:flex stg:min-w-0 stg:flex-wrap stg:items-center stg:gap-x-3 stg:gap-y-1.5 stg:border-b stg:border-border stg:bg-background stg:px-4 stg:py-2",children:[(0,n.jsx)("span",{className:"stg:shrink-0 stg:text-muted-foreground",children:(0,n.jsx)(t9,{})}),(0,n.jsx)("span",{className:"stg:truncate stg:text-sm stg:font-medium stg:text-foreground",children:i}),(0,n.jsx)("span",{className:"stg:shrink-0 stg:text-[0.65rem] stg:tabular-nums stg:text-muted-foreground-faint",children:(0,t3.formatArtifactSize)(l)}),o&&(0,n.jsx)("span",{className:"stg:shrink-0 stg:text-[0.65rem] stg:text-muted-foreground",children:o}),(0,n.jsxs)("div",{className:"stg:ml-auto stg:flex stg:min-w-0 stg:flex-wrap stg:items-center stg:gap-3",children:[w&&(0,n.jsxs)("button",{type:"button",onClick:j,"aria-label":k?"Copied to clipboard":"Copy content",className:(0,u.cn)("stg:inline-flex stg:items-center stg:gap-1.5 stg:text-xs stg:font-medium stg:transition-colors",k?"stg:text-success":"stg:text-muted-foreground stg:hover:text-foreground",t8),children:[k?(0,n.jsx)(ss,{}):(0,n.jsx)(se,{}),k?"Copied":"Copy"]}),(0,n.jsxs)("button",{type:"button",onClick:()=>v(r),disabled:b||!r,className:(0,u.cn)("stg:inline-flex stg:items-center stg:gap-1.5 stg:text-xs stg:font-medium stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground stg:disabled:opacity-50",t8),children:[(0,n.jsx)(st,{}),b?"Preparing…":"Download"]})]})]}),(0,n.jsx)("div",{className:"stg:min-w-0",children:(0,n.jsx)(t5.ArtifactFileContent,{fileName:i,content:m,contentType:h??o,isLoading:f,error:x,isTruncated:p})}),(0,n.jsx)("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"stg:sr-only",children:k&&"Content copied to clipboard"})]})}let t8="stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:focus-visible:rounded-sm";function t9(){return(0,n.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M9.5 1.5H5C4.17 1.5 3.5 2.17 3.5 3V13C3.5 13.83 4.17 14.5 5 14.5H11C11.83 14.5 12.5 13.83 12.5 13V4.5L9.5 1.5Z"}),(0,n.jsx)("path",{d:"M9.5 1.5V4.5H12.5"})]})}function se(){return(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:[(0,n.jsx)("rect",{x:"4",y:"4",width:"6.5",height:"6.5",rx:"1"}),(0,n.jsx)("path",{d:"M8 4V2.5C8 1.95 7.55 1.5 7 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V7C1.5 7.55 1.95 8 2.5 8H4"})]})}function st(){return(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M6 1.5V8.5"}),(0,n.jsx)("path",{d:"M3 6L6 9L9 6"}),(0,n.jsx)("path",{d:"M2 10.5H10"})]})}function ss(){return(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M2 6.5L4.5 9L10 3"})})}var sr=e.i(106909),sn=e.i(901982),sa=e.i(719705),si=e.i(863714),so=e.i(422891),sl=e.i(130460),su=e.i(644389);let sc=[],sd=(0,a.memo)(function({childExecutionId:e,agentSlug:t,hitl:s,onNavigateToAgentExecution:r,className:i}){let{ref:o,isVisible:l}=function(){let e=(0,a.useRef)(null),[t,s]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let t=e.current;if(!t)return;let r=new IntersectionObserver(e=>{let t=e[e.length-1];t&&s(t.isIntersecting)},{root:null,rootMargin:"200px 0px 200px 0px",threshold:0});return r.observe(t),()=>r.disconnect()},[]),{ref:e,isVisible:t}}(),{execution:g,phase:m,isLoading:h,isReconnecting:p,error:f,reconnect:x}=function(e,t){let s=(0,c.useStigmer)(),r=t?.live??!0,n=e?async()=>{try{return await s.agentExecution.get(e)}catch(e){if((0,q.isNotFound)(e))return null;throw e}}:null,{data:i,isLoading:o,error:l,refetch:u}=(0,d.useFetch)(n,[e,s],null,{cacheKey:e?`agent-execution:${e}`:void 0}),g=i?.status?.phase??ee.ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED,m=r&&null!==i&&!(0,ew.isTerminalPhase)(g),h=(0,ej.useExecutionStream)(m?e:null),p=(0,a.useRef)(null);e&&h.execution?p.current={id:e,execution:h.execution}:p.current?.id!==e&&(p.current=null);let f=h.execution??p.current?.execution??i,x=f?.status?.phase??ee.ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED,v=h.reconnect,b=(0,a.useCallback)(()=>{u(),v()},[u,v]),y=l??h.error,{isStreaming:k,isReconnecting:j}=h;return(0,a.useMemo)(()=>({execution:f,phase:x,isLoading:o,isStreaming:k,isReconnecting:j,error:y,reconnect:b}),[f,x,o,k,j,y,b])}(e,{live:l}),v=(0,ew.isTerminalPhase)(m),b=(0,a.useMemo)(()=>v?[]:(0,sl.displayFileChangeSets)(g?.status).filter(e=>e.status===ee.FileChangeSetStatus.AWAITING_REVIEW&&e.changes.length>0),[g?.status,v]),y=s?.submitFileDecision,k=(0,a.useCallback)((t,s,r)=>{y?.(e,t,s,r)},[y,e]),j=p||!!r;return(0,n.jsxs)("div",{ref:o,role:"group","aria-label":t?`Transcript of agent ${t}`:"Agent transcript",className:(0,u.cn)("stg:flex stg:max-h-[60vh] stg:min-w-0 stg:flex-col",i),children:[j&&(0,n.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:shrink-0 stg:items-center stg:gap-3 stg:pb-1.5",children:[p&&(0,n.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:"Reconnecting…"}),r&&(0,n.jsxs)("button",{type:"button",onClick:()=>r(e),className:"stg:ml-auto stg:inline-flex stg:shrink-0 stg:items-center stg:gap-1.5 stg:text-xs stg:font-medium stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:focus-visible:rounded-sm",children:[(0,n.jsx)(sg,{}),"Open standalone"]})]}),(0,n.jsx)("div",{className:"stg:min-h-0 stg:min-w-0 stg:flex-1",children:g?(0,n.jsx)(eT.MessageThread,{executions:sc,activeStreamExecution:g,onApprovalSubmit:s?.submitApproval,submittingApprovalIds:s?.approvalSubmittingToolCallIds,approvalErrors:s?.approvalErrorsByToolCallId,showFileReviewRecords:null!=s,className:"stg:h-full"}):h?(0,n.jsx)(K.ThreadSkeleton,{className:"stg:py-2"}):f?(0,n.jsxs)("div",{role:"alert",className:"stg:flex stg:flex-col stg:items-start stg:gap-2 stg:py-2",children:[(0,n.jsx)("p",{className:"stg:text-xs stg:text-destructive",children:f.message}),(0,n.jsx)("button",{type:"button",onClick:x,className:"stg:rounded stg:border stg:border-border stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium stg:text-foreground stg:hover:bg-muted stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",children:"Retry"})]}):(0,n.jsxs)("div",{role:"status",className:"stg:flex stg:flex-col stg:gap-1 stg:py-2",children:[(0,n.jsx)("p",{className:"stg:text-xs stg:font-medium stg:text-foreground",children:"This agent execution is no longer available."}),(0,n.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"It may have been removed, or the workflow run predates transcript retention."})]})}),s&&b.length>0&&(0,n.jsx)(su.FileReviewDock,{changeSets:b,onSubmit:k,submittingDecisionKeys:s.fileDecisionSubmittingKeys,decisionErrors:s.fileDecisionErrorsByKey,className:"stg:shrink-0"})]})});function sg(){return(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M10.5 4.5V1.5H7.5"}),(0,n.jsx)("path",{d:"M10.5 1.5L6 6"}),(0,n.jsx)("path",{d:"M8.5 7v3a1 1 0 0 1-1 1h-5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3"})]})}var sm=e.i(167040),sh=e.i(156463),sp=e.i(918789),sf=e.i(61855),sx=e.i(954418),sv=e.i(321425),sb=e.i(46103);let sy=/^(https?:\/\/|[a-z]{2,6}_[0-9a-zA-Z]{8,}$|[0-9a-f]{8}-[0-9a-f]{4}-|\/[a-z])/,sk=(0,a.memo)(function({data:e,className:t}){let s=Object.entries(e);return 0===s.length?(0,n.jsx)("p",{className:(0,u.cn)("stg:text-xs stg:text-muted-foreground",t),children:"No data fields"}):(0,n.jsx)("div",{className:(0,u.cn)("stg:space-y-3 stg:text-xs",t),children:(0,n.jsx)(sj,{entries:s,depth:0})})});function sj({entries:e,depth:t}){let s=[],r=[];for(let[t,n]of e)(0,sb.isScalar)(n)||null==n?s.push([t,n]):r.push([t,n]);return(0,n.jsxs)(n.Fragment,{children:[s.length>0&&(0,n.jsx)("dl",{className:"stg:grid stg:grid-cols-[auto_1fr] stg:gap-x-3 stg:gap-y-1.5 stg:rounded-md stg:border stg:border-border stg:bg-muted-faint stg:px-2.5 stg:py-2",children:s.map(([e,t])=>(0,n.jsx)(sw,{label:e,value:t},e))}),r.map(([e,s])=>(0,n.jsx)(sC,{label:e,value:s,depth:t},e))]})}function sw({label:e,value:t}){let s=null==t?"—":String(t),r="string"==typeof t&&s.length>120&&!sy.test(s);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("dt",{className:"stg:whitespace-nowrap stg:font-mono stg:text-muted-foreground",children:(0,sb.humanizeArgKey)(e)}),r?(0,n.jsx)("dd",{className:"stg:min-w-0",children:(0,n.jsx)(sN,{text:s})}):(0,n.jsx)("dd",{className:(0,u.cn)("stg:min-w-0 stg:font-mono stg:text-foreground","boolean"==typeof t&&"stg:font-medium",null==t&&"stg:text-muted-foreground"),children:s.includes("\n")?(0,n.jsx)("pre",{className:"stg:whitespace-pre-wrap stg:break-words stg:rounded stg:border stg:border-border stg:bg-muted-subtle stg:px-2 stg:py-1 stg:font-mono stg:text-foreground",children:s}):(0,n.jsx)(tw.TruncatedText,{text:s,className:"stg:block"})})]})}function sN({text:e}){let t=e.length>300,[s,r]=(0,a.useState)(!1),i=t&&!s?e.slice(0,300)+"…":e;return(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"stg:whitespace-pre-wrap stg:break-words stg:leading-relaxed stg:text-foreground",children:i}),t&&(0,n.jsx)("button",{type:"button",onClick:()=>r(e=>!e),className:"stg:mt-0.5 stg:text-xs stg:font-medium stg:text-primary stg:transition-colors stg:hover:text-primary-muted",children:s?"Show less":"Show more"})]})}function sC({label:e,value:t,depth:s}){if(Array.isArray(t))return(0,n.jsx)(sE,{label:e,items:t,depth:s});if("object"==typeof t&&null!==t){let r=Object.entries(t);return 0===r.length||s+1>=5&&!sI(r)?(0,n.jsx)(sb.CollapsibleJsonBlock,{label:(0,sb.humanizeArgKey)(e),content:(0,sb.formatJson)(t)}):(0,n.jsx)(sM,{label:(0,sb.humanizeArgKey)(e),children:(0,n.jsx)(sj,{entries:r,depth:s+1})})}return(0,n.jsx)(sb.CollapsibleJsonBlock,{label:(0,sb.humanizeArgKey)(e),content:(0,sb.formatJson)(t)})}let sS=["name","title","label","id"];function sE({label:e,items:t,depth:s}){if(0===t.length)return(0,n.jsxs)("div",{className:"stg:flex stg:items-baseline stg:gap-1.5",children:[(0,n.jsx)("span",{className:"stg:font-medium stg:text-muted-foreground",children:(0,sb.humanizeArgKey)(e)}),(0,n.jsx)("span",{className:"stg:text-muted-foreground-subtle",children:"(0 items)"})]});if(t.every(e=>(0,sb.isScalar)(e)||null==e)&&t.length<=5)return(0,n.jsxs)("div",{className:"stg:space-y-1",children:[(0,n.jsx)("span",{className:"stg:font-medium stg:text-muted-foreground",children:(0,sb.humanizeArgKey)(e)}),(0,n.jsx)("p",{className:"stg:font-mono stg:text-foreground",children:t.map(e=>String(e??"null")).join(", ")})]});return t.every(e=>"object"==typeof e&&null!==e&&!Array.isArray(e))&&(s<5||t.every(e=>sI(Object.entries(e))))?(0,n.jsx)(sT,{label:e,items:t,depth:s}):(0,n.jsx)(sb.CollapsibleJsonBlock,{label:`${(0,sb.humanizeArgKey)(e)} (${t.length} items)`,content:(0,sb.formatJson)(t)})}function sT({label:e,items:t,depth:s}){let[r,i]=(0,a.useState)(!0),o=t.length<=3;return(0,n.jsxs)("div",{className:"stg:space-y-1.5",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),className:"stg:flex stg:items-center stg:gap-1 stg:font-medium stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground",children:[(0,n.jsx)(sO,{expanded:r}),(0,sb.humanizeArgKey)(e)," ",(0,n.jsxs)("span",{className:"stg:font-normal stg:text-muted-foreground-subtle",children:["(",t.length," ",1===t.length?"item":"items",")"]})]}),r&&(0,n.jsx)("div",{className:"stg:space-y-1.5 stg:border-l-2 stg:border-border stg:pl-3",children:t.map((e,t)=>(0,n.jsx)(sA,{item:e,index:t,depth:s,defaultExpanded:o},t))})]})}function sA({item:e,index:t,depth:s,defaultExpanded:r}){let[i,o]=(0,a.useState)(r),l=Object.entries(e),u=function(e){for(let t of sS){let s=e[t];if((0,sb.isScalar)(s))return String(s)}return null}(e),c=u?`Item ${t+1} \u2014 ${u}`:`Item ${t+1}`;return 0===l.length?(0,n.jsxs)("div",{className:"stg:text-muted-foreground",children:[c," ",(0,n.jsx)("span",{className:"stg:font-normal stg:text-muted-foreground-subtle",children:"(empty)"})]}):(0,n.jsxs)("div",{className:"stg:space-y-1",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>o(e=>!e),className:"stg:flex stg:items-center stg:gap-1 stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground",children:[(0,n.jsx)(sO,{expanded:i}),(0,n.jsx)("span",{className:"stg:font-medium",children:`Item ${t+1}`}),u&&(0,n.jsxs)("span",{className:"stg:font-normal stg:text-muted-foreground-subtle",children:["— ",u]})]}),i&&(0,n.jsx)("div",{className:"stg:border-l-2 stg:border-border stg:pl-3",children:(0,n.jsx)(sj,{entries:l,depth:s+1})})]})}function sI(e){return e.every(([,e])=>(0,sb.isScalar)(e)||null==e)}function sM({label:e,children:t}){let[s,r]=(0,a.useState)(!0);return(0,n.jsxs)("div",{className:"stg:space-y-1.5",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>r(e=>!e),className:"stg:flex stg:items-center stg:gap-1 stg:font-medium stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground",children:[(0,n.jsx)(sO,{expanded:s}),e]}),s&&(0,n.jsx)("div",{className:"stg:border-l-2 stg:border-border stg:pl-3",children:t})]})}function sO({expanded:e}){return(0,n.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:(0,u.cn)("stg:shrink-0 stg:transition-transform stg:duration-150",e&&"stg:rotate-90"),"aria-hidden":"true",children:(0,n.jsx)("path",{d:"M2 1L6 4L2 7"})})}let s_=[{name:"approve",label:"Approve"},{name:"reject",label:"Reject"}],sR=(0,a.memo)(function({taskName:e,prompt:t,outcomes:s,formSchema:r,payload:i=null,onSubmit:o,isSubmitting:l,error:c,className:d}){var g;let m=s.length>0?s:s_,[h,p]=(0,a.useState)(null),[f,x]=(0,a.useState)(""),[v,b]=(0,a.useState)({}),y=(0,a.useMemo)(()=>(function(e){if(!e||"object"!=typeof e)return[];let t=e.properties;return t&&"object"==typeof t?Object.entries(t).map(([e,t])=>({name:e,label:sD(e.replace(/_/g," ")),description:"string"==typeof t?.description?t.description:""})):[]})(r),[r]);(0,a.useEffect)(()=>{l||p(null)},[l]);let k=(0,a.useCallback)((e,t)=>{b(s=>({...s,[e]:t}))},[]),j=(0,a.useCallback)(t=>{p(t);let s=y.length>0?Object.fromEntries(Object.entries(v).filter(([,e])=>""!==e.trim())):void 0;o(e,t,s&&Object.keys(s).length>0?s:void 0,f.trim()||void 0)},[e,v,f,y.length,o]);return(0,n.jsxs)("div",{role:"form","aria-label":`Approval decision for ${e}`,"aria-busy":l,className:(0,u.cn)("stg:mt-2 stg:rounded-lg stg:border stg:border-border-prominent stg:border-l-2 stg:border-l-warning stg:p-3",d),children:[t&&(0,n.jsx)("div",{className:"stg:mb-3 stg:max-h-80 stg:overflow-y-auto stg:rounded stg:border stg:border-border stg:bg-background stg:p-3",children:(0,n.jsx)("div",{className:"stgm-prose",children:(0,n.jsx)(sp.default,{components:sf.MARKDOWN_COMPONENTS,remarkPlugins:sf.REMARK_PLUGINS,children:t})})}),null!==i&&(0,n.jsx)("div",{"aria-label":`Review material for ${e}`,className:"stg:mb-3 stg:max-h-96 stg:overflow-y-auto stg:rounded stg:border stg:border-border stg:bg-background stg:p-3",children:null===(g=i)||"object"!=typeof g||Array.isArray(g)?(0,n.jsx)("pre",{className:"stg:overflow-auto stg:whitespace-pre-wrap stg:break-words stg:font-mono stg:text-xs stg:leading-relaxed stg:text-foreground",children:(0,n.jsx)("code",{children:(0,sb.formatJson)(i)})}):(0,n.jsx)(sk,{data:i})}),y.length>0&&(0,n.jsx)("div",{className:"stg:mb-3 stg:space-y-2",children:y.map(t=>(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:`${e}-${t.name}`,className:"stg:mb-1 stg:block stg:text-xs stg:font-medium stg:text-foreground",children:t.label}),(0,n.jsx)("textarea",{id:`${e}-${t.name}`,value:v[t.name]??"",onChange:e=>k(t.name,e.target.value),placeholder:t.description,disabled:l,rows:2,className:(0,u.cn)("stg:w-full stg:rounded stg:border stg:border-border stg:bg-background stg:px-2 stg:py-1.5 stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-ring","stg:disabled:opacity-50","stg:resize-y")})]},t.name))}),(0,n.jsx)("div",{className:"stg:mb-2",children:(0,n.jsx)("textarea",{value:f,onChange:e=>x(e.target.value),placeholder:"Comment (optional)",disabled:l,rows:1,className:(0,u.cn)("stg:w-full stg:rounded stg:border stg:border-border stg:bg-background stg:px-2 stg:py-1.5 stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-ring","stg:disabled:opacity-50","stg:resize-y")})}),(0,n.jsx)("div",{className:"stg:flex stg:flex-wrap stg:gap-2",children:m.map((e,t)=>(0,n.jsx)(sx.DecisionButton,{label:e.label||sD(e.name),variant:function(e,t,s){if(0===t)return"primary";let r=e.toLowerCase();return"reject"===r||"deny"===r||r.includes("reject")||t===s-1&&2===s?"danger":"ghost"}(e.name,t,m.length),onClick:()=>j(e.name),isActive:h===e.name,isSubmitting:l},e.name))}),c&&(0,n.jsx)("div",{className:"stg:mt-2",children:(0,n.jsx)(sv.InCardDecisionError,{error:c,leadIn:"submit decision",cursorTarget:"wf-task-approval-error"})})]})});function sD(e){return e.charAt(0).toUpperCase()+e.slice(1)}let sP=(0,a.memo)(function({taskName:e,prompt:t,outcomes:s,formSchema:r,payload:i=null,uiHint:o,payloadArtifactId:l=null,onSubmit:u,isSubmitting:c,error:g,className:m}){let h=(0,sm.useReviewRenderer)(o),p=function(e,t){let s=(0,a.useContext)(sh.StigmerContext),{data:r,isLoading:n,error:i,refetch:o}=(0,d.useFetch)(t?async()=>{if(!s)throw Error("This gate's review payload is artifact-backed and needs a Stigmer client to fetch. Wrap your component tree with <StigmerProvider client={stigmerClient}>.");let e=await s.artifact.getContent((0,V.create)(el.GetArtifactContentRequestSchema,{artifactId:t,maxBytes:BigInt(0x3200000)}));if(e.truncated)throw Error(`Review payload artifact ${t} exceeds the 52428800 byte limit and was truncated`);return JSON.parse(new TextDecoder().decode(e.content))}:null,[t,s],null);return t?{payload:r,isLoading:n,error:i,refetch:o}:{payload:e,isLoading:!1,error:null,refetch:o}}(i,l??null),f=(0,a.useCallback)((t,s,r)=>u(e,t,s,r),[u,e]);return p.isLoading?(0,n.jsx)(sF,{taskName:e,className:m}):p.error?(0,n.jsx)(sL,{taskName:e,error:p.error,onRetry:p.refetch,className:m}):h&&null!==p.payload?(0,n.jsx)("div",{className:m,children:(0,n.jsx)(h,{taskName:e,payload:p.payload,formSchema:r??null,outcomes:s,submit:f,isSubmitting:c,error:g??null})}):(0,n.jsx)(sR,{taskName:e,prompt:t,outcomes:s,formSchema:r,payload:p.payload,onSubmit:u,isSubmitting:c,error:g,className:m})});function sF({taskName:e,className:t}){return(0,n.jsx)("div",{role:"status","aria-label":`Loading review material for ${e}`,className:(0,u.cn)("stg:mt-2 stg:rounded-lg stg:border stg:border-border-prominent stg:border-l-2 stg:border-l-warning stg:p-3",t),children:(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:text-xs stg:text-muted-foreground",children:[(0,n.jsx)(sW,{}),"Loading review material…"]})})}function sL({taskName:e,error:t,onRetry:s,className:r}){return(0,n.jsxs)("div",{role:"alert",className:(0,u.cn)("stg:mt-2 stg:rounded-lg stg:border stg:border-border-prominent stg:border-l-2 stg:border-l-destructive stg:p-3",r),children:[(0,n.jsxs)("p",{className:"stg:text-xs stg:font-medium stg:text-foreground",children:["Could not load the review material for ",e]}),(0,n.jsx)("p",{className:"stg:mt-1 stg:break-words stg:text-xs stg:text-muted-foreground",children:t.message}),(0,n.jsx)("p",{className:"stg:mt-1 stg:text-xs stg:text-muted-foreground",children:"The gate stays pending — retry to load the material before deciding."}),(0,n.jsx)("button",{type:"button",onClick:s,className:(0,u.cn)("stg:mt-2 stg:rounded stg:border stg:border-border stg:px-2 stg:py-1 stg:text-xs stg:font-medium stg:text-foreground","stg:transition-colors stg:hover:bg-muted","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Retry"})]})}function sW(){return(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"stg:animate-spin","aria-hidden":"true",children:[(0,n.jsx)("circle",{cx:"6",cy:"6",r:"5",stroke:"currentColor",strokeWidth:"1.5",strokeOpacity:"0.25"}),(0,n.jsx)("path",{d:"M11 6a5 5 0 0 0-5-5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}var sK=e.i(414385),sU=e.i(612221);function sB(e,t){let s=e?.[t];return"string"==typeof s?s:""}function sz(e,t){let s=e?.[t];return null===s||"object"!=typeof s||Array.isArray(s)?null:s}let sq=(0,a.memo)(function({taskName:e,prompt:t,outcomes:s,decision:r,className:i}){let o=!r||""===r.outcome,l=(0,a.useMemo)(()=>{if(!r||!r.outcome)return"";let e=s.find(e=>e.name===r.outcome);return e?.label||sG(r.outcome.replace(/_/g," "))},[r,s]),c=(0,a.useMemo)(()=>{let e;return r&&!o?(e=r.outcome.toLowerCase()).includes("reject")||e.includes("deny")||e.includes("decline")?"reject":e.includes("approve")||e.includes("accept")||"yes"===e?"approve":"neutral":"neutral"},[r,o]),d=(0,a.useMemo)(()=>{var e;return(e=r?.formData??null)?Object.entries(e).map(([e,t])=>({key:e,label:sG(e.replace(/_/g," ")),value:function(e){if(null==e)return"";if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return String(e);try{return JSON.stringify(e,null,2)}catch{return String(e)}}(t)})):[]},[r]),g=(0,a.useMemo)(()=>r?function(e){let t=e.reviewerActor,s=t?.displayName||t?.email||e.reviewer;if(!s)return null;let r=t?.email&&t.email!==s?t.email:"";return{label:s,email:r,avatar:t?.avatar??"",isRawId:!t?.displayName&&!t?.email}}(r):null,[r]);return(0,n.jsxs)("div",{role:"group","aria-label":`Approval decision for ${e}`,className:(0,u.cn)("stg:mt-2 stg:rounded-lg stg:border stg:border-border stg:bg-muted-subtle stg:p-3",i),children:[o?(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:text-xs stg:text-muted-foreground",children:[(0,n.jsx)(so.SpinnerIcon,{size:12}),(0,n.jsx)("span",{children:"Decision recorded — finalizing…"})]}):(0,n.jsxs)("div",{className:"stg:flex stg:flex-wrap stg:items-center stg:gap-x-2 stg:gap-y-1",children:[(0,n.jsxs)("span",{className:(0,u.cn)("stg:inline-flex stg:items-center stg:gap-1.5 stg:rounded-md stg:px-2 stg:py-1 stg:text-xs stg:font-medium",sH[c]),children:[(0,n.jsx)(sX,{tone:c}),l]}),r.autoResolved&&(0,n.jsx)("span",{className:"stg:rounded stg:bg-muted stg:px-1.5 stg:py-0.5 stg:text-[10px] stg:font-medium stg:text-muted-foreground",children:"auto-resolved"})]}),!o&&(0,n.jsxs)("div",{className:"stg:mt-1.5 stg:flex stg:flex-wrap stg:items-center stg:gap-x-1.5 stg:text-[11px] stg:text-muted-foreground",children:[g&&(0,n.jsx)(s$,{reviewer:g}),r.respondedAt&&(0,n.jsxs)(n.Fragment,{children:[g&&(0,n.jsx)(sV,{}),(0,n.jsx)("span",{className:"stg:tabular-nums",children:(0,ep.formatTimestamp)(r.respondedAt)})]}),r.waitDurationMs>0&&(0,n.jsxs)(n.Fragment,{children:[(g||r.respondedAt)&&(0,n.jsx)(sV,{}),(0,n.jsxs)("span",{className:"stg:tabular-nums",children:["waited ",(0,ep.formatDuration)(r.waitDurationMs)]})]})]}),t&&(0,n.jsx)("div",{className:"stg:mt-3 stg:max-h-80 stg:overflow-y-auto stg:rounded stg:border stg:border-border stg:bg-background stg:p-3",children:(0,n.jsx)("div",{className:"stgm-prose",children:(0,n.jsx)(sp.default,{components:sf.MARKDOWN_COMPONENTS,remarkPlugins:sf.REMARK_PLUGINS,children:t})})}),!o&&r.comment&&(0,n.jsxs)("div",{className:"stg:mt-3",children:[(0,n.jsx)("p",{className:"stg:mb-1 stg:text-[11px] stg:font-medium stg:uppercase stg:tracking-wide stg:text-muted-foreground",children:"Comment"}),(0,n.jsx)("p",{className:"stg:whitespace-pre-wrap stg:rounded stg:border stg:border-border stg:bg-background stg:p-2 stg:text-xs stg:text-foreground",children:r.comment})]}),!o&&d.length>0&&(0,n.jsx)("dl",{className:"stg:mt-3 stg:space-y-2",children:d.map(e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"stg:mb-1 stg:text-[11px] stg:font-medium stg:uppercase stg:tracking-wide stg:text-muted-foreground",children:e.label}),(0,n.jsx)("dd",{className:"stg:whitespace-pre-wrap stg:rounded stg:border stg:border-border stg:bg-background stg:p-2 stg:text-xs stg:text-foreground",children:e.value})]},e.key))})]})});function s$({reviewer:e}){let t=(0,u.cn)(e.isRawId?"stg:font-mono stg:text-[10px] stg:text-muted-foreground":"stg:font-medium stg:text-foreground");return(0,n.jsxs)("span",{className:"stg:flex stg:items-center stg:gap-1",children:["by"," ",e.avatar&&(0,n.jsx)("img",{src:e.avatar,alt:"",className:"stg:size-3.5 stg:rounded-full"}),e.email?(0,n.jsxs)(e5.Tooltip,{children:[(0,n.jsx)(e5.TooltipTrigger,{render:(0,n.jsx)("span",{className:t}),children:e.label}),(0,n.jsx)(e5.TooltipContent,{side:"top",children:e.email})]}):(0,n.jsx)("span",{className:t,children:e.label})]})}let sH={approve:"stg:bg-success-subtle stg:text-success",reject:"stg:bg-destructive-subtle stg:text-destructive",neutral:"stg:bg-muted stg:text-foreground"};function sG(e){return e.length>0?e.charAt(0).toUpperCase()+e.slice(1):e}function sV(){return(0,n.jsx)("span",{"aria-hidden":"true",children:"·"})}function sX({tone:e}){return"reject"===e?(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M3 3l6 6M9 3l-6 6",strokeLinecap:"round"})}):"approve"===e?(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M2.5 6.5l2.5 2.5 4.5-5.5",strokeLinecap:"round",strokeLinejoin:"round"})}):(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",children:(0,n.jsx)("circle",{cx:"6",cy:"6",r:"4"})})}function sQ(e,t,s){return e&&Object.keys(e).length>0?{data:e,summary:t,artifactIds:s,source:"snapshot"}:t&&Object.keys(t).length>0?{data:t,summary:t,artifactIds:s,source:"event-summary"}:null}let sY=new Map([["ai","action"],["control_flow","control"],["invocation","action"],["data","action"],["governance","gate"],["event","event"],["unspecified","action"]]),sJ=new Map,sZ=new Set([z.WorkflowTaskKind.transform,z.WorkflowTaskKind.validate,z.WorkflowTaskKind.llm_call,z.WorkflowTaskKind.eval,z.WorkflowTaskKind.emit_event,z.WorkflowTaskKind.notification,z.WorkflowTaskKind.agent_call,z.WorkflowTaskKind.set_vars,z.WorkflowTaskKind.human_input,z.WorkflowTaskKind.http_call,z.WorkflowTaskKind.grpc_call,z.WorkflowTaskKind.activity_call,z.WorkflowTaskKind.run_workflow,z.WorkflowTaskKind.try_catch,z.WorkflowTaskKind.raise_error]);function s0(e){return"string"==typeof e&&e.length>0?e:null}function s1(e){return null==e||"object"!=typeof e||Array.isArray(e)?null:e}function s2(e){if(null===e)return"null";if("string"==typeof e)return`"${s5(e)}"`;if("number"==typeof e||"boolean"==typeof e)return String(e);if(Array.isArray(e))return`[${e.length} ${1===e.length?"item":"items"}]`;let t=Object.keys(e);if(1===t.length){let s=e[t[0]];if(null===s||"string"==typeof s||"number"==typeof s||"boolean"==typeof s)return s2(s)}return`{${t.length} ${1===t.length?"field":"fields"}}`}function s5(e){let t=e.indexOf("\n");return -1===t?e:e.slice(0,t)}function s3(e){return e.length>80?`${e.slice(0,79)}\u2026`:e}let s6=new Set(["running","retrying","waiting_approval"]),s7=new Set(["completed","failed","skipped"]),s4=(0,a.memo)(function({taskStates:e,totalTasks:t,isRunning:s,onNavigateToAgentExecution:r,hitl:i,taskSnapshotsByName:o,scrollOnSend:l=!0,className:c}){let d,g,{items:m,progress:h}=(g=function(e,t,s){let r=new Map;if(s)for(let e of s)r.set(e.taskName,e);let n=[],a=0,i=0;for(let t of e.values()){var o,l,u;s7.has(t.status)?a+=1:s6.has(t.status)&&(i+=1);let e=function(e){var t,s;let r=sJ.get(e.taskKind),n=r?.disclosure?.(e)??(t=e.taskKind,sZ.has(t)?"preview":"summary"),a="waiting_approval"===(s=e).status?"Awaiting approval":"failed"===s.status&&s.error?s5(s.error):"skipped"===s.status?"Skipped":null;return null!==a?{previewLine:s3(a),disclosure:n}:{previewLine:s3(r?.previewLine?.(e)??function(e){var t,s;switch(e.taskKind){case z.WorkflowTaskKind.agent_call:return function(e){let t=[];return e.agentSlug&&t.push(e.agentSlug),"running"===e.status&&e.currentToolName&&t.push(`running ${e.currentToolName}`),(e.messagesCount>0||e.toolCallsCount>0)&&t.push(`${e.messagesCount} msgs \xb7 ${e.toolCallsCount} tools`),t.length>0?t.join(" · "):null}(e);case z.WorkflowTaskKind.set_vars:return function(e){if(!e)return null;let t=Object.keys(s1(e.variables)??e);if(0===t.length)return null;let s=t.slice(0,3).join(", "),r=t.length-3;return r>0?`set ${s} +${r} more`:`set ${s}`}(e.inputSummary);case z.WorkflowTaskKind.transform:return function(e){let t=s0(e.inputSummary?.engine)?.toLowerCase()??null;if(e.outputSummary){let s=s2(e.outputSummary);return t?`${t} → ${s}`:`→ ${s}`}return t}(e);case z.WorkflowTaskKind.validate:return function(e){if(!e)return null;let t=e.valid;if(!0===t)return"valid";if(!1===t){let t=Array.isArray(e.errors)?e.errors.length:0;return t>0?`${t} ${1===t?"error":"errors"}`:"invalid"}return null}(e.outputSummary);case z.WorkflowTaskKind.llm_call:return function(e){let t=[],s=s0(e.inputSummary?.model);return s&&t.push(s),e.outputSummary&&t.push(s2(e.outputSummary)),t.length>0?t.join(" · "):null}(e);case z.WorkflowTaskKind.eval:return function(e){if(!e)return null;let t=e.pass,s=e.score;if("boolean"!=typeof t)return null;let r=t?"pass":"fail";return"number"==typeof s?`${r} \xb7 score ${s}`:r}(e.outputSummary);case z.WorkflowTaskKind.emit_event:return function(e){let t=s0(e.outputSummary?.type);if(t)return`emitted ${t}`;let s=s0(s1(e.inputSummary?.event)?.type);return s?`emitting ${s}`:null}(e);case z.WorkflowTaskKind.notification:return function(e){let t=e.outputSummary,s=s0(t?.channel)??s0(e.inputSummary?.channel);return t&&!1===t.delivered?"delivery failed":t&&s?`sent via ${s}`:s}(e);case z.WorkflowTaskKind.human_input:return function(e){let t=s0(e?.outcome);if(!t)return null;let s=s1(e?.reviewer_actor),r=s0(s?.display_name)??s0(s?.email)??s0(e?.reviewer);return r?`${t} \xb7 by ${r}`:t}(e.outputSummary);case z.WorkflowTaskKind.wait:return function(e){let t=e.inputSummary;if(!t)return null;let s="running"===e.status?"waiting":"waited",r=s1(t.duration);if(r){let e=function(e){let t=t=>{let s=e[t];return"number"==typeof s&&Number.isFinite(s)?s:0},s=864e5*t("days")+36e5*t("hours")+6e4*t("minutes")+1e3*t("seconds")+t("milliseconds");return s>0?(0,ep.formatDuration)(s):null}(r);return e?`${s} ${e}`:null}let n=s0(t.until);return n?`${s} until ${n}`:null}(e);case z.WorkflowTaskKind.listen:return"running"===(t=e).status?"waiting for signal":"completed"===t.status?"signal received":null;case z.WorkflowTaskKind.switch_case:return function(e){let t=s0(e?.__flow_directive__);return t?`\u2192 ${t}`:null}(e.outputSummary);case z.WorkflowTaskKind.try_catch:return"completed"===(s=e).status&&s.attemptNumber>1?`recovered after ${s.attemptNumber} attempts`:s.outputSummary?s2(s.outputSummary):null;default:return null}}(e)??""),disclosure:n}}(t),s={taskName:t.taskName,taskKind:t.taskKind,kindLabel:t.taskKind===z.WorkflowTaskKind.workflow_task_kind_unspecified?"":(0,eV.kindToDisplayName)((0,eB.taskKindToString)(t.taskKind)),variant:(o=t.taskKind)===z.WorkflowTaskKind.agent_call?"agent-call":sY.get((0,eV.categorizeKind)((0,eB.taskKindToString)(o)))??"action",status:t.status,durationMs:t.durationMs,costMicros:t.costMicros,tokensUsed:t.tokensUsed,attemptNumber:t.attemptNumber,error:t.error,childExecutionId:t.childExecutionId,agentSlug:t.agentSlug,currentToolName:t.currentToolName,messagesCount:t.messagesCount,toolCallsCount:t.toolCallsCount,previewLine:e.previewLine,disclosure:e.disclosure,inputSummary:t.inputSummary,outputSummary:t.outputSummary,approvalRequest:t.approvalRequest,approvalResolution:t.approvalResolution},c=r.get(t.taskName);n.push(c&&(l=c,u=s,l.taskName===u.taskName&&l.taskKind===u.taskKind&&l.status===u.status&&l.durationMs===u.durationMs&&l.costMicros===u.costMicros&&l.tokensUsed===u.tokensUsed&&l.attemptNumber===u.attemptNumber&&l.error===u.error&&l.childExecutionId===u.childExecutionId&&l.agentSlug===u.agentSlug&&l.currentToolName===u.currentToolName&&l.messagesCount===u.messagesCount&&l.toolCallsCount===u.toolCallsCount&&l.previewLine===u.previewLine&&l.inputSummary===u.inputSummary&&l.outputSummary===u.outputSummary&&l.approvalRequest===u.approvalRequest&&l.approvalResolution===u.approvalResolution)?c:s)}return{items:n,progress:{settledTasks:a,activeTasks:i,totalTasks:t>0?t:0}}}(e,t,(d=(0,a.useRef)([])).current),d.current=g.items,g),{scrollRef:p,sentinelRef:f,contentRef:x,isFollowing:v,jumpToLatest:b}=(0,sr.useAutoScroll)(),y=(0,a.useMemo)(()=>i&&l?{...i,submitApproval:(...e)=>(b(),i.submitApproval(...e)),submitTaskApproval:(...e)=>(b(),i.submitTaskApproval(...e)),submitFileDecision:(...e)=>(b(),i.submitFileDecision(...e))}:i,[i,l,b]);return(0,n.jsxs)("div",{className:(0,u.cn)("stg:relative stg:flex stg:h-full stg:min-h-0 stg:flex-col",c),children:[(0,n.jsx)(s8,{progress:h,isRunning:s}),(0,n.jsx)("div",{ref:p,className:"stg:min-h-0 stg:flex-1 stg:overflow-y-auto",children:(0,n.jsxs)("div",{ref:x,className:"stg:mx-auto stg:flex stg:w-full stg:max-w-3xl stg:flex-col stg:gap-2 stg:px-4 stg:py-4",children:[0===m.length?(0,n.jsx)(s9,{isRunning:s}):m.map(e=>(0,n.jsx)(re,{item:e,onNavigateToAgentExecution:r,hitl:"waiting_approval"===e.status?y:void 0,snapshot:o?.get(e.taskName)},e.taskName)),(0,n.jsx)("div",{ref:f,"aria-hidden":"true"})]})}),(0,n.jsx)(sn.JumpToLatestButton,{visible:!v,onClick:b})]})});function s8({progress:e,isRunning:t}){let{settledTasks:s,activeTasks:r,totalTasks:a}=e,i=a>0?`${s} of ${a} tasks`:`${s} ${1===s?"task":"tasks"}`;return(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:border-b stg:border-border stg:px-4 stg:py-1.5 stg:text-xs stg:text-muted-foreground",children:[(0,n.jsx)("span",{children:i}),r>0&&(0,n.jsxs)("span",{className:"stg:flex stg:items-center stg:gap-1.5",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:(0,u.cn)("stg:size-1.5 stg:rounded-full stg:bg-primary",t&&"stg:animate-pulse")}),r," active"]})]})}function s9({isRunning:e}){return(0,n.jsx)("div",{role:"status",className:"stg:px-4 stg:py-10 stg:text-center stg:text-sm stg:text-muted-foreground",children:e?"Waiting for the first task to start…":"No task activity was recorded for this execution."})}let re=(0,a.memo)(function({item:e,onNavigateToAgentExecution:t,hitl:s,snapshot:r}){let[i,o]=(0,a.useState)(!1),l=(0,a.useMemo)(()=>sQ(r?.output,e.outputSummary,r?.artifactIds??[]),[r,e.outputSummary]),u=(0,a.useMemo)(()=>sQ(r?.input,e.inputSummary,[]),[r,e.inputSummary]),c=(0,a.useMemo)(()=>{var t;return e.approvalRequest?{prompt:(t=e.approvalRequest).prompt,outcomes:(t.outcomes??[]).map(e=>({name:e.name,label:e.label})),formSchema:t.formSchema?t.formSchema:null,payload:t.payload?(0,sK.toJson)(sU.ValueSchema,t.payload):null,uiHint:t.uiHint,payloadArtifactId:t.payloadArtifactId||null}:null},[e.approvalRequest]),d=(0,a.useMemo)(()=>{var t,s;let n;return e.approvalRequest?(t=e.approvalResolution,n=sB(s=r?.output,"outcome"),null===t&&""===n?null:{outcome:n,reviewer:sB(s,"reviewer")||(t?.resolvedBy??""),reviewerActor:function(e,t){let s=sz(t,"reviewer_actor");if(s)return{id:sB(s,"id"),displayName:sB(s,"display_name"),email:sB(s,"email"),avatar:sB(s,"avatar")};let r=e?.resolvedByActor;return r?{id:r.id,displayName:r.displayName,email:r.email,avatar:r.avatar}:null}(t,s),respondedAt:sB(s,"responded_at")||null,comment:sB(s,"comment")||(t?.comment??""),formData:sz(s,"form_data"),waitDurationMs:t?Number(t.waitDurationMs):0,autoResolved:s?.auto_resolved===!0}):null},[e.approvalRequest,e.approvalResolution,r]),g="preview"===e.disclosure,m="agent-call"===e.variant&&""!==e.childExecutionId,h=!!s&&"waiting_approval"===e.status&&!m,p=!h&&null!==c&&null!==d,f=!m&&g&&(null!==l||!!e.error||p),x=!g&&!m&&(rn(e).length>0||!!e.error||null!==u||null!==l),v=(0,ep.formatMetaChips)({durationMs:e.durationMs,costMicros:e.costMicros,tokens:e.tokensUsed}),b=e.previewLine||null;return(0,n.jsxs)(si.ThreadCardShell,{accent:"waiting_approval"===e.status?"warning":null,cursorTarget:"workflow-task-row",children:[(0,n.jsxs)(si.ThreadCardHeader,{gesture:x?{kind:"expand",expanded:i,onToggle:()=>o(e=>!e)}:{kind:"none"},children:[(0,n.jsx)(ro,{status:e.status}),(0,n.jsxs)("span",{className:"stg:min-w-0 stg:flex-1 stg:flex stg:items-baseline stg:gap-1.5 stg:overflow-hidden",children:[(0,n.jsx)("span",{className:"stg:shrink-0 stg:font-medium stg:text-foreground",children:e.taskName}),e.kindLabel&&(0,n.jsx)("span",{className:"stg:shrink-0 stg:rounded stg:border stg:border-border stg:px-1 stg:py-px stg:text-[10px] stg:uppercase stg:tracking-wide stg:text-muted-foreground",children:e.kindLabel}),e.attemptNumber>1&&(0,n.jsxs)("span",{className:"stg:shrink-0 stg:text-muted-foreground",children:["attempt ",e.attemptNumber]}),b&&(0,n.jsx)("span",{className:"stg:min-w-0 stg:truncate stg:text-muted-foreground",children:b})]}),v&&(0,n.jsx)("span",{className:"stg:shrink-0 stg:tabular-nums stg:text-muted-foreground",children:v})]}),h&&s&&(0,n.jsx)(si.ThreadCardBody,{children:(0,n.jsx)(rt,{item:e,hitl:s,approvalRequestView:c})}),m&&(0,n.jsx)(si.ThreadCardBody,{cursorTarget:"task-transcript",children:(0,n.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-2",children:[e.error&&(0,n.jsx)(sa.BoundedContent,{children:(0,n.jsx)("pre",{className:"stg:whitespace-pre-wrap stg:break-words stg:text-xs stg:text-destructive",children:e.error})}),(0,n.jsx)(sd,{childExecutionId:e.childExecutionId,agentSlug:e.agentSlug||void 0,hitl:s,onNavigateToAgentExecution:t})]})}),f&&(0,n.jsx)(si.ThreadCardBody,{cursorTarget:"task-preview",children:(0,n.jsx)(rr,{item:e,outputIO:l,approvalSummary:p&&c?{request:c,decision:d}:void 0})}),x&&i&&(0,n.jsx)(si.ThreadCardBody,{children:(0,n.jsx)(ra,{item:e,inputIO:u,outputIO:l})})]})});function rt({item:e,hitl:t,approvalRequestView:s}){return s?(0,n.jsx)(sP,{taskName:e.taskName,prompt:s.prompt,outcomes:s.outcomes,formSchema:s.formSchema??void 0,payload:s.payload,uiHint:s.uiHint,payloadArtifactId:s.payloadArtifactId,onSubmit:t.submitTaskApproval,isSubmitting:t.taskApprovalSubmittingTaskNames.has(e.taskName),error:t.taskApprovalErrorsByTaskName.get(e.taskName)??null}):(0,n.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"Review required to continue this run."})}function rs({label:e,io:t}){return(0,n.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1",children:[(0,n.jsx)("span",{className:"stg:text-[10px] stg:font-medium stg:uppercase stg:tracking-wide stg:text-muted-foreground",children:e}),"event-summary"===t.source&&(0,n.jsx)("p",{className:"stg:text-[10px] stg:text-muted-foreground",children:"Showing truncated summary from the event log. Full data appears when the run's snapshot is available."}),(0,n.jsx)(sa.BoundedContent,{children:(0,n.jsx)(sk,{data:t.data})})]})}function rr({item:e,outputIO:t,approvalSummary:s}){return(0,n.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-2",children:[e.error&&(0,n.jsx)(sa.BoundedContent,{children:(0,n.jsx)("pre",{className:"stg:whitespace-pre-wrap stg:break-words stg:text-xs stg:text-destructive",children:e.error})}),s?(0,n.jsx)(sq,{taskName:e.taskName,prompt:s.request.prompt,outcomes:s.request.outcomes,decision:s.decision}):t&&(0,n.jsx)(rs,{label:"Output",io:t})]})}function rn(e){let t=[];e.attemptNumber>1&&t.push(["Attempt",String(e.attemptNumber)]);let s=(0,ep.formatMetaChips)({costMicros:e.costMicros,tokens:e.tokensUsed});return s&&t.push(["Usage",s]),"agent-call"===e.variant&&e.agentSlug&&t.push(["Agent",e.agentSlug]),t}function ra({item:e,inputIO:t,outputIO:s}){let r=rn(e);return(0,n.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-2",children:[r.length>0&&(0,n.jsx)("dl",{className:"stg:grid stg:grid-cols-[auto_1fr] stg:gap-x-4 stg:gap-y-1 stg:text-xs",children:r.map(([e,t])=>(0,n.jsxs)("div",{className:"stg:contents",children:[(0,n.jsx)("dt",{className:"stg:text-muted-foreground",children:e}),(0,n.jsx)("dd",{className:"stg:text-foreground",children:t})]},e))}),e.error&&(0,n.jsx)(sa.BoundedContent,{children:(0,n.jsx)("pre",{className:"stg:whitespace-pre-wrap stg:break-words stg:text-xs stg:text-destructive",children:e.error})}),t&&(0,n.jsx)(rs,{label:"Input",io:t}),s&&(0,n.jsx)(rs,{label:"Output",io:s})]})}let ri={running:{Icon:so.SpinnerIcon,color:"stg:text-foreground"},retrying:{Icon:so.SpinnerIcon,color:"stg:text-warning"},waiting_approval:{Icon:so.ClockIcon,color:"stg:text-warning"},completed:{Icon:so.CheckCircleIcon,color:"stg:text-success"},failed:{Icon:so.XCircleIcon,color:"stg:text-destructive"},skipped:{Icon:so.SlashCircleIcon,color:"stg:text-muted-foreground"},pending:{Icon:so.DotIcon,color:"stg:text-muted-foreground"}};function ro({status:e}){let{Icon:t,color:s}=ri[e];return(0,n.jsx)("span",{className:(0,u.cn)("stg:shrink-0",s),"aria-hidden":"true",children:(0,n.jsx)(t,{})})}let rl="stgm-wf-exec-center-view.v2";function ru(){try{let e=localStorage.getItem(rl);if("thread"===e||"graph"===e)return e}catch{}return"thread"}let rc=(0,a.memo)(function({executionId:e,org:t,onNavigateToAgentExecution:s,onNavigateToWorkflowEditor:r,headerActions:i,nodesDraggable:o,panel:l="auto",defaultPanelOpen:g,panelOpen:m,onPanelOpenChange:h,className:p}){let f,x,{execution:v,isLoading:b,error:y,refetch:k}=G(e),j=v?.status?.phase,w=j===B.ExecutionPhase.EXECUTION_PENDING||j===B.ExecutionPhase.EXECUTION_IN_PROGRESS,{events:N,taskStates:C,costSummary:S,streamState:E,totalTasks:T,error:A,reconnect:I}=eo(e,{executionPhase:j}),M=(0,a.useMemo)(()=>{if(N.length>0||"complete"!==E.stage)return null;let e=v?.status?.tasks;if(!e||0===e.length)return null;let t=new Map;for(let s of e){let e=s.taskName;if(!e)continue;let r="pending";switch(s.status){case B.WorkflowTaskStatus.WORKFLOW_TASK_IN_PROGRESS:r="running";break;case B.WorkflowTaskStatus.WORKFLOW_TASK_COMPLETED:r="completed";break;case B.WorkflowTaskStatus.WORKFLOW_TASK_FAILED:r="failed";break;case B.WorkflowTaskStatus.WORKFLOW_TASK_SKIPPED:r="skipped";break;case B.WorkflowTaskStatus.WORKFLOW_TASK_WAITING_APPROVAL:r="waiting_approval";break;default:r="pending"}let n=0;s.startedAt&&s.completedAt&&(n=new Date(s.completedAt).getTime()-new Date(s.startedAt).getTime()),t.set(e,{taskName:e,taskKind:z.WorkflowTaskKind.workflow_task_kind_unspecified,status:r,durationMs:n,costMicros:BigInt(0),tokensUsed:BigInt(0),attemptNumber:1,error:s.error??"",childExecutionId:"",agentSlug:"",currentToolName:"",messagesCount:0,toolCallsCount:0,inputSummary:null,outputSummary:null,approvalRequest:null,approvalResolution:null})}return t},[N.length,E.stage,v?.status?.tasks]),O=M??C,_=M?M.size:T,R=(0,a.useMemo)(()=>{let e=v?.status?.tasks;if(!e||0===e.length)return;let t=new Map;for(let s of e)s.taskName&&t.set(s.taskName,s);return t},[v?.status?.tasks]),{artifacts:D}=function(e){let t=(0,c.useStigmer)(),s=e?async()=>[...(await t.artifact.listByExecution((0,V.create)(el.ListArtifactsByExecutionRequestSchema,{workflowExecutionId:e}))).entries]:null,{data:r,isLoading:n,isRefetching:a,error:i,refetch:o}=(0,d.useFetch)(s,[e,t],[],{cacheKey:e?`workflow-execution-artifacts:${e}`:void 0});return{artifacts:r,isLoading:n,isRefetching:a,error:i,refetch:o}}(e),P=function({executionId:e,taskStates:t,taskSnapshots:s}){let r=(0,c.useStigmer)(),n=(0,a.useRef)(r);n.current=r;let i=function(e,t){let s=[],r=new Set,n=new Set;for(let t of e.values())!t.childExecutionId||r.has(t.childExecutionId)||(r.add(t.childExecutionId),n.add(t.taskName),s.push({taskName:t.taskName,childExecutionId:t.childExecutionId,settled:ec.has(t.status)}));if(!t||0===t.length)return s;let a=[];for(let s of t){if(!s.taskName||n.has(s.taskName))continue;let t=s.metadata,i=t?.agent_execution_id;if("string"!=typeof i||!i||r.has(i))continue;r.add(i);let o=e.get(s.taskName);a.push({taskName:s.taskName,childExecutionId:i,settled:o?ec.has(o.status):ed.has(s.status),startedAt:s.startedAt??""})}for(let{startedAt:e,...t}of(a.sort((e,t)=>e.startedAt&&t.startedAt?e.startedAt.localeCompare(t.startedAt):0),a))s.push(t);return s}(t,s),o=i.map(e=>`${e.childExecutionId}:${e.settled?"1":"0"}`).join("\n"),l=(0,a.useRef)({signature:o,children:i});l.current.signature!==o&&(l.current={signature:o,children:i});let u=l.current.children,[d,g]=(0,a.useState)(()=>new Map),m=(0,a.useRef)(new Map),[h,p]=(0,a.useState)(!1),[f,x]=(0,a.useState)(null),[v,b]=(0,a.useState)(0),y=(0,a.useMemo)(()=>()=>{m.current.clear(),b(e=>e+1)},[]),k=(0,a.useRef)(e);k.current!==e&&(k.current=e,m.current.clear(),g(new Map),p(!1),x(null)),(0,a.useEffect)(()=>{if(!e)return;let t=u.filter(e=>{let t=m.current.get(e.childExecutionId);return void 0===t||!1===t&&e.settled});if(0===t.length)return;let s=!1;return p(!0),x(null),(async()=>{let e=await Promise.all(t.map(async e=>{try{let t=await n.current.agentExecution.get(e.childExecutionId);return{child:e,execution:t,error:null}}catch(t){return{child:e,execution:null,error:(0,Y.toError)(t)}}}));s||(g(t=>{let s=new Map(t);for(let{child:t,execution:r}of e)r&&(s.set(t.childExecutionId,r),m.current.set(t.childExecutionId,t.settled));return s}),x(e.find(e=>e.error)?.error??null),p(!1))})(),()=>{s=!0}},[e,o,v]);let j=(0,a.useMemo)(()=>{let e=[];for(let t of u){let s=d.get(t.childExecutionId);s&&e.push(s)}return(0,eu.deriveExecutionFileChanges)(e)},[u,d]),w=d.size>0,N=h&&!w,C=h&&w;return(0,a.useMemo)(()=>({fileChanges:j,fileChangeCount:j.length,isLoading:N,isRefetching:C,error:f,refetch:y}),[j,N,C,f,y])}({executionId:e,taskStates:O,taskSnapshots:v?.status?.tasks}),F=function(e,t){let s=(0,c.useStigmer)(),[r,n]=(0,a.useState)(!1),[i,o]=(0,a.useState)(null),l=(0,eg.useKeyedSubmission)(),u=(0,eg.useKeyedSubmission)(),d=(0,eg.useKeyedSubmission)(),g=(0,a.useRef)(e);g.current=e;let m=(0,a.useRef)(s);m.current=s;let h=(0,a.useRef)(t?.onSuccess);h.current=t?.onSuccess;let p=(0,a.useCallback)(()=>o(null),[]),f=(0,a.useCallback)(async(e,t=!0)=>{if(!g.current)return null;n(!0),o(null);try{let s=await e();return t&&h.current?.(s),s}catch(e){return o((0,Y.toError)(e)),null}finally{n(!1)}},[]),x=(0,a.useCallback)(e=>f(()=>m.current.workflowExecution.cancel((0,V.create)(X.CancelWorkflowExecutionInputSchema,{id:g.current,reason:e??""}))),[f]),v=(0,a.useCallback)(e=>f(()=>m.current.workflowExecution.terminate((0,V.create)(X.TerminateWorkflowExecutionInputSchema,{id:g.current,reason:e??""}))),[f]),b=(0,a.useCallback)(e=>f(()=>m.current.workflowExecution.pause((0,V.create)(X.PauseWorkflowExecutionInputSchema,{id:g.current,reason:e??""}))),[f]),y=(0,a.useCallback)(()=>f(()=>m.current.workflowExecution.resume((0,V.create)(X.ResumeWorkflowExecutionInputSchema,{id:g.current}))),[f]),k=(0,a.useCallback)(e=>f(()=>m.current.workflowExecution.recover((0,V.create)(X.RecoverWorkflowExecutionInputSchema,{id:g.current,reason:e??""}))),[f]),j=(0,a.useCallback)((e,t,s)=>g.current?l.run(e,()=>m.current.workflowExecution.submitApproval((0,V.create)(X.SubmitWorkflowApprovalInputSchema,{executionId:g.current,toolCallId:e,action:t,comment:s??""}))).catch(()=>null):Promise.resolve(null),[l.run]),w=(0,a.useCallback)((e,t,s,r)=>g.current?u.run(e,()=>m.current.workflowExecution.submitWorkflowTaskApproval((0,V.create)(X.SubmitWorkflowTaskApprovalInputSchema,{executionId:g.current,taskName:e,outcome:t,formData:s,reviewer:"",comment:r??""}))).catch(()=>null):Promise.resolve(null),[u.run]),N=(0,a.useCallback)((e,t,s,r)=>{if(!g.current)return Promise.resolve(null);let n=r?.fileChangeId??"",a=r?.scope??(n?ee.FileDecisionScope.FILE:ee.FileDecisionScope.CHANGE_SET),i=(0,em.fileDecisionKey)(t,n||void 0);return d.run(i,()=>m.current.workflowExecution.submitFileDecision((0,V.create)(X.SubmitWorkflowFileDecisionInputSchema,{executionId:g.current,childAgentExecutionId:e,changeSetId:t,scope:a,fileChangeId:n,action:s,expectedDigest:r?.expectedDigest??"",reason:r?.reason??"",acknowledgeUnreviewable:r?.acknowledgeUnreviewable??!1}))).catch(()=>null)},[d.run]);return(0,a.useMemo)(()=>({cancel:x,terminate:v,pause:b,resume:y,recover:k,submitApproval:j,submitTaskApproval:w,submitFileDecision:N,isSubmitting:r,error:i,clearError:p,approvalSubmittingToolCallIds:l.submittingKeys,approvalErrorsByToolCallId:l.errorsByKey,taskApprovalSubmittingTaskNames:u.submittingKeys,taskApprovalErrorsByTaskName:u.errorsByKey,fileDecisionSubmittingKeys:d.submittingKeys,fileDecisionErrorsByKey:d.errorsByKey}),[x,v,b,y,k,j,w,N,r,i,p,l.submittingKeys,l.errorsByKey,u.submittingKeys,u.errorsByKey,d.submittingKeys,d.errorsByKey])}(e,{onSuccess:k}),L=(0,a.useMemo)(()=>({submitApproval:F.submitApproval,approvalSubmittingToolCallIds:F.approvalSubmittingToolCallIds,approvalErrorsByToolCallId:F.approvalErrorsByToolCallId,submitFileDecision:F.submitFileDecision,fileDecisionSubmittingKeys:F.fileDecisionSubmittingKeys,fileDecisionErrorsByKey:F.fileDecisionErrorsByKey,submitTaskApproval:F.submitTaskApproval,taskApprovalSubmittingTaskNames:F.taskApprovalSubmittingTaskNames,taskApprovalErrorsByTaskName:F.taskApprovalErrorsByTaskName}),[F.submitApproval,F.approvalSubmittingToolCallIds,F.approvalErrorsByToolCallId,F.submitFileDecision,F.fileDecisionSubmittingKeys,F.fileDecisionErrorsByKey,F.submitTaskApproval,F.taskApprovalSubmittingTaskNames,F.taskApprovalErrorsByTaskName]),W="none"!==l,K=function({defaultView:e="artifacts",open:t,defaultOpen:s=!1,onOpenChange:r}={}){let n=(0,eN.useWorkspaceEditorsStoreRef)(),i=void 0!==t,[o,l]=(0,a.useState)(s),u=i?t:o,c=(0,a.useRef)(r);c.current=r;let d=(0,a.useRef)(i);d.current=i;let g=(0,a.useRef)(u);g.current=u;let m=(0,a.useCallback)(e=>{g.current!==e&&(d.current||(g.current=e,l(e)),c.current?.(e))},[]),[h,p]=(0,a.useState)(e),f=(0,a.useCallback)(()=>m(!0),[m]),x=(0,a.useCallback)(()=>m(!1),[m]),v=(0,a.useCallback)(e=>p(e),[]),b=(0,a.useCallback)(()=>{n.openPinned(tR,tD),m(!0)},[n,m]),y=(0,a.useCallback)((e,t,s)=>{n.openPreview(e,t,s),m(!0)},[n,m]),k=(0,a.useCallback)(e=>{n.openPreview(tE.ARTIFACT_DOCUMENT_ENTRY_ID,tP(e)),m(!0)},[n,m]),j=(0,a.useCallback)(e=>{n.pin(tE.ARTIFACT_DOCUMENT_ENTRY_ID,tP(e))},[n]),w=(0,a.useCallback)(e=>{n.openPreview(tA,tI(e)),m(!0)},[n,m]),N=(0,a.useCallback)(e=>{n.pin(tA,tI(e))},[n]),C=(0,a.useCallback)((e,t)=>n.activate(e,t),[n]),S=(0,a.useCallback)((e,t)=>n.pin(e,t),[n]),E=(0,a.useCallback)((e,t)=>n.close(e,t),[n]);return(0,a.useMemo)(()=>({editorsStore:n,isOpen:u,view:h,openPanel:f,closePanel:x,setView:v,openDiagnosis:b,openFile:y,activateEditor:C,pinEditor:S,closeEditor:E,openArtifact:k,pinArtifact:j,openFileChange:w,pinFileChange:N}),[n,u,h,f,x,v,b,y,C,S,E,k,j,w,N])}({open:!!W&&m,defaultOpen:g,onOpenChange:W?h:void 0}),[U,q]=(0,a.useState)(!1),[$,H]=(0,a.useState)(null),[Q,J]=(0,a.useState)(ru),Z=(0,a.useCallback)(e=>{J(e);try{localStorage.setItem(rl,e)}catch{}},[]);(0,a.useEffect)(()=>{try{localStorage.removeItem("stgm-wf-exec-center-view")}catch{}},[]);let et=e6(O),es=(0,a.useRef)(E.stage);(0,a.useEffect)(()=>{let e=es.current;es.current=E.stage;let t="complete"===E.stage&&("streaming"===e||"reconnecting"===e),s="streaming"===E.stage&&"streaming"!==e;(t||s)&&k()},[E.stage,k]);let er=(0,a.useCallback)(e=>{k()},[k]);f=(0,a.useRef)(new Map),(x=(0,a.useRef)(er)).current=er,(0,a.useEffect)(()=>{let e=f.current;if(f.current=O,!w)return;let t=[],s=[];for(let[r,n]of O){let a=e.get(r)?.status;a!==n.status&&("waiting_approval"===n.status?t.push(r):"waiting_approval"===a&&s.push(r))}(t.length>0||s.length>0)&&x.current({entered:t,exited:s})},[O,w]);let en=(0,a.useCallback)(()=>{q(!0)},[]),ea=(0,a.useCallback)(()=>{q(!1)},[]),ei=(0,a.useCallback)(e=>{H(e),q(!1)},[]),eh=(0,a.useCallback)(()=>{H(null)},[]),ep=(0,a.useCallback)(e=>{r&&r(e,v?.metadata?.slug??v?.metadata?.name??"")},[r,v]);return b?(0,n.jsx)("div",{className:(0,u.cn)("stg:flex stg:h-full stg:items-center stg:justify-center",p),children:(0,n.jsx)(rh,{})}):y?(0,n.jsxs)("div",{className:(0,u.cn)("stg:flex stg:h-full stg:flex-col stg:items-center stg:justify-center stg:gap-3 stg:px-6",p),children:[(0,n.jsx)("p",{className:"stg:text-sm stg:text-destructive",children:y.message}),(0,n.jsx)("button",{type:"button",onClick:k,className:"stg:rounded stg:border stg:border-border stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium stg:text-foreground stg:hover:bg-muted",children:"Retry"})]}):v?(0,n.jsxs)("div",{className:(0,u.cn)("stg:flex stg:h-full stg:flex-col stg:overflow-hidden",p),children:[(0,n.jsx)(ev,{execution:v,streamState:E,costSummary:S,actions:F,onDiagnose:t&&W?K.openDiagnosis:void 0,onCompare:en,headerActions:(0,n.jsxs)(n.Fragment,{children:[i,W&&(0,n.jsx)(t_.PanelChip,{isOpen:K.isOpen,onToggle:K.isOpen?K.closePanel:K.openPanel,badgeCount:D.length})]})}),(0,n.jsx)(to,{open:U,workflowId:v.spec?.workflowId??v.spec?.workflowInstanceId??"",baseExecutionId:e,basePhase:j??0,onConfirm:ei,onClose:ea}),F.error&&(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:border-b stg:border-destructive/20 stg:bg-destructive/5 stg:px-4 stg:py-2",children:[(0,n.jsx)("p",{className:"stg:flex-1 stg:text-xs stg:text-destructive",children:F.error.message}),(0,n.jsx)("button",{type:"button",onClick:F.clearError,className:"stg:shrink-0 stg:rounded stg:border stg:border-destructive/30 stg:px-2 stg:py-1 stg:text-xs stg:text-destructive stg:hover:bg-destructive/10",children:"Dismiss"})]}),$?(0,n.jsx)("div",{className:"stg:min-h-0 stg:flex-1 stg:overflow-y-auto stg:p-4",children:(0,n.jsx)(tN,{baseExecutionId:e,compareExecutionId:$,onBack:eh})}):(0,n.jsxs)(n.Fragment,{children:[A&&(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:border-b stg:border-destructive/20 stg:bg-destructive/5 stg:px-4 stg:py-2",children:[(0,n.jsx)("p",{className:"stg:flex-1 stg:text-xs stg:text-destructive",children:A.message}),(0,n.jsx)("button",{type:"button",onClick:I,className:"stg:shrink-0 stg:rounded stg:border stg:border-destructive/30 stg:px-2 stg:py-1 stg:text-xs stg:text-destructive stg:hover:bg-destructive/10",children:"Reconnect"})]}),(0,n.jsx)(tS.ResizableSplit,{resizablePane:"secondary",collapsedPane:K.isOpen?"none":"secondary",defaultSize:560,minSize:360,maxSize:960,storageKey:"stgm-wf-exec-panel-width",ariaLabel:"Resize execution panel",className:"stg:min-h-0 stg:flex-1",primary:(0,n.jsxs)("div",{className:"stg:flex stg:h-full stg:min-h-0 stg:flex-1 stg:flex-col",children:[(0,n.jsx)(rp,{view:Q,onChange:Z}),(0,n.jsx)("div",{role:"log","aria-live":"polite","aria-atomic":"false",className:"stg:sr-only",children:et}),(0,n.jsx)("div",{"data-center-view":"thread",className:(0,u.cn)("stg:min-h-0 stg:flex-1","thread"!==Q&&"stg:hidden"),children:(0,n.jsx)(s4,{taskStates:O,totalTasks:_,isRunning:w,onNavigateToAgentExecution:s,hitl:L,taskSnapshotsByName:R,className:"stg:h-full"})}),(0,n.jsx)("div",{"data-center-view":"graph",className:(0,u.cn)("stg:min-h-0 stg:flex-1","graph"!==Q&&"stg:hidden"),children:(0,n.jsx)(e9,{executionId:e,execution:v,taskStates:O,followExecution:w&&"graph"===Q,announceTaskStates:!1,nodesDraggable:o,className:"stg:h-full"})})]}),secondary:K.isOpen&&W?(0,n.jsx)(rd,{panel:K,executionId:e,org:t,artifacts:D,fileChangesState:P,costSummary:S,taskStates:O,onApplyFix:r?ep:void 0}):null})]})]}):(0,n.jsx)("div",{className:(0,u.cn)("stg:flex stg:h-full stg:items-center stg:justify-center stg:text-sm stg:text-muted-foreground",p),children:"Execution not found"})});function rd({panel:e,executionId:t,org:s,artifacts:r,fileChangesState:i,costSummary:o,taskStates:l,onApplyFix:u}){let{editors:c,activeFile:d}=(0,eN.useWorkspaceEditors)(e.editorsStore),g=d?.entryId===tA?d.path:null,m=function({artifacts:e,onOpenArtifact:t,onActivateArtifact:s,fileChanges:r,fileChangesLoading:i,fileChangesRefetching:o,fileChangesError:l,activeFileChangePath:u,onOpenFileChange:c,costSummary:d,taskStates:g}){return(0,a.useMemo)(()=>[{id:"artifacts",label:"Artifacts",icon:(0,n.jsx)(t0,{}),badge:e.length>0?e.length:void 0,content:(0,n.jsx)(tB,{artifacts:e,onOpen:t,onActivate:s})},{id:"changes",label:"Changes",icon:(0,n.jsx)(t1,{}),badge:r.length>0?r.length:void 0,content:(0,n.jsx)(t$,{fileChanges:r,isLoading:i,isRefetching:o,error:l,activePath:u,onOpen:c})},{id:"usage",label:"Usage",icon:(0,n.jsx)(t2,{}),content:(0,n.jsx)(tX,{costSummary:d,taskStates:g})}],[e,t,s,r,i,o,l,u,c,d,g])}({artifacts:r,onOpenArtifact:e.openArtifact,onActivateArtifact:e.pinArtifact,fileChanges:i.fileChanges,fileChangesLoading:i.isLoading,fileChangesRefetching:i.isRefetching,fileChangesError:i.error,activeFileChangePath:g,onOpenFileChange:e.openFileChange,costSummary:o,taskStates:l}),h=(0,a.useMemo)(()=>new Map(r.map(e=>[tP(e),e])),[r]),p=(0,a.useMemo)(()=>new Map(i.fileChanges.map(e=>[tI(e),e])),[i.fileChanges]),f=(0,a.useMemo)(()=>c.filter(e=>e.entryId===tE.ARTIFACT_DOCUMENT_ENTRY_ID||e.entryId===tA||e.entryId===tR).map(r=>{if(r.entryId===tR)return{entryId:tR,path:r.path,content:(0,n.jsx)(e_,{executionId:t,org:s??"",onApplyFix:u,onClose:()=>e.closeEditor(tR,tD)},r.path)};if(r.entryId===tA){let e=p.get(r.path);return{entryId:tA,path:r.path,content:e?(0,n.jsx)("div",{className:"stg:mx-auto stg:w-full stg:max-w-5xl stg:px-4 stg:py-4",children:(0,n.jsx)(tM.FileChangeDiff,{change:e},r.path)}):(0,n.jsx)(rg,{})}}let a=h.get(r.path);return{entryId:tE.ARTIFACT_DOCUMENT_ENTRY_ID,path:r.path,content:a?(0,n.jsx)(t4,{artifact:a},r.path):(0,n.jsx)(rm,{})}}),[c,h,p,t,s,u,e.closeEditor]);return(0,n.jsx)(tO.WorkspaceSurface,{entries:[],lister:void 0,reader:void 0,builtInViews:[],view:e.view,onViewChange:e.setView,extraViews:m,virtualDocuments:f,editors:c,selectedFile:d,onOpenFile:e.openFile,onActivateEditor:e.activateEditor,onPinEditor:e.pinEditor,onCloseEditor:e.closeEditor,onCollapse:e.closePanel,className:"stg:h-full"})}function rg(){return(0,n.jsxs)("div",{role:"status",className:"stg:mx-auto stg:flex stg:w-full stg:max-w-3xl stg:flex-col stg:items-center stg:gap-1 stg:px-4 stg:py-8 stg:text-center",children:[(0,n.jsx)("p",{className:"stg:text-xs stg:font-medium stg:text-foreground",children:"This file change is no longer available."}),(0,n.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"The rollup was refreshed and this file no longer appears among the execution's changes."})]})}function rm(){return(0,n.jsxs)("div",{role:"status",className:"stg:mx-auto stg:flex stg:w-full stg:max-w-3xl stg:flex-col stg:items-center stg:gap-1 stg:px-4 stg:py-8 stg:text-center",children:[(0,n.jsx)("p",{className:"stg:text-xs stg:font-medium stg:text-foreground",children:"This artifact is no longer available."}),(0,n.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"It may have expired or been removed from storage."})]})}function rh(){return(0,n.jsxs)("div",{className:"stg:flex stg:w-full stg:flex-col stg:gap-3 stg:p-6",children:[(0,n.jsx)("div",{className:"stg:h-4 stg:w-48 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,n.jsx)("div",{className:"stg:h-3 stg:w-32 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,n.jsx)("div",{className:"stg:mt-4 stg:space-y-2",children:Array.from({length:5},(e,t)=>(0,n.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-3",children:[(0,n.jsx)("div",{className:"stg:size-3 stg:animate-pulse stg:rounded-full stg:bg-muted"}),(0,n.jsx)("div",{className:"stg:h-3 stg:flex-1 stg:animate-pulse stg:rounded stg:bg-muted"})]},t))})]})}function rp({view:e,onChange:t}){return(0,n.jsxs)("div",{role:"radiogroup","aria-label":"Center view",className:"stg:flex stg:items-center stg:gap-0.5 stg:border-b stg:border-[var(--stgm-border,#e5e5e5)] stg:px-2 stg:py-1",children:[(0,n.jsx)(rf,{label:"Thread",isActive:"thread"===e,onClick:()=>t("thread")}),(0,n.jsx)(rf,{label:"Graph",isActive:"graph"===e,onClick:()=>t("graph")})]})}function rf({label:e,isActive:t,onClick:s}){return(0,n.jsx)("button",{type:"button",role:"radio","aria-checked":t,onClick:s,className:(0,u.cn)("stg:rounded stg:px-2 stg:py-0.5 stg:text-xs stg:font-medium stg:transition-colors",t?"stg:bg-[var(--stgm-muted,#f5f5f5)] stg:text-[var(--stgm-foreground,#171717)]":"stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:text-[var(--stgm-foreground,#171717)]"),children:e})}function rx({executionId:e,org:t}){let{navigateToSession:s}=(0,h.useSessionNavigation)(),r=(0,R.useActiveOrgSlug)(),i=t??r,o=(0,R.useActiveOrgId)(),[l,u]=(0,a.useState)(null),{sessionId:c,isLoading:d}=g(l);(0,a.useEffect)(()=>{c&&s(c)},[c,s]);let m=(0,a.useCallback)(e=>{u(e)},[]),p=(0,a.useCallback)((e,t)=>{let s=i??"";window.location.href=`/library/workflows/${s}/${t}`},[i]);return(0,n.jsxs)("div",{className:"relative flex h-full w-full flex-col",children:[d&&(0,n.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-4 z-50 flex justify-center",children:(0,n.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2 text-sm text-muted-foreground shadow-md",children:[(0,n.jsx)("div",{className:"size-4 animate-spin rounded-full border-2 border-muted border-t-primary"}),"Navigating to session…"]})}),(0,n.jsx)(rc,{executionId:e,org:i,onNavigateToAgentExecution:m,onNavigateToWorkflowEditor:p,headerActions:(0,n.jsx)(L.ManageAccessButton,{resource:{kind:W.ApiResourceKind.workflow_execution,kindString:"workflow_execution",id:e,org:o}}),nodesDraggable:!0},e)]})}var rv=e.i(440160);let rb=(0,o.default)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);var ry=e.i(37727);let rk=[{test:e=>e.endsWith(".dmg"),os:"macos",arch:null,label:"macOS"},{test:e=>e.endsWith("-setup.exe"),os:"windows",arch:"x64",label:"Windows (64-bit)"},{test:e=>e.endsWith(".deb"),os:"linux",arch:"x64",label:"Linux (.deb)"},{test:e=>e.endsWith(".AppImage"),os:"linux",arch:"x64",label:"Linux (.AppImage)"}],rj=null;async function rw(){if(rj)return{ok:!0,release:rj};try{let e=await fetch("https://api.github.com/repos/stigmer/stigmer/releases/latest",{headers:{Accept:"application/vnd.github.v3+json"}});if(!e.ok)return{ok:!1,reason:"fetch-failed",status:e.status};let t=await e.json(),s=(t.tag_name??"").replace(/^v/,""),r=[];for(let e of t.assets??[]){let t=function(e,t){for(let s of rk)if(s.test(e))return{os:s.os,arch:s.arch,url:t,filename:e,label:s.label};return null}(e.name,e.browser_download_url);t&&r.push(t)}if(0===r.length)return{ok:!1,reason:"no-assets"};return rj={version:s,assets:r},{ok:!0,release:rj}}catch{return{ok:!1,reason:"fetch-failed"}}}let rN={macos:"Open the .dmg and drag Stigmer to Applications.",windows:"Run the installer and follow the prompts.",linux:"Install with sudo dpkg -i <filename>."},rC={macos:"macOS",windows:"Windows",linux:"Linux"},rS={label:"Download page",onClick:()=>window.open("https://stigmer.ai/download","_blank","noopener,noreferrer")};async function rE(){try{let[e,t]=await Promise.all([new Promise(e=>{if("u"<typeof navigator)return void e({os:null,arch:null});let t=navigator.userAgent.toLowerCase(),s=null;t.includes("mac")?s="macos":t.includes("win")?s="windows":t.includes("linux")&&(s="linux");let r=null;if("macos"===s){let t=navigator.userAgentData;if(t)return void t.getHighEntropyValues(["architecture"]).then(t=>{e({os:s,arch:"arm"===t.architecture?"arm64":"x64"})}).catch(()=>{e({os:s,arch:"arm64"})});r="arm64"}else("windows"===s||"linux"===s)&&(r="x64");e({os:s,arch:r})}),rw()]);if(!e.os){console.warn("[desktop-download] Platform detection returned no OS",{userAgent:"u">typeof navigator?navigator.userAgent:"n/a"}),f.toast.warning("Couldn’t detect your platform.",{description:"Visit the download page to pick the right installer.",action:rS,duration:8e3});return}if(!t.ok){console.warn("[desktop-download] Release fetch failed",t),f.toast.warning("Couldn’t reach the download server.",{description:"Try again in a moment, or visit the download page.",action:rS,duration:8e3});return}let s=function(e,t){if(!t.os)return null;let s=e.filter(e=>e.os===t.os&&(null===e.arch||null===t.arch||e.arch===t.arch));return 0===s.length?null:1===s.length?s[0]:s.find(e=>e.filename.endsWith(".deb"))??s[0]}(t.release.assets,e);if(!s){console.warn("[desktop-download] No matching asset for platform",{platform:e,availableAssets:t.release.assets.map(e=>({os:e.os,arch:e.arch,filename:e.filename}))}),f.toast.warning(`No installer found for ${rC[e.os]??e.os}.`,{description:"This platform may not be supported yet. Check all available downloads.",action:rS,duration:8e3});return}let r=document.createElement("a");r.href=s.url,r.download=s.filename,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),function(){try{localStorage.setItem(rI,new Date().toISOString()),window.dispatchEvent(new StorageEvent("storage",{key:rI}))}catch{}}(),f.toast.success(`Downloading Stigmer Desktop for ${s.label}`,{description:rN[s.os??""]??"Check your downloads folder for the installer.",duration:8e3})}catch(e){console.warn("[desktop-download] Unexpected error",e),f.toast.warning("Something went wrong.",{description:"Visit the download page to download Stigmer Desktop.",action:rS,duration:8e3})}}let rT="stigmer:desktop-banner-first-seen",rA="stigmer:desktop-banner-dismissed",rI="stigmer:desktop-downloaded",rM="stigmer:has-local-runner",rO="2026.04",r_=!1;function rR(){try{if(r_||function(){try{if(function(){try{return"__TAURI__"in window}catch{return!1}}()||localStorage.getItem(rI)||localStorage.getItem(rM))return!0;return!1}catch{return!1}}()||function(){try{let e=localStorage.getItem(rA);if(!e)return!1;let t=JSON.parse(e);return t?.campaign===rO}catch{return!1}}())return!1;return null!==localStorage.getItem(rT)}catch{return!1}}function rD(){return!1}function rP(e){function t(t){(t.key===rT||t.key===rA||t.key===rI||t.key===rM)&&e()}return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)}function rF({onDismiss:e}){return(0,n.jsxs)("aside",{role:"complementary","aria-label":"Desktop app",className:"bg-card border-border-muted flex items-center gap-3 border-b px-4 py-2.5",children:[(0,n.jsx)(rb,{className:"text-muted-foreground size-4 shrink-0"}),(0,n.jsxs)("p",{className:"text-muted-foreground min-w-0 flex-1 text-xs",children:[(0,n.jsx)("span",{className:"text-foreground font-medium",children:"Stigmer Desktop"})," — ","manage runners from your system tray with deep-link launches and native notifications."]}),(0,n.jsxs)("button",{type:"button",onClick:rE,className:"text-primary hover:text-foreground inline-flex shrink-0 items-center gap-1 text-xs font-medium transition-colors",children:["Download",(0,n.jsx)(rv.Download,{className:"text-muted-foreground size-3"})]}),(0,n.jsx)("button",{type:"button",onClick:e,"aria-label":"Dismiss",className:"text-muted-foreground hover:text-foreground -mr-1 shrink-0 rounded p-0.5 transition-colors",children:(0,n.jsx)(ry.X,{className:"size-3.5"})})]})}var rL=e.i(522016),rW=e.i(766354),rK=e.i(607486),rU=e.i(63209),rB=e.i(16715);let rz=(0,o.default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);var rq=e.i(107233),r$=e.i(284614);e.s([],275704),e.i(275704),e.i(247167);var rH=e.i(367805);let rG=a.createContext(void 0);function rV(e){let t=a.useContext(rG);if(!1===e&&void 0===t)throw Error((0,rH.default)(27));return t}var rX=e.i(327601),rQ=e.i(383590),rY=e.i(284759);let rJ={...rQ.popupStateMapping,...rY.transitionStatusMapping},rZ=a.forwardRef(function(e,t){let{render:s,className:r,forceRender:n=!1,...a}=e,{store:i}=rV(),o=i.useState("open"),l=i.useState("nested"),u=i.useState("mounted"),c=i.useState("transitionStatus");return(0,rX.useRenderElement)("div",e,{state:{open:o,transitionStatus:c},ref:[i.context.backdropRef,t],stateAttributesMapping:rJ,props:[{role:"presentation",hidden:!u,style:{userSelect:"none",WebkitUserSelect:"none"}},a],enabled:n||!l})});var r0=e.i(991730),r1=e.i(5963),r2=e.i(803404);let r5=a.forwardRef(function(e,t){let{render:s,className:r,disabled:n=!1,nativeButton:a=!0,...i}=e,{store:o}=rV(),l=o.useState("open"),{getButtonProps:u,buttonRef:c}=(0,r0.useButton)({disabled:n,native:a});return(0,rX.useRenderElement)("button",e,{state:{disabled:n},ref:[t,c],props:[{onClick:function(e){l&&o.setOpen(!1,(0,r1.createChangeEventDetails)(r2.REASONS.closePress,e.nativeEvent))}},i,u]})});var r3=e.i(189879);let r6=a.forwardRef(function(e,t){let{render:s,className:r,id:n,...a}=e,{store:i}=rV(),o=(0,r3.useBaseUiId)(n);return i.useSyncedValueWithCleanup("descriptionElementId",o),(0,rX.useRenderElement)("p",e,{ref:t,props:[{id:o},a]})});var r7=e.i(488306);let r4=((t={}).nestedDialogs="--nested-dialogs",t),r8=((s={})[s.open=rQ.CommonPopupDataAttributes.open]="open",s[s.closed=rQ.CommonPopupDataAttributes.closed]="closed",s[s.startingStyle=rQ.CommonPopupDataAttributes.startingStyle]="startingStyle",s[s.endingStyle=rQ.CommonPopupDataAttributes.endingStyle]="endingStyle",s.nested="data-nested",s.nestedDialogOpen="data-nested-dialog-open",s),r9=a.createContext(void 0);function ne(){let e=a.useContext(r9);if(void 0===e)throw Error((0,rH.default)(26));return e}var nt=e.i(889269),ns=e.i(992238);let nr={...rQ.popupStateMapping,...rY.transitionStatusMapping,nestedDialogOpen:e=>e?{[r8.nestedDialogOpen]:""}:null},nn=a.forwardRef(function(e,t){let{className:s,finalFocus:r,initialFocus:a,render:i,...o}=e,{store:l}=rV(),u=l.useState("descriptionElementId"),c=l.useState("disablePointerDismissal"),d=l.useState("floatingRootContext"),g=l.useState("popupProps"),m=l.useState("modal"),h=l.useState("mounted"),p=l.useState("nested"),f=l.useState("nestedOpenDialogCount"),x=l.useState("open"),v=l.useState("openMethod"),b=l.useState("titleElementId"),y=l.useState("transitionStatus"),k=l.useState("role");ne(),(0,nt.useOpenChangeComplete)({open:x,ref:l.context.popupRef,onComplete(){x&&l.context.onOpenChangeComplete?.(!0)}});let j=void 0===a?function(e){return"touch"!==e||l.context.popupRef.current}:a,w=(0,rX.useRenderElement)("div",e,{state:{open:x,nested:p,transitionStatus:y,nestedDialogOpen:f>0},props:[g,{"aria-labelledby":b??void 0,"aria-describedby":u??void 0,role:k,tabIndex:-1,hidden:!h,onKeyDown(e){ns.COMPOSITE_KEYS.has(e.key)&&e.stopPropagation()},style:{[r4.nestedDialogs]:f}},o],ref:[t,l.context.popupRef,l.useStateSetter("popupElement")],stateAttributesMapping:nr});return(0,n.jsx)(r7.FloatingFocusManager,{context:d,openInteractionType:v,disabled:!h,closeOnFocusOut:!c,initialFocus:j,returnFocus:r,modal:!1!==m,restoreFocus:"popup",children:w})});var na=e.i(658130),ni=e.i(937692),no=e.i(536893);let nl=a.forwardRef(function(e,t){let{keepMounted:s=!1,...r}=e,{store:a}=rV(),i=a.useState("mounted"),o=a.useState("modal"),l=a.useState("open");return i||s?(0,n.jsx)(r9.Provider,{value:s,children:(0,n.jsxs)(ni.FloatingPortal,{ref:t,...r,children:[i&&!0===o&&(0,n.jsx)(no.InternalBackdrop,{ref:a.context.internalBackdropRef,inert:(0,na.inertValue)(!l)}),e.children]})}):null});var nu=e.i(630628),nc=e.i(58509),nd=e.i(676477),ng=e.i(66196),nm=e.i(933605),nh=e.i(789633),np=e.i(926665),nf=e.i(206157),nx=e.i(247857),nv=e.i(450091),nb=e.i(258642),ny=e.i(783921),nk=e.i(598263),nj=e.i(600628),nw=e.i(769375);let nN={...nj.popupStoreSelectors,modal:(0,ny.createSelector)(e=>e.modal),nested:(0,ny.createSelector)(e=>e.nested),nestedOpenDialogCount:(0,ny.createSelector)(e=>e.nestedOpenDialogCount),disablePointerDismissal:(0,ny.createSelector)(e=>e.disablePointerDismissal),openMethod:(0,ny.createSelector)(e=>e.openMethod),descriptionElementId:(0,ny.createSelector)(e=>e.descriptionElementId),titleElementId:(0,ny.createSelector)(e=>e.titleElementId),viewportElement:(0,ny.createSelector)(e=>e.viewportElement),role:(0,ny.createSelector)(e=>e.role)};class nC extends nk.ReactStore{constructor(e){super(function(e={}){return{...(0,nj.createInitialPopupStoreState)(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}(e),{popupRef:a.createRef(),backdropRef:a.createRef(),internalBackdropRef:a.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new nw.PopupTriggerMap,onOpenChange:void 0,onOpenChangeComplete:void 0},nN)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},e||null!=t.trigger||null==this.state.activeTriggerId||(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;let s={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",s);let r={open:e},n=t.trigger?.id??null;(n||e)&&(r.activeTriggerId=n,r.activeTriggerElement=t.trigger??null),this.update(r)}}let nS=((r={})[r.open=rQ.CommonPopupDataAttributes.open]="open",r[r.closed=rQ.CommonPopupDataAttributes.closed]="closed",r[r.startingStyle=rQ.CommonPopupDataAttributes.startingStyle]="startingStyle",r[r.endingStyle=rQ.CommonPopupDataAttributes.endingStyle]="endingStyle",r.nested="data-nested",r.nestedDialogOpen="data-nested-dialog-open",r),nE={...rQ.popupStateMapping,...rY.transitionStatusMapping,nested:e=>e?{[nS.nested]:""}:null,nestedDialogOpen:e=>e?{[nS.nestedDialogOpen]:""}:null},nT=a.forwardRef(function(e,t){let{className:s,render:r,children:n,...a}=e,i=ne(),{store:o}=rV(),l=o.useState("open"),u=o.useState("nested"),c=o.useState("transitionStatus"),d=o.useState("nestedOpenDialogCount"),g=o.useState("mounted");return(0,rX.useRenderElement)("div",e,{enabled:i||g,state:{open:l,nested:u,transitionStatus:c,nestedDialogOpen:d>0},ref:[t,o.useStateSetter("viewportElement")],stateAttributesMapping:nE,props:[{role:"presentation",hidden:!g,style:{pointerEvents:l?void 0:"none"},children:n},a]})}),nA=a.forwardRef(function(e,t){let{render:s,className:r,id:n,...a}=e,{store:i}=rV(),o=(0,r3.useBaseUiId)(n);return i.useSyncedValueWithCleanup("titleElementId",o),(0,rX.useRenderElement)("h2",e,{ref:t,props:[{id:o},a]})});var nI=e.i(607335),nM=e.i(804012);let nO=a.forwardRef(function(e,t){let{render:s,className:r,disabled:n=!1,nativeButton:i=!0,id:o,payload:l,handle:u,...c}=e,d=rV(!0),g=u?.store??d?.store;if(!g)throw Error((0,rH.default)(79));let m=(0,r3.useBaseUiId)(o),h=g.useState("floatingRootContext"),p=g.useState("isOpenedByTrigger",m),f=a.useRef(null),{registerTrigger:x,isMountedByThisTrigger:v}=(0,nb.useTriggerDataForwarding)(m,f,g,{payload:l}),{getButtonProps:b,buttonRef:y}=(0,r0.useButton)({disabled:n,native:i}),k=(0,nM.useClick)(h,{enabled:null!=h}),j=(0,nh.useInteractions)([k]),w=g.useState("triggerProps",v);return(0,rX.useRenderElement)("button",e,{state:{disabled:n,open:p},ref:[y,t,x,f],props:[j.getReferenceProps(),w,{[nI.CLICK_TRIGGER_IDENTIFIER]:"",id:m},c,b],stateAttributesMapping:rQ.triggerOpenStateMapping})});class n_{constructor(e){this.store=e??new nC}open(e){let t=e?this.store.context.triggerElements.getById(e):void 0;this.store.setOpen(!0,(0,r1.createChangeEventDetails)(r2.REASONS.imperativeAction,void 0,t))}openWithPayload(e){this.store.set("payload",e),this.store.setOpen(!0,(0,r1.createChangeEventDetails)(r2.REASONS.imperativeAction,void 0,void 0))}close(){this.store.setOpen(!1,(0,r1.createChangeEventDetails)(r2.REASONS.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}e.s(["Backdrop",0,rZ,"Close",0,r5,"Description",0,r6,"Handle",0,n_,"Popup",0,nn,"Portal",0,nl,"Root",0,function(e){let{children:t,open:s,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:o,disablePointerDismissal:l=!1,modal:u=!0,actionsRef:c,handle:d,triggerId:g,defaultTriggerId:m=null}=e,h=rV(!0),p=!!h,f=(0,nu.useRefWithInit)(()=>d?.store??new nC({open:r,openProp:s,activeTriggerId:m,triggerIdProp:g,modal:u,disablePointerDismissal:l,nested:p})).current;(0,nc.useOnFirstRender)(()=>{void 0===s&&!1===f.state.open&&!0===r&&f.update({open:!0,activeTriggerId:m})}),f.useControlledProp("openProp",s),f.useControlledProp("triggerIdProp",g),f.useSyncedValues({disablePointerDismissal:l,nested:p,modal:u}),f.useContextCallback("onOpenChange",i),f.useContextCallback("onOpenChangeComplete",o);let x=f.useState("payload");!function(e){let{store:t,parentContext:s,actionsRef:r}=e,n=t.useState("open"),i=t.useState("disablePointerDismissal"),o=t.useState("modal"),l=t.useState("popupElement"),{openMethod:u,triggerProps:c}=(0,nv.useOpenInteractionType)(n);(0,nb.useImplicitActiveTrigger)(t);let{forceUnmount:d}=(0,nb.useOpenStateTransitions)(n,t),g=(0,nd.useStableCallback)(e=>{let s=(0,r1.createChangeEventDetails)(e);return s.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},s}),m=a.useCallback(()=>{t.setOpen(!1,g(r2.REASONS.imperativeAction))},[t,g]);a.useImperativeHandle(r,()=>({unmount:d,close:m}),[d,m]);let h=(0,nf.useSyncedFloatingRootContext)({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[p,f]=a.useState(0),x=0===p,v=(0,np.useRole)(h),b=(0,nm.useDismiss)(h,{outsidePressEvent:()=>t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:"trap-focus"===o?"sloppy":"intentional",touch:"sloppy"},outsidePress(e){if(!t.context.outsidePressEnabledRef.current||"button"in e&&0!==e.button||"touches"in e&&1!==e.touches.length)return!1;let s=(0,nx.getTarget)(e);return!!x&&!i&&(!o||!t.context.internalBackdropRef.current&&!t.context.backdropRef.current||t.context.internalBackdropRef.current===s||t.context.backdropRef.current===s||(0,nx.contains)(s,l)&&!s?.hasAttribute("data-base-ui-portal"))},escapeKey:x});(0,ng.useScrollLock)(n&&!0===o,l);let{getReferenceProps:y,getFloatingProps:k,getTriggerProps:j}=(0,nh.useInteractions)([v,b]);t.useContextCallback("onNestedDialogOpen",e=>{f(e+1)}),t.useContextCallback("onNestedDialogClose",()=>{f(0)}),a.useEffect(()=>(s?.onNestedDialogOpen&&n&&s.onNestedDialogOpen(p),s?.onNestedDialogClose&&!n&&s.onNestedDialogClose(),()=>{s?.onNestedDialogClose&&n&&s.onNestedDialogClose()}),[n,s,p]);let w=a.useMemo(()=>y(c),[y,c]),N=a.useMemo(()=>j(c),[j,c]),C=a.useMemo(()=>k(),[k]);t.useSyncedValues({openMethod:u,activeTriggerProps:w,inactiveTriggerProps:N,popupProps:C,floatingRootContext:h,nestedOpenDialogCount:p})}({store:f,actionsRef:c,parentContext:h?.store.context,onOpenChange:i,triggerIdProp:g});let v=a.useMemo(()=>({store:f}),[f]);return(0,n.jsx)(rG.Provider,{value:v,children:"function"==typeof t?t({payload:x}):t})},"Title",0,nA,"Trigger",0,nO,"Viewport",0,nT,"createHandle",0,function(){return new n_}],387913);var nR=e.i(387913),nR=nR,nD=e.i(364354),nP=e.i(916624),nF=e.i(379185);function nL({onOrgChanged:e,className:t}){let{orgs:s,activeOrg:r,setActiveOrg:i,isLoading:o,error:l,retry:c,refresh:d}=(0,R.useOrg)(),[g,m]=(0,a.useState)(!1),h=(0,nD.useStigmerPortalContainer)(),p=(0,a.useCallback)(t=>{let n=s.find(e=>e.metadata?.slug===t);n&&n.metadata?.slug!==r?.metadata?.slug&&(i(n),e?.(n))},[s,r,i,e]),f=(0,a.useCallback)(t=>{m(!1),d(t.metadata?.slug),e?.(t)},[d,e]),x=(0,a.useMemo)(()=>s.filter(e=>e.spec?.isPersonal),[s]),v=(0,a.useMemo)(()=>s.filter(e=>!e.spec?.isPersonal),[s]);if(o)return(0,n.jsx)(nK,{className:t});if(l)return(0,n.jsxs)("div",{className:(0,u.cn)("stg:flex stg:items-center stg:gap-2 stg:px-2 stg:py-1.5",t),children:[(0,n.jsx)(rU.AlertCircle,{className:"stg:text-destructive stg:size-4 stg:shrink-0"}),(0,n.jsx)("span",{className:"stg:text-destructive stg:truncate stg:text-xs",children:l}),(0,n.jsx)("button",{onClick:c,className:"stg:text-sidebar-muted-foreground stg:hover:text-sidebar-foreground stg:shrink-0 stg:rounded stg:p-0.5 stg:transition-colors","aria-label":"Retry loading organizations",children:(0,n.jsx)(rB.RefreshCw,{className:"stg:size-3"})})]});let b=s.length>0&&r,y=r?.spec?.isPersonal?r$.User:rK.Building2;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(nP.Menu,{children:[(0,n.jsxs)(nP.MenuTrigger,{"aria-label":"Organization menu",className:(0,u.cn)("stg:hover:bg-sidebar-accent stg:flex stg:w-full stg:cursor-pointer stg:items-center stg:gap-2 stg:rounded-lg stg:px-2 stg:py-1.5 stg:text-sm stg:transition-colors stg:focus:outline-none",t),children:[(0,n.jsx)(y,{className:"stg:text-sidebar-muted-foreground stg:mt-0.5 stg:size-4 stg:shrink-0 stg:self-start"}),b?(0,n.jsx)(nW,{org:r,slugClassName:"stg:text-sidebar-muted-foreground"}):(0,n.jsx)("span",{className:"stg:text-sidebar-muted-foreground stg:truncate",children:"No organizations"}),(0,n.jsx)(rz,{className:"stg:text-sidebar-muted-foreground stg:ml-auto stg:mt-0.5 stg:size-3.5 stg:shrink-0 stg:self-start"})]}),(0,n.jsxs)(nP.MenuContent,{align:"start",side:"bottom",sideOffset:4,children:[b&&(0,n.jsxs)(nP.MenuRadioGroup,{value:r.metadata?.slug??"",onValueChange:p,children:[x.map(e=>(0,n.jsxs)(nP.MenuRadioItem,{value:e.metadata?.slug??"",className:"stg:items-start",children:[(0,n.jsx)(r$.User,{className:"stg:mt-0.5 stg:size-3.5 stg:shrink-0"}),(0,n.jsx)(nW,{org:e})]},e.metadata?.slug)),x.length>0&&v.length>0&&(0,n.jsx)(nP.MenuSeparator,{}),v.map(e=>(0,n.jsxs)(nP.MenuRadioItem,{value:e.metadata?.slug??"",className:"stg:items-start",children:[(0,n.jsx)(rK.Building2,{className:"stg:mt-0.5 stg:size-3.5 stg:shrink-0"}),(0,n.jsx)(nW,{org:e})]},e.metadata?.slug))]}),b&&(0,n.jsx)(nP.MenuSeparator,{}),(0,n.jsxs)(nP.MenuItem,{onClick:()=>m(!0),children:[(0,n.jsx)(rq.Plus,{className:"stg:size-4"}),"Create organization"]})]})]}),(0,n.jsx)(nR.Root,{open:g,onOpenChange:e=>m(e),children:(0,n.jsxs)(nR.Portal,{container:h,children:[(0,n.jsx)(nR.Backdrop,{className:(0,u.cn)("stg:fixed stg:inset-0 stg:z-50 stg:bg-black/50","stg:data-open:animate-in stg:data-open:fade-in-0","stg:data-closed:animate-out stg:data-closed:fade-out-0","stg:duration-150")}),(0,n.jsxs)(nR.Popup,{className:(0,u.cn)("stg:bg-background stg:text-foreground stg:ring-border/20","stg:fixed stg:top-1/2 stg:left-1/2 stg:z-50 stg:w-full stg:max-w-md stg:-translate-x-1/2 stg:-translate-y-1/2 stg:rounded-lg stg:p-6 stg:shadow-lg stg:ring-1 stg:outline-none","stg:data-open:animate-in stg:data-open:fade-in-0 stg:data-open:zoom-in-95","stg:data-closed:animate-out stg:data-closed:fade-out-0 stg:data-closed:zoom-out-95","stg:duration-150"),children:[(0,n.jsx)(nR.Title,{className:"stg:text-foreground stg:text-sm stg:font-semibold",children:"Create organization"}),(0,n.jsx)(nR.Description,{className:"stg:text-muted-foreground stg:mt-1 stg:mb-4 stg:text-xs",children:"Organizations are tenancy boundaries that own agents, environments, and other resources."}),(0,n.jsx)(nF.CreateOrganizationForm,{onCreated:f,onCancel:()=>m(!1)})]})]})})]})}function nW({org:e,slugClassName:t}){let s=e.metadata?.name||e.metadata?.slug,r=e.metadata?.slug;return(0,n.jsxs)("span",{className:"stg:min-w-0 stg:flex-1",children:[(0,n.jsx)("span",{className:"stg:block stg:truncate stg:text-sm stg:font-medium stg:leading-tight",children:s}),r&&(0,n.jsx)("span",{className:(0,u.cn)("stg:block stg:truncate stg:text-xs stg:leading-tight",t??"stg:text-muted-foreground"),children:r})]})}function nK({className:e}){return(0,n.jsxs)("div",{className:(0,u.cn)("stg:flex stg:items-center stg:gap-2 stg:px-2 stg:py-1.5",e),children:[(0,n.jsx)("div",{className:"stg:bg-sidebar-muted stg:size-4 stg:animate-pulse stg:rounded"}),(0,n.jsx)("div",{className:"stg:bg-sidebar-muted stg:h-4 stg:w-24 stg:animate-pulse stg:rounded"})]})}function nU({ariaLabel:e,isOpen:t=!0,onCollapse:s,onOrgChanged:r,footer:i,children:o}){let c=(0,a.useId)();return(0,n.jsxs)("nav",{id:c,"aria-label":e,className:"stg:bg-sidebar stg:text-sidebar-foreground stg:flex stg:h-full stg:flex-col",children:[(0,n.jsxs)("div",{className:"stg:flex stg:flex-none stg:items-center stg:gap-1 stg:px-2 stg:py-2",children:[(0,n.jsx)("button",{type:"button",onClick:s,"aria-expanded":t,"aria-controls":c,"aria-label":"Collapse sidebar",className:(0,u.cn)("stg:inline-flex stg:size-7 stg:shrink-0 stg:items-center stg:justify-center stg:rounded-md","stg:text-sidebar-foreground stg:transition-colors stg:motion-reduce:transition-none","stg:hover:bg-sidebar-accent stg:hover:text-sidebar-accent-foreground","stg:aria-expanded:bg-sidebar-accent stg:aria-expanded:text-sidebar-accent-foreground","stg:focus-visible:ring-sidebar-ring stg:focus-visible:ring-2 stg:focus-visible:outline-none"),children:(0,n.jsx)(l,{className:"stg:size-4"})}),(0,n.jsx)("div",{className:"stg:min-w-0 stg:flex-1",children:(0,n.jsx)(nL,{onOrgChanged:r})})]}),o,(0,n.jsx)("div",{className:"stg:border-sidebar-border stg:flex-none stg:border-t stg:px-3 stg:py-2",children:i})]})}function nB(){return(0,n.jsx)("div",{className:"stg:px-3 stg:py-1",children:(0,n.jsx)("div",{className:"stg:bg-sidebar-border stg:h-px"})})}function nz(e){return(0,u.cn)("stg:flex stg:items-center stg:gap-2 stg:rounded-md stg:px-2 stg:py-1 stg:text-[13px] stg:leading-4 stg:transition-colors",e?"stg:bg-sidebar-accent stg:text-sidebar-accent-foreground":"stg:text-sidebar-muted-foreground stg:hover:bg-sidebar-accent stg:hover:text-sidebar-accent-foreground")}function nq(){return"stg:text-sidebar-muted-foreground stg:px-2 stg:text-[11px] stg:leading-4 stg:font-medium stg:tracking-wide stg:uppercase"}function n$({groups:e,activePath:t=null,renderLink:s,backHref:r="/",footer:a,isOpen:i=!0,onCollapse:o,onOrgChanged:l}){return(0,n.jsxs)(nU,{ariaLabel:"Management navigation",isOpen:i,onCollapse:o,onOrgChanged:l,footer:a,children:[(0,n.jsx)("div",{className:"stg:flex-none stg:px-3 stg:py-1",children:s({id:"back-to-sessions",href:r,active:!1,className:nz(!1),"aria-current":void 0,children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(rW.ArrowLeft,{className:"stg:size-4 stg:shrink-0"}),"Back to Sessions"]})})}),(0,n.jsx)(nB,{}),(0,n.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-5 stg:px-3 stg:py-1",children:e.map(e=>(0,n.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-0.5",children:[(0,n.jsx)("span",{className:`${nq()} stg:pb-1`,children:e.label}),e.items.map(e=>{let r=null!=t&&(t===e.href||t.startsWith(`${e.href}/`));return(0,n.jsx)(nH,{href:e.href,label:e.label,icon:(0,n.jsx)(e.icon,{className:"stg:size-4 stg:shrink-0"}),active:r,renderLink:s},e.href)})]},e.label))}),(0,n.jsx)("div",{className:"stg:flex-1"})]})}function nH({href:e,label:t,icon:s,active:r,renderLink:a}){return a({id:e.slice(e.lastIndexOf("/")+1),href:e,active:r,className:nz(r),"aria-current":r?"page":void 0,children:(0,n.jsxs)(n.Fragment,{children:[s,t]})})}var nG=e.i(20753),nV=e.i(363178),nX=e.i(292270);let nQ=(0,o.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),nY=(0,o.default)("sun-moon",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14.837 16.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715",key:"xlf6rm"}],["path",{d:"M16 12a4 4 0 0 0-4-4",key:"6vsxu"}],["path",{d:"m19 5-1.256 1.256",key:"1yg6a6"}],["path",{d:"M20 12h2",key:"1q8mjw"}]]);function nJ({user:e,colorMode:t,onColorModeChange:s,onSettingsClick:r,onSignOut:a,extraItems:i,className:o}){let l=null!=t&&null!=s,c=null!=r,d=c||l||i,g=e?.name??e?.email,m=e?"User menu":"Settings";return(0,n.jsxs)(nP.Menu,{children:[(0,n.jsxs)(nP.MenuTrigger,{"aria-label":m,className:(0,u.cn)("stg:hover:bg-sidebar-accent stg:flex stg:w-full stg:cursor-pointer stg:items-center stg:gap-2 stg:rounded-lg stg:px-2 stg:py-1.5 stg:transition-colors stg:focus:outline-none",o),children:[(0,n.jsx)(n0,{name:g}),e?(0,n.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:flex-1 stg:flex-col stg:text-left",children:[e.name&&(0,n.jsx)("span",{className:"stg:truncate stg:text-sm stg:font-medium",children:e.name}),(0,n.jsx)("span",{className:"stg:text-sidebar-muted-foreground stg:truncate stg:text-xs",children:e.email})]}):(0,n.jsx)("span",{className:"stg:text-sidebar-muted-foreground stg:truncate stg:text-sm",children:"Local mode"}),(0,n.jsx)(rz,{className:"stg:text-sidebar-muted-foreground stg:ml-auto stg:size-3.5 stg:shrink-0"})]}),(0,n.jsxs)(nP.MenuContent,{align:"start",side:"top",sideOffset:8,children:[c&&(0,n.jsxs)(nP.MenuItem,{onClick:r,children:[(0,n.jsx)(nQ,{className:"stg:size-4"}),"Settings"]}),c&&l&&(0,n.jsx)(nP.MenuSeparator,{}),l&&(0,n.jsx)(nZ,{colorMode:t,onColorModeChange:s}),i&&(0,n.jsxs)(n.Fragment,{children:[(c||l)&&(0,n.jsx)(nP.MenuSeparator,{}),i]}),null!=a&&(0,n.jsxs)(n.Fragment,{children:[d&&(0,n.jsx)(nP.MenuSeparator,{}),(0,n.jsxs)(nP.MenuItem,{onClick:a,children:[(0,n.jsx)(nX.LogOut,{className:"stg:size-4"}),"Sign out"]})]})]})]})}function nZ({colorMode:e,onColorModeChange:t}){return(0,n.jsxs)(nP.MenuGroup,{"aria-label":"Color scheme",children:[(0,n.jsxs)(nP.MenuLabel,{children:[(0,n.jsx)(nY,{className:"stg:mr-1 stg:inline stg:size-3 stg:align-[-2px]"}),"Color Scheme"]}),(0,n.jsxs)(nP.MenuRadioGroup,{value:e,onValueChange:e=>t(e),children:[(0,n.jsx)(nP.MenuRadioItem,{value:"light",children:"Light"}),(0,n.jsx)(nP.MenuRadioItem,{value:"dark",children:"Dark"}),(0,n.jsx)(nP.MenuRadioItem,{value:"system",children:"System"})]})]})}function n0({name:e}){let t=e?e.charAt(0).toUpperCase():null;return(0,n.jsx)("div",{className:(0,u.cn)("stg:bg-sidebar-accent stg:text-sidebar-accent-foreground stg:border-sidebar-border","stg:flex stg:size-6 stg:shrink-0 stg:items-center stg:justify-center stg:rounded-full stg:border"),children:t?(0,n.jsx)("span",{className:"stg:text-xs stg:font-medium",children:t}):(0,n.jsx)(r$.User,{className:"stg:size-3.5"})})}e.i(67407);var n1=e.i(800692),n2=e.i(704077);function n5({className:e,inset:t,variant:s="default",...r}){return(0,n.jsx)(n2.Menu.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":s,className:(0,u.cn)("group/dropdown-menu-item focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive-subtle data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function n3(){let{user:e,logout:t}=(0,n1.useAuth)(),{theme:s,setTheme:r}=(0,nV.useTheme)(),o=(0,i.useRouter)(),l=(0,a.useCallback)(()=>{o.push("/settings")},[o]);return(0,n.jsx)(nJ,{user:e?{name:e.name,email:e.email}:null,colorMode:s??"system",onColorModeChange:r,onSettingsClick:l,onSignOut:e?t:void 0,extraItems:(0,n.jsx)(n6,{})})}function n6(){return(0,n.jsxs)(n5,{onClick:rE,children:[(0,n.jsx)(rb,{className:"size-4"}),"Get Desktop App",(0,n.jsx)(rv.Download,{className:"text-muted-foreground ml-auto size-3"})]})}(0,o.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),e.i(678784);let n7="stigmer:sidebar-open";function n4(){try{let e=localStorage.getItem(n7);if(null===e)return!0;return"false"!==e}catch{return!0}}function n8(){return!0}function n9(e){function t(t){t.key===n7&&e()}return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)}function ae(e){try{localStorage.setItem(n7,String(e))}catch{}window.dispatchEvent(new StorageEvent("storage",{key:n7}))}function at(){let e=(0,a.useSyncExternalStore)(n9,n4,n8),t=(0,a.useCallback)(()=>ae(!n4()),[]);return{isOpen:e,toggle:t,open:(0,a.useCallback)(()=>ae(!0),[]),close:(0,a.useCallback)(()=>ae(!1),[])}}function as(){let e=at(),t=(0,i.usePathname)(),s=(0,i.useRouter)(),{lastSessionZonePath:r}=(0,h.useSessionNavigation)(),o=(0,nG.useSettingsNavGroups)(),l=(0,a.useCallback)(({href:e,className:t,children:s,"aria-current":r})=>(0,n.jsx)(rL.default,{href:e,"aria-current":r,className:t,children:s}),[]),u=(0,a.useCallback)(()=>{s.push("/dashboard")},[s]);return(0,n.jsx)(n$,{groups:o,activePath:t,backHref:r??"/",renderLink:l,footer:(0,n.jsx)(n3,{}),isOpen:e.isOpen,onCollapse:e.close,onOrgChanged:u})}var ar=e.i(12556),an=e.i(799190),aa=e.i(17616);let ai=new Date(0);function ao(e){let t=e.updatedAt?(0,aa.timestampDate)(e.updatedAt):ai;return{id:e.id,type:"session"===e.type?"session":"workflow_execution",subject:e.subject||("session"===e.type?"Untitled session":"Untitled execution"),updatedAt:t.getTime()>0?t:ai,status:e.status||void 0}}let al=(0,o.default)("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),au=(0,o.default)("library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);var ac=e.i(686311),ad=e.i(981997),ag=e.i(640524);function am(e,t){let s=new Date(e);return s.setDate(s.getDate()+t),s}let ah=new Map([["failed","destructive"],["terminated","destructive"],["cancelled","muted"],["running","muted"],["pending","muted"]]);function ap({className:e,children:t,...s}){return(0,n.jsx)("div",{className:(0,u.cn)("stg:relative stg:overflow-auto","stg:[scrollbar-width:thin] stg:[scrollbar-color:var(--color-border)_transparent]","stg:[&::-webkit-scrollbar]:w-2.5","stg:[&::-webkit-scrollbar-track]:bg-transparent","stg:[&::-webkit-scrollbar-thumb]:rounded-full","stg:[&::-webkit-scrollbar-thumb]:bg-border",e),...s,children:t})}function af({activeNav:e=null,renderLink:t,recentActivity:s,activeSessionId:r=null,activeExecutionId:i=null,renderEntryAccessory:o,conversationsBadgeCount:l,footer:u,isOpen:c=!0,onCollapse:d,onOrgChanged:g,now:m}){let{entries:h,isLoading:p=!1,error:f=null}=s,x=(0,a.useMemo)(()=>(function(e,t){let s,r=((s=new Date(t??new Date)).setHours(0,0,0,0),s),n=am(r,-1),a=am(r,-6),i=am(r,-29),o=[{label:"Today",entries:[]},{label:"Yesterday",entries:[]},{label:"Previous 7 Days",entries:[]},{label:"Previous 30 Days",entries:[]},{label:"Older",entries:[]}];for(let t of e){let e=t.updatedAt;e>=r?o[0].entries.push(t):e>=n?o[1].entries.push(t):e>=a?o[2].entries.push(t):e>=i?o[3].entries.push(t):o[4].entries.push(t)}return o.filter(e=>e.entries.length>0)})(h,m),[h,m]);return(0,n.jsxs)(nU,{ariaLabel:"Main navigation",isOpen:c,onCollapse:d,onOrgChanged:g,footer:u,children:[(0,n.jsxs)("div",{className:"stg:flex stg:flex-none stg:flex-col stg:gap-0.5 stg:px-3 stg:py-1",children:[(0,n.jsx)(ax,{id:"new-session",href:"/",label:"New Session",icon:rq.Plus,active:"new-session"===e,renderLink:t}),(0,n.jsx)(ax,{id:"dashboard",href:"/dashboard",label:"Dashboard",icon:al,active:"dashboard"===e,renderLink:t}),(0,n.jsx)(ax,{id:"conversations",href:"/conversations",label:"Conversations",icon:ad.MessagesSquare,active:"conversations"===e,renderLink:t,accessory:void 0!==l&&l>0?(0,n.jsx)(av,{count:l}):null}),(0,n.jsx)(ax,{id:"library",href:"/library",label:"Library",icon:au,active:"library"===e,renderLink:t})]}),(0,n.jsx)(nB,{}),(0,n.jsx)(ap,{className:"stg:flex-1",children:(0,n.jsxs)("div",{className:"stg:p-3",children:[(0,n.jsx)("p",{className:`${nq()} stg:mb-2`,children:"Recents"}),p?(0,n.jsx)(ak,{}):f?(0,n.jsx)(aj,{message:f.message}):0===x.length?(0,n.jsx)(aw,{}):(0,n.jsx)(ab,{groups:x,activeSessionId:r,activeExecutionId:i,renderLink:t,renderEntryAccessory:o,now:m})]})})]})}function ax({id:e,href:t,label:s,icon:r,active:a,renderLink:i,accessory:o=null}){return i({id:e,href:t,active:a,className:nz(a),"aria-current":a?"page":void 0,children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r,{className:"stg:size-4 stg:shrink-0"}),s,o]})})}function av({count:e}){return(0,n.jsxs)("span",{className:"stg:ml-auto stg:flex stg:shrink-0 stg:items-center",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"stg:bg-sidebar-primary stg:text-sidebar-primary-foreground stg:rounded-full stg:px-1.5 stg:py-0.5 stg:text-[10px] stg:leading-none stg:font-semibold stg:tabular-nums",children:e>99?"99+":e}),(0,n.jsx)("span",{className:"stg:sr-only",children:1===e?"1 conversation needs a human":`${e} conversations need a human`})]})}function ab({groups:e,activeSessionId:t,activeExecutionId:s,renderLink:r,renderEntryAccessory:a,now:i}){return(0,n.jsx)(e5.TooltipProvider,{children:(0,n.jsx)("div",{className:"stg:space-y-4",children:e.map(e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"stg:text-sidebar-muted-foreground stg:mb-1 stg:px-2 stg:text-[10px] stg:font-medium stg:tracking-wide stg:uppercase",children:e.label}),(0,n.jsx)("ul",{className:`${tF.UNSTYLED_LIST} stg:space-y-0.5`,role:"list",children:e.entries.map(e=>(0,n.jsx)(ay,{entry:e,activeSessionId:t,activeExecutionId:s,renderLink:r,renderEntryAccessory:a,now:i},e.id))})]},e.label))})})}let ay=(0,a.memo)(function({entry:e,activeSessionId:t,activeExecutionId:s,renderLink:r,renderEntryAccessory:a,now:i}){let o="session"===e.type,l=o?e.id===t:e.id===s,u=o?`/sessions/${e.id}`:`/executions/${e.id}`,c=o?ac.MessageSquare:ag.Workflow,d=function(e){if("workflow_execution"!==e.type||!e.status)return null;let t=ah.get(e.status);return t?{label:e.status,tone:t}:null}(e),g=r({id:e.id,href:u,active:l,"aria-current":l?"page":void 0,entry:e,className:l?"stg:flex stg:items-start stg:gap-2 stg:rounded-md stg:px-2 stg:py-1 stg:text-xs stg:transition-colors stg:bg-sidebar-accent stg:text-sidebar-accent-foreground":"stg:flex stg:items-start stg:gap-2 stg:rounded-md stg:px-2 stg:py-1 stg:text-xs stg:transition-colors stg:text-sidebar-muted-foreground stg:hover:bg-sidebar-accent stg:hover:text-sidebar-accent-foreground",children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c,{className:"stg:mt-0.5 stg:size-3 stg:shrink-0 stg:opacity-50","aria-hidden":"true"}),(0,n.jsx)("span",{className:"stg:line-clamp-2 stg:flex-1",children:e.subject}),(0,n.jsxs)("span",{className:"stg:flex stg:shrink-0 stg:flex-col stg:items-end stg:gap-0.5 stg:text-[10px] stg:leading-tight",children:[(0,n.jsx)("span",{className:"stg:text-sidebar-muted-foreground stg:tabular-nums",children:(0,ta.formatRelativeTime)(e.updatedAt,i)}),d&&(0,n.jsx)("span",{className:"destructive"===d.tone?"stg:text-destructive":"stg:text-sidebar-muted-foreground",children:d.label})]}),a?.(e)]})});return(0,n.jsx)("li",{children:(0,n.jsxs)(e5.Tooltip,{children:[(0,n.jsx)(e5.TooltipTrigger,{render:g}),(0,n.jsx)(e5.TooltipContent,{side:"right",sideOffset:12,children:e.subject})]})})});function ak(){return(0,n.jsx)("div",{className:"stg:space-y-2 stg:px-2","aria-busy":"true","aria-label":"Loading sessions",children:Array.from({length:5},(e,t)=>(0,n.jsx)("div",{className:"stg:bg-sidebar-muted stg:h-5 stg:animate-pulse stg:rounded",style:{width:`${70+20*Math.sin(1.5*t)}%`}},t))})}function aj({message:e}){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"stg:text-destructive stg:mb-4 stg:px-2 stg:text-xs",role:"alert",children:e}),(0,n.jsx)(aw,{})]})}function aw(){return(0,n.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:gap-2 stg:py-8 stg:text-center",children:[(0,n.jsx)(ac.MessageSquare,{className:"stg:text-sidebar-muted-foreground stg:size-8"}),(0,n.jsx)("p",{className:"stg:text-sidebar-muted-foreground stg:text-xs",children:"No recent activity"})]})}function aN(e){return!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey&&0===e.button}function aC(){let e=at(),t=(0,i.usePathname)(),s=(0,i.useRouter)(),r=function(){let e=(void 0)??30,t=(0,c.useStigmer)(),s=(0,R.useActiveOrgSlug)(),{data:r,isLoading:n,error:i,refetch:o}=(0,d.useFetch)(()=>t.activity.listRecentActivity({pageSize:e,org:s}).then(e=>e.entries.map(ao)),[t,e,s],[],{cacheKey:`recent-activity:${s}`}),[l,u]=(0,a.useState)([]),g=(0,a.useRef)(r);return(0,a.useEffect)(()=>{r!==g.current&&(g.current=r,l.length>0&&u([]))},[r,l.length]),{entries:(0,a.useMemo)(()=>{if(0===l.length)return r;let e=new Set(r.map(e=>e.id)),t=l.filter(t=>!e.has(t.id));return t.length>0?[...t,...r]:r},[r,l]),isLoading:n,error:i,refetch:o,prependOptimistic:(0,a.useCallback)(e=>{u(t=>t.some(t=>t.id===e.id)?t:[{id:e.id,type:e.type,subject:e.subject,updatedAt:new Date},...t])},[])}}(),{refetch:o,prependOptimistic:l}=r,{count:u}=function(e){let t=(0,c.useStigmer)(),s=(void 0)??an.CONVERSATION_BADGE_POLL_INTERVAL_MS,r=e?async()=>(await t.agentChannel.listConversations((0,V.create)(ar.ListChannelConversationsInputSchema,{org:e,filter:ar.ChannelConversationListFilter.filter_wants_human,pageInfo:{num:1,size:1}}))).totalCount:null,{data:n,isLoading:i,error:o,refetch:l}=(0,d.useFetch)(r,[e,t],0,{refetchInterval:s,refetchOnWindowFocus:!0});return(0,a.useMemo)(()=>({count:n,isLoading:i,error:o,refetch:l}),[n,i,o,l])}((0,R.useActiveOrgSlug)()||null),{activeSessionId:g,isSessionZone:m,navigateToSession:f,navigateToHome:x}=(0,h.useSessionNavigation)(),{activeExecutionId:v,isExecutionZone:b,navigateToExecution:y}=(0,p.useExecutionNavigation)(),k=!m&&!b&&t.startsWith("/dashboard"),j=!m&&!b&&t.startsWith("/conversations"),w=!m&&!b&&t.startsWith("/library"),N=(0,a.useCallback)(()=>{s.push("/dashboard")},[s]),C=(0,a.useRef)(r.entries);(0,a.useEffect)(()=>{C.current=r.entries}),(0,a.useEffect)(()=>{if(v&&!C.current.some(e=>e.id===v)&&l({id:v,type:"workflow_execution",subject:"Loading…"}),o(),!(g??v))return;let e=setTimeout(o,8e3),t=setTimeout(o,18e3);return()=>{clearTimeout(e),clearTimeout(t)}},[g,v,o,l]);let S=(0,a.useCallback)(({id:e,href:t,className:s,children:r,entry:a,"aria-current":i})=>a?(0,n.jsx)("a",{href:t,onClick:e=>{aN(e)&&(e.preventDefault(),"session"===a.type?f(a.id):y(a.id))},"aria-current":i,className:s,children:r}):"new-session"===e?(0,n.jsx)(rL.default,{href:"/",onClick:e=>{aN(e)&&(e.preventDefault(),x())},className:s,children:r}):(0,n.jsx)(rL.default,{href:t,"aria-current":i,className:s,children:r}),[f,y,x]);return(0,n.jsx)(af,{activeNav:k?"dashboard":j?"conversations":w?"library":null,renderLink:S,recentActivity:r,activeSessionId:g,activeExecutionId:v,conversationsBadgeCount:u,footer:(0,n.jsx)(n3,{}),isOpen:e.isOpen,onCollapse:e.close,onOrgChanged:N})}function aS({executionId:e}){let{navigateToSession:t}=(0,h.useSessionNavigation)(),s=e.startsWith("aex_"),{sessionId:r}=g(s?e:null);return((0,a.useEffect)(()=>{r&&t(r)},[r,t]),s)?null:(0,n.jsx)(rx,{executionId:e})}function aE({activeSessionId:e}){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:(0,u.cn)("h-full",null!=e&&"hidden"),"aria-hidden":null!=e,children:(0,n.jsx)(D,{})}),null!=e&&(0,n.jsx)(U,{id:e},e)]})}e.s(["AppShell",0,function({children:e}){let t,s=at(),r=(0,i.usePathname)(),{activeSessionId:o,isSessionZone:c}=(0,h.useSessionNavigation)(),{activeExecutionId:d,isExecutionZone:g}=(0,p.useExecutionNavigation)(),f=(t=(0,a.useSyncExternalStore)(rP,rR,rD),(0,a.useEffect)(()=>{try{localStorage.getItem(rT)||(localStorage.setItem(rT,new Date().toISOString()),r_=!0)}catch{}},[]),{visible:t,dismiss:(0,a.useCallback)(()=>{try{localStorage.setItem(rA,JSON.stringify({campaign:rO,ts:new Date().toISOString()}))}catch{}window.dispatchEvent(new StorageEvent("storage",{key:rA}))},[])}),x=r.startsWith("/settings"),v=r.startsWith("/invite/")||r.startsWith("/login")||r.startsWith("/chat/");(0,a.useEffect)(()=>{s.isOpen&&window.innerWidth<1024&&s.close()},[r]);let b=s.isOpen,y=s.close;return((0,a.useEffect)(()=>{function e(e){"Escape"===e.key&&b&&window.innerWidth<1024&&y()}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[b,y]),v)?(0,n.jsx)("div",{className:"bg-background text-foreground min-h-screen",children:(0,n.jsx)("main",{children:e})}):(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"bg-background text-foreground flex h-screen",children:[s.isOpen&&(0,n.jsx)("div",{className:"bg-backdrop fixed inset-0 z-40 backdrop-blur-sm lg:hidden",onClick:s.close,"aria-hidden":"true"}),(0,n.jsx)(m.Button,{variant:"ghost",size:"icon-sm",onClick:s.open,"aria-label":"Open sidebar",className:(0,u.cn)("fixed top-2 left-2 z-30",s.isOpen&&"hidden"),children:(0,n.jsx)(l,{className:"size-4"})}),(0,n.jsx)("div",{className:(0,u.cn)("shrink-0 overflow-hidden","border-sidebar-border border-r","transition-[width] duration-200 ease-in-out motion-reduce:transition-none",s.isOpen?"w-60":"w-0","max-lg:fixed max-lg:inset-y-0 max-lg:left-0 max-lg:z-50 max-lg:shadow-lg"),children:(0,n.jsx)("div",{className:"h-full w-60",children:(0,n.jsx)("div",{className:"h-full animate-in fade-in duration-150",children:x?(0,n.jsx)(as,{}):(0,n.jsx)(aC,{})},x?"management":"session")})}),(0,n.jsxs)("main",{className:"min-w-0 flex-1 flex flex-col overflow-hidden",children:[f.visible&&(0,n.jsx)(rF,{onDismiss:f.dismiss}),(0,n.jsx)("div",{className:"min-w-0 flex-1 overflow-y-auto",children:x?e:g&&d?(0,n.jsx)(aS,{executionId:d},d):c?(0,n.jsx)(aE,{activeSessionId:o}):e})]})]})})}],936636)}]);
|