@geekbeer/minion 3.52.0 → 3.55.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.
- package/.env.example +7 -0
- package/core/db/migrations/20260508000000_page_recipes.js +33 -0
- package/core/lib/dag-step-poller.js +245 -1
- package/core/lib/web-extract/extractor.js +142 -0
- package/core/lib/web-extract/fingerprint.js +63 -0
- package/core/lib/web-extract/html-cleaner.js +72 -0
- package/core/lib/web-extract/index.js +21 -0
- package/core/lib/web-extract/playwright-runner.js +129 -0
- package/core/lib/web-extract/recipe-generator.js +247 -0
- package/core/lib/web-extract/url-normalize.js +90 -0
- package/core/routes/web.js +94 -0
- package/core/stores/page-recipe-store.js +143 -0
- package/docs/api-reference.md +106 -297
- package/docs/task-guides.md +134 -75
- package/linux/routes/chat.js +37 -20
- package/linux/server.js +2 -0
- package/mac/server.js +2 -0
- package/package.json +6 -2
- package/rules/core.md +26 -9
- package/win/routes/chat.js +38 -16
- package/win/server.js +2 -0
package/docs/api-reference.md
CHANGED
|
@@ -52,20 +52,6 @@ hq list workspaces
|
|
|
52
52
|
| `POST /api/skills/fetch/:name` | `workspace_id` | クエリパラメータ |
|
|
53
53
|
| `GET /api/skills/remote` | `workspace_id` | クエリパラメータ |
|
|
54
54
|
|
|
55
|
-
### Workflows
|
|
56
|
-
|
|
57
|
-
v3.38.0 以降、workflows はワークスペース単位でスコープされる。各workflowレコードは `workspace_id` を持ち、未指定は `""`(未所属/legacy)として扱われる。
|
|
58
|
-
|
|
59
|
-
| Method | Endpoint | Description |
|
|
60
|
-
|--------|----------|-------------|
|
|
61
|
-
| GET | `/api/workflows` | List local workflows with next_run. Optional `?workspace_id=` filter (omit for cross-workspace view) |
|
|
62
|
-
| POST | `/api/workflows` | Receive/upsert workflows (from HQ). Each incoming workflow should carry `workspace_id` |
|
|
63
|
-
| POST | `/api/workflows/push/:name` | Push local workflow to HQ |
|
|
64
|
-
| POST | `/api/workflows/fetch/:name` | Fetch workflow from HQ and deploy locally (+ pipeline skills). HQ response includes `workspace_id` |
|
|
65
|
-
| GET | `/api/workflows/remote` | List workflows on HQ |
|
|
66
|
-
| DELETE | `/api/workflows/:id` | Remove a local workflow |
|
|
67
|
-
| POST | `/api/workflows/trigger` | Manual trigger. Body: `{workflow_id}` |
|
|
68
|
-
|
|
69
55
|
### Routines
|
|
70
56
|
|
|
71
57
|
v3.38.0 以降、routines はワークスペース単位でスコープされる。各routineレコードは `workspace_id` を持ち、未指定は `""`(未所属/legacy)として扱われる。
|
|
@@ -82,11 +68,11 @@ v3.38.0 以降、routines はワークスペース単位でスコープされる
|
|
|
82
68
|
|
|
83
69
|
### Executions
|
|
84
70
|
|
|
85
|
-
v3.38.0 以降、executions は親
|
|
71
|
+
v3.38.0 以降、executions は親 routine から `workspace_id` を継承する。
|
|
86
72
|
|
|
87
73
|
| Method | Endpoint | Description |
|
|
88
74
|
|--------|----------|-------------|
|
|
89
|
-
| GET | `/api/executions` | List execution history (`?limit=50`,
|
|
75
|
+
| GET | `/api/executions` | List execution history (`?limit=50`, optional `?workspace_id=`) |
|
|
90
76
|
| GET | `/api/executions/:id` | Get single execution (includes `workspace_id`) |
|
|
91
77
|
| GET | `/api/executions/:id/log` | Get execution log content (`?tail=N`) |
|
|
92
78
|
| POST | `/api/executions/:id/outcome` | Report outcome (no auth). Body: `{outcome, summary?, details?}` |
|
|
@@ -429,6 +415,8 @@ GET `/api/daemons/status` response:
|
|
|
429
415
|
"success": true,
|
|
430
416
|
"daemons": {
|
|
431
417
|
"step_poller": { "running": true, "last_poll_at": "2026-03-19T15:30:00.000Z" },
|
|
418
|
+
"dag_step_poller": { "running": true, "last_poll_at": "2026-03-19T15:30:02.000Z" },
|
|
419
|
+
"board_task_poller": { "running": true, "last_poll_at": "2026-03-19T15:30:08.000Z" },
|
|
432
420
|
"revision_watcher": { "running": true, "last_poll_at": "2026-03-19T15:30:05.000Z" },
|
|
433
421
|
"thread_watcher": { "running": true, "last_poll_at": "2026-03-19T15:29:52.000Z" },
|
|
434
422
|
"reflection_scheduler": { "running": true, "next_run": "2026-03-20T03:00:00.000Z" },
|
|
@@ -439,12 +427,16 @@ GET `/api/daemons/status` response:
|
|
|
439
427
|
|
|
440
428
|
| Daemon | 概要 |
|
|
441
429
|
|--------|------|
|
|
442
|
-
| `
|
|
443
|
-
| `
|
|
430
|
+
| `dag_step_poller` | DAGノード(skill/transform/script)の取得・claim・実行(30秒間隔) |
|
|
431
|
+
| `board_task_poller` | アクティブスプリント内のボードタスク自動着手(30秒間隔、v3.46.0〜) |
|
|
432
|
+
| `step_poller` | 旧式ワークフローステップ用ポーラー(30秒間隔。サポート打ち切り後はpending返却なし、互換目的で稼働) |
|
|
433
|
+
| `revision_watcher` | 旧式ワークフローのリビジョン要求検知(30秒間隔、PMのみ。DAGの差し戻しはサーバ側カスケードで処理) |
|
|
444
434
|
| `thread_watcher` | プロジェクト・ワークスペーススレッドの監視・LLM評価(15秒間隔) |
|
|
445
435
|
| `reflection_scheduler` | 1日1回の振り返り(cron) |
|
|
446
436
|
| `heartbeat` | HQへのハートビート(30秒間隔) |
|
|
447
437
|
|
|
438
|
+
> Note: `dag_cron_poller`(v3.51.0〜、PMロールがcron-enabled DAGを発火する)は内部的には起動しているが、`/api/daemons/status` のレスポンスには含まれていない(既知のギャップ)。稼働確認は `~/.minion/logs/agent.log` を grep する。
|
|
439
|
+
|
|
448
440
|
### Threads (スレッド)
|
|
449
441
|
|
|
450
442
|
ワークスペースレベルのコミュニケーションチャネル。ブロッカー共有やチーム議論に使う。
|
|
@@ -513,7 +505,7 @@ POST `/api/threads` body (プロジェクト紐づきディスカッション):
|
|
|
513
505
|
| `title` | string | Yes | スレッドの要約 |
|
|
514
506
|
| `content` | string | Yes | スレッド本文(thread_messagesの最初のメッセージとして保存) |
|
|
515
507
|
| `mentions` | string[] | No | メンション対象。形式: `role:engineer`, `role:pm`, `minion:<minion_id>`, `user` |
|
|
516
|
-
| `context` | object | No | 任意のメタデータ(category, urgency,
|
|
508
|
+
| `context` | object | No | 任意のメタデータ(category, urgency, dag_execution_id等) |
|
|
517
509
|
|
|
518
510
|
**プロジェクト紐づけの使い分け:**
|
|
519
511
|
- ワークフロー実行中(プロジェクトあり)→ `project_ids: ["uuid"]`
|
|
@@ -696,6 +688,72 @@ PUT `/api/email/inbox/:id` body:
|
|
|
696
688
|
|
|
697
689
|
Note: 既読メールは受信後90日で自動削除される。未読メールは保持される。
|
|
698
690
|
|
|
691
|
+
### Web Page Extraction 🧪 (experimental, v3.53.0〜)
|
|
692
|
+
|
|
693
|
+
Web ページの読み取り・要約・情報抽出をミニオン内のサブプロセスで完結させ、メインの Claude Code セッションには結果 JSON だけを返すための実験的 API。Playwright MCP で DOM 全体がチャットに流れ込みトークン肥大化を起こす問題への対処として導入。
|
|
694
|
+
|
|
695
|
+
| Method | Endpoint | Description |
|
|
696
|
+
|--------|----------|-------------|
|
|
697
|
+
| POST | `/api/web/extract` | URL を抽出済み JSON に変換 (タイトル・本文・主要構造化データ) |
|
|
698
|
+
| GET | `/api/web/recipes` | キャッシュされたレシピ一覧 (debug) |
|
|
699
|
+
| DELETE | `/api/web/recipes?template=...&fingerprint=...` | レシピを削除 |
|
|
700
|
+
|
|
701
|
+
**前提条件 (LLM の解決順):**
|
|
702
|
+
1. **primary LLM プラグインが設定されていればそれを使用** (推奨)。`PUT /api/llm/config` で `claude` 等を primary に指定すると、CLI の認証情報 (`~/.claude/.credentials.json`) がそのまま使われる。API キーの別途設定は不要。
|
|
703
|
+
2. primary 未設定で `ANTHROPIC_API_KEY` シークレットが設定されていれば、そちらを fallback として使用 (Anthropic Messages API の tool_use で JSON Schema を強制)。
|
|
704
|
+
3. どちらもなければ 503 (`LLM_UNAVAILABLE`) を返す。
|
|
705
|
+
|
|
706
|
+
その他の前提:
|
|
707
|
+
- ホスト上で `npx playwright install chromium` を実行済みであること (未実行の場合 503 が返る)
|
|
708
|
+
|
|
709
|
+
**`POST /api/web/extract` リクエスト:**
|
|
710
|
+
```json
|
|
711
|
+
{
|
|
712
|
+
"url": "https://example.com/article/123",
|
|
713
|
+
"hint": "本文と著者を抽出してほしい (任意, 抽出フィールドのヒント)"
|
|
714
|
+
}
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
**レスポンス (success):**
|
|
718
|
+
```json
|
|
719
|
+
{
|
|
720
|
+
"success": true,
|
|
721
|
+
"experimental": true,
|
|
722
|
+
"url": "https://example.com/article/123",
|
|
723
|
+
"finalUrl": "https://example.com/article/123",
|
|
724
|
+
"statusCode": 200,
|
|
725
|
+
"recipeMode": "cold",
|
|
726
|
+
"recipeId": "example.com/article/:id#abc123def456",
|
|
727
|
+
"pageType": "article",
|
|
728
|
+
"title": "...",
|
|
729
|
+
"content": "Markdown 本文...",
|
|
730
|
+
"structured": { "title": "...", "author": "...", "publishedAt": "..." },
|
|
731
|
+
"selectors": { "title": { "selector": "h1" }, "author": { "selector": "a[rel=author]" } }
|
|
732
|
+
}
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
**動作:**
|
|
736
|
+
- 初回アクセス (cold): Playwright でレンダリング → Readability で本文抽出 → Anthropic Haiku でセレクタ生成 → SQLite (`page_recipes`) に保存 → セレクタで再抽出して返却
|
|
737
|
+
- 2回目以降 (hot): URL 正規化・テンプレート化 → DOM フィンガープリントで保存済みレシピを照合 → セレクタで抽出のみ (LLM 呼び出しなし)
|
|
738
|
+
- セルフヒール: hot 実行で空結果が返ったら `fail_count++`、3回失敗で破棄して次回 cold 再生成
|
|
739
|
+
|
|
740
|
+
**URL 正規化ルール:**
|
|
741
|
+
- `utm_*` `fbclid` `gclid` `ref` 等のトラッキングクエリは除去
|
|
742
|
+
- `page` `p` `offset` 等のページネーション値は `:n` プレースホルダ化
|
|
743
|
+
- パスセグメントは数値→`:id`、UUID→`:uuid`、20文字以上の英数字→`:slug` に置換
|
|
744
|
+
- 例: `https://www.lancers.jp/work/proposal/123456?utm_source=foo&page=2` → `lancers.jp/work/proposal/:id?page=:n`
|
|
745
|
+
|
|
746
|
+
**エラー:**
|
|
747
|
+
- 401: APIトークン不正
|
|
748
|
+
- 400: URL 欠落・不正
|
|
749
|
+
- 502: primary LLM 呼び出し失敗 (`PRIMARY_LLM_FAILED`) / 返却 JSON が parse 不能 (`PRIMARY_LLM_BAD_JSON`)
|
|
750
|
+
- 503: Playwright 未インストール (`PLAYWRIGHT_UNAVAILABLE`) / LLM 未設定 (`LLM_UNAVAILABLE`)
|
|
751
|
+
- 500: 抽出失敗 (タイムアウト等)
|
|
752
|
+
|
|
753
|
+
**注意 (experimental):**
|
|
754
|
+
- レスポンス形状・URL 正規化ルール・キャッシュスキーマは予告なく変更される可能性がある
|
|
755
|
+
- 認証付きページ (ログイン必須) は対応外。Cookie や対話的操作が必要な場合は Playwright MCP を使用すること
|
|
756
|
+
|
|
699
757
|
### Commands
|
|
700
758
|
|
|
701
759
|
| Method | Endpoint | Description |
|
|
@@ -751,7 +809,7 @@ Response:
|
|
|
751
809
|
]
|
|
752
810
|
```
|
|
753
811
|
|
|
754
|
-
`role` is
|
|
812
|
+
`role` is one of `"pm"` (project manager), `"engineer"`, or `"accountant"`.
|
|
755
813
|
|
|
756
814
|
### Project Context
|
|
757
815
|
|
|
@@ -789,6 +847,18 @@ Response:
|
|
|
789
847
|
|
|
790
848
|
プロジェクト変数はワークフロー実行時に `template_vars` としてミニオンに渡され、スキルの `{{VAR_NAME}}` テンプレートを展開する。
|
|
791
849
|
|
|
850
|
+
#### 変数とシークレットの違い
|
|
851
|
+
|
|
852
|
+
**変数**(ミニオン変数・プロジェクト変数)はスキル本文の `{{VAR_NAME}}` テンプレートとして実行時に展開される。スキル作成時にパラメータ化したい値は `{{変数名}}` で記述する。
|
|
853
|
+
|
|
854
|
+
**シークレット**(ミニオンシークレット)は環境変数 `$SECRET_NAME` としてプロセスに注入される。APIキーやパスワード等の機密情報に使用する。テンプレート展開は行われない。
|
|
855
|
+
|
|
856
|
+
#### テンプレート変数の展開優先順位
|
|
857
|
+
|
|
858
|
+
同名の変数が複数のスコープで定義されている場合、以下の順序で上書きされる:
|
|
859
|
+
1. ミニオン変数(最低優先)
|
|
860
|
+
2. プロジェクト変数(最優先)
|
|
861
|
+
|
|
792
862
|
### Project Tasks
|
|
793
863
|
|
|
794
864
|
タスクは5段階Kanban (`backlog`/`todo`/`doing`/`review`/`done`)で管理される。親子関係は2階層まで(孫タスク禁止)。担当は **ミニオンか人間の二択**(両方は不可、後勝ち null)。
|
|
@@ -980,282 +1050,11 @@ Response:
|
|
|
980
1050
|
- 子タスクが `milestone_id=null` でも、親 EPIC の `milestone_id` を継承して集計される(effective milestone)。つまり「親に MVP を付ければ配下の子タスクも MVP 進捗に含まれる」。
|
|
981
1051
|
- `summary.by_status` は従来どおり全タスク(親含む)で計上する。
|
|
982
1052
|
|
|
983
|
-
### Workflow Variables (PM only)
|
|
984
|
-
|
|
985
|
-
| Method | Endpoint | Description |
|
|
986
|
-
|--------|----------|-------------|
|
|
987
|
-
| POST | `/api/minion/me/project/[id]/workflows/[wfId]/variables/[key]` | ワークフロー変数を設定(upsert) |
|
|
988
|
-
| DELETE | `/api/minion/me/project/[id]/workflows/[wfId]/variables/[key]` | ワークフロー変数を削除 |
|
|
989
|
-
|
|
990
|
-
POST body:
|
|
991
|
-
```json
|
|
992
|
-
{
|
|
993
|
-
"value": "variable value (max 2000 chars)"
|
|
994
|
-
}
|
|
995
|
-
```
|
|
996
|
-
|
|
997
|
-
Key format: `/^[A-Za-z_][A-Za-z0-9_]{0,99}$/`
|
|
998
|
-
|
|
999
|
-
Response:
|
|
1000
|
-
```json
|
|
1001
|
-
{
|
|
1002
|
-
"success": true,
|
|
1003
|
-
"key": "MY_VAR",
|
|
1004
|
-
"value": "variable value"
|
|
1005
|
-
}
|
|
1006
|
-
```
|
|
1007
|
-
|
|
1008
|
-
ワークフロー変数はプロジェクト変数を上書きする(同名キーの場合)。
|
|
1009
|
-
|
|
1010
|
-
#### 変数とシークレットの違い
|
|
1011
|
-
|
|
1012
|
-
**変数**(ミニオン変数・プロジェクト変数・ワークフロー変数)はスキル本文の `{{VAR_NAME}}` テンプレートとして実行時に展開される。スキル作成時にパラメータ化したい値は `{{変数名}}` で記述する。
|
|
1013
|
-
|
|
1014
|
-
**シークレット**(ミニオンシークレット)は環境変数 `$SECRET_NAME` としてプロセスに注入される。APIキーやパスワード等の機密情報に使用する。テンプレート展開は行われない。
|
|
1015
|
-
|
|
1016
|
-
#### テンプレート変数の展開優先順位
|
|
1017
|
-
|
|
1018
|
-
同名の変数が複数のスコープで定義されている場合、以下の順序で上書きされる:
|
|
1019
|
-
1. ミニオン変数(最低優先)
|
|
1020
|
-
2. プロジェクト変数
|
|
1021
|
-
3. ワークフロー変数(最優先)
|
|
1022
|
-
|
|
1023
|
-
### Workflows (project-scoped, versioned)
|
|
1024
|
-
|
|
1025
|
-
| Method | Endpoint | Description |
|
|
1026
|
-
|--------|----------|-------------|
|
|
1027
|
-
| GET | `/api/minion/workflows` | 参加プロジェクトのアクティブなワークフロー一覧 |
|
|
1028
|
-
| POST | `/api/minion/workflows` | ワークフローを push(新規作成 or 新バージョン) |
|
|
1029
|
-
|
|
1030
|
-
GET Response:
|
|
1031
|
-
```json
|
|
1032
|
-
{
|
|
1033
|
-
"workflows": [
|
|
1034
|
-
{
|
|
1035
|
-
"name": "daily-check",
|
|
1036
|
-
"pipeline_skill_names": ["skill-1", "skill-2"],
|
|
1037
|
-
"pipeline": [
|
|
1038
|
-
{
|
|
1039
|
-
"skill_version_id": "uuid",
|
|
1040
|
-
"skill_name": "skill-1",
|
|
1041
|
-
"skill_display_name": "Skill One",
|
|
1042
|
-
"skill_version": 3,
|
|
1043
|
-
"assigned_role": "engineer",
|
|
1044
|
-
"requires_review": false,
|
|
1045
|
-
"is_my_step": true
|
|
1046
|
-
}
|
|
1047
|
-
],
|
|
1048
|
-
"content": "...",
|
|
1049
|
-
"version": 3,
|
|
1050
|
-
"cron_expression": "0 9 * * *",
|
|
1051
|
-
"project_id": "uuid",
|
|
1052
|
-
"created_at": "..."
|
|
1053
|
-
}
|
|
1054
|
-
]
|
|
1055
|
-
}
|
|
1056
|
-
```
|
|
1057
|
-
|
|
1058
|
-
各ステップの `is_my_step` はミニオン自身のプロジェクトロールと `assigned_role` の一致を示す。
|
|
1059
|
-
|
|
1060
|
-
POST body (push):
|
|
1061
|
-
```json
|
|
1062
|
-
{
|
|
1063
|
-
"name": "my-workflow",
|
|
1064
|
-
"pipeline_skill_names": ["skill-1", "skill-2"],
|
|
1065
|
-
"content": "Workflow description",
|
|
1066
|
-
"project_id": "uuid",
|
|
1067
|
-
"change_summary": "Added skill-2 to pipeline"
|
|
1068
|
-
}
|
|
1069
|
-
```
|
|
1070
|
-
|
|
1071
|
-
push するとパイプライン内のスキル名が `skill_version_id` に解決され、新バージョンが自動作成される。
|
|
1072
|
-
|
|
1073
|
-
### Workflow Structure
|
|
1074
|
-
|
|
1075
|
-
```json
|
|
1076
|
-
{
|
|
1077
|
-
"name": "my-workflow",
|
|
1078
|
-
"pipeline_skill_names": ["skill-1", "skill-2"],
|
|
1079
|
-
"pipeline": [
|
|
1080
|
-
{
|
|
1081
|
-
"skill_version_id": "uuid",
|
|
1082
|
-
"skill_name": "skill-1",
|
|
1083
|
-
"skill_display_name": "Skill One",
|
|
1084
|
-
"skill_version": 2,
|
|
1085
|
-
"assigned_role": "engineer",
|
|
1086
|
-
"requires_review": false,
|
|
1087
|
-
"is_my_step": true
|
|
1088
|
-
}
|
|
1089
|
-
],
|
|
1090
|
-
"content": "Markdown description of the workflow",
|
|
1091
|
-
"version": 2,
|
|
1092
|
-
"cron_expression": "0 9 * * *",
|
|
1093
|
-
"project_id": "uuid"
|
|
1094
|
-
}
|
|
1095
|
-
```
|
|
1096
|
-
|
|
1097
|
-
| Field | Type | Description |
|
|
1098
|
-
|-------|------|-------------|
|
|
1099
|
-
| `name` | string | Slug identifier (`/^[a-z0-9-]+$/`) |
|
|
1100
|
-
| `pipeline_skill_names` | string[] | Ordered skill names (for display/push) |
|
|
1101
|
-
| `pipeline` | PipelineStep[] | Resolved pipeline with version IDs and roles |
|
|
1102
|
-
| `content` | string | Markdown body describing the workflow |
|
|
1103
|
-
| `version` | number | Current version number (auto-incremented on push) |
|
|
1104
|
-
| `cron_expression` | string\|null | Cron schedule (null = manual/one-shot only) |
|
|
1105
|
-
| `project_id` | string | UUID of the parent project |
|
|
1106
|
-
|
|
1107
|
-
### Pipeline Step Fields
|
|
1108
|
-
|
|
1109
|
-
| Field | Type | Description |
|
|
1110
|
-
|-------|------|-------------|
|
|
1111
|
-
| `skill_version_id` | string | UUID of the specific skill version |
|
|
1112
|
-
| `skill_name` | string | Skill slug name |
|
|
1113
|
-
| `skill_display_name` | string | Human-readable skill name |
|
|
1114
|
-
| `skill_version` | number | Skill version number |
|
|
1115
|
-
| `assigned_role` | string | `"pm"` or `"engineer"` — who executes this step |
|
|
1116
|
-
| `requires_review` | boolean | If true, human review required after completion |
|
|
1117
|
-
| `is_my_step` | boolean | Whether this minion's role matches assigned_role |
|
|
1118
|
-
|
|
1119
|
-
### Syncing Workflows with HQ
|
|
1120
|
-
|
|
1121
|
-
- `POST /api/workflows/push/:name` — Push local workflow to HQ. Pipeline skills are auto-pushed first.
|
|
1122
|
-
- `POST /api/workflows/fetch/:name` — Fetch workflow from HQ. Missing pipeline skills are auto-fetched.
|
|
1123
|
-
- `GET /api/workflows/remote` — List workflows available on HQ.
|
|
1124
|
-
|
|
1125
|
-
Pipeline skills must be deployed locally (in `~/.claude/skills/`) before pushing a workflow.
|
|
1126
|
-
|
|
1127
|
-
### Pending Steps (軽量ポーリング)
|
|
1128
|
-
|
|
1129
|
-
| Method | Endpoint | Description |
|
|
1130
|
-
|--------|----------|-------------|
|
|
1131
|
-
| GET | `/api/minion/pending-steps` | 自分が実行すべき pending ステップ一覧 |
|
|
1132
|
-
|
|
1133
|
-
**このエンドポイントはミニオンエージェント(非AI)による高頻度ポーリング用。**
|
|
1134
|
-
|
|
1135
|
-
Response:
|
|
1136
|
-
```json
|
|
1137
|
-
{
|
|
1138
|
-
"steps": [
|
|
1139
|
-
{
|
|
1140
|
-
"step_execution_id": "uuid",
|
|
1141
|
-
"execution_id": "uuid",
|
|
1142
|
-
"workflow_name": "daily-check",
|
|
1143
|
-
"step_index": 0,
|
|
1144
|
-
"skill_version_id": "uuid",
|
|
1145
|
-
"assigned_role": "engineer"
|
|
1146
|
-
}
|
|
1147
|
-
]
|
|
1148
|
-
}
|
|
1149
|
-
```
|
|
1150
|
-
|
|
1151
|
-
返却条件:
|
|
1152
|
-
- `assigned_role` がミニオンのプロジェクトロールと一致
|
|
1153
|
-
- ステップの `status` が `pending`
|
|
1154
|
-
- 前ステップが全て `completed`(`requires_review` の場合は `approved` も必要)
|
|
1155
|
-
|
|
1156
|
-
### Workflow Execution Recording
|
|
1157
|
-
|
|
1158
|
-
| Method | Endpoint | Description |
|
|
1159
|
-
|--------|----------|-------------|
|
|
1160
|
-
| POST | `/api/minion/workflow-execution` | 新規 execution 開始を記録 |
|
|
1161
|
-
| POST | `/api/minion/execution` | ステップ実行状況を HQ に報告 |
|
|
1162
|
-
|
|
1163
|
-
POST `/api/minion/workflow-execution` body:
|
|
1164
|
-
```json
|
|
1165
|
-
{
|
|
1166
|
-
"workflow_version_id": "uuid"
|
|
1167
|
-
}
|
|
1168
|
-
```
|
|
1169
|
-
|
|
1170
|
-
Response:
|
|
1171
|
-
```json
|
|
1172
|
-
{
|
|
1173
|
-
"execution_id": "uuid",
|
|
1174
|
-
"status": "running",
|
|
1175
|
-
"steps_count": 3
|
|
1176
|
-
}
|
|
1177
|
-
```
|
|
1178
|
-
|
|
1179
|
-
POST `/api/minion/execution` body:
|
|
1180
|
-
```json
|
|
1181
|
-
{
|
|
1182
|
-
"workflow_execution_id": "uuid",
|
|
1183
|
-
"steps": [
|
|
1184
|
-
{
|
|
1185
|
-
"step_index": 0,
|
|
1186
|
-
"skill_version_id": "uuid",
|
|
1187
|
-
"assigned_role": "engineer",
|
|
1188
|
-
"status": "completed",
|
|
1189
|
-
"outcome": "success",
|
|
1190
|
-
"started_at": "...",
|
|
1191
|
-
"completed_at": "..."
|
|
1192
|
-
}
|
|
1193
|
-
],
|
|
1194
|
-
"status": "running",
|
|
1195
|
-
"started_at": "..."
|
|
1196
|
-
}
|
|
1197
|
-
```
|
|
1198
|
-
|
|
1199
|
-
### Pending Revisions (PM のみ)
|
|
1200
|
-
|
|
1201
|
-
レビューで `revision_requested` になったステップを検知する。ミニオンの `revision-watcher` デーモンが30秒ごとにポーリングし、LLM で差し戻し先ステップを判断した上で `/api/minion/revision-reset` を呼び出す。
|
|
1202
|
-
|
|
1203
|
-
| Method | Endpoint | Description |
|
|
1204
|
-
|--------|----------|-------------|
|
|
1205
|
-
| GET | `/api/minion/pending-revisions` | `revision_requested` 状態のステップ一覧(PMのプロジェクトのみ) |
|
|
1206
|
-
| POST | `/api/minion/revision-reset` | 差し戻し対象ステップを `pending` に戻す |
|
|
1207
|
-
|
|
1208
|
-
GET Response:
|
|
1209
|
-
```json
|
|
1210
|
-
{
|
|
1211
|
-
"revisions": [
|
|
1212
|
-
{
|
|
1213
|
-
"execution_id": "uuid",
|
|
1214
|
-
"workflow_name": "daily-check",
|
|
1215
|
-
"revision_step_index": 2,
|
|
1216
|
-
"review_comment": "string (レビュアーのフィードバック)",
|
|
1217
|
-
"pipeline": [
|
|
1218
|
-
{
|
|
1219
|
-
"step_index": 0,
|
|
1220
|
-
"skill_version_id": "uuid",
|
|
1221
|
-
"skill_name": "string|null",
|
|
1222
|
-
"assigned_role": "pm|engineer|accountant"
|
|
1223
|
-
}
|
|
1224
|
-
]
|
|
1225
|
-
}
|
|
1226
|
-
]
|
|
1227
|
-
}
|
|
1228
|
-
```
|
|
1229
|
-
|
|
1230
|
-
POST `/api/minion/revision-reset` body:
|
|
1231
|
-
```json
|
|
1232
|
-
{
|
|
1233
|
-
"execution_id": "uuid",
|
|
1234
|
-
"target_step_index": 0,
|
|
1235
|
-
"revision_step_index": 2,
|
|
1236
|
-
"revision_feedback": "string (省略可、target step の review_comment に保存)"
|
|
1237
|
-
}
|
|
1238
|
-
```
|
|
1239
|
-
|
|
1240
|
-
- `target_step_index` は差し戻し先(やり直し起点)のインデックス
|
|
1241
|
-
- `revision_step_index` は差し戻しを要求されたレビューステップのインデックス(`target_step_index <= revision_step_index`)
|
|
1242
|
-
- target から revision までのステップが `pending` に戻り、`revision_feedback` が再実行時のコンテキストとして注入される
|
|
1243
|
-
|
|
1244
|
-
Response:
|
|
1245
|
-
```json
|
|
1246
|
-
{
|
|
1247
|
-
"success": true,
|
|
1248
|
-
"reset_count": 3,
|
|
1249
|
-
"target_step_index": 0,
|
|
1250
|
-
"revision_step_index": 2
|
|
1251
|
-
}
|
|
1252
|
-
```
|
|
1253
|
-
|
|
1254
1053
|
---
|
|
1255
1054
|
|
|
1256
1055
|
## DAG Workflows (HQ, ノード/エッジ方式)
|
|
1257
1056
|
|
|
1258
|
-
DAG
|
|
1057
|
+
DAG ワークフローは有向非巡回グラフでスキル間の依存関係を表現するワークフローです。HQダッシュボードの DAG エディタで作成・編集できるほか、ミニオンAPI経由でも JSON ベースで編集可能(PMロールのみ)。ミニオンはプルベースのポーリングで pending ノードを検出・実行します。
|
|
1259
1058
|
|
|
1260
1059
|
### 編集エンドポイント (PMロール限定)
|
|
1261
1060
|
|
|
@@ -1341,7 +1140,7 @@ POST `/api/minion/dag-workflows/:id/publish` (body なし):
|
|
|
1341
1140
|
}
|
|
1342
1141
|
```
|
|
1343
1142
|
|
|
1344
|
-
- `type` (必須): `start` | `end` | `skill` | `review` | `fan_out` | `join` | `conditional` | `transform`
|
|
1143
|
+
- `type` (必須): `start` | `end` | `skill` | `review` | `fan_out` | `join` | `conditional` | `transform` | `script`
|
|
1345
1144
|
- `id` (任意): 省略時は `<type>_1`, `<type>_2`, ... で自動採番
|
|
1346
1145
|
- `label` (任意): 省略時は `New <type>`
|
|
1347
1146
|
- `after` (任意): このノードの後ろに挿入。`after` → 新ノード へのエッジを自動生成
|
|
@@ -1359,6 +1158,7 @@ POST `/api/minion/dag-workflows/:id/publish` (body なし):
|
|
|
1359
1158
|
| `join` | `join_mode`, `aggregation` | |
|
|
1360
1159
|
| `conditional` | `condition_type`, `branches` or `default_branch` | |
|
|
1361
1160
|
| `transform` | `assigned_role`, incoming edge 1 本 + outgoing edge 1 本 (両方 `contract` 必須) | `transform_instruction` は optional hint。I/O 型は edge の contract から自動導出される |
|
|
1161
|
+
| `script` | `assigned_role`, `script_runtime` (`'python'` \| `'node'`), `script_source` (非空) | `script_timeout_seconds` (任意, デフォルト 60, 範囲 1-600)。LLM を使わず `python3` / `node` で決定的にスクリプト実行。input_data を stdin で JSON 受信 → output_data を stdout に JSON 出力。outgoing edge に `contract` があれば HQ が output_data を検証 |
|
|
1362
1162
|
|
|
1363
1163
|
**review ノード追加の例:**
|
|
1364
1164
|
```json
|
|
@@ -1617,7 +1417,7 @@ hq dag update-node <wf-id> fan_out_1 /tmp/u.json
|
|
|
1617
1417
|
テンプレート内部のノード/エッジを個別操作するAPIは現在ない。テンプレートは `template` フィールドの全体上書きで更新すること。テンプレートは start/end ノードを持たない sub-graph であり、バリデーション時に再帰的に検証される。
|
|
1618
1418
|
|
|
1619
1419
|
> **⚠️ 重要: テンプレート内に `start` / `end` ノードを配置してはいけない。**
|
|
1620
|
-
> テンプレートのエントリポイントとエグジットポイントは、エッジ構造から自動検出される(incoming edge がないノード = エントリ、outgoing edge がないノード = エグジット)。`start` / `end` はトップレベル DAG 専用のノードタイプであり、テンプレート内に含めるとバリデーションエラーになる。テンプレート内では `skill`, `conditional`, `transform`, `review` 等の実行ノードのみ使用すること。
|
|
1420
|
+
> テンプレートのエントリポイントとエグジットポイントは、エッジ構造から自動検出される(incoming edge がないノード = エントリ、outgoing edge がないノード = エグジット)。`start` / `end` はトップレベル DAG 専用のノードタイプであり、テンプレート内に含めるとバリデーションエラーになる。テンプレート内では `skill`, `conditional`, `transform`, `script`, `review` 等の実行ノードのみ使用すること。
|
|
1621
1421
|
|
|
1622
1422
|
### ミニオン CLI ラッパー
|
|
1623
1423
|
|
|
@@ -1721,7 +1521,9 @@ GET `/api/minion/dag-executions/:id` Response:
|
|
|
1721
1521
|
| POST | `/api/dag/minion/node-complete` | ノード完了を報告し、下流ノードへカスケード |
|
|
1722
1522
|
| POST | `/api/dag/minion/dag-cron-tick` | PMロールのミニオン専用。所属プロジェクトのcron-enabled DAGワークフローを発火 |
|
|
1723
1523
|
|
|
1724
|
-
ミニオンの `dag-step-poller` デーモンが30秒ごとに `pending-nodes` を叩き、最大2並列で claim → skill/transform 実行 → node-complete の流れを回す。`skill`・`transform` 以外のノード(start/end/review/fan_out/join/conditional)はHQ内部のカスケードエンジンが処理するため、ミニオンには返されない。
|
|
1524
|
+
ミニオンの `dag-step-poller` デーモンが30秒ごとに `pending-nodes` を叩き、最大2並列で claim → skill/transform/script 実行 → node-complete の流れを回す。`skill`・`transform`・`script` 以外のノード(start/end/review/fan_out/join/conditional)はHQ内部のカスケードエンジンが処理するため、ミニオンには返されない。
|
|
1525
|
+
|
|
1526
|
+
`script` ノード (v3.54.0〜) は LLM を経由しない決定的な処理用。ミニオン標準搭載の `python3` / `node` で `script_source` を `child_process` 実行し、`input_data` を stdin で JSON 渡し → stdout の JSON を `output_data` として `node-complete` に報告する。タイムアウト超過 (`script_timeout_seconds`、デフォルト60s) / 非0終了 / 不正JSON はいずれも `failed` 扱いで stderr が `output_summary` に格納される。tmux セッションは作らない (専用プロセスのみ)。
|
|
1725
1527
|
|
|
1726
1528
|
`dag-cron-poller` デーモン(v3.51.0〜)は60秒ごとに `dag-cron-tick` を叩く。HQ側で「呼び出しミニオンがPMロールであるプロジェクトのDAGワークフロー」のうち `cron_enabled AND next_run_at <= now()` を atomic claim → triggerDagExecution。Push型ではないので、PMミニオンが offline ならcron発火が遅延する。
|
|
1727
1529
|
|
|
@@ -1743,7 +1545,10 @@ Response:
|
|
|
1743
1545
|
"assigned_role": "pm|engineer|accountant",
|
|
1744
1546
|
"input_data": { "...": "..." },
|
|
1745
1547
|
"revision_feedback": "string|null",
|
|
1746
|
-
"transform_instruction": "string|null"
|
|
1548
|
+
"transform_instruction": "string|null",
|
|
1549
|
+
"script_runtime": "python|node|null",
|
|
1550
|
+
"script_source": "string|null",
|
|
1551
|
+
"script_timeout_seconds": "number|null"
|
|
1747
1552
|
}
|
|
1748
1553
|
]
|
|
1749
1554
|
}
|
|
@@ -1752,7 +1557,7 @@ Response:
|
|
|
1752
1557
|
返却条件:
|
|
1753
1558
|
- `assigned_role` がミニオンのプロジェクトロールと一致
|
|
1754
1559
|
- ノードの `status` が `pending`
|
|
1755
|
-
- `node_type` が `skill
|
|
1560
|
+
- `node_type` が `skill`、`transform`、または `script`
|
|
1756
1561
|
- スコープ内の全依存ノードが `completed`(`requires_review` の場合は `approved` も必要)
|
|
1757
1562
|
|
|
1758
1563
|
`scope_path` は fan-out 内のインスタンスを示す(ルートは空文字列、1段のfan-outでは `fan_out_A:0`、ネストでは `fan_out_A:2/fan_out_B:1`)。依存解決は同じ scope_path 内で閉じる。
|
|
@@ -1880,6 +1685,7 @@ DAG ワークフローの graph は以下の構造で保存される(`dag_work
|
|
|
1880
1685
|
| `end` | 終端 | ❌ (内部) |
|
|
1881
1686
|
| `skill` | スキル実行。`skill_version_id` と `assigned_role` が必須 | ✅ |
|
|
1882
1687
|
| `transform` | contract 同士のブリッジ。I/O 型は incoming/outgoing edge の `contract` から自動導出、出力は HQ が contract validate。`transform_instruction` は optional hint | ✅ |
|
|
1688
|
+
| `script` | LLMを使わず `python3` / `node` でインラインスクリプトを実行 (v3.54.0〜)。input_data を stdin で JSON 受信 → output_data を stdout に JSON 出力。決定的処理向け | ✅ |
|
|
1883
1689
|
| `review` | レビューゲート。`approved` / `revision_requested` で分岐 | ❌ (内部) |
|
|
1884
1690
|
| `fan_out` | 配列入力をテンプレートsub-graphに展開して並列実行。子が全て settle すると自ノードが completed に遷移 | ❌ (内部) |
|
|
1885
1691
|
| `join` | N本の上流エッジを待ち合わせる汎用バリア。fan_out とは独立 | ❌ (内部) |
|
|
@@ -1905,6 +1711,9 @@ DAG ワークフローの graph は以下の構造で保存される(`dag_work
|
|
|
1905
1711
|
| `branches` | Record<string,string> | conditional: 条件出力→遷移先ノードID |
|
|
1906
1712
|
| `default_branch` | string? | conditional: マッチしなかった場合の遷移先 |
|
|
1907
1713
|
| `transform_instruction` | string | transform: LLMへの変換指示 |
|
|
1714
|
+
| `script_runtime` | `python`\|`node` | script: ランタイム指定 |
|
|
1715
|
+
| `script_source` | string | script: インラインスクリプト本文。stdin から JSON を読み、stdout に JSON を出力 |
|
|
1716
|
+
| `script_timeout_seconds` | number? | script: タイムアウト秒数 (デフォルト60、範囲1-600) |
|
|
1908
1717
|
| `review` | object | review: レビュー設定 |
|
|
1909
1718
|
|
|
1910
1719
|
#### DagEdge
|