feat: alice workspace CLI adapter + chat-cli template#250
Merged
Conversation
The third adapter over domain/ (after HTTP routes + MCP tools): the one
that fits the workspace consumer — a native unix-CLI agent — which was
never built, so `news` faked it inside the MCP surface (the readNews
index/lookback coupling bug).
- src/server/cli.ts: /cli/:wsId/{manifest,invoke} mounted in McpPlugin
(same open port, identity-by-URL, no token), reusing extractMcpShape +
wrapToolExecute — CLI and MCP are two front-ends over one ToolCenter.
- src/server/cli-commands.ts: the `alice <group> <verb>` alias map = the
CLI's public contract; invoke is gated to it. trading/cron deliberately
excluded (still MCP-reachable) pending boundary review.
- src/workspaces/cli/bin/alice: zero-import, build-free node forwarder;
manifest-driven --help; JSON stdout; unix exit codes.
- PATH injection via cliBinPath() in buildSpawnEnv — shared script, never
written into a workspace (no bootstrap.sh change, no git pollution).
- Documented `alice` in chat + finance-research CLAUDE.md.
- News: NewsItem.id = seq; readNews({id}) resolves by stable id.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…a MCP An experimental workspace template that routes OpenAlice's market/data tools through the `alice` CLI instead of MCP, while keeping the stateful inbox channel on MCP. A testbed for CLI-mode context injection that generalizes to any future agent runtime with a shell (no per-runtime MCP wiring). - context-injector: `injectMcp` gains an 'inbox' mode that writes ONLY the workspace inbox server (drops the global tool server); the `true` output stays byte-identical. TemplateMeta.injectMcp widened to `boolean | 'inbox'`. - default/skills/openalice-cli: a skill teaching the agent to use `alice` (discover with --help, JSON out, exit codes, inbox stays MCP). - templates/chat-cli: template.json (injectMcp:'inbox', bundles openalice-cli + the tool-agnostic research skills), instruction.md, README, bootstrap.sh. - chat template untouched; existing injector behavior unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
equityGetRatios forwarded no `ttm`, so the FMP fetcher's default (ttm:'only') returned a single TTM row with `period`/`limit` effectively dead — which surfaced as a "thin" result when poked via the `alice` CLI. - Default to ttm:'include' so the historical series (and therefore period/limit) actually come through (TTM + `limit` periods). - Expose `ttm` as an enum flag (include/exclude/only) so the agent can pick snapshot-only vs history-only. Manifest is schema-derived, so `alice equity ratios --help` picks it up automatically. - Correct the description (it claimed "default: 5 periods" while returning 1). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a third adapter over the tool registry — a workspace-local
aliceCLI — alongside the existing HTTP routes (UI) and MCP tools (in-proc AI). It's the adapter that fits the workspace consumer (a native unix-CLI agent), which was never built — sonewshad been faking it inside the MCP surface.aliceCLI (src/server/cli.ts+src/server/cli-commands.ts+src/workspaces/cli/bin/alice): a capability-agnosticargv → JSON → HTTPforwarder. The/cli/:wsId/{manifest,invoke}gateway mounts on the MCP server (open port, identity-by-URL, no token) and reusesextractMcpShape/wrapToolExecute, so CLI and MCP are two front-ends over one ToolCenter. Surface =alice <group> <verb> --flags, manifest-driven--help, JSON to stdout, unix exit codes. Trading + cron deliberately excluded (still MCP-reachable) pending a boundary review.cliBinPath()inbuildSpawnEnv— one shared script, never written into a workspace (no bootstrap.sh change, no git pollution). Couples to a runtime only through "has a shell + PATH", so it applies to any future agent runtime for free.chat-clitemplate: routes data tools through the CLI while keeping the stateful inbox on MCP. Realized by widening the launcher'sinjectMcpflag to a tri-state (true/'inbox'/false) incontext-injector.ts;'inbox'writes only the workspace inbox server. Bundles a newopenalice-cliskill. The standardchattemplate is untouched andinjectMcp: trueoutput stays byte-identical.newsreadNewsnow addresses by stable id (NewsItem.id = seq) — kills the index/lookback coupling bug.equityratios returns TTM + history (defaultsttm:'include', exposes attmflag) instead of a single TTM snapshot with deadperiod/limit.Test plan
npx tsc --noEmitcleanpnpm test— 1728 passing (incl. newcli.spec.ts,cli-commands.spec.ts, and the inbox-mode injector golden)/cligateway over HTTP driven by the realaliceclient — group/verb listing,--help, invoke (think calc → 42), and every failure path (bad args / unknown group / unknown workspace / backend down → clean stderr + non-zero exit)chat-cliend-to-end — discovered + parsed (injectMcp:'inbox'), injection produces an inbox-only.mcp.json(no global tool server) with persona + theopenalice-cliskill in both.claude/and.agents/Boundary touch
Touches the workspace launcher (
context-injectorinjectMcptri-state, spawn-env PATH) and the tool layer (newsaddressing,equityratios). No trading / auth / broker-credential / migration changes — and trading + cron are deliberately kept off the new CLI surface.🤖 Generated with Claude Code