@celljs/ta-cloud-handoff 4.38.0 → 4.40.0
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/extension/index.mjs +71 -15
- package/host/index.mjs +846 -615
- package/package.json +6 -4
- package/web/index.js +372 -37
package/extension/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
// ../ta-protocol/esm/common/
|
|
1
|
+
// ../ta-protocol/esm/common/host-cloud-protocol.js
|
|
2
2
|
var TA_CLOUD_OUTPUT_BYTES = 1024 * 1024;
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
// ../ta-protocol/esm/common/ta-extension-host.js
|
|
4
5
|
var TA_HOST_EVENT = "ta:host";
|
|
5
6
|
var TaHostUtil;
|
|
6
7
|
(function(TaHostUtil2) {
|
|
@@ -299,17 +300,61 @@ var HandoffTexts;
|
|
|
299
300
|
});
|
|
300
301
|
}
|
|
301
302
|
HandoffTexts.away = away;
|
|
302
|
-
function
|
|
303
|
+
function locked(error) {
|
|
304
|
+
return /index\.lock|Another git process seems to be running/.test(error instanceof Error ? error.message : String(error));
|
|
305
|
+
}
|
|
306
|
+
HandoffTexts.locked = locked;
|
|
307
|
+
function reason(error) {
|
|
308
|
+
if (locked(error)) {
|
|
309
|
+
return TaLanguageUtil.say({
|
|
310
|
+
"zh-CN": "云端那份代码正被另一个 git 命令占用,过一会儿再试",
|
|
311
|
+
"zh-TW": "雲端那份程式碼正被另一個 git 指令佔用,過一會兒再試",
|
|
312
|
+
"en-US": "another git command held the copy in the cloud: try again in a moment",
|
|
313
|
+
"ja-JP": "クラウドのコピーを別の git コマンドが使用中です。少し待ってからもう一度お試しください"
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
return error instanceof Error ? error.message : String(error);
|
|
317
|
+
}
|
|
318
|
+
HandoffTexts.reason = reason;
|
|
319
|
+
function sharedHead(cloud) {
|
|
320
|
+
return TaLanguageUtil.say({
|
|
321
|
+
"zh-CN": `这个仓库已有对话在云端 ${cloud} 接着做,而这里之后有了不同的提交:先把那个对话接回本机,再换过去`,
|
|
322
|
+
"zh-TW": `這個倉庫已有對話在雲端 ${cloud} 接著做,而這裡之後有了不同的提交:先把那個對話接回本機,再換過去`,
|
|
323
|
+
"en-US": `Another conversation of this repository goes on in ${cloud}, and the commits here are not those there: bring it back first, then move this one`,
|
|
324
|
+
"ja-JP": `このリポジトリの別の会話がクラウド ${cloud} で続いていて、こちらのコミットが違います。先にそちらを戻してから移してください`
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
HandoffTexts.sharedHead = sharedHead;
|
|
328
|
+
function sharedConflict(cloud, paths) {
|
|
329
|
+
const list = paths.slice(0, 3).join(", ") + (paths.length > 3 ? " …" : "");
|
|
330
|
+
return TaLanguageUtil.say({
|
|
331
|
+
"zh-CN": `这个仓库已有对话在云端 ${cloud} 改了同样的文件(${list}):先把那个对话接回本机,再换过去`,
|
|
332
|
+
"zh-TW": `這個倉庫已有對話在雲端 ${cloud} 改了同樣的檔案(${list}):先把那個對話接回本機,再換過去`,
|
|
333
|
+
"en-US": `Another conversation of this repository in ${cloud} changed the same files (${list}): bring it back first, then move this one`,
|
|
334
|
+
"ja-JP": `このリポジトリの別の会話がクラウド ${cloud} で同じファイル(${list})を変更しました。先にそちらを戻してから移してください`
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
HandoffTexts.sharedConflict = sharedConflict;
|
|
338
|
+
function wentBack(computer) {
|
|
339
|
+
return TaLanguageUtil.say({
|
|
340
|
+
"zh-CN": `这个对话已接回电脑 ${computer},在那边接着做:在这里说的话不会带回去。`,
|
|
341
|
+
"zh-TW": `這個對話已接回電腦 ${computer},在那邊接著做:在這裡說的話不會帶回去。`,
|
|
342
|
+
"en-US": `This conversation went back to the computer ${computer} and goes on there: what is said here would not reach it.`,
|
|
343
|
+
"ja-JP": `この会話はパソコン ${computer} に戻り、そちらで続いています。ここで書いた内容は戻りません。`
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
HandoffTexts.wentBack = wentBack;
|
|
347
|
+
function stayed(reason2) {
|
|
303
348
|
return TaLanguageUtil.say({
|
|
304
|
-
"zh-CN": `没能换到云端(${
|
|
305
|
-
"zh-TW": `沒能換到雲端(${
|
|
306
|
-
"en-US": `It did not move to the cloud (${
|
|
307
|
-
"ja-JP": `クラウドへ移せませんでした(${
|
|
349
|
+
"zh-CN": `没能换到云端(${reason2}),在本机接着做`,
|
|
350
|
+
"zh-TW": `沒能換到雲端(${reason2}),在本機接著做`,
|
|
351
|
+
"en-US": `It did not move to the cloud (${reason2}): going on here`,
|
|
352
|
+
"ja-JP": `クラウドへ移せませんでした(${reason2})。このパソコンで続けます`
|
|
308
353
|
});
|
|
309
354
|
}
|
|
310
355
|
HandoffTexts.stayed = stayed;
|
|
311
|
-
function failed(
|
|
312
|
-
return `Moving this conversation to the cloud failed: ${
|
|
356
|
+
function failed(reason2) {
|
|
357
|
+
return `Moving this conversation to the cloud failed: ${reason2}. It stays on this computer; tell the user in a line.`;
|
|
313
358
|
}
|
|
314
359
|
HandoffTexts.failed = failed;
|
|
315
360
|
})(HandoffTexts ||= {});
|
|
@@ -351,16 +396,27 @@ function activate(pi) {
|
|
|
351
396
|
});
|
|
352
397
|
pi.on("input", async (_event, ctx) => {
|
|
353
398
|
const file = ctx.sessionManager.getSessionFile();
|
|
354
|
-
const
|
|
355
|
-
return;
|
|
356
|
-
}))?.away(file).catch(() => {
|
|
399
|
+
const service = file ? await reach().catch(() => {
|
|
357
400
|
return;
|
|
358
401
|
}) : undefined;
|
|
359
|
-
if (!
|
|
402
|
+
if (!file || !service) {
|
|
360
403
|
return { action: "continue" };
|
|
361
404
|
}
|
|
362
|
-
|
|
363
|
-
|
|
405
|
+
const away = await service.away(file).catch(() => {
|
|
406
|
+
return;
|
|
407
|
+
});
|
|
408
|
+
if (away) {
|
|
409
|
+
ctx.ui?.notify(HandoffTexts.away(away.cloud), "warning");
|
|
410
|
+
return { action: "handled" };
|
|
411
|
+
}
|
|
412
|
+
const back = await service.wentBack?.(file).catch(() => {
|
|
413
|
+
return;
|
|
414
|
+
});
|
|
415
|
+
if (back) {
|
|
416
|
+
ctx.ui?.notify(HandoffTexts.wentBack(back.computer), "warning");
|
|
417
|
+
return { action: "handled" };
|
|
418
|
+
}
|
|
419
|
+
return { action: "continue" };
|
|
364
420
|
});
|
|
365
421
|
pi.registerTool({
|
|
366
422
|
name: HANDOFF_TOOL,
|