oh-my-opencode-kikokikok 2.15.9 → 2.15.10
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/features/letta-memory/adapter.d.ts +14 -0
- package/dist/index.js +65 -2
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2253,7 +2253,7 @@ var require_picocolors = __commonJS((exports, module) => {
|
|
|
2253
2253
|
var require_package = __commonJS((exports, module) => {
|
|
2254
2254
|
module.exports = {
|
|
2255
2255
|
name: "oh-my-opencode-kikokikok",
|
|
2256
|
-
version: "2.15.
|
|
2256
|
+
version: "2.15.10",
|
|
2257
2257
|
description: "OpenCode plugin - custom agents (oracle, librarian) and enhanced features",
|
|
2258
2258
|
main: "dist/index.js",
|
|
2259
2259
|
types: "dist/index.d.ts",
|
|
@@ -7,7 +7,21 @@ export declare class LettaAdapter {
|
|
|
7
7
|
private modelCachePromise;
|
|
8
8
|
private resolvedEmbeddingModel;
|
|
9
9
|
private resolvedLlmModel;
|
|
10
|
+
private providerInitPromise;
|
|
10
11
|
constructor(config: LettaConfig);
|
|
12
|
+
/**
|
|
13
|
+
* Ensures the openai-proxy provider is registered in Letta when:
|
|
14
|
+
* 1. Models with openai-proxy/ prefix exist (from OPENAI_API_BASE env var)
|
|
15
|
+
* 2. No user-created openai-proxy provider exists
|
|
16
|
+
* 3. Copilot proxy is available locally
|
|
17
|
+
*
|
|
18
|
+
* This fixes the provider mismatch where Letta's built-in OpenAI provider
|
|
19
|
+
* creates models with openai-proxy/ handles but the provider is named "openai",
|
|
20
|
+
* causing agent creation to fail.
|
|
21
|
+
*/
|
|
22
|
+
ensureOpenAIProxyProvider(): Promise<void>;
|
|
23
|
+
private doEnsureOpenAIProxyProvider;
|
|
24
|
+
private isCopilotProxyAvailable;
|
|
11
25
|
private getModels;
|
|
12
26
|
/**
|
|
13
27
|
* Resolves user model name to Letta handle. Letta requires exact handle matches
|
package/dist/index.js
CHANGED
|
@@ -43783,7 +43783,9 @@ var DEFAULT_ENDPOINT2 = "http://localhost:8283";
|
|
|
43783
43783
|
var DEFAULT_AGENT_PREFIX = "opencode";
|
|
43784
43784
|
var DEFAULT_LLM_MODEL = "letta/letta-free";
|
|
43785
43785
|
var DEFAULT_EMBEDDING_MODEL = "letta/letta-free";
|
|
43786
|
-
var VALID_PROVIDERS = ["letta", "openai"];
|
|
43786
|
+
var VALID_PROVIDERS = ["letta", "openai", "openai-proxy"];
|
|
43787
|
+
var COPILOT_PROXY_ENDPOINT = "http://host.docker.internal:4141/v1";
|
|
43788
|
+
var COPILOT_PROXY_LOCAL = "http://localhost:4141/v1";
|
|
43787
43789
|
|
|
43788
43790
|
class LettaAdapter {
|
|
43789
43791
|
config;
|
|
@@ -43793,10 +43795,67 @@ class LettaAdapter {
|
|
|
43793
43795
|
modelCachePromise = null;
|
|
43794
43796
|
resolvedEmbeddingModel = null;
|
|
43795
43797
|
resolvedLlmModel = null;
|
|
43798
|
+
providerInitPromise = null;
|
|
43796
43799
|
constructor(config3) {
|
|
43797
43800
|
this.config = config3;
|
|
43798
43801
|
this.endpoint = config3.endpoint ?? DEFAULT_ENDPOINT2;
|
|
43799
43802
|
}
|
|
43803
|
+
async ensureOpenAIProxyProvider() {
|
|
43804
|
+
if (this.providerInitPromise) {
|
|
43805
|
+
return this.providerInitPromise;
|
|
43806
|
+
}
|
|
43807
|
+
this.providerInitPromise = this.doEnsureOpenAIProxyProvider();
|
|
43808
|
+
return this.providerInitPromise;
|
|
43809
|
+
}
|
|
43810
|
+
async doEnsureOpenAIProxyProvider() {
|
|
43811
|
+
try {
|
|
43812
|
+
const models = await this.getModels();
|
|
43813
|
+
const hasOpenAIProxyModels = models.some((m) => m.handle.startsWith("openai-proxy/"));
|
|
43814
|
+
if (!hasOpenAIProxyModels) {
|
|
43815
|
+
return;
|
|
43816
|
+
}
|
|
43817
|
+
const providersResponse = await fetch(`${this.endpoint}/v1/providers/`, {
|
|
43818
|
+
method: "GET",
|
|
43819
|
+
redirect: "follow",
|
|
43820
|
+
signal: AbortSignal.timeout(1e4)
|
|
43821
|
+
});
|
|
43822
|
+
if (!providersResponse.ok) {
|
|
43823
|
+
return;
|
|
43824
|
+
}
|
|
43825
|
+
const providers = await providersResponse.json();
|
|
43826
|
+
const hasOpenAIProxyProvider = providers.some((p) => p.name === "openai-proxy");
|
|
43827
|
+
if (hasOpenAIProxyProvider) {
|
|
43828
|
+
return;
|
|
43829
|
+
}
|
|
43830
|
+
const proxyAvailable = await this.isCopilotProxyAvailable();
|
|
43831
|
+
if (!proxyAvailable) {
|
|
43832
|
+
return;
|
|
43833
|
+
}
|
|
43834
|
+
await fetch(`${this.endpoint}/v1/providers/`, {
|
|
43835
|
+
method: "POST",
|
|
43836
|
+
headers: { "Content-Type": "application/json" },
|
|
43837
|
+
redirect: "follow",
|
|
43838
|
+
signal: AbortSignal.timeout(1e4),
|
|
43839
|
+
body: JSON.stringify({
|
|
43840
|
+
name: "openai-proxy",
|
|
43841
|
+
provider_type: "openai",
|
|
43842
|
+
api_key: "dummy",
|
|
43843
|
+
base_url: COPILOT_PROXY_ENDPOINT
|
|
43844
|
+
})
|
|
43845
|
+
});
|
|
43846
|
+
} catch {}
|
|
43847
|
+
}
|
|
43848
|
+
async isCopilotProxyAvailable() {
|
|
43849
|
+
try {
|
|
43850
|
+
const response2 = await fetch(`${COPILOT_PROXY_LOCAL}/models`, {
|
|
43851
|
+
method: "GET",
|
|
43852
|
+
signal: AbortSignal.timeout(5000)
|
|
43853
|
+
});
|
|
43854
|
+
return response2.ok;
|
|
43855
|
+
} catch {
|
|
43856
|
+
return false;
|
|
43857
|
+
}
|
|
43858
|
+
}
|
|
43800
43859
|
async getModels() {
|
|
43801
43860
|
if (this.modelCache) {
|
|
43802
43861
|
return this.modelCache;
|
|
@@ -44063,7 +44122,11 @@ class LettaAdapter {
|
|
|
44063
44122
|
redirect: "follow",
|
|
44064
44123
|
signal: AbortSignal.timeout(5000)
|
|
44065
44124
|
});
|
|
44066
|
-
|
|
44125
|
+
if (response2.ok) {
|
|
44126
|
+
await this.ensureOpenAIProxyProvider();
|
|
44127
|
+
return true;
|
|
44128
|
+
}
|
|
44129
|
+
return false;
|
|
44067
44130
|
} catch {
|
|
44068
44131
|
return false;
|
|
44069
44132
|
}
|