@agentclientprotocol/codex-acp 1.1.5 → 1.1.8
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/dist/index.js +914 -138
- package/package.json +8 -6
package/dist/index.js
CHANGED
|
@@ -18470,6 +18470,7 @@ var zToolCallUpdate = object({
|
|
|
18470
18470
|
kind: defaultOnError(zToolKind.nullish(), () => void 0),
|
|
18471
18471
|
status: defaultOnError(zToolCallStatus.nullish(), () => void 0),
|
|
18472
18472
|
title: defaultOnError(string2().nullish(), () => void 0),
|
|
18473
|
+
name: defaultOnError(string2().nullish(), () => void 0),
|
|
18473
18474
|
content: defaultOnError(vecSkipError(zToolCallContent).nullish(), () => void 0),
|
|
18474
18475
|
locations: defaultOnError(vecSkipError(zToolCallLocation).nullish(), () => void 0),
|
|
18475
18476
|
rawInput: defaultOnError(unknown().optional(), () => void 0),
|
|
@@ -19235,6 +19236,7 @@ var zContentChunk = object({
|
|
|
19235
19236
|
var zToolCall = object({
|
|
19236
19237
|
toolCallId: zToolCallId,
|
|
19237
19238
|
title: string2(),
|
|
19239
|
+
name: defaultOnError(string2().nullish(), () => void 0),
|
|
19238
19240
|
kind: defaultOnError(zToolKind.optional(), () => void 0),
|
|
19239
19241
|
status: defaultOnError(zToolCallStatus.optional(), () => void 0),
|
|
19240
19242
|
content: defaultOnError(vecSkipError(zToolCallContent).optional(), () => []),
|
|
@@ -19916,66 +19918,71 @@ var zCancelRequestNotification = object({
|
|
|
19916
19918
|
_meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
|
|
19917
19919
|
});
|
|
19918
19920
|
|
|
19919
|
-
// node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js
|
|
19920
|
-
function tagOf(value, key) {
|
|
19921
|
-
return typeof value === "object" && value !== null ? value[key] : void 0;
|
|
19922
|
-
}
|
|
19923
|
-
var zGuardCreateElicitationRequestForm = zElicitationFormMode.and(object({ mode: literal("form") })).and(object({ message: string2() }));
|
|
19924
|
-
var zGuardCreateElicitationRequestUrl = zElicitationUrlMode.and(object({ mode: literal("url") })).and(object({ message: string2() }));
|
|
19925
|
-
var zGuardCreateElicitationRequestCustom = union([zElicitationSessionScope, zElicitationRequestScope]).and(object({ message: string2() }));
|
|
19926
|
-
var zGuardElicitationPropertySchemaString = zStringPropertySchema.and(object({ type: literal("string") }));
|
|
19927
|
-
var zGuardElicitationPropertySchemaNumber = zNumberPropertySchema.and(object({ type: literal("number") }));
|
|
19928
|
-
var zGuardElicitationPropertySchemaInteger = zIntegerPropertySchema.and(object({ type: literal("integer") }));
|
|
19929
|
-
var zGuardElicitationPropertySchemaBoolean = zBooleanPropertySchema.and(object({ type: literal("boolean") }));
|
|
19930
|
-
var zGuardElicitationPropertySchemaArray = zMultiSelectPropertySchema.and(object({ type: literal("array") }));
|
|
19931
|
-
var zGuardMultiSelectItemsString = zStringMultiSelectItems.and(object({ type: literal("string") }));
|
|
19932
|
-
var zGuardCreateElicitationResponseAccept = zElicitationAcceptAction.and(object({ action: literal("accept") }));
|
|
19933
|
-
var zGuardCreateElicitationResponseDecline = object({
|
|
19934
|
-
action: literal("decline")
|
|
19935
|
-
});
|
|
19936
|
-
var zGuardCreateElicitationResponseCancel = object({
|
|
19937
|
-
action: literal("cancel")
|
|
19938
|
-
});
|
|
19939
|
-
var CreateElicitationResponse = {
|
|
19940
|
-
/** Narrow to the `accept` variant, validating its payload. */
|
|
19941
|
-
isAccept(value) {
|
|
19942
|
-
return tagOf(value, "action") === "accept" && zGuardCreateElicitationResponseAccept.safeParse(value).success;
|
|
19943
|
-
},
|
|
19944
|
-
/** Narrow to the `decline` variant, validating its payload. */
|
|
19945
|
-
isDecline(value) {
|
|
19946
|
-
return tagOf(value, "action") === "decline" && zGuardCreateElicitationResponseDecline.safeParse(value).success;
|
|
19947
|
-
},
|
|
19948
|
-
/** Narrow to the `cancel` variant, validating its payload. */
|
|
19949
|
-
isCancel(value) {
|
|
19950
|
-
return tagOf(value, "action") === "cancel" && zGuardCreateElicitationResponseCancel.safeParse(value).success;
|
|
19951
|
-
},
|
|
19952
|
-
/**
|
|
19953
|
-
* Narrow to a custom or future variant: the `action` tag matches no known variant.
|
|
19954
|
-
*
|
|
19955
|
-
* TypeScript keeps the known variants in the narrowed union (they are
|
|
19956
|
-
* structural subtypes of the catch-all), so read vendor payload keys
|
|
19957
|
-
* via a widening cast: `(value as Record<string, unknown>).someKey`.
|
|
19958
|
-
*/
|
|
19959
|
-
isCustom(value) {
|
|
19960
|
-
const tag = tagOf(value, "action");
|
|
19961
|
-
return typeof tag === "string" && !["accept", "cancel", "decline"].includes(tag);
|
|
19962
|
-
}
|
|
19963
|
-
};
|
|
19964
|
-
|
|
19965
19921
|
// node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js
|
|
19966
19922
|
var CANCEL_REQUEST_METHOD = "$/cancel_request";
|
|
19923
|
+
function isRequestMessage(value) {
|
|
19924
|
+
return isJsonRpcEnvelope(value) && "id" in value && typeof value["method"] === "string" && isJsonRpcId(value["id"]);
|
|
19925
|
+
}
|
|
19926
|
+
function isResponseMessage(value) {
|
|
19927
|
+
if (!isJsonRpcEnvelope(value) || "method" in value) {
|
|
19928
|
+
return false;
|
|
19929
|
+
}
|
|
19930
|
+
if (!("id" in value) || !isJsonRpcId(value["id"])) {
|
|
19931
|
+
return false;
|
|
19932
|
+
}
|
|
19933
|
+
const hasResult = Object.hasOwn(value, "result");
|
|
19934
|
+
const hasError = Object.hasOwn(value, "error");
|
|
19935
|
+
if (hasResult === hasError) {
|
|
19936
|
+
return false;
|
|
19937
|
+
}
|
|
19938
|
+
return !hasError || isErrorResponse(value["error"]);
|
|
19939
|
+
}
|
|
19940
|
+
function isNotificationMessage(value) {
|
|
19941
|
+
return isJsonRpcEnvelope(value) && !("id" in value) && typeof value["method"] === "string";
|
|
19942
|
+
}
|
|
19967
19943
|
function isRecord(value) {
|
|
19968
19944
|
return typeof value === "object" && value !== null;
|
|
19969
19945
|
}
|
|
19946
|
+
function isJsonRpcEnvelope(value) {
|
|
19947
|
+
return isRecord(value) && value["jsonrpc"] === "2.0";
|
|
19948
|
+
}
|
|
19970
19949
|
function isJsonRpcId(value) {
|
|
19971
19950
|
return value === null || typeof value === "string" || typeof value === "number" && Number.isFinite(value);
|
|
19972
19951
|
}
|
|
19952
|
+
function isResponseShapedMessage(value) {
|
|
19953
|
+
return isRecord(value) && !("method" in value) && ("id" in value || "result" in value || "error" in value);
|
|
19954
|
+
}
|
|
19955
|
+
function isResponseBatch(batch) {
|
|
19956
|
+
let hasValidCall = false;
|
|
19957
|
+
let hasValidResponse = false;
|
|
19958
|
+
let hasCallShape = false;
|
|
19959
|
+
let hasResponseShape = false;
|
|
19960
|
+
for (const entry of batch) {
|
|
19961
|
+
hasValidCall ||= isRequestMessage(entry) || isNotificationMessage(entry);
|
|
19962
|
+
hasValidResponse ||= isResponseMessage(entry);
|
|
19963
|
+
if (!isRecord(entry)) {
|
|
19964
|
+
continue;
|
|
19965
|
+
}
|
|
19966
|
+
hasCallShape ||= "method" in entry;
|
|
19967
|
+
hasResponseShape ||= "result" in entry || "error" in entry;
|
|
19968
|
+
}
|
|
19969
|
+
if (hasValidCall) {
|
|
19970
|
+
return false;
|
|
19971
|
+
}
|
|
19972
|
+
if (hasValidResponse) {
|
|
19973
|
+
return true;
|
|
19974
|
+
}
|
|
19975
|
+
return hasResponseShape && !hasCallShape;
|
|
19976
|
+
}
|
|
19973
19977
|
function cancelRequestId(params) {
|
|
19974
19978
|
if (!isRecord(params) || !isJsonRpcId(params["requestId"])) {
|
|
19975
19979
|
return void 0;
|
|
19976
19980
|
}
|
|
19977
19981
|
return params["requestId"];
|
|
19978
19982
|
}
|
|
19983
|
+
function isErrorResponse(value) {
|
|
19984
|
+
return isRecord(value) && typeof value["code"] === "number" && Number.isInteger(value["code"]) && typeof value["message"] === "string";
|
|
19985
|
+
}
|
|
19979
19986
|
var Handled = {
|
|
19980
19987
|
/**
|
|
19981
19988
|
* Marks a message as handled.
|
|
@@ -20135,6 +20142,12 @@ var ConnectionContext = class {
|
|
|
20135
20142
|
sendNotification(method, params) {
|
|
20136
20143
|
return this.connection.sendNotification(method, params);
|
|
20137
20144
|
}
|
|
20145
|
+
/**
|
|
20146
|
+
* Sends a non-empty JSON-RPC batch in one transport message.
|
|
20147
|
+
*/
|
|
20148
|
+
sendBatch(entries) {
|
|
20149
|
+
return this.connection.sendBatch(entries);
|
|
20150
|
+
}
|
|
20138
20151
|
/**
|
|
20139
20152
|
* Sends a protocol-level request cancellation notification.
|
|
20140
20153
|
*/
|
|
@@ -20173,6 +20186,7 @@ var Connection = class {
|
|
|
20173
20186
|
retryQueue = [];
|
|
20174
20187
|
context = new ConnectionContext(this);
|
|
20175
20188
|
receiveReader;
|
|
20189
|
+
allowBatches = true;
|
|
20176
20190
|
constructor(requestHandlerOrStream, notificationHandlerOrHandlers, streamOrOptions, options) {
|
|
20177
20191
|
if (typeof requestHandlerOrStream === "function") {
|
|
20178
20192
|
const requestHandler = requestHandlerOrStream;
|
|
@@ -20181,16 +20195,13 @@ var Connection = class {
|
|
|
20181
20195
|
this.initialize(stream2, [
|
|
20182
20196
|
...options?.handlers ?? [],
|
|
20183
20197
|
this.legacyHandler(requestHandler, notificationHandler)
|
|
20184
|
-
]);
|
|
20198
|
+
], options);
|
|
20185
20199
|
return;
|
|
20186
20200
|
}
|
|
20187
20201
|
const stream = requestHandlerOrStream;
|
|
20188
20202
|
const handlers = notificationHandlerOrHandlers;
|
|
20189
20203
|
const connectionOptions = streamOrOptions;
|
|
20190
|
-
this.initialize(stream, [
|
|
20191
|
-
...connectionOptions?.handlers ?? [],
|
|
20192
|
-
...handlers
|
|
20193
|
-
]);
|
|
20204
|
+
this.initialize(stream, [...connectionOptions?.handlers ?? [], ...handlers], connectionOptions);
|
|
20194
20205
|
}
|
|
20195
20206
|
/**
|
|
20196
20207
|
* Creates a builder for configuring a handler-based connection.
|
|
@@ -20264,15 +20275,89 @@ var Connection = class {
|
|
|
20264
20275
|
if (this.abortController.signal.aborted) {
|
|
20265
20276
|
return rejectedPromise(this.closedReason());
|
|
20266
20277
|
}
|
|
20278
|
+
const request = this.prepareRequest(method, params, mapResponse, options);
|
|
20279
|
+
const requestSent = this.sendWireMessage(request.message);
|
|
20280
|
+
void requestSent.catch(() => {
|
|
20281
|
+
});
|
|
20282
|
+
if (options.cancellationSignal?.aborted) {
|
|
20283
|
+
request.cancel();
|
|
20284
|
+
}
|
|
20285
|
+
return request.response;
|
|
20286
|
+
}
|
|
20287
|
+
/**
|
|
20288
|
+
* Sends a non-empty JSON-RPC batch in one transport message.
|
|
20289
|
+
*
|
|
20290
|
+
* Requests and notifications are processed independently by the peer. The
|
|
20291
|
+
* returned tuple preserves the input order: request entries resolve to their
|
|
20292
|
+
* mapped response, while notification entries resolve to `undefined`.
|
|
20293
|
+
*/
|
|
20294
|
+
sendBatch(entries) {
|
|
20295
|
+
if (this.abortController.signal.aborted) {
|
|
20296
|
+
return rejectedPromise(this.closedReason());
|
|
20297
|
+
}
|
|
20298
|
+
if (!this.allowBatches) {
|
|
20299
|
+
return rejectedPromise(new TypeError("JSON-RPC batches are not supported on this connection"));
|
|
20300
|
+
}
|
|
20301
|
+
if (entries.length === 0) {
|
|
20302
|
+
return rejectedPromise(new TypeError("JSON-RPC batch must contain at least one entry"));
|
|
20303
|
+
}
|
|
20304
|
+
const messages = [];
|
|
20305
|
+
const cancellations = [];
|
|
20306
|
+
const outputs = [];
|
|
20307
|
+
for (const entry of entries) {
|
|
20308
|
+
if (entry.kind === "notification") {
|
|
20309
|
+
messages.push({
|
|
20310
|
+
jsonrpc: "2.0",
|
|
20311
|
+
method: entry.method,
|
|
20312
|
+
params: entry.params
|
|
20313
|
+
});
|
|
20314
|
+
outputs.push(Promise.resolve(void 0));
|
|
20315
|
+
continue;
|
|
20316
|
+
}
|
|
20317
|
+
const request = this.prepareRequest(entry.method, entry.params, entry.mapResponse, entry.options);
|
|
20318
|
+
messages.push(request.message);
|
|
20319
|
+
outputs.push(request.response);
|
|
20320
|
+
cancellations.push({
|
|
20321
|
+
signal: entry.options?.cancellationSignal,
|
|
20322
|
+
cancel: request.cancel
|
|
20323
|
+
});
|
|
20324
|
+
}
|
|
20325
|
+
const batch = messages;
|
|
20326
|
+
const batchSent = this.sendWireMessage(batch);
|
|
20327
|
+
for (const cancellation of cancellations) {
|
|
20328
|
+
if (cancellation.signal?.aborted) {
|
|
20329
|
+
cancellation.cancel();
|
|
20330
|
+
}
|
|
20331
|
+
}
|
|
20332
|
+
const response = Promise.all([batchSent, ...outputs]).then(([, ...resolved]) => resolved);
|
|
20333
|
+
response.catch(() => {
|
|
20334
|
+
});
|
|
20335
|
+
return response;
|
|
20336
|
+
}
|
|
20337
|
+
/**
|
|
20338
|
+
* Sends a protocol-level request cancellation notification.
|
|
20339
|
+
*/
|
|
20340
|
+
sendCancelRequest(requestId) {
|
|
20341
|
+
return this.sendNotification(CANCEL_REQUEST_METHOD, { requestId });
|
|
20342
|
+
}
|
|
20343
|
+
/**
|
|
20344
|
+
* Sends a JSON-RPC notification.
|
|
20345
|
+
*/
|
|
20346
|
+
sendNotification(method, params) {
|
|
20347
|
+
if (this.abortController.signal.aborted) {
|
|
20348
|
+
return rejectedPromise(this.closedReason());
|
|
20349
|
+
}
|
|
20350
|
+
return this.sendWireMessage({ jsonrpc: "2.0", method, params });
|
|
20351
|
+
}
|
|
20352
|
+
prepareRequest(method, params, mapResponse, options = {}) {
|
|
20267
20353
|
const id = this.nextRequestId++;
|
|
20268
20354
|
let cancel = () => {
|
|
20269
20355
|
};
|
|
20270
|
-
const
|
|
20356
|
+
const response = new Promise((resolve, reject) => {
|
|
20271
20357
|
const pendingResponse = {
|
|
20272
|
-
resolve: (
|
|
20358
|
+
resolve: (value) => {
|
|
20273
20359
|
try {
|
|
20274
|
-
|
|
20275
|
-
resolve(value);
|
|
20360
|
+
resolve(mapResponse ? mapResponse(value) : value);
|
|
20276
20361
|
} catch (error51) {
|
|
20277
20362
|
reject(error51);
|
|
20278
20363
|
}
|
|
@@ -20296,35 +20381,13 @@ var Connection = class {
|
|
|
20296
20381
|
};
|
|
20297
20382
|
this.pendingResponses.set(id, pendingResponse);
|
|
20298
20383
|
});
|
|
20299
|
-
|
|
20300
|
-
});
|
|
20301
|
-
const requestSent = this.sendMessage({
|
|
20302
|
-
jsonrpc: "2.0",
|
|
20303
|
-
id,
|
|
20304
|
-
method,
|
|
20305
|
-
params
|
|
20384
|
+
response.catch(() => {
|
|
20306
20385
|
});
|
|
20307
|
-
|
|
20308
|
-
|
|
20309
|
-
|
|
20310
|
-
cancel()
|
|
20311
|
-
}
|
|
20312
|
-
return responsePromise;
|
|
20313
|
-
}
|
|
20314
|
-
/**
|
|
20315
|
-
* Sends a protocol-level request cancellation notification.
|
|
20316
|
-
*/
|
|
20317
|
-
sendCancelRequest(requestId) {
|
|
20318
|
-
return this.sendNotification(CANCEL_REQUEST_METHOD, { requestId });
|
|
20319
|
-
}
|
|
20320
|
-
/**
|
|
20321
|
-
* Sends a JSON-RPC notification.
|
|
20322
|
-
*/
|
|
20323
|
-
sendNotification(method, params) {
|
|
20324
|
-
if (this.abortController.signal.aborted) {
|
|
20325
|
-
return rejectedPromise(this.closedReason());
|
|
20326
|
-
}
|
|
20327
|
-
return this.sendMessage({ jsonrpc: "2.0", method, params });
|
|
20386
|
+
return {
|
|
20387
|
+
message: { jsonrpc: "2.0", id, method, params },
|
|
20388
|
+
response,
|
|
20389
|
+
cancel: () => cancel()
|
|
20390
|
+
};
|
|
20328
20391
|
}
|
|
20329
20392
|
/**
|
|
20330
20393
|
* Closes the connection and rejects pending requests.
|
|
@@ -20347,9 +20410,10 @@ var Connection = class {
|
|
|
20347
20410
|
void this.receiveReader?.cancel(closeError).catch(() => {
|
|
20348
20411
|
});
|
|
20349
20412
|
}
|
|
20350
|
-
initialize(stream, handlers) {
|
|
20413
|
+
initialize(stream, handlers, options) {
|
|
20351
20414
|
this.stream = stream;
|
|
20352
20415
|
this.staticHandlers = handlers;
|
|
20416
|
+
this.allowBatches = options?.allowBatches ?? true;
|
|
20353
20417
|
this.closedPromise = new Promise((resolve) => {
|
|
20354
20418
|
this.abortController.signal.addEventListener("abort", () => resolve());
|
|
20355
20419
|
});
|
|
@@ -20385,7 +20449,7 @@ var Connection = class {
|
|
|
20385
20449
|
if (!message) {
|
|
20386
20450
|
continue;
|
|
20387
20451
|
}
|
|
20388
|
-
this.
|
|
20452
|
+
this.receiveWireMessage(message);
|
|
20389
20453
|
}
|
|
20390
20454
|
} finally {
|
|
20391
20455
|
if (this.receiveReader === reader) {
|
|
@@ -20399,24 +20463,93 @@ var Connection = class {
|
|
|
20399
20463
|
this.close(closeError);
|
|
20400
20464
|
}
|
|
20401
20465
|
}
|
|
20402
|
-
|
|
20403
|
-
if (
|
|
20466
|
+
receiveWireMessage(message) {
|
|
20467
|
+
if (Array.isArray(message)) {
|
|
20468
|
+
if (!this.allowBatches) {
|
|
20469
|
+
this.close(new TypeError("JSON-RPC batches are not supported on this connection"));
|
|
20470
|
+
return;
|
|
20471
|
+
}
|
|
20472
|
+
this.receiveBatch(message);
|
|
20404
20473
|
return;
|
|
20405
20474
|
}
|
|
20406
20475
|
if (!isRecord(message)) {
|
|
20407
20476
|
console.error("Invalid message", { message });
|
|
20408
20477
|
return;
|
|
20409
20478
|
}
|
|
20479
|
+
this.receiveMessage(message);
|
|
20480
|
+
}
|
|
20481
|
+
receiveBatch(batch) {
|
|
20482
|
+
if (batch.length === 0) {
|
|
20483
|
+
void this.sendWireMessage({
|
|
20484
|
+
jsonrpc: "2.0",
|
|
20485
|
+
id: null,
|
|
20486
|
+
error: RequestError.invalidRequest(batch).toErrorResponse()
|
|
20487
|
+
}).catch(() => {
|
|
20488
|
+
});
|
|
20489
|
+
return;
|
|
20490
|
+
}
|
|
20491
|
+
const responseBatch = isResponseBatch(batch);
|
|
20492
|
+
const responseCount = responseBatch ? 0 : batch.reduce((count, message) => count + (isNotificationMessage(message) ? 0 : 1), 0);
|
|
20493
|
+
let remaining = responseCount;
|
|
20494
|
+
let remainingNotifications = batch.reduce((count, message) => count + (isNotificationMessage(message) ? 1 : 0), 0);
|
|
20495
|
+
let responseSent = false;
|
|
20496
|
+
const responses = [];
|
|
20497
|
+
const sendResponsesIfReady = async () => {
|
|
20498
|
+
if (responseSent || remaining !== 0 || remainingNotifications !== 0 || responses.length === 0) {
|
|
20499
|
+
return;
|
|
20500
|
+
}
|
|
20501
|
+
responseSent = true;
|
|
20502
|
+
await this.sendWireMessage(responses);
|
|
20503
|
+
};
|
|
20504
|
+
const collectResponse = async (response) => {
|
|
20505
|
+
responses.push(response);
|
|
20506
|
+
remaining -= 1;
|
|
20507
|
+
await sendResponsesIfReady();
|
|
20508
|
+
};
|
|
20509
|
+
for (const message of batch) {
|
|
20510
|
+
if (responseBatch) {
|
|
20511
|
+
if (isResponseShapedMessage(message)) {
|
|
20512
|
+
this.receiveMessage(message);
|
|
20513
|
+
}
|
|
20514
|
+
continue;
|
|
20515
|
+
}
|
|
20516
|
+
if (!isRequestMessage(message) && !isNotificationMessage(message)) {
|
|
20517
|
+
void collectResponse({
|
|
20518
|
+
jsonrpc: "2.0",
|
|
20519
|
+
id: null,
|
|
20520
|
+
error: RequestError.invalidRequest(message).toErrorResponse()
|
|
20521
|
+
}).catch(() => {
|
|
20522
|
+
});
|
|
20523
|
+
continue;
|
|
20524
|
+
}
|
|
20525
|
+
const processing = this.receiveMessage(message, isRequestMessage(message) ? collectResponse : void 0);
|
|
20526
|
+
if (isNotificationMessage(message)) {
|
|
20527
|
+
void processing.finally(() => {
|
|
20528
|
+
remainingNotifications -= 1;
|
|
20529
|
+
void sendResponsesIfReady().catch((error51) => this.close(error51));
|
|
20530
|
+
});
|
|
20531
|
+
}
|
|
20532
|
+
}
|
|
20533
|
+
}
|
|
20534
|
+
receiveMessage(message, sendResponse) {
|
|
20535
|
+
if (this.abortController.signal.aborted) {
|
|
20536
|
+
return Promise.resolve();
|
|
20537
|
+
}
|
|
20538
|
+
if (!isRecord(message)) {
|
|
20539
|
+
console.error("Invalid message", { message });
|
|
20540
|
+
return Promise.resolve();
|
|
20541
|
+
}
|
|
20410
20542
|
if ("method" in message) {
|
|
20411
20543
|
if (!("id" in message)) {
|
|
20412
20544
|
this.handleProtocolNotification(message);
|
|
20413
20545
|
}
|
|
20414
|
-
|
|
20546
|
+
return this.processIncomingMessage(this.toIncomingMessage(message, sendResponse)).catch((error51) => this.close(error51));
|
|
20415
20547
|
} else if ("id" in message) {
|
|
20416
20548
|
this.handleResponse(message);
|
|
20417
20549
|
} else {
|
|
20418
20550
|
console.error("Invalid message", { message });
|
|
20419
20551
|
}
|
|
20552
|
+
return Promise.resolve();
|
|
20420
20553
|
}
|
|
20421
20554
|
async processIncomingMessage(message) {
|
|
20422
20555
|
if (this.abortController.signal.aborted) {
|
|
@@ -20460,7 +20593,7 @@ var Connection = class {
|
|
|
20460
20593
|
}
|
|
20461
20594
|
}
|
|
20462
20595
|
}
|
|
20463
|
-
toIncomingMessage(message) {
|
|
20596
|
+
toIncomingMessage(message, sendResponse) {
|
|
20464
20597
|
if ("id" in message) {
|
|
20465
20598
|
const abortController = new AbortController();
|
|
20466
20599
|
this.incomingRequests.set(message.id, abortController);
|
|
@@ -20475,11 +20608,14 @@ var Connection = class {
|
|
|
20475
20608
|
params: message.params,
|
|
20476
20609
|
raw: message,
|
|
20477
20610
|
signal: abortController.signal,
|
|
20478
|
-
responder: new RequestResponder(message.id, (result) =>
|
|
20479
|
-
|
|
20480
|
-
|
|
20481
|
-
|
|
20482
|
-
|
|
20611
|
+
responder: new RequestResponder(message.id, (result) => {
|
|
20612
|
+
const response = {
|
|
20613
|
+
jsonrpc: "2.0",
|
|
20614
|
+
id: message.id,
|
|
20615
|
+
...result
|
|
20616
|
+
};
|
|
20617
|
+
return sendResponse ? sendResponse(response) : this.sendWireMessage(response);
|
|
20618
|
+
}, abortController.signal, finishRequest)
|
|
20483
20619
|
};
|
|
20484
20620
|
}
|
|
20485
20621
|
return {
|
|
@@ -20494,13 +20630,13 @@ var Connection = class {
|
|
|
20494
20630
|
if (pendingResponse) {
|
|
20495
20631
|
this.pendingResponses.delete(response.id);
|
|
20496
20632
|
pendingResponse.cleanup?.();
|
|
20497
|
-
if (
|
|
20633
|
+
if (!isResponseMessage(response)) {
|
|
20634
|
+
pendingResponse.reject(RequestError.invalidRequest(response));
|
|
20635
|
+
} else if ("result" in response) {
|
|
20498
20636
|
pendingResponse.resolve(response.result);
|
|
20499
|
-
} else
|
|
20637
|
+
} else {
|
|
20500
20638
|
const { code, message, data } = response.error;
|
|
20501
20639
|
pendingResponse.reject(new RequestError(code, message, data));
|
|
20502
|
-
} else {
|
|
20503
|
-
pendingResponse.reject(RequestError.invalidRequest(response));
|
|
20504
20640
|
}
|
|
20505
20641
|
} else {
|
|
20506
20642
|
console.error("Got response to unknown request", response.id);
|
|
@@ -20523,7 +20659,7 @@ var Connection = class {
|
|
|
20523
20659
|
closedReason() {
|
|
20524
20660
|
return this.abortController.signal.reason ?? new Error("ACP connection closed");
|
|
20525
20661
|
}
|
|
20526
|
-
async
|
|
20662
|
+
async sendWireMessage(message) {
|
|
20527
20663
|
if (this.abortController.signal.aborted) {
|
|
20528
20664
|
return rejectedPromise(this.closedReason());
|
|
20529
20665
|
}
|
|
@@ -20769,7 +20905,7 @@ function ndJsonStream(output, input) {
|
|
|
20769
20905
|
if (trimmedLine) {
|
|
20770
20906
|
try {
|
|
20771
20907
|
const message = JSON.parse(trimmedLine);
|
|
20772
|
-
if (isRecord(message)) {
|
|
20908
|
+
if (isRecord(message) || Array.isArray(message)) {
|
|
20773
20909
|
controller.enqueue(message);
|
|
20774
20910
|
} else {
|
|
20775
20911
|
console.warn("Skipping JSON line that is not an object:", trimmedLine);
|
|
@@ -20843,7 +20979,56 @@ function ndJsonStream(output, input) {
|
|
|
20843
20979
|
return { readable, writable };
|
|
20844
20980
|
}
|
|
20845
20981
|
|
|
20982
|
+
// node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js
|
|
20983
|
+
function tagOf(value, key) {
|
|
20984
|
+
return typeof value === "object" && value !== null ? value[key] : void 0;
|
|
20985
|
+
}
|
|
20986
|
+
var zGuardCreateElicitationRequestForm = zElicitationFormMode.and(object({ mode: literal("form") })).and(object({ message: string2() }));
|
|
20987
|
+
var zGuardCreateElicitationRequestUrl = zElicitationUrlMode.and(object({ mode: literal("url") })).and(object({ message: string2() }));
|
|
20988
|
+
var zGuardCreateElicitationRequestCustom = union([zElicitationSessionScope, zElicitationRequestScope]).and(object({ message: string2() }));
|
|
20989
|
+
var zGuardElicitationPropertySchemaString = zStringPropertySchema.and(object({ type: literal("string") }));
|
|
20990
|
+
var zGuardElicitationPropertySchemaNumber = zNumberPropertySchema.and(object({ type: literal("number") }));
|
|
20991
|
+
var zGuardElicitationPropertySchemaInteger = zIntegerPropertySchema.and(object({ type: literal("integer") }));
|
|
20992
|
+
var zGuardElicitationPropertySchemaBoolean = zBooleanPropertySchema.and(object({ type: literal("boolean") }));
|
|
20993
|
+
var zGuardElicitationPropertySchemaArray = zMultiSelectPropertySchema.and(object({ type: literal("array") }));
|
|
20994
|
+
var zGuardMultiSelectItemsString = zStringMultiSelectItems.and(object({ type: literal("string") }));
|
|
20995
|
+
var zGuardCreateElicitationResponseAccept = zElicitationAcceptAction.and(object({ action: literal("accept") }));
|
|
20996
|
+
var zGuardCreateElicitationResponseDecline = object({
|
|
20997
|
+
action: literal("decline")
|
|
20998
|
+
});
|
|
20999
|
+
var zGuardCreateElicitationResponseCancel = object({
|
|
21000
|
+
action: literal("cancel")
|
|
21001
|
+
});
|
|
21002
|
+
var CreateElicitationResponse = {
|
|
21003
|
+
/** Narrow to the `accept` variant, validating its payload. */
|
|
21004
|
+
isAccept(value) {
|
|
21005
|
+
return tagOf(value, "action") === "accept" && zGuardCreateElicitationResponseAccept.safeParse(value).success;
|
|
21006
|
+
},
|
|
21007
|
+
/** Narrow to the `decline` variant, validating its payload. */
|
|
21008
|
+
isDecline(value) {
|
|
21009
|
+
return tagOf(value, "action") === "decline" && zGuardCreateElicitationResponseDecline.safeParse(value).success;
|
|
21010
|
+
},
|
|
21011
|
+
/** Narrow to the `cancel` variant, validating its payload. */
|
|
21012
|
+
isCancel(value) {
|
|
21013
|
+
return tagOf(value, "action") === "cancel" && zGuardCreateElicitationResponseCancel.safeParse(value).success;
|
|
21014
|
+
},
|
|
21015
|
+
/**
|
|
21016
|
+
* Narrow to a custom or future variant: the `action` tag matches no known variant.
|
|
21017
|
+
*
|
|
21018
|
+
* TypeScript keeps the known variants in the narrowed union (they are
|
|
21019
|
+
* structural subtypes of the catch-all), so read vendor payload keys
|
|
21020
|
+
* via a widening cast: `(value as Record<string, unknown>).someKey`.
|
|
21021
|
+
*/
|
|
21022
|
+
isCustom(value) {
|
|
21023
|
+
const tag = tagOf(value, "action");
|
|
21024
|
+
return typeof tag === "string" && !["accept", "cancel", "decline"].includes(tag);
|
|
21025
|
+
}
|
|
21026
|
+
};
|
|
21027
|
+
|
|
20846
21028
|
// node_modules/@agentclientprotocol/sdk/dist/acp.js
|
|
21029
|
+
function ndJsonStream2(output, input) {
|
|
21030
|
+
return ndJsonStream(output, input);
|
|
21031
|
+
}
|
|
20847
21032
|
function emptyObjectResponse(response) {
|
|
20848
21033
|
return response ?? {};
|
|
20849
21034
|
}
|
|
@@ -21505,6 +21690,7 @@ function runConnectHandlers(connection, handlers) {
|
|
|
21505
21690
|
var appBuilder = /* @__PURE__ */ Symbol("appBuilder");
|
|
21506
21691
|
var runAgentConnectHandlers = /* @__PURE__ */ Symbol("runAgentConnectHandlers");
|
|
21507
21692
|
var runClientConnectHandlers = /* @__PURE__ */ Symbol("runClientConnectHandlers");
|
|
21693
|
+
var stableConnectionOptions = { allowBatches: false };
|
|
21508
21694
|
function agent(options) {
|
|
21509
21695
|
return new AgentApp(options);
|
|
21510
21696
|
}
|
|
@@ -21578,7 +21764,7 @@ var AgentApp = class {
|
|
|
21578
21764
|
return state2;
|
|
21579
21765
|
}
|
|
21580
21766
|
const [thisStream, peerStream] = memoryStreamPair();
|
|
21581
|
-
const peerRawConnection = target[appBuilder]().connect(peerStream);
|
|
21767
|
+
const peerRawConnection = target[appBuilder]().connect(peerStream, stableConnectionOptions);
|
|
21582
21768
|
const peerConnection = clientConnection(peerRawConnection);
|
|
21583
21769
|
const state = this.openStreamConnection(thisStream);
|
|
21584
21770
|
void state.rawConnection.closed.then(() => peerConnection.close());
|
|
@@ -21594,7 +21780,7 @@ var AgentApp = class {
|
|
|
21594
21780
|
return state;
|
|
21595
21781
|
}
|
|
21596
21782
|
openStreamConnection(stream) {
|
|
21597
|
-
const rawConnection = this.builder.connect(stream);
|
|
21783
|
+
const rawConnection = this.builder.connect(stream, stableConnectionOptions);
|
|
21598
21784
|
return {
|
|
21599
21785
|
rawConnection,
|
|
21600
21786
|
connection: agentConnection(rawConnection, this.connectHandlers)
|
|
@@ -21673,7 +21859,7 @@ var ClientApp = class {
|
|
|
21673
21859
|
return state2;
|
|
21674
21860
|
}
|
|
21675
21861
|
const [thisStream, peerStream] = memoryStreamPair();
|
|
21676
|
-
const peerRawConnection = target[appBuilder]().connect(peerStream);
|
|
21862
|
+
const peerRawConnection = target[appBuilder]().connect(peerStream, stableConnectionOptions);
|
|
21677
21863
|
const peerConnection = agentConnection(peerRawConnection);
|
|
21678
21864
|
const state = this.openStreamConnection(thisStream);
|
|
21679
21865
|
void state.rawConnection.closed.then(() => peerConnection.close());
|
|
@@ -21689,7 +21875,7 @@ var ClientApp = class {
|
|
|
21689
21875
|
return state;
|
|
21690
21876
|
}
|
|
21691
21877
|
openStreamConnection(stream) {
|
|
21692
|
-
const rawConnection = this.builder.connect(stream);
|
|
21878
|
+
const rawConnection = this.builder.connect(stream, stableConnectionOptions);
|
|
21693
21879
|
return {
|
|
21694
21880
|
rawConnection,
|
|
21695
21881
|
connection: clientConnection(rawConnection, this.connectHandlers)
|
|
@@ -21811,7 +21997,7 @@ function createJSONRPCReader(readable) {
|
|
|
21811
21997
|
function createJsonStream(readable, writable) {
|
|
21812
21998
|
const input = Writable.toWeb(writable);
|
|
21813
21999
|
const output = Readable.toWeb(readable);
|
|
21814
|
-
return
|
|
22000
|
+
return ndJsonStream2(input, output);
|
|
21815
22001
|
}
|
|
21816
22002
|
|
|
21817
22003
|
// src/Logger.ts
|
|
@@ -22858,7 +23044,7 @@ function createWebSearchStartUpdate(item) {
|
|
|
22858
23044
|
kind: "search",
|
|
22859
23045
|
title: formatWebSearchTitle(item),
|
|
22860
23046
|
status: "in_progress",
|
|
22861
|
-
rawInput: item
|
|
23047
|
+
rawInput: createWebSearchRawInput(item)
|
|
22862
23048
|
};
|
|
22863
23049
|
}
|
|
22864
23050
|
function createWebSearchCompleteUpdate(item) {
|
|
@@ -22867,7 +23053,15 @@ function createWebSearchCompleteUpdate(item) {
|
|
|
22867
23053
|
toolCallId: item.id,
|
|
22868
23054
|
title: formatWebSearchTitle(item),
|
|
22869
23055
|
status: "completed",
|
|
22870
|
-
rawInput: item
|
|
23056
|
+
rawInput: createWebSearchRawInput(item)
|
|
23057
|
+
};
|
|
23058
|
+
}
|
|
23059
|
+
function createWebSearchRawInput(item) {
|
|
23060
|
+
return {
|
|
23061
|
+
type: item.type,
|
|
23062
|
+
id: item.id,
|
|
23063
|
+
query: item.query,
|
|
23064
|
+
action: item.action
|
|
22871
23065
|
};
|
|
22872
23066
|
}
|
|
22873
23067
|
function createCollabAgentToolCallUpdate(item) {
|
|
@@ -23364,9 +23558,10 @@ function createAgentTextThoughtChunk(text, messageId, meta3) {
|
|
|
23364
23558
|
|
|
23365
23559
|
// src/AcpExtensions.ts
|
|
23366
23560
|
var LEGACY_SET_SESSION_MODEL_METHOD = "session/set_model";
|
|
23561
|
+
var SESSION_STEERING_METHOD = "_session/steering";
|
|
23367
23562
|
var GOAL_CONTROL_METHOD = "_codex/session/goal_control";
|
|
23368
23563
|
function isExtMethodRequest(request) {
|
|
23369
|
-
return request.method === "authentication/status" || request.method === "authentication/logout" || request.method === LEGACY_SET_SESSION_MODEL_METHOD || request.method === GOAL_CONTROL_METHOD;
|
|
23564
|
+
return request.method === "authentication/status" || request.method === "authentication/logout" || request.method === LEGACY_SET_SESSION_MODEL_METHOD || request.method === GOAL_CONTROL_METHOD || request.method === SESSION_STEERING_METHOD;
|
|
23370
23565
|
}
|
|
23371
23566
|
|
|
23372
23567
|
// src/ThreadGoalSnapshot.ts
|
|
@@ -23390,23 +23585,32 @@ function sameThreadGoalSnapshot(left, right) {
|
|
|
23390
23585
|
var CodexEventHandler = class {
|
|
23391
23586
|
connection;
|
|
23392
23587
|
sessionState;
|
|
23588
|
+
supportsPlanUpdates;
|
|
23393
23589
|
failure = null;
|
|
23590
|
+
completedPlan = null;
|
|
23394
23591
|
activeFuzzyFileSearchSessions = /* @__PURE__ */ new Set();
|
|
23395
23592
|
activeGuardianApprovalReviews = /* @__PURE__ */ new Set();
|
|
23396
23593
|
activeImageGenerationItems = /* @__PURE__ */ new Set();
|
|
23397
23594
|
emittedImageViewItems = /* @__PURE__ */ new Set();
|
|
23595
|
+
planDeltaTextByItemId = /* @__PURE__ */ new Map();
|
|
23398
23596
|
seenReasoningDeltaItemIds = /* @__PURE__ */ new Set();
|
|
23399
23597
|
terminalCommandIds = /* @__PURE__ */ new Set();
|
|
23400
23598
|
terminalCommandOutputIds = /* @__PURE__ */ new Set();
|
|
23401
23599
|
agentMessagePhases = /* @__PURE__ */ new Map();
|
|
23402
23600
|
activeSubAgentActivities = /* @__PURE__ */ new Set();
|
|
23403
|
-
constructor(connection, sessionState) {
|
|
23601
|
+
constructor(connection, sessionState, supportsPlanUpdates = false) {
|
|
23404
23602
|
this.connection = connection;
|
|
23405
23603
|
this.sessionState = sessionState;
|
|
23604
|
+
this.supportsPlanUpdates = supportsPlanUpdates;
|
|
23406
23605
|
}
|
|
23407
23606
|
getFailure() {
|
|
23408
23607
|
return this.failure;
|
|
23409
23608
|
}
|
|
23609
|
+
takeCompletedPlan() {
|
|
23610
|
+
const plan = this.completedPlan;
|
|
23611
|
+
this.completedPlan = null;
|
|
23612
|
+
return plan;
|
|
23613
|
+
}
|
|
23410
23614
|
async handleNotification(notification) {
|
|
23411
23615
|
const session = new ACPSessionConnection(this.connection, this.sessionState.sessionId);
|
|
23412
23616
|
const updateEvent = await this.createUpdateEvent(notification);
|
|
@@ -23418,6 +23622,8 @@ var CodexEventHandler = class {
|
|
|
23418
23622
|
switch (notification.method) {
|
|
23419
23623
|
case "item/agentMessage/delta":
|
|
23420
23624
|
return await this.createTextEvent(notification.params);
|
|
23625
|
+
case "item/plan/delta":
|
|
23626
|
+
return this.createPlanDeltaEvent(notification.params);
|
|
23421
23627
|
case "item/started":
|
|
23422
23628
|
return await this.createItemEvent(notification.params);
|
|
23423
23629
|
case "item/completed":
|
|
@@ -23496,6 +23702,8 @@ var CodexEventHandler = class {
|
|
|
23496
23702
|
return this.createTerminalInteractionEvent(notification.params);
|
|
23497
23703
|
// ignored events
|
|
23498
23704
|
case "thread/deleted":
|
|
23705
|
+
case "thread/environment/connected":
|
|
23706
|
+
case "thread/environment/disconnected":
|
|
23499
23707
|
case "command/exec/outputDelta":
|
|
23500
23708
|
case "hook/started":
|
|
23501
23709
|
case "hook/completed":
|
|
@@ -23525,8 +23733,8 @@ var CodexEventHandler = class {
|
|
|
23525
23733
|
case "mcpServer/oauthLogin/completed":
|
|
23526
23734
|
case "externalAgentConfig/import/completed":
|
|
23527
23735
|
case "rawResponseItem/completed":
|
|
23736
|
+
case "rawResponse/completed":
|
|
23528
23737
|
case "thread/started":
|
|
23529
|
-
case "item/plan/delta":
|
|
23530
23738
|
case "remoteControl/status/changed":
|
|
23531
23739
|
case "app/list/updated":
|
|
23532
23740
|
case "thread/settings/updated":
|
|
@@ -23591,6 +23799,15 @@ ${event.details}` : "";
|
|
|
23591
23799
|
this.seenReasoningDeltaItemIds.add(event.itemId);
|
|
23592
23800
|
return this.createAgentThoughtEvent(event.delta, event.itemId);
|
|
23593
23801
|
}
|
|
23802
|
+
createPlanDeltaEvent(event) {
|
|
23803
|
+
if (event.delta.length === 0) {
|
|
23804
|
+
return null;
|
|
23805
|
+
}
|
|
23806
|
+
const text = this.planDeltaTextByItemId.get(event.itemId) ?? "";
|
|
23807
|
+
const updatedText = text + event.delta;
|
|
23808
|
+
this.planDeltaTextByItemId.set(event.itemId, updatedText);
|
|
23809
|
+
return this.supportsPlanUpdates ? this.createPlanUpdateEvent(updatedText, event.itemId) : null;
|
|
23810
|
+
}
|
|
23594
23811
|
createReasoningSectionBreakEvent(event) {
|
|
23595
23812
|
this.seenReasoningDeltaItemIds.add(event.itemId);
|
|
23596
23813
|
return this.createAgentThoughtEvent("\n\n", event.itemId);
|
|
@@ -23684,6 +23901,11 @@ ${event.details}` : "";
|
|
|
23684
23901
|
case "agentMessage":
|
|
23685
23902
|
this.rememberAgentMessagePhase(event.item);
|
|
23686
23903
|
return null;
|
|
23904
|
+
case "plan": {
|
|
23905
|
+
const deltaText = this.planDeltaTextByItemId.get(event.item.id) ?? "";
|
|
23906
|
+
this.planDeltaTextByItemId.delete(event.item.id);
|
|
23907
|
+
return this.createCompletedPlanEvent(event.item, deltaText);
|
|
23908
|
+
}
|
|
23687
23909
|
case "exitedReviewMode":
|
|
23688
23910
|
return this.createExitedReviewModeEvent(event.item);
|
|
23689
23911
|
case "contextCompaction":
|
|
@@ -23697,7 +23919,6 @@ ${event.details}` : "";
|
|
|
23697
23919
|
case "userMessage":
|
|
23698
23920
|
case "hookPrompt":
|
|
23699
23921
|
case "enteredReviewMode":
|
|
23700
|
-
case "plan":
|
|
23701
23922
|
return null;
|
|
23702
23923
|
}
|
|
23703
23924
|
}
|
|
@@ -23712,6 +23933,31 @@ ${event.details}` : "";
|
|
|
23712
23933
|
}
|
|
23713
23934
|
return this.createAgentThoughtEvent(text, item.id);
|
|
23714
23935
|
}
|
|
23936
|
+
createCompletedPlanEvent(item, deltaText) {
|
|
23937
|
+
const text = item.text.length > 0 ? item.text : deltaText;
|
|
23938
|
+
if (text.length === 0) {
|
|
23939
|
+
return null;
|
|
23940
|
+
}
|
|
23941
|
+
this.completedPlan = { itemId: item.id, text };
|
|
23942
|
+
return this.supportsPlanUpdates ? this.createPlanUpdateEvent(text, item.id) : this.createPlanTextEvent(text, item.id);
|
|
23943
|
+
}
|
|
23944
|
+
createPlanUpdateEvent(text, planId) {
|
|
23945
|
+
return {
|
|
23946
|
+
sessionUpdate: "plan_update",
|
|
23947
|
+
plan: {
|
|
23948
|
+
type: "markdown",
|
|
23949
|
+
planId,
|
|
23950
|
+
content: text
|
|
23951
|
+
}
|
|
23952
|
+
};
|
|
23953
|
+
}
|
|
23954
|
+
createPlanTextEvent(text, messageId) {
|
|
23955
|
+
return createAgentTextMessageChunk(
|
|
23956
|
+
text,
|
|
23957
|
+
messageId,
|
|
23958
|
+
createCodexMessagePhaseMeta("final_answer")
|
|
23959
|
+
);
|
|
23960
|
+
}
|
|
23715
23961
|
createExitedReviewModeEvent(item) {
|
|
23716
23962
|
const text = item.review.trim();
|
|
23717
23963
|
if (text.length === 0) {
|
|
@@ -23956,12 +24202,17 @@ var ApprovalOptionId = {
|
|
|
23956
24202
|
};
|
|
23957
24203
|
|
|
23958
24204
|
// src/CodexApprovalHandler.ts
|
|
23959
|
-
function permissionOption(optionId, name, kind, codexMeta) {
|
|
24205
|
+
function permissionOption(optionId, name, kind, codexMeta, permission) {
|
|
23960
24206
|
return {
|
|
23961
24207
|
optionId,
|
|
23962
24208
|
name,
|
|
23963
24209
|
kind,
|
|
23964
|
-
...codexMeta
|
|
24210
|
+
...codexMeta || permission ? {
|
|
24211
|
+
_meta: {
|
|
24212
|
+
...permission ? { permission } : {},
|
|
24213
|
+
...codexMeta ? { codex: codexMeta } : {}
|
|
24214
|
+
}
|
|
24215
|
+
} : {}
|
|
23965
24216
|
};
|
|
23966
24217
|
}
|
|
23967
24218
|
var CodexApprovalHandler = class {
|
|
@@ -24068,13 +24319,15 @@ var CodexApprovalHandler = class {
|
|
|
24068
24319
|
ApprovalOptionId.AllowPermissionsForSession,
|
|
24069
24320
|
"Allow for Session",
|
|
24070
24321
|
"allow_always",
|
|
24071
|
-
{ decision: "allowPermissionsForSession", permissions: params.permissions }
|
|
24322
|
+
{ decision: "allowPermissionsForSession", permissions: params.permissions },
|
|
24323
|
+
this.permissionGrantMetadata(params.permissions, "session")
|
|
24072
24324
|
),
|
|
24073
24325
|
permissionOption(
|
|
24074
24326
|
ApprovalOptionId.AllowPermissionsForTurn,
|
|
24075
24327
|
"Allow Once",
|
|
24076
24328
|
"allow_once",
|
|
24077
|
-
{ decision: "allowPermissionsForTurn", permissions: params.permissions }
|
|
24329
|
+
{ decision: "allowPermissionsForTurn", permissions: params.permissions },
|
|
24330
|
+
this.permissionGrantMetadata(params.permissions, "turn")
|
|
24078
24331
|
),
|
|
24079
24332
|
permissionOption(
|
|
24080
24333
|
ApprovalOptionId.RejectPermissions,
|
|
@@ -24136,7 +24389,24 @@ var CodexApprovalHandler = class {
|
|
|
24136
24389
|
ApprovalOptionId.AllowAlways,
|
|
24137
24390
|
params.networkApprovalContext ? "Allow Host for Session" : "Allow for Session",
|
|
24138
24391
|
"allow_always",
|
|
24139
|
-
{ decision: "acceptForSession" }
|
|
24392
|
+
{ decision: "acceptForSession" },
|
|
24393
|
+
params.networkApprovalContext ? {
|
|
24394
|
+
version: 1,
|
|
24395
|
+
changes: [{
|
|
24396
|
+
type: "grant",
|
|
24397
|
+
operation: "grant",
|
|
24398
|
+
description: `Allow access to ${params.networkApprovalContext.host} for this session`,
|
|
24399
|
+
lifetime: { scope: "session" },
|
|
24400
|
+
targets: [{
|
|
24401
|
+
type: "network",
|
|
24402
|
+
matcher: {
|
|
24403
|
+
type: "host",
|
|
24404
|
+
host: params.networkApprovalContext.host,
|
|
24405
|
+
protocol: params.networkApprovalContext.protocol
|
|
24406
|
+
}
|
|
24407
|
+
}]
|
|
24408
|
+
}]
|
|
24409
|
+
} : void 0
|
|
24140
24410
|
),
|
|
24141
24411
|
decision: "acceptForSession"
|
|
24142
24412
|
}
|
|
@@ -24150,6 +24420,22 @@ var CodexApprovalHandler = class {
|
|
|
24150
24420
|
{
|
|
24151
24421
|
decision: "acceptWithExecpolicyAmendment",
|
|
24152
24422
|
execpolicyAmendment: params.proposedExecpolicyAmendment
|
|
24423
|
+
},
|
|
24424
|
+
{
|
|
24425
|
+
version: 1,
|
|
24426
|
+
changes: [{
|
|
24427
|
+
type: "policy_rule",
|
|
24428
|
+
operation: "add",
|
|
24429
|
+
ruleBehavior: "allow",
|
|
24430
|
+
description: `Allow commands starting with ${params.proposedExecpolicyAmendment.join(" ")}`,
|
|
24431
|
+
targets: [{
|
|
24432
|
+
type: "command",
|
|
24433
|
+
matcher: {
|
|
24434
|
+
type: "argv_prefix",
|
|
24435
|
+
argv: params.proposedExecpolicyAmendment
|
|
24436
|
+
}
|
|
24437
|
+
}]
|
|
24438
|
+
}]
|
|
24153
24439
|
}
|
|
24154
24440
|
),
|
|
24155
24441
|
decision: {
|
|
@@ -24168,6 +24454,22 @@ var CodexApprovalHandler = class {
|
|
|
24168
24454
|
{
|
|
24169
24455
|
decision: "applyNetworkPolicyAmendment",
|
|
24170
24456
|
networkPolicyAmendment: amendment
|
|
24457
|
+
},
|
|
24458
|
+
{
|
|
24459
|
+
version: 1,
|
|
24460
|
+
changes: [{
|
|
24461
|
+
type: "policy_rule",
|
|
24462
|
+
operation: "add",
|
|
24463
|
+
ruleBehavior: amendment.action,
|
|
24464
|
+
description: amendment.action === "allow" ? `Allow access to ${amendment.host}` : `Block access to ${amendment.host}`,
|
|
24465
|
+
targets: [{
|
|
24466
|
+
type: "network",
|
|
24467
|
+
matcher: {
|
|
24468
|
+
type: "host",
|
|
24469
|
+
host: amendment.host
|
|
24470
|
+
}
|
|
24471
|
+
}]
|
|
24472
|
+
}]
|
|
24171
24473
|
}
|
|
24172
24474
|
),
|
|
24173
24475
|
decision: {
|
|
@@ -24194,7 +24496,21 @@ var CodexApprovalHandler = class {
|
|
|
24194
24496
|
ApprovalOptionId.AllowAlways,
|
|
24195
24497
|
params.grantRoot ? "Allow Root for Session" : "Allow for Session",
|
|
24196
24498
|
"allow_always",
|
|
24197
|
-
{ decision: "acceptForSession", grantRoot: params.grantRoot ?? null }
|
|
24499
|
+
{ decision: "acceptForSession", grantRoot: params.grantRoot ?? null },
|
|
24500
|
+
params.grantRoot ? {
|
|
24501
|
+
version: 1,
|
|
24502
|
+
changes: [{
|
|
24503
|
+
type: "grant",
|
|
24504
|
+
operation: "grant",
|
|
24505
|
+
description: `Allow writes under ${params.grantRoot} for this session`,
|
|
24506
|
+
lifetime: { scope: "session" },
|
|
24507
|
+
targets: [{
|
|
24508
|
+
type: "filesystem",
|
|
24509
|
+
access: ["write"],
|
|
24510
|
+
matcher: { type: "directory", path: params.grantRoot }
|
|
24511
|
+
}]
|
|
24512
|
+
}]
|
|
24513
|
+
} : void 0
|
|
24198
24514
|
),
|
|
24199
24515
|
decision: "acceptForSession"
|
|
24200
24516
|
},
|
|
@@ -24217,6 +24533,68 @@ var CodexApprovalHandler = class {
|
|
|
24217
24533
|
...permissions.fileSystem ? { fileSystem: permissions.fileSystem } : {}
|
|
24218
24534
|
};
|
|
24219
24535
|
}
|
|
24536
|
+
permissionGrantMetadata(permissions, scope) {
|
|
24537
|
+
const changes = [];
|
|
24538
|
+
const lifetime = { scope };
|
|
24539
|
+
const suffix = scope === "session" ? " for this session" : " for this turn";
|
|
24540
|
+
if (permissions.network?.enabled !== null && permissions.network?.enabled !== void 0) {
|
|
24541
|
+
const allowed = permissions.network.enabled;
|
|
24542
|
+
changes.push({
|
|
24543
|
+
type: allowed ? "grant" : "policy_rule",
|
|
24544
|
+
operation: allowed ? "grant" : "add",
|
|
24545
|
+
...allowed ? {} : { ruleBehavior: "deny" },
|
|
24546
|
+
description: `${allowed ? "Allow" : "Deny"} network access${suffix}`,
|
|
24547
|
+
lifetime,
|
|
24548
|
+
targets: [{ type: "network", matcher: { type: "any" } }]
|
|
24549
|
+
});
|
|
24550
|
+
}
|
|
24551
|
+
const fileSystem = permissions.fileSystem;
|
|
24552
|
+
for (const path6 of fileSystem?.read ?? []) {
|
|
24553
|
+
changes.push(this.fileSystemGrantChange(path6, "read", lifetime, suffix));
|
|
24554
|
+
}
|
|
24555
|
+
for (const path6 of fileSystem?.write ?? []) {
|
|
24556
|
+
changes.push(this.fileSystemGrantChange(path6, "write", lifetime, suffix));
|
|
24557
|
+
}
|
|
24558
|
+
for (const entry of fileSystem?.entries ?? []) {
|
|
24559
|
+
const matcher = (() => {
|
|
24560
|
+
switch (entry.path.type) {
|
|
24561
|
+
case "path":
|
|
24562
|
+
return { type: "exact_path", path: entry.path.path };
|
|
24563
|
+
case "glob_pattern":
|
|
24564
|
+
return { type: "glob", pattern: entry.path.pattern };
|
|
24565
|
+
case "special":
|
|
24566
|
+
return { type: "special", provider: "codex", value: entry.path.value };
|
|
24567
|
+
}
|
|
24568
|
+
})();
|
|
24569
|
+
const pathDescription = entry.path.type === "path" ? entry.path.path : entry.path.type === "glob_pattern" ? entry.path.pattern : JSON.stringify(entry.path.value);
|
|
24570
|
+
changes.push({
|
|
24571
|
+
type: entry.access === "deny" ? "policy_rule" : "grant",
|
|
24572
|
+
operation: entry.access === "deny" ? "add" : "grant",
|
|
24573
|
+
...entry.access === "deny" ? { ruleBehavior: "deny" } : {},
|
|
24574
|
+
description: entry.access === "deny" ? `Deny filesystem access to ${pathDescription}${suffix}` : `Allow ${entry.access} access to ${pathDescription}${suffix}`,
|
|
24575
|
+
lifetime,
|
|
24576
|
+
targets: [{
|
|
24577
|
+
type: "filesystem",
|
|
24578
|
+
...entry.access === "deny" ? {} : { access: [entry.access] },
|
|
24579
|
+
matcher
|
|
24580
|
+
}]
|
|
24581
|
+
});
|
|
24582
|
+
}
|
|
24583
|
+
return changes.length > 0 ? { version: 1, changes } : void 0;
|
|
24584
|
+
}
|
|
24585
|
+
fileSystemGrantChange(path6, access, lifetime, suffix) {
|
|
24586
|
+
return {
|
|
24587
|
+
type: "grant",
|
|
24588
|
+
operation: "grant",
|
|
24589
|
+
description: `Allow ${access} access to ${path6}${suffix}`,
|
|
24590
|
+
lifetime,
|
|
24591
|
+
targets: [{
|
|
24592
|
+
type: "filesystem",
|
|
24593
|
+
access: [access],
|
|
24594
|
+
matcher: { type: "exact_path", path: path6 }
|
|
24595
|
+
}]
|
|
24596
|
+
};
|
|
24597
|
+
}
|
|
24220
24598
|
networkPolicyAmendmentOptionId(index) {
|
|
24221
24599
|
return `${ApprovalOptionId.ApplyNetworkPolicyAmendment}:${index}`;
|
|
24222
24600
|
}
|
|
@@ -25687,7 +26065,7 @@ var package_default = {
|
|
|
25687
26065
|
publishConfig: {
|
|
25688
26066
|
access: "public"
|
|
25689
26067
|
},
|
|
25690
|
-
version: "1.1.
|
|
26068
|
+
version: "1.1.8",
|
|
25691
26069
|
description: "",
|
|
25692
26070
|
main: "dist/index.js",
|
|
25693
26071
|
bin: {
|
|
@@ -25717,11 +26095,13 @@ var package_default = {
|
|
|
25717
26095
|
"package:win-x64": "cd dist/bin && zip codex-acp-x64-windows.zip codex-acp-x64-windows.exe",
|
|
25718
26096
|
"package:win-arm64": "cd dist/bin && zip codex-acp-arm64-windows.zip codex-acp-arm64-windows.exe",
|
|
25719
26097
|
start: "node --import tsx src/index.ts",
|
|
26098
|
+
"example:steering": "node --import tsx examples/steering.ts",
|
|
26099
|
+
"example:steering:multistep": "node --import tsx examples/steering.ts",
|
|
25720
26100
|
"generate-types": "./node_modules/.bin/codex app-server generate-ts --out src/app-server",
|
|
25721
26101
|
test: "vitest run",
|
|
25722
26102
|
"test:e2e": "npm run build && RUN_E2E_TESTS=true vitest run src/__tests__/CodexACPAgent/e2e",
|
|
25723
26103
|
"test:watch": "vitest",
|
|
25724
|
-
typecheck: "tsc --noEmit",
|
|
26104
|
+
typecheck: "tsc --noEmit && tsc --noEmit -p examples/tsconfig.json",
|
|
25725
26105
|
"codex-test": "tsx .claude/skills/run-codex/scripts/run-codex-test.ts"
|
|
25726
26106
|
},
|
|
25727
26107
|
homepage: "https://github.com/agentclientprotocol/codex-acp#readme",
|
|
@@ -25740,13 +26120,13 @@ var package_default = {
|
|
|
25740
26120
|
"@types/node": "^26.1.0",
|
|
25741
26121
|
esbuild: "^0.28.1",
|
|
25742
26122
|
"mcp-hello-world": "^1.1.2",
|
|
25743
|
-
tsx: "^4.23.
|
|
25744
|
-
typescript: "^
|
|
26123
|
+
tsx: "^4.23.1",
|
|
26124
|
+
typescript: "^7.0.2",
|
|
25745
26125
|
vitest: "^4.1.10"
|
|
25746
26126
|
},
|
|
25747
26127
|
dependencies: {
|
|
25748
|
-
"@agentclientprotocol/sdk": "^1.
|
|
25749
|
-
"@openai/codex": "^0.
|
|
26128
|
+
"@agentclientprotocol/sdk": "^1.3.0",
|
|
26129
|
+
"@openai/codex": "^0.145.0",
|
|
25750
26130
|
diff: "^9.0.0",
|
|
25751
26131
|
open: "^11.0.0",
|
|
25752
26132
|
"vscode-jsonrpc": "^9.0.1",
|
|
@@ -26438,6 +26818,13 @@ var CodexAcpClient = class {
|
|
|
26438
26818
|
turnId: params.turnId
|
|
26439
26819
|
});
|
|
26440
26820
|
}
|
|
26821
|
+
async steerTurn(params) {
|
|
26822
|
+
return await this.codexClient.turnSteer({
|
|
26823
|
+
threadId: params.threadId,
|
|
26824
|
+
expectedTurnId: params.turnId,
|
|
26825
|
+
input: buildPromptItems(params.prompt)
|
|
26826
|
+
});
|
|
26827
|
+
}
|
|
26441
26828
|
async fetchAvailableModels() {
|
|
26442
26829
|
const models = [];
|
|
26443
26830
|
let cursor = null;
|
|
@@ -27116,6 +27503,47 @@ var CodexCommands = class {
|
|
|
27116
27503
|
}
|
|
27117
27504
|
};
|
|
27118
27505
|
|
|
27506
|
+
// src/SteeringQueue.ts
|
|
27507
|
+
var SteeringQueue = class {
|
|
27508
|
+
constructor(handle) {
|
|
27509
|
+
this.handle = handle;
|
|
27510
|
+
}
|
|
27511
|
+
handle;
|
|
27512
|
+
pending = [];
|
|
27513
|
+
processing = false;
|
|
27514
|
+
enqueue(params) {
|
|
27515
|
+
return new Promise((resolve, reject) => {
|
|
27516
|
+
this.pending.push({ params, resolve, reject });
|
|
27517
|
+
this.startConsumer();
|
|
27518
|
+
});
|
|
27519
|
+
}
|
|
27520
|
+
/** No request is queued and the consumer is not running. */
|
|
27521
|
+
get isIdle() {
|
|
27522
|
+
return !this.processing && this.pending.length === 0;
|
|
27523
|
+
}
|
|
27524
|
+
startConsumer() {
|
|
27525
|
+
if (this.processing) {
|
|
27526
|
+
return;
|
|
27527
|
+
}
|
|
27528
|
+
this.processing = true;
|
|
27529
|
+
void this.consume();
|
|
27530
|
+
}
|
|
27531
|
+
async consume() {
|
|
27532
|
+
try {
|
|
27533
|
+
while (this.pending.length > 0) {
|
|
27534
|
+
const next = this.pending.shift();
|
|
27535
|
+
try {
|
|
27536
|
+
next.resolve(await this.handle(next.params));
|
|
27537
|
+
} catch (error51) {
|
|
27538
|
+
next.reject(error51);
|
|
27539
|
+
}
|
|
27540
|
+
}
|
|
27541
|
+
} finally {
|
|
27542
|
+
this.processing = false;
|
|
27543
|
+
}
|
|
27544
|
+
}
|
|
27545
|
+
};
|
|
27546
|
+
|
|
27119
27547
|
// src/ResponseItemHistoryFallback.ts
|
|
27120
27548
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
27121
27549
|
import path5 from "node:path";
|
|
@@ -28137,7 +28565,14 @@ function isJetBrains2026_1Client(clientInfo) {
|
|
|
28137
28565
|
return (isIntelliJPlatform || isJetBrainsClient) && clientInfo.version.startsWith("2026.1");
|
|
28138
28566
|
}
|
|
28139
28567
|
|
|
28568
|
+
// src/PlanCapabilities.ts
|
|
28569
|
+
function clientSupportsPlanUpdates(clientCapabilities) {
|
|
28570
|
+
return clientCapabilities?.plan != null;
|
|
28571
|
+
}
|
|
28572
|
+
|
|
28140
28573
|
// src/CodexAcpServer.ts
|
|
28574
|
+
var IMPLEMENT_PLAN_OPTION_ID = "implement_plan";
|
|
28575
|
+
var REVISE_PLAN_OPTION_ID = "revise_plan";
|
|
28141
28576
|
var CodexAcpServer = class _CodexAcpServer {
|
|
28142
28577
|
static MODEL_NAME_TOKEN_OVERRIDES = {
|
|
28143
28578
|
gpt: "GPT",
|
|
@@ -28158,6 +28593,7 @@ var CodexAcpServer = class _CodexAcpServer {
|
|
|
28158
28593
|
pendingMcpStartupSessions;
|
|
28159
28594
|
pendingTurnStarts;
|
|
28160
28595
|
activePrompts;
|
|
28596
|
+
steeringQueues;
|
|
28161
28597
|
closingSessions;
|
|
28162
28598
|
sessionGenerations;
|
|
28163
28599
|
sessionOpenGenerations;
|
|
@@ -28166,6 +28602,7 @@ var CodexAcpServer = class _CodexAcpServer {
|
|
|
28166
28602
|
this.pendingMcpStartupSessions = /* @__PURE__ */ new Map();
|
|
28167
28603
|
this.pendingTurnStarts = /* @__PURE__ */ new Map();
|
|
28168
28604
|
this.activePrompts = /* @__PURE__ */ new Map();
|
|
28605
|
+
this.steeringQueues = /* @__PURE__ */ new Map();
|
|
28169
28606
|
this.closingSessions = /* @__PURE__ */ new Map();
|
|
28170
28607
|
this.sessionGenerations = /* @__PURE__ */ new Map();
|
|
28171
28608
|
this.sessionOpenGenerations = /* @__PURE__ */ new Map();
|
|
@@ -28222,7 +28659,12 @@ var CodexAcpServer = class _CodexAcpServer {
|
|
|
28222
28659
|
sse: false
|
|
28223
28660
|
}
|
|
28224
28661
|
},
|
|
28225
|
-
authMethods: getCodexAuthMethods(_params.clientCapabilities)
|
|
28662
|
+
authMethods: getCodexAuthMethods(_params.clientCapabilities),
|
|
28663
|
+
_meta: {
|
|
28664
|
+
steering: {
|
|
28665
|
+
supported: true
|
|
28666
|
+
}
|
|
28667
|
+
}
|
|
28226
28668
|
};
|
|
28227
28669
|
}
|
|
28228
28670
|
async extMethod(method, params) {
|
|
@@ -28239,6 +28681,8 @@ var CodexAcpServer = class _CodexAcpServer {
|
|
|
28239
28681
|
}
|
|
28240
28682
|
case LEGACY_SET_SESSION_MODEL_METHOD:
|
|
28241
28683
|
return await this.unstable_setSessionModel(this.parseLegacySetSessionModelParams(methodRequest.params));
|
|
28684
|
+
case SESSION_STEERING_METHOD:
|
|
28685
|
+
return await this.executeOrQueueSteeringRequest(this.parseSessionSteerParams(methodRequest.params));
|
|
28242
28686
|
case GOAL_CONTROL_METHOD: {
|
|
28243
28687
|
const sessionState = this.sessions.get(methodRequest.params.sessionId);
|
|
28244
28688
|
if (!sessionState) {
|
|
@@ -28545,6 +28989,7 @@ Check ${configPath} and project .codex directories, especially their config.toml
|
|
|
28545
28989
|
this.pendingMcpStartupSessions.delete(params.sessionId);
|
|
28546
28990
|
this.pendingTurnStarts.delete(params.sessionId);
|
|
28547
28991
|
this.activePrompts.delete(params.sessionId);
|
|
28992
|
+
this.steeringQueues.delete(params.sessionId);
|
|
28548
28993
|
}
|
|
28549
28994
|
this.endSessionCloseFence(params.sessionId);
|
|
28550
28995
|
}
|
|
@@ -28765,6 +29210,199 @@ Check ${configPath} and project .codex directories, especially their config.toml
|
|
|
28765
29210
|
modelId
|
|
28766
29211
|
};
|
|
28767
29212
|
}
|
|
29213
|
+
/**
|
|
29214
|
+
* Handles one incoming steering request, serialising it against any other
|
|
29215
|
+
* steer already in flight for the same session.
|
|
29216
|
+
*
|
|
29217
|
+
* Every session gets its own {@link SteeringQueue}: the request is enqueued
|
|
29218
|
+
* and awaited, so concurrent steers for one session run strictly one at a
|
|
29219
|
+
* time, in arrival order, and can never race to inject into — or start —
|
|
29220
|
+
* rival turns. Steers for different sessions use different queues and run
|
|
29221
|
+
* concurrently. Once the queue drains to idle it is removed from the map,
|
|
29222
|
+
* so no per-session entry leaks after the session goes quiet (the identity
|
|
29223
|
+
* check guards against deleting a queue a later request has since reused).
|
|
29224
|
+
*
|
|
29225
|
+
* @param params The target session id and the prompt to steer with.
|
|
29226
|
+
* @returns Whether the prompt joined the active turn ("injected"), started a
|
|
29227
|
+
* new one ("startedNewTurn"), or could not be applied ("failed"); see
|
|
29228
|
+
* {@link performSteeringRequest}.
|
|
29229
|
+
*/
|
|
29230
|
+
async executeOrQueueSteeringRequest(params) {
|
|
29231
|
+
const queue = this.getSteeringQueue(params.sessionId);
|
|
29232
|
+
try {
|
|
29233
|
+
return await queue.enqueue(params);
|
|
29234
|
+
} catch (error51) {
|
|
29235
|
+
if (error51 instanceof RequestError) {
|
|
29236
|
+
throw error51;
|
|
29237
|
+
}
|
|
29238
|
+
logger.error(`Steering request for session ${params.sessionId} failed`, error51);
|
|
29239
|
+
return { outcome: "failed" };
|
|
29240
|
+
} finally {
|
|
29241
|
+
if (queue.isIdle && this.steeringQueues.get(params.sessionId) === queue) {
|
|
29242
|
+
this.steeringQueues.delete(params.sessionId);
|
|
29243
|
+
}
|
|
29244
|
+
}
|
|
29245
|
+
}
|
|
29246
|
+
/**
|
|
29247
|
+
* Returns the steering queue for a session, creating and registering it on
|
|
29248
|
+
* first use.
|
|
29249
|
+
*
|
|
29250
|
+
* @param sessionId The session whose steering queue is required.
|
|
29251
|
+
* @returns The session's existing queue, or a freshly created one.
|
|
29252
|
+
*/
|
|
29253
|
+
getSteeringQueue(sessionId) {
|
|
29254
|
+
let queue = this.steeringQueues.get(sessionId);
|
|
29255
|
+
if (!queue) {
|
|
29256
|
+
queue = new SteeringQueue((params) => this.performSteeringRequest(params));
|
|
29257
|
+
this.steeringQueues.set(sessionId, queue);
|
|
29258
|
+
}
|
|
29259
|
+
return queue;
|
|
29260
|
+
}
|
|
29261
|
+
/**
|
|
29262
|
+
* Delivers a steering prompt to the session: injects it into the live turn
|
|
29263
|
+
* when there is one, otherwise starts a new turn.
|
|
29264
|
+
*
|
|
29265
|
+
* @param params The target session id and the prompt to steer with.
|
|
29266
|
+
* @returns "injected" when the prompt joined an existing turn, otherwise the
|
|
29267
|
+
* outcome of starting a new turn.
|
|
29268
|
+
*/
|
|
29269
|
+
async performSteeringRequest(params) {
|
|
29270
|
+
logger.log("Steering session requested", {
|
|
29271
|
+
sessionId: params.sessionId,
|
|
29272
|
+
prompt: params.prompt
|
|
29273
|
+
});
|
|
29274
|
+
const sessionState = this.getSessionState(params.sessionId);
|
|
29275
|
+
this.assertSteerInputSupported(params, sessionState);
|
|
29276
|
+
const turnId = await this.getSteerableTurnId(sessionState);
|
|
29277
|
+
if (turnId) {
|
|
29278
|
+
const injected = await this.injectSteerIntoActiveTurn(params, turnId, sessionState);
|
|
29279
|
+
if (injected) {
|
|
29280
|
+
logger.log("Steering session injected", { sessionId: params.sessionId, turnId });
|
|
29281
|
+
return { outcome: "injected" };
|
|
29282
|
+
}
|
|
29283
|
+
}
|
|
29284
|
+
return await this.startNewTurnFromSteering(params);
|
|
29285
|
+
}
|
|
29286
|
+
/**
|
|
29287
|
+
* Rejects a steering prompt whose content the active model cannot accept
|
|
29288
|
+
* (currently: image blocks on a text-only model).
|
|
29289
|
+
*/
|
|
29290
|
+
assertSteerInputSupported(params, sessionState) {
|
|
29291
|
+
const hasImage = params.prompt.some((block) => block.type === "image");
|
|
29292
|
+
if (hasImage && !sessionState.supportedInputModalities.includes("image")) {
|
|
29293
|
+
throw RequestError.invalidRequest("The current model does not support image input");
|
|
29294
|
+
}
|
|
29295
|
+
}
|
|
29296
|
+
/**
|
|
29297
|
+
* Attempts to inject the prompt into the given running turn.
|
|
29298
|
+
*
|
|
29299
|
+
* A failed injection is fatal only when the turn is still the session's
|
|
29300
|
+
* current turn and Codex reported something other than "no active turn to
|
|
29301
|
+
* steer". Otherwise the turn has already ended underneath us and the caller
|
|
29302
|
+
* should start a new turn instead.
|
|
29303
|
+
*
|
|
29304
|
+
* @returns true when the prompt was injected; false when the caller should
|
|
29305
|
+
* fall back to starting a new turn.
|
|
29306
|
+
*/
|
|
29307
|
+
async injectSteerIntoActiveTurn(params, turnId, sessionState) {
|
|
29308
|
+
try {
|
|
29309
|
+
await this.runWithProcessCheck(() => this.codexAcpClient.steerTurn({
|
|
29310
|
+
threadId: params.sessionId,
|
|
29311
|
+
turnId,
|
|
29312
|
+
prompt: params.prompt
|
|
29313
|
+
}));
|
|
29314
|
+
return true;
|
|
29315
|
+
} catch (err) {
|
|
29316
|
+
await this.codexAcpClient.waitForSessionNotifications(params.sessionId);
|
|
29317
|
+
const turnStillActive = sessionState.currentTurnId === turnId;
|
|
29318
|
+
if (turnStillActive && !this.isNoActiveTurnToSteerError(err)) {
|
|
29319
|
+
throw err;
|
|
29320
|
+
}
|
|
29321
|
+
return false;
|
|
29322
|
+
}
|
|
29323
|
+
}
|
|
29324
|
+
/**
|
|
29325
|
+
* Starts a new turn from a steering prompt when there is no live turn to
|
|
29326
|
+
* inject into, and returns as soon as that turn is running.
|
|
29327
|
+
*
|
|
29328
|
+
* Waits for any previous prompt to drain first, then re-checks that the
|
|
29329
|
+
* session is not closing — the await above is a window during which a close
|
|
29330
|
+
* request can arrive.
|
|
29331
|
+
*
|
|
29332
|
+
* @param params The target session id and the prompt to steer with.
|
|
29333
|
+
* @returns "startedNewTurn" once the turn is running; throws if the prompt
|
|
29334
|
+
* fails or is cancelled before the turn starts.
|
|
29335
|
+
*/
|
|
29336
|
+
async startNewTurnFromSteering(params) {
|
|
29337
|
+
const previousPrompt = this.activePrompts.get(params.sessionId);
|
|
29338
|
+
await previousPrompt?.completion;
|
|
29339
|
+
if (this.sessionIsClosing(params.sessionId)) {
|
|
29340
|
+
throw RequestError.invalidRequest(`Session ${params.sessionId} is closing`);
|
|
29341
|
+
}
|
|
29342
|
+
return await new Promise((resolve, reject) => {
|
|
29343
|
+
let turnStarted = false;
|
|
29344
|
+
const promptDone = this.prompt(params, void 0, () => {
|
|
29345
|
+
turnStarted = true;
|
|
29346
|
+
logger.log("Steering session started a new turn", { sessionId: params.sessionId });
|
|
29347
|
+
resolve({ outcome: "startedNewTurn" });
|
|
29348
|
+
});
|
|
29349
|
+
promptDone.then(
|
|
29350
|
+
(response) => {
|
|
29351
|
+
if (!turnStarted && response.stopReason === "cancelled") {
|
|
29352
|
+
reject(RequestError.invalidRequest(`Session ${params.sessionId} was cancelled before the steering turn started`));
|
|
29353
|
+
} else {
|
|
29354
|
+
resolve({ outcome: "startedNewTurn" });
|
|
29355
|
+
}
|
|
29356
|
+
},
|
|
29357
|
+
(error51) => {
|
|
29358
|
+
if (turnStarted) {
|
|
29359
|
+
logger.error(`Steering-started prompt for session ${params.sessionId} failed`, error51);
|
|
29360
|
+
} else {
|
|
29361
|
+
reject(error51);
|
|
29362
|
+
}
|
|
29363
|
+
}
|
|
29364
|
+
);
|
|
29365
|
+
});
|
|
29366
|
+
}
|
|
29367
|
+
isNoActiveTurnToSteerError(error51) {
|
|
29368
|
+
const messages = error51 instanceof Error ? [error51.message] : [];
|
|
29369
|
+
if (typeof error51 === "object" && error51 !== null && "data" in error51) {
|
|
29370
|
+
const data = error51.data;
|
|
29371
|
+
if (typeof data === "string") {
|
|
29372
|
+
messages.push(data);
|
|
29373
|
+
} else if (typeof data === "object" && data !== null && "details" in data) {
|
|
29374
|
+
const details = data.details;
|
|
29375
|
+
if (typeof details === "string") {
|
|
29376
|
+
messages.push(details);
|
|
29377
|
+
}
|
|
29378
|
+
}
|
|
29379
|
+
}
|
|
29380
|
+
return messages.some((message) => message.toLowerCase().includes("no active turn to steer"));
|
|
29381
|
+
}
|
|
29382
|
+
async getSteerableTurnId(sessionState) {
|
|
29383
|
+
if (this.sessionIsClosing(sessionState.sessionId)) {
|
|
29384
|
+
return null;
|
|
29385
|
+
}
|
|
29386
|
+
if (sessionState.currentTurnId) {
|
|
29387
|
+
return sessionState.currentTurnId;
|
|
29388
|
+
}
|
|
29389
|
+
const pendingTurnStart = this.pendingTurnStarts.get(sessionState.sessionId);
|
|
29390
|
+
if (!pendingTurnStart) {
|
|
29391
|
+
return null;
|
|
29392
|
+
}
|
|
29393
|
+
return await pendingTurnStart.promise;
|
|
29394
|
+
}
|
|
29395
|
+
parseSessionSteerParams(params) {
|
|
29396
|
+
const sessionId = params["sessionId"];
|
|
29397
|
+
const prompt = params["prompt"];
|
|
29398
|
+
if (typeof sessionId !== "string" || !Array.isArray(prompt)) {
|
|
29399
|
+
throw RequestError.invalidParams();
|
|
29400
|
+
}
|
|
29401
|
+
return {
|
|
29402
|
+
sessionId,
|
|
29403
|
+
prompt
|
|
29404
|
+
};
|
|
29405
|
+
}
|
|
28768
29406
|
createSessionConfigOptions(sessionState) {
|
|
28769
29407
|
const currentModelId = ModelId.fromString(sessionState.currentModelId);
|
|
28770
29408
|
const configOptions = [
|
|
@@ -29053,7 +29691,7 @@ Check ${configPath} and project .codex directories, especially their config.toml
|
|
|
29053
29691
|
case "contextCompaction":
|
|
29054
29692
|
return [createCompletedContextCompactionUpdate(item)];
|
|
29055
29693
|
case "plan":
|
|
29056
|
-
return [this.
|
|
29694
|
+
return item.text.length > 0 ? [this.createPlanHistoryUpdate(item)] : [];
|
|
29057
29695
|
}
|
|
29058
29696
|
}
|
|
29059
29697
|
createUserMessageUpdates(item) {
|
|
@@ -29094,15 +29732,22 @@ Check ${configPath} and project .codex directories, especially their config.toml
|
|
|
29094
29732
|
}
|
|
29095
29733
|
};
|
|
29096
29734
|
}
|
|
29097
|
-
|
|
29098
|
-
|
|
29099
|
-
|
|
29100
|
-
|
|
29101
|
-
|
|
29102
|
-
|
|
29103
|
-
|
|
29104
|
-
|
|
29105
|
-
|
|
29735
|
+
createPlanHistoryUpdate(item) {
|
|
29736
|
+
if (clientSupportsPlanUpdates(this.clientCapabilities)) {
|
|
29737
|
+
return {
|
|
29738
|
+
sessionUpdate: "plan_update",
|
|
29739
|
+
plan: {
|
|
29740
|
+
type: "markdown",
|
|
29741
|
+
planId: item.id,
|
|
29742
|
+
content: item.text
|
|
29743
|
+
}
|
|
29744
|
+
};
|
|
29745
|
+
}
|
|
29746
|
+
return createAgentTextMessageChunk(
|
|
29747
|
+
item.text,
|
|
29748
|
+
item.id,
|
|
29749
|
+
createCodexMessagePhaseMeta("final_answer")
|
|
29750
|
+
);
|
|
29106
29751
|
}
|
|
29107
29752
|
userInputToContentBlocks(input) {
|
|
29108
29753
|
switch (input.type) {
|
|
@@ -29372,7 +30017,7 @@ ${item.text}`
|
|
|
29372
30017
|
}
|
|
29373
30018
|
return turnId;
|
|
29374
30019
|
}
|
|
29375
|
-
async prompt(params, signal) {
|
|
30020
|
+
async prompt(params, signal, onTurnStarted) {
|
|
29376
30021
|
logger.log("Prompt received", {
|
|
29377
30022
|
sessionId: params.sessionId,
|
|
29378
30023
|
prompt: params.prompt
|
|
@@ -29391,7 +30036,11 @@ ${item.text}`
|
|
|
29391
30036
|
};
|
|
29392
30037
|
const disposePromptRequestCancellation = this.observePromptRequestCancellation(signal, sessionState, activePrompt);
|
|
29393
30038
|
try {
|
|
29394
|
-
const eventHandler = new CodexEventHandler(
|
|
30039
|
+
const eventHandler = new CodexEventHandler(
|
|
30040
|
+
this.connection,
|
|
30041
|
+
sessionState,
|
|
30042
|
+
clientSupportsPlanUpdates(this.clientCapabilities)
|
|
30043
|
+
);
|
|
29395
30044
|
const approvalHandler = new CodexApprovalHandler(this.connection, sessionState, activePrompt.signal);
|
|
29396
30045
|
const elicitationHandler = new CodexElicitationHandler(
|
|
29397
30046
|
this.connection,
|
|
@@ -29424,6 +30073,7 @@ ${item.text}`
|
|
|
29424
30073
|
}
|
|
29425
30074
|
sessionState.currentTurnId = turnId;
|
|
29426
30075
|
pendingTurnStart?.resolve(turnId);
|
|
30076
|
+
onTurnStarted?.();
|
|
29427
30077
|
},
|
|
29428
30078
|
setConfigOption: async (configId, value) => {
|
|
29429
30079
|
await this.applySessionConfigOption(sessionState, {
|
|
@@ -29507,6 +30157,7 @@ ${item.text}`
|
|
|
29507
30157
|
}
|
|
29508
30158
|
sessionState.currentTurnId = turnId;
|
|
29509
30159
|
pendingTurnStart?.resolve(turnId);
|
|
30160
|
+
onTurnStarted?.();
|
|
29510
30161
|
},
|
|
29511
30162
|
() => this.promptShouldStop(params.sessionId, activePrompt)
|
|
29512
30163
|
)
|
|
@@ -29516,7 +30167,7 @@ ${item.text}`
|
|
|
29516
30167
|
logger.error(`Prompt for cancelled session ${params.sessionId} failed after prompt returned`, err);
|
|
29517
30168
|
}
|
|
29518
30169
|
});
|
|
29519
|
-
|
|
30170
|
+
let turnCompleted = await Promise.race([
|
|
29520
30171
|
sendPromptPromise,
|
|
29521
30172
|
activePrompt.closeSignal,
|
|
29522
30173
|
this.cancelBeforeTurnStarted(activePrompt)
|
|
@@ -29533,6 +30184,73 @@ ${item.text}`
|
|
|
29533
30184
|
if (error51) {
|
|
29534
30185
|
throw error51;
|
|
29535
30186
|
}
|
|
30187
|
+
const completedPlan = eventHandler.takeCompletedPlan();
|
|
30188
|
+
if (completedPlan !== null && sessionState.collaborationMode === PLAN_COLLABORATION_MODE && !this.promptShouldStop(params.sessionId, activePrompt)) {
|
|
30189
|
+
const approved = await this.requestPlanImplementationPermission(
|
|
30190
|
+
sessionState,
|
|
30191
|
+
completedPlan,
|
|
30192
|
+
activePrompt.signal
|
|
30193
|
+
);
|
|
30194
|
+
if (this.promptShouldStop(params.sessionId, activePrompt)) {
|
|
30195
|
+
return this.cancelledPromptResponse(sessionState);
|
|
30196
|
+
}
|
|
30197
|
+
if (approved && !this.promptShouldStop(params.sessionId, activePrompt)) {
|
|
30198
|
+
await this.applyCollaborationModeChange(sessionState, DEFAULT_COLLABORATION_MODE);
|
|
30199
|
+
const session = new ACPSessionConnection(this.connection, sessionState.sessionId);
|
|
30200
|
+
await session.update({
|
|
30201
|
+
sessionUpdate: "config_option_update",
|
|
30202
|
+
configOptions: this.createSessionConfigOptions(sessionState)
|
|
30203
|
+
});
|
|
30204
|
+
const implementationRequest = {
|
|
30205
|
+
sessionId: params.sessionId,
|
|
30206
|
+
prompt: [{ type: "text", text: "Implement the approved plan." }]
|
|
30207
|
+
};
|
|
30208
|
+
activePrompt.currentTurn = null;
|
|
30209
|
+
const implementationPromise = this.runWithProcessCheck(
|
|
30210
|
+
() => this.codexAcpClient.sendPrompt(
|
|
30211
|
+
implementationRequest,
|
|
30212
|
+
agentMode,
|
|
30213
|
+
modelId,
|
|
30214
|
+
serviceTier,
|
|
30215
|
+
disableSummary,
|
|
30216
|
+
sessionState.cwd,
|
|
30217
|
+
sessionState.additionalDirectories,
|
|
30218
|
+
(turnId) => {
|
|
30219
|
+
const turn = { threadId: params.sessionId, turnId };
|
|
30220
|
+
activePrompt.currentTurn = turn;
|
|
30221
|
+
if (this.promptShouldStop(params.sessionId, activePrompt)) {
|
|
30222
|
+
this.interruptLateStartedTurn(turn);
|
|
30223
|
+
return;
|
|
30224
|
+
}
|
|
30225
|
+
sessionState.currentTurnId = turnId;
|
|
30226
|
+
},
|
|
30227
|
+
() => this.promptShouldStop(params.sessionId, activePrompt)
|
|
30228
|
+
)
|
|
30229
|
+
);
|
|
30230
|
+
void implementationPromise.catch((err) => {
|
|
30231
|
+
if (this.activePrompts.get(params.sessionId) !== activePrompt) {
|
|
30232
|
+
logger.error(`Implementation turn for cancelled prompt ${params.sessionId} failed after prompt returned`, err);
|
|
30233
|
+
}
|
|
30234
|
+
});
|
|
30235
|
+
turnCompleted = await Promise.race([
|
|
30236
|
+
implementationPromise,
|
|
30237
|
+
activePrompt.closeSignal,
|
|
30238
|
+
this.cancelBeforeTurnStarted(activePrompt)
|
|
30239
|
+
]);
|
|
30240
|
+
if (turnCompleted === null) {
|
|
30241
|
+
return this.cancelledPromptResponse(sessionState);
|
|
30242
|
+
}
|
|
30243
|
+
await this.codexAcpClient.waitForSessionNotifications(params.sessionId);
|
|
30244
|
+
if (turnCompleted.turn.status === "interrupted") {
|
|
30245
|
+
await this.notifyConversationInterrupted(params.sessionId);
|
|
30246
|
+
return this.cancelledPromptResponse(sessionState);
|
|
30247
|
+
}
|
|
30248
|
+
const implementationError = eventHandler.getFailure();
|
|
30249
|
+
if (implementationError) {
|
|
30250
|
+
throw implementationError;
|
|
30251
|
+
}
|
|
30252
|
+
}
|
|
30253
|
+
}
|
|
29536
30254
|
await this.publishFallbackSessionTitle(
|
|
29537
30255
|
sessionState,
|
|
29538
30256
|
this.createPromptFallbackTitle(params.prompt)
|
|
@@ -29557,6 +30275,57 @@ ${item.text}`
|
|
|
29557
30275
|
activePrompt.complete();
|
|
29558
30276
|
}
|
|
29559
30277
|
}
|
|
30278
|
+
async requestPlanImplementationPermission(sessionState, plan, cancellationSignal) {
|
|
30279
|
+
const toolCallId = `plan-review:${plan.itemId}`;
|
|
30280
|
+
try {
|
|
30281
|
+
const response = await this.connection.request(
|
|
30282
|
+
methods.client.session.requestPermission,
|
|
30283
|
+
{
|
|
30284
|
+
sessionId: sessionState.sessionId,
|
|
30285
|
+
toolCall: {
|
|
30286
|
+
toolCallId,
|
|
30287
|
+
title: "Implement this plan?",
|
|
30288
|
+
kind: "switch_mode",
|
|
30289
|
+
status: "pending",
|
|
30290
|
+
rawInput: { plan: plan.text }
|
|
30291
|
+
},
|
|
30292
|
+
options: [
|
|
30293
|
+
{
|
|
30294
|
+
optionId: IMPLEMENT_PLAN_OPTION_ID,
|
|
30295
|
+
name: "Yes, implement this plan",
|
|
30296
|
+
kind: "allow_once"
|
|
30297
|
+
},
|
|
30298
|
+
{
|
|
30299
|
+
optionId: REVISE_PLAN_OPTION_ID,
|
|
30300
|
+
name: "No, and tell Codex what to do differently",
|
|
30301
|
+
kind: "reject_once"
|
|
30302
|
+
}
|
|
30303
|
+
],
|
|
30304
|
+
_meta: {
|
|
30305
|
+
codex: {
|
|
30306
|
+
kind: "plan_review",
|
|
30307
|
+
planItemId: plan.itemId
|
|
30308
|
+
}
|
|
30309
|
+
}
|
|
30310
|
+
},
|
|
30311
|
+
{ cancellationSignal }
|
|
30312
|
+
);
|
|
30313
|
+
const approved = response.outcome.outcome === "selected" && response.outcome.optionId === IMPLEMENT_PLAN_OPTION_ID;
|
|
30314
|
+
await this.connection.notify(methods.client.session.update, {
|
|
30315
|
+
sessionId: sessionState.sessionId,
|
|
30316
|
+
update: {
|
|
30317
|
+
sessionUpdate: "tool_call_update",
|
|
30318
|
+
toolCallId,
|
|
30319
|
+
status: "completed",
|
|
30320
|
+
rawOutput: approved ? "User approved the plan." : "User kept the session in plan mode."
|
|
30321
|
+
}
|
|
30322
|
+
});
|
|
30323
|
+
return approved;
|
|
30324
|
+
} catch (error51) {
|
|
30325
|
+
logger.error("Error requesting plan implementation permission", error51);
|
|
30326
|
+
return false;
|
|
30327
|
+
}
|
|
30328
|
+
}
|
|
29560
30329
|
cancelledPromptResponse(sessionState) {
|
|
29561
30330
|
return {
|
|
29562
30331
|
stopReason: "cancelled",
|
|
@@ -30034,6 +30803,9 @@ var CodexAppServerClient = class {
|
|
|
30034
30803
|
async turnInterrupt(params) {
|
|
30035
30804
|
return await this.sendRequest({ method: "turn/interrupt", params });
|
|
30036
30805
|
}
|
|
30806
|
+
async turnSteer(params) {
|
|
30807
|
+
return await this.sendRequest({ method: "turn/steer", params });
|
|
30808
|
+
}
|
|
30037
30809
|
async reviewStart(params) {
|
|
30038
30810
|
return await this.sendRequest({ method: "review/start", params });
|
|
30039
30811
|
}
|
|
@@ -30607,6 +31379,10 @@ var legacySetSessionModelParamsParser = external_exports.object({
|
|
|
30607
31379
|
sessionId: external_exports.string(),
|
|
30608
31380
|
modelId: external_exports.string()
|
|
30609
31381
|
}).passthrough();
|
|
31382
|
+
var sessionSteerParamsParser = external_exports.object({
|
|
31383
|
+
sessionId: external_exports.string(),
|
|
31384
|
+
prompt: external_exports.array(external_exports.any())
|
|
31385
|
+
}).passthrough();
|
|
30610
31386
|
var goalControlParamsParser = external_exports.object({
|
|
30611
31387
|
sessionId: external_exports.string(),
|
|
30612
31388
|
action: external_exports.enum(["pause", "clear"])
|
|
@@ -30683,5 +31459,5 @@ function startAcpServer() {
|
|
|
30683
31459
|
codexAcpServer = null;
|
|
30684
31460
|
}
|
|
30685
31461
|
});
|
|
30686
|
-
}).onRequest(methods.agent.initialize, (ctx) => getAgent().initialize(ctx.params)).onRequest(methods.agent.session.new, (ctx) => getAgent().newSession(ctx.params)).onRequest(methods.agent.session.load, (ctx) => getAgent().loadSession(ctx.params)).onRequest(methods.agent.session.list, (ctx) => getAgent().listSessions(ctx.params)).onRequest(methods.agent.session.delete, (ctx) => getAgent().deleteSession(ctx.params)).onRequest(methods.agent.session.resume, (ctx) => getAgent().resumeSession(ctx.params)).onRequest(methods.agent.session.close, (ctx) => getAgent().closeSession(ctx.params)).onRequest(methods.agent.session.setMode, (ctx) => getAgent().setSessionMode(ctx.params)).onRequest(methods.agent.session.setConfigOption, (ctx) => getAgent().setSessionConfigOption(ctx.params)).onRequest(methods.agent.authenticate, (ctx) => getAgent().authenticate(ctx.params)).onRequest(methods.agent.logout, (ctx) => getAgent().logout(ctx.params)).onRequest(methods.agent.providers.list, (ctx) => getAgent().listProviders(ctx.params)).onRequest(methods.agent.providers.set, (ctx) => getAgent().setProvider(ctx.params)).onRequest(methods.agent.providers.disable, (ctx) => getAgent().disableProvider(ctx.params)).onRequest(methods.agent.session.prompt, (ctx) => getAgent().prompt(ctx.params, ctx.signal)).onNotification(methods.agent.session.cancel, (ctx) => getAgent().cancel(ctx.params)).onRequest("authentication/status", emptyExtensionParamsParser, (ctx) => getAgent().extMethod("authentication/status", ctx.params)).onRequest("authentication/logout", emptyExtensionParamsParser, (ctx) => getAgent().extMethod("authentication/logout", ctx.params)).onRequest(LEGACY_SET_SESSION_MODEL_METHOD, legacySetSessionModelParamsParser, (ctx) => getAgent().extMethod(LEGACY_SET_SESSION_MODEL_METHOD, ctx.params)).onRequest(GOAL_CONTROL_METHOD, goalControlParamsParser, (ctx) => getAgent().extMethod(GOAL_CONTROL_METHOD, ctx.params)).connect(acpJsonStream);
|
|
31462
|
+
}).onRequest(methods.agent.initialize, (ctx) => getAgent().initialize(ctx.params)).onRequest(methods.agent.session.new, (ctx) => getAgent().newSession(ctx.params)).onRequest(methods.agent.session.load, (ctx) => getAgent().loadSession(ctx.params)).onRequest(methods.agent.session.list, (ctx) => getAgent().listSessions(ctx.params)).onRequest(methods.agent.session.delete, (ctx) => getAgent().deleteSession(ctx.params)).onRequest(methods.agent.session.resume, (ctx) => getAgent().resumeSession(ctx.params)).onRequest(methods.agent.session.close, (ctx) => getAgent().closeSession(ctx.params)).onRequest(methods.agent.session.setMode, (ctx) => getAgent().setSessionMode(ctx.params)).onRequest(methods.agent.session.setConfigOption, (ctx) => getAgent().setSessionConfigOption(ctx.params)).onRequest(methods.agent.authenticate, (ctx) => getAgent().authenticate(ctx.params)).onRequest(methods.agent.logout, (ctx) => getAgent().logout(ctx.params)).onRequest(methods.agent.providers.list, (ctx) => getAgent().listProviders(ctx.params)).onRequest(methods.agent.providers.set, (ctx) => getAgent().setProvider(ctx.params)).onRequest(methods.agent.providers.disable, (ctx) => getAgent().disableProvider(ctx.params)).onRequest(methods.agent.session.prompt, (ctx) => getAgent().prompt(ctx.params, ctx.signal)).onNotification(methods.agent.session.cancel, (ctx) => getAgent().cancel(ctx.params)).onRequest("authentication/status", emptyExtensionParamsParser, (ctx) => getAgent().extMethod("authentication/status", ctx.params)).onRequest("authentication/logout", emptyExtensionParamsParser, (ctx) => getAgent().extMethod("authentication/logout", ctx.params)).onRequest(LEGACY_SET_SESSION_MODEL_METHOD, legacySetSessionModelParamsParser, (ctx) => getAgent().extMethod(LEGACY_SET_SESSION_MODEL_METHOD, ctx.params)).onRequest(SESSION_STEERING_METHOD, sessionSteerParamsParser, (ctx) => getAgent().extMethod(SESSION_STEERING_METHOD, ctx.params)).onRequest(GOAL_CONTROL_METHOD, goalControlParamsParser, (ctx) => getAgent().extMethod(GOAL_CONTROL_METHOD, ctx.params)).connect(acpJsonStream);
|
|
30687
31463
|
}
|