@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/adapters.cjs CHANGED
@@ -978,6 +978,7 @@ __export(adapters_exports, {
978
978
  A2AHistoryConverter: () => A2AHistoryConverter,
979
979
  ACPClientAdapter: () => ACPClientAdapter,
980
980
  ACPServer: () => ACPServer,
981
+ AcpSessionConfigError: () => AcpSessionConfigError,
981
982
  AnthropicAdapter: () => AnthropicAdapter,
982
983
  AnthropicToolCallingModel: () => AnthropicToolCallingModel,
983
984
  BandACPServerAdapter: () => BandACPServerAdapter,
@@ -991,6 +992,7 @@ __export(adapters_exports, {
991
992
  CopilotACPAdapter: () => CopilotACPAdapter,
992
993
  DEFAULT_COPILOT_ACP_COMMAND: () => DEFAULT_COPILOT_ACP_COMMAND,
993
994
  DEFAULT_OMP_ACP_COMMAND: () => DEFAULT_OMP_ACP_COMMAND,
995
+ FAILURE_CODE_SESSION_CONFIG: () => FAILURE_CODE_SESSION_CONFIG,
994
996
  GatewayHistoryConverter: () => GatewayHistoryConverter,
995
997
  GatewayServer: () => GatewayServer,
996
998
  GeminiAdapter: () => GeminiAdapter,
@@ -1002,6 +1004,7 @@ __export(adapters_exports, {
1002
1004
  LangGraphAdapter: () => LangGraphAdapter,
1003
1005
  LettaAdapter: () => LettaAdapter,
1004
1006
  LettaHistoryConverter: () => LettaHistoryConverter,
1007
+ MISSING_CONFIG_OPTIONS_REASON: () => MISSING_CONFIG_OPTIONS_REASON,
1005
1008
  OmpACPAdapter: () => OmpACPAdapter,
1006
1009
  OpenAIAdapter: () => OpenAIAdapter,
1007
1010
  OpenAIToolCallingModel: () => OpenAIToolCallingModel,
@@ -1011,6 +1014,7 @@ __export(adapters_exports, {
1011
1014
  ToolCallingAdapter: () => ToolCallingAdapter,
1012
1015
  VercelAISDKAdapter: () => VercelAISDKAdapter,
1013
1016
  VercelAISDKToolCallingModel: () => VercelAISDKToolCallingModel,
1017
+ applySessionConfigSelections: () => applySessionConfigSelections,
1014
1018
  buildA2AAuthHeaders: () => buildA2AAuthHeaders,
1015
1019
  createGatewayServer: () => createGatewayServer,
1016
1020
  runSingleToolRound: () => runSingleToolRound
@@ -1730,6 +1734,149 @@ function abandon(operation, onError = () => void 0) {
1730
1734
  void Promise.resolve().then(operation).catch(onError);
1731
1735
  }
1732
1736
 
1737
+ // src/adapters/acp/sessionConfigReconciliation.ts
1738
+ var FAILURE_CODE_SESSION_CONFIG = "session_config";
1739
+ var MISSING_CONFIG_OPTIONS_REASON = "missing_config_options";
1740
+ var AcpSessionConfigTimeoutError = class extends Error {
1741
+ };
1742
+ var AcpSessionConfigError = class extends Error {
1743
+ provider;
1744
+ sessionId;
1745
+ optionId;
1746
+ selectedValue;
1747
+ acpCode;
1748
+ detail;
1749
+ timedOut;
1750
+ constructor(input) {
1751
+ super(input.message, input.cause !== void 0 ? { cause: input.cause } : void 0);
1752
+ this.name = "AcpSessionConfigError";
1753
+ this.provider = input.provider;
1754
+ this.sessionId = input.sessionId;
1755
+ this.optionId = input.optionId;
1756
+ this.selectedValue = input.selectedValue;
1757
+ this.acpCode = input.acpCode;
1758
+ this.detail = input.detail;
1759
+ this.timedOut = input.timedOut ?? false;
1760
+ }
1761
+ toAgentFailure() {
1762
+ return agentFailure(
1763
+ this.provider,
1764
+ this.message,
1765
+ this.acpCode !== void 0 ? String(this.acpCode) : FAILURE_CODE_SESSION_CONFIG,
1766
+ {
1767
+ sessionId: this.sessionId,
1768
+ optionId: this.optionId,
1769
+ selectedValue: this.selectedValue,
1770
+ detail: this.detail
1771
+ }
1772
+ );
1773
+ }
1774
+ };
1775
+ async function applySessionConfigSelections(input) {
1776
+ let catalog = input.catalog;
1777
+ for (const { configId, value: selectedValue } of sessionConfigSelectionEntries(input.selections)) {
1778
+ if (selectedValue === void 0) {
1779
+ continue;
1780
+ }
1781
+ const option = catalog.find((entry) => entry?.id === configId);
1782
+ if (!option || !isSessionConfigSelect(option)) {
1783
+ throw new AcpSessionConfigError({
1784
+ provider: input.provider,
1785
+ sessionId: input.sessionId,
1786
+ optionId: configId,
1787
+ selectedValue,
1788
+ message: `Session config option "${configId}" is not available after prior selections.`
1789
+ });
1790
+ }
1791
+ if (selectedValue === option.currentValue) {
1792
+ continue;
1793
+ }
1794
+ const availableValues = flattenConfigSelectOptions(option.options).map((entry) => entry.value);
1795
+ if (!availableValues.includes(selectedValue)) {
1796
+ throw new AcpSessionConfigError({
1797
+ provider: input.provider,
1798
+ sessionId: input.sessionId,
1799
+ optionId: configId,
1800
+ selectedValue,
1801
+ message: `Session config value "${selectedValue}" is not advertised for option "${configId}".`,
1802
+ detail: { availableValues }
1803
+ });
1804
+ }
1805
+ const timeoutMessage = `setSessionConfigOption did not respond within ${input.timeoutMs}ms`;
1806
+ try {
1807
+ const response = await withTimeout(
1808
+ input.setOption({ sessionId: input.sessionId, configId, value: selectedValue }),
1809
+ input.timeoutMs,
1810
+ () => new AcpSessionConfigTimeoutError(timeoutMessage)
1811
+ );
1812
+ if (!Array.isArray(response?.configOptions)) {
1813
+ throw new AcpSessionConfigError({
1814
+ provider: input.provider,
1815
+ sessionId: input.sessionId,
1816
+ optionId: configId,
1817
+ selectedValue,
1818
+ message: `Session config option "${configId}" response did not include a refreshed catalog.`,
1819
+ detail: { reason: MISSING_CONFIG_OPTIONS_REASON }
1820
+ });
1821
+ }
1822
+ catalog = response.configOptions;
1823
+ } catch (error) {
1824
+ if (error instanceof AcpSessionConfigError) {
1825
+ throw error;
1826
+ }
1827
+ const acpError = asAcpJsonRpcError(error);
1828
+ throw new AcpSessionConfigError({
1829
+ provider: input.provider,
1830
+ sessionId: input.sessionId,
1831
+ optionId: configId,
1832
+ selectedValue,
1833
+ acpCode: acpError?.code,
1834
+ detail: acpError?.data,
1835
+ message: acpError?.message ?? asErrorMessage(error),
1836
+ cause: error,
1837
+ timedOut: error instanceof AcpSessionConfigTimeoutError
1838
+ });
1839
+ }
1840
+ }
1841
+ return { catalog };
1842
+ }
1843
+ function sessionConfigSelectionEntries(selections) {
1844
+ if (isOrderedSessionConfigSelections(selections)) {
1845
+ return selections;
1846
+ }
1847
+ return Object.keys(selections).map((configId) => ({ configId, value: selections[configId] }));
1848
+ }
1849
+ function isOrderedSessionConfigSelections(selections) {
1850
+ return Array.isArray(selections);
1851
+ }
1852
+ function isSessionConfigSelect(option) {
1853
+ return option?.type === "select";
1854
+ }
1855
+ function flattenConfigSelectOptions(options) {
1856
+ if (!Array.isArray(options)) {
1857
+ return [];
1858
+ }
1859
+ return options.flatMap((entry) => {
1860
+ if (!asOptionalRecord2(entry)) {
1861
+ return [];
1862
+ }
1863
+ if ("group" in entry) {
1864
+ return Array.isArray(entry.options) ? entry.options : [];
1865
+ }
1866
+ return [entry];
1867
+ });
1868
+ }
1869
+ function isAcpErrorResponse(error) {
1870
+ return typeof error === "object" && error !== null && typeof error.code === "number" && typeof error.message === "string";
1871
+ }
1872
+ function asAcpJsonRpcError(error) {
1873
+ if (isAcpErrorResponse(error)) {
1874
+ return error;
1875
+ }
1876
+ const nested = asOptionalRecord2(error)?.error;
1877
+ return isAcpErrorResponse(nested) ? nested : void 0;
1878
+ }
1879
+
1733
1880
  // src/adapters/acp/ACPClientAdapter.ts
1734
1881
  init_chatEvents();
1735
1882
  init_schemas();
@@ -2546,6 +2693,13 @@ var acpModule = new LazyAsyncValue({
2546
2693
  });
2547
2694
 
2548
2695
  // src/adapters/acp/ACPClientAdapter.ts
2696
+ function createConnectionRetirement() {
2697
+ let reject = () => void 0;
2698
+ const promise = new Promise((_resolve, rejectPromise) => {
2699
+ reject = rejectPromise;
2700
+ });
2701
+ return { promise, reject };
2702
+ }
2549
2703
  var DEFAULT_PERMISSION_TIMEOUT_MS = 5 * 6e4;
2550
2704
  var DEFAULT_TURN_TIMEOUT_MS = 60 * 6e4;
2551
2705
  var SET_SESSION_CONFIG_TIMEOUT_MS = 1e4;
@@ -2603,6 +2757,7 @@ var ACPClientAdapter = class extends SimpleAdapter {
2603
2757
  permissionTimeoutMs;
2604
2758
  turnTimeoutMs;
2605
2759
  logger;
2760
+ customSection;
2606
2761
  backend = null;
2607
2762
  backendPromise = null;
2608
2763
  client = null;
@@ -2613,6 +2768,7 @@ var ACPClientAdapter = class extends SimpleAdapter {
2613
2768
  started = false;
2614
2769
  systemPrompt = "";
2615
2770
  spawnPromise = null;
2771
+ connectionRetirements = /* @__PURE__ */ new WeakMap();
2616
2772
  // Bumped by `stop()` and on every successful spawn install. Cleanup/timeout
2617
2773
  // and permission maps key by this plus session id so a stale generation
2618
2774
  // cannot alias a same-id session on a newer connection.
@@ -2639,6 +2795,7 @@ var ACPClientAdapter = class extends SimpleAdapter {
2639
2795
  this.resolveSessionModel = options.resolveSessionModel;
2640
2796
  this.resolveSessionConfig = options.resolveSessionConfig;
2641
2797
  this.logger = resolveLogger(options.logger);
2798
+ this.customSection = options.customSection;
2642
2799
  this.permissionTimeoutMs = options.permissionTimeoutMs ?? DEFAULT_PERMISSION_TIMEOUT_MS;
2643
2800
  if ((this.resolvePermission || this.resolveSessionMode || this.resolveSessionModel || this.resolveSessionConfig) && (!Number.isFinite(this.permissionTimeoutMs) || this.permissionTimeoutMs <= 0)) {
2644
2801
  throw new ValidationError(`permissionTimeoutMs must be a positive finite number, got ${options.permissionTimeoutMs}`);
@@ -2670,7 +2827,8 @@ var ACPClientAdapter = class extends SimpleAdapter {
2670
2827
  this.systemPrompt = renderSystemPrompt({
2671
2828
  agentName,
2672
2829
  agentDescription,
2673
- includeBaseInstructions: false
2830
+ includeBaseInstructions: false,
2831
+ customSection: this.customSection
2674
2832
  });
2675
2833
  await this.ensureConnection();
2676
2834
  }
@@ -2703,13 +2861,17 @@ var ACPClientAdapter = class extends SimpleAdapter {
2703
2861
 
2704
2862
  ${messageWithContext}`;
2705
2863
  this.bootstrappedSessions.add(sessionKey);
2706
- const response = await withTimeout(connection.prompt({
2707
- sessionId,
2708
- prompt: [{
2709
- type: "text",
2710
- text: promptText
2711
- }]
2712
- }), this.turnTimeoutMs, () => new AcpTurnTimeoutError());
2864
+ const response = await withTimeout(
2865
+ this.raceAgainstConnectionRetirement(connection, connection.prompt({
2866
+ sessionId,
2867
+ prompt: [{
2868
+ type: "text",
2869
+ text: promptText
2870
+ }]
2871
+ })),
2872
+ this.turnTimeoutMs,
2873
+ () => new AcpTurnTimeoutError()
2874
+ );
2713
2875
  await this.flushChunks({
2714
2876
  client,
2715
2877
  tools,
@@ -2750,12 +2912,17 @@ ${messageWithContext}`;
2750
2912
  }
2751
2913
  }
2752
2914
  }
2753
- const acpError = asAcpJsonRpcError(error);
2915
+ const configError = error instanceof AcpSessionConfigError ? error : void 0;
2916
+ const acpError = configError ? void 0 : asAcpJsonRpcError(error);
2754
2917
  await reportTurnFailure(
2755
2918
  tools,
2756
- 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)),
2919
+ 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)),
2757
2920
  this.logger,
2758
- { roomId: context.roomId, sessionId }
2921
+ {
2922
+ roomId: context.roomId,
2923
+ sessionId: configError?.sessionId ?? sessionId,
2924
+ ...configError ? { optionId: configError.optionId, selectedValue: configError.selectedValue } : {}
2925
+ }
2759
2926
  );
2760
2927
  }
2761
2928
  }
@@ -2774,17 +2941,12 @@ ${messageWithContext}`;
2774
2941
  // would risk blocking this room's turn lock forever on the very process
2775
2942
  // that just proved it can hang.
2776
2943
  async abandonTimedOutTurn(connection, sessionId, generation) {
2777
- const key = this.sessionKey(generation, sessionId);
2778
- this.activeSessions.delete(key);
2779
- this.abandonedSessions.add(key);
2780
- const owner = [...this.roomToSession.entries()].find(([, value]) => value.sessionId === sessionId && value.generation === generation);
2781
- if (owner) {
2782
- this.unlinkOwner(owner[0], owner[1]);
2783
- }
2784
- abandon(
2785
- () => connection.cancel({ sessionId }),
2786
- (error) => this.safeWarn("acp_client.cancel_failed", { sessionId, error: asErrorMessage(error) })
2787
- );
2944
+ this.evictAbandonedSession(sessionId, generation, connection, () => {
2945
+ const owner = [...this.roomToSession.entries()].find(([, value]) => value.sessionId === sessionId && value.generation === generation);
2946
+ if (owner) {
2947
+ this.unlinkOwner(owner[0], owner[1]);
2948
+ }
2949
+ });
2788
2950
  }
2789
2951
  // A per-room async mutex: `fn` for a given `roomId` never overlaps another
2790
2952
  // call for that same room, while different rooms stay fully concurrent.
@@ -2910,6 +3072,11 @@ ${messageWithContext}`;
2910
3072
  void connection.closed.then(() => reject(new Error("ACP connection closed while a session operation was still in flight")));
2911
3073
  return Promise.race([operation, closedRejection]);
2912
3074
  }
3075
+ raceAgainstConnectionRetirement(connection, operation) {
3076
+ const retirement = this.connectionRetirements.get(connection) ?? createConnectionRetirement();
3077
+ this.connectionRetirements.set(connection, retirement);
3078
+ return Promise.race([operation, retirement.promise]);
3079
+ }
2913
3080
  unlinkRoom(roomId) {
2914
3081
  const owner = this.roomToSession.get(roomId);
2915
3082
  if (owner) {
@@ -3054,7 +3221,7 @@ ${messageWithContext}`;
3054
3221
  this.activeSessions.add(restoredKey);
3055
3222
  this.bootstrappedSessions.add(restoredKey);
3056
3223
  await this.configureSessionMode(roomId, existingSessionId, restored.modes, connection);
3057
- await this.configureSessionConfig(roomId, existingSessionId, restored.configOptions, connection);
3224
+ await this.configureSessionConfig(roomId, existingSessionId, restored.configOptions, connection, connectionGeneration, client);
3058
3225
  if (!this.resolveSessionConfig) {
3059
3226
  await this.configureSessionModel(roomId, existingSessionId, restored.configOptions, connection);
3060
3227
  }
@@ -3068,13 +3235,13 @@ ${messageWithContext}`;
3068
3235
  this.linkOrAbandon(roomId, created.sessionId, generation, connectionGeneration, client);
3069
3236
  this.activeSessions.add(this.sessionKey(connectionGeneration, created.sessionId));
3070
3237
  await this.configureSessionMode(roomId, created.sessionId, created.modes, connection);
3071
- await this.configureSessionConfig(roomId, created.sessionId, created.configOptions, connection);
3238
+ await this.configureSessionConfig(roomId, created.sessionId, created.configOptions, connection, connectionGeneration, client);
3072
3239
  if (!this.resolveSessionConfig) {
3073
3240
  await this.configureSessionModel(roomId, created.sessionId, created.configOptions, connection);
3074
3241
  }
3075
3242
  return created.sessionId;
3076
3243
  }
3077
- async configureSessionConfig(roomId, sessionId, configOptions, connection) {
3244
+ async configureSessionConfig(roomId, sessionId, configOptions, connection, connectionGeneration, client) {
3078
3245
  if (!this.resolveSessionConfig || !Array.isArray(configOptions) || configOptions.length === 0) {
3079
3246
  return;
3080
3247
  }
@@ -3087,35 +3254,76 @@ ${messageWithContext}`;
3087
3254
  if (!selections) {
3088
3255
  return;
3089
3256
  }
3090
- for (const option of advertisedOptions) {
3091
- const selectedValue = selections[option.id];
3092
- if (selectedValue === void 0 || selectedValue === option.currentValue || !isSessionConfigSelect(option)) {
3093
- continue;
3094
- }
3095
- const availableValues = flattenConfigSelectOptions(option.options).map((entry) => entry.value);
3096
- if (!availableValues.includes(selectedValue)) {
3097
- this.safeWarn("resolveSessionConfig selected a value this session does not advertise", {
3098
- sessionId,
3099
- configId: option.id,
3100
- selectedValue,
3101
- availableValues
3102
- });
3103
- continue;
3104
- }
3105
- try {
3106
- await withTimeout(
3107
- connection.setSessionConfigOption({ sessionId, configId: option.id, value: selectedValue }),
3108
- SET_SESSION_CONFIG_TIMEOUT_MS,
3109
- `setSessionConfigOption did not respond within ${SET_SESSION_CONFIG_TIMEOUT_MS}ms`
3110
- );
3111
- } catch (error) {
3112
- this.safeWarn("failed to switch session config option", {
3113
- sessionId,
3114
- configId: option.id,
3115
- selectedValue,
3116
- error: String(error)
3117
- });
3257
+ try {
3258
+ await applySessionConfigSelections({
3259
+ provider: this.provider,
3260
+ sessionId,
3261
+ catalog: advertisedOptions,
3262
+ selections,
3263
+ setOption: (params) => connection.setSessionConfigOption(params),
3264
+ timeoutMs: SET_SESSION_CONFIG_TIMEOUT_MS
3265
+ });
3266
+ } catch (error) {
3267
+ this.abandonFailedConfigSession(
3268
+ roomId,
3269
+ sessionId,
3270
+ connectionGeneration,
3271
+ client,
3272
+ connection,
3273
+ error instanceof AcpSessionConfigError && error.timedOut
3274
+ );
3275
+ throw error;
3276
+ }
3277
+ }
3278
+ // A config failure mid-establish must not leave a half-applied session
3279
+ // active for the room: the next turn needs a fresh `newSession` catalog.
3280
+ abandonFailedConfigSession(roomId, sessionId, connectionGeneration, client, connection, retireConnection) {
3281
+ const key = this.sessionKey(connectionGeneration, sessionId);
3282
+ this.bootstrappedSessions.delete(key);
3283
+ client.resetChunks(sessionId);
3284
+ this.evictAbandonedSession(sessionId, connectionGeneration, connection, () => {
3285
+ const owner = this.roomToSession.get(roomId);
3286
+ if (owner && owner.sessionId === sessionId && owner.generation === connectionGeneration) {
3287
+ this.unlinkOwner(roomId, owner);
3118
3288
  }
3289
+ });
3290
+ if (retireConnection) {
3291
+ this.retireConnection(connection, connectionGeneration);
3292
+ }
3293
+ }
3294
+ // Common half of timeout and config-failure abandon: mark the session
3295
+ // unusable for restore, unlink ownership, and best-effort cancel.
3296
+ evictAbandonedSession(sessionId, connectionGeneration, connection, unlink) {
3297
+ const key = this.sessionKey(connectionGeneration, sessionId);
3298
+ const wasActive = this.activeSessions.delete(key);
3299
+ if (wasActive) {
3300
+ this.abandonedSessions.add(key);
3301
+ }
3302
+ unlink();
3303
+ abandon(
3304
+ () => connection.cancel({ sessionId }),
3305
+ (error) => this.safeWarn("acp_client.cancel_failed", { sessionId, error: asErrorMessage(error) })
3306
+ );
3307
+ }
3308
+ // A timed-out config RPC means this transport has already failed to answer
3309
+ // one request. Retire it so the next turn cannot wait forever on another.
3310
+ retireConnection(connection, generation) {
3311
+ if (this.connection !== connection || this.connectionGeneration !== generation) {
3312
+ return;
3313
+ }
3314
+ const handle = this.connectionHandle;
3315
+ this.connectionGeneration++;
3316
+ this.connection = null;
3317
+ this.connectionHandle = null;
3318
+ this.connectionState = null;
3319
+ this.client = null;
3320
+ this.pruneConnectionGeneration(generation);
3321
+ this.connectionRetirements.get(connection)?.reject(new Error("ACP connection retired after a config timeout"));
3322
+ if (handle) {
3323
+ abandon(
3324
+ () => handle.stop(),
3325
+ (error) => this.safeWarn("acp_client.handle_stop_after_config_timeout", { error: asErrorMessage(error) })
3326
+ );
3119
3327
  }
3120
3328
  }
3121
3329
  // The single gate an establishment must pass before it's allowed to claim
@@ -3729,39 +3937,12 @@ async function createTcpConnection(client, endpoint, signal) {
3729
3937
  };
3730
3938
  }
3731
3939
  var MODEL_CONFIG_OPTION_KEY = "model";
3732
- function isSessionConfigSelect(option) {
3733
- return option?.type === "select";
3734
- }
3735
3940
  function isModelConfigOption(option) {
3736
3941
  return isSessionConfigSelect(option) && option.category === MODEL_CONFIG_OPTION_KEY;
3737
3942
  }
3738
3943
  function isModelConfigOptionById(option) {
3739
3944
  return isSessionConfigSelect(option) && option.id === MODEL_CONFIG_OPTION_KEY;
3740
3945
  }
3741
- function flattenConfigSelectOptions(options) {
3742
- if (!Array.isArray(options)) {
3743
- return [];
3744
- }
3745
- return options.flatMap((entry) => {
3746
- if (!asOptionalRecord2(entry)) {
3747
- return [];
3748
- }
3749
- if ("group" in entry) {
3750
- return Array.isArray(entry.options) ? entry.options : [];
3751
- }
3752
- return [entry];
3753
- });
3754
- }
3755
- function isAcpErrorResponse(error) {
3756
- return typeof error === "object" && error !== null && typeof error.code === "number" && typeof error.message === "string";
3757
- }
3758
- function asAcpJsonRpcError(error) {
3759
- if (isAcpErrorResponse(error)) {
3760
- return error;
3761
- }
3762
- const nested = asOptionalRecord2(error)?.error;
3763
- return isAcpErrorResponse(nested) ? nested : void 0;
3764
- }
3765
3946
 
3766
3947
  // src/adapters/acp/ACPServer.ts
3767
3948
  var import_node_stream2 = require("stream");
@@ -12864,6 +13045,7 @@ function parseModelListResponse(value) {
12864
13045
  A2AHistoryConverter,
12865
13046
  ACPClientAdapter,
12866
13047
  ACPServer,
13048
+ AcpSessionConfigError,
12867
13049
  AnthropicAdapter,
12868
13050
  AnthropicToolCallingModel,
12869
13051
  BandACPServerAdapter,
@@ -12877,6 +13059,7 @@ function parseModelListResponse(value) {
12877
13059
  CopilotACPAdapter,
12878
13060
  DEFAULT_COPILOT_ACP_COMMAND,
12879
13061
  DEFAULT_OMP_ACP_COMMAND,
13062
+ FAILURE_CODE_SESSION_CONFIG,
12880
13063
  GatewayHistoryConverter,
12881
13064
  GatewayServer,
12882
13065
  GeminiAdapter,
@@ -12888,6 +13071,7 @@ function parseModelListResponse(value) {
12888
13071
  LangGraphAdapter,
12889
13072
  LettaAdapter,
12890
13073
  LettaHistoryConverter,
13074
+ MISSING_CONFIG_OPTIONS_REASON,
12891
13075
  OmpACPAdapter,
12892
13076
  OpenAIAdapter,
12893
13077
  OpenAIToolCallingModel,
@@ -12897,6 +13081,7 @@ function parseModelListResponse(value) {
12897
13081
  ToolCallingAdapter,
12898
13082
  VercelAISDKAdapter,
12899
13083
  VercelAISDKToolCallingModel,
13084
+ applySessionConfigSelections,
12900
13085
  buildA2AAuthHeaders,
12901
13086
  createGatewayServer,
12902
13087
  runSingleToolRound
@@ -1,4 +1,4 @@
1
- export { A as A2AAdapter, a as A2AAdapterOptions, a2 as A2AClientFactory, a3 as A2AClientLike, b as A2AGatewayAdapter, c as ACPClientAdapter, d as ACPClientAdapterBaseOptions, e as ACPClientAdapterOptions, f as ACPClientStdioOptions, g as ACPClientTcpOptions, h as ACPConfigRequest, i as ACPConfigSelections, a4 as ACPPermissionAbandonReason, a5 as ACPPermissionEndReason, a6 as ACPPermissionRequest, j as AnthropicAdapter, k as AnthropicAdapterOptions, a7 as AnthropicClientFactory, a8 as AnthropicToolCallingModel, a9 as AnthropicToolCallingModelOptions, 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, aa as ClaudeSDKQuery, ab as ClaudeSDKQueryParams, q as CodexAdapter, r as CodexAdapterConfig, ac as CodexAppServerStdioClient, s as CodexApprovalPolicy, ad as CodexClientLike, ae as CodexJsonRpcError, 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, af as DynamicToolCallParams, ag as DynamicToolCallResponse, ah as DynamicToolSpec, G as GeminiAdapter, F as GeminiAdapterOptions, ai as GeminiClientFactory, aj as GeminiToolCallingModel, ak as GeminiToolCallingModelOptions, H as GenericAdapter, I as GenericAdapterHandler, J as GoogleADKAdapter, K as GoogleADKAdapterOptions, al as HttpOpencodeClient, am as HttpOpencodeClientOptions, an as HttpStatusError, L as LangGraphAdapter, M as LangGraphAdapterOptions, N as LangGraphGraph, O as LettaAdapter, P as LettaAdapterOptions, ao as LettaAgentCreateParams, ap as LettaClientFactory, aq as LettaClientLike, ar as LettaHistoryConverter, as as LettaMessage, at as LettaMessageCreateParams, au as LettaMessages, av as LettaRequestOptions, aw as LettaResponse, ax as LettaResponseMessage, Q as OmpACPAdapter, R as OmpACPAdapterOptions, S as OpenAIAdapter, T as OpenAIAdapterOptions, ay as OpenAIClientFactory, az as OpenAIToolCallingModel, aA as OpenAIToolCallingModelOptions, U as OpencodeAdapter, V as OpencodeAdapterConfig, W as OpencodeApprovalMode, X as OpencodeApprovalReply, aB as OpencodeClientLike, Y as OpencodeQuestionMode, Z as ParlantAdapter, _ as ParlantAdapterOptions, aC as ParlantClientFactory, aD as ParlantClientLike, aE as ToolCall, aF as ToolCallingAdapter, aG as ToolCallingAdapterOptions, $ as ToolCallingModel, aH as ToolCallingModelRequest, aI as ToolCallingResponse, aJ as ToolResult, aK as TurnStartParams, a0 as VercelAISDKAdapter, a1 as VercelAISDKAdapterOptions, aL as VercelAISDKToolCallingModel, aM as VercelAISDKToolCallingModelOptions, aN as runSingleToolRound } from './CopilotACPAdapter-Clid9xGR.cjs';
1
+ export { A as A2AAdapter, a as A2AAdapterOptions, a6 as A2AClientFactory, a7 as A2AClientLike, b as A2AGatewayAdapter, c as ACPClientAdapter, d as ACPClientAdapterBaseOptions, e as ACPClientAdapterOptions, f as ACPClientStdioOptions, g as ACPClientTcpOptions, h as ACPConfigRequest, i as ACPConfigSelections, a8 as ACPPermissionAbandonReason, a9 as ACPPermissionEndReason, aa as ACPPermissionRequest, j as AcpSessionConfigError, k as AnthropicAdapter, l as AnthropicAdapterOptions, ab as AnthropicClientFactory, ac as AnthropicToolCallingModel, ad as AnthropicToolCallingModelOptions, 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, ae as ClaudeSDKQuery, af as ClaudeSDKQueryParams, r as CodexAdapter, s as CodexAdapterConfig, ag as CodexAppServerStdioClient, t as CodexApprovalPolicy, ah as CodexClientLike, ai as CodexJsonRpcError, 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, aj as DynamicToolCallParams, ak as DynamicToolCallResponse, al as DynamicToolSpec, G as FAILURE_CODE_SESSION_CONFIG, H as GeminiAdapter, I as GeminiAdapterOptions, am as GeminiClientFactory, an as GeminiToolCallingModel, ao as GeminiToolCallingModelOptions, J as GenericAdapter, K as GenericAdapterHandler, L as GoogleADKAdapter, M as GoogleADKAdapterOptions, ap as HttpOpencodeClient, aq as HttpOpencodeClientOptions, ar as HttpStatusError, N as LangGraphAdapter, O as LangGraphAdapterOptions, P as LangGraphGraph, Q as LettaAdapter, R as LettaAdapterOptions, as as LettaAgentCreateParams, at as LettaClientFactory, au as LettaClientLike, av as LettaHistoryConverter, aw as LettaMessage, ax as LettaMessageCreateParams, ay as LettaMessages, az as LettaRequestOptions, aA as LettaResponse, aB as LettaResponseMessage, S as MISSING_CONFIG_OPTIONS_REASON, T as OmpACPAdapter, U as OmpACPAdapterOptions, V as OpenAIAdapter, W as OpenAIAdapterOptions, aC as OpenAIClientFactory, aD as OpenAIToolCallingModel, aE as OpenAIToolCallingModelOptions, X as OpencodeAdapter, Y as OpencodeAdapterConfig, Z as OpencodeApprovalMode, _ as OpencodeApprovalReply, aF as OpencodeClientLike, $ as OpencodeQuestionMode, a0 as ParlantAdapter, a1 as ParlantAdapterOptions, aG as ParlantClientFactory, aH as ParlantClientLike, aI as ToolCall, aJ as ToolCallingAdapter, aK as ToolCallingAdapterOptions, a2 as ToolCallingModel, aL as ToolCallingModelRequest, aM as ToolCallingResponse, aN as ToolResult, aO as TurnStartParams, a3 as VercelAISDKAdapter, a4 as VercelAISDKAdapterOptions, aP as VercelAISDKToolCallingModel, aQ as VercelAISDKToolCallingModelOptions, a5 as applySessionConfigSelections, aR as runSingleToolRound } from './CopilotACPAdapter-HRvat7CP.cjs';
2
2
  import * as _agentclientprotocol_sdk from '@agentclientprotocol/sdk';
3
3
  import { SessionMode, AgentSideConnection, SessionModeState, McpServer, Agent, InitializeResponse, Implementation, Stream, InitializeRequest, LoadSessionRequest, LoadSessionResponse, ListSessionsRequest, ListSessionsResponse, ForkSessionRequest, ForkSessionResponse, ResumeSessionRequest, ResumeSessionResponse, SetSessionModeRequest, SetSessionModeResponse, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, AuthenticateRequest, AuthenticateResponse, PromptRequest, PromptResponse } from '@agentclientprotocol/sdk';
4
4
  import { A as ACPServerSessionState } from './acp-server-CJhclo6P.cjs';
@@ -1,4 +1,4 @@
1
- export { A as A2AAdapter, a as A2AAdapterOptions, a2 as A2AClientFactory, a3 as A2AClientLike, b as A2AGatewayAdapter, c as ACPClientAdapter, d as ACPClientAdapterBaseOptions, e as ACPClientAdapterOptions, f as ACPClientStdioOptions, g as ACPClientTcpOptions, h as ACPConfigRequest, i as ACPConfigSelections, a4 as ACPPermissionAbandonReason, a5 as ACPPermissionEndReason, a6 as ACPPermissionRequest, j as AnthropicAdapter, k as AnthropicAdapterOptions, a7 as AnthropicClientFactory, a8 as AnthropicToolCallingModel, a9 as AnthropicToolCallingModelOptions, 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, aa as ClaudeSDKQuery, ab as ClaudeSDKQueryParams, q as CodexAdapter, r as CodexAdapterConfig, ac as CodexAppServerStdioClient, s as CodexApprovalPolicy, ad as CodexClientLike, ae as CodexJsonRpcError, 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, af as DynamicToolCallParams, ag as DynamicToolCallResponse, ah as DynamicToolSpec, G as GeminiAdapter, F as GeminiAdapterOptions, ai as GeminiClientFactory, aj as GeminiToolCallingModel, ak as GeminiToolCallingModelOptions, H as GenericAdapter, I as GenericAdapterHandler, J as GoogleADKAdapter, K as GoogleADKAdapterOptions, al as HttpOpencodeClient, am as HttpOpencodeClientOptions, an as HttpStatusError, L as LangGraphAdapter, M as LangGraphAdapterOptions, N as LangGraphGraph, O as LettaAdapter, P as LettaAdapterOptions, ao as LettaAgentCreateParams, ap as LettaClientFactory, aq as LettaClientLike, ar as LettaHistoryConverter, as as LettaMessage, at as LettaMessageCreateParams, au as LettaMessages, av as LettaRequestOptions, aw as LettaResponse, ax as LettaResponseMessage, Q as OmpACPAdapter, R as OmpACPAdapterOptions, S as OpenAIAdapter, T as OpenAIAdapterOptions, ay as OpenAIClientFactory, az as OpenAIToolCallingModel, aA as OpenAIToolCallingModelOptions, U as OpencodeAdapter, V as OpencodeAdapterConfig, W as OpencodeApprovalMode, X as OpencodeApprovalReply, aB as OpencodeClientLike, Y as OpencodeQuestionMode, Z as ParlantAdapter, _ as ParlantAdapterOptions, aC as ParlantClientFactory, aD as ParlantClientLike, aE as ToolCall, aF as ToolCallingAdapter, aG as ToolCallingAdapterOptions, $ as ToolCallingModel, aH as ToolCallingModelRequest, aI as ToolCallingResponse, aJ as ToolResult, aK as TurnStartParams, a0 as VercelAISDKAdapter, a1 as VercelAISDKAdapterOptions, aL as VercelAISDKToolCallingModel, aM as VercelAISDKToolCallingModelOptions, aN as runSingleToolRound } from './CopilotACPAdapter-B_AVyAl6.js';
1
+ export { A as A2AAdapter, a as A2AAdapterOptions, a6 as A2AClientFactory, a7 as A2AClientLike, b as A2AGatewayAdapter, c as ACPClientAdapter, d as ACPClientAdapterBaseOptions, e as ACPClientAdapterOptions, f as ACPClientStdioOptions, g as ACPClientTcpOptions, h as ACPConfigRequest, i as ACPConfigSelections, a8 as ACPPermissionAbandonReason, a9 as ACPPermissionEndReason, aa as ACPPermissionRequest, j as AcpSessionConfigError, k as AnthropicAdapter, l as AnthropicAdapterOptions, ab as AnthropicClientFactory, ac as AnthropicToolCallingModel, ad as AnthropicToolCallingModelOptions, 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, ae as ClaudeSDKQuery, af as ClaudeSDKQueryParams, r as CodexAdapter, s as CodexAdapterConfig, ag as CodexAppServerStdioClient, t as CodexApprovalPolicy, ah as CodexClientLike, ai as CodexJsonRpcError, 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, aj as DynamicToolCallParams, ak as DynamicToolCallResponse, al as DynamicToolSpec, G as FAILURE_CODE_SESSION_CONFIG, H as GeminiAdapter, I as GeminiAdapterOptions, am as GeminiClientFactory, an as GeminiToolCallingModel, ao as GeminiToolCallingModelOptions, J as GenericAdapter, K as GenericAdapterHandler, L as GoogleADKAdapter, M as GoogleADKAdapterOptions, ap as HttpOpencodeClient, aq as HttpOpencodeClientOptions, ar as HttpStatusError, N as LangGraphAdapter, O as LangGraphAdapterOptions, P as LangGraphGraph, Q as LettaAdapter, R as LettaAdapterOptions, as as LettaAgentCreateParams, at as LettaClientFactory, au as LettaClientLike, av as LettaHistoryConverter, aw as LettaMessage, ax as LettaMessageCreateParams, ay as LettaMessages, az as LettaRequestOptions, aA as LettaResponse, aB as LettaResponseMessage, S as MISSING_CONFIG_OPTIONS_REASON, T as OmpACPAdapter, U as OmpACPAdapterOptions, V as OpenAIAdapter, W as OpenAIAdapterOptions, aC as OpenAIClientFactory, aD as OpenAIToolCallingModel, aE as OpenAIToolCallingModelOptions, X as OpencodeAdapter, Y as OpencodeAdapterConfig, Z as OpencodeApprovalMode, _ as OpencodeApprovalReply, aF as OpencodeClientLike, $ as OpencodeQuestionMode, a0 as ParlantAdapter, a1 as ParlantAdapterOptions, aG as ParlantClientFactory, aH as ParlantClientLike, aI as ToolCall, aJ as ToolCallingAdapter, aK as ToolCallingAdapterOptions, a2 as ToolCallingModel, aL as ToolCallingModelRequest, aM as ToolCallingResponse, aN as ToolResult, aO as TurnStartParams, a3 as VercelAISDKAdapter, a4 as VercelAISDKAdapterOptions, aP as VercelAISDKToolCallingModel, aQ as VercelAISDKToolCallingModelOptions, a5 as applySessionConfigSelections, aR as runSingleToolRound } from './CopilotACPAdapter-Bj6NRdqd.js';
2
2
  import * as _agentclientprotocol_sdk from '@agentclientprotocol/sdk';
3
3
  import { SessionMode, AgentSideConnection, SessionModeState, McpServer, Agent, InitializeResponse, Implementation, Stream, InitializeRequest, LoadSessionRequest, LoadSessionResponse, ListSessionsRequest, ListSessionsResponse, ForkSessionRequest, ForkSessionResponse, ResumeSessionRequest, ResumeSessionResponse, SetSessionModeRequest, SetSessionModeResponse, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, AuthenticateRequest, AuthenticateResponse, PromptRequest, PromptResponse } from '@agentclientprotocol/sdk';
4
4
  import { A as ACPServerSessionState } from './acp-server-BlcYMxKt.js';
package/dist/adapters.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  ACPClientAdapter,
3
3
  ACPServer,
4
+ AcpSessionConfigError,
4
5
  AnthropicAdapter,
5
6
  AnthropicToolCallingModel,
6
7
  BandACPServerAdapter,
@@ -14,6 +15,7 @@ import {
14
15
  CopilotACPAdapter,
15
16
  DEFAULT_COPILOT_ACP_COMMAND,
16
17
  DEFAULT_OMP_ACP_COMMAND,
18
+ FAILURE_CODE_SESSION_CONFIG,
17
19
  GeminiAdapter,
18
20
  GeminiToolCallingModel,
19
21
  GenericAdapter,
@@ -23,6 +25,7 @@ import {
23
25
  LangGraphAdapter,
24
26
  LettaAdapter,
25
27
  LettaHistoryConverter,
28
+ MISSING_CONFIG_OPTIONS_REASON,
26
29
  OmpACPAdapter,
27
30
  OpenAIAdapter,
28
31
  OpenAIToolCallingModel,
@@ -30,8 +33,9 @@ import {
30
33
  ToolCallingAdapter,
31
34
  VercelAISDKAdapter,
32
35
  VercelAISDKToolCallingModel,
36
+ applySessionConfigSelections,
33
37
  runSingleToolRound
34
- } from "./chunk-UFO6XMCV.js";
38
+ } from "./chunk-KXLV645N.js";
35
39
  import "./chunk-UL3Y5C4J.js";
36
40
  import "./chunk-JDW5WSGF.js";
37
41
  import {
@@ -60,6 +64,7 @@ export {
60
64
  A2AHistoryConverter,
61
65
  ACPClientAdapter,
62
66
  ACPServer,
67
+ AcpSessionConfigError,
63
68
  AnthropicAdapter,
64
69
  AnthropicToolCallingModel,
65
70
  BandACPServerAdapter,
@@ -73,6 +78,7 @@ export {
73
78
  CopilotACPAdapter,
74
79
  DEFAULT_COPILOT_ACP_COMMAND,
75
80
  DEFAULT_OMP_ACP_COMMAND,
81
+ FAILURE_CODE_SESSION_CONFIG,
76
82
  GatewayHistoryConverter,
77
83
  GatewayServer,
78
84
  GeminiAdapter,
@@ -84,6 +90,7 @@ export {
84
90
  LangGraphAdapter,
85
91
  LettaAdapter,
86
92
  LettaHistoryConverter,
93
+ MISSING_CONFIG_OPTIONS_REASON,
87
94
  OmpACPAdapter,
88
95
  OpenAIAdapter,
89
96
  OpenAIToolCallingModel,
@@ -93,6 +100,7 @@ export {
93
100
  ToolCallingAdapter,
94
101
  VercelAISDKAdapter,
95
102
  VercelAISDKToolCallingModel,
103
+ applySessionConfigSelections,
96
104
  buildA2AAuthHeaders,
97
105
  createGatewayServer,
98
106
  runSingleToolRound