@mitralab.io/sdk-core 0.2.8 → 0.2.9-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1088,6 +1088,13 @@ interface AgentTaskEvent {
1088
1088
  /** Present only on persisted structural events; live deltas omit it. */
1089
1089
  sequence?: number;
1090
1090
  }
1091
+ /** Where the Copilot serves a chat on its box, and how far that box's log went when it answered. */
1092
+ interface AgentTaskChannel {
1093
+ /** Box socket address. The query carries a short-lived grant, so it is never logged or reused. */
1094
+ wsUrl: string;
1095
+ /** Last sequence in the box log, 0 when the box reported none. */
1096
+ lastSequence: number;
1097
+ }
1091
1098
  interface AgentMessage {
1092
1099
  id: string;
1093
1100
  sender: string;
@@ -1297,6 +1304,12 @@ interface AgentTasksModule {
1297
1304
  sendInput(id: string, input: AgentTaskInput): Promise<void>;
1298
1305
  /** Lists persisted messages. Defaults: page 0, size 50, sort createdAt. */
1299
1306
  listMessages(id: string, options?: PageOptions): Promise<Page<AgentMessage>>;
1307
+ /**
1308
+ * Asks the Copilot where the chat is served. It holds the request while the box boots and
1309
+ * answers with the box socket, or null (202) when it offers none. Optional so hand-written
1310
+ * modules keep compiling; a module without it never takes the direct channel.
1311
+ */
1312
+ channel?(id: string): Promise<AgentTaskChannel | null>;
1300
1313
  }
1301
1314
  declare function createAgentTasksModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentTasksModule;
1302
1315
 
@@ -1767,6 +1780,65 @@ interface SdkCore {
1767
1780
  }
1768
1781
  declare function createSdkCore(options: SdkCoreOptions): SdkCore;
1769
1782
 
1783
+ /**
1784
+ * The part of a WebSocket the channel uses: the browser one and `ws` both fit. Handlers take
1785
+ * `never` so either implementation's own event types can be assigned without a cast.
1786
+ */
1787
+ interface AgentWebSocket {
1788
+ readonly readyState: number;
1789
+ onopen: ((event: never) => void) | null;
1790
+ onmessage: ((event: never) => void) | null;
1791
+ onerror: ((event: never) => void) | null;
1792
+ onclose: ((event: never) => void) | null;
1793
+ send(data: string): void;
1794
+ close(code?: number, reason?: string): void;
1795
+ }
1796
+ type AgentWebSocketConstructor = new (url: string) => AgentWebSocket;
1797
+ interface AgentDirectChannelOptions {
1798
+ /**
1799
+ * API base URL of the SDK. A channel on this same host is the gateway proxying the box; any
1800
+ * other host must be a fleet box over `wss:`. Required: without it the direct channel is off
1801
+ * and the session stays on the event source and REST inputs.
1802
+ */
1803
+ apiUrl?: string;
1804
+ /**
1805
+ * WebSocket implementation for runtimes with no global one, such as Node 18 and 20. Wins over
1806
+ * `globalThis.WebSocket` when given. With neither, the chat stays on the event source and a
1807
+ * `channelDeclined` event with reason `websocket` says so.
1808
+ */
1809
+ WebSocket?: AgentWebSocketConstructor;
1810
+ /** fetch for the box's HTTP routes. Defaults to `globalThis.fetch`. */
1811
+ fetch?: AgentFetch;
1812
+ }
1813
+ /** The part of a fetch response the HTTP channel reads. */
1814
+ interface AgentFetchResponse {
1815
+ readonly ok: boolean;
1816
+ readonly status: number;
1817
+ json(): Promise<unknown>;
1818
+ readonly body: {
1819
+ getReader(): {
1820
+ read(): Promise<{
1821
+ done: boolean;
1822
+ value?: Uint8Array | undefined;
1823
+ }>;
1824
+ cancel(): Promise<void>;
1825
+ releaseLock(): void;
1826
+ };
1827
+ } | null;
1828
+ }
1829
+ type AgentFetch = (url: string, init: {
1830
+ method?: string;
1831
+ headers?: Record<string, string>;
1832
+ body?: string;
1833
+ signal?: AbortSignal;
1834
+ redirect?: "error";
1835
+ }) => Promise<AgentFetchResponse>;
1836
+
1837
+ declare class AgentTaskTurnError extends Error {
1838
+ readonly code: string | undefined;
1839
+ constructor(message: string, code?: string);
1840
+ }
1841
+
1770
1842
  interface AgentTaskEventObserver {
1771
1843
  onEvent(event: AgentTaskEvent): void;
1772
1844
  onDisconnect(error?: unknown): void;
@@ -1774,7 +1846,10 @@ interface AgentTaskEventObserver {
1774
1846
  interface AgentTaskEventConnection {
1775
1847
  close(): void;
1776
1848
  }
1777
- /** Streaming boundary implemented by concrete SDKs. Core never opens HTTP or WebSocket itself. */
1849
+ /**
1850
+ * Streaming boundary implemented by concrete SDKs: the Copilot stream a chat falls back to when
1851
+ * its box offers no direct channel. The direct channel itself is Core's.
1852
+ */
1778
1853
  interface AgentTaskEventSource {
1779
1854
  open(taskId: string, observer: AgentTaskEventObserver, signal?: AbortSignal, transport?: AgentSessionTransport): Promise<AgentTaskEventConnection>;
1780
1855
  }
@@ -1790,7 +1865,11 @@ interface NewAgentTaskSessionOptions {
1790
1865
  runtime?: AgentTaskRuntime;
1791
1866
  /** Credential scope the task resolves against. Omitted means the Copilot server default. */
1792
1867
  scope?: AgentCredentialScope;
1793
- /** Adapter preference. Server adapters support `http`; browser adapters may support all values. */
1868
+ /**
1869
+ * How the session reaches the box the Copilot offers: `websocket` on its socket, `http` on its
1870
+ * HTTP routes, `auto` on the socket when available and HTTP otherwise. Without an offer the
1871
+ * session falls back to the event source.
1872
+ */
1794
1873
  transport?: AgentSessionTransport;
1795
1874
  }
1796
1875
  interface ExistingAgentTaskSessionOptions {
@@ -1836,10 +1915,6 @@ interface AgentTurnResult {
1836
1915
  content: string;
1837
1916
  reason: string;
1838
1917
  }
1839
- declare class AgentTaskTurnError extends Error {
1840
- readonly code: string | undefined;
1841
- constructor(message: string, code?: string);
1842
- }
1843
1918
  interface AgentTaskSessionEventMap {
1844
1919
  statusChange: {
1845
1920
  status: AgentTaskSessionStatus;
@@ -1861,6 +1936,12 @@ interface AgentTaskSessionEventMap {
1861
1936
  timestamp: number;
1862
1937
  };
1863
1938
  turnEnd: AgentTurnResult;
1939
+ /**
1940
+ * The prompt reached the server: the box admitted the turn on the direct channel, or the
1941
+ * Copilot accepted it over REST. From here the turn runs without this session, so a caller
1942
+ * that does not wait for the answer can close it or return.
1943
+ */
1944
+ accepted: Record<string, never>;
1864
1945
  cancelled: Record<string, never>;
1865
1946
  queueChange: {
1866
1947
  queue: readonly AgentQueueItem[];
@@ -1899,6 +1980,8 @@ type AgentTasksWithSessions = AgentTasksModule & AgentTaskSessionManager;
1899
1980
  interface AgentTaskSessionManagerOptions {
1900
1981
  tasks: AgentTasksModule;
1901
1982
  eventSource: AgentTaskEventSource;
1983
+ /** Where the box channel may live and how to dial it outside a browser. */
1984
+ directChannel?: AgentDirectChannelOptions;
1902
1985
  }
1903
1986
  declare function toAgentTimelineItem(message: AgentMessage): AgentTimelineItem;
1904
1987
  declare function createAgentTaskSessionManager(options: AgentTaskSessionManagerOptions): AgentTaskSessionManager;
@@ -1958,4 +2041,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
1958
2041
  declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
1959
2042
  declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
1960
2043
 
1961
- export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentInput, type AgentMessage, type AgentModel, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentUpdateItem, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
2044
+ export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentInput, type AgentMessage, type AgentModel, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
package/dist/index.d.ts CHANGED
@@ -1088,6 +1088,13 @@ interface AgentTaskEvent {
1088
1088
  /** Present only on persisted structural events; live deltas omit it. */
1089
1089
  sequence?: number;
1090
1090
  }
1091
+ /** Where the Copilot serves a chat on its box, and how far that box's log went when it answered. */
1092
+ interface AgentTaskChannel {
1093
+ /** Box socket address. The query carries a short-lived grant, so it is never logged or reused. */
1094
+ wsUrl: string;
1095
+ /** Last sequence in the box log, 0 when the box reported none. */
1096
+ lastSequence: number;
1097
+ }
1091
1098
  interface AgentMessage {
1092
1099
  id: string;
1093
1100
  sender: string;
@@ -1297,6 +1304,12 @@ interface AgentTasksModule {
1297
1304
  sendInput(id: string, input: AgentTaskInput): Promise<void>;
1298
1305
  /** Lists persisted messages. Defaults: page 0, size 50, sort createdAt. */
1299
1306
  listMessages(id: string, options?: PageOptions): Promise<Page<AgentMessage>>;
1307
+ /**
1308
+ * Asks the Copilot where the chat is served. It holds the request while the box boots and
1309
+ * answers with the box socket, or null (202) when it offers none. Optional so hand-written
1310
+ * modules keep compiling; a module without it never takes the direct channel.
1311
+ */
1312
+ channel?(id: string): Promise<AgentTaskChannel | null>;
1300
1313
  }
1301
1314
  declare function createAgentTasksModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentTasksModule;
1302
1315
 
@@ -1767,6 +1780,65 @@ interface SdkCore {
1767
1780
  }
1768
1781
  declare function createSdkCore(options: SdkCoreOptions): SdkCore;
1769
1782
 
1783
+ /**
1784
+ * The part of a WebSocket the channel uses: the browser one and `ws` both fit. Handlers take
1785
+ * `never` so either implementation's own event types can be assigned without a cast.
1786
+ */
1787
+ interface AgentWebSocket {
1788
+ readonly readyState: number;
1789
+ onopen: ((event: never) => void) | null;
1790
+ onmessage: ((event: never) => void) | null;
1791
+ onerror: ((event: never) => void) | null;
1792
+ onclose: ((event: never) => void) | null;
1793
+ send(data: string): void;
1794
+ close(code?: number, reason?: string): void;
1795
+ }
1796
+ type AgentWebSocketConstructor = new (url: string) => AgentWebSocket;
1797
+ interface AgentDirectChannelOptions {
1798
+ /**
1799
+ * API base URL of the SDK. A channel on this same host is the gateway proxying the box; any
1800
+ * other host must be a fleet box over `wss:`. Required: without it the direct channel is off
1801
+ * and the session stays on the event source and REST inputs.
1802
+ */
1803
+ apiUrl?: string;
1804
+ /**
1805
+ * WebSocket implementation for runtimes with no global one, such as Node 18 and 20. Wins over
1806
+ * `globalThis.WebSocket` when given. With neither, the chat stays on the event source and a
1807
+ * `channelDeclined` event with reason `websocket` says so.
1808
+ */
1809
+ WebSocket?: AgentWebSocketConstructor;
1810
+ /** fetch for the box's HTTP routes. Defaults to `globalThis.fetch`. */
1811
+ fetch?: AgentFetch;
1812
+ }
1813
+ /** The part of a fetch response the HTTP channel reads. */
1814
+ interface AgentFetchResponse {
1815
+ readonly ok: boolean;
1816
+ readonly status: number;
1817
+ json(): Promise<unknown>;
1818
+ readonly body: {
1819
+ getReader(): {
1820
+ read(): Promise<{
1821
+ done: boolean;
1822
+ value?: Uint8Array | undefined;
1823
+ }>;
1824
+ cancel(): Promise<void>;
1825
+ releaseLock(): void;
1826
+ };
1827
+ } | null;
1828
+ }
1829
+ type AgentFetch = (url: string, init: {
1830
+ method?: string;
1831
+ headers?: Record<string, string>;
1832
+ body?: string;
1833
+ signal?: AbortSignal;
1834
+ redirect?: "error";
1835
+ }) => Promise<AgentFetchResponse>;
1836
+
1837
+ declare class AgentTaskTurnError extends Error {
1838
+ readonly code: string | undefined;
1839
+ constructor(message: string, code?: string);
1840
+ }
1841
+
1770
1842
  interface AgentTaskEventObserver {
1771
1843
  onEvent(event: AgentTaskEvent): void;
1772
1844
  onDisconnect(error?: unknown): void;
@@ -1774,7 +1846,10 @@ interface AgentTaskEventObserver {
1774
1846
  interface AgentTaskEventConnection {
1775
1847
  close(): void;
1776
1848
  }
1777
- /** Streaming boundary implemented by concrete SDKs. Core never opens HTTP or WebSocket itself. */
1849
+ /**
1850
+ * Streaming boundary implemented by concrete SDKs: the Copilot stream a chat falls back to when
1851
+ * its box offers no direct channel. The direct channel itself is Core's.
1852
+ */
1778
1853
  interface AgentTaskEventSource {
1779
1854
  open(taskId: string, observer: AgentTaskEventObserver, signal?: AbortSignal, transport?: AgentSessionTransport): Promise<AgentTaskEventConnection>;
1780
1855
  }
@@ -1790,7 +1865,11 @@ interface NewAgentTaskSessionOptions {
1790
1865
  runtime?: AgentTaskRuntime;
1791
1866
  /** Credential scope the task resolves against. Omitted means the Copilot server default. */
1792
1867
  scope?: AgentCredentialScope;
1793
- /** Adapter preference. Server adapters support `http`; browser adapters may support all values. */
1868
+ /**
1869
+ * How the session reaches the box the Copilot offers: `websocket` on its socket, `http` on its
1870
+ * HTTP routes, `auto` on the socket when available and HTTP otherwise. Without an offer the
1871
+ * session falls back to the event source.
1872
+ */
1794
1873
  transport?: AgentSessionTransport;
1795
1874
  }
1796
1875
  interface ExistingAgentTaskSessionOptions {
@@ -1836,10 +1915,6 @@ interface AgentTurnResult {
1836
1915
  content: string;
1837
1916
  reason: string;
1838
1917
  }
1839
- declare class AgentTaskTurnError extends Error {
1840
- readonly code: string | undefined;
1841
- constructor(message: string, code?: string);
1842
- }
1843
1918
  interface AgentTaskSessionEventMap {
1844
1919
  statusChange: {
1845
1920
  status: AgentTaskSessionStatus;
@@ -1861,6 +1936,12 @@ interface AgentTaskSessionEventMap {
1861
1936
  timestamp: number;
1862
1937
  };
1863
1938
  turnEnd: AgentTurnResult;
1939
+ /**
1940
+ * The prompt reached the server: the box admitted the turn on the direct channel, or the
1941
+ * Copilot accepted it over REST. From here the turn runs without this session, so a caller
1942
+ * that does not wait for the answer can close it or return.
1943
+ */
1944
+ accepted: Record<string, never>;
1864
1945
  cancelled: Record<string, never>;
1865
1946
  queueChange: {
1866
1947
  queue: readonly AgentQueueItem[];
@@ -1899,6 +1980,8 @@ type AgentTasksWithSessions = AgentTasksModule & AgentTaskSessionManager;
1899
1980
  interface AgentTaskSessionManagerOptions {
1900
1981
  tasks: AgentTasksModule;
1901
1982
  eventSource: AgentTaskEventSource;
1983
+ /** Where the box channel may live and how to dial it outside a browser. */
1984
+ directChannel?: AgentDirectChannelOptions;
1902
1985
  }
1903
1986
  declare function toAgentTimelineItem(message: AgentMessage): AgentTimelineItem;
1904
1987
  declare function createAgentTaskSessionManager(options: AgentTaskSessionManagerOptions): AgentTaskSessionManager;
@@ -1958,4 +2041,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
1958
2041
  declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
1959
2042
  declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
1960
2043
 
1961
- export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentInput, type AgentMessage, type AgentModel, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentUpdateItem, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
2044
+ export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentInput, type AgentMessage, type AgentModel, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };