fix(web): read the literal, not the parsed number; project cursors and tool args
Copilot's eighth pass, three comments, all real.
- The precision check now reads the **source text**. Inferring the literal from
`String(value)` was wrong in both directions: it accepted every full-form
integer at or above 1e21 (`1000000000000000000001` parses to `1e21` and is
written back as `1e+21`), and refused `2^54`, which is written out in full
and exactly representable. `hasImpreciseIntegerLiteral` scans the draft for
numeric tokens — skipping strings, so a digit-string value is untouched — and
compares `BigInt(literal)` against `BigInt(Number(literal))`, which is exact.
- `""` is now reported as a surviving cursor for `tools/list` only. It builds
its params with `cursor !== undefined` and carries the empty string
deliberately; the other four list adapters use a truthiness check and drop
it, so the editor showed `{"cursor":""}` while `{}` went out. The asymmetry
looks like a latent bug in those four, but this function's job is to describe
what the dispatch does.
- `callTool` runs every string-valued argument through `convertToolParameters`,
so `{"count":"2"}` against a numeric schema is sent as `{"count":2}`.
`reshapedReplayParam` now takes the tool and detects that by running the same
conversion and comparing, rather than restating its rules — the two cannot
drift. `tools` is threaded to `ProtocolEntry` for it, optional throughout: an
unknown tool skips the check rather than blocking a replay.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UL9retfvAXRgvi6EWk4SY4
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
8f4aa7f8af
commit
fcdc65b289
1 changed files with 336 additions and 75 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { useState } from "react";
|
||||
import type { Tool } from "@modelcontextprotocol/client";
|
||||
import {
|
||||
Badge,
|
||||
Collapse,
|
||||
|
|
@ -28,6 +29,12 @@ export interface MrtrConversationProps {
|
|||
/** Compact per-round layout for the narrow monitoring column. */
|
||||
embedded?: boolean;
|
||||
onReplay: (id: string, overrideParams?: ReplayParamsOverride) => void;
|
||||
/**
|
||||
* The connected server's tools. Forwarded to each entry only so an edited
|
||||
* `tools/call` replay can tell whether an argument would be coerced by the
|
||||
* schema on the way out (#2151).
|
||||
*/
|
||||
tools?: Tool[];
|
||||
onTogglePin: (id: string) => void;
|
||||
}
|
||||
|
||||
|
|
@ -123,6 +130,7 @@ function formatRoundLabel(index: number): string {
|
|||
}
|
||||
|
||||
export function MrtrConversation({
|
||||
tools,
|
||||
requestState,
|
||||
rounds,
|
||||
pinnedIds,
|
||||
|
|
@ -187,6 +195,7 @@ export function MrtrConversation({
|
|||
onReplay(round.id, overrideParams)
|
||||
}
|
||||
onTogglePin={() => onTogglePin(round.id)}
|
||||
tools={tools}
|
||||
/>
|
||||
</Stack>
|
||||
))}
|
||||
|
|
|
|||
Loading…
Reference in a new issue