mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
Update memory plugin (#160)
This commit is contained in:
1 parent
be7e64b07f
commit
1248d0b9e0
50 files changed
+5363
-291
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { fetchWrapper, fetchWrapperVoid } from './fetchWrapper'
|
||||
import { API_BASE_URL } from '@/config'
|
||||
import type { Memory, MemoryStats, CreateMemoryRequest, UpdateMemoryRequest, PluginConfig } from '@opencode-manager/shared/types'
|
||||
import type { Memory, MemoryStats, CreateMemoryRequest, UpdateMemoryRequest, PluginConfig, KvEntry, CreateKvEntryRequest, UpdateKvEntryRequest } from '@opencode-manager/shared/types'
|
||||
|
||||
export async function listMemories(filters?: {
|
||||
projectId?: string
|
||||
@@ -94,3 +94,39 @@ export async function testEmbeddingConfig(): Promise<TestEmbeddingResult> {
|
||||
body: JSON.stringify({}),
|
||||
})
|
||||
}
|
||||
|
||||
export async function listKvEntries(projectId: string, prefix?: string): Promise<{ entries: KvEntry[] }> {
|
||||
const params = new URLSearchParams({ projectId })
|
||||
if (prefix) params.set('prefix', prefix)
|
||||
return fetchWrapper(`${API_BASE_URL}/api/memory/kv?${params.toString()}`)
|
||||
}
|
||||
|
||||
export async function deleteKvEntry(projectId: string, key: string): Promise<void> {
|
||||
return fetchWrapperVoid(`${API_BASE_URL}/api/memory/kv/${encodeURIComponent(key)}?projectId=${encodeURIComponent(projectId)}`, {
|
||||
method: 'DELETE',
|
||||
})
|
||||
}
|
||||
|
||||
export async function createKvEntry(data: CreateKvEntryRequest): Promise<{ entry: KvEntry }> {
|
||||
return fetchWrapper(`${API_BASE_URL}/api/memory/kv`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
}
|
||||
|
||||
export async function updateKvEntry(projectId: string, key: string, data: UpdateKvEntryRequest): Promise<{ entry: KvEntry }> {
|
||||
return fetchWrapper(`${API_BASE_URL}/api/memory/kv/${encodeURIComponent(key)}?projectId=${encodeURIComponent(projectId)}`, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
}
|
||||
|
||||
export async function cancelRalphLoop(repoId: string, sessionId: string): Promise<{ cancelled: boolean; worktreeName?: string }> {
|
||||
return fetchWrapper(`${API_BASE_URL}/api/memory/ralph/cancel`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ repoId, sessionId }),
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user