beam-protocol-sdk 0.2.0 → 0.2.1
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 +177 -0
- package/package.json +1 -1
- package/dist/client.d.ts +0 -96
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -293
- package/dist/client.js.map +0 -1
- package/dist/directory.d.ts +0 -15
- package/dist/directory.d.ts.map +0 -1
- package/dist/directory.js +0 -82
- package/dist/directory.js.map +0 -1
- package/dist/frames.d.ts +0 -29
- package/dist/frames.d.ts.map +0 -1
- package/dist/frames.js +0 -133
- package/dist/frames.js.map +0 -1
- package/dist/identity.d.ts +0 -19
- package/dist/identity.d.ts.map +0 -1
- package/dist/identity.js +0 -65
- package/dist/identity.js.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -5
- package/dist/index.js.map +0 -1
- package/dist/types.d.ts +0 -60
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# beam-protocol-sdk · TypeScript SDK
|
|
2
|
+
|
|
3
|
+
> **SMTP for AI Agents** — TypeScript SDK for agent identity, registration, discovery and intent routing via the Beam Protocol.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/beam-protocol-sdk)
|
|
6
|
+
[](https://www.apache.org/licenses/LICENSE-2.0)
|
|
7
|
+
[](https://nodejs.org)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install beam-protocol-sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { BeamIdentity, BeamClient } from 'beam-protocol-sdk'
|
|
21
|
+
|
|
22
|
+
// 1. Generate a Beam identity (Ed25519 keypair)
|
|
23
|
+
const identity = BeamIdentity.generate({
|
|
24
|
+
agentName: 'myagent',
|
|
25
|
+
orgName: 'myorg',
|
|
26
|
+
})
|
|
27
|
+
console.log(identity.beamId) // → myagent@myorg.beam.directory
|
|
28
|
+
|
|
29
|
+
// 2. Connect to the directory
|
|
30
|
+
const client = new BeamClient({
|
|
31
|
+
identity: identity.export(),
|
|
32
|
+
directoryUrl: 'wss://dir.beam.directory',
|
|
33
|
+
})
|
|
34
|
+
await client.connect()
|
|
35
|
+
|
|
36
|
+
// 3. Send a structured intent
|
|
37
|
+
const result = await client.send(
|
|
38
|
+
'other@org.beam.directory',
|
|
39
|
+
'payment.status_check',
|
|
40
|
+
{ invoiceId: 'INV-2847' }
|
|
41
|
+
)
|
|
42
|
+
console.log(result.payload)
|
|
43
|
+
// → { status: 'paid', amount: 2185.00, date: '2026-03-05' }
|
|
44
|
+
|
|
45
|
+
// 4. Or just talk in natural language
|
|
46
|
+
const reply = await client.talk(
|
|
47
|
+
'clara@coppen.beam.directory',
|
|
48
|
+
'Was weißt du über Christopher Schnorrenberg?'
|
|
49
|
+
)
|
|
50
|
+
console.log(reply) // Clara uses her real tools to answer
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Concepts
|
|
54
|
+
|
|
55
|
+
### Beam ID
|
|
56
|
+
|
|
57
|
+
Every agent gets a globally unique **Beam ID**:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
agent@org.beam.directory
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Like email, but for AI agents. Backed by an Ed25519 keypair for cryptographic verification.
|
|
64
|
+
|
|
65
|
+
### Intent Frames
|
|
66
|
+
|
|
67
|
+
Structured JSON messages with built-in security:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { createIntentFrame, signFrame } from 'beam-protocol-sdk'
|
|
71
|
+
|
|
72
|
+
const frame = createIntentFrame({
|
|
73
|
+
from: 'jarvis@coppen.beam.directory',
|
|
74
|
+
to: 'fischer@coppen.beam.directory',
|
|
75
|
+
intent: 'escalation.request',
|
|
76
|
+
payload: { caseId: 'CASE-0042', priority: 'high' },
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
const signed = signFrame(frame, identity.privateKey)
|
|
80
|
+
// → Ed25519 signature, nonce, replay protection included
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Directory
|
|
84
|
+
|
|
85
|
+
Discover agents by org, capability, or connection status:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import { BeamDirectory } from 'beam-protocol-sdk'
|
|
89
|
+
|
|
90
|
+
const directory = new BeamDirectory({
|
|
91
|
+
baseUrl: 'https://api.beam.directory',
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
// Look up a specific agent
|
|
95
|
+
const agent = await directory.lookup('clara@coppen.beam.directory')
|
|
96
|
+
|
|
97
|
+
// Search by org
|
|
98
|
+
const agents = await directory.search({ org: 'coppen', limit: 10 })
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Threads
|
|
102
|
+
|
|
103
|
+
Multi-turn conversations between agents:
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
const thread = client.thread('clara@coppen.beam.directory')
|
|
107
|
+
|
|
108
|
+
const r1 = await thread.send('query.customer', { name: 'Chris' })
|
|
109
|
+
// Clara responds with customer data
|
|
110
|
+
|
|
111
|
+
const r2 = await thread.send('query.deals', { customerId: r1.payload.id })
|
|
112
|
+
// Follow-up in the same conversation context
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## API Reference
|
|
116
|
+
|
|
117
|
+
### `BeamIdentity`
|
|
118
|
+
|
|
119
|
+
| Method | Description |
|
|
120
|
+
|---|---|
|
|
121
|
+
| `BeamIdentity.generate(config)` | Create a new identity with Ed25519 keypair |
|
|
122
|
+
| `identity.beamId` | The agent's Beam ID string |
|
|
123
|
+
| `identity.export()` | Serialize for storage/transport |
|
|
124
|
+
| `BeamIdentity.fromExport(data)` | Restore from serialized data |
|
|
125
|
+
|
|
126
|
+
### `BeamClient`
|
|
127
|
+
|
|
128
|
+
| Method | Description |
|
|
129
|
+
|---|---|
|
|
130
|
+
| `new BeamClient(config)` | Create client with identity + directory URL |
|
|
131
|
+
| `client.connect()` | Connect to directory via WebSocket |
|
|
132
|
+
| `client.send(to, intent, payload)` | Send a structured intent frame |
|
|
133
|
+
| `client.talk(to, message)` | Natural language message (no schema needed) |
|
|
134
|
+
| `client.thread(to)` | Start a multi-turn conversation |
|
|
135
|
+
| `client.disconnect()` | Graceful disconnect |
|
|
136
|
+
|
|
137
|
+
### `BeamDirectory`
|
|
138
|
+
|
|
139
|
+
| Method | Description |
|
|
140
|
+
|---|---|
|
|
141
|
+
| `directory.lookup(beamId)` | Find a specific agent |
|
|
142
|
+
| `directory.search(query)` | Search agents by org/capability |
|
|
143
|
+
| `directory.register(name, capabilities)` | Register agent in directory |
|
|
144
|
+
|
|
145
|
+
### Frame Utilities
|
|
146
|
+
|
|
147
|
+
| Function | Description |
|
|
148
|
+
|---|---|
|
|
149
|
+
| `createIntentFrame(opts)` | Build a new intent frame |
|
|
150
|
+
| `createResultFrame(opts)` | Build a result response frame |
|
|
151
|
+
| `signFrame(frame, privateKey)` | Ed25519-sign a frame |
|
|
152
|
+
| `validateIntentFrame(frame)` | Validate structure + replay protection |
|
|
153
|
+
| `MAX_FRAME_SIZE` | 1024 bytes max per frame |
|
|
154
|
+
| `REPLAY_WINDOW_MS` | 5 minute replay window |
|
|
155
|
+
|
|
156
|
+
## Security
|
|
157
|
+
|
|
158
|
+
- **Ed25519 signatures** on every frame
|
|
159
|
+
- **Nonce-based replay protection** (5 min window)
|
|
160
|
+
- **Deny-by-default ACL** — agents must be explicitly authorized
|
|
161
|
+
- **Schema validation** at the directory level
|
|
162
|
+
- **Rate limiting** — 60 intents/min per agent
|
|
163
|
+
|
|
164
|
+
## Examples
|
|
165
|
+
|
|
166
|
+
See [`examples/`](https://github.com/Beam-directory/beam-protocol/tree/main/examples) in the main repo.
|
|
167
|
+
|
|
168
|
+
## Links
|
|
169
|
+
|
|
170
|
+
- 🌐 [beam.directory](https://beam.directory)
|
|
171
|
+
- 📄 [RFC 0001](https://github.com/Beam-directory/beam-protocol/blob/main/spec/RFC-0001.md)
|
|
172
|
+
- 📖 [Full Documentation](https://github.com/Beam-directory/beam-protocol/tree/main/docs)
|
|
173
|
+
- 🐍 [Python SDK](https://pypi.org/project/beam-directory/)
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
Apache-2.0
|
package/package.json
CHANGED
package/dist/client.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { BeamDirectory } from './directory.js';
|
|
2
|
-
import type { BeamClientConfig, BeamIdString, IntentFrame, ResultFrame, AgentRecord } from './types.js';
|
|
3
|
-
type IntentHandler = (frame: IntentFrame, respond: (options: {
|
|
4
|
-
success: boolean;
|
|
5
|
-
payload?: Record<string, unknown>;
|
|
6
|
-
error?: string;
|
|
7
|
-
errorCode?: string;
|
|
8
|
-
latency?: number;
|
|
9
|
-
}) => ResultFrame) => void | Promise<void>;
|
|
10
|
-
export declare class BeamClient {
|
|
11
|
-
private readonly _identity;
|
|
12
|
-
private readonly _directory;
|
|
13
|
-
private readonly _directoryUrl;
|
|
14
|
-
private _ws;
|
|
15
|
-
private _wsConnected;
|
|
16
|
-
private readonly _pendingResults;
|
|
17
|
-
private readonly _intentHandlers;
|
|
18
|
-
constructor(config: BeamClientConfig);
|
|
19
|
-
get beamId(): BeamIdString;
|
|
20
|
-
get directory(): BeamDirectory;
|
|
21
|
-
register(displayName: string, capabilities: string[]): Promise<AgentRecord>;
|
|
22
|
-
connect(): Promise<void>;
|
|
23
|
-
private _handleMessage;
|
|
24
|
-
send(to: BeamIdString, intent: string, payload?: Record<string, unknown>, timeoutMs?: number): Promise<ResultFrame>;
|
|
25
|
-
private _sendViaWebSocket;
|
|
26
|
-
private _sendViaHttp;
|
|
27
|
-
on(intent: string, handler: IntentHandler): this;
|
|
28
|
-
/**
|
|
29
|
-
* Send a natural language message to another agent.
|
|
30
|
-
* The receiving agent uses its LLM to interpret and respond.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* const reply = await client.talk(
|
|
34
|
-
* 'clara@coppen.beam.directory',
|
|
35
|
-
* 'Was weißt du über Chris Schnorrenberg?'
|
|
36
|
-
* )
|
|
37
|
-
* console.log(reply.message) // Natural language response
|
|
38
|
-
* console.log(reply.structured) // Optional structured data
|
|
39
|
-
*/
|
|
40
|
-
/**
|
|
41
|
-
* Start a multi-turn conversation thread.
|
|
42
|
-
* Returns a Thread object with a `say()` method for follow-ups.
|
|
43
|
-
*/
|
|
44
|
-
thread(to: BeamIdString, options?: {
|
|
45
|
-
language?: string;
|
|
46
|
-
timeoutMs?: number;
|
|
47
|
-
}): BeamThread;
|
|
48
|
-
talk(to: BeamIdString, message: string, options?: {
|
|
49
|
-
context?: Record<string, unknown>;
|
|
50
|
-
language?: string;
|
|
51
|
-
timeoutMs?: number;
|
|
52
|
-
threadId?: string;
|
|
53
|
-
}): Promise<{
|
|
54
|
-
message: string;
|
|
55
|
-
structured?: Record<string, unknown>;
|
|
56
|
-
threadId?: string;
|
|
57
|
-
raw: ResultFrame;
|
|
58
|
-
}>;
|
|
59
|
-
/**
|
|
60
|
-
* Register a natural language handler.
|
|
61
|
-
* Convenience wrapper that listens for conversation.message intents.
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* client.onTalk(async (message, from, respond) => {
|
|
65
|
-
* const answer = await myLLM.generate(message)
|
|
66
|
-
* respond(answer)
|
|
67
|
-
* })
|
|
68
|
-
*/
|
|
69
|
-
onTalk(handler: (message: string, from: BeamIdString, respond: (reply: string, structured?: Record<string, unknown>) => void, frame: IntentFrame) => void | Promise<void>): this;
|
|
70
|
-
disconnect(): void;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* A multi-turn conversation thread between two agents.
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* const chat = client.thread('clara@coppen.beam.directory')
|
|
77
|
-
* const r1 = await chat.say('Was weißt du über Chris?')
|
|
78
|
-
* const r2 = await chat.say('Und seine Pipeline?') // keeps context
|
|
79
|
-
*/
|
|
80
|
-
export declare class BeamThread {
|
|
81
|
-
readonly threadId: string;
|
|
82
|
-
private readonly _client;
|
|
83
|
-
private readonly _to;
|
|
84
|
-
private readonly _language?;
|
|
85
|
-
private readonly _timeoutMs;
|
|
86
|
-
constructor(client: BeamClient, to: BeamIdString, options?: {
|
|
87
|
-
language?: string;
|
|
88
|
-
timeoutMs?: number;
|
|
89
|
-
});
|
|
90
|
-
say(message: string, context?: Record<string, unknown>): Promise<{
|
|
91
|
-
message: string;
|
|
92
|
-
structured?: Record<string, unknown>;
|
|
93
|
-
}>;
|
|
94
|
-
}
|
|
95
|
-
export {};
|
|
96
|
-
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAE9C,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,WAAW,EACX,WAAW,EACZ,MAAM,YAAY,CAAA;AAanB,KAAK,aAAa,GAAG,CACnB,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,CAAC,OAAO,EAAE;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,KAAK,WAAW,KACd,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAiBzB,qBAAa,UAAU;IACrB,OAAO,CAAC,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+0,0 @@
|
|
|
1
|
-
import { BeamIdentity } from './identity.js';
|
|
2
|
-
import { BeamDirectory } from './directory.js';
|
|
3
|
-
import { createIntentFrame, createResultFrame, signFrame, validateIntentFrame } from './frames.js';
|
|
4
|
-
async function openWebSocket(url) {
|
|
5
|
-
if (typeof globalThis.WebSocket !== 'undefined') {
|
|
6
|
-
return new globalThis.WebSocket(url);
|
|
7
|
-
}
|
|
8
|
-
// Node 18-20: use ws package
|
|
9
|
-
const { default: WS } = await import('ws');
|
|
10
|
-
return new WS(url);
|
|
11
|
-
}
|
|
12
|
-
export class BeamClient {
|
|
13
|
-
_identity;
|
|
14
|
-
_directory;
|
|
15
|
-
_directoryUrl;
|
|
16
|
-
_ws = null;
|
|
17
|
-
_wsConnected = false;
|
|
18
|
-
_pendingResults = new Map();
|
|
19
|
-
_intentHandlers = new Map();
|
|
20
|
-
constructor(config) {
|
|
21
|
-
this._identity = BeamIdentity.fromData(config.identity);
|
|
22
|
-
this._directoryUrl = config.directoryUrl;
|
|
23
|
-
this._directory = new BeamDirectory({ baseUrl: config.directoryUrl });
|
|
24
|
-
}
|
|
25
|
-
get beamId() {
|
|
26
|
-
return this._identity.beamId;
|
|
27
|
-
}
|
|
28
|
-
get directory() {
|
|
29
|
-
return this._directory;
|
|
30
|
-
}
|
|
31
|
-
async register(displayName, capabilities) {
|
|
32
|
-
const parsed = BeamIdentity.parseBeamId(this._identity.beamId);
|
|
33
|
-
if (!parsed)
|
|
34
|
-
throw new Error('Invalid beam ID on identity');
|
|
35
|
-
return this._directory.register({
|
|
36
|
-
beamId: this._identity.beamId,
|
|
37
|
-
displayName,
|
|
38
|
-
capabilities,
|
|
39
|
-
publicKey: this._identity.publicKeyBase64,
|
|
40
|
-
org: parsed.org
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
async connect() {
|
|
44
|
-
if (this._ws && this._wsConnected)
|
|
45
|
-
return;
|
|
46
|
-
// Convert http(s) scheme to ws(s) and append /ws path with beamId query param
|
|
47
|
-
const wsUrl = this._directoryUrl
|
|
48
|
-
.replace(/^http:\/\//, 'ws://')
|
|
49
|
-
.replace(/^https:\/\//, 'wss://')
|
|
50
|
-
.replace(/\/$/, '') + `/ws?beamId=${encodeURIComponent(this._identity.beamId)}`;
|
|
51
|
-
return new Promise((resolve, reject) => {
|
|
52
|
-
openWebSocket(wsUrl).then((ws) => {
|
|
53
|
-
this._ws = ws;
|
|
54
|
-
ws.onopen = () => {
|
|
55
|
-
// Wait for the server's connected message before resolving
|
|
56
|
-
};
|
|
57
|
-
ws.onmessage = (event) => {
|
|
58
|
-
this._handleMessage(event.data);
|
|
59
|
-
};
|
|
60
|
-
ws.onclose = () => {
|
|
61
|
-
this._wsConnected = false;
|
|
62
|
-
this._ws = null;
|
|
63
|
-
// Reject all pending results
|
|
64
|
-
for (const [nonce, pending] of this._pendingResults) {
|
|
65
|
-
clearTimeout(pending.timer);
|
|
66
|
-
pending.reject(new Error('WebSocket connection closed'));
|
|
67
|
-
this._pendingResults.delete(nonce);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
ws.onerror = (event) => {
|
|
71
|
-
if (!this._wsConnected) {
|
|
72
|
-
reject(new Error(`WebSocket connection error: ${String(event)}`));
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
// We resolve after receiving the 'connected' message
|
|
76
|
-
const originalHandleMessage = this._handleMessage.bind(this);
|
|
77
|
-
this._handleMessage = (data) => {
|
|
78
|
-
try {
|
|
79
|
-
const msg = JSON.parse(data);
|
|
80
|
-
if (msg.type === 'connected') {
|
|
81
|
-
this._wsConnected = true;
|
|
82
|
-
this._handleMessage = originalHandleMessage;
|
|
83
|
-
resolve();
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
// ignore parse errors during connect phase
|
|
89
|
-
}
|
|
90
|
-
originalHandleMessage(data);
|
|
91
|
-
};
|
|
92
|
-
}).catch(reject);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
_handleMessage(data) {
|
|
96
|
-
let msg;
|
|
97
|
-
try {
|
|
98
|
-
msg = JSON.parse(data);
|
|
99
|
-
}
|
|
100
|
-
catch {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (msg['type'] === 'result') {
|
|
104
|
-
const frame = msg['frame'];
|
|
105
|
-
if (!frame)
|
|
106
|
-
return;
|
|
107
|
-
const pending = this._pendingResults.get(frame.nonce);
|
|
108
|
-
if (pending) {
|
|
109
|
-
clearTimeout(pending.timer);
|
|
110
|
-
this._pendingResults.delete(frame.nonce);
|
|
111
|
-
pending.resolve(frame);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else if (msg['type'] === 'intent') {
|
|
115
|
-
const frame = msg['frame'];
|
|
116
|
-
const senderPublicKey = msg['senderPublicKey'];
|
|
117
|
-
if (!frame || !senderPublicKey)
|
|
118
|
-
return;
|
|
119
|
-
const validation = validateIntentFrame(frame, senderPublicKey);
|
|
120
|
-
if (!validation.valid)
|
|
121
|
-
return;
|
|
122
|
-
const handler = this._intentHandlers.get(frame.intent) ?? this._intentHandlers.get('*');
|
|
123
|
-
if (!handler)
|
|
124
|
-
return;
|
|
125
|
-
const startTime = Date.now();
|
|
126
|
-
const respond = (options) => {
|
|
127
|
-
const latency = options.latency ?? (Date.now() - startTime);
|
|
128
|
-
const resultFrame = createResultFrame({ ...options, nonce: frame.nonce, latency }, this._identity);
|
|
129
|
-
if (this._ws && this._wsConnected) {
|
|
130
|
-
this._ws.send(JSON.stringify({ type: 'result', frame: resultFrame }));
|
|
131
|
-
}
|
|
132
|
-
return resultFrame;
|
|
133
|
-
};
|
|
134
|
-
Promise.resolve(handler(frame, respond)).catch(() => {
|
|
135
|
-
// Swallow handler errors to avoid unhandled rejections
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
async send(to, intent, payload, timeoutMs = 30_000) {
|
|
140
|
-
const frame = createIntentFrame({ intent, from: this._identity.beamId, to, payload }, this._identity);
|
|
141
|
-
signFrame(frame, this._identity.export().privateKeyBase64);
|
|
142
|
-
if (this._ws && this._wsConnected) {
|
|
143
|
-
return this._sendViaWebSocket(frame, timeoutMs);
|
|
144
|
-
}
|
|
145
|
-
return this._sendViaHttp(frame);
|
|
146
|
-
}
|
|
147
|
-
_sendViaWebSocket(frame, timeoutMs) {
|
|
148
|
-
return new Promise((resolve, reject) => {
|
|
149
|
-
const timer = setTimeout(() => {
|
|
150
|
-
this._pendingResults.delete(frame.nonce);
|
|
151
|
-
reject(new Error(`Intent "${frame.intent}" timed out after ${timeoutMs}ms`));
|
|
152
|
-
}, timeoutMs);
|
|
153
|
-
this._pendingResults.set(frame.nonce, { resolve, reject, timer });
|
|
154
|
-
try {
|
|
155
|
-
this._ws.send(JSON.stringify({ type: 'intent', frame }));
|
|
156
|
-
}
|
|
157
|
-
catch (err) {
|
|
158
|
-
clearTimeout(timer);
|
|
159
|
-
this._pendingResults.delete(frame.nonce);
|
|
160
|
-
reject(err);
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
async _sendViaHttp(frame) {
|
|
165
|
-
const baseUrl = this._directoryUrl.replace(/\/$/, '');
|
|
166
|
-
const res = await fetch(`${baseUrl}/intents`, {
|
|
167
|
-
method: 'POST',
|
|
168
|
-
headers: { 'Content-Type': 'application/json' },
|
|
169
|
-
body: JSON.stringify(frame)
|
|
170
|
-
});
|
|
171
|
-
if (!res.ok) {
|
|
172
|
-
throw new Error(`HTTP intent delivery failed: ${res.status} ${res.statusText}`);
|
|
173
|
-
}
|
|
174
|
-
return res.json();
|
|
175
|
-
}
|
|
176
|
-
on(intent, handler) {
|
|
177
|
-
this._intentHandlers.set(intent, handler);
|
|
178
|
-
return this;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Send a natural language message to another agent.
|
|
182
|
-
* The receiving agent uses its LLM to interpret and respond.
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* const reply = await client.talk(
|
|
186
|
-
* 'clara@coppen.beam.directory',
|
|
187
|
-
* 'Was weißt du über Chris Schnorrenberg?'
|
|
188
|
-
* )
|
|
189
|
-
* console.log(reply.message) // Natural language response
|
|
190
|
-
* console.log(reply.structured) // Optional structured data
|
|
191
|
-
*/
|
|
192
|
-
/**
|
|
193
|
-
* Start a multi-turn conversation thread.
|
|
194
|
-
* Returns a Thread object with a `say()` method for follow-ups.
|
|
195
|
-
*/
|
|
196
|
-
thread(to, options) {
|
|
197
|
-
return new BeamThread(this, to, options);
|
|
198
|
-
}
|
|
199
|
-
async talk(to, message, options) {
|
|
200
|
-
if (!message || message.length === 0) {
|
|
201
|
-
throw new Error('Message must be non-empty');
|
|
202
|
-
}
|
|
203
|
-
if (message.length > 32768) {
|
|
204
|
-
throw new Error('Message exceeds maximum length of 32768 characters');
|
|
205
|
-
}
|
|
206
|
-
const payload = {
|
|
207
|
-
message,
|
|
208
|
-
};
|
|
209
|
-
if (options?.context)
|
|
210
|
-
payload['context'] = options.context;
|
|
211
|
-
if (options?.language)
|
|
212
|
-
payload['language'] = options.language;
|
|
213
|
-
if (options?.threadId)
|
|
214
|
-
payload['threadId'] = options.threadId;
|
|
215
|
-
const result = await this.send(to, 'conversation.message', payload, options?.timeoutMs ?? 60_000);
|
|
216
|
-
return {
|
|
217
|
-
message: result.payload?.['message'] ?? '',
|
|
218
|
-
structured: result.payload?.['structured'],
|
|
219
|
-
threadId: result.payload?.['threadId'] ?? options?.threadId,
|
|
220
|
-
raw: result,
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Register a natural language handler.
|
|
225
|
-
* Convenience wrapper that listens for conversation.message intents.
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* client.onTalk(async (message, from, respond) => {
|
|
229
|
-
* const answer = await myLLM.generate(message)
|
|
230
|
-
* respond(answer)
|
|
231
|
-
* })
|
|
232
|
-
*/
|
|
233
|
-
onTalk(handler) {
|
|
234
|
-
this.on('conversation.message', (frame, rawRespond) => {
|
|
235
|
-
const message = frame.payload?.['message'] ?? '';
|
|
236
|
-
const respond = (reply, structured) => {
|
|
237
|
-
rawRespond({
|
|
238
|
-
success: true,
|
|
239
|
-
payload: {
|
|
240
|
-
message: reply,
|
|
241
|
-
...(structured ? { structured } : {}),
|
|
242
|
-
},
|
|
243
|
-
});
|
|
244
|
-
};
|
|
245
|
-
return handler(message, frame.from, respond, frame);
|
|
246
|
-
});
|
|
247
|
-
return this;
|
|
248
|
-
}
|
|
249
|
-
disconnect() {
|
|
250
|
-
if (this._ws) {
|
|
251
|
-
this._wsConnected = false;
|
|
252
|
-
for (const [nonce, pending] of this._pendingResults) {
|
|
253
|
-
clearTimeout(pending.timer);
|
|
254
|
-
pending.reject(new Error('Client disconnected'));
|
|
255
|
-
this._pendingResults.delete(nonce);
|
|
256
|
-
}
|
|
257
|
-
this._ws.close();
|
|
258
|
-
this._ws = null;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* A multi-turn conversation thread between two agents.
|
|
264
|
-
*
|
|
265
|
-
* @example
|
|
266
|
-
* const chat = client.thread('clara@coppen.beam.directory')
|
|
267
|
-
* const r1 = await chat.say('Was weißt du über Chris?')
|
|
268
|
-
* const r2 = await chat.say('Und seine Pipeline?') // keeps context
|
|
269
|
-
*/
|
|
270
|
-
export class BeamThread {
|
|
271
|
-
threadId;
|
|
272
|
-
_client;
|
|
273
|
-
_to;
|
|
274
|
-
_language;
|
|
275
|
-
_timeoutMs;
|
|
276
|
-
constructor(client, to, options) {
|
|
277
|
-
this._client = client;
|
|
278
|
-
this._to = to;
|
|
279
|
-
this._language = options?.language;
|
|
280
|
-
this._timeoutMs = options?.timeoutMs ?? 60_000;
|
|
281
|
-
this.threadId = crypto.randomUUID();
|
|
282
|
-
}
|
|
283
|
-
async say(message, context) {
|
|
284
|
-
const result = await this._client.talk(this._to, message, {
|
|
285
|
-
threadId: this.threadId,
|
|
286
|
-
context,
|
|
287
|
-
language: this._language,
|
|
288
|
-
timeoutMs: this._timeoutMs,
|
|
289
|
-
});
|
|
290
|
-
return { message: result.message, structured: result.structured };
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAqClG,KAAK,UAAU,aAAa,CAAC,GAAW;IACtC,IAAI,OAAO,UAAU,CAAC,SAAS,KAAK,WAAW,EAAE,CAAC;QAChD,OAAO,IAAK,UAAU,CAAC,SAAgD,CAAC,GAAG,CAAC,CAAA;IAC9E,CAAC;IACD,6BAA6B;IAC7B,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAA;IAC1C,OAAO,IAAI,EAAE,CAAC,GAAG,CAA6B,CAAA;AAChD,CAAC;AAED,MAAM,OAAO,UAAU;IACJ,SAAS,CAAc;IACvB,UAAU,CAAe;IACzB,aAAa,CAAQ;IAC9B,GAAG,GAAyB,IAAI,CAAA;IAChC,YAAY,GAAG,KAAK,CAAA;IACX,eAAe,GAAG,IAAI,GAAG,EAAyB,CAAA;IAClD,eAAe,GAAG,IAAI,GAAG,EAAyB,CAAA;IAEnE,YAAY,MAAwB;QAClC,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QACvD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,YAAY,CAAA;QACxC,IAAI,CAAC,U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AQ,EAAE,IAAI,CAAC,SAAS;YACxB,SAAS,EAAE,IAAI,CAAC,UAAU;SAC3B,CAAC,CAAA;QACF,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAA;IACnE,CAAC;CACF"}
|
package/dist/directory.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { AgentRecord, AgentRegistration, AgentSearchQuery, BeamIdString, DirectoryConfig } from './types.js';
|
|
2
|
-
export declare class BeamDirectoryError extends Error {
|
|
3
|
-
readonly statusCode: number;
|
|
4
|
-
constructor(message: string, statusCode: number);
|
|
5
|
-
}
|
|
6
|
-
export declare class BeamDirectory {
|
|
7
|
-
private readonly baseUrl;
|
|
8
|
-
private readonly headers;
|
|
9
|
-
constructor(config: DirectoryConfig);
|
|
10
|
-
register(registration: AgentRegistration): Promise<AgentRecord>;
|
|
11
|
-
lookup(beamId: BeamIdString): Promise<AgentRecord | null>;
|
|
12
|
-
search(query: AgentSearchQuery): Promise<AgentRecord[]>;
|
|
13
|
-
heartbeat(beamId: BeamIdString): Promise<void>;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=directory.d.ts.map
|
package/dist/directory.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EAChB,MAAM,YAAY,CAAA;AAiBnB,qBAAa,kBAAmB,SAAQ,KAAK;aAGzB,UAAU,EAAE,MAAM;gBADlC,OAAO,EAAE,MAAM,EACC,UAAU,EAAE,MAAM;CAKrC;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;gBAEpC,MAAM,EAAE,eAAe;IAQ7B,QAAQ,CAAC,YAAY,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;IAa/D,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IASzD,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAcvD,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CASrD"}
|
package/dist/directory.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/** Normalize snake_case server response to camelCase AgentRecord */
|
|
2
|
-
function normalizeAgent(raw) {
|
|
3
|
-
return {
|
|
4
|
-
beamId: (raw.beamId ?? raw.beam_id),
|
|
5
|
-
displayName: (raw.displayName ?? raw.display_name ?? ''),
|
|
6
|
-
capabilities: (raw.capabilities ?? []),
|
|
7
|
-
publicKey: (raw.publicKey ?? raw.public_key ?? ''),
|
|
8
|
-
org: (raw.org ?? ''),
|
|
9
|
-
trustScore: (raw.trustScore ?? raw.trust_score ?? 0),
|
|
10
|
-
verified: (raw.verified ?? false),
|
|
11
|
-
createdAt: (raw.createdAt ?? raw.created_at ?? ''),
|
|
12
|
-
lastSeen: (raw.lastSeen ?? raw.last_seen ?? ''),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export class BeamDirectoryError extends Error {
|
|
16
|
-
statusCode;
|
|
17
|
-
constructor(message, statusCode) {
|
|
18
|
-
super(message);
|
|
19
|
-
this.statusCode = statusCode;
|
|
20
|
-
this.name = 'BeamDirectoryError';
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export class BeamDirectory {
|
|
24
|
-
baseUrl;
|
|
25
|
-
headers;
|
|
26
|
-
constructor(config) {
|
|
27
|
-
this.baseUrl = config.baseUrl.replace(/\/$/, '');
|
|
28
|
-
this.headers = {
|
|
29
|
-
'Content-Type': 'application/json',
|
|
30
|
-
...(config.apiKey && { Authorization: `Bearer ${config.apiKey}` })
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
async register(registration) {
|
|
34
|
-
const res = await fetch(`${this.baseUrl}/agents/register`, {
|
|
35
|
-
method: 'POST',
|
|
36
|
-
headers: this.headers,
|
|
37
|
-
body: JSON.stringify(registration)
|
|
38
|
-
});
|
|
39
|
-
if (!res.ok) {
|
|
40
|
-
const body = await res.json().catch(() => ({ error: res.statusText }));
|
|
41
|
-
throw new BeamDirectoryError(`Registration failed: ${body.error}`, res.status);
|
|
42
|
-
}
|
|
43
|
-
return res.json();
|
|
44
|
-
}
|
|
45
|
-
async lookup(beamId) {
|
|
46
|
-
const res = await fetch(`${this.baseUrl}/agents/${encodeURIComponent(beamId)}`, {
|
|
47
|
-
headers: this.headers
|
|
48
|
-
});
|
|
49
|
-
if (res.status === 404)
|
|
50
|
-
return null;
|
|
51
|
-
if (!res.ok)
|
|
52
|
-
throw new BeamDirectoryError(`Lookup failed: ${res.statusText}`, res.status);
|
|
53
|
-
return res.json();
|
|
54
|
-
}
|
|
55
|
-
async search(query) {
|
|
56
|
-
const params = new URLSearchParams();
|
|
57
|
-
if (query.org)
|
|
58
|
-
params.set('org', query.org);
|
|
59
|
-
if (query.capabilities?.length)
|
|
60
|
-
params.set('capabilities', query.capabilities.join(','));
|
|
61
|
-
if (query.minTrustScore !== undefined)
|
|
62
|
-
params.set('minTrustScore', String(query.minTrustScore));
|
|
63
|
-
if (query.limit !== undefined)
|
|
64
|
-
params.set('limit', String(query.limit));
|
|
65
|
-
const res = await fetch(`${this.baseUrl}/agents/search?${params}`, { headers: this.headers });
|
|
66
|
-
if (!res.ok)
|
|
67
|
-
throw new BeamDirectoryError(`Search failed: ${res.statusText}`, res.status);
|
|
68
|
-
const body = await res.json();
|
|
69
|
-
const raw = Array.isArray(body) ? body : (body?.agents ?? []);
|
|
70
|
-
return raw.map(normalizeAgent);
|
|
71
|
-
}
|
|
72
|
-
async heartbeat(beamId) {
|
|
73
|
-
const res = await fetch(`${this.baseUrl}/agents/${encodeURIComponent(beamId)}/heartbeat`, {
|
|
74
|
-
method: 'POST',
|
|
75
|
-
headers: this.headers
|
|
76
|
-
});
|
|
77
|
-
if (!res.ok && res.status !== 404) {
|
|
78
|
-
throw new BeamDirectoryError(`Heartbeat failed: ${res.statusText}`, res.status);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=directory.js.map
|
package/dist/directory.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory.js","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":"AAQA,oEAAoE;AACpE,SAAS,cAAc,CAAC,GAA4B;IAClD,OAAO;QACL,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,CAA0B;QAC5D,WAAW,EAAE,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,YAAY,IAAI,EAAE,CAAW;QAClE,YAAY,EAAE,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE,CAAa;QAClD,SAAS,EAAE,CAAC,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC,UAAU,IAAI,EAAE,CAAW;QAC5D,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,CAAW;QAC9B,UAAU,EAAE,CAAC,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,WAAW,IAAI,CAAC,CAAW;QAC9D,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,IAAI,KAAK,CAAY;QAC5C,SAAS,EAAE,CAAC,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC,UAAU,IAAI,EAAE,CAAW;QAC5D,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,SAAS,IAAI,EAAE,CAAW;KAC1D,CAAA;AACH,CAAC;AAED,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAGzB;IAFlB,YACE,OAAe,EACC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;QACzF,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAwE,CAAA;QACnG,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,CAAC,CAAA;QAC7D,OAAO,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IAChC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,MAAoB;QAClC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,WAAW,kBAAkB,CAAC,MAAM,CAAC,YAAY,EAAE;YACxF,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAClC,MAAM,IAAI,kBAAkB,CAAC,qBAAqB,GAAG,CAAC,UAAU,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;QACjF,CAAC;IACH,CAAC;CACF"}
|
package/dist/frames.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { IntentFrame, ResultFrame, BeamIdString } from './types.js';
|
|
2
|
-
import { BeamIdentity } from './identity.js';
|
|
3
|
-
export declare const MAX_FRAME_SIZE: number;
|
|
4
|
-
export declare const REPLAY_WINDOW_MS: number;
|
|
5
|
-
export declare function createIntentFrame(options: {
|
|
6
|
-
intent: string;
|
|
7
|
-
from: BeamIdString;
|
|
8
|
-
to: BeamIdString;
|
|
9
|
-
payload?: Record<string, unknown>;
|
|
10
|
-
}, identity: BeamIdentity): IntentFrame;
|
|
11
|
-
export declare function signFrame(frame: IntentFrame, privateKeyBase64: string): IntentFrame;
|
|
12
|
-
export declare function createResultFrame(options: {
|
|
13
|
-
nonce: string;
|
|
14
|
-
success: boolean;
|
|
15
|
-
payload?: Record<string, unknown>;
|
|
16
|
-
error?: string;
|
|
17
|
-
errorCode?: string;
|
|
18
|
-
latency?: number;
|
|
19
|
-
}, identity: BeamIdentity): ResultFrame;
|
|
20
|
-
export declare function validateIntentFrame(frame: unknown, senderPublicKey: string): {
|
|
21
|
-
valid: boolean;
|
|
22
|
-
error?: string;
|
|
23
|
-
};
|
|
24
|
-
export declare function validateResultFrame(frame: unknown, senderPublicKey: string): {
|
|
25
|
-
valid: boolean;
|
|
26
|
-
error?: string;
|
|
27
|
-
};
|
|
28
|
-
export declare function canonicalizeFrame(frame: Record<string, unknown>): string;
|
|
29
|
-
//# sourceMappingURL=frames.d.ts.map
|
package/dist/frames.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../src/frames.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5C,eAAO,MAAM,cAAc,QAAW,CAAA;AACtC,eAAO,MAAM,gBAAgB,QAAgB,CAAA;AAE7C,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE;IACP,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,YAAY,CAAA;IAClB,EAAE,EAAE,YAAY,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC,EACD,QAAQ,EAAE,YAAY,GACrB,WAAW,CAWb;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,GAAG,WAAW,CAiBnF;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE;IACP,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,EACD,QAAQ,EAAE,YAAY,GACrB,WAAW,CAab;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,MAAM,GACtB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CA8CpC;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,MAAM,GACtB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAkBpC;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAExE"}
|
package/dist/frames.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { randomUUID, createPrivateKey, sign } from 'node:crypto';
|
|
2
|
-
import { BeamIdentity } from './identity.js';
|
|
3
|
-
export const MAX_FRAME_SIZE = 4 * 1024; // 4KB hard limit
|
|
4
|
-
export const REPLAY_WINDOW_MS = 5 * 60 * 1000; // 5 minutes
|
|
5
|
-
export function createIntentFrame(options, identity) {
|
|
6
|
-
const frame = {
|
|
7
|
-
v: '1',
|
|
8
|
-
intent: options.intent,
|
|
9
|
-
from: options.from,
|
|
10
|
-
to: options.to,
|
|
11
|
-
payload: options.payload ?? {},
|
|
12
|
-
nonce: randomUUID(),
|
|
13
|
-
timestamp: new Date().toISOString()
|
|
14
|
-
};
|
|
15
|
-
return signFrame(frame, identity.export().privateKeyBase64);
|
|
16
|
-
}
|
|
17
|
-
export function signFrame(frame, privateKeyBase64) {
|
|
18
|
-
const signedPayload = JSON.stringify({
|
|
19
|
-
type: 'intent',
|
|
20
|
-
from: frame.from,
|
|
21
|
-
to: frame.to,
|
|
22
|
-
intent: frame.intent,
|
|
23
|
-
payload: frame.payload,
|
|
24
|
-
timestamp: frame.timestamp,
|
|
25
|
-
nonce: frame.nonce,
|
|
26
|
-
});
|
|
27
|
-
const privateKey = createPrivateKey({
|
|
28
|
-
key: Buffer.from(privateKeyBase64, 'base64'),
|
|
29
|
-
format: 'der',
|
|
30
|
-
type: 'pkcs8',
|
|
31
|
-
});
|
|
32
|
-
frame.signature = sign(null, Buffer.from(signedPayload, 'utf8'), privateKey).toString('base64');
|
|
33
|
-
return frame;
|
|
34
|
-
}
|
|
35
|
-
export function createResultFrame(options, identity) {
|
|
36
|
-
const frame = {
|
|
37
|
-
v: '1',
|
|
38
|
-
success: options.success,
|
|
39
|
-
nonce: options.nonce,
|
|
40
|
-
timestamp: new Date().toISOString(),
|
|
41
|
-
...(options.payload !== undefined && { payload: options.payload }),
|
|
42
|
-
...(options.error !== undefined && { error: options.error }),
|
|
43
|
-
...(options.errorCode !== undefined && { errorCode: options.errorCode }),
|
|
44
|
-
...(options.latency !== undefined && { latency: options.latency })
|
|
45
|
-
};
|
|
46
|
-
frame.signature = identity.sign(canonicalizeFrame(frame));
|
|
47
|
-
return frame;
|
|
48
|
-
}
|
|
49
|
-
export function validateIntentFrame(frame, senderPublicKey) {
|
|
50
|
-
if (!frame || typeof frame !== 'object') {
|
|
51
|
-
return { valid: false, error: 'Frame must be an object' };
|
|
52
|
-
}
|
|
53
|
-
const f = frame;
|
|
54
|
-
if (f['v'] !== '1')
|
|
55
|
-
return { valid: false, error: 'Invalid protocol version' };
|
|
56
|
-
if (typeof f['intent'] !== 'string' || !f['intent'])
|
|
57
|
-
return { valid: false, error: 'Missing or empty intent' };
|
|
58
|
-
if (typeof f['from'] !== 'string' || !BeamIdentity.parseBeamId(f['from'])) {
|
|
59
|
-
return { valid: false, error: 'Invalid from Beam ID' };
|
|
60
|
-
}
|
|
61
|
-
if (typeof f['to'] !== 'string' || !BeamIdentity.parseBeamId(f['to'])) {
|
|
62
|
-
return { valid: false, error: 'Invalid to Beam ID' };
|
|
63
|
-
}
|
|
64
|
-
if (typeof f['nonce'] !== 'string' || !f['nonce'])
|
|
65
|
-
return { valid: false, error: 'Missing nonce' };
|
|
66
|
-
if (typeof f['timestamp'] !== 'string')
|
|
67
|
-
return { valid: false, error: 'Missing timestamp' };
|
|
68
|
-
if (!f['payload'] || typeof f['payload'] !== 'object' || Array.isArray(f['payload'])) {
|
|
69
|
-
return { valid: false, error: 'Payload must be an object' };
|
|
70
|
-
}
|
|
71
|
-
const size = Buffer.byteLength(JSON.stringify(frame), 'utf8');
|
|
72
|
-
if (size > MAX_FRAME_SIZE) {
|
|
73
|
-
return { valid: false, error: `Frame size ${size} exceeds limit of ${MAX_FRAME_SIZE} bytes` };
|
|
74
|
-
}
|
|
75
|
-
const frameTime = new Date(f['timestamp']).getTime();
|
|
76
|
-
if (isNaN(frameTime))
|
|
77
|
-
return { valid: false, error: 'Invalid timestamp format' };
|
|
78
|
-
if (Math.abs(Date.now() - frameTime) > REPLAY_WINDOW_MS) {
|
|
79
|
-
return { valid: false, error: 'Frame timestamp outside replay window (±5 minutes)' };
|
|
80
|
-
}
|
|
81
|
-
if (typeof f['signature'] !== 'string')
|
|
82
|
-
return { valid: false, error: 'Missing signature' };
|
|
83
|
-
const signedPayload = JSON.stringify({
|
|
84
|
-
type: 'intent',
|
|
85
|
-
from: f['from'],
|
|
86
|
-
to: f['to'],
|
|
87
|
-
intent: f['intent'],
|
|
88
|
-
payload: f['payload'],
|
|
89
|
-
timestamp: f['timestamp'],
|
|
90
|
-
nonce: f['nonce'],
|
|
91
|
-
});
|
|
92
|
-
if (!BeamIdentity.verify(signedPayload, f['signature'], senderPublicKey)) {
|
|
93
|
-
return { valid: false, error: 'Signature verification failed' };
|
|
94
|
-
}
|
|
95
|
-
return { valid: true };
|
|
96
|
-
}
|
|
97
|
-
export function validateResultFrame(frame, senderPublicKey) {
|
|
98
|
-
if (!frame || typeof frame !== 'object') {
|
|
99
|
-
return { valid: false, error: 'Frame must be an object' };
|
|
100
|
-
}
|
|
101
|
-
const f = frame;
|
|
102
|
-
if (f['v'] !== '1')
|
|
103
|
-
return { valid: false, error: 'Invalid protocol version' };
|
|
104
|
-
if (typeof f['success'] !== 'boolean')
|
|
105
|
-
return { valid: false, error: 'Missing success boolean' };
|
|
106
|
-
if (typeof f['nonce'] !== 'string' || !f['nonce'])
|
|
107
|
-
return { valid: false, error: 'Missing nonce' };
|
|
108
|
-
if (typeof f['timestamp'] !== 'string')
|
|
109
|
-
return { valid: false, error: 'Missing timestamp' };
|
|
110
|
-
if (typeof f['signature'] !== 'string')
|
|
111
|
-
return { valid: false, error: 'Missing signature' };
|
|
112
|
-
const { signature, ...unsigned } = f;
|
|
113
|
-
if (!BeamIdentity.verify(canonicalizeFrame(unsigned), signature, senderPublicKey)) {
|
|
114
|
-
return { valid: false, error: 'Signature verification failed' };
|
|
115
|
-
}
|
|
116
|
-
return { valid: true };
|
|
117
|
-
}
|
|
118
|
-
export function canonicalizeFrame(frame) {
|
|
119
|
-
return JSON.stringify(deepSortKeys(frame));
|
|
120
|
-
}
|
|
121
|
-
function deepSortKeys(value) {
|
|
122
|
-
if (Array.isArray(value))
|
|
123
|
-
return value.map(deepSortKeys);
|
|
124
|
-
if (value !== null && typeof value === 'object') {
|
|
125
|
-
const sorted = {};
|
|
126
|
-
for (const key of Object.keys(value).sort()) {
|
|
127
|
-
sorted[key] = deepSortKeys(value[key]);
|
|
128
|
-
}
|
|
129
|
-
return sorted;
|
|
130
|
-
}
|
|
131
|
-
return value;
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=frames.js.map
|
package/dist/frames.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frames.js","sourceRoot":"","sources":["../src/frames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,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K,EAAE,KAAK,EAAE,KAAK,EAAE,+BAA+B,EAAE,CAAA;IACjE,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AACxB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAA8B;IAC9D,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;AAC5C,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;IACxD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,MAAM,GAA4B,EAAE,CAAA;QAC1C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YACtD,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAE,KAAiC,CAAC,GAAG,CAAC,CAAC,CAAA;QACrE,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/dist/identity.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { BeamIdString, BeamIdentityConfig, BeamIdentityData } from './types.js';
|
|
2
|
-
export declare class BeamIdentity {
|
|
3
|
-
readonly beamId: BeamIdString;
|
|
4
|
-
readonly publicKeyBase64: string;
|
|
5
|
-
private readonly _privateKey;
|
|
6
|
-
private readonly _publicKey;
|
|
7
|
-
private constructor();
|
|
8
|
-
static generate(config: BeamIdentityConfig): BeamIdentity;
|
|
9
|
-
static fromData(data: BeamIdentityData): BeamIdentity;
|
|
10
|
-
export(): BeamIdentityData;
|
|
11
|
-
sign(data: string): string;
|
|
12
|
-
static verify(data: string, signatureBase64: string, publicKeyBase64: string): boolean;
|
|
13
|
-
static parseBeamId(beamId: string): {
|
|
14
|
-
agent: string;
|
|
15
|
-
org: string;
|
|
16
|
-
} | null;
|
|
17
|
-
static generateNonce(): string;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=identity.d.ts.map
|
package/dist/identity.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAEpF,qBAAa,YAAY;IACvB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAW;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAW;IAEtC,OAAO;IAOP,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY;IAMzD,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,YAAY;IAcrD,MAAM,IAAI,gBAAgB;IAQ1B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAK1B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO;IAkBtF,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAMzE,MAAM,CAAC,aAAa,IAAI,MAAM;CAG/B"}
|
package/dist/identity.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { generateKeyPairSync, sign, verify, createPrivateKey, createPublicKey, randomUUID } from 'node:crypto';
|
|
2
|
-
export class BeamIdentity {
|
|
3
|
-
beamId;
|
|
4
|
-
publicKeyBase64;
|
|
5
|
-
_privateKey;
|
|
6
|
-
_publicKey;
|
|
7
|
-
constructor(beamId, privateKey, publicKey) {
|
|
8
|
-
this.beamId = beamId;
|
|
9
|
-
this._privateKey = privateKey;
|
|
10
|
-
this._publicKey = publicKey;
|
|
11
|
-
this.publicKeyBase64 = publicKey.export({ type: 'spki', format: 'der' }).toString('base64');
|
|
12
|
-
}
|
|
13
|
-
static generate(config) {
|
|
14
|
-
const { privateKey, publicKey } = generateKeyPairSync('ed25519');
|
|
15
|
-
const beamId = `${config.agentName}@${config.orgName}.beam.directory`;
|
|
16
|
-
return new BeamIdentity(beamId, privateKey, publicKey);
|
|
17
|
-
}
|
|
18
|
-
static fromData(data) {
|
|
19
|
-
const privateKey = createPrivateKey({
|
|
20
|
-
key: Buffer.from(data.privateKeyBase64, 'base64'),
|
|
21
|
-
format: 'der',
|
|
22
|
-
type: 'pkcs8'
|
|
23
|
-
});
|
|
24
|
-
const publicKey = createPublicKey({
|
|
25
|
-
key: Buffer.from(data.publicKeyBase64, 'base64'),
|
|
26
|
-
format: 'der',
|
|
27
|
-
type: 'spki'
|
|
28
|
-
});
|
|
29
|
-
return new BeamIdentity(data.beamId, privateKey, publicKey);
|
|
30
|
-
}
|
|
31
|
-
export() {
|
|
32
|
-
return {
|
|
33
|
-
beamId: this.beamId,
|
|
34
|
-
publicKeyBase64: this.publicKeyBase64,
|
|
35
|
-
privateKeyBase64: this._privateKey.export({ type: 'pkcs8', format: 'der' }).toString('base64')
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
sign(data) {
|
|
39
|
-
const signature = sign(null, Buffer.from(data, 'utf8'), this._privateKey);
|
|
40
|
-
return signature.toString('base64');
|
|
41
|
-
}
|
|
42
|
-
static verify(data, signatureBase64, publicKeyBase64) {
|
|
43
|
-
try {
|
|
44
|
-
const publicKey = createPublicKey({
|
|
45
|
-
key: Buffer.from(publicKeyBase64, 'base64'),
|
|
46
|
-
format: 'der',
|
|
47
|
-
type: 'spki'
|
|
48
|
-
});
|
|
49
|
-
return verify(null, Buffer.from(data, 'utf8'), publicKey, Buffer.from(signatureBase64, 'base64'));
|
|
50
|
-
}
|
|
51
|
-
catch {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
static parseBeamId(beamId) {
|
|
56
|
-
const match = beamId.match(/^([a-z0-9_-]+)@([a-z0-9_-]+)\.beam\.directory$/);
|
|
57
|
-
if (!match)
|
|
58
|
-
return null;
|
|
59
|
-
return { agent: match[1], org: match[2] };
|
|
60
|
-
}
|
|
61
|
-
static generateNonce() {
|
|
62
|
-
return randomUUID();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=identity.js.map
|
package/dist/identity.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,IAAI,EACJ,MAAM,EACN,gBAAgB,EAChB,eAAe,EACf,UAAU,EAEX,MAAM,aAAa,CAAA;AAGpB,MAAM,OAAO,YAAY;IACd,MAAM,CAAc;IACpB,eAAe,CAAQ;IACf,WAAW,CAAW;IACtB,UAAU,CAAW;IAEtC,YAAoB,MAAoB,EAAE,UAAqB,EAAE,SAAoB;QACnF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;QAC7B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;QAC3B,IAAI,CAAC,eAAe,GAAI,SAAS,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACzG,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,MAA0B;QACxC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAA;QAChE,MA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ACH,MAAM,SAAS,GAAG,eAAe,CAAC;gBAChC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC;gBAC3C,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,MAAM;aACb,CAAC,CAAA;YACF,OAAO,MAAM,CACX,IAAI,EACJ,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EACzB,SAAS,EACT,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CACvC,CAAA;QACH,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAA;QACd,CAAC;IACH,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,MAAc;QAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAA;QAC5E,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAA;QACvB,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAC3C,CAAC;IAED,MAAM,CAAC,aAAa;QAClB,OAAO,UAAU,EAAE,CAAA;IACrB,CAAC;CACF"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { BeamIdentity } from './identity.js';
|
|
2
|
-
export { BeamDirectory, BeamDirectoryError } from './directory.js';
|
|
3
|
-
export { BeamClient, BeamThread } from './client.js';
|
|
4
|
-
export { createIntentFrame, createResultFrame, signFrame, validateIntentFrame, validateResultFrame, canonicalizeFrame, MAX_FRAME_SIZE, REPLAY_WINDOW_MS } from './frames.js';
|
|
5
|
-
export type { BeamIdString, BeamIdentityConfig, BeamIdentityData, IntentFrame, ResultFrame, AgentRegistration, AgentRecord, DirectoryConfig, BeamClientConfig, AgentSearchQuery } from './types.js';
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EACjB,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,YAAY,CAAA"}
|
package/dist/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { BeamIdentity } from './identity.js';
|
|
2
|
-
export { BeamDirectory, BeamDirectoryError } from './directory.js';
|
|
3
|
-
export { BeamClient, BeamThread } from './client.js';
|
|
4
|
-
export { createIntentFrame, createResultFrame, signFrame, validateIntentFrame, validateResultFrame, canonicalizeFrame, MAX_FRAME_SIZE, REPLAY_WINDOW_MS } from './frames.js';
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EACjB,MAAM,aAAa,CAAA"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/** Beam ID format: agent@org.beam.directory */
|
|
2
|
-
export type BeamIdString = `${string}@${string}.beam.directory`;
|
|
3
|
-
export interface BeamIdentityConfig {
|
|
4
|
-
agentName: string;
|
|
5
|
-
orgName: string;
|
|
6
|
-
}
|
|
7
|
-
export interface BeamIdentityData {
|
|
8
|
-
beamId: BeamIdString;
|
|
9
|
-
publicKeyBase64: string;
|
|
10
|
-
privateKeyBase64: string;
|
|
11
|
-
}
|
|
12
|
-
export interface IntentFrame {
|
|
13
|
-
v: '1';
|
|
14
|
-
intent: string;
|
|
15
|
-
from: BeamIdString;
|
|
16
|
-
to: BeamIdString;
|
|
17
|
-
payload: Record<string, unknown>;
|
|
18
|
-
nonce: string;
|
|
19
|
-
timestamp: string;
|
|
20
|
-
signature?: string;
|
|
21
|
-
}
|
|
22
|
-
export interface ResultFrame {
|
|
23
|
-
v: '1';
|
|
24
|
-
success: boolean;
|
|
25
|
-
payload?: Record<string, unknown>;
|
|
26
|
-
error?: string;
|
|
27
|
-
errorCode?: string;
|
|
28
|
-
nonce: string;
|
|
29
|
-
timestamp: string;
|
|
30
|
-
latency?: number;
|
|
31
|
-
signature?: string;
|
|
32
|
-
}
|
|
33
|
-
export interface AgentRegistration {
|
|
34
|
-
beamId: BeamIdString;
|
|
35
|
-
displayName: string;
|
|
36
|
-
capabilities: string[];
|
|
37
|
-
publicKey: string;
|
|
38
|
-
org: string;
|
|
39
|
-
}
|
|
40
|
-
export interface AgentRecord extends AgentRegistration {
|
|
41
|
-
trustScore: number;
|
|
42
|
-
verified: boolean;
|
|
43
|
-
createdAt: string;
|
|
44
|
-
lastSeen: string;
|
|
45
|
-
}
|
|
46
|
-
export interface DirectoryConfig {
|
|
47
|
-
baseUrl: string;
|
|
48
|
-
apiKey?: string;
|
|
49
|
-
}
|
|
50
|
-
export interface BeamClientConfig {
|
|
51
|
-
identity: BeamIdentityData;
|
|
52
|
-
directoryUrl: string;
|
|
53
|
-
}
|
|
54
|
-
export interface AgentSearchQuery {
|
|
55
|
-
org?: string;
|
|
56
|
-
capabilities?: string[];
|
|
57
|
-
minTrustScore?: number;
|
|
58
|
-
limit?: number;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,MAAM,MAAM,YAAY,GAAG,GAAG,MAAM,IAAI,MAAM,iBAAiB,CAAA;AAE/D,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,YAAY,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,GAAG,CAAA;IACN,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,YAAY,CAAA;IAClB,EAAE,EAAE,YAAY,CAAA;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,GAAG,CAAA;IACN,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,YAAY,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,WAAY,SAAQ,iBAAiB;IACpD,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,OAAO,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf"}
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|