add project instruction file loading

This commit is contained in:
Yichen Jiang
2026-06-25 16:04:42 +08:00
parent 4cfa22f997
commit d091946fc4
25 changed files with 1314 additions and 25 deletions

View File

@@ -34,6 +34,7 @@
"@cordisjs/plugin-loader": "^1.0.0-rc.4",
"@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-session-persistence-jsonl": "^0.0.1",
"cordis": "^4.0.0-rc.6",
"schemastery": "^3.17.0"
@@ -43,6 +44,7 @@
"@cordisjs/plugin-loader": "workspace:^",
"@deepseek-ai/dsh-acp": "workspace:^",
"@deepseek-ai/dsh-agent-core": "workspace:^",
"@deepseek-ai/dsh-project-instructions": "workspace:^",
"@deepseek-ai/dsh-session-persistence-jsonl": "workspace:^",
"cordis": "^4.0.0-rc.6",
"schemastery": "^3.17.0"

View File

@@ -33,6 +33,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 SessionPersistenceJsonl from '@deepseek-ai/dsh-session-persistence-jsonl'
export const name = 'acp-agent'
@@ -50,13 +51,16 @@ export interface Config {
systemPrompt: string
/** 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']
}
export const Config: z<Config> = z.object({
model: z.string().required(),
systemPrompt: z.string().required(),
persistenceRoot: z.string().default('./.sessions'),
})
projectInstructions: z.union([z.const(false), projectInstructions.Config]),
}) as unknown as z<Config>
/**
* Compose the spine with the ACP front door. The agent-core bundle pre-creates
@@ -66,7 +70,7 @@ export const Config: z<Config> = z.object({
* stdout stays pure.
*/
export function apply(ctx: Context, config: Config): void {
ctx.plugin(agentCore)
ctx.plugin(agentCore, config.projectInstructions === undefined ? {} : { projectInstructions: config.projectInstructions })
ctx.plugin(SessionPersistenceJsonl, { root: config.persistenceRoot ?? './.sessions' })
ctx.plugin(acp, { model: config.model, systemPrompt: config.systemPrompt })
}