Merge remote-tracking branch 'origin/master' into codex/project-instruction-files

# Conflicts:
#	docs/architecture.md
#	docs/config-catalog.md
#	docs/event-producer-consumer.md
#	docs/module-graph.md
#	packages/core/agent-core/src/index.ts
#	packages/ui/acp-agent/src/index.ts
This commit is contained in:
Yichen Jiang
2026-07-10 14:40:33 +08:00
190 changed files with 15408 additions and 5562 deletions

View File

@@ -47,7 +47,7 @@ import z from 'schemastery'
import LlmService from '@deepseek-ai/dsh-llm'
import SessionStore from '@deepseek-ai/dsh-session'
import SystemPrompt, { type Config as SystemPromptConfig } from '@deepseek-ai/dsh-system-prompt'
import ToolRegistry from '@deepseek-ai/dsh-tools'
import ToolRegistry, { type Config as ToolsConfig } from '@deepseek-ai/dsh-tools'
import AgentRegistry from '@deepseek-ai/dsh-agent'
import * as invariants from '@deepseek-ai/dsh-invariants'
import * as toolBash from '@deepseek-ai/dsh-tool-bash'
@@ -61,11 +61,13 @@ export const name = 'agent-core'
* `agents` to the agent loop (an app that pre-creates no agents, like the ACP
* bridge, simply omits it), `persona` and `toolOrder` to the system-prompt
* plugin (the deployment's persona section and the explicit model-facing tool
* order), and `workspaceContext` to the workspace-context plugin. Every
* field is optional INPUT here because each owner's schema supplies the
* default (`[]` / `''` / absent — lexicographic / loader defaults); the schema
* is the INTERSECTION of the owners' own schemas, so validation and defaulting
* can never drift from them.
* order), the `tools` object to the tool registry (its presentation `mode`),
* and `workspaceContext` to the workspace-context plugin. Every field is
* optional INPUT here because each owner's schema supplies the default (`[]` /
* `''` / absent — lexicographic / `native` / loader defaults); the schema is
* the INTERSECTION of the owners' own schemas (the registry and workspace
* loader nested under their bundle keys), so validation and defaulting cannot
* drift from them.
*/
export interface Config {
/** The agent-loop `agents` list (see dsh-agent-loop's `Config`). */
@@ -74,6 +76,8 @@ export interface Config {
persona?: SystemPromptConfig['persona']
/** The explicit model-facing tool order (see dsh-system-prompt's `Config`). */
toolOrder?: SystemPromptConfig['toolOrder']
/** The tool registry's config — its presentation `mode` (see dsh-tools' `Config`). */
tools?: ToolsConfig
/** Workspace-context loader controls; set `false` for hermetic prompts. */
workspaceContext?: workspaceContext.Config | false
}
@@ -83,8 +87,9 @@ export const Config = z.intersect([
AgentLoop.Config,
SystemPrompt.Config,
z.object({
tools: ToolRegistry.Config,
workspaceContext: z.union([z.const(false), workspaceContext.Config]),
}) as unknown as z<Pick<Config, 'workspaceContext'>>,
}) as unknown as z<Pick<Config, 'tools' | 'workspaceContext'>>,
]) as unknown as z<Config>
/**
@@ -111,7 +116,7 @@ export function apply(ctx: Context, config: Config): void {
persona: config.persona ?? '',
...config.toolOrder !== undefined ? { toolOrder: config.toolOrder } : {},
})
ctx.plugin(ToolRegistry)
ctx.plugin(ToolRegistry, config.tools ?? {})
ctx.plugin(AgentRegistry)
ctx.plugin(invariants)
ctx.plugin(toolBash)