@agentstorm/server 0.2.6 → 0.2.8

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.
@@ -80,6 +80,19 @@ export declare class GlobalTemplateLibrary {
80
80
  private ensureSeedTemplates;
81
81
  private migrateGeneralWorkflowId;
82
82
  private retireLegacySeedTemplates;
83
+ /**
84
+ * v5 was the last product-specific SONiC/TCSGW seed. Replace only the exact
85
+ * checked-in semantic document; any graph, layout, Prompt, or composition
86
+ * edit changes the fingerprint and remains user-owned. Canonicalization
87
+ * intentionally ignores JSON property order and per-Agent runtime settings,
88
+ * which are preserved during the upgrade.
89
+ * The internal ID stays stable because deletion records and package sources
90
+ * may already reference it.
91
+ */
92
+ private upgradeLegacyDevelopmentWorkflowSeed;
93
+ private upgradeBuiltinTemplateNames;
94
+ private upgradeBuiltinTemplateName;
95
+ private replaceWithCurrentSeed;
83
96
  private normalizeLegacyManifest;
84
97
  private templateDir;
85
98
  private writeDocument;
@@ -12,6 +12,9 @@ const MAX_ASSET_BYTES = 8 * 1024 * 1024;
12
12
  const TEMPLATE_ID_PATTERN = /^[a-z0-9][a-z0-9._-]{0,63}$/;
13
13
  const BUILTIN_TEMPLATE_IDS = ["general-workflow", "sonic-pipeline"];
14
14
  const BUILTIN_TEMPLATE_ROOT = resolveBuiltinTemplateRoot();
15
+ const LEGACY_SONIC_PIPELINE_SEED_FINGERPRINT = "5e88fd35e66dcea3a6ad17f250cc6415df68d66b524680d18ece8267e0ff3456";
16
+ const LEGACY_GENERAL_WORKFLOW_NAME_FINGERPRINT = "6e0fbfbb5c98ac15bccb348a1132b87d1b625ad7befe35d8049328340dfd6cbb";
17
+ const LEGACY_DEVELOPMENT_WORKFLOW_NAME_FINGERPRINT = "f4672d3ccaf29d42d5ee9573ee74381c71327ee90d5e785f89d7187f00b8f0e8";
15
18
  const RETIRED_SEED_TEMPLATES = {
16
19
  "grpc-migration": "gRPC migration 示例",
17
20
  "review-loop": "审核循环",
@@ -76,6 +79,8 @@ export class GlobalTemplateLibrary {
76
79
  }
77
80
  this.migrateGeneralWorkflowId();
78
81
  this.retireLegacySeedTemplates();
82
+ this.upgradeLegacyDevelopmentWorkflowSeed();
83
+ this.upgradeBuiltinTemplateNames();
79
84
  this.ensureSeedTemplates();
80
85
  }
81
86
  list() {
@@ -247,7 +252,7 @@ export class GlobalTemplateLibrary {
247
252
  catch {
248
253
  return;
249
254
  }
250
- if (manifest.name !== "通用work flow")
255
+ if (manifest.name !== "通用work flow" && manifest.name !== "通用workflow")
251
256
  return;
252
257
  fs.renameSync(legacyDir, currentDir);
253
258
  writeJsonAtomic(path.join(currentDir, "manifest.json"), {
@@ -272,6 +277,81 @@ export class GlobalTemplateLibrary {
272
277
  }
273
278
  }
274
279
  }
280
+ /**
281
+ * v5 was the last product-specific SONiC/TCSGW seed. Replace only the exact
282
+ * checked-in semantic document; any graph, layout, Prompt, or composition
283
+ * edit changes the fingerprint and remains user-owned. Canonicalization
284
+ * intentionally ignores JSON property order and per-Agent runtime settings,
285
+ * which are preserved during the upgrade.
286
+ * The internal ID stays stable because deletion records and package sources
287
+ * may already reference it.
288
+ */
289
+ upgradeLegacyDevelopmentWorkflowSeed() {
290
+ const id = "sonic-pipeline";
291
+ if (!fs.existsSync(this.templateDir(id)))
292
+ return;
293
+ let current;
294
+ try {
295
+ current = this.get(id);
296
+ }
297
+ catch {
298
+ return;
299
+ }
300
+ if (current.name !== "SONiC TCSGW 开发流水线" ||
301
+ current.version !== 5 ||
302
+ legacyBuiltinTemplateFingerprint(current.spec, current.layout, current.assets) !==
303
+ LEGACY_SONIC_PIPELINE_SEED_FINGERPRINT) {
304
+ return;
305
+ }
306
+ this.replaceWithCurrentSeed(id, current);
307
+ }
308
+ upgradeBuiltinTemplateNames() {
309
+ this.upgradeBuiltinTemplateName({
310
+ id: "general-workflow",
311
+ previousName: "通用work flow",
312
+ previousVersion: 20,
313
+ fingerprint: LEGACY_GENERAL_WORKFLOW_NAME_FINGERPRINT,
314
+ });
315
+ this.upgradeBuiltinTemplateName({
316
+ id: "sonic-pipeline",
317
+ previousName: "开发流水线",
318
+ previousVersion: 6,
319
+ fingerprint: LEGACY_DEVELOPMENT_WORKFLOW_NAME_FINGERPRINT,
320
+ });
321
+ }
322
+ upgradeBuiltinTemplateName(options) {
323
+ if (!fs.existsSync(this.templateDir(options.id)))
324
+ return;
325
+ let current;
326
+ try {
327
+ current = this.get(options.id);
328
+ }
329
+ catch {
330
+ return;
331
+ }
332
+ if (current.name !== options.previousName ||
333
+ current.version !== options.previousVersion ||
334
+ legacyBuiltinTemplateFingerprint(current.spec, current.layout, current.assets) !==
335
+ options.fingerprint) {
336
+ return;
337
+ }
338
+ this.replaceWithCurrentSeed(options.id, current);
339
+ }
340
+ replaceWithCurrentSeed(id, current) {
341
+ const seed = DEFAULT_TEMPLATES.find((candidate) => candidate.id === id);
342
+ if (!seed)
343
+ return;
344
+ const parsed = parseInput(seed);
345
+ this.writeDocument({
346
+ schemaVersion: 1,
347
+ id,
348
+ name: parsed.name,
349
+ description: parsed.description,
350
+ version: seed.seedVersion,
351
+ seeded: true,
352
+ updatedAt: seed.seedUpdatedAt || nowBeijing(),
353
+ }, preserveAgentRuntimeSettings(parsed.spec, current.spec), parsed.layout, parsed.assets);
354
+ }
275
355
  normalizeLegacyManifest(id) {
276
356
  const manifestPath = path.join(this.templateDir(id), "manifest.json");
277
357
  if (!fs.existsSync(manifestPath) ||
@@ -475,6 +555,49 @@ function templateEtag(manifest, spec, layout, assets) {
475
555
  function etagOf(raw) {
476
556
  return `"${createHash("sha256").update(raw).digest("hex").slice(0, 16)}"`;
477
557
  }
558
+ function templateContentFingerprint(spec, layout, assets) {
559
+ const canonical = canonicalizeJson({ spec, layout, assets });
560
+ return createHash("sha256").update(JSON.stringify(canonical)).digest("hex");
561
+ }
562
+ function legacyBuiltinTemplateFingerprint(spec, layout, assets) {
563
+ const normalizedSpec = {
564
+ ...spec,
565
+ agents: Object.fromEntries(Object.entries(spec.agents).map(([id, config]) => [
566
+ id,
567
+ {
568
+ backend: "paseo",
569
+ provider: "<runtime>",
570
+ model: "<runtime>",
571
+ ...(config.prompt === undefined ? {} : { prompt: config.prompt }),
572
+ ...(config.promptComposition === undefined
573
+ ? {}
574
+ : { promptComposition: config.promptComposition }),
575
+ },
576
+ ])),
577
+ };
578
+ return templateContentFingerprint(normalizedSpec, layout, assets);
579
+ }
580
+ function preserveAgentRuntimeSettings(seed, current) {
581
+ return {
582
+ ...seed,
583
+ agents: Object.fromEntries(Object.entries(seed.agents).map(([id, seedConfig]) => {
584
+ const currentConfig = current.agents[id];
585
+ if (!currentConfig)
586
+ return [id, seedConfig];
587
+ const { prompt: _currentPrompt, promptComposition: _currentComposition, ...runtimeSettings } = currentConfig;
588
+ return [id, { ...seedConfig, ...runtimeSettings }];
589
+ })),
590
+ };
591
+ }
592
+ function canonicalizeJson(value) {
593
+ if (Array.isArray(value))
594
+ return value.map(canonicalizeJson);
595
+ if (!value || typeof value !== "object")
596
+ return value;
597
+ return Object.fromEntries(Object.keys(value)
598
+ .sort()
599
+ .map((key) => [key, canonicalizeJson(value[key])]));
600
+ }
478
601
  function readJson(filePath, fallback) {
479
602
  if (!fs.existsSync(filePath)) {
480
603
  if (fallback !== undefined)
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "id": "general-workflow",
4
- "name": "通用work flow",
4
+ "name": "通用workflow",
5
5
  "description": "通用 Plan → 审批 → Execute 流水线。",
6
- "version": 20,
6
+ "version": 21,
7
7
  "seeded": true,
8
- "updatedAt": "2026-08-09T16:15:02.000+08:00"
8
+ "updatedAt": "2026-08-21T10:38:16+08:00"
9
9
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "1",
3
- "name": "通用work flow",
3
+ "name": "通用workflow",
4
4
  "vars": {
5
5
  "goal": "Inspect this workspace, plan the requested migration, implement it, review it, and run relevant tests."
6
6
  },
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "id": "sonic-pipeline",
4
- "name": "SONiC TCSGW 开发流水线",
5
- "description": "需求与项目分析 → 人工审核 PRD → 任务拆分 → 人工审核计划 → 逐任务开发与 Code Review。",
6
- "version": 5,
4
+ "name": "开发workflow",
5
+ "description": "通用需求与项目分析 → 人工审核 PRD → 任务拆分 → 人工审核计划 → 逐任务开发与 Code Review。",
6
+ "version": 7,
7
7
  "seeded": true,
8
- "updatedAt": "2026-08-10T16:53:00+08:00"
8
+ "updatedAt": "2026-08-21T10:38:16+08:00"
9
9
  }
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: analysis
3
- description: 分析用户需求与 SONiC/TCSGW 真实项目,形成可审核的需求分析报告和 PRD
3
+ description: 分析用户需求与当前真实项目,形成可审核的需求分析报告和 PRD
4
4
  role: analyst
5
5
  ---
6
6
 
7
- # SONiC/TCSGW Analysis
7
+ # Analysis
8
8
 
9
- 你负责流水线的需求分析阶段。先理解用户目标,再调查真实工作区和 SONiC/TCSGW 项目,形成供人审核的需求分析报告与 PRD。本阶段不拆分执行任务、不修改业务代码,也不提交 PlanResult
9
+ 你负责流水线的需求分析阶段。先理解用户目标,再调查真实工作区与当前项目,形成供人审核的需求分析报告与 PRD。本阶段不拆分执行任务、不修改业务代码,也不提交 PlanResult。该流程适用于功能开发、缺陷修复、重构和迁移,不假定固定业务或技术栈。
10
10
 
11
11
  ## 输入与调查
12
12
 
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: code-reviewer
3
- description: 逐条验证 SONiC/TCSGW 任务验收标准并审查实际改动
3
+ description: 逐条验证当前任务验收标准并审查实际改动
4
4
  role: reviewer
5
5
  ---
6
6
 
7
- # SONiC/TCSGW Code Reviewer
7
+ # Code Reviewer
8
8
 
9
9
  你负责当前子任务的最终代码审查。读取任务描述、验收标准、Worker Summary 与 `resources`、PRD、实际 diff 和相关源码;不能只依据 Worker 的自述作出结论。
10
10
 
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: planner
3
- description: 根据已批准的需求分析与 PRD,将 SONiC/TCSGW 需求拆分为可独立验收的执行任务
3
+ description: 根据已批准的需求分析与 PRD,将目标拆分为可独立验收的执行任务
4
4
  role: planner
5
5
  ---
6
6
 
7
- # SONiC/TCSGW Planner
7
+ # Planner
8
8
 
9
9
  你的职责是把已经通过人工审批的需求分析报告和 PRD 转换为可执行、可再次审批、可独立验收的任务计划。规划阶段不修改业务代码,不重新发明需求。
10
10
 
@@ -13,7 +13,7 @@ role: planner
13
13
  1. 优先读取 Analysis 节点通过 `resources` 交付的 `requirements-analysis.md`、`prd.md`、节点 Summary 和关键证据。若这些审批输入缺失或相互矛盾,不得猜测,应明确报告阻塞点。
14
14
  2. 结合当前工作区复核任务涉及的源码、组件边界、构建与测试入口。已批准 PRD 是需求基线,真实代码是现状基线。
15
15
  3. 阅读上一轮计划审批意见;重新规划时逐条回应,保留仍然有效的任务,只修订需要变化的部分。
16
- 4. 如果项目存在 `.agentstorm/knowledge/sonic-pipeline.md`,可将其中经过验证的经验作为补充,但代码与已批准 PRD 始终优先。
16
+ 4. 按需读取 `.agentstorm/knowledge/` 下与当前任务相关的 Markdown 经验;只采纳与真实代码和已批准 PRD 一致的内容。
17
17
 
18
18
  ## 任务切分规则
19
19
 
@@ -29,9 +29,9 @@ role: planner
29
29
 
30
30
  ## 计划产物
31
31
 
32
- - 在当前节点的 `resourceRoot` 下生成 `sonic-plan.md`,包含需求覆盖关系、任务与依赖、验收标准、风险、验证策略和人工介入点。
32
+ - 在当前节点的 `resourceRoot` 下生成 `implementation-plan.md`,包含需求覆盖关系、任务与依赖、验收标准、风险、验证策略和人工介入点。
33
33
  - 提交完整 PlanResult:`revision`、`summary`、`tasks`、`removedTaskDisplayIds`、`resources`。每个任务使用稳定且唯一的 `displayId`,并填写 `title`、`description`、`acceptanceCriteria`、`dependencyDisplayIds`;任务相关输入或交付文件放入任务级 `resources`。仅在重新规划时,才把明确需要删除且尚未启动的 pending 任务写入 `removedTaskDisplayIds`;正常规划使用空数组。
34
- - 计划级 `resources` 必须包含节点 Summary、`sonic-plan.md`、已批准的 `requirements-analysis.md` 与 `prd.md`,以及审批者需要查看的关键证据。正文和结构化 PlanResult 必须一致。
34
+ - 计划级 `resources` 必须包含节点 Summary、`implementation-plan.md`、已批准的 `requirements-analysis.md` 与 `prd.md`,以及审批者需要查看的关键证据。正文和结构化 PlanResult 必须一致。
35
35
  - 不创建旧版任务清单,不写死 Summary 路径,也不手工推进节点;AgentStorm 负责保存计划、创建任务、发起第二次人工审批和后续调度。
36
36
 
37
37
  提交前自检:已批准需求是否全部映射到任务或非目标,任务是否真正垂直且大小合理,路径与命令是否存在,依赖是否无环,验收是否可以由 Execute Agent 直接验证。
@@ -1,17 +1,17 @@
1
1
  ---
2
2
  name: worker
3
- description: 按当前任务的验收标准实现并验证 SONiC/TCSGW 垂直切片
3
+ description: 按当前任务的验收标准实现并验证一个完整垂直切片
4
4
  role: worker
5
5
  ---
6
6
 
7
- # SONiC/TCSGW Worker
7
+ # Worker
8
8
 
9
9
  一次只处理当前子任务。读取任务描述、验收标准、依赖任务交付的 `resources`、PRD 以及审查反馈;不得自行扩大到其他计划任务。
10
10
 
11
11
  ## 工作方式
12
12
 
13
13
  1. 先检查工作区状态并保护用户已有修改。读取目标文件及 1–2 个相近实现,理解项目约定后再动手。
14
- 2. 如存在 `.agentstorm/knowledge/sonic-pipeline.md`,只采纳与当前代码和 PRD 一致的经验。任务强调的 Skills 应优先使用;未列出的 Provider 可用 Skills 仍可按需使用。
14
+ 2. 按需读取 `.agentstorm/knowledge/` 下与当前任务相关的 Markdown 经验,只采纳与当前代码和 PRD 一致的内容。任务强调的 Skills 应优先使用;未列出的 Provider 可用 Skills 仍可按需使用。
15
15
  3. 先思考最小完整方案,保持实现简单、改动聚焦、符合现有结构。不要顺手重构无关代码,不清理或覆盖用户文件。
16
16
  4. 实现当前垂直切片,并逐条验证验收标准。优先使用任务指定及项目已有的检查;使用等价或更强验证时说明替代原因和证据。
17
17
  5. 对本地可修复失败最多进行 5 轮有依据的诊断与修改;仍失败时报告真实错误、复现命令、已尝试方案和剩余风险,不伪造成功。
@@ -21,5 +21,5 @@ role: worker
21
21
 
22
22
  - 在节点 Summary 中按验收标准逐项记录实现位置、实际命令、结果和遗留风险。Summary 的路径由 AgentStorm 统一提供,不要自行创建第二份固定 Summary。
23
23
  - `resources` 应包含下一节点需要读取的 Summary 和其他关键文件/证据;不要只给口头结论。
24
- - 只有确实可复用且不明显的 SONiC/TCSGW 知识才可追加到 `.agentstorm/knowledge/sonic-pipeline.md`,不得把任务进度或一次性故障写成知识。
24
+ - 只有确实可复用且不明显的经验才可写入 `.agentstorm/knowledge/` 下合适的 Markdown 文件;不得把任务进度、敏感信息或一次性故障写成共享经验。
25
25
  - 不创建旧版 `worker-result.json`,不执行 git commit 或 push,也不手工推进流水线。
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "version": "1",
3
- "name": "SONiC TCSGW 开发流水线",
3
+ "name": "开发workflow",
4
4
  "vars": {
5
- "goal": "先分析用户需求与 SONiC/TCSGW 代码库并形成需求分析报告和 PRD;需求审批通过后拆分执行任务,计划再次审批通过后逐任务实现、自测并进行严格 Code Review。"
5
+ "goal": "先分析用户需求与当前项目并形成需求分析报告和 PRD;需求审批通过后拆分执行任务,计划再次审批通过后逐任务实现、自测并进行严格 Code Review。"
6
6
  },
7
7
  "agents": {
8
8
  "analysis": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentstorm/server",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "AgentStorm resident Pipeline service",
5
5
  "files": [
6
6
  "dist"
@@ -19,9 +19,9 @@
19
19
  "access": "public"
20
20
  },
21
21
  "dependencies": {
22
- "@agentstorm/agent-runtime": "0.2.6",
23
- "@agentstorm/kernel": "0.2.6",
24
- "@agentstorm/protocol": "0.2.6",
22
+ "@agentstorm/agent-runtime": "0.2.8",
23
+ "@agentstorm/kernel": "0.2.8",
24
+ "@agentstorm/protocol": "0.2.8",
25
25
  "express": "^4.21.0"
26
26
  },
27
27
  "license": "AGPL-3.0-or-later",