@stacklink/sdk 0.2.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.
Files changed (60) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +50 -0
  3. package/compatibility.json +30 -0
  4. package/dist/src/domain/knowledge-meta-tools.d.ts +12 -0
  5. package/dist/src/domain/knowledge-meta-tools.d.ts.map +1 -0
  6. package/dist/src/domain/knowledge-meta-tools.js +38 -0
  7. package/dist/src/domain/knowledge-meta-tools.js.map +1 -0
  8. package/dist/src/domain/memory-contract.d.ts +3399 -0
  9. package/dist/src/domain/memory-contract.d.ts.map +1 -0
  10. package/dist/src/domain/memory-contract.js +931 -0
  11. package/dist/src/domain/memory-contract.js.map +1 -0
  12. package/dist/src/domain/memory-meta-tools.d.ts +5 -0
  13. package/dist/src/domain/memory-meta-tools.d.ts.map +1 -0
  14. package/dist/src/domain/memory-meta-tools.js +18 -0
  15. package/dist/src/domain/memory-meta-tools.js.map +1 -0
  16. package/dist/src/domain/platform-mcp-tools.d.ts +3 -0
  17. package/dist/src/domain/platform-mcp-tools.d.ts.map +1 -0
  18. package/dist/src/domain/platform-mcp-tools.js +30 -0
  19. package/dist/src/domain/platform-mcp-tools.js.map +1 -0
  20. package/dist/src/domain/provider-branding.d.ts +27 -0
  21. package/dist/src/domain/provider-branding.d.ts.map +1 -0
  22. package/dist/src/domain/provider-branding.js +256 -0
  23. package/dist/src/domain/provider-branding.js.map +1 -0
  24. package/dist/src/domain/stacklink-meta-tools.d.ts +80 -0
  25. package/dist/src/domain/stacklink-meta-tools.d.ts.map +1 -0
  26. package/dist/src/domain/stacklink-meta-tools.js +456 -0
  27. package/dist/src/domain/stacklink-meta-tools.js.map +1 -0
  28. package/dist/src/sdk/claude-agent.d.ts +14 -0
  29. package/dist/src/sdk/claude-agent.d.ts.map +1 -0
  30. package/dist/src/sdk/claude-agent.js +15 -0
  31. package/dist/src/sdk/claude-agent.js.map +1 -0
  32. package/dist/src/sdk/framework-tools.d.ts +19 -0
  33. package/dist/src/sdk/framework-tools.d.ts.map +1 -0
  34. package/dist/src/sdk/framework-tools.js +26 -0
  35. package/dist/src/sdk/framework-tools.js.map +1 -0
  36. package/dist/src/sdk/index.d.ts +3443 -0
  37. package/dist/src/sdk/index.d.ts.map +1 -0
  38. package/dist/src/sdk/index.js +2782 -0
  39. package/dist/src/sdk/index.js.map +1 -0
  40. package/dist/src/sdk/langchain.d.ts +9 -0
  41. package/dist/src/sdk/langchain.d.ts.map +1 -0
  42. package/dist/src/sdk/langchain.js +11 -0
  43. package/dist/src/sdk/langchain.js.map +1 -0
  44. package/dist/src/sdk/memory-lifecycle.d.ts +75 -0
  45. package/dist/src/sdk/memory-lifecycle.d.ts.map +1 -0
  46. package/dist/src/sdk/memory-lifecycle.js +128 -0
  47. package/dist/src/sdk/memory-lifecycle.js.map +1 -0
  48. package/dist/src/sdk/openai-agents.d.ts +45 -0
  49. package/dist/src/sdk/openai-agents.d.ts.map +1 -0
  50. package/dist/src/sdk/openai-agents.js +182 -0
  51. package/dist/src/sdk/openai-agents.js.map +1 -0
  52. package/dist/src/sdk/openai.d.ts +12 -0
  53. package/dist/src/sdk/openai.d.ts.map +1 -0
  54. package/dist/src/sdk/openai.js +271 -0
  55. package/dist/src/sdk/openai.js.map +1 -0
  56. package/dist/src/sdk/vercel-ai.d.ts +11 -0
  57. package/dist/src/sdk/vercel-ai.d.ts.map +1 -0
  58. package/dist/src/sdk/vercel-ai.js +226 -0
  59. package/dist/src/sdk/vercel-ai.js.map +1 -0
  60. package/package.json +81 -0
@@ -0,0 +1,3443 @@
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';
4
+ 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
+ export type { ProviderBrandDescriptor };
8
+ export type { MemoryContextInput, MemoryConversationTurnInput, MemoryConnectedSourceInput, MemoryConnectedSourcePreviewInput, MemoryExportInput, MemoryGraphQueryInput, MemoryIngestInput, MemoryRichIngestInput, MemoryLegalHoldInput, MemoryPolicyPreviewInput, MemoryProjectPolicyInput, MemoryProjectPolicyUpdateInput, MemorySearchInput, MemorySourceBindingInput, MemorySourceBindingUpdateInput, MemorySubjectRef, };
9
+ 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;
13
+ export type StacklinkFetch = typeof fetch;
14
+ export type StacklinkMcpToolName = StacklinkMetaToolName | PlatformMcpToolName | KnowledgeMetaToolName | MemoryMetaToolName;
15
+ export type StacklinkToolSurfaceName = StacklinkMcpToolName | (string & {});
16
+ export declare const stacklinkTypeScriptSdkVersion = "0.2.0";
17
+ export declare class StacklinkApiError extends Error {
18
+ readonly statusCode: number;
19
+ readonly code?: string | undefined;
20
+ readonly details?: unknown | undefined;
21
+ constructor(message: string, statusCode: number, code?: string | undefined, details?: unknown | undefined);
22
+ }
23
+ type QueryPrimitive = string | number | boolean | null | undefined;
24
+ type QueryValue = QueryPrimitive | QueryPrimitive[];
25
+ export type JsonRecord = Record<string, unknown>;
26
+ export type StacklinkExecutionKind = 'tool' | 'batch' | 'workbench_bash' | 'workbench_code' | 'workbench_proxy';
27
+ export interface StacklinkRequestOptions {
28
+ signal?: AbortSignal | undefined;
29
+ }
30
+ interface StacklinkRequestInit extends StacklinkRequestOptions {
31
+ method?: string | undefined;
32
+ body?: unknown;
33
+ query?: Record<string, QueryValue> | undefined;
34
+ registration?: boolean | undefined;
35
+ headers?: Record<string, string> | undefined;
36
+ }
37
+ export interface StacklinkMcpProgressNotification {
38
+ jsonrpc: '2.0';
39
+ method: 'notifications/progress';
40
+ params: {
41
+ progressToken: string | number;
42
+ progress: number;
43
+ total?: number | undefined;
44
+ message?: string | undefined;
45
+ };
46
+ }
47
+ export interface StacklinkMcpStreamOptions extends StacklinkRequestOptions {
48
+ onProgress?: (notification: StacklinkMcpProgressNotification['params']) => void;
49
+ }
50
+ export interface StacklinkExecutionCapability {
51
+ mode?: 'sync' | 'background_job' | 'streaming' | 'hybrid' | undefined;
52
+ cancellable: 'hard' | 'cooperative' | 'request_only' | 'none';
53
+ streamingSupport: 'none' | 'progress' | 'output_delta' | 'both';
54
+ backgroundSupport: 'none' | 'optional' | 'required';
55
+ parallelSafety?: 'safe' | 'account_serial' | 'resource_serial' | 'unsafe' | undefined;
56
+ defaultTimeoutMs?: number | undefined;
57
+ maxTimeoutMs?: number | undefined;
58
+ idempotency?: {
59
+ requiredForMutation?: boolean | undefined;
60
+ providerIdempotencyKey?: string | undefined;
61
+ } | undefined;
62
+ }
63
+ export interface StacklinkToolOutputPolicy {
64
+ maxInlineBytes: number;
65
+ largeResult: 'inline' | 'preview_and_artifact' | 'workbench_sync' | 'reject';
66
+ artifactExtractors: Array<{
67
+ kind: 'provider_url' | 'file_bytes' | 'export_ref' | 'attachment';
68
+ path: string[];
69
+ contentTypePath?: string[] | undefined;
70
+ sizeBytesPath?: string[] | undefined;
71
+ expiresAtPath?: string[] | undefined;
72
+ }>;
73
+ redactionProfile: 'default_provider' | 'financial' | 'messaging' | 'file';
74
+ }
75
+ export interface StacklinkToolFamily {
76
+ familyKey: string;
77
+ resource: string;
78
+ operationKind: 'list' | 'get' | 'create' | 'update' | 'delete' | 'export' | 'job_start' | 'job_status';
79
+ workflowTags: string[];
80
+ }
81
+ export interface StacklinkToolNavigation {
82
+ categoryKey: string;
83
+ categoryLabel: string;
84
+ categoryOrder: number;
85
+ moduleKey: string;
86
+ moduleLabel: string;
87
+ moduleOrder: number;
88
+ actionLabel: string;
89
+ actionOrder?: number | undefined;
90
+ facets: string[];
91
+ }
92
+ export interface StacklinkProviderOperation {
93
+ transport: 'rest' | 'graphql' | 'sdk' | 'local' | 'mcp';
94
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | undefined;
95
+ path?: string | undefined;
96
+ graphqlOperationName?: string | undefined;
97
+ docsUrl?: string | undefined;
98
+ source: 'official_openapi' | 'official_docs' | 'hand_authored';
99
+ }
100
+ export interface StacklinkToolAuthPolicy {
101
+ connectionRequired: boolean;
102
+ scopeRequirements: Array<{
103
+ all?: string[] | undefined;
104
+ any?: string[] | undefined;
105
+ authModes?: string[] | undefined;
106
+ reauthRequired?: boolean | undefined;
107
+ allowProviderValidatedFallback?: boolean | undefined;
108
+ }>;
109
+ rawAccess?: {
110
+ enabled?: boolean | undefined;
111
+ tenantFlag?: string | undefined;
112
+ appFlag?: string | undefined;
113
+ approvalRequired?: boolean | undefined;
114
+ } | undefined;
115
+ confirmation: {
116
+ required: boolean;
117
+ exactToolKey: boolean;
118
+ };
119
+ approval?: {
120
+ required: boolean;
121
+ reason?: string | undefined;
122
+ } | undefined;
123
+ }
124
+ export type ProviderConnectorType = 'app' | 'platform' | 'sandbox' | 'api';
125
+ export interface ProviderProfileCapabilityItem {
126
+ key: string;
127
+ label: string;
128
+ description: string;
129
+ }
130
+ export interface ProviderProfileCapabilityGroup {
131
+ key: string;
132
+ title: string;
133
+ items: ProviderProfileCapabilityItem[];
134
+ }
135
+ export interface ProviderProfileDetails {
136
+ connectorType: ProviderConnectorType;
137
+ author: 'Stacklink';
138
+ providerKey: string;
139
+ websiteUrl?: string | undefined;
140
+ docsUrl?: string | undefined;
141
+ privacyPolicyUrl?: string | undefined;
142
+ termsUrl?: string | undefined;
143
+ }
144
+ export interface ProviderMarketplaceProfile {
145
+ visible: boolean;
146
+ connectable: boolean;
147
+ recommended: boolean;
148
+ internal: boolean;
149
+ }
150
+ export interface ProviderProfile {
151
+ headline: string;
152
+ summary: string;
153
+ examplePrompts: string[];
154
+ capabilityGroups: ProviderProfileCapabilityGroup[];
155
+ accessText: string;
156
+ authText: string;
157
+ safetyText: string;
158
+ details: ProviderProfileDetails;
159
+ marketplace: ProviderMarketplaceProfile;
160
+ }
161
+ export type ProviderRuntimeKind = 'native_api' | 'native_sdk' | 'remote_mcp' | 'managed_mcp_gateway';
162
+ export type ProviderRuntimeOwner = 'stacklink' | 'provider' | 'third_party';
163
+ export type ProviderMcpTransport = 'streamable_http';
164
+ export type ProviderMcpAuthType = 'oauth_dcr' | 'oauth_static_client' | 'bearer' | 'none';
165
+ export type ProviderMcpImportPolicy = 'certified_allowlist' | 'discover_then_review';
166
+ 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';
168
+ export interface ProviderRuntime {
169
+ kind: ProviderRuntimeKind;
170
+ owner: ProviderRuntimeOwner;
171
+ label: string;
172
+ mcp?: {
173
+ endpointUrl: string;
174
+ transport: ProviderMcpTransport;
175
+ auth: {
176
+ type: ProviderMcpAuthType;
177
+ };
178
+ sourceUrl: string;
179
+ importPolicy: ProviderMcpImportPolicy;
180
+ allowlisted: boolean;
181
+ identity?: {
182
+ strategy: 'tool_call';
183
+ identityKind: ProviderMcpIdentityKind;
184
+ toolName: string;
185
+ arguments: Record<string, unknown>;
186
+ payloadRoot?: {
187
+ source: 'result' | 'content_text_json';
188
+ contentIndex?: number | undefined;
189
+ path?: string[] | undefined;
190
+ } | undefined;
191
+ externalAccountIdPath?: string[] | undefined;
192
+ displayNamePath?: string[] | undefined;
193
+ displayNameTemplate?: string | undefined;
194
+ metadataPaths?: Record<string, string[]> | undefined;
195
+ fallbackDisplayName: string;
196
+ timeoutMs: number;
197
+ contractVersion: number;
198
+ } | undefined;
199
+ resources?: Array<{
200
+ key: string;
201
+ strategy: 'tool_call';
202
+ resourceKind: ProviderMcpResourceKind;
203
+ toolName: string;
204
+ arguments: Record<string, unknown>;
205
+ payloadRoot?: {
206
+ source: 'result' | 'content_text_json';
207
+ contentIndex?: number | undefined;
208
+ path?: string[] | undefined;
209
+ } | undefined;
210
+ externalResourceIdPath: string[];
211
+ labelPath?: string[] | undefined;
212
+ labelTemplate?: string | undefined;
213
+ parent?: {
214
+ kind: ProviderMcpResourceKind;
215
+ externalResourceIdPath?: string[] | undefined;
216
+ labelPath?: string[] | undefined;
217
+ labelTemplate?: string | undefined;
218
+ } | undefined;
219
+ metadataPaths?: Record<string, string[]> | undefined;
220
+ enrichments?: Array<{
221
+ toolName: string;
222
+ argumentsTemplate: Record<string, string | number | boolean | null>;
223
+ payloadRoot?: {
224
+ source: 'result' | 'content_text_json';
225
+ contentIndex?: number | undefined;
226
+ path?: string[] | undefined;
227
+ } | undefined;
228
+ metadataPaths?: Record<string, string[]> | undefined;
229
+ urlPath?: string[] | undefined;
230
+ timeoutMs?: number | undefined;
231
+ }> | undefined;
232
+ timeoutMs: number;
233
+ maxItems: number;
234
+ contractVersion: number;
235
+ }> | undefined;
236
+ } | undefined;
237
+ }
238
+ export interface ProviderToolkit {
239
+ id?: string | undefined;
240
+ key: string;
241
+ displayName: string;
242
+ category?: string | undefined;
243
+ status?: string | undefined;
244
+ authModes?: string[] | undefined;
245
+ capabilities?: string[] | undefined;
246
+ metadata?: unknown;
247
+ brand?: ProviderBrandDescriptor | undefined;
248
+ profile?: ProviderProfile | undefined;
249
+ runtime?: ProviderRuntime | undefined;
250
+ billingSummary?: StacklinkPublicBillingSummary | undefined;
251
+ createdAt?: string | undefined;
252
+ updatedAt?: string | undefined;
253
+ }
254
+ export interface ProjectProvider {
255
+ key?: string | undefined;
256
+ providerKey?: string | undefined;
257
+ name?: string | undefined;
258
+ displayName?: string | undefined;
259
+ category?: string | undefined;
260
+ status?: string | undefined;
261
+ projectStatus?: string | undefined;
262
+ authModes?: string[] | undefined;
263
+ capabilities?: string[] | undefined;
264
+ metadata?: unknown;
265
+ brand?: ProviderBrandDescriptor | undefined;
266
+ profile?: ProviderProfile | undefined;
267
+ runtime?: ProviderRuntime | undefined;
268
+ billingSummary?: StacklinkPublicBillingSummary | undefined;
269
+ toolCount?: number | undefined;
270
+ triggerCount?: number | undefined;
271
+ enabledAt?: string | null | undefined;
272
+ disabledAt?: string | null | undefined;
273
+ connection?: {
274
+ isActive: boolean;
275
+ connectedAccounts: ConnectedAccount[];
276
+ } | undefined;
277
+ toolkit?: ProviderToolkit | undefined;
278
+ }
279
+ export interface StacklinkProject {
280
+ id: string;
281
+ projectId?: string | undefined;
282
+ name: string;
283
+ projectName?: string | undefined;
284
+ slug: string;
285
+ clientName?: string | undefined;
286
+ environment: string;
287
+ status: string;
288
+ defaultTimeZone?: string | undefined;
289
+ dashboardWorkspaceId?: string | null | undefined;
290
+ dashboardWorkspace?: {
291
+ id: string;
292
+ name: string;
293
+ slug: string;
294
+ status: string;
295
+ } | null | undefined;
296
+ logsPurgeAt?: string | null | undefined;
297
+ deletedAt?: string | null | undefined;
298
+ metadata?: JsonRecord | undefined;
299
+ createdAt?: string | undefined;
300
+ updatedAt?: string | undefined;
301
+ }
302
+ export interface ProviderTool {
303
+ id?: string | undefined;
304
+ key: string;
305
+ toolkitKey?: string | undefined;
306
+ displayName: string;
307
+ description?: string | undefined;
308
+ capability?: string | undefined;
309
+ mutationLevel?: string | undefined;
310
+ status?: string | undefined;
311
+ inputSchema?: unknown;
312
+ outputSchema?: unknown;
313
+ searchDescriptor?: unknown;
314
+ metadata?: unknown;
315
+ aliases?: unknown[] | undefined;
316
+ providerBrand?: ProviderBrandDescriptor | undefined;
317
+ providerProfile?: ProviderProfile | undefined;
318
+ brand?: ProviderBrandDescriptor | undefined;
319
+ execution?: StacklinkExecutionCapability | undefined;
320
+ billing?: StacklinkBillingDescriptor | undefined;
321
+ outputPolicy?: StacklinkToolOutputPolicy | undefined;
322
+ family?: StacklinkToolFamily | undefined;
323
+ navigation?: StacklinkToolNavigation | undefined;
324
+ providerOperation?: StacklinkProviderOperation | undefined;
325
+ authPolicy?: StacklinkToolAuthPolicy | undefined;
326
+ contractVersion?: string | undefined;
327
+ connection?: unknown;
328
+ schema?: unknown;
329
+ accountScopedSchemas?: unknown;
330
+ executionBinding?: unknown;
331
+ modelCallable?: unknown;
332
+ }
333
+ export interface AuthRequirement {
334
+ authConfigId: string;
335
+ authMode: string;
336
+ flow: string;
337
+ family?: string | null | undefined;
338
+ surface?: string | null | undefined;
339
+ ownership?: unknown;
340
+ managedBy?: 'stacklink' | 'project' | undefined;
341
+ requiredFields: string[];
342
+ optionalFields: string[];
343
+ description: string;
344
+ credentialSchema: unknown;
345
+ oauthConfig: unknown;
346
+ }
347
+ export interface AuthConfig {
348
+ id: string;
349
+ providerKey: string;
350
+ providerBrand?: ProviderBrandDescriptor | undefined;
351
+ key: string;
352
+ displayName: string;
353
+ status?: string | undefined;
354
+ authMode: string;
355
+ flow: string;
356
+ family?: string | null | undefined;
357
+ surface?: string | null | undefined;
358
+ ownership?: unknown;
359
+ credentialSchema: unknown;
360
+ oauthConfig: unknown;
361
+ isDefault: boolean;
362
+ metadata: unknown;
363
+ managedBy?: string | undefined;
364
+ secretRefs?: unknown;
365
+ createdAt?: string | undefined;
366
+ updatedAt?: string | undefined;
367
+ }
368
+ export interface ConnectedAccount {
369
+ id: string;
370
+ tenantId: string;
371
+ authConfigId: string | null;
372
+ providerKey: string;
373
+ providerBrand?: ProviderBrandDescriptor | undefined;
374
+ externalAccountId: string;
375
+ displayName: string | null;
376
+ status: string;
377
+ authMode: string;
378
+ isDefault: boolean;
379
+ region?: string | null | undefined;
380
+ scopes: unknown;
381
+ identity?: {
382
+ kind: ProviderMcpIdentityKind;
383
+ source: 'oauth_profile' | 'mcp_identity' | 'manual' | 'fallback';
384
+ label: string;
385
+ status: 'resolved' | 'fallback' | 'failed';
386
+ resolvedAt?: string | undefined;
387
+ email?: string | undefined;
388
+ projectUrl?: string | undefined;
389
+ workspace?: string | undefined;
390
+ organization?: string | undefined;
391
+ details?: Record<string, string | number | boolean> | undefined;
392
+ resourceSummary?: ConnectedAccountResourceSummary[] | undefined;
393
+ } | null | undefined;
394
+ resourceSummary?: ConnectedAccountResourceSummary[] | undefined;
395
+ aliases: string[];
396
+ aliasValues?: string[] | undefined;
397
+ connectedAt?: string | null | undefined;
398
+ lastVerifiedAt?: string | null | undefined;
399
+ expiresAt: string | null;
400
+ }
401
+ export interface ConnectedAccountResourceSummary {
402
+ resourceKey: string;
403
+ kind: ProviderMcpResourceKind | string;
404
+ count: number;
405
+ }
406
+ export interface ConnectedAccountResource {
407
+ id: string;
408
+ accountId: string;
409
+ providerKey: string;
410
+ resourceKey: string;
411
+ kind: ProviderMcpResourceKind | string;
412
+ externalResourceId: string;
413
+ label: string;
414
+ parent?: {
415
+ kind: ProviderMcpResourceKind | string;
416
+ externalResourceId?: string | undefined;
417
+ label?: string | undefined;
418
+ } | undefined;
419
+ status: string;
420
+ url?: string | null | undefined;
421
+ details: Record<string, string | number | boolean>;
422
+ discoveredAt: string | Date;
423
+ lastSeenAt: string | Date;
424
+ contractVersion: number;
425
+ }
426
+ export interface ConnectedAccountResourcesResponse {
427
+ accountId: string;
428
+ providerKey: string;
429
+ resources: ConnectedAccountResource[];
430
+ resourceSummary: ConnectedAccountResourceSummary[];
431
+ page: {
432
+ limit: number;
433
+ total: number;
434
+ hasMore: boolean;
435
+ nextCursor: string | null;
436
+ };
437
+ sync?: {
438
+ status: 'resolved' | 'empty' | 'failed' | 'skipped_no_contract' | 'skipped_no_secret';
439
+ discovered: number;
440
+ resourceKeys: string[];
441
+ errors?: Array<{
442
+ resourceKey: string;
443
+ toolName: string;
444
+ message: string;
445
+ code?: string | undefined;
446
+ }> | undefined;
447
+ } | undefined;
448
+ syncJob?: {
449
+ id: string;
450
+ status: 'pending' | 'processing' | 'retry' | 'completed' | 'failed' | 'cancelled';
451
+ attempts: number;
452
+ queuedAt: string | Date;
453
+ completedAt: string | Date | null;
454
+ } | undefined;
455
+ }
456
+ export interface ConnectedAccountResourceListOptions {
457
+ search?: string | undefined;
458
+ resourceKey?: string | undefined;
459
+ resourceKinds?: string[] | undefined;
460
+ cursor?: string | undefined;
461
+ limit?: number | undefined;
462
+ }
463
+ export interface ConnectedAccountResourceResolveInput {
464
+ resourceKey: string;
465
+ externalResourceId: string;
466
+ }
467
+ export interface StacklinkApiKey {
468
+ id: string;
469
+ name: string;
470
+ keyPrefix?: string | undefined;
471
+ status: string;
472
+ scopes: string[];
473
+ rawKey?: string | undefined;
474
+ expiresAt?: string | null | undefined;
475
+ lastUsedAt?: string | null | undefined;
476
+ createdAt?: string | undefined;
477
+ updatedAt?: string | undefined;
478
+ }
479
+ export interface CreateStacklinkApiKeyInput {
480
+ name: string;
481
+ scopes?: string[] | undefined;
482
+ expiresAt?: string | undefined;
483
+ }
484
+ export type ConnectionRequestPhase = 'request_created' | 'connect_page_opened' | 'oauth_started' | 'provider_authorizing' | 'oauth_callback_received' | 'token_exchange_started' | 'account_storing' | 'remote_mcp_tools_importing' | 'remote_mcp_tools_imported' | 'completed' | 'failed' | 'expired';
485
+ export type ConnectionRequestNextAction = 'open_connect_url' | 'continue_to_provider' | 'wait_for_user' | 'wait_for_provider' | 'wait_for_stacklink' | 'refresh_toolkits' | 'retry' | 'none';
486
+ export interface ConnectionRequestResponse {
487
+ id: string;
488
+ providerKey: string;
489
+ providerName?: string | undefined;
490
+ authConfigId?: string | null | undefined;
491
+ authMode?: string | null | undefined;
492
+ status: string;
493
+ phase?: ConnectionRequestPhase | undefined;
494
+ nextAction?: ConnectionRequestNextAction | undefined;
495
+ redirectUrl?: string | undefined;
496
+ callbackUrl?: string | null | undefined;
497
+ failureReason?: string | null | undefined;
498
+ failureCode?: string | null | undefined;
499
+ expiresAt?: string | undefined;
500
+ authModes?: string[] | undefined;
501
+ authRequirements?: AuthRequirement[] | undefined;
502
+ connectedAccount?: ConnectedAccount | undefined;
503
+ error?: string | null | undefined;
504
+ metadata?: unknown;
505
+ }
506
+ export interface ConnectionAuthorizationResponse {
507
+ id: string;
508
+ providerKey: string;
509
+ authConfigId?: string | undefined;
510
+ authMode?: string | undefined;
511
+ status: string;
512
+ phase?: ConnectionRequestPhase | undefined;
513
+ nextAction?: ConnectionRequestNextAction | undefined;
514
+ redirectUrl: string;
515
+ hostedUrl?: string | undefined;
516
+ expiresAt: string;
517
+ authModes: string[];
518
+ authRequirements?: AuthRequirement[] | undefined;
519
+ }
520
+ export interface TriggerType {
521
+ id?: string | undefined;
522
+ key: string;
523
+ providerKey: string;
524
+ displayName: string;
525
+ description?: string | undefined;
526
+ deliveryModes?: string[] | undefined;
527
+ configSchema?: unknown;
528
+ eventSchema?: unknown;
529
+ metadata?: unknown;
530
+ }
531
+ export interface TriggerSubscription {
532
+ id: string;
533
+ tenantId?: string | undefined;
534
+ triggerType?: string | unknown;
535
+ triggerTypeId?: string | undefined;
536
+ providerKey: string;
537
+ accountId?: string | null | undefined;
538
+ connectedAccountId?: string | null | undefined;
539
+ status: string;
540
+ deliveryMode: string;
541
+ config?: unknown;
542
+ idempotencyKey?: string | null | undefined;
543
+ lastEventAt?: string | null | undefined;
544
+ createdAt?: string | undefined;
545
+ updatedAt?: string | undefined;
546
+ }
547
+ export interface CreateTriggerSubscriptionInput {
548
+ tenantId: string;
549
+ accountId?: string | undefined;
550
+ triggerTypeId: string;
551
+ deliveryMode?: 'webhook' | 'polling' | undefined;
552
+ config?: Record<string, unknown> | undefined;
553
+ idempotencyKey?: string | undefined;
554
+ }
555
+ export interface UpdateTriggerSubscriptionInput {
556
+ status?: 'active' | 'disabled' | undefined;
557
+ config?: Record<string, unknown> | undefined;
558
+ }
559
+ export interface ListTriggerSubscriptionsInput {
560
+ tenantId?: string | undefined;
561
+ providerKey?: string | undefined;
562
+ status?: string | undefined;
563
+ }
564
+ export type StacklinkWebhookEventType = 'stacklink.trigger.event' | 'stacklink.connected_account.connected' | 'stacklink.connected_account.refreshed' | 'stacklink.connected_account.expired' | 'stacklink.connected_account.disabled' | 'stacklink.connected_account.deleted' | 'stacklink.remote_mcp.tools_imported' | 'stacklink.remote_mcp.tools_import_failed' | 'stacklink.trigger.disabled';
565
+ export interface StacklinkWebhookEndpoint {
566
+ id: string;
567
+ consumerAppId?: string | undefined;
568
+ status: string;
569
+ callbackUrl?: string | null | undefined;
570
+ eventTypes: StacklinkWebhookEventType[];
571
+ secretRef?: string | null | undefined;
572
+ metadata?: unknown;
573
+ createdAt?: string | undefined;
574
+ updatedAt?: string | undefined;
575
+ }
576
+ export interface StacklinkWebhookTestResult {
577
+ deliveryId: string;
578
+ attemptId: string;
579
+ status: string;
580
+ statusCode: number | null;
581
+ durationMs: number;
582
+ }
583
+ export type StacklinkUsageOperationClass = 'standard' | 'premium' | 'free';
584
+ export type StacklinkBillingUnit = 'call' | 'runtime_10s' | 'token_block' | 'byte_block';
585
+ export type StacklinkBillingQuantitySource = 'fixed' | 'duration_ms' | 'tokens' | 'bytes';
586
+ export type StacklinkBillingInterval = 'monthly' | 'annual';
587
+ export type StacklinkBillingPolicyClass = 'free' | 'rate_limit_only' | 'standard_ops' | 'premium_ops';
588
+ export interface StacklinkBillingDescriptor {
589
+ class: StacklinkUsageOperationClass;
590
+ unit: StacklinkBillingUnit;
591
+ multiplier?: 1 | 2 | 3 | undefined;
592
+ quantitySource: StacklinkBillingQuantitySource;
593
+ version: 'stacklink-billing-v1';
594
+ }
595
+ export interface StacklinkBillingPlan {
596
+ key: string;
597
+ displayName: string;
598
+ monthlyPriceCents: number;
599
+ annualPriceCents?: number | null | undefined;
600
+ standardOpsIncluded: number;
601
+ premiumOpsIncluded: number;
602
+ standardOveragePerThousandCents: number;
603
+ premiumOveragePerThousandCents: number;
604
+ rateLimitPerMinute: number;
605
+ logRetentionDays: number;
606
+ projectsIncluded?: number | null | undefined;
607
+ status: string;
608
+ metadata?: unknown;
609
+ }
610
+ export interface StacklinkPublicBillingSummary {
611
+ policy: StacklinkBillingPolicyClass;
612
+ operationClass: StacklinkUsageOperationClass | null;
613
+ meterName: 'standard_ops' | 'premium_ops' | null;
614
+ label: string;
615
+ description: string;
616
+ }
617
+ export interface StacklinkWorkspaceSubscription {
618
+ id: string;
619
+ dashboardWorkspaceId: string;
620
+ planKey: string;
621
+ status: string;
622
+ currentPeriodStart: string;
623
+ currentPeriodEnd: string;
624
+ cancelAtPeriodEnd: boolean;
625
+ billingProvider: string;
626
+ externalCustomerPresent?: boolean | undefined;
627
+ externalSubscriptionPresent?: boolean | undefined;
628
+ metadata?: unknown;
629
+ createdAt?: string | undefined;
630
+ updatedAt?: string | undefined;
631
+ }
632
+ export interface StacklinkUsageBucket {
633
+ used: number;
634
+ included: number;
635
+ remaining: number;
636
+ overage: number;
637
+ overageCents: number;
638
+ }
639
+ export interface StacklinkUsageSummary {
640
+ workspace?: {
641
+ id: string;
642
+ name: string;
643
+ slug: string;
644
+ status: string;
645
+ } | undefined;
646
+ subscription: StacklinkWorkspaceSubscription;
647
+ plan: StacklinkBillingPlan;
648
+ period: {
649
+ start: string;
650
+ end: string;
651
+ };
652
+ usage: {
653
+ standard: StacklinkUsageBucket;
654
+ premium: StacklinkUsageBucket;
655
+ };
656
+ overagePending: boolean;
657
+ }
658
+ export interface StacklinkUsageMeterEvent {
659
+ id: string;
660
+ consumerAppId: string;
661
+ tenantId?: string | null | undefined;
662
+ sessionId?: string | null | undefined;
663
+ sourceType: string;
664
+ sourceId: string;
665
+ operationClass: StacklinkUsageOperationClass;
666
+ billingVisibility: 'customer' | 'internal';
667
+ quantity: number;
668
+ idempotencyKey: string;
669
+ occurredAt: string;
670
+ metadata?: unknown;
671
+ ratedUsage?: {
672
+ id: string;
673
+ pricingRuleKey: string;
674
+ pricingVersion: string;
675
+ productArea: string;
676
+ providerKey?: string | null | undefined;
677
+ toolKey?: string | null | undefined;
678
+ runtimeKind?: string | null | undefined;
679
+ knowledgePackKey?: string | null | undefined;
680
+ modelProvider?: string | null | undefined;
681
+ model?: string | null | undefined;
682
+ quantity: number;
683
+ unit: string;
684
+ upstreamCostMicros: string;
685
+ baseCostMicros: string;
686
+ markupBps: number;
687
+ markupAmountMicros: string;
688
+ finalChargeMicros: string;
689
+ currency: string;
690
+ createdAt: string;
691
+ } | null | undefined;
692
+ createdAt?: string | undefined;
693
+ }
694
+ export interface StacklinkBillingCheckoutSession {
695
+ provider: string;
696
+ checkoutSessionId: string;
697
+ url: string;
698
+ planKey: string;
699
+ billingInterval: StacklinkBillingInterval;
700
+ }
701
+ export interface StacklinkBillingPortalSession {
702
+ provider: string;
703
+ portalSessionId: string;
704
+ url: string;
705
+ }
706
+ export interface UpdateStacklinkSessionInput {
707
+ expectedConfigVersion?: number | undefined;
708
+ status?: 'active' | 'closed' | 'failed' | undefined;
709
+ toolRouter?: CreateStacklinkSessionInput['toolRouter'];
710
+ preset?: CreateStacklinkSessionInput['preset'];
711
+ preload?: CreateStacklinkSessionInput['preload'];
712
+ toolkits?: CreateStacklinkSessionInput['toolkits'];
713
+ tools?: CreateStacklinkSessionInput['tools'];
714
+ authConfigs?: CreateStacklinkSessionInput['authConfigs'];
715
+ connectedAccounts?: CreateStacklinkSessionInput['connectedAccounts'];
716
+ providerMutationMode?: CreateStacklinkSessionInput['providerMutationMode'];
717
+ multiAccount?: CreateStacklinkSessionInput['multiAccount'];
718
+ workbench?: CreateStacklinkSessionInput['workbench'];
719
+ knowledgePacks?: CreateStacklinkSessionInput['knowledgePacks'];
720
+ metaTools?: CreateStacklinkSessionInput['metaTools'];
721
+ memory?: CreateStacklinkSessionInput['memory'];
722
+ metadata?: Record<string, unknown> | undefined;
723
+ }
724
+ export interface StacklinkWebhookEnvelope<TType extends StacklinkWebhookEventType = StacklinkWebhookEventType, TData = unknown> {
725
+ version: 'v1';
726
+ id: string;
727
+ type: TType;
728
+ metadata: {
729
+ trigger_id?: string | null | undefined;
730
+ trigger_slug?: string | null | undefined;
731
+ connected_account_id?: string | null | undefined;
732
+ tenant_id?: string | null | undefined;
733
+ provider_key?: string | null | undefined;
734
+ auth_config_id?: string | null | undefined;
735
+ raw_event_id?: string | null | undefined;
736
+ [key: string]: unknown;
737
+ };
738
+ data: TData;
739
+ timestamp: string;
740
+ }
741
+ export type StacklinkTriggerEventEnvelope<TData = unknown> = StacklinkWebhookEnvelope<'stacklink.trigger.event', TData>;
742
+ export type StacklinkConnectedAccountExpiredEnvelope<TData = unknown> = StacklinkWebhookEnvelope<'stacklink.connected_account.expired', TData>;
743
+ export type StacklinkTriggerDisabledEnvelope<TData = unknown> = StacklinkWebhookEnvelope<'stacklink.trigger.disabled', TData>;
744
+ export interface StacklinkWebhookSignatureInput {
745
+ id: string;
746
+ timestamp: string;
747
+ signature: string;
748
+ body: string;
749
+ secret: string;
750
+ toleranceSeconds?: number | undefined;
751
+ now?: Date | undefined;
752
+ }
753
+ export interface WorkbenchSession {
754
+ id: string;
755
+ consumerAppId?: string | undefined;
756
+ tenantId?: string | undefined;
757
+ platformSessionId?: string | undefined;
758
+ sessionId?: string | undefined;
759
+ runtimeProvider?: string | null | undefined;
760
+ runtimeSessionId?: string | null | undefined;
761
+ sandboxSize?: 'standard' | 'medium' | 'large' | undefined;
762
+ runtimeSandboxSize?: 'standard' | 'medium' | 'large' | null | undefined;
763
+ runtimeGeneration?: number | undefined;
764
+ runtimeEnvironmentRestoredGeneration?: number | undefined;
765
+ activeExecutionCount?: number | undefined;
766
+ workspaceStorageKind?: 'r2_workspace' | string | undefined;
767
+ workspaceStorageRef?: string | null | undefined;
768
+ environmentManifest?: unknown;
769
+ status?: string | undefined;
770
+ model?: string | undefined;
771
+ metadata?: unknown;
772
+ lastActiveAt?: string | null | undefined;
773
+ destroyedAt?: string | null | undefined;
774
+ createdAt?: string | undefined;
775
+ updatedAt?: string | undefined;
776
+ }
777
+ export interface WorkbenchSessionDeleteReceipt {
778
+ deleted: true;
779
+ workbenchSessionId: string;
780
+ platformSessionId: string;
781
+ computeDestroyed: boolean;
782
+ deletedArtifactObjects: number;
783
+ deletedUploadObjects: number;
784
+ deletedSnapshots: number;
785
+ workspace: {
786
+ deleted: true;
787
+ workspaceKey: string;
788
+ deletedWorkspaceObjects: number;
789
+ deletedExecutionObjects: number;
790
+ deletedObjects: number;
791
+ };
792
+ deletedDatabaseRows: {
793
+ workbenchSessions: number;
794
+ files: number;
795
+ fileUploads: number;
796
+ artifacts: number;
797
+ executionLogs: number;
798
+ executionEvents: number;
799
+ executionEventStreams: number;
800
+ runDefinitions: number;
801
+ environmentSnapshots: number;
802
+ usageEvents: number;
803
+ costLedger: number;
804
+ budgetPolicies: number;
805
+ budgetReservations: number;
806
+ runtimeHeartbeats: number;
807
+ approvalRequests: number;
808
+ };
809
+ databaseDeleted: true;
810
+ }
811
+ export type WorkbenchRuntimeLanguage = 'python' | 'javascript' | 'typescript';
812
+ export type WorkbenchOutputMode = 'inline' | 'preview' | 'events' | 'artifact';
813
+ export interface WorkbenchReusableRunRequest {
814
+ mode?: 'auto' | 'off' | undefined;
815
+ seriesId?: string | undefined;
816
+ name?: string | undefined;
817
+ description?: string | undefined;
818
+ versionReason?: string | undefined;
819
+ }
820
+ export interface WorkbenchRunCodeInput {
821
+ workbenchSessionId?: string | undefined;
822
+ language: WorkbenchRuntimeLanguage;
823
+ code: string;
824
+ timeoutMs?: number | undefined;
825
+ background?: boolean | undefined;
826
+ notifyOnComplete?: boolean | undefined;
827
+ outputMode?: WorkbenchOutputMode | undefined;
828
+ maxOutputBytes?: number | undefined;
829
+ reusableRun?: WorkbenchReusableRunRequest | undefined;
830
+ currentStep?: string | undefined;
831
+ currentStepMetric?: string | undefined;
832
+ thought?: string | undefined;
833
+ metadata?: Record<string, unknown> | undefined;
834
+ }
835
+ export interface WorkbenchRunBashInput {
836
+ workbenchSessionId?: string | undefined;
837
+ command: string;
838
+ timeoutMs?: number | undefined;
839
+ background?: boolean | undefined;
840
+ notifyOnComplete?: boolean | undefined;
841
+ outputMode?: WorkbenchOutputMode | undefined;
842
+ maxOutputBytes?: number | undefined;
843
+ reusableRun?: WorkbenchReusableRunRequest | undefined;
844
+ currentStep?: string | undefined;
845
+ currentStepMetric?: string | undefined;
846
+ thought?: string | undefined;
847
+ metadata?: Record<string, unknown> | undefined;
848
+ }
849
+ export interface WorkbenchRuntimeDiagnostics {
850
+ code?: string | undefined;
851
+ message?: string | undefined;
852
+ runtimeStatus?: string | undefined;
853
+ exitCode?: number | undefined;
854
+ error?: unknown;
855
+ }
856
+ export type WorkbenchExecutionStatus = 'queued' | 'started' | 'running' | 'cancel_requested' | 'completed' | 'failed' | 'cancelled' | 'timed_out';
857
+ export interface WorkbenchExecutionLog {
858
+ id: string;
859
+ executionId?: string | undefined;
860
+ executionKind?: 'workbench_code' | 'workbench_bash' | undefined;
861
+ workbenchSessionId: string;
862
+ operation: string;
863
+ language: WorkbenchRuntimeLanguage | null;
864
+ status: WorkbenchExecutionStatus;
865
+ durationMs: number | null;
866
+ artifactId: string | null;
867
+ timeoutMs: number | null;
868
+ deadlineAt: string | null;
869
+ cancelRequestedAt: string | null;
870
+ cancelledAt: string | null;
871
+ runtimeProvider: string | null;
872
+ runtimeSessionId: string | null;
873
+ runtimeProcessId: string | null;
874
+ runtimeOutputCursor: string | null;
875
+ approvalRequestId: string | null;
876
+ idempotencyKey: string | null;
877
+ startedAt: string;
878
+ runtimeStartedAt?: string | null | undefined;
879
+ completedAt: string | null;
880
+ outputMode?: WorkbenchOutputMode | undefined;
881
+ result?: WorkbenchRuntimeEnvelope | WorkbenchBackgroundExecutionResult | WorkbenchOutputPreview | undefined;
882
+ artifact?: WorkbenchArtifact | null | undefined;
883
+ stdout?: string | null | undefined;
884
+ stderr?: string | null | undefined;
885
+ error?: unknown;
886
+ metadata?: Record<string, unknown> | undefined;
887
+ reusableRun?: {
888
+ mode: 'auto' | 'off';
889
+ status: 'pending' | 'ready' | 'failed' | 'skipped';
890
+ seriesId?: string | null | undefined;
891
+ name?: string | null | undefined;
892
+ description?: string | null | undefined;
893
+ versionReason?: string | null | undefined;
894
+ errorCode?: string | null | undefined;
895
+ runDefinitionId?: string | null | undefined;
896
+ version?: number | null | undefined;
897
+ replayOfRunDefinitionId?: string | null | undefined;
898
+ observableResultContractVersion?: string | null | undefined;
899
+ observableResult?: WorkbenchObservableResultV1 | null | undefined;
900
+ observableResultSha256?: string | null | undefined;
901
+ comparisonStatus?: 'matched' | 'mismatched' | null | undefined;
902
+ comparison?: WorkbenchRunComparison | null | undefined;
903
+ comparedAt?: string | null | undefined;
904
+ nextAction?: 'get_execution' | 'get_reusable_run' | null | undefined;
905
+ } | undefined;
906
+ inputEnvironmentSnapshotId?: string | null | undefined;
907
+ observableResultContractVersion?: string | null | undefined;
908
+ observableResult?: WorkbenchObservableResultV1 | null | undefined;
909
+ observableResultSha256?: string | null | undefined;
910
+ replayOfRunDefinitionId?: string | null | undefined;
911
+ replayComparisonStatus?: 'matched' | 'mismatched' | null | undefined;
912
+ replayComparison?: WorkbenchRunComparison | null | undefined;
913
+ replayComparedAt?: string | null | undefined;
914
+ }
915
+ export interface WorkbenchRuntimeResult {
916
+ status: 'completed' | 'failed' | 'cancelled' | 'timed_out' | string;
917
+ success: boolean;
918
+ exitCode: number | null;
919
+ terminalReason?: string | undefined;
920
+ stdout: string;
921
+ stderr: string;
922
+ outputBytes?: number | undefined;
923
+ outputTruncated?: boolean | undefined;
924
+ diagnostics?: WorkbenchRuntimeDiagnostics | undefined;
925
+ }
926
+ export interface WorkbenchRuntimeEnvelope {
927
+ runtime?: {
928
+ provider: 'cloudflare' | string;
929
+ sessionId: string;
930
+ workspaceKey?: string | undefined;
931
+ } | undefined;
932
+ result: WorkbenchRuntimeResult;
933
+ }
934
+ export interface WorkbenchBackgroundExecutionResult {
935
+ executionKind: 'workbench_code' | 'workbench_bash';
936
+ executionId: string;
937
+ status: 'queued' | 'running';
938
+ runtimeProcessId: string | null;
939
+ outputMode: 'events';
940
+ }
941
+ export interface WorkbenchOutputPreview {
942
+ outputMode: 'preview';
943
+ outputBytes: number;
944
+ preview: string;
945
+ }
946
+ export interface WorkbenchExecutionResponse {
947
+ workbenchSession: WorkbenchSession;
948
+ executionKind: 'workbench_code' | 'workbench_bash';
949
+ executionId: string;
950
+ status?: WorkbenchExecutionStatus | undefined;
951
+ outputMode?: WorkbenchOutputMode | undefined;
952
+ execution?: WorkbenchExecutionLog | undefined;
953
+ executionLog?: WorkbenchExecutionLog | undefined;
954
+ result?: WorkbenchRuntimeEnvelope | WorkbenchBackgroundExecutionResult | WorkbenchOutputPreview | undefined;
955
+ artifact?: WorkbenchArtifact | undefined;
956
+ }
957
+ export interface WorkbenchFile {
958
+ id: string;
959
+ path: string;
960
+ contentType: string;
961
+ sizeBytes: number | string;
962
+ storageKind: 'r2_workspace' | 'database_blob' | string;
963
+ sha256?: string | null | undefined;
964
+ etag?: string | null | undefined;
965
+ contentBase64?: string | undefined;
966
+ createdAt?: string | undefined;
967
+ updatedAt?: string | undefined;
968
+ }
969
+ export interface WorkbenchFileSignedUpload {
970
+ uploadId: string;
971
+ path: string;
972
+ contentType: string;
973
+ sizeBytes: number;
974
+ storageKind: 'r2_workspace';
975
+ uploadUrl: string;
976
+ expiresAt: string;
977
+ requiredHeaders: Record<string, string>;
978
+ }
979
+ export interface WorkbenchFileSignedDownload {
980
+ file: Omit<WorkbenchFile, 'id'> & {
981
+ etag?: string | undefined;
982
+ };
983
+ downloadUrl: string;
984
+ expiresAt: string;
985
+ }
986
+ export interface WorkbenchArtifact {
987
+ id: string;
988
+ artifactRef: string;
989
+ path: string;
990
+ label: string | null;
991
+ contentType: string | null;
992
+ sizeBytes: number | string | null;
993
+ sha256: string | null;
994
+ storageKind: 'r2_object' | 'database_blob' | 'workbench_file' | string;
995
+ status: string;
996
+ downloadUrl?: string | undefined;
997
+ createdAt: string;
998
+ updatedAt: string;
999
+ }
1000
+ export interface WorkbenchRunDefinition {
1001
+ id: string;
1002
+ seriesId: string;
1003
+ version: number;
1004
+ workbenchSessionId: string;
1005
+ platformSessionId: string;
1006
+ sourceExecutionId: string;
1007
+ environmentSnapshotId: string | null;
1008
+ name: string;
1009
+ description?: string | null | undefined;
1010
+ kind: 'code' | 'bash';
1011
+ language?: WorkbenchRuntimeLanguage | null | undefined;
1012
+ source: string;
1013
+ publicationStatus: 'draft' | 'published' | 'retired';
1014
+ validationStatus: 'unvalidated' | 'matched' | 'mismatched';
1015
+ validatedAt?: string | null | undefined;
1016
+ validatedByExecutionId?: string | null | undefined;
1017
+ sourceObservableResult?: WorkbenchObservableResultV1 | null | undefined;
1018
+ sourceObservableResultSha256?: string | null | undefined;
1019
+ sourceCodeSha256?: string | null | undefined;
1020
+ environmentManifestSha256?: string | null | undefined;
1021
+ creationMode: 'auto' | 'migrated_manual';
1022
+ versionReason?: string | null | undefined;
1023
+ environmentManifest: unknown;
1024
+ metadata?: unknown;
1025
+ replayCount?: number | undefined;
1026
+ replays?: Array<{
1027
+ executionId: string;
1028
+ status: WorkbenchExecutionStatus;
1029
+ comparison: WorkbenchRunComparison;
1030
+ }> | undefined;
1031
+ publishedAt?: string | null | undefined;
1032
+ retiredAt?: string | null | undefined;
1033
+ createdAt: string;
1034
+ }
1035
+ export type WorkbenchReplayEnvironmentMode = 'require_match' | 'restore_snapshot' | 'current';
1036
+ export interface WorkbenchRunComparison {
1037
+ contractVersion?: 'workbench.observable-result.v1' | undefined;
1038
+ status: 'pending' | 'pending_finalization' | 'matched' | 'mismatched';
1039
+ sourceExecutionId?: string | undefined;
1040
+ replayExecutionId: string;
1041
+ terminalMatch?: boolean | undefined;
1042
+ outputMatch?: boolean | undefined;
1043
+ artifactMatch?: boolean | undefined;
1044
+ sourceObservableResultSha256?: string | undefined;
1045
+ replayObservableResultSha256?: string | undefined;
1046
+ nextAction?: 'get_reusable_run' | undefined;
1047
+ }
1048
+ export interface WorkbenchObservableResultV1 {
1049
+ contractVersion: 'workbench.observable-result.v1';
1050
+ terminal: {
1051
+ status: 'completed' | 'failed' | 'cancelled' | 'timed_out';
1052
+ exitCode: number | null;
1053
+ };
1054
+ output: {
1055
+ orderedSha256: string;
1056
+ stdoutSha256: string;
1057
+ stderrSha256: string;
1058
+ structuredResultSha256: string;
1059
+ byteCount: number;
1060
+ };
1061
+ artifact: null | {
1062
+ sha256: string;
1063
+ sizeBytes: number;
1064
+ contentType: string | null;
1065
+ };
1066
+ }
1067
+ export interface WorkbenchRunReplayResponse {
1068
+ runDefinition: WorkbenchRunDefinition;
1069
+ execution: WorkbenchExecutionResponse;
1070
+ environment: {
1071
+ mode: WorkbenchReplayEnvironmentMode;
1072
+ status: 'queued' | 'completed' | 'failed';
1073
+ matchedBeforeReplay: boolean | null;
1074
+ restored: boolean;
1075
+ snapshotId: string | null;
1076
+ };
1077
+ comparison: WorkbenchRunComparison;
1078
+ }
1079
+ export type WorkbenchBudgetPeriod = 'daily' | 'weekly' | 'monthly' | 'all_time';
1080
+ export interface WorkbenchBudgetPolicy {
1081
+ id: string;
1082
+ tenantId: string;
1083
+ workbenchSessionId?: string | null | undefined;
1084
+ status: 'active' | 'disabled' | string;
1085
+ period: WorkbenchBudgetPeriod;
1086
+ maxCostMicros?: number | string | null | undefined;
1087
+ maxDurationMs?: number | null | undefined;
1088
+ maxArtifactBytes?: number | string | null | undefined;
1089
+ maxLlmTokens?: number | null | undefined;
1090
+ metadata?: unknown;
1091
+ createdAt?: string | undefined;
1092
+ updatedAt?: string | undefined;
1093
+ }
1094
+ export interface WorkbenchUsage {
1095
+ usageEvents?: unknown[];
1096
+ costLedger?: unknown[];
1097
+ heartbeats?: unknown[];
1098
+ events?: unknown[];
1099
+ ledger?: unknown[];
1100
+ summary?: unknown;
1101
+ budgets?: WorkbenchBudgetPolicy[];
1102
+ }
1103
+ export interface WorkbenchModelOption {
1104
+ provider: string;
1105
+ model: string;
1106
+ label?: string | undefined;
1107
+ supportsWebSearch?: boolean | undefined;
1108
+ supportsReasoning?: boolean | undefined;
1109
+ default?: boolean | undefined;
1110
+ }
1111
+ export interface StacklinkSessionData {
1112
+ id: string;
1113
+ tenantId: string;
1114
+ status?: string | undefined;
1115
+ userId?: string | null | undefined;
1116
+ tenantExternalId?: string | undefined;
1117
+ tenantDisplayName?: string | null | undefined;
1118
+ userExternalId?: string | null | undefined;
1119
+ userDisplayName?: string | null | undefined;
1120
+ userEmail?: string | null | undefined;
1121
+ toolkits?: string[] | undefined;
1122
+ connectedAccounts?: unknown;
1123
+ providerMutationMode?: 'read_only' | 'ask' | 'full_access' | undefined;
1124
+ authConfigs?: unknown;
1125
+ workbench?: unknown;
1126
+ memory?: unknown;
1127
+ mcp?: StacklinkSessionMcpDescriptor | undefined;
1128
+ createdAt?: string | undefined;
1129
+ updatedAt?: string | undefined;
1130
+ }
1131
+ export interface StacklinkSessionMcpDescriptor {
1132
+ url: string;
1133
+ headers: Record<string, string>;
1134
+ auth: {
1135
+ type: 'bearer';
1136
+ envVar: string;
1137
+ };
1138
+ protocolVersion: string;
1139
+ sessionId: string;
1140
+ }
1141
+ export interface StacklinkSessionMcpConnection {
1142
+ url: string;
1143
+ headers: Record<string, string>;
1144
+ }
1145
+ export interface StacklinkSessionMetaToolDefinition {
1146
+ name: string;
1147
+ description: string;
1148
+ inputSchema: Record<string, unknown>;
1149
+ }
1150
+ export interface ProviderArtifact {
1151
+ id: string;
1152
+ providerKey?: string | undefined;
1153
+ objectType?: string | undefined;
1154
+ sourceUrl?: string | null | undefined;
1155
+ storageKind?: string | undefined;
1156
+ storageRef?: string | null | undefined;
1157
+ mimeType?: string | null | undefined;
1158
+ sizeBytes?: number | string | null | undefined;
1159
+ downloadUrl?: string | undefined;
1160
+ metadata?: unknown;
1161
+ createdAt?: string | undefined;
1162
+ }
1163
+ export interface LogSummary {
1164
+ requests?: unknown;
1165
+ tools?: unknown;
1166
+ triggers?: unknown;
1167
+ webhooks?: unknown;
1168
+ workbench?: unknown;
1169
+ sourceBreakdown?: unknown;
1170
+ }
1171
+ export interface RequestLog {
1172
+ id: string;
1173
+ status?: string | undefined;
1174
+ method?: string | undefined;
1175
+ route?: string | null | undefined;
1176
+ path?: string | undefined;
1177
+ statusCode?: number | null | undefined;
1178
+ durationMs?: number | null | undefined;
1179
+ clientChannel?: 'rest_api' | 'ts_sdk' | 'python_sdk' | 'mcp' | 'dashboard' | string | undefined;
1180
+ clientName?: string | undefined;
1181
+ clientVersion?: string | null | undefined;
1182
+ clientRequestId?: string | null | undefined;
1183
+ clientSurface?: string | null | undefined;
1184
+ createdAt?: string | undefined;
1185
+ startedAt?: string | undefined;
1186
+ completedAt?: string | null | undefined;
1187
+ metadata?: unknown;
1188
+ }
1189
+ export interface ToolExecutionLog {
1190
+ id: string;
1191
+ toolKey?: string | undefined;
1192
+ status?: string | undefined;
1193
+ requestLogId?: string | null | undefined;
1194
+ requestLog?: RequestLog | null | undefined;
1195
+ clientChannel?: 'rest_api' | 'ts_sdk' | 'python_sdk' | 'mcp' | 'dashboard' | string | undefined;
1196
+ clientName?: string | undefined;
1197
+ clientVersion?: string | null | undefined;
1198
+ clientRequestId?: string | null | undefined;
1199
+ clientSurface?: string | null | undefined;
1200
+ createdAt?: string | undefined;
1201
+ startedAt?: string | undefined;
1202
+ completedAt?: string | null | undefined;
1203
+ durationMs?: number | null | undefined;
1204
+ metadata?: unknown;
1205
+ }
1206
+ export interface TriggerEventLog {
1207
+ id: string;
1208
+ triggerType?: string | undefined;
1209
+ status?: string | undefined;
1210
+ createdAt?: string | undefined;
1211
+ metadata?: unknown;
1212
+ }
1213
+ export interface StacklinkOptions {
1214
+ apiKey: string;
1215
+ baseUrl: string;
1216
+ fetch?: StacklinkFetch;
1217
+ registrationKey?: string | undefined;
1218
+ cache?: StacklinkClientCacheOptions | undefined;
1219
+ }
1220
+ export interface StacklinkClientCacheOptions {
1221
+ enabled?: boolean | undefined;
1222
+ toolsListTtlMs?: number | undefined;
1223
+ toolkitsTtlMs?: number | undefined;
1224
+ schemasTtlMs?: number | undefined;
1225
+ searchTtlMs?: number | undefined;
1226
+ maxEntries?: number | undefined;
1227
+ }
1228
+ export interface StacklinkDiscoveryCacheControl {
1229
+ cache?: 'default' | 'bypass' | undefined;
1230
+ }
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;
1239
+ }
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;
1248
+ };
1249
+ }
1250
+ 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;
1257
+ includeConnectionManagement?: boolean | undefined;
1258
+ };
1259
+ }
1260
+ export interface CreateStacklinkSessionInput {
1261
+ tenantId?: string | undefined;
1262
+ userId?: string | undefined;
1263
+ tenantDisplayName?: string | undefined;
1264
+ userDisplayName?: string | undefined;
1265
+ userEmail?: string | undefined;
1266
+ scopes?: string[] | undefined;
1267
+ 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;
1275
+ } | undefined;
1276
+ toolkits?: string[] | {
1277
+ enable?: string[];
1278
+ disable?: string[];
1279
+ } | undefined;
1280
+ tools?: string[] | Record<string, unknown> | undefined;
1281
+ authConfigs?: Record<string, string> | undefined;
1282
+ connectedAccounts?: Record<string, string | string[]> | undefined;
1283
+ providerMutationMode?: 'read_only' | 'ask' | 'full_access' | undefined;
1284
+ multiAccount?: {
1285
+ enable?: boolean;
1286
+ maxAccountsPerToolkit?: number;
1287
+ requireExplicitSelection?: boolean;
1288
+ } | undefined;
1289
+ workbench?: {
1290
+ enable?: boolean;
1291
+ sandboxSize?: 'standard' | 'medium' | 'large';
1292
+ autoSaveRuns?: boolean;
1293
+ } | undefined;
1294
+ knowledgePacks?: string[] | {
1295
+ enable?: string[];
1296
+ disable?: string[];
1297
+ } | undefined;
1298
+ memory?: {
1299
+ enabled?: boolean | undefined;
1300
+ agentExternalId?: string | undefined;
1301
+ readableSubjects?: Array<'session_user' | 'session_agent' | 'tenant_shared'> | undefined;
1302
+ writableSubjects?: Array<'session_user' | 'session_agent' | 'tenant_shared'> | undefined;
1303
+ captureMode?: 'explicit' | 'bound_sources' | undefined;
1304
+ includeProfile?: boolean | undefined;
1305
+ includeBlocks?: boolean | undefined;
1306
+ contextTokenBudget?: number | undefined;
1307
+ policyKey?: string | undefined;
1308
+ } | undefined;
1309
+ metaTools?: {
1310
+ surface?: StacklinkMetaToolSurface;
1311
+ includeInternal?: boolean;
1312
+ enable?: string[];
1313
+ disable?: string[];
1314
+ } | undefined;
1315
+ metadata?: Record<string, unknown> | undefined;
1316
+ }
1317
+ export interface ListStacklinkSessionsInput {
1318
+ status?: 'active' | 'closed' | 'failed' | undefined;
1319
+ tenantId?: string | undefined;
1320
+ externalTenantId?: string | undefined;
1321
+ userId?: string | undefined;
1322
+ externalUserId?: string | undefined;
1323
+ cursor?: string | undefined;
1324
+ limit?: number | undefined;
1325
+ }
1326
+ export interface ListStacklinkSessionsResponse {
1327
+ sessions: StacklinkSessionData[];
1328
+ nextCursor?: string | null | undefined;
1329
+ }
1330
+ export interface StacklinkTool {
1331
+ description: string;
1332
+ parameters: Record<string, unknown>;
1333
+ execute: (input: Record<string, unknown>) => Promise<unknown>;
1334
+ }
1335
+ export type StacklinkTools = Record<string, StacklinkTool>;
1336
+ export type KnowledgeRetrievalMode = 'canonical_lookup' | 'hybrid_search' | 'semantic_search' | 'text_search' | 'semantic_unavailable';
1337
+ export interface KnowledgeEvidenceReceipt {
1338
+ evidenceId: string;
1339
+ knowledgePackKey: string;
1340
+ releaseId: string;
1341
+ releaseKey: string;
1342
+ sourceReleaseKey: string | null;
1343
+ status: string;
1344
+ allowedClaimScopes: string[];
1345
+ canonicalId: string | null;
1346
+ sourceKey: string;
1347
+ blockId: string;
1348
+ documentId: string;
1349
+ exactQuote: string;
1350
+ sourceUrl: string | null;
1351
+ sourcePdfUrl: string | null;
1352
+ sourceClass: string | null;
1353
+ officiality: string | null;
1354
+ legallyBinding: boolean;
1355
+ amendmentState: string;
1356
+ evidenceHash: string;
1357
+ }
1358
+ export interface KnowledgeAgentWarning {
1359
+ code: string;
1360
+ message: string;
1361
+ }
1362
+ export interface KnowledgeNextAction {
1363
+ tool: string;
1364
+ reason: string;
1365
+ }
1366
+ export interface KnowledgeAgentGuidance {
1367
+ canAnswerDirectly: boolean;
1368
+ requiresStructuredTool: boolean;
1369
+ evidenceConfidence: 'verified' | 'partial' | 'source_missing' | 'missing' | (string & {});
1370
+ currentnessState: string;
1371
+ nextRecommendedActions: KnowledgeNextAction[];
1372
+ warnings: KnowledgeAgentWarning[];
1373
+ }
1374
+ export interface KnowledgeSemanticMeta {
1375
+ enabled: boolean;
1376
+ model?: string | undefined;
1377
+ dimensions?: number | undefined;
1378
+ reason?: string | undefined;
1379
+ retrievalEngine?: 'pgvector_hnsw' | 'jsonb_cosine' | (string & {}) | undefined;
1380
+ candidateLimit?: number | undefined;
1381
+ candidateLimitReached?: boolean | undefined;
1382
+ candidateCount?: number | undefined;
1383
+ comparedCount?: number | undefined;
1384
+ returnedCount?: number | undefined;
1385
+ filteredBelowMinSimilarityCount?: number | undefined;
1386
+ minSimilarity?: number | undefined;
1387
+ durationMs?: number | undefined;
1388
+ }
1389
+ export interface KnowledgeRetrievalLaneMeta {
1390
+ name: 'exact' | 'lexical' | 'semantic' | (string & {});
1391
+ enabled: boolean;
1392
+ engine?: 'canonical_lookup' | 'postgres_fts' | 'pgvector_hnsw' | (string & {}) | undefined;
1393
+ returnedCount: number;
1394
+ durationMs?: number | undefined;
1395
+ reason?: string | undefined;
1396
+ }
1397
+ export interface KnowledgeRetrievalMeta {
1398
+ strategy: 'canonical_lookup' | 'hybrid_rrf' | 'lexical_fallback' | (string & {});
1399
+ lanes: KnowledgeRetrievalLaneMeta[];
1400
+ fusion: {
1401
+ algorithm: 'rrf' | (string & {});
1402
+ k: number;
1403
+ candidateCount: number;
1404
+ finalCount: number;
1405
+ };
1406
+ filters: {
1407
+ sourceKeys: string[];
1408
+ claimScope?: string | undefined;
1409
+ currentnessPolicy: 'fail_closed' | (string & {});
1410
+ };
1411
+ }
1412
+ export interface KnowledgeSearchInput {
1413
+ sessionId: string;
1414
+ packKey?: string | undefined;
1415
+ releaseKey?: string | undefined;
1416
+ query?: string | undefined;
1417
+ canonicalId?: string | undefined;
1418
+ sourceKey?: string | undefined;
1419
+ sourceKeys?: string[] | undefined;
1420
+ claimScope?: string | undefined;
1421
+ limit?: number | undefined;
1422
+ semanticCandidateLimit?: number | undefined;
1423
+ minSimilarity?: number | undefined;
1424
+ }
1425
+ export interface KnowledgeSearchResult {
1426
+ blockId: string;
1427
+ documentId: string;
1428
+ canonicalId: string | null;
1429
+ sourceKey: string;
1430
+ title: string;
1431
+ exactQuote: string;
1432
+ amendmentState: string;
1433
+ sourceClass: string | null;
1434
+ officiality: string | null;
1435
+ legallyBinding: boolean;
1436
+ sourceUrl: string | null;
1437
+ sourcePdfUrl: string | null;
1438
+ allowedClaimScopes: string[];
1439
+ match?: {
1440
+ retrievalMode: KnowledgeRetrievalMode;
1441
+ similarity?: number | undefined;
1442
+ lexicalScore?: number | undefined;
1443
+ rrfScore?: number | undefined;
1444
+ lanes?: string[] | undefined;
1445
+ } | undefined;
1446
+ evidence: KnowledgeEvidenceReceipt;
1447
+ }
1448
+ export interface KnowledgeSearchResponse {
1449
+ knowledgePackKey: string;
1450
+ releaseKey: string;
1451
+ retrievalMode: KnowledgeRetrievalMode;
1452
+ semantic: KnowledgeSemanticMeta;
1453
+ retrieval?: KnowledgeRetrievalMeta | undefined;
1454
+ results: KnowledgeSearchResult[];
1455
+ agentGuidance?: KnowledgeAgentGuidance | undefined;
1456
+ }
1457
+ export interface KnowledgeCitationLookupInput {
1458
+ sessionId: string;
1459
+ packKey?: string | undefined;
1460
+ releaseKey?: string | undefined;
1461
+ canonicalId?: string | undefined;
1462
+ citationText?: string | undefined;
1463
+ limit?: number | undefined;
1464
+ }
1465
+ export interface KnowledgeCitationLookupResponse {
1466
+ knowledgePackKey: string;
1467
+ releaseKey: string;
1468
+ results: KnowledgeSearchResult[];
1469
+ agentGuidance?: KnowledgeAgentGuidance | undefined;
1470
+ }
1471
+ export interface KnowledgeAmendmentTrailInput {
1472
+ sessionId: string;
1473
+ packKey?: string | undefined;
1474
+ releaseKey?: string | undefined;
1475
+ canonicalId?: string | undefined;
1476
+ blockId?: string | undefined;
1477
+ limit?: number | undefined;
1478
+ }
1479
+ export interface KnowledgeAmendmentTrailEdge {
1480
+ id: string;
1481
+ relationship: string;
1482
+ sourceBlockId: string | null;
1483
+ targetBlockId: string | null;
1484
+ sourceCanonicalId: string | null;
1485
+ targetCanonicalId: string | null;
1486
+ effectiveFrom: string | null;
1487
+ effectiveTo: string | null;
1488
+ evidenceText: string | null;
1489
+ metadata: unknown;
1490
+ sourceBlock: KnowledgeSearchResult | null;
1491
+ targetBlock: KnowledgeSearchResult | null;
1492
+ }
1493
+ export interface KnowledgeAmendmentTrailResult {
1494
+ knowledgePackKey: string;
1495
+ releaseKey: string;
1496
+ target: KnowledgeSearchResult | {
1497
+ canonicalId?: string | undefined;
1498
+ };
1499
+ edges: KnowledgeAmendmentTrailEdge[];
1500
+ agentGuidance?: KnowledgeAgentGuidance | undefined;
1501
+ }
1502
+ export interface KnowledgeEvidenceVerifyInput {
1503
+ sessionId: string;
1504
+ evidenceId?: string | undefined;
1505
+ packKey?: string | undefined;
1506
+ releaseKey?: string | undefined;
1507
+ blockId?: string | undefined;
1508
+ exactQuote?: string | undefined;
1509
+ claimScope?: string | undefined;
1510
+ }
1511
+ export interface KnowledgeEvidenceVerifyResult {
1512
+ verified: boolean;
1513
+ quoteMatches?: boolean | undefined;
1514
+ receipt: KnowledgeEvidenceReceipt | unknown;
1515
+ }
1516
+ export interface KnowledgeAnswerVerifyInput {
1517
+ sessionId: string;
1518
+ answer?: string | undefined;
1519
+ evidenceIds: string[];
1520
+ requireAllVerified?: boolean | undefined;
1521
+ }
1522
+ export interface KnowledgeAnswerVerifyResult {
1523
+ verified: boolean;
1524
+ evidenceStatus: string;
1525
+ requireAllVerified: boolean;
1526
+ evidenceIds: string[];
1527
+ verifiedEvidenceIds: string[];
1528
+ missingEvidenceIds: string[];
1529
+ unverifiedEvidenceIds: string[];
1530
+ cannotAnswerReasons: string[];
1531
+ receipts: unknown[];
1532
+ agentGuidance: KnowledgeAgentGuidance;
1533
+ }
1534
+ export interface KnowledgeCapabilityResponse {
1535
+ capabilities: Array<{
1536
+ packKey: string;
1537
+ displayName: string;
1538
+ description?: string | null | undefined;
1539
+ category: string;
1540
+ status: string;
1541
+ defaultClaimScopes: unknown;
1542
+ subscribed: boolean;
1543
+ sessionEnabled: boolean | null;
1544
+ activeRelease: {
1545
+ key: string;
1546
+ sourceReleaseKey?: string | null | undefined;
1547
+ status: string;
1548
+ activatedAt?: string | null | undefined;
1549
+ embeddingModel?: string | null | undefined;
1550
+ embeddingDimensions?: number | null | undefined;
1551
+ } | null;
1552
+ retrievalTools: string[];
1553
+ structuredModules: Array<{
1554
+ moduleKey: string;
1555
+ displayName: string;
1556
+ domain: string;
1557
+ status: string;
1558
+ activeRelease: unknown;
1559
+ tools: string[];
1560
+ evidenceStatus: string;
1561
+ legalConfidence: string;
1562
+ evidenceSummary: unknown;
1563
+ recommendedFlows: Array<{
1564
+ task: string;
1565
+ tool: string;
1566
+ when: string;
1567
+ }>;
1568
+ metadata: unknown;
1569
+ }>;
1570
+ recommendedFlows: Array<{
1571
+ task: string;
1572
+ tool: string;
1573
+ when: string;
1574
+ }>;
1575
+ setupStatus: {
1576
+ ready: boolean;
1577
+ missing: string[];
1578
+ };
1579
+ metadata: unknown;
1580
+ }>;
1581
+ agentContract: {
1582
+ sessionRequirement: string;
1583
+ subscriptionRequirement: string;
1584
+ evidencePolicy: string;
1585
+ structuredToolPolicy: string;
1586
+ };
1587
+ }
1588
+ export interface KnowledgePackListResponse {
1589
+ packs: Array<{
1590
+ id: string;
1591
+ key: string;
1592
+ displayName: string;
1593
+ description?: string | null | undefined;
1594
+ category?: string | undefined;
1595
+ status: string;
1596
+ defaultClaimScopes: unknown;
1597
+ subscribed: boolean;
1598
+ activeRelease: {
1599
+ id: string;
1600
+ key: string;
1601
+ sourceReleaseKey?: string | null | undefined;
1602
+ status: string;
1603
+ activatedAt?: string | null | undefined;
1604
+ } | null;
1605
+ metadata: unknown;
1606
+ }>;
1607
+ }
1608
+ export interface KnowledgeReleaseListResponse {
1609
+ pack: {
1610
+ id: string;
1611
+ key: string;
1612
+ displayName: string;
1613
+ };
1614
+ releases: Array<{
1615
+ id: string;
1616
+ key: string;
1617
+ sourceReleaseKey?: string | null | undefined;
1618
+ status: string;
1619
+ active: boolean;
1620
+ manifestHash?: string | null | undefined;
1621
+ embeddingModel?: string | null | undefined;
1622
+ embeddingDimensions?: number | null | undefined;
1623
+ publishedAt?: string | null | undefined;
1624
+ activatedAt?: string | null | undefined;
1625
+ manifest: unknown;
1626
+ }>;
1627
+ }
1628
+ export interface GstRuleEvidenceLink {
1629
+ id: string;
1630
+ entityType: string;
1631
+ entityKey: string;
1632
+ knowledgePackKey: string;
1633
+ knowledgeReleaseKey: string;
1634
+ knowledgeBlockId: string | null;
1635
+ canonicalId: string | null;
1636
+ evidenceId: string | null;
1637
+ claimScope: string | null;
1638
+ currentnessState: string;
1639
+ verificationStatus: string;
1640
+ sourceUrl: string | null;
1641
+ exactQuote: string | null;
1642
+ metadata: unknown;
1643
+ }
1644
+ export interface GstRuleWarning {
1645
+ code: string;
1646
+ message: string;
1647
+ entityKey?: string | undefined;
1648
+ }
1649
+ export interface GstComplianceRuleRow {
1650
+ id: string;
1651
+ ruleKey: string;
1652
+ ruleFamily: string;
1653
+ ruleType: string;
1654
+ category: string | null;
1655
+ subjectKey: string | null;
1656
+ formKey: string | null;
1657
+ periodType: string | null;
1658
+ taxpayerClass: string | null;
1659
+ jurisdiction: string;
1660
+ lawDomain: string;
1661
+ title: string;
1662
+ description: string | null;
1663
+ claimScope: string;
1664
+ currentnessState: string;
1665
+ verificationStatus: string;
1666
+ origin: string;
1667
+ valueType: string | null;
1668
+ unit: string | null;
1669
+ value: unknown;
1670
+ conditions: unknown;
1671
+ priority: number;
1672
+ applicability: unknown;
1673
+ calculation: unknown;
1674
+ sourceUrl: string | null;
1675
+ sourceSection: string | null;
1676
+ effectiveFrom: string | null;
1677
+ effectiveTo: string | null;
1678
+ reviewedAt: string | null;
1679
+ reviewedBy: string | null;
1680
+ lastVerifiedAt: string | null;
1681
+ metadata: unknown;
1682
+ evidenceLinks: GstRuleEvidenceLink[];
1683
+ }
1684
+ export interface GstComplianceRuleQueryInput {
1685
+ sessionId: string;
1686
+ packKey?: string | undefined;
1687
+ moduleKey?: string | undefined;
1688
+ releaseKey?: string | undefined;
1689
+ asOfDate?: string | undefined;
1690
+ ruleKey?: string | undefined;
1691
+ ruleFamily?: string | undefined;
1692
+ ruleType?: string | undefined;
1693
+ subjectKey?: string | undefined;
1694
+ formKey?: string | undefined;
1695
+ periodType?: string | undefined;
1696
+ taxpayerClass?: string | undefined;
1697
+ limit?: number | undefined;
1698
+ }
1699
+ export interface GstFormRuleInput {
1700
+ sessionId: string;
1701
+ packKey?: string | undefined;
1702
+ moduleKey?: string | undefined;
1703
+ releaseKey?: string | undefined;
1704
+ asOfDate?: string | undefined;
1705
+ formKey: string;
1706
+ periodType?: string | undefined;
1707
+ taxpayerClass?: string | undefined;
1708
+ }
1709
+ export interface GstDueDateCalculationInput extends GstFormRuleInput {
1710
+ periodEnd: string;
1711
+ }
1712
+ export interface GstLateFeeRuleInput extends GstFormRuleInput {
1713
+ nilReturn?: boolean | undefined;
1714
+ }
1715
+ export interface GstLateFeeCalculationInput extends GstLateFeeRuleInput {
1716
+ dueDate: string;
1717
+ filedDate: string;
1718
+ }
1719
+ export interface GstInterestRuleInput {
1720
+ sessionId: string;
1721
+ packKey?: string | undefined;
1722
+ moduleKey?: string | undefined;
1723
+ releaseKey?: string | undefined;
1724
+ asOfDate?: string | undefined;
1725
+ taxHead?: string | undefined;
1726
+ }
1727
+ export interface GstInterestCalculationInput extends GstInterestRuleInput {
1728
+ amountMinor: number;
1729
+ dueDate: string;
1730
+ paidDate: string;
1731
+ }
1732
+ export interface GstRateLookupInput {
1733
+ sessionId: string;
1734
+ packKey?: string | undefined;
1735
+ moduleKey?: string | undefined;
1736
+ releaseKey?: string | undefined;
1737
+ asOfDate?: string | undefined;
1738
+ codeType: 'hsn' | 'sac';
1739
+ code: string;
1740
+ }
1741
+ export interface GstRcmCheckInput {
1742
+ sessionId: string;
1743
+ packKey?: string | undefined;
1744
+ moduleKey?: string | undefined;
1745
+ releaseKey?: string | undefined;
1746
+ asOfDate?: string | undefined;
1747
+ supplyKey: string;
1748
+ }
1749
+ export interface GstNoticeRuleInput {
1750
+ sessionId: string;
1751
+ packKey?: string | undefined;
1752
+ moduleKey?: string | undefined;
1753
+ releaseKey?: string | undefined;
1754
+ asOfDate?: string | undefined;
1755
+ noticeCode: string;
1756
+ }
1757
+ export interface GstAppealStageRuleInput {
1758
+ sessionId: string;
1759
+ packKey?: string | undefined;
1760
+ moduleKey?: string | undefined;
1761
+ releaseKey?: string | undefined;
1762
+ asOfDate?: string | undefined;
1763
+ stageKey: string;
1764
+ }
1765
+ export interface GstStructuredResponseContext {
1766
+ knowledgePackKey: string;
1767
+ knowledgeReleaseKey: string;
1768
+ structuredModuleKey: string;
1769
+ structuredReleaseKey: string;
1770
+ evidenceStatus: string;
1771
+ legalConfidence: string;
1772
+ evidenceSummary: unknown;
1773
+ }
1774
+ export interface GstRuleQueryResponse extends GstStructuredResponseContext {
1775
+ inputsUsed: unknown;
1776
+ results: GstComplianceRuleRow[];
1777
+ warnings: GstRuleWarning[];
1778
+ }
1779
+ export interface GstSingleRuleResponse extends GstStructuredResponseContext {
1780
+ inputsUsed: unknown;
1781
+ rule: GstComplianceRuleRow;
1782
+ warnings: GstRuleWarning[];
1783
+ }
1784
+ export interface GstCalculationResponse extends GstStructuredResponseContext {
1785
+ result: unknown;
1786
+ inputsUsed: unknown;
1787
+ ruleRowsUsed: GstComplianceRuleRow[];
1788
+ evidenceLinks: GstRuleEvidenceLink[];
1789
+ warnings: GstRuleWarning[];
1790
+ }
1791
+ export interface GstRateLookupResponse extends GstStructuredResponseContext {
1792
+ inputsUsed: unknown;
1793
+ result: unknown;
1794
+ evidenceLinks: GstRuleEvidenceLink[];
1795
+ warnings: GstRuleWarning[];
1796
+ }
1797
+ export interface GstRcmCheckResponse extends GstRateLookupResponse {
1798
+ }
1799
+ export interface GstNoticeRuleResponse extends GstRateLookupResponse {
1800
+ }
1801
+ export interface GstAppealStageRuleResponse extends GstRateLookupResponse {
1802
+ }
1803
+ export declare function verifyWebhookSignature(input: StacklinkWebhookSignatureInput): Promise<boolean>;
1804
+ export declare class Stacklink {
1805
+ private readonly apiKey;
1806
+ private readonly registrationKey;
1807
+ private readonly baseUrl;
1808
+ private readonly fetchImpl;
1809
+ private readonly cacheOptions;
1810
+ private readonly responseCache;
1811
+ readonly webhooks: StacklinkWebhooksClient;
1812
+ readonly triggers: StacklinkTriggersClient;
1813
+ readonly sessions: StacklinkSessionsClient;
1814
+ readonly logs: StacklinkLogsClient;
1815
+ readonly apiKeys: StacklinkApiKeysClient;
1816
+ readonly connectedAccounts: StacklinkConnectedAccountsClient;
1817
+ readonly authConfigs: StacklinkAuthConfigsClient;
1818
+ readonly toolkits: StacklinkToolkitsClient;
1819
+ readonly tools: StacklinkProviderToolsClient;
1820
+ readonly billing: StacklinkBillingClient;
1821
+ readonly memory: StacklinkMemoryClient;
1822
+ constructor(options: StacklinkOptions);
1823
+ sessionMcpConnection(descriptor: StacklinkSessionMcpDescriptor): StacklinkSessionMcpConnection;
1824
+ create(input: CreateStacklinkSessionInput): Promise<ToolRouterSession>;
1825
+ use(sessionId: string): Promise<ToolRouterSession>;
1826
+ clearCache(prefix?: string): void;
1827
+ listSessions(query?: ListStacklinkSessionsInput): Promise<ListStacklinkSessionsResponse>;
1828
+ getSession(sessionId: string): Promise<{
1829
+ session: StacklinkSessionData;
1830
+ }>;
1831
+ updateSession(sessionId: string, patch: UpdateStacklinkSessionInput): Promise<{
1832
+ session: StacklinkSessionData;
1833
+ }>;
1834
+ closeSession(sessionId: string): Promise<{
1835
+ session: StacklinkSessionData;
1836
+ }>;
1837
+ failSession(sessionId: string, input?: {
1838
+ metadata?: Record<string, unknown>;
1839
+ }): Promise<{
1840
+ session: StacklinkSessionData;
1841
+ }>;
1842
+ listSessionRouterFacts(sessionId: string, query?: {
1843
+ kind?: string;
1844
+ limit?: number;
1845
+ cursor?: string;
1846
+ }): Promise<{
1847
+ entries: unknown[];
1848
+ nextCursor?: string | null;
1849
+ kinds?: Array<{
1850
+ kind: string;
1851
+ count: number;
1852
+ }>;
1853
+ }>;
1854
+ listSessionConnectionEvents(sessionId: string): Promise<{
1855
+ events: unknown[];
1856
+ }>;
1857
+ getSessionTrace(sessionId: string, query?: {
1858
+ cursor?: string;
1859
+ limit?: number;
1860
+ }): Promise<{
1861
+ sessionId: string;
1862
+ selectedConnectedAccountIds: string[];
1863
+ entries: unknown[];
1864
+ nextCursor: string | null;
1865
+ }>;
1866
+ getSessionConfigHistory(sessionId: string, query?: {
1867
+ beforeVersion?: number;
1868
+ limit?: number;
1869
+ }): Promise<{
1870
+ sessionId: string;
1871
+ currentVersion: number | null;
1872
+ versions: Array<{
1873
+ version: number;
1874
+ config: Record<string, unknown>;
1875
+ changeMetadata: Record<string, unknown>;
1876
+ createdAt: string;
1877
+ }>;
1878
+ nextBeforeVersion: number | null;
1879
+ }>;
1880
+ getSessionWorkbench(sessionId: string): Promise<{
1881
+ workbenchSessions: WorkbenchSession[];
1882
+ artifacts: WorkbenchArtifact[];
1883
+ usage: unknown[];
1884
+ cost: unknown[];
1885
+ }>;
1886
+ getSessionMetaTools(sessionId: string): Promise<{
1887
+ contractVersion: string;
1888
+ tools: StacklinkSessionMetaToolDefinition[];
1889
+ toolRouterSession?: StacklinkSessionData;
1890
+ }>;
1891
+ createApiKey(input: CreateStacklinkApiKeyInput): Promise<{
1892
+ apiKey: StacklinkApiKey;
1893
+ }>;
1894
+ deleteApiKey(apiKeyId: string): Promise<{
1895
+ apiKey: StacklinkApiKey;
1896
+ }>;
1897
+ listProviders(): Promise<{
1898
+ providers: ProviderToolkit[];
1899
+ }>;
1900
+ listProjectProviders(query?: {
1901
+ tenantId?: string;
1902
+ }): Promise<{
1903
+ providers: ProjectProvider[];
1904
+ }>;
1905
+ listProviderTools(providerKey: string, input?: {
1906
+ 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
+ }>;
1916
+ createProject(input: {
1917
+ clientName: string;
1918
+ projectName?: string | undefined;
1919
+ projectSlug?: string | undefined;
1920
+ environment?: string | undefined;
1921
+ keyName?: string | undefined;
1922
+ scopes?: string[] | undefined;
1923
+ enabledProviders?: string[] | undefined;
1924
+ metadata?: JsonRecord | undefined;
1925
+ }): Promise<{
1926
+ project: StacklinkProject;
1927
+ apiKey: {
1928
+ id: string;
1929
+ apiKeyId: string;
1930
+ name: string;
1931
+ keyName: string;
1932
+ apiKey: string;
1933
+ value: string;
1934
+ prefix: string;
1935
+ scopes: string[];
1936
+ status: string;
1937
+ createdAt: string;
1938
+ };
1939
+ enabledProviders: Array<{
1940
+ providerKey: string;
1941
+ status: string;
1942
+ }>;
1943
+ }>;
1944
+ listProjects(input?: {
1945
+ status?: 'active' | 'deleted' | 'all' | undefined;
1946
+ limit?: number | undefined;
1947
+ cursor?: string | undefined;
1948
+ registration?: boolean | undefined;
1949
+ }): Promise<{
1950
+ projects: StacklinkProject[];
1951
+ nextCursor: string | null;
1952
+ }>;
1953
+ getProject(projectId: string, input?: {
1954
+ registration?: boolean | undefined;
1955
+ }): Promise<{
1956
+ project: StacklinkProject;
1957
+ }>;
1958
+ resetProjectAuthConfigs(projectId: string): Promise<{
1959
+ resetAt: string;
1960
+ resetCount: {
1961
+ authConfigs: number;
1962
+ accounts: number;
1963
+ triggers: number;
1964
+ };
1965
+ providerSideTokensRevoked: boolean;
1966
+ }>;
1967
+ listProjectProviderAccess(projectId: string): Promise<{
1968
+ providers: ProjectProvider[];
1969
+ }>;
1970
+ setProjectProviderAccess(projectId: string, providerKey: string, input?: {
1971
+ status?: 'enabled' | 'disabled' | 'planned' | undefined;
1972
+ enabledBy?: string | undefined;
1973
+ metadata?: JsonRecord | undefined;
1974
+ }): Promise<{
1975
+ provider: ProjectProvider;
1976
+ }>;
1977
+ inspectConnectToken(publicToken: string): Promise<{
1978
+ connectionRequest: ConnectionRequestResponse;
1979
+ }>;
1980
+ completeConnectToken(publicToken: string, input: Record<string, unknown>): Promise<{
1981
+ connectedAccount: ConnectedAccount;
1982
+ connectionRequest?: ConnectionRequestResponse;
1983
+ }>;
1984
+ startOAuthConnect(publicToken: string): Promise<Record<string, unknown>>;
1985
+ getConnectionRequest(requestId: string): Promise<{
1986
+ connectionRequest: ConnectionRequestResponse;
1987
+ }>;
1988
+ searchTools(input: Record<string, unknown>): Promise<{
1989
+ tools: ProviderTool[];
1990
+ queries?: unknown[];
1991
+ meta?: unknown;
1992
+ }>;
1993
+ getToolSchemas(input: {
1994
+ sessionId: string;
1995
+ toolKeys: string[];
1996
+ includePlanned?: boolean | undefined;
1997
+ }): Promise<{
1998
+ tools: ProviderTool[];
1999
+ }>;
2000
+ getRuntimeToolContracts(input: {
2001
+ sessionId: string;
2002
+ toolkitKeys?: string[] | undefined;
2003
+ toolKeys?: string[] | undefined;
2004
+ includePlanned?: boolean | undefined;
2005
+ }): Promise<{
2006
+ contract: string;
2007
+ sessionId: string;
2008
+ tools: ProviderTool[];
2009
+ meta?: unknown;
2010
+ }>;
2011
+ executeTool(input: Record<string, unknown>, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
2012
+ executeToolsBatch(input: Record<string, unknown>, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
2013
+ getSubscription(): Promise<StacklinkUsageSummary>;
2014
+ listBillingPlans(): Promise<{
2015
+ plans: StacklinkBillingPlan[];
2016
+ }>;
2017
+ getUsage(): Promise<StacklinkUsageSummary>;
2018
+ listUsageEvents(query?: {
2019
+ sourceType?: string | undefined;
2020
+ operationClass?: StacklinkUsageOperationClass | undefined;
2021
+ limit?: number | undefined;
2022
+ }): Promise<{
2023
+ events: StacklinkUsageMeterEvent[];
2024
+ }>;
2025
+ createBillingCheckout(input: {
2026
+ planKey: string;
2027
+ billingInterval?: StacklinkBillingInterval | undefined;
2028
+ successUrl?: string | undefined;
2029
+ cancelUrl?: string | undefined;
2030
+ }): Promise<StacklinkBillingCheckoutSession>;
2031
+ createBillingPortal(input?: {
2032
+ returnUrl?: string | undefined;
2033
+ }): Promise<StacklinkBillingPortalSession>;
2034
+ setWorkspaceSubscriptionPlanForProject(projectId: string, input: {
2035
+ planKey: string;
2036
+ status?: string | undefined;
2037
+ metadata?: JsonRecord | undefined;
2038
+ }): Promise<{
2039
+ subscription: StacklinkWorkspaceSubscription;
2040
+ usage: StacklinkUsageSummary;
2041
+ }>;
2042
+ listAuthConfigs(query?: {
2043
+ providerKey?: string;
2044
+ includeDisabled?: boolean;
2045
+ }): Promise<{
2046
+ authConfigs: AuthConfig[];
2047
+ }>;
2048
+ createAuthConfig(input: Record<string, unknown>): Promise<{
2049
+ authConfig: AuthConfig;
2050
+ }>;
2051
+ workbenchModels(): Promise<{
2052
+ models: WorkbenchModelOption[];
2053
+ defaultModel: string;
2054
+ webSearchDefaultProvider: string;
2055
+ }>;
2056
+ runWorkbench(input: Record<string, unknown>, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
2057
+ useWorkbenchSession(input: {
2058
+ sessionId: string;
2059
+ workbenchSessionId?: string | undefined;
2060
+ createNew?: boolean | undefined;
2061
+ metadata?: Record<string, unknown> | undefined;
2062
+ }): Promise<{
2063
+ workbenchSession: WorkbenchSession;
2064
+ reused: boolean;
2065
+ }>;
2066
+ deleteWorkbenchSession(input: {
2067
+ sessionId: string;
2068
+ workbenchSessionId: string;
2069
+ }): Promise<WorkbenchSessionDeleteReceipt>;
2070
+ listWorkbenchFiles(input: {
2071
+ sessionId: string;
2072
+ workbenchSessionId: string;
2073
+ }): Promise<{
2074
+ workbenchSession: WorkbenchSession;
2075
+ files: WorkbenchFile[];
2076
+ }>;
2077
+ readWorkbenchFile(input: {
2078
+ sessionId: string;
2079
+ workbenchSessionId: string;
2080
+ path: string;
2081
+ }): Promise<{
2082
+ workbenchSession: WorkbenchSession;
2083
+ file: WorkbenchFile;
2084
+ }>;
2085
+ uploadWorkbenchFile(input: {
2086
+ sessionId: string;
2087
+ workbenchSessionId: string;
2088
+ path: string;
2089
+ content: string | Uint8Array;
2090
+ contentType?: string | undefined;
2091
+ metadata?: Record<string, unknown> | undefined;
2092
+ }): Promise<{
2093
+ workbenchSession: WorkbenchSession;
2094
+ file: WorkbenchFile;
2095
+ }>;
2096
+ prepareWorkbenchFileUpload(input: {
2097
+ sessionId: string;
2098
+ workbenchSessionId: string;
2099
+ path: string;
2100
+ contentType: string;
2101
+ sizeBytes: number;
2102
+ }): Promise<{
2103
+ workbenchSession: WorkbenchSession;
2104
+ upload: WorkbenchFileSignedUpload;
2105
+ }>;
2106
+ finalizeWorkbenchFileUpload(input: {
2107
+ sessionId: string;
2108
+ workbenchSessionId: string;
2109
+ uploadId: string;
2110
+ metadata?: Record<string, unknown> | undefined;
2111
+ }): Promise<{
2112
+ file: WorkbenchFile;
2113
+ }>;
2114
+ uploadWorkbenchFileDirect(input: {
2115
+ sessionId: string;
2116
+ workbenchSessionId: string;
2117
+ path: string;
2118
+ content: string | Uint8Array;
2119
+ contentType?: string | undefined;
2120
+ metadata?: Record<string, unknown> | undefined;
2121
+ }): Promise<{
2122
+ file: WorkbenchFile;
2123
+ }>;
2124
+ getWorkbenchFileDownload(input: {
2125
+ sessionId: string;
2126
+ workbenchSessionId: string;
2127
+ path: string;
2128
+ }): Promise<WorkbenchFileSignedDownload>;
2129
+ downloadWorkbenchFile(input: {
2130
+ sessionId: string;
2131
+ workbenchSessionId: string;
2132
+ path: string;
2133
+ }): Promise<Response>;
2134
+ deleteWorkbenchFile(input: {
2135
+ sessionId: string;
2136
+ workbenchSessionId: string;
2137
+ path: string;
2138
+ }): Promise<{
2139
+ workbenchSession: WorkbenchSession;
2140
+ file: WorkbenchFile;
2141
+ deleted: true;
2142
+ }>;
2143
+ createWorkbenchRunDefinition(input: {
2144
+ sessionId: string;
2145
+ workbenchSessionId: string;
2146
+ executionId: string;
2147
+ seriesId?: string | undefined;
2148
+ name: string;
2149
+ description?: string | undefined;
2150
+ metadata?: Record<string, unknown> | undefined;
2151
+ }): Promise<{
2152
+ runDefinition: WorkbenchRunDefinition;
2153
+ }>;
2154
+ listWorkbenchRunDefinitions(input: {
2155
+ sessionId: string;
2156
+ workbenchSessionId?: string | undefined;
2157
+ seriesId?: string | undefined;
2158
+ cursor?: string | undefined;
2159
+ limit?: number | undefined;
2160
+ }): Promise<{
2161
+ runDefinitions: WorkbenchRunDefinition[];
2162
+ limit: number;
2163
+ hasMore: boolean;
2164
+ nextCursor: string | null;
2165
+ }>;
2166
+ getWorkbenchRunDefinition(input: {
2167
+ sessionId: string;
2168
+ runDefinitionId: string;
2169
+ }): Promise<{
2170
+ runDefinition: WorkbenchRunDefinition;
2171
+ }>;
2172
+ updateWorkbenchRunDefinition(input: {
2173
+ sessionId: string;
2174
+ runDefinitionId: string;
2175
+ name?: string | undefined;
2176
+ description?: string | null | undefined;
2177
+ versionReason?: string | null | undefined;
2178
+ }): Promise<{
2179
+ runDefinition: WorkbenchRunDefinition;
2180
+ }>;
2181
+ replayWorkbenchRunDefinition(input: {
2182
+ sessionId: string;
2183
+ runDefinitionId: string;
2184
+ background?: boolean | undefined;
2185
+ timeoutMs?: number | undefined;
2186
+ environmentMode?: WorkbenchReplayEnvironmentMode | undefined;
2187
+ idempotencyKey: string;
2188
+ }): Promise<WorkbenchRunReplayResponse>;
2189
+ publishWorkbenchRunDefinition(input: {
2190
+ sessionId: string;
2191
+ runDefinitionId: string;
2192
+ expectedPublishedVersion: number | null;
2193
+ }): Promise<{
2194
+ runDefinition: WorkbenchRunDefinition;
2195
+ }>;
2196
+ rollbackWorkbenchRunDefinition(input: {
2197
+ sessionId: string;
2198
+ runDefinitionId: string;
2199
+ expectedPublishedVersion: number | null;
2200
+ }): Promise<{
2201
+ runDefinition: WorkbenchRunDefinition;
2202
+ }>;
2203
+ destroyWorkbenchSession(input: {
2204
+ sessionId: string;
2205
+ workbenchSessionId: string;
2206
+ }, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
2207
+ runWorkbenchBash(input: Record<string, unknown>, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
2208
+ waitForWorkbenchResponse(input: Record<string, unknown>, accepted: Record<string, unknown>, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
2209
+ listExecutions(input: {
2210
+ sessionId: string;
2211
+ executionKind?: StacklinkExecutionKind | undefined;
2212
+ workbenchSessionId?: string | undefined;
2213
+ status?: string | undefined;
2214
+ cursor?: string | undefined;
2215
+ limit?: number | undefined;
2216
+ }, options?: StacklinkRequestOptions): Promise<{
2217
+ executions: unknown[];
2218
+ limit: number;
2219
+ nextCursor: string | null;
2220
+ liveCount: number;
2221
+ }>;
2222
+ getExecution(input: {
2223
+ sessionId: string;
2224
+ executionKind: StacklinkExecutionKind;
2225
+ executionId: string;
2226
+ includeEvents?: boolean | undefined;
2227
+ eventLimit?: number | undefined;
2228
+ }, options?: StacklinkRequestOptions): Promise<{
2229
+ execution: unknown;
2230
+ events?: unknown[] | undefined;
2231
+ limit?: number | undefined;
2232
+ hasMore?: boolean | undefined;
2233
+ nextCursor?: string | null | undefined;
2234
+ }>;
2235
+ readExecutionEvents(input: {
2236
+ sessionId: string;
2237
+ executionKind: StacklinkExecutionKind;
2238
+ executionId: string;
2239
+ afterSequence?: string | number | bigint | undefined;
2240
+ limit?: number | undefined;
2241
+ }, options?: StacklinkRequestOptions): Promise<{
2242
+ events: unknown[];
2243
+ limit: number;
2244
+ hasMore: boolean;
2245
+ nextCursor: string | null;
2246
+ }>;
2247
+ waitForExecution(input: {
2248
+ sessionId: string;
2249
+ executionKind: StacklinkExecutionKind;
2250
+ executionId: string;
2251
+ waitTimeoutMs?: number | undefined;
2252
+ pollIntervalMs?: number | undefined;
2253
+ }, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
2254
+ cancelExecution(input: {
2255
+ sessionId: string;
2256
+ executionKind: StacklinkExecutionKind;
2257
+ executionId: string;
2258
+ reason?: string | undefined;
2259
+ }, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
2260
+ getAuthConfig(authConfigId: string): Promise<{
2261
+ authConfig: AuthConfig;
2262
+ }>;
2263
+ updateAuthConfig(authConfigId: string, patch: Record<string, unknown>): Promise<{
2264
+ authConfig: AuthConfig;
2265
+ }>;
2266
+ enableAuthConfig(authConfigId: string): Promise<{
2267
+ authConfig: AuthConfig;
2268
+ }>;
2269
+ disableAuthConfig(authConfigId: string): Promise<{
2270
+ authConfig: AuthConfig;
2271
+ }>;
2272
+ deleteAuthConfig(authConfigId: string): Promise<{
2273
+ authConfig: AuthConfig;
2274
+ }>;
2275
+ listConnectedAccounts(tenantId: string): Promise<{
2276
+ connections: ConnectedAccount[];
2277
+ }>;
2278
+ createConnectedAccount(input: Record<string, unknown>): Promise<{
2279
+ account: ConnectedAccount;
2280
+ }>;
2281
+ getConnectedAccount(accountId: string): Promise<{
2282
+ account: ConnectedAccount;
2283
+ }>;
2284
+ listConnectedAccountTools(accountId: string, input?: {
2285
+ includePlanned?: boolean | undefined;
2286
+ toolKeys?: string[] | undefined;
2287
+ }): Promise<{
2288
+ contract: string;
2289
+ sessionId: string;
2290
+ tools: ProviderTool[];
2291
+ meta?: unknown;
2292
+ }>;
2293
+ listConnectedAccountResources(accountId: string, input?: ConnectedAccountResourceListOptions): Promise<ConnectedAccountResourcesResponse>;
2294
+ refreshConnectedAccountResources(accountId: string, input?: ConnectedAccountResourceListOptions): Promise<ConnectedAccountResourcesResponse>;
2295
+ resolveConnectedAccountResource(accountId: string, input: ConnectedAccountResourceResolveInput): Promise<{
2296
+ accountId: string;
2297
+ providerKey: string;
2298
+ resource: ConnectedAccountResource;
2299
+ }>;
2300
+ updateConnectedAccount(accountId: string, patch: Record<string, unknown>): Promise<{
2301
+ account: ConnectedAccount;
2302
+ }>;
2303
+ enableConnectedAccount(accountId: string): Promise<{
2304
+ account: ConnectedAccount;
2305
+ }>;
2306
+ disableConnectedAccount(accountId: string): Promise<{
2307
+ account: ConnectedAccount;
2308
+ }>;
2309
+ refreshConnectedAccount(accountId: string): Promise<{
2310
+ account: ConnectedAccount;
2311
+ }>;
2312
+ validateConnectedAccount(accountId: string): Promise<unknown>;
2313
+ deleteConnectedAccount(accountId: string): Promise<{
2314
+ account: ConnectedAccount;
2315
+ }>;
2316
+ listConnectedAccountSecrets(accountId: string): Promise<{
2317
+ secrets: unknown[];
2318
+ }>;
2319
+ runConnectionHealthCheck(input?: Record<string, unknown>): Promise<unknown>;
2320
+ listTriggerTypes(query?: {
2321
+ providerKey?: string;
2322
+ }): Promise<{
2323
+ triggerTypes: TriggerType[];
2324
+ }>;
2325
+ listTriggerSubscriptions(query?: ListTriggerSubscriptionsInput): Promise<{
2326
+ subscriptions: TriggerSubscription[];
2327
+ }>;
2328
+ createTriggerSubscription(input: CreateTriggerSubscriptionInput): Promise<{
2329
+ subscription: TriggerSubscription;
2330
+ }>;
2331
+ getTriggerSubscription(subscriptionId: string): Promise<{
2332
+ subscription: TriggerSubscription;
2333
+ }>;
2334
+ updateTriggerSubscription(subscriptionId: string, patch: UpdateTriggerSubscriptionInput): Promise<{
2335
+ subscription: TriggerSubscription;
2336
+ }>;
2337
+ deleteTriggerSubscription(subscriptionId: string): Promise<{
2338
+ subscription: TriggerSubscription;
2339
+ }>;
2340
+ listWebhookEventTypes(): Promise<{
2341
+ eventTypes: Array<{
2342
+ eventType: StacklinkWebhookEventType;
2343
+ }>;
2344
+ }>;
2345
+ getWebhook(): Promise<{
2346
+ webhook: StacklinkWebhookEndpoint;
2347
+ }>;
2348
+ updateWebhook(input: {
2349
+ callbackUrl?: string | null;
2350
+ status?: 'active' | 'disabled';
2351
+ eventTypes?: StacklinkWebhookEventType[];
2352
+ }): Promise<{
2353
+ webhook: StacklinkWebhookEndpoint;
2354
+ signingSecret?: string;
2355
+ }>;
2356
+ rotateWebhookSecret(): Promise<{
2357
+ webhook: StacklinkWebhookEndpoint;
2358
+ signingSecret: string;
2359
+ }>;
2360
+ sendWebhookTest(input: {
2361
+ eventType: StacklinkWebhookEventType;
2362
+ }): Promise<StacklinkWebhookTestResult>;
2363
+ verifyWebhookSignature(input: StacklinkWebhookSignatureInput): Promise<boolean>;
2364
+ replayProviderEvent(eventId: string): Promise<unknown>;
2365
+ retryWebhookDelivery(deliveryId: string, input?: {
2366
+ force?: boolean;
2367
+ }): Promise<unknown>;
2368
+ redriveDeadLetterWebhookDeliveries(input?: {
2369
+ limit?: number;
2370
+ force?: boolean;
2371
+ }): Promise<unknown>;
2372
+ runTriggerPoller(input?: Record<string, unknown>): Promise<Record<string, unknown>>;
2373
+ runTriggerDeliveries(input?: Record<string, unknown>): Promise<Record<string, unknown>>;
2374
+ getProviderArtifact(artifactId: string): Promise<{
2375
+ artifact: ProviderArtifact;
2376
+ }>;
2377
+ getLogSummary(query?: {
2378
+ clientChannel?: string;
2379
+ clientName?: string;
2380
+ tenantId?: string;
2381
+ sessionId?: string;
2382
+ providerKey?: string;
2383
+ toolKey?: string;
2384
+ requestId?: string;
2385
+ apiKeyId?: string;
2386
+ route?: string;
2387
+ status?: string;
2388
+ from?: string;
2389
+ to?: string;
2390
+ limit?: number;
2391
+ }): Promise<{
2392
+ summary: LogSummary;
2393
+ }>;
2394
+ listRequestLogs(query?: {
2395
+ clientChannel?: string;
2396
+ clientName?: string;
2397
+ tenantId?: string;
2398
+ sessionId?: string;
2399
+ providerKey?: string;
2400
+ toolKey?: string;
2401
+ requestId?: string;
2402
+ apiKeyId?: string;
2403
+ route?: string;
2404
+ status?: string;
2405
+ cursor?: string;
2406
+ from?: string;
2407
+ to?: string;
2408
+ limit?: number;
2409
+ }): Promise<{
2410
+ logs: RequestLog[];
2411
+ nextCursor?: string | null;
2412
+ }>;
2413
+ getRequestLog(logId: string): Promise<{
2414
+ log: RequestLog;
2415
+ }>;
2416
+ listToolLogs(query?: {
2417
+ clientChannel?: string;
2418
+ clientName?: string;
2419
+ tenantId?: string;
2420
+ sessionId?: string;
2421
+ accountId?: string;
2422
+ requestLogId?: string;
2423
+ providerKey?: string;
2424
+ toolKey?: string;
2425
+ status?: string;
2426
+ cursor?: string;
2427
+ from?: string;
2428
+ to?: string;
2429
+ limit?: number;
2430
+ }): Promise<{
2431
+ logs: ToolExecutionLog[];
2432
+ nextCursor?: string | null;
2433
+ }>;
2434
+ getToolLog(logId: string): Promise<{
2435
+ log: ToolExecutionLog;
2436
+ }>;
2437
+ listTriggerLogs(query?: {
2438
+ tenantId?: string;
2439
+ accountId?: string;
2440
+ providerKey?: string;
2441
+ eventScope?: string;
2442
+ eventType?: string;
2443
+ externalEventId?: string;
2444
+ status?: string;
2445
+ cursor?: string;
2446
+ from?: string;
2447
+ to?: string;
2448
+ limit?: number;
2449
+ }): Promise<{
2450
+ events: TriggerEventLog[];
2451
+ logs?: TriggerEventLog[];
2452
+ nextCursor?: string | null;
2453
+ }>;
2454
+ getTriggerLog(logId: string): Promise<{
2455
+ event: TriggerEventLog;
2456
+ }>;
2457
+ listWebhookDeliveries(query?: {
2458
+ tenantId?: string;
2459
+ accountId?: string;
2460
+ providerKey?: string;
2461
+ eventScope?: string;
2462
+ externalEventId?: string;
2463
+ deliveryId?: string;
2464
+ rawEventId?: string;
2465
+ subscriptionId?: string;
2466
+ status?: string;
2467
+ cursor?: string;
2468
+ from?: string;
2469
+ to?: string;
2470
+ limit?: number;
2471
+ }): Promise<{
2472
+ deliveries: unknown[];
2473
+ logs?: unknown[];
2474
+ nextCursor?: string | null;
2475
+ }>;
2476
+ getWebhookDeliveryLog(deliveryId: string): Promise<{
2477
+ delivery: unknown;
2478
+ }>;
2479
+ listWorkbenchSessions(query?: {
2480
+ tenantId?: string;
2481
+ platformSessionId?: string;
2482
+ status?: string;
2483
+ limit?: number;
2484
+ }): Promise<{
2485
+ workbenchSessions: WorkbenchSession[];
2486
+ }>;
2487
+ getWorkbenchSession(workbenchSessionId: string): Promise<{
2488
+ workbenchSession: WorkbenchSession;
2489
+ }>;
2490
+ getWorkbenchUsage(workbenchSessionId: string): Promise<WorkbenchUsage>;
2491
+ listWorkbenchArtifacts(query?: {
2492
+ tenantId?: string;
2493
+ workbenchSessionId?: string;
2494
+ status?: string;
2495
+ limit?: number;
2496
+ }): Promise<{
2497
+ artifacts: WorkbenchArtifact[];
2498
+ }>;
2499
+ getWorkbenchArtifactDownloadUrl(artifactId: string): Promise<unknown>;
2500
+ downloadWorkbenchArtifact(artifactId: string): Promise<Response>;
2501
+ promoteWorkbenchArtifact(input: {
2502
+ sessionId: string;
2503
+ workbenchSessionId: string;
2504
+ path: string;
2505
+ label?: string | undefined;
2506
+ contentType?: string | undefined;
2507
+ metadata?: Record<string, unknown> | undefined;
2508
+ }): Promise<{
2509
+ workbenchSession: WorkbenchSession;
2510
+ artifact: WorkbenchArtifact;
2511
+ }>;
2512
+ deleteWorkbenchArtifact(input: {
2513
+ sessionId: string;
2514
+ workbenchSessionId: string;
2515
+ artifactId: string;
2516
+ path?: string | undefined;
2517
+ }): Promise<{
2518
+ workbenchSession: WorkbenchSession;
2519
+ artifact: WorkbenchArtifact;
2520
+ deleted: boolean;
2521
+ }>;
2522
+ listWorkbenchBudgets(query?: {
2523
+ tenantId?: string;
2524
+ workbenchSessionId?: string;
2525
+ status?: string;
2526
+ limit?: number;
2527
+ }): Promise<{
2528
+ budgetPolicies: WorkbenchBudgetPolicy[];
2529
+ }>;
2530
+ createWorkbenchBudget(input: Record<string, unknown>): Promise<{
2531
+ budgetPolicy: WorkbenchBudgetPolicy;
2532
+ }>;
2533
+ updateWorkbenchBudget(budgetPolicyId: string, patch: Record<string, unknown>): Promise<{
2534
+ budgetPolicy: WorkbenchBudgetPolicy;
2535
+ }>;
2536
+ deleteWorkbenchBudget(budgetPolicyId: string): Promise<{
2537
+ budgetPolicy: WorkbenchBudgetPolicy;
2538
+ }>;
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>;
2541
+ private mcpRequestAtPath;
2542
+ mcpRequestStream(input: Record<string, unknown>, options?: StacklinkMcpStreamOptions): Promise<unknown>;
2543
+ mcpSessionRequestStream(sessionId: string, input: Record<string, unknown>, options?: StacklinkMcpStreamOptions): Promise<unknown>;
2544
+ 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>;
2548
+ listKnowledgePacks(): Promise<KnowledgePackListResponse>;
2549
+ getKnowledgeCapabilities(input?: {
2550
+ sessionId?: string | undefined;
2551
+ packKey?: string | undefined;
2552
+ }): Promise<KnowledgeCapabilityResponse>;
2553
+ listKnowledgeReleases(packKey: string): Promise<KnowledgeReleaseListResponse>;
2554
+ subscribeKnowledgePack(packKey: string, input?: Record<string, unknown>): Promise<unknown>;
2555
+ searchKnowledge(input: KnowledgeSearchInput): Promise<KnowledgeSearchResponse>;
2556
+ lookupKnowledgeCitation(input: KnowledgeCitationLookupInput): Promise<KnowledgeCitationLookupResponse>;
2557
+ getKnowledgeAmendmentTrail(input: KnowledgeAmendmentTrailInput): Promise<KnowledgeAmendmentTrailResult>;
2558
+ verifyKnowledgeEvidence(input: KnowledgeEvidenceVerifyInput): Promise<KnowledgeEvidenceVerifyResult>;
2559
+ verifyKnowledgeAnswer(input: KnowledgeAnswerVerifyInput): Promise<KnowledgeAnswerVerifyResult>;
2560
+ getGstComplianceRule(input: GstComplianceRuleQueryInput): Promise<GstRuleQueryResponse>;
2561
+ getGstDueDateRule(input: GstFormRuleInput): Promise<GstSingleRuleResponse>;
2562
+ calculateGstDueDate(input: GstDueDateCalculationInput): Promise<GstCalculationResponse>;
2563
+ getGstLateFeeRule(input: GstLateFeeRuleInput): Promise<GstSingleRuleResponse>;
2564
+ calculateGstLateFee(input: GstLateFeeCalculationInput): Promise<GstCalculationResponse>;
2565
+ getGstInterestRule(input: GstInterestRuleInput): Promise<GstSingleRuleResponse>;
2566
+ calculateGstInterest(input: GstInterestCalculationInput): Promise<GstCalculationResponse>;
2567
+ lookupGstHsnSacRate(input: GstRateLookupInput): Promise<GstRateLookupResponse>;
2568
+ checkGstRcm(input: GstRcmCheckInput): Promise<GstRcmCheckResponse>;
2569
+ getGstNoticeRule(input: GstNoticeRuleInput): Promise<GstNoticeRuleResponse>;
2570
+ getGstAppealStageRule(input: GstAppealStageRuleInput): Promise<GstAppealStageRuleResponse>;
2571
+ private attachAbortSignalCancellation;
2572
+ request<T>(path: string, init?: StacklinkRequestInit): Promise<T>;
2573
+ requestRaw(path: string, init?: StacklinkRequestInit): Promise<Response>;
2574
+ cachedDiscoveryRequest<T>(cacheKey: string, ttlMs: number, control: StacklinkDiscoveryCacheControl | undefined, producer: () => Promise<T>): Promise<T>;
2575
+ discoveryCacheTtl(kind: 'toolsList' | 'toolkits' | 'schemas' | 'search'): number;
2576
+ private trimResponseCache;
2577
+ private readMcpEventStream;
2578
+ private requestHeaders;
2579
+ }
2580
+ export declare class StacklinkWebhooksClient {
2581
+ private readonly client;
2582
+ constructor(client: Stacklink);
2583
+ listEventTypes(): Promise<{
2584
+ eventTypes: {
2585
+ eventType: StacklinkWebhookEventType;
2586
+ }[];
2587
+ }>;
2588
+ get(): Promise<{
2589
+ webhook: StacklinkWebhookEndpoint;
2590
+ }>;
2591
+ update(input: {
2592
+ callbackUrl?: string | null;
2593
+ status?: 'active' | 'disabled';
2594
+ eventTypes?: StacklinkWebhookEventType[];
2595
+ }): Promise<{
2596
+ webhook: StacklinkWebhookEndpoint;
2597
+ signingSecret?: string;
2598
+ }>;
2599
+ rotateSecret(): Promise<{
2600
+ webhook: StacklinkWebhookEndpoint;
2601
+ signingSecret: string;
2602
+ }>;
2603
+ sendTest(input: {
2604
+ eventType: StacklinkWebhookEventType;
2605
+ }): Promise<StacklinkWebhookTestResult>;
2606
+ retryDelivery(deliveryId: string, input?: {
2607
+ force?: boolean;
2608
+ }): Promise<unknown>;
2609
+ redriveDeadLetters(input?: {
2610
+ limit?: number;
2611
+ force?: boolean;
2612
+ }): Promise<unknown>;
2613
+ replayEvent(eventId: string): Promise<unknown>;
2614
+ verifySignature(input: StacklinkWebhookSignatureInput): Promise<boolean>;
2615
+ }
2616
+ export declare class StacklinkTriggersClient {
2617
+ private readonly client;
2618
+ constructor(client: Stacklink);
2619
+ listTypes(query?: {
2620
+ providerKey?: string;
2621
+ }): Promise<{
2622
+ triggerTypes: TriggerType[];
2623
+ }>;
2624
+ listSubscriptions(query?: ListTriggerSubscriptionsInput): Promise<{
2625
+ subscriptions: TriggerSubscription[];
2626
+ }>;
2627
+ createSubscription(input: CreateTriggerSubscriptionInput): Promise<{
2628
+ subscription: TriggerSubscription;
2629
+ }>;
2630
+ getSubscription(subscriptionId: string): Promise<{
2631
+ subscription: TriggerSubscription;
2632
+ }>;
2633
+ updateSubscription(subscriptionId: string, patch: UpdateTriggerSubscriptionInput): Promise<{
2634
+ subscription: TriggerSubscription;
2635
+ }>;
2636
+ deleteSubscription(subscriptionId: string): Promise<{
2637
+ subscription: TriggerSubscription;
2638
+ }>;
2639
+ runPoll(input?: Record<string, unknown>): Promise<Record<string, unknown>>;
2640
+ runDeliveries(input?: Record<string, unknown>): Promise<Record<string, unknown>>;
2641
+ }
2642
+ export interface StacklinkMemoryAccessSelector {
2643
+ tenantId?: string | undefined;
2644
+ externalTenantId?: string | undefined;
2645
+ sessionId?: string | undefined;
2646
+ subjectType?: MemorySubjectRef['type'] | undefined;
2647
+ externalSubjectId?: string | undefined;
2648
+ }
2649
+ export declare class StacklinkMemoryClient {
2650
+ private readonly client;
2651
+ constructor(client: Stacklink);
2652
+ listPolicies(): Promise<JsonRecord>;
2653
+ createPolicy(input: MemoryProjectPolicyInput): Promise<JsonRecord>;
2654
+ getPolicy(policyKey?: string): Promise<JsonRecord>;
2655
+ policyHistory(policyKey?: string): Promise<JsonRecord>;
2656
+ previewPolicy(input: MemoryPolicyPreviewInput, policyKey?: string): Promise<JsonRecord>;
2657
+ updatePolicy(policyKey: string, input: MemoryProjectPolicyUpdateInput): Promise<JsonRecord>;
2658
+ deletePolicy(policyKey: string): Promise<JsonRecord>;
2659
+ ingest(input: MemoryIngestInput): Promise<JsonRecord>;
2660
+ ingestRich(input: MemoryRichIngestInput): Promise<JsonRecord>;
2661
+ getRichIngest(jobId: string): Promise<JsonRecord>;
2662
+ recordConversationTurn(input: MemoryConversationTurnInput): Promise<JsonRecord>;
2663
+ add(input: Omit<MemoryIngestInput, 'mode'>): Promise<JsonRecord>;
2664
+ search(input: MemorySearchInput): Promise<JsonRecord>;
2665
+ context(input: MemoryContextInput): Promise<JsonRecord>;
2666
+ list(input: StacklinkMemoryAccessSelector & {
2667
+ kind?: 'fact' | 'episode' | 'profile_item' | 'block' | undefined;
2668
+ sourceKind?: 'direct' | 'conversation' | 'document' | 'provider' | 'tool_execution' | 'artifact' | undefined;
2669
+ state?: 'current' | 'conflicted' | undefined;
2670
+ cursor?: string | undefined;
2671
+ limit?: number | undefined;
2672
+ }): Promise<JsonRecord>;
2673
+ listForgotten(input: StacklinkMemoryAccessSelector & {
2674
+ kind?: 'fact' | 'episode' | 'profile_item' | 'block' | undefined;
2675
+ sourceKind?: 'direct' | 'conversation' | 'document' | 'provider' | 'tool_execution' | 'artifact' | undefined;
2676
+ cursor?: string | undefined;
2677
+ limit?: number | undefined;
2678
+ }): Promise<JsonRecord>;
2679
+ get(memoryId: string, selector: StacklinkMemoryAccessSelector): Promise<JsonRecord>;
2680
+ history(memoryId: string, selector: StacklinkMemoryAccessSelector): Promise<JsonRecord>;
2681
+ update(memoryId: string, input: StacklinkMemoryAccessSelector & {
2682
+ patch: {
2683
+ content?: string | undefined;
2684
+ title?: string | null | undefined;
2685
+ memoryType?: 'preference' | 'decision' | 'commitment' | 'goal' | 'constraint' | 'relationship' | 'durable_fact' | undefined;
2686
+ sensitivityClass?: 'standard' | 'personal' | 'restricted' | undefined;
2687
+ restrictedDataClasses?: Array<'health' | 'biometric' | 'government_identity' | 'precise_location' | 'protected_trait' | 'minor' | 'detailed_personal_financial'> | undefined;
2688
+ topicTags?: string[] | undefined;
2689
+ language?: string | null | undefined;
2690
+ validFrom?: string | null | undefined;
2691
+ validTo?: string | null | undefined;
2692
+ state?: 'current' | 'conflicted' | undefined;
2693
+ reason?: string | undefined;
2694
+ metadata?: JsonRecord | undefined;
2695
+ };
2696
+ }): Promise<JsonRecord>;
2697
+ forget(memoryId: string, input: StacklinkMemoryAccessSelector & {
2698
+ reason?: string | undefined;
2699
+ }): Promise<JsonRecord>;
2700
+ restore(memoryId: string, input: StacklinkMemoryAccessSelector & {
2701
+ reason?: string | undefined;
2702
+ }): Promise<JsonRecord>;
2703
+ erase(memoryId: string, input: StacklinkMemoryAccessSelector & {
2704
+ reason?: string | undefined;
2705
+ }): Promise<JsonRecord>;
2706
+ previewErasure(memoryId: string, selector: StacklinkMemoryAccessSelector): Promise<JsonRecord>;
2707
+ getErasure(erasureJobId: string): Promise<JsonRecord>;
2708
+ profile(selector: StacklinkMemoryAccessSelector): Promise<JsonRecord>;
2709
+ subjectProfile(subjectId: string, selector: StacklinkMemoryAccessSelector): Promise<JsonRecord>;
2710
+ listSubjects(input: {
2711
+ tenantId?: string | undefined;
2712
+ externalTenantId?: string | undefined;
2713
+ type?: MemorySubjectRef['type'] | undefined;
2714
+ status?: 'active' | 'erased' | undefined;
2715
+ cursor?: string | undefined;
2716
+ limit?: number | undefined;
2717
+ }): Promise<JsonRecord>;
2718
+ eraseSubject(subjectId: string, input: {
2719
+ tenantId?: string | undefined;
2720
+ externalTenantId?: string | undefined;
2721
+ reason?: string | undefined;
2722
+ }): Promise<JsonRecord>;
2723
+ createBlock(input: {
2724
+ tenantId?: string | undefined;
2725
+ externalTenantId?: string | undefined;
2726
+ sessionId?: string | undefined;
2727
+ subjects?: MemorySubjectRef[] | undefined;
2728
+ title: string;
2729
+ content: string;
2730
+ access?: 'read_only' | 'editable' | undefined;
2731
+ priority?: number | undefined;
2732
+ required?: boolean | undefined;
2733
+ metadata?: JsonRecord | undefined;
2734
+ }): Promise<JsonRecord>;
2735
+ listBlocks(selector: StacklinkMemoryAccessSelector): Promise<JsonRecord>;
2736
+ updateBlock(blockId: string, input: StacklinkMemoryAccessSelector & {
2737
+ patch: {
2738
+ title?: string | undefined;
2739
+ content?: string | undefined;
2740
+ access?: 'read_only' | 'editable' | undefined;
2741
+ priority?: number | undefined;
2742
+ required?: boolean | undefined;
2743
+ metadata?: JsonRecord | undefined;
2744
+ };
2745
+ }): Promise<JsonRecord>;
2746
+ revokeBlock(blockId: string, selector: StacklinkMemoryAccessSelector): Promise<JsonRecord>;
2747
+ queryGraph(input: MemoryGraphQueryInput): Promise<JsonRecord>;
2748
+ createSource(input: MemorySourceBindingInput): Promise<JsonRecord>;
2749
+ previewConnectedSource(input: MemoryConnectedSourcePreviewInput): Promise<JsonRecord>;
2750
+ createConnectedSource(input: MemoryConnectedSourceInput): Promise<JsonRecord>;
2751
+ listSources(input: {
2752
+ tenantId?: string | undefined;
2753
+ externalTenantId?: string | undefined;
2754
+ status?: 'active' | 'paused' | 'degraded' | 'failed' | undefined;
2755
+ }): Promise<JsonRecord>;
2756
+ getSource(bindingId: string): Promise<JsonRecord>;
2757
+ setSourceStatus(bindingId: string, status: 'active' | 'paused'): Promise<JsonRecord>;
2758
+ updateSource(bindingId: string, input: MemorySourceBindingUpdateInput): Promise<JsonRecord>;
2759
+ deleteSource(bindingId: string): Promise<JsonRecord>;
2760
+ replaySourceItem(bindingId: string, itemId: string): Promise<JsonRecord>;
2761
+ listSourceDeliveries(input?: {
2762
+ tenantId?: string | undefined;
2763
+ status?: 'pending' | 'processing' | 'retry' | 'completed' | 'dead_letter' | undefined;
2764
+ limit?: number | undefined;
2765
+ }): Promise<JsonRecord>;
2766
+ replaySourceDelivery(deliveryId: string): Promise<JsonRecord>;
2767
+ export(input: MemoryExportInput): Promise<JsonRecord>;
2768
+ getExport(exportId: string): Promise<JsonRecord>;
2769
+ dataManagement(input?: {
2770
+ tenantId?: string | undefined;
2771
+ }): Promise<JsonRecord>;
2772
+ createLegalHold(input: MemoryLegalHoldInput): Promise<JsonRecord>;
2773
+ releaseLegalHold(holdId: string): Promise<JsonRecord>;
2774
+ }
2775
+ export declare class StacklinkSessionsClient {
2776
+ private readonly client;
2777
+ constructor(client: Stacklink);
2778
+ create(input: CreateStacklinkSessionInput): Promise<ToolRouterSession>;
2779
+ use(sessionId: string): Promise<ToolRouterSession>;
2780
+ list(query?: ListStacklinkSessionsInput): Promise<ListStacklinkSessionsResponse>;
2781
+ get(sessionId: string): Promise<{
2782
+ session: StacklinkSessionData;
2783
+ }>;
2784
+ update(sessionId: string, patch: UpdateStacklinkSessionInput): Promise<{
2785
+ session: StacklinkSessionData;
2786
+ }>;
2787
+ close(sessionId: string): Promise<{
2788
+ session: StacklinkSessionData;
2789
+ }>;
2790
+ fail(sessionId: string, input?: {
2791
+ metadata?: Record<string, unknown>;
2792
+ }): Promise<{
2793
+ session: StacklinkSessionData;
2794
+ }>;
2795
+ metaTools(sessionId: string): Promise<{
2796
+ contractVersion: string;
2797
+ tools: StacklinkSessionMetaToolDefinition[];
2798
+ toolRouterSession?: StacklinkSessionData;
2799
+ }>;
2800
+ toolkits(sessionId: string): Promise<{
2801
+ toolkits: ProjectProvider[];
2802
+ }>;
2803
+ streamEvents(sessionId: string, input?: {
2804
+ after?: string;
2805
+ eventTypes?: string[];
2806
+ limit?: number;
2807
+ pollIntervalMs?: number;
2808
+ }): Promise<Response>;
2809
+ listRouterFacts(sessionId: string, query?: {
2810
+ kind?: string;
2811
+ limit?: number;
2812
+ cursor?: string;
2813
+ }): Promise<{
2814
+ entries: unknown[];
2815
+ nextCursor?: string | null;
2816
+ kinds?: {
2817
+ kind: string;
2818
+ count: number;
2819
+ }[];
2820
+ }>;
2821
+ listConnectionEvents(sessionId: string): Promise<{
2822
+ events: unknown[];
2823
+ }>;
2824
+ workbench(sessionId: string): Promise<{
2825
+ workbenchSessions: WorkbenchSession[];
2826
+ artifacts: WorkbenchArtifact[];
2827
+ usage: unknown[];
2828
+ cost: unknown[];
2829
+ }>;
2830
+ }
2831
+ export declare class StacklinkLogsClient {
2832
+ private readonly client;
2833
+ constructor(client: Stacklink);
2834
+ summary(): Promise<{
2835
+ summary: LogSummary;
2836
+ }>;
2837
+ listRequests(query?: Parameters<Stacklink['listRequestLogs']>[0]): Promise<{
2838
+ logs: RequestLog[];
2839
+ nextCursor?: string | null;
2840
+ }>;
2841
+ getRequest(logId: string): Promise<{
2842
+ log: RequestLog;
2843
+ }>;
2844
+ listTools(query?: Parameters<Stacklink['listToolLogs']>[0]): Promise<{
2845
+ logs: ToolExecutionLog[];
2846
+ nextCursor?: string | null;
2847
+ }>;
2848
+ getTool(logId: string): Promise<{
2849
+ log: ToolExecutionLog;
2850
+ }>;
2851
+ listTriggers(query?: Parameters<Stacklink['listTriggerLogs']>[0]): Promise<{
2852
+ events: TriggerEventLog[];
2853
+ logs?: TriggerEventLog[];
2854
+ nextCursor?: string | null;
2855
+ }>;
2856
+ getTrigger(logId: string): Promise<{
2857
+ event: TriggerEventLog;
2858
+ }>;
2859
+ listWebhookDeliveries(query?: Parameters<Stacklink['listWebhookDeliveries']>[0]): Promise<{
2860
+ deliveries: unknown[];
2861
+ logs?: unknown[];
2862
+ nextCursor?: string | null;
2863
+ }>;
2864
+ getWebhookDelivery(deliveryId: string): Promise<{
2865
+ delivery: unknown;
2866
+ }>;
2867
+ retryWebhookDelivery(deliveryId: string, input?: {
2868
+ force?: boolean;
2869
+ }): Promise<unknown>;
2870
+ redriveDeadLetters(input?: {
2871
+ limit?: number;
2872
+ force?: boolean;
2873
+ }): Promise<unknown>;
2874
+ replayProviderEvent(eventId: string): Promise<unknown>;
2875
+ }
2876
+ export declare class StacklinkApiKeysClient {
2877
+ private readonly client;
2878
+ constructor(client: Stacklink);
2879
+ create(input: CreateStacklinkApiKeyInput): Promise<{
2880
+ apiKey: StacklinkApiKey;
2881
+ }>;
2882
+ delete(apiKeyId: string): Promise<{
2883
+ apiKey: StacklinkApiKey;
2884
+ }>;
2885
+ }
2886
+ export declare class StacklinkBillingClient {
2887
+ private readonly client;
2888
+ constructor(client: Stacklink);
2889
+ getSubscription(): Promise<StacklinkUsageSummary>;
2890
+ listPlans(): Promise<{
2891
+ plans: StacklinkBillingPlan[];
2892
+ }>;
2893
+ getUsage(): Promise<StacklinkUsageSummary>;
2894
+ listUsageEvents(query?: {
2895
+ sourceType?: string | undefined;
2896
+ operationClass?: StacklinkUsageOperationClass | undefined;
2897
+ limit?: number | undefined;
2898
+ }): Promise<{
2899
+ events: StacklinkUsageMeterEvent[];
2900
+ }>;
2901
+ createCheckout(input: {
2902
+ planKey: string;
2903
+ billingInterval?: StacklinkBillingInterval | undefined;
2904
+ successUrl?: string | undefined;
2905
+ cancelUrl?: string | undefined;
2906
+ }): Promise<StacklinkBillingCheckoutSession>;
2907
+ createPortal(input?: {
2908
+ returnUrl?: string | undefined;
2909
+ }): Promise<StacklinkBillingPortalSession>;
2910
+ setWorkspacePlanForProject(projectId: string, input: {
2911
+ planKey: string;
2912
+ status?: string | undefined;
2913
+ metadata?: JsonRecord | undefined;
2914
+ }): Promise<{
2915
+ subscription: StacklinkWorkspaceSubscription;
2916
+ usage: StacklinkUsageSummary;
2917
+ }>;
2918
+ }
2919
+ export declare class StacklinkConnectedAccountsClient {
2920
+ private readonly client;
2921
+ constructor(client: Stacklink);
2922
+ list(tenantId: string): Promise<{
2923
+ connections: ConnectedAccount[];
2924
+ }>;
2925
+ create(input: Record<string, unknown>): Promise<{
2926
+ account: ConnectedAccount;
2927
+ }>;
2928
+ get(accountId: string): Promise<{
2929
+ account: ConnectedAccount;
2930
+ }>;
2931
+ listTools(accountId: string, input?: {
2932
+ includePlanned?: boolean | undefined;
2933
+ toolKeys?: string[] | undefined;
2934
+ }): Promise<{
2935
+ contract: string;
2936
+ sessionId: string;
2937
+ tools: ProviderTool[];
2938
+ meta?: unknown;
2939
+ }>;
2940
+ listResources(accountId: string): Promise<ConnectedAccountResourcesResponse>;
2941
+ refreshResources(accountId: string): Promise<ConnectedAccountResourcesResponse>;
2942
+ resolveResource(accountId: string, input: ConnectedAccountResourceResolveInput): Promise<{
2943
+ accountId: string;
2944
+ providerKey: string;
2945
+ resource: ConnectedAccountResource;
2946
+ }>;
2947
+ update(accountId: string, patch: Record<string, unknown>): Promise<{
2948
+ account: ConnectedAccount;
2949
+ }>;
2950
+ enable(accountId: string): Promise<{
2951
+ account: ConnectedAccount;
2952
+ }>;
2953
+ disable(accountId: string): Promise<{
2954
+ account: ConnectedAccount;
2955
+ }>;
2956
+ refresh(accountId: string): Promise<{
2957
+ account: ConnectedAccount;
2958
+ }>;
2959
+ validate(accountId: string): Promise<unknown>;
2960
+ delete(accountId: string): Promise<{
2961
+ account: ConnectedAccount;
2962
+ }>;
2963
+ }
2964
+ export declare class StacklinkAuthConfigsClient {
2965
+ private readonly client;
2966
+ constructor(client: Stacklink);
2967
+ list(query?: {
2968
+ providerKey?: string;
2969
+ includeDisabled?: boolean;
2970
+ }): Promise<{
2971
+ authConfigs: AuthConfig[];
2972
+ }>;
2973
+ create(input: Record<string, unknown>): Promise<{
2974
+ authConfig: AuthConfig;
2975
+ }>;
2976
+ get(authConfigId: string): Promise<{
2977
+ authConfig: AuthConfig;
2978
+ }>;
2979
+ update(authConfigId: string, patch: Record<string, unknown>): Promise<{
2980
+ authConfig: AuthConfig;
2981
+ }>;
2982
+ enable(authConfigId: string): Promise<{
2983
+ authConfig: AuthConfig;
2984
+ }>;
2985
+ disable(authConfigId: string): Promise<{
2986
+ authConfig: AuthConfig;
2987
+ }>;
2988
+ delete(authConfigId: string): Promise<{
2989
+ authConfig: AuthConfig;
2990
+ }>;
2991
+ }
2992
+ export declare class StacklinkToolkitsClient {
2993
+ private readonly client;
2994
+ 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
+ }>;
3011
+ }
3012
+ export declare class StacklinkProviderToolsClient {
3013
+ private readonly client;
3014
+ constructor(client: Stacklink);
3015
+ search(input: Record<string, unknown>): Promise<{
3016
+ tools: ProviderTool[];
3017
+ queries?: unknown[];
3018
+ meta?: unknown;
3019
+ }>;
3020
+ schemas(input: {
3021
+ sessionId: string;
3022
+ toolKeys: string[];
3023
+ includePlanned?: boolean | undefined;
3024
+ }): Promise<{
3025
+ tools: ProviderTool[];
3026
+ }>;
3027
+ runtimeContracts(input: {
3028
+ sessionId: string;
3029
+ toolkitKeys?: string[] | undefined;
3030
+ toolKeys?: string[] | undefined;
3031
+ includePlanned?: boolean | undefined;
3032
+ }): Promise<{
3033
+ contract: string;
3034
+ sessionId: string;
3035
+ tools: ProviderTool[];
3036
+ meta?: unknown;
3037
+ }>;
3038
+ execute(input: Record<string, unknown>): Promise<Record<string, unknown>>;
3039
+ executeBatch(input: Record<string, unknown>): Promise<Record<string, unknown>>;
3040
+ }
3041
+ export declare class StacklinkSessionMemoryClient {
3042
+ private readonly memoryClient;
3043
+ private readonly sessionId;
3044
+ constructor(memoryClient: StacklinkMemoryClient, sessionId: string);
3045
+ add(input: {
3046
+ subjects?: MemorySubjectRef[] | undefined;
3047
+ kind?: 'fact' | 'episode' | 'profile_item' | 'block' | undefined;
3048
+ content: string;
3049
+ title?: string | undefined;
3050
+ memoryType?: 'preference' | 'decision' | 'commitment' | 'goal' | 'constraint' | 'relationship' | 'durable_fact' | undefined;
3051
+ sensitivityClass?: 'standard' | 'personal' | 'restricted' | undefined;
3052
+ restrictedDataClasses?: Array<'health' | 'biometric' | 'government_identity' | 'precise_location' | 'protected_trait' | 'minor' | 'detailed_personal_financial'> | undefined;
3053
+ topicTags?: string[] | undefined;
3054
+ language?: string | undefined;
3055
+ source?: MemoryIngestInput['source'] | undefined;
3056
+ idempotencyKey?: string | undefined;
3057
+ policyKey?: string | undefined;
3058
+ consent?: MemoryIngestInput['consent'] | undefined;
3059
+ metadata?: JsonRecord | undefined;
3060
+ occurredAt?: string | undefined;
3061
+ validFrom?: string | undefined;
3062
+ validTo?: string | undefined;
3063
+ }): Promise<JsonRecord>;
3064
+ ingest(input: Omit<MemoryIngestInput, 'tenantId' | 'externalTenantId' | 'sessionId'>): Promise<JsonRecord>;
3065
+ ingestRich(input: Omit<MemoryRichIngestInput, 'tenantId' | 'externalTenantId' | 'sessionId'>): Promise<JsonRecord>;
3066
+ getRichIngest(jobId: string): Promise<JsonRecord>;
3067
+ recordConversationTurn(input: Omit<MemoryConversationTurnInput, 'sessionId'>): Promise<JsonRecord>;
3068
+ search(input: Omit<MemorySearchInput, 'tenantId' | 'externalTenantId' | 'sessionId'>): Promise<JsonRecord>;
3069
+ context(input: Omit<MemoryContextInput, 'tenantId' | 'externalTenantId' | 'sessionId'>): Promise<JsonRecord>;
3070
+ recall(input: Omit<MemoryContextInput, 'tenantId' | 'externalTenantId' | 'sessionId'>): Promise<JsonRecord>;
3071
+ profile(): Promise<JsonRecord>;
3072
+ get(memoryId: string): Promise<JsonRecord>;
3073
+ history(memoryId: string): Promise<JsonRecord>;
3074
+ update(memoryId: string, patch: Parameters<StacklinkMemoryClient['update']>[1]['patch']): Promise<JsonRecord>;
3075
+ forget(memoryId: string, reason?: string): Promise<JsonRecord>;
3076
+ restore(memoryId: string, reason?: string): Promise<JsonRecord>;
3077
+ }
3078
+ export declare class StacklinkWorkbenchRun {
3079
+ private readonly client;
3080
+ private readonly platformSessionId;
3081
+ readonly response: WorkbenchExecutionResponse;
3082
+ readonly executionId: string;
3083
+ readonly executionKind: 'workbench_code' | 'workbench_bash';
3084
+ constructor(client: Stacklink, platformSessionId: string, response: WorkbenchExecutionResponse);
3085
+ events(input?: {
3086
+ pollIntervalMs?: number | undefined;
3087
+ limit?: number | undefined;
3088
+ }): AsyncGenerator<unknown, void, unknown>;
3089
+ wait(input?: {
3090
+ waitTimeoutMs?: number | undefined;
3091
+ pollIntervalMs?: number | undefined;
3092
+ }): Promise<Record<string, unknown>>;
3093
+ cancel(reason?: string): Promise<Record<string, unknown>>;
3094
+ }
3095
+ export declare class StacklinkWorkbenchFiles {
3096
+ private readonly client;
3097
+ private readonly platformSessionId;
3098
+ private readonly workbenchSessionId;
3099
+ constructor(client: Stacklink, platformSessionId: string, workbenchSessionId: () => Promise<string>);
3100
+ list(): Promise<{
3101
+ workbenchSession: WorkbenchSession;
3102
+ files: WorkbenchFile[];
3103
+ }>;
3104
+ read(path: string): Promise<{
3105
+ workbenchSession: WorkbenchSession;
3106
+ file: WorkbenchFile;
3107
+ }>;
3108
+ upload(input: {
3109
+ path: string;
3110
+ content: string | Uint8Array;
3111
+ contentType?: string | undefined;
3112
+ metadata?: Record<string, unknown> | undefined;
3113
+ }): Promise<{
3114
+ workbenchSession: WorkbenchSession;
3115
+ file: WorkbenchFile;
3116
+ }>;
3117
+ uploadLarge(input: {
3118
+ path: string;
3119
+ content: string | Uint8Array;
3120
+ contentType?: string | undefined;
3121
+ metadata?: Record<string, unknown> | undefined;
3122
+ }): Promise<{
3123
+ file: WorkbenchFile;
3124
+ }>;
3125
+ download(path: string): Promise<Response>;
3126
+ delete(path: string): Promise<{
3127
+ workbenchSession: WorkbenchSession;
3128
+ file: WorkbenchFile;
3129
+ deleted: true;
3130
+ }>;
3131
+ }
3132
+ export declare class StacklinkWorkbenchRuns {
3133
+ private readonly client;
3134
+ private readonly platformSessionId;
3135
+ private readonly workbenchSessionId;
3136
+ constructor(client: Stacklink, platformSessionId: string, workbenchSessionId: () => Promise<string>);
3137
+ list(seriesId?: string, cursor?: string, limit?: number): Promise<{
3138
+ runDefinitions: WorkbenchRunDefinition[];
3139
+ limit: number;
3140
+ hasMore: boolean;
3141
+ nextCursor: string | null;
3142
+ }>;
3143
+ get(runDefinitionId: string): Promise<{
3144
+ runDefinition: WorkbenchRunDefinition;
3145
+ }>;
3146
+ update(runDefinitionId: string, input: {
3147
+ name?: string | undefined;
3148
+ description?: string | null | undefined;
3149
+ versionReason?: string | null | undefined;
3150
+ }): Promise<{
3151
+ runDefinition: WorkbenchRunDefinition;
3152
+ }>;
3153
+ save(input: {
3154
+ executionId: string;
3155
+ seriesId?: string | undefined;
3156
+ name: string;
3157
+ description?: string | undefined;
3158
+ metadata?: Record<string, unknown> | undefined;
3159
+ }): Promise<{
3160
+ runDefinition: WorkbenchRunDefinition;
3161
+ }>;
3162
+ replay(runDefinitionId: string, input: {
3163
+ background?: boolean | undefined;
3164
+ timeoutMs?: number | undefined;
3165
+ environmentMode?: WorkbenchReplayEnvironmentMode | undefined;
3166
+ idempotencyKey: string;
3167
+ }): Promise<WorkbenchRunReplayResponse>;
3168
+ publish(runDefinitionId: string, expectedPublishedVersion: number | null): Promise<{
3169
+ runDefinition: WorkbenchRunDefinition;
3170
+ }>;
3171
+ rollback(runDefinitionId: string, expectedPublishedVersion: number | null): Promise<{
3172
+ runDefinition: WorkbenchRunDefinition;
3173
+ }>;
3174
+ }
3175
+ export declare class StacklinkWorkbenchArtifacts {
3176
+ private readonly client;
3177
+ private readonly platformSessionId;
3178
+ private readonly workbenchSessionId;
3179
+ constructor(client: Stacklink, platformSessionId: string, workbenchSessionId: () => Promise<string>);
3180
+ list(): Promise<{
3181
+ artifacts: WorkbenchArtifact[];
3182
+ }>;
3183
+ promote(input: {
3184
+ path: string;
3185
+ label?: string | undefined;
3186
+ contentType?: string | undefined;
3187
+ metadata?: Record<string, unknown> | undefined;
3188
+ }): Promise<{
3189
+ workbenchSession: WorkbenchSession;
3190
+ artifact: WorkbenchArtifact;
3191
+ }>;
3192
+ downloadUrl(artifactId: string): Promise<unknown>;
3193
+ download(artifactId: string): Promise<Response>;
3194
+ delete(artifactId: string, path?: string): Promise<{
3195
+ workbenchSession: WorkbenchSession;
3196
+ artifact: WorkbenchArtifact;
3197
+ deleted: boolean;
3198
+ }>;
3199
+ }
3200
+ export declare class StacklinkSessionSandbox {
3201
+ private readonly client;
3202
+ private readonly platformSessionId;
3203
+ readonly files: StacklinkWorkbenchFiles;
3204
+ readonly runs: StacklinkWorkbenchRuns;
3205
+ readonly artifacts: StacklinkWorkbenchArtifacts;
3206
+ private activeWorkbenchSessionId;
3207
+ constructor(client: Stacklink, platformSessionId: string);
3208
+ use(workbenchSessionId?: string, input?: {
3209
+ createNew?: boolean | undefined;
3210
+ metadata?: Record<string, unknown> | undefined;
3211
+ }): Promise<{
3212
+ workbenchSession: WorkbenchSession;
3213
+ reused: boolean;
3214
+ }>;
3215
+ run(input: WorkbenchRunCodeInput, options?: StacklinkRequestOptions): Promise<StacklinkWorkbenchRun>;
3216
+ bash(input: WorkbenchRunBashInput, options?: StacklinkRequestOptions): Promise<StacklinkWorkbenchRun>;
3217
+ destroy(): Promise<Record<string, unknown>>;
3218
+ delete(): Promise<WorkbenchSessionDeleteReceipt>;
3219
+ private ensureWorkbenchSession;
3220
+ }
3221
+ export declare class ToolRouterSession {
3222
+ private readonly client;
3223
+ readonly id: string;
3224
+ readonly tenantId: string;
3225
+ readonly mcp?: StacklinkSessionMcpDescriptor | undefined;
3226
+ readonly memory: StacklinkSessionMemoryClient;
3227
+ readonly sandbox: StacklinkSessionSandbox;
3228
+ private contractVersion;
3229
+ private toolDefinitions;
3230
+ constructor(client: Stacklink, id: string, tenantId: string, mcp?: StacklinkSessionMcpDescriptor | undefined, contractVersion?: string, toolDefinitions?: StacklinkSessionMetaToolDefinition[]);
3231
+ get(): Promise<{
3232
+ session: StacklinkSessionData;
3233
+ }>;
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>;
3237
+ mcpConnection(): StacklinkSessionMcpConnection;
3238
+ update(patch: UpdateStacklinkSessionInput): Promise<{
3239
+ session: StacklinkSessionData;
3240
+ }>;
3241
+ toolContractVersion(): string;
3242
+ toolRegistry(): StacklinkSessionMetaToolDefinition[];
3243
+ close(): Promise<{
3244
+ session: StacklinkSessionData;
3245
+ }>;
3246
+ routerFacts(query?: {
3247
+ kind?: string;
3248
+ limit?: number;
3249
+ cursor?: string;
3250
+ }): Promise<{
3251
+ entries: unknown[];
3252
+ nextCursor?: string | null;
3253
+ kinds?: {
3254
+ kind: string;
3255
+ count: number;
3256
+ }[];
3257
+ }>;
3258
+ connectionEvents(): Promise<{
3259
+ events: unknown[];
3260
+ }>;
3261
+ trace(query?: {
3262
+ cursor?: string;
3263
+ limit?: number;
3264
+ }): Promise<{
3265
+ sessionId: string;
3266
+ selectedConnectedAccountIds: string[];
3267
+ entries: unknown[];
3268
+ nextCursor: string | null;
3269
+ }>;
3270
+ configHistory(query?: {
3271
+ beforeVersion?: number;
3272
+ limit?: number;
3273
+ }): Promise<{
3274
+ sessionId: string;
3275
+ currentVersion: number | null;
3276
+ versions: {
3277
+ version: number;
3278
+ config: Record<string, unknown>;
3279
+ changeMetadata: Record<string, unknown>;
3280
+ createdAt: string;
3281
+ }[];
3282
+ nextBeforeVersion: number | null;
3283
+ }>;
3284
+ workbenchActivity(): Promise<{
3285
+ workbenchSessions: WorkbenchSession[];
3286
+ artifacts: WorkbenchArtifact[];
3287
+ usage: unknown[];
3288
+ cost: unknown[];
3289
+ }>;
3290
+ toolkits(): Promise<ProjectProvider[]>;
3291
+ authorize(providerKey: string, input?: {
3292
+ callbackUrl?: string;
3293
+ authConfigId?: string;
3294
+ authMode?: string;
3295
+ metadata?: Record<string, unknown>;
3296
+ }): Promise<StacklinkConnectionRequest>;
3297
+ waitForConnections(connectionRequestIds: string[], timeoutMs?: number, intervalMs?: number): Promise<{
3298
+ status: "completed";
3299
+ connectionRequests: ConnectionRequestResponse[];
3300
+ }>;
3301
+ connectedAccounts(): Promise<ConnectedAccount[]>;
3302
+ getConnectedAccount(accountId: string): Promise<ConnectedAccount>;
3303
+ updateConnectedAccount(accountId: string, patch: Record<string, unknown>): Promise<ConnectedAccount>;
3304
+ enableConnectedAccount(accountId: string): Promise<ConnectedAccount>;
3305
+ disableConnectedAccount(accountId: string): Promise<ConnectedAccount>;
3306
+ refreshConnectedAccount(accountId: string): Promise<ConnectedAccount>;
3307
+ validateConnectedAccount(accountId: string): Promise<unknown>;
3308
+ deleteConnectedAccount(accountId: string): Promise<ConnectedAccount>;
3309
+ connectedAccountSecrets(accountId: string): Promise<unknown[]>;
3310
+ connectedAccountResources(accountId: string): Promise<ConnectedAccountResourcesResponse>;
3311
+ 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>;
3333
+ searchKnowledge(input?: Omit<KnowledgeSearchInput, 'sessionId'>): Promise<KnowledgeSearchResponse>;
3334
+ getKnowledgeCapabilities(input?: {
3335
+ packKey?: string | undefined;
3336
+ }): Promise<KnowledgeCapabilityResponse>;
3337
+ lookupKnowledgeCitation(input?: Omit<KnowledgeCitationLookupInput, 'sessionId'>): Promise<KnowledgeCitationLookupResponse>;
3338
+ getKnowledgeAmendmentTrail(input?: Omit<KnowledgeAmendmentTrailInput, 'sessionId'>): Promise<KnowledgeAmendmentTrailResult>;
3339
+ verifyKnowledgeEvidence(input?: Omit<KnowledgeEvidenceVerifyInput, 'sessionId'>): Promise<KnowledgeEvidenceVerifyResult>;
3340
+ verifyKnowledgeAnswer(input: Omit<KnowledgeAnswerVerifyInput, 'sessionId'>): Promise<KnowledgeAnswerVerifyResult>;
3341
+ getGstComplianceRule(input?: Omit<GstComplianceRuleQueryInput, 'sessionId'>): Promise<GstRuleQueryResponse>;
3342
+ getGstDueDateRule(input: Omit<GstFormRuleInput, 'sessionId'>): Promise<GstSingleRuleResponse>;
3343
+ calculateGstDueDate(input: Omit<GstDueDateCalculationInput, 'sessionId'>): Promise<GstCalculationResponse>;
3344
+ getGstLateFeeRule(input: Omit<GstLateFeeRuleInput, 'sessionId'>): Promise<GstSingleRuleResponse>;
3345
+ calculateGstLateFee(input: Omit<GstLateFeeCalculationInput, 'sessionId'>): Promise<GstCalculationResponse>;
3346
+ getGstInterestRule(input?: Omit<GstInterestRuleInput, 'sessionId'>): Promise<GstSingleRuleResponse>;
3347
+ calculateGstInterest(input: Omit<GstInterestCalculationInput, 'sessionId'>): Promise<GstCalculationResponse>;
3348
+ lookupGstHsnSacRate(input: Omit<GstRateLookupInput, 'sessionId'>): Promise<GstRateLookupResponse>;
3349
+ checkGstRcm(input: Omit<GstRcmCheckInput, 'sessionId'>): Promise<GstRcmCheckResponse>;
3350
+ getGstNoticeRule(input: Omit<GstNoticeRuleInput, 'sessionId'>): Promise<GstNoticeRuleResponse>;
3351
+ 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>>;
3354
+ runWorkbench(input: Omit<Record<string, unknown>, 'sessionId'>, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
3355
+ destroyWorkbenchSession(input: {
3356
+ workbenchSessionId: string;
3357
+ }, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
3358
+ deleteWorkbenchSession(input: {
3359
+ workbenchSessionId: string;
3360
+ }): Promise<WorkbenchSessionDeleteReceipt>;
3361
+ runWorkbenchBash(input: Omit<Record<string, unknown>, 'sessionId'>, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
3362
+ listExecutions(input?: {
3363
+ executionKind?: StacklinkExecutionKind | undefined;
3364
+ workbenchSessionId?: string | undefined;
3365
+ status?: string | undefined;
3366
+ cursor?: string | undefined;
3367
+ limit?: number | undefined;
3368
+ }, options?: StacklinkRequestOptions): Promise<{
3369
+ executions: unknown[];
3370
+ limit: number;
3371
+ nextCursor: string | null;
3372
+ liveCount: number;
3373
+ }>;
3374
+ getExecution(input: {
3375
+ executionKind: StacklinkExecutionKind;
3376
+ executionId: string;
3377
+ includeEvents?: boolean | undefined;
3378
+ eventLimit?: number | undefined;
3379
+ }, options?: StacklinkRequestOptions): Promise<{
3380
+ execution: unknown;
3381
+ events?: unknown[] | undefined;
3382
+ limit?: number | undefined;
3383
+ hasMore?: boolean | undefined;
3384
+ nextCursor?: string | null | undefined;
3385
+ }>;
3386
+ readExecutionEvents(input: {
3387
+ executionKind: StacklinkExecutionKind;
3388
+ executionId: string;
3389
+ afterSequence?: string | number | bigint | undefined;
3390
+ limit?: number | undefined;
3391
+ }, options?: StacklinkRequestOptions): Promise<{
3392
+ events: unknown[];
3393
+ limit: number;
3394
+ hasMore: boolean;
3395
+ nextCursor: string | null;
3396
+ }>;
3397
+ waitForExecution(input: {
3398
+ executionKind: StacklinkExecutionKind;
3399
+ executionId: string;
3400
+ waitTimeoutMs?: number | undefined;
3401
+ pollIntervalMs?: number | undefined;
3402
+ }, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
3403
+ cancelExecution(input: {
3404
+ executionKind: StacklinkExecutionKind;
3405
+ executionId: string;
3406
+ reason?: string | undefined;
3407
+ }, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
3408
+ streamEvents(input?: {
3409
+ after?: string;
3410
+ eventTypes?: string[];
3411
+ limit?: number;
3412
+ pollIntervalMs?: number;
3413
+ }): Promise<Response>;
3414
+ tools(): StacklinkTools;
3415
+ }
3416
+ export { ToolRouterSession as StacklinkSession };
3417
+ export declare class StacklinkConnectionRequest {
3418
+ private readonly client;
3419
+ readonly id: string;
3420
+ readonly providerKey: string;
3421
+ readonly status: string;
3422
+ readonly phase: ConnectionRequestPhase | undefined;
3423
+ readonly nextAction: ConnectionRequestNextAction | undefined;
3424
+ readonly redirectUrl: string;
3425
+ readonly expiresAt: string;
3426
+ readonly authModes: string[];
3427
+ readonly authRequirements: AuthRequirement[];
3428
+ constructor(client: Stacklink, input: ConnectionAuthorizationResponse);
3429
+ getStatus(): Promise<ConnectionRequestResponse>;
3430
+ toJSON(): {
3431
+ id: string;
3432
+ providerKey: string;
3433
+ status: string;
3434
+ phase: ConnectionRequestPhase | undefined;
3435
+ nextAction: ConnectionRequestNextAction | undefined;
3436
+ redirectUrl: string;
3437
+ expiresAt: string;
3438
+ authModes: string[];
3439
+ authRequirements: AuthRequirement[];
3440
+ };
3441
+ waitForConnection(timeoutMs?: number, intervalMs?: number): Promise<ConnectedAccount | undefined>;
3442
+ }
3443
+ //# sourceMappingURL=index.d.ts.map