@alexjbarnes/cockpit 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/(app)/agents/[name]/page.js +1 -1
- package/.next/server/app/(app)/agents/[name]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/agents/[name]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/agents/page.js +2 -2
- package/.next/server/app/(app)/agents/page.js.nft.json +1 -1
- package/.next/server/app/(app)/agents/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/claude-md/edit/page.js +1 -1
- package/.next/server/app/(app)/claude-md/edit/page.js.nft.json +1 -1
- package/.next/server/app/(app)/claude-md/edit/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/claude-md/page.js +1 -1
- package/.next/server/app/(app)/claude-md/page.js.nft.json +1 -1
- package/.next/server/app/(app)/claude-md/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/commands/[name]/page.js +1 -1
- package/.next/server/app/(app)/commands/[name]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/commands/[name]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/commands/page.js +2 -2
- package/.next/server/app/(app)/commands/page.js.nft.json +1 -1
- package/.next/server/app/(app)/commands/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/hooks/[event]/page.js +1 -1
- package/.next/server/app/(app)/hooks/[event]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/hooks/[event]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/hooks/page.js +2 -2
- package/.next/server/app/(app)/hooks/page.js.nft.json +1 -1
- package/.next/server/app/(app)/hooks/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/inbox/[id]/page.js +1 -1
- package/.next/server/app/(app)/inbox/[id]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/inbox/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/inbox/page.js +2 -2
- package/.next/server/app/(app)/inbox/page.js.nft.json +1 -1
- package/.next/server/app/(app)/inbox/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/jobs/[id]/edit/page.js +2 -2
- package/.next/server/app/(app)/jobs/[id]/edit/page.js.nft.json +1 -1
- package/.next/server/app/(app)/jobs/[id]/edit/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/jobs/[id]/page.js +1 -1
- package/.next/server/app/(app)/jobs/[id]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/jobs/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/jobs/[id]/runs/[runId]/page.js +1 -1
- package/.next/server/app/(app)/jobs/[id]/runs/[runId]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/jobs/[id]/runs/[runId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/jobs/page.js +2 -2
- package/.next/server/app/(app)/jobs/page.js.nft.json +1 -1
- package/.next/server/app/(app)/jobs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/mcp-servers/[name]/page.js +1 -1
- package/.next/server/app/(app)/mcp-servers/[name]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/mcp-servers/[name]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/mcp-servers/page.js +2 -2
- package/.next/server/app/(app)/mcp-servers/page.js.nft.json +1 -1
- package/.next/server/app/(app)/mcp-servers/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/page.js +2 -2
- package/.next/server/app/(app)/page.js.nft.json +1 -1
- package/.next/server/app/(app)/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/plugins/page.js +2 -2
- package/.next/server/app/(app)/plugins/page.js.nft.json +1 -1
- package/.next/server/app/(app)/plugins/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/reviews/[owner]/[repo]/[number]/page.js +1 -1
- package/.next/server/app/(app)/reviews/[owner]/[repo]/[number]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/reviews/[owner]/[repo]/[number]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/reviews/[owner]/[repo]/page.js +1 -1
- package/.next/server/app/(app)/reviews/[owner]/[repo]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/reviews/[owner]/[repo]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/reviews/page.js +2 -2
- package/.next/server/app/(app)/reviews/page.js.nft.json +1 -1
- package/.next/server/app/(app)/reviews/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/sessions/[id]/page.js +1 -1
- package/.next/server/app/(app)/sessions/[id]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/appearance/page.js +1 -1
- package/.next/server/app/(app)/settings/appearance/page.js.nft.json +1 -1
- package/.next/server/app/(app)/settings/appearance/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/notifications/page.js +1 -1
- package/.next/server/app/(app)/settings/notifications/page.js.nft.json +1 -1
- package/.next/server/app/(app)/settings/notifications/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/page.js +1 -1
- package/.next/server/app/(app)/settings/page.js.nft.json +1 -1
- package/.next/server/app/(app)/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/providers/[id]/page.js +1 -1
- package/.next/server/app/(app)/settings/providers/[id]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/settings/providers/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/providers/new/page.js +1 -1
- package/.next/server/app/(app)/settings/providers/new/page.js.nft.json +1 -1
- package/.next/server/app/(app)/settings/providers/new/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/providers/page.js +1 -1
- package/.next/server/app/(app)/settings/providers/page.js.nft.json +1 -1
- package/.next/server/app/(app)/settings/providers/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/session/page.js +2 -2
- package/.next/server/app/(app)/settings/session/page.js.nft.json +1 -1
- package/.next/server/app/(app)/settings/session/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/skills/[name]/page.js +1 -1
- package/.next/server/app/(app)/skills/[name]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/skills/[name]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/skills/page.js +2 -2
- package/.next/server/app/(app)/skills/page.js.nft.json +1 -1
- package/.next/server/app/(app)/skills/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/agents.html +1 -1
- package/.next/server/app/agents.rsc +4 -4
- package/.next/server/app/agents.segments/!KGFwcCk/agents/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/agents.segments/!KGFwcCk/agents.segment.rsc +1 -1
- package/.next/server/app/agents.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/agents.segments/_full.segment.rsc +4 -4
- package/.next/server/app/agents.segments/_head.segment.rsc +1 -1
- package/.next/server/app/agents.segments/_index.segment.rsc +2 -2
- package/.next/server/app/agents.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/jobs/[id]/runs/[runId]/route.js +1 -1
- package/.next/server/app/api/jobs/[id]/runs/route.js +1 -1
- package/.next/server/app/api/jobs/status/route.js +1 -1
- package/.next/server/app/api/plugins/[id]/route.js +1 -1
- package/.next/server/app/api/plugins/install/route.js +1 -1
- package/.next/server/app/api/plugins/marketplaces/[name]/route.js +1 -1
- package/.next/server/app/api/plugins/marketplaces/route.js +1 -1
- package/.next/server/app/api/plugins/route.js +1 -1
- package/.next/server/app/api/providers/[id]/route.js +1 -1
- package/.next/server/app/api/providers/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/tabs/route.js +1 -1
- package/.next/server/app/claude-md/edit.html +1 -1
- package/.next/server/app/claude-md/edit.rsc +4 -4
- package/.next/server/app/claude-md/edit.segments/!KGFwcCk/claude-md/edit/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/claude-md/edit.segments/!KGFwcCk/claude-md/edit.segment.rsc +1 -1
- package/.next/server/app/claude-md/edit.segments/!KGFwcCk/claude-md.segment.rsc +1 -1
- package/.next/server/app/claude-md/edit.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/claude-md/edit.segments/_full.segment.rsc +4 -4
- package/.next/server/app/claude-md/edit.segments/_head.segment.rsc +1 -1
- package/.next/server/app/claude-md/edit.segments/_index.segment.rsc +2 -2
- package/.next/server/app/claude-md/edit.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/claude-md.html +1 -1
- package/.next/server/app/claude-md.rsc +4 -4
- package/.next/server/app/claude-md.segments/!KGFwcCk/claude-md/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/claude-md.segments/!KGFwcCk/claude-md.segment.rsc +1 -1
- package/.next/server/app/claude-md.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/claude-md.segments/_full.segment.rsc +4 -4
- package/.next/server/app/claude-md.segments/_head.segment.rsc +1 -1
- package/.next/server/app/claude-md.segments/_index.segment.rsc +2 -2
- package/.next/server/app/claude-md.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/commands.html +1 -1
- package/.next/server/app/commands.rsc +4 -4
- package/.next/server/app/commands.segments/!KGFwcCk/commands/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/commands.segments/!KGFwcCk/commands.segment.rsc +1 -1
- package/.next/server/app/commands.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/commands.segments/_full.segment.rsc +4 -4
- package/.next/server/app/commands.segments/_head.segment.rsc +1 -1
- package/.next/server/app/commands.segments/_index.segment.rsc +2 -2
- package/.next/server/app/commands.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/hooks.html +1 -1
- package/.next/server/app/hooks.rsc +4 -4
- package/.next/server/app/hooks.segments/!KGFwcCk/hooks/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/hooks.segments/!KGFwcCk/hooks.segment.rsc +1 -1
- package/.next/server/app/hooks.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/hooks.segments/_full.segment.rsc +4 -4
- package/.next/server/app/hooks.segments/_head.segment.rsc +1 -1
- package/.next/server/app/hooks.segments/_index.segment.rsc +2 -2
- package/.next/server/app/hooks.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/inbox.html +1 -1
- package/.next/server/app/inbox.rsc +4 -4
- package/.next/server/app/inbox.segments/!KGFwcCk/inbox/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/inbox.segments/!KGFwcCk/inbox.segment.rsc +1 -1
- package/.next/server/app/inbox.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/inbox.segments/_full.segment.rsc +4 -4
- package/.next/server/app/inbox.segments/_head.segment.rsc +1 -1
- package/.next/server/app/inbox.segments/_index.segment.rsc +2 -2
- package/.next/server/app/inbox.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +4 -4
- package/.next/server/app/index.segments/!KGFwcCk/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/jobs.html +1 -1
- package/.next/server/app/jobs.rsc +4 -4
- package/.next/server/app/jobs.segments/!KGFwcCk/jobs/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/jobs.segments/!KGFwcCk/jobs.segment.rsc +1 -1
- package/.next/server/app/jobs.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/jobs.segments/_full.segment.rsc +4 -4
- package/.next/server/app/jobs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/jobs.segments/_index.segment.rsc +2 -2
- package/.next/server/app/jobs.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +2 -2
- package/.next/server/app/login.segments/_full.segment.rsc +2 -2
- package/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/.next/server/app/login.segments/_index.segment.rsc +2 -2
- package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/.next/server/app/mcp-servers.html +1 -1
- package/.next/server/app/mcp-servers.rsc +4 -4
- package/.next/server/app/mcp-servers.segments/!KGFwcCk/mcp-servers/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/mcp-servers.segments/!KGFwcCk/mcp-servers.segment.rsc +1 -1
- package/.next/server/app/mcp-servers.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/mcp-servers.segments/_full.segment.rsc +4 -4
- package/.next/server/app/mcp-servers.segments/_head.segment.rsc +1 -1
- package/.next/server/app/mcp-servers.segments/_index.segment.rsc +2 -2
- package/.next/server/app/mcp-servers.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/plugins.html +1 -1
- package/.next/server/app/plugins.rsc +4 -4
- package/.next/server/app/plugins.segments/!KGFwcCk/plugins/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/plugins.segments/!KGFwcCk/plugins.segment.rsc +1 -1
- package/.next/server/app/plugins.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/plugins.segments/_full.segment.rsc +4 -4
- package/.next/server/app/plugins.segments/_head.segment.rsc +1 -1
- package/.next/server/app/plugins.segments/_index.segment.rsc +2 -2
- package/.next/server/app/plugins.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/reviews.html +1 -1
- package/.next/server/app/reviews.rsc +4 -4
- package/.next/server/app/reviews.segments/!KGFwcCk/reviews/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/reviews.segments/!KGFwcCk/reviews.segment.rsc +1 -1
- package/.next/server/app/reviews.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/reviews.segments/_full.segment.rsc +4 -4
- package/.next/server/app/reviews.segments/_head.segment.rsc +1 -1
- package/.next/server/app/reviews.segments/_index.segment.rsc +2 -2
- package/.next/server/app/reviews.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings/appearance.html +1 -1
- package/.next/server/app/settings/appearance.rsc +4 -4
- package/.next/server/app/settings/appearance.segments/!KGFwcCk/settings/appearance/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings/appearance.segments/!KGFwcCk/settings/appearance.segment.rsc +1 -1
- package/.next/server/app/settings/appearance.segments/!KGFwcCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings/appearance.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/settings/appearance.segments/_full.segment.rsc +4 -4
- package/.next/server/app/settings/appearance.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/appearance.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings/appearance.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings/notifications.html +1 -1
- package/.next/server/app/settings/notifications.rsc +4 -4
- package/.next/server/app/settings/notifications.segments/!KGFwcCk/settings/notifications/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings/notifications.segments/!KGFwcCk/settings/notifications.segment.rsc +1 -1
- package/.next/server/app/settings/notifications.segments/!KGFwcCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings/notifications.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/settings/notifications.segments/_full.segment.rsc +4 -4
- package/.next/server/app/settings/notifications.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/notifications.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings/notifications.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings/providers/new.html +1 -1
- package/.next/server/app/settings/providers/new.rsc +4 -4
- package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings/providers/new/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings/providers/new.segment.rsc +1 -1
- package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings/providers.segment.rsc +1 -1
- package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings/providers/new.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/settings/providers/new.segments/_full.segment.rsc +4 -4
- package/.next/server/app/settings/providers/new.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/providers/new.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings/providers/new.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings/providers.html +1 -1
- package/.next/server/app/settings/providers.rsc +4 -4
- package/.next/server/app/settings/providers.segments/!KGFwcCk/settings/providers/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings/providers.segments/!KGFwcCk/settings/providers.segment.rsc +1 -1
- package/.next/server/app/settings/providers.segments/!KGFwcCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings/providers.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/settings/providers.segments/_full.segment.rsc +4 -4
- package/.next/server/app/settings/providers.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/providers.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings/providers.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings/session.html +1 -1
- package/.next/server/app/settings/session.rsc +4 -4
- package/.next/server/app/settings/session.segments/!KGFwcCk/settings/session/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings/session.segments/!KGFwcCk/settings/session.segment.rsc +1 -1
- package/.next/server/app/settings/session.segments/!KGFwcCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings/session.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/settings/session.segments/_full.segment.rsc +4 -4
- package/.next/server/app/settings/session.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/session.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings/session.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +4 -4
- package/.next/server/app/settings.segments/!KGFwcCk/settings/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings.segments/!KGFwcCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/settings.segments/_full.segment.rsc +4 -4
- package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/skills.html +1 -1
- package/.next/server/app/skills.rsc +4 -4
- package/.next/server/app/skills.segments/!KGFwcCk/skills/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/skills.segments/!KGFwcCk/skills.segment.rsc +1 -1
- package/.next/server/app/skills.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/skills.segments/_full.segment.rsc +4 -4
- package/.next/server/app/skills.segments/_head.segment.rsc +1 -1
- package/.next/server/app/skills.segments/_index.segment.rsc +2 -2
- package/.next/server/app/skills.segments/_tree.segment.rsc +2 -2
- package/.next/server/chunks/1011.js +1 -1
- package/.next/server/chunks/1979.js +4 -4
- package/.next/server/chunks/3136.js +3 -3
- package/.next/server/chunks/{5292.js → 4734.js} +2 -2
- package/.next/server/chunks/7891.js +3 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{25781-c77dc5d11fb85d82.js → 14371-46bd93e838a73082.js} +1 -1
- package/.next/static/chunks/{1550-9a32fa02f6722fc7.js → 1550-2b61396833da3dec.js} +4 -4
- package/.next/static/chunks/86939-ba1fb2321ef9cd80.js +1 -0
- package/.next/static/chunks/app/(app)/agents/[name]/{page-6954a12623e4bdcf.js → page-2b04446e17990f1a.js} +1 -1
- package/.next/static/chunks/app/(app)/agents/page-ba23fc2296a7be83.js +1 -0
- package/.next/static/chunks/app/(app)/claude-md/edit/{page-575c5ccdc585516c.js → page-a281913e0b8add64.js} +1 -1
- package/.next/static/chunks/app/(app)/claude-md/{page-aab6df0c14c657f3.js → page-2d96e3554ef23d18.js} +1 -1
- package/.next/static/chunks/app/(app)/commands/[name]/{page-ea86a4400fd29210.js → page-fb34a46c0c086dab.js} +1 -1
- package/.next/static/chunks/app/(app)/commands/page-3802984c62d8ac69.js +1 -0
- package/.next/static/chunks/app/(app)/hooks/[event]/{page-2c41e810c15a1149.js → page-9481839e736408cb.js} +1 -1
- package/.next/static/chunks/app/(app)/hooks/page-f430735f702c7219.js +1 -0
- package/.next/static/chunks/app/(app)/inbox/[id]/{page-885a258b67e47b00.js → page-aadeab885f4845b0.js} +1 -1
- package/.next/static/chunks/app/(app)/inbox/page-b95594cb0a1a5cac.js +1 -0
- package/.next/static/chunks/app/(app)/jobs/[id]/edit/page-cc5a314765daff0b.js +1 -0
- package/.next/static/chunks/app/(app)/jobs/[id]/{page-ba516fa01db89ea0.js → page-5890d22a832830ae.js} +1 -1
- package/.next/static/chunks/app/(app)/jobs/[id]/runs/[runId]/{page-0650e6f678fae5b8.js → page-0b99d3ca8a0db5a4.js} +1 -1
- package/.next/static/chunks/app/(app)/jobs/page-3112e52c1cf2a1c6.js +1 -0
- package/.next/static/chunks/app/(app)/{layout-3cd80708648e0723.js → layout-62bd7715bd974abb.js} +1 -1
- package/.next/static/chunks/app/(app)/mcp-servers/[name]/{page-9290a7940a32d9ac.js → page-c8586b1dc6f9824d.js} +1 -1
- package/.next/static/chunks/app/(app)/mcp-servers/page-bfc2a6ca8f7968c9.js +1 -0
- package/.next/static/chunks/app/(app)/page-7fa2e1ffac49c78b.js +1 -0
- package/.next/static/chunks/app/(app)/plugins/page-f37a96c5d3bd20a1.js +1 -0
- package/.next/static/chunks/app/(app)/reviews/[owner]/[repo]/[number]/{page-4396e9d6df189336.js → page-9bdb676f496d53bd.js} +1 -1
- package/.next/static/chunks/app/(app)/reviews/[owner]/[repo]/{page-76a072cbfe3d9f0e.js → page-200fefe31b935564.js} +1 -1
- package/.next/static/chunks/app/(app)/reviews/page-2b8118a506454063.js +1 -0
- package/.next/static/chunks/app/(app)/sessions/[id]/{page-95bcce2e0b9f827a.js → page-428e74d62712abe2.js} +1 -1
- package/.next/static/chunks/app/(app)/settings/appearance/{page-433fcfb9b95fb22e.js → page-e2b21c857330b047.js} +1 -1
- package/.next/static/chunks/app/(app)/settings/notifications/{page-e5309337f125a059.js → page-4c4e5802b3993e7f.js} +1 -1
- package/.next/static/chunks/app/(app)/settings/page-3c1d956c719f0160.js +1 -0
- package/.next/static/chunks/app/(app)/settings/providers/[id]/{page-2cacea2e60ba435c.js → page-020f2eab5c3a93ee.js} +1 -1
- package/.next/static/chunks/app/(app)/settings/providers/new/{page-d40acef3abfc7c19.js → page-9010d32aeca78d7f.js} +1 -1
- package/.next/static/chunks/app/(app)/settings/providers/{page-098d8f399c663944.js → page-d86ebcd6d1cb033d.js} +1 -1
- package/.next/static/chunks/app/(app)/settings/session/page-174370077dbb9079.js +1 -0
- package/.next/static/chunks/app/(app)/skills/[name]/{page-7dd7c0f316742c01.js → page-dfea5f58b95c01b6.js} +1 -1
- package/.next/static/chunks/app/(app)/skills/page-c33dbb722dbdf826.js +1 -0
- package/.next/static/css/4cc7360c7e3ca504.css +1 -0
- package/dist/src/lib/models.js +49 -1
- package/dist/src/server/claude-bin.js +14 -3
- package/dist/src/server/claude-settings.js +3 -0
- package/dist/src/server/mcp/cockpit-config-server.js +1 -1
- package/dist/src/server/pty-runtime.js +1 -0
- package/dist/src/server/session-manager.js +65 -25
- package/dist/src/server/transcript.js +26 -5
- package/dist/src/server/ws-handler.js +1 -1
- package/package.json +1 -1
- package/.next/static/chunks/86939-51ae17d3d12c0310.js +0 -1
- package/.next/static/chunks/app/(app)/agents/page-b984c01f39aed22e.js +0 -1
- package/.next/static/chunks/app/(app)/commands/page-3867a45c1378c6fe.js +0 -1
- package/.next/static/chunks/app/(app)/hooks/page-49f9dbb78a3f97df.js +0 -1
- package/.next/static/chunks/app/(app)/inbox/page-592249fc155b9fe4.js +0 -1
- package/.next/static/chunks/app/(app)/jobs/[id]/edit/page-121bf977a839488c.js +0 -1
- package/.next/static/chunks/app/(app)/jobs/page-da3fe23a43277e67.js +0 -1
- package/.next/static/chunks/app/(app)/mcp-servers/page-1e828264f81ee08c.js +0 -1
- package/.next/static/chunks/app/(app)/page-2d171ffc3e1945e1.js +0 -1
- package/.next/static/chunks/app/(app)/plugins/page-7e70e0b3ead44a99.js +0 -1
- package/.next/static/chunks/app/(app)/reviews/page-deaa44f0ce253da8.js +0 -1
- package/.next/static/chunks/app/(app)/settings/page-353ef8c508418af1.js +0 -1
- package/.next/static/chunks/app/(app)/settings/session/page-706118ba33c2b99f.js +0 -1
- package/.next/static/chunks/app/(app)/skills/page-48d0bbe201180fc8.js +0 -1
- package/.next/static/css/483101dd9c42fb97.css +0 -1
- /package/.next/static/{mmHo0MmzQHWjZATtI-VbH → NTa6G91R3HtKCLYuQqdR0}/_buildManifest.js +0 -0
- /package/.next/static/{mmHo0MmzQHWjZATtI-VbH → NTa6G91R3HtKCLYuQqdR0}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[86939],{86939:(e,t,s)=>{s.d(t,{Q:()=>y});var a=s(95155);let r=(0,s(99537).A)("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);var l=s(19707),n=s(12651),o=s(9005),d=s(2125),i=s(65738),x=s(12115),c=s(60529),m=s(8081);let u=["low","medium","high","xhigh","max"];function p(e){return/TOKEN|SECRET|PASSWORD/i.test(e)||e.toUpperCase().endsWith("_KEY")}function h(e,t,s,a){let r=e.trim().replace(/\[.*\]$/,"");return{modelId:r,displayName:t.trim()||r,effortLevels:s,contextSizes:a}}function f(e,t){return""!==e.trim().replace(/\[.*\]$/,"")&&t.length>0}function g({selected:e,onChange:t}){return(0,a.jsx)("div",{className:"ml-auto flex flex-wrap gap-1 justify-end",children:u.map(s=>(0,a.jsx)("button",{type:"button",onClick:()=>t(e.includes(s)?e.filter(e=>e!==s):[...e,s]),className:`rounded px-2 py-0.5 text-xs transition-colors ${e.includes(s)?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:s},s))})}function j({selected:e,onChange:t}){let s=Object.keys(m.XR);return(0,a.jsx)("div",{className:"ml-auto flex flex-wrap gap-1 justify-end",children:s.map(s=>{let r=e.includes(s);return(0,a.jsx)("button",{type:"button",onClick:()=>t(r?e.filter(e=>e!==s):[...e,s]),className:`rounded px-2 py-0.5 text-xs transition-colors ${r?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:m.XR[s].label},s)})})}function v({active:e,onClick:t,icon:s,label:r}){return(0,a.jsxs)("button",{onClick:t,className:`flex items-center gap-2 px-3 py-1.5 rounded text-xs font-medium transition-colors ${e?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:[s,r]})}function y({provider:e,isNew:t,onSave:s,onCancel:u,onDelete:N,lockedEnvKeys:b}){let[k,w]=(0,x.useState)("general"),[C,S]=(0,x.useState)(e.name),[E,I]=(0,x.useState)(Object.entries(e.envVars)),[z,A]=(0,x.useState)(e.models),[D,L]=(0,x.useState)(""),[K,O]=(0,x.useState)(""),[R,_]=(0,x.useState)(""),[$,T]=(0,x.useState)(""),[M,V]=(0,x.useState)([]),[W,X]=(0,x.useState)(["200k"]),[Y,P]=(0,x.useState)(null),[q,F]=(0,x.useState)(!1),G=new Set(b??[]),Q=async()=>{if(!C.trim())return;let t=z;Y&&f(Y.modelId,Y.contextSizes)&&(t=t.map((e,t)=>t===Y.index?h(Y.modelId,Y.displayName,Y.effortLevels,Y.contextSizes):e)),f(R,W)&&(t=[...t,h(R,$,M,W)]),F(!0);try{await s({...e,name:C,envVars:Object.fromEntries(E),models:t})}finally{F(!1)}},U=()=>{D.trim()&&(I([...E,[D.trim(),K]]),L(""),O(""))},B=()=>{f(R,W)&&(A([...z,h(R,$,M,W)]),_(""),T(""),V([]),X(["200k"]))},H=()=>{Y&&f(Y.modelId,Y.contextSizes)&&(A(z.map((e,t)=>t===Y.index?h(Y.modelId,Y.displayName,Y.effortLevels,Y.contextSizes):e)),P(null))};return(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[(0,a.jsxs)("div",{className:"flex gap-1 px-1 pb-3 border-b shrink-0",children:[(0,a.jsx)(v,{active:"general"===k,onClick:()=>w("general"),icon:(0,a.jsx)(r,{className:"h-3.5 w-3.5"}),label:"General"}),(0,a.jsx)(v,{active:"models"===k,onClick:()=>w("models"),icon:(0,a.jsx)(l.A,{className:"h-3.5 w-3.5"}),label:"Models"})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto py-4 space-y-4",children:["general"===k&&(0,a.jsxs)("div",{className:"space-y-4 sm:space-y-5",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-1.5 sm:gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(n.A,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,a.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Name"})]}),(0,a.jsx)(c.p,{value:C,onChange:e=>S(e.target.value),placeholder:"e.g. OpenRouter",className:"sm:ml-auto sm:w-56 text-xs h-7"})]}),(0,a.jsxs)("div",{className:"space-y-2 sm:space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(r,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,a.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Environment Variables"})]}),(0,a.jsx)("div",{className:"space-y-1.5",children:E.map(([e,t],s)=>{let r=G.has(e),l=p(e);return(0,a.jsxs)("div",{className:"rounded-lg border border-border px-3 py-2 text-xs space-y-1.5",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:r?(0,a.jsx)("span",{className:"font-mono text-muted-foreground truncate",children:e}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.p,{value:e,onChange:e=>{let a=[...E];a[s]=[e.target.value,t],I(a)},placeholder:"KEY",className:"flex-1 min-w-0 font-mono text-xs h-7"}),(0,a.jsx)("button",{type:"button",onClick:()=>I(E.filter((e,t)=>t!==s)),className:"shrink-0 text-muted-foreground hover:text-foreground p-0.5",children:(0,a.jsx)(o.A,{className:"h-3.5 w-3.5"})})]})}),(0,a.jsx)(c.p,{type:l?"password":"text",value:t,onChange:t=>{let a=[...E];a[s]=[e,t.target.value],I(a)},placeholder:l?"••••••••":"value",className:"w-full font-mono text-xs h-7"})]},s)})}),(0,a.jsxs)("div",{className:"rounded-lg border border-dashed border-input px-3 py-2 space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(c.p,{value:D,onChange:e=>L(e.target.value),placeholder:"NEW_KEY",className:"flex-1 min-w-0 font-mono text-xs h-7",onKeyDown:e=>"Enter"===e.key&&U()}),(0,a.jsx)("button",{type:"button",onClick:U,className:"shrink-0 text-muted-foreground hover:text-foreground p-0.5",children:(0,a.jsx)(d.A,{className:"h-3.5 w-3.5"})})]}),(0,a.jsx)(c.p,{type:p(D)?"password":"text",value:K,onChange:e=>O(e.target.value),placeholder:p(D)?"••••••••":"value",className:"w-full font-mono text-xs h-7",onKeyDown:e=>"Enter"===e.key&&U()})]})]})]}),"models"===k&&(0,a.jsxs)("div",{className:"space-y-4",children:[0===z.length&&!Y&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground py-4 text-center",children:"No models configured yet."}),(0,a.jsx)("div",{className:"space-y-1",children:z.map((e,t)=>Y?.index===t?(0,a.jsxs)("div",{className:"rounded-lg border border-primary/30 bg-primary/5 px-3 sm:px-4 py-3 space-y-3",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)(c.p,{value:Y.modelId,onChange:e=>P({...Y,modelId:e.target.value}),placeholder:"Model ID",className:"flex-1 font-mono text-xs h-7"}),(0,a.jsx)(c.p,{value:Y.displayName,onChange:e=>P({...Y,displayName:e.target.value}),placeholder:"Display name",className:"flex-1 text-xs h-7"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Thinking"}),(0,a.jsx)(g,{selected:Y.effortLevels,onChange:e=>P({...Y,effortLevels:e})})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Context"}),(0,a.jsx)(j,{selected:Y.contextSizes,onChange:e=>P({...Y,contextSizes:e})})]}),(0,a.jsxs)("div",{className:"flex gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>P(null),className:"px-2.5 py-1 text-xs rounded-md border border-input text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Cancel"}),(0,a.jsx)("button",{type:"button",onClick:H,disabled:!Y.modelId.trim()||0===Y.contextSizes.length,className:"px-2.5 py-1 text-xs rounded-md bg-primary text-primary-foreground hover:brightness-110 transition-all disabled:opacity-50",children:"Save"})]})]})]},t):(0,a.jsxs)("button",{type:"button",onClick:()=>P({index:t,modelId:e.modelId,displayName:e.displayName,effortLevels:e.effortLevels??[],contextSizes:e.contextSizes??["200k"]}),className:"flex w-full items-center gap-2 sm:gap-3 rounded-lg border border-border px-3 sm:px-4 py-2.5 text-xs hover:bg-muted/50 transition-colors text-left",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-0.5 sm:gap-3 min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"font-mono font-medium truncate",children:e.modelId}),e.displayName!==e.modelId&&(0,a.jsx)("span",{className:"text-muted-foreground truncate",children:e.displayName})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[e.effortLevels.length>0&&(0,a.jsx)("span",{className:"text-muted-foreground hidden sm:inline",children:e.effortLevels.join(", ")}),(e.contextSizes??[]).filter(e=>"200k"!==e).map(e=>(0,a.jsx)("span",{className:"text-muted-foreground",children:m.XR[e].label},e)),(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),A(z.filter((e,s)=>s!==t))},className:"text-muted-foreground hover:text-destructive p-0.5",children:(0,a.jsx)(o.A,{className:"h-3 w-3"})})]})]},t))}),(0,a.jsxs)("div",{className:"rounded-lg border border-dashed border-input px-3 sm:px-4 py-3 space-y-3",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)(c.p,{value:R,onChange:e=>_(e.target.value),placeholder:"Model ID (e.g. openai/gpt-4o)",className:"flex-1 font-mono text-xs h-7",onKeyDown:e=>"Enter"===e.key&&B()}),(0,a.jsx)(c.p,{value:$,onChange:e=>T(e.target.value),placeholder:"Display name",className:"flex-1 text-xs h-7",onKeyDown:e=>"Enter"===e.key&&B()})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Thinking"}),(0,a.jsx)(g,{selected:M,onChange:V})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Context"}),(0,a.jsx)(j,{selected:W,onChange:X})]}),(0,a.jsxs)("button",{type:"button",onClick:B,disabled:!R.trim()||0===W.length,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md border border-input text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-50",children:[(0,a.jsx)(d.A,{className:"h-3 w-3"}),"Add model"]})]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between pt-3 border-t shrink-0",children:[(0,a.jsx)("div",{children:N&&(0,a.jsxs)("button",{onClick:N,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md text-destructive hover:bg-destructive/10 transition-colors",children:[(0,a.jsx)(i.A,{className:"h-3 w-3"}),"Delete"]})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:u,className:"px-3 py-1.5 text-xs rounded-md border border-input text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Cancel"}),(0,a.jsx)("button",{onClick:Q,disabled:!C.trim()||q,className:"px-4 py-1.5 text-xs rounded-md bg-primary text-primary-foreground hover:brightness-110 transition-all disabled:opacity-50",children:q?"Saving...":t?"Create":"Save"})]})]})]})}}}]);
|
|
@@ -5,4 +5,4 @@ model: sonnet
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
Your system prompt here.
|
|
8
|
-
`;function x({params:e}){let{name:t}=(0,l.use)(e),n=(0,c.useSearchParams)(),p=(0,c.useRouter)(),g="new"===t,v=n.get("scope")||"user",b=n.get("cwd")||void 0;(0,i.si)(g?"New Agent":"Edit Agent",{hideActions:!0});let[w,j]=(0,l.useState)(g?"":decodeURIComponent(t)),[y,N]=(0,l.useState)(g?h:""),[C,k]=(0,l.useState)(g?h:""),[S,E]=(0,l.useState)(!g),[R,$]=(0,l.useState)(!1),[_,A]=(0,l.useState)(null),[L,z]=(0,l.useState)(!1),P=y!==C;(0,l.useEffect)(()=>{if(g)return;let e=new URLSearchParams({scope:v});b&&e.set("cwd",b),fetch(`/api/agents/${encodeURIComponent(t)}?${e}`).then(e=>{if(!e.ok)throw Error("Not found");return e.json()}).then(e=>{N(e.content),k(e.content)}).catch(()=>{A("Failed to load agent")}).finally(()=>E(!1))},[g,t,v,b]);let U=(0,l.useCallback)(async()=>{let e=w.trim();if(!e)return void A("Name is required");if(!/^[a-zA-Z0-9_-]+$/.test(e))return void A("Name can only contain letters, numbers, hyphens, and underscores");$(!0),A(null);try{if(!(await fetch(`/api/agents/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:v,cwd:b,content:y})})).ok)throw Error("Save failed");if(k(y),A("Saved"),g){let t=new URLSearchParams({scope:v});b&&t.set("cwd",b),p.replace(`/agents/${encodeURIComponent(e)}?${t}`)}}catch{A("Failed to save")}finally{$(!1)}},[w,y,v,b,g,p]);return S?(0,r.jsx)("div",{className:"flex-1 min-h-0 p-4",children:(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,r.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex-1 min-w-0",children:g?(0,r.jsx)(f.p,{placeholder:"agent-name",value:w,onChange:e=>j(e.target.value),className:"font-mono"}):(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono font-bold text-lg",children:w}),(0,r.jsx)(d.E,{variant:"secondary",children:"user"===v?"Global":"Project"})]})}),(0,r.jsxs)(m.$,{size:"sm",variant:"outline",onClick:()=>{let e=document.createElement("textarea");e.value=y,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),z(!0),setTimeout(()=>z(!1),1500)},children:[L?(0,r.jsx)(s.A,{className:"h-4 w-4 mr-1"}):(0,r.jsx)(a.A,{className:"h-4 w-4 mr-1"}),L?"Copied":"Copy"]}),(0,r.jsxs)(m.$,{size:"sm",onClick:U,disabled:R||!g&&!P,children:[(0,r.jsx)(o.A,{className:"h-4 w-4 mr-1"}),R?"Saving...":"Save"]})]}),_&&(0,r.jsx)("p",{className:`text-sm ${"Saved"===_?"text-green-600":"text-destructive"}`,children:_}),(0,r.jsx)(u.n,{value:y,onChange:N,onSave:U,className:"flex-1 min-h-0"})]})}},56905:(e,t,n)=>{"use strict";n.d(t,{n:()=>d});var r=n(95155),s=n(18986),a=n(25182),o=n(12115),c=n(98757),l=n(64233),i=n(40980);let u="cockpit-md-editor-preview";function d({value:e,onChange:t,onSave:n,className:f}){let[h,x]=(0,o.useState)(!1);(0,o.useEffect)(()=>{"1"===localStorage.getItem(u)&&x(!0)},[]);let p=(0,o.useCallback)(e=>{x(e),localStorage.setItem(u,e?"1":"0")},[]);return(0,r.jsxs)("div",{className:(0,i.cn)("flex flex-col min-h-0 overflow-hidden rounded-md border bg-background",f),children:[(0,r.jsxs)("div",{className:"shrink-0 flex items-center gap-1 border-b bg-muted/30 px-2 py-1",children:[(0,r.jsx)(m,{active:!h,icon:(0,r.jsx)(s.A,{className:"h-3.5 w-3.5"}),label:"Edit",onClick:()=>p(!1)}),(0,r.jsx)(m,{active:h,icon:(0,r.jsx)(a.A,{className:"h-3.5 w-3.5"}),label:"Preview",onClick:()=>p(!0)})]}),h?(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:e.trim()?(0,r.jsx)(l.Y,{content:e}):(0,r.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"Nothing to preview."})}):(0,r.jsx)(c.B,{value:e,onChange:t,language:"markdown",onSave:n,className:"flex-1 min-h-0 rounded-none border-0 [&_.cm-editor]:h-full [&_.cm-editor]:min-h-[300px]"})]})}function m({active:e,icon:t,label:n,onClick:s}){return(0,r.jsxs)("button",{type:"button",onClick:s,"aria-pressed":e,className:(0,i.cn)("inline-flex items-center gap-1.5 rounded px-2 py-0.5 text-xs transition-colors",e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[t,n]})}},60470:(e,t,n)=>{Promise.resolve().then(n.bind(n,49470))},98757:(e,t,n)=>{"use strict";n.d(t,{B:()=>h});var r=n(95155),s=n(13748),a=n(53649),o=n(27071),c=n(74059),l=n(89561),i=n(62465),u=n(12115);let d=l.Lz.theme({"&":{backgroundColor:"transparent"},".cm-gutters":{backgroundColor:"transparent",borderRight:"1px solid hsl(var(--border))"}});function m(){return!("u"<typeof document)&&document.documentElement.classList.contains("dark")}function f(e){switch(e){case"markdown":default:return(0,s.wD)();case"yaml":return(0,a.oQ)()}}function h({value:e,onChange:t,language:n,readOnly:s,className:a,onSave:x}){let p=(0,u.useRef)(null),g=(0,u.useRef)(null),v=(0,u.useRef)(new o.xx),b=(0,u.useRef)(new o.xx),w=(0,u.useRef)(new o.xx),j=(0,u.useRef)(t),y=(0,u.useRef)(x),N=(0,u.useRef)(e);return j.current=t,y.current=x,(0,u.useEffect)(()=>{if(!p.current)return;let e=o.$t.create({doc:N.current,extensions:[i.oQ,l.Lz.lineWrapping,v.current.of(m()?c.bM:d),b.current.of(f(n)),w.current.of(o.$t.readOnly.of(!!s)),l.w4.of([{key:"Mod-s",run:()=>(y.current?.(),!0)}]),l.Lz.updateListener.of(e=>{if(e.docChanged){let t=e.state.doc.toString();N.current=t,j.current(t)}})]}),t=new l.Lz({state:e,parent:p.current});return g.current=t,()=>{t.destroy(),g.current=null}},[]),(0,u.useEffect)(()=>{let t=g.current;t&&e!==N.current&&(N.current=e,t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}}))},[e]),(0,u.useEffect)(()=>{let e=g.current;if(!e)return;let t=new MutationObserver(()=>{e.dispatch({effects:v.current.reconfigure(m()?c.bM:d)})});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]),(0,u.useEffect)(()=>{let e=g.current;e&&e.dispatch({effects:b.current.reconfigure(f(n))})},[n]),(0,u.useEffect)(()=>{let e=g.current;e&&e.dispatch({effects:w.current.reconfigure(o.$t.readOnly.of(!!s))})},[s]),(0,r.jsx)("div",{ref:p,className:`overflow-auto rounded-md border bg-background text-sm [&_.cm-editor]:min-h-[200px] [&_.cm-editor.cm-focused]:outline-none ${a||""}`})}}},e=>{e.O(0,[6079,989,
|
|
8
|
+
`;function x({params:e}){let{name:t}=(0,l.use)(e),n=(0,c.useSearchParams)(),p=(0,c.useRouter)(),g="new"===t,v=n.get("scope")||"user",b=n.get("cwd")||void 0;(0,i.si)(g?"New Agent":"Edit Agent",{hideActions:!0});let[w,j]=(0,l.useState)(g?"":decodeURIComponent(t)),[y,N]=(0,l.useState)(g?h:""),[C,k]=(0,l.useState)(g?h:""),[S,E]=(0,l.useState)(!g),[R,$]=(0,l.useState)(!1),[_,A]=(0,l.useState)(null),[L,z]=(0,l.useState)(!1),P=y!==C;(0,l.useEffect)(()=>{if(g)return;let e=new URLSearchParams({scope:v});b&&e.set("cwd",b),fetch(`/api/agents/${encodeURIComponent(t)}?${e}`).then(e=>{if(!e.ok)throw Error("Not found");return e.json()}).then(e=>{N(e.content),k(e.content)}).catch(()=>{A("Failed to load agent")}).finally(()=>E(!1))},[g,t,v,b]);let U=(0,l.useCallback)(async()=>{let e=w.trim();if(!e)return void A("Name is required");if(!/^[a-zA-Z0-9_-]+$/.test(e))return void A("Name can only contain letters, numbers, hyphens, and underscores");$(!0),A(null);try{if(!(await fetch(`/api/agents/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:v,cwd:b,content:y})})).ok)throw Error("Save failed");if(k(y),A("Saved"),g){let t=new URLSearchParams({scope:v});b&&t.set("cwd",b),p.replace(`/agents/${encodeURIComponent(e)}?${t}`)}}catch{A("Failed to save")}finally{$(!1)}},[w,y,v,b,g,p]);return S?(0,r.jsx)("div",{className:"flex-1 min-h-0 p-4",children:(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,r.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex-1 min-w-0",children:g?(0,r.jsx)(f.p,{placeholder:"agent-name",value:w,onChange:e=>j(e.target.value),className:"font-mono"}):(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono font-bold text-lg",children:w}),(0,r.jsx)(d.E,{variant:"secondary",children:"user"===v?"Global":"Project"})]})}),(0,r.jsxs)(m.$,{size:"sm",variant:"outline",onClick:()=>{let e=document.createElement("textarea");e.value=y,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),z(!0),setTimeout(()=>z(!1),1500)},children:[L?(0,r.jsx)(s.A,{className:"h-4 w-4 mr-1"}):(0,r.jsx)(a.A,{className:"h-4 w-4 mr-1"}),L?"Copied":"Copy"]}),(0,r.jsxs)(m.$,{size:"sm",onClick:U,disabled:R||!g&&!P,children:[(0,r.jsx)(o.A,{className:"h-4 w-4 mr-1"}),R?"Saving...":"Save"]})]}),_&&(0,r.jsx)("p",{className:`text-sm ${"Saved"===_?"text-green-600":"text-destructive"}`,children:_}),(0,r.jsx)(u.n,{value:y,onChange:N,onSave:U,className:"flex-1 min-h-0"})]})}},56905:(e,t,n)=>{"use strict";n.d(t,{n:()=>d});var r=n(95155),s=n(18986),a=n(25182),o=n(12115),c=n(98757),l=n(64233),i=n(40980);let u="cockpit-md-editor-preview";function d({value:e,onChange:t,onSave:n,className:f}){let[h,x]=(0,o.useState)(!1);(0,o.useEffect)(()=>{"1"===localStorage.getItem(u)&&x(!0)},[]);let p=(0,o.useCallback)(e=>{x(e),localStorage.setItem(u,e?"1":"0")},[]);return(0,r.jsxs)("div",{className:(0,i.cn)("flex flex-col min-h-0 overflow-hidden rounded-md border bg-background",f),children:[(0,r.jsxs)("div",{className:"shrink-0 flex items-center gap-1 border-b bg-muted/30 px-2 py-1",children:[(0,r.jsx)(m,{active:!h,icon:(0,r.jsx)(s.A,{className:"h-3.5 w-3.5"}),label:"Edit",onClick:()=>p(!1)}),(0,r.jsx)(m,{active:h,icon:(0,r.jsx)(a.A,{className:"h-3.5 w-3.5"}),label:"Preview",onClick:()=>p(!0)})]}),h?(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:e.trim()?(0,r.jsx)(l.Y,{content:e}):(0,r.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"Nothing to preview."})}):(0,r.jsx)(c.B,{value:e,onChange:t,language:"markdown",onSave:n,className:"flex-1 min-h-0 rounded-none border-0 [&_.cm-editor]:h-full [&_.cm-editor]:min-h-[300px]"})]})}function m({active:e,icon:t,label:n,onClick:s}){return(0,r.jsxs)("button",{type:"button",onClick:s,"aria-pressed":e,className:(0,i.cn)("inline-flex items-center gap-1.5 rounded px-2 py-0.5 text-xs transition-colors",e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[t,n]})}},60470:(e,t,n)=>{Promise.resolve().then(n.bind(n,49470))},98757:(e,t,n)=>{"use strict";n.d(t,{B:()=>h});var r=n(95155),s=n(13748),a=n(53649),o=n(27071),c=n(74059),l=n(89561),i=n(62465),u=n(12115);let d=l.Lz.theme({"&":{backgroundColor:"transparent"},".cm-gutters":{backgroundColor:"transparent",borderRight:"1px solid hsl(var(--border))"}});function m(){return!("u"<typeof document)&&document.documentElement.classList.contains("dark")}function f(e){switch(e){case"markdown":default:return(0,s.wD)();case"yaml":return(0,a.oQ)()}}function h({value:e,onChange:t,language:n,readOnly:s,className:a,onSave:x}){let p=(0,u.useRef)(null),g=(0,u.useRef)(null),v=(0,u.useRef)(new o.xx),b=(0,u.useRef)(new o.xx),w=(0,u.useRef)(new o.xx),j=(0,u.useRef)(t),y=(0,u.useRef)(x),N=(0,u.useRef)(e);return j.current=t,y.current=x,(0,u.useEffect)(()=>{if(!p.current)return;let e=o.$t.create({doc:N.current,extensions:[i.oQ,l.Lz.lineWrapping,v.current.of(m()?c.bM:d),b.current.of(f(n)),w.current.of(o.$t.readOnly.of(!!s)),l.w4.of([{key:"Mod-s",run:()=>(y.current?.(),!0)}]),l.Lz.updateListener.of(e=>{if(e.docChanged){let t=e.state.doc.toString();N.current=t,j.current(t)}})]}),t=new l.Lz({state:e,parent:p.current});return g.current=t,()=>{t.destroy(),g.current=null}},[]),(0,u.useEffect)(()=>{let t=g.current;t&&e!==N.current&&(N.current=e,t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}}))},[e]),(0,u.useEffect)(()=>{let e=g.current;if(!e)return;let t=new MutationObserver(()=>{e.dispatch({effects:v.current.reconfigure(m()?c.bM:d)})});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]),(0,u.useEffect)(()=>{let e=g.current;e&&e.dispatch({effects:b.current.reconfigure(f(n))})},[n]),(0,u.useEffect)(()=>{let e=g.current;e&&e.dispatch({effects:w.current.reconfigure(o.$t.readOnly.of(!!s))})},[s]),(0,r.jsx)("div",{ref:p,className:`overflow-auto rounded-md border bg-background text-sm [&_.cm-editor]:min-h-[200px] [&_.cm-editor.cm-focused]:outline-none ${a||""}`})}}},e=>{e.O(0,[6079,989,14371,6802,1550,28441,93794,77358],()=>e(e.s=60470)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[35130],{49194:(e,t,s)=>{Promise.resolve().then(s.bind(s,86646))},74180:(e,t,s)=>{"use strict";s.d(t,{R:()=>a});var n=s(12115);function a(e){let t=(0,n.useRef)(null);return(0,n.useCallback)(s=>{if(t.current?.(),t.current=null,!s)return;let n=sessionStorage.getItem(e),a=null!==n?Number(n):NaN,r=Number.isFinite(a)&&a>0,l=0,c=0,o=()=>{r=!1,l&&cancelAnimationFrame(l),l=0,s.removeEventListener("wheel",o),s.removeEventListener("touchstart",o),s.removeEventListener("keydown",o)};if(r)if(s.scrollTop=a,2>Math.abs(s.scrollTop-a))r=!1;else{let e=0,t=()=>{if(r){if(s.scrollTop=a,e++,2>Math.abs(s.scrollTop-a)||e>120)return void o();l=requestAnimationFrame(t)}};s.addEventListener("wheel",o,{passive:!0}),s.addEventListener("touchstart",o,{passive:!0}),s.addEventListener("keydown",o),l=requestAnimationFrame(t)}let i=()=>{r||c||(c=requestAnimationFrame(()=>{c=0,sessionStorage.setItem(e,String(s.scrollTop))}))};s.addEventListener("scroll",i,{passive:!0}),t.current=()=>{let t=r;o(),c&&cancelAnimationFrame(c),s.removeEventListener("scroll",i),t||sessionStorage.setItem(e,String(s.scrollTop))}},[e])}},86646:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var n=s(95155),a=s(2125),r=s(65738),l=s(73321),c=s(12115),o=s(1550),i=s(45160),d=s(89239),u=s(81477),m=s(42763),h=s(74180);function x(){(0,o.si)("Agents",{hideActions:!0});let e=(0,h.R)("agents-scroll"),t="u">typeof localStorage&&localStorage.getItem("cockpit-agents-cwd")||void 0,{agents:s,loading:r,deleteAgent:i}=function(e){let[t,s]=(0,c.useState)([]),[n,a]=(0,c.useState)(!0),r=(0,c.useCallback)(()=>{a(!0);let t=new URLSearchParams;e&&t.set("cwd",e),fetch(`/api/agents?${t}`).then(e=>e.json()).then(e=>s(e.agents)).catch(()=>s([])).finally(()=>a(!1))},[e]);(0,c.useEffect)(()=>{r()},[r]);let l=(0,c.useCallback)(async(t,s)=>{let n=new URLSearchParams({scope:s});"project"===s&&e&&n.set("cwd",e);try{if((await fetch(`/api/agents/${encodeURIComponent(t)}?${n}`,{method:"DELETE"})).ok)return r(),!0;return!1}catch{return!1}},[e,r]);return{agents:t,loading:n,refresh:r,deleteAgent:l}}(t),x=(0,l.useRouter)(),[j,f]=(0,c.useState)(null),[g,v]=(0,c.useState)(!1),N=s.filter(e=>"user"===e.scope),b=s.filter(e=>"project"===e.scope);function w(e){v(!1);let s=new URLSearchParams({scope:e});"project"===e&&t&&s.set("cwd",t),x.push(`/agents/new?${s}`)}function C(e,s){let n=new URLSearchParams({scope:s});"project"===s&&t&&n.set("cwd",t),x.push(`/agents/${encodeURIComponent(e)}?${n}`)}async function k(){j&&(await i(j.name,j.scope),f(null))}return(0,n.jsxs)("div",{ref:e,className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("div",{}),(0,n.jsxs)(d.$,{size:"sm",onClick:()=>v(!0),children:[(0,n.jsx)(a.A,{className:"h-4 w-4 mr-1"}),"New Agent"]})]}),r&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading agents..."}),!r&&0===s.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No custom agents found. Create one to get started."}),N.length>0&&(0,n.jsxs)(u.Zp,{children:[(0,n.jsx)(u.aR,{children:(0,n.jsx)(u.ZB,{className:"text-base",children:"Global"})}),(0,n.jsx)(u.Wu,{className:"space-y-1",children:N.map(e=>(0,n.jsx)(p,{name:e.name,scope:"user",description:e.description,onClick:()=>C(e.name,"user"),onDelete:()=>f({name:e.name,scope:"user"})},e.name))})]}),b.length>0&&(0,n.jsxs)(u.Zp,{children:[(0,n.jsx)(u.aR,{children:(0,n.jsx)(u.ZB,{className:"text-base",children:"Project"})}),(0,n.jsx)(u.Wu,{className:"space-y-1",children:b.map(e=>(0,n.jsx)(p,{name:e.name,scope:"project",description:e.description,onClick:()=>C(e.name,"project"),onDelete:()=>f({name:e.name,scope:"project"})},e.name))})]}),(0,n.jsx)(m.lG,{open:g,onOpenChange:v,children:(0,n.jsxs)(m.Cf,{children:[(0,n.jsx)(m.c7,{children:(0,n.jsx)(m.L3,{children:"New Agent"})}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Where should this agent be saved?"}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(d.$,{variant:"outline",className:"flex-1",onClick:()=>w("user"),children:"Global"}),(0,n.jsx)(d.$,{variant:"outline",className:"flex-1",onClick:()=>w("project"),disabled:!t,children:"Project"})]})]})}),(0,n.jsx)(m.lG,{open:!!j,onOpenChange:()=>f(null),children:(0,n.jsxs)(m.Cf,{children:[(0,n.jsx)(m.c7,{children:(0,n.jsx)(m.L3,{children:"Delete Agent"})}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground mb-4",children:["Delete ",(0,n.jsx)("span",{className:"font-mono font-bold",children:j?.name}),"? This cannot be undone."]}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(d.$,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),(0,n.jsx)(d.$,{variant:"destructive",onClick:k,children:"Delete"})]})]})})]})}function p({name:e,scope:t,description:s,onClick:a,onDelete:l}){return(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors",children:[(0,n.jsxs)("button",{type:"button",className:"flex-1 text-left min-w-0",onClick:a,children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"font-mono font-bold text-sm",children:e}),(0,n.jsx)(i.E,{variant:"secondary",className:"text-[10px]",children:"user"===t?"Global":"Project"})]}),s&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:s})]}),(0,n.jsx)("button",{type:"button",className:"shrink-0 p-1 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",onClick:e=>{e.stopPropagation(),l()},children:(0,n.jsx)(r.A,{className:"h-4 w-4"})})]})}}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=49194)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[32805],{54669:(e,t,n)=>{Promise.resolve().then(n.bind(n,55165))},55165:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>x});var r=n(95155),s=n(64577),c=n(99314),a=n(81402),l=n(73321),o=n(12115),i=n(1550),d=n(56905),u=n(45160),m=n(89239);let f={user:{title:"~/.claude/CLAUDE.md",badge:"Global"},project:{title:"CLAUDE.md",badge:"Project"},"project-hidden":{title:".claude/CLAUDE.md",badge:"Project"}};function x(){let e=(0,l.useSearchParams)(),t=e.get("scope")||"user",n=e.get("cwd")||void 0,x=f[t];(0,i.si)("Edit CLAUDE.md",{hideActions:!0});let[h,p]=(0,o.useState)(""),[g,v]=(0,o.useState)(""),[b,j]=(0,o.useState)(!0),[w,N]=(0,o.useState)(!1),[k,y]=(0,o.useState)(null),[C,E]=(0,o.useState)(!1),S=h!==g;(0,o.useEffect)(()=>{let e=new URLSearchParams({scope:t});n&&e.set("cwd",n),fetch(`/api/claude-md?${e}`).then(e=>e.json()).then(e=>{p(e.content),v(e.content)}).catch(()=>y("Failed to load")).finally(()=>j(!1))},[t,n]);let L=(0,o.useCallback)(async()=>{N(!0),y(null);try{if(!(await fetch("/api/claude-md",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:t,cwd:n,content:h})})).ok)throw Error("Save failed");v(h),y("Saved")}catch{y("Failed to save")}finally{N(!1)}},[t,n,h]);return b?(0,r.jsx)("div",{className:"flex-1 min-h-0 p-4",children:(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,r.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col p-4 gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,r.jsx)("span",{className:"font-mono font-bold text-sm truncate",children:x.title}),(0,r.jsx)(u.E,{variant:"secondary",className:"shrink-0",children:x.badge})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[k&&(0,r.jsx)("p",{className:`text-sm ${"Saved"===k?"text-green-600":"text-destructive"}`,children:k}),(0,r.jsxs)(m.$,{size:"sm",variant:"outline",onClick:()=>{let e=document.createElement("textarea");e.value=h,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),E(!0),setTimeout(()=>E(!1),1500)},children:[C?(0,r.jsx)(s.A,{className:"h-4 w-4 mr-1"}):(0,r.jsx)(c.A,{className:"h-4 w-4 mr-1"}),C?"Copied":"Copy"]}),(0,r.jsxs)(m.$,{size:"sm",onClick:L,disabled:w||!S,children:[(0,r.jsx)(a.A,{className:"h-4 w-4 mr-1"}),w?"Saving...":"Save"]})]})]}),(0,r.jsx)("div",{className:"flex-1 min-h-0",children:(0,r.jsx)(d.n,{value:h,onChange:e=>{p(e),y(null)},onSave:L,className:"h-full"})})]})}},56905:(e,t,n)=>{"use strict";n.d(t,{n:()=>u});var r=n(95155),s=n(18986),c=n(25182),a=n(12115),l=n(98757),o=n(64233),i=n(40980);let d="cockpit-md-editor-preview";function u({value:e,onChange:t,onSave:n,className:f}){let[x,h]=(0,a.useState)(!1);(0,a.useEffect)(()=>{"1"===localStorage.getItem(d)&&h(!0)},[]);let p=(0,a.useCallback)(e=>{h(e),localStorage.setItem(d,e?"1":"0")},[]);return(0,r.jsxs)("div",{className:(0,i.cn)("flex flex-col min-h-0 overflow-hidden rounded-md border bg-background",f),children:[(0,r.jsxs)("div",{className:"shrink-0 flex items-center gap-1 border-b bg-muted/30 px-2 py-1",children:[(0,r.jsx)(m,{active:!x,icon:(0,r.jsx)(s.A,{className:"h-3.5 w-3.5"}),label:"Edit",onClick:()=>p(!1)}),(0,r.jsx)(m,{active:x,icon:(0,r.jsx)(c.A,{className:"h-3.5 w-3.5"}),label:"Preview",onClick:()=>p(!0)})]}),x?(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:e.trim()?(0,r.jsx)(o.Y,{content:e}):(0,r.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"Nothing to preview."})}):(0,r.jsx)(l.B,{value:e,onChange:t,language:"markdown",onSave:n,className:"flex-1 min-h-0 rounded-none border-0 [&_.cm-editor]:h-full [&_.cm-editor]:min-h-[300px]"})]})}function m({active:e,icon:t,label:n,onClick:s}){return(0,r.jsxs)("button",{type:"button",onClick:s,"aria-pressed":e,className:(0,i.cn)("inline-flex items-center gap-1.5 rounded px-2 py-0.5 text-xs transition-colors",e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[t,n]})}},98757:(e,t,n)=>{"use strict";n.d(t,{B:()=>x});var r=n(95155),s=n(13748),c=n(53649),a=n(27071),l=n(74059),o=n(89561),i=n(62465),d=n(12115);let u=o.Lz.theme({"&":{backgroundColor:"transparent"},".cm-gutters":{backgroundColor:"transparent",borderRight:"1px solid hsl(var(--border))"}});function m(){return!("u"<typeof document)&&document.documentElement.classList.contains("dark")}function f(e){switch(e){case"markdown":default:return(0,s.wD)();case"yaml":return(0,c.oQ)()}}function x({value:e,onChange:t,language:n,readOnly:s,className:c,onSave:h}){let p=(0,d.useRef)(null),g=(0,d.useRef)(null),v=(0,d.useRef)(new a.xx),b=(0,d.useRef)(new a.xx),j=(0,d.useRef)(new a.xx),w=(0,d.useRef)(t),N=(0,d.useRef)(h),k=(0,d.useRef)(e);return w.current=t,N.current=h,(0,d.useEffect)(()=>{if(!p.current)return;let e=a.$t.create({doc:k.current,extensions:[i.oQ,o.Lz.lineWrapping,v.current.of(m()?l.bM:u),b.current.of(f(n)),j.current.of(a.$t.readOnly.of(!!s)),o.w4.of([{key:"Mod-s",run:()=>(N.current?.(),!0)}]),o.Lz.updateListener.of(e=>{if(e.docChanged){let t=e.state.doc.toString();k.current=t,w.current(t)}})]}),t=new o.Lz({state:e,parent:p.current});return g.current=t,()=>{t.destroy(),g.current=null}},[]),(0,d.useEffect)(()=>{let t=g.current;t&&e!==k.current&&(k.current=e,t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}}))},[e]),(0,d.useEffect)(()=>{let e=g.current;if(!e)return;let t=new MutationObserver(()=>{e.dispatch({effects:v.current.reconfigure(m()?l.bM:u)})});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]),(0,d.useEffect)(()=>{let e=g.current;e&&e.dispatch({effects:b.current.reconfigure(f(n))})},[n]),(0,d.useEffect)(()=>{let e=g.current;e&&e.dispatch({effects:j.current.reconfigure(a.$t.readOnly.of(!!s))})},[s]),(0,r.jsx)("div",{ref:p,className:`overflow-auto rounded-md border bg-background text-sm [&_.cm-editor]:min-h-[200px] [&_.cm-editor.cm-focused]:outline-none ${c||""}`})}}},e=>{e.O(0,[6079,989,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[32805],{54669:(e,t,n)=>{Promise.resolve().then(n.bind(n,55165))},55165:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>x});var r=n(95155),s=n(64577),c=n(99314),a=n(81402),l=n(73321),o=n(12115),i=n(1550),d=n(56905),u=n(45160),m=n(89239);let f={user:{title:"~/.claude/CLAUDE.md",badge:"Global"},project:{title:"CLAUDE.md",badge:"Project"},"project-hidden":{title:".claude/CLAUDE.md",badge:"Project"}};function x(){let e=(0,l.useSearchParams)(),t=e.get("scope")||"user",n=e.get("cwd")||void 0,x=f[t];(0,i.si)("Edit CLAUDE.md",{hideActions:!0});let[h,p]=(0,o.useState)(""),[g,v]=(0,o.useState)(""),[b,j]=(0,o.useState)(!0),[w,N]=(0,o.useState)(!1),[k,y]=(0,o.useState)(null),[C,E]=(0,o.useState)(!1),S=h!==g;(0,o.useEffect)(()=>{let e=new URLSearchParams({scope:t});n&&e.set("cwd",n),fetch(`/api/claude-md?${e}`).then(e=>e.json()).then(e=>{p(e.content),v(e.content)}).catch(()=>y("Failed to load")).finally(()=>j(!1))},[t,n]);let L=(0,o.useCallback)(async()=>{N(!0),y(null);try{if(!(await fetch("/api/claude-md",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:t,cwd:n,content:h})})).ok)throw Error("Save failed");v(h),y("Saved")}catch{y("Failed to save")}finally{N(!1)}},[t,n,h]);return b?(0,r.jsx)("div",{className:"flex-1 min-h-0 p-4",children:(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,r.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col p-4 gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,r.jsx)("span",{className:"font-mono font-bold text-sm truncate",children:x.title}),(0,r.jsx)(u.E,{variant:"secondary",className:"shrink-0",children:x.badge})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[k&&(0,r.jsx)("p",{className:`text-sm ${"Saved"===k?"text-green-600":"text-destructive"}`,children:k}),(0,r.jsxs)(m.$,{size:"sm",variant:"outline",onClick:()=>{let e=document.createElement("textarea");e.value=h,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),E(!0),setTimeout(()=>E(!1),1500)},children:[C?(0,r.jsx)(s.A,{className:"h-4 w-4 mr-1"}):(0,r.jsx)(c.A,{className:"h-4 w-4 mr-1"}),C?"Copied":"Copy"]}),(0,r.jsxs)(m.$,{size:"sm",onClick:L,disabled:w||!S,children:[(0,r.jsx)(a.A,{className:"h-4 w-4 mr-1"}),w?"Saving...":"Save"]})]})]}),(0,r.jsx)("div",{className:"flex-1 min-h-0",children:(0,r.jsx)(d.n,{value:h,onChange:e=>{p(e),y(null)},onSave:L,className:"h-full"})})]})}},56905:(e,t,n)=>{"use strict";n.d(t,{n:()=>u});var r=n(95155),s=n(18986),c=n(25182),a=n(12115),l=n(98757),o=n(64233),i=n(40980);let d="cockpit-md-editor-preview";function u({value:e,onChange:t,onSave:n,className:f}){let[x,h]=(0,a.useState)(!1);(0,a.useEffect)(()=>{"1"===localStorage.getItem(d)&&h(!0)},[]);let p=(0,a.useCallback)(e=>{h(e),localStorage.setItem(d,e?"1":"0")},[]);return(0,r.jsxs)("div",{className:(0,i.cn)("flex flex-col min-h-0 overflow-hidden rounded-md border bg-background",f),children:[(0,r.jsxs)("div",{className:"shrink-0 flex items-center gap-1 border-b bg-muted/30 px-2 py-1",children:[(0,r.jsx)(m,{active:!x,icon:(0,r.jsx)(s.A,{className:"h-3.5 w-3.5"}),label:"Edit",onClick:()=>p(!1)}),(0,r.jsx)(m,{active:x,icon:(0,r.jsx)(c.A,{className:"h-3.5 w-3.5"}),label:"Preview",onClick:()=>p(!0)})]}),x?(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:e.trim()?(0,r.jsx)(o.Y,{content:e}):(0,r.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"Nothing to preview."})}):(0,r.jsx)(l.B,{value:e,onChange:t,language:"markdown",onSave:n,className:"flex-1 min-h-0 rounded-none border-0 [&_.cm-editor]:h-full [&_.cm-editor]:min-h-[300px]"})]})}function m({active:e,icon:t,label:n,onClick:s}){return(0,r.jsxs)("button",{type:"button",onClick:s,"aria-pressed":e,className:(0,i.cn)("inline-flex items-center gap-1.5 rounded px-2 py-0.5 text-xs transition-colors",e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[t,n]})}},98757:(e,t,n)=>{"use strict";n.d(t,{B:()=>x});var r=n(95155),s=n(13748),c=n(53649),a=n(27071),l=n(74059),o=n(89561),i=n(62465),d=n(12115);let u=o.Lz.theme({"&":{backgroundColor:"transparent"},".cm-gutters":{backgroundColor:"transparent",borderRight:"1px solid hsl(var(--border))"}});function m(){return!("u"<typeof document)&&document.documentElement.classList.contains("dark")}function f(e){switch(e){case"markdown":default:return(0,s.wD)();case"yaml":return(0,c.oQ)()}}function x({value:e,onChange:t,language:n,readOnly:s,className:c,onSave:h}){let p=(0,d.useRef)(null),g=(0,d.useRef)(null),v=(0,d.useRef)(new a.xx),b=(0,d.useRef)(new a.xx),j=(0,d.useRef)(new a.xx),w=(0,d.useRef)(t),N=(0,d.useRef)(h),k=(0,d.useRef)(e);return w.current=t,N.current=h,(0,d.useEffect)(()=>{if(!p.current)return;let e=a.$t.create({doc:k.current,extensions:[i.oQ,o.Lz.lineWrapping,v.current.of(m()?l.bM:u),b.current.of(f(n)),j.current.of(a.$t.readOnly.of(!!s)),o.w4.of([{key:"Mod-s",run:()=>(N.current?.(),!0)}]),o.Lz.updateListener.of(e=>{if(e.docChanged){let t=e.state.doc.toString();k.current=t,w.current(t)}})]}),t=new o.Lz({state:e,parent:p.current});return g.current=t,()=>{t.destroy(),g.current=null}},[]),(0,d.useEffect)(()=>{let t=g.current;t&&e!==k.current&&(k.current=e,t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}}))},[e]),(0,d.useEffect)(()=>{let e=g.current;if(!e)return;let t=new MutationObserver(()=>{e.dispatch({effects:v.current.reconfigure(m()?l.bM:u)})});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]),(0,d.useEffect)(()=>{let e=g.current;e&&e.dispatch({effects:b.current.reconfigure(f(n))})},[n]),(0,d.useEffect)(()=>{let e=g.current;e&&e.dispatch({effects:j.current.reconfigure(a.$t.readOnly.of(!!s))})},[s]),(0,r.jsx)("div",{ref:p,className:`overflow-auto rounded-md border bg-background text-sm [&_.cm-editor]:min-h-[200px] [&_.cm-editor.cm-focused]:outline-none ${c||""}`})}}},e=>{e.O(0,[6079,989,14371,6802,1550,28441,93794,77358],()=>e(e.s=54669)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[29604],{38316:(e,s,t)=>{Promise.resolve().then(t.bind(t,80520))},80520:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>h});var n=t(95155),l=t(2125),c=t(73321),r=t(12115),a=t(1550),i=t(45160),o=t(89239),d=t(81477),u=t(42763),x=t(53972);function h(){(0,a.si)("CLAUDE.md",{hideActions:!0});let{files:e,cwds:s,loading:t}=function(){let[e,s]=(0,r.useState)([]),[t,n]=(0,r.useState)([]),[l,c]=(0,r.useState)(!0),a=(0,r.useCallback)(()=>{c(!0),fetch("/api/claude-md").then(e=>e.json()).then(e=>{s(e.files),n(e.cwds)}).catch(()=>{s([]),n([])}).finally(()=>c(!1))},[]);return(0,r.useEffect)(()=>{a()},[a]),{files:e,cwds:t,loading:l,refresh:a}}(),i=(0,c.useRouter)(),[u,h]=(0,r.useState)(!1);function f(e){let s=new URLSearchParams({scope:e.scope});e.cwd&&s.set("cwd",e.cwd),i.push(`/claude-md/edit?${s}`)}let j=e.find(e=>"user"===e.scope),w=e.filter(e=>"user"!==e.scope),N=new Map;for(let e of w){if(!e.cwd)continue;let s=N.get(e.cwd)||[];s.push(e),N.set(e.cwd,s)}let C=new Set;for(let e of w)e.cwd&&e.exists&&C.add(e.cwd);let g=s.filter(e=>(N.get(e)||[]).filter(e=>e.exists).length<2);return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("div",{}),g.length>0&&(0,n.jsxs)(o.$,{size:"sm",onClick:()=>h(!0),children:[(0,n.jsx)(l.A,{className:"h-4 w-4 mr-1"}),"New"]})]}),t&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."}),!t&&j&&(0,n.jsxs)(d.Zp,{children:[(0,n.jsx)(d.aR,{children:(0,n.jsx)(d.ZB,{className:"text-base",children:"Global"})}),(0,n.jsx)(d.Wu,{className:"space-y-1",children:(0,n.jsx)(m,{file:j,onClick:()=>f(j)})})]}),!t&&Array.from(N.entries()).map(([e,s])=>{let t=s.filter(e=>e.exists);if(0===t.length)return null;let l=(0,x.uk)(e)||e;return(0,n.jsxs)(d.Zp,{children:[(0,n.jsx)(d.aR,{children:(0,n.jsx)(d.ZB,{className:"text-base",children:l})}),(0,n.jsx)(d.Wu,{className:"space-y-1",children:t.map(e=>(0,n.jsx)(m,{file:e,onClick:()=>f(e)},e.scope))})]},e)}),(0,n.jsx)(p,{open:u,onOpenChange:h,cwds:g,byCwd:N,onSelect:function(e,s){h(!1);let t=new URLSearchParams({scope:e,cwd:s});i.push(`/claude-md/edit?${t}`)}})]})}function m({file:e,onClick:s}){return(0,n.jsx)("button",{type:"button",className:"flex w-full items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors text-left",onClick:s,children:(0,n.jsx)("div",{className:"flex-1 min-w-0",children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"font-mono font-bold text-sm",children:function(e){switch(e){case"user":return"~/.claude/CLAUDE.md";case"project":return"CLAUDE.md";case"project-hidden":return".claude/CLAUDE.md"}}(e.scope)}),(0,n.jsx)(i.E,{variant:"secondary",className:"text-[10px]",children:"user"===e.scope?"Global":"Project"})]})})})}function p({open:e,onOpenChange:s,cwds:t,byCwd:l,onSelect:c}){let[a,i]=(0,r.useState)(null);function d(e){let s=l.get(e)||[],t=[];return s.some(e=>"project"===e.scope&&e.exists)||t.push("project"),s.some(e=>"project-hidden"===e.scope&&e.exists)||t.push("project-hidden"),t}return(0,n.jsx)(u.lG,{open:e,onOpenChange:e=>{s(e),e||i(null)},children:(0,n.jsxs)(u.Cf,{children:[(0,n.jsx)(u.c7,{children:(0,n.jsx)(u.L3,{children:a?"Choose type":"Choose project"})}),!a&&(0,n.jsx)("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:t.map(e=>{let s=(0,x.uk)(e)||e;return(0,n.jsxs)("button",{className:"flex w-full items-center rounded px-3 py-2 text-sm hover:bg-muted transition-colors text-left",onClick:()=>{let s;1===(s=d(e)).length?c(s[0],e):i(e)},children:[(0,n.jsx)("span",{className:"font-mono",children:s}),(0,n.jsx)("span",{className:"ml-2 text-xs text-muted-foreground truncate",children:e})]},e)})}),a&&(0,n.jsx)("div",{className:"flex gap-2",children:d(a).map(e=>(0,n.jsx)(o.$,{variant:"outline",className:"flex-1",onClick:()=>c(e,a),children:"project"===e?"CLAUDE.md":".claude/CLAUDE.md"},e))})]})})}}},e=>{e.O(0,[989,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[29604],{38316:(e,s,t)=>{Promise.resolve().then(t.bind(t,80520))},80520:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>h});var n=t(95155),l=t(2125),c=t(73321),r=t(12115),a=t(1550),i=t(45160),o=t(89239),d=t(81477),u=t(42763),x=t(53972);function h(){(0,a.si)("CLAUDE.md",{hideActions:!0});let{files:e,cwds:s,loading:t}=function(){let[e,s]=(0,r.useState)([]),[t,n]=(0,r.useState)([]),[l,c]=(0,r.useState)(!0),a=(0,r.useCallback)(()=>{c(!0),fetch("/api/claude-md").then(e=>e.json()).then(e=>{s(e.files),n(e.cwds)}).catch(()=>{s([]),n([])}).finally(()=>c(!1))},[]);return(0,r.useEffect)(()=>{a()},[a]),{files:e,cwds:t,loading:l,refresh:a}}(),i=(0,c.useRouter)(),[u,h]=(0,r.useState)(!1);function f(e){let s=new URLSearchParams({scope:e.scope});e.cwd&&s.set("cwd",e.cwd),i.push(`/claude-md/edit?${s}`)}let j=e.find(e=>"user"===e.scope),w=e.filter(e=>"user"!==e.scope),N=new Map;for(let e of w){if(!e.cwd)continue;let s=N.get(e.cwd)||[];s.push(e),N.set(e.cwd,s)}let C=new Set;for(let e of w)e.cwd&&e.exists&&C.add(e.cwd);let g=s.filter(e=>(N.get(e)||[]).filter(e=>e.exists).length<2);return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("div",{}),g.length>0&&(0,n.jsxs)(o.$,{size:"sm",onClick:()=>h(!0),children:[(0,n.jsx)(l.A,{className:"h-4 w-4 mr-1"}),"New"]})]}),t&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."}),!t&&j&&(0,n.jsxs)(d.Zp,{children:[(0,n.jsx)(d.aR,{children:(0,n.jsx)(d.ZB,{className:"text-base",children:"Global"})}),(0,n.jsx)(d.Wu,{className:"space-y-1",children:(0,n.jsx)(m,{file:j,onClick:()=>f(j)})})]}),!t&&Array.from(N.entries()).map(([e,s])=>{let t=s.filter(e=>e.exists);if(0===t.length)return null;let l=(0,x.uk)(e)||e;return(0,n.jsxs)(d.Zp,{children:[(0,n.jsx)(d.aR,{children:(0,n.jsx)(d.ZB,{className:"text-base",children:l})}),(0,n.jsx)(d.Wu,{className:"space-y-1",children:t.map(e=>(0,n.jsx)(m,{file:e,onClick:()=>f(e)},e.scope))})]},e)}),(0,n.jsx)(p,{open:u,onOpenChange:h,cwds:g,byCwd:N,onSelect:function(e,s){h(!1);let t=new URLSearchParams({scope:e,cwd:s});i.push(`/claude-md/edit?${t}`)}})]})}function m({file:e,onClick:s}){return(0,n.jsx)("button",{type:"button",className:"flex w-full items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors text-left",onClick:s,children:(0,n.jsx)("div",{className:"flex-1 min-w-0",children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"font-mono font-bold text-sm",children:function(e){switch(e){case"user":return"~/.claude/CLAUDE.md";case"project":return"CLAUDE.md";case"project-hidden":return".claude/CLAUDE.md"}}(e.scope)}),(0,n.jsx)(i.E,{variant:"secondary",className:"text-[10px]",children:"user"===e.scope?"Global":"Project"})]})})})}function p({open:e,onOpenChange:s,cwds:t,byCwd:l,onSelect:c}){let[a,i]=(0,r.useState)(null);function d(e){let s=l.get(e)||[],t=[];return s.some(e=>"project"===e.scope&&e.exists)||t.push("project"),s.some(e=>"project-hidden"===e.scope&&e.exists)||t.push("project-hidden"),t}return(0,n.jsx)(u.lG,{open:e,onOpenChange:e=>{s(e),e||i(null)},children:(0,n.jsxs)(u.Cf,{children:[(0,n.jsx)(u.c7,{children:(0,n.jsx)(u.L3,{children:a?"Choose type":"Choose project"})}),!a&&(0,n.jsx)("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:t.map(e=>{let s=(0,x.uk)(e)||e;return(0,n.jsxs)("button",{className:"flex w-full items-center rounded px-3 py-2 text-sm hover:bg-muted transition-colors text-left",onClick:()=>{let s;1===(s=d(e)).length?c(s[0],e):i(e)},children:[(0,n.jsx)("span",{className:"font-mono",children:s}),(0,n.jsx)("span",{className:"ml-2 text-xs text-muted-foreground truncate",children:e})]},e)})}),a&&(0,n.jsx)("div",{className:"flex gap-2",children:d(a).map(e=>(0,n.jsx)(o.$,{variant:"outline",className:"flex-1",onClick:()=>c(e,a),children:"project"===e?"CLAUDE.md":".claude/CLAUDE.md"},e))})]})})}}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=38316)),_N_E=e.O()}]);
|
|
@@ -3,4 +3,4 @@ description: What this command does
|
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
Your command prompt here. Use $ARGUMENTS for user input.
|
|
6
|
-
`;function x({params:e}){let{name:t}=(0,l.use)(e),n=(0,c.useSearchParams)(),p=(0,c.useRouter)(),v="new"===t,g=n.get("scope")||"user",b=n.get("cwd")||void 0;(0,i.si)(v?"New Command":"Edit Command",{hideActions:!0});let[w,N]=(0,l.useState)(v?"":decodeURIComponent(t)),[j,y]=(0,l.useState)(v?h:""),[C,k]=(0,l.useState)(v?h:""),[S,E]=(0,l.useState)(!v),[R,$]=(0,l.useState)(!1),[_,L]=(0,l.useState)(null),[U,A]=(0,l.useState)(!1),z=j!==C;(0,l.useEffect)(()=>{if(v)return;let e=new URLSearchParams({scope:g});b&&e.set("cwd",b),fetch(`/api/commands/${encodeURIComponent(t)}?${e}`).then(e=>{if(!e.ok)throw Error("Not found");return e.json()}).then(e=>{y(e.content),k(e.content)}).catch(()=>{L("Failed to load command")}).finally(()=>E(!1))},[v,t,g,b]);let P=(0,l.useCallback)(async()=>{let e=w.trim();if(!e)return void L("Name is required");if(!/^[a-zA-Z0-9_-]+$/.test(e))return void L("Name can only contain letters, numbers, hyphens, and underscores");$(!0),L(null);try{if(!(await fetch(`/api/commands/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:g,cwd:b,content:j})})).ok)throw Error("Save failed");if(k(j),L("Saved"),v){let t=new URLSearchParams({scope:g});b&&t.set("cwd",b),p.replace(`/commands/${encodeURIComponent(e)}?${t}`)}}catch{L("Failed to save")}finally{$(!1)}},[w,j,g,b,v,p]);return S?(0,r.jsx)("div",{className:"flex-1 min-h-0 p-4",children:(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,r.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex-1 min-w-0",children:v?(0,r.jsx)(f.p,{placeholder:"command-name",value:w,onChange:e=>N(e.target.value),className:"font-mono"}):(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono font-bold text-lg",children:w}),(0,r.jsx)(u.E,{variant:"secondary",children:"user"===g?"Global":"Project"})]})}),(0,r.jsxs)(m.$,{size:"sm",variant:"outline",onClick:()=>{let e=document.createElement("textarea");e.value=j,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),A(!0),setTimeout(()=>A(!1),1500)},children:[U?(0,r.jsx)(s.A,{className:"h-4 w-4 mr-1"}):(0,r.jsx)(o.A,{className:"h-4 w-4 mr-1"}),U?"Copied":"Copy"]}),(0,r.jsxs)(m.$,{size:"sm",onClick:P,disabled:R||!v&&!z,children:[(0,r.jsx)(a.A,{className:"h-4 w-4 mr-1"}),R?"Saving...":"Save"]})]}),_&&(0,r.jsx)("p",{className:`text-sm ${"Saved"===_?"text-green-600":"text-destructive"}`,children:_}),(0,r.jsx)(d.n,{value:j,onChange:y,onSave:P,className:"flex-1 min-h-0"})]})}},98757:(e,t,n)=>{"use strict";n.d(t,{B:()=>h});var r=n(95155),s=n(13748),o=n(53649),a=n(27071),c=n(74059),l=n(89561),i=n(62465),d=n(12115);let u=l.Lz.theme({"&":{backgroundColor:"transparent"},".cm-gutters":{backgroundColor:"transparent",borderRight:"1px solid hsl(var(--border))"}});function m(){return!("u"<typeof document)&&document.documentElement.classList.contains("dark")}function f(e){switch(e){case"markdown":default:return(0,s.wD)();case"yaml":return(0,o.oQ)()}}function h({value:e,onChange:t,language:n,readOnly:s,className:o,onSave:x}){let p=(0,d.useRef)(null),v=(0,d.useRef)(null),g=(0,d.useRef)(new a.xx),b=(0,d.useRef)(new a.xx),w=(0,d.useRef)(new a.xx),N=(0,d.useRef)(t),j=(0,d.useRef)(x),y=(0,d.useRef)(e);return N.current=t,j.current=x,(0,d.useEffect)(()=>{if(!p.current)return;let e=a.$t.create({doc:y.current,extensions:[i.oQ,l.Lz.lineWrapping,g.current.of(m()?c.bM:u),b.current.of(f(n)),w.current.of(a.$t.readOnly.of(!!s)),l.w4.of([{key:"Mod-s",run:()=>(j.current?.(),!0)}]),l.Lz.updateListener.of(e=>{if(e.docChanged){let t=e.state.doc.toString();y.current=t,N.current(t)}})]}),t=new l.Lz({state:e,parent:p.current});return v.current=t,()=>{t.destroy(),v.current=null}},[]),(0,d.useEffect)(()=>{let t=v.current;t&&e!==y.current&&(y.current=e,t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}}))},[e]),(0,d.useEffect)(()=>{let e=v.current;if(!e)return;let t=new MutationObserver(()=>{e.dispatch({effects:g.current.reconfigure(m()?c.bM:u)})});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]),(0,d.useEffect)(()=>{let e=v.current;e&&e.dispatch({effects:b.current.reconfigure(f(n))})},[n]),(0,d.useEffect)(()=>{let e=v.current;e&&e.dispatch({effects:w.current.reconfigure(a.$t.readOnly.of(!!s))})},[s]),(0,r.jsx)("div",{ref:p,className:`overflow-auto rounded-md border bg-background text-sm [&_.cm-editor]:min-h-[200px] [&_.cm-editor.cm-focused]:outline-none ${o||""}`})}}},e=>{e.O(0,[6079,989,
|
|
6
|
+
`;function x({params:e}){let{name:t}=(0,l.use)(e),n=(0,c.useSearchParams)(),p=(0,c.useRouter)(),v="new"===t,g=n.get("scope")||"user",b=n.get("cwd")||void 0;(0,i.si)(v?"New Command":"Edit Command",{hideActions:!0});let[w,N]=(0,l.useState)(v?"":decodeURIComponent(t)),[j,y]=(0,l.useState)(v?h:""),[C,k]=(0,l.useState)(v?h:""),[S,E]=(0,l.useState)(!v),[R,$]=(0,l.useState)(!1),[_,L]=(0,l.useState)(null),[U,A]=(0,l.useState)(!1),z=j!==C;(0,l.useEffect)(()=>{if(v)return;let e=new URLSearchParams({scope:g});b&&e.set("cwd",b),fetch(`/api/commands/${encodeURIComponent(t)}?${e}`).then(e=>{if(!e.ok)throw Error("Not found");return e.json()}).then(e=>{y(e.content),k(e.content)}).catch(()=>{L("Failed to load command")}).finally(()=>E(!1))},[v,t,g,b]);let P=(0,l.useCallback)(async()=>{let e=w.trim();if(!e)return void L("Name is required");if(!/^[a-zA-Z0-9_-]+$/.test(e))return void L("Name can only contain letters, numbers, hyphens, and underscores");$(!0),L(null);try{if(!(await fetch(`/api/commands/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:g,cwd:b,content:j})})).ok)throw Error("Save failed");if(k(j),L("Saved"),v){let t=new URLSearchParams({scope:g});b&&t.set("cwd",b),p.replace(`/commands/${encodeURIComponent(e)}?${t}`)}}catch{L("Failed to save")}finally{$(!1)}},[w,j,g,b,v,p]);return S?(0,r.jsx)("div",{className:"flex-1 min-h-0 p-4",children:(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,r.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex-1 min-w-0",children:v?(0,r.jsx)(f.p,{placeholder:"command-name",value:w,onChange:e=>N(e.target.value),className:"font-mono"}):(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono font-bold text-lg",children:w}),(0,r.jsx)(u.E,{variant:"secondary",children:"user"===g?"Global":"Project"})]})}),(0,r.jsxs)(m.$,{size:"sm",variant:"outline",onClick:()=>{let e=document.createElement("textarea");e.value=j,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),A(!0),setTimeout(()=>A(!1),1500)},children:[U?(0,r.jsx)(s.A,{className:"h-4 w-4 mr-1"}):(0,r.jsx)(o.A,{className:"h-4 w-4 mr-1"}),U?"Copied":"Copy"]}),(0,r.jsxs)(m.$,{size:"sm",onClick:P,disabled:R||!v&&!z,children:[(0,r.jsx)(a.A,{className:"h-4 w-4 mr-1"}),R?"Saving...":"Save"]})]}),_&&(0,r.jsx)("p",{className:`text-sm ${"Saved"===_?"text-green-600":"text-destructive"}`,children:_}),(0,r.jsx)(d.n,{value:j,onChange:y,onSave:P,className:"flex-1 min-h-0"})]})}},98757:(e,t,n)=>{"use strict";n.d(t,{B:()=>h});var r=n(95155),s=n(13748),o=n(53649),a=n(27071),c=n(74059),l=n(89561),i=n(62465),d=n(12115);let u=l.Lz.theme({"&":{backgroundColor:"transparent"},".cm-gutters":{backgroundColor:"transparent",borderRight:"1px solid hsl(var(--border))"}});function m(){return!("u"<typeof document)&&document.documentElement.classList.contains("dark")}function f(e){switch(e){case"markdown":default:return(0,s.wD)();case"yaml":return(0,o.oQ)()}}function h({value:e,onChange:t,language:n,readOnly:s,className:o,onSave:x}){let p=(0,d.useRef)(null),v=(0,d.useRef)(null),g=(0,d.useRef)(new a.xx),b=(0,d.useRef)(new a.xx),w=(0,d.useRef)(new a.xx),N=(0,d.useRef)(t),j=(0,d.useRef)(x),y=(0,d.useRef)(e);return N.current=t,j.current=x,(0,d.useEffect)(()=>{if(!p.current)return;let e=a.$t.create({doc:y.current,extensions:[i.oQ,l.Lz.lineWrapping,g.current.of(m()?c.bM:u),b.current.of(f(n)),w.current.of(a.$t.readOnly.of(!!s)),l.w4.of([{key:"Mod-s",run:()=>(j.current?.(),!0)}]),l.Lz.updateListener.of(e=>{if(e.docChanged){let t=e.state.doc.toString();y.current=t,N.current(t)}})]}),t=new l.Lz({state:e,parent:p.current});return v.current=t,()=>{t.destroy(),v.current=null}},[]),(0,d.useEffect)(()=>{let t=v.current;t&&e!==y.current&&(y.current=e,t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}}))},[e]),(0,d.useEffect)(()=>{let e=v.current;if(!e)return;let t=new MutationObserver(()=>{e.dispatch({effects:g.current.reconfigure(m()?c.bM:u)})});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]),(0,d.useEffect)(()=>{let e=v.current;e&&e.dispatch({effects:b.current.reconfigure(f(n))})},[n]),(0,d.useEffect)(()=>{let e=v.current;e&&e.dispatch({effects:w.current.reconfigure(a.$t.readOnly.of(!!s))})},[s]),(0,r.jsx)("div",{ref:p,className:`overflow-auto rounded-md border bg-background text-sm [&_.cm-editor]:min-h-[200px] [&_.cm-editor.cm-focused]:outline-none ${o||""}`})}}},e=>{e.O(0,[6079,989,14371,6802,1550,28441,93794,77358],()=>e(e.s=96326)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[96494],{36456:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>x});var n=t(95155),a=t(2125),r=t(65738),c=t(73321),l=t(12115),o=t(1550),i=t(45160),m=t(89239),d=t(81477),u=t(42763),h=t(74180);function x(){(0,o.si)("Commands",{hideActions:!0});let e=(0,h.R)("commands-scroll"),s="u">typeof localStorage&&localStorage.getItem("cockpit-agents-cwd")||void 0,{commands:t,loading:r,deleteCommand:i}=function(e){let[s,t]=(0,l.useState)([]),[n,a]=(0,l.useState)(!0),r=(0,l.useCallback)(()=>{a(!0);let s=new URLSearchParams;e&&s.set("cwd",e),fetch(`/api/commands?${s}`).then(e=>e.json()).then(e=>t(e.commands)).catch(()=>t([])).finally(()=>a(!1))},[e]);(0,l.useEffect)(()=>{r()},[r]);let c=(0,l.useCallback)(async(s,t)=>{let n=new URLSearchParams({scope:t});"project"===t&&e&&n.set("cwd",e);try{if((await fetch(`/api/commands/${encodeURIComponent(s)}?${n}`,{method:"DELETE"})).ok)return r(),!0;return!1}catch{return!1}},[e,r]);return{commands:s,loading:n,refresh:r,deleteCommand:c}}(s),x=(0,c.useRouter)(),[j,f]=(0,l.useState)(null),[v,N]=(0,l.useState)(!1),g=t.filter(e=>"user"===e.scope),b=t.filter(e=>"project"===e.scope);function C(e){N(!1);let t=new URLSearchParams({scope:e});"project"===e&&s&&t.set("cwd",s),x.push(`/commands/new?${t}`)}function w(e,t){let n=new URLSearchParams({scope:t});"project"===t&&s&&n.set("cwd",s),x.push(`/commands/${encodeURIComponent(e)}?${n}`)}async function k(){j&&(await i(j.name,j.scope),f(null))}return(0,n.jsxs)("div",{ref:e,className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("div",{}),(0,n.jsxs)(m.$,{size:"sm",onClick:()=>N(!0),children:[(0,n.jsx)(a.A,{className:"h-4 w-4 mr-1"}),"New Command"]})]}),r&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading commands..."}),!r&&0===t.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No custom commands found. Create one to get started."}),g.length>0&&(0,n.jsxs)(d.Zp,{children:[(0,n.jsx)(d.aR,{children:(0,n.jsx)(d.ZB,{className:"text-base",children:"Global"})}),(0,n.jsx)(d.Wu,{className:"space-y-1",children:g.map(e=>(0,n.jsx)(p,{name:e.name,scope:"user",description:e.description,onClick:()=>w(e.name,"user"),onDelete:()=>f({name:e.name,scope:"user"})},e.name))})]}),b.length>0&&(0,n.jsxs)(d.Zp,{children:[(0,n.jsx)(d.aR,{children:(0,n.jsx)(d.ZB,{className:"text-base",children:"Project"})}),(0,n.jsx)(d.Wu,{className:"space-y-1",children:b.map(e=>(0,n.jsx)(p,{name:e.name,scope:"project",description:e.description,onClick:()=>w(e.name,"project"),onDelete:()=>f({name:e.name,scope:"project"})},e.name))})]}),(0,n.jsx)(u.lG,{open:v,onOpenChange:N,children:(0,n.jsxs)(u.Cf,{children:[(0,n.jsx)(u.c7,{children:(0,n.jsx)(u.L3,{children:"New Command"})}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Where should this command be saved?"}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(m.$,{variant:"outline",className:"flex-1",onClick:()=>C("user"),children:"Global"}),(0,n.jsx)(m.$,{variant:"outline",className:"flex-1",onClick:()=>C("project"),disabled:!s,children:"Project"})]})]})}),(0,n.jsx)(u.lG,{open:!!j,onOpenChange:()=>f(null),children:(0,n.jsxs)(u.Cf,{children:[(0,n.jsx)(u.c7,{children:(0,n.jsx)(u.L3,{children:"Delete Command"})}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground mb-4",children:["Delete ",(0,n.jsx)("span",{className:"font-mono font-bold",children:j?.name}),"? This cannot be undone."]}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(m.$,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),(0,n.jsx)(m.$,{variant:"destructive",onClick:k,children:"Delete"})]})]})})]})}function p({name:e,scope:s,description:t,onClick:a,onDelete:c}){return(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors",children:[(0,n.jsxs)("button",{type:"button",className:"flex-1 text-left min-w-0",onClick:a,children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"font-mono font-bold text-sm",children:e}),(0,n.jsx)(i.E,{variant:"secondary",className:"text-[10px]",children:"user"===s?"Global":"Project"})]}),t&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:t})]}),(0,n.jsx)("button",{type:"button",className:"shrink-0 p-1 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",onClick:e=>{e.stopPropagation(),c()},children:(0,n.jsx)(r.A,{className:"h-4 w-4"})})]})}},74180:(e,s,t)=>{"use strict";t.d(s,{R:()=>a});var n=t(12115);function a(e){let s=(0,n.useRef)(null);return(0,n.useCallback)(t=>{if(s.current?.(),s.current=null,!t)return;let n=sessionStorage.getItem(e),a=null!==n?Number(n):NaN,r=Number.isFinite(a)&&a>0,c=0,l=0,o=()=>{r=!1,c&&cancelAnimationFrame(c),c=0,t.removeEventListener("wheel",o),t.removeEventListener("touchstart",o),t.removeEventListener("keydown",o)};if(r)if(t.scrollTop=a,2>Math.abs(t.scrollTop-a))r=!1;else{let e=0,s=()=>{if(r){if(t.scrollTop=a,e++,2>Math.abs(t.scrollTop-a)||e>120)return void o();c=requestAnimationFrame(s)}};t.addEventListener("wheel",o,{passive:!0}),t.addEventListener("touchstart",o,{passive:!0}),t.addEventListener("keydown",o),c=requestAnimationFrame(s)}let i=()=>{r||l||(l=requestAnimationFrame(()=>{l=0,sessionStorage.setItem(e,String(t.scrollTop))}))};t.addEventListener("scroll",i,{passive:!0}),s.current=()=>{let s=r;o(),l&&cancelAnimationFrame(l),t.removeEventListener("scroll",i),s||sessionStorage.setItem(e,String(t.scrollTop))}},[e])}},89850:(e,s,t)=>{Promise.resolve().then(t.bind(t,36456))}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=89850)),_N_E=e.O()}]);
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
"type": "command",
|
|
4
4
|
"command": "echo hook fired"
|
|
5
5
|
}
|
|
6
|
-
]`;function x({params:e}){let{event:t}=(0,c.use)(e),r=(0,l.useSearchParams)(),b="new"===t,g=b?"":decodeURIComponent(t),v=r.get("scope")||"global",j=r.get("filePath")||"",S=r.get("cwd")||void 0;(0,u.si)(b?"New Hook":g,{hideActions:!0});let[y,w]=(0,c.useState)(g),[k,N]=(0,c.useState)(v),[C,E]=(0,c.useState)(b?p:""),[P,R]=(0,c.useState)(b?p:""),[_,L]=(0,c.useState)(!b),[$,O]=(0,c.useState)(!1),[U,z]=(0,c.useState)(null),[A,T]=(0,c.useState)(!1),M=C!==P;(0,c.useEffect)(()=>{if(b)return;let e=new URLSearchParams;S&&e.set("cwd",S),fetch(`/api/hooks?${e}`).then(e=>e.json()).then(e=>{let t=e.hooks.find(e=>e.event===g&&e.scope===v);if(t){let e=JSON.stringify(t.hooks,null,2);E(e),R(e)}else z("Hook not found")}).catch(()=>z("Failed to load")).finally(()=>L(!1))},[b,g,v,S]);let F=(0,c.useCallback)(()=>!b&&j?j:"global"===k?"__global__":"project"===k&&S?`${S}/.claude/settings.json`:"project-local"===k&&S?`${S}/.claude/settings.local.json`:"",[b,j,k,S]),J=(0,c.useCallback)(async()=>{let e,t=b?y:g;if(!t)return void z("Select an event");try{if(e=JSON.parse(C),!Array.isArray(e))throw Error("Must be an array")}catch(e){z("Invalid JSON: must be an array of hook objects");return}O(!0),z(null);let r=F(),a=new URLSearchParams;S&&a.set("cwd",S);try{let s=await fetch(`/api/hooks?${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:r,event:t,hooks:e})});if(!s.ok){let e=await s.json().catch(()=>({}));throw Error(e.error||"Save failed")}R(C),z("Saved")}catch(e){z(e instanceof Error?e.message:"Failed to save")}finally{O(!1)}},[C,b,y,g,S,F]);return _?(0,a.jsx)("div",{className:"flex-1 min-h-0 p-4",children:(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,a.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex-1 min-w-0",children:b?(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("select",{value:y,onChange:e=>w(e.target.value),className:"rounded-md border border-input bg-background px-3 py-1.5 text-sm",children:[(0,a.jsx)("option",{value:"",children:"Select event..."}),m.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),(0,a.jsx)("select",{value:k,onChange:e=>N(e.target.value),className:"rounded-md border border-input bg-background px-3 py-1.5 text-sm",children:h.map(e=>(0,a.jsx)("option",{value:e.value,disabled:"global"!==e.value&&!S,children:e.label},e.value))})]}):(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-mono font-bold text-lg",children:g}),(0,a.jsx)(d.E,{variant:"secondary",children:"global"===v?"Global":"project"===v?"Project":"Local"})]})}),(0,a.jsxs)(f.$,{size:"sm",variant:"outline",onClick:()=>{let e=document.createElement("textarea");e.value=C,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),T(!0),setTimeout(()=>T(!1),1500)},children:[A?(0,a.jsx)(s.A,{className:"h-4 w-4 mr-1"}):(0,a.jsx)(n.A,{className:"h-4 w-4 mr-1"}),A?"Copied":"Copy"]}),(0,a.jsxs)(f.$,{size:"sm",onClick:J,disabled:$||!b&&!M,children:[(0,a.jsx)(o.A,{className:"h-4 w-4 mr-1"}),$?"Saving...":"Save"]})]}),U&&(0,a.jsx)("p",{className:`text-sm ${"Saved"===U?"text-green-600":"text-destructive"}`,children:U}),(0,a.jsx)(i.B,{value:C,onChange:E,language:"json",onSave:J,className:"flex-1"})]})}},58853:(e,t,r)=>{Promise.resolve().then(r.bind(r,27557))},98757:(e,t,r)=>{"use strict";r.d(t,{B:()=>h});var a=r(95155),s=r(13748),n=r(53649),o=r(27071),l=r(74059),c=r(89561),u=r(62465),i=r(12115);let d=c.Lz.theme({"&":{backgroundColor:"transparent"},".cm-gutters":{backgroundColor:"transparent",borderRight:"1px solid hsl(var(--border))"}});function f(){return!("u"<typeof document)&&document.documentElement.classList.contains("dark")}function m(e){switch(e){case"markdown":default:return(0,s.wD)();case"yaml":return(0,n.oQ)()}}function h({value:e,onChange:t,language:r,readOnly:s,className:n,onSave:p}){let x=(0,i.useRef)(null),b=(0,i.useRef)(null),g=(0,i.useRef)(new o.xx),v=(0,i.useRef)(new o.xx),j=(0,i.useRef)(new o.xx),S=(0,i.useRef)(t),y=(0,i.useRef)(p),w=(0,i.useRef)(e);return S.current=t,y.current=p,(0,i.useEffect)(()=>{if(!x.current)return;let e=o.$t.create({doc:w.current,extensions:[u.oQ,c.Lz.lineWrapping,g.current.of(f()?l.bM:d),v.current.of(m(r)),j.current.of(o.$t.readOnly.of(!!s)),c.w4.of([{key:"Mod-s",run:()=>(y.current?.(),!0)}]),c.Lz.updateListener.of(e=>{if(e.docChanged){let t=e.state.doc.toString();w.current=t,S.current(t)}})]}),t=new c.Lz({state:e,parent:x.current});return b.current=t,()=>{t.destroy(),b.current=null}},[]),(0,i.useEffect)(()=>{let t=b.current;t&&e!==w.current&&(w.current=e,t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}}))},[e]),(0,i.useEffect)(()=>{let e=b.current;if(!e)return;let t=new MutationObserver(()=>{e.dispatch({effects:g.current.reconfigure(f()?l.bM:d)})});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]),(0,i.useEffect)(()=>{let e=b.current;e&&e.dispatch({effects:v.current.reconfigure(m(r))})},[r]),(0,i.useEffect)(()=>{let e=b.current;e&&e.dispatch({effects:j.current.reconfigure(o.$t.readOnly.of(!!s))})},[s]),(0,a.jsx)("div",{ref:x,className:`overflow-auto rounded-md border bg-background text-sm [&_.cm-editor]:min-h-[200px] [&_.cm-editor.cm-focused]:outline-none ${n||""}`})}}},e=>{e.O(0,[6079,989,
|
|
6
|
+
]`;function x({params:e}){let{event:t}=(0,c.use)(e),r=(0,l.useSearchParams)(),b="new"===t,g=b?"":decodeURIComponent(t),v=r.get("scope")||"global",j=r.get("filePath")||"",S=r.get("cwd")||void 0;(0,u.si)(b?"New Hook":g,{hideActions:!0});let[y,w]=(0,c.useState)(g),[k,N]=(0,c.useState)(v),[C,E]=(0,c.useState)(b?p:""),[P,R]=(0,c.useState)(b?p:""),[_,L]=(0,c.useState)(!b),[$,O]=(0,c.useState)(!1),[U,z]=(0,c.useState)(null),[A,T]=(0,c.useState)(!1),M=C!==P;(0,c.useEffect)(()=>{if(b)return;let e=new URLSearchParams;S&&e.set("cwd",S),fetch(`/api/hooks?${e}`).then(e=>e.json()).then(e=>{let t=e.hooks.find(e=>e.event===g&&e.scope===v);if(t){let e=JSON.stringify(t.hooks,null,2);E(e),R(e)}else z("Hook not found")}).catch(()=>z("Failed to load")).finally(()=>L(!1))},[b,g,v,S]);let F=(0,c.useCallback)(()=>!b&&j?j:"global"===k?"__global__":"project"===k&&S?`${S}/.claude/settings.json`:"project-local"===k&&S?`${S}/.claude/settings.local.json`:"",[b,j,k,S]),J=(0,c.useCallback)(async()=>{let e,t=b?y:g;if(!t)return void z("Select an event");try{if(e=JSON.parse(C),!Array.isArray(e))throw Error("Must be an array")}catch(e){z("Invalid JSON: must be an array of hook objects");return}O(!0),z(null);let r=F(),a=new URLSearchParams;S&&a.set("cwd",S);try{let s=await fetch(`/api/hooks?${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:r,event:t,hooks:e})});if(!s.ok){let e=await s.json().catch(()=>({}));throw Error(e.error||"Save failed")}R(C),z("Saved")}catch(e){z(e instanceof Error?e.message:"Failed to save")}finally{O(!1)}},[C,b,y,g,S,F]);return _?(0,a.jsx)("div",{className:"flex-1 min-h-0 p-4",children:(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,a.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex-1 min-w-0",children:b?(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("select",{value:y,onChange:e=>w(e.target.value),className:"rounded-md border border-input bg-background px-3 py-1.5 text-sm",children:[(0,a.jsx)("option",{value:"",children:"Select event..."}),m.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),(0,a.jsx)("select",{value:k,onChange:e=>N(e.target.value),className:"rounded-md border border-input bg-background px-3 py-1.5 text-sm",children:h.map(e=>(0,a.jsx)("option",{value:e.value,disabled:"global"!==e.value&&!S,children:e.label},e.value))})]}):(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-mono font-bold text-lg",children:g}),(0,a.jsx)(d.E,{variant:"secondary",children:"global"===v?"Global":"project"===v?"Project":"Local"})]})}),(0,a.jsxs)(f.$,{size:"sm",variant:"outline",onClick:()=>{let e=document.createElement("textarea");e.value=C,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),T(!0),setTimeout(()=>T(!1),1500)},children:[A?(0,a.jsx)(s.A,{className:"h-4 w-4 mr-1"}):(0,a.jsx)(n.A,{className:"h-4 w-4 mr-1"}),A?"Copied":"Copy"]}),(0,a.jsxs)(f.$,{size:"sm",onClick:J,disabled:$||!b&&!M,children:[(0,a.jsx)(o.A,{className:"h-4 w-4 mr-1"}),$?"Saving...":"Save"]})]}),U&&(0,a.jsx)("p",{className:`text-sm ${"Saved"===U?"text-green-600":"text-destructive"}`,children:U}),(0,a.jsx)(i.B,{value:C,onChange:E,language:"json",onSave:J,className:"flex-1"})]})}},58853:(e,t,r)=>{Promise.resolve().then(r.bind(r,27557))},98757:(e,t,r)=>{"use strict";r.d(t,{B:()=>h});var a=r(95155),s=r(13748),n=r(53649),o=r(27071),l=r(74059),c=r(89561),u=r(62465),i=r(12115);let d=c.Lz.theme({"&":{backgroundColor:"transparent"},".cm-gutters":{backgroundColor:"transparent",borderRight:"1px solid hsl(var(--border))"}});function f(){return!("u"<typeof document)&&document.documentElement.classList.contains("dark")}function m(e){switch(e){case"markdown":default:return(0,s.wD)();case"yaml":return(0,n.oQ)()}}function h({value:e,onChange:t,language:r,readOnly:s,className:n,onSave:p}){let x=(0,i.useRef)(null),b=(0,i.useRef)(null),g=(0,i.useRef)(new o.xx),v=(0,i.useRef)(new o.xx),j=(0,i.useRef)(new o.xx),S=(0,i.useRef)(t),y=(0,i.useRef)(p),w=(0,i.useRef)(e);return S.current=t,y.current=p,(0,i.useEffect)(()=>{if(!x.current)return;let e=o.$t.create({doc:w.current,extensions:[u.oQ,c.Lz.lineWrapping,g.current.of(f()?l.bM:d),v.current.of(m(r)),j.current.of(o.$t.readOnly.of(!!s)),c.w4.of([{key:"Mod-s",run:()=>(y.current?.(),!0)}]),c.Lz.updateListener.of(e=>{if(e.docChanged){let t=e.state.doc.toString();w.current=t,S.current(t)}})]}),t=new c.Lz({state:e,parent:x.current});return b.current=t,()=>{t.destroy(),b.current=null}},[]),(0,i.useEffect)(()=>{let t=b.current;t&&e!==w.current&&(w.current=e,t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}}))},[e]),(0,i.useEffect)(()=>{let e=b.current;if(!e)return;let t=new MutationObserver(()=>{e.dispatch({effects:g.current.reconfigure(f()?l.bM:d)})});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]),(0,i.useEffect)(()=>{let e=b.current;e&&e.dispatch({effects:v.current.reconfigure(m(r))})},[r]),(0,i.useEffect)(()=>{let e=b.current;e&&e.dispatch({effects:j.current.reconfigure(o.$t.readOnly.of(!!s))})},[s]),(0,a.jsx)("div",{ref:x,className:`overflow-auto rounded-md border bg-background text-sm [&_.cm-editor]:min-h-[200px] [&_.cm-editor.cm-focused]:outline-none ${n||""}`})}}},e=>{e.O(0,[6079,989,14371,6802,1550,28441,93794,77358],()=>e(e.s=58853)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[40992],{64025:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>d});var o=s(95155),n=s(73321),r=s(1550),a=s(45160),l=s(81477),i=s(12115),c=s(74180);let u={global:"Global",project:"Project","project-local":"Local"},m=new Set(["UserPromptSubmit","PreToolUse","PermissionRequest","Stop","SubagentStop"]);function d(){(0,r.si)("Hooks",{hideActions:!0});let e=(0,c.R)("hooks-scroll"),t="u">typeof localStorage&&localStorage.getItem("cockpit-agents-cwd")||void 0,{hooks:s,loading:d}=function(e){let[t,s]=(0,i.useState)([]),[o,n]=(0,i.useState)([]),[r,a]=(0,i.useState)(!0),l=(0,i.useCallback)(()=>{a(!0);let t=new URLSearchParams;e&&t.set("cwd",e),fetch(`/api/hooks?${t}`).then(e=>e.json()).then(e=>{s(e.hooks),n(e.events)}).catch(()=>s([])).finally(()=>a(!1))},[e]);(0,i.useEffect)(()=>{l()},[l]);let c=(0,i.useCallback)(async(t,s,o)=>{let n=new URLSearchParams;e&&n.set("cwd",e);try{if((await fetch(`/api/hooks?${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:t,event:s,hooks:o})})).ok)return l(),!0;return!1}catch{return!1}},[e,l]);return{hooks:t,events:o,loading:r,refresh:l,saveHooks:c}}(t),h=(0,n.useRouter)(),p={};for(let e of s){let t=e.scope;p[t]||(p[t]=[]),p[t].push(e)}return(0,o.jsxs)("div",{ref:e,className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("div",{}),(0,o.jsx)("button",{className:"inline-flex items-center rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground hover:bg-primary/90",onClick:function(){let e=new URLSearchParams;t&&e.set("cwd",t),h.push(`/hooks/new?${e}`)},children:"New Hook"})]}),d&&(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading hooks..."}),!d&&0===s.length&&(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:"No hooks configured. Hooks let you run commands, HTTP requests, or prompts at key points in the agent lifecycle."}),Object.entries(p).map(([e,s])=>(0,o.jsxs)(l.Zp,{children:[(0,o.jsx)(l.aR,{children:(0,o.jsx)(l.ZB,{className:"text-base",children:u[e]||e})}),(0,o.jsx)(l.Wu,{className:"space-y-1",children:s.map(e=>(0,o.jsx)("button",{type:"button",className:"flex w-full items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors text-left",onClick:()=>{var s;let o;return s=e.event,o=new URLSearchParams({scope:e.scope,filePath:e.filePath}),void(t&&o.set("cwd",t),h.push(`/hooks/${encodeURIComponent(s)}?${o}`))},children:(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("span",{className:"font-mono font-bold text-sm",children:e.event}),m.has(e.event)&&(0,o.jsx)(a.E,{variant:"outline",className:"text-[10px]",children:"can block"})]}),(0,o.jsxs)("p",{className:"text-xs text-muted-foreground mt-0.5",children:[e.hooks.length," hook",1!==e.hooks.length?"s":""," — ",e.hooks.map(e=>e.type).join(", ")]})]})},`${e.event}-${e.scope}`))})]},e))]})}},70532:(e,t,s)=>{Promise.resolve().then(s.bind(s,64025))},74180:(e,t,s)=>{"use strict";s.d(t,{R:()=>n});var o=s(12115);function n(e){let t=(0,o.useRef)(null);return(0,o.useCallback)(s=>{if(t.current?.(),t.current=null,!s)return;let o=sessionStorage.getItem(e),n=null!==o?Number(o):NaN,r=Number.isFinite(n)&&n>0,a=0,l=0,i=()=>{r=!1,a&&cancelAnimationFrame(a),a=0,s.removeEventListener("wheel",i),s.removeEventListener("touchstart",i),s.removeEventListener("keydown",i)};if(r)if(s.scrollTop=n,2>Math.abs(s.scrollTop-n))r=!1;else{let e=0,t=()=>{if(r){if(s.scrollTop=n,e++,2>Math.abs(s.scrollTop-n)||e>120)return void i();a=requestAnimationFrame(t)}};s.addEventListener("wheel",i,{passive:!0}),s.addEventListener("touchstart",i,{passive:!0}),s.addEventListener("keydown",i),a=requestAnimationFrame(t)}let c=()=>{r||l||(l=requestAnimationFrame(()=>{l=0,sessionStorage.setItem(e,String(s.scrollTop))}))};s.addEventListener("scroll",c,{passive:!0}),t.current=()=>{let t=r;i(),l&&cancelAnimationFrame(l),s.removeEventListener("scroll",c),t||sessionStorage.setItem(e,String(s.scrollTop))}},[e])}}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=70532)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[58346],{14577:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},35484:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},54722:(e,s,t)=>{Promise.resolve().then(t.bind(t,96218))},75796:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]])},96218:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>p});var a=t(95155),i=t(35484),n=t(11012),l=t(14577),c=t(92571),r=t(31966),d=t(75796),x=t(65738),h=t(73321),o=t(12115),m=t(1550),u=t(64233),j=t(89239),f=t(42763);function p(){(0,m.si)("Inbox",{hideActions:!0});let{id:e}=(0,h.useParams)(),s=(0,h.useRouter)(),[t,p]=(0,o.useState)(null),[y,k]=(0,o.useState)(!0),[N,v]=(0,o.useState)(!1),b=(0,o.useCallback)(async()=>{let s=await fetch("/api/inbox");if(s.ok){let t=((await s.json()).messages||[]).find(s=>s.id===e);p(t||null),t&&!t.read&&await fetch(`/api/inbox/${t.id}`,{method:"PATCH"})}k(!1)},[e]);(0,o.useEffect)(()=>{b()},[b]);let g=async()=>{await fetch(`/api/inbox/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({read:!1})}),s.push("/inbox")},w=async()=>{await fetch(`/api/inbox/${e}`,{method:"DELETE"}),s.push("/inbox")};return y?(0,a.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,a.jsx)(c.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):t?(0,a.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",onClick:()=>s.push("/inbox"),children:[(0,a.jsx)(r.A,{className:"h-4 w-4 mr-1"}),"Back"]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",onClick:g,children:[(0,a.jsx)(d.A,{className:"h-4 w-4 mr-1"}),"Mark unread"]}),(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>v(!0),children:[(0,a.jsx)(x.A,{className:"h-4 w-4 mr-1"}),"Delete"]})]})]}),(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[function(e){switch(e){case"error":return(0,a.jsx)(i.A,{className:"h-5 w-5 text-destructive shrink-0"});case"warning":return(0,a.jsx)(n.A,{className:"h-5 w-5 text-yellow-500 shrink-0"});default:return(0,a.jsx)(l.A,{className:"h-5 w-5 text-blue-500 shrink-0"})}}(t.priority),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-lg font-semibold",children:t.title}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1 text-xs text-muted-foreground",children:[t.jobName&&(0,a.jsx)("span",{children:t.jobName}),(0,a.jsx)("span",{children:new Date(t.createdAt).toLocaleString()})]})]})]}),(0,a.jsx)("div",{className:"border-t pt-4",children:(0,a.jsx)(u.Y,{content:t.body,variant:"full"})}),(0,a.jsx)(f.lG,{open:N,onOpenChange:()=>v(!1),children:(0,a.jsxs)(f.Cf,{children:[(0,a.jsx)(f.c7,{children:(0,a.jsx)(f.L3,{children:"Delete Message"})}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Delete this message? This cannot be undone."}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(j.$,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),(0,a.jsx)(j.$,{variant:"destructive",onClick:w,children:"Delete"})]})]})})]}):(0,a.jsxs)("div",{className:"flex-1 p-4",children:[(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",onClick:()=>s.push("/inbox"),children:[(0,a.jsx)(r.A,{className:"h-4 w-4 mr-1"}),"Back"]}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-8 text-center",children:"Message not found."})]})}}},e=>{e.O(0,[989,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[58346],{14577:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},35484:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},54722:(e,s,t)=>{Promise.resolve().then(t.bind(t,96218))},75796:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]])},96218:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>p});var a=t(95155),i=t(35484),n=t(11012),l=t(14577),c=t(92571),r=t(31966),d=t(75796),x=t(65738),h=t(73321),o=t(12115),m=t(1550),u=t(64233),j=t(89239),f=t(42763);function p(){(0,m.si)("Inbox",{hideActions:!0});let{id:e}=(0,h.useParams)(),s=(0,h.useRouter)(),[t,p]=(0,o.useState)(null),[y,k]=(0,o.useState)(!0),[N,v]=(0,o.useState)(!1),b=(0,o.useCallback)(async()=>{let s=await fetch("/api/inbox");if(s.ok){let t=((await s.json()).messages||[]).find(s=>s.id===e);p(t||null),t&&!t.read&&await fetch(`/api/inbox/${t.id}`,{method:"PATCH"})}k(!1)},[e]);(0,o.useEffect)(()=>{b()},[b]);let g=async()=>{await fetch(`/api/inbox/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({read:!1})}),s.push("/inbox")},w=async()=>{await fetch(`/api/inbox/${e}`,{method:"DELETE"}),s.push("/inbox")};return y?(0,a.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,a.jsx)(c.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):t?(0,a.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",onClick:()=>s.push("/inbox"),children:[(0,a.jsx)(r.A,{className:"h-4 w-4 mr-1"}),"Back"]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",onClick:g,children:[(0,a.jsx)(d.A,{className:"h-4 w-4 mr-1"}),"Mark unread"]}),(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>v(!0),children:[(0,a.jsx)(x.A,{className:"h-4 w-4 mr-1"}),"Delete"]})]})]}),(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[function(e){switch(e){case"error":return(0,a.jsx)(i.A,{className:"h-5 w-5 text-destructive shrink-0"});case"warning":return(0,a.jsx)(n.A,{className:"h-5 w-5 text-yellow-500 shrink-0"});default:return(0,a.jsx)(l.A,{className:"h-5 w-5 text-blue-500 shrink-0"})}}(t.priority),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-lg font-semibold",children:t.title}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1 text-xs text-muted-foreground",children:[t.jobName&&(0,a.jsx)("span",{children:t.jobName}),(0,a.jsx)("span",{children:new Date(t.createdAt).toLocaleString()})]})]})]}),(0,a.jsx)("div",{className:"border-t pt-4",children:(0,a.jsx)(u.Y,{content:t.body,variant:"full"})}),(0,a.jsx)(f.lG,{open:N,onOpenChange:()=>v(!1),children:(0,a.jsxs)(f.Cf,{children:[(0,a.jsx)(f.c7,{children:(0,a.jsx)(f.L3,{children:"Delete Message"})}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Delete this message? This cannot be undone."}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(j.$,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),(0,a.jsx)(j.$,{variant:"destructive",onClick:w,children:"Delete"})]})]})})]}):(0,a.jsxs)("div",{className:"flex-1 p-4",children:[(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",onClick:()=>s.push("/inbox"),children:[(0,a.jsx)(r.A,{className:"h-4 w-4 mr-1"}),"Back"]}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-8 text-center",children:"Message not found."})]})}}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=54722)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[10576],{14577:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},34454:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>g});var a=t(95155),r=t(35484),n=t(11012),i=t(14577);let l=(0,t(99537).A)("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);var c=t(65738),o=t(92571),d=t(64577),h=t(75796),m=t(73321),x=t(12115),u=t(1550),f=t(89239),p=t(42763),j=t(74180);function g(){(0,u.si)("Inbox",{hideActions:!0});let e=(0,j.R)("inbox-scroll"),s=(0,m.useRouter)(),[t,g]=(0,x.useState)([]),[v,y]=(0,x.useState)(!0),[N,k]=(0,x.useState)(null),[b,w]=(0,x.useState)(!1),A=(0,x.useCallback)(async()=>{let e=await fetch("/api/inbox");e.ok&&g((await e.json()).messages||[]),y(!1)},[]);(0,x.useEffect)(()=>{A()},[A]);let C=async(e,s)=>{e.stopPropagation();let t=!s.read;await fetch(`/api/inbox/${s.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({read:t})}),g(e=>e.map(e=>e.id===s.id?{...e,read:t}:e))},$=async()=>{N&&(await fetch(`/api/inbox/${N}`,{method:"DELETE"}),g(e=>e.filter(e=>e.id!==N)),k(null))},E=async()=>{let e=0!==T;await fetch("/api/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"mark_all_read",read:e})}),g(s=>s.map(s=>({...s,read:e})))},M=async()=>{await fetch("/api/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear"})}),g([]),w(!1)},T=t.filter(e=>!e.read).length;return(0,a.jsxs)("div",{ref:e,className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:t.length>0&&(0,a.jsxs)(a.Fragment,{children:[t.length," message",1!==t.length?"s":"",T>0&&` (${T} unread)`]})}),t.length>0&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(f.$,{variant:"outline",size:"sm",onClick:E,children:[(0,a.jsx)(l,{className:"h-3.5 w-3.5 mr-1"}),0===T?"Mark all unread":"Mark all read"]}),(0,a.jsxs)(f.$,{variant:"outline",size:"sm",onClick:()=>w(!0),children:[(0,a.jsx)(c.A,{className:"h-3.5 w-3.5 mr-1"}),"Clear all"]})]})]}),v&&(0,a.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,a.jsx)(o.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!v&&0===t.length&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,a.jsx)(d.A,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"No messages."}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Messages from scheduled jobs will appear here."})]}),(0,a.jsx)("div",{className:"space-y-2",children:t.map(e=>(0,a.jsx)("div",{className:`rounded-lg border bg-card transition-colors cursor-pointer hover:bg-accent/50 ${!e.read?"border-l-2 border-l-blue-500":""}`,role:"button",onClick:()=>s.push(`/inbox/${e.id}`),children:(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[function(e){switch(e){case"error":return(0,a.jsx)(r.A,{className:"h-4 w-4 text-destructive shrink-0"});case"warning":return(0,a.jsx)(n.A,{className:"h-4 w-4 text-yellow-500 shrink-0"});default:return(0,a.jsx)(i.A,{className:"h-4 w-4 text-blue-500 shrink-0"})}}(e.priority),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsx)("span",{className:`text-sm truncate ${!e.read?"font-semibold":""}`,children:e.title})}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-0.5 text-xs text-muted-foreground",children:[e.jobName&&(0,a.jsx)("span",{children:e.jobName}),(0,a.jsx)("span",{children:function(e){let s=Math.floor((Date.now()-e)/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;let t=Math.floor(s/60);if(t<24)return`${t}h ago`;let a=Math.floor(t/24);return`${a}d ago`}(e.createdAt)})]})]}),(0,a.jsxs)("div",{className:"flex items-center shrink-0",children:[(0,a.jsx)(f.$,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",title:e.read?"Mark as unread":"Mark as read",onClick:s=>C(s,e),children:e.read?(0,a.jsx)(h.A,{className:"h-3.5 w-3.5"}):(0,a.jsx)(d.A,{className:"h-3.5 w-3.5"})}),(0,a.jsx)(f.$,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:s=>{var t;return t=e.id,void(s.stopPropagation(),k(t))},children:(0,a.jsx)(c.A,{className:"h-3.5 w-3.5"})})]})]})},e.id))}),(0,a.jsx)(p.lG,{open:!!N,onOpenChange:()=>k(null),children:(0,a.jsxs)(p.Cf,{children:[(0,a.jsx)(p.c7,{children:(0,a.jsx)(p.L3,{children:"Delete Message"})}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Delete this message? This cannot be undone."}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(f.$,{variant:"outline",onClick:()=>k(null),children:"Cancel"}),(0,a.jsx)(f.$,{variant:"destructive",onClick:$,children:"Delete"})]})]})}),(0,a.jsx)(p.lG,{open:b,onOpenChange:()=>w(!1),children:(0,a.jsxs)(p.Cf,{children:[(0,a.jsx)(p.c7,{children:(0,a.jsx)(p.L3,{children:"Clear All Messages"})}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Delete all inbox messages? This cannot be undone."}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(f.$,{variant:"outline",onClick:()=>w(!1),children:"Cancel"}),(0,a.jsx)(f.$,{variant:"destructive",onClick:M,children:"Clear All"})]})]})})]})}},35484:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},46728:(e,s,t)=>{Promise.resolve().then(t.bind(t,34454))},74180:(e,s,t)=>{"use strict";t.d(s,{R:()=>r});var a=t(12115);function r(e){let s=(0,a.useRef)(null);return(0,a.useCallback)(t=>{if(s.current?.(),s.current=null,!t)return;let a=sessionStorage.getItem(e),r=null!==a?Number(a):NaN,n=Number.isFinite(r)&&r>0,i=0,l=0,c=()=>{n=!1,i&&cancelAnimationFrame(i),i=0,t.removeEventListener("wheel",c),t.removeEventListener("touchstart",c),t.removeEventListener("keydown",c)};if(n)if(t.scrollTop=r,2>Math.abs(t.scrollTop-r))n=!1;else{let e=0,s=()=>{if(n){if(t.scrollTop=r,e++,2>Math.abs(t.scrollTop-r)||e>120)return void c();i=requestAnimationFrame(s)}};t.addEventListener("wheel",c,{passive:!0}),t.addEventListener("touchstart",c,{passive:!0}),t.addEventListener("keydown",c),i=requestAnimationFrame(s)}let o=()=>{n||l||(l=requestAnimationFrame(()=>{l=0,sessionStorage.setItem(e,String(t.scrollTop))}))};t.addEventListener("scroll",o,{passive:!0}),s.current=()=>{let s=n;c(),l&&cancelAnimationFrame(l),t.removeEventListener("scroll",o),s||sessionStorage.setItem(e,String(t.scrollTop))}},[e])}},75796:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]])}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=46728)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[58179],{39071:(e,t,s)=>{Promise.resolve().then(s.bind(s,72814))},72814:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>S});var n=s(95155),l=s(9005),a=s(31966),i=s(2125),r=s(73321),o=s(12115),d=s(1550),c=s(41158),u=s(89239),m=s(81477),x=s(60529),h=s(8081);function p(e){return""===e?"":Number(e)}function f(e){return""!==e&&Number.isFinite(e)&&e>=1}var j=s(40980),y=s(84949);let v=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],g=["Read","Write","Edit","Bash","Bash git","Bash npm","Bash ls","Grep","Glob","Agent","WebFetch","WebSearch"],N={off:"Off",low:"Low",medium:"Medium",high:"High",xhigh:"XHigh",max:"Max"},b=(0,h.zQ)("sonnet")?.modelId||"",w="w-full rounded-md border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring";function k({checked:e,onChange:t}){return(0,n.jsx)("button",{type:"button",role:"switch","aria-checked":e,onClick:()=>t(!e),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ${e?"bg-primary":"bg-muted"}`,children:(0,n.jsx)("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-lg transition-transform ${e?"translate-x-4":"translate-x-0"}`})})}function C({value:e,onChange:t,onRemove:s,canRemove:a}){let i="simple"===e.type;return(0,n.jsxs)("div",{className:"border rounded-md p-3 space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(u.$,{variant:i?"default":"outline",size:"sm",onClick:()=>t({type:"simple",frequency:"daily",time:"09:00"}),children:"Simple"}),(0,n.jsx)(u.$,{variant:i?"outline":"default",size:"sm",onClick:()=>t({type:"cron",expression:"0 9 * * *"}),children:"Cron"})]}),a&&(0,n.jsx)("button",{type:"button",onClick:s,className:"text-muted-foreground hover:text-destructive",children:(0,n.jsx)(l.A,{className:"h-4 w-4"})})]}),i?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("select",{value:e.frequency,onChange:s=>t({...e,frequency:s.target.value}),className:w,children:[(0,n.jsx)("option",{value:"hourly",children:"Hourly"}),(0,n.jsx)("option",{value:"daily",children:"Daily"}),(0,n.jsx)("option",{value:"weekly",children:"Weekly"}),(0,n.jsx)("option",{value:"monthly",children:"Monthly"})]}),"hourly"!==e.frequency&&(0,n.jsx)(x.p,{type:"time",value:e.time||"09:00",onChange:s=>t({...e,time:s.target.value})}),"weekly"===e.frequency&&(0,n.jsx)("select",{value:e.dayOfWeek??1,onChange:s=>t({...e,dayOfWeek:Number(s.target.value)}),className:w,children:v.map((e,t)=>(0,n.jsx)("option",{value:t,children:e},e))}),"monthly"===e.frequency&&(0,n.jsx)(x.p,{type:"number",min:1,max:31,value:e.dayOfMonth??1,onChange:s=>t({...e,dayOfMonth:Number(s.target.value)}),placeholder:"Day of month"})]}):(0,n.jsx)(x.p,{value:e.expression,onChange:e=>t({type:"cron",expression:e.target.value}),placeholder:"0 9 * * 1-5",className:"font-mono"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:(0,y.Bg)(e)})]})}function S(){let e=(0,r.useParams)(),t=(0,r.useSearchParams)(),s=e.id,v="new"===s,S=v?t.get("from"):null,$=v?t.get("cwd"):null,M=(0,r.useRouter)();(0,d.si)(S?"Duplicate Job":v?"New Job":"Edit Job",{hideActions:!0});let[D,W]=(0,o.useState)(""),[E,A]=(0,o.useState)($||""),[T,z]=(0,o.useState)(""),[I,O]=(0,o.useState)(!0),[R,P]=(0,o.useState)([{type:"simple",frequency:"daily",time:"09:00"}]),[B,L]=(0,o.useState)(b),[Z,q]=(0,o.useState)("200k"),[J,U]=(0,o.useState)("medium"),[F,_]=(0,o.useState)("anthropic"),[H,K]=(0,o.useState)("stream"),[X,G]=(0,o.useState)(30),[Q,V]=(0,o.useState)(!1),[Y,ee]=(0,o.useState)([]),[et,es]=(0,o.useState)(""),[en,el]=(0,o.useState)([]),[ea,ei]=(0,o.useState)({}),[er,eo]=(0,o.useState)({}),[ed,ec]=(0,o.useState)(new Set),[eu,em]=(0,o.useState)({}),[ex,eh]=(0,o.useState)({}),[ep,ef]=(0,o.useState)([]),[ej,ey]=(0,o.useState)(!1),[ev,eg]=(0,o.useState)(90),[eN,eb]=(0,o.useState)(!1),[ew,ek]=(0,o.useState)([]),[eC,eS]=(0,o.useState)([]),[e$,eM]=(0,o.useState)([]),[eD,eW]=(0,o.useState)(!1),[eE,eA]=(0,o.useState)(!1),[eT,ez]=(0,o.useState)({}),[eI,eO]=(0,o.useState)(!v||!!S),eR="anthropic"===F,eP=e$.find(e=>e.id===F),eB=eR&&B?(0,h.bs)(B):null,eL=eB?.alias||null,eZ=eL?(0,h.r5)(eL):[],eq=eZ.length>1,eJ=!eR&&eP?eP.models.find(e=>e.modelId===B):null,eU=(0,o.useMemo)(()=>eR?eB?.contextSizes??["200k"]:eJ?.contextSizes??["200k"],[eR,eB,eJ]);(0,o.useEffect)(()=>{eU.includes(Z)||q(eU[0]??"200k")},[eU,Z]);let eF=(()=>{if(!eR&&eJ)return eJ.effortLevels;let e=B.replace(/\[.*\]$/,"");for(let t of e$){let s=t.models.find(t=>t.modelId===e);if(s&&s.effortLevels.length>0)return s.effortLevels}return eB?(0,h.iz)(eB):[]})(),e_=g.filter(e=>!Y.includes(e)),eH=e$.filter(e=>!e.isBuiltin);function eK(e){let t=(0,h.zQ)(e);t&&(_("anthropic"),L(t.modelId),q("200k"),U((0,h.Mi)(t)||""))}function eX(e){let t=e.trim();t&&!Y.includes(t)&&ee([...Y,t]),es("")}async function eG(e){if(eu[e]||ex[e])return;eh(t=>({...t,[e]:!0}));let t=new URLSearchParams;E&&t.set("cwd",E);try{let s=await fetch(`/api/mcp-servers/${encodeURIComponent(e)}/tools?${t}`);if(s.ok){let t=await s.json();t.tools&&em(s=>({...s,[e]:t.tools}))}}catch{}finally{eh(t=>({...t,[e]:!1}))}}function eQ(e,t){if(!t)return;let s=ea[e]||[];s.includes(t)||ei({...ea,[e]:[...s,t]})}let eV=(0,o.useCallback)((e,t)=>{W(t?`${e.name} (copy)`:e.name),A(e.cwd),z(e.prompt),O(e.enabled),P((0,y.KU)(e));let s=e.model||"",n=s.replace(/\[.*\]$/,""),l=n.indexOf(":");if(l>0)_(n.slice(0,l)),L(n.slice(l+1));else{_("anthropic");let e=(0,h.AX)(n);L(e?.modelId||b)}let a=/\[1m\]$/i.test(s);q(e.contextSize??(a?"1m":"200k"));let i=(0,h.AX)(n);U(e.thinkingLevel||(0,h.Mi)(i)||""),G(e.maxDurationMinutes??30),V(e.bypassPermissions??!1),ee(e.allowedTools||[]),el(e.mcpServers||[]),ei(e.mcpToolFilters||{}),ey(e.skipIfMissed??!1),eg(e.retentionDays??90),eb(e.inboxOutput??!1),ek(e.notifyProviders||[]),K(e.runtime||"stream")},[]),eY=(0,o.useCallback)(async()=>{let e=S||(v?null:s);if(e)try{let t=await fetch(`/api/jobs/${e}`);if(!t.ok)return void M.push("/jobs");let s=await t.json();eV(s.job,!!S)}finally{eO(!1)}},[s,v,S,M,eV]);async function e0(){let e=f(X),t=f(ev);if(ez({maxDuration:e?void 0:"Enter a duration of at least 1 minute.",retentionDays:t?void 0:"Enter a retention of at least 1 day."}),!e||!t)return;eA(!0);let n=B;!eR&&F&&(n=`${F}:${B}`);let l={name:D,cwd:E,prompt:T,enabled:I,schedule:R[0],schedules:R,model:n,contextSize:Z,thinkingLevel:J||void 0,maxDurationMinutes:X,bypassPermissions:Q,allowedTools:Y,mcpServers:en,mcpToolFilters:ea,skipIfMissed:ej,retentionDays:ev,inboxOutput:eN,notifyProviders:ew,runtime:H};try{let e=v?"/api/jobs":`/api/jobs/${s}`,t=v?"POST":"PUT",n=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(n.ok){let e=await n.json(),t=v?e.job.id:s;M.push(`/jobs/${t}`)}}finally{eA(!1)}}return((0,o.useEffect)(()=>{eY()},[eY]),(0,o.useEffect)(()=>{let e=E?`?cwd=${encodeURIComponent(E)}`:"";fetch(`/api/jobs/mcp-discover${e}`).then(e=>e.json()).then(e=>ef(e.servers)).catch(()=>ef([]))},[E]),(0,o.useEffect)(()=>{fetch("/api/notifications").then(e=>e.json()).then(e=>eS((e.providers||[]).filter(e=>e.enabled))).catch(()=>eS([]))},[]),(0,o.useEffect)(()=>{fetch("/api/providers").then(e=>e.json()).then(e=>{Array.isArray(e)&&eM(e)}).catch(()=>{})},[]),eI)?(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:(0,n.jsxs)("div",{className:"max-w-2xl mx-auto space-y-4 pb-8",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(u.$,{variant:"ghost",size:"icon",onClick:()=>M.push(v?"/jobs":`/jobs/${s}`),children:(0,n.jsx)(a.A,{className:"h-4 w-4"})}),(0,n.jsx)("h2",{className:"font-semibold",children:S?"Duplicate Job":v?"New Job":"Edit Job"})]}),(0,n.jsx)(m.Zp,{children:(0,n.jsxs)(m.Wu,{className:"pt-6 space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Enabled"}),!I&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Paused — this job will not run on its schedule."})]}),(0,n.jsx)(k,{checked:I,onChange:O})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Name"}),(0,n.jsx)(x.p,{value:D,onChange:e=>W(e.target.value),placeholder:"Weekly dependency update"})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Prompt"}),(0,n.jsx)("textarea",{value:T,onChange:e=>z(e.target.value),placeholder:"Check for outdated dependencies and create a PR updating them...",className:"w-full min-h-[120px] rounded-md border bg-background px-3 py-2 text-sm font-mono resize-y focus:outline-none focus:ring-2 focus:ring-ring"})]})]})}),(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{className:"pb-2",children:(0,n.jsx)(m.ZB,{className:"text-sm font-medium",children:"Working Directory"})}),(0,n.jsxs)(m.Wu,{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(x.p,{value:E,onChange:e=>A(e.target.value),placeholder:"Leave empty for scratchpad",className:"flex-1"}),(0,n.jsx)(u.$,{variant:"outline",size:"sm",onClick:()=>eW(!0),children:"Browse"})]}),!E&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"Uses ~/.cockpit/jobs as a temporary scratchpad directory"}),eD&&(0,n.jsx)("div",{className:"border rounded-md p-3",children:(0,n.jsx)(c.K,{onSelect:e=>{A(e),eW(!1)},onCancel:()=>eW(!1)})})]})]}),(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{className:"pb-2",children:(0,n.jsx)(m.ZB,{className:"text-sm font-medium",children:"Schedule"})}),(0,n.jsxs)(m.Wu,{className:"space-y-3",children:[R.map((e,t)=>(0,n.jsx)(C,{value:e,onChange:e=>P(R.map((s,n)=>n===t?e:s)),onRemove:()=>P(R.filter((e,s)=>s!==t)),canRemove:R.length>1},t)),(0,n.jsxs)("button",{type:"button",onClick:()=>P([...R,{type:"simple",frequency:"daily",time:"09:00"}]),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-primary transition-colors",children:[(0,n.jsx)(i.A,{className:"h-3 w-3"}),"Add schedule"]})]})]}),(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{className:"pb-2",children:(0,n.jsx)(m.ZB,{className:"text-sm font-medium",children:"Model"})}),(0,n.jsxs)(m.Wu,{className:"space-y-1",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 px-2 py-2 text-sm",children:[(0,n.jsx)("span",{children:"Provider"}),(0,n.jsxs)("select",{value:F,onChange:e=>{if("anthropic"===e.target.value)(0,h.bs)(B)?_("anthropic"):eK("sonnet");else{var t=e.target.value;_(t);let s=e$.find(e=>e.id===t);if(s&&s.models.length>0){let e=s.models[0];L(e.modelId),q("200k"),U(e.defaultEffort||(e.effortLevels.length>0?e.effortLevels[0]:""))}}},className:w,children:[(0,n.jsx)("option",{value:"anthropic",children:"Anthropic"}),eH.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),eR&&(0,n.jsxs)("div",{className:"flex items-center justify-between px-2 py-2 text-sm",children:[(0,n.jsx)("span",{children:"Model"}),(0,n.jsx)("div",{className:"flex gap-1 flex-wrap justify-end",children:["haiku","sonnet","opus","fable"].map(e=>(0,n.jsx)(u.$,{variant:eL===e?"default":"outline",size:"sm",onClick:()=>eK(e),children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),!eR&&eP&&(0,n.jsxs)("div",{className:"flex items-center justify-between px-2 py-2 text-sm",children:[(0,n.jsx)("span",{children:"Model"}),(0,n.jsx)("div",{className:"flex gap-1 flex-wrap justify-end",children:eP.models.map(e=>(0,n.jsx)(u.$,{variant:B===e.modelId?"default":"outline",size:"sm",onClick:()=>{L(e.modelId),q("200k"),U(e.defaultEffort||(e.effortLevels.length>0?e.effortLevels[0]:""))},children:e.displayName},e.modelId))})]}),eR&&eq&&(0,n.jsxs)("div",{className:"flex items-center justify-between px-2 py-2 text-sm",children:[(0,n.jsx)("span",{children:"Version"}),(0,n.jsx)("div",{className:"flex gap-1 flex-wrap justify-end",children:eZ.map(e=>(0,n.jsx)(u.$,{variant:eB?.version===e.version?"default":"outline",size:"sm",onClick:()=>(function(e){if(!eL)return;let t=(0,h.r5)(eL).find(t=>t.version===e);if(t){L(t.modelId);let e=(()=>{for(let e of e$){let s=e.models.find(e=>e.modelId===t.modelId);if(s)return s.effortLevels}return[]})(),s=e.length>0?e:(0,h.iz)(t);J&&!s.includes(J)&&U((0,h.Mi)(t)||"")}})(e.version),children:e.version},e.version))})]}),eU.length>=2&&(0,n.jsxs)("div",{className:"flex items-center justify-between px-2 py-2 text-sm",children:[(0,n.jsx)("span",{children:"Context"}),(0,n.jsx)("div",{className:"flex gap-1",children:eU.map(e=>(0,n.jsx)(u.$,{variant:Z===e?"default":"outline",size:"sm",onClick:()=>q(e),children:h.XR[e].label},e))})]}),eF.length>0&&(0,n.jsxs)("div",{className:"flex items-center justify-between px-2 py-2 text-sm",children:[(0,n.jsx)("span",{children:"Thinking"}),(0,n.jsx)("div",{className:"flex gap-1 flex-wrap justify-end",children:["off",...eF].map(e=>(0,n.jsx)(u.$,{variant:J===e?"default":"outline",size:"sm",onClick:()=>U(e),children:N[e]},e))})]})]})]}),(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{className:"pb-2",children:(0,n.jsx)(m.ZB,{className:"text-sm font-medium",children:"Permissions"})}),(0,n.jsxs)(m.Wu,{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Bypass Permissions"}),Q&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"All tool permissions will be auto-approved"})]}),(0,n.jsx)(k,{checked:Q,onChange:V})]}),!Q&&(0,n.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Allowed Tools"}),Y.length>0&&(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:Y.map(e=>(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-md bg-primary/10 text-primary font-mono",children:[e,(0,n.jsx)("button",{type:"button",onClick:()=>{ee(Y.filter(t=>t!==e))},className:"hover:text-destructive",children:(0,n.jsx)(l.A,{className:"h-3 w-3"})})]},e))}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(x.p,{value:et,onChange:e=>es(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),eX(et))},placeholder:"Type tool name and press Enter",className:"flex-1 font-mono"}),(0,n.jsx)(u.$,{variant:"outline",size:"sm",onClick:()=>eX(et),disabled:!et.trim(),children:"Add"})]}),e_.length>0&&(0,n.jsx)("div",{className:"flex flex-wrap gap-1",children:e_.map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>eX(e),className:"text-xs px-2 py-0.5 rounded border border-dashed border-muted-foreground/30 text-muted-foreground hover:border-primary hover:text-primary transition-colors",children:["+ ",e]},e))}),0===Y.length&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"No tools permitted. Add tools this job is allowed to use."})]})]})]}),(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{className:"pb-2",children:(0,n.jsx)(m.ZB,{className:"text-sm font-medium",children:"MCP Servers"})}),(0,n.jsxs)(m.Wu,{className:"space-y-2",children:[0===ep.length&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"No MCP servers found. Configure servers in Settings."}),ep.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:ep.map(e=>{let t=en.includes(e);return(0,n.jsx)("button",{type:"button",onClick:()=>{if(t){el(en.filter(t=>t!==e));let{[e]:t,...s}=ea;ei(s),ec(t=>{let s=new Set(t);return s.delete(e),s})}else el([...en,e])},className:`inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-md font-mono transition-colors ${t?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"}`,children:e},e)})}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:0===en.length?"No servers enabled. Select servers to activate.":`${en.length} enabled.`}),en.map(e=>{let t=ea[e]||[],s=ed.has(e),a=er[e]||"";return(0,n.jsxs)("div",{className:"border rounded-md p-2 space-y-2",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>{ec(t=>{let s=new Set(t);return s.has(e)?s.delete(e):(s.add(e),setTimeout(()=>eG(e),0)),s})},className:"w-full flex items-center justify-between text-xs text-muted-foreground hover:text-primary",children:[(0,n.jsx)("span",{className:"font-mono",children:e}),(0,n.jsx)("span",{children:0===t.length?"All tools":`${t.length} tool${1===t.length?"":"s"} filtered`})]}),s&&(0,n.jsxs)("div",{className:"space-y-2 pt-1",children:[t.length>0&&(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.map(s=>(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-md bg-primary/10 text-primary font-mono",children:[s,(0,n.jsx)("button",{type:"button",onClick:()=>{let n=t.filter(e=>e!==s);if(0===n.length){let{[e]:t,...s}=ea;ei(s)}else ei({...ea,[e]:n})},className:"hover:text-destructive",children:(0,n.jsx)(l.A,{className:"h-3 w-3"})})]},s))}),ex[e]?(0,n.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"Discovering tools..."}):eu[e]?.length>0?(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Discovered tools — click to add:"}),(0,n.jsx)("div",{className:"flex flex-wrap gap-1",children:eu[e].map(s=>{let l=t.includes(s);return(0,n.jsx)("button",{type:"button",disabled:l,onClick:()=>eQ(e,s),className:`inline-flex items-center text-xs px-2 py-0.5 rounded font-mono transition-colors ${l?"text-muted-foreground/40 line-through cursor-not-allowed":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:s},s)})})]}):null,(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(x.p,{value:a,onChange:t=>eo({...er,[e]:t.target.value}),onKeyDown:s=>{if("Enter"===s.key){s.preventDefault();let n=a.trim();n&&!t.includes(n)&&(eQ(e,n),eo({...er,[e]:""}))}},placeholder:"Tool name or server:tool",className:"flex-1 font-mono text-xs"}),(0,n.jsx)(u.$,{variant:"outline",size:"sm",onClick:()=>{let s=a.trim();s&&!t.includes(s)&&(eQ(e,s),eo({...er,[e]:""}))},disabled:!a.trim(),children:"Add"})]}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to allow all tools. For proxy servers, use server:tool format."})]})]},e)})]})]})]}),(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{className:"pb-2",children:(0,n.jsx)(m.ZB,{className:"text-sm font-medium",children:"Execution"})}),(0,n.jsxs)(m.Wu,{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Runtime"}),(0,n.jsxs)("div",{className:"flex gap-1",children:[(0,n.jsx)(u.$,{variant:"stream"===H?"default":"outline",size:"sm",onClick:()=>K("stream"),children:"Stream"}),(0,n.jsx)(u.$,{variant:"pty"===H?"default":"outline",size:"sm",onClick:()=>K("pty"),children:"PTY"})]})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Max Duration (minutes)"}),(0,n.jsx)(x.p,{type:"number",min:1,value:X,onChange:e=>G(p(e.target.value)),className:(0,j.cn)(eT.maxDuration&&"border-destructive")}),eT.maxDuration&&(0,n.jsx)("p",{className:"text-xs text-destructive",children:eT.maxDuration})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Retry missed runs"}),(0,n.jsx)(k,{checked:!ej,onChange:e=>ey(!e)})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Audit log retention (days)"}),(0,n.jsx)(x.p,{type:"number",min:1,value:ev,onChange:e=>eg(p(e.target.value)),className:(0,j.cn)(eT.retentionDays&&"border-destructive")}),eT.retentionDays&&(0,n.jsx)("p",{className:"text-xs text-destructive",children:eT.retentionDays})]})]})]}),(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{className:"pb-2",children:(0,n.jsx)(m.ZB,{className:"text-sm font-medium",children:"Output"})}),(0,n.jsxs)(m.Wu,{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Send to Inbox"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"The agent will format its final output as a structured message delivered to your Cockpit inbox."})]}),(0,n.jsx)(k,{checked:eN,onChange:eb})]}),eN&&eC.length>0&&(0,n.jsxs)("div",{className:"mt-4 pt-4 border-t",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"External notifications"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 mb-2",children:"Also send to these providers when a message is delivered."}),(0,n.jsx)("div",{className:"space-y-1.5",children:eC.map(e=>(0,n.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,n.jsx)("input",{type:"checkbox",checked:ew.includes(e.id),onChange:t=>ek(s=>t.target.checked?[...s,e.id]:s.filter(t=>t!==e.id)),className:"rounded border-input"}),(0,n.jsx)("span",{children:e.name}),(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",e.type,")"]})]},e.id))})]})]})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(u.$,{onClick:e0,disabled:eE||!D||!T,children:eE?"Saving...":"Save"}),(0,n.jsx)(u.$,{variant:"outline",onClick:()=>M.push(v?"/jobs":`/jobs/${s}`),children:"Cancel"})]})]})})}},84949:(e,t,s)=>{"use strict";function n(e,t,s){let n=[];for(let l of e.split(",")){let e=l.match(/^(.+)\/(\d+)$/),a=e?Number.parseInt(e[2],10):1,i=e?e[1]:l;if("*"===i)for(let e=t;e<=s;e+=a)n.push(e);else if(i.includes("-")){let[e,t]=i.split("-"),s=Number.parseInt(e,10),l=Number.parseInt(t,10);for(let e=s;e<=l;e+=a)n.push(e)}else n.push(Number.parseInt(i,10))}return n}function l(e){if("cron"===e.type)return`cron: ${e.expression}`;let t=e.time||"00:00";switch(e.frequency){case"hourly":return`Every hour at :${t.split(":")[1]||"00"}`;case"daily":return`Daily at ${t}`;case"weekly":return`Weekly on ${["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.dayOfWeek??0]} at ${t}`;case"monthly":return`Monthly on day ${e.dayOfMonth??1} at ${t}`}}function a(e){return e.schedules?.length?e.schedules:[e.schedule]}function i(e){return e.map(l).join("; ")}function r(e,t){let s=null;for(let l of e){let e=function(e,t){let s=function(e){let t=e.trim().split(/\s+/);if(5!==t.length)throw Error(`Invalid cron expression: expected 5 fields, got ${t.length}`);return{minute:n(t[0],0,59),hour:n(t[1],0,23),dayOfMonth:n(t[2],1,31),month:n(t[3],1,12),dayOfWeek:n(t[4],0,6),domWild:"*"===t[2],dowWild:"*"===t[4]}}("cron"===e.type?e.expression:function(e){let[t,s]=(e.time||"00:00").split(":").map(Number);switch(e.frequency){case"hourly":return`${s} * * * *`;case"daily":return`${s} ${t} * * *`;case"weekly":return`${s} ${t} * * ${e.dayOfWeek??0}`;case"monthly":return`${s} ${t} ${e.dayOfMonth??1} * *`}}(e)),l=new Date(t.getTime());l.setSeconds(0,0),l.setMinutes(l.getMinutes()+1);for(let e=0;e<525960;e++){if(s.minute.includes(l.getMinutes())&&s.hour.includes(l.getHours())&&s.dayOfMonth.includes(l.getDate())&&s.month.includes(l.getMonth()+1)&&s.dayOfWeek.includes(l.getDay()))return l;l.setMinutes(l.getMinutes()+1)}return new Date(t.getTime()+864e5)}(l,t);(!s||e.getTime()<s.getTime())&&(s=new Date(e.getTime()))}return s??new Date(t.getTime()+864e5)}s.d(t,{Bg:()=>l,JH:()=>i,KU:()=>a,ay:()=>r})}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=39071)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[39410],{2330:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>v});var n=t(95155),a=t(94088),r=t(12363),i=t(31966),l=t(18986),c=t(92571),o=t(36619),d=t(40852),u=t(65738),m=t(73321),h=t(12115),x=t(1550),p=t(45160),f=t(89239),j=t(81477),g=t(42763),N=t(67032),y=t(8081),w=t(84949);function $({prompt:e}){let[s,t]=(0,h.useState)(!1),i=e.split("\n"),l=i.length>8,c=l&&!s?i.slice(0,8).join("\n"):e;return(0,n.jsxs)(j.Zp,{children:[(0,n.jsx)(j.aR,{className:"pb-2",children:(0,n.jsx)(j.ZB,{className:"text-sm font-medium",children:"Prompt"})}),(0,n.jsxs)(j.Wu,{children:[(0,n.jsx)("pre",{className:"text-sm whitespace-pre-wrap break-all font-mono bg-muted rounded p-3",children:c}),l&&(0,n.jsxs)("button",{onClick:()=>t(!s),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground mt-2 transition-colors",children:[s?(0,n.jsx)(a.A,{className:"h-3 w-3"}):(0,n.jsx)(r.A,{className:"h-3 w-3"}),s?"Show less":`Show all ${i.length} lines`]})]})]})}let b="min-w-[5rem] justify-center";function v(){let e=(0,m.useParams)().id,s=(0,m.useRouter)(),[t,a]=(0,h.useState)(null),[r,v]=(0,h.useState)(!0),[k,M]=(0,h.useState)(!1),[S,E]=(0,h.useState)(!1),[C,D]=(0,h.useState)(!1);(0,x.si)(t?.name||"Job",{hideActions:!0});let{runs:T,loading:A,loadingMore:O,hasMore:W,refresh:L,loadMore:z}=(0,N.Jm)(e),P=(0,h.useCallback)(async()=>{try{let t=await fetch(`/api/jobs/${e}`);if(!t.ok)return void s.push("/jobs");let n=await t.json();a(n.job)}finally{v(!1)}},[e,s]);async function R(){M(!0),await fetch(`/api/jobs/${e}/trigger`,{method:"POST"}),M(!1),L()}async function _(){E(!0);try{(await fetch(`/api/jobs/${e}/stop`,{method:"POST"})).ok&&L()}finally{E(!1)}}async function F(){(await fetch(`/api/jobs/${e}`,{method:"DELETE"})).ok&&s.push("/jobs")}return((0,h.useEffect)(()=>{P()},[P]),r||!t)?(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:(0,n.jsxs)("div",{className:"max-w-2xl mx-auto space-y-4 pb-8",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(f.$,{variant:"ghost",size:"icon",onClick:()=>s.push("/jobs"),children:(0,n.jsx)(i.A,{className:"h-4 w-4"})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("h2",{className:"font-semibold truncate",children:t.name}),t.enabled?(0,n.jsx)(p.E,{variant:"default",children:"Enabled"}):(0,n.jsx)(p.E,{variant:"secondary",children:"Disabled"})]}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:(0,w.JH)((0,w.KU)(t))})]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsxs)(f.$,{variant:"outline",size:"sm",onClick:()=>s.push(`/jobs/${e}/edit`),children:[(0,n.jsx)(l.A,{className:"h-4 w-4 mr-1"}),"Edit"]}),(0,n.jsxs)(f.$,{variant:"outline",size:"sm",onClick:R,disabled:k,children:[k?(0,n.jsx)(c.A,{className:"h-4 w-4 mr-1 animate-spin"}):(0,n.jsx)(o.A,{className:"h-4 w-4 mr-1"}),"Run Now"]}),T.some(e=>"running"===e.status)&&(0,n.jsxs)(f.$,{variant:"outline",size:"sm",onClick:_,disabled:S,children:[S?(0,n.jsx)(c.A,{className:"h-4 w-4 mr-1 animate-spin"}):(0,n.jsx)(d.A,{className:"h-4 w-4 mr-1"}),"Stop"]}),(0,n.jsxs)(f.$,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>D(!0),children:[(0,n.jsx)(u.A,{className:"h-4 w-4 mr-1"}),"Delete"]})]}),(0,n.jsx)($,{prompt:t.prompt}),(0,n.jsx)(j.Zp,{children:(0,n.jsx)(j.Wu,{className:"pt-4",children:(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-y-2 text-sm",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Model"}),(0,n.jsx)("span",{className:"text-right",children:function(e){let s=e.model||"",t=/\[1m\]$/i.test(s)?" (1M)":"",n=s.replace(/\[.*\]$/,""),a=n.indexOf(":");if(a>0)return`${n.slice(a+1)}${t}`;let r=(0,y.bs)(n);if(!r)return s||"Default";let i=r.alias.charAt(0).toUpperCase()+r.alias.slice(1);return`${i} ${r.version}${t}`}(t)}),t.thinkingLevel&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Thinking"}),(0,n.jsx)("span",{className:"text-right capitalize",children:t.thinkingLevel})]}),(0,n.jsx)("span",{className:"text-muted-foreground",children:"Runtime"}),(0,n.jsx)("span",{className:"text-right uppercase",children:t.runtime||"stream"}),(0,n.jsx)("span",{className:"text-muted-foreground",children:"Max Duration"}),(0,n.jsxs)("span",{className:"text-right",children:[t.maxDurationMinutes??30," min"]}),t.cwd&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Directory"}),(0,n.jsx)("span",{className:"text-right font-mono text-xs truncate",children:t.cwd})]}),(0,n.jsx)("span",{className:"text-muted-foreground",children:"Permissions"}),(0,n.jsx)("span",{className:"text-right",children:t.bypassPermissions?"Bypass all":`${(t.allowedTools||[]).length} tools allowed`}),(t.mcpServers||[]).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"MCP Servers"}),(0,n.jsx)("span",{className:"text-right text-xs font-mono truncate",children:(t.mcpServers||[]).join(", ")})]})]})})}),(0,n.jsxs)(j.Zp,{children:[(0,n.jsx)(j.aR,{className:"pb-2",children:(0,n.jsx)(j.ZB,{className:"text-sm font-medium",children:"Run History"})}),(0,n.jsxs)(j.Wu,{children:[A&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading runs..."}),!A&&0===T.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No runs yet."}),(0,n.jsx)("div",{className:"space-y-1",children:T.map(t=>{let a;return(0,n.jsxs)("button",{type:"button",className:"w-full flex items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors text-left",onClick:()=>s.push(`/jobs/${e}/runs/${t.id}`),children:[function(e){switch(e){case"success":return(0,n.jsx)(p.E,{className:`${b} bg-green-600 text-white`,children:"Success"});case"failure":return(0,n.jsx)(p.E,{variant:"destructive",className:b,children:"Failed"});case"timeout":return(0,n.jsx)(p.E,{className:`${b} bg-yellow-600 text-white`,children:"Timeout"});case"running":return(0,n.jsx)(p.E,{className:`${b} bg-blue-600 text-white`,children:"Running"});case"stopped":return(0,n.jsx)(p.E,{variant:"secondary",className:b,children:"Stopped"});default:return(0,n.jsx)(p.E,{variant:"secondary",className:b,children:e})}}(t.status),(0,n.jsx)("span",{className:"text-xs text-muted-foreground flex-1",children:new Date(t.startedAt).toLocaleString()}),null!=t.durationMs&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:(a=Math.round(t.durationMs/1e3))<60?`${a}s`:`${Math.floor(a/60)}m ${a%60}s`})]},t.id)})}),W&&(0,n.jsx)(f.$,{variant:"ghost",size:"sm",className:"w-full mt-2",onClick:z,disabled:O,children:O?"Loading...":"Load more"})]})]}),(0,n.jsx)(g.lG,{open:C,onOpenChange:D,children:(0,n.jsxs)(g.Cf,{children:[(0,n.jsx)(g.c7,{children:(0,n.jsx)(g.L3,{children:"Delete Job"})}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Delete this job and all run history? This cannot be undone."}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(f.$,{variant:"outline",onClick:()=>D(!1),children:"Cancel"}),(0,n.jsx)(f.$,{variant:"destructive",onClick:F,children:"Delete"})]})]})})]})})}},83250:(e,s,t)=>{Promise.resolve().then(t.bind(t,2330))},84949:(e,s,t)=>{"use strict";function n(e,s,t){let n=[];for(let a of e.split(",")){let e=a.match(/^(.+)\/(\d+)$/),r=e?Number.parseInt(e[2],10):1,i=e?e[1]:a;if("*"===i)for(let e=s;e<=t;e+=r)n.push(e);else if(i.includes("-")){let[e,s]=i.split("-"),t=Number.parseInt(e,10),a=Number.parseInt(s,10);for(let e=t;e<=a;e+=r)n.push(e)}else n.push(Number.parseInt(i,10))}return n}function a(e){if("cron"===e.type)return`cron: ${e.expression}`;let s=e.time||"00:00";switch(e.frequency){case"hourly":return`Every hour at :${s.split(":")[1]||"00"}`;case"daily":return`Daily at ${s}`;case"weekly":return`Weekly on ${["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.dayOfWeek??0]} at ${s}`;case"monthly":return`Monthly on day ${e.dayOfMonth??1} at ${s}`}}function r(e){return e.schedules?.length?e.schedules:[e.schedule]}function i(e){return e.map(a).join("; ")}function l(e,s){let t=null;for(let a of e){let e=function(e,s){let t=function(e){let s=e.trim().split(/\s+/);if(5!==s.length)throw Error(`Invalid cron expression: expected 5 fields, got ${s.length}`);return{minute:n(s[0],0,59),hour:n(s[1],0,23),dayOfMonth:n(s[2],1,31),month:n(s[3],1,12),dayOfWeek:n(s[4],0,6),domWild:"*"===s[2],dowWild:"*"===s[4]}}("cron"===e.type?e.expression:function(e){let[s,t]=(e.time||"00:00").split(":").map(Number);switch(e.frequency){case"hourly":return`${t} * * * *`;case"daily":return`${t} ${s} * * *`;case"weekly":return`${t} ${s} * * ${e.dayOfWeek??0}`;case"monthly":return`${t} ${s} ${e.dayOfMonth??1} * *`}}(e)),a=new Date(s.getTime());a.setSeconds(0,0),a.setMinutes(a.getMinutes()+1);for(let e=0;e<525960;e++){if(t.minute.includes(a.getMinutes())&&t.hour.includes(a.getHours())&&t.dayOfMonth.includes(a.getDate())&&t.month.includes(a.getMonth()+1)&&t.dayOfWeek.includes(a.getDay()))return a;a.setMinutes(a.getMinutes()+1)}return new Date(s.getTime()+864e5)}(a,s);(!t||e.getTime()<t.getTime())&&(t=new Date(e.getTime()))}return t??new Date(s.getTime()+864e5)}t.d(s,{Bg:()=>a,JH:()=>i,KU:()=>r,ay:()=>l})},94088:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(99537).A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])}},e=>{e.O(0,[989,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[39410],{2330:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>v});var n=t(95155),a=t(94088),r=t(12363),i=t(31966),l=t(18986),c=t(92571),o=t(36619),d=t(40852),u=t(65738),m=t(73321),h=t(12115),x=t(1550),p=t(45160),f=t(89239),j=t(81477),g=t(42763),N=t(67032),y=t(8081),w=t(84949);function $({prompt:e}){let[s,t]=(0,h.useState)(!1),i=e.split("\n"),l=i.length>8,c=l&&!s?i.slice(0,8).join("\n"):e;return(0,n.jsxs)(j.Zp,{children:[(0,n.jsx)(j.aR,{className:"pb-2",children:(0,n.jsx)(j.ZB,{className:"text-sm font-medium",children:"Prompt"})}),(0,n.jsxs)(j.Wu,{children:[(0,n.jsx)("pre",{className:"text-sm whitespace-pre-wrap break-all font-mono bg-muted rounded p-3",children:c}),l&&(0,n.jsxs)("button",{onClick:()=>t(!s),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground mt-2 transition-colors",children:[s?(0,n.jsx)(a.A,{className:"h-3 w-3"}):(0,n.jsx)(r.A,{className:"h-3 w-3"}),s?"Show less":`Show all ${i.length} lines`]})]})]})}let b="min-w-[5rem] justify-center";function v(){let e=(0,m.useParams)().id,s=(0,m.useRouter)(),[t,a]=(0,h.useState)(null),[r,v]=(0,h.useState)(!0),[k,M]=(0,h.useState)(!1),[S,E]=(0,h.useState)(!1),[C,D]=(0,h.useState)(!1);(0,x.si)(t?.name||"Job",{hideActions:!0});let{runs:T,loading:A,loadingMore:O,hasMore:W,refresh:L,loadMore:z}=(0,N.Jm)(e),P=(0,h.useCallback)(async()=>{try{let t=await fetch(`/api/jobs/${e}`);if(!t.ok)return void s.push("/jobs");let n=await t.json();a(n.job)}finally{v(!1)}},[e,s]);async function R(){M(!0),await fetch(`/api/jobs/${e}/trigger`,{method:"POST"}),M(!1),L()}async function _(){E(!0);try{(await fetch(`/api/jobs/${e}/stop`,{method:"POST"})).ok&&L()}finally{E(!1)}}async function F(){(await fetch(`/api/jobs/${e}`,{method:"DELETE"})).ok&&s.push("/jobs")}return((0,h.useEffect)(()=>{P()},[P]),r||!t)?(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:(0,n.jsxs)("div",{className:"max-w-2xl mx-auto space-y-4 pb-8",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(f.$,{variant:"ghost",size:"icon",onClick:()=>s.push("/jobs"),children:(0,n.jsx)(i.A,{className:"h-4 w-4"})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("h2",{className:"font-semibold truncate",children:t.name}),t.enabled?(0,n.jsx)(p.E,{variant:"default",children:"Enabled"}):(0,n.jsx)(p.E,{variant:"secondary",children:"Disabled"})]}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:(0,w.JH)((0,w.KU)(t))})]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsxs)(f.$,{variant:"outline",size:"sm",onClick:()=>s.push(`/jobs/${e}/edit`),children:[(0,n.jsx)(l.A,{className:"h-4 w-4 mr-1"}),"Edit"]}),(0,n.jsxs)(f.$,{variant:"outline",size:"sm",onClick:R,disabled:k,children:[k?(0,n.jsx)(c.A,{className:"h-4 w-4 mr-1 animate-spin"}):(0,n.jsx)(o.A,{className:"h-4 w-4 mr-1"}),"Run Now"]}),T.some(e=>"running"===e.status)&&(0,n.jsxs)(f.$,{variant:"outline",size:"sm",onClick:_,disabled:S,children:[S?(0,n.jsx)(c.A,{className:"h-4 w-4 mr-1 animate-spin"}):(0,n.jsx)(d.A,{className:"h-4 w-4 mr-1"}),"Stop"]}),(0,n.jsxs)(f.$,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>D(!0),children:[(0,n.jsx)(u.A,{className:"h-4 w-4 mr-1"}),"Delete"]})]}),(0,n.jsx)($,{prompt:t.prompt}),(0,n.jsx)(j.Zp,{children:(0,n.jsx)(j.Wu,{className:"pt-4",children:(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-y-2 text-sm",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Model"}),(0,n.jsx)("span",{className:"text-right",children:function(e){let s=e.model||"",t=/\[1m\]$/i.test(s)?" (1M)":"",n=s.replace(/\[.*\]$/,""),a=n.indexOf(":");if(a>0)return`${n.slice(a+1)}${t}`;let r=(0,y.bs)(n);if(!r)return s||"Default";let i=r.alias.charAt(0).toUpperCase()+r.alias.slice(1);return`${i} ${r.version}${t}`}(t)}),t.thinkingLevel&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Thinking"}),(0,n.jsx)("span",{className:"text-right capitalize",children:t.thinkingLevel})]}),(0,n.jsx)("span",{className:"text-muted-foreground",children:"Runtime"}),(0,n.jsx)("span",{className:"text-right uppercase",children:t.runtime||"stream"}),(0,n.jsx)("span",{className:"text-muted-foreground",children:"Max Duration"}),(0,n.jsxs)("span",{className:"text-right",children:[t.maxDurationMinutes??30," min"]}),t.cwd&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Directory"}),(0,n.jsx)("span",{className:"text-right font-mono text-xs truncate",children:t.cwd})]}),(0,n.jsx)("span",{className:"text-muted-foreground",children:"Permissions"}),(0,n.jsx)("span",{className:"text-right",children:t.bypassPermissions?"Bypass all":`${(t.allowedTools||[]).length} tools allowed`}),(t.mcpServers||[]).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"MCP Servers"}),(0,n.jsx)("span",{className:"text-right text-xs font-mono truncate",children:(t.mcpServers||[]).join(", ")})]})]})})}),(0,n.jsxs)(j.Zp,{children:[(0,n.jsx)(j.aR,{className:"pb-2",children:(0,n.jsx)(j.ZB,{className:"text-sm font-medium",children:"Run History"})}),(0,n.jsxs)(j.Wu,{children:[A&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading runs..."}),!A&&0===T.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No runs yet."}),(0,n.jsx)("div",{className:"space-y-1",children:T.map(t=>{let a;return(0,n.jsxs)("button",{type:"button",className:"w-full flex items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors text-left",onClick:()=>s.push(`/jobs/${e}/runs/${t.id}`),children:[function(e){switch(e){case"success":return(0,n.jsx)(p.E,{className:`${b} bg-green-600 text-white`,children:"Success"});case"failure":return(0,n.jsx)(p.E,{variant:"destructive",className:b,children:"Failed"});case"timeout":return(0,n.jsx)(p.E,{className:`${b} bg-yellow-600 text-white`,children:"Timeout"});case"running":return(0,n.jsx)(p.E,{className:`${b} bg-blue-600 text-white`,children:"Running"});case"stopped":return(0,n.jsx)(p.E,{variant:"secondary",className:b,children:"Stopped"});default:return(0,n.jsx)(p.E,{variant:"secondary",className:b,children:e})}}(t.status),(0,n.jsx)("span",{className:"text-xs text-muted-foreground flex-1",children:new Date(t.startedAt).toLocaleString()}),null!=t.durationMs&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:(a=Math.round(t.durationMs/1e3))<60?`${a}s`:`${Math.floor(a/60)}m ${a%60}s`})]},t.id)})}),W&&(0,n.jsx)(f.$,{variant:"ghost",size:"sm",className:"w-full mt-2",onClick:z,disabled:O,children:O?"Loading...":"Load more"})]})]}),(0,n.jsx)(g.lG,{open:C,onOpenChange:D,children:(0,n.jsxs)(g.Cf,{children:[(0,n.jsx)(g.c7,{children:(0,n.jsx)(g.L3,{children:"Delete Job"})}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Delete this job and all run history? This cannot be undone."}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(f.$,{variant:"outline",onClick:()=>D(!1),children:"Cancel"}),(0,n.jsx)(f.$,{variant:"destructive",onClick:F,children:"Delete"})]})]})})]})})}},83250:(e,s,t)=>{Promise.resolve().then(t.bind(t,2330))},84949:(e,s,t)=>{"use strict";function n(e,s,t){let n=[];for(let a of e.split(",")){let e=a.match(/^(.+)\/(\d+)$/),r=e?Number.parseInt(e[2],10):1,i=e?e[1]:a;if("*"===i)for(let e=s;e<=t;e+=r)n.push(e);else if(i.includes("-")){let[e,s]=i.split("-"),t=Number.parseInt(e,10),a=Number.parseInt(s,10);for(let e=t;e<=a;e+=r)n.push(e)}else n.push(Number.parseInt(i,10))}return n}function a(e){if("cron"===e.type)return`cron: ${e.expression}`;let s=e.time||"00:00";switch(e.frequency){case"hourly":return`Every hour at :${s.split(":")[1]||"00"}`;case"daily":return`Daily at ${s}`;case"weekly":return`Weekly on ${["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.dayOfWeek??0]} at ${s}`;case"monthly":return`Monthly on day ${e.dayOfMonth??1} at ${s}`}}function r(e){return e.schedules?.length?e.schedules:[e.schedule]}function i(e){return e.map(a).join("; ")}function l(e,s){let t=null;for(let a of e){let e=function(e,s){let t=function(e){let s=e.trim().split(/\s+/);if(5!==s.length)throw Error(`Invalid cron expression: expected 5 fields, got ${s.length}`);return{minute:n(s[0],0,59),hour:n(s[1],0,23),dayOfMonth:n(s[2],1,31),month:n(s[3],1,12),dayOfWeek:n(s[4],0,6),domWild:"*"===s[2],dowWild:"*"===s[4]}}("cron"===e.type?e.expression:function(e){let[s,t]=(e.time||"00:00").split(":").map(Number);switch(e.frequency){case"hourly":return`${t} * * * *`;case"daily":return`${t} ${s} * * *`;case"weekly":return`${t} ${s} * * ${e.dayOfWeek??0}`;case"monthly":return`${t} ${s} ${e.dayOfMonth??1} * *`}}(e)),a=new Date(s.getTime());a.setSeconds(0,0),a.setMinutes(a.getMinutes()+1);for(let e=0;e<525960;e++){if(t.minute.includes(a.getMinutes())&&t.hour.includes(a.getHours())&&t.dayOfMonth.includes(a.getDate())&&t.month.includes(a.getMonth()+1)&&t.dayOfWeek.includes(a.getDay()))return a;a.setMinutes(a.getMinutes()+1)}return new Date(s.getTime()+864e5)}(a,s);(!t||e.getTime()<t.getTime())&&(t=new Date(e.getTime()))}return t??new Date(s.getTime()+864e5)}t.d(s,{Bg:()=>a,JH:()=>i,KU:()=>r,ay:()=>l})},94088:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(99537).A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=83250)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[15496],{46172:(e,s,t)=>{Promise.resolve().then(t.bind(t,60532))},60532:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>y});var n=t(95155),a=t(94088),r=t(12363),i=t(76721),l=t(9005),c=t(92571),d=t(31966),o=t(36483),u=t(25494),x=t(40852),m=t(73321),h=t(12115),p=t(1550),j=t(513),f=t(45160),N=t(89239),g=t(81477);function w({prompt:e}){let[s,t]=(0,h.useState)(!1),i=e.split("\n"),l=i.length>8,c=l&&!s?i.slice(0,8).join("\n"):e;return(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Prompt:"}),(0,n.jsx)("pre",{className:"mt-1 text-xs bg-muted rounded p-2 whitespace-pre-wrap",children:c}),l&&(0,n.jsxs)("button",{onClick:()=>t(!s),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground mt-1 transition-colors",children:[s?(0,n.jsx)(a.A,{className:"h-3 w-3"}):(0,n.jsx)(r.A,{className:"h-3 w-3"}),s?"Show less":`Show all ${i.length} lines`]})]})}function v({tool:e}){let[s,t]=(0,h.useState)(!1);return(0,n.jsxs)("div",{className:"border rounded-md",children:[(0,n.jsxs)("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-muted/50 transition-colors",onClick:()=>t(!s),children:[s?(0,n.jsx)(r.A,{className:"h-3 w-3 shrink-0"}):(0,n.jsx)(i.A,{className:"h-3 w-3 shrink-0"}),(0,n.jsx)("span",{className:"font-mono font-medium truncate min-w-0",children:e.name}),void 0!==e.permitted&&(0,n.jsx)(f.E,{variant:e.permitted?"secondary":"destructive",className:"text-[10px]",children:e.permitted?"Allowed":"Denied"}),null!=e.durationMs&&(0,n.jsxs)("span",{className:"text-xs text-muted-foreground ml-auto shrink-0",children:[e.durationMs,"ms"]})]}),s&&(0,n.jsxs)("div",{className:"border-t px-3 py-2 space-y-2",children:[e.input&&(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Input"}),(0,n.jsx)("pre",{className:"text-xs bg-muted rounded p-2 overflow-x-auto max-h-48 whitespace-pre-wrap",children:e.input})]}),e.output&&(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Output"}),(0,n.jsx)("pre",{className:"text-xs bg-muted rounded p-2 overflow-x-auto max-h-48 whitespace-pre-wrap",children:e.output})]})]})]})}function b({jobId:e,runId:s,onClose:t}){let[a,r]=(0,h.useState)([]),[i,d]=(0,h.useState)(!0),[o,u]=(0,h.useState)(null),x=(0,h.useRef)(new Set);(0,h.useEffect)(()=>{fetch(`/api/jobs/${e}/runs/${s}/transcript`).then(e=>{if(!e.ok)throw Error("Failed to load transcript");return e.json()}).then(e=>{r(e.messages),d(!1)}).catch(e=>{u(e.message),d(!1)})},[e,s]),(0,h.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),t())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]);let m=(0,h.useCallback)(e=>{e.target===e.currentTarget&&t()},[t]);return(0,n.jsx)("div",{className:"fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4",onClick:m,children:(0,n.jsxs)(g.Zp,{className:"w-full max-w-3xl flex flex-col",style:{maxHeight:"calc(100dvh - 2rem)"},children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b shrink-0",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Run transcript"}),(0,n.jsx)(N.$,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:t,children:(0,n.jsx)(l.A,{className:"h-4 w-4"})})]}),(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[i&&(0,n.jsx)("div",{className:"flex justify-center py-12",children:(0,n.jsx)(c.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),o&&(0,n.jsx)("div",{className:"text-center text-sm text-red-500 py-12",children:o}),!i&&0===a.length&&!o&&(0,n.jsx)("div",{className:"text-center text-sm text-muted-foreground py-12",children:"No transcript found for this run."}),!i&&a.map(e=>(0,n.jsx)("div",{children:(0,n.jsx)(j.s,{message:e,expandedToolIds:x})},e.id))]})]})})}function y(){let e=(0,m.useParams)(),s=e.id,t=e.runId,a=(0,m.useRouter)();(0,p.si)("Run Detail",{hideActions:!0});let[r,i]=(0,h.useState)(null),[l,j]=(0,h.useState)(!0),[y,k]=(0,h.useState)(!1),[S,A]=(0,h.useState)(!1),$=(0,h.useCallback)(async()=>{try{let e=await fetch(`/api/jobs/${s}/runs/${t}`);if(!e.ok)return void a.push(`/jobs/${s}`);let n=await e.json();i(n.run)}finally{j(!1)}},[s,t,a]);async function C(){A(!0);try{(await fetch(`/api/jobs/${s}/stop`,{method:"POST"})).ok&&await $(),A(!1)}catch{A(!1)}}return((0,h.useEffect)(()=>{$()},[$]),l||!r)?(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsx)("div",{className:"flex items-center gap-2",children:(0,n.jsx)(N.$,{variant:"ghost",size:"icon",onClick:()=>a.push(`/jobs/${s}`),children:(0,n.jsx)(d.A,{className:"h-4 w-4"})})}),(0,n.jsxs)(g.Zp,{children:[(0,n.jsx)(g.aR,{children:(0,n.jsxs)(g.ZB,{className:"text-base flex items-center gap-2",children:["Run Summary",function(e){switch(e){case"success":return(0,n.jsx)(f.E,{className:"bg-green-600 text-white",children:"Success"});case"failure":return(0,n.jsx)(f.E,{variant:"destructive",children:"Failed"});case"timeout":return(0,n.jsx)(f.E,{className:"bg-yellow-600 text-white",children:"Timeout"});case"running":return(0,n.jsx)(f.E,{className:"bg-blue-600 text-white",children:"Running"});case"stopped":return(0,n.jsx)(f.E,{variant:"secondary",children:"Stopped"});default:return(0,n.jsx)(f.E,{variant:"secondary",children:e})}}(r.status)]})}),(0,n.jsxs)(g.Wu,{className:"space-y-2 text-sm",children:[(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Started:"})," ",new Date(r.startedAt).toLocaleString()]}),r.completedAt&&(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Completed:"})," ",new Date(r.completedAt).toLocaleString()]}),null!=r.durationMs&&(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Duration:"})," ",Math.round(r.durationMs/1e3),"s"]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Messages:"})," ",r.messageCount]})]}),r.error&&(0,n.jsx)("div",{className:"mt-2 p-2 rounded bg-destructive/10 text-destructive text-xs",children:r.error}),(0,n.jsx)(w,{prompt:r.prompt}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Working Directory:"})," ",(0,n.jsx)("span",{className:"font-mono text-xs break-all",children:r.cwd})]}),(0,n.jsxs)("div",{className:"pt-2 flex flex-wrap gap-2",children:[(0,n.jsxs)(N.$,{variant:"outline",size:"sm",onClick:()=>k(!0),children:[(0,n.jsx)(o.A,{className:"h-3 w-3 mr-1"}),"View Transcript"]}),(0,n.jsxs)(N.$,{variant:"outline",size:"sm",onClick:()=>a.push(`/sessions/${r.sessionId}?cwd=${encodeURIComponent(r.cwd)}`),children:[(0,n.jsx)(u.A,{className:"h-3 w-3 mr-1"}),"Continue Session"]}),"running"===r.status&&(0,n.jsxs)(N.$,{variant:"destructive",size:"sm",onClick:C,disabled:S,children:[S?(0,n.jsx)(c.A,{className:"h-3 w-3 mr-1 animate-spin"}):(0,n.jsx)(x.A,{className:"h-3 w-3 mr-1"}),"Stop Now"]})]})]})]}),(0,n.jsxs)(g.Zp,{children:[(0,n.jsx)(g.aR,{children:(0,n.jsxs)(g.ZB,{className:"text-base",children:["Tool Usage (",r.toolsUsed.length,")"]})}),(0,n.jsxs)(g.Wu,{children:[0===r.toolsUsed.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No tool invocations recorded."}),(0,n.jsx)("div",{className:"space-y-1",children:r.toolsUsed.map((e,s)=>(0,n.jsx)(v,{tool:e},`${e.name}-${e.timestamp}-${s}`))})]})]}),y&&(0,n.jsx)(b,{jobId:s,runId:t,onClose:()=>k(!1)})]})}},94088:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(99537).A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])}},e=>{e.O(0,[989,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[15496],{46172:(e,s,t)=>{Promise.resolve().then(t.bind(t,60532))},60532:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>y});var n=t(95155),a=t(94088),r=t(12363),i=t(76721),l=t(9005),c=t(92571),d=t(31966),o=t(36483),u=t(25494),x=t(40852),m=t(73321),h=t(12115),p=t(1550),j=t(513),f=t(45160),N=t(89239),g=t(81477);function w({prompt:e}){let[s,t]=(0,h.useState)(!1),i=e.split("\n"),l=i.length>8,c=l&&!s?i.slice(0,8).join("\n"):e;return(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Prompt:"}),(0,n.jsx)("pre",{className:"mt-1 text-xs bg-muted rounded p-2 whitespace-pre-wrap",children:c}),l&&(0,n.jsxs)("button",{onClick:()=>t(!s),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground mt-1 transition-colors",children:[s?(0,n.jsx)(a.A,{className:"h-3 w-3"}):(0,n.jsx)(r.A,{className:"h-3 w-3"}),s?"Show less":`Show all ${i.length} lines`]})]})}function v({tool:e}){let[s,t]=(0,h.useState)(!1);return(0,n.jsxs)("div",{className:"border rounded-md",children:[(0,n.jsxs)("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-muted/50 transition-colors",onClick:()=>t(!s),children:[s?(0,n.jsx)(r.A,{className:"h-3 w-3 shrink-0"}):(0,n.jsx)(i.A,{className:"h-3 w-3 shrink-0"}),(0,n.jsx)("span",{className:"font-mono font-medium truncate min-w-0",children:e.name}),void 0!==e.permitted&&(0,n.jsx)(f.E,{variant:e.permitted?"secondary":"destructive",className:"text-[10px]",children:e.permitted?"Allowed":"Denied"}),null!=e.durationMs&&(0,n.jsxs)("span",{className:"text-xs text-muted-foreground ml-auto shrink-0",children:[e.durationMs,"ms"]})]}),s&&(0,n.jsxs)("div",{className:"border-t px-3 py-2 space-y-2",children:[e.input&&(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Input"}),(0,n.jsx)("pre",{className:"text-xs bg-muted rounded p-2 overflow-x-auto max-h-48 whitespace-pre-wrap",children:e.input})]}),e.output&&(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Output"}),(0,n.jsx)("pre",{className:"text-xs bg-muted rounded p-2 overflow-x-auto max-h-48 whitespace-pre-wrap",children:e.output})]})]})]})}function b({jobId:e,runId:s,onClose:t}){let[a,r]=(0,h.useState)([]),[i,d]=(0,h.useState)(!0),[o,u]=(0,h.useState)(null),x=(0,h.useRef)(new Set);(0,h.useEffect)(()=>{fetch(`/api/jobs/${e}/runs/${s}/transcript`).then(e=>{if(!e.ok)throw Error("Failed to load transcript");return e.json()}).then(e=>{r(e.messages),d(!1)}).catch(e=>{u(e.message),d(!1)})},[e,s]),(0,h.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),t())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]);let m=(0,h.useCallback)(e=>{e.target===e.currentTarget&&t()},[t]);return(0,n.jsx)("div",{className:"fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4",onClick:m,children:(0,n.jsxs)(g.Zp,{className:"w-full max-w-3xl flex flex-col",style:{maxHeight:"calc(100dvh - 2rem)"},children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b shrink-0",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Run transcript"}),(0,n.jsx)(N.$,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:t,children:(0,n.jsx)(l.A,{className:"h-4 w-4"})})]}),(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[i&&(0,n.jsx)("div",{className:"flex justify-center py-12",children:(0,n.jsx)(c.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),o&&(0,n.jsx)("div",{className:"text-center text-sm text-red-500 py-12",children:o}),!i&&0===a.length&&!o&&(0,n.jsx)("div",{className:"text-center text-sm text-muted-foreground py-12",children:"No transcript found for this run."}),!i&&a.map(e=>(0,n.jsx)("div",{children:(0,n.jsx)(j.s,{message:e,expandedToolIds:x})},e.id))]})]})})}function y(){let e=(0,m.useParams)(),s=e.id,t=e.runId,a=(0,m.useRouter)();(0,p.si)("Run Detail",{hideActions:!0});let[r,i]=(0,h.useState)(null),[l,j]=(0,h.useState)(!0),[y,k]=(0,h.useState)(!1),[S,A]=(0,h.useState)(!1),$=(0,h.useCallback)(async()=>{try{let e=await fetch(`/api/jobs/${s}/runs/${t}`);if(!e.ok)return void a.push(`/jobs/${s}`);let n=await e.json();i(n.run)}finally{j(!1)}},[s,t,a]);async function C(){A(!0);try{(await fetch(`/api/jobs/${s}/stop`,{method:"POST"})).ok&&await $(),A(!1)}catch{A(!1)}}return((0,h.useEffect)(()=>{$()},[$]),l||!r)?(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsx)("div",{className:"flex items-center gap-2",children:(0,n.jsx)(N.$,{variant:"ghost",size:"icon",onClick:()=>a.push(`/jobs/${s}`),children:(0,n.jsx)(d.A,{className:"h-4 w-4"})})}),(0,n.jsxs)(g.Zp,{children:[(0,n.jsx)(g.aR,{children:(0,n.jsxs)(g.ZB,{className:"text-base flex items-center gap-2",children:["Run Summary",function(e){switch(e){case"success":return(0,n.jsx)(f.E,{className:"bg-green-600 text-white",children:"Success"});case"failure":return(0,n.jsx)(f.E,{variant:"destructive",children:"Failed"});case"timeout":return(0,n.jsx)(f.E,{className:"bg-yellow-600 text-white",children:"Timeout"});case"running":return(0,n.jsx)(f.E,{className:"bg-blue-600 text-white",children:"Running"});case"stopped":return(0,n.jsx)(f.E,{variant:"secondary",children:"Stopped"});default:return(0,n.jsx)(f.E,{variant:"secondary",children:e})}}(r.status)]})}),(0,n.jsxs)(g.Wu,{className:"space-y-2 text-sm",children:[(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Started:"})," ",new Date(r.startedAt).toLocaleString()]}),r.completedAt&&(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Completed:"})," ",new Date(r.completedAt).toLocaleString()]}),null!=r.durationMs&&(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Duration:"})," ",Math.round(r.durationMs/1e3),"s"]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Messages:"})," ",r.messageCount]})]}),r.error&&(0,n.jsx)("div",{className:"mt-2 p-2 rounded bg-destructive/10 text-destructive text-xs",children:r.error}),(0,n.jsx)(w,{prompt:r.prompt}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Working Directory:"})," ",(0,n.jsx)("span",{className:"font-mono text-xs break-all",children:r.cwd})]}),(0,n.jsxs)("div",{className:"pt-2 flex flex-wrap gap-2",children:[(0,n.jsxs)(N.$,{variant:"outline",size:"sm",onClick:()=>k(!0),children:[(0,n.jsx)(o.A,{className:"h-3 w-3 mr-1"}),"View Transcript"]}),(0,n.jsxs)(N.$,{variant:"outline",size:"sm",onClick:()=>a.push(`/sessions/${r.sessionId}?cwd=${encodeURIComponent(r.cwd)}`),children:[(0,n.jsx)(u.A,{className:"h-3 w-3 mr-1"}),"Continue Session"]}),"running"===r.status&&(0,n.jsxs)(N.$,{variant:"destructive",size:"sm",onClick:C,disabled:S,children:[S?(0,n.jsx)(c.A,{className:"h-3 w-3 mr-1 animate-spin"}):(0,n.jsx)(x.A,{className:"h-3 w-3 mr-1"}),"Stop Now"]})]})]})]}),(0,n.jsxs)(g.Zp,{children:[(0,n.jsx)(g.aR,{children:(0,n.jsxs)(g.ZB,{className:"text-base",children:["Tool Usage (",r.toolsUsed.length,")"]})}),(0,n.jsxs)(g.Wu,{children:[0===r.toolsUsed.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No tool invocations recorded."}),(0,n.jsx)("div",{className:"space-y-1",children:r.toolsUsed.map((e,s)=>(0,n.jsx)(v,{tool:e},`${e.name}-${e.timestamp}-${s}`))})]})]}),y&&(0,n.jsx)(b,{jobId:s,runId:t,onClose:()=>k(!1)})]})}},94088:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(99537).A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=46172)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[17288],{22048:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>C});var n=s(95155),a=s(35484),r=s(64962),l=s(92571),i=s(40852),o=s(36619),c=s(99314),u=s(65738),d=s(76721),m=s(14225),h=s(2125),p=s(77618),x=s(73321),f=s(12115),g=s(1550),j=s(45160),N=s(89239),b=s(81477),w=s(42763),y=s(67032),v=s(74180),S=s(84949);function k(e){if(!e.lastRunAt)return null;let t=function(e){let t=Math.floor((Date.now()-e)/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let n=Math.floor(s/24);return`${n}d ago`}(e.lastRunAt);return"failure"===e.lastRunStatus||"timeout"===e.lastRunStatus?(0,n.jsxs)("span",{className:"flex items-center gap-1 text-destructive",children:[(0,n.jsx)(a.A,{className:"h-3 w-3"}),"Failed ",t]}):"success"===e.lastRunStatus?(0,n.jsxs)("span",{className:"flex items-center gap-1 text-green-500",children:[(0,n.jsx)(r.A,{className:"h-3 w-3"}),"Succeeded ",t]}):"stopped"===e.lastRunStatus?(0,n.jsxs)("span",{className:"flex items-center gap-1 text-muted-foreground",children:["Stopped ",t]}):null}function $({job:e,triggeringJobs:t,stoppingJobs:s,onTrigger:a,onStop:r,onDuplicate:d,onDelete:m,onClick:h}){let p=t.has(e.id)||"running"===e.lastRunStatus?"running":e.enabled?"failure"===e.lastRunStatus||"timeout"===e.lastRunStatus?"failed":"stopped"===e.lastRunStatus?"stopped":"enabled":"disabled";return(0,n.jsx)(b.Zp,{className:"cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>h(e.id),children:(0,n.jsxs)(b.Wu,{className:"p-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,n.jsx)("span",{className:"font-medium text-sm truncate flex-1 min-w-0",children:e.name}),"running"===p?(0,n.jsx)(j.E,{variant:"default",children:"Running"}):"disabled"===p?(0,n.jsx)(j.E,{variant:"secondary",children:"Disabled"}):"failed"===p?(0,n.jsx)(j.E,{variant:"destructive",children:"Failed"}):"stopped"===p?(0,n.jsx)(j.E,{variant:"secondary",children:"Stopped"}):(0,n.jsx)(j.E,{variant:"default",children:"Enabled"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:(0,S.JH)((0,S.KU)(e))}),(0,n.jsxs)("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Next: ",function(e){if(!e.enabled)return"Disabled";try{return(0,S.ay)((0,S.KU)(e),new Date).toLocaleString()}catch{return"Unknown"}}(e)]}),"running"===p?(0,n.jsx)("p",{className:"text-xs mt-0.5",children:(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(l.A,{className:"h-3 w-3 animate-spin"}),"Running"]})}):k(e)&&(0,n.jsx)("p",{className:"text-xs mt-0.5",children:k(e)})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:["running"===p&&r&&(0,n.jsx)(N.$,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Stop now",disabled:s?.has(e.id),onClick:t=>r(t,e.id),children:s?.has(e.id)?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):(0,n.jsx)(i.A,{className:"h-4 w-4"})}),(0,n.jsx)(N.$,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Run now",disabled:t.has(e.id),onClick:t=>a(t,e.id),children:t.has(e.id)?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):(0,n.jsx)(o.A,{className:"h-4 w-4"})}),(0,n.jsx)(N.$,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Duplicate",onClick:t=>d(t,e.id),children:(0,n.jsx)(c.A,{className:"h-4 w-4"})}),(0,n.jsx)(N.$,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",title:"Delete",onClick:t=>m(t,e.id),children:(0,n.jsx)(u.A,{className:"h-4 w-4"})})]})]})]})})}function A({group:e,triggeringJobs:t,stoppingJobs:s,onTrigger:a,onStop:r,onDuplicate:l,onDelete:i,onClickJob:o,onCreateJob:c,defaultExpanded:u}){let[p,x]=(0,f.useState)(u),g=e.jobs.filter(e=>"failure"===e.lastRunStatus||"timeout"===e.lastRunStatus).length;return(0,n.jsxs)("div",{className:"rounded-lg border bg-card",children:[(0,n.jsxs)("div",{role:"button",onClick:()=>x(!p),className:"w-full flex items-center gap-2 p-3 text-left hover:bg-accent/50 rounded-lg transition-colors cursor-pointer",children:[(0,n.jsx)(d.A,{className:`h-4 w-4 shrink-0 text-muted-foreground transition-transform ${p?"rotate-90":""}`}),(0,n.jsx)(m.A,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,n.jsx)("span",{className:"font-medium text-sm truncate flex-1",children:e.dirName}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[g>0&&(0,n.jsxs)(j.E,{variant:"destructive",children:[g," failed"]}),(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.jobs.length," job",1!==e.jobs.length?"s":""]}),(0,n.jsx)("button",{onClick:t=>{t.stopPropagation(),c(e.cwd)},className:"p-1 rounded hover:bg-accent",title:"New job in this folder",children:(0,n.jsx)(h.A,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]}),p&&(0,n.jsx)("div",{className:"px-3 pb-3 space-y-2",children:e.jobs.map(e=>(0,n.jsx)($,{job:e,triggeringJobs:t,stoppingJobs:s,onTrigger:a,onStop:r,onDuplicate:l,onDelete:i,onClick:o},e.id))})]})}function C(){(0,g.si)("Scheduled Jobs",{hideActions:!0});let e=(0,v.R)("jobs-scroll"),{jobs:t,loading:s,deleteJob:a,triggerJob:r,stopJob:l,refresh:i}=(0,y.Os)(),o=(0,x.useRouter)(),[c,u]=(0,f.useState)(null),[d,m]=(0,f.useState)(new Set),[j,b]=(0,f.useState)(new Set),S=(0,f.useMemo)(()=>(function(e){let t=new Map;for(let s of e){let e=s.cwd||"",n=t.get(e)||[];n.push(s),t.set(e,n)}let s=[];for(let[e,n]of t)s.push({cwd:e,dirName:function(e){if(!e)return"Scratchpad";let t=e.replace(/\/+$/,"").split("/");return t[t.length-1]||e}(e),jobs:n});return s.sort((e,t)=>e.cwd?t.cwd?e.dirName.localeCompare(t.dirName):1:-1),s})(t),[t]);async function k(){c&&(await a(c),u(null))}async function C(e,t){e.stopPropagation(),m(e=>new Set(e).add(t)),await r(t),m(e=>{let s=new Set(e);return s.delete(t),s}),i()}async function D(e,t){e.stopPropagation(),b(e=>new Set(e).add(t)),m(e=>{let s=new Set(e);return s.delete(t),s}),await l(t),b(e=>{let s=new Set(e);return s.delete(t),s}),i()}function E(e,t){e.stopPropagation(),o.push(`/jobs/new/edit?from=${t}`)}function R(e,t){e.stopPropagation(),u(t)}return(0,n.jsxs)("div",{ref:e,className:"flex-1 min-h-0 overflow-y-auto p-4 pb-24 space-y-4",children:[s&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading jobs..."}),!s&&0===t.length&&(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,n.jsx)(p.A,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No scheduled jobs yet."}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Create one to run Claude on a schedule."})]}),(0,n.jsx)("div",{className:"space-y-2",children:1===S.length?S[0].jobs.map(e=>(0,n.jsx)($,{job:e,triggeringJobs:d,stoppingJobs:j,onTrigger:C,onStop:D,onDuplicate:E,onDelete:R,onClick:e=>o.push(`/jobs/${e}`)},e.id)):S.map(e=>(0,n.jsx)(A,{group:e,triggeringJobs:d,stoppingJobs:j,onTrigger:C,onStop:D,onDuplicate:E,onDelete:R,onClickJob:e=>o.push(`/jobs/${e}`),onCreateJob:e=>o.push(`/jobs/new/edit?cwd=${encodeURIComponent(e)}`),defaultExpanded:S.length<=3},e.cwd))}),(0,n.jsx)("div",{className:"fixed bottom-6 right-6",children:(0,n.jsxs)(N.$,{size:"lg",className:"rounded-full shadow-lg",onClick:()=>o.push("/jobs/new/edit"),children:[(0,n.jsx)(h.A,{className:"h-5 w-5 mr-1"}),"New Job"]})}),(0,n.jsx)(w.lG,{open:!!c,onOpenChange:()=>u(null),children:(0,n.jsxs)(w.Cf,{children:[(0,n.jsx)(w.c7,{children:(0,n.jsx)(w.L3,{children:"Delete Job"})}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Delete this job and all its run history? This cannot be undone."}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(N.$,{variant:"outline",onClick:()=>u(null),children:"Cancel"}),(0,n.jsx)(N.$,{variant:"destructive",onClick:k,children:"Delete"})]})]})})]})}},35484:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(99537).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},61112:(e,t,s)=>{Promise.resolve().then(s.bind(s,22048))},74180:(e,t,s)=>{"use strict";s.d(t,{R:()=>a});var n=s(12115);function a(e){let t=(0,n.useRef)(null);return(0,n.useCallback)(s=>{if(t.current?.(),t.current=null,!s)return;let n=sessionStorage.getItem(e),a=null!==n?Number(n):NaN,r=Number.isFinite(a)&&a>0,l=0,i=0,o=()=>{r=!1,l&&cancelAnimationFrame(l),l=0,s.removeEventListener("wheel",o),s.removeEventListener("touchstart",o),s.removeEventListener("keydown",o)};if(r)if(s.scrollTop=a,2>Math.abs(s.scrollTop-a))r=!1;else{let e=0,t=()=>{if(r){if(s.scrollTop=a,e++,2>Math.abs(s.scrollTop-a)||e>120)return void o();l=requestAnimationFrame(t)}};s.addEventListener("wheel",o,{passive:!0}),s.addEventListener("touchstart",o,{passive:!0}),s.addEventListener("keydown",o),l=requestAnimationFrame(t)}let c=()=>{r||i||(i=requestAnimationFrame(()=>{i=0,sessionStorage.setItem(e,String(s.scrollTop))}))};s.addEventListener("scroll",c,{passive:!0}),t.current=()=>{let t=r;o(),i&&cancelAnimationFrame(i),s.removeEventListener("scroll",c),t||sessionStorage.setItem(e,String(s.scrollTop))}},[e])}},84949:(e,t,s)=>{"use strict";function n(e,t,s){let n=[];for(let a of e.split(",")){let e=a.match(/^(.+)\/(\d+)$/),r=e?Number.parseInt(e[2],10):1,l=e?e[1]:a;if("*"===l)for(let e=t;e<=s;e+=r)n.push(e);else if(l.includes("-")){let[e,t]=l.split("-"),s=Number.parseInt(e,10),a=Number.parseInt(t,10);for(let e=s;e<=a;e+=r)n.push(e)}else n.push(Number.parseInt(l,10))}return n}function a(e){if("cron"===e.type)return`cron: ${e.expression}`;let t=e.time||"00:00";switch(e.frequency){case"hourly":return`Every hour at :${t.split(":")[1]||"00"}`;case"daily":return`Daily at ${t}`;case"weekly":return`Weekly on ${["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.dayOfWeek??0]} at ${t}`;case"monthly":return`Monthly on day ${e.dayOfMonth??1} at ${t}`}}function r(e){return e.schedules?.length?e.schedules:[e.schedule]}function l(e){return e.map(a).join("; ")}function i(e,t){let s=null;for(let a of e){let e=function(e,t){let s=function(e){let t=e.trim().split(/\s+/);if(5!==t.length)throw Error(`Invalid cron expression: expected 5 fields, got ${t.length}`);return{minute:n(t[0],0,59),hour:n(t[1],0,23),dayOfMonth:n(t[2],1,31),month:n(t[3],1,12),dayOfWeek:n(t[4],0,6),domWild:"*"===t[2],dowWild:"*"===t[4]}}("cron"===e.type?e.expression:function(e){let[t,s]=(e.time||"00:00").split(":").map(Number);switch(e.frequency){case"hourly":return`${s} * * * *`;case"daily":return`${s} ${t} * * *`;case"weekly":return`${s} ${t} * * ${e.dayOfWeek??0}`;case"monthly":return`${s} ${t} ${e.dayOfMonth??1} * *`}}(e)),a=new Date(t.getTime());a.setSeconds(0,0),a.setMinutes(a.getMinutes()+1);for(let e=0;e<525960;e++){if(s.minute.includes(a.getMinutes())&&s.hour.includes(a.getHours())&&s.dayOfMonth.includes(a.getDate())&&s.month.includes(a.getMonth()+1)&&s.dayOfWeek.includes(a.getDay()))return a;a.setMinutes(a.getMinutes()+1)}return new Date(t.getTime()+864e5)}(a,t);(!s||e.getTime()<s.getTime())&&(s=new Date(e.getTime()))}return s??new Date(t.getTime()+864e5)}s.d(t,{Bg:()=>a,JH:()=>l,KU:()=>r,ay:()=>i})}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=61112)),_N_E=e.O()}]);
|
package/.next/static/chunks/app/(app)/{layout-3cd80708648e0723.js → layout-62bd7715bd974abb.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4944],{9276:(e,s,n)=>{"use strict";n.r(s),n.d(s,{default:()=>t});var r=n(95155),u=n(1550);function t({children:e}){return(0,r.jsx)(u.GV,{children:e})}},69154:(e,s,n)=>{Promise.resolve().then(n.bind(n,9276))}},e=>{e.O(0,[989,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4944],{9276:(e,s,n)=>{"use strict";n.r(s),n.d(s,{default:()=>t});var r=n(95155),u=n(1550);function t({children:e}){return(0,r.jsx)(u.GV,{children:e})}},69154:(e,s,n)=>{Promise.resolve().then(n.bind(n,9276))}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=69154)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[80227],{10833:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>g});var a=s(95155),n=s(81402),l=s(73321),r=s(12115),o=s(1550),i=s(9005),d=s(2125),c=s(89239),m=s(60529);function u({value:e,onChange:t,keyPlaceholder:s="Key",valuePlaceholder:n="Value"}){let l=Object.entries(e);return(0,a.jsxs)("div",{className:"space-y-2",children:[l.map(([r,o],d)=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(m.p,{className:"flex-1 font-mono text-xs h-8",placeholder:s,value:r,onChange:e=>(function(e,s){let a={};for(let[t,n]of l)a[t===e?s:t]=n;t(a)})(r,e.target.value)}),(0,a.jsx)(m.p,{className:"flex-1 font-mono text-xs h-8",placeholder:n,value:o,onChange:s=>{var a;return a=s.target.value,void t({...e,[r]:a})}}),(0,a.jsx)("button",{type:"button",className:"shrink-0 p-1 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",onClick:()=>{let s;return s={...e},void(delete s[r],t(s))},children:(0,a.jsx)(i.A,{className:"h-3.5 w-3.5"})})]},d)),(0,a.jsxs)(c.$,{type:"button",variant:"outline",size:"sm",onClick:function(){let s="",a=0;for(;s in e;)a++,s=`key${a}`;t({...e,[s]:""})},children:[(0,a.jsx)(d.A,{className:"h-3.5 w-3.5 mr-1"}),"Add"]})]})}function h({value:e,onChange:t,placeholder:s="Value"}){return(0,a.jsxs)("div",{className:"space-y-2",children:[e.map((n,l)=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(m.p,{className:"flex-1 font-mono text-xs h-8",placeholder:s,value:n,onChange:s=>{var a;let n;return a=s.target.value,void((n=[...e])[l]=a,t(n))}}),(0,a.jsx)("button",{type:"button",className:"shrink-0 p-1 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",onClick:()=>{t(e.filter((e,t)=>t!==l))},children:(0,a.jsx)(i.A,{className:"h-3.5 w-3.5"})})]},l)),(0,a.jsxs)(c.$,{type:"button",variant:"outline",size:"sm",onClick:function(){t([...e,""])},children:[(0,a.jsx)(d.A,{className:"h-3.5 w-3.5 mr-1"}),"Add"]})]})}var v=s(45160);let p={type:"stdio",command:"",args:[],env:{},url:"",headers:{}},x=[{value:"stdio",label:"stdio"},{value:"http",label:"http"},{value:"sse",label:"sse (deprecated)"}];function f(e){if("stdio"===e.type){let t={type:"stdio",command:e.command};return e.args.length>0&&(t.args=e.args),Object.keys(e.env).length>0&&(t.env=e.env),t}let t={type:e.type,url:e.url};return Object.keys(e.headers).length>0&&(t.headers=e.headers),t}function j(e){return JSON.stringify(f(e))}function g({params:e}){let{name:t}=(0,r.use)(e),s=(0,l.useSearchParams)(),i=(0,l.useRouter)(),d="new"===t,y=s.get("scope")||"user",b=s.get("cwd")||void 0;(0,o.si)(d?"New MCP Server":"Edit MCP Server",{hideActions:!0});let[N,k]=(0,r.useState)(d?"":decodeURIComponent(t)),[C,w]=(0,r.useState)(p),[S,A]=(0,r.useState)(j(p)),[P,$]=(0,r.useState)(!d),[E,R]=(0,r.useState)(!1),[U,O]=(0,r.useState)(null),_=j(C)!==S;(0,r.useEffect)(()=>{if(d)return;let e=new URLSearchParams({scope:y});b&&e.set("cwd",b),fetch(`/api/mcp-servers/${encodeURIComponent(t)}?${e}`).then(e=>{if(!e.ok)throw Error("Not found");return e.json()}).then(e=>{var t;let s={type:(t=e.config).type||(t.command?"stdio":t.url?"http":"stdio"),command:t.command||"",args:t.args||[],env:t.env||{},url:t.url||"",headers:t.headers||{}};w(s),A(j(s))}).catch(()=>{O("Failed to load server")}).finally(()=>$(!1))},[d,t,y,b]);let z=(0,r.useCallback)(async()=>{let e=N.trim();if(!e)return void O("Name is required");if(!/^[a-zA-Z0-9_-]+$/.test(e))return void O("Name can only contain letters, numbers, hyphens, and underscores");if("stdio"===C.type&&!C.command.trim())return void O("Command is required for stdio transport");if(("http"===C.type||"sse"===C.type)&&!C.url.trim())return void O("URL is required for "+C.type+" transport");R(!0),O(null);try{if(!(await fetch(`/api/mcp-servers/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:y,cwd:b,config:f(C)})})).ok)throw Error("Save failed");if(A(j(C)),O("Saved"),d){let t=new URLSearchParams({scope:y});b&&t.set("cwd",b),i.replace(`/mcp-servers/${encodeURIComponent(e)}?${t}`)}}catch{O("Failed to save")}finally{R(!1)}},[N,C,y,b,d,i]);function L(e){w(t=>({...t,...e}))}return P?(0,a.jsx)("div",{className:"flex-1 min-h-0 p-4",children:(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,a.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex-1 min-w-0",children:d?(0,a.jsx)(m.p,{placeholder:"server-name",value:N,onChange:e=>k(e.target.value),className:"font-mono"}):(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-mono font-bold text-lg",children:N}),(0,a.jsx)(v.E,{variant:"secondary",children:"user"===y?"Global":"Project"})]})}),(0,a.jsxs)(c.$,{size:"sm",onClick:z,disabled:E||!d&&!_,children:[(0,a.jsx)(n.A,{className:"h-4 w-4 mr-1"}),E?"Saving...":"Save"]})]}),U&&(0,a.jsx)("p",{className:`text-sm ${"Saved"===U?"text-green-600":"text-destructive"}`,children:U}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Transport"}),(0,a.jsx)("div",{className:"flex gap-1",children:x.map(e=>(0,a.jsx)(c.$,{variant:C.type===e.value?"default":"outline",size:"sm",onClick:()=>L({type:e.value}),children:e.label},e.value))})]}),"stdio"===C.type&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Command"}),(0,a.jsx)(m.p,{placeholder:"node",value:C.command,onChange:e=>L({command:e.target.value}),className:"font-mono"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Arguments"}),(0,a.jsx)(h,{value:C.args,onChange:e=>L({args:e}),placeholder:"argument"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Environment Variables"}),(0,a.jsx)(u,{value:C.env,onChange:e=>L({env:e}),keyPlaceholder:"VARIABLE",valuePlaceholder:"value"})]})]}),("http"===C.type||"sse"===C.type)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"URL"}),(0,a.jsx)(m.p,{placeholder:"https://example.com/mcp",value:C.url,onChange:e=>L({url:e.target.value}),className:"font-mono"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Headers"}),(0,a.jsx)(u,{value:C.headers,onChange:e=>L({headers:e}),keyPlaceholder:"Header-Name",valuePlaceholder:"value"})]})]})]})]})}},81402:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(99537).A)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},86853:(e,t,s)=>{Promise.resolve().then(s.bind(s,10833))}},e=>{e.O(0,[989,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[80227],{10833:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>g});var a=s(95155),n=s(81402),l=s(73321),r=s(12115),o=s(1550),i=s(9005),d=s(2125),c=s(89239),m=s(60529);function u({value:e,onChange:t,keyPlaceholder:s="Key",valuePlaceholder:n="Value"}){let l=Object.entries(e);return(0,a.jsxs)("div",{className:"space-y-2",children:[l.map(([r,o],d)=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(m.p,{className:"flex-1 font-mono text-xs h-8",placeholder:s,value:r,onChange:e=>(function(e,s){let a={};for(let[t,n]of l)a[t===e?s:t]=n;t(a)})(r,e.target.value)}),(0,a.jsx)(m.p,{className:"flex-1 font-mono text-xs h-8",placeholder:n,value:o,onChange:s=>{var a;return a=s.target.value,void t({...e,[r]:a})}}),(0,a.jsx)("button",{type:"button",className:"shrink-0 p-1 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",onClick:()=>{let s;return s={...e},void(delete s[r],t(s))},children:(0,a.jsx)(i.A,{className:"h-3.5 w-3.5"})})]},d)),(0,a.jsxs)(c.$,{type:"button",variant:"outline",size:"sm",onClick:function(){let s="",a=0;for(;s in e;)a++,s=`key${a}`;t({...e,[s]:""})},children:[(0,a.jsx)(d.A,{className:"h-3.5 w-3.5 mr-1"}),"Add"]})]})}function h({value:e,onChange:t,placeholder:s="Value"}){return(0,a.jsxs)("div",{className:"space-y-2",children:[e.map((n,l)=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(m.p,{className:"flex-1 font-mono text-xs h-8",placeholder:s,value:n,onChange:s=>{var a;let n;return a=s.target.value,void((n=[...e])[l]=a,t(n))}}),(0,a.jsx)("button",{type:"button",className:"shrink-0 p-1 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",onClick:()=>{t(e.filter((e,t)=>t!==l))},children:(0,a.jsx)(i.A,{className:"h-3.5 w-3.5"})})]},l)),(0,a.jsxs)(c.$,{type:"button",variant:"outline",size:"sm",onClick:function(){t([...e,""])},children:[(0,a.jsx)(d.A,{className:"h-3.5 w-3.5 mr-1"}),"Add"]})]})}var v=s(45160);let p={type:"stdio",command:"",args:[],env:{},url:"",headers:{}},x=[{value:"stdio",label:"stdio"},{value:"http",label:"http"},{value:"sse",label:"sse (deprecated)"}];function f(e){if("stdio"===e.type){let t={type:"stdio",command:e.command};return e.args.length>0&&(t.args=e.args),Object.keys(e.env).length>0&&(t.env=e.env),t}let t={type:e.type,url:e.url};return Object.keys(e.headers).length>0&&(t.headers=e.headers),t}function j(e){return JSON.stringify(f(e))}function g({params:e}){let{name:t}=(0,r.use)(e),s=(0,l.useSearchParams)(),i=(0,l.useRouter)(),d="new"===t,y=s.get("scope")||"user",b=s.get("cwd")||void 0;(0,o.si)(d?"New MCP Server":"Edit MCP Server",{hideActions:!0});let[N,k]=(0,r.useState)(d?"":decodeURIComponent(t)),[C,w]=(0,r.useState)(p),[S,A]=(0,r.useState)(j(p)),[P,$]=(0,r.useState)(!d),[E,R]=(0,r.useState)(!1),[U,O]=(0,r.useState)(null),_=j(C)!==S;(0,r.useEffect)(()=>{if(d)return;let e=new URLSearchParams({scope:y});b&&e.set("cwd",b),fetch(`/api/mcp-servers/${encodeURIComponent(t)}?${e}`).then(e=>{if(!e.ok)throw Error("Not found");return e.json()}).then(e=>{var t;let s={type:(t=e.config).type||(t.command?"stdio":t.url?"http":"stdio"),command:t.command||"",args:t.args||[],env:t.env||{},url:t.url||"",headers:t.headers||{}};w(s),A(j(s))}).catch(()=>{O("Failed to load server")}).finally(()=>$(!1))},[d,t,y,b]);let z=(0,r.useCallback)(async()=>{let e=N.trim();if(!e)return void O("Name is required");if(!/^[a-zA-Z0-9_-]+$/.test(e))return void O("Name can only contain letters, numbers, hyphens, and underscores");if("stdio"===C.type&&!C.command.trim())return void O("Command is required for stdio transport");if(("http"===C.type||"sse"===C.type)&&!C.url.trim())return void O("URL is required for "+C.type+" transport");R(!0),O(null);try{if(!(await fetch(`/api/mcp-servers/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:y,cwd:b,config:f(C)})})).ok)throw Error("Save failed");if(A(j(C)),O("Saved"),d){let t=new URLSearchParams({scope:y});b&&t.set("cwd",b),i.replace(`/mcp-servers/${encodeURIComponent(e)}?${t}`)}}catch{O("Failed to save")}finally{R(!1)}},[N,C,y,b,d,i]);function L(e){w(t=>({...t,...e}))}return P?(0,a.jsx)("div",{className:"flex-1 min-h-0 p-4",children:(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,a.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex-1 min-w-0",children:d?(0,a.jsx)(m.p,{placeholder:"server-name",value:N,onChange:e=>k(e.target.value),className:"font-mono"}):(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-mono font-bold text-lg",children:N}),(0,a.jsx)(v.E,{variant:"secondary",children:"user"===y?"Global":"Project"})]})}),(0,a.jsxs)(c.$,{size:"sm",onClick:z,disabled:E||!d&&!_,children:[(0,a.jsx)(n.A,{className:"h-4 w-4 mr-1"}),E?"Saving...":"Save"]})]}),U&&(0,a.jsx)("p",{className:`text-sm ${"Saved"===U?"text-green-600":"text-destructive"}`,children:U}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Transport"}),(0,a.jsx)("div",{className:"flex gap-1",children:x.map(e=>(0,a.jsx)(c.$,{variant:C.type===e.value?"default":"outline",size:"sm",onClick:()=>L({type:e.value}),children:e.label},e.value))})]}),"stdio"===C.type&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Command"}),(0,a.jsx)(m.p,{placeholder:"node",value:C.command,onChange:e=>L({command:e.target.value}),className:"font-mono"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Arguments"}),(0,a.jsx)(h,{value:C.args,onChange:e=>L({args:e}),placeholder:"argument"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Environment Variables"}),(0,a.jsx)(u,{value:C.env,onChange:e=>L({env:e}),keyPlaceholder:"VARIABLE",valuePlaceholder:"value"})]})]}),("http"===C.type||"sse"===C.type)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"URL"}),(0,a.jsx)(m.p,{placeholder:"https://example.com/mcp",value:C.url,onChange:e=>L({url:e.target.value}),className:"font-mono"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Headers"}),(0,a.jsx)(u,{value:C.headers,onChange:e=>L({headers:e}),keyPlaceholder:"Header-Name",valuePlaceholder:"value"})]})]})]})]})}},81402:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(99537).A)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},86853:(e,t,s)=>{Promise.resolve().then(s.bind(s,10833))}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=86853)),_N_E=e.O()}]);
|