dsh-taskbridge 0.0.0-stage → 1.3.2
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 +763 -0
- package/LICENSE +21 -0
- package/README.md +622 -3
- package/bin/dsh-delegate-codex-agent.js +115 -0
- package/bin/dsh-delegate-control.d.ts +90 -0
- package/bin/dsh-delegate-control.js +450 -0
- package/bin/dsh-delegate-mcp.d.ts +121 -0
- package/bin/dsh-delegate-mcp.js +273 -0
- package/codex/dsh-taskbridge.toml +247 -0
- package/cordis.patch.yml +6 -0
- package/docs/INTRODUCTION.md +15 -0
- package/docs/INTRODUCTION.zh.md +34 -0
- package/docs/auth-contract.md +138 -0
- package/docs/claude-code.md +31 -0
- package/docs/codex-integration.md +937 -0
- package/docs/contracts-stage-b.md +443 -0
- package/docs/conversation-placement.md +304 -0
- package/docs/plugin-market.md +30 -0
- package/docs/redaction-contract.md +127 -0
- package/docs/runtime-compatibility.md +223 -0
- package/docs/silent-wait.md +191 -0
- package/docs/taskbridge-upgrade.md +28 -0
- package/docs/taskdispatch-upgrade.md +25 -0
- package/docs/worker-permissions.md +347 -0
- package/docs/workspace-contract.md +538 -0
- package/icon.svg +1 -0
- package/lib/client.d.ts +118 -0
- package/lib/client.js +3232 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +138 -4
- package/src/auth/fence.js +361 -0
- package/src/auth/grants.js +789 -0
- package/src/client/api.js +2322 -0
- package/src/client/index.jsx +2333 -0
- package/src/client/styles.js +251 -0
- package/src/codex/installer.js +3299 -0
- package/src/codex/seam.js +429 -0
- package/src/codex/toml.js +784 -0
- package/src/config/defaults.js +164 -0
- package/src/config/redact.js +184 -0
- package/src/config/settings.js +629 -0
- package/src/config/store.js +186 -0
- package/src/config/validate.js +763 -0
- package/src/credentials/seam.js +202 -0
- package/src/http/execution-plane.js +456 -0
- package/src/http/respond.js +175 -0
- package/src/http/user-plane.js +1122 -0
- package/src/index.d.ts +332 -0
- package/src/index.js +657 -0
- package/src/jobs/activity.js +1008 -0
- package/src/jobs/engine.js +3614 -0
- package/src/jobs/history.js +1467 -0
- package/src/jobs/title.js +17 -0
- package/src/mcp/server.js +1821 -0
- package/src/mcp/wait.js +536 -0
- package/src/model/connectivity.js +371 -0
- package/src/model/discovery.js +582 -0
- package/src/model/native-catalog.js +68 -0
- package/src/model/openai-adapter.js +671 -0
- package/src/model/probe.js +264 -0
- package/src/model/providers.js +756 -0
- package/src/model/routing.js +321 -0
- package/src/review/preset.js +868 -0
- package/src/review/prompts.js +126 -0
- package/src/review/reviewer.js +933 -0
- package/src/runtime/agent-runner.js +1740 -0
- package/src/runtime/endpoint-discovery.js +118 -0
- package/src/runtime/permissions.js +1429 -0
- package/src/runtime/sandbox.js +358 -0
- package/src/runtime/session-placement.js +1121 -0
- package/src/workspace/audit.js +775 -0
- package/src/workspace/locks.js +167 -0
- package/src/workspace/preflight.js +424 -0
- package/src/workspace/worktrees.js +613 -0
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
// Type declarations for the dsh-delegate native plugin entry (`src/index.js`).
|
|
2
|
+
//
|
|
3
|
+
// These describe only the package's own public surface — the Cordis plugin object
|
|
4
|
+
// DSH imports, the optional-config shape, and the two exported helpers. They are
|
|
5
|
+
// hand-written against the runtime module because this package ships plain ESM
|
|
6
|
+
// JavaScript; there is no build step that emits declarations.
|
|
7
|
+
//
|
|
8
|
+
// Every declared member below exists on the runtime module today. Adding a member
|
|
9
|
+
// to `src/index.js` without adding it here leaves the package usable but
|
|
10
|
+
// under-declared; removing one here before removing it from the runtime would make
|
|
11
|
+
// the declaration lie.
|
|
12
|
+
|
|
13
|
+
/** Stable Cordis plugin name; also the settings/document namespace. */
|
|
14
|
+
export declare const name: 'dsh-taskbridge';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Injected native services. While any of these is absent Cordis does not activate
|
|
18
|
+
* the plugin, so no handler can run against a half-built harness.
|
|
19
|
+
*/
|
|
20
|
+
export declare const inject: readonly ['agents', 'sessions', 'llm', 'tools', 'webServer', 'connection'];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Plugin configuration schema.
|
|
24
|
+
*
|
|
25
|
+
* This is a `@deepseek-ai/schemastery` schema object, not a plain structural
|
|
26
|
+
* shape: Cordis validates it through the Standard Schema interface
|
|
27
|
+
* (`Config['~standard'].validate`), which a plain object does not implement.
|
|
28
|
+
* The schema's value type is `{ dataDir: string }`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const Config: import('@deepseek-ai/schemastery').default.Schema<{ dataDir: string }>;
|
|
31
|
+
|
|
32
|
+
/** One operator-facing provider profile after validation. Never carries a secret. */
|
|
33
|
+
export interface DelegateProviderProfile {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
baseUrl: string;
|
|
37
|
+
protocol: string;
|
|
38
|
+
/** Reference into the harness credential seam, or `null` when unset. */
|
|
39
|
+
credentialRef: string | null;
|
|
40
|
+
models: Array<{ id: string; name?: string; efforts?: string[] }>;
|
|
41
|
+
[field: string]: unknown;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Bounded diagnostic shape shared by the connectivity fan-out and the HTTP planes. */
|
|
45
|
+
export interface DelegateError {
|
|
46
|
+
code: string;
|
|
47
|
+
message: string;
|
|
48
|
+
details?: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Per-provider connectivity report: HTTP, auth and catalog layers reported separately from the model probe. */
|
|
52
|
+
export interface DelegateProviderConnectivity {
|
|
53
|
+
providerId: string;
|
|
54
|
+
providerName?: string;
|
|
55
|
+
error?: DelegateError | null;
|
|
56
|
+
[layer: string]: unknown;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Whole-configuration connectivity report produced by {@link checkConnectivity}. */
|
|
60
|
+
export interface DelegateConnectivityReport {
|
|
61
|
+
ok: boolean;
|
|
62
|
+
providers: DelegateProviderConnectivity[];
|
|
63
|
+
error?: DelegateError;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Dependency object the exported helpers accept. Only the fields they read are
|
|
68
|
+
* required; the plugin's own engine passes a much wider object.
|
|
69
|
+
*/
|
|
70
|
+
export interface DelegateRuntimeDeps {
|
|
71
|
+
llm?: unknown;
|
|
72
|
+
settings?: { read?: () => Promise<unknown> } | unknown;
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** One routable provider/model/effort selection that has already been validated. */
|
|
77
|
+
export interface DelegateSelection {
|
|
78
|
+
providerId: string;
|
|
79
|
+
providerRoute?: string;
|
|
80
|
+
model: string;
|
|
81
|
+
reasoningEffort?: string | null;
|
|
82
|
+
[field: string]: unknown;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Routable descriptor returned by {@link resolveRoute}. */
|
|
86
|
+
export interface DelegateResolvedRoute {
|
|
87
|
+
providerRoute: string;
|
|
88
|
+
model: string;
|
|
89
|
+
reasoningEffort?: string | null;
|
|
90
|
+
[field: string]: unknown;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** One provider's catalog row returned by {@link describeCatalog}. */
|
|
94
|
+
export interface DelegateCatalogEntry {
|
|
95
|
+
providerId: string;
|
|
96
|
+
route: string;
|
|
97
|
+
models: Array<{ id: string; name?: string; efforts?: string[] }>;
|
|
98
|
+
error: DelegateError | null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Options accepted by {@link resolveRoute} and {@link describeCatalog}. */
|
|
102
|
+
export interface DelegateRouteOptions {
|
|
103
|
+
signal?: AbortSignal;
|
|
104
|
+
routes?: Map<string, string> | null;
|
|
105
|
+
requireEffort?: boolean;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* One pending per-call permission request, as the task view publishes it.
|
|
110
|
+
*
|
|
111
|
+
* Every field is redacted at construction time: `arguments` is a bounded JSON
|
|
112
|
+
* rendering whose string values have passed through the plugin's own redaction,
|
|
113
|
+
* and `reason` is the WORKER's own claim about why it asks — never the operation
|
|
114
|
+
* being decided.
|
|
115
|
+
*/
|
|
116
|
+
export interface DelegatePendingPermission {
|
|
117
|
+
/** Non-reusable identity of this request. */
|
|
118
|
+
requestId: string;
|
|
119
|
+
taskId: string;
|
|
120
|
+
sessionId: string | null;
|
|
121
|
+
/** The tool whose call is paused. */
|
|
122
|
+
toolName: string;
|
|
123
|
+
/** The exact native tool-call id the decision is bound to. */
|
|
124
|
+
callId: string;
|
|
125
|
+
turn: number | null;
|
|
126
|
+
step: number | null;
|
|
127
|
+
tool: { name: string; callId: string };
|
|
128
|
+
/** `pending` while the call waits; a settled request leaves the pending slot. */
|
|
129
|
+
state: 'pending' | 'decided' | 'expired' | 'cancelled' | 'unavailable';
|
|
130
|
+
/** The worker's own one-line justification. Evidence, not the operation. */
|
|
131
|
+
reason: string | null;
|
|
132
|
+
reasonSource: 'asker-claim';
|
|
133
|
+
/** The access the REAL arguments ask for. */
|
|
134
|
+
requestedAccess: { kind: string; mode: string | null };
|
|
135
|
+
argumentKeys: string[];
|
|
136
|
+
/** Redacted, bounded JSON of the real tool arguments. */
|
|
137
|
+
arguments: string | null;
|
|
138
|
+
argumentsRedacted: true;
|
|
139
|
+
/**
|
|
140
|
+
* Whether the published operation is the WHOLE operation. An `allow-once`
|
|
141
|
+
* decision is refused when this is not `complete`, because an allow must not grant
|
|
142
|
+
* a call whose executable material (a command tail, a write body) was cut by a
|
|
143
|
+
* bound. `reject` is unaffected.
|
|
144
|
+
*/
|
|
145
|
+
completeness: 'complete' | 'truncated' | 'unbounded';
|
|
146
|
+
argumentsComplete: boolean;
|
|
147
|
+
/** Which bounds fired, e.g. `value`, `key`, `depth`, `item`. */
|
|
148
|
+
boundsApplied: string[];
|
|
149
|
+
omitted: { valueChars: number; keys: number; depth: number; items: number };
|
|
150
|
+
/** Why an `allow-once` would be refused, or `null` when an allow is decidable. */
|
|
151
|
+
allowBlocked: string | null;
|
|
152
|
+
/** Exact fingerprint of the real arguments; REQUIRED by `allow-once`. */
|
|
153
|
+
fingerprint: string;
|
|
154
|
+
createdAt: number;
|
|
155
|
+
/** Fixed bound: the wait never outlives this (default 10 minutes). */
|
|
156
|
+
deadlineAt: number;
|
|
157
|
+
decision: 'allow-once' | 'reject' | null;
|
|
158
|
+
decidedAt: number | null;
|
|
159
|
+
decidedBy: 'commander' | 'deadline' | 'asker' | 'stop' | 'binding' | 'restart' | null;
|
|
160
|
+
decisionReason: string | null;
|
|
161
|
+
/** Closed native outcome: `allowed-once` is the only grant. */
|
|
162
|
+
outcome: 'allowed-once' | 'rejected' | 'cancelled' | 'unavailable' | null;
|
|
163
|
+
/** Present only for an `allowed-once`: which checks the grant actually passed. */
|
|
164
|
+
verified?: {
|
|
165
|
+
fingerprintQuoted: boolean;
|
|
166
|
+
argumentsComplete: boolean;
|
|
167
|
+
callReread: boolean;
|
|
168
|
+
turnOpen: boolean;
|
|
169
|
+
boundsApplied: string[];
|
|
170
|
+
} | null;
|
|
171
|
+
/** Present only for an `allowed-once`; states that it covers one call. */
|
|
172
|
+
grant: { kind: 'allowed-once'; appliesTo: 'this-call-only'; callId: string; reusable: false } | null;
|
|
173
|
+
/** Always true: a decision never changes the Session's standing mode. */
|
|
174
|
+
standingModeUnchanged: true;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** The per-call permission block every task view carries. */
|
|
178
|
+
export interface DelegateTaskPermission {
|
|
179
|
+
/** Whether this run was offered a bridge at all. */
|
|
180
|
+
bridged: boolean;
|
|
181
|
+
/** Whether a request is outstanding right now. */
|
|
182
|
+
waiting: boolean;
|
|
183
|
+
pending: DelegatePendingPermission | null;
|
|
184
|
+
/** Bounded settled trail, oldest first. */
|
|
185
|
+
evidence: DelegatePendingPermission[];
|
|
186
|
+
/** Time the run spent waiting, which was NOT charged to the execution budget. */
|
|
187
|
+
pausedExecutionMs: number;
|
|
188
|
+
/** The standing sandbox mode, which no decision changes. */
|
|
189
|
+
standingSandboxMode: 'workspace-write';
|
|
190
|
+
/** Stated so no reader can mistake a decision for a standing grant. */
|
|
191
|
+
grantScope: 'single-call';
|
|
192
|
+
/**
|
|
193
|
+
* Present in a STORED record only: the process stopped while this request was
|
|
194
|
+
* pending, so it was rewritten as history and can never be decided or replayed.
|
|
195
|
+
*/
|
|
196
|
+
interrupted?: true;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Bounded activity metadata for one task.
|
|
201
|
+
*
|
|
202
|
+
* Every field is a count, a timestamp or an identifier. Model text, reasoning,
|
|
203
|
+
* tool arguments and tool results have no field here: the monitor that produces
|
|
204
|
+
* this summary never retains them, so no projection of it can leak them.
|
|
205
|
+
*/
|
|
206
|
+
export interface DelegateTaskActivity {
|
|
207
|
+
/** Clock time of the last genuine progress, or `null` before any. */
|
|
208
|
+
lastActivityAt: number | null;
|
|
209
|
+
/**
|
|
210
|
+
* The true silence span. It is never substituted with a tool's elapsed time: an
|
|
211
|
+
* open tool call that emits nothing is still silence, which is why a hung tool
|
|
212
|
+
* reaches the attention threshold like any other silent executor.
|
|
213
|
+
*/
|
|
214
|
+
idleForMs: number | null;
|
|
215
|
+
/** Whether the run is silent between model turns or executing a tool. */
|
|
216
|
+
waitingOn: 'idle' | 'tool' | null;
|
|
217
|
+
/** The native tool call in flight, bounded to its identifiers. */
|
|
218
|
+
currentTool: { name: string | null; callId: string | null; startedAt: number; elapsedMs: number } | null;
|
|
219
|
+
/** The most recent tool call and how long it took. */
|
|
220
|
+
lastTool: { name: string | null; durationMs: number | null } | null;
|
|
221
|
+
/** Total events observed, and how many of them were genuine progress. */
|
|
222
|
+
events: number;
|
|
223
|
+
activityEvents: number;
|
|
224
|
+
toolCallsStarted: number;
|
|
225
|
+
toolCallsFinished: number;
|
|
226
|
+
/** The thresholds this task froze at admission. */
|
|
227
|
+
selfCheckSeconds: number;
|
|
228
|
+
attentionSeconds: number;
|
|
229
|
+
/**
|
|
230
|
+
* `null` while the run is live. Once the task ended it holds the recorded end, and
|
|
231
|
+
* every elapsed value above is measured against it — a stored or queried record
|
|
232
|
+
* therefore does not keep growing.
|
|
233
|
+
*/
|
|
234
|
+
finalizedAt: number | null;
|
|
235
|
+
/** The last self-check verdict, which explains a silent run. */
|
|
236
|
+
selfCheck: { episode: number | null; checkedAt: number | null; verdict: string | null } | null;
|
|
237
|
+
/** Counts per event kind, bounded. */
|
|
238
|
+
kinds: Record<string, number>;
|
|
239
|
+
/** Present only in a STORED record: the run did not survive a restart. */
|
|
240
|
+
interrupted?: true;
|
|
241
|
+
/** Present only in a STORED record: the tool that was cut off by the restart. */
|
|
242
|
+
interruptedTool?: { name: string | null; callId: string | null; startedAt: number | null; elapsedMs: number | null } | null;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** Why one observation of a running task returned. */
|
|
246
|
+
export type DelegateObserveReason =
|
|
247
|
+
| 'heartbeat'
|
|
248
|
+
| 'attention'
|
|
249
|
+
| 'permission'
|
|
250
|
+
| 'ready'
|
|
251
|
+
| 'failed'
|
|
252
|
+
| 'cancelled'
|
|
253
|
+
| 'interrupted';
|
|
254
|
+
|
|
255
|
+
/** The compact task summary one observation returns. */
|
|
256
|
+
export interface DelegateObservationSummary {
|
|
257
|
+
taskId: string;
|
|
258
|
+
state: 'pending' | 'running' | 'awaiting-host-review' | 'failed' | 'cancelled';
|
|
259
|
+
phase: string;
|
|
260
|
+
createdAt: number | null;
|
|
261
|
+
startedAt: number | null;
|
|
262
|
+
endedAt: number | null;
|
|
263
|
+
elapsedMs: number;
|
|
264
|
+
lastActivityAt: number | null;
|
|
265
|
+
currentTool: DelegateTaskActivity['currentTool'];
|
|
266
|
+
idleForMs: number | null;
|
|
267
|
+
waitingOn: DelegateTaskActivity['waitingOn'];
|
|
268
|
+
activity: DelegateTaskActivity | null;
|
|
269
|
+
selfCheck: { episode: number | null; checkedAt: number | null; verdict: string | null } | null;
|
|
270
|
+
/** The route this task froze at admission, never a re-resolved one. */
|
|
271
|
+
route: {
|
|
272
|
+
providerId: string | null;
|
|
273
|
+
providerRoute: string | null;
|
|
274
|
+
model: string | null;
|
|
275
|
+
reasoningEffort: string | null;
|
|
276
|
+
isolation: string | null;
|
|
277
|
+
monitoring: { selfCheckSeconds: number | null; attentionSeconds: number | null };
|
|
278
|
+
} | null;
|
|
279
|
+
connectionId: string | null;
|
|
280
|
+
/** Always false: execution completion is not host acceptance. */
|
|
281
|
+
selfApproved: false;
|
|
282
|
+
hostAcceptance: null;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** Result of one bounded observation of a delegated task. */
|
|
286
|
+
export interface DelegateObservation {
|
|
287
|
+
task: DelegateObservationSummary;
|
|
288
|
+
reason: DelegateObserveReason;
|
|
289
|
+
/**
|
|
290
|
+
* The FULL redacted pending request, present only for `reason: 'permission'`.
|
|
291
|
+
* Carries the exact fingerprint and completeness facts a decision needs; it is
|
|
292
|
+
* never shortened into an undecidable summary.
|
|
293
|
+
*/
|
|
294
|
+
permission: DelegatePendingPermission | null;
|
|
295
|
+
activity: DelegateTaskActivity | null;
|
|
296
|
+
selfCheck: { episode: number | null; checkedAt: number | null; verdict: string | null } | null;
|
|
297
|
+
/**
|
|
298
|
+
* The wait that produced this result. `activitySinceWait` reports that the run
|
|
299
|
+
* moved during the wait; it is NOT a reason to wake the host, so such an
|
|
300
|
+
* observation still ends as `heartbeat` unless a threshold or an outcome says
|
|
301
|
+
* otherwise.
|
|
302
|
+
*/
|
|
303
|
+
wait: { waitMs: number; waitedMs: number; activitySinceWait: boolean };
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Mount the delegation service.
|
|
308
|
+
*
|
|
309
|
+
* After this resolves the plugin holds no grant, owns no agent, and refuses to
|
|
310
|
+
* dispatch work until an operator authorizes a connection through the
|
|
311
|
+
* authenticated user plane.
|
|
312
|
+
* @param ctx - Cordis plugin context.
|
|
313
|
+
* @param config - plugin config.
|
|
314
|
+
*/
|
|
315
|
+
export declare function apply(ctx: unknown, config?: { dataDir?: string }): Promise<void>;
|
|
316
|
+
|
|
317
|
+
/** Whole-configuration connectivity report; one entry per configured provider. */
|
|
318
|
+
export declare function checkConnectivity(deps: DelegateRuntimeDeps): Promise<DelegateConnectivityReport>;
|
|
319
|
+
|
|
320
|
+
/** Resolve and validate one explicit selection against the native LLM service. */
|
|
321
|
+
export declare function resolveRoute(
|
|
322
|
+
deps: DelegateRuntimeDeps,
|
|
323
|
+
selection: DelegateSelection,
|
|
324
|
+
options?: DelegateRouteOptions,
|
|
325
|
+
): Promise<DelegateResolvedRoute>;
|
|
326
|
+
|
|
327
|
+
/** Describe each provider's available models, with per-provider status. */
|
|
328
|
+
export declare function describeCatalog(
|
|
329
|
+
deps: DelegateRuntimeDeps,
|
|
330
|
+
providers: DelegateProviderProfile[],
|
|
331
|
+
options?: DelegateRouteOptions,
|
|
332
|
+
): Promise<DelegateCatalogEntry[]>;
|