@cjhyy/code-shell 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,8 @@ breaking.
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.8.0] - 2026-08-05
12
+
11
13
  ### Added
12
14
 
13
15
  #### Unified input attachments
@@ -59,13 +61,16 @@ breaking.
59
61
 
60
62
  #### Browser automation + built-in browser panel
61
63
 
62
- - CDP-driven automation of the built-in browser (no Playwright/JS-injection):
63
- semantic `browser_observe` / `browser_act` / `browser_navigate` tools, image
64
- & vision observation, multi-tab support, and link/image URL extraction. The
65
- whole capability is a single toggle turning it off removes both the tools
66
- and their prompt text. Stale snapshots are folded to save tokens.
67
- - The agent can open the browser panel itself; selections echo back into tool
68
- cards; screenshots echo to the stream as clickable thumbnails.
64
+ - Semantic `browser_observe` / `browser_act` / `browser_navigate` tools now use
65
+ a task-owned background target in the built-in browser profile by default,
66
+ sharing that profile's login state without silently taking over a tab the
67
+ user opened. The exact same target can be revealed for login or human
68
+ takeover.
69
+ - User-opened built-in tabs and regular Chrome tabs require an explicit claim;
70
+ dedicated Playwright remains an explicit isolated option for scheduled or
71
+ unattended work. Image/vision observation, multi-tab control, URL extraction,
72
+ trace visibility, and stale-snapshot folding are available across the runtime
73
+ control plane.
69
74
 
70
75
  #### Credentials: cookie login, multi-account, inject
71
76
 
@@ -123,6 +128,26 @@ breaking.
123
128
 
124
129
  ### Fixed
125
130
 
131
+ - Link Actions now preserve the dedicated `link` credential-access purpose
132
+ through the desktop bridge, so provider-owned credentials remain
133
+ non-agent-exposable while still being usable by the approved Link tool.
134
+ - Browser device authorization now encrypts the access token, refresh token,
135
+ token and refresh expiries, token endpoint, and public client ID together.
136
+ Only the access token crosses the Link execution boundary; expired or invalid
137
+ connections are hidden from Link Actions and surfaced in the UI for a clean
138
+ reconnect.
139
+ - Link connection cards isolate state per provider and connection method,
140
+ cancel pending device flows on close/unmount, clear abandoned local secrets,
141
+ derive gateway totals from the live channel list, and leave browser-login
142
+ status retryable after a transient status-check failure.
143
+ - Clean-checkout CI now builds workspace exports before package-boundary tests,
144
+ resolves the agent stdio source subpath during typechecking, recognizes the
145
+ packaged Chrome extension globals, and gives coverage tests the same timeout
146
+ budget as the full suite.
147
+ - Desktop packaging now derives its workspace build order from one tested list,
148
+ including the Web, Server, and Chat packages introduced by the monorepo
149
+ split. npm publication also waits for all three native installer jobs, so a
150
+ failed desktop package cannot leave a half-published release.
126
151
  - Addressed the latest core/desktop architecture review findings around stream
127
152
  routing, permission/session scoping, and event coalescing, reducing
128
153
  wrong-session routing, duplicated events, and hard-to-cancel operations in
@@ -174,11 +199,66 @@ breaking.
174
199
 
175
200
  ### Changed
176
201
 
202
+ - The core installer, marketplace, onboarding, and updater implementation
203
+ exports have moved to the `/internal` subpath. Embedders importing these
204
+ implementation details must update their import path for 0.8.0.
205
+ - The short-lived personal todo UI has been replaced by Mimi follow-ups. Existing
206
+ `userData/pet/todos.json` files are intentionally left untouched and are not
207
+ auto-imported; users of that preview should back up or copy any remaining text
208
+ manually.
177
209
  - Refreshed beta-release documentation and repository hygiene: README badges and
178
210
  status copy now reflect the public beta track, obsolete handoff notes are
179
211
  archived under `docs/archive/`, and generated build artifacts are covered by
180
212
  `.gitignore`.
181
213
 
214
+ ## [0.7.1] - 2026-07-11
215
+
216
+ Hardening release. No breaking changes from 0.7.0 — 71 of the 119 commits are
217
+ fixes, concentrated in usage accounting, tool failure semantics, permission
218
+ boundaries and session lifecycle.
219
+
220
+ ### Added
221
+
222
+ - **Full-context session forks** — fork a session and keep the entire context
223
+ instead of restarting from a summary.
224
+ - **MCP HTTP OAuth** — the login and token-refresh flow is now complete, so
225
+ OAuth-protected HTTP MCP servers stay authenticated across restarts.
226
+ - Send images from the mobile remote.
227
+ - Jump from a `DriveAgent` job straight to its CLI session.
228
+ - Browser panel address-bar actions.
229
+
230
+ ### Fixed
231
+
232
+ - **Unified usage accounting** — billing and visibility are now split, and
233
+ aux / Arena / sub-agent / `maxTurns` usage is recovered instead of being
234
+ dropped. Image token estimation was also corrected.
235
+ - **Tool failure and abort semantics** are enforced consistently: a failed tool
236
+ reports as failed, and an abort propagates instead of being swallowed.
237
+ - **Permission modes defer to run boundaries**, so a mode change mid-run can no
238
+ longer apply to a tool call that was already in flight.
239
+ - **Session close is serialized** with close-only generation fencing, removing a
240
+ race between closing a session and its in-flight work.
241
+ - Hook stdin is protected against `EPIPE`, and transcript flush failures are
242
+ surfaced rather than silently lost.
243
+ - Approvals are bounded and plugin denials propagate correctly.
244
+ - Background media jobs are hardened: timed-out video URLs are retained, stream
245
+ fetches are capped, and MCP image names are unique.
246
+ - Duplicate mobile uploads are serialized; review requests are scoped by
247
+ workspace.
248
+
249
+ ## [0.7.0] - 2026-07-10
250
+
251
+ ### Added
252
+
253
+ - **Quick chat dock panel** — a lightweight always-available chat surface in the
254
+ desktop app.
255
+ - **Live CC room transcripts** stream into the desktop client.
256
+ - **Goal judge reads run evidence** (tool results, progress, previous gaps) on
257
+ the primary model, so goal evaluation is grounded in what the run actually did.
258
+ - `DriveAgent` job inspection and cancellation.
259
+ - `DriveAgent` accepts an optional per-job model override for claude/codex.
260
+ - OAuth MCP credentials.
261
+
182
262
  ## [0.6.0-rc.14]
183
263
 
184
264
  ### Fixed
@@ -221,7 +301,7 @@ plus one private Electron POC:
221
301
  render layer, the `code-shell` CLI bin, themes, key bindings, all
222
302
  terminal-only utilities. Imports core; nothing else imports it.
223
303
  - **`@cjhyy/code-shell`** (meta) — thin re-export shim. `import { Engine }
224
- from "@cjhyy/code-shell"` still works for SDK users; the `code-shell`
304
+ from "@cjhyy/code-shell"` still works for SDK users; the `code-shell`
225
305
  bin loads the TUI CLI. Ships three files total: `index.js`, `index.d.ts`,
226
306
  `cli.js`.
227
307
  - **`@cjhyy/code-shell-desktop`** (private) — Electron POC. Currently a
@@ -282,7 +362,7 @@ plugin `hooks.json` files.
282
362
  user's prompt text on `user_prompt_submit`). Registry aggregation is
283
363
  last-write-wins for input/prompt, newline-joined for additionalContext.
284
364
  - **`settings.json` shell hooks.** New `hooks: [{event, command,
285
- matcher?, timeout_ms?, cwd?}]` schema. Engine spawns the command per
365
+ matcher?, timeout_ms?, cwd?}]` schema. Engine spawns the command per
286
366
  emit with the CC wire protocol — stdin is the HookContext JSON,
287
367
  stdout is a HookResult JSON, exit 2 = deny with stderr surfaced to
288
368
  the model. `CODESHELL_HOOK_EVENT` / `CODESHELL_HOOK_CWD` env vars
@@ -301,7 +381,7 @@ plugin `hooks.json` files.
301
381
  `${CODESHELL_PLUGIN_ROOT}` across every text file, so CC-authored
302
382
  plugin scripts that branch on host detection pick the codeshell
303
383
  path. `InstallResult.varRewrite` reports counts and `/plugin
304
- install` prints a `rewrote: N file(s)` line so the modification is
384
+ install` prints a `rewrote: N file(s)` line so the modification is
305
385
  visible.
306
386
  - **`ToolContext.hooks`.** Tools that need to emit lifecycle events
307
387
  (currently `notification` on background sub-agent terminal states)
@@ -365,6 +445,7 @@ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
365
445
  ## [0.1.6] - 2026-05-13
366
446
 
367
447
  ### Added
448
+
368
449
  - **Built-in skills bundled with the package.** The skill scanner now also
369
450
  reads `skills-builtin/` shipped inside the installed npm package. First
370
451
  built-in is `codeshell-help` — answers questions about code-shell itself
@@ -377,6 +458,7 @@ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
377
458
  block, since unattended automations have no human to retry the task.
378
459
 
379
460
  ### Fixed
461
+
380
462
  - `code-shell run` now resolves API keys / baseUrl / model from
381
463
  `settings.providers[]` and `settings.models[]` in addition to the legacy
382
464
  `settings.model.*` mirror — matches what Engine reconciles at startup,
@@ -395,8 +477,9 @@ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
395
477
  ## [0.1.5] - 2026-05-13
396
478
 
397
479
  ### Added
480
+
398
481
  - **Auto-installing updater.** Background update check probes `npm config get
399
- prefix` for write permission; if writable, registers a detached `npm i -g`
482
+ prefix` for write permission; if writable, registers a detached `npm i -g`
400
483
  on process exit so the next launch picks up the new version. File lock at
401
484
  `~/.code-shell/.update.lock` (5min stale-takeover) prevents concurrent
402
485
  installs from corrupting each other. Disable with `DISABLE_AUTOUPDATER=1`,
@@ -421,7 +504,7 @@ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
421
504
  reminder; a third re-read is hard-blocked. Four+ consecutive read-only
422
505
  calls (or three+ silent turns) inject a strategy-change reminder.
423
506
  - **Per-session verbose recorder.** Dev-only JSONL trace under `log/<date>/
424
- session-<sid>.jsonl` capturing every LLM request/response, tool call, and
507
+ session-<sid>.jsonl` capturing every LLM request/response, tool call, and
425
508
  engine event. Gated on `CODE_SHELL_DEV=1` / `--debug` / running from src.
426
509
  7-day retention, argv secrets redacted, per-record output clipped to 256 KB.
427
510
  - **Pasted-noise sanitizer.** Engine rejects tasks that are >70% ANSI/box
@@ -434,6 +517,7 @@ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
434
517
  progress instead of a stale snapshot from the last completed run.
435
518
 
436
519
  ### Changed (breaking)
520
+
437
521
  - `SessionStatus` is now `"active" | "paused" | TerminalReason` instead of
438
522
  `"active" | "paused" | "completed" | "errored"`. `state.json` records the
439
523
  raw terminal reason (e.g. `aborted_streaming`, `model_error`,
@@ -442,6 +526,7 @@ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
442
526
  need to widen its match.
443
527
 
444
528
  ### Changed
529
+
445
530
  - API key resolution centralized into `resolveApiKey()` (one canonical
446
531
  fallback chain: option → settings → all provider env vars). Replaces five
447
532
  drifting copies in `repl.ts`, `run.ts`, `runs.ts`, `main.ts`,
@@ -454,6 +539,7 @@ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
454
539
  ## [0.1.4] - 2026-05-09
455
540
 
456
541
  ### Fixed
542
+
457
543
  - **Multi-model `apiKey` ignored on startup.** When `settings.json` defined
458
544
  a model in `models[]` (with its own `apiKey`/`baseUrl`) and the top-level
459
545
  `model.apiKey` was empty, the runtime fell through to
@@ -472,6 +558,7 @@ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
472
558
  ## [0.1.0-alpha.1] - 2026-04-30
473
559
 
474
560
  ### Changed (breaking)
561
+
475
562
  - **Tool timeout system rewritten.** Removed the hardcoded
476
563
  `LEGACY_LONG_TIMEOUT_TOOLS = {Agent, Arena}` whitelist in
477
564
  `tool-system/registry.ts`. Tools now declare their own timeout via
@@ -491,6 +578,7 @@ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
491
578
  (e.g. extended thinking).
492
579
 
493
580
  ### Added
581
+
494
582
  - **`Agent(run_in_background: true)`** — fire-and-forget sub-agents. Returns
495
583
  an `agent_id` immediately instead of blocking the parent turn. The agent
496
584
  runs detached in the same process; restarting loses its state.
@@ -502,6 +590,7 @@ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
502
590
  registry for async agent handles.
503
591
 
504
592
  ### Notes
593
+
505
594
  - Cross-process / restart-survivable long tasks still belong to `RunManager`
506
595
  in `@cjhyy/code-shell/run`, not to `Agent(run_in_background)`. The split
507
596
  mirrors Claude Code's REPL/Agent-tool/Routines architecture.
@@ -509,6 +598,7 @@ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
509
598
  ## [0.1.0-alpha.0] - 2026-04-28
510
599
 
511
600
  ### Added
601
+
512
602
  - **`IterativeArena` — multi-model authoring loop.** Pipeline: tournament v1
513
603
  (every participant writes a draft, the author merges anonymized drafts into
514
604
  v1) → critique-revise rounds (parallel critics produce anchored critiques
@@ -527,6 +617,7 @@ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
527
617
  - `node >= 20` engine constraint alongside the existing `bun >= 1.3` hint.
528
618
 
529
619
  ### Fixed
620
+
530
621
  - TypeScript compilation is now clean (was 50+ errors).
531
622
  - Removed zombie `cli/transports/`, `cli/handlers/`, `cli/remoteIO.ts`,
532
623
  `cli/structuredIO.ts`, `cli/ndjsonSafeStringify.ts` — these were copied
@@ -571,11 +662,13 @@ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
571
662
  Azure backend that rejects tool calls with 401.
572
663
 
573
664
  ### Removed
665
+
574
666
  - `TodoWrite` tool. It was a 6-line wrapper around `TaskCreate` and its
575
667
  presence confused models into using two equivalent interfaces. Use the
576
668
  `Task*` family (`TaskCreate`, `TaskUpdate`, `TaskList`, `TaskGet`, etc.).
577
669
 
578
670
  ### Changed
671
+
579
672
  - Arena research-phase prompts no longer hard-cap output at "exactly 3 to 6
580
673
  findings". The new instruction asks for "as many findings as the topic
581
674
  warrants — typically 5-15", with each `summary` field expected to be 80+
@@ -593,6 +686,7 @@ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
593
686
  marked `[需调研]` / `[TBD: ...]`.
594
687
 
595
688
  ### Fixed
689
+
596
690
  - IterativeArena: `extractTag` now tolerates LLM responses where the
597
691
  closing `</v1_content>` / `</v_next_content>` marker is missing (e.g. due
598
692
  to max_tokens truncation). Previously the parser fell back to "use the
package/README.md CHANGED
@@ -30,7 +30,7 @@ CodeShell is one orchestration engine wearing three faces:
30
30
  - an **Electron desktop app** with chat, file/browser/terminal/diff panels, model & credential management, an extensions marketplace, automation, and a phone remote, and
31
31
  - a **programmatic SDK** (`import { Engine } from "@cjhyy/code-shell"`) for embedding the engine in your own product.
32
32
 
33
- The core is deliberately **domain-agnostic**. The turn loop, context management, permissions, MCP integration, hooks, tasks, cron, sub-agents, sessions, and memory all stay generic; coding behavior is just a *preset* layered on top not baked into the engine. (See `packages/core/CONTRIBUTING.md`: "core only carries mechanism, not policy.")
33
+ The core is deliberately **domain-agnostic**. The turn loop, context management, permissions, MCP integration, hooks, tasks, cron, sub-agents, sessions, and memory all stay generic. Coding tools, git/worktree behavior, LSP, review, quota, and coding prompts live in the physically separate `@cjhyy/code-shell-capability-coding` package and are composed by the CLI/Desktop hosts. (See `packages/core/CONTRIBUTING.md`: "core only carries mechanism, not policy.")
34
34
 
35
35
  > Status: **0.6.x, entering beta**. The desktop app is the headline product; the CLI and SDK share the same core engine.
36
36
 
@@ -99,10 +99,11 @@ It gives you chat with streaming output, a side-by-side file / browser / termina
99
99
 
100
100
  ### Presets
101
101
 
102
- | Preset | Purpose | Extra tools |
103
- |--------|---------|-------------|
104
- | `general` | General orchestration, research, automation, long-running work | Core orchestration tools only |
105
- | `terminal-coding` | Terminal-native coding assistant | `EnterWorktree`, `ExitWorktree`, `NotebookEdit`, `LSP`, `Brief`, `Arena` |
102
+ | Preset | Purpose | Extra tools |
103
+ | ----------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------ |
104
+ | `harness-min` | Domain-neutral core default for embedding | Minimal filesystem, shell, MCP, memory, task and agent mechanisms |
105
+ | `general` | General orchestration, research, automation, long-running work | Core orchestration tools only |
106
+ | `terminal-coding` | Terminal-native coding assistant | `EnterWorktree`, `ExitWorktree`, `NotebookEdit`, `LSP`, `Brief`, `Arena` |
106
107
 
107
108
  Presets select the system prompt, the built-in tool set, and permission defaults. Configure via the SDK, the CLI `--preset` flag, or settings.
108
109
 
@@ -127,8 +128,9 @@ Presets select the system prompt, the built-in tool set, and permission defaults
127
128
 
128
129
  ### Built-in tools
129
130
 
130
- The default `general` preset whitelists 48 built-ins. The CLI defaults to
131
- `terminal-coding`, which adds coding extras. Runtime guards may hide tools that
131
+ Core by itself defaults to the minimal `harness-min` preset. The CLI and Desktop
132
+ compose the coding capability package, whose host default is `terminal-coding`.
133
+ Runtime guards may hide tools that
132
134
  need unavailable providers, credentials, cookies, or an active goal.
133
135
 
134
136
  - **File / workspace**: `Read`, `Write`, `Edit`, `ApplyPatch`, `Glob`, `Grep`
@@ -169,6 +171,14 @@ const codingEngine = new Engine({
169
171
 
170
172
  Everything is exported from the package root — `import { ... } from "@cjhyy/code-shell"` (or directly from `@cjhyy/code-shell-core`). There are no `/run`, `/arena`, or `/product` subpath entry points.
171
173
 
174
+ Runnable SDK examples live in [`examples/`](examples/) — each runs directly
175
+ with `bun run <file>` and supports `--dry-run` (scripted mock LLM) when no API
176
+ key is configured:
177
+
178
+ - [`examples/01-minimal-agent.ts`](examples/01-minimal-agent.ts) — one Engine, one run, streamed output
179
+ - [`examples/02-approval-flow.ts`](examples/02-approval-flow.ts) — a custom `ApprovalBackend` gating tool calls
180
+ - [`examples/03-in-process-transport.ts`](examples/03-in-process-transport.ts) — the recommended `createServer` / `createClient` factory pair
181
+
172
182
  ---
173
183
 
174
184
  ## Configuration
@@ -216,6 +226,7 @@ The OpenAI-compatible provider aborts any LLM stream idle for `CODESHELL_STREAM_
216
226
  At a high level, CodeShell routes CLI, headless, SDK, and desktop clients through the same engine runtime:
217
227
 
218
228
  - **Preset resolution** selects the system prompt, built-in tools, and permission defaults.
229
+ - **Capability composition** lets products install their own tools, presets, prompt sections, file-history behavior, and session-workspace adapters without putting product policy in core.
219
230
  - **TurnLoop** coordinates model streaming, context assembly, tool execution, and lifecycle events.
220
231
  - **Tool system** hosts built-ins, MCP tools, permissions, hooks, and cancellation.
221
232
  - **Session / run layers** persist transcripts, state, tasks, automation runs, and memories.
@@ -225,7 +236,7 @@ In the desktop app, the Electron main process acts as an IPC service layer: it d
225
236
  Design principles:
226
237
 
227
238
  - **Core first** — the orchestration engine stays domain-agnostic.
228
- - **Presets over hardcoding** — coding behavior lives in configuration.
239
+ - **Capabilities over hardcoding** — coding behavior lives in a separate package composed at the host boundary.
229
240
  - **Secure by default** — permission-gated actions and explicit approval flow; owner-only credential files.
230
241
  - **Long-running ready** — tasks, cron, sleep, sub-agents, and persistent goals are first-class.
231
242
 
@@ -235,10 +246,19 @@ Design principles:
235
246
 
236
247
  ```text
237
248
  packages/
238
- ├── core/ # Engine, context, tools, MCP, hooks, sessions, runs, presets, memory
249
+ ├── link/ # Framework-independent Link provider manifests and authorization guides
250
+ ├── core/ # Domain-agnostic engine, context, MCP, hooks, sessions, runs, memory
251
+ ├── coding/ # Coding capability pack: tools, git/worktrees, LSP, review, prompt/presets
252
+ ├── arena/ # Optional multi-model Arena capability
253
+ ├── pet/ # Mimi behavior, DelegateWork, projection protocol, digital-human teams
254
+ ├── server/ # Headless HTTP/WebSocket host, rooms, uploads, mobile remote
255
+ ├── web/ # Browser-safe remote client state and SPA
239
256
  ├── tui/ # Terminal CLI, Ink-based UI, renderer, commands, approvals
240
257
  ├── desktop/ # Electron desktop client + agent worker bridge + mobile remote app
241
- └── cdp/ # Environment-agnostic CDP browser-action layer (no Playwright)
258
+ ├── cdp/ # Environment-agnostic CDP browser-action layer (no Playwright)
259
+ └── chat/ # Standalone multi-channel chat gateway + optional CodeShell adapter
260
+
261
+ package.json # @cjhyy/code-shell compatibility meta package
242
262
 
243
263
  assets/ # README / product images (mascot, promo hero, Playwright desktop screenshots)
244
264
 
@@ -256,8 +276,8 @@ scripts/ # Build, release, and repo maintenance scripts
256
276
 
257
277
  ```bash
258
278
  bun install
259
- bun run build # build core + tui + meta package
260
- bun run typecheck # root core + tui check; currently not a clean gate
279
+ bun run build # build link + core + capability/host packages + meta package
280
+ bun run typecheck # root core + coding capability + tui + chat check
261
281
  bun test # core / tui test suites
262
282
 
263
283
  # Desktop has its OWN typecheck and build (the root checks do NOT cover it):
@@ -266,7 +286,7 @@ bun run typecheck
266
286
  bun run build
267
287
  ```
268
288
 
269
- > Current caveat: `bun run typecheck` at the repo root reports a pre-existing test typing error in `packages/core/src/tool-system/builtin/drive-claude-code.test.ts:158`. Use it for signal, but do not treat it as a clean gate until that is fixed.
289
+ > Current caveat: `bun run typecheck` at the repository root still reports pre-existing test-source typing diagnostics. The package builds and Desktop typecheck above are the clean gates for this change.
270
290
 
271
291
  `bun run dev` launches the desktop app. For the TUI in dev: `bun run dev:tui`.
272
292
 
@@ -276,6 +296,14 @@ bun run build
276
296
 
277
297
  ## Further reading
278
298
 
299
+ - [Panel Apps v2 — project-bound UI, tools, and Skills](docs/panel-apps.md)
300
+ - [Panel App starter template](https://github.com/cjhyy/codeshell-panel-apps/tree/main/templates/starter)
301
+ - [Design Studio reference Panel App](https://github.com/cjhyy/codeshell-panel-apps/tree/main/apps/design-studio)
302
+ - [Quant Lab reference Panel App](https://github.com/cjhyy/codeshell-panel-apps/tree/main/apps/quant-lab)
303
+ - [Video editor reference plugin](examples/plugins/video-editor/README.md)
304
+ - [Package boundaries & Pet split rationale](docs/architecture/12-package-boundaries-and-release-units.md)
305
+ - [Plugin parity matrix](docs/architecture/13-plugin-parity-and-video-editor.md)
306
+ - [Digital humans & Pet architecture](docs/architecture/14-digital-human-and-pet.md)
279
307
  - [Architecture & feature inventory](docs/architecture/README.md)
280
308
  - [Roadmap & TODO](docs/todo/README.md)
281
309
  - [Prior architecture documentation set (archived, pending rewrite)](docs/archive/architecture/README.md)
@@ -284,7 +312,7 @@ bun run build
284
312
 
285
313
  ## Acknowledgments
286
314
 
287
- The `ApplyPatch` tool (`packages/core/src/tool-system/builtin/apply-patch/`) is adapted from
315
+ The `ApplyPatch` tool (`packages/coding/src/tools/apply-patch/`) is adapted from
288
316
  [OpenAI Codex `codex-rs/apply-patch`](https://github.com/openai/codex/tree/main/codex-rs/apply-patch),
289
317
  licensed under the Apache License 2.0. See `NOTICE.md` and `LICENSE-codex` in that directory
290
318
  for details, including the intentional behavioral divergence where our applier rolls back
package/README.zh-CN.md CHANGED
@@ -30,7 +30,7 @@ CodeShell 是同一个编排引擎的三种形态:
30
30
  - **Electron 桌面应用**:提供聊天、文件/浏览器/终端/diff 面板、模型与凭证管理、扩展市场、自动化和手机远程控制;
31
31
  - **程序化 SDK** (`import { Engine } from "@cjhyy/code-shell"`):可把引擎嵌入你自己的产品。
32
32
 
33
- 核心引擎保持**领域无关**。turn loop、上下文管理、权限、MCP 集成、hooks、tasks、cron、sub-agents、sessions 和 memory 都是通用机制;“写代码助手”只是叠在引擎上的一个 preset,而不是写死在核心里。
33
+ 核心引擎保持**领域无关**。turn loop、上下文管理、权限、MCP 集成、hooks、tasks、cron、sub-agents、sessions 和 memory 都是通用机制。编码工具、git/worktree、LSP、review、quota 与编码 prompt 位于物理独立的 `@cjhyy/code-shell-capability-coding` 包,由 CLI/Desktop host 组合,不写进 core。
34
34
 
35
35
  > 状态:**0.6.x,进入 beta 阶段**。桌面应用是当前主产品;CLI 和 SDK 共享同一个核心引擎。
36
36
 
@@ -99,10 +99,11 @@ bun run dev # 以开发模式启动桌面应用
99
99
 
100
100
  ### Presets
101
101
 
102
- | Preset | 用途 | 额外工具 |
103
- |--------|------|----------|
104
- | `general` | 通用编排、研究、自动化、长期任务 | 仅核心编排工具 |
105
- | `terminal-coding` | 终端原生编码助手 | `EnterWorktree`, `ExitWorktree`, `NotebookEdit`, `LSP`, `Brief`, `Arena` |
102
+ | Preset | 用途 | 额外工具 |
103
+ | ----------------- | ---------------------------------- | ------------------------------------------------------------------------ |
104
+ | `harness-min` | 供其他产品嵌入的领域无关 core 默认 | 最小文件、shell、MCP、memory、task 与 agent 机制 |
105
+ | `general` | 通用编排、研究、自动化、长期任务 | 仅核心编排工具 |
106
+ | `terminal-coding` | 终端原生编码助手 | `EnterWorktree`, `ExitWorktree`, `NotebookEdit`, `LSP`, `Brief`, `Arena` |
106
107
 
107
108
  Preset 决定 system prompt、内置工具集和权限默认值。可通过 SDK、CLI `--preset` 参数或 settings 配置。
108
109
 
@@ -127,8 +128,8 @@ Preset 决定 system prompt、内置工具集和权限默认值。可通过 SDK
127
128
 
128
129
  ### 内置工具
129
130
 
130
- 默认 `general` preset 白名单包含 48 个内置工具。CLI 默认使用
131
- `terminal-coding` preset,并额外加入编码相关工具。运行时 guard 可能隐藏当前不可用的
131
+ 单独使用 core 时默认是最小的 `harness-min` preset。CLI Desktop 会组合 coding
132
+ capability 包,该宿主的默认 preset 是 `terminal-coding`。运行时 guard 可能隐藏当前不可用的
132
133
  provider、凭证、cookie 或 goal 相关工具。
133
134
 
134
135
  - **File / workspace**:`Read`, `Write`, `Edit`, `ApplyPatch`, `Glob`, `Grep`
@@ -214,6 +215,7 @@ OpenAI-compatible provider 会中止在 `CODESHELL_STREAM_IDLE_TIMEOUT_MS` 毫
214
215
  高层来看,CodeShell 让 CLI、headless、SDK 和桌面客户端都走同一个 engine runtime:
215
216
 
216
217
  - **Preset resolution** 选择 system prompt、内置工具和权限默认值;
218
+ - **Capability composition** 允许产品在 core 之外注入工具、presets、prompt sections、文件历史行为与 session workspace adapter;
217
219
  - **TurnLoop** 协调模型流式输出、上下文组装、工具执行和生命周期事件;
218
220
  - **Tool system** 承载内置工具、MCP tools、permissions、hooks 和 cancellation;
219
221
  - **Session / run layers** 持久化 transcripts、state、tasks、automation runs 和 memories。
@@ -223,7 +225,7 @@ OpenAI-compatible provider 会中止在 `CODESHELL_STREAM_IDLE_TIMEOUT_MS` 毫
223
225
  设计原则:
224
226
 
225
227
  - **Core first**:编排引擎保持领域无关;
226
- - **Presets over hardcoding**:编码行为存在配置里;
228
+ - **Capabilities over hardcoding**:编码行为放在独立 package 中,在 host 边界组合;
227
229
  - **Secure by default**:高影响动作默认经过权限门禁;
228
230
  - **Long-running ready**:tasks、cron、sleep、sub-agents 和 persistent goals 都是一等能力。
229
231
 
@@ -233,10 +235,19 @@ OpenAI-compatible provider 会中止在 `CODESHELL_STREAM_IDLE_TIMEOUT_MS` 毫
233
235
 
234
236
  ```text
235
237
  packages/
236
- ├── core/ # Engine, context, tools, MCP, hooks, sessions, runs, presets, memory
237
- ├── tui/ # Terminal CLI, Ink-based UI, renderer, commands, approvals
238
- ├── desktop/ # Electron desktop client + agent worker bridge + mobile remote app
239
- └── cdp/ # Environment-agnostic CDP browser-action layer (no Playwright)
238
+ ├── link/ # 与框架无关的 Link provider 清单和授权指南
239
+ ├── core/ # 领域无关的 Engine、context、MCP、hooks、sessions、runs、memory
240
+ ├── coding/ # 编码 capability:tools、git/worktrees、LSP、review、prompt/presets
241
+ ├── arena/ # 可选的多模型 Arena capability
242
+ ├── pet/ # Mimi 行为、DelegateWork、投影协议、数字人团队
243
+ ├── server/ # Headless HTTP/WebSocket host、rooms、uploads、mobile remote
244
+ ├── web/ # 浏览器安全的远程客户端状态与 SPA
245
+ ├── tui/ # Terminal CLI、Ink UI、renderer、commands、approvals
246
+ ├── desktop/ # Electron desktop client、agent worker bridge、mobile remote app
247
+ ├── cdp/ # Environment-agnostic CDP browser-action layer (no Playwright)
248
+ └── chat/ # 独立多渠道聊天网关与可选 CodeShell adapter
249
+
250
+ package.json # @cjhyy/code-shell 兼容 meta package
240
251
 
241
252
  assets/ # README / product images (mascot, promo hero, Playwright desktop screenshots)
242
253
 
@@ -254,8 +265,8 @@ scripts/ # Build, release, and repo maintenance scripts
254
265
 
255
266
  ```bash
256
267
  bun install
257
- bun run build # build core + tui + meta package
258
- bun run typecheck # root core + tui check; currently not a clean gate
268
+ bun run build # build link + core + capability/host packages + meta package
269
+ bun run typecheck # root core + coding capability + tui + chat check
259
270
  bun test # core / tui test suites
260
271
 
261
272
  # Desktop has its OWN typecheck and build (root checks do NOT cover it):
@@ -264,7 +275,7 @@ bun run typecheck
264
275
  bun run build
265
276
  ```
266
277
 
267
- > 当前注意:repo root 的 `bun run typecheck` 会因 `packages/core/src/tool-system/builtin/drive-claude-code.test.ts:158` 的既有测试类型错误失败。它仍可提供信号,但在该错误修复前不要把它当成干净 gate。
278
+ > 当前注意:repo root 的 `bun run typecheck` 仍会报告既有的测试源码类型诊断。本次改动以各 package build 与上面的 Desktop typecheck 作为干净 gate。
268
279
 
269
280
  `bun run dev` 会启动桌面应用。TUI 开发模式:`bun run dev:tui`。
270
281
 
@@ -275,6 +286,11 @@ bun run build
275
286
  ## 延伸阅读
276
287
 
277
288
  - [Architecture & feature inventory](docs/architecture/README.md)
289
+ - [Plugin panels v1](docs/plugin-panels.md)
290
+ - [视频剪辑参考插件](examples/plugins/video-editor/README.md)
291
+ - [包边界与 Pet 拆分理由](docs/architecture/12-package-boundaries-and-release-units.md)
292
+ - [插件能力差距矩阵](docs/architecture/13-plugin-parity-and-video-editor.md)
293
+ - [数字人与 Pet 架构](docs/architecture/14-digital-human-and-pet.md)
278
294
  - [Roadmap & TODO](docs/todo/README.md)
279
295
  - [Prior architecture documentation set (archived, pending rewrite)](docs/archive/architecture/README.md)
280
296
 
@@ -282,7 +298,7 @@ bun run build
282
298
 
283
299
  ## 致谢
284
300
 
285
- `ApplyPatch` tool(`packages/core/src/tool-system/builtin/apply-patch/`)改编自 [OpenAI Codex `codex-rs/apply-patch`](https://github.com/openai/codex/tree/main/codex-rs/apply-patch),使用 Apache License 2.0。详见该目录下的 `NOTICE.md` 和 `LICENSE-codex`。
301
+ `ApplyPatch` tool(`packages/coding/src/tools/apply-patch/`)改编自 [OpenAI Codex `codex-rs/apply-patch`](https://github.com/openai/codex/tree/main/codex-rs/apply-patch),使用 Apache License 2.0。详见该目录下的 `NOTICE.md` 和 `LICENSE-codex`。
286
302
 
287
303
  ## License
288
304
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cjhyy/code-shell",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Code Shell — meta package. Installs @cjhyy/code-shell-core and @cjhyy/code-shell-tui.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -16,22 +16,30 @@
16
16
  },
17
17
  "scripts": {
18
18
  "preinstall": "node scripts/check-node.cjs",
19
- "build": "bun run --filter '@cjhyy/code-shell-core' build && bun run --filter '@cjhyy/code-shell-tui' build && bun run scripts/build-meta.ts",
19
+ "build": "bun run --filter '@cjhyy/code-shell-link' build && bun run --filter '@cjhyy/code-shell-core' build && bun run --filter '@cjhyy/code-shell-pet' build && bun run --filter '@cjhyy/code-shell-arena' build && bun run --filter '@cjhyy/code-shell-capability-coding' build && bun run --filter '@cjhyy/code-shell-cdp' build && bun run --filter '@cjhyy/code-shell-server' build && bun run --filter '@cjhyy/code-shell-web' build && bun run --filter '@cjhyy/code-shell-tui' build && bun run --filter '@cjhyy/code-shell-chat' build && bun run scripts/build-meta.ts",
20
20
  "dev": "bun run dev:desktop",
21
21
  "dev:desktop": "bun run --filter '@cjhyy/code-shell-desktop' dev",
22
22
  "dev:tui": "CODE_SHELL_DEV=1 CODESHELL_UI_PERF=1 bun run packages/tui/src/cli/main.ts",
23
23
  "dev:bigtranscript": "bun run scripts/render-bigtranscript-dev.ts",
24
- "test": "bun test",
25
- "test:watch": "bun test --watch",
24
+ "test": "bun test --timeout 30000",
25
+ "test:coverage": "bun test --timeout 30000 --config ./bunfig.coverage.toml packages/core/src/tool-system/builtin packages/core/src/tool-system/testing --coverage --coverage-reporter=text",
26
+ "test:e2e": "bun run build && bun run --cwd packages/desktop build && bun run --cwd packages/desktop test:e2e",
27
+ "smoke": "bun run build && bun run --cwd packages/desktop build && bun run --cwd packages/desktop smoke",
28
+ "test:core-exports": "bun run --filter '@cjhyy/code-shell-core' build && node scripts/smoke-core-exports.mjs",
29
+ "test:core-harness": "bun run --filter '@cjhyy/code-shell-core' build && node scripts/smoke-core-harness.mjs",
30
+ "test:package-release": "bun run scripts/package-release-smoke.ts",
31
+ "test:watch": "bun test --timeout 30000 --watch",
26
32
  "bench:render": "bun run bench/render-tail.bench.ts && bun run bench/render-streaming.bench.ts && bun run bench/render-spinner.bench.ts && bun run bench/render-wheel.bench.ts",
27
- "typecheck": "tsc --noEmit",
33
+ "typecheck": "bun run --filter '@cjhyy/code-shell-chat' typecheck && tsc --noEmit",
28
34
  "lint": "eslint packages/",
29
35
  "lint:engine-bypass": "bash scripts/check-no-engine-bypass.sh",
36
+ "lint:workflow-test-paths": "node scripts/check-workflow-test-paths.mjs",
37
+ "lint:baseline": "node scripts/check-lint-baseline.mjs",
30
38
  "format": "prettier --write 'packages/**/*.ts'"
31
39
  },
32
40
  "dependencies": {
33
- "@cjhyy/code-shell-core": "0.7.0",
34
- "@cjhyy/code-shell-tui": "0.7.0"
41
+ "@cjhyy/code-shell-core": "0.8.0",
42
+ "@cjhyy/code-shell-tui": "0.8.0"
35
43
  },
36
44
  "workspaces": [
37
45
  "packages/*"