@zvada/agent-server 0.3.19 → 0.3.20

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.
package/CHANGELOG.md CHANGED
@@ -1,7 +1,43 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.20
4
+
5
+ - zod is a peer dependency, any 4.x (`^4.0.0`), where it was a dependency
6
+ at `^4.6.6`. The schemas are the wire contract a consumer builds its own
7
+ with (`.extend`, its own unions and objects), so the two must be one zod's:
8
+ a consumer on another 4.x got a second copy, and its types stopped matching
9
+ ours ("ZodObject … is not assignable to SomeType"). Install zod beside the
10
+ package. The suite passes on zod 4.0.0, 4.4.3 and 4.6.7.
11
+ - A result the client cannot read says where it is wrong:
12
+ `malformed initialize result: harnesses.claude-code.files: …`, where it
13
+ said only `malformed initialize result`.
14
+ - The README lists the `./accounts` seat, and the client's `subscribe` and
15
+ `joinTurn` where it named a `watch` the client no longer has.
16
+
3
17
  ## 0.3.19
4
18
 
19
+ Upgrading from 0.3.18, what the compiler does not tell you:
20
+
21
+ - A client hears a session while its own turn runs there, or while it
22
+ subscribes (wire protocol 6, was 2). A backend that records every event of
23
+ its sessions, one that comes after a turn included (`session.ended`),
24
+ subscribes to them, or calls `subscribeAll()` when it is the server's only
25
+ client.
26
+ - A tool its turn left running is `failed` with a `closure`
27
+ (`outcome_unknown`, `never_ran`) unless the turn was cancelled; it was
28
+ `cancelled`.
29
+ - The `codex-sdk` harness is gone: run a session saved with it on
30
+ `codex-app-server`. `codexAppServer.resolveAuth` is gone: a host's login
31
+ reaches each turn through `credentials`.
32
+ - New events for an exhaustive match: `elicitation.requested`,
33
+ `elicitation.resolved`, `session.limits` and `session.mode`; the
34
+ reducer's change kinds are snake_case (`part_upserted`).
35
+ - An agent's `capabilities` name `files` and `rejectionMessages`, and
36
+ `AgentServer` calls its runtime's `onCliProgress` and `onAuthUpdated`: a
37
+ fake runtime or agent in a test supplies them.
38
+ - The Claude Agent SDK is at least 0.3.277; a product that bundles it sets
39
+ `provision.pins.claude` to its version (agent-server pins 0.3.288).
40
+
5
41
  Breaking since 0.3.18:
6
42
 
7
43
  - Each harness's login is the engine's to read and to run, through its CLI
package/README.md CHANGED
@@ -5,19 +5,23 @@ OpenAI Codex (app-server), and any [ACP](https://agentclientprotocol.com)
5
5
  agent behind one interface with a single normalized event stream, multi-turn
6
6
  sessions, resume, engine-brokered permissions, and pinned CLI provisioning.
7
7
 
8
- One package, five seats — pick the subpath for how you consume it:
8
+ One package, six seats — pick the subpath for how you consume it:
9
9
 
10
10
  | Import | Seat |
11
11
  | --- | --- |
12
12
  | `@zvada/agent-server` (or `/protocol`) | **The wire contract** — zod schemas for `Part`, `LifecycleEvent`, `RunRequest`, wire method envelopes, harness/model/thinking vocabulary, token usage, UUIDv7 ids. Zod-only, safe in any runtime (workers, browsers, node, bun). |
13
13
  | `@zvada/agent-server/core` | **The engine** — `AgentRuntime`, harness agents + adapters, registry, CLI provisioning. Embed it in-process behind an `EventSink`. |
14
14
  | `@zvada/agent-server/server` | **The standard wire** — serve the engine over JSON-RPC 2.0 NDJSON (stdio / WebSocket listen / dial-out) with quick-ack turns, per-session `seq`, bounded replay, and an ACP v1 binding (`--acp`). Ships the `agent-server` bin. |
15
- | `@zvada/agent-server/client` | **The typed consumer client** — spawn/connect/attach, `runTurn` as an async iterable, permission responses, reconnect with sequenced replay healing (a turn start whose ack a dropped connection lost is re-sent and joins the running turn), `watch` to follow a session another client started. Depends only on the contract + node builtins. |
15
+ | `@zvada/agent-server/client` | **The typed consumer client** — spawn/connect/attach, `runTurn` as an async iterable, permission responses, reconnect with sequenced replay healing (a turn start whose ack a dropped connection lost is re-sent and joins the running turn), `subscribe` / `joinTurn` to follow a session or a turn another client started, the harnesses' logins (`authStatus`, `login`). Depends only on the contract + node builtins. |
16
+ | `@zvada/agent-server/accounts` | **A login the product holds** — sign a subscription in for a credential the product stores (ChatGPT, Claude), renew it, and answer each turn's credential request (`createCredentialHandler`, `credentialsFrom`). `fetch` and Web Crypto only: it runs in a Worker. |
16
17
  | `@zvada/agent-server/sync` | **Experimental.** Optional durable journal port and history helpers: transfer, open, follow, managed sync. |
17
18
  | `@zvada/agent-server/sync/sqlite` | **Experimental.** Bun SQLite journal with its history and checkpoint store. |
18
19
  | `@zvada/agent-server/sync/node-sqlite` | **Experimental.** Same storage under Node >=22.16 using built-in SQLite (itself experimental in Node 22). |
19
20
  | `@zvada/agent-server/core/proxy` | Optional BYOK Anthropic proxy building block. |
20
21
 
22
+ zod is a peer (any 4.x): install it beside the package, and your schemas and
23
+ ours are one zod's.
24
+
21
25
  ## Embed the engine
22
26
 
23
27
  ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../../../src/client/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAGlB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD,2DAA2D;AAC3D,qBAAa,gBAAiB,SAAQ,KAAK;IAGzC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO;IAJxB,SAAkB,IAAI,sBAAsB;gBAElC,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,IAAI,CAAC,EAAE,OAAO,YAAA;CAIxB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,mBAAmB,EACxD,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,CAAC,GACL,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CAEhC;AAED,iEAAiE;AACjE,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,SAAS,iBAAiB,EACjD,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,UAAU,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,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,CAAC,EAC3B,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GACpB,OAAO,CAAC,CAAC,CAAC;IA2Cb,sDAAsD;IACtD,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,GAAG,IAAI;IAWjE,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAO3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zvada/agent-server",
3
- "version": "0.3.19",
3
+ "version": "0.3.20",
4
4
  "description": "Harness-agnostic agent execution engine: run Claude Code, Codex (app-server), and any ACP agent behind one interface with a normalized event stream, multi-turn sessions, and resume. Root export is the wire contract; /core, /server, /client are the seats.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -113,12 +113,10 @@
113
113
  "default": "./src/sync/node-sqlite.ts"
114
114
  }
115
115
  },
116
- "dependencies": {
117
- "zod": "^4.6.6"
118
- },
119
116
  "peerDependencies": {
120
117
  "@agentclientprotocol/sdk": ">=1.3.0",
121
- "@anthropic-ai/claude-agent-sdk": ">=0.3.277"
118
+ "@anthropic-ai/claude-agent-sdk": ">=0.3.277",
119
+ "zod": "^4.0.0"
122
120
  },
123
121
  "peerDependenciesMeta": {
124
122
  "@agentclientprotocol/sdk": {
@@ -132,6 +130,7 @@
132
130
  "@agentclientprotocol/sdk": "^1.7.0",
133
131
  "@anthropic-ai/claude-agent-sdk": "0.3.288",
134
132
  "@openai/codex": "0.160.0",
135
- "@types/bun": "^1.2.0"
133
+ "@types/bun": "^1.2.0",
134
+ "zod": "^4.6.7"
136
135
  }
137
136
  }
package/src/client/rpc.ts CHANGED
@@ -26,6 +26,14 @@ export class WireRequestError extends Error {
26
26
  }
27
27
  }
28
28
 
29
+ /** Where a result failed its schema, as the first issue says: `: harnesses.acp.files: …`. */
30
+ function whereMalformed(error: unknown): string {
31
+ const issue = (error as { issues?: { path: PropertyKey[]; message: string }[] } | undefined)
32
+ ?.issues?.[0];
33
+ if (!issue) return "";
34
+ return `: ${issue.path.length ? `${issue.path.map(String).join(".")}: ` : ""}${issue.message}`;
35
+ }
36
+
29
37
  /**
30
38
  * What a refusal carries, read by its name (`WIRE_REFUSAL_DATA`): undefined
31
39
  * unless `error` is that refusal and its data is well formed. A
@@ -95,9 +103,12 @@ export class Rpc {
95
103
  let result: T;
96
104
  try {
97
105
  result = decode(raw);
98
- } catch {
106
+ } catch (error) {
99
107
  reject(
100
- new WireRequestError(WIRE_ERROR_CODES.internalError, `malformed ${method} result`),
108
+ new WireRequestError(
109
+ WIRE_ERROR_CODES.internalError,
110
+ `malformed ${method} result${whereMalformed(error)}`,
111
+ ),
101
112
  );
102
113
  return;
103
114
  }