lody 0.73.0 → 0.75.1
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/chunks/{diff-line-counts-BLxwWP6r.js → diff-line-counts-Du5QanrM.js} +3 -2
- package/dist/chunks/{directory-handle-QE16b3Ol.js → directory-handle-Dn3SB9Us.js} +2 -2
- package/dist/chunks/{index-B9fKl40V.js → index-Bn7ENQt8.js} +2 -1
- package/dist/chunks/{index-yJXq3BkB.js → index-Cuqd9gip.js} +172 -41
- package/dist/chunks/loro_wasm_bg-DLsklGR5.js +5197 -0
- package/dist/chunks/package-C4jJQVT8.js +4133 -0
- package/dist/chunks/{review-viewer-BbX0BXrV.js → review-viewer-B_uk2FYA.js} +2 -2
- package/dist/chunks/{schemas-CDSDDVK-.js → schemas-BDpQ67Nq.js} +89 -19
- package/dist/chunks/{turn-diff-replay-qRat9u1k.js → turn-diff-replay-BUdzlx5r.js} +2 -2
- package/dist/claude-acp.js +52 -3465
- package/dist/code-collab-watch-worker.js +102 -36
- package/dist/codex-acp.js +1 -1
- package/dist/diff-worker.js +1 -1
- package/dist/file-index-scan-worker.js +3 -3
- package/dist/index.js +8779 -6391
- package/dist/turn-diff-replay-worker.js +1 -1
- package/package.json +13 -11
- package/dist/chunks/loro_wasm_bg-N-tMVpou.js +0 -5197
- package/dist/chunks/package-CkkAIS-_.js +0 -11
|
@@ -603,7 +603,7 @@ let gitAvailable;
|
|
|
603
603
|
function isGitAvailable() {
|
|
604
604
|
if (gitAvailable === void 0) {
|
|
605
605
|
try {
|
|
606
|
-
gitAvailable = spawnSync("git", ["--version"], { stdio: "ignore" }).status === 0;
|
|
606
|
+
gitAvailable = spawnSync("git", ["--version"], { stdio: "ignore", windowsHide: true }).status === 0;
|
|
607
607
|
} catch {
|
|
608
608
|
gitAvailable = false;
|
|
609
609
|
}
|
|
@@ -624,7 +624,8 @@ function gitNumstatLineCounts(oldText, newText) {
|
|
|
624
624
|
writeFileSync(newPath, newText);
|
|
625
625
|
const result = spawnSync("git", ["diff", "--no-index", "--numstat", "--", oldPath, newPath], {
|
|
626
626
|
encoding: "utf8",
|
|
627
|
-
maxBuffer: GIT_NUMSTAT_MAX_BUFFER
|
|
627
|
+
maxBuffer: GIT_NUMSTAT_MAX_BUFFER,
|
|
628
|
+
windowsHide: true
|
|
628
629
|
});
|
|
629
630
|
if (result.status !== 0 && result.status !== 1) {
|
|
630
631
|
return null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { o as object, s as string, l as literal, b as boolean, a as _enum, u as union, n as number, d as discriminatedUnion, c as array, r as record,
|
|
1
|
+
import { o as object, s as string, l as literal, b as boolean, a as _enum, u as union, n as number, d as discriminatedUnion, c as array, r as record, I as tuple, e as unknown } from "./schemas-BDpQ67Nq.js";
|
|
2
2
|
import { execFile } from "node:child_process";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import path__default from "node:path";
|
|
5
5
|
import { promisify } from "node:util";
|
|
6
|
-
import { a as countTextLines } from "./diff-line-counts-
|
|
6
|
+
import { a as countTextLines } from "./diff-line-counts-Du5QanrM.js";
|
|
7
7
|
_enum(["host", "write", "read"]);
|
|
8
8
|
_enum([
|
|
9
9
|
"not-started",
|
|
@@ -293,7 +293,8 @@ async function runGit(repoPath, args, maxBuffer = 8 * 1024 * 1024) {
|
|
|
293
293
|
const result = await execFileAsync("git", args, {
|
|
294
294
|
cwd: repoPath,
|
|
295
295
|
encoding: "utf8",
|
|
296
|
-
maxBuffer
|
|
296
|
+
maxBuffer,
|
|
297
|
+
windowsHide: true
|
|
297
298
|
});
|
|
298
299
|
return result.stdout;
|
|
299
300
|
}
|
|
@@ -20804,6 +20804,16 @@ var ACP_EXT_SESSION_USAGE_UPDATE_METHOD = "_acp_ext:session_usage_update";
|
|
|
20804
20804
|
var ACP_EXT_SESSION_RATE_LIMITS_METHOD = "_acp_ext:session_rate_limits";
|
|
20805
20805
|
var ACP_EXT_CODEX_PROPOSED_PLAN_METHOD = "_acp_ext:codex_proposed_plan";
|
|
20806
20806
|
var CODEX_STEER_APPLIED_METHOD = "_codex/steerApplied";
|
|
20807
|
+
function getLodyForkTurnId(meta3) {
|
|
20808
|
+
if (typeof meta3 !== "object" || meta3 === null) return null;
|
|
20809
|
+
const lody = meta3["lody"];
|
|
20810
|
+
if (typeof lody !== "object" || lody === null) return null;
|
|
20811
|
+
const forkAtTurn = lody["forkAtTurn"];
|
|
20812
|
+
if (typeof forkAtTurn !== "object" || forkAtTurn === null) return null;
|
|
20813
|
+
const version2 = forkAtTurn["version"];
|
|
20814
|
+
const turnId = forkAtTurn["turnId"];
|
|
20815
|
+
return version2 === 1 && typeof turnId === "string" && turnId.length > 0 ? turnId : null;
|
|
20816
|
+
}
|
|
20807
20817
|
var CODEX_STEER_CAPABILITY = {
|
|
20808
20818
|
version: 1,
|
|
20809
20819
|
appliedNotification: CODEX_STEER_APPLIED_METHOD,
|
|
@@ -21720,22 +21730,24 @@ function createFuzzyFileSearchComplete(event) {
|
|
|
21720
21730
|
};
|
|
21721
21731
|
}
|
|
21722
21732
|
function createWebSearchStartUpdate(item) {
|
|
21733
|
+
const { results: _results, ...rawInput } = item;
|
|
21723
21734
|
return {
|
|
21724
21735
|
sessionUpdate: "tool_call",
|
|
21725
21736
|
toolCallId: item.id,
|
|
21726
21737
|
kind: "search",
|
|
21727
21738
|
title: formatWebSearchTitle(item),
|
|
21728
21739
|
status: "in_progress",
|
|
21729
|
-
rawInput
|
|
21740
|
+
rawInput
|
|
21730
21741
|
};
|
|
21731
21742
|
}
|
|
21732
21743
|
function createWebSearchCompleteUpdate(item) {
|
|
21744
|
+
const { results: _results, ...rawInput } = item;
|
|
21733
21745
|
return {
|
|
21734
21746
|
sessionUpdate: "tool_call_update",
|
|
21735
21747
|
toolCallId: item.id,
|
|
21736
21748
|
title: formatWebSearchTitle(item),
|
|
21737
21749
|
status: "completed",
|
|
21738
|
-
rawInput
|
|
21750
|
+
rawInput
|
|
21739
21751
|
};
|
|
21740
21752
|
}
|
|
21741
21753
|
function createCollabAgentToolCallUpdate(item) {
|
|
@@ -22180,6 +22192,12 @@ function createCodexMessagePhaseMeta(phase) {
|
|
|
22180
22192
|
}
|
|
22181
22193
|
return { codex: { phase } };
|
|
22182
22194
|
}
|
|
22195
|
+
function createCodexAgentMessageMeta(phase, turnId) {
|
|
22196
|
+
return {
|
|
22197
|
+
...phase ? { codex: { phase } } : {},
|
|
22198
|
+
lody: { turnId }
|
|
22199
|
+
};
|
|
22200
|
+
}
|
|
22183
22201
|
function createUserMessageChunk(content, messageId, meta3) {
|
|
22184
22202
|
if (messageId) {
|
|
22185
22203
|
return {
|
|
@@ -22346,6 +22364,8 @@ var CodexEventHandler = class {
|
|
|
22346
22364
|
return this.createTerminalInteractionEvent(notification.params);
|
|
22347
22365
|
// ignored events
|
|
22348
22366
|
case "thread/deleted":
|
|
22367
|
+
case "thread/environment/connected":
|
|
22368
|
+
case "thread/environment/disconnected":
|
|
22349
22369
|
case "command/exec/outputDelta":
|
|
22350
22370
|
case "hook/started":
|
|
22351
22371
|
case "hook/completed":
|
|
@@ -22375,6 +22395,7 @@ var CodexEventHandler = class {
|
|
|
22375
22395
|
case "mcpServer/oauthLogin/completed":
|
|
22376
22396
|
case "externalAgentConfig/import/completed":
|
|
22377
22397
|
case "rawResponseItem/completed":
|
|
22398
|
+
case "rawResponse/completed":
|
|
22378
22399
|
case "thread/started":
|
|
22379
22400
|
case "item/plan/delta":
|
|
22380
22401
|
case "remoteControl/status/changed":
|
|
@@ -22487,7 +22508,11 @@ var CodexEventHandler = class {
|
|
|
22487
22508
|
}
|
|
22488
22509
|
async createTextEvent(event) {
|
|
22489
22510
|
const phase = this.agentMessagePhases.get(event.itemId) ?? null;
|
|
22490
|
-
return createAgentTextMessageChunk(
|
|
22511
|
+
return createAgentTextMessageChunk(
|
|
22512
|
+
event.delta,
|
|
22513
|
+
event.itemId,
|
|
22514
|
+
createCodexAgentMessageMeta(phase, event.turnId)
|
|
22515
|
+
);
|
|
22491
22516
|
}
|
|
22492
22517
|
async createConfigWarningEvent(event) {
|
|
22493
22518
|
const detailsText = event.details ? `
|
|
@@ -22892,6 +22917,7 @@ ${event.stdin}
|
|
|
22892
22917
|
secondary: rateLimits.secondary ?? existing.secondary,
|
|
22893
22918
|
credits: rateLimits.credits ?? existing.credits,
|
|
22894
22919
|
individualLimit: rateLimits.individualLimit ?? existing.individualLimit,
|
|
22920
|
+
spendControlReached: rateLimits.spendControlReached ?? existing.spendControlReached,
|
|
22895
22921
|
planType: rateLimits.planType ?? existing.planType,
|
|
22896
22922
|
rateLimitReachedType: rateLimits.rateLimitReachedType ?? existing.rateLimitReachedType
|
|
22897
22923
|
} : rateLimits;
|
|
@@ -24599,7 +24625,7 @@ var package_default = {
|
|
|
24599
24625
|
publishConfig: {
|
|
24600
24626
|
access: "public"
|
|
24601
24627
|
},
|
|
24602
|
-
version: "1.
|
|
24628
|
+
version: "1.3.0",
|
|
24603
24629
|
description: "An ACP-compatible coding agent powered by Codex",
|
|
24604
24630
|
main: "dist/index.js",
|
|
24605
24631
|
bin: {
|
|
@@ -24665,7 +24691,7 @@ var package_default = {
|
|
|
24665
24691
|
},
|
|
24666
24692
|
dependencies: {
|
|
24667
24693
|
"@agentclientprotocol/sdk": "^1.2.1",
|
|
24668
|
-
"@openai/codex": "^0.
|
|
24694
|
+
"@openai/codex": "^0.145.0",
|
|
24669
24695
|
diff: "^9.0.0",
|
|
24670
24696
|
open: "^11.0.0",
|
|
24671
24697
|
"vscode-jsonrpc": "^9.0.1",
|
|
@@ -24673,6 +24699,7 @@ var package_default = {
|
|
|
24673
24699
|
}
|
|
24674
24700
|
};
|
|
24675
24701
|
var CUSTOM_GATEWAY_PROVIDER_ID = "custom-gateway";
|
|
24702
|
+
var SESSION_LIST_PAGE_SIZE = 100;
|
|
24676
24703
|
var SUPPORTED_GATEWAY_PROTOCOLS = {
|
|
24677
24704
|
openai: "responses"
|
|
24678
24705
|
};
|
|
@@ -24910,7 +24937,7 @@ var CodexAcpClient = class {
|
|
|
24910
24937
|
modelProvider: await this.getResumeModelProvider(),
|
|
24911
24938
|
threadId: request.sessionId
|
|
24912
24939
|
});
|
|
24913
|
-
onSubscribed?.();
|
|
24940
|
+
onSubscribed?.(request.sessionId);
|
|
24914
24941
|
const codexModels = await this.fetchAvailableModels();
|
|
24915
24942
|
const currentModelId = this.createModelId(codexModels, response.model, response.reasoningEffort).toString();
|
|
24916
24943
|
return {
|
|
@@ -24922,6 +24949,30 @@ var CodexAcpClient = class {
|
|
|
24922
24949
|
additionalDirectories
|
|
24923
24950
|
};
|
|
24924
24951
|
}
|
|
24952
|
+
async forkSession(request, onSubscribed) {
|
|
24953
|
+
const additionalDirectories = readAdditionalDirectories(request.cwd, request.additionalDirectories, request._meta);
|
|
24954
|
+
await this.refreshSkills(request.cwd, additionalDirectories);
|
|
24955
|
+
const forkTurnId = getLodyForkTurnId(request._meta);
|
|
24956
|
+
const response = await this.codexClient.threadFork({
|
|
24957
|
+
config: await this.createSessionConfig(request.cwd, additionalDirectories, request.mcpServers ?? []),
|
|
24958
|
+
cwd: request.cwd,
|
|
24959
|
+
excludeTurns: true,
|
|
24960
|
+
...forkTurnId ? { lastTurnId: forkTurnId } : {},
|
|
24961
|
+
modelProvider: await this.getResumeModelProvider(),
|
|
24962
|
+
threadId: request.sessionId
|
|
24963
|
+
});
|
|
24964
|
+
onSubscribed?.(response.thread.id);
|
|
24965
|
+
const codexModels = await this.fetchAvailableModels();
|
|
24966
|
+
const currentModelId = this.createModelId(codexModels, response.model, response.reasoningEffort).toString();
|
|
24967
|
+
return {
|
|
24968
|
+
sessionId: response.thread.id,
|
|
24969
|
+
currentModelId,
|
|
24970
|
+
models: codexModels,
|
|
24971
|
+
modelProvider: response.modelProvider,
|
|
24972
|
+
currentServiceTier: response.serviceTier ?? null,
|
|
24973
|
+
additionalDirectories
|
|
24974
|
+
};
|
|
24975
|
+
}
|
|
24925
24976
|
async loadSession(request, onSubscribed) {
|
|
24926
24977
|
const additionalDirectories = readAdditionalDirectories(request.cwd, request.additionalDirectories, request._meta);
|
|
24927
24978
|
await this.refreshSkills(request.cwd, additionalDirectories);
|
|
@@ -24948,7 +24999,7 @@ var CodexAcpClient = class {
|
|
|
24948
24999
|
additionalDirectories
|
|
24949
25000
|
};
|
|
24950
25001
|
}
|
|
24951
|
-
async newSession(request) {
|
|
25002
|
+
async newSession(request, onSubscribed) {
|
|
24952
25003
|
const additionalDirectories = readAdditionalDirectories(request.cwd, request.additionalDirectories, request._meta);
|
|
24953
25004
|
await this.refreshSkills(request.cwd, additionalDirectories);
|
|
24954
25005
|
const response = await this.codexClient.threadStart({
|
|
@@ -24956,6 +25007,7 @@ var CodexAcpClient = class {
|
|
|
24956
25007
|
modelProvider: this.getModelProvider(),
|
|
24957
25008
|
cwd: request.cwd
|
|
24958
25009
|
});
|
|
25010
|
+
onSubscribed?.(response.thread.id);
|
|
24959
25011
|
const codexModels = await this.fetchAvailableModels();
|
|
24960
25012
|
if (codexModels.length === 0) {
|
|
24961
25013
|
throw new Error("Codex did not return any models");
|
|
@@ -25271,8 +25323,12 @@ var CodexAcpClient = class {
|
|
|
25271
25323
|
const modelProviders = preferredProvider ? [preferredProvider] : [];
|
|
25272
25324
|
const listResponse = await this.codexClient.threadList({
|
|
25273
25325
|
cursor: request.cursor ?? null,
|
|
25326
|
+
limit: SESSION_LIST_PAGE_SIZE,
|
|
25327
|
+
sortKey: "updated_at",
|
|
25328
|
+
sortDirection: "desc",
|
|
25274
25329
|
modelProviders,
|
|
25275
|
-
sourceKinds
|
|
25330
|
+
sourceKinds,
|
|
25331
|
+
...requestedCwd && path__default.isAbsolute(requestedCwd) ? { cwd: requestedCwd } : {}
|
|
25276
25332
|
});
|
|
25277
25333
|
const mapThreadToSession = (thread) => ({
|
|
25278
25334
|
sessionId: thread.id,
|
|
@@ -25280,7 +25336,7 @@ var CodexAcpClient = class {
|
|
|
25280
25336
|
title: (thread.name ?? thread.preview) || null,
|
|
25281
25337
|
updatedAt: new Date(thread.updatedAt * 1e3).toISOString()
|
|
25282
25338
|
});
|
|
25283
|
-
if (listResponse.data.length === 0) {
|
|
25339
|
+
if (listResponse.data.length === 0 && !requestedCwd) {
|
|
25284
25340
|
const diagnostics = await this.runSessionListDiagnostics();
|
|
25285
25341
|
logger.log("Session list diagnostics", diagnostics);
|
|
25286
25342
|
}
|
|
@@ -27079,6 +27135,7 @@ var CodexAcpServer = class _CodexAcpServer {
|
|
|
27079
27135
|
},
|
|
27080
27136
|
sessionCapabilities: {
|
|
27081
27137
|
resume: {},
|
|
27138
|
+
fork: {},
|
|
27082
27139
|
list: {},
|
|
27083
27140
|
close: {},
|
|
27084
27141
|
delete: {},
|
|
@@ -27092,6 +27149,9 @@ var CodexAcpServer = class _CodexAcpServer {
|
|
|
27092
27149
|
_meta: {
|
|
27093
27150
|
codex: {
|
|
27094
27151
|
steer: CODEX_STEER_CAPABILITY
|
|
27152
|
+
},
|
|
27153
|
+
lody: {
|
|
27154
|
+
forkAtTurn: { version: 1 }
|
|
27095
27155
|
}
|
|
27096
27156
|
}
|
|
27097
27157
|
},
|
|
@@ -27139,6 +27199,15 @@ var CodexAcpServer = class _CodexAcpServer {
|
|
|
27139
27199
|
throw e;
|
|
27140
27200
|
}
|
|
27141
27201
|
}
|
|
27202
|
+
async getOrForkSession(request) {
|
|
27203
|
+
try {
|
|
27204
|
+
return await this.tryOpenSession({ kind: "fork", request });
|
|
27205
|
+
} catch (e) {
|
|
27206
|
+
const error48 = e instanceof Error ? e : new Error(String(e));
|
|
27207
|
+
await this.handleError(error48);
|
|
27208
|
+
throw e;
|
|
27209
|
+
}
|
|
27210
|
+
}
|
|
27142
27211
|
async handleError(e) {
|
|
27143
27212
|
if (e.message.includes("log out") || e.message.includes("cloud requirements")) {
|
|
27144
27213
|
await this.runWithProcessCheck(() => this.codexAcpClient.logout());
|
|
@@ -27203,47 +27272,93 @@ You have been logged out. Please try again.`);
|
|
|
27203
27272
|
return generation;
|
|
27204
27273
|
}
|
|
27205
27274
|
async tryCreateSession(request) {
|
|
27206
|
-
|
|
27275
|
+
return await this.tryOpenSession("sessionId" in request ? { kind: "resume", request } : { kind: "new", request });
|
|
27276
|
+
}
|
|
27277
|
+
async tryOpenSession(operation) {
|
|
27278
|
+
const { request } = operation;
|
|
27279
|
+
let openedSession = operation.kind === "resume" ? {
|
|
27280
|
+
sessionId: operation.request.sessionId,
|
|
27281
|
+
generation: this.beginSessionOpen(operation.request.sessionId)
|
|
27282
|
+
} : null;
|
|
27283
|
+
let subscribed = false;
|
|
27284
|
+
const onSubscribed = (reportedSessionId) => {
|
|
27285
|
+
const sessionId2 = reportedSessionId ?? (operation.kind === "resume" ? operation.request.sessionId : null);
|
|
27286
|
+
if (!sessionId2) {
|
|
27287
|
+
throw RequestError.internalError("Codex subscribed without reporting a session id");
|
|
27288
|
+
}
|
|
27289
|
+
subscribed = true;
|
|
27290
|
+
if (!openedSession) {
|
|
27291
|
+
openedSession = {
|
|
27292
|
+
sessionId: sessionId2,
|
|
27293
|
+
generation: this.beginSessionOpen(sessionId2)
|
|
27294
|
+
};
|
|
27295
|
+
}
|
|
27296
|
+
};
|
|
27207
27297
|
await this.checkAuthorization();
|
|
27208
27298
|
const requestedMcpServers = request.mcpServers ?? [];
|
|
27209
27299
|
const mcpServerStartupVersion = requestedMcpServers.length > 0 ? this.codexAcpClient.getMcpServerStartupVersion() : null;
|
|
27210
27300
|
let sessionMetadata;
|
|
27211
|
-
|
|
27212
|
-
|
|
27213
|
-
|
|
27214
|
-
|
|
27215
|
-
|
|
27216
|
-
|
|
27217
|
-
|
|
27218
|
-
|
|
27219
|
-
|
|
27220
|
-
|
|
27221
|
-
|
|
27222
|
-
|
|
27223
|
-
|
|
27224
|
-
|
|
27301
|
+
try {
|
|
27302
|
+
switch (operation.kind) {
|
|
27303
|
+
case "new":
|
|
27304
|
+
logger.log("Create new session...");
|
|
27305
|
+
sessionMetadata = await this.runWithProcessCheck(
|
|
27306
|
+
() => this.codexAcpClient.newSession(operation.request, onSubscribed)
|
|
27307
|
+
);
|
|
27308
|
+
break;
|
|
27309
|
+
case "resume":
|
|
27310
|
+
logger.log(`Resume existing session: ${operation.request.sessionId}...`);
|
|
27311
|
+
sessionMetadata = await this.runWithProcessCheck(
|
|
27312
|
+
() => this.codexAcpClient.resumeSession(operation.request, onSubscribed)
|
|
27313
|
+
);
|
|
27314
|
+
break;
|
|
27315
|
+
case "fork":
|
|
27316
|
+
logger.log(`Fork existing session: ${operation.request.sessionId}...`);
|
|
27317
|
+
sessionMetadata = await this.runWithProcessCheck(
|
|
27318
|
+
() => this.codexAcpClient.forkSession(operation.request, onSubscribed)
|
|
27319
|
+
);
|
|
27320
|
+
break;
|
|
27225
27321
|
}
|
|
27226
|
-
}
|
|
27227
|
-
|
|
27228
|
-
|
|
27322
|
+
} catch (err) {
|
|
27323
|
+
if (subscribed && openedSession) {
|
|
27324
|
+
await this.cleanupStaleSessionOpen(openedSession.sessionId, openedSession.generation);
|
|
27325
|
+
}
|
|
27326
|
+
throw err;
|
|
27229
27327
|
}
|
|
27230
27328
|
const { sessionId, currentModelId, models } = sessionMetadata;
|
|
27329
|
+
if (!openedSession) {
|
|
27330
|
+
openedSession = {
|
|
27331
|
+
sessionId,
|
|
27332
|
+
generation: this.beginSessionOpen(sessionId)
|
|
27333
|
+
};
|
|
27334
|
+
} else if (openedSession.sessionId !== sessionId) {
|
|
27335
|
+
if (subscribed) {
|
|
27336
|
+
await this.cleanupStaleSessionOpen(openedSession.sessionId, openedSession.generation);
|
|
27337
|
+
}
|
|
27338
|
+
throw RequestError.internalError(
|
|
27339
|
+
{ expectedSessionId: openedSession?.sessionId, actualSessionId: sessionId },
|
|
27340
|
+
"Codex opened a different session than it reported"
|
|
27341
|
+
);
|
|
27342
|
+
}
|
|
27343
|
+
subscribed = true;
|
|
27231
27344
|
const authProvider = sessionMetadata.modelProvider ?? this.codexAcpClient.getModelProvider();
|
|
27232
27345
|
let authState;
|
|
27233
27346
|
try {
|
|
27234
27347
|
authState = await this.getAuthStateForProvider(authProvider);
|
|
27235
27348
|
} catch (err) {
|
|
27236
|
-
if (
|
|
27237
|
-
await this.cleanupStaleSessionOpen(sessionId,
|
|
27349
|
+
if (subscribed) {
|
|
27350
|
+
await this.cleanupStaleSessionOpen(sessionId, openedSession.generation);
|
|
27238
27351
|
}
|
|
27239
27352
|
throw err;
|
|
27240
27353
|
}
|
|
27241
|
-
|
|
27242
|
-
|
|
27243
|
-
|
|
27244
|
-
await this.closeStaleSessionOpen(sessionId, sessionGeneration);
|
|
27354
|
+
if (!this.sessionOpenCanInstall(sessionId, openedSession.generation)) {
|
|
27355
|
+
subscribed = false;
|
|
27356
|
+
await this.closeStaleSessionOpen(sessionId, openedSession.generation);
|
|
27245
27357
|
}
|
|
27246
|
-
const sessionMcpServers = this.resolveSessionMcpServers(
|
|
27358
|
+
const sessionMcpServers = this.resolveSessionMcpServers(
|
|
27359
|
+
requestedMcpServers,
|
|
27360
|
+
operation.kind !== "new"
|
|
27361
|
+
);
|
|
27247
27362
|
const currentModel = this.findCurrentModel(models, currentModelId);
|
|
27248
27363
|
const currentModelSupportsFast = modelSupportsFast(currentModel);
|
|
27249
27364
|
const sessionState = {
|
|
@@ -27270,11 +27385,11 @@ You have been logged out. Please try again.`);
|
|
|
27270
27385
|
sessionMcpServers,
|
|
27271
27386
|
terminalOutputMode: this.terminalOutputMode,
|
|
27272
27387
|
sessionTitle: null,
|
|
27273
|
-
sessionTitleSource: "
|
|
27388
|
+
sessionTitleSource: operation.kind === "new" ? "unset" : "unknown"
|
|
27274
27389
|
};
|
|
27275
27390
|
this.sessions.set(sessionId, sessionState);
|
|
27276
27391
|
this.publishRateLimitsAsync(sessionState);
|
|
27277
|
-
|
|
27392
|
+
subscribed = false;
|
|
27278
27393
|
if (requestedMcpServers.length > 0 && mcpServerStartupVersion !== null) {
|
|
27279
27394
|
this.pendingMcpStartupSessions.set(sessionId, {
|
|
27280
27395
|
requestedServers: new Set(getRequestedMcpServerNames(requestedMcpServers)),
|
|
@@ -27375,6 +27490,20 @@ You have been logged out. Please try again.`);
|
|
|
27375
27490
|
...this.createSessionConfigOptionsResponse(this.getSessionState(sessionId))
|
|
27376
27491
|
};
|
|
27377
27492
|
}
|
|
27493
|
+
async unstable_forkSession(params) {
|
|
27494
|
+
logger.log("Forking session...", { sessionId: params.sessionId });
|
|
27495
|
+
const [sessionId, , modeState, availableCommands] = await this.getOrForkSession(params);
|
|
27496
|
+
this.publishAvailableCommandsAsync(sessionId, availableCommands);
|
|
27497
|
+
logger.log("Session forked", {
|
|
27498
|
+
sourceSessionId: params.sessionId,
|
|
27499
|
+
sessionId
|
|
27500
|
+
});
|
|
27501
|
+
return {
|
|
27502
|
+
sessionId,
|
|
27503
|
+
modes: modeState,
|
|
27504
|
+
...this.createSessionConfigOptionsResponse(this.getSessionState(sessionId))
|
|
27505
|
+
};
|
|
27506
|
+
}
|
|
27378
27507
|
async listSessions(params) {
|
|
27379
27508
|
logger.log("Listing sessions...", { cwd: params.cwd, cursor: params.cursor });
|
|
27380
27509
|
await this.checkAuthorization();
|
|
@@ -27805,7 +27934,7 @@ You have been logged out. Please try again.`);
|
|
|
27805
27934
|
const threadUpdates = [];
|
|
27806
27935
|
for (const turn of thread.turns) {
|
|
27807
27936
|
for (const item of turn.items) {
|
|
27808
|
-
const updates2 = await this.createHistoryUpdates(item, sessionState);
|
|
27937
|
+
const updates2 = await this.createHistoryUpdates(item, sessionState, turn.id);
|
|
27809
27938
|
threadUpdates.push(...updates2);
|
|
27810
27939
|
}
|
|
27811
27940
|
}
|
|
@@ -27855,7 +27984,7 @@ You have been logged out. Please try again.`);
|
|
|
27855
27984
|
const normalized = title?.replace(/\s+/g, " ").trim() ?? "";
|
|
27856
27985
|
return normalized.length > 0 ? normalized : null;
|
|
27857
27986
|
}
|
|
27858
|
-
async createHistoryUpdates(item, sessionState) {
|
|
27987
|
+
async createHistoryUpdates(item, sessionState, turnId) {
|
|
27859
27988
|
switch (item.type) {
|
|
27860
27989
|
case "userMessage":
|
|
27861
27990
|
return this.createUserMessageUpdates(item);
|
|
@@ -27864,12 +27993,11 @@ You have been logged out. Please try again.`);
|
|
|
27864
27993
|
case "sleep":
|
|
27865
27994
|
return [];
|
|
27866
27995
|
case "agentMessage": {
|
|
27867
|
-
const meta3 = createCodexMessagePhaseMeta(item.phase);
|
|
27868
27996
|
return [{
|
|
27869
27997
|
sessionUpdate: "agent_message_chunk",
|
|
27870
27998
|
messageId: item.id,
|
|
27871
27999
|
content: { type: "text", text: item.text },
|
|
27872
|
-
|
|
28000
|
+
_meta: createCodexAgentMessageMeta(item.phase, turnId)
|
|
27873
28001
|
}];
|
|
27874
28002
|
}
|
|
27875
28003
|
case "reasoning":
|
|
@@ -28957,6 +29085,9 @@ var CodexAppServerClient = class {
|
|
|
28957
29085
|
async threadResume(params) {
|
|
28958
29086
|
return await this.sendRequest({ method: "thread/resume", params });
|
|
28959
29087
|
}
|
|
29088
|
+
async threadFork(params) {
|
|
29089
|
+
return await this.sendRequest({ method: "thread/fork", params });
|
|
29090
|
+
}
|
|
28960
29091
|
async threadList(params) {
|
|
28961
29092
|
return await this.sendRequest({ method: "thread/list", params });
|
|
28962
29093
|
}
|
|
@@ -29573,5 +29704,5 @@ function startAcpServer() {
|
|
|
29573
29704
|
codexAcpServer = null;
|
|
29574
29705
|
}
|
|
29575
29706
|
});
|
|
29576
|
-
}).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)).connect(acpJsonStream);
|
|
29707
|
+
}).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.fork, (ctx) => getAgent().unstable_forkSession(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)).connect(acpJsonStream);
|
|
29577
29708
|
}
|