reasonix 0.3.0-alpha.1 → 0.3.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -94,22 +94,32 @@ with your own API key: `npx tsx benchmarks/tau-bench/runner.ts --repeats 3`.
94
94
  ### Extends to MCP (v0.3-alpha)
95
95
 
96
96
  Any [MCP](https://spec.modelcontextprotocol.io/) server's tools inherit
97
- the same Cache-First benefits. Live run with an MCP tool call in the
98
- middle of a conversation:
97
+ the same Cache-First benefits. Two live runs, two data points:
99
98
 
100
- | turn | what happened | cache hit |
101
- |---|---|---:|
102
- | 1 | user asks, model decides to call `add` tool via MCP stdio | 0.0% (first-ever prefix) |
103
- | 1 (continued) | model receives tool result (42), writes final answer | **96.6%** |
99
+ | server | turns | tool calls | cache hit | cost | vs Claude |
100
+ |---|---:|---:|---:|---:|---:|
101
+ | bundled demo (`add` / `echo` / `get_time`) | 2 | 1 | **96.6%** (turn 2) | $0.000254 | −94.0% |
102
+ | official `@modelcontextprotocol/server-filesystem` | 5 | 4 | **96.7%** overall | $0.001235 | −97.0% |
104
103
 
105
- The MCP round-trip did not disturb the byte-stable prefixserver-side
106
- prompt cache kicked in on turn 2. Cost $0.000254 total, **94% cheaper
107
- than Claude** at equivalent token counts. Reference transcript:
108
- [`mcp-demo.add.jsonl`][mcp]. Reproduce:
104
+ The second run is the interesting oneit's through an *external*,
105
+ production MCP server (no code we control). Five turns including
106
+ `list_directory`, a permission-denied recovery via
107
+ `list_allowed_directories`, a successful retry, and `read_text_file`.
108
+ Byte-stable prefix held across every turn; cache hit stayed at 96.7%.
109
+
110
+ **Reproduce without an API key** (replay the committed transcripts):
111
+
112
+ ```bash
113
+ npx reasonix replay benchmarks/tau-bench/transcripts/mcp-demo.add.jsonl
114
+ npx reasonix replay benchmarks/tau-bench/transcripts/mcp-filesystem.jsonl
115
+ ```
116
+
117
+ **Reproduce with your own key** (live, ~$0.002):
109
118
 
110
119
  ```bash
111
120
  reasonix chat --mcp "node --import tsx examples/mcp-server-demo.ts"
112
- # ask "use add to compute 17 + 25" — model calls the MCP tool, cache holds
121
+ # or against the real filesystem server:
122
+ reasonix chat --mcp "npx -y @modelcontextprotocol/server-filesystem /path/to/safe/dir"
113
123
  ```
114
124
 
115
125
  [mcp]: ./benchmarks/tau-bench/transcripts/mcp-demo.add.jsonl
package/dist/cli/index.js CHANGED
@@ -2004,11 +2004,25 @@ var StdioTransport = class {
2004
2004
  stdoutBuffer = "";
2005
2005
  constructor(opts) {
2006
2006
  const env = opts.replaceEnv ? { ...opts.env ?? {} } : { ...process.env, ...opts.env ?? {} };
2007
- this.child = spawn(opts.command, opts.args ?? [], {
2008
- env,
2009
- cwd: opts.cwd,
2010
- stdio: ["pipe", "pipe", "inherit"]
2011
- });
2007
+ const shell = opts.shell ?? process.platform === "win32";
2008
+ if (shell) {
2009
+ const line = [
2010
+ opts.command,
2011
+ ...(opts.args ?? []).map((a) => quoteArg(a, process.platform === "win32"))
2012
+ ].join(" ");
2013
+ this.child = spawn(line, [], {
2014
+ env,
2015
+ cwd: opts.cwd,
2016
+ stdio: ["pipe", "pipe", "inherit"],
2017
+ shell: true
2018
+ });
2019
+ } else {
2020
+ this.child = spawn(opts.command, opts.args ?? [], {
2021
+ env,
2022
+ cwd: opts.cwd,
2023
+ stdio: ["pipe", "pipe", "inherit"]
2024
+ });
2025
+ }
2012
2026
  this.child.stdout.setEncoding("utf8");
2013
2027
  this.child.stdout.on("data", (chunk) => this.onStdout(chunk));
2014
2028
  this.child.on("close", () => this.onClose());
@@ -2082,6 +2096,12 @@ var StdioTransport = class {
2082
2096
  else this.queue.push(msg);
2083
2097
  }
2084
2098
  };
2099
+ function quoteArg(s, windows) {
2100
+ if (!windows) {
2101
+ return `'${s.replace(/'/g, "'\\''")}'`;
2102
+ }
2103
+ return `"${s.replace(/"/g, '""')}"`;
2104
+ }
2085
2105
 
2086
2106
  // src/mcp/registry.ts
2087
2107
  async function bridgeMcpTools(client, opts = {}) {
@@ -2166,7 +2186,7 @@ function redactKey(key) {
2166
2186
  }
2167
2187
 
2168
2188
  // src/index.ts
2169
- var VERSION = "0.3.0-alpha.1";
2189
+ var VERSION = "0.3.0-alpha.2";
2170
2190
 
2171
2191
  // src/cli/commands/chat.tsx
2172
2192
  import { render } from "ink";