@band-ai/sdk 0.4.0 → 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;
@@ -2599,9 +2753,11 @@ var ACPClientAdapter = class extends SimpleAdapter {
2599
2753
  resolvePermission;
2600
2754
  resolveSessionMode;
2601
2755
  resolveSessionModel;
2756
+ resolveSessionConfig;
2602
2757
  permissionTimeoutMs;
2603
2758
  turnTimeoutMs;
2604
2759
  logger;
2760
+ customSection;
2605
2761
  backend = null;
2606
2762
  backendPromise = null;
2607
2763
  client = null;
@@ -2612,6 +2768,7 @@ var ACPClientAdapter = class extends SimpleAdapter {
2612
2768
  started = false;
2613
2769
  systemPrompt = "";
2614
2770
  spawnPromise = null;
2771
+ connectionRetirements = /* @__PURE__ */ new WeakMap();
2615
2772
  // Bumped by `stop()` and on every successful spawn install. Cleanup/timeout
2616
2773
  // and permission maps key by this plus session id so a stale generation
2617
2774
  // cannot alias a same-id session on a newer connection.
@@ -2636,12 +2793,14 @@ var ACPClientAdapter = class extends SimpleAdapter {
2636
2793
  this.resolvePermission = options.resolvePermission;
2637
2794
  this.resolveSessionMode = options.resolveSessionMode;
2638
2795
  this.resolveSessionModel = options.resolveSessionModel;
2796
+ this.resolveSessionConfig = options.resolveSessionConfig;
2639
2797
  this.logger = resolveLogger(options.logger);
2798
+ this.customSection = options.customSection;
2640
2799
  this.permissionTimeoutMs = options.permissionTimeoutMs ?? DEFAULT_PERMISSION_TIMEOUT_MS;
2641
- if ((this.resolvePermission || this.resolveSessionMode || this.resolveSessionModel) && (!Number.isFinite(this.permissionTimeoutMs) || this.permissionTimeoutMs <= 0)) {
2800
+ if ((this.resolvePermission || this.resolveSessionMode || this.resolveSessionModel || this.resolveSessionConfig) && (!Number.isFinite(this.permissionTimeoutMs) || this.permissionTimeoutMs <= 0)) {
2642
2801
  throw new ValidationError(`permissionTimeoutMs must be a positive finite number, got ${options.permissionTimeoutMs}`);
2643
2802
  }
2644
- if (this.resolvePermission || this.resolveSessionMode || this.resolveSessionModel) {
2803
+ if (this.resolvePermission || this.resolveSessionMode || this.resolveSessionModel || this.resolveSessionConfig) {
2645
2804
  assertWithinSetTimeoutBound(
2646
2805
  `permissionTimeoutMs must be at most ${MAX_SETTIMEOUT_DELAY_MS}, got ${options.permissionTimeoutMs}`,
2647
2806
  this.permissionTimeoutMs
@@ -2668,7 +2827,8 @@ var ACPClientAdapter = class extends SimpleAdapter {
2668
2827
  this.systemPrompt = renderSystemPrompt({
2669
2828
  agentName,
2670
2829
  agentDescription,
2671
- includeBaseInstructions: false
2830
+ includeBaseInstructions: false,
2831
+ customSection: this.customSection
2672
2832
  });
2673
2833
  await this.ensureConnection();
2674
2834
  }
@@ -2701,13 +2861,17 @@ var ACPClientAdapter = class extends SimpleAdapter {
2701
2861
 
2702
2862
  ${messageWithContext}`;
2703
2863
  this.bootstrappedSessions.add(sessionKey);
2704
- const response = await withTimeout(connection.prompt({
2705
- sessionId,
2706
- prompt: [{
2707
- type: "text",
2708
- text: promptText
2709
- }]
2710
- }), 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
+ );
2711
2875
  await this.flushChunks({
2712
2876
  client,
2713
2877
  tools,
@@ -2748,12 +2912,17 @@ ${messageWithContext}`;
2748
2912
  }
2749
2913
  }
2750
2914
  }
2751
- const acpError = asAcpJsonRpcError(error);
2915
+ const configError = error instanceof AcpSessionConfigError ? error : void 0;
2916
+ const acpError = configError ? void 0 : asAcpJsonRpcError(error);
2752
2917
  await reportTurnFailure(
2753
2918
  tools,
2754
- 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)),
2755
2920
  this.logger,
2756
- { roomId: context.roomId, sessionId }
2921
+ {
2922
+ roomId: context.roomId,
2923
+ sessionId: configError?.sessionId ?? sessionId,
2924
+ ...configError ? { optionId: configError.optionId, selectedValue: configError.selectedValue } : {}
2925
+ }
2757
2926
  );
2758
2927
  }
2759
2928
  }
@@ -2772,17 +2941,12 @@ ${messageWithContext}`;
2772
2941
  // would risk blocking this room's turn lock forever on the very process
2773
2942
  // that just proved it can hang.
2774
2943
  async abandonTimedOutTurn(connection, sessionId, generation) {
2775
- const key = this.sessionKey(generation, sessionId);
2776
- this.activeSessions.delete(key);
2777
- this.abandonedSessions.add(key);
2778
- const owner = [...this.roomToSession.entries()].find(([, value]) => value.sessionId === sessionId && value.generation === generation);
2779
- if (owner) {
2780
- this.unlinkOwner(owner[0], owner[1]);
2781
- }
2782
- abandon(
2783
- () => connection.cancel({ sessionId }),
2784
- (error) => this.safeWarn("acp_client.cancel_failed", { sessionId, error: asErrorMessage(error) })
2785
- );
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
+ });
2786
2950
  }
2787
2951
  // A per-room async mutex: `fn` for a given `roomId` never overlaps another
2788
2952
  // call for that same room, while different rooms stay fully concurrent.
@@ -2908,6 +3072,11 @@ ${messageWithContext}`;
2908
3072
  void connection.closed.then(() => reject(new Error("ACP connection closed while a session operation was still in flight")));
2909
3073
  return Promise.race([operation, closedRejection]);
2910
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
+ }
2911
3080
  unlinkRoom(roomId) {
2912
3081
  const owner = this.roomToSession.get(roomId);
2913
3082
  if (owner) {
@@ -3052,7 +3221,10 @@ ${messageWithContext}`;
3052
3221
  this.activeSessions.add(restoredKey);
3053
3222
  this.bootstrappedSessions.add(restoredKey);
3054
3223
  await this.configureSessionMode(roomId, existingSessionId, restored.modes, connection);
3055
- await this.configureSessionModel(roomId, existingSessionId, restored.configOptions, connection);
3224
+ await this.configureSessionConfig(roomId, existingSessionId, restored.configOptions, connection, connectionGeneration, client);
3225
+ if (!this.resolveSessionConfig) {
3226
+ await this.configureSessionModel(roomId, existingSessionId, restored.configOptions, connection);
3227
+ }
3056
3228
  return existingSessionId;
3057
3229
  }
3058
3230
  }
@@ -3063,9 +3235,97 @@ ${messageWithContext}`;
3063
3235
  this.linkOrAbandon(roomId, created.sessionId, generation, connectionGeneration, client);
3064
3236
  this.activeSessions.add(this.sessionKey(connectionGeneration, created.sessionId));
3065
3237
  await this.configureSessionMode(roomId, created.sessionId, created.modes, connection);
3066
- await this.configureSessionModel(roomId, created.sessionId, created.configOptions, connection);
3238
+ await this.configureSessionConfig(roomId, created.sessionId, created.configOptions, connection, connectionGeneration, client);
3239
+ if (!this.resolveSessionConfig) {
3240
+ await this.configureSessionModel(roomId, created.sessionId, created.configOptions, connection);
3241
+ }
3067
3242
  return created.sessionId;
3068
3243
  }
3244
+ async configureSessionConfig(roomId, sessionId, configOptions, connection, connectionGeneration, client) {
3245
+ if (!this.resolveSessionConfig || !Array.isArray(configOptions) || configOptions.length === 0) {
3246
+ return;
3247
+ }
3248
+ const advertisedOptions = configOptions;
3249
+ const selections = await this.resolveManualSelection(
3250
+ "resolveSessionConfig",
3251
+ (signal) => this.resolveSessionConfig({ roomId, sessionId, configOptions: advertisedOptions }, signal),
3252
+ connection.signal
3253
+ );
3254
+ if (!selections) {
3255
+ return;
3256
+ }
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);
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
+ );
3327
+ }
3328
+ }
3069
3329
  // The single gate an establishment must pass before it's allowed to claim
3070
3330
  // the room: it must still be the room's current generation (not
3071
3331
  // superseded by a teardown or a fresher establishment while this one was
@@ -3677,39 +3937,12 @@ async function createTcpConnection(client, endpoint, signal) {
3677
3937
  };
3678
3938
  }
3679
3939
  var MODEL_CONFIG_OPTION_KEY = "model";
3680
- function isSessionConfigSelect(option) {
3681
- return option?.type === "select";
3682
- }
3683
3940
  function isModelConfigOption(option) {
3684
3941
  return isSessionConfigSelect(option) && option.category === MODEL_CONFIG_OPTION_KEY;
3685
3942
  }
3686
3943
  function isModelConfigOptionById(option) {
3687
3944
  return isSessionConfigSelect(option) && option.id === MODEL_CONFIG_OPTION_KEY;
3688
3945
  }
3689
- function flattenConfigSelectOptions(options) {
3690
- if (!Array.isArray(options)) {
3691
- return [];
3692
- }
3693
- return options.flatMap((entry) => {
3694
- if (!asOptionalRecord2(entry)) {
3695
- return [];
3696
- }
3697
- if ("group" in entry) {
3698
- return Array.isArray(entry.options) ? entry.options : [];
3699
- }
3700
- return [entry];
3701
- });
3702
- }
3703
- function isAcpErrorResponse(error) {
3704
- return typeof error === "object" && error !== null && typeof error.code === "number" && typeof error.message === "string";
3705
- }
3706
- function asAcpJsonRpcError(error) {
3707
- if (isAcpErrorResponse(error)) {
3708
- return error;
3709
- }
3710
- const nested = asOptionalRecord2(error)?.error;
3711
- return isAcpErrorResponse(nested) ? nested : void 0;
3712
- }
3713
3946
 
3714
3947
  // src/adapters/acp/ACPServer.ts
3715
3948
  var import_node_stream2 = require("stream");
@@ -12812,6 +13045,7 @@ function parseModelListResponse(value) {
12812
13045
  A2AHistoryConverter,
12813
13046
  ACPClientAdapter,
12814
13047
  ACPServer,
13048
+ AcpSessionConfigError,
12815
13049
  AnthropicAdapter,
12816
13050
  AnthropicToolCallingModel,
12817
13051
  BandACPServerAdapter,
@@ -12825,6 +13059,7 @@ function parseModelListResponse(value) {
12825
13059
  CopilotACPAdapter,
12826
13060
  DEFAULT_COPILOT_ACP_COMMAND,
12827
13061
  DEFAULT_OMP_ACP_COMMAND,
13062
+ FAILURE_CODE_SESSION_CONFIG,
12828
13063
  GatewayHistoryConverter,
12829
13064
  GatewayServer,
12830
13065
  GeminiAdapter,
@@ -12836,6 +13071,7 @@ function parseModelListResponse(value) {
12836
13071
  LangGraphAdapter,
12837
13072
  LettaAdapter,
12838
13073
  LettaHistoryConverter,
13074
+ MISSING_CONFIG_OPTIONS_REASON,
12839
13075
  OmpACPAdapter,
12840
13076
  OpenAIAdapter,
12841
13077
  OpenAIToolCallingModel,
@@ -12845,6 +13081,7 @@ function parseModelListResponse(value) {
12845
13081
  ToolCallingAdapter,
12846
13082
  VercelAISDKAdapter,
12847
13083
  VercelAISDKToolCallingModel,
13084
+ applySessionConfigSelections,
12848
13085
  buildA2AAuthHeaders,
12849
13086
  createGatewayServer,
12850
13087
  runSingleToolRound
@@ -1,4 +1,4 @@
1
- export { A as A2AAdapter, a as A2AAdapterOptions, a0 as A2AClientFactory, a1 as A2AClientLike, b as A2AGatewayAdapter, c as ACPClientAdapter, d as ACPClientAdapterBaseOptions, e as ACPClientAdapterOptions, f as ACPClientStdioOptions, g as ACPClientTcpOptions, a2 as ACPPermissionAbandonReason, a3 as ACPPermissionEndReason, a4 as ACPPermissionRequest, h as AnthropicAdapter, i as AnthropicAdapterOptions, a5 as AnthropicClientFactory, a6 as AnthropicToolCallingModel, a7 as AnthropicToolCallingModelOptions, C as CODEX_REASONING_EFFORTS, j as CODEX_REASONING_SUMMARIES, k as CODEX_WEB_SEARCH_MODES, l as ClaudePermissionMode, m as ClaudeSDKAdapter, n as ClaudeSDKAdapterOptions, a8 as ClaudeSDKQuery, a9 as ClaudeSDKQueryParams, o as CodexAdapter, p as CodexAdapterConfig, aa as CodexAppServerStdioClient, q as CodexApprovalPolicy, ab as CodexClientLike, ac as CodexJsonRpcError, r as CodexReasoningEffort, s as CodexReasoningSummary, t as CodexSandboxMode, u as CodexWebSearchMode, v as CopilotACPAdapter, w as CopilotACPAdapterOptions, x as CopilotACPStdioOptions, y as CopilotACPTcpOptions, D as DEFAULT_COPILOT_ACP_COMMAND, z as DEFAULT_OMP_ACP_COMMAND, ad as DynamicToolCallParams, ae as DynamicToolCallResponse, af as DynamicToolSpec, G as GeminiAdapter, B as GeminiAdapterOptions, ag as GeminiClientFactory, ah as GeminiToolCallingModel, ai as GeminiToolCallingModelOptions, E as GenericAdapter, F as GenericAdapterHandler, H as GoogleADKAdapter, I as GoogleADKAdapterOptions, aj as HttpOpencodeClient, ak as HttpOpencodeClientOptions, al as HttpStatusError, L as LangGraphAdapter, J as LangGraphAdapterOptions, K as LangGraphGraph, M as LettaAdapter, N as LettaAdapterOptions, am as LettaAgentCreateParams, an as LettaClientFactory, ao as LettaClientLike, ap as LettaHistoryConverter, aq as LettaMessage, ar as LettaMessageCreateParams, as as LettaMessages, at as LettaRequestOptions, au as LettaResponse, av as LettaResponseMessage, O as OmpACPAdapter, P as OmpACPAdapterOptions, Q as OpenAIAdapter, R as OpenAIAdapterOptions, aw as OpenAIClientFactory, ax as OpenAIToolCallingModel, ay as OpenAIToolCallingModelOptions, S as OpencodeAdapter, T as OpencodeAdapterConfig, U as OpencodeApprovalMode, V as OpencodeApprovalReply, az as OpencodeClientLike, W as OpencodeQuestionMode, X as ParlantAdapter, Y as ParlantAdapterOptions, aA as ParlantClientFactory, aB as ParlantClientLike, aC as ToolCall, aD as ToolCallingAdapter, aE as ToolCallingAdapterOptions, Z as ToolCallingModel, aF as ToolCallingModelRequest, aG as ToolCallingResponse, aH as ToolResult, aI as TurnStartParams, _ as VercelAISDKAdapter, $ as VercelAISDKAdapterOptions, aJ as VercelAISDKToolCallingModel, aK as VercelAISDKToolCallingModelOptions, aL as runSingleToolRound } from './CopilotACPAdapter-D4VWg8lJ.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, a0 as A2AClientFactory, a1 as A2AClientLike, b as A2AGatewayAdapter, c as ACPClientAdapter, d as ACPClientAdapterBaseOptions, e as ACPClientAdapterOptions, f as ACPClientStdioOptions, g as ACPClientTcpOptions, a2 as ACPPermissionAbandonReason, a3 as ACPPermissionEndReason, a4 as ACPPermissionRequest, h as AnthropicAdapter, i as AnthropicAdapterOptions, a5 as AnthropicClientFactory, a6 as AnthropicToolCallingModel, a7 as AnthropicToolCallingModelOptions, C as CODEX_REASONING_EFFORTS, j as CODEX_REASONING_SUMMARIES, k as CODEX_WEB_SEARCH_MODES, l as ClaudePermissionMode, m as ClaudeSDKAdapter, n as ClaudeSDKAdapterOptions, a8 as ClaudeSDKQuery, a9 as ClaudeSDKQueryParams, o as CodexAdapter, p as CodexAdapterConfig, aa as CodexAppServerStdioClient, q as CodexApprovalPolicy, ab as CodexClientLike, ac as CodexJsonRpcError, r as CodexReasoningEffort, s as CodexReasoningSummary, t as CodexSandboxMode, u as CodexWebSearchMode, v as CopilotACPAdapter, w as CopilotACPAdapterOptions, x as CopilotACPStdioOptions, y as CopilotACPTcpOptions, D as DEFAULT_COPILOT_ACP_COMMAND, z as DEFAULT_OMP_ACP_COMMAND, ad as DynamicToolCallParams, ae as DynamicToolCallResponse, af as DynamicToolSpec, G as GeminiAdapter, B as GeminiAdapterOptions, ag as GeminiClientFactory, ah as GeminiToolCallingModel, ai as GeminiToolCallingModelOptions, E as GenericAdapter, F as GenericAdapterHandler, H as GoogleADKAdapter, I as GoogleADKAdapterOptions, aj as HttpOpencodeClient, ak as HttpOpencodeClientOptions, al as HttpStatusError, L as LangGraphAdapter, J as LangGraphAdapterOptions, K as LangGraphGraph, M as LettaAdapter, N as LettaAdapterOptions, am as LettaAgentCreateParams, an as LettaClientFactory, ao as LettaClientLike, ap as LettaHistoryConverter, aq as LettaMessage, ar as LettaMessageCreateParams, as as LettaMessages, at as LettaRequestOptions, au as LettaResponse, av as LettaResponseMessage, O as OmpACPAdapter, P as OmpACPAdapterOptions, Q as OpenAIAdapter, R as OpenAIAdapterOptions, aw as OpenAIClientFactory, ax as OpenAIToolCallingModel, ay as OpenAIToolCallingModelOptions, S as OpencodeAdapter, T as OpencodeAdapterConfig, U as OpencodeApprovalMode, V as OpencodeApprovalReply, az as OpencodeClientLike, W as OpencodeQuestionMode, X as ParlantAdapter, Y as ParlantAdapterOptions, aA as ParlantClientFactory, aB as ParlantClientLike, aC as ToolCall, aD as ToolCallingAdapter, aE as ToolCallingAdapterOptions, Z as ToolCallingModel, aF as ToolCallingModelRequest, aG as ToolCallingResponse, aH as ToolResult, aI as TurnStartParams, _ as VercelAISDKAdapter, $ as VercelAISDKAdapterOptions, aJ as VercelAISDKToolCallingModel, aK as VercelAISDKToolCallingModelOptions, aL as runSingleToolRound } from './CopilotACPAdapter-BCpbHFB0.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-YF7K4UB3.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