@band-ai/sdk 0.3.4 → 0.4.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 (97) hide show
  1. package/README.md +54 -1
  2. package/dist/{ClaudeSDKAdapter-CXud2DBE.d.ts → CopilotACPAdapter-BCpbHFB0.d.ts} +240 -19
  3. package/dist/{ClaudeSDKAdapter-Cx6zhSaG.d.cts → CopilotACPAdapter-D4VWg8lJ.d.cts} +240 -19
  4. package/dist/{opencode-2YdscIc1.d.cts → acp-client-D-I_5lK-.d.cts} +23 -4
  5. package/dist/{opencode-Bld62x5t.d.ts → acp-client-DUXyczlF.d.ts} +23 -4
  6. package/dist/acp-server-BlcYMxKt.d.ts +17 -0
  7. package/dist/acp-server-CJhclo6P.d.cts +17 -0
  8. package/dist/adapters.cjs +2205 -969
  9. package/dist/adapters.d.cts +21 -132
  10. package/dist/adapters.d.ts +21 -132
  11. package/dist/adapters.js +26 -1922
  12. package/dist/{backends-D-dBdDm-.d.ts → backends-CgsPQa9B.d.ts} +2 -2
  13. package/dist/{backends-ZLxmQrTZ.d.cts → backends-Dh2WXcHQ.d.cts} +2 -2
  14. package/dist/{chunk-JY75VSQK.js → chunk-4OVNFDD7.js} +14 -1
  15. package/dist/chunk-6BE2EG5P.js +128 -0
  16. package/dist/{chunk-U6AFCLYZ.js → chunk-6TGXV5TE.js} +1824 -514
  17. package/dist/{chunk-OH6VVVKT.js → chunk-CBCHTTUY.js} +10 -0
  18. package/dist/{chunk-K5KAEYPF.js → chunk-HNWZZXAE.js} +288 -120
  19. package/dist/chunk-I34SXMTJ.js +6 -0
  20. package/dist/{chunk-XWHWJP4I.js → chunk-JDW5WSGF.js} +2 -2
  21. package/dist/{chunk-KXJ74J73.js → chunk-JIZE4EC6.js} +4 -10
  22. package/dist/chunk-OGOXY43L.js +119 -0
  23. package/dist/{chunk-W5IAI6Z4.js → chunk-OVXVZUPO.js} +5 -5
  24. package/dist/{chunk-YJ42AZO4.js → chunk-RJNJUISR.js} +5 -2
  25. package/dist/{chunk-MQY74R7D.js → chunk-SHZBLLDQ.js} +21 -9
  26. package/dist/{chunk-JADCAMZY.js → chunk-TGDDFBYS.js} +45 -0
  27. package/dist/{chunk-US226AS4.js → chunk-UENIC5FJ.js} +14 -11
  28. package/dist/{chunk-WA7CHXUS.js → chunk-UL3Y5C4J.js} +2 -2
  29. package/dist/{chunk-WL2HNJZ6.js → chunk-VOMJRQOM.js} +3 -3
  30. package/dist/{chunk-MQBBWYRP.js → chunk-YF7K4UB3.js} +3352 -572
  31. package/dist/{chunk-OD2G5LFQ.js → chunk-ZYOXI4JL.js} +41 -2
  32. package/dist/config.cjs +2 -12
  33. package/dist/config.js +2 -2
  34. package/dist/converters.cjs +36 -11
  35. package/dist/converters.d.cts +7 -5
  36. package/dist/converters.d.ts +7 -5
  37. package/dist/converters.js +11 -13
  38. package/dist/core.cjs +239 -5
  39. package/dist/core.d.cts +71 -6
  40. package/dist/core.d.ts +71 -6
  41. package/dist/core.js +31 -6
  42. package/dist/{customTools-BzF0IISO.d.cts → customTools-Bfecd0mJ.d.cts} +1 -1
  43. package/dist/{customTools-BzF0IISO.d.ts → customTools-Bfecd0mJ.d.ts} +1 -1
  44. package/dist/{disconnectReason-IuADl6TH.d.ts → disconnectReason-Cctmg1SN.d.cts} +1 -1
  45. package/dist/{disconnectReason-IuADl6TH.d.cts → disconnectReason-Cctmg1SN.d.ts} +1 -1
  46. package/dist/{dtos-B8KU_q4d.d.ts → dtos-CjQsN1_h.d.cts} +5 -12
  47. package/dist/{dtos-B8KU_q4d.d.cts → dtos-CjQsN1_h.d.ts} +5 -12
  48. package/dist/index.cjs +5237 -1474
  49. package/dist/index.d.cts +61 -22
  50. package/dist/index.d.ts +61 -22
  51. package/dist/index.js +151 -43
  52. package/dist/linear.cjs +45 -7
  53. package/dist/linear.d.cts +4 -3
  54. package/dist/linear.d.ts +4 -3
  55. package/dist/linear.js +10 -10
  56. package/dist/mcp-claude.cjs +11 -6
  57. package/dist/mcp-claude.d.cts +4 -3
  58. package/dist/mcp-claude.d.ts +4 -3
  59. package/dist/mcp-claude.js +4 -5
  60. package/dist/mcp.cjs +13 -7
  61. package/dist/mcp.d.cts +6 -5
  62. package/dist/mcp.d.ts +6 -5
  63. package/dist/mcp.js +5 -6
  64. package/dist/{pagination-DqdkQArT.d.cts → pagination-BZDhB_nO.d.cts} +2 -2
  65. package/dist/{pagination-BgEx-HeL.d.ts → pagination-CPz0J_vQ.d.ts} +2 -2
  66. package/dist/{protocols-Bz1rxcUg.d.cts → protocols-CabgO52c.d.cts} +38 -3
  67. package/dist/{protocols-Bwwcql0h.d.ts → protocols-Dpci6uae.d.ts} +38 -3
  68. package/dist/rest.cjs +43 -1
  69. package/dist/rest.d.cts +6 -5
  70. package/dist/rest.d.ts +6 -5
  71. package/dist/rest.js +6 -5
  72. package/dist/runtime.cjs +2113 -597
  73. package/dist/runtime.d.cts +44 -25
  74. package/dist/runtime.d.ts +44 -25
  75. package/dist/runtime.js +11 -11
  76. package/dist/{schemas-BgJhlqqO.d.cts → schemas-BKnh4fKR.d.cts} +209 -24
  77. package/dist/{schemas-C4mK1WSs.d.ts → schemas-CDa3V_I5.d.ts} +209 -24
  78. package/dist/{sdk-BTciSLRQ.d.cts → sdk-CXNqzoY1.d.cts} +1 -1
  79. package/dist/{sdk-qKJtMma_.d.ts → sdk-Cin80BTC.d.ts} +1 -1
  80. package/dist/{simpleAdapter-BpT4XbZC.d.cts → simpleAdapter-D75rcz9n.d.cts} +3 -1
  81. package/dist/{simpleAdapter--wznuoOw.d.ts → simpleAdapter-eLvsAQNo.d.ts} +3 -1
  82. package/dist/testing.cjs +25 -7
  83. package/dist/testing.d.cts +5 -3
  84. package/dist/testing.d.ts +5 -3
  85. package/dist/testing.js +9 -6
  86. package/dist/{types-BivGO7I9.d.ts → types-42-HWeX8.d.cts} +10 -4
  87. package/dist/types-CKU1N0SK.d.ts +137 -0
  88. package/dist/{types-BgYFd_Yw.d.cts → types-CjxZekMH.d.ts} +10 -4
  89. package/dist/types-DtcOLALn.d.cts +137 -0
  90. package/package.json +25 -26
  91. package/dist/acp-server-CiUqN3G3.d.ts +0 -24
  92. package/dist/acp-server-Dlj7D563.d.cts +0 -24
  93. package/dist/chunk-AVVDPXP4.js +0 -39
  94. package/dist/chunk-F63TPOI3.js +0 -29
  95. package/dist/chunk-V5TSWS7P.js +0 -62
  96. package/dist/types-BNNtOXu3.d.cts +0 -446
  97. package/dist/types-DFUtpxah.d.ts +0 -446
package/dist/linear.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { LinearClient, LinearDocument } from '@linear/sdk';
2
- import { R as RestApi } from './types-BivGO7I9.js';
2
+ import { R as RestApi } from './types-CjxZekMH.js';
3
3
  import { AppUserNotificationWebhookPayloadWithNotification, AgentSessionEventWebhookPayload, AppUserTeamAccessChangedWebhookPayload, OAuthAppWebhookPayload } from '@linear/sdk/webhooks';
4
4
  import { L as Logger } from './logger-CABQOnlR.js';
5
- import { C as CustomToolDef } from './customTools-BzF0IISO.js';
5
+ import { C as CustomToolDef } from './customTools-Bfecd0mJ.js';
6
6
  import { IncomingMessage, ServerResponse } from 'node:http';
7
- import './dtos-B8KU_q4d.js';
7
+ import './dtos-CjQsN1_h.js';
8
+ import '@band-ai/band-sdk-core';
8
9
  import 'zod';
9
10
 
10
11
  interface CandidateRepositoryInput {
package/dist/linear.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
- NoopLogger
3
- } from "./chunk-OD2G5LFQ.js";
2
+ resolveLogger
3
+ } from "./chunk-ZYOXI4JL.js";
4
4
  import {
5
5
  UnsupportedFeatureError
6
- } from "./chunk-JY75VSQK.js";
6
+ } from "./chunk-4OVNFDD7.js";
7
7
 
8
8
  // src/integrations/linear/bridge/handler.ts
9
9
  import { LinearDocument as L2 } from "@linear/sdk";
@@ -128,7 +128,7 @@ var StaleSessionGuard = class {
128
128
  constructor(options) {
129
129
  this.store = options.store;
130
130
  this.linearClient = options.linearClient;
131
- this.logger = options.logger ?? new NoopLogger();
131
+ this.logger = resolveLogger(options.logger);
132
132
  this.checkIntervalMs = options.checkIntervalMs ?? STALE_SESSION_CHECK_INTERVAL_MS;
133
133
  this.staleThresholdMs = options.staleThresholdMs ?? STALE_SESSION_THRESHOLD_MS;
134
134
  this.keepAliveMessage = options.keepAliveMessage ?? DEFAULT_KEEPALIVE_MESSAGE;
@@ -439,7 +439,7 @@ function getAgentSessionEventKey(payload) {
439
439
  ].join(":");
440
440
  }
441
441
  async function handleAgentSessionEvent(input, options) {
442
- const logger = input.deps.logger ?? new NoopLogger();
442
+ const logger = resolveLogger(input.deps.logger);
443
443
  const config = normalizeConfig(input.config);
444
444
  const action = normalizeAction(input.payload.action);
445
445
  const runtime = options?.runtime ?? createLinearBridgeRuntime();
@@ -1830,9 +1830,9 @@ function createLinearTools(options) {
1830
1830
  session_id: z.string().describe("The Linear agent session ID"),
1831
1831
  body: z.string().describe("The message body in Markdown format")
1832
1832
  });
1833
- const issueIdInputSchema = z.object({
1833
+ const issueIdInputSchema = z.looseObject({
1834
1834
  issue_id: z.string().optional().describe("The Linear issue ID (UUID) from the session context")
1835
- }).passthrough();
1835
+ });
1836
1836
  const issueCommentLimitSchema = z.number().int().min(1).max(50).optional().describe("Maximum number of recent comments to return");
1837
1837
  const requiredIssueIdSchema = issueIdInputSchema;
1838
1838
  const optionalIssueIdSchema = issueIdInputSchema;
@@ -2526,7 +2526,7 @@ import {
2526
2526
  var DISPATCH_RETRY_LIMIT = 2;
2527
2527
  var DISPATCH_RETRY_BASE_DELAY_MS = 1e3;
2528
2528
  function createInlineLinearBridgeDispatcher(options) {
2529
- const logger = options?.logger ?? new NoopLogger();
2529
+ const logger = resolveLogger(options?.logger);
2530
2530
  const runtime = createLinearBridgeRuntime();
2531
2531
  return {
2532
2532
  dispatch: async (job) => {
@@ -2568,7 +2568,7 @@ function createInlineLinearBridgeDispatcher(options) {
2568
2568
  };
2569
2569
  }
2570
2570
  function createInProcessLinearBridgeDispatcher(options) {
2571
- const logger = options?.logger ?? new NoopLogger();
2571
+ const logger = resolveLogger(options?.logger);
2572
2572
  const runtime = createLinearBridgeRuntime();
2573
2573
  const queued = /* @__PURE__ */ new Set();
2574
2574
  const inFlight = /* @__PURE__ */ new Set();
@@ -2650,7 +2650,7 @@ function createInProcessLinearBridgeDispatcher(options) {
2650
2650
  };
2651
2651
  }
2652
2652
  function createLinearWebhookHandler(options) {
2653
- const logger = options.deps.logger ?? new NoopLogger();
2653
+ const logger = resolveLogger(options.deps.logger);
2654
2654
  const runtime = createLinearBridgeRuntime();
2655
2655
  const dispatcher = options.dispatcher ?? createInlineLinearBridgeDispatcher({ logger });
2656
2656
  const webhookClient = new LinearWebhookClient(options.config.linearWebhookSecret);
@@ -31,6 +31,7 @@ var CHAT_EVENT_TYPES = ["tool_call", "tool_result", "thought", "error", "task"];
31
31
  var CHAT_MESSAGE_TYPES = ["text", ...CHAT_EVENT_TYPES];
32
32
 
33
33
  // src/contracts/memory.ts
34
+ var import_band_sdk_core = require("@band-ai/band-sdk-core");
34
35
  var SENSORY_MEMORY_TYPES = [
35
36
  "iconic",
36
37
  // Visual input
@@ -74,18 +75,22 @@ var MEMORY_SEGMENTS = [
74
75
  // Behavioral rules or policies
75
76
  ];
76
77
  var MEMORY_STORE_SCOPES = [
78
+ "agent",
79
+ // Private to the storing agent; omit subject_id
77
80
  "subject",
78
81
  // About one person/agent; requires subject_id
79
82
  "organization"
80
83
  // Shared org-wide
81
84
  ];
82
85
  var MEMORY_LIST_SCOPES = [
86
+ "agent",
87
+ // Caller's private agent-scoped memories only
83
88
  "subject",
84
89
  // Subject-scoped memories only
85
90
  "organization",
86
91
  // Organization-scoped memories only
87
92
  "all"
88
- // Both scopes (no scope filter)
93
+ // All scopes (no scope filter)
89
94
  ];
90
95
  var MEMORY_STATUSES = [
91
96
  "active",
@@ -281,7 +286,7 @@ var TOOL_MODELS = {
281
286
  required: ["action"]
282
287
  },
283
288
  band_list_memories: {
284
- description: "List memories accessible to the agent. Returns memories about the specified subject (cross-agent sharing) and organization-wide shared memories.",
289
+ description: `List memories accessible to the agent. Use scope="agent" for the caller's private memories, scope="subject" for memories about a specific person or agent, and scope="organization" for org-wide shared memories. Omit scope or use scope="all" to search across scopes.`,
285
290
  properties: {
286
291
  subject_id: {
287
292
  type: "string",
@@ -290,7 +295,7 @@ var TOOL_MODELS = {
290
295
  scope: {
291
296
  type: "string",
292
297
  enum: [...MEMORY_LIST_SCOPES],
293
- description: "Filter by scope."
298
+ description: `Filter by scope. "agent" returns the caller's private memories; "subject" and "organization" filter to those audiences; "all" omits the filter.`
294
299
  },
295
300
  system: {
296
301
  type: "string",
@@ -326,7 +331,7 @@ var TOOL_MODELS = {
326
331
  required: []
327
332
  },
328
333
  band_store_memory: {
329
- description: "Store a new memory entry. The memory will be associated with the authenticated agent as the source. For subject-scoped memories, provide a subject_id. For organization-scoped memories, omit subject_id.",
334
+ description: 'Store a new memory entry. The memory will be associated with the authenticated agent as the source. Use scope="agent" for information private to this agent (no subject_id). Use scope="subject" with a subject_id for memories about a specific person or agent. Use scope="organization" for knowledge genuinely shared across the organization.',
330
335
  properties: {
331
336
  content: {
332
337
  type: "string",
@@ -354,11 +359,11 @@ var TOOL_MODELS = {
354
359
  scope: {
355
360
  type: "string",
356
361
  enum: [...MEMORY_STORE_SCOPES],
357
- description: "Visibility scope."
362
+ description: 'Visibility scope. "agent" is private to this agent; "subject" requires subject_id; "organization" is shared org-wide.'
358
363
  },
359
364
  subject_id: {
360
365
  type: "string",
361
- description: "UUID of the subject this memory is about (required for subject scope)."
366
+ description: "UUID of the subject this memory is about (required for subject scope; omit for agent scope)."
362
367
  },
363
368
  metadata: {
364
369
  type: "object",
@@ -1,4 +1,5 @@
1
1
  import '@anthropic-ai/claude-agent-sdk';
2
- import './protocols-Bz1rxcUg.cjs';
3
- export { B as BandSdkMcpServer, C as CreateBandSdkMcpServerOptions, G as GetSystemPromptContextOptions, g as GetSystemPromptContextResult, h as createBandSdkMcpServer } from './sdk-BTciSLRQ.cjs';
4
- import './dtos-B8KU_q4d.cjs';
2
+ import './protocols-CabgO52c.cjs';
3
+ export { B as BandSdkMcpServer, C as CreateBandSdkMcpServerOptions, G as GetSystemPromptContextOptions, g as GetSystemPromptContextResult, h as createBandSdkMcpServer } from './sdk-CXNqzoY1.cjs';
4
+ import '@band-ai/band-sdk-core';
5
+ import './dtos-CjQsN1_h.cjs';
@@ -1,4 +1,5 @@
1
1
  import '@anthropic-ai/claude-agent-sdk';
2
- import './protocols-Bwwcql0h.js';
3
- export { B as BandSdkMcpServer, C as CreateBandSdkMcpServerOptions, G as GetSystemPromptContextOptions, g as GetSystemPromptContextResult, h as createBandSdkMcpServer } from './sdk-qKJtMma_.js';
4
- import './dtos-B8KU_q4d.js';
2
+ import './protocols-Dpci6uae.js';
3
+ export { B as BandSdkMcpServer, C as CreateBandSdkMcpServerOptions, G as GetSystemPromptContextOptions, g as GetSystemPromptContextResult, h as createBandSdkMcpServer } from './sdk-Cin80BTC.js';
4
+ import '@band-ai/band-sdk-core';
5
+ import './dtos-CjQsN1_h.js';
@@ -3,14 +3,13 @@ import {
3
3
  buildSingleContextRegistrations,
4
4
  buildZodShape,
5
5
  resolveSingleRoomTools
6
- } from "./chunk-XWHWJP4I.js";
6
+ } from "./chunk-JDW5WSGF.js";
7
7
  import {
8
8
  MCP_SERVER_NAME,
9
9
  mcpToolNames
10
- } from "./chunk-MQY74R7D.js";
11
- import "./chunk-F63TPOI3.js";
12
- import "./chunk-JADCAMZY.js";
13
- import "./chunk-JY75VSQK.js";
10
+ } from "./chunk-SHZBLLDQ.js";
11
+ import "./chunk-TGDDFBYS.js";
12
+ import "./chunk-4OVNFDD7.js";
14
13
 
15
14
  // src/mcp/sdk.ts
16
15
  import {
package/dist/mcp.cjs CHANGED
@@ -52,10 +52,11 @@ var init_chatEvents = __esm({
52
52
  function namedValues(values) {
53
53
  return Object.fromEntries(values.map((value) => [value, value]));
54
54
  }
55
- var SENSORY_MEMORY_TYPES, COGNITIVE_MEMORY_TYPES, MEMORY_SYSTEM_TYPES, MEMORY_SYSTEMS, MEMORY_TYPES, MEMORY_SEGMENTS, MEMORY_STORE_SCOPES, MEMORY_LIST_SCOPES, MEMORY_STATUSES, MEMORY_SYSTEM, MEMORY_TYPE, MEMORY_SEGMENT, MEMORY_STORE_SCOPE;
55
+ var import_band_sdk_core, SENSORY_MEMORY_TYPES, COGNITIVE_MEMORY_TYPES, MEMORY_SYSTEM_TYPES, MEMORY_SYSTEMS, MEMORY_TYPES, MEMORY_SEGMENTS, MEMORY_STORE_SCOPES, MEMORY_LIST_SCOPES, MEMORY_STATUSES, MEMORY_SYSTEM, MEMORY_TYPE, MEMORY_SEGMENT, MEMORY_STORE_SCOPE;
56
56
  var init_memory = __esm({
57
57
  "src/contracts/memory.ts"() {
58
58
  "use strict";
59
+ import_band_sdk_core = require("@band-ai/band-sdk-core");
59
60
  SENSORY_MEMORY_TYPES = [
60
61
  "iconic",
61
62
  // Visual input
@@ -96,18 +97,22 @@ var init_memory = __esm({
96
97
  // Behavioral rules or policies
97
98
  ];
98
99
  MEMORY_STORE_SCOPES = [
100
+ "agent",
101
+ // Private to the storing agent; omit subject_id
99
102
  "subject",
100
103
  // About one person/agent; requires subject_id
101
104
  "organization"
102
105
  // Shared org-wide
103
106
  ];
104
107
  MEMORY_LIST_SCOPES = [
108
+ "agent",
109
+ // Caller's private agent-scoped memories only
105
110
  "subject",
106
111
  // Subject-scoped memories only
107
112
  "organization",
108
113
  // Organization-scoped memories only
109
114
  "all"
110
- // Both scopes (no scope filter)
115
+ // All scopes (no scope filter)
111
116
  ];
112
117
  MEMORY_STATUSES = [
113
118
  "active",
@@ -318,7 +323,7 @@ var init_schemas = __esm({
318
323
  required: ["action"]
319
324
  },
320
325
  band_list_memories: {
321
- description: "List memories accessible to the agent. Returns memories about the specified subject (cross-agent sharing) and organization-wide shared memories.",
326
+ description: `List memories accessible to the agent. Use scope="agent" for the caller's private memories, scope="subject" for memories about a specific person or agent, and scope="organization" for org-wide shared memories. Omit scope or use scope="all" to search across scopes.`,
322
327
  properties: {
323
328
  subject_id: {
324
329
  type: "string",
@@ -327,7 +332,7 @@ var init_schemas = __esm({
327
332
  scope: {
328
333
  type: "string",
329
334
  enum: [...MEMORY_LIST_SCOPES],
330
- description: "Filter by scope."
335
+ description: `Filter by scope. "agent" returns the caller's private memories; "subject" and "organization" filter to those audiences; "all" omits the filter.`
331
336
  },
332
337
  system: {
333
338
  type: "string",
@@ -363,7 +368,7 @@ var init_schemas = __esm({
363
368
  required: []
364
369
  },
365
370
  band_store_memory: {
366
- description: "Store a new memory entry. The memory will be associated with the authenticated agent as the source. For subject-scoped memories, provide a subject_id. For organization-scoped memories, omit subject_id.",
371
+ description: 'Store a new memory entry. The memory will be associated with the authenticated agent as the source. Use scope="agent" for information private to this agent (no subject_id). Use scope="subject" with a subject_id for memories about a specific person or agent. Use scope="organization" for knowledge genuinely shared across the organization.',
367
372
  properties: {
368
373
  content: {
369
374
  type: "string",
@@ -391,11 +396,11 @@ var init_schemas = __esm({
391
396
  scope: {
392
397
  type: "string",
393
398
  enum: [...MEMORY_STORE_SCOPES],
394
- description: "Visibility scope."
399
+ description: 'Visibility scope. "agent" is private to this agent; "subject" requires subject_id; "organization" is shared org-wide.'
395
400
  },
396
401
  subject_id: {
397
402
  type: "string",
398
- description: "UUID of the subject this memory is about (required for subject scope)."
403
+ description: "UUID of the subject this memory is about (required for subject scope; omit for agent scope)."
399
404
  },
400
405
  metadata: {
401
406
  type: "object",
@@ -482,6 +487,7 @@ var TOOL_EXECUTOR_ERROR_TYPES;
482
487
  var init_protocols = __esm({
483
488
  "src/contracts/protocols.ts"() {
484
489
  "use strict";
490
+ init_chatEvents();
485
491
  TOOL_EXECUTOR_ERROR_TYPES = [
486
492
  "ToolArgumentsValidationError",
487
493
  "ToolNotFoundError",
package/dist/mcp.d.cts CHANGED
@@ -1,10 +1,11 @@
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';
1
+ export { B as BandMcpBackend, a as BandMcpBackendKind, C as CreateBandMcpBackendOptions, c as createBandMcpBackend, g as getBandSdkMcpServerConfig } from './backends-Dh2WXcHQ.cjs';
2
+ import { M as McpToolRegistration } from './sdk-CXNqzoY1.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-CXNqzoY1.cjs';
4
+ import { A as AdapterToolsProtocol } from './protocols-CabgO52c.cjs';
5
5
  import { Readable, Writable } from 'node:stream';
6
6
  import '@anthropic-ai/claude-agent-sdk';
7
- import './dtos-B8KU_q4d.cjs';
7
+ import '@band-ai/band-sdk-core';
8
+ import './dtos-CjQsN1_h.cjs';
8
9
 
9
10
  interface BandMcpServerOptions {
10
11
  /** Single tools instance (no room scoping) or a resolver function for room-scoped tools. */
package/dist/mcp.d.ts CHANGED
@@ -1,10 +1,11 @@
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';
1
+ export { B as BandMcpBackend, a as BandMcpBackendKind, C as CreateBandMcpBackendOptions, c as createBandMcpBackend, g as getBandSdkMcpServerConfig } from './backends-CgsPQa9B.js';
2
+ import { M as McpToolRegistration } from './sdk-Cin80BTC.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-Cin80BTC.js';
4
+ import { A as AdapterToolsProtocol } from './protocols-Dpci6uae.js';
5
5
  import { Readable, Writable } from 'node:stream';
6
6
  import '@anthropic-ai/claude-agent-sdk';
7
- import './dtos-B8KU_q4d.js';
7
+ import '@band-ai/band-sdk-core';
8
+ import './dtos-CjQsN1_h.js';
8
9
 
9
10
  interface BandMcpServerOptions {
10
11
  /** Single tools instance (no room scoping) or a resolver function for room-scoped tools. */
package/dist/mcp.js CHANGED
@@ -4,17 +4,16 @@ import {
4
4
  BandMcpStdioServer,
5
5
  createBandMcpBackend,
6
6
  getBandSdkMcpServerConfig
7
- } from "./chunk-WA7CHXUS.js";
7
+ } from "./chunk-UL3Y5C4J.js";
8
8
  import {
9
9
  buildRoomScopedRegistrations,
10
10
  buildSingleContextRegistrations,
11
11
  errorResult,
12
12
  successResult
13
- } from "./chunk-XWHWJP4I.js";
14
- import "./chunk-MQY74R7D.js";
15
- import "./chunk-F63TPOI3.js";
16
- import "./chunk-JADCAMZY.js";
17
- import "./chunk-JY75VSQK.js";
13
+ } from "./chunk-JDW5WSGF.js";
14
+ import "./chunk-SHZBLLDQ.js";
15
+ import "./chunk-TGDDFBYS.js";
16
+ import "./chunk-4OVNFDD7.js";
18
17
  export {
19
18
  BandMcpServer,
20
19
  BandMcpSseServer,
@@ -1,5 +1,5 @@
1
- import { P as PaginatedResponse, a as PaginationMetadata } from './types-BgYFd_Yw.cjs';
2
- import { M as MetadataMap } from './dtos-B8KU_q4d.cjs';
1
+ import { P as PaginatedResponse, a as PaginationMetadata } from './types-42-HWeX8.cjs';
2
+ import { M as MetadataMap } from './dtos-CjQsN1_h.cjs';
3
3
 
4
4
  interface FetchPageRequest {
5
5
  page: number;
@@ -1,5 +1,5 @@
1
- import { P as PaginatedResponse, a as PaginationMetadata } from './types-BivGO7I9.js';
2
- import { M as MetadataMap } from './dtos-B8KU_q4d.js';
1
+ import { P as PaginatedResponse, a as PaginationMetadata } from './types-CjxZekMH.js';
2
+ import { M as MetadataMap } from './dtos-CjQsN1_h.js';
3
3
 
4
4
  interface FetchPageRequest {
5
5
  page: number;
@@ -1,4 +1,12 @@
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';
1
+ import { AgentFailure } from '@band-ai/band-sdk-core';
2
+ import { h as MentionInput, T as ToolOperationResult, M as MetadataMap, g as ParticipantRecord, j as ToolSchemaRecord, i as PaginatedList, P as PeerRecord, L as ListContactsArgs, C as ContactRecord, A as AddContactArgs, R as RemoveContactArgs, b as ListContactRequestsArgs, c as ContactRequestsResult, d as RespondContactRequestArgs, e as ListMemoriesArgs, f as MemoryRecord, S as StoreMemoryArgs } from './dtos-CjQsN1_h.cjs';
3
+
4
+ declare const CHAT_EVENT_TYPES: readonly ["tool_call", "tool_result", "thought", "error", "task"];
5
+ type ChatEventType = (typeof CHAT_EVENT_TYPES)[number];
6
+ declare const CHAT_MESSAGE_TYPES: readonly ["text", "tool_call", "tool_result", "thought", "error", "task"];
7
+ type ChatMessageType = (typeof CHAT_MESSAGE_TYPES)[number];
8
+ declare function isChatEventType(value: string): value is ChatEventType;
9
+ declare function assertChatEventType(value: string): asserts value is ChatEventType;
2
10
 
3
11
  interface HistoryConverter<T> {
4
12
  convert(raw: MetadataMap[]): T;
@@ -21,8 +29,35 @@ interface HistoryLike {
21
29
  }
22
30
  interface MessagingTools {
23
31
  sendMessage(content: string, mentions?: MentionInput): Promise<ToolOperationResult>;
32
+ /**
33
+ * Room telemetry, unlike `sendMessage`: a *failed post* resolves
34
+ * `{ ok: false, status: "failed" }` rather than rejecting, so reporting
35
+ * something about a turn can never abort the turn over a transport error.
36
+ * `sendFailure`, which delegates here, inherits that.
37
+ *
38
+ * It is not unconditionally non-throwing: an implementation still rejects
39
+ * when it cannot post at all — `ContactCallbackTools` throws for an event
40
+ * with no room context, and for a REST adapter without the endpoint. A
41
+ * caller reporting from a `catch` on such a path has to guard it, the way
42
+ * `safeSendFailure` (`core/providerFailure.ts`) does.
43
+ */
24
44
  sendEvent(content: string, messageType: string, metadata?: MetadataMap): Promise<ToolOperationResult>;
25
- }
45
+ sendFailure(failure: AgentFailure): Promise<ToolOperationResult>;
46
+ }
47
+ /** The chat event type every failure is posted as. */
48
+ declare const FAILURE_EVENT_TYPE: ChatEventType;
49
+ /**
50
+ * Metadata key nesting the serialized `AgentFailure`. Part of the wire
51
+ * contract — clients read `metadata.failure` to render a failure — so it is
52
+ * defined here once rather than spelled out at each posting site.
53
+ */
54
+ declare const FAILURE_METADATA_KEY = "failure";
55
+ /** The complete event every `sendFailure` implementation posts for a failure. */
56
+ declare function toFailureEvent(failure: AgentFailure): {
57
+ content: string;
58
+ messageType: ChatEventType;
59
+ metadata: MetadataMap;
60
+ };
26
61
  interface RoomParticipantTools {
27
62
  addParticipant(name: string, role?: string): Promise<ToolOperationResult>;
28
63
  removeParticipant(name: string): Promise<ToolOperationResult>;
@@ -113,4 +148,4 @@ interface Preprocessor<TEvent extends EventEnvelope = EventEnvelope> {
113
148
  process(context: PreprocessorContext, event: TEvent, agentId: string): Promise<FrameworkAdapterInput | null>;
114
149
  }
115
150
 
116
- export type { AdapterToolsProtocol as A, ContactTools as C, FrameworkAdapter as F, HistoryConverter as H, MemoryTools as M, ParticipantTools as P, RoomParticipantTools as R, ToolExecutor as T, AgentToolsProtocol as a, FrameworkAdapterInput as b, MessagingTools as c, PeerLookupTools as d, Preprocessor as e, ToolSchemaProvider as f, PlatformMessageLike as g, AgentToolsCapabilities as h, PreprocessorContext as i };
151
+ export { type AdapterToolsProtocol as A, type ContactTools as C, type FrameworkAdapter as F, type HistoryConverter as H, type MemoryTools as M, type PlatformMessageLike as P, type RoomParticipantTools as R, type ToolExecutor as T, type FrameworkAdapterInput as a, type AgentToolsProtocol as b, FAILURE_EVENT_TYPE as c, FAILURE_METADATA_KEY as d, type MessagingTools as e, type ParticipantTools as f, type PeerLookupTools as g, type Preprocessor as h, type ToolSchemaProvider as i, type AgentToolsCapabilities as j, CHAT_EVENT_TYPES as k, CHAT_MESSAGE_TYPES as l, type ChatEventType as m, type ChatMessageType as n, assertChatEventType as o, isChatEventType as p, type PreprocessorContext as q, toFailureEvent as t };
@@ -1,4 +1,12 @@
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';
1
+ import { AgentFailure } from '@band-ai/band-sdk-core';
2
+ import { h as MentionInput, T as ToolOperationResult, M as MetadataMap, g as ParticipantRecord, j as ToolSchemaRecord, i as PaginatedList, P as PeerRecord, L as ListContactsArgs, C as ContactRecord, A as AddContactArgs, R as RemoveContactArgs, b as ListContactRequestsArgs, c as ContactRequestsResult, d as RespondContactRequestArgs, e as ListMemoriesArgs, f as MemoryRecord, S as StoreMemoryArgs } from './dtos-CjQsN1_h.js';
3
+
4
+ declare const CHAT_EVENT_TYPES: readonly ["tool_call", "tool_result", "thought", "error", "task"];
5
+ type ChatEventType = (typeof CHAT_EVENT_TYPES)[number];
6
+ declare const CHAT_MESSAGE_TYPES: readonly ["text", "tool_call", "tool_result", "thought", "error", "task"];
7
+ type ChatMessageType = (typeof CHAT_MESSAGE_TYPES)[number];
8
+ declare function isChatEventType(value: string): value is ChatEventType;
9
+ declare function assertChatEventType(value: string): asserts value is ChatEventType;
2
10
 
3
11
  interface HistoryConverter<T> {
4
12
  convert(raw: MetadataMap[]): T;
@@ -21,8 +29,35 @@ interface HistoryLike {
21
29
  }
22
30
  interface MessagingTools {
23
31
  sendMessage(content: string, mentions?: MentionInput): Promise<ToolOperationResult>;
32
+ /**
33
+ * Room telemetry, unlike `sendMessage`: a *failed post* resolves
34
+ * `{ ok: false, status: "failed" }` rather than rejecting, so reporting
35
+ * something about a turn can never abort the turn over a transport error.
36
+ * `sendFailure`, which delegates here, inherits that.
37
+ *
38
+ * It is not unconditionally non-throwing: an implementation still rejects
39
+ * when it cannot post at all — `ContactCallbackTools` throws for an event
40
+ * with no room context, and for a REST adapter without the endpoint. A
41
+ * caller reporting from a `catch` on such a path has to guard it, the way
42
+ * `safeSendFailure` (`core/providerFailure.ts`) does.
43
+ */
24
44
  sendEvent(content: string, messageType: string, metadata?: MetadataMap): Promise<ToolOperationResult>;
25
- }
45
+ sendFailure(failure: AgentFailure): Promise<ToolOperationResult>;
46
+ }
47
+ /** The chat event type every failure is posted as. */
48
+ declare const FAILURE_EVENT_TYPE: ChatEventType;
49
+ /**
50
+ * Metadata key nesting the serialized `AgentFailure`. Part of the wire
51
+ * contract — clients read `metadata.failure` to render a failure — so it is
52
+ * defined here once rather than spelled out at each posting site.
53
+ */
54
+ declare const FAILURE_METADATA_KEY = "failure";
55
+ /** The complete event every `sendFailure` implementation posts for a failure. */
56
+ declare function toFailureEvent(failure: AgentFailure): {
57
+ content: string;
58
+ messageType: ChatEventType;
59
+ metadata: MetadataMap;
60
+ };
26
61
  interface RoomParticipantTools {
27
62
  addParticipant(name: string, role?: string): Promise<ToolOperationResult>;
28
63
  removeParticipant(name: string): Promise<ToolOperationResult>;
@@ -113,4 +148,4 @@ interface Preprocessor<TEvent extends EventEnvelope = EventEnvelope> {
113
148
  process(context: PreprocessorContext, event: TEvent, agentId: string): Promise<FrameworkAdapterInput | null>;
114
149
  }
115
150
 
116
- export type { AdapterToolsProtocol as A, ContactTools as C, FrameworkAdapter as F, HistoryConverter as H, MemoryTools as M, ParticipantTools as P, RoomParticipantTools as R, ToolExecutor as T, AgentToolsProtocol as a, FrameworkAdapterInput as b, MessagingTools as c, PeerLookupTools as d, Preprocessor as e, ToolSchemaProvider as f, PlatformMessageLike as g, AgentToolsCapabilities as h, PreprocessorContext as i };
151
+ export { type AdapterToolsProtocol as A, type ContactTools as C, type FrameworkAdapter as F, type HistoryConverter as H, type MemoryTools as M, type PlatformMessageLike as P, type RoomParticipantTools as R, type ToolExecutor as T, type FrameworkAdapterInput as a, type AgentToolsProtocol as b, FAILURE_EVENT_TYPE as c, FAILURE_METADATA_KEY as d, type MessagingTools as e, type ParticipantTools as f, type PeerLookupTools as g, type Preprocessor as h, type ToolSchemaProvider as i, type AgentToolsCapabilities as j, CHAT_EVENT_TYPES as k, CHAT_MESSAGE_TYPES as l, type ChatEventType as m, type ChatMessageType as n, assertChatEventType as o, isChatEventType as p, type PreprocessorContext as q, toFailureEvent as t };
package/dist/rest.cjs CHANGED
@@ -226,14 +226,56 @@ var DEFAULT_REQUEST_OPTIONS = {
226
226
  };
227
227
  var MESSAGE_SEND_MAX_RETRIES = 2;
228
228
 
229
+ // src/core/sensitiveTerms.ts
230
+ var SENSITIVE_KEY_TERMS = "authorization|api[-_ ]?key|token|secret|password|cookie";
231
+ var GATEWAY_FREE_TEXT_SENSITIVE_KEY_TERMS = `${SENSITIVE_KEY_TERMS}|session`;
232
+
229
233
  // src/core/logger.ts
230
234
  var noop = () => void 0;
235
+ var SENSITIVE_KEY_PATTERN = new RegExp(`(${SENSITIVE_KEY_TERMS})`, "i");
231
236
  var NoopLogger = class {
232
237
  debug = noop;
233
238
  info = noop;
234
239
  warn = noop;
235
240
  error = noop;
236
241
  };
242
+ function resolveLogger(logger) {
243
+ if (!logger) {
244
+ return new NoopLogger();
245
+ }
246
+ return logger instanceof GuardedLogger ? logger : new GuardedLogger(logger);
247
+ }
248
+ var GuardedLogger = class {
249
+ constructor(inner) {
250
+ this.inner = inner;
251
+ }
252
+ debug(message, context) {
253
+ return this.emit("debug", message, context);
254
+ }
255
+ info(message, context) {
256
+ return this.emit("info", message, context);
257
+ }
258
+ warn(message, context) {
259
+ return this.emit("warn", message, context);
260
+ }
261
+ error(message, context) {
262
+ return this.emit("error", message, context);
263
+ }
264
+ emit(level, message, context) {
265
+ try {
266
+ const result = this.inner[level](message, context);
267
+ if (result instanceof Promise) {
268
+ result.catch(noop);
269
+ }
270
+ return result;
271
+ } catch {
272
+ }
273
+ }
274
+ };
275
+
276
+ // src/contracts/chatEvents.ts
277
+ var CHAT_EVENT_TYPES = ["tool_call", "tool_result", "thought", "error", "task"];
278
+ var CHAT_MESSAGE_TYPES = ["text", ...CHAT_EVENT_TYPES];
237
279
 
238
280
  // src/adapters/shared/coercion.ts
239
281
  function asOptionalRecord(value) {
@@ -868,7 +910,7 @@ var RestFacade = class {
868
910
  logger;
869
911
  constructor(options) {
870
912
  this.api = options.api;
871
- this.logger = options.logger ?? new NoopLogger();
913
+ this.logger = resolveLogger(options.logger);
872
914
  }
873
915
  async getAgentMe(options) {
874
916
  return this.forward("getAgentMe", () => this.api.getAgentMe(options));
package/dist/rest.d.cts CHANGED
@@ -1,9 +1,10 @@
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';
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-42-HWeX8.cjs';
2
+ export { d as ChatMessageMention, D as DEFAULT_REQUEST_OPTIONS, a as PaginationMetadata } from './types-42-HWeX8.cjs';
3
+ import { P as PaginationOptions } from './pagination-BZDhB_nO.cjs';
4
+ export { f as fetchPaginated, n as normalizePaginationMetadata } from './pagination-BZDhB_nO.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-B8KU_q4d.cjs';
6
+ import { M as MetadataMap, a as MentionReference, T as ToolOperationResult, P as PeerRecord, L as ListContactsArgs, C as ContactRecord, A as AddContactArgs, R as RemoveContactArgs, b as ListContactRequestsArgs, c as ContactRequestsResult, d as RespondContactRequestArgs, e as ListMemoriesArgs, f as MemoryRecord, S as StoreMemoryArgs } from './dtos-CjQsN1_h.cjs';
7
+ import '@band-ai/band-sdk-core';
7
8
 
8
9
  declare class FernRestAdapter implements RestApi {
9
10
  private readonly client;
package/dist/rest.d.ts CHANGED
@@ -1,9 +1,10 @@
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';
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-CjxZekMH.js';
2
+ export { d as ChatMessageMention, D as DEFAULT_REQUEST_OPTIONS, a as PaginationMetadata } from './types-CjxZekMH.js';
3
+ import { P as PaginationOptions } from './pagination-CPz0J_vQ.js';
4
+ export { f as fetchPaginated, n as normalizePaginationMetadata } from './pagination-CPz0J_vQ.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-B8KU_q4d.js';
6
+ import { M as MetadataMap, a as MentionReference, T as ToolOperationResult, P as PeerRecord, L as ListContactsArgs, C as ContactRecord, A as AddContactArgs, R as RemoveContactArgs, b as ListContactRequestsArgs, c as ContactRequestsResult, d as RespondContactRequestArgs, e as ListMemoriesArgs, f as MemoryRecord, S as StoreMemoryArgs } from './dtos-CjQsN1_h.js';
7
+ import '@band-ai/band-sdk-core';
7
8
 
8
9
  declare class FernRestAdapter implements RestApi {
9
10
  private readonly client;
package/dist/rest.js CHANGED
@@ -4,11 +4,12 @@ import {
4
4
  RestFacade,
5
5
  fetchPaginated,
6
6
  normalizePaginationMetadata
7
- } from "./chunk-W5IAI6Z4.js";
8
- import "./chunk-KXJ74J73.js";
9
- import "./chunk-JADCAMZY.js";
10
- import "./chunk-OD2G5LFQ.js";
11
- import "./chunk-JY75VSQK.js";
7
+ } from "./chunk-OVXVZUPO.js";
8
+ import "./chunk-JIZE4EC6.js";
9
+ import "./chunk-6BE2EG5P.js";
10
+ import "./chunk-TGDDFBYS.js";
11
+ import "./chunk-ZYOXI4JL.js";
12
+ import "./chunk-4OVNFDD7.js";
12
13
  export {
13
14
  DEFAULT_REQUEST_OPTIONS,
14
15
  FernRestAdapter,