nodal-agents 0.4.2 → 0.4.4

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.
Files changed (130) hide show
  1. package/README.md +12 -12
  2. package/package.json +2 -1
  3. package/runner.js +247 -66
  4. package/web/.next/BUILD_ID +1 -1
  5. package/web/.next/build-manifest.json +2 -2
  6. package/web/.next/prerender-manifest.json +3 -3
  7. package/web/.next/server/app/(dashboard)/agents/[id]/edit/page.js +3 -3
  8. package/web/.next/server/app/(dashboard)/agents/[id]/edit/page.js.nft.json +1 -1
  9. package/web/.next/server/app/(dashboard)/agents/[id]/edit/page_client-reference-manifest.js +1 -1
  10. package/web/.next/server/app/(dashboard)/agents/[id]/telegram/page.js +2 -2
  11. package/web/.next/server/app/(dashboard)/agents/[id]/telegram/page_client-reference-manifest.js +1 -1
  12. package/web/.next/server/app/(dashboard)/agents/page.js +2 -2
  13. package/web/.next/server/app/(dashboard)/agents/page_client-reference-manifest.js +1 -1
  14. package/web/.next/server/app/(dashboard)/approvals/page.js +2 -2
  15. package/web/.next/server/app/(dashboard)/approvals/page.js.nft.json +1 -1
  16. package/web/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
  17. package/web/.next/server/app/(dashboard)/automations/page.js +2 -2
  18. package/web/.next/server/app/(dashboard)/automations/page_client-reference-manifest.js +1 -1
  19. package/web/.next/server/app/(dashboard)/billing/page.js +2 -2
  20. package/web/.next/server/app/(dashboard)/billing/page_client-reference-manifest.js +1 -1
  21. package/web/.next/server/app/(dashboard)/chat/page.js +1 -1
  22. package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  23. package/web/.next/server/app/(dashboard)/connectors/page.js +1 -1
  24. package/web/.next/server/app/(dashboard)/connectors/page.js.nft.json +1 -1
  25. package/web/.next/server/app/(dashboard)/connectors/page_client-reference-manifest.js +1 -1
  26. package/web/.next/server/app/(dashboard)/credentials/page.js +1 -1
  27. package/web/.next/server/app/(dashboard)/credentials/page.js.nft.json +1 -1
  28. package/web/.next/server/app/(dashboard)/credentials/page_client-reference-manifest.js +1 -1
  29. package/web/.next/server/app/(dashboard)/jobs/[id]/page.js +2 -2
  30. package/web/.next/server/app/(dashboard)/jobs/[id]/page_client-reference-manifest.js +1 -1
  31. package/web/.next/server/app/(dashboard)/jobs/page.js +2 -2
  32. package/web/.next/server/app/(dashboard)/jobs/page.js.nft.json +1 -1
  33. package/web/.next/server/app/(dashboard)/jobs/page_client-reference-manifest.js +1 -1
  34. package/web/.next/server/app/(dashboard)/llm-providers/page.js +1 -1
  35. package/web/.next/server/app/(dashboard)/llm-providers/page_client-reference-manifest.js +1 -1
  36. package/web/.next/server/app/(dashboard)/logs/page.js +2 -2
  37. package/web/.next/server/app/(dashboard)/logs/page_client-reference-manifest.js +1 -1
  38. package/web/.next/server/app/(dashboard)/mcp/page.js +1 -1
  39. package/web/.next/server/app/(dashboard)/mcp/page_client-reference-manifest.js +1 -1
  40. package/web/.next/server/app/(dashboard)/memories/page.js +2 -2
  41. package/web/.next/server/app/(dashboard)/memories/page_client-reference-manifest.js +1 -1
  42. package/web/.next/server/app/(dashboard)/page.js +4 -4
  43. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  44. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  45. package/web/.next/server/app/(dashboard)/settings/page.js +2 -2
  46. package/web/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  47. package/web/.next/server/app/(dashboard)/skills/[id]/edit/page.js +1 -1
  48. package/web/.next/server/app/(dashboard)/skills/[id]/edit/page.js.nft.json +1 -1
  49. package/web/.next/server/app/(dashboard)/skills/[id]/edit/page_client-reference-manifest.js +1 -1
  50. package/web/.next/server/app/(dashboard)/skills/new/page.js +2 -2
  51. package/web/.next/server/app/(dashboard)/skills/new/page.js.nft.json +1 -1
  52. package/web/.next/server/app/(dashboard)/skills/new/page_client-reference-manifest.js +1 -1
  53. package/web/.next/server/app/(dashboard)/skills/page.js +1 -1
  54. package/web/.next/server/app/(dashboard)/skills/page_client-reference-manifest.js +1 -1
  55. package/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  56. package/web/.next/server/app/_global-error.html +1 -1
  57. package/web/.next/server/app/_global-error.rsc +2 -2
  58. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +2 -2
  59. package/web/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  60. package/web/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  61. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  62. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +2 -2
  63. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  64. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  65. package/web/.next/server/app/_not-found.html +1 -1
  66. package/web/.next/server/app/_not-found.rsc +2 -2
  67. package/web/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  68. package/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  69. package/web/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  70. package/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  71. package/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  72. package/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  73. package/web/.next/server/app/api/oauth/[provider]/callback/route.js +1 -1
  74. package/web/.next/server/app/login/page_client-reference-manifest.js +1 -1
  75. package/web/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  76. package/web/.next/server/app/onboarding.html +1 -1
  77. package/web/.next/server/app/onboarding.rsc +2 -2
  78. package/web/.next/server/app/onboarding.segments/_full.segment.rsc +2 -2
  79. package/web/.next/server/app/onboarding.segments/_head.segment.rsc +1 -1
  80. package/web/.next/server/app/onboarding.segments/_index.segment.rsc +2 -2
  81. package/web/.next/server/app/onboarding.segments/_tree.segment.rsc +1 -1
  82. package/web/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +1 -1
  83. package/web/.next/server/app/onboarding.segments/onboarding.segment.rsc +1 -1
  84. package/web/.next/server/chunks/3233.js +1 -1
  85. package/web/.next/server/chunks/3889.js +1 -0
  86. package/web/.next/server/chunks/5329.js +1 -0
  87. package/web/.next/server/chunks/593.js +1 -0
  88. package/web/.next/server/chunks/7231.js +1 -0
  89. package/web/.next/server/chunks/7741.js +1 -1
  90. package/web/.next/server/middleware-build-manifest.js +1 -1
  91. package/web/.next/server/pages/404.html +1 -1
  92. package/web/.next/server/pages/500.html +1 -1
  93. package/web/.next/server/server-reference-manifest.js +1 -1
  94. package/web/.next/server/server-reference-manifest.json +1 -1
  95. package/web/.next/static/chunks/{9123-20653d928e33410a.js → 9123-67530ba510c58003.js} +1 -1
  96. package/web/.next/static/chunks/app/(dashboard)/agents/[id]/edit/page-a2c267f563cd1a70.js +2 -0
  97. package/web/.next/static/chunks/app/(dashboard)/agents/[id]/telegram/page-2d7cae43f5e6952a.js +1 -0
  98. package/web/.next/static/chunks/app/(dashboard)/agents/page-bed833ebdd3646fb.js +1 -0
  99. package/web/.next/static/chunks/app/(dashboard)/approvals/{page-79dea6e91956eeba.js → page-4b27762472802ce0.js} +1 -1
  100. package/web/.next/static/chunks/app/(dashboard)/automations/{page-3b863b7af8e2c1a3.js → page-9e5d2ce807ce1c37.js} +1 -1
  101. package/web/.next/static/chunks/app/(dashboard)/chat/page-8f81d7e3abb475a6.js +1 -0
  102. package/web/.next/static/chunks/app/(dashboard)/connectors/{page-4a437ba82f4086da.js → page-39b1d9560235d574.js} +1 -1
  103. package/web/.next/static/chunks/app/(dashboard)/jobs/[id]/page-112bb22a9ec43be0.js +1 -0
  104. package/web/.next/static/chunks/app/(dashboard)/jobs/{page-94a311f688a255d8.js → page-44351170ed5f9180.js} +1 -1
  105. package/web/.next/static/chunks/app/(dashboard)/{layout-e1b0d4fad2926646.js → layout-53e69de869cba0d0.js} +1 -1
  106. package/web/.next/static/chunks/app/(dashboard)/llm-providers/{page-e5e2c4e2b783d37f.js → page-8f6ce47ba228e38b.js} +1 -1
  107. package/web/.next/static/chunks/app/(dashboard)/mcp/page-cdf057e468c6e92e.js +1 -0
  108. package/web/.next/static/chunks/app/(dashboard)/memories/page-e706ab4aa681fa99.js +1 -0
  109. package/web/.next/static/chunks/app/(dashboard)/{page-fb50e1576a3ab2e4.js → page-29cfae3bf701076e.js} +1 -1
  110. package/web/.next/static/chunks/app/(dashboard)/settings/page-312ae27ae71ea6d1.js +1 -0
  111. package/web/.next/static/chunks/app/(dashboard)/skills/[id]/edit/page-89a8a30db5eb96e1.js +1 -0
  112. package/web/.next/static/chunks/app/(dashboard)/skills/new/page-46a424b203591560.js +1 -0
  113. package/web/.next/static/chunks/app/(dashboard)/skills/page-edad7bbd3230fb7a.js +1 -0
  114. package/web/.next/server/chunks/1945.js +0 -1
  115. package/web/.next/server/chunks/4839.js +0 -1
  116. package/web/.next/server/chunks/8206.js +0 -1
  117. package/web/.next/server/chunks/8398.js +0 -1
  118. package/web/.next/static/chunks/app/(dashboard)/agents/[id]/edit/page-a8e293c54c818084.js +0 -2
  119. package/web/.next/static/chunks/app/(dashboard)/agents/[id]/telegram/page-7a94ae67b2c3c9c3.js +0 -1
  120. package/web/.next/static/chunks/app/(dashboard)/agents/page-b258b8975ac6450b.js +0 -1
  121. package/web/.next/static/chunks/app/(dashboard)/chat/page-4d965bb7ee3732db.js +0 -1
  122. package/web/.next/static/chunks/app/(dashboard)/jobs/[id]/page-be20dcbf25c8f3ce.js +0 -1
  123. package/web/.next/static/chunks/app/(dashboard)/mcp/page-c071c54f76273ac4.js +0 -1
  124. package/web/.next/static/chunks/app/(dashboard)/memories/page-8ca0b34ad35eb1fa.js +0 -1
  125. package/web/.next/static/chunks/app/(dashboard)/settings/page-7b256e9c462e97f8.js +0 -1
  126. package/web/.next/static/chunks/app/(dashboard)/skills/[id]/edit/page-12930816795e8b20.js +0 -1
  127. package/web/.next/static/chunks/app/(dashboard)/skills/new/page-e3a19abaf7468db9.js +0 -1
  128. package/web/.next/static/chunks/app/(dashboard)/skills/page-43f1475a0bc9c45f.js +0 -1
  129. /package/web/.next/static/{ZuUX-HBTQOhLf0tFI6JQI → PV5qpGylrVW3jZ7zKHuhE}/_buildManifest.js +0 -0
  130. /package/web/.next/static/{ZuUX-HBTQOhLf0tFI6JQI → PV5qpGylrVW3jZ7zKHuhE}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9123],{12120:(e,t,a)=>{a.d(t,{YT:()=>A,zw:()=>O,SV:()=>G,mV:()=>L,eS:()=>q});var l=a(96831);let i=l.k5(["telegram","api","whatsapp","internal","cron","task-board","slack","discord","dashboard"]),o=l.k5(["pending","processing","completed","failed","awaiting_approval","awaiting_delegation","cancelled"]),n=l.k5(["todo","in_progress","done","cancelled","blocked"]),d=l.k5(["low","medium","high"]),u=l.k5(["agent","orchestrator","system"]),r=l.k5(["router","planner"]),s=l.k5(["api_key","oauth2","bearer","basic","none"]),c=l.k5(["pending","approved","rejected","expired"]),m=l.k5(["auto_approve","require_approval","block"]),p=l.k5(["preference","context","outcome","learned_rule"]),_=l.k5(["agent","reflection","manual"]),b=l.k5(["L1","L2","L3"]),j=l.k5(["cron","heartbeat"]),Y=l.k5(["success","failed","no_action"]),g=l.k5(["entity","operator"]),k=l.k5(["owner","admin","member","viewer"]),f=l.k5(["agency","startup","personal","studio","enterprise","other"]),h=l.k5(["read","write","destructive"]);l.k5(["webhook","transform","schedule"]),l.k5(["pre_task","post_task","pre_tool","post_tool","on_memory_save"]),l.k5(["http","stdio"]),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Ik({id:l.Yj().guid(),user_id:l.Yj().guid(),name:l.Yj().min(1).max(120),slug:l.Yj().min(1).max(80).regex(/^[a-z0-9-]+$/),description:l.Yj().max(500).nullable(),icon:l.Yj().max(4),industry:f.nullable(),goal:l.Yj().max(1e3).nullable(),mcp_token:l.Yj().guid().nullable(),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,mcp_token:!0,created_at:!0,updated_at:!0}).extend({description:l.Yj().max(500).nullable().optional(),icon:l.Yj().max(4).default("\uD83C\uDFE2"),industry:f.nullable().optional(),goal:l.Yj().max(1e3).nullable().optional()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid(),user_id:l.Yj().guid(),role:k,created_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0}).extend({role:k.default("owner")}),l.Ik({user_id:l.Yj().guid(),display_name:l.Yj().max(120).nullable(),avatar_url:l.Yj().max(500).nullable(),timezone:l.Yj().max(80),locale:l.Yj().max(10),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({created_at:!0,updated_at:!0}).extend({display_name:l.Yj().max(120).nullable().optional(),avatar_url:l.Yj().max(500).nullable().optional(),timezone:l.Yj().max(80).default("UTC"),locale:l.Yj().max(10).default("en")}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),name:l.Yj().min(1).max(120),slug:l.Yj().min(1).max(80).regex(/^[a-z0-9-]+$/),personality:l.Yj().min(1),model:l.Yj().min(1),active:l.zM(),is_default:l.zM(),role:u,orchestrator_mode:r.nullable(),telegram_bot_token:l.Yj().nullable(),telegram_bot_username:l.Yj().nullable(),telegram_offset:l.ai().int().nonnegative().nullable(),requires_approval:l.YO(l.Yj()),capabilities:l.YO(l.Yj()),task_context_template:l.Yj().nullable(),avatar_url:l.Yj().nullable(),system_agent:l.zM(),max_tokens_per_job:l.ai().int().min(0),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0,telegram_offset:!0,capabilities:!0,system_agent:!0}).extend({active:l.zM().default(!0),is_default:l.zM().default(!1),role:u.default("agent"),orchestrator_mode:r.nullable().optional(),telegram_bot_token:l.Yj().nullable().optional(),telegram_bot_username:l.Yj().nullable().optional(),requires_approval:l.YO(l.Yj()).default([]),task_context_template:l.Yj().nullable().optional(),avatar_url:l.Yj().nullable().optional(),max_tokens_per_job:l.ai().int().min(0).max(5e5).default(0)});let y=l.ai().int().min(0),x=l.ai().int().min(0);l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),agent_id:l.Yj().guid().nullable(),status:o,channel:i,task:l.Yj().min(1),original_task:l.Yj().nullable(),chat_id:l.Yj().nullable(),system_prompt:l.Yj().nullable(),messages:l.YO(l.g1(l.Yj(),l.L5())),tools_used:l.YO(l.Yj()),turn:l.ai().int().min(0),result:l.Yj().nullable(),error:l.Yj().nullable(),chain_count:y,request_id:l.Yj().nullable(),parent_job_id:l.Yj().guid().nullable(),parent_request_id:l.Yj().nullable(),total_duration_ms:l.ai().int().min(0),input_tokens:l.ai().int().min(0),output_tokens:l.ai().int().min(0),delegation_depth:x,pending_delegation:l.g1(l.Yj(),l.L5()).nullable(),completed_at:l.Yj().datetime().nullable(),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0,completed_at:!0,messages:!0,tools_used:!0,turn:!0,result:!0,error:!0,chain_count:!0,total_duration_ms:!0,input_tokens:!0,output_tokens:!0,delegation_depth:!0,pending_delegation:!0,parent_request_id:!0}).extend({status:o.default("pending"),original_task:l.Yj().nullable().optional(),chat_id:l.Yj().nullable().optional(),system_prompt:l.Yj().nullable().optional(),request_id:l.Yj().nullable().optional(),parent_job_id:l.Yj().guid().nullable().optional()});let v=l.Yj().max(2e3).nullable(),I=l.Yj().min(1).max(200);l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid(),orchestrator_id:l.Yj().guid(),title:I,description:v,status:n,priority:d,job_id:l.Yj().guid().nullable(),result:l.Yj().nullable(),created_by_agent_id:l.Yj().guid().nullable(),assigned_agent_id:l.Yj().guid().nullable(),input_tokens:l.ai().int().min(0),output_tokens:l.ai().int().min(0),cost_usd:l.ai().min(0),depends_on:l.YO(l.Yj().guid()),context:l.g1(l.Yj(),l.L5()),root_job_id:l.Yj().guid().nullable(),locked_at:l.Yj().datetime().nullable(),locked_by:l.Yj().nullable(),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0,job_id:!0,result:!0,created_by_agent_id:!0,assigned_agent_id:!0,input_tokens:!0,output_tokens:!0,cost_usd:!0,depends_on:!0,context:!0,root_job_id:!0,locked_at:!0,locked_by:!0}).extend({status:n.default("todo"),priority:d.default("medium"),description:v.optional(),depends_on:l.YO(l.Yj().guid()).default([]),context:l.g1(l.Yj(),l.L5()).default({}),root_job_id:l.Yj().guid().nullable().optional()}),l.Ik({id:l.Yj().guid(),owner_user_id:l.Yj().guid(),name:l.Yj().min(1),type:l.k5(["google-oauth","notion-oauth","airtable-oauth"]),payload:l.Yj(),created_at:l.p6().nullable(),updated_at:l.p6().nullable()}),l.Ik({clientId:l.Yj(),clientSecret:l.Yj(),refreshToken:l.Yj().nullable(),accessToken:l.Yj(),expiresAt:l.Yj().nullable(),scopes:l.Yj(),accountName:l.Yj(),tokenUrl:l.Yj().url()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),name:l.Yj().min(1).max(120),slug:l.Yj().min(1).max(80).regex(/^[a-z0-9-]+$/),base_url:l.Yj().nullable(),api_key:l.Yj().nullable(),active:l.zM(),auth_type:s,credential_id:l.Yj().guid().nullable(),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0}).extend({active:l.zM().default(!0),auth_type:s.default("api_key"),base_url:l.Yj().nullable().optional(),api_key:l.Yj().nullable().optional(),credential_id:l.Yj().guid().nullable().optional()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),job_id:l.Yj().guid().nullable(),tool_name:l.Yj().min(1),tool_input:l.g1(l.Yj(),l.L5()).nullable(),tool_output:l.Yj().nullable(),duration_ms:l.ai().int().min(0).nullable(),turn:l.ai().int().min(0).nullable(),created_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0}).extend({tool_input:l.g1(l.Yj(),l.L5()).nullable().optional(),tool_output:l.Yj().nullable().optional(),duration_ms:l.ai().int().min(0).nullable().optional(),turn:l.ai().int().min(0).nullable().optional()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),job_id:l.Yj().guid(),agent_id:l.Yj().guid().nullable(),tool_name:l.Yj().min(1),tool_input:l.g1(l.Yj(),l.L5()),status:c,requested_at:l.Yj().datetime(),resolved_at:l.Yj().datetime().nullable(),resolved_by:l.Yj().nullable(),expires_at:l.Yj().datetime().nullable(),notes:l.Yj().nullable()}).strict().omit({id:!0,requested_at:!0,resolved_at:!0,resolved_by:!0,expires_at:!0}).extend({status:c.default("pending"),notes:l.Yj().nullable().optional()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),agent_id:l.Yj().guid().nullable(),tool_name:l.Yj().min(1),action:m,condition_json:l.g1(l.Yj(),l.L5()),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0}).extend({agent_id:l.Yj().guid().nullable().optional(),condition_json:l.g1(l.Yj(),l.L5()).default({})});let T=l.ai().int().min(1).max(5);l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),agent_id:l.Yj().guid().nullable(),fact:l.Yj().min(1),category:p,importance:T,source:_,skill_tags:l.YO(l.Yj().max(60)),memory_layer:b.nullable(),valid_from:l.Yj().datetime().nullable(),valid_to:l.Yj().datetime().nullable(),fact_hash:l.Yj().nullable(),archived:l.zM(),last_accessed_at:l.Yj().datetime().nullable(),access_count:l.ai().int().min(0),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0,fact_hash:!0,archived:!0,last_accessed_at:!0,access_count:!0,valid_from:!0,valid_to:!0}).extend({agent_id:l.Yj().guid().nullable().optional(),category:p.default("context"),importance:T.default(3),source:_.default("manual"),skill_tags:l.YO(l.Yj().max(60)).max(20).default([]),memory_layer:b.nullable().optional()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),agent_id:l.Yj().guid().nullable(),name:l.Yj().min(1).max(120),slug:l.Yj().min(1).max(80).regex(/^[a-z0-9-]+$/),task_template:l.Yj().min(1),active:l.zM(),secret:l.Yj().nullable(),last_triggered_at:l.Yj().datetime().nullable(),trigger_count:l.ai().int().min(0),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0,secret:!0,last_triggered_at:!0,trigger_count:!0}).extend({active:l.zM().default(!0)});let C=l.Ik({name:l.Yj().min(1),slug:l.Yj().min(1).regex(/^[a-z0-9-]+$/),risk:h,requires_approval:l.zM()}).strict(),z=l.Ik({label:l.Yj().min(1),description:l.Yj().min(1),type:l.k5(["connector_slug","manual"]),value:l.Yj().optional(),critical:l.zM()}).strict();l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),name:l.Yj().min(1).max(120),slug:l.Yj().min(1).max(80).regex(/^[a-z0-9-]+$/),content:l.Yj().min(1),active:l.zM(),description:l.Yj().max(300).nullable(),default_content:l.Yj().nullable(),content_overridden:l.zM(),required_config:l.YO(z),operations:l.YO(C),required_builtins:l.YO(l.Yj()),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0}).extend({active:l.zM().default(!0),description:l.Yj().max(300).nullable().optional(),default_content:l.Yj().nullable().optional(),content_overridden:l.zM().default(!1),required_config:l.YO(z).default([]),operations:l.YO(C).default([]),required_builtins:l.YO(l.Yj()).default([])}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid(),agent_id:l.Yj().guid(),skill_id:l.Yj().guid(),approval_overrides:l.g1(l.Yj(),l.zM()),use_custom_instructions:l.zM(),enabled_operations:l.YO(l.Yj()).nullable(),created_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0}).extend({approval_overrides:l.g1(l.Yj(),l.zM()).default({}),use_custom_instructions:l.zM().default(!1),enabled_operations:l.YO(l.Yj()).nullable().optional()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),agent_id:l.Yj().guid(),type:j,name:l.Yj().min(1).max(120),cron_expr:l.Yj().min(1),task:l.Yj().nullable(),objectives:l.Yj().nullable(),active:l.zM(),last_run:l.Yj().datetime().nullable(),next_run:l.Yj().datetime().nullable(),last_status:Y.nullable(),chat_id:l.Yj().nullable(),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0,last_run:!0,next_run:!0,last_status:!0}).extend({type:j.default("cron"),active:l.zM().default(!0),task:l.Yj().nullable().optional(),objectives:l.Yj().nullable().optional(),chat_id:l.Yj().nullable().optional()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid(),provider:l.Yj().min(1),api_key:l.Yj(),base_url:l.Yj().nullable(),nickname:l.Yj().max(80).nullable(),is_active:l.zM(),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0}).extend({api_key:l.Yj().default(""),base_url:l.Yj().nullable().optional(),nickname:l.Yj().max(80).nullable().optional(),is_active:l.zM().default(!0)}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),agent_id:l.Yj().guid().nullable(),task:l.Yj().min(1),result:l.Yj().nullable(),success:l.zM(),tools_used:l.YO(l.Yj()),tokens_used:l.ai().int().min(0).nullable(),input_tokens:l.ai().int().min(0).nullable(),output_tokens:l.ai().int().min(0).nullable(),duration_ms:l.ai().int().min(0).nullable(),key_source:g.nullable(),created_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0}).extend({success:l.zM().default(!0),tools_used:l.YO(l.Yj()).default([]),result:l.Yj().nullable().optional(),tokens_used:l.ai().int().min(0).nullable().optional(),input_tokens:l.ai().int().min(0).nullable().optional(),output_tokens:l.ai().int().min(0).nullable().optional(),duration_ms:l.ai().int().min(0).nullable().optional(),key_source:g.nullable().optional()});let w=["https://www.googleapis.com/auth/userinfo.email","openid"];[...w],[...w],[...w],[...w];let M=l.k5(["propose_confirm","destructive_gate","fully_autonomous"]);l.Ik({createAgent:l.zM(),createSkill:l.zM(),updateSkill:l.zM(),assignSkill:l.zM(),createMcp:l.zM(),createConnector:l.zM(),autonomy:M});let O={createAgent:!0,createSkill:!0,updateSkill:!0,assignSkill:!0,createMcp:!0,createConnector:!0,autonomy:"propose_confirm"},A=[{slug:"notion",label:"Notion",authType:"api_key",docsHint:"Create a Notion integration at notion.so/my-integrations and copy its internal secret."},{slug:"notion-oauth",label:"Notion (OAuth)",authType:"oauth2",credentialType:"notion-oauth",docsHint:"Public Integration via OAuth — create one at notion.so/my-integrations (Public type) and authorize from your dashboard."},{slug:"google-drive",label:"Google Drive",authType:"oauth2",credentialType:"google-oauth",docsHint:"OAuth flow — uses your Google credential (create one under Credentials)."},{slug:"gmail",label:"Gmail",authType:"oauth2",credentialType:"google-oauth",docsHint:"OAuth flow — uses your Google credential (create one under Credentials)."},{slug:"google-sheets",label:"Google Sheets",authType:"oauth2",credentialType:"google-oauth",docsHint:"OAuth flow — uses your Google credential (create one under Credentials)."},{slug:"google-docs",label:"Google Docs",authType:"oauth2",credentialType:"google-oauth",docsHint:"OAuth flow — uses your Google credential (create one under Credentials)."},{slug:"airtable-oauth",label:"Airtable (OAuth)",authType:"oauth2",credentialType:"airtable-oauth",docsHint:"OAuth flow for Airtable Public Integrations (recommended)."},{slug:"airtable",label:"Airtable",authType:"api_key",docsHint:"Personal Access Token — airtable.com/create/tokens."},{slug:"apify",label:"Apify",authType:"api_key",docsHint:"Token API Apify — console.apify.com/account/integrations."},{slug:"firecrawl",label:"Firecrawl",authType:"api_key",docsHint:"API key Firecrawl — firecrawl.dev/account."},{slug:"tavily",label:"Tavily",authType:"api_key",docsHint:"API key Tavily — app.tavily.com."}],G={anthropic:[{modelId:"claude-opus-4-8",label:"Claude Opus 4.8",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"claude-sonnet-4-6",label:"Claude Sonnet 4.6",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"claude-haiku-4-5-20251001",label:"Claude Haiku 4.5",capabilities:{tools:!0,forcedToolChoice:!0}}],openai:[{modelId:"gpt-5",label:"GPT-5",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"gpt-5-mini",label:"GPT-5 mini",capabilities:{tools:!0,forcedToolChoice:!0}}],google:[{modelId:"gemini-2.0-flash",label:"Gemini 2.0 Flash",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"gemini-2.5-pro",label:"Gemini 2.5 Pro",capabilities:{tools:!0,forcedToolChoice:!0}}],groq:[{modelId:"llama-3.3-70b-versatile",label:"Llama 3.3 70B",capabilities:{tools:!0,forcedToolChoice:!0}}],mistral:[{modelId:"mistral-large-latest",label:"Mistral Large",capabilities:{tools:!0,forcedToolChoice:!0}}],openrouter:[{modelId:"anthropic/claude-haiku-4.5",label:"Claude Haiku 4.5",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"anthropic/claude-opus-4.7",label:"Claude Opus 4.7",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"anthropic/claude-opus-4.7-fast",label:"Claude Opus 4.7 (fast)",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"anthropic/claude-opus-4.8",label:"Claude Opus 4.8",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"anthropic/claude-opus-4.8-fast",label:"Claude Opus 4.8 (fast)",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"anthropic/claude-sonnet-4.6",label:"Claude Sonnet 4.6",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"deepseek/deepseek-v3.2",label:"DeepSeek V3.2",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"deepseek/deepseek-v4-flash",label:"DeepSeek V4 Flash",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"deepseek/deepseek-v4-pro",label:"DeepSeek V4 Pro",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"google/gemini-3.1-flash-lite-preview",label:"Gemini 3.1 Flash Lite (preview)",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"google/gemini-3.1-pro-preview",label:"Gemini 3.1 Pro (preview)",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"google/gemini-3.5-flash",label:"Gemini 3.5 Flash",capabilities:{tools:!0,forcedToolChoice:!0}},{modelId:"google/gemma-4-31b-it",label:"Gemma 4 31B-IT",capabilities:{tools:!0,forcedToolChoice:!0}}]};function L(e,t){return G[e]?.find(e=>e.modelId===t)}let S={anthropic:"Anthropic",openai:"OpenAI",google:"Google",deepseek:"DeepSeek",mistral:"Mistral",meta:"Meta",qwen:"Qwen","meta-llama":"Meta"};function q(e){let t=new Map;for(let a of e){let e=function(e){let t=e.indexOf("/");if(t<0)return null;let a=e.slice(0,t);return S[a]??a.charAt(0).toUpperCase()+a.slice(1)}(a.modelId),l=t.get(e)??[];l.push(a),t.set(e,l)}return[...t.entries()].map(([e,t])=>({group:e,models:[...t].sort((e,t)=>e.label.localeCompare(t.label))})).sort((e,t)=>(e.group??"").localeCompare(t.group??""))}},14308:(e,t,a)=>{a.d(t,{A:()=>n});var l=a(3680),i=a(78604),o=a(51869);function n({open:e,title:t,message:a,confirmLabel:d="Confirm",cancelLabel:u="Cancel",destructive:r=!0,onConfirm:s,onCancel:c}){let m=(0,i.useRef)(null),[p,_]=(0,i.useState)(!1);return((0,i.useEffect)(()=>{_(!0)},[]),(0,i.useEffect)(()=>{if(e)return m.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&c()}},[e,c]),e&&p)?(0,o.createPortal)((0,l.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",className:"fixed inset-0 z-50 flex items-center justify-center px-4 text-left",children:[(0,l.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:c,"aria-hidden":"true"}),(0,l.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl p-6 max-w-md w-full shadow-2xl",children:[(0,l.jsx)("h2",{id:"confirm-dialog-title",className:"text-base font-semibold text-ink",children:t}),a&&(0,l.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:a}),(0,l.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,l.jsx)("button",{ref:m,type:"button",onClick:c,className:"px-4 py-2 text-sm font-medium border border-rule text-ink-2 rounded-lg hover:border-rule hover:text-ink transition-colors",children:u}),(0,l.jsx)("button",{type:"button",onClick:s,className:`px-4 py-2 text-sm font-semibold rounded-lg transition-colors ${r?"bg-err hover:brightness-[0.94] text-ink":"bg-ink hover:brightness-[0.92] text-canvas"}`,children:d})]})]})]}),document.body):null}}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9123],{12120:(e,t,a)=>{a.d(t,{YT:()=>A,zw:()=>O,SV:()=>W,mV:()=>G,eS:()=>S});var l=a(96831);let i=l.k5(["telegram","api","whatsapp","internal","cron","task-board","slack","discord","dashboard"]),o=l.k5(["pending","processing","completed","failed","awaiting_approval","awaiting_delegation","cancelled"]),n=l.k5(["todo","in_progress","done","cancelled","blocked"]),d=l.k5(["low","medium","high"]),u=l.k5(["agent","orchestrator","system"]),r=l.k5(["router","planner"]),s=l.k5(["api_key","oauth2","bearer","basic","none"]),c=l.k5(["pending","approved","rejected","expired"]),m=l.k5(["auto_approve","require_approval","block"]),p=l.k5(["preference","context","outcome","learned_rule"]),_=l.k5(["agent","reflection","manual"]),b=l.k5(["L1","L2","L3"]),j=l.k5(["cron","heartbeat"]),Y=l.k5(["success","failed","no_action"]),g=l.k5(["entity","operator"]),k=l.k5(["owner","admin","member","viewer"]),f=l.k5(["agency","startup","personal","studio","enterprise","other"]),h=l.k5(["read","write","destructive"]);l.k5(["webhook","transform","schedule"]),l.k5(["pre_task","post_task","pre_tool","post_tool","on_memory_save"]),l.k5(["http","stdio"]),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Yj().guid().brand(),l.Ik({id:l.Yj().guid(),user_id:l.Yj().guid(),name:l.Yj().min(1).max(120),slug:l.Yj().min(1).max(80).regex(/^[a-z0-9-]+$/),description:l.Yj().max(500).nullable(),icon:l.Yj().max(4),industry:f.nullable(),goal:l.Yj().max(1e3).nullable(),mcp_token:l.Yj().guid().nullable(),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,mcp_token:!0,created_at:!0,updated_at:!0}).extend({description:l.Yj().max(500).nullable().optional(),icon:l.Yj().max(4).default("\uD83C\uDFE2"),industry:f.nullable().optional(),goal:l.Yj().max(1e3).nullable().optional()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid(),user_id:l.Yj().guid(),role:k,created_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0}).extend({role:k.default("owner")}),l.Ik({user_id:l.Yj().guid(),display_name:l.Yj().max(120).nullable(),avatar_url:l.Yj().max(500).nullable(),timezone:l.Yj().max(80),locale:l.Yj().max(10),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({created_at:!0,updated_at:!0}).extend({display_name:l.Yj().max(120).nullable().optional(),avatar_url:l.Yj().max(500).nullable().optional(),timezone:l.Yj().max(80).default("UTC"),locale:l.Yj().max(10).default("en")}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),name:l.Yj().min(1).max(120),slug:l.Yj().min(1).max(80).regex(/^[a-z0-9-]+$/),personality:l.Yj().min(1),model:l.Yj().min(1),active:l.zM(),is_default:l.zM(),role:u,orchestrator_mode:r.nullable(),telegram_bot_token:l.Yj().nullable(),telegram_bot_username:l.Yj().nullable(),telegram_offset:l.ai().int().nonnegative().nullable(),requires_approval:l.YO(l.Yj()),capabilities:l.YO(l.Yj()),task_context_template:l.Yj().nullable(),avatar_url:l.Yj().nullable(),system_agent:l.zM(),max_tokens_per_job:l.ai().int().min(0),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0,telegram_offset:!0,capabilities:!0,system_agent:!0}).extend({active:l.zM().default(!0),is_default:l.zM().default(!1),role:u.default("agent"),orchestrator_mode:r.nullable().optional(),telegram_bot_token:l.Yj().nullable().optional(),telegram_bot_username:l.Yj().nullable().optional(),requires_approval:l.YO(l.Yj()).default([]),task_context_template:l.Yj().nullable().optional(),avatar_url:l.Yj().nullable().optional(),max_tokens_per_job:l.ai().int().min(0).max(5e5).default(0)});let x=l.ai().int().min(0),y=l.ai().int().min(0);l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),agent_id:l.Yj().guid().nullable(),status:o,channel:i,task:l.Yj().min(1),original_task:l.Yj().nullable(),chat_id:l.Yj().nullable(),system_prompt:l.Yj().nullable(),messages:l.YO(l.g1(l.Yj(),l.L5())),tools_used:l.YO(l.Yj()),turn:l.ai().int().min(0),result:l.Yj().nullable(),error:l.Yj().nullable(),chain_count:x,request_id:l.Yj().nullable(),parent_job_id:l.Yj().guid().nullable(),parent_request_id:l.Yj().nullable(),total_duration_ms:l.ai().int().min(0),input_tokens:l.ai().int().min(0),output_tokens:l.ai().int().min(0),delegation_depth:y,pending_delegation:l.g1(l.Yj(),l.L5()).nullable(),completed_at:l.Yj().datetime().nullable(),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0,completed_at:!0,messages:!0,tools_used:!0,turn:!0,result:!0,error:!0,chain_count:!0,total_duration_ms:!0,input_tokens:!0,output_tokens:!0,delegation_depth:!0,pending_delegation:!0,parent_request_id:!0}).extend({status:o.default("pending"),original_task:l.Yj().nullable().optional(),chat_id:l.Yj().nullable().optional(),system_prompt:l.Yj().nullable().optional(),request_id:l.Yj().nullable().optional(),parent_job_id:l.Yj().guid().nullable().optional()});let v=l.Yj().max(2e3).nullable(),w=l.Yj().min(1).max(200);l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid(),orchestrator_id:l.Yj().guid(),title:w,description:v,status:n,priority:d,job_id:l.Yj().guid().nullable(),result:l.Yj().nullable(),created_by_agent_id:l.Yj().guid().nullable(),assigned_agent_id:l.Yj().guid().nullable(),input_tokens:l.ai().int().min(0),output_tokens:l.ai().int().min(0),cost_usd:l.ai().min(0),depends_on:l.YO(l.Yj().guid()),context:l.g1(l.Yj(),l.L5()),root_job_id:l.Yj().guid().nullable(),locked_at:l.Yj().datetime().nullable(),locked_by:l.Yj().nullable(),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0,job_id:!0,result:!0,created_by_agent_id:!0,assigned_agent_id:!0,input_tokens:!0,output_tokens:!0,cost_usd:!0,depends_on:!0,context:!0,root_job_id:!0,locked_at:!0,locked_by:!0}).extend({status:n.default("todo"),priority:d.default("medium"),description:v.optional(),depends_on:l.YO(l.Yj().guid()).default([]),context:l.g1(l.Yj(),l.L5()).default({}),root_job_id:l.Yj().guid().nullable().optional()}),l.Ik({id:l.Yj().guid(),owner_user_id:l.Yj().guid(),name:l.Yj().min(1),type:l.k5(["google-oauth","notion-oauth","airtable-oauth"]),payload:l.Yj(),created_at:l.p6().nullable(),updated_at:l.p6().nullable()}),l.Ik({clientId:l.Yj(),clientSecret:l.Yj(),refreshToken:l.Yj().nullable(),accessToken:l.Yj(),expiresAt:l.Yj().nullable(),scopes:l.Yj(),accountName:l.Yj(),tokenUrl:l.Yj().url()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),name:l.Yj().min(1).max(120),slug:l.Yj().min(1).max(80).regex(/^[a-z0-9-]+$/),base_url:l.Yj().nullable(),api_key:l.Yj().nullable(),active:l.zM(),auth_type:s,credential_id:l.Yj().guid().nullable(),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0}).extend({active:l.zM().default(!0),auth_type:s.default("api_key"),base_url:l.Yj().nullable().optional(),api_key:l.Yj().nullable().optional(),credential_id:l.Yj().guid().nullable().optional()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),job_id:l.Yj().guid().nullable(),tool_name:l.Yj().min(1),tool_input:l.g1(l.Yj(),l.L5()).nullable(),tool_output:l.Yj().nullable(),duration_ms:l.ai().int().min(0).nullable(),turn:l.ai().int().min(0).nullable(),created_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0}).extend({tool_input:l.g1(l.Yj(),l.L5()).nullable().optional(),tool_output:l.Yj().nullable().optional(),duration_ms:l.ai().int().min(0).nullable().optional(),turn:l.ai().int().min(0).nullable().optional()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),job_id:l.Yj().guid(),agent_id:l.Yj().guid().nullable(),tool_name:l.Yj().min(1),tool_input:l.g1(l.Yj(),l.L5()),status:c,requested_at:l.Yj().datetime(),resolved_at:l.Yj().datetime().nullable(),resolved_by:l.Yj().nullable(),expires_at:l.Yj().datetime().nullable(),notes:l.Yj().nullable()}).strict().omit({id:!0,requested_at:!0,resolved_at:!0,resolved_by:!0,expires_at:!0}).extend({status:c.default("pending"),notes:l.Yj().nullable().optional()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),agent_id:l.Yj().guid().nullable(),tool_name:l.Yj().min(1),action:m,condition_json:l.g1(l.Yj(),l.L5()),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0}).extend({agent_id:l.Yj().guid().nullable().optional(),condition_json:l.g1(l.Yj(),l.L5()).default({})});let I=l.ai().int().min(1).max(5);l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),agent_id:l.Yj().guid().nullable(),fact:l.Yj().min(1),category:p,importance:I,source:_,skill_tags:l.YO(l.Yj().max(60)),memory_layer:b.nullable(),valid_from:l.Yj().datetime().nullable(),valid_to:l.Yj().datetime().nullable(),fact_hash:l.Yj().nullable(),archived:l.zM(),last_accessed_at:l.Yj().datetime().nullable(),access_count:l.ai().int().min(0),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0,fact_hash:!0,archived:!0,last_accessed_at:!0,access_count:!0,valid_from:!0,valid_to:!0}).extend({agent_id:l.Yj().guid().nullable().optional(),category:p.default("context"),importance:I.default(3),source:_.default("manual"),skill_tags:l.YO(l.Yj().max(60)).max(20).default([]),memory_layer:b.nullable().optional()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),agent_id:l.Yj().guid().nullable(),name:l.Yj().min(1).max(120),slug:l.Yj().min(1).max(80).regex(/^[a-z0-9-]+$/),task_template:l.Yj().min(1),active:l.zM(),secret:l.Yj().nullable(),last_triggered_at:l.Yj().datetime().nullable(),trigger_count:l.ai().int().min(0),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0,secret:!0,last_triggered_at:!0,trigger_count:!0}).extend({active:l.zM().default(!0)});let T=l.Ik({name:l.Yj().min(1),slug:l.Yj().min(1).regex(/^[a-z0-9-]+$/),risk:h,requires_approval:l.zM()}).strict(),C=l.Ik({label:l.Yj().min(1),description:l.Yj().min(1),type:l.k5(["connector_slug","manual"]),value:l.Yj().optional(),critical:l.zM()}).strict();l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),name:l.Yj().min(1).max(120),slug:l.Yj().min(1).max(80).regex(/^[a-z0-9-]+$/),content:l.Yj().min(1),active:l.zM(),description:l.Yj().max(300).nullable(),default_content:l.Yj().nullable(),content_overridden:l.zM(),required_config:l.YO(C),operations:l.YO(T),required_builtins:l.YO(l.Yj()),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0}).extend({active:l.zM().default(!0),description:l.Yj().max(300).nullable().optional(),default_content:l.Yj().nullable().optional(),content_overridden:l.zM().default(!1),required_config:l.YO(C).default([]),operations:l.YO(T).default([]),required_builtins:l.YO(l.Yj()).default([])}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid(),agent_id:l.Yj().guid(),skill_id:l.Yj().guid(),approval_overrides:l.g1(l.Yj(),l.zM()),use_custom_instructions:l.zM(),enabled_operations:l.YO(l.Yj()).nullable(),created_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0}).extend({approval_overrides:l.g1(l.Yj(),l.zM()).default({}),use_custom_instructions:l.zM().default(!1),enabled_operations:l.YO(l.Yj()).nullable().optional()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),agent_id:l.Yj().guid(),type:j,name:l.Yj().min(1).max(120),cron_expr:l.Yj().min(1),task:l.Yj().nullable(),objectives:l.Yj().nullable(),active:l.zM(),last_run:l.Yj().datetime().nullable(),next_run:l.Yj().datetime().nullable(),last_status:Y.nullable(),chat_id:l.Yj().nullable(),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0,last_run:!0,next_run:!0,last_status:!0}).extend({type:j.default("cron"),active:l.zM().default(!0),task:l.Yj().nullable().optional(),objectives:l.Yj().nullable().optional(),chat_id:l.Yj().nullable().optional()}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid(),provider:l.Yj().min(1),api_key:l.Yj(),base_url:l.Yj().nullable(),nickname:l.Yj().max(80).nullable(),is_active:l.zM(),created_at:l.Yj().datetime(),updated_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0,updated_at:!0}).extend({api_key:l.Yj().default(""),base_url:l.Yj().nullable().optional(),nickname:l.Yj().max(80).nullable().optional(),is_active:l.zM().default(!0)}),l.Ik({id:l.Yj().guid(),entity_id:l.Yj().guid().nullable(),agent_id:l.Yj().guid().nullable(),task:l.Yj().min(1),result:l.Yj().nullable(),success:l.zM(),tools_used:l.YO(l.Yj()),tokens_used:l.ai().int().min(0).nullable(),input_tokens:l.ai().int().min(0).nullable(),output_tokens:l.ai().int().min(0).nullable(),duration_ms:l.ai().int().min(0).nullable(),key_source:g.nullable(),created_at:l.Yj().datetime()}).strict().omit({id:!0,created_at:!0}).extend({success:l.zM().default(!0),tools_used:l.YO(l.Yj()).default([]),result:l.Yj().nullable().optional(),tokens_used:l.ai().int().min(0).nullable().optional(),input_tokens:l.ai().int().min(0).nullable().optional(),output_tokens:l.ai().int().min(0).nullable().optional(),duration_ms:l.ai().int().min(0).nullable().optional(),key_source:g.nullable().optional()});let M=["https://www.googleapis.com/auth/userinfo.email","openid"];[...M],[...M],[...M],[...M];let z=l.k5(["propose_confirm","destructive_gate","fully_autonomous"]);l.Ik({createAgent:l.zM(),createSkill:l.zM(),updateSkill:l.zM(),assignSkill:l.zM(),createMcp:l.zM(),createConnector:l.zM(),autonomy:z});let O={createAgent:!0,createSkill:!0,updateSkill:!0,assignSkill:!0,createMcp:!0,createConnector:!0,autonomy:"propose_confirm"},A=[{slug:"notion",label:"Notion",authType:"api_key",docsHint:"Create a Notion integration at notion.so/my-integrations and copy its internal secret."},{slug:"notion-oauth",label:"Notion (OAuth)",authType:"oauth2",credentialType:"notion-oauth",docsHint:"Public Integration via OAuth — create one at notion.so/my-integrations (Public type) and authorize from your dashboard."},{slug:"google-drive",label:"Google Drive",authType:"oauth2",credentialType:"google-oauth",docsHint:"OAuth flow — uses your Google credential (create one under Credentials)."},{slug:"gmail",label:"Gmail",authType:"oauth2",credentialType:"google-oauth",docsHint:"OAuth flow — uses your Google credential (create one under Credentials)."},{slug:"google-sheets",label:"Google Sheets",authType:"oauth2",credentialType:"google-oauth",docsHint:"OAuth flow — uses your Google credential (create one under Credentials)."},{slug:"google-docs",label:"Google Docs",authType:"oauth2",credentialType:"google-oauth",docsHint:"OAuth flow — uses your Google credential (create one under Credentials)."},{slug:"airtable-oauth",label:"Airtable (OAuth)",authType:"oauth2",credentialType:"airtable-oauth",docsHint:"OAuth flow for Airtable Public Integrations (recommended)."},{slug:"airtable",label:"Airtable",authType:"api_key",docsHint:"Personal Access Token — airtable.com/create/tokens."},{slug:"apify",label:"Apify",authType:"api_key",docsHint:"Token API Apify — console.apify.com/account/integrations."},{slug:"firecrawl",label:"Firecrawl",authType:"api_key",docsHint:"API key Firecrawl — firecrawl.dev/account."},{slug:"tavily",label:"Tavily",authType:"api_key",docsHint:"API key Tavily — app.tavily.com."}],W={anthropic:[{modelId:"claude-opus-4-8",label:"Claude Opus 4.8",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:2e5},{modelId:"claude-sonnet-4-6",label:"Claude Sonnet 4.6",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:2e5},{modelId:"claude-haiku-4-5-20251001",label:"Claude Haiku 4.5",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:2e5}],openai:[{modelId:"gpt-5",label:"GPT-5",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:4e5},{modelId:"gpt-5-mini",label:"GPT-5 mini",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:4e5}],google:[{modelId:"gemini-2.0-flash",label:"Gemini 2.0 Flash",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:1048576},{modelId:"gemini-2.5-pro",label:"Gemini 2.5 Pro",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:1048576}],groq:[{modelId:"llama-3.3-70b-versatile",label:"Llama 3.3 70B",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:131072}],mistral:[{modelId:"mistral-large-latest",label:"Mistral Large",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:131072}],openrouter:[{modelId:"anthropic/claude-haiku-4.5",label:"Claude Haiku 4.5",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:2e5},{modelId:"anthropic/claude-opus-4.7",label:"Claude Opus 4.7",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:1e6},{modelId:"anthropic/claude-opus-4.7-fast",label:"Claude Opus 4.7 (fast)",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:1e6},{modelId:"anthropic/claude-opus-4.8",label:"Claude Opus 4.8",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:1e6},{modelId:"anthropic/claude-opus-4.8-fast",label:"Claude Opus 4.8 (fast)",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:1e6},{modelId:"anthropic/claude-sonnet-4.6",label:"Claude Sonnet 4.6",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:1e6},{modelId:"deepseek/deepseek-v3.2",label:"DeepSeek V3.2",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:131072},{modelId:"deepseek/deepseek-v4-flash",label:"DeepSeek V4 Flash",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:1048576},{modelId:"deepseek/deepseek-v4-pro",label:"DeepSeek V4 Pro",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:1048576},{modelId:"google/gemini-3.1-flash-lite-preview",label:"Gemini 3.1 Flash Lite (preview)",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:1048576},{modelId:"google/gemini-3.1-pro-preview",label:"Gemini 3.1 Pro (preview)",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:1048576},{modelId:"google/gemini-3.5-flash",label:"Gemini 3.5 Flash",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:1048576},{modelId:"google/gemma-4-31b-it",label:"Gemma 4 31B-IT",capabilities:{tools:!0,forcedToolChoice:!0},contextWindow:262144},{modelId:"minimax/minimax-m3",label:"MiniMax M3",capabilities:{tools:!0,forcedToolChoice:!1,reasoning:!0},contextWindow:1048576}]};function G(e,t){return W[e]?.find(e=>e.modelId===t)}let L={anthropic:"Anthropic",openai:"OpenAI",google:"Google",deepseek:"DeepSeek",minimax:"MiniMax",mistral:"Mistral",meta:"Meta",qwen:"Qwen","meta-llama":"Meta"};function S(e){let t=new Map;for(let a of e){let e=function(e){let t=e.indexOf("/");if(t<0)return null;let a=e.slice(0,t);return L[a]??a.charAt(0).toUpperCase()+a.slice(1)}(a.modelId),l=t.get(e)??[];l.push(a),t.set(e,l)}return[...t.entries()].map(([e,t])=>({group:e,models:[...t].sort((e,t)=>e.label.localeCompare(t.label))})).sort((e,t)=>(e.group??"").localeCompare(t.group??""))}},14308:(e,t,a)=>{a.d(t,{A:()=>n});var l=a(3680),i=a(78604),o=a(51869);function n({open:e,title:t,message:a,confirmLabel:d="Confirm",cancelLabel:u="Cancel",destructive:r=!0,onConfirm:s,onCancel:c}){let m=(0,i.useRef)(null),[p,_]=(0,i.useState)(!1);return((0,i.useEffect)(()=>{_(!0)},[]),(0,i.useEffect)(()=>{if(e)return m.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&c()}},[e,c]),e&&p)?(0,o.createPortal)((0,l.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",className:"fixed inset-0 z-50 flex items-center justify-center px-4 text-left",children:[(0,l.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:c,"aria-hidden":"true"}),(0,l.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl p-6 max-w-md w-full shadow-2xl",children:[(0,l.jsx)("h2",{id:"confirm-dialog-title",className:"text-base font-semibold text-ink",children:t}),a&&(0,l.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:a}),(0,l.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,l.jsx)("button",{ref:m,type:"button",onClick:c,className:"px-4 py-2 text-sm font-medium border border-rule text-ink-2 rounded-lg hover:border-rule hover:text-ink transition-colors",children:u}),(0,l.jsx)("button",{type:"button",onClick:s,className:`px-4 py-2 text-sm font-semibold rounded-lg transition-colors ${r?"bg-err hover:brightness-[0.94] text-ink":"bg-ink hover:brightness-[0.92] text-canvas"}`,children:d})]})]})]}),document.body):null}}}]);
@@ -0,0 +1,2 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3990],{119:(e,t,n)=>{"use strict";n.d(t,{default:()=>E});var l=n(3680),s=n(78604),r=n(63363),a=n.n(r),i=n(27540),o=n(39504),d=n(22799),c=n(56662),x=n(61453),p=n(81906),u=n(80957),h=n(14099),m=n(26772),g=n(64678);let b=(0,g.createServerReference)("40dd345d903fe6038aa991e0d968ff178175882e76",g.callServer,void 0,g.findSourceMapURL,"listAgentWorkspacesAction");var v=n(60705);let f=(0,g.createServerReference)("60d33abe965baee12ec705d093bdd07654d00f0e22",g.callServer,void 0,g.findSourceMapURL,"listWorkspaceFilesAction"),k=(0,g.createServerReference)("708a8804d4c430873c5b65db43c98c43242eedaa68",g.callServer,void 0,g.findSourceMapURL,"uploadToWorkspaceAction"),j=(0,g.createServerReference)("70c07e81341877e5e3d66c5a105d95552fec935b4b",g.callServer,void 0,g.findSourceMapURL,"deleteWorkspaceFileAction"),N=(0,g.createServerReference)("70ee6bc3c68327436b7c4c9a6a288eb852a0c29082",g.callServer,void 0,g.findSourceMapURL,"addAgentWorkspaceAction"),w=(0,g.createServerReference)("403efba0f740b490b80e06367cb020a727cfe0efd9",g.callServer,void 0,g.findSourceMapURL,"removeAgentWorkspaceAction");var y=n(14308),S=n(12120),C=n(63217),A=n(37955),I=n(81630);function M({glyph:e,name:t,description:n,meta:s,actions:r,expanded:a,className:i=""}){return(0,l.jsxs)("div",{className:`overflow-hidden rounded-[10px] border border-rule-2 bg-paper ${i}`,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3.5 px-4 py-3.5",children:[e&&(0,l.jsx)("div",{className:"flex-shrink-0",children:e}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("div",{className:"text-[13.5px] font-medium leading-[1.2] text-ink",children:t}),n&&(0,l.jsx)("div",{className:"mt-0.5 truncate text-[12px] leading-[1.3] text-ink-3",children:n})]}),s&&(0,l.jsx)("div",{className:"flex-shrink-0 font-mono text-[10.5px] tracking-[0.04em] text-ink-4",children:s}),r&&(0,l.jsx)("div",{className:"flex flex-shrink-0 items-center gap-2",children:r})]}),a&&(0,l.jsx)("div",{className:"space-y-2 border-t border-rule-2 bg-canvas/40 px-4 py-3",children:a})]})}function R({onClick:e,title:t,children:n,ariaLabel:s}){return(0,l.jsx)("button",{type:"button",onClick:e,title:t,"aria-label":s??t,className:"flex h-7 w-7 items-center justify-center rounded-md border border-rule text-ink-3 transition-colors hover:bg-hover hover:text-ink",children:n})}var $=n(35196),L=n(21021);let _=(0,g.createServerReference)("78387ce7c2490d9e4084990b4dcfdc1611724686e5",g.callServer,void 0,g.findSourceMapURL,"setAgentConnectorAssignmentAction"),O=(0,g.createServerReference)("7804a10eab6db5a571bf689eb41c33f0ea7e323820",g.callServer,void 0,g.findSourceMapURL,"setAgentMcpServerAssignmentAction");function T({onClick:e,href:t,children:n,className:s=""}){let r=`flex h-[42px] w-full items-center justify-center gap-2 rounded-[10px] border border-dashed border-rule bg-paper/40 text-[13px] font-medium text-ink-3 transition-colors hover:bg-paper/60 hover:text-ink-2 ${s}`,a=(0,l.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:(0,l.jsx)("path",{d:"M7 2v10M2 7h10"})});return t?(0,l.jsxs)("a",{href:t,className:r,children:[a,n]}):(0,l.jsxs)("button",{type:"button",onClick:e,className:r,children:[a,n]})}function U({agentId:e,connectors:t,mcpServers:n}){let[r,a]=(0,s.useState)(()=>{let e=new Map;for(let n of t)e.set(n.connectorId,{assigned:n.assigned,enabledOperations:n.enabledOperations});return e}),[i,d]=(0,s.useState)(()=>{let e=new Map;for(let t of n)e.set(t.mcpServerId,{assigned:t.assigned,enabledTools:t.enabledTools});return e}),[c,x]=(0,s.useState)(new Set),p=(0,s.useRef)(new Map),u=(0,s.useCallback)((t,n,l)=>{let s=`conn:${t}`,r=p.current.get(s);r&&clearTimeout(r);let a=setTimeout(()=>{p.current.delete(s),_(e,t,n,l).then(e=>{e.ok||o.oR.error(e.message)})},300);p.current.set(s,a)},[e]),h=(0,s.useCallback)((t,n,l)=>{let s=`mcp:${t}`,r=p.current.get(s);r&&clearTimeout(r);let a=setTimeout(()=>{p.current.delete(s),O(e,t,n,l).then(e=>{e.ok||o.oR.error(e.message)})},300);p.current.set(s,a)},[e]);function m(e,t){a(n=>{let l=new Map(n);return l.set(e,{assigned:t,enabledOperations:null}),u(e,t,null),l}),t||v(e)}function g(e,t){d(n=>{let l=new Map(n);return l.set(e,{assigned:t,enabledTools:null}),h(e,t,null),l}),t||v(e)}function b(e){x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function v(e){x(t=>{let n=new Set(t);return n.delete(e),n})}let{connected:f,available:k}=(0,s.useMemo)(()=>{let e=[],l=[];for(let n of t){let t=r.get(n.connectorId)??n,s={kind:"api",row:n};t.assigned?e.push(s):l.push(s)}for(let t of n){let n=i.get(t.mcpServerId)??t,s={kind:"mcp",row:t};n.assigned?e.push(s):l.push(s)}return{connected:e,available:l}},[t,n,r,i]);if(0===t.length&&0===n.length)return(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)("p",{className:"text-[12.5px] text-ink-3",children:"No connectors or MCP servers installed on this workspace yet. Add some first; you'll then be able to attach them to this agent."}),(0,l.jsx)(T,{href:"/connectors",children:"Browse connectors marketplace"}),(0,l.jsx)(T,{href:"/mcp",children:"Browse MCP servers"})]});return(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsxs)(F,{label:`Connected \xb7 ${f.length}`,hint:"Revoke any to detach everywhere. Per-op (API) / per-tool (MCP) whitelist via the gear icon.",children:[0===f.length&&(0,l.jsx)("p",{className:"text-[12.5px] text-ink-3",children:"No connectors or MCP servers attached to this agent yet. Pick from the list below."}),f.map(e=>j(e,!0))]}),k.length>0&&(0,l.jsx)(F,{label:`Available on this workspace \xb7 ${k.length}`,hint:"Already installed at the workspace level; click + to attach to this agent.",children:k.map(e=>j(e,!1))}),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsx)(T,{href:"/connectors",children:"Browse connectors marketplace"}),(0,l.jsx)(T,{href:"/mcp",children:"Browse MCP servers"})]})]});function j(e,t){if("api"===e.kind){let n=e.row,s=r.get(n.connectorId)??n,i=c.has(n.connectorId),o=n.availableOperations,d=null===s.enabledOperations?`all ${o.length} ops`:`${s.enabledOperations.length} of ${o.length} ops`;return(0,l.jsx)(M,{glyph:(0,l.jsx)(I.A,{variant:"conn",size:"lg",shape:"square",background:L.a[n.slug],children:(0,l.jsx)("span",{className:"font-mono text-[10.5px] font-semibold",children:(0,L.d)(n.slug,n.label)})}),name:(0,l.jsxs)(l.Fragment,{children:[n.label,(0,l.jsx)(P,{kind:"API"})]}),description:n.credentialName??void 0,meta:t?d:`${o.length} ops`,actions:t?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(R,{title:i?"Hide operations":"Configure operations",ariaLabel:"Configure",onClick:()=>b(n.connectorId),children:(0,l.jsx)(W,{})}),(0,l.jsx)(R,{title:"Detach from this agent",ariaLabel:"Detach",onClick:()=>m(n.connectorId,!1),children:(0,l.jsx)(B,{})})]}):(0,l.jsx)(R,{title:"Attach to this agent",ariaLabel:"Attach",onClick:()=>m(n.connectorId,!0),children:(0,l.jsx)(K,{})}),expanded:t&&i?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(z,{onClick:()=>{var e;return e=n.connectorId,void a(t=>{let n=new Map(t);return n.set(e,{assigned:!0,enabledOperations:null}),u(e,!0,null),n})},children:"Enable all"}),(0,l.jsx)(z,{onClick:()=>m(n.connectorId,!1),children:"Uncheck all"})]}),(0,l.jsx)("div",{className:"space-y-0.5",children:o.map(e=>{let t=null===s.enabledOperations||s.enabledOperations.includes(e.slug);return(0,l.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 rounded px-1 py-1 text-[12.5px] transition-colors hover:bg-hover",children:[(0,l.jsx)("input",{type:"checkbox",checked:t,onChange:()=>{var t,l;return t=n.connectorId,l=e.slug,void a(e=>{let n,s=e.get(t)??{assigned:!0,enabledOperations:null},r=o.map(e=>e.slug);null!==(n=null===s.enabledOperations?r.filter(e=>e!==l):s.enabledOperations.includes(l)?s.enabledOperations.filter(e=>e!==l):[...s.enabledOperations,l])&&n.length===r.length&&(n=null);let a=new Map(e);return null!==n&&0===n.length?(a.set(t,{assigned:!1,enabledOperations:null}),u(t,!1,null),v(t)):(a.set(t,{...s,enabledOperations:n}),u(t,!0,n)),a})},className:"shrink-0 accent-agent-vivid"}),(0,l.jsx)("code",{className:"shrink-0 font-mono text-[11px] text-ink-2",children:e.slug}),(0,l.jsx)(D,{op:e}),e.description&&(0,l.jsx)("span",{className:"truncate text-[11px] italic text-ink-4",children:e.description})]},e.slug)})})]}):null},`conn:${n.connectorId}`)}let n=e.row,s=i.get(n.mcpServerId)??n,o=c.has(n.mcpServerId),x=n.availableTools.map(e=>e.name),p=null===s.enabledTools?`all ${x.length} tools`:`${s.enabledTools.length} of ${x.length} tools`;return(0,l.jsx)(M,{glyph:(0,l.jsx)(I.A,{variant:"conn",size:"lg",shape:"square",children:(0,l.jsx)("span",{className:"font-mono text-[10.5px] font-semibold",children:"MCP"})}),name:(0,l.jsxs)(l.Fragment,{children:[n.label,(0,l.jsx)(P,{kind:"MCP"})]}),meta:t?p:`${x.length} tools`,actions:t?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(R,{title:o?"Hide tools":"Configure tools",ariaLabel:"Configure",onClick:()=>b(n.mcpServerId),children:(0,l.jsx)(W,{})}),(0,l.jsx)(R,{title:"Detach from this agent",ariaLabel:"Detach",onClick:()=>g(n.mcpServerId,!1),children:(0,l.jsx)(B,{})})]}):(0,l.jsx)(R,{title:"Attach to this agent",ariaLabel:"Attach",onClick:()=>g(n.mcpServerId,!0),children:(0,l.jsx)(K,{})}),expanded:t&&o?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(z,{onClick:()=>{var e;return e=n.mcpServerId,void d(t=>{let n=new Map(t);return n.set(e,{assigned:!0,enabledTools:null}),h(e,!0,null),n})},children:"Enable all"}),(0,l.jsx)(z,{onClick:()=>g(n.mcpServerId,!1),children:"Uncheck all"})]}),(0,l.jsx)("div",{className:"space-y-0.5",children:n.availableTools.map(e=>{let t=null===s.enabledTools||s.enabledTools.includes(e.name);return(0,l.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 rounded px-1 py-1 text-[12.5px] transition-colors hover:bg-hover",children:[(0,l.jsx)("input",{type:"checkbox",checked:t,onChange:()=>{var t,l;return t=n.mcpServerId,l=e.name,void d(e=>{let n,s=e.get(t)??{assigned:!0,enabledTools:null};null!==(n=null===s.enabledTools?x.filter(e=>e!==l):s.enabledTools.includes(l)?s.enabledTools.filter(e=>e!==l):[...s.enabledTools,l])&&n.length===x.length&&(n=null);let r=new Map(e);return null!==n&&0===n.length?(r.set(t,{assigned:!1,enabledTools:null}),h(t,!1,null),v(t)):(r.set(t,{assigned:!0,enabledTools:n}),h(t,!0,n)),r})},className:"shrink-0 accent-agent-vivid"}),(0,l.jsx)("code",{className:"shrink-0 font-mono text-[11px] text-ink-2",children:e.name}),e.description&&(0,l.jsx)("span",{className:"truncate text-[11px] italic text-ink-4",children:e.description})]},e.name)})})]}):null},`mcp:${n.mcpServerId}`)}}function F({label:e,hint:t,children:n}){return(0,l.jsxs)("section",{className:"space-y-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"font-mono text-[10.5px] uppercase tracking-[0.12em] text-ink-4",children:e}),t&&(0,l.jsx)("p",{className:"mt-1 text-[11.5px] leading-[1.5] text-ink-3",children:t})]}),(0,l.jsx)("div",{className:"space-y-2",children:n})]})}function P({kind:e}){return(0,l.jsx)("span",{className:"ml-2 font-mono text-[10px] uppercase tracking-[0.04em] text-ink-4",children:e})}function z({children:e,onClick:t}){return(0,l.jsx)("button",{type:"button",onClick:t,className:"rounded border border-rule px-2 py-1 text-[11px] font-medium text-ink-3 transition-colors hover:border-rule-2 hover:text-ink",children:e})}function D({op:e}){let t="inline-flex shrink-0 items-center rounded px-1.5 py-0.5 text-[9.5px] font-semibold uppercase tracking-wider";return"read"===e.risk?(0,l.jsx)("span",{className:`${t} bg-agent-vivid/10 text-ok`,children:"read"}):"write"===e.risk?(0,l.jsxs)("span",{className:`${t} bg-warn/10 text-warn`,children:[e.requiresApproval?"⚠ ":"","write"]}):(0,l.jsx)("span",{className:`${t} bg-warn-bg text-err`,children:"⚠ destr"})}function W(){return(0,l.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,l.jsx)("circle",{cx:"8",cy:"8",r:"2"}),(0,l.jsx)("circle",{cx:"8",cy:"8",r:"6"})]})}function B(){return(0,l.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:(0,l.jsx)("path",{d:"M3 3l6 6M9 3l-6 6"})})}function K(){return(0,l.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:(0,l.jsx)("path",{d:"M6 2v8M2 6h8"})})}function E({agent:e,peers:t,allAgents:n,llmKeys:r,connectors:a,mcpServers:d,jobs:c,attachedSkills:x}){var p,u;let h=(0,i.useRouter)(),[m,g]=(0,s.useTransition)(),[f,k]=(0,s.useState)("overview"),j=(p=e.role??null,u=e.orchestratorMode??null,"orchestrator"===p&&"planner"===u?"planner":"orchestrator"===p?"router":"worker"),N=(0,s.useMemo)(()=>r.filter(e=>e.isActive),[r]),w=e.llmKeyId??N[0]?.id??"",[y,A]=(0,s.useState)(e.name),[I,M]=(0,s.useState)(e.personality??""),[R,L]=(0,s.useState)(j),[_,O]=(0,s.useState)(e.subAgentIds),[T,F]=(0,s.useState)(w),[P,z]=(0,s.useState)(e.fallbackChain??[]),[D,W]=(0,s.useState)(e.model??""),[B,K]=(0,s.useState)(e.avatarUrl??null),[H,J]=(0,s.useState)([]),[Y,Z]=(0,s.useState)(!1);(0,s.useEffect)(()=>{b(e.id).then(e=>{e.ok&&J(e.data),Z(!0)})},[e.id]);let et=(0,s.useMemo)(()=>r.find(e=>e.id===T)??null,[r,T]),en=0===N.length,el=(e.name||e.slug).slice(0,1).toUpperCase(),ea=a.filter(e=>e.assigned),ei=ea.length,eo=d.filter(e=>e.assigned).length,ed="worker"===R?0:_.length,ec=(I||"").split(/\n+/).filter(Boolean)[0]?.trim()??"No description yet.",ex=c.length,ep=c.filter(e=>"completed"===e.status).length,eu=y!==e.name||I!==(e.personality??"")||R!==j||JSON.stringify([..._].sort())!==JSON.stringify([...e.subAgentIds].sort())||T!==w||JSON.stringify(P)!==JSON.stringify(e.fallbackChain??[])||D!==(e.model??"")||B!==(e.avatarUrl??null);return(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)(G,{}),(0,l.jsx)(q,{agents:n,activeId:e.id}),(0,l.jsx)(V,{initial:el,avatarUrl:B,name:e.name,personaPreview:ec,role:j,slug:e.slug,model:e.model,llmKeyLabel:r.find(t=>t.id===e.llmKeyId)?.nickname??(r.find(t=>t.id===e.llmKeyId)?.provider?(0,C.R)(r.find(t=>t.id===e.llmKeyId).provider):null),stats:{connectors:ei,mcps:eo,subAgents:ed,skills:x.length,totalRuns:ex,successfulRuns:ep},onConfigure:()=>k("settings")}),(0,l.jsx)(Q,{tab:f,onChange:k,counts:{skills:x.length,connectors:ei+eo,runs:ex}}),"overview"===f&&(0,l.jsx)(ee,{jobs:c,attachedSkills:x,connectorsAssigned:ea,mcpsAssignedCount:eo,onOpenSkills:()=>k("skills"),onOpenConnectors:()=>k("connectors")}),"skills"===f&&(0,l.jsx)(es,{skills:x}),"connectors"===f&&(0,l.jsx)(X,{children:(0,l.jsx)(U,{agentId:e.id,connectors:a,mcpServers:d},e.id)}),"runs"===f&&(0,l.jsx)($.default,{jobs:c,agents:[{id:e.id,name:e.name,slug:e.slug},...t],agentId:e.id}),"settings"===f&&(0,l.jsx)(er,{name:y,slug:e.slug,avatarUrl:B,personality:I,role:R,showSubAgents:"worker"!==R,subAgentIds:_,peers:t,llmKeyId:T,fallbackChain:P,activeKeys:N,selectedKey:et,model:D,noLlmKeys:en,workspaces:H,workspacesLoaded:Y,onWorkspacesChange:J,mcpServers:d,agentId:e.id,dirty:eu,isPending:m,onChangeName:A,onChangeAvatar:K,onChangePersonality:M,onChangeRole:L,onToggleSubAgent:function(e){O(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},onToggleFallback:function(e){z(t=>{if(t.some(t=>t.keyId===e))return t.filter(t=>t.keyId!==e);let n=r.find(t=>t.id===e);return[...t,{keyId:e,model:n?S.SV[n.provider]?.[0]?.modelId??"":""}]})},onChangeFallbackModel:function(e,t){z(n=>n.map(n=>n.keyId===e?{...n,model:t}:n))},onChangeLlmKey:function(e){let t=r.find(t=>t.id===e);F(e),W(t?S.SV[t.provider]?.[0]?.modelId??"":"")},onChangeModel:function(e){W(e)},onSave:function(){if(en||m||!eu)return;let t={id:e.id,name:y,personality:I,model:D,llmKeyId:T||null,fallbackChain:P.filter(e=>e.keyId!==T),role:R,subAgentIds:"worker"===R?[]:_,avatarUrl:B};g(async()=>{let e=await (0,v.f)(t);e.ok?(o.oR.success("Agent updated"),h.refresh()):o.oR.error(e.message)})},onReset:function(){A(e.name),M(e.personality??""),L(j),O(e.subAgentIds),F(w),z(e.fallbackChain??[]),W(e.model??""),K(e.avatarUrl??null)}})]})}function G(){return(0,l.jsxs)(a(),{href:"/agents",className:"inline-flex items-center gap-1.5 text-[12.5px] text-ink-3 transition-colors hover:text-ink-2",children:[(0,l.jsx)("span",{className:"text-[14px] leading-none",children:"‹"}),"Back to agents"]})}function q({agents:e,activeId:t}){return e.length<=1?null:(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(e=>{let n=e.id===t;return(0,l.jsxs)(a(),{href:`/agents/${e.id}/edit`,className:["inline-flex h-[34px] items-center gap-2 rounded-full border px-3.5 text-[13px] font-medium transition-colors",n?"border-rule-2 bg-paper text-ink":"border-rule bg-canvas text-ink-3 hover:border-rule-2 hover:text-ink-2"].join(" "),children:[(0,l.jsx)("span",{className:"inline-block h-[7px] w-[7px] rounded-full bg-agent-vivid"}),e.name]},e.id)})})}function V({initial:e,avatarUrl:t,name:n,personaPreview:s,role:r,slug:a,model:i,llmKeyLabel:o,stats:d,onConfigure:c}){let x=d.totalRuns>0?`${Math.round(d.successfulRuns/d.totalRuns*100)}%`:"—";return(0,l.jsxs)("div",{className:"overflow-hidden rounded-2xl border border-rule-2 bg-paper",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-5 p-6 lg:flex-row lg:items-start",children:[t?(0,l.jsx)("img",{src:t,alt:"",className:"h-[80px] w-[80px] flex-shrink-0 rounded-2xl object-cover"}):(0,l.jsx)("div",{className:"flex h-[80px] w-[80px] flex-shrink-0 items-center justify-center rounded-2xl bg-agent-vivid text-[28px] font-semibold text-canvas",children:e}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,l.jsx)("h1",{className:"m-0 text-[22px] font-semibold leading-none tracking-[-0.01em] text-ink",children:n}),(0,l.jsxs)("span",{className:"inline-flex h-[24px] items-center gap-1.5 rounded-full border border-rule-2 bg-canvas px-2.5 text-[11.5px] font-medium text-ink-3",children:[(0,l.jsx)("span",{className:"h-[6px] w-[6px] rounded-full bg-ink-3"}),"Idle"]})]}),(0,l.jsx)("p",{className:"mt-2 text-[13.5px] leading-[1.55] text-ink-3",children:s}),(0,l.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[11.5px] text-ink-3",children:[i&&(0,l.jsxs)("span",{children:[(0,l.jsx)("span",{className:"text-ink-4",children:"Model:"})," ",(0,l.jsx)("code",{className:"rounded border border-rule-2 bg-canvas px-1.5 py-0.5 font-mono text-[11px] text-ink-2",children:i})]}),o&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(H,{}),(0,l.jsxs)("span",{children:[(0,l.jsx)("span",{className:"text-ink-4",children:"LLM:"})," ",(0,l.jsx)("span",{className:"text-ink-2",children:o})]})]}),(0,l.jsx)(H,{}),(0,l.jsxs)("span",{children:[(0,l.jsx)("span",{className:"text-ink-4",children:"Role:"})," ",(0,l.jsx)("span",{className:"capitalize text-ink-2",children:r})]}),(0,l.jsx)(H,{}),(0,l.jsxs)("span",{className:"font-mono text-ink-4",children:["@",a]})]})]}),(0,l.jsx)("div",{className:"flex flex-shrink-0 flex-wrap gap-2",children:(0,l.jsxs)("button",{type:"button",onClick:c,className:"inline-flex h-[34px] items-center gap-1.5 rounded-lg border border-rule bg-paper px-3.5 text-[12.5px] font-medium text-ink-2 transition-colors hover:border-rule-2 hover:text-ink",children:[(0,l.jsx)(Y,{}),"Configure"]})})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-2 px-6 pb-6 sm:grid-cols-3 lg:grid-cols-6",children:[(0,l.jsx)(J,{label:"Skills",value:String(d.skills)}),(0,l.jsx)(J,{label:"Connectors",value:String(d.connectors)}),(0,l.jsx)(J,{label:"MCPs",value:String(d.mcps)}),(0,l.jsx)(J,{label:"Sub-agents",value:"worker"===r?"—":String(d.subAgents),dim:"worker"===r}),(0,l.jsx)(J,{label:"Runs",value:String(d.totalRuns),dim:0===d.totalRuns}),(0,l.jsx)(J,{label:"Success rate",value:x,dim:0===d.totalRuns})]})]})}function H(){return(0,l.jsx)("span",{className:"text-ink-4",children:"\xb7"})}function J({label:e,value:t,dim:n}){return(0,l.jsxs)("div",{className:"rounded-lg border border-rule-2 bg-canvas/40 px-4 py-3",children:[(0,l.jsx)("div",{className:"font-mono text-[9.5px] uppercase tracking-[0.14em] text-ink-4",children:e}),(0,l.jsx)("div",{className:`mt-1.5 text-[20px] font-semibold leading-none tracking-[-0.01em] ${n?"text-ink-4":"text-ink"}`,children:t})]})}function Y(){return(0,l.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,l.jsx)("circle",{cx:"8",cy:"8",r:"2"}),(0,l.jsx)("path",{d:"M8 1v2M8 13v2M1 8h2M13 8h2M3.5 3.5l1.5 1.5M11 11l1.5 1.5M3.5 12.5L5 11M11 5l1.5-1.5"})]})}function Q({tab:e,onChange:t,counts:n}){let s=[{id:"overview",label:"Overview"},{id:"skills",label:"Skills",count:n.skills},{id:"connectors",label:"Connectors",count:n.connectors},{id:"runs",label:"Runs",count:n.runs},{id:"settings",label:"Settings"}];return(0,l.jsx)("div",{className:"flex gap-1 border-b border-rule-2",children:s.map(n=>{let s=e===n.id;return(0,l.jsxs)("button",{type:"button",onClick:()=>t(n.id),className:["relative -mb-px border-b-2 px-4 pt-2.5 pb-3 text-[13.5px] font-medium transition-colors",s?"border-ink text-ink":"border-transparent text-ink-3 hover:text-ink-2"].join(" "),children:[n.label,void 0!==n.count&&n.count>0&&(0,l.jsx)("span",{className:`ml-1.5 font-mono text-[10.5px] ${s?"text-ink-2":"text-ink-4"}`,children:n.count})]},n.id)})})}function X({children:e}){return(0,l.jsx)("div",{className:"rounded-2xl border border-rule-2 bg-paper p-6",children:e})}function Z({label:e,hint:t,right:n}){return(0,l.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"font-mono text-[10.5px] uppercase tracking-[0.12em] text-ink-4",children:e}),t&&(0,l.jsx)("p",{className:"mt-1 text-[12px] leading-[1.5] text-ink-3",children:t})]}),n]})}function ee({jobs:e,attachedSkills:t,connectorsAssigned:n,mcpsAssignedCount:s,onOpenSkills:r,onOpenConnectors:i}){let o=t.length>0,d=n.length>0;return(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3",children:[(0,l.jsx)("div",{className:"lg:col-span-2",children:(0,l.jsx)(X,{children:(0,l.jsx)(et,{jobs:e})})}),(0,l.jsxs)(X,{children:[(0,l.jsx)(Z,{label:`Connectors used \xb7 ${n.length}`,right:d?(0,l.jsx)("button",{type:"button",onClick:i,className:"text-[11.5px] text-ink-3 underline hover:text-ink-2",children:"Manage"}):void 0}),d?(0,l.jsx)("div",{className:"space-y-2",children:n.map(e=>(0,l.jsx)(el,{row:e},e.connectorId))}):(0,l.jsxs)("p",{className:"text-[12.5px] text-ink-3",children:["No connectors assigned yet."," ",(0,l.jsx)("button",{type:"button",onClick:i,className:"underline hover:text-ink-2",children:"Wire one →"})]}),s>0&&(0,l.jsxs)("p",{className:"mt-3 border-t border-rule-2 pt-3 text-[11.5px] text-ink-4",children:["+ ",s," MCP server",s>1?"s":""," attached (Settings → Knowledge)."]})]})]}),(0,l.jsxs)(X,{children:[(0,l.jsx)(Z,{label:`Skills attached \xb7 ${t.length}`,right:o?(0,l.jsx)("button",{type:"button",onClick:r,className:"text-[11.5px] text-ink-3 underline hover:text-ink-2",children:"Manage"}):void 0}),o?(0,l.jsx)("div",{className:"grid grid-cols-1 gap-2 lg:grid-cols-2 xl:grid-cols-3",children:t.map(e=>(0,l.jsx)(en,{skill:e},e.id))}):(0,l.jsxs)("p",{className:"text-[12.5px] text-ink-3",children:["No skills attached yet. Read-only view — manage on the"," ",(0,l.jsx)(a(),{href:"/skills",className:"underline hover:text-ink-2",children:"Skills page"}),"."]})]})]})}function et({jobs:e}){let{data:t,total:n}=(0,s.useMemo)(()=>{let t=new Date;t.setHours(0,0,0,0);let n=[];for(let e=6;e>=0;e-=1){let l=new Date(t.getTime()-864e5*e);n.push({day:l.toLocaleDateString("en-US",{weekday:"short"}),iso:l.toISOString().slice(0,10),runs:0})}let l=new Map(n.map(e=>[e.iso,e])),s=0;for(let t of e){if("completed"!==t.status||!t.createdAt)continue;let e="string"==typeof t.createdAt?new Date(t.createdAt):t.createdAt,n=new Date(e.getFullYear(),e.getMonth(),e.getDate()).toISOString().slice(0,10),r=l.get(n);r&&(r.runs+=1,s+=1)}return{data:n,total:s}},[e]);return(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"mb-3 flex items-baseline gap-2",children:(0,l.jsx)("span",{className:"font-mono text-[10.5px] uppercase tracking-[0.12em] text-ink-4",children:"Runs \xb7 7 days"})}),(0,l.jsxs)("div",{className:"mb-4 flex items-baseline gap-3",children:[(0,l.jsx)("span",{className:"text-[34px] font-semibold leading-none tracking-[-0.015em] text-ink",children:n.toLocaleString()}),(0,l.jsxs)("span",{className:"text-[13.5px] text-ink-3",children:["successful run",1===n?"":"s"]})]}),(0,l.jsx)("div",{className:"h-[200px]",children:(0,l.jsx)(d.u,{width:"100%",height:"100%",children:(0,l.jsxs)(c.Q,{data:t,margin:{top:6,right:10,left:-20,bottom:0},children:[(0,l.jsx)("defs",{children:(0,l.jsxs)("linearGradient",{id:"agentWeeklyFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,l.jsx)("stop",{offset:"0%",stopColor:"var(--c-agent-vivid)",stopOpacity:.55}),(0,l.jsx)("stop",{offset:"100%",stopColor:"var(--c-agent-vivid)",stopOpacity:.05})]})}),(0,l.jsx)(x.d,{stroke:"var(--c-rule-2)",vertical:!1}),(0,l.jsx)(p.W,{dataKey:"day",stroke:"var(--c-ink-4)",tick:{fill:"var(--c-ink-4)",fontSize:11},axisLine:!1,tickLine:!1}),(0,l.jsx)(u.h,{stroke:"var(--c-ink-4)",tick:{fill:"var(--c-ink-4)",fontSize:11},axisLine:!1,tickLine:!1,allowDecimals:!1}),(0,l.jsx)(h.m,{cursor:{stroke:"var(--c-ink-4)",strokeDasharray:"3 3"},contentStyle:{background:"var(--c-paper)",border:"1px solid var(--c-rule)",borderRadius:10,fontSize:12,color:"var(--c-ink)",boxShadow:"0 6px 20px rgba(0,0,0,0.08)"},labelStyle:{color:"var(--c-ink-3)"}}),(0,l.jsx)(m.Gk,{type:"monotone",dataKey:"runs",stroke:"var(--c-agent-vivid)",strokeWidth:2,fill:"url(#agentWeeklyFill)"})]})})})]})}function en({skill:e}){return(0,l.jsx)(M,{glyph:(0,l.jsx)(I.A,{variant:"skill",size:"lg",shape:"square",children:(0,l.jsx)("span",{className:"font-mono text-[10.5px] font-semibold uppercase",children:e.slug.slice(0,2)})}),name:e.name,description:e.description??void 0,meta:`@${e.slug}`,actions:(0,l.jsx)(a(),{href:`/skills/${e.id}/edit`,className:"flex h-7 items-center gap-1 rounded-md border border-rule px-2 text-[11px] font-medium text-ink-3 transition-colors hover:border-rule-2 hover:text-ink",children:"Open ›"})})}function el({row:e}){return(0,l.jsx)(M,{glyph:(0,l.jsx)(I.A,{variant:"conn",size:"lg",shape:"square",background:L.a[e.slug],children:(0,l.jsx)("span",{className:"font-mono text-[10.5px] font-semibold",children:(0,L.d)(e.slug,e.label)})}),name:(0,l.jsxs)(l.Fragment,{children:[e.label,(0,l.jsx)("span",{className:"ml-2 font-mono text-[10px] uppercase tracking-[0.04em] text-ink-4",children:e.slug.toUpperCase()})]}),description:e.credentialName??void 0,actions:(0,l.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.08em] text-ink-3",children:[(0,l.jsx)("span",{className:"h-[6px] w-[6px] rounded-full bg-agent-vivid"}),"on"]})})}function es({skills:e}){return 0===e.length?(0,l.jsx)(X,{children:(0,l.jsx)(Z,{label:"No skills attached",hint:"Read-only view. Manage attachments on the /skills page."})}):(0,l.jsxs)(X,{children:[(0,l.jsx)(Z,{label:`Attached \xb7 ${e.length}`}),(0,l.jsx)("div",{className:"space-y-2",children:e.map(e=>(0,l.jsx)(en,{skill:e},e.id))})]})}function er(e){let{name:t,slug:n,avatarUrl:r,personality:i,role:d,showSubAgents:c,subAgentIds:x,peers:p,llmKeyId:u,fallbackChain:h,activeKeys:m,selectedKey:g,model:v,noLlmKeys:I,workspaces:M,workspacesLoaded:R,onWorkspacesChange:$,mcpServers:L,agentId:_,dirty:O,isPending:T,onChangeName:U,onChangeAvatar:F,onChangePersonality:P,onChangeRole:z,onToggleSubAgent:D,onToggleFallback:W,onChangeFallbackModel:B,onChangeLlmKey:K,onChangeModel:E,onSave:G,onReset:q}=e,V=m.filter(e=>e.id!==u),H=g?S.SV[g.provider]??[]:[],J=!!(0,S.mV)(g?.provider??"",v),[Y,Q]=(0,s.useState)(""),[ee,et]=(0,s.useState)(""),[en,el]=(0,s.useState)(!1),[es,er]=(0,s.useState)(null),[ei,eo]=(0,s.useTransition)(),[ed,ec]=(0,s.useState)({}),[ex,ep]=(0,s.useState)({}),[eu,eh]=(0,s.useState)(""),[em,eg]=(0,s.useState)(!1),[eb,ev]=(0,s.useState)(null),[ef,ek]=(0,s.useTransition)();async function ej(e,t){eg(!0);let n=new FormData;n.append("file",t);let l=await k(_,e,n);if(eg(!1),!l.ok)return void o.oR.error(l.message);o.oR.success(`Uploaded ${l.data.filename}`);let s=await f(_,e);s.ok&&ec(t=>({...t,[e]:s.data}))}return(0,s.useEffect)(()=>{for(let e of M)ex[e.label]||f(_,e.label).then(t=>{t.ok&&ec(n=>({...n,[e.label]:t.data})),ep(t=>({...t,[e.label]:!0}))})},[M,_]),(0,l.jsxs)("div",{className:"space-y-6 pb-24",children:[(0,l.jsxs)(X,{children:[(0,l.jsx)(Z,{label:"Identity",hint:"Slug is immutable. Avatar is used across the app."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,l.jsx)(ea,{label:"Name",children:(0,l.jsx)("input",{type:"text",value:t,onChange:e=>U(e.target.value),placeholder:"Agent name",className:"w-full rounded-lg border border-rule bg-canvas px-3 py-2 text-[13px] text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})}),(0,l.jsx)(ea,{label:"Slug (read-only)",children:(0,l.jsx)("code",{className:"block w-full rounded-lg border border-rule-2 bg-hover px-3 py-2 font-mono text-[11.5px] tracking-[0.02em] text-ink-3",children:n})}),(0,l.jsx)("div",{className:"sm:col-span-2",children:(0,l.jsx)(ea,{label:"Avatar",children:(0,l.jsx)(A.A,{value:r,onChange:F})})})]})]}),(0,l.jsxs)(X,{children:[(0,l.jsx)(Z,{label:"Behavior",hint:"Persona is the system prompt. Updating it invalidates the prompt cache for new jobs."}),(0,l.jsx)(ea,{label:"Persona / system prompt",children:(0,l.jsx)("textarea",{value:i,onChange:e=>P(e.target.value),rows:24,placeholder:"You are a helpful assistant…",className:"min-h-[560px] w-full resize-y rounded-lg border border-rule bg-canvas px-3 py-2 font-mono text-[12.5px] leading-[1.55] text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})}),(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)(ea,{label:"Role",children:(0,l.jsxs)("select",{value:d,onChange:e=>z(e.target.value),className:"w-full rounded-lg border border-rule bg-canvas px-3 py-2 text-[13px] text-ink focus:border-ink-3 focus:outline-none",children:[(0,l.jsx)("option",{value:"worker",children:"Worker — runs its own tools"}),(0,l.jsx)("option",{value:"router",children:"Router — delegates one at a time"}),(0,l.jsx)("option",{value:"planner",children:"Planner — parallel sub-agents"})]})})}),c&&(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)(ea,{label:`Sub-agents \xb7 ${x.length} selected`,children:0===p.length?(0,l.jsx)("p",{className:"text-[12.5px] text-warn",children:"Create at least one worker agent first — orchestrators need someone to delegate to."}):(0,l.jsx)("div",{className:"divide-y divide-rule-2 overflow-hidden rounded-lg border border-rule-2 bg-canvas/30",children:p.map(e=>{let t=x.includes(e.id);return(0,l.jsxs)("label",{className:"flex cursor-pointer items-center gap-3 px-3 py-2 text-[13px] transition-colors hover:bg-hover",children:[(0,l.jsx)("input",{type:"checkbox",checked:t,onChange:()=>D(e.id),className:"accent-agent-vivid"}),(0,l.jsx)("span",{className:"text-ink",children:e.name}),(0,l.jsx)("span",{className:"ml-auto font-mono text-[11px] text-ink-3",children:e.slug})]},e.id)})})})})]}),(0,l.jsxs)(X,{children:[(0,l.jsx)(Z,{label:"Model",hint:"LLM key + model identifier passed to the runner."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,l.jsx)(ea,{label:"LLM provider",children:I?(0,l.jsxs)("p",{className:"text-[12.5px] text-warn",children:["No active LLM keys."," ",(0,l.jsx)(a(),{href:"/llm-providers",className:"underline",children:"Add one"}),"."]}):(0,l.jsx)("select",{value:u,onChange:e=>K(e.target.value),className:"w-full rounded-lg border border-rule bg-canvas px-3 py-2 text-[13px] text-ink focus:border-ink-3 focus:outline-none",children:m.map(e=>(0,l.jsx)("option",{value:e.id,children:(e.nickname??(0,C.R)(e.provider))+" ("+(0,C.R)(e.provider)+")"},e.id))})}),(0,l.jsxs)(ea,{label:"Model",children:[H.length>0&&(0,l.jsxs)("select",{value:J?v:"__custom__",onChange:e=>E("__custom__"===e.target.value?"":e.target.value),className:"mb-2 w-full rounded-lg border border-rule bg-canvas px-3 py-2 text-[13px] text-ink focus:border-ink-3 focus:outline-none",children:[(0,S.eS)(H).map(({group:e,models:t})=>e?(0,l.jsx)("optgroup",{label:e,children:t.map(e=>(0,l.jsx)("option",{value:e.modelId,children:e.label},e.modelId))},e):t.map(e=>(0,l.jsx)("option",{value:e.modelId,children:e.label},e.modelId))),(0,l.jsx)("option",{value:"__custom__",children:"Custom…"})]}),(0===H.length||!J)&&(0,l.jsx)("input",{type:"text",value:v,onChange:e=>E(e.target.value),placeholder:S.SV[g?.provider??""]?.[0]?.modelId??"e.g. claude-haiku-4-5-20251001",className:"w-full rounded-lg border border-rule bg-canvas px-3 py-2 font-mono text-[12.5px] text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})]})]}),!I&&(0,l.jsx)("div",{className:"mt-3",children:(0,l.jsx)(ea,{label:"Fallback providers (failover order)",children:0===V.length?(0,l.jsxs)("p",{className:"text-[12px] text-ink-4",children:["Add another LLM key in"," ",(0,l.jsx)(a(),{href:"/llm-providers",className:"underline",children:"LLM providers"})," ","to enable failover."]}):(0,l.jsxs)("div",{className:"space-y-2.5",children:[(0,l.jsx)("p",{className:"text-[12px] text-ink-4",children:"If the primary is down (5xx / timeout / quota) mid-job, the runner fails over to these in order. Pick the model each fallback should run on."}),V.map(e=>{let t=h.findIndex(t=>t.keyId===e.id),n=-1!==t,s=S.SV[e.provider]??[],r=n?h[t]?.model??"":"";return(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsxs)("label",{className:"flex cursor-pointer items-center gap-2.5 select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:n,onChange:()=>W(e.id),className:"accent-ink"}),(0,l.jsx)("span",{className:"text-[13px] text-ink-2",children:(e.nickname??(0,C.R)(e.provider))+" ("+(0,C.R)(e.provider)+")"}),n&&(0,l.jsxs)("span",{className:"ml-auto rounded-full border border-rule-2 px-2 py-0.5 text-[10px] font-medium text-ink-4",children:["#",t+1]})]}),n&&(s.length>0?(0,l.jsx)("select",{value:r,onChange:t=>B(e.id,t.target.value),className:"ml-[1.6rem] w-[calc(100%-1.6rem)] rounded-lg border border-rule bg-canvas px-3 py-1.5 text-[12.5px] text-ink focus:border-ink-3 focus:outline-none",children:(0,S.eS)(s).map(({group:e,models:t})=>e?(0,l.jsx)("optgroup",{label:e,children:t.map(e=>(0,l.jsx)("option",{value:e.modelId,children:e.label},e.modelId))},e):t.map(e=>(0,l.jsx)("option",{value:e.modelId,children:e.label},e.modelId)))}):(0,l.jsx)("input",{type:"text",value:r,onChange:t=>B(e.id,t.target.value),placeholder:"model id (e.g. llama-3.3-70b)",className:"ml-[1.6rem] w-[calc(100%-1.6rem)] rounded-lg border border-rule bg-canvas px-3 py-1.5 font-mono text-[12px] text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"}))]},e.id)})]})})})]}),(0,l.jsxs)(X,{children:[(0,l.jsx)(Z,{label:"Knowledge",hint:"Folders scope file_* tools. Add multiple paths with distinct labels."}),R?0===M.length?(0,l.jsx)("p",{className:"text-[12.5px] text-ink-4",children:"No folders configured."}):(0,l.jsx)("div",{className:"space-y-4 mb-4",children:M.map(e=>(0,l.jsxs)("div",{className:"rounded-lg border border-rule bg-hover/50 overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3 px-3 py-2 border-b border-rule",children:[(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("span",{className:"font-mono text-[11px] font-semibold text-ink-2 mr-2",children:e.label}),(0,l.jsx)("span",{className:"font-mono text-[11.5px] text-ink-3 break-all",children:e.path})]}),(0,l.jsx)("button",{type:"button",onClick:()=>er(e.id),disabled:ei,className:"shrink-0 rounded border border-rule px-2 py-0.5 text-[11px] text-err hover:border-err/40 hover:bg-err/5 disabled:opacity-50",children:"Remove"})]}),(0,l.jsxs)("div",{className:"px-3 pt-2 pb-1",children:[ex[e.label]?0===(ed[e.label]??[]).length?(0,l.jsx)("p",{className:"text-[11.5px] text-ink-4 py-1",children:"No files uploaded yet."}):(0,l.jsx)("div",{className:"space-y-1 mb-2",children:(ed[e.label]??[]).map(t=>(0,l.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded px-2 py-1 bg-canvas border border-rule-2 text-[11.5px]",children:[(0,l.jsx)("span",{className:"font-mono text-ink-2 truncate min-w-0",children:t.name}),(0,l.jsx)("span",{className:"shrink-0 text-ink-4",children:t.size>=1048576?`${(t.size/1024/1024).toFixed(1)} MB`:t.size>=1024?`${(t.size/1024).toFixed(0)} KB`:`${t.size} B`}),(0,l.jsx)("button",{type:"button",onClick:()=>{ev({label:e.label,name:t.name})},disabled:ef,className:"shrink-0 rounded border border-rule px-1.5 py-0.5 text-[10px] text-err hover:border-err/40 hover:bg-err/5 disabled:opacity-50",children:"Delete"})]},t.name))}):(0,l.jsx)("p",{className:"text-[11.5px] text-ink-4 py-1",children:"Loading files…"}),(0,l.jsxs)("label",{className:`flex items-center gap-2 cursor-pointer rounded-lg border border-dashed px-3 py-2 text-[12px] transition-colors mb-2
2
+ ${em&&eu===e.label?"border-ink-3 text-ink-3 bg-hover":"border-rule text-ink-4 hover:border-ink-3 hover:text-ink-3"}`,children:[(0,l.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:[(0,l.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,l.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,l.jsx)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),em&&eu===e.label?"Uploading…":"Upload file (.docx .xlsx .pptx .pdf .txt .md .csv — max 25 MB)",(0,l.jsx)("input",{type:"file",className:"sr-only",accept:".docx,.xlsx,.pptx,.pdf,.txt,.md,.csv",disabled:em,onChange:t=>{let n=t.target.files?.[0];n&&(t.target.value="",eh(e.label),ej(e.label,n))}})]})]})]},e.id))}):(0,l.jsx)("p",{className:"text-[12.5px] text-ink-4",children:"Loading…"}),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsx)(ea,{label:"Add folder",children:(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("input",{type:"text",value:Y,onChange:e=>Q(e.target.value),placeholder:"Label (e.g. notes)",maxLength:80,className:"w-28 shrink-0 rounded-lg border border-rule bg-canvas px-3 py-2 font-mono text-[12.5px] text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"}),(0,l.jsx)("input",{type:"text",value:ee,onChange:e=>et(e.target.value),placeholder:"/home/you/notes or C:\\Users\\you\\docs",className:"min-w-0 flex-1 rounded-lg border border-rule bg-canvas px-3 py-2 font-mono text-[12.5px] text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"}),(0,l.jsx)("button",{type:"button",onClick:function(){Y.trim()&&ee.trim()&&eo(async()=>{el(!0);let e=await N(_,Y.trim(),ee.trim());if(el(!1),!e.ok)return void o.oR.error(e.message);let t=await b(_);t.ok&&$(t.data),Q(""),et(""),o.oR.success("Folder added")})},disabled:ei||en||!Y.trim()||!ee.trim(),className:"shrink-0 rounded-lg border border-rule px-4 py-2 text-[13px] font-medium text-ink-2 hover:border-rule-2 hover:text-ink disabled:cursor-not-allowed disabled:opacity-50",children:en?"Adding…":"Add"})]})}),(0,l.jsxs)("p",{className:"text-[11px] text-ink-4",children:["Absolute path. Label is the prefix the agent uses (e.g."," ",(0,l.jsx)("code",{className:"font-mono",children:"notes/file.md"}),"). Leave label blank if a single folder — label is then optional."]})]}),(0,l.jsx)(y.A,{open:null!==es,title:"Remove folder",message:"The agent will lose file access to this path. Existing files are NOT deleted.",confirmLabel:"Remove",destructive:!0,onConfirm:()=>es&&void eo(async()=>{let e=await w(es);if(er(null),!e.ok)return void o.oR.error(e.message);let t=await b(_);t.ok&&$(t.data),o.oR.success("Folder removed")}),onCancel:()=>er(null)}),(0,l.jsx)(y.A,{open:null!==eb,title:"Delete file",message:eb?`Delete "${eb.name}" from folder "${eb.label}"? This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,onConfirm:function(){if(!eb)return;let{label:e,name:t}=eb;ek(async()=>{ev(null);let n=await j(_,e,t);if(!n.ok)return void o.oR.error(n.message);o.oR.success(`Deleted ${t}`);let l=await f(_,e);l.ok&&ec(t=>({...t,[e]:l.data}))})},onCancel:()=>ev(null)})]}),(0,l.jsxs)("div",{className:"sticky bottom-4 z-10 flex items-center justify-between gap-3 rounded-2xl border border-rule-2 bg-paper px-4 py-3 shadow-lg",children:[(0,l.jsx)("div",{className:"text-[12.5px] text-ink-3",children:O?(0,l.jsxs)("span",{children:[(0,l.jsx)("span",{className:"mr-1.5 inline-block h-[7px] w-[7px] rounded-full bg-skill-vivid"}),"Unsaved changes"]}):(0,l.jsx)("span",{className:"text-ink-4",children:"No changes"})}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("button",{type:"button",onClick:q,disabled:T||!O,className:"rounded-lg border border-rule px-4 py-2 text-[13px] font-medium text-ink-3 transition-colors hover:border-rule-2 hover:text-ink-2 disabled:cursor-not-allowed disabled:opacity-50",children:"Reset"}),(0,l.jsx)("button",{type:"button",onClick:G,disabled:T||I||!O,title:O?void 0:"No changes to save",className:"rounded-lg bg-ink px-5 py-2 text-[13px] font-semibold text-canvas transition-colors hover:brightness-[0.92] disabled:cursor-not-allowed disabled:opacity-50",children:T?"Saving…":"Save"})]})]})]})}function ea({label:e,children:t}){return(0,l.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,l.jsx)("label",{className:"font-mono text-[10px] uppercase tracking-[0.1em] text-ink-4",children:e}),(0,l.jsx)("div",{children:t})]})}},21021:(e,t,n)=>{"use strict";n.d(t,{a:()=>l,d:()=>r});let l={gmail:"#ea4335","google-drive":"#4285f4","google-sheets":"#0f9d58","google-docs":"#4285f4","google-calendar":"#4285f4",notion:"#000000","notion-oauth":"#000000",airtable:"#f82b60","airtable-oauth":"#f82b60",github:"#24292f",linear:"#5e6ad2",hubspot:"#ff7a59",slack:"#4a154b",intercom:"#1f8ced",stripe:"#635bff",postgres:"#336791",apify:"#00aeff",firecrawl:"#f97316",tavily:"#6366f1",composio:"#000000"},s={gmail:"Gm","google-drive":"GD","google-sheets":"GS","google-docs":"GD","google-calendar":"GC",notion:"No","notion-oauth":"No",airtable:"At","airtable-oauth":"At",github:"Gh",linear:"Li",hubspot:"HS",slack:"Sl",intercom:"IC",stripe:"St",postgres:"PG",apify:"Ap",firecrawl:"FC",tavily:"Tv",composio:"Co","custom-http-mcp":"+","custom-stdio-mcp":"+","cogni-cortex":"CX"};function r(e,t){return s[e]??t.slice(0,2).toUpperCase()}},35196:(e,t,n)=>{"use strict";n.d(t,{default:()=>p});var l=n(3680),s=n(78604),r=n(63363),a=n.n(r);function i({tabs:e,value:t,defaultValue:n,onChange:r,variant:a="inset"}){let[o,d]=(0,s.useState)(t??n??e[0].value),c=t??o,x="inset"===a?"bg-paper text-ink shadow-[0_1px_2px_rgba(0,0,0,0.06)]":"bg-ink text-canvas";return(0,l.jsx)("div",{className:`inline-flex gap-0.5 rounded-md p-[3px] ${"inset"===a?"bg-black/[0.05]":"bg-black/[0.04]"}`,role:"tablist",children:e.map(e=>{let n=e.value===c;return(0,l.jsxs)("button",{type:"button",role:"tab","aria-selected":n,onClick:()=>{void 0===t&&d(e.value),r?.(e.value)},className:`inline-flex h-[26px] items-center gap-1.5 rounded-[6px] border-0 px-3 text-[11.5px] font-medium leading-none transition-colors ${n?x:"bg-transparent text-ink-3 hover:text-ink-2"}`,children:[e.label,void 0!==e.count&&(0,l.jsx)("span",{className:`font-mono text-[10px] ${n?"opacity-85":"opacity-65"}`,children:e.count})]},e.value)})})}var o=n(93606),d=n(99203),c=n(32928);let x=[{value:"All",label:"All"},{value:"Running",label:"Running"},{value:"Failed",label:"Failed"}];function p({jobs:e,agents:t,agentId:n}){let[r,h]=(0,s.useState)("All"),[m,g]=(0,s.useState)(""),b=(0,s.useMemo)(()=>new Map(t.map(e=>[e.id,e])),[t]),v=(0,s.useMemo)(()=>{let t=n?e.filter(e=>e.agentId===n):e;if("Running"===r?t=t.filter(e=>{let t=e.status??"";return"processing"===t||"pending"===t||t.startsWith("awaiting")}):"Failed"===r&&(t=t.filter(e=>"failed"===e.status||"cancelled"===e.status)),m.trim()){let e=m.toLowerCase();t=t.filter(t=>{let n=t.agentId?b.get(t.agentId)?.name??"":"";return t.task.toLowerCase().includes(e)||n.toLowerCase().includes(e)||t.channel.toLowerCase().includes(e)})}return t},[e,n,r,m,b]);return(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"mb-3.5 flex flex-wrap items-center gap-2.5",children:[(0,l.jsx)(i,{tabs:x,defaultValue:"All",variant:"dark-active",onChange:e=>h(e)}),(0,l.jsxs)("div",{className:"ml-auto flex h-[34px] min-w-[240px] items-center gap-2 rounded-md border border-rule-2 bg-paper px-3 text-[12.5px] text-ink-4",children:[(0,l.jsx)(c.e,{size:13,className:"shrink-0"}),(0,l.jsx)("input",{type:"search",value:m,onChange:e=>g(e.target.value),placeholder:"Search by task or agent…",className:"flex-1 border-0 bg-transparent text-[13px] leading-none text-ink outline-none placeholder:text-ink-4"})]})]}),(0,l.jsx)("div",{className:"overflow-hidden rounded-2xl border border-rule-2 bg-paper",children:0===v.length?(0,l.jsx)("div",{className:"px-6 py-12 text-center text-[13px] text-ink-4",children:0===e.length?"No runs yet. Use the form above to send your first task to an agent.":"No runs match the current filter."}):(0,l.jsx)("div",{className:"overflow-x-auto",children:(0,l.jsxs)("table",{className:"w-full border-collapse text-sm",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)(u,{children:"Agent"}),(0,l.jsx)(u,{children:"Task"}),(0,l.jsx)(u,{className:"hidden md:table-cell",children:"Channel"}),(0,l.jsx)(u,{className:"hidden lg:table-cell",children:"Started"}),(0,l.jsx)(u,{align:"right",children:"Status"})]})}),(0,l.jsx)("tbody",{children:v.map(e=>{var t,n,s,r;let i=e.agentId?b.get(e.agentId):null,c="completed"===(t=e.status)?"done":"failed"===t||"cancelled"===t?"warn":"processing"===t||"pending"===t||t?.startsWith("awaiting")?"run":"idle";return(0,l.jsxs)("tr",{className:"border-b border-dashed border-rule-2 last:border-0 hover:bg-hover transition-colors",children:[(0,l.jsx)("td",{className:"px-[18px] py-3 align-middle",children:i?(0,l.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,l.jsx)(d.A,{name:i.name,imageUrl:i.avatarUrl,size:"md",shape:"round"}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("div",{className:"truncate text-[13px] font-medium leading-[1.2] text-ink",children:i.name}),(0,l.jsx)("div",{className:"truncate font-mono text-[10px] leading-none text-ink-4",children:i.slug})]})]}):(0,l.jsx)("span",{className:"font-mono text-[11px] text-ink-4",children:"—"})}),(0,l.jsx)("td",{className:"max-w-[320px] px-[18px] py-3 align-middle",children:(0,l.jsx)(a(),{href:`/jobs/${e.id}`,className:"line-clamp-1 text-[13px] text-ink-2 hover:text-ink transition-colors",title:e.task,children:(n=e.task).length>72?n.slice(0,72)+"…":n})}),(0,l.jsx)("td",{className:"hidden px-[18px] py-3 align-middle font-mono text-[11px] text-ink-4 md:table-cell",children:e.channel}),(0,l.jsx)("td",{className:"hidden px-[18px] py-3 align-middle font-mono text-[11px] text-ink-4 lg:table-cell",children:(s=e.createdAt)?("string"==typeof s?new Date(s):s).toLocaleString(void 0,{weekday:"short",hour:"2-digit",minute:"2-digit"}):"—"}),(0,l.jsx)("td",{className:"px-[18px] py-3 align-middle text-right",children:(0,l.jsx)(o.A,{variant:c,label:(r=e.status)?({pending:"Pending",processing:"Running",completed:"Done",failed:"Failed",awaiting_approval:"Awaiting",awaiting_delegation:"Awaiting",cancelled:"Cancelled"})[r]??r:"Pending"})})]},e.id)})})]})})})]})}function u({children:e,align:t="left",className:n=""}){return(0,l.jsx)("th",{className:`border-b border-rule-2 px-[18px] pt-1.5 pb-2.5 font-mono text-[9.5px] font-normal whitespace-nowrap uppercase tracking-[0.16em] text-ink-4 ${"right"===t?"text-right":"text-left"} ${n}`,children:e})}},37955:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var l=n(3680),s=n(78604),r=n(51869);let a=Array.from({length:42},(e,t)=>{let n=String(t+1).padStart(2,"0");return{id:`avatar-${n}`,url:`/avatars/avatar-${n}.png`}});function i({value:e,onChange:t,label:n="Avatar"}){let[c,x]=(0,s.useState)(!1),[p,u]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{u(!0)},[]),(0,s.useEffect)(()=>{if(c)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&x(!1)}},[c]),(0,l.jsxs)("div",{children:[n&&(0,l.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:n}),(0,l.jsxs)("button",{type:"button",onClick:()=>x(!0),className:"group flex items-center gap-3 bg-hover border border-rule hover:border-rule rounded-md px-3 py-2 text-left transition-colors w-full max-w-xs",children:[(0,l.jsx)(o,{url:e,size:36}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"text-sm text-ink truncate",children:e?e.split("/").pop()?.replace(".png",""):"No avatar"}),(0,l.jsxs)("p",{className:"text-[11px] text-ink-3",children:["Click to ",e?"change":"pick"]})]})]}),p&&c&&(0,r.createPortal)((0,l.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":"Pick an avatar",onClick:()=>x(!1),className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:(0,l.jsxs)("div",{onClick:e=>e.stopPropagation(),className:"bg-paper border border-rule-2 rounded-2xl p-5 max-w-2xl w-full max-h-[80vh] overflow-y-auto",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"Pick an avatar"}),(0,l.jsx)("button",{type:"button",onClick:()=>x(!1),className:"text-ink-3 hover:text-ink text-xs",children:"Close (Esc)"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-6 gap-3",children:[(0,l.jsx)(d,{selected:null===e,onClick:()=>void(t(null),x(!1)),label:"None",url:null}),a.map(n=>(0,l.jsx)(d,{selected:e===n.url,onClick:()=>{t(n.url),x(!1)},label:n.id,url:n.url},n.id))]})]})}),document.body)]})}function o({url:e,size:t=32}){return e?(0,l.jsx)("img",{src:e,alt:"",width:t,height:t,style:{width:t,height:t},className:"rounded-full object-cover border border-rule shrink-0"}):(0,l.jsx)("div",{style:{width:t,height:t},className:"rounded-full bg-hover border border-dashed border-rule text-ink-3 text-xs flex items-center justify-center shrink-0",children:"?"})}function d({selected:e,onClick:t,label:n,url:s}){return(0,l.jsx)("button",{type:"button",onClick:t,title:n,"aria-label":n,"aria-pressed":e,className:`aspect-square rounded-lg p-1 flex items-center justify-center transition-all ${e?"bg-ink/10 ring-2 ring-emerald-400":"bg-hover hover:bg-hover ring-1 ring-transparent hover:ring-neutral-700"}`,children:(0,l.jsx)(o,{url:s,size:56})})}},60705:(e,t,n)=>{"use strict";n.d(t,{f:()=>s});var l=n(64678);let s=(0,l.createServerReference)("408b4374239f76207d53f760182cb5fa1a0aa2c1b1",l.callServer,void 0,l.findSourceMapURL,"updateAgentAction")},63217:(e,t,n)=>{"use strict";function l(e){switch(e){case"openai-compatible":return"Local LLM";case"anthropic":return"Anthropic";case"openai":return"OpenAI";case"ollama":return"Ollama";case"openrouter":return"OpenRouter";case"google":return"Google";case"mistral":return"Mistral";case"groq":return"Groq";default:return e}}n.d(t,{R:()=>l})},81630:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var l=n(3680);let s={agent:"bg-agent-vivid text-[#0a0a0a]",skill:"bg-skill-vivid text-white",conn:"bg-conn-vivid text-white",ink:"bg-ink text-canvas",neutral:"bg-hover text-ink-3"},r={sm:"h-[30px] w-[30px]",md:"h-[34px] w-[34px]",lg:"h-[38px] w-[38px]",xl:"h-[42px] w-[42px]"},a={sm:"[&_svg]:h-[13px] [&_svg]:w-[13px]",md:"[&_svg]:h-[14px] [&_svg]:w-[14px]",lg:"[&_svg]:h-[16px] [&_svg]:w-[16px]",xl:"[&_svg]:h-[18px] [&_svg]:w-[18px]"};function i({variant:e,size:t="md",shape:n="round",background:o,children:d,className:c=""}){let x=o?"":s[e];return(0,l.jsx)("span",{style:o?{background:o}:void 0,className:`inline-flex shrink-0 items-center justify-center ${r[t]} ${a[t]} ${"round"===n?"rounded-full":"rounded-[9px]"} ${x} ${o?"text-white":""} ${c}`,children:d})}},82592:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var l=n(3680);let s={ok:"bg-ok",lime:"bg-agent-vivid",coral:"bg-skill-vivid",blue:"bg-conn-vivid"},r={ok:"animate-[blip_1.4s_ease-out_infinite]",lime:"animate-[blip-lime_1.5s_ease-out_infinite]",coral:"animate-[blip-coral_1.4s_ease-out_infinite]",blue:"animate-[blip-blue_1.4s_ease-out_infinite]"};function a({variant:e="ok",size:t="sm",animate:n=!0,className:i=""}){return(0,l.jsx)("span",{className:`inline-block shrink-0 rounded-full ${"sm"===t?"h-[7px] w-[7px]":"h-2 w-2"} ${s[e]} ${n?r[e]:""} ${i}`})}},88812:(e,t,n)=>{Promise.resolve().then(n.bind(n,119))},93606:(e,t,n)=>{"use strict";n.d(t,{A:()=>d});var l=n(3680),s=n(86127),r=n(22089),a=n(82592);let i={done:"Done",warn:"Attention",run:"Running",idle:"Idle","lvl-info":"INFO","lvl-ok":"OK","lvl-warn":"WARN","lvl-err":"ERR"},o={done:"bg-ok-bg text-ok",warn:"bg-warn-bg text-warn",run:"bg-run-bg text-run",idle:"bg-black/5 text-ink-3 dark:bg-white/5","lvl-info":"bg-black/5 text-ink-3 dark:bg-white/5","lvl-ok":"bg-ok-bg text-ok","lvl-warn":"bg-warn-bg text-warn","lvl-err":"bg-warn-bg text-err"};function d({variant:e,label:t,icon:n,className:c=""}){let x=t??i[e],p=null;return void 0!==n?p=n:"done"===e?p=(0,l.jsx)(s.r,{size:11,weight:"regular"}):"warn"===e?p=(0,l.jsx)(r.N,{size:11,weight:"regular"}):"run"===e&&(p=(0,l.jsx)(a.A,{variant:"blue",size:"sm"})),(0,l.jsxs)("span",{className:`inline-flex h-[22px] items-center gap-1.5 rounded-[5px] px-2.5 text-[11px] font-medium leading-none ${o[e]} ${c}`,children:[p,x]})}},99203:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var l=n(3680),s=n(22575);let r={sm:{box:"h-6 w-6",text:"text-[9.5px]",px:24},md:{box:"h-[30px] w-[30px]",text:"text-[10.5px]",px:30},lg:{box:"h-[42px] w-[42px]",text:"text-[14px]",px:42}};function a({name:e,imageUrl:t,size:n="md",shape:i="round",className:o=""}){let d=r[n],c=`inline-flex shrink-0 items-center justify-center overflow-hidden bg-hover font-mono font-semibold tracking-[0.04em] text-ink-2 ${d.box} ${d.text} ${"round"===i?"rounded-full":"rounded-[8px]"} ${o}`;return t?(0,l.jsx)("span",{className:c,children:(0,l.jsx)(s.default,{src:t,alt:e,width:d.px,height:d.px,className:"h-full w-full object-cover"})}):(0,l.jsx)("span",{className:c,children:function(e){let t=e.trim();if(!t)return"?";let n=t.split(/\s+/);return n.length>=2?((n[0][0]??"")+(n[1][0]??"")).toUpperCase():t.slice(0,2).toUpperCase()}(e)})}}},e=>{e.O(0,[3363,9504,7025,2575,269,9582,9123,1065,8724,7358],()=>e(e.s=88812)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2925],{14308:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(3680),s=n(78604),a=n(51869);function o({open:e,title:t,message:n,confirmLabel:i="Confirm",cancelLabel:l="Cancel",destructive:c=!0,onConfirm:d,onCancel:u}){let m=(0,s.useRef)(null),[b,f]=(0,s.useState)(!1);return((0,s.useEffect)(()=>{f(!0)},[]),(0,s.useEffect)(()=>{if(e)return m.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&u()}},[e,u]),e&&b)?(0,a.createPortal)((0,r.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",className:"fixed inset-0 z-50 flex items-center justify-center px-4 text-left",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:u,"aria-hidden":"true"}),(0,r.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl p-6 max-w-md w-full shadow-2xl",children:[(0,r.jsx)("h2",{id:"confirm-dialog-title",className:"text-base font-semibold text-ink",children:t}),n&&(0,r.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:n}),(0,r.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,r.jsx)("button",{ref:m,type:"button",onClick:u,className:"px-4 py-2 text-sm font-medium border border-rule text-ink-2 rounded-lg hover:border-rule hover:text-ink transition-colors",children:l}),(0,r.jsx)("button",{type:"button",onClick:d,className:`px-4 py-2 text-sm font-semibold rounded-lg transition-colors ${c?"bg-err hover:brightness-[0.94] text-ink":"bg-ink hover:brightness-[0.92] text-canvas"}`,children:i})]})]})]}),document.body):null}},22997:(e,t,n)=>{"use strict";n.d(t,{default:()=>u});var r=n(3680),s=n(78604),a=n(27540),o=n(39504),i=n(64678);let l=(0,i.createServerReference)("40f886db2aa6738396c9820d79573481e8094556fe",i.callServer,void 0,i.findSourceMapURL,"configureAgentTelegramAction"),c=(0,i.createServerReference)("4028e336e8831dd6916335467985f84baa9e94eab6",i.callServer,void 0,i.findSourceMapURL,"disconnectAgentTelegramAction");var d=n(14308);function u({agentId:e,initialConfig:t}){let n=(0,a.useRouter)(),[i,m]=(0,s.useState)(t),[b,f]=(0,s.useState)(""),[x,p]=(0,s.useTransition)(),[h,v]=(0,s.useState)(!1),g="connected"===i.status;return(0,r.jsxs)("div",{className:"space-y-5",children:[(0,r.jsxs)("div",{className:"bg-paper border border-rule-2/60 rounded-xl px-5 py-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:g?"inline-block w-2 h-2 rounded-full bg-agent-vivid":"inline-block w-2 h-2 rounded-full bg-ink-4","aria-hidden":"true"}),(0,r.jsx)("span",{className:"text-sm font-medium text-ink",children:g?"Connected":"Not connected"})]}),i.botUsername&&(0,r.jsxs)("p",{className:"text-xs text-ink-3 mt-1.5",children:["Bot:"," ",(0,r.jsxs)("a",{href:`https://t.me/${i.botUsername}`,target:"_blank",rel:"noopener noreferrer",className:"font-mono text-ink-2 hover:text-ok",children:["@",i.botUsername]})]})]}),(0,r.jsxs)("form",{onSubmit:function(t){t.preventDefault(),b&&p(async()=>{let t=await l({agentId:e,botToken:b});t.ok?(m(t.data),f(""),o.oR.success(`Connected as @${t.data.botUsername}`),n.refresh()):o.oR.error(t.message)})},className:"space-y-3",children:[(0,r.jsxs)("label",{className:"block",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-ink-2 uppercase tracking-wider",children:"Bot token"}),(0,r.jsx)("input",{type:"text",autoComplete:"off",spellCheck:!1,value:b,onChange:e=>f(e.target.value),placeholder:"123456789:ABCDEF…",className:"mt-2 w-full px-3 py-2 bg-canvas border border-rule-2 rounded-lg text-sm font-mono text-ink placeholder:text-ink-4 focus:outline-none focus:border-rule"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{type:"submit",disabled:x||!b,className:"px-4 py-2 text-sm font-medium bg-ok text-ink rounded-lg hover:bg-agent-vivid transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:x?"Saving…":g?"Replace token":"Connect"}),g&&(0,r.jsx)("button",{type:"button",onClick:()=>v(!0),disabled:x,className:"px-4 py-2 text-sm font-medium border border-rule-2 text-ink-3 rounded-lg hover:border-err hover:text-err transition-colors disabled:opacity-50",children:"Disconnect"})]})]}),(0,r.jsx)(d.A,{open:h,title:"Disconnect Telegram bot?",message:"Incoming messages to this bot will stop being processed. You can reconnect later by pasting the token again.",confirmLabel:"Disconnect",onConfirm:function(){v(!1),p(async()=>{let t=await c(e);t.ok?(m({...i,status:"disconnected",botUsername:null}),o.oR.success("Telegram disconnected"),n.refresh()):o.oR.error(t.message)})},onCancel:()=>v(!1)})]})}},27540:(e,t,n)=>{"use strict";var r=n(71268);n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},64678:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={callServer:function(){return a.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}};for(var s in r)Object.defineProperty(t,s,{enumerable:!0,get:r[s]});let a=n(22673),o=n(43145),i=n(87478)},78479:(e,t,n)=>{Promise.resolve().then(n.bind(n,22997)),Promise.resolve().then(n.t.bind(n,63363,23))}},e=>{e.O(0,[3363,9504,1065,8724,7358],()=>e(e.s=78479)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[797],{25681:(e,t,r)=>{"use strict";r.d(t,{default:()=>f});var s=r(3680),n=r(63363),l=r.n(n),a=r(78604),i=r(27540),o=r(39504),d=r(34767),c=r(35436),u=r(62182),x=r(50404),m=r(64678);let h=(0,m.createServerReference)("4011a0e49507079213b6ce631cd4903ec46942f9e1",m.callServer,void 0,m.findSourceMapURL,"reorderAgentsAction"),g=(0,m.createServerReference)("40ecb72d2da458a2330753fee3e93712648aaccff0",m.callServer,void 0,m.findSourceMapURL,"deleteAgentAction");var p=r(14308);function b({id:e,name:t,deleteAction:r}){let n=(0,i.useRouter)(),[l,d]=(0,a.useTransition)(),[c,u]=(0,a.useState)(!1);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>u(!0),disabled:l,className:"px-3 py-1.5 text-xs font-medium border border-rule-2 text-ink-3 rounded-lg hover:border-err hover:text-err transition-colors disabled:opacity-50",children:l?"Deleting…":"Delete"}),(0,s.jsx)(p.A,{open:c,title:`Delete agent "${t}"?`,message:"The agent and its assignments will be removed. Past job history is preserved.",confirmLabel:"Delete",onConfirm:function(){u(!1),d(async()=>{let t=await r(e);t.ok?(o.oR.success("Agent deleted"),n.refresh()):o.oR.error(t.message)})},onCancel:()=>u(!1)})]})}function f({initialGroups:e,initialActivity:t}){let[r,n]=(0,a.useState)(e),[l,u]=(0,a.useState)(t),[m,g]=(0,a.useTransition)(),p=(0,i.useRouter)(),b=(0,a.useSyncExternalStore)(()=>()=>{},()=>!0,()=>!1),k=(0,a.useMemo)(()=>{let e=new Map;for(let t of l)e.set(t.agentId,t);return e},[l]);(0,a.useEffect)(()=>{let e=!1,t=async()=>{let t=await (0,x.V)();!e&&t.ok&&u(t.data)},r=setInterval(()=>void t(),5e3);return()=>{e=!0,clearInterval(r)}},[]);let y=(0,d.FR)((0,d.MS)(d.AN,{activationConstraint:{distance:8}}),(0,d.MS)(d.uN,{coordinateGetter:c.JR}));function w(e){n(e),g(async()=>{let t=await h(function(e){let t=[];for(let r of e)for(let e of(r.orchestrator&&t.push(r.orchestrator.id),r.workers))t.push(e.id);return t}(e));if(!t.ok){o.oR.error(t.message),n(r);return}p.refresh()})}if(0===r.length)return(0,s.jsx)("div",{className:"bg-paper border border-rule-2 rounded-xl overflow-hidden",children:(0,s.jsx)("div",{className:"px-6 py-12 text-center text-ink-4 text-sm",children:"No agents yet. Create one above."})});let S=r.map(e=>e.orchestrator?.id).filter(e=>!!e);return b?(0,s.jsx)(d.Mp,{sensors:y,collisionDetection:d.fp,onDragEnd:function(e){let{active:t,over:s}=e;if(!s||t.id===s.id)return;let n=r.findIndex(e=>e.orchestrator?.id===t.id),l=r.findIndex(e=>e.orchestrator?.id===s.id);n<0||l<0||w((0,c.be)(r,n,l))},children:(0,s.jsx)(c.gB,{items:S,strategy:c._G,children:(0,s.jsx)("div",{className:"space-y-6",children:r.map((e,t)=>{let n=null===e.orchestrator;return(0,s.jsxs)("div",{children:[e.orchestrator?(0,s.jsx)(v,{orchestrator:e.orchestrator,disabled:m}):(0,s.jsx)("h2",{className:"mb-2 text-xs font-semibold text-ink-3 uppercase tracking-wider",children:"Standalone"}),(0,s.jsx)(j,{workers:e.workers,indent:!!e.orchestrator,orchestrator:e.orchestrator,disabled:m,onWorkerDragEnd:e=>(function(e,t){let{active:s,over:n}=t;if(!n||s.id===n.id)return;let l=r[e];if(!l)return;let a=l.workers.findIndex(e=>e.id===s.id),i=l.workers.findIndex(e=>e.id===n.id);if(a<0||i<0)return;let o=(0,c.be)(l.workers,a,i);w(r.map((t,r)=>r===e?{...t,workers:o}:t))})(t,e),sensors:y,activityByAgent:k})]},n?"__standalone__":e.orchestrator?.id??"")})})})}):(0,s.jsx)("div",{className:"space-y-6",children:r.map(e=>{let t=null===e.orchestrator;return(0,s.jsxs)("div",{children:[e.orchestrator?(0,s.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"leading-none text-ink-4","aria-hidden":!0,children:"⋮⋮"}),(0,s.jsxs)("h2",{className:"text-xs font-semibold uppercase tracking-wider text-ink-3",children:["Team — ",e.orchestrator.name]})]}):(0,s.jsx)("h2",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-ink-3",children:"Standalone"}),(0,s.jsx)("div",{className:"overflow-hidden rounded-xl border border-rule-2 bg-paper",children:(0,s.jsx)("table",{className:"w-full text-sm",children:(0,s.jsxs)("tbody",{children:[e.orchestrator&&(0,s.jsx)(N,{agent:e.orchestrator,indent:!1,activity:k.get(e.orchestrator.id)??null}),e.workers.map(t=>(0,s.jsx)(N,{agent:t,indent:!!e.orchestrator,activity:k.get(t.id)??null},t.id))]})})})]},t?"__standalone__":e.orchestrator?.id??"")})})}function v({orchestrator:e,disabled:t}){let{attributes:r,listeners:n,setNodeRef:l,transform:a,transition:i,isDragging:o}=(0,c.gl)({id:e.id,disabled:t});return(0,s.jsxs)("div",{ref:l,style:{transform:u.Ks.Transform.toString(a),transition:i},className:`mb-2 flex items-center gap-2 ${o?"opacity-50":""}`,children:[(0,s.jsx)("button",{type:"button",...r,...n,"aria-label":"Drag team",title:"Drag to reorder team",className:"cursor-grab active:cursor-grabbing text-ink-4 hover:text-ink-2 transition-colors leading-none touch-none",children:"⋮⋮"}),(0,s.jsxs)("h2",{className:"text-xs font-semibold text-ink-3 uppercase tracking-wider",children:["Team — ",e.name]})]})}function j({workers:e,indent:t,orchestrator:r,disabled:n,onWorkerDragEnd:l,sensors:a,activityByAgent:i}){let o=e.map(e=>e.id);return(0,s.jsx)(d.Mp,{sensors:a,collisionDetection:d.fp,onDragEnd:l,children:(0,s.jsx)("div",{className:"bg-paper border border-rule-2 rounded-xl overflow-hidden",children:(0,s.jsx)("table",{className:"w-full text-sm",children:(0,s.jsx)("tbody",{children:(0,s.jsxs)(c.gB,{items:o,strategy:c._G,children:[r&&(0,s.jsx)(N,{agent:r,indent:!1,activity:i.get(r.id)??null}),e.map(e=>(0,s.jsx)(k,{agent:e,indent:t,disabled:n,activity:i.get(e.id)??null},e.id))]})})})})})}function k({agent:e,indent:t,disabled:r,activity:n}){let{attributes:l,listeners:a,setNodeRef:i,transform:o,transition:d,isDragging:x}=(0,c.gl)({id:e.id,disabled:r});return(0,s.jsxs)("tr",{ref:i,style:{transform:u.Ks.Transform.toString(o),transition:d},className:`border-b border-rule-2 last:border-0 ${x?"opacity-50 bg-hover":""}`,children:[(0,s.jsx)("td",{className:`px-5 py-3 ${t?"pl-10":""}`,children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{type:"button",...l,...a,"aria-label":"Drag row",title:"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-ink-4 hover:text-ink-3 transition-colors leading-none touch-none select-none",children:"⋮⋮"}),(0,s.jsx)(y,{agent:e}),(0,s.jsx)(w,{agent:e}),(0,s.jsx)(S,{agent:e,activity:n})]})}),(0,s.jsx)(C,{agent:e})]})}function N({agent:e,indent:t,activity:r}){return(0,s.jsxs)("tr",{className:"border-b border-rule-2 last:border-0",children:[(0,s.jsx)("td",{className:`px-5 py-3 ${t?"pl-10":""}`,children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("span",{className:"w-4 inline-block","aria-hidden":!0}),(0,s.jsx)(y,{agent:e}),(0,s.jsx)(w,{agent:e}),(0,s.jsx)(S,{agent:e,activity:r})]})}),(0,s.jsx)(C,{agent:e})]})}function y({agent:e}){return e.avatarUrl?(0,s.jsx)("img",{src:e.avatarUrl,alt:"",width:32,height:32,className:"w-8 h-8 rounded-full object-cover border border-rule-2 shrink-0"}):(0,s.jsx)("div",{className:"w-8 h-8 rounded-full bg-hover text-ink-3 text-xs font-semibold flex items-center justify-center shrink-0",children:e.name.charAt(0).toUpperCase()})}function w({agent:e}){return(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-ink font-medium truncate",children:e.name}),e.isDefault&&(0,s.jsx)("span",{className:"text-[10px] font-semibold text-run uppercase tracking-wider",children:"default"}),"orchestrator"===e.role&&(0,s.jsx)("span",{className:"text-[10px] font-semibold text-indigo-400 uppercase tracking-wider",children:"orchestrator"})]}),(0,s.jsx)("span",{className:"font-mono text-ink-3 text-[11px]",children:e.slug}),e.model&&(0,s.jsxs)("span",{className:"ml-2 text-ink-4 text-[11px]",children:["\xb7 ",e.model]})]})}function S({agent:e,activity:t}){if(!t||0===t.total)return null;let r=t.processing>0?{color:"bg-run",pulse:!0,label:`${t.processing} running`}:t.awaiting>0?{color:"bg-warn",pulse:!0,label:`${t.awaiting} awaiting`}:{color:"bg-warn",pulse:!1,label:`${t.pending} pending`},n=[];return t.processing>0&&n.push(`${t.processing} processing`),t.awaiting>0&&n.push(`${t.awaiting} awaiting`),t.pending>0&&n.push(`${t.pending} pending`),(0,s.jsxs)(l(),{href:`/jobs?agentId=${e.id}`,title:n.join(" \xb7 "),onPointerDown:e=>e.stopPropagation(),className:"ml-1 inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-hover hover:bg-hover border border-rule text-[11px] text-ink-2 transition-colors shrink-0",children:[(0,s.jsxs)("span",{className:"relative inline-flex w-2 h-2 shrink-0",children:[r.pulse&&(0,s.jsx)("span",{className:`absolute inset-0 inline-flex h-full w-full rounded-full opacity-60 animate-ping ${r.color}`}),(0,s.jsx)("span",{className:`relative inline-flex w-2 h-2 rounded-full ${r.color}`})]}),(0,s.jsx)("span",{className:"font-mono tabular-nums",children:t.total}),(0,s.jsx)("span",{className:"text-ink-3 text-[10px]",children:"active"})]})}function C({agent:e}){return(0,s.jsx)("td",{className:"px-5 py-3 text-right",children:(0,s.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,s.jsx)(l(),{href:`/agents/${e.id}/telegram`,className:"px-3 py-1.5 text-xs font-medium border border-rule-2 text-ink-3 rounded-lg hover:border-rule hover:text-ink transition-colors",children:"Telegram"}),(0,s.jsx)(l(),{href:`/agents/${e.id}/edit`,className:"px-3 py-1.5 text-xs font-medium border border-rule-2 text-ink-3 rounded-lg hover:border-rule hover:text-ink transition-colors",children:"Edit"}),(0,s.jsx)(b,{id:e.id,name:e.name,deleteAction:g})]})})}},37955:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var s=r(3680),n=r(78604),l=r(51869);let a=Array.from({length:42},(e,t)=>{let r=String(t+1).padStart(2,"0");return{id:`avatar-${r}`,url:`/avatars/avatar-${r}.png`}});function i({value:e,onChange:t,label:r="Avatar"}){let[c,u]=(0,n.useState)(!1),[x,m]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{m(!0)},[]),(0,n.useEffect)(()=>{if(c)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&u(!1)}},[c]),(0,s.jsxs)("div",{children:[r&&(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:r}),(0,s.jsxs)("button",{type:"button",onClick:()=>u(!0),className:"group flex items-center gap-3 bg-hover border border-rule hover:border-rule rounded-md px-3 py-2 text-left transition-colors w-full max-w-xs",children:[(0,s.jsx)(o,{url:e,size:36}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm text-ink truncate",children:e?e.split("/").pop()?.replace(".png",""):"No avatar"}),(0,s.jsxs)("p",{className:"text-[11px] text-ink-3",children:["Click to ",e?"change":"pick"]})]})]}),x&&c&&(0,l.createPortal)((0,s.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":"Pick an avatar",onClick:()=>u(!1),className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:(0,s.jsxs)("div",{onClick:e=>e.stopPropagation(),className:"bg-paper border border-rule-2 rounded-2xl p-5 max-w-2xl w-full max-h-[80vh] overflow-y-auto",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"Pick an avatar"}),(0,s.jsx)("button",{type:"button",onClick:()=>u(!1),className:"text-ink-3 hover:text-ink text-xs",children:"Close (Esc)"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-6 gap-3",children:[(0,s.jsx)(d,{selected:null===e,onClick:()=>void(t(null),u(!1)),label:"None",url:null}),a.map(r=>(0,s.jsx)(d,{selected:e===r.url,onClick:()=>{t(r.url),u(!1)},label:r.id,url:r.url},r.id))]})]})}),document.body)]})}function o({url:e,size:t=32}){return e?(0,s.jsx)("img",{src:e,alt:"",width:t,height:t,style:{width:t,height:t},className:"rounded-full object-cover border border-rule shrink-0"}):(0,s.jsx)("div",{style:{width:t,height:t},className:"rounded-full bg-hover border border-dashed border-rule text-ink-3 text-xs flex items-center justify-center shrink-0",children:"?"})}function d({selected:e,onClick:t,label:r,url:n}){return(0,s.jsx)("button",{type:"button",onClick:t,title:r,"aria-label":r,"aria-pressed":e,className:`aspect-square rounded-lg p-1 flex items-center justify-center transition-all ${e?"bg-ink/10 ring-2 ring-emerald-400":"bg-hover hover:bg-hover ring-1 ring-transparent hover:ring-neutral-700"}`,children:(0,s.jsx)(o,{url:n,size:56})})}},50404:(e,t,r)=>{"use strict";r.d(t,{V:()=>n});var s=r(64678);let n=(0,s.createServerReference)("005448c2fdf7ea031fef0a9bb5d459d3f80ace4a01",s.callServer,void 0,s.findSourceMapURL,"getActiveJobsByAgentAction")},52232:(e,t,r)=>{"use strict";r.d(t,{default:()=>l});var s=r(3680),n=r(27540);function l({message:e}){let t=(0,n.useRouter)();return(0,s.jsxs)("div",{className:"bg-warn-bg border border-err/30 rounded-xl px-5 py-4 flex items-center justify-between gap-4",children:[(0,s.jsx)("p",{className:"text-sm text-err",children:e}),(0,s.jsx)("button",{onClick:()=>t.refresh(),className:"shrink-0 px-3 py-1.5 text-xs font-medium border border-err/30 text-err rounded-lg hover:border-err hover:text-err transition-colors",children:"Retry"})]})}},60705:(e,t,r)=>{"use strict";r.d(t,{f:()=>n});var s=r(64678);let n=(0,s.createServerReference)("408b4374239f76207d53f760182cb5fa1a0aa2c1b1",s.callServer,void 0,s.findSourceMapURL,"updateAgentAction")},63217:(e,t,r)=>{"use strict";function s(e){switch(e){case"openai-compatible":return"Local LLM";case"anthropic":return"Anthropic";case"openai":return"OpenAI";case"ollama":return"Ollama";case"openrouter":return"OpenRouter";case"google":return"Google";case"mistral":return"Mistral";case"groq":return"Groq";default:return e}}r.d(t,{R:()=>s})},67849:(e,t,r)=>{Promise.resolve().then(r.bind(r,52232)),Promise.resolve().then(r.bind(r,25681)),Promise.resolve().then(r.bind(r,89742))},89742:(e,t,r)=>{"use strict";r.d(t,{default:()=>h});var s=r(3680),n=r(78604),l=r(51869),a=r(27540),i=r(39504),o=r(60705),d=r(64678);let c=(0,d.createServerReference)("408a1c1b6416b62e96523dd4e7ffcf5b12406ff7ce",d.callServer,void 0,d.findSourceMapURL,"createAgentAction");var u=r(12120),x=r(63217),m=r(37955);function h(e){var t,r;let d="edit"===e.mode,h=(0,a.useRouter)(),g=(0,n.useRef)(null),[p,b]=(0,n.useTransition)(),[f,v]=(0,n.useState)(d),j=d?(t=e.initial.role??null,r=e.initial.orchestratorMode??null,"orchestrator"===t&&"planner"===r?"planner":"orchestrator"===t?"router":"worker"):"worker",[k,N]=(0,n.useState)(j),[y,w]=(0,n.useState)(d?e.initial.subAgentIds:[]),S=(0,n.useMemo)(()=>e.llmKeys.filter(e=>e.isActive),[e.llmKeys]),C=(d?e.initial.llmKeyId:null)??S[0]?.id??"",[R,A]=(0,n.useState)(C),[M,L]=(0,n.useState)(d?e.initial.model??"":""),[E,I]=(0,n.useState)(d?e.initial.avatarUrl??null:null),_=(0,n.useMemo)(()=>e.llmKeys.find(e=>e.id===R)??null,[e.llmKeys,R]);function $(t){let r=e.llmKeys.find(e=>e.id===t);A(t),L(u.SV[r?.provider??""]?.[0]?.modelId??"")}function D(t){t.preventDefault();let r=new FormData(t.currentTarget);if(d&&"edit"===e.mode){let t={id:e.initial.id,name:r.get("name"),personality:r.get("personality"),model:M,llmKeyId:R||null,role:k,subAgentIds:"worker"===k?[]:y,avatarUrl:E};b(async()=>{let e=await (0,o.f)(t);e.ok?(i.oR.success("Agent updated"),h.push("/agents")):i.oR.error(e.message)})}else{let e={slug:r.get("slug"),name:r.get("name"),personality:r.get("personality"),model:M,llmKeyId:R||void 0,role:k,subAgentIds:"worker"===k?[]:y,avatarUrl:E};b(async()=>{let t=await c(e);t.ok?(i.oR.success("Agent created"),g.current?.reset(),N("worker"),w([]),A(S[0]?.id??""),L(""),I(null),v(!1),h.refresh()):i.oR.error(t.message)})}}function F(e){w(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}(0,n.useEffect)(()=>{if(f&&!d)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&v(!1)}},[f,d]);let P=e.agents??[],q=0===S.length,K="worker"!==k,T=0===P.length;if(d){let t=e.initial;return(0,s.jsxs)("form",{ref:g,onSubmit:D,className:"w-full max-w-lg space-y-4",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"Edit agent"}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-slug",children:"Slug"}),(0,s.jsx)("input",{id:"agent-slug",name:"slug",readOnly:!0,defaultValue:t.slug,title:"Slug is not editable",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink-3 cursor-not-allowed"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-name",children:"Name"}),(0,s.jsx)("input",{id:"agent-name",name:"name",required:!0,defaultValue:t.name,placeholder:"My Agent",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})]})]}),(0,s.jsx)(m.A,{value:E,onChange:I}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-personality",children:"Personality / System prompt"}),(0,s.jsx)("textarea",{id:"agent-personality",name:"personality",required:!0,rows:6,defaultValue:t.personality,placeholder:"You are a helpful assistant...",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none resize-y"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-llm-key",children:"LLM provider"}),q?(0,s.jsxs)("p",{className:"text-xs text-warn mt-1",children:["No active LLM providers. Add one in"," ",(0,s.jsx)("a",{href:"/settings",className:"underline",children:"Settings → LLM providers"}),"."]}):(0,s.jsx)("select",{id:"agent-llm-key",value:R,onChange:e=>$(e.target.value),required:!0,className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink focus:border-ink-3 focus:outline-none",children:S.map(e=>(0,s.jsx)("option",{value:e.id,children:(e.nickname??(0,x.R)(e.provider))+" ("+(0,x.R)(e.provider)+")"},e.id))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-model",children:"Model"}),(0,s.jsx)("input",{id:"agent-model",name:"model",type:"text",required:!0,value:M,onChange:e=>{L(e.target.value)},placeholder:u.SV[_?.provider??""]?.[0]?.modelId??"e.g. claude-haiku-4-5-20251001",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none font-mono"}),null]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-role",children:"Role"}),(0,s.jsxs)("select",{id:"agent-role",value:k,onChange:e=>N(e.target.value),className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink focus:border-ink-3 focus:outline-none",children:[(0,s.jsx)("option",{value:"worker",children:"Worker — runs its own tools and tasks"}),(0,s.jsx)("option",{value:"router",children:"Router — delegates to one sub-agent at a time"}),(0,s.jsx)("option",{value:"planner",children:"Planner — creates parallel tasks for sub-agents"})]})]}),K&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs text-ink-3 mb-1",children:["Sub-agents ",(0,s.jsxs)("span",{className:"text-ink-4",children:["(",y.length," selected)"]})]}),T?(0,s.jsx)("p",{className:"text-xs text-warn mt-1",children:"Create at least one worker agent first — orchestrators need someone to delegate to."}):(0,s.jsx)("div",{className:"max-h-40 overflow-y-auto bg-hover border border-rule rounded-lg divide-y divide-neutral-800",children:P.map(e=>{let t=y.includes(e.id);return(0,s.jsxs)("label",{className:"flex items-center gap-2 px-3 py-2 text-sm cursor-pointer hover:bg-hover/80",children:[(0,s.jsx)("input",{type:"checkbox",checked:t,onChange:()=>F(e.id),className:"accent-violet-500"}),(0,s.jsx)("span",{className:"text-ink",children:e.name}),(0,s.jsx)("span",{className:"font-mono text-xs text-ink-3 ml-auto",children:e.slug})]},e.id)})})]}),(0,s.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,s.jsx)("button",{type:"submit",disabled:p||q,className:"px-4 py-2 text-sm font-semibold bg-ink text-canvas rounded-lg hover:brightness-[0.92] transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:p?"Saving…":"Save changes"}),(0,s.jsx)("button",{type:"button",onClick:()=>h.push("/agents"),className:"px-4 py-2 text-sm font-medium border border-rule text-ink-3 rounded-lg hover:border-rule transition-colors",children:"Cancel"})]})]})}let U=f?(0,l.createPortal)((0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed inset-0 bg-black/60 z-40 animate-[fadeIn_150ms_ease]",onClick:()=>v(!1),"aria-hidden":"true"}),(0,s.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":"New agent",className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:(0,s.jsxs)("form",{ref:g,onSubmit:D,className:"pointer-events-auto w-full max-w-lg max-h-[90vh] overflow-y-auto bg-paper border border-rule-2 rounded-xl p-6 space-y-4 shadow-2xl animate-[scaleIn_150ms_ease]",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"New agent"}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-slug",children:"Slug"}),(0,s.jsx)("input",{id:"agent-slug",name:"slug",required:!0,pattern:"[a-z0-9\\-]+",placeholder:"my-agent",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-name",children:"Name"}),(0,s.jsx)("input",{id:"agent-name",name:"name",required:!0,placeholder:"My Agent",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})]})]}),(0,s.jsx)(m.A,{value:E,onChange:I}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-personality",children:"Personality / System prompt"}),(0,s.jsx)("textarea",{id:"agent-personality",name:"personality",required:!0,rows:4,placeholder:"You are a helpful assistant...",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none resize-none"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-llm-key",children:"LLM provider"}),q?(0,s.jsxs)("p",{className:"text-xs text-warn mt-1",children:["No active LLM providers. Add one in"," ",(0,s.jsx)("a",{href:"/settings",className:"underline",children:"Settings → LLM providers"}),"."]}):(0,s.jsx)("select",{id:"agent-llm-key",value:R,onChange:e=>$(e.target.value),required:!0,className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink focus:border-ink-3 focus:outline-none",children:S.map(e=>(0,s.jsx)("option",{value:e.id,children:(e.nickname??(0,x.R)(e.provider))+" ("+(0,x.R)(e.provider)+")"},e.id))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-model",children:"Model"}),(0,s.jsx)("input",{id:"agent-model",name:"model",type:"text",required:!0,value:M,onChange:e=>{L(e.target.value)},placeholder:u.SV[_?.provider??""]?.[0]?.modelId??"e.g. claude-haiku-4-5-20251001",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none font-mono"}),null]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-role",children:"Role"}),(0,s.jsxs)("select",{id:"agent-role",value:k,onChange:e=>N(e.target.value),className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink focus:border-ink-3 focus:outline-none",children:[(0,s.jsx)("option",{value:"worker",children:"Worker — runs its own tools and tasks"}),(0,s.jsx)("option",{value:"router",children:"Router — delegates to one sub-agent at a time"}),(0,s.jsx)("option",{value:"planner",children:"Planner — creates parallel tasks for sub-agents"})]})]}),K&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs text-ink-3 mb-1",children:["Sub-agents ",(0,s.jsxs)("span",{className:"text-ink-4",children:["(",y.length," selected)"]})]}),T?(0,s.jsx)("p",{className:"text-xs text-warn mt-1",children:"Create at least one worker agent first — orchestrators need someone to delegate to."}):(0,s.jsx)("div",{className:"max-h-40 overflow-y-auto bg-hover border border-rule rounded-lg divide-y divide-neutral-800",children:P.map(e=>{let t=y.includes(e.id);return(0,s.jsxs)("label",{className:"flex items-center gap-2 px-3 py-2 text-sm cursor-pointer hover:bg-hover/80",children:[(0,s.jsx)("input",{type:"checkbox",checked:t,onChange:()=>F(e.id),className:"accent-violet-500"}),(0,s.jsx)("span",{className:"text-ink",children:e.name}),(0,s.jsx)("span",{className:"font-mono text-xs text-ink-3 ml-auto",children:e.slug})]},e.id)})})]}),(0,s.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,s.jsx)("button",{type:"submit",disabled:p||q,className:"px-4 py-2 text-sm font-semibold bg-ink text-canvas rounded-lg hover:brightness-[0.92] transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:p?"Creating…":"Create agent"}),(0,s.jsx)("button",{type:"button",onClick:()=>v(!1),className:"px-4 py-2 text-sm font-medium border border-rule text-ink-3 rounded-lg hover:border-rule transition-colors",children:"Cancel"})]})]})})]}),document.body):null;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>v(!0),className:"px-4 py-2 text-sm font-medium bg-ink text-canvas rounded-lg hover:brightness-[0.92] transition-colors",children:"+ New agent"}),U]})}}},e=>{e.O(0,[3363,9504,7025,5436,9123,1065,8724,7358],()=>e(e.s=67849)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2253],{18720:(e,r,t)=>{Promise.resolve().then(t.bind(t,67189)),Promise.resolve().then(t.t.bind(t,63363,23))},64678:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o={callServer:function(){return s.callServer},createServerReference:function(){return c.createServerReference},findSourceMapURL:function(){return a.findSourceMapURL}};for(var n in o)Object.defineProperty(r,n,{enumerable:!0,get:o[n]});let s=t(22673),a=t(43145),c=t(87478)},67189:(e,r,t)=>{"use strict";t.d(r,{default:()=>i});var o=t(3680),n=t(78604),s=t(39504),a=t(64678);let c=(0,a.createServerReference)("400cfdc41e4bf4ffb900586307c0e1b774f8b5393a",a.callServer,void 0,a.findSourceMapURL,"resolveApprovalAction");function i({approvalId:e}){let[r,t]=(0,n.useTransition)(),[a,l]=(0,n.useState)(!1),[d,u]=(0,n.useState)("");return(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsxs)("div",{className:"flex gap-2",children:[(0,o.jsx)("button",{type:"button",onClick:function(){t(async()=>{let r=await c({approvalRequestId:e,decision:"approve"});r.ok?s.oR.success("Approved"):s.oR.error(r.message)})},disabled:r,className:"rounded-md bg-ok px-3 py-1.5 text-xs font-semibold text-canvas transition-[filter] hover:brightness-[0.92] disabled:opacity-40",children:"Approve"}),(0,o.jsx)("button",{type:"button",onClick:function(){a?t(async()=>{let r=await c({approvalRequestId:e,decision:"reject",notes:d.trim()||void 0});r.ok?(s.oR.success("Rejected"),l(!1),u("")):s.oR.error(r.message)}):l(!0)},disabled:r,className:"rounded-md border border-err/30 px-3 py-1.5 text-xs font-semibold text-err transition-colors hover:border-err/60 disabled:opacity-40",children:a?"Confirm reject":"Reject"}),a&&(0,o.jsx)("button",{type:"button",onClick:()=>{l(!1),u("")},className:"px-3 py-1.5 text-xs text-ink-3 hover:text-ink",children:"Cancel"})]}),a&&(0,o.jsx)("textarea",{value:d,onChange:e=>u(e.target.value),placeholder:"Reason for rejection (optional, shown to the agent)",rows:2,maxLength:500,className:"w-full resize-none rounded-md border border-rule bg-canvas px-2 py-1.5 text-xs text-ink placeholder-ink-4 focus:border-ink-3 focus:outline-none"})]})}}},e=>{e.O(0,[3363,9504,1065,8724,7358],()=>e(e.s=18720)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2253],{18720:(e,r,t)=>{Promise.resolve().then(t.bind(t,97799)),Promise.resolve().then(t.t.bind(t,63363,23))},64678:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o={callServer:function(){return s.callServer},createServerReference:function(){return c.createServerReference},findSourceMapURL:function(){return a.findSourceMapURL}};for(var n in o)Object.defineProperty(r,n,{enumerable:!0,get:o[n]});let s=t(22673),a=t(43145),c=t(87478)},97799:(e,r,t)=>{"use strict";t.d(r,{default:()=>i});var o=t(3680),n=t(78604),s=t(39504),a=t(64678);let c=(0,a.createServerReference)("40555201ad9b6108567fd1e445b41bb86aa9c548db",a.callServer,void 0,a.findSourceMapURL,"resolveApprovalAction");function i({approvalId:e}){let[r,t]=(0,n.useTransition)(),[a,l]=(0,n.useState)(!1),[d,u]=(0,n.useState)("");return(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsxs)("div",{className:"flex gap-2",children:[(0,o.jsx)("button",{type:"button",onClick:function(){t(async()=>{let r=await c({approvalRequestId:e,decision:"approve"});r.ok?s.oR.success("Approved"):s.oR.error(r.message)})},disabled:r,className:"rounded-md bg-ok px-3 py-1.5 text-xs font-semibold text-canvas transition-[filter] hover:brightness-[0.92] disabled:opacity-40",children:"Approve"}),(0,o.jsx)("button",{type:"button",onClick:function(){a?t(async()=>{let r=await c({approvalRequestId:e,decision:"reject",notes:d.trim()||void 0});r.ok?(s.oR.success("Rejected"),l(!1),u("")):s.oR.error(r.message)}):l(!0)},disabled:r,className:"rounded-md border border-err/30 px-3 py-1.5 text-xs font-semibold text-err transition-colors hover:border-err/60 disabled:opacity-40",children:a?"Confirm reject":"Reject"}),a&&(0,o.jsx)("button",{type:"button",onClick:()=>{l(!1),u("")},className:"px-3 py-1.5 text-xs text-ink-3 hover:text-ink",children:"Cancel"})]}),a&&(0,o.jsx)("textarea",{value:d,onChange:e=>u(e.target.value),placeholder:"Reason for rejection (optional, shown to the agent)",rows:2,maxLength:500,className:"w-full resize-none rounded-md border border-rule bg-canvas px-2 py-1.5 text-xs text-ink placeholder-ink-4 focus:border-ink-3 focus:outline-none"})]})}}},e=>{e.O(0,[3363,9504,1065,8724,7358],()=>e(e.s=18720)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7665],{14308:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(3680),s=n(78604),a=n(51869);function i({open:e,title:t,message:n,confirmLabel:l="Confirm",cancelLabel:o="Cancel",destructive:d=!0,onConfirm:c,onCancel:u}){let m=(0,s.useRef)(null),[x,h]=(0,s.useState)(!1);return((0,s.useEffect)(()=>{h(!0)},[]),(0,s.useEffect)(()=>{if(e)return m.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&u()}},[e,u]),e&&x)?(0,a.createPortal)((0,r.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",className:"fixed inset-0 z-50 flex items-center justify-center px-4 text-left",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:u,"aria-hidden":"true"}),(0,r.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl p-6 max-w-md w-full shadow-2xl",children:[(0,r.jsx)("h2",{id:"confirm-dialog-title",className:"text-base font-semibold text-ink",children:t}),n&&(0,r.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:n}),(0,r.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,r.jsx)("button",{ref:m,type:"button",onClick:u,className:"px-4 py-2 text-sm font-medium border border-rule text-ink-2 rounded-lg hover:border-rule hover:text-ink transition-colors",children:o}),(0,r.jsx)("button",{type:"button",onClick:c,className:`px-4 py-2 text-sm font-semibold rounded-lg transition-colors ${d?"bg-err hover:brightness-[0.94] text-ink":"bg-ink hover:brightness-[0.92] text-canvas"}`,children:l})]})]})]}),document.body):null}},21369:(e,t,n)=>{"use strict";n.d(t,{E$:()=>s,Ff:()=>o,X3:()=>d,_6:()=>i});var r=n(74178);function s(e,t=new Date){if(!e||"string"!=typeof e)return{ok:!1,error:"Empty expression"};try{let n=r.CronExpressionParser.parse(e.trim(),{currentDate:t}),s=[];for(let e=0;e<3;e++)s.push(n.next().toDate());return{ok:!0,nextRuns:s,humanLabel:i(e)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:"Invalid cron expression"}}}let a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function i(e){let t=e.trim().split(/\s+/);if(5!==t.length)return e;let[n,r,s,i,o]=t;if("*"===n&&"*"===r&&"*"===s&&"*"===i&&"*"===o)return"Every minute";let d=n?.match(/^\*\/(\d+)$/);if(d&&"*"===r&&"*"===s&&"*"===i&&"*"===o)return`Every ${d[1]} minutes`;if("*"===r&&"*"===s&&"*"===i&&"*"===o&&/^\d+$/.test(n??""))return"0"===n?"Every hour (top of hour)":`Every hour at :${(n??"").padStart(2,"0")}`;if("*"===s&&"*"===i&&"*"===o&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??""))return`Every day at ${l(r)}:${l(n)}`;if("*"===s&&"*"===i&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??"")){let e=function(e){if("*"===e)return"day";if("1-5"===e)return"weekday";if("0,6"===e||"6,0"===e)return"weekend";if(/^\d$/.test(e)){let t=parseInt(e,10);if(t>=0&&t<=6)return a[t]??null}return/^[0-6](,[0-6])+$/.test(e)?e.split(",").map(e=>a[parseInt(e,10)]).filter(Boolean).join(", "):null}(o??"");if(e)return`Every ${e} at ${l(r)}:${l(n)}`}return"*"===i&&"*"===o&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??"")&&/^\d+$/.test(s??"")?`Day ${s} of every month at ${l(r)}:${l(n)}`:e}function l(e){return(e??"").padStart(2,"0")}function o(e){let t=function(e){if(!e)return{hour:9,minute:0};let t=e.match(/^(\d{1,2}):(\d{2})$/);return t?{hour:Math.max(0,Math.min(23,parseInt(t[1]??"0",10))),minute:Math.max(0,Math.min(59,parseInt(t[2]??"0",10)))}:{hour:9,minute:0}}(e.time);switch(e.mode){case"minutes":{let t=e.everyMinutes&&e.everyMinutes>0?e.everyMinutes:5;return`*/${t} * * * *`}case"hourly":return`${t.minute} * * * *`;case"daily":return`${t.minute} ${t.hour} * * *`;case"weekly":{let n=e.weekdays&&e.weekdays.length>0?e.weekdays.slice().sort().join(","):"1";return`${t.minute} ${t.hour} * * ${n}`}case"monthly":{let n=e.dayOfMonth&&e.dayOfMonth>0?e.dayOfMonth:1;return`${t.minute} ${t.hour} ${n} * *`}case"custom":return(e.custom??"").trim()}}function d(e){let t=e.trim().split(/\s+/);if(5!==t.length)return{mode:"custom",values:{mode:"custom",custom:e}};let[n,r,s,a,i]=t,o=n?.match(/^\*\/(\d+)$/);if(o&&"*"===r&&"*"===s&&"*"===a&&"*"===i)return{mode:"minutes",values:{mode:"minutes",everyMinutes:parseInt(o[1]??"5",10)}};if("*"===r&&"*"===s&&"*"===a&&"*"===i&&/^\d+$/.test(n??""))return{mode:"hourly",values:{mode:"hourly",time:`00:${l(n)}`}};if("*"===s&&"*"===a&&"*"===i&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??""))return{mode:"daily",values:{mode:"daily",time:`${l(r)}:${l(n)}`}};if("*"===s&&"*"===a&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??"")){let e=function(e){if("*"===e)return[0,1,2,3,4,5,6];if("1-5"===e)return[1,2,3,4,5];if("0,6"===e||"6,0"===e)return[0,6];if(/^\d$/.test(e)){let t=parseInt(e,10);if(t>=0&&t<=6)return[t]}return/^[0-6](,[0-6])+$/.test(e)?e.split(",").map(e=>parseInt(e,10)):null}(i??"");if(e)return{mode:"weekly",values:{mode:"weekly",time:`${l(r)}:${l(n)}`,weekdays:e}}}return"*"===a&&"*"===i&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??"")&&/^\d+$/.test(s??"")?{mode:"monthly",values:{mode:"monthly",time:`${l(r)}:${l(n)}`,dayOfMonth:parseInt(s??"1",10)}}:{mode:"custom",values:{mode:"custom",custom:e}}}},30922:(e,t,n)=>{Promise.resolve().then(n.bind(n,73980)),Promise.resolve().then(n.bind(n,32786))},32786:(e,t,n)=>{"use strict";n.d(t,{default:()=>h});var r=n(3680),s=n(78604),a=n(39504),i=n(64678);let l=(0,i.createServerReference)("400ca4c91c055218dcdc663b53bc21d219783e16f2",i.callServer,void 0,i.findSourceMapURL,"toggleScheduleAction"),o=(0,i.createServerReference)("4069f5841b60ff6b623370147903caf7970d85fc29",i.callServer,void 0,i.findSourceMapURL,"deleteScheduleAction"),d=(0,i.createServerReference)("404912c6c805f1cee60f4f4fc38f2528b768406fb6",i.callServer,void 0,i.findSourceMapURL,"runScheduleNowAction");var c=n(14308),u=n(73980),m=n(21369),x=n(93606);function h({schedule:e,agents:t}){let[n,i]=(0,s.useTransition)(),[b,p]=(0,s.useState)(!1),[f,v]=(0,s.useState)(!1);return f?(0,r.jsx)("div",{className:"space-y-2",children:(0,r.jsx)(u.default,{mode:"edit",agents:t,initial:e,onDone:()=>v(!1)})}):(0,r.jsxs)("div",{className:"space-y-3 rounded-xl border border-rule-2 bg-paper p-5",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-base font-semibold text-ink",children:e.name}),(0,r.jsx)(x.A,{variant:e.active?"done":"idle",label:e.active?"Active":"Paused"})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs text-ink-3",children:[(0,r.jsx)("span",{children:(0,m._6)(e.cronExpr)}),e.agentName&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-rule",children:"\xb7"}),(0,r.jsxs)("span",{children:[e.agentName," ",(0,r.jsx)("span",{className:"font-mono text-ink-4",children:e.agentSlug})]})]}),e.notifyOnSuccess&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-rule",children:"\xb7"}),(0,r.jsx)("span",{title:"Sends you a Telegram confirmation when it succeeds",children:"\uD83D\uDD14 Notifies"})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 text-[10px] text-ink-4",children:[e.nextRun&&e.active&&(0,r.jsxs)("span",{children:["Next run ",new Date(e.nextRun).toLocaleString()]}),e.lastRun&&(0,r.jsxs)("span",{children:["Last run ",new Date(e.lastRun).toLocaleString(),e.lastStatus&&(0,r.jsxs)("span",{className:`ml-1 ${"success"===e.lastStatus?"text-ok":"failed"===e.lastStatus?"text-err":"text-ink-4"}`,children:["(",e.lastStatus,")"]})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("button",{type:"button",onClick:function(){i(async()=>{let t=await d(e.id);t.ok?a.oR.success(`Running "${e.name}" now`):a.oR.error(t.message)})},disabled:n||!e.task,title:e.task?"Run this automation now, outside its schedule":"No task to run",className:"rounded-md border border-rule-2 px-2.5 py-1 text-xs font-medium text-ink-3 transition-colors hover:border-rule hover:text-ink disabled:opacity-40",children:"▶ Run now"}),(0,r.jsx)("button",{type:"button",onClick:()=>v(!0),disabled:n,className:"rounded-md border border-rule-2 px-2.5 py-1 text-xs font-medium text-ink-3 transition-colors hover:border-rule hover:text-ink disabled:opacity-40",children:"Edit"}),(0,r.jsx)("button",{type:"button",onClick:function(){i(async()=>{let t=await l(e.id);t.ok?a.oR.success(t.data.active?"Schedule enabled":"Schedule disabled"):a.oR.error(t.message)})},disabled:n,className:"rounded-md border border-rule-2 px-2.5 py-1 text-xs font-medium text-ink-3 transition-colors hover:border-rule hover:text-ink disabled:opacity-40",children:e.active?"Pause":"Enable"}),(0,r.jsx)("button",{type:"button",onClick:()=>p(!0),disabled:n,className:"rounded-md border border-err/30 px-2.5 py-1 text-xs font-medium text-err transition-colors hover:border-err/60 disabled:opacity-40",children:"Delete"})]})]}),e.task&&(0,r.jsxs)("details",{className:"rounded-md border border-rule bg-canvas",children:[(0,r.jsx)("summary",{className:"cursor-pointer px-3 py-2 text-xs text-ink-3 hover:text-ink-2",children:"Task instructions"}),(0,r.jsx)("pre",{className:"whitespace-pre-wrap px-3 pb-3 text-xs text-ink-2",children:e.task})]}),(0,r.jsx)(c.A,{open:b,title:"Delete schedule?",message:"This cron schedule will be removed. Past runs are kept for audit.",confirmLabel:"Delete",onConfirm:function(){p(!1),i(async()=>{let t=await o(e.id);t.ok?a.oR.success("Schedule deleted"):a.oR.error(t.message)})},onCancel:()=>p(!1)})]})}},73980:(e,t,n)=>{"use strict";n.d(t,{default:()=>h});var r=n(3680),s=n(78604),a=n(39504),i=n(64678);let l=(0,i.createServerReference)("405441c5447e7f0cc99b8c935b54e903aa38a592ca",i.callServer,void 0,i.findSourceMapURL,"updateScheduleAction"),o=(0,i.createServerReference)("404ae92a4884f24a9d0d96b484c9a0eb05289bdc1c",i.callServer,void 0,i.findSourceMapURL,"createScheduleAction");var d=n(21369);let c=[{n:1,label:"Mon"},{n:2,label:"Tue"},{n:3,label:"Wed"},{n:4,label:"Thu"},{n:5,label:"Fri"},{n:6,label:"Sat"},{n:0,label:"Sun"}],u=[1,5,10,15,30];function m({name:e="cronExpr",initial:t}){let n=(0,s.useMemo)(()=>t?(0,d.X3)(t):{mode:"daily",values:{mode:"daily",time:"09:00"}},[t]),[a,i]=(0,s.useState)(n.mode),[l,o]=(0,s.useState)(n.values.everyMinutes??5),[h,b]=(0,s.useState)(n.values.time??"09:00"),[p,f]=(0,s.useState)(n.values.weekdays??[1,2,3,4,5]),[v,k]=(0,s.useState)(n.values.dayOfMonth??1),[g,y]=(0,s.useState)(n.values.custom??t??"0 9 * * *"),j=(0,s.useMemo)(()=>(0,d.Ff)({mode:a,everyMinutes:l,time:h,weekdays:p,dayOfMonth:v,custom:g}),[a,l,h,p,v,g]),N=(0,s.useMemo)(()=>(0,d.E$)(j),[j]);return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("input",{type:"hidden",name:e,value:j}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-mode",className:"block text-xs text-ink-3 mb-1",children:"Frequency"}),(0,r.jsxs)("select",{id:"cron-mode",value:a,onChange:e=>i(e.target.value),className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none",children:[(0,r.jsx)("option",{value:"minutes",children:"Every N minutes"}),(0,r.jsx)("option",{value:"hourly",children:"Hourly"}),(0,r.jsx)("option",{value:"daily",children:"Daily"}),(0,r.jsx)("option",{value:"weekly",children:"Weekly"}),(0,r.jsx)("option",{value:"monthly",children:"Monthly"}),(0,r.jsx)("option",{value:"custom",children:"Custom (cron)"})]})]}),"minutes"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-every",className:"block text-xs text-ink-3 mb-1",children:"Every"}),(0,r.jsx)("select",{id:"cron-every",value:l,onChange:e=>o(parseInt(e.target.value,10)),className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none",children:u.map(e=>(0,r.jsxs)("option",{value:e,children:[e," ",1===e?"minute":"minutes"]},e))})]}),"hourly"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-min-of-hour",className:"block text-xs text-ink-3 mb-1",children:"At minute"}),(0,r.jsx)("input",{id:"cron-min-of-hour",type:"number",min:0,max:59,value:parseInt(h.split(":")[1]??"0",10),onChange:e=>{let t=Math.max(0,Math.min(59,parseInt(e.target.value||"0",10)));b(`00:${String(t).padStart(2,"0")}`)},className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none"})]}),("daily"===a||"weekly"===a||"monthly"===a)&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-time",className:"block text-xs text-ink-3 mb-1",children:"Time"}),(0,r.jsx)("input",{id:"cron-time",type:"time",value:h,onChange:e=>b(e.target.value),className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none"})]})]}),"weekly"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:"Days"}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:c.map(e=>{let t=p.includes(e.n);return(0,r.jsx)("button",{type:"button",onClick:()=>{var t;return t=e.n,void f(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t].sort())},className:`px-2.5 py-1 text-xs font-medium rounded border ${t?"bg-run-bg border-run/30 text-run":"border-rule-2 text-ink-3 hover:border-rule hover:text-ink"}`,children:e.label},e.n)})})]}),"monthly"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-dom",className:"block text-xs text-ink-3 mb-1",children:"Day of month"}),(0,r.jsx)("input",{id:"cron-dom",type:"number",min:1,max:31,value:v,onChange:e=>k(Math.max(1,Math.min(31,parseInt(e.target.value||"1",10)))),className:"w-32 bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none"})]}),"custom"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-custom",className:"block text-xs text-ink-3 mb-1",children:"Cron expression"}),(0,r.jsx)("input",{id:"cron-custom",type:"text",value:g,onChange:e=>y(e.target.value),placeholder:"0 9 * * *",className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none font-mono"}),(0,r.jsx)("p",{className:"text-[10px] text-ink-4 mt-1",children:"Format: minute hour day-of-month month day-of-week"})]}),(0,r.jsx)(x,{expr:j,preview:N})]})}function x({expr:e,preview:t}){return t.ok?(0,r.jsxs)("div",{className:"bg-canvas border border-rule-2 rounded-md px-3 py-2 space-y-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,r.jsx)("span",{className:"text-ink-3",children:"Schedule:"}),(0,r.jsx)("span",{className:"text-ink",children:t.humanLabel}),(0,r.jsx)("code",{className:"ml-auto font-mono text-[10px] text-run",children:e})]}),(0,r.jsxs)("div",{className:"text-[10px] text-ink-4",suppressHydrationWarning:!0,children:["Next runs: ",t.nextRuns.map(e=>e.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})).join(" \xb7 ")]})]}):(0,r.jsxs)("div",{className:"bg-warn-bg border border-err/30 rounded-md px-3 py-2 text-xs text-err",children:[(0,r.jsx)("span",{className:"font-semibold",children:"Invalid:"})," ",t.error]})}function h(e){let t="edit"===e.mode,[n,i]=(0,s.useState)(t),[d,c]=(0,s.useTransition)(),[u,x]=(0,s.useState)(t?e.initial.agentId:""),[h,b]=(0,s.useState)(!!t&&!0===e.initial.notifyOnSuccess);if(!t&&!n)return(0,r.jsx)("button",{type:"button",onClick:()=>i(!0),disabled:0===e.agents.length,className:"inline-flex h-[34px] items-center gap-1.5 rounded-md border-0 bg-ink px-3.5 text-[13px] font-medium leading-none text-canvas transition-[filter] hover:brightness-[0.92] disabled:cursor-not-allowed disabled:opacity-40",title:0===e.agents.length?"Create an agent first":"",children:"+ New schedule"});let p=t?e.initial.name:"",f=t?e.initial.task??"":"",v=t?e.initial.cronExpr:"0 9 * * *",k=e.agents.find(e=>e.id===u),g=h&&null!=k&&!k.telegramBotToken;return(0,r.jsxs)("form",{onSubmit:function(n){n.preventDefault();let r=n.currentTarget,s=new FormData(r);c(async()=>{if(t){let t=await l({id:e.initial.id,agentId:u,name:s.get("name"),cronExpr:s.get("cronExpr"),task:s.get("task"),notifyOnSuccess:h});t.ok?(a.oR.success("Schedule updated"),e.onDone?.()):a.oR.error(t.message)}else{let t=await o({agentId:u,name:s.get("name"),cronExpr:s.get("cronExpr"),task:s.get("task"),notifyOnSuccess:h});t.ok?(a.oR.success("Schedule created"),r.reset(),x(""),b(!1),i(!1),e.onDone?.()):a.oR.error(t.message)}})},className:"space-y-3 rounded-xl border border-rule-2 bg-paper p-5",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-ink",children:t?"Edit schedule":"New schedule"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs text-ink-3",htmlFor:"schedule-agent",children:"Agent"}),(0,r.jsxs)("select",{id:"schedule-agent",name:"agentId",required:!0,value:u,onChange:e=>x(e.target.value),className:"w-full rounded-md border border-rule bg-canvas px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none",children:[(0,r.jsx)("option",{value:"",children:"Select…"}),e.agents.map(e=>(0,r.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs text-ink-3",htmlFor:"schedule-name",children:"Name"}),(0,r.jsx)("input",{id:"schedule-name",name:"name",required:!0,defaultValue:p,placeholder:"Daily standup",className:"w-full rounded-md border border-rule bg-canvas px-2 py-1.5 text-sm text-ink placeholder-ink-4 focus:border-ink-3 focus:outline-none"})]})]}),(0,r.jsx)(m,{name:"cronExpr",initial:v}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs text-ink-3",htmlFor:"schedule-task",children:"Task instructions"}),(0,r.jsx)("textarea",{id:"schedule-task",name:"task",required:!0,rows:4,defaultValue:f,placeholder:"What should the agent do each time this fires?",className:"w-full resize-y rounded-md border border-rule bg-canvas px-2 py-1.5 text-sm text-ink placeholder-ink-4 focus:border-ink-3 focus:outline-none"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("label",{className:"flex items-start gap-2.5 rounded-md border border-rule bg-canvas px-3 py-2.5 text-sm",children:[(0,r.jsx)("input",{type:"checkbox",name:"notifyOnSuccess",checked:h,onChange:e=>b(e.target.checked),className:"mt-0.5 h-4 w-4 shrink-0 accent-ink"}),(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{className:"font-medium text-ink",children:"Notify me on Telegram when it succeeds"}),(0,r.jsx)("span",{className:"mt-0.5 block text-xs text-ink-3",children:"The agent sends you a short confirmation each time this automation finishes. Requires a Telegram bot on the agent (DM it once so it knows where to reach you)."})]})]}),g&&(0,r.jsxs)("p",{className:"rounded-md border border-warn/30 bg-warn-bg px-3 py-2 text-xs text-warn",children:["⚠️ ",(0,r.jsx)("span",{className:"font-medium",children:k?.name})," has no Telegram bot, so it can't send you this confirmation. Schedule this automation on a Telegram-connected agent, or connect a bot to this one."]})]}),(0,r.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,r.jsx)("button",{type:"submit",disabled:d,className:"inline-flex h-[34px] items-center gap-1.5 rounded-md border-0 bg-ink px-3.5 text-[13px] font-medium leading-none text-canvas transition-[filter] hover:brightness-[0.92] disabled:opacity-50",children:d?t?"Saving…":"Creating…":t?"Save changes":"Create schedule"}),(0,r.jsx)("button",{type:"button",onClick:()=>{t?e.onDone?.():i(!1)},className:"inline-flex h-[34px] items-center rounded-md border border-rule-2 px-3.5 text-[13px] font-medium text-ink-3 transition-colors hover:border-rule hover:text-ink",children:"Cancel"})]})]})}},81444:()=>{},82592:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(3680);let s={ok:"bg-ok",lime:"bg-agent-vivid",coral:"bg-skill-vivid",blue:"bg-conn-vivid"},a={ok:"animate-[blip_1.4s_ease-out_infinite]",lime:"animate-[blip-lime_1.5s_ease-out_infinite]",coral:"animate-[blip-coral_1.4s_ease-out_infinite]",blue:"animate-[blip-blue_1.4s_ease-out_infinite]"};function i({variant:e="ok",size:t="sm",animate:n=!0,className:l=""}){return(0,r.jsx)("span",{className:`inline-block shrink-0 rounded-full ${"sm"===t?"h-[7px] w-[7px]":"h-2 w-2"} ${s[e]} ${n?a[e]:""} ${l}`})}},93606:(e,t,n)=>{"use strict";n.d(t,{A:()=>d});var r=n(3680),s=n(86127),a=n(22089),i=n(82592);let l={done:"Done",warn:"Attention",run:"Running",idle:"Idle","lvl-info":"INFO","lvl-ok":"OK","lvl-warn":"WARN","lvl-err":"ERR"},o={done:"bg-ok-bg text-ok",warn:"bg-warn-bg text-warn",run:"bg-run-bg text-run",idle:"bg-black/5 text-ink-3 dark:bg-white/5","lvl-info":"bg-black/5 text-ink-3 dark:bg-white/5","lvl-ok":"bg-ok-bg text-ok","lvl-warn":"bg-warn-bg text-warn","lvl-err":"bg-warn-bg text-err"};function d({variant:e,label:t,icon:n,className:c=""}){let u=t??l[e],m=null;return void 0!==n?m=n:"done"===e?m=(0,r.jsx)(s.r,{size:11,weight:"regular"}):"warn"===e?m=(0,r.jsx)(a.N,{size:11,weight:"regular"}):"run"===e&&(m=(0,r.jsx)(i.A,{variant:"blue",size:"sm"})),(0,r.jsxs)("span",{className:`inline-flex h-[22px] items-center gap-1.5 rounded-[5px] px-2.5 text-[11px] font-medium leading-none ${o[e]} ${c}`,children:[m,u]})}},96333:()=>{}},e=>{e.O(0,[4641,9504,9167,1065,8724,7358],()=>e(e.s=30922)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7665],{14308:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(3680),s=n(78604),a=n(51869);function i({open:e,title:t,message:n,confirmLabel:l="Confirm",cancelLabel:o="Cancel",destructive:d=!0,onConfirm:c,onCancel:u}){let m=(0,s.useRef)(null),[x,h]=(0,s.useState)(!1);return((0,s.useEffect)(()=>{h(!0)},[]),(0,s.useEffect)(()=>{if(e)return m.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&u()}},[e,u]),e&&x)?(0,a.createPortal)((0,r.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",className:"fixed inset-0 z-50 flex items-center justify-center px-4 text-left",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:u,"aria-hidden":"true"}),(0,r.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl p-6 max-w-md w-full shadow-2xl",children:[(0,r.jsx)("h2",{id:"confirm-dialog-title",className:"text-base font-semibold text-ink",children:t}),n&&(0,r.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:n}),(0,r.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,r.jsx)("button",{ref:m,type:"button",onClick:u,className:"px-4 py-2 text-sm font-medium border border-rule text-ink-2 rounded-lg hover:border-rule hover:text-ink transition-colors",children:o}),(0,r.jsx)("button",{type:"button",onClick:c,className:`px-4 py-2 text-sm font-semibold rounded-lg transition-colors ${d?"bg-err hover:brightness-[0.94] text-ink":"bg-ink hover:brightness-[0.92] text-canvas"}`,children:l})]})]})]}),document.body):null}},20125:(e,t,n)=>{"use strict";n.d(t,{default:()=>h});var r=n(3680),s=n(78604),a=n(39504),i=n(64678);let l=(0,i.createServerReference)("40636072bcb4efeb9d67f99498d3e984b1f52b51fc",i.callServer,void 0,i.findSourceMapURL,"toggleScheduleAction"),o=(0,i.createServerReference)("40245a2e007dbf597e697c65a7beb167abca4eab76",i.callServer,void 0,i.findSourceMapURL,"deleteScheduleAction"),d=(0,i.createServerReference)("405baecc1b1556260c43db88c1cbdea3f44aa47fea",i.callServer,void 0,i.findSourceMapURL,"runScheduleNowAction");var c=n(14308),u=n(40990),m=n(21369),x=n(93606);function h({schedule:e,agents:t}){let[n,i]=(0,s.useTransition)(),[b,p]=(0,s.useState)(!1),[f,v]=(0,s.useState)(!1);return f?(0,r.jsx)("div",{className:"space-y-2",children:(0,r.jsx)(u.default,{mode:"edit",agents:t,initial:e,onDone:()=>v(!1)})}):(0,r.jsxs)("div",{className:"space-y-3 rounded-xl border border-rule-2 bg-paper p-5",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-base font-semibold text-ink",children:e.name}),(0,r.jsx)(x.A,{variant:e.active?"done":"idle",label:e.active?"Active":"Paused"})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs text-ink-3",children:[(0,r.jsx)("span",{children:(0,m._6)(e.cronExpr)}),e.agentName&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-rule",children:"\xb7"}),(0,r.jsxs)("span",{children:[e.agentName," ",(0,r.jsx)("span",{className:"font-mono text-ink-4",children:e.agentSlug})]})]}),e.notifyOnSuccess&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-rule",children:"\xb7"}),(0,r.jsx)("span",{title:"Sends you a Telegram confirmation when it succeeds",children:"\uD83D\uDD14 Notifies"})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 text-[10px] text-ink-4",children:[e.nextRun&&e.active&&(0,r.jsxs)("span",{children:["Next run ",new Date(e.nextRun).toLocaleString()]}),e.lastRun&&(0,r.jsxs)("span",{children:["Last run ",new Date(e.lastRun).toLocaleString(),e.lastStatus&&(0,r.jsxs)("span",{className:`ml-1 ${"success"===e.lastStatus?"text-ok":"failed"===e.lastStatus?"text-err":"text-ink-4"}`,children:["(",e.lastStatus,")"]})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("button",{type:"button",onClick:function(){i(async()=>{let t=await d(e.id);t.ok?a.oR.success(`Running "${e.name}" now`):a.oR.error(t.message)})},disabled:n||!e.task,title:e.task?"Run this automation now, outside its schedule":"No task to run",className:"rounded-md border border-rule-2 px-2.5 py-1 text-xs font-medium text-ink-3 transition-colors hover:border-rule hover:text-ink disabled:opacity-40",children:"▶ Run now"}),(0,r.jsx)("button",{type:"button",onClick:()=>v(!0),disabled:n,className:"rounded-md border border-rule-2 px-2.5 py-1 text-xs font-medium text-ink-3 transition-colors hover:border-rule hover:text-ink disabled:opacity-40",children:"Edit"}),(0,r.jsx)("button",{type:"button",onClick:function(){i(async()=>{let t=await l(e.id);t.ok?a.oR.success(t.data.active?"Schedule enabled":"Schedule disabled"):a.oR.error(t.message)})},disabled:n,className:"rounded-md border border-rule-2 px-2.5 py-1 text-xs font-medium text-ink-3 transition-colors hover:border-rule hover:text-ink disabled:opacity-40",children:e.active?"Pause":"Enable"}),(0,r.jsx)("button",{type:"button",onClick:()=>p(!0),disabled:n,className:"rounded-md border border-err/30 px-2.5 py-1 text-xs font-medium text-err transition-colors hover:border-err/60 disabled:opacity-40",children:"Delete"})]})]}),e.task&&(0,r.jsxs)("details",{className:"rounded-md border border-rule bg-canvas",children:[(0,r.jsx)("summary",{className:"cursor-pointer px-3 py-2 text-xs text-ink-3 hover:text-ink-2",children:"Task instructions"}),(0,r.jsx)("pre",{className:"whitespace-pre-wrap px-3 pb-3 text-xs text-ink-2",children:e.task})]}),(0,r.jsx)(c.A,{open:b,title:"Delete schedule?",message:"This cron schedule will be removed. Past runs are kept for audit.",confirmLabel:"Delete",onConfirm:function(){p(!1),i(async()=>{let t=await o(e.id);t.ok?a.oR.success("Schedule deleted"):a.oR.error(t.message)})},onCancel:()=>p(!1)})]})}},21369:(e,t,n)=>{"use strict";n.d(t,{E$:()=>s,Ff:()=>o,X3:()=>d,_6:()=>i});var r=n(74178);function s(e,t=new Date){if(!e||"string"!=typeof e)return{ok:!1,error:"Empty expression"};try{let n=r.CronExpressionParser.parse(e.trim(),{currentDate:t}),s=[];for(let e=0;e<3;e++)s.push(n.next().toDate());return{ok:!0,nextRuns:s,humanLabel:i(e)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:"Invalid cron expression"}}}let a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function i(e){let t=e.trim().split(/\s+/);if(5!==t.length)return e;let[n,r,s,i,o]=t;if("*"===n&&"*"===r&&"*"===s&&"*"===i&&"*"===o)return"Every minute";let d=n?.match(/^\*\/(\d+)$/);if(d&&"*"===r&&"*"===s&&"*"===i&&"*"===o)return`Every ${d[1]} minutes`;if("*"===r&&"*"===s&&"*"===i&&"*"===o&&/^\d+$/.test(n??""))return"0"===n?"Every hour (top of hour)":`Every hour at :${(n??"").padStart(2,"0")}`;if("*"===s&&"*"===i&&"*"===o&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??""))return`Every day at ${l(r)}:${l(n)}`;if("*"===s&&"*"===i&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??"")){let e=function(e){if("*"===e)return"day";if("1-5"===e)return"weekday";if("0,6"===e||"6,0"===e)return"weekend";if(/^\d$/.test(e)){let t=parseInt(e,10);if(t>=0&&t<=6)return a[t]??null}return/^[0-6](,[0-6])+$/.test(e)?e.split(",").map(e=>a[parseInt(e,10)]).filter(Boolean).join(", "):null}(o??"");if(e)return`Every ${e} at ${l(r)}:${l(n)}`}return"*"===i&&"*"===o&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??"")&&/^\d+$/.test(s??"")?`Day ${s} of every month at ${l(r)}:${l(n)}`:e}function l(e){return(e??"").padStart(2,"0")}function o(e){let t=function(e){if(!e)return{hour:9,minute:0};let t=e.match(/^(\d{1,2}):(\d{2})$/);return t?{hour:Math.max(0,Math.min(23,parseInt(t[1]??"0",10))),minute:Math.max(0,Math.min(59,parseInt(t[2]??"0",10)))}:{hour:9,minute:0}}(e.time);switch(e.mode){case"minutes":{let t=e.everyMinutes&&e.everyMinutes>0?e.everyMinutes:5;return`*/${t} * * * *`}case"hourly":return`${t.minute} * * * *`;case"daily":return`${t.minute} ${t.hour} * * *`;case"weekly":{let n=e.weekdays&&e.weekdays.length>0?e.weekdays.slice().sort().join(","):"1";return`${t.minute} ${t.hour} * * ${n}`}case"monthly":{let n=e.dayOfMonth&&e.dayOfMonth>0?e.dayOfMonth:1;return`${t.minute} ${t.hour} ${n} * *`}case"custom":return(e.custom??"").trim()}}function d(e){let t=e.trim().split(/\s+/);if(5!==t.length)return{mode:"custom",values:{mode:"custom",custom:e}};let[n,r,s,a,i]=t,o=n?.match(/^\*\/(\d+)$/);if(o&&"*"===r&&"*"===s&&"*"===a&&"*"===i)return{mode:"minutes",values:{mode:"minutes",everyMinutes:parseInt(o[1]??"5",10)}};if("*"===r&&"*"===s&&"*"===a&&"*"===i&&/^\d+$/.test(n??""))return{mode:"hourly",values:{mode:"hourly",time:`00:${l(n)}`}};if("*"===s&&"*"===a&&"*"===i&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??""))return{mode:"daily",values:{mode:"daily",time:`${l(r)}:${l(n)}`}};if("*"===s&&"*"===a&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??"")){let e=function(e){if("*"===e)return[0,1,2,3,4,5,6];if("1-5"===e)return[1,2,3,4,5];if("0,6"===e||"6,0"===e)return[0,6];if(/^\d$/.test(e)){let t=parseInt(e,10);if(t>=0&&t<=6)return[t]}return/^[0-6](,[0-6])+$/.test(e)?e.split(",").map(e=>parseInt(e,10)):null}(i??"");if(e)return{mode:"weekly",values:{mode:"weekly",time:`${l(r)}:${l(n)}`,weekdays:e}}}return"*"===a&&"*"===i&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??"")&&/^\d+$/.test(s??"")?{mode:"monthly",values:{mode:"monthly",time:`${l(r)}:${l(n)}`,dayOfMonth:parseInt(s??"1",10)}}:{mode:"custom",values:{mode:"custom",custom:e}}}},30922:(e,t,n)=>{Promise.resolve().then(n.bind(n,40990)),Promise.resolve().then(n.bind(n,20125))},40990:(e,t,n)=>{"use strict";n.d(t,{default:()=>h});var r=n(3680),s=n(78604),a=n(39504),i=n(64678);let l=(0,i.createServerReference)("40968376cf71f09beaceb5af45c00b88be86871e29",i.callServer,void 0,i.findSourceMapURL,"updateScheduleAction"),o=(0,i.createServerReference)("40f91faf74d47eaf54ef1581686fdb3d9c75750615",i.callServer,void 0,i.findSourceMapURL,"createScheduleAction");var d=n(21369);let c=[{n:1,label:"Mon"},{n:2,label:"Tue"},{n:3,label:"Wed"},{n:4,label:"Thu"},{n:5,label:"Fri"},{n:6,label:"Sat"},{n:0,label:"Sun"}],u=[1,5,10,15,30];function m({name:e="cronExpr",initial:t}){let n=(0,s.useMemo)(()=>t?(0,d.X3)(t):{mode:"daily",values:{mode:"daily",time:"09:00"}},[t]),[a,i]=(0,s.useState)(n.mode),[l,o]=(0,s.useState)(n.values.everyMinutes??5),[h,b]=(0,s.useState)(n.values.time??"09:00"),[p,f]=(0,s.useState)(n.values.weekdays??[1,2,3,4,5]),[v,k]=(0,s.useState)(n.values.dayOfMonth??1),[g,y]=(0,s.useState)(n.values.custom??t??"0 9 * * *"),j=(0,s.useMemo)(()=>(0,d.Ff)({mode:a,everyMinutes:l,time:h,weekdays:p,dayOfMonth:v,custom:g}),[a,l,h,p,v,g]),N=(0,s.useMemo)(()=>(0,d.E$)(j),[j]);return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("input",{type:"hidden",name:e,value:j}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-mode",className:"block text-xs text-ink-3 mb-1",children:"Frequency"}),(0,r.jsxs)("select",{id:"cron-mode",value:a,onChange:e=>i(e.target.value),className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none",children:[(0,r.jsx)("option",{value:"minutes",children:"Every N minutes"}),(0,r.jsx)("option",{value:"hourly",children:"Hourly"}),(0,r.jsx)("option",{value:"daily",children:"Daily"}),(0,r.jsx)("option",{value:"weekly",children:"Weekly"}),(0,r.jsx)("option",{value:"monthly",children:"Monthly"}),(0,r.jsx)("option",{value:"custom",children:"Custom (cron)"})]})]}),"minutes"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-every",className:"block text-xs text-ink-3 mb-1",children:"Every"}),(0,r.jsx)("select",{id:"cron-every",value:l,onChange:e=>o(parseInt(e.target.value,10)),className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none",children:u.map(e=>(0,r.jsxs)("option",{value:e,children:[e," ",1===e?"minute":"minutes"]},e))})]}),"hourly"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-min-of-hour",className:"block text-xs text-ink-3 mb-1",children:"At minute"}),(0,r.jsx)("input",{id:"cron-min-of-hour",type:"number",min:0,max:59,value:parseInt(h.split(":")[1]??"0",10),onChange:e=>{let t=Math.max(0,Math.min(59,parseInt(e.target.value||"0",10)));b(`00:${String(t).padStart(2,"0")}`)},className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none"})]}),("daily"===a||"weekly"===a||"monthly"===a)&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-time",className:"block text-xs text-ink-3 mb-1",children:"Time"}),(0,r.jsx)("input",{id:"cron-time",type:"time",value:h,onChange:e=>b(e.target.value),className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none"})]})]}),"weekly"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:"Days"}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:c.map(e=>{let t=p.includes(e.n);return(0,r.jsx)("button",{type:"button",onClick:()=>{var t;return t=e.n,void f(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t].sort())},className:`px-2.5 py-1 text-xs font-medium rounded border ${t?"bg-run-bg border-run/30 text-run":"border-rule-2 text-ink-3 hover:border-rule hover:text-ink"}`,children:e.label},e.n)})})]}),"monthly"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-dom",className:"block text-xs text-ink-3 mb-1",children:"Day of month"}),(0,r.jsx)("input",{id:"cron-dom",type:"number",min:1,max:31,value:v,onChange:e=>k(Math.max(1,Math.min(31,parseInt(e.target.value||"1",10)))),className:"w-32 bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none"})]}),"custom"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-custom",className:"block text-xs text-ink-3 mb-1",children:"Cron expression"}),(0,r.jsx)("input",{id:"cron-custom",type:"text",value:g,onChange:e=>y(e.target.value),placeholder:"0 9 * * *",className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none font-mono"}),(0,r.jsx)("p",{className:"text-[10px] text-ink-4 mt-1",children:"Format: minute hour day-of-month month day-of-week"})]}),(0,r.jsx)(x,{expr:j,preview:N})]})}function x({expr:e,preview:t}){return t.ok?(0,r.jsxs)("div",{className:"bg-canvas border border-rule-2 rounded-md px-3 py-2 space-y-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,r.jsx)("span",{className:"text-ink-3",children:"Schedule:"}),(0,r.jsx)("span",{className:"text-ink",children:t.humanLabel}),(0,r.jsx)("code",{className:"ml-auto font-mono text-[10px] text-run",children:e})]}),(0,r.jsxs)("div",{className:"text-[10px] text-ink-4",suppressHydrationWarning:!0,children:["Next runs: ",t.nextRuns.map(e=>e.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})).join(" \xb7 ")]})]}):(0,r.jsxs)("div",{className:"bg-warn-bg border border-err/30 rounded-md px-3 py-2 text-xs text-err",children:[(0,r.jsx)("span",{className:"font-semibold",children:"Invalid:"})," ",t.error]})}function h(e){let t="edit"===e.mode,[n,i]=(0,s.useState)(t),[d,c]=(0,s.useTransition)(),[u,x]=(0,s.useState)(t?e.initial.agentId:""),[h,b]=(0,s.useState)(!!t&&!0===e.initial.notifyOnSuccess);if(!t&&!n)return(0,r.jsx)("button",{type:"button",onClick:()=>i(!0),disabled:0===e.agents.length,className:"inline-flex h-[34px] items-center gap-1.5 rounded-md border-0 bg-ink px-3.5 text-[13px] font-medium leading-none text-canvas transition-[filter] hover:brightness-[0.92] disabled:cursor-not-allowed disabled:opacity-40",title:0===e.agents.length?"Create an agent first":"",children:"+ New schedule"});let p=t?e.initial.name:"",f=t?e.initial.task??"":"",v=t?e.initial.cronExpr:"0 9 * * *",k=e.agents.find(e=>e.id===u),g=h&&null!=k&&!k.telegramBotToken;return(0,r.jsxs)("form",{onSubmit:function(n){n.preventDefault();let r=n.currentTarget,s=new FormData(r);c(async()=>{if(t){let t=await l({id:e.initial.id,agentId:u,name:s.get("name"),cronExpr:s.get("cronExpr"),task:s.get("task"),notifyOnSuccess:h});t.ok?(a.oR.success("Schedule updated"),e.onDone?.()):a.oR.error(t.message)}else{let t=await o({agentId:u,name:s.get("name"),cronExpr:s.get("cronExpr"),task:s.get("task"),notifyOnSuccess:h});t.ok?(a.oR.success("Schedule created"),r.reset(),x(""),b(!1),i(!1),e.onDone?.()):a.oR.error(t.message)}})},className:"space-y-3 rounded-xl border border-rule-2 bg-paper p-5",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-ink",children:t?"Edit schedule":"New schedule"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs text-ink-3",htmlFor:"schedule-agent",children:"Agent"}),(0,r.jsxs)("select",{id:"schedule-agent",name:"agentId",required:!0,value:u,onChange:e=>x(e.target.value),className:"w-full rounded-md border border-rule bg-canvas px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none",children:[(0,r.jsx)("option",{value:"",children:"Select…"}),e.agents.map(e=>(0,r.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs text-ink-3",htmlFor:"schedule-name",children:"Name"}),(0,r.jsx)("input",{id:"schedule-name",name:"name",required:!0,defaultValue:p,placeholder:"Daily standup",className:"w-full rounded-md border border-rule bg-canvas px-2 py-1.5 text-sm text-ink placeholder-ink-4 focus:border-ink-3 focus:outline-none"})]})]}),(0,r.jsx)(m,{name:"cronExpr",initial:v}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs text-ink-3",htmlFor:"schedule-task",children:"Task instructions"}),(0,r.jsx)("textarea",{id:"schedule-task",name:"task",required:!0,rows:4,defaultValue:f,placeholder:"What should the agent do each time this fires?",className:"w-full resize-y rounded-md border border-rule bg-canvas px-2 py-1.5 text-sm text-ink placeholder-ink-4 focus:border-ink-3 focus:outline-none"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("label",{className:"flex items-start gap-2.5 rounded-md border border-rule bg-canvas px-3 py-2.5 text-sm",children:[(0,r.jsx)("input",{type:"checkbox",name:"notifyOnSuccess",checked:h,onChange:e=>b(e.target.checked),className:"mt-0.5 h-4 w-4 shrink-0 accent-ink"}),(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{className:"font-medium text-ink",children:"Notify me on Telegram when it succeeds"}),(0,r.jsx)("span",{className:"mt-0.5 block text-xs text-ink-3",children:"The agent sends you a short confirmation each time this automation finishes. Requires a Telegram bot on the agent (DM it once so it knows where to reach you)."})]})]}),g&&(0,r.jsxs)("p",{className:"rounded-md border border-warn/30 bg-warn-bg px-3 py-2 text-xs text-warn",children:["⚠️ ",(0,r.jsx)("span",{className:"font-medium",children:k?.name})," has no Telegram bot, so it can't send you this confirmation. Schedule this automation on a Telegram-connected agent, or connect a bot to this one."]})]}),(0,r.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,r.jsx)("button",{type:"submit",disabled:d,className:"inline-flex h-[34px] items-center gap-1.5 rounded-md border-0 bg-ink px-3.5 text-[13px] font-medium leading-none text-canvas transition-[filter] hover:brightness-[0.92] disabled:opacity-50",children:d?t?"Saving…":"Creating…":t?"Save changes":"Create schedule"}),(0,r.jsx)("button",{type:"button",onClick:()=>{t?e.onDone?.():i(!1)},className:"inline-flex h-[34px] items-center rounded-md border border-rule-2 px-3.5 text-[13px] font-medium text-ink-3 transition-colors hover:border-rule hover:text-ink",children:"Cancel"})]})]})}},81444:()=>{},82592:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(3680);let s={ok:"bg-ok",lime:"bg-agent-vivid",coral:"bg-skill-vivid",blue:"bg-conn-vivid"},a={ok:"animate-[blip_1.4s_ease-out_infinite]",lime:"animate-[blip-lime_1.5s_ease-out_infinite]",coral:"animate-[blip-coral_1.4s_ease-out_infinite]",blue:"animate-[blip-blue_1.4s_ease-out_infinite]"};function i({variant:e="ok",size:t="sm",animate:n=!0,className:l=""}){return(0,r.jsx)("span",{className:`inline-block shrink-0 rounded-full ${"sm"===t?"h-[7px] w-[7px]":"h-2 w-2"} ${s[e]} ${n?a[e]:""} ${l}`})}},93606:(e,t,n)=>{"use strict";n.d(t,{A:()=>d});var r=n(3680),s=n(86127),a=n(22089),i=n(82592);let l={done:"Done",warn:"Attention",run:"Running",idle:"Idle","lvl-info":"INFO","lvl-ok":"OK","lvl-warn":"WARN","lvl-err":"ERR"},o={done:"bg-ok-bg text-ok",warn:"bg-warn-bg text-warn",run:"bg-run-bg text-run",idle:"bg-black/5 text-ink-3 dark:bg-white/5","lvl-info":"bg-black/5 text-ink-3 dark:bg-white/5","lvl-ok":"bg-ok-bg text-ok","lvl-warn":"bg-warn-bg text-warn","lvl-err":"bg-warn-bg text-err"};function d({variant:e,label:t,icon:n,className:c=""}){let u=t??l[e],m=null;return void 0!==n?m=n:"done"===e?m=(0,r.jsx)(s.r,{size:11,weight:"regular"}):"warn"===e?m=(0,r.jsx)(a.N,{size:11,weight:"regular"}):"run"===e&&(m=(0,r.jsx)(i.A,{variant:"blue",size:"sm"})),(0,r.jsxs)("span",{className:`inline-flex h-[22px] items-center gap-1.5 rounded-[5px] px-2.5 text-[11px] font-medium leading-none ${o[e]} ${c}`,children:[m,u]})}},96333:()=>{}},e=>{e.O(0,[4641,9504,9167,1065,8724,7358],()=>e(e.s=30922)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3705],{14308:(e,t,a)=>{"use strict";a.d(t,{A:()=>l});var r=a(3680),n=a(78604),s=a(51869);function l({open:e,title:t,message:a,confirmLabel:i="Confirm",cancelLabel:o="Cancel",destructive:c=!0,onConfirm:d,onCancel:u}){let m=(0,n.useRef)(null),[x,p]=(0,n.useState)(!1);return((0,n.useEffect)(()=>{p(!0)},[]),(0,n.useEffect)(()=>{if(e)return m.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&u()}},[e,u]),e&&x)?(0,s.createPortal)((0,r.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",className:"fixed inset-0 z-50 flex items-center justify-center px-4 text-left",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:u,"aria-hidden":"true"}),(0,r.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl p-6 max-w-md w-full shadow-2xl",children:[(0,r.jsx)("h2",{id:"confirm-dialog-title",className:"text-base font-semibold text-ink",children:t}),a&&(0,r.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:a}),(0,r.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,r.jsx)("button",{ref:m,type:"button",onClick:u,className:"px-4 py-2 text-sm font-medium border border-rule text-ink-2 rounded-lg hover:border-rule hover:text-ink transition-colors",children:o}),(0,r.jsx)("button",{type:"button",onClick:d,className:`px-4 py-2 text-sm font-semibold rounded-lg transition-colors ${c?"bg-err hover:brightness-[0.94] text-ink":"bg-ink hover:brightness-[0.92] text-canvas"}`,children:i})]})]})]}),document.body):null}},37223:(e,t,a)=>{"use strict";a.d(t,{X:()=>i});var r=a(78604),n=a(53087);let s=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),r.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),l=r.forwardRef((e,t)=>r.createElement(n.A,{ref:t,...e,weights:s}));l.displayName="XIcon";let i=l},44891:(e,t,a)=>{Promise.resolve().then(a.bind(a,62014)),Promise.resolve().then(a.t.bind(a,63363,23))},53087:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});var r=a(78604);let n=(0,r.createContext)({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),s=r.forwardRef((e,t)=>{let{alt:a,color:s,size:l,weight:i,mirrored:o,children:c,weights:d,...u}=e,{color:m="currentColor",size:x,weight:p="regular",mirrored:f=!1,...h}=r.useContext(n);return r.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:null!=l?l:x,height:null!=l?l:x,fill:null!=s?s:m,viewBox:"0 0 256 256",transform:o||f?"scale(-1, 1)":void 0,...h,...u},!!a&&r.createElement("title",null,a),c,d.get(null!=i?i:p))});s.displayName="IconBase"},54805:(e,t,a)=>{"use strict";a.d(t,{B:()=>i});var r=a(78604),n=a(53087);let s=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H40a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128ZM40,76H216a12,12,0,0,0,0-24H40a12,12,0,0,0,0,24ZM216,180H40a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M216,64V192H40V64Z",opacity:"0.2"}),r.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM40,72H216a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM192,184H64a8,8,0,0,1,0-16H192a8,8,0,0,1,0,16Zm0-48H64a8,8,0,0,1,0-16H192a8,8,0,0,1,0,16Zm0-48H64a8,8,0,0,1,0-16H192a8,8,0,0,1,0,16Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H40a6,6,0,0,1,0-12H216A6,6,0,0,1,222,128ZM40,70H216a6,6,0,0,0,0-12H40a6,6,0,0,0,0,12ZM216,186H40a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM40,72H216a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H40a4,4,0,0,1,0-8H216A4,4,0,0,1,220,128ZM40,68H216a4,4,0,0,0,0-8H40a4,4,0,0,0,0,8ZM216,188H40a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Z"}))]]),l=r.forwardRef((e,t)=>r.createElement(n.A,{ref:t,...e,weights:s}));l.displayName="ListIcon";let i=l},62014:(e,t,a)=>{"use strict";a.d(t,{default:()=>b});var r=a(3680),n=a(78604),s=a(39504),l=a(54805),i=a(37223),o=a(14308),c=a(64678);let d=(0,c.createServerReference)("001bc4cd7d773c42f0abe430aa4938eb24e122f3ed",c.callServer,void 0,c.findSourceMapURL,"listConversationsAction"),u=(0,c.createServerReference)("4068d449799d0839162c8c459eef6518ec3cec8eb1",c.callServer,void 0,c.findSourceMapURL,"listChatAction"),m=(0,c.createServerReference)("006a72d5a5e11e139d3a629fbcceea11c7cd5c08da",c.callServer,void 0,c.findSourceMapURL,"createConversationAction"),x=(0,c.createServerReference)("40767bfec90d74a95e600d8e748e02d76eef253591",c.callServer,void 0,c.findSourceMapURL,"deleteConversationAction"),p=(0,c.createServerReference)("400539c555b2a3f2f29167cb5dec3c4dcc8fc2d2b2",c.callServer,void 0,c.findSourceMapURL,"sendChatMessageAction"),f=(0,c.createServerReference)("409f0187893df968935c2166f22e9dabae2abe4464",c.callServer,void 0,c.findSourceMapURL,"getChatJobStatusAction"),h=n.useLayoutEffect,g=new Set(["completed","failed","cancelled"]);function b({initialConversations:e,rootName:t}){let[a,c]=(0,n.useState)(e),[f,g]=(0,n.useState)(e[0]?.id??null),[w,y]=(0,n.useState)([]),[N,E]=(0,n.useState)(""),[L,S]=(0,n.useState)(!1),[H,M]=(0,n.useState)(""),[A,R]=(0,n.useState)(null),[C,Z]=(0,n.useState)(!1),[T,D]=(0,n.useState)(!1),F=(0,n.useRef)(null),O=(0,n.useRef)(!0),I=w.length>0&&"user"===w[w.length-1].role,Y=(0,n.useCallback)(()=>{let e=F.current;e&&(e.scrollTop=e.scrollHeight)},[]),$=(0,n.useCallback)(()=>{let e=F.current;e&&(O.current=e.scrollHeight-e.scrollTop-e.clientHeight<80)},[]);h(()=>{O.current=!0,Y();let e=setTimeout(Y,80);return()=>clearTimeout(e)},[w,I,C,Y]),(0,n.useEffect)(()=>{let e=F.current;if(!e)return;let t=new MutationObserver(()=>{O.current&&(e.scrollTop=e.scrollHeight)});return t.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>t.disconnect()},[]);let z=(0,n.useCallback)(async()=>{let e=await d();e.ok&&c(e.data.conversations)},[]),U=(0,n.useCallback)(async e=>{Z(!0);let t=await u(e);Z(!1),t.ok&&y(t.data.messages)},[]);async function V(e){D(!1),e!==f&&(g(e),y([]),await U(e))}async function _(){let e=await m();e.ok?(await z(),y([]),g(e.data.id),D(!1)):s.oR.error(e.message)}async function P(e){let t=await x(e);if(!t.ok)return void s.oR.error(t.message);let r=a.filter(t=>t.id!==e);if(c(r),f===e){let e=r[0]?.id??null;g(e),e?await U(e):y([])}s.oR.success("Conversation deleted")}async function B(e){e.preventDefault();let t=N.trim();if(!t||L)return;E(""),S(!0);let a=f;if(!a){let e=await m();if(!e.ok){s.oR.error(e.message),S(!1);return}g(a=e.data.id)}y(e=>[...e,{id:`local-${Date.now()}`,role:"user",content:t,jobId:null}]);let r=await p({conversationId:a,message:t});r.ok||s.oR.error(r.message);let n=await u(a);n.ok&&y(n.data.messages),await z(),S(!1)}(0,n.useEffect)(()=>{f&&U(f)},[]),(0,n.useEffect)(()=>{let e;if(!I||!f)return;let t=!1,a=0,r=async()=>{if(t||a>=30)return;a+=1;let n=await u(f);t||!n.ok||(y(n.data.messages),n.data.messages[n.data.messages.length-1]?.role==="user"?e=setTimeout(()=>void r(),2e3):z())};return e=setTimeout(()=>void r(),2e3),()=>{t=!0,e&&clearTimeout(e)}},[I,f,z]);let K=H.trim()?a.filter(e=>e.title.toLowerCase().includes(H.toLowerCase())):a,X=function(e){let t={TODAY:[],YESTERDAY:[],EARLIER:[]};for(let a of e)t[function(e){if(!e)return"EARLIER";let t=new Date,a=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(a.getTime()-864e5),n=new Date(e.getFullYear(),e.getMonth(),e.getDate());return n.getTime()===a.getTime()?"TODAY":n.getTime()===r.getTime()?"YESTERDAY":"EARLIER"}(a.updatedAt)].push(a);return["TODAY","YESTERDAY","EARLIER"].filter(e=>t[e].length>0).map(e=>({group:e,items:t[e]}))}(K);return(0,r.jsxs)("div",{className:"relative flex h-full min-h-0 overflow-hidden rounded-xl border border-rule-2 bg-paper",children:[(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b border-rule-2 px-3 py-2 lg:hidden",children:[(0,r.jsx)("span",{className:"truncate text-sm font-semibold text-ink",children:t??"Chat"}),(0,r.jsxs)("button",{type:"button",onClick:()=>D(!0),className:"inline-flex shrink-0 items-center gap-1.5 rounded-md border border-rule px-2.5 py-1 text-xs font-medium text-ink-2 transition-colors hover:bg-hover","aria-label":"Show conversations",children:[(0,r.jsx)(l.B,{size:14})," History"]})]}),(0,r.jsx)("div",{ref:F,onScroll:$,className:"min-h-0 flex-1 space-y-3 overflow-y-auto p-5",children:C?(0,r.jsx)("p",{className:"py-8 text-center text-sm text-ink-4",children:"Loading…"}):0!==w.length||I?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"relative flex items-center justify-center py-1",children:[(0,r.jsx)("span",{className:"absolute inset-x-0 top-1/2 h-px bg-rule-2"}),(0,r.jsx)("span",{className:"relative bg-paper px-3 text-[10px] font-semibold uppercase tracking-widest text-ink-4",children:"Today"})]}),w.map(e=>(0,r.jsx)(k,{message:e,rootName:t},e.id)),I&&(0,r.jsxs)("div",{className:"flex justify-start gap-2.5",children:[(0,r.jsx)(j,{rootName:t}),(0,r.jsxs)("div",{className:"flex max-w-[80%] flex-col items-start",children:[(0,r.jsxs)("div",{className:"mb-1 flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-ink-2",children:t??"Agent"}),(0,r.jsx)("span",{className:"rounded bg-ink/10 px-1 py-px text-[9px] font-semibold uppercase tracking-widest text-ink-3",children:"Orchestrator"})]}),(0,r.jsx)("div",{className:"rounded-2xl rounded-bl-sm border border-rule bg-canvas px-3.5 py-2 text-sm text-ink-4",children:(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)("span",{className:"animate-pulse",children:"●"})," thinking…"]})})]})]})]}):(0,r.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,r.jsxs)("p",{className:"text-center text-sm text-ink-4",children:["Say hello to ",t??"your ROOT agent"," \uD83D\uDC4B"]})})}),(0,r.jsxs)("form",{onSubmit:e=>void B(e),className:"flex items-end gap-2 border-t border-rule-2 p-3",children:[(0,r.jsx)("textarea",{value:N,onChange:e=>E(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),B(e))},rows:1,placeholder:`Message ${t??"your ROOT agent"}…`,className:"max-h-40 min-h-[40px] flex-1 resize-y rounded-md border border-rule bg-canvas px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"}),(0,r.jsx)("button",{type:"submit",disabled:L||0===N.trim().length,className:"inline-flex h-[40px] shrink-0 items-center rounded-md bg-ink px-4 text-sm font-medium text-canvas transition-[filter] hover:brightness-[0.92] disabled:opacity-40",children:L?"Sending…":"Send"})]})]}),T&&(0,r.jsx)("div",{className:"absolute inset-0 z-10 bg-black/40 lg:hidden",onClick:()=>D(!1),"aria-hidden":!0}),(0,r.jsxs)("aside",{className:`flex-col border-l border-rule-2 bg-paper lg:flex lg:static lg:z-auto lg:w-[300px] lg:max-w-none lg:shrink-0 lg:shadow-none ${T?"absolute inset-y-0 right-0 z-20 flex w-[85%] max-w-[320px] shadow-xl":"hidden"}`,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between border-b border-rule-2 px-4 py-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>D(!1),className:"text-ink-3 transition-colors hover:text-ink lg:hidden","aria-label":"Close conversations",children:(0,r.jsx)(i.X,{size:16})}),(0,r.jsx)("span",{className:"text-sm font-semibold text-ink",children:"Chat"})]}),(0,r.jsx)("button",{type:"button",onClick:()=>void _(),className:"inline-flex items-center gap-1 rounded-md bg-ink px-2.5 py-1 text-xs font-medium text-canvas transition-[filter] hover:brightness-[0.92]",children:"+ New"})]}),(0,r.jsx)("div",{className:"border-b border-rule-2 px-3 py-2.5",children:(0,r.jsx)("input",{type:"text",value:H,onChange:e=>M(e.target.value),placeholder:"Search conversations…",className:"w-full rounded-md border border-rule bg-canvas px-3 py-1.5 text-xs text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===K.length?(0,r.jsx)("p",{className:"px-4 py-6 text-center text-xs text-ink-4",children:H.trim()?"No conversations match.":"No conversations yet — say hello."}):X.map(({group:e,items:t})=>(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"sticky top-0 bg-paper px-4 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-ink-4",children:e}),t.map(e=>(0,r.jsx)(v,{conversation:e,active:e.id===f,onSelect:()=>void V(e.id),onDelete:()=>R(e.id)},e.id))]},e))})]}),(0,r.jsx)(o.A,{open:null!==A,title:"Delete conversation",message:"This will permanently remove this conversation and all its messages.",confirmLabel:"Delete",cancelLabel:"Cancel",destructive:!0,onConfirm:()=>{R(null),A&&P(A)},onCancel:()=>R(null)})]})}function v({conversation:e,active:t,onSelect:a,onDelete:n}){let s=e.title.trim()||"New conversation",l=e.preview.trim(),i=function(e){if(!e)return"";let t=Math.floor((Date.now()-e.getTime())/1e3);if(t<60)return"just now";let a=Math.floor(t/60);if(a<60)return`${a}m ago`;let r=Math.floor(a/60);if(r<24)return`${r}h ago`;let n=Math.floor(r/24);return 1===n?"yesterday":n<7?`${n}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}(e.updatedAt);return(0,r.jsxs)("div",{role:"button",tabIndex:0,onClick:a,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&a()},className:`group relative flex cursor-pointer flex-col gap-0.5 px-4 py-2.5 transition-colors ${t?"bg-ink/8 text-ink":"hover:bg-ink/4 text-ink-2"}`,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("span",{className:`truncate text-xs font-medium ${t?"text-ink":"text-ink-2"}`,children:s}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,r.jsx)("span",{className:"text-[10px] text-ink-4",children:i}),(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),n()},"aria-label":"Delete conversation",className:"ml-0.5 hidden rounded p-0.5 text-ink-4 transition-colors hover:text-err group-hover:inline-flex",children:(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:[(0,r.jsx)("polyline",{points:"1 3 11 3"}),(0,r.jsx)("path",{d:"M4 3V2h4v1"}),(0,r.jsx)("path",{d:"M2 3l.8 7.2A1 1 0 003.8 11h4.4a1 1 0 001-.8L10 3"})]})})]})]}),l&&(0,r.jsx)("p",{className:"truncate text-[11px] text-ink-4",children:l})]})}function j({rootName:e}){let t=(e??"A").charAt(0).toUpperCase();return(0,r.jsx)("div",{className:"mt-5 flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-run text-xs font-semibold text-ink",children:t})}function k({message:e,rootName:t}){return"user"===e.role?(0,r.jsxs)("div",{className:"flex justify-end gap-2.5",children:[(0,r.jsxs)("div",{className:"flex max-w-[80%] flex-col items-end",children:[(0,r.jsx)("span",{className:"mb-1 text-xs font-medium text-ink-3",children:"You"}),(0,r.jsx)("div",{className:"whitespace-pre-wrap rounded-2xl rounded-br-sm bg-ink px-3.5 py-2 text-sm text-canvas",children:e.content})]}),(0,r.jsx)("div",{className:"mt-5 flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-ink/10 text-xs font-semibold text-ink-3",children:"Y"})]}):(0,r.jsxs)("div",{className:"flex justify-start gap-2.5",children:[(0,r.jsx)(j,{rootName:t}),(0,r.jsxs)("div",{className:"flex max-w-[80%] flex-col items-start",children:[(0,r.jsxs)("div",{className:"mb-1 flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-ink-2",children:t??"Agent"}),(0,r.jsx)("span",{className:"rounded bg-ink/10 px-1 py-px text-[9px] font-semibold uppercase tracking-widest text-ink-3",children:"Orchestrator"})]}),""!==e.content.trim()&&(0,r.jsx)("div",{className:"whitespace-pre-wrap rounded-2xl rounded-bl-sm border border-rule bg-canvas px-3.5 py-2 text-sm text-ink-2",children:e.content}),e.jobId&&(0,r.jsx)(y,{jobId:e.jobId})]})]})}function w({status:e}){let t="completed"===e,a="failed"===e||"cancelled"===e;return(0,r.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium ${t?"border-ok/40 text-ok":a?"border-err/40 text-err":"border-run/40 text-run"}`,children:[!t&&!a&&(0,r.jsx)("span",{className:"animate-pulse",children:"●"}),t?"Done":a?"Failed":"Running"]})}function y({jobId:e}){let[t,a]=(0,n.useState)(null);(0,n.useEffect)(()=>{let t,r=!1,n=0,s=async()=>{let l=await f(e);r||(l.ok&&a(l.data),!(l.ok&&g.has(l.data.status))&&n<150&&(n+=1,t=setTimeout(()=>void s(),2e3)))};return s(),()=>{r=!0,t&&clearTimeout(t)}},[e]);let s=t?.status??"pending",l=t?.children??[];return(0,r.jsxs)("div",{className:"mt-2 w-full rounded-lg border border-rule-2 bg-canvas/60 p-2.5",children:[(0,r.jsxs)("div",{className:"mb-1.5 flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-ink-4",children:l.length>0?`↘ Dispatched to ${l.length} agent${l.length>1?"s":""}`:"↘ Task"}),0===l.length&&(0,r.jsx)(w,{status:s})]}),l.length>0?(0,r.jsx)("div",{className:"space-y-1",children:l.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-rule bg-paper px-2.5 py-1.5",children:[(0,r.jsx)("span",{className:"truncate text-xs font-medium text-ink-2",children:e.agentName}),(0,r.jsx)(w,{status:e.status})]},t))}):null,t&&g.has(s)&&t.result&&(0,r.jsx)("p",{className:"mt-1.5 whitespace-pre-wrap text-xs text-ink-3",children:t.result})]})}},64678:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={callServer:function(){return s.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return l.findSourceMapURL}};for(var n in r)Object.defineProperty(t,n,{enumerable:!0,get:r[n]});let s=a(22673),l=a(43145),i=a(87478)}},e=>{e.O(0,[3363,9504,1065,8724,7358],()=>e(e.s=44891)),_N_E=e.O()}]);