feat(workflow): port 3d workflow + hive-mind engine — parse, execute, cycle, synthesis, docs

This commit is contained in:
asepharyana
2026-09-02 22:50:38 +07:00
parent a14a2275ff
commit edc007619b
10 changed files with 512 additions and 35 deletions
+16 -19
View File
@@ -3,7 +3,7 @@
> Plan lengkap migrasi in-place dari Rust (11 crate, clean architecture 4 lapis) ke monorepo
> TypeScript/Bun. Bahasa Indonesia, commit pakai Conventional Commits.
>
> **Status:** Fase 0–2 + 3a + 3b + 3e + 3c **selesai**. Berikutnya: **3d workflow + hive-mind**.
> **Status:** Fase 0–2 + 3a + 3b + 3e + 3c + 3d **selesai**. Berikutnya: **3f auth infrastructure**.
> Base: `bun run check` bersih, 54 test hijau.
---
@@ -95,12 +95,8 @@ apps/
**Sumber Rust:** `apps/infrastructure/src/subagent/{engine,division,context,provider,spawn}.rs`, `subagent/auto/*`
- [x] `AccessTier.toolsFor(access)` — `tools/division.ts`: Read / Write / Full yang mem-filter registry
- Read → tool baca-saja
- Write → baca + tulis
- Full → semua
- [x] `run_agent` loop (`tools/engine.ts`): `MAX_ITERATIONS=25`, `TOOL_OUTPUT_MAX_CHARS=12_000`,
`MAX_CONSECUTIVE_TOOL_ERRORS=3`, `MAX_PARALLEL_TOOLS=8`; recovery note setelah 3 error beruntun;
return pesan limit iterasai saat keluar alami
`MAX_CONSECUTIVE_TOOL_ERRORS=3`, `MAX_PARALLEL_TOOLS=8`; recovery note setelah 3 error beruntun
- [x] `SubagentContext` (`subagent/context.ts`) — directive, toolCtx, access, baseURL, apiKey, model
- [x] `spawn_subagent` — `spawn_tools.ts` — runAgent berbasis HTTP provider + config_resolver
- [x] `resolve_subagent_provider` (`subagent/provider.ts`) — pilih provider/model subagent dari settings + app_config
@@ -111,21 +107,22 @@ apps/
wiring `review_enabled` (yang sekarang no-op di `Review` agent)
- [x] Placeholder di `apps/packages/infrastructure/src/subagent/*` diisi penuh
---
## ⬜ Yang belum dikerjakan
### Fase 3d — Workflow + hive-mind
**Sumber Rust:** `apps/infrastructure/src/workflow/{script,mod,docs}.rs`, `workflow/engine/{execution,phases,primitives}.rs`, `workflow/hive_mind/{complexity,cycle,synthesis,live,types}.rs`
- [ ] `parse_workflow_script(yaml)` — parser YAML workflow (`script.ts`)
- [ ] `execute_workflow(script, ctx)` — eksekusi multi-phase (`engine/execution.ts`)
- [ ] Phase primitives: run sub-agent per node, gate/condition, paralel (bounded), I/O
- [ ] `execute_cycle(cycle, ctx)` — hive-mind cycle, concurrency 8, kumpulkan NodeOutput
- [ ] `synthesize_consensus(node_outputs, ctx)` — konsensus via LLM
- [ ] `complexity_heuristic` — pilih apakah cukup 1 cycle / butuh banyak
- [ ] `docs.ts` — tulis convergence/decision doc
- [ ] Isi body `WorkflowRun` & `HiveMind` tool (ganti placeholder), hapus `workflow/index.ts` + `hive_mind.ts` placeholder
- [x] `parse_workflow_script(yaml)` — parser YAML workflow (`workflow/script.ts`)
- [x] `execute_workflow(script, ctx)` — eksekusi multi-phase (`workflow/engine.ts` + `workflow/orchestrate.ts`)
- [x] Phase primitives: run sub-agent per node (`executePrimitive`)
- [x] `execute_cycle(cycle, ctx)` — hive-mind cycle, concurrency 8, kumpulkan NodeOutput (`workflow/cycle.ts`)
- [x] `synthesize_consensus(node_outputs, ctx)` — konsensus via LLM + fallback concat (`workflow/synthesis.ts`)
- [x] `complexity_heuristic` — pilih apakah cukup 1 cycle / butuh banyak (`workflow/complexity.ts`)
- [x] `docs.ts` — tulis convergence/decision doc (`workflow/docs.ts`)
- [x] Isi body `WorkflowRun` & `HiveMind` tool (ganti placeholder) di `tools/workflow.ts`
- [x] `orchestrate.ts` — top-level `executeWorkflow` + `executeHiveMind` entry points
---
## ⬜ Yang belum dikerjakan
### Fase 3f — Auth infrastructure
**Sumber Rust:** `apps/infrastructure/src/auth/{password,jwt,oauth_loopback,mod}.rs`
@@ -195,4 +192,4 @@ apps/
- Registry tool = **38** (terhitung workflow_run, note_finding, read_findings, hive_mind; ExploreCodebase tidak diport).
- `Tool.run` boleh return `string | Promise<string>`.
- `spawn_agents`/`spawn_pipeline`/`parallel_delegate` sudah terisi penuh via 3c.
- Workflow/hive-mind tools masih placeholder — diisi penuh di 3d.
- Workflow/hive-mind tools sudah terisi penuh via 3d.