@mitralab.io/sdk-core 0.2.3 → 0.2.5-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.cjs CHANGED
@@ -995,6 +995,7 @@ function expectAgentTask(value, context, errors = defaultSdkCoreErrorFactory) {
995
995
  for (const field of ["appId", "agentId", "userId", "title", "reasoningEffort"]) {
996
996
  if (!isNullableString(task[field])) invalidField(context, field, errors);
997
997
  }
998
+ if ("scope" in task && !isNullableString(task.scope)) invalidField(context, "scope", errors);
998
999
  if (typeof task.agentType !== "string") invalidField(context, "agentType", errors);
999
1000
  if (typeof task.archived !== "boolean") invalidField(context, "archived", errors);
1000
1001
  if (!isNullableString(task.createdAt)) invalidField(context, "createdAt", errors);
@@ -1232,76 +1233,83 @@ function createAgentConnectionsModule(transport, errors = defaultSdkCoreErrorFac
1232
1233
  // src/modules/agentCredentials.ts
1233
1234
  function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFactory) {
1234
1235
  const providerSegment = (provider) => encodePathSegment(provider, "provider", errors);
1236
+ const scopeParams = (options) => options?.scope ? { params: { scope: options.scope } } : {};
1235
1237
  return {
1236
- async list() {
1238
+ async list(options) {
1237
1239
  return expectObjectArray(
1238
- await transport.request("/api/v1/credentials", { method: "GET" }),
1240
+ await transport.request("/api/v1/credentials", {
1241
+ method: "GET",
1242
+ ...scopeParams(options)
1243
+ }),
1239
1244
  "Credential status response",
1240
1245
  errors,
1241
1246
  expectCredentialStatus
1242
1247
  );
1243
1248
  },
1244
- async listModels(agentId) {
1249
+ async listModels(agentId, options) {
1245
1250
  return expectObjectArray(
1246
1251
  await transport.request("/api/v1/models", {
1247
1252
  method: "GET",
1248
- params: { agentId }
1253
+ params: { agentId, ...scopeParams(options).params }
1249
1254
  }),
1250
1255
  "Agent model response",
1251
1256
  errors,
1252
1257
  expectAgentModel
1253
1258
  );
1254
1259
  },
1255
- async saveApiKey(provider, apiKey) {
1260
+ async saveApiKey(provider, apiKey, options) {
1256
1261
  expectEmpty(
1257
1262
  await transport.request(
1258
1263
  `/api/v1/credentials/${providerSegment(provider)}/api-key`,
1259
- { method: "PUT", body: { apiKey } }
1264
+ { method: "PUT", body: { apiKey }, ...scopeParams(options) }
1260
1265
  ),
1261
1266
  "Save API key response",
1262
1267
  errors
1263
1268
  );
1264
1269
  },
1265
- async remove(provider) {
1270
+ async remove(provider, options) {
1266
1271
  expectEmpty(
1267
1272
  await transport.request(`/api/v1/credentials/${providerSegment(provider)}`, {
1268
- method: "DELETE"
1273
+ method: "DELETE",
1274
+ ...scopeParams(options)
1269
1275
  }),
1270
1276
  "Remove credential response",
1271
1277
  errors
1272
1278
  );
1273
1279
  },
1274
- async startOAuth(provider) {
1280
+ async startOAuth(provider, options) {
1275
1281
  return expectOAuthStartResult(
1276
1282
  await transport.request("/api/v1/oauth/start", {
1277
1283
  method: "POST",
1278
- body: { provider }
1284
+ body: { provider },
1285
+ ...scopeParams(options)
1279
1286
  }),
1280
1287
  "OAuth start response",
1281
1288
  errors
1282
1289
  );
1283
1290
  },
1284
- async exchangeOAuth(provider, input) {
1291
+ async exchangeOAuth(provider, input, options) {
1285
1292
  return expectAuthenticationResult(
1286
1293
  await transport.request("/api/v1/oauth/exchange", {
1287
1294
  method: "POST",
1288
- body: { provider, ...input }
1295
+ body: { provider, ...input },
1296
+ ...scopeParams(options)
1289
1297
  }),
1290
1298
  "OAuth exchange response",
1291
1299
  errors
1292
1300
  );
1293
1301
  },
1294
- async startDeviceAuthorization(provider) {
1302
+ async startDeviceAuthorization(provider, options) {
1295
1303
  return expectDeviceAuthorization(
1296
1304
  await transport.request(
1297
1305
  `/api/v1/credentials/${providerSegment(provider)}/device-authorizations`,
1298
- { method: "POST" }
1306
+ { method: "POST", ...scopeParams(options) }
1299
1307
  ),
1300
1308
  "Device authorization response",
1301
1309
  errors
1302
1310
  );
1303
1311
  },
1304
- async pollDeviceAuthorization(provider, deviceAuthId) {
1312
+ async pollDeviceAuthorization(provider, deviceAuthId, options) {
1305
1313
  return expectAuthenticationResult(
1306
1314
  await transport.request(
1307
1315
  `/api/v1/credentials/${providerSegment(provider)}/device-authorizations/${encodePathSegment(
@@ -1309,7 +1317,7 @@ function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFac
1309
1317
  "device authorization id",
1310
1318
  errors
1311
1319
  )}/poll`,
1312
- { method: "POST" }
1320
+ { method: "POST", ...scopeParams(options) }
1313
1321
  ),
1314
1322
  "Device authorization poll response",
1315
1323
  errors
@@ -3344,7 +3352,17 @@ var CoreAgentTaskSession = class {
3344
3352
  }
3345
3353
  if (this.isClosed() || waiter?.settled) return;
3346
3354
  await this.ensureTask();
3347
- if (this.isClosed() || waiter?.settled) return;
3355
+ const input = {
3356
+ type: "message",
3357
+ content: prompt,
3358
+ ...options.agentType ? { agentType: options.agentType } : {},
3359
+ ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {}
3360
+ };
3361
+ if (this.isClosed()) {
3362
+ await this.sendInput(input).catch(() => void 0);
3363
+ return;
3364
+ }
3365
+ if (waiter?.settled) return;
3348
3366
  await this.ensureChannel();
3349
3367
  if (this.isClosed() || waiter?.settled) return;
3350
3368
  await this.captureTurnBaseline();
@@ -3355,12 +3373,7 @@ var CoreAgentTaskSession = class {
3355
3373
  this.activeWaiter = waiter;
3356
3374
  this.setStatus("streaming");
3357
3375
  this.emit("turnStart", {});
3358
- await this.sendInput({
3359
- type: "message",
3360
- content: prompt,
3361
- ...options.agentType ? { agentType: options.agentType } : {},
3362
- ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {}
3363
- });
3376
+ await this.sendInput(input);
3364
3377
  }
3365
3378
  async ensureTask() {
3366
3379
  if (this._taskId) return;
@@ -3374,7 +3387,8 @@ var CoreAgentTaskSession = class {
3374
3387
  ...createOptions.agentId ? { agentId: createOptions.agentId } : {},
3375
3388
  ...createOptions.reasoningEffort ? { reasoningEffort: createOptions.reasoningEffort } : {},
3376
3389
  ...createOptions.userId ? { userId: createOptions.userId } : {},
3377
- ...createOptions.runtime ? { runtime: createOptions.runtime } : {}
3390
+ ...createOptions.runtime ? { runtime: createOptions.runtime } : {},
3391
+ ...createOptions.scope ? { scope: createOptions.scope } : {}
3378
3392
  });
3379
3393
  this._task = task;
3380
3394
  this._taskId = task.id;
package/dist/index.d.cts CHANGED
@@ -1022,6 +1022,8 @@ interface IntegrationExecution {
1022
1022
  type CopilotProvider = "ANTHROPIC" | "OPENAI" | (string & {});
1023
1023
  /** Execution runtime a chat is born on. Absent means the Copilot server default. */
1024
1024
  type AgentTaskRuntime = "T3" | "RUNNER";
1025
+ /** Credential scope a call or a chat resolves against. Absent means the Copilot server default. */
1026
+ type AgentCredentialScope = "ACCOUNT";
1025
1027
  interface AgentTaskCreateInput {
1026
1028
  /** Optional title, at most 255 characters. */
1027
1029
  title?: string;
@@ -1033,6 +1035,8 @@ interface AgentTaskCreateInput {
1033
1035
  reasoningEffort?: string;
1034
1036
  /** Optional runtime. Core never defaults it; the concrete SDK decides what to send. */
1035
1037
  runtime?: AgentTaskRuntime;
1038
+ /** Optional credential scope. Core never defaults it; the concrete SDK decides what to send. */
1039
+ scope?: AgentCredentialScope;
1036
1040
  /** Owner for an on-behalf chat. Requires AGENT_WRITE in the current app. */
1037
1041
  userId?: string;
1038
1042
  /**
@@ -1049,6 +1053,8 @@ interface AgentTask {
1049
1053
  title: string | null;
1050
1054
  agentType: string;
1051
1055
  reasoningEffort: string | null;
1056
+ /** Absent on a Copilot that predates credential scopes; null on a task without one. */
1057
+ scope?: AgentCredentialScope | null;
1052
1058
  archived: boolean;
1053
1059
  createdAt: string | null;
1054
1060
  updatedAt: string;
@@ -1188,23 +1194,27 @@ interface AgentConnectionsModule {
1188
1194
  }
1189
1195
  declare function createAgentConnectionsModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentConnectionsModule;
1190
1196
 
1197
+ interface AgentCredentialOptions {
1198
+ /** Credential scope the call resolves against. Omitted means the Copilot server default. */
1199
+ scope?: AgentCredentialScope;
1200
+ }
1191
1201
  interface AgentCredentialsModule {
1192
1202
  /** Lists safe credential status. Raw credentials never leave Copilot. */
1193
- list(): Promise<CredentialStatus[]>;
1203
+ list(options?: AgentCredentialOptions): Promise<CredentialStatus[]>;
1194
1204
  /** Lists models backed by a usable credential, optionally through a business agent connection. */
1195
- listModels(agentId?: string): Promise<AgentModel[]>;
1205
+ listModels(agentId?: string, options?: AgentCredentialOptions): Promise<AgentModel[]>;
1196
1206
  /** Validates and stores a write-only API key. */
1197
- saveApiKey(provider: CopilotProvider, apiKey: string): Promise<void>;
1207
+ saveApiKey(provider: CopilotProvider, apiKey: string, options?: AgentCredentialOptions): Promise<void>;
1198
1208
  /** Permanently removes the current credential for a provider. */
1199
- remove(provider: CopilotProvider): Promise<void>;
1209
+ remove(provider: CopilotProvider, options?: AgentCredentialOptions): Promise<void>;
1200
1210
  /** Starts provider OAuth and returns an opaque state that must be preserved. */
1201
- startOAuth(provider: CopilotProvider): Promise<OAuthStartResult>;
1211
+ startOAuth(provider: CopilotProvider, options?: AgentCredentialOptions): Promise<OAuthStartResult>;
1202
1212
  /** Exchanges provider OAuth code and state, saving the resulting credential. */
1203
- exchangeOAuth(provider: CopilotProvider, input: OAuthExchangeInput): Promise<AuthenticationResult>;
1213
+ exchangeOAuth(provider: CopilotProvider, input: OAuthExchangeInput, options?: AgentCredentialOptions): Promise<AuthenticationResult>;
1204
1214
  /** Starts a provider device flow and returns its polling interval. */
1205
- startDeviceAuthorization(provider: CopilotProvider): Promise<DeviceAuthorization>;
1215
+ startDeviceAuthorization(provider: CopilotProvider, options?: AgentCredentialOptions): Promise<DeviceAuthorization>;
1206
1216
  /** Polls one device authorization. Respect the returned start interval between calls. */
1207
- pollDeviceAuthorization(provider: CopilotProvider, deviceAuthId: string): Promise<AuthenticationResult>;
1217
+ pollDeviceAuthorization(provider: CopilotProvider, deviceAuthId: string, options?: AgentCredentialOptions): Promise<AuthenticationResult>;
1208
1218
  }
1209
1219
  declare function createAgentCredentialsModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentCredentialsModule;
1210
1220
 
@@ -1738,6 +1748,8 @@ interface NewAgentTaskSessionOptions {
1738
1748
  userId?: string;
1739
1749
  /** Runtime the task is born on. Omitted means the Copilot server default. */
1740
1750
  runtime?: AgentTaskRuntime;
1751
+ /** Credential scope the task resolves against. Omitted means the Copilot server default. */
1752
+ scope?: AgentCredentialScope;
1741
1753
  /** Adapter preference. Server adapters support `http`; browser adapters may support all values. */
1742
1754
  transport?: AgentSessionTransport;
1743
1755
  }
@@ -1906,4 +1918,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
1906
1918
  declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
1907
1919
  declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
1908
1920
 
1909
- export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionsModule, 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 };
1921
+ export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, 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 };
package/dist/index.d.ts CHANGED
@@ -1022,6 +1022,8 @@ interface IntegrationExecution {
1022
1022
  type CopilotProvider = "ANTHROPIC" | "OPENAI" | (string & {});
1023
1023
  /** Execution runtime a chat is born on. Absent means the Copilot server default. */
1024
1024
  type AgentTaskRuntime = "T3" | "RUNNER";
1025
+ /** Credential scope a call or a chat resolves against. Absent means the Copilot server default. */
1026
+ type AgentCredentialScope = "ACCOUNT";
1025
1027
  interface AgentTaskCreateInput {
1026
1028
  /** Optional title, at most 255 characters. */
1027
1029
  title?: string;
@@ -1033,6 +1035,8 @@ interface AgentTaskCreateInput {
1033
1035
  reasoningEffort?: string;
1034
1036
  /** Optional runtime. Core never defaults it; the concrete SDK decides what to send. */
1035
1037
  runtime?: AgentTaskRuntime;
1038
+ /** Optional credential scope. Core never defaults it; the concrete SDK decides what to send. */
1039
+ scope?: AgentCredentialScope;
1036
1040
  /** Owner for an on-behalf chat. Requires AGENT_WRITE in the current app. */
1037
1041
  userId?: string;
1038
1042
  /**
@@ -1049,6 +1053,8 @@ interface AgentTask {
1049
1053
  title: string | null;
1050
1054
  agentType: string;
1051
1055
  reasoningEffort: string | null;
1056
+ /** Absent on a Copilot that predates credential scopes; null on a task without one. */
1057
+ scope?: AgentCredentialScope | null;
1052
1058
  archived: boolean;
1053
1059
  createdAt: string | null;
1054
1060
  updatedAt: string;
@@ -1188,23 +1194,27 @@ interface AgentConnectionsModule {
1188
1194
  }
1189
1195
  declare function createAgentConnectionsModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentConnectionsModule;
1190
1196
 
1197
+ interface AgentCredentialOptions {
1198
+ /** Credential scope the call resolves against. Omitted means the Copilot server default. */
1199
+ scope?: AgentCredentialScope;
1200
+ }
1191
1201
  interface AgentCredentialsModule {
1192
1202
  /** Lists safe credential status. Raw credentials never leave Copilot. */
1193
- list(): Promise<CredentialStatus[]>;
1203
+ list(options?: AgentCredentialOptions): Promise<CredentialStatus[]>;
1194
1204
  /** Lists models backed by a usable credential, optionally through a business agent connection. */
1195
- listModels(agentId?: string): Promise<AgentModel[]>;
1205
+ listModels(agentId?: string, options?: AgentCredentialOptions): Promise<AgentModel[]>;
1196
1206
  /** Validates and stores a write-only API key. */
1197
- saveApiKey(provider: CopilotProvider, apiKey: string): Promise<void>;
1207
+ saveApiKey(provider: CopilotProvider, apiKey: string, options?: AgentCredentialOptions): Promise<void>;
1198
1208
  /** Permanently removes the current credential for a provider. */
1199
- remove(provider: CopilotProvider): Promise<void>;
1209
+ remove(provider: CopilotProvider, options?: AgentCredentialOptions): Promise<void>;
1200
1210
  /** Starts provider OAuth and returns an opaque state that must be preserved. */
1201
- startOAuth(provider: CopilotProvider): Promise<OAuthStartResult>;
1211
+ startOAuth(provider: CopilotProvider, options?: AgentCredentialOptions): Promise<OAuthStartResult>;
1202
1212
  /** Exchanges provider OAuth code and state, saving the resulting credential. */
1203
- exchangeOAuth(provider: CopilotProvider, input: OAuthExchangeInput): Promise<AuthenticationResult>;
1213
+ exchangeOAuth(provider: CopilotProvider, input: OAuthExchangeInput, options?: AgentCredentialOptions): Promise<AuthenticationResult>;
1204
1214
  /** Starts a provider device flow and returns its polling interval. */
1205
- startDeviceAuthorization(provider: CopilotProvider): Promise<DeviceAuthorization>;
1215
+ startDeviceAuthorization(provider: CopilotProvider, options?: AgentCredentialOptions): Promise<DeviceAuthorization>;
1206
1216
  /** Polls one device authorization. Respect the returned start interval between calls. */
1207
- pollDeviceAuthorization(provider: CopilotProvider, deviceAuthId: string): Promise<AuthenticationResult>;
1217
+ pollDeviceAuthorization(provider: CopilotProvider, deviceAuthId: string, options?: AgentCredentialOptions): Promise<AuthenticationResult>;
1208
1218
  }
1209
1219
  declare function createAgentCredentialsModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentCredentialsModule;
1210
1220
 
@@ -1738,6 +1748,8 @@ interface NewAgentTaskSessionOptions {
1738
1748
  userId?: string;
1739
1749
  /** Runtime the task is born on. Omitted means the Copilot server default. */
1740
1750
  runtime?: AgentTaskRuntime;
1751
+ /** Credential scope the task resolves against. Omitted means the Copilot server default. */
1752
+ scope?: AgentCredentialScope;
1741
1753
  /** Adapter preference. Server adapters support `http`; browser adapters may support all values. */
1742
1754
  transport?: AgentSessionTransport;
1743
1755
  }
@@ -1906,4 +1918,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
1906
1918
  declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
1907
1919
  declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
1908
1920
 
1909
- export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionsModule, 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 };
1921
+ export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, 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 };
package/dist/index.js CHANGED
@@ -923,6 +923,7 @@ function expectAgentTask(value, context, errors = defaultSdkCoreErrorFactory) {
923
923
  for (const field of ["appId", "agentId", "userId", "title", "reasoningEffort"]) {
924
924
  if (!isNullableString(task[field])) invalidField(context, field, errors);
925
925
  }
926
+ if ("scope" in task && !isNullableString(task.scope)) invalidField(context, "scope", errors);
926
927
  if (typeof task.agentType !== "string") invalidField(context, "agentType", errors);
927
928
  if (typeof task.archived !== "boolean") invalidField(context, "archived", errors);
928
929
  if (!isNullableString(task.createdAt)) invalidField(context, "createdAt", errors);
@@ -1160,76 +1161,83 @@ function createAgentConnectionsModule(transport, errors = defaultSdkCoreErrorFac
1160
1161
  // src/modules/agentCredentials.ts
1161
1162
  function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFactory) {
1162
1163
  const providerSegment = (provider) => encodePathSegment(provider, "provider", errors);
1164
+ const scopeParams = (options) => options?.scope ? { params: { scope: options.scope } } : {};
1163
1165
  return {
1164
- async list() {
1166
+ async list(options) {
1165
1167
  return expectObjectArray(
1166
- await transport.request("/api/v1/credentials", { method: "GET" }),
1168
+ await transport.request("/api/v1/credentials", {
1169
+ method: "GET",
1170
+ ...scopeParams(options)
1171
+ }),
1167
1172
  "Credential status response",
1168
1173
  errors,
1169
1174
  expectCredentialStatus
1170
1175
  );
1171
1176
  },
1172
- async listModels(agentId) {
1177
+ async listModels(agentId, options) {
1173
1178
  return expectObjectArray(
1174
1179
  await transport.request("/api/v1/models", {
1175
1180
  method: "GET",
1176
- params: { agentId }
1181
+ params: { agentId, ...scopeParams(options).params }
1177
1182
  }),
1178
1183
  "Agent model response",
1179
1184
  errors,
1180
1185
  expectAgentModel
1181
1186
  );
1182
1187
  },
1183
- async saveApiKey(provider, apiKey) {
1188
+ async saveApiKey(provider, apiKey, options) {
1184
1189
  expectEmpty(
1185
1190
  await transport.request(
1186
1191
  `/api/v1/credentials/${providerSegment(provider)}/api-key`,
1187
- { method: "PUT", body: { apiKey } }
1192
+ { method: "PUT", body: { apiKey }, ...scopeParams(options) }
1188
1193
  ),
1189
1194
  "Save API key response",
1190
1195
  errors
1191
1196
  );
1192
1197
  },
1193
- async remove(provider) {
1198
+ async remove(provider, options) {
1194
1199
  expectEmpty(
1195
1200
  await transport.request(`/api/v1/credentials/${providerSegment(provider)}`, {
1196
- method: "DELETE"
1201
+ method: "DELETE",
1202
+ ...scopeParams(options)
1197
1203
  }),
1198
1204
  "Remove credential response",
1199
1205
  errors
1200
1206
  );
1201
1207
  },
1202
- async startOAuth(provider) {
1208
+ async startOAuth(provider, options) {
1203
1209
  return expectOAuthStartResult(
1204
1210
  await transport.request("/api/v1/oauth/start", {
1205
1211
  method: "POST",
1206
- body: { provider }
1212
+ body: { provider },
1213
+ ...scopeParams(options)
1207
1214
  }),
1208
1215
  "OAuth start response",
1209
1216
  errors
1210
1217
  );
1211
1218
  },
1212
- async exchangeOAuth(provider, input) {
1219
+ async exchangeOAuth(provider, input, options) {
1213
1220
  return expectAuthenticationResult(
1214
1221
  await transport.request("/api/v1/oauth/exchange", {
1215
1222
  method: "POST",
1216
- body: { provider, ...input }
1223
+ body: { provider, ...input },
1224
+ ...scopeParams(options)
1217
1225
  }),
1218
1226
  "OAuth exchange response",
1219
1227
  errors
1220
1228
  );
1221
1229
  },
1222
- async startDeviceAuthorization(provider) {
1230
+ async startDeviceAuthorization(provider, options) {
1223
1231
  return expectDeviceAuthorization(
1224
1232
  await transport.request(
1225
1233
  `/api/v1/credentials/${providerSegment(provider)}/device-authorizations`,
1226
- { method: "POST" }
1234
+ { method: "POST", ...scopeParams(options) }
1227
1235
  ),
1228
1236
  "Device authorization response",
1229
1237
  errors
1230
1238
  );
1231
1239
  },
1232
- async pollDeviceAuthorization(provider, deviceAuthId) {
1240
+ async pollDeviceAuthorization(provider, deviceAuthId, options) {
1233
1241
  return expectAuthenticationResult(
1234
1242
  await transport.request(
1235
1243
  `/api/v1/credentials/${providerSegment(provider)}/device-authorizations/${encodePathSegment(
@@ -1237,7 +1245,7 @@ function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFac
1237
1245
  "device authorization id",
1238
1246
  errors
1239
1247
  )}/poll`,
1240
- { method: "POST" }
1248
+ { method: "POST", ...scopeParams(options) }
1241
1249
  ),
1242
1250
  "Device authorization poll response",
1243
1251
  errors
@@ -3272,7 +3280,17 @@ var CoreAgentTaskSession = class {
3272
3280
  }
3273
3281
  if (this.isClosed() || waiter?.settled) return;
3274
3282
  await this.ensureTask();
3275
- if (this.isClosed() || waiter?.settled) return;
3283
+ const input = {
3284
+ type: "message",
3285
+ content: prompt,
3286
+ ...options.agentType ? { agentType: options.agentType } : {},
3287
+ ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {}
3288
+ };
3289
+ if (this.isClosed()) {
3290
+ await this.sendInput(input).catch(() => void 0);
3291
+ return;
3292
+ }
3293
+ if (waiter?.settled) return;
3276
3294
  await this.ensureChannel();
3277
3295
  if (this.isClosed() || waiter?.settled) return;
3278
3296
  await this.captureTurnBaseline();
@@ -3283,12 +3301,7 @@ var CoreAgentTaskSession = class {
3283
3301
  this.activeWaiter = waiter;
3284
3302
  this.setStatus("streaming");
3285
3303
  this.emit("turnStart", {});
3286
- await this.sendInput({
3287
- type: "message",
3288
- content: prompt,
3289
- ...options.agentType ? { agentType: options.agentType } : {},
3290
- ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {}
3291
- });
3304
+ await this.sendInput(input);
3292
3305
  }
3293
3306
  async ensureTask() {
3294
3307
  if (this._taskId) return;
@@ -3302,7 +3315,8 @@ var CoreAgentTaskSession = class {
3302
3315
  ...createOptions.agentId ? { agentId: createOptions.agentId } : {},
3303
3316
  ...createOptions.reasoningEffort ? { reasoningEffort: createOptions.reasoningEffort } : {},
3304
3317
  ...createOptions.userId ? { userId: createOptions.userId } : {},
3305
- ...createOptions.runtime ? { runtime: createOptions.runtime } : {}
3318
+ ...createOptions.runtime ? { runtime: createOptions.runtime } : {},
3319
+ ...createOptions.scope ? { scope: createOptions.scope } : {}
3306
3320
  });
3307
3321
  this._task = task;
3308
3322
  this._taskId = task.id;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mitralab.io/sdk-core",
3
- "version": "0.2.3",
3
+ "version": "0.2.5-beta.0",
4
4
  "description": "Environment-neutral contracts and modules shared by Mitra JavaScript SDKs",
5
5
  "type": "module",
6
6
  "sideEffects": false,