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.
Files changed (42) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +751 -733
  3. package/antigravity/agents/dsh-taskbridge.md +14 -12
  4. package/antigravity/skills/dsh-taskbridge/SKILL.md +32 -19
  5. package/bin/dsh-delegate-codex-agent.js +9 -4
  6. package/codex/skills/dsh-taskbridge/SKILL.md +131 -0
  7. package/codex/skills/dsh-taskbridge/rules-reference-96027c387cb9b7587efa4aa3836235d86db1108068e007dc08196e807ca25e5d.md +114 -0
  8. package/docs/INTRODUCTION.md +148 -122
  9. package/docs/INTRODUCTION.zh.md +151 -134
  10. package/docs/antigravity-integration.md +47 -42
  11. package/docs/assets/taskbridge-workflow.en.svg +72 -0
  12. package/docs/assets/taskbridge-workflow.zh.png +0 -0
  13. package/docs/claude-code.md +18 -18
  14. package/docs/codex-integration.md +139 -113
  15. package/docs/releases/1.8.0.zh.md +16 -16
  16. package/docs/releases/1.8.1.zh.md +24 -24
  17. package/docs/releases/1.9.0.zh.md +31 -0
  18. package/docs/runtime-compatibility.md +7 -9
  19. package/docs/silent-wait.md +17 -26
  20. package/docs/taskbridge-upgrade.md +4 -4
  21. package/lib/client.d.ts +2 -2
  22. package/lib/client.js +7 -7
  23. package/locale/en.json +7 -7
  24. package/locale/zh.json +7 -7
  25. package/package.json +10 -4
  26. package/src/antigravity/installer.js +1099 -1068
  27. package/src/antigravity/seam.js +142 -142
  28. package/src/client/api.js +135 -13
  29. package/src/client/index.jsx +19 -18
  30. package/src/codex/agent-ownership.js +72 -12
  31. package/src/codex/installer.js +688 -268
  32. package/src/http/execution-plane.js +17 -0
  33. package/src/http/user-plane.js +6 -0
  34. package/src/index.d.ts +9 -1
  35. package/src/index.js +86 -64
  36. package/src/jobs/engine.js +278 -5
  37. package/src/jobs/history.js +17 -1
  38. package/src/jobs/record-cleanup.js +715 -641
  39. package/src/mcp/server.js +241 -12
  40. package/src/runtime/permissions.js +18 -0
  41. package/src/runtime/worker-prompt.js +13 -9
  42. package/codex/dsh-taskbridge.toml +0 -181
@@ -237,6 +237,15 @@ async function submitTask({ req, res, connection, deps }) {
237
237
  const continueFromTaskId = body.continueFromTaskId === undefined || body.continueFromTaskId === null
238
238
  ? undefined
239
239
  : body.continueFromTaskId;
240
+ if (body.reuseWorktreeFromTaskId !== undefined && body.reuseWorktreeFromTaskId !== null
241
+ && typeof body.reuseWorktreeFromTaskId !== 'string') {
242
+ throw new HttpError(400, 'JOB_ISOLATION_REFUSED', 'reuseWorktreeFromTaskId must be a string', {
243
+ field: 'reuseWorktreeFromTaskId',
244
+ });
245
+ }
246
+ const reuseWorktreeFromTaskId = typeof body.reuseWorktreeFromTaskId === 'string'
247
+ ? body.reuseWorktreeFromTaskId
248
+ : undefined;
240
249
  // The Agent Teams decision travels as the commander's own field and is folded into the
241
250
  // existing overrides channel (the engine's per-task choice path). A non-boolean is
242
251
  // refused here rather than reaching the engine's sanitiser as a coercible value.
@@ -277,6 +286,7 @@ async function submitTask({ req, res, connection, deps }) {
277
286
  ...(body.title === undefined ? {} : { title: body.title }),
278
287
  overrides,
279
288
  ...(continueFromTaskId === undefined ? {} : { continueFromTaskId }),
289
+ ...(reuseWorktreeFromTaskId === undefined ? {} : { reuseWorktreeFromTaskId }),
280
290
  ...hierarchyFields,
281
291
  ...goalField,
282
292
  });
@@ -297,6 +307,7 @@ async function submitTask({ req, res, connection, deps }) {
297
307
  ...(body.title === undefined ? {} : { title: body.title }),
298
308
  overrides,
299
309
  ...(continueFromTaskId === undefined ? {} : { continueFromTaskId }),
310
+ ...(reuseWorktreeFromTaskId === undefined ? {} : { reuseWorktreeFromTaskId }),
300
311
  ...hierarchyFields,
301
312
  ...goalField,
302
313
  });
@@ -383,6 +394,11 @@ async function decidePermission({ req, res, connection, deps }) {
383
394
  if (body.fingerprint !== undefined && body.fingerprint !== null && typeof body.fingerprint !== 'string') {
384
395
  throw new HttpError(400, 'PERMISSION_FINGERPRINT_INVALID', 'fingerprint must be a string when present');
385
396
  }
397
+ if (body.scope !== undefined && body.scope !== null && body.scope !== 'once' && body.scope !== 'task-command') {
398
+ throw new HttpError(400, 'PERMISSION_DECISION_INVALID', 'scope must be once or task-command when present', {
399
+ field: 'scope',
400
+ });
401
+ }
386
402
  const result = await deps.engine.decidePermission({
387
403
  // The verified connection, not `body.connectionId`: a caller cannot name an owner.
388
404
  connectionId: connection.connectionId,
@@ -391,6 +407,7 @@ async function decidePermission({ req, res, connection, deps }) {
391
407
  decision: body.decision,
392
408
  ...(typeof body.reason === 'string' ? { reason: body.reason } : {}),
393
409
  ...(typeof body.fingerprint === 'string' ? { fingerprint: body.fingerprint } : {}),
410
+ ...(typeof body.scope === 'string' ? { scope: body.scope } : {}),
394
411
  });
395
412
  sendJson(res, 200, { ok: true, ...result });
396
413
  }
@@ -923,6 +923,9 @@ async function runCodexIntegration(deps, action) {
923
923
  'this host does not expose the Codex integration, so nothing can be installed or reported',
924
924
  );
925
925
  }
926
+ if (deps.codexStartupRefresh) {
927
+ try { await deps.codexStartupRefresh; } catch { /* startup refresh logs its own warning */ }
928
+ }
926
929
  let outcome;
927
930
  try {
928
931
  outcome = action === 'status' ? await seam.status() : await seam.run(action);
@@ -964,6 +967,9 @@ async function runAntigravityIntegration(deps, action) {
964
967
  'this host does not expose the Antigravity integration, so nothing can be installed or reported',
965
968
  );
966
969
  }
970
+ if (deps.antigravityStartupRefresh) {
971
+ try { await deps.antigravityStartupRefresh; } catch { /* startup refresh logs its own warning */ }
972
+ }
967
973
  let outcome;
968
974
  try {
969
975
  outcome = action === 'status' ? await seam.status() : await seam.run(action);
package/src/index.d.ts CHANGED
@@ -112,8 +112,13 @@ export interface DelegateSubmitRequest {
112
112
  title?: string;
113
113
  goalDescription?: string;
114
114
  continueFromTaskId?: string;
115
+ reuseWorktreeFromTaskId?: string;
115
116
  planNodeId?: string;
116
117
  parentNodeId?: string;
118
+ autoPreflight?: boolean;
119
+ allowShared?: boolean;
120
+ wait?: boolean;
121
+ waitSeconds?: number;
117
122
  overrides?: {
118
123
  model?: string;
119
124
  reasoningEffort?: string;
@@ -227,7 +232,7 @@ export interface DelegatePendingPermission {
227
232
  deadlineAt: number;
228
233
  decision: 'allow-once' | 'reject' | null;
229
234
  decidedAt: number | null;
230
- decidedBy: 'commander' | 'deadline' | 'asker' | 'stop' | 'binding' | 'restart' | null;
235
+ decidedBy: 'commander' | 'commander-task-command' | 'deadline' | 'asker' | 'stop' | 'binding' | 'restart' | null;
231
236
  decisionReason: string | null;
232
237
  /** Closed native outcome: `allowed-once` is the only grant. */
233
238
  outcome: 'allowed-once' | 'rejected' | 'cancelled' | 'unavailable' | null;
@@ -237,6 +242,9 @@ export interface DelegatePendingPermission {
237
242
  argumentsComplete: boolean;
238
243
  callReread: boolean;
239
244
  turnOpen: boolean;
245
+ /** Effective scope. `task-command` can appear in historical preview receipts. */
246
+ scope?: 'once' | 'task-command';
247
+ reusedFromRequestId?: string;
240
248
  boundsApplied: string[];
241
249
  } | null;
242
250
  /** Present only for an `allowed-once`; states that it covers one call. */
package/src/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  // dsh-delegate — native DSH plugin entry point.
2
2
  //
3
3
  // Load order matters and is visible here: services are injected, configuration is
4
- // read, a byte-exact shipped Codex agent is refreshed, both HTTP planes are
5
- // registered on their respective carriers, and the native
6
- // provider/adapter/worktree/history machinery is constructed. The persisted
7
- // local-call switch is restored at startup and defaults to OFF; no task is
8
- // dispatched until an operator enables it in the DSH plugin settings.
4
+ // read, the native provider/adapter/worktree/history machinery is constructed,
5
+ // both HTTP planes are registered on their respective carriers immediately, and
6
+ // byte-exact shipped Codex / Antigravity integrations are refreshed in parallel.
7
+ // The persisted local-call switch is restored at startup and defaults to OFF;
8
+ // no task is dispatched until an operator enables it in the DSH plugin settings.
9
9
  //
10
10
  // Service access is deliberately split in three:
11
11
  //
@@ -296,67 +296,10 @@ export async function apply(ctx, config = {}) {
296
296
  hasQuestionService: () => hasQuestionService(ctx),
297
297
  logger,
298
298
  }),
299
+ codexStartupRefresh: null,
300
+ antigravityStartupRefresh: null,
299
301
  };
300
302
 
301
- try {
302
- // Both halves of the installed-integration check: a byte-exact shipped agent is
303
- // refreshed, and an ALREADY INSTALLED managed `mcp_servers.dsh-delegate` entry that
304
- // is merely stale (for example one written before `tool_timeout_sec` existed) is
305
- // upgraded in place. Nothing is created here — a home without an entry stays
306
- // without one — and an entry this plugin cannot prove it wrote is refused and left
307
- // byte-identical.
308
- //
309
- // The TARGET is the seam's own decision (`startupTarget`), not a second read of
310
- // `process.env`: an explicit `CODEX_HOME`, else the home this plugin recorded from a
311
- // successful install, else the default only when it is a real directory. A default
312
- // that is a link is reported instead of walked, so the automatic upgrade never
313
- // writes into a tree nobody named.
314
- const target = await deps.codex?.startupTarget?.();
315
- let migration = null;
316
- if (target?.home) {
317
- migration = await deps.codex?.refreshManagedIntegration({
318
- startupTarget: target,
319
- // The pre-write copy lives in the plugin's own data directory: supportable, not
320
- // packaged, and never inside the Codex home.
321
- backupDir: join(dataDir, 'codex-config-backup'),
322
- });
323
- } else if (target !== undefined && target !== null) {
324
- logger?.info?.(`dsh-delegate: Codex integration check skipped (${target.reason})`);
325
- }
326
- if (migration?.changed.includes('agent')) {
327
- logger?.info?.(`dsh-delegate: refreshed a managed Codex agent template to ${pluginVersion}`);
328
- }
329
- if (migration?.changed.includes('mcp')) {
330
- logger?.info?.('dsh-delegate: upgraded a stale managed Codex MCP entry in place');
331
- }
332
- for (const refusal of migration?.refused ?? []) {
333
- logger?.warn?.(`dsh-delegate: Codex integration refresh was refused (${refusal.code})`);
334
- }
335
- } catch (error) {
336
- logger?.warn?.(`dsh-delegate: Codex integration refresh check failed (${diagnostic(error?.message ?? error, 200)})`);
337
- }
338
-
339
- try {
340
- const agyTarget = await deps.antigravity?.startupTarget?.();
341
- let agyMigration = null;
342
- if (agyTarget?.home) {
343
- agyMigration = await deps.antigravity?.refreshManagedIntegration({ startupTarget: agyTarget });
344
- } else if (agyTarget !== undefined && agyTarget !== null) {
345
- logger?.info?.(`dsh-delegate: Antigravity integration check skipped (${agyTarget.reason})`);
346
- }
347
- if (agyMigration?.changed.includes('plugin')) {
348
- logger?.info?.(`dsh-delegate: refreshed a managed Antigravity plugin bundle to ${pluginVersion}`);
349
- }
350
- if (agyMigration?.changed.includes('mcp')) {
351
- logger?.info?.('dsh-delegate: upgraded a stale managed Antigravity MCP entry in place');
352
- }
353
- for (const refusal of agyMigration?.refused ?? []) {
354
- logger?.warn?.(`dsh-delegate: Antigravity integration refresh was refused (${refusal.code})`);
355
- }
356
- } catch (error) {
357
- logger?.warn?.(`dsh-delegate: Antigravity integration refresh check failed (${diagnostic(error?.message ?? error, 200)})`);
358
- }
359
-
360
303
  /**
361
304
  * Bring the native routes and the adapter's served snapshot to the state this
362
305
  * settings snapshot describes, and return the mapping both sides agree on.
@@ -570,6 +513,85 @@ export async function apply(ctx, config = {}) {
570
513
  credentials,
571
514
  deps,
572
515
  });
516
+
517
+ // Run Codex and Antigravity startup refreshes AFTER both HTTP planes are registered
518
+ // (and in parallel), so clicking "Enable immediately" in DSH Desktop never leaves
519
+ // `/api/dsh-delegate/*` returning 404 while Windows PowerShell checks symlink paths.
520
+ // The `/codex` and `/antigravity` user-plane routes await their respective refresh
521
+ // promise before reading or mutating files so there is no startup read/write race.
522
+ const codexStartupRefresh = (async () => {
523
+ try {
524
+ // Both halves of the installed-integration check: a byte-exact shipped agent is
525
+ // refreshed, and an ALREADY INSTALLED managed `mcp_servers.dsh-delegate` entry that
526
+ // is merely stale (for example one written before `tool_timeout_sec` existed) is
527
+ // upgraded in place. Nothing is created here — a home without an entry stays
528
+ // without one — and an entry this plugin cannot prove it wrote is refused and left
529
+ // byte-identical.
530
+ //
531
+ // The TARGET is the seam's own decision (`startupTarget`), not a second read of
532
+ // `process.env`: an explicit `CODEX_HOME`, else the home this plugin recorded from a
533
+ // successful install, else the default only when it is a real directory. A default
534
+ // that is a link is reported instead of walked, so the automatic upgrade never
535
+ // writes into a tree nobody named.
536
+ const target = await deps.codex?.startupTarget?.();
537
+ let migration = null;
538
+ if (target?.home) {
539
+ migration = await deps.codex?.refreshManagedIntegration({
540
+ startupTarget: target,
541
+ // The pre-write copy lives in the plugin's own data directory: supportable, not
542
+ // packaged, and never inside the Codex home.
543
+ backupDir: join(dataDir, 'codex-config-backup'),
544
+ });
545
+ } else if (target !== undefined && target !== null) {
546
+ logger?.info?.(`dsh-delegate: Codex integration check skipped (${target.reason})`);
547
+ }
548
+ if (migration?.changed.includes('agent')) {
549
+ logger?.info?.(`dsh-delegate: refreshed a managed Codex skill template to ${pluginVersion}`);
550
+ }
551
+ if (migration?.changed.includes('legacyAgent')) {
552
+ logger?.info?.('dsh-delegate: removed managed legacy Codex subagent files');
553
+ }
554
+ if (migration?.changed.includes('mcp')) {
555
+ logger?.info?.('dsh-delegate: upgraded a stale managed Codex MCP entry in place');
556
+ }
557
+ for (const refusal of migration?.refused ?? []) {
558
+ logger?.warn?.(`dsh-delegate: Codex integration refresh was refused (${refusal.code})`);
559
+ }
560
+ } catch (error) {
561
+ logger?.warn?.(`dsh-delegate: Codex integration refresh check failed (${diagnostic(error?.message ?? error, 200)})`);
562
+ }
563
+ })().finally(() => {
564
+ if (deps.codexStartupRefresh === codexStartupRefresh) deps.codexStartupRefresh = null;
565
+ });
566
+ deps.codexStartupRefresh = codexStartupRefresh;
567
+
568
+ const antigravityStartupRefresh = (async () => {
569
+ try {
570
+ const agyTarget = await deps.antigravity?.startupTarget?.();
571
+ let agyMigration = null;
572
+ if (agyTarget?.home) {
573
+ agyMigration = await deps.antigravity?.refreshManagedIntegration({ startupTarget: agyTarget });
574
+ } else if (agyTarget !== undefined && agyTarget !== null) {
575
+ logger?.info?.(`dsh-delegate: Antigravity integration check skipped (${agyTarget.reason})`);
576
+ }
577
+ if (agyMigration?.changed.includes('plugin')) {
578
+ logger?.info?.(`dsh-delegate: refreshed a managed Antigravity plugin bundle to ${pluginVersion}`);
579
+ }
580
+ if (agyMigration?.changed.includes('mcp')) {
581
+ logger?.info?.('dsh-delegate: upgraded a stale managed Antigravity MCP entry in place');
582
+ }
583
+ for (const refusal of agyMigration?.refused ?? []) {
584
+ logger?.warn?.(`dsh-delegate: Antigravity integration refresh was refused (${refusal.code})`);
585
+ }
586
+ } catch (error) {
587
+ logger?.warn?.(`dsh-delegate: Antigravity integration refresh check failed (${diagnostic(error?.message ?? error, 200)})`);
588
+ }
589
+ })().finally(() => {
590
+ if (deps.antigravityStartupRefresh === antigravityStartupRefresh) deps.antigravityStartupRefresh = null;
591
+ });
592
+ deps.antigravityStartupRefresh = antigravityStartupRefresh;
593
+
594
+ await Promise.all([codexStartupRefresh, antigravityStartupRefresh]);
573
595
  }
574
596
 
575
597
  /**