@stacklink/sdk 0.3.15 → 0.6.2

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 (34) hide show
  1. package/README.md +26 -0
  2. package/compatibility.json +1 -1
  3. package/dist/src/domain/billing-plans.d.ts +827 -0
  4. package/dist/src/domain/billing-plans.d.ts.map +1 -0
  5. package/dist/src/domain/billing-plans.js +893 -0
  6. package/dist/src/domain/billing-plans.js.map +1 -0
  7. package/dist/src/domain/bot-avatar.d.ts +46 -0
  8. package/dist/src/domain/bot-avatar.d.ts.map +1 -0
  9. package/dist/src/domain/bot-avatar.js +436 -0
  10. package/dist/src/domain/bot-avatar.js.map +1 -0
  11. package/dist/src/domain/bot-contract.d.ts +1472 -700
  12. package/dist/src/domain/bot-contract.d.ts.map +1 -1
  13. package/dist/src/domain/bot-contract.js +133 -10
  14. package/dist/src/domain/bot-contract.js.map +1 -1
  15. package/dist/src/domain/memory-contract.d.ts +275 -275
  16. package/dist/src/domain/platform-approval-contract.d.ts +10 -4
  17. package/dist/src/domain/platform-approval-contract.d.ts.map +1 -1
  18. package/dist/src/domain/platform-approval-contract.js.map +1 -1
  19. package/dist/src/domain/provider-branding.d.ts.map +1 -1
  20. package/dist/src/domain/provider-branding.js +3 -0
  21. package/dist/src/domain/provider-branding.js.map +1 -1
  22. package/dist/src/domain/stacklink-meta-tools.d.ts +21 -5
  23. package/dist/src/domain/stacklink-meta-tools.d.ts.map +1 -1
  24. package/dist/src/domain/stacklink-meta-tools.js +73 -45
  25. package/dist/src/domain/stacklink-meta-tools.js.map +1 -1
  26. package/dist/src/domain/workflow-contract.d.ts +24338 -0
  27. package/dist/src/domain/workflow-contract.d.ts.map +1 -0
  28. package/dist/src/domain/workflow-contract.js +95 -0
  29. package/dist/src/domain/workflow-contract.js.map +1 -0
  30. package/dist/src/sdk/index.d.ts +329 -30
  31. package/dist/src/sdk/index.d.ts.map +1 -1
  32. package/dist/src/sdk/index.js +194 -47
  33. package/dist/src/sdk/index.js.map +1 -1
  34. package/package.json +1 -1
@@ -1,8 +1,11 @@
1
- import type { BotFileUpload, BotFileUploadInput, BotAttachment } from '../domain/bot-contract.js';
1
+ import type { BillingCreditsSummary } from '../domain/billing-plans.js';
2
+ import type { WorkflowDefinitionInput, WorkflowTriggerInput, WorkflowTriggerConfiguration, WorkflowDefinition, WorkflowRunView, WorkflowView } from '../domain/workflow-contract.js';
3
+ export type { WorkflowEmbedAccessInput, WorkflowEmbedConfig, WorkflowEmbedSettingsView, WorkflowAnalyticsView, WorkflowCustomerView, WorkflowCustomerDetail, WorkflowActivityView, WorkflowApprovalInbox, WorkflowDefinitionInput, WorkflowTriggerInput, WorkflowTriggerConfiguration, WorkflowValue, WorkflowCondition, WorkflowDefinition, WorkflowNode, WorkflowRunView, WorkflowView } from '../domain/workflow-contract.js';
4
+ import type { BotFileUpload, BotFileUploadInput, BotFileLink, BotAttachment } from '../domain/bot-contract.js';
2
5
  import type { Bot, BotPatch, BotRun, BotRunInput, PublishChannels, SavedBotApi, ContextApi, BotApiSigningKey, BotApiSigningKeyRequest } from '../domain/bot-contract.js';
3
6
  import type { ApprovalRecord, ApprovalDecision, ApprovalChange, ApprovalListResponse, ApprovalListQuery, CustomerApprovalGrantInput, CustomerApprovalGrantResponse } from '../domain/platform-approval-contract.js';
4
7
  export type { ApprovalRecord, ApprovalDecision, ApprovalChange, ApprovalListResponse, ApprovalAudience, ApprovalRequirement, CustomerApprovalGrantInput, CustomerApprovalGrantResponse } from '../domain/platform-approval-contract.js';
5
- export type { BotFileUpload, BotFileUploadInput, BotAttachment, BotFileSettings, BotOutputFile, FileCitation, FileCoverage, Bot, BotPatch, BotRun, BotRunInput, PublishChannels, SavedBotApi, ContextApi, BotApiSigningKey, BotApiSigningKeyRequest, BotTrigger, BotPreparation, BotRunDisplay, BotReadinessIssue, BotCapabilityFact, BotConnectionAction, BotWaitingOperation, BotRequirement } from '../domain/bot-contract.js';
8
+ export type { BotAvatar, BotIdentity, BotFileUpload, BotFileUploadInput, BotFileLink, BotAttachment, BotFileSettings, BotOutputFile, BotWebSource, FileCitation, FileCoverage, Bot, BotPatch, BotRun, BotRunInput, PublishChannels, SavedBotApi, ContextApi, BotApiSigningKey, BotApiSigningKeyRequest, BotTrigger, BotPreparation, BotRunDisplay, BotReadinessIssue, BotCapabilityFact, BotConnectionAction, BotWaitingOperation, BotRequirement } from '../domain/bot-contract.js';
6
9
  import { type StacklinkMetaToolName, type StacklinkAgentSearchResponse } from '../domain/stacklink-meta-tools.js';
7
10
  export type { StacklinkAgentSearchResponse } from '../domain/stacklink-meta-tools.js';
8
11
  import type { ProviderBrandDescriptor } from '../domain/provider-branding.js';
@@ -14,13 +17,14 @@ export type { StacklinkMemoryAvailabilityMode, StacklinkMemoryCaptureController,
14
17
  export type StacklinkFetch = typeof fetch;
15
18
  export type StacklinkMcpToolName = StacklinkMetaToolName;
16
19
  export type StacklinkToolSurfaceName = StacklinkMcpToolName | (string & {});
17
- export declare const stacklinkTypeScriptSdkVersion = "0.3.15";
20
+ export declare const stacklinkTypeScriptSdkVersion = "0.6.2";
18
21
  export declare class StacklinkApiError extends Error {
19
22
  readonly statusCode: number;
20
23
  readonly code?: string | undefined;
21
24
  readonly details?: unknown | undefined;
22
25
  readonly retryAfterMs?: number | undefined;
23
- constructor(message: string, statusCode: number, code?: string | undefined, details?: unknown | undefined, retryAfterMs?: number | undefined);
26
+ readonly failureId?: string | undefined;
27
+ constructor(message: string, statusCode: number, code?: string | undefined, details?: unknown | undefined, retryAfterMs?: number | undefined, failureId?: string | undefined);
24
28
  }
25
29
  type QueryPrimitive = string | number | boolean | null | undefined;
26
30
  type QueryValue = QueryPrimitive | QueryPrimitive[];
@@ -577,6 +581,9 @@ export interface ConnectionRequestResponse {
577
581
  }
578
582
  export interface ConnectionAuthorizationResponse {
579
583
  id: string;
584
+ intent?: 'connect' | 'reconnect' | undefined;
585
+ accountDisplayName?: string | undefined;
586
+ requestedScopes?: string[] | undefined;
580
587
  providerKey: string;
581
588
  authConfigId?: string | undefined;
582
589
  authMode?: string | undefined;
@@ -711,7 +718,7 @@ export interface StacklinkUsageBucket {
711
718
  }
712
719
  export interface StacklinkResourceUsage {
713
720
  credited?: number;
714
- key: 'tool_calls' | 'delivered_events' | 'memory_calls' | 'memory_input_tokens' | 'memory_retrievals' | 'workbench_standard' | 'workbench_medium' | 'workbench_large';
721
+ key: 'tool_calls' | 'delivered_events' | 'memory_calls' | 'memory_input_tokens' | 'memory_retrievals' | 'workbench_standard' | 'workbench_medium' | 'workbench_large' | 'workbench_ready_standard' | 'workbench_ready_medium' | 'workbench_ready_large';
715
722
  label: string;
716
723
  unit: string;
717
724
  included: number;
@@ -728,13 +735,7 @@ export interface StacklinkResourceUsage {
728
735
  export interface StacklinkUsageSummary {
729
736
  agreementVersion?: string;
730
737
  resources?: StacklinkResourceUsage[];
731
- spending?: Record<string, {
732
- approvedCents: number;
733
- usedCents: number;
734
- reservedCents: number;
735
- availableCents: number;
736
- currency: 'USD';
737
- }>;
738
+ credits?: BillingCreditsSummary;
738
739
  workspace?: {
739
740
  id: string;
740
741
  name: string;
@@ -902,6 +903,18 @@ export interface WorkbenchSession {
902
903
  createdAt?: string | undefined;
903
904
  updatedAt?: string | undefined;
904
905
  }
906
+ export interface WorkbenchStorageOperation<T = unknown> {
907
+ operationId: string;
908
+ workbenchSessionId: string;
909
+ kind: 'delete' | 'upload_finalize' | 'artifact_promote';
910
+ status: 'pending' | 'processing' | 'completed' | 'failed';
911
+ statusUrl: string;
912
+ stage: string;
913
+ retryAfterMs: number;
914
+ pendingReason?: string;
915
+ result?: T;
916
+ error?: unknown;
917
+ }
905
918
  export interface WorkbenchSessionDeleteReceipt {
906
919
  deleted: true;
907
920
  workbenchSessionId: string;
@@ -946,6 +959,8 @@ export interface WorkbenchReusableRunRequest {
946
959
  versionReason?: string | undefined;
947
960
  }
948
961
  export interface WorkbenchRunCodeInput {
962
+ idempotencyKey?: string;
963
+ afterExecution?: WorkbenchWaitRequest;
949
964
  workbenchSessionId?: string | undefined;
950
965
  language: WorkbenchRuntimeLanguage;
951
966
  code: string;
@@ -961,6 +976,8 @@ export interface WorkbenchRunCodeInput {
961
976
  metadata?: Record<string, unknown> | undefined;
962
977
  }
963
978
  export interface WorkbenchRunBashInput {
979
+ idempotencyKey?: string;
980
+ afterExecution?: WorkbenchWaitRequest;
964
981
  workbenchSessionId?: string | undefined;
965
982
  command: string;
966
983
  timeoutMs?: number | undefined;
@@ -981,8 +998,27 @@ export interface WorkbenchRuntimeDiagnostics {
981
998
  exitCode?: number | undefined;
982
999
  error?: unknown;
983
1000
  }
984
- export type WorkbenchExecutionStatus = 'waiting_for_approval' | 'queued' | 'started' | 'running' | 'cancel_requested' | 'completed' | 'failed' | 'cancelled' | 'timed_out';
1001
+ export type WorkbenchExecutionStatus = 'checkpointing' | 'waiting_saved' | 'waiting_ready' | 'resuming' | 'waiting_for_approval' | 'waiting_for_funding' | 'queued' | 'started' | 'running' | 'cancel_requested' | 'completed' | 'failed' | 'cancelled' | 'timed_out';
1002
+ export interface WorkbenchWaitRequest {
1003
+ mode?: 'saved' | 'keep_ready';
1004
+ reason: 'approval' | 'connection' | 'user_input' | 'external_event';
1005
+ maximumWaitMs?: number;
1006
+ continuation: {
1007
+ language: WorkbenchRuntimeLanguage;
1008
+ code: string;
1009
+ timeoutMs: number;
1010
+ };
1011
+ keepReady?: {
1012
+ maximumWaitMs: number;
1013
+ maximumChargeMicros: string;
1014
+ rateVersion: string;
1015
+ priceMicros: string;
1016
+ unitQuantity: number;
1017
+ };
1018
+ }
985
1019
  export interface WorkbenchExecutionLog {
1020
+ waitRevision?: number;
1021
+ waitState?: Record<string, unknown> | null;
986
1022
  id: string;
987
1023
  executionId?: string | undefined;
988
1024
  executionKind?: 'workbench_code' | 'workbench_bash' | undefined;
@@ -1074,7 +1110,7 @@ export interface WorkbenchOutputPreview {
1074
1110
  export interface WorkbenchExecutionResponse {
1075
1111
  approvalRequestId?: string | undefined;
1076
1112
  executed?: boolean | undefined;
1077
- nextAction?: 'wait_for_approval' | undefined;
1113
+ nextAction?: 'wait_for_approval' | 'resume_saved_work' | undefined;
1078
1114
  workbenchSession: WorkbenchSession;
1079
1115
  executionKind: 'workbench_code' | 'workbench_bash';
1080
1116
  executionId: string;
@@ -1086,9 +1122,9 @@ export interface WorkbenchExecutionResponse {
1086
1122
  artifact?: WorkbenchArtifact | undefined;
1087
1123
  }
1088
1124
  export interface WorkbenchFile {
1089
- id: string;
1125
+ id: string | null;
1090
1126
  path: string;
1091
- contentType: string;
1127
+ contentType: string | null;
1092
1128
  sizeBytes: number | string;
1093
1129
  storageKind: 'r2_workspace' | 'database_blob' | string;
1094
1130
  sha256?: string | null | undefined;
@@ -1113,6 +1149,7 @@ export interface WorkbenchFileSignedDownload {
1113
1149
  };
1114
1150
  downloadUrl: string;
1115
1151
  expiresAt: string;
1152
+ requiredHeaders?: Record<string, string>;
1116
1153
  }
1117
1154
  export interface WorkbenchArtifact {
1118
1155
  id: string;
@@ -2005,6 +2042,7 @@ export declare class Stacklink {
2005
2042
  private readonly timeoutMs;
2006
2043
  private readonly maxAttempts;
2007
2044
  readonly bots: StacklinkBotsClient;
2045
+ readonly workflows: StacklinkWorkflowsClient;
2008
2046
  readonly approvals: StacklinkApprovalsClient;
2009
2047
  readonly webhooks: StacklinkWebhooksClient;
2010
2048
  readonly triggers: StacklinkTriggersClient;
@@ -2235,10 +2273,20 @@ export declare class Stacklink {
2235
2273
  createAuthConfig(input: Record<string, unknown>): Promise<{
2236
2274
  authConfig: AuthConfig;
2237
2275
  }>;
2276
+ resumeWorkbenchExecution(input: {
2277
+ sessionId: string;
2278
+ executionId: string;
2279
+ expectedWaitRevision: number;
2280
+ checkpointId: string;
2281
+ }, options?: StacklinkRequestOptions): Promise<{
2282
+ executionId: string;
2283
+ status: WorkbenchExecutionStatus;
2284
+ waitRevision: number;
2285
+ executionLog: WorkbenchExecutionLog;
2286
+ }>;
2238
2287
  workbenchModels(): Promise<{
2239
2288
  models: WorkbenchModelOption[];
2240
2289
  defaultModel: string;
2241
- webSearchDefaultProvider: string;
2242
2290
  }>;
2243
2291
  runWorkbench(input: Record<string, unknown>, options?: StacklinkRequestOptions): Promise<Record<string, unknown>>;
2244
2292
  useWorkbenchSession(input: {
@@ -2250,16 +2298,36 @@ export declare class Stacklink {
2250
2298
  workbenchSession: WorkbenchSession;
2251
2299
  reused: boolean;
2252
2300
  }>;
2301
+ getWorkbenchOperation<T = unknown>(input: {
2302
+ sessionId: string;
2303
+ workbenchSessionId: string;
2304
+ operationId: string;
2305
+ }, options?: StacklinkRequestOptions): Promise<{
2306
+ operation: WorkbenchStorageOperation<T>;
2307
+ }>;
2308
+ waitForWorkbenchOperation<T>(input: {
2309
+ sessionId: string;
2310
+ workbenchSessionId: string;
2311
+ operationId: string;
2312
+ }, options?: {
2313
+ timeoutMs?: number | undefined;
2314
+ signal?: AbortSignal | undefined;
2315
+ }): Promise<T>;
2253
2316
  deleteWorkbenchSession(input: {
2254
2317
  sessionId: string;
2255
2318
  workbenchSessionId: string;
2319
+ }, options?: {
2320
+ timeoutMs?: number | undefined;
2321
+ signal?: AbortSignal | undefined;
2256
2322
  }): Promise<WorkbenchSessionDeleteReceipt>;
2257
2323
  listWorkbenchFiles(input: {
2258
2324
  sessionId: string;
2259
2325
  workbenchSessionId: string;
2326
+ cursor?: string;
2327
+ limit?: number;
2260
2328
  }): Promise<{
2261
- workbenchSession: WorkbenchSession;
2262
2329
  files: WorkbenchFile[];
2330
+ nextCursor: string | null;
2263
2331
  }>;
2264
2332
  readWorkbenchFile(input: {
2265
2333
  sessionId: string;
@@ -2276,9 +2344,10 @@ export declare class Stacklink {
2276
2344
  content: string | Uint8Array;
2277
2345
  contentType?: string | undefined;
2278
2346
  metadata?: Record<string, unknown> | undefined;
2347
+ uploadId?: string;
2279
2348
  }): Promise<{
2280
- workbenchSession: WorkbenchSession;
2281
2349
  file: WorkbenchFile;
2350
+ finalized: true;
2282
2351
  }>;
2283
2352
  prepareWorkbenchFileUpload(input: {
2284
2353
  sessionId: string;
@@ -2286,6 +2355,7 @@ export declare class Stacklink {
2286
2355
  path: string;
2287
2356
  contentType: string;
2288
2357
  sizeBytes: number;
2358
+ uploadId?: string;
2289
2359
  }): Promise<{
2290
2360
  workbenchSession: WorkbenchSession;
2291
2361
  upload: WorkbenchFileSignedUpload;
@@ -2295,18 +2365,28 @@ export declare class Stacklink {
2295
2365
  workbenchSessionId: string;
2296
2366
  uploadId: string;
2297
2367
  metadata?: Record<string, unknown> | undefined;
2368
+ }, options?: {
2369
+ timeoutMs?: number | undefined;
2370
+ signal?: AbortSignal | undefined;
2298
2371
  }): Promise<{
2299
2372
  file: WorkbenchFile;
2373
+ uploadId: string;
2374
+ finalized: true;
2300
2375
  }>;
2301
2376
  uploadWorkbenchFileDirect(input: {
2302
2377
  sessionId: string;
2303
2378
  workbenchSessionId: string;
2304
2379
  path: string;
2305
- content: string | Uint8Array;
2380
+ content: string | Uint8Array | Blob;
2306
2381
  contentType?: string | undefined;
2307
2382
  metadata?: Record<string, unknown> | undefined;
2383
+ uploadId?: string;
2384
+ transferTimeoutMs?: number;
2385
+ signal?: AbortSignal;
2308
2386
  }): Promise<{
2309
2387
  file: WorkbenchFile;
2388
+ uploadId: string;
2389
+ finalized: true;
2310
2390
  }>;
2311
2391
  getWorkbenchFileDownload(input: {
2312
2392
  sessionId: string;
@@ -2724,6 +2804,7 @@ export declare class Stacklink {
2724
2804
  sessionId: string;
2725
2805
  workbenchSessionId: string;
2726
2806
  path: string;
2807
+ artifactRef?: string;
2727
2808
  label?: string | undefined;
2728
2809
  contentType?: string | undefined;
2729
2810
  metadata?: Record<string, unknown> | undefined;
@@ -3375,9 +3456,12 @@ export declare class StacklinkWorkbenchFiles {
3375
3456
  private readonly platformSessionId;
3376
3457
  private readonly workbenchSessionId;
3377
3458
  constructor(client: Stacklink, platformSessionId: string, workbenchSessionId: () => Promise<string>);
3378
- list(): Promise<{
3379
- workbenchSession: WorkbenchSession;
3459
+ list(options?: {
3460
+ cursor?: string;
3461
+ limit?: number;
3462
+ }): Promise<{
3380
3463
  files: WorkbenchFile[];
3464
+ nextCursor: string | null;
3381
3465
  }>;
3382
3466
  read(path: string): Promise<{
3383
3467
  workbenchSession: WorkbenchSession;
@@ -3388,17 +3472,23 @@ export declare class StacklinkWorkbenchFiles {
3388
3472
  content: string | Uint8Array;
3389
3473
  contentType?: string | undefined;
3390
3474
  metadata?: Record<string, unknown> | undefined;
3475
+ uploadId?: string;
3391
3476
  }): Promise<{
3392
- workbenchSession: WorkbenchSession;
3393
3477
  file: WorkbenchFile;
3478
+ finalized: true;
3394
3479
  }>;
3395
3480
  uploadLarge(input: {
3396
3481
  path: string;
3397
- content: string | Uint8Array;
3482
+ content: string | Uint8Array | Blob;
3398
3483
  contentType?: string | undefined;
3399
3484
  metadata?: Record<string, unknown> | undefined;
3485
+ uploadId?: string;
3486
+ transferTimeoutMs?: number;
3487
+ signal?: AbortSignal;
3400
3488
  }): Promise<{
3401
3489
  file: WorkbenchFile;
3490
+ uploadId: string;
3491
+ finalized: true;
3402
3492
  }>;
3403
3493
  download(path: string): Promise<Response>;
3404
3494
  delete(path: string): Promise<{
@@ -3483,6 +3573,12 @@ export declare class StacklinkSessionSandbox {
3483
3573
  readonly artifacts: StacklinkWorkbenchArtifacts;
3484
3574
  private activeWorkbenchSessionId;
3485
3575
  constructor(client: Stacklink, platformSessionId: string);
3576
+ resume(executionId: string, expectedWaitRevision: number, checkpointId: string): Promise<{
3577
+ executionId: string;
3578
+ status: WorkbenchExecutionStatus;
3579
+ waitRevision: number;
3580
+ executionLog: WorkbenchExecutionLog;
3581
+ }>;
3486
3582
  use(workbenchSessionId?: string, input?: {
3487
3583
  createNew?: boolean | undefined;
3488
3584
  metadata?: Record<string, unknown> | undefined;
@@ -3568,6 +3664,7 @@ export declare class ToolRouterSession {
3568
3664
  toolkits(query?: Omit<ListProviderCatalogInput, 'tenantId'>): Promise<ProviderCatalogPage>;
3569
3665
  authorize(connectionRef: string, input?: {
3570
3666
  oauthScopeProfile?: string;
3667
+ amazonSellerRegion?: 'NA' | 'EU' | 'FE';
3571
3668
  metadata?: Record<string, unknown>;
3572
3669
  }): Promise<StacklinkConnectionRequest>;
3573
3670
  waitForConnections(connectionRequestIds: string[], timeoutMs?: number, intervalMs?: number): Promise<{
@@ -3724,10 +3821,7 @@ export declare class StacklinkBotsClient {
3724
3821
  }>;
3725
3822
  link: (botId: string, fileId: string, input: {
3726
3823
  sessionId: string;
3727
- }) => Promise<{
3728
- url: string;
3729
- expiresAt: string;
3730
- }>;
3824
+ }) => Promise<BotFileLink>;
3731
3825
  };
3732
3826
  constructor(client: Stacklink);
3733
3827
  apis(): Promise<{
@@ -3797,14 +3891,23 @@ export declare class StacklinkBotsClient {
3797
3891
  pauseFor?: '1h' | 'tomorrow' | 'manual';
3798
3892
  reason?: string;
3799
3893
  }): Promise<Bot>;
3800
- list(): Promise<{
3894
+ list(query?: {
3895
+ cursor?: string;
3896
+ limit?: number;
3897
+ search?: string;
3898
+ }): Promise<{
3801
3899
  bots: Array<{
3802
3900
  id: string;
3803
3901
  name: string;
3804
3902
  status: string;
3805
3903
  }>;
3904
+ nextCursor: string | null;
3806
3905
  }>;
3807
- create(name: string): Promise<Bot>;
3906
+ create(name: string, identity?: {
3907
+ publicDescription?: string;
3908
+ iconAssetId?: string | null;
3909
+ avatar?: import('../domain/bot-contract.js').BotAvatar | null;
3910
+ }): Promise<Bot>;
3808
3911
  get(botId: string): Promise<Bot>;
3809
3912
  update(botId: string, revision: number, patch: BotPatch): Promise<Bot>;
3810
3913
  publish(botId: string, revision: number, channels: PublishChannels): Promise<{
@@ -3815,6 +3918,7 @@ export declare class StacklinkBotsClient {
3815
3918
  sessionId: string;
3816
3919
  }): Promise<BotRun>;
3817
3920
  getRun(botId: string, runId: string): Promise<BotRun>;
3921
+ continueRun(botId: string, runId: string): Promise<BotRun>;
3818
3922
  /** Observe the same durable run. Returns when finished or when a person must act. */
3819
3923
  wait(botId: string, runId: string, options?: {
3820
3924
  totalTimeoutMs?: number;
@@ -3838,4 +3942,199 @@ export declare class StacklinkBotsClient {
3838
3942
  }, void, unknown>;
3839
3943
  cancel(botId: string, runId: string): Promise<BotRun>;
3840
3944
  }
3945
+ /** Visual and code-defined workflows use the same immutable graph and run API. */
3946
+ export declare class StacklinkWorkflowsClient {
3947
+ private readonly client;
3948
+ private readonly context?;
3949
+ constructor(client: Stacklink, context?: {
3950
+ customerId?: string;
3951
+ projectId?: string;
3952
+ accessToken?: string;
3953
+ } | undefined);
3954
+ /** Backend administration of one customer; never expose the project key in the browser. */
3955
+ forCustomer(customerId: string): StacklinkWorkflowsClient;
3956
+ /** Person-scoped data/decision calls from your authenticated backend. Same workflow methods. */
3957
+ withEmbeddedAccess(projectId: string, accessToken: string): StacklinkWorkflowsClient;
3958
+ private request;
3959
+ private path;
3960
+ list(query?: {
3961
+ cursor?: string;
3962
+ limit?: number;
3963
+ search?: string;
3964
+ }): Promise<{
3965
+ workflows: WorkflowView[];
3966
+ nextCursor: string | null;
3967
+ }>;
3968
+ create(input: {
3969
+ name: string;
3970
+ description?: string;
3971
+ source?: 'visual' | 'code';
3972
+ definition: WorkflowDefinitionInput;
3973
+ deployment?: WorkflowView['deployment'];
3974
+ }): Promise<WorkflowView>;
3975
+ get(id: string): Promise<WorkflowView>;
3976
+ update(id: string, input: {
3977
+ revision: number;
3978
+ name?: string;
3979
+ description?: string;
3980
+ definition?: WorkflowDefinitionInput;
3981
+ deployment?: WorkflowView['deployment'];
3982
+ }): Promise<WorkflowView>;
3983
+ validate(definition: WorkflowDefinitionInput): Promise<{
3984
+ valid: boolean;
3985
+ issues: Array<{
3986
+ nodeId?: string;
3987
+ message: string;
3988
+ }>;
3989
+ }>;
3990
+ publish(id: string, revision: number): Promise<WorkflowView>;
3991
+ setState(id: string, paused: boolean): Promise<WorkflowView>;
3992
+ versions(id: string): Promise<{
3993
+ versions: Array<{
3994
+ version: number;
3995
+ definition: WorkflowDefinition;
3996
+ name: string | null;
3997
+ description: string | null;
3998
+ triggers: WorkflowTriggerConfiguration[];
3999
+ createdAt: string;
4000
+ }>;
4001
+ }>;
4002
+ run(id: string, input: {
4003
+ sessionId?: string;
4004
+ jobKey: string;
4005
+ purpose?: 'test' | 'operational';
4006
+ input?: Record<string, unknown>;
4007
+ version?: number;
4008
+ revision?: number;
4009
+ mode?: 'live' | 'simulation';
4010
+ samples?: Record<string, unknown>;
4011
+ }): Promise<WorkflowRunView>;
4012
+ runs(id: string, query?: {
4013
+ cursor?: string;
4014
+ limit?: number;
4015
+ }): Promise<{
4016
+ runs: WorkflowRunView[];
4017
+ nextCursor: string | null;
4018
+ }>;
4019
+ getRun(id: string, runId: string): Promise<WorkflowRunView>;
4020
+ events(id: string, runId: string, query?: {
4021
+ before?: string;
4022
+ limit?: number;
4023
+ }): Promise<{
4024
+ events: WorkflowRunView["events"];
4025
+ nextCursor: string | null;
4026
+ }>;
4027
+ action(id: string, runId: string, input: {
4028
+ action: 'retry' | 'repeat' | 'cancel' | 'reconcile' | 'confirm' | 'signal';
4029
+ nodeId?: string;
4030
+ event?: string;
4031
+ value?: unknown;
4032
+ reason?: string;
4033
+ }): Promise<WorkflowRunView>;
4034
+ triggers(id: string): Promise<{
4035
+ revision: number;
4036
+ triggers: WorkflowTriggerConfiguration[];
4037
+ liveTriggers: WorkflowTriggerConfiguration[];
4038
+ }>;
4039
+ saveTrigger(id: string, input: WorkflowTriggerInput): Promise<{
4040
+ kind: "form" | "schedule" | "webhook" | "app_event" | "workflow_failed";
4041
+ enabled: boolean;
4042
+ name: string;
4043
+ sessionId: string;
4044
+ input: Record<string, unknown>;
4045
+ timezone: string;
4046
+ missedRuns: "latest" | "skip";
4047
+ version?: number | undefined;
4048
+ id?: string | undefined;
4049
+ form?: {
4050
+ description: string;
4051
+ title: string;
4052
+ answerSchema: Record<string, unknown>;
4053
+ } | undefined;
4054
+ inputMapping?: Record<string, {
4055
+ kind: "literal";
4056
+ value?: unknown;
4057
+ } | {
4058
+ path: (string | number)[];
4059
+ kind: "input";
4060
+ } | {
4061
+ path: (string | number)[];
4062
+ kind: "step";
4063
+ stepId: string;
4064
+ }> | undefined;
4065
+ cron?: string | undefined;
4066
+ subscriptionId?: string | undefined;
4067
+ sourceWorkflowId?: string | undefined;
4068
+ } & {
4069
+ revision: number;
4070
+ }>;
4071
+ deleteTrigger(id: string, triggerId: string, expectedRevision: number): Promise<{
4072
+ deleted: boolean;
4073
+ revision: number;
4074
+ }>;
4075
+ invokeTrigger(id: string, triggerId: string, requestId: string, input: Record<string, unknown>): Promise<WorkflowRunView>;
4076
+ previewSchedule(cron: string, timezone: string): Promise<{
4077
+ nextRuns: string[];
4078
+ runsPerDay: number;
4079
+ }>;
4080
+ suggest(id: string, description: string, revision: number, sessionId: string): Promise<{
4081
+ definition: WorkflowDefinitionInput;
4082
+ assumptions: string[];
4083
+ }>;
4084
+ issueEmbeddedAccess(input: import('../domain/workflow-contract.js').WorkflowEmbedAccessInput): Promise<{
4085
+ bootstrapToken: string;
4086
+ embedUrl: string;
4087
+ expiresAt: string;
4088
+ }>;
4089
+ exchangeEmbeddedAccess(bootstrapToken: string, origin: string): Promise<{
4090
+ accessToken: string;
4091
+ expiresAt: string;
4092
+ projectId: string;
4093
+ customerId: string;
4094
+ userId: string;
4095
+ sessionId: string;
4096
+ role: string;
4097
+ permissions: Record<string, boolean>;
4098
+ }>;
4099
+ embedSettings(): Promise<import("../domain/workflow-contract.js").WorkflowEmbedSettingsView>;
4100
+ saveEmbedSettings(input: {
4101
+ revision: number;
4102
+ config: import('../domain/workflow-contract.js').WorkflowEmbedConfig;
4103
+ }): Promise<import("../domain/workflow-contract.js").WorkflowEmbedSettingsView>;
4104
+ customers(query?: {
4105
+ search?: string;
4106
+ cursor?: string;
4107
+ limit?: number;
4108
+ }): Promise<{
4109
+ customers: import("../domain/workflow-contract.js").WorkflowCustomerView[];
4110
+ nextCursor: string | null;
4111
+ }>;
4112
+ customer(id: string): Promise<import("../domain/workflow-contract.js").WorkflowCustomerDetail>;
4113
+ setCustomerAutomations(id: string, enabled: boolean): Promise<unknown>;
4114
+ setCustomerPersonAccess(customerId: string, personId: string, action: 'revoke' | 'restore'): Promise<unknown>;
4115
+ analytics(query?: {
4116
+ days?: number;
4117
+ customerId?: string;
4118
+ }): Promise<import("../domain/workflow-contract.js").WorkflowAnalyticsView>;
4119
+ activity(query?: {
4120
+ cursor?: string;
4121
+ limit?: number;
4122
+ purpose?: 'test' | 'operational';
4123
+ }): Promise<import("../domain/workflow-contract.js").WorkflowActivityView>;
4124
+ approvals(query?: {
4125
+ view?: 'inbox' | 'history';
4126
+ cursor?: string;
4127
+ limit?: number;
4128
+ }): Promise<import("../domain/workflow-contract.js").WorkflowApprovalInbox>;
4129
+ decideApproval(id: string, input: {
4130
+ kind: 'workflow';
4131
+ value: unknown;
4132
+ } | {
4133
+ kind: 'action';
4134
+ requirement: 'customer' | 'company';
4135
+ decision: 'approve' | 'decline';
4136
+ expectedRevision: number;
4137
+ reason?: string;
4138
+ }): Promise<unknown>;
4139
+ }
3841
4140
  //# sourceMappingURL=index.d.ts.map