@khalilgharbaoui/opencode-claude-code-plugin 0.63.1 → 0.63.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/dist/index.js +47 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/claude-code-plugin/SKILL.md +1 -1
package/dist/index.js
CHANGED
|
@@ -8442,7 +8442,26 @@ function spawnIdentity(key) {
|
|
|
8442
8442
|
}
|
|
8443
8443
|
return parts.join("::");
|
|
8444
8444
|
}
|
|
8445
|
-
function
|
|
8445
|
+
function spawnHasPendingWork(key) {
|
|
8446
|
+
const active = activeProcesses.get(key);
|
|
8447
|
+
return !!(getPendingProxyCalls(key).length || hasExitPlanModeQuestions(key) || active?.pendingProxyCompletions?.size || active && (active.lineEmitter.listenerCount("line") > 0 || isSideQuestionPending(active)));
|
|
8448
|
+
}
|
|
8449
|
+
function conversationIdentity(key) {
|
|
8450
|
+
const parts = spawnIdentity(key).split("::");
|
|
8451
|
+
if (parts.length !== 5 || parts[2] === "compaction" || parts[3] === "default") return void 0;
|
|
8452
|
+
parts[1] = parts[1].replace(/^[^@]*/, "*");
|
|
8453
|
+
return parts.join("::");
|
|
8454
|
+
}
|
|
8455
|
+
function findBusySpawnVariant(requestedKey) {
|
|
8456
|
+
const identity = conversationIdentity(requestedKey);
|
|
8457
|
+
if (!identity || spawnHasPendingWork(requestedKey)) return void 0;
|
|
8458
|
+
for (const key of /* @__PURE__ */ new Set([...activeProcesses.keys(), ...claudeSessions.keys()])) {
|
|
8459
|
+
if (key === requestedKey || conversationIdentity(key) !== identity) continue;
|
|
8460
|
+
if (spawnHasPendingWork(key)) return key;
|
|
8461
|
+
}
|
|
8462
|
+
return void 0;
|
|
8463
|
+
}
|
|
8464
|
+
function invalidateOtherSpawnVariants(currentKey, options = {}) {
|
|
8446
8465
|
const levels = [
|
|
8447
8466
|
void 0,
|
|
8448
8467
|
"minimal",
|
|
@@ -8452,7 +8471,7 @@ function invalidateOtherSpawnVariants(baseKey, effort) {
|
|
|
8452
8471
|
"xhigh",
|
|
8453
8472
|
"max"
|
|
8454
8473
|
];
|
|
8455
|
-
const
|
|
8474
|
+
const baseKey = currentKey.replace(/::effort=[a-z]+$/, "");
|
|
8456
8475
|
const identity = spawnIdentity(currentKey);
|
|
8457
8476
|
const staleKeys = [
|
|
8458
8477
|
.../* @__PURE__ */ new Set([
|
|
@@ -8462,16 +8481,16 @@ function invalidateOtherSpawnVariants(baseKey, effort) {
|
|
|
8462
8481
|
])
|
|
8463
8482
|
].filter((key) => key !== currentKey && spawnIdentity(key) === identity);
|
|
8464
8483
|
for (const key of staleKeys) {
|
|
8465
|
-
|
|
8466
|
-
if (getPendingProxyCalls(key).length || hasExitPlanModeQuestions(key) || active?.pendingProxyCompletions?.size || active && (active.lineEmitter.listenerCount("line") > 0 || isSideQuestionPending(active))) {
|
|
8484
|
+
if (spawnHasPendingWork(key)) {
|
|
8467
8485
|
throw new Error(
|
|
8468
8486
|
"Cannot change reasoning effort, prompt cache TTL, maxTurns or maxBudgetUsd while this conversation's previous claude process has pending work. Finish that work under its original settings first."
|
|
8469
8487
|
);
|
|
8470
8488
|
}
|
|
8471
8489
|
}
|
|
8490
|
+
const carry = options.carryConversation !== false;
|
|
8472
8491
|
for (const key of staleKeys) {
|
|
8473
8492
|
deleteActiveProcess(key);
|
|
8474
|
-
if (transferClaudeSession(key, currentKey)) {
|
|
8493
|
+
if (carry && transferClaudeSession(key, currentKey)) {
|
|
8475
8494
|
clearCompression(key);
|
|
8476
8495
|
clearBackgroundTasks(key);
|
|
8477
8496
|
continue;
|
|
@@ -9333,6 +9352,7 @@ var PLUGIN_LOG_MESSAGES = /* @__PURE__ */ new Set([
|
|
|
9333
9352
|
"falling back to the next model in the chain",
|
|
9334
9353
|
"fast mode is in cooldown after a rate limit; this turn runs at standard speed and is billed at standard Opus rates, not the fast price shown in the model picker.",
|
|
9335
9354
|
"file part without data, skipping",
|
|
9355
|
+
"finishing the turn in progress under its original settings",
|
|
9336
9356
|
"forkSessions is on but this claude CLI has no --fork-session; replaying the conversation instead",
|
|
9337
9357
|
"forking the parent conversation's claude session instead of replaying it",
|
|
9338
9358
|
"holding a subagent dispatch for the operator's answer",
|
|
@@ -18392,7 +18412,15 @@ var ClaudeCodeLanguageModel = class {
|
|
|
18392
18412
|
cwd,
|
|
18393
18413
|
`${effectiveModelId}::${scope}::${affinity}::context=${JSON.stringify(context)}`
|
|
18394
18414
|
);
|
|
18395
|
-
const
|
|
18415
|
+
const requestedKey = effortSessionKey(baseKey, reasoningEffort);
|
|
18416
|
+
const busyVariant = compactionMode ? void 0 : findBusySpawnVariant(requestedKey);
|
|
18417
|
+
if (busyVariant) {
|
|
18418
|
+
log.notice("finishing the turn in progress under its original settings", {
|
|
18419
|
+
sessionKey: busyVariant,
|
|
18420
|
+
requestedKey
|
|
18421
|
+
});
|
|
18422
|
+
}
|
|
18423
|
+
const sk = compactionMode ? sessionKey(cwd, `${effectiveModelId}::compaction::${affinity}`) : busyVariant ?? requestedKey;
|
|
18396
18424
|
const toUsage2 = this.toUsage.bind(this);
|
|
18397
18425
|
const toFinishReason2 = this.toFinishReason.bind(this);
|
|
18398
18426
|
const handleControlRequest2 = this.handleControlRequest.bind(this);
|
|
@@ -18602,14 +18630,20 @@ var ClaudeCodeLanguageModel = class {
|
|
|
18602
18630
|
});
|
|
18603
18631
|
}
|
|
18604
18632
|
}
|
|
18605
|
-
if (!compactionMode)
|
|
18606
|
-
|
|
18607
|
-
|
|
18608
|
-
model: stripAccountSuffix(failover.modelId),
|
|
18609
|
-
effort: reasoningEffort,
|
|
18610
|
-
account: (this.config.failoverAccounts?.length ?? 0) > 1 ? failover.target ?? sourceAccount : void 0,
|
|
18611
|
-
agent: this.getOpencodeAgent(options)
|
|
18633
|
+
if (!compactionMode) {
|
|
18634
|
+
invalidateOtherSpawnVariants(sk, {
|
|
18635
|
+
carryConversation: this.config.resumeAcrossModelChanges !== false
|
|
18612
18636
|
});
|
|
18637
|
+
}
|
|
18638
|
+
if (!compactionMode && affinity !== "default") {
|
|
18639
|
+
if (!busyVariant) {
|
|
18640
|
+
recordSessionSpawn(affinity, {
|
|
18641
|
+
model: stripAccountSuffix(failover.modelId),
|
|
18642
|
+
effort: reasoningEffort,
|
|
18643
|
+
account: (this.config.failoverAccounts?.length ?? 0) > 1 ? failover.target ?? sourceAccount : void 0,
|
|
18644
|
+
agent: this.getOpencodeAgent(options)
|
|
18645
|
+
});
|
|
18646
|
+
}
|
|
18613
18647
|
const parked = new Set(getPendingProxyCalls(sk).map((call) => call.toolCallId));
|
|
18614
18648
|
if (startsTurn(options.prompt, parked)) {
|
|
18615
18649
|
markTurnStart(sk, {
|