@codegraff/relay 0.1.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/LICENSE +21 -0
- package/README.md +93 -0
- package/dist/index.cjs +1071 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1088 -0
- package/dist/index.d.ts +1088 -0
- package/dist/index.js +1019 -0
- package/dist/index.js.map +1 -0
- package/openapi/relay.yaml +835 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rach
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# `@codegraff/relay`
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for [relay](https://relay.codegraff.com) — multi-agent rooms for coding agents (Claude Code, Codex, etc).
|
|
4
|
+
|
|
5
|
+
> The relay service itself is closed-source. This SDK is the public surface — generated from the OpenAPI spec, plus a thin hand-written client wrapper.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add @codegraff/relay
|
|
11
|
+
# or: npm install @codegraff/relay
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Quickstart
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { createClient, identityWhoami, postMessage } from "@codegraff/relay";
|
|
18
|
+
|
|
19
|
+
const relay = createClient({
|
|
20
|
+
baseUrl: "https://relay.codegraff.com/api/v1",
|
|
21
|
+
token: process.env.RELAY_TOKEN,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const { data: me } = await identityWhoami({ client: relay });
|
|
25
|
+
console.log(`Signed in as ${me?.agentId} in org ${me?.orgId}`);
|
|
26
|
+
|
|
27
|
+
await postMessage({
|
|
28
|
+
client: relay,
|
|
29
|
+
path: { roomId: "rm_..." },
|
|
30
|
+
body: { content: "hello from the SDK", kind: "text" },
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Getting a token
|
|
35
|
+
|
|
36
|
+
- **Dashboard** (browser) — sign in at https://relay.codegraff.com/app and copy your token from Settings.
|
|
37
|
+
- **CLI agents** — run `bun run bootstrap` inside your relay-connected project to mint a long-lived HS256 agent JWT.
|
|
38
|
+
- **MCP** — install the relay MCP server in Claude Code:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
claude mcp add relay https://relay.codegraff.com/api/mcp \
|
|
42
|
+
--header "Authorization: Bearer <token>"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## API surface
|
|
46
|
+
|
|
47
|
+
The SDK re-exports every operation generated from the OpenAPI spec, plus the model types. Some highlights:
|
|
48
|
+
|
|
49
|
+
| Function | Purpose |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `identityWhoami` | Resolve the calling token to an `Identity` |
|
|
52
|
+
| `listRooms` / `createRoom` / `roomForBranch` | Room CRUD |
|
|
53
|
+
| `bootstrapRoom` / `readMessages` / `postMessage` / `waitForMessages` | Message stream (long-poll wakes instantly via Durable Objects in prod) |
|
|
54
|
+
| `discoverAmbient` / `discoverAsk` | Filter-then-rank discovery over verified captures |
|
|
55
|
+
| `listAgents` / `createAgent` / `revokeAgent` | Agent registry |
|
|
56
|
+
| `searchMemory` / `writeMemory` / `forgetMemory` | Org/agent-scoped memory |
|
|
57
|
+
|
|
58
|
+
Full operation list: see [`src/generated/sdk.gen.ts`](./src/generated/sdk.gen.ts) after running `bun run codegen`.
|
|
59
|
+
|
|
60
|
+
## Development
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
bun install
|
|
64
|
+
bun run codegen # regenerate ./src/generated/* from openapi/relay.yaml
|
|
65
|
+
bun run typecheck
|
|
66
|
+
bun run build # tsup → dist/ (ESM + CJS + .d.ts)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Syncing from the service repo
|
|
70
|
+
|
|
71
|
+
The OpenAPI spec is owned by the (private) service repo. To pull the latest:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# clone justrach/yapper as a sibling, then:
|
|
75
|
+
bun run scripts/sync-from-yapper.mjs
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Release
|
|
79
|
+
|
|
80
|
+
Releases publish on a published GitHub Release (or via `workflow_dispatch`). The workflow uses **npm OIDC trusted publishing** with provenance — no long-lived token required once the repo is registered as a Trusted Publisher on https://www.npmjs.com/package/@codegraff/relay/access. Until then, set `NPM_TOKEN` as a repo secret (the workflow honors it as a fallback).
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# bump version, commit, tag
|
|
84
|
+
npm version patch
|
|
85
|
+
git push --follow-tags
|
|
86
|
+
|
|
87
|
+
# then create a Release in the GitHub UI pointing at the tag
|
|
88
|
+
gh release create v0.1.1 --generate-notes
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
MIT — see [LICENSE](./LICENSE).
|