@band-ai/sdk 0.1.2

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 (91) hide show
  1. package/dist/CodexAdapter-A1k_LMdZ.d.ts +1278 -0
  2. package/dist/CodexAdapter-BbZD-nBd.d.cts +1278 -0
  3. package/dist/adapters.cjs +10643 -0
  4. package/dist/adapters.d.cts +217 -0
  5. package/dist/adapters.d.ts +217 -0
  6. package/dist/adapters.js +92 -0
  7. package/dist/backends-BnOLsG7w.d.cts +20 -0
  8. package/dist/backends-C4n6cKOf.d.ts +20 -0
  9. package/dist/chunk-3BKAC4OZ.js +44 -0
  10. package/dist/chunk-5CXIMAH2.js +52 -0
  11. package/dist/chunk-6AJA2OPC.js +3682 -0
  12. package/dist/chunk-A3TDK6GP.js +6674 -0
  13. package/dist/chunk-AVVDPXP4.js +39 -0
  14. package/dist/chunk-EDPKUUJL.js +177 -0
  15. package/dist/chunk-FUODYQRE.js +2562 -0
  16. package/dist/chunk-GVEQ3RAH.js +373 -0
  17. package/dist/chunk-INA6YZTZ.js +88 -0
  18. package/dist/chunk-IZPV6QS6.js +115 -0
  19. package/dist/chunk-LY55KYVI.js +0 -0
  20. package/dist/chunk-NIAQBANR.js +577 -0
  21. package/dist/chunk-OD2G5LFQ.js +78 -0
  22. package/dist/chunk-SFVKOEQH.js +103 -0
  23. package/dist/chunk-SG4WLD2H.js +1093 -0
  24. package/dist/chunk-YR3BOQNW.js +39 -0
  25. package/dist/chunk-ZZJRRBPQ.js +82 -0
  26. package/dist/claude-CcnQ5OUC.d.ts +53 -0
  27. package/dist/claude-CwTAxhwI.d.cts +53 -0
  28. package/dist/config.cjs +164 -0
  29. package/dist/config.d.cts +19 -0
  30. package/dist/config.d.ts +19 -0
  31. package/dist/config.js +9 -0
  32. package/dist/converters.cjs +1086 -0
  33. package/dist/converters.d.cts +143 -0
  34. package/dist/converters.d.ts +143 -0
  35. package/dist/converters.js +468 -0
  36. package/dist/core.cjs +185 -0
  37. package/dist/core.d.cts +22 -0
  38. package/dist/core.d.ts +22 -0
  39. package/dist/core.js +24 -0
  40. package/dist/customTools-BzF0IISO.d.cts +10 -0
  41. package/dist/customTools-BzF0IISO.d.ts +10 -0
  42. package/dist/dtos-DUpbIu8k.d.cts +163 -0
  43. package/dist/dtos-DUpbIu8k.d.ts +163 -0
  44. package/dist/history-ByessXNq.d.ts +24 -0
  45. package/dist/history-i6yN7neC.d.cts +24 -0
  46. package/dist/index.cjs +13914 -0
  47. package/dist/index.d.cts +63 -0
  48. package/dist/index.d.ts +63 -0
  49. package/dist/index.js +198 -0
  50. package/dist/linear.cjs +2207 -0
  51. package/dist/linear.d.cts +167 -0
  52. package/dist/linear.d.ts +167 -0
  53. package/dist/linear.js +2139 -0
  54. package/dist/logger-CABQOnlR.d.cts +21 -0
  55. package/dist/logger-CABQOnlR.d.ts +21 -0
  56. package/dist/mcp-claude.cjs +584 -0
  57. package/dist/mcp-claude.d.cts +4 -0
  58. package/dist/mcp-claude.d.ts +4 -0
  59. package/dist/mcp-claude.js +11 -0
  60. package/dist/mcp.cjs +1247 -0
  61. package/dist/mcp.d.cts +97 -0
  62. package/dist/mcp.d.ts +97 -0
  63. package/dist/mcp.js +27 -0
  64. package/dist/opencode-BBcDchcN.d.cts +159 -0
  65. package/dist/opencode-DthQQUsZ.d.ts +159 -0
  66. package/dist/pagination-BPiys10t.d.cts +25 -0
  67. package/dist/pagination-CcDkVFxK.d.ts +25 -0
  68. package/dist/protocols-CInhtFpA.d.cts +116 -0
  69. package/dist/protocols-DrhzOH6K.d.ts +116 -0
  70. package/dist/rest.cjs +1159 -0
  71. package/dist/rest.d.cts +144 -0
  72. package/dist/rest.d.ts +144 -0
  73. package/dist/rest.js +18 -0
  74. package/dist/runtime.cjs +5353 -0
  75. package/dist/runtime.d.cts +276 -0
  76. package/dist/runtime.d.ts +276 -0
  77. package/dist/runtime.js +274 -0
  78. package/dist/schemas-BpEBkq5V.d.cts +592 -0
  79. package/dist/schemas-vos1AaBc.d.ts +592 -0
  80. package/dist/sdk-HJUVSSWA.js +10 -0
  81. package/dist/simpleAdapter-9OE_p6QW.d.ts +29 -0
  82. package/dist/simpleAdapter-DqhvjsGr.d.cts +29 -0
  83. package/dist/testing.cjs +217 -0
  84. package/dist/testing.d.cts +126 -0
  85. package/dist/testing.d.ts +126 -0
  86. package/dist/testing.js +186 -0
  87. package/dist/types-7jVzOeOP.d.ts +446 -0
  88. package/dist/types-CSHFipIc.d.cts +331 -0
  89. package/dist/types-CovcHpYf.d.cts +446 -0
  90. package/dist/types-CxII3XkA.d.ts +331 -0
  91. package/package.json +189 -0
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/testing/index.ts
21
+ var testing_exports = {};
22
+ __export(testing_exports, {
23
+ FakeAgentTools: () => FakeAgentTools,
24
+ StubRestApi: () => StubRestApi
25
+ });
26
+ module.exports = __toCommonJS(testing_exports);
27
+
28
+ // src/contracts/protocols.ts
29
+ var DEFAULT_AGENT_TOOLS_CAPABILITIES = {
30
+ peers: true,
31
+ contacts: true,
32
+ memory: true
33
+ };
34
+
35
+ // src/testing/FakeAgentTools.ts
36
+ var FakeAgentTools = class {
37
+ capabilities = {
38
+ ...DEFAULT_AGENT_TOOLS_CAPABILITIES,
39
+ peers: true,
40
+ contacts: true,
41
+ memory: true
42
+ };
43
+ messagesSent = [];
44
+ eventsSent = [];
45
+ participantsAdded = [];
46
+ participantsRemoved = [];
47
+ toolCalls = [];
48
+ messageCounter = 0;
49
+ eventCounter = 0;
50
+ failOn;
51
+ errorFactory;
52
+ constructor(options) {
53
+ this.failOn = new Set(options?.failOn ?? []);
54
+ this.errorFactory = options?.errorFactory ?? ((method) => new Error(`FakeAgentTools configured failure for ${String(method)}`));
55
+ }
56
+ async sendMessage(content, mentions) {
57
+ this.maybeFail("sendMessage");
58
+ this.messagesSent.push({ content, mentions });
59
+ const id = `msg-${this.messageCounter++}`;
60
+ return { id, status: "sent" };
61
+ }
62
+ async sendEvent(content, messageType, metadata) {
63
+ this.maybeFail("sendEvent");
64
+ this.eventsSent.push({ content, messageType, metadata });
65
+ const id = `evt-${this.eventCounter++}`;
66
+ return { id, status: "sent" };
67
+ }
68
+ async addParticipant(name, role) {
69
+ this.maybeFail("addParticipant");
70
+ this.participantsAdded.push({ name, role });
71
+ return { status: "ok" };
72
+ }
73
+ async removeParticipant(name) {
74
+ this.maybeFail("removeParticipant");
75
+ this.participantsRemoved.push(name);
76
+ return { status: "ok" };
77
+ }
78
+ async getParticipants() {
79
+ this.maybeFail("getParticipants");
80
+ return [];
81
+ }
82
+ async createChatroom(_taskId) {
83
+ this.maybeFail("createChatroom");
84
+ return `room-${Date.now()}`;
85
+ }
86
+ async lookupPeers(_page, _pageSize) {
87
+ this.maybeFail("lookupPeers");
88
+ return { data: [] };
89
+ }
90
+ getToolSchemas(_format, _options) {
91
+ this.maybeFail("getToolSchemas");
92
+ return [];
93
+ }
94
+ getAnthropicToolSchemas(_options) {
95
+ this.maybeFail("getAnthropicToolSchemas");
96
+ return [];
97
+ }
98
+ getOpenAIToolSchemas(_options) {
99
+ this.maybeFail("getOpenAIToolSchemas");
100
+ return [];
101
+ }
102
+ async executeToolCall(toolName, arguments_) {
103
+ this.maybeFail("executeToolCall");
104
+ this.toolCalls.push({ toolName, arguments: arguments_ });
105
+ return { status: "ok" };
106
+ }
107
+ // Contact stubs
108
+ async listContacts(_request) {
109
+ this.maybeFail("listContacts");
110
+ return { data: [] };
111
+ }
112
+ async addContact(_request) {
113
+ this.maybeFail("addContact");
114
+ return { status: "ok" };
115
+ }
116
+ async removeContact(_request) {
117
+ this.maybeFail("removeContact");
118
+ return { status: "ok" };
119
+ }
120
+ async listContactRequests(_request) {
121
+ this.maybeFail("listContactRequests");
122
+ return { received: [], sent: [] };
123
+ }
124
+ async respondContactRequest(_request) {
125
+ this.maybeFail("respondContactRequest");
126
+ return { status: "ok" };
127
+ }
128
+ // Memory stubs
129
+ async listMemories(_args) {
130
+ this.maybeFail("listMemories");
131
+ return { data: [] };
132
+ }
133
+ async storeMemory(args) {
134
+ this.maybeFail("storeMemory");
135
+ return { ...args, id: "mem-0", status: "active" };
136
+ }
137
+ async getMemory(memoryId) {
138
+ this.maybeFail("getMemory");
139
+ return { id: memoryId, status: "active" };
140
+ }
141
+ async supersedeMemory(_memoryId) {
142
+ this.maybeFail("supersedeMemory");
143
+ return { status: "ok" };
144
+ }
145
+ async archiveMemory(_memoryId) {
146
+ this.maybeFail("archiveMemory");
147
+ return { status: "ok" };
148
+ }
149
+ reset() {
150
+ this.messagesSent.length = 0;
151
+ this.eventsSent.length = 0;
152
+ this.participantsAdded.length = 0;
153
+ this.participantsRemoved.length = 0;
154
+ this.toolCalls.length = 0;
155
+ this.messageCounter = 0;
156
+ this.eventCounter = 0;
157
+ }
158
+ maybeFail(method) {
159
+ if (this.failOn.has(method)) {
160
+ throw this.errorFactory(method);
161
+ }
162
+ }
163
+ };
164
+
165
+ // src/testing/StubRestApi.ts
166
+ var StubRestApi = class {
167
+ async getAgentMe() {
168
+ return { id: "stub-agent", name: "Stub Agent", description: null };
169
+ }
170
+ async createChatMessage() {
171
+ return { ok: true };
172
+ }
173
+ async createChatEvent() {
174
+ return { ok: true };
175
+ }
176
+ async createChat() {
177
+ return { id: "stub-room" };
178
+ }
179
+ async listChatParticipants() {
180
+ return [];
181
+ }
182
+ async addChatParticipant() {
183
+ return { ok: true };
184
+ }
185
+ async removeChatParticipant() {
186
+ return { ok: true };
187
+ }
188
+ async markMessageProcessing() {
189
+ return { ok: true };
190
+ }
191
+ async markMessageProcessed() {
192
+ return { ok: true };
193
+ }
194
+ async markMessageFailed() {
195
+ return { ok: true };
196
+ }
197
+ async listChats() {
198
+ return {
199
+ data: [],
200
+ metadata: { page: 1, pageSize: 100, totalCount: 0, totalPages: 1 }
201
+ };
202
+ }
203
+ async listPeers() {
204
+ return {
205
+ data: [],
206
+ metadata: { page: 1, pageSize: 100, totalCount: 0, totalPages: 1 }
207
+ };
208
+ }
209
+ async getNextMessage() {
210
+ return null;
211
+ }
212
+ };
213
+ // Annotate the CommonJS export names for ESM import in node:
214
+ 0 && (module.exports = {
215
+ FakeAgentTools,
216
+ StubRestApi
217
+ });
@@ -0,0 +1,126 @@
1
+ import { A as AdapterToolsProtocol, d as PeerLookupTools, C as ContactTools, M as MemoryTools, h as AgentToolsCapabilities } from './protocols-CInhtFpA.cjs';
2
+ import { a as MentionInput, M as MetadataMap, T as ToolOperationResult, P as ParticipantRecord, c as PaginatedList, d as PeerRecord, b as ToolSchemaRecord, L as ListContactsArgs, C as ContactRecord, A as AddContactArgs, R as RemoveContactArgs, e as ListContactRequestsArgs, f as ContactRequestsResult, g as RespondContactRequestArgs, h as ListMemoriesArgs, i as MemoryRecord, S as StoreMemoryArgs } from './dtos-DUpbIu8k.cjs';
3
+ import { R as RestApi } from './types-CSHFipIc.cjs';
4
+
5
+ interface CapturedMessage {
6
+ content: string;
7
+ mentions?: MentionInput;
8
+ }
9
+ interface CapturedEvent {
10
+ content: string;
11
+ messageType: string;
12
+ metadata?: MetadataMap;
13
+ }
14
+ interface CapturedParticipant {
15
+ name: string;
16
+ role?: string;
17
+ }
18
+ interface CapturedToolCall {
19
+ toolName: string;
20
+ arguments: MetadataMap;
21
+ }
22
+ type FakeToolMethod = keyof AdapterToolsProtocol;
23
+ interface FakeAgentToolsOptions {
24
+ failOn?: Iterable<FakeToolMethod>;
25
+ errorFactory?: (method: FakeToolMethod) => Error;
26
+ }
27
+ declare class FakeAgentTools implements AdapterToolsProtocol, PeerLookupTools, ContactTools, MemoryTools {
28
+ readonly capabilities: Readonly<AgentToolsCapabilities>;
29
+ messagesSent: CapturedMessage[];
30
+ eventsSent: CapturedEvent[];
31
+ participantsAdded: CapturedParticipant[];
32
+ participantsRemoved: string[];
33
+ toolCalls: CapturedToolCall[];
34
+ private messageCounter;
35
+ private eventCounter;
36
+ private readonly failOn;
37
+ private readonly errorFactory;
38
+ constructor(options?: FakeAgentToolsOptions);
39
+ sendMessage(content: string, mentions?: MentionInput): Promise<ToolOperationResult>;
40
+ sendEvent(content: string, messageType: string, metadata?: MetadataMap): Promise<ToolOperationResult>;
41
+ addParticipant(name: string, role?: string): Promise<ToolOperationResult>;
42
+ removeParticipant(name: string): Promise<ToolOperationResult>;
43
+ getParticipants(): Promise<ParticipantRecord[]>;
44
+ createChatroom(_taskId?: string): Promise<string>;
45
+ lookupPeers(_page?: number, _pageSize?: number): Promise<PaginatedList<PeerRecord>>;
46
+ getToolSchemas(_format: "openai" | "anthropic", _options?: {
47
+ includeMemory?: boolean;
48
+ }): ToolSchemaRecord[];
49
+ getAnthropicToolSchemas(_options?: {
50
+ includeMemory?: boolean;
51
+ }): ToolSchemaRecord[];
52
+ getOpenAIToolSchemas(_options?: {
53
+ includeMemory?: boolean;
54
+ }): ToolSchemaRecord[];
55
+ executeToolCall(toolName: string, arguments_: MetadataMap): Promise<unknown>;
56
+ listContacts(_request?: ListContactsArgs): Promise<PaginatedList<ContactRecord>>;
57
+ addContact(_request: AddContactArgs): Promise<ToolOperationResult>;
58
+ removeContact(_request: RemoveContactArgs): Promise<ToolOperationResult>;
59
+ listContactRequests(_request?: ListContactRequestsArgs): Promise<ContactRequestsResult>;
60
+ respondContactRequest(_request: RespondContactRequestArgs): Promise<ToolOperationResult>;
61
+ listMemories(_args?: ListMemoriesArgs): Promise<PaginatedList<MemoryRecord>>;
62
+ storeMemory(args: StoreMemoryArgs): Promise<MemoryRecord>;
63
+ getMemory(memoryId: string): Promise<MemoryRecord>;
64
+ supersedeMemory(_memoryId: string): Promise<ToolOperationResult>;
65
+ archiveMemory(_memoryId: string): Promise<ToolOperationResult>;
66
+ reset(): void;
67
+ private maybeFail;
68
+ }
69
+
70
+ /**
71
+ * No-op REST API implementation for local development and examples.
72
+ * Returns sensible defaults for all methods without making real API calls.
73
+ */
74
+ declare class StubRestApi implements RestApi {
75
+ getAgentMe(): Promise<{
76
+ id: string;
77
+ name: string;
78
+ description: null;
79
+ }>;
80
+ createChatMessage(): Promise<{
81
+ ok: boolean;
82
+ }>;
83
+ createChatEvent(): Promise<{
84
+ ok: boolean;
85
+ }>;
86
+ createChat(): Promise<{
87
+ id: string;
88
+ }>;
89
+ listChatParticipants(): Promise<never[]>;
90
+ addChatParticipant(): Promise<{
91
+ ok: boolean;
92
+ }>;
93
+ removeChatParticipant(): Promise<{
94
+ ok: boolean;
95
+ }>;
96
+ markMessageProcessing(): Promise<{
97
+ ok: boolean;
98
+ }>;
99
+ markMessageProcessed(): Promise<{
100
+ ok: boolean;
101
+ }>;
102
+ markMessageFailed(): Promise<{
103
+ ok: boolean;
104
+ }>;
105
+ listChats(): Promise<{
106
+ data: never[];
107
+ metadata: {
108
+ page: number;
109
+ pageSize: number;
110
+ totalCount: number;
111
+ totalPages: number;
112
+ };
113
+ }>;
114
+ listPeers(): Promise<{
115
+ data: never[];
116
+ metadata: {
117
+ page: number;
118
+ pageSize: number;
119
+ totalCount: number;
120
+ totalPages: number;
121
+ };
122
+ }>;
123
+ getNextMessage(): Promise<null>;
124
+ }
125
+
126
+ export { FakeAgentTools, type FakeAgentToolsOptions, StubRestApi };
@@ -0,0 +1,126 @@
1
+ import { A as AdapterToolsProtocol, d as PeerLookupTools, C as ContactTools, M as MemoryTools, h as AgentToolsCapabilities } from './protocols-DrhzOH6K.js';
2
+ import { a as MentionInput, M as MetadataMap, T as ToolOperationResult, P as ParticipantRecord, c as PaginatedList, d as PeerRecord, b as ToolSchemaRecord, L as ListContactsArgs, C as ContactRecord, A as AddContactArgs, R as RemoveContactArgs, e as ListContactRequestsArgs, f as ContactRequestsResult, g as RespondContactRequestArgs, h as ListMemoriesArgs, i as MemoryRecord, S as StoreMemoryArgs } from './dtos-DUpbIu8k.js';
3
+ import { R as RestApi } from './types-CxII3XkA.js';
4
+
5
+ interface CapturedMessage {
6
+ content: string;
7
+ mentions?: MentionInput;
8
+ }
9
+ interface CapturedEvent {
10
+ content: string;
11
+ messageType: string;
12
+ metadata?: MetadataMap;
13
+ }
14
+ interface CapturedParticipant {
15
+ name: string;
16
+ role?: string;
17
+ }
18
+ interface CapturedToolCall {
19
+ toolName: string;
20
+ arguments: MetadataMap;
21
+ }
22
+ type FakeToolMethod = keyof AdapterToolsProtocol;
23
+ interface FakeAgentToolsOptions {
24
+ failOn?: Iterable<FakeToolMethod>;
25
+ errorFactory?: (method: FakeToolMethod) => Error;
26
+ }
27
+ declare class FakeAgentTools implements AdapterToolsProtocol, PeerLookupTools, ContactTools, MemoryTools {
28
+ readonly capabilities: Readonly<AgentToolsCapabilities>;
29
+ messagesSent: CapturedMessage[];
30
+ eventsSent: CapturedEvent[];
31
+ participantsAdded: CapturedParticipant[];
32
+ participantsRemoved: string[];
33
+ toolCalls: CapturedToolCall[];
34
+ private messageCounter;
35
+ private eventCounter;
36
+ private readonly failOn;
37
+ private readonly errorFactory;
38
+ constructor(options?: FakeAgentToolsOptions);
39
+ sendMessage(content: string, mentions?: MentionInput): Promise<ToolOperationResult>;
40
+ sendEvent(content: string, messageType: string, metadata?: MetadataMap): Promise<ToolOperationResult>;
41
+ addParticipant(name: string, role?: string): Promise<ToolOperationResult>;
42
+ removeParticipant(name: string): Promise<ToolOperationResult>;
43
+ getParticipants(): Promise<ParticipantRecord[]>;
44
+ createChatroom(_taskId?: string): Promise<string>;
45
+ lookupPeers(_page?: number, _pageSize?: number): Promise<PaginatedList<PeerRecord>>;
46
+ getToolSchemas(_format: "openai" | "anthropic", _options?: {
47
+ includeMemory?: boolean;
48
+ }): ToolSchemaRecord[];
49
+ getAnthropicToolSchemas(_options?: {
50
+ includeMemory?: boolean;
51
+ }): ToolSchemaRecord[];
52
+ getOpenAIToolSchemas(_options?: {
53
+ includeMemory?: boolean;
54
+ }): ToolSchemaRecord[];
55
+ executeToolCall(toolName: string, arguments_: MetadataMap): Promise<unknown>;
56
+ listContacts(_request?: ListContactsArgs): Promise<PaginatedList<ContactRecord>>;
57
+ addContact(_request: AddContactArgs): Promise<ToolOperationResult>;
58
+ removeContact(_request: RemoveContactArgs): Promise<ToolOperationResult>;
59
+ listContactRequests(_request?: ListContactRequestsArgs): Promise<ContactRequestsResult>;
60
+ respondContactRequest(_request: RespondContactRequestArgs): Promise<ToolOperationResult>;
61
+ listMemories(_args?: ListMemoriesArgs): Promise<PaginatedList<MemoryRecord>>;
62
+ storeMemory(args: StoreMemoryArgs): Promise<MemoryRecord>;
63
+ getMemory(memoryId: string): Promise<MemoryRecord>;
64
+ supersedeMemory(_memoryId: string): Promise<ToolOperationResult>;
65
+ archiveMemory(_memoryId: string): Promise<ToolOperationResult>;
66
+ reset(): void;
67
+ private maybeFail;
68
+ }
69
+
70
+ /**
71
+ * No-op REST API implementation for local development and examples.
72
+ * Returns sensible defaults for all methods without making real API calls.
73
+ */
74
+ declare class StubRestApi implements RestApi {
75
+ getAgentMe(): Promise<{
76
+ id: string;
77
+ name: string;
78
+ description: null;
79
+ }>;
80
+ createChatMessage(): Promise<{
81
+ ok: boolean;
82
+ }>;
83
+ createChatEvent(): Promise<{
84
+ ok: boolean;
85
+ }>;
86
+ createChat(): Promise<{
87
+ id: string;
88
+ }>;
89
+ listChatParticipants(): Promise<never[]>;
90
+ addChatParticipant(): Promise<{
91
+ ok: boolean;
92
+ }>;
93
+ removeChatParticipant(): Promise<{
94
+ ok: boolean;
95
+ }>;
96
+ markMessageProcessing(): Promise<{
97
+ ok: boolean;
98
+ }>;
99
+ markMessageProcessed(): Promise<{
100
+ ok: boolean;
101
+ }>;
102
+ markMessageFailed(): Promise<{
103
+ ok: boolean;
104
+ }>;
105
+ listChats(): Promise<{
106
+ data: never[];
107
+ metadata: {
108
+ page: number;
109
+ pageSize: number;
110
+ totalCount: number;
111
+ totalPages: number;
112
+ };
113
+ }>;
114
+ listPeers(): Promise<{
115
+ data: never[];
116
+ metadata: {
117
+ page: number;
118
+ pageSize: number;
119
+ totalCount: number;
120
+ totalPages: number;
121
+ };
122
+ }>;
123
+ getNextMessage(): Promise<null>;
124
+ }
125
+
126
+ export { FakeAgentTools, type FakeAgentToolsOptions, StubRestApi };
@@ -0,0 +1,186 @@
1
+ import {
2
+ DEFAULT_AGENT_TOOLS_CAPABILITIES
3
+ } from "./chunk-3BKAC4OZ.js";
4
+
5
+ // src/testing/FakeAgentTools.ts
6
+ var FakeAgentTools = class {
7
+ capabilities = {
8
+ ...DEFAULT_AGENT_TOOLS_CAPABILITIES,
9
+ peers: true,
10
+ contacts: true,
11
+ memory: true
12
+ };
13
+ messagesSent = [];
14
+ eventsSent = [];
15
+ participantsAdded = [];
16
+ participantsRemoved = [];
17
+ toolCalls = [];
18
+ messageCounter = 0;
19
+ eventCounter = 0;
20
+ failOn;
21
+ errorFactory;
22
+ constructor(options) {
23
+ this.failOn = new Set(options?.failOn ?? []);
24
+ this.errorFactory = options?.errorFactory ?? ((method) => new Error(`FakeAgentTools configured failure for ${String(method)}`));
25
+ }
26
+ async sendMessage(content, mentions) {
27
+ this.maybeFail("sendMessage");
28
+ this.messagesSent.push({ content, mentions });
29
+ const id = `msg-${this.messageCounter++}`;
30
+ return { id, status: "sent" };
31
+ }
32
+ async sendEvent(content, messageType, metadata) {
33
+ this.maybeFail("sendEvent");
34
+ this.eventsSent.push({ content, messageType, metadata });
35
+ const id = `evt-${this.eventCounter++}`;
36
+ return { id, status: "sent" };
37
+ }
38
+ async addParticipant(name, role) {
39
+ this.maybeFail("addParticipant");
40
+ this.participantsAdded.push({ name, role });
41
+ return { status: "ok" };
42
+ }
43
+ async removeParticipant(name) {
44
+ this.maybeFail("removeParticipant");
45
+ this.participantsRemoved.push(name);
46
+ return { status: "ok" };
47
+ }
48
+ async getParticipants() {
49
+ this.maybeFail("getParticipants");
50
+ return [];
51
+ }
52
+ async createChatroom(_taskId) {
53
+ this.maybeFail("createChatroom");
54
+ return `room-${Date.now()}`;
55
+ }
56
+ async lookupPeers(_page, _pageSize) {
57
+ this.maybeFail("lookupPeers");
58
+ return { data: [] };
59
+ }
60
+ getToolSchemas(_format, _options) {
61
+ this.maybeFail("getToolSchemas");
62
+ return [];
63
+ }
64
+ getAnthropicToolSchemas(_options) {
65
+ this.maybeFail("getAnthropicToolSchemas");
66
+ return [];
67
+ }
68
+ getOpenAIToolSchemas(_options) {
69
+ this.maybeFail("getOpenAIToolSchemas");
70
+ return [];
71
+ }
72
+ async executeToolCall(toolName, arguments_) {
73
+ this.maybeFail("executeToolCall");
74
+ this.toolCalls.push({ toolName, arguments: arguments_ });
75
+ return { status: "ok" };
76
+ }
77
+ // Contact stubs
78
+ async listContacts(_request) {
79
+ this.maybeFail("listContacts");
80
+ return { data: [] };
81
+ }
82
+ async addContact(_request) {
83
+ this.maybeFail("addContact");
84
+ return { status: "ok" };
85
+ }
86
+ async removeContact(_request) {
87
+ this.maybeFail("removeContact");
88
+ return { status: "ok" };
89
+ }
90
+ async listContactRequests(_request) {
91
+ this.maybeFail("listContactRequests");
92
+ return { received: [], sent: [] };
93
+ }
94
+ async respondContactRequest(_request) {
95
+ this.maybeFail("respondContactRequest");
96
+ return { status: "ok" };
97
+ }
98
+ // Memory stubs
99
+ async listMemories(_args) {
100
+ this.maybeFail("listMemories");
101
+ return { data: [] };
102
+ }
103
+ async storeMemory(args) {
104
+ this.maybeFail("storeMemory");
105
+ return { ...args, id: "mem-0", status: "active" };
106
+ }
107
+ async getMemory(memoryId) {
108
+ this.maybeFail("getMemory");
109
+ return { id: memoryId, status: "active" };
110
+ }
111
+ async supersedeMemory(_memoryId) {
112
+ this.maybeFail("supersedeMemory");
113
+ return { status: "ok" };
114
+ }
115
+ async archiveMemory(_memoryId) {
116
+ this.maybeFail("archiveMemory");
117
+ return { status: "ok" };
118
+ }
119
+ reset() {
120
+ this.messagesSent.length = 0;
121
+ this.eventsSent.length = 0;
122
+ this.participantsAdded.length = 0;
123
+ this.participantsRemoved.length = 0;
124
+ this.toolCalls.length = 0;
125
+ this.messageCounter = 0;
126
+ this.eventCounter = 0;
127
+ }
128
+ maybeFail(method) {
129
+ if (this.failOn.has(method)) {
130
+ throw this.errorFactory(method);
131
+ }
132
+ }
133
+ };
134
+
135
+ // src/testing/StubRestApi.ts
136
+ var StubRestApi = class {
137
+ async getAgentMe() {
138
+ return { id: "stub-agent", name: "Stub Agent", description: null };
139
+ }
140
+ async createChatMessage() {
141
+ return { ok: true };
142
+ }
143
+ async createChatEvent() {
144
+ return { ok: true };
145
+ }
146
+ async createChat() {
147
+ return { id: "stub-room" };
148
+ }
149
+ async listChatParticipants() {
150
+ return [];
151
+ }
152
+ async addChatParticipant() {
153
+ return { ok: true };
154
+ }
155
+ async removeChatParticipant() {
156
+ return { ok: true };
157
+ }
158
+ async markMessageProcessing() {
159
+ return { ok: true };
160
+ }
161
+ async markMessageProcessed() {
162
+ return { ok: true };
163
+ }
164
+ async markMessageFailed() {
165
+ return { ok: true };
166
+ }
167
+ async listChats() {
168
+ return {
169
+ data: [],
170
+ metadata: { page: 1, pageSize: 100, totalCount: 0, totalPages: 1 }
171
+ };
172
+ }
173
+ async listPeers() {
174
+ return {
175
+ data: [],
176
+ metadata: { page: 1, pageSize: 100, totalCount: 0, totalPages: 1 }
177
+ };
178
+ }
179
+ async getNextMessage() {
180
+ return null;
181
+ }
182
+ };
183
+ export {
184
+ FakeAgentTools,
185
+ StubRestApi
186
+ };