Skip to content

Support conversation input and verify Cloudflare Workers compatibility #5

Closed

Description

@dannymitchelldev

Outcome and current status

Completed in v0.2.0. PR #7 adds role-preserving text conversation input and verifies the packed ESM package through its public exports in workerd. Existing prompt consumers and the prompt-based CLI remain supported. PR #6 also strengthens terminal-framing verification.

This issue records completed library work. This maintenance update authorizes no new implementation, dependency installation, package publication, credentials, infrastructure changes, or provider execution.

Recorded completion evidence

  • Review snapshot, November 15, 2026: clean main/release source 6b45f03da1dbb7f29edcbb4ca3541b48b38f4cdf, package v0.2.0.
  • Published v0.2.0 release, archive, and SHA256SUMS. Archive SHA-256: 26052e58300c227ea5cafcd1a34a0736c70d0091001f5805be416365557a38e7.
  • Exact-release CI is completed/successful in all four Ubuntu/Windows x Node 22.12.0/24 jobs. Published evidence records 157 Node tests, packed declaration/installed CLI checks, and 50 workerd cases with 22 intercepted fixture requests and zero external requests.
  • Recorded runtime: SDK 1.5.91, workerd 1.20260730.1, compatibility date 2026-07-30, nodejs_compat; esbuild 0.28.2 is verification tooling. Wrangler is not part of this proof.
  • This issue-maintenance review inspected current source and live release/CI metadata. It did not install, execute, or rerun the package. Checked criteria below refer to the linked implementation/release evidence.

Completed implementation sequence

  1. Established an initial offline workerd proof of the actual packed ESM package through its public exports, including SDK initialization, header validation, streams, and signal behavior.
  2. Added conversation input and verified both the existing prompt path and new message path.
  3. Verified the final messages-capable archive with installed-package and Workers consumers, then published the versioned v0.2.0 archive through its release workflow.

This establishes the recorded synthetic workerd configuration, not blanket support for all compatibility dates/flags or deployed application behavior. Consumers must verify their own complete runtime integration.

Implementation contract

  • Export a text-message type with role: 'system' | 'user' | 'assistant' and string content.
  • Accept exactly one of existing prompt or a nonempty messages array. Preserve source compatibility for prompt consumers, CLI behavior, defaults, and result types.
  • Require each conversation entry to be an ordinary text-message object with a supported role and nonblank string content; validate without rewriting its text. Reject tool/image structures. Validate malformed conversations, unsupported roles, both/neither inputs, and missing, blank, or locally malformed authorization-header credentials before transport. Invalid input returns the existing input/setup diagnostic, except that an already-aborted caller signal retains its existing cancellation precedence and sends no request even when other options are invalid.
  • A syntactically valid rejected credential cannot be identified locally. Cover synthetic HTTP 401 as a request failure after one intercepted request, not as zero-request setup validation.
  • Assert the actual outbound SDK request preserves message roles, order, and content; do not flatten a conversation into a user prompt.
  • Preserve synchronous onText, accumulation before callbacks, observed finish metadata, provisional completion, first-terminal precedence, cancellation, deadlines, warnings, and disabled retries. Do not introduce async callbacks.
  • Preserve current success semantics: length and content_filter may succeed with warnings, and empty normally finished responses are possible. partialOutput does not judge answer usefulness. Consumer history policy is outside this library.
  • Exercise SDK/header/runtime behavior in workerd with pinned compatibility date/flags. Reproduce failures before making the smallest compatibility changes; bundling alone is insufficient evidence.
  • v0.2.0 success requires an observed normal finish plus a complete SSE [DONE] event. The raw framing observer reports missing terminal markers or unfinished events at EOF as protocol diagnostics while retaining previously accepted text. Observation stops at the first complete [DONE]; full HTTP EOF and bytes after that boundary are not verified. This supersedes the historical SDK-only limitation.

Acceptance criteria

  • Existing prompt consumers and installed CLI remain compatible.
  • Packed declarations compile positive prompt and messages consumers; both/neither input contracts are checked at runtime and as applicable type errors.
  • Outbound fixture assertions verify roles, order, and content exactly.
  • Malformed inputs and locally malformed credentials send zero requests, with pre-aborted cancellation precedence explicitly covered.
  • The final messages-capable packed archive runs through its actual public exports in workerd against synthetic HTTP/SSE fixtures through the real SDK. Repeat runtime acceptance after the API change; the initial prompt-only spike is not final feature evidence.
  • Runtime cases cover success, failure before text, synthetic HTTP 401, HTTP 200 followed by provider error, missing observed finish, malformed stream, interruption, cancellation, deadline, warning-bearing/empty success, and a thrown synchronous callback.
  • Exact received text and observed finish metadata survive applicable failure/cancellation cases; first-terminal races and abort cleanup retain existing behavior.
  • Node checks, packed consumer/CLI/declaration checks, and the new documented Workers-runtime command pass.
  • README, declarations, examples, and testing runbook describe input exclusivity, sync callbacks, tested runtime settings, and completion/evidence boundaries.
  • No tools, images, automatic retry/continuation, async callback contract, or server-side persistence are added.

Verification and artifact handoff

Use fictional credentials and intercepted HTTP/SSE fixtures only. Fixture transport must intercept the real public-export fetch path rather than import internal transport seams; observe the effective SDK signal (init?.signal ?? request.signal) without requiring RequestInit.signal to exist in every runtime. Unexpected provider egress fails the offline check.

The recorded implementation/release verification passed npm run check, the typed offline example, and same-archive installed-package/workerd checks. See the source runbook for reproducible commands, versions, compatibility settings, hash, and evidence boundaries. No check was rerun during this issue update.

The versioned GitHub release artifact is now available; npm-registry publication is not implied. GitHub currently reports immutable: false, so the named release URL is not host-enforced immutable. Consumers must pin the expected archive digest and dependency-lock integrity and reject changed bytes. Do not substitute a machine-local checkout or silently change bytes under the same version. This update publishes no new archive.

Synthetic faults do not prove naturally occurring upstream failures, complete transport verification, or cessation of provider billing after local cancellation. Any billable check remains a separately authorized action.

Consumer handoff review — November 15, 2026

No additional library implementation is required by this review; preserve the completed v0.2.0 evidence and issue state.

The public options provide API key, model, exactly one prompt/conversation input, output-token limit, deadline, signal, and synchronous text callback. They do not expose provider routing, provider allowlists, fallback preferences, or data-retention controls. Disabled client/SDK retries must not be represented as a guarantee about upstream routing. OpenRouter documents provider fallback as a separate routing setting. See provider selection.

A consumer must verify its own complete runtime against the digest-pinned archive, bound callback-to-client delivery, define its accepted terminal event and missing-final deadline, and apply its history/persistence policy. If it requires routing/privacy controls absent from the public API, verify an effective supported configuration or scope a separate generic library change. Do not depend on internal transport seams or silently expand this completed issue.

Historical starting state and remaining boundaries

The original backlog baseline was ac39595e53106357eef4ee5b2b8da3a41899dd9c (v0.1.1). It is historical; the current completed release/source is recorded above.

The library provides synchronous callbacks and in-memory text/results. Applications own browser delivery/backpressure, accepted-final semantics, history eligibility, authentication, persistence, input/output bounds, and monetary controls. maxTokens, deadlines, partialOutput, and disabled SDK retries do not establish answer usefulness or an application spending ceiling. A success may still be warning-bearing or empty.

Other runtime settings, deployed Cloudflare behavior, naturally occurring upstream reliability, and provider processing/billing cessation after local cancellation remain separate evidence. Historical live receipts are tied to their recorded revisions; this release added no new live-provider verification. Tools, images, async callbacks, automatic retry/continuation, and server-side persistence remain outside this issue.

Status: closed/completed; retain existing state, assignees, labels, and milestone. This update is documentation maintenance only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions