dsh-monkeyai-sessions 0.1.0 → 0.1.2
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 +3 -1
- package/README.zh.md +96 -0
- package/client.js +136 -136
- package/lib/client-runtime.cjs +136 -136
- package/package.json +4 -3
- package/src/client/index.js +119 -119
- package/src/host/monkeyai-remote.js +76 -25
- package/src/shared/projection.mjs +10 -10
package/lib/client-runtime.cjs
CHANGED
|
@@ -310,9 +310,9 @@ var TYPERT_REMOTE = createTypertRemoteInfo({ package: PACKAGE_NAME, methods }, i
|
|
|
310
310
|
|
|
311
311
|
// src/shared/projection.mjs
|
|
312
312
|
var MESSAGE_UPDATES = Object.freeze({
|
|
313
|
-
user_message_chunk: { role: "user", label: "
|
|
313
|
+
user_message_chunk: { role: "user", label: "\u6211", mode: "append" },
|
|
314
314
|
agent_message_chunk: { role: "assistant", label: "MonkeyAI", mode: "append" },
|
|
315
|
-
user_message: { role: "user", label: "
|
|
315
|
+
user_message: { role: "user", label: "\u6211", mode: "replace" },
|
|
316
316
|
agent_message: { role: "assistant", label: "MonkeyAI", mode: "replace" }
|
|
317
317
|
});
|
|
318
318
|
var THOUGHT_UPDATES = Object.freeze({
|
|
@@ -320,11 +320,11 @@ var THOUGHT_UPDATES = Object.freeze({
|
|
|
320
320
|
agent_thought: "replace"
|
|
321
321
|
});
|
|
322
322
|
var TOOL_STATUS_LABEL = Object.freeze({
|
|
323
|
-
pending: "
|
|
324
|
-
in_progress: "
|
|
325
|
-
completed: "
|
|
326
|
-
failed: "
|
|
327
|
-
cancelled: "
|
|
323
|
+
pending: "\u6392\u961F\u4E2D",
|
|
324
|
+
in_progress: "\u6267\u884C\u4E2D",
|
|
325
|
+
completed: "\u5B8C\u6210",
|
|
326
|
+
failed: "\u5931\u8D25",
|
|
327
|
+
cancelled: "\u5DF2\u53D6\u6D88"
|
|
328
328
|
});
|
|
329
329
|
function contentText(content) {
|
|
330
330
|
const blocks = Array.isArray(content) ? content : content === void 0 || content === null ? [] : [content];
|
|
@@ -444,25 +444,25 @@ function projectFrames(frames) {
|
|
|
444
444
|
if (frame.type === "ready") {
|
|
445
445
|
if (!seenReady) {
|
|
446
446
|
seenReady = true;
|
|
447
|
-
entries.push({ kind: "system", label: "
|
|
447
|
+
entries.push({ kind: "system", label: "\u5DF2\u8FDE\u63A5\u5230\u8FDC\u7A0B runtime", key: `sys-ready:${entries.length}` });
|
|
448
448
|
}
|
|
449
449
|
continue;
|
|
450
450
|
}
|
|
451
451
|
if (frame.type === "history_loaded") {
|
|
452
452
|
if (!seenHistoryLoaded) {
|
|
453
453
|
seenHistoryLoaded = true;
|
|
454
|
-
entries.push({ kind: "system", label: "
|
|
454
|
+
entries.push({ kind: "system", label: "\u5386\u53F2\u5DF2\u52A0\u8F7D", key: `sys-hist:${entries.length}` });
|
|
455
455
|
}
|
|
456
456
|
continue;
|
|
457
457
|
}
|
|
458
458
|
if (frame.type === "history_incomplete") {
|
|
459
|
-
entries.push({ kind: "system", label: "
|
|
459
|
+
entries.push({ kind: "system", label: "\u5386\u53F2\u4E0D\u5B8C\u6574\uFF0C\u90E8\u5206\u66F4\u65E9\u7684\u6D88\u606F\u53EF\u80FD\u7F3A\u5931", key: `sys-inc:${entries.length}` });
|
|
460
460
|
continue;
|
|
461
461
|
}
|
|
462
462
|
if (frame.type === "reconnecting") {
|
|
463
463
|
if (!seenReconnecting) {
|
|
464
464
|
seenReconnecting = true;
|
|
465
|
-
entries.push({ kind: "system", label: frame.message || "
|
|
465
|
+
entries.push({ kind: "system", label: frame.message || "\u6B63\u5728\u91CD\u8FDE\u8FDC\u7A0B runtime", key: `sys-reconn:${entries.length}` });
|
|
466
466
|
}
|
|
467
467
|
continue;
|
|
468
468
|
}
|
|
@@ -472,18 +472,18 @@ function projectFrames(frames) {
|
|
|
472
472
|
if (frame.type === "delivery") {
|
|
473
473
|
const accepted = Boolean(frame.data?.accepted);
|
|
474
474
|
if (accepted) continue;
|
|
475
|
-
entries.push({ kind: "system", label: "MonkeyAI
|
|
475
|
+
entries.push({ kind: "system", label: "MonkeyAI \u672A\u63A5\u53D7\u8BE5\u6307\u4EE4", key: `sys-del:${entries.length}` });
|
|
476
476
|
continue;
|
|
477
477
|
}
|
|
478
478
|
if (frame.type === "cancel_sent") {
|
|
479
|
-
entries.push({ kind: "system", label: "
|
|
479
|
+
entries.push({ kind: "system", label: "\u5DF2\u8BF7\u6C42\u505C\u6B62", key: `sys-cancel:${entries.length}` });
|
|
480
480
|
continue;
|
|
481
481
|
}
|
|
482
482
|
if (frame.type === "request") {
|
|
483
483
|
continue;
|
|
484
484
|
}
|
|
485
485
|
if (frame.type === "model_switched") {
|
|
486
|
-
entries.push({ kind: "system", label:
|
|
486
|
+
entries.push({ kind: "system", label: `\u5DF2\u5207\u6362\u6A21\u578B\uFF1A${frame.data?.model ?? "\u6240\u9009\u6A21\u578B"}`, key: `sys-model:${entries.length}` });
|
|
487
487
|
continue;
|
|
488
488
|
}
|
|
489
489
|
if (frame.type === "model_switch_failed") {
|
|
@@ -587,7 +587,7 @@ var PANEL_CSS = `
|
|
|
587
587
|
.mai-panel .mai-md pre::-webkit-scrollbar-thumb { background: #d5dbe4; border-radius: 6px; }
|
|
588
588
|
`;
|
|
589
589
|
function errorText(error) {
|
|
590
|
-
return typeof error?.message === "string" ? error.message : typeof error === "string" ? error : "
|
|
590
|
+
return typeof error?.message === "string" ? error.message : typeof error === "string" ? error : "\u8FDC\u7A0B\u64CD\u4F5C\u5931\u8D25";
|
|
591
591
|
}
|
|
592
592
|
function renderMarkdown(text) {
|
|
593
593
|
if (typeof text !== "string" || text === "") return null;
|
|
@@ -721,8 +721,8 @@ function ApprovalCard({ request, hasControl, onRespond, answerText, setAnswerTex
|
|
|
721
721
|
h(
|
|
722
722
|
"div",
|
|
723
723
|
{ style: { display: "flex", alignItems: "center", gap: 8 } },
|
|
724
|
-
h("span", { style: { fontSize: 12.5, fontWeight: 650 } }, isPermission ? "
|
|
725
|
-
h("span", { style: { fontSize: 11, color: t.text3 } }, "
|
|
724
|
+
h("span", { style: { fontSize: 12.5, fontWeight: 650 } }, isPermission ? "\u8BF7\u6C42\u6388\u6743" : "MonkeyAI \u9700\u8981\u4F60\u7684\u8F93\u5165"),
|
|
725
|
+
h("span", { style: { fontSize: 11, color: t.text3 } }, "\u56DE\u590D\u9700\u8981 session:control \u6743\u9650")
|
|
726
726
|
),
|
|
727
727
|
questionText !== "" ? h("div", { style: { fontSize: 12.5, color: t.text2, whiteSpace: "pre-wrap", overflowWrap: "anywhere" } }, questionText) : null,
|
|
728
728
|
options.length > 0 ? h(
|
|
@@ -735,14 +735,14 @@ function ApprovalCard({ request, hasControl, onRespond, answerText, setAnswerTex
|
|
|
735
735
|
disabled,
|
|
736
736
|
onClick: () => onRespond(request, { outcome: "selected", optionId: option.optionId })
|
|
737
737
|
}, option.name || option.optionId)),
|
|
738
|
-
h("button", { type: "button", style: style.button, disabled, onClick: () => onRespond(request, { outcome: "cancelled" }) }, "
|
|
738
|
+
h("button", { type: "button", style: style.button, disabled, onClick: () => onRespond(request, { outcome: "cancelled" }) }, "\u62D2\u7EDD")
|
|
739
739
|
) : null,
|
|
740
740
|
options.length === 0 && !isPermission ? h(
|
|
741
741
|
import_react.default.Fragment,
|
|
742
742
|
null,
|
|
743
743
|
h("textarea", {
|
|
744
744
|
style: { ...style.textarea, minHeight: 44 },
|
|
745
|
-
placeholder: disabled ? "
|
|
745
|
+
placeholder: disabled ? "\u53EA\u8BFB\u6A21\u5F0F\uFF1A\u56DE\u590D\u9700\u8981 session:control \u6743\u9650" : "\u8F93\u5165\u4F60\u7684\u56DE\u7B54",
|
|
746
746
|
value: answerText,
|
|
747
747
|
disabled,
|
|
748
748
|
onChange: (event) => setAnswerText(event.target.value)
|
|
@@ -750,19 +750,19 @@ function ApprovalCard({ request, hasControl, onRespond, answerText, setAnswerTex
|
|
|
750
750
|
h(
|
|
751
751
|
"div",
|
|
752
752
|
{ style: style.row },
|
|
753
|
-
h("button", { type: "button", style: style.primaryButton, disabled: disabled || answerText.trim() === "", onClick: () => onAnswer(request) }, "
|
|
754
|
-
h("button", { type: "button", style: style.button, disabled, onClick: () => onRespond(request, { action: "decline" }) }, "
|
|
753
|
+
h("button", { type: "button", style: style.primaryButton, disabled: disabled || answerText.trim() === "", onClick: () => onAnswer(request) }, "\u56DE\u590D"),
|
|
754
|
+
h("button", { type: "button", style: style.button, disabled, onClick: () => onRespond(request, { action: "decline" }) }, "\u62D2\u7EDD")
|
|
755
755
|
)
|
|
756
756
|
) : null,
|
|
757
757
|
options.length === 0 && isPermission ? h(
|
|
758
758
|
"div",
|
|
759
759
|
{ style: style.row },
|
|
760
|
-
h("button", { type: "button", style: style.button, disabled, onClick: () => onRespond(request, { outcome: "cancelled" }) }, "
|
|
760
|
+
h("button", { type: "button", style: style.button, disabled, onClick: () => onRespond(request, { outcome: "cancelled" }) }, "\u62D2\u7EDD")
|
|
761
761
|
) : null,
|
|
762
762
|
h(
|
|
763
763
|
"details",
|
|
764
764
|
{ style: style.details },
|
|
765
|
-
h("summary", { style: style.summary }, "
|
|
765
|
+
h("summary", { style: style.summary }, "\u8BF7\u6C42\u8BE6\u60C5"),
|
|
766
766
|
h("pre", { style: { margin: "6px 0 0", whiteSpace: "pre-wrap", overflowWrap: "anywhere", fontSize: 11.5 } }, JSON.stringify(request.data, null, 2))
|
|
767
767
|
)
|
|
768
768
|
);
|
|
@@ -784,7 +784,7 @@ function RemoteSessionPage({ api }) {
|
|
|
784
784
|
const [pendingRequests, setPendingRequests] = useState([]);
|
|
785
785
|
const [prompt, setPrompt] = useState("");
|
|
786
786
|
const [answerText, setAnswerText] = useState("");
|
|
787
|
-
const [status, setStatus] = useState("
|
|
787
|
+
const [status, setStatus] = useState("\u672A\u8FDE\u63A5");
|
|
788
788
|
const [error, setError] = useState("");
|
|
789
789
|
const [loading, setLoading] = useState(false);
|
|
790
790
|
const [lastDelivery, setLastDelivery] = useState(void 0);
|
|
@@ -867,7 +867,7 @@ function RemoteSessionPage({ api }) {
|
|
|
867
867
|
if (loading || !serverAddress || !signInEmail.trim() || signInPassword === "") return;
|
|
868
868
|
setError("");
|
|
869
869
|
setLoading(true);
|
|
870
|
-
setStatus("
|
|
870
|
+
setStatus("\u6B63\u5728\u767B\u5F55 MonkeyAI");
|
|
871
871
|
try {
|
|
872
872
|
const account = await unwrap(api.signIn({
|
|
873
873
|
serverAddress,
|
|
@@ -878,7 +878,7 @@ function RemoteSessionPage({ api }) {
|
|
|
878
878
|
adoptAccount(account);
|
|
879
879
|
} catch (reason) {
|
|
880
880
|
setError(errorText(reason));
|
|
881
|
-
setStatus("
|
|
881
|
+
setStatus("\u767B\u5F55\u5931\u8D25");
|
|
882
882
|
} finally {
|
|
883
883
|
setLoading(false);
|
|
884
884
|
}
|
|
@@ -893,9 +893,9 @@ function RemoteSessionPage({ api }) {
|
|
|
893
893
|
setAuthorizationMode(mode);
|
|
894
894
|
setCopied(false);
|
|
895
895
|
if (mode === "loopback") {
|
|
896
|
-
setStatus("
|
|
896
|
+
setStatus("\u7B49\u5F85\u6279\u51C6");
|
|
897
897
|
} else {
|
|
898
|
-
setStatus("
|
|
898
|
+
setStatus("\u6279\u51C6\u6388\u6743\u540E\uFF0C\u7C98\u8D34\u56DE\u8C03 URL");
|
|
899
899
|
}
|
|
900
900
|
authWindowRef.current = window.open(result.authorizationUrl, "_blank");
|
|
901
901
|
} catch (reason) {
|
|
@@ -941,12 +941,12 @@ function RemoteSessionPage({ api }) {
|
|
|
941
941
|
setAccounts((current) => [result.account, ...current.filter((item) => item.accountId !== result.account.accountId)]);
|
|
942
942
|
setAccountId(result.account.accountId);
|
|
943
943
|
setServerAddress(result.account.serverOrigin);
|
|
944
|
-
setStatus("MonkeyAI
|
|
944
|
+
setStatus("MonkeyAI \u8D26\u53F7\u5DF2\u8FDE\u63A5");
|
|
945
945
|
} else if (result.status === "failed") {
|
|
946
|
-
setError(result.error || "
|
|
947
|
-
setStatus("
|
|
946
|
+
setError(result.error || "\u81EA\u52A8\u6388\u6743\u5931\u8D25\uFF0C\u8BF7\u6539\u4E3A\u7C98\u8D34\u56DE\u8C03 URL\u3002");
|
|
947
|
+
setStatus("\u81EA\u52A8\u6388\u6743\u5931\u8D25");
|
|
948
948
|
} else {
|
|
949
|
-
setStatus("
|
|
949
|
+
setStatus("\u6388\u6743\u8BF7\u6C42\u5DF2\u8FC7\u671F");
|
|
950
950
|
}
|
|
951
951
|
setAuthorizationRequestId("");
|
|
952
952
|
setAuthorizationUrl("");
|
|
@@ -960,7 +960,7 @@ function RemoteSessionPage({ api }) {
|
|
|
960
960
|
setAccounts((current) => [account, ...current.filter((item) => item.accountId !== account.accountId)]);
|
|
961
961
|
setAccountId(account.accountId);
|
|
962
962
|
setServerAddress(account.serverOrigin);
|
|
963
|
-
setStatus("MonkeyAI
|
|
963
|
+
setStatus("MonkeyAI \u8D26\u53F7\u5DF2\u8FDE\u63A5");
|
|
964
964
|
setAddingServer(false);
|
|
965
965
|
}
|
|
966
966
|
async function completeAuthorization() {
|
|
@@ -983,9 +983,9 @@ function RemoteSessionPage({ api }) {
|
|
|
983
983
|
try {
|
|
984
984
|
await navigator.clipboard.writeText(authorizationUrl);
|
|
985
985
|
setCopied(true);
|
|
986
|
-
setStatus("
|
|
986
|
+
setStatus("\u6388\u6743\u94FE\u63A5\u5DF2\u590D\u5236");
|
|
987
987
|
} catch {
|
|
988
|
-
setStatus("
|
|
988
|
+
setStatus("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u94FE\u63A5\u6587\u672C");
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
991
|
async function loadDevices() {
|
|
@@ -1002,7 +1002,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1002
1002
|
setSessionId("");
|
|
1003
1003
|
streamRef.current?.dispose();
|
|
1004
1004
|
streamRef.current = null;
|
|
1005
|
-
setStatus(result.items.length > 0 ? `${result.items.length} device(s) found` : "
|
|
1005
|
+
setStatus(result.items.length > 0 ? `${result.items.length} device(s) found` : "\u6682\u65E0\u5DF2\u6CE8\u518C\u8BBE\u5907");
|
|
1006
1006
|
if (first) await loadSessions(first);
|
|
1007
1007
|
} catch (reason) {
|
|
1008
1008
|
setError(errorText(reason));
|
|
@@ -1026,10 +1026,10 @@ function RemoteSessionPage({ api }) {
|
|
|
1026
1026
|
]);
|
|
1027
1027
|
const errors = [];
|
|
1028
1028
|
if (results[0].status === "fulfilled") setSummarySessions(results[0].value.items);
|
|
1029
|
-
else errors.push(
|
|
1029
|
+
else errors.push(`\u4F1A\u8BDD\u6458\u8981\u7D22\u5F15\uFF1A${errorText(results[0].reason)}`);
|
|
1030
1030
|
if (results[1].status === "fulfilled") setRuntimeSessions(results[1].value.sessions);
|
|
1031
|
-
else errors.push(`ACP
|
|
1032
|
-
setStatus(errors.length === 0 ? "
|
|
1031
|
+
else errors.push(`ACP \u4F1A\u8BDD\u5217\u8868\uFF1A${errorText(results[1].reason)}`);
|
|
1032
|
+
setStatus(errors.length === 0 ? "\u4F1A\u8BDD\u5DF2\u5237\u65B0" : "\u90E8\u5206\u4F1A\u8BDD\u6765\u6E90\u4E0D\u53EF\u7528");
|
|
1033
1033
|
setError(errors.join("\n"));
|
|
1034
1034
|
setLoading(false);
|
|
1035
1035
|
}
|
|
@@ -1048,38 +1048,38 @@ function RemoteSessionPage({ api }) {
|
|
|
1048
1048
|
setCurrentModel("");
|
|
1049
1049
|
setVisibleCount(RECENT_LIMIT);
|
|
1050
1050
|
setHistoryLoading(true);
|
|
1051
|
-
setStatus("
|
|
1051
|
+
setStatus("\u6B63\u5728\u8FDE\u63A5\u8FDC\u7A0B\u4F1A\u8BDD");
|
|
1052
1052
|
try {
|
|
1053
1053
|
const stream = api.followSession({ accountId, machineId, sessionId: session.id, cwd: session.cwd });
|
|
1054
1054
|
streamRef.current = stream;
|
|
1055
|
-
setStatus("
|
|
1055
|
+
setStatus("\u8FDC\u7A0B\u4F1A\u8BDD\u5DF2\u8FDE\u63A5");
|
|
1056
1056
|
for await (const frame of stream) {
|
|
1057
1057
|
setFrames((current) => [...current, frame]);
|
|
1058
|
-
if (frame.type === "ready" && !historyLoadedRef.current) setStatus("
|
|
1059
|
-
if (frame.type === "reconnecting") setStatus(frame.message || "
|
|
1058
|
+
if (frame.type === "ready" && !historyLoadedRef.current) setStatus("\u6B63\u5728\u56DE\u653E\u4F1A\u8BDD\u5386\u53F2");
|
|
1059
|
+
if (frame.type === "reconnecting") setStatus(frame.message || "\u6B63\u5728\u91CD\u8FDE\u8FDC\u7A0B runtime");
|
|
1060
1060
|
if (frame.type === "history_loaded") {
|
|
1061
1061
|
historyLoadedRef.current = true;
|
|
1062
|
-
setStatus("
|
|
1062
|
+
setStatus("\u5386\u53F2\u5DF2\u52A0\u8F7D");
|
|
1063
1063
|
setHistoryLoading(false);
|
|
1064
1064
|
if (frame.model) setCurrentModel(frame.model);
|
|
1065
1065
|
}
|
|
1066
1066
|
if (frame.type === "history_incomplete") {
|
|
1067
|
-
setStatus("
|
|
1067
|
+
setStatus("\u5386\u53F2\u4E0D\u5B8C\u6574\uFF1A" + (frame.message || "\u56DE\u653E\u88AB\u4E2D\u65AD"));
|
|
1068
1068
|
setHistoryLoading(false);
|
|
1069
1069
|
}
|
|
1070
1070
|
if (frame.type === "model_switched") {
|
|
1071
1071
|
if (frame.data?.model) setCurrentModel(frame.data.model);
|
|
1072
1072
|
setSwitchingModel(false);
|
|
1073
|
-
setStatus("
|
|
1073
|
+
setStatus("\u6A21\u578B\u5DF2\u5207\u6362");
|
|
1074
1074
|
}
|
|
1075
1075
|
if (frame.type === "model_switch_failed") {
|
|
1076
1076
|
setSwitchingModel(false);
|
|
1077
|
-
setError(frame.message || "
|
|
1078
|
-
setStatus("
|
|
1077
|
+
setError(frame.message || "\u6A21\u578B\u5207\u6362\u88AB\u62D2\u7EDD");
|
|
1078
|
+
setStatus("\u6A21\u578B\u5207\u6362\u5931\u8D25");
|
|
1079
1079
|
}
|
|
1080
1080
|
if (frame.type === "session_missing") {
|
|
1081
|
-
setError(frame.message || "
|
|
1082
|
-
setStatus("
|
|
1081
|
+
setError(frame.message || "\u8BE5\u4F1A\u8BDD\u5728\u6240\u9009\u8BBE\u5907\u4E0A\u5DF2\u4E0D\u5B58\u5728\u3002");
|
|
1082
|
+
setStatus("\u8BBE\u5907\u4E0A\u627E\u4E0D\u5230\u8BE5\u4F1A\u8BDD");
|
|
1083
1083
|
setHistoryLoading(false);
|
|
1084
1084
|
}
|
|
1085
1085
|
if (frame.type === "request") {
|
|
@@ -1092,31 +1092,31 @@ function RemoteSessionPage({ api }) {
|
|
|
1092
1092
|
setStopping(false);
|
|
1093
1093
|
if (accepted) {
|
|
1094
1094
|
const cancelled = frame.data?.result?.stopReason === "cancelled";
|
|
1095
|
-
setStatus(cancelled ? "
|
|
1095
|
+
setStatus(cancelled ? "\u56DE\u5408\u5DF2\u505C\u6B62" : "\u56DE\u5408\u5DF2\u5B8C\u6210");
|
|
1096
1096
|
} else {
|
|
1097
1097
|
setPrompt((current) => current === "" ? lastDraftRef.current || "" : current);
|
|
1098
|
-
setStatus("MonkeyAI
|
|
1098
|
+
setStatus("MonkeyAI \u672A\u63A5\u53D7\u8BE5\u6307\u4EE4\uFF0C\u8349\u7A3F\u5DF2\u4FDD\u7559");
|
|
1099
1099
|
if (frame.message) setError(frame.message);
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
1102
|
if (frame.type === "cancel_sent") {
|
|
1103
1103
|
setStopping(false);
|
|
1104
|
-
setStatus("
|
|
1104
|
+
setStatus("\u5DF2\u8BF7\u6C42\u505C\u6B62\uFF0C\u7B49\u5F85 runtime \u53D6\u6D88");
|
|
1105
1105
|
}
|
|
1106
1106
|
if (frame.type === "response_sent") {
|
|
1107
1107
|
setPendingRequests((current) => current.filter((item) => item.requestId !== frame.requestId));
|
|
1108
1108
|
}
|
|
1109
1109
|
if (frame.type === "response_error") {
|
|
1110
|
-
setError(
|
|
1110
|
+
setError(`\u8FDC\u7A0B\u56DE\u590D\u88AB\u62D2\u7EDD\uFF1A${frame.code || "\u672A\u77E5"}`);
|
|
1111
1111
|
}
|
|
1112
|
-
if (frame.type === "error") setError(frame.message || frame.code || "
|
|
1112
|
+
if (frame.type === "error") setError(frame.message || frame.code || "\u8FDC\u7A0B\u4F1A\u8BDD\u9519\u8BEF");
|
|
1113
1113
|
}
|
|
1114
|
-
setStatus("
|
|
1114
|
+
setStatus("\u8FDC\u7A0B\u4F1A\u8BDD\u5DF2\u65AD\u5F00");
|
|
1115
1115
|
setHistoryLoading(false);
|
|
1116
1116
|
setTurnActive(false);
|
|
1117
1117
|
setStopping(false);
|
|
1118
1118
|
} catch (reason) {
|
|
1119
|
-
setStatus("
|
|
1119
|
+
setStatus("\u8FDC\u7A0B\u4F1A\u8BDD\u4E0D\u53EF\u7528");
|
|
1120
1120
|
setError(errorText(reason));
|
|
1121
1121
|
setHistoryLoading(false);
|
|
1122
1122
|
setTurnActive(false);
|
|
@@ -1134,7 +1134,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1134
1134
|
setPrompt("");
|
|
1135
1135
|
setTurnActive(true);
|
|
1136
1136
|
setStopping(false);
|
|
1137
|
-
setStatus("
|
|
1137
|
+
setStatus("\u6307\u4EE4\u5DF2\u53D1\u9001\uFF0CMonkeyAI \u6B63\u5728\u5904\u7406");
|
|
1138
1138
|
} catch (reason) {
|
|
1139
1139
|
setError(errorText(reason));
|
|
1140
1140
|
}
|
|
@@ -1145,14 +1145,14 @@ function RemoteSessionPage({ api }) {
|
|
|
1145
1145
|
try {
|
|
1146
1146
|
stream.send({ type: "cancel" });
|
|
1147
1147
|
setStopping(true);
|
|
1148
|
-
setStatus("
|
|
1148
|
+
setStatus("\u505C\u6B62\u4E2D\u2026");
|
|
1149
1149
|
} catch (reason) {
|
|
1150
1150
|
setError(errorText(reason));
|
|
1151
1151
|
}
|
|
1152
1152
|
}
|
|
1153
1153
|
function respond(request, result) {
|
|
1154
1154
|
if (!hasControl) {
|
|
1155
|
-
setError("MonkeyAI
|
|
1155
|
+
setError("\u56DE\u590D MonkeyAI \u9700\u8981 session:control \u6743\u9650");
|
|
1156
1156
|
return;
|
|
1157
1157
|
}
|
|
1158
1158
|
try {
|
|
@@ -1182,7 +1182,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1182
1182
|
setCallbackUrl("");
|
|
1183
1183
|
setAuthorizationUrl("");
|
|
1184
1184
|
setAuthorizationMode("");
|
|
1185
|
-
setStatus("
|
|
1185
|
+
setStatus("\u672A\u8FDE\u63A5");
|
|
1186
1186
|
setAddingServer(false);
|
|
1187
1187
|
} catch (reason) {
|
|
1188
1188
|
setError(errorText(reason));
|
|
@@ -1233,7 +1233,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1233
1233
|
setDevices((current) => [entry, ...current.filter((item) => item.machineId !== machineId2)]);
|
|
1234
1234
|
setMachineId((current) => current || machineId2);
|
|
1235
1235
|
}
|
|
1236
|
-
setStatus(
|
|
1236
|
+
setStatus(`\u5DF2\u6DFB\u52A0\u8BBE\u5907 ${entry.displayName}`);
|
|
1237
1237
|
}
|
|
1238
1238
|
function removeManualDevice(machineId2) {
|
|
1239
1239
|
saveManualDevices(loadManualDevices().filter((item) => item.machineId !== machineId2));
|
|
@@ -1249,14 +1249,14 @@ function RemoteSessionPage({ api }) {
|
|
|
1249
1249
|
if (created.model) setCurrentModel(created.model);
|
|
1250
1250
|
setRuntimeSessions((current) => {
|
|
1251
1251
|
if (current.some((item) => item.id === created.sessionId)) return current;
|
|
1252
|
-
return [{ id: created.sessionId, title: created.title || "
|
|
1252
|
+
return [{ id: created.sessionId, title: created.title || "\u65B0\u5EFA\u8FDC\u7A0B\u4F1A\u8BDD", cwd: created.cwd }, ...current];
|
|
1253
1253
|
});
|
|
1254
1254
|
setSummarySessions((current) => current.filter((item) => item.id !== created.sessionId));
|
|
1255
|
-
setStatus("
|
|
1256
|
-
await openSession({ id: created.sessionId, title: created.title || "
|
|
1255
|
+
setStatus("\u4F1A\u8BDD\u5DF2\u521B\u5EFA");
|
|
1256
|
+
await openSession({ id: created.sessionId, title: created.title || "\u65B0\u5EFA\u8FDC\u7A0B\u4F1A\u8BDD", cwd: created.cwd });
|
|
1257
1257
|
} catch (reason) {
|
|
1258
1258
|
setError(errorText(reason));
|
|
1259
|
-
setStatus("
|
|
1259
|
+
setStatus("\u65E0\u6CD5\u521B\u5EFA\u8FDC\u7A0B\u4F1A\u8BDD");
|
|
1260
1260
|
} finally {
|
|
1261
1261
|
setNewSessionBusy(false);
|
|
1262
1262
|
}
|
|
@@ -1269,10 +1269,10 @@ function RemoteSessionPage({ api }) {
|
|
|
1269
1269
|
setSwitchingModel(true);
|
|
1270
1270
|
try {
|
|
1271
1271
|
stream.send({ type: "switch_model", model: modelId });
|
|
1272
|
-
setStatus("
|
|
1272
|
+
setStatus("\u6B63\u5728\u5207\u6362\u6A21\u578B\u2026");
|
|
1273
1273
|
} catch (reason) {
|
|
1274
1274
|
setError(errorText(reason));
|
|
1275
|
-
setStatus("
|
|
1275
|
+
setStatus("\u6A21\u578B\u5207\u6362\u5931\u8D25");
|
|
1276
1276
|
setSwitchingModel(false);
|
|
1277
1277
|
}
|
|
1278
1278
|
}
|
|
@@ -1330,7 +1330,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1330
1330
|
"div",
|
|
1331
1331
|
{ style: { display: "flex", alignItems: "center", gap: 8 } },
|
|
1332
1332
|
h(MonkeyIcon, { size: 22 }),
|
|
1333
|
-
h("h1", { style: style.title }, "MonkeyAI
|
|
1333
|
+
h("h1", { style: style.title }, "MonkeyAI \u4F1A\u8BDD")
|
|
1334
1334
|
),
|
|
1335
1335
|
h(StatusBadge, { status, live: isLive })
|
|
1336
1336
|
),
|
|
@@ -1340,7 +1340,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1340
1340
|
h("span", { style: { flex: 1 } }, error),
|
|
1341
1341
|
h("button", {
|
|
1342
1342
|
type: "button",
|
|
1343
|
-
"aria-label": "
|
|
1343
|
+
"aria-label": "\u5173\u95ED\u9519\u8BEF\u63D0\u793A",
|
|
1344
1344
|
onClick: () => setError(""),
|
|
1345
1345
|
style: { border: 0, background: "transparent", cursor: "pointer", color: t.danger, fontWeight: 700, padding: "0 2px", fontSize: 13 }
|
|
1346
1346
|
}, "\xD7")
|
|
@@ -1351,12 +1351,12 @@ function RemoteSessionPage({ api }) {
|
|
|
1351
1351
|
addingServer && !authorizing ? h(
|
|
1352
1352
|
"div",
|
|
1353
1353
|
{ style: style.row },
|
|
1354
|
-
h("h2", { style: { ...style.sectionTitle, flex: 1 } }, "
|
|
1354
|
+
h("h2", { style: { ...style.sectionTitle, flex: 1 } }, "\u6DFB\u52A0 MonkeyAI \u670D\u52A1\u5668"),
|
|
1355
1355
|
h("button", { type: "button", style: style.button, onClick: () => {
|
|
1356
1356
|
setAddingServer(false);
|
|
1357
1357
|
setServerAddress(currentAccount?.serverOrigin || "");
|
|
1358
|
-
setStatus("MonkeyAI
|
|
1359
|
-
} }, "
|
|
1358
|
+
setStatus("MonkeyAI \u8D26\u53F7\u5DF2\u8FDE\u63A5");
|
|
1359
|
+
} }, "\u53D6\u6D88")
|
|
1360
1360
|
) : null,
|
|
1361
1361
|
authorizing ? h(
|
|
1362
1362
|
import_react.default.Fragment,
|
|
@@ -1364,15 +1364,15 @@ function RemoteSessionPage({ api }) {
|
|
|
1364
1364
|
h(
|
|
1365
1365
|
"div",
|
|
1366
1366
|
{ style: style.row },
|
|
1367
|
-
h("h2", { style: { ...style.sectionTitle, flex: 1 } }, addingServer ? "
|
|
1367
|
+
h("h2", { style: { ...style.sectionTitle, flex: 1 } }, addingServer ? "\u6B63\u5728\u6388\u6743\u65B0\u670D\u52A1\u5668" : "\u7B49\u5F85\u6388\u6743"),
|
|
1368
1368
|
addingServer ? h("button", { type: "button", style: style.button, onClick: () => {
|
|
1369
1369
|
setAuthorizationRequestId("");
|
|
1370
1370
|
setAuthorizationUrl("");
|
|
1371
1371
|
setAuthorizationMode("");
|
|
1372
1372
|
setCallbackUrl("");
|
|
1373
1373
|
setAddingServer(false);
|
|
1374
|
-
setStatus("MonkeyAI
|
|
1375
|
-
} }, "
|
|
1374
|
+
setStatus("MonkeyAI \u8D26\u53F7\u5DF2\u8FDE\u63A5");
|
|
1375
|
+
} }, "\u53D6\u6D88") : null
|
|
1376
1376
|
),
|
|
1377
1377
|
h(
|
|
1378
1378
|
"ol",
|
|
@@ -1380,20 +1380,20 @@ function RemoteSessionPage({ api }) {
|
|
|
1380
1380
|
h(
|
|
1381
1381
|
"li",
|
|
1382
1382
|
null,
|
|
1383
|
-
"
|
|
1383
|
+
"\u6253\u5F00\u6388\u6743\u9875\u5E76\u5728 MonkeyAI \u4E2D\u6279\u51C6\u8BBF\u95EE\u3002",
|
|
1384
1384
|
h(
|
|
1385
1385
|
"span",
|
|
1386
1386
|
{ style: style.row, title: authorizationUrl },
|
|
1387
|
-
h("a", { href: authorizationUrl, target: "_blank", rel: "noopener noreferrer", style: { color: t.accent, fontWeight: 600, fontSize: 12 } }, "
|
|
1388
|
-
h("button", { type: "button", style: style.button, onClick: copyAuthorizationUrl }, copied ? "
|
|
1387
|
+
h("a", { href: authorizationUrl, target: "_blank", rel: "noopener noreferrer", style: { color: t.accent, fontWeight: 600, fontSize: 12 } }, "\u6253\u5F00\u6388\u6743\u9875"),
|
|
1388
|
+
h("button", { type: "button", style: style.button, onClick: copyAuthorizationUrl }, copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236\u94FE\u63A5")
|
|
1389
1389
|
)
|
|
1390
1390
|
),
|
|
1391
|
-
authorizationMode === "loopback" ? h("li", null, "
|
|
1391
|
+
authorizationMode === "loopback" ? h("li", null, "\u5728\u6D4F\u89C8\u5668\u4E2D\u6279\u51C6\u540E\u9762\u677F\u4F1A\u81EA\u52A8\u5B8C\u6210\u3002\u82E5\u6D4F\u89C8\u5668\u65E0\u6CD5\u56DE\u4F20\u5230 DSH\uFF0C\u8BF7\u590D\u5236\u56DE\u8C03 URL \u7C98\u8D34\u5230\u4E0B\u65B9\u3002") : h("li", null, "\u6279\u51C6\u540E\u6D4F\u89C8\u5668\u4F1A\u663E\u793A monkeyai-desktop:// \u56DE\u8C03\uFF0C\u590D\u5236\u5730\u5740\u680F\u5B8C\u6574 URL \u7C98\u8D34\u5230\u4E0B\u65B9\u3002")
|
|
1392
1392
|
),
|
|
1393
1393
|
h(
|
|
1394
1394
|
"details",
|
|
1395
1395
|
{ style: style.details },
|
|
1396
|
-
h("summary", { style: style.summary }, "
|
|
1396
|
+
h("summary", { style: style.summary }, "\u6CA1\u6709\u81EA\u52A8\u5B8C\u6210\uFF1F\u624B\u52A8\u7C98\u8D34\u56DE\u8C03"),
|
|
1397
1397
|
h(
|
|
1398
1398
|
"div",
|
|
1399
1399
|
{ style: { ...style.row, paddingTop: 8 } },
|
|
@@ -1404,13 +1404,13 @@ function RemoteSessionPage({ api }) {
|
|
|
1404
1404
|
style: { ...style.input, flex: "1 1 260px" },
|
|
1405
1405
|
onChange: (event) => setCallbackUrl(event.target.value)
|
|
1406
1406
|
}),
|
|
1407
|
-
h("button", { type: "button", style: style.primaryButton, disabled: loading || !callbackUrl, onClick: completeAuthorization }, "
|
|
1407
|
+
h("button", { type: "button", style: style.primaryButton, disabled: loading || !callbackUrl, onClick: completeAuthorization }, "\u5B8C\u6210\u6388\u6743")
|
|
1408
1408
|
)
|
|
1409
1409
|
)
|
|
1410
1410
|
) : h(
|
|
1411
1411
|
import_react.default.Fragment,
|
|
1412
1412
|
null,
|
|
1413
|
-
h("h2", { style: style.sectionTitle }, "
|
|
1413
|
+
h("h2", { style: style.sectionTitle }, "\u8FDE\u63A5 MonkeyAI"),
|
|
1414
1414
|
h(
|
|
1415
1415
|
"form",
|
|
1416
1416
|
{
|
|
@@ -1422,7 +1422,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1422
1422
|
},
|
|
1423
1423
|
h(
|
|
1424
1424
|
Field,
|
|
1425
|
-
{ labelText: "MonkeyAI
|
|
1425
|
+
{ labelText: "MonkeyAI \u670D\u52A1\u5668\u5730\u5740" },
|
|
1426
1426
|
h("input", {
|
|
1427
1427
|
type: "url",
|
|
1428
1428
|
value: serverAddress,
|
|
@@ -1434,7 +1434,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1434
1434
|
),
|
|
1435
1435
|
h(
|
|
1436
1436
|
Field,
|
|
1437
|
-
{ labelText: "
|
|
1437
|
+
{ labelText: "\u8D26\u53F7\u90AE\u7BB1" },
|
|
1438
1438
|
h("input", {
|
|
1439
1439
|
type: "email",
|
|
1440
1440
|
value: signInEmail,
|
|
@@ -1446,11 +1446,11 @@ function RemoteSessionPage({ api }) {
|
|
|
1446
1446
|
),
|
|
1447
1447
|
h(
|
|
1448
1448
|
Field,
|
|
1449
|
-
{ labelText: "
|
|
1449
|
+
{ labelText: "\u5BC6\u7801" },
|
|
1450
1450
|
h("input", {
|
|
1451
1451
|
type: "password",
|
|
1452
1452
|
value: signInPassword,
|
|
1453
|
-
placeholder: "MonkeyAI
|
|
1453
|
+
placeholder: "MonkeyAI \u8D26\u53F7\u5BC6\u7801",
|
|
1454
1454
|
style: style.input,
|
|
1455
1455
|
autoComplete: "current-password",
|
|
1456
1456
|
onChange: (event) => setSignInPassword(event.target.value)
|
|
@@ -1460,26 +1460,26 @@ function RemoteSessionPage({ api }) {
|
|
|
1460
1460
|
type: "submit",
|
|
1461
1461
|
style: style.primaryButton,
|
|
1462
1462
|
disabled: loading || !serverAddress || !signInEmail.trim() || signInPassword === ""
|
|
1463
|
-
}, loading ? "
|
|
1463
|
+
}, loading ? "\u767B\u5F55\u4E2D\u2026" : "\u767B\u5F55"),
|
|
1464
1464
|
h(
|
|
1465
1465
|
"p",
|
|
1466
1466
|
{ style: { margin: 0, fontSize: 11.5, color: t.text3 } },
|
|
1467
|
-
"
|
|
1467
|
+
"\u767B\u5F55\u5728 DSH Host \u4E0A\u5B8C\u6210\uFF0C\u624B\u673A\u540C\u6837\u53EF\u7528\u3002\u5BC6\u7801\u4EC5\u7528\u4E8E\u672C\u6B21\u6388\u6743\uFF0C\u4E0D\u4F1A\u88AB\u5B58\u50A8\u3002"
|
|
1468
1468
|
)
|
|
1469
1469
|
),
|
|
1470
1470
|
h(
|
|
1471
1471
|
"details",
|
|
1472
1472
|
{ style: style.details },
|
|
1473
|
-
h("summary", { style: style.summary }, "
|
|
1473
|
+
h("summary", { style: style.summary }, "\u6539\u7528\u6D4F\u89C8\u5668\u6388\u6743"),
|
|
1474
1474
|
h(
|
|
1475
1475
|
"div",
|
|
1476
1476
|
{ style: { display: "grid", gap: 8, paddingTop: 8 } },
|
|
1477
|
-
h("button", { type: "button", style: style.button, disabled: loading || !serverAddress, onClick: () => beginAuthorization("loopback") }, "
|
|
1478
|
-
h("button", { type: "button", style: style.button, disabled: loading || !serverAddress, onClick: () => beginAuthorization("scheme") }, "
|
|
1479
|
-
h("p", { style: { margin: 0, fontSize: 12, color: t.text3 } }, "
|
|
1477
|
+
h("button", { type: "button", style: style.button, disabled: loading || !serverAddress, onClick: () => beginAuthorization("loopback") }, "\u5728\u6D4F\u89C8\u5668\u4E2D\u6388\u6743"),
|
|
1478
|
+
h("button", { type: "button", style: style.button, disabled: loading || !serverAddress, onClick: () => beginAuthorization("scheme") }, "\u6388\u6743\uFF08\u7C98\u8D34\u56DE\u8C03\uFF09"),
|
|
1479
|
+
h("p", { style: { margin: 0, fontSize: 12, color: t.text3 } }, "\u6D4F\u89C8\u5668\u6388\u6743\u9700\u8981\u56DE\u8C03\u80FD\u8BBF\u95EE\u5230\u672C\u673A Host\u3002\u624B\u673A\u4E0A\u8BF7\u6539\u7528\u4E0A\u65B9\u8D26\u53F7\u767B\u5F55\u3002")
|
|
1480
1480
|
)
|
|
1481
1481
|
),
|
|
1482
|
-
accounts.length > 0 ? h("p", { style: { margin: 0, fontSize: 12, color: t.text3 } }, "
|
|
1482
|
+
accounts.length > 0 ? h("p", { style: { margin: 0, fontSize: 12, color: t.text3 } }, "\u5DF2\u8FDE\u63A5\u7684\u8D26\u53F7\u4F1A\u51FA\u73B0\u5728\u8BBE\u5907\u5217\u8868\u4E0A\u65B9\u7684\u8D26\u53F7\u9009\u62E9\u5668\u4E2D\u3002") : null
|
|
1483
1483
|
)
|
|
1484
1484
|
) : null,
|
|
1485
1485
|
currentAccount ? h(
|
|
@@ -1488,7 +1488,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1488
1488
|
h(
|
|
1489
1489
|
"div",
|
|
1490
1490
|
{ style: style.row },
|
|
1491
|
-
h("h2", { style: { ...style.sectionTitle, flex: 1 } }, "
|
|
1491
|
+
h("h2", { style: { ...style.sectionTitle, flex: 1 } }, "\u8FDC\u7A0B\u4F1A\u8BDD"),
|
|
1492
1492
|
h("span", { style: { fontSize: 11, color: t.text3 } }, currentAccount.scopes.filter((s) => s !== "device:connect").join(" \xB7 "))
|
|
1493
1493
|
),
|
|
1494
1494
|
h(
|
|
@@ -1496,7 +1496,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1496
1496
|
{ style: style.row },
|
|
1497
1497
|
h(
|
|
1498
1498
|
"select",
|
|
1499
|
-
{ style: { ...style.input, flex: "1 1 200px" }, value: accountId, onChange: (event) => setAccountId(event.target.value), "aria-label": "
|
|
1499
|
+
{ style: { ...style.input, flex: "1 1 200px" }, value: accountId, onChange: (event) => setAccountId(event.target.value), "aria-label": "\u5DF2\u6388\u6743\u8D26\u53F7" },
|
|
1500
1500
|
accounts.map((account) => h("option", { key: account.accountId, value: account.accountId }, account.serverOrigin))
|
|
1501
1501
|
),
|
|
1502
1502
|
h("button", { type: "button", style: { ...style.button, flex: "0 0 auto", padding: "6px 10px", fontWeight: 700 }, disabled: loading || addingServer, onClick: () => {
|
|
@@ -1506,22 +1506,22 @@ function RemoteSessionPage({ api }) {
|
|
|
1506
1506
|
setAuthorizationUrl("");
|
|
1507
1507
|
setAuthorizationMode("");
|
|
1508
1508
|
setCallbackUrl("");
|
|
1509
|
-
setStatus("
|
|
1510
|
-
}, title: "
|
|
1509
|
+
setStatus("\u8BF7\u8F93\u5165 MonkeyAI \u670D\u52A1\u5668\u5730\u5740");
|
|
1510
|
+
}, title: "\u6388\u6743\u53E6\u4E00\u4E2A MonkeyAI \u670D\u52A1\u5668" }, "+ \u6DFB\u52A0\u670D\u52A1\u5668"),
|
|
1511
1511
|
h(
|
|
1512
1512
|
"select",
|
|
1513
1513
|
{ style: { ...style.input, flex: "1 1 220px" }, value: machineId, onChange: (event) => {
|
|
1514
1514
|
const next = event.target.value;
|
|
1515
1515
|
setMachineId(next);
|
|
1516
1516
|
if (next) void loadSessions(next);
|
|
1517
|
-
}, "aria-label": "
|
|
1518
|
-
h("option", { value: "" }, "
|
|
1519
|
-
allDevices.map((device) => h("option", { key: device.machineId, value: device.machineId }, `${device.displayName}${device.status === "online" ? "" : ` \xB7 ${device.status}`}${device.stale ? " \xB7
|
|
1517
|
+
}, "aria-label": "\u8FDC\u7A0B\u8BBE\u5907" },
|
|
1518
|
+
h("option", { value: "" }, "\u9009\u62E9\u8BBE\u5907"),
|
|
1519
|
+
allDevices.map((device) => h("option", { key: device.machineId, value: device.machineId }, `${device.displayName}${device.status === "online" ? "" : ` \xB7 ${device.status === "offline" ? "\u79BB\u7EBF" : device.status}`}${device.stale ? " \xB7 \u5DF2\u8FC7\u671F" : ""}`))
|
|
1520
1520
|
),
|
|
1521
|
-
h("button", { type: "button", style: style.button, disabled: loading, onClick: machineId ? () => loadSessions() : loadDevices, title: machineId ? "
|
|
1522
|
-
h("button", { type: "button", style: style.dangerButton, disabled: !accountId, onClick: disconnectAccount, title: "
|
|
1521
|
+
h("button", { type: "button", style: style.button, disabled: loading, onClick: machineId ? () => loadSessions() : loadDevices, title: machineId ? "\u5237\u65B0\u4F1A\u8BDD" : "\u5237\u65B0\u8BBE\u5907" }, "\u5237\u65B0"),
|
|
1522
|
+
h("button", { type: "button", style: style.dangerButton, disabled: !accountId, onClick: disconnectAccount, title: "\u64A4\u9500\u8BE5\u8D26\u53F7\u6388\u6743" }, "\u65AD\u5F00\u8FDE\u63A5")
|
|
1523
1523
|
),
|
|
1524
|
-
!hasRead ? h("p", { style: { margin: 0, fontSize: 12, color: t.text3 } }, "session:read
|
|
1524
|
+
!hasRead ? h("p", { style: { margin: 0, fontSize: 12, color: t.text3 } }, "\u5217\u51FA\u548C\u8BFB\u53D6\u8FDC\u7A0B\u4F1A\u8BDD\u9700\u8981 session:read \u6743\u9650\u3002") : null,
|
|
1525
1525
|
manualDevices.length > 0 ? h(
|
|
1526
1526
|
"div",
|
|
1527
1527
|
{ style: style.row },
|
|
@@ -1532,7 +1532,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1532
1532
|
h("button", {
|
|
1533
1533
|
type: "button",
|
|
1534
1534
|
style: { border: 0, background: "transparent", cursor: "pointer", padding: 0, color: t.danger, fontWeight: 700, fontSize: 12 },
|
|
1535
|
-
"aria-label":
|
|
1535
|
+
"aria-label": `\u79FB\u9664 ${device.displayName}`,
|
|
1536
1536
|
onClick: () => removeManualDevice(device.machineId)
|
|
1537
1537
|
}, "\xD7")
|
|
1538
1538
|
))
|
|
@@ -1540,7 +1540,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1540
1540
|
h(
|
|
1541
1541
|
"details",
|
|
1542
1542
|
{ style: style.details },
|
|
1543
|
-
h("summary", { style: style.summary }, "
|
|
1543
|
+
h("summary", { style: style.summary }, "\u627E\u4E0D\u5230\u8BBE\u5907\uFF1F\u6309 machine ID \u6DFB\u52A0"),
|
|
1544
1544
|
h(
|
|
1545
1545
|
"div",
|
|
1546
1546
|
{ style: { display: "grid", gap: 8, paddingTop: 8 } },
|
|
@@ -1550,23 +1550,23 @@ function RemoteSessionPage({ api }) {
|
|
|
1550
1550
|
h("input", {
|
|
1551
1551
|
style: { ...style.input, flex: "2 1 200px" },
|
|
1552
1552
|
value: manualDeviceId,
|
|
1553
|
-
placeholder: "Machine ID
|
|
1553
|
+
placeholder: "Machine ID\uFF0C\u4F8B\u5982 6f1c2a34-... \u6216 headless-host-01",
|
|
1554
1554
|
onChange: (event) => setManualDeviceId(event.target.value)
|
|
1555
1555
|
}),
|
|
1556
1556
|
h("input", {
|
|
1557
1557
|
style: { ...style.input, flex: "1 1 140px" },
|
|
1558
1558
|
value: manualDeviceName,
|
|
1559
|
-
placeholder: "
|
|
1559
|
+
placeholder: "\u663E\u793A\u540D\u79F0\uFF08\u53EF\u9009\uFF09",
|
|
1560
1560
|
onChange: (event) => setManualDeviceName(event.target.value)
|
|
1561
1561
|
}),
|
|
1562
|
-
h("button", { type: "button", style: style.button, disabled: !manualDeviceId.trim(), onClick: addManualDevice }, "
|
|
1562
|
+
h("button", { type: "button", style: style.button, disabled: !manualDeviceId.trim(), onClick: addManualDevice }, "\u6DFB\u52A0")
|
|
1563
1563
|
)
|
|
1564
1564
|
)
|
|
1565
1565
|
),
|
|
1566
1566
|
h(
|
|
1567
1567
|
"details",
|
|
1568
1568
|
{ style: style.details },
|
|
1569
|
-
h("summary", { style: style.summary }, "
|
|
1569
|
+
h("summary", { style: style.summary }, "\u65B0\u5EFA\u8FDC\u7A0B\u4F1A\u8BDD"),
|
|
1570
1570
|
h(
|
|
1571
1571
|
"div",
|
|
1572
1572
|
{ style: { display: "grid", gap: 8, paddingTop: 8 } },
|
|
@@ -1576,7 +1576,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1576
1576
|
h("input", {
|
|
1577
1577
|
style: { ...style.input, flex: "2 1 200px" },
|
|
1578
1578
|
value: newSessionCwd,
|
|
1579
|
-
placeholder: "
|
|
1579
|
+
placeholder: "\u5DE5\u4F5C\u76EE\u5F55\uFF0C\u4F8B\u5982 /root",
|
|
1580
1580
|
onChange: (event) => setNewSessionCwd(event.target.value)
|
|
1581
1581
|
}),
|
|
1582
1582
|
h("select", {
|
|
@@ -1584,7 +1584,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1584
1584
|
value: selectedModel,
|
|
1585
1585
|
disabled: models.length === 0,
|
|
1586
1586
|
onChange: (event) => setSelectedModel(event.target.value),
|
|
1587
|
-
"aria-label": "
|
|
1587
|
+
"aria-label": "\u65B0\u4F1A\u8BDD\u4F7F\u7528\u7684\u6A21\u578B"
|
|
1588
1588
|
}, models.map((m) => h("option", { key: m.id, value: m.id }, m.displayName))),
|
|
1589
1589
|
h("button", {
|
|
1590
1590
|
type: "button",
|
|
@@ -1592,12 +1592,12 @@ function RemoteSessionPage({ api }) {
|
|
|
1592
1592
|
flex: "0 0 auto",
|
|
1593
1593
|
disabled: loading || !machineId || !newSessionCwd.trim() || newSessionBusy,
|
|
1594
1594
|
onClick: createRemoteSession
|
|
1595
|
-
}, newSessionBusy ? "
|
|
1595
|
+
}, newSessionBusy ? "\u521B\u5EFA\u4E2D\u2026" : "\u521B\u5EFA")
|
|
1596
1596
|
)
|
|
1597
1597
|
)
|
|
1598
1598
|
),
|
|
1599
1599
|
sessionOptions.length > 0 ? h("div", { style: style.sessions }, sessionOptions.map((session) => {
|
|
1600
|
-
const flag = session.stale ? "
|
|
1600
|
+
const flag = session.stale ? "\u5DF2\u8FC7\u671F" : session.deviceStatus && session.deviceStatus !== "online" ? session.deviceStatus === "offline" ? "\u79BB\u7EBF" : session.deviceStatus : "";
|
|
1601
1601
|
return h(
|
|
1602
1602
|
"button",
|
|
1603
1603
|
{
|
|
@@ -1607,13 +1607,13 @@ function RemoteSessionPage({ api }) {
|
|
|
1607
1607
|
type: "button",
|
|
1608
1608
|
disabled: !session.cwd,
|
|
1609
1609
|
onClick: () => openSession(session),
|
|
1610
|
-
title: session.cwd ?
|
|
1610
|
+
title: session.cwd ? `\u6253\u5F00 ${session.cwd}` : "ACP \u4F1A\u8BDD\u5217\u8868\u672A\u63D0\u4F9B\u5DE5\u4F5C\u76EE\u5F55"
|
|
1611
1611
|
},
|
|
1612
1612
|
h("span", { style: style.sessionTitle }, session.title || session.id),
|
|
1613
|
-
h("span", { style: style.sessionMeta }, session.cwd || "
|
|
1613
|
+
h("span", { style: style.sessionMeta }, session.cwd || "\u52A0\u8F7D\u5386\u53F2\u9700\u8981 runtime \u63D0\u4F9B\u5DE5\u4F5C\u76EE\u5F55"),
|
|
1614
1614
|
flag !== "" ? h("span", { style: { fontSize: 10.5, fontWeight: 650, color: session.stale ? t.text3 : "#8a6d1d", textTransform: "uppercase", letterSpacing: "0.04em" } }, flag) : null
|
|
1615
1615
|
);
|
|
1616
|
-
})) : h("p", { style: style.subtitle }, machineId ? "
|
|
1616
|
+
})) : h("p", { style: style.subtitle }, machineId ? "\u8BE5\u8BBE\u5907\u6682\u65E0\u4F1A\u8BDD\u3002\u53EF\u5728\u4E0A\u65B9\u65B0\u5EFA\uFF0C\u6216\u70B9\u51FB\u5237\u65B0\u3002" : "\u8BF7\u9009\u62E9\u8BBE\u5907\u4EE5\u5217\u51FA\u5176\u4F1A\u8BDD\u3002")
|
|
1617
1617
|
) : null,
|
|
1618
1618
|
sessionId ? h(
|
|
1619
1619
|
"section",
|
|
@@ -1624,14 +1624,14 @@ function RemoteSessionPage({ api }) {
|
|
|
1624
1624
|
h("button", {
|
|
1625
1625
|
type: "button",
|
|
1626
1626
|
style: { ...style.button, flexShrink: 0 },
|
|
1627
|
-
title: "
|
|
1627
|
+
title: "\u5173\u95ED\u4F1A\u8BDD\u5E76\u8FD4\u56DE\u5217\u8868",
|
|
1628
1628
|
onClick: () => {
|
|
1629
1629
|
streamRef.current?.dispose();
|
|
1630
1630
|
streamRef.current = null;
|
|
1631
1631
|
setSessionId("");
|
|
1632
1632
|
setTurnActive(false);
|
|
1633
1633
|
setStopping(false);
|
|
1634
|
-
setStatus("
|
|
1634
|
+
setStatus("\u8FDC\u7A0B\u4F1A\u8BDD\u5DF2\u5173\u95ED");
|
|
1635
1635
|
}
|
|
1636
1636
|
}, "\u2190"),
|
|
1637
1637
|
h("strong", { style: { flex: 1, fontSize: 13.5, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, title }, title),
|
|
@@ -1641,7 +1641,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1641
1641
|
style: { ...style.input, flex: "0 1 190px", minWidth: 130 },
|
|
1642
1642
|
value: currentModel,
|
|
1643
1643
|
disabled: !hasControl || switchingModel || models.length === 0,
|
|
1644
|
-
title: "
|
|
1644
|
+
title: "\u5207\u6362\u8BE5\u4F1A\u8BDD\u7684\u6A21\u578B",
|
|
1645
1645
|
onChange: (event) => {
|
|
1646
1646
|
const next = event.target.value;
|
|
1647
1647
|
if (next && next !== currentModel) switchSessionModel(next);
|
|
@@ -1669,11 +1669,11 @@ function RemoteSessionPage({ api }) {
|
|
|
1669
1669
|
historyLoading ? h(
|
|
1670
1670
|
"div",
|
|
1671
1671
|
{ style: { fontSize: 12.5, color: t.text3, textAlign: "center", padding: "32px 12px" } },
|
|
1672
|
-
displayEntries.length > 0 ?
|
|
1672
|
+
displayEntries.length > 0 ? `\u6B63\u5728\u52A0\u8F7D\u4F1A\u8BDD\u5386\u53F2\u2026\uFF08\u5DF2\u52A0\u8F7D ${displayEntries.length} \u6761\uFF09` : "\u6B63\u5728\u52A0\u8F7D\u4F1A\u8BDD\u5386\u53F2\u2026"
|
|
1673
1673
|
) : h(
|
|
1674
1674
|
import_react.default.Fragment,
|
|
1675
1675
|
null,
|
|
1676
|
-
displayEntries.length > visibleCount ? h("div", { style: { fontSize: 11, color: t.text3, textAlign: "center", padding: "6px 0" } },
|
|
1676
|
+
displayEntries.length > visibleCount ? h("div", { style: { fontSize: 11, color: t.text3, textAlign: "center", padding: "6px 0" } }, `\u8FD8\u6709 ${displayEntries.length - visibleCount} \u6761\u66F4\u65E9\u7684\u6D88\u606F \u2014 \u5411\u4E0A\u6EDA\u52A8\u52A0\u8F7D`) : null,
|
|
1677
1677
|
displayEntries.slice(-visibleCount).map((entry) => {
|
|
1678
1678
|
if (entry.kind === "thought") {
|
|
1679
1679
|
return h(
|
|
@@ -1683,7 +1683,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1683
1683
|
h(
|
|
1684
1684
|
"details",
|
|
1685
1685
|
{ style: style.thought },
|
|
1686
|
-
h("summary", { style: style.thoughtSummary }, "
|
|
1686
|
+
h("summary", { style: style.thoughtSummary }, "\u601D\u8003\u8FC7\u7A0B"),
|
|
1687
1687
|
h("p", { style: { margin: "6px 0 0", whiteSpace: "pre-wrap", overflowWrap: "anywhere", color: "#5b4a72", fontStyle: "italic" } }, entry.text || "")
|
|
1688
1688
|
)
|
|
1689
1689
|
);
|
|
@@ -1703,7 +1703,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1703
1703
|
h("div", { style: { fontSize: 10.5, fontWeight: 700, letterSpacing: "0.04em", marginBottom: 3, opacity: 0.7, textTransform: "uppercase", color: isUser ? "rgba(255,255,255,0.85)" : t.text3 } }, entry.label),
|
|
1704
1704
|
isUser ? h("p", { style: { margin: 0, whiteSpace: "pre-wrap", overflowWrap: "anywhere" } }, entry.text || "") : h("div", { className: "mai-md" }, renderMarkdown(entry.text || ""))
|
|
1705
1705
|
),
|
|
1706
|
-
isUser ? h("div", { style: { ...style.avatar, background: avatarColor } }, "
|
|
1706
|
+
isUser ? h("div", { style: { ...style.avatar, background: avatarColor } }, "\u6211") : null
|
|
1707
1707
|
);
|
|
1708
1708
|
}
|
|
1709
1709
|
if (entry.kind === "tool") {
|
|
@@ -1717,8 +1717,8 @@ function RemoteSessionPage({ api }) {
|
|
|
1717
1717
|
h(
|
|
1718
1718
|
"summary",
|
|
1719
1719
|
{ style: { ...style.row, cursor: "pointer", userSelect: "none", listStyle: "none" } },
|
|
1720
|
-
h("span", { style: { fontSize: 10, fontWeight: 700, color: t.text3, textTransform: "uppercase", letterSpacing: "0.05em", flexShrink: 0 } }, "
|
|
1721
|
-
h("span", { style: { fontSize: 12.5, fontWeight: 600, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1, minWidth: 0 } }, entry.title || "
|
|
1720
|
+
h("span", { style: { fontSize: 10, fontWeight: 700, color: t.text3, textTransform: "uppercase", letterSpacing: "0.05em", flexShrink: 0 } }, "\u5DE5\u5177"),
|
|
1721
|
+
h("span", { style: { fontSize: 12.5, fontWeight: 600, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1, minWidth: 0 } }, entry.title || "\u6267\u884C\u4E2D"),
|
|
1722
1722
|
running ? h("span", { className: "mai-pulse", style: { ...style.dot, width: 6, height: 6, background: "#d4a72c" } }) : null,
|
|
1723
1723
|
h("span", { style: { fontSize: 10.5, padding: "1px 8px", borderRadius: 999, background: statusBg, color: statusColor, fontWeight: 650, flexShrink: 0 } }, statusLabel)
|
|
1724
1724
|
),
|
|
@@ -1729,7 +1729,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1729
1729
|
return h(
|
|
1730
1730
|
"article",
|
|
1731
1731
|
{ style: style.event, key: entry.key },
|
|
1732
|
-
h("div", { style: { fontSize: 10.5, fontWeight: 700, color: t.text3, marginBottom: 3, textTransform: "uppercase", letterSpacing: "0.04em" } }, "
|
|
1732
|
+
h("div", { style: { fontSize: 10.5, fontWeight: 700, color: t.text3, marginBottom: 3, textTransform: "uppercase", letterSpacing: "0.04em" } }, "\u8BA1\u5212"),
|
|
1733
1733
|
...entry.entries.map((item, index) => h(
|
|
1734
1734
|
"div",
|
|
1735
1735
|
{ style: { display: "flex", gap: 6, fontSize: 12.5, margin: "2px 0" }, key: index },
|
|
@@ -1752,7 +1752,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1752
1752
|
h(
|
|
1753
1753
|
"details",
|
|
1754
1754
|
null,
|
|
1755
|
-
h("summary", { style: style.summary }, "
|
|
1755
|
+
h("summary", { style: style.summary }, "\u67E5\u770B\u8BE6\u60C5"),
|
|
1756
1756
|
h("pre", { style: { margin: "5px 0 0", whiteSpace: "pre-wrap", overflowWrap: "anywhere", fontSize: 11.5 } }, JSON.stringify(entry.data ?? {}, null, 2))
|
|
1757
1757
|
)
|
|
1758
1758
|
);
|
|
@@ -1784,7 +1784,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1784
1784
|
sendPrompt();
|
|
1785
1785
|
}
|
|
1786
1786
|
},
|
|
1787
|
-
placeholder: hasControl ? "
|
|
1787
|
+
placeholder: hasControl ? "\u5411\u8FDC\u7A0B\u4F1A\u8BDD\u4E0B\u53D1\u6307\u4EE4\uFF08\u56DE\u8F66\u53D1\u9001\uFF0CShift+\u56DE\u8F66\u6362\u884C\uFF09" : "\u53EA\u8BFB\u6A21\u5F0F\uFF1A\u4E0B\u53D1\u6307\u4EE4\u9700\u8981 session:control \u6743\u9650",
|
|
1788
1788
|
disabled: !hasControl
|
|
1789
1789
|
}),
|
|
1790
1790
|
turnActive ? h(
|
|
@@ -1794,8 +1794,8 @@ function RemoteSessionPage({ api }) {
|
|
|
1794
1794
|
style: style.stopButton,
|
|
1795
1795
|
disabled: !hasControl || stopping,
|
|
1796
1796
|
onClick: stopTurn,
|
|
1797
|
-
title: stopping ? "
|
|
1798
|
-
"aria-label": "
|
|
1797
|
+
title: stopping ? "\u505C\u6B62\u4E2D\u2026" : "\u505C\u6B62\u5F53\u524D\u56DE\u5408",
|
|
1798
|
+
"aria-label": "\u505C\u6B62\u5F53\u524D\u56DE\u5408"
|
|
1799
1799
|
},
|
|
1800
1800
|
h("span", { style: style.stopIcon })
|
|
1801
1801
|
) : h(
|
|
@@ -1804,8 +1804,8 @@ function RemoteSessionPage({ api }) {
|
|
|
1804
1804
|
type: "submit",
|
|
1805
1805
|
style: style.sendButton,
|
|
1806
1806
|
disabled: !streamRef.current || !hasControl || prompt.trim() === "",
|
|
1807
|
-
title: "
|
|
1808
|
-
"aria-label": "
|
|
1807
|
+
title: "\u53D1\u9001\uFF08\u56DE\u8F66\uFF09",
|
|
1808
|
+
"aria-label": "\u53D1\u9001\u6307\u4EE4"
|
|
1809
1809
|
},
|
|
1810
1810
|
h(
|
|
1811
1811
|
"svg",
|
|
@@ -1818,7 +1818,7 @@ function RemoteSessionPage({ api }) {
|
|
|
1818
1818
|
"div",
|
|
1819
1819
|
{ style: { fontSize: 11.5, color: turnActive ? t.accent : lastDelivery?.accepted ? t.success : lastDelivery?.frame === "pending" ? t.text3 : t.danger, textAlign: "right", display: "flex", alignItems: "center", justifyContent: "flex-end", gap: 6 } },
|
|
1820
1820
|
turnActive ? h("span", { className: "mai-pulse", style: { ...style.dot, background: t.accent } }) : null,
|
|
1821
|
-
turnActive ? stopping ? "
|
|
1821
|
+
turnActive ? stopping ? "\u6B63\u5728\u505C\u6B62\u5F53\u524D\u56DE\u5408\u2026" : "MonkeyAI \u6B63\u5728\u5904\u7406\u2026" : lastDelivery?.accepted ? "\u56DE\u5408\u5DF2\u7ED3\u675F" : lastDelivery?.frame === "pending" ? "\u7B49\u5F85\u6295\u9012" : "\u6295\u9012\u88AB\u62D2\u7EDD"
|
|
1822
1822
|
) : null
|
|
1823
1823
|
) : null
|
|
1824
1824
|
);
|
|
@@ -1856,8 +1856,8 @@ async function apply(ctx) {
|
|
|
1856
1856
|
type: "button",
|
|
1857
1857
|
style: { width: "100%", height: "100%", padding: 0, border: 0, background: "transparent", color: "inherit", cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center" },
|
|
1858
1858
|
onClick: () => owner.layout.selectPanel(PANEL_ID),
|
|
1859
|
-
"aria-label": "MonkeyAI
|
|
1860
|
-
title: "MonkeyAI
|
|
1859
|
+
"aria-label": "MonkeyAI \u4F1A\u8BDD",
|
|
1860
|
+
title: "MonkeyAI \u4F1A\u8BDD"
|
|
1861
1861
|
}, h(MonkeyIcon, { size: 18 }));
|
|
1862
1862
|
owner.slots.inject("main", () => owner.slots.register({
|
|
1863
1863
|
name: "main",
|