@band-ai/sdk 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1058,6 +1058,7 @@ __export(src_exports, {
1058
1058
  A2AAdapter: () => A2AAdapter,
1059
1059
  A2AGatewayAdapter: () => A2AGatewayAdapter,
1060
1060
  ACPClientAdapter: () => ACPClientAdapter,
1061
+ AcpSessionConfigError: () => AcpSessionConfigError,
1061
1062
  Agent: () => Agent,
1062
1063
  AgentFailure: () => import_band_sdk_core13.AgentFailure,
1063
1064
  AgentRuntime: () => AgentRuntime,
@@ -1073,6 +1074,7 @@ __export(src_exports, {
1073
1074
  DEFAULT_OMP_ACP_COMMAND: () => DEFAULT_OMP_ACP_COMMAND,
1074
1075
  DefaultPreprocessor: () => DefaultPreprocessor,
1075
1076
  DeliveryFailedError: () => DeliveryFailedError,
1077
+ FAILURE_CODE_SESSION_CONFIG: () => FAILURE_CODE_SESSION_CONFIG,
1076
1078
  FAILURE_EVENT_TYPE: () => FAILURE_EVENT_TYPE,
1077
1079
  FAILURE_METADATA_KEY: () => FAILURE_METADATA_KEY,
1078
1080
  GeminiAdapter: () => GeminiAdapter,
@@ -1082,6 +1084,7 @@ __export(src_exports, {
1082
1084
  LettaAdapter: () => LettaAdapter,
1083
1085
  MCP_SERVER_NAME: () => MCP_SERVER_NAME,
1084
1086
  MCP_TOOL_PREFIX: () => MCP_TOOL_PREFIX,
1087
+ MISSING_CONFIG_OPTIONS_REASON: () => MISSING_CONFIG_OPTIONS_REASON,
1085
1088
  OmpACPAdapter: () => OmpACPAdapter,
1086
1089
  OpenAIAdapter: () => OpenAIAdapter,
1087
1090
  OpencodeAdapter: () => OpencodeAdapter,
@@ -1094,6 +1097,7 @@ __export(src_exports, {
1094
1097
  VercelAISDKAdapter: () => VercelAISDKAdapter,
1095
1098
  WebSocketDisconnectError: () => WebSocketDisconnectError,
1096
1099
  agentFailure: () => agentFailure,
1100
+ applySessionConfigSelections: () => applySessionConfigSelections,
1097
1101
  deliverReply: () => deliverReply,
1098
1102
  deriveDefaultRestUrl: () => deriveDefaultRestUrl,
1099
1103
  isDirectExecution: () => isDirectExecution,
@@ -17103,6 +17107,151 @@ var ACPClientHistoryConverter = class {
17103
17107
 
17104
17108
  // src/adapters/acp/ACPClientAdapter.ts
17105
17109
  init_errors();
17110
+
17111
+ // src/adapters/acp/sessionConfigReconciliation.ts
17112
+ var FAILURE_CODE_SESSION_CONFIG = "session_config";
17113
+ var MISSING_CONFIG_OPTIONS_REASON = "missing_config_options";
17114
+ var AcpSessionConfigTimeoutError = class extends Error {
17115
+ };
17116
+ var AcpSessionConfigError = class extends Error {
17117
+ provider;
17118
+ sessionId;
17119
+ optionId;
17120
+ selectedValue;
17121
+ acpCode;
17122
+ detail;
17123
+ timedOut;
17124
+ constructor(input) {
17125
+ super(input.message, input.cause !== void 0 ? { cause: input.cause } : void 0);
17126
+ this.name = "AcpSessionConfigError";
17127
+ this.provider = input.provider;
17128
+ this.sessionId = input.sessionId;
17129
+ this.optionId = input.optionId;
17130
+ this.selectedValue = input.selectedValue;
17131
+ this.acpCode = input.acpCode;
17132
+ this.detail = input.detail;
17133
+ this.timedOut = input.timedOut ?? false;
17134
+ }
17135
+ toAgentFailure() {
17136
+ return agentFailure(
17137
+ this.provider,
17138
+ this.message,
17139
+ this.acpCode !== void 0 ? String(this.acpCode) : FAILURE_CODE_SESSION_CONFIG,
17140
+ {
17141
+ sessionId: this.sessionId,
17142
+ optionId: this.optionId,
17143
+ selectedValue: this.selectedValue,
17144
+ detail: this.detail
17145
+ }
17146
+ );
17147
+ }
17148
+ };
17149
+ async function applySessionConfigSelections(input) {
17150
+ let catalog = input.catalog;
17151
+ for (const { configId, value: selectedValue } of sessionConfigSelectionEntries(input.selections)) {
17152
+ if (selectedValue === void 0) {
17153
+ continue;
17154
+ }
17155
+ const option = catalog.find((entry) => entry?.id === configId);
17156
+ if (!option || !isSessionConfigSelect(option)) {
17157
+ throw new AcpSessionConfigError({
17158
+ provider: input.provider,
17159
+ sessionId: input.sessionId,
17160
+ optionId: configId,
17161
+ selectedValue,
17162
+ message: `Session config option "${configId}" is not available after prior selections.`
17163
+ });
17164
+ }
17165
+ if (selectedValue === option.currentValue) {
17166
+ continue;
17167
+ }
17168
+ const availableValues = flattenConfigSelectOptions(option.options).map((entry) => entry.value);
17169
+ if (!availableValues.includes(selectedValue)) {
17170
+ throw new AcpSessionConfigError({
17171
+ provider: input.provider,
17172
+ sessionId: input.sessionId,
17173
+ optionId: configId,
17174
+ selectedValue,
17175
+ message: `Session config value "${selectedValue}" is not advertised for option "${configId}".`,
17176
+ detail: { availableValues }
17177
+ });
17178
+ }
17179
+ const timeoutMessage = `setSessionConfigOption did not respond within ${input.timeoutMs}ms`;
17180
+ try {
17181
+ const response = await withTimeout(
17182
+ input.setOption({ sessionId: input.sessionId, configId, value: selectedValue }),
17183
+ input.timeoutMs,
17184
+ () => new AcpSessionConfigTimeoutError(timeoutMessage)
17185
+ );
17186
+ if (!Array.isArray(response?.configOptions)) {
17187
+ throw new AcpSessionConfigError({
17188
+ provider: input.provider,
17189
+ sessionId: input.sessionId,
17190
+ optionId: configId,
17191
+ selectedValue,
17192
+ message: `Session config option "${configId}" response did not include a refreshed catalog.`,
17193
+ detail: { reason: MISSING_CONFIG_OPTIONS_REASON }
17194
+ });
17195
+ }
17196
+ catalog = response.configOptions;
17197
+ } catch (error) {
17198
+ if (error instanceof AcpSessionConfigError) {
17199
+ throw error;
17200
+ }
17201
+ const acpError = asAcpJsonRpcError(error);
17202
+ throw new AcpSessionConfigError({
17203
+ provider: input.provider,
17204
+ sessionId: input.sessionId,
17205
+ optionId: configId,
17206
+ selectedValue,
17207
+ acpCode: acpError?.code,
17208
+ detail: acpError?.data,
17209
+ message: acpError?.message ?? asErrorMessage(error),
17210
+ cause: error,
17211
+ timedOut: error instanceof AcpSessionConfigTimeoutError
17212
+ });
17213
+ }
17214
+ }
17215
+ return { catalog };
17216
+ }
17217
+ function sessionConfigSelectionEntries(selections) {
17218
+ if (isOrderedSessionConfigSelections(selections)) {
17219
+ return selections;
17220
+ }
17221
+ return Object.keys(selections).map((configId) => ({ configId, value: selections[configId] }));
17222
+ }
17223
+ function isOrderedSessionConfigSelections(selections) {
17224
+ return Array.isArray(selections);
17225
+ }
17226
+ function isSessionConfigSelect(option) {
17227
+ return option?.type === "select";
17228
+ }
17229
+ function flattenConfigSelectOptions(options) {
17230
+ if (!Array.isArray(options)) {
17231
+ return [];
17232
+ }
17233
+ return options.flatMap((entry) => {
17234
+ if (!asOptionalRecord2(entry)) {
17235
+ return [];
17236
+ }
17237
+ if ("group" in entry) {
17238
+ return Array.isArray(entry.options) ? entry.options : [];
17239
+ }
17240
+ return [entry];
17241
+ });
17242
+ }
17243
+ function isAcpErrorResponse(error) {
17244
+ return typeof error === "object" && error !== null && typeof error.code === "number" && typeof error.message === "string";
17245
+ }
17246
+ function asAcpJsonRpcError(error) {
17247
+ if (isAcpErrorResponse(error)) {
17248
+ return error;
17249
+ }
17250
+ const nested = asOptionalRecord2(error)?.error;
17251
+ return isAcpErrorResponse(nested) ? nested : void 0;
17252
+ }
17253
+
17254
+ // src/adapters/acp/ACPClientAdapter.ts
17106
17255
  init_chatEvents();
17107
17256
  init_schemas();
17108
17257
 
@@ -17361,6 +17510,13 @@ var acpModule = new LazyAsyncValue({
17361
17510
  });
17362
17511
 
17363
17512
  // src/adapters/acp/ACPClientAdapter.ts
17513
+ function createConnectionRetirement() {
17514
+ let reject = () => void 0;
17515
+ const promise = new Promise((_resolve, rejectPromise) => {
17516
+ reject = rejectPromise;
17517
+ });
17518
+ return { promise, reject };
17519
+ }
17364
17520
  var DEFAULT_PERMISSION_TIMEOUT_MS = 5 * 6e4;
17365
17521
  var DEFAULT_TURN_TIMEOUT_MS = 60 * 6e4;
17366
17522
  var SET_SESSION_CONFIG_TIMEOUT_MS = 1e4;
@@ -17418,6 +17574,7 @@ var ACPClientAdapter = class extends SimpleAdapter {
17418
17574
  permissionTimeoutMs;
17419
17575
  turnTimeoutMs;
17420
17576
  logger;
17577
+ customSection;
17421
17578
  backend = null;
17422
17579
  backendPromise = null;
17423
17580
  client = null;
@@ -17428,6 +17585,7 @@ var ACPClientAdapter = class extends SimpleAdapter {
17428
17585
  started = false;
17429
17586
  systemPrompt = "";
17430
17587
  spawnPromise = null;
17588
+ connectionRetirements = /* @__PURE__ */ new WeakMap();
17431
17589
  // Bumped by `stop()` and on every successful spawn install. Cleanup/timeout
17432
17590
  // and permission maps key by this plus session id so a stale generation
17433
17591
  // cannot alias a same-id session on a newer connection.
@@ -17454,6 +17612,7 @@ var ACPClientAdapter = class extends SimpleAdapter {
17454
17612
  this.resolveSessionModel = options.resolveSessionModel;
17455
17613
  this.resolveSessionConfig = options.resolveSessionConfig;
17456
17614
  this.logger = resolveLogger(options.logger);
17615
+ this.customSection = options.customSection;
17457
17616
  this.permissionTimeoutMs = options.permissionTimeoutMs ?? DEFAULT_PERMISSION_TIMEOUT_MS;
17458
17617
  if ((this.resolvePermission || this.resolveSessionMode || this.resolveSessionModel || this.resolveSessionConfig) && (!Number.isFinite(this.permissionTimeoutMs) || this.permissionTimeoutMs <= 0)) {
17459
17618
  throw new ValidationError(`permissionTimeoutMs must be a positive finite number, got ${options.permissionTimeoutMs}`);
@@ -17485,7 +17644,8 @@ var ACPClientAdapter = class extends SimpleAdapter {
17485
17644
  this.systemPrompt = renderSystemPrompt({
17486
17645
  agentName,
17487
17646
  agentDescription,
17488
- includeBaseInstructions: false
17647
+ includeBaseInstructions: false,
17648
+ customSection: this.customSection
17489
17649
  });
17490
17650
  await this.ensureConnection();
17491
17651
  }
@@ -17518,13 +17678,17 @@ var ACPClientAdapter = class extends SimpleAdapter {
17518
17678
 
17519
17679
  ${messageWithContext}`;
17520
17680
  this.bootstrappedSessions.add(sessionKey);
17521
- const response = await withTimeout(connection.prompt({
17522
- sessionId,
17523
- prompt: [{
17524
- type: "text",
17525
- text: promptText
17526
- }]
17527
- }), this.turnTimeoutMs, () => new AcpTurnTimeoutError());
17681
+ const response = await withTimeout(
17682
+ this.raceAgainstConnectionRetirement(connection, connection.prompt({
17683
+ sessionId,
17684
+ prompt: [{
17685
+ type: "text",
17686
+ text: promptText
17687
+ }]
17688
+ })),
17689
+ this.turnTimeoutMs,
17690
+ () => new AcpTurnTimeoutError()
17691
+ );
17528
17692
  await this.flushChunks({
17529
17693
  client,
17530
17694
  tools,
@@ -17565,12 +17729,17 @@ ${messageWithContext}`;
17565
17729
  }
17566
17730
  }
17567
17731
  }
17568
- const acpError = asAcpJsonRpcError(error);
17732
+ const configError = error instanceof AcpSessionConfigError ? error : void 0;
17733
+ const acpError = configError ? void 0 : asAcpJsonRpcError(error);
17569
17734
  await reportTurnFailure(
17570
17735
  tools,
17571
- isTimeout ? agentFailure(this.provider, "ACP turn timed out.", FAILURE_CODE_TIMEOUT) : acpError ? agentFailure(this.provider, acpError.message, String(acpError.code), acpError.data) : agentFailure(this.provider, asErrorMessage(error)),
17736
+ isTimeout ? agentFailure(this.provider, "ACP turn timed out.", FAILURE_CODE_TIMEOUT) : configError ? configError.toAgentFailure() : acpError ? agentFailure(this.provider, acpError.message, String(acpError.code), acpError.data) : agentFailure(this.provider, asErrorMessage(error)),
17572
17737
  this.logger,
17573
- { roomId: context.roomId, sessionId }
17738
+ {
17739
+ roomId: context.roomId,
17740
+ sessionId: configError?.sessionId ?? sessionId,
17741
+ ...configError ? { optionId: configError.optionId, selectedValue: configError.selectedValue } : {}
17742
+ }
17574
17743
  );
17575
17744
  }
17576
17745
  }
@@ -17589,17 +17758,12 @@ ${messageWithContext}`;
17589
17758
  // would risk blocking this room's turn lock forever on the very process
17590
17759
  // that just proved it can hang.
17591
17760
  async abandonTimedOutTurn(connection, sessionId, generation) {
17592
- const key = this.sessionKey(generation, sessionId);
17593
- this.activeSessions.delete(key);
17594
- this.abandonedSessions.add(key);
17595
- const owner = [...this.roomToSession.entries()].find(([, value]) => value.sessionId === sessionId && value.generation === generation);
17596
- if (owner) {
17597
- this.unlinkOwner(owner[0], owner[1]);
17598
- }
17599
- abandon(
17600
- () => connection.cancel({ sessionId }),
17601
- (error) => this.safeWarn("acp_client.cancel_failed", { sessionId, error: asErrorMessage(error) })
17602
- );
17761
+ this.evictAbandonedSession(sessionId, generation, connection, () => {
17762
+ const owner = [...this.roomToSession.entries()].find(([, value]) => value.sessionId === sessionId && value.generation === generation);
17763
+ if (owner) {
17764
+ this.unlinkOwner(owner[0], owner[1]);
17765
+ }
17766
+ });
17603
17767
  }
17604
17768
  // A per-room async mutex: `fn` for a given `roomId` never overlaps another
17605
17769
  // call for that same room, while different rooms stay fully concurrent.
@@ -17725,6 +17889,11 @@ ${messageWithContext}`;
17725
17889
  void connection.closed.then(() => reject(new Error("ACP connection closed while a session operation was still in flight")));
17726
17890
  return Promise.race([operation, closedRejection]);
17727
17891
  }
17892
+ raceAgainstConnectionRetirement(connection, operation) {
17893
+ const retirement = this.connectionRetirements.get(connection) ?? createConnectionRetirement();
17894
+ this.connectionRetirements.set(connection, retirement);
17895
+ return Promise.race([operation, retirement.promise]);
17896
+ }
17728
17897
  unlinkRoom(roomId) {
17729
17898
  const owner = this.roomToSession.get(roomId);
17730
17899
  if (owner) {
@@ -17869,7 +18038,7 @@ ${messageWithContext}`;
17869
18038
  this.activeSessions.add(restoredKey);
17870
18039
  this.bootstrappedSessions.add(restoredKey);
17871
18040
  await this.configureSessionMode(roomId, existingSessionId, restored.modes, connection);
17872
- await this.configureSessionConfig(roomId, existingSessionId, restored.configOptions, connection);
18041
+ await this.configureSessionConfig(roomId, existingSessionId, restored.configOptions, connection, connectionGeneration, client);
17873
18042
  if (!this.resolveSessionConfig) {
17874
18043
  await this.configureSessionModel(roomId, existingSessionId, restored.configOptions, connection);
17875
18044
  }
@@ -17883,13 +18052,13 @@ ${messageWithContext}`;
17883
18052
  this.linkOrAbandon(roomId, created.sessionId, generation, connectionGeneration, client);
17884
18053
  this.activeSessions.add(this.sessionKey(connectionGeneration, created.sessionId));
17885
18054
  await this.configureSessionMode(roomId, created.sessionId, created.modes, connection);
17886
- await this.configureSessionConfig(roomId, created.sessionId, created.configOptions, connection);
18055
+ await this.configureSessionConfig(roomId, created.sessionId, created.configOptions, connection, connectionGeneration, client);
17887
18056
  if (!this.resolveSessionConfig) {
17888
18057
  await this.configureSessionModel(roomId, created.sessionId, created.configOptions, connection);
17889
18058
  }
17890
18059
  return created.sessionId;
17891
18060
  }
17892
- async configureSessionConfig(roomId, sessionId, configOptions, connection) {
18061
+ async configureSessionConfig(roomId, sessionId, configOptions, connection, connectionGeneration, client) {
17893
18062
  if (!this.resolveSessionConfig || !Array.isArray(configOptions) || configOptions.length === 0) {
17894
18063
  return;
17895
18064
  }
@@ -17902,35 +18071,76 @@ ${messageWithContext}`;
17902
18071
  if (!selections) {
17903
18072
  return;
17904
18073
  }
17905
- for (const option of advertisedOptions) {
17906
- const selectedValue = selections[option.id];
17907
- if (selectedValue === void 0 || selectedValue === option.currentValue || !isSessionConfigSelect(option)) {
17908
- continue;
17909
- }
17910
- const availableValues = flattenConfigSelectOptions(option.options).map((entry) => entry.value);
17911
- if (!availableValues.includes(selectedValue)) {
17912
- this.safeWarn("resolveSessionConfig selected a value this session does not advertise", {
17913
- sessionId,
17914
- configId: option.id,
17915
- selectedValue,
17916
- availableValues
17917
- });
17918
- continue;
17919
- }
17920
- try {
17921
- await withTimeout(
17922
- connection.setSessionConfigOption({ sessionId, configId: option.id, value: selectedValue }),
17923
- SET_SESSION_CONFIG_TIMEOUT_MS,
17924
- `setSessionConfigOption did not respond within ${SET_SESSION_CONFIG_TIMEOUT_MS}ms`
17925
- );
17926
- } catch (error) {
17927
- this.safeWarn("failed to switch session config option", {
17928
- sessionId,
17929
- configId: option.id,
17930
- selectedValue,
17931
- error: String(error)
17932
- });
18074
+ try {
18075
+ await applySessionConfigSelections({
18076
+ provider: this.provider,
18077
+ sessionId,
18078
+ catalog: advertisedOptions,
18079
+ selections,
18080
+ setOption: (params) => connection.setSessionConfigOption(params),
18081
+ timeoutMs: SET_SESSION_CONFIG_TIMEOUT_MS
18082
+ });
18083
+ } catch (error) {
18084
+ this.abandonFailedConfigSession(
18085
+ roomId,
18086
+ sessionId,
18087
+ connectionGeneration,
18088
+ client,
18089
+ connection,
18090
+ error instanceof AcpSessionConfigError && error.timedOut
18091
+ );
18092
+ throw error;
18093
+ }
18094
+ }
18095
+ // A config failure mid-establish must not leave a half-applied session
18096
+ // active for the room: the next turn needs a fresh `newSession` catalog.
18097
+ abandonFailedConfigSession(roomId, sessionId, connectionGeneration, client, connection, retireConnection) {
18098
+ const key = this.sessionKey(connectionGeneration, sessionId);
18099
+ this.bootstrappedSessions.delete(key);
18100
+ client.resetChunks(sessionId);
18101
+ this.evictAbandonedSession(sessionId, connectionGeneration, connection, () => {
18102
+ const owner = this.roomToSession.get(roomId);
18103
+ if (owner && owner.sessionId === sessionId && owner.generation === connectionGeneration) {
18104
+ this.unlinkOwner(roomId, owner);
17933
18105
  }
18106
+ });
18107
+ if (retireConnection) {
18108
+ this.retireConnection(connection, connectionGeneration);
18109
+ }
18110
+ }
18111
+ // Common half of timeout and config-failure abandon: mark the session
18112
+ // unusable for restore, unlink ownership, and best-effort cancel.
18113
+ evictAbandonedSession(sessionId, connectionGeneration, connection, unlink) {
18114
+ const key = this.sessionKey(connectionGeneration, sessionId);
18115
+ const wasActive = this.activeSessions.delete(key);
18116
+ if (wasActive) {
18117
+ this.abandonedSessions.add(key);
18118
+ }
18119
+ unlink();
18120
+ abandon(
18121
+ () => connection.cancel({ sessionId }),
18122
+ (error) => this.safeWarn("acp_client.cancel_failed", { sessionId, error: asErrorMessage(error) })
18123
+ );
18124
+ }
18125
+ // A timed-out config RPC means this transport has already failed to answer
18126
+ // one request. Retire it so the next turn cannot wait forever on another.
18127
+ retireConnection(connection, generation) {
18128
+ if (this.connection !== connection || this.connectionGeneration !== generation) {
18129
+ return;
18130
+ }
18131
+ const handle = this.connectionHandle;
18132
+ this.connectionGeneration++;
18133
+ this.connection = null;
18134
+ this.connectionHandle = null;
18135
+ this.connectionState = null;
18136
+ this.client = null;
18137
+ this.pruneConnectionGeneration(generation);
18138
+ this.connectionRetirements.get(connection)?.reject(new Error("ACP connection retired after a config timeout"));
18139
+ if (handle) {
18140
+ abandon(
18141
+ () => handle.stop(),
18142
+ (error) => this.safeWarn("acp_client.handle_stop_after_config_timeout", { error: asErrorMessage(error) })
18143
+ );
17934
18144
  }
17935
18145
  }
17936
18146
  // The single gate an establishment must pass before it's allowed to claim
@@ -18544,39 +18754,12 @@ async function createTcpConnection(client, endpoint, signal) {
18544
18754
  };
18545
18755
  }
18546
18756
  var MODEL_CONFIG_OPTION_KEY = "model";
18547
- function isSessionConfigSelect(option) {
18548
- return option?.type === "select";
18549
- }
18550
18757
  function isModelConfigOption(option) {
18551
18758
  return isSessionConfigSelect(option) && option.category === MODEL_CONFIG_OPTION_KEY;
18552
18759
  }
18553
18760
  function isModelConfigOptionById(option) {
18554
18761
  return isSessionConfigSelect(option) && option.id === MODEL_CONFIG_OPTION_KEY;
18555
18762
  }
18556
- function flattenConfigSelectOptions(options) {
18557
- if (!Array.isArray(options)) {
18558
- return [];
18559
- }
18560
- return options.flatMap((entry) => {
18561
- if (!asOptionalRecord2(entry)) {
18562
- return [];
18563
- }
18564
- if ("group" in entry) {
18565
- return Array.isArray(entry.options) ? entry.options : [];
18566
- }
18567
- return [entry];
18568
- });
18569
- }
18570
- function isAcpErrorResponse(error) {
18571
- return typeof error === "object" && error !== null && typeof error.code === "number" && typeof error.message === "string";
18572
- }
18573
- function asAcpJsonRpcError(error) {
18574
- if (isAcpErrorResponse(error)) {
18575
- return error;
18576
- }
18577
- const nested = asOptionalRecord2(error)?.error;
18578
- return isAcpErrorResponse(nested) ? nested : void 0;
18579
- }
18580
18763
 
18581
18764
  // src/adapters/acp/ACPServer.ts
18582
18765
  var import_node_stream2 = require("stream");
@@ -18633,6 +18816,7 @@ init_schemas();
18633
18816
  A2AAdapter,
18634
18817
  A2AGatewayAdapter,
18635
18818
  ACPClientAdapter,
18819
+ AcpSessionConfigError,
18636
18820
  Agent,
18637
18821
  AgentFailure,
18638
18822
  AgentRuntime,
@@ -18648,6 +18832,7 @@ init_schemas();
18648
18832
  DEFAULT_OMP_ACP_COMMAND,
18649
18833
  DefaultPreprocessor,
18650
18834
  DeliveryFailedError,
18835
+ FAILURE_CODE_SESSION_CONFIG,
18651
18836
  FAILURE_EVENT_TYPE,
18652
18837
  FAILURE_METADATA_KEY,
18653
18838
  GeminiAdapter,
@@ -18657,6 +18842,7 @@ init_schemas();
18657
18842
  LettaAdapter,
18658
18843
  MCP_SERVER_NAME,
18659
18844
  MCP_TOOL_PREFIX,
18845
+ MISSING_CONFIG_OPTIONS_REASON,
18660
18846
  OmpACPAdapter,
18661
18847
  OpenAIAdapter,
18662
18848
  OpencodeAdapter,
@@ -18669,6 +18855,7 @@ init_schemas();
18669
18855
  VercelAISDKAdapter,
18670
18856
  WebSocketDisconnectError,
18671
18857
  agentFailure,
18858
+ applySessionConfigSelections,
18672
18859
  deliverReply,
18673
18860
  deriveDefaultRestUrl,
18674
18861
  isDirectExecution,
package/dist/index.d.cts CHANGED
@@ -9,7 +9,7 @@ import { P as PlatformMessage } from './types-DtcOLALn.cjs';
9
9
  export { A as AgentConfig, a as AgentInput, C as ContactEvent, b as ContactEventCallback, c as ContactEventConfig, d as ContactEventStrategy, e as ConversationContext, H as HistoryProvider, M as MessageHandler, f as PlatformEvent, R as ReconnectedEvent, S as SessionConfig } from './types-DtcOLALn.cjs';
10
10
  export { W as WebSocketConflictPolicy, a as WebSocketDisconnectError, b as WebSocketDisconnectReason } from './disconnectReason-Cctmg1SN.cjs';
11
11
  export { C as CustomToolDef } from './customTools-Bfecd0mJ.cjs';
12
- export { A as A2AAdapter, a as A2AAdapterOptions, b as A2AGatewayAdapter, c as ACPClientAdapter, d as ACPClientAdapterBaseOptions, e as ACPClientAdapterOptions, f as ACPClientStdioOptions, g as ACPClientTcpOptions, h as ACPConfigRequest, i as ACPConfigSelections, j as AnthropicAdapter, k as AnthropicAdapterOptions, C as CODEX_REASONING_EFFORTS, l as CODEX_REASONING_SUMMARIES, m as CODEX_WEB_SEARCH_MODES, n as ClaudePermissionMode, o as ClaudeSDKAdapter, p as ClaudeSDKAdapterOptions, q as CodexAdapter, r as CodexAdapterConfig, s as CodexApprovalPolicy, t as CodexReasoningEffort, u as CodexReasoningSummary, v as CodexSandboxMode, w as CodexWebSearchMode, x as CopilotACPAdapter, y as CopilotACPAdapterOptions, z as CopilotACPStdioOptions, B as CopilotACPTcpOptions, D as DEFAULT_COPILOT_ACP_COMMAND, E as DEFAULT_OMP_ACP_COMMAND, G as GeminiAdapter, F as GeminiAdapterOptions, H as GenericAdapter, I as GenericAdapterHandler, J as GoogleADKAdapter, K as GoogleADKAdapterOptions, L as LangGraphAdapter, M as LangGraphAdapterOptions, N as LangGraphGraph, O as LettaAdapter, P as LettaAdapterOptions, Q as OmpACPAdapter, R as OmpACPAdapterOptions, S as OpenAIAdapter, T as OpenAIAdapterOptions, U as OpencodeAdapter, V as OpencodeAdapterConfig, W as OpencodeApprovalMode, X as OpencodeApprovalReply, Y as OpencodeQuestionMode, Z as ParlantAdapter, _ as ParlantAdapterOptions, $ as ToolCallingModel, a0 as VercelAISDKAdapter, a1 as VercelAISDKAdapterOptions } from './CopilotACPAdapter-Clid9xGR.cjs';
12
+ export { A as A2AAdapter, a as A2AAdapterOptions, b as A2AGatewayAdapter, c as ACPClientAdapter, d as ACPClientAdapterBaseOptions, e as ACPClientAdapterOptions, f as ACPClientStdioOptions, g as ACPClientTcpOptions, h as ACPConfigRequest, i as ACPConfigSelections, j as AcpSessionConfigError, k as AnthropicAdapter, l as AnthropicAdapterOptions, C as CODEX_REASONING_EFFORTS, m as CODEX_REASONING_SUMMARIES, n as CODEX_WEB_SEARCH_MODES, o as ClaudePermissionMode, p as ClaudeSDKAdapter, q as ClaudeSDKAdapterOptions, r as CodexAdapter, s as CodexAdapterConfig, t as CodexApprovalPolicy, u as CodexReasoningEffort, v as CodexReasoningSummary, w as CodexSandboxMode, x as CodexWebSearchMode, y as CopilotACPAdapter, z as CopilotACPAdapterOptions, B as CopilotACPStdioOptions, D as CopilotACPTcpOptions, E as DEFAULT_COPILOT_ACP_COMMAND, F as DEFAULT_OMP_ACP_COMMAND, G as FAILURE_CODE_SESSION_CONFIG, H as GeminiAdapter, I as GeminiAdapterOptions, J as GenericAdapter, K as GenericAdapterHandler, L as GoogleADKAdapter, M as GoogleADKAdapterOptions, N as LangGraphAdapter, O as LangGraphAdapterOptions, P as LangGraphGraph, Q as LettaAdapter, R as LettaAdapterOptions, S as MISSING_CONFIG_OPTIONS_REASON, T as OmpACPAdapter, U as OmpACPAdapterOptions, V as OpenAIAdapter, W as OpenAIAdapterOptions, X as OpencodeAdapter, Y as OpencodeAdapterConfig, Z as OpencodeApprovalMode, _ as OpencodeApprovalReply, $ as OpencodeQuestionMode, a0 as ParlantAdapter, a1 as ParlantAdapterOptions, a2 as ToolCallingModel, a3 as VercelAISDKAdapter, a4 as VercelAISDKAdapterOptions, a5 as applySessionConfigSelections } from './CopilotACPAdapter-HRvat7CP.cjs';
13
13
  export { S as SimpleAdapter } from './simpleAdapter-D75rcz9n.cjs';
14
14
  export { A as A2AAuth, a as A2AGatewayAdapterOptions } from './acp-client-D-I_5lK-.cjs';
15
15
  export { AgentFailure } from '@band-ai/band-sdk-core';
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import { P as PlatformMessage } from './types-CKU1N0SK.js';
9
9
  export { A as AgentConfig, a as AgentInput, C as ContactEvent, b as ContactEventCallback, c as ContactEventConfig, d as ContactEventStrategy, e as ConversationContext, H as HistoryProvider, M as MessageHandler, f as PlatformEvent, R as ReconnectedEvent, S as SessionConfig } from './types-CKU1N0SK.js';
10
10
  export { W as WebSocketConflictPolicy, a as WebSocketDisconnectError, b as WebSocketDisconnectReason } from './disconnectReason-Cctmg1SN.js';
11
11
  export { C as CustomToolDef } from './customTools-Bfecd0mJ.js';
12
- export { A as A2AAdapter, a as A2AAdapterOptions, b as A2AGatewayAdapter, c as ACPClientAdapter, d as ACPClientAdapterBaseOptions, e as ACPClientAdapterOptions, f as ACPClientStdioOptions, g as ACPClientTcpOptions, h as ACPConfigRequest, i as ACPConfigSelections, j as AnthropicAdapter, k as AnthropicAdapterOptions, C as CODEX_REASONING_EFFORTS, l as CODEX_REASONING_SUMMARIES, m as CODEX_WEB_SEARCH_MODES, n as ClaudePermissionMode, o as ClaudeSDKAdapter, p as ClaudeSDKAdapterOptions, q as CodexAdapter, r as CodexAdapterConfig, s as CodexApprovalPolicy, t as CodexReasoningEffort, u as CodexReasoningSummary, v as CodexSandboxMode, w as CodexWebSearchMode, x as CopilotACPAdapter, y as CopilotACPAdapterOptions, z as CopilotACPStdioOptions, B as CopilotACPTcpOptions, D as DEFAULT_COPILOT_ACP_COMMAND, E as DEFAULT_OMP_ACP_COMMAND, G as GeminiAdapter, F as GeminiAdapterOptions, H as GenericAdapter, I as GenericAdapterHandler, J as GoogleADKAdapter, K as GoogleADKAdapterOptions, L as LangGraphAdapter, M as LangGraphAdapterOptions, N as LangGraphGraph, O as LettaAdapter, P as LettaAdapterOptions, Q as OmpACPAdapter, R as OmpACPAdapterOptions, S as OpenAIAdapter, T as OpenAIAdapterOptions, U as OpencodeAdapter, V as OpencodeAdapterConfig, W as OpencodeApprovalMode, X as OpencodeApprovalReply, Y as OpencodeQuestionMode, Z as ParlantAdapter, _ as ParlantAdapterOptions, $ as ToolCallingModel, a0 as VercelAISDKAdapter, a1 as VercelAISDKAdapterOptions } from './CopilotACPAdapter-B_AVyAl6.js';
12
+ export { A as A2AAdapter, a as A2AAdapterOptions, b as A2AGatewayAdapter, c as ACPClientAdapter, d as ACPClientAdapterBaseOptions, e as ACPClientAdapterOptions, f as ACPClientStdioOptions, g as ACPClientTcpOptions, h as ACPConfigRequest, i as ACPConfigSelections, j as AcpSessionConfigError, k as AnthropicAdapter, l as AnthropicAdapterOptions, C as CODEX_REASONING_EFFORTS, m as CODEX_REASONING_SUMMARIES, n as CODEX_WEB_SEARCH_MODES, o as ClaudePermissionMode, p as ClaudeSDKAdapter, q as ClaudeSDKAdapterOptions, r as CodexAdapter, s as CodexAdapterConfig, t as CodexApprovalPolicy, u as CodexReasoningEffort, v as CodexReasoningSummary, w as CodexSandboxMode, x as CodexWebSearchMode, y as CopilotACPAdapter, z as CopilotACPAdapterOptions, B as CopilotACPStdioOptions, D as CopilotACPTcpOptions, E as DEFAULT_COPILOT_ACP_COMMAND, F as DEFAULT_OMP_ACP_COMMAND, G as FAILURE_CODE_SESSION_CONFIG, H as GeminiAdapter, I as GeminiAdapterOptions, J as GenericAdapter, K as GenericAdapterHandler, L as GoogleADKAdapter, M as GoogleADKAdapterOptions, N as LangGraphAdapter, O as LangGraphAdapterOptions, P as LangGraphGraph, Q as LettaAdapter, R as LettaAdapterOptions, S as MISSING_CONFIG_OPTIONS_REASON, T as OmpACPAdapter, U as OmpACPAdapterOptions, V as OpenAIAdapter, W as OpenAIAdapterOptions, X as OpencodeAdapter, Y as OpencodeAdapterConfig, Z as OpencodeApprovalMode, _ as OpencodeApprovalReply, $ as OpencodeQuestionMode, a0 as ParlantAdapter, a1 as ParlantAdapterOptions, a2 as ToolCallingModel, a3 as VercelAISDKAdapter, a4 as VercelAISDKAdapterOptions, a5 as applySessionConfigSelections } from './CopilotACPAdapter-Bj6NRdqd.js';
13
13
  export { S as SimpleAdapter } from './simpleAdapter-eLvsAQNo.js';
14
14
  export { A as A2AAuth, a as A2AGatewayAdapterOptions } from './acp-client-DUXyczlF.js';
15
15
  export { AgentFailure } from '@band-ai/band-sdk-core';
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  ACPClientAdapter,
3
+ AcpSessionConfigError,
3
4
  AnthropicAdapter,
4
5
  CODEX_REASONING_EFFORTS,
5
6
  CODEX_REASONING_SUMMARIES,
@@ -9,16 +10,19 @@ import {
9
10
  CopilotACPAdapter,
10
11
  DEFAULT_COPILOT_ACP_COMMAND,
11
12
  DEFAULT_OMP_ACP_COMMAND,
13
+ FAILURE_CODE_SESSION_CONFIG,
12
14
  GeminiAdapter,
13
15
  GenericAdapter,
14
16
  GoogleADKAdapter,
15
17
  LangGraphAdapter,
16
18
  LettaAdapter,
19
+ MISSING_CONFIG_OPTIONS_REASON,
17
20
  OmpACPAdapter,
18
21
  OpenAIAdapter,
19
22
  OpencodeAdapter,
20
- VercelAISDKAdapter
21
- } from "./chunk-UFO6XMCV.js";
23
+ VercelAISDKAdapter,
24
+ applySessionConfigSelections
25
+ } from "./chunk-KXLV645N.js";
22
26
  import "./chunk-UL3Y5C4J.js";
23
27
  import "./chunk-JDW5WSGF.js";
24
28
  import {
@@ -267,6 +271,7 @@ export {
267
271
  A2AAdapter,
268
272
  A2AGatewayAdapter,
269
273
  ACPClientAdapter,
274
+ AcpSessionConfigError,
270
275
  Agent,
271
276
  AgentFailure,
272
277
  AgentRuntime,
@@ -282,6 +287,7 @@ export {
282
287
  DEFAULT_OMP_ACP_COMMAND,
283
288
  DefaultPreprocessor,
284
289
  DeliveryFailedError,
290
+ FAILURE_CODE_SESSION_CONFIG,
285
291
  FAILURE_EVENT_TYPE,
286
292
  FAILURE_METADATA_KEY,
287
293
  GeminiAdapter,
@@ -291,6 +297,7 @@ export {
291
297
  LettaAdapter,
292
298
  MCP_SERVER_NAME,
293
299
  MCP_TOOL_PREFIX,
300
+ MISSING_CONFIG_OPTIONS_REASON,
294
301
  OmpACPAdapter,
295
302
  OpenAIAdapter,
296
303
  OpencodeAdapter,
@@ -303,6 +310,7 @@ export {
303
310
  VercelAISDKAdapter,
304
311
  WebSocketDisconnectError,
305
312
  agentFailure,
313
+ applySessionConfigSelections,
306
314
  deliverReply,
307
315
  deriveDefaultRestUrl,
308
316
  isDirectExecution,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@band-ai/sdk",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Band TypeScript SDK core runtime",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -82,7 +82,13 @@
82
82
  "lint": "eslint .",
83
83
  "clean": "rm -rf dist",
84
84
  "dev:linear": "tsx --env-file-if-exists=.env.local examples/linear-band/linear-band-bridge-server.ts",
85
- "start:linear": "tsx examples/linear-band/linear-band-bridge-server.ts"
85
+ "start:linear": "tsx examples/linear-band/linear-band-bridge-server.ts",
86
+ "examples:config": "python3 scripts/generate-agent-config-for-examples.py",
87
+ "examples:a2a-stub": "node scripts/a2a-stub-server.mjs",
88
+ "examples:discover": "node scripts/examples-discover.mjs",
89
+ "examples:smoke": "node scripts/examples-smoke-startup.mjs --env-file ../../.env.test",
90
+ "examples:run-plan": "tsx --env-file ../../.env.test scripts/example-runner.ts",
91
+ "examples:tom-jerry": "tsx --env-file ../../.env.test scripts/tom-jerry-cross-room.ts"
86
92
  },
87
93
  "engines": {
88
94
  "node": ">=22.12"