@stacklink/sdk 0.2.0 → 0.3.7

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.
Files changed (63) hide show
  1. package/README.md +33 -0
  2. package/compatibility.json +1 -1
  3. package/dist/src/domain/bot-contract.d.ts +4336 -0
  4. package/dist/src/domain/bot-contract.d.ts.map +1 -0
  5. package/dist/src/domain/bot-contract.js +382 -0
  6. package/dist/src/domain/bot-contract.js.map +1 -0
  7. package/dist/src/domain/memory-contract.d.ts +1705 -543
  8. package/dist/src/domain/memory-contract.d.ts.map +1 -1
  9. package/dist/src/domain/memory-contract.js +331 -60
  10. package/dist/src/domain/memory-contract.js.map +1 -1
  11. package/dist/src/domain/platform-approval-contract.d.ts +508 -0
  12. package/dist/src/domain/platform-approval-contract.d.ts.map +1 -0
  13. package/dist/src/domain/platform-approval-contract.js +77 -0
  14. package/dist/src/domain/platform-approval-contract.js.map +1 -0
  15. package/dist/src/domain/provider-branding.d.ts +1 -1
  16. package/dist/src/domain/provider-branding.d.ts.map +1 -1
  17. package/dist/src/domain/provider-branding.js +306 -8
  18. package/dist/src/domain/provider-branding.js.map +1 -1
  19. package/dist/src/domain/stacklink-meta-tools.d.ts +14 -16
  20. package/dist/src/domain/stacklink-meta-tools.d.ts.map +1 -1
  21. package/dist/src/domain/stacklink-meta-tools.js +217 -128
  22. package/dist/src/domain/stacklink-meta-tools.js.map +1 -1
  23. package/dist/src/sdk/framework-tools.d.ts +24 -2
  24. package/dist/src/sdk/framework-tools.d.ts.map +1 -1
  25. package/dist/src/sdk/framework-tools.js +50 -0
  26. package/dist/src/sdk/framework-tools.js.map +1 -1
  27. package/dist/src/sdk/index.d.ts +475 -143
  28. package/dist/src/sdk/index.d.ts.map +1 -1
  29. package/dist/src/sdk/index.js +633 -236
  30. package/dist/src/sdk/index.js.map +1 -1
  31. package/dist/src/sdk/langchain.d.ts +7 -2
  32. package/dist/src/sdk/langchain.d.ts.map +1 -1
  33. package/dist/src/sdk/langchain.js +3 -2
  34. package/dist/src/sdk/langchain.js.map +1 -1
  35. package/dist/src/sdk/memory-lifecycle.d.ts +25 -0
  36. package/dist/src/sdk/memory-lifecycle.d.ts.map +1 -1
  37. package/dist/src/sdk/memory-lifecycle.js +75 -1
  38. package/dist/src/sdk/memory-lifecycle.js.map +1 -1
  39. package/dist/src/sdk/openai-agents.d.ts +6 -6
  40. package/dist/src/sdk/openai-agents.d.ts.map +1 -1
  41. package/dist/src/sdk/openai-agents.js +21 -16
  42. package/dist/src/sdk/openai-agents.js.map +1 -1
  43. package/dist/src/sdk/openai.d.ts +2 -2
  44. package/dist/src/sdk/openai.d.ts.map +1 -1
  45. package/dist/src/sdk/openai.js +67 -31
  46. package/dist/src/sdk/openai.js.map +1 -1
  47. package/dist/src/sdk/vercel-ai.d.ts +15 -4
  48. package/dist/src/sdk/vercel-ai.d.ts.map +1 -1
  49. package/dist/src/sdk/vercel-ai.js +33 -9
  50. package/dist/src/sdk/vercel-ai.js.map +1 -1
  51. package/package.json +1 -1
  52. package/dist/src/domain/knowledge-meta-tools.d.ts +0 -12
  53. package/dist/src/domain/knowledge-meta-tools.d.ts.map +0 -1
  54. package/dist/src/domain/knowledge-meta-tools.js +0 -38
  55. package/dist/src/domain/knowledge-meta-tools.js.map +0 -1
  56. package/dist/src/domain/memory-meta-tools.d.ts +0 -5
  57. package/dist/src/domain/memory-meta-tools.d.ts.map +0 -1
  58. package/dist/src/domain/memory-meta-tools.js +0 -18
  59. package/dist/src/domain/memory-meta-tools.js.map +0 -1
  60. package/dist/src/domain/platform-mcp-tools.d.ts +0 -3
  61. package/dist/src/domain/platform-mcp-tools.d.ts.map +0 -1
  62. package/dist/src/domain/platform-mcp-tools.js +0 -30
  63. package/dist/src/domain/platform-mcp-tools.js.map +0 -1
@@ -1,19 +1,18 @@
1
- import { type StacklinkMetaToolName, type StacklinkMetaToolSurface } from '../domain/stacklink-meta-tools.js';
2
- import type { KnowledgeMetaToolName } from '../domain/knowledge-meta-tools.js';
3
- import { type PlatformMcpToolName } from '../domain/platform-mcp-tools.js';
1
+ import type { Bot, BotPatch, BotRun, BotRunInput, PublishChannels, SavedBotApi, ContextApi, BotApiSigningKey, BotApiSigningKeyRequest } from '../domain/bot-contract.js';
2
+ import type { ApprovalRecord, ApprovalDecision, ApprovalChange, ApprovalListResponse, ApprovalListQuery, CustomerApprovalGrantInput, CustomerApprovalGrantResponse } from '../domain/platform-approval-contract.js';
3
+ export type { ApprovalRecord, ApprovalDecision, ApprovalChange, ApprovalListResponse, ApprovalAudience, ApprovalRequirement, CustomerApprovalGrantInput, CustomerApprovalGrantResponse } from '../domain/platform-approval-contract.js';
4
+ export type { Bot, BotPatch, BotRun, BotRunInput, PublishChannels, SavedBotApi, ContextApi, BotApiSigningKey, BotApiSigningKeyRequest, BotTrigger, BotPreparation, BotRunDisplay, BotReadinessIssue } from '../domain/bot-contract.js';
5
+ import { type StacklinkMetaToolName } from '../domain/stacklink-meta-tools.js';
4
6
  import type { ProviderBrandDescriptor } from '../domain/provider-branding.js';
5
- import type { MemoryMetaToolName } from '../domain/memory-meta-tools.js';
6
- import type { MemoryContextInput, MemoryConversationTurnInput, MemoryConnectedSourceInput, MemoryConnectedSourcePreviewInput, MemoryExportInput, MemoryGraphQueryInput, MemoryIngestInput, MemoryRichIngestInput, MemoryLegalHoldInput, MemoryPolicyPreviewInput, MemoryProjectPolicyInput, MemoryProjectPolicyUpdateInput, MemorySearchInput, MemorySourceBindingInput, MemorySourceBindingUpdateInput, MemorySubjectRef } from '../domain/memory-contract.js';
7
+ import type { MemoryContextInput, MemoryConversationTurnInput, MemoryConnectedSourceInput, MemoryConnectedSourcePreviewInput, MemoryExportInput, MemoryGraphQueryInput, MemoryIngestInput, MemoryRichIngestInput, MemoryLegalHoldInput, MemoryPolicyPreviewInput, MemoryProjectPolicyInput, MemoryProjectPolicyUpdateInput, MemorySearchInput, MemorySourceBindingInput, MemorySourceBindingUpdateInput, MemorySourceRemovalInput, MemorySubjectRef } from '../domain/memory-contract.js';
7
8
  export type { ProviderBrandDescriptor };
8
- export type { MemoryContextInput, MemoryConversationTurnInput, MemoryConnectedSourceInput, MemoryConnectedSourcePreviewInput, MemoryExportInput, MemoryGraphQueryInput, MemoryIngestInput, MemoryRichIngestInput, MemoryLegalHoldInput, MemoryPolicyPreviewInput, MemoryProjectPolicyInput, MemoryProjectPolicyUpdateInput, MemorySearchInput, MemorySourceBindingInput, MemorySourceBindingUpdateInput, MemorySubjectRef, };
9
+ export type { MemoryContextInput, MemoryConversationTurnInput, MemoryConnectedSourceInput, MemoryConnectedSourcePreviewInput, MemoryExportInput, MemoryGraphQueryInput, MemoryIngestInput, MemoryRichIngestInput, MemoryLegalHoldInput, MemoryPolicyPreviewInput, MemoryProjectPolicyInput, MemoryProjectPolicyUpdateInput, MemorySearchInput, MemorySourceBindingInput, MemorySourceBindingUpdateInput, MemorySourceRemovalInput, MemorySubjectRef, };
9
10
  export { StacklinkMemoryLifecycle, StacklinkMemoryLifecycleError, createStacklinkMemoryLifecycle, serializeCompletedConversationTurn, } from './memory-lifecycle.js';
10
- export type { StacklinkMemoryAvailabilityMode, StacklinkMemoryCaptureMode, StacklinkMemoryDiagnostic, StacklinkMemoryLifecycleOptions, StacklinkMemorySessionLike, StacklinkMemoryTurnContext, StacklinkMemoryTurnOptions, } from './memory-lifecycle.js';
11
- export declare const platformToolSurfaceNames: readonly ["PLATFORM_LIST_AUTH_CONFIGS", "PLATFORM_LIST_SESSIONS", "PLATFORM_UPDATE_WORKBENCH_PROVIDER_ACCESS", "PLATFORM_LIST_WORKSPACES", "PLATFORM_LIST_MEMBERS", "PLATFORM_LIST_WORKBENCH_BUDGETS", "PLATFORM_QUERY_LOGS", "PLATFORM_GET_EXECUTION_DETAILS", "PLATFORM_ENABLE_TOOLKIT", "PLATFORM_CREATE_TRIGGER", "PLATFORM_GET_WEBHOOK", "PLATFORM_UPDATE_WEBHOOK", "PLATFORM_ROTATE_WEBHOOK_SECRET", "PLATFORM_APPROVE_WEBHOOK_SECRET_ROTATION", "PLATFORM_SEND_WEBHOOK_TEST", "PLATFORM_PROPOSE_AUTH_CONFIG", "PLATFORM_APPROVE_AUTH_CONFIG", "PLATFORM_PROPOSE_API_KEY", "PLATFORM_APPROVE_API_KEY", "PLATFORM_REVOKE_API_KEY", "PLATFORM_PROPOSE_WORKSPACE_MUTATION", "PLATFORM_APPROVE_WORKSPACE_MUTATION", "PLATFORM_PROPOSE_WORKBENCH_BUDGET", "PLATFORM_APPROVE_WORKBENCH_BUDGET", "PLATFORM_APPROVE_EXECUTION", "PLATFORM_DENY_APPROVAL", "PLATFORM_CANCEL_APPROVAL"];
12
- export type PlatformToolSurfaceName = PlatformMcpToolName;
11
+ export type { StacklinkMemoryAvailabilityMode, StacklinkMemoryCaptureController, StacklinkMemoryCaptureIssue, StacklinkMemoryCaptureMode, StacklinkMemoryDiagnostic, StacklinkMemoryLifecycleOptions, StacklinkMemorySessionLike, StacklinkMemoryTurnContext, StacklinkMemoryTurnOptions, } from './memory-lifecycle.js';
13
12
  export type StacklinkFetch = typeof fetch;
14
- export type StacklinkMcpToolName = StacklinkMetaToolName | PlatformMcpToolName | KnowledgeMetaToolName | MemoryMetaToolName;
13
+ export type StacklinkMcpToolName = StacklinkMetaToolName;
15
14
  export type StacklinkToolSurfaceName = StacklinkMcpToolName | (string & {});
16
- export declare const stacklinkTypeScriptSdkVersion = "0.2.0";
15
+ export declare const stacklinkTypeScriptSdkVersion = "0.3.7";
17
16
  export declare class StacklinkApiError extends Error {
18
17
  readonly statusCode: number;
19
18
  readonly code?: string | undefined;
@@ -26,6 +25,10 @@ export type JsonRecord = Record<string, unknown>;
26
25
  export type StacklinkExecutionKind = 'tool' | 'batch' | 'workbench_bash' | 'workbench_code' | 'workbench_proxy';
27
26
  export interface StacklinkRequestOptions {
28
27
  signal?: AbortSignal | undefined;
28
+ timeoutMs?: number | undefined;
29
+ idempotencyKey?: string | undefined;
30
+ requestId?: string | undefined;
31
+ traceparent?: string | undefined;
29
32
  }
30
33
  interface StacklinkRequestInit extends StacklinkRequestOptions {
31
34
  method?: string | undefined;
@@ -164,7 +167,7 @@ export type ProviderMcpTransport = 'streamable_http';
164
167
  export type ProviderMcpAuthType = 'oauth_dcr' | 'oauth_static_client' | 'bearer' | 'none';
165
168
  export type ProviderMcpImportPolicy = 'certified_allowlist' | 'discover_then_review';
166
169
  export type ProviderMcpIdentityKind = 'user' | 'workspace' | 'organization' | 'project';
167
- export type ProviderMcpResourceKind = 'user' | 'workspace' | 'organization' | 'project' | 'site' | 'space' | 'component' | 'repository' | 'channel' | 'label' | 'folder' | 'document' | 'spreadsheet' | 'database';
170
+ export type ProviderMcpResourceKind = 'user' | 'user_group' | 'group' | 'workspace' | 'organization' | 'project' | 'site' | 'space' | 'component' | 'repository' | 'team' | 'channel' | 'chat' | 'message' | 'meeting' | 'scheduled_event' | 'invitee' | 'routing_form' | 'routing_form_submission' | 'meeting_recap' | 'platform' | 'transcript' | 'schedule' | 'shift' | 'label' | 'folder' | 'mail_folder' | 'calendar' | 'contact_folder' | 'file' | 'document' | 'spreadsheet' | 'database' | 'zoom_meeting' | 'zoom_webinar' | 'zoom_transcript' | 'zoom_meeting_summary' | 'invoice' | 'estimate' | 'credit_note' | 'customer_payment' | 'bill' | 'expense' | 'purchase_order' | 'vendor_payment' | 'task' | 'time_entry' | 'shopify_collection' | 'shopify_location' | 'shopify_order' | 'business_account' | 'ad_account' | 'campaign' | 'ad_creative' | 'product_catalog' | 'facebook_page' | 'instagram_account' | 'phone_number' | 'resource';
168
171
  export interface ProviderRuntime {
169
172
  kind: ProviderRuntimeKind;
170
173
  owner: ProviderRuntimeOwner;
@@ -276,6 +279,65 @@ export interface ProjectProvider {
276
279
  } | undefined;
277
280
  toolkit?: ProviderToolkit | undefined;
278
281
  }
282
+ export type ProviderCatalogConnectionStatus = 'connected' | 'in_progress' | 'attention' | 'not_connected';
283
+ export interface ProviderCatalogListItem {
284
+ providerKey: string;
285
+ displayName: string;
286
+ shortDescription: string;
287
+ logoUrl: string;
288
+ categoryKeys: string[];
289
+ authModes: string[];
290
+ catalogStatus: string;
291
+ projectStatus: 'enabled' | 'disabled' | 'planned';
292
+ connection: {
293
+ status: ProviderCatalogConnectionStatus;
294
+ connectedAccountCount: number;
295
+ };
296
+ availableToolCount: number;
297
+ availableTriggerCount: number;
298
+ catalogVersion: string;
299
+ }
300
+ export interface ProviderToolCatalogListItem {
301
+ toolKey: string;
302
+ displayName: string;
303
+ description: string;
304
+ capability: string;
305
+ mutationLevel: string;
306
+ connectionRequired: boolean;
307
+ contractVersion: string;
308
+ status: string;
309
+ }
310
+ export interface CursorPageMeta {
311
+ limit: number;
312
+ nextCursor: string | null;
313
+ hasMore: boolean;
314
+ totalItems: number;
315
+ }
316
+ export interface CatalogSnapshotMeta {
317
+ catalogVersion: string;
318
+ asOf: string;
319
+ }
320
+ export interface ProviderCatalogPage {
321
+ items: ProviderCatalogListItem[];
322
+ page: CursorPageMeta;
323
+ snapshot: CatalogSnapshotMeta;
324
+ }
325
+ export interface ProviderToolCatalogPage {
326
+ providerKey: string;
327
+ items: ProviderToolCatalogListItem[];
328
+ page: CursorPageMeta;
329
+ snapshot: CatalogSnapshotMeta;
330
+ }
331
+ export interface ListProviderCatalogInput {
332
+ limit?: number | undefined;
333
+ cursor?: string | undefined;
334
+ search?: string | undefined;
335
+ providerKeys?: string[] | undefined;
336
+ categoryKeys?: string[] | undefined;
337
+ projectStatus?: 'enabled' | 'disabled' | 'planned' | undefined;
338
+ connectionStatus?: ProviderCatalogConnectionStatus | undefined;
339
+ tenantId?: string | undefined;
340
+ }
279
341
  export interface StacklinkProject {
280
342
  id: string;
281
343
  projectId?: string | undefined;
@@ -375,6 +437,7 @@ export interface ConnectedAccount {
375
437
  displayName: string | null;
376
438
  status: string;
377
439
  authMode: string;
440
+ oauthScopeProfile?: string | null | undefined;
378
441
  isDefault: boolean;
379
442
  region?: string | null | undefined;
380
443
  scopes: unknown;
@@ -489,6 +552,7 @@ export interface ConnectionRequestResponse {
489
552
  providerName?: string | undefined;
490
553
  authConfigId?: string | null | undefined;
491
554
  authMode?: string | null | undefined;
555
+ oauthScopeProfile?: string | null | undefined;
492
556
  status: string;
493
557
  phase?: ConnectionRequestPhase | undefined;
494
558
  nextAction?: ConnectionRequestNextAction | undefined;
@@ -508,6 +572,7 @@ export interface ConnectionAuthorizationResponse {
508
572
  providerKey: string;
509
573
  authConfigId?: string | undefined;
510
574
  authMode?: string | undefined;
575
+ oauthScopeProfile?: string | null | undefined;
511
576
  status: string;
512
577
  phase?: ConnectionRequestPhase | undefined;
513
578
  nextAction?: ConnectionRequestNextAction | undefined;
@@ -707,8 +772,7 @@ export interface UpdateStacklinkSessionInput {
707
772
  expectedConfigVersion?: number | undefined;
708
773
  status?: 'active' | 'closed' | 'failed' | undefined;
709
774
  toolRouter?: CreateStacklinkSessionInput['toolRouter'];
710
- preset?: CreateStacklinkSessionInput['preset'];
711
- preload?: CreateStacklinkSessionInput['preload'];
775
+ modelSurface?: CreateStacklinkSessionInput['modelSurface'];
712
776
  toolkits?: CreateStacklinkSessionInput['toolkits'];
713
777
  tools?: CreateStacklinkSessionInput['tools'];
714
778
  authConfigs?: CreateStacklinkSessionInput['authConfigs'];
@@ -717,7 +781,6 @@ export interface UpdateStacklinkSessionInput {
717
781
  multiAccount?: CreateStacklinkSessionInput['multiAccount'];
718
782
  workbench?: CreateStacklinkSessionInput['workbench'];
719
783
  knowledgePacks?: CreateStacklinkSessionInput['knowledgePacks'];
720
- metaTools?: CreateStacklinkSessionInput['metaTools'];
721
784
  memory?: CreateStacklinkSessionInput['memory'];
722
785
  metadata?: Record<string, unknown> | undefined;
723
786
  }
@@ -853,7 +916,7 @@ export interface WorkbenchRuntimeDiagnostics {
853
916
  exitCode?: number | undefined;
854
917
  error?: unknown;
855
918
  }
856
- export type WorkbenchExecutionStatus = 'queued' | 'started' | 'running' | 'cancel_requested' | 'completed' | 'failed' | 'cancelled' | 'timed_out';
919
+ export type WorkbenchExecutionStatus = 'waiting_for_approval' | 'queued' | 'started' | 'running' | 'cancel_requested' | 'completed' | 'failed' | 'cancelled' | 'timed_out';
857
920
  export interface WorkbenchExecutionLog {
858
921
  id: string;
859
922
  executionId?: string | undefined;
@@ -944,6 +1007,9 @@ export interface WorkbenchOutputPreview {
944
1007
  preview: string;
945
1008
  }
946
1009
  export interface WorkbenchExecutionResponse {
1010
+ approvalRequestId?: string | undefined;
1011
+ executed?: boolean | undefined;
1012
+ nextAction?: 'wait_for_approval' | undefined;
947
1013
  workbenchSession: WorkbenchSession;
948
1014
  executionKind: 'workbench_code' | 'workbench_bash';
949
1015
  executionId: string;
@@ -1146,6 +1212,7 @@ export interface StacklinkSessionMetaToolDefinition {
1146
1212
  name: string;
1147
1213
  description: string;
1148
1214
  inputSchema: Record<string, unknown>;
1215
+ outputSchema: Record<string, unknown>;
1149
1216
  }
1150
1217
  export interface ProviderArtifact {
1151
1218
  id: string;
@@ -1216,6 +1283,8 @@ export interface StacklinkOptions {
1216
1283
  fetch?: StacklinkFetch;
1217
1284
  registrationKey?: string | undefined;
1218
1285
  cache?: StacklinkClientCacheOptions | undefined;
1286
+ timeoutMs?: number | undefined;
1287
+ maxAttempts?: number | undefined;
1219
1288
  }
1220
1289
  export interface StacklinkClientCacheOptions {
1221
1290
  enabled?: boolean | undefined;
@@ -1228,32 +1297,111 @@ export interface StacklinkClientCacheOptions {
1228
1297
  export interface StacklinkDiscoveryCacheControl {
1229
1298
  cache?: 'default' | 'bypass' | undefined;
1230
1299
  }
1231
- export interface StacklinkPrepareToolsInput extends StacklinkDiscoveryCacheControl {
1232
- intents: string[];
1233
- includeSchemas?: boolean | undefined;
1234
- limitPerIntent?: number | undefined;
1235
- includePlanned?: boolean | undefined;
1236
- toolkitKey?: string | undefined;
1237
- capability?: string | undefined;
1238
- model?: string | undefined;
1300
+ export interface StacklinkAgentSearchQuery {
1301
+ id: string;
1302
+ task: string;
1303
+ providerHint?: {
1304
+ label: string;
1305
+ } | undefined;
1306
+ providerRef?: string | undefined;
1307
+ }
1308
+ export interface StacklinkAgentSearchResponse {
1309
+ schemaVersion: 'stacklink.agent_tool_search.v2';
1310
+ results: Array<{
1311
+ queryId: string;
1312
+ providerResolution: {
1313
+ status: 'resolved' | 'ambiguous' | 'not_found';
1314
+ requestedLabel?: string | undefined;
1315
+ recommended?: {
1316
+ providerRef: string;
1317
+ providerKey: string;
1318
+ displayName: string;
1319
+ } | undefined;
1320
+ alternatives: Array<{
1321
+ providerRef: string;
1322
+ providerKey: string;
1323
+ displayName: string;
1324
+ }>;
1325
+ };
1326
+ provider?: {
1327
+ providerRef: string;
1328
+ providerKey: string;
1329
+ displayName: string;
1330
+ globalStatus: 'available' | 'planned';
1331
+ projectStatus: 'available_to_connect' | 'enabled' | 'blocked' | 'planned';
1332
+ connectionStatus?: string | undefined;
1333
+ } | undefined;
1334
+ accounts?: Array<{
1335
+ accountRef: string;
1336
+ displayName: string;
1337
+ isDefault: boolean;
1338
+ selected: boolean;
1339
+ }> | undefined;
1340
+ tools: Array<{
1341
+ toolRef: string;
1342
+ providerKey: string;
1343
+ displayName: string;
1344
+ description: string;
1345
+ capability: string;
1346
+ risk: string;
1347
+ connectionStatus: string;
1348
+ contractRef?: string | undefined;
1349
+ }>;
1350
+ nextAction?: {
1351
+ kind: 'authorize_connection';
1352
+ connectionRef: string;
1353
+ } | undefined;
1354
+ blocker?: {
1355
+ kind: 'provider_not_found' | 'provider_planned' | 'provider_blocked';
1356
+ owner: 'stacklink' | 'project_admin';
1357
+ } | undefined;
1358
+ }>;
1359
+ limits: {
1360
+ maxQueries: number;
1361
+ maxProviderCandidatesPerQuery: number;
1362
+ maxCandidatesPerQuery: number;
1363
+ maxUniqueTools: number;
1364
+ };
1239
1365
  }
1240
- export interface StacklinkPreparedTools {
1241
- tools: ProviderTool[];
1242
- schemas: ProviderTool[];
1243
- toolKeys: string[];
1244
- search: {
1245
- tools: ProviderTool[];
1246
- queries?: unknown[] | undefined;
1247
- meta?: unknown;
1366
+ export interface StacklinkAgentToolContractsResponse {
1367
+ contract: 'stacklink.agent_tool_contracts.v2';
1368
+ sessionId: string;
1369
+ tools: StacklinkAgentToolContract[];
1370
+ meta: {
1371
+ returned: number;
1372
+ };
1373
+ }
1374
+ export interface StacklinkAgentToolContract {
1375
+ contractRef: string;
1376
+ toolKey: string;
1377
+ contractVersion: string;
1378
+ provider: {
1379
+ providerKey: string;
1380
+ displayName: string;
1381
+ };
1382
+ displayName: string;
1383
+ description: string;
1384
+ capability: string;
1385
+ inputSchema: Record<string, unknown>;
1386
+ outputSchema: Record<string, unknown>;
1387
+ risk: Record<string, unknown>;
1388
+ execution: Record<string, unknown>;
1389
+ outputPolicy: Record<string, unknown>;
1390
+ accountSelection: {
1391
+ required: boolean;
1392
+ status: string;
1393
+ accounts: Array<{
1394
+ accountRef: string;
1395
+ displayName: string;
1396
+ isDefault: boolean;
1397
+ selected: boolean;
1398
+ }>;
1248
1399
  };
1249
1400
  }
1250
1401
  export interface StacklinkDiscoveryConfig {
1251
- preset: 'meta_tools' | 'direct_tools' | 'hybrid';
1252
- preload: {
1253
- tools?: string[] | undefined;
1254
- toolkits?: string[] | undefined;
1255
- includeMetaTools?: boolean | undefined;
1256
- includeWorkbench?: boolean | undefined;
1402
+ mode: 'router' | 'specialist';
1403
+ specialist: {
1404
+ toolKeys: string[];
1257
1405
  includeConnectionManagement?: boolean | undefined;
1258
1406
  };
1259
1407
  }
@@ -1265,13 +1413,12 @@ export interface CreateStacklinkSessionInput {
1265
1413
  userEmail?: string | undefined;
1266
1414
  scopes?: string[] | undefined;
1267
1415
  toolRouter?: Record<string, unknown> | undefined;
1268
- preset?: 'meta_tools' | 'direct_tools' | 'hybrid' | undefined;
1269
- preload?: {
1270
- tools?: string[] | undefined;
1271
- toolkits?: string[] | undefined;
1272
- includeMetaTools?: boolean | undefined;
1273
- includeWorkbench?: boolean | undefined;
1274
- includeConnectionManagement?: boolean | undefined;
1416
+ modelSurface?: {
1417
+ mode: 'router' | 'specialist';
1418
+ specialist?: {
1419
+ toolKeys?: string[] | undefined;
1420
+ includeConnectionManagement?: boolean | undefined;
1421
+ } | undefined;
1275
1422
  } | undefined;
1276
1423
  toolkits?: string[] | {
1277
1424
  enable?: string[];
@@ -1306,12 +1453,6 @@ export interface CreateStacklinkSessionInput {
1306
1453
  contextTokenBudget?: number | undefined;
1307
1454
  policyKey?: string | undefined;
1308
1455
  } | undefined;
1309
- metaTools?: {
1310
- surface?: StacklinkMetaToolSurface;
1311
- includeInternal?: boolean;
1312
- enable?: string[];
1313
- disable?: string[];
1314
- } | undefined;
1315
1456
  metadata?: Record<string, unknown> | undefined;
1316
1457
  }
1317
1458
  export interface ListStacklinkSessionsInput {
@@ -1330,7 +1471,13 @@ export interface ListStacklinkSessionsResponse {
1330
1471
  export interface StacklinkTool {
1331
1472
  description: string;
1332
1473
  parameters: Record<string, unknown>;
1333
- execute: (input: Record<string, unknown>) => Promise<unknown>;
1474
+ outputSchema: Record<string, unknown>;
1475
+ execute: (input: Record<string, unknown>, execution?: StacklinkToolExecutionContext | undefined) => Promise<unknown>;
1476
+ }
1477
+ export interface StacklinkToolExecutionContext {
1478
+ toolCallId?: string | undefined;
1479
+ abortSignal?: AbortSignal | undefined;
1480
+ onProgress?: StacklinkMcpStreamOptions['onProgress'];
1334
1481
  }
1335
1482
  export type StacklinkTools = Record<string, StacklinkTool>;
1336
1483
  export type KnowledgeRetrievalMode = 'canonical_lookup' | 'hybrid_search' | 'semantic_search' | 'text_search' | 'semantic_unavailable';
@@ -1801,6 +1948,33 @@ export interface GstNoticeRuleResponse extends GstRateLookupResponse {
1801
1948
  export interface GstAppealStageRuleResponse extends GstRateLookupResponse {
1802
1949
  }
1803
1950
  export declare function verifyWebhookSignature(input: StacklinkWebhookSignatureInput): Promise<boolean>;
1951
+ /** Sign the exact JSON bytes sent to a saved inbound Bot webhook. Reuse requestId when retrying. */
1952
+ export declare function signBotTriggerRequest(input: {
1953
+ triggerId: string;
1954
+ secret: string;
1955
+ body: string;
1956
+ requestId?: string;
1957
+ now?: Date;
1958
+ }): Promise<Record<string, string>>;
1959
+ /** Verify the original request bytes before using identity. consumeRequestId must atomically reject replays. */
1960
+ export declare function verifyBotApiRequest(input: {
1961
+ method: string;
1962
+ url: string;
1963
+ body: string;
1964
+ headers: ConstructorParameters<typeof Headers>[0];
1965
+ projectId: string;
1966
+ keys: Record<string, string | {
1967
+ secret: string;
1968
+ validUntil: string | null;
1969
+ }>;
1970
+ consumeRequestId: (id: string, expiresAt: Date) => boolean | Promise<boolean>;
1971
+ now?: Date;
1972
+ toleranceSeconds?: number;
1973
+ }): Promise<{
1974
+ tenantId: string;
1975
+ userId: string | null;
1976
+ requestId: string;
1977
+ } | null>;
1804
1978
  export declare class Stacklink {
1805
1979
  private readonly apiKey;
1806
1980
  private readonly registrationKey;
@@ -1808,6 +1982,11 @@ export declare class Stacklink {
1808
1982
  private readonly fetchImpl;
1809
1983
  private readonly cacheOptions;
1810
1984
  private readonly responseCache;
1985
+ private readonly discoveryRequests;
1986
+ private readonly timeoutMs;
1987
+ private readonly maxAttempts;
1988
+ readonly bots: StacklinkBotsClient;
1989
+ readonly approvals: StacklinkApprovalsClient;
1811
1990
  readonly webhooks: StacklinkWebhooksClient;
1812
1991
  readonly triggers: StacklinkTriggersClient;
1813
1992
  readonly sessions: StacklinkSessionsClient;
@@ -1894,25 +2073,15 @@ export declare class Stacklink {
1894
2073
  deleteApiKey(apiKeyId: string): Promise<{
1895
2074
  apiKey: StacklinkApiKey;
1896
2075
  }>;
1897
- listProviders(): Promise<{
1898
- providers: ProviderToolkit[];
1899
- }>;
1900
- listProjectProviders(query?: {
1901
- tenantId?: string;
1902
- }): Promise<{
1903
- providers: ProjectProvider[];
1904
- }>;
2076
+ listProviders(query?: Omit<ListProviderCatalogInput, 'tenantId' | 'projectStatus' | 'connectionStatus'>): Promise<ProviderCatalogPage>;
2077
+ listProjectProviders(query?: ListProviderCatalogInput): Promise<ProviderCatalogPage>;
1905
2078
  listProviderTools(providerKey: string, input?: {
2079
+ limit?: number | undefined;
2080
+ cursor?: string | undefined;
2081
+ search?: string | undefined;
2082
+ capability?: string | undefined;
1906
2083
  includePlanned?: boolean | undefined;
1907
- responseMode?: 'compact' | 'full' | undefined;
1908
- }): Promise<{
1909
- providerKey: string;
1910
- tools: ProviderTool[];
1911
- meta?: {
1912
- responseMode?: "compact" | "full" | undefined;
1913
- provider?: ProviderToolkit | undefined;
1914
- } | undefined;
1915
- }>;
2084
+ }): Promise<ProviderToolCatalogPage>;
1916
2085
  createProject(input: {
1917
2086
  clientName: string;
1918
2087
  projectName?: string | undefined;
@@ -1999,8 +2168,7 @@ export declare class Stacklink {
1999
2168
  }>;
2000
2169
  getRuntimeToolContracts(input: {
2001
2170
  sessionId: string;
2002
- toolkitKeys?: string[] | undefined;
2003
- toolKeys?: string[] | undefined;
2171
+ toolKeys: string[];
2004
2172
  includePlanned?: boolean | undefined;
2005
2173
  }): Promise<{
2006
2174
  contract: string;
@@ -2244,12 +2412,26 @@ export declare class Stacklink {
2244
2412
  hasMore: boolean;
2245
2413
  nextCursor: string | null;
2246
2414
  }>;
2415
+ streamBotEvents(botId: string, runId: string, options?: StacklinkRequestOptions & {
2416
+ after?: string;
2417
+ totalTimeoutMs?: number;
2418
+ }): AsyncGenerator<Record<string, unknown> | {
2419
+ sequence: string;
2420
+ type: string;
2421
+ payload: unknown;
2422
+ }, void, unknown>;
2423
+ streamExecutionEvents(input: {
2424
+ sessionId: string;
2425
+ executionKind: StacklinkExecutionKind;
2426
+ executionId: string;
2427
+ afterSequence?: string | number | bigint | undefined;
2428
+ limit?: number | undefined;
2429
+ }, options?: StacklinkRequestOptions): AsyncGenerator<any, void, unknown>;
2247
2430
  waitForExecution(input: {
2248
2431
  sessionId: string;
2249
2432
  executionKind: StacklinkExecutionKind;
2250
2433
  executionId: string;
2251
2434
  waitTimeoutMs?: number | undefined;
2252
- pollIntervalMs?: number | undefined;
2253
2435
  }, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
2254
2436
  cancelExecution(input: {
2255
2437
  sessionId: string;
@@ -2281,9 +2463,9 @@ export declare class Stacklink {
2281
2463
  getConnectedAccount(accountId: string): Promise<{
2282
2464
  account: ConnectedAccount;
2283
2465
  }>;
2284
- listConnectedAccountTools(accountId: string, input?: {
2466
+ listConnectedAccountTools(accountId: string, input: {
2285
2467
  includePlanned?: boolean | undefined;
2286
- toolKeys?: string[] | undefined;
2468
+ toolKeys: string[];
2287
2469
  }): Promise<{
2288
2470
  contract: string;
2289
2471
  sessionId: string;
@@ -2536,15 +2718,11 @@ export declare class Stacklink {
2536
2718
  deleteWorkbenchBudget(budgetPolicyId: string): Promise<{
2537
2719
  budgetPolicy: WorkbenchBudgetPolicy;
2538
2720
  }>;
2539
- mcpRequest(input: Record<string, unknown> | Array<Record<string, unknown>>, options?: StacklinkRequestOptions): Promise<unknown>;
2540
- mcpSessionRequest(sessionId: string, input: Record<string, unknown> | Array<Record<string, unknown>>, options?: StacklinkRequestOptions): Promise<unknown>;
2721
+ mcpSessionRequest(sessionId: string, input: Record<string, unknown> | Array<Record<string, unknown>>, options?: StacklinkRequestOptions): Promise<{} | null>;
2541
2722
  private mcpRequestAtPath;
2542
- mcpRequestStream(input: Record<string, unknown>, options?: StacklinkMcpStreamOptions): Promise<unknown>;
2543
- mcpSessionRequestStream(sessionId: string, input: Record<string, unknown>, options?: StacklinkMcpStreamOptions): Promise<unknown>;
2723
+ mcpSessionRequestStream(sessionId: string, input: Record<string, unknown>, options?: StacklinkMcpStreamOptions): Promise<{} | null>;
2544
2724
  private mcpRequestStreamAtPath;
2545
- listMcpTools(): Promise<unknown>;
2546
- callMcpTool(name: StacklinkToolSurfaceName, args: Record<string, unknown>): Promise<unknown>;
2547
- callSessionMcpTool(sessionId: string, name: StacklinkToolSurfaceName, args: Record<string, unknown>): Promise<unknown>;
2725
+ callSessionMcpTool(sessionId: string, name: StacklinkToolSurfaceName, args: Record<string, unknown>, options?: StacklinkMcpStreamOptions): Promise<{} | null>;
2548
2726
  listKnowledgePacks(): Promise<KnowledgePackListResponse>;
2549
2727
  getKnowledgeCapabilities(input?: {
2550
2728
  sessionId?: string | undefined;
@@ -2571,10 +2749,12 @@ export declare class Stacklink {
2571
2749
  private attachAbortSignalCancellation;
2572
2750
  request<T>(path: string, init?: StacklinkRequestInit): Promise<T>;
2573
2751
  requestRaw(path: string, init?: StacklinkRequestInit): Promise<Response>;
2752
+ private performRequest;
2574
2753
  cachedDiscoveryRequest<T>(cacheKey: string, ttlMs: number, control: StacklinkDiscoveryCacheControl | undefined, producer: () => Promise<T>): Promise<T>;
2575
2754
  discoveryCacheTtl(kind: 'toolsList' | 'toolkits' | 'schemas' | 'search'): number;
2576
2755
  private trimResponseCache;
2577
2756
  private readMcpEventStream;
2757
+ private readJsonEventStream;
2578
2758
  private requestHeaders;
2579
2759
  }
2580
2760
  export declare class StacklinkWebhooksClient {
@@ -2646,6 +2826,30 @@ export interface StacklinkMemoryAccessSelector {
2646
2826
  subjectType?: MemorySubjectRef['type'] | undefined;
2647
2827
  externalSubjectId?: string | undefined;
2648
2828
  }
2829
+ export interface StacklinkMemoryQualityReviewEntity {
2830
+ entityType: string;
2831
+ canonicalKey: string;
2832
+ displayName?: string | null | undefined;
2833
+ attributes?: JsonRecord | undefined;
2834
+ }
2835
+ export interface StacklinkMemoryQualityReviewInput {
2836
+ disposition: 'keep' | 'correct' | 'convert_to_episode' | 'restrict';
2837
+ content?: string | undefined;
2838
+ title?: string | null | undefined;
2839
+ memoryType: 'preference' | 'decision' | 'commitment' | 'goal' | 'constraint' | 'relationship' | 'durable_fact';
2840
+ sensitivityClass: 'standard' | 'personal' | 'restricted';
2841
+ restrictedDataClasses?: Array<'health' | 'biometric' | 'government_identity' | 'precise_location' | 'protected_trait' | 'minor' | 'detailed_personal_financial'> | undefined;
2842
+ topicTags?: string[] | undefined;
2843
+ language?: string | null | undefined;
2844
+ validFrom?: string | null | undefined;
2845
+ validTo?: string | null | undefined;
2846
+ authorshipClass: 'connected_user' | 'other_human' | 'bot' | 'application' | 'system' | 'unknown';
2847
+ salience: 'low' | 'medium' | 'high';
2848
+ evidenceConfidence: 'low' | 'medium' | 'high';
2849
+ actorEntity: StacklinkMemoryQualityReviewEntity;
2850
+ subjectEntity: StacklinkMemoryQualityReviewEntity;
2851
+ reason: string;
2852
+ }
2649
2853
  export declare class StacklinkMemoryClient {
2650
2854
  private readonly client;
2651
2855
  constructor(client: Stacklink);
@@ -2694,6 +2898,9 @@ export declare class StacklinkMemoryClient {
2694
2898
  metadata?: JsonRecord | undefined;
2695
2899
  };
2696
2900
  }): Promise<JsonRecord>;
2901
+ reviewQuality(memoryId: string, input: StacklinkMemoryAccessSelector & {
2902
+ review: StacklinkMemoryQualityReviewInput;
2903
+ }): Promise<JsonRecord>;
2697
2904
  forget(memoryId: string, input: StacklinkMemoryAccessSelector & {
2698
2905
  reason?: string | undefined;
2699
2906
  }): Promise<JsonRecord>;
@@ -2756,7 +2963,7 @@ export declare class StacklinkMemoryClient {
2756
2963
  getSource(bindingId: string): Promise<JsonRecord>;
2757
2964
  setSourceStatus(bindingId: string, status: 'active' | 'paused'): Promise<JsonRecord>;
2758
2965
  updateSource(bindingId: string, input: MemorySourceBindingUpdateInput): Promise<JsonRecord>;
2759
- deleteSource(bindingId: string): Promise<JsonRecord>;
2966
+ deleteSource(bindingId: string, input: MemorySourceRemovalInput): Promise<JsonRecord>;
2760
2967
  replaySourceItem(bindingId: string, itemId: string): Promise<JsonRecord>;
2761
2968
  listSourceDeliveries(input?: {
2762
2969
  tenantId?: string | undefined;
@@ -2772,6 +2979,45 @@ export declare class StacklinkMemoryClient {
2772
2979
  createLegalHold(input: MemoryLegalHoldInput): Promise<JsonRecord>;
2773
2980
  releaseLegalHold(holdId: string): Promise<JsonRecord>;
2774
2981
  }
2982
+ export interface StacklinkApprovalAccess {
2983
+ sessionId: string;
2984
+ asCustomer?: boolean;
2985
+ }
2986
+ export interface StacklinkApprovalEvent {
2987
+ sequence: string;
2988
+ approvalId: string;
2989
+ type: 'approval.request.updated';
2990
+ data: {
2991
+ revision: number;
2992
+ status: string;
2993
+ requirements: unknown[];
2994
+ denialReason: string | null;
2995
+ };
2996
+ occurredAt: string;
2997
+ }
2998
+ export declare class StacklinkApprovalsClient {
2999
+ private readonly client;
3000
+ constructor(client: Stacklink);
3001
+ /** Server-only access. Identity comes from the authenticated application session. */
3002
+ getCustomerGrant(sessionId: string): Promise<CustomerApprovalGrantResponse>;
3003
+ saveCustomerGrant(sessionId: string, grant: CustomerApprovalGrantInput): Promise<CustomerApprovalGrantResponse>;
3004
+ removeCustomerGrant(sessionId: string, revision: number): Promise<CustomerApprovalGrantResponse>;
3005
+ list(input: StacklinkApprovalAccess & Partial<ApprovalListQuery>): Promise<ApprovalListResponse>;
3006
+ get(id: string, access: StacklinkApprovalAccess): Promise<ApprovalRecord>;
3007
+ /** Decide only after displaying the exact proposal and checking permissions. Never resubmit the original action. */
3008
+ decide(id: string, access: StacklinkApprovalAccess, decision: ApprovalDecision): Promise<ApprovalRecord>;
3009
+ change(id: string, access: StacklinkApprovalAccess, change: ApprovalChange): Promise<ApprovalRecord>;
3010
+ events(access: StacklinkApprovalAccess, after?: string, options?: StacklinkRequestOptions): Promise<{
3011
+ events: StacklinkApprovalEvent[];
3012
+ nextCursor: string;
3013
+ }>;
3014
+ /** Durable cursor observation. Save each sequence and pass it as `after` when reconnecting. */
3015
+ observe(access: StacklinkApprovalAccess, options?: {
3016
+ after?: string;
3017
+ signal?: AbortSignal;
3018
+ timeoutMs?: number;
3019
+ }): AsyncGenerator<StacklinkApprovalEvent>;
3020
+ }
2775
3021
  export declare class StacklinkSessionsClient {
2776
3022
  private readonly client;
2777
3023
  constructor(client: Stacklink);
@@ -2797,14 +3043,11 @@ export declare class StacklinkSessionsClient {
2797
3043
  tools: StacklinkSessionMetaToolDefinition[];
2798
3044
  toolRouterSession?: StacklinkSessionData;
2799
3045
  }>;
2800
- toolkits(sessionId: string): Promise<{
2801
- toolkits: ProjectProvider[];
2802
- }>;
3046
+ toolkits(sessionId: string, query?: Omit<ListProviderCatalogInput, 'tenantId'>): Promise<ProviderCatalogPage>;
2803
3047
  streamEvents(sessionId: string, input?: {
2804
3048
  after?: string;
2805
3049
  eventTypes?: string[];
2806
3050
  limit?: number;
2807
- pollIntervalMs?: number;
2808
3051
  }): Promise<Response>;
2809
3052
  listRouterFacts(sessionId: string, query?: {
2810
3053
  kind?: string;
@@ -2928,9 +3171,9 @@ export declare class StacklinkConnectedAccountsClient {
2928
3171
  get(accountId: string): Promise<{
2929
3172
  account: ConnectedAccount;
2930
3173
  }>;
2931
- listTools(accountId: string, input?: {
3174
+ listTools(accountId: string, input: {
2932
3175
  includePlanned?: boolean | undefined;
2933
- toolKeys?: string[] | undefined;
3176
+ toolKeys: string[];
2934
3177
  }): Promise<{
2935
3178
  contract: string;
2936
3179
  sessionId: string;
@@ -2992,22 +3235,15 @@ export declare class StacklinkAuthConfigsClient {
2992
3235
  export declare class StacklinkToolkitsClient {
2993
3236
  private readonly client;
2994
3237
  constructor(client: Stacklink);
2995
- list(): Promise<{
2996
- providers: ProviderToolkit[];
2997
- }>;
2998
- listProject(query?: {
2999
- tenantId?: string;
3000
- }): Promise<{
3001
- providers: ProjectProvider[];
3002
- }>;
3003
- listTools(providerKey: string): Promise<{
3004
- providerKey: string;
3005
- tools: ProviderTool[];
3006
- meta?: {
3007
- responseMode?: "compact" | "full" | undefined;
3008
- provider?: ProviderToolkit | undefined;
3009
- } | undefined;
3010
- }>;
3238
+ list(query?: Omit<ListProviderCatalogInput, 'tenantId' | 'projectStatus' | 'connectionStatus'>): Promise<ProviderCatalogPage>;
3239
+ listProject(query?: ListProviderCatalogInput): Promise<ProviderCatalogPage>;
3240
+ listTools(providerKey: string, query?: {
3241
+ limit?: number | undefined;
3242
+ cursor?: string | undefined;
3243
+ search?: string | undefined;
3244
+ capability?: string | undefined;
3245
+ includePlanned?: boolean | undefined;
3246
+ }): Promise<ProviderToolCatalogPage>;
3011
3247
  }
3012
3248
  export declare class StacklinkProviderToolsClient {
3013
3249
  private readonly client;
@@ -3026,8 +3262,7 @@ export declare class StacklinkProviderToolsClient {
3026
3262
  }>;
3027
3263
  runtimeContracts(input: {
3028
3264
  sessionId: string;
3029
- toolkitKeys?: string[] | undefined;
3030
- toolKeys?: string[] | undefined;
3265
+ toolKeys: string[];
3031
3266
  includePlanned?: boolean | undefined;
3032
3267
  }): Promise<{
3033
3268
  contract: string;
@@ -3073,7 +3308,6 @@ export declare class StacklinkSessionMemoryClient {
3073
3308
  history(memoryId: string): Promise<JsonRecord>;
3074
3309
  update(memoryId: string, patch: Parameters<StacklinkMemoryClient['update']>[1]['patch']): Promise<JsonRecord>;
3075
3310
  forget(memoryId: string, reason?: string): Promise<JsonRecord>;
3076
- restore(memoryId: string, reason?: string): Promise<JsonRecord>;
3077
3311
  }
3078
3312
  export declare class StacklinkWorkbenchRun {
3079
3313
  private readonly client;
@@ -3083,12 +3317,12 @@ export declare class StacklinkWorkbenchRun {
3083
3317
  readonly executionKind: 'workbench_code' | 'workbench_bash';
3084
3318
  constructor(client: Stacklink, platformSessionId: string, response: WorkbenchExecutionResponse);
3085
3319
  events(input?: {
3086
- pollIntervalMs?: number | undefined;
3320
+ signal?: AbortSignal | undefined;
3321
+ streamTimeoutMs?: number | undefined;
3087
3322
  limit?: number | undefined;
3088
- }): AsyncGenerator<unknown, void, unknown>;
3323
+ }): AsyncGenerator<any, void, unknown>;
3089
3324
  wait(input?: {
3090
3325
  waitTimeoutMs?: number | undefined;
3091
- pollIntervalMs?: number | undefined;
3092
3326
  }): Promise<Record<string, unknown>>;
3093
3327
  cancel(reason?: string): Promise<Record<string, unknown>>;
3094
3328
  }
@@ -3231,9 +3465,9 @@ export declare class ToolRouterSession {
3231
3465
  get(): Promise<{
3232
3466
  session: StacklinkSessionData;
3233
3467
  }>;
3234
- mcpRequest(input: Record<string, unknown> | Array<Record<string, unknown>>, options?: StacklinkRequestOptions): Promise<unknown>;
3235
- mcpRequestStream(input: Record<string, unknown>, options?: StacklinkMcpStreamOptions): Promise<unknown>;
3236
- callMcpTool(name: StacklinkToolSurfaceName, args: Record<string, unknown>): Promise<unknown>;
3468
+ mcpRequest(input: Record<string, unknown> | Array<Record<string, unknown>>, options?: StacklinkRequestOptions): Promise<{} | null>;
3469
+ mcpRequestStream(input: Record<string, unknown>, options?: StacklinkMcpStreamOptions): Promise<{} | null>;
3470
+ callMcpTool(name: StacklinkToolSurfaceName, args: Record<string, unknown>, options?: StacklinkMcpStreamOptions): Promise<{} | null>;
3237
3471
  mcpConnection(): StacklinkSessionMcpConnection;
3238
3472
  update(patch: UpdateStacklinkSessionInput): Promise<{
3239
3473
  session: StacklinkSessionData;
@@ -3287,11 +3521,9 @@ export declare class ToolRouterSession {
3287
3521
  usage: unknown[];
3288
3522
  cost: unknown[];
3289
3523
  }>;
3290
- toolkits(): Promise<ProjectProvider[]>;
3291
- authorize(providerKey: string, input?: {
3292
- callbackUrl?: string;
3293
- authConfigId?: string;
3294
- authMode?: string;
3524
+ toolkits(query?: Omit<ListProviderCatalogInput, 'tenantId'>): Promise<ProviderCatalogPage>;
3525
+ authorize(connectionRef: string, input?: {
3526
+ oauthScopeProfile?: string;
3295
3527
  metadata?: Record<string, unknown>;
3296
3528
  }): Promise<StacklinkConnectionRequest>;
3297
3529
  waitForConnections(connectionRequestIds: string[], timeoutMs?: number, intervalMs?: number): Promise<{
@@ -3309,27 +3541,10 @@ export declare class ToolRouterSession {
3309
3541
  connectedAccountSecrets(accountId: string): Promise<unknown[]>;
3310
3542
  connectedAccountResources(accountId: string): Promise<ConnectedAccountResourcesResponse>;
3311
3543
  refreshConnectedAccountResources(accountId: string): Promise<ConnectedAccountResourcesResponse>;
3312
- searchTools(input?: Omit<Record<string, unknown>, 'sessionId'> & StacklinkDiscoveryCacheControl): Promise<{
3313
- tools: ProviderTool[];
3314
- queries?: unknown[];
3315
- meta?: unknown;
3316
- }>;
3317
- getToolSchemas(toolKeys: string[], input?: {
3318
- includePlanned?: boolean | undefined;
3319
- } & StacklinkDiscoveryCacheControl): Promise<{
3320
- tools: ProviderTool[];
3321
- }>;
3322
- prepareRuntimeTools(input?: {
3323
- toolkitKeys?: string[] | undefined;
3324
- toolKeys?: string[] | undefined;
3325
- includePlanned?: boolean | undefined;
3326
- }): Promise<{
3327
- contract: string;
3328
- sessionId: string;
3329
- tools: ProviderTool[];
3330
- meta?: unknown;
3331
- }>;
3332
- prepareTools(input: StacklinkPrepareToolsInput): Promise<StacklinkPreparedTools>;
3544
+ search(input: {
3545
+ queries: StacklinkAgentSearchQuery[];
3546
+ } & StacklinkDiscoveryCacheControl): Promise<StacklinkAgentSearchResponse>;
3547
+ getContracts(contractRefs: string[]): Promise<StacklinkAgentToolContractsResponse>;
3333
3548
  searchKnowledge(input?: Omit<KnowledgeSearchInput, 'sessionId'>): Promise<KnowledgeSearchResponse>;
3334
3549
  getKnowledgeCapabilities(input?: {
3335
3550
  packKey?: string | undefined;
@@ -3349,8 +3564,16 @@ export declare class ToolRouterSession {
3349
3564
  checkGstRcm(input: Omit<GstRcmCheckInput, 'sessionId'>): Promise<GstRcmCheckResponse>;
3350
3565
  getGstNoticeRule(input: Omit<GstNoticeRuleInput, 'sessionId'>): Promise<GstNoticeRuleResponse>;
3351
3566
  getGstAppealStageRule(input: Omit<GstAppealStageRuleInput, 'sessionId'>): Promise<GstAppealStageRuleResponse>;
3352
- executeTool(input: Omit<Record<string, unknown>, 'sessionId'>, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
3353
- executeToolsBatch(input: Omit<Record<string, unknown>, 'sessionId'>, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
3567
+ execute(contractRef: string, input: Record<string, unknown>, execution?: {
3568
+ accountRef?: string | undefined;
3569
+ binding?: {
3570
+ targetType: string;
3571
+ targetId: string;
3572
+ } | undefined;
3573
+ idempotencyKey?: string | undefined;
3574
+ clientExecutionId?: string | undefined;
3575
+ metadata?: Record<string, unknown> | undefined;
3576
+ }, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
3354
3577
  runWorkbench(input: Omit<Record<string, unknown>, 'sessionId'>, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
3355
3578
  destroyWorkbenchSession(input: {
3356
3579
  workbenchSessionId: string;
@@ -3398,7 +3621,6 @@ export declare class ToolRouterSession {
3398
3621
  executionKind: StacklinkExecutionKind;
3399
3622
  executionId: string;
3400
3623
  waitTimeoutMs?: number | undefined;
3401
- pollIntervalMs?: number | undefined;
3402
3624
  }, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
3403
3625
  cancelExecution(input: {
3404
3626
  executionKind: StacklinkExecutionKind;
@@ -3409,7 +3631,6 @@ export declare class ToolRouterSession {
3409
3631
  after?: string;
3410
3632
  eventTypes?: string[];
3411
3633
  limit?: number;
3412
- pollIntervalMs?: number;
3413
3634
  }): Promise<Response>;
3414
3635
  tools(): StacklinkTools;
3415
3636
  }
@@ -3440,4 +3661,115 @@ export declare class StacklinkConnectionRequest {
3440
3661
  };
3441
3662
  waitForConnection(timeoutMs?: number, intervalMs?: number): Promise<ConnectedAccount | undefined>;
3442
3663
  }
3664
+ /** Hosted bots share durable runs across the API, MCP and dashboard. */
3665
+ export declare class StacklinkBotsClient {
3666
+ private readonly client;
3667
+ constructor(client: Stacklink);
3668
+ apis(): Promise<{
3669
+ apis: SavedBotApi[];
3670
+ }>;
3671
+ updateApi(apiId: string, revision: number, api: ContextApi): Promise<SavedBotApi>;
3672
+ deleteApi(apiId: string): Promise<{
3673
+ deleted: boolean;
3674
+ }>;
3675
+ webhookSecret(botId: string): Promise<{
3676
+ signingSecret: string;
3677
+ }>;
3678
+ triggerWebhook(botId: string, triggerId: string): Promise<{
3679
+ url: string;
3680
+ signingSecret: string;
3681
+ signatureVersion: string;
3682
+ maxAgeSeconds: number;
3683
+ }>;
3684
+ triggerAdmission(botId: string, triggerId: string, admissionId: string): Promise<{
3685
+ admissionId: string;
3686
+ status: string;
3687
+ runId: string | null;
3688
+ result: unknown;
3689
+ error: unknown;
3690
+ }>;
3691
+ apiSigningKey(botId: string, apiId: string, request?: BotApiSigningKeyRequest): Promise<BotApiSigningKey>;
3692
+ models(): Promise<{
3693
+ models: import("../domain/bot-contract.js").ModelOption[];
3694
+ defaultModel: string;
3695
+ }>;
3696
+ setCredential(botId: string, secret: string): Promise<{
3697
+ id: string;
3698
+ }>;
3699
+ deliveries(botId: string, runId: string): Promise<{
3700
+ deliveries: Array<{
3701
+ id: string;
3702
+ status: string;
3703
+ attemptCount: number;
3704
+ nextAttemptAt: string | null;
3705
+ failureReason: string | null;
3706
+ }>;
3707
+ }>;
3708
+ retryDelivery(botId: string, runId: string, deliveryId: string): Promise<{
3709
+ queued: boolean;
3710
+ }>;
3711
+ setCustomerCredential(botId: string, input: {
3712
+ apiId: string;
3713
+ sessionId: string;
3714
+ secret: string;
3715
+ }): Promise<{
3716
+ id: string;
3717
+ }>;
3718
+ delete(botId: string): Promise<{
3719
+ deleted: boolean;
3720
+ }>;
3721
+ deleteCustomerData(botId: string, sessionId: string): Promise<{
3722
+ deleted: boolean;
3723
+ conversations: number;
3724
+ knowledgeSources: number;
3725
+ workspaces: number;
3726
+ sharedMemory: "unchanged";
3727
+ sharedApiCredentials: "unchanged";
3728
+ }>;
3729
+ setState(botId: string, input: {
3730
+ state: 'on' | 'paused';
3731
+ pauseFor?: '1h' | 'tomorrow' | 'manual';
3732
+ reason?: string;
3733
+ }): Promise<Bot>;
3734
+ list(): Promise<{
3735
+ bots: Array<{
3736
+ id: string;
3737
+ name: string;
3738
+ status: string;
3739
+ }>;
3740
+ }>;
3741
+ create(name: string): Promise<Bot>;
3742
+ get(botId: string): Promise<Bot>;
3743
+ update(botId: string, revision: number, patch: BotPatch): Promise<Bot>;
3744
+ publish(botId: string, revision: number, channels: PublishChannels): Promise<{
3745
+ botId: string;
3746
+ publishedAt: string;
3747
+ }>;
3748
+ run(botId: string, input: BotRunInput & {
3749
+ sessionId: string;
3750
+ }): Promise<BotRun>;
3751
+ getRun(botId: string, runId: string): Promise<BotRun>;
3752
+ /** Observe the same durable run. Returns when finished or when a person must act. */
3753
+ wait(botId: string, runId: string, options?: {
3754
+ totalTimeoutMs?: number;
3755
+ signal?: AbortSignal;
3756
+ }): Promise<BotRun>;
3757
+ events(botId: string, runId: string, after?: string): Promise<{
3758
+ events: Array<{
3759
+ sequence: string;
3760
+ type: string;
3761
+ payload: unknown;
3762
+ }>;
3763
+ terminal: boolean;
3764
+ }>;
3765
+ stream(botId: string, runId: string, options?: StacklinkRequestOptions & {
3766
+ after?: string;
3767
+ totalTimeoutMs?: number;
3768
+ }): AsyncGenerator<Record<string, unknown> | {
3769
+ sequence: string;
3770
+ type: string;
3771
+ payload: unknown;
3772
+ }, void, unknown>;
3773
+ cancel(botId: string, runId: string): Promise<BotRun>;
3774
+ }
3443
3775
  //# sourceMappingURL=index.d.ts.map