dsh-taskbridge 1.8.1 → 1.9.0
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 +20 -0
- package/README.md +751 -733
- 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 +148 -122
- package/docs/INTRODUCTION.zh.md +151 -134
- package/docs/antigravity-integration.md +47 -42
- package/docs/assets/taskbridge-workflow.en.svg +72 -0
- package/docs/assets/taskbridge-workflow.zh.png +0 -0
- package/docs/claude-code.md +18 -18
- package/docs/codex-integration.md +139 -113
- package/docs/releases/1.8.0.zh.md +16 -16
- package/docs/releases/1.8.1.zh.md +24 -24
- package/docs/releases/1.9.0.zh.md +31 -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 +7 -7
- package/locale/zh.json +7 -7
- package/package.json +10 -4
- package/src/antigravity/installer.js +1099 -1068
- package/src/antigravity/seam.js +142 -142
- package/src/client/api.js +135 -13
- package/src/client/index.jsx +19 -18
- package/src/codex/agent-ownership.js +72 -12
- package/src/codex/installer.js +688 -268
- 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 +715 -641
- 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
|
@@ -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
|
}
|