@takboo/dsh-coopanion 0.4.7 → 0.4.8
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 +4 -4
- package/desktop/main.cjs +19 -15
- package/desktop/tray-state.cjs +10 -5
- package/dist/bridge.js +4 -1
- package/dist/bridge.js.map +2 -2
- package/dist/client.js +371 -7
- package/dist/index.js +333 -8
- package/dist/index.js.map +4 -4
- package/docs/release-notes.md +13 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +5 -4
- package/scripts/check-package.mjs +1 -1
- package/src/bridge.ts +4 -1
- package/src/client/index.ts +21 -3
- package/src/client/locale-sync.ts +34 -0
- package/src/client/notification-copy.ts +3 -2
- package/src/index.ts +32 -4
- package/tests/desktop.mjs +15 -3
- package/tests/install.mjs +8 -0
- package/tests/locale-client.mjs +25 -0
- package/tests/locale-sync.test.ts +36 -0
- package/tests/locale-ui.mjs +79 -0
- package/tests/plugin.test.ts +27 -1
- package/tests/presentation.test.js +16 -1
- package/tests/session-replies-ui.mjs +1 -1
- package/tests/ui.mjs +1 -1
- package/web/index.html +42 -42
- package/web/locale.d.ts +6 -0
- package/web/locale.js +76 -0
- package/web/notification-ui.js +3 -2
- package/web/pet.js +102 -50
- package/web/session-ui.js +3 -2
- package/web/style.css +2 -0
package/dist/index.js
CHANGED
|
@@ -625,8 +625,11 @@ var ElectronBridge = class extends EventEmitter {
|
|
|
625
625
|
removeAction(listener) {
|
|
626
626
|
this.off("action", listener);
|
|
627
627
|
}
|
|
628
|
+
// JSON IPC omits undefined. An explicit null lets a cleared Harness
|
|
629
|
+
// preference restore the renderer's automatic language instead of retaining
|
|
630
|
+
// its previous locale during a merged configuration update.
|
|
628
631
|
configure(options) {
|
|
629
|
-
this.send({ type: "configure", options });
|
|
632
|
+
this.send({ type: "configure", options: { ...options, locale: options.locale ?? null } });
|
|
630
633
|
}
|
|
631
634
|
control(command) {
|
|
632
635
|
this.send({ type: "control", command });
|
|
@@ -1116,6 +1119,299 @@ var PetControls = class {
|
|
|
1116
1119
|
|
|
1117
1120
|
// src/index.ts
|
|
1118
1121
|
import { z as wire } from "zod";
|
|
1122
|
+
|
|
1123
|
+
// web/locale.js
|
|
1124
|
+
function petLanguage(locale = "en") {
|
|
1125
|
+
return /^zh(?:-|$)/i.test(locale) ? "zh" : "en";
|
|
1126
|
+
}
|
|
1127
|
+
var zh = {
|
|
1128
|
+
defaultName: "DeepSeek \u5927\u80A5\u9C7C",
|
|
1129
|
+
title: "DeepSeek \u5927\u80A5\u9C7C \xB7 Harness",
|
|
1130
|
+
words: { neutral: "\u5E73\u9759", happy: "\u5F00\u5FC3", wink: "\u7728\u773C", love: "\u559C\u6B22", shy: "\u5BB3\u7F9E", surprised: "\u60CA\u8BB6", angry: "\u751F\u6C14", sad: "\u96BE\u8FC7", sleepy: "\u72AF\u56F0", thinking: "\u601D\u8003", smug: "\u5F97\u610F", pout: "\u561F\u5634", worried: "\u62C5\u5FC3", determined: "\u8BA4\u771F", flustered: "\u614C\u5F20", scared: "\u5BB3\u6015", excited: "\u671F\u5F85", cry: "\u5927\u54ED", confused: "\u7591\u60D1", stand: "\u7AD9\u8D77", jump: "\u8DF3", hop: "\u5C0F\u8DF3", look: "\u5F20\u671B", turn: "\u8F6C\u8EAB", nod: "\u70B9\u5934", shake: "\u6447\u5934", spin: "\u8F6C\u5708", sit: "\u5750\u4E0B", sleep: "\u7761\u89C9", dizzy: "\u6655", walk: "\u6563\u6B65", run: "\u8DD1", wave: "\u62DB\u624B", bow: "\u97A0\u8EAC", shiver: "\u53D1\u6296", flap: "\u6251\u817E", dance: "\u8DF3\u821E" },
|
|
1131
|
+
settingFailed: "\u8BBE\u7F6E\u672A\u80FD\u4FDD\u5B58",
|
|
1132
|
+
settingFailedBody: "\u8BF7\u56DE\u5230 Harness \u68C0\u67E5\u63D2\u4EF6\u8BBE\u7F6E\u3002",
|
|
1133
|
+
sessionUnavailable: "\u4F1A\u8BDD\u5C1A\u672A\u5C31\u7EEA",
|
|
1134
|
+
sessionUnavailableBody: "\u8BF7\u5148\u56DE\u5230 Harness \u6253\u5F00\u8FD9\u4E2A\u4F1A\u8BDD\uFF0C\u7136\u540E\u518D\u53D1\u9001\u6D88\u606F\u3002",
|
|
1135
|
+
messageFailed: "\u6D88\u606F\u672A\u80FD\u53D1\u9001",
|
|
1136
|
+
messageFailedBody: "\u8BF7\u56DE\u5230 Harness \u68C0\u67E5\u4F1A\u8BDD\u72B6\u6001\u3002",
|
|
1137
|
+
stoppedBody: "\u5148\u505C\u5728\u8FD9\u91CC\uFF0C\u968F\u65F6\u7EE7\u7EED\u3002",
|
|
1138
|
+
interruptedBody: "\u8FD9\u6BB5\u4EFB\u52A1\u4E2D\u65AD\u4E86\uFF0C\u966A\u4F60\u56DE\u53BB\u770B\u770B\u3002",
|
|
1139
|
+
demoTitle: "\u5DE5\u4F5C\u7684\u65F6\u5019\uFF0C\n\u5927\u80A5\u9C7C\u966A\u7740\u3002",
|
|
1140
|
+
demoIntro: "\u4F4F\u5728\u684C\u9762\u4E0A\u7684 DeepSeek \u5927\u80A5\u9C7C\u3002\n\u70B9\u70B9\u5979\u3001\u62D6\u7740\u5979\u8D70\uFF0C\u6216\u548C\u5979\u8BF4\u53E5\u8BDD\u3002",
|
|
1141
|
+
demoStatus: "\u6D4F\u89C8\u5668\u6F14\u793A \xB7 \u6A21\u62DF Harness \u4E8B\u4EF6",
|
|
1142
|
+
demoHint: "\u684C\u9762\u63D2\u4EF6\u4F1A\u8BA2\u9605\u771F\u5B9E\u4EFB\u52A1\uFF0C\u65E0\u9700\u53E6\u586B API Key\u3002",
|
|
1143
|
+
demoButtons: { thinking: "\u601D\u8003", talking: "\u56DE\u590D", working: "\u5DE5\u4F5C", waiting: "\u7B49\u4F60\u786E\u8BA4", happy: "\u4EFB\u52A1\u5B8C\u6210", error: "\u9047\u5230\u95EE\u9898", idle: "\u7A7A\u95F2", long: "\u957F\u56DE\u590D", background: "\u540E\u53F0\u5B8C\u6210" },
|
|
1144
|
+
demoSession: "\u6F14\u793A\u4F1A\u8BDD",
|
|
1145
|
+
demoOther: "\u53E6\u4E00\u4E2A\u60F3\u6CD5",
|
|
1146
|
+
demoPrompt: "\u8BA9\u89D2\u8272\u5728\u601D\u8003\u4E0E\u56DE\u590D\u65F6\u505A\u51FA\u5BF9\u5E94\u7684\u52A8\u4F5C",
|
|
1147
|
+
demoOtherPrompt: "\u91CD\u505A\u89D2\u8272\u83DC\u5355\u4E0E\u4F1A\u8BDD\u9009\u62E9\uFF0C\u8BA9\u5B83\u66F4\u50CF\u4F19\u4F34",
|
|
1148
|
+
demoTexts: { thinking: "\u8BA9\u6211\u60F3\u4E00\u60F3\uFF0C\u600E\u6837\u628A\u8FD9\u4E2A\u529F\u80FD\u505A\u597D\u2026", talking: "\u6211\u60F3\u5230\u4E86\u3002\u8BA9\u601D\u8003\u3001\u8BF4\u8BDD\u4E0E\u5DE5\u4F5C\u5404\u6709\u81EA\u5DF1\u7684\u52A8\u4F5C\uFF0C\u5C31\u80FD\u4E00\u773C\u770B\u51FA\u8FD9\u6BB5\u5BF9\u8BDD\u5728\u505A\u4EC0\u4E48\u3002", working: "\u6B63\u5728\u770B\u6587\u4EF6 \xB7 src/index.ts", waiting: "\u4E0B\u4E00\u6B65\u9700\u8981\u4F60\u786E\u8BA4\u3002\u771F\u5B9E\u63D2\u4EF6\u4F1A\u5F15\u5BFC\u4F60\u56DE\u5230 Harness\u3002", happy: "\u4EFB\u52A1\u5B8C\u6210\u5566\uFF01\u8981\u4E0D\u8981\u4F11\u606F\u4E00\u4E0B\uFF1F\u{1F433}", error: "\u4EFB\u52A1\u9047\u5230\u4E86\u95EE\u9898\uFF0C\u8BF7\u56DE\u5230 Harness \u67E5\u770B\u8BE6\u60C5\u3002" },
|
|
1149
|
+
demoLong: "\u52A8\u753B\u3001\u6C14\u6CE1\u548C\u4F1A\u8BDD\u7684\u5C55\u793A\u5DF2\u7ECF\u5206\u5F00\u4E86\u3002\n\n" + "\u601D\u8003\u548C\u5DE5\u5177\u8C03\u7528\u7531\u52A8\u4F5C\u8868\u8FBE\uFF0C\u6700\u7EC8\u56DE\u590D\u53EF\u4EE5\u5C55\u5F00\u9605\u8BFB\u3002\u957F\u5185\u5BB9\u4F1A\u5B8C\u6574\u4FDD\u7559\uFF0C\u4E0D\u4F1A\u5728\u4E00\u5343\u4E8C\u767E\u5B57\u5904\u622A\u65AD\u3002\n\n".repeat(35) + "\u6700\u540E\u4E00\u53E5\uFF1A\u8FD9\u4EFD\u56DE\u590D\u5B8C\u6574\u5730\u4FDD\u7559\u4E0B\u6765\u4E86\u3002",
|
|
1150
|
+
demoBackground: "\u540E\u53F0\u4F1A\u8BDD\u5DF2\u7ECF\u5B8C\u6210\uFF0C\u8FD9\u662F\u5B83\u7684\u6700\u7EC8\u56DE\u590D\u3002",
|
|
1151
|
+
demoReply: (text) => `\u6536\u5230\u300C${text}\u300D\uFF01\u8FD9\u662F\u6F14\u793A\u56DE\u590D\u3002\u771F\u5B9E\u63D2\u4EF6\u4F1A\u4F7F\u7528 Harness \u7684\u6A21\u578B\u3002`,
|
|
1152
|
+
labels: { idle: "\u5728\u8FD9\u91CC\u966A\u4F60", thinking: "\u6B63\u5728\u601D\u8003", talking: "\u6B63\u5728\u56DE\u590D", working: "\u6B63\u5728\u5FD9", waiting: "\u7B49\u4F60\u786E\u8BA4", happy: "\u5B8C\u6210\u5566", error: "\u9700\u8981\u5173\u6CE8", sleeping: "\u4F11\u606F\u4E2D" },
|
|
1153
|
+
stage: "\u684C\u5BA0\u6D3B\u52A8\u533A\u57DF",
|
|
1154
|
+
dismiss: "\u6536\u8D77\u6C14\u6CE1",
|
|
1155
|
+
reveal: "\u7ACB\u5373\u663E\u793A",
|
|
1156
|
+
expand: "\u5C55\u5F00\u5B8C\u6574\u56DE\u590D \u2197",
|
|
1157
|
+
back: "\u56DE\u5230\u4F1A\u8BDD \u2197",
|
|
1158
|
+
readerClose: "\u6536\u8D77\u5B8C\u6574\u56DE\u590D",
|
|
1159
|
+
conversationsCaption: "\u4E00\u8D77\u5DE5\u4F5C\u7684\u7247\u6BB5",
|
|
1160
|
+
conversationsTitle: "\u8FD9\u6B21\uFF0C\u966A\u54EA\u4E00\u6BB5\uFF1F",
|
|
1161
|
+
conversationsClose: "\u6536\u8D77\u5BF9\u8BDD\u6C14\u6CE1",
|
|
1162
|
+
conversationsIntro: "\u56FA\u5B9A\u966A\u7740\u4F60\u9009\u7684\u8FD9\u6BB5\u3002\u540E\u53F0\u7EE7\u7EED\u5DE5\u4F5C\uFF0C\u56DE\u590D\u7559\u5728\u8FD9\u91CC\uFF0C\u9047\u5230\u8981\u7D27\u4E8B\u5C31\u53EB\u4F60\u3002",
|
|
1163
|
+
all: "\u5168\u90E8",
|
|
1164
|
+
pending: "\u5F85\u67E5\u770B",
|
|
1165
|
+
searchPlaceholder: "\u627E\u63D0\u95EE\u3001\u9879\u76EE\u6216\u7F16\u53F7\u2026",
|
|
1166
|
+
searchLabel: "\u641C\u7D22\u4F1A\u8BDD",
|
|
1167
|
+
switchConversation: "\u5207\u6362\u5F53\u524D\u5BF9\u8BDD",
|
|
1168
|
+
openCurrent: "\u6253\u5F00\u5F53\u524D\u4F1A\u8BDD \u2197",
|
|
1169
|
+
chatTitle: "\u6211\u5728\uFF0C\u6162\u6162\u8BF4\u3002",
|
|
1170
|
+
chatClose: "\u5173\u95ED\u804A\u5929",
|
|
1171
|
+
changeConversation: "\u6362\u4E00\u6BB5 \u203A",
|
|
1172
|
+
readFull: "\u8BFB\u5B8C\u6574\u56DE\u590D \u2197",
|
|
1173
|
+
interact: "\u548C\u89D2\u8272\u4E92\u52A8",
|
|
1174
|
+
wave: "\u6253\u4E2A\u62DB\u547C",
|
|
1175
|
+
cheer: "\u7ED9\u6211\u6253\u6C14",
|
|
1176
|
+
messagePlaceholder: "\u63A5\u7740\u8FD9\u6BB5\u5BF9\u8BDD\u8BF4\u70B9\u4EC0\u4E48\u2026",
|
|
1177
|
+
messageLabel: "\u6D88\u606F",
|
|
1178
|
+
sendHint: "\u2318 / Ctrl + Enter \u53D1\u9001",
|
|
1179
|
+
send: "\u634E\u7ED9\u8FD9\u6BB5\u5BF9\u8BDD \u2197",
|
|
1180
|
+
companion: "\u684C\u4E0A\u7684\u5C0F\u4F19\u4F34",
|
|
1181
|
+
menuClose: "\u6536\u8D77\u4F19\u4F34\u83DC\u5355",
|
|
1182
|
+
appearance: "\u6362\u4E2A\u6A21\u6837",
|
|
1183
|
+
appearanceHint: "\u89D2\u8272 \xB7 \u914D\u8272 \xB7 \u52A8\u4F5C",
|
|
1184
|
+
say: "\u8BF4\u53E5\u8BDD",
|
|
1185
|
+
sayHint: "\u63A5\u7740\u4F60\u7684\u4F1A\u8BDD\u804A",
|
|
1186
|
+
roam: "\u6563\u6563\u6B65",
|
|
1187
|
+
roamHint: "\u81EA\u5728\u8D70\u52A8",
|
|
1188
|
+
sleep: "\u6B47\u4E00\u4F1A",
|
|
1189
|
+
sleepHint: "\u5FD9\u8D77\u6765\u4F1A\u9192",
|
|
1190
|
+
notices: "\u63D0\u9192\u6211",
|
|
1191
|
+
noticesHint: "\u8981\u7D27\u4E8B\u4E0D\u6F0F\u6389",
|
|
1192
|
+
sound: "\u5C0F\u5C0F\u58F0",
|
|
1193
|
+
soundHint: "\u52A8\u4F5C\u4E0E\u8BF4\u8BDD\u97F3\u6548",
|
|
1194
|
+
hide: "\u6682\u65F6\u85CF\u8D77\u6765",
|
|
1195
|
+
source: "\u6E90\u7801 \xB7 AGPL \u2197",
|
|
1196
|
+
sourceHint: "\u4E0B\u8F7D\u5F53\u524D\u7248\u672C\u5B8C\u6574\u5BF9\u5E94\u6E90\u7801",
|
|
1197
|
+
characters: "\u89D2\u8272\u4E0E\u52A8\u753B",
|
|
1198
|
+
charactersClose: "\u5173\u95ED\u89D2\u8272\u9762\u677F",
|
|
1199
|
+
selectCharacter: "\u9009\u62E9\u89D2\u8272",
|
|
1200
|
+
character: "\u89D2\u8272",
|
|
1201
|
+
outfit: "\u914D\u8272 / \u6362\u88C5",
|
|
1202
|
+
characterScheme: "\u89D2\u8272\u914D\u8272",
|
|
1203
|
+
preview: "\u89D2\u8272\u52A8\u753B\u9884\u89C8",
|
|
1204
|
+
previewAction: "\u9884\u89C8\u52A8\u4F5C",
|
|
1205
|
+
play: "\u64AD\u653E\u52A8\u4F5C",
|
|
1206
|
+
useCharacter: "\u4F7F\u7528\u89D2\u8272",
|
|
1207
|
+
import: "\u5BFC\u5165\u89D2\u8272\u5305",
|
|
1208
|
+
remove: "\u5220\u9664",
|
|
1209
|
+
characterHint: "\u652F\u6301 Coopanion API 2 ZIP \u89D2\u8272\u5305\uFF1B\u89D2\u8272\u548C\u914D\u8272\u4F1A\u5728\u91CD\u542F\u540E\u4FDD\u7559\u3002",
|
|
1210
|
+
using: "\u6B63\u5728\u4F7F\u7528",
|
|
1211
|
+
useScheme: "\u4F7F\u7528\u8FD9\u4E2A\u914D\u8272",
|
|
1212
|
+
useOutfit: "\u4F7F\u7528\u8FD9\u4E2A\u642D\u914D",
|
|
1213
|
+
customOutfit: "\u81EA\u5B9A\u4E49\u642D\u914D",
|
|
1214
|
+
defaultScheme: "\u9ED8\u8BA4",
|
|
1215
|
+
imported: "\u5DF2\u5BFC\u5165\u3002\u9884\u89C8\u6EE1\u610F\u540E\u70B9\u51FB\u4F7F\u7528\u89D2\u8272\u3002",
|
|
1216
|
+
switched: "\u5DF2\u5207\u6362\uFF0C\u91CD\u542F\u540E\u4F1A\u4FDD\u7559\u8FD9\u4E2A\u89D2\u8272\u548C\u914D\u8272\u3002",
|
|
1217
|
+
removed: "\u5DF2\u5220\u9664\u672C\u5730\u89D2\u8272\u5305\u3002",
|
|
1218
|
+
packTooLarge: "\u89D2\u8272\u5305\u4E0D\u80FD\u8D85\u8FC7 128 MiB",
|
|
1219
|
+
noSession: "\u8FD8\u6CA1\u6709\u5BF9\u8BDD",
|
|
1220
|
+
noConversation: "\u8FD8\u6CA1\u6709\u4F1A\u8BDD",
|
|
1221
|
+
session: "\u4F1A\u8BDD",
|
|
1222
|
+
sessionReply: "\u4F1A\u8BDD\u56DE\u590D",
|
|
1223
|
+
focused: "\u5173\u6CE8",
|
|
1224
|
+
unread: "1 \u4EFD\u672A\u8BFB",
|
|
1225
|
+
notOpen: "\u672A\u6253\u5F00",
|
|
1226
|
+
connected: "\u6709\u4F1A\u8BDD\u76F8\u4F34",
|
|
1227
|
+
emptySearch: "\u6CA1\u627E\u5230\u8FD9\u6BB5\u5BF9\u8BDD\u3002\u8BD5\u8BD5\u63D0\u95EE\u91CC\u7684\u8BCD\u6216\u9879\u76EE\u540D\uFF1F",
|
|
1228
|
+
emptyPending: "\u90FD\u770B\u8FC7\u5566\uFF0C\u5B89\u5FC3\u505A\u624B\u8FB9\u7684\u4E8B\u3002",
|
|
1229
|
+
emptySessions: "\u8FD8\u6CA1\u6709\u53EF\u7528\u7684\u5BF9\u8BDD\u3002\u5148\u5728 Harness \u4E2D\u6253\u5F00\u4E00\u6BB5\u5BF9\u8BDD\uFF0C\u6211\u5C31\u80FD\u542C\u89C1\u5B83\u3002",
|
|
1230
|
+
noChat: "\u5148\u5728 Harness \u4E2D\u6253\u5F00\u4E00\u6BB5\u5BF9\u8BDD\uFF0C\u5C31\u53EF\u4EE5\u4ECE\u8FD9\u91CC\u548C\u6211\u8BF4\u8BDD\u3002",
|
|
1231
|
+
unavailableChat: "\u8FD9\u6BB5\u5BF9\u8BDD\u5C1A\u672A\u5728 Harness \u4E2D\u6253\u5F00\uFF0C\u8BF7\u5148\u56DE\u53BB\u6253\u5F00\u5B83\u3002",
|
|
1232
|
+
sleepBusy: "\u6B63\u5728\u5FD9\uFF0C\u5B8C\u6210\u540E\u518D\u4F11\u606F",
|
|
1233
|
+
sleepWake: "\u6709\u65B0\u7684\u4EFB\u52A1\u4F1A\u81EA\u52A8\u9192\u6765",
|
|
1234
|
+
issueError: "\u4EFB\u52A1\u9047\u5230\u4E86\u95EE\u9898\uFF0C\u8BF7\u56DE\u5230 Harness \u67E5\u770B\u8BE6\u60C5\u3002",
|
|
1235
|
+
issueWaiting: "\u4EFB\u52A1\u6682\u65F6\u505C\u4E0B\u4E86\uFF0C\u8BF7\u56DE\u5230 Harness \u770B\u770B\u3002",
|
|
1236
|
+
timeUnknown: "\u65F6\u95F4\u672A\u8BB0\u5F55",
|
|
1237
|
+
petLabel: (name2) => `${name2}\uFF0C\u70B9\u51FB\u4E92\u52A8\uFF0C\u53CC\u51FB\u804A\u5929\uFF0C\u53F3\u952E\u83DC\u5355\uFF0C\u62D6\u52A8\u79FB\u52A8`,
|
|
1238
|
+
finalReply: (name2) => `${name2}\u7684\u6700\u7EC8\u56DE\u590D`,
|
|
1239
|
+
recent: (text) => `\u6700\u8FD1\uFF1A${text}`,
|
|
1240
|
+
chatTarget: (label) => `\u5F53\u524D\u5BF9\u8BDD\uFF1A${label}\u3002\u70B9\u51FB\u5207\u6362`,
|
|
1241
|
+
chatHelp: (label) => `\u6D88\u606F\u4EA4\u7ED9\u300C${label}\u300D\uFF0C\u5B8C\u6210\u540E\u53EA\u5C55\u793A\u6700\u7EC8\u56DE\u590D\u3002`,
|
|
1242
|
+
activity: (busy, unread) => `${busy} \u6BB5\u8FDB\u884C\u4E2D \xB7 ${unread} \u4EFD\u672A\u8BFB\u56DE\u590D`,
|
|
1243
|
+
authorCredit: (author, credits, license) => `\u4F5C\u8005\uFF1A${author} \xB7 ${credits} \xB7 \u8BB8\u53EF\uFF1A${license}`,
|
|
1244
|
+
unknownAuthor: "\u672A\u6CE8\u660E",
|
|
1245
|
+
builtinLicense: "\u4EE3\u7801 AGPL-3.0-or-later\uFF1B\u7D20\u6750\u89C1\u6743\u5229\u58F0\u660E",
|
|
1246
|
+
authorLicense: "\u7531\u89D2\u8272\u4F5C\u8005\u6CE8\u660E",
|
|
1247
|
+
operationError: (detail) => `\u64CD\u4F5C\u672A\u5B8C\u6210\uFF1A${detail}`,
|
|
1248
|
+
bodyError: (detail) => `\u89D2\u8272\u8FD0\u884C\u5931\u8D25\uFF1A${detail}`,
|
|
1249
|
+
builtinError: (detail) => `\u65E0\u6CD5\u52A0\u8F7D\u5185\u7F6E\u89D2\u8272\uFF1A${detail}`,
|
|
1250
|
+
previewError: (detail) => `\u9884\u89C8\u5931\u8D25\uFF1A${detail}`,
|
|
1251
|
+
restoreError: (detail) => `\u5DF2\u6062\u590D\u5185\u7F6E\u5927\u80A5\u9C7C\uFF1A${detail}`,
|
|
1252
|
+
loadError: (detail) => `\u89D2\u8272\u52A0\u8F7D\u5931\u8D25\uFF1A${detail}`,
|
|
1253
|
+
trayOpen: "\u56DE\u5230\u5F53\u524D\u4F1A\u8BDD",
|
|
1254
|
+
traySwitch: "\u5207\u6362\u966A\u4F34\u4F1A\u8BDD",
|
|
1255
|
+
trayChat: "\u8BF4\u53E5\u8BDD",
|
|
1256
|
+
trayCharacters: "\u89D2\u8272\u4E0E\u914D\u8272",
|
|
1257
|
+
trayRoam: "\u81EA\u5728\u8D70\u52A8",
|
|
1258
|
+
traySleep: "\u4F11\u606F\u4E00\u4E0B\uFF08\u65B0\u4EFB\u52A1\u4F1A\u5524\u9192\uFF09",
|
|
1259
|
+
trayNotices: "\u4EFB\u52A1\u63D0\u9192",
|
|
1260
|
+
traySound: "\u52A8\u4F5C\u4E0E\u8BF4\u8BDD\u97F3\u6548",
|
|
1261
|
+
trayShow: "\u663E\u793A\u4F19\u4F34",
|
|
1262
|
+
trayQuit: "\u5173\u95ED\u684C\u5BA0",
|
|
1263
|
+
trayNeeds: " \xB7 \u9700\u8981\u4F60",
|
|
1264
|
+
trayUnread: (n) => ` \xB7 ${n} \u4EFD\u672A\u8BFB`,
|
|
1265
|
+
trayPending: (unread, pending) => `\u5F85\u67E5\u770B \xB7 ${unread} \u4EFD\u56DE\u590D \xB7 ${pending} \u6BB5\u9700\u8981\u4F60`,
|
|
1266
|
+
trayTooltip: (name2, mood, label, busy, pending, unread) => `${name2} \xB7 ${mood}
|
|
1267
|
+
\u5173\u6CE8\uFF1A${label}
|
|
1268
|
+
${busy} \u6BB5\u8FDB\u884C\u4E2D \xB7 ${pending} \u6BB5\u9700\u8981\u4F60 \xB7 ${unread} \u4EFD\u672A\u8BFB\u56DE\u590D`
|
|
1269
|
+
};
|
|
1270
|
+
var en = {
|
|
1271
|
+
defaultName: "DeepSeek Whale",
|
|
1272
|
+
title: "DeepSeek Whale \xB7 Harness",
|
|
1273
|
+
words: { neutral: "Neutral", happy: "Happy", wink: "Wink", love: "Love", shy: "Shy", surprised: "Surprised", angry: "Angry", sad: "Sad", sleepy: "Sleepy", thinking: "Thinking", smug: "Smug", pout: "Pout", worried: "Worried", determined: "Determined", flustered: "Flustered", scared: "Scared", excited: "Excited", cry: "Cry", confused: "Confused", stand: "Stand", jump: "Jump", hop: "Hop", look: "Look around", turn: "Turn", nod: "Nod", shake: "Shake head", spin: "Spin", sit: "Sit", sleep: "Sleep", dizzy: "Dizzy", walk: "Walk", run: "Run", wave: "Wave", bow: "Bow", shiver: "Shiver", flap: "Flap", dance: "Dance" },
|
|
1274
|
+
settingFailed: "Settings were not saved",
|
|
1275
|
+
settingFailedBody: "Open Harness to check the plugin settings.",
|
|
1276
|
+
sessionUnavailable: "Conversation not ready",
|
|
1277
|
+
sessionUnavailableBody: "Open this conversation in Harness before sending a message.",
|
|
1278
|
+
messageFailed: "Message was not sent",
|
|
1279
|
+
messageFailedBody: "Open Harness to check the conversation state.",
|
|
1280
|
+
stoppedBody: "Paused here. Continue whenever you are ready.",
|
|
1281
|
+
interruptedBody: "This task was interrupted. Open the conversation to check it.",
|
|
1282
|
+
demoTitle: "While you work,\nWhale keeps you company.",
|
|
1283
|
+
demoIntro: "Your DeepSeek Whale desktop companion.\nSay hello, drag her around, or continue a conversation.",
|
|
1284
|
+
demoStatus: "Browser demo \xB7 Simulated Harness events",
|
|
1285
|
+
demoHint: "The desktop plugin follows real tasks. No extra API key is needed.",
|
|
1286
|
+
demoButtons: { thinking: "Think", talking: "Reply", working: "Work", waiting: "Approval", happy: "Finished", error: "Error", idle: "Idle", long: "Long reply", background: "Background reply" },
|
|
1287
|
+
demoSession: "Demo conversation",
|
|
1288
|
+
demoOther: "Another idea",
|
|
1289
|
+
demoPrompt: "Match the character\u2019s actions to thinking and replying",
|
|
1290
|
+
demoOtherPrompt: "Make the character menu and conversation picker feel like a companion",
|
|
1291
|
+
demoTexts: { thinking: "Let me think about how to do this\u2026", talking: "Thinking, replying and working each have their own actions, so you can see what this conversation is doing.", working: "Reading files \xB7 src/index.ts", waiting: "The next step needs your approval. The installed plugin opens Harness.", happy: "Finished! Shall we take a rest? \u{1F433}", error: "This task needs attention. Open Harness for details." },
|
|
1292
|
+
demoLong: "Animation, bubbles and conversations are presented separately.\n\n" + "Actions show thinking and tool use. Final replies open in full and remain complete, including long content.\n\n".repeat(35) + "The complete reply has been preserved.",
|
|
1293
|
+
demoBackground: "The background conversation finished. Here is its final reply.",
|
|
1294
|
+
demoReply: (text) => `Received \u201C${text}\u201D! This is a demo reply. The installed plugin uses the Harness model.`,
|
|
1295
|
+
labels: { idle: "Here for you", thinking: "Thinking", talking: "Replying", working: "Working", waiting: "Waiting for you", happy: "Finished", error: "Needs attention", sleeping: "Resting" },
|
|
1296
|
+
stage: "Desktop pet activity area",
|
|
1297
|
+
dismiss: "Dismiss bubble",
|
|
1298
|
+
reveal: "Show now",
|
|
1299
|
+
expand: "Read full reply \u2197",
|
|
1300
|
+
back: "Back to conversation \u2197",
|
|
1301
|
+
readerClose: "Close full reply",
|
|
1302
|
+
conversationsCaption: "Working together",
|
|
1303
|
+
conversationsTitle: "Which conversation shall we join?",
|
|
1304
|
+
conversationsClose: "Close conversations",
|
|
1305
|
+
conversationsIntro: "Stay with the conversation you choose. Background work continues, replies stay here, and important requests get your attention.",
|
|
1306
|
+
all: "All",
|
|
1307
|
+
pending: "Inbox",
|
|
1308
|
+
searchPlaceholder: "Find a prompt, project or ID\u2026",
|
|
1309
|
+
searchLabel: "Search conversations",
|
|
1310
|
+
switchConversation: "Switch current conversation",
|
|
1311
|
+
openCurrent: "Open current conversation \u2197",
|
|
1312
|
+
chatTitle: "I\u2019m here. Take your time.",
|
|
1313
|
+
chatClose: "Close chat",
|
|
1314
|
+
changeConversation: "Switch \u203A",
|
|
1315
|
+
readFull: "Read full reply \u2197",
|
|
1316
|
+
interact: "Interact with the character",
|
|
1317
|
+
wave: "Say hello",
|
|
1318
|
+
cheer: "Cheer me on",
|
|
1319
|
+
messagePlaceholder: "Continue this conversation\u2026",
|
|
1320
|
+
messageLabel: "Message",
|
|
1321
|
+
sendHint: "\u2318 / Ctrl + Enter to send",
|
|
1322
|
+
send: "Send to this conversation \u2197",
|
|
1323
|
+
companion: "Your desktop companion",
|
|
1324
|
+
menuClose: "Close companion menu",
|
|
1325
|
+
appearance: "Change appearance",
|
|
1326
|
+
appearanceHint: "Character \xB7 Colours \xB7 Actions",
|
|
1327
|
+
say: "Say something",
|
|
1328
|
+
sayHint: "Continue your conversation",
|
|
1329
|
+
roam: "Take a walk",
|
|
1330
|
+
roamHint: "Roam freely",
|
|
1331
|
+
sleep: "Take a rest",
|
|
1332
|
+
sleepHint: "Wake when work starts",
|
|
1333
|
+
notices: "Keep me posted",
|
|
1334
|
+
noticesHint: "Remember important requests",
|
|
1335
|
+
sound: "A little sound",
|
|
1336
|
+
soundHint: "Action and reply sounds",
|
|
1337
|
+
hide: "Hide for now",
|
|
1338
|
+
source: "Source \xB7 AGPL \u2197",
|
|
1339
|
+
sourceHint: "Download the complete source for this version",
|
|
1340
|
+
characters: "Characters and animation",
|
|
1341
|
+
charactersClose: "Close character panel",
|
|
1342
|
+
selectCharacter: "Select character",
|
|
1343
|
+
character: "Character",
|
|
1344
|
+
outfit: "Colours / Outfit",
|
|
1345
|
+
characterScheme: "Character colours",
|
|
1346
|
+
preview: "Character animation preview",
|
|
1347
|
+
previewAction: "Preview action",
|
|
1348
|
+
play: "Play action",
|
|
1349
|
+
useCharacter: "Use character",
|
|
1350
|
+
import: "Import character pack",
|
|
1351
|
+
remove: "Delete",
|
|
1352
|
+
characterHint: "Coopanion API 2 ZIP packs. Characters and colours survive restarts.",
|
|
1353
|
+
using: "In use",
|
|
1354
|
+
useScheme: "Use these colours",
|
|
1355
|
+
useOutfit: "Use this outfit",
|
|
1356
|
+
customOutfit: "Custom outfit",
|
|
1357
|
+
defaultScheme: "Default",
|
|
1358
|
+
imported: "Imported. Preview the character, then choose Use character.",
|
|
1359
|
+
switched: "Changed. This character and its colours will survive restarts.",
|
|
1360
|
+
removed: "Local character pack deleted.",
|
|
1361
|
+
packTooLarge: "Character packs cannot exceed 128 MiB",
|
|
1362
|
+
noSession: "No conversation yet",
|
|
1363
|
+
noConversation: "No conversation yet",
|
|
1364
|
+
session: "Conversation",
|
|
1365
|
+
sessionReply: "Conversation reply",
|
|
1366
|
+
focused: "Focused",
|
|
1367
|
+
unread: "1 unread reply",
|
|
1368
|
+
notOpen: "Not open",
|
|
1369
|
+
connected: "Conversation connected",
|
|
1370
|
+
emptySearch: "No matching conversation. Try a word from the prompt or project name.",
|
|
1371
|
+
emptyPending: "All read. Carry on with your work.",
|
|
1372
|
+
emptySessions: "No conversation is available. Open one in Harness to get started.",
|
|
1373
|
+
noChat: "Open a conversation in Harness to chat here.",
|
|
1374
|
+
unavailableChat: "This conversation is not open in Harness. Open it there first.",
|
|
1375
|
+
sleepBusy: "Working now. Rest when it is done.",
|
|
1376
|
+
sleepWake: "Wake automatically when new work starts.",
|
|
1377
|
+
issueError: "The task needs attention. Open Harness for details.",
|
|
1378
|
+
issueWaiting: "The task paused. Open Harness to check the next step.",
|
|
1379
|
+
timeUnknown: "Time not recorded",
|
|
1380
|
+
petLabel: (name2) => `${name2}, click to interact, double-click to chat, right-click for the menu, drag to move`,
|
|
1381
|
+
finalReply: (name2) => `Final reply from ${name2}`,
|
|
1382
|
+
recent: (text) => `Recent: ${text}`,
|
|
1383
|
+
chatTarget: (label) => `Current conversation: ${label}. Click to switch`,
|
|
1384
|
+
chatHelp: (label) => `Send to \u201C${label}\u201D. Only the final reply is shown when the task completes.`,
|
|
1385
|
+
activity: (busy, unread) => `${busy} active \xB7 ${unread} unread replies`,
|
|
1386
|
+
authorCredit: (author, credits, license) => `Author: ${author} \xB7 ${credits} \xB7 License: ${license}`,
|
|
1387
|
+
unknownAuthor: "Not specified",
|
|
1388
|
+
builtinLicense: "Code: AGPL-3.0-or-later; see artwork rights notice",
|
|
1389
|
+
authorLicense: "Specified by the character author",
|
|
1390
|
+
operationError: (detail) => `Operation failed: ${detail}`,
|
|
1391
|
+
bodyError: (detail) => `Character runtime failed: ${detail}`,
|
|
1392
|
+
builtinError: (detail) => `Cannot load the built-in character: ${detail}`,
|
|
1393
|
+
previewError: (detail) => `Preview failed: ${detail}`,
|
|
1394
|
+
restoreError: (detail) => `Built-in Whale restored: ${detail}`,
|
|
1395
|
+
loadError: (detail) => `Character failed to load: ${detail}`,
|
|
1396
|
+
trayOpen: "Open current conversation",
|
|
1397
|
+
traySwitch: "Choose companion conversation",
|
|
1398
|
+
trayChat: "Say something",
|
|
1399
|
+
trayCharacters: "Characters and colours",
|
|
1400
|
+
trayRoam: "Roam freely",
|
|
1401
|
+
traySleep: "Rest (new work wakes the pet)",
|
|
1402
|
+
trayNotices: "Task reminders",
|
|
1403
|
+
traySound: "Action and reply sounds",
|
|
1404
|
+
trayShow: "Show companion",
|
|
1405
|
+
trayQuit: "Close desktop pet",
|
|
1406
|
+
trayNeeds: " \xB7 Needs attention",
|
|
1407
|
+
trayUnread: (n) => ` \xB7 ${n} unread`,
|
|
1408
|
+
trayPending: (unread, pending) => `Inbox \xB7 ${unread} replies \xB7 ${pending} need attention`,
|
|
1409
|
+
trayTooltip: (name2, mood, label, busy, pending, unread) => `${name2} \xB7 ${mood}
|
|
1410
|
+
Focused: ${label}
|
|
1411
|
+
${busy} active \xB7 ${pending} need attention \xB7 ${unread} unread replies`
|
|
1412
|
+
};
|
|
1413
|
+
|
|
1414
|
+
// src/index.ts
|
|
1119
1415
|
var name = "dsh-coopanion";
|
|
1120
1416
|
var inject = ["agents"];
|
|
1121
1417
|
var Config = z2.object({
|
|
@@ -1144,7 +1440,33 @@ async function mountPet(ctx, options, bridge) {
|
|
|
1144
1440
|
});
|
|
1145
1441
|
const currentOptions = () => ({ size: options.size.get(), roam: options.roam.get(), notifications: options.notifications.get(), bubbleDurationMs: options.bubbleDurationMs.get(), systemNotifications: options.systemNotifications.get(), reminders: options.reminders.get(), reminderDelayMs: options.reminderDelayMs.get(), electronPath: options.electronPath, locale, ...preferences });
|
|
1146
1442
|
const controls = new PetControls(bridge, currentOptions);
|
|
1147
|
-
let locale
|
|
1443
|
+
let locale;
|
|
1444
|
+
let clientLocale;
|
|
1445
|
+
let dedicatedLocale = false;
|
|
1446
|
+
let storedLocale;
|
|
1447
|
+
const syncLocale = () => {
|
|
1448
|
+
const preference = storedLocale?.();
|
|
1449
|
+
const next = preference ? petLanguage(preference) : clientLocale;
|
|
1450
|
+
if (next === locale) return;
|
|
1451
|
+
locale = next;
|
|
1452
|
+
controls.configure();
|
|
1453
|
+
};
|
|
1454
|
+
const adoptClientLocale = (value) => {
|
|
1455
|
+
clientLocale = petLanguage(value);
|
|
1456
|
+
syncLocale();
|
|
1457
|
+
};
|
|
1458
|
+
ctx.inject(["settings"], (child) => {
|
|
1459
|
+
const read = () => {
|
|
1460
|
+
const value = child.settings.describe({ redactSecrets: true }).find((entry) => entry.ns === "locale")?.value;
|
|
1461
|
+
const preference = isRecord(value) && typeof value.preference === "string" ? value.preference.toLowerCase() : void 0;
|
|
1462
|
+
return preference === "zh" || preference === "en" ? preference : void 0;
|
|
1463
|
+
};
|
|
1464
|
+
storedLocale = read;
|
|
1465
|
+
child.effect(() => () => {
|
|
1466
|
+
if (storedLocale === read) storedLocale = void 0;
|
|
1467
|
+
});
|
|
1468
|
+
syncLocale();
|
|
1469
|
+
});
|
|
1148
1470
|
let navigation;
|
|
1149
1471
|
ctx.provide("coopanion", controls);
|
|
1150
1472
|
const update = () => {
|
|
@@ -1213,12 +1535,18 @@ async function mountPet(ctx, options, bridge) {
|
|
|
1213
1535
|
if (ns === "dsh-coopanion") {
|
|
1214
1536
|
broker.preferences(notificationPrefs());
|
|
1215
1537
|
controls.configure();
|
|
1216
|
-
}
|
|
1538
|
+
} else if (ns === "locale") syncLocale();
|
|
1217
1539
|
});
|
|
1218
1540
|
ctx.inject(["connection"], (child) => {
|
|
1219
1541
|
const dispatch = async (endpoint, payload, signal) => {
|
|
1220
1542
|
try {
|
|
1221
1543
|
if (signal.aborted) throw new Error("\u8BF7\u6C42\u5DF2\u53D6\u6D88");
|
|
1544
|
+
if (endpoint === "locale") {
|
|
1545
|
+
const input = wire.object({ locale: wire.enum(["zh", "en"]) }).strict().parse(payload);
|
|
1546
|
+
dedicatedLocale = true;
|
|
1547
|
+
adoptClientLocale(input.locale);
|
|
1548
|
+
return { ok: true, value: { locale } };
|
|
1549
|
+
}
|
|
1222
1550
|
if (endpoint === "status") {
|
|
1223
1551
|
wire.object({}).strict().parse(payload);
|
|
1224
1552
|
return { ok: true, value: controls.status() };
|
|
@@ -1231,10 +1559,7 @@ async function mountPet(ctx, options, bridge) {
|
|
|
1231
1559
|
}
|
|
1232
1560
|
if (endpoint === "notification-state") {
|
|
1233
1561
|
const input = notificationRequests.state.parse(payload);
|
|
1234
|
-
if (input.locale && input.locale
|
|
1235
|
-
locale = input.locale;
|
|
1236
|
-
controls.configure();
|
|
1237
|
-
}
|
|
1562
|
+
if (input.locale && !dedicatedLocale) adoptClientLocale(input.locale);
|
|
1238
1563
|
return { ok: true, value: broker.snapshot() };
|
|
1239
1564
|
}
|
|
1240
1565
|
if (endpoint === "notification-claim") {
|
|
@@ -1271,7 +1596,7 @@ async function mountPet(ctx, options, bridge) {
|
|
|
1271
1596
|
return { ok: false, error: { code: "coopanion/rejected", message: String(error instanceof Error ? error.message : error).slice(0, 600), details: {} } };
|
|
1272
1597
|
}
|
|
1273
1598
|
};
|
|
1274
|
-
for (const endpoint of ["status", "control", "navigation", ...notificationEndpoints]) {
|
|
1599
|
+
for (const endpoint of ["status", "control", "navigation", "locale", ...notificationEndpoints]) {
|
|
1275
1600
|
child.effect(() => child.connection.fetch.register({
|
|
1276
1601
|
path: `/api/coopanion/${endpoint}`,
|
|
1277
1602
|
methods: ["POST"],
|