@band-ai/sdk 0.3.4 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -1
- package/dist/{ClaudeSDKAdapter-CXud2DBE.d.ts → CopilotACPAdapter-B_AVyAl6.d.ts} +249 -19
- package/dist/{ClaudeSDKAdapter-Cx6zhSaG.d.cts → CopilotACPAdapter-Clid9xGR.d.cts} +249 -19
- package/dist/{opencode-2YdscIc1.d.cts → acp-client-D-I_5lK-.d.cts} +23 -4
- package/dist/{opencode-Bld62x5t.d.ts → acp-client-DUXyczlF.d.ts} +23 -4
- package/dist/acp-server-BlcYMxKt.d.ts +17 -0
- package/dist/acp-server-CJhclo6P.d.cts +17 -0
- package/dist/adapters.cjs +2257 -969
- package/dist/adapters.d.cts +21 -132
- package/dist/adapters.d.ts +21 -132
- package/dist/adapters.js +26 -1922
- package/dist/{backends-D-dBdDm-.d.ts → backends-CgsPQa9B.d.ts} +2 -2
- package/dist/{backends-ZLxmQrTZ.d.cts → backends-Dh2WXcHQ.d.cts} +2 -2
- package/dist/{chunk-JY75VSQK.js → chunk-4OVNFDD7.js} +14 -1
- package/dist/chunk-6BE2EG5P.js +128 -0
- package/dist/{chunk-U6AFCLYZ.js → chunk-6TGXV5TE.js} +1824 -514
- package/dist/{chunk-OH6VVVKT.js → chunk-CBCHTTUY.js} +10 -0
- package/dist/{chunk-K5KAEYPF.js → chunk-HNWZZXAE.js} +288 -120
- package/dist/chunk-I34SXMTJ.js +6 -0
- package/dist/{chunk-XWHWJP4I.js → chunk-JDW5WSGF.js} +2 -2
- package/dist/{chunk-KXJ74J73.js → chunk-JIZE4EC6.js} +4 -10
- package/dist/chunk-OGOXY43L.js +119 -0
- package/dist/{chunk-W5IAI6Z4.js → chunk-OVXVZUPO.js} +5 -5
- package/dist/{chunk-YJ42AZO4.js → chunk-RJNJUISR.js} +5 -2
- package/dist/{chunk-MQY74R7D.js → chunk-SHZBLLDQ.js} +21 -9
- package/dist/{chunk-JADCAMZY.js → chunk-TGDDFBYS.js} +45 -0
- package/dist/{chunk-US226AS4.js → chunk-UENIC5FJ.js} +14 -11
- package/dist/{chunk-MQBBWYRP.js → chunk-UFO6XMCV.js} +3404 -572
- package/dist/{chunk-WA7CHXUS.js → chunk-UL3Y5C4J.js} +2 -2
- package/dist/{chunk-WL2HNJZ6.js → chunk-VOMJRQOM.js} +3 -3
- package/dist/{chunk-OD2G5LFQ.js → chunk-ZYOXI4JL.js} +41 -2
- package/dist/config.cjs +2 -12
- package/dist/config.js +2 -2
- package/dist/converters.cjs +36 -11
- package/dist/converters.d.cts +7 -5
- package/dist/converters.d.ts +7 -5
- package/dist/converters.js +11 -13
- package/dist/core.cjs +239 -5
- package/dist/core.d.cts +71 -6
- package/dist/core.d.ts +71 -6
- package/dist/core.js +31 -6
- package/dist/{customTools-BzF0IISO.d.cts → customTools-Bfecd0mJ.d.cts} +1 -1
- package/dist/{customTools-BzF0IISO.d.ts → customTools-Bfecd0mJ.d.ts} +1 -1
- package/dist/{disconnectReason-IuADl6TH.d.ts → disconnectReason-Cctmg1SN.d.cts} +1 -1
- package/dist/{disconnectReason-IuADl6TH.d.cts → disconnectReason-Cctmg1SN.d.ts} +1 -1
- package/dist/{dtos-B8KU_q4d.d.ts → dtos-CjQsN1_h.d.cts} +5 -12
- package/dist/{dtos-B8KU_q4d.d.cts → dtos-CjQsN1_h.d.ts} +5 -12
- package/dist/index.cjs +5289 -1474
- package/dist/index.d.cts +61 -22
- package/dist/index.d.ts +61 -22
- package/dist/index.js +151 -43
- package/dist/linear.cjs +45 -7
- package/dist/linear.d.cts +4 -3
- package/dist/linear.d.ts +4 -3
- package/dist/linear.js +10 -10
- package/dist/mcp-claude.cjs +11 -6
- package/dist/mcp-claude.d.cts +4 -3
- package/dist/mcp-claude.d.ts +4 -3
- package/dist/mcp-claude.js +4 -5
- package/dist/mcp.cjs +13 -7
- package/dist/mcp.d.cts +6 -5
- package/dist/mcp.d.ts +6 -5
- package/dist/mcp.js +5 -6
- package/dist/{pagination-DqdkQArT.d.cts → pagination-BZDhB_nO.d.cts} +2 -2
- package/dist/{pagination-BgEx-HeL.d.ts → pagination-CPz0J_vQ.d.ts} +2 -2
- package/dist/{protocols-Bz1rxcUg.d.cts → protocols-CabgO52c.d.cts} +38 -3
- package/dist/{protocols-Bwwcql0h.d.ts → protocols-Dpci6uae.d.ts} +38 -3
- package/dist/rest.cjs +43 -1
- package/dist/rest.d.cts +6 -5
- package/dist/rest.d.ts +6 -5
- package/dist/rest.js +6 -5
- package/dist/runtime.cjs +2113 -597
- package/dist/runtime.d.cts +44 -25
- package/dist/runtime.d.ts +44 -25
- package/dist/runtime.js +11 -11
- package/dist/{schemas-BgJhlqqO.d.cts → schemas-BKnh4fKR.d.cts} +209 -24
- package/dist/{schemas-C4mK1WSs.d.ts → schemas-CDa3V_I5.d.ts} +209 -24
- package/dist/{sdk-BTciSLRQ.d.cts → sdk-CXNqzoY1.d.cts} +1 -1
- package/dist/{sdk-qKJtMma_.d.ts → sdk-Cin80BTC.d.ts} +1 -1
- package/dist/{simpleAdapter-BpT4XbZC.d.cts → simpleAdapter-D75rcz9n.d.cts} +3 -1
- package/dist/{simpleAdapter--wznuoOw.d.ts → simpleAdapter-eLvsAQNo.d.ts} +3 -1
- package/dist/testing.cjs +25 -7
- package/dist/testing.d.cts +5 -3
- package/dist/testing.d.ts +5 -3
- package/dist/testing.js +9 -6
- package/dist/{types-BivGO7I9.d.ts → types-42-HWeX8.d.cts} +10 -4
- package/dist/types-CKU1N0SK.d.ts +137 -0
- package/dist/{types-BgYFd_Yw.d.cts → types-CjxZekMH.d.ts} +10 -4
- package/dist/types-DtcOLALn.d.cts +137 -0
- package/package.json +25 -26
- package/dist/acp-server-CiUqN3G3.d.ts +0 -24
- package/dist/acp-server-Dlj7D563.d.cts +0 -24
- package/dist/chunk-AVVDPXP4.js +0 -39
- package/dist/chunk-F63TPOI3.js +0 -29
- package/dist/chunk-V5TSWS7P.js +0 -62
- package/dist/types-BNNtOXu3.d.cts +0 -446
- package/dist/types-DFUtpxah.d.ts +0 -446
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AdapterToolsProtocol } from './protocols-
|
|
2
|
-
import { M as McpToolRegistration, B as BandSdkMcpServer } from './sdk-
|
|
1
|
+
import { A as AdapterToolsProtocol } from './protocols-Dpci6uae.js';
|
|
2
|
+
import { M as McpToolRegistration, B as BandSdkMcpServer } from './sdk-Cin80BTC.js';
|
|
3
3
|
|
|
4
4
|
type BandMcpBackendKind = "sdk" | "http" | "sse" | "stdio";
|
|
5
5
|
interface BandMcpBackend {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AdapterToolsProtocol } from './protocols-
|
|
2
|
-
import { M as McpToolRegistration, B as BandSdkMcpServer } from './sdk-
|
|
1
|
+
import { A as AdapterToolsProtocol } from './protocols-CabgO52c.cjs';
|
|
2
|
+
import { M as McpToolRegistration, B as BandSdkMcpServer } from './sdk-CXNqzoY1.cjs';
|
|
3
3
|
|
|
4
4
|
type BandMcpBackendKind = "sdk" | "http" | "sse" | "stdio";
|
|
5
5
|
interface BandMcpBackend {
|
|
@@ -29,11 +29,24 @@ var RuntimeStateError = class extends BandSdkError {
|
|
|
29
29
|
this.name = "RuntimeStateError";
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
+
var RecoverableTurnError = class extends BandSdkError {
|
|
33
|
+
constructor(message, cause) {
|
|
34
|
+
super(message, cause);
|
|
35
|
+
this.name = "RecoverableTurnError";
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
function rethrowIfRecoverableTurnFailure(error) {
|
|
39
|
+
if (error instanceof RecoverableTurnError) {
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
32
43
|
|
|
33
44
|
export {
|
|
34
45
|
BandSdkError,
|
|
35
46
|
UnsupportedFeatureError,
|
|
36
47
|
ValidationError,
|
|
37
48
|
TransportError,
|
|
38
|
-
RuntimeStateError
|
|
49
|
+
RuntimeStateError,
|
|
50
|
+
RecoverableTurnError,
|
|
51
|
+
rethrowIfRecoverableTurnFailure
|
|
39
52
|
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// src/core/coercion.ts
|
|
2
|
+
var MAX_ERROR_CAUSE_DEPTH = 5;
|
|
3
|
+
var MAX_ERROR_DETAIL_LENGTH = 500;
|
|
4
|
+
var LENGTH_TRUNCATED_MARKER = "... (truncated)";
|
|
5
|
+
var DEPTH_TRUNCATED_MARKER = "... (cause chain truncated)";
|
|
6
|
+
function asOptionalRecord(value) {
|
|
7
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
8
|
+
return void 0;
|
|
9
|
+
}
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
function asNonEmptyString(value) {
|
|
13
|
+
if (typeof value !== "string") {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const trimmed = value.trim();
|
|
17
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
18
|
+
}
|
|
19
|
+
function toDisplayText(value) {
|
|
20
|
+
if (typeof value === "string") {
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
if (value == null) {
|
|
24
|
+
return "";
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const json = JSON.stringify(value);
|
|
28
|
+
return typeof json === "string" ? json : String(value);
|
|
29
|
+
} catch {
|
|
30
|
+
return String(value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function asErrorMessage(error) {
|
|
34
|
+
return formatCaughtError(error, 0);
|
|
35
|
+
}
|
|
36
|
+
function formatCaughtError(error, depth) {
|
|
37
|
+
if (typeof error !== "object" || error === null) {
|
|
38
|
+
return truncate(String(error));
|
|
39
|
+
}
|
|
40
|
+
const message = truncate(asNestedMessage(error) ?? String(error));
|
|
41
|
+
const detail = selectDetail(asOptionalRecord(error));
|
|
42
|
+
if (detail === void 0) {
|
|
43
|
+
return message;
|
|
44
|
+
}
|
|
45
|
+
if (depth >= MAX_ERROR_CAUSE_DEPTH) {
|
|
46
|
+
return `${message} (${DEPTH_TRUNCATED_MARKER})`;
|
|
47
|
+
}
|
|
48
|
+
return `${message} (${formatErrorDetail(detail, depth + 1)})`;
|
|
49
|
+
}
|
|
50
|
+
function selectDetail(record) {
|
|
51
|
+
if (isPresentDetail(record?.data)) {
|
|
52
|
+
return record?.data;
|
|
53
|
+
}
|
|
54
|
+
if (isPresentDetail(record?.cause)) {
|
|
55
|
+
return record?.cause;
|
|
56
|
+
}
|
|
57
|
+
return void 0;
|
|
58
|
+
}
|
|
59
|
+
function isPresentDetail(value) {
|
|
60
|
+
if (value === void 0 || value === null) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
if (typeof value === "string") {
|
|
64
|
+
return asNonEmptyString(value) !== null;
|
|
65
|
+
}
|
|
66
|
+
if (value instanceof Error) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
if (Array.isArray(value)) {
|
|
70
|
+
return value.length > 0;
|
|
71
|
+
}
|
|
72
|
+
if (typeof value === "object") {
|
|
73
|
+
return isPlainObject(value) ? Object.keys(value).length > 0 : true;
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
function isPlainObject(value) {
|
|
78
|
+
const proto = Object.getPrototypeOf(value);
|
|
79
|
+
return proto === Object.prototype || proto === null;
|
|
80
|
+
}
|
|
81
|
+
function formatErrorDetail(detail, depth) {
|
|
82
|
+
if (detail instanceof Error || selectDetail(asOptionalRecord(detail)) !== void 0) {
|
|
83
|
+
return formatCaughtError(detail, depth);
|
|
84
|
+
}
|
|
85
|
+
return truncate(formatLeafDetail(detail));
|
|
86
|
+
}
|
|
87
|
+
function formatLeafDetail(detail) {
|
|
88
|
+
if (typeof detail === "string") {
|
|
89
|
+
return detail;
|
|
90
|
+
}
|
|
91
|
+
if (typeof detail === "number" && !Number.isFinite(detail)) {
|
|
92
|
+
return String(detail);
|
|
93
|
+
}
|
|
94
|
+
const builtin = formatNonEnumerableDetail(detail);
|
|
95
|
+
if (builtin !== null) {
|
|
96
|
+
return builtin;
|
|
97
|
+
}
|
|
98
|
+
const nested = asNestedMessage(detail);
|
|
99
|
+
if (nested !== null) {
|
|
100
|
+
return nested;
|
|
101
|
+
}
|
|
102
|
+
return toDisplayText(detail);
|
|
103
|
+
}
|
|
104
|
+
function formatNonEnumerableDetail(detail) {
|
|
105
|
+
if (detail instanceof RegExp) {
|
|
106
|
+
return detail.toString();
|
|
107
|
+
}
|
|
108
|
+
if (detail instanceof Map) {
|
|
109
|
+
return `Map ${toDisplayText([...detail])}`;
|
|
110
|
+
}
|
|
111
|
+
if (detail instanceof Set) {
|
|
112
|
+
return `Set ${toDisplayText([...detail])}`;
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
function truncate(text) {
|
|
117
|
+
return text.length > MAX_ERROR_DETAIL_LENGTH ? `${text.slice(0, MAX_ERROR_DETAIL_LENGTH)}${LENGTH_TRUNCATED_MARKER}` : text;
|
|
118
|
+
}
|
|
119
|
+
function asNestedMessage(value) {
|
|
120
|
+
const record = asOptionalRecord(value);
|
|
121
|
+
return asNonEmptyString(record?.message);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
asErrorMessage,
|
|
126
|
+
truncate,
|
|
127
|
+
asNestedMessage
|
|
128
|
+
};
|