@band-ai/sdk 0.1.6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +372 -0
  2. package/dist/{ClaudeSDKAdapter-CRq4R-WB.d.cts → ClaudeSDKAdapter-BY4zEbCl.d.cts} +14 -10
  3. package/dist/{ClaudeSDKAdapter-BHOkjN3X.d.ts → ClaudeSDKAdapter-Cna5P1dR.d.ts} +14 -10
  4. package/dist/{acp-server-B1Da7L6u.d.ts → acp-server-CiUqN3G3.d.ts} +2 -2
  5. package/dist/{acp-server-BdRz9_UN.d.cts → acp-server-Dlj7D563.d.cts} +2 -2
  6. package/dist/adapters.cjs +734 -279
  7. package/dist/adapters.d.cts +21 -19
  8. package/dist/adapters.d.ts +21 -19
  9. package/dist/adapters.js +65 -44
  10. package/dist/backends-D-dBdDm-.d.ts +27 -0
  11. package/dist/backends-ZLxmQrTZ.d.cts +27 -0
  12. package/dist/{chunk-MSL6CWHY.js → chunk-4IAXZBXX.js} +77 -37
  13. package/dist/{chunk-SG4WLD2H.js → chunk-EAI2M3WM.js} +38 -94
  14. package/dist/{chunk-YR3BOQNW.js → chunk-JY75VSQK.js} +7 -7
  15. package/dist/{chunk-INA6YZTZ.js → chunk-LBWKISBS.js} +51 -31
  16. package/dist/{chunk-I5EZG52P.js → chunk-N2QTUMGO.js} +532 -327
  17. package/dist/{chunk-RHVH2GZR.js → chunk-NMZLX7TP.js} +110 -56
  18. package/dist/{chunk-EDPKUUJL.js → chunk-NT7TBFX2.js} +9 -1
  19. package/dist/{chunk-GVEQ3RAH.js → chunk-RV76SKFT.js} +169 -54
  20. package/dist/{chunk-W5NDZSYE.js → chunk-TLBCKDQO.js} +23 -23
  21. package/dist/chunk-US226AS4.js +130 -0
  22. package/dist/{chunk-IZPV6QS6.js → chunk-WL2HNJZ6.js} +38 -11
  23. package/dist/chunk-WLCM2OXG.js +181 -0
  24. package/dist/config.cjs +40 -13
  25. package/dist/config.d.cts +7 -1
  26. package/dist/config.d.ts +7 -1
  27. package/dist/config.js +2 -2
  28. package/dist/converters.cjs +491 -35
  29. package/dist/converters.d.cts +5 -5
  30. package/dist/converters.d.ts +5 -5
  31. package/dist/converters.js +4 -3
  32. package/dist/core.cjs +53 -10
  33. package/dist/core.d.cts +10 -9
  34. package/dist/core.d.ts +10 -9
  35. package/dist/core.js +8 -4
  36. package/dist/disconnectReason-IuADl6TH.d.cts +34 -0
  37. package/dist/disconnectReason-IuADl6TH.d.ts +34 -0
  38. package/dist/{dtos-DUpbIu8k.d.ts → dtos-B8KU_q4d.d.cts} +26 -6
  39. package/dist/{dtos-DUpbIu8k.d.cts → dtos-B8KU_q4d.d.ts} +26 -6
  40. package/dist/index.cjs +1510 -735
  41. package/dist/index.d.cts +18 -16
  42. package/dist/index.d.ts +18 -16
  43. package/dist/index.js +21 -13
  44. package/dist/linear.cjs +1044 -112
  45. package/dist/linear.d.cts +146 -16
  46. package/dist/linear.d.ts +146 -16
  47. package/dist/linear.js +1031 -110
  48. package/dist/mcp-claude.cjs +338 -66
  49. package/dist/mcp-claude.d.cts +3 -3
  50. package/dist/mcp-claude.d.ts +3 -3
  51. package/dist/mcp-claude.js +215 -16
  52. package/dist/mcp.cjs +414 -105
  53. package/dist/mcp.d.cts +29 -16
  54. package/dist/mcp.d.ts +29 -16
  55. package/dist/mcp.js +14 -14
  56. package/dist/{opencode-BBcDchcN.d.cts → opencode-2YdscIc1.d.cts} +5 -5
  57. package/dist/{opencode-DthQQUsZ.d.ts → opencode-Bld62x5t.d.ts} +5 -5
  58. package/dist/{pagination-CcDkVFxK.d.ts → pagination-BgEx-HeL.d.ts} +2 -2
  59. package/dist/{pagination-BPiys10t.d.cts → pagination-DqdkQArT.d.cts} +2 -2
  60. package/dist/{protocols-DrhzOH6K.d.ts → protocols-Bwwcql0h.d.ts} +1 -1
  61. package/dist/{protocols-CInhtFpA.d.cts → protocols-Bz1rxcUg.d.cts} +1 -1
  62. package/dist/rest.cjs +41 -97
  63. package/dist/rest.d.cts +7 -7
  64. package/dist/rest.d.ts +7 -7
  65. package/dist/rest.js +2 -2
  66. package/dist/runtime.cjs +998 -620
  67. package/dist/runtime.d.cts +22 -29
  68. package/dist/runtime.d.ts +22 -29
  69. package/dist/runtime.js +19 -67
  70. package/dist/{schemas-BpEBkq5V.d.cts → schemas-BotL3ZLH.d.cts} +51 -56
  71. package/dist/{schemas-vos1AaBc.d.ts → schemas-DBsC4J1g.d.ts} +51 -56
  72. package/dist/{sdk-CwTAxhwI.d.cts → sdk-BTciSLRQ.d.cts} +35 -5
  73. package/dist/{sdk-CcnQ5OUC.d.ts → sdk-qKJtMma_.d.ts} +35 -5
  74. package/dist/{simpleAdapter-9OE_p6QW.d.ts → simpleAdapter--wznuoOw.d.ts} +1 -1
  75. package/dist/{simpleAdapter-DqhvjsGr.d.cts → simpleAdapter-BpT4XbZC.d.cts} +1 -1
  76. package/dist/testing.d.cts +3 -3
  77. package/dist/testing.d.ts +3 -3
  78. package/dist/{types-7jVzOeOP.d.ts → types-BTN_ZETM.d.ts} +2 -2
  79. package/dist/{types-CxII3XkA.d.ts → types-BgYFd_Yw.d.cts} +5 -5
  80. package/dist/{types-CSHFipIc.d.cts → types-BivGO7I9.d.ts} +5 -5
  81. package/dist/{types-CovcHpYf.d.cts → types-D958TC71.d.cts} +2 -2
  82. package/package.json +25 -23
  83. package/dist/backends-CzDbiQar.d.ts +0 -20
  84. package/dist/backends-SVMT-7l4.d.cts +0 -20
  85. package/dist/chunk-SFVKOEQH.js +0 -103
package/dist/mcp.d.cts CHANGED
@@ -1,12 +1,12 @@
1
- export { C as CreateThenvoiMcpBackendOptions, T as ThenvoiMcpBackend, a as ThenvoiMcpBackendKind, c as createThenvoiMcpBackend, g as getThenvoiSdkMcpServerConfig } from './backends-SVMT-7l4.cjs';
2
- import { M as McpToolRegistration } from './sdk-CwTAxhwI.cjs';
3
- export { B as BuildRegistrationsOptions, a as McpToolInputSchema, b as McpToolResult, c as buildRoomScopedRegistrations, d as buildSingleContextRegistrations, e as errorResult, s as successResult } from './sdk-CwTAxhwI.cjs';
4
- import { A as AdapterToolsProtocol } from './protocols-CInhtFpA.cjs';
1
+ export { B as BandMcpBackend, a as BandMcpBackendKind, C as CreateBandMcpBackendOptions, c as createBandMcpBackend, g as getBandSdkMcpServerConfig } from './backends-ZLxmQrTZ.cjs';
2
+ import { M as McpToolRegistration } from './sdk-BTciSLRQ.cjs';
3
+ export { a as BuildRegistrationsOptions, b as McpToolInputSchema, c as McpToolResult, d as buildRoomScopedRegistrations, e as buildSingleContextRegistrations, f as errorResult, s as successResult } from './sdk-BTciSLRQ.cjs';
4
+ import { A as AdapterToolsProtocol } from './protocols-Bz1rxcUg.cjs';
5
5
  import { Readable, Writable } from 'node:stream';
6
6
  import '@anthropic-ai/claude-agent-sdk';
7
- import './dtos-DUpbIu8k.cjs';
7
+ import './dtos-B8KU_q4d.cjs';
8
8
 
9
- interface ThenvoiMcpServerOptions {
9
+ interface BandMcpServerOptions {
10
10
  /** Single tools instance (no room scoping) or a resolver function for room-scoped tools. */
11
11
  tools: AdapterToolsProtocol | ((roomId: string) => AdapterToolsProtocol | undefined);
12
12
  /** Server name advertised to MCP clients. */
@@ -19,21 +19,27 @@ interface ThenvoiMcpServerOptions {
19
19
  enableContactTools?: boolean;
20
20
  /** Additional MCP tool registrations to expose alongside the built-in tools. */
21
21
  additionalTools?: McpToolRegistration[];
22
+ /**
23
+ * When set, every `/mcp` request must carry `Authorization: Bearer <authToken>`
24
+ * or is rejected with a 401. Unset (the default) leaves the server open, matching
25
+ * prior behavior for callers that don't opt in.
26
+ */
27
+ authToken?: string;
22
28
  }
23
29
  /**
24
- * Standalone MCP server that exposes Thenvoi agent tools over Streamable HTTP.
30
+ * Standalone MCP server that exposes Band agent tools over Streamable HTTP.
25
31
  *
26
32
  * Uses `@modelcontextprotocol/server` (optional peer dependency) and `express`.
27
33
  * Install with: `npm install @modelcontextprotocol/server express`
28
34
  */
29
- declare class ThenvoiMcpServer {
35
+ declare class BandMcpServer {
30
36
  private readonly options;
31
37
  private readonly registrations;
32
38
  private httpServer;
33
39
  private actualPort;
34
40
  private readonly sessions;
35
41
  private sessionSweepTimer;
36
- constructor(options: ThenvoiMcpServerOptions);
42
+ constructor(options: BandMcpServerOptions);
37
43
  /** Port the server is listening on. Null if not started. */
38
44
  get port(): number | null;
39
45
  /** MCP endpoint URL. Null if not started. */
@@ -48,22 +54,29 @@ declare class ThenvoiMcpServer {
48
54
  private closeIdleSessions;
49
55
  }
50
56
 
51
- interface ThenvoiMcpSseServerOptions {
57
+ interface BandMcpSseServerOptions {
52
58
  tools: AdapterToolsProtocol | ((roomId: string) => AdapterToolsProtocol | undefined);
53
59
  name?: string;
54
60
  port?: number;
55
61
  enableMemoryTools?: boolean;
56
62
  enableContactTools?: boolean;
57
63
  additionalTools?: McpToolRegistration[];
64
+ /**
65
+ * When set, every `/sse` and `/messages` request must carry
66
+ * `Authorization: Bearer <authToken>` or is rejected with a 401. Unset (the
67
+ * default) leaves the server open, matching prior behavior for callers that
68
+ * don't opt in.
69
+ */
70
+ authToken?: string;
58
71
  }
59
- declare class ThenvoiMcpSseServer {
72
+ declare class BandMcpSseServer {
60
73
  private readonly options;
61
74
  private readonly registrations;
62
75
  private httpServer;
63
76
  private actualPort;
64
77
  private readonly sessions;
65
78
  private sweepTimer;
66
- constructor(options: ThenvoiMcpSseServerOptions);
79
+ constructor(options: BandMcpSseServerOptions);
67
80
  get port(): number | null;
68
81
  get sseUrl(): string | null;
69
82
  get toolNames(): string[];
@@ -74,7 +87,7 @@ declare class ThenvoiMcpSseServer {
74
87
  private closeIdleSessions;
75
88
  }
76
89
 
77
- interface ThenvoiMcpStdioServerOptions {
90
+ interface BandMcpStdioServerOptions {
78
91
  tools: AdapterToolsProtocol | ((roomId: string) => AdapterToolsProtocol | undefined);
79
92
  name?: string;
80
93
  enableMemoryTools?: boolean;
@@ -83,15 +96,15 @@ interface ThenvoiMcpStdioServerOptions {
83
96
  stdin?: Readable;
84
97
  stdout?: Writable;
85
98
  }
86
- declare class ThenvoiMcpStdioServer {
99
+ declare class BandMcpStdioServer {
87
100
  private readonly options;
88
101
  private readonly registrations;
89
102
  private mcpServer;
90
103
  private transport;
91
- constructor(options: ThenvoiMcpStdioServerOptions);
104
+ constructor(options: BandMcpStdioServerOptions);
92
105
  get toolNames(): string[];
93
106
  start(): Promise<void>;
94
107
  stop(): Promise<void>;
95
108
  }
96
109
 
97
- export { McpToolRegistration, ThenvoiMcpServer, type ThenvoiMcpServerOptions, ThenvoiMcpSseServer, type ThenvoiMcpSseServerOptions, ThenvoiMcpStdioServer, type ThenvoiMcpStdioServerOptions };
110
+ export { BandMcpServer, type BandMcpServerOptions, BandMcpSseServer, type BandMcpSseServerOptions, BandMcpStdioServer, type BandMcpStdioServerOptions, McpToolRegistration };
package/dist/mcp.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- export { C as CreateThenvoiMcpBackendOptions, T as ThenvoiMcpBackend, a as ThenvoiMcpBackendKind, c as createThenvoiMcpBackend, g as getThenvoiSdkMcpServerConfig } from './backends-CzDbiQar.js';
2
- import { M as McpToolRegistration } from './sdk-CcnQ5OUC.js';
3
- export { B as BuildRegistrationsOptions, a as McpToolInputSchema, b as McpToolResult, c as buildRoomScopedRegistrations, d as buildSingleContextRegistrations, e as errorResult, s as successResult } from './sdk-CcnQ5OUC.js';
4
- import { A as AdapterToolsProtocol } from './protocols-DrhzOH6K.js';
1
+ export { B as BandMcpBackend, a as BandMcpBackendKind, C as CreateBandMcpBackendOptions, c as createBandMcpBackend, g as getBandSdkMcpServerConfig } from './backends-D-dBdDm-.js';
2
+ import { M as McpToolRegistration } from './sdk-qKJtMma_.js';
3
+ export { a as BuildRegistrationsOptions, b as McpToolInputSchema, c as McpToolResult, d as buildRoomScopedRegistrations, e as buildSingleContextRegistrations, f as errorResult, s as successResult } from './sdk-qKJtMma_.js';
4
+ import { A as AdapterToolsProtocol } from './protocols-Bwwcql0h.js';
5
5
  import { Readable, Writable } from 'node:stream';
6
6
  import '@anthropic-ai/claude-agent-sdk';
7
- import './dtos-DUpbIu8k.js';
7
+ import './dtos-B8KU_q4d.js';
8
8
 
9
- interface ThenvoiMcpServerOptions {
9
+ interface BandMcpServerOptions {
10
10
  /** Single tools instance (no room scoping) or a resolver function for room-scoped tools. */
11
11
  tools: AdapterToolsProtocol | ((roomId: string) => AdapterToolsProtocol | undefined);
12
12
  /** Server name advertised to MCP clients. */
@@ -19,21 +19,27 @@ interface ThenvoiMcpServerOptions {
19
19
  enableContactTools?: boolean;
20
20
  /** Additional MCP tool registrations to expose alongside the built-in tools. */
21
21
  additionalTools?: McpToolRegistration[];
22
+ /**
23
+ * When set, every `/mcp` request must carry `Authorization: Bearer <authToken>`
24
+ * or is rejected with a 401. Unset (the default) leaves the server open, matching
25
+ * prior behavior for callers that don't opt in.
26
+ */
27
+ authToken?: string;
22
28
  }
23
29
  /**
24
- * Standalone MCP server that exposes Thenvoi agent tools over Streamable HTTP.
30
+ * Standalone MCP server that exposes Band agent tools over Streamable HTTP.
25
31
  *
26
32
  * Uses `@modelcontextprotocol/server` (optional peer dependency) and `express`.
27
33
  * Install with: `npm install @modelcontextprotocol/server express`
28
34
  */
29
- declare class ThenvoiMcpServer {
35
+ declare class BandMcpServer {
30
36
  private readonly options;
31
37
  private readonly registrations;
32
38
  private httpServer;
33
39
  private actualPort;
34
40
  private readonly sessions;
35
41
  private sessionSweepTimer;
36
- constructor(options: ThenvoiMcpServerOptions);
42
+ constructor(options: BandMcpServerOptions);
37
43
  /** Port the server is listening on. Null if not started. */
38
44
  get port(): number | null;
39
45
  /** MCP endpoint URL. Null if not started. */
@@ -48,22 +54,29 @@ declare class ThenvoiMcpServer {
48
54
  private closeIdleSessions;
49
55
  }
50
56
 
51
- interface ThenvoiMcpSseServerOptions {
57
+ interface BandMcpSseServerOptions {
52
58
  tools: AdapterToolsProtocol | ((roomId: string) => AdapterToolsProtocol | undefined);
53
59
  name?: string;
54
60
  port?: number;
55
61
  enableMemoryTools?: boolean;
56
62
  enableContactTools?: boolean;
57
63
  additionalTools?: McpToolRegistration[];
64
+ /**
65
+ * When set, every `/sse` and `/messages` request must carry
66
+ * `Authorization: Bearer <authToken>` or is rejected with a 401. Unset (the
67
+ * default) leaves the server open, matching prior behavior for callers that
68
+ * don't opt in.
69
+ */
70
+ authToken?: string;
58
71
  }
59
- declare class ThenvoiMcpSseServer {
72
+ declare class BandMcpSseServer {
60
73
  private readonly options;
61
74
  private readonly registrations;
62
75
  private httpServer;
63
76
  private actualPort;
64
77
  private readonly sessions;
65
78
  private sweepTimer;
66
- constructor(options: ThenvoiMcpSseServerOptions);
79
+ constructor(options: BandMcpSseServerOptions);
67
80
  get port(): number | null;
68
81
  get sseUrl(): string | null;
69
82
  get toolNames(): string[];
@@ -74,7 +87,7 @@ declare class ThenvoiMcpSseServer {
74
87
  private closeIdleSessions;
75
88
  }
76
89
 
77
- interface ThenvoiMcpStdioServerOptions {
90
+ interface BandMcpStdioServerOptions {
78
91
  tools: AdapterToolsProtocol | ((roomId: string) => AdapterToolsProtocol | undefined);
79
92
  name?: string;
80
93
  enableMemoryTools?: boolean;
@@ -83,15 +96,15 @@ interface ThenvoiMcpStdioServerOptions {
83
96
  stdin?: Readable;
84
97
  stdout?: Writable;
85
98
  }
86
- declare class ThenvoiMcpStdioServer {
99
+ declare class BandMcpStdioServer {
87
100
  private readonly options;
88
101
  private readonly registrations;
89
102
  private mcpServer;
90
103
  private transport;
91
- constructor(options: ThenvoiMcpStdioServerOptions);
104
+ constructor(options: BandMcpStdioServerOptions);
92
105
  get toolNames(): string[];
93
106
  start(): Promise<void>;
94
107
  stop(): Promise<void>;
95
108
  }
96
109
 
97
- export { McpToolRegistration, ThenvoiMcpServer, type ThenvoiMcpServerOptions, ThenvoiMcpSseServer, type ThenvoiMcpSseServerOptions, ThenvoiMcpStdioServer, type ThenvoiMcpStdioServerOptions };
110
+ export { BandMcpServer, type BandMcpServerOptions, BandMcpSseServer, type BandMcpSseServerOptions, BandMcpStdioServer, type BandMcpStdioServerOptions, McpToolRegistration };
package/dist/mcp.js CHANGED
@@ -1,27 +1,27 @@
1
1
  import {
2
- ThenvoiMcpServer,
3
- ThenvoiMcpSseServer,
4
- ThenvoiMcpStdioServer,
5
- createThenvoiMcpBackend,
6
- getThenvoiSdkMcpServerConfig
7
- } from "./chunk-MSL6CWHY.js";
2
+ BandMcpServer,
3
+ BandMcpSseServer,
4
+ BandMcpStdioServer,
5
+ createBandMcpBackend,
6
+ getBandSdkMcpServerConfig
7
+ } from "./chunk-4IAXZBXX.js";
8
8
  import {
9
9
  buildRoomScopedRegistrations,
10
10
  buildSingleContextRegistrations,
11
11
  errorResult,
12
12
  successResult
13
- } from "./chunk-EDPKUUJL.js";
14
- import "./chunk-GVEQ3RAH.js";
13
+ } from "./chunk-NT7TBFX2.js";
14
+ import "./chunk-RV76SKFT.js";
15
15
  import "./chunk-3BKAC4OZ.js";
16
- import "./chunk-YR3BOQNW.js";
16
+ import "./chunk-JY75VSQK.js";
17
17
  export {
18
- ThenvoiMcpServer,
19
- ThenvoiMcpSseServer,
20
- ThenvoiMcpStdioServer,
18
+ BandMcpServer,
19
+ BandMcpSseServer,
20
+ BandMcpStdioServer,
21
21
  buildRoomScopedRegistrations,
22
22
  buildSingleContextRegistrations,
23
- createThenvoiMcpBackend,
23
+ createBandMcpBackend,
24
24
  errorResult,
25
- getThenvoiSdkMcpServerConfig,
25
+ getBandSdkMcpServerConfig,
26
26
  successResult
27
27
  };
@@ -1,5 +1,5 @@
1
- import { H as HistoryConverter } from './protocols-CInhtFpA.cjs';
2
- import { R as RestApi } from './types-CSHFipIc.cjs';
1
+ import { H as HistoryConverter } from './protocols-Bz1rxcUg.cjs';
2
+ import { R as RestApi } from './types-BgYFd_Yw.cjs';
3
3
 
4
4
  interface GoogleADKMessage {
5
5
  role: "user" | "model";
@@ -60,7 +60,7 @@ interface GatewayA2AStatusUpdateEvent {
60
60
  }
61
61
  interface GatewayRequest {
62
62
  /**
63
- * Canonical Thenvoi peer id.
63
+ * Canonical Band peer id.
64
64
  * Legacy clients may still send a slug in this field; adapter-side normalization handles that alias.
65
65
  */
66
66
  peerId: string;
@@ -74,7 +74,7 @@ interface GatewayRequest {
74
74
  }
75
75
  interface GatewayCancelRequest {
76
76
  /**
77
- * Canonical Thenvoi peer id.
77
+ * Canonical Band peer id.
78
78
  * Legacy clients may still send a slug in this field; adapter-side normalization handles that alias.
79
79
  */
80
80
  peerId: string;
@@ -121,7 +121,7 @@ interface GatewayServerOptions {
121
121
  }
122
122
  type GatewayServerFactory = (options: GatewayServerOptions) => GatewayServerLike;
123
123
  interface A2AGatewayAdapterOptions {
124
- thenvoiRest: RestApi;
124
+ bandRest: RestApi;
125
125
  gatewayUrl?: string;
126
126
  host?: string;
127
127
  port?: number;
@@ -1,5 +1,5 @@
1
- import { H as HistoryConverter } from './protocols-DrhzOH6K.js';
2
- import { R as RestApi } from './types-CxII3XkA.js';
1
+ import { H as HistoryConverter } from './protocols-Bwwcql0h.js';
2
+ import { R as RestApi } from './types-BivGO7I9.js';
3
3
 
4
4
  interface GoogleADKMessage {
5
5
  role: "user" | "model";
@@ -60,7 +60,7 @@ interface GatewayA2AStatusUpdateEvent {
60
60
  }
61
61
  interface GatewayRequest {
62
62
  /**
63
- * Canonical Thenvoi peer id.
63
+ * Canonical Band peer id.
64
64
  * Legacy clients may still send a slug in this field; adapter-side normalization handles that alias.
65
65
  */
66
66
  peerId: string;
@@ -74,7 +74,7 @@ interface GatewayRequest {
74
74
  }
75
75
  interface GatewayCancelRequest {
76
76
  /**
77
- * Canonical Thenvoi peer id.
77
+ * Canonical Band peer id.
78
78
  * Legacy clients may still send a slug in this field; adapter-side normalization handles that alias.
79
79
  */
80
80
  peerId: string;
@@ -121,7 +121,7 @@ interface GatewayServerOptions {
121
121
  }
122
122
  type GatewayServerFactory = (options: GatewayServerOptions) => GatewayServerLike;
123
123
  interface A2AGatewayAdapterOptions {
124
- thenvoiRest: RestApi;
124
+ bandRest: RestApi;
125
125
  gatewayUrl?: string;
126
126
  host?: string;
127
127
  port?: number;
@@ -1,5 +1,5 @@
1
- import { P as PaginatedResponse, a as PaginationMetadata } from './types-CxII3XkA.js';
2
- import { M as MetadataMap } from './dtos-DUpbIu8k.js';
1
+ import { P as PaginatedResponse, a as PaginationMetadata } from './types-BivGO7I9.js';
2
+ import { M as MetadataMap } from './dtos-B8KU_q4d.js';
3
3
 
4
4
  interface FetchPageRequest {
5
5
  page: number;
@@ -1,5 +1,5 @@
1
- import { P as PaginatedResponse, a as PaginationMetadata } from './types-CSHFipIc.cjs';
2
- import { M as MetadataMap } from './dtos-DUpbIu8k.cjs';
1
+ import { P as PaginatedResponse, a as PaginationMetadata } from './types-BgYFd_Yw.cjs';
2
+ import { M as MetadataMap } from './dtos-B8KU_q4d.cjs';
3
3
 
4
4
  interface FetchPageRequest {
5
5
  page: number;
@@ -1,4 +1,4 @@
1
- import { a as MentionInput, T as ToolOperationResult, M as MetadataMap, P as ParticipantRecord, b as ToolSchemaRecord, c as PaginatedList, d as PeerRecord, 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';
1
+ import { a as MentionInput, T as ToolOperationResult, M as MetadataMap, P as ParticipantRecord, b as ToolSchemaRecord, c as PaginatedList, d as PeerRecord, 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-B8KU_q4d.js';
2
2
 
3
3
  interface HistoryConverter<T> {
4
4
  convert(raw: MetadataMap[]): T;
@@ -1,4 +1,4 @@
1
- import { a as MentionInput, T as ToolOperationResult, M as MetadataMap, P as ParticipantRecord, b as ToolSchemaRecord, c as PaginatedList, d as PeerRecord, 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';
1
+ import { a as MentionInput, T as ToolOperationResult, M as MetadataMap, P as ParticipantRecord, b as ToolSchemaRecord, c as PaginatedList, d as PeerRecord, 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-B8KU_q4d.cjs';
2
2
 
3
3
  interface HistoryConverter<T> {
4
4
  convert(raw: MetadataMap[]): T;
package/dist/rest.cjs CHANGED
@@ -29,19 +29,19 @@ __export(rest_exports, {
29
29
  module.exports = __toCommonJS(rest_exports);
30
30
 
31
31
  // src/core/errors.ts
32
- var ThenvoiSdkError = class extends Error {
32
+ var BandSdkError = class extends Error {
33
33
  constructor(message, cause) {
34
34
  super(message, cause !== void 0 ? { cause } : void 0);
35
- this.name = "ThenvoiSdkError";
35
+ this.name = "BandSdkError";
36
36
  }
37
37
  };
38
- var UnsupportedFeatureError = class extends ThenvoiSdkError {
38
+ var UnsupportedFeatureError = class extends BandSdkError {
39
39
  constructor(message) {
40
40
  super(message);
41
41
  this.name = "UnsupportedFeatureError";
42
42
  }
43
43
  };
44
- var ValidationError = class extends ThenvoiSdkError {
44
+ var ValidationError = class extends BandSdkError {
45
45
  constructor(message, cause) {
46
46
  super(message, cause);
47
47
  this.name = "ValidationError";
@@ -224,6 +224,7 @@ function toNonNegativeInteger(value) {
224
224
  var DEFAULT_REQUEST_OPTIONS = {
225
225
  maxRetries: 3
226
226
  };
227
+ var MESSAGE_SEND_MAX_RETRIES = 2;
227
228
 
228
229
  // src/core/logger.ts
229
230
  var noop = () => void 0;
@@ -283,54 +284,16 @@ function normalizeContactRequestsResult(result) {
283
284
  }
284
285
 
285
286
  // src/client/rest/FernRestAdapter.ts
286
- function mergeOptions(options) {
287
+ function mergeOptions(options, maxRetries) {
287
288
  return {
288
289
  ...DEFAULT_REQUEST_OPTIONS,
290
+ ...maxRetries !== void 0 ? { maxRetries } : {},
289
291
  ...options
290
292
  };
291
293
  }
292
- var AGENT_ME_RETRY_LIMIT = 4;
293
- var AGENT_ME_RETRY_BASE_DELAY_MS = 2e3;
294
- var MESSAGE_SEND_RETRY_LIMIT = 3;
295
- var MESSAGE_SEND_RETRY_BASE_DELAY_MS = 500;
296
294
  function asMetadataMap2(value) {
297
295
  return asOptionalRecord(value);
298
296
  }
299
- function extractHttpStatus(error) {
300
- const record = asOptionalRecord(error);
301
- if (!record) {
302
- return void 0;
303
- }
304
- const response = asOptionalRecord(record.response);
305
- const status = record.statusCode ?? record.status ?? response?.statusCode ?? response?.status;
306
- return typeof status === "number" ? status : void 0;
307
- }
308
- function isFernRateLimitError(error) {
309
- return extractHttpStatus(error) === 429;
310
- }
311
- async function sleep(ms) {
312
- await new Promise((resolveDelay) => setTimeout(resolveDelay, ms));
313
- }
314
- function computeRetryDelayMs(baseDelayMs, attempt) {
315
- const backoff = baseDelayMs * 2 ** (attempt - 1);
316
- const jitter = Math.floor(Math.random() * Math.max(1, Math.floor(backoff / 4)));
317
- return backoff + jitter;
318
- }
319
- async function withRateLimitRetry(operation, options) {
320
- let lastError;
321
- for (let attempt = 1; attempt <= options.retryLimit; attempt += 1) {
322
- try {
323
- return await operation();
324
- } catch (error) {
325
- lastError = error;
326
- if (!isFernRateLimitError(error) || attempt === options.retryLimit) {
327
- throw error;
328
- }
329
- await sleep(computeRetryDelayMs(options.baseDelayMs, attempt));
330
- }
331
- }
332
- throw lastError instanceof Error ? lastError : new Error("Rate-limit retry exhausted without a terminal error.");
333
- }
334
297
  function requireNonEmptyStringField(value, field, source) {
335
298
  if (typeof value !== "string" || value.trim().length === 0) {
336
299
  throw new Error(`Invalid ${source} response: expected non-empty string AgentIdentity.${field}`);
@@ -538,28 +501,21 @@ var FernRestAdapter = class {
538
501
  this.client = client;
539
502
  }
540
503
  async getAgentMe(options) {
541
- return withRateLimitRetry(
542
- async () => {
543
- if (this.client.agentApiIdentity?.getAgentMe) {
544
- const response = await this.client.agentApiIdentity.getAgentMe(mergeOptions(options));
545
- return normalizeAgentIdentityEnvelope(response, "agentApiIdentity.getAgentMe");
546
- }
547
- const profileClient = this.client.myProfile ?? this.client.humanApiProfile;
548
- if (!profileClient?.getMyProfile) {
549
- throw new UnsupportedFeatureError(
550
- "Fern client missing agentApiIdentity.getAgentMe or humanApiProfile.getMyProfile"
551
- );
552
- }
553
- const profile = await profileClient.getMyProfile(mergeOptions(options));
554
- return normalizeLegacyProfileIdentity(
555
- normalizeLegacyProfileEnvelope(profile),
556
- "profile.getMyProfile"
557
- );
558
- },
559
- {
560
- retryLimit: AGENT_ME_RETRY_LIMIT,
561
- baseDelayMs: AGENT_ME_RETRY_BASE_DELAY_MS
562
- }
504
+ const requestOptions = mergeOptions(options);
505
+ if (this.client.agentApiIdentity?.getAgentMe) {
506
+ const response = await this.client.agentApiIdentity.getAgentMe(requestOptions);
507
+ return normalizeAgentIdentityEnvelope(response, "agentApiIdentity.getAgentMe");
508
+ }
509
+ const profileClient = this.client.myProfile ?? this.client.humanApiProfile;
510
+ if (!profileClient?.getMyProfile) {
511
+ throw new UnsupportedFeatureError(
512
+ "Fern client missing agentApiIdentity.getAgentMe or humanApiProfile.getMyProfile"
513
+ );
514
+ }
515
+ const profile = await profileClient.getMyProfile(requestOptions);
516
+ return normalizeLegacyProfileIdentity(
517
+ normalizeLegacyProfileEnvelope(profile),
518
+ "profile.getMyProfile"
563
519
  );
564
520
  }
565
521
  async createChatMessage(chatId, message, options) {
@@ -567,45 +523,33 @@ var FernRestAdapter = class {
567
523
  if (!api) {
568
524
  throw new UnsupportedFeatureError("Fern client missing chat message creation endpoint");
569
525
  }
570
- const response = await withRateLimitRetry(
571
- async () => await api(
572
- chatId,
573
- {
574
- message: {
575
- content: message.content,
576
- message_type: message.messageType,
577
- metadata: message.metadata,
578
- mentions: message.mentions
579
- }
580
- },
581
- mergeOptions(options)
582
- ),
526
+ const response = await api(
527
+ chatId,
583
528
  {
584
- retryLimit: MESSAGE_SEND_RETRY_LIMIT,
585
- baseDelayMs: MESSAGE_SEND_RETRY_BASE_DELAY_MS
586
- }
529
+ message: {
530
+ content: message.content,
531
+ message_type: message.messageType,
532
+ metadata: message.metadata,
533
+ mentions: message.mentions
534
+ }
535
+ },
536
+ mergeOptions(options, MESSAGE_SEND_MAX_RETRIES)
587
537
  );
588
538
  return normalizeToolOperationResult(response);
589
539
  }
590
540
  async createChatEvent(chatId, event, options) {
591
541
  const createAgentChatEvent = this.client.agentApiEvents?.createAgentChatEvent?.bind(this.client.agentApiEvents);
592
542
  if (createAgentChatEvent) {
593
- const response = await withRateLimitRetry(
594
- async () => await createAgentChatEvent(
595
- chatId,
596
- {
597
- event: {
598
- content: event.content,
599
- message_type: event.messageType,
600
- metadata: event.metadata
601
- }
602
- },
603
- mergeOptions(options)
604
- ),
543
+ const response = await createAgentChatEvent(
544
+ chatId,
605
545
  {
606
- retryLimit: MESSAGE_SEND_RETRY_LIMIT,
607
- baseDelayMs: MESSAGE_SEND_RETRY_BASE_DELAY_MS
608
- }
546
+ event: {
547
+ content: event.content,
548
+ message_type: event.messageType,
549
+ metadata: event.metadata
550
+ }
551
+ },
552
+ mergeOptions(options, MESSAGE_SEND_MAX_RETRIES)
609
553
  );
610
554
  return normalizeToolOperationResult(response);
611
555
  }
package/dist/rest.d.cts CHANGED
@@ -1,13 +1,13 @@
1
- import { R as RestApi, F as FernThenvoiClientLike, b as RestRequestOptions, A as AgentIdentity, C as ChatParticipant, c as PlatformChatMessage, P as PaginatedResponse } from './types-CSHFipIc.cjs';
2
- export { d as ChatMessageMention, D as DEFAULT_REQUEST_OPTIONS, a as PaginationMetadata } from './types-CSHFipIc.cjs';
3
- import { P as PaginationOptions } from './pagination-BPiys10t.cjs';
4
- export { f as fetchPaginated, n as normalizePaginationMetadata } from './pagination-BPiys10t.cjs';
1
+ import { R as RestApi, F as FernBandClientLike, b as RestRequestOptions, A as AgentIdentity, C as ChatParticipant, c as PlatformChatMessage, P as PaginatedResponse } from './types-BgYFd_Yw.cjs';
2
+ export { d as ChatMessageMention, D as DEFAULT_REQUEST_OPTIONS, a as PaginationMetadata } from './types-BgYFd_Yw.cjs';
3
+ import { P as PaginationOptions } from './pagination-DqdkQArT.cjs';
4
+ export { f as fetchPaginated, n as normalizePaginationMetadata } from './pagination-DqdkQArT.cjs';
5
5
  import { L as Logger } from './logger-CABQOnlR.cjs';
6
- import { M as MetadataMap, j as MentionReference, T as ToolOperationResult, d as PeerRecord, 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';
6
+ import { M as MetadataMap, j as MentionReference, T as ToolOperationResult, d as PeerRecord, 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-B8KU_q4d.cjs';
7
7
 
8
8
  declare class FernRestAdapter implements RestApi {
9
9
  private readonly client;
10
- constructor(client: FernThenvoiClientLike);
10
+ constructor(client: FernBandClientLike);
11
11
  getAgentMe(options?: RestRequestOptions): Promise<AgentIdentity>;
12
12
  createChatMessage(chatId: string, message: {
13
13
  content: string;
@@ -141,4 +141,4 @@ declare class RestFacade implements RestApi {
141
141
  private forward;
142
142
  }
143
143
 
144
- export { AgentIdentity, ChatParticipant, FernRestAdapter, FernThenvoiClientLike, PaginatedResponse, PlatformChatMessage, RestApi, RestFacade };
144
+ export { AgentIdentity, ChatParticipant, FernBandClientLike, FernRestAdapter, PaginatedResponse, PlatformChatMessage, RestApi, RestFacade };
package/dist/rest.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { R as RestApi, F as FernThenvoiClientLike, b as RestRequestOptions, A as AgentIdentity, C as ChatParticipant, c as PlatformChatMessage, P as PaginatedResponse } from './types-CxII3XkA.js';
2
- export { d as ChatMessageMention, D as DEFAULT_REQUEST_OPTIONS, a as PaginationMetadata } from './types-CxII3XkA.js';
3
- import { P as PaginationOptions } from './pagination-CcDkVFxK.js';
4
- export { f as fetchPaginated, n as normalizePaginationMetadata } from './pagination-CcDkVFxK.js';
1
+ import { R as RestApi, F as FernBandClientLike, b as RestRequestOptions, A as AgentIdentity, C as ChatParticipant, c as PlatformChatMessage, P as PaginatedResponse } from './types-BivGO7I9.js';
2
+ export { d as ChatMessageMention, D as DEFAULT_REQUEST_OPTIONS, a as PaginationMetadata } from './types-BivGO7I9.js';
3
+ import { P as PaginationOptions } from './pagination-BgEx-HeL.js';
4
+ export { f as fetchPaginated, n as normalizePaginationMetadata } from './pagination-BgEx-HeL.js';
5
5
  import { L as Logger } from './logger-CABQOnlR.js';
6
- import { M as MetadataMap, j as MentionReference, T as ToolOperationResult, d as PeerRecord, 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';
6
+ import { M as MetadataMap, j as MentionReference, T as ToolOperationResult, d as PeerRecord, 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-B8KU_q4d.js';
7
7
 
8
8
  declare class FernRestAdapter implements RestApi {
9
9
  private readonly client;
10
- constructor(client: FernThenvoiClientLike);
10
+ constructor(client: FernBandClientLike);
11
11
  getAgentMe(options?: RestRequestOptions): Promise<AgentIdentity>;
12
12
  createChatMessage(chatId: string, message: {
13
13
  content: string;
@@ -141,4 +141,4 @@ declare class RestFacade implements RestApi {
141
141
  private forward;
142
142
  }
143
143
 
144
- export { AgentIdentity, ChatParticipant, FernRestAdapter, FernThenvoiClientLike, PaginatedResponse, PlatformChatMessage, RestApi, RestFacade };
144
+ export { AgentIdentity, ChatParticipant, FernBandClientLike, FernRestAdapter, PaginatedResponse, PlatformChatMessage, RestApi, RestFacade };
package/dist/rest.js CHANGED
@@ -4,11 +4,11 @@ import {
4
4
  RestFacade,
5
5
  fetchPaginated,
6
6
  normalizePaginationMetadata
7
- } from "./chunk-SG4WLD2H.js";
7
+ } from "./chunk-EAI2M3WM.js";
8
8
  import "./chunk-ZZJRRBPQ.js";
9
9
  import "./chunk-3BKAC4OZ.js";
10
10
  import "./chunk-OD2G5LFQ.js";
11
- import "./chunk-YR3BOQNW.js";
11
+ import "./chunk-JY75VSQK.js";
12
12
  export {
13
13
  DEFAULT_REQUEST_OPTIONS,
14
14
  FernRestAdapter,