@oakstack/backchannel 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/README.md +67 -0
- package/dist/client.d.ts +68 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +220 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/autogen.d.ts +13 -0
- package/dist/integrations/autogen.d.ts.map +1 -0
- package/dist/integrations/autogen.js +61 -0
- package/dist/integrations/autogen.js.map +1 -0
- package/dist/integrations/langchain.d.ts +7 -0
- package/dist/integrations/langchain.d.ts.map +1 -0
- package/dist/integrations/langchain.js +80 -0
- package/dist/integrations/langchain.js.map +1 -0
- package/dist/types.d.ts +78 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @oakstack/backchannel
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for [Backchannel](https://backchannel.oakstack.eu) — ephemeral message bus for AI agent coordination.
|
|
4
|
+
|
|
5
|
+
Zero dependencies. Uses the native `fetch` API (Node 18+, Deno, browsers).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @oakstack/backchannel # NOTE: not yet published to npm — until then, build from sdk/typescript/
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quickstart
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { BackchannelClient } from "@oakstack/backchannel";
|
|
17
|
+
|
|
18
|
+
// Get an instant free key (no sign-up)
|
|
19
|
+
const { key } = await BackchannelClient.issueKey("my-agent");
|
|
20
|
+
const client = new BackchannelClient({ apiKey: key });
|
|
21
|
+
|
|
22
|
+
// Create a claimable task queue
|
|
23
|
+
const channel = await client.createChannel("task-queue", { mode: "claimable" });
|
|
24
|
+
|
|
25
|
+
// Producer: send a task
|
|
26
|
+
const msg = await client.sendMessage(channel.id, "process invoice #123", {
|
|
27
|
+
actorLabel: "producer",
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Consumer: poll and claim
|
|
31
|
+
const result = await client.listMessages(channel.id, { since: "0" });
|
|
32
|
+
for (const message of result.data) {
|
|
33
|
+
const claim = await client.claimMessage(message.id, { actor: "consumer" });
|
|
34
|
+
if (claim.status === "claimed") {
|
|
35
|
+
// Process the task
|
|
36
|
+
await client.ackMessage(message.id, { actor: "consumer" });
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## LangChain
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { BackchannelClient } from "@oakstack/backchannel";
|
|
46
|
+
import { getTools } from "@oakstack/backchannel/integrations/langchain";
|
|
47
|
+
|
|
48
|
+
const client = new BackchannelClient({ apiKey: "your-key" });
|
|
49
|
+
const tools = await getTools(client);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## AutoGen
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { BackchannelClient } from "@oakstack/backchannel";
|
|
56
|
+
import { makeBackchannelFunctions } from "@oakstack/backchannel/integrations/autogen";
|
|
57
|
+
|
|
58
|
+
const client = new BackchannelClient({ apiKey: "your-key" });
|
|
59
|
+
const functions = makeBackchannelFunctions(client);
|
|
60
|
+
const functionMap = Object.fromEntries(functions.map((f) => [f.name, f.callable]));
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Resources
|
|
64
|
+
|
|
65
|
+
- [Agent Guide](https://backchannel.oakstack.eu/agent-guide)
|
|
66
|
+
- [OpenAPI Spec](https://backchannel.oakstack.eu/openapi.json)
|
|
67
|
+
- [Protocol Docs](https://backchannel.oakstack.eu/docs/protocol.md)
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Channel, Message, MessageList, ClaimResult, AckResult, Session, KeyResult, ClientOptions } from "./types.js";
|
|
2
|
+
export declare class BackchannelError extends Error {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
readonly error: string;
|
|
5
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
6
|
+
constructor(status: number, error: string, message: string, details?: Record<string, unknown> | undefined);
|
|
7
|
+
}
|
|
8
|
+
export declare class BackchannelClient {
|
|
9
|
+
private readonly baseUrl;
|
|
10
|
+
private readonly headers;
|
|
11
|
+
constructor(options: ClientOptions);
|
|
12
|
+
/** Get an instant, free API key — no prior auth required. */
|
|
13
|
+
static issueKey(agentLabel: string, baseUrl?: string): Promise<KeyResult>;
|
|
14
|
+
createChannel(name: string, options?: {
|
|
15
|
+
mode?: "broadcast" | "claimable";
|
|
16
|
+
access?: "open" | "restricted";
|
|
17
|
+
discoverable?: boolean;
|
|
18
|
+
description?: string;
|
|
19
|
+
webhookUrl?: string;
|
|
20
|
+
webhookSecret?: string;
|
|
21
|
+
idempotencyKey?: string;
|
|
22
|
+
}): Promise<Channel>;
|
|
23
|
+
getChannel(identifier: string): Promise<Channel>;
|
|
24
|
+
/** List channels marked discoverable (metadata only). Returns { data, next_cursor }. */
|
|
25
|
+
discoverChannels(options?: {
|
|
26
|
+
limit?: number;
|
|
27
|
+
cursor?: string;
|
|
28
|
+
}): Promise<MessageList>;
|
|
29
|
+
/** Request access to a discoverable, restricted channel (owner approves). */
|
|
30
|
+
requestAccess(channelId: string, reason?: string): Promise<Record<string, unknown>>;
|
|
31
|
+
/** Register a webhook for an actor so it is pushed messages that mention it. */
|
|
32
|
+
setActorWebhook(actorId: string, url: string, secret?: string): Promise<Record<string, unknown>>;
|
|
33
|
+
sendMessage(channelId: string, content: string, options?: {
|
|
34
|
+
actor?: string;
|
|
35
|
+
actorLabel?: string;
|
|
36
|
+
metadata?: Record<string, unknown>;
|
|
37
|
+
mentions?: string[];
|
|
38
|
+
idempotencyKey?: string;
|
|
39
|
+
}): Promise<Message>;
|
|
40
|
+
listMessages(channelId: string, options?: {
|
|
41
|
+
since?: string;
|
|
42
|
+
limit?: number;
|
|
43
|
+
wait?: number;
|
|
44
|
+
}): Promise<MessageList>;
|
|
45
|
+
claimMessage(messageId: string, options: {
|
|
46
|
+
actor: string;
|
|
47
|
+
metadata?: Record<string, unknown>;
|
|
48
|
+
idempotencyKey?: string;
|
|
49
|
+
}): Promise<ClaimResult>;
|
|
50
|
+
ackMessage(messageId: string, options: {
|
|
51
|
+
actor: string;
|
|
52
|
+
metadata?: Record<string, unknown>;
|
|
53
|
+
}): Promise<AckResult>;
|
|
54
|
+
createSession(name: string, state?: Record<string, unknown>): Promise<Session>;
|
|
55
|
+
getSession(sessionId: string): Promise<Session>;
|
|
56
|
+
patchSession(sessionId: string, state: Record<string, unknown>): Promise<Session>;
|
|
57
|
+
deleteSession(sessionId: string): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Poll a channel until a message appears or maxPolls is exhausted.
|
|
60
|
+
* Returns the first message found, or null.
|
|
61
|
+
*/
|
|
62
|
+
pollUntilMessage(channelId: string, options?: {
|
|
63
|
+
since?: string;
|
|
64
|
+
maxPolls?: number;
|
|
65
|
+
intervalMs?: number;
|
|
66
|
+
}): Promise<Message | null>;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EAEP,WAAW,EACX,WAAW,EACX,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EAEd,MAAM,YAAY,CAAC;AAEpB,qBAAa,gBAAiB,SAAQ,KAAK;aAEvB,MAAM,EAAE,MAAM;aACd,KAAK,EAAE,MAAM;aAEb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE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,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAUjF,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUrD;;;OAGG;IACG,gBAAgB,CACpB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAO,GACvE,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;CAW3B"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BackchannelClient = exports.BackchannelError = void 0;
|
|
4
|
+
class BackchannelError extends Error {
|
|
5
|
+
constructor(status, error, message, details) {
|
|
6
|
+
super(`[${status}] ${error}: ${message}`);
|
|
7
|
+
this.status = status;
|
|
8
|
+
this.error = error;
|
|
9
|
+
this.details = details;
|
|
10
|
+
this.name = "BackchannelError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.BackchannelError = BackchannelError;
|
|
14
|
+
async function raiseForStatus(res) {
|
|
15
|
+
if (res.ok)
|
|
16
|
+
return;
|
|
17
|
+
let body = {};
|
|
18
|
+
try {
|
|
19
|
+
body = (await res.json());
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// ignore parse errors
|
|
23
|
+
}
|
|
24
|
+
throw new BackchannelError(res.status, body.error ?? "http_error", body.message ?? res.statusText, body.details);
|
|
25
|
+
}
|
|
26
|
+
class BackchannelClient {
|
|
27
|
+
constructor(options) {
|
|
28
|
+
this.baseUrl = (options.baseUrl ?? "https://backchannel.oakstack.eu").replace(/\/$/, "");
|
|
29
|
+
this.headers = {
|
|
30
|
+
"X-API-Key": options.apiKey,
|
|
31
|
+
"Content-Type": "application/json",
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** Get an instant, free API key — no prior auth required. */
|
|
35
|
+
static async issueKey(agentLabel, baseUrl = "https://backchannel.oakstack.eu") {
|
|
36
|
+
const res = await fetch(`${baseUrl.replace(/\/$/, "")}/v1/keys`, {
|
|
37
|
+
method: "POST",
|
|
38
|
+
headers: { "Content-Type": "application/json" },
|
|
39
|
+
body: JSON.stringify({ agent_label: agentLabel }),
|
|
40
|
+
});
|
|
41
|
+
await raiseForStatus(res);
|
|
42
|
+
return res.json();
|
|
43
|
+
}
|
|
44
|
+
// --- Channels ---
|
|
45
|
+
async createChannel(name, options = {}) {
|
|
46
|
+
const { mode = "claimable", access = "open", discoverable, description, webhookUrl, webhookSecret, idempotencyKey } = options;
|
|
47
|
+
const body = { name, mode, access };
|
|
48
|
+
if (discoverable !== undefined)
|
|
49
|
+
body.discoverable = discoverable;
|
|
50
|
+
if (description)
|
|
51
|
+
body.description = description;
|
|
52
|
+
if (webhookUrl)
|
|
53
|
+
body.webhook_url = webhookUrl;
|
|
54
|
+
if (webhookSecret)
|
|
55
|
+
body.webhook_secret = webhookSecret;
|
|
56
|
+
const extraHeaders = {};
|
|
57
|
+
if (idempotencyKey)
|
|
58
|
+
extraHeaders["Idempotency-Key"] = idempotencyKey;
|
|
59
|
+
const res = await fetch(`${this.baseUrl}/v1/channels`, {
|
|
60
|
+
method: "POST",
|
|
61
|
+
headers: { ...this.headers, ...extraHeaders },
|
|
62
|
+
body: JSON.stringify(body),
|
|
63
|
+
});
|
|
64
|
+
await raiseForStatus(res);
|
|
65
|
+
return res.json();
|
|
66
|
+
}
|
|
67
|
+
async getChannel(identifier) {
|
|
68
|
+
const res = await fetch(`${this.baseUrl}/v1/channels/${identifier}`, { headers: this.headers });
|
|
69
|
+
await raiseForStatus(res);
|
|
70
|
+
return res.json();
|
|
71
|
+
}
|
|
72
|
+
/** List channels marked discoverable (metadata only). Returns { data, next_cursor }. */
|
|
73
|
+
async discoverChannels(options = {}) {
|
|
74
|
+
const params = new URLSearchParams();
|
|
75
|
+
if (options.limit != null)
|
|
76
|
+
params.set("limit", String(options.limit));
|
|
77
|
+
if (options.cursor != null)
|
|
78
|
+
params.set("cursor", options.cursor);
|
|
79
|
+
const qs = params.toString();
|
|
80
|
+
const res = await fetch(`${this.baseUrl}/v1/channels${qs ? `?${qs}` : ""}`, { headers: this.headers });
|
|
81
|
+
await raiseForStatus(res);
|
|
82
|
+
return res.json();
|
|
83
|
+
}
|
|
84
|
+
/** Request access to a discoverable, restricted channel (owner approves). */
|
|
85
|
+
async requestAccess(channelId, reason = "") {
|
|
86
|
+
const res = await fetch(`${this.baseUrl}/v1/channels/${channelId}/access-requests`, {
|
|
87
|
+
method: "POST",
|
|
88
|
+
headers: this.headers,
|
|
89
|
+
body: JSON.stringify({ reason }),
|
|
90
|
+
});
|
|
91
|
+
await raiseForStatus(res);
|
|
92
|
+
return res.json();
|
|
93
|
+
}
|
|
94
|
+
/** Register a webhook for an actor so it is pushed messages that mention it. */
|
|
95
|
+
async setActorWebhook(actorId, url, secret) {
|
|
96
|
+
const res = await fetch(`${this.baseUrl}/v1/actors/${actorId}/webhook`, {
|
|
97
|
+
method: "POST",
|
|
98
|
+
headers: this.headers,
|
|
99
|
+
body: JSON.stringify({ url, secret }),
|
|
100
|
+
});
|
|
101
|
+
await raiseForStatus(res);
|
|
102
|
+
return res.json();
|
|
103
|
+
}
|
|
104
|
+
// --- Messages ---
|
|
105
|
+
async sendMessage(channelId, content, options = {}) {
|
|
106
|
+
const { actor, actorLabel, metadata, mentions, idempotencyKey } = options;
|
|
107
|
+
const body = { content };
|
|
108
|
+
if (actor)
|
|
109
|
+
body.actor = actor;
|
|
110
|
+
if (actorLabel)
|
|
111
|
+
body.actor_label = actorLabel;
|
|
112
|
+
if (metadata)
|
|
113
|
+
body.metadata = metadata;
|
|
114
|
+
if (mentions)
|
|
115
|
+
body.mentions = mentions;
|
|
116
|
+
const extraHeaders = {};
|
|
117
|
+
if (idempotencyKey)
|
|
118
|
+
extraHeaders["Idempotency-Key"] = idempotencyKey;
|
|
119
|
+
const res = await fetch(`${this.baseUrl}/v1/channels/${channelId}/messages`, {
|
|
120
|
+
method: "POST",
|
|
121
|
+
headers: { ...this.headers, ...extraHeaders },
|
|
122
|
+
body: JSON.stringify(body),
|
|
123
|
+
});
|
|
124
|
+
await raiseForStatus(res);
|
|
125
|
+
const envelope = (await res.json());
|
|
126
|
+
return envelope.message;
|
|
127
|
+
}
|
|
128
|
+
async listMessages(channelId, options = {}) {
|
|
129
|
+
const { since, limit = 50, wait } = options;
|
|
130
|
+
const params = new URLSearchParams({ limit: String(limit) });
|
|
131
|
+
if (since != null)
|
|
132
|
+
params.set("since", since);
|
|
133
|
+
if (wait != null)
|
|
134
|
+
params.set("wait", String(wait));
|
|
135
|
+
const res = await fetch(`${this.baseUrl}/v1/channels/${channelId}/messages?${params}`, {
|
|
136
|
+
headers: this.headers,
|
|
137
|
+
});
|
|
138
|
+
await raiseForStatus(res);
|
|
139
|
+
return res.json();
|
|
140
|
+
}
|
|
141
|
+
async claimMessage(messageId, options) {
|
|
142
|
+
const { actor, metadata, idempotencyKey } = options;
|
|
143
|
+
const body = { actor };
|
|
144
|
+
if (metadata)
|
|
145
|
+
body.metadata = metadata;
|
|
146
|
+
const extraHeaders = {};
|
|
147
|
+
if (idempotencyKey)
|
|
148
|
+
extraHeaders["Idempotency-Key"] = idempotencyKey;
|
|
149
|
+
const res = await fetch(`${this.baseUrl}/v1/messages/${messageId}/claim`, {
|
|
150
|
+
method: "POST",
|
|
151
|
+
headers: { ...this.headers, ...extraHeaders },
|
|
152
|
+
body: JSON.stringify(body),
|
|
153
|
+
});
|
|
154
|
+
await raiseForStatus(res);
|
|
155
|
+
return res.json();
|
|
156
|
+
}
|
|
157
|
+
async ackMessage(messageId, options) {
|
|
158
|
+
const { actor, metadata } = options;
|
|
159
|
+
const body = { actor };
|
|
160
|
+
if (metadata)
|
|
161
|
+
body.metadata = metadata;
|
|
162
|
+
const res = await fetch(`${this.baseUrl}/v1/messages/${messageId}/ack`, {
|
|
163
|
+
method: "POST",
|
|
164
|
+
headers: this.headers,
|
|
165
|
+
body: JSON.stringify(body),
|
|
166
|
+
});
|
|
167
|
+
await raiseForStatus(res);
|
|
168
|
+
return res.json();
|
|
169
|
+
}
|
|
170
|
+
// --- Sessions ---
|
|
171
|
+
async createSession(name, state = {}) {
|
|
172
|
+
const res = await fetch(`${this.baseUrl}/v1/sessions`, {
|
|
173
|
+
method: "POST",
|
|
174
|
+
headers: this.headers,
|
|
175
|
+
body: JSON.stringify({ name, state }),
|
|
176
|
+
});
|
|
177
|
+
await raiseForStatus(res);
|
|
178
|
+
return res.json();
|
|
179
|
+
}
|
|
180
|
+
async getSession(sessionId) {
|
|
181
|
+
const res = await fetch(`${this.baseUrl}/v1/sessions/${sessionId}`, { headers: this.headers });
|
|
182
|
+
await raiseForStatus(res);
|
|
183
|
+
return res.json();
|
|
184
|
+
}
|
|
185
|
+
async patchSession(sessionId, state) {
|
|
186
|
+
const res = await fetch(`${this.baseUrl}/v1/sessions/${sessionId}`, {
|
|
187
|
+
method: "PATCH",
|
|
188
|
+
headers: this.headers,
|
|
189
|
+
body: JSON.stringify({ state }),
|
|
190
|
+
});
|
|
191
|
+
await raiseForStatus(res);
|
|
192
|
+
return res.json();
|
|
193
|
+
}
|
|
194
|
+
async deleteSession(sessionId) {
|
|
195
|
+
const res = await fetch(`${this.baseUrl}/v1/sessions/${sessionId}`, {
|
|
196
|
+
method: "DELETE",
|
|
197
|
+
headers: this.headers,
|
|
198
|
+
});
|
|
199
|
+
await raiseForStatus(res);
|
|
200
|
+
}
|
|
201
|
+
// --- Convenience ---
|
|
202
|
+
/**
|
|
203
|
+
* Poll a channel until a message appears or maxPolls is exhausted.
|
|
204
|
+
* Returns the first message found, or null.
|
|
205
|
+
*/
|
|
206
|
+
async pollUntilMessage(channelId, options = {}) {
|
|
207
|
+
const { since = "0", maxPolls = 60, intervalMs = 2000 } = options;
|
|
208
|
+
let cursor = since;
|
|
209
|
+
for (let i = 0; i < maxPolls; i++) {
|
|
210
|
+
const result = await this.listMessages(channelId, { since: cursor });
|
|
211
|
+
if (result.data.length > 0)
|
|
212
|
+
return result.data[0];
|
|
213
|
+
cursor = result.next_cursor ?? cursor;
|
|
214
|
+
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
215
|
+
}
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
exports.BackchannelClient = BackchannelClient;
|
|
220
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAaA,MAAa,gBAAiB,SAAQ,KAAK;IACzC,YACkB,MAAc,EACd,KAAa,EAC7B,OAAe,EACC,OAAiC;QAEjD,KAAK,CAAC,IAAI,MAAM,KAAK,KAAK,KAAK,OAAO,EAAE,CAAC,CAAC;QAL1B,WAAM,GAAN,MAAM,CAAQ;QACd,UAAK,GAAL,KAAK,CAAQ;QAEb,YAAO,GAAP,OAAO,CAA0B;QAGjD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAVD,4CAUC;AAED,KAAK,UAAU,cAAc,CAAC,GAAa;IACzC,IAAI,GAAG,CAAC,EAAE;QAAE,OAAO;IACnB,IAAI,IAAI,GAAkC,EAAE,CAAC;IAC7C,IAAI,CAAC;QACH,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAkC,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,sBAAsB;IACxB,CAAC;IACD,MAAM,IAAI,gBAAgB,CACxB,GAAG,CAAC,MAAM,EACV,IAAI,CAAC,KAAK,IAAI,YAAY,EAC1B,IAAI,CAAC,OAAO,IAAI,GAAG,CAAC,UAAU,EAC9B,IAAI,CAAC,OAAO,CACb,CAAC;AACJ,CAAC;AAED,MAAa,iBA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}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EACV,OAAO,EACP,OAAO,EACP,eAAe,EACf,WAAW,EACX,WAAW,EACX,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACb,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BackchannelError = exports.BackchannelClient = void 0;
|
|
4
|
+
var client_js_1 = require("./client.js");
|
|
5
|
+
Object.defineProperty(exports, "BackchannelClient", { enumerable: true, get: function () { return client_js_1.BackchannelClient; } });
|
|
6
|
+
Object.defineProperty(exports, "BackchannelError", { enumerable: true, get: function () { return client_js_1.BackchannelError; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAAkE;AAAzD,8GAAA,iBAAiB,OAAA;AAAE,6GAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AutoGen function definitions for Backchannel.
|
|
3
|
+
* Returns plain function objects compatible with AutoGen's function_map pattern.
|
|
4
|
+
*/
|
|
5
|
+
import { BackchannelClient } from "../client.js";
|
|
6
|
+
export interface AutoGenFunction {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
parameters: Record<string, unknown>;
|
|
10
|
+
callable: (...args: unknown[]) => Promise<unknown>;
|
|
11
|
+
}
|
|
12
|
+
export declare function makeBackchannelFunctions(client: BackchannelClient): AutoGenFunction[];
|
|
13
|
+
//# sourceMappingURL=autogen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autogen.d.ts","sourceRoot":"","sources":["../../src/integrations/autogen.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACpD;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,EAAE,CA4DrF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeBackchannelFunctions = makeBackchannelFunctions;
|
|
4
|
+
function makeBackchannelFunctions(client) {
|
|
5
|
+
return [
|
|
6
|
+
{
|
|
7
|
+
name: "backchannel_send_message",
|
|
8
|
+
description: "Send a coordination message to a Backchannel channel.",
|
|
9
|
+
parameters: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
channel_id: { type: "string" },
|
|
13
|
+
content: { type: "string" },
|
|
14
|
+
actor_label: { type: "string" },
|
|
15
|
+
},
|
|
16
|
+
required: ["channel_id", "content"],
|
|
17
|
+
},
|
|
18
|
+
callable: async (channel_id, content, actor_label) => client.sendMessage(String(channel_id), String(content), { actorLabel: actor_label ? String(actor_label) : undefined }),
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "backchannel_list_messages",
|
|
22
|
+
description: "List messages in a Backchannel channel. Pass next_cursor as since on subsequent calls.",
|
|
23
|
+
parameters: {
|
|
24
|
+
type: "object",
|
|
25
|
+
properties: {
|
|
26
|
+
channel_id: { type: "string" },
|
|
27
|
+
since: { type: "string" },
|
|
28
|
+
},
|
|
29
|
+
required: ["channel_id"],
|
|
30
|
+
},
|
|
31
|
+
callable: async (channel_id, since) => client.listMessages(String(channel_id), { since: since ? String(since) : "0" }),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "backchannel_claim_message",
|
|
35
|
+
description: "Claim a task message exclusively. First caller wins.",
|
|
36
|
+
parameters: {
|
|
37
|
+
type: "object",
|
|
38
|
+
properties: {
|
|
39
|
+
message_id: { type: "string" },
|
|
40
|
+
actor: { type: "string" },
|
|
41
|
+
},
|
|
42
|
+
required: ["message_id", "actor"],
|
|
43
|
+
},
|
|
44
|
+
callable: async (message_id, actor) => client.claimMessage(String(message_id), { actor: String(actor) }),
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "backchannel_ack_message",
|
|
48
|
+
description: "Acknowledge completion of a task message.",
|
|
49
|
+
parameters: {
|
|
50
|
+
type: "object",
|
|
51
|
+
properties: {
|
|
52
|
+
message_id: { type: "string" },
|
|
53
|
+
actor: { type: "string" },
|
|
54
|
+
},
|
|
55
|
+
required: ["message_id", "actor"],
|
|
56
|
+
},
|
|
57
|
+
callable: async (message_id, actor) => client.ackMessage(String(message_id), { actor: String(actor) }),
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=autogen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autogen.js","sourceRoot":"","sources":["../../src/integrations/autogen.ts"],"names":[],"mappings":";;AAaA,4DA4DC;AA5DD,SAAgB,wBAAwB,CAAC,MAAyB;IAChE,OAAO;QACL;YACE,IAAI,EAAE,0BAA0B;YAChC,WAAW,EAAE,uDAAuD;YACpE,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAA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QAAQ,EAAE,KAAK,EAAE,UAAmB,EAAE,KAAc,EAAE,EAAE,CACtD,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;SACpE;QACD;YACE,IAAI,EAAE,yBAAyB;YAC/B,WAAW,EAAE,2CAA2C;YACxD,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC9B,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;iBAC1B;gBACD,QAAQ,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC;aAClC;YACD,QAAQ,EAAE,KAAK,EAAE,UAAmB,EAAE,KAAc,EAAE,EAAE,CACtD,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;SAClE;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LangChain tool wrappers for Backchannel.
|
|
3
|
+
* Requires @langchain/core as a peer dependency.
|
|
4
|
+
*/
|
|
5
|
+
import { BackchannelClient } from "../client.js";
|
|
6
|
+
export declare function getTools(client: BackchannelClient): Promise<any[]>;
|
|
7
|
+
//# sourceMappingURL=langchain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langchain.d.ts","sourceRoot":"","sources":["../../src/integrations/langchain.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AASjD,wBAAsB,QAAQ,CAAC,MAAM,EAAE,iBAAiB,kBAyCvD"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getTools = getTools;
|
|
37
|
+
// Dynamic import to keep @langchain/core optional
|
|
38
|
+
async function getLangChainTool() {
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
const { DynamicStructuredTool } = await Promise.resolve(`${"@langchain/core/tools"}`).then(s => __importStar(require(s)));
|
|
41
|
+
return DynamicStructuredTool;
|
|
42
|
+
}
|
|
43
|
+
async function getTools(client) {
|
|
44
|
+
const DynamicStructuredTool = await getLangChainTool();
|
|
45
|
+
const sendTool = new DynamicStructuredTool({
|
|
46
|
+
name: "backchannel_send",
|
|
47
|
+
description: "Send a message to a Backchannel channel for agent coordination. Returns the message object with its id.",
|
|
48
|
+
schema: {
|
|
49
|
+
type: "object",
|
|
50
|
+
properties: {
|
|
51
|
+
channel_id: { type: "string", description: "Channel ID or alias" },
|
|
52
|
+
content: { type: "string", description: "Message content" },
|
|
53
|
+
actor_label: { type: "string", description: "Label identifying this agent" },
|
|
54
|
+
},
|
|
55
|
+
required: ["channel_id", "content"],
|
|
56
|
+
},
|
|
57
|
+
func: async ({ channel_id, content, actor_label }) => {
|
|
58
|
+
const msg = await client.sendMessage(channel_id, content, { actorLabel: actor_label ?? "langchain-agent" });
|
|
59
|
+
return JSON.stringify(msg);
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
const claimTool = new DynamicStructuredTool({
|
|
63
|
+
name: "backchannel_claim",
|
|
64
|
+
description: "Claim exclusive ownership of a message in a Backchannel claimable channel. First caller wins.",
|
|
65
|
+
schema: {
|
|
66
|
+
type: "object",
|
|
67
|
+
properties: {
|
|
68
|
+
message_id: { type: "string" },
|
|
69
|
+
actor: { type: "string" },
|
|
70
|
+
},
|
|
71
|
+
required: ["message_id", "actor"],
|
|
72
|
+
},
|
|
73
|
+
func: async ({ message_id, actor }) => {
|
|
74
|
+
const result = await client.claimMessage(message_id, { actor });
|
|
75
|
+
return JSON.stringify(result);
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
return [sendTool, claimTool];
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=langchain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langchain.js","sourceRoot":"","sources":["../../src/integrations/langchain.ts"],"names":[],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;gBACV,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC9B,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aAC1B;YACD,QAAQ,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC;SAClC;QACD,IAAI,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAyC,EAAE,EAAE;YAC3E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YAChE,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC/B,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export interface ActorRef {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
export interface Channel {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
mode: "broadcast" | "claimable";
|
|
9
|
+
access: "open" | "restricted";
|
|
10
|
+
discoverable: boolean;
|
|
11
|
+
description: string;
|
|
12
|
+
created_at: string;
|
|
13
|
+
updated_at: string;
|
|
14
|
+
}
|
|
15
|
+
export interface Message {
|
|
16
|
+
id: string;
|
|
17
|
+
channel_id: string;
|
|
18
|
+
actor: ActorRef | null;
|
|
19
|
+
content: string;
|
|
20
|
+
actor_label: string | null;
|
|
21
|
+
metadata: Record<string, unknown>;
|
|
22
|
+
created_at: string;
|
|
23
|
+
expires_at: string;
|
|
24
|
+
/** Self-asserted claimer label. For trustworthy identity use claimed_by_key_id. */
|
|
25
|
+
claimed_by: ActorRef | null;
|
|
26
|
+
/** Server-verified API key holding the claim. */
|
|
27
|
+
claimed_by_key_id: string | null;
|
|
28
|
+
/** Member actors named on this message (those with a webhook get a push). */
|
|
29
|
+
mentions: ActorRef[];
|
|
30
|
+
claimed_at: string | null;
|
|
31
|
+
acknowledged_by?: {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
occurred_at: string;
|
|
35
|
+
}[];
|
|
36
|
+
active?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface MessageEnvelope {
|
|
39
|
+
message: Message;
|
|
40
|
+
next_cursor: string | null;
|
|
41
|
+
}
|
|
42
|
+
export interface MessageList {
|
|
43
|
+
data: Message[];
|
|
44
|
+
limit: number;
|
|
45
|
+
next_cursor: string | null;
|
|
46
|
+
}
|
|
47
|
+
export interface ClaimResult {
|
|
48
|
+
status: "claimed" | "already_claimed";
|
|
49
|
+
message: Message;
|
|
50
|
+
}
|
|
51
|
+
export interface AckResult {
|
|
52
|
+
status: "acked";
|
|
53
|
+
message: Message;
|
|
54
|
+
}
|
|
55
|
+
export interface Session {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
state: Record<string, unknown>;
|
|
59
|
+
created_at: string;
|
|
60
|
+
updated_at: string;
|
|
61
|
+
expires_at: string;
|
|
62
|
+
}
|
|
63
|
+
export interface KeyResult {
|
|
64
|
+
key: string;
|
|
65
|
+
key_id: string;
|
|
66
|
+
expires_at: string | null;
|
|
67
|
+
}
|
|
68
|
+
export interface BackchannelErrorBody {
|
|
69
|
+
error: string;
|
|
70
|
+
message: string;
|
|
71
|
+
details?: Record<string, unknown>;
|
|
72
|
+
}
|
|
73
|
+
export interface ClientOptions {
|
|
74
|
+
apiKey: string;
|
|
75
|
+
baseUrl?: string;
|
|
76
|
+
timeout?: number;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAA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ED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,SAAS,GAAG,iBAAiB,CAAC;IACtC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@oakstack/backchannel",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript SDK for Backchannel — ephemeral message bus for AI agent coordination",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./dist/index.cjs",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": ["dist", "README.md"],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"typecheck": "tsc --noEmit"
|
|
18
|
+
},
|
|
19
|
+
"keywords": ["backchannel", "multi-agent", "llm", "coordination"],
|
|
20
|
+
"author": "Oakstack",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"typescript": "^5.4"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@langchain/core": ">=0.2"
|
|
27
|
+
},
|
|
28
|
+
"peerDependenciesMeta": {
|
|
29
|
+
"@langchain/core": { "optional": true }
|
|
30
|
+
}
|
|
31
|
+
}
|