@openhands/agent-canvas 1.0.0-alpha.8 → 1.0.0-alpha.9
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 +17 -6
- package/build/assets/{add-backend-modal-KMmPQNZU.js → add-backend-modal-FsnpTTgO.js} +1 -1
- package/build/assets/{agent-server-conversation-service.api-DSl9G5UR.js → agent-server-conversation-service.api-BZmUqtiO.js} +1 -1
- package/build/assets/{automation-detail-g5-RZ0da.js → automation-detail-R-99FUce.js} +1 -1
- package/build/assets/{automations-list-DHoq_0MM.js → automations-list-Dfu2c-_D.js} +1 -1
- package/build/assets/backend-form-modal-DxYjqqAK.js +1 -0
- package/build/assets/browser-HrYc5Gce.js +5 -0
- package/build/assets/conversation--ldUK72N.js +19 -0
- package/build/assets/conversation-eNrhH94O.js +1 -0
- package/build/assets/conversation-panel-B49Jpqpb.js +1 -0
- package/build/assets/{conversation-service.api-C8pYCyV6.js → conversation-service.api--f8WglOC.js} +1 -1
- package/build/assets/conversation-websocket-context-BW68-J8o.js +3 -0
- package/build/assets/{entry.client-D9uR9Blz.js → entry.client-CqqXOSvd.js} +2 -2
- package/build/assets/{files-tab-B3A1NDlZ.js → files-tab-CQHdWpQt.js} +1 -1
- package/build/assets/git-control-bar-branch-button-C8u5rzjc.js +27 -0
- package/build/assets/{git-provider-icon-DYE9n7fs.js → git-provider-icon-D-a-rcLm.js} +1 -1
- package/build/assets/{home-dIzxi5Dd.js → home-DD0GroCu.js} +1 -1
- package/build/assets/{launch-hZ0ifhcV.js → launch-B2mbfOSm.js} +1 -1
- package/build/assets/llm-settings-BEyqixPI.js +1 -0
- package/build/assets/{llm-settings-CcHqGOYL.js → llm-settings-BdiaGFbg.js} +1 -1
- package/build/assets/{manage-backends-modal-rYeyGx7j.js → manage-backends-modal-s22zCdEW.js} +1 -1
- package/build/assets/{manifest-97e839da.js → manifest-9d1c34fb.js} +1 -1
- package/build/assets/{messages-T2ewVkbp.js → messages-6aOyUu3r.js} +1 -1
- package/build/assets/{path-utils-CqJboYxo.js → path-utils-BVbe598W.js} +1 -1
- package/build/assets/{planner-tab-BrntFmb1.js → planner-tab-bN6r1G-1.js} +1 -1
- package/build/assets/{recommended-automations-launcher-BI9NhG8Y.js → recommended-automations-launcher-mJhK6Atl.js} +1 -1
- package/build/assets/{root-BS1Td78t.js → root-3t9rxEpE.js} +2 -2
- package/build/assets/{root-layout-BLjAEgle.js → root-layout-BjVwHmta.js} +2 -2
- package/build/assets/{shared-conversation-a0QV8o99.js → shared-conversation-EZV0FRIf.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-DTUNI1WQ.js → sidebar-mobile-menu-toggle-BnbzzpQl.js} +1 -1
- package/build/assets/{skills-settings-DOnMn9q1.js → skills-settings-CG2hu34D.js} +1 -1
- package/build/assets/{task-list-tab-Day9nhRT.js → task-list-tab-465DDju0.js} +1 -1
- package/build/assets/{terminal-ro4SNjUU.js → terminal-CcgBEVnC.js} +1 -1
- package/build/assets/{use-active-conversation-D15D9GgR.js → use-active-conversation-DS5j9R4q.js} +1 -1
- package/build/assets/{use-agent-state-DE5dlEXJ.js → use-agent-state-D2C9SeGw.js} +1 -1
- package/build/assets/{use-create-conversation-DW7AGgLA.js → use-create-conversation-BEZg__Vv.js} +1 -1
- package/build/assets/{use-event-store-CQZCcVz-.js → use-event-store-BT_gV3ut.js} +1 -1
- package/build/assets/{use-handle-plan-click-DpgEQDAV.js → use-handle-plan-click-uOpew2LO.js} +1 -1
- package/build/assets/{use-runtime-is-ready-XFbT16BD.js → use-runtime-is-ready-pGSbPddC.js} +1 -1
- package/build/assets/{use-skills-Xe0vjPMt.js → use-skills-BIvlWblA.js} +1 -1
- package/build/assets/{use-task-list-Bs90uF2N.js → use-task-list-DDeNHprj.js} +1 -1
- package/build/assets/{use-unified-vscode-url-BOsIOd-b.js → use-unified-vscode-url-wAMzv8Sn.js} +1 -1
- package/build/assets/{use-user-conversation-Mc0mQgkl.js → use-user-conversation-B_zDoSeh.js} +1 -1
- package/build/assets/{vscode-tab-C0ShhiSU.js → vscode-tab-B0vdh9gU.js} +1 -1
- package/build/index.html +4 -4
- 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 -0
- package/dist/api/agent-server-adapter.js.map +1 -1
- package/dist/api/skills-service.cjs +1 -1
- package/dist/api/skills-service.cjs.map +1 -1
- package/dist/api/skills-service.d.ts +1 -1
- package/dist/api/skills-service.js +2 -2
- package/dist/api/skills-service.js.map +1 -1
- package/dist/components/features/backends/backend-form-modal.cjs +1 -1
- package/dist/components/features/backends/backend-form-modal.cjs.map +1 -1
- package/dist/components/features/backends/backend-form-modal.js +149 -142
- package/dist/components/features/backends/backend-form-modal.js.map +1 -1
- package/dist/components/features/conversation-panel/skills-modal.cjs +1 -1
- package/dist/components/features/conversation-panel/skills-modal.cjs.map +1 -1
- package/dist/components/features/conversation-panel/skills-modal.js +1 -1
- package/dist/components/features/conversation-panel/skills-modal.js.map +1 -1
- package/dist/contexts/conversation-websocket-context.cjs +3 -3
- package/dist/contexts/conversation-websocket-context.cjs.map +1 -1
- package/dist/contexts/conversation-websocket-context.js +97 -89
- package/dist/contexts/conversation-websocket-context.js.map +1 -1
- package/dist/hooks/chat/use-slash-command.cjs +1 -1
- package/dist/hooks/chat/use-slash-command.cjs.map +1 -1
- package/dist/hooks/chat/use-slash-command.js +1 -1
- package/dist/hooks/chat/use-slash-command.js.map +1 -1
- package/dist/hooks/query/use-conversation-skills.cjs +2 -0
- package/dist/hooks/query/use-conversation-skills.cjs.map +1 -0
- package/dist/hooks/query/use-conversation-skills.d.ts +7 -0
- package/dist/hooks/query/use-conversation-skills.js +8 -0
- package/dist/hooks/query/use-conversation-skills.js.map +1 -0
- package/dist/hooks/query/use-skills.cjs +1 -1
- package/dist/hooks/query/use-skills.cjs.map +1 -1
- package/dist/hooks/query/use-skills.d.ts +6 -1
- package/dist/hooks/query/use-skills.js +3 -3
- package/dist/hooks/query/use-skills.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +3 -3
- package/dist/package.js.map +1 -1
- package/dist/routes/conversation.cjs +1 -1
- package/dist/routes/conversation.cjs.map +1 -1
- package/dist/routes/conversation.js +61 -63
- package/dist/routes/conversation.js.map +1 -1
- package/dist/stores/use-event-store.cjs +1 -1
- package/dist/stores/use-event-store.cjs.map +1 -1
- package/dist/stores/use-event-store.d.ts +22 -0
- package/dist/stores/use-event-store.js +9 -1
- package/dist/stores/use-event-store.js.map +1 -1
- package/dist/ui/context-menu.d.ts +1 -1
- package/dist/ui/help-link.d.ts +1 -1
- package/package.json +3 -3
- package/scripts/dev-safe.mjs +35 -17
- package/scripts/dev-with-automation.mjs +24 -49
- package/build/assets/backend-form-modal-K6IMCr3p.js +0 -1
- package/build/assets/browser-DKG63inJ.js +0 -5
- package/build/assets/conversation-BD5WemJI.js +0 -19
- package/build/assets/conversation-C47K62n8.js +0 -1
- package/build/assets/conversation-panel-Dn-S56Gk.js +0 -1
- package/build/assets/conversation-websocket-context-Ywrxd_9p.js +0 -3
- package/build/assets/git-control-bar-branch-button-CcIpmyfM.js +0 -27
- package/build/assets/llm-settings-2036m7Wt.js +0 -1
- /package/build/assets/{link-external-Df8J52xI.js → link-external-C9d6Fo3x.js} +0 -0
- /package/build/assets/{use-llm-profiles-D3-KXwQ0.js → use-llm-profiles-O4a9V6RC.js} +0 -0
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
import { useTranslation as e } from "../../../node_modules/react-i18next/dist/es/useTranslation.js";
|
|
2
2
|
import { I18nKey as t } from "../../../i18n/declaration.js";
|
|
3
3
|
import { cn as n } from "../../../utils/utils.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import m from "../../../
|
|
15
|
-
import h from "../../../
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import v from "
|
|
19
|
-
import
|
|
4
|
+
import { useNavigation as r } from "../../../context/navigation-context.js";
|
|
5
|
+
import { useActiveBackendContext as i } from "../../../contexts/active-backend-context.js";
|
|
6
|
+
import { ServerClient as a } from "../../../node_modules/@openhands/typescript-client/dist/client/server-client.js";
|
|
7
|
+
import { useQuery as o } from "../../../node_modules/@tanstack/react-query/build/modern/useQuery.js";
|
|
8
|
+
import { getAgentServerClientOptions as s } from "../../../api/agent-server-client-options.js";
|
|
9
|
+
import { ModalBackdrop as c } from "../../shared/modals/modal-backdrop.js";
|
|
10
|
+
import { MODAL_MAX_WIDTH_VIEWPORT as l, modalWidthClassName as u } from "../../shared/modals/modal-body.js";
|
|
11
|
+
import { ModalCloseButton as d } from "../../shared/modals/modal-close-button.js";
|
|
12
|
+
import { BrandButton as f } from "../settings/brand-button.js";
|
|
13
|
+
import { SettingsInput as p } from "../settings/settings-input.js";
|
|
14
|
+
import { useBackendsHealth as m } from "../../../hooks/query/use-backends-health.js";
|
|
15
|
+
import h from "../../../assets/branding/openhands-logo-white.js";
|
|
16
|
+
import g from "../../../icons/chevron-down-small.js";
|
|
17
|
+
import { BackendStatusDot as _ } from "./backend-status-dot.js";
|
|
18
|
+
import { DeviceFlowAuth as v } from "./device-flow-auth.js";
|
|
19
|
+
import y from "react";
|
|
20
|
+
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
20
21
|
//#region src/components/features/backends/backend-form-modal.tsx
|
|
21
|
-
function
|
|
22
|
+
function S(e) {
|
|
22
23
|
let t = e.trim().toLowerCase();
|
|
23
24
|
return t.includes("all-hands.dev") || t.includes("openhands.dev") ? "cloud" : "local";
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function C(e) {
|
|
26
27
|
let t = e.toLowerCase().replace(/^\[|\]$/g, "");
|
|
27
28
|
return !!(t === "localhost" || t === "::1" || t === "::" || t === "0.0.0.0" || /^127\./.test(t) || /^::ffff:127\./i.test(t) || /^10\./.test(t) || /^192\.168\./.test(t) || /^172\.(1[6-9]|2\d|3[01])\./.test(t) || /^fe[89ab][0-9a-f]:/i.test(t) || /^f[cd][0-9a-f]{2}:/i.test(t) || t.endsWith(".local") || !t.includes(".") && !t.includes(":"));
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
+
function w(e) {
|
|
30
31
|
let t = e.trim().replace(/\/+$/, "");
|
|
31
32
|
if (!t) return "";
|
|
32
33
|
if (/^https?:\/\//i.test(t)) return t;
|
|
33
34
|
let n = t.match(/^\[([^\]]+)\]/);
|
|
34
|
-
return `${
|
|
35
|
+
return `${C(n ? n[1] : (t.match(/:/g) ?? []).length > 1 ? t : t.split(":")[0]) ? "http" : "https"}://${t}`;
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function T(e) {
|
|
37
38
|
let t = e.trim();
|
|
38
39
|
if (!t || /\s/.test(t)) return !1;
|
|
39
|
-
let n =
|
|
40
|
+
let n = w(t);
|
|
40
41
|
if (!n) return !1;
|
|
41
42
|
try {
|
|
42
43
|
let e = new URL(n);
|
|
@@ -45,15 +46,15 @@ function w(e) {
|
|
|
45
46
|
return !1;
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
var
|
|
49
|
-
function
|
|
50
|
-
let { t:
|
|
49
|
+
var E = "https://app.all-hands.dev";
|
|
50
|
+
function D({ backend: n, testIdRoot: r }) {
|
|
51
|
+
let { t: i } = e("openhands"), c = m([n])[n.id], l = c?.isConnected ?? null, u = c?.disabled === !0, d = c?.consecutiveFailures ?? 0, f = c?.lastError ?? null, { data: p } = o({
|
|
51
52
|
queryKey: [
|
|
52
53
|
"backend-version",
|
|
53
54
|
n.host,
|
|
54
55
|
n.apiKey
|
|
55
56
|
],
|
|
56
|
-
queryFn: async () => (await new
|
|
57
|
+
queryFn: async () => (await new a(s({
|
|
57
58
|
host: n.host,
|
|
58
59
|
sessionApiKey: n.apiKey || null,
|
|
59
60
|
timeout: 5e3
|
|
@@ -62,47 +63,47 @@ function E({ backend: n, testIdRoot: r }) {
|
|
|
62
63
|
staleTime: 6e4,
|
|
63
64
|
enabled: n.kind === "local" && !u
|
|
64
65
|
}), h;
|
|
65
|
-
h =
|
|
66
|
-
let
|
|
67
|
-
return /* @__PURE__ */
|
|
66
|
+
h = i(l === !0 ? t.ONBOARDING$BACKEND_STATUS_CONNECTED : l === !1 ? t.ONBOARDING$BACKEND_STATUS_DISCONNECTED : t.ONBOARDING$BACKEND_STATUS_CHECKING);
|
|
67
|
+
let g = n.kind === "cloud" ? i(t.BACKEND$KIND_CLOUD) : i(t.BACKEND$KIND_LOCAL);
|
|
68
|
+
return /* @__PURE__ */ x("div", {
|
|
68
69
|
className: "flex flex-col gap-2",
|
|
69
|
-
children: [/* @__PURE__ */
|
|
70
|
+
children: [/* @__PURE__ */ x("div", {
|
|
70
71
|
"data-testid": `${r}-status`,
|
|
71
72
|
className: "flex items-center gap-3 text-sm",
|
|
72
73
|
children: [
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ b(_, { isConnected: l }),
|
|
75
|
+
/* @__PURE__ */ b("span", {
|
|
75
76
|
className: "text-white",
|
|
76
77
|
"data-testid": `${r}-status-label`,
|
|
77
78
|
children: h
|
|
78
79
|
}),
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ b("span", {
|
|
80
81
|
className: "text-tertiary-alt",
|
|
81
82
|
children: "·"
|
|
82
83
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ b("span", {
|
|
84
85
|
className: "text-[var(--oh-text-tertiary)]",
|
|
85
|
-
children:
|
|
86
|
+
children: g
|
|
86
87
|
}),
|
|
87
|
-
|
|
88
|
+
p ? /* @__PURE__ */ b("span", {
|
|
88
89
|
className: "text-xs text-[var(--oh-muted)]",
|
|
89
90
|
"data-testid": `${r}-version`,
|
|
90
|
-
children:
|
|
91
|
+
children: i(t.BACKEND$VERSION_LABEL, { version: p })
|
|
91
92
|
}) : null
|
|
92
93
|
]
|
|
93
|
-
}), u ? /* @__PURE__ */
|
|
94
|
+
}), u ? /* @__PURE__ */ x("div", {
|
|
94
95
|
"data-testid": `${r}-status-error`,
|
|
95
96
|
className: "flex flex-col gap-1 rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm",
|
|
96
97
|
children: [
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ b("span", {
|
|
98
99
|
className: "font-semibold text-red-300",
|
|
99
|
-
children:
|
|
100
|
+
children: i(t.BACKEND$HEALTH_FAILED_TITLE)
|
|
100
101
|
}),
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ b("span", {
|
|
102
103
|
className: "text-xs text-[var(--oh-text-tertiary)]",
|
|
103
|
-
children:
|
|
104
|
+
children: i(t.BACKEND$HEALTH_FAILED_DETAIL, { count: d })
|
|
104
105
|
}),
|
|
105
|
-
f ? /* @__PURE__ */
|
|
106
|
+
f ? /* @__PURE__ */ b("span", {
|
|
106
107
|
"data-testid": `${r}-status-error-message`,
|
|
107
108
|
className: "text-xs text-red-300 whitespace-pre-wrap break-words",
|
|
108
109
|
children: f
|
|
@@ -111,9 +112,9 @@ function E({ backend: n, testIdRoot: r }) {
|
|
|
111
112
|
}) : null]
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
|
-
function
|
|
115
|
-
let { t: c } = e("openhands"), { addBackend: l, updateBackend: u } =
|
|
116
|
-
return /* @__PURE__ */
|
|
115
|
+
function O({ mode: n, backend: r, onSubmitted: a, renderActions: o, testIdRoot: s }) {
|
|
116
|
+
let { t: c } = e("openhands"), { addBackend: l, updateBackend: u } = i(), [d, m] = y.useState(r?.name ?? ""), [h, g] = y.useState(r?.host ?? ""), [_, v] = y.useState(r?.apiKey ?? ""), [C, O] = y.useState(!1), [k, A] = y.useState(!1), j = S(h), M = s ?? (n === "edit" ? "edit-backend" : "add-backend"), N = d.trim().length > 0 && T(h) && (j === "local" || _.trim().length > 0), P = C && !d.trim() ? c(t.BACKEND$NAME_REQUIRED) : void 0, F = k ? h.trim() ? T(h) ? void 0 : c(t.BACKEND$HOST_INVALID) : c(t.BACKEND$HOST_REQUIRED) : void 0;
|
|
117
|
+
return /* @__PURE__ */ x("form", {
|
|
117
118
|
"data-testid": `${M}-form`,
|
|
118
119
|
onSubmit: (e) => {
|
|
119
120
|
if (e.preventDefault(), !N) {
|
|
@@ -121,21 +122,21 @@ function D({ mode: n, backend: i, onSubmitted: a, renderActions: o, testIdRoot:
|
|
|
121
122
|
return;
|
|
122
123
|
}
|
|
123
124
|
let t = {
|
|
124
|
-
name:
|
|
125
|
-
host:
|
|
125
|
+
name: d.trim(),
|
|
126
|
+
host: w(h),
|
|
126
127
|
apiKey: _.trim(),
|
|
127
128
|
kind: j
|
|
128
129
|
};
|
|
129
|
-
n === "edit" &&
|
|
130
|
+
n === "edit" && r ? u(r.id, t) : l(t), a();
|
|
130
131
|
},
|
|
131
132
|
className: "flex flex-col gap-4",
|
|
132
133
|
children: [
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ b(p, {
|
|
134
135
|
testId: `${M}-name`,
|
|
135
136
|
name: `${M}-name`,
|
|
136
137
|
type: "text",
|
|
137
138
|
label: c(t.BACKEND$NAME_LABEL),
|
|
138
|
-
value:
|
|
139
|
+
value: d,
|
|
139
140
|
onChange: m,
|
|
140
141
|
onBlur: () => O(!0),
|
|
141
142
|
placeholder: "Production",
|
|
@@ -143,7 +144,7 @@ function D({ mode: n, backend: i, onSubmitted: a, renderActions: o, testIdRoot:
|
|
|
143
144
|
showRequiredTag: !0,
|
|
144
145
|
error: P
|
|
145
146
|
}),
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ b(p, {
|
|
147
148
|
testId: `${M}-host`,
|
|
148
149
|
name: `${M}-host`,
|
|
149
150
|
type: "text",
|
|
@@ -151,37 +152,37 @@ function D({ mode: n, backend: i, onSubmitted: a, renderActions: o, testIdRoot:
|
|
|
151
152
|
value: h,
|
|
152
153
|
onChange: g,
|
|
153
154
|
onBlur: () => A(!0),
|
|
154
|
-
placeholder:
|
|
155
|
+
placeholder: E,
|
|
155
156
|
className: "w-full",
|
|
156
157
|
showRequiredTag: !0,
|
|
157
158
|
error: F
|
|
158
159
|
}),
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ b(p, {
|
|
160
161
|
testId: `${M}-api-key`,
|
|
161
162
|
name: `${M}-api-key`,
|
|
162
163
|
type: "password",
|
|
163
164
|
label: c(t.BACKEND$KEY_LABEL),
|
|
164
165
|
value: _,
|
|
165
|
-
onChange:
|
|
166
|
+
onChange: v,
|
|
166
167
|
placeholder: "",
|
|
167
168
|
className: "w-full"
|
|
168
169
|
}),
|
|
169
|
-
n === "edit" &&
|
|
170
|
-
backend:
|
|
170
|
+
n === "edit" && r && /* @__PURE__ */ b(D, {
|
|
171
|
+
backend: r,
|
|
171
172
|
testIdRoot: M
|
|
172
173
|
}),
|
|
173
174
|
o ? o({
|
|
174
175
|
canSubmit: N,
|
|
175
176
|
testIdRoot: M
|
|
176
|
-
}) : /* @__PURE__ */
|
|
177
|
+
}) : /* @__PURE__ */ x("div", {
|
|
177
178
|
className: "flex justify-end gap-2 mt-2 w-full",
|
|
178
|
-
children: [/* @__PURE__ */
|
|
179
|
+
children: [/* @__PURE__ */ b(f, {
|
|
179
180
|
type: "button",
|
|
180
181
|
variant: "secondary",
|
|
181
182
|
onClick: a,
|
|
182
183
|
testId: `${M}-cancel`,
|
|
183
184
|
children: c(t.BUTTON$CANCEL)
|
|
184
|
-
}), /* @__PURE__ */
|
|
185
|
+
}), /* @__PURE__ */ b(f, {
|
|
185
186
|
type: "submit",
|
|
186
187
|
variant: "primary",
|
|
187
188
|
isDisabled: !N,
|
|
@@ -192,132 +193,138 @@ function D({ mode: n, backend: i, onSubmitted: a, renderActions: o, testIdRoot:
|
|
|
192
193
|
]
|
|
193
194
|
});
|
|
194
195
|
}
|
|
195
|
-
function
|
|
196
|
-
let {
|
|
197
|
-
return
|
|
196
|
+
function k() {
|
|
197
|
+
let { currentPath: e, navigate: t } = r();
|
|
198
|
+
return y.useCallback(() => {
|
|
199
|
+
/^\/automations\/[^/]+/.test(e) ? t("/automations") : /^\/conversations\/[^/]+/.test(e) && t("/conversations");
|
|
200
|
+
}, [e, t]);
|
|
201
|
+
}
|
|
202
|
+
function A({ onClose: n }) {
|
|
203
|
+
let { t: r } = e("openhands"), { addBackend: a } = i(), o = k(), [s, c] = y.useState(""), [l, u] = y.useState(""), [d, m] = y.useState(""), h = S(l), g = s.trim().length > 0 && T(l) && (h === "local" || d.trim().length > 0);
|
|
204
|
+
return /* @__PURE__ */ x("form", {
|
|
198
205
|
"data-testid": "add-backend-form",
|
|
199
206
|
onSubmit: (e) => {
|
|
200
|
-
e.preventDefault(),
|
|
201
|
-
name:
|
|
202
|
-
host:
|
|
203
|
-
apiKey:
|
|
204
|
-
kind:
|
|
205
|
-
}), n());
|
|
207
|
+
e.preventDefault(), g && (a({
|
|
208
|
+
name: s.trim(),
|
|
209
|
+
host: w(l),
|
|
210
|
+
apiKey: d.trim(),
|
|
211
|
+
kind: h
|
|
212
|
+
}), o(), n());
|
|
206
213
|
},
|
|
207
214
|
className: "flex flex-col gap-4 flex-1 min-w-0",
|
|
208
215
|
children: [
|
|
209
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ x("div", {
|
|
210
217
|
className: "flex flex-col gap-1",
|
|
211
|
-
children: [/* @__PURE__ */
|
|
218
|
+
children: [/* @__PURE__ */ b(p, {
|
|
212
219
|
testId: "add-backend-name",
|
|
213
220
|
name: "add-backend-name",
|
|
214
221
|
type: "text",
|
|
215
|
-
label:
|
|
216
|
-
value:
|
|
217
|
-
onChange:
|
|
222
|
+
label: r(t.BACKEND$NAME_LABEL),
|
|
223
|
+
value: s,
|
|
224
|
+
onChange: c,
|
|
218
225
|
placeholder: "e.g. My Server",
|
|
219
226
|
className: "w-full"
|
|
220
|
-
}), /* @__PURE__ */
|
|
227
|
+
}), /* @__PURE__ */ b("p", {
|
|
221
228
|
className: "text-xs text-[var(--oh-muted)]",
|
|
222
|
-
children:
|
|
229
|
+
children: r(t.BACKEND$NAME_HELPER)
|
|
223
230
|
})]
|
|
224
231
|
}),
|
|
225
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ x("div", {
|
|
226
233
|
className: "flex flex-col gap-1",
|
|
227
|
-
children: [/* @__PURE__ */
|
|
234
|
+
children: [/* @__PURE__ */ b(p, {
|
|
228
235
|
testId: "add-backend-host",
|
|
229
236
|
name: "add-backend-host",
|
|
230
237
|
type: "text",
|
|
231
|
-
label:
|
|
232
|
-
value:
|
|
233
|
-
onChange:
|
|
238
|
+
label: r(t.BACKEND$HOST_LABEL),
|
|
239
|
+
value: l,
|
|
240
|
+
onChange: u,
|
|
234
241
|
placeholder: "http://localhost:8000",
|
|
235
242
|
className: "w-full"
|
|
236
|
-
}), /* @__PURE__ */
|
|
243
|
+
}), /* @__PURE__ */ b("p", {
|
|
237
244
|
className: "text-xs text-[var(--oh-muted)]",
|
|
238
245
|
"data-testid": "add-backend-host-helper",
|
|
239
|
-
children:
|
|
246
|
+
children: r(t.BACKEND$HOST_HELPER)
|
|
240
247
|
})]
|
|
241
248
|
}),
|
|
242
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ b(p, {
|
|
243
250
|
testId: "add-backend-api-key",
|
|
244
251
|
name: "add-backend-api-key",
|
|
245
252
|
type: "password",
|
|
246
|
-
label:
|
|
247
|
-
value:
|
|
248
|
-
onChange:
|
|
253
|
+
label: r(t.BACKEND$KEY_LABEL),
|
|
254
|
+
value: d,
|
|
255
|
+
onChange: m,
|
|
249
256
|
placeholder: "sk-••••••••••",
|
|
250
257
|
className: "w-full"
|
|
251
258
|
}),
|
|
252
|
-
/* @__PURE__ */
|
|
259
|
+
/* @__PURE__ */ b(f, {
|
|
253
260
|
type: "submit",
|
|
254
261
|
variant: "secondary",
|
|
255
|
-
isDisabled: !
|
|
262
|
+
isDisabled: !g,
|
|
256
263
|
testId: "add-backend-submit",
|
|
257
264
|
className: "w-full text-center",
|
|
258
|
-
children:
|
|
265
|
+
children: r(t.BACKEND$CONNECT)
|
|
259
266
|
})
|
|
260
267
|
]
|
|
261
268
|
});
|
|
262
269
|
}
|
|
263
|
-
function
|
|
264
|
-
let { t: a } = e("openhands"), { addBackend: o } =
|
|
265
|
-
return /* @__PURE__ */
|
|
270
|
+
function j({ onClose: r }) {
|
|
271
|
+
let { t: a } = e("openhands"), { addBackend: o } = i(), s = k(), [c, l] = y.useState(!1), [u, d] = y.useState(""), f = u.trim() || E;
|
|
272
|
+
return /* @__PURE__ */ x("div", {
|
|
266
273
|
className: "flex flex-1 min-w-0 flex-col items-center gap-3",
|
|
267
274
|
children: [
|
|
268
|
-
/* @__PURE__ */
|
|
275
|
+
/* @__PURE__ */ x("div", {
|
|
269
276
|
className: "flex flex-col items-center gap-1",
|
|
270
|
-
children: [/* @__PURE__ */
|
|
277
|
+
children: [/* @__PURE__ */ b(h, {
|
|
271
278
|
width: 56,
|
|
272
279
|
height: 56,
|
|
273
280
|
"aria-hidden": !0
|
|
274
|
-
}), /* @__PURE__ */
|
|
281
|
+
}), /* @__PURE__ */ b("h4", {
|
|
275
282
|
className: "text-lg font-medium text-white",
|
|
276
283
|
"data-testid": "add-backend-cloud-title",
|
|
277
284
|
children: a(t.BACKEND$CLOUD_TITLE)
|
|
278
285
|
})]
|
|
279
286
|
}),
|
|
280
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ b("p", {
|
|
281
288
|
className: "text-center text-sm leading-relaxed text-[var(--oh-muted)]",
|
|
282
289
|
children: a(t.BACKEND$CLOUD_DESCRIPTION)
|
|
283
290
|
}),
|
|
284
|
-
/* @__PURE__ */
|
|
285
|
-
host:
|
|
291
|
+
/* @__PURE__ */ b(v, {
|
|
292
|
+
host: f,
|
|
286
293
|
onSuccess: (e) => {
|
|
287
294
|
o({
|
|
288
295
|
name: "OpenHands Cloud",
|
|
289
|
-
host:
|
|
296
|
+
host: w(f),
|
|
290
297
|
apiKey: e,
|
|
291
298
|
kind: "cloud"
|
|
292
|
-
}),
|
|
299
|
+
}), s(), r();
|
|
293
300
|
},
|
|
294
301
|
testIdRoot: "add-backend"
|
|
295
302
|
}),
|
|
296
|
-
/* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ x("div", {
|
|
297
304
|
className: "w-full",
|
|
298
|
-
children: [/* @__PURE__ */
|
|
305
|
+
children: [/* @__PURE__ */ x("button", {
|
|
299
306
|
type: "button",
|
|
300
|
-
onClick: () =>
|
|
301
|
-
"aria-expanded":
|
|
307
|
+
onClick: () => l((e) => !e),
|
|
308
|
+
"aria-expanded": c,
|
|
302
309
|
"data-testid": "add-backend-advanced-toggle",
|
|
303
310
|
className: "flex w-full cursor-pointer items-center justify-center gap-1 text-center text-xs text-[var(--oh-muted)] transition-colors hover:text-content-2",
|
|
304
|
-
children: [/* @__PURE__ */
|
|
305
|
-
className: n("h-4 w-4 shrink-0 text-muted transition-transform",
|
|
311
|
+
children: [/* @__PURE__ */ b("span", { children: a(t.BACKEND$ADVANCED) }), /* @__PURE__ */ b(g, {
|
|
312
|
+
className: n("h-4 w-4 shrink-0 text-muted transition-transform", c && "rotate-180"),
|
|
306
313
|
"aria-hidden": !0
|
|
307
314
|
})]
|
|
308
|
-
}), /* @__PURE__ */
|
|
309
|
-
className: n("pt-2", !
|
|
310
|
-
"aria-hidden": !
|
|
311
|
-
children: [/* @__PURE__ */
|
|
315
|
+
}), /* @__PURE__ */ x("div", {
|
|
316
|
+
className: n("pt-2", !c && "pointer-events-none invisible"),
|
|
317
|
+
"aria-hidden": !c,
|
|
318
|
+
children: [/* @__PURE__ */ b(p, {
|
|
312
319
|
testId: "add-backend-cloud-host",
|
|
313
320
|
name: "add-backend-cloud-host",
|
|
314
321
|
type: "text",
|
|
315
322
|
label: a(t.BACKEND$HOST_LABEL),
|
|
316
|
-
value:
|
|
317
|
-
onChange:
|
|
318
|
-
placeholder:
|
|
323
|
+
value: u,
|
|
324
|
+
onChange: d,
|
|
325
|
+
placeholder: E,
|
|
319
326
|
className: "w-full"
|
|
320
|
-
}), /* @__PURE__ */
|
|
327
|
+
}), /* @__PURE__ */ b("p", {
|
|
321
328
|
className: "mt-1 text-xs text-[var(--oh-muted)]",
|
|
322
329
|
children: a(t.BACKEND$LOGIN_CLOUD_HINT)
|
|
323
330
|
})]
|
|
@@ -326,82 +333,82 @@ function k({ onClose: i }) {
|
|
|
326
333
|
]
|
|
327
334
|
});
|
|
328
335
|
}
|
|
329
|
-
function
|
|
336
|
+
function M({ mode: r, backend: i, onClose: a }) {
|
|
330
337
|
let { t: o } = e("openhands");
|
|
331
|
-
if (r === "add") return /* @__PURE__ */
|
|
338
|
+
if (r === "add") return /* @__PURE__ */ b(c, {
|
|
332
339
|
onClose: a,
|
|
333
340
|
closeOnEscape: !1,
|
|
334
341
|
"aria-label": o(t.BACKEND$ADD_TITLE),
|
|
335
|
-
children: /* @__PURE__ */
|
|
342
|
+
children: /* @__PURE__ */ x("div", {
|
|
336
343
|
"data-testid": "add-backend-modal",
|
|
337
|
-
className: n("relative rounded-xl border border-[var(--oh-border)] bg-base-secondary",
|
|
344
|
+
className: n("relative rounded-xl border border-[var(--oh-border)] bg-base-secondary", u("xl"), l),
|
|
338
345
|
children: [
|
|
339
|
-
/* @__PURE__ */
|
|
346
|
+
/* @__PURE__ */ b(d, {
|
|
340
347
|
onClose: a,
|
|
341
348
|
testId: "add-backend-close"
|
|
342
349
|
}),
|
|
343
|
-
/* @__PURE__ */
|
|
350
|
+
/* @__PURE__ */ b("div", {
|
|
344
351
|
className: "px-6 pt-6 pb-2 pr-12",
|
|
345
|
-
children: /* @__PURE__ */
|
|
352
|
+
children: /* @__PURE__ */ b("h2", {
|
|
346
353
|
className: "text-lg font-semibold",
|
|
347
354
|
children: o(t.BACKEND$ADD_TITLE)
|
|
348
355
|
})
|
|
349
356
|
}),
|
|
350
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ x("div", {
|
|
351
358
|
className: "flex gap-6 px-6 pb-6 pt-2",
|
|
352
359
|
children: [
|
|
353
|
-
/* @__PURE__ */
|
|
360
|
+
/* @__PURE__ */ b("div", {
|
|
354
361
|
className: "flex-1 min-w-0",
|
|
355
|
-
children: /* @__PURE__ */
|
|
362
|
+
children: /* @__PURE__ */ b(A, { onClose: a })
|
|
356
363
|
}),
|
|
357
|
-
/* @__PURE__ */
|
|
364
|
+
/* @__PURE__ */ x("div", {
|
|
358
365
|
className: "flex shrink-0 flex-col items-center",
|
|
359
366
|
children: [
|
|
360
|
-
/* @__PURE__ */
|
|
361
|
-
/* @__PURE__ */
|
|
367
|
+
/* @__PURE__ */ b("div", { className: "flex-1 w-px bg-[var(--oh-border)]" }),
|
|
368
|
+
/* @__PURE__ */ b("span", {
|
|
362
369
|
className: "py-3 text-xs uppercase text-[var(--oh-muted)]",
|
|
363
370
|
children: o(t.BACKEND$LOGIN_OR)
|
|
364
371
|
}),
|
|
365
|
-
/* @__PURE__ */
|
|
372
|
+
/* @__PURE__ */ b("div", { className: "flex-1 w-px bg-[var(--oh-border)]" })
|
|
366
373
|
]
|
|
367
374
|
}),
|
|
368
|
-
/* @__PURE__ */
|
|
375
|
+
/* @__PURE__ */ b("div", {
|
|
369
376
|
className: "flex-1 min-w-0",
|
|
370
|
-
children: /* @__PURE__ */
|
|
377
|
+
children: /* @__PURE__ */ b(j, { onClose: a })
|
|
371
378
|
})
|
|
372
379
|
]
|
|
373
380
|
})
|
|
374
381
|
]
|
|
375
382
|
})
|
|
376
383
|
});
|
|
377
|
-
let
|
|
378
|
-
return /* @__PURE__ */
|
|
384
|
+
let s = "edit-backend";
|
|
385
|
+
return /* @__PURE__ */ b(c, {
|
|
379
386
|
onClose: a,
|
|
380
387
|
closeOnEscape: !1,
|
|
381
388
|
"aria-label": o(t.BACKEND$EDIT_TITLE),
|
|
382
|
-
children: /* @__PURE__ */
|
|
383
|
-
"data-testid": `${
|
|
384
|
-
className: n("relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)]",
|
|
389
|
+
children: /* @__PURE__ */ x("div", {
|
|
390
|
+
"data-testid": `${s}-modal`,
|
|
391
|
+
className: n("relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)]", u("md")),
|
|
385
392
|
children: [
|
|
386
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ b(d, {
|
|
387
394
|
onClose: a,
|
|
388
|
-
testId: `${
|
|
395
|
+
testId: `${s}-close`
|
|
389
396
|
}),
|
|
390
|
-
/* @__PURE__ */
|
|
397
|
+
/* @__PURE__ */ b("h2", {
|
|
391
398
|
className: "pr-6 text-lg font-semibold",
|
|
392
399
|
children: o(t.BACKEND$EDIT_TITLE)
|
|
393
400
|
}),
|
|
394
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ b(O, {
|
|
395
402
|
mode: "edit",
|
|
396
403
|
backend: i,
|
|
397
404
|
onSubmitted: a,
|
|
398
|
-
testIdRoot:
|
|
405
|
+
testIdRoot: s
|
|
399
406
|
})
|
|
400
407
|
]
|
|
401
408
|
})
|
|
402
409
|
});
|
|
403
410
|
}
|
|
404
411
|
//#endregion
|
|
405
|
-
export {
|
|
412
|
+
export { M as BackendFormModal };
|
|
406
413
|
|
|
407
414
|
//# sourceMappingURL=backend-form-modal.js.map
|