deskbuddy 0.2.0-beta.20 → 0.2.0-beta.21
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/dist/cli.js +100 -15
- package/hook/hook-debug.log +40 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -16540,9 +16540,62 @@ function workbuddyNotifyArgs(hookPath, platform = process.platform) {
|
|
|
16540
16540
|
return ["--settings", JSON.stringify(settings)];
|
|
16541
16541
|
}
|
|
16542
16542
|
function launchArgs(tool, platform, hookPath = installedHookPath(), sessionId = "") {
|
|
16543
|
-
|
|
16544
|
-
if (tool === "
|
|
16545
|
-
return
|
|
16543
|
+
const sid = sessionId && REGISTER_TOOLS.has(tool) ? ["--session-id", sessionId] : [];
|
|
16544
|
+
if (tool === "workbuddy") return [...workbuddyNotifyArgs(hookPath, platform), ...sid];
|
|
16545
|
+
return sid;
|
|
16546
|
+
}
|
|
16547
|
+
var REGISTER_TOOLS = /* @__PURE__ */ new Set(["qoder_cn", "workbuddy"]);
|
|
16548
|
+
var EARLY_POLL_MS = 3e3;
|
|
16549
|
+
var EARLY_POLL_MAX_MS = 2 * 60 * 1e3;
|
|
16550
|
+
function startEarlyRegister(tool, sid, cwd, text, d) {
|
|
16551
|
+
if (!d.register || !d.transcriptReady) return { stop: async () => {
|
|
16552
|
+
} };
|
|
16553
|
+
const register = d.register;
|
|
16554
|
+
const ready = d.transcriptReady;
|
|
16555
|
+
const every = d.pollMs ?? EARLY_POLL_MS;
|
|
16556
|
+
const deadline = d.now() + (d.pollMaxMs ?? EARLY_POLL_MAX_MS);
|
|
16557
|
+
let stopped = false;
|
|
16558
|
+
let timer = null;
|
|
16559
|
+
let inflight = null;
|
|
16560
|
+
const tick = async () => {
|
|
16561
|
+
timer = null;
|
|
16562
|
+
if (stopped) return;
|
|
16563
|
+
let ok = false;
|
|
16564
|
+
try {
|
|
16565
|
+
ok = await ready(tool, sid);
|
|
16566
|
+
} catch {
|
|
16567
|
+
ok = false;
|
|
16568
|
+
}
|
|
16569
|
+
if (stopped) return;
|
|
16570
|
+
if (ok) {
|
|
16571
|
+
try {
|
|
16572
|
+
await register(tool, sid, cwd, text, false);
|
|
16573
|
+
} catch (e) {
|
|
16574
|
+
d.log(`\u63D0\u524D\u767B\u8BB0\u51FA\u9519\uFF1A${e.message}`);
|
|
16575
|
+
}
|
|
16576
|
+
return;
|
|
16577
|
+
}
|
|
16578
|
+
if (d.now() >= deadline) {
|
|
16579
|
+
d.log(`[${sid.slice(0, 8)}] ${Math.round((d.pollMaxMs ?? EARLY_POLL_MAX_MS) / 1e3)} \u79D2\u5185 jsonl \u6CA1\u6709\u7528\u6237\u6D88\u606F\uFF0C\u7B49\u7A97\u53E3\u9000\u51FA\u65F6\u518D\u767B\u8BB0`);
|
|
16580
|
+
return;
|
|
16581
|
+
}
|
|
16582
|
+
schedule();
|
|
16583
|
+
};
|
|
16584
|
+
const schedule = () => {
|
|
16585
|
+
timer = setTimeout(() => {
|
|
16586
|
+
inflight = tick();
|
|
16587
|
+
}, every);
|
|
16588
|
+
timer.unref?.();
|
|
16589
|
+
};
|
|
16590
|
+
schedule();
|
|
16591
|
+
return {
|
|
16592
|
+
stop: async () => {
|
|
16593
|
+
stopped = true;
|
|
16594
|
+
if (timer) clearTimeout(timer);
|
|
16595
|
+
if (inflight) await inflight.catch(() => {
|
|
16596
|
+
});
|
|
16597
|
+
}
|
|
16598
|
+
};
|
|
16546
16599
|
}
|
|
16547
16600
|
async function runPromptLaunch(tool, windowId, cwd, d) {
|
|
16548
16601
|
let real2 = null;
|
|
@@ -16576,17 +16629,21 @@ async function runPromptLaunch(tool, windowId, cwd, d) {
|
|
|
16576
16629
|
d.log(`[${windowId.slice(0, 8)}] \u6CA1\u7B49\u5230\u9996\u53E5\uFF0C\u8D77\u4E00\u4E2A\u7A7A\u7684 ${tool}`);
|
|
16577
16630
|
}
|
|
16578
16631
|
const answerWindowId = tool === "workbuddy" || tool === "codex" ? randomBytes8(16).toString("hex") : "";
|
|
16579
|
-
|
|
16580
|
-
|
|
16632
|
+
const sid = REGISTER_TOOLS.has(tool) ? (d.newSessionId ?? randomUUID4)() : "";
|
|
16633
|
+
const env = tool === "qoder_cn" ? { ...promptEnv(tool, d.env), ...real2.env ?? {} } : promptEnv(tool, d.env, process.pid, answerWindowId);
|
|
16634
|
+
const args = [...launchArgs(tool, d.platform, void 0, sid), ...promptArgs(text)];
|
|
16635
|
+
const early = sid ? startEarlyRegister(tool, sid, cwd, text, d) : null;
|
|
16636
|
+
let code;
|
|
16637
|
+
try {
|
|
16638
|
+
code = tool === "qoder_cn" ? await d.run(tool, real2, args, env) : await d.run(tool, real2, args, env, answerWindowId);
|
|
16639
|
+
} finally {
|
|
16640
|
+
await early?.stop();
|
|
16581
16641
|
}
|
|
16582
|
-
|
|
16583
|
-
const env = { ...promptEnv(tool, d.env), ...real2.env ?? {} };
|
|
16584
|
-
const code = await d.run(tool, real2, [...launchArgs(tool, d.platform, "", sid), ...promptArgs(text)], env);
|
|
16585
|
-
if (d.afterQoder) {
|
|
16642
|
+
if (sid && d.register) {
|
|
16586
16643
|
try {
|
|
16587
|
-
await d.
|
|
16644
|
+
await d.register(tool, sid, cwd, text, true);
|
|
16588
16645
|
} catch (e) {
|
|
16589
|
-
d.log(`\u767B\u8BB0
|
|
16646
|
+
d.log(`\u767B\u8BB0\u4F1A\u8BDD\u51FA\u9519\uFF1A${e.message}`);
|
|
16590
16647
|
}
|
|
16591
16648
|
}
|
|
16592
16649
|
return code;
|
|
@@ -16950,6 +17007,33 @@ async function runAnswerWindow(tool, real2, args, env, windowId, d) {
|
|
|
16950
17007
|
});
|
|
16951
17008
|
}
|
|
16952
17009
|
|
|
17010
|
+
// src/wrap/launchRegister.ts
|
|
17011
|
+
import { dirname as dirname26 } from "path";
|
|
17012
|
+
async function launchTranscriptReady(tool, sessionId) {
|
|
17013
|
+
try {
|
|
17014
|
+
if (tool === "qoder_cn") {
|
|
17015
|
+
const p = await findTranscript(qoderConfigDir(tool), sessionId);
|
|
17016
|
+
return !!p && (await transcriptInfo(p)).title !== "";
|
|
17017
|
+
}
|
|
17018
|
+
if (tool === "workbuddy") {
|
|
17019
|
+
const p = findWbTranscript(dirname26(workbuddySettingsPath()), sessionId);
|
|
17020
|
+
return !!p && wbTranscriptInfo(p).title !== "";
|
|
17021
|
+
}
|
|
17022
|
+
return false;
|
|
17023
|
+
} catch {
|
|
17024
|
+
return false;
|
|
17025
|
+
}
|
|
17026
|
+
}
|
|
17027
|
+
var defaultDeps = { qoder: (j) => syncQoderApp(j), workbuddy: (j) => registerWorkbuddySession(j) };
|
|
17028
|
+
async function launchRegister(tool, sessionId, cwd, firstLine, final, d = defaultDeps) {
|
|
17029
|
+
if (tool === "workbuddy") return d.workbuddy({ sessionId, cwd, fallbackTitle: firstLine ?? "" });
|
|
17030
|
+
if (tool !== "qoder_cn") return "skip tool";
|
|
17031
|
+
const r = await d.qoder({ tool, kind: "register", sessionId, cwd, fallbackTitle: firstLine ?? "" });
|
|
17032
|
+
if (!final) return r;
|
|
17033
|
+
const c = await d.qoder({ tool, kind: "clear", sessionId, cwd });
|
|
17034
|
+
return `${r}\uFF1B\u6E05\u7F13\u5B58 ${c}`;
|
|
17035
|
+
}
|
|
17036
|
+
|
|
16953
17037
|
// src/wrap/run.ts
|
|
16954
17038
|
var DEFAULT_TTL_MS = 10 * 60 * 1e3;
|
|
16955
17039
|
var TICK_MS = 300;
|
|
@@ -17111,10 +17195,11 @@ function defaultPromptDeps(deps2, cwd, launchId) {
|
|
|
17111
17195
|
},
|
|
17112
17196
|
env: deps2.env,
|
|
17113
17197
|
log: deps2.log,
|
|
17114
|
-
|
|
17115
|
-
const r = await
|
|
17116
|
-
deps2.log(`[${(launchId ?? "").slice(0, 8)}]
|
|
17117
|
-
}
|
|
17198
|
+
register: async (tool, sid, c, first, final) => {
|
|
17199
|
+
const r = await launchRegister(tool, sid, c, first, final === true);
|
|
17200
|
+
deps2.log(`[${(launchId ?? "").slice(0, 8)}] ${tool} \u4F1A\u8BDD ${sid.slice(0, 8)} \u767B\u8BB0\u8FDB\u684C\u9762\u7AEF\u5217\u8868${final ? "\uFF08\u7A97\u53E3\u9000\u51FA\uFF09" : "\uFF08\u63D0\u524D\uFF09"}\uFF1A${r}`);
|
|
17201
|
+
},
|
|
17202
|
+
transcriptReady: (tool, sid) => launchTranscriptReady(tool, sid)
|
|
17118
17203
|
};
|
|
17119
17204
|
}
|
|
17120
17205
|
async function runLaunch(argv, deps2 = defaultWrapDeps(), ld = defaultLaunchDeps()) {
|
package/hook/hook-debug.log
CHANGED
|
@@ -26,3 +26,43 @@
|
|
|
26
26
|
2026-10-04T07:08:32.795Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
27
27
|
2026-10-04T07:08:32.908Z [opencode] opencode 版本 读不出:带说明的拒绝不走新路由
|
|
28
28
|
2026-10-04T07:08:32.909Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
29
|
+
2026-10-04T07:38:35.702Z [opencode] 回填选择题失败:/question/{requestID}/reply status=404
|
|
30
|
+
2026-10-04T07:38:36.121Z [opencode] opencode 版本 1.4.3:带说明的拒绝不走新路由
|
|
31
|
+
2026-10-04T07:38:36.121Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
32
|
+
2026-10-04T07:38:36.211Z [opencode] opencode 版本 读不出:带说明的拒绝不走新路由
|
|
33
|
+
2026-10-04T07:38:36.211Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
34
|
+
2026-10-04T11:03:50.679Z [opencode] 回填选择题失败:/question/{requestID}/reply status=404
|
|
35
|
+
2026-10-04T11:03:51.107Z [opencode] opencode 版本 1.4.3:带说明的拒绝不走新路由
|
|
36
|
+
2026-10-04T11:03:51.107Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
37
|
+
2026-10-04T11:03:51.207Z [opencode] opencode 版本 读不出:带说明的拒绝不走新路由
|
|
38
|
+
2026-10-04T11:03:51.207Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
39
|
+
2026-10-04T11:12:40.872Z [opencode] 回填选择题失败:/question/{requestID}/reply status=404
|
|
40
|
+
2026-10-04T11:12:42.480Z [opencode] opencode 版本 1.4.3:带说明的拒绝不走新路由
|
|
41
|
+
2026-10-04T11:12:42.481Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
42
|
+
2026-10-04T11:12:42.866Z [opencode] opencode 版本 读不出:带说明的拒绝不走新路由
|
|
43
|
+
2026-10-04T11:12:44.878Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
44
|
+
2026-10-04T11:14:37.601Z [opencode] 回填选择题失败:/question/{requestID}/reply status=404
|
|
45
|
+
2026-10-04T11:14:38.045Z [opencode] opencode 版本 1.4.3:带说明的拒绝不走新路由
|
|
46
|
+
2026-10-04T11:14:38.045Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
47
|
+
2026-10-04T11:14:38.171Z [opencode] opencode 版本 读不出:带说明的拒绝不走新路由
|
|
48
|
+
2026-10-04T11:14:38.171Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
49
|
+
2026-10-04T12:00:44.405Z [opencode] 回填选择题失败:/question/{requestID}/reply status=404
|
|
50
|
+
2026-10-04T12:00:44.879Z [opencode] opencode 版本 1.4.3:带说明的拒绝不走新路由
|
|
51
|
+
2026-10-04T12:00:44.879Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
52
|
+
2026-10-04T12:00:45.021Z [opencode] opencode 版本 读不出:带说明的拒绝不走新路由
|
|
53
|
+
2026-10-04T12:00:45.022Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
54
|
+
2026-10-04T12:08:19.397Z [opencode] 回填选择题失败:/question/{requestID}/reply status=404
|
|
55
|
+
2026-10-04T12:08:19.805Z [opencode] opencode 版本 1.4.3:带说明的拒绝不走新路由
|
|
56
|
+
2026-10-04T12:08:19.805Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
57
|
+
2026-10-04T12:08:19.911Z [opencode] opencode 版本 读不出:带说明的拒绝不走新路由
|
|
58
|
+
2026-10-04T12:08:19.912Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
59
|
+
2026-10-05T02:15:10.472Z [opencode] 回填选择题失败:/question/{requestID}/reply status=404
|
|
60
|
+
2026-10-05T02:15:10.898Z [opencode] opencode 版本 1.4.3:带说明的拒绝不走新路由
|
|
61
|
+
2026-10-05T02:15:10.899Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
62
|
+
2026-10-05T02:15:11.004Z [opencode] opencode 版本 读不出:带说明的拒绝不走新路由
|
|
63
|
+
2026-10-05T02:15:11.004Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
64
|
+
2026-10-05T02:23:41.382Z [opencode] 回填选择题失败:/question/{requestID}/reply status=404
|
|
65
|
+
2026-10-05T02:23:41.811Z [opencode] opencode 版本 1.4.3:带说明的拒绝不走新路由
|
|
66
|
+
2026-10-05T02:23:41.812Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|
|
67
|
+
2026-10-05T02:23:41.898Z [opencode] opencode 版本 读不出:带说明的拒绝不走新路由
|
|
68
|
+
2026-10-05T02:23:41.898Z [opencode] opencode 版本不确定支持带说明的拒绝,设备上的反馈没有带给模型
|