dsh-monkeyai-sessions 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +19 -19
- package/src/shared/projection.mjs +10 -10
package/client.js
CHANGED
|
@@ -315,9 +315,9 @@ window.__ModuleLoader__.load({
|
|
|
315
315
|
|
|
316
316
|
// src/shared/projection.mjs
|
|
317
317
|
var MESSAGE_UPDATES = Object.freeze({
|
|
318
|
-
user_message_chunk: { role: "user", label: "
|
|
318
|
+
user_message_chunk: { role: "user", label: "\u6211", mode: "append" },
|
|
319
319
|
agent_message_chunk: { role: "assistant", label: "MonkeyAI", mode: "append" },
|
|
320
|
-
user_message: { role: "user", label: "
|
|
320
|
+
user_message: { role: "user", label: "\u6211", mode: "replace" },
|
|
321
321
|
agent_message: { role: "assistant", label: "MonkeyAI", mode: "replace" }
|
|
322
322
|
});
|
|
323
323
|
var THOUGHT_UPDATES = Object.freeze({
|
|
@@ -325,11 +325,11 @@ window.__ModuleLoader__.load({
|
|
|
325
325
|
agent_thought: "replace"
|
|
326
326
|
});
|
|
327
327
|
var TOOL_STATUS_LABEL = Object.freeze({
|
|
328
|
-
pending: "
|
|
329
|
-
in_progress: "
|
|
330
|
-
completed: "
|
|
331
|
-
failed: "
|
|
332
|
-
cancelled: "
|
|
328
|
+
pending: "\u6392\u961F\u4E2D",
|
|
329
|
+
in_progress: "\u6267\u884C\u4E2D",
|
|
330
|
+
completed: "\u5B8C\u6210",
|
|
331
|
+
failed: "\u5931\u8D25",
|
|
332
|
+
cancelled: "\u5DF2\u53D6\u6D88"
|
|
333
333
|
});
|
|
334
334
|
function contentText(content) {
|
|
335
335
|
const blocks = Array.isArray(content) ? content : content === void 0 || content === null ? [] : [content];
|
|
@@ -449,25 +449,25 @@ window.__ModuleLoader__.load({
|
|
|
449
449
|
if (frame.type === "ready") {
|
|
450
450
|
if (!seenReady) {
|
|
451
451
|
seenReady = true;
|
|
452
|
-
entries.push({ kind: "system", label: "
|
|
452
|
+
entries.push({ kind: "system", label: "\u5DF2\u8FDE\u63A5\u5230\u8FDC\u7A0B runtime", key: `sys-ready:${entries.length}` });
|
|
453
453
|
}
|
|
454
454
|
continue;
|
|
455
455
|
}
|
|
456
456
|
if (frame.type === "history_loaded") {
|
|
457
457
|
if (!seenHistoryLoaded) {
|
|
458
458
|
seenHistoryLoaded = true;
|
|
459
|
-
entries.push({ kind: "system", label: "
|
|
459
|
+
entries.push({ kind: "system", label: "\u5386\u53F2\u5DF2\u52A0\u8F7D", key: `sys-hist:${entries.length}` });
|
|
460
460
|
}
|
|
461
461
|
continue;
|
|
462
462
|
}
|
|
463
463
|
if (frame.type === "history_incomplete") {
|
|
464
|
-
entries.push({ kind: "system", label: "
|
|
464
|
+
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}` });
|
|
465
465
|
continue;
|
|
466
466
|
}
|
|
467
467
|
if (frame.type === "reconnecting") {
|
|
468
468
|
if (!seenReconnecting) {
|
|
469
469
|
seenReconnecting = true;
|
|
470
|
-
entries.push({ kind: "system", label: frame.message || "
|
|
470
|
+
entries.push({ kind: "system", label: frame.message || "\u6B63\u5728\u91CD\u8FDE\u8FDC\u7A0B runtime", key: `sys-reconn:${entries.length}` });
|
|
471
471
|
}
|
|
472
472
|
continue;
|
|
473
473
|
}
|
|
@@ -477,18 +477,18 @@ window.__ModuleLoader__.load({
|
|
|
477
477
|
if (frame.type === "delivery") {
|
|
478
478
|
const accepted = Boolean(frame.data?.accepted);
|
|
479
479
|
if (accepted) continue;
|
|
480
|
-
entries.push({ kind: "system", label: "MonkeyAI
|
|
480
|
+
entries.push({ kind: "system", label: "MonkeyAI \u672A\u63A5\u53D7\u8BE5\u6307\u4EE4", key: `sys-del:${entries.length}` });
|
|
481
481
|
continue;
|
|
482
482
|
}
|
|
483
483
|
if (frame.type === "cancel_sent") {
|
|
484
|
-
entries.push({ kind: "system", label: "
|
|
484
|
+
entries.push({ kind: "system", label: "\u5DF2\u8BF7\u6C42\u505C\u6B62", key: `sys-cancel:${entries.length}` });
|
|
485
485
|
continue;
|
|
486
486
|
}
|
|
487
487
|
if (frame.type === "request") {
|
|
488
488
|
continue;
|
|
489
489
|
}
|
|
490
490
|
if (frame.type === "model_switched") {
|
|
491
|
-
entries.push({ kind: "system", label:
|
|
491
|
+
entries.push({ kind: "system", label: `\u5DF2\u5207\u6362\u6A21\u578B\uFF1A${frame.data?.model ?? "\u6240\u9009\u6A21\u578B"}`, key: `sys-model:${entries.length}` });
|
|
492
492
|
continue;
|
|
493
493
|
}
|
|
494
494
|
if (frame.type === "model_switch_failed") {
|
|
@@ -592,7 +592,7 @@ window.__ModuleLoader__.load({
|
|
|
592
592
|
.mai-panel .mai-md pre::-webkit-scrollbar-thumb { background: #d5dbe4; border-radius: 6px; }
|
|
593
593
|
`;
|
|
594
594
|
function errorText(error) {
|
|
595
|
-
return typeof error?.message === "string" ? error.message : typeof error === "string" ? error : "
|
|
595
|
+
return typeof error?.message === "string" ? error.message : typeof error === "string" ? error : "\u8FDC\u7A0B\u64CD\u4F5C\u5931\u8D25";
|
|
596
596
|
}
|
|
597
597
|
function renderMarkdown(text) {
|
|
598
598
|
if (typeof text !== "string" || text === "") return null;
|
|
@@ -726,8 +726,8 @@ window.__ModuleLoader__.load({
|
|
|
726
726
|
h(
|
|
727
727
|
"div",
|
|
728
728
|
{ style: { display: "flex", alignItems: "center", gap: 8 } },
|
|
729
|
-
h("span", { style: { fontSize: 12.5, fontWeight: 650 } }, isPermission ? "
|
|
730
|
-
h("span", { style: { fontSize: 11, color: t.text3 } }, "
|
|
729
|
+
h("span", { style: { fontSize: 12.5, fontWeight: 650 } }, isPermission ? "\u8BF7\u6C42\u6388\u6743" : "MonkeyAI \u9700\u8981\u4F60\u7684\u8F93\u5165"),
|
|
730
|
+
h("span", { style: { fontSize: 11, color: t.text3 } }, "\u56DE\u590D\u9700\u8981 session:control \u6743\u9650")
|
|
731
731
|
),
|
|
732
732
|
questionText !== "" ? h("div", { style: { fontSize: 12.5, color: t.text2, whiteSpace: "pre-wrap", overflowWrap: "anywhere" } }, questionText) : null,
|
|
733
733
|
options.length > 0 ? h(
|
|
@@ -740,14 +740,14 @@ window.__ModuleLoader__.load({
|
|
|
740
740
|
disabled,
|
|
741
741
|
onClick: () => onRespond(request, { outcome: "selected", optionId: option.optionId })
|
|
742
742
|
}, option.name || option.optionId)),
|
|
743
|
-
h("button", { type: "button", style: style.button, disabled, onClick: () => onRespond(request, { outcome: "cancelled" }) }, "
|
|
743
|
+
h("button", { type: "button", style: style.button, disabled, onClick: () => onRespond(request, { outcome: "cancelled" }) }, "\u62D2\u7EDD")
|
|
744
744
|
) : null,
|
|
745
745
|
options.length === 0 && !isPermission ? h(
|
|
746
746
|
import_react.default.Fragment,
|
|
747
747
|
null,
|
|
748
748
|
h("textarea", {
|
|
749
749
|
style: { ...style.textarea, minHeight: 44 },
|
|
750
|
-
placeholder: disabled ? "
|
|
750
|
+
placeholder: disabled ? "\u53EA\u8BFB\u6A21\u5F0F\uFF1A\u56DE\u590D\u9700\u8981 session:control \u6743\u9650" : "\u8F93\u5165\u4F60\u7684\u56DE\u7B54",
|
|
751
751
|
value: answerText,
|
|
752
752
|
disabled,
|
|
753
753
|
onChange: (event) => setAnswerText(event.target.value)
|
|
@@ -755,19 +755,19 @@ window.__ModuleLoader__.load({
|
|
|
755
755
|
h(
|
|
756
756
|
"div",
|
|
757
757
|
{ style: style.row },
|
|
758
|
-
h("button", { type: "button", style: style.primaryButton, disabled: disabled || answerText.trim() === "", onClick: () => onAnswer(request) }, "
|
|
759
|
-
h("button", { type: "button", style: style.button, disabled, onClick: () => onRespond(request, { action: "decline" }) }, "
|
|
758
|
+
h("button", { type: "button", style: style.primaryButton, disabled: disabled || answerText.trim() === "", onClick: () => onAnswer(request) }, "\u56DE\u590D"),
|
|
759
|
+
h("button", { type: "button", style: style.button, disabled, onClick: () => onRespond(request, { action: "decline" }) }, "\u62D2\u7EDD")
|
|
760
760
|
)
|
|
761
761
|
) : null,
|
|
762
762
|
options.length === 0 && isPermission ? h(
|
|
763
763
|
"div",
|
|
764
764
|
{ style: style.row },
|
|
765
|
-
h("button", { type: "button", style: style.button, disabled, onClick: () => onRespond(request, { outcome: "cancelled" }) }, "
|
|
765
|
+
h("button", { type: "button", style: style.button, disabled, onClick: () => onRespond(request, { outcome: "cancelled" }) }, "\u62D2\u7EDD")
|
|
766
766
|
) : null,
|
|
767
767
|
h(
|
|
768
768
|
"details",
|
|
769
769
|
{ style: style.details },
|
|
770
|
-
h("summary", { style: style.summary }, "
|
|
770
|
+
h("summary", { style: style.summary }, "\u8BF7\u6C42\u8BE6\u60C5"),
|
|
771
771
|
h("pre", { style: { margin: "6px 0 0", whiteSpace: "pre-wrap", overflowWrap: "anywhere", fontSize: 11.5 } }, JSON.stringify(request.data, null, 2))
|
|
772
772
|
)
|
|
773
773
|
);
|
|
@@ -789,7 +789,7 @@ window.__ModuleLoader__.load({
|
|
|
789
789
|
const [pendingRequests, setPendingRequests] = useState([]);
|
|
790
790
|
const [prompt, setPrompt] = useState("");
|
|
791
791
|
const [answerText, setAnswerText] = useState("");
|
|
792
|
-
const [status, setStatus] = useState("
|
|
792
|
+
const [status, setStatus] = useState("\u672A\u8FDE\u63A5");
|
|
793
793
|
const [error, setError] = useState("");
|
|
794
794
|
const [loading, setLoading] = useState(false);
|
|
795
795
|
const [lastDelivery, setLastDelivery] = useState(void 0);
|
|
@@ -872,7 +872,7 @@ window.__ModuleLoader__.load({
|
|
|
872
872
|
if (loading || !serverAddress || !signInEmail.trim() || signInPassword === "") return;
|
|
873
873
|
setError("");
|
|
874
874
|
setLoading(true);
|
|
875
|
-
setStatus("
|
|
875
|
+
setStatus("\u6B63\u5728\u767B\u5F55 MonkeyAI");
|
|
876
876
|
try {
|
|
877
877
|
const account = await unwrap(api.signIn({
|
|
878
878
|
serverAddress,
|
|
@@ -883,7 +883,7 @@ window.__ModuleLoader__.load({
|
|
|
883
883
|
adoptAccount(account);
|
|
884
884
|
} catch (reason) {
|
|
885
885
|
setError(errorText(reason));
|
|
886
|
-
setStatus("
|
|
886
|
+
setStatus("\u767B\u5F55\u5931\u8D25");
|
|
887
887
|
} finally {
|
|
888
888
|
setLoading(false);
|
|
889
889
|
}
|
|
@@ -898,9 +898,9 @@ window.__ModuleLoader__.load({
|
|
|
898
898
|
setAuthorizationMode(mode);
|
|
899
899
|
setCopied(false);
|
|
900
900
|
if (mode === "loopback") {
|
|
901
|
-
setStatus("
|
|
901
|
+
setStatus("\u7B49\u5F85\u6279\u51C6");
|
|
902
902
|
} else {
|
|
903
|
-
setStatus("
|
|
903
|
+
setStatus("\u6279\u51C6\u6388\u6743\u540E\uFF0C\u7C98\u8D34\u56DE\u8C03 URL");
|
|
904
904
|
}
|
|
905
905
|
authWindowRef.current = window.open(result.authorizationUrl, "_blank");
|
|
906
906
|
} catch (reason) {
|
|
@@ -946,12 +946,12 @@ window.__ModuleLoader__.load({
|
|
|
946
946
|
setAccounts((current) => [result.account, ...current.filter((item) => item.accountId !== result.account.accountId)]);
|
|
947
947
|
setAccountId(result.account.accountId);
|
|
948
948
|
setServerAddress(result.account.serverOrigin);
|
|
949
|
-
setStatus("MonkeyAI
|
|
949
|
+
setStatus("MonkeyAI \u8D26\u53F7\u5DF2\u8FDE\u63A5");
|
|
950
950
|
} else if (result.status === "failed") {
|
|
951
|
-
setError(result.error || "
|
|
952
|
-
setStatus("
|
|
951
|
+
setError(result.error || "\u81EA\u52A8\u6388\u6743\u5931\u8D25\uFF0C\u8BF7\u6539\u4E3A\u7C98\u8D34\u56DE\u8C03 URL\u3002");
|
|
952
|
+
setStatus("\u81EA\u52A8\u6388\u6743\u5931\u8D25");
|
|
953
953
|
} else {
|
|
954
|
-
setStatus("
|
|
954
|
+
setStatus("\u6388\u6743\u8BF7\u6C42\u5DF2\u8FC7\u671F");
|
|
955
955
|
}
|
|
956
956
|
setAuthorizationRequestId("");
|
|
957
957
|
setAuthorizationUrl("");
|
|
@@ -965,7 +965,7 @@ window.__ModuleLoader__.load({
|
|
|
965
965
|
setAccounts((current) => [account, ...current.filter((item) => item.accountId !== account.accountId)]);
|
|
966
966
|
setAccountId(account.accountId);
|
|
967
967
|
setServerAddress(account.serverOrigin);
|
|
968
|
-
setStatus("MonkeyAI
|
|
968
|
+
setStatus("MonkeyAI \u8D26\u53F7\u5DF2\u8FDE\u63A5");
|
|
969
969
|
setAddingServer(false);
|
|
970
970
|
}
|
|
971
971
|
async function completeAuthorization() {
|
|
@@ -988,9 +988,9 @@ window.__ModuleLoader__.load({
|
|
|
988
988
|
try {
|
|
989
989
|
await navigator.clipboard.writeText(authorizationUrl);
|
|
990
990
|
setCopied(true);
|
|
991
|
-
setStatus("
|
|
991
|
+
setStatus("\u6388\u6743\u94FE\u63A5\u5DF2\u590D\u5236");
|
|
992
992
|
} catch {
|
|
993
|
-
setStatus("
|
|
993
|
+
setStatus("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u94FE\u63A5\u6587\u672C");
|
|
994
994
|
}
|
|
995
995
|
}
|
|
996
996
|
async function loadDevices() {
|
|
@@ -1007,7 +1007,7 @@ window.__ModuleLoader__.load({
|
|
|
1007
1007
|
setSessionId("");
|
|
1008
1008
|
streamRef.current?.dispose();
|
|
1009
1009
|
streamRef.current = null;
|
|
1010
|
-
setStatus(result.items.length > 0 ? `${result.items.length} device(s) found` : "
|
|
1010
|
+
setStatus(result.items.length > 0 ? `${result.items.length} device(s) found` : "\u6682\u65E0\u5DF2\u6CE8\u518C\u8BBE\u5907");
|
|
1011
1011
|
if (first) await loadSessions(first);
|
|
1012
1012
|
} catch (reason) {
|
|
1013
1013
|
setError(errorText(reason));
|
|
@@ -1031,10 +1031,10 @@ window.__ModuleLoader__.load({
|
|
|
1031
1031
|
]);
|
|
1032
1032
|
const errors = [];
|
|
1033
1033
|
if (results[0].status === "fulfilled") setSummarySessions(results[0].value.items);
|
|
1034
|
-
else errors.push(
|
|
1034
|
+
else errors.push(`\u4F1A\u8BDD\u6458\u8981\u7D22\u5F15\uFF1A${errorText(results[0].reason)}`);
|
|
1035
1035
|
if (results[1].status === "fulfilled") setRuntimeSessions(results[1].value.sessions);
|
|
1036
|
-
else errors.push(`ACP
|
|
1037
|
-
setStatus(errors.length === 0 ? "
|
|
1036
|
+
else errors.push(`ACP \u4F1A\u8BDD\u5217\u8868\uFF1A${errorText(results[1].reason)}`);
|
|
1037
|
+
setStatus(errors.length === 0 ? "\u4F1A\u8BDD\u5DF2\u5237\u65B0" : "\u90E8\u5206\u4F1A\u8BDD\u6765\u6E90\u4E0D\u53EF\u7528");
|
|
1038
1038
|
setError(errors.join("\n"));
|
|
1039
1039
|
setLoading(false);
|
|
1040
1040
|
}
|
|
@@ -1053,38 +1053,38 @@ window.__ModuleLoader__.load({
|
|
|
1053
1053
|
setCurrentModel("");
|
|
1054
1054
|
setVisibleCount(RECENT_LIMIT);
|
|
1055
1055
|
setHistoryLoading(true);
|
|
1056
|
-
setStatus("
|
|
1056
|
+
setStatus("\u6B63\u5728\u8FDE\u63A5\u8FDC\u7A0B\u4F1A\u8BDD");
|
|
1057
1057
|
try {
|
|
1058
1058
|
const stream = api.followSession({ accountId, machineId, sessionId: session.id, cwd: session.cwd });
|
|
1059
1059
|
streamRef.current = stream;
|
|
1060
|
-
setStatus("
|
|
1060
|
+
setStatus("\u8FDC\u7A0B\u4F1A\u8BDD\u5DF2\u8FDE\u63A5");
|
|
1061
1061
|
for await (const frame of stream) {
|
|
1062
1062
|
setFrames((current) => [...current, frame]);
|
|
1063
|
-
if (frame.type === "ready" && !historyLoadedRef.current) setStatus("
|
|
1064
|
-
if (frame.type === "reconnecting") setStatus(frame.message || "
|
|
1063
|
+
if (frame.type === "ready" && !historyLoadedRef.current) setStatus("\u6B63\u5728\u56DE\u653E\u4F1A\u8BDD\u5386\u53F2");
|
|
1064
|
+
if (frame.type === "reconnecting") setStatus(frame.message || "\u6B63\u5728\u91CD\u8FDE\u8FDC\u7A0B runtime");
|
|
1065
1065
|
if (frame.type === "history_loaded") {
|
|
1066
1066
|
historyLoadedRef.current = true;
|
|
1067
|
-
setStatus("
|
|
1067
|
+
setStatus("\u5386\u53F2\u5DF2\u52A0\u8F7D");
|
|
1068
1068
|
setHistoryLoading(false);
|
|
1069
1069
|
if (frame.model) setCurrentModel(frame.model);
|
|
1070
1070
|
}
|
|
1071
1071
|
if (frame.type === "history_incomplete") {
|
|
1072
|
-
setStatus("
|
|
1072
|
+
setStatus("\u5386\u53F2\u4E0D\u5B8C\u6574\uFF1A" + (frame.message || "\u56DE\u653E\u88AB\u4E2D\u65AD"));
|
|
1073
1073
|
setHistoryLoading(false);
|
|
1074
1074
|
}
|
|
1075
1075
|
if (frame.type === "model_switched") {
|
|
1076
1076
|
if (frame.data?.model) setCurrentModel(frame.data.model);
|
|
1077
1077
|
setSwitchingModel(false);
|
|
1078
|
-
setStatus("
|
|
1078
|
+
setStatus("\u6A21\u578B\u5DF2\u5207\u6362");
|
|
1079
1079
|
}
|
|
1080
1080
|
if (frame.type === "model_switch_failed") {
|
|
1081
1081
|
setSwitchingModel(false);
|
|
1082
|
-
setError(frame.message || "
|
|
1083
|
-
setStatus("
|
|
1082
|
+
setError(frame.message || "\u6A21\u578B\u5207\u6362\u88AB\u62D2\u7EDD");
|
|
1083
|
+
setStatus("\u6A21\u578B\u5207\u6362\u5931\u8D25");
|
|
1084
1084
|
}
|
|
1085
1085
|
if (frame.type === "session_missing") {
|
|
1086
|
-
setError(frame.message || "
|
|
1087
|
-
setStatus("
|
|
1086
|
+
setError(frame.message || "\u8BE5\u4F1A\u8BDD\u5728\u6240\u9009\u8BBE\u5907\u4E0A\u5DF2\u4E0D\u5B58\u5728\u3002");
|
|
1087
|
+
setStatus("\u8BBE\u5907\u4E0A\u627E\u4E0D\u5230\u8BE5\u4F1A\u8BDD");
|
|
1088
1088
|
setHistoryLoading(false);
|
|
1089
1089
|
}
|
|
1090
1090
|
if (frame.type === "request") {
|
|
@@ -1097,31 +1097,31 @@ window.__ModuleLoader__.load({
|
|
|
1097
1097
|
setStopping(false);
|
|
1098
1098
|
if (accepted) {
|
|
1099
1099
|
const cancelled = frame.data?.result?.stopReason === "cancelled";
|
|
1100
|
-
setStatus(cancelled ? "
|
|
1100
|
+
setStatus(cancelled ? "\u56DE\u5408\u5DF2\u505C\u6B62" : "\u56DE\u5408\u5DF2\u5B8C\u6210");
|
|
1101
1101
|
} else {
|
|
1102
1102
|
setPrompt((current) => current === "" ? lastDraftRef.current || "" : current);
|
|
1103
|
-
setStatus("MonkeyAI
|
|
1103
|
+
setStatus("MonkeyAI \u672A\u63A5\u53D7\u8BE5\u6307\u4EE4\uFF0C\u8349\u7A3F\u5DF2\u4FDD\u7559");
|
|
1104
1104
|
if (frame.message) setError(frame.message);
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
1107
|
if (frame.type === "cancel_sent") {
|
|
1108
1108
|
setStopping(false);
|
|
1109
|
-
setStatus("
|
|
1109
|
+
setStatus("\u5DF2\u8BF7\u6C42\u505C\u6B62\uFF0C\u7B49\u5F85 runtime \u53D6\u6D88");
|
|
1110
1110
|
}
|
|
1111
1111
|
if (frame.type === "response_sent") {
|
|
1112
1112
|
setPendingRequests((current) => current.filter((item) => item.requestId !== frame.requestId));
|
|
1113
1113
|
}
|
|
1114
1114
|
if (frame.type === "response_error") {
|
|
1115
|
-
setError(
|
|
1115
|
+
setError(`\u8FDC\u7A0B\u56DE\u590D\u88AB\u62D2\u7EDD\uFF1A${frame.code || "\u672A\u77E5"}`);
|
|
1116
1116
|
}
|
|
1117
|
-
if (frame.type === "error") setError(frame.message || frame.code || "
|
|
1117
|
+
if (frame.type === "error") setError(frame.message || frame.code || "\u8FDC\u7A0B\u4F1A\u8BDD\u9519\u8BEF");
|
|
1118
1118
|
}
|
|
1119
|
-
setStatus("
|
|
1119
|
+
setStatus("\u8FDC\u7A0B\u4F1A\u8BDD\u5DF2\u65AD\u5F00");
|
|
1120
1120
|
setHistoryLoading(false);
|
|
1121
1121
|
setTurnActive(false);
|
|
1122
1122
|
setStopping(false);
|
|
1123
1123
|
} catch (reason) {
|
|
1124
|
-
setStatus("
|
|
1124
|
+
setStatus("\u8FDC\u7A0B\u4F1A\u8BDD\u4E0D\u53EF\u7528");
|
|
1125
1125
|
setError(errorText(reason));
|
|
1126
1126
|
setHistoryLoading(false);
|
|
1127
1127
|
setTurnActive(false);
|
|
@@ -1139,7 +1139,7 @@ window.__ModuleLoader__.load({
|
|
|
1139
1139
|
setPrompt("");
|
|
1140
1140
|
setTurnActive(true);
|
|
1141
1141
|
setStopping(false);
|
|
1142
|
-
setStatus("
|
|
1142
|
+
setStatus("\u6307\u4EE4\u5DF2\u53D1\u9001\uFF0CMonkeyAI \u6B63\u5728\u5904\u7406");
|
|
1143
1143
|
} catch (reason) {
|
|
1144
1144
|
setError(errorText(reason));
|
|
1145
1145
|
}
|
|
@@ -1150,14 +1150,14 @@ window.__ModuleLoader__.load({
|
|
|
1150
1150
|
try {
|
|
1151
1151
|
stream.send({ type: "cancel" });
|
|
1152
1152
|
setStopping(true);
|
|
1153
|
-
setStatus("
|
|
1153
|
+
setStatus("\u505C\u6B62\u4E2D\u2026");
|
|
1154
1154
|
} catch (reason) {
|
|
1155
1155
|
setError(errorText(reason));
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
1158
|
function respond(request, result) {
|
|
1159
1159
|
if (!hasControl) {
|
|
1160
|
-
setError("MonkeyAI
|
|
1160
|
+
setError("\u56DE\u590D MonkeyAI \u9700\u8981 session:control \u6743\u9650");
|
|
1161
1161
|
return;
|
|
1162
1162
|
}
|
|
1163
1163
|
try {
|
|
@@ -1187,7 +1187,7 @@ window.__ModuleLoader__.load({
|
|
|
1187
1187
|
setCallbackUrl("");
|
|
1188
1188
|
setAuthorizationUrl("");
|
|
1189
1189
|
setAuthorizationMode("");
|
|
1190
|
-
setStatus("
|
|
1190
|
+
setStatus("\u672A\u8FDE\u63A5");
|
|
1191
1191
|
setAddingServer(false);
|
|
1192
1192
|
} catch (reason) {
|
|
1193
1193
|
setError(errorText(reason));
|
|
@@ -1238,7 +1238,7 @@ window.__ModuleLoader__.load({
|
|
|
1238
1238
|
setDevices((current) => [entry, ...current.filter((item) => item.machineId !== machineId2)]);
|
|
1239
1239
|
setMachineId((current) => current || machineId2);
|
|
1240
1240
|
}
|
|
1241
|
-
setStatus(
|
|
1241
|
+
setStatus(`\u5DF2\u6DFB\u52A0\u8BBE\u5907 ${entry.displayName}`);
|
|
1242
1242
|
}
|
|
1243
1243
|
function removeManualDevice(machineId2) {
|
|
1244
1244
|
saveManualDevices(loadManualDevices().filter((item) => item.machineId !== machineId2));
|
|
@@ -1254,14 +1254,14 @@ window.__ModuleLoader__.load({
|
|
|
1254
1254
|
if (created.model) setCurrentModel(created.model);
|
|
1255
1255
|
setRuntimeSessions((current) => {
|
|
1256
1256
|
if (current.some((item) => item.id === created.sessionId)) return current;
|
|
1257
|
-
return [{ id: created.sessionId, title: created.title || "
|
|
1257
|
+
return [{ id: created.sessionId, title: created.title || "\u65B0\u5EFA\u8FDC\u7A0B\u4F1A\u8BDD", cwd: created.cwd }, ...current];
|
|
1258
1258
|
});
|
|
1259
1259
|
setSummarySessions((current) => current.filter((item) => item.id !== created.sessionId));
|
|
1260
|
-
setStatus("
|
|
1261
|
-
await openSession({ id: created.sessionId, title: created.title || "
|
|
1260
|
+
setStatus("\u4F1A\u8BDD\u5DF2\u521B\u5EFA");
|
|
1261
|
+
await openSession({ id: created.sessionId, title: created.title || "\u65B0\u5EFA\u8FDC\u7A0B\u4F1A\u8BDD", cwd: created.cwd });
|
|
1262
1262
|
} catch (reason) {
|
|
1263
1263
|
setError(errorText(reason));
|
|
1264
|
-
setStatus("
|
|
1264
|
+
setStatus("\u65E0\u6CD5\u521B\u5EFA\u8FDC\u7A0B\u4F1A\u8BDD");
|
|
1265
1265
|
} finally {
|
|
1266
1266
|
setNewSessionBusy(false);
|
|
1267
1267
|
}
|
|
@@ -1274,10 +1274,10 @@ window.__ModuleLoader__.load({
|
|
|
1274
1274
|
setSwitchingModel(true);
|
|
1275
1275
|
try {
|
|
1276
1276
|
stream.send({ type: "switch_model", model: modelId });
|
|
1277
|
-
setStatus("
|
|
1277
|
+
setStatus("\u6B63\u5728\u5207\u6362\u6A21\u578B\u2026");
|
|
1278
1278
|
} catch (reason) {
|
|
1279
1279
|
setError(errorText(reason));
|
|
1280
|
-
setStatus("
|
|
1280
|
+
setStatus("\u6A21\u578B\u5207\u6362\u5931\u8D25");
|
|
1281
1281
|
setSwitchingModel(false);
|
|
1282
1282
|
}
|
|
1283
1283
|
}
|
|
@@ -1335,7 +1335,7 @@ window.__ModuleLoader__.load({
|
|
|
1335
1335
|
"div",
|
|
1336
1336
|
{ style: { display: "flex", alignItems: "center", gap: 8 } },
|
|
1337
1337
|
h(MonkeyIcon, { size: 22 }),
|
|
1338
|
-
h("h1", { style: style.title }, "MonkeyAI
|
|
1338
|
+
h("h1", { style: style.title }, "MonkeyAI \u4F1A\u8BDD")
|
|
1339
1339
|
),
|
|
1340
1340
|
h(StatusBadge, { status, live: isLive })
|
|
1341
1341
|
),
|
|
@@ -1345,7 +1345,7 @@ window.__ModuleLoader__.load({
|
|
|
1345
1345
|
h("span", { style: { flex: 1 } }, error),
|
|
1346
1346
|
h("button", {
|
|
1347
1347
|
type: "button",
|
|
1348
|
-
"aria-label": "
|
|
1348
|
+
"aria-label": "\u5173\u95ED\u9519\u8BEF\u63D0\u793A",
|
|
1349
1349
|
onClick: () => setError(""),
|
|
1350
1350
|
style: { border: 0, background: "transparent", cursor: "pointer", color: t.danger, fontWeight: 700, padding: "0 2px", fontSize: 13 }
|
|
1351
1351
|
}, "\xD7")
|
|
@@ -1356,12 +1356,12 @@ window.__ModuleLoader__.load({
|
|
|
1356
1356
|
addingServer && !authorizing ? h(
|
|
1357
1357
|
"div",
|
|
1358
1358
|
{ style: style.row },
|
|
1359
|
-
h("h2", { style: { ...style.sectionTitle, flex: 1 } }, "
|
|
1359
|
+
h("h2", { style: { ...style.sectionTitle, flex: 1 } }, "\u6DFB\u52A0 MonkeyAI \u670D\u52A1\u5668"),
|
|
1360
1360
|
h("button", { type: "button", style: style.button, onClick: () => {
|
|
1361
1361
|
setAddingServer(false);
|
|
1362
1362
|
setServerAddress(currentAccount?.serverOrigin || "");
|
|
1363
|
-
setStatus("MonkeyAI
|
|
1364
|
-
} }, "
|
|
1363
|
+
setStatus("MonkeyAI \u8D26\u53F7\u5DF2\u8FDE\u63A5");
|
|
1364
|
+
} }, "\u53D6\u6D88")
|
|
1365
1365
|
) : null,
|
|
1366
1366
|
authorizing ? h(
|
|
1367
1367
|
import_react.default.Fragment,
|
|
@@ -1369,15 +1369,15 @@ window.__ModuleLoader__.load({
|
|
|
1369
1369
|
h(
|
|
1370
1370
|
"div",
|
|
1371
1371
|
{ style: style.row },
|
|
1372
|
-
h("h2", { style: { ...style.sectionTitle, flex: 1 } }, addingServer ? "
|
|
1372
|
+
h("h2", { style: { ...style.sectionTitle, flex: 1 } }, addingServer ? "\u6B63\u5728\u6388\u6743\u65B0\u670D\u52A1\u5668" : "\u7B49\u5F85\u6388\u6743"),
|
|
1373
1373
|
addingServer ? h("button", { type: "button", style: style.button, onClick: () => {
|
|
1374
1374
|
setAuthorizationRequestId("");
|
|
1375
1375
|
setAuthorizationUrl("");
|
|
1376
1376
|
setAuthorizationMode("");
|
|
1377
1377
|
setCallbackUrl("");
|
|
1378
1378
|
setAddingServer(false);
|
|
1379
|
-
setStatus("MonkeyAI
|
|
1380
|
-
} }, "
|
|
1379
|
+
setStatus("MonkeyAI \u8D26\u53F7\u5DF2\u8FDE\u63A5");
|
|
1380
|
+
} }, "\u53D6\u6D88") : null
|
|
1381
1381
|
),
|
|
1382
1382
|
h(
|
|
1383
1383
|
"ol",
|
|
@@ -1385,20 +1385,20 @@ window.__ModuleLoader__.load({
|
|
|
1385
1385
|
h(
|
|
1386
1386
|
"li",
|
|
1387
1387
|
null,
|
|
1388
|
-
"
|
|
1388
|
+
"\u6253\u5F00\u6388\u6743\u9875\u5E76\u5728 MonkeyAI \u4E2D\u6279\u51C6\u8BBF\u95EE\u3002",
|
|
1389
1389
|
h(
|
|
1390
1390
|
"span",
|
|
1391
1391
|
{ style: style.row, title: authorizationUrl },
|
|
1392
|
-
h("a", { href: authorizationUrl, target: "_blank", rel: "noopener noreferrer", style: { color: t.accent, fontWeight: 600, fontSize: 12 } }, "
|
|
1393
|
-
h("button", { type: "button", style: style.button, onClick: copyAuthorizationUrl }, copied ? "
|
|
1392
|
+
h("a", { href: authorizationUrl, target: "_blank", rel: "noopener noreferrer", style: { color: t.accent, fontWeight: 600, fontSize: 12 } }, "\u6253\u5F00\u6388\u6743\u9875"),
|
|
1393
|
+
h("button", { type: "button", style: style.button, onClick: copyAuthorizationUrl }, copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236\u94FE\u63A5")
|
|
1394
1394
|
)
|
|
1395
1395
|
),
|
|
1396
|
-
authorizationMode === "loopback" ? h("li", null, "
|
|
1396
|
+
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")
|
|
1397
1397
|
),
|
|
1398
1398
|
h(
|
|
1399
1399
|
"details",
|
|
1400
1400
|
{ style: style.details },
|
|
1401
|
-
h("summary", { style: style.summary }, "
|
|
1401
|
+
h("summary", { style: style.summary }, "\u6CA1\u6709\u81EA\u52A8\u5B8C\u6210\uFF1F\u624B\u52A8\u7C98\u8D34\u56DE\u8C03"),
|
|
1402
1402
|
h(
|
|
1403
1403
|
"div",
|
|
1404
1404
|
{ style: { ...style.row, paddingTop: 8 } },
|
|
@@ -1409,13 +1409,13 @@ window.__ModuleLoader__.load({
|
|
|
1409
1409
|
style: { ...style.input, flex: "1 1 260px" },
|
|
1410
1410
|
onChange: (event) => setCallbackUrl(event.target.value)
|
|
1411
1411
|
}),
|
|
1412
|
-
h("button", { type: "button", style: style.primaryButton, disabled: loading || !callbackUrl, onClick: completeAuthorization }, "
|
|
1412
|
+
h("button", { type: "button", style: style.primaryButton, disabled: loading || !callbackUrl, onClick: completeAuthorization }, "\u5B8C\u6210\u6388\u6743")
|
|
1413
1413
|
)
|
|
1414
1414
|
)
|
|
1415
1415
|
) : h(
|
|
1416
1416
|
import_react.default.Fragment,
|
|
1417
1417
|
null,
|
|
1418
|
-
h("h2", { style: style.sectionTitle }, "
|
|
1418
|
+
h("h2", { style: style.sectionTitle }, "\u8FDE\u63A5 MonkeyAI"),
|
|
1419
1419
|
h(
|
|
1420
1420
|
"form",
|
|
1421
1421
|
{
|
|
@@ -1427,7 +1427,7 @@ window.__ModuleLoader__.load({
|
|
|
1427
1427
|
},
|
|
1428
1428
|
h(
|
|
1429
1429
|
Field,
|
|
1430
|
-
{ labelText: "MonkeyAI
|
|
1430
|
+
{ labelText: "MonkeyAI \u670D\u52A1\u5668\u5730\u5740" },
|
|
1431
1431
|
h("input", {
|
|
1432
1432
|
type: "url",
|
|
1433
1433
|
value: serverAddress,
|
|
@@ -1439,7 +1439,7 @@ window.__ModuleLoader__.load({
|
|
|
1439
1439
|
),
|
|
1440
1440
|
h(
|
|
1441
1441
|
Field,
|
|
1442
|
-
{ labelText: "
|
|
1442
|
+
{ labelText: "\u8D26\u53F7\u90AE\u7BB1" },
|
|
1443
1443
|
h("input", {
|
|
1444
1444
|
type: "email",
|
|
1445
1445
|
value: signInEmail,
|
|
@@ -1451,11 +1451,11 @@ window.__ModuleLoader__.load({
|
|
|
1451
1451
|
),
|
|
1452
1452
|
h(
|
|
1453
1453
|
Field,
|
|
1454
|
-
{ labelText: "
|
|
1454
|
+
{ labelText: "\u5BC6\u7801" },
|
|
1455
1455
|
h("input", {
|
|
1456
1456
|
type: "password",
|
|
1457
1457
|
value: signInPassword,
|
|
1458
|
-
placeholder: "MonkeyAI
|
|
1458
|
+
placeholder: "MonkeyAI \u8D26\u53F7\u5BC6\u7801",
|
|
1459
1459
|
style: style.input,
|
|
1460
1460
|
autoComplete: "current-password",
|
|
1461
1461
|
onChange: (event) => setSignInPassword(event.target.value)
|
|
@@ -1465,26 +1465,26 @@ window.__ModuleLoader__.load({
|
|
|
1465
1465
|
type: "submit",
|
|
1466
1466
|
style: style.primaryButton,
|
|
1467
1467
|
disabled: loading || !serverAddress || !signInEmail.trim() || signInPassword === ""
|
|
1468
|
-
}, loading ? "
|
|
1468
|
+
}, loading ? "\u767B\u5F55\u4E2D\u2026" : "\u767B\u5F55"),
|
|
1469
1469
|
h(
|
|
1470
1470
|
"p",
|
|
1471
1471
|
{ style: { margin: 0, fontSize: 11.5, color: t.text3 } },
|
|
1472
|
-
"
|
|
1472
|
+
"\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"
|
|
1473
1473
|
)
|
|
1474
1474
|
),
|
|
1475
1475
|
h(
|
|
1476
1476
|
"details",
|
|
1477
1477
|
{ style: style.details },
|
|
1478
|
-
h("summary", { style: style.summary }, "
|
|
1478
|
+
h("summary", { style: style.summary }, "\u6539\u7528\u6D4F\u89C8\u5668\u6388\u6743"),
|
|
1479
1479
|
h(
|
|
1480
1480
|
"div",
|
|
1481
1481
|
{ style: { display: "grid", gap: 8, paddingTop: 8 } },
|
|
1482
|
-
h("button", { type: "button", style: style.button, disabled: loading || !serverAddress, onClick: () => beginAuthorization("loopback") }, "
|
|
1483
|
-
h("button", { type: "button", style: style.button, disabled: loading || !serverAddress, onClick: () => beginAuthorization("scheme") }, "
|
|
1484
|
-
h("p", { style: { margin: 0, fontSize: 12, color: t.text3 } }, "
|
|
1482
|
+
h("button", { type: "button", style: style.button, disabled: loading || !serverAddress, onClick: () => beginAuthorization("loopback") }, "\u5728\u6D4F\u89C8\u5668\u4E2D\u6388\u6743"),
|
|
1483
|
+
h("button", { type: "button", style: style.button, disabled: loading || !serverAddress, onClick: () => beginAuthorization("scheme") }, "\u6388\u6743\uFF08\u7C98\u8D34\u56DE\u8C03\uFF09"),
|
|
1484
|
+
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")
|
|
1485
1485
|
)
|
|
1486
1486
|
),
|
|
1487
|
-
accounts.length > 0 ? h("p", { style: { margin: 0, fontSize: 12, color: t.text3 } }, "
|
|
1487
|
+
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
|
|
1488
1488
|
)
|
|
1489
1489
|
) : null,
|
|
1490
1490
|
currentAccount ? h(
|
|
@@ -1493,7 +1493,7 @@ window.__ModuleLoader__.load({
|
|
|
1493
1493
|
h(
|
|
1494
1494
|
"div",
|
|
1495
1495
|
{ style: style.row },
|
|
1496
|
-
h("h2", { style: { ...style.sectionTitle, flex: 1 } }, "
|
|
1496
|
+
h("h2", { style: { ...style.sectionTitle, flex: 1 } }, "\u8FDC\u7A0B\u4F1A\u8BDD"),
|
|
1497
1497
|
h("span", { style: { fontSize: 11, color: t.text3 } }, currentAccount.scopes.filter((s) => s !== "device:connect").join(" \xB7 "))
|
|
1498
1498
|
),
|
|
1499
1499
|
h(
|
|
@@ -1501,7 +1501,7 @@ window.__ModuleLoader__.load({
|
|
|
1501
1501
|
{ style: style.row },
|
|
1502
1502
|
h(
|
|
1503
1503
|
"select",
|
|
1504
|
-
{ style: { ...style.input, flex: "1 1 200px" }, value: accountId, onChange: (event) => setAccountId(event.target.value), "aria-label": "
|
|
1504
|
+
{ style: { ...style.input, flex: "1 1 200px" }, value: accountId, onChange: (event) => setAccountId(event.target.value), "aria-label": "\u5DF2\u6388\u6743\u8D26\u53F7" },
|
|
1505
1505
|
accounts.map((account) => h("option", { key: account.accountId, value: account.accountId }, account.serverOrigin))
|
|
1506
1506
|
),
|
|
1507
1507
|
h("button", { type: "button", style: { ...style.button, flex: "0 0 auto", padding: "6px 10px", fontWeight: 700 }, disabled: loading || addingServer, onClick: () => {
|
|
@@ -1511,22 +1511,22 @@ window.__ModuleLoader__.load({
|
|
|
1511
1511
|
setAuthorizationUrl("");
|
|
1512
1512
|
setAuthorizationMode("");
|
|
1513
1513
|
setCallbackUrl("");
|
|
1514
|
-
setStatus("
|
|
1515
|
-
}, title: "
|
|
1514
|
+
setStatus("\u8BF7\u8F93\u5165 MonkeyAI \u670D\u52A1\u5668\u5730\u5740");
|
|
1515
|
+
}, title: "\u6388\u6743\u53E6\u4E00\u4E2A MonkeyAI \u670D\u52A1\u5668" }, "+ \u6DFB\u52A0\u670D\u52A1\u5668"),
|
|
1516
1516
|
h(
|
|
1517
1517
|
"select",
|
|
1518
1518
|
{ style: { ...style.input, flex: "1 1 220px" }, value: machineId, onChange: (event) => {
|
|
1519
1519
|
const next = event.target.value;
|
|
1520
1520
|
setMachineId(next);
|
|
1521
1521
|
if (next) void loadSessions(next);
|
|
1522
|
-
}, "aria-label": "
|
|
1523
|
-
h("option", { value: "" }, "
|
|
1524
|
-
allDevices.map((device) => h("option", { key: device.machineId, value: device.machineId }, `${device.displayName}${device.status === "online" ? "" : ` \xB7 ${device.status}`}${device.stale ? " \xB7
|
|
1522
|
+
}, "aria-label": "\u8FDC\u7A0B\u8BBE\u5907" },
|
|
1523
|
+
h("option", { value: "" }, "\u9009\u62E9\u8BBE\u5907"),
|
|
1524
|
+
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" : ""}`))
|
|
1525
1525
|
),
|
|
1526
|
-
h("button", { type: "button", style: style.button, disabled: loading, onClick: machineId ? () => loadSessions() : loadDevices, title: machineId ? "
|
|
1527
|
-
h("button", { type: "button", style: style.dangerButton, disabled: !accountId, onClick: disconnectAccount, title: "
|
|
1526
|
+
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"),
|
|
1527
|
+
h("button", { type: "button", style: style.dangerButton, disabled: !accountId, onClick: disconnectAccount, title: "\u64A4\u9500\u8BE5\u8D26\u53F7\u6388\u6743" }, "\u65AD\u5F00\u8FDE\u63A5")
|
|
1528
1528
|
),
|
|
1529
|
-
!hasRead ? h("p", { style: { margin: 0, fontSize: 12, color: t.text3 } }, "session:read
|
|
1529
|
+
!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,
|
|
1530
1530
|
manualDevices.length > 0 ? h(
|
|
1531
1531
|
"div",
|
|
1532
1532
|
{ style: style.row },
|
|
@@ -1537,7 +1537,7 @@ window.__ModuleLoader__.load({
|
|
|
1537
1537
|
h("button", {
|
|
1538
1538
|
type: "button",
|
|
1539
1539
|
style: { border: 0, background: "transparent", cursor: "pointer", padding: 0, color: t.danger, fontWeight: 700, fontSize: 12 },
|
|
1540
|
-
"aria-label":
|
|
1540
|
+
"aria-label": `\u79FB\u9664 ${device.displayName}`,
|
|
1541
1541
|
onClick: () => removeManualDevice(device.machineId)
|
|
1542
1542
|
}, "\xD7")
|
|
1543
1543
|
))
|
|
@@ -1545,7 +1545,7 @@ window.__ModuleLoader__.load({
|
|
|
1545
1545
|
h(
|
|
1546
1546
|
"details",
|
|
1547
1547
|
{ style: style.details },
|
|
1548
|
-
h("summary", { style: style.summary }, "
|
|
1548
|
+
h("summary", { style: style.summary }, "\u627E\u4E0D\u5230\u8BBE\u5907\uFF1F\u6309 machine ID \u6DFB\u52A0"),
|
|
1549
1549
|
h(
|
|
1550
1550
|
"div",
|
|
1551
1551
|
{ style: { display: "grid", gap: 8, paddingTop: 8 } },
|
|
@@ -1555,23 +1555,23 @@ window.__ModuleLoader__.load({
|
|
|
1555
1555
|
h("input", {
|
|
1556
1556
|
style: { ...style.input, flex: "2 1 200px" },
|
|
1557
1557
|
value: manualDeviceId,
|
|
1558
|
-
placeholder: "Machine ID
|
|
1558
|
+
placeholder: "Machine ID\uFF0C\u4F8B\u5982 6f1c2a34-... \u6216 headless-host-01",
|
|
1559
1559
|
onChange: (event) => setManualDeviceId(event.target.value)
|
|
1560
1560
|
}),
|
|
1561
1561
|
h("input", {
|
|
1562
1562
|
style: { ...style.input, flex: "1 1 140px" },
|
|
1563
1563
|
value: manualDeviceName,
|
|
1564
|
-
placeholder: "
|
|
1564
|
+
placeholder: "\u663E\u793A\u540D\u79F0\uFF08\u53EF\u9009\uFF09",
|
|
1565
1565
|
onChange: (event) => setManualDeviceName(event.target.value)
|
|
1566
1566
|
}),
|
|
1567
|
-
h("button", { type: "button", style: style.button, disabled: !manualDeviceId.trim(), onClick: addManualDevice }, "
|
|
1567
|
+
h("button", { type: "button", style: style.button, disabled: !manualDeviceId.trim(), onClick: addManualDevice }, "\u6DFB\u52A0")
|
|
1568
1568
|
)
|
|
1569
1569
|
)
|
|
1570
1570
|
),
|
|
1571
1571
|
h(
|
|
1572
1572
|
"details",
|
|
1573
1573
|
{ style: style.details },
|
|
1574
|
-
h("summary", { style: style.summary }, "
|
|
1574
|
+
h("summary", { style: style.summary }, "\u65B0\u5EFA\u8FDC\u7A0B\u4F1A\u8BDD"),
|
|
1575
1575
|
h(
|
|
1576
1576
|
"div",
|
|
1577
1577
|
{ style: { display: "grid", gap: 8, paddingTop: 8 } },
|
|
@@ -1581,7 +1581,7 @@ window.__ModuleLoader__.load({
|
|
|
1581
1581
|
h("input", {
|
|
1582
1582
|
style: { ...style.input, flex: "2 1 200px" },
|
|
1583
1583
|
value: newSessionCwd,
|
|
1584
|
-
placeholder: "
|
|
1584
|
+
placeholder: "\u5DE5\u4F5C\u76EE\u5F55\uFF0C\u4F8B\u5982 /root",
|
|
1585
1585
|
onChange: (event) => setNewSessionCwd(event.target.value)
|
|
1586
1586
|
}),
|
|
1587
1587
|
h("select", {
|
|
@@ -1589,7 +1589,7 @@ window.__ModuleLoader__.load({
|
|
|
1589
1589
|
value: selectedModel,
|
|
1590
1590
|
disabled: models.length === 0,
|
|
1591
1591
|
onChange: (event) => setSelectedModel(event.target.value),
|
|
1592
|
-
"aria-label": "
|
|
1592
|
+
"aria-label": "\u65B0\u4F1A\u8BDD\u4F7F\u7528\u7684\u6A21\u578B"
|
|
1593
1593
|
}, models.map((m) => h("option", { key: m.id, value: m.id }, m.displayName))),
|
|
1594
1594
|
h("button", {
|
|
1595
1595
|
type: "button",
|
|
@@ -1597,12 +1597,12 @@ window.__ModuleLoader__.load({
|
|
|
1597
1597
|
flex: "0 0 auto",
|
|
1598
1598
|
disabled: loading || !machineId || !newSessionCwd.trim() || newSessionBusy,
|
|
1599
1599
|
onClick: createRemoteSession
|
|
1600
|
-
}, newSessionBusy ? "
|
|
1600
|
+
}, newSessionBusy ? "\u521B\u5EFA\u4E2D\u2026" : "\u521B\u5EFA")
|
|
1601
1601
|
)
|
|
1602
1602
|
)
|
|
1603
1603
|
),
|
|
1604
1604
|
sessionOptions.length > 0 ? h("div", { style: style.sessions }, sessionOptions.map((session) => {
|
|
1605
|
-
const flag = session.stale ? "
|
|
1605
|
+
const flag = session.stale ? "\u5DF2\u8FC7\u671F" : session.deviceStatus && session.deviceStatus !== "online" ? session.deviceStatus === "offline" ? "\u79BB\u7EBF" : session.deviceStatus : "";
|
|
1606
1606
|
return h(
|
|
1607
1607
|
"button",
|
|
1608
1608
|
{
|
|
@@ -1612,13 +1612,13 @@ window.__ModuleLoader__.load({
|
|
|
1612
1612
|
type: "button",
|
|
1613
1613
|
disabled: !session.cwd,
|
|
1614
1614
|
onClick: () => openSession(session),
|
|
1615
|
-
title: session.cwd ?
|
|
1615
|
+
title: session.cwd ? `\u6253\u5F00 ${session.cwd}` : "ACP \u4F1A\u8BDD\u5217\u8868\u672A\u63D0\u4F9B\u5DE5\u4F5C\u76EE\u5F55"
|
|
1616
1616
|
},
|
|
1617
1617
|
h("span", { style: style.sessionTitle }, session.title || session.id),
|
|
1618
|
-
h("span", { style: style.sessionMeta }, session.cwd || "
|
|
1618
|
+
h("span", { style: style.sessionMeta }, session.cwd || "\u52A0\u8F7D\u5386\u53F2\u9700\u8981 runtime \u63D0\u4F9B\u5DE5\u4F5C\u76EE\u5F55"),
|
|
1619
1619
|
flag !== "" ? h("span", { style: { fontSize: 10.5, fontWeight: 650, color: session.stale ? t.text3 : "#8a6d1d", textTransform: "uppercase", letterSpacing: "0.04em" } }, flag) : null
|
|
1620
1620
|
);
|
|
1621
|
-
})) : h("p", { style: style.subtitle }, machineId ? "
|
|
1621
|
+
})) : 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")
|
|
1622
1622
|
) : null,
|
|
1623
1623
|
sessionId ? h(
|
|
1624
1624
|
"section",
|
|
@@ -1629,14 +1629,14 @@ window.__ModuleLoader__.load({
|
|
|
1629
1629
|
h("button", {
|
|
1630
1630
|
type: "button",
|
|
1631
1631
|
style: { ...style.button, flexShrink: 0 },
|
|
1632
|
-
title: "
|
|
1632
|
+
title: "\u5173\u95ED\u4F1A\u8BDD\u5E76\u8FD4\u56DE\u5217\u8868",
|
|
1633
1633
|
onClick: () => {
|
|
1634
1634
|
streamRef.current?.dispose();
|
|
1635
1635
|
streamRef.current = null;
|
|
1636
1636
|
setSessionId("");
|
|
1637
1637
|
setTurnActive(false);
|
|
1638
1638
|
setStopping(false);
|
|
1639
|
-
setStatus("
|
|
1639
|
+
setStatus("\u8FDC\u7A0B\u4F1A\u8BDD\u5DF2\u5173\u95ED");
|
|
1640
1640
|
}
|
|
1641
1641
|
}, "\u2190"),
|
|
1642
1642
|
h("strong", { style: { flex: 1, fontSize: 13.5, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, title }, title),
|
|
@@ -1646,7 +1646,7 @@ window.__ModuleLoader__.load({
|
|
|
1646
1646
|
style: { ...style.input, flex: "0 1 190px", minWidth: 130 },
|
|
1647
1647
|
value: currentModel,
|
|
1648
1648
|
disabled: !hasControl || switchingModel || models.length === 0,
|
|
1649
|
-
title: "
|
|
1649
|
+
title: "\u5207\u6362\u8BE5\u4F1A\u8BDD\u7684\u6A21\u578B",
|
|
1650
1650
|
onChange: (event) => {
|
|
1651
1651
|
const next = event.target.value;
|
|
1652
1652
|
if (next && next !== currentModel) switchSessionModel(next);
|
|
@@ -1674,11 +1674,11 @@ window.__ModuleLoader__.load({
|
|
|
1674
1674
|
historyLoading ? h(
|
|
1675
1675
|
"div",
|
|
1676
1676
|
{ style: { fontSize: 12.5, color: t.text3, textAlign: "center", padding: "32px 12px" } },
|
|
1677
|
-
displayEntries.length > 0 ?
|
|
1677
|
+
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"
|
|
1678
1678
|
) : h(
|
|
1679
1679
|
import_react.default.Fragment,
|
|
1680
1680
|
null,
|
|
1681
|
-
displayEntries.length > visibleCount ? h("div", { style: { fontSize: 11, color: t.text3, textAlign: "center", padding: "6px 0" } },
|
|
1681
|
+
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,
|
|
1682
1682
|
displayEntries.slice(-visibleCount).map((entry) => {
|
|
1683
1683
|
if (entry.kind === "thought") {
|
|
1684
1684
|
return h(
|
|
@@ -1688,7 +1688,7 @@ window.__ModuleLoader__.load({
|
|
|
1688
1688
|
h(
|
|
1689
1689
|
"details",
|
|
1690
1690
|
{ style: style.thought },
|
|
1691
|
-
h("summary", { style: style.thoughtSummary }, "
|
|
1691
|
+
h("summary", { style: style.thoughtSummary }, "\u601D\u8003\u8FC7\u7A0B"),
|
|
1692
1692
|
h("p", { style: { margin: "6px 0 0", whiteSpace: "pre-wrap", overflowWrap: "anywhere", color: "#5b4a72", fontStyle: "italic" } }, entry.text || "")
|
|
1693
1693
|
)
|
|
1694
1694
|
);
|
|
@@ -1708,7 +1708,7 @@ window.__ModuleLoader__.load({
|
|
|
1708
1708
|
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),
|
|
1709
1709
|
isUser ? h("p", { style: { margin: 0, whiteSpace: "pre-wrap", overflowWrap: "anywhere" } }, entry.text || "") : h("div", { className: "mai-md" }, renderMarkdown(entry.text || ""))
|
|
1710
1710
|
),
|
|
1711
|
-
isUser ? h("div", { style: { ...style.avatar, background: avatarColor } }, "
|
|
1711
|
+
isUser ? h("div", { style: { ...style.avatar, background: avatarColor } }, "\u6211") : null
|
|
1712
1712
|
);
|
|
1713
1713
|
}
|
|
1714
1714
|
if (entry.kind === "tool") {
|
|
@@ -1722,8 +1722,8 @@ window.__ModuleLoader__.load({
|
|
|
1722
1722
|
h(
|
|
1723
1723
|
"summary",
|
|
1724
1724
|
{ style: { ...style.row, cursor: "pointer", userSelect: "none", listStyle: "none" } },
|
|
1725
|
-
h("span", { style: { fontSize: 10, fontWeight: 700, color: t.text3, textTransform: "uppercase", letterSpacing: "0.05em", flexShrink: 0 } }, "
|
|
1726
|
-
h("span", { style: { fontSize: 12.5, fontWeight: 600, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1, minWidth: 0 } }, entry.title || "
|
|
1725
|
+
h("span", { style: { fontSize: 10, fontWeight: 700, color: t.text3, textTransform: "uppercase", letterSpacing: "0.05em", flexShrink: 0 } }, "\u5DE5\u5177"),
|
|
1726
|
+
h("span", { style: { fontSize: 12.5, fontWeight: 600, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1, minWidth: 0 } }, entry.title || "\u6267\u884C\u4E2D"),
|
|
1727
1727
|
running ? h("span", { className: "mai-pulse", style: { ...style.dot, width: 6, height: 6, background: "#d4a72c" } }) : null,
|
|
1728
1728
|
h("span", { style: { fontSize: 10.5, padding: "1px 8px", borderRadius: 999, background: statusBg, color: statusColor, fontWeight: 650, flexShrink: 0 } }, statusLabel)
|
|
1729
1729
|
),
|
|
@@ -1734,7 +1734,7 @@ window.__ModuleLoader__.load({
|
|
|
1734
1734
|
return h(
|
|
1735
1735
|
"article",
|
|
1736
1736
|
{ style: style.event, key: entry.key },
|
|
1737
|
-
h("div", { style: { fontSize: 10.5, fontWeight: 700, color: t.text3, marginBottom: 3, textTransform: "uppercase", letterSpacing: "0.04em" } }, "
|
|
1737
|
+
h("div", { style: { fontSize: 10.5, fontWeight: 700, color: t.text3, marginBottom: 3, textTransform: "uppercase", letterSpacing: "0.04em" } }, "\u8BA1\u5212"),
|
|
1738
1738
|
...entry.entries.map((item, index) => h(
|
|
1739
1739
|
"div",
|
|
1740
1740
|
{ style: { display: "flex", gap: 6, fontSize: 12.5, margin: "2px 0" }, key: index },
|
|
@@ -1757,7 +1757,7 @@ window.__ModuleLoader__.load({
|
|
|
1757
1757
|
h(
|
|
1758
1758
|
"details",
|
|
1759
1759
|
null,
|
|
1760
|
-
h("summary", { style: style.summary }, "
|
|
1760
|
+
h("summary", { style: style.summary }, "\u67E5\u770B\u8BE6\u60C5"),
|
|
1761
1761
|
h("pre", { style: { margin: "5px 0 0", whiteSpace: "pre-wrap", overflowWrap: "anywhere", fontSize: 11.5 } }, JSON.stringify(entry.data ?? {}, null, 2))
|
|
1762
1762
|
)
|
|
1763
1763
|
);
|
|
@@ -1789,7 +1789,7 @@ window.__ModuleLoader__.load({
|
|
|
1789
1789
|
sendPrompt();
|
|
1790
1790
|
}
|
|
1791
1791
|
},
|
|
1792
|
-
placeholder: hasControl ? "
|
|
1792
|
+
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",
|
|
1793
1793
|
disabled: !hasControl
|
|
1794
1794
|
}),
|
|
1795
1795
|
turnActive ? h(
|
|
@@ -1799,8 +1799,8 @@ window.__ModuleLoader__.load({
|
|
|
1799
1799
|
style: style.stopButton,
|
|
1800
1800
|
disabled: !hasControl || stopping,
|
|
1801
1801
|
onClick: stopTurn,
|
|
1802
|
-
title: stopping ? "
|
|
1803
|
-
"aria-label": "
|
|
1802
|
+
title: stopping ? "\u505C\u6B62\u4E2D\u2026" : "\u505C\u6B62\u5F53\u524D\u56DE\u5408",
|
|
1803
|
+
"aria-label": "\u505C\u6B62\u5F53\u524D\u56DE\u5408"
|
|
1804
1804
|
},
|
|
1805
1805
|
h("span", { style: style.stopIcon })
|
|
1806
1806
|
) : h(
|
|
@@ -1809,8 +1809,8 @@ window.__ModuleLoader__.load({
|
|
|
1809
1809
|
type: "submit",
|
|
1810
1810
|
style: style.sendButton,
|
|
1811
1811
|
disabled: !streamRef.current || !hasControl || prompt.trim() === "",
|
|
1812
|
-
title: "
|
|
1813
|
-
"aria-label": "
|
|
1812
|
+
title: "\u53D1\u9001\uFF08\u56DE\u8F66\uFF09",
|
|
1813
|
+
"aria-label": "\u53D1\u9001\u6307\u4EE4"
|
|
1814
1814
|
},
|
|
1815
1815
|
h(
|
|
1816
1816
|
"svg",
|
|
@@ -1823,7 +1823,7 @@ window.__ModuleLoader__.load({
|
|
|
1823
1823
|
"div",
|
|
1824
1824
|
{ 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 } },
|
|
1825
1825
|
turnActive ? h("span", { className: "mai-pulse", style: { ...style.dot, background: t.accent } }) : null,
|
|
1826
|
-
turnActive ? stopping ? "
|
|
1826
|
+
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"
|
|
1827
1827
|
) : null
|
|
1828
1828
|
) : null
|
|
1829
1829
|
);
|
|
@@ -1861,8 +1861,8 @@ window.__ModuleLoader__.load({
|
|
|
1861
1861
|
type: "button",
|
|
1862
1862
|
style: { width: "100%", height: "100%", padding: 0, border: 0, background: "transparent", color: "inherit", cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center" },
|
|
1863
1863
|
onClick: () => owner.layout.selectPanel(PANEL_ID),
|
|
1864
|
-
"aria-label": "MonkeyAI
|
|
1865
|
-
title: "MonkeyAI
|
|
1864
|
+
"aria-label": "MonkeyAI \u4F1A\u8BDD",
|
|
1865
|
+
title: "MonkeyAI \u4F1A\u8BDD"
|
|
1866
1866
|
}, h(MonkeyIcon, { size: 18 }));
|
|
1867
1867
|
owner.slots.inject("main", () => owner.slots.register({
|
|
1868
1868
|
name: "main",
|