dsh-plugin-agentflow 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/runtime/boards.mjs +35 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-agentflow",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "DeepSeek Harness tool plugin: run AgentFlow (material-canvas agent orchestrator) boards from the model",
5
5
  "keywords": [
6
6
  "dsh",
@@ -13,6 +13,7 @@
13
13
  import fs from 'node:fs/promises';
14
14
  import path from 'node:path';
15
15
  import { dataDir, writeJsonAtomic, exclusive } from './store.mjs';
16
+ import { orchestratorPersona, orchestratorCriteria } from './preset-gen.mjs';
16
17
 
17
18
  export const FLOW_BOARD_ID = 'flow-agentflow';
18
19
 
@@ -247,6 +248,38 @@ function slugify(name) {
247
248
  return s || 'board';
248
249
  }
249
250
 
251
+ /**
252
+ * 新建画布的默认根节点(调度卡 / 对话入口)。
253
+ *
254
+ * 产品约定:画布必须有一张且只有一张调度根节点,它承载人格、是对话入口。
255
+ * 新建时直接给一张,用户不用先手动派生再改类型;子节点仍然由用户自己派生。
256
+ * 根节点在后端删不掉(DELETE 命中 orchestrator 返回 400),所以不会退化成空画布。
257
+ */
258
+ function defaultRootNode(name) {
259
+ return {
260
+ id: 'orchestrator',
261
+ label: `${name} · 调度`,
262
+ type: 'orchestrator',
263
+ provider: '',
264
+ model: '',
265
+ reasoningEffort: '',
266
+ fallback: [],
267
+ fallbackEfforts: {},
268
+ task: orchestratorPersona({ name }),
269
+ criteria: orchestratorCriteria(),
270
+ skills: [],
271
+ tools: [],
272
+ verify: '',
273
+ content: '',
274
+ status: 'idle',
275
+ usage: null,
276
+ error: null,
277
+ verdict: null,
278
+ x: 80,
279
+ y: 80,
280
+ };
281
+ }
282
+
250
283
  /** 新建画布:presetId 有值就用它当 id(冲突报 409),否则由名字生成唯一 id。 */
251
284
  export async function createBoard({ name, presetId } = {}) {
252
285
  const safeName = String(name || '').trim() || '未命名画布';
@@ -273,7 +306,8 @@ export async function createBoard({ name, presetId } = {}) {
273
306
  }
274
307
 
275
308
  const now = Date.now();
276
- const board = { id, name: safeName, nodes: [], edges: [] };
309
+ // 新建画布默认带一张调度根节点(对话入口),子节点由用户自己派生
310
+ const board = { id, name: safeName, nodes: [defaultRootNode(safeName)], edges: [] };
277
311
  const meta = { id, name: safeName, presetId: wantedPreset, createdAt: now, updatedAt: now };
278
312
  await writeJsonAtomic(boardFile(id), board);
279
313
  await writeIndex({