dsh-taskbridge 1.8.1 → 1.9.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/CHANGELOG.md +27 -0
- package/README.md +139 -121
- package/antigravity/agents/dsh-taskbridge.md +14 -12
- package/antigravity/skills/dsh-taskbridge/SKILL.md +32 -19
- package/bin/dsh-delegate-codex-agent.js +9 -4
- package/codex/skills/dsh-taskbridge/SKILL.md +131 -0
- package/codex/skills/dsh-taskbridge/rules-reference-96027c387cb9b7587efa4aa3836235d86db1108068e007dc08196e807ca25e5d.md +114 -0
- package/docs/INTRODUCTION.md +94 -68
- package/docs/INTRODUCTION.zh.md +94 -77
- package/docs/antigravity-integration.md +6 -1
- package/docs/assets/taskbridge-workflow.en.svg +72 -0
- package/docs/assets/taskbridge-workflow.zh.png +0 -0
- package/docs/claude-code.md +5 -5
- package/docs/codex-integration.md +1102 -1076
- package/docs/releases/1.9.0.zh.md +31 -0
- package/docs/releases/1.9.1.zh.md +14 -0
- package/docs/runtime-compatibility.md +7 -9
- package/docs/silent-wait.md +17 -26
- package/docs/taskbridge-upgrade.md +4 -4
- package/lib/client.d.ts +2 -2
- package/lib/client.js +7 -7
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +157 -150
- package/src/antigravity/installer.js +33 -2
- package/src/client/api.js +139 -17
- package/src/client/index.jsx +20 -19
- package/src/codex/agent-ownership.js +72 -12
- package/src/codex/installer.js +4613 -4190
- package/src/http/execution-plane.js +17 -0
- package/src/http/user-plane.js +6 -0
- package/src/index.d.ts +9 -1
- package/src/index.js +86 -64
- package/src/jobs/engine.js +278 -5
- package/src/jobs/history.js +17 -1
- package/src/jobs/record-cleanup.js +76 -2
- package/src/mcp/server.js +241 -12
- package/src/runtime/permissions.js +18 -0
- package/src/runtime/worker-prompt.js +13 -9
- package/codex/dsh-taskbridge.toml +0 -181
package/src/client/index.jsx
CHANGED
|
@@ -2136,7 +2136,7 @@ function TaskDetail({ store, task }) {
|
|
|
2136
2136
|
<dt>无进展诊断</dt>
|
|
2137
2137
|
<dd>
|
|
2138
2138
|
{activity === null || activity.selfCheck === null || activity.selfCheck.verdict === null
|
|
2139
|
-
? (activity === null ? '未采集到' : '
|
|
2139
|
+
? (activity === null ? '未采集到' : '尚未触发程序自检(开始运行时间还没到自检间隔,或已关闭自检)')
|
|
2140
2140
|
: `${SELF_CHECK_LABELS[activity.selfCheck.verdict] ?? activity.selfCheck.verdict}`
|
|
2141
2141
|
+ (activity.selfCheck.checkedAt === null ? '' : `(${formatTime(activity.selfCheck.checkedAt)})`)}
|
|
2142
2142
|
</dd>
|
|
@@ -2222,15 +2222,15 @@ function TaskDetail({ store, task }) {
|
|
|
2222
2222
|
{`${entry.requestId} · ${entry.toolName ?? '—'} · `
|
|
2223
2223
|
+ `${PERMISSION_STATE_LABELS[entry.state] ?? entry.state ?? '—'} · `
|
|
2224
2224
|
+ `${PERMISSION_OUTCOME_LABELS[entry.outcome] ?? entry.outcome ?? '—'}`
|
|
2225
|
-
+ `${entry.decidedBy === 'commander' ? ` · ${PERMISSION_DECISION_LABELS[entry.outcome === 'allowed-once' ? 'allow-once' : 'reject'] ?? '
|
|
2225
|
+
+ `${entry.decidedBy === 'commander' ? ` · ${PERMISSION_DECISION_LABELS[entry.outcome === 'allowed-once' ? 'allow-once' : 'reject'] ?? '宿主端'}` : ''}`}
|
|
2226
2226
|
</li>
|
|
2227
2227
|
))}
|
|
2228
2228
|
</ul>
|
|
2229
2229
|
</>
|
|
2230
2230
|
)}
|
|
2231
2231
|
<p className="dshdg-hint">
|
|
2232
|
-
|
|
2233
|
-
|
|
2232
|
+
逐次授权只覆盖当前调用。后续调用如需扩大权限,须重新核对参数并审批。它不能创建或扩大任何跨任务或长期有效的授权(“长期有效”指跨会话持久的授权),不能修改设置、凭据、本机调用开关、提供方、模型或隔离方式;
|
|
2233
|
+
工作进程的常规沙箱权限始终保持 workspace-write。此界面不提供手工批准按钮,决定由宿主端通过
|
|
2234
2234
|
delegate_permission_decide 作出。
|
|
2235
2235
|
</p>
|
|
2236
2236
|
|
|
@@ -3316,7 +3316,7 @@ function TasksPanel({ store, snapshot }) {
|
|
|
3316
3316
|
return (
|
|
3317
3317
|
<div className="dshdg-panel">
|
|
3318
3318
|
<div className="dshdg-row">
|
|
3319
|
-
<p className="dshdg-muted"
|
|
3319
|
+
<p className="dshdg-muted">这里只记录执行事实。执行完成不等于被接受:“等待宿主审查”要由宿主端单独给出结论。</p>
|
|
3320
3320
|
<span className="dshdg-spacer" />
|
|
3321
3321
|
<span className="dshdg-hint" data-dshdg-refresh-hint="">
|
|
3322
3322
|
{changing !== true
|
|
@@ -3478,19 +3478,21 @@ function CodexPanel({ store, snapshot }) {
|
|
|
3478
3478
|
return (
|
|
3479
3479
|
<section className="dshdg-card" aria-labelledby="dshdg-codex-title">
|
|
3480
3480
|
<div className="dshdg-row">
|
|
3481
|
-
<h3 id="dshdg-codex-title">Codex
|
|
3481
|
+
<h3 id="dshdg-codex-title">Codex 集成(技能 Skill + MCP)</h3>
|
|
3482
3482
|
<span className="dshdg-spacer" />
|
|
3483
3483
|
<Badge tone={ready ? 'on' : 'off'}>{ready ? '已就绪' : '未就绪'}</Badge>
|
|
3484
3484
|
</div>
|
|
3485
3485
|
<p className="dshdg-muted">
|
|
3486
|
-
{'
|
|
3487
|
-
<span className="dshdg-mono">
|
|
3486
|
+
{'点下面的按钮,把原生技能 '}
|
|
3487
|
+
<span className="dshdg-mono">skills/dsh-taskbridge/SKILL.md</span>
|
|
3488
3488
|
{' 装进 Codex 目录,并在 Codex 的 '}
|
|
3489
3489
|
<span className="dshdg-mono">config.toml</span>
|
|
3490
|
-
{' 里登记本插件的 stdio MCP
|
|
3491
|
-
+ '
|
|
3492
|
-
+ '
|
|
3493
|
-
+ '
|
|
3490
|
+
{' 里登记本插件的 stdio MCP 服务(全套 11 个 delegate_* 工具:delegate_status / delegate_preflight / delegate_plan / delegate_submit / delegate_wait / delegate_permission_decide / delegate_question_answer / delegate_result / delegate_review / delegate_cancel / delegate_metrics)。'
|
|
3491
|
+
+ '首次安装只会由你点击触发:打开本页、安装或升级本插件都不会自动创建技能文件或 MCP 条目。'
|
|
3492
|
+
+ '若目录里存在早期版本写入且未经你改动的旧子智能体文件(agents/dsh-taskbridge.toml / agents/dsh-delegate.toml),'
|
|
3493
|
+
+ '插件会在升级或安装时自动迁移为原生技能并安全移除旧文件;你手动改过的旧文件会原样保留不删。'
|
|
3494
|
+
+ '已经安装过的情况下,插件下次启动也会把本插件自己写入的过期托管 MCP 条目就地更新(例如补上 tool_timeout_sec),'
|
|
3495
|
+
+ '不触碰非托管条目或 Codex 的其他设置。'}
|
|
3494
3496
|
</p>
|
|
3495
3497
|
{error === null ? null : <p className="dshdg-fail">{error}</p>}
|
|
3496
3498
|
{codex === null ? (
|
|
@@ -3511,7 +3513,7 @@ function CodexPanel({ store, snapshot }) {
|
|
|
3511
3513
|
<p className="dshdg-hint" data-dshdg-codex-drift="">
|
|
3512
3514
|
{'这个托管 MCP 条目已经过期:'}
|
|
3513
3515
|
{codexMcpDriftText(codex.mcp)}
|
|
3514
|
-
{'。插件下次启动会自动在原地更新;也可以点上面的「安装 / 更新 TaskBridge
|
|
3516
|
+
{'。插件下次启动会自动在原地更新;也可以点上面的「安装 / 更新 TaskBridge 技能」。'}
|
|
3515
3517
|
</p>
|
|
3516
3518
|
) : null}
|
|
3517
3519
|
{notes.length === 0 ? null : (
|
|
@@ -3524,7 +3526,7 @@ function CodexPanel({ store, snapshot }) {
|
|
|
3524
3526
|
{refreshing ? '读取中…' : '刷新状态'}
|
|
3525
3527
|
</button>
|
|
3526
3528
|
<button type="button" className="dshdg-primary" disabled={disabled} onClick={() => { void store.runCodexAction('install'); }}>
|
|
3527
|
-
{busy ? '处理中…' : '安装 / 更新 TaskBridge
|
|
3529
|
+
{busy ? '处理中…' : '安装 / 更新 TaskBridge 技能'}
|
|
3528
3530
|
</button>
|
|
3529
3531
|
<button type="button" disabled={disabled} onClick={() => { void store.runCodexAction('repair'); }}>
|
|
3530
3532
|
仅修复 MCP 配置
|
|
@@ -3539,11 +3541,10 @@ function CodexPanel({ store, snapshot }) {
|
|
|
3539
3541
|
</>
|
|
3540
3542
|
)}
|
|
3541
3543
|
<p className="dshdg-hint">
|
|
3542
|
-
{'安装后需要让 Codex 重新载入:新开会话或重启 Codex
|
|
3543
|
-
+ '
|
|
3544
|
-
+ '
|
|
3545
|
-
+ '
|
|
3546
|
-
+ '同名的自定义 agent 会被保留并报告为冲突;没有本插件托管标记注释的同名 MCP 条目也视为你自己写的,不会被覆盖或删除。'}
|
|
3544
|
+
{'安装后需要让 Codex 重新载入:新开会话或重启 Codex,才会读到新的原生技能和 MCP 条目。'
|
|
3545
|
+
+ 'Codex 会话在明确指派时(例如 $dsh-taskbridge 或明确要求交给 DSH / TaskBridge)会按技能规则由当前会话直接调用 delegate_submit 与单链 delegate_wait(利用 tool_timeout_sec = 3660 静默长等,不再派生子智能体并做 wait_agent 短轮询)。'
|
|
3546
|
+
+ '技能只在明确指派时派发任务,并在提交前先检查上面的本机调用开关;本页不会替你打开该开关。'
|
|
3547
|
+
+ '同名的自定义技能文件或你手动改过的旧 agents/*.toml 都会被保留而不被覆盖或删除;没有本插件托管标记注释的同名 MCP 条目也视为你自己写的,不会被覆盖或删除。'}
|
|
3547
3548
|
</p>
|
|
3548
3549
|
</section>
|
|
3549
3550
|
);
|
|
@@ -38,9 +38,12 @@ import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
|
38
38
|
/** Schema version of the record this module writes. */
|
|
39
39
|
export const OWNERSHIP_SCHEMA_VERSION = 1;
|
|
40
40
|
|
|
41
|
-
/** Directory, inside the plugin data directory, that holds one
|
|
41
|
+
/** Directory, inside the plugin data directory, that holds one legacy agent record per Codex home. */
|
|
42
42
|
export const OWNERSHIP_DIR_NAME = 'codex-agent-ownership';
|
|
43
43
|
|
|
44
|
+
/** Directory, inside the plugin data directory, that holds one skill record per Codex home. */
|
|
45
|
+
export const SKILL_OWNERSHIP_DIR_NAME = 'codex-skill-ownership';
|
|
46
|
+
|
|
44
47
|
/** A digest: lowercase hex SHA-256. */
|
|
45
48
|
const SHA256 = /^[0-9a-f]{64}$/u;
|
|
46
49
|
|
|
@@ -73,12 +76,17 @@ export function pluginDataDirectory(env = process.env) {
|
|
|
73
76
|
* @param {Record<string, string | undefined>} [env] - environment (`DSH_HOME`).
|
|
74
77
|
* @returns {string | null} absolute record path, or null when the data directory is unusable.
|
|
75
78
|
*/
|
|
76
|
-
export function ownershipRecordPath(codexHome, env = process.env) {
|
|
79
|
+
export function ownershipRecordPath(codexHome, env = process.env, dirName = OWNERSHIP_DIR_NAME) {
|
|
77
80
|
const dataDir = pluginDataDirectory(env);
|
|
78
81
|
if (dataDir === null) return null;
|
|
79
82
|
if (typeof codexHome !== 'string' || codexHome.trim() === '' || !isAbsolute(codexHome)) return null;
|
|
80
83
|
const key = createHash('sha256').update(resolve(codexHome), 'utf8').digest('hex');
|
|
81
|
-
return join(dataDir,
|
|
84
|
+
return join(dataDir, dirName, `${key}.json`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The skill ownership record path for one Codex home. */
|
|
88
|
+
export function skillOwnershipRecordPath(codexHome, env = process.env) {
|
|
89
|
+
return ownershipRecordPath(codexHome, env, SKILL_OWNERSHIP_DIR_NAME);
|
|
82
90
|
}
|
|
83
91
|
|
|
84
92
|
/**
|
|
@@ -94,14 +102,35 @@ export function ownershipRecordPath(codexHome, env = process.env) {
|
|
|
94
102
|
* platform attribute read. Injected so this module never grows a second, weaker copy of it.
|
|
95
103
|
* @returns {Promise<{ ok: boolean, missing: boolean, reason: string }>} verdict.
|
|
96
104
|
*/
|
|
97
|
-
|
|
105
|
+
export function chainPathsOf(target) {
|
|
98
106
|
const absolute = resolve(target);
|
|
99
107
|
const root = rootOf(absolute);
|
|
108
|
+
const paths = [root];
|
|
100
109
|
let current = root;
|
|
101
|
-
if ((await classify(root)) !== 'directory') return { ok: false, missing: false, reason: 'ancestor-not-a-directory' };
|
|
102
110
|
for (const part of absolute.slice(root.length).split(/[\\/]+/u).filter((part) => part !== '')) {
|
|
103
111
|
current = join(current, part);
|
|
104
|
-
|
|
112
|
+
paths.push(current);
|
|
113
|
+
}
|
|
114
|
+
return paths;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function inspectRealChain(target, classify, classifyMany = null) {
|
|
118
|
+
const paths = chainPathsOf(target);
|
|
119
|
+
if (typeof classifyMany === 'function') {
|
|
120
|
+
const verdicts = await classifyMany(paths);
|
|
121
|
+
if (verdicts.get(paths[0]) !== 'directory') return { ok: false, missing: false, reason: 'ancestor-not-a-directory' };
|
|
122
|
+
for (let i = 1; i < paths.length; i += 1) {
|
|
123
|
+
const kind = verdicts.get(paths[i]);
|
|
124
|
+
if (kind === 'directory') continue;
|
|
125
|
+
if (kind === 'missing') return { ok: false, missing: true, reason: 'ancestor-missing' };
|
|
126
|
+
if (kind === 'link') return { ok: false, missing: false, reason: 'ancestor-is-a-link' };
|
|
127
|
+
return { ok: false, missing: false, reason: 'ancestor-not-a-directory' };
|
|
128
|
+
}
|
|
129
|
+
return { ok: true, missing: false, reason: 'ok' };
|
|
130
|
+
}
|
|
131
|
+
if ((await classify(paths[0])) !== 'directory') return { ok: false, missing: false, reason: 'ancestor-not-a-directory' };
|
|
132
|
+
for (let i = 1; i < paths.length; i += 1) {
|
|
133
|
+
const kind = await classify(paths[i]);
|
|
105
134
|
if (kind === 'directory') continue;
|
|
106
135
|
if (kind === 'missing') return { ok: false, missing: true, reason: 'ancestor-missing' };
|
|
107
136
|
if (kind === 'link') return { ok: false, missing: false, reason: 'ancestor-is-a-link' };
|
|
@@ -135,11 +164,11 @@ function rootOf(absolute) {
|
|
|
135
164
|
* @param {object} options - `codexHome` (real, pinned), `env`, `classify` (see {@link inspectRealChain}).
|
|
136
165
|
* @returns {Promise<string | null>} LF-normalized template digest, or null.
|
|
137
166
|
*/
|
|
138
|
-
export async function recallTemplateDigest({ codexHome, env = process.env, classify } = {}) {
|
|
139
|
-
const path = ownershipRecordPath(codexHome, env);
|
|
167
|
+
export async function recallTemplateDigest({ codexHome, env = process.env, classify, classifyMany = null, dirName = OWNERSHIP_DIR_NAME } = {}) {
|
|
168
|
+
const path = ownershipRecordPath(codexHome, env, dirName);
|
|
140
169
|
if (path === null) return null;
|
|
141
|
-
if (typeof classify !== 'function') return null;
|
|
142
|
-
const chain = await inspectRealChain(dirname(path), classify);
|
|
170
|
+
if (typeof classify !== 'function' && typeof classifyMany !== 'function') return null;
|
|
171
|
+
const chain = await inspectRealChain(dirname(path), classify, classifyMany);
|
|
143
172
|
if (chain.ok !== true) return null;
|
|
144
173
|
const info = await lstat(path).catch(() => null);
|
|
145
174
|
// A junction is a directory to `lstat`, and a symlink is not a regular file: both are refused.
|
|
@@ -181,8 +210,10 @@ export async function rememberTemplateDigest({
|
|
|
181
210
|
writeFileAtomic,
|
|
182
211
|
mkdir: makeDirectory,
|
|
183
212
|
classify,
|
|
213
|
+
classifyMany = null,
|
|
214
|
+
dirName = OWNERSHIP_DIR_NAME,
|
|
184
215
|
} = {}) {
|
|
185
|
-
const path = ownershipRecordPath(codexHome, env);
|
|
216
|
+
const path = ownershipRecordPath(codexHome, env, dirName);
|
|
186
217
|
if (path === null) return { ok: false, reason: 'record-path-unusable' };
|
|
187
218
|
if (typeof template !== 'string' || template === '') return { ok: false, reason: 'no-template' };
|
|
188
219
|
if (typeof classify !== 'function') return { ok: false, reason: 'no-classifier' };
|
|
@@ -199,7 +230,7 @@ export async function rememberTemplateDigest({
|
|
|
199
230
|
}
|
|
200
231
|
if (current !== template) return { ok: false, reason: 'agent-not-this-template' };
|
|
201
232
|
|
|
202
|
-
const chain = await inspectRealChain(dirname(path), classify);
|
|
233
|
+
const chain = await inspectRealChain(dirname(path), classify, classifyMany);
|
|
203
234
|
if (chain.ok !== true) {
|
|
204
235
|
if (chain.reason !== 'ancestor-missing') return { ok: false, reason: chain.reason };
|
|
205
236
|
// The record directory does not exist yet: create it one level at a time and re-prove.
|
|
@@ -265,6 +296,35 @@ async function createArchiveDirectory(directory, classify, makeDirectory) {
|
|
|
265
296
|
* @param {string} text - agent file or template text.
|
|
266
297
|
* @returns {string} lowercase hex SHA-256.
|
|
267
298
|
*/
|
|
299
|
+
export async function recallSkillTemplateDigest({ codexHome, env = process.env, classify, classifyMany = null } = {}) {
|
|
300
|
+
return await recallTemplateDigest({ codexHome, env, classify, classifyMany, dirName: SKILL_OWNERSHIP_DIR_NAME });
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export async function rememberSkillTemplateDigest({
|
|
304
|
+
codexHome,
|
|
305
|
+
env = process.env,
|
|
306
|
+
template,
|
|
307
|
+
skillPath,
|
|
308
|
+
readFile: read = readFile,
|
|
309
|
+
writeFileAtomic,
|
|
310
|
+
mkdir: makeDirectory,
|
|
311
|
+
classify,
|
|
312
|
+
classifyMany = null,
|
|
313
|
+
} = {}) {
|
|
314
|
+
return await rememberTemplateDigest({
|
|
315
|
+
codexHome,
|
|
316
|
+
env,
|
|
317
|
+
template,
|
|
318
|
+
agentPath: skillPath,
|
|
319
|
+
readFile: read,
|
|
320
|
+
writeFileAtomic,
|
|
321
|
+
mkdir: makeDirectory,
|
|
322
|
+
classify,
|
|
323
|
+
classifyMany,
|
|
324
|
+
dirName: SKILL_OWNERSHIP_DIR_NAME,
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
268
328
|
export function digestLf(text) {
|
|
269
329
|
return createHash('sha256').update(String(text).replace(/\r\n/gu, '\n'), 'utf8').digest('hex');
|
|
270
330
|
}
|