oh-my-opencode-kikokikok 2.15.3 → 2.15.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/cli/index.js +1 -1
- package/dist/features/letta-memory/types.d.ts +27 -3
- package/dist/index.js +35 -7
- 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.5",
|
|
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",
|
|
@@ -26,8 +26,25 @@ export interface LettaConfig {
|
|
|
26
26
|
agentPrefix?: string;
|
|
27
27
|
/** LLM model for agent (e.g., "openai/gpt-4.1") */
|
|
28
28
|
llmModel?: string;
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Embedding model for semantic search.
|
|
31
|
+
* Use format "provider/model" e.g.:
|
|
32
|
+
* - "openai/text-embedding-3-large" (best quality, 3072 dimensions)
|
|
33
|
+
* - "openai/text-embedding-3-small" (good balance, 1536 dimensions)
|
|
34
|
+
* - "openai/text-embedding-ada-002" (legacy)
|
|
35
|
+
* - "letta/letta-free" (default, requires Letta cloud auth)
|
|
36
|
+
*
|
|
37
|
+
* If not set, auto-detects local proxy models with "openai" provider.
|
|
38
|
+
*/
|
|
30
39
|
embeddingModel?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Preferred embedding model for auto-detection.
|
|
42
|
+
* When embeddingModel is not set and multiple proxy models are available,
|
|
43
|
+
* this determines which one to prefer. Partial match on model name.
|
|
44
|
+
* Default: "text-embedding-3-small"
|
|
45
|
+
* Set to "text-embedding-3-large" for better quality.
|
|
46
|
+
*/
|
|
47
|
+
preferredEmbeddingModel?: string;
|
|
31
48
|
/** Auto-rehydrate memories on session start */
|
|
32
49
|
autoRehydrate?: boolean;
|
|
33
50
|
/** Layers to rehydrate */
|
|
@@ -137,9 +154,16 @@ export interface LettaApiResponse<T> {
|
|
|
137
154
|
error?: string;
|
|
138
155
|
message?: string;
|
|
139
156
|
}
|
|
157
|
+
/** Letta search result item (different from passage) */
|
|
158
|
+
export interface LettaSearchResultItem {
|
|
159
|
+
timestamp: string;
|
|
160
|
+
content: string;
|
|
161
|
+
tags?: string[];
|
|
162
|
+
}
|
|
163
|
+
/** Letta search response */
|
|
140
164
|
export interface LettaSearchResponse {
|
|
141
|
-
|
|
142
|
-
|
|
165
|
+
results: LettaSearchResultItem[];
|
|
166
|
+
count: number;
|
|
143
167
|
}
|
|
144
168
|
export interface LettaAgentListResponse {
|
|
145
169
|
agents: LettaAgent[];
|
package/dist/index.js
CHANGED
|
@@ -43816,10 +43816,12 @@ class LettaAdapter {
|
|
|
43816
43816
|
return;
|
|
43817
43817
|
}
|
|
43818
43818
|
const models = await response2.json();
|
|
43819
|
-
const
|
|
43820
|
-
if (
|
|
43821
|
-
const
|
|
43822
|
-
|
|
43819
|
+
const proxyEmbeddingModels = models.filter((m) => m.name.includes("embedding") && m.model_endpoint.includes("host.docker.internal") && m.provider_name === "openai");
|
|
43820
|
+
if (proxyEmbeddingModels.length > 0) {
|
|
43821
|
+
const preferredName = this.config.preferredEmbeddingModel ?? "text-embedding-3-small";
|
|
43822
|
+
const preferred = proxyEmbeddingModels.find((m) => m.name.includes(preferredName));
|
|
43823
|
+
const model = preferred ?? proxyEmbeddingModels[0];
|
|
43824
|
+
this.detectedEmbeddingModel = `openai/${model.name}`;
|
|
43823
43825
|
}
|
|
43824
43826
|
} catch {}
|
|
43825
43827
|
})();
|
|
@@ -43843,7 +43845,11 @@ class LettaAdapter {
|
|
|
43843
43845
|
tags
|
|
43844
43846
|
})
|
|
43845
43847
|
});
|
|
43846
|
-
const
|
|
43848
|
+
const data = await response2.json();
|
|
43849
|
+
console.log("[LettaAdapter.add] Raw API response:", JSON.stringify(data, null, 2));
|
|
43850
|
+
const passage = Array.isArray(data) ? data[0] : data;
|
|
43851
|
+
console.log("[LettaAdapter.add] Extracted passage:", JSON.stringify(passage, null, 2));
|
|
43852
|
+
console.log("[LettaAdapter.add] passage.id:", passage?.id);
|
|
43847
43853
|
return this.passageToMemory(passage, input.layer, agent.id);
|
|
43848
43854
|
}
|
|
43849
43855
|
async search(input) {
|
|
@@ -43867,8 +43873,17 @@ class LettaAdapter {
|
|
|
43867
43873
|
}
|
|
43868
43874
|
const response2 = await this.request(`/v1/agents/${agent.id}/archival-memory/search?${params.toString()}`, { method: "GET" });
|
|
43869
43875
|
const data = await response2.json();
|
|
43870
|
-
const
|
|
43871
|
-
|
|
43876
|
+
const searchResults = data.results ?? [];
|
|
43877
|
+
const layerResults = searchResults.map((item, index) => ({
|
|
43878
|
+
memory: {
|
|
43879
|
+
id: `search-${agent.id}-${item.timestamp}-${index}`,
|
|
43880
|
+
content: item.content,
|
|
43881
|
+
layer,
|
|
43882
|
+
metadata: item.tags ? { tags: item.tags } : undefined,
|
|
43883
|
+
createdAt: item.timestamp,
|
|
43884
|
+
source: "passage",
|
|
43885
|
+
agentId: agent.id
|
|
43886
|
+
},
|
|
43872
43887
|
score: 1 - index * 0.05
|
|
43873
43888
|
}));
|
|
43874
43889
|
results.push(...layerResults);
|
|
@@ -43989,16 +44004,20 @@ class LettaAdapter {
|
|
|
43989
44004
|
}
|
|
43990
44005
|
}
|
|
43991
44006
|
async getOrCreateAgent(layer) {
|
|
44007
|
+
console.log(`[LettaAdapter.getOrCreateAgent] Looking for agent for layer: ${layer}`);
|
|
43992
44008
|
const existing = await this.getAgent(layer);
|
|
43993
44009
|
if (existing) {
|
|
44010
|
+
console.log(`[LettaAdapter.getOrCreateAgent] Found existing agent: ${existing.id} (${existing.name})`);
|
|
43994
44011
|
const needsUpdate = await this.agentNeedsEmbeddingUpdate(existing);
|
|
43995
44012
|
if (needsUpdate) {
|
|
43996
44013
|
return this.recreateAgentWithCorrectEmbedding(existing, layer);
|
|
43997
44014
|
}
|
|
43998
44015
|
return existing;
|
|
43999
44016
|
}
|
|
44017
|
+
console.log(`[LettaAdapter.getOrCreateAgent] No existing agent, creating new one for layer: ${layer}`);
|
|
44000
44018
|
const embeddingModel = await this.detectEmbeddingModel();
|
|
44001
44019
|
const agentName = this.getAgentName(layer);
|
|
44020
|
+
console.log(`[LettaAdapter.getOrCreateAgent] Creating agent with name: ${agentName}, embedding: ${embeddingModel}`);
|
|
44002
44021
|
const response2 = await this.request("/v1/agents", {
|
|
44003
44022
|
method: "POST",
|
|
44004
44023
|
body: JSON.stringify({
|
|
@@ -44017,6 +44036,7 @@ class LettaAdapter {
|
|
|
44017
44036
|
})
|
|
44018
44037
|
});
|
|
44019
44038
|
const agent = await response2.json();
|
|
44039
|
+
console.log(`[LettaAdapter.getOrCreateAgent] Created agent: ${agent.id} (${agent.name})`);
|
|
44020
44040
|
this.agentCache.set(layer, agent);
|
|
44021
44041
|
return agent;
|
|
44022
44042
|
}
|
|
@@ -44087,6 +44107,10 @@ class LettaAdapter {
|
|
|
44087
44107
|
if (this.config.apiKey) {
|
|
44088
44108
|
headers["Authorization"] = `Bearer ${this.config.apiKey}`;
|
|
44089
44109
|
}
|
|
44110
|
+
console.log(`[LettaAdapter.request] ${options.method} ${this.endpoint}${path7}`);
|
|
44111
|
+
if (options.body) {
|
|
44112
|
+
console.log(`[LettaAdapter.request] Body: ${options.body.slice(0, 500)}`);
|
|
44113
|
+
}
|
|
44090
44114
|
const response2 = await fetch(`${this.endpoint}${path7}`, {
|
|
44091
44115
|
method: options.method,
|
|
44092
44116
|
headers,
|
|
@@ -44095,6 +44119,7 @@ class LettaAdapter {
|
|
|
44095
44119
|
});
|
|
44096
44120
|
if (!response2.ok) {
|
|
44097
44121
|
const text = await response2.text().catch(() => "");
|
|
44122
|
+
console.log(`[LettaAdapter.request] Error ${response2.status}: ${text}`);
|
|
44098
44123
|
throw new Error(`Letta API error: ${response2.status} ${response2.statusText} - ${text}`);
|
|
44099
44124
|
}
|
|
44100
44125
|
return response2;
|
|
@@ -44131,6 +44156,9 @@ class LettaAdapter {
|
|
|
44131
44156
|
return ["user", "session", "project", "team", "org", "company", "agent"];
|
|
44132
44157
|
}
|
|
44133
44158
|
passageToMemory(passage, layer, agentId) {
|
|
44159
|
+
console.log("[LettaAdapter.passageToMemory] Input passage keys:", Object.keys(passage || {}));
|
|
44160
|
+
console.log("[LettaAdapter.passageToMemory] passage.id:", passage?.id);
|
|
44161
|
+
console.log("[LettaAdapter.passageToMemory] passage.text:", passage?.text?.slice(0, 50));
|
|
44134
44162
|
return {
|
|
44135
44163
|
id: passage.id,
|
|
44136
44164
|
content: passage.text,
|