更新 src/index.ts
This commit is contained in:
parent
d2f83fd196
commit
76e36e539a
18
src/index.ts
18
src/index.ts
|
|
@ -13,8 +13,10 @@ import { CloudClient } from './api.ts'
|
|||
import type { CloudMemoryContext, SessionEventLike, SessionLike } from './context-types.ts'
|
||||
import { Reporter } from './reporter.ts'
|
||||
import { createRoutes } from './routes.ts'
|
||||
import { SettingsStore } from './store.ts'
|
||||
import { join } from 'node:path'
|
||||
import { SettingsStore, dshHome } from './store.ts'
|
||||
import { SkillSync } from './skill-sync.ts'
|
||||
import { SkillAdmin, skillsHoldingDir, skillsTrashDir } from './skill-admin.ts'
|
||||
import { createMemoryTools, createSkillTools } from './tools.ts'
|
||||
|
||||
/** Package name; also the client bundle id. */
|
||||
|
|
@ -24,7 +26,7 @@ export const name = 'dsh-cloud-memory'
|
|||
export const inject = ['webServer']
|
||||
|
||||
/** Version reported by the status card. */
|
||||
const VERSION = '0.3.0'
|
||||
const VERSION = '0.4.0'
|
||||
|
||||
/** How often the skill directory is reconciled with the cloud center. */
|
||||
const SKILL_SYNC_INTERVAL_MS = 15 * 60_000
|
||||
|
|
@ -62,6 +64,16 @@ export function apply(ctx: CloudMemoryContext, config: unknown): void {
|
|||
skillsDir: settings().skillsDir,
|
||||
}),
|
||||
log: (message) => logger.info(message),
|
||||
holdingDir: () => skillsHoldingDir(),
|
||||
})
|
||||
|
||||
const skillAdmin = new SkillAdmin({
|
||||
skillsRoot: () => skillSync.skillsRoot(),
|
||||
holdingDir: () => skillsHoldingDir(),
|
||||
trashDir: () => skillsTrashDir(),
|
||||
syncStatePath: () => join(dshHome(), 'cloud-memory-skills.json'),
|
||||
syncRunning: () => skillSync.stats().running,
|
||||
log: (message) => logger.info(message),
|
||||
})
|
||||
// Announce at most once per activation so a missing token is obvious in logs.
|
||||
const effective = settings()
|
||||
|
|
@ -111,7 +123,7 @@ export function apply(ctx: CloudMemoryContext, config: unknown): void {
|
|||
if (webServer === undefined) {
|
||||
logger.warn('webServer service unavailable; the configuration page stays disabled')
|
||||
} else {
|
||||
const routes = createRoutes({ version: VERSION, store, reporter, client: () => client, skills: () => skillSync.stats() })
|
||||
const routes = createRoutes({ version: VERSION, store, reporter, client: () => client, skills: () => skillSync.stats(), admin: skillAdmin })
|
||||
for (const route of routes) {
|
||||
ctx.effect(() => webServer.register(route), `dsh-cloud-memory: route ${route.path}`)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue