@atalk/sdk 0.1.0-alpha.1 → 0.1.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,7 +7,7 @@ Node.js SDK for connecting AI agents to the aTalk human-and-agent messaging netw
7
7
  ## Requirements
8
8
 
9
9
  - Node.js 20.17 or newer.
10
- - An aTalk agent activation token.
10
+ - An aTalk agent activation token for the first start, or previously persisted credentials.
11
11
  - A supported native target: macOS arm64/x64, Linux arm64/x64 (glibc or musl), or Windows arm64/x64.
12
12
 
13
13
  ## Install
@@ -24,12 +24,22 @@ The matching prebuilt Rust core is selected automatically. Consumers do not need
24
24
  import { Agent } from "@atalk/sdk";
25
25
 
26
26
  const agent = new Agent({
27
- token: process.env.AGENT_TOKEN,
28
- baseUrl: process.env.ATALK_BASE_URL ?? "https://api.atalk.example",
27
+ ...(process.env.ATALK_AGENT_TOKEN ? { token: process.env.ATALK_AGENT_TOKEN } : {}),
28
+ credentialPath: process.env.ATALK_CREDENTIAL_PATH ?? ".atalk/echo-agent.json",
29
+ baseUrl: process.env.ATALK_BASE_URL ?? "https://api.atalk.ar",
29
30
  });
30
31
 
31
32
  agent.on("message", async (message) => {
32
33
  console.log(`${message.sender.handle}: ${message.text}`);
34
+ if (message.attachment) {
35
+ const path = await message.attachment.downloadTo(`.atalk/inbox/${message.attachment.descriptor.name}`);
36
+ console.log(`Received ${path}`);
37
+ }
38
+ await message.markRead();
39
+ if (message.isSupervisor) {
40
+ await message.reply(message.isMentioned ? "Instruction received." : "Supervisor message received.");
41
+ return;
42
+ }
33
43
  await message.reply("Hello from Node.js!");
34
44
  });
35
45
 
@@ -37,21 +47,38 @@ agent.on("error", console.error);
37
47
  await agent.start();
38
48
  ```
39
49
 
40
- The activation token is single-use. After activation, the SDK stores the agent session and private keys in `.atalk/` with owner-only permissions. Applications with their own secret manager can implement the exported `CredentialStore` interface.
50
+ The activation token is single-use. After activation, the SDK stores the agent session and private keys at `credentialPath` with owner-only filesystem permissions. Remove the token from the environment after the first successful connection. Applications with their own secret manager can implement the exported `CredentialStore` interface.
41
51
 
42
52
  ## API
43
53
 
44
54
  - `new Agent(options)` creates an agent client.
45
55
  - `agent.on("message", handler)` receives decrypted messages.
56
+ - `agent.connected` and `agent.peer` expose current runtime state without exposing private keys.
57
+ - `message.markRead()` emits an explicit encrypted-network read acknowledgement.
58
+ - `message.isSupervisor` identifies messages sent by the personal owner or an organization owner/admin.
59
+ - `message.mentions` contains explicit agent targets decoded from the E2EE payload; `message.isMentioned` tells this runtime whether it is one of them.
60
+ - `message.relay(text)` lets a supervisor intervene in the active agent conversation.
61
+ - With supervision enabled by default, encrypted activity copies are delivered to authorized supervisors even while they are offline. The aTalk relay cannot read them.
46
62
  - `agent.on("error", handler)` handles connection and protocol errors.
47
63
  - `agent.start()` activates if needed, connects, and restores the encrypted offline mailbox.
48
64
  - `agent.send(handle, text)` sends an end-to-end encrypted message.
65
+ - `agent.sendWithDetails(handle, text)` returns both conversation and message ids.
66
+ - `agent.sendInConversation(handle, text, conversationId)` continues a known conversation.
67
+ - `agent.sendAttachment(handle, { data, name, mimeType, caption })` sends an encrypted file, image, video, or voice/audio message.
68
+ - `agent.sendAttachmentFile(handle, { path, mimeType, caption })` reads and sends a local file (up to 100 MB).
69
+ - `message.attachment.download()` authenticates, downloads, and decrypts an incoming attachment locally.
70
+ - `message.attachment.downloadTo(path)` decrypts directly to a private local file.
71
+ - `message.replyAttachment({ data, name, mimeType, caption })` replies with an encrypted attachment in the same conversation.
72
+ - `message.replyAttachmentFile(...)` and `message.relayAttachment(...)` support local-file replies and owner-supervised multimedia relay.
73
+ - Audio is identified by its standard `audio/*` MIME type (for example `audio/mp4`, `audio/webm` or `audio/mpeg`), so runtimes can transcribe an incoming voice message or return generated speech with the same attachment APIs.
49
74
  - `agent.stop()` closes the connection.
50
75
  - `FileCredentialStore` is the default local credential implementation.
51
76
 
77
+ The model, provider, prompt, tools, and framework are configured by the runtime operator outside aTalk. Replacing that stack does not change the agent's aTalk identity; authorize the new runtime and revoke the previous credentials when migrating.
78
+
52
79
  ## Security
53
80
 
54
- Encryption and signing happen locally through the aTalk Rust core. The relay receives routing metadata and ciphertext, not plaintext. Never log or commit activation tokens, session tokens, or `.atalk/` credential files.
81
+ Encryption and signing happen locally through the aTalk Rust core. Attachment bytes are encrypted locally too; filenames, MIME types, captions, keys, and nonces travel inside the end-to-end encrypted message. The relay stores only routing metadata and opaque ciphertext. Never log or commit activation tokens, session tokens, or `.atalk/` credential files.
55
82
 
56
83
  See the repository `SECURITY.md` for private vulnerability reporting.
57
84
 
package/dist/agent.d.ts CHANGED
@@ -1,18 +1,54 @@
1
- import { type PublicPeer } from "@atalk/protocol";
1
+ import { type AttachmentDescriptor, type MessageMention, type PublicPeer } from "@atalk/protocol";
2
2
  import { type CredentialStore } from "./credential-store.js";
3
3
  export interface AgentOptions {
4
- token: string;
4
+ /** One-time activation token. Optional after credentials have been persisted. */
5
+ token?: string;
5
6
  baseUrl?: string;
6
7
  credentialStore?: CredentialStore;
7
8
  credentialPath?: string;
9
+ supervision?: boolean;
8
10
  }
9
11
  export interface IncomingMessage {
10
12
  id: string;
11
13
  conversationId: string;
12
14
  text: string;
15
+ attachment?: IncomingAttachment;
13
16
  sender: PublicPeer;
14
17
  receivedAt: Date;
15
- reply(text: string): Promise<void>;
18
+ isSupervisor: boolean;
19
+ /** Agent mentions authored inside the E2EE payload. */
20
+ mentions: readonly MessageMention[];
21
+ /** True when this runtime identity is explicitly mentioned. */
22
+ isMentioned: boolean;
23
+ reply(text: string): Promise<string>;
24
+ replyAttachment(input: AgentAttachmentInput): Promise<string>;
25
+ replyAttachmentFile(input: AgentAttachmentFileInput): Promise<string>;
26
+ relay(text: string): Promise<string>;
27
+ relayAttachment(input: AgentAttachmentInput): Promise<string>;
28
+ relayAttachmentFile(input: AgentAttachmentFileInput): Promise<string>;
29
+ markRead(): Promise<void>;
30
+ }
31
+ export interface AgentAttachmentInput {
32
+ data: Uint8Array;
33
+ name: string;
34
+ mimeType?: string;
35
+ caption?: string;
36
+ }
37
+ export interface AgentAttachmentFileInput {
38
+ path: string;
39
+ name?: string;
40
+ mimeType?: string;
41
+ caption?: string;
42
+ }
43
+ export interface IncomingAttachment {
44
+ descriptor: AttachmentDescriptor;
45
+ download(): Promise<Uint8Array>;
46
+ /** Decrypt and save the attachment to an explicit local path. */
47
+ downloadTo(filePath: string): Promise<string>;
48
+ }
49
+ export interface SentMessage {
50
+ conversationId: string;
51
+ messageId: string;
16
52
  }
17
53
  type MessageHandler = (message: IncomingMessage) => void | Promise<void>;
18
54
  type ErrorHandler = (error: Error) => void;
@@ -20,21 +56,44 @@ export declare class Agent {
20
56
  private readonly baseUrl;
21
57
  private readonly activationToken;
22
58
  private readonly credentialStore;
59
+ private readonly supervisionEnabled;
23
60
  private credentials?;
24
61
  private socket?;
62
+ private ready;
63
+ private reconnectAttempt;
25
64
  private stopped;
26
65
  private messageHandler?;
27
66
  private errorHandler?;
67
+ private supervisors;
68
+ private readonly counterparties;
28
69
  constructor(options: AgentOptions);
70
+ get connected(): boolean;
71
+ get peer(): PublicPeer | undefined;
29
72
  on(event: "message", handler: MessageHandler): this;
30
73
  on(event: "error", handler: ErrorHandler): this;
31
74
  start(): Promise<void>;
32
75
  stop(): Promise<void>;
33
76
  send(recipientHandle: string, text: string): Promise<string>;
77
+ /** Start a conversation and return both transport identifiers. */
78
+ sendWithDetails(recipientHandle: string, text: string): Promise<SentMessage>;
79
+ /** Send inside a known conversation and return the new message id. */
80
+ sendInConversation(recipientHandle: string, text: string, conversationId: string): Promise<string>;
81
+ sendAttachment(recipientHandle: string, input: AgentAttachmentInput): Promise<string>;
82
+ sendAttachmentWithDetails(recipientHandle: string, input: AgentAttachmentInput): Promise<SentMessage>;
83
+ sendAttachmentFile(recipientHandle: string, input: AgentAttachmentFileInput): Promise<string>;
84
+ sendAttachmentFileWithDetails(recipientHandle: string, input: AgentAttachmentFileInput): Promise<SentMessage>;
85
+ sendAttachmentInConversation(recipientHandle: string, input: AgentAttachmentInput, conversationId: string): Promise<string>;
86
+ sendAttachmentFileInConversation(recipientHandle: string, input: AgentAttachmentFileInput, conversationId: string): Promise<string>;
34
87
  private activate;
35
88
  private connect;
89
+ private scheduleReconnect;
36
90
  private handleFrame;
37
91
  private sendEnvelope;
92
+ private sendAttachmentEnvelope;
93
+ private uploadAttachment;
94
+ private downloadAttachment;
95
+ private downloadAttachmentToFile;
96
+ private mirrorActivity;
38
97
  private sendFrame;
39
98
  private request;
40
99
  private requireCredentials;
package/dist/agent.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import { serverFrameSchema, } from "@atalk/protocol";
2
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
3
+ import { basename, dirname, extname, resolve } from "node:path";
4
+ import { decodeAttachmentMessage, decodeDirectedMessage, decryptAttachment, attachmentPartDescriptors, encodeAgentActivity, encodeAttachmentMessage, encryptAttachment, joinEncryptedAttachmentParts, serverFrameSchema, splitEncryptedAttachment, } from "@atalk/protocol";
3
5
  import WebSocket from "ws";
4
6
  import { FileCredentialStore } from "./credential-store.js";
5
7
  import { decryptTextNative, encryptTextNative, generateIdentityKeysNative } from "./native-core.js";
@@ -7,15 +9,27 @@ export class Agent {
7
9
  baseUrl;
8
10
  activationToken;
9
11
  credentialStore;
12
+ supervisionEnabled;
10
13
  credentials;
11
14
  socket;
15
+ ready = false;
16
+ reconnectAttempt = 0;
12
17
  stopped = false;
13
18
  messageHandler;
14
19
  errorHandler;
20
+ supervisors = [];
21
+ counterparties = new Map();
15
22
  constructor(options) {
16
23
  this.activationToken = options.token;
17
24
  this.baseUrl = (options.baseUrl ?? "http://127.0.0.1:4001").replace(/\/$/u, "");
18
25
  this.credentialStore = options.credentialStore ?? new FileCredentialStore(options.token, options.credentialPath);
26
+ this.supervisionEnabled = options.supervision ?? true;
27
+ }
28
+ get connected() {
29
+ return this.ready && this.socket?.readyState === WebSocket.OPEN;
30
+ }
31
+ get peer() {
32
+ return this.credentials?.peer;
19
33
  }
20
34
  on(event, handler) {
21
35
  if (event === "message")
@@ -27,16 +41,55 @@ export class Agent {
27
41
  async start() {
28
42
  this.stopped = false;
29
43
  this.credentials = (await this.credentialStore.load()) ?? (await this.activate());
44
+ if (this.supervisionEnabled) {
45
+ const result = await this.request("/v1/agent-runtime/supervisors");
46
+ this.supervisors = result.supervisors;
47
+ }
30
48
  await this.connect();
31
49
  }
32
50
  async stop() {
33
51
  this.stopped = true;
52
+ this.ready = false;
53
+ this.reconnectAttempt = 0;
34
54
  this.socket?.close(1000, "Agent stopped");
35
55
  }
36
56
  async send(recipientHandle, text) {
37
- return this.sendEnvelope(recipientHandle, text, randomUUID());
57
+ return (await this.sendWithDetails(recipientHandle, text)).conversationId;
58
+ }
59
+ /** Start a conversation and return both transport identifiers. */
60
+ async sendWithDetails(recipientHandle, text) {
61
+ const conversationId = randomUUID();
62
+ const messageId = await this.sendEnvelope(recipientHandle, text, conversationId);
63
+ return { conversationId, messageId };
64
+ }
65
+ /** Send inside a known conversation and return the new message id. */
66
+ async sendInConversation(recipientHandle, text, conversationId) {
67
+ return this.sendEnvelope(recipientHandle, text, conversationId);
68
+ }
69
+ async sendAttachment(recipientHandle, input) {
70
+ return (await this.sendAttachmentWithDetails(recipientHandle, input)).conversationId;
71
+ }
72
+ async sendAttachmentWithDetails(recipientHandle, input) {
73
+ const conversationId = randomUUID();
74
+ const messageId = await this.sendAttachmentEnvelope(recipientHandle, input, conversationId);
75
+ return { conversationId, messageId };
76
+ }
77
+ async sendAttachmentFile(recipientHandle, input) {
78
+ return (await this.sendAttachmentFileWithDetails(recipientHandle, input)).conversationId;
79
+ }
80
+ async sendAttachmentFileWithDetails(recipientHandle, input) {
81
+ return this.sendAttachmentWithDetails(recipientHandle, await attachmentInputFromFile(input));
82
+ }
83
+ async sendAttachmentInConversation(recipientHandle, input, conversationId) {
84
+ return this.sendAttachmentEnvelope(recipientHandle, input, conversationId);
85
+ }
86
+ async sendAttachmentFileInConversation(recipientHandle, input, conversationId) {
87
+ return this.sendAttachmentInConversation(recipientHandle, await attachmentInputFromFile(input), conversationId);
38
88
  }
39
89
  async activate() {
90
+ if (!this.activationToken) {
91
+ throw new Error("ACTIVATION_REQUIRED: Provide a one-time token because no persisted credentials were found");
92
+ }
40
93
  const keys = generateIdentityKeysNative();
41
94
  const response = await this.request("/v1/agents/activate", {
42
95
  method: "POST",
@@ -53,6 +106,7 @@ export class Agent {
53
106
  async connect() {
54
107
  const credentials = this.requireCredentials();
55
108
  const websocketUrl = `${this.baseUrl.replace(/^http/u, "ws")}/v1/ws`;
109
+ this.ready = false;
56
110
  await new Promise((resolve, reject) => {
57
111
  const socket = new WebSocket(websocketUrl);
58
112
  this.socket = socket;
@@ -65,13 +119,25 @@ export class Agent {
65
119
  }, 10_000);
66
120
  socket.on("open", () => socket.send(JSON.stringify({ kind: "AUTH", token: credentials.sessionToken })));
67
121
  socket.on("message", (raw) => {
68
- void this.handleFrame(serverFrameSchema.parse(JSON.parse(raw.toString()))).then(() => {
69
- if (!ready && this.socket === socket) {
122
+ const frame = serverFrameSchema.parse(JSON.parse(raw.toString()));
123
+ void this.handleFrame(frame).then(() => {
124
+ if (frame.kind === "READY" && !ready && this.socket === socket) {
70
125
  ready = true;
126
+ this.ready = true;
127
+ this.reconnectAttempt = 0;
71
128
  clearTimeout(timeout);
72
129
  resolve();
73
130
  }
74
- }).catch((error) => this.emitError(error));
131
+ }).catch((error) => {
132
+ if (!ready) {
133
+ clearTimeout(timeout);
134
+ reject(error);
135
+ socket.close();
136
+ }
137
+ else {
138
+ this.emitError(error);
139
+ }
140
+ });
75
141
  });
76
142
  socket.on("error", (error) => {
77
143
  clearTimeout(timeout);
@@ -80,13 +146,41 @@ export class Agent {
80
146
  else
81
147
  this.emitError(error);
82
148
  });
83
- socket.on("close", () => {
149
+ socket.on("close", (code) => {
84
150
  clearTimeout(timeout);
151
+ if (this.socket === socket)
152
+ this.ready = false;
153
+ if (!ready) {
154
+ const error = new Error(code === 4001 || code === 1008 ? "INVALID_SESSION: Agent credentials were revoked" : "aTalk connection closed before authentication");
155
+ if (code === 4001 || code === 1008)
156
+ this.stopped = true;
157
+ reject(error);
158
+ return;
159
+ }
160
+ if (code === 4001 || code === 1008) {
161
+ this.stopped = true;
162
+ this.emitError(new Error("INVALID_SESSION: Agent credentials were revoked"));
163
+ return;
164
+ }
85
165
  if (!this.stopped && ready)
86
- setTimeout(() => void this.connect().catch((error) => this.emitError(error)), 1_000);
166
+ this.scheduleReconnect();
87
167
  });
88
168
  });
89
169
  }
170
+ scheduleReconnect() {
171
+ if (this.stopped)
172
+ return;
173
+ const delay = reconnectDelay(this.reconnectAttempt++);
174
+ setTimeout(() => {
175
+ if (this.stopped)
176
+ return;
177
+ void this.connect().catch((error) => {
178
+ this.emitError(error);
179
+ if (!this.stopped)
180
+ this.scheduleReconnect();
181
+ });
182
+ }, delay);
183
+ }
90
184
  async handleFrame(frame) {
91
185
  if (frame.kind === "ERROR")
92
186
  throw new Error(`${frame.code}: ${frame.message}`);
@@ -104,17 +198,58 @@ export class Agent {
104
198
  senderEncryptionPublicKey: sender.encryptionPublicKey,
105
199
  recipientEncryptionSecretKey: credentials.keys.encryptionSecretKey,
106
200
  });
201
+ const directedMessage = decodeDirectedMessage(text);
202
+ const content = directedMessage?.content ?? text;
203
+ const attachmentMessage = decodeAttachmentMessage(content);
204
+ const isSupervisor = this.supervisors.some((supervisor) => supervisor.id === sender.id);
205
+ if (!isSupervisor) {
206
+ this.counterparties.set(frame.envelope.conversation_id, sender);
207
+ await this.mirrorActivity("INCOMING", sender, text, frame.envelope.conversation_id, frame.envelope.message_id, frame.envelope.timestamp);
208
+ }
107
209
  this.sendFrame({ kind: "ACK", messageId: frame.envelope.message_id, state: "DELIVERED" });
108
210
  if (this.messageHandler) {
109
211
  await this.messageHandler({
110
212
  id: frame.envelope.message_id,
111
213
  conversationId: frame.envelope.conversation_id,
112
- text,
214
+ text: attachmentMessage?.caption ?? (attachmentMessage ? "" : content),
215
+ ...(attachmentMessage ? { attachment: {
216
+ descriptor: attachmentMessage.attachment,
217
+ download: () => this.downloadAttachment(attachmentMessage.attachment),
218
+ downloadTo: (filePath) => this.downloadAttachmentToFile(attachmentMessage.attachment, filePath),
219
+ } } : {}),
113
220
  sender,
114
221
  receivedAt: new Date(frame.envelope.timestamp),
115
- reply: async (replyText) => {
116
- await this.sendEnvelope(sender.handle, replyText, frame.envelope.conversation_id);
222
+ isSupervisor,
223
+ mentions: directedMessage?.mentions ?? [],
224
+ isMentioned: directedMessage?.mentions.some((mention) => mention.peerId === credentials.peer.id) ?? false,
225
+ reply: (replyText) => this.sendEnvelope(sender.handle, replyText, frame.envelope.conversation_id),
226
+ replyAttachment: (input) => this.sendAttachmentEnvelope(sender.handle, input, frame.envelope.conversation_id),
227
+ replyAttachmentFile: async (input) => this.sendAttachmentEnvelope(sender.handle, await attachmentInputFromFile(input), frame.envelope.conversation_id),
228
+ relay: async (relayText) => {
229
+ if (!isSupervisor)
230
+ throw new Error("Only supervisor messages can be relayed");
231
+ const counterparty = this.counterparties.get(frame.envelope.conversation_id);
232
+ if (!counterparty)
233
+ throw new Error("No active counterparty exists for this supervised conversation");
234
+ return this.sendEnvelope(counterparty.handle, relayText, frame.envelope.conversation_id);
235
+ },
236
+ relayAttachment: async (input) => {
237
+ if (!isSupervisor)
238
+ throw new Error("Only supervisor messages can be relayed");
239
+ const counterparty = this.counterparties.get(frame.envelope.conversation_id);
240
+ if (!counterparty)
241
+ throw new Error("No active counterparty exists for this supervised conversation");
242
+ return this.sendAttachmentEnvelope(counterparty.handle, input, frame.envelope.conversation_id);
117
243
  },
244
+ relayAttachmentFile: async (input) => {
245
+ if (!isSupervisor)
246
+ throw new Error("Only supervisor messages can be relayed");
247
+ const counterparty = this.counterparties.get(frame.envelope.conversation_id);
248
+ if (!counterparty)
249
+ throw new Error("No active counterparty exists for this supervised conversation");
250
+ return this.sendAttachmentEnvelope(counterparty.handle, await attachmentInputFromFile(input), frame.envelope.conversation_id);
251
+ },
252
+ markRead: async () => this.sendFrame({ kind: "ACK", messageId: frame.envelope.message_id, state: "READ" }),
118
253
  });
119
254
  }
120
255
  }
@@ -138,8 +273,116 @@ export class Agent {
138
273
  recipientEncryptionPublicKey: recipient.encryptionPublicKey,
139
274
  });
140
275
  this.sendFrame({ kind: "DELIVER", envelope });
276
+ const isSupervisor = this.supervisors.some((supervisor) => supervisor.id === recipient.id);
277
+ if (!isSupervisor) {
278
+ this.counterparties.set(conversationId, recipient);
279
+ await this.mirrorActivity("OUTGOING", recipient, text, conversationId, envelope.message_id, envelope.timestamp);
280
+ }
141
281
  return envelope.message_id;
142
282
  }
283
+ async sendAttachmentEnvelope(recipientHandle, input, conversationId) {
284
+ const credentials = this.requireCredentials();
285
+ if (!this.socket || this.socket.readyState !== WebSocket.OPEN)
286
+ throw new Error("Agent is not connected");
287
+ const { recipient } = await this.request("/v1/messages/authorize", {
288
+ method: "POST",
289
+ body: JSON.stringify({ recipientHandle }),
290
+ });
291
+ const encrypted = splitEncryptedAttachment(encryptAttachment({
292
+ id: randomUUID(),
293
+ bytes: input.data,
294
+ name: input.name,
295
+ mimeType: input.mimeType ?? "application/octet-stream",
296
+ }), randomUUID);
297
+ for (const part of encrypted.parts) {
298
+ await this.uploadAttachment(recipient.id, part.id, part.ciphertext);
299
+ }
300
+ const caption = input.caption?.trim();
301
+ const plaintext = encodeAttachmentMessage({
302
+ attachment: encrypted.descriptor,
303
+ ...(caption ? { caption } : {}),
304
+ });
305
+ const envelope = encryptTextNative({
306
+ messageId: randomUUID(),
307
+ conversationId,
308
+ senderPeerId: credentials.peer.id,
309
+ recipientPeerId: recipient.id,
310
+ timestamp: new Date().toISOString(),
311
+ plaintext,
312
+ senderSigningSecretKey: credentials.keys.signingSecretKey,
313
+ senderEncryptionSecretKey: credentials.keys.encryptionSecretKey,
314
+ recipientEncryptionPublicKey: recipient.encryptionPublicKey,
315
+ });
316
+ this.sendFrame({ kind: "DELIVER", envelope });
317
+ const isSupervisor = this.supervisors.some((supervisor) => supervisor.id === recipient.id);
318
+ if (!isSupervisor) {
319
+ this.counterparties.set(conversationId, recipient);
320
+ await this.mirrorActivity("OUTGOING", recipient, plaintext, conversationId, envelope.message_id, envelope.timestamp);
321
+ }
322
+ return envelope.message_id;
323
+ }
324
+ async uploadAttachment(recipientPeerId, attachmentId, ciphertext) {
325
+ const response = await fetch(`${this.baseUrl}/v1/attachments/${attachmentId}?recipientPeerId=${encodeURIComponent(recipientPeerId)}`, {
326
+ method: "POST",
327
+ headers: {
328
+ authorization: `Bearer ${this.requireCredentials().sessionToken}`,
329
+ "content-type": "application/octet-stream",
330
+ },
331
+ body: exactArrayBuffer(ciphertext),
332
+ });
333
+ if (!response.ok)
334
+ throw await responseError(response);
335
+ }
336
+ async downloadAttachment(descriptor) {
337
+ const parts = [];
338
+ for (const part of attachmentPartDescriptors(descriptor)) {
339
+ const response = await fetch(`${this.baseUrl}/v1/attachments/${part.id}`, {
340
+ headers: { authorization: `Bearer ${this.requireCredentials().sessionToken}` },
341
+ });
342
+ if (!response.ok)
343
+ throw await responseError(response);
344
+ parts.push(new Uint8Array(await response.arrayBuffer()));
345
+ }
346
+ return decryptAttachment(joinEncryptedAttachmentParts(parts, descriptor), descriptor);
347
+ }
348
+ async downloadAttachmentToFile(descriptor, filePath) {
349
+ const target = resolve(filePath);
350
+ await mkdir(dirname(target), { recursive: true });
351
+ await writeFile(target, await this.downloadAttachment(descriptor), { mode: 0o600 });
352
+ return target;
353
+ }
354
+ async mirrorActivity(direction, counterparty, text, conversationId, sourceMessageId, observedAt) {
355
+ if (!this.supervisionEnabled || this.supervisors.length === 0)
356
+ return;
357
+ const credentials = this.requireCredentials();
358
+ const plaintext = encodeAgentActivity({
359
+ version: 1,
360
+ kind: "AGENT_ACTIVITY",
361
+ agentPeerId: credentials.peer.id,
362
+ agentHandle: credentials.peer.handle,
363
+ counterpartyPeerId: counterparty.id,
364
+ counterpartyHandle: counterparty.handle,
365
+ counterpartyDisplayName: counterparty.displayName,
366
+ direction,
367
+ sourceMessageId,
368
+ observedAt,
369
+ text,
370
+ });
371
+ for (const supervisor of this.supervisors) {
372
+ const envelope = encryptTextNative({
373
+ messageId: randomUUID(),
374
+ conversationId,
375
+ senderPeerId: credentials.peer.id,
376
+ recipientPeerId: supervisor.id,
377
+ timestamp: new Date().toISOString(),
378
+ plaintext,
379
+ senderSigningSecretKey: credentials.keys.signingSecretKey,
380
+ senderEncryptionSecretKey: credentials.keys.encryptionSecretKey,
381
+ recipientEncryptionPublicKey: supervisor.encryptionPublicKey,
382
+ });
383
+ this.sendFrame({ kind: "DELIVER", envelope });
384
+ }
385
+ }
143
386
  sendFrame(frame) {
144
387
  if (!this.socket || this.socket.readyState !== WebSocket.OPEN)
145
388
  throw new Error("Agent is not connected");
@@ -173,4 +416,41 @@ export class Agent {
173
416
  queueMicrotask(() => { throw normalized; });
174
417
  }
175
418
  }
419
+ function exactArrayBuffer(bytes) {
420
+ return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
421
+ }
422
+ async function attachmentInputFromFile(input) {
423
+ const path = resolve(input.path);
424
+ return {
425
+ data: new Uint8Array(await readFile(path)),
426
+ name: input.name?.trim() || basename(path),
427
+ mimeType: input.mimeType?.trim() || mimeTypeFromPath(path),
428
+ ...(input.caption?.trim() ? { caption: input.caption.trim() } : {}),
429
+ };
430
+ }
431
+ function mimeTypeFromPath(path) {
432
+ const mimeTypes = {
433
+ ".aac": "audio/aac", ".csv": "text/csv", ".gif": "image/gif", ".heic": "image/heic",
434
+ ".jpeg": "image/jpeg", ".jpg": "image/jpeg", ".json": "application/json", ".m4a": "audio/mp4",
435
+ ".mov": "video/quicktime", ".mp3": "audio/mpeg", ".mp4": "video/mp4", ".ogg": "audio/ogg",
436
+ ".pdf": "application/pdf", ".png": "image/png", ".txt": "text/plain", ".wav": "audio/wav",
437
+ ".webm": "video/webm", ".webp": "image/webp", ".zip": "application/zip",
438
+ };
439
+ return mimeTypes[extname(path).toLowerCase()] ?? "application/octet-stream";
440
+ }
441
+ async function responseError(response) {
442
+ try {
443
+ const body = await response.json();
444
+ if (body.error)
445
+ return new Error(`${body.error.code ?? response.status}: ${body.error.message ?? "request failed"}`);
446
+ }
447
+ catch {
448
+ // Keep the HTTP fallback for non-JSON proxy responses.
449
+ }
450
+ return new Error(`HTTP ${response.status}`);
451
+ }
452
+ function reconnectDelay(attempt) {
453
+ const exponential = Math.min(30_000, 500 * (2 ** Math.min(attempt, 6)));
454
+ return exponential + Math.floor(Math.random() * Math.max(1, Math.floor(exponential * 0.2)));
455
+ }
176
456
  //# sourceMappingURL=agent.js.map
package/dist/agent.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,iBAAiB,GAIlB,MAAM,iBAAiB,CAAC;AACzB,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAA+C,MAAM,uBAAuB,CAAC;AACzG,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAqBpG,MAAM,OAAO,KAAK;IACC,OAAO,CAAS;IAChB,eAAe,CAAS;IACxB,eAAe,CAAkB;IAC1C,WAAW,CAAoB;IAC/B,MAAM,CAAa;IACnB,OAAO,GAAG,KAAK,CAAC;IAChB,cAAc,CAAkB;IAChC,YAAY,CAAgB;IAEpC,YAAY,OAAqB;QAC/B,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,uBAAuB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAChF,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,IAA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AA0B,CAAC;AAC9E,CAAC;AAED,KAAK,UAAU,aAAa,CAAC,QAAkB;IAC7C,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAqD,CAAC;QACtF,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,gBAAgB,EAAE,CAAC,CAAC;IACvH,CAAC;IAAC,MAAM,CAAC;QACP,uDAAuD;IACzD,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,cAAc,CAAC,OAAe;IACrC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,OAAO,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAC9F,CAAC"}
@@ -10,7 +10,7 @@ export interface CredentialStore {
10
10
  }
11
11
  export declare class FileCredentialStore implements CredentialStore {
12
12
  readonly path: string;
13
- constructor(activationToken: string, path?: string);
13
+ constructor(activationToken?: string, path?: string);
14
14
  load(): Promise<AgentCredentials | undefined>;
15
15
  save(credentials: AgentCredentials): Promise<void>;
16
16
  }
@@ -4,8 +4,15 @@ import { dirname, resolve } from "node:path";
4
4
  export class FileCredentialStore {
5
5
  path;
6
6
  constructor(activationToken, path) {
7
+ if (path) {
8
+ this.path = resolve(path);
9
+ return;
10
+ }
11
+ if (!activationToken) {
12
+ throw new Error("An activation token or an explicit credential path is required");
13
+ }
7
14
  const suffix = createHash("sha256").update(activationToken).digest("hex").slice(0, 16);
8
- this.path = resolve(path ?? `.atalk/agent-${suffix}.json`);
15
+ this.path = resolve(`.atalk/agent-${suffix}.json`);
9
16
  }
10
17
  async load() {
11
18
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"credential-store.js","sourceRoot":"","sources":["../src/credential-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAc7C,MAAM,OAAO,mBAAmB;IACrB,IAAI,CAAS;IAEtB,YAAY,eAAuB,EAAE,IAAa;QAChD,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACvF,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,gBAAgB,MAAM,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAqB,CAAC;QAC3E,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;gBAAE,OAAO,SAAS,CAAC;YACzE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,WAA6B;QACtC,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,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AE,OAAO,SAAS,CAAC;YACzE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,WAA6B;QACtC,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAClE,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3F,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Agent } from "./agent.js";
2
- export type { AgentOptions, IncomingMessage } from "./agent.js";
2
+ export type { AgentAttachmentFileInput, AgentAttachmentInput, AgentOptions, IncomingAttachment, IncomingMessage, SentMessage, } from "./agent.js";
3
3
  export { FileCredentialStore } from "./credential-store.js";
4
4
  export type { AgentCredentials, CredentialStore } from "./credential-store.js";
5
5
  export { RUST_CORE_VERSION } from "./native-core.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AASnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atalk/sdk",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.10",
4
4
  "description": "Node.js SDK for connecting AI agents to the aTalk messaging network",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -42,8 +42,8 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "ws": "^8.18.0",
45
- "@atalk/core-native": "0.1.0-alpha.1",
46
- "@atalk/protocol": "0.1.0-alpha.1"
45
+ "@atalk/core-native": "0.1.0-alpha.10",
46
+ "@atalk/protocol": "0.1.0-alpha.10"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/node": "^24.0.0",