@towns-labs/agent 2.0.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.
Files changed (46) hide show
  1. package/README.md +151 -0
  2. package/dist/agent.d.ts +480 -0
  3. package/dist/agent.d.ts.map +1 -0
  4. package/dist/agent.js +1758 -0
  5. package/dist/agent.js.map +1 -0
  6. package/dist/agent.test.d.ts +2 -0
  7. package/dist/agent.test.d.ts.map +1 -0
  8. package/dist/agent.test.js +1315 -0
  9. package/dist/agent.test.js.map +1 -0
  10. package/dist/eventDedup.d.ts +73 -0
  11. package/dist/eventDedup.d.ts.map +1 -0
  12. package/dist/eventDedup.js +105 -0
  13. package/dist/eventDedup.js.map +1 -0
  14. package/dist/eventDedup.test.d.ts +2 -0
  15. package/dist/eventDedup.test.d.ts.map +1 -0
  16. package/dist/eventDedup.test.js +222 -0
  17. package/dist/eventDedup.test.js.map +1 -0
  18. package/dist/identity-types.d.ts +43 -0
  19. package/dist/identity-types.d.ts.map +1 -0
  20. package/dist/identity-types.js +2 -0
  21. package/dist/identity-types.js.map +1 -0
  22. package/dist/index.d.ts +11 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +11 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/interaction-api.d.ts +61 -0
  27. package/dist/interaction-api.d.ts.map +1 -0
  28. package/dist/interaction-api.js +95 -0
  29. package/dist/interaction-api.js.map +1 -0
  30. package/dist/payments.d.ts +89 -0
  31. package/dist/payments.d.ts.map +1 -0
  32. package/dist/payments.js +144 -0
  33. package/dist/payments.js.map +1 -0
  34. package/dist/re-exports.d.ts +2 -0
  35. package/dist/re-exports.d.ts.map +1 -0
  36. package/dist/re-exports.js +2 -0
  37. package/dist/re-exports.js.map +1 -0
  38. package/dist/smart-account.d.ts +54 -0
  39. package/dist/smart-account.d.ts.map +1 -0
  40. package/dist/smart-account.js +132 -0
  41. package/dist/smart-account.js.map +1 -0
  42. package/dist/snapshot-getter.d.ts +21 -0
  43. package/dist/snapshot-getter.d.ts.map +1 -0
  44. package/dist/snapshot-getter.js +27 -0
  45. package/dist/snapshot-getter.js.map +1 -0
  46. package/package.json +67 -0
package/README.md ADDED
@@ -0,0 +1,151 @@
1
+ # @towns-labs/agent
2
+
3
+ An agent framework for Towns.
4
+
5
+ ## Installing
6
+
7
+ We suggest users to quickstart a project using our cli.
8
+
9
+ ```bash
10
+ $ bunx towns-agent init
11
+ ```
12
+
13
+ If you prefer to install manually:
14
+
15
+ ```bash
16
+ $ bun add @towns-labs/agent viem hono
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ With Node:
22
+
23
+ ```ts
24
+ import { makeTownsAgent } from "@towns-labs/agent";
25
+ import { serve } from "@hono/node-server";
26
+
27
+ const app = new Hono();
28
+ const agent = await makeTownsAgent("<app-private-data-base64>", "<jwt-secret>");
29
+
30
+ agent.onMessage((handler, { channelId, isMentioned }) => {
31
+ if (isMentioned) {
32
+ handler.sendMessage(channelId, "Hello, world!");
33
+ }
34
+ });
35
+
36
+ const { jwtMiddleware, handler } = agent.start();
37
+ app.post("/webhook", jwtMiddleware, handler);
38
+
39
+ serve({ fetch: app.fetch });
40
+ ```
41
+
42
+ With Bun:
43
+
44
+ ```ts
45
+ import { makeTownsAgent } from "@towns-labs/agent";
46
+
47
+ const app = new Hono();
48
+ const agent = await makeTownsAgent("<app-private-data-base64>", "<jwt-secret>");
49
+
50
+ agent.onMessage((handler, { channelId, isMentioned }) => {
51
+ if (isMentioned) {
52
+ handler.sendMessage(channelId, "Hello, world!");
53
+ }
54
+ });
55
+
56
+ const { jwtMiddleware, handler } = agent.start();
57
+ app.post("/webhook", jwtMiddleware, handler);
58
+
59
+ export default app;
60
+ ```
61
+
62
+ ## Identity Metadata (ERC-8004)
63
+
64
+ Agents can optionally define ERC-8004 compliant identity metadata for agent discovery and trust.
65
+
66
+ ### Minimal Example
67
+
68
+ Create `identity.ts`:
69
+
70
+ ```ts
71
+ import type { AgentAgentIdentityConfig } from "@towns-labs/agent";
72
+
73
+ const identity = {
74
+ name: "My Agent",
75
+ description: "A helpful agent for Towns",
76
+ image: "https://example.com/agent-logo.png",
77
+ domain: "myAgent.example.com",
78
+ } as const satisfies AgentIdentityConfig;
79
+
80
+ export default identity;
81
+ ```
82
+
83
+ Use in agent setup:
84
+
85
+ ```ts
86
+ import identity from "./identity";
87
+
88
+ const agent = await makeTownsAgent(
89
+ process.env.APP_PRIVATE_DATA!,
90
+ process.env.JWT_SECRET!,
91
+ {
92
+ commands,
93
+ identity,
94
+ },
95
+ );
96
+
97
+ // Get metadata for hosting at /.well-known/agent-metadata.json
98
+ const metadata = agent.getIdentityMetadata();
99
+ app.get("/.well-known/agent-metadata.json", metadata);
100
+ ```
101
+
102
+ ### Advanced Example
103
+
104
+ For full ERC-8004 compliance with endpoints and trust models:
105
+
106
+ ```ts
107
+ import type { AgentIdentityConfig } from "@towns-labs/agent";
108
+
109
+ const identity = {
110
+ name: "Advanced Agent",
111
+ description: "AI-powered agent with multi-protocol support",
112
+ image: "https://example.com/agent-logo.png",
113
+ motto: "Building the future of agent economies",
114
+ domain: "agent.example.com",
115
+
116
+ endpoints: [
117
+ {
118
+ name: "A2A",
119
+ endpoint: "https://agent.example.com/.well-known/agent-card.json",
120
+ version: "0.3.0",
121
+ },
122
+ {
123
+ name: "MCP",
124
+ endpoint: "https://mcp.agent.example.com/",
125
+ version: "2025-06-18",
126
+ },
127
+ ],
128
+
129
+ registrations: [],
130
+
131
+ supportedTrust: ["reputation", "crypto-economic"],
132
+
133
+ attributes: [
134
+ { trait_type: "Category", value: "Gateway" },
135
+ { trait_type: "Model", value: "GPT-4" },
136
+ ],
137
+ } as const satisfies AgentIdentityConfig;
138
+
139
+ export default identity;
140
+ ```
141
+
142
+ The agent automatically adds `agentWallet` endpoint using the agent's app address and `A2A` endpoint if domain is configured.
143
+
144
+ ## Debug Logging
145
+
146
+ Agent framework uses `debug` package for logging.
147
+ You can enable by setting the `DEBUG` environment variable to `csb:agent`.
148
+
149
+ ```bash
150
+ DEBUG=csb:agent node dist/agent.cjs
151
+ ```
@@ -0,0 +1,480 @@
1
+ import { SpaceDapp, type SendTipMemberParams } from '@towns-labs/web3';
2
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
3
+ import { type ClientV2, type ParsedEvent, type CreateTownsClientParams } from '@towns-labs/sdk';
4
+ import { Hono } from 'hono';
5
+ import { type ChannelMessage_Post_Mention, ChannelMessage, type PlainMessage, Tags, type SlashCommand, type BlockchainTransaction, InteractionRequestPayload, InteractionResponsePayload, StreamEvent } from '@towns-labs/proto';
6
+ import { type EventDedupConfig } from './eventDedup';
7
+ import { type FlattenedInteractionRequest } from './interaction-api';
8
+ import type { FacilitatorConfig, RouteConfig } from 'x402/types';
9
+ import { type Chain, type Transport, type Address, type Account, type WalletClient, type TransactionReceipt } from 'viem';
10
+ import type { AgentIdentityConfig, AgentIdentityMetadata } from './identity-types';
11
+ type AgentActions = ReturnType<typeof buildAgentActions>;
12
+ export type AgentCommand = PlainMessage<SlashCommand> & {
13
+ paid?: RouteConfig;
14
+ };
15
+ export type AgentHandler = ReturnType<typeof buildAgentActions>;
16
+ export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
17
+ export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
18
+ export type AgentPayload<T extends keyof AgentEvents<Commands>, Commands extends AgentCommand[] = []> = Parameters<AgentEvents<Commands>[T]>[1];
19
+ type ImageAttachment = {
20
+ type: 'image';
21
+ alt?: string;
22
+ url: string;
23
+ };
24
+ type ChunkedMediaAttachment = {
25
+ type: 'chunked';
26
+ data: Blob;
27
+ width?: number;
28
+ height?: number;
29
+ filename: string;
30
+ } | {
31
+ type: 'chunked';
32
+ data: Uint8Array;
33
+ width?: number;
34
+ height?: number;
35
+ filename: string;
36
+ mimetype: string;
37
+ };
38
+ type LinkAttachment = {
39
+ type: 'link';
40
+ url: string;
41
+ title?: string;
42
+ description?: string;
43
+ image?: {
44
+ width: number;
45
+ height: number;
46
+ url: string;
47
+ };
48
+ };
49
+ type MiniAppAttachment = {
50
+ type: 'miniapp';
51
+ url: string;
52
+ };
53
+ type TickerAttachment = {
54
+ type: 'ticker';
55
+ address: string;
56
+ chainId: string;
57
+ };
58
+ export type MessageOpts = {
59
+ threadId?: string;
60
+ replyId?: string;
61
+ ephemeral?: boolean;
62
+ };
63
+ export type PostMessageOpts = MessageOpts & {
64
+ mentions?: Array<{
65
+ userId: string;
66
+ displayName: string;
67
+ } | {
68
+ roleId: number;
69
+ } | {
70
+ atChannel: true;
71
+ }>;
72
+ attachments?: Array<ImageAttachment | ChunkedMediaAttachment | LinkAttachment | TickerAttachment | MiniAppAttachment>;
73
+ };
74
+ export type DecryptedInteractionResponse = {
75
+ recipient: Uint8Array;
76
+ payload: PlainMessage<InteractionResponsePayload>;
77
+ };
78
+ export type AgentEvents<Commands extends AgentCommand[] = []> = {
79
+ message: (handler: AgentActions, event: BasePayload & {
80
+ /** The decrypted message content */
81
+ message: string;
82
+ /** In case of a reply, that's the eventId of the message that got replied */
83
+ replyId: string | undefined;
84
+ /** In case of a thread, that's the thread id where the message belongs to */
85
+ threadId: string | undefined;
86
+ /** Users mentioned in the message */
87
+ mentions: Pick<ChannelMessage_Post_Mention, 'userId' | 'displayName'>[];
88
+ /** Convenience flag to check if the agent was mentioned */
89
+ isMentioned: boolean;
90
+ }) => void | Promise<void>;
91
+ redaction: (handler: AgentActions, event: BasePayload & {
92
+ /** The event ID that got redacted */
93
+ refEventId: string;
94
+ }) => void | Promise<void>;
95
+ messageEdit: (handler: AgentActions, event: BasePayload & {
96
+ /** The event ID of the message that got edited */
97
+ refEventId: string;
98
+ /** New message */
99
+ message: string;
100
+ /** In case of a reply, that's the eventId of the message that got replied */
101
+ replyId: string | undefined;
102
+ /** In case of a thread, that's the thread id where the message belongs to */
103
+ threadId: string | undefined;
104
+ /** Users mentioned in the message */
105
+ mentions: Pick<ChannelMessage_Post_Mention, 'userId' | 'displayName'>[];
106
+ /** Convenience flag to check if the agent was mentioned */
107
+ isMentioned: boolean;
108
+ }) => void | Promise<void>;
109
+ reaction: (handler: AgentActions, event: BasePayload & {
110
+ /** The reaction that was added */
111
+ reaction: string;
112
+ /** The event ID of the message that got reacted to */
113
+ messageId: string;
114
+ /** The user ID of the user that added the reaction */
115
+ userId: string;
116
+ }) => Promise<void> | void;
117
+ eventRevoke: (handler: AgentActions, event: BasePayload & {
118
+ /** The event ID of the message that got revoked */
119
+ refEventId: string;
120
+ }) => Promise<void> | void;
121
+ tip: (handler: AgentActions, event: BasePayload & {
122
+ /** The message ID of the parent of the tip */
123
+ messageId: string;
124
+ /** The address that sent the tip */
125
+ senderAddress: Address;
126
+ /** The address that received the tip */
127
+ receiverAddress: Address;
128
+ /** The user ID that received the tip */
129
+ receiverUserId: string;
130
+ /** The amount of the tip */
131
+ amount: bigint;
132
+ /** The currency of the tip */
133
+ currency: Address;
134
+ }) => Promise<void> | void;
135
+ channelJoin: (handler: AgentActions, event: BasePayload) => Promise<void> | void;
136
+ channelLeave: (handler: AgentActions, event: BasePayload) => Promise<void> | void;
137
+ streamEvent: (handler: AgentActions, event: BasePayload & {
138
+ parsed: ParsedEvent;
139
+ }) => Promise<void> | void;
140
+ slashCommand: (handler: AgentActions, event: BasePayload & {
141
+ /** The slash command that was invoked (without the /) */
142
+ command: Commands[number]['name'];
143
+ /** Arguments passed after the command
144
+ * @example
145
+ * ```
146
+ * /help
147
+ * args: []
148
+ * ```
149
+ * ```
150
+ * /sum 1 2
151
+ * args: ['1', '2']
152
+ * ```
153
+ */
154
+ args: string[];
155
+ /** Users mentioned in the command */
156
+ mentions: Pick<ChannelMessage_Post_Mention, 'userId' | 'displayName'>[];
157
+ /** The eventId of the message that got replied */
158
+ replyId: string | undefined;
159
+ /** The thread id where the message belongs to */
160
+ threadId: string | undefined;
161
+ }) => Promise<void> | void;
162
+ rawGmMessage: (handler: AgentActions, event: BasePayload & {
163
+ typeUrl: string;
164
+ message: Uint8Array;
165
+ }) => void | Promise<void>;
166
+ gm: <Schema extends StandardSchemaV1>(handler: AgentActions, event: BasePayload & {
167
+ typeUrl: string;
168
+ schema: Schema;
169
+ data: InferOutput<Schema>;
170
+ }) => void | Promise<void>;
171
+ interactionResponse: (handler: AgentActions, event: BasePayload & {
172
+ /** The interaction response that was received */
173
+ response: DecryptedInteractionResponse;
174
+ threadId: string | undefined;
175
+ }) => void | Promise<void>;
176
+ };
177
+ export type BasePayload = {
178
+ /** The user ID of the user that triggered the event */
179
+ userId: Address;
180
+ /** channelId that the event was triggered in */
181
+ channelId: string;
182
+ /** The ID of the event that triggered */
183
+ eventId: string;
184
+ /** The creation time of the event */
185
+ createdAt: Date;
186
+ /** The raw event payload */
187
+ event: StreamEvent;
188
+ /** Convenience flag to check if the event triggered on a DM channel */
189
+ isDm: boolean;
190
+ /** Convenience flag to check if the event triggered on a GDM channel */
191
+ isGdm: boolean;
192
+ };
193
+ export declare class Agent<Commands extends AgentCommand[] = []> {
194
+ readonly client: ClientV2<AgentActions>;
195
+ readonly appAddress: Address;
196
+ agentUserId: string;
197
+ viem: WalletClient<Transport, Chain, Account>;
198
+ private readonly jwtSecret;
199
+ private currentMessageTags;
200
+ private readonly emitter;
201
+ private readonly slashCommandHandlers;
202
+ private readonly gmTypedHandlers;
203
+ private readonly commands;
204
+ private readonly identityConfig?;
205
+ private readonly eventDedup;
206
+ private readonly paymentConfig?;
207
+ private readonly pendingPayments;
208
+ private readonly paymentCommands;
209
+ constructor(clientV2: ClientV2<AgentActions>, viem: WalletClient<Transport, Chain, Account>, jwtSecretBase64: string, appAddress: Address, commands?: Commands, identityConfig?: AgentIdentityConfig, dedupConfig?: EventDedupConfig, paymentConfig?: FacilitatorConfig);
210
+ start(): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
211
+ private jwtMiddleware;
212
+ private webhookHandler;
213
+ private handleEvent;
214
+ private handleChannelMessage;
215
+ private handlePaymentResponse;
216
+ /**
217
+ * get the public device key of the agent
218
+ * @returns the public device key of the agent
219
+ */
220
+ getUserDevice(): import("@towns-labs/encryption").UserDevice;
221
+ /**
222
+ * Send a message to a stream
223
+ * @param streamId - Id of the stream. Usually channelId or userId
224
+ * @param message - The cleartext of the message
225
+ * @param opts - The options for the message
226
+ */
227
+ sendMessage(streamId: string, message: string, opts?: PostMessageOpts): Promise<{
228
+ eventId: string;
229
+ prevMiniblockHash: Uint8Array;
230
+ envelope: import("@towns-labs/proto").Envelope;
231
+ }>;
232
+ /**
233
+ * Send a reaction to a stream
234
+ * @param streamId - Id of the stream. Usually channelId or userId
235
+ * @param refEventId - The eventId of the event to react to
236
+ * @param reaction - The reaction to send
237
+ */
238
+ sendReaction(streamId: string, refEventId: string, reaction: string): Promise<{
239
+ eventId: string;
240
+ prevMiniblockHash: Uint8Array;
241
+ envelope: import("@towns-labs/proto").Envelope;
242
+ }>;
243
+ /**
244
+ * Remove an specific event from a stream
245
+ * @param streamId - Id of the stream. Usually channelId or userId
246
+ * @param refEventId - The eventId of the event to remove
247
+ */
248
+ removeEvent(streamId: string, refEventId: string): Promise<{
249
+ eventId: string;
250
+ prevMiniblockHash: Uint8Array;
251
+ envelope: import("@towns-labs/proto").Envelope;
252
+ }>;
253
+ /**
254
+ * Edit an specific message from a stream
255
+ * @param streamId - Id of the stream. Usually channelId or userId
256
+ * @param messageId - The eventId of the message to edit
257
+ * @param message - The new message text
258
+ */
259
+ editMessage(streamId: string, messageId: string, message: string, opts?: PostMessageOpts): Promise<{
260
+ eventId: string;
261
+ prevMiniblockHash: Uint8Array;
262
+ envelope: import("@towns-labs/proto").Envelope;
263
+ }>;
264
+ /**
265
+ * Send a GM (generic message) to a stream with schema validation
266
+ * @param streamId - Id of the stream. Usually channelId or userId
267
+ * @param typeUrl - The type URL identifying the message format
268
+ * @param schema - StandardSchema for validation
269
+ * @param data - Data to validate and send
270
+ */
271
+ sendGM<Schema extends StandardSchemaV1>(streamId: string, typeUrl: string, schema: Schema, data: InferInput<Schema>, opts?: MessageOpts): Promise<{
272
+ eventId: string;
273
+ prevMiniblockHash: Uint8Array;
274
+ envelope: import("@towns-labs/proto").Envelope;
275
+ }>;
276
+ /**
277
+ * Send a raw GM (generic message) to a stream without schema validation
278
+ * @param streamId - Id of the stream. Usually channelId or userId
279
+ * @param typeUrl - The type URL identifying the message format
280
+ * @param message - Optional raw message data as bytes
281
+ * @param opts - The options for the message
282
+ */
283
+ sendRawGM(streamId: string, typeUrl: string, message: Uint8Array, opts?: MessageOpts): Promise<{
284
+ eventId: string;
285
+ prevMiniblockHash: Uint8Array;
286
+ envelope: import("@towns-labs/proto").Envelope;
287
+ }>;
288
+ /**
289
+ * Send an interaction request to a stream
290
+ * @param streamId - Id of the stream. Usually channelId or userId
291
+ * @param contentOrPayload - The interaction request content (old format) or flattened payload (new format)
292
+ * @param recipientOrOpts - Recipient bytes (old format) or message options (new format)
293
+ * @param opts - The options for the interaction request (old format only)
294
+ * @returns The eventId of the interaction request
295
+ */
296
+ sendInteractionRequest(streamId: string, content: PlainMessage<InteractionRequestPayload['content']>, recipient?: Uint8Array, opts?: MessageOpts): Promise<{
297
+ eventId: string;
298
+ }>;
299
+ sendInteractionRequest(streamId: string, payload: FlattenedInteractionRequest, opts?: MessageOpts): Promise<{
300
+ eventId: string;
301
+ }>;
302
+ pinMessage(streamId: string, eventId: string, streamEvent: StreamEvent): Promise<{
303
+ eventId: string;
304
+ prevMiniblockHash: Uint8Array;
305
+ envelope: import("@towns-labs/proto").Envelope;
306
+ }>;
307
+ unpinMessage(streamId: string, eventId: string): Promise<{
308
+ eventId: string;
309
+ prevMiniblockHash: Uint8Array;
310
+ envelope: import("@towns-labs/proto").Envelope;
311
+ }>;
312
+ /** Sends a tip to a user by looking up their smart account.
313
+ * Tip will always get funds from the app account balance.
314
+ * @param params - Tip parameters including userId, amount, messageId, channelId, currency.
315
+ * @returns The transaction hash and event ID
316
+ */
317
+ sendTip(params: Omit<SendTipMemberParams, 'spaceId' | 'tokenId' | 'currency' | 'receiver'> & {
318
+ currency?: Address;
319
+ userId: Address;
320
+ }): Promise<{
321
+ txHash: string;
322
+ eventId: string;
323
+ }>;
324
+ /**
325
+ * Triggered when someone sends a message.
326
+ * This is triggered for all messages, including direct messages and group messages.
327
+ */
328
+ onMessage(fn: AgentEvents['message']): import("nanoevents").Unsubscribe;
329
+ onRedaction(fn: AgentEvents['redaction']): import("nanoevents").Unsubscribe;
330
+ /**
331
+ * Triggered when a message gets edited
332
+ */
333
+ onMessageEdit(fn: AgentEvents['messageEdit']): import("nanoevents").Unsubscribe;
334
+ /**
335
+ * Triggered when someone reacts to a message
336
+ */
337
+ onReaction(fn: AgentEvents['reaction']): import("nanoevents").Unsubscribe;
338
+ /**
339
+ * Triggered when a message is revoked by a moderator
340
+ */
341
+ onEventRevoke(fn: AgentEvents['eventRevoke']): import("nanoevents").Unsubscribe;
342
+ /**
343
+ * Triggered when someone tips the agent
344
+ */
345
+ onTip(fn: AgentEvents['tip']): import("nanoevents").Unsubscribe;
346
+ /**
347
+ * Triggered when someone joins a channel
348
+ */
349
+ onChannelJoin(fn: AgentEvents['channelJoin']): import("nanoevents").Unsubscribe;
350
+ /**
351
+ * Triggered when someone leaves a channel
352
+ */
353
+ onChannelLeave(fn: AgentEvents['channelLeave']): import("nanoevents").Unsubscribe;
354
+ onStreamEvent(fn: AgentEvents['streamEvent']): import("nanoevents").Unsubscribe;
355
+ onSlashCommand(command: Commands[number]['name'], fn: AgentEvents<Commands>['slashCommand']): () => void;
356
+ /**
357
+ * Triggered when someone sends a GM (generic message) with type validation using StandardSchema
358
+ * @param typeUrl - The type URL to listen for
359
+ * @param schema - The StandardSchema to validate the message data
360
+ * @param handler - The handler function to call when a message is received
361
+ */
362
+ onGmMessage<Schema extends StandardSchemaV1>(typeUrl: string, schema: Schema, handler: (handler: AgentActions, event: BasePayload & {
363
+ typeUrl: string;
364
+ data: InferOutput<Schema>;
365
+ }) => void | Promise<void>): () => void;
366
+ onRawGmMessage(handler: AgentEvents['rawGmMessage']): import("nanoevents").Unsubscribe;
367
+ /**
368
+ * Triggered when someone sends an interaction response
369
+ * @param fn - The handler function to call when an interaction response is received
370
+ */
371
+ onInteractionResponse(fn: AgentEvents['interactionResponse']): import("nanoevents").Unsubscribe;
372
+ /**
373
+ * Get the stream view for a stream
374
+ * Stream views contain contextual information about the stream (space, channel, etc)
375
+ * Stream views contain member data for all streams - you can iterate over all members in a channel via: `streamView.getMembers().joined.keys()`
376
+ * note: potentially expensive operation because streams can be large, fine to use in small streams
377
+ * @param streamId - The stream ID to get the view for
378
+ * @returns The stream view
379
+ */
380
+ getStreamView(streamId: string): Promise<import("@towns-labs/sdk").StreamStateView>;
381
+ /**
382
+ * Get the ERC-8004 compliant metadata JSON
383
+ * This should be hosted at /.well-known/agent-metadata.json
384
+ * Fetches metadata from the App Registry and merges with local config
385
+ * @returns The ERC-8004 compliant metadata object or null
386
+ */
387
+ getIdentityMetadata(): Promise<AgentIdentityMetadata | null>;
388
+ /**
389
+ * Get the tokenURI that would be used for ERC-8004 registration
390
+ * Returns null if no domain is configured
391
+ * @returns The .well-known URL or null
392
+ */
393
+ getTokenURI(): string | null;
394
+ }
395
+ export declare const makeTownsAgent: <Commands extends AgentCommand[] = []>(appPrivateData: string, jwtSecretBase64: string, opts?: {
396
+ baseRpcUrl?: string;
397
+ commands?: Commands;
398
+ identity?: AgentIdentityConfig;
399
+ dedup?: EventDedupConfig;
400
+ paymentConfig?: FacilitatorConfig;
401
+ } & Partial<Omit<CreateTownsClientParams, "env" | "encryptionDevice">>) => Promise<Agent<Commands>>;
402
+ declare const buildAgentActions: (client: ClientV2, viem: WalletClient<Transport, Chain, Account>, spaceDapp: SpaceDapp, appAddress: Address) => {
403
+ sendMessage: (streamId: string, message: string, opts?: PostMessageOpts, tags?: PlainMessage<Tags>) => Promise<{
404
+ eventId: string;
405
+ prevMiniblockHash: Uint8Array;
406
+ envelope: import("@towns-labs/proto").Envelope;
407
+ }>;
408
+ editMessage: (streamId: string, messageId: string, message: string, opts?: PostMessageOpts, tags?: PlainMessage<Tags>) => Promise<{
409
+ eventId: string;
410
+ prevMiniblockHash: Uint8Array;
411
+ envelope: import("@towns-labs/proto").Envelope;
412
+ }>;
413
+ sendReaction: (streamId: string, messageId: string, reaction: string, tags?: PlainMessage<Tags>) => Promise<{
414
+ eventId: string;
415
+ prevMiniblockHash: Uint8Array;
416
+ envelope: import("@towns-labs/proto").Envelope;
417
+ }>;
418
+ sendInteractionRequest: {
419
+ (streamId: string, content: PlainMessage<InteractionRequestPayload["content"]>, recipient?: Uint8Array, opts?: MessageOpts, tags?: PlainMessage<Tags>): Promise<{
420
+ eventId: string;
421
+ }>;
422
+ (streamId: string, payload: FlattenedInteractionRequest, opts?: MessageOpts, tags?: PlainMessage<Tags>): Promise<{
423
+ eventId: string;
424
+ }>;
425
+ };
426
+ sendGM: <Schema extends StandardSchemaV1>(streamId: string, typeUrl: string, schema: Schema, data: InferInput<Schema>, opts?: MessageOpts, tags?: PlainMessage<Tags>) => ReturnType<({ streamId, payload, tags, ephemeral, }: {
427
+ streamId: string;
428
+ payload: ChannelMessage;
429
+ tags?: PlainMessage<Tags>;
430
+ ephemeral?: boolean;
431
+ }) => Promise<{
432
+ eventId: string;
433
+ prevMiniblockHash: Uint8Array;
434
+ envelope: import("@towns-labs/proto").Envelope;
435
+ }>>;
436
+ sendRawGM: (streamId: string, typeUrl: string, message: Uint8Array, opts?: MessageOpts, tags?: PlainMessage<Tags>) => Promise<{
437
+ eventId: string;
438
+ prevMiniblockHash: Uint8Array;
439
+ envelope: import("@towns-labs/proto").Envelope;
440
+ }>;
441
+ removeEvent: (streamId: string, messageId: string, tags?: PlainMessage<Tags>) => Promise<{
442
+ eventId: string;
443
+ prevMiniblockHash: Uint8Array;
444
+ envelope: import("@towns-labs/proto").Envelope;
445
+ }>;
446
+ sendKeySolicitation: (streamId: string, sessionIds: string[]) => Promise<{
447
+ eventId: string;
448
+ prevMiniblockHash: Uint8Array;
449
+ envelope: import("@towns-labs/proto").Envelope;
450
+ }>;
451
+ uploadDeviceKeys: () => Promise<{
452
+ eventId: string;
453
+ prevMiniblockHash: Uint8Array;
454
+ envelope: import("@towns-labs/proto").Envelope;
455
+ }>;
456
+ pinMessage: (streamId: string, eventId: string, streamEvent: StreamEvent) => Promise<{
457
+ eventId: string;
458
+ prevMiniblockHash: Uint8Array;
459
+ envelope: import("@towns-labs/proto").Envelope;
460
+ }>;
461
+ unpinMessage: (streamId: string, eventId: string) => Promise<{
462
+ eventId: string;
463
+ prevMiniblockHash: Uint8Array;
464
+ envelope: import("@towns-labs/proto").Envelope;
465
+ }>;
466
+ getChannelSettings: (channelId: string) => Promise<import("@towns-labs/sdk").ParsedChannelProperties>;
467
+ sendBlockchainTransaction: (chainId: number, receipt: TransactionReceipt, content?: PlainMessage<BlockchainTransaction>["content"], tags?: PlainMessage<Tags>) => Promise<{
468
+ txHash: string;
469
+ eventId: string;
470
+ }>;
471
+ sendTip: (params: Omit<SendTipMemberParams, "spaceId" | "tokenId" | "currency" | "receiver"> & {
472
+ currency?: Address;
473
+ userId: Address;
474
+ }, tags?: PlainMessage<Tags>) => Promise<{
475
+ txHash: string;
476
+ eventId: string;
477
+ }>;
478
+ };
479
+ export {};
480
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,SAAS,EAET,KAAK,mBAAmB,EAG3B,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAI7D,OAAO,EAKH,KAAK,QAAQ,EAOb,KAAK,WAAW,EAkBhB,KAAK,uBAAuB,EAK/B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,IAAI,EAA2B,MAAM,MAAM,CAAA;AAMpD,OAAO,EAEH,KAAK,2BAA2B,EAChC,cAAc,EAOd,KAAK,YAAY,EACjB,IAAI,EAEJ,KAA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