Skip to content

feat(sdk): in-process link-mode adapter for single-process service mounting #451

Description

@rickylabs

Part of #327

Handle: #E1 · Milestone: 0.0.1-beta.8 (precursor — land early in the window). · Depends on: nothing (server-side ServiceApp.fetch() mount seam already ships). Blocks: #E4.

Scope — in-process link-mode adapter for single-process service mounting

Add createInProcessClientLink (packages/sdk/src/client/in-process-client-link.ts), the in-process registry (packages/sdk/src/client/in-process-registry.ts: registerInProcessService/resolveInProcessService/clearInProcessServices), the ServiceClientTransport discriminated union + transport option on CreateServiceClientOptions, the branch in createServiceClient, and the createInProcessServiceClient convenience. Export all on the @netscript/sdk mod + JSR export map.

Strikes the mis-referenced "172a-2 service-base-seam" dependency — PR #172 is merged CLI type-soundness, unrelated (drift E1).

Acceptance

  1. createInProcessClientLink reuses oRPC RPCLink with fetch: (req,init) => app.fetch(new Request(req,init)) and the identical apiPath/apiVersion/pathSegment pathname as the HTTP link — no bespoke RPC codec.
  2. In-process and HTTP clients for the same built service return byte-identical results for a representative contract (round-trip parity test — the anti-divergence guarantee).
  3. W3C trace propagation preserved in-process (traceparent/tracestate reach the mounted app).
  4. transport defaults to http; every existing createServiceClient caller unchanged (existing sdk tests stay green).
  5. Registry: unknown serviceName throws a clear error; clearInProcessServices() isolates tests.
  6. gate:jsr: deno doc --lint clean on the new public surface (A1); no any, no upstream oRPC/Hono types leaked into the public signature beyond existing structural mirrors (A7); deno publish --dry-run green.
  7. Decide the sdk↔service dependency direction for ServiceApp (O-1): import type {ServiceApp} from @netscript/service or mirror its 2-method structural shape in sdk. Record choice + rationale.

Design source: design/E-desktop/epic-and-issues.md (#E1).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions