@stofone/dsh-agent-roster 0.10.4 → 0.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,30 @@
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.10.6] - 2026-11-03
8
+
9
+ ### Fixed
10
+
11
+ - **An index cached before an upgrade kept feeding the old shape.** The cache stored an index document
12
+ with no notion of what shape it had, so after upgrading to 0.10.3 — the release that added
13
+ `collection.files` — the panel kept reading a cached index without `files`, fell back to the v1 path, and
14
+ 404'd. Caches now carry `CACHE_VERSION`; a mismatch refetches once.
15
+ - A failed fetch on the v1 fallback path now says *why* it is likely failing: if the collection has no
16
+ `files` mapping, the diagnostic points at a stale index (refresh, or delete `.index-cache`) instead of
17
+ leaving a bare `HTTP 404`.
18
+
19
+ ## [0.10.5] - 2026-11-03
20
+
21
+ ### Fixed
22
+
23
+ - **`roster_index` could not run at all.** Its `execute()` called `loadRemotePanel` and `fetchCollection`,
24
+ neither of which was imported; the module loaded fine and threw `ReferenceError` on the first call.
25
+ It now imports both, and a test executes the tool so this class of breakage cannot pass silently again.
26
+ - **Every public collection answered HTTP 404.** `loadRemotePanel` rebuilds each registry collection from
27
+ an explicit field list, and `files` was not on it — so every URL fell back to the v1 path
28
+ `<id>/roster.yaml`, which no longer exists for a v2 library. The projection keeps `files` now, with a
29
+ test that fails if the field is dropped again.
30
+
7
31
  ## [0.10.4] - 2026-11-03
8
32
 
9
33
  ### Fixed
@@ -500,7 +524,9 @@
500
524
  - 工具返回值含 `undefined` 键,运行时按 `value is not lossless JSON` 整次拒绝;缺失值统一写 `null`,
501
525
  且所有返回值先过 `lib/json.js#lossless`。
502
526
 
503
- [Unreleased]: https://github.com/dsh-agent-roster/dsh-agent-roster/compare/v0.10.4...main
527
+ [Unreleased]: https://github.com/dsh-agent-roster/dsh-agent-roster/compare/v0.10.6...main
528
+ [0.10.6]: https://github.com/dsh-agent-roster/dsh-agent-roster/compare/v0.10.5...v0.10.6
529
+ [0.10.5]: https://github.com/dsh-agent-roster/dsh-agent-roster/compare/v0.10.4...v0.10.5
504
530
  [0.10.4]: https://github.com/dsh-agent-roster/dsh-agent-roster/compare/v0.10.3...v0.10.4
505
531
  [0.10.3]: https://github.com/dsh-agent-roster/dsh-agent-roster/compare/v0.10.2...v0.10.3
506
532
  [0.10.2]: https://github.com/dsh-agent-roster/dsh-agent-roster/compare/v0.10.1...v0.10.2
package/README.md CHANGED
@@ -480,7 +480,7 @@ test/ unit tests
480
480
 
481
481
  Verified on this machine:
482
482
 
483
- - `npm test` — 293/293 passing (format, parse, validate, registry, paths, bridge, verify buckets, digests and provenance, roster diff, capability requirements and the capability gate, library organization, registry schema, lossless JSON, write plan/apply, all routes, panel snapshot and hints, dictionary consistency, tool contracts, client loader contract, library snapshot, config view, package manifest, declared fields and captain block, schema/constant alignment, the v2 role/roster/compiled layers and their schema alignment, v1→v2 migration, run records feeding the plan, remote registry and one-click install).
483
+ - `npm test` — 295/295 passing (format, parse, validate, registry, paths, bridge, verify buckets, digests and provenance, roster diff, capability requirements and the capability gate, library organization, registry schema, lossless JSON, write plan/apply, all routes, panel snapshot and hints, dictionary consistency, tool contracts, client loader contract, library snapshot, config view, package manifest, declared fields and captain block, schema/constant alignment, the v2 role/roster/compiled layers and their schema alignment, v1→v2 migration, run records feeding the plan, remote registry and one-click install).
484
484
  - `npm run smoke` — `apply()` registers all six tools through a real `defineTool` from a DSH bundle; `roster_list` / `roster_show` / `roster_create` / `roster_verify` / `roster_diff` execute, every output survives `lossless` checks, `path` overrides are honored, effect disposal runs cleanly. The same command then loads `client.js` against a stubbed module table and asserts the three slot registrations, style injection and effect disposal.
485
485
  - CLI: `validate --dir examples` returns exit 0 over both example libraries.
486
486
  - Installed into a real profile with the plugin manager (`plugin_manager install_bundle` against this directory → `link:` dependency + bundle entry); the profile re-reads the linked files on restart.
package/README.zh.md CHANGED
@@ -454,7 +454,7 @@ test/ 单测
454
454
 
455
455
  本机已验证:
456
456
 
457
- - `npm test` —— 293/293 通过(格式、解析、校验、扫描、路径、桥接、核对四桶、摘要与溯源、档案差异、能力要求与能力闸门、档案库组织、索引 schema、无损 JSON、写入计划与执行、六条路由、快照与提示、两本词典一致、工具契约、客户端加载器契约、包清单、配置视图、样式 token 约束、声明层字段与队长段、schema 与常量对齐、v2 角色/组装/编译三层及其 schema 对齐、v1→v2 迁移、执行回执并入施工图)。
457
+ - `npm test` —— 295/295 通过(格式、解析、校验、扫描、路径、桥接、核对四桶、摘要与溯源、档案差异、能力要求与能力闸门、档案库组织、索引 schema、无损 JSON、写入计划与执行、六条路由、快照与提示、两本词典一致、工具契约、客户端加载器契约、包清单、配置视图、样式 token 约束、声明层字段与队长段、schema 与常量对齐、v2 角色/组装/编译三层及其 schema 对齐、v1→v2 迁移、执行回执并入施工图)。
458
458
  - `npm run smoke` —— 用真实 DSH bundle 的 `defineTool` 注册六个工具,逐个调用:输出全部通过无损校验、`path` 覆盖生效、释放干净;同一条命令随后用桩模块表加载 `client.js`,断言三处槽位注册、样式只注入一次、effect 可回收。
459
459
  - CLI:`validate --dir examples` 对两座示例库退出码 0。
460
460
  - 用插件管理器真的装进了本机 profile(`plugin_manager install_bundle` 指向本仓库 → `link:` 依赖 + bundle 条目),重启后按链接读取本仓库文件。
package/lib/remote.js CHANGED
@@ -49,6 +49,15 @@ export const DEFAULT_REGISTRY_URL =
49
49
  /** 缓存目录名,放在档案库根下,跟着 `$DSH_HOME` 走。 */
50
50
  export const CACHE_DIR_NAME = ".index-cache";
51
51
 
52
+ /**
53
+ * 索引缓存的语义版本。
54
+ *
55
+ * 缓存里存的是**索引的形状**,而形状会随插件版本变(0.10.3 给 collection 加了 `files`)。
56
+ * 不认版本号的缓存会在升级后继续提供旧形状,表现就是"面板明明装了新版,仍然 404"。
57
+ * 索引语义再变时把这里 +1,老缓存自动失效、重取一次。
58
+ */
59
+ export const CACHE_VERSION = 2;
60
+
52
61
  /** entry 文件所在的仓库前缀(只支持 GitHub raw,不引入 git 协议)。 */
53
62
  export const GITHUB_RAW = "https://raw.githubusercontent.com";
54
63
 
@@ -266,6 +275,7 @@ export async function loadRegistry(source, options = {}) {
266
275
  });
267
276
  }
268
277
  writeCache(cachePath, {
278
+ cacheVersion: CACHE_VERSION,
269
279
  sourceId: source.id,
270
280
  fetchedAt: current,
271
281
  etag: fetched.etag,
@@ -567,6 +577,17 @@ export async function fetchCollection(collection, options = {}) {
567
577
  }
568
578
  if (loaded === null) {
569
579
  diagnostics.push(diagnostic("warn", "collection-fetch-failed", `${collection.id}/${rosterId} 拉取失败:${lastError || "未知原因"}`));
580
+ // 没有 files 映射时退回的是 v1 路径;v2 库在那条路径上必然 404。
581
+ // 这时最可能的原因是"索引是升级前缓存的",提示一句比让用户猜有用。
582
+ if (listedPath === null) {
583
+ diagnostics.push(
584
+ diagnostic(
585
+ "info",
586
+ "index-may-be-stale",
587
+ `${collection.id} 的索引里没有 files 映射,回退到了 v1 路径;若刚升级过插件,先刷新索引(缓存按版本失效,也可删 .index-cache)`,
588
+ ),
589
+ );
590
+ }
570
591
  continue;
571
592
  }
572
593
  const parsed = parseDocumentText(loaded.text, { file: loaded.url });
@@ -669,6 +690,7 @@ export function cachePathFor(cacheDir, id) {
669
690
  function readCache(file) {
670
691
  try {
671
692
  const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
693
+ if (parsed?.cacheVersion !== CACHE_VERSION) return null;
672
694
  if (typeof parsed?.fetchedAt !== "number" || typeof parsed?.document !== "object" || parsed.document === null) return null;
673
695
  return parsed;
674
696
  } catch {
package/lib/service.js CHANGED
@@ -461,6 +461,7 @@ export async function loadRemotePanel(config, options = {}) {
461
461
  repo: collection.repo,
462
462
  ref: collection.ref,
463
463
  path: collection.path,
464
+ files: collection.files,
464
465
  rosters: collection.rosters,
465
466
  tags: collection.tags,
466
467
  license: collection.license,
package/lib/tools.js CHANGED
@@ -19,6 +19,8 @@ import { LIMITS } from "./format.js";
19
19
  import { resolveDirSpec } from "./home.js";
20
20
  import { lossless } from "./json.js";
21
21
  import { findRoster, loadRosterAt, scanRosterLibrary } from "./registry.js";
22
+ import { fetchCollection } from "./remote.js";
23
+ import { loadRemotePanel } from "./service.js";
22
24
  import {
23
25
  renderBridgePlan,
24
26
  renderCapabilityGate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stofone/dsh-agent-roster",
3
- "version": "0.10.4",
3
+ "version": "0.10.6",
4
4
  "description": "多 Agent 团队的静态成员档案定义与校验层:档案库在面板里看得见、改得动,团队成员的人设、模型与工具边界固化成可校验、可版本化的文件,并在 dsh-agent-teams 创建成员时把档案桥接给运行时。",
5
5
  "type": "module",
6
6
  "main": "index.js",