Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

opencode-goal-plugin-rust — unbounded enterprise autonomous

Rust-core + JS-shim opencode plugin for Codex-style goal mode, /goal commands, persistence, and TUI — unbounded, always-visible Goal, clean single-source via git rev, real strict-schema validation, full TDD, DDD/Hex.

Replaces prevalentware/opencode-goal-plugin 0.1.39 (which had hard 25 wall, hidden Goal when tool output missed, sibling path, placeholder wire_is_valid()).

Why Rust + tiny JS handoff

  • Rust is the brain (crates/goal-core crates/goal-store crates/napi-bridge — DDD GoalSnapshot maxAutoTurns: None = ∞, GoalService::should_continue advisory not wall, FileStore file+KV atomic with goals.json direct-edit fallback, Health 3 checks)
  • Tiny JS just hands off (src/server.ts src/tui.tsx — /** @jsxImportSource @opentui/solid */, jsx: preserve) — src/server.ts is a normal Plugin (@opencode-ai/plugin) that imports Rust via napi-rs and delegates all 8 tools (get_goal/create_goal etc.) to Rust; src/tui.tsx is @opentui/solid <box>/<text> that calls Rust for goalStateFromSession + cachedGoal fallback.

Opencode plugins are JS/TS modules (~/.config/opencode/plugins/ or npm), so the JS shim is what opencode loads (exports: {"./server": "./dist/server.js", "./tui": "./src/tui.tsx"} same as prevalentware package.json:31).

What it fixes (vs prevalentware)

  • No 25 wall — maxAutoTurns: null = ∞ (enterprise), budgetLimited/usageLimited → needsAttention not blocked — auto-continues while task.detail 51bbyZ72jNVqFCzoJchpJC is running/waiting on legatus_check Allow (evidence-based, not counter-based), not just noProgressTurns
  • Never hidden Goal — GoalSidebar never return null (fixes prevalentware src/tui.ts:407 if (!goal) return null that hid Goal when goals.json had ses_fa24... active but tool output missed) — always box with placeholder “No goal for this session. Run /goal here.” + Manus: 51bbyZ72jNVqFCzoJchpJC • PR #18 f85e4c8 • 33 hooks
  • No sibling path — manus-hooks-engine f85e4c8→0d1c119 via git rev pinned (rev = "0d1c1194f43...") + Cargo.lock + net.git-fetch-with-cli = true, not path = "../manus-hooks-engine" (Manus blocked PR #79 38939b8 on this)
  • No placeholder wire_is_valid() — real jsonschema::JSONSchema::compile for contracts/governance-decision-v1.schema.json with WireVerdict projection (Ask->Observe, Deny->Escalate) so PR #18 0d1c119 GovernanceDecisionV1Wire strictly validates (was placeholder at src/wire.rs:60)

Install

# from local (workspace needs absolute path in tui.json)
opencode plugin add /Users/gary.somerhalder/Documents/GitHub/opencode-goal-plugin-rust
# or npm (when published)
opencode plugin add opencode-goal-plugin-rust

Workspace tui.json must be absolute: {"tui": "/Users/gary.somerhalder/Documents/GitHub/opencode-goal-plugin-rust/src/tui.tsx"} (opencode resolves tui.json relative to ~/.config/opencode/).

Build

cargo test --jobs 1 -- --test-threads=1  # 3 tests: unbounded, file_store direct edit, health 3 checks
bun install
bun run build  # bun build ./src/server.ts --outdir ./dist --target bun --external @opencode-ai/plugin --external effect --external zod
cargo fmt --all && bunx prettier --write "src/**/*.{ts,tsx}"

TUI

  • order: 100 (before Todo 125 so Goal is top), sidebar_content that always returns a box (never null), shows Status: active Time: live Tokens: 41/∞ Auto-continues: 80/∞ Manus: running PR #18 f85e4c8 PR #79 38939b8
  • Uses registerSlotV2 arity branch (slot.length <= 1 ? slot({append,render}) : slot(name,render)) and themeColorV2 (text/default vs flat text) same as prevalentware src/tui.ts:128 but never hides

Enterprise

  • Unbounded: maxAutoTurns: null = ∞ — no usageLimited wall at 25/80/120, only needsAttention toast
  • DDD/Hex: goal-core pure domain, goal-store file+KV, napi-bridge ports, adapters TUI/server
  • TDD: cargo test for goal-core/goal-store (unbounded, file direct edit, health 3 checks, wire real schema, 43 tests in manus-hooks-engine 0d1c119), bun test for src/tui.tsx
  • Manus: legatus-ai/manus-hooks-engine PR #18 0d1c119 +769 43 tests + legatus-ai/manus-mcp-rust PR #79 38939b8 git + single-source cargo test 52 are first consumers (replaces prevalentware import)

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages