refactor: name front door defaults
This commit is contained in:
@@ -18,6 +18,7 @@ import SessionPersistenceJsonl from '@deepseek-ai/dsh-session-persistence-jsonl'
|
|||||||
import UserInteractionService from '@deepseek-ai/dsh-user-interaction'
|
import UserInteractionService from '@deepseek-ai/dsh-user-interaction'
|
||||||
|
|
||||||
export const name = 'acp-demo'
|
export const name = 'acp-demo'
|
||||||
|
const DEFAULT_PERSISTENCE_ROOT = './.sessions'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* App config: the swappable per-deployment values. `model` configures the
|
* App config: the swappable per-deployment values. `model` configures the
|
||||||
@@ -54,9 +55,7 @@ export const Config: z<Config> = z.object({
|
|||||||
// schemastery's native [] default would read as an invalid configured list.
|
// schemastery's native [] default would read as an invalid configured list.
|
||||||
toolOrder: z.array(z.string()).default(undefined as unknown as string[]),
|
toolOrder: z.array(z.string()).default(undefined as unknown as string[]),
|
||||||
tools: ToolRegistry.Config,
|
tools: ToolRegistry.Config,
|
||||||
// TODO(single-default-literal): share this schema default and the defensive
|
persistenceRoot: z.string().default(DEFAULT_PERSISTENCE_ROOT),
|
||||||
// apply() fallback through one named constant while retaining both boundaries.
|
|
||||||
persistenceRoot: z.string().default('./.sessions'),
|
|
||||||
skills: agentCore.SkillConfigSchema,
|
skills: agentCore.SkillConfigSchema,
|
||||||
})
|
})
|
||||||
/* jscpd:ignore-end */
|
/* jscpd:ignore-end */
|
||||||
@@ -76,6 +75,6 @@ export function apply(ctx: Context, config: Config): void {
|
|||||||
...config.skills !== undefined ? { skills: config.skills } : {},
|
...config.skills !== undefined ? { skills: config.skills } : {},
|
||||||
})
|
})
|
||||||
ctx.plugin(UserInteractionService)
|
ctx.plugin(UserInteractionService)
|
||||||
ctx.plugin(SessionPersistenceJsonl, { root: config.persistenceRoot ?? './.sessions' })
|
ctx.plugin(SessionPersistenceJsonl, { root: config.persistenceRoot ?? DEFAULT_PERSISTENCE_ROOT })
|
||||||
ctx.plugin(acp, { model: config.model })
|
ctx.plugin(acp, { model: config.model })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import * as toolAskUser from '@deepseek-ai/dsh-tool-ask-user'
|
|||||||
import * as uiStdio from '@deepseek-ai/dsh-stdio'
|
import * as uiStdio from '@deepseek-ai/dsh-stdio'
|
||||||
|
|
||||||
export const name = 'stdio-demo'
|
export const name = 'stdio-demo'
|
||||||
|
const DEFAULT_PERSISTENCE_ROOT = './.sessions'
|
||||||
|
const DEFAULT_WELCOME = 'ready.'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* App config: the swappable per-demo values, each routed to where the app wires
|
* App config: the swappable per-demo values, each routed to where the app wires
|
||||||
@@ -65,10 +67,8 @@ export const Config: z<Config> = z.object({
|
|||||||
// schemastery's native [] default would read as an invalid configured list.
|
// schemastery's native [] default would read as an invalid configured list.
|
||||||
toolOrder: z.array(z.string()).default(undefined as unknown as string[]),
|
toolOrder: z.array(z.string()).default(undefined as unknown as string[]),
|
||||||
tools: ToolRegistry.Config,
|
tools: ToolRegistry.Config,
|
||||||
// TODO(single-default-literal): share these schema defaults and defensive
|
persistenceRoot: z.string().default(DEFAULT_PERSISTENCE_ROOT),
|
||||||
// apply() fallbacks through named constants while retaining both boundaries.
|
welcome: z.string().default(DEFAULT_WELCOME),
|
||||||
persistenceRoot: z.string().default('./.sessions'),
|
|
||||||
welcome: z.string().default('ready.'),
|
|
||||||
skills: agentCore.SkillConfigSchema,
|
skills: agentCore.SkillConfigSchema,
|
||||||
resumeSessionId: z.string(),
|
resumeSessionId: z.string(),
|
||||||
})
|
})
|
||||||
@@ -85,10 +85,10 @@ export function apply(ctx: Context, config: Config): void {
|
|||||||
const resumeSessionId = config.resumeSessionId === '' ? undefined : config.resumeSessionId
|
const resumeSessionId = config.resumeSessionId === '' ? undefined : config.resumeSessionId
|
||||||
const sessionId = SessionId(resumeSessionId ?? `main-session-${randomUUID()}`)
|
const sessionId = SessionId(resumeSessionId ?? `main-session-${randomUUID()}`)
|
||||||
ctx.plugin(ConsoleExporter)
|
ctx.plugin(ConsoleExporter)
|
||||||
ctx.plugin(SessionPersistenceJsonl, { root: config.persistenceRoot ?? './.sessions' })
|
ctx.plugin(SessionPersistenceJsonl, { root: config.persistenceRoot ?? DEFAULT_PERSISTENCE_ROOT })
|
||||||
ctx.plugin(UserInteractionService)
|
ctx.plugin(UserInteractionService)
|
||||||
ctx.plugin(uiStdio, {
|
ctx.plugin(uiStdio, {
|
||||||
welcome: config.welcome ?? 'ready.',
|
welcome: config.welcome ?? DEFAULT_WELCOME,
|
||||||
sessionId,
|
sessionId,
|
||||||
})
|
})
|
||||||
ctx.plugin(agentCore, {
|
ctx.plugin(agentCore, {
|
||||||
|
|||||||
Reference in New Issue
Block a user