dsh-collab-pair 1.5.0 → 1.5.1
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 +2 -0
- package/index.js +37 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,6 +60,7 @@ The page only links, unlinks, and reports status. Goals, tasks, and acceptance s
|
|
|
60
60
|
|
|
61
61
|
- The settings page follows the app language; English and Chinese ship in the package.
|
|
62
62
|
- Generated collaboration messages follow the `language` config (`zh` or `en`, default `zh`). Switch it in the page header (**Message language**) or with `/collab language en`. The command persists the config and reloads the plugin.
|
|
63
|
+
- Built-in title prefixes follow `language`: `【项目经理】`/`【员工】` for zh, `[Manager]`/`[Worker]` for en. Custom `prefixManager`/`prefixWorker` values override the defaults; switching language re-prefixes linked titles on reload.
|
|
63
64
|
|
|
64
65
|
## Unattended runs
|
|
65
66
|
|
|
@@ -319,6 +320,7 @@ dsh plugin add dsh-collab-pair
|
|
|
319
320
|
|
|
320
321
|
- 设置页跟随应用语言,包内自带中文和英文。
|
|
321
322
|
- 对话里生成的消息由配置 `language` 决定(`zh` / `en`,默认 `zh`)。可在页面顶部「对话消息语言」切换,或用 `/collab language en`;命令会保存配置并重载插件。
|
|
323
|
+
- 内置标题前缀跟随 `language`:中文 `【项目经理】`/`【员工】`,英文 `[Manager]`/`[Worker]`。自定义 `prefixManager`/`prefixWorker` 会覆盖默认;切换语言后重载会自动把已关联对话改成对应前缀。
|
|
322
324
|
|
|
323
325
|
## 挂机运行
|
|
324
326
|
|
package/index.js
CHANGED
|
@@ -41,7 +41,11 @@ const DONE = 'done'
|
|
|
41
41
|
const STOPPED = 'stopped'
|
|
42
42
|
const REPORTS = new Set(['done', 'partial', 'blocked'])
|
|
43
43
|
const PROMPT_TIMEOUT_MS = 180000
|
|
44
|
-
const ENGINE = 'collab-pair/1.5.
|
|
44
|
+
const ENGINE = 'collab-pair/1.5.1'
|
|
45
|
+
const PREFIX_DEFAULTS = {
|
|
46
|
+
zh: { manager: '【项目经理】', worker: '【员工】' },
|
|
47
|
+
en: { manager: '[Manager]', worker: '[Worker]' },
|
|
48
|
+
}
|
|
45
49
|
|
|
46
50
|
/** A recoverable failure whose message is meant for the model. */
|
|
47
51
|
class CollabError extends Error {}
|
|
@@ -61,9 +65,9 @@ function resolveConfig(raw) {
|
|
|
61
65
|
notifyWorkerOnDone: value.notifyWorkerOnDone !== false,
|
|
62
66
|
autoRelay: value.autoRelay !== false,
|
|
63
67
|
addPrefix: value.addPrefix !== false,
|
|
64
|
-
prefixManager: prefixText(value.prefixManager, '【项目经理】'),
|
|
65
|
-
prefixWorker: prefixText(value.prefixWorker, '【员工】'),
|
|
66
68
|
language: value.language === 'en' ? 'en' : 'zh',
|
|
69
|
+
prefixManager: prefixFor(value.prefixManager, 'manager', value.language === 'en' ? 'en' : 'zh'),
|
|
70
|
+
prefixWorker: prefixFor(value.prefixWorker, 'worker', value.language === 'en' ? 'en' : 'zh'),
|
|
67
71
|
autoNudge: value.autoNudge !== false,
|
|
68
72
|
nudgeAfterMinutes: clampInt(value.nudgeAfterMinutes, 5, 1440, 20),
|
|
69
73
|
maxNudges: clampInt(value.maxNudges, 1, 20, 3),
|
|
@@ -114,6 +118,15 @@ function prefixText(candidate, fallback) {
|
|
|
114
118
|
return value.length > 24 ? value.slice(0, 24) : value
|
|
115
119
|
}
|
|
116
120
|
|
|
121
|
+
/** Built-in prefixes follow the message language; custom values stay custom. */
|
|
122
|
+
function prefixFor(candidate, role, language) {
|
|
123
|
+
const value = typeof candidate === 'string' ? candidate.trim() : ''
|
|
124
|
+
const fallback = PREFIX_DEFAULTS[language][role]
|
|
125
|
+
if (value === '') return fallback
|
|
126
|
+
const builtIn = Object.values(PREFIX_DEFAULTS).some((set) => set[role] === value)
|
|
127
|
+
return builtIn ? fallback : prefixText(value, fallback)
|
|
128
|
+
}
|
|
129
|
+
|
|
117
130
|
/** Rounds per worker: 0 (the default) means unlimited. */
|
|
118
131
|
function normalizeRounds(candidate) {
|
|
119
132
|
const number = typeof candidate === 'number' ? candidate : Number(candidate)
|
|
@@ -576,6 +589,7 @@ export function apply(ctx, rawConfig) {
|
|
|
576
589
|
if (cfg.autoNudge) watchdogTimer = setInterval(() => { void runWatchdog() }, 60000)
|
|
577
590
|
setTimeout(() => { void recoverPendingLinks() }, 5000)
|
|
578
591
|
setTimeout(() => { void backfillProjects() }, 3000)
|
|
592
|
+
setTimeout(() => { void relocalizePrefixes() }, 4000)
|
|
579
593
|
setTimeout(() => { if (alive) void remoteLoop() }, 2000)
|
|
580
594
|
|
|
581
595
|
registerTools()
|
|
@@ -1635,7 +1649,12 @@ export function apply(ctx, rawConfig) {
|
|
|
1635
1649
|
|
|
1636
1650
|
/** Remove one of our role prefixes from a title. */
|
|
1637
1651
|
function stripKnownPrefix(title) {
|
|
1638
|
-
|
|
1652
|
+
const known = new Set([
|
|
1653
|
+
cfg.prefixManager,
|
|
1654
|
+
cfg.prefixWorker,
|
|
1655
|
+
...Object.values(PREFIX_DEFAULTS).flatMap((set) => [set.manager, set.worker]),
|
|
1656
|
+
])
|
|
1657
|
+
for (const prefix of known) {
|
|
1639
1658
|
if (prefix !== '' && title.startsWith(prefix)) return title.slice(prefix.length).trimStart()
|
|
1640
1659
|
}
|
|
1641
1660
|
return title
|
|
@@ -1977,6 +1996,20 @@ export function apply(ctx, rawConfig) {
|
|
|
1977
1996
|
}
|
|
1978
1997
|
}
|
|
1979
1998
|
|
|
1999
|
+
/** Re-apply role prefixes in the current language after a language switch. */
|
|
2000
|
+
async function relocalizePrefixes() {
|
|
2001
|
+
if (!alive || !cfg.addPrefix) return
|
|
2002
|
+
for (const link of [...links.values()]) {
|
|
2003
|
+
if (!alive) return
|
|
2004
|
+
try {
|
|
2005
|
+
await applyPrefix(link.manager, cfg.prefixManager)
|
|
2006
|
+
if (link.remote === undefined) await applyPrefix(link.worker, cfg.prefixWorker)
|
|
2007
|
+
} catch (error) {
|
|
2008
|
+
ctx.logger.warn(`collab-pair: re-prefixing ${link.id} failed: ${String(error)}`)
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
|
|
1980
2013
|
/** Serialize relays per link so one turn cannot relay twice. */
|
|
1981
2014
|
function enqueueRelay(linkId, run) { const previous = relays.get(linkId) ?? Promise.resolve()
|
|
1982
2015
|
const next = previous.then(run, run).catch((error) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-collab-pair",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "DSH collaboration plugin: link a project-manager conversation with local or remote workers across devices, dispatch rounds, relay results and manage projects/stages automatically. Also ships a prompt to-do queue for any conversation: pre-write a series of prompts and the next one is sent when a turn ends. Includes a relay hub and a free ntfy.sh transport.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|