From 55e356d60fc392edbd3ed7386a29cc43c7944175 Mon Sep 17 00:00:00 2001 From: Shigma Date: Tue, 3 Nov 2026 13:49:28 +0800 Subject: [PATCH 1/3] docs(vendor): drop the rc.11 plan and correct upstream pins --- vendor/README.md | 21 +++---- vendor/cordis-rc11-upgrade-plan.md | 93 ------------------------------ 2 files changed, 9 insertions(+), 105 deletions(-) delete mode 100644 vendor/cordis-rc11-upgrade-plan.md diff --git a/vendor/README.md b/vendor/README.md index 9020f5dcb6..c3a4c8e774 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -6,23 +6,19 @@ All vendored packages use the **`@deepseek-ai` scope** (`cordis` → `@deepseek- This file covers the manifest, the local-modification log, and the procedure for **updating** an existing vendored package. To **add a new** one, see the cookbook guide: [docs/cookbook/adding-a-vendored-package.md](../docs/cookbook/adding-a-vendored-package.md). -The proposed [Cordis rc.11 upgrade plan](cordis-rc11-upgrade-plan.md) records the package scope, PR dependencies and intended disposition of the local modifications. - ## Manifest -Upstream workspace: `cordis-workspace` (local checkout: `~/repos/cordis-workspace`). - | Directory | npm name | Upstream name | Version | Upstream repo | Commit | |---|---|---|---|---|---| -| `cosmokit/` | `@deepseek-ai/cosmokit` | `cosmokit` | 1.8.1 | https://github.com/deepseek-harness/cosmokit | `16f6fc058ade66e8ac5da0033d35a8d0f279f544` | -| `schemastery/` | `@deepseek-ai/schemastery` | `schemastery` | 3.18.0 | https://github.com/deepseek-harness/schemastery (`packages/core`) | `e67cee00ad725bd1534aee930a979ea3eec6f698` | +| `cosmokit/` | `@deepseek-ai/cosmokit` | `cosmokit` | 1.8.1 | https://github.com/shigma/cosmokit | `02e691c5aa7f37f6e0b1cee7ee8f4a21c2e34507` | +| `schemastery/` | `@deepseek-ai/schemastery` | `schemastery` | 3.18.0 | https://github.com/shigma/schemastery (`packages/core`) | `cf0b7e5481d0e31d10cdc30bc45c09366c332f27` | | `cordis/` | `@deepseek-ai/cordis` | `cordis` | 4.0.0-rc.11 | https://github.com/cordiverse/cordis (`packages/core`) | `0b96d9fd517b998e44e2209560c9e5f0671ce933` | | `loader/` | `@deepseek-ai/cordis-plugin-loader` | `@cordisjs/plugin-loader` | 1.0.0-rc.8 | https://github.com/cordiverse/cordis (`packages/loader`) | `0b96d9fd517b998e44e2209560c9e5f0671ce933` | | `include/` | `@deepseek-ai/cordis-plugin-include` | `@cordisjs/plugin-include` | 1.1.1 | https://github.com/cordiverse/cordis (`packages/include`) | `0b96d9fd517b998e44e2209560c9e5f0671ce933` | -| `group/` | `@deepseek-ai/cordis-plugin-group` | `@cordisjs/plugin-group` | 1.0.0 | https://github.com/deepseek-harness/cordis (`packages/group`) | `abb0a307cb1d3b0947f455d590cf5ba922d4caa4` | -| `timer/` | `@deepseek-ai/cordis-plugin-timer` | `@cordisjs/plugin-timer` | 1.1.4 | https://github.com/cordiverse/cordis (`packages/timer`) | `0b96d9fd517b998e44e2209560c9e5f0671ce933` | -| `hmr/` | `@deepseek-ai/cordis-plugin-hmr` | `@cordisjs/plugin-hmr` | 1.0.15 | https://github.com/deepseek-harness/cordis (`packages/hmr`) | `abb0a307cb1d3b0947f455d590cf5ba922d4caa4` | -| `logger-console/` | `@deepseek-ai/cordis-plugin-logger-console` | `@cordisjs/plugin-logger-console` | 1.0.0 | https://github.com/deepseek-harness/cordis (`packages/logger-console`) | `abb0a307cb1d3b0947f455d590cf5ba922d4caa4` | +| `group/` | `@deepseek-ai/cordis-plugin-group` | `@cordisjs/plugin-group` | 1.0.0 | https://github.com/cordiverse/cordis (`packages/group`) | `01b396240ce47cf2779c40af9bc445bb748fe112` | +| `timer/` | `@deepseek-ai/cordis-plugin-timer` | `@cordisjs/plugin-timer` | 1.1.4 | https://github.com/cordiverse/cordis (`packages/timer`) | `01b396240ce47cf2779c40af9bc445bb748fe112` | +| `hmr/` | `@deepseek-ai/cordis-plugin-hmr` | `@cordisjs/plugin-hmr` | 1.0.15 | https://github.com/cordiverse/cordis (`packages/hmr`) | `ed8a7755c26a27a72064a21dea036ad1d1d6833c` | +| `logger-console/` | `@deepseek-ai/cordis-plugin-logger-console` | `@cordisjs/plugin-logger-console` | 1.0.0 | https://github.com/cordiverse/cordis (`packages/logger-console`) | `01b396240ce47cf2779c40af9bc445bb748fe112` | Third-party dependencies of the vendored packages stay on npm: `@standard-schema/spec`, `js-yaml`, `chokidar`, `picomatch`, `@babel/code-frame`, `supports-color`, `node-addon-require-builtin`. @@ -31,13 +27,14 @@ Intentionally **not** vendored (verified unused by this set): `reggol`, `@cordis ## Local modifications Keep this log exhaustive — every divergence from upstream must be listed. Each entry has a stable ID: remove an entry when its divergence no longer exists, and never renumber or reuse IDs. The next new entry is V28. + - **V1 · `hmr/src/index.ts`**: removed the `./locales/en-US.yml` / `./locales/zh-CN.yml` imports, the `.i18n({...})` call on the `Config` schema, and the `src/locales/` directory. Rationale: those imports require a runtime YAML loader hook (`@cordisjs/unyaml`) that we do not vendor; the i18n texts only localize config descriptions. - **V2 · All `package.json` files**: regenerated for Harness releases with scoped names, release versions, publication metadata, precise bundled-runtime and `lib/types/**/*.d.ts` / `.d.ts.map` file entries, source exports where applicable, and declaration metadata pointing at `lib/types`. References within the vendored set use `workspace:~`. HMR declares `esbuild` as a direct dev dependency for its imported `BuildFailure` type, and Loader requires `node-addon-require-builtin@^0.1.4` to match published app runtimes. - **V3 · All `tsconfig.json` files**: regenerated to extend the repo-root `tsconfig.base.json`, emit TypeScript intermediates to `lib/types`, and declare project references. - **V4 · Vendored TypeScript source internal specifiers**: changed local relative imports/exports from upstream's specifier shape to explicit `.ts` specifiers so TypeScript rewrites emitted JS to `.js` while declarations keep explicit, NodeNext-safe `.ts` specifiers. This includes `loader/src/config/isolate.ts` using `declare module './entry.ts'`. Type-only dependencies use `import type` or inline `type` modifiers so ESM output does not retain erased interfaces. - **V5 · `schemastery/tsdown.config.ts` and `logger-console/tsdown.config.ts`**: ours, not upstream files — per-package build-shape overrides (dual ESM+CJS output; separate node/browser entries) for the repo-root tsdown build. They read the JS emitted under `lib/types` and then write the publish runtime entries under `lib/`. Like the regenerated tsconfigs, they are not part of the upstream sync surface. - **V6 · `cordis/src/fiber.ts` lifecycle hardening**: locally closes three reentrant disposal gaps. An effect's owner-list wrapper is registered before its setup body runs, so an unload begun from inside setup awaits setup and every collected cleanup; synchronous setup failure removes the wrapper and rolls back collected cleanup. Async cleanup stays owner-visible until quiescence, and Cordis's internal effect composition joins an already-running cleanup while repeated public disposer calls retain their upstream single-shot result. Effect creation is rejected while the owner is `UNLOADING` (while `PENDING` and `LOADING` remain legal), preventing cleanup-time registrations from escaping the unload snapshot. Child fibers register and receive their parent-owned disposer before `internal/plugin` publication, resolve dependency declarations added by that notification before activation, drain effects attached while pending, and contain teardown-notification failures per observer so one callback cannot starve peers or interrupt ownership cleanup. -- **V7 · Cordis, Loader and Timer JSDoc enrichment**: added `@param`/`@returns` tags and contract documentation (disposal semantics, waterfall veto, bail conditions, error cases) across the public plugin-author surface — `Context` (class, statics, and the `Context` interface properties incl. `root`), module re-exports, shared utility helpers, `EventsService`, `Fiber`, `RegistryService`, `ReflectService`, `Service`, `LoggerService` and their `declare module './context.ts'` overloads. Loader documentation covers `loader/src/{index,internal,config/entry,config/group,config/isolate,config/tree,config/utils}.ts`, including entry ownership, tree mutation methods, and the `!!js` discriminator. The upstream `EventsService.dispatch()` deprecation annotation is omitted: DSH enumerates callbacks to contain each observer failure independently, which the typed dispatch methods do not provide. Timer retains its local class and helper summaries; its README is local documentation because the upstream package has none. Comment-only; no code changes. Motivation: the website API-reference generator renders these docs and hard-errors on undocumented members. Retire this entry when the enrichment is upstreamed to the fork. +- **V7 · JSDoc enrichment**: added `@param`/`@returns` tags and contract documentation (disposal semantics, waterfall veto, bail conditions, error cases) across the public plugin-author surface — `Context` (class, statics, and the `Context` interface properties incl. `root`), module re-exports, shared utility helpers, `EventsService`, `Fiber`, `RegistryService`, `ReflectService`, `Service`, `LoggerService` and their `declare module './context.ts'` overloads. Loader documentation covers `loader/src/{index,internal,config/entry,config/group,config/isolate,config/tree,config/utils}.ts`, including entry ownership, tree mutation methods, and the `!!js` discriminator. The upstream `EventsService.dispatch()` deprecation annotation is omitted: DSH enumerates callbacks to contain each observer failure independently, which the typed dispatch methods do not provide. Timer retains its local class and helper summaries; its README is local documentation because the upstream package has none. Cosmokit and Schemastery add summaries to their exported helpers, types and namespaces, logger-console to its exporters and config namespace, and HMR to its build-failure logger in `hmr/src/error.ts`. Comment-only; no code changes. Motivation: the website API-reference generator renders these docs and hard-errors on undocumented members. Retire this entry when the enrichment is upstreamed. - **V9 · `hmr/src/index.ts` module-watcher readiness and native paths**: realpath the existing watch base, classify framework modules and attach listeners before reporting readiness, and compare config paths using both canonical and configured spellings. This preserves Node module-cache identity across Windows short-name paths and filesystem aliases. The main watcher uses `ignoreInitial: true` so startup reads do not trigger another refresh; exact profile patch watching is owned by `packages/boot/hmr/src/watch-config.ts`. The Include change listener logs a rejected `Include.refresh()` instead of leaving the rejection unhandled; the rejection reports unsaved runtime changes while Include keeps its running tree. Covered by `packages/boot/hmr/tests/watch-config.spec.ts` and `scripts/cordis-vendor-hmr-include.spec.ts`. - **V10 · Vendored Node-compatible TypeScript**: marked erased imports explicitly across `cordis`, `loader`, `include`, `hmr`, and `schemastery` so Node's native TypeScript transform does not request types as runtime exports. Schemastery's source uses an ESM default export and its package declares `type: module`. Conditional exports select `.mjs` for import and `.cjs` for require; without them, concurrent imports under module-hook hosts reach the CJS entry and can race its require of ESM Cosmokit (`ERR_REQUIRE_ESM_RACE_CONDITION`). - **V11 · Include patch and YAML exports**: `include/src/index.ts` exports upstream `applyPatches` as `applyEntryPatches` and the `!!js` YAML dialect as `entryListSchema`, so `dsh --dump-config` composes entries with the same algorithm that mounting uses. Covered by `packages/boot/app-boot/tests/config-reload.spec.ts` and `scripts/cordis-entry-commit.spec.ts`. @@ -63,7 +60,7 @@ Relative to the resolver source in Cordis `v4.0.0-rc.11`: To update a vendored package from upstream: -1. In the upstream workspace, note `git rev-parse HEAD` of the relevant submodule. +1. In the upstream repository listed in the manifest, check out the release tag or commit to sync and note its full commit SHA. 2. Copy the package's `src/` (and `bin.js`, `README.md`, `LICENSE` if changed) over the vendored directory. 3. Re-apply the local modifications listed above (or drop them if upstream made them unnecessary — update the log either way). 4. Update the version and commit hash in the manifest table. diff --git a/vendor/cordis-rc11-upgrade-plan.md b/vendor/cordis-rc11-upgrade-plan.md deleted file mode 100644 index 7833cf3514..0000000000 --- a/vendor/cordis-rc11-upgrade-plan.md +++ /dev/null @@ -1,93 +0,0 @@ -# Cordis rc.11 vendor upgrade plan - -Status: proposed - -## Problem - -The upgrade starts from the [vendored](README.md) baselines Cordis core 4.0.0-rc.7, Loader 1.0.0-rc.5, Include 1.0.4, HMR 1.0.15 and Timer 1.1.2, with 24 local-modification entries. [Cordis v4.0.0-rc.11](https://github.com/cordiverse/cordis/releases/tag/v4.0.0-rc.11) incorporates some fixes and replaces other mechanisms. Updating every package and retiring every patch in one change would combine configuration, persistence, lifecycle and module-replacement decisions. - -DSH also has consumers that upstream Cordis does not own. Volatile configuration fields are stable references updated without restarting plugins; the settings UI reads their live values. A profile selects ordered plugin bundles and configuration overrides. [DSH HMR](../packages/boot/hmr/README.md) coordinates module replacement and profile changes through `ctx.hmr`. An entry's module namespace is its raw import result, retained before selecting `default` or `apply` so HMR can identify the module already loaded. These consumers must remain usable at every merge point. - -## Proposal - -Keep source vendoring and stage the upgrade as independently reviewable PRs, each covering a complete concern with its producers and consumers. Upgrade Core with the minimum cross-package compatibility changes, then complete Loader, Include and vendor HMR separately. Retire an existing patch when its replacement is adopted and verified; retain independently applicable patches until their behavior has a replacement. PR 0 records this plan only. It does not approve the open runtime decisions or implement the upgrade. - -### Package scope - -| Package | Target from the rc.11 tag | Treatment | -|---|---|---| -| `vendor/cordis` | 4.0.0-rc.11 | Upgrade with the Core compatibility slice. | -| `vendor/loader` | 1.0.0-rc.8 | Import required slices first; complete the package after resolution and change reporting land. | -| `vendor/include` | 1.1.1 | Separate patch composition from journal adoption. | -| `vendor/hmr` | 1.1.1 | Upgrade independently of the Include journal. | -| `vendor/timer` | 1.1.4 | Upgrade independently of Core. | -| `vendor/group` | Keep the existing pin | Its entry source matches the tag after rescoping. The Group implementation lives in Loader and still requires migration. | -| `vendor/logger-console` | Keep the existing pin | All three source files match the tag after normalizing scope, relative import extensions and comments. Core's logger changes remain part of the Core upgrade. | -| `vendor/cosmokit`, `vendor/schemastery` | Keep the existing pins | Retain the volatile extensions; their upstream upgrades are outside this plan. | - -The comparison above checks the current vendored source against the release tag; it does not assume equal version numbers imply equal code. DSH package versions, exports and build settings remain governed by the repository. A partially synchronized Loader, Include or HMR keeps its old manifest baseline and records the imported upstream slice in the local-modification log. Advance the package baseline only when the complete package has been reconciled, with remaining differences recorded explicitly. - -### PR dependencies - -The identifiers below are plan labels, not GitHub issue numbers. Preconditions are merge requirements. Independent PRs can be developed and reviewed concurrently; a dependent PR can start against the proposed changes before its predecessors merge, but must validate the actual combined result before merging. - -`Vn` below is the stable ID of an entry in the [local-modification log](README.md#local-modifications), not a PR; a retired ID no longer appears in the log. **Retire** means the upstream implementation replaces the local difference; **partial** means some behavior still needs a local adaptation; **retain** means the requirement remains; **prepare** does not retire a patch. These are proposed outcomes, confirmed only by the owning PR's tests. - -| PR | Scope | Prerequisite PRs | Existing vendor modifications | Required evidence | -|---|---|---|---|---| -| 0 | This plan, package comparison and open decisions. | None | None retired; records the proposed disposition. | Documentation checks; no runtime changes. | -| 1 | Define access to raw config, candidate resolution and the active instance's effective config, and migrate settings, Config Editor, volatile updates and HMR readers together. Initially delegate to the old framework fields. | 0 | Prepare V15 (lazy/raw config) and V22 (volatile); retire neither yet. | Preserve existing objects, validation, settings and volatile behavior. Candidate validation does not replace the active instance's references; introduce no dependency from vendor code to DSH packages. | -| 2 | Add upstream-compatible `hmr.watch()` to both HMR providers with compatible typing, migrate the existing Include to explicit registration, and remove the equivalent Include scans. Use DSH HMR's existing coordination queue. | 0 | Adapt V9's config-path matching to explicit watches; retain its readiness and native-path requirements. | Callback ordering, disposal, explicit paths and `root: []` under the old Core; one Include refresh per change under either provider. Preserve profile watching and both module-replacement algorithms. | -| 3 | Upgrade Timer to 1.1.4, retaining DSH locale resources and build metadata. | 0 | Retain V24 (display metadata); no logged runtime patch retired. | Concurrent interval reads, throttle cancellation and void return types; check callers using the old Core. | -| 4a | Upgrade Core to rc.11 with the minimum Loader, Include and HMR compatibility slice described below. | 1 | Retire V12 (activation observer), V21 (logger disposer) and, after canonical-fiber audits, V20 (Entry identity workaround). Partial V6 (lifecycle) and V15 (config model). Retain/adapt V22 and V23 (module namespace). | Config resolution, volatile identity, service isolation, dependent-before-provider teardown, retained effect regressions and application startup. | -| 4b | Import Loader's project-relative bare-specifier resolver, runtime API detection and fallback when Node internals are absent. | 0 | Retire V19: upstream now detects the internal loader by its available APIs. | Resolve in the config project's package scope, retain subpaths, handle read-only helper creation and test Node 24's older v1 API. | -| 4c | Complete Loader's `EntryChange` / `commit(change)` reporting and remaining changes, and upgrade Include to its 1.1.1 journal implementation in the same PR. Both HMR providers keep finding Include through their existing scans; keep `applyEntryPatches` and `entryListSchema` exports and in-memory no-op commits. | 4a, 4b | Retire V18 (`disabled` expressions), V8 (old refresh implementation) and V13 (`writeTask` type). Partial V11: retire the duplicate patch algorithm and insert-index fix; retain public exports. Partial V14: replace the write queue; retain rejection while the journal contains unsaved changes. Retain/adapt V22, including the schema receiver fix, V23 and the V15 child-expression marker. | Create, move, remove and self-update reports; no false self-disposal writes; later patches address inserted rows; stable ids for anonymous entries; file/runtime conflict handling, patch-owned writes, shutdown results and nested expressions; cloning and config dumps agree with mounting. | -| 4e | Complete vendor HMR's upgrade to 1.1.1, preserving required local path, readiness and explicit-watch behavior. | 2, 3, 4a | Partial V9: adopt upstream ordering and path handling where equivalent; retain explicit readiness and realpath gaps. Retain V1 (no YAML locale imports). | Three-stage module replacement, nested entries, disabled/removed entries, explicit watches and the existing local path cases. | -| 4f | Register the journal Include through the explicit watch adopted in PR 2 and remove the remaining Include scans. | 2, 4c | Adapt V9's config-path matching to the journal Include. | One coordinated refresh per change under either HMR provider; profile watching unchanged. | - -Shared integration differences remain in every affected sync: V2 (manifests), V3 (TypeScript projects), V4/V10 (imports and Node-compatible modules), V5 (build overrides), V7 (API documentation), V16 (published Core source) and V17 (scope). Untouched packages retain them without edits. V6 only loses the stale-epoch guard already supplied upstream; its remaining ownership and cleanup guarantees stay. V15 replaces the old raw/effective-config and event implementation, but the Include child-expression behavior remains local. V22 is not upstreamed by this release, including its schema-bound `simplify` call. - -After PR 0, PRs 1, 2, 3 and 4b have no implementation dependency on one another. Core depends on configuration preparation; it does not depend on Timer. Loader completion and vendor HMR can proceed independently after Core. Include journal adoption is part of Loader completion; PR 4f only connects that Include to PR 2's explicit watches and does not depend on the new vendor HMR replacement algorithm, so PRs 4e and 4f can merge in either order. No single GitHub stack should impose a dependency between unrelated branches. Shared files such as the vendor manifest may still require merge-conflict resolution. - -### Minimum Core compatibility slice - -PR 4a must migrate every caller of the changed Core APIs in the same PR, including callers outside vendor. This is a complete Core upgrade with local patches, paired with selected Loader changes; it is not a claim that Loader already equals 1.0.0-rc.8. - -- Adopt upstream raw `Fiber.config`, `internal/config(fiber, next)`, `internal/commit` and the new `internal/update` arguments and awaited result. Update the config accessors, provider hooks, boot observers and old Include's update listener together. The temporary commit listener writes through the old tree writer until PR 4c. -- Carry the required Loader entry/context awaiting chain, activation-failure observer and isolation changes with Core's `Impl.ctx`, `Impl.isolate`, `committed` and dependent tracking. Update direct implementation readers such as the preset registry. Include Group behavior owned by `vendor/loader/src/config/group.ts`; do not confuse it with the unchanged `vendor/group` entry package. Before retiring V20, ensure volatile updates and every other direct lifecycle-field access use the canonical `fiber.ctx.fiber`. -- Keep Include's nested-entry expressions literal until the owning child resolves them. Keep the namespace field needed by DSH HMR and preserve active volatile references through the agreed config mechanism. Update raw-config access in both HMR implementations without replacing the DSH module-replacement policy. -- Reapply the still-needed effect ownership, reentrant disposal and observer-containment guarantees to the new Core lifecycle. Remove patches already supplied by the imported Core source. Verify the combination with provider/dependent teardown before treating the compatibility slice as complete. - -Module resolution, structured tree-change reporting, journal reconciliation and the new vendor HMR algorithm are not prerequisites for these Core interfaces. Their PRs remain separate unless executable compatibility tests expose an additional dependency; amend this plan before broadening a PR silently. - -### Temporary compatibility code - -PR 4c changes tree mutation producers to `commit(change)` and adopts the journal Include in the same PR: upstream `patch.ts` clones file and inserted entries, while the old Include relied on sharing entry objects with the running tree for its cached data and generated ids. In-memory trees, including `PresetTree`, implement a no-op commit. Until PR 4f, both HMR providers find the journal Include through their existing scans and call its `refresh()`. - -The public patch export may remain an alias; it must not retain a second algorithm. Every temporary divergence has an owning introduction PR and a named removal PR. No runtime version detection or second Core event protocol is planned. - -PR 2 moves Include refresh ownership in one step: both HMR providers expose `watch()`, the existing Include registers its callback, and both providers stop their equivalent Include scans. The upstream HMR source no longer performs that scan, so importing it before migrating the Include consumer would lose config refresh. Moving the complete watch concern first avoids a temporary scan adapter and makes the later module-replacement and persistence decisions independent. - -### Decisions owned by individual PRs - -| Decision | Owning PR | Proposal and unresolved choice | -|---|---|---| -| Active effective config | 1, 4a | Store or expose the object actually supplied to the current instance. Resolving a candidate through `internal/config` must not overwrite it. Decide the publication point and invalidation rules before switching Core; a WeakMap alone does not establish those rules. | -| Persistence outcome | 4c | Use the journal's retry and reconciliation mechanism. Explicit `flush()` and `stop()` reject while changes remain unsaved; later successful retries clear previous errors. Keep this local adaptation minimal. | -| Nested config interpolation | 4a, 4c | Preserve child-owned expression evaluation. Keep the existing Include marker initially; any refinement that permits interpolation of Include's own fields while excluding child lists is a separate behavior change. | -| HMR replacement failure | 4e | Adopt upstream behavior for vendor HMR. Preserve DSH HMR's current source-reload rollback policy in this series; replacing that policy requires its own proposal and tests. | -| Effect cleanup guarantees | 4a | Retain guarantees not supplied by rc.11. Further upstreaming or retirement is separate work, not a prerequisite for reaching the release baseline. | - -## Acceptance criteria - -- Every implementation PR leaves supported applications usable and passes checks appropriate to its changes. A later PR may not be required to repair an earlier PR's startup, types, persistence or teardown. -- Each source-vendor update follows the [sync procedure](README.md#sync-procedure), including `pnpm run test` and `pnpm run build`, and updates its own manifest, local-modification log, affected documentation and generated references. The [pre-push workflow](../.agents/skills/dsh-pre-push-checks/SKILL.md) selects additional focused checks. Documentation freshness is not deferred to a final cleanup PR. -- Every changed behavior has an explicit decision and focused regression coverage. Tests for an intentionally superseded behavior change with its implementation and explain the new expectation. -- Once all implementation PRs are complete, Core, Loader, Include, vendor HMR and Timer use their selected rc.11-tag sources with enumerated remaining patches. Group, logger-console, Cosmokit and Schemastery keep their existing pins. All temporary writer and config adapters have been removed or reduced to the agreed permanent accessors. -- Final integration verification exercises settings and volatile updates, profile recomposition, both HMR providers, Include persistence and representative built application launches. This is an acceptance checkpoint, not an otherwise empty PR. - -## Risks - -PR 4a remains the largest necessary compatibility change: Core's service lifetime and configuration model cross repository package boundaries. The minimum slice is based on source inspection, not a completed migration experiment. Focused tests may identify additional inseparable changes. - -Intermediate Loader, Include and HMR copies intentionally combine an old baseline with documented upstream slices. Missing slice records would make a later sync unsafe. Deferred config, candidate validation, journal writes and asynchronous disposal must be tested in combination rather than inferred from independently passing unit cases. A new Include's type dependency on HMR must not force both concrete providers into the same incompatible `Context.hmr` declaration. From 0dd0bd18cdb3b81e023e9764dd04abaf14492cf9 Mon Sep 17 00:00:00 2001 From: Shigma Date: Thu, 5 Nov 2026 16:26:40 +0800 Subject: [PATCH 2/3] refactor(cordis): route Include-dialect YAML through Include exports --- apps/cli/tests/built-bin.e2e.ts | 5 +-- .../tests/dump-config-schema.expected.e2e.ts | 5 +-- .../tests/lazy-search-startup.compat.spec.ts | 12 ++--- apps/cli/tests/windows-shell.spec.ts | 5 +-- apps/web/tests/client-ui-stats-panel.e2e.ts | 5 +-- apps/web/tests/scaffold.ts | 5 +-- apps/web/tests/schedule-after.e2e.ts | 7 ++- apps/web/tests/settings-import.e2e.ts | 5 +-- docs/event-producer-consumer.md | 2 +- docs/event-producer-consumer.zh.md | 2 +- packages/boot/app-boot/package.json | 2 - .../app-boot/src/compatibility-preflight.ts | 5 +-- .../app-boot/src/config-schema/collect.ts | 8 ++-- packages/boot/app-boot/src/index.ts | 16 ++----- .../tests/compatibility-preflight.spec.ts | 5 +-- .../boot/app-boot/tests/config-dump.spec.ts | 9 ++-- packages/boot/config-editor/package.json | 4 +- packages/boot/config-editor/src/index.ts | 5 +-- packages/bundle/acp-app/tests/acp-app.spec.ts | 8 +--- packages/bundle/base/tests/base.spec.ts | 13 ++---- packages/bundle/sdk-app/tests/sdk-app.spec.ts | 8 +--- .../sdk-minimal/tests/sdk-minimal.spec.ts | 8 +--- packages/experimental/cua-bundle/package.json | 1 - .../cua-bundle/tests/platform.spec.ts | 7 +-- .../inspector-profile/package.json | 3 +- .../inspector-profile/tests/profile.spec.ts | 7 +-- .../personalized-recommendations/package.json | 1 - .../tests/bundle.spec.ts | 11 ++--- .../webworker-packer/package.json | 2 - .../experimental/webworker-packer/src/pack.ts | 7 ++- .../tests/profile-image.spec.ts | 5 +-- .../preset/agent-preset-registry/package.json | 6 +-- .../preset/agent-preset-registry/src/index.ts | 5 +-- packages/preset/agent-preset/package.json | 4 +- .../preset/agent-preset/tests/skills.spec.ts | 5 +-- .../settings/tests/profile-composition.ts | 7 ++- .../test-support/client-runtime/package.json | 2 - .../src/assembly/bundle-roster.ts | 7 ++- .../session-snapshot/src/launcher.ts | 7 ++- pnpm-lock.yaml | 45 ------------------- scripts/cordis-entry-yaml.spec.ts | 39 ++++++++++++++++ scripts/cordis-yaml.ts | 14 +----- vendor/README.md | 2 +- vendor/include/README.md | 2 +- vendor/include/src/index.ts | 44 ++++++++++++++++-- 45 files changed, 161 insertions(+), 216 deletions(-) create mode 100644 scripts/cordis-entry-yaml.spec.ts diff --git a/apps/cli/tests/built-bin.e2e.ts b/apps/cli/tests/built-bin.e2e.ts index 1c8765d268..acb6e4ab37 100644 --- a/apps/cli/tests/built-bin.e2e.ts +++ b/apps/cli/tests/built-bin.e2e.ts @@ -13,9 +13,8 @@ import { } from '@agentclientprotocol/sdk' import { withFileLock, writeFileAtomic } from '@deepseek-ai/dsh-atomic-write' import { startMockLlmServer } from '@deepseek-ai/dsh-llm-mock-server' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { execa } from 'execa' -import * as yaml from 'js-yaml' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { testProfileResolution } from './profiles/headless/tests/profile-resolution.ts' @@ -1259,7 +1258,7 @@ describe.skipIf(!existsSync(dshBin))('dsh BUILT bin (node lib/bin.js, no tsx)', ) expect(code).toBe(0) expect(stderr).toBe('') - const rows = yaml.load(stdout, { schema: entryListSchema }) as Array<{ id?: string; name?: string }> + const rows = parseEntryYaml(stdout) as Array<{ id?: string; name?: string }> expect(rows.map(row => [row.id, row.name])).toEqual([ ['sdk-app-startup', '@deepseek-ai/dsh-sdk-app'], ['sdk-jsonrpc-server', '@deepseek-ai/dsh-sdk-jsonrpc-server'], diff --git a/apps/cli/tests/dump-config-schema.expected.e2e.ts b/apps/cli/tests/dump-config-schema.expected.e2e.ts index d481c9bd2a..b6472adabb 100644 --- a/apps/cli/tests/dump-config-schema.expected.e2e.ts +++ b/apps/cli/tests/dump-config-schema.expected.e2e.ts @@ -3,8 +3,7 @@ import { existsSync, mkdtempSync, realpathSync } from 'node:fs' import { copyFile, mkdir, readFile, rm, writeFile } from 'node:fs/promises' import { Ajv2020 } from 'ajv/dist/2020.js' -import * as yaml from 'js-yaml' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import type { ConfigSchemaDump } from '@deepseek-ai/dsh-app-boot' import { tmpdir } from 'node:os' import { join } from 'node:path' @@ -162,7 +161,7 @@ describe.skipIf(!builtArtifactsExist)('dsh --dump-config-schema assembled output const composed = await dump(fixture, [], '--dump-config') const validator = new Ajv2020({ strict: false, validateFormats: false }) const validate = validator.compile(document) - expect(validate(yaml.load(composed.stdout, { schema: entryListSchema })), JSON.stringify(validate.errors)).toBe(true) + expect(validate(parseEntryYaml(composed.stdout)), JSON.stringify(validate.errors)).toBe(true) expect(validate([{ name: `${packageName}/namespace`, config: { attempts: 'wrong' } }])).toBe(false) const patch = validator.compile({ $schema: document.$schema, $defs: document.$defs, $ref: '#/$defs/patchList' }) expect(patch([{ id: 'schema-class', config: { enabled: 'wrong' } }])).toBe(false) diff --git a/apps/cli/tests/lazy-search-startup.compat.spec.ts b/apps/cli/tests/lazy-search-startup.compat.spec.ts index dfb92dc340..ed1efb0a16 100644 --- a/apps/cli/tests/lazy-search-startup.compat.spec.ts +++ b/apps/cli/tests/lazy-search-startup.compat.spec.ts @@ -15,7 +15,7 @@ import { mkdtemp, readFile, rm } from 'node:fs/promises' import { tmpdir } from 'node:os' import { join, resolve } from 'node:path' import { fileURLToPath } from 'node:url' -import yaml from 'js-yaml' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { describe, expect, it } from 'vitest' const repoRoot = fileURLToPath(new URL('../../../', import.meta.url)) @@ -37,12 +37,6 @@ interface PatchEntry extends ConfigRow { insert?: ConfigRow[] } -const jsExprType = new yaml.Type('tag:yaml.org,2002:js', { - kind: 'scalar', - construct: value => String(value), -}) -const configSchema = yaml.JSON_SCHEMA.extend(jsExprType) - /** Boot the built Web CLI, wait for its settled URL, then dispose through SIGTERM. */ function runBuiltWeb(cwd: string): Promise<{ stdout: string; stderr: string; code: number }> { return new Promise((resolveRun, rejectRun) => { @@ -103,9 +97,9 @@ describe.skipIf(!requireBuiltArtifacts)('built CLI lazy-search startup', () => { it('boots and disposes the shipped composition with full-text search off by default', async () => { expect(existsSync(builtBin), `missing built CLI ${resolve(builtBin)}; run pnpm build`).toBe(true) expect(existsSync(webDist), `missing Web dist ${resolve(webDist)}; run pnpm run build:web`).toBe(true) - const baseRows = (yaml.load(await readFile(baseConfigPath, 'utf8'), { schema: configSchema }) as PatchEntry[]) + const baseRows = (parseEntryYaml(await readFile(baseConfigPath, 'utf8')) as PatchEntry[]) .flatMap(entry => entry.insert ?? [entry]) - const webRows = (yaml.load(await readFile(webConfigPath, 'utf8'), { schema: configSchema }) as PatchEntry[]) + const webRows = (parseEntryYaml(await readFile(webConfigPath, 'utf8')) as PatchEntry[]) .flatMap(entry => entry.insert ?? [entry]) const baseRow = baseRows.find(row => row.id === 'session-query-sqlite') const webRow = webRows.find(row => row.id === 'session-query-sqlite') diff --git a/apps/cli/tests/windows-shell.spec.ts b/apps/cli/tests/windows-shell.spec.ts index c10f7c869a..858080ef42 100644 --- a/apps/cli/tests/windows-shell.spec.ts +++ b/apps/cli/tests/windows-shell.spec.ts @@ -15,8 +15,7 @@ import { mkdtempSync, rmSync, readFileSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { fileURLToPath } from 'node:url' -import yaml from 'js-yaml' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { evaluate } from '@deepseek-ai/cordis-plugin-loader' import { bundlePatchPaths, composeEntries, initProfile, loadProfile, PROFILES_DIR } from '@deepseek-ai/dsh-app-boot' @@ -104,7 +103,7 @@ describe('shipped agent presets gate both shell tools by platform', () => { const webBundle = fileURLToPath(new URL('../../../packages/bundle/web-app/', import.meta.url)) const webManifest = JSON.parse(readFileSync(join(webBundle, 'package.json'), 'utf8')) as { dsh: { bundle: { patch: string[] } } } const presetRows = composeEntries([bundlePatchPaths(webBundle, webManifest.dsh.bundle).flatMap(file => - yaml.load(readFileSync(file, 'utf8'), { schema: entryListSchema }) as import('@deepseek-ai/cordis-plugin-include').PatchOptions[])]) + parseEntryYaml(readFileSync(file, 'utf8')) as import('@deepseek-ai/cordis-plugin-include').PatchOptions[])]) const definitions = presetRows.filter(row => row.name === '@deepseek-ai/dsh-agent-preset').map(row => row.config as import('@deepseek-ai/dsh-agent-preset-registry').PresetDefinition) diff --git a/apps/web/tests/client-ui-stats-panel.e2e.ts b/apps/web/tests/client-ui-stats-panel.e2e.ts index fc0a51b3b5..5ea9061afb 100644 --- a/apps/web/tests/client-ui-stats-panel.e2e.ts +++ b/apps/web/tests/client-ui-stats-panel.e2e.ts @@ -7,8 +7,7 @@ import { readFileSync } from 'node:fs' import type { Browser, Page } from 'playwright' import { chromium } from 'playwright' import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest' -import * as yaml from 'js-yaml' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { createAssistantMessage, createMessage, createUserMessage, ToolCallId, type AssistantStreamRecord, type TokenUsage, @@ -31,7 +30,7 @@ const MODE = webSnapshotMode() /** Overlay layer entries, for the composition guard below. */ function profileEntries(path: string): unknown[] { - const parsed = yaml.load(readFileSync(path, 'utf8'), { schema: entryListSchema }) + const parsed = parseEntryYaml(readFileSync(path, 'utf8')) if (!Array.isArray(parsed)) throw new Error(`profile layer at ${path} must be a list`) return parsed } diff --git a/apps/web/tests/scaffold.ts b/apps/web/tests/scaffold.ts index 2b173325e4..55ae66f480 100644 --- a/apps/web/tests/scaffold.ts +++ b/apps/web/tests/scaffold.ts @@ -33,8 +33,7 @@ import { expect } from 'vitest' import { Context } from '@deepseek-ai/cordis' import { DSH_LAUNCH_ENVIRONMENT_KEY, type LaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment' import Loader from '@deepseek-ai/cordis-plugin-loader' -import { entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' -import yaml from 'js-yaml' +import { stringifyEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' import { captureExpectedWorkspaceSnapshot, captureWorkspaceSnapshot, @@ -807,7 +806,7 @@ export async function launchWebScaffold(options: LaunchOptions = {}): Promise { ? { ...plugin, config: { refreshIntervalMs: 0 } } : plugin) const path = join(dir, 'time-context-every-step.patch.yml') - await writeFile(path, dump([ + await writeFile(path, stringifyEntryYaml([ { id: 'preset-standard', config: { ...config, plugins } }, - ], { schema: entryListSchema, noRefs: true, lineWidth: -1 })) + ], { lineWidth: -1 })) return path } diff --git a/apps/web/tests/settings-import.e2e.ts b/apps/web/tests/settings-import.e2e.ts index 44a14f0ac0..8b26362942 100644 --- a/apps/web/tests/settings-import.e2e.ts +++ b/apps/web/tests/settings-import.e2e.ts @@ -5,8 +5,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { chromium } from 'playwright' import { expect, it } from 'vitest' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' -import yaml from 'js-yaml' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { WELCOME_NOTICE_VERSION, launchWebScaffold, watchConsole } from './scaffold.ts' import { ZH_BROWSER_LOCALE } from './support.ts' @@ -24,7 +23,7 @@ it('imports settings.yaml into the profile once and applies the imported values' const patchPath = join(harnessHome, 'profiles', 'scaffold', 'cordis.patch.yml') type Row = { id?: string; config?: Record } const config = (id: string): Record | undefined => - (yaml.load(readFileSync(patchPath, 'utf8'), { schema: entryListSchema }) as Row[]).find(row => row.id === id)?.config + (parseEntryYaml(readFileSync(patchPath, 'utf8')) as Row[]).find(row => row.id === id)?.config await expect.poll(() => config('ui-theme')?.['fontSize'], { timeout: 10_000 }).toBe(16) expect(config('ui-settings')?.['enabled']).toBe(false) expect(config('ui-settings-general')?.['welcomeNoticeVersion']).toBe(WELCOME_NOTICE_VERSION) diff --git a/docs/event-producer-consumer.md b/docs/event-producer-consumer.md index c93e55bed5..453fadc682 100644 --- a/docs/event-producer-consumer.md +++ b/docs/event-producer-consumer.md @@ -28,7 +28,7 @@ Application listeners are outside this package matrix. Desktop Host subscribes t | `api-session/error` | `emit` | [`packages/api/session-controller/src/types.ts:708`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` | | `api-session/removed` | `emit` | [`packages/api/session-controller/src/types.ts:687`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` | | `api-session/status` | `emit` | [`packages/api/session-controller/src/types.ts:694`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` | -| `app-boot/config-reload` | `emit` | [`packages/boot/app-boot/src/index.ts:55`](../packages/boot/app-boot/src/index.ts) | [`app-boot`](../packages/boot/app-boot) (`emit`) | [`settings`](../packages/settings/settings) | +| `app-boot/config-reload` | `emit` | [`packages/boot/app-boot/src/index.ts:54`](../packages/boot/app-boot/src/index.ts) | [`app-boot`](../packages/boot/app-boot) (`emit`) | [`settings`](../packages/settings/settings) | | `approval/request` | `waterfall` | [`packages/interaction/user-approval/src/types.ts:87`](../packages/interaction/user-approval/src/types.ts) | [`user-approval`](../packages/interaction/user-approval) (`waterfall`) | [`acp`](../packages/acp/acp), `remotes`, `server` | | `authorization/settled` | `emit` | [`packages/credentials/authorization/src/index.ts:57`](../packages/credentials/authorization/src/index.ts) | [`authorization`](../packages/credentials/authorization) (`events.dispatch`) | - | | `commands/change` | `emit` | [`packages/interaction/commands/src/types.ts:89`](../packages/interaction/commands/src/types.ts) | [`commands`](../packages/interaction/commands) (`events.dispatch`) | `remotes` | diff --git a/docs/event-producer-consumer.zh.md b/docs/event-producer-consumer.zh.md index 4a3a34876b..081292be53 100644 --- a/docs/event-producer-consumer.zh.md +++ b/docs/event-producer-consumer.zh.md @@ -30,7 +30,7 @@ | `api-session/error` | `emit` | [`packages/api/session-controller/src/types.ts:708`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` | | `api-session/removed` | `emit` | [`packages/api/session-controller/src/types.ts:687`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` | | `api-session/status` | `emit` | [`packages/api/session-controller/src/types.ts:694`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` | -| `app-boot/config-reload` | `emit` | [`packages/boot/app-boot/src/index.ts:55`](../packages/boot/app-boot/src/index.ts) | [`app-boot`](../packages/boot/app-boot) (`emit`) | [`settings`](../packages/settings/settings) | +| `app-boot/config-reload` | `emit` | [`packages/boot/app-boot/src/index.ts:54`](../packages/boot/app-boot/src/index.ts) | [`app-boot`](../packages/boot/app-boot) (`emit`) | [`settings`](../packages/settings/settings) | | `approval/request` | `waterfall` | [`packages/interaction/user-approval/src/types.ts:87`](../packages/interaction/user-approval/src/types.ts) | [`user-approval`](../packages/interaction/user-approval) (`waterfall`) | [`acp`](../packages/acp/acp), `remotes`, `server` | | `authorization/settled` | `emit` | [`packages/credentials/authorization/src/index.ts:57`](../packages/credentials/authorization/src/index.ts) | [`authorization`](../packages/credentials/authorization) (`events.dispatch`) | - | | `commands/change` | `emit` | [`packages/interaction/commands/src/types.ts:89`](../packages/interaction/commands/src/types.ts) | [`commands`](../packages/interaction/commands) (`events.dispatch`) | `remotes` | diff --git a/packages/boot/app-boot/package.json b/packages/boot/app-boot/package.json index 6bcc5fa3d2..bebd0e315e 100644 --- a/packages/boot/app-boot/package.json +++ b/packages/boot/app-boot/package.json @@ -37,7 +37,6 @@ "@deepseek-ai/dsh-package-manifest": "workspace:*", "@eslint-community/regexpp": "^4.12.2", "ajv": "^8.20.0", - "js-yaml": "^4.3.2", "node-addon-require-builtin": "^0.1.9", "resolve.exports": "^2.0.3", "semver": "^7.8.5" @@ -59,7 +58,6 @@ "@deepseek-ai/dsh-launch-environment": "workspace:*", "@deepseek-ai/dsh-home-paths": "workspace:*", "@deepseek-ai/dsh-system-prompt": "workspace:*", - "@types/js-yaml": "^4.0.9", "@types/semver": "^7.8.0", "@deepseek-ai/cordis": "workspace:~" } diff --git a/packages/boot/app-boot/src/compatibility-preflight.ts b/packages/boot/app-boot/src/compatibility-preflight.ts index ae10be63e1..c8aeedf2ad 100644 --- a/packages/boot/app-boot/src/compatibility-preflight.ts +++ b/packages/boot/app-boot/src/compatibility-preflight.ts @@ -5,8 +5,7 @@ import { dirname, extname, isAbsolute, join } from 'node:path' import { fileURLToPath, pathToFileURL } from 'node:url' import type { Context } from '@deepseek-ai/cordis' import type { EntryOptions } from '@deepseek-ai/cordis-plugin-loader' -import { applyEntryPatches, entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' -import { load } from 'js-yaml' +import { applyEntryPatches, parseEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' import { resolvePluginResource } from './package-meta.ts' import { barePackageName } from './profile-resolution/resolver.ts' import type {} from './profile-resolution/service.ts' @@ -151,7 +150,7 @@ function preflight( includes.add(filename) try { let data: unknown - try { data = load(readFileSync(filename, 'utf8'), { schema: entryListSchema }) } + try { data = parseEntryYaml(readFileSync(filename, 'utf8')) } catch (error) { if ((error as NodeJS.ErrnoException).code !== 'ENOENT' || config.initial === undefined) return undefined data = config.initial diff --git a/packages/boot/app-boot/src/config-schema/collect.ts b/packages/boot/app-boot/src/config-schema/collect.ts index 4bd1e7a40b..ab18fc035c 100644 --- a/packages/boot/app-boot/src/config-schema/collect.ts +++ b/packages/boot/app-boot/src/config-schema/collect.ts @@ -3,10 +3,9 @@ import { readFile, realpath } from 'node:fs/promises' import { extname, join } from 'node:path' import { fileURLToPath, pathToFileURL } from 'node:url' -import * as yaml from 'js-yaml' import Loader, { EntryGroup, ModuleLoader, isJsExpr, type EntryOptions } from '@deepseek-ai/cordis-plugin-loader' import Group from '@deepseek-ai/cordis-plugin-group' -import Include, { applyEntryPatches, entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' +import Include, { applyEntryPatches, entryYamlErrorPosition, parseEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' import type { Profile, RuntimeResolution } from '../profile.ts' import { installRuntimeInterception } from '../profile-resolution/resolver.ts' import { buildConfigSchemaDocument } from './document.ts' @@ -148,10 +147,11 @@ export async function collectConfigSchemas( } if (content !== undefined) { try { - source = extension === '.json' ? JSON.parse(content) : yaml.load(content, { schema: entryListSchema }) + source = extension === '.json' ? JSON.parse(content) : parseEntryYaml(content) } catch (error) { // Parser messages can quote configuration values; retain only the file and location. - const at = error instanceof yaml.YAMLException ? ` at line ${error.mark.line + 1}, column ${error.mark.column + 1}` : '' + const position = extension === '.json' ? undefined : entryYamlErrorPosition(error) + const at = position === undefined ? '' : ` at line ${position.line}, column ${position.column}` throw new Error(`invalid ${extension === '.json' ? 'JSON' : 'YAML'} include ${filename}${at}`) } } diff --git a/packages/boot/app-boot/src/index.ts b/packages/boot/app-boot/src/index.ts index daf1406a43..f8f63ff8c5 100644 --- a/packages/boot/app-boot/src/index.ts +++ b/packages/boot/app-boot/src/index.ts @@ -12,10 +12,9 @@ import { inspect, parseEnv } from 'node:util' import { captureStartupComposition, type StartupCompositionDiagnostic } from './startup-diagnostics.ts' export type { StartupCompositionDiagnostic, StartupPluginState, StartupServiceState } from './startup-diagnostics.ts' import { basename, dirname, isAbsolute, resolve } from 'node:path' -import * as yaml from 'js-yaml' import { Context, type Fiber, type FiberState } from '@deepseek-ai/cordis' import Loader, { type Entry, type EntryGroup, type EntryOptions } from '@deepseek-ai/cordis-plugin-loader' -import Include, { applyEntryPatches, entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' +import Include, { applyEntryPatches, parseEntryYaml, stringifyEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' import Group from '@deepseek-ai/cordis-plugin-group' import { dshHomePath, resolveDshHome } from '@deepseek-ai/dsh-home-paths' import { createLaunchEnvironmentSnapshot, type LaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment' @@ -258,13 +257,6 @@ export function loadLayeredEnv( const bootstrapIncludes = new WeakMap() -// The include's YAML dialect (`!!js` scalars become expression nodes the -// Loader interpolates against each entry's injection-ready context), imported -// from the include itself so patch parsing and config dumping can never drift -// from what the include mounts. User patch layers share it so they may -// reference `process.env`. -const userPatchesSchema = entryListSchema - /** What a caller of {@link recomposeProfile} already did and requires. */ export interface ProfileRecompositionOptions { /** Explicit enablement targets whose existing failures also reject the recomposition. */ @@ -573,7 +565,7 @@ function parsePatchList( ): PatchOptions[] { let parsed: unknown try { - parsed = yaml.load(content, { schema: userPatchesSchema }) + parsed = parseEntryYaml(content) } catch (error) { throw new Error(`${binName}: failed to parse ${label} ${file}: ${String(error)}`) } @@ -642,7 +634,7 @@ export function renderConfigDump( } let parsed: unknown try { - parsed = yaml.load(content, { schema: entryListSchema }) + parsed = parseEntryYaml(content) } catch (error) { throw new Error(`${binName}: failed to parse config ${absoluteConfigPath}: ${String(error)}`) } @@ -703,7 +695,7 @@ function groupedDump( const flush = (): void => { if (currentLabel === undefined || group.length === 0) return lines.push(`# == ${currentLabel}`) - lines.push(yaml.dump(group, { schema: entryListSchema, noRefs: true }).trimEnd()) + lines.push(stringifyEntryYaml(group).trimEnd()) group = [] } for (let index = 0; index < composed.length; index += 1) { diff --git a/packages/boot/app-boot/tests/compatibility-preflight.spec.ts b/packages/boot/app-boot/tests/compatibility-preflight.spec.ts index e753fa5b4d..0fcf850d56 100644 --- a/packages/boot/app-boot/tests/compatibility-preflight.spec.ts +++ b/packages/boot/app-boot/tests/compatibility-preflight.spec.ts @@ -4,9 +4,8 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { pathToFileURL } from 'node:url' import { Context } from '@deepseek-ai/cordis' -import { entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' import type { EntryOptions } from '@deepseek-ai/cordis-plugin-loader' -import { load } from 'js-yaml' import { describe, expect, it, onTestFinished, vi } from 'vitest' import { PROFILE_COMPATIBILITY_FILENAME, PluginPackages, boot, getDshRuntimeVersion, @@ -358,7 +357,7 @@ it('reuses the documented literal Include dialect when reading included entries' f.plugin('allowed-plugin') const list = join(f.dir, 'nested.cordis.yml') writeFileSync(list, '- id: nested\n name: allowed-plugin\n') - expect(load(readFileSync(list, 'utf8'), { schema: entryListSchema })).toEqual([{ id: 'nested', name: 'allowed-plugin' }]) + expect(parseEntryYaml(readFileSync(list, 'utf8'))).toEqual([{ id: 'nested', name: 'allowed-plugin' }]) // The launcher mounts an Include with a file URL, which a Windows path cannot stand in for: `C:` reads as a scheme. expect(await f.run([{ insert: [{ id: 'outer', name: 'cordis:include', config: { path: pathToFileURL(list).href } }] }])) .toEqual(['import:allowed-plugin', 'apply:allowed-plugin']) diff --git a/packages/boot/app-boot/tests/config-dump.spec.ts b/packages/boot/app-boot/tests/config-dump.spec.ts index 6703df20e0..8a56d57e34 100644 --- a/packages/boot/app-boot/tests/config-dump.spec.ts +++ b/packages/boot/app-boot/tests/config-dump.spec.ts @@ -12,8 +12,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { pathToFileURL } from 'node:url' import { afterAll, describe, expect, it, vi } from 'vitest' -import * as yaml from 'js-yaml' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { loadOverlayPatches, renderConfigDump } from '../src/index.ts' const NAME = 'dsh-test-bin' @@ -73,7 +72,7 @@ describe('renderConfigDump', () => { ], () => {}) // Comments do not break loadability: the dump parses as one document // equal to what boot() would mount. - const parsed = yaml.load(dump, { schema: entryListSchema }) as { + const parsed = parseEntryYaml(dump) as { id: string config?: Record }[] @@ -140,7 +139,7 @@ describe('renderConfigDump', () => { { label: 'b.yml', patches: [{ id: 'child', config: { v: 2 } }] }, ], line => void warnings.push(line)) expect(warnings).toEqual([`${NAME}: [b.yml] patch: entry "child" not found`]) - const parsed = yaml.load(dump, { schema: entryListSchema }) as { + const parsed = parseEntryYaml(dump) as { config?: { config?: { v?: number } }[] }[] expect(parsed[0]?.config?.[0]?.config?.v).toBe(1) @@ -169,7 +168,7 @@ describe('renderConfigDump', () => { line => void warnings.push(line), ) expect(warnings).toEqual([`${NAME}: [overlay.yml] patch: entry "only-on-another-surface" not found`]) - const parsed = yaml.load(dump, { schema: entryListSchema }) as { config?: { value?: string } }[] + const parsed = parseEntryYaml(dump) as { config?: { value?: string } }[] expect(parsed[0]?.config?.value).toBe('patched') }) diff --git a/packages/boot/config-editor/package.json b/packages/boot/config-editor/package.json index 783ce890db..be5241adb0 100644 --- a/packages/boot/config-editor/package.json +++ b/packages/boot/config-editor/package.json @@ -37,15 +37,13 @@ }, "dependencies": { "@deepseek-ai/dsh-atomic-write": "workspace:*", - "yaml": "^2.8.1", - "js-yaml": "^4.3.2" + "yaml": "^2.8.1" }, "devDependencies": { "@deepseek-ai/cordis": "workspace:~", "@deepseek-ai/cordis-plugin-loader": "workspace:~", "@deepseek-ai/dsh-hmr": "workspace:*", "@deepseek-ai/cordis-plugin-include": "workspace:~", - "@types/js-yaml": "^4.0.9", "@deepseek-ai/dsh-app-boot": "workspace:*" }, "peerDependenciesMeta": { diff --git a/packages/boot/config-editor/src/index.ts b/packages/boot/config-editor/src/index.ts index 8fe686e478..a13541199c 100644 --- a/packages/boot/config-editor/src/index.ts +++ b/packages/boot/config-editor/src/index.ts @@ -3,8 +3,7 @@ import { readFile } from 'node:fs/promises' import { join } from 'node:path' import { isDeepStrictEqual } from 'node:util' import { Context, FiberState, Service } from '@deepseek-ai/cordis' -import { entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' -import yaml from 'js-yaml' +import { parseEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' import type { Entry, EntryOptions } from '@deepseek-ai/cordis-plugin-loader' import type {} from '@deepseek-ai/dsh-hmr' import { composeEntries, loadProfileDirectory, readProfilePatches, reconcileProfilePatches } from '@deepseek-ai/dsh-app-boot' @@ -133,7 +132,7 @@ export class ConfigEditor extends Service { } }) const profile = this.ownerContext.profileContext const loaded = loadProfileDirectory('dsh', profile.dir, profile.installAnchor) - const patches = readProfilePatches('dsh', profile, { ...loaded, patches: yaml.load(String(document), { schema: entryListSchema }) as PatchOptions[] }) + const patches = readProfilePatches('dsh', profile, { ...loaded, patches: parseEntryYaml(String(document)) as PatchOptions[] }) const effective = flatten(composeEntries([patches])).find(row => row.id === entry.options.id) if (!isDeepStrictEqual(effective?.config ?? {}, next)) { throw new Error(`Configuration for "${entry.options.id}" is overridden by a home patch or command-line overlay`) diff --git a/packages/bundle/acp-app/tests/acp-app.spec.ts b/packages/bundle/acp-app/tests/acp-app.spec.ts index 925c4e8044..2c176bd770 100644 --- a/packages/bundle/acp-app/tests/acp-app.spec.ts +++ b/packages/bundle/acp-app/tests/acp-app.spec.ts @@ -3,9 +3,8 @@ import { readFileSync } from 'node:fs' import { resolve } from 'node:path' import { fileURLToPath } from 'node:url' -import * as yaml from 'js-yaml' import { describe, expect, it } from 'vitest' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' describe('dsh-acp-app bundle', () => { it('declares startup-gated ACP serving without overriding base HMR policy', () => { @@ -16,10 +15,7 @@ describe('dsh-acp-app bundle', () => { } expect(manifest.dsh?.bundle?.patch).toBe('./cordis.patch.yml') expect(manifest.dependencies).toHaveProperty('@deepseek-ai/dsh-acp') - const patches = yaml.load( - readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'), - { schema: entryListSchema }, - ) as Array<{ + const patches = parseEntryYaml(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8')) as Array<{ id?: string disabled?: boolean insert?: Array<{ config?: { model?: string; provider?: string }; id?: string; inject?: string[]; name?: string }> diff --git a/packages/bundle/base/tests/base.spec.ts b/packages/bundle/base/tests/base.spec.ts index 4a9d5b5c54..fdd22df18c 100644 --- a/packages/bundle/base/tests/base.spec.ts +++ b/packages/bundle/base/tests/base.spec.ts @@ -7,8 +7,7 @@ import { existsSync, readFileSync } from 'node:fs' import { fileURLToPath } from 'node:url' import { resolve } from 'node:path' import { describe, expect, it } from 'vitest' -import * as yaml from 'js-yaml' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { evaluate } from '@deepseek-ai/cordis-plugin-loader' describe('dsh-base bundle', () => { @@ -21,10 +20,7 @@ describe('dsh-base bundle', () => { dsh?: { bundle?: { patch?: string } } } expect(manifest.dsh?.bundle?.patch).toBe('./cordis.patch.yml') - const parsed = yaml.load( - readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'), - { schema: entryListSchema }, - ) + const parsed = parseEntryYaml(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8')) expect(Array.isArray(parsed)).toBe(true) // The base layer is one insert list over the empty profile root. const rows = (parsed as { insert?: { id?: string; config?: Record; disabled?: boolean }[] }[]).flatMap( @@ -57,10 +53,7 @@ describe('dsh-base bundle', () => { it('gates each shell stack by platform with a symmetric disabled expression', () => { const root = fileURLToPath(new URL('..', import.meta.url)) - const parsed = yaml.load( - readFileSync(resolve(root, 'cordis.patch.yml'), 'utf8'), - { schema: entryListSchema }, - ) + const parsed = parseEntryYaml(readFileSync(resolve(root, 'cordis.patch.yml'), 'utf8')) if (!Array.isArray(parsed)) throw new TypeError('base patch must parse to a patch list') const rows = parsed.flatMap((patch): Record[] => typeof patch === 'object' && patch !== null diff --git a/packages/bundle/sdk-app/tests/sdk-app.spec.ts b/packages/bundle/sdk-app/tests/sdk-app.spec.ts index 6ab9bd10ff..286f6f0cbf 100644 --- a/packages/bundle/sdk-app/tests/sdk-app.spec.ts +++ b/packages/bundle/sdk-app/tests/sdk-app.spec.ts @@ -3,9 +3,8 @@ import { readFileSync } from 'node:fs' import { resolve } from 'node:path' import { fileURLToPath } from 'node:url' -import * as yaml from 'js-yaml' import { describe, expect, it } from 'vitest' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' describe('dsh-sdk-app bundle', () => { it('enables plugin management while keeping JSON-RPC dependencies stable until restart', () => { @@ -16,10 +15,7 @@ describe('dsh-sdk-app bundle', () => { } expect(manifest.dsh?.bundle?.patch).toBe('./cordis.patch.yml') expect(manifest.dependencies).toHaveProperty('@deepseek-ai/dsh-sdk-jsonrpc-server') - const patches = yaml.load( - readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'), - { schema: entryListSchema }, - ) as Array<{ id?: string; disabled?: boolean; insert?: Array<{ id?: string; inject?: string[]; name?: string }> }> + const patches = parseEntryYaml(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8')) as Array<{ id?: string; disabled?: boolean; insert?: Array<{ id?: string; inject?: string[]; name?: string }> }> expect(patches.find(patch => patch.id === 'hmr')).toMatchObject({ disabled: true }) expect(patches.find(patch => patch.id === 'tool-plugin-manager')).toMatchObject({ disabled: false }) expect(patches.find(patch => patch.id === 'session-title-llm')).toMatchObject({ disabled: true }) diff --git a/packages/bundle/sdk-minimal/tests/sdk-minimal.spec.ts b/packages/bundle/sdk-minimal/tests/sdk-minimal.spec.ts index 2a96ffc076..3357798d2e 100644 --- a/packages/bundle/sdk-minimal/tests/sdk-minimal.spec.ts +++ b/packages/bundle/sdk-minimal/tests/sdk-minimal.spec.ts @@ -3,9 +3,8 @@ import { readFileSync } from 'node:fs' import { resolve } from 'node:path' import { fileURLToPath } from 'node:url' -import * as yaml from 'js-yaml' import { describe, expect, it } from 'vitest' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' function packageName(specifier: string): string { return specifier.startsWith('@') ? specifier.split('/').slice(0, 2).join('/') : specifier.split('/')[0]! @@ -19,10 +18,7 @@ describe('dsh-sdk-minimal bundle', () => { dsh?: { bundle?: { patch?: string } } } expect(manifest.dsh?.bundle?.patch).toBe('./cordis.patch.yml') - const patches = yaml.load( - readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'), - { schema: entryListSchema }, - ) as Array<{ insert?: Array<{ id?: string; inject?: string[]; name?: string; config?: Record; disabled?: unknown }> }> + const patches = parseEntryYaml(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8')) as Array<{ insert?: Array<{ id?: string; inject?: string[]; name?: string; config?: Record; disabled?: unknown }> }> expect(patches).toHaveLength(1) const rows = patches[0]?.insert ?? [] expect(rows.map(row => [row.id, row.name])).toEqual([ diff --git a/packages/experimental/cua-bundle/package.json b/packages/experimental/cua-bundle/package.json index 93612c3ffc..cc7f8216f3 100644 --- a/packages/experimental/cua-bundle/package.json +++ b/packages/experimental/cua-bundle/package.json @@ -51,7 +51,6 @@ "devDependencies": { "@deepseek-ai/cordis": "workspace:~", "@deepseek-ai/cordis-plugin-include": "workspace:~", - "js-yaml": "^4.2.0", "@deepseek-ai/cordis-plugin-loader": "workspace:~" }, "optionalDependencies": { diff --git a/packages/experimental/cua-bundle/tests/platform.spec.ts b/packages/experimental/cua-bundle/tests/platform.spec.ts index 4230e4f406..6d10bc2252 100644 --- a/packages/experimental/cua-bundle/tests/platform.spec.ts +++ b/packages/experimental/cua-bundle/tests/platform.spec.ts @@ -2,14 +2,11 @@ import { readFile } from 'node:fs/promises' import { Context } from '@deepseek-ai/cordis' import Loader, { interpolate, type EntryOptions } from '@deepseek-ai/cordis-plugin-loader' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' -import { load } from 'js-yaml' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { expect, it, vi } from 'vitest' it.each(['darwin', 'win32', 'linux'])('loads the exported patch directly on %s and imports the native provider only on Darwin', async (platform) => { - const patch = load(await readFile(new URL('../cordis.patch.yml', import.meta.url), 'utf8'), { - schema: entryListSchema, - }) as { insert: EntryOptions[] }[] + const patch = parseEntryYaml(await readFile(new URL('../cordis.patch.yml', import.meta.url), 'utf8')) as { insert: EntryOptions[] }[] const ctx = new Context() await ctx.plugin(Loader) if (!ctx.loader.internal) throw new Error('Loader module importer is unavailable') diff --git a/packages/experimental/inspector-profile/package.json b/packages/experimental/inspector-profile/package.json index f5f40445dd..23df26e9c9 100644 --- a/packages/experimental/inspector-profile/package.json +++ b/packages/experimental/inspector-profile/package.json @@ -48,7 +48,6 @@ }, "devDependencies": { "@deepseek-ai/cordis": "workspace:~", - "@deepseek-ai/cordis-plugin-include": "workspace:~", - "js-yaml": "^4.3.2" + "@deepseek-ai/cordis-plugin-include": "workspace:~" } } diff --git a/packages/experimental/inspector-profile/tests/profile.spec.ts b/packages/experimental/inspector-profile/tests/profile.spec.ts index 7fcfa5813b..4992f2fb1c 100644 --- a/packages/experimental/inspector-profile/tests/profile.spec.ts +++ b/packages/experimental/inspector-profile/tests/profile.spec.ts @@ -2,8 +2,7 @@ import { readFileSync } from 'node:fs' import { describe, expect, it } from 'vitest' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' -import * as yaml from 'js-yaml' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' describe('Inspector profile bundle', () => { it('publishes one layer containing both inspectors and the Statistics view', () => { @@ -19,9 +18,7 @@ describe('Inspector profile bundle', () => { '@deepseek-ai/dsh-experimental-inspector': 'workspace:*', '@deepseek-ai/dsh-experimental-session-inspector': 'workspace:*', }) - expect(yaml.load(readFileSync(new URL(`../${manifest.dsh.bundle.patch}`, import.meta.url), 'utf8'), { - schema: entryListSchema, - })).toEqual([{ insert: [ + expect(parseEntryYaml(readFileSync(new URL(`../${manifest.dsh.bundle.patch}`, import.meta.url), 'utf8'))).toEqual([{ insert: [ { id: 'experimental-inspector', name: '@deepseek-ai/dsh-experimental-inspector', disabled: false, config: { captureFetch: true }, diff --git a/packages/experimental/personalized-recommendations/package.json b/packages/experimental/personalized-recommendations/package.json index b94017f26f..00be87ebfa 100644 --- a/packages/experimental/personalized-recommendations/package.json +++ b/packages/experimental/personalized-recommendations/package.json @@ -47,7 +47,6 @@ "devDependencies": { "@deepseek-ai/cordis": "workspace:~", "@deepseek-ai/cordis-plugin-include": "workspace:~", - "js-yaml": "^4.3.2", "@deepseek-ai/cordis-plugin-timer": "workspace:~", "@deepseek-ai/dsh-agent": "workspace:*", "@deepseek-ai/dsh-api-remote-access": "workspace:*", diff --git a/packages/experimental/personalized-recommendations/tests/bundle.spec.ts b/packages/experimental/personalized-recommendations/tests/bundle.spec.ts index 7856031d47..e3e9d5d588 100644 --- a/packages/experimental/personalized-recommendations/tests/bundle.spec.ts +++ b/packages/experimental/personalized-recommendations/tests/bundle.spec.ts @@ -4,9 +4,8 @@ import { mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { join } from 'node:path' import { expect, it, onTestFinished } from 'vitest' -import * as yaml from 'js-yaml' import type { Context } from '@deepseek-ai/cordis' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import Timer from '@deepseek-ai/cordis-plugin-timer' import { boot, initProfile, loadProfileDirectory, readProfilePatches, type ProfileContext } from '@deepseek-ai/dsh-app-boot' import Hmr from '@deepseek-ai/dsh-hmr' @@ -32,9 +31,7 @@ const manifest = JSON.parse(readFileSync(new URL('../package.json', import.meta. dependencies: Record dsh: { bundle: { patch: string } } } -const patch = yaml.load(readFileSync(new URL(`../${manifest.dsh.bundle.patch}`, import.meta.url), 'utf8'), { - schema: entryListSchema, -}) as { insert: Row[] }[] +const patch = parseEntryYaml(readFileSync(new URL(`../${manifest.dsh.bundle.patch}`, import.meta.url), 'utf8')) as { insert: Row[] }[] const rows = patch[0]?.insert ?? [] /** A browser row's Host entry is an empty `apply`; its contribution loads in the Client. */ @@ -133,7 +130,7 @@ it('addresses every row through its own id and switches the shared card service await toggle('action-cards', false) expect(ctx.get('actionCards')).toBeUndefined() expect(await skills()).toEqual([]) - expect(yaml.load(await readFile(profile.patchPath, 'utf8'))).toEqual([ + expect(parseEntryYaml(await readFile(profile.patchPath, 'utf8'))).toEqual([ { id: 'creation-recommendations', disabled: true }, { id: 'action-cards', disabled: true }, ]) await toggle('action-cards', true) @@ -144,5 +141,5 @@ it('addresses every row through its own id and switches the shared card service expect(await skills()).toEqual(['personalized-pages']) await toggle('plugin-recommendations', true) expect(await skills()).toEqual(['official-plugins', 'personalized-pages']) - expect(yaml.load(await readFile(profile.patchPath, 'utf8'))).toEqual([]) + expect(parseEntryYaml(await readFile(profile.patchPath, 'utf8'))).toEqual([]) }, 30_000) diff --git a/packages/experimental/webworker-packer/package.json b/packages/experimental/webworker-packer/package.json index a9b39b76d0..9f261c2dbb 100644 --- a/packages/experimental/webworker-packer/package.json +++ b/packages/experimental/webworker-packer/package.json @@ -40,12 +40,10 @@ "@deepseek-ai/dsh-session-format": "workspace:*", "@deepseek-ai/dsh-session-format-catalog": "workspace:*", "@deepseek-ai/dsh-session-format-v3-to-v4": "workspace:*", - "js-yaml": "^4.3.2", "picomatch": "^4.0.7" }, "devDependencies": { "@deepseek-ai/cordis": "workspace:~", - "@types/js-yaml": "^4.0.9", "@types/picomatch": "^4.0.3" }, "peerDependencies": { diff --git a/packages/experimental/webworker-packer/src/pack.ts b/packages/experimental/webworker-packer/src/pack.ts index fd394d2d51..0b8ea127cf 100644 --- a/packages/experimental/webworker-packer/src/pack.ts +++ b/packages/experimental/webworker-packer/src/pack.ts @@ -28,8 +28,7 @@ import { type ImageLazyArchive, type ImageManifest, } from '@deepseek-ai/dsh-experimental-webworker-runtime' import picomatch from 'picomatch' -import yaml from 'js-yaml' -import { entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml, stringifyEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' import { PROFILE_PATCH_FILENAME } from '@deepseek-ai/dsh-app-boot' import { WRAPPER_CONTRACT, type ImageFiles, type TransformOutcome } from './transform-image.ts' import { EXCLUDE, EXCLUDE_WORKSPACE, IMAGE_ENTRY_SEEDS, PAGE_ASSETS } from './rules.ts' @@ -207,7 +206,7 @@ function treeRosterOf(root: string): string[] { continue } if (!entry.name.endsWith('.yml') && !entry.name.endsWith('.yaml')) continue - collectModuleNames(yaml.load(readFileSync(absolute, 'utf8'), { schema: entryListSchema }), names) + collectModuleNames(parseEntryYaml(readFileSync(absolute, 'utf8')), names) } } walk(root) @@ -696,7 +695,7 @@ export function packVfsImage(options: PackOptions): PackResult { files[`node_modules/${installation.name}/package.json`] = readFileSync(installation.manifest) } if (options.homePatch !== undefined && options.homePatch.length > 0) { - files[HOME_PATCH_PATH] = encoder.encode(yaml.dump(options.homePatch, { schema: entryListSchema, noRefs: true })) + files[HOME_PATCH_PATH] = encoder.encode(stringifyEntryYaml(options.homePatch)) } for (const tree of configTrees) collectTree(tree.directory, files, tree.mount, relativePath => !excluded(relativePath)) diff --git a/packages/experimental/webworker-packer/tests/profile-image.spec.ts b/packages/experimental/webworker-packer/tests/profile-image.spec.ts index 6249b8a2c1..48c7be1d92 100644 --- a/packages/experimental/webworker-packer/tests/profile-image.spec.ts +++ b/packages/experimental/webworker-packer/tests/profile-image.spec.ts @@ -10,8 +10,7 @@ import { join } from 'node:path' import { fileURLToPath } from 'node:url' import { describe, expect, it, type TestContext } from 'vitest' import { OPTIONAL_BUNDLES, PROFILE_TEMPLATES } from '@deepseek-ai/dsh-official-bundles' -import yaml from 'js-yaml' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { HOME_PATCH_PATH, MANIFEST_PATH, packVfsImage } from '../src/pack.ts' import { installationManifest, platformHomePatch, profileRoster } from '../src/repository.ts' @@ -93,7 +92,7 @@ describe('image layout', () => { expect(HOME_PATCH_PATH).toBe('home/cordis.patch.yml') const text = new TextDecoder().decode(result.files[HOME_PATCH_PATH]) expect(text).toContain("!!js dshHomePath('sessions')") - expect(yaml.load(text, { schema: entryListSchema })).toEqual(homePatch) + expect(parseEntryYaml(text)).toEqual(homePatch) }) it('refuses an installation that is also a roster package', (test) => { diff --git a/packages/preset/agent-preset-registry/package.json b/packages/preset/agent-preset-registry/package.json index 242639fdba..ad692b8a7e 100644 --- a/packages/preset/agent-preset-registry/package.json +++ b/packages/preset/agent-preset-registry/package.json @@ -65,8 +65,7 @@ "dependencies": { "@deepseek-ai/dsh-app-boot": "workspace:*", "@deepseek-ai/schemastery": "workspace:~", - "zod": "4.4.3", - "js-yaml": "^4.3.2" + "zod": "4.4.3" }, "devDependencies": { "@deepseek-ai/cordis-plugin-group": "workspace:~", @@ -94,7 +93,6 @@ "@deepseek-ai/dsh-sandbox-policy": "workspace:*", "@deepseek-ai/dsh-user-approval": "workspace:*", "@deepseek-ai/dsh-agent-preset": "workspace:*", - "@deepseek-ai/dsh-working-directory": "workspace:*", - "@types/js-yaml": "^4.0.9" + "@deepseek-ai/dsh-working-directory": "workspace:*" } } diff --git a/packages/preset/agent-preset-registry/src/index.ts b/packages/preset/agent-preset-registry/src/index.ts index 5205a58228..0bee8749e1 100644 --- a/packages/preset/agent-preset-registry/src/index.ts +++ b/packages/preset/agent-preset-registry/src/index.ts @@ -4,8 +4,7 @@ import { Context, Service } from '@deepseek-ai/cordis' import z from '@deepseek-ai/schemastery' import { Remote, RemoteError, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol' import { bindScopeParent, createScope, scopeOf, scopeParentOf, type Scope, type ScopeKey, type ScopeParentBinding } from '@deepseek-ai/dsh-scope' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' -import { dump } from 'js-yaml' +import { stringifyEntryYaml } from '@deepseek-ai/cordis-plugin-include' import type { Agent } from '@deepseek-ai/dsh-agent' import type { Session } from '@deepseek-ai/dsh-session' // Type-only: the optional `settings` service this registry keeps off the generated pages. @@ -239,7 +238,7 @@ export class AgentPresetRegistry extends TypertRemoteService { } const { id, name, description, plugins } = record.config // The Loader's own dialect, so `!!js` conditions read as declared rather than as expression objects. - const content = dump(plugins, { schema: entryListSchema, noRefs: true, lineWidth: -1 }) + const content = stringifyEntryYaml(plugins, { lineWidth: -1 }) return Promise.resolve({ agentPreset: id, content, ...(name === undefined ? {} : { name }), ...(description === undefined ? {} : { description }), }) diff --git a/packages/preset/agent-preset/package.json b/packages/preset/agent-preset/package.json index b64d6a23d8..5ccc9622f8 100644 --- a/packages/preset/agent-preset/package.json +++ b/packages/preset/agent-preset/package.json @@ -45,8 +45,6 @@ "@deepseek-ai/dsh-compaction-tool-result-pruner": "workspace:*", "@deepseek-ai/dsh-skill": "workspace:*", "@deepseek-ai/dsh-skill-filesystem": "workspace:*", - "@deepseek-ai/schemastery": "workspace:~", - "@types/js-yaml": "^4.0.9", - "js-yaml": "^4.3.2" + "@deepseek-ai/schemastery": "workspace:~" } } diff --git a/packages/preset/agent-preset/tests/skills.spec.ts b/packages/preset/agent-preset/tests/skills.spec.ts index 23ff399c2a..602f2bc57b 100644 --- a/packages/preset/agent-preset/tests/skills.spec.ts +++ b/packages/preset/agent-preset/tests/skills.spec.ts @@ -7,8 +7,7 @@ import { lstatSync, readdirSync, readFileSync, readlinkSync, realpathSync, statS import { dirname, join, matchesGlob, resolve } from 'node:path' import { Context } from '@deepseek-ai/cordis' import { fileURLToPath } from 'node:url' -import * as yaml from 'js-yaml' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { codePointLength } from '@deepseek-ai/dsh-compaction-tool-result-pruner' import SkillRegistry, { renderSkillContent } from '@deepseek-ai/dsh-skill' import * as SkillFileSystem from '@deepseek-ai/dsh-skill-filesystem' @@ -94,7 +93,7 @@ describe('the shipped creator skills', () => { for (const name of readdirSync(templates)) { const dir = join(templates, name) const manifest = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8')) as { dsh: { bundle: { patch: string } } } - const patch = yaml.load(readFileSync(join(dir, manifest.dsh.bundle.patch), 'utf8'), { schema: entryListSchema }) + const patch = parseEntryYaml(readFileSync(join(dir, manifest.dsh.bundle.patch), 'utf8')) expect(Array.isArray(patch)).toBe(true) for (const file of readdirSync(dir).filter(entry => entry.endsWith('.js'))) { execFileSync(process.execPath, ['--check', join(dir, file)]) diff --git a/packages/settings/settings/tests/profile-composition.ts b/packages/settings/settings/tests/profile-composition.ts index b0ba588749..fceb74a585 100644 --- a/packages/settings/settings/tests/profile-composition.ts +++ b/packages/settings/settings/tests/profile-composition.ts @@ -1,9 +1,8 @@ /** Mount source modules through a real profile, patch file, and reload coordinator. */ import { mkdir, readFile, writeFile } from 'node:fs/promises' import { join } from 'node:path' -import yaml from 'js-yaml' import type { Context } from '@deepseek-ai/cordis' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml, stringifyEntryYaml } from '@deepseek-ai/cordis-plugin-include' import type { EntryOptions } from '@deepseek-ai/cordis-plugin-loader' import Timer from '@deepseek-ai/cordis-plugin-timer' import { initProfile, mountRootInclude, readProfilePatches, type ProfileContext } from '@deepseek-ai/dsh-app-boot' @@ -19,9 +18,9 @@ export async function profileComposition(ctx: Context, home: string, baseFile: s await mkdir(bundle, { recursive: true }) await writeFile(join(home, 'package.json'), '{"name":"test-installation"}\n') await writeFile(join(bundle, 'package.json'), JSON.stringify({ name: 'test-profile-bundle', version: '1.0.0', dsh: { bundle: { patch: 'cordis.patch.yml' } } })) - const rows = yaml.load(await readFile(baseFile, 'utf8'), { schema: entryListSchema }) as EntryOptions[] + const rows = parseEntryYaml(await readFile(baseFile, 'utf8')) as EntryOptions[] for (const row of rows) row.id ??= row.name.replace('@deepseek-ai/dsh-', '') - await writeFile(join(bundle, 'cordis.patch.yml'), yaml.dump([{ insert: rows }], { schema: entryListSchema })) + await writeFile(join(bundle, 'cordis.patch.yml'), stringifyEntryYaml([{ insert: rows }])) await writeFile(join(dir, 'cordis.yml'), '[]\n') const profile: ProfileContext = { name: 'test', startedBundles: ['test-profile-bundle'], dir, patchPath: join(dir, 'cordis.patch.yml'), diff --git a/packages/test-support/client-runtime/package.json b/packages/test-support/client-runtime/package.json index 6c8b0e9c3a..d64df4c47d 100644 --- a/packages/test-support/client-runtime/package.json +++ b/packages/test-support/client-runtime/package.json @@ -25,7 +25,6 @@ "dependencies": { "@testing-library/dom": "^10.4.1", "@testing-library/react": "^16.3.3", - "js-yaml": "^4.3.2", "vitest": "^4.1.11" }, "peerDependencies": { @@ -86,7 +85,6 @@ "@deepseek-ai/dsh-subagent": "workspace:*", "@deepseek-ai/dsh-typert-protocol": "workspace:*", "@deepseek-ai/dsh-web-app": "workspace:*", - "@types/js-yaml": "^4.0.9", "react": "^18.2.0", "react-dom": "^18.2.0", "@deepseek-ai/dsh-client-ui-context-menu": "workspace:*" diff --git a/packages/test-support/client-runtime/src/assembly/bundle-roster.ts b/packages/test-support/client-runtime/src/assembly/bundle-roster.ts index d268bbc84c..d31ab8c876 100644 --- a/packages/test-support/client-runtime/src/assembly/bundle-roster.ts +++ b/packages/test-support/client-runtime/src/assembly/bundle-roster.ts @@ -1,7 +1,7 @@ /** * The browser roster of a `dsh --profile`, read from its bundle patch files * the way the launcher composes them: each bundle's `dsh.bundle.patch` file list is - * parsed with the include plugin's YAML dialect (`entryListSchema`) and + * parsed with the include plugin's `parseEntryYaml` and * composed by its `applyEntryPatches`; every enabled row whose package * declares `dsh.client.platform === 'web'` becomes a roster row carrying that * declaration's `inject` and `immediately`; rows nested in Loader groups count @@ -18,9 +18,8 @@ import { createRequire } from 'node:module' import { basename, dirname, join } from 'node:path' import { fileURLToPath } from 'node:url' import { evaluate, isJsExpr, type EntryOptions } from '@deepseek-ai/cordis-plugin-loader' -import { applyEntryPatches, entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' +import { applyEntryPatches, parseEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' import { exactPackageSpecifier, parseDshClient } from '@deepseek-ai/dsh-client-modules/client' -import * as yaml from 'js-yaml' import { ClientRoster, type ClientRosterRow } from './roster.ts' /** @@ -96,7 +95,7 @@ function readLayer(bundle: string, anchor: string): BundleLayer { } const patches = files.flatMap((patch) => { const file = join(dirname(manifestPath), patch) - const parsed: unknown = yaml.load(readFileSync(file, 'utf8'), { schema: entryListSchema }) + const parsed: unknown = parseEntryYaml(readFileSync(file, 'utf8')) if (!Array.isArray(parsed)) throw new Error(`client-test-runtime: ${file} must be a top-level list of patches`) return parsed as PatchOptions[] }) diff --git a/packages/test-support/session-snapshot/src/launcher.ts b/packages/test-support/session-snapshot/src/launcher.ts index a99ecac2c0..3524da3347 100644 --- a/packages/test-support/session-snapshot/src/launcher.ts +++ b/packages/test-support/session-snapshot/src/launcher.ts @@ -13,7 +13,6 @@ import { createRequire } from 'node:module' import { basename, dirname, join, resolve } from 'node:path' import { Readable, Writable } from 'node:stream' import { pathToFileURL } from 'node:url' -import * as yaml from 'js-yaml' import { client as createAcpClientApp, methods, @@ -37,7 +36,7 @@ import { type SetSessionConfigOptionResponse, type SessionNotification, } from '@agentclientprotocol/sdk' -import { entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' +import { parseEntryYaml, stringifyEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include' import { resolveExampleLaunch } from '@deepseek-ai/dsh-loader-smoke' const EXIT_MARKER_GRACE_MS = 250 @@ -417,7 +416,7 @@ function linkProfilePackage(source: string, cwd: string, profile: string, packag export function materializeProfilePatch( source: string, cwd: string, profile: string, targetDir: string, index: number, ): string { - const parsed = yaml.load(readFileSync(source, 'utf8'), { schema: entryListSchema }) + const parsed = parseEntryYaml(readFileSync(source, 'utf8')) if (!Array.isArray(parsed)) throw new Error(`snapshot profile patch must be a top-level array: ${source}`) const patches = parsed as PatchOptions[] const baseDir = dirname(source) @@ -439,7 +438,7 @@ export function materializeProfilePatch( for (const entry of patch.insert ?? []) visitEntry(entry) } const target = join(targetDir, `${String(index)}-${basename(source)}`) - writeFileSync(target, yaml.dump(patches, { schema: entryListSchema, lineWidth: -1, noRefs: true })) + writeFileSync(target, stringifyEntryYaml(patches, { lineWidth: -1 })) return target } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dfd3aa64d9..00c3c94fb1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2029,9 +2029,6 @@ importers: ajv: specifier: ^8.20.0 version: 8.20.0 - js-yaml: - specifier: ^4.3.2 - version: 4.3.2 node-addon-require-builtin: specifier: ^0.1.9 version: 0.1.9 @@ -2069,9 +2066,6 @@ importers: '@deepseek-ai/schemastery': specifier: link:../../../vendor/schemastery version: link:../../../vendor/schemastery - '@types/js-yaml': - specifier: ^4.0.9 - version: 4.0.9 '@types/semver': specifier: ^7.8.0 version: 7.8.0 @@ -2096,9 +2090,6 @@ importers: '@deepseek-ai/dsh-atomic-write': specifier: workspace:* version: link:../../util/atomic-write - js-yaml: - specifier: ^4.3.2 - version: 4.3.2 yaml: specifier: ^2.8.1 version: 2.9.0 @@ -2118,9 +2109,6 @@ importers: '@deepseek-ai/dsh-hmr': specifier: workspace:* version: link:../hmr - '@types/js-yaml': - specifier: ^4.0.9 - version: 4.0.9 packages/boot/hmr: dependencies: @@ -9840,9 +9828,6 @@ importers: '@deepseek-ai/cordis-plugin-loader': specifier: workspace:~ version: link:../../../vendor/loader - js-yaml: - specifier: ^4.2.0 - version: 4.3.2 optionalDependencies: '@deepseek-ai/dsh-experimental-cua-macos': specifier: workspace:* @@ -10354,9 +10339,6 @@ importers: '@deepseek-ai/cordis-plugin-include': specifier: workspace:~ version: link:../../../vendor/include - js-yaml: - specifier: ^4.3.2 - version: 4.3.2 packages/experimental/liveshare: dependencies: @@ -10684,9 +10666,6 @@ importers: '@deepseek-ai/dsh-tools': specifier: workspace:* version: link:../../core/tools - js-yaml: - specifier: ^4.3.2 - version: 4.3.2 packages/experimental/plugin-market-bundle: dependencies: @@ -11544,9 +11523,6 @@ importers: '@deepseek-ai/dsh-session-format-v3-to-v4': specifier: workspace:* version: link:../../session/session-format-v3-to-v4 - js-yaml: - specifier: ^4.3.2 - version: 4.3.2 picomatch: specifier: ^4.0.7 version: 4.0.7 @@ -11554,9 +11530,6 @@ importers: '@deepseek-ai/cordis': specifier: workspace:~ version: link:../../../vendor/cordis - '@types/js-yaml': - specifier: ^4.0.9 - version: 4.0.9 '@types/picomatch': specifier: ^4.0.3 version: 4.0.3 @@ -13748,12 +13721,6 @@ importers: '@deepseek-ai/dsh-skill-filesystem': specifier: workspace:* version: link:../../skill/skill-filesystem - '@types/js-yaml': - specifier: ^4.0.9 - version: 4.0.9 - js-yaml: - specifier: ^4.3.2 - version: 4.3.2 packages/preset/agent-preset-registry: dependencies: @@ -13763,9 +13730,6 @@ importers: '@deepseek-ai/schemastery': specifier: link:../../../vendor/schemastery version: link:../../../vendor/schemastery - js-yaml: - specifier: ^4.3.2 - version: 4.3.2 zod: specifier: 4.4.3 version: 4.4.3 @@ -13848,9 +13812,6 @@ importers: '@deepseek-ai/dsh-working-directory': specifier: workspace:* version: link:../../session/working-directory - '@types/js-yaml': - specifier: ^4.0.9 - version: 4.0.9 packages/preset/persona: dependencies: @@ -17088,9 +17049,6 @@ importers: '@testing-library/react': specifier: ^16.3.3 version: 16.3.3(@testing-library/dom@10.4.2)(@types/react-dom@18.3.7(@types/react@18.3.31))(@types/react@18.3.31)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - js-yaml: - specifier: ^4.3.2 - version: 4.3.2 vitest: specifier: ^4.1.11 version: 4.1.11(@opentelemetry/api@1.9.1)(@types/node@22.20.1)(@vitest/coverage-v8@4.1.11)(happy-dom@20.11.6)(jsdom@29.1.1(@noble/hashes@2.4.0))(vite@8.2.2(@types/node@22.20.1)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.13)(yaml@2.9.0)) @@ -17188,9 +17146,6 @@ importers: '@deepseek-ai/dsh-web-app': specifier: workspace:* version: link:../../bundle/web-app - '@types/js-yaml': - specifier: ^4.0.9 - version: 4.0.9 react: specifier: ^18.2.0 version: 18.3.1 diff --git a/scripts/cordis-entry-yaml.spec.ts b/scripts/cordis-entry-yaml.spec.ts new file mode 100644 index 0000000000..75d938e84b --- /dev/null +++ b/scripts/cordis-entry-yaml.spec.ts @@ -0,0 +1,39 @@ +/** Include's YAML dialect exports used by DSH configuration tools. */ +import { entryYamlErrorPosition, parseEntryYaml, stringifyEntryYaml } from '@deepseek-ai/cordis-plugin-include' +import { describe, expect, it } from 'vitest' + +describe('Include YAML dialect', () => { + it('reads and writes !!js scalars as expression nodes', () => { + const source = '- id: a\n name: example\n disabled: !!js process.env.OFF\n' + const parsed = parseEntryYaml(source) + expect(parsed).toEqual([{ id: 'a', name: 'example', disabled: { __jsExpr: 'process.env.OFF' } }]) + expect(stringifyEntryYaml(parsed)).toBe(source) + }) + + it('reads binary integers as numbers and dates as strings', () => { + expect(parseEntryYaml('- 0b101\n- 2001-01-01\n- ~\n')).toEqual([5, '2001-01-01', null]) + expect(parseEntryYaml('')).toBeUndefined() + }) + + it('writes repeated references in full', () => { + const shared = { value: 1 } + expect(stringifyEntryYaml([{ config: shared }, { config: shared }])).toBe('- config:\n value: 1\n- config:\n value: 1\n') + }) + + it('folds long scalars at the requested line width', () => { + const value = [{ text: Array.from({ length: 20 }, (_, index) => `word${String(index)}`).join(' ') }] + expect(stringifyEntryYaml(value).split('\n').length).toBeGreaterThan(2) + expect(stringifyEntryYaml(value, { lineWidth: -1 }).split('\n')).toHaveLength(2) + }) + + it('locates parse errors', () => { + let error: unknown + try { + parseEntryYaml('- id: a\n name: [\n') + } catch (caught) { + error = caught + } + expect(entryYamlErrorPosition(error)).toEqual({ line: 3, column: 1 }) + expect(entryYamlErrorPosition(new Error('other'))).toBeUndefined() + }) +}) diff --git a/scripts/cordis-yaml.ts b/scripts/cordis-yaml.ts index 43f81af22e..2389c7893f 100644 --- a/scripts/cordis-yaml.ts +++ b/scripts/cordis-yaml.ts @@ -3,30 +3,20 @@ * @module scripts/cordis-yaml */ -import * as yaml from 'js-yaml' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' /** A Loader `!!js` expression preserved as data instead of executed. */ export interface JsExpr { __jsExpr: string } -const jsExprType = new yaml.Type('tag:yaml.org,2002:js', { - kind: 'scalar', - resolve: data => typeof data === 'string', - construct: (data: unknown): JsExpr => { - if (typeof data !== 'string') throw new TypeError('!!js requires a scalar string') - return { __jsExpr: data } - }, -}) -const schema = yaml.JSON_SCHEMA.extend(jsExprType) - /** * Parse a Cordis config while preserving Loader `!!js` expressions as data. * @param source - Cordis YAML source text. * @returns the parsed YAML value. */ export function loadCordisYaml(source: string): unknown { - return yaml.load(source, { schema }) + return parseEntryYaml(source) } /** diff --git a/vendor/README.md b/vendor/README.md index c3a4c8e774..bb51a6381d 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -37,7 +37,7 @@ Keep this log exhaustive — every divergence from upstream must be listed. Each - **V7 · JSDoc enrichment**: added `@param`/`@returns` tags and contract documentation (disposal semantics, waterfall veto, bail conditions, error cases) across the public plugin-author surface — `Context` (class, statics, and the `Context` interface properties incl. `root`), module re-exports, shared utility helpers, `EventsService`, `Fiber`, `RegistryService`, `ReflectService`, `Service`, `LoggerService` and their `declare module './context.ts'` overloads. Loader documentation covers `loader/src/{index,internal,config/entry,config/group,config/isolate,config/tree,config/utils}.ts`, including entry ownership, tree mutation methods, and the `!!js` discriminator. The upstream `EventsService.dispatch()` deprecation annotation is omitted: DSH enumerates callbacks to contain each observer failure independently, which the typed dispatch methods do not provide. Timer retains its local class and helper summaries; its README is local documentation because the upstream package has none. Cosmokit and Schemastery add summaries to their exported helpers, types and namespaces, logger-console to its exporters and config namespace, and HMR to its build-failure logger in `hmr/src/error.ts`. Comment-only; no code changes. Motivation: the website API-reference generator renders these docs and hard-errors on undocumented members. Retire this entry when the enrichment is upstreamed. - **V9 · `hmr/src/index.ts` module-watcher readiness and native paths**: realpath the existing watch base, classify framework modules and attach listeners before reporting readiness, and compare config paths using both canonical and configured spellings. This preserves Node module-cache identity across Windows short-name paths and filesystem aliases. The main watcher uses `ignoreInitial: true` so startup reads do not trigger another refresh; exact profile patch watching is owned by `packages/boot/hmr/src/watch-config.ts`. The Include change listener logs a rejected `Include.refresh()` instead of leaving the rejection unhandled; the rejection reports unsaved runtime changes while Include keeps its running tree. Covered by `packages/boot/hmr/tests/watch-config.spec.ts` and `scripts/cordis-vendor-hmr-include.spec.ts`. - **V10 · Vendored Node-compatible TypeScript**: marked erased imports explicitly across `cordis`, `loader`, `include`, `hmr`, and `schemastery` so Node's native TypeScript transform does not request types as runtime exports. Schemastery's source uses an ESM default export and its package declares `type: module`. Conditional exports select `.mjs` for import and `.cjs` for require; without them, concurrent imports under module-hook hosts reach the CJS entry and can race its require of ESM Cosmokit (`ERR_REQUIRE_ESM_RACE_CONDITION`). -- **V11 · Include patch and YAML exports**: `include/src/index.ts` exports upstream `applyPatches` as `applyEntryPatches` and the `!!js` YAML dialect as `entryListSchema`, so `dsh --dump-config` composes entries with the same algorithm that mounting uses. Covered by `packages/boot/app-boot/tests/config-reload.spec.ts` and `scripts/cordis-entry-commit.spec.ts`. +- **V11 · Include patch and YAML exports**: `include/src/index.ts` exports upstream `applyPatches` as `applyEntryPatches`, so `dsh --dump-config` composes entries with the same algorithm that mounting uses. It also exports `parseEntryYaml`, `stringifyEntryYaml` and `entryYamlErrorPosition` over the `!!js` YAML dialect, and `_read()` parses through `parseEntryYaml`, so every DSH reader and writer of Include-dialect YAML uses Include's parser; `stringifyEntryYaml` writes with `noRefs`, while Include's own writer keeps upstream's options. Covered by `packages/boot/app-boot/tests/config-reload.spec.ts`, `scripts/cordis-entry-commit.spec.ts` and `scripts/cordis-entry-yaml.spec.ts`. - **V14 · Include persistence results**: `include/src/index.ts` keeps an error for unsaved journal changes. `flush()` retries pending writes and rejects while changes remain unsaved; `stop()` returns the same result and always stops the child tree; a later successful flush clears previous errors. A failed `refresh()` can also reject while runtime changes remain unsaved. Patch-owned changes route to the parent Include, so callers that need them persisted must flush that parent too. The constructor omits upstream's `ctx.hmr.watch(this.filename, () => this.refresh())` registration because neither HMR provider exposes `watch()`; both find each Include by scanning loader entries for its `filename` and call `refresh()`. Ordinary Fiber teardown keeps its error containment. Covered by `scripts/cordis-include-journal.spec.ts` and `packages/host/directory-picker-auto/tests/loader-composition.spec.ts`. - **V15 · Configuration access across Core, Loader, Include and HMR**: rc.11 Core owns raw `Fiber.config`, `internal/config(fiber, next)`, `internal/commit` and awaited `internal/update(config, next)`. Root-fiber candidate resolution remains available without a plugin schema. Local `rawConfig`, `resolveConfig(candidate)` and `effectiveConfig` accessors retain the DSH consumer API. Fiber caches the object passed to activation or a successful update that keeps the instance; candidate resolution is pure, failed or superseded updates cannot replace the cache, and volatile updates retain references. Loader resolves only entry roots and excludes Group/Include tree carriers, so nested `!!js` expressions wait for their own injections. Include retains its tree-carrier marker and public patch exports, and HMR transfers raw config through the accessors. Covered by `scripts/cordis-config-access.spec.ts`, `scripts/cordis-core-lifecycle.spec.ts` and the boot/HMR suites. - **V16 · `cordis/package.json` publishes `src`**: added `src` to the `files` list, joining the other eight vendored packages. Cordis declares `"./src/*": "./src/*"` in its exports, so a tarball without `src` publishes an export map pointing at absent files; the release change judgement also reads `files` to decide whether a diff reaches the payload, and a package whose only published paths are build output has no tracked path to match. diff --git a/vendor/include/README.md b/vendor/include/README.md index ae01993dc8..1ce78ec9a9 100644 --- a/vendor/include/README.md +++ b/vendor/include/README.md @@ -44,7 +44,7 @@ Patches can insert entries or override fields on entries with a matching `id`. ## Patch composition and persistence -`applyEntryPatches(data, patches, warn)` uses the same upstream algorithm as mounting. It clones file entries even without patches and clones inserted entry lists before indexing them, so later patches can address inserted rows without mutating those input lists. `entryListSchema` exposes Include’s YAML dialect to configuration tools. Nested entry expressions remain literal until their owning Loader entry evaluates them. +`applyEntryPatches(data, patches, warn)` uses the same upstream algorithm as mounting. It clones file entries even without patches and clones inserted entry lists before indexing them, so later patches can address inserted rows without mutating those input lists. `parseEntryYaml(content)` and `stringifyEntryYaml(value, options)` read and write Include’s YAML dialect for configuration tools, and `entryYamlErrorPosition(error)` locates a parse error. `stringifyEntryYaml` writes repeated references in full instead of as aliases. Nested entry expressions remain literal until their owning Loader entry evaluates them. Tree mutations arrive through `commit(change)` and enter a journal. Include merges them with the latest file before writing; file edits win conflicts on the same fields and produce a diagnostic. Patch-owned fields and inserted entries update the parent Include’s patches instead of the included file. Invalid, missing or read-only files leave unsaved changes in memory. diff --git a/vendor/include/src/index.ts b/vendor/include/src/index.ts index 5dd86d50ec..2f905bbe3e 100644 --- a/vendor/include/src/index.ts +++ b/vendor/include/src/index.ts @@ -21,9 +21,45 @@ const JsExpr = new yaml.Type('tag:yaml.org,2002:js', { represent: (data) => data['__jsExpr'], }) -/** YAML dialect preserving child-owned JavaScript expression nodes. */ -export const entryListSchema = yaml.JSON_SCHEMA.extend(JsExpr) -const schema = entryListSchema +const schema = yaml.JSON_SCHEMA.extend(JsExpr) + +/** Options for {@link stringifyEntryYaml}. */ +export interface EntryYamlStringifyOptions { + /** Column at which long scalars are folded; `-1` disables folding. Defaults to 80. */ + lineWidth?: number +} + +/** + * Parse text in Include's YAML dialect. A `!!js` scalar becomes a child-owned JavaScript expression node that stays + * literal until its owning Loader entry evaluates it. + * @param content - YAML source text. + * @returns the parsed value, or `undefined` for an empty document. + * @throws the parser's syntax error; {@link entryYamlErrorPosition} reads its location. + */ +export function parseEntryYaml(content: string): unknown { + return yaml.load(content, { schema }) +} + +/** + * Serialize a value in Include's YAML dialect. JavaScript expression nodes are written as `!!js` scalars, and + * repeated object references are written out in full instead of as aliases. + * @param value - entry list, patch list, or entry fragment to serialize. + * @param options - output formatting. + * @returns YAML text ending with a newline. + */ +export function stringifyEntryYaml(value: unknown, options: EntryYamlStringifyOptions = {}): string { + return yaml.dump(value, { schema, noRefs: true, lineWidth: options.lineWidth ?? 80 }) +} + +/** + * Locate a syntax error thrown by {@link parseEntryYaml}. + * @param error - value thrown by {@link parseEntryYaml}. + * @returns the one-based line and column of the error, or `undefined` when the error carries no source location. + */ +export function entryYamlErrorPosition(error: unknown): { line: number; column: number } | undefined { + if (!(error instanceof yaml.YAMLException) || !error.mark) return undefined + return { line: error.mark.line + 1, column: error.mark.column + 1 } +} const types: Record = { '.json': 'application/json', @@ -255,7 +291,7 @@ export class Include extends EntryTree { let data: any try { data = this.type === 'application/yaml' - ? yaml.load(content, { schema }) + ? parseEntryYaml(content) : JSON.parse(content) } catch (error) { throw new ConfigFileError('parse', this.filename, error) From 6d44ea055b7b41a0342524e7f17fa1bb6b5088e1 Mon Sep 17 00:00:00 2001 From: Shigma Date: Thu, 5 Nov 2026 19:29:17 +0800 Subject: [PATCH 3/3] refactor(cordis): migrate remaining Include-dialect YAML call sites --- apps/cli/tests/profiles/official-installer-packed.e2e.ts | 4 ++-- apps/cli/tests/profiles/webhook-packed.e2e.ts | 3 ++- apps/web/tests/cua-optin.e2e.ts | 8 ++++---- apps/web/tests/session-log-upload.e2e.ts | 4 ++-- packages/boot/app-boot/src/config-schema/collect.ts | 2 +- packages/subagent/subagent-claude-code/package.json | 1 + .../tests/subagent-claude-code.spec.ts | 4 ++-- packages/subagent/subagent-codex/package.json | 1 + .../subagent/subagent-codex/tests/subagent-codex.spec.ts | 4 ++-- pnpm-lock.yaml | 6 ++++++ vendor/README.md | 2 +- vendor/include/src/index.ts | 6 +++--- 12 files changed, 27 insertions(+), 18 deletions(-) diff --git a/apps/cli/tests/profiles/official-installer-packed.e2e.ts b/apps/cli/tests/profiles/official-installer-packed.e2e.ts index e9039e8a5a..699f8deb7c 100644 --- a/apps/cli/tests/profiles/official-installer-packed.e2e.ts +++ b/apps/cli/tests/profiles/official-installer-packed.e2e.ts @@ -5,8 +5,8 @@ import { join } from 'node:path' import { createInterface } from 'node:readline' import { fileURLToPath } from 'node:url' import { execa } from 'execa' -import yaml from 'js-yaml' import { expect, it, onTestFinished } from 'vitest' +import { stringifyEntryYaml } from '@deepseek-ai/cordis-plugin-include' import type { BundleInfo, ChangeResult } from '@deepseek-ai/dsh-plugin-manager' import { getDshRuntimeVersion } from '../../../../packages/boot/app-boot/src/plugin-compatibility.ts' import { generateOfficialBundleCatalog } from '../../../../scripts/gen-official-bundle-catalog.ts' @@ -118,7 +118,7 @@ it.skipIf(!built)('installs the exported registry\'s local closure and switches const observer = join(temporary, 'official-installer-observer.mjs') await writeFile(observer, await readFile(new URL('./fixtures/official-installer-observer.mjs', import.meta.url), 'utf8')) const patch = join(temporary, 'official-installer.patch.yml') - await writeFile(patch, yaml.dump([{ insert: [{ id: 'official-installer-observer', name: observer, + await writeFile(patch, stringifyEntryYaml([{ insert: [{ id: 'official-installer-observer', name: observer, config: { registry: registry.url, profile, diff --git a/apps/cli/tests/profiles/webhook-packed.e2e.ts b/apps/cli/tests/profiles/webhook-packed.e2e.ts index 3844ceb22b..ac0214a76d 100644 --- a/apps/cli/tests/profiles/webhook-packed.e2e.ts +++ b/apps/cli/tests/profiles/webhook-packed.e2e.ts @@ -7,6 +7,7 @@ import { fileURLToPath } from 'node:url' import { execa } from 'execa' import yaml from 'js-yaml' import { expect, it } from 'vitest' +import { stringifyEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { assertInstalledTree, createPackedInstallation } from './packed-installation.ts' const root = fileURLToPath(new URL('../../../..', import.meta.url)) @@ -64,7 +65,7 @@ export function apply(ctx) { } `) const patch = join(temporary, 'test.patch.yml') - await writeFile(patch, yaml.dump([ + await writeFile(patch, stringifyEntryYaml([ { id: 'session-telemetry-otel', disabled: true }, { id: 'github-webhook-ingress', insert: [{ id: 'observe-packed-ingress', name: observer }] }, ])) diff --git a/apps/web/tests/cua-optin.e2e.ts b/apps/web/tests/cua-optin.e2e.ts index 77ec920da5..d7edef699a 100644 --- a/apps/web/tests/cua-optin.e2e.ts +++ b/apps/web/tests/cua-optin.e2e.ts @@ -8,7 +8,7 @@ import { readProfileManifest } from '@deepseek-ai/dsh-app-boot' import { SessionId } from '@deepseek-ai/dsh-session' import type {} from '@deepseek-ai/dsh-ptc-runtime' import type {} from '@deepseek-ai/dsh-agent-preset-registry' -import { load } from 'js-yaml' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { expect, it, vi } from 'vitest' import { captureStableAria, compareOrRefreshGolden, launchWebScaffold, webSnapshotMode, type WebScaffold } from './scaffold.ts' import { connectFreshWorkspaceZh, ZH_BROWSER_LOCALE } from './support.ts' @@ -151,9 +151,9 @@ it.skipIf(process.platform !== 'darwin').each([ expect(scaffold.ctx.settings.describe().find(row => row.ns === 'ui-settings')?.value).toMatchObject({ enabled: codingTools }) expect(saved).not.toContain('executionMode:') if (selectedDefault === undefined) { - expect(load(saved)).not.toEqual(expect.arrayContaining([expect.objectContaining({ id: 'agent-preset-registry' })])) + expect(parseEntryYaml(saved)).not.toEqual(expect.arrayContaining([expect.objectContaining({ id: 'agent-preset-registry' })])) } else { - expect(load(saved)).toEqual(expect.arrayContaining([ + expect(parseEntryYaml(saved)).toEqual(expect.arrayContaining([ expect.objectContaining({ id: 'agent-preset-registry', config: { default: 'standard', selectedDefault } }), ])) } @@ -232,7 +232,7 @@ it.skipIf(process.platform !== 'darwin').each([ expect(scaffold.ctx.tools.schemas(ptcAgent).some(tool => tool.name === 'cua')).toBe(true) expect((await runtime.run(runtime.resolve({ program, bindings: [], stateOwner: owner }))).value).toBe(3) const confirmedSettings = await readFile(settingsPath, 'utf8') - expect(load(confirmedSettings)).toEqual(expect.arrayContaining([ + expect(parseEntryYaml(confirmedSettings)).toEqual(expect.arrayContaining([ expect.objectContaining({ id: 'agent-preset-registry', config: { default: 'standard', selectedDefault: 'ptc' } }), ])) await toggle.click() diff --git a/apps/web/tests/session-log-upload.e2e.ts b/apps/web/tests/session-log-upload.e2e.ts index 09a3c4444c..8b26c3c5f9 100644 --- a/apps/web/tests/session-log-upload.e2e.ts +++ b/apps/web/tests/session-log-upload.e2e.ts @@ -3,8 +3,8 @@ import { mkdtemp, rm, writeFile, readFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { join } from 'node:path' import { chromium } from 'playwright' -import yaml from 'js-yaml' import { expect, it, onTestFinished } from 'vitest' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { credentialRef } from '@deepseek-ai/dsh-credentials' import { startMockLlmServer } from '@deepseek-ai/dsh-llm-mock-server' import { launchWebScaffold, webSnapshotMode } from './scaffold.ts' @@ -44,7 +44,7 @@ it.skipIf(webSnapshotMode() === 'record')('persists the upload switch and omits await toggle.click() await expect.poll(() => toggle.getAttribute('aria-checked')).toBe(String(enabled)) await expect.poll(async () => { - const patches = yaml.load(await readFile(join(scaffold.harnessHome, 'profiles/scaffold/cordis.patch.yml'), 'utf8')) as { id: string; config?: { enabled?: boolean } }[] + const patches = parseEntryYaml(await readFile(join(scaffold.harnessHome, 'profiles/scaffold/cordis.patch.yml'), 'utf8')) as { id: string; config?: { enabled?: boolean } }[] return patches.find(patch => patch.id === 'session-log-deepseek')?.config?.enabled ?? true }).toBe(enabled) await page.keyboard.press('Escape') diff --git a/packages/boot/app-boot/src/config-schema/collect.ts b/packages/boot/app-boot/src/config-schema/collect.ts index ab18fc035c..0eed38de5c 100644 --- a/packages/boot/app-boot/src/config-schema/collect.ts +++ b/packages/boot/app-boot/src/config-schema/collect.ts @@ -150,7 +150,7 @@ export async function collectConfigSchemas( source = extension === '.json' ? JSON.parse(content) : parseEntryYaml(content) } catch (error) { // Parser messages can quote configuration values; retain only the file and location. - const position = extension === '.json' ? undefined : entryYamlErrorPosition(error) + const position = entryYamlErrorPosition(error) const at = position === undefined ? '' : ` at line ${position.line}, column ${position.column}` throw new Error(`invalid ${extension === '.json' ? 'JSON' : 'YAML'} include ${filename}${at}`) } diff --git a/packages/subagent/subagent-claude-code/package.json b/packages/subagent/subagent-claude-code/package.json index bd59808055..55f99d0db1 100644 --- a/packages/subagent/subagent-claude-code/package.json +++ b/packages/subagent/subagent-claude-code/package.json @@ -55,6 +55,7 @@ }, "devDependencies": { "@deepseek-ai/cordis": "workspace:~", + "@deepseek-ai/cordis-plugin-include": "workspace:~", "@deepseek-ai/dsh-agent": "workspace:*", "@deepseek-ai/dsh-app-boot": "workspace:*", "@deepseek-ai/dsh-llm": "workspace:*", diff --git a/packages/subagent/subagent-claude-code/tests/subagent-claude-code.spec.ts b/packages/subagent/subagent-claude-code/tests/subagent-claude-code.spec.ts index 4b46c397d5..faf32eb43a 100644 --- a/packages/subagent/subagent-claude-code/tests/subagent-claude-code.spec.ts +++ b/packages/subagent/subagent-claude-code/tests/subagent-claude-code.spec.ts @@ -15,7 +15,7 @@ import type { } from '@anthropic-ai/claude-agent-sdk' import { Context } from '@deepseek-ai/cordis' import Loader from '@deepseek-ai/cordis-plugin-loader' -import * as yaml from 'js-yaml' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { afterEach, beforeEach, @@ -392,7 +392,7 @@ describe('task admission and package contracts', () => { ) } - const parsed = yaml.load(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8')) + const parsed = parseEntryYaml(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8')) expect(parsed).toEqual([{ insert: [ { id: 'subagent-claude-code', name: '@deepseek-ai/dsh-subagent-claude-code' }, { id: 'tool-subagent-claude-code', name: '@deepseek-ai/dsh-tool-subagent', config: { diff --git a/packages/subagent/subagent-codex/package.json b/packages/subagent/subagent-codex/package.json index 05df46cbc9..014a19366b 100644 --- a/packages/subagent/subagent-codex/package.json +++ b/packages/subagent/subagent-codex/package.json @@ -53,6 +53,7 @@ }, "devDependencies": { "@deepseek-ai/cordis": "workspace:~", + "@deepseek-ai/cordis-plugin-include": "workspace:~", "@deepseek-ai/cordis-plugin-loader": "workspace:~", "@deepseek-ai/dsh-agent": "workspace:*", "@deepseek-ai/dsh-app-boot": "workspace:*", diff --git a/packages/subagent/subagent-codex/tests/subagent-codex.spec.ts b/packages/subagent/subagent-codex/tests/subagent-codex.spec.ts index 4e267275f5..7dbb71fb64 100644 --- a/packages/subagent/subagent-codex/tests/subagent-codex.spec.ts +++ b/packages/subagent/subagent-codex/tests/subagent-codex.spec.ts @@ -7,7 +7,7 @@ import { PassThrough } from 'node:stream' import { fileURLToPath } from 'node:url' import { Context } from '@deepseek-ai/cordis' import Loader from '@deepseek-ai/cordis-plugin-loader' -import * as yaml from 'js-yaml' +import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include' import { describe, expect, it, vi } from 'vitest' import type { Agent } from '@deepseek-ai/dsh-agent' import type { ContentBlock } from '@deepseek-ai/dsh-llm' @@ -405,7 +405,7 @@ describe('task admission and package contracts', () => { ) } - const parsed = yaml.load(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8')) + const parsed = parseEntryYaml(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8')) expect(parsed).toEqual([{ insert: [ { id: 'subagent-codex', name: '@deepseek-ai/dsh-subagent-codex' }, { id: 'tool-subagent-codex', name: '@deepseek-ai/dsh-tool-subagent', config: { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 00c3c94fb1..23f2f3d7c4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16328,6 +16328,9 @@ importers: '@deepseek-ai/cordis': specifier: workspace:~ version: link:../../../vendor/cordis + '@deepseek-ai/cordis-plugin-include': + specifier: workspace:~ + version: link:../../../vendor/include '@deepseek-ai/dsh-agent': specifier: workspace:* version: link:../../core/agent @@ -16398,6 +16401,9 @@ importers: '@deepseek-ai/cordis': specifier: workspace:~ version: link:../../../vendor/cordis + '@deepseek-ai/cordis-plugin-include': + specifier: workspace:~ + version: link:../../../vendor/include '@deepseek-ai/cordis-plugin-loader': specifier: workspace:~ version: link:../../../vendor/loader diff --git a/vendor/README.md b/vendor/README.md index bb51a6381d..b59f8bd765 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -37,7 +37,7 @@ Keep this log exhaustive — every divergence from upstream must be listed. Each - **V7 · JSDoc enrichment**: added `@param`/`@returns` tags and contract documentation (disposal semantics, waterfall veto, bail conditions, error cases) across the public plugin-author surface — `Context` (class, statics, and the `Context` interface properties incl. `root`), module re-exports, shared utility helpers, `EventsService`, `Fiber`, `RegistryService`, `ReflectService`, `Service`, `LoggerService` and their `declare module './context.ts'` overloads. Loader documentation covers `loader/src/{index,internal,config/entry,config/group,config/isolate,config/tree,config/utils}.ts`, including entry ownership, tree mutation methods, and the `!!js` discriminator. The upstream `EventsService.dispatch()` deprecation annotation is omitted: DSH enumerates callbacks to contain each observer failure independently, which the typed dispatch methods do not provide. Timer retains its local class and helper summaries; its README is local documentation because the upstream package has none. Cosmokit and Schemastery add summaries to their exported helpers, types and namespaces, logger-console to its exporters and config namespace, and HMR to its build-failure logger in `hmr/src/error.ts`. Comment-only; no code changes. Motivation: the website API-reference generator renders these docs and hard-errors on undocumented members. Retire this entry when the enrichment is upstreamed. - **V9 · `hmr/src/index.ts` module-watcher readiness and native paths**: realpath the existing watch base, classify framework modules and attach listeners before reporting readiness, and compare config paths using both canonical and configured spellings. This preserves Node module-cache identity across Windows short-name paths and filesystem aliases. The main watcher uses `ignoreInitial: true` so startup reads do not trigger another refresh; exact profile patch watching is owned by `packages/boot/hmr/src/watch-config.ts`. The Include change listener logs a rejected `Include.refresh()` instead of leaving the rejection unhandled; the rejection reports unsaved runtime changes while Include keeps its running tree. Covered by `packages/boot/hmr/tests/watch-config.spec.ts` and `scripts/cordis-vendor-hmr-include.spec.ts`. - **V10 · Vendored Node-compatible TypeScript**: marked erased imports explicitly across `cordis`, `loader`, `include`, `hmr`, and `schemastery` so Node's native TypeScript transform does not request types as runtime exports. Schemastery's source uses an ESM default export and its package declares `type: module`. Conditional exports select `.mjs` for import and `.cjs` for require; without them, concurrent imports under module-hook hosts reach the CJS entry and can race its require of ESM Cosmokit (`ERR_REQUIRE_ESM_RACE_CONDITION`). -- **V11 · Include patch and YAML exports**: `include/src/index.ts` exports upstream `applyPatches` as `applyEntryPatches`, so `dsh --dump-config` composes entries with the same algorithm that mounting uses. It also exports `parseEntryYaml`, `stringifyEntryYaml` and `entryYamlErrorPosition` over the `!!js` YAML dialect, and `_read()` parses through `parseEntryYaml`, so every DSH reader and writer of Include-dialect YAML uses Include's parser; `stringifyEntryYaml` writes with `noRefs`, while Include's own writer keeps upstream's options. Covered by `packages/boot/app-boot/tests/config-reload.spec.ts`, `scripts/cordis-entry-commit.spec.ts` and `scripts/cordis-entry-yaml.spec.ts`. +- **V11 · Include patch and YAML exports**: `include/src/index.ts` exports upstream `applyPatches` as `applyEntryPatches`, so `dsh --dump-config` composes entries with the same algorithm that mounting uses. It also exports `parseEntryYaml`, `stringifyEntryYaml` and `entryYamlErrorPosition` over the `!!js` YAML dialect, and `_read()` parses through `parseEntryYaml`, so every DSH reader and writer of Include-dialect YAML uses Include's parser; `stringifyEntryYaml` always writes with `noRefs` and offers no option to emit aliases, while Include's own writer keeps upstream's options. Covered by `packages/boot/app-boot/tests/config-reload.spec.ts`, `scripts/cordis-entry-commit.spec.ts` and `scripts/cordis-entry-yaml.spec.ts`. - **V14 · Include persistence results**: `include/src/index.ts` keeps an error for unsaved journal changes. `flush()` retries pending writes and rejects while changes remain unsaved; `stop()` returns the same result and always stops the child tree; a later successful flush clears previous errors. A failed `refresh()` can also reject while runtime changes remain unsaved. Patch-owned changes route to the parent Include, so callers that need them persisted must flush that parent too. The constructor omits upstream's `ctx.hmr.watch(this.filename, () => this.refresh())` registration because neither HMR provider exposes `watch()`; both find each Include by scanning loader entries for its `filename` and call `refresh()`. Ordinary Fiber teardown keeps its error containment. Covered by `scripts/cordis-include-journal.spec.ts` and `packages/host/directory-picker-auto/tests/loader-composition.spec.ts`. - **V15 · Configuration access across Core, Loader, Include and HMR**: rc.11 Core owns raw `Fiber.config`, `internal/config(fiber, next)`, `internal/commit` and awaited `internal/update(config, next)`. Root-fiber candidate resolution remains available without a plugin schema. Local `rawConfig`, `resolveConfig(candidate)` and `effectiveConfig` accessors retain the DSH consumer API. Fiber caches the object passed to activation or a successful update that keeps the instance; candidate resolution is pure, failed or superseded updates cannot replace the cache, and volatile updates retain references. Loader resolves only entry roots and excludes Group/Include tree carriers, so nested `!!js` expressions wait for their own injections. Include retains its tree-carrier marker and public patch exports, and HMR transfers raw config through the accessors. Covered by `scripts/cordis-config-access.spec.ts`, `scripts/cordis-core-lifecycle.spec.ts` and the boot/HMR suites. - **V16 · `cordis/package.json` publishes `src`**: added `src` to the `files` list, joining the other eight vendored packages. Cordis declares `"./src/*": "./src/*"` in its exports, so a tarball without `src` publishes an export map pointing at absent files; the release change judgement also reads `files` to decide whether a diff reaches the payload, and a package whose only published paths are build output has no tracked path to match. diff --git a/vendor/include/src/index.ts b/vendor/include/src/index.ts index 2f905bbe3e..b8e12bd6a7 100644 --- a/vendor/include/src/index.ts +++ b/vendor/include/src/index.ts @@ -41,8 +41,8 @@ export function parseEntryYaml(content: string): unknown { } /** - * Serialize a value in Include's YAML dialect. JavaScript expression nodes are written as `!!js` scalars, and - * repeated object references are written out in full instead of as aliases. + * Serialize a value in Include's YAML dialect. JavaScript expression nodes are written as `!!js` scalars. The output + * never contains anchors or aliases: repeated object references are written out in full, and no option changes this. * @param value - entry list, patch list, or entry fragment to serialize. * @param options - output formatting. * @returns YAML text ending with a newline. @@ -53,7 +53,7 @@ export function stringifyEntryYaml(value: unknown, options: EntryYamlStringifyOp /** * Locate a syntax error thrown by {@link parseEntryYaml}. - * @param error - value thrown by {@link parseEntryYaml}. + * @param error - any caught value; only a parse error thrown by {@link parseEntryYaml} yields a position. * @returns the one-based line and column of the error, or `undefined` when the error carries no source location. */ export function entryYamlErrorPosition(error: unknown): { line: number; column: number } | undefined {