34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
/**
|
|
* Memory sub-plugin entry — the five memory_* agent tools.
|
|
*
|
|
* Registers nothing but the tool set (no routes, no timers). It sees the
|
|
* cloud exclusively through the kernel's MemoryRemoteFactory, so it can be
|
|
* toggled independently of the cloud-sync entry that would otherwise own
|
|
* the connection. With this row disabled the agent loses memory_search /
|
|
* memory_add / … while the settings page, skill management, and activity
|
|
* reporting keep working.
|
|
*/
|
|
import type { CloudMemoryContext } from '../context-types.ts'
|
|
import { brainKernel } from '../kernel.ts'
|
|
import { createMemoryTools } from '../memory/tools.ts'
|
|
|
|
export const name = 'dsh-brain-memory'
|
|
|
|
/** Services required before `apply` runs. */
|
|
export const inject = ['tools']
|
|
|
|
/** Register the sub-plugin with the host. */
|
|
export function apply(ctx: CloudMemoryContext, config: unknown): void {
|
|
const kernel = brainKernel(config, ctx.logger('dsh-brain'))
|
|
kernel.activate('memory')
|
|
ctx.effect(() => () => kernel.deactivate('memory'), 'dsh-brain-memory: activation')
|
|
|
|
ctx.inject(['tools'], (toolsCtx) => {
|
|
const tools = (toolsCtx as CloudMemoryContext).tools
|
|
if (tools === undefined) return
|
|
for (const tool of createMemoryTools(kernel.toolDeps())) {
|
|
toolsCtx.effect(() => tools.register(tool), `dsh-brain-memory: tool ${tool.name}`)
|
|
}
|
|
})
|
|
}
|