opencode-acp 1.18.1-pr.408.164 → 1.18.1-pr.408.169
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 +34 -17
- package/dist/index.js.map +1 -1
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/state/state.d.ts +1 -1
- package/dist/lib/state/state.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4917,6 +4917,8 @@ var SessionStateRegistry = class {
|
|
|
4917
4917
|
// (message transforms, compress/decompress tools, event-hook saves,
|
|
4918
4918
|
// system-hook limit writes). Shared factory so test stubs compose the
|
|
4919
4919
|
// exact same implementation instead of drifting.
|
|
4920
|
+
// Not readonly: the session-guard wiring test wraps this to observe
|
|
4921
|
+
// acquisition order (Issue #404).
|
|
4920
4922
|
withSessionGuard = createSessionGuard();
|
|
4921
4923
|
// Idempotent: ensureSessionInitialized returns immediately once
|
|
4922
4924
|
// state.sessionId === sessionId, and coalesces concurrent inits per state
|
|
@@ -5059,7 +5061,15 @@ async function ensureSessionInitialized(client, state, sessionId, logger, messag
|
|
|
5059
5061
|
if (state.sessionId === sessionId) {
|
|
5060
5062
|
return;
|
|
5061
5063
|
}
|
|
5062
|
-
const run = runSessionInitialization(
|
|
5064
|
+
const run = runSessionInitialization(
|
|
5065
|
+
client,
|
|
5066
|
+
state,
|
|
5067
|
+
sessionId,
|
|
5068
|
+
logger,
|
|
5069
|
+
messages,
|
|
5070
|
+
config,
|
|
5071
|
+
projectDir
|
|
5072
|
+
);
|
|
5063
5073
|
inflightInits.set(state, run);
|
|
5064
5074
|
try {
|
|
5065
5075
|
await run;
|
|
@@ -10595,7 +10605,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
|
10595
10605
|
import { join as join4 } from "path";
|
|
10596
10606
|
import { existsSync as existsSync4 } from "fs";
|
|
10597
10607
|
import { homedir as homedir3 } from "os";
|
|
10598
|
-
var LOG_VERSION = true ? "1.18.1-pr.408.
|
|
10608
|
+
var LOG_VERSION = true ? "1.18.1-pr.408.169" : "dev";
|
|
10599
10609
|
var LEVEL_RANK = {
|
|
10600
10610
|
debug: 10,
|
|
10601
10611
|
info: 20,
|
|
@@ -12911,8 +12921,11 @@ function createCommandExecuteHandler(client, registry4, logger, config, workingD
|
|
|
12911
12921
|
path: { id: input.sessionID }
|
|
12912
12922
|
});
|
|
12913
12923
|
const messages = filterMessages(messagesResponse.data || messagesResponse);
|
|
12914
|
-
const state = await registry4.
|
|
12915
|
-
|
|
12924
|
+
const state = await registry4.withSessionGuard(input.sessionID, async () => {
|
|
12925
|
+
const s = await registry4.getOrCreate(client, input.sessionID, messages, config);
|
|
12926
|
+
syncCompressPermissionState(s, config, hostPermissions, messages);
|
|
12927
|
+
return s;
|
|
12928
|
+
});
|
|
12916
12929
|
const commandCtx = {
|
|
12917
12930
|
client,
|
|
12918
12931
|
state,
|
|
@@ -12990,23 +13003,27 @@ function createEventHandler(registry4, logger) {
|
|
|
12990
13003
|
callId: part.callID,
|
|
12991
13004
|
durationMs
|
|
12992
13005
|
});
|
|
13006
|
+
const settles = [];
|
|
12993
13007
|
for (const state of registry4.all()) {
|
|
12994
13008
|
if (!state.sessionId) {
|
|
12995
13009
|
continue;
|
|
12996
13010
|
}
|
|
12997
|
-
|
|
12998
|
-
|
|
12999
|
-
|
|
13000
|
-
|
|
13001
|
-
|
|
13002
|
-
|
|
13003
|
-
|
|
13004
|
-
|
|
13005
|
-
|
|
13006
|
-
|
|
13007
|
-
|
|
13008
|
-
|
|
13011
|
+
settles.push(
|
|
13012
|
+
registry4.withSessionGuard(state.sessionId, async () => {
|
|
13013
|
+
const updates = applyPendingCompressionDurations(state);
|
|
13014
|
+
if (updates > 0) {
|
|
13015
|
+
await saveSessionState(state, logger);
|
|
13016
|
+
logger.info("Attached compression time to blocks", {
|
|
13017
|
+
messageID: part.messageID,
|
|
13018
|
+
callID: part.callID,
|
|
13019
|
+
blocks: updates,
|
|
13020
|
+
durationMs
|
|
13021
|
+
});
|
|
13022
|
+
}
|
|
13023
|
+
})
|
|
13024
|
+
);
|
|
13009
13025
|
}
|
|
13026
|
+
await Promise.allSettled(settles);
|
|
13010
13027
|
return;
|
|
13011
13028
|
}
|
|
13012
13029
|
if (part.state.status === "running") {
|
|
@@ -13290,7 +13307,7 @@ var server = (async (ctx) => {
|
|
|
13290
13307
|
}
|
|
13291
13308
|
const logger = new Logger(config.debug, config.debug ? "debug" : config.logLevel);
|
|
13292
13309
|
logger.info("ACP plugin initialized", {
|
|
13293
|
-
version: true ? "1.18.1-pr.408.
|
|
13310
|
+
version: true ? "1.18.1-pr.408.169" : "dev",
|
|
13294
13311
|
workspace: ctx.directory,
|
|
13295
13312
|
logLevel: logger.level,
|
|
13296
13313
|
debug: config.debug,
|