@yushaw/sanqian-sdk 0.3.21 → 0.3.23

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.d.mts CHANGED
@@ -871,6 +871,11 @@ interface ChannelProbeResult {
871
871
  bot_username: string | null;
872
872
  error: string | null;
873
873
  }
874
+ interface ProbeChannelConfigRequest {
875
+ channel_type: string;
876
+ config: Record<string, unknown>;
877
+ }
878
+ type ChannelConfigSchema = Record<string, unknown>;
874
879
  interface CreateChannelAccountRequest {
875
880
  channel_type: string;
876
881
  name: string;
@@ -938,6 +943,7 @@ declare class SanqianSDK {
938
943
  private activeStreamConversations;
939
944
  private static readonly VALID_SECURITY_LEVELS;
940
945
  private connectingPromise;
946
+ private httpReadyPromise;
941
947
  private reconnectRefCount;
942
948
  private launchedBySanqian;
943
949
  private eventListeners;
@@ -958,11 +964,19 @@ declare class SanqianSDK {
958
964
  private resolvePendingStartIndex;
959
965
  private getHttpBaseUrl;
960
966
  private getHttpAuthHeaders;
967
+ private ensureHttpReady;
968
+ private doEnsureHttpReady;
961
969
  /**
962
970
  * Get the port number for the Sanqian backend
963
971
  * @throws Error if not connected
964
972
  */
965
973
  getPort(): number;
974
+ /**
975
+ * Get the HTTP base URL for Sanqian backend.
976
+ *
977
+ * @throws Error if connection info is not available
978
+ */
979
+ getBaseUrl(): string;
966
980
  constructor(config: SDKConfig);
967
981
  /**
968
982
  * Start watching connection.json for changes
@@ -1450,6 +1464,8 @@ declare class SanqianSDK {
1450
1464
  }>;
1451
1465
  getChannelStatus(id: string): Promise<ChannelStatus>;
1452
1466
  probeChannelAccount(id: string): Promise<ChannelProbeResult>;
1467
+ probeChannelConfig(req: ProbeChannelConfigRequest): Promise<ChannelProbeResult>;
1468
+ getChannelConfigSchema(channelType: string): Promise<ChannelConfigSchema>;
1453
1469
  listChannelBindings(accountId?: string): Promise<ChannelBinding[]>;
1454
1470
  createChannelBinding(req: CreateChannelBindingRequest): Promise<ChannelBinding>;
1455
1471
  updateChannelBinding(id: string, req: UpdateChannelBindingRequest): Promise<ChannelBinding>;
@@ -1644,4 +1660,4 @@ declare class SanqianSDKError extends Error {
1644
1660
  */
1645
1661
  declare function createSDKError(code: SDKErrorCode, details?: string): SanqianSDKError;
1646
1662
 
1647
- export { type AgentCapability, type AgentConfig, type AgentInfo, type AgentUpdateConfig, type Capability, type CapabilitySearchResult, type CapabilityType, type ChannelAccount, type ChannelAccountStatus, type ChannelBinding, type ChannelBindingMatchType, type ChannelChatType, type ChannelDmPolicy, type ChannelDmScope, type ChannelGroupPolicy, type ChannelPluginInfo, type ChannelProbeResult, type ChannelRuntimeStatus, type ChannelStatus, type ChatMessage, type ChatRequest, type ChatResponse, type ChatStreamEvent, type ConnectionInfo, type ConnectionState, type ContextCapability, type ContextData, type ContextListItem, type ContextProvider, Conversation, type ConversationDetail, type ConversationHistoryResult, type ConversationInfo, type ConversationMessage, type CreateChannelAccountRequest, type CreateChannelBindingRequest, DiscoveryManager, type EmbeddingConfigResult, ErrorMessages, type HitlInterruptPayload, type HitlInterruptType, type HitlResponse, type HitlRiskLevel, type JSONSchema, type JSONSchemaProperty, type ListCapabilitiesOptions, type LoadItem, type LoadItemAction, type LoadItemType, type RemoteToolDefinition, type RerankConfigResult, type ResourceListOptions, type ResourceListResult, type ResourceType, SANQIAN_WEBSITE, type SDKConfig, SDKErrorCode, type SDKEventName, type SDKEvents, type SDKExtendedMethods, SanqianSDK, SanqianSDKError, type SearchCapabilitiesOptions, type SendChannelMessageRequest, type SendChannelMessageResponse, type SessionResource, type SkillCapability, type StoredSessionResource, type ToolCall, type ToolCapability, type ToolDefinition, type UpdateChannelAccountRequest, type UpdateChannelBindingRequest, createSDKError };
1663
+ export { type AgentCapability, type AgentConfig, type AgentInfo, type AgentUpdateConfig, type Capability, type CapabilitySearchResult, type CapabilityType, type ChannelAccount, type ChannelAccountStatus, type ChannelBinding, type ChannelBindingMatchType, type ChannelChatType, type ChannelConfigSchema, type ChannelDmPolicy, type ChannelDmScope, type ChannelGroupPolicy, type ChannelPluginInfo, type ChannelProbeResult, type ChannelRuntimeStatus, type ChannelStatus, type ChatMessage, type ChatRequest, type ChatResponse, type ChatStreamEvent, type ConnectionInfo, type ConnectionState, type ContextCapability, type ContextData, type ContextListItem, type ContextProvider, Conversation, type ConversationDetail, type ConversationHistoryResult, type ConversationInfo, type ConversationMessage, type CreateChannelAccountRequest, type CreateChannelBindingRequest, DiscoveryManager, type EmbeddingConfigResult, ErrorMessages, type HitlInterruptPayload, type HitlInterruptType, type HitlResponse, type HitlRiskLevel, type JSONSchema, type JSONSchemaProperty, type ListCapabilitiesOptions, type LoadItem, type LoadItemAction, type LoadItemType, type ProbeChannelConfigRequest, type RemoteToolDefinition, type RerankConfigResult, type ResourceListOptions, type ResourceListResult, type ResourceType, SANQIAN_WEBSITE, type SDKConfig, SDKErrorCode, type SDKEventName, type SDKEvents, type SDKExtendedMethods, SanqianSDK, SanqianSDKError, type SearchCapabilitiesOptions, type SendChannelMessageRequest, type SendChannelMessageResponse, type SessionResource, type SkillCapability, type StoredSessionResource, type ToolCall, type ToolCapability, type ToolDefinition, type UpdateChannelAccountRequest, type UpdateChannelBindingRequest, createSDKError };
package/dist/index.d.ts CHANGED
@@ -871,6 +871,11 @@ interface ChannelProbeResult {
871
871
  bot_username: string | null;
872
872
  error: string | null;
873
873
  }
874
+ interface ProbeChannelConfigRequest {
875
+ channel_type: string;
876
+ config: Record<string, unknown>;
877
+ }
878
+ type ChannelConfigSchema = Record<string, unknown>;
874
879
  interface CreateChannelAccountRequest {
875
880
  channel_type: string;
876
881
  name: string;
@@ -938,6 +943,7 @@ declare class SanqianSDK {
938
943
  private activeStreamConversations;
939
944
  private static readonly VALID_SECURITY_LEVELS;
940
945
  private connectingPromise;
946
+ private httpReadyPromise;
941
947
  private reconnectRefCount;
942
948
  private launchedBySanqian;
943
949
  private eventListeners;
@@ -958,11 +964,19 @@ declare class SanqianSDK {
958
964
  private resolvePendingStartIndex;
959
965
  private getHttpBaseUrl;
960
966
  private getHttpAuthHeaders;
967
+ private ensureHttpReady;
968
+ private doEnsureHttpReady;
961
969
  /**
962
970
  * Get the port number for the Sanqian backend
963
971
  * @throws Error if not connected
964
972
  */
965
973
  getPort(): number;
974
+ /**
975
+ * Get the HTTP base URL for Sanqian backend.
976
+ *
977
+ * @throws Error if connection info is not available
978
+ */
979
+ getBaseUrl(): string;
966
980
  constructor(config: SDKConfig);
967
981
  /**
968
982
  * Start watching connection.json for changes
@@ -1450,6 +1464,8 @@ declare class SanqianSDK {
1450
1464
  }>;
1451
1465
  getChannelStatus(id: string): Promise<ChannelStatus>;
1452
1466
  probeChannelAccount(id: string): Promise<ChannelProbeResult>;
1467
+ probeChannelConfig(req: ProbeChannelConfigRequest): Promise<ChannelProbeResult>;
1468
+ getChannelConfigSchema(channelType: string): Promise<ChannelConfigSchema>;
1453
1469
  listChannelBindings(accountId?: string): Promise<ChannelBinding[]>;
1454
1470
  createChannelBinding(req: CreateChannelBindingRequest): Promise<ChannelBinding>;
1455
1471
  updateChannelBinding(id: string, req: UpdateChannelBindingRequest): Promise<ChannelBinding>;
@@ -1644,4 +1660,4 @@ declare class SanqianSDKError extends Error {
1644
1660
  */
1645
1661
  declare function createSDKError(code: SDKErrorCode, details?: string): SanqianSDKError;
1646
1662
 
1647
- export { type AgentCapability, type AgentConfig, type AgentInfo, type AgentUpdateConfig, type Capability, type CapabilitySearchResult, type CapabilityType, type ChannelAccount, type ChannelAccountStatus, type ChannelBinding, type ChannelBindingMatchType, type ChannelChatType, type ChannelDmPolicy, type ChannelDmScope, type ChannelGroupPolicy, type ChannelPluginInfo, type ChannelProbeResult, type ChannelRuntimeStatus, type ChannelStatus, type ChatMessage, type ChatRequest, type ChatResponse, type ChatStreamEvent, type ConnectionInfo, type ConnectionState, type ContextCapability, type ContextData, type ContextListItem, type ContextProvider, Conversation, type ConversationDetail, type ConversationHistoryResult, type ConversationInfo, type ConversationMessage, type CreateChannelAccountRequest, type CreateChannelBindingRequest, DiscoveryManager, type EmbeddingConfigResult, ErrorMessages, type HitlInterruptPayload, type HitlInterruptType, type HitlResponse, type HitlRiskLevel, type JSONSchema, type JSONSchemaProperty, type ListCapabilitiesOptions, type LoadItem, type LoadItemAction, type LoadItemType, type RemoteToolDefinition, type RerankConfigResult, type ResourceListOptions, type ResourceListResult, type ResourceType, SANQIAN_WEBSITE, type SDKConfig, SDKErrorCode, type SDKEventName, type SDKEvents, type SDKExtendedMethods, SanqianSDK, SanqianSDKError, type SearchCapabilitiesOptions, type SendChannelMessageRequest, type SendChannelMessageResponse, type SessionResource, type SkillCapability, type StoredSessionResource, type ToolCall, type ToolCapability, type ToolDefinition, type UpdateChannelAccountRequest, type UpdateChannelBindingRequest, createSDKError };
1663
+ export { type AgentCapability, type AgentConfig, type AgentInfo, type AgentUpdateConfig, type Capability, type CapabilitySearchResult, type CapabilityType, type ChannelAccount, type ChannelAccountStatus, type ChannelBinding, type ChannelBindingMatchType, type ChannelChatType, type ChannelConfigSchema, type ChannelDmPolicy, type ChannelDmScope, type ChannelGroupPolicy, type ChannelPluginInfo, type ChannelProbeResult, type ChannelRuntimeStatus, type ChannelStatus, type ChatMessage, type ChatRequest, type ChatResponse, type ChatStreamEvent, type ConnectionInfo, type ConnectionState, type ContextCapability, type ContextData, type ContextListItem, type ContextProvider, Conversation, type ConversationDetail, type ConversationHistoryResult, type ConversationInfo, type ConversationMessage, type CreateChannelAccountRequest, type CreateChannelBindingRequest, DiscoveryManager, type EmbeddingConfigResult, ErrorMessages, type HitlInterruptPayload, type HitlInterruptType, type HitlResponse, type HitlRiskLevel, type JSONSchema, type JSONSchemaProperty, type ListCapabilitiesOptions, type LoadItem, type LoadItemAction, type LoadItemType, type ProbeChannelConfigRequest, type RemoteToolDefinition, type RerankConfigResult, type ResourceListOptions, type ResourceListResult, type ResourceType, SANQIAN_WEBSITE, type SDKConfig, SDKErrorCode, type SDKEventName, type SDKEvents, type SDKExtendedMethods, SanqianSDK, SanqianSDKError, type SearchCapabilitiesOptions, type SendChannelMessageRequest, type SendChannelMessageResponse, type SessionResource, type SkillCapability, type StoredSessionResource, type ToolCall, type ToolCapability, type ToolDefinition, type UpdateChannelAccountRequest, type UpdateChannelBindingRequest, createSDKError };
package/dist/index.js CHANGED
@@ -538,6 +538,8 @@ var SanqianSDK = class _SanqianSDK {
538
538
  ]);
539
539
  // Connection promise for deduplication (prevents multiple concurrent connect attempts)
540
540
  connectingPromise = null;
541
+ // HTTP readiness promise for deduplication (prevents concurrent discovery/launch)
542
+ httpReadyPromise = null;
541
543
  // Reconnect reference count - when > 0, auto-reconnect is enabled
542
544
  // This allows multiple components to request persistent connections
543
545
  reconnectRefCount = 0;
@@ -664,6 +666,38 @@ var SanqianSDK = class _SanqianSDK {
664
666
  const token = info?.token;
665
667
  return token ? { "X-App-Token": token } : {};
666
668
  }
669
+ async ensureHttpReady() {
670
+ if (this.connectionInfo || this.config.connectionInfo) {
671
+ return;
672
+ }
673
+ if (this.httpReadyPromise) {
674
+ this.log("HTTP readiness already in progress, waiting...");
675
+ return this.httpReadyPromise;
676
+ }
677
+ this.httpReadyPromise = this.doEnsureHttpReady();
678
+ try {
679
+ await this.httpReadyPromise;
680
+ } finally {
681
+ this.httpReadyPromise = null;
682
+ }
683
+ }
684
+ async doEnsureHttpReady() {
685
+ const discovery = await this.getDiscovery();
686
+ let info = discovery.read();
687
+ if (!info) {
688
+ if (!this.config.autoLaunchSanqian) {
689
+ throw createSDKError("NOT_RUNNING" /* NOT_RUNNING */);
690
+ }
691
+ this.log("Sanqian not running, attempting to launch for HTTP API...");
692
+ const launched = discovery.launchSanqian(this.config.sanqianPath);
693
+ if (!launched) {
694
+ throw createSDKError("NOT_INSTALLED" /* NOT_INSTALLED */);
695
+ }
696
+ this.log("Sanqian launch initiated, waiting for startup...");
697
+ info = await this.waitForSanqianStartup();
698
+ }
699
+ this.connectionInfo = info;
700
+ }
667
701
  /**
668
702
  * Get the port number for the Sanqian backend
669
703
  * @throws Error if not connected
@@ -675,6 +709,14 @@ var SanqianSDK = class _SanqianSDK {
675
709
  }
676
710
  return info.port;
677
711
  }
712
+ /**
713
+ * Get the HTTP base URL for Sanqian backend.
714
+ *
715
+ * @throws Error if connection info is not available
716
+ */
717
+ getBaseUrl() {
718
+ return this.getHttpBaseUrl();
719
+ }
678
720
  constructor(config) {
679
721
  const requestedSecurityLevel = this.normalizeRequestedSecurityLevel(
680
722
  config.requestedSecurityLevel
@@ -1565,26 +1607,10 @@ var SanqianSDK = class _SanqianSDK {
1565
1607
  */
1566
1608
  async doFullConnect() {
1567
1609
  this.log("Starting full connection flow...");
1568
- let info = null;
1569
- if (this.config.connectionInfo) {
1570
- this.log("Using pre-configured connection info (browser mode)");
1571
- info = this.config.connectionInfo;
1572
- } else {
1573
- const discovery = await this.getDiscovery();
1574
- info = discovery.read();
1575
- if (!info) {
1576
- if (this.config.autoLaunchSanqian) {
1577
- this.log("Sanqian not running, attempting to launch...");
1578
- const launched = discovery.launchSanqian(this.config.sanqianPath);
1579
- if (!launched) {
1580
- throw createSDKError("NOT_INSTALLED" /* NOT_INSTALLED */);
1581
- }
1582
- this.log("Sanqian launch initiated, waiting for startup...");
1583
- info = await this.waitForSanqianStartup();
1584
- } else {
1585
- throw createSDKError("NOT_RUNNING" /* NOT_RUNNING */);
1586
- }
1587
- }
1610
+ await this.ensureHttpReady();
1611
+ const info = this.connectionInfo || this.config.connectionInfo;
1612
+ if (!info) {
1613
+ throw createSDKError("NOT_RUNNING" /* NOT_RUNNING */);
1588
1614
  }
1589
1615
  await this.connectWithInfo(info);
1590
1616
  }
@@ -2473,7 +2499,7 @@ var SanqianSDK = class _SanqianSDK {
2473
2499
  // Channels
2474
2500
  // ============================================
2475
2501
  async listChannelPlugins() {
2476
- await this.ensureReady();
2502
+ await this.ensureHttpReady();
2477
2503
  const url = `${this.getHttpBaseUrl()}/api/channels/plugins`;
2478
2504
  const response = await fetch(url, { headers: this.getHttpAuthHeaders() });
2479
2505
  if (!response.ok) {
@@ -2482,7 +2508,7 @@ var SanqianSDK = class _SanqianSDK {
2482
2508
  return response.json();
2483
2509
  }
2484
2510
  async listChannelAccounts() {
2485
- await this.ensureReady();
2511
+ await this.ensureHttpReady();
2486
2512
  const url = `${this.getHttpBaseUrl()}/api/channels/accounts`;
2487
2513
  const response = await fetch(url, { headers: this.getHttpAuthHeaders() });
2488
2514
  if (!response.ok) {
@@ -2491,7 +2517,7 @@ var SanqianSDK = class _SanqianSDK {
2491
2517
  return response.json();
2492
2518
  }
2493
2519
  async createChannelAccount(req) {
2494
- await this.ensureReady();
2520
+ await this.ensureHttpReady();
2495
2521
  const url = `${this.getHttpBaseUrl()}/api/channels/accounts`;
2496
2522
  const response = await fetch(url, {
2497
2523
  method: "POST",
@@ -2505,7 +2531,7 @@ var SanqianSDK = class _SanqianSDK {
2505
2531
  return response.json();
2506
2532
  }
2507
2533
  async getChannelAccount(id) {
2508
- await this.ensureReady();
2534
+ await this.ensureHttpReady();
2509
2535
  const url = `${this.getHttpBaseUrl()}/api/channels/accounts/${encodeURIComponent(id)}`;
2510
2536
  const response = await fetch(url, { headers: this.getHttpAuthHeaders() });
2511
2537
  if (!response.ok) {
@@ -2514,7 +2540,7 @@ var SanqianSDK = class _SanqianSDK {
2514
2540
  return response.json();
2515
2541
  }
2516
2542
  async updateChannelAccount(id, req) {
2517
- await this.ensureReady();
2543
+ await this.ensureHttpReady();
2518
2544
  const url = `${this.getHttpBaseUrl()}/api/channels/accounts/${encodeURIComponent(id)}`;
2519
2545
  const response = await fetch(url, {
2520
2546
  method: "PUT",
@@ -2528,7 +2554,7 @@ var SanqianSDK = class _SanqianSDK {
2528
2554
  return response.json();
2529
2555
  }
2530
2556
  async deleteChannelAccount(id) {
2531
- await this.ensureReady();
2557
+ await this.ensureHttpReady();
2532
2558
  const url = `${this.getHttpBaseUrl()}/api/channels/accounts/${encodeURIComponent(id)}`;
2533
2559
  const response = await fetch(url, { method: "DELETE", headers: this.getHttpAuthHeaders() });
2534
2560
  if (!response.ok) {
@@ -2536,7 +2562,7 @@ var SanqianSDK = class _SanqianSDK {
2536
2562
  }
2537
2563
  }
2538
2564
  async startChannelAccount(id) {
2539
- await this.ensureReady();
2565
+ await this.ensureHttpReady();
2540
2566
  const url = `${this.getHttpBaseUrl()}/api/channels/accounts/${encodeURIComponent(id)}/start`;
2541
2567
  const response = await fetch(url, { method: "POST", headers: this.getHttpAuthHeaders() });
2542
2568
  if (!response.ok) {
@@ -2546,7 +2572,7 @@ var SanqianSDK = class _SanqianSDK {
2546
2572
  return response.json();
2547
2573
  }
2548
2574
  async stopChannelAccount(id) {
2549
- await this.ensureReady();
2575
+ await this.ensureHttpReady();
2550
2576
  const url = `${this.getHttpBaseUrl()}/api/channels/accounts/${encodeURIComponent(id)}/stop`;
2551
2577
  const response = await fetch(url, { method: "POST", headers: this.getHttpAuthHeaders() });
2552
2578
  if (!response.ok) {
@@ -2555,7 +2581,7 @@ var SanqianSDK = class _SanqianSDK {
2555
2581
  return response.json();
2556
2582
  }
2557
2583
  async getChannelStatus(id) {
2558
- await this.ensureReady();
2584
+ await this.ensureHttpReady();
2559
2585
  const url = `${this.getHttpBaseUrl()}/api/channels/accounts/${encodeURIComponent(id)}/status`;
2560
2586
  const response = await fetch(url, { headers: this.getHttpAuthHeaders() });
2561
2587
  if (!response.ok) {
@@ -2564,7 +2590,7 @@ var SanqianSDK = class _SanqianSDK {
2564
2590
  return response.json();
2565
2591
  }
2566
2592
  async probeChannelAccount(id) {
2567
- await this.ensureReady();
2593
+ await this.ensureHttpReady();
2568
2594
  const url = `${this.getHttpBaseUrl()}/api/channels/accounts/${encodeURIComponent(id)}/probe`;
2569
2595
  const response = await fetch(url, { method: "POST", headers: this.getHttpAuthHeaders() });
2570
2596
  if (!response.ok) {
@@ -2573,8 +2599,32 @@ var SanqianSDK = class _SanqianSDK {
2573
2599
  }
2574
2600
  return response.json();
2575
2601
  }
2602
+ async probeChannelConfig(req) {
2603
+ await this.ensureHttpReady();
2604
+ const url = `${this.getHttpBaseUrl()}/api/channels/probe-config`;
2605
+ const response = await fetch(url, {
2606
+ method: "POST",
2607
+ headers: { ...this.getHttpAuthHeaders(), "Content-Type": "application/json" },
2608
+ body: JSON.stringify(req)
2609
+ });
2610
+ if (!response.ok) {
2611
+ const detail = await response.text();
2612
+ throw createSDKError("REQUEST_FAILED" /* REQUEST_FAILED */, `Failed to probe channel config: ${detail}`);
2613
+ }
2614
+ return response.json();
2615
+ }
2616
+ async getChannelConfigSchema(channelType) {
2617
+ await this.ensureHttpReady();
2618
+ const url = `${this.getHttpBaseUrl()}/api/channels/plugins/${encodeURIComponent(channelType)}/config-schema`;
2619
+ const response = await fetch(url, { headers: this.getHttpAuthHeaders() });
2620
+ if (!response.ok) {
2621
+ const detail = await response.text();
2622
+ throw createSDKError("REQUEST_FAILED" /* REQUEST_FAILED */, `Failed to get channel config schema: ${detail}`);
2623
+ }
2624
+ return response.json();
2625
+ }
2576
2626
  async listChannelBindings(accountId) {
2577
- await this.ensureReady();
2627
+ await this.ensureHttpReady();
2578
2628
  const params = accountId ? `?account_id=${encodeURIComponent(accountId)}` : "";
2579
2629
  const url = `${this.getHttpBaseUrl()}/api/channels/bindings${params}`;
2580
2630
  const response = await fetch(url, { headers: this.getHttpAuthHeaders() });
@@ -2584,7 +2634,7 @@ var SanqianSDK = class _SanqianSDK {
2584
2634
  return response.json();
2585
2635
  }
2586
2636
  async createChannelBinding(req) {
2587
- await this.ensureReady();
2637
+ await this.ensureHttpReady();
2588
2638
  const url = `${this.getHttpBaseUrl()}/api/channels/bindings`;
2589
2639
  const response = await fetch(url, {
2590
2640
  method: "POST",
@@ -2598,7 +2648,7 @@ var SanqianSDK = class _SanqianSDK {
2598
2648
  return response.json();
2599
2649
  }
2600
2650
  async updateChannelBinding(id, req) {
2601
- await this.ensureReady();
2651
+ await this.ensureHttpReady();
2602
2652
  const url = `${this.getHttpBaseUrl()}/api/channels/bindings/${encodeURIComponent(id)}`;
2603
2653
  const response = await fetch(url, {
2604
2654
  method: "PUT",
@@ -2612,7 +2662,7 @@ var SanqianSDK = class _SanqianSDK {
2612
2662
  return response.json();
2613
2663
  }
2614
2664
  async deleteChannelBinding(id) {
2615
- await this.ensureReady();
2665
+ await this.ensureHttpReady();
2616
2666
  const url = `${this.getHttpBaseUrl()}/api/channels/bindings/${encodeURIComponent(id)}`;
2617
2667
  const response = await fetch(url, { method: "DELETE", headers: this.getHttpAuthHeaders() });
2618
2668
  if (!response.ok) {
@@ -2620,7 +2670,7 @@ var SanqianSDK = class _SanqianSDK {
2620
2670
  }
2621
2671
  }
2622
2672
  async sendChannelMessage(req) {
2623
- await this.ensureReady();
2673
+ await this.ensureHttpReady();
2624
2674
  const url = `${this.getHttpBaseUrl()}/api/channels/send`;
2625
2675
  const response = await fetch(url, {
2626
2676
  method: "POST",