@linjz/opencode-qqbot 0.3.20 → 0.3.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/README.md +10 -2
- package/README.zh-CN.md +11 -3
- package/bin/openqq.js +1 -1
- package/dist/opencode-qqbot-plugin.js +124 -6
- package/dist/openqq-bot.js +560 -93
- package/dist/openqq-cli.js +152 -16
- package/dist/openqq-watchdog.js +72 -2
- package/package.json +2 -2
- package/src/bridge.ts +26 -6
- package/src/cli/openqq-main.ts +33 -5
- package/src/core/bot-control.ts +73 -8
- package/src/core/card-approval.ts +10 -0
- package/src/core/office-text.ts +234 -0
- package/src/core/permission.ts +157 -26
- package/src/core/watchdog.ts +108 -5
- package/src/qq/media.ts +153 -54
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Built for production, not just message bridging: a self-healing watchdog, an aud
|
|
|
26
26
|
| Remote commands | `/new /cancel /status /sessions /history /models /agents /rename /progress /queue /ledger /send /undo /amend /goal /compact /redo /btw` |
|
|
27
27
|
| Busy-time steer | New messages while a turn is running merge into the current turn (official steer semantics — the default); enqueue explicitly with `/queue <text>`; classic FIFO via `QQ_BUSY_DEFAULT=queue` |
|
|
28
28
|
| Goal mode | `/goal <objective>` passes through to the engine's goal mode with status-change notifications and kickoff attribution; `/goal` shows status, `pause|resume|clear` to control |
|
|
29
|
-
| Rich media | Receive images (native attachments go to the AI for vision); **receive voice** (QQ's built-in ASR transcribes to text into the prompt for free); **send images/files** — the AI calls the native `qq_send_file` tool (path allowlist + idempotent dedupe + precise errors; `QQ_SEND_FILE:` marker retained as fallback) or you run `/send <path>`; 20MB limit |
|
|
29
|
+
| Rich media | Receive images (native attachments go to the AI for vision); **receive voice** (QQ's built-in ASR transcribes to text into the prompt for free); **receive text/PDF/Office documents** (txt/md/code inject directly, docx/xlsx/pptx extract text locally, PDF passes through; legacy doc/xls/ppt gets explicit conversion guidance); **send images/files** — the AI calls the native `qq_send_file` tool (path allowlist + idempotent dedupe + precise errors; `QQ_SEND_FILE:` marker retained as fallback) or you run `/send <path>`; 20MB limit |
|
|
30
30
|
| Quote context | Long-press quote a message and ask — the AI sees the quoted content (our own replies are indexed too) |
|
|
31
31
|
| Long tasks never lost | 30-min foreground timeout falls back to a background wait (SSE + polling, up to 24h); a 30-min stall triggers a proactive notice with status (stalled / unknown / finished-but-lost), the latest tool action, and how long there's been no progress |
|
|
32
32
|
| Duplicate-proof delivery | Two-layer dedup: cross-process atomic msgId claim + same-content in-flight fingerprint; long identical replies deduped outbound for 24h; "received" ack bubble off by default (`QQ_ACK_RECEIPT=1` to enable) |
|
|
@@ -92,6 +92,13 @@ QQ_SANDBOX=false
|
|
|
92
92
|
- **Plugin flavor**: nothing to start manually — once the plugin is installed and credentials are set, the plugin's patrol launches the bot; it also recovers when the OpenCode service restarts.
|
|
93
93
|
- **Standalone flavor**: run `openqq` in the foreground; for daemon mode pick your OS (Windows: Task Scheduler via `openqq service install`; Linux: `systemd --user`; macOS: launchd or `nohup`).
|
|
94
94
|
|
|
95
|
+
### Stop and uninstall (to avoid confusion)
|
|
96
|
+
|
|
97
|
+
- **Stop the bot**: `openqq stop` (waits for in-flight turns by default, then performs a supervised graceful stop without spawning a replacement; supervisors will not revive it until `openqq restart` clears the hold).
|
|
98
|
+
- **Remove autostart only**: `openqq service uninstall` (the bot may keep running).
|
|
99
|
+
- **Full shutdown**: `openqq service uninstall --stop-bot` (remove autostart, then stop the bot through the same supervised path).
|
|
100
|
+
- **Plugin removal boundary**: `opencode plugin remove @linjz/opencode-qqbot` removes only the in-host bootstrap and patrol; it **does not stop an already independent bot process**. Run `openqq service uninstall --stop-bot` for a complete shutdown.
|
|
101
|
+
|
|
95
102
|
<details>
|
|
96
103
|
<summary>Linux: systemd --user unit (copy-paste ready)</summary>
|
|
97
104
|
|
|
@@ -190,6 +197,7 @@ launchctl load ~/Library/LaunchAgents/net.opencode-qqbot.plist
|
|
|
190
197
|
| `QQ_ORPHAN_MS` | 90000 | Orphan threshold (accepted but silent beyond this; valid 5s–60min, invalid falls back) |
|
|
191
198
|
| `QQ_WATCHDOG_INTERVAL_MS` | 300000 | Plugin bootstrap patrol interval (5min; the service-side autostart default is 10min) |
|
|
192
199
|
| `QQ_PERM_DEFER_MS` | 500 | Approval card deferral window (0–10s): if the request is resolved elsewhere within the window, no QQ card — aligns with desktop silent handling |
|
|
200
|
+
| `QQ_PERM_SEND_GRACE_MS` | 1000 | Cancellable grace window before the QQ API call for approval cards (0–10s, 0 disables): if the request is resolved inside the window, the card is abandoned to prevent "resolved notice first, dead card later"; totals 1500ms with the defer window |
|
|
193
201
|
| `QQ_QUEUE_RECEIPTS` | off | Queue-completion receipt "queue #N done" (off by default to prevent batch spam) |
|
|
194
202
|
| `QQ_LOG_FILE` | `~/.openqq/openqq.log` (unified log, bot + watchdog in one file) | In-process file log path; 20MB × 4 generations, 100MB total budget (`QQ_LOG_MAX_MB`/`QQ_LOG_KEEP`/`QQ_LOG_TOTAL_MB` tunable) |
|
|
195
203
|
| `QQBOT_DEFAULT_CWD` | bot process cwd | Default project directory for new sessions |
|
|
@@ -288,7 +296,7 @@ Hard-won findings from real deployments (Windows 11 / OpenCode v2.2.2) — the p
|
|
|
288
296
|
**QQ platform**
|
|
289
297
|
|
|
290
298
|
1. The token endpoint `POST https://bots.qq.com/app/getAppAccessToken` takes **`clientSecret`** (older docs say `appSecret`); the `100016 invalid appid or secret` error is misleading — check the field name before resetting your secret.
|
|
291
|
-
2. Tokens are environment-independent and always use the production domain `bots.qq.com`; **the sandbox domain `sandbox.api.sgroup.qq.com has no token endpoint** (it returns `11001 unsupported call`).
|
|
299
|
+
2. Tokens are environment-independent and always use the production domain `bots.qq.com`; **the sandbox domain `sandbox.api.sgroup.qq.com` has no token endpoint** (it returns `11001 unsupported call`).
|
|
292
300
|
3. Sandbox bots have a separate gateway: `GET https://sandbox.api.sgroup.qq.com/gateway` → `wss://sandbox.api.sgroup.qq.com/websocket`; a sandbox bot connecting to the production gateway is rejected with 4914.
|
|
293
301
|
|
|
294
302
|
**OpenCode side**
|
package/README.zh-CN.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
| 远程指令 | `/new /cancel /status /sessions /history /models /agents /rename /progress /queue /ledger /send /undo /amend /goal /compact /redo /btw` |
|
|
25
25
|
| 忙时 steer | 回合进行中收到新消息默认并入当前回合(官方 steer 语义);`/queue <文本>` 显式排队;`QQ_BUSY_DEFAULT=queue` 切回经典 FIFO |
|
|
26
26
|
| goal 模式 | `/goal <目标>` 直通引擎目标模式——状态变化通知 + kickoff 🎯 归属;`/goal` 查状态,pause/resume/clear 控制 |
|
|
27
|
-
| 富媒体 | 收图(原生附件给 AI 看图);**收语音**(QQ 内置 ASR 免费转文字进 prompt
|
|
27
|
+
| 富媒体 | 收图(原生附件给 AI 看图);**收语音**(QQ 内置 ASR 免费转文字进 prompt);**收文本/PDF/Office 文档**(txt/md/代码等直接注入,docx/xlsx/pptx 本地提取文本,PDF 原样注入;旧版 doc/xls/ppt 明确指引转换);**发图/发文件**——AI 调原生 `qq_send_file` 工具(路径白名单+幂等去重+精确错误,失败会告诉你可以发哪些根目录;`QQ_SEND_FILE:` 标记保留为降级通道)或 `/send <路径>`,20MB 上限 |
|
|
28
28
|
| 引用上下文 | 长按引用某条消息提问,AI 能感知被引用的内容(我方回复也会入索引缓存) |
|
|
29
29
|
| 长任务不丢 | 前台 30min 超时 → 后台等待(SSE + 轮询,最长 24h);停滞 30min 主动提醒(带「已停滞/状态不明/已终结未回传」状态位 + 最近工具动作 + 无进展时长) |
|
|
30
30
|
| 投递幂等 | 双层去重:同 msgId 跨进程原子占位 + 同内容在途指纹(窗口=并发在途;已完成消息的重发按重发处理);同文长回复 24h 出站去重;「已收到」受理回执默认关(`QQ_ACK_RECEIPT=1` 调试召回) |
|
|
@@ -87,6 +87,13 @@ QQ_SANDBOX=false
|
|
|
87
87
|
- **插件形态**:无需手动启动——装好插件 + 配好凭据后,插件巡检自动拉起 bot;opencode 服务重启也会自动恢复。
|
|
88
88
|
- **独立部署形态**:`openqq` 前台运行;常驻按 OS 自选(Windows:`openqq service install` 注册计划任务;Linux `systemd --user`;macOS launchd 或 `nohup`)。
|
|
89
89
|
|
|
90
|
+
### 停止与卸载(避免误解)
|
|
91
|
+
|
|
92
|
+
- **停止 bot**:`openqq stop`(默认等待在途回合空闲,走监督矩阵优雅停止,不拉起新进程;停止后巡检不会复活,`openqq restart` 解除并恢复)。
|
|
93
|
+
- **只移除自启**:`openqq service uninstall`(bot 仍可能继续运行)。
|
|
94
|
+
- **完整停用**:`openqq service uninstall --stop-bot`(先注销自启,再受控停止 bot)。
|
|
95
|
+
- **插件移除边界**:`opencode plugin remove @linjz/opencode-qqbot` 只移除 OpenCode 宿主内的引导与巡检,**不会停止已独立运行的 bot**;要彻底停用请再执行 `openqq service uninstall --stop-bot`。
|
|
96
|
+
|
|
90
97
|
<details>
|
|
91
98
|
<summary>Linux:systemd --user 单元(复制即用)</summary>
|
|
92
99
|
|
|
@@ -183,9 +190,10 @@ launchctl load ~/Library/LaunchAgents/net.opencode-qqbot.plist
|
|
|
183
190
|
| `QQ_DIGEST_ANSWER_MAX_CHARS` | 0(全文) | 摘要卡答案截断上限 |
|
|
184
191
|
| `QQ_HISTORY_USER_CLIP` / `QQ_HISTORY_TEXT_CLIP` | 500 / 1200 | /history 用户/AI 行截断 |
|
|
185
192
|
| `QQ_SEND_EXTRA_ROOTS` | — | `/send` 额外允许目录(逗号分隔) |
|
|
186
|
-
| `QQ_ORPHAN_MS` | 90000 | 孤儿判定阈值(受理后无下文超此时长记孤儿;合法 5s
|
|
193
|
+
| `QQ_ORPHAN_MS` | 90000 | 孤儿判定阈值(受理后无下文超此时长记孤儿;合法 5s 至 60min,非法回退默认) |
|
|
187
194
|
| `QQ_WATCHDOG_INTERVAL_MS` | 300000 | 插件引导器巡检间隔(5min;计划任务侧由 service install 注册,默认 10min) |
|
|
188
|
-
| `QQ_PERM_DEFER_MS` | 500 | 审批弹卡延迟判定窗(0
|
|
195
|
+
| `QQ_PERM_DEFER_MS` | 500 | 审批弹卡延迟判定窗(0 至 10s):窗口内 ask 已被其他端处置则不推 QQ 卡,与桌面静默放行对齐 |
|
|
196
|
+
| `QQ_PERM_SEND_GRACE_MS` | 1000 | 审批卡调 QQ API 前的可取消发送窗(0 至 10s,0 关闭):窗内请求已被其他端处置则弃发,防“已处理通知先到、死卡后到”;与延迟判定窗合计 1500ms 总窗口 |
|
|
189
197
|
| `QQ_QUEUE_RECEIPTS` | 关 | 队列完成回执「队列 #N 完成」(批量排空防刷,默认关) |
|
|
190
198
|
| `QQ_LOG_FILE` | `~/.openqq/openqq.log`(统一日志,bot 与看门狗同文件) | 进程内文件日志路径;滚动 20MB×4 代、总预算 100MB(`QQ_LOG_MAX_MB`/`QQ_LOG_KEEP`/`QQ_LOG_TOTAL_MB` 可调) |
|
|
191
199
|
| `QQBOT_DEFAULT_CWD` | bot 进程工作目录 | 新会话默认项目目录(目录继承链兜底值) |
|
package/bin/openqq.js
CHANGED
|
@@ -24,7 +24,7 @@ function runChild(cmd, args) {
|
|
|
24
24
|
if (argv[0] === "watchdog") {
|
|
25
25
|
runChild(detectBun() ?? "node", [join(root, "dist", "openqq-watchdog.js"), ...argv.slice(1)])
|
|
26
26
|
}
|
|
27
|
-
if (argv[0] === "restart" || argv[0] === "service") {
|
|
27
|
+
if (argv[0] === "restart" || argv[0] === "stop" || argv[0] === "service") {
|
|
28
28
|
runChild("node", [join(root, "dist", "openqq-cli.js"), ...argv])
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -204,6 +204,33 @@ function readJson(path, fallback) {
|
|
|
204
204
|
return fallback;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
+
function defaultHoldPath() {
|
|
208
|
+
return join2(homedir(), ".openqq", "supervisor-hold.json");
|
|
209
|
+
}
|
|
210
|
+
function readSupervisorHold(path = defaultHoldPath()) {
|
|
211
|
+
try {
|
|
212
|
+
const raw = JSON.parse(readFileSync2(path, "utf-8"));
|
|
213
|
+
if (raw?.version === 1 && typeof raw.reason === "string" && typeof raw.by === "string" && typeof raw.at === "number") {
|
|
214
|
+
return raw;
|
|
215
|
+
}
|
|
216
|
+
} catch {}
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
function writeSupervisorHold(path, reason, by) {
|
|
220
|
+
try {
|
|
221
|
+
writeFileSync2(path, JSON.stringify({ version: 1, reason, by, at: Date.now() }));
|
|
222
|
+
} catch {}
|
|
223
|
+
}
|
|
224
|
+
function clearSupervisorHold(path) {
|
|
225
|
+
try {
|
|
226
|
+
if (!existsSync2(path))
|
|
227
|
+
return false;
|
|
228
|
+
unlinkSync2(path);
|
|
229
|
+
return true;
|
|
230
|
+
} catch {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
207
234
|
async function superviseOnce(deps) {
|
|
208
235
|
const policy = deps.policy ?? DEFAULT_SUPERVISOR_POLICY;
|
|
209
236
|
const now = deps.now?.() ?? Date.now();
|
|
@@ -240,7 +267,25 @@ async function superviseOnce(deps) {
|
|
|
240
267
|
try {
|
|
241
268
|
const health = readBotHealth(deps.paths, now);
|
|
242
269
|
const state = readJson(statePath, { restartLog: [] });
|
|
270
|
+
const holdPath = deps.holdPath ?? defaultHoldPath();
|
|
271
|
+
const hold = readSupervisorHold(holdPath);
|
|
272
|
+
if (hold && (!deps.request || deps.request === "health-check")) {
|
|
273
|
+
if (health.lockPid === null || health.pidAlive === false) {
|
|
274
|
+
log(`[supervisor] manual-stop hold \u751F\u6548\uFF08${hold.reason}\uFF09\uFF0C\u8DF3\u8FC7\u62C9\u8D77`);
|
|
275
|
+
return { action: "yield", detail: `manual-stop hold \u751F\u6548\uFF1A${hold.reason}`, killedPid: null, spawnedPid: null };
|
|
276
|
+
}
|
|
277
|
+
if (clearSupervisorHold(holdPath)) {
|
|
278
|
+
log(`[supervisor] manual-stop hold \u5931\u6548\uFF1Abot \u5DF2\u5728\u8FD0\u884C\uFF0C\u6062\u590D\u5E38\u89C4\u76D1\u7763`);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (deps.request === "manual-restart" && hold) {
|
|
282
|
+
if (clearSupervisorHold(holdPath))
|
|
283
|
+
log(`[supervisor] manual-stop hold \u5DF2\u89E3\u9664\uFF08openqq restart\uFF09`);
|
|
284
|
+
}
|
|
243
285
|
let action = decideSupervise(health, state, now, policy);
|
|
286
|
+
if (deps.request === "manual-stop") {
|
|
287
|
+
action = health.lockPid !== null && health.pidAlive !== false ? { kind: "grace-kill-spawn", killPid: health.lockPid, reason: "\u4EBA\u5DE5\u8BF7\u6C42\u505C\u6B62\uFF08openqq stop\uFF09" } : { kind: "spawn", reason: "\u4EBA\u5DE5\u8BF7\u6C42\u505C\u6B62\uFF08bot \u672A\u8FD0\u884C\uFF0C\u4EC5\u6E05\u9501\uFF09" };
|
|
288
|
+
}
|
|
244
289
|
if (deps.request === "manual-restart" && action.kind === "ok") {
|
|
245
290
|
const windowStart = now - policy.windowMs;
|
|
246
291
|
const recentRestarts = state.restartLog.filter((t) => t > windowStart).length;
|
|
@@ -284,7 +329,7 @@ async function superviseOnce(deps) {
|
|
|
284
329
|
let killedPid = null;
|
|
285
330
|
if (action.kind === "grace-kill-spawn" && action.killPid !== process.pid) {
|
|
286
331
|
const pid = action.killPid;
|
|
287
|
-
if (deps.request !== "manual-restart") {
|
|
332
|
+
if (deps.request !== "manual-restart" && deps.request !== "manual-stop") {
|
|
288
333
|
await sleep(300);
|
|
289
334
|
const recheck = readBotHealth(deps.paths, Date.now());
|
|
290
335
|
const recheckFresh = recheck.heartbeatAgeMs !== null && recheck.heartbeatAgeMs <= HEARTBEAT_STALE_MS;
|
|
@@ -334,6 +379,31 @@ async function superviseOnce(deps) {
|
|
|
334
379
|
if (cleared.length > 0)
|
|
335
380
|
audit(`\u6E05\u9501\uFF1A${cleared.join("\u3001")}\uFF08${action.reason}\uFF09`);
|
|
336
381
|
} catch {}
|
|
382
|
+
if (deps.request === "manual-stop") {
|
|
383
|
+
writeSupervisorHold(holdPath, action.reason, "openqq stop");
|
|
384
|
+
const detail = killedPid ? `${action.reason}\uFF1B\u5DF2\u4F18\u96C5\u505C pid=${killedPid}\uFF1B\u9501\u5DF2\u6E05\uFF1Bhold \u5DF2\u7ACB\uFF08\u5DE1\u68C0\u4E0D\u62C9\u8D77\uFF09` : `${action.reason}\uFF1B\u9501\u5DF2\u6E05\uFF1Bhold \u5DF2\u7ACB\uFF08\u5DE1\u68C0\u4E0D\u62C9\u8D77\uFF09`;
|
|
385
|
+
if (killedPid !== null) {
|
|
386
|
+
appendKillLog({
|
|
387
|
+
kind: "decision",
|
|
388
|
+
reason: action.reason,
|
|
389
|
+
health: {
|
|
390
|
+
lockPid: health.lockPid,
|
|
391
|
+
pidAlive: health.pidAlive,
|
|
392
|
+
heartbeatAgeMs: health.heartbeatAgeMs,
|
|
393
|
+
lockAgeMs: health.lockAgeMs
|
|
394
|
+
},
|
|
395
|
+
killedPid,
|
|
396
|
+
killEscalation: "TERM",
|
|
397
|
+
spawnedPid: null,
|
|
398
|
+
restartIntensity: `${state.restartLog.length}/${policy.maxRestarts}`,
|
|
399
|
+
livenessVerdict: "stopped",
|
|
400
|
+
at: Date.now()
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
audit(`\u4E3B\u52A8\u505C\uFF1A${detail}`);
|
|
404
|
+
log(`[supervisor] \u4E3B\u52A8\u505C\uFF1A${detail}`);
|
|
405
|
+
return { action: "stopped", detail, killedPid, spawnedPid: null };
|
|
406
|
+
}
|
|
337
407
|
const spawnedPid = deps.spawn();
|
|
338
408
|
state.restartLog.push(Date.now());
|
|
339
409
|
state.restartLog = state.restartLog.filter((t) => t > Date.now() - policy.windowMs * 2);
|
|
@@ -404,7 +474,7 @@ async function superviseOnce(deps) {
|
|
|
404
474
|
}
|
|
405
475
|
|
|
406
476
|
// src/core/bot-control.ts
|
|
407
|
-
import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
|
|
477
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync as readdirSync2 } from "fs";
|
|
408
478
|
import { dirname as dirname3, join as join4 } from "path";
|
|
409
479
|
import { fileURLToPath } from "url";
|
|
410
480
|
|
|
@@ -1260,7 +1330,7 @@ function electSupervisor(channel, opts) {
|
|
|
1260
1330
|
}
|
|
1261
1331
|
|
|
1262
1332
|
// src/core/send-requests.ts
|
|
1263
|
-
import { existsSync as existsSync9, mkdirSync as mkdirSync4, readdirSync as
|
|
1333
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync4, readdirSync as readdirSync3, readFileSync as readFileSync10, renameSync as renameSync3, statSync as statSync6, writeFileSync as writeFileSync6 } from "fs";
|
|
1264
1334
|
import { join as join10 } from "path";
|
|
1265
1335
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
1266
1336
|
|
|
@@ -1268,8 +1338,56 @@ import { randomUUID as randomUUID2 } from "crypto";
|
|
|
1268
1338
|
import { resolve, extname, basename, sep, join as join9 } from "path";
|
|
1269
1339
|
import { homedir as homedir7 } from "os";
|
|
1270
1340
|
|
|
1341
|
+
// src/core/office-text.ts
|
|
1342
|
+
var MAX_ENTRY_UNCOMPRESSED_BYTES = 50 * 1024 * 1024;
|
|
1343
|
+
|
|
1271
1344
|
// src/qq/media.ts
|
|
1272
1345
|
var MAX_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
1346
|
+
var MAX_FILE_BYTES = 20 * 1024 * 1024;
|
|
1347
|
+
var TEXT_FILE_EXTENSIONS = new Set([
|
|
1348
|
+
"txt",
|
|
1349
|
+
"md",
|
|
1350
|
+
"markdown",
|
|
1351
|
+
"json",
|
|
1352
|
+
"jsonc",
|
|
1353
|
+
"log",
|
|
1354
|
+
"csv",
|
|
1355
|
+
"tsv",
|
|
1356
|
+
"xml",
|
|
1357
|
+
"yaml",
|
|
1358
|
+
"yml",
|
|
1359
|
+
"toml",
|
|
1360
|
+
"ini",
|
|
1361
|
+
"cfg",
|
|
1362
|
+
"conf",
|
|
1363
|
+
"js",
|
|
1364
|
+
"mjs",
|
|
1365
|
+
"cjs",
|
|
1366
|
+
"ts",
|
|
1367
|
+
"tsx",
|
|
1368
|
+
"jsx",
|
|
1369
|
+
"py",
|
|
1370
|
+
"java",
|
|
1371
|
+
"go",
|
|
1372
|
+
"rs",
|
|
1373
|
+
"c",
|
|
1374
|
+
"h",
|
|
1375
|
+
"cpp",
|
|
1376
|
+
"hpp",
|
|
1377
|
+
"cs",
|
|
1378
|
+
"sql",
|
|
1379
|
+
"sh",
|
|
1380
|
+
"ps1",
|
|
1381
|
+
"bat",
|
|
1382
|
+
"cmd",
|
|
1383
|
+
"html",
|
|
1384
|
+
"htm",
|
|
1385
|
+
"css",
|
|
1386
|
+
"scss",
|
|
1387
|
+
"less",
|
|
1388
|
+
"vue",
|
|
1389
|
+
"svelte"
|
|
1390
|
+
]);
|
|
1273
1391
|
|
|
1274
1392
|
// src/qq/api.ts
|
|
1275
1393
|
var appSandboxRegistry = new Map;
|
|
@@ -1317,7 +1435,7 @@ function findQQBinding(sessionId, root = storageRoot()) {
|
|
|
1317
1435
|
const candidates = [{ file: join10(root, "sessions.json") }];
|
|
1318
1436
|
const rolesDir = join10(root, "roles");
|
|
1319
1437
|
if (existsSync9(rolesDir)) {
|
|
1320
|
-
for (const role of
|
|
1438
|
+
for (const role of readdirSync3(rolesDir)) {
|
|
1321
1439
|
candidates.push({ file: join10(rolesDir, role, "sessions.json"), appId: role });
|
|
1322
1440
|
}
|
|
1323
1441
|
}
|
|
@@ -1395,7 +1513,7 @@ async function executeQQSendFile(input, context) {
|
|
|
1395
1513
|
}
|
|
1396
1514
|
|
|
1397
1515
|
// src/core/qq-instructions.ts
|
|
1398
|
-
import { existsSync as existsSync10, mkdirSync as mkdirSync5, readdirSync as
|
|
1516
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync5, readdirSync as readdirSync4, readFileSync as readFileSync11, writeFileSync as writeFileSync7 } from "fs";
|
|
1399
1517
|
import { dirname as dirname5, join as join11 } from "path";
|
|
1400
1518
|
var QQ_INSTRUCTION_KEY = "qq";
|
|
1401
1519
|
var QQ_INSTRUCTION_TEXT = [
|
|
@@ -1411,7 +1529,7 @@ function listQQBindings(root = storageRoot()) {
|
|
|
1411
1529
|
const candidates = [{ file: join11(root, "sessions.json") }];
|
|
1412
1530
|
const rolesDir = join11(root, "roles");
|
|
1413
1531
|
if (existsSync10(rolesDir)) {
|
|
1414
|
-
for (const role of
|
|
1532
|
+
for (const role of readdirSync4(rolesDir))
|
|
1415
1533
|
candidates.push({ file: join11(rolesDir, role, "sessions.json"), appId: role });
|
|
1416
1534
|
}
|
|
1417
1535
|
const out = [];
|