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
@@ -1,82 +1,82 @@
1
- // Shared contract for `goalDescription` and `completionSummary`: <= 2000 Unicode code points
2
- // (Chinese, newlines and emoji count once), trimmed, non-strings refused, re-checked post-redaction.
3
-
4
- export const TASK_DESCRIPTION_MAX_CHARS = 2_000;
5
-
6
- export const TASK_DESCRIPTION_FIELDS = Object.freeze({
7
- goal: 'goalDescription',
8
- summary: 'completionSummary',
9
- });
10
-
11
- export function normalizeTaskDescription(value) {
12
- return typeof value === 'string' ? value.trim() : '';
13
- }
14
-
15
- export function taskDescriptionLength(value) {
16
- return typeof value === 'string' ? Array.from(value).length : 0;
17
- }
18
-
19
- /** Build refusal facts naming field, measured code-point length and limit (never echoing text). */
20
- export function taskDescriptionRefusal(field, value, reason) {
21
- const limit = TASK_DESCRIPTION_MAX_CHARS;
22
- const length = taskDescriptionLength(value);
23
- if (reason === 'type') {
24
- return {
25
- field,
26
- limit,
27
- length,
28
- unit: 'unicode-code-points',
29
- message: `${field} must be a string of at most ${limit} Unicode code points`,
30
- };
31
- }
32
- return {
33
- field,
34
- limit,
35
- length,
36
- unit: 'unicode-code-points',
37
- message: `${field} must be at most ${limit} Unicode code points, but it is ${length}`,
38
- };
39
- }
40
-
41
- export function taskDescriptionPresent(value) {
42
- if (value === undefined) return false;
43
- return typeof value === 'string' ? value.trim() !== '' : true;
44
- }
45
-
46
- export function readTaskDescription(value, field) {
47
- if (!taskDescriptionPresent(value)) return { ok: true, value: null, length: 0 };
48
- if (typeof value !== 'string') {
49
- return { ok: false, refusal: taskDescriptionRefusal(field, value, 'type') };
50
- }
51
- const text = value.trim();
52
- if (text === '') return { ok: true, value: null, length: 0 };
53
- const length = taskDescriptionLength(text);
54
- if (length > TASK_DESCRIPTION_MAX_CHARS) {
55
- return { ok: false, refusal: taskDescriptionRefusal(field, text, 'length') };
56
- }
57
- return { ok: true, value: text, length };
58
- }
59
-
60
- /** Canonicalize once: type, trim, inbound bound, redact, and post-redaction bound. */
61
- export function canonicalTaskDescription(value, field, redact) {
62
- const read = readTaskDescription(value, field);
63
- if (read.ok === false) return read;
64
- if (read.value === null) return read;
65
- const masked = typeof redact === 'function' ? redact(read.value) : read.value;
66
- const stored = typeof masked === 'string' ? masked.trim() : '';
67
- if (stored === '') return { ok: true, value: null, length: 0 };
68
- const length = taskDescriptionLength(stored);
69
- if (length > TASK_DESCRIPTION_MAX_CHARS) {
70
- return { ok: false, refusal: taskDescriptionRefusal(field, stored, 'length') };
71
- }
72
- return { ok: true, value: stored, length };
73
- }
74
-
75
- /** Load-only code-point truncation leaving room for a marker without splitting surrogate pairs. */
76
- export function truncateTaskDescription(value, markerChars = 0, limit = TASK_DESCRIPTION_MAX_CHARS) {
77
- if (typeof value !== 'string' || value === '') return null;
78
- const points = Array.from(value);
79
- if (points.length <= limit) return value;
80
- const keep = Math.max(0, limit - Math.max(0, Math.trunc(markerChars)));
81
- return points.slice(0, keep).join('');
82
- }
1
+ // Shared contract for `goalDescription` and `completionSummary`: <= 2000 Unicode code points
2
+ // (Chinese, newlines and emoji count once), trimmed, non-strings refused, re-checked post-redaction.
3
+
4
+ export const TASK_DESCRIPTION_MAX_CHARS = 2_000;
5
+
6
+ export const TASK_DESCRIPTION_FIELDS = Object.freeze({
7
+ goal: 'goalDescription',
8
+ summary: 'completionSummary',
9
+ });
10
+
11
+ export function normalizeTaskDescription(value) {
12
+ return typeof value === 'string' ? value.trim() : '';
13
+ }
14
+
15
+ export function taskDescriptionLength(value) {
16
+ return typeof value === 'string' ? Array.from(value).length : 0;
17
+ }
18
+
19
+ /** Build refusal facts naming field, measured code-point length and limit (never echoing text). */
20
+ export function taskDescriptionRefusal(field, value, reason) {
21
+ const limit = TASK_DESCRIPTION_MAX_CHARS;
22
+ const length = taskDescriptionLength(value);
23
+ if (reason === 'type') {
24
+ return {
25
+ field,
26
+ limit,
27
+ length,
28
+ unit: 'unicode-code-points',
29
+ message: `${field} must be a string of at most ${limit} Unicode code points`,
30
+ };
31
+ }
32
+ return {
33
+ field,
34
+ limit,
35
+ length,
36
+ unit: 'unicode-code-points',
37
+ message: `${field} must be at most ${limit} Unicode code points, but it is ${length}`,
38
+ };
39
+ }
40
+
41
+ export function taskDescriptionPresent(value) {
42
+ if (value === undefined) return false;
43
+ return typeof value === 'string' ? value.trim() !== '' : true;
44
+ }
45
+
46
+ export function readTaskDescription(value, field) {
47
+ if (!taskDescriptionPresent(value)) return { ok: true, value: null, length: 0 };
48
+ if (typeof value !== 'string') {
49
+ return { ok: false, refusal: taskDescriptionRefusal(field, value, 'type') };
50
+ }
51
+ const text = value.trim();
52
+ if (text === '') return { ok: true, value: null, length: 0 };
53
+ const length = taskDescriptionLength(text);
54
+ if (length > TASK_DESCRIPTION_MAX_CHARS) {
55
+ return { ok: false, refusal: taskDescriptionRefusal(field, text, 'length') };
56
+ }
57
+ return { ok: true, value: text, length };
58
+ }
59
+
60
+ /** Canonicalize once: type, trim, inbound bound, redact, and post-redaction bound. */
61
+ export function canonicalTaskDescription(value, field, redact) {
62
+ const read = readTaskDescription(value, field);
63
+ if (read.ok === false) return read;
64
+ if (read.value === null) return read;
65
+ const masked = typeof redact === 'function' ? redact(read.value) : read.value;
66
+ const stored = typeof masked === 'string' ? masked.trim() : '';
67
+ if (stored === '') return { ok: true, value: null, length: 0 };
68
+ const length = taskDescriptionLength(stored);
69
+ if (length > TASK_DESCRIPTION_MAX_CHARS) {
70
+ return { ok: false, refusal: taskDescriptionRefusal(field, stored, 'length') };
71
+ }
72
+ return { ok: true, value: stored, length };
73
+ }
74
+
75
+ /** Load-only code-point truncation leaving room for a marker without splitting surrogate pairs. */
76
+ export function truncateTaskDescription(value, markerChars = 0, limit = TASK_DESCRIPTION_MAX_CHARS) {
77
+ if (typeof value !== 'string' || value === '') return null;
78
+ const points = Array.from(value);
79
+ if (points.length <= limit) return value;
80
+ const keep = Math.max(0, limit - Math.max(0, Math.trunc(markerChars)));
81
+ return points.slice(0, keep).join('');
82
+ }
@@ -1,73 +1,73 @@
1
- import { createHash } from 'node:crypto';
2
- import { JsonDocument } from '../config/store.js';
3
-
4
- const MAX_ARCHIVES = 2048;
5
- const ARCHIVABLE = 'accepted';
6
-
7
- function chainsOf(node) {
8
- return node.kind === 'plan' ? node.executions : [node.chain];
9
- }
10
-
11
- // Hash only the facts that made this subtree eligible. A continuation, a changed
12
- // review or a missing history entry brings the subtree back into the active view.
13
- function activityStamp(node) {
14
- const evidence = [node.nodeId, node.nodeStatus, node.hostAcceptance?.acceptedAt ?? null];
15
- for (const chain of chainsOf(node)) {
16
- evidence.push(chain.rounds.map((round) => [round.taskId, round.state, round.hostAcceptance?.acceptedAt ?? null]));
17
- }
18
- evidence.push(node.children.map(activityStamp));
19
- return createHash('sha256').update(JSON.stringify(evidence)).digest('hex');
20
- }
21
-
22
- export function findDisplayNode(roots, nodeId) {
23
- const remaining = [...roots];
24
- while (remaining.length > 0) {
25
- const node = remaining.pop();
26
- if (node.nodeId === nodeId) return node;
27
- remaining.push(...node.children);
28
- }
29
- return null;
30
- }
31
-
32
- export class TaskDisplayStore extends JsonDocument {
33
- constructor(dataDir) {
34
- super(dataDir, 'task-display.json', {
35
- schemaVersion: 1,
36
- initial: () => ({ schemaVersion: 1, archives: {} }),
37
- });
38
- }
39
-
40
- async project(tree) {
41
- const { archives } = await this.load();
42
- if (!archives || typeof archives !== 'object' || Array.isArray(archives)) throw new Error('invalid display archive');
43
- const hidden = new Set();
44
- const visit = (node) => {
45
- node.displayArchived = node.nodeStatus === ARCHIVABLE
46
- && Object.hasOwn(archives, node.nodeId)
47
- && archives[node.nodeId] === activityStamp(node);
48
- if (node.displayArchived) hidden.add(node.nodeId);
49
- for (const child of node.children) visit(child);
50
- };
51
- for (const root of tree.roots) visit(root);
52
- for (const node of tree.flatNodes) node.displayArchived = hidden.has(node.nodeId);
53
- }
54
-
55
- async setArchived(node, archived, knownIds) {
56
- if (archived && node.nodeStatus !== ARCHIVABLE) return { conflict: 'TASK_DISPLAY_NOT_ACCEPTED' };
57
- let limitReached = false;
58
- await this.commit((draft) => {
59
- if (!draft.archives || typeof draft.archives !== 'object' || Array.isArray(draft.archives)) throw new Error('invalid display archive');
60
- for (const id of Object.keys(draft.archives)) {
61
- if (!knownIds.has(id)) delete draft.archives[id];
62
- }
63
- if (!archived) {
64
- delete draft.archives[node.nodeId];
65
- } else if (Object.hasOwn(draft.archives, node.nodeId) || Object.keys(draft.archives).length < MAX_ARCHIVES) {
66
- Object.defineProperty(draft.archives, node.nodeId, { value: activityStamp(node), enumerable: true, configurable: true, writable: true });
67
- } else {
68
- limitReached = true;
69
- }
70
- });
71
- return limitReached ? { conflict: 'TASK_DISPLAY_LIMIT' } : { archived };
72
- }
73
- }
1
+ import { createHash } from 'node:crypto';
2
+ import { JsonDocument } from '../config/store.js';
3
+
4
+ const MAX_ARCHIVES = 2048;
5
+ const ARCHIVABLE = 'accepted';
6
+
7
+ function chainsOf(node) {
8
+ return node.kind === 'plan' ? node.executions : [node.chain];
9
+ }
10
+
11
+ // Hash only the facts that made this subtree eligible. A continuation, a changed
12
+ // review or a missing history entry brings the subtree back into the active view.
13
+ function activityStamp(node) {
14
+ const evidence = [node.nodeId, node.nodeStatus, node.hostAcceptance?.acceptedAt ?? null];
15
+ for (const chain of chainsOf(node)) {
16
+ evidence.push(chain.rounds.map((round) => [round.taskId, round.state, round.hostAcceptance?.acceptedAt ?? null]));
17
+ }
18
+ evidence.push(node.children.map(activityStamp));
19
+ return createHash('sha256').update(JSON.stringify(evidence)).digest('hex');
20
+ }
21
+
22
+ export function findDisplayNode(roots, nodeId) {
23
+ const remaining = [...roots];
24
+ while (remaining.length > 0) {
25
+ const node = remaining.pop();
26
+ if (node.nodeId === nodeId) return node;
27
+ remaining.push(...node.children);
28
+ }
29
+ return null;
30
+ }
31
+
32
+ export class TaskDisplayStore extends JsonDocument {
33
+ constructor(dataDir) {
34
+ super(dataDir, 'task-display.json', {
35
+ schemaVersion: 1,
36
+ initial: () => ({ schemaVersion: 1, archives: {} }),
37
+ });
38
+ }
39
+
40
+ async project(tree) {
41
+ const { archives } = await this.load();
42
+ if (!archives || typeof archives !== 'object' || Array.isArray(archives)) throw new Error('invalid display archive');
43
+ const hidden = new Set();
44
+ const visit = (node) => {
45
+ node.displayArchived = node.nodeStatus === ARCHIVABLE
46
+ && Object.hasOwn(archives, node.nodeId)
47
+ && archives[node.nodeId] === activityStamp(node);
48
+ if (node.displayArchived) hidden.add(node.nodeId);
49
+ for (const child of node.children) visit(child);
50
+ };
51
+ for (const root of tree.roots) visit(root);
52
+ for (const node of tree.flatNodes) node.displayArchived = hidden.has(node.nodeId);
53
+ }
54
+
55
+ async setArchived(node, archived, knownIds) {
56
+ if (archived && node.nodeStatus !== ARCHIVABLE) return { conflict: 'TASK_DISPLAY_NOT_ACCEPTED' };
57
+ let limitReached = false;
58
+ await this.commit((draft) => {
59
+ if (!draft.archives || typeof draft.archives !== 'object' || Array.isArray(draft.archives)) throw new Error('invalid display archive');
60
+ for (const id of Object.keys(draft.archives)) {
61
+ if (!knownIds.has(id)) delete draft.archives[id];
62
+ }
63
+ if (!archived) {
64
+ delete draft.archives[node.nodeId];
65
+ } else if (Object.hasOwn(draft.archives, node.nodeId) || Object.keys(draft.archives).length < MAX_ARCHIVES) {
66
+ Object.defineProperty(draft.archives, node.nodeId, { value: activityStamp(node), enumerable: true, configurable: true, writable: true });
67
+ } else {
68
+ limitReached = true;
69
+ }
70
+ });
71
+ return limitReached ? { conflict: 'TASK_DISPLAY_LIMIT' } : { archived };
72
+ }
73
+ }