Skip to content

feat(sdk): add session artifacts with PDF support - #1910

Closed
samuv wants to merge 34 commits into
plan/sdk-pdf-artifactsfrom
impl/sdk-pdf-artifacts
Closed

samuv wants to merge 34 commits into
plan/sdk-pdf-artifactsfrom
impl/sdk-pdf-artifacts

Conversation

@samuv

@samuv samuv commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Stage and contract

Implementation, stacked on Plan / Interface PR #1881. The human-authorized amended plan baseline is d2afe062d6298d8d4fa8b31d362decc413a9b621.

The upload, download, storage, capability, and result-reference APIs have generic artifact names. This release accepts only application/pdf; PDF prompt parts, model capability, validation, and provider translation remain PDF-specific. The rebase renumbered the artifact ADR from 0360 to 0367 because main assigned 0360 to another decision. Its named verification test changed to match. The decision and implementation contract did not change.

Interfaces match approved contract: Yes. The directing human authorized the generic-name amendment in #1881. No other implementation deviation required an amendment.

Delivered

  • TypeScript SDK uploadArtifact returns bounded metadata, downloadArtifact streams bytes, and pdfPart(uploaded.artifactId) sends a PDF prompt reference.
  • Generic gRPC and HTTP artifact routes and typed tool-result references with PDF MIME metadata.
  • Session-owned S3-compatible objects for mecak8s with Redis references, failover, fork, reconciliation, and deletion cleanup. Native OpenAI Responses and Anthropic Messages accept qualified PDF input. Effective PDF tool results are externalized before durable recording.
  • Updated SDK and deployment guides, generated references, ADR 0027 inventories, engine API snapshots, and changelog.

Acceptance and verification

AC1.1–AC1.4, AC2.1–AC2.2, AC3.1–AC3.2, and AC4.1–AC4.2 are implemented. task ac-trace-strict passed for every landed plan, including the 10 artifact criteria.

After rebasing on origin/main, these checks passed: task generate, task api:update, CGO_ENABLED=0 task docs, CGO_ENABLED=0 task test, CGO_ENABLED=0 task lint (zero findings), CGO_ENABLED=0 task test:race, task sdk:test (380/380), and task site:build. The offline demo showed a tool call, permission ask and approval, and final result. Focused Go artifact and SDK RPC surface tests also passed.

The prior full implementation panel reported PANEL: ship_blockers=0 important=1 advisory=1 reviewer_failures=0. The generic-artifact amendment recheck reported PANEL: ship_blockers=0 important=0 advisory=0 reviewer_failures=0. The remaining important item concerns release order: publish an engine version with the PDF API before provider module tags that claim PDF support, then update their engine requirements and remove the compatibility bridge.

Relates to #1881. This PR does not close an issue. A human alone merges it.

@samuv
samuv added this pull request to stack #1911 September 24, 2026 23:57
@samuv samuv changed the title impl/sdk pdf artifacts feat(sdk): add PDF chat artifacts Sep 24, 2026
@samuv
samuv marked this pull request as draft September 25, 2026 08:17
@samuv samuv changed the title feat(sdk): add PDF chat artifacts feat(sdk): add session artifacts with PDF support Sep 25, 2026
@samuv
samuv marked this pull request as ready for review September 25, 2026 09:50
@samuv samuv self-assigned this Sep 25, 2026
samuv and others added 23 commits September 25, 2026 17:16
Co-Authored-By: OpenAI <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Stage bounded PDF streams before publishing metadata, keep bytes outside Redis, and enqueue private-prefix cleanup atomically with session deletion. Add mecak8s flags and Helm values for a TLS S3-compatible endpoint.

Co-Authored-By: OpenAI <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Co-Authored-By: OpenAI <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Pin session-owned upload validation, streaming cancellation, and selected-provider PDF translation. Keep binary SDK route and generated error references in parity.

Co-Authored-By: OpenAI <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Co-Authored-By: OpenAI <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Authorize download before opening private objects and stream bounded chunks over gRPC and HTTP. Expose an async SDK byte iterator with early cleanup and document the result workflow.

Co-Authored-By: OpenAI <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Co-Authored-By: OpenAI <[email protected]>
Signed-off-by: Samuele Verzi <[email protected]>
Copy referenced PDFs into private successor namespaces before publication, keep Redis cleanup intent through failed copies and deletion, and reconcile abandoned or published copies from authoritative snapshots.

Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Co-Authored-By: OpenAI Codex <[email protected]>
Signed-off-by: Samuele Verzi <[email protected]>
Co-Authored-By: OpenAI Codex <[email protected]>
Signed-off-by: Samuele Verzi <[email protected]>
Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Decode authoritative session snapshots before deciding whether staged PDFs are durable. Exercise the production S3 client against a local TLS fixture, and iterate Redis artifact records with go-redis scan iterators.

Co-Authored-By: OpenAI Codex <[email protected]>
Signed-off-by: Samuele Verzi <[email protected]>
Co-Authored-By: OpenAI Codex <[email protected]>
Signed-off-by: Samuele Verzi <[email protected]>
Keep all inline binary bytes within the shared 20 MiB result budget while accounting non-PDF text and media separately. Pin the exact PDF boundary through session validation, MCP, and artifact processing.

Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
samuv and others added 11 commits September 25, 2026 17:21
Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Enforce a server receive lifetime before metadata and through staging, and release half-open streams and staging after timeout or failure.

Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Exercise the zero-value service configuration and its production receive bound; the real stream tests cover configured expiry.

Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Update the SDK guide, wire references, deployment guidance, and living architecture inventory to match the approved artifact API contract. Keep PDF validation and availability limits explicit.

Co-Authored-By: OpenAI Codex <[email protected]>
Signed-off-by: Samuele Verzi <[email protected]>
Use generic artifact names across wire, server, engine, Redis, and S3 seams while validating application/pdf only. Echo canonical MIME metadata in upload responses and preserve PDF model gating at prompt use.

Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Rename SDK upload and download methods, routes, capability projections, and error codes to artifacts. Return bounded upload metadata while PDF prompts continue to use pdfPart and model-specific validation.

Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Refresh the gRPC schema and TypeScript method reference from the amended protobuf and SDK sources.

Co-Authored-By: OpenAI Codex <[email protected]>
Signed-off-by: Samuele Verzi <[email protected]>
Decode a tool-result artifact from configured-fetch SSE, then download by its projected ID and verify ordered bytes, size, and SHA-256. The test fails when HTTP event decoding drops artifact kind or metadata.

Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Use the current discovery fixture and SDK RPC inventory, restore the engine API snapshot, and align the artifact ADR references after rebasing.

Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant