@alas-ide/codex-acp 2.2.2-alas.1 → 2.2.2-alas.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.js +78 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ Use [OpenAI Codex](https://github.com/openai/codex) from [Agent Client Protocol]
|
|
|
21
21
|
- Typed warnings and errors through the opt-in [AIR session failure extension](docs/air-extensions.md#session-failure).
|
|
22
22
|
- All AIR extensions, capabilities, and `_meta` keys: [AIR extensions](docs/air-extensions.md).
|
|
23
23
|
- A per-turn [agent file-change report](docs/air-extensions.md#agent-file-change-report) after capability negotiation.
|
|
24
|
+
- Client-provided, session-scoped [system prompt append](docs/system-prompt-extension.md), preserving configured developer instructions.
|
|
24
25
|
- Client-provided MCP servers over command-based stdio config and HTTP transport.
|
|
25
26
|
- Slash commands: `/status`, `/mcp` (with `/mcp reconnect`), `/skills`, `/goal`, `/review`, `/review-branch`, `/review-commit`, `/compact`, and `/logout`, as well as configured skills.
|
|
26
27
|
|
package/dist/index.js
CHANGED
|
@@ -27893,6 +27893,20 @@ function attachLogs(proc) {
|
|
|
27893
27893
|
});
|
|
27894
27894
|
}
|
|
27895
27895
|
|
|
27896
|
+
// src/SessionInstructions.ts
|
|
27897
|
+
var SYSTEM_PROMPT_CAPABILITY = { version: 1, append: true, clear: true, maxBytes: 256 * 1024 };
|
|
27898
|
+
function readSessionInstructionAppend(meta3) {
|
|
27899
|
+
const prompt = meta3?.["systemPrompt"];
|
|
27900
|
+
if (prompt === void 0) return void 0;
|
|
27901
|
+
if (prompt === null || typeof prompt !== "object" || Array.isArray(prompt) || Object.keys(prompt).some((key) => key !== "append") || !("append" in prompt) || typeof prompt.append !== "string") {
|
|
27902
|
+
throw RequestError.invalidParams(void 0, "systemPrompt must contain only an append string");
|
|
27903
|
+
}
|
|
27904
|
+
if (Buffer.byteLength(prompt.append, "utf8") > SYSTEM_PROMPT_CAPABILITY.maxBytes) {
|
|
27905
|
+
throw RequestError.invalidParams(void 0, `systemPrompt.append exceeds ${SYSTEM_PROMPT_CAPABILITY.maxBytes} UTF-8 bytes`);
|
|
27906
|
+
}
|
|
27907
|
+
return prompt.append;
|
|
27908
|
+
}
|
|
27909
|
+
|
|
27896
27910
|
// src/AcpSessionExtensions.ts
|
|
27897
27911
|
function asSdkSessionNotification(notification) {
|
|
27898
27912
|
return notification;
|
|
@@ -34378,7 +34392,7 @@ var package_default = {
|
|
|
34378
34392
|
publishConfig: {
|
|
34379
34393
|
access: "public"
|
|
34380
34394
|
},
|
|
34381
|
-
version: "2.2.2-alas.
|
|
34395
|
+
version: "2.2.2-alas.2",
|
|
34382
34396
|
description: "",
|
|
34383
34397
|
main: "dist/index.js",
|
|
34384
34398
|
bin: {
|
|
@@ -34455,7 +34469,7 @@ var package_default = {
|
|
|
34455
34469
|
alasDownstream: {
|
|
34456
34470
|
upstreamVersion: "2.2.2",
|
|
34457
34471
|
upstreamCommit: "202e66e63343ec4f5a5e35ab590251d813d129ca",
|
|
34458
|
-
sourceCommit: "
|
|
34472
|
+
sourceCommit: "f431e5cac0d2972bcb8295f8967d6f27f6633eea"
|
|
34459
34473
|
}
|
|
34460
34474
|
};
|
|
34461
34475
|
|
|
@@ -34659,6 +34673,8 @@ var CodexSubagentSubscriptions = class {
|
|
|
34659
34673
|
// src/SessionFork.ts
|
|
34660
34674
|
import { createHash } from "node:crypto";
|
|
34661
34675
|
async function forkSession(request, additionalDirectories, dependencies) {
|
|
34676
|
+
const append = readSessionInstructionAppend(request._meta);
|
|
34677
|
+
const instructionOverride = await dependencies.sessionInstructionOverride(append, request.cwd);
|
|
34662
34678
|
await dependencies.refreshSkills(request.cwd, additionalDirectories);
|
|
34663
34679
|
const lastTurnId = await resolveForkTurnId(request, dependencies.codexClient);
|
|
34664
34680
|
const sessionConfig = await dependencies.createSessionConfig(
|
|
@@ -34667,6 +34683,7 @@ async function forkSession(request, additionalDirectories, dependencies) {
|
|
|
34667
34683
|
request.mcpServers ?? []
|
|
34668
34684
|
);
|
|
34669
34685
|
const response = await dependencies.codexClient.threadFork({
|
|
34686
|
+
...instructionOverride,
|
|
34670
34687
|
excludeTurns: true,
|
|
34671
34688
|
config: sessionConfig.config,
|
|
34672
34689
|
cwd: request.cwd,
|
|
@@ -34767,6 +34784,13 @@ var CodexAcpClient = class _CodexAcpClient {
|
|
|
34767
34784
|
pendingLoginCompleted = null;
|
|
34768
34785
|
pendingAccountUpdated = null;
|
|
34769
34786
|
sessionNotificationQueues = /* @__PURE__ */ new Map();
|
|
34787
|
+
/**
|
|
34788
|
+
* The `systemPrompt.append` each thread was opened with in this process. A
|
|
34789
|
+
* client that reconnects to a live adapter sends `session/load` or
|
|
34790
|
+
* `session/resume` again with the same text; Codex already holds those
|
|
34791
|
+
* instructions, so a matching repeat is accepted without an override.
|
|
34792
|
+
*/
|
|
34793
|
+
appliedInstructionAppends = /* @__PURE__ */ new Map();
|
|
34770
34794
|
subagents;
|
|
34771
34795
|
skillExtraRoots = [];
|
|
34772
34796
|
configPath = null;
|
|
@@ -35232,16 +35256,20 @@ var CodexAcpClient = class _CodexAcpClient {
|
|
|
35232
35256
|
}
|
|
35233
35257
|
}
|
|
35234
35258
|
async resumeSession(request, onSubscribed) {
|
|
35259
|
+
const append = readSessionInstructionAppend(request._meta);
|
|
35260
|
+
const instructionOverride = await this.sessionInstructionOverride(append, request.cwd, request.sessionId);
|
|
35235
35261
|
const additionalDirectories = readAdditionalDirectories(request.cwd, request.additionalDirectories, request._meta);
|
|
35236
35262
|
await this.refreshSkills(request.cwd, additionalDirectories);
|
|
35237
35263
|
const sessionConfig = await this.createSessionConfig(request.cwd, additionalDirectories, request.mcpServers ?? []);
|
|
35238
35264
|
const response = await this.resumeThread({
|
|
35239
35265
|
excludeTurns: true,
|
|
35266
|
+
...instructionOverride,
|
|
35240
35267
|
config: sessionConfig.config,
|
|
35241
35268
|
cwd: request.cwd,
|
|
35242
35269
|
modelProvider: await this.getResumeModelProvider(),
|
|
35243
35270
|
threadId: request.sessionId
|
|
35244
35271
|
});
|
|
35272
|
+
this.recordInstructionAppend(request.sessionId, append);
|
|
35245
35273
|
onSubscribed?.();
|
|
35246
35274
|
const codexModels = await this.fetchAvailableModels();
|
|
35247
35275
|
const currentModelId = this.createModelId(codexModels, response.model, response.reasoningEffort).toString();
|
|
@@ -35259,8 +35287,9 @@ var CodexAcpClient = class _CodexAcpClient {
|
|
|
35259
35287
|
}
|
|
35260
35288
|
async forkSession(request, releaseFailedFork = (threadId) => this.closeSession(threadId)) {
|
|
35261
35289
|
const additionalDirectories = readAdditionalDirectories(request.cwd, request.additionalDirectories, request._meta);
|
|
35262
|
-
|
|
35290
|
+
const metadata = await forkSession(request, additionalDirectories, {
|
|
35263
35291
|
codexClient: this.codexClient,
|
|
35292
|
+
sessionInstructionOverride: (append, cwd) => this.sessionInstructionOverride(append, cwd),
|
|
35264
35293
|
refreshSkills: (cwd, directories) => this.refreshSkills(cwd, directories),
|
|
35265
35294
|
createSessionConfig: (cwd, directories, mcpServers) => this.createSessionConfig(cwd, directories, mcpServers),
|
|
35266
35295
|
getResumeModelProvider: () => this.getResumeModelProvider(),
|
|
@@ -35269,18 +35298,24 @@ var CodexAcpClient = class _CodexAcpClient {
|
|
|
35269
35298
|
getCollaborationMode: (sessionId) => this.getCollaborationMode(sessionId),
|
|
35270
35299
|
releaseFailedFork
|
|
35271
35300
|
});
|
|
35301
|
+
this.recordInstructionAppend(metadata.sessionId, readSessionInstructionAppend(request._meta));
|
|
35302
|
+
return metadata;
|
|
35272
35303
|
}
|
|
35273
35304
|
async loadSession(request, onSubscribed) {
|
|
35305
|
+
const append = readSessionInstructionAppend(request._meta);
|
|
35306
|
+
const instructionOverride = await this.sessionInstructionOverride(append, request.cwd, request.sessionId);
|
|
35274
35307
|
const additionalDirectories = readAdditionalDirectories(request.cwd, request.additionalDirectories, request._meta);
|
|
35275
35308
|
await this.refreshSkills(request.cwd, additionalDirectories);
|
|
35276
35309
|
const sessionConfig = await this.createSessionConfig(request.cwd, additionalDirectories, request.mcpServers ?? []);
|
|
35277
35310
|
const response = await this.resumeThread({
|
|
35278
35311
|
excludeTurns: true,
|
|
35312
|
+
...instructionOverride,
|
|
35279
35313
|
config: sessionConfig.config,
|
|
35280
35314
|
cwd: request.cwd,
|
|
35281
35315
|
modelProvider: await this.getResumeModelProvider(),
|
|
35282
35316
|
threadId: request.sessionId
|
|
35283
35317
|
});
|
|
35318
|
+
this.recordInstructionAppend(request.sessionId, append);
|
|
35284
35319
|
onSubscribed?.();
|
|
35285
35320
|
let thread = { ...response.thread, turns: [] };
|
|
35286
35321
|
let history = noItems();
|
|
@@ -35335,16 +35370,24 @@ var CodexAcpClient = class _CodexAcpClient {
|
|
|
35335
35370
|
return null;
|
|
35336
35371
|
}
|
|
35337
35372
|
async newSession(request) {
|
|
35373
|
+
const append = readSessionInstructionAppend(request._meta);
|
|
35374
|
+
const custom2 = airCustomInstructions(request._meta);
|
|
35375
|
+
if (append !== void 0 && custom2 !== void 0) {
|
|
35376
|
+
throw RequestError.invalidParams(void 0, "systemPrompt.append and AIR customInstructions cannot be combined");
|
|
35377
|
+
}
|
|
35378
|
+
const instructionOverride = await this.sessionInstructionOverride(append, request.cwd);
|
|
35338
35379
|
const additionalDirectories = readAdditionalDirectories(request.cwd, request.additionalDirectories, request._meta);
|
|
35339
35380
|
const developerInstructions = airCustomInstructions(request._meta);
|
|
35340
35381
|
await this.refreshSkills(request.cwd, additionalDirectories);
|
|
35341
35382
|
const sessionConfig = await this.createSessionConfig(request.cwd, additionalDirectories, request.mcpServers);
|
|
35342
35383
|
const response = await this.codexClient.threadStart({
|
|
35384
|
+
...instructionOverride,
|
|
35343
35385
|
config: sessionConfig.config,
|
|
35344
35386
|
modelProvider: this.getModelProvider(),
|
|
35345
35387
|
cwd: request.cwd,
|
|
35346
35388
|
...developerInstructions !== void 0 && { developerInstructions }
|
|
35347
35389
|
});
|
|
35390
|
+
this.recordInstructionAppend(response.thread.id, append);
|
|
35348
35391
|
const codexModels = await this.fetchAvailableModels();
|
|
35349
35392
|
if (codexModels.length === 0) {
|
|
35350
35393
|
throw new Error("Codex did not return any models");
|
|
@@ -35441,6 +35484,32 @@ var CodexAcpClient = class _CodexAcpClient {
|
|
|
35441
35484
|
getMcpServerStartupVersion() {
|
|
35442
35485
|
return this.codexClient.mcpStartup.version();
|
|
35443
35486
|
}
|
|
35487
|
+
recordInstructionAppend(sessionId, append) {
|
|
35488
|
+
if (append === void 0) return;
|
|
35489
|
+
this.appliedInstructionAppends.set(sessionId, append);
|
|
35490
|
+
}
|
|
35491
|
+
async sessionInstructionOverride(append, cwd, sessionId) {
|
|
35492
|
+
if (append === void 0) return {};
|
|
35493
|
+
if (sessionId !== void 0) {
|
|
35494
|
+
let cursor;
|
|
35495
|
+
do {
|
|
35496
|
+
const page = await this.codexClient.threadLoadedList({ ...cursor !== void 0 && { cursor } });
|
|
35497
|
+
if (page.data.includes(sessionId)) {
|
|
35498
|
+
if (this.appliedInstructionAppends.get(sessionId) === append) return {};
|
|
35499
|
+
throw RequestError.invalidParams(void 0, "Cannot append instructions to a loaded thread; close it before loading or resuming with instructions");
|
|
35500
|
+
}
|
|
35501
|
+
cursor = page.nextCursor ?? void 0;
|
|
35502
|
+
} while (cursor !== void 0);
|
|
35503
|
+
}
|
|
35504
|
+
const effective = await this.codexClient.configRead({ cwd, includeLayers: false });
|
|
35505
|
+
const configured = this.config["developer_instructions"] !== void 0 ? this.config["developer_instructions"] : effective.config.developer_instructions;
|
|
35506
|
+
if (configured != null && typeof configured !== "string") {
|
|
35507
|
+
throw RequestError.invalidParams(void 0, "Configured developer_instructions must be a string");
|
|
35508
|
+
}
|
|
35509
|
+
return { developerInstructions: configured ? append ? `${configured}
|
|
35510
|
+
|
|
35511
|
+
${append}` : configured : append };
|
|
35512
|
+
}
|
|
35444
35513
|
async createSessionConfig(projectPath, additionalDirectories, mcpServers) {
|
|
35445
35514
|
const sessionRoots = [projectPath, ...additionalDirectories];
|
|
35446
35515
|
const activeProvider = this.gatewayConfig ? {
|
|
@@ -39236,7 +39305,7 @@ var JsonText = class {
|
|
|
39236
39305
|
}
|
|
39237
39306
|
text;
|
|
39238
39307
|
};
|
|
39239
|
-
var MAX_DEPTH =
|
|
39308
|
+
var MAX_DEPTH = 64;
|
|
39240
39309
|
var apply = Reflect.apply;
|
|
39241
39310
|
var getPrototypeOf = Object.getPrototypeOf;
|
|
39242
39311
|
var isRawJson = JSON.isRawJSON ?? (() => false);
|
|
@@ -42504,6 +42573,7 @@ var CodexAcpServer = class {
|
|
|
42504
42573
|
},
|
|
42505
42574
|
authMethods: getCodexAuthMethods(_params.clientCapabilities),
|
|
42506
42575
|
_meta: {
|
|
42576
|
+
systemPrompt: SYSTEM_PROMPT_CAPABILITY,
|
|
42507
42577
|
steering: {
|
|
42508
42578
|
supported: true
|
|
42509
42579
|
},
|
|
@@ -43087,6 +43157,7 @@ Check ${configPath} and project .codex directories, especially their config.toml
|
|
|
43087
43157
|
return null;
|
|
43088
43158
|
}
|
|
43089
43159
|
async loadSession(params) {
|
|
43160
|
+
readSessionInstructionAppend(params._meta);
|
|
43090
43161
|
return this.recovery === null ? await this.loadSessionOnce(params) : await this.recovery.trackOpen(params.sessionId, () => this.loadSessionOnce(params));
|
|
43091
43162
|
}
|
|
43092
43163
|
async loadSessionOnce(params) {
|
|
@@ -43129,6 +43200,7 @@ Check ${configPath} and project .codex directories, especially their config.toml
|
|
|
43129
43200
|
};
|
|
43130
43201
|
}
|
|
43131
43202
|
async resumeSession(params) {
|
|
43203
|
+
readSessionInstructionAppend(params._meta);
|
|
43132
43204
|
return this.recovery === null ? await this.resumeSessionOnce(params) : await this.recovery.trackOpen(params.sessionId, () => this.resumeSessionOnce(params));
|
|
43133
43205
|
}
|
|
43134
43206
|
async resumeSessionOnce(params) {
|
|
@@ -43151,6 +43223,7 @@ Check ${configPath} and project .codex directories, especially their config.toml
|
|
|
43151
43223
|
};
|
|
43152
43224
|
}
|
|
43153
43225
|
async forkSession(params) {
|
|
43226
|
+
readSessionInstructionAppend(params._meta);
|
|
43154
43227
|
if (this.providerUpdate !== null) {
|
|
43155
43228
|
await this.waitForProviderUpdate();
|
|
43156
43229
|
}
|
|
@@ -43262,6 +43335,7 @@ Check ${configPath} and project .codex directories, especially their config.toml
|
|
|
43262
43335
|
return this.sessionOpenGenerations.get(sessionId) === this.getSessionGeneration(sessionId);
|
|
43263
43336
|
}
|
|
43264
43337
|
async newSession(params) {
|
|
43338
|
+
readSessionInstructionAppend(params._meta);
|
|
43265
43339
|
if (this.providerUpdate !== null) {
|
|
43266
43340
|
await this.waitForProviderUpdate();
|
|
43267
43341
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "2.2.2-alas.
|
|
6
|
+
"version": "2.2.2-alas.2",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"bin": {
|
|
@@ -80,6 +80,6 @@
|
|
|
80
80
|
"alasDownstream": {
|
|
81
81
|
"upstreamVersion": "2.2.2",
|
|
82
82
|
"upstreamCommit": "202e66e63343ec4f5a5e35ab590251d813d129ca",
|
|
83
|
-
"sourceCommit": "
|
|
83
|
+
"sourceCommit": "f431e5cac0d2972bcb8295f8967d6f27f6633eea"
|
|
84
84
|
}
|
|
85
85
|
}
|