@cjhyy/code-shell-server 0.9.21 → 0.9.22
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.
|
@@ -38,8 +38,11 @@ export type WorkerRpcOutcome = {
|
|
|
38
38
|
};
|
|
39
39
|
export interface WorkerRequestOptions {
|
|
40
40
|
/** Wire id for the frame. Caller mints it (must be unique while pending). */
|
|
41
|
-
id: string;
|
|
41
|
+
id: string | number;
|
|
42
42
|
timeoutMs: number;
|
|
43
|
+
/** For agent/run, timeout covers admission only. A matching runAccepted
|
|
44
|
+
* transfers ownership to completion/exit; requires failFast + settleOnExit. */
|
|
45
|
+
waitForRunCompletion?: boolean;
|
|
43
46
|
/**
|
|
44
47
|
* true: the matching response line is consumed here and NOT dispatched to
|
|
45
48
|
* line listeners (host-internal RPC, e.g. pet snapshots). false: the line
|
|
@@ -197,6 +197,11 @@ export class WorkerBridgeCore {
|
|
|
197
197
|
}
|
|
198
198
|
if (!msg || typeof msg !== "object" || Array.isArray(msg))
|
|
199
199
|
return false;
|
|
200
|
+
if (msg.method === "agent/runAccepted" &&
|
|
201
|
+
(typeof msg.params?.requestId === "string" || typeof msg.params?.requestId === "number")) {
|
|
202
|
+
this.pendingRequests.get(msg.params.requestId)?.acceptRun?.(msg.params.sessionId);
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
200
205
|
if (msg.id === undefined || msg.id === null)
|
|
201
206
|
return false;
|
|
202
207
|
const pending = this.pendingRequests.get(msg.id);
|
|
@@ -268,6 +273,13 @@ export class WorkerBridgeCore {
|
|
|
268
273
|
*/
|
|
269
274
|
request(method, params, options) {
|
|
270
275
|
const { id } = options;
|
|
276
|
+
if (options.waitForRunCompletion &&
|
|
277
|
+
(method !== "agent/run" || !options.failFast || !options.settleOnExit)) {
|
|
278
|
+
return Promise.resolve({
|
|
279
|
+
status: "sendFailed",
|
|
280
|
+
error: new Error("Completion tracking requires agent/run, failFast and settleOnExit"),
|
|
281
|
+
});
|
|
282
|
+
}
|
|
271
283
|
return new Promise((resolve) => {
|
|
272
284
|
let settled = false;
|
|
273
285
|
const settle = (outcome) => {
|
|
@@ -289,6 +301,16 @@ export class WorkerBridgeCore {
|
|
|
289
301
|
consume: options.consume === true,
|
|
290
302
|
settleOnExit: options.settleOnExit === true,
|
|
291
303
|
settle,
|
|
304
|
+
...(options.waitForRunCompletion
|
|
305
|
+
? {
|
|
306
|
+
acceptRun: (sessionId) => {
|
|
307
|
+
const expected = params?.sessionId;
|
|
308
|
+
if (typeof sessionId === "string" && (!expected || sessionId === expected)) {
|
|
309
|
+
clearTimeout(timer);
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
}
|
|
313
|
+
: {}),
|
|
292
314
|
});
|
|
293
315
|
let rawFrame;
|
|
294
316
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cjhyy/code-shell-server",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.22",
|
|
4
4
|
"description": "CodeShell server transport layer — mobile remote HTTP/WS host, pairing, passcode gate, tunnel, rooms, uploads, and session/attachment services. Electron-free; precursor of the auth gateway.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@cjhyy/code-shell-capability-coding": "0.9.
|
|
55
|
-
"@cjhyy/code-shell-core": "0.9.
|
|
56
|
-
"@cjhyy/code-shell-web": "0.9.
|
|
54
|
+
"@cjhyy/code-shell-capability-coding": "0.9.22",
|
|
55
|
+
"@cjhyy/code-shell-core": "0.9.22",
|
|
56
|
+
"@cjhyy/code-shell-web": "0.9.22",
|
|
57
57
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
58
58
|
"@types/ws": "^8.18.1",
|
|
59
59
|
"ws": "^8.21.0",
|
|
60
|
-
"@cjhyy/code-shell-link": "0.9.
|
|
60
|
+
"@cjhyy/code-shell-link": "0.9.22"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=20.10"
|