dsh-supermesh 0.0.3 → 0.0.5
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/assets/prompts/orchestrator.md +3 -0
- package/assets/prompts/worker.md +4 -0
- package/dist/{channel-eDqcOvFj.js → channel-ChqKKcYq.js} +182 -59
- package/dist/client.cjs +96 -13
- package/dist/client.cjs.map +1 -1
- package/dist/index.js +38 -22
- package/dist/shell-DqAUjFxq.js +1 -0
- package/package.json +2 -1
- package/dist/shell-Bj-vzt4e.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as project, c as shell, d as singlet, f as setting, g as db, h as channelProxyEnvironment, i as archive, l as inbox, m as DSH_PLUGIN_HOME, n as server, o as worktree, p as defineService, r as worker$1, s as devops, t as channel, u as session } from "./channel-
|
|
1
|
+
import { a as project, c as shell, d as singlet, f as setting, g as db, h as channelProxyEnvironment, i as archive, l as inbox, m as DSH_PLUGIN_HOME, n as server, o as worktree, p as defineService, r as worker$1, s as devops, t as channel, u as session } from "./channel-ChqKKcYq.js";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join, resolve } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
@@ -267,6 +267,18 @@ async function latestVersion(threadId) {
|
|
|
267
267
|
async function markThread(exec, threadId) {
|
|
268
268
|
observe(exec, threadId, await latestVersion(threadId));
|
|
269
269
|
}
|
|
270
|
+
// src/channel/_shared/admission.ts
|
|
271
|
+
function acceptsChannelTrigger(input) {
|
|
272
|
+
if (!input.human || input.historical && !input.subscribed) return false;
|
|
273
|
+
return input.subscribed || input.admin && (input.kind === "open" || input.mentioned) && (!input.ignored || input.mentioned);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* 进流程不等于被点名。没 @ bot 的消息只是时间线记录:可以分诊,但不建票、不派工、也不在渠道上发言。
|
|
277
|
+
* 只有明确 @、或者这条话题已经被票订阅(人在跟进已有任务)才算在跟 bot 说话。
|
|
278
|
+
*/
|
|
279
|
+
function addressedToBot(input) {
|
|
280
|
+
return input.mentioned || input.subscribed;
|
|
281
|
+
}
|
|
270
282
|
// src/channel/_shared/error.ts
|
|
271
283
|
var ChannelError = class extends Error {
|
|
272
284
|
code;
|
|
@@ -417,7 +429,7 @@ function* answerLines(body) {
|
|
|
417
429
|
}
|
|
418
430
|
}
|
|
419
431
|
// src/channel/_shared/ci.ts
|
|
420
|
-
/** 分支 CI 变更落成 ciWatch、ci
|
|
432
|
+
/** 分支 CI 变更落成 ciWatch、ci 话题与触发;只有订阅了这条话题的票才收到通知。 */
|
|
421
433
|
async function notifyBranchCi(input) {
|
|
422
434
|
const { row: watch } = await db.ciWatch.recordRevision({
|
|
423
435
|
id: `${input.channel}:${input.ref}`,
|
|
@@ -457,17 +469,22 @@ async function notifyBranchCi(input) {
|
|
|
457
469
|
at: now(),
|
|
458
470
|
ref: input.head
|
|
459
471
|
});
|
|
460
|
-
await db.
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
472
|
+
for (const ticketId of await db.ticketThread.listTicketIds(threadId)) {
|
|
473
|
+
const ticket = await db.ticket.findById(ticketId);
|
|
474
|
+
if (!ticket || ["done", "cancelled"].includes(ticket.status)) continue;
|
|
475
|
+
await db.inbox.enqueue({
|
|
476
|
+
id: `${triggerId}:ticket:${ticketId}`,
|
|
477
|
+
type: "project",
|
|
478
|
+
origin: "system",
|
|
479
|
+
kind: "notice",
|
|
480
|
+
projectId: ticket.projectId,
|
|
481
|
+
ticketId,
|
|
482
|
+
triggerId,
|
|
483
|
+
threadId,
|
|
484
|
+
title: input.message,
|
|
485
|
+
message: input.message
|
|
486
|
+
});
|
|
487
|
+
}
|
|
471
488
|
}
|
|
472
489
|
// src/channel/github/service/resource.ts
|
|
473
490
|
const resource$1 = defineService({
|
|
@@ -529,11 +546,6 @@ const resource$1 = defineService({
|
|
|
529
546
|
};
|
|
530
547
|
}
|
|
531
548
|
});
|
|
532
|
-
// src/channel/_shared/admission.ts
|
|
533
|
-
function acceptsChannelTrigger(input) {
|
|
534
|
-
if (!input.human || input.historical && !input.subscribed) return false;
|
|
535
|
-
return input.subscribed || input.admin && (input.kind === "open" || input.mentioned) && (!input.ignored || input.mentioned);
|
|
536
|
-
}
|
|
537
549
|
// src/service/courier.ts
|
|
538
550
|
/** 没有活票的话题,最后一次活动超过这个时长就不再轮询(官方 POLL_HORIZON_MS)。 */
|
|
539
551
|
const POLL_HORIZON_MS = 12096e5;
|
|
@@ -2153,6 +2165,11 @@ const reply_channel = defineTool({
|
|
|
2153
2165
|
status: "suppressed",
|
|
2154
2166
|
reason: "another_role_already_replied"
|
|
2155
2167
|
});
|
|
2168
|
+
const subscribed = (await db.ticketThread.listTicketIds(thread.id)).length > 0;
|
|
2169
|
+
if (!addressedToBot({
|
|
2170
|
+
mentioned: Boolean(trigger.mentioned),
|
|
2171
|
+
subscribed
|
|
2172
|
+
})) throw new Error("这条消息没有 @ bot,也不是已订阅话题上的跟进:只做分诊记录,不对外发言");
|
|
2156
2173
|
const ticketId = identity.ticketId ?? null;
|
|
2157
2174
|
const row = await db.inbox.enqueue({
|
|
2158
2175
|
id: replyKey(trigger.id, args.text),
|
|
@@ -2202,7 +2219,7 @@ const inbox_list = defineTool({
|
|
|
2202
2219
|
});
|
|
2203
2220
|
const read_mailbox = defineTool({
|
|
2204
2221
|
name: "read_mailbox",
|
|
2205
|
-
description: "读取当前角色未处理邮件,以及可用项目的 id、仓库地址和本地路径。可传 ids
|
|
2222
|
+
description: "读取当前角色未处理邮件,以及可用项目的 id、仓库地址和本地路径。可传 ids 一次读取指定多条邮件。渠道邮件带 trigger 事实(actor / human / mentioned):mentioned=no 只是时间线记录,不是开工请求。读取标为已读,处理完用 inbox_kill,ask 必须用 answer。",
|
|
2206
2223
|
parameters: { ids: {
|
|
2207
2224
|
type: "array",
|
|
2208
2225
|
items: { type: "string" },
|
|
@@ -2635,7 +2652,7 @@ const create_worker = defineTool({
|
|
|
2635
2652
|
});
|
|
2636
2653
|
const send = defineTool({
|
|
2637
2654
|
name: "send",
|
|
2638
|
-
description: "直接将完整消息交给活跃 Worker,跳过业务排队;只有需要立刻止损才用 interrupt。Worker
|
|
2655
|
+
description: "直接将完整消息交给活跃 Worker,跳过业务排队;只有需要立刻止损才用 interrupt。Worker 没有收件箱。票已结束不拦,Worker 还活着就能收到。",
|
|
2639
2656
|
parameters: {
|
|
2640
2657
|
workerId: {
|
|
2641
2658
|
type: "string",
|
|
@@ -2676,7 +2693,6 @@ const send = defineTool({
|
|
|
2676
2693
|
const ticket = await db.ticket.findById(worker.ticketId);
|
|
2677
2694
|
if (!ticket || ticket.projectId !== identity.projectId) throw new Error("Worker 不属于当前项目");
|
|
2678
2695
|
if (worker.status === "ended") throw new Error("Worker 已结束");
|
|
2679
|
-
if (ticket.status === "done" || ticket.status === "cancelled") throw new Error("工单已结束");
|
|
2680
2696
|
if (!await session.lookup(worker.id)) throw new Error("Worker 未在运行时加载、已归档或不属于 Supermesh;不能直接发送");
|
|
2681
2697
|
if (args.mode === "reply") {
|
|
2682
2698
|
const asks = (await db.inbox.listByTicket(ticket.id)).filter((row) => row.workerId === worker.id && row.kind === "ask" && row.status === "pending");
|
|
@@ -2731,7 +2747,7 @@ const view = defineTool({
|
|
|
2731
2747
|
});
|
|
2732
2748
|
const cancel = defineTool({
|
|
2733
2749
|
name: "cancel",
|
|
2734
|
-
description: "中止 Worker
|
|
2750
|
+
description: "中止 Worker 当前回合。那一次回合一并作废。票已结束也能停,只看 Worker 是否还活着。",
|
|
2735
2751
|
parameters: {
|
|
2736
2752
|
workerId: {
|
|
2737
2753
|
type: "string",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { c as shell } from "./channel-ChqKKcYq.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-supermesh",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"description": "把 GitHub / GitLab 的 issue、PR 与评论变成任务,交给各自 worktree 里的 Worker 改代码、开 PR,再由上级代理验收收尾。",
|
|
6
6
|
"author": "Hairy <wwu710632@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -120,6 +120,7 @@
|
|
|
120
120
|
"@deepseek-ai/dsh-session-persistence": "0.2.2-rc.2",
|
|
121
121
|
"@deepseek-ai/dsh-session-projection": "0.2.2-rc.2",
|
|
122
122
|
"@deepseek-ai/dsh-session-query": "0.0.1-rc.1",
|
|
123
|
+
"@deepseek-ai/dsh-shell-env": "0.2.2-rc.2",
|
|
123
124
|
"@deepseek-ai/dsh-skill-filesystem": "0.2.2-rc.2",
|
|
124
125
|
"@deepseek-ai/dsh-tools": "0.2.2-rc.2",
|
|
125
126
|
"@deepseek-ai/dsh-user-approval": "0.2.2-rc.2",
|
package/dist/shell-Bj-vzt4e.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { c as shell } from "./channel-eDqcOvFj.js";
|