@openhands/agent-canvas 1.0.0-beta.2 → 1.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/build/assets/{agent-server-conversation-service.api-DFvqqEDo.js → agent-server-conversation-service.api-C2V5SlHu.js} +1 -1
- package/build/assets/{automation-detail-Di7EOIZD.js → automation-detail-DJvbVSYK.js} +1 -1
- package/build/assets/{automations-list-IsIWdDiw.js → automations-list-rMki-8au.js} +1 -1
- package/build/assets/{conversation-HlncOV7n.js → conversation-DVrKU0oz.js} +3 -3
- package/build/assets/conversation-Dlys-D5A.js +1 -0
- package/build/assets/conversation-panel-iF09WjZ4.js +1 -0
- package/build/assets/{conversation-service.api-nb5W1PqR.js → conversation-service.api-CCfztilW.js} +1 -1
- package/build/assets/{conversation-websocket-context-C8_PkGLi.js → conversation-websocket-context-DhJhqUna.js} +1 -1
- package/build/assets/{files-tab-BhnLgimi.js → files-tab-R5z0lLdY.js} +1 -1
- package/build/assets/{git-control-bar-branch-button-M34A5_vX.js → git-control-bar-branch-button-COdRAYHb.js} +1 -1
- package/build/assets/{git-provider-icon-D5dCNy-k.js → git-provider-icon-BzLbc0yC.js} +1 -1
- package/build/assets/{home-CYQv7yc_.js → home-XxBpNOVq.js} +1 -1
- package/build/assets/{launch-DHEUYn2A.js → launch-CshDse3e.js} +1 -1
- package/build/assets/{manifest-6b31008e.js → manifest-d9077852.js} +1 -1
- package/build/assets/{messages-BMzyOW2V.js → messages-D0rWot7s.js} +1 -1
- package/build/assets/{path-utils-YohAYyMv.js → path-utils-C3bQf6lJ.js} +1 -1
- package/build/assets/{planner-tab-CFc-hV07.js → planner-tab-BlrCpv-7.js} +1 -1
- package/build/assets/{recommended-automations-launcher-sgvfU62c.js → recommended-automations-launcher-BQChv2rc.js} +2 -2
- package/build/assets/root-BgEbw3S0.js +2 -0
- package/build/assets/{root-layout-DVepR4To.js → root-layout-Czo9Ma6Q.js} +1 -1
- package/build/assets/{shared-conversation-DChOdb0t.js → shared-conversation-AMyqXvpk.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-BWuf4PRH.js → sidebar-mobile-menu-toggle-Do_aA9Zm.js} +1 -1
- package/build/assets/{terminal-CRf9S0Z2.js → terminal-DgQk1Ay6.js} +1 -1
- package/build/assets/{use-active-conversation-Db3IWSPK.js → use-active-conversation-BEFNwnFk.js} +1 -1
- package/build/assets/{use-agent-state-Bn8vS5sY.js → use-agent-state-Bkrd1FZq.js} +1 -1
- package/build/assets/{use-create-conversation-CKS3EAHu.js → use-create-conversation-CEgXpkfH.js} +1 -1
- package/build/assets/{use-handle-plan-click-C9zJpK8A.js → use-handle-plan-click-Ckkm5eIY.js} +1 -1
- package/build/assets/{use-runtime-is-ready-CQCE3xZC.js → use-runtime-is-ready-B7EF4BKU.js} +1 -1
- package/build/assets/{use-unified-vscode-url-sZt29HrC.js → use-unified-vscode-url-DdSRw-6P.js} +1 -1
- package/build/assets/{use-user-conversation-DfgEB6RW.js → use-user-conversation-C6hrMMtn.js} +1 -1
- package/build/assets/{vscode-tab-Zb-QbTuV.js → vscode-tab-DjNArCgY.js} +1 -1
- package/build/index.html +3 -3
- package/dist/api/agent-server-adapter.cjs +1 -1
- package/dist/api/agent-server-adapter.cjs.map +1 -1
- package/dist/api/agent-server-adapter.js +1 -1
- package/dist/api/agent-server-adapter.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +2 -1
- package/dist/package.js.map +1 -1
- package/package.json +2 -1
- package/scripts/dev-safe.mjs +1 -1
- package/build/assets/conversation-MtnkpqA9.js +0 -1
- package/build/assets/conversation-panel-DxnM6tRe.js +0 -1
- package/build/assets/root-E6pcRIYp.js +0 -2
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ agent-canvas
|
|
|
61
61
|
### Option 2: With a Docker Sandbox
|
|
62
62
|
|
|
63
63
|
```sh
|
|
64
|
-
docker pull ghcr.io/openhands/agent-canvas:1.0.0-beta.
|
|
64
|
+
docker pull ghcr.io/openhands/agent-canvas:1.0.0-beta.5
|
|
65
65
|
|
|
66
66
|
export PROJECTS_PATH=~/projects # directory containing your project folders
|
|
67
67
|
|
|
@@ -69,7 +69,7 @@ docker run -it --rm \
|
|
|
69
69
|
-p 8000:8000 \
|
|
70
70
|
-v ~/.openhands:/home/openhands/.openhands \
|
|
71
71
|
-v ${PROJECTS_PATH}:/projects \
|
|
72
|
-
ghcr.io/openhands/agent-canvas:1.0.0-beta.
|
|
72
|
+
ghcr.io/openhands/agent-canvas:1.0.0-beta.5
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
The agent will be able to access any project under `PROJECTS_PATH`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/secrets-service-BsnKFc2x.js","assets/rolldown-runtime-BFRubm34.js","assets/agent-server-client-options-Bc5ZorQZ.js","assets/settings-client-C73C7IgV.js","assets/proxy-CxydCnis.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~ninslayh-D9P8e98a.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-CT1Z6Pdu.js";import{E as t,S as n,c as r,i,o as a,s as o,t as s,u as c,y as l}from"./agent-server-client-options-Bc5ZorQZ.js";import{n as u,s as d,u as f}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-DTwbEEcX.js";import{t as p}from"./profiles-client-D6IkTJof.js";import{n as m}from"./agent-server-compatibility-BlkUsrX2.js";import{n as h,t as g}from"./proxy-CxydCnis.js";import{t as ee}from"./v4-CNn21NXa.js";import{t as _}from"./settings-D_H-qsRm.js";import{t as te}from"./common-DR1t-EeP.js";import{a as v,u as y}from"./acp-providers-CbiRekh9.js";import{t as b}from"./settings-service.api-CZ3uWx4v.js";var x=class{constructor(e){this.host=e.host.replace(/\/$/,``),this.apiKey=e.apiKey,this.client=new a({baseUrl:this.host,apiKey:this.apiKey,timeout:e.timeout||6e4})}async createConversation(e){return(await this.client.post(`/api/conversations`,e)).data}async searchConversations(e={}){return(await this.client.get(`/api/conversations/search`,{params:e})).data}async countConversations(e={}){return(await this.client.get(`/api/conversations/count`,{params:e})).data}async getConversations(e){return(await this.client.get(`/api/conversations`,{params:{ids:e}})).data}async getConversation(e){return(await this.client.get(`/api/conversations/${e}`)).data}async searchEvents(e,t={}){return(await this.client.get(`/api/conversations/${e}/events/search`,{params:t})).data}async getEvent(e,t){return(await this.client.get(`/api/conversations/${e}/events/${t}`)).data}async getEvents(e,t){return Promise.all(t.map(async t=>{try{return await this.getEvent(e,t)}catch(e){if(e instanceof o&&e.status===404)return null;throw e}}))}async sendEvent(e,t,n={}){await this.client.post(`/api/conversations/${e}/events`,{...t,...n.run===void 0?{}:{run:n.run}})}async pauseConversation(e){return(await this.client.post(`/api/conversations/${e}/pause`,{})).data}async interruptConversation(e){return(await this.client.post(`/api/conversations/${e}/interrupt`,{})).data}async runConversation(e){return(await this.client.post(`/api/conversations/${e}/run`,{})).data}async askAgent(e,t){return(await this.client.post(`/api/conversations/${e}/ask_agent`,{question:t})).data}async getEventCount(e,t={}){return(await this.client.get(`/api/conversations/${e}/events/count`,{params:t})).data}async respondToConfirmation(e,t){return(await this.client.post(`/api/conversations/${e}/events/respond_to_confirmation`,t)).data}async getAgentFinalResponse(e){return(await this.client.get(`/api/conversations/${e}/agent_final_response`)).data}async setConfirmationPolicy(e,t){let n=`policy`in t?t:{policy:t};return(await this.client.post(`/api/conversations/${e}/confirmation_policy`,n)).data}async condenseConversation(e){return(await this.client.post(`/api/conversations/${e}/condense`,{})).data}async setSecurityAnalyzer(e,t){let n=ne(t)?t:{security_analyzer:t};return(await this.client.post(`/api/conversations/${e}/security_analyzer`,n)).data}async updateSecrets(e,t){return(await this.client.post(`/api/conversations/${e}/secrets`,t)).data}async forkConversation(e,t={},n={}){return(await this.client.post(`/api/conversations/${e}/fork`,t,{params:n.includeSkills===void 0?void 0:{include_skills:n.includeSkills}})).data}async switchProfile(e,t){await this.client.post(`/api/conversations/${e}/switch_profile`,{profile_name:t})}async switchLLM(e,t){await this.client.post(`/api/conversations/${e}/switch_llm`,{llm:t})}async switchAcpModel(e,t){await this.client.post(`/api/conversations/${e}/switch_acp_model`,{model:t})}async deleteConversation(e){await this.client.delete(`/api/conversations/${e}`)}async updateConversation(e,t){return(await this.client.patch(`/api/conversations/${e}`,t)).data}close(){this.client.close()}};function ne(e){return typeof e==`object`&&!!e&&`security_analyzer`in e}var S=`openhands-agent-server-conversation-metadata`,C=()=>{if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(S);if(!e)return{};let t=JSON.parse(e);return!t||typeof t!=`object`?{}:t}catch{return{}}},w=e=>{if(!(typeof window>`u`)){if(Object.keys(e).length===0){window.localStorage.removeItem(S);return}window.localStorage.setItem(S,JSON.stringify(e))}},T=e=>C()[e]??null,E=(e,t)=>{let n=C();n[e]=t,w(n)},D=e=>{let t=C();e in t&&(delete t[e],w(t))};function O(e){if(!e?.id)return e;let t=T(e.id);return t?{...e,selected_repository:e.selected_repository??t.selected_repository??null,selected_branch:e.selected_branch??t.selected_branch??null,git_provider:e.git_provider??t.git_provider??null,selected_workspace:e.selected_workspace??t.selected_workspace??null}:e}function k(){let e=r().backend;if(e.kind!==`cloud`)throw Error(`Cloud conversations call requires a cloud backend.`);return e}async function re(e=20,t){let n=k(),r=new URLSearchParams;r.set(`limit`,String(e)),t&&r.set(`page_id`,t),r.set(`sort_order`,`UPDATED_AT_DESC`);let i=await g({backend:n,method:`GET`,path:`/api/v1/app-conversations/search?${r.toString()}`});return{items:(i?.items??[]).map(e=>O(e)),next_page_id:i?.next_page_id??null}}async function A(e){if(e.length===0)return[];let t=k(),n=new URLSearchParams;for(let t of e)n.append(`ids`,t);return(await g({backend:t,method:`GET`,path:`/api/v1/app-conversations?${n.toString()}`})??[]).map(O)}async function ie(e){return await g({backend:k(),method:`POST`,path:`/api/v1/app-conversations`,body:e})}async function ae(e){return g({backend:k(),method:`GET`,path:`/api/v1/app-conversations/${e}/download`,responseType:`blob`})}async function oe(e){await g({backend:k(),method:`DELETE`,path:`/api/v1/app-conversations/${e}`})}async function se(e,t){return await g({backend:k(),method:`PATCH`,path:`/api/v1/app-conversations/${e}`,body:{public:t}})}async function ce(e){await g({backend:k(),method:`POST`,path:`/api/v1/sandboxes/${e}/pause`})}async function le(e){await g({backend:k(),method:`POST`,path:`/api/v1/sandboxes/${e}/resume`})}async function ue(e,t){let n=k(),r=new URLSearchParams;return r.append(`file_path`,t),await g({backend:n,method:`GET`,path:`/api/v1/app-conversations/${e}/file?${r.toString()}`})??``}async function de(e){let t=k(),n=new URLSearchParams;return n.set(`ids`,e),(await g({backend:t,method:`GET`,path:`/api/v1/app-conversations/start-tasks?${n.toString()}`}))?.[0]??null}var j=`canvas_ui`,fe=`canvas_ui_tool`,pe=[`terminal`,`file_editor`,`task_tracker`,j],M=`browser_tool_set`,N=`task_tool_set`;function me(){return!0}function he(){let e=(void 0)?.trim();if(!e)return null;try{let t=JSON.parse(e);return!t||typeof t!=`object`?null:t}catch{return null}}function ge(){let e=he();if(!e?.services)return;let t=[];t.push(`<RUNTIME_SERVICES>`),e.mode?t.push(`You are running inside an agent-canvas dev stack started in '${e.mode}' mode.`):t.push(`You are running inside an agent-canvas dev stack.`),t.push(`The following services are reachable from your sandbox. URLs are written`,`from your point of view (i.e., as you should curl/fetch them).`,``);let{agent_server:n,ingress:r,automation:i}=e.services,a=e.services.frontend??e.services.vite;n?.url_from_agent&&t.push(`* Agent Server (you): ${n.url_from_agent}`,` ${n.description??`The agent-server hosting your tool calls.`}`),r?.url_from_agent&&t.push(`* Ingress: ${r.url_from_agent}`,` ${r.description??`Unified entry point for browser-facing traffic.`}`),a?.url_from_agent&&t.push(`* Frontend: ${a.url_from_agent}`,` ${a.description??`Frontend dev server.`}`),i?.url_from_agent?(t.push(`* Automation backend: ${i.url_from_agent}`,` ${i.description??`OpenHands Automations service.`}`),i.docs_url&&t.push(` Docs: ${i.docs_url}`),i.openapi_url&&t.push(` OpenAPI: ${i.openapi_url}`),i.auth_env_var&&t.push(` Auth: header 'X-API-Key: $${i.auth_env_var}'`)):t.push(`* Automation backend: not running in this dev mode (skip /api/automation calls).`);let o=n?.url_from_agent;return t.push(``,`Trust this block over guessing: do not assume any other URLs are running.`),o&&t.push(`In particular, ${o} inside your sandbox is the Agent Server`,`you are running inside of — NOT the automation backend.`),t.push(`</RUNTIME_SERVICES>`),t.join(`
|
|
2
|
+
import{t as e}from"./preload-helper-CT1Z6Pdu.js";import{E as t,S as n,c as r,i,o as a,s as o,t as s,u as c,y as l}from"./agent-server-client-options-Bc5ZorQZ.js";import{n as u,s as d,u as f}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-DTwbEEcX.js";import{t as p}from"./profiles-client-D6IkTJof.js";import{n as m}from"./agent-server-compatibility-BlkUsrX2.js";import{n as h,t as g}from"./proxy-CxydCnis.js";import{t as ee}from"./v4-CNn21NXa.js";import{t as _}from"./settings-D_H-qsRm.js";import{t as te}from"./common-DR1t-EeP.js";import{a as v,u as y}from"./acp-providers-CbiRekh9.js";import{t as b}from"./settings-service.api-CZ3uWx4v.js";var x=class{constructor(e){this.host=e.host.replace(/\/$/,``),this.apiKey=e.apiKey,this.client=new a({baseUrl:this.host,apiKey:this.apiKey,timeout:e.timeout||6e4})}async createConversation(e){return(await this.client.post(`/api/conversations`,e)).data}async searchConversations(e={}){return(await this.client.get(`/api/conversations/search`,{params:e})).data}async countConversations(e={}){return(await this.client.get(`/api/conversations/count`,{params:e})).data}async getConversations(e){return(await this.client.get(`/api/conversations`,{params:{ids:e}})).data}async getConversation(e){return(await this.client.get(`/api/conversations/${e}`)).data}async searchEvents(e,t={}){return(await this.client.get(`/api/conversations/${e}/events/search`,{params:t})).data}async getEvent(e,t){return(await this.client.get(`/api/conversations/${e}/events/${t}`)).data}async getEvents(e,t){return Promise.all(t.map(async t=>{try{return await this.getEvent(e,t)}catch(e){if(e instanceof o&&e.status===404)return null;throw e}}))}async sendEvent(e,t,n={}){await this.client.post(`/api/conversations/${e}/events`,{...t,...n.run===void 0?{}:{run:n.run}})}async pauseConversation(e){return(await this.client.post(`/api/conversations/${e}/pause`,{})).data}async interruptConversation(e){return(await this.client.post(`/api/conversations/${e}/interrupt`,{})).data}async runConversation(e){return(await this.client.post(`/api/conversations/${e}/run`,{})).data}async askAgent(e,t){return(await this.client.post(`/api/conversations/${e}/ask_agent`,{question:t})).data}async getEventCount(e,t={}){return(await this.client.get(`/api/conversations/${e}/events/count`,{params:t})).data}async respondToConfirmation(e,t){return(await this.client.post(`/api/conversations/${e}/events/respond_to_confirmation`,t)).data}async getAgentFinalResponse(e){return(await this.client.get(`/api/conversations/${e}/agent_final_response`)).data}async setConfirmationPolicy(e,t){let n=`policy`in t?t:{policy:t};return(await this.client.post(`/api/conversations/${e}/confirmation_policy`,n)).data}async condenseConversation(e){return(await this.client.post(`/api/conversations/${e}/condense`,{})).data}async setSecurityAnalyzer(e,t){let n=ne(t)?t:{security_analyzer:t};return(await this.client.post(`/api/conversations/${e}/security_analyzer`,n)).data}async updateSecrets(e,t){return(await this.client.post(`/api/conversations/${e}/secrets`,t)).data}async forkConversation(e,t={},n={}){return(await this.client.post(`/api/conversations/${e}/fork`,t,{params:n.includeSkills===void 0?void 0:{include_skills:n.includeSkills}})).data}async switchProfile(e,t){await this.client.post(`/api/conversations/${e}/switch_profile`,{profile_name:t})}async switchLLM(e,t){await this.client.post(`/api/conversations/${e}/switch_llm`,{llm:t})}async switchAcpModel(e,t){await this.client.post(`/api/conversations/${e}/switch_acp_model`,{model:t})}async deleteConversation(e){await this.client.delete(`/api/conversations/${e}`)}async updateConversation(e,t){return(await this.client.patch(`/api/conversations/${e}`,t)).data}close(){this.client.close()}};function ne(e){return typeof e==`object`&&!!e&&`security_analyzer`in e}var S=`openhands-agent-server-conversation-metadata`,C=()=>{if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(S);if(!e)return{};let t=JSON.parse(e);return!t||typeof t!=`object`?{}:t}catch{return{}}},w=e=>{if(!(typeof window>`u`)){if(Object.keys(e).length===0){window.localStorage.removeItem(S);return}window.localStorage.setItem(S,JSON.stringify(e))}},T=e=>C()[e]??null,E=(e,t)=>{let n=C();n[e]=t,w(n)},D=e=>{let t=C();e in t&&(delete t[e],w(t))};function O(e){if(!e?.id)return e;let t=T(e.id);return t?{...e,selected_repository:e.selected_repository??t.selected_repository??null,selected_branch:e.selected_branch??t.selected_branch??null,git_provider:e.git_provider??t.git_provider??null,selected_workspace:e.selected_workspace??t.selected_workspace??null}:e}function k(){let e=r().backend;if(e.kind!==`cloud`)throw Error(`Cloud conversations call requires a cloud backend.`);return e}async function re(e=20,t){let n=k(),r=new URLSearchParams;r.set(`limit`,String(e)),t&&r.set(`page_id`,t),r.set(`sort_order`,`UPDATED_AT_DESC`);let i=await g({backend:n,method:`GET`,path:`/api/v1/app-conversations/search?${r.toString()}`});return{items:(i?.items??[]).map(e=>O(e)),next_page_id:i?.next_page_id??null}}async function A(e){if(e.length===0)return[];let t=k(),n=new URLSearchParams;for(let t of e)n.append(`ids`,t);return(await g({backend:t,method:`GET`,path:`/api/v1/app-conversations?${n.toString()}`})??[]).map(O)}async function ie(e){return await g({backend:k(),method:`POST`,path:`/api/v1/app-conversations`,body:e})}async function ae(e){return g({backend:k(),method:`GET`,path:`/api/v1/app-conversations/${e}/download`,responseType:`blob`})}async function oe(e){await g({backend:k(),method:`DELETE`,path:`/api/v1/app-conversations/${e}`})}async function se(e,t){return await g({backend:k(),method:`PATCH`,path:`/api/v1/app-conversations/${e}`,body:{public:t}})}async function ce(e){await g({backend:k(),method:`POST`,path:`/api/v1/sandboxes/${e}/pause`})}async function le(e){await g({backend:k(),method:`POST`,path:`/api/v1/sandboxes/${e}/resume`})}async function ue(e,t){let n=k(),r=new URLSearchParams;return r.append(`file_path`,t),await g({backend:n,method:`GET`,path:`/api/v1/app-conversations/${e}/file?${r.toString()}`})??``}async function de(e){let t=k(),n=new URLSearchParams;return n.set(`ids`,e),(await g({backend:t,method:`GET`,path:`/api/v1/app-conversations/start-tasks?${n.toString()}`}))?.[0]??null}var j=`canvas_ui`,fe=`canvas_ui_tool`,pe=[`terminal`,`file_editor`,`task_tracker`,j],M=`browser_tool_set`,N=`task_tool_set`;function me(){return!0}function he(){let e=(void 0)?.trim();if(!e)return null;try{let t=JSON.parse(e);return!t||typeof t!=`object`?null:t}catch{return null}}function ge(){let e=he();if(!e?.services)return;let t=[];t.push(`<RUNTIME_SERVICES>`),e.mode?t.push(`You are running inside an agent-canvas dev stack started in '${e.mode}' mode.`):t.push(`You are running inside an agent-canvas dev stack.`),t.push(`The following services are reachable from your sandbox. URLs are written`,`from your point of view (i.e., as you should curl/fetch them).`,``);let{agent_server:n,ingress:r,automation:i}=e.services,a=e.services.frontend??e.services.vite;n?.url_from_agent&&t.push(`* Agent Server (you): ${n.url_from_agent}`,` ${n.description??`The agent-server hosting your tool calls.`}`),r?.url_from_agent&&t.push(`* Ingress: ${r.url_from_agent}`,` ${r.description??`Unified entry point for browser-facing traffic.`}`),a?.url_from_agent&&t.push(`* Frontend: ${a.url_from_agent}`,` ${a.description??`Frontend dev server.`}`),i?.url_from_agent?(t.push(`* Automation backend: ${i.url_from_agent}`,` ${i.description??`OpenHands Automations service.`}`),i.docs_url&&t.push(` Docs: ${i.docs_url}`),i.openapi_url&&t.push(` OpenAPI: ${i.openapi_url}`),i.auth_env_var&&t.push(` Auth: header 'X-Session-API-Key: $${i.auth_env_var}'`)):t.push(`* Automation backend: not running in this dev mode (skip /api/automation calls).`);let o=n?.url_from_agent;return t.push(``,`Trust this block over guessing: do not assume any other URLs are running.`),o&&t.push(`In particular, ${o} inside your sandbox is the Agent Server`,`you are running inside of — NOT the automation backend.`),t.push(`</RUNTIME_SERVICES>`),t.join(`
|
|
3
3
|
`)}function _e(e){let{host:t}=s();return`${t}/api/conversations/${e}`}function P(e){return`Conversation ${e.slice(0,5)}`}function F(e){let t=T(e.id),r=e.agent?.kind===`ACPAgent`,i=r?e.tags?.acpserver??null:null;return{id:e.id,created_by_user_id:null,selected_repository:t?.selected_repository??null,selected_branch:t?.selected_branch??null,git_provider:t?.git_provider??null,selected_workspace:t?.selected_workspace??null,title:e.title?.trim()?e.title:P(e.id),trigger:null,pr_number:[],agent_kind:r?`acp`:`openhands`,acp_server:i,llm_model:r?y({runtimeName:e.current_model_name,runtimeId:e.current_model_id,configured:e.agent?.acp_model,sdkLlm:e.agent?.llm?.model}):e.agent?.llm?.model??_.llm_model,metrics:e.metrics?{accumulated_cost:e.metrics.accumulated_cost??null,max_budget_per_task:e.metrics.max_budget_per_task??null,accumulated_token_usage:e.metrics.accumulated_token_usage?{prompt_tokens:e.metrics.accumulated_token_usage.prompt_tokens??0,completion_tokens:e.metrics.accumulated_token_usage.completion_tokens??0,cache_read_tokens:e.metrics.accumulated_token_usage.cache_read_tokens??0,cache_write_tokens:e.metrics.accumulated_token_usage.cache_write_tokens??0,context_window:e.metrics.accumulated_token_usage.context_window??0,per_turn_token:e.metrics.accumulated_token_usage.per_turn_token??0}:null}:null,created_at:e.created_at,updated_at:e.updated_at,execution_status:e.execution_status??te.IDLE,sandbox_status:e.sandbox_status??null,conversation_url:_e(e.id),session_api_key:s().apiKey??null,sandbox_id:null,workspace:{working_dir:e.workspace?.working_dir??n()},public:!1,sub_conversation_ids:[]}}function ve(e){return{items:e.items.map(F),next_page_id:e.next_page_id??null}}var I=[`acp_command`,`acp_args`,`acp_env`,`acp_model`,`acp_session_mode`,`acp_prompt_timeout`],ye=`acpserver`,be=new Set([`schema_version`,`agent_settings`,`workspace`,`conversation_id`,`initial_message`,`plugins`]);function L(e){return!e||typeof e!=`object`||Array.isArray(e)?{}:structuredClone(e)}function R(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function xe(e){return e.confirmation_mode===!0?e.security_analyzer===`llm`?{kind:`ConfirmRisky`,threshold:`HIGH`,confirm_unknown:!0}:{kind:`AlwaysConfirm`}:{kind:`NeverConfirm`}}function Se(e){switch(e.security_analyzer){case`llm`:return{kind:`LLMSecurityAnalyzer`};case`pattern`:return{kind:`PatternSecurityAnalyzer`};case`policy_rail`:return{kind:`PolicyRailSecurityAnalyzer`};default:return}}function Ce(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&typeof e.name==`string`}function z(e,t){return e===M?me()&&m(e):e===N?t.enable_sub_agents===!0&&m(e):!0}function we(e){let t=new Map;for(let e of pe)t.set(e,{name:e,params:{}});for(let n of[M,N])z(n,e)&&t.set(n,{name:n,params:{}});let n=e.tools;if(Array.isArray(n)&&n.every(e=>Ce(e)))for(let r of n)z(r.name,e)&&t.set(r.name,{name:r.name,params:L(r.params)});return Array.from(t.values())}function Te(e,t){let n=[e?.trim(),t?.trim()].filter(Boolean);return n.length===0?null:{role:`user`,content:[{type:`text`,text:n.join(`
|
|
4
4
|
|
|
5
5
|
`)}],run:!0}}function B(e){let n=ge();return{...L(e.agent_context),load_public_skills:t(),load_user_skills:!0,load_project_skills:!0,...n?{system_message_suffix:n}:{}}}function V(e){return L(e.agent_settings).agent_kind===`acp`}function Ee(e){let t=L(e.agent_settings).acp_server;return typeof t==`string`&&t.length>0?t:void 0}function De(e){let t=e.acp_command;if(!(Array.isArray(t)&&t.length===0)&&t!==void 0)return t;let n=v(typeof e.acp_server==`string`?e.acp_server:void 0);return n?[...n.default_command]:t}function Oe(e){let t=L(e.agent_settings),n={agent_kind:`acp`,agent_context:B(t)};for(let e of I){if(e===`acp_model`)continue;let r=e===`acp_command`?De(t):t[e];r!=null&&(n[e]=r)}let r=v(typeof t.acp_server==`string`?t.acp_server:void 0),i=y({configured:t.acp_model,providerDefault:r?.default_model});return i&&(n.acp_model=i),n}function ke(e){let t=L(e.agent_settings),n=L(t.llm);n.model=typeof n.model==`string`&&n.model.trim().length>0?n.model:_.llm_model;let r=R(n.api_key);r?n.api_key=r:delete n.api_key;let i=R(n.base_url);i?n.base_url=i:delete n.base_url;let a=L(t.mcp_config);(Object.keys(a).length===0||!(`mcpServers`in a))&&delete t.mcp_config,delete t.acp_server;for(let e of I)delete t[e];return{...t,llm:n,agent_context:B(t),tools:we(t)}}function Ae(e){return V(e)?Oe(e):ke(e)}function je(e){let{settings:t,query:r,conversationInstructions:i,plugins:a,workingDir:o}=e,s=L(t.conversation_settings),c=Te(r,i);return be.forEach(e=>delete s[e]),{...s,workspace:{kind:`LocalWorkspace`,working_dir:o??n()},...c?{initial_message:c}:{},...a?.length?{plugins:a.map(e=>({source:e.source,...e.ref?{ref:e.ref}:{},...e.repo_path?{repo_path:e.repo_path}:{}}))}:{}}}function Me(e){let t=e.encryptedAgentSettings?{...e.settings,agent_settings:e.encryptedAgentSettings}:e.settings,n=V(t),r=Ae(t),i=n?Ee(t):void 0,a=je(e.encryptedConversationSettings?{...e,settings:{...e.settings,conversation_settings:e.encryptedConversationSettings}}:e),o={agent_settings:r,workspace:a.workspace,confirmation_policy:xe(a),max_iterations:typeof a.max_iterations==`number`?a.max_iterations:500,stuck_detection:!0,autotitle:!0,worktree:!0};i&&(o.tags={[ye]:i}),e.secretsEncrypted&&(o.secrets_encrypted=!0),e.conversationId&&(o.conversation_id=e.conversationId);let s=Se(a);if(s&&(o.security_analyzer=s),a.initial_message&&(o.initial_message=a.initial_message),a.plugins&&(o.plugins=a.plugins),a.hook_config&&(o.hook_config=a.hook_config),o.tool_module_qualnames={[j]:fe,...a.tool_module_qualnames??{}},a.agent_definitions&&(o.agent_definitions=a.agent_definitions),e.customSecrets&&e.customSecrets.length>0){let t=h(c()),r={};for(let n of e.customSecrets){let e={kind:`LookupSecret`,url:`/api/settings/secrets/${encodeURIComponent(n.name)}`,description:n.description};Object.keys(t).length>0&&(e.headers=t),r[n.name]=e}o.secrets=r,n&&(o.agent_settings.agent_context={...o.agent_settings.agent_context,secrets:r})}return o}async function Ne(t){let{SecretsService:n}=await e(async()=>{let{SecretsService:e}=await import(`./secrets-service-BsnKFc2x.js`).then(e=>e.n);return{SecretsService:e}},__vite__mapDeps([0,1,2,3,4,5])),[r,i]=await Promise.all([b.getSettingsForConversation(),n.getSecrets()]),{agentSettings:a,conversationSettings:o,secretsEncrypted:s}=r;return Me({...t,encryptedAgentSettings:a,encryptedConversationSettings:o,secretsEncrypted:s,customSecrets:i})}function Pe(){return{hooks:[]}}var Fe=`1970-01-01T00:00:00.000Z`,Ie=`Unable to load conversations because the selected agent server returned data this UI does not understand. Check the backend URL/session key and update the agent server if needed.`;function H(){return Error(Ie)}function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function W(e){return typeof e==`number`?e:null}function G(e){return typeof e==`number`?e:0}function K(e){return typeof e==`string`?e:null}function q(e,t,n){let r=e[t]??e[n];return typeof r==`string`&&r.trim()?r:Fe}function Le(e){return U(e)?{prompt_tokens:G(e.prompt_tokens),completion_tokens:G(e.completion_tokens),cache_read_tokens:G(e.cache_read_tokens),cache_write_tokens:G(e.cache_write_tokens),context_window:G(e.context_window),per_turn_token:G(e.per_turn_token)}:null}function J(e){return U(e)?{accumulated_cost:W(e.accumulated_cost),max_budget_per_task:W(e.max_budget_per_task),accumulated_token_usage:Le(e.accumulated_token_usage)}:null}function Re(e){if(!U(e))return null;let t=U(e.llm)?{model:K(e.llm.model)}:null;return{kind:K(e.kind),acp_model:K(e.acp_model),llm:t}}function ze(e){return U(e)?{working_dir:K(e.working_dir)}:null}function Be(e){if(!U(e))return null;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function Y(e){if(!e.startsWith(`/`))return null;let t=[];for(let n of e.split(`/`))if(n&&n!==`.`)if(n===`..`){if(!t.length)return null;t.pop()}else t.push(n);return`/${t.join(`/`)}`}function X(e,t){let n=Y(e),r=Y(t);if(!n||!r||n!==r&&!n.startsWith(`${r}/`))throw Error(`Conversation file path must stay inside the workspace`);return n}function Z(e){if(!U(e)||typeof e.id!=`string`||!e.id.trim())throw H();return{id:e.id.trim(),title:K(e.title),created_at:q(e,`created_at`,`createdAt`),updated_at:q(e,`updated_at`,`updatedAt`),execution_status:K(e.execution_status),sandbox_status:K(e.sandbox_status),metrics:J(e.metrics),agent:Re(e.agent),workspace:ze(e.workspace),tags:Be(e.tags),current_model_id:K(e.current_model_id),current_model_name:K(e.current_model_name)}}function Q(e){if(!Array.isArray(e))throw H();return e.map(Z)}function Ve(e){if(Array.isArray(e))return{items:Q(e),next_page_id:null};if(!U(e))throw H();return{items:Q(e.items),next_page_id:typeof e.next_page_id==`string`?e.next_page_id:null}}var He=new Set([`idle`,`running`,`paused`,`waiting_for_confirmation`,`finished`,`error`,`stuck`]);function Ue(e){let t=e??`idle`;return He.has(t)?t:`idle`}function $(e,t){if(!e)throw Error(`Conversation ${t} was not found`);return e}var We=class{static async sendMessage(e,t,n){let a=r().backend,o=n?.conversationUrl??null,c=n?.sessionApiKey??null;if(a.kind===`cloud`){if(!o||!c){let[t]=await A([e]);o=t?.conversation_url?.trim()??null,c=t?.session_api_key?.trim()??null}if(!o||!c)throw Error(`Conversation sandbox is still starting. Wait for it to finish, then try again.`);return await g({backend:a,method:`POST`,hostOverride:i(o),path:`/api/conversations/${e}/events`,body:{...t,run:!0},authMode:`session-api-key`,sessionApiKey:c}),t}return await new x(s({conversationUrl:o,sessionApiKey:c})).sendEvent(e,t,{run:!0}),t}static async createConversation(e,t,n,i,a,o,u,d){if(r().backend.kind===`cloud`)return ie({initial_message:e?{role:`user`,content:[{type:`text`,text:e}]}:null,title:t??null,selected_repository:i?.selected_repository??null,selected_branch:i?.selected_branch??null,git_provider:i?.git_provider??null,plugins:n??null,parent_conversation_id:o??null,agent_type:u,sandbox_id:d??null});let f=await b.getSettings(),p=ee(),m=await Ne({settings:f,query:e,conversationInstructions:t,plugins:n,conversationId:p,workingDir:a??l(p)}),h=await new x(s()).createConversation(m);return(i?.selected_repository||a)&&E(h.id,{selected_repository:i?.selected_repository??null,selected_branch:i?.selected_branch??null,git_provider:i?.git_provider??null,selected_workspace:a??null}),{id:h.id,created_by_user_id:null,status:`READY`,detail:null,app_conversation_id:h.id,agent_server_url:c().host,request:{initial_message:m.initial_message,plugins:n??null},created_at:h.created_at,updated_at:h.updated_at}}static async getStartTask(e){return r().backend.kind===`cloud`?de(e):null}static async getVSCodeUrl(e,t,n){let r=await this.resolveConversationWorkingDir(e);return{vscode_url:await new d(s({conversationUrl:t,sessionApiKey:n})).getUrl({baseUrl:typeof window<`u`?window.location.origin:void 0,workspaceDir:r})}}static async resolveConversationWorkingDir(e){let[t]=await this.batchGetAppConversations([e]);return t?.workspace?.working_dir??n()}static async batchGetAppConversations(e){return e.length===0?[]:r().backend.kind===`cloud`?A(e):Q(await new x(s()).getConversations(e)).map(e=>F(e))}static async updateConversationPublicFlag(e,t){if(r().backend.kind!==`cloud`)throw Error(`Public sharing requires a cloud backend.`);return se(e,t)}static async updateConversationRepository(e,t,n,r){t?E(e,{...T(e)??{},selected_repository:t,selected_branch:n??null,git_provider:r??null}):D(e);let[i]=await this.batchGetAppConversations([e]);return $(i,e)}static async readConversationFile(e,t){if(r().backend.kind===`cloud`)return ue(e,X(t??`/workspace/project/.agents_tmp/PLAN.md`,`/workspace/project`));let n=await this.resolveConversationWorkingDir(e),i=X(t??`${n}/.agents_tmp/PLAN.md`,n);return new f(s()).downloadTextFile(i)}static async downloadConversation(e){return r().backend.kind===`cloud`?ae(e):new f(s()).downloadTrajectory(e)}static async getHooks(e){return Pe()}static async getRuntimeConversation(e,t,n){let a=r().backend,o=a.kind===`cloud`&&t?await g({backend:a,method:`GET`,hostOverride:i(t),path:`/api/conversations/${e}`,authMode:`session-api-key`,sessionApiKey:n}):await new x(s({conversationUrl:t,sessionApiKey:n})).getConversation(e),c=Z(o),l=U(o)?o.stats:null;return{id:c.id,title:c.title?.trim()?c.title:P(c.id),metrics:J(c.metrics),created_at:c.created_at,updated_at:c.updated_at,status:Ue(c.execution_status),stats:U(l)?l:{usage_to_metrics:{}}}}static async searchConversations(e=20,t){return r().backend.kind===`cloud`?re(e,t):ve(Ve(await new x(s()).searchConversations({limit:e,page_id:t,sort_order:u.UPDATED_AT_DESC})))}static async deleteConversation(e){r().backend.kind===`cloud`?await oe(e):await new x(s()).deleteConversation(e),D(e)}static async updateConversationTitle(e,t){await new x(s()).updateConversation(e,{title:t});let[n]=await this.batchGetAppConversations([e]);return $(n,e)}static async switchProfile(e,t){if(r().backend.kind===`cloud`)throw Error(`LLM profile switching is only supported for local agent-server backends.`);if(!e){await new p(s()).activateProfile(t);return}await new x(s()).switchProfile(e,t)}static async switchAcpModel(e,t){if(r().backend.kind===`cloud`)throw Error(`ACP model switching is only supported for local agent-server backends.`);await new x(s()).switchAcpModel(e,t)}};export{T as a,le as i,A as n,x as o,ce as r,We as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n,P as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{t as i}from"./vendor~root~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-s~f2l2lr17-CDXvdvb2.js";import{o as a,t as o}from"./declaration-BNMqORFE.js";import{t as s}from"./useTranslation-DCOdSSMl.js";import{n as c,r as l}from"./custom-toast-handlers-C-SZFmto.js";import{t as u}from"./utils-i18rdUj2.js";import{c as d,i as f,t as p}from"./agent-server-client-options-Bc5ZorQZ.js";import{n as m}from"./active-backend-context-cCM1vYYZ.js";import{f as h}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-DTwbEEcX.js";import{n as g}from"./navigation-context-D0YWpT8d.js";import{t as _}from"./navigation-link-Cn7KP3c5.js";import{n as v,r as y}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~ninslayh-D9P8e98a.js";import{t as b}from"./proxy-CxydCnis.js";import{t as x}from"./u-edit-CFvXHqZk.js";import{t as S}from"./terminal-RmuaSdhJ.js";import{t as C}from"./use-user-conversation-DfgEB6RW.js";import{t as w}from"./toggle-switch-Pvyp2RAN.js";import{t as T}from"./x-mark-CrpjscNc.js";import{t as E}from"./clock-BRjCgHTc.js";import{_ as ee,a as D,b as O,c as k,g as te,h as A,i as ne,l as j,n as re,o as M,p as ie,r as ae,s as N,t as oe,u as P,v as se,y as ce}from"./edit-automation-modal-BGzR3nfZ.js";import{t as F}from"./automation-IdgZq6ZK.js";var I=e(t()),L=a(),le=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15.75 19.5 8.25 12l7.5-7.5`})});function R(){let{t:e}=s(`openhands`);return(0,L.jsxs)(_,{to:`/automations`,className:`inline-flex items-center gap-1.5 text-sm text-muted hover:text-foreground`,children:[(0,L.jsx)(le,{className:`size-4`}),e(o.AUTOMATIONS$DETAIL$BACK_TO_LIST)]})}var ue=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3`})});function z({active:e}){let{t}=s(`openhands`);return(0,L.jsx)(`span`,{"data-testid":e?`active-status-badge-active`:`active-status-badge-inactive`,className:u(`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium`,e?`bg-[var(--oh-success)]/15 text-[var(--oh-success)]`:`bg-surface-raised text-muted`),children:t(e?o.AUTOMATIONS$DETAIL$ACTIVE:o.AUTOMATIONS$DETAIL$INACTIVE)})}function B({automation:e,onToggle:t,onEdit:n,onDelete:r,onRunNow:i,isRunningNow:a=!1}){let{t:c}=s(`openhands`),l=j(`manage_automations`),u=[...n?[{label:c(o.AUTOMATIONS$EDIT),icon:(0,L.jsx)(x,{className:`size-4`}),onClick:n}]:[],{label:e.enabled?c(o.AUTOMATIONS$TURN_OFF):c(o.AUTOMATIONS$TURN_ON),icon:(0,L.jsx)(N,{className:`size-4`}),onClick:t},{label:c(o.AUTOMATIONS$DOWNLOAD_TARBALL),icon:(0,L.jsx)(ue,{className:`size-4`}),onClick:()=>{O.downloadTarball(e.id,e.name)}},{label:c(o.AUTOMATIONS$DELETE),icon:(0,L.jsx)(M,{className:`size-4`}),onClick:r}];return(0,L.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,L.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e.name}),(0,L.jsx)(z,{active:e.enabled})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&i&&(0,L.jsx)(`button`,{type:`button`,className:`rounded-md border border-[var(--oh-border)] px-3 py-1.5 text-sm font-medium text-content transition-colors hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:a||!e.enabled,onClick:i,children:a?`Starting…`:`Run now`}),l&&(0,L.jsx)(w,{enabled:e.enabled,label:e.enabled?c(o.AUTOMATIONS$TURN_OFF):c(o.AUTOMATIONS$TURN_ON),onToggle:t}),l&&(0,L.jsx)(P,{items:u})]})]})})}function V({icon:e,title:t,children:n}){return(0,L.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,L.jsx)(`span`,{className:`size-4 text-muted`,children:e}),(0,L.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t})]}),(0,L.jsx)(`div`,{className:`px-5 py-5`,children:n})]})}function H({prompt:e}){let{t}=s(`openhands`);return(0,L.jsx)(V,{icon:(0,L.jsx)(S,{className:`size-4`}),title:t(o.AUTOMATIONS$DETAIL$PROMPT),children:(0,L.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6 text-content`,children:e})})}var U=e=>(0,L.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 0 1 1.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 0 1-1.449.12l-.738-.527c-.35-.25-.806-.272-1.204-.107-.397.165-.71.505-.78.929l-.15.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 0 1-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.506-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.108-1.204l-.526-.738a1.125 1.125 0 0 1 .12-1.45l.773-.773a1.125 1.125 0 0 1 1.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894Z`}),(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z`})]}),de=e=>(0,L.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 3v12m0 0a3 3 0 1 0 3 3M6 15a3 3 0 0 1 3-3h6a3 3 0 0 0 3-3V3m0 0a3 3 0 1 0 0 0`}),(0,L.jsx)(`circle`,{cx:6,cy:3,r:2}),(0,L.jsx)(`circle`,{cx:18,cy:3,r:2}),(0,L.jsx)(`circle`,{cx:9,cy:18,r:2})]}),W=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),G=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5`})}),fe=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0`})});function K({icon:e,label:t,children:n}){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`size-3.5 text-muted`,children:e}),(0,L.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:t})]}),(0,L.jsx)(`div`,{className:`text-sm text-content`,children:n})]})}function pe({branch:e}){return(0,L.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-surface-raised px-2.5 py-0.5 text-xs text-muted`,children:e})}function me({automation:e}){let{t}=s(`openhands`),n=e.trigger.schedule??``;e.trigger.schedule_human&&(n=e.timezone?`${e.trigger.schedule_human} (${e.timezone})`:e.trigger.schedule_human);let r=e.trigger.type===`cron`?`Schedule`:e.trigger.type;return(0,L.jsx)(V,{icon:(0,L.jsx)(U,{className:`size-4`}),title:t(o.AUTOMATIONS$DETAIL$CONFIGURATION),children:(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-5`,children:[e.repository&&(0,L.jsx)(K,{icon:(0,L.jsx)(de,{className:`size-3.5`}),label:t(o.AUTOMATIONS$DETAIL$REPOSITORIES),children:(0,L.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e.repository,e.branch&&(0,L.jsx)(pe,{branch:e.branch})]})}),(0,L.jsx)(K,{icon:(0,L.jsx)(W,{className:`size-3.5`}),label:t(o.AUTOMATIONS$DETAIL$TRIGGER),children:r}),(0,L.jsx)(K,{icon:(0,L.jsx)(G,{className:`size-3.5`}),label:t(o.AUTOMATIONS$DETAIL$SCHEDULE),children:n}),(0,L.jsx)(K,{icon:(0,L.jsx)(k,{className:`size-3.5`}),label:t(o.AUTOMATIONS$DETAIL$MODEL),children:e.model??`Active profile`}),e.notification&&(0,L.jsx)(K,{icon:(0,L.jsx)(fe,{className:`size-3.5`}),label:t(o.AUTOMATIONS$DETAIL$NOTIFICATION),children:e.notification})]})})}var he=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z`})});function q({name:e}){return(0,L.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-[var(--oh-surface-deep)] px-3.5 py-1.5 text-sm text-content`,children:e})}function ge({plugins:e}){let{t}=s(`openhands`);return(0,L.jsx)(V,{icon:(0,L.jsx)(he,{className:`size-4`}),title:t(o.AUTOMATIONS$DETAIL$PLUGINS),children:(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,L.jsx)(q,{name:e},e))})})}var J=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182`})});function Y(e,t){return new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`})}function _e(e,t,n){let r=Date.now()-new Date(e).getTime(),i=Math.floor(r/6e4),a=Math.floor(r/36e5),s=Math.floor(r/864e5);return i<1?n(o.AUTOMATIONS$DETAIL$TIME_JUST_NOW):i<60?n(o.AUTOMATIONS$DETAIL$TIME_MINUTES_AGO,{count:i}):a<24?n(o.AUTOMATIONS$DETAIL$TIME_HOURS_AGO,{count:a}):s===1?n(o.AUTOMATIONS$DETAIL$TIME_YESTERDAY):s<7?n(o.AUTOMATIONS$DETAIL$TIME_DAYS_AGO,{count:s}):Y(e,t)}function ve({createdAt:e,lastRunAt:t}){let{t:n,i18n:r}=s(`openhands`),i=r.language;return(0,L.jsx)(V,{icon:(0,L.jsx)(J,{className:`size-4`}),title:n(o.AUTOMATIONS$DETAIL$ACTIVITY),children:(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4`,children:[(0,L.jsx)(K,{icon:(0,L.jsx)(G,{className:`size-3.5`}),label:n(o.AUTOMATIONS$DETAIL$CREATED),children:Y(e,i)}),(0,L.jsx)(K,{icon:(0,L.jsx)(E,{className:`size-3.5`}),label:n(o.AUTOMATIONS$DETAIL$LAST_RUN),children:t?_e(t,i,n):n(o.AUTOMATIONS$DETAIL$TIME_NEVER)})]})})}var ye=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),be={[F.COMPLETED]:{label:o.AUTOMATIONS$DETAIL$SUCCESSFUL,style:`border-[var(--oh-success)]/50 bg-[var(--oh-success)]/10 text-[var(--oh-success)]`},[F.FAILED]:{label:o.AUTOMATIONS$DETAIL$FAILED,style:`border-[var(--oh-danger)]/50 bg-[var(--oh-danger)]/10 text-danger`},[F.PENDING]:{label:o.AUTOMATIONS$DETAIL$PENDING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`},[F.RUNNING]:{label:o.AUTOMATIONS$DETAIL$RUNNING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`}};function xe({status:e}){switch(e){case F.COMPLETED:return(0,L.jsx)(W,{"data-testid":`run-status-icon-completed`,className:`size-3.5`});case F.FAILED:return(0,L.jsx)(ye,{"data-testid":`run-status-icon-failed`,className:`size-3.5`});default:return(0,L.jsx)(E,{"data-testid":`run-status-icon-pending`,className:`size-3.5`})}}function Se({status:e}){let{t}=s(`openhands`),n=be[e];return(0,L.jsxs)(`span`,{className:u(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium`,n.style),children:[(0,L.jsx)(xe,{status:e}),t(n.label)]})}var Ce=20;function we(e){return e.kind===`BashOutput`}var Te=class e{static async listOutputs(t,n,r){let i=[],a;for(let o=0;o<Ce;o+=1){let o=await e.searchEvents(t,n,{kind__eq:`BashOutput`,command_id__eq:r,sort_order:`TIMESTAMP`,...a?{page_id:a}:{}});if(o.items.forEach(e=>{we(e)&&i.push(e)}),!o.next_page_id)break;a=o.next_page_id}return i}static async searchEvents(e,t,n){let r=d().backend;if(r.kind===`cloud`){if(!e)throw Error(`BashService.listOutputs requires a conversation URL on cloud backends`);let i=new URLSearchParams;return Object.entries(n).forEach(([e,t])=>{t!=null&&i.set(e,String(t))}),b({backend:r,method:`GET`,hostOverride:f(e),path:`/api/bash/bash_events/search?${i.toString()}`,authMode:`session-api-key`,sessionApiKey:t})}return new h(p({...e?{conversationUrl:e}:{},sessionApiKey:t})).searchEvents(n)}},Ee=[`bash-command-logs`];function De(e){switch(e){case`MISSING`:return`missing`;case`PAUSED`:return`paused`;case`STARTING`:return`starting`;case`ERROR`:return`errored`;case`RUNNING`:case null:case void 0:default:return null}}function Oe(e){if(!y.isAxiosError(e))return null;if(!e.response)return`unreachable`;let t=e.response.status;return t===404||t>=500?`unreachable`:null}function ke(e){let{conversationId:t,bashCommandId:n,enabled:r=!0}=e,a=m(),o=C(r?t??null:null),s=o.data,c=s?.conversation_url??null,l=s?.session_api_key??null,u=a.backend.kind===`cloud`,d=o.isFetched,f=null,p=!1;u&&d&&(s?f=De(s.sandbox_status)??(s.conversation_url?null:`missing`):p=!0);let h=r&&!!n&&(u?!!c:!0)&&!f&&!p,g=i({queryKey:[...Ee,n,c,l,a.backend.id,a.orgId],queryFn:()=>Te.listOutputs(c,l,n),enabled:h,staleTime:60*1e3,gcTime:300*1e3,retry:!1}),_=u?Oe(g.error):null,v=f??_;return{data:g.data,error:_?null:g.error,isFetching:g.isFetching,isPending:g.isPending,isResolvingConversation:u&&o.isPending,conversationMissing:p,sandboxIssue:v}}var Ae={missing:o.AUTOMATIONS$DETAIL$LOGS_SANDBOX_MISSING,paused:o.AUTOMATIONS$DETAIL$LOGS_SANDBOX_PAUSED,starting:o.AUTOMATIONS$DETAIL$LOGS_SANDBOX_STARTING,errored:o.AUTOMATIONS$DETAIL$LOGS_SANDBOX_ERROR,unreachable:o.AUTOMATIONS$DETAIL$LOGS_SANDBOX_UNREACHABLE};function X(e,t){return[...e].sort((e,t)=>{let n=e.timestamp.localeCompare(t.timestamp);return n===0?(e.order??0)-(t.order??0):n}).map(e=>e[t]??``).join(``)}function je({conversationId:e,bashCommandId:t,isOpen:n,onClose:r}){let{t:i}=s(`openhands`),[a,c]=(0,I.useState)(`stdout`),{data:l,isFetching:u,isResolvingConversation:d,sandboxIssue:f,conversationMissing:p,error:m}=ke({conversationId:e,bashCommandId:t,enabled:n});(0,I.useEffect)(()=>{n&&c(`stdout`)},[n,t]),(0,I.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,r]);let{stdout:h,stderr:g}=(0,I.useMemo)(()=>l?{stdout:X(l,`stdout`),stderr:X(l,`stderr`)}:{stdout:``,stderr:``},[l]);if(!n)return null;let _=d||u&&!l,v=!t,y=a===`stdout`?h:g,b=`border-b-2 px-3 py-2 text-sm font-normal transition-colors focus:outline-none`,x=`border-[var(--oh-primary)] text-white`,S=`border-transparent text-muted hover:text-content`;return(0,L.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":i(o.AUTOMATIONS$DETAIL$LOGS_TITLE),children:[(0,L.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`presentation`}),(0,L.jsxs)(`div`,{className:`relative flex max-h-[80vh] w-full max-w-3xl flex-col rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:r,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":i(o.AUTOMATIONS$CANCEL),children:(0,L.jsx)(T,{className:`size-5`})}),(0,L.jsx)(`h2`,{className:`pr-8 text-lg font-medium text-white`,children:i(o.AUTOMATIONS$DETAIL$LOGS_TITLE)}),(0,L.jsxs)(`div`,{role:`tablist`,"aria-label":i(o.AUTOMATIONS$DETAIL$LOGS_TITLE),className:`mt-4 flex gap-1 border-b border-[var(--oh-border)]`,children:[(0,L.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":a===`stdout`,"aria-controls":`run-logs-panel-stdout`,id:`run-logs-tab-stdout`,tabIndex:a===`stdout`?0:-1,onClick:()=>c(`stdout`),className:`${b} ${a===`stdout`?x:S}`,children:i(o.AUTOMATIONS$DETAIL$LOGS_TAB_OUTPUT)}),(0,L.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":a===`stderr`,"aria-controls":`run-logs-panel-stderr`,id:`run-logs-tab-stderr`,tabIndex:a===`stderr`?0:-1,onClick:()=>c(`stderr`),className:`${b} ${a===`stderr`?x:S}`,children:i(o.AUTOMATIONS$DETAIL$LOGS_TAB_ERROR)})]}),(0,L.jsxs)(`div`,{role:`tabpanel`,id:`run-logs-panel-${a}`,"aria-labelledby":`run-logs-tab-${a}`,className:`mt-3 min-h-[12rem] flex-1 overflow-auto rounded-lg border border-[var(--oh-border)] bg-black/40 p-4 font-mono text-xs`,children:[v&&(0,L.jsx)(`p`,{className:`text-muted italic`,children:i(o.AUTOMATIONS$DETAIL$LOGS_NO_COMMAND)}),!v&&p&&(0,L.jsx)(`p`,{className:`text-muted italic`,children:i(o.AUTOMATIONS$DETAIL$LOGS_CONVERSATION_MISSING)}),!v&&!p&&f&&(0,L.jsx)(`p`,{"data-testid":`run-logs-sandbox-issue-${f}`,className:`text-muted italic`,children:i(Ae[f])}),!v&&!p&&!f&&_&&(0,L.jsx)(`p`,{className:`text-muted italic`,children:i(o.AUTOMATIONS$DETAIL$LOGS_LOADING)}),!v&&!p&&!f&&!_&&m&&!l&&(0,L.jsxs)(`p`,{className:`text-danger`,children:[i(o.AUTOMATIONS$DETAIL$LOGS_ERROR),`: `,String(m)]}),!_&&!f&&l&&(0,L.jsx)(`pre`,{"data-testid":`run-logs-output-${a}`,className:`whitespace-pre-wrap break-words ${a===`stderr`?`text-danger`:`text-content`}`,children:y.length>0?y:(0,L.jsx)(`span`,{className:`text-muted italic`,children:i(o.AUTOMATIONS$DETAIL$LOGS_EMPTY)})})]})]})]})}function Me(e,t){return new Date(e).toLocaleDateString(t,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function Ne(e){if(!e)return!0;let t=new Date(e).getTime();return Number.isNaN(t)||t===0}function Pe(e){return`/conversations/${e}`}function Fe({run:e}){let{t,i18n:n}=s(`openhands`),r=!!e.conversation_id,i=!!e.bash_command_id,a=e.status===F.COMPLETED||e.status===F.FAILED,c=!r&&a,[l,u]=(0,I.useState)(!1),[d]=(0,I.useState)(()=>new Date().toISOString()),f=Me(Ne(e.started_at)?d:e.started_at,n.language),p=i?(0,L.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),e.preventDefault(),u(!0)},className:`rounded-md p-1 text-muted hover:bg-surface-raised hover:text-foreground focus:bg-surface-raised focus:outline-none`,"aria-label":t(o.AUTOMATIONS$DETAIL$LOGS_VIEW,{timestamp:f}),title:t(o.AUTOMATIONS$DETAIL$LOGS_VIEW_SHORT),children:(0,L.jsx)(S,{className:`size-4`})}):null,m=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`span`,{className:`text-sm text-content`,children:f}),c&&(0,L.jsxs)(`span`,{className:`text-xs text-muted italic`,children:[`(`,t(o.AUTOMATIONS$DETAIL$NO_CONVERSATION),`)`]})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p,(0,L.jsx)(Se,{status:e.status})]})]});return(0,L.jsxs)(L.Fragment,{children:[r&&e.conversation_id?(0,L.jsx)(`a`,{href:Pe(e.conversation_id),className:`flex items-center justify-between px-5 py-3 transition-colors cursor-pointer hover:bg-surface-raised focus:bg-surface-raised focus:outline-none`,"aria-label":`View conversation for run at ${f}`,children:m}):(0,L.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 cursor-default`,children:m}),i&&(0,L.jsx)(je,{conversationId:e.conversation_id,bashCommandId:e.bash_command_id,isOpen:l,onClose:()=>u(!1)})]})}var Z=20;function Ie({automationId:e}){let{t}=s(`openhands`),[n,r]=(0,I.useState)(Z),{data:i,isLoading:a}=ce({id:e,limit:n,offset:0}),c=i?i.total>i.runs.length:!1;return(0,L.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,L.jsx)(`span`,{className:`size-4 text-muted`,children:(0,L.jsx)(J,{className:`size-4`})}),(0,L.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t(o.AUTOMATIONS$DETAIL$ACTIVITY_LOG)})]}),a&&(0,L.jsx)(`div`,{className:`space-y-1 p-5`,children:Array.from({length:3}).map((e,t)=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,L.jsx)(`div`,{className:`h-5 w-64 animate-pulse rounded bg-surface-raised`}),(0,L.jsx)(`div`,{className:`h-6 w-24 animate-pulse rounded-full bg-surface-raised`})]},`skeleton-${t}`))}),!a&&i?.runs.length===0&&(0,L.jsx)(`p`,{className:`px-5 py-8 text-center text-sm text-muted`,children:t(o.AUTOMATIONS$DETAIL$NO_RUNS)}),!a&&i&&i.runs.length>0&&(0,L.jsxs)(`div`,{children:[i.runs.map((e,t)=>(0,L.jsx)(`div`,{className:t>0?`border-t border-[var(--oh-border)]`:``,children:(0,L.jsx)(Fe,{run:e})},e.id)),c&&(0,L.jsx)(`div`,{className:`border-t border-[var(--oh-border)] px-5 py-3`,children:(0,L.jsx)(`button`,{type:`button`,onClick:()=>r(e=>e+Z),className:`text-sm text-muted hover:text-foreground`,children:t(o.AUTOMATIONS$DETAIL$LOAD_MORE_RUNS)})})]})]})}function Q({className:e}){return(0,L.jsx)(`div`,{className:u(`animate-pulse rounded bg-surface-raised`,e)})}function $(){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-testid":`detail-skeleton`,children:[(0,L.jsx)(Q,{className:`h-5 w-40`}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(Q,{className:`h-6 w-48`}),(0,L.jsx)(Q,{className:`h-6 w-16 rounded-full`})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(Q,{className:`h-6 w-11 rounded-full`}),(0,L.jsx)(Q,{className:`h-8 w-8`})]})]}),(0,L.jsx)(Q,{className:`h-5 w-96`}),(0,L.jsx)(Q,{className:`h-36 w-full rounded-2xl`}),(0,L.jsx)(Q,{className:`h-72 w-full rounded-2xl`}),(0,L.jsx)(Q,{className:`h-32 w-full rounded-2xl`}),(0,L.jsx)(Q,{className:`h-40 w-full rounded-2xl`})]})}function Le(){let{t:e}=s(`openhands`);return(0,L.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,L.jsx)(D,{className:`size-12 text-muted`}),(0,L.jsx)(`p`,{className:`mt-4 text-sm font-medium text-content`,children:e(o.AUTOMATIONS$DETAIL$NOT_FOUND_TITLE)}),(0,L.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:e(o.AUTOMATIONS$DETAIL$NOT_FOUND_MESSAGE)}),(0,L.jsx)(`div`,{className:`mt-6`,children:(0,L.jsx)(R,{})})]})}var Re=n(function(){let{t:e}=s(`openhands`),{automationId:t}=r(),{navigate:n}=g(),[i,a]=(0,I.useState)(!1),[u,d]=(0,I.useState)(!1),{data:f,isLoading:p,refetch:h}=ie(),_=f?.status===`ok`,y=m(),b=(0,I.useRef)(y.backend.id).current!==y.backend.id,{data:x,isLoading:S,isError:C,error:w,refetch:T}=se({id:t??``,enabled:_&&!b}),E=ee(),D=A(),O=te(),k=C&&v(w)&&w.response?.status===404;if(p)return(0,L.jsx)(`div`,{className:`min-h-full`,children:(0,L.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,L.jsx)($,{})})});if(!_)return(0,L.jsx)(`div`,{className:`min-h-full`,children:(0,L.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,L.jsx)(ae,{onRetry:h})})});if(S)return(0,L.jsx)(`div`,{className:`min-h-full`,children:(0,L.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,L.jsx)($,{})})});if(k)return(0,L.jsx)(`div`,{className:`min-h-full`,children:(0,L.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,L.jsx)(Le,{})})});if(C||!x)return(0,L.jsx)(`div`,{className:`min-h-full`,children:(0,L.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,L.jsx)(ne,{onRetry:()=>T()})})});let j=()=>{E.mutate({id:x.id,enabled:!x.enabled})},M=()=>{D.mutate(x.id,{onSuccess:()=>{n?.(`/automations`)}})},N=()=>{O.mutate(x.id,{onSuccess:()=>{l(e(o.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{c(v(t)?t.response?.data?.message||t.message||e(o.AUTOMATIONS$RUN_NOW_ERROR):t.message||e(o.AUTOMATIONS$RUN_NOW_ERROR))}})},P=y.backend.kind===`local`;return(0,L.jsx)(`div`,{className:`min-h-full`,children:(0,L.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,L.jsx)(R,{}),(0,L.jsx)(B,{automation:x,onToggle:j,onEdit:P?()=>d(!0):void 0,onDelete:()=>a(!0),onRunNow:N,isRunningNow:O.isPending}),x.prompt&&(0,L.jsx)(H,{prompt:x.prompt}),(0,L.jsx)(me,{automation:x}),x.plugins&&x.plugins.length>0&&(0,L.jsx)(ge,{plugins:x.plugins}),(0,L.jsx)(ve,{createdAt:x.created_at,lastRunAt:x.last_triggered_at}),(0,L.jsx)(Ie,{automationId:x.id}),(0,L.jsx)(re,{automationName:x.name,isOpen:i,onConfirm:M,onCancel:()=>a(!1)}),P&&(0,L.jsx)(oe,{automation:x,isOpen:u,onClose:()=>d(!1)})]})})})});export{Re as default};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n,P as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{t as i}from"./vendor~root~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-s~f2l2lr17-CDXvdvb2.js";import{o as a,t as o}from"./declaration-BNMqORFE.js";import{t as s}from"./useTranslation-DCOdSSMl.js";import{n as c,r as l}from"./custom-toast-handlers-C-SZFmto.js";import{t as u}from"./utils-i18rdUj2.js";import{c as d,i as f,t as p}from"./agent-server-client-options-Bc5ZorQZ.js";import{n as m}from"./active-backend-context-cCM1vYYZ.js";import{f as h}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-DTwbEEcX.js";import{n as g}from"./navigation-context-D0YWpT8d.js";import{t as _}from"./navigation-link-Cn7KP3c5.js";import{n as v,r as y}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~ninslayh-D9P8e98a.js";import{t as b}from"./proxy-CxydCnis.js";import{t as x}from"./u-edit-CFvXHqZk.js";import{t as S}from"./terminal-RmuaSdhJ.js";import{t as C}from"./use-user-conversation-C6hrMMtn.js";import{t as w}from"./toggle-switch-Pvyp2RAN.js";import{t as T}from"./x-mark-CrpjscNc.js";import{t as E}from"./clock-BRjCgHTc.js";import{_ as ee,a as D,b as O,c as k,g as te,h as A,i as ne,l as j,n as re,o as M,p as ie,r as ae,s as N,t as oe,u as P,v as se,y as ce}from"./edit-automation-modal-BGzR3nfZ.js";import{t as F}from"./automation-IdgZq6ZK.js";var I=e(t()),L=a(),le=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15.75 19.5 8.25 12l7.5-7.5`})});function R(){let{t:e}=s(`openhands`);return(0,L.jsxs)(_,{to:`/automations`,className:`inline-flex items-center gap-1.5 text-sm text-muted hover:text-foreground`,children:[(0,L.jsx)(le,{className:`size-4`}),e(o.AUTOMATIONS$DETAIL$BACK_TO_LIST)]})}var ue=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3`})});function z({active:e}){let{t}=s(`openhands`);return(0,L.jsx)(`span`,{"data-testid":e?`active-status-badge-active`:`active-status-badge-inactive`,className:u(`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium`,e?`bg-[var(--oh-success)]/15 text-[var(--oh-success)]`:`bg-surface-raised text-muted`),children:t(e?o.AUTOMATIONS$DETAIL$ACTIVE:o.AUTOMATIONS$DETAIL$INACTIVE)})}function B({automation:e,onToggle:t,onEdit:n,onDelete:r,onRunNow:i,isRunningNow:a=!1}){let{t:c}=s(`openhands`),l=j(`manage_automations`),u=[...n?[{label:c(o.AUTOMATIONS$EDIT),icon:(0,L.jsx)(x,{className:`size-4`}),onClick:n}]:[],{label:e.enabled?c(o.AUTOMATIONS$TURN_OFF):c(o.AUTOMATIONS$TURN_ON),icon:(0,L.jsx)(N,{className:`size-4`}),onClick:t},{label:c(o.AUTOMATIONS$DOWNLOAD_TARBALL),icon:(0,L.jsx)(ue,{className:`size-4`}),onClick:()=>{O.downloadTarball(e.id,e.name)}},{label:c(o.AUTOMATIONS$DELETE),icon:(0,L.jsx)(M,{className:`size-4`}),onClick:r}];return(0,L.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,L.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e.name}),(0,L.jsx)(z,{active:e.enabled})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&i&&(0,L.jsx)(`button`,{type:`button`,className:`rounded-md border border-[var(--oh-border)] px-3 py-1.5 text-sm font-medium text-content transition-colors hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:a||!e.enabled,onClick:i,children:a?`Starting…`:`Run now`}),l&&(0,L.jsx)(w,{enabled:e.enabled,label:e.enabled?c(o.AUTOMATIONS$TURN_OFF):c(o.AUTOMATIONS$TURN_ON),onToggle:t}),l&&(0,L.jsx)(P,{items:u})]})]})})}function V({icon:e,title:t,children:n}){return(0,L.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,L.jsx)(`span`,{className:`size-4 text-muted`,children:e}),(0,L.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t})]}),(0,L.jsx)(`div`,{className:`px-5 py-5`,children:n})]})}function H({prompt:e}){let{t}=s(`openhands`);return(0,L.jsx)(V,{icon:(0,L.jsx)(S,{className:`size-4`}),title:t(o.AUTOMATIONS$DETAIL$PROMPT),children:(0,L.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6 text-content`,children:e})})}var U=e=>(0,L.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 0 1 1.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 0 1-1.449.12l-.738-.527c-.35-.25-.806-.272-1.204-.107-.397.165-.71.505-.78.929l-.15.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 0 1-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.506-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.108-1.204l-.526-.738a1.125 1.125 0 0 1 .12-1.45l.773-.773a1.125 1.125 0 0 1 1.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894Z`}),(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z`})]}),de=e=>(0,L.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 3v12m0 0a3 3 0 1 0 3 3M6 15a3 3 0 0 1 3-3h6a3 3 0 0 0 3-3V3m0 0a3 3 0 1 0 0 0`}),(0,L.jsx)(`circle`,{cx:6,cy:3,r:2}),(0,L.jsx)(`circle`,{cx:18,cy:3,r:2}),(0,L.jsx)(`circle`,{cx:9,cy:18,r:2})]}),W=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),G=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5`})}),fe=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0`})});function K({icon:e,label:t,children:n}){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`size-3.5 text-muted`,children:e}),(0,L.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:t})]}),(0,L.jsx)(`div`,{className:`text-sm text-content`,children:n})]})}function pe({branch:e}){return(0,L.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-surface-raised px-2.5 py-0.5 text-xs text-muted`,children:e})}function me({automation:e}){let{t}=s(`openhands`),n=e.trigger.schedule??``;e.trigger.schedule_human&&(n=e.timezone?`${e.trigger.schedule_human} (${e.timezone})`:e.trigger.schedule_human);let r=e.trigger.type===`cron`?`Schedule`:e.trigger.type;return(0,L.jsx)(V,{icon:(0,L.jsx)(U,{className:`size-4`}),title:t(o.AUTOMATIONS$DETAIL$CONFIGURATION),children:(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-5`,children:[e.repository&&(0,L.jsx)(K,{icon:(0,L.jsx)(de,{className:`size-3.5`}),label:t(o.AUTOMATIONS$DETAIL$REPOSITORIES),children:(0,L.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e.repository,e.branch&&(0,L.jsx)(pe,{branch:e.branch})]})}),(0,L.jsx)(K,{icon:(0,L.jsx)(W,{className:`size-3.5`}),label:t(o.AUTOMATIONS$DETAIL$TRIGGER),children:r}),(0,L.jsx)(K,{icon:(0,L.jsx)(G,{className:`size-3.5`}),label:t(o.AUTOMATIONS$DETAIL$SCHEDULE),children:n}),(0,L.jsx)(K,{icon:(0,L.jsx)(k,{className:`size-3.5`}),label:t(o.AUTOMATIONS$DETAIL$MODEL),children:e.model??`Active profile`}),e.notification&&(0,L.jsx)(K,{icon:(0,L.jsx)(fe,{className:`size-3.5`}),label:t(o.AUTOMATIONS$DETAIL$NOTIFICATION),children:e.notification})]})})}var he=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z`})});function q({name:e}){return(0,L.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-[var(--oh-surface-deep)] px-3.5 py-1.5 text-sm text-content`,children:e})}function ge({plugins:e}){let{t}=s(`openhands`);return(0,L.jsx)(V,{icon:(0,L.jsx)(he,{className:`size-4`}),title:t(o.AUTOMATIONS$DETAIL$PLUGINS),children:(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,L.jsx)(q,{name:e},e))})})}var J=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182`})});function Y(e,t){return new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`})}function _e(e,t,n){let r=Date.now()-new Date(e).getTime(),i=Math.floor(r/6e4),a=Math.floor(r/36e5),s=Math.floor(r/864e5);return i<1?n(o.AUTOMATIONS$DETAIL$TIME_JUST_NOW):i<60?n(o.AUTOMATIONS$DETAIL$TIME_MINUTES_AGO,{count:i}):a<24?n(o.AUTOMATIONS$DETAIL$TIME_HOURS_AGO,{count:a}):s===1?n(o.AUTOMATIONS$DETAIL$TIME_YESTERDAY):s<7?n(o.AUTOMATIONS$DETAIL$TIME_DAYS_AGO,{count:s}):Y(e,t)}function ve({createdAt:e,lastRunAt:t}){let{t:n,i18n:r}=s(`openhands`),i=r.language;return(0,L.jsx)(V,{icon:(0,L.jsx)(J,{className:`size-4`}),title:n(o.AUTOMATIONS$DETAIL$ACTIVITY),children:(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4`,children:[(0,L.jsx)(K,{icon:(0,L.jsx)(G,{className:`size-3.5`}),label:n(o.AUTOMATIONS$DETAIL$CREATED),children:Y(e,i)}),(0,L.jsx)(K,{icon:(0,L.jsx)(E,{className:`size-3.5`}),label:n(o.AUTOMATIONS$DETAIL$LAST_RUN),children:t?_e(t,i,n):n(o.AUTOMATIONS$DETAIL$TIME_NEVER)})]})})}var ye=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),be={[F.COMPLETED]:{label:o.AUTOMATIONS$DETAIL$SUCCESSFUL,style:`border-[var(--oh-success)]/50 bg-[var(--oh-success)]/10 text-[var(--oh-success)]`},[F.FAILED]:{label:o.AUTOMATIONS$DETAIL$FAILED,style:`border-[var(--oh-danger)]/50 bg-[var(--oh-danger)]/10 text-danger`},[F.PENDING]:{label:o.AUTOMATIONS$DETAIL$PENDING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`},[F.RUNNING]:{label:o.AUTOMATIONS$DETAIL$RUNNING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`}};function xe({status:e}){switch(e){case F.COMPLETED:return(0,L.jsx)(W,{"data-testid":`run-status-icon-completed`,className:`size-3.5`});case F.FAILED:return(0,L.jsx)(ye,{"data-testid":`run-status-icon-failed`,className:`size-3.5`});default:return(0,L.jsx)(E,{"data-testid":`run-status-icon-pending`,className:`size-3.5`})}}function Se({status:e}){let{t}=s(`openhands`),n=be[e];return(0,L.jsxs)(`span`,{className:u(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium`,n.style),children:[(0,L.jsx)(xe,{status:e}),t(n.label)]})}var Ce=20;function we(e){return e.kind===`BashOutput`}var Te=class e{static async listOutputs(t,n,r){let i=[],a;for(let o=0;o<Ce;o+=1){let o=await e.searchEvents(t,n,{kind__eq:`BashOutput`,command_id__eq:r,sort_order:`TIMESTAMP`,...a?{page_id:a}:{}});if(o.items.forEach(e=>{we(e)&&i.push(e)}),!o.next_page_id)break;a=o.next_page_id}return i}static async searchEvents(e,t,n){let r=d().backend;if(r.kind===`cloud`){if(!e)throw Error(`BashService.listOutputs requires a conversation URL on cloud backends`);let i=new URLSearchParams;return Object.entries(n).forEach(([e,t])=>{t!=null&&i.set(e,String(t))}),b({backend:r,method:`GET`,hostOverride:f(e),path:`/api/bash/bash_events/search?${i.toString()}`,authMode:`session-api-key`,sessionApiKey:t})}return new h(p({...e?{conversationUrl:e}:{},sessionApiKey:t})).searchEvents(n)}},Ee=[`bash-command-logs`];function De(e){switch(e){case`MISSING`:return`missing`;case`PAUSED`:return`paused`;case`STARTING`:return`starting`;case`ERROR`:return`errored`;case`RUNNING`:case null:case void 0:default:return null}}function Oe(e){if(!y.isAxiosError(e))return null;if(!e.response)return`unreachable`;let t=e.response.status;return t===404||t>=500?`unreachable`:null}function ke(e){let{conversationId:t,bashCommandId:n,enabled:r=!0}=e,a=m(),o=C(r?t??null:null),s=o.data,c=s?.conversation_url??null,l=s?.session_api_key??null,u=a.backend.kind===`cloud`,d=o.isFetched,f=null,p=!1;u&&d&&(s?f=De(s.sandbox_status)??(s.conversation_url?null:`missing`):p=!0);let h=r&&!!n&&(u?!!c:!0)&&!f&&!p,g=i({queryKey:[...Ee,n,c,l,a.backend.id,a.orgId],queryFn:()=>Te.listOutputs(c,l,n),enabled:h,staleTime:60*1e3,gcTime:300*1e3,retry:!1}),_=u?Oe(g.error):null,v=f??_;return{data:g.data,error:_?null:g.error,isFetching:g.isFetching,isPending:g.isPending,isResolvingConversation:u&&o.isPending,conversationMissing:p,sandboxIssue:v}}var Ae={missing:o.AUTOMATIONS$DETAIL$LOGS_SANDBOX_MISSING,paused:o.AUTOMATIONS$DETAIL$LOGS_SANDBOX_PAUSED,starting:o.AUTOMATIONS$DETAIL$LOGS_SANDBOX_STARTING,errored:o.AUTOMATIONS$DETAIL$LOGS_SANDBOX_ERROR,unreachable:o.AUTOMATIONS$DETAIL$LOGS_SANDBOX_UNREACHABLE};function X(e,t){return[...e].sort((e,t)=>{let n=e.timestamp.localeCompare(t.timestamp);return n===0?(e.order??0)-(t.order??0):n}).map(e=>e[t]??``).join(``)}function je({conversationId:e,bashCommandId:t,isOpen:n,onClose:r}){let{t:i}=s(`openhands`),[a,c]=(0,I.useState)(`stdout`),{data:l,isFetching:u,isResolvingConversation:d,sandboxIssue:f,conversationMissing:p,error:m}=ke({conversationId:e,bashCommandId:t,enabled:n});(0,I.useEffect)(()=>{n&&c(`stdout`)},[n,t]),(0,I.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,r]);let{stdout:h,stderr:g}=(0,I.useMemo)(()=>l?{stdout:X(l,`stdout`),stderr:X(l,`stderr`)}:{stdout:``,stderr:``},[l]);if(!n)return null;let _=d||u&&!l,v=!t,y=a===`stdout`?h:g,b=`border-b-2 px-3 py-2 text-sm font-normal transition-colors focus:outline-none`,x=`border-[var(--oh-primary)] text-white`,S=`border-transparent text-muted hover:text-content`;return(0,L.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":i(o.AUTOMATIONS$DETAIL$LOGS_TITLE),children:[(0,L.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`presentation`}),(0,L.jsxs)(`div`,{className:`relative flex max-h-[80vh] w-full max-w-3xl flex-col rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:r,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":i(o.AUTOMATIONS$CANCEL),children:(0,L.jsx)(T,{className:`size-5`})}),(0,L.jsx)(`h2`,{className:`pr-8 text-lg font-medium text-white`,children:i(o.AUTOMATIONS$DETAIL$LOGS_TITLE)}),(0,L.jsxs)(`div`,{role:`tablist`,"aria-label":i(o.AUTOMATIONS$DETAIL$LOGS_TITLE),className:`mt-4 flex gap-1 border-b border-[var(--oh-border)]`,children:[(0,L.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":a===`stdout`,"aria-controls":`run-logs-panel-stdout`,id:`run-logs-tab-stdout`,tabIndex:a===`stdout`?0:-1,onClick:()=>c(`stdout`),className:`${b} ${a===`stdout`?x:S}`,children:i(o.AUTOMATIONS$DETAIL$LOGS_TAB_OUTPUT)}),(0,L.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":a===`stderr`,"aria-controls":`run-logs-panel-stderr`,id:`run-logs-tab-stderr`,tabIndex:a===`stderr`?0:-1,onClick:()=>c(`stderr`),className:`${b} ${a===`stderr`?x:S}`,children:i(o.AUTOMATIONS$DETAIL$LOGS_TAB_ERROR)})]}),(0,L.jsxs)(`div`,{role:`tabpanel`,id:`run-logs-panel-${a}`,"aria-labelledby":`run-logs-tab-${a}`,className:`mt-3 min-h-[12rem] flex-1 overflow-auto rounded-lg border border-[var(--oh-border)] bg-black/40 p-4 font-mono text-xs`,children:[v&&(0,L.jsx)(`p`,{className:`text-muted italic`,children:i(o.AUTOMATIONS$DETAIL$LOGS_NO_COMMAND)}),!v&&p&&(0,L.jsx)(`p`,{className:`text-muted italic`,children:i(o.AUTOMATIONS$DETAIL$LOGS_CONVERSATION_MISSING)}),!v&&!p&&f&&(0,L.jsx)(`p`,{"data-testid":`run-logs-sandbox-issue-${f}`,className:`text-muted italic`,children:i(Ae[f])}),!v&&!p&&!f&&_&&(0,L.jsx)(`p`,{className:`text-muted italic`,children:i(o.AUTOMATIONS$DETAIL$LOGS_LOADING)}),!v&&!p&&!f&&!_&&m&&!l&&(0,L.jsxs)(`p`,{className:`text-danger`,children:[i(o.AUTOMATIONS$DETAIL$LOGS_ERROR),`: `,String(m)]}),!_&&!f&&l&&(0,L.jsx)(`pre`,{"data-testid":`run-logs-output-${a}`,className:`whitespace-pre-wrap break-words ${a===`stderr`?`text-danger`:`text-content`}`,children:y.length>0?y:(0,L.jsx)(`span`,{className:`text-muted italic`,children:i(o.AUTOMATIONS$DETAIL$LOGS_EMPTY)})})]})]})]})}function Me(e,t){return new Date(e).toLocaleDateString(t,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function Ne(e){if(!e)return!0;let t=new Date(e).getTime();return Number.isNaN(t)||t===0}function Pe(e){return`/conversations/${e}`}function Fe({run:e}){let{t,i18n:n}=s(`openhands`),r=!!e.conversation_id,i=!!e.bash_command_id,a=e.status===F.COMPLETED||e.status===F.FAILED,c=!r&&a,[l,u]=(0,I.useState)(!1),[d]=(0,I.useState)(()=>new Date().toISOString()),f=Me(Ne(e.started_at)?d:e.started_at,n.language),p=i?(0,L.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),e.preventDefault(),u(!0)},className:`rounded-md p-1 text-muted hover:bg-surface-raised hover:text-foreground focus:bg-surface-raised focus:outline-none`,"aria-label":t(o.AUTOMATIONS$DETAIL$LOGS_VIEW,{timestamp:f}),title:t(o.AUTOMATIONS$DETAIL$LOGS_VIEW_SHORT),children:(0,L.jsx)(S,{className:`size-4`})}):null,m=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`span`,{className:`text-sm text-content`,children:f}),c&&(0,L.jsxs)(`span`,{className:`text-xs text-muted italic`,children:[`(`,t(o.AUTOMATIONS$DETAIL$NO_CONVERSATION),`)`]})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p,(0,L.jsx)(Se,{status:e.status})]})]});return(0,L.jsxs)(L.Fragment,{children:[r&&e.conversation_id?(0,L.jsx)(`a`,{href:Pe(e.conversation_id),className:`flex items-center justify-between px-5 py-3 transition-colors cursor-pointer hover:bg-surface-raised focus:bg-surface-raised focus:outline-none`,"aria-label":`View conversation for run at ${f}`,children:m}):(0,L.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 cursor-default`,children:m}),i&&(0,L.jsx)(je,{conversationId:e.conversation_id,bashCommandId:e.bash_command_id,isOpen:l,onClose:()=>u(!1)})]})}var Z=20;function Ie({automationId:e}){let{t}=s(`openhands`),[n,r]=(0,I.useState)(Z),{data:i,isLoading:a}=ce({id:e,limit:n,offset:0}),c=i?i.total>i.runs.length:!1;return(0,L.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,L.jsx)(`span`,{className:`size-4 text-muted`,children:(0,L.jsx)(J,{className:`size-4`})}),(0,L.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t(o.AUTOMATIONS$DETAIL$ACTIVITY_LOG)})]}),a&&(0,L.jsx)(`div`,{className:`space-y-1 p-5`,children:Array.from({length:3}).map((e,t)=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,L.jsx)(`div`,{className:`h-5 w-64 animate-pulse rounded bg-surface-raised`}),(0,L.jsx)(`div`,{className:`h-6 w-24 animate-pulse rounded-full bg-surface-raised`})]},`skeleton-${t}`))}),!a&&i?.runs.length===0&&(0,L.jsx)(`p`,{className:`px-5 py-8 text-center text-sm text-muted`,children:t(o.AUTOMATIONS$DETAIL$NO_RUNS)}),!a&&i&&i.runs.length>0&&(0,L.jsxs)(`div`,{children:[i.runs.map((e,t)=>(0,L.jsx)(`div`,{className:t>0?`border-t border-[var(--oh-border)]`:``,children:(0,L.jsx)(Fe,{run:e})},e.id)),c&&(0,L.jsx)(`div`,{className:`border-t border-[var(--oh-border)] px-5 py-3`,children:(0,L.jsx)(`button`,{type:`button`,onClick:()=>r(e=>e+Z),className:`text-sm text-muted hover:text-foreground`,children:t(o.AUTOMATIONS$DETAIL$LOAD_MORE_RUNS)})})]})]})}function Q({className:e}){return(0,L.jsx)(`div`,{className:u(`animate-pulse rounded bg-surface-raised`,e)})}function $(){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-testid":`detail-skeleton`,children:[(0,L.jsx)(Q,{className:`h-5 w-40`}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(Q,{className:`h-6 w-48`}),(0,L.jsx)(Q,{className:`h-6 w-16 rounded-full`})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(Q,{className:`h-6 w-11 rounded-full`}),(0,L.jsx)(Q,{className:`h-8 w-8`})]})]}),(0,L.jsx)(Q,{className:`h-5 w-96`}),(0,L.jsx)(Q,{className:`h-36 w-full rounded-2xl`}),(0,L.jsx)(Q,{className:`h-72 w-full rounded-2xl`}),(0,L.jsx)(Q,{className:`h-32 w-full rounded-2xl`}),(0,L.jsx)(Q,{className:`h-40 w-full rounded-2xl`})]})}function Le(){let{t:e}=s(`openhands`);return(0,L.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,L.jsx)(D,{className:`size-12 text-muted`}),(0,L.jsx)(`p`,{className:`mt-4 text-sm font-medium text-content`,children:e(o.AUTOMATIONS$DETAIL$NOT_FOUND_TITLE)}),(0,L.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:e(o.AUTOMATIONS$DETAIL$NOT_FOUND_MESSAGE)}),(0,L.jsx)(`div`,{className:`mt-6`,children:(0,L.jsx)(R,{})})]})}var Re=n(function(){let{t:e}=s(`openhands`),{automationId:t}=r(),{navigate:n}=g(),[i,a]=(0,I.useState)(!1),[u,d]=(0,I.useState)(!1),{data:f,isLoading:p,refetch:h}=ie(),_=f?.status===`ok`,y=m(),b=(0,I.useRef)(y.backend.id).current!==y.backend.id,{data:x,isLoading:S,isError:C,error:w,refetch:T}=se({id:t??``,enabled:_&&!b}),E=ee(),D=A(),O=te(),k=C&&v(w)&&w.response?.status===404;if(p)return(0,L.jsx)(`div`,{className:`min-h-full`,children:(0,L.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,L.jsx)($,{})})});if(!_)return(0,L.jsx)(`div`,{className:`min-h-full`,children:(0,L.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,L.jsx)(ae,{onRetry:h})})});if(S)return(0,L.jsx)(`div`,{className:`min-h-full`,children:(0,L.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,L.jsx)($,{})})});if(k)return(0,L.jsx)(`div`,{className:`min-h-full`,children:(0,L.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,L.jsx)(Le,{})})});if(C||!x)return(0,L.jsx)(`div`,{className:`min-h-full`,children:(0,L.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,L.jsx)(ne,{onRetry:()=>T()})})});let j=()=>{E.mutate({id:x.id,enabled:!x.enabled})},M=()=>{D.mutate(x.id,{onSuccess:()=>{n?.(`/automations`)}})},N=()=>{O.mutate(x.id,{onSuccess:()=>{l(e(o.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{c(v(t)?t.response?.data?.message||t.message||e(o.AUTOMATIONS$RUN_NOW_ERROR):t.message||e(o.AUTOMATIONS$RUN_NOW_ERROR))}})},P=y.backend.kind===`local`;return(0,L.jsx)(`div`,{className:`min-h-full`,children:(0,L.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,L.jsx)(R,{}),(0,L.jsx)(B,{automation:x,onToggle:j,onEdit:P?()=>d(!0):void 0,onDelete:()=>a(!0),onRunNow:N,isRunningNow:O.isPending}),x.prompt&&(0,L.jsx)(H,{prompt:x.prompt}),(0,L.jsx)(me,{automation:x}),x.plugins&&x.plugins.length>0&&(0,L.jsx)(ge,{plugins:x.plugins}),(0,L.jsx)(ve,{createdAt:x.created_at,lastRunAt:x.last_triggered_at}),(0,L.jsx)(Ie,{automationId:x.id}),(0,L.jsx)(re,{automationName:x.name,isOpen:i,onConfirm:M,onCancel:()=>a(!1)}),P&&(0,L.jsx)(oe,{automation:x,isOpen:u,onClose:()=>d(!1)})]})})})});export{Re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{t as r}from"./react-dom-hVBnwgwZ.js";import{o as i,t as a}from"./declaration-BNMqORFE.js";import{t as o}from"./Trans-Cvm_-SMi.js";import{t as s}from"./useTranslation-DCOdSSMl.js";import{t as c}from"./createLucideIcon-Ddu8jDOQ.js";import{t as l}from"./check-CYxAHs85.js";import{n as u,r as d}from"./custom-toast-handlers-C-SZFmto.js";import{a as f,c as p,i as m,o as h,r as g,s as _}from"./circle-plus-check-toggle-P7ZZToV4.js";import{t as v}from"./utils-i18rdUj2.js";import{n as ee}from"./active-backend-context-cCM1vYYZ.js";import{t as y}from"./modal-backdrop-BAbgYsqB.js";import{t as b}from"./brand-button-Br7f0kZJ.js";import{n as x}from"./navigation-context-D0YWpT8d.js";import{t as S}from"./styled-tooltip-CBzrri6o.js";import{n as te}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~ninslayh-D9P8e98a.js";import{t as C}from"./modal-close-button-t1Gh3qmL.js";import{n as w,t as T}from"./context-menu-list-item-CWNFpuiC.js";import{t as E}from"./u-edit-CFvXHqZk.js";import{t as D}from"./folder-ZZJVGgd7.js";import{t as O}from"./search-27Owlc3A.js";import{n as k,t as ne}from"./recommended-automations-launcher-sgvfU62c.js";import{n as A}from"./skill-card-pill-row-DF1axQCG.js";import{t as j}from"./clock-BRjCgHTc.js";import{n as M,t as N}from"./use-launch-skill-in-chat-fNN_xGZG.js";import{_ as re,c as P,d as F,f as I,g as ie,h as ae,i as oe,l as L,m as se,n as ce,o as R,p as le,r as ue,s as z,t as de,u as B}from"./edit-automation-modal-BGzR3nfZ.js";var fe=c(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),V=c(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),pe=c(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),H=e(t()),U=i();function me({value:e,onChange:t,className:n}){let{t:r}=s(`openhands`);return(0,U.jsxs)(`div`,{className:v(`relative flex min-w-0 flex-1 items-center`,`h-9 rounded-lg border border-[var(--oh-border)] bg-base-secondary`,`focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20`,`transition-colors`,n),children:[(0,U.jsx)(O,{className:`ml-3 size-4 shrink-0 text-tertiary-alt`,"aria-hidden":!0}),(0,U.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:r(a.AUTOMATIONS$SEARCH_PLACEHOLDER),"aria-label":r(a.AUTOMATIONS$SEARCH_PLACEHOLDER),className:`min-w-0 flex-1 border-0 bg-transparent px-3 text-sm text-white outline-none placeholder:text-tertiary-alt`})]})}var W=e=>(0,U.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,U.jsx)(`g`,{clipPath:`url(#clip0_8467_30872)`,children:(0,U.jsx)(`path`,{d:`M6.26693 21.4874L6.25583 21.4951L6.24514 21.5033C5.95991 21.7227 5.5 21.5308 5.5 21.0996V2.89961C5.5 2.4684 5.95991 2.2765 6.24514 2.49592L6.25634 2.50452L6.26799 2.51249L19.518 11.5625L19.518 11.5625L19.5226 11.5656C19.8258 11.7677 19.8258 12.1815 19.5226 12.3836L19.5226 12.3835L19.5169 12.3874L6.26693 21.4874Z`,fill:`currentColor`,stroke:`currentColor`})}),(0,U.jsx)(`defs`,{children:(0,U.jsx)(`clipPath`,{id:`clip0_8467_30872`,children:(0,U.jsx)(`rect`,{width:24,height:24,fill:`white`})})})]});function G(e,t){let n=[];return e.repository&&n.push({id:`repository`,node:(0,U.jsxs)(`span`,{className:v(h,`gap-1`),children:[(0,U.jsx)(D,{className:`size-3 shrink-0`}),e.repository]})}),n.push({id:`schedule`,node:(0,U.jsxs)(`span`,{className:v(h,`gap-1`),children:[(0,U.jsx)(j,{className:`size-3 shrink-0`}),t]})}),e.model&&n.push({id:`model`,node:(0,U.jsxs)(`span`,{className:v(h,`gap-1`),children:[(0,U.jsx)(P,{className:`size-3 shrink-0`}),e.model]})}),n}function K({automation:e,t,canManage:n,onRunNow:r,isRunPending:i,onView:o,onEdit:s,onToggle:c,onDelete:l}){return[...n?[{label:t(a.AUTOMATIONS$RUN_NOW),icon:(0,U.jsx)(W,{className:`size-4`}),onClick:()=>r(e.id),disabled:i||!e.enabled}]:[],{label:t(a.COMMON$VIEW),icon:(0,U.jsx)(fe,{className:`size-4`,"aria-hidden":!0}),onClick:o},...n&&s?[{label:t(a.AUTOMATIONS$EDIT),icon:(0,U.jsx)(E,{className:`size-4`}),onClick:()=>s(e.id)}]:[],...n?[{label:e.enabled?t(a.AUTOMATIONS$TURN_OFF):t(a.AUTOMATIONS$TURN_ON),icon:(0,U.jsx)(z,{className:`size-4`}),onClick:()=>c(e.id,e.enabled)},{label:t(a.AUTOMATIONS$DELETE),icon:(0,U.jsx)(R,{className:`size-4`}),onClick:()=>l(e.id)}]:[]]}function he({automation:e,onToggle:t,onRunNow:n,isRunPending:r=!1,onDelete:i,onEdit:o}){let{navigate:c}=x(),{t:l}=s(`openhands`),u=L(`manage_automations`),d=e.trigger.schedule_human||e.trigger.type,p=(0,H.useMemo)(()=>G(e,d),[e,d]),m=()=>{c?.(`/automations/${e.id}`)},h=K({automation:e,t:l,canManage:u,onRunNow:n,isRunPending:r,onView:m,onEdit:o,onToggle:t,onDelete:i}),g=()=>{m()};return(0,U.jsxs)(`div`,{role:`link`,tabIndex:0,"data-testid":`automation-card-${e.id}`,onClick:g,onKeyDown:e=>{e.key===`Enter`&&g()},className:v(`flex min-w-0 flex-col gap-3 overflow-hidden p-4 text-left`,_,f),children:[(0,U.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-white`,children:e.name}),e.prompt?(0,U.jsx)(`p`,{className:`line-clamp-2 text-xs leading-relaxed text-tertiary-light`,children:e.prompt}):null]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[u?(0,U.jsxs)(`button`,{type:`button`,"data-testid":`automation-run-now-${e.id}`,"aria-busy":r,disabled:r||!e.enabled,onClick:t=>{t.stopPropagation(),n(e.id)},className:I,children:[(0,U.jsx)(W,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),l(a.AUTOMATIONS$RUN_NOW)]}):null,(0,U.jsx)(B,{items:h})]})]}),p.length>0?(0,U.jsx)(A,{pills:p,testId:`automation-pills-${e.id}`}):null]})}var ge=`overflow-hidden rounded-md border border-[var(--oh-border)] bg-base-secondary`,q=[`h-11`,`border-t border-[var(--oh-border)] transition-colors`].join(` `),_e=`hover:bg-interactive-hover-low outline-none focus:outline-none focus-visible:outline-none focus-visible:bg-interactive-hover-low`,J=`px-3 align-middle`,ve=[q,_e,`cursor-pointer`].join(` `),ye=`openhands-automations-view`;function be(){return typeof window>`u`?`grid`:window.localStorage.getItem(`openhands-automations-view`)===`list`?`list`:`grid`}function xe(e){window.localStorage.setItem(ye,e)}function Se({automation:e,onToggle:t,onRunNow:n,isRunPending:r=!1,onDelete:i,onEdit:o}){let{navigate:c}=x(),{t:l}=s(`openhands`),u=L(`manage_automations`),d=e.trigger.schedule_human||e.trigger.type,f=(0,H.useMemo)(()=>G(e,d),[e,d]),p=()=>{c?.(`/automations/${e.id}`)},m=K({automation:e,t:l,canManage:u,onRunNow:n,isRunPending:r,onView:p,onEdit:o,onToggle:t,onDelete:i}),h=()=>{p()};return(0,U.jsxs)(`tr`,{"data-testid":`automation-list-row-${e.id}`,onClick:h,onKeyDown:e=>{e.key===`Enter`&&h()},tabIndex:0,className:v(ve,`cursor-pointer`),children:[(0,U.jsx)(`td`,{className:J,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate text-sm font-medium text-white`,title:e.name,children:e.name}),f.length>0?(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(A,{pills:f,testId:`automation-pills-${e.id}`})}):null]})}),(0,U.jsx)(`td`,{className:v(`w-0 whitespace-nowrap`,J),children:(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[u?(0,U.jsx)(S,{content:l(a.AUTOMATIONS$RUN_NOW),placement:`top`,children:(0,U.jsx)(`button`,{type:`button`,"data-testid":`automation-run-now-${e.id}`,"aria-label":l(a.AUTOMATIONS$RUN_NOW),"aria-busy":r,disabled:r||!e.enabled,onClick:t=>{t.stopPropagation(),n(e.id)},className:F,children:(0,U.jsx)(W,{className:`size-4 shrink-0`,"aria-hidden":!0})})}):null,(0,U.jsx)(B,{items:m})]})})]})}function Y({title:e,count:t,automations:n,view:r,onToggle:i,onRunNow:a,runPendingId:o=null,onDelete:s,onEdit:c}){return n.length===0?null:(0,U.jsxs)(`section`,{children:[(0,U.jsxs)(`div`,{className:`flex items-center`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:e}),(0,U.jsx)(k,{count:t})]}),r===`grid`?(0,U.jsx)(`div`,{className:v(`mt-3`,m),children:(0,U.jsx)(`div`,{className:g,children:n.map(e=>(0,U.jsx)(he,{automation:e,onToggle:i,onRunNow:a,isRunPending:o===e.id,onDelete:s,onEdit:c},e.id))})}):(0,U.jsx)(`div`,{className:v(ge,`mt-3`),children:(0,U.jsx)(`table`,{className:`w-full min-w-full [&>tbody>tr:first-child]:border-t-0`,children:(0,U.jsx)(`tbody`,{children:n.map(e=>(0,U.jsx)(Se,{automation:e,onToggle:i,onRunNow:a,isRunPending:o===e.id,onDelete:s,onEdit:c},e.id))})})})]})}var Ce=e(r(),1),X=[{value:`grid`,icon:V,labelKey:a.AUTOMATIONS$VIEW_GRID,testId:`automations-view-toggle-grid`},{value:`list`,icon:pe,labelKey:a.AUTOMATIONS$VIEW_LIST,testId:`automations-view-toggle-list`}];function we({icon:e,label:t,isSelected:n}){return(0,U.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`flex shrink-0 items-center text-[var(--oh-muted)] transition-colors group-hover:text-[var(--oh-foreground)] group-focus-visible:text-[var(--oh-foreground)] [&_svg]:size-4 [&_svg]:text-current`,"aria-hidden":!0,children:(0,U.jsx)(e,{})}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),n?(0,U.jsx)(l,{className:`size-4 shrink-0`,"aria-hidden":!0}):null]})}function Te({view:e,onChange:t,disabled:n=!1}){let{t:r}=s(`openhands`),[i,o]=(0,H.useState)(!1),[c,l]=(0,H.useState)(),u=(0,H.useRef)(null),d=(0,H.useRef)(null),f=(X.find(t=>t.value===e)??X[0]).icon;(0,H.useLayoutEffect)(()=>{if(!i||!u.current)return;let e=()=>{let e=u.current?.getBoundingClientRect();e&&l({position:`fixed`,zIndex:9999,top:e.bottom+4,right:window.innerWidth-e.right})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[i]),(0,H.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;u.current?.contains(t)||d.current?.contains(t)||o(!1)},t=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let p=i&&c?(0,U.jsx)(w,{ref:d,theme:`popover`,className:`min-w-[10rem]`,children:X.map(n=>(0,U.jsx)(`li`,{children:(0,U.jsx)(T,{testId:n.testId,onClick:()=>{t(n.value),o(!1)},className:`group`,children:(0,U.jsx)(we,{icon:n.icon,label:r(n.labelKey),isSelected:e===n.value})})},n.value))}):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{ref:u,type:`button`,"data-testid":`automations-view-toggle`,"aria-label":r(a.AUTOMATIONS$VIEW_MODE),"aria-haspopup":`menu`,"aria-expanded":i,"aria-disabled":n,disabled:n,onClick:()=>{n||o(e=>!e)},className:v(`inline-flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-[var(--oh-border)] bg-base-secondary text-white transition-colors hover:bg-[var(--oh-interactive-hover)] focus-visible:border-white/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/20`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-base-secondary`),children:(0,U.jsx)(f,{className:`size-4`,"aria-hidden":!0})}),i&&c&&typeof document<`u`?Ce.createPortal((0,U.jsx)(`div`,{style:c,children:p}),document.body):null]})}function Z(){return(0,U.jsxs)(`div`,{"data-testid":`automation-card-skeleton`,className:`${_} border border-transparent p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,U.jsx)(`div`,{className:`h-5 w-40 animate-pulse rounded bg-surface-raised`}),(0,U.jsx)(`div`,{className:`h-5 w-10 animate-pulse rounded-full bg-surface-raised`})]}),(0,U.jsx)(`div`,{className:`mt-2 h-4 w-72 animate-pulse rounded bg-surface-raised`}),(0,U.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,U.jsx)(`div`,{className:`h-7 w-32 animate-pulse rounded-full bg-surface-raised`}),(0,U.jsx)(`div`,{className:`h-7 w-28 animate-pulse rounded-full bg-surface-raised`}),(0,U.jsx)(`div`,{className:`h-7 w-24 animate-pulse rounded-full bg-surface-raised`})]})]})}var Ee=e=>(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,U.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m19.5 8.25-7.5 7.5-7.5-7.5`})}),De=`https://docs.openhands.dev/openhands/usage/automations/overview`;function Oe({children:e}){return(0,U.jsx)(`span`,{className:`whitespace-nowrap`,children:e})}function ke({children:e}){return(0,U.jsx)(`code`,{"data-testid":`automations-create-instructions-example`,className:v(`mx-0.5 inline-block rounded-sm border border-[var(--oh-border-subtle)]`,`bg-[var(--oh-surface-raised)] px-1.5 py-0.5 align-baseline font-mono text-[11px] text-white`),children:e})}function Ae({children:e}){return(0,U.jsx)(U.Fragment,{children:e})}var je={example:(0,U.jsx)(Oe,{}),cmd:(0,U.jsx)(ke,{}),punct:(0,U.jsx)(Ae,{})};function Q({onLaunch:e}={}){let{t}=s(`openhands`),n=N();return(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-tertiary-light`,children:[(0,U.jsx)(o,{ns:`openhands`,i18nKey:a.AUTOMATIONS$EMPTY_OPTION_CONVERSATION_DESC,components:je}),` `,t(a.AUTOMATIONS$CREATE_INSTRUCTIONS_GUIDANCE)]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsx)(`a`,{href:De,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-muted underline transition-colors hover:text-foreground`,children:t(a.AUTOMATIONS$EMPTY_LEARN_MORE)}),(0,U.jsx)(b,{type:`button`,variant:`primary`,testId:`automations-create-automation`,onClick:()=>{n(t(a.AUTOMATIONS$CREATE_AUTOMATION_PROMPT),e)},startContent:(0,U.jsx)(M,{className:`size-4`,"aria-hidden":!0}),children:t(a.AUTOMATIONS$CREATE_AUTOMATION_BUTTON)})]})]})}function Me({collapsible:e=!1}){let{t}=s(`openhands`),[n,r]=(0,H.useState)(!e);return e?(0,U.jsxs)(`div`,{className:`w-full rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`flex w-full items-center justify-between rounded-lg p-4 text-left transition-colors hover:bg-surface-raised`,children:[(0,U.jsx)(`span`,{className:`text-sm font-normal text-content`,children:t(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}),(0,U.jsx)(Ee,{className:v(`size-5 text-muted transition-transform`,n&&`rotate-180`)})]}),n?(0,U.jsx)(`div`,{className:`px-4 pb-4`,children:(0,U.jsx)(Q,{})}):null]}):(0,U.jsxs)(`div`,{className:`w-full max-w-2xl`,children:[(0,U.jsx)(`h3`,{className:`text-center text-sm font-medium text-content`,children:t(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}),(0,U.jsx)(`div`,{className:`mt-4`,children:(0,U.jsx)(Q,{})})]})}function Ne(){let{t:e}=s(`openhands`);return(0,U.jsxs)(`div`,{"data-testid":`automations-empty`,className:p,children:[(0,U.jsx)(`p`,{className:`text-sm text-white`,children:e(a.AUTOMATIONS$EMPTY)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-tertiary-light`,children:e(a.AUTOMATIONS$EMPTY_HINT)}),(0,U.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,U.jsx)(Me,{})})]})}function Pe({isOpen:e,onClose:t}){let{t:n}=s(`openhands`);return e?(0,U.jsx)(y,{onClose:t,"aria-label":n(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE),children:(0,U.jsxs)(`div`,{"data-testid":`add-automation-modal`,className:`relative flex w-full max-w-lg flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,U.jsx)(C,{onClose:t,testId:`add-automation-modal-close`}),(0,U.jsx)(`header`,{className:`flex-shrink-0 px-6 pb-4 pt-6`,children:(0,U.jsx)(`h2`,{id:`add-automation-modal-title`,className:`pr-6 text-lg font-semibold`,children:n(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)})}),(0,U.jsx)(`div`,{className:`px-6 pb-6`,children:(0,U.jsx)(Q,{onLaunch:t})})]})}):null}var $=50,Fe=n(function(){let{t:e}=s(`openhands`),[t,n]=(0,H.useState)(``),[r,i]=(0,H.useState)(()=>be()),[o,c]=(0,H.useState)($),[l,f]=(0,H.useState)(null),[p,m]=(0,H.useState)(null),[h,g]=(0,H.useState)(!1),_=ee().backend.kind===`local`,{data:v,isLoading:y,refetch:x}=le(),S=v?.status===`ok`,{data:C,isLoading:w,isError:T,refetch:E}=se({limit:o,offset:0,enabled:S}),D=re(),O=ae(),k=ie(),A=(0,H.useMemo)(()=>{if(!C?.automations)return[];let e=t.toLowerCase();return e?C.automations.filter(t=>t.name.toLowerCase().includes(e)||(t.prompt??``).toLowerCase().includes(e)||t.repository?.toLowerCase().includes(e)||t.model?.toLowerCase().includes(e)):C.automations},[C?.automations,t]),j=(0,H.useMemo)(()=>A.filter(e=>e.enabled),[A]),M=(0,H.useMemo)(()=>A.filter(e=>!e.enabled),[A]),N=(e,t)=>{D.mutate({id:e,enabled:!t})},P=t=>{k.mutate(t,{onSuccess:()=>{d(e(a.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{u(te(t)?t.response?.data?.message||t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR):t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR))}})},F=e=>{let t=C?.automations.find(t=>t.id===e);t&&f({id:e,name:t.name})},I=e=>{let t=C?.automations.find(t=>t.id===e);t&&m(t)},L=()=>{l&&(O.mutate(l.id),f(null))},R=(0,H.useCallback)(e=>{i(e),xe(e)},[]),z=C?C.total>C.automations.length:!1,B=!w&&!T&&C?.automations.length===0;return y?(0,U.jsx)(`div`,{className:`min-h-full`,children:(0,U.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)}),(0,U.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,U.jsx)(Z,{},`skeleton-${String(t)}`))})]})}):S?(0,U.jsx)(`div`,{className:`min-h-full`,children:(0,U.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-semibold text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)})]}),(0,U.jsx)(b,{type:`button`,variant:`secondary`,testId:`automations-add-automation`,className:`shrink-0 whitespace-nowrap`,onClick:()=>g(!0),children:e(a.AUTOMATIONS$ADD_AUTOMATION)})]}),(0,U.jsxs)(`div`,{className:`mt-6 flex items-stretch gap-2`,children:[(0,U.jsx)(me,{value:t,onChange:n}),(0,U.jsx)(Te,{view:r,onChange:R,disabled:B})]}),(0,U.jsxs)(`div`,{className:`mt-6 flex flex-col gap-6`,children:[w&&(0,U.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,U.jsx)(Z,{},`skeleton-${String(t)}`))}),T&&!w&&(0,U.jsx)(oe,{onRetry:E}),B&&(0,U.jsx)(Ne,{}),!w&&!T&&C&&C.automations.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{title:e(a.AUTOMATIONS$ACTIVE),count:j.length,automations:j,view:r,onToggle:N,onRunNow:P,runPendingId:k.isPending?k.variables??null:null,onDelete:F,onEdit:_?I:void 0}),(0,U.jsx)(Y,{title:e(a.AUTOMATIONS$INACTIVE),count:M.length,automations:M,view:r,onToggle:N,onRunNow:P,runPendingId:k.isPending?k.variables??null:null,onDelete:F,onEdit:_?I:void 0}),z&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>c(e=>e+$),className:`self-center rounded-lg border border-[var(--oh-border)] px-6 py-2 text-sm text-white hover:bg-surface-raised`,children:e(a.AUTOMATIONS$LOAD_MORE)})]})]}),(0,U.jsx)(`div`,{className:`mt-6`,children:(0,U.jsx)(ne,{query:t})}),(0,U.jsx)(ce,{automationName:l?.name??``,isOpen:l!==null,onConfirm:L,onCancel:()=>f(null)}),p&&(0,U.jsx)(de,{automation:p,isOpen:p!==null,onClose:()=>m(null)}),(0,U.jsx)(Pe,{isOpen:h,onClose:()=>g(!1)})]})}):(0,U.jsx)(`div`,{className:`min-h-full`,children:(0,U.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)}),(0,U.jsx)(ue,{onRetry:x})]})})});export{Fe as default};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{t as r}from"./react-dom-hVBnwgwZ.js";import{o as i,t as a}from"./declaration-BNMqORFE.js";import{t as o}from"./Trans-Cvm_-SMi.js";import{t as s}from"./useTranslation-DCOdSSMl.js";import{t as c}from"./createLucideIcon-Ddu8jDOQ.js";import{t as l}from"./check-CYxAHs85.js";import{n as u,r as d}from"./custom-toast-handlers-C-SZFmto.js";import{a as f,c as p,i as m,o as h,r as g,s as _}from"./circle-plus-check-toggle-P7ZZToV4.js";import{t as v}from"./utils-i18rdUj2.js";import{n as ee}from"./active-backend-context-cCM1vYYZ.js";import{t as y}from"./modal-backdrop-BAbgYsqB.js";import{t as b}from"./brand-button-Br7f0kZJ.js";import{n as x}from"./navigation-context-D0YWpT8d.js";import{t as S}from"./styled-tooltip-CBzrri6o.js";import{n as te}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~ninslayh-D9P8e98a.js";import{t as C}from"./modal-close-button-t1Gh3qmL.js";import{n as w,t as T}from"./context-menu-list-item-CWNFpuiC.js";import{t as E}from"./u-edit-CFvXHqZk.js";import{t as D}from"./folder-ZZJVGgd7.js";import{t as O}from"./search-27Owlc3A.js";import{n as k,t as ne}from"./recommended-automations-launcher-BQChv2rc.js";import{n as A}from"./skill-card-pill-row-DF1axQCG.js";import{t as j}from"./clock-BRjCgHTc.js";import{n as M,t as N}from"./use-launch-skill-in-chat-fNN_xGZG.js";import{_ as re,c as P,d as F,f as I,g as ie,h as ae,i as oe,l as L,m as se,n as ce,o as R,p as le,r as ue,s as z,t as de,u as B}from"./edit-automation-modal-BGzR3nfZ.js";var fe=c(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),V=c(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),pe=c(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),H=e(t()),U=i();function me({value:e,onChange:t,className:n}){let{t:r}=s(`openhands`);return(0,U.jsxs)(`div`,{className:v(`relative flex min-w-0 flex-1 items-center`,`h-9 rounded-lg border border-[var(--oh-border)] bg-base-secondary`,`focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20`,`transition-colors`,n),children:[(0,U.jsx)(O,{className:`ml-3 size-4 shrink-0 text-tertiary-alt`,"aria-hidden":!0}),(0,U.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:r(a.AUTOMATIONS$SEARCH_PLACEHOLDER),"aria-label":r(a.AUTOMATIONS$SEARCH_PLACEHOLDER),className:`min-w-0 flex-1 border-0 bg-transparent px-3 text-sm text-white outline-none placeholder:text-tertiary-alt`})]})}var W=e=>(0,U.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,U.jsx)(`g`,{clipPath:`url(#clip0_8467_30872)`,children:(0,U.jsx)(`path`,{d:`M6.26693 21.4874L6.25583 21.4951L6.24514 21.5033C5.95991 21.7227 5.5 21.5308 5.5 21.0996V2.89961C5.5 2.4684 5.95991 2.2765 6.24514 2.49592L6.25634 2.50452L6.26799 2.51249L19.518 11.5625L19.518 11.5625L19.5226 11.5656C19.8258 11.7677 19.8258 12.1815 19.5226 12.3836L19.5226 12.3835L19.5169 12.3874L6.26693 21.4874Z`,fill:`currentColor`,stroke:`currentColor`})}),(0,U.jsx)(`defs`,{children:(0,U.jsx)(`clipPath`,{id:`clip0_8467_30872`,children:(0,U.jsx)(`rect`,{width:24,height:24,fill:`white`})})})]});function G(e,t){let n=[];return e.repository&&n.push({id:`repository`,node:(0,U.jsxs)(`span`,{className:v(h,`gap-1`),children:[(0,U.jsx)(D,{className:`size-3 shrink-0`}),e.repository]})}),n.push({id:`schedule`,node:(0,U.jsxs)(`span`,{className:v(h,`gap-1`),children:[(0,U.jsx)(j,{className:`size-3 shrink-0`}),t]})}),e.model&&n.push({id:`model`,node:(0,U.jsxs)(`span`,{className:v(h,`gap-1`),children:[(0,U.jsx)(P,{className:`size-3 shrink-0`}),e.model]})}),n}function K({automation:e,t,canManage:n,onRunNow:r,isRunPending:i,onView:o,onEdit:s,onToggle:c,onDelete:l}){return[...n?[{label:t(a.AUTOMATIONS$RUN_NOW),icon:(0,U.jsx)(W,{className:`size-4`}),onClick:()=>r(e.id),disabled:i||!e.enabled}]:[],{label:t(a.COMMON$VIEW),icon:(0,U.jsx)(fe,{className:`size-4`,"aria-hidden":!0}),onClick:o},...n&&s?[{label:t(a.AUTOMATIONS$EDIT),icon:(0,U.jsx)(E,{className:`size-4`}),onClick:()=>s(e.id)}]:[],...n?[{label:e.enabled?t(a.AUTOMATIONS$TURN_OFF):t(a.AUTOMATIONS$TURN_ON),icon:(0,U.jsx)(z,{className:`size-4`}),onClick:()=>c(e.id,e.enabled)},{label:t(a.AUTOMATIONS$DELETE),icon:(0,U.jsx)(R,{className:`size-4`}),onClick:()=>l(e.id)}]:[]]}function he({automation:e,onToggle:t,onRunNow:n,isRunPending:r=!1,onDelete:i,onEdit:o}){let{navigate:c}=x(),{t:l}=s(`openhands`),u=L(`manage_automations`),d=e.trigger.schedule_human||e.trigger.type,p=(0,H.useMemo)(()=>G(e,d),[e,d]),m=()=>{c?.(`/automations/${e.id}`)},h=K({automation:e,t:l,canManage:u,onRunNow:n,isRunPending:r,onView:m,onEdit:o,onToggle:t,onDelete:i}),g=()=>{m()};return(0,U.jsxs)(`div`,{role:`link`,tabIndex:0,"data-testid":`automation-card-${e.id}`,onClick:g,onKeyDown:e=>{e.key===`Enter`&&g()},className:v(`flex min-w-0 flex-col gap-3 overflow-hidden p-4 text-left`,_,f),children:[(0,U.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-white`,children:e.name}),e.prompt?(0,U.jsx)(`p`,{className:`line-clamp-2 text-xs leading-relaxed text-tertiary-light`,children:e.prompt}):null]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[u?(0,U.jsxs)(`button`,{type:`button`,"data-testid":`automation-run-now-${e.id}`,"aria-busy":r,disabled:r||!e.enabled,onClick:t=>{t.stopPropagation(),n(e.id)},className:I,children:[(0,U.jsx)(W,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),l(a.AUTOMATIONS$RUN_NOW)]}):null,(0,U.jsx)(B,{items:h})]})]}),p.length>0?(0,U.jsx)(A,{pills:p,testId:`automation-pills-${e.id}`}):null]})}var ge=`overflow-hidden rounded-md border border-[var(--oh-border)] bg-base-secondary`,q=[`h-11`,`border-t border-[var(--oh-border)] transition-colors`].join(` `),_e=`hover:bg-interactive-hover-low outline-none focus:outline-none focus-visible:outline-none focus-visible:bg-interactive-hover-low`,J=`px-3 align-middle`,ve=[q,_e,`cursor-pointer`].join(` `),ye=`openhands-automations-view`;function be(){return typeof window>`u`?`grid`:window.localStorage.getItem(`openhands-automations-view`)===`list`?`list`:`grid`}function xe(e){window.localStorage.setItem(ye,e)}function Se({automation:e,onToggle:t,onRunNow:n,isRunPending:r=!1,onDelete:i,onEdit:o}){let{navigate:c}=x(),{t:l}=s(`openhands`),u=L(`manage_automations`),d=e.trigger.schedule_human||e.trigger.type,f=(0,H.useMemo)(()=>G(e,d),[e,d]),p=()=>{c?.(`/automations/${e.id}`)},m=K({automation:e,t:l,canManage:u,onRunNow:n,isRunPending:r,onView:p,onEdit:o,onToggle:t,onDelete:i}),h=()=>{p()};return(0,U.jsxs)(`tr`,{"data-testid":`automation-list-row-${e.id}`,onClick:h,onKeyDown:e=>{e.key===`Enter`&&h()},tabIndex:0,className:v(ve,`cursor-pointer`),children:[(0,U.jsx)(`td`,{className:J,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate text-sm font-medium text-white`,title:e.name,children:e.name}),f.length>0?(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(A,{pills:f,testId:`automation-pills-${e.id}`})}):null]})}),(0,U.jsx)(`td`,{className:v(`w-0 whitespace-nowrap`,J),children:(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[u?(0,U.jsx)(S,{content:l(a.AUTOMATIONS$RUN_NOW),placement:`top`,children:(0,U.jsx)(`button`,{type:`button`,"data-testid":`automation-run-now-${e.id}`,"aria-label":l(a.AUTOMATIONS$RUN_NOW),"aria-busy":r,disabled:r||!e.enabled,onClick:t=>{t.stopPropagation(),n(e.id)},className:F,children:(0,U.jsx)(W,{className:`size-4 shrink-0`,"aria-hidden":!0})})}):null,(0,U.jsx)(B,{items:m})]})})]})}function Y({title:e,count:t,automations:n,view:r,onToggle:i,onRunNow:a,runPendingId:o=null,onDelete:s,onEdit:c}){return n.length===0?null:(0,U.jsxs)(`section`,{children:[(0,U.jsxs)(`div`,{className:`flex items-center`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:e}),(0,U.jsx)(k,{count:t})]}),r===`grid`?(0,U.jsx)(`div`,{className:v(`mt-3`,m),children:(0,U.jsx)(`div`,{className:g,children:n.map(e=>(0,U.jsx)(he,{automation:e,onToggle:i,onRunNow:a,isRunPending:o===e.id,onDelete:s,onEdit:c},e.id))})}):(0,U.jsx)(`div`,{className:v(ge,`mt-3`),children:(0,U.jsx)(`table`,{className:`w-full min-w-full [&>tbody>tr:first-child]:border-t-0`,children:(0,U.jsx)(`tbody`,{children:n.map(e=>(0,U.jsx)(Se,{automation:e,onToggle:i,onRunNow:a,isRunPending:o===e.id,onDelete:s,onEdit:c},e.id))})})})]})}var Ce=e(r(),1),X=[{value:`grid`,icon:V,labelKey:a.AUTOMATIONS$VIEW_GRID,testId:`automations-view-toggle-grid`},{value:`list`,icon:pe,labelKey:a.AUTOMATIONS$VIEW_LIST,testId:`automations-view-toggle-list`}];function we({icon:e,label:t,isSelected:n}){return(0,U.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`flex shrink-0 items-center text-[var(--oh-muted)] transition-colors group-hover:text-[var(--oh-foreground)] group-focus-visible:text-[var(--oh-foreground)] [&_svg]:size-4 [&_svg]:text-current`,"aria-hidden":!0,children:(0,U.jsx)(e,{})}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),n?(0,U.jsx)(l,{className:`size-4 shrink-0`,"aria-hidden":!0}):null]})}function Te({view:e,onChange:t,disabled:n=!1}){let{t:r}=s(`openhands`),[i,o]=(0,H.useState)(!1),[c,l]=(0,H.useState)(),u=(0,H.useRef)(null),d=(0,H.useRef)(null),f=(X.find(t=>t.value===e)??X[0]).icon;(0,H.useLayoutEffect)(()=>{if(!i||!u.current)return;let e=()=>{let e=u.current?.getBoundingClientRect();e&&l({position:`fixed`,zIndex:9999,top:e.bottom+4,right:window.innerWidth-e.right})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[i]),(0,H.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;u.current?.contains(t)||d.current?.contains(t)||o(!1)},t=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let p=i&&c?(0,U.jsx)(w,{ref:d,theme:`popover`,className:`min-w-[10rem]`,children:X.map(n=>(0,U.jsx)(`li`,{children:(0,U.jsx)(T,{testId:n.testId,onClick:()=>{t(n.value),o(!1)},className:`group`,children:(0,U.jsx)(we,{icon:n.icon,label:r(n.labelKey),isSelected:e===n.value})})},n.value))}):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{ref:u,type:`button`,"data-testid":`automations-view-toggle`,"aria-label":r(a.AUTOMATIONS$VIEW_MODE),"aria-haspopup":`menu`,"aria-expanded":i,"aria-disabled":n,disabled:n,onClick:()=>{n||o(e=>!e)},className:v(`inline-flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-[var(--oh-border)] bg-base-secondary text-white transition-colors hover:bg-[var(--oh-interactive-hover)] focus-visible:border-white/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/20`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-base-secondary`),children:(0,U.jsx)(f,{className:`size-4`,"aria-hidden":!0})}),i&&c&&typeof document<`u`?Ce.createPortal((0,U.jsx)(`div`,{style:c,children:p}),document.body):null]})}function Z(){return(0,U.jsxs)(`div`,{"data-testid":`automation-card-skeleton`,className:`${_} border border-transparent p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,U.jsx)(`div`,{className:`h-5 w-40 animate-pulse rounded bg-surface-raised`}),(0,U.jsx)(`div`,{className:`h-5 w-10 animate-pulse rounded-full bg-surface-raised`})]}),(0,U.jsx)(`div`,{className:`mt-2 h-4 w-72 animate-pulse rounded bg-surface-raised`}),(0,U.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,U.jsx)(`div`,{className:`h-7 w-32 animate-pulse rounded-full bg-surface-raised`}),(0,U.jsx)(`div`,{className:`h-7 w-28 animate-pulse rounded-full bg-surface-raised`}),(0,U.jsx)(`div`,{className:`h-7 w-24 animate-pulse rounded-full bg-surface-raised`})]})]})}var Ee=e=>(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,U.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m19.5 8.25-7.5 7.5-7.5-7.5`})}),De=`https://docs.openhands.dev/openhands/usage/automations/overview`;function Oe({children:e}){return(0,U.jsx)(`span`,{className:`whitespace-nowrap`,children:e})}function ke({children:e}){return(0,U.jsx)(`code`,{"data-testid":`automations-create-instructions-example`,className:v(`mx-0.5 inline-block rounded-sm border border-[var(--oh-border-subtle)]`,`bg-[var(--oh-surface-raised)] px-1.5 py-0.5 align-baseline font-mono text-[11px] text-white`),children:e})}function Ae({children:e}){return(0,U.jsx)(U.Fragment,{children:e})}var je={example:(0,U.jsx)(Oe,{}),cmd:(0,U.jsx)(ke,{}),punct:(0,U.jsx)(Ae,{})};function Q({onLaunch:e}={}){let{t}=s(`openhands`),n=N();return(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-tertiary-light`,children:[(0,U.jsx)(o,{ns:`openhands`,i18nKey:a.AUTOMATIONS$EMPTY_OPTION_CONVERSATION_DESC,components:je}),` `,t(a.AUTOMATIONS$CREATE_INSTRUCTIONS_GUIDANCE)]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsx)(`a`,{href:De,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-muted underline transition-colors hover:text-foreground`,children:t(a.AUTOMATIONS$EMPTY_LEARN_MORE)}),(0,U.jsx)(b,{type:`button`,variant:`primary`,testId:`automations-create-automation`,onClick:()=>{n(t(a.AUTOMATIONS$CREATE_AUTOMATION_PROMPT),e)},startContent:(0,U.jsx)(M,{className:`size-4`,"aria-hidden":!0}),children:t(a.AUTOMATIONS$CREATE_AUTOMATION_BUTTON)})]})]})}function Me({collapsible:e=!1}){let{t}=s(`openhands`),[n,r]=(0,H.useState)(!e);return e?(0,U.jsxs)(`div`,{className:`w-full rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`flex w-full items-center justify-between rounded-lg p-4 text-left transition-colors hover:bg-surface-raised`,children:[(0,U.jsx)(`span`,{className:`text-sm font-normal text-content`,children:t(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}),(0,U.jsx)(Ee,{className:v(`size-5 text-muted transition-transform`,n&&`rotate-180`)})]}),n?(0,U.jsx)(`div`,{className:`px-4 pb-4`,children:(0,U.jsx)(Q,{})}):null]}):(0,U.jsxs)(`div`,{className:`w-full max-w-2xl`,children:[(0,U.jsx)(`h3`,{className:`text-center text-sm font-medium text-content`,children:t(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}),(0,U.jsx)(`div`,{className:`mt-4`,children:(0,U.jsx)(Q,{})})]})}function Ne(){let{t:e}=s(`openhands`);return(0,U.jsxs)(`div`,{"data-testid":`automations-empty`,className:p,children:[(0,U.jsx)(`p`,{className:`text-sm text-white`,children:e(a.AUTOMATIONS$EMPTY)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-tertiary-light`,children:e(a.AUTOMATIONS$EMPTY_HINT)}),(0,U.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,U.jsx)(Me,{})})]})}function Pe({isOpen:e,onClose:t}){let{t:n}=s(`openhands`);return e?(0,U.jsx)(y,{onClose:t,"aria-label":n(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE),children:(0,U.jsxs)(`div`,{"data-testid":`add-automation-modal`,className:`relative flex w-full max-w-lg flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,U.jsx)(C,{onClose:t,testId:`add-automation-modal-close`}),(0,U.jsx)(`header`,{className:`flex-shrink-0 px-6 pb-4 pt-6`,children:(0,U.jsx)(`h2`,{id:`add-automation-modal-title`,className:`pr-6 text-lg font-semibold`,children:n(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)})}),(0,U.jsx)(`div`,{className:`px-6 pb-6`,children:(0,U.jsx)(Q,{onLaunch:t})})]})}):null}var $=50,Fe=n(function(){let{t:e}=s(`openhands`),[t,n]=(0,H.useState)(``),[r,i]=(0,H.useState)(()=>be()),[o,c]=(0,H.useState)($),[l,f]=(0,H.useState)(null),[p,m]=(0,H.useState)(null),[h,g]=(0,H.useState)(!1),_=ee().backend.kind===`local`,{data:v,isLoading:y,refetch:x}=le(),S=v?.status===`ok`,{data:C,isLoading:w,isError:T,refetch:E}=se({limit:o,offset:0,enabled:S}),D=re(),O=ae(),k=ie(),A=(0,H.useMemo)(()=>{if(!C?.automations)return[];let e=t.toLowerCase();return e?C.automations.filter(t=>t.name.toLowerCase().includes(e)||(t.prompt??``).toLowerCase().includes(e)||t.repository?.toLowerCase().includes(e)||t.model?.toLowerCase().includes(e)):C.automations},[C?.automations,t]),j=(0,H.useMemo)(()=>A.filter(e=>e.enabled),[A]),M=(0,H.useMemo)(()=>A.filter(e=>!e.enabled),[A]),N=(e,t)=>{D.mutate({id:e,enabled:!t})},P=t=>{k.mutate(t,{onSuccess:()=>{d(e(a.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{u(te(t)?t.response?.data?.message||t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR):t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR))}})},F=e=>{let t=C?.automations.find(t=>t.id===e);t&&f({id:e,name:t.name})},I=e=>{let t=C?.automations.find(t=>t.id===e);t&&m(t)},L=()=>{l&&(O.mutate(l.id),f(null))},R=(0,H.useCallback)(e=>{i(e),xe(e)},[]),z=C?C.total>C.automations.length:!1,B=!w&&!T&&C?.automations.length===0;return y?(0,U.jsx)(`div`,{className:`min-h-full`,children:(0,U.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)}),(0,U.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,U.jsx)(Z,{},`skeleton-${String(t)}`))})]})}):S?(0,U.jsx)(`div`,{className:`min-h-full`,children:(0,U.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-semibold text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)})]}),(0,U.jsx)(b,{type:`button`,variant:`secondary`,testId:`automations-add-automation`,className:`shrink-0 whitespace-nowrap`,onClick:()=>g(!0),children:e(a.AUTOMATIONS$ADD_AUTOMATION)})]}),(0,U.jsxs)(`div`,{className:`mt-6 flex items-stretch gap-2`,children:[(0,U.jsx)(me,{value:t,onChange:n}),(0,U.jsx)(Te,{view:r,onChange:R,disabled:B})]}),(0,U.jsxs)(`div`,{className:`mt-6 flex flex-col gap-6`,children:[w&&(0,U.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,U.jsx)(Z,{},`skeleton-${String(t)}`))}),T&&!w&&(0,U.jsx)(oe,{onRetry:E}),B&&(0,U.jsx)(Ne,{}),!w&&!T&&C&&C.automations.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{title:e(a.AUTOMATIONS$ACTIVE),count:j.length,automations:j,view:r,onToggle:N,onRunNow:P,runPendingId:k.isPending?k.variables??null:null,onDelete:F,onEdit:_?I:void 0}),(0,U.jsx)(Y,{title:e(a.AUTOMATIONS$INACTIVE),count:M.length,automations:M,view:r,onToggle:N,onRunNow:P,runPendingId:k.isPending?k.variables??null:null,onDelete:F,onEdit:_?I:void 0}),z&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>c(e=>e+$),className:`self-center rounded-lg border border-[var(--oh-border)] px-6 py-2 text-sm text-white hover:bg-surface-raised`,children:e(a.AUTOMATIONS$LOAD_MORE)})]})]}),(0,U.jsx)(`div`,{className:`mt-6`,children:(0,U.jsx)(ne,{query:t})}),(0,U.jsx)(ce,{automationName:l?.name??``,isOpen:l!==null,onConfirm:L,onCancel:()=>f(null)}),p&&(0,U.jsx)(de,{automation:p,isOpen:p!==null,onClose:()=>m(null)}),(0,U.jsx)(Pe,{isOpen:h,onClose:()=>g(!1)})]})}):(0,U.jsx)(`div`,{className:`min-h-full`,children:(0,U.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)}),(0,U.jsx)(ue,{onRetry:x})]})})});export{Fe as default};
|