oh-my-opencode 2.11.0 → 2.12.0
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/cli/index.js +1 -1
- package/dist/index.js +39 -18
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2657,7 +2657,7 @@ var require_napi = __commonJS((exports, module) => {
|
|
|
2657
2657
|
var require_package = __commonJS((exports, module) => {
|
|
2658
2658
|
module.exports = {
|
|
2659
2659
|
name: "oh-my-opencode",
|
|
2660
|
-
version: "2.
|
|
2660
|
+
version: "2.11.0",
|
|
2661
2661
|
description: "OpenCode plugin - custom agents (oracle, librarian) and enhanced features",
|
|
2662
2662
|
main: "dist/index.js",
|
|
2663
2663
|
types: "dist/index.d.ts",
|
package/dist/index.js
CHANGED
|
@@ -8683,12 +8683,14 @@ function createTodoContinuationEnforcer(ctx, options = {}) {
|
|
|
8683
8683
|
const prompt = `${CONTINUATION_PROMPT}
|
|
8684
8684
|
|
|
8685
8685
|
[Status: ${todos.length - freshIncompleteCount}/${todos.length} completed, ${freshIncompleteCount} remaining]`;
|
|
8686
|
+
const modelField = prevMessage?.model?.providerID && prevMessage?.model?.modelID ? { providerID: prevMessage.model.providerID, modelID: prevMessage.model.modelID } : undefined;
|
|
8686
8687
|
try {
|
|
8687
|
-
log(`[${HOOK_NAME}] Injecting continuation`, { sessionID, agent: prevMessage?.agent, incompleteCount: freshIncompleteCount });
|
|
8688
|
+
log(`[${HOOK_NAME}] Injecting continuation`, { sessionID, agent: prevMessage?.agent, model: modelField, incompleteCount: freshIncompleteCount });
|
|
8688
8689
|
await ctx.client.session.prompt({
|
|
8689
8690
|
path: { id: sessionID },
|
|
8690
8691
|
body: {
|
|
8691
8692
|
agent: prevMessage?.agent,
|
|
8693
|
+
model: modelField,
|
|
8692
8694
|
parts: [{ type: "text", text: prompt }]
|
|
8693
8695
|
},
|
|
8694
8696
|
query: { directory: ctx.directory }
|
|
@@ -10726,9 +10728,19 @@ var TOKEN_LIMIT_KEYWORDS = [
|
|
|
10726
10728
|
"token limit",
|
|
10727
10729
|
"context length",
|
|
10728
10730
|
"too many tokens",
|
|
10729
|
-
"non-empty content"
|
|
10730
|
-
"invalid_request_error"
|
|
10731
|
+
"non-empty content"
|
|
10731
10732
|
];
|
|
10733
|
+
var THINKING_BLOCK_ERROR_PATTERNS = [
|
|
10734
|
+
/thinking.*first block/i,
|
|
10735
|
+
/first block.*thinking/i,
|
|
10736
|
+
/must.*start.*thinking/i,
|
|
10737
|
+
/thinking.*redacted_thinking/i,
|
|
10738
|
+
/expected.*thinking.*found/i,
|
|
10739
|
+
/thinking.*disabled.*cannot.*contain/i
|
|
10740
|
+
];
|
|
10741
|
+
function isThinkingBlockError(text) {
|
|
10742
|
+
return THINKING_BLOCK_ERROR_PATTERNS.some((pattern) => pattern.test(text));
|
|
10743
|
+
}
|
|
10732
10744
|
var MESSAGE_INDEX_PATTERN = /messages\.(\d+)/;
|
|
10733
10745
|
function extractTokensFromMessage(message) {
|
|
10734
10746
|
for (const pattern of TOKEN_LIMIT_PATTERNS) {
|
|
@@ -10749,6 +10761,9 @@ function extractMessageIndex2(text) {
|
|
|
10749
10761
|
return;
|
|
10750
10762
|
}
|
|
10751
10763
|
function isTokenLimitError(text) {
|
|
10764
|
+
if (isThinkingBlockError(text)) {
|
|
10765
|
+
return false;
|
|
10766
|
+
}
|
|
10752
10767
|
const lower = text.toLowerCase();
|
|
10753
10768
|
return TOKEN_LIMIT_KEYWORDS.some((kw) => lower.includes(kw.toLowerCase()));
|
|
10754
10769
|
}
|
|
@@ -17381,10 +17396,6 @@ function createClaudeCodeHooksHook(ctx, config = {}) {
|
|
|
17381
17396
|
} catch {}
|
|
17382
17397
|
const isFirstMessage = !sessionFirstMessageProcessed.has(input.sessionID);
|
|
17383
17398
|
sessionFirstMessageProcessed.add(input.sessionID);
|
|
17384
|
-
if (isFirstMessage) {
|
|
17385
|
-
log("Skipping UserPromptSubmit hooks on first message for title generation", { sessionID: input.sessionID });
|
|
17386
|
-
return;
|
|
17387
|
-
}
|
|
17388
17399
|
if (!isHookDisabled(config, "UserPromptSubmit")) {
|
|
17389
17400
|
const userPromptCtx = {
|
|
17390
17401
|
sessionId: input.sessionID,
|
|
@@ -17406,17 +17417,27 @@ function createClaudeCodeHooksHook(ctx, config = {}) {
|
|
|
17406
17417
|
const hookContent = result.messages.join(`
|
|
17407
17418
|
|
|
17408
17419
|
`);
|
|
17409
|
-
log(`[claude-code-hooks] Injecting ${result.messages.length} hook messages`, { sessionID: input.sessionID, contentLength: hookContent.length });
|
|
17410
|
-
|
|
17411
|
-
|
|
17412
|
-
|
|
17413
|
-
|
|
17414
|
-
|
|
17415
|
-
|
|
17416
|
-
|
|
17417
|
-
|
|
17418
|
-
|
|
17419
|
-
|
|
17420
|
+
log(`[claude-code-hooks] Injecting ${result.messages.length} hook messages`, { sessionID: input.sessionID, contentLength: hookContent.length, isFirstMessage });
|
|
17421
|
+
if (isFirstMessage) {
|
|
17422
|
+
const idx = output.parts.findIndex((p) => p.type === "text" && p.text);
|
|
17423
|
+
if (idx >= 0) {
|
|
17424
|
+
output.parts[idx].text = `${hookContent}
|
|
17425
|
+
|
|
17426
|
+
${output.parts[idx].text ?? ""}`;
|
|
17427
|
+
log("UserPromptSubmit hooks prepended to first message parts directly", { sessionID: input.sessionID });
|
|
17428
|
+
}
|
|
17429
|
+
} else {
|
|
17430
|
+
const message = output.message;
|
|
17431
|
+
const success = injectHookMessage(input.sessionID, hookContent, {
|
|
17432
|
+
agent: message.agent,
|
|
17433
|
+
model: message.model,
|
|
17434
|
+
path: message.path ?? { cwd: ctx.directory, root: "/" },
|
|
17435
|
+
tools: message.tools
|
|
17436
|
+
});
|
|
17437
|
+
log(success ? "Hook message injected via file system" : "File injection failed", {
|
|
17438
|
+
sessionID: input.sessionID
|
|
17439
|
+
});
|
|
17440
|
+
}
|
|
17420
17441
|
}
|
|
17421
17442
|
}
|
|
17422
17443
|
},
|