Repository navigation
Conversation
…tachment manager Adds @traceai/framework-attachments, a shared typed-part normalizer with thin bindings for LangChain LLM runs, LlamaIndex chat, Vercel AI SDK model/tool events and Genkit model/tool implementations. Decode is lazy behind manager admission, inline base64/data URIs and Uint8Array only, capped at 1 MiB per part. No URL, path or stream reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… media CI Adds genkitAttachmentMiddleware for models the application does not implement. The Mastra exporter removes fi.attachment.* keys it did not issue and documents that it never captures media. Adds a pull-request workflow for the framework media matrix, packs the shared helper in the Vercel and Mastra consumers, and registers it with release-please. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…its own consumer suites Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…taller uses candidate transitive tarballs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e tarball in the strict pnpm load Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rted input Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…trumentation prefix The @traceai/auto registry test requires every packages/traceai_* directory to be a registered instrumentation. @traceai/framework-attachments is a shared helper with no instrumentor, so its directory moves to packages/framework_attachments (npm name unchanged). Release-please keys, repository.directory, consumer tsconfig references, lockfile importer and workflow path filters and pack loops follow the move. Adds test/layout.test.cjs, which fails if the helper re-enters the traceai_ prefix or if any release key, tsconfig reference or lockfile link still points at the old directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The TypeScript core base (feat/attachments-ts-core 031178f) now validates content and complete status bodies strictly ({id, state, reason}). The helper's loopback fixture returned {upload_id, state} only, so the PR merge ref failed five upload tests. Status bodies now include `reason`, and session and upload expiry sit an hour out so no renewal runs inside a test. Both the previous and the current core accept this fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 of 5 tasks
…meworks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adopt the ts-core preflight API (SDK design section 1) in the shared framework media helper used by the LangChain, LlamaIndex, Vercel AI SDK and Genkit bindings. - Size each part from its shape only (exact decoded length, no decode), then manager.preflight() with the merged capture policy. Only an admitted part is decoded and passed to ticket.attach() with its message/part fields. The lazy `get data()` getter through manager.attach() is gone. - A part over the owned-byte budget is now denied queue_full before any decode (the old path decoded inside the core, then denied). - An admitted part that fails strict decode releases its ticket at once; decode no longer throws, so later parts in the same message still run. - Tests: queue_full denial with zero atob calls for all four dialects, preflight+ticket.attach used and manager.attach never called, ticket release on a decode failure, and no FI_ATTACHMENTS_* warning from the v1 fixture transport. No consumed byte stream exists at these boundaries (every part arrives as one complete inline value), so startAttachmentStream is not used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e base64 cap The preflight rewrite applied the 1 MiB base64 decode cap to Uint8Array parts too, so a typed-bytes image over 1 MiB (for example an AI SDK `image` part holding an uploaded photo) was skipped where the previous helper captured it. Bytes are never decoded here: size them by byteLength and let preflight apply the manager's upload cap and owned-byte budget. Base64 strings keep the 1 MiB decode cap. Test: a 1.5 MiB Uint8Array part uploads byte-identical, and the same media as base64 in the same array is skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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).
Draft. Stacked on #677 (
feat/attachments-ts-core). Design work packages F03 to F06.Resync pass 2026-11-11 (head
2b38d3f0)feat/attachments-ts-core(f0a56b37), as merge commit47614991. The merge was clean. Before any adaptation, the merged tree already passed: the helper suite (43/43) and all 8 real-framework floor/latest rows, with unchanged upload counts. Capture never stopped on the new core.captureMediaPartssizes each part from its shape: the exact decoded length, computed without decoding. It then callsmanager.preflight(span, {mimeType, direction, purpose, capture, maxBytes}). Only an admitted part is decoded and handed toticket.attach(...), with its message and part fields. The lazyget data()getter throughmanager.attachis gone.queue_fullbefore any decode. The old path decoded inside the core first, then denied.Uint8Arrayparts are not decoded, so only the manager bounds them at preflight, exactly as before. Base64 strings keep the 1 MiB per-part decode cap. Commit2b38d3f0fixes47d6b724, which had wrongly applied the 1 MiB cap to bytes too, so that a 1.5 MiB typed-bytes image was skipped.captureMediaMessages,captureMediaParts) and every binding are unchanged.startAttachmentStreamdoes not apply.queue_fulldenial with zeroatobcalls, for all four dialects;preflight+ticket.attachare used andmanager.attachis never called;FI_ATTACHMENTS_*warning, which pins it to the v1 wire.Uint8Arrayimage uploads byte-identical, while the same media as base64 in the same array is skipped.2b38d3f0:FI_ATTACHMENTS_*warnings47d6b724manager.attachgetterThe real framework invocations cover
@langchain/core0.2.0 and 1.3.7,llamaindex0.1.0 and 0.12.1,ai5.0.0 and 7.0.169, andgenkit1.42.0 and 1.44.0. Allowed runs upload 1, 1, 3 (AI SDK 5) or 5 (AI SDK 7), and 5 parts respectively, the same counts as the control. Every denied mode uploads 0.On the control build, the 2 failing rows are exactly the two preflight rows; the large-bytes row passes there, because the old helper captured it. On
47d6b724, the 1 failing row is exactly the large-bytes row.CI at
2b38d3f0: all 21 PR checks pass, includingTypeScript framework attachmentson Node 22 and 24 (run 43020780762). Branch dispatches, which do not appear in this PR's Checks tab, all pass:Zero-code agent (@traceai/auto) tests: 43020906548LangChain TypeScript contracts: 8/8 jobs, 43020912578Vercel AI SDK native telemetry tests: 6/6, 43020918123Mastra TypeScript tests: 4/4, 43020923351TypeScript framework attachments: 2/2, 43020928934Still open: cross-span occurrence claim. A framework integration and a provider integration given the same manager still upload the same media once per span.
Fix pass 2026-11-11 (head
4e24a9ce)typescript/packages/traceai_framework_attachments. The@traceai/autoregistry test (traceai_auto/test/config.test.ts) requires everypackages/traceai_*directory to be a registered instrumentation, so it failed: expected 52, received 51. The helper is not an instrumentation, so it now lives attypescript/packages/framework_attachments. The npm name stays@traceai/framework-attachments.repository.directory, the tsconfig references in langchain, llamaindex, vercel and genkit, the lockfile importer, and the workflow path filters and pack loops all moved with it.framework_attachments/test/layout.test.cjs. It fails if the helper re-enters thetraceai_prefix, or if any release key, consumer tsconfig reference or lockfile link still names the old directory. Copied into the old tree at6aa72cb2, it fails as expected (2 of 3 pass); at the new head, 3 of 3 pass.feat/attachments-ts-coremoved to031178f6, and its v1 transport now rejects status bodies that have noreasonmember. The helper's loopback fixture now returnsreason, and its sessions and uploads expire an hour out. This is a test-only change, and both the old and the new core accept it.2ada9bc1on the old core, and the PR merge tree (4e24a9ce+031178f6). Both gave the same results:pnpm run build:orderedpasses;config.test.tspasses 12/12, and the full@traceai/autosuite passes 44/44 suites (1504 passed, 12 skipped);jestpasses 74/74 tests. Only the pre-existinglegacyFunctionArguments.test.tstype error fails, and it fails the same way on base7145f783.4e24a9ce, all green:TypeScript framework attachments(merge ref);Zero-code agent (@traceai/auto) tests,TypeScript framework attachments,LangChain TypeScript contracts,Vercel AI SDK native telemetry testsandMastra TypeScript tests. Run ids: 42973681302, 42973842136, 42973850962, 42973859184, 42973868102, 42973875575.What this adds
@traceai/framework-attachmentsis a shared typed-part normalizer. It never uploads anything itself; the sharedAttachmentManagerfrom feat(core): TypeScript attachment streaming, recordings, imports and lifecycle #677 owns admission, transport, references and lifecycle.Uint8Arrayonly, capped at 1 MiB per part and 64 positions per span.attachments;capturerestrictions can only add denials):LangChainInstrumentation({attachments, capture})covers chat-model input and output messages.LlamaIndexInstrumentation({attachments, traceConfig, capture})covers chat input and non-streaming output.VercelAIInstrumentation({attachments, capture})covers prompt messages on AI SDK 5, 6 and 7. Model response files and typed toolcontentresults are covered on AI SDK 7 only.recordInputsandrecordOutputsset to false also deny the matching media.genkitAttachmentMiddleware(binding)for any model, including plugin models,withGenkitModelAttachmentsandwithGenkitToolAttachments.fi.attachment.*attributes it did not issue.typescript/packages/framework_attachments/README.md.Not supported, fails closed
@traceai/openai) get the same manager, the same media is uploaded once per span. The core has no occurrence-claim API yet. This was raised for reconciliation.CI and packaging
framework-attachments-tests.yml, triggered on any pull request that touches these paths.workflow_dispatch, because their pull_request triggers only fire fordevandmain.Evidence (GitHub Actions on this branch; the GCP VM run could not start because gcloud needed interactive reauth)
TypeScript framework attachments, Node 22 and 24:@langchain/core0.2.0 and 1.3.7,llamaindex0.1.0 and 0.12.1,ai5.0.0 and 7.0.169,genkit1.42.0 and 1.44.0.6aa72cb2. They are branch runs, so they do not show up in this PR's Checks tab:LangChain TypeScript contracts: 8/8 jobs pass, covering core 0.2.0, 0.3.0, 0.3.80, 1.0.0, 1.3.2 and 1.3.4, plus Remote LangGraph SDK. https://github.com/future-agi/traceAI/actions/runs/42960703799Mastra TypeScript tests: 4/4 version combinations pass. https://github.com/future-agi/traceAI/actions/runs/42960709647Vercel AI SDK native telemetry tests: 6/6 pass (floor, current and latest, each on Node 22 and 24). https://github.com/future-agi/traceAI/actions/runs/42960716068TypeScript framework attachments: https://github.com/future-agi/traceAI/actions/runs/42960681184jesthits a TS type error insrc/__tests__/legacyFunctionArguments.test.ts, a file this PR does not touch. LangChain's own workflow, which runs its consumer runtime suites, is the gate used here.🤖 Generated with Claude Code