@agent-relay/sdk 17.2.1 → 18.0.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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Core TypeScript SDK for Agent Relay communication. The SDK gives agents and applications three public capabilities: messaging, delivery, and actions.
4
4
 
5
- Use `@agent-relay/sdk` when your app, service, harness, or worker already owns its runtime and needs to participate in Agent Relay. Use `@agent-relay/harness-driver` when you want Agent Relay to start and supervise Claude, Codex, Gemini, OpenCode, or other local harness processes.
5
+ Use `@agent-relay/sdk` when your app, service, harness, or worker already owns its runtime and needs to participate in Agent Relay. To have Agent Relay start and supervise Claude, Codex, OpenCode, or other agent sessions on a machine, run `relay init`: the Agent Relay core it starts spawns, injects into and releases them.
6
6
 
7
7
  Full docs: [agentrelay.com/docs](https://agentrelay.com/docs/typescript-sdk) (markdown mirrors for agents and CLI tooling at [agentrelay.com/llms.txt](https://agentrelay.com/llms.txt)).
8
8
 
@@ -17,7 +17,7 @@ npm install @agent-relay/sdk zod
17
17
  - **Messaging** is durable agent communication: identities, channels, DMs, group DMs, threads, reactions, inbox, read state, presence, search, and events.
18
18
  - **Delivery** is runtime handoff: taking durable messages from Agent Relay and injecting them into a live agent process, service, app server, browser worker, or harness.
19
19
  - **Actions** are typed capabilities: discoverable operations with Zod schemas, fire-and-forget invocation, audit events, and `action.completed` results delivered to listeners.
20
- - **Runtime** is optional managed execution. Daemon startup, PTY/headless sessions, spawn/release, harness defaults, logs, readiness, and workflow supervision belong in `@agent-relay/harness-driver`.
20
+ - **Runtime** is optional managed execution. Spawning, injecting into and releasing agent sessions on a machine belong to the Agent Relay core that `relay init` starts.
21
21
 
22
22
  ## Quick start
23
23
 
@@ -175,7 +175,7 @@ Delivery is the session handoff contract. Relay stores messages durably; a sessi
175
175
  - `DeliveryRunner` can drain inbox items into either a session `receiveMessage(...)` contract or a legacy `inject(...)` adapter.
176
176
  - Send operations support idempotency keys so retries do not duplicate messages.
177
177
 
178
- Managed harness delivery, such as injecting messages into a PTY or headless app server, belongs in `@agent-relay/harness-driver`. The SDK stays responsible for the public delivery contract.
178
+ Managed harness delivery, such as injecting messages into a running agent session, belongs to the Agent Relay core. The SDK stays responsible for the public delivery contract.
179
179
 
180
180
  Minimum session contract:
181
181
 
@@ -223,44 +223,24 @@ await new DeliveryRunner({
223
223
  }).start();
224
224
  ```
225
225
 
226
- ## Optional managed harnesses
226
+ ## Managed harnesses
227
227
 
228
- Install the harness packages for managed local execution:
229
-
230
- ```bash
231
- npm install @agent-relay/harnesses @agent-relay/harness-driver
232
- ```
233
-
234
- `create({ relay })` spawns the agent **and** self-registers it, returning the same live client shape as `relay.workspace.register(...)`:
235
-
236
- ```ts
237
- import { claude, codex } from '@agent-relay/harnesses';
238
-
239
- const planner = await claude.create({ relay, model: 'sonnet' });
240
- const engineer = await codex.create({ relay, model: 'gpt-5.5' });
241
-
242
- await planner.sendMessage({ to: '#reviews', text: `${engineer.handle} let's pair on the migration.` });
243
- ```
244
-
245
- `@agent-relay/harness-driver` owns:
246
-
247
- - Local broker process startup and connection files.
248
- - PTY and headless harness transports.
249
- - Claude, Codex, Gemini, OpenCode, and custom CLI spawn defaults.
250
- - Agent lifecycle hooks, session metadata, idle detection, managed release, and shutdown.
251
- - Workflow and supervision helpers that coordinate multiple spawned harnesses.
252
-
253
- Keep application-level messaging code on `@agent-relay/sdk`; add the harness packages only at the boundary that owns local agent processes.
228
+ The managed-harness packages `@agent-relay/harnesses` and
229
+ `@agent-relay/harness-driver` were retired together with the local broker. Their
230
+ published versions stay installable from npm for existing integrations, but no
231
+ new versions ship. For managed agent sessions on a machine, use the Agent Relay
232
+ core that `relay init` starts; keep application-level messaging code on
233
+ `@agent-relay/sdk`.
254
234
 
255
235
  ## Migration from the pre-v8 SDK
256
236
 
257
- | Previous SDK surface | Version 8 replacement |
258
- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------- |
259
- | `relay.agents.register(...)` + `relay.as(agent)` token handoff | `relay.workspace.register(...)` returns the live client directly. |
260
- | `relay.sendMessage(...)`, `relay.system()` | Send from a registered participant: `agent.sendMessage(...)`. |
261
- | `agent.events.on(...)`, `relay.on(...)` | `relay.addListener(selector, handler)` — the single listener entry point. |
262
- | `relay.actions.register(...)` / `relay.actions.invoke(...)` returning inline results | `relay.registerAction(...)`; results reach listeners via `action.completed`. |
263
- | Spawn methods on `AgentRelay` (`spawnAgent()`, PTY/headless helpers) | `@agent-relay/harnesses` `create({ relay })` + `@agent-relay/harness-driver`. |
237
+ | Previous SDK surface | Version 8 replacement |
238
+ | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------- |
239
+ | `relay.agents.register(...)` + `relay.as(agent)` token handoff | `relay.workspace.register(...)` returns the live client directly. |
240
+ | `relay.sendMessage(...)`, `relay.system()` | Send from a registered participant: `agent.sendMessage(...)`. |
241
+ | `agent.events.on(...)`, `relay.on(...)` | `relay.addListener(selector, handler)` — the single listener entry point. |
242
+ | `relay.actions.register(...)` / `relay.actions.invoke(...)` returning inline results | `relay.registerAction(...)`; results reach listeners via `action.completed`. |
243
+ | Spawn methods on `AgentRelay` (`spawnAgent()`, PTY/headless helpers) | The Agent Relay core started by `relay init`. |
264
244
 
265
245
  See the [migration guide](https://agentrelay.com/docs/migration) for details.
266
246
 
@@ -5,15 +5,14 @@ import type { AgentIdentity, AgentIdentityInput, HarnessConfig } from './types.j
5
5
  /**
6
6
  * Common shape of any agent produced by a harness factory: a {@link RelayAgentHandle}
7
7
  * (so `relay.on(agent.status.becomes(...))` works) tagged with the `kind` of factory
8
- * that built it (e.g. `'session'`, or `'pty'` from `@agent-relay/harnesses`).
8
+ * that built it (e.g. `'session'`).
9
9
  */
10
10
  export interface RelayHarnessAgent extends RelayAgentHandle {
11
11
  kind: string;
12
12
  }
13
13
  /**
14
14
  * A harness factory: `create`/`new` produce a registerable {@link RelayHarnessAgent}.
15
- * The in-process session harnesses below and the PTY harnesses in
16
- * `@agent-relay/harnesses` share this shape.
15
+ * The in-process session harnesses below use this shape.
17
16
  */
18
17
  export interface HarnessFactory<TInput, TAgent extends RelayHarnessAgent> {
19
18
  readonly name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEnF;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc,CAAC,MAAM,EAAE,MAAM,SAAS,iBAAiB;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,4DAA4D;IAC5D,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CACjC;AAID;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAKvE;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB,CAAC,MAAM,GAAG,IAAI,CAAE,SAAQ,iBAAiB;IAC3E,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc,CAAC,MAAM,GAAG,IAAI,CAAE,SAAQ,cAAc,CAAC,MAAM,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACxG,QAAQ,CAAC,M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AK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO;QAAE,OAAO,QAAQ,CAAC;IAC9B,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;AAChF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/sdk",
3
- "version": "17.2.1",
3
+ "version": "18.0.0",
4
4
  "engines": {
5
5
  "node": ">=22.0.0"
6
6
  },
Binary file
Binary file
Binary file
Binary file