reasonix 0.26.1 → 0.27.1

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/dist/index.d.ts CHANGED
@@ -446,6 +446,8 @@ declare class ImmutablePrefix {
446
446
  toMessages(): ChatMessage[];
447
447
  tools(): ToolSpec[];
448
448
  addTool(spec: ToolSpec): boolean;
449
+ /** Mirror of addTool for MCP hot-unbridge. Same cache-miss cost — prefix changes shape. */
450
+ removeTool(name: string): boolean;
449
451
  get fingerprint(): string;
450
452
  /** Dev/test only — throws on cache drift, which always means a non-`addTool` mutation slipped in. */
451
453
  verifyFingerprint(): string;
@@ -619,6 +621,8 @@ declare class ToolRegistry {
619
621
  /** At most one interceptor active; calling twice replaces. */
620
622
  setToolInterceptor(fn: ToolInterceptor | null): void;
621
623
  register<A, R>(def: ToolDefinition<A, R>): this;
624
+ /** Drop a registered tool. Returns true if the name was present. Used by MCP hot-unbridge. */
625
+ unregister(name: string): boolean;
622
626
  has(name: string): boolean;
623
627
  get(name: string): ToolDefinition | undefined;
624
628
  get size(): number;
package/dist/index.js CHANGED
@@ -981,6 +981,10 @@ var ToolRegistry = class {
981
981
  this._tools.set(def.name, internal);
982
982
  return this;
983
983
  }
984
+ /** Drop a registered tool. Returns true if the name was present. Used by MCP hot-unbridge. */
985
+ unregister(name) {
986
+ return this._tools.delete(name);
987
+ }
984
988
  has(name) {
985
989
  return this._tools.has(name);
986
990
  }
@@ -1645,6 +1649,14 @@ var ImmutablePrefix = class {
1645
1649
  this._fingerprintCache = null;
1646
1650
  return true;
1647
1651
  }
1652
+ /** Mirror of addTool for MCP hot-unbridge. Same cache-miss cost — prefix changes shape. */
1653
+ removeTool(name) {
1654
+ const idx = this._toolSpecs.findIndex((t) => t.function?.name === name);
1655
+ if (idx < 0) return false;
1656
+ this._toolSpecs.splice(idx, 1);
1657
+ this._fingerprintCache = null;
1658
+ return true;
1659
+ }
1648
1660
  get fingerprint() {
1649
1661
  if (this._fingerprintCache !== null) return this._fingerprintCache;
1650
1662
  this._fingerprintCache = this.computeFingerprint();
@@ -5854,7 +5866,7 @@ function splitOnChainOps(cmd) {
5854
5866
  const ch = cmd[i];
5855
5867
  if (quote) {
5856
5868
  if (ch === quote) quote = null;
5857
- else if (ch === "\\" && quote === '"' && i + 1 < cmd.length) i++;
5869
+ else if (quote === '"' && isDqEscape(ch, cmd[i + 1])) i++;
5858
5870
  i++;
5859
5871
  atTokenStart = false;
5860
5872
  continue;
@@ -5926,7 +5938,7 @@ function parseSegment(segStr) {
5926
5938
  if (quote) {
5927
5939
  if (ch === quote) {
5928
5940
  quote = null;
5929
- } else if (ch === "\\" && quote === '"' && i + 1 < segStr.length) {
5941
+ } else if (quote === '"' && isDqEscape(ch, segStr[i + 1])) {
5930
5942
  cur += segStr[++i] ?? "";
5931
5943
  curHasContent = true;
5932
5944
  } else {
@@ -6329,6 +6341,9 @@ var BUILTIN_ALLOWLIST = [
6329
6341
  "ruff",
6330
6342
  "mypy"
6331
6343
  ];
6344
+ function isDqEscape(prev, next) {
6345
+ return prev === "\\" && (next === '"' || next === "\\");
6346
+ }
6332
6347
  function tokenizeCommand(cmd) {
6333
6348
  const out = [];
6334
6349
  let cur = "";
@@ -6338,7 +6353,7 @@ function tokenizeCommand(cmd) {
6338
6353
  if (quote) {
6339
6354
  if (ch === quote) {
6340
6355
  quote = null;
6341
- } else if (ch === "\\" && quote === '"' && i + 1 < cmd.length) {
6356
+ } else if (quote === '"' && isDqEscape(ch, cmd[i + 1])) {
6342
6357
  cur += cmd[++i];
6343
6358
  } else {
6344
6359
  cur += ch;
@@ -6380,7 +6395,7 @@ function detectShellOperator(cmd) {
6380
6395
  if (quote) {
6381
6396
  if (ch === quote) {
6382
6397
  quote = null;
6383
- } else if (ch === "\\" && quote === '"' && i + 1 < cmd.length) {
6398
+ } else if (quote === '"' && isDqEscape(ch, cmd[i + 1])) {
6384
6399
  cur += cmd[++i];
6385
6400
  curQuoted = true;
6386
6401
  } else {