@geekbeer/minion 3.32.0 → 3.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/lib/dag-step-poller.js +2 -1
- package/docs/api-reference.md +39 -1
- package/linux/routes/chat.js +3 -2
- package/linux/workflow-runner.js +4 -2
- package/package.json +1 -1
- package/rules/core.md +4 -0
- package/win/routes/chat.js +3 -2
- package/win/workflow-runner.js +4 -2
|
@@ -385,7 +385,8 @@ function buildTransformSkillContent(instruction, inputData, outputContracts) {
|
|
|
385
385
|
lines.push('| Field | Type | Required | Description |')
|
|
386
386
|
lines.push('|-------|------|----------|-------------|')
|
|
387
387
|
for (const f of oc.contract.fields || []) {
|
|
388
|
-
|
|
388
|
+
const typeDisplay = f.type === 'array' && f.items ? `array<${f.items}>` : f.type
|
|
389
|
+
lines.push(`| ${f.key} | ${typeDisplay} | ${f.required ? 'Yes' : 'No'} | ${f.description || ''} |`)
|
|
389
390
|
}
|
|
390
391
|
}
|
|
391
392
|
}
|
package/docs/api-reference.md
CHANGED
|
@@ -1048,8 +1048,13 @@ PUT `/api/minion/dag-workflows/:id` body(全フィールド optional、省略
|
|
|
1048
1048
|
}
|
|
1049
1049
|
```
|
|
1050
1050
|
|
|
1051
|
-
- `graph` を渡すと draft_graph
|
|
1051
|
+
- `graph` を渡すと draft_graph が上書きされる(構造チェック + structural validation: contract参照の型整合性チェックは実行、ノード完全性チェックは `publish` 時のみ)
|
|
1052
1052
|
- `content` / `change_summary` は `graph` と併せて draft スロットに保存される
|
|
1053
|
+
- **推奨**: graph 全文PUTは**原則使用しない**。代わりに個別APIの `/nodes` `/edges` `/contracts` を使ってインクリメンタルに編集すること。全文PUTは型の取り違え(例: `edge.contract` に配列を渡す)が発生しやすく、バリデーションエラーで400が返る
|
|
1054
|
+
- 具体的な制約:
|
|
1055
|
+
- `edge.contract` は**単一の**Contract名(string)。配列は不可
|
|
1056
|
+
- `contract.fields[].items` は Contract名(string)で、`graph.contracts` 内に存在するものを参照
|
|
1057
|
+
- 不整合があると `{ "error": "...", "details": [...] }` の形式で400エラー
|
|
1053
1058
|
|
|
1054
1059
|
POST `/api/minion/dag-workflows/:id/publish` (body なし):
|
|
1055
1060
|
- 現在の draft_graph を `validateDagGraph` でフル検証
|
|
@@ -1206,15 +1211,48 @@ POST `/api/minion/dag-workflows/:id/publish` (body なし):
|
|
|
1206
1211
|
type: "string" | "number" | "boolean" | "url" | "array" | "object" // フィールド型
|
|
1207
1212
|
description: string // フィールドの説明
|
|
1208
1213
|
required?: boolean // 必須フラグ (省略時 false)
|
|
1214
|
+
items?: string // type='array' 時のみ。要素の型を表す別Contract名
|
|
1209
1215
|
}]
|
|
1210
1216
|
}
|
|
1211
1217
|
```
|
|
1212
1218
|
|
|
1213
1219
|
**注意:**
|
|
1214
1220
|
- エッジに設定する `contract` は `graph.contracts` に存在する名前でなければならない(存在しない名前を指定すると 400 エラー)
|
|
1221
|
+
- **エッジが参照できる Contract は 1 つのみ**。`edge.contract` に配列を渡すことは不可(400エラー)。複数の型構造を束ねたい場合は、それらを束ねた複合Contractを1つ定義してから参照すること
|
|
1215
1222
|
- contract を削除すると、参照しているエッジの `contract` フィールドが自動でクリアされる(DELETE / PUT 共通)
|
|
1216
1223
|
- `validate` エンドポイントはダングリング参照(存在しない contract への参照)をエラーとして報告する
|
|
1217
1224
|
|
|
1225
|
+
**Contract内で List<別Contract> を表現する方法 (items):**
|
|
1226
|
+
|
|
1227
|
+
`type: 'array'` のフィールドに `items` プロパティを設定すると、配列要素の型を別Contractで記述できる。`items` の値は `graph.contracts` 内のContract名。
|
|
1228
|
+
|
|
1229
|
+
```json
|
|
1230
|
+
{
|
|
1231
|
+
"contracts": {
|
|
1232
|
+
"Article": {
|
|
1233
|
+
"description": "個別の記事",
|
|
1234
|
+
"fields": [
|
|
1235
|
+
{ "key": "title", "type": "string", "required": true, "description": "タイトル" },
|
|
1236
|
+
{ "key": "url", "type": "url", "description": "記事URL" }
|
|
1237
|
+
]
|
|
1238
|
+
},
|
|
1239
|
+
"NewsCollection": {
|
|
1240
|
+
"description": "収集されたニュース全体",
|
|
1241
|
+
"fields": [
|
|
1242
|
+
{ "key": "articles", "type": "array", "items": "Article", "required": true, "description": "記事リスト" },
|
|
1243
|
+
{ "key": "collected_at", "type": "string", "required": true, "description": "収集日時" },
|
|
1244
|
+
{ "key": "count", "type": "number", "required": true, "description": "件数" }
|
|
1245
|
+
]
|
|
1246
|
+
}
|
|
1247
|
+
},
|
|
1248
|
+
"edges": [
|
|
1249
|
+
{ "id": "edge_1", "source": "a", "target": "b", "contract": "NewsCollection" }
|
|
1250
|
+
]
|
|
1251
|
+
}
|
|
1252
|
+
```
|
|
1253
|
+
|
|
1254
|
+
この構造で「エッジは単一Contract (`NewsCollection`) を参照し、その内部で `articles` フィールドが `Article[]` 型」という意味になる。
|
|
1255
|
+
|
|
1218
1256
|
##### GET `/api/minion/dag-workflows/:id/contracts` — 全contracts取得
|
|
1219
1257
|
|
|
1220
1258
|
レスポンス: `{ "contracts": { "name": { "description": "...", "fields": [...] }, ... } }`
|
package/linux/routes/chat.js
CHANGED
|
@@ -433,7 +433,7 @@ async function buildContextPrefix(message, context, sessionId, workspaceId) {
|
|
|
433
433
|
` hq fetch dag-workflow ${context.dagWorkflowId}`,
|
|
434
434
|
`プロジェクトコンテキスト:`,
|
|
435
435
|
` hq fetch project-context ${context.projectId}`,
|
|
436
|
-
`PMロールの場合、ノード/エッジ操作API
|
|
436
|
+
`PMロールの場合、ノード/エッジ操作APIでインクリメンタルに編集してください(**強く推奨**、全文PUTは型取り違えが起きやすいためエラーになりがち):`,
|
|
437
437
|
` hq dag add-node ${context.dagWorkflowId} <body.json> # ノード追加`,
|
|
438
438
|
` hq dag update-node ${context.dagWorkflowId} <node-id> <body.json> # ノード更新`,
|
|
439
439
|
` hq dag remove-node ${context.dagWorkflowId} <node-id> # ノード削除`,
|
|
@@ -441,7 +441,8 @@ async function buildContextPrefix(message, context, sessionId, workspaceId) {
|
|
|
441
441
|
` hq dag remove-edge ${context.dagWorkflowId} <edge-id> # エッジ削除`,
|
|
442
442
|
` hq dag validate ${context.dagWorkflowId} # ドラフト検証(公開せず)`,
|
|
443
443
|
` hq publish dag-workflow ${context.dagWorkflowId} # 公開`,
|
|
444
|
-
`
|
|
444
|
+
`Contract編集時の重要な規則: edge.contract は単一Contract名(string)のみ、配列不可。List<X> は type:"array" + items:"X" で表現。詳細は ~/.minion/docs/api-reference.md の「Contracts API」参照。`,
|
|
445
|
+
`graph JSON 全文PUTは非推奨: hq put dag-workflow ${context.dagWorkflowId} <body.json>`,
|
|
445
446
|
`新規作成は: hq create dag-workflow <body.json>`,
|
|
446
447
|
`プロジェクト内の DAG ワークフロー一覧: hq list dag-workflows ${context.projectId}`,
|
|
447
448
|
`DAG の構造(nodes/edges/node types/scope_path 等)や実行フローの詳細は ~/.minion/docs/api-reference.md の「DAG Workflows」セクション、および ~/.minion/docs/task-guides.md の「DAG ワークフロー」セクションを参照してください。`,
|
package/linux/workflow-runner.js
CHANGED
|
@@ -106,7 +106,8 @@ async function executeWorkflowSession(workflow, executionId, skillNames, options
|
|
|
106
106
|
contractContext += `### ${ic.contract_name}\n${ic.contract.description || ''}\n`
|
|
107
107
|
contractContext += '| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n'
|
|
108
108
|
for (const f of ic.contract.fields || []) {
|
|
109
|
-
|
|
109
|
+
const typeDisplay = f.type === 'array' && f.items ? `array<${f.items}>` : f.type
|
|
110
|
+
contractContext += `| ${f.key} | ${typeDisplay} | ${f.required ? 'Yes' : 'No'} | ${f.description || ''} |\n`
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
contractContext += '\n'
|
|
@@ -117,7 +118,8 @@ async function executeWorkflowSession(workflow, executionId, skillNames, options
|
|
|
117
118
|
contractContext += `### ${oc.contract_name}\n${oc.contract.description || ''}\n`
|
|
118
119
|
contractContext += '| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n'
|
|
119
120
|
for (const f of oc.contract.fields || []) {
|
|
120
|
-
|
|
121
|
+
const typeDisplay = f.type === 'array' && f.items ? `array<${f.items}>` : f.type
|
|
122
|
+
contractContext += `| ${f.key} | ${typeDisplay} | ${f.required ? 'Yes' : 'No'} | ${f.description || ''} |\n`
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
contractContext += '\n'
|
package/package.json
CHANGED
package/rules/core.md
CHANGED
|
@@ -28,6 +28,10 @@ Minion
|
|
|
28
28
|
|
|
29
29
|
- **Workflow**: プロジェクトスコープ。線形パイプライン形式のバージョン管理ワークフロー。ミニオンAPIで push/fetch 可能。
|
|
30
30
|
- **DAG Workflow**: プロジェクトスコープ。ノード/エッジで依存関係を表現する新方式。fan-out / join / conditional / transform / review をサポート。作成・編集はHQダッシュボードのみ、ミニオンは `dag-step-poller` で自動実行。詳細は `~/.minion/docs/api-reference.md` の「DAG Workflows」と `~/.minion/docs/task-guides.md` の「DAG ワークフロー」を参照。
|
|
31
|
+
- **PMロールで編集する場合の重要な規則**:
|
|
32
|
+
- ノード/エッジ/contract の追加・更新は**個別API** (`/nodes` `/edges` `/contracts`) を使うこと。`PUT /dag-workflows/:id` による graph 全文PUTは型の取り違えが起きやすく、バリデーションエラーで 400 が返る
|
|
33
|
+
- `edge.contract` は**単一のContract名(string)**のみ。配列は不可。複数の型構造を束ねたい場合は、それらを内包する複合Contractを1つ定義する
|
|
34
|
+
- Contract内で `List<別Contract>` を表現するには `type: 'array'` + `items: "別Contract名"` を使う(詳細は `~/.minion/docs/api-reference.md` の「Contracts API」を参照)
|
|
31
35
|
- **Routine**: ミニオンスコープ。ミニオンローカルの定期タスク。
|
|
32
36
|
- **Workspace**: ミニオンは複数のワークスペースに所属でき、スキルやプロジェクトはワークスペース単位でスコープされる。チャットセッションもワークスペース別に分離される。所属ワークスペースはハートビートで自動同期され、`hq list workspaces` で確認できる。
|
|
33
37
|
- ミニオンは複数プロジェクトに `pm`、`engineer`、`accountant` として参加できる。
|
package/win/routes/chat.js
CHANGED
|
@@ -494,7 +494,7 @@ async function buildContextPrefix(message, context, sessionId, workspaceId) {
|
|
|
494
494
|
` hq fetch dag-workflow ${context.dagWorkflowId}`,
|
|
495
495
|
`プロジェクトコンテキスト:`,
|
|
496
496
|
` hq fetch project-context ${context.projectId}`,
|
|
497
|
-
`PMロールの場合、ノード/エッジ操作API
|
|
497
|
+
`PMロールの場合、ノード/エッジ操作APIでインクリメンタルに編集してください(**強く推奨**、全文PUTは型取り違えが起きやすいためエラーになりがち):`,
|
|
498
498
|
` hq dag add-node ${context.dagWorkflowId} <body.json> # ノード追加`,
|
|
499
499
|
` hq dag update-node ${context.dagWorkflowId} <node-id> <body.json> # ノード更新`,
|
|
500
500
|
` hq dag remove-node ${context.dagWorkflowId} <node-id> # ノード削除`,
|
|
@@ -502,7 +502,8 @@ async function buildContextPrefix(message, context, sessionId, workspaceId) {
|
|
|
502
502
|
` hq dag remove-edge ${context.dagWorkflowId} <edge-id> # エッジ削除`,
|
|
503
503
|
` hq dag validate ${context.dagWorkflowId} # ドラフト検証(公開せず)`,
|
|
504
504
|
` hq publish dag-workflow ${context.dagWorkflowId} # 公開`,
|
|
505
|
-
`
|
|
505
|
+
`Contract編集時の重要な規則: edge.contract は単一Contract名(string)のみ、配列不可。List<X> は type:"array" + items:"X" で表現。詳細は ~/.minion/docs/api-reference.md の「Contracts API」参照。`,
|
|
506
|
+
`graph JSON 全文PUTは非推奨: hq put dag-workflow ${context.dagWorkflowId} <body.json>`,
|
|
506
507
|
`新規作成は: hq create dag-workflow <body.json>`,
|
|
507
508
|
`プロジェクト内の DAG ワークフロー一覧: hq list dag-workflows ${context.projectId}`,
|
|
508
509
|
`DAG の構造(nodes/edges/node types/scope_path 等)や実行フローの詳細は ~/.minion/docs/api-reference.md の「DAG Workflows」セクション、および ~/.minion/docs/task-guides.md の「DAG ワークフロー」セクションを参照してください。`,
|
package/win/workflow-runner.js
CHANGED
|
@@ -113,7 +113,8 @@ async function executeWorkflowSession(workflow, executionId, skillNames, options
|
|
|
113
113
|
contractContext += `### ${ic.contract_name}\n${ic.contract.description || ''}\n`
|
|
114
114
|
contractContext += '| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n'
|
|
115
115
|
for (const f of ic.contract.fields || []) {
|
|
116
|
-
|
|
116
|
+
const typeDisplay = f.type === 'array' && f.items ? `array<${f.items}>` : f.type
|
|
117
|
+
contractContext += `| ${f.key} | ${typeDisplay} | ${f.required ? 'Yes' : 'No'} | ${f.description || ''} |\n`
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
contractContext += '\n'
|
|
@@ -124,7 +125,8 @@ async function executeWorkflowSession(workflow, executionId, skillNames, options
|
|
|
124
125
|
contractContext += `### ${oc.contract_name}\n${oc.contract.description || ''}\n`
|
|
125
126
|
contractContext += '| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n'
|
|
126
127
|
for (const f of oc.contract.fields || []) {
|
|
127
|
-
|
|
128
|
+
const typeDisplay = f.type === 'array' && f.items ? `array<${f.items}>` : f.type
|
|
129
|
+
contractContext += `| ${f.key} | ${typeDisplay} | ${f.required ? 'Yes' : 'No'} | ${f.description || ''} |\n`
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
132
|
contractContext += '\n'
|