@khalilgharbaoui/opencode-claude-code-plugin 0.53.4 → 0.53.5
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 +15 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5927,9 +5927,20 @@ function backgroundTaskIdsIn(text) {
|
|
|
5927
5927
|
}
|
|
5928
5928
|
return [...ids];
|
|
5929
5929
|
}
|
|
5930
|
+
var BATCH_SECTION = /^## task \d+ of \d+: /m;
|
|
5931
|
+
function acceptedBackgroundTaskIds(result) {
|
|
5932
|
+
if (result.kind !== "text") return [];
|
|
5933
|
+
if (result.isError !== true) return backgroundTaskIdsIn(result.text);
|
|
5934
|
+
const ids = /* @__PURE__ */ new Set();
|
|
5935
|
+
for (const section of result.text.split(BATCH_SECTION).slice(1)) {
|
|
5936
|
+
const body = section.slice(section.indexOf("\n") + 1);
|
|
5937
|
+
if (body.startsWith("[error] ") || body.startsWith("[missing] ")) continue;
|
|
5938
|
+
for (const id of backgroundTaskIdsIn(body)) ids.add(id);
|
|
5939
|
+
}
|
|
5940
|
+
return [...ids];
|
|
5941
|
+
}
|
|
5930
5942
|
function noteBackgroundDispatchResult(sessionKey2, result, now = Date.now()) {
|
|
5931
|
-
|
|
5932
|
-
for (const taskId of backgroundTaskIdsIn(result.text)) {
|
|
5943
|
+
for (const taskId of acceptedBackgroundTaskIds(result)) {
|
|
5933
5944
|
started.delete(taskId);
|
|
5934
5945
|
started.set(taskId, { sessionKey: sessionKey2, at: now });
|
|
5935
5946
|
while (started.size > MAX_STARTED) {
|
|
@@ -6012,8 +6023,8 @@ async function countOtherRunningWithin(exclude, budgetMs) {
|
|
|
6012
6023
|
}
|
|
6013
6024
|
}
|
|
6014
6025
|
async function withBackgroundRunningCount(result, budgetMs = BACKGROUND_COUNT_BUDGET_MS) {
|
|
6015
|
-
if (result.kind !== "text"
|
|
6016
|
-
const dispatched =
|
|
6026
|
+
if (result.kind !== "text") return result;
|
|
6027
|
+
const dispatched = acceptedBackgroundTaskIds(result);
|
|
6017
6028
|
if (dispatched.length === 0) return result;
|
|
6018
6029
|
const others = await countOtherRunningWithin(new Set(dispatched), budgetMs);
|
|
6019
6030
|
if (others === void 0) {
|