Skip to content

Epic: Typed SDK client contributions — credentials, transport policy, metadata, and cache-safe extensions #1348

Description

@rickylabs

Important

0.0.7 normative scope amendment — 2026-08-13. RFC 0001 was merged by PR #1390 and is the
ratified source of truth. Its public protocol is the versioned SdkClientContribution contract,
contribution-owned context projection, disjoint header ownership, and explicit response-cache
declaration in rfcs/0001-sdk-client-contributions.md. The older envelope, callback-array,
public-link, NetScriptProcedureMeta.policy, #928/#934 milestone, and custom-link-unblocking
statements below are historical proposal text and are non-normative where they conflict with the
merged RFC. Stage 0 is accepted; #1466 owns procedure metadata; #1349#1353 are amended below.

Summary

@netscript/sdk owns a transport nobody can extend. CreateServiceClientOptions is a closed
nine-field record with no headers, fetch, interceptors, plugins, link, or context type
parameter, and ServiceClientContext is a closed interface rather than a type parameter — so the
shipped auth plugin cannot ride the typed client, no plugin can contribute to client construction,
and procedure policy metadata does not exist. Every mechanism needed is already present in the
pinned oRPC 1.14.6, so this is an un-hiding problem, not a missing-primitive problem. This RFC
ratifies one versioned SdkClientContribution contract that carries client construction, request
context, headers/credentials, transport middleware, $meta policy metadata, response/error types,
and query defaults/invalidation through a single typed chain, before #928 defines a second
contribution dialect and before #934 invents its own policy shape.

Evidence

Current surface

createServiceClient(options)createORPCClient(createHttpClientLink(...))
(packages/sdk/src/client/service-client.ts:41-66). The link is constructed once with literal
headers, literal plugins, hard-coded fetch, and method: inferRPCMethodFromContractRouter(contract). The only per-call seam that works is the retry/dedupe
knob set typed into ServiceClientContext (http-client-link.ts:27, regression-tested at
packages/sdk/tests/integration/service-client-runtime_test.ts:113,153). defineServices() forwards
the same nine fields and inherits the gap wholesale
(packages/sdk/src/presets/define-services.ts:106-116). There is no plugin-facing client axis
anywhere.

Target contract

A ratified RFC-A that fixes, at minimum:

  • a versioned SdkClientContribution envelope (literal contractVersion, namespaced name,
    environment, requires, typed context marker, headerKeys + headers, the four oRPC
    interceptor/plugin arrays, fetch, errors, query);
  • a composition algebra where the client's per-call context is the intersection of the chain's
    declared contexts and with is optional — a host app with no plugins compiles unchanged;
  • a failure taxonomy in which absence, version mismatch, and conflict fail at compile time or
    construction time, never as a missing header or a silently dropped plugin;
  • NetScriptProcedureMeta.policy as the single policy-metadata shape, threaded through
    baseContract via oc.$meta<…>();
  • server/client environment boundaries that are enforced, not documented;
  • the rule that contributions never observe the HTTP method, so oRPC v2's POST-only default lands in
    one owned function.

Ratification means: the owner accepts or amends the shape, the tracking issue receives its
milestone, and #1349#1353 may proceed. This issue closes only when all implementation children are
merged.

Acceptance

Boundaries

Docs/consumer proof

Ratification is proved by documents, not by code: the RFC text, the owner's written disposition, the
cross-links recorded on #928 and #934, and answers to Q1/Q2 on this issue. Adoption proof belongs to
the children — #1352 and #1353 must each show a working consumer, and #1350 must show
docs/site/services-sdk/sdk.md:199 compiling.

Provenance

Seed run plan-fable5-remediation-roadmap--seed, PR #1347, 2026-08-08. Drafted from the Stage-B
corpus (research/repo-audit/services-sdk.md, research/repo-audit/auth.md,
research/external/orpc.md) and Stage-C synthesis §4 (pack T1) and §5. All source claims re-verified
against worktree baseline fac9e339042c. No GitHub mutation was performed.


Filed from planning seed PR #1347 · source Draft-ID T1-01 · live issue #1348.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:pluginsplugins/* and plugin-core packagesarea:sdkpackages/sdkepic:sdk-client-contribTyped SDK client contribution architecture (RFC 0001)priority:p1HighrfcRequest for Comments - substantial/breaking design changestatus:planHarness plan phasetype:umbrella

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions