Adapt workspace context to session prefixes

This commit is contained in:
Yichen Jiang
2026-07-10 14:32:44 +08:00
parent 7b54768ee7
commit 3fe196a751
61 changed files with 2313 additions and 1155 deletions
+2 -2
View File
@@ -35,7 +35,7 @@
"@deepseek-ai/dsh-app-boot": "^0.0.1",
"@deepseek-ai/dsh-acp": "^0.0.1",
"@deepseek-ai/dsh-agent-core": "^0.0.1",
"@deepseek-ai/dsh-project-instructions": "^0.0.1",
"@deepseek-ai/dsh-workspace-context": "^0.0.1",
"@deepseek-ai/dsh-session-persistence-jsonl": "^0.0.1",
"@deepseek-ai/dsh-user-interaction": "^0.0.1",
"cordis": "^4.0.0-rc.6",
@@ -47,8 +47,8 @@
"@deepseek-ai/dsh-app-boot": "workspace:^",
"@deepseek-ai/dsh-acp": "workspace:^",
"@deepseek-ai/dsh-agent-core": "workspace:^",
"@deepseek-ai/dsh-project-instructions": "workspace:^",
"@deepseek-ai/dsh-system-prompt": "workspace:^",
"@deepseek-ai/dsh-workspace-context": "workspace:^",
"@deepseek-ai/dsh-session-persistence-jsonl": "workspace:^",
"@deepseek-ai/dsh-user-interaction": "workspace:^",
"cordis": "^4.0.0-rc.6",
+4 -4
View File
@@ -34,7 +34,7 @@ import type { Context } from 'cordis'
import z from 'schemastery'
import * as acp from '@deepseek-ai/dsh-acp'
import * as agentCore from '@deepseek-ai/dsh-agent-core'
import * as projectInstructions from '@deepseek-ai/dsh-project-instructions'
import * as workspaceContext from '@deepseek-ai/dsh-workspace-context'
import SessionPersistenceJsonl from '@deepseek-ai/dsh-session-persistence-jsonl'
import UserInteractionService from '@deepseek-ai/dsh-user-interaction'
@@ -58,7 +58,7 @@ export interface Config {
/** Directory the JSONL session backend writes under. Defaults to `./.sessions`. */
persistenceRoot?: string
/** Controls automatic AGENTS.md/CLAUDE.md loading; set `false` for hermetic prompts. */
projectInstructions?: agentCore.Config['projectInstructions']
workspaceContext?: agentCore.Config['workspaceContext']
}
export const Config: z<Config> = z.object({
@@ -69,7 +69,7 @@ export const Config: z<Config> = z.object({
// schemastery's native [] default would read as an invalid configured list.
toolOrder: z.array(z.string()).default(undefined as unknown as string[]),
persistenceRoot: z.string().default('./.sessions'),
projectInstructions: z.union([z.const(false), projectInstructions.Config]),
workspaceContext: z.union([z.const(false), workspaceContext.Config]),
}) as unknown as z<Config>
/**
@@ -82,8 +82,8 @@ export const Config: z<Config> = z.object({
export function apply(ctx: Context, config: Config): void {
ctx.plugin(agentCore, {
...config.persona !== undefined ? { persona: config.persona } : {},
...config.projectInstructions !== undefined ? { projectInstructions: config.projectInstructions } : {},
...config.toolOrder !== undefined ? { toolOrder: config.toolOrder } : {},
...config.workspaceContext !== undefined ? { workspaceContext: config.workspaceContext } : {},
})
ctx.plugin(UserInteractionService)
ctx.plugin(SessionPersistenceJsonl, { root: config.persistenceRoot ?? './.sessions' })
@@ -54,8 +54,8 @@ describe('dsh-acp-agent composition', () => {
const ctx = await mount({
model: 'mock',
persona: 'hi',
persistenceRoot: '/tmp/dsh-acp-agent-project-instructions',
projectInstructions: false,
persistenceRoot: '/tmp/dsh-acp-agent-workspace-context',
workspaceContext: false,
})
expect(ctx.get('agents')).toBeDefined()
expect(ctx.get('agentLoop')).toBeDefined()
+1 -1
View File
@@ -40,7 +40,7 @@ const acpBin = join(repoRoot, 'packages/ui/acp-agent/lib/bin.js')
const dshPackages = [
'core/agent-core', 'core/agent', 'core/session', 'core/system-prompt',
'core/tools', 'core/agent-loop', 'llm/llm', 'llm/llm-deepseek', 'bash/bash',
'bash/bash-local', 'bash/tool-bash', 'prompt/project-instructions', 'support/invariants', 'ui/app-boot',
'bash/bash-local', 'bash/tool-bash', 'prompt/workspace-context', 'support/invariants', 'ui/app-boot',
'session-persistence/session-persistence',
'session-persistence/session-persistence-jsonl', 'ui/acp', 'ui/acp-agent', 'util/paths',
]
+1 -1
View File
@@ -27,7 +27,7 @@
"path": "../../core/agent-core"
},
{
"path": "../../prompt/project-instructions"
"path": "../../prompt/workspace-context"
},
{
"path": "../user-interaction"