feat: align minimal runtime profiles

This commit is contained in:
Yichen Jiang
2026-08-11 15:19:24 +08:00
parent c172faed37
commit 663253099d
18 changed files with 190 additions and 82 deletions

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write examples/jsonrpc-agent/README.md
README.md: 5f60a64a4888c64e4fd68835f78e4a334ffed263
README.zh.md: 8d2f9807ff259000b5a6823357f8c41b43bfa434
README.md: 93ac1d4bc966568d2baab70f763394d1293d348f
README.zh.md: f358d3c8b22017a10dff62ce2dedced2bfd6de6c

View File

@@ -20,7 +20,9 @@ The surrounding runtime also loads JSONL session persistence and automatic conte
| `DEEPSEEK_API_KEY` | Credential passed to the OpenAI-compatible host endpoint |
| `DEEPSEEK_BASE_URL` | Host endpoint used by `dsh-llm-deepseek` |
| `DSH_CWD` | Agent workspace for bash and filesystem tools |
| `DSH_CONTEXT_WINDOW` | Context capacity recorded for the `DSH_MODEL` catalog entry in the minimal variant |
| `DSH_MAX_TOKENS_AS_SUCCESS` | `true` (default) accepts token-limited results; `false` reports them as errors |
| `DSH_MODEL` | Default model used by `minimal.py`; `--model` takes precedence |
| `DSH_SESSION_ROOT` | JSONL session directory |
| `DSH_SYSTEM_PROMPT` | Deployment-provided coding persona |
@@ -28,9 +30,9 @@ Pass the config path through the Python SDK's `cordis` option or `DSH_CORDIS_CON
## Minimal variant
[`minimal.cordis.yml`](minimal.cordis.yml) is the complete standalone counterpart of the Web `minimal` preset. It fixes the system prompt and compaction policy, and its model-facing surface is exactly:
[`minimal.cordis.yml`](minimal.cordis.yml) is the complete standalone counterpart of the Web `minimal` preset. `DSH_SYSTEM_PROMPT` selects its system prompt, with `You are a helpful software engineer assistant.` as the fallback, and no context-compaction plugin is mounted. Its model-facing tools are exactly:
- owner-scoped persistent `bash`
- `str_replace_editor` with `view`, `create`, `str_replace`, and `insert`
It composes the local PTY, filesystem intent policy, session sandbox policy, and JSONL persistence needed by the bundled runtime. [`minimal.py`](minimal.py) runs it through the Python SDK; the [Python SDK tutorial](../../docs/user/guide/python-sdk.md) uses this configuration to cover setup, session management, and the security boundary.
It composes the local PTY, bare `fs-local` backend, danger-full-access policy for persistent Bash, and uncompressed JSONL persistence needed by the bundled runtime. [`minimal.py`](minimal.py) runs it through the Python SDK and uses `DSH_MODEL` as its default model; the [Python SDK tutorial](../../docs/user/guide/python-sdk.md) covers setup, session management, and the security boundary.

View File

@@ -20,7 +20,9 @@
| `DEEPSEEK_API_KEY` | 传给 OpenAI 兼容宿主端点的凭据 |
| `DEEPSEEK_BASE_URL` | `dsh-llm-deepseek` 使用的宿主端点 |
| `DSH_CWD` | bash 和文件系统工具使用的 agent workspace |
| `DSH_CONTEXT_WINDOW` | 极简变体中为 `DSH_MODEL` 目录项记录的上下文容量 |
| `DSH_MAX_TOKENS_AS_SUCCESS` | `true`(默认)接受受 token 上限限制的结果;`false` 将其报告为错误 |
| `DSH_MODEL` | `minimal.py` 使用的默认模型;`--model` 优先 |
| `DSH_SESSION_ROOT` | JSONL 会话目录 |
| `DSH_SYSTEM_PROMPT` | 由部署提供的编码人格 |
@@ -28,9 +30,9 @@
## 极简变体
[`minimal.cordis.yml`](minimal.cordis.yml) 是 Web `minimal` preset 的完整独立版本。它固定系统提示词与压缩策略,面向模型的能力严格只有:
[`minimal.cordis.yml`](minimal.cordis.yml) 是 Web `minimal` preset 的完整独立版本。`DSH_SYSTEM_PROMPT` 选择它的系统提示词,未设置时使用 `You are a helpful software engineer assistant.`,且不挂载上下文压缩插件。面向模型的工具严格只有:
- 所有者作用域内持久化的 `bash`
- 提供 `view``create``str_replace``insert``str_replace_editor`
它组合了内置运行时所需的本地 PTY、文件系统意图策略、会话沙箱策略与 JSONL 持久化。[`minimal.py`](minimal.py) 通过 Python SDK 运行该配置;[Python SDK 教程](../../docs/user/guide/python-sdk.md)以此配置介绍设置方式、会话管理与安全边界。
它组合了内置运行时所需的本地 PTY、`fs-local` 后端、供持久 Bash 使用的 danger-full-access 策略,以及未压缩的 JSONL 持久化。[`minimal.py`](minimal.py) 通过 Python SDK 运行该配置,并把 `DSH_MODEL` 作为默认模型[Python SDK 教程](../../docs/user/guide/python-sdk.md)以此配置介绍设置方式、会话管理与安全边界。

View File

@@ -1,6 +1,6 @@
# Complete unattended minimal-agent composition for the Python SDK. The model
# sees one fixed system prompt and only the owner-scoped persistent Bash and
# string-replace editor tools.
# sees one deployment-selected system prompt and only the owner-scoped
# persistent Bash and string-replace editor tools. Context compaction is absent.
- id: jsonrpc
name: '@deepseek-ai/dsh-jsonrpc'
@@ -9,6 +9,12 @@
- id: llm-deepseek
name: '@deepseek-ai/dsh-llm-deepseek'
config:
apiKeyEnv: DEEPSEEK_API_KEY
streamIdleTimeoutMs: 172800000
models:
- id: !!js process.env.DSH_MODEL ?? 'deepseek-v4-flash'
contextWindow: !!js Number(process.env.DSH_CONTEXT_WINDOW ?? 1000000)
- id: sandbox
name: '@deepseek-ai/dsh-sandbox-local'
@@ -30,22 +36,18 @@
config:
timeoutMs: 300000
# The sandbox-aware filesystem backend applies the same per-session policy as
# Bash. danger-full-access permits unrestricted workspace behavior while
# keeping one policy boundary for both tools.
- id: fs-sandbox
name: '@deepseek-ai/dsh-fs-sandbox'
# The editor uses the bare local filesystem; persistent Bash still consumes the
# shared danger-full-access sandbox policy above.
- id: fs-local
name: '@deepseek-ai/dsh-fs-local'
config:
cwd: !!js process.env.DSH_CWD ?? process.cwd()
- id: fs-policy
name: '@deepseek-ai/dsh-fs-policy'
- id: agent-spine
name: '@deepseek-ai/dsh-agent-spine-demo'
config:
includeHarnessIdentity: false
persona: You are a helpful software engineer assistant.
persona: !!js process.env.DSH_SYSTEM_PROMPT ?? 'You are a helpful software engineer assistant.'
workspaceContext: false
skills:
enabled: false
@@ -76,16 +78,3 @@
config:
root: !!js process.env.DSH_SESSION_ROOT ?? './.sessions'
compression: none
- id: token-meter
name: '@deepseek-ai/dsh-token-meter'
- id: compact-basic
name: '@deepseek-ai/dsh-compact-basic'
config:
thresholdRatio: 0.8
retainTokens: 20480
summarizationProvider: ''
summarizationModel: ''
maxTokens: 8192
compactionRetries: 1

View File

@@ -4,6 +4,7 @@
from __future__ import annotations
import argparse
import os
from pathlib import Path
from deepseek_harness import DeepSeekHarness
@@ -20,7 +21,7 @@ def main() -> None:
parser.add_argument("--session-root", type=Path, default=Path(".dsh-sessions"))
parser.add_argument("--session-id")
parser.add_argument("--provider", default="deepseek-official")
parser.add_argument("--model", default="deepseek-v4-flash")
parser.add_argument("--model", default=os.environ.get("DSH_MODEL", "deepseek-v4-flash"))
parser.add_argument("--max-tokens", type=int)
args = parser.parse_args()

View File

@@ -38,7 +38,7 @@ const minimalReplayConfig = join(testsDir, '..', 'minimal.snapshot.cordis.yml')
const runtimeBin = fileURLToPath(new URL('../../../packages/examples/jsonrpc-demo/src/bin.ts', import.meta.url))
const repoTsconfig = fileURLToPath(new URL('../../../tsconfig.json', import.meta.url))
const MINIMAL_SYSTEM_PROMPT = 'You are a helpful software engineer assistant.'
const MINIMAL_SYSTEM_PROMPT = 'You are the environment-selected minimal software engineer.'
const MINIMAL_BASH_DESCRIPTION = `Run commands in a bash shell
* When invoking this tool, the contents of the "command" parameter does NOT need to be XML-escaped.
* You don't have access to the internet via this tool.
@@ -67,6 +67,8 @@ interface SdkScenario {
children: number
/** Optional scenario-specific live and replay compositions. */
configs?: { live: string; replay: string }
/** Environment overrides passed to the runtime subprocess. */
environment?: Readonly<Record<string, string>>
/** Cwd-relative files whose final contents are part of the scenario contract. */
expectedFiles?: Readonly<Record<string, string>>
/** Assembled model-facing tool names and required argument keys. */
@@ -104,6 +106,7 @@ const SCENARIOS: SdkScenario[] = [
sessionId: 'persistent-tools-snapshot',
children: 0,
configs: { live: minimalLiveConfig, replay: minimalReplayConfig },
environment: { DSH_SYSTEM_PROMPT: MINIMAL_SYSTEM_PROMPT },
expectedFiles: { 'note.txt': 'target:\n\tnew\n' },
expectedTools: { bash: ['command'], str_replace_editor: ['command', 'path'] },
expectedSystem: MINIMAL_SYSTEM_PROMPT,
@@ -291,6 +294,7 @@ async function runScenario(scenario: SdkScenario): Promise<{
DSH_SNAPSHOT_FILE: parentFixture,
...childFixtures.length > 0 ? { DSH_SNAPSHOT_CHILD_FILES: childFixtures.join(delimiter) } : {},
},
...scenario.environment,
}
const harness = new DeepSeekHarness({