@godspeedai/cognate-protocol-connect 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +5 -5
  2. package/src/EGM.md +34 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@godspeedai/cognate-protocol-connect",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Maps RuntimeService to the generated Connect service (server routes and a remote client). Transport-agnostic.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -23,10 +23,10 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@bufbuild/protobuf": "2.15.0",
26
- "@godspeedai/cognate-events": "^0.8.0",
27
- "@godspeedai/cognate-kernel-api": "^0.8.0",
28
- "@godspeedai/cognate-proto": "^0.8.0",
29
- "@godspeedai/cognate-runtime-api": "^0.8.0",
26
+ "@godspeedai/cognate-events": "^0.9.0",
27
+ "@godspeedai/cognate-kernel-api": "^0.9.0",
28
+ "@godspeedai/cognate-proto": "^0.9.0",
29
+ "@godspeedai/cognate-runtime-api": "^0.9.0",
30
30
  "@connectrpc/connect": "2.2.0"
31
31
  },
32
32
  "devDependencies": {
package/src/EGM.md ADDED
@@ -0,0 +1,34 @@
1
+ # protocol-connect / src — Connect service mapping
2
+
3
+ ## Overview
4
+
5
+ `registerRuntimeService` binds every `RuntimeService` method to a route on a Connect router and maps `ServiceError` codes to Connect codes `[index.ts:registerRuntimeService]`. `createRemoteRuntimeService` is the mirror: a `RuntimeService` implemented over a Connect transport whose per-caller credential comes from `tokenFor` `[index.ts:createRemoteRuntimeService]`. Caller identity always comes from the transport's authenticator, never from a message body `[index.ts:1]`.
6
+
7
+ ## Interface
8
+
9
+ - `registerRuntimeService` — server routes for `startRun`, `getRun`, `cancelRun`, `streamEvents`, continuations, projections, state, remote offers, and observations `[index.ts:registerRuntimeService]`
10
+ - `createRemoteRuntimeService` — remote `RuntimeService` over a `Transport` `[index.ts:createRemoteRuntimeService]`
11
+ - `errorCodes` — the exported `ServiceErrorCode` to Connect `Code` table `[index.ts:errorCodes]`
12
+ - `HandlerOptions` — `authenticate(headers)` plus `maxJsonDepth` `[index.ts:HandlerOptions]`
13
+ - `decodeValue` — internal `google.protobuf.Value` decoder enforcing the depth bound `[index.ts:decodeValue]`
14
+ - `requireCaller` — internal guard turning a missing caller into `Code.Unauthenticated` `[index.ts:requireCaller]`
15
+
16
+ ## Invariants
17
+
18
+ - `errorCodes` covers all nine `ServiceErrorCode` variants, and the inverse map is built from it, so a code round-trips in both directions `[index.ts:errorCodes]`
19
+ - A JSON value deeper than `maxJsonDepth` is rejected with `Code.InvalidArgument` before reaching the service `[index.ts:decodeValue]`
20
+ - An absent `Value` or one with no oneof case decodes to JSON `null` instead of raising `@bufbuild/protobuf`'s value error `[index.ts:valueToJson]`
21
+ - `uint64` wire fields convert through `BigInt` and back, so positions above `Number.MAX_SAFE_INTEGER` never silently truncate on encode `[index.ts:toBigInt]`
22
+ - A request with no authenticated caller fails with `Code.Unauthenticated` before any service call `[index.ts:requireCaller]`
23
+ - Aborting a `streamEvents` signal ends the remote iteration without raising `[index.ts:createRemoteRuntimeService]`
24
+ - An unrecognized `ResolveOutcome` falls back to `transitioned` when decoding `resolveContinuation` `[index.ts:createRemoteRuntimeService]`
25
+
26
+ ## Side Effects
27
+
28
+ - RPC calls over the supplied `Transport` on the client path `[index.ts:createRemoteRuntimeService]`
29
+ - Reading the `authorization` request header through the `authenticate` callback `[index.ts:requireCaller]`
30
+ - Abort-signal listeners registered per handler call so an aborted request rejects the pending work `[index.ts:withDeadline]`
31
+
32
+ ## Verification
33
+
34
+ - Run: `cd packages/protocol-connect && bun test`