dsh-super-code 0.3.10 → 0.3.11
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/README.en.md +4 -4
- package/README.md +4 -4
- package/client/index.js +106 -47
- package/cordis.patch.yml +1 -1
- package/docs/Changelog.md +43 -0
- package/docs/Compatibility.md +13 -0
- package/docs/UsageGuide.md +30 -8
- package/docs/en/Changelog.md +43 -0
- package/docs/en/Compatibility.md +13 -0
- package/docs/en/UsageGuide.md +30 -8
- package/lib/connection/directories.d.ts.map +1 -1
- package/lib/connection/directories.js +14 -5
- package/lib/connection/directories.js.map +1 -1
- package/lib/connection/guidance.d.ts.map +1 -1
- package/lib/connection/guidance.js +7 -0
- package/lib/connection/guidance.js.map +1 -1
- package/lib/connection/http.d.ts.map +1 -1
- package/lib/connection/http.js +59 -30
- package/lib/connection/http.js.map +1 -1
- package/lib/connection/service.d.ts +3 -0
- package/lib/connection/service.d.ts.map +1 -1
- package/lib/connection/service.js +82 -33
- package/lib/connection/service.js.map +1 -1
- package/lib/connection/store.d.ts +2 -0
- package/lib/connection/store.d.ts.map +1 -1
- package/lib/connection/store.js +95 -30
- package/lib/connection/store.js.map +1 -1
- package/lib/connection/tasks.d.ts +6 -3
- package/lib/connection/tasks.d.ts.map +1 -1
- package/lib/connection/tasks.js +125 -53
- package/lib/connection/tasks.js.map +1 -1
- package/lib/connection/types.d.ts +1 -0
- package/lib/connection/types.d.ts.map +1 -1
- package/lib/connection/types.js.map +1 -1
- package/lib/core/deletion-command.d.ts.map +1 -1
- package/lib/core/deletion-command.js +84 -24
- package/lib/core/deletion-command.js.map +1 -1
- package/lib/dsh/compaction.d.ts.map +1 -1
- package/lib/dsh/compaction.js +1 -0
- package/lib/dsh/compaction.js.map +1 -1
- package/lib/dsh/connection-history.d.ts.map +1 -1
- package/lib/dsh/connection-history.js +3 -0
- package/lib/dsh/connection-history.js.map +1 -1
- package/lib/dsh/connection-host.js +1 -1
- package/lib/dsh/connection-host.js.map +1 -1
- package/lib/dsh/connection.d.ts.map +1 -1
- package/lib/dsh/connection.js +24 -3
- package/lib/dsh/connection.js.map +1 -1
- package/lib/dsh/deletion-protection.d.ts.map +1 -1
- package/lib/dsh/deletion-protection.js +18 -10
- package/lib/dsh/deletion-protection.js.map +1 -1
- package/lib/dsh/index.d.ts.map +1 -1
- package/lib/dsh/index.js +2 -0
- package/lib/dsh/index.js.map +1 -1
- package/lib/dsh/official-budgets.d.ts.map +1 -1
- package/lib/dsh/official-budgets.js +15 -3
- package/lib/dsh/official-budgets.js.map +1 -1
- package/lib/dsh/preset-declaration.d.ts +3 -0
- package/lib/dsh/preset-declaration.d.ts.map +1 -1
- package/lib/dsh/preset-declaration.js +68 -45
- package/lib/dsh/preset-declaration.js.map +1 -1
- package/lib/dsh/preset-installation.d.ts +10 -7
- package/lib/dsh/preset-installation.d.ts.map +1 -1
- package/lib/dsh/preset-installation.js +66 -30
- package/lib/dsh/preset-installation.js.map +1 -1
- package/lib/dsh/preset-metadata.d.ts.map +1 -1
- package/lib/dsh/preset-metadata.js +2 -1
- package/lib/dsh/preset-metadata.js.map +1 -1
- package/lib/dsh/preset-recovery-runtime.d.ts +76 -0
- package/lib/dsh/preset-recovery-runtime.d.ts.map +1 -0
- package/lib/dsh/preset-recovery-runtime.js +322 -0
- package/lib/dsh/preset-recovery-runtime.js.map +1 -0
- package/lib/dsh/preset-recovery.d.ts +14 -0
- package/lib/dsh/preset-recovery.d.ts.map +1 -0
- package/lib/dsh/preset-recovery.js +140 -0
- package/lib/dsh/preset-recovery.js.map +1 -0
- package/lib/dsh/ptc-budget.d.ts.map +1 -1
- package/lib/dsh/ptc-budget.js +20 -10
- package/lib/dsh/ptc-budget.js.map +1 -1
- package/lib/dsh/windows-shell.d.ts.map +1 -1
- package/lib/dsh/windows-shell.js +18 -4
- package/lib/dsh/windows-shell.js.map +1 -1
- package/lib/long-memory.d.ts.map +1 -1
- package/lib/long-memory.js +3 -2
- package/lib/long-memory.js.map +1 -1
- package/lib/super-agent-usage.d.ts +2 -0
- package/lib/super-agent-usage.d.ts.map +1 -1
- package/lib/super-agent-usage.js +16 -11
- package/lib/super-agent-usage.js.map +1 -1
- package/lib/task-feedback-projection.d.ts +11 -0
- package/lib/task-feedback-projection.d.ts.map +1 -1
- package/lib/task-feedback-projection.js +37 -12
- package/lib/task-feedback-projection.js.map +1 -1
- package/package.json +1 -1
- package/presets/super-code/agent.cordis.yml +1 -1
package/lib/connection/store.js
CHANGED
|
@@ -4,6 +4,7 @@ import { join, isAbsolute, relative } from 'node:path';
|
|
|
4
4
|
import { randomBytes, randomUUID } from 'node:crypto';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { connectionConfigSchema, defaultConnectionConfig, ConnectionError } from './types.js';
|
|
7
|
+
const taskStorageLimit = 64 * 1024 * 1024;
|
|
7
8
|
const taskSchema = z.object({
|
|
8
9
|
id: z.string().regex(/^sc-[a-f0-9-]{36}$/), sessionId: z.string(), requestId: z.string().min(1).max(128), fingerprint: z.string().length(64),
|
|
9
10
|
cwd: z.string().max(4096), preset: z.string().min(1).max(128), client: z.string().max(80),
|
|
@@ -12,6 +13,7 @@ const taskSchema = z.object({
|
|
|
12
13
|
sequence: z.number().int().nonnegative(), events: z.array(z.object({ cursor: z.number().int().positive(), time: z.number(), status: z.string(), message: z.string().max(1000) }).strict()).max(200),
|
|
13
14
|
operations: z.record(z.string(), z.string().length(64)).refine(value => Object.keys(value).length <= 128),
|
|
14
15
|
connectionId: z.string().max(128).optional(),
|
|
16
|
+
previousRequest: z.string().min(1).max(128).optional(),
|
|
15
17
|
modelSelection: z.object({ provider: z.string().min(1).max(256), model: z.string().min(1).max(256), reasoningEffort: z.string().min(1).max(128).optional() }).strict().optional(),
|
|
16
18
|
observation: z.object({ lastEventSeq: z.number().int().min(-1), lastEventType: z.string().max(128), outputTruncated: z.boolean(), errorCode: z.string().max(128).optional() }).strict().optional(),
|
|
17
19
|
baseline: z.object({ available: z.boolean(), root: z.string(), head: z.string(), fingerprint: z.string(), dirty: z.array(z.string()).max(160) }).strict(),
|
|
@@ -22,10 +24,13 @@ export class ConnectionStore {
|
|
|
22
24
|
directory;
|
|
23
25
|
lock = '';
|
|
24
26
|
owned = false;
|
|
27
|
+
writable = false;
|
|
25
28
|
constructor(directory) {
|
|
26
29
|
this.directory = directory;
|
|
27
30
|
}
|
|
28
31
|
async initialize() {
|
|
32
|
+
if (this.owned)
|
|
33
|
+
throw new ConnectionError('profile-busy');
|
|
29
34
|
if (!isAbsolute(this.directory))
|
|
30
35
|
throw new ConnectionError('storage-unavailable');
|
|
31
36
|
await mkdir(this.directory, { recursive: true, mode: 0o700 });
|
|
@@ -34,62 +39,117 @@ export class ConnectionStore {
|
|
|
34
39
|
throw new ConnectionError('storage-unavailable');
|
|
35
40
|
await chmod(this.directory, 0o700);
|
|
36
41
|
const path = join(this.directory, 'owner.lock');
|
|
37
|
-
|
|
42
|
+
const token = `${process.pid}:${randomUUID()}`;
|
|
38
43
|
try {
|
|
39
|
-
await this.claim(path);
|
|
44
|
+
await this.claim(path, token);
|
|
40
45
|
}
|
|
41
46
|
catch (error) {
|
|
42
47
|
if (error.code !== 'EEXIST')
|
|
43
48
|
throw error;
|
|
44
49
|
// A separate exclusive claim serializes stale-lock recovery by competing hosts.
|
|
45
50
|
const recovery = await open(join(this.directory, 'recovery.lock'), 'wx', 0o600).catch(() => { throw new ConnectionError('profile-busy'); });
|
|
51
|
+
const failures = [];
|
|
46
52
|
try {
|
|
47
|
-
const previous = await readFile(path, 'utf8')
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
const previous = await readFile(path, 'utf8').catch(failure => {
|
|
54
|
+
if (failure.code !== 'ENOENT')
|
|
55
|
+
throw failure;
|
|
56
|
+
return false;
|
|
57
|
+
});
|
|
58
|
+
// A live owner can finish closing after the exclusive claim saw EEXIST.
|
|
59
|
+
if (previous !== false) {
|
|
60
|
+
const pid = Number(previous.split(':')[0]);
|
|
61
|
+
if (!Number.isSafeInteger(pid) || pid <= 0)
|
|
62
|
+
throw new ConnectionError('profile-busy');
|
|
63
|
+
try {
|
|
64
|
+
process.kill(pid, 0);
|
|
65
|
+
throw new ConnectionError('profile-busy');
|
|
66
|
+
}
|
|
67
|
+
catch (failure) {
|
|
68
|
+
if (failure.code !== 'ESRCH')
|
|
69
|
+
throw failure;
|
|
70
|
+
}
|
|
71
|
+
await unlink(path);
|
|
72
|
+
}
|
|
73
|
+
await this.claim(path, token);
|
|
74
|
+
}
|
|
75
|
+
catch (failure) {
|
|
76
|
+
failures.push(failure);
|
|
77
|
+
}
|
|
78
|
+
for (const release of [() => recovery.close(), () => unlink(join(this.directory, 'recovery.lock'))]) {
|
|
51
79
|
try {
|
|
52
|
-
|
|
53
|
-
throw new ConnectionError('profile-busy');
|
|
80
|
+
await release();
|
|
54
81
|
}
|
|
55
82
|
catch (failure) {
|
|
56
|
-
|
|
57
|
-
throw failure;
|
|
83
|
+
failures.push(failure);
|
|
58
84
|
}
|
|
59
|
-
await unlink(path);
|
|
60
|
-
await this.claim(path);
|
|
61
85
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
86
|
+
if (failures.length) {
|
|
87
|
+
// Initialization did not complete: never strand a token for this live PID.
|
|
88
|
+
try {
|
|
89
|
+
await this.release(token);
|
|
90
|
+
}
|
|
91
|
+
catch (failure) {
|
|
92
|
+
failures.push(failure);
|
|
93
|
+
}
|
|
94
|
+
if (failures.length === 1)
|
|
95
|
+
throw failures[0];
|
|
96
|
+
throw new AggregateError(failures, 'MCP lock recovery failed');
|
|
65
97
|
}
|
|
66
98
|
}
|
|
99
|
+
this.lock = token;
|
|
67
100
|
this.owned = true;
|
|
101
|
+
this.writable = true;
|
|
68
102
|
}
|
|
69
|
-
async claim(path) {
|
|
103
|
+
async claim(path, token) {
|
|
70
104
|
const file = await open(path, 'wx', 0o600);
|
|
105
|
+
let identity = false;
|
|
71
106
|
try {
|
|
72
|
-
await file.
|
|
107
|
+
identity = await file.stat();
|
|
108
|
+
await file.writeFile(token);
|
|
73
109
|
await file.sync();
|
|
74
|
-
}
|
|
75
|
-
finally {
|
|
76
110
|
await file.close();
|
|
77
111
|
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
await file.close().catch(() => { });
|
|
114
|
+
try {
|
|
115
|
+
const current = await lstat(path);
|
|
116
|
+
if (identity && !current.isSymbolicLink() && current.dev === identity.dev && current.ino === identity.ino)
|
|
117
|
+
await unlink(path);
|
|
118
|
+
}
|
|
119
|
+
catch (cleanup) {
|
|
120
|
+
if (cleanup.code !== 'ENOENT')
|
|
121
|
+
throw new AggregateError([error, cleanup], 'Failed to clean up an incomplete MCP owner lock');
|
|
122
|
+
}
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
78
125
|
}
|
|
79
126
|
async close() {
|
|
127
|
+
this.writable = false;
|
|
80
128
|
if (!this.owned)
|
|
81
129
|
return;
|
|
82
|
-
|
|
130
|
+
const token = this.lock;
|
|
131
|
+
await this.release(token);
|
|
132
|
+
// Keep failed releases retryable without permitting further profile writes.
|
|
133
|
+
if (this.lock === token)
|
|
134
|
+
this.owned = false;
|
|
135
|
+
}
|
|
136
|
+
async release(token) {
|
|
83
137
|
const path = join(this.directory, 'owner.lock');
|
|
84
|
-
|
|
85
|
-
await
|
|
138
|
+
try {
|
|
139
|
+
if (await readFile(path, 'utf8') === token)
|
|
140
|
+
await unlink(path);
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
if (error.code !== 'ENOENT')
|
|
144
|
+
throw error;
|
|
145
|
+
}
|
|
86
146
|
}
|
|
87
147
|
async settings() {
|
|
88
148
|
try {
|
|
89
149
|
const stored = settingsSchema.parse(JSON.parse(await readFile(join(this.directory, 'settings.json'), 'utf8')));
|
|
90
150
|
if (stored.config.maxConcurrent !== stored.config.maxConnections) {
|
|
91
151
|
stored.config.maxConcurrent = stored.config.maxConnections;
|
|
92
|
-
await this.write('settings.json', stored);
|
|
152
|
+
await this.write('settings.json', JSON.stringify(stored));
|
|
93
153
|
}
|
|
94
154
|
return stored;
|
|
95
155
|
}
|
|
@@ -97,19 +157,19 @@ export class ConnectionStore {
|
|
|
97
157
|
if (error.code !== 'ENOENT')
|
|
98
158
|
throw new ConnectionError('storage-unavailable');
|
|
99
159
|
const value = { revision: 0, config: structuredClone(defaultConnectionConfig), token: randomBytes(32).toString('hex') };
|
|
100
|
-
await this.write('settings.json', value);
|
|
160
|
+
await this.write('settings.json', JSON.stringify(value));
|
|
101
161
|
return value;
|
|
102
162
|
}
|
|
103
163
|
}
|
|
104
164
|
async saveSettings(value) {
|
|
105
165
|
const normalized = settingsSchema.parse(value);
|
|
106
166
|
normalized.config.maxConcurrent = normalized.config.maxConnections;
|
|
107
|
-
await this.write('settings.json', normalized);
|
|
167
|
+
await this.write('settings.json', JSON.stringify(normalized));
|
|
108
168
|
}
|
|
109
169
|
async tasks() {
|
|
110
170
|
try {
|
|
111
171
|
const path = join(this.directory, 'tasks.json');
|
|
112
|
-
if ((await lstat(path)).size >
|
|
172
|
+
if ((await lstat(path)).size > taskStorageLimit)
|
|
113
173
|
throw new ConnectionError('storage-unavailable');
|
|
114
174
|
return z.array(taskSchema).max(200).parse(JSON.parse(await readFile(path, 'utf8')));
|
|
115
175
|
}
|
|
@@ -119,14 +179,19 @@ export class ConnectionStore {
|
|
|
119
179
|
throw new ConnectionError('storage-unavailable');
|
|
120
180
|
}
|
|
121
181
|
}
|
|
122
|
-
async saveTasks(tasks) {
|
|
123
|
-
|
|
124
|
-
if (
|
|
182
|
+
async saveTasks(tasks) {
|
|
183
|
+
const content = JSON.stringify(tasks);
|
|
184
|
+
if (Buffer.byteLength(content) > taskStorageLimit)
|
|
185
|
+
throw new ConnectionError('task-storage-full');
|
|
186
|
+
await this.write('tasks.json', content);
|
|
187
|
+
}
|
|
188
|
+
async write(name, content) {
|
|
189
|
+
if (!this.owned || !this.writable || relative(this.directory, join(this.directory, name)).startsWith('..'))
|
|
125
190
|
throw new ConnectionError('storage-unavailable');
|
|
126
191
|
const target = join(this.directory, name), temporary = `${target}.${randomUUID()}.tmp`;
|
|
127
192
|
const file = await open(temporary, 'wx', 0o600);
|
|
128
193
|
try {
|
|
129
|
-
await file.writeFile(
|
|
194
|
+
await file.writeFile(content);
|
|
130
195
|
await file.sync();
|
|
131
196
|
await file.close();
|
|
132
197
|
await rename(temporary, target);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/connection/store.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACtF,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAG7F,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;IAC5I,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAA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export declare class DelegatedTasks {
|
|
|
10
10
|
private records;
|
|
11
11
|
private tail;
|
|
12
12
|
private closed;
|
|
13
|
+
private closing;
|
|
13
14
|
readonly approvals: CallerApprovals;
|
|
14
15
|
constructor(store: ConnectionStore, host: DelegationHost, configuration: () => ConnectionConfig);
|
|
15
16
|
initialize(): Promise<void>;
|
|
16
17
|
private exclusive;
|
|
17
18
|
private event;
|
|
18
19
|
private persist;
|
|
20
|
+
private replace;
|
|
19
21
|
private owned;
|
|
20
22
|
private enabled;
|
|
21
23
|
requestApproval(input: Omit<CallerApproval, 'id' | 'createdAt' | 'expiresAt' | 'taskId' | 'cwd'>, roots: readonly string[], signal?: AbortSignal): Promise<ApprovalAnswer>;
|
|
22
|
-
approve(taskId: string, approvalId: string, decision: CallerApprovalDecision): Promise<{
|
|
24
|
+
approve(taskId: string, approvalId: string, decision: CallerApprovalDecision, signal?: AbortSignal): Promise<{
|
|
23
25
|
outcome: string;
|
|
24
26
|
repeated: boolean;
|
|
25
27
|
}>;
|
|
26
28
|
approvalsChanged(): void;
|
|
27
29
|
private selectModel;
|
|
28
30
|
models(): Promise<unknown>;
|
|
31
|
+
private authorization;
|
|
29
32
|
private directory;
|
|
30
33
|
private capacity;
|
|
31
34
|
run(input: {
|
|
@@ -35,7 +38,7 @@ export declare class DelegatedTasks {
|
|
|
35
38
|
client?: string;
|
|
36
39
|
connectionId?: string;
|
|
37
40
|
modelSelection?: ModelSelection;
|
|
38
|
-
}): Promise<TaskView>;
|
|
41
|
+
}, signal?: AbortSignal): Promise<TaskView>;
|
|
39
42
|
send(input: {
|
|
40
43
|
taskId: string;
|
|
41
44
|
requestId: string;
|
|
@@ -43,7 +46,7 @@ export declare class DelegatedTasks {
|
|
|
43
46
|
prompt: string;
|
|
44
47
|
connectionId?: string;
|
|
45
48
|
modelSelection?: ModelSelection;
|
|
46
|
-
}): Promise<TaskView>;
|
|
49
|
+
}, signal?: AbortSignal): Promise<TaskView>;
|
|
47
50
|
cancel(id: string): Promise<TaskView>;
|
|
48
51
|
private refresh;
|
|
49
52
|
private refreshPending;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/connection/tasks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,gBAAgB,EAAiB,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC3L,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAGjD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAGlE;AAED,qBAAa,cAAc;
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/connection/tasks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,gBAAgB,EAAiB,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC3L,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAGjD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAGlE;AAED,qBAAa,cAAc;IAMb,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAmB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACxE,OAAO,CAAC,QAAQ,CAAC,aAAa;IANhC,OAAO,CAAC,OAAO,CAAs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E,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,UAAU,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE;IAIvI,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAW/F,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAOvB"}
|
package/lib/connection/tasks.js
CHANGED
|
@@ -17,6 +17,7 @@ export class DelegatedTasks {
|
|
|
17
17
|
records = [];
|
|
18
18
|
tail = Promise.resolve();
|
|
19
19
|
closed = false;
|
|
20
|
+
closing = false;
|
|
20
21
|
approvals = new CallerApprovals();
|
|
21
22
|
constructor(store, host, configuration) {
|
|
22
23
|
this.store = store;
|
|
@@ -42,15 +43,21 @@ export class DelegatedTasks {
|
|
|
42
43
|
task.events = task.events.slice(-200);
|
|
43
44
|
}
|
|
44
45
|
async persist() { await this.store.saveTasks(this.records); }
|
|
46
|
+
async replace(task, candidate) {
|
|
47
|
+
await this.store.saveTasks(this.records.map(row => row === task ? candidate : row));
|
|
48
|
+
Object.assign(task, candidate);
|
|
49
|
+
}
|
|
45
50
|
owned(id) {
|
|
46
51
|
const task = this.records.find(row => row.id === id);
|
|
47
52
|
if (!task)
|
|
48
53
|
throw new ConnectionError('task-not-found');
|
|
49
54
|
return task;
|
|
50
55
|
}
|
|
51
|
-
enabled() {
|
|
56
|
+
enabled(signal) {
|
|
52
57
|
if (this.closed || !this.configuration().enabled)
|
|
53
58
|
throw new ConnectionError('connection-disabled');
|
|
59
|
+
if (signal?.aborted)
|
|
60
|
+
throw new ConnectionError('request-aborted');
|
|
54
61
|
}
|
|
55
62
|
async requestApproval(input, roots, signal) {
|
|
56
63
|
const config = this.configuration();
|
|
@@ -69,12 +76,15 @@ export class DelegatedTasks {
|
|
|
69
76
|
return 'host';
|
|
70
77
|
return this.approvals.request({ ...input, taskId: task.id, cwd: task.cwd }, signal);
|
|
71
78
|
}
|
|
72
|
-
async approve(taskId, approvalId, decision) {
|
|
73
|
-
this.enabled();
|
|
79
|
+
async approve(taskId, approvalId, decision, signal) {
|
|
80
|
+
this.enabled(signal);
|
|
74
81
|
if (!this.configuration().allowCallerApproval)
|
|
75
82
|
throw new ConnectionError('caller-approval-disabled');
|
|
76
83
|
const task = this.owned(taskId);
|
|
77
|
-
await this.
|
|
84
|
+
const authorization = await this.authorization(task.cwd, signal);
|
|
85
|
+
authorization.check(task.cwd);
|
|
86
|
+
if (!this.configuration().allowCallerApproval)
|
|
87
|
+
throw new ConnectionError('caller-approval-disabled');
|
|
78
88
|
if (task.cancellationRequested)
|
|
79
89
|
throw new ConnectionError('approval-not-found');
|
|
80
90
|
if (!activeTask(task.status) && this.approvals.pending(task.id).length) {
|
|
@@ -96,7 +106,8 @@ export class DelegatedTasks {
|
|
|
96
106
|
throw new ConnectionError('model-catalog-unavailable');
|
|
97
107
|
return this.host.models();
|
|
98
108
|
}
|
|
99
|
-
async
|
|
109
|
+
async authorization(cwd, signal, creating = false) {
|
|
110
|
+
this.enabled(signal);
|
|
100
111
|
if (!isAbsolute(cwd))
|
|
101
112
|
throw new ConnectionError('absolute-directory-required');
|
|
102
113
|
let canonical;
|
|
@@ -108,10 +119,26 @@ export class DelegatedTasks {
|
|
|
108
119
|
catch {
|
|
109
120
|
throw new ConnectionError('directory-unavailable');
|
|
110
121
|
}
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
122
|
+
const allowed = [...this.configuration().allowedDirectories];
|
|
123
|
+
const roots = await Promise.all(allowed.map(async (path) => ({ path, root: await realpath(path).catch(() => false) })));
|
|
124
|
+
const grants = roots.filter(({ root }) => root !== false && withinDirectory(root, canonical)).map(({ path }) => path);
|
|
125
|
+
// The caller checks again synchronously after awaiting, immediately before each host mutation.
|
|
126
|
+
const check = (expected = canonical) => {
|
|
127
|
+
this.enabled(signal);
|
|
128
|
+
if (!grants.some(path => this.configuration().allowedDirectories.includes(path)))
|
|
129
|
+
throw new ConnectionError('directory-not-allowed');
|
|
130
|
+
if (canonical !== expected)
|
|
131
|
+
throw new ConnectionError('task-directory-mismatch');
|
|
132
|
+
if (creating && !this.configuration().allowNewConversations)
|
|
133
|
+
throw new ConnectionError('new-conversation-disabled');
|
|
134
|
+
};
|
|
135
|
+
check();
|
|
136
|
+
return { canonical, check };
|
|
137
|
+
}
|
|
138
|
+
async directory(cwd, signal) {
|
|
139
|
+
const authorization = await this.authorization(cwd, signal);
|
|
140
|
+
authorization.check();
|
|
141
|
+
return authorization.canonical;
|
|
115
142
|
}
|
|
116
143
|
async capacity(cwd, except = '') {
|
|
117
144
|
await this.refreshPending(except);
|
|
@@ -125,10 +152,10 @@ export class DelegatedTasks {
|
|
|
125
152
|
|| root !== false && root === roots[index]))
|
|
126
153
|
throw new ConnectionError('workspace-busy', details);
|
|
127
154
|
}
|
|
128
|
-
async run(input) {
|
|
155
|
+
async run(input, signal) {
|
|
129
156
|
const task = await this.exclusive(async () => {
|
|
130
157
|
this.enabled();
|
|
131
|
-
const cwd = await this.directory(input.cwd);
|
|
158
|
+
const cwd = await this.directory(input.cwd, signal);
|
|
132
159
|
const request = { cwd, prompt: input.prompt, client: input.client ?? 'mcp' };
|
|
133
160
|
const fingerprint = input.modelSelection ? digest({ ...request, modelSelection: input.modelSelection }) : digest(request);
|
|
134
161
|
const prior = this.records.find(row => row.requestId === input.requestId);
|
|
@@ -150,44 +177,45 @@ export class DelegatedTasks {
|
|
|
150
177
|
const row = { id, sessionId: id, requestId: input.requestId, fingerprint, cwd, preset,
|
|
151
178
|
client: input.client ?? 'mcp', status: 'starting', cancellationRequested: false, createdAt: now, updatedAt: now, currentRequest: randomUUID(),
|
|
152
179
|
output: '', sequence: 0, events: [], operations: {}, baseline: await gitSnapshot(cwd), ...(input.connectionId ? { connectionId: input.connectionId } : {}) };
|
|
180
|
+
(await this.authorization(cwd, signal, true)).check(cwd);
|
|
153
181
|
this.event(row, 'starting', 'Dispatch intent saved. A DSH turn ending does not verify task acceptance.');
|
|
182
|
+
await this.store.saveTasks([...this.records, row]);
|
|
154
183
|
this.records.push(row);
|
|
155
|
-
|
|
184
|
+
let phase = 'authorization';
|
|
156
185
|
try {
|
|
186
|
+
;
|
|
187
|
+
(await this.authorization(cwd, signal, true)).check(cwd);
|
|
188
|
+
phase = 'creation';
|
|
157
189
|
await this.host.create(row.sessionId, cwd, preset, `[MCP] ${input.client ?? 'conversation'}`);
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
await this.persist();
|
|
162
|
-
return row;
|
|
163
|
-
}
|
|
164
|
-
try {
|
|
190
|
+
phase = 'authorization';
|
|
191
|
+
(await this.authorization(cwd, signal, true)).check(cwd);
|
|
192
|
+
phase = 'model';
|
|
165
193
|
await this.selectModel(row, input.modelSelection);
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
await this.persist();
|
|
170
|
-
return row;
|
|
171
|
-
}
|
|
172
|
-
try {
|
|
194
|
+
phase = 'authorization';
|
|
195
|
+
(await this.authorization(cwd, signal, true)).check(cwd);
|
|
196
|
+
phase = 'prompt';
|
|
173
197
|
await this.host.prompt(row.sessionId, row.currentRequest, input.prompt);
|
|
174
198
|
this.event(row, 'running', 'Prompt accepted by DSH.');
|
|
175
199
|
}
|
|
176
|
-
catch {
|
|
177
|
-
|
|
200
|
+
catch (error) {
|
|
201
|
+
const message = phase === 'authorization' ? `Admission stopped (${error instanceof ConnectionError ? error.code : 'directory-unavailable'}). No prompt was sent.`
|
|
202
|
+
: phase === 'creation' ? 'Session creation failed. No prompt was sent.'
|
|
203
|
+
: phase === 'model' ? 'Requested model or reasoning effort could not be selected. No prompt was sent.'
|
|
204
|
+
: 'Prompt admission could not be confirmed. No automatic retry; inspect the DSH session before continuing.';
|
|
205
|
+
this.event(row, phase === 'prompt' ? 'interrupted' : 'failed', message);
|
|
178
206
|
}
|
|
179
207
|
await this.persist();
|
|
180
208
|
return row;
|
|
181
209
|
});
|
|
182
210
|
return this.view(task.id, 0);
|
|
183
211
|
}
|
|
184
|
-
async send(input) {
|
|
212
|
+
async send(input, signal) {
|
|
185
213
|
await this.exclusive(async () => {
|
|
186
214
|
this.enabled();
|
|
187
215
|
const task = this.owned(input.taskId), fingerprint = input.modelSelection
|
|
188
216
|
? digest({ prompt: input.prompt, modelSelection: input.modelSelection })
|
|
189
217
|
: digest(input.prompt);
|
|
190
|
-
const cwd = await this.directory(input.cwd ?? task.cwd);
|
|
218
|
+
const cwd = await this.directory(input.cwd ?? task.cwd, signal);
|
|
191
219
|
if (cwd !== task.cwd)
|
|
192
220
|
throw new ConnectionError('task-directory-mismatch');
|
|
193
221
|
if (input.requestId === task.requestId) {
|
|
@@ -217,28 +245,49 @@ export class DelegatedTasks {
|
|
|
217
245
|
if (task.status === 'cancelling' || task.status === 'waiting_confirmation')
|
|
218
246
|
throw new ConnectionError('resolve-in-dsh-first');
|
|
219
247
|
await this.capacity(task.cwd, task.id);
|
|
248
|
+
(await this.authorization(task.cwd, signal)).check(task.cwd);
|
|
249
|
+
const previous = { currentRequest: task.currentRequest, cancellationRequested: task.cancellationRequested, status: task.status, previousRequest: task.previousRequest };
|
|
220
250
|
// Persist the operation before admission. A retry observes this intent; it never resends it.
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
task.cancellationRequested = false;
|
|
251
|
+
const intent = structuredClone(task);
|
|
252
|
+
Object.defineProperty(intent.operations, input.requestId, { value: fingerprint, enumerable: true, configurable: true, writable: true });
|
|
224
253
|
if (input.connectionId)
|
|
225
|
-
|
|
226
|
-
this.event(
|
|
227
|
-
await this.
|
|
254
|
+
intent.connectionId = input.connectionId;
|
|
255
|
+
this.event(intent, intent.status, 'Explicit continuation intent saved; the previous turn remains tracked during preparation.');
|
|
256
|
+
await this.replace(task, intent);
|
|
257
|
+
let phase = 'authorization';
|
|
228
258
|
try {
|
|
259
|
+
;
|
|
260
|
+
(await this.authorization(task.cwd, signal)).check(task.cwd);
|
|
261
|
+
phase = 'model';
|
|
229
262
|
await this.selectModel(task, input.modelSelection);
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
263
|
+
phase = 'authorization';
|
|
264
|
+
(await this.authorization(task.cwd, signal)).check(task.cwd);
|
|
265
|
+
const dispatch = structuredClone(task);
|
|
266
|
+
dispatch.previousRequest = task.previousRequest ?? task.currentRequest;
|
|
267
|
+
dispatch.currentRequest = randomUUID();
|
|
268
|
+
dispatch.cancellationRequested = false;
|
|
269
|
+
this.event(dispatch, 'starting', 'Continuation dispatch checkpoint saved. Admission is not yet confirmed.');
|
|
270
|
+
phase = 'persistence';
|
|
271
|
+
await this.replace(task, dispatch);
|
|
272
|
+
phase = 'authorization';
|
|
273
|
+
(await this.authorization(task.cwd, signal)).check(task.cwd);
|
|
274
|
+
phase = 'prompt';
|
|
237
275
|
await this.host.prompt(task.sessionId, task.currentRequest, input.prompt);
|
|
238
276
|
this.event(task, 'running', 'Continuation accepted by DSH.');
|
|
239
277
|
}
|
|
240
|
-
catch {
|
|
241
|
-
|
|
278
|
+
catch (error) {
|
|
279
|
+
if (phase === 'persistence')
|
|
280
|
+
throw error;
|
|
281
|
+
if (phase === 'prompt')
|
|
282
|
+
this.event(task, 'interrupted', 'Continuation admission could not be confirmed; no automatic retry.');
|
|
283
|
+
else {
|
|
284
|
+
Object.assign(task, previous);
|
|
285
|
+
if (!previous.previousRequest)
|
|
286
|
+
delete task.previousRequest;
|
|
287
|
+
this.event(task, previous.status, phase === 'model'
|
|
288
|
+
? 'Requested model or reasoning effort could not be selected. No prompt was sent.'
|
|
289
|
+
: `Continuation stopped (${error instanceof ConnectionError ? error.code : 'directory-unavailable'}). No prompt was sent.`);
|
|
290
|
+
}
|
|
242
291
|
}
|
|
243
292
|
await this.persist();
|
|
244
293
|
});
|
|
@@ -251,10 +300,12 @@ export class DelegatedTasks {
|
|
|
251
300
|
await this.refresh(task);
|
|
252
301
|
if (!activeTask(task.status) && task.status !== 'interrupted')
|
|
253
302
|
return;
|
|
254
|
-
|
|
303
|
+
this.enabled();
|
|
304
|
+
const cancellation = structuredClone(task);
|
|
305
|
+
cancellation.cancellationRequested = true;
|
|
255
306
|
this.approvals.withdraw(task.id, 'cancelled');
|
|
256
|
-
this.event(
|
|
257
|
-
await this.
|
|
307
|
+
this.event(cancellation, 'cancelling', 'Cancellation requested; waiting for the root and managed descendants to stop.');
|
|
308
|
+
await this.replace(task, cancellation);
|
|
258
309
|
try {
|
|
259
310
|
await this.host.cancel(task.sessionId);
|
|
260
311
|
}
|
|
@@ -273,12 +324,25 @@ export class DelegatedTasks {
|
|
|
273
324
|
return;
|
|
274
325
|
if (task.cancellationRequested)
|
|
275
326
|
await this.host.cancel(task.sessionId).catch(() => { });
|
|
276
|
-
|
|
327
|
+
let observation = await this.host.observe(task.sessionId, task.currentRequest, task.cancellationRequested);
|
|
328
|
+
let checkpointChanged = false;
|
|
329
|
+
if (task.previousRequest && observation.observation) {
|
|
330
|
+
if (observation.observation.lastEventSeq >= 0) {
|
|
331
|
+
delete task.previousRequest;
|
|
332
|
+
checkpointChanged = true;
|
|
333
|
+
}
|
|
334
|
+
else if (!task.cancellationRequested) {
|
|
335
|
+
const previous = await this.host.observe(task.sessionId, task.previousRequest);
|
|
336
|
+
observation = ['finished', 'failed', 'interrupted'].includes(previous.status)
|
|
337
|
+
? { ...previous, status: 'interrupted', detail: 'Continuation admission has not been confirmed; the previous turn settled. No automatic retry.' }
|
|
338
|
+
: previous;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
277
341
|
const status = task.cancellationRequested
|
|
278
342
|
? ['finished', 'interrupted', 'failed'].includes(observation.status) ? 'cancelled' : observation.status === 'unavailable' ? 'unavailable' : 'cancelling'
|
|
279
343
|
: observation.status;
|
|
280
344
|
const output = observation.status === 'unavailable' && !observation.output ? task.output : observation.output.slice(-12000);
|
|
281
|
-
const changed = task.output !== output || JSON.stringify(task.observation) !== JSON.stringify(observation.observation ?? task.observation);
|
|
345
|
+
const changed = checkpointChanged || task.output !== output || JSON.stringify(task.observation) !== JSON.stringify(observation.observation ?? task.observation);
|
|
282
346
|
task.output = output;
|
|
283
347
|
if (observation.observation)
|
|
284
348
|
task.observation = observation.observation;
|
|
@@ -309,7 +373,8 @@ export class DelegatedTasks {
|
|
|
309
373
|
});
|
|
310
374
|
}
|
|
311
375
|
async snapshot(id) {
|
|
312
|
-
return this.exclusive(async () => { const row = this.owned(id);
|
|
376
|
+
return this.exclusive(async () => { const row = this.owned(id); if (!this.closed)
|
|
377
|
+
await this.refresh(row); return structuredClone(row); });
|
|
313
378
|
}
|
|
314
379
|
async view(id, cursor) {
|
|
315
380
|
return this.describe(await this.snapshot(id), cursor);
|
|
@@ -380,7 +445,7 @@ export class DelegatedTasks {
|
|
|
380
445
|
async wait(id, cursor, waitMs, signal) {
|
|
381
446
|
const deadline = Date.now() + Math.min(Math.max(waitMs, 0), 30000);
|
|
382
447
|
let task = await this.snapshot(id);
|
|
383
|
-
while (activeTask(task.status) && task.status !== 'waiting_confirmation' && !this.approvals.pending(task.id).length && task.sequence <= cursor && Date.now() < deadline) {
|
|
448
|
+
while (!this.closed && activeTask(task.status) && task.status !== 'waiting_confirmation' && !this.approvals.pending(task.id).length && task.sequence <= cursor && Date.now() < deadline) {
|
|
384
449
|
signal?.throwIfAborted();
|
|
385
450
|
await pause(Math.min(1000, Math.max(1, deadline - Date.now())), undefined, { signal });
|
|
386
451
|
task = await this.snapshot(id);
|
|
@@ -388,6 +453,13 @@ export class DelegatedTasks {
|
|
|
388
453
|
// Git observations are needed once per response, not at every internal status poll.
|
|
389
454
|
return this.describe(task, cursor);
|
|
390
455
|
}
|
|
391
|
-
|
|
456
|
+
close() {
|
|
457
|
+
if (this.closing)
|
|
458
|
+
return this.closing;
|
|
459
|
+
this.closed = true;
|
|
460
|
+
this.approvals.withdraw();
|
|
461
|
+
this.closing = this.exclusive(() => this.persist());
|
|
462
|
+
return this.closing;
|
|
463
|
+
}
|
|
392
464
|
}
|
|
393
465
|
//# sourceMappingURL=tasks.js.map
|