Skip to content

feat: add Mira workflow console read-only MVP#59

Open
mira-zennai wants to merge 7 commits into
xaspx:mainfrom
mira-zennai:feature/mira-workflow-console-mvp
Open

feat: add Mira workflow console read-only MVP#59
mira-zennai wants to merge 7 commits into
xaspx:mainfrom
mira-zennai:feature/mira-workflow-console-mvp

Conversation

@mira-zennai
Copy link
Copy Markdown

@mira-zennai mira-zennai commented May 7, 2026

Summary

  • Add read-only Mira workflow indexing from MiraRepo docs/workflows/definitions, runbooks, reports, and Hermes cron metadata.
  • Add authenticated /api/workflows and /api/workflows/:id endpoints.
  • Add a Workflows tab with summary cards, inventory table, status/warning display, and raw definition/runbook/report preview modal.
  • Add node:test coverage for workflow indexing, detail loading, and stale delivery-warning classification.
  • Make cron lookup LaunchAgent-safe by using direct Hermes CLI execution instead of shell timeout / PATH-dependent lookup on macOS.
  • Synced with upstream main / v3.5.1 and resolved the server.js conflict.

Safety notes

  • Read-only MVP: no cron create/update/pause/resume, no file writes, no external posting.
  • Auth is required for workflow API endpoints.
  • Secrets are not parsed or displayed beyond the existing repo files selected by workflow definitions.
  • MiraRepo path can be overridden with MIRA_REPO_DIR; defaults to local MiraRepo worktree candidates.

Verification

  • npm test — passed, 14/14 tests.
  • npm run build — passed.
  • git diff --check — passed.
  • Local LaunchAgent smoke test at http://127.0.0.1:10272:
    • login API returned ok for existing admin session.
    • /api/workflows returned 3 workflows.
    • summary returned ok=1, stale_warning=1, missing_cron=1, active_failure=0.
    • /api/workflows/weekly-memory-refactor linked cron id d27468bad831, deliver local, and showed the expected stale delivery warning.
  • GitHub reports this PR as mergeable after upstream sync.

Related: ZennAI-Japan/MiraRepo#42

@mira-zennai
Copy link
Copy Markdown
Author

Follow-up update: surfaced ADHDev-inspired workflow worker statuses in the Mira workflow console.

Changes:

  • Adds normalized worker/session status vocabulary: starting, generating, waiting_approval, idle, error, stopped, unknown.
  • Reads worker metadata from workflow definitions via execution.workers or top-level workers.
  • Adds worker summary counts to /api/workflows.
  • Shows Workers in the Workflows table and detail modal.
  • Adds node:test coverage for status normalization and summary counts.

Verification run locally:

  • npm test → 16/16 pass
  • npm run build → Vite build succeeded
  • git diff --check → no whitespace errors
  • LaunchAgent smoke: http://127.0.0.1:10272/api/workflows returned ok: true, total workflows: 24, worker summary object present.

@mira-zennai
Copy link
Copy Markdown
Author

Follow-up pushed: runtime worker snapshots can now override static workflow worker entries.

What changed:

  • Added execution.worker_status_file support on workflow definitions.
  • The file must be repo-local; absolute paths and path traversal are ignored.
  • JSON/YAML snapshots can be either { workers: [...] } or a top-level worker array.
  • Runtime entries merge by worker id, preserving static label/provider metadata while overriding live fields like status/session_id/updated_at/note.
  • This lets Codex/Claude/Hermes lanes write live status snapshots without hard-coding any AGPL ADHDev code into HCI.

Verification:

  • npm test → 17/17 pass
  • npm run build → Vite build succeeded
  • git diff --check → clean

Local note: I restarted the macOS LaunchAgent for HCI. Direct unauthenticated curl to /api/workflows correctly returns 401, so API runtime smoke needs browser/auth session or signed cookie next.

@mira-zennai
Copy link
Copy Markdown
Author

Follow-up pushed: added a small runtime writer for workflow worker snapshots.

What changed:

  • New module: lib/workflow-worker-status.js
    • atomically upserts a worker status snapshot JSON file
    • merges by worker id
    • preserves existing label/provider/session metadata unless explicitly overridden
    • normalizes status with the same HCI vocabulary (runninggenerating, blockedwaiting_approval, etc.)
    • rejects absolute paths and ../ traversal so writers can only target repo-local snapshot files
  • New CLI/script: npm run worker-status -- ...
    • example: npm run worker-status -- --repo ~/repos/MiraRepo --file reports/workflows/runtime/demo.json --id codex-lane --status blocked --session-id live-123 --note 'approval required'
  • Added focused node:test coverage for writer upsert, stable sorting, and path safety.

End-to-end smoke:

  • Created a temp workflow definition with execution.worker_status_file
  • Ran the writer script to write blocked
  • Read it back through buildWorkflowIndex
  • HCI returned the worker as waiting_approval with summary count updated

Verification:

  • npm test → 20/20 pass
  • npm run build → Vite build succeeded
  • git diff --check → clean

@mira-zennai
Copy link
Copy Markdown
Author

Follow-up pushed: connected the runtime status writer to an executable worker command wrapper.

What changed:

  • New module: lib/workflow-worker-runner.js
    • writes generating before launching a wrapped worker command
    • writes idle when the command exits 0
    • writes error when the command exits non-zero / launch fails
    • writes stopped for signal-style termination / 130 / 143
  • New CLI/script: npm run worker-run -- ...
    • wraps Codex/Claude/Hermes/other lane commands while continuously feeding the HCI snapshot file
    • keeps the existing npm run worker-status command for explicit state changes like waiting_approval

Example:

npm run worker-run -- \
  --repo ~/repos/MiraRepo \
  --file reports/workflows/runtime/mira-hci.json \
  --id codex-lane-1 \
  --label "Codex Lane 1" \
  --provider codex \
  -- codex --ask-for-approval on-request "Implement issue #123"

Runtime smoke:

  • Wrapped node -e 'process.exit(0)'
  • Snapshot ended as worker codex-smoke with status: idle, provider: codex, note: exited 0

Verification:

  • node --test test/workflow-worker-runner.test.js → 4/4 pass after TDD red/green
  • npm test → 24/24 pass
  • npm run build → Vite build succeeded
  • git diff --check → clean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant