oh-my-opencode 3.3.0 → 3.3.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/cli/index.js +14 -8
- package/dist/index.js +86 -1
- package/dist/shared/model-suggestion-retry.d.ts +10 -0
- package/package.json +8 -8
package/dist/cli/index.js
CHANGED
|
@@ -6524,6 +6524,11 @@ var init_tmux = __esm(() => {
|
|
|
6524
6524
|
init_constants2();
|
|
6525
6525
|
init_tmux_utils();
|
|
6526
6526
|
});
|
|
6527
|
+
|
|
6528
|
+
// src/shared/model-suggestion-retry.ts
|
|
6529
|
+
var init_model_suggestion_retry = __esm(() => {
|
|
6530
|
+
init_logger();
|
|
6531
|
+
});
|
|
6527
6532
|
// src/shared/port-utils.ts
|
|
6528
6533
|
async function isPortAvailable(port, hostname = "127.0.0.1") {
|
|
6529
6534
|
try {
|
|
@@ -6593,6 +6598,7 @@ var init_shared = __esm(() => {
|
|
|
6593
6598
|
init_connected_providers_cache();
|
|
6594
6599
|
init_session_utils();
|
|
6595
6600
|
init_tmux();
|
|
6601
|
+
init_model_suggestion_retry();
|
|
6596
6602
|
init_port_utils();
|
|
6597
6603
|
init_safe_create_hook();
|
|
6598
6604
|
});
|
|
@@ -8436,7 +8442,7 @@ var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
|
8436
8442
|
// package.json
|
|
8437
8443
|
var package_default = {
|
|
8438
8444
|
name: "oh-my-opencode",
|
|
8439
|
-
version: "3.3.
|
|
8445
|
+
version: "3.3.1",
|
|
8440
8446
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
8441
8447
|
main: "dist/index.js",
|
|
8442
8448
|
types: "dist/index.d.ts",
|
|
@@ -8510,13 +8516,13 @@ var package_default = {
|
|
|
8510
8516
|
typescript: "^5.7.3"
|
|
8511
8517
|
},
|
|
8512
8518
|
optionalDependencies: {
|
|
8513
|
-
"oh-my-opencode-darwin-arm64": "3.3.
|
|
8514
|
-
"oh-my-opencode-darwin-x64": "3.3.
|
|
8515
|
-
"oh-my-opencode-linux-arm64": "3.3.
|
|
8516
|
-
"oh-my-opencode-linux-arm64-musl": "3.3.
|
|
8517
|
-
"oh-my-opencode-linux-x64": "3.3.
|
|
8518
|
-
"oh-my-opencode-linux-x64-musl": "3.3.
|
|
8519
|
-
"oh-my-opencode-windows-x64": "3.3.
|
|
8519
|
+
"oh-my-opencode-darwin-arm64": "3.3.1",
|
|
8520
|
+
"oh-my-opencode-darwin-x64": "3.3.1",
|
|
8521
|
+
"oh-my-opencode-linux-arm64": "3.3.1",
|
|
8522
|
+
"oh-my-opencode-linux-arm64-musl": "3.3.1",
|
|
8523
|
+
"oh-my-opencode-linux-x64": "3.3.1",
|
|
8524
|
+
"oh-my-opencode-linux-x64-musl": "3.3.1",
|
|
8525
|
+
"oh-my-opencode-windows-x64": "3.3.1"
|
|
8520
8526
|
},
|
|
8521
8527
|
trustedDependencies: [
|
|
8522
8528
|
"@ast-grep/cli",
|
package/dist/index.js
CHANGED
|
@@ -6047,9 +6047,93 @@ var init_tmux = __esm(() => {
|
|
|
6047
6047
|
});
|
|
6048
6048
|
|
|
6049
6049
|
// src/shared/model-suggestion-retry.ts
|
|
6050
|
+
function extractMessage(error) {
|
|
6051
|
+
if (typeof error === "string")
|
|
6052
|
+
return error;
|
|
6053
|
+
if (error instanceof Error)
|
|
6054
|
+
return error.message;
|
|
6055
|
+
if (typeof error === "object" && error !== null) {
|
|
6056
|
+
const obj = error;
|
|
6057
|
+
if (typeof obj.message === "string")
|
|
6058
|
+
return obj.message;
|
|
6059
|
+
try {
|
|
6060
|
+
return JSON.stringify(error);
|
|
6061
|
+
} catch {
|
|
6062
|
+
return "";
|
|
6063
|
+
}
|
|
6064
|
+
}
|
|
6065
|
+
return String(error);
|
|
6066
|
+
}
|
|
6067
|
+
function parseModelSuggestion(error) {
|
|
6068
|
+
if (!error)
|
|
6069
|
+
return null;
|
|
6070
|
+
if (typeof error === "object") {
|
|
6071
|
+
const errObj = error;
|
|
6072
|
+
if (errObj.name === "ProviderModelNotFoundError" && typeof errObj.data === "object" && errObj.data !== null) {
|
|
6073
|
+
const data = errObj.data;
|
|
6074
|
+
const suggestions = data.suggestions;
|
|
6075
|
+
if (Array.isArray(suggestions) && suggestions.length > 0 && typeof suggestions[0] === "string") {
|
|
6076
|
+
return {
|
|
6077
|
+
providerID: String(data.providerID ?? ""),
|
|
6078
|
+
modelID: String(data.modelID ?? ""),
|
|
6079
|
+
suggestion: suggestions[0]
|
|
6080
|
+
};
|
|
6081
|
+
}
|
|
6082
|
+
return null;
|
|
6083
|
+
}
|
|
6084
|
+
for (const key of ["data", "error", "cause"]) {
|
|
6085
|
+
const nested = errObj[key];
|
|
6086
|
+
if (nested && typeof nested === "object") {
|
|
6087
|
+
const result = parseModelSuggestion(nested);
|
|
6088
|
+
if (result)
|
|
6089
|
+
return result;
|
|
6090
|
+
}
|
|
6091
|
+
}
|
|
6092
|
+
}
|
|
6093
|
+
const message = extractMessage(error);
|
|
6094
|
+
if (!message)
|
|
6095
|
+
return null;
|
|
6096
|
+
const modelMatch = message.match(/model not found:\s*([^/\s]+)\s*\/\s*([^.\s]+)/i);
|
|
6097
|
+
const suggestionMatch = message.match(/did you mean:\s*([^,?]+)/i);
|
|
6098
|
+
if (modelMatch && suggestionMatch) {
|
|
6099
|
+
return {
|
|
6100
|
+
providerID: modelMatch[1].trim(),
|
|
6101
|
+
modelID: modelMatch[2].trim(),
|
|
6102
|
+
suggestion: suggestionMatch[1].trim()
|
|
6103
|
+
};
|
|
6104
|
+
}
|
|
6105
|
+
return null;
|
|
6106
|
+
}
|
|
6050
6107
|
async function promptWithModelSuggestionRetry(client, args) {
|
|
6051
6108
|
await client.session.promptAsync(args);
|
|
6052
6109
|
}
|
|
6110
|
+
async function promptSyncWithModelSuggestionRetry(client, args) {
|
|
6111
|
+
try {
|
|
6112
|
+
await client.session.prompt(args);
|
|
6113
|
+
} catch (error) {
|
|
6114
|
+
const suggestion = parseModelSuggestion(error);
|
|
6115
|
+
if (!suggestion || !args.body.model) {
|
|
6116
|
+
throw error;
|
|
6117
|
+
}
|
|
6118
|
+
log("[model-suggestion-retry] Model not found, retrying with suggestion", {
|
|
6119
|
+
original: `${suggestion.providerID}/${suggestion.modelID}`,
|
|
6120
|
+
suggested: suggestion.suggestion
|
|
6121
|
+
});
|
|
6122
|
+
await client.session.prompt({
|
|
6123
|
+
...args,
|
|
6124
|
+
body: {
|
|
6125
|
+
...args.body,
|
|
6126
|
+
model: {
|
|
6127
|
+
providerID: suggestion.providerID,
|
|
6128
|
+
modelID: suggestion.suggestion
|
|
6129
|
+
}
|
|
6130
|
+
}
|
|
6131
|
+
});
|
|
6132
|
+
}
|
|
6133
|
+
}
|
|
6134
|
+
var init_model_suggestion_retry = __esm(() => {
|
|
6135
|
+
init_logger();
|
|
6136
|
+
});
|
|
6053
6137
|
|
|
6054
6138
|
// src/shared/opencode-server-auth.ts
|
|
6055
6139
|
function getServerBasicAuthHeader() {
|
|
@@ -6148,6 +6232,7 @@ var init_shared = __esm(() => {
|
|
|
6148
6232
|
init_connected_providers_cache();
|
|
6149
6233
|
init_session_utils();
|
|
6150
6234
|
init_tmux();
|
|
6235
|
+
init_model_suggestion_retry();
|
|
6151
6236
|
init_port_utils();
|
|
6152
6237
|
init_safe_create_hook();
|
|
6153
6238
|
});
|
|
@@ -49227,7 +49312,7 @@ Original error: ${createResult.error}`;
|
|
|
49227
49312
|
}
|
|
49228
49313
|
log(`[look_at] Sending prompt with ${isBase64Input ? "base64 image" : "file"} to session ${sessionID}`);
|
|
49229
49314
|
try {
|
|
49230
|
-
await
|
|
49315
|
+
await promptSyncWithModelSuggestionRetry(ctx.client, {
|
|
49231
49316
|
path: { id: sessionID },
|
|
49232
49317
|
body: {
|
|
49233
49318
|
agent: MULTIMODAL_LOOKER_AGENT,
|
|
@@ -21,4 +21,14 @@ interface PromptArgs {
|
|
|
21
21
|
[key: string]: unknown;
|
|
22
22
|
}
|
|
23
23
|
export declare function promptWithModelSuggestionRetry(client: Client, args: PromptArgs): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Synchronous variant of promptWithModelSuggestionRetry.
|
|
26
|
+
*
|
|
27
|
+
* Uses `session.prompt` (blocking HTTP call that waits for the LLM response)
|
|
28
|
+
* instead of `promptAsync` (fire-and-forget HTTP 204).
|
|
29
|
+
*
|
|
30
|
+
* Required by callers that need the response to be available immediately after
|
|
31
|
+
* the call returns — e.g. look_at, which reads session messages right away.
|
|
32
|
+
*/
|
|
33
|
+
export declare function promptSyncWithModelSuggestionRetry(client: Client, args: PromptArgs): Promise<void>;
|
|
24
34
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oh-my-opencode",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -74,13 +74,13 @@
|
|
|
74
74
|
"typescript": "^5.7.3"
|
|
75
75
|
},
|
|
76
76
|
"optionalDependencies": {
|
|
77
|
-
"oh-my-opencode-darwin-arm64": "3.3.
|
|
78
|
-
"oh-my-opencode-darwin-x64": "3.3.
|
|
79
|
-
"oh-my-opencode-linux-arm64": "3.3.
|
|
80
|
-
"oh-my-opencode-linux-arm64-musl": "3.3.
|
|
81
|
-
"oh-my-opencode-linux-x64": "3.3.
|
|
82
|
-
"oh-my-opencode-linux-x64-musl": "3.3.
|
|
83
|
-
"oh-my-opencode-windows-x64": "3.3.
|
|
77
|
+
"oh-my-opencode-darwin-arm64": "3.3.1",
|
|
78
|
+
"oh-my-opencode-darwin-x64": "3.3.1",
|
|
79
|
+
"oh-my-opencode-linux-arm64": "3.3.1",
|
|
80
|
+
"oh-my-opencode-linux-arm64-musl": "3.3.1",
|
|
81
|
+
"oh-my-opencode-linux-x64": "3.3.1",
|
|
82
|
+
"oh-my-opencode-linux-x64-musl": "3.3.1",
|
|
83
|
+
"oh-my-opencode-windows-x64": "3.3.1"
|
|
84
84
|
},
|
|
85
85
|
"trustedDependencies": [
|
|
86
86
|
"@ast-grep/cli",
|