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,202 +1,202 @@
1
- // Credential seam gateway.
2
- //
3
- // The plugin never stores a secret and never reads one back into a projection.
4
- // It talks to the native DSH credential seam (`ctx.credentials`) for exactly four
5
- // operations and nothing else:
6
- //
7
- // * `describe(ref)` — presence/source/writability, safe for a settings UI;
8
- // * `resolve(ref)` — the value, for the native adapter inside a stream call;
9
- // * `set(ref, value)` — write one value the operator pasted;
10
- // * `unset(ref)` — remove it.
11
- //
12
- // The seam is reached through a *lazy* accessor rather than a captured reference.
13
- // Two reasons, both about load order:
14
- //
15
- // 1. this plugin deliberately does not inject the credential service, so it
16
- // loads and reports state in a harness that has none (the UI then says
17
- // "host provides no credential interface" instead of the plugin refusing to
18
- // start); and
19
- // 2. the seam documents a per-operation resolve so a rotated credential reaches
20
- // the next operation without a restart — capturing the service object once
21
- // would still be fine, but capturing the *value* would not, and the lazy
22
- // read makes that mistake impossible to write here.
23
- //
24
- // A failed seam call is reported with its own code and a bounded `cause` code.
25
- // The provider's message is never forwarded: a credential backend is free to echo
26
- // what it was given, and this is the one place in the plugin where that would be
27
- // a disclosure.
28
-
29
- /** Stable refusal codes for every credential operation. */
30
- export const CREDENTIAL_CODES = Object.freeze({
31
- seamUnavailable: 'CREDENTIAL_SEAM_UNAVAILABLE',
32
- operationFailed: 'CREDENTIAL_OPERATION_FAILED',
33
- readOnly: 'CREDENTIAL_READ_ONLY',
34
- valueRequired: 'CREDENTIAL_VALUE_REQUIRED',
35
- valueTooLarge: 'CREDENTIAL_VALUE_TOO_LARGE',
36
- refInvalid: 'CREDENTIAL_REF_INVALID',
37
- });
38
-
39
- /** Bound on a pasted secret. A provider key is far shorter than this. */
40
- export const MAX_CREDENTIAL_VALUE_CHARS = 8192;
41
-
42
- /** A credential refusal with a stable machine code. */
43
- export class CredentialSeamError extends Error {
44
- /**
45
- * @param {string} code - stable machine code.
46
- * @param {string} message - human-readable explanation.
47
- * @param {object} [details] - bounded, non-secret details.
48
- */
49
- constructor(code, message, details = {}) {
50
- super(message);
51
- this.name = 'CredentialSeamError';
52
- this.code = code;
53
- this.details = details;
54
- }
55
- }
56
-
57
- /** Methods the seam must expose for this plugin to act at all. */
58
- const REQUIRED_METHODS = Object.freeze({
59
- resolve: 'resolve',
60
- describe: 'describe',
61
- set: 'set',
62
- unset: 'unset',
63
- });
64
-
65
- /**
66
- * Create the credential gateway over one native service accessor.
67
- * @param {() => unknown} getService - returns the current `ctx.credentials`, or a
68
- * nullish value while the service is absent.
69
- * @returns {{ available: () => boolean, describe: Function, resolve: Function, set: Function, unset: Function }} gateway.
70
- */
71
- export function createCredentialGateway(getService) {
72
- if (typeof getService !== 'function') {
73
- throw new TypeError('createCredentialGateway needs a service accessor');
74
- }
75
-
76
- /**
77
- * Read the seam, refusing rather than returning null so a caller can never
78
- * mistake "no service" for "no credential".
79
- * @param {string} operation - seam method being attempted, for the refusal.
80
- * @returns {object} the native service.
81
- */
82
- function requireSeam(operation) {
83
- let service;
84
- try {
85
- service = getService();
86
- } catch (error) {
87
- // A host whose accessor throws is a refusal, not a crash inside a route.
88
- throw new CredentialSeamError(CREDENTIAL_CODES.seamUnavailable,
89
- 'the DSH credential service could not be read in this harness',
90
- { operation, cause: typeof error?.code === 'string' ? error.code : null });
91
- }
92
- if (service === null || typeof service !== 'object') {
93
- throw new CredentialSeamError(CREDENTIAL_CODES.seamUnavailable,
94
- 'this harness exposes no credential service; a pasted secret cannot be stored',
95
- { operation });
96
- }
97
- const method = REQUIRED_METHODS[operation];
98
- if (typeof service[method] !== 'function') {
99
- throw new CredentialSeamError(CREDENTIAL_CODES.seamUnavailable,
100
- `the credential service does not implement ${method}()`,
101
- { operation });
102
- }
103
- return service;
104
- }
105
-
106
- /**
107
- * Run one seam call, translating a provider failure into a bounded refusal.
108
- * @param {string} operation - seam method name.
109
- * @param {string} ref - credential reference, echoed as a name only.
110
- * @param {(service: object) => Promise<unknown>} work - the call.
111
- * @returns {Promise<unknown>} the seam result.
112
- */
113
- async function attempt(operation, ref, work) {
114
- const service = requireSeam(operation);
115
- try {
116
- return await work(service);
117
- } catch (error) {
118
- if (error instanceof CredentialSeamError) throw error;
119
- // Only the code survives: the message may quote the value or a path.
120
- throw new CredentialSeamError(CREDENTIAL_CODES.operationFailed,
121
- `the credential service refused ${operation}() for ${ref}`,
122
- { operation, reference: ref, cause: typeof error?.code === 'string' ? error.code : null });
123
- }
124
- }
125
-
126
- return {
127
- /**
128
- * Whether the seam is present at all, for status reporting.
129
- * @returns {boolean} true when `resolve` is callable.
130
- */
131
- available() {
132
- try {
133
- requireSeam('resolve');
134
- return true;
135
- } catch {
136
- return false;
137
- }
138
- },
139
-
140
- /**
141
- * Presence/source/writability for one reference. The returned view has no
142
- * slot a value could ride in, and this function does not add one.
143
- * @param {string} ref - credential reference name.
144
- * @returns {Promise<{ configured: boolean, source?: string, writable: boolean }>} seam view.
145
- */
146
- async describe(ref) {
147
- const info = await attempt('describe', ref, (service) => service.describe(ref));
148
- if (info === null || typeof info !== 'object') {
149
- throw new CredentialSeamError(CREDENTIAL_CODES.operationFailed,
150
- `the credential service returned no usable description for ${ref}`,
151
- { operation: 'describe', reference: ref });
152
- }
153
- return {
154
- configured: info.configured === true,
155
- ...(typeof info.source === 'string' && info.source !== '' ? { source: info.source } : {}),
156
- writable: info.writable === true,
157
- };
158
- },
159
-
160
- /**
161
- * Resolve one reference to its current value. Called only by the native
162
- * adapter inside a stream operation; the value is returned to pi-ai and to
163
- * nothing else.
164
- * @param {string} ref - credential reference name.
165
- * @returns {Promise<{ value: string, source: string } | undefined>} value, or undefined.
166
- */
167
- async resolve(ref) {
168
- return await attempt('resolve', ref, (service) => service.resolve(ref));
169
- },
170
-
171
- /**
172
- * Store one pasted value. Refuses an empty value (that is `unset`) and a
173
- * value no provider key could be.
174
- * @param {string} ref - credential reference name.
175
- * @param {string} value - the literal secret.
176
- * @returns {Promise<void>} resolves after the seam committed the write.
177
- */
178
- async set(ref, value) {
179
- if (typeof value !== 'string' || value.trim() === '') {
180
- throw new CredentialSeamError(CREDENTIAL_CODES.valueRequired,
181
- 'a credential value is required; use clear to remove one', { reference: ref });
182
- }
183
- if (value.length > MAX_CREDENTIAL_VALUE_CHARS) {
184
- throw new CredentialSeamError(CREDENTIAL_CODES.valueTooLarge,
185
- 'the credential value exceeds the accepted bound',
186
- { reference: ref, limit: MAX_CREDENTIAL_VALUE_CHARS });
187
- }
188
- // The literal is not trimmed: a trailing space would be a different secret,
189
- // and silently altering what the operator pasted would be a hidden failure.
190
- await attempt('set', ref, (service) => service.set(ref, value));
191
- },
192
-
193
- /**
194
- * Remove one stored value. Removing an absent value is a no-op in the seam.
195
- * @param {string} ref - credential reference name.
196
- * @returns {Promise<void>} resolves after the seam committed the removal.
197
- */
198
- async unset(ref) {
199
- await attempt('unset', ref, (service) => service.unset(ref));
200
- },
201
- };
202
- }
1
+ // Credential seam gateway.
2
+ //
3
+ // The plugin never stores a secret and never reads one back into a projection.
4
+ // It talks to the native DSH credential seam (`ctx.credentials`) for exactly four
5
+ // operations and nothing else:
6
+ //
7
+ // * `describe(ref)` — presence/source/writability, safe for a settings UI;
8
+ // * `resolve(ref)` — the value, for the native adapter inside a stream call;
9
+ // * `set(ref, value)` — write one value the operator pasted;
10
+ // * `unset(ref)` — remove it.
11
+ //
12
+ // The seam is reached through a *lazy* accessor rather than a captured reference.
13
+ // Two reasons, both about load order:
14
+ //
15
+ // 1. this plugin deliberately does not inject the credential service, so it
16
+ // loads and reports state in a harness that has none (the UI then says
17
+ // "host provides no credential interface" instead of the plugin refusing to
18
+ // start); and
19
+ // 2. the seam documents a per-operation resolve so a rotated credential reaches
20
+ // the next operation without a restart — capturing the service object once
21
+ // would still be fine, but capturing the *value* would not, and the lazy
22
+ // read makes that mistake impossible to write here.
23
+ //
24
+ // A failed seam call is reported with its own code and a bounded `cause` code.
25
+ // The provider's message is never forwarded: a credential backend is free to echo
26
+ // what it was given, and this is the one place in the plugin where that would be
27
+ // a disclosure.
28
+
29
+ /** Stable refusal codes for every credential operation. */
30
+ export const CREDENTIAL_CODES = Object.freeze({
31
+ seamUnavailable: 'CREDENTIAL_SEAM_UNAVAILABLE',
32
+ operationFailed: 'CREDENTIAL_OPERATION_FAILED',
33
+ readOnly: 'CREDENTIAL_READ_ONLY',
34
+ valueRequired: 'CREDENTIAL_VALUE_REQUIRED',
35
+ valueTooLarge: 'CREDENTIAL_VALUE_TOO_LARGE',
36
+ refInvalid: 'CREDENTIAL_REF_INVALID',
37
+ });
38
+
39
+ /** Bound on a pasted secret. A provider key is far shorter than this. */
40
+ export const MAX_CREDENTIAL_VALUE_CHARS = 8192;
41
+
42
+ /** A credential refusal with a stable machine code. */
43
+ export class CredentialSeamError extends Error {
44
+ /**
45
+ * @param {string} code - stable machine code.
46
+ * @param {string} message - human-readable explanation.
47
+ * @param {object} [details] - bounded, non-secret details.
48
+ */
49
+ constructor(code, message, details = {}) {
50
+ super(message);
51
+ this.name = 'CredentialSeamError';
52
+ this.code = code;
53
+ this.details = details;
54
+ }
55
+ }
56
+
57
+ /** Methods the seam must expose for this plugin to act at all. */
58
+ const REQUIRED_METHODS = Object.freeze({
59
+ resolve: 'resolve',
60
+ describe: 'describe',
61
+ set: 'set',
62
+ unset: 'unset',
63
+ });
64
+
65
+ /**
66
+ * Create the credential gateway over one native service accessor.
67
+ * @param {() => unknown} getService - returns the current `ctx.credentials`, or a
68
+ * nullish value while the service is absent.
69
+ * @returns {{ available: () => boolean, describe: Function, resolve: Function, set: Function, unset: Function }} gateway.
70
+ */
71
+ export function createCredentialGateway(getService) {
72
+ if (typeof getService !== 'function') {
73
+ throw new TypeError('createCredentialGateway needs a service accessor');
74
+ }
75
+
76
+ /**
77
+ * Read the seam, refusing rather than returning null so a caller can never
78
+ * mistake "no service" for "no credential".
79
+ * @param {string} operation - seam method being attempted, for the refusal.
80
+ * @returns {object} the native service.
81
+ */
82
+ function requireSeam(operation) {
83
+ let service;
84
+ try {
85
+ service = getService();
86
+ } catch (error) {
87
+ // A host whose accessor throws is a refusal, not a crash inside a route.
88
+ throw new CredentialSeamError(CREDENTIAL_CODES.seamUnavailable,
89
+ 'the DSH credential service could not be read in this harness',
90
+ { operation, cause: typeof error?.code === 'string' ? error.code : null });
91
+ }
92
+ if (service === null || typeof service !== 'object') {
93
+ throw new CredentialSeamError(CREDENTIAL_CODES.seamUnavailable,
94
+ 'this harness exposes no credential service; a pasted secret cannot be stored',
95
+ { operation });
96
+ }
97
+ const method = REQUIRED_METHODS[operation];
98
+ if (typeof service[method] !== 'function') {
99
+ throw new CredentialSeamError(CREDENTIAL_CODES.seamUnavailable,
100
+ `the credential service does not implement ${method}()`,
101
+ { operation });
102
+ }
103
+ return service;
104
+ }
105
+
106
+ /**
107
+ * Run one seam call, translating a provider failure into a bounded refusal.
108
+ * @param {string} operation - seam method name.
109
+ * @param {string} ref - credential reference, echoed as a name only.
110
+ * @param {(service: object) => Promise<unknown>} work - the call.
111
+ * @returns {Promise<unknown>} the seam result.
112
+ */
113
+ async function attempt(operation, ref, work) {
114
+ const service = requireSeam(operation);
115
+ try {
116
+ return await work(service);
117
+ } catch (error) {
118
+ if (error instanceof CredentialSeamError) throw error;
119
+ // Only the code survives: the message may quote the value or a path.
120
+ throw new CredentialSeamError(CREDENTIAL_CODES.operationFailed,
121
+ `the credential service refused ${operation}() for ${ref}`,
122
+ { operation, reference: ref, cause: typeof error?.code === 'string' ? error.code : null });
123
+ }
124
+ }
125
+
126
+ return {
127
+ /**
128
+ * Whether the seam is present at all, for status reporting.
129
+ * @returns {boolean} true when `resolve` is callable.
130
+ */
131
+ available() {
132
+ try {
133
+ requireSeam('resolve');
134
+ return true;
135
+ } catch {
136
+ return false;
137
+ }
138
+ },
139
+
140
+ /**
141
+ * Presence/source/writability for one reference. The returned view has no
142
+ * slot a value could ride in, and this function does not add one.
143
+ * @param {string} ref - credential reference name.
144
+ * @returns {Promise<{ configured: boolean, source?: string, writable: boolean }>} seam view.
145
+ */
146
+ async describe(ref) {
147
+ const info = await attempt('describe', ref, (service) => service.describe(ref));
148
+ if (info === null || typeof info !== 'object') {
149
+ throw new CredentialSeamError(CREDENTIAL_CODES.operationFailed,
150
+ `the credential service returned no usable description for ${ref}`,
151
+ { operation: 'describe', reference: ref });
152
+ }
153
+ return {
154
+ configured: info.configured === true,
155
+ ...(typeof info.source === 'string' && info.source !== '' ? { source: info.source } : {}),
156
+ writable: info.writable === true,
157
+ };
158
+ },
159
+
160
+ /**
161
+ * Resolve one reference to its current value. Called only by the native
162
+ * adapter inside a stream operation; the value is returned to pi-ai and to
163
+ * nothing else.
164
+ * @param {string} ref - credential reference name.
165
+ * @returns {Promise<{ value: string, source: string } | undefined>} value, or undefined.
166
+ */
167
+ async resolve(ref) {
168
+ return await attempt('resolve', ref, (service) => service.resolve(ref));
169
+ },
170
+
171
+ /**
172
+ * Store one pasted value. Refuses an empty value (that is `unset`) and a
173
+ * value no provider key could be.
174
+ * @param {string} ref - credential reference name.
175
+ * @param {string} value - the literal secret.
176
+ * @returns {Promise<void>} resolves after the seam committed the write.
177
+ */
178
+ async set(ref, value) {
179
+ if (typeof value !== 'string' || value.trim() === '') {
180
+ throw new CredentialSeamError(CREDENTIAL_CODES.valueRequired,
181
+ 'a credential value is required; use clear to remove one', { reference: ref });
182
+ }
183
+ if (value.length > MAX_CREDENTIAL_VALUE_CHARS) {
184
+ throw new CredentialSeamError(CREDENTIAL_CODES.valueTooLarge,
185
+ 'the credential value exceeds the accepted bound',
186
+ { reference: ref, limit: MAX_CREDENTIAL_VALUE_CHARS });
187
+ }
188
+ // The literal is not trimmed: a trailing space would be a different secret,
189
+ // and silently altering what the operator pasted would be a hidden failure.
190
+ await attempt('set', ref, (service) => service.set(ref, value));
191
+ },
192
+
193
+ /**
194
+ * Remove one stored value. Removing an absent value is a no-op in the seam.
195
+ * @param {string} ref - credential reference name.
196
+ * @returns {Promise<void>} resolves after the seam committed the removal.
197
+ */
198
+ async unset(ref) {
199
+ await attempt('unset', ref, (service) => service.unset(ref));
200
+ },
201
+ };
202
+ }
@@ -190,11 +190,12 @@ function statusForCode(code) {
190
190
  if (code === 'CREDENTIAL_OPERATION_FAILED' || code === 'CREDENTIAL_READ_ONLY') return 502;
191
191
  if (code === 'CREDENTIAL_VALUE_REQUIRED' || code === 'CREDENTIAL_VALUE_TOO_LARGE' || code === 'CREDENTIAL_REF_INVALID') return 400;
192
192
  if (code.startsWith('CREDENTIAL_')) return 409;
193
- // Codex integration: the operator's own Codex home/config is the subject, so a
194
- // refusal to touch it is a state conflict, and a malformed request a 400.
195
- if (code === 'CODEX_INTEGRATION_UNAVAILABLE') return 503;
196
- if (code === 'CODEX_HOME_INVALID' || code === 'CODEX_ACTION_INVALID') return 400;
197
- if (code.startsWith('CODEX_') || code.startsWith('MCP_') || code.startsWith('AGENT_')) return 409;
193
+ // Codex & Antigravity integrations: the operator's own home/config is the subject,
194
+ // so a refusal to touch it is a state conflict, and a malformed request a 400.
195
+ if (code === 'CODEX_INTEGRATION_UNAVAILABLE' || code === 'ANTIGRAVITY_INTEGRATION_UNAVAILABLE') return 503;
196
+ if (code === 'CODEX_HOME_INVALID' || code === 'CODEX_ACTION_INVALID'
197
+ || code === 'ANTIGRAVITY_HOME_INVALID' || code === 'ANTIGRAVITY_ACTION_INVALID') return 400;
198
+ if (code.startsWith('CODEX_') || code.startsWith('ANTIGRAVITY_') || code.startsWith('MCP_') || code.startsWith('AGENT_')) return 409;
198
199
  if (code === 'BODY_TOO_LARGE') return 413;
199
200
  if (code === 'BODY_INVALID_JSON' || code === 'BODY_NOT_OBJECT') return 400;
200
201
  return 400;
@@ -36,12 +36,13 @@ import { discoverProviderModels } from '../model/discovery.js';
36
36
  import { checkProviderConnectivity } from '../model/connectivity.js';
37
37
  import { MAX_CREDENTIAL_VALUE_CHARS } from '../credentials/seam.js';
38
38
  import { CODEX_ACTIONS, publicCodexStatus, runCodexAction } from '../codex/installer.js';
39
+ import { ANTIGRAVITY_ACTIONS, publicAntigravityStatus } from '../antigravity/installer.js';
39
40
  import { classifyError, HttpError, jsonResponse, readJsonRequest } from '../http/respond.js';
40
41
  import { sameRecordedDirectory } from '../jobs/continuation-identity.js';
41
42
  import { buildTaskTree } from '../jobs/task-tree.js';
42
43
  import { findDisplayNode } from '../jobs/task-display.js';
43
44
  import { MAX_PLAN_BATCH, PLAN_CODES } from '../jobs/plan-store.js';
44
- import { cleanupOverview, runCleanup } from '../jobs/record-cleanup.js';
45
+ import { cleanupOverview, runCleanup, runOrphanCleanup } from '../jobs/record-cleanup.js';
45
46
 
46
47
  /**
47
48
  * Route prefix, already below `/api` because the native exact-route registry
@@ -593,6 +594,16 @@ export function userPlaneRoutes(deps) {
593
594
  return jsonResponse(200, { ok: true, ...outcome });
594
595
  },
595
596
  },
597
+ {
598
+ path: `${USER_PLANE_PREFIX}/tasks/cleanup-orphans`,
599
+ methods: ['POST'],
600
+ requestBody: BODY_MODE,
601
+ fetch: async (request) => {
602
+ const body = await readJsonRequest(request);
603
+ const outcome = await runOrphanCleanup(deps, body);
604
+ return jsonResponse(200, { ok: true, ...outcome });
605
+ },
606
+ },
596
607
  {
597
608
  path: `${USER_PLANE_PREFIX}/tasks/cancel`,
598
609
  methods: ['POST'],
@@ -817,6 +828,41 @@ export function userPlaneRoutes(deps) {
817
828
  },
818
829
  },
819
830
 
831
+ // ---- Antigravity integration -------------------------------------------
832
+ // Same authenticated operator plane contract as `/codex`:
833
+ // GET /antigravity — read-only diagnosis (never writes);
834
+ // POST /antigravity — explicit `install`, `repair` or `remove`.
835
+ {
836
+ path: `${USER_PLANE_PREFIX}/antigravity`,
837
+ methods: ['GET', 'POST'],
838
+ requestBody: BODY_MODE,
839
+ fetch: async (request) => {
840
+ const method = String(request.method ?? 'GET').toUpperCase();
841
+ if (method === 'GET') {
842
+ const outcome = await runAntigravityIntegration(deps, 'status');
843
+ return jsonResponse(200, { ok: true, ...outcome });
844
+ }
845
+ if (method !== 'POST') return methodRefusal(request, ['GET', 'POST']);
846
+ const body = await readJsonRequest(request);
847
+ const action = typeof body.action === 'string' ? body.action.trim() : '';
848
+ if (!ANTIGRAVITY_ACTIONS.includes(action) || action === 'status') {
849
+ throw new HttpError(
850
+ 400,
851
+ 'ANTIGRAVITY_ACTION_INVALID',
852
+ `action must be one of ${ANTIGRAVITY_ACTIONS.filter((entry) => entry !== 'status').join(', ')}`,
853
+ { allowed: ANTIGRAVITY_ACTIONS.filter((entry) => entry !== 'status') },
854
+ );
855
+ }
856
+ const outcome = await runAntigravityIntegration(deps, action);
857
+ deps.logger?.info?.('dsh-delegate: Antigravity integration action applied', {
858
+ action,
859
+ changed: outcome.changed,
860
+ refused: outcome.refused.map((entry) => entry.code),
861
+ });
862
+ return jsonResponse(200, { ok: true, ...outcome });
863
+ },
864
+ },
865
+
820
866
  // ---- layered connectivity ---------------------------------------------
821
867
  // One provider per request. The report is the four-layer structure documented
822
868
  // in `docs/native-integration-audit.md`; a layer that was not attempted is
@@ -909,6 +955,42 @@ async function runCodexIntegration(deps, action) {
909
955
  };
910
956
  }
911
957
 
958
+ async function runAntigravityIntegration(deps, action) {
959
+ const seam = deps.antigravity;
960
+ if (seam === null || seam === undefined || typeof seam.run !== 'function' || typeof seam.status !== 'function') {
961
+ throw new HttpError(
962
+ 503,
963
+ 'ANTIGRAVITY_INTEGRATION_UNAVAILABLE',
964
+ 'this host does not expose the Antigravity integration, so nothing can be installed or reported',
965
+ );
966
+ }
967
+ let outcome;
968
+ try {
969
+ outcome = action === 'status' ? await seam.status() : await seam.run(action);
970
+ } catch (error) {
971
+ const code = typeof error?.code === 'string' ? error.code : 'ANTIGRAVITY_INTEGRATION_FAILED';
972
+ throw new HttpError(
973
+ code === 'ANTIGRAVITY_HOME_INVALID' ? 400 : code === 'ANTIGRAVITY_PATH_CONFLICT' ? 409 : 500,
974
+ code,
975
+ typeof error?.message === 'string' ? error.message : 'the Antigravity integration action failed',
976
+ error?.details !== undefined && error.details !== null ? error.details : {},
977
+ );
978
+ }
979
+ const switchPosture = typeof deps.engine?.posture === 'function' ? deps.engine.posture() : null;
980
+ return {
981
+ action,
982
+ changed: Array.isArray(outcome?.changed) ? outcome.changed : [],
983
+ refused: Array.isArray(outcome?.refused) ? outcome.refused : [],
984
+ antigravity: redactDeep(publicAntigravityStatus(outcome?.status ?? {})),
985
+ switch: {
986
+ authorized: switchPosture?.authorized === true,
987
+ mode: switchPosture?.mode ?? 'switch',
988
+ reason: switchPosture?.reason ?? null,
989
+ changedByThisAction: false,
990
+ },
991
+ };
992
+ }
993
+
912
994
  // ---- task-record projection (live engine + durable archive) ----------------
913
995
 
914
996
  /**
package/src/index.js CHANGED
@@ -58,6 +58,7 @@ import { diagnostic } from './runtime/agent-runner.js';
58
58
  import { ensureWorkspace, SessionStore, liveControllerAccessor } from './runtime/session-placement.js';
59
59
  import { publishRuntimeEndpoint, resolveDefaultEndpointDiscoveryPath } from './runtime/endpoint-discovery.js';
60
60
  import { resolveCodexActionSeam } from './codex/seam.js';
61
+ import { resolveAntigravityActionSeam } from './antigravity/seam.js';
61
62
  import { configureDelegatedSession, policyServicesOf } from './runtime/sandbox.js';
62
63
  import { PermissionBridge, PERMISSION_DEFAULT_TIMEOUT_MS } from './runtime/permissions.js';
63
64
  import { QuestionBridge } from './runtime/questions.js';
@@ -267,6 +268,9 @@ export async function apply(ctx, config = {}) {
267
268
  // always has a place to keep the original bytes.
268
269
  backupDir: join(dataDir, 'codex-config-backup'),
269
270
  }),
271
+ antigravity: resolveAntigravityActionSeam({
272
+ version: pluginVersion,
273
+ }),
270
274
  configureDelegatedSession,
271
275
  // `ctx.sandboxPolicy` and `ctx.approval` own the two facts the delegated
272
276
  // policy writes, so the runner reads them back through these live services
@@ -332,6 +336,27 @@ export async function apply(ctx, config = {}) {
332
336
  logger?.warn?.(`dsh-delegate: Codex integration refresh check failed (${diagnostic(error?.message ?? error, 200)})`);
333
337
  }
334
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
+
335
360
  /**
336
361
  * Bring the native routes and the adapter's served snapshot to the state this
337
362
  * settings snapshot describes, and return the mapping both sides agree on.
@@ -1,15 +1,15 @@
1
- // Closed vocabulary shared by the activity monitor and the MCP wait answer.
2
- //
3
- // This module exists only to hold string constants that BOTH sides compare, so the
4
- // producer and the consumer cannot drift apart, and so neither has to import the other.
5
- // It has no imports of its own: it is the leaf of the graph, which is what keeps the
6
- // `server ⇄ wait` pair and the engine from forming a cycle over one literal.
7
-
8
- /**
9
- * `failure.kind` for a repeated-tool-failure reminder.
10
- *
11
- * The reminder rides the existing `attention` reason rather than adding a new one; this
12
- * discriminator is what lets a host tell "silent for the configured interval" from "kept
13
- * failing the same operation", which need different decisions.
14
- */
15
- export const REPEATED_FAILURE_KIND = 'repeated-tool-failure';
1
+ // Closed vocabulary shared by the activity monitor and the MCP wait answer.
2
+ //
3
+ // This module exists only to hold string constants that BOTH sides compare, so the
4
+ // producer and the consumer cannot drift apart, and so neither has to import the other.
5
+ // It has no imports of its own: it is the leaf of the graph, which is what keeps the
6
+ // `server ⇄ wait` pair and the engine from forming a cycle over one literal.
7
+
8
+ /**
9
+ * `failure.kind` for a repeated-tool-failure reminder.
10
+ *
11
+ * The reminder rides the existing `attention` reason rather than adding a new one; this
12
+ * discriminator is what lets a host tell "silent for the configured interval" from "kept
13
+ * failing the same operation", which need different decisions.
14
+ */
15
+ export const REPEATED_FAILURE_KIND = 'repeated-tool-failure';
@@ -3904,6 +3904,7 @@ export class JobEngine {
3904
3904
  taskId: task.taskId,
3905
3905
  connectionId: task.connectionId,
3906
3906
  sourcePath: task.sourcePath,
3907
+ isolation: task.effective?.worker?.isolation ?? null,
3907
3908
  // Worker sessions are writable only inside their current DSH workspace.
3908
3909
  // Wider sandbox requests are refused when no bridge is armed, and decided
3909
3910
  // per call by the commander when one is. The services that own both facts
@@ -467,7 +467,7 @@ export class HistoryStore {
467
467
  for (const taskId of ids) {
468
468
  const row = byId.get(taskId);
469
469
  if (row === undefined) missing.push(taskId);
470
- else if (!isTerminal(row.state) || row.state === 'interrupted') live.push(taskId);
470
+ else if (!isTerminal(row.state)) live.push(taskId);
471
471
  }
472
472
  if (missing.length > 0 || live.length > 0) {
473
473
  // The ids are echoed back because the caller sent them; nothing else is.