Repository navigation
Conversation
…ed attachment manager Adds opt-in MCP callTool/readResource media capture (wrapMCPClient, captureMCPResult) and Claude Agent SDK original image/PDF block capture before text truncation. Both use the provider-owned AttachmentManager, read source bytes only after manager admission, and never fetch URLs, paths, file IDs or structuredContent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…edup wrapMCPClient now returns the same proxy when a raw client is wrapped again, and records a synchronous non-thenable result as success. The Agent SDK tracer offers each original media source object to the manager at most once per query, by identity, without reading its data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…edia dedup Two existing expectations drifted on dev and fail on the unchanged base head too: fi-core now hides the conversation status description under hidden outputs, and the Python BUILTIN_TOOLS list now includes Agent (which TS already had). The README now states the per-query dedup and the subprocess model-call boundary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-agents Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…its base64 Adopt the core preflight API (SDK design section 1) in place of the lazy Bytes getter passed to attach(). Each MCP tool/resource part and each Agent SDK image/PDF block is preflighted with the full deny-wins facts before its encoded value is read; the value is read at most once. A too_large or queue_full preflight (both evaluated after every privacy, correlation and sampling step) is retried once at the part's exact decoded size, so a negotiated upload limit or a nearly used owned-byte budget still admits small media as attach() did. An admitted part whose bytes are malformed or over the decode budget releases its reservation. A manager without preflight captures nothing. Harness: sessions are minted for one hour (core renewal triggers), negotiated limits can be overridden, and FI_ATTACHMENTS_* process warnings are collected and asserted absent. New rows: read-after-preflight, exact-size retry on too_large and queue_full, reservation release on malformed bytes, and no legacy/wire-rejected warnings. README: preflight ordering, no stream capture for parsed results, and the one-proxy-per-client behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… strict F01 and tighten-only policy On ts-core f0a56b3 every status body is checked against F01: the double's content PUT response lacked `reason`, so each upload transferred its bytes but completed as unsupported_version with FI_ATTACHMENTS_WIRE_REJECTED. It now returns {upload_id, state: pending_upload, reason: queued}, and a row asserts completion is validating. updatePolicy is now tighten-only (enabled:false cannot be undone), so the real-SDK policy controls each run on a fresh manager through a per-control delegate of the same real SSE client instead of toggling one manager. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 11, 2026
This branch has not been deployed
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.
Part of TH-2379 (Linear).
Stacked on #677 (
feat/attachments-ts-core). Design packages C02 (TypeScript MCP) and C04 (TypeScript Claude Agent SDK).What this adds
@traceai/mcp:wrapMCPClient(client, config)traces the realcallTool()/readResource()boundaries and offers typed inline media to the provider's sharedAttachmentManager: toolimage/audioblocks, embeddedresource.blob, andreadResource().contents[].blob.captureMCPResult(manager, span, result, operation, capture, traceConfig)is exported for custom wiring.@traceai/claude-agent-sdk: newattachmentsandattachmentCaptureoptions. Original base64imageand PDFdocumentblocks attach before tool output is truncated into span text: tool results go to the exact tool span (withtool_call_id), direct user media goes to the conversation span.Privacy and failure behaviour
preflight(the full deny-wins check plus a budget reservation) before its base64 is read or decoded, and the value is read at most once. Atoo_largeorqueue_fullpreflight is retried once at the part's exact decoded size; both reasons come after every privacy, correlation and sampling step, so this read is post-gate. An admitted part whose bytes are malformed or over budget releases its reservation. A manager withoutpreflightcaptures nothing.piiRedaction,hideErrorDetailswith error media, andcaptureContent/recordInputs/recordOutputs/muted/temporaryChatrestrictions all deny. Integration flags only tighten.structuredContentare never read. No stream is advanced, and no recording is started.Not supported here
startAttachmentStream) does not apply:callTool/readResourcereturn fully parsed content arrays, and the Agent SDK yields complete message frames, so there are no consumed byte chunks to forward.MCPInstrumentationonly propagates context and does not capture media. This PR does not describe it as byte capture.Test changes to pre-existing tests
The
@traceai/claude-agent-sdkjest suite has no CI ondev, and four of its expectations had drifted. On the unchanged base head (7145f783) it gives 4 failed / 113 passed:J3 MCP tool errorandfailure semantics … hideOutputs: fi-core now drops the ERROR status description when outputs or error details are hidden, so these expectundefined.Python parity › built-in tool list: the PythonBUILTIN_TOOLSnow includesAgent, which TS already had, so the count is 14. Every Python name is still asserted to be in the TS set.package.json homepage: this expectation was already failing. The test now pins the currentpackage.jsonvalue (https://docs.futureagi.com/docs/tracing) instead of a homepage derived from the Anthropic package's path.With this PR the suite gives 117 / 117.
Resync onto ts-core
f0a56b37(this update)a9fd5c03merges the updatedfeat/attachments-ts-core(clean merge, no rebase).148b91bcadoptspreflightin both adapters (above) and adds rows: read-after-preflight spies, exact-size retry ontoo_large(negotiatedmax_upload_bytes100 KiB) andqueue_full(maxOwnedBytes200 KiB), reservation release on malformed bytes, and an assertion that noFI_ATTACHMENTS_*process warning fires. READMEs now describe preflight ordering and the one-proxy-per-client behaviour.f088b62caligns the loopback test double with core changes. Under strict F01 checks, its contentPUTbody lackedreason. As a result, uploads transferred their bytes but completed asunsupported_versionwithFI_ATTACHMENTS_WIRE_REJECTED.updatePolicyis now tighten-only, so the real-SDK policy controls each run on a fresh manager.Qualification on a temporary private GCP VM (synthetic data, loopback services, network-isolated suites). Each tree was rebuilt from public refs plus patches, and the tree hashes matched:
5780b83bon coref0a56b37, old tests + fixed doublef088b62cattachment suites, Node 24.11.1 / 18.20.8FI_ATTACHMENTS_*warnings@traceai/mcpjest /@traceai/claude-agent-sdkjest, Node 24 and 18Before the double fix, the control's old suites passed 35/35 but logged
FI_ATTACHMENTS_WIRE_REJECTED, and the real MCP SDK row failed (4 !== 6) on the tighten-only policy. That is a test-double defect, not lost capture: the bytes reached the double in every row.GitHub CI on
f088b62c:MCP and Agent SDK attachments(run 43016779634) passes on Node 18 and 24, including the real-SDK floor/latest step.Earlier qualification (head
5780b83b, on core7145f783)Final head
5780b83b, on Node 24.11.1 and Node 18.20.8:pnpm --filter @traceai/mcp... --filter @traceai/claude-agent-sdk... install --frozen-lockfile --ignore-scripts, then buildfi-semantic-conventions,fi-core,mcpandclaude-agent-sdk: all exit 0.pnpm --filter @traceai/mcp test: 1 / 1.pnpm --filter @traceai/claude-agent-sdk test: 117 / 117. Both pass on both Node versions.node packages/traceai_mcp/test/run-attachments.cjs(fresh loopback TLS cert, synthetic attachment service): 35 / 35 on both Node versions. It covers:captureContent,muted,temporaryChat,recordInputsandrecordOutputs;hideErrorDetailswith error media;structuredContentnon-dereference;node packages/traceai_mcp/test/run-sdk-matrix.cjs, with real upstream SDKs installed at exact versions:@modelcontextprotocol/sdk1.10.2 (floor) and 1.32.2 (latest pernpm view) over real SSE: screenshot, audio and resource tool result,readResource, abort, and four policy controls. All pass.@anthropic-ai/claude-agent-sdk0.3.277 (floor) and 0.3.322 (latest pernpm view): the bundled Claude Code executable runs a realReadtool on a synthetic PNG against a loopback Messages mock, with egress blackholed. The original image attaches to the exacttool.Readspan. The disabled,hideInputsandpiiRedactionruns make no attachment requests. All pass.sdk.mjs,core*.mjs,bridge.mjs, …) containsmessages.create,/v1/messagesornew Anthropic(. Model calls run in the spawned executable.GitHub CI on
5780b83b:MCP and Agent SDK attachmentspasses on Node 18 and 24, including the real-SDK floor/latest step.🤖 Generated with Claude Code