@geekbeer/minion 3.29.1 → 3.29.4

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.
@@ -1066,8 +1066,12 @@ POST `/api/minion/dag-workflows/:id/publish` (body なし):
1066
1066
  | PATCH | `/api/minion/dag-workflows/:id/nodes/:nodeId` | ノードのプロパティを更新 |
1067
1067
  | DELETE | `/api/minion/dag-workflows/:id/nodes/:nodeId` | ノードを削除(自動再接続対応) |
1068
1068
  | POST | `/api/minion/dag-workflows/:id/edges` | エッジを追加 |
1069
- | PATCH | `/api/minion/dag-workflows/:id/edges/:edgeId` | エッジの kind / condition_label を更新 |
1069
+ | PATCH | `/api/minion/dag-workflows/:id/edges/:edgeId` | エッジの kind / condition_label / contract を更新 |
1070
1070
  | DELETE | `/api/minion/dag-workflows/:id/edges/:edgeId` | エッジを削除 |
1071
+ | GET | `/api/minion/dag-workflows/:id/contracts` | 全contractsを取得 |
1072
+ | PUT | `/api/minion/dag-workflows/:id/contracts` | 全contractsを上書き |
1073
+ | POST | `/api/minion/dag-workflows/:id/contracts` | 個別contractを追加/更新 |
1074
+ | DELETE | `/api/minion/dag-workflows/:id/contracts` | 個別contractを削除 |
1071
1075
  | POST | `/api/minion/dag-workflows/:id/validate` | ドラフトをフル検証(公開せず) |
1072
1076
 
1073
1077
  #### POST `/api/minion/dag-workflows/:id/nodes` — ノード追加
@@ -1166,6 +1170,7 @@ POST `/api/minion/dag-workflows/:id/publish` (body なし):
1166
1170
  - `source`, `target` (必須): 既存ノードのID
1167
1171
  - `kind` (任意): `normal` (default) | `approved` | `revision`
1168
1172
  - `condition_label` (任意): conditional ノードの分岐ラベル
1173
+ - `contract` (任意): `graph.contracts` 内の型名への参照
1169
1174
  - `id` (任意): 省略時は `edge_1`, `edge_2`, ... で自動採番
1170
1175
 
1171
1176
  #### PATCH `/api/minion/dag-workflows/:id/edges/:edgeId` — エッジ更新
@@ -1173,18 +1178,85 @@ POST `/api/minion/dag-workflows/:id/publish` (body なし):
1173
1178
  ```json
1174
1179
  {
1175
1180
  "kind": "approved",
1176
- "condition_label": "success"
1181
+ "condition_label": "success",
1182
+ "contract": "prototype"
1177
1183
  }
1178
1184
  ```
1179
1185
 
1180
1186
  - `kind` (任意): `normal` | `approved` | `revision`
1181
1187
  - `condition_label` (任意): 分岐ラベル。`null` を渡すとクリア
1188
+ - `contract` (任意): contracts 内の型名。`null` を渡すとクリア
1182
1189
  - 指定したフィールドのみ上書き(未指定フィールドは変更しない)
1183
1190
 
1184
1191
  #### DELETE `/api/minion/dag-workflows/:id/edges/:edgeId` — エッジ削除
1185
1192
 
1186
1193
  - エッジIDを指定して削除
1187
1194
 
1195
+ #### Contracts API
1196
+
1197
+ エッジを流れるデータの型を定義するための API。contracts は `graph.contracts` に保存される。
1198
+
1199
+ **Contract のスキーマ:**
1200
+
1201
+ ```typescript
1202
+ {
1203
+ description: string // contract の説明
1204
+ fields: [{
1205
+ key: string // フィールド名
1206
+ type: "string" | "number" | "boolean" | "url" | "array" | "object" // フィールド型
1207
+ description: string // フィールドの説明
1208
+ required?: boolean // 必須フラグ (省略時 false)
1209
+ }]
1210
+ }
1211
+ ```
1212
+
1213
+ **注意:**
1214
+ - エッジに設定する `contract` は `graph.contracts` に存在する名前でなければならない(存在しない名前を指定すると 400 エラー)
1215
+ - contract を削除すると、参照しているエッジの `contract` フィールドが自動でクリアされる(DELETE / PUT 共通)
1216
+ - `validate` エンドポイントはダングリング参照(存在しない contract への参照)をエラーとして報告する
1217
+
1218
+ ##### GET `/api/minion/dag-workflows/:id/contracts` — 全contracts取得
1219
+
1220
+ レスポンス: `{ "contracts": { "name": { "description": "...", "fields": [...] }, ... } }`
1221
+
1222
+ ##### PUT `/api/minion/dag-workflows/:id/contracts` — 全contracts上書き
1223
+
1224
+ ```json
1225
+ {
1226
+ "contracts": {
1227
+ "prototype": {
1228
+ "description": "プロトタイプ成果物",
1229
+ "fields": [
1230
+ { "key": "git_url", "type": "url", "description": "リポジトリURL", "required": true },
1231
+ { "key": "preview_url", "type": "url", "description": "プレビューURL" }
1232
+ ]
1233
+ }
1234
+ }
1235
+ }
1236
+ ```
1237
+
1238
+ ##### POST `/api/minion/dag-workflows/:id/contracts` — 個別contract追加/更新
1239
+
1240
+ ```json
1241
+ {
1242
+ "name": "prototype",
1243
+ "contract": {
1244
+ "description": "プロトタイプ成果物",
1245
+ "fields": [
1246
+ { "key": "git_url", "type": "url", "description": "リポジトリURL", "required": true }
1247
+ ]
1248
+ }
1249
+ }
1250
+ ```
1251
+
1252
+ ##### DELETE `/api/minion/dag-workflows/:id/contracts` — 個別contract削除
1253
+
1254
+ ```json
1255
+ { "name": "prototype" }
1256
+ ```
1257
+
1258
+ 参照しているエッジの `contract` フィールドも自動でクリアされる。レスポンスの `cleared_edges` にクリアされたエッジIDの一覧が含まれる。
1259
+
1188
1260
  #### POST `/api/minion/dag-workflows/:id/validate` — ドラフト検証
1189
1261
 
1190
1262
  body なし。現在のドラフトを `validateDagGraph` でフル検証し結果を返す。**公開はしない**。
@@ -1245,6 +1317,9 @@ hq dag update-node <wf-id> fan_out_1 /tmp/u.json
1245
1317
 
1246
1318
  テンプレート内部のノード/エッジを個別操作するAPIは現在ない。テンプレートは `template` フィールドの全体上書きで更新すること。テンプレートは start/end ノードを持たない sub-graph であり、バリデーション時に再帰的に検証される。
1247
1319
 
1320
+ > **⚠️ 重要: テンプレート内に `start` / `end` ノードを配置してはいけない。**
1321
+ > テンプレートのエントリポイントとエグジットポイントは、エッジ構造から自動検出される(incoming edge がないノード = エントリ、outgoing edge がないノード = エグジット)。`start` / `end` はトップレベル DAG 専用のノードタイプであり、テンプレート内に含めるとバリデーションエラーになる。テンプレート内では `skill`, `conditional`, `transform`, `review` 等の実行ノードのみ使用すること。
1322
+
1248
1323
  ### ミニオン CLI ラッパー
1249
1324
 
1250
1325
  以下の `hq` サブコマンドが上記エンドポイントを呼び出す。いずれもリクエスト送信前にローカルで JSON 構文検証を行う。
@@ -345,8 +345,11 @@ hq dag remove-edge <wf-id> edge_3
345
345
 
346
346
  **fan_out テンプレート編集:**
347
347
 
348
+ > **⚠️ テンプレート内に `start` / `end` ノードを入れないこと。** テンプレートのエントリ/エグジットはエッジ構造から自動検出される。`start` / `end` はトップレベル DAG 専用であり、テンプレート内に含めるとバリデーションエラーになる。`skill`, `conditional`, `transform`, `review` 等の実行ノードのみ使用すること。
349
+
348
350
  ```bash
349
351
  # fan_out ノードの template を PATCH で上書き
352
+ # ※ start/end ノードは不要。実行ノードのみ配置する
350
353
  cat > /tmp/t.json <<'EOF'
351
354
  {
352
355
  "template": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekbeer/minion",
3
- "version": "3.29.1",
3
+ "version": "3.29.4",
4
4
  "description": "AI Agent runtime for Minion - manages status and skill deployment on VPS",
5
5
  "main": "linux/server.js",
6
6
  "bin": {