@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.
- package/README.md +372 -0
- package/dist/{ClaudeSDKAdapter-CRq4R-WB.d.cts → ClaudeSDKAdapter-BY4zEbCl.d.cts} +14 -10
- package/dist/{ClaudeSDKAdapter-BHOkjN3X.d.ts → ClaudeSDKAdapter-Cna5P1dR.d.ts} +14 -10
- package/dist/{acp-server-B1Da7L6u.d.ts → acp-server-CiUqN3G3.d.ts} +2 -2
- package/dist/{acp-server-BdRz9_UN.d.cts → acp-server-Dlj7D563.d.cts} +2 -2
- package/dist/adapters.cjs +734 -279
- package/dist/adapters.d.cts +21 -19
- package/dist/adapters.d.ts +21 -19
- package/dist/adapters.js +65 -44
- package/dist/backends-D-dBdDm-.d.ts +27 -0
- package/dist/backends-ZLxmQrTZ.d.cts +27 -0
- package/dist/{chunk-MSL6CWHY.js → chunk-4IAXZBXX.js} +77 -37
- package/dist/{chunk-SG4WLD2H.js → chunk-EAI2M3WM.js} +38 -94
- package/dist/{chunk-YR3BOQNW.js → chunk-JY75VSQK.js} +7 -7
- package/dist/{chunk-INA6YZTZ.js → chunk-LBWKISBS.js} +51 -31
- package/dist/{chunk-I5EZG52P.js → chunk-N2QTUMGO.js} +532 -327
- package/dist/{chunk-RHVH2GZR.js → chunk-NMZLX7TP.js} +110 -56
- package/dist/{chunk-EDPKUUJL.js → chunk-NT7TBFX2.js} +9 -1
- package/dist/{chunk-GVEQ3RAH.js → chunk-RV76SKFT.js} +169 -54
- package/dist/{chunk-W5NDZSYE.js → chunk-TLBCKDQO.js} +23 -23
- package/dist/chunk-US226AS4.js +130 -0
- package/dist/{chunk-IZPV6QS6.js → chunk-WL2HNJZ6.js} +38 -11
- package/dist/chunk-WLCM2OXG.js +181 -0
- package/dist/config.cjs +40 -13
- package/dist/config.d.cts +7 -1
- package/dist/config.d.ts +7 -1
- package/dist/config.js +2 -2
- package/dist/converters.cjs +491 -35
- package/dist/converters.d.cts +5 -5
- package/dist/converters.d.ts +5 -5
- package/dist/converters.js +4 -3
- package/dist/core.cjs +53 -10
- package/dist/core.d.cts +10 -9
- package/dist/core.d.ts +10 -9
- package/dist/core.js +8 -4
- package/dist/disconnectReason-IuADl6TH.d.cts +34 -0
- package/dist/disconnectReason-IuADl6TH.d.ts +34 -0
- package/dist/{dtos-DUpbIu8k.d.ts → dtos-B8KU_q4d.d.cts} +26 -6
- package/dist/{dtos-DUpbIu8k.d.cts → dtos-B8KU_q4d.d.ts} +26 -6
- package/dist/index.cjs +1510 -735
- package/dist/index.d.cts +18 -16
- package/dist/index.d.ts +18 -16
- package/dist/index.js +21 -13
- package/dist/linear.cjs +1044 -112
- package/dist/linear.d.cts +146 -16
- package/dist/linear.d.ts +146 -16
- package/dist/linear.js +1031 -110
- package/dist/mcp-claude.cjs +338 -66
- package/dist/mcp-claude.d.cts +3 -3
- package/dist/mcp-claude.d.ts +3 -3
- package/dist/mcp-claude.js +215 -16
- package/dist/mcp.cjs +414 -105
- package/dist/mcp.d.cts +29 -16
- package/dist/mcp.d.ts +29 -16
- package/dist/mcp.js +14 -14
- package/dist/{opencode-BBcDchcN.d.cts → opencode-2YdscIc1.d.cts} +5 -5
- package/dist/{opencode-DthQQUsZ.d.ts → opencode-Bld62x5t.d.ts} +5 -5
- package/dist/{pagination-CcDkVFxK.d.ts → pagination-BgEx-HeL.d.ts} +2 -2
- package/dist/{pagination-BPiys10t.d.cts → pagination-DqdkQArT.d.cts} +2 -2
- package/dist/{protocols-DrhzOH6K.d.ts → protocols-Bwwcql0h.d.ts} +1 -1
- package/dist/{protocols-CInhtFpA.d.cts → protocols-Bz1rxcUg.d.cts} +1 -1
- package/dist/rest.cjs +41 -97
- package/dist/rest.d.cts +7 -7
- package/dist/rest.d.ts +7 -7
- package/dist/rest.js +2 -2
- package/dist/runtime.cjs +998 -620
- package/dist/runtime.d.cts +22 -29
- package/dist/runtime.d.ts +22 -29
- package/dist/runtime.js +19 -67
- package/dist/{schemas-BpEBkq5V.d.cts → schemas-BotL3ZLH.d.cts} +51 -56
- package/dist/{schemas-vos1AaBc.d.ts → schemas-DBsC4J1g.d.ts} +51 -56
- package/dist/{sdk-CwTAxhwI.d.cts → sdk-BTciSLRQ.d.cts} +35 -5
- package/dist/{sdk-CcnQ5OUC.d.ts → sdk-qKJtMma_.d.ts} +35 -5
- package/dist/{simpleAdapter-9OE_p6QW.d.ts → simpleAdapter--wznuoOw.d.ts} +1 -1
- package/dist/{simpleAdapter-DqhvjsGr.d.cts → simpleAdapter-BpT4XbZC.d.cts} +1 -1
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/{types-7jVzOeOP.d.ts → types-BTN_ZETM.d.ts} +2 -2
- package/dist/{types-CxII3XkA.d.ts → types-BgYFd_Yw.d.cts} +5 -5
- package/dist/{types-CSHFipIc.d.cts → types-BivGO7I9.d.ts} +5 -5
- package/dist/{types-CovcHpYf.d.cts → types-D958TC71.d.cts} +2 -2
- package/package.json +25 -23
- package/dist/backends-CzDbiQar.d.ts +0 -20
- package/dist/backends-SVMT-7l4.d.cts +0 -20
- package/dist/chunk-SFVKOEQH.js +0 -103
package/dist/mcp.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import { M as McpToolRegistration } from './sdk-
|
|
3
|
-
export {
|
|
4
|
-
import { A as AdapterToolsProtocol } from './protocols-
|
|
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-
|
|
7
|
+
import './dtos-B8KU_q4d.cjs';
|
|
8
8
|
|
|
9
|
-
interface
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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:
|
|
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 {
|
|
110
|
+
export { BandMcpServer, type BandMcpServerOptions, BandMcpSseServer, type BandMcpSseServerOptions, BandMcpStdioServer, type BandMcpStdioServerOptions, McpToolRegistration };
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import { M as McpToolRegistration } from './sdk-
|
|
3
|
-
export {
|
|
4
|
-
import { A as AdapterToolsProtocol } from './protocols-
|
|
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-
|
|
7
|
+
import './dtos-B8KU_q4d.js';
|
|
8
8
|
|
|
9
|
-
interface
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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:
|
|
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 {
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
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-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-NT7TBFX2.js";
|
|
14
|
+
import "./chunk-RV76SKFT.js";
|
|
15
15
|
import "./chunk-3BKAC4OZ.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-JY75VSQK.js";
|
|
17
17
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
BandMcpServer,
|
|
19
|
+
BandMcpSseServer,
|
|
20
|
+
BandMcpStdioServer,
|
|
21
21
|
buildRoomScopedRegistrations,
|
|
22
22
|
buildSingleContextRegistrations,
|
|
23
|
-
|
|
23
|
+
createBandMcpBackend,
|
|
24
24
|
errorResult,
|
|
25
|
-
|
|
25
|
+
getBandSdkMcpServerConfig,
|
|
26
26
|
successResult
|
|
27
27
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HistoryConverter } from './protocols-
|
|
2
|
-
import { R as RestApi } from './types-
|
|
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
|
|
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
|
|
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
|
-
|
|
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-
|
|
2
|
-
import { R as RestApi } from './types-
|
|
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
|
|
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
|
|
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
|
-
|
|
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-
|
|
2
|
-
import { M as MetadataMap } from './dtos-
|
|
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-
|
|
2
|
-
import { M as MetadataMap } from './dtos-
|
|
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-
|
|
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-
|
|
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
|
|
32
|
+
var BandSdkError = class extends Error {
|
|
33
33
|
constructor(message, cause) {
|
|
34
34
|
super(message, cause !== void 0 ? { cause } : void 0);
|
|
35
|
-
this.name = "
|
|
35
|
+
this.name = "BandSdkError";
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
var UnsupportedFeatureError = class extends
|
|
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
|
|
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
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
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
|
|
571
|
-
|
|
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
|
-
|
|
585
|
-
|
|
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
|
|
594
|
-
|
|
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
|
-
|
|
607
|
-
|
|
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
|
|
2
|
-
export { d as ChatMessageMention, D as DEFAULT_REQUEST_OPTIONS, a as PaginationMetadata } from './types-
|
|
3
|
-
import { P as PaginationOptions } from './pagination-
|
|
4
|
-
export { f as fetchPaginated, n as normalizePaginationMetadata } from './pagination-
|
|
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-
|
|
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:
|
|
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,
|
|
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
|
|
2
|
-
export { d as ChatMessageMention, D as DEFAULT_REQUEST_OPTIONS, a as PaginationMetadata } from './types-
|
|
3
|
-
import { P as PaginationOptions } from './pagination-
|
|
4
|
-
export { f as fetchPaginated, n as normalizePaginationMetadata } from './pagination-
|
|
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-
|
|
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:
|
|
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,
|
|
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-
|
|
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-
|
|
11
|
+
import "./chunk-JY75VSQK.js";
|
|
12
12
|
export {
|
|
13
13
|
DEFAULT_REQUEST_OPTIONS,
|
|
14
14
|
FernRestAdapter,
|