Skip to content

fix(jerry-term): rebuild / command selector - #11

Closed
SarkarShubhdeep wants to merge 45 commits into
mainfrom
phase3/jerry-term-UX
Closed

fix(jerry-term): rebuild / command selector#11
SarkarShubhdeep wants to merge 45 commits into
mainfrom
phase3/jerry-term-UX

Conversation

@SarkarShubhdeep

Copy link
Copy Markdown
Collaborator

Summary

  • Rebuild the / command selector that appears above the input (OpenCode-style list, not a stock OpenTUI dropdown).
  • Fix OpenTUI wiring: use onInput so the selector opens on the first /, call preventDefault for navigation keys, Enter runs the selected command, Tab completes into the input.
  • Add unit tests for slash-mode / filter / complete helpers.

The / selector problem is solved — it now appears from the first prompt when typing /, without needing a prior message or Up-arrow workaround.

Test plan

  • pnpm --filter jerry-term dev → type / immediately → selector appears
  • Up/Down moves selection; Enter runs command; Tab inserts /name
  • Escape clears slash mode
  • pnpm --filter jerry-term test (CommandDropdown tests pass)

Made with Cursor

SarkarShubhdeep and others added 30 commits June 30, 2026 14:12
Set up the Jerry monorepo with:
- pnpm workspaces + strict TypeScript + ESLint flat config
- Four package skeletons: jerry-app, tools, collector, cli
- Script-first CI (scripts/ci.sh + GitHub Actions workflow)
- Phase 0 tracking doc at docs/plans/phase-0.md
- Development section in README

All packages have placeholder exports and passing tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
feat(phase-0): add pnpm workspace scaffold
Mark the workspace-scaffold slice complete in phase-0 tracking and run
CI on pushes to development as well as main.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add git submodules for the three platform dependencies under vendor/:
- vendor/cloud → mieweb/cloud (@mieweb/cloud, cli, cloud-local/os/types/workers)
- vendor/footnote → mieweb/melvil-artipod-footnote (@mieweb/footnote)
- vendor/ozwellai-api → mieweb/ozwellai-api (ozwellai, @mieweb/ozwellai-spec)

Extend pnpm-workspace.yaml to include vendor package paths so downstream
slices can add workspace:* dependencies. Update CI to fetch submodules
recursively before install. Document vendor submodule workflow in README.

Jerry packages do not yet depend on vendor packages; workspace:* wiring
lands in later Phase 0 slices (agent-runtime-port, target-config, etc).

Co-authored-by: Cursor <cursoragent@cursor.com>
## cloud-agent (vendor/cloud)
- Add @mieweb/cloud-agent with hostAgent() API
- Session DO with queue-driven turns, suspend/resume, alarms
- Storage module for sessions, events, messages, summaries
- Add @mieweb/cloud-agent-cli with message-first dispatcher

## Jerry bindings
- Update wrangler.jsonc with SESSION, JOBS, VECTORS bindings
- Update mieweb.jsonc with local adapter drivers
- Add D1 migration 0001_events.sql with event model schema

## jerry-app worker
- Refactor to export fetch, queue, scheduled handlers
- Wire AgentSession DO via hostAgent()
- Add Jerry agent definition with value-advocate persona

## Runtime tools (packages/tools)
- Add summarize_activity tool (AW pure functions + DB)
- Add search_memory tool (CloudVectorIndex)
- Add schedule_followup tool (DO alarms)
- Export createJerryTools(ctx) factory

## Collector (packages/collector)
- Add AW poller for localhost:5600
- Add folder watcher with chokidar
- CLI entry point with configurable options

## CLI (packages/cli)
- Add bin/jerry.js wrapping cloud-agent-cli
- Profile/target resolution from env and config files

## Portability
- Add integration test harness
- Add scripts/test-portability.sh

Co-authored-by: Cursor <cursoragent@cursor.com>
Connect createJerryTools to the session turn, align privacy profile tool
dispositions with runtime tool names, and improve local dev (tsx loader,
port cleanup, workers types). Add Opus chat transcripts under docs/chats.

Co-authored-by: Cursor <cursoragent@cursor.com>
feat: Phase 1 — Event Host + Jerry MVP
Give new contributors a copy-paste path to run the worker, collector, and CLI locally.

Co-authored-by: Cursor <cursoragent@cursor.com>
Capture operating guide, cloud vendor comparison, and phase 2 planning discussions for team reference.

Co-authored-by: Cursor <cursoragent@cursor.com>
Document the feature/cloud-agent PR opened on mieweb/cloud and track
Jerry's vendor/cloud pin (ecb8aa7) in phase-1 plan, README, and chat10.

Co-authored-by: Cursor <cursoragent@cursor.com>
Apply consistent list, table, and emphasis formatting across the README.

Co-authored-by: Cursor <cursoragent@cursor.com>
Capture the phase 2 scope, milestones, and planning discussion so the team has a shared reference for capture-and-reach work.

Co-authored-by: Cursor <cursoragent@cursor.com>
… Slice 1)

Add read_file, list_watched, and index_document tools with real Ollama
embeddings support. Replace placeholder random vectors in search_memory
with actual nomic-embed-text embeddings via Ollama /api/embeddings endpoint.

Wire collector ingest pipeline to upload files and trigger indexing for
text documents when folder watcher detects changes.

- Add embeddings.ts with shared getEmbedding() for Ollama integration
- Add file-tools.ts with read_file and list_watched tools
- Add index-document.ts with index_document tool and vector upsert
- Add ingest.ts with collector → bucket → index pipeline
- Update folder-watcher.ts to call ingestFile() for text files
- Update createJerryTools() to register new tools
- Update agent instructions with new tool descriptions
- Add comprehensive unit tests with mocked dependencies
- Add opt-in Ollama integration tests (JERRY_OLLAMA_TEST=1)

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace custom embeddings.ts implementation with footnote's OllamaEmbedder
which provides better error handling, automatic context length truncation,
retry logic, and caching.

- Add @mieweb/footnote as workspace dependency
- Refactor embeddings.ts to use footnote's createEmbedder
- Update tests to reset cached embedder between test runs
- Keep same getEmbedding() function signature for compatibility

Co-authored-by: Cursor <cursoragent@cursor.com>
tsx@^4.19.0 was removed from cloud-agent-cli and cli package.json
but not from the root lockfile, causing frozen-lockfile CI failure.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Rewrite embeddings.ts with direct Ollama fetch calls — removes
  @mieweb/footnote dependency whose dist/ is gitignored and absent in CI
- Fix embeddings.test.ts mock fetch casts (unknown as typeof fetch)
- Remove unused StoredActivityEvent import from file-tools.ts
- Add missing messages:[] to all ToolExecutionOptions in test files
- Fix unknown[] index access in index-document.test.ts
- Remove @mieweb/footnote from tools package.json and update lockfile

Co-authored-by: Cursor <cursoragent@cursor.com>
Phase 2 Slice 1: File Tools and Real Embeddings
Adds PUT /v1/files and POST /v1/index so the collector ingest pipeline
can upload and index documents. Also registers new file tools in the
default privacy profile and fixes search_memory limit schema handling.

Changes:
- Worker: PUT /v1/files/:path for bucket upload
- Worker: POST /v1/index for embed + vector upsert
- Profile: register read_file, list_watched, index_document dispositions
- search_memory: nullable/optional limit param with transform
- test-portability.sh: health check regex fix

Co-authored-by: Cursor <cursoragent@cursor.com>
Documents the full drop-file → index → search acceptance path and
records Slice 1 merge status plus known deviations from the plan.

Co-authored-by: Cursor <cursoragent@cursor.com>
fix(worker): Slice 1 ingest routes and profile gaps
Adds MCP client infrastructure and footnote adapter for consuming
external MCP servers via stdio transport. Jerry can now leverage
footnote's hybrid search (vector + FTS) when available.

Changes:
- Add @modelcontextprotocol/sdk dependency
- McpClient wrapper for stdio transport (connect, listTools, callTool)
- Footnote adapter: search_hybrid, search_fts, search_literal, read_document
- McpServerConfig type in privacy profile
- mcp-config.ts for resolving MCP servers from profile/env
- createJerryTools accepts optional mcpTools for merging
- Agent instructions updated with MCP tool descriptions
- Unit tests for MCP client and footnote adapter

Gracefully falls back to in-process search_memory when MCP unavailable.

Co-authored-by: Cursor <cursoragent@cursor.com>
Export McpServerConfig, fix MCP test strictness and type errors so CI
passes. Bump vendor/cloud for SSE tool streaming and --verbose CLI.
Update phase-2.md Slice 2 checklist to reflect PR #6 and remaining gaps.

Co-authored-by: Cursor <cursoragent@cursor.com>
Spawn footnote MCP on session requests, merge search tools with
search_memory fallback, and record manual acceptance on PR #6.

Co-authored-by: Cursor <cursoragent@cursor.com>
PR #6 pointed vendor/cloud at local-only commit 63e0642, which GitHub
Actions cannot fetch. Revert to ecb8aa7 (development / cloud PR #1 tip
used by Jerry) so submodule checkout succeeds.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add stdio CLI proxy and worker /v1/mcp endpoint so Cursor and other MCP
clients can call summarize_activity, search_memory, and schedule_followup.

Co-authored-by: Cursor <cursoragent@cursor.com>
feat(mcp): expose Jerry tools as MCP server (Phase 2 Slice 3)
Complete the three-way runtime split with API key support, Manager-host Ozwell defaults, and local Ollama fallback when Ozwell is unavailable.

Co-authored-by: Cursor <cursoragent@cursor.com>
Agent keys were overriding parent keys and binding Ozwell-side persona/tools, so Jerry skipped local summarize_activity. Prefer OZWELL_API_KEY, probe via chat (not unauthenticated /v1/models), and fall back on stream auth errors.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add Quick start runtime backends section and refresh agent-runtime README with env vars, ozw_ key guidance, and fallback notes.

Co-authored-by: Cursor <cursoragent@cursor.com>
SarkarShubhdeep and others added 15 commits July 21, 2026 10:49
resolveApiKey reads OZWELL_API_KEY from the environment, so a leaked key skipped the intended no-key fallback path.

Co-authored-by: Cursor <cursoragent@cursor.com>
ozwellai ships types from gitignored dist/, so CI failed to resolve the module; build it before tsc. Also remove unused mock import in byo-cloud tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
feat(runtime): byo-cloud and ozwell backends (Phase 2 Slice 4)
Phase 3 delivers jerry-term, a standalone interactive CLI for Jerry:
- Bundled distribution (npm i -g jerry-term)
- Runtime switching (local/ozwell/byo-cloud)
- Health checks (Ollama, ActivityWatch, Footnote, MCP)
- Ink-based UI with terminal-native design system
- Real-time observability panels for tool execution

7 slices from scaffold through npm publish.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Add chat logs documenting footnote submodule usage, phase 2 planning,
  search tools implementation, and jerry-term CLI architecture
- Update phase-2.md with latest status

Co-authored-by: Cursor <cursoragent@cursor.com>
Add packages/jerry-term/ as a publishable tsup-bundled CLI with:
- Bundled @mieweb/jerry-agent-runtime via noExternal config
- Minimal --version entry point for acceptance verification
- React/Ink dependencies pre-installed for later slices

Verified: build produces dist/ with createLocalRuntime inlined,
typecheck passes, npm link + jerry-term --version works.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add JerryBridge abstraction wrapping agent-runtime for CLI consumption:
- BridgeEventEmitter for UI subscription (turn-start, turn-end, runtime-switched)
- JerryBridge class with dynamic runtime switching via switchRuntime()
- Active-turn protection: queues switch requests during runTurn()
- 15 unit tests covering all acceptance criteria

Also updates branching strategy to use per-slice branches for independent PRs.

Co-authored-by: Cursor <cursoragent@cursor.com>
Land all jerry-term slices on phase3/jerry-term and open a single PR
against development when the phase is complete, instead of per-slice PRs.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add Ollama, ActivityWatch, Footnote, and MCP health adapters with a
parallel runner, formatter, and unit tests. Externalize the MCP SDK
for local diagnostics.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add readline REPL with slash commands and config loading, wire health
into the CLI, and enable local summarize_activity via ActivityWatch HTTP
with stubs for worker-only tools.

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace Ink with OpenTUI React for the interactive terminal UI to enable
proper fixed-viewport layout with native scrollable transcript.

Key changes:
- Stack: @opentui/core + @opentui/react replacing ink, ink-text-input
- React upgraded to 19.x (required by OpenTUI reconciler)
- Runtime: Bun required for interactive UI; Node.js via --no-ui fallback
- Layout: Fixed header/input/status chrome with scrollbox for transcript
- Dynamic import for UI to allow --no-ui mode to work with Node.js

UI components now rendered inline in App.tsx using OpenTUI primitives:
- box, text, scrollbox, input elements
- useKeyboard hook replacing Ink useInput
- useBridge and useRepl hooks unchanged (standard React hooks)

The --no-ui readline REPL remains fully functional under Node.js.

Co-authored-by: Cursor <cursoragent@cursor.com>
…bility UI

Restore local summarize_activity by calling AW /events without a trailing
slash and aborting timed-out fetches. Add /aw-tail to peek recent events.
Land Slice 6 observability panels and layout hardening attempts.

Open issue (unsolved): sticky alternate-screen viewport — host terminal
scrollback can still steal the wheel and the transcript scrollbox may not
scroll reliably. Tracked in docs/plans/phase-3.md.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Document /runtime command with available runtimes display
- Add examples showing runtime status and model override syntax
- Document /config persistence behavior and additional options
- Clarify that config changes are auto-persisted to config file

Co-authored-by: Cursor <cursoragent@cursor.com>
Wire OpenTUI onInput so slash mode opens on first keystroke, intercept
keys with preventDefault, and run the selected command on Enter (Tab
still completes into the input). The / selector problem is solved.

Co-authored-by: Cursor <cursoragent@cursor.com>
@SarkarShubhdeep

Copy link
Copy Markdown
Collaborator Author

The / command selector problem is solved.

Typing / now shows the command list above the input from the first prompt (no prior message / Up-arrow workaround). Enter runs the selected command; Tab completes into the input.

@SarkarShubhdeep

Copy link
Copy Markdown
Collaborator Author

Closing — no PR intended; change is just committed and pushed on phase3/jerry-term-UX.

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