Merge pull request #301 from deepseek-harness/codex/simp-name-front-door-defaults
refactor: name front-door defaults
This commit is contained in:
@@ -71,7 +71,7 @@ export interface Config {
|
|||||||
|
|
||||||
Depends on: [`agentCore`](../packages/examples/agent-spine-demo/src/index.ts) · [`ToolsConfig`](#deepseek-aidsh-tools)
|
Depends on: [`agentCore`](../packages/examples/agent-spine-demo/src/index.ts) · [`ToolsConfig`](#deepseek-aidsh-tools)
|
||||||
|
|
||||||
Source: [`packages/examples/acp-demo/src/index.ts:32`](../packages/examples/acp-demo/src/index.ts)
|
Source: [`packages/examples/acp-demo/src/index.ts:33`](../packages/examples/acp-demo/src/index.ts)
|
||||||
|
|
||||||
## `@deepseek-ai/dsh-agent-loop`
|
## `@deepseek-ai/dsh-agent-loop`
|
||||||
|
|
||||||
@@ -827,7 +827,7 @@ export interface Config {
|
|||||||
|
|
||||||
Depends on: [`agentCore`](../packages/examples/agent-spine-demo/src/index.ts) · [`ToolsConfig`](#deepseek-aidsh-tools)
|
Depends on: [`agentCore`](../packages/examples/agent-spine-demo/src/index.ts) · [`ToolsConfig`](#deepseek-aidsh-tools)
|
||||||
|
|
||||||
Source: [`packages/examples/stdio-demo/src/index.ts:38`](../packages/examples/stdio-demo/src/index.ts)
|
Source: [`packages/examples/stdio-demo/src/index.ts:40`](../packages/examples/stdio-demo/src/index.ts)
|
||||||
|
|
||||||
## `@deepseek-ai/dsh-subagent-acp`
|
## `@deepseek-ai/dsh-subagent-acp`
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,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. `provider` and `model` configure the
|
* App config: the swappable per-deployment values. `provider` and `model` configure the
|
||||||
@@ -70,9 +71,7 @@ export const Config: z<Config> = z.object({
|
|||||||
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,
|
||||||
dshHome: z.string(),
|
dshHome: z.string(),
|
||||||
// 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'),
|
|
||||||
workspaceContext: z.union([z.const(false), workspaceContext.Config]).required(),
|
workspaceContext: z.union([z.const(false), workspaceContext.Config]).required(),
|
||||||
skills: agentCore.SkillConfigSchema,
|
skills: agentCore.SkillConfigSchema,
|
||||||
toolBash: agentCore.ToolBashConfigSchema,
|
toolBash: agentCore.ToolBashConfigSchema,
|
||||||
@@ -90,6 +89,6 @@ export const Config: z<Config> = z.object({
|
|||||||
export function apply(ctx: Context, config: Config): void {
|
export function apply(ctx: Context, config: Config): void {
|
||||||
ctx.plugin(agentCore, agentCore.pickSpineConfig(config))
|
ctx.plugin(agentCore, agentCore.pickSpineConfig(config))
|
||||||
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, { provider: config.provider, model: config.model })
|
ctx.plugin(acp, { provider: config.provider, model: config.model })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ describe('dsh-acp-demo composition', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('defaults the persistence root when omitted', async () => {
|
it('defaults the persistence root when omitted', async () => {
|
||||||
// Exercises the `?? './.sessions'` fallback for a direct-apply caller that
|
// Exercises the `DEFAULT_PERSISTENCE_ROOT` fallback for a direct-apply caller that
|
||||||
// bypasses the schema's `.default(...)`: call `apply` directly (not via
|
// bypasses the schema's `.default(...)`: call `apply` directly (not via
|
||||||
// `ctx.plugin`, which validates+defaults the config first) with no
|
// `ctx.plugin`, which validates+defaults the config first) with no
|
||||||
// persistenceRoot, so the runtime fallback is the one that fires.
|
// persistenceRoot, so the runtime fallback is the one that fires.
|
||||||
|
|||||||
@@ -24,6 +24,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
|
||||||
@@ -81,10 +83,8 @@ export const Config: z<Config> = z.object({
|
|||||||
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,
|
||||||
dshHome: z.string(),
|
dshHome: z.string(),
|
||||||
// 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,
|
||||||
toolBash: agentCore.ToolBashConfigSchema,
|
toolBash: agentCore.ToolBashConfigSchema,
|
||||||
toolTasks: agentCore.ToolTasksConfigSchema,
|
toolTasks: agentCore.ToolTasksConfigSchema,
|
||||||
@@ -104,10 +104,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, {
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ describe('dsh-stdio-demo app', () => {
|
|||||||
|
|
||||||
it('defaults persistenceRoot and welcome when omitted', async () => {
|
it('defaults persistenceRoot and welcome when omitted', async () => {
|
||||||
// Direct apply (NOT via ctx.plugin, which validates+defaults the config
|
// Direct apply (NOT via ctx.plugin, which validates+defaults the config
|
||||||
// first) so the runtime `?? './.sessions'` / `?? 'ready.'` fallbacks on
|
// first) so the runtime `DEFAULT_PERSISTENCE_ROOT` / `DEFAULT_WELCOME` fallbacks on
|
||||||
// apply()'s last two lines are the ones that fire — covering a
|
// apply()'s last two lines are the ones that fire — covering a
|
||||||
// schema-bypassing direct-mount caller.
|
// schema-bypassing direct-mount caller.
|
||||||
const ctx = new Context()
|
const ctx = new Context()
|
||||||
|
|||||||
Reference in New Issue
Block a user