dsh-taskbridge 1.7.1 → 1.8.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/LICENSE +21 -21
  3. package/README.md +733 -877
  4. package/THIRD_PARTY_NOTICES.txt +23 -23
  5. package/antigravity/agents/dsh-taskbridge.md +32 -0
  6. package/antigravity/skills/dsh-taskbridge/SKILL.md +51 -0
  7. package/codex/dsh-taskbridge.toml +181 -631
  8. package/cordis.patch.yml +6 -6
  9. package/docs/INTRODUCTION.md +122 -295
  10. package/docs/INTRODUCTION.zh.md +134 -279
  11. package/docs/antigravity-integration.md +42 -0
  12. package/docs/auth-contract.md +138 -138
  13. package/docs/claude-code.md +6 -11
  14. package/docs/codex-integration.md +2 -2
  15. package/docs/contracts-stage-b.md +443 -443
  16. package/docs/conversation-placement.md +7 -6
  17. package/docs/plugin-market.md +30 -30
  18. package/docs/redaction-contract.md +170 -170
  19. package/docs/releases/1.7.0.zh.md +11 -11
  20. package/docs/releases/1.8.0.zh.md +16 -0
  21. package/docs/releases/1.8.1.zh.md +24 -0
  22. package/docs/runtime-compatibility.md +1 -1
  23. package/docs/taskbridge-upgrade.md +28 -28
  24. package/docs/taskdispatch-upgrade.md +25 -25
  25. package/docs/workspace-contract.md +538 -538
  26. package/docs/workspace-grouping.md +126 -126
  27. package/icon.svg +1 -1
  28. package/lib/client.d.ts +804 -699
  29. package/lib/client.js +7 -7
  30. package/locale/en.json +1 -1
  31. package/locale/zh.json +1 -1
  32. package/package.json +150 -144
  33. package/src/antigravity/installer.js +1068 -0
  34. package/src/antigravity/seam.js +142 -0
  35. package/src/auth/fence.js +361 -361
  36. package/src/auth/grants.js +789 -789
  37. package/src/client/api.js +266 -3
  38. package/src/client/index.jsx +224 -11
  39. package/src/client/sidebar.jsx +862 -862
  40. package/src/client/styles.js +624 -624
  41. package/src/client/task-cleanup.js +429 -304
  42. package/src/client/task-records-table.jsx +217 -217
  43. package/src/client/task-view.js +307 -307
  44. package/src/client/workspace-groups.js +482 -482
  45. package/src/client/workspaces-browser.jsx +770 -770
  46. package/src/codex/agent-ownership.js +270 -270
  47. package/src/codex/installer.js +6 -0
  48. package/src/codex/toml.js +784 -784
  49. package/src/config/defaults.js +11 -15
  50. package/src/config/redact.js +245 -245
  51. package/src/config/store.js +186 -186
  52. package/src/credentials/seam.js +202 -202
  53. package/src/http/respond.js +6 -5
  54. package/src/http/user-plane.js +83 -1
  55. package/src/index.js +25 -0
  56. package/src/jobs/diagnostics.js +15 -15
  57. package/src/jobs/engine.js +1 -0
  58. package/src/jobs/history.js +1 -1
  59. package/src/jobs/plan-store.js +1103 -1020
  60. package/src/jobs/record-cleanup.js +452 -7
  61. package/src/jobs/review-note.js +63 -63
  62. package/src/jobs/task-descriptions.js +82 -82
  63. package/src/jobs/task-display.js +73 -73
  64. package/src/jobs/task-tree.js +786 -786
  65. package/src/jobs/title.js +134 -134
  66. package/src/mcp/continuation.js +317 -317
  67. package/src/mcp/server.js +34 -27
  68. package/src/mcp/wait.js +34 -15
  69. package/src/model/connectivity.js +371 -371
  70. package/src/model/discovery.js +582 -582
  71. package/src/model/native-catalog.js +68 -68
  72. package/src/model/openai-adapter.js +671 -671
  73. package/src/model/probe.js +264 -264
  74. package/src/model/providers.js +756 -756
  75. package/src/model/routing.js +321 -321
  76. package/src/runtime/agent-runner.js +1 -0
  77. package/src/runtime/permissions.js +1619 -1619
  78. package/src/runtime/question-call.js +162 -162
  79. package/src/runtime/questions.js +909 -909
  80. package/src/runtime/session-placement.js +36 -1
  81. package/src/runtime/worker-prompt.js +61 -55
  82. package/src/workspace/audit.js +775 -775
  83. package/src/workspace/preflight.js +424 -424
  84. package/src/workspace/worktrees.js +833 -679
@@ -417,7 +417,13 @@ export async function placeSession(deps, request) {
417
417
  const execPath = request.path;
418
418
  const continueFromTaskId = continuationOf(request?.continueFromTaskId);
419
419
 
420
- const workspace = await ensureWorkspace(workspaces, execPath, continueFromTaskId === null ? request?.title : null, request?.taskId ?? deps.taskId ?? '');
420
+ // Only a newly created dedicated worktree Workspace is named after a single task's title.
421
+ // A shared-mode run executes directly inside the project's native source Workspace, which is
422
+ // shared across runs and manual conversations and must keep the project's own Workspace name.
423
+ const workspaceTitleForCreate = continueFromTaskId === null && request?.isolation !== 'shared'
424
+ ? request?.title
425
+ : null;
426
+ const workspace = await ensureWorkspace(workspaces, execPath, workspaceTitleForCreate, request?.taskId ?? deps.taskId ?? '');
421
427
  if (workspace.namingError) deps.logger?.warn?.(`TaskBridge workspace title: ${workspace.namingError}`);
422
428
 
423
429
  if (continueFromTaskId !== null) {
@@ -935,6 +941,35 @@ export class SessionStore {
935
941
  return await run;
936
942
  }
937
943
 
944
+ /**
945
+ * Forget the threads recorded for a batch of tasks in one atomic write.
946
+ * @param {Iterable<string>} taskIds - task ids to remove.
947
+ * @returns {Promise<object[]>} the removed records.
948
+ */
949
+ async forgetMany(taskIds) {
950
+ if (this.disposed) throw new Error('the session map has been disposed');
951
+ const keys = new Set();
952
+ for (const id of Array.isArray(taskIds) || taskIds instanceof Set ? taskIds : []) {
953
+ const key = typeof id === 'string' ? id.trim() : '';
954
+ if (key !== '') keys.add(key);
955
+ }
956
+ if (keys.size === 0) return [];
957
+ const run = this.enqueue(async () => {
958
+ const base = await this.ensureLoaded();
959
+ const removed = [];
960
+ const next = [];
961
+ for (const item of base) {
962
+ if (keys.has(item.taskId)) removed.push({ ...item });
963
+ else next.push(item);
964
+ }
965
+ if (removed.length === 0) return [];
966
+ await this.writeDocument(next);
967
+ this.records = next;
968
+ return removed;
969
+ });
970
+ return await run;
971
+ }
972
+
938
973
  /**
939
974
  * Wait for queued writes and stop accepting new ones.
940
975
  * @returns {Promise<void>} resolves when settled.
@@ -1,55 +1,61 @@
1
- /**
2
- * Build the delegation prompt for one task.
3
- * @param {object} input - `taskId`, `prompt`, `workspacePath`, `isolation`, `diff`, `baseline`.
4
- * @returns {string} assembled prompt.
5
- */
6
- export function buildWorkerPrompt(input) {
7
- const lines = [];
8
- lines.push('You are a delegated implementation worker. Your work will be reviewed by the host.');
9
- lines.push('');
10
- lines.push(`Task id: ${input.taskId}`);
11
- if (typeof input.workspacePath === 'string' && input.workspacePath !== '') {
12
- lines.push(`Workspace: ${input.workspacePath}`);
13
- }
14
- lines.push(`Isolation: ${input.isolation ?? 'shared'}`);
15
- lines.push('');
16
- lines.push('## Task');
17
- lines.push(String(input.prompt ?? '').trim());
18
- lines.push('');
19
- lines.push('## Working rules');
20
- lines.push('- Follow the assigned plan. Make routine choices within the packet. '
21
- + 'If a premise conflicts with the project, report what you verified and the affected step to the host before changing course.');
22
- lines.push('- You may modify files only inside the workspace above.');
23
- lines.push('- Do not commit, push, tag, or rewrite git history.');
24
- lines.push('- Do not read or print credentials, tokens, or .env contents.');
25
- lines.push('- Do not install packages from the network unless the task explicitly requires it.');
26
- lines.push('- Report what you changed and what you could not do. Do not claim checks you did not run.');
27
- lines.push('');
28
- lines.push('## Checks and extra permissions');
29
- lines.push('- Read ordinary files and logs with the normal file tools and the ordinary workspace permission. '
30
- + 'Do not ask for elevated access merely to read a log, and do not use a sandbox escape as a substitute for '
31
- + 'a file tool.');
32
- lines.push('- Run tests under the ordinary permission first. If a test fails for a CONCRETE environment reason '
33
- + '(a missing module, a denied pipe, an absent binary), keep that error text and report it rather than retrying '
34
- + 'the same command with more access.');
35
- lines.push('- Ask for extra permission only for the one complete, bounded command that genuinely needs it, and say '
36
- + 'which error it resolves. A permission granted for one call never covers a later call, and it never widens '
37
- + 'the sandbox permanently.');
38
- lines.push('- Run one combined test command, save its FULL stdout/stderr, its real exit code and a short summary '
39
- + '(for example into `.cache/`), and read that saved log afterwards with the file tools. Do not re-run a test '
40
- + 'merely to change a filter, a `Select-String` pattern or a `Select-Object -First N`: read the log instead.');
41
- lines.push('- A missing dependency is a fact to verify, not a reason to re-run the suite: check whether the module '
42
- + 'exists before concluding the test failed, and never use extra permission to paper over a module-not-found '
43
- + 'error.');
44
- lines.push('- Fix a failing test before running the suite again. Report the tests you actually ran, their exit '
45
- + 'codes and their counts; if the worktree cannot provide a dependency, say so plainly instead of retrying.');
46
- lines.push('');
47
- lines.push('## Completion');
48
- lines.push('When the task is complete, reply with a short summary, the files you changed, and any checks you actually ran with their results.');
49
- lines.push('You cannot approve your own work; the host decides acceptance.');
50
- if (input.baseline !== undefined && input.baseline !== null) {
51
- lines.push('');
52
- lines.push(`## Starting state: ${input.baseline.dirtyBaseline === true ? 'the workspace already had uncommitted changes' : 'the workspace was clean'}`);
53
- }
54
- return lines.join('\n');
55
- }
1
+ /**
2
+ * Build the delegation prompt for one task.
3
+ * @param {object} input - `taskId`, `prompt`, `workspacePath`, `isolation`, `diff`, `baseline`.
4
+ * @returns {string} assembled prompt.
5
+ */
6
+ export function buildWorkerPrompt(input) {
7
+ const lines = [];
8
+ lines.push('You are a delegated implementation worker. Your work will be reviewed by the host.');
9
+ lines.push('');
10
+ lines.push(`Task id: ${input.taskId}`);
11
+ if (typeof input.workspacePath === 'string' && input.workspacePath !== '') {
12
+ lines.push(`Workspace: ${input.workspacePath}`);
13
+ }
14
+ lines.push(`Isolation: ${input.isolation ?? 'shared'}`);
15
+ lines.push('');
16
+ lines.push('## Task');
17
+ lines.push(String(input.prompt ?? '').trim());
18
+ lines.push('');
19
+ lines.push('## Working rules');
20
+ lines.push('- Follow the assigned plan. Make routine choices within the packet. '
21
+ + 'If a premise conflicts with the project, report what you verified and the affected step to the host before changing course.');
22
+ lines.push('- You may modify files only inside the workspace above.');
23
+ if (input.isolation === 'shared' || input.baseline?.dirtyBaseline === true) {
24
+ lines.push('- Preserve existing uncommitted changes and unrelated files in this checkout.');
25
+ }
26
+ lines.push('- Do not commit, push, tag, or rewrite git history.');
27
+ lines.push('- Do not read or print credentials, tokens, or .env contents.');
28
+ lines.push('- Do not install packages or make external network requests (`Invoke-WebRequest`, `curl`, `wget`, etc.) unless the task explicitly requires it.');
29
+ lines.push('- Report what you changed and what you could not do. Do not claim checks you did not run.');
30
+ lines.push('');
31
+ lines.push('## Checks and extra permissions');
32
+ lines.push('- Always prefer native file/search/edit tools (read, grep, glob, edit, write) over shell commands (`pwsh`, `powershell`, `cmd`, `bash`, `Get-Content`, `Select-String`, `cat`, `ls`, `dir`) to inspect files, search code, or read logs. Reserve shell commands strictly for running tests, builds, typechecks, and git inspection.');
33
+ lines.push('- Read ordinary files and logs with the normal file tools and the ordinary workspace permission. '
34
+ + 'Do not ask for elevated access merely to read a log, and do not use a sandbox escape as a substitute for '
35
+ + 'a file tool.');
36
+ lines.push('- Run tests under the ordinary permission first. If a test fails for a CONCRETE environment reason '
37
+ + '(a missing module, a denied pipe, an absent binary), keep that error text and report it rather than retrying '
38
+ + 'the same command with more access.');
39
+ lines.push('- Ask for extra permission only for the one complete, bounded command that genuinely needs it, and say '
40
+ + 'which error it resolves. A permission granted for one call never covers a later call, and it never widens '
41
+ + 'the sandbox permanently.');
42
+ lines.push('- Run one combined test command, save its FULL stdout/stderr, its real exit code and a short summary '
43
+ + '(for example into `.cache/`), and read that saved log afterwards with the file tools. Do not re-run a test '
44
+ + 'merely to change a filter, a `Select-String` pattern or a `Select-Object -First N`: read the log instead.');
45
+ lines.push('- After reading temporary test logs you created (such as under `.cache/`), remove those untracked '
46
+ + 'temporary log files before finishing so the delivery diff contains only intended task changes.');
47
+ lines.push('- A missing dependency is a fact to verify, not a reason to re-run the suite: check whether the module '
48
+ + 'exists before concluding the test failed, and never use extra permission to paper over a module-not-found '
49
+ + 'error.');
50
+ lines.push('- Fix a failing test before running the suite again. Report the tests you actually ran, their exit '
51
+ + 'codes and their counts; if the worktree cannot provide a dependency, say so plainly instead of retrying.');
52
+ lines.push('');
53
+ lines.push('## Completion');
54
+ lines.push('When the task is complete, reply with a short summary, the files you changed, and any checks you actually ran with their results.');
55
+ lines.push('You cannot approve your own work; the host decides acceptance.');
56
+ if (input.baseline !== undefined && input.baseline !== null) {
57
+ lines.push('');
58
+ lines.push(`## Starting state: ${input.baseline.dirtyBaseline === true ? 'the workspace already had uncommitted changes' : 'the workspace was clean'}`);
59
+ }
60
+ return lines.join('\n');
61
+ }