2026-06-13 00:28:29 +08:00
|
|
|
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
|
|
|
import { defineConfig } from 'vitest/config'
|
|
|
|
|
|
2026-06-16 14:55:37 +08:00
|
|
|
// Real-API end-to-end tests: `pnpm run test:e2e`, file pattern *.e2e.ts.
|
|
|
|
|
// Separate from the default suite (`pnpm run test`, *.spec.ts) on purpose —
|
2026-06-13 00:28:29 +08:00
|
|
|
// these hit the live DeepSeek API, spend tokens, and need a key.
|
|
|
|
|
//
|
|
|
|
|
// Secrets: tests gate themselves with
|
|
|
|
|
// `describe.skipIf(!process.env.DEEPSEEK_API_KEY)`, so the suite passes
|
|
|
|
|
// (all-skipped) without credentials — CI has none and stays green. Put the
|
|
|
|
|
// key in the environment or in a gitignored `.env` at the repo root:
|
|
|
|
|
//
|
|
|
|
|
// DEEPSEEK_API_KEY=sk-…
|
|
|
|
|
// DEEPSEEK_BASE_URL=https://… # optional, defaults to the public API
|
|
|
|
|
try {
|
|
|
|
|
// Node >= 21.7 native; throws when the file does not exist.
|
|
|
|
|
process.loadEnvFile(new URL('.env', import.meta.url).pathname)
|
|
|
|
|
} catch {
|
|
|
|
|
// No .env — fine, the environment may already carry the variables.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
// Same resolution note as vitest.config.ts: bare workspace names resolve
|
|
|
|
|
// through the root tsconfig paths map; the native option cannot do this.
|
2026-06-17 23:41:18 +08:00
|
|
|
plugins: [tsconfigPaths({ projects: ['./tsconfig.json'] })],
|
2026-06-13 00:28:29 +08:00
|
|
|
test: {
|
Reorganize packages into a modular hierarchy
Move the 18 flat packages/<name> packages into role-grouped dirs:
core/, llm/, bash/, session-persistence/, ui/, support/. Group dirs are
pure containers; each package keeps its @deepseek-ai/dsh-* name.
Collapse the per-package tsconfig paths maps (base + typecheck) into one
@deepseek-ai/dsh-* wildcard with a candidate per group, and derive the
publint list from the hierarchy. Update all depth-coupled globs/configs
(workspace, tsdown, vitest, eslint, knip, tsconfig includes/refs,
per-package tsconfigs, generators, doc-script scopes, type-equiv manifest)
and the cross-package/script relative imports in tests.
Fix doc-typecheck's workspacePaths() to parse tsconfig JSONC via the
TypeScript API instead of a regex comment-strip, which corrupted the
new wildcard `/*/` path candidates.
WIP: doc cross-links and package/RFC docs still to update.
2026-06-20 22:55:20 +08:00
|
|
|
include: ['packages/*/*/tests/**/*.e2e.ts', 'examples/*/tests/**/*.e2e.ts'],
|
Add examples/coding-agent and the docs cookbook
The first real agent wiring: DeepSeek V4 + the bash tool suite + stdio
chat + JSONL persistence, runnable via yarn demo:coding (reads the
gitignored repo-root .env through process.loadEnvFile).
- examples/coding-agent: cordis.yml wiring both real plugin families
(llm-deepseek with !!js env secrets; bash-local + tool-bash), a
bash-only coding system prompt, a max-steps-guard plugin (bounds
runaway turns via the agent/turn-continuation waterfall — abort()
from step-end is a no-op by then), and a stdio UI with dimmed
reasoning and exit-on-idle for piped stdin.
- e2e (yarn test:e2e, key-gated): full-loop.e2e.ts runs a real model
against the real bash tool; coding-task.e2e.ts is the swebench-style
smoke — the model fixes a buggy add.js in a temp dir and the test
re-runs node add.test.js itself rather than trusting the agent.
- docs/cookbook: adding-a-package (the verified checklist),
adding-a-tool (execute() contract, background pattern, seams),
adding-an-llm-adapter (protocol obligations, mock-server testing,
e2e policy). AGENTS.md layout/commands/secrets sections updated;
architecture.md points at both examples and the cookbook.
- vitest.e2e.config.ts: serialize test files + retry twice — parallel
e2e files trip the shared internal key's concurrency quota.
- fix: the !js YAML tag spelling in docs/JSDoc is actually !!js
(js-yaml resolves custom tags under tag:yaml.org,2002:js).
2026-06-13 00:47:32 +08:00
|
|
|
// Real model calls: generous timeouts, and retries for transient flakes
|
|
|
|
|
// (the shared internal key hits concurrency quotas). No coverage — the
|
|
|
|
|
// unit suites own the coverage gate.
|
2026-06-13 00:28:29 +08:00
|
|
|
testTimeout: 120_000,
|
|
|
|
|
hookTimeout: 30_000,
|
Add examples/coding-agent and the docs cookbook
The first real agent wiring: DeepSeek V4 + the bash tool suite + stdio
chat + JSONL persistence, runnable via yarn demo:coding (reads the
gitignored repo-root .env through process.loadEnvFile).
- examples/coding-agent: cordis.yml wiring both real plugin families
(llm-deepseek with !!js env secrets; bash-local + tool-bash), a
bash-only coding system prompt, a max-steps-guard plugin (bounds
runaway turns via the agent/turn-continuation waterfall — abort()
from step-end is a no-op by then), and a stdio UI with dimmed
reasoning and exit-on-idle for piped stdin.
- e2e (yarn test:e2e, key-gated): full-loop.e2e.ts runs a real model
against the real bash tool; coding-task.e2e.ts is the swebench-style
smoke — the model fixes a buggy add.js in a temp dir and the test
re-runs node add.test.js itself rather than trusting the agent.
- docs/cookbook: adding-a-package (the verified checklist),
adding-a-tool (execute() contract, background pattern, seams),
adding-an-llm-adapter (protocol obligations, mock-server testing,
e2e policy). AGENTS.md layout/commands/secrets sections updated;
architecture.md points at both examples and the cookbook.
- vitest.e2e.config.ts: serialize test files + retry twice — parallel
e2e files trip the shared internal key's concurrency quota.
- fix: the !js YAML tag spelling in docs/JSDoc is actually !!js
(js-yaml resolves custom tags under tag:yaml.org,2002:js).
2026-06-13 00:47:32 +08:00
|
|
|
retry: 2,
|
|
|
|
|
// Run e2e files one at a time: the shared internal API key has a small
|
|
|
|
|
// concurrency quota, and parallel files issue enough simultaneous requests
|
|
|
|
|
// to trip it (manifesting as flaky rate-limit errors).
|
|
|
|
|
fileParallelism: false,
|
2026-06-13 00:28:29 +08:00
|
|
|
},
|
|
|
|
|
})
|