modulex-js 0.1.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.
@@ -0,0 +1,3349 @@
1
+ /**
2
+ * Configuration options for the ModuleX client.
3
+ */
4
+ interface ModulexConfig {
5
+ /** API key with `mx_live_` prefix. */
6
+ apiKey: string;
7
+ /** Default organization ID for all requests. Can be overridden per-request. */
8
+ organizationId?: string;
9
+ /** Base URL for the ModuleX API. */
10
+ baseUrl?: string;
11
+ /** Request timeout in milliseconds. */
12
+ timeout?: number;
13
+ /** Maximum number of retries for transient errors (429, 5xx). */
14
+ maxRetries?: number;
15
+ /** Custom fetch implementation. Defaults to globalThis.fetch. */
16
+ fetch?: typeof globalThis.fetch;
17
+ }
18
+ /** @internal */
19
+ interface ResolvedConfig {
20
+ apiKey: string;
21
+ organizationId?: string;
22
+ baseUrl: string;
23
+ timeout: number;
24
+ maxRetries: number;
25
+ fetch: typeof globalThis.fetch;
26
+ }
27
+
28
+ /** A parsed SSE event. */
29
+ interface SSEEvent {
30
+ /** Event type (e.g., "node_update", "done", "error"). */
31
+ event: string;
32
+ /** Parsed JSON data payload. */
33
+ data: Record<string, unknown>;
34
+ /** Optional event ID. */
35
+ id?: string;
36
+ /** Optional reconnection interval in ms. */
37
+ retry?: number;
38
+ }
39
+
40
+ /**
41
+ * Common types shared across all ModuleX SDK resources.
42
+ * @module types/shared
43
+ */
44
+ /**
45
+ * Per-request options that can be passed to any SDK method.
46
+ * organizationId overrides the client-level default for a single call.
47
+ */
48
+ interface RequestOptions {
49
+ /** Override the organization context for this request. */
50
+ organizationId?: string;
51
+ /** Additional query parameters appended to the URL (camelCase keys are converted to snake_case). */
52
+ params?: Record<string, string | number | boolean | undefined>;
53
+ /** An AbortSignal to cancel the in-flight request. */
54
+ signal?: AbortSignal;
55
+ /** Request-level timeout in milliseconds, overrides the client default. */
56
+ timeout?: number;
57
+ }
58
+ /**
59
+ * Standard success acknowledgement returned by mutation endpoints.
60
+ */
61
+ interface SuccessResponse {
62
+ success: boolean;
63
+ message?: string;
64
+ }
65
+ /**
66
+ * Generic paginated list envelope.
67
+ * The API uses different pagination styles across resources; all optional
68
+ * fields that a particular endpoint may or may not include are represented here.
69
+ *
70
+ * @template T - The type of each item in the collection.
71
+ */
72
+ interface PaginatedList<T> {
73
+ total: number;
74
+ page?: number;
75
+ page_size?: number;
76
+ total_pages?: number;
77
+ limit?: number;
78
+ offset?: number;
79
+ has_next?: boolean;
80
+ has_previous?: boolean;
81
+ }
82
+
83
+ /**
84
+ * Base class for all resource classes. Provides HTTP methods with
85
+ * retry logic, error handling, and organization ID resolution.
86
+ */
87
+ declare abstract class BaseResource {
88
+ /** @internal */
89
+ protected readonly _config: ResolvedConfig;
90
+ constructor(config: ResolvedConfig);
91
+ /**
92
+ * Resolve the organization ID from per-request options or client default.
93
+ * @internal
94
+ */
95
+ private resolveOrgId;
96
+ /**
97
+ * Build full URL with query parameters.
98
+ * @internal
99
+ */
100
+ private buildUrl;
101
+ /**
102
+ * Build headers for a request.
103
+ * @internal
104
+ */
105
+ private buildHeaders;
106
+ /**
107
+ * Create an abort signal that combines timeout and user-provided signal.
108
+ * @internal
109
+ */
110
+ private createSignal;
111
+ /**
112
+ * Execute a fetch request with retry logic.
113
+ * @internal
114
+ */
115
+ private fetchWithRetry;
116
+ /**
117
+ * Calculate delay for exponential backoff with jitter.
118
+ * @internal
119
+ */
120
+ private calculateDelay;
121
+ /**
122
+ * Sleep for a given duration, respecting abort signals.
123
+ * @internal
124
+ */
125
+ private sleep;
126
+ /** Perform a GET request. */
127
+ protected _get<T>(path: string, options?: RequestOptions): Promise<T>;
128
+ /** Perform a POST request. */
129
+ protected _post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
130
+ /** Perform a PUT request. */
131
+ protected _put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
132
+ /** Perform a PATCH request. */
133
+ protected _patch<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
134
+ /** Perform a DELETE request. */
135
+ protected _delete<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
136
+ /** Open an SSE stream and return an async iterable of events. */
137
+ protected streamSSE(path: string, options?: RequestOptions): AsyncGenerator<SSEEvent>;
138
+ /** Perform a POST SSE stream request. */
139
+ protected streamSSEPost(path: string, body?: unknown, options?: RequestOptions): AsyncGenerator<SSEEvent>;
140
+ /** Upload a file using multipart/form-data. */
141
+ protected upload<T>(path: string, formData: FormData, options?: RequestOptions): Promise<T>;
142
+ }
143
+
144
+ /**
145
+ * Types for authentication, user identity, and organization membership.
146
+ * @module types/auth
147
+ */
148
+ /**
149
+ * The role a user can hold within the platform.
150
+ */
151
+ type UserRole = 'USER' | 'ADMIN' | 'SUPER_ADMIN';
152
+ /**
153
+ * Full user object returned by identity endpoints.
154
+ */
155
+ interface UserResponse {
156
+ id: string;
157
+ email: string;
158
+ username: string;
159
+ role: UserRole;
160
+ is_active: boolean;
161
+ /** IDs of all organizations the user belongs to. */
162
+ organization_ids: string[];
163
+ /** The user's primary / default organization. */
164
+ primary_organization_id: string | null;
165
+ }
166
+ /**
167
+ * Lightweight organization membership record returned inside user-centric responses.
168
+ */
169
+ interface OrganizationInfo {
170
+ id: string;
171
+ name: string;
172
+ slug: string;
173
+ /** The calling user's role inside this organization. */
174
+ role: string;
175
+ created_at: string;
176
+ }
177
+ /**
178
+ * Response from listing the organizations a user belongs to.
179
+ */
180
+ interface OrganizationsResponse {
181
+ success: boolean;
182
+ user_id: string;
183
+ organizations: OrganizationInfo[];
184
+ total: number;
185
+ }
186
+ /**
187
+ * A single organization invitation object.
188
+ */
189
+ interface InvitationObject {
190
+ id: string;
191
+ organization_id: string;
192
+ organization_name?: string;
193
+ invited_email: string;
194
+ role: string;
195
+ status: string;
196
+ invitation_message?: string;
197
+ created_at: string;
198
+ expires_at?: string;
199
+ }
200
+ /**
201
+ * Response from listing pending invitations for the authenticated user.
202
+ */
203
+ interface InvitationsResponse {
204
+ success: boolean;
205
+ invitations: InvitationObject[];
206
+ total: number;
207
+ }
208
+ /**
209
+ * Response from accepting or rejecting a single invitation.
210
+ */
211
+ interface InvitationResponse {
212
+ success: boolean;
213
+ message?: string;
214
+ invitation: InvitationObject;
215
+ }
216
+ /**
217
+ * Response returned when a user leaves an organization.
218
+ */
219
+ interface LeaveResponse {
220
+ success: boolean;
221
+ message: string;
222
+ /** The organization that was left. */
223
+ left_organization: {
224
+ id: string;
225
+ name: string;
226
+ };
227
+ /** The organizations the user still belongs to. */
228
+ remaining_organizations: {
229
+ id: string;
230
+ name: string;
231
+ }[];
232
+ total_remaining: number;
233
+ }
234
+
235
+ /**
236
+ * Types for API key management.
237
+ * @module types/api-keys
238
+ */
239
+ /**
240
+ * Parameters for creating a new API key.
241
+ * Field names are camelCase; the SDK converts them to snake_case before sending.
242
+ */
243
+ interface CreateApiKeyParams {
244
+ /** Human-readable label for the key. */
245
+ name: string;
246
+ /** Scope the key to a specific organization. Defaults to the client-level org. */
247
+ organizationId?: string;
248
+ /** ISO-8601 datetime after which the key becomes invalid. */
249
+ expiresAt?: string;
250
+ /** Maximum number of API calls allowed per minute for this key. */
251
+ rateLimitPerMinute?: number;
252
+ }
253
+ /**
254
+ * An API key object as returned by the API.
255
+ * The `key` field is only present immediately after creation.
256
+ */
257
+ interface ApiKeyResponse {
258
+ id: string;
259
+ name: string;
260
+ /**
261
+ * The full secret key value.
262
+ * Only returned once, immediately after creation — store it securely.
263
+ */
264
+ key?: string;
265
+ /** Masked hint showing the first / last characters of the key. */
266
+ key_hint: string;
267
+ organization_id: string | null;
268
+ expires_at: string | null;
269
+ rate_limit_per_minute: number | null;
270
+ created_at: string;
271
+ is_revoked?: boolean;
272
+ revoked_at?: string | null;
273
+ }
274
+ /**
275
+ * Response returned when a new API key is created.
276
+ * Extends {@link ApiKeyResponse} and always includes the full `key`.
277
+ */
278
+ interface CreateApiKeyResponse extends ApiKeyResponse {
279
+ /** The full secret key — only exposed on creation. */
280
+ key: string;
281
+ }
282
+ /**
283
+ * Response from listing API keys for an organization.
284
+ */
285
+ interface ApiKeyListResponse {
286
+ keys: ApiKeyResponse[];
287
+ total?: number;
288
+ }
289
+ /**
290
+ * Response returned after revoking an API key.
291
+ */
292
+ interface RevokeApiKeyResponse {
293
+ success: boolean;
294
+ message: string;
295
+ }
296
+
297
+ /**
298
+ * Types for organization management, LLM configuration, and member management.
299
+ * @module types/organizations
300
+ */
301
+ /**
302
+ * Parameters for creating a new organization.
303
+ */
304
+ interface CreateOrganizationParams {
305
+ /** Display name for the organization. */
306
+ name: string;
307
+ /** URL-safe slug. Auto-generated from `name` if omitted. */
308
+ slug?: string;
309
+ }
310
+ /**
311
+ * Minimal organization object embedded in creation responses.
312
+ */
313
+ interface OrganizationCreatedObject {
314
+ id: string;
315
+ name: string;
316
+ slug: string;
317
+ }
318
+ /**
319
+ * Response from the create-organization endpoint.
320
+ */
321
+ interface CreateOrganizationResponse {
322
+ success: boolean;
323
+ message: string;
324
+ organization: OrganizationCreatedObject;
325
+ }
326
+ /**
327
+ * A single LLM integration entry as returned by the organization LLM list.
328
+ */
329
+ interface LLMEntry {
330
+ [key: string]: unknown;
331
+ }
332
+ /**
333
+ * Response from listing LLM integrations for an organization.
334
+ */
335
+ interface LLMsResponse {
336
+ success: boolean;
337
+ total: number;
338
+ active_llm_total: number;
339
+ inactive_llm_total: number;
340
+ /** Array of active LLM integration objects. */
341
+ active_llms: LLMEntry[];
342
+ /** Array of inactive LLM integration objects. */
343
+ inactive_llms: LLMEntry[];
344
+ }
345
+ /**
346
+ * Parameters for inviting a user to the organization.
347
+ */
348
+ interface InviteParams {
349
+ /** Email address of the person being invited. */
350
+ invitedEmail: string;
351
+ /** Role to assign upon acceptance. Defaults to `'member'`. */
352
+ role?: string;
353
+ /** Optional personal message included in the invitation email. */
354
+ invitationMessage?: string;
355
+ }
356
+ /**
357
+ * Response returned after cancelling a pending invitation.
358
+ */
359
+ interface CancelInvitationResponse {
360
+ success: boolean;
361
+ message: string;
362
+ }
363
+ /**
364
+ * Parameters for updating a member's role within an organization.
365
+ */
366
+ interface RoleUpdateParams {
367
+ /** New role to assign. */
368
+ role: 'member' | 'admin';
369
+ }
370
+ /**
371
+ * Response returned after a successful role update.
372
+ */
373
+ interface RoleUpdateResponse {
374
+ success: boolean;
375
+ message: string;
376
+ user_id: string;
377
+ organization_id: string;
378
+ new_role: string;
379
+ }
380
+
381
+ /**
382
+ * Types for workflow definitions, nodes, edges, and builder metadata.
383
+ * This is the largest type module — it covers the full workflow DSL used
384
+ * across the create, update, run, and builder endpoints.
385
+ * @module types/workflows
386
+ */
387
+ /**
388
+ * Human-readable metadata attached to a workflow.
389
+ */
390
+ interface WorkflowMetadata {
391
+ name: string;
392
+ description?: string;
393
+ version?: string;
394
+ author?: string;
395
+ tags?: string[];
396
+ }
397
+ /**
398
+ * Runtime configuration defaults for a workflow.
399
+ */
400
+ interface WorkflowConfig {
401
+ /** Default LLM configuration used when a node does not specify one. */
402
+ default_llm?: LLMConfig;
403
+ /** Default list of tool definitions available to agent nodes. */
404
+ default_tools?: ToolDefinition[];
405
+ /** Maximum number of recursive node invocations before aborting. */
406
+ recursion_limit?: number;
407
+ /** Checkpointing backend identifier (e.g. `"postgres"`). */
408
+ checkpointing?: string;
409
+ }
410
+ /**
411
+ * Definition of a single field in the workflow state schema.
412
+ */
413
+ interface StateSchemaField {
414
+ /** JSON Schema type string (e.g. `"string"`, `"number"`, `"array"`). */
415
+ type: string;
416
+ description?: string;
417
+ /** LangGraph reducer function name or expression applied to updates. */
418
+ reducer?: string;
419
+ required?: boolean;
420
+ default?: unknown;
421
+ }
422
+ /**
423
+ * The complete state schema for a workflow, keyed by field name.
424
+ */
425
+ interface StateSchema {
426
+ fields: Record<string, StateSchemaField>;
427
+ }
428
+ /**
429
+ * All valid node type identifiers in the workflow graph.
430
+ */
431
+ type NodeType = 'llm' | 'tool' | 'agent' | 'function' | 'conditional' | 'interrupt' | 'transformer' | 'guardrails' | 'knowledge';
432
+ /**
433
+ * Identifies a specific LLM model from a provider integration.
434
+ */
435
+ interface LLMConfig {
436
+ /** The name of the LLM integration (e.g. `"openai"`). */
437
+ integration_name: string;
438
+ /** Provider ID within the integration (e.g. `"openai"`). */
439
+ provider_id: string;
440
+ /** Model identifier (e.g. `"gpt-4o"`). */
441
+ model_id: string;
442
+ /** Sampling temperature (0–2). */
443
+ temperature?: number;
444
+ /** Credential ID to use when calling this model. */
445
+ credential_id?: string;
446
+ }
447
+ /**
448
+ * Selects a specific action from a tool integration.
449
+ */
450
+ interface ToolDefinition {
451
+ /** The name of the tool integration (e.g. `"github"`). */
452
+ integration_name: string;
453
+ /** Action / service name within the integration. */
454
+ service_name: string;
455
+ /** Credential ID to use for authenticated tool calls. */
456
+ credential_id?: string;
457
+ /** Static defaults to merge into the tool's input parameters. */
458
+ parameter_defaults?: Record<string, unknown>;
459
+ /** Values that override user-supplied parameters at runtime. */
460
+ parameter_overrides?: Record<string, unknown>;
461
+ }
462
+ /**
463
+ * Retry policy applied to a node on transient failures.
464
+ */
465
+ interface RetryConfig {
466
+ /** Maximum number of retry attempts. */
467
+ max_attempts?: number;
468
+ /** Initial wait interval in milliseconds before the first retry. */
469
+ initial_interval?: number;
470
+ /** Multiplier applied to the interval on each subsequent retry. */
471
+ backoff_factor?: number;
472
+ }
473
+ /**
474
+ * Configuration for an `llm` node — calls an LLM and stores the response.
475
+ */
476
+ interface LLMNodeConfig {
477
+ llm: LLMConfig;
478
+ /** System prompt template (supports state interpolation via `{{field}}`). */
479
+ system_prompt?: string;
480
+ /** User prompt template. */
481
+ user_prompt?: string;
482
+ /** JSON Schema describing the expected structured output format. */
483
+ structured_output_schema?: Record<string, unknown>;
484
+ }
485
+ /**
486
+ * Configuration for a `tool` node — executes a single tool action.
487
+ */
488
+ interface ToolNodeConfig {
489
+ tool: ToolDefinition;
490
+ /** Maps state fields to tool input parameters. */
491
+ input_mapping?: Record<string, string>;
492
+ }
493
+ /**
494
+ * Configuration for an `agent` node — an LLM with tool-use capabilities.
495
+ */
496
+ interface AgentNodeConfig {
497
+ llm: LLMConfig;
498
+ /** Tools available to this agent. */
499
+ tools?: ToolDefinition[];
500
+ system_prompt?: string;
501
+ user_prompt?: string;
502
+ /** Maximum tool-call iterations before the agent yields. */
503
+ max_iterations?: number;
504
+ input_mapping?: Record<string, string>;
505
+ }
506
+ /**
507
+ * Configuration for a `function` node — executes arbitrary registered code.
508
+ * Shape is integration-specific and passed through without transformation.
509
+ */
510
+ interface FunctionNodeConfig {
511
+ [key: string]: unknown;
512
+ }
513
+ /**
514
+ * A single branch in a conditional node evaluated against runtime state.
515
+ */
516
+ interface ConditionalBranch {
517
+ name: string;
518
+ /** Boolean expression evaluated against the workflow state. */
519
+ condition: string;
520
+ /** Node ID to route to when the condition is truthy. */
521
+ target: string;
522
+ }
523
+ /**
524
+ * Loop execution configuration for a `conditional` node used as a loop.
525
+ */
526
+ interface LoopConfig {
527
+ loop_id: string;
528
+ /** `"for"` | `"foreach"` | `"while"` — how to determine iterations. */
529
+ mode: string;
530
+ /** Fixed iteration count for `"for"` mode. */
531
+ iterations?: number;
532
+ /** State field containing the collection to iterate over for `"foreach"` mode. */
533
+ collection?: string;
534
+ /** Boolean expression used for `"while"` mode. */
535
+ condition?: string;
536
+ /** First node inside the loop body. */
537
+ body_target?: string;
538
+ /** Last node inside the loop body. */
539
+ body_end?: string;
540
+ /** Node to route to when the loop exits. */
541
+ exit_target?: string;
542
+ /** Hard upper bound on iterations to prevent infinite loops. */
543
+ max_iterations?: number;
544
+ }
545
+ /**
546
+ * Configuration for a `conditional` node — branches or loops based on state.
547
+ */
548
+ interface ConditionalNodeConfig {
549
+ /** `"expression"` | `"llm"` | `"loop"` */
550
+ condition_type: string;
551
+ /** Named routes mapping route names to target node IDs. */
552
+ routes?: Record<string, string>;
553
+ /** Ordered list of conditional branches evaluated top-to-bottom. */
554
+ expression_branches?: ConditionalBranch[];
555
+ loop_config?: LoopConfig;
556
+ }
557
+ /**
558
+ * Configuration for an `interrupt` node — pauses execution for human input.
559
+ */
560
+ interface InterruptNodeConfig {
561
+ /** Message shown to the human reviewer. */
562
+ message?: string;
563
+ /** JSON Schema describing the shape of the resume value. */
564
+ resume_schema?: Record<string, unknown>;
565
+ /** Example resume values shown in the UI. */
566
+ examples?: unknown[];
567
+ }
568
+ /**
569
+ * A single data-transformation operation applied by a `transformer` node.
570
+ */
571
+ interface TransformerOperation {
572
+ /** Operation type (e.g. `"set"`, `"delete"`, `"map"`, `"filter"`, `"template"`). */
573
+ type: string;
574
+ /** JSON Pointer or dot-notation path to the target field. */
575
+ path?: string;
576
+ /** Boolean expression used for conditional operations. */
577
+ condition?: string;
578
+ /** Jinja-style template string for `"template"` operations. */
579
+ template?: string;
580
+ }
581
+ /**
582
+ * Configuration for a `transformer` node — reshapes state between nodes.
583
+ */
584
+ interface TransformerNodeConfig {
585
+ /** Source state field to read from. */
586
+ source?: string;
587
+ /** Ordered list of transformation operations. */
588
+ operations?: TransformerOperation[];
589
+ }
590
+ /**
591
+ * Configuration for a `guardrails` node — validates or filters content.
592
+ * Shape is provider-specific and passed through without transformation.
593
+ */
594
+ interface GuardrailsNodeConfig {
595
+ [key: string]: unknown;
596
+ }
597
+ /**
598
+ * Configuration for a `knowledge` node — retrieves context from a knowledge base.
599
+ */
600
+ interface KnowledgeNodeConfig {
601
+ credential_id?: string;
602
+ /** Provider type identifier (e.g. `"pinecone"`, `"weaviate"`). */
603
+ provider_type?: string;
604
+ /** Query string or state field reference to search with. */
605
+ query?: string;
606
+ collection_name?: string;
607
+ /** Number of top results to return. */
608
+ top_k?: number;
609
+ /** Minimum similarity score threshold (0–1). */
610
+ min_score?: number;
611
+ /** Provider-specific metadata filters. */
612
+ filters?: Record<string, unknown>;
613
+ /** Embedding model configuration used for the similarity search. */
614
+ embedding_config?: Record<string, unknown>;
615
+ }
616
+ /**
617
+ * A single node in the workflow graph.
618
+ */
619
+ interface NodeDefinition {
620
+ /** Unique identifier for this node within the workflow. */
621
+ id: string;
622
+ type: NodeType;
623
+ name: string;
624
+ description?: string;
625
+ /** Whether the node participates in execution. Defaults to `true`. */
626
+ enabled?: boolean;
627
+ /** Canvas X position (used by the visual editor). */
628
+ x?: number;
629
+ /** Canvas Y position (used by the visual editor). */
630
+ y?: number;
631
+ retry_config?: RetryConfig;
632
+ llm_config?: LLMNodeConfig;
633
+ tool_config?: ToolNodeConfig;
634
+ agent_config?: AgentNodeConfig;
635
+ function_config?: FunctionNodeConfig;
636
+ conditional_config?: ConditionalNodeConfig;
637
+ interrupt_config?: InterruptNodeConfig;
638
+ transformer_config?: TransformerNodeConfig;
639
+ guardrails_config?: GuardrailsNodeConfig;
640
+ knowledge_config?: KnowledgeNodeConfig;
641
+ }
642
+ /**
643
+ * A directed edge connecting two nodes in the workflow graph.
644
+ */
645
+ interface EdgeDefinition {
646
+ /** ID of the source node. */
647
+ source: string;
648
+ /** ID of the target node. */
649
+ target: string;
650
+ }
651
+ /**
652
+ * The complete, serializable definition of a workflow.
653
+ * This is what is stored, versioned, and executed.
654
+ */
655
+ interface WorkflowDefinition {
656
+ metadata: WorkflowMetadata;
657
+ config: WorkflowConfig;
658
+ state_schema: StateSchema;
659
+ nodes: NodeDefinition[];
660
+ edges: EdgeDefinition[];
661
+ /** ID of the first node to execute. */
662
+ entry_point: string;
663
+ }
664
+ /**
665
+ * Parameters for creating a new workflow.
666
+ */
667
+ interface CreateWorkflowParams {
668
+ /** The full workflow graph definition. */
669
+ workflowSchema: WorkflowDefinition;
670
+ name?: string;
671
+ description?: string;
672
+ version?: string;
673
+ tags?: string[];
674
+ category?: string;
675
+ /** Lifecycle status (e.g. `"draft"`, `"published"`). */
676
+ status?: string;
677
+ /** Sharing visibility (e.g. `"private"`, `"organization"`, `"public"`). */
678
+ visibility?: string;
679
+ /** Default input values shown in the run panel. */
680
+ input?: Record<string, unknown>;
681
+ /** Override config values for this workflow. */
682
+ config?: Partial<WorkflowConfig>;
683
+ }
684
+ /**
685
+ * Parameters for updating an existing workflow.
686
+ * All fields are optional; only provided fields are updated.
687
+ */
688
+ interface UpdateWorkflowParams {
689
+ name?: string;
690
+ description?: string;
691
+ version?: string;
692
+ tags?: string[];
693
+ category?: string;
694
+ status?: string;
695
+ visibility?: string;
696
+ workflowSchema?: WorkflowDefinition;
697
+ input?: Record<string, unknown>;
698
+ config?: Partial<WorkflowConfig>;
699
+ }
700
+ /**
701
+ * Lightweight workflow record returned in list responses.
702
+ */
703
+ interface WorkflowSummary {
704
+ id: string;
705
+ name: string;
706
+ description: string | null;
707
+ version: string;
708
+ status: string;
709
+ visibility: string;
710
+ category: string | null;
711
+ tags: string[];
712
+ created_at: string;
713
+ updated_at: string;
714
+ creator_id: string;
715
+ }
716
+ /**
717
+ * Full workflow record including the stored schema.
718
+ */
719
+ interface WorkflowResponse extends WorkflowSummary {
720
+ workflow_schema: WorkflowDefinition;
721
+ edit_version?: number;
722
+ last_edited_by?: string | null;
723
+ last_edited_at?: string | null;
724
+ organization_id: string;
725
+ }
726
+ /**
727
+ * Query parameters for listing workflows.
728
+ */
729
+ interface WorkflowListParams {
730
+ status?: string;
731
+ category?: string;
732
+ visibility?: string;
733
+ search?: string;
734
+ page?: number;
735
+ pageSize?: number;
736
+ organizationId?: string;
737
+ }
738
+ /**
739
+ * Paginated list of workflow summaries.
740
+ */
741
+ interface WorkflowListResponse {
742
+ workflows: WorkflowSummary[];
743
+ total: number;
744
+ page?: number;
745
+ page_size?: number;
746
+ total_pages?: number;
747
+ }
748
+ /**
749
+ * Response from deleting a workflow.
750
+ */
751
+ interface DeleteWorkflowResponse {
752
+ /** HTTP-style status string (e.g. `"deleted"`). */
753
+ status: string;
754
+ workflow_id: string;
755
+ message: string;
756
+ }
757
+ /**
758
+ * Query parameters for fetching node type and integration details from the builder.
759
+ */
760
+ interface BuilderDetailsParams {
761
+ /** Filter to a specific node type. */
762
+ nodeType?: string;
763
+ /** Filter to a specific category. */
764
+ category?: string;
765
+ /** Filter to a specific integration name. */
766
+ integrationName?: string;
767
+ organizationId?: string;
768
+ }
769
+ /**
770
+ * Response from the builder details endpoint, providing the palette of
771
+ * available node types, integration categories, and their counts.
772
+ */
773
+ interface BuilderDetailsResponse {
774
+ /** Map of node type identifier to its descriptor. */
775
+ node_types: Record<string, unknown>;
776
+ /** Available integration categories. */
777
+ categories: string[];
778
+ /** Count breakdown by category or type. */
779
+ counts: Record<string, number>;
780
+ /** Whether the response was served from cache. */
781
+ cached: boolean;
782
+ }
783
+
784
+ /**
785
+ * Types for workflow execution — running, resuming, cancelling, and streaming.
786
+ * @module types/executions
787
+ */
788
+
789
+ /**
790
+ * Parameters for triggering a workflow run.
791
+ */
792
+ interface WorkflowRunParams {
793
+ /** ID of a previously saved workflow to run. Mutually exclusive with `workflow`. */
794
+ workflowId?: string;
795
+ /** An inline workflow definition to run without saving. */
796
+ workflow?: WorkflowDefinition;
797
+ /** Override the LLM used by the run. */
798
+ llm?: LLMConfig;
799
+ /** Name of a system-level workflow to run (e.g. `"workflow_name"`). */
800
+ systemWorkflow?: string;
801
+ /** State input values passed to the workflow's entry node. */
802
+ input?: Record<string, unknown>;
803
+ /** Runtime config overrides for this execution. */
804
+ config?: Record<string, unknown>;
805
+ /** Whether to open an SSE stream for real-time events. */
806
+ stream?: boolean;
807
+ /** If `true`, the run is not persisted and no thread is created. */
808
+ ephemeral?: boolean;
809
+ /** If `true`, the run and its messages are only visible to the creator. */
810
+ isPrivate?: boolean;
811
+ /** Knowledge base retrieval config for this run. */
812
+ knowledgeConfig?: Record<string, unknown>;
813
+ organizationId?: string;
814
+ }
815
+ /**
816
+ * Response from initiating a workflow run.
817
+ */
818
+ interface WorkflowRunResponse {
819
+ /** Terminal or intermediate status (e.g. `"completed"`, `"running"`, `"interrupted"`). */
820
+ status: string;
821
+ run_id: string;
822
+ thread_id: string;
823
+ chat_id: string | null;
824
+ ephemeral: boolean;
825
+ stream: boolean;
826
+ workflow_name: string;
827
+ workflow_version: string;
828
+ /** `"saved"` | `"inline"` | `"deployment"` */
829
+ workflow_source: string;
830
+ /** Wall-clock duration of the synchronous portion in milliseconds. */
831
+ elapsed_ms: number;
832
+ human_message?: Record<string, unknown> | null;
833
+ ai_message?: Record<string, unknown> | null;
834
+ message: string;
835
+ }
836
+ /**
837
+ * The persisted state snapshot of a workflow thread at a given checkpoint.
838
+ */
839
+ interface WorkflowStateResponse {
840
+ thread_id: string;
841
+ run_id: string;
842
+ checkpoint_id: string;
843
+ /** The full LangGraph state object. */
844
+ state: Record<string, unknown>;
845
+ /** Node IDs scheduled to execute next. */
846
+ next: string[];
847
+ /** LangGraph metadata blob. */
848
+ metadata: Record<string, unknown>;
849
+ /** Number of writes pending flush to the checkpoint store. */
850
+ pending_writes: number;
851
+ }
852
+ /**
853
+ * Parameters for resuming a workflow that is waiting at an interrupt node.
854
+ */
855
+ interface WorkflowResumeParams {
856
+ /** The thread ID to resume (required — used as path parameter). */
857
+ threadId: string;
858
+ /** ID of the saved workflow. Required unless `workflow` is provided. */
859
+ workflowId?: string;
860
+ /** Inline workflow definition to resume. */
861
+ workflow?: WorkflowDefinition;
862
+ /** The value to inject at the interrupt point (required). */
863
+ resumeValue: unknown;
864
+ /** The run ID to resume (required). */
865
+ runId: string;
866
+ /** Whether to open an SSE stream for the resumed execution. */
867
+ stream?: boolean;
868
+ organizationId?: string;
869
+ }
870
+ /**
871
+ * Response from resuming an interrupted workflow run.
872
+ */
873
+ interface WorkflowResumeResponse {
874
+ status: string;
875
+ run_id: string;
876
+ thread_id: string;
877
+ stream: boolean;
878
+ workflow_source: string;
879
+ message: string;
880
+ }
881
+ /**
882
+ * Response from cancelling an in-progress workflow run.
883
+ */
884
+ interface CancelResponse {
885
+ status: string;
886
+ run_id: string;
887
+ reason: string;
888
+ message: string;
889
+ }
890
+ /**
891
+ * Data payload for the `metadata` SSE event — emitted at the start of a run.
892
+ */
893
+ interface MetadataEventData {
894
+ run_id: string;
895
+ thread_id: string;
896
+ workflow_name: string;
897
+ workflow_version: string;
898
+ /** Ordered list of node IDs in the execution plan. */
899
+ nodes: string[];
900
+ }
901
+ /**
902
+ * Data payload for a `node_update` SSE event — emitted as each node changes state.
903
+ */
904
+ interface NodeUpdateEventData {
905
+ node_id: string;
906
+ node_type: string;
907
+ status: 'started' | 'completed' | 'error';
908
+ /** Node output value (present when `status` is `"completed"`). */
909
+ output?: unknown;
910
+ /** Error message (present when `status` is `"error"`). */
911
+ error?: string;
912
+ /** How long the node took to execute, in milliseconds. */
913
+ execution_time_ms?: number;
914
+ }
915
+ /**
916
+ * Data payload for an `interrupt` SSE event — execution is paused for human input.
917
+ */
918
+ interface InterruptEventData {
919
+ message: string;
920
+ /** Current workflow state at the point of interruption. */
921
+ state: Record<string, unknown>;
922
+ /** Instructions describing what the human should supply as a resume value. */
923
+ resume_instructions?: string;
924
+ /** ID of the node that triggered the interrupt. */
925
+ node_id: string;
926
+ }
927
+ /**
928
+ * Data payload for a `resumed` SSE event — a previously interrupted run has continued.
929
+ */
930
+ interface ResumedEventData {
931
+ run_id: string;
932
+ thread_id: string;
933
+ }
934
+ /**
935
+ * Data payload for the `done` SSE event — the workflow has finished executing.
936
+ */
937
+ interface DoneEventData {
938
+ final_state: Record<string, unknown>;
939
+ steps_executed: number;
940
+ total_execution_time_ms: number;
941
+ }
942
+ /**
943
+ * Data payload for an `error` SSE event — an unrecoverable error occurred.
944
+ */
945
+ interface ErrorEventData {
946
+ error_message: string;
947
+ error_type?: string;
948
+ /** ID of the node where the error originated, if applicable. */
949
+ node_id?: string;
950
+ stack_trace?: string;
951
+ }
952
+ /**
953
+ * A type-safe discriminated union of all possible SSE events emitted during
954
+ * a workflow run or resume stream.
955
+ *
956
+ * Discriminate on the `event` field to narrow the `data` type:
957
+ * ```ts
958
+ * for await (const evt of stream) {
959
+ * if (evt.event === 'done') {
960
+ * console.log(evt.data.final_state);
961
+ * }
962
+ * }
963
+ * ```
964
+ */
965
+ type WorkflowSSEEvent = {
966
+ event: 'metadata';
967
+ data: MetadataEventData;
968
+ } | {
969
+ event: 'node_update';
970
+ data: NodeUpdateEventData;
971
+ } | {
972
+ event: 'interrupt';
973
+ data: InterruptEventData;
974
+ } | {
975
+ event: 'resumed';
976
+ data: ResumedEventData;
977
+ } | {
978
+ event: 'done';
979
+ data: DoneEventData;
980
+ } | {
981
+ event: 'error';
982
+ data: ErrorEventData;
983
+ };
984
+
985
+ /**
986
+ * Types for workflow deployment management.
987
+ * @module types/deployments
988
+ */
989
+
990
+ /**
991
+ * Parameters for creating a deployment snapshot of a workflow.
992
+ */
993
+ interface CreateDeploymentParams {
994
+ /** Human-readable release note describing what changed in this deployment. */
995
+ deploymentNote?: string;
996
+ /** URL to a preview image of the workflow schema canvas. */
997
+ schemaImageUrl?: string;
998
+ }
999
+ /**
1000
+ * A deployment record as returned by list and summary endpoints.
1001
+ */
1002
+ interface DeploymentResponse {
1003
+ id: string;
1004
+ workflow_id: string;
1005
+ name: string;
1006
+ version: string;
1007
+ deployment_note: string | null;
1008
+ schema_image_url: string | null;
1009
+ deployed_by: string;
1010
+ created_at: string;
1011
+ /** Whether this deployment is currently the live (active) version. */
1012
+ is_live: boolean;
1013
+ }
1014
+ /**
1015
+ * Query parameters for listing deployments.
1016
+ */
1017
+ interface DeploymentListParams {
1018
+ limit?: number;
1019
+ offset?: number;
1020
+ }
1021
+ /**
1022
+ * Paginated list of deployment records.
1023
+ */
1024
+ interface DeploymentListResponse {
1025
+ deployments: DeploymentResponse[];
1026
+ total: number;
1027
+ limit: number;
1028
+ offset: number;
1029
+ }
1030
+ /**
1031
+ * Full deployment record including the stored workflow schema and run config.
1032
+ * Returned by the get-single-deployment endpoint.
1033
+ */
1034
+ interface DeploymentDetailResponse extends DeploymentResponse {
1035
+ /** The full workflow graph definition at the time of this deployment. */
1036
+ workflow_schema: WorkflowDefinition;
1037
+ /** Default input values stored with the deployment. */
1038
+ input: Record<string, unknown> | null;
1039
+ /** Runtime configuration stored with the deployment. */
1040
+ config: Record<string, unknown> | null;
1041
+ }
1042
+ /**
1043
+ * Response from activating a deployment (making it the live version).
1044
+ */
1045
+ interface ActivateDeploymentResponse {
1046
+ success: boolean;
1047
+ message: string;
1048
+ deployment_id: string;
1049
+ /** The deployment that was previously live, if any. */
1050
+ previous_live_deployment_id: string | null;
1051
+ }
1052
+ /**
1053
+ * Response from deactivating the current live deployment.
1054
+ */
1055
+ interface DeactivateDeploymentResponse {
1056
+ success: boolean;
1057
+ message: string;
1058
+ /** The deployment that was deactivated. */
1059
+ previous_live_deployment_id: string;
1060
+ }
1061
+ /**
1062
+ * Response from deleting a deployment.
1063
+ */
1064
+ interface DeleteDeploymentResponse {
1065
+ success: boolean;
1066
+ message: string;
1067
+ deleted_deployment_id: string;
1068
+ /** Whether the deleted deployment was the live version. */
1069
+ was_live: boolean;
1070
+ /**
1071
+ * The deployment automatically promoted to live status after deletion,
1072
+ * if any (only present when `was_live` is `true`).
1073
+ */
1074
+ new_live_deployment_id: string | null;
1075
+ }
1076
+
1077
+ /**
1078
+ * Types for chat session management and messaging.
1079
+ * @module types/chats
1080
+ */
1081
+ /**
1082
+ * A chat session record.
1083
+ */
1084
+ interface ChatResponse {
1085
+ id: string;
1086
+ title: string | null;
1087
+ creator_id: string;
1088
+ is_private: boolean;
1089
+ /** ID of the currently in-progress run attached to this chat, if any. */
1090
+ running_id: string | null;
1091
+ created_at: string;
1092
+ updated_at: string;
1093
+ organization_id?: string | null;
1094
+ /** Messages are included when fetching a single chat with messages embedded. */
1095
+ messages?: ChatMessageResponse[];
1096
+ deleted_at?: string | null;
1097
+ }
1098
+ /**
1099
+ * The role of a participant in a chat message.
1100
+ */
1101
+ type ChatMessageRole = 'human' | 'ai' | 'system';
1102
+ /**
1103
+ * A single message within a chat session.
1104
+ */
1105
+ interface ChatMessageResponse {
1106
+ id: string;
1107
+ chat_id: string;
1108
+ role: ChatMessageRole;
1109
+ /** Message content — can be a string, structured array, or object depending on message type. */
1110
+ content: string | unknown[] | Record<string, unknown>;
1111
+ /** Name or version of the workflow that produced an `ai` message. */
1112
+ workflow?: string | null;
1113
+ run_id?: string | null;
1114
+ /** Execution status of the run that produced this message (for `ai` messages). */
1115
+ running_status?: string | null;
1116
+ created_at: string;
1117
+ updated_at: string;
1118
+ }
1119
+ /**
1120
+ * Query parameters for paginating messages within a chat.
1121
+ */
1122
+ interface ChatMessagesParams {
1123
+ limit?: number;
1124
+ offset?: number;
1125
+ }
1126
+ /**
1127
+ * Paginated list of messages within a chat.
1128
+ */
1129
+ interface ChatMessagesResponse {
1130
+ messages: ChatMessageResponse[];
1131
+ total: number;
1132
+ limit: number;
1133
+ offset: number;
1134
+ has_next: boolean;
1135
+ /** The number of messages actually returned (may differ from `limit` on the last page). */
1136
+ actual_count: number;
1137
+ }
1138
+ /**
1139
+ * Parameters for updating a chat's metadata.
1140
+ */
1141
+ interface UpdateChatParams {
1142
+ title?: string;
1143
+ isPrivate?: boolean;
1144
+ /** Move the chat to a named folder (e.g. `"pinned"`, `"archived"`, or a custom name). */
1145
+ folder?: string;
1146
+ }
1147
+ /**
1148
+ * Grouped chat list response.
1149
+ *
1150
+ * Keys are dynamic folder names: at minimum `"chats"`, `"pinned"`, and
1151
+ * `"archived"` are present; user-created custom folders appear as additional keys.
1152
+ *
1153
+ * @example
1154
+ * ```ts
1155
+ * const list: ChatListResponse = await client.chats.list();
1156
+ * const pinned = list['pinned'] ?? [];
1157
+ * ```
1158
+ */
1159
+ type ChatListResponse = Record<string, ChatResponse[]>;
1160
+
1161
+ /**
1162
+ * Types for credential management and MCP server connections.
1163
+ * @module types/credentials
1164
+ */
1165
+ /**
1166
+ * A stored credential record as returned by the API.
1167
+ */
1168
+ interface CredentialResponse {
1169
+ credential_id: string;
1170
+ integration_name: string;
1171
+ /** Integration category (e.g. `"tool"`, `"llm"`, `"knowledge"`). */
1172
+ integration_type: string;
1173
+ /** Human-readable label for the credential. */
1174
+ display_name: string;
1175
+ /** Auth mechanism used (e.g. `"api_key"`, `"oauth2"`, `"basic"`). */
1176
+ auth_type: string;
1177
+ /** Whether this is the default credential for its integration. */
1178
+ is_default: boolean;
1179
+ created_at: string;
1180
+ updated_at: string;
1181
+ last_used_at?: string | null;
1182
+ expires_at?: string | null;
1183
+ }
1184
+ /**
1185
+ * Parameters for creating a new credential.
1186
+ */
1187
+ interface CreateCredentialParams {
1188
+ /** Integration name to create the credential for (e.g. `"openai"`). */
1189
+ integrationName: string;
1190
+ /** Auth data object — shape depends on `authType` and the integration. */
1191
+ authData?: Record<string, unknown>;
1192
+ /** Auth mechanism (e.g. `"api_key"`, `"oauth2"`). */
1193
+ authType?: string;
1194
+ /** Human-readable label. Defaults to the integration display name. */
1195
+ displayName?: string;
1196
+ /** Arbitrary metadata to associate with the credential. */
1197
+ metadata?: Record<string, unknown>;
1198
+ /** Whether to set this credential as the default for its integration. */
1199
+ makeDefault?: boolean;
1200
+ /** OAuth2-specific configuration when creating via OAuth. */
1201
+ oauthConfig?: Record<string, unknown>;
1202
+ /** ISO-8601 datetime after which the credential should be considered expired. */
1203
+ expiresAt?: string;
1204
+ }
1205
+ /**
1206
+ * Parameters for updating an existing credential.
1207
+ */
1208
+ interface UpdateCredentialParams {
1209
+ displayName?: string;
1210
+ metadata?: Record<string, unknown>;
1211
+ }
1212
+ /**
1213
+ * A single integration group entry within the grouped credential list.
1214
+ */
1215
+ interface CredentialIntegrationGroup {
1216
+ integration_name: string;
1217
+ integration_type: string;
1218
+ total_count: number;
1219
+ auth_types: string[];
1220
+ credentials: CredentialResponse[];
1221
+ }
1222
+ /**
1223
+ * Credential list response in grouped-by-integration format.
1224
+ * Returned when no `integrationName` filter is applied.
1225
+ */
1226
+ interface CredentialListGrouped {
1227
+ integrations: Record<string, CredentialIntegrationGroup>;
1228
+ total_credentials: number;
1229
+ total_integrations: number;
1230
+ filters: Record<string, unknown>;
1231
+ }
1232
+ /**
1233
+ * Credential list response in flat format.
1234
+ * Returned when an `integrationName` filter is applied.
1235
+ */
1236
+ interface CredentialListFlat {
1237
+ credentials: CredentialResponse[];
1238
+ total_count: number;
1239
+ integration_name: string | null;
1240
+ filters: Record<string, unknown>;
1241
+ }
1242
+ /**
1243
+ * Query parameters for listing credentials.
1244
+ */
1245
+ interface CredentialListParams {
1246
+ integrationName?: string;
1247
+ authType?: string;
1248
+ limit?: number;
1249
+ offset?: number;
1250
+ }
1251
+ /**
1252
+ * Parameters for testing a temporary (unsaved) credential.
1253
+ */
1254
+ interface TestTemporaryParams {
1255
+ integrationName: string;
1256
+ authType: string;
1257
+ authData: Record<string, unknown>;
1258
+ }
1259
+ /**
1260
+ * Response from testing a temporary credential before saving it.
1261
+ */
1262
+ interface TestTemporaryResponse {
1263
+ is_valid: boolean;
1264
+ message: string;
1265
+ tested_at: string;
1266
+ test_method: string;
1267
+ integration_name: string;
1268
+ auth_type: string;
1269
+ /** Endpoint that was contacted during the test, if applicable. */
1270
+ test_endpoint?: string | null;
1271
+ /** HTTP status code returned by the test endpoint, if applicable. */
1272
+ status_code?: number | null;
1273
+ /** Relative API cost of the test call (e.g. `"free"`, `"low"`, `"medium"`). */
1274
+ cost_level?: string | null;
1275
+ }
1276
+ /**
1277
+ * Response from testing an existing saved credential.
1278
+ */
1279
+ interface TestCredentialResponse {
1280
+ credential_id: string;
1281
+ is_valid: boolean;
1282
+ message: string;
1283
+ tested_at: string;
1284
+ }
1285
+ /**
1286
+ * Query parameters for fetching credential usage statistics.
1287
+ */
1288
+ interface CredentialUsageParams {
1289
+ startDate?: string;
1290
+ endDate?: string;
1291
+ }
1292
+ /**
1293
+ * Usage statistics for a credential over a date range.
1294
+ */
1295
+ interface CredentialUsageResponse {
1296
+ credential_id: string;
1297
+ total_calls: number;
1298
+ successful_calls: number;
1299
+ failed_calls: number;
1300
+ /** Success rate as a fraction (0–1). */
1301
+ success_rate: number;
1302
+ /** Call counts broken down by action / operation name. */
1303
+ action_breakdown: Record<string, number>;
1304
+ start_date: string;
1305
+ end_date: string;
1306
+ }
1307
+ /**
1308
+ * Query parameters for paginating a credential's audit log.
1309
+ */
1310
+ interface CredentialAuditParams {
1311
+ limit?: number;
1312
+ offset?: number;
1313
+ }
1314
+ /**
1315
+ * Parameters for connecting a Model Context Protocol (MCP) server as a credential.
1316
+ */
1317
+ interface McpServerParams {
1318
+ /** URL of the MCP server. */
1319
+ serverUrl: string;
1320
+ /** Additional HTTP headers sent to the MCP server on each request. */
1321
+ headers?: Record<string, string>;
1322
+ /** Human-readable label for this MCP server credential. */
1323
+ displayName?: string;
1324
+ /** Whether to set this as the default MCP credential. */
1325
+ makeDefault?: boolean;
1326
+ }
1327
+ /**
1328
+ * Response listing tools discovered from an MCP server credential.
1329
+ */
1330
+ interface McpToolsResponse {
1331
+ credential_id: string;
1332
+ /** Array of tool descriptors in MCP schema format. */
1333
+ tools: Record<string, unknown>[];
1334
+ total_count: number;
1335
+ }
1336
+ /**
1337
+ * Response from refreshing the tool discovery cache for an MCP server credential.
1338
+ */
1339
+ interface RefreshDiscoveryResponse {
1340
+ credential_id: string;
1341
+ refreshed_at: string;
1342
+ /** Summary of what changed (added / removed tools). */
1343
+ changes: Record<string, unknown>;
1344
+ total_tools: number;
1345
+ success: boolean;
1346
+ }
1347
+
1348
+ /**
1349
+ * Types for browsing the integration catalog and fetching provider details.
1350
+ * @module types/integrations
1351
+ */
1352
+ /**
1353
+ * Query parameters for browsing the integration catalog.
1354
+ */
1355
+ interface BrowseParams {
1356
+ /** Filter by category (e.g. `"communication"`, `"storage"`, `"llm"`). */
1357
+ category?: string;
1358
+ /** Filter by integration type (e.g. `"tool"`, `"llm_provider"`, `"knowledge_provider"`). */
1359
+ type?: string;
1360
+ /** Filter by supported auth type (e.g. `"api_key"`, `"oauth2"`). */
1361
+ authType?: string;
1362
+ /** Full-text search query against name and description. */
1363
+ search?: string;
1364
+ /** Whether to include full action/schema details in the response. */
1365
+ includeDetails?: boolean;
1366
+ /** Whether to return a paginated response. */
1367
+ paginate?: boolean;
1368
+ page?: number;
1369
+ pageSize?: number;
1370
+ }
1371
+ /**
1372
+ * Response from the catalog browse endpoint.
1373
+ */
1374
+ interface BrowseResponse {
1375
+ integrations: IntegrationResponse[];
1376
+ total: number;
1377
+ page?: number;
1378
+ page_size?: number;
1379
+ total_pages?: number;
1380
+ }
1381
+ /**
1382
+ * Generic integration object as returned by catalog and detail endpoints.
1383
+ * Fields beyond the listed ones are provider-specific and accessed via the index signature.
1384
+ */
1385
+ interface IntegrationResponse {
1386
+ name: string;
1387
+ /** Integration category (e.g. `"tool"`, `"llm_provider"`, `"knowledge_provider"`). */
1388
+ type: string;
1389
+ display_name?: string;
1390
+ description?: string;
1391
+ /** Available action/service names. */
1392
+ actions?: string[];
1393
+ /** Authentication schema descriptors. */
1394
+ auth_schemas?: Record<string, unknown>[];
1395
+ icon_url?: string;
1396
+ [key: string]: unknown;
1397
+ }
1398
+ /**
1399
+ * Detailed tool integration response including action definitions.
1400
+ */
1401
+ interface ToolIntegrationResponse {
1402
+ integration_name: string;
1403
+ display_name?: string;
1404
+ description?: string;
1405
+ /** Map of action name to action descriptor. */
1406
+ actions?: Record<string, unknown>;
1407
+ auth_types?: string[];
1408
+ [key: string]: unknown;
1409
+ }
1410
+ /**
1411
+ * Detailed LLM provider response including available models.
1412
+ */
1413
+ interface LLMProviderResponse {
1414
+ provider_name: string;
1415
+ display_name?: string;
1416
+ models?: Record<string, unknown>[];
1417
+ auth_types?: string[];
1418
+ [key: string]: unknown;
1419
+ }
1420
+ /**
1421
+ * Detailed knowledge provider response including supported collection features.
1422
+ */
1423
+ interface KnowledgeProviderResponse {
1424
+ provider_name: string;
1425
+ display_name?: string;
1426
+ auth_types?: string[];
1427
+ [key: string]: unknown;
1428
+ }
1429
+
1430
+ /**
1431
+ * Types for knowledge base management, document ingestion, and semantic search.
1432
+ * @module types/knowledge
1433
+ */
1434
+ /**
1435
+ * Configuration for the embedding model used to vectorize documents and queries.
1436
+ */
1437
+ interface EmbeddingConfig {
1438
+ /** Credential ID for the embedding provider. */
1439
+ provider_credential_id?: string;
1440
+ /** Provider name (e.g. `"openai"`, `"cohere"`). */
1441
+ provider?: string;
1442
+ /** Model identifier (e.g. `"text-embedding-3-small"`). */
1443
+ model?: string;
1444
+ /** Expected vector dimension for the model. */
1445
+ dimension?: number;
1446
+ }
1447
+ /**
1448
+ * Configuration for how documents are split into chunks before indexing.
1449
+ */
1450
+ interface ChunkingConfig {
1451
+ /** Chunking strategy (e.g. `"recursive"`, `"sentence"`, `"fixed"`). */
1452
+ strategy?: string;
1453
+ /** Target token/character count per chunk. */
1454
+ chunk_size?: number;
1455
+ /** Overlap in tokens/characters between consecutive chunks. */
1456
+ overlap?: number;
1457
+ /** Custom separator strings used by recursive/sentence strategies. */
1458
+ separators?: string[];
1459
+ }
1460
+ /**
1461
+ * Parameters for creating a new knowledge base.
1462
+ */
1463
+ interface CreateKnowledgeBaseParams {
1464
+ name: string;
1465
+ description?: string;
1466
+ /** Embedding model configuration for this knowledge base. */
1467
+ embeddingConfig?: EmbeddingConfig;
1468
+ /** Chunking strategy configuration for ingested documents. */
1469
+ chunkingConfig?: ChunkingConfig;
1470
+ }
1471
+ /**
1472
+ * Parameters for updating an existing knowledge base.
1473
+ * All fields are optional; only provided fields are updated.
1474
+ */
1475
+ interface UpdateKnowledgeBaseParams {
1476
+ name?: string;
1477
+ description?: string;
1478
+ embeddingConfig?: EmbeddingConfig;
1479
+ chunkingConfig?: ChunkingConfig;
1480
+ /** Lifecycle status (e.g. `"active"`, `"paused"`). */
1481
+ status?: string;
1482
+ }
1483
+ /**
1484
+ * A knowledge base record as returned by the API.
1485
+ */
1486
+ interface KnowledgeBaseResponse {
1487
+ id: string;
1488
+ name: string;
1489
+ description: string | null;
1490
+ organization_id: string;
1491
+ embedding_config: EmbeddingConfig;
1492
+ chunking_config: ChunkingConfig;
1493
+ /** Lifecycle status (e.g. `"active"`, `"building"`, `"error"`). */
1494
+ status: string;
1495
+ document_count?: number;
1496
+ total_chunks?: number;
1497
+ created_at: string;
1498
+ updated_at: string;
1499
+ }
1500
+ /**
1501
+ * Query parameters for listing knowledge bases.
1502
+ */
1503
+ interface KnowledgeBaseListParams {
1504
+ status?: string;
1505
+ limit?: number;
1506
+ offset?: number;
1507
+ }
1508
+ /**
1509
+ * Paginated list of knowledge bases.
1510
+ */
1511
+ interface KnowledgeBaseListResponse {
1512
+ knowledge_bases: KnowledgeBaseResponse[];
1513
+ total: number;
1514
+ limit: number;
1515
+ offset: number;
1516
+ }
1517
+ /**
1518
+ * Aggregated statistics across all knowledge bases in an organization.
1519
+ * The shape is extensible; provider-specific fields may be present.
1520
+ */
1521
+ interface KnowledgeBaseStatsResponse {
1522
+ [key: string]: unknown;
1523
+ }
1524
+ /**
1525
+ * A document record as returned by the API.
1526
+ */
1527
+ interface DocumentResponse {
1528
+ id: string;
1529
+ knowledge_base_id: string;
1530
+ filename: string;
1531
+ file_type: string;
1532
+ file_size: number;
1533
+ /** Processing status (e.g. `"pending"`, `"processing"`, `"ready"`, `"error"`). */
1534
+ status: string;
1535
+ metadata?: Record<string, unknown>;
1536
+ chunk_count?: number;
1537
+ created_at: string;
1538
+ updated_at: string;
1539
+ }
1540
+ /**
1541
+ * Query parameters for listing documents within a knowledge base.
1542
+ */
1543
+ interface DocumentListParams {
1544
+ status?: string;
1545
+ limit?: number;
1546
+ offset?: number;
1547
+ }
1548
+ /**
1549
+ * Parameters for uploading a document to a knowledge base.
1550
+ */
1551
+ interface UploadDocumentParams {
1552
+ /** File content as a Blob or File object. */
1553
+ file: Blob | File;
1554
+ /** Override the filename stored with the document. */
1555
+ filename?: string;
1556
+ /** Arbitrary metadata to associate with the document. */
1557
+ metadata?: Record<string, unknown>;
1558
+ }
1559
+ /**
1560
+ * Status and progress of a document being processed.
1561
+ */
1562
+ interface DocumentStatusResponse {
1563
+ status: string;
1564
+ /** Processing progress as a fraction (0–1). */
1565
+ progress?: number;
1566
+ error?: string;
1567
+ }
1568
+ /**
1569
+ * A single document chunk as returned by the chunks endpoint or a search result.
1570
+ */
1571
+ interface ChunkResponse {
1572
+ id: string;
1573
+ content: string;
1574
+ metadata?: Record<string, unknown>;
1575
+ /** Similarity score (0–1). Present only in search results. */
1576
+ score?: number;
1577
+ }
1578
+ /**
1579
+ * Query parameters for listing chunks within a document.
1580
+ */
1581
+ interface DocumentChunksParams {
1582
+ limit?: number;
1583
+ offset?: number;
1584
+ }
1585
+ /**
1586
+ * Response from the document chunks endpoint.
1587
+ */
1588
+ interface DocumentChunksResponse {
1589
+ chunks: ChunkResponse[];
1590
+ count: number;
1591
+ }
1592
+ /**
1593
+ * Parameters for semantic search within a single knowledge base.
1594
+ */
1595
+ interface SearchParams {
1596
+ query: string;
1597
+ topK?: number;
1598
+ minScore?: number;
1599
+ filters?: Record<string, unknown>;
1600
+ includeContent?: boolean;
1601
+ includeMetadata?: boolean;
1602
+ }
1603
+ /**
1604
+ * A single search result entry.
1605
+ */
1606
+ interface SearchResult {
1607
+ chunk_id: string;
1608
+ content: string;
1609
+ score: number;
1610
+ metadata: Record<string, unknown>;
1611
+ document_id: string;
1612
+ }
1613
+ /**
1614
+ * Response from a knowledge base search.
1615
+ */
1616
+ interface SearchResponse {
1617
+ results: SearchResult[];
1618
+ query: string;
1619
+ total: number;
1620
+ }
1621
+ /**
1622
+ * Parameters for searching across multiple knowledge bases simultaneously.
1623
+ */
1624
+ interface MultiSearchParams {
1625
+ knowledgeBaseIds: string[];
1626
+ query: string;
1627
+ topK?: number;
1628
+ minScore?: number;
1629
+ }
1630
+ /**
1631
+ * Parameters for hybrid (semantic + keyword) search within a knowledge base.
1632
+ */
1633
+ interface HybridSearchParams {
1634
+ query: string;
1635
+ topK?: number;
1636
+ /** Relative weight given to keyword matching (0–1). */
1637
+ keywordWeight?: number;
1638
+ /** Relative weight given to semantic similarity (0–1). */
1639
+ semanticWeight?: number;
1640
+ minScore?: number;
1641
+ filters?: Record<string, unknown>;
1642
+ }
1643
+ /**
1644
+ * Parameters for retrieving a pre-formatted context string from a knowledge base.
1645
+ */
1646
+ interface RetrieveContextParams {
1647
+ query: string;
1648
+ /** Maximum token budget for the returned context string. */
1649
+ maxTokens?: number;
1650
+ topK?: number;
1651
+ minScore?: number;
1652
+ }
1653
+ /**
1654
+ * Response from the context retrieval endpoint.
1655
+ */
1656
+ interface RetrieveContextResponse {
1657
+ /** Pre-formatted context string suitable for injection into a prompt. */
1658
+ context: string;
1659
+ query: string;
1660
+ }
1661
+ /**
1662
+ * Response listing the file types accepted by the document ingestion pipeline.
1663
+ */
1664
+ interface SupportedFileTypesResponse {
1665
+ supported_types: string[];
1666
+ max_file_size_bytes: number;
1667
+ max_file_size_mb: number;
1668
+ }
1669
+
1670
+ /**
1671
+ * Types for workflow schedule management and scheduled run history.
1672
+ * @module types/schedules
1673
+ */
1674
+ /**
1675
+ * Parameters for creating a new workflow schedule.
1676
+ */
1677
+ interface CreateScheduleParams {
1678
+ /** ID of the workflow to run on this schedule. */
1679
+ workflowId: string;
1680
+ name: string;
1681
+ description?: string;
1682
+ /** How the schedule recurrence is defined. */
1683
+ scheduleType: 'interval' | 'cron';
1684
+ /** Recurrence interval in seconds. Required when `scheduleType` is `"interval"`. */
1685
+ intervalSeconds?: number;
1686
+ /** Cron expression string. Required when `scheduleType` is `"cron"`. */
1687
+ cronExpression?: string;
1688
+ /** IANA timezone name (e.g. `"America/New_York"`). Defaults to `"UTC"`. */
1689
+ timezone?: string;
1690
+ /** State input passed to the workflow on each scheduled run. */
1691
+ input?: Record<string, unknown>;
1692
+ /** Runtime config overrides applied to each scheduled run. */
1693
+ config?: Record<string, unknown>;
1694
+ }
1695
+ /**
1696
+ * Parameters for updating an existing schedule.
1697
+ * All fields are optional; only provided fields are updated.
1698
+ */
1699
+ interface UpdateScheduleParams {
1700
+ workflowId?: string;
1701
+ name?: string;
1702
+ description?: string;
1703
+ scheduleType?: 'interval' | 'cron';
1704
+ intervalSeconds?: number;
1705
+ cronExpression?: string;
1706
+ timezone?: string;
1707
+ isActive?: boolean;
1708
+ input?: Record<string, unknown>;
1709
+ config?: Record<string, unknown>;
1710
+ }
1711
+ /**
1712
+ * A schedule record as returned by the API.
1713
+ */
1714
+ interface ScheduleResponse {
1715
+ id: string;
1716
+ workflow_id: string;
1717
+ name: string;
1718
+ description: string | null;
1719
+ schedule_type: 'interval' | 'cron';
1720
+ interval_seconds?: number | null;
1721
+ cron_expression?: string | null;
1722
+ /** IANA timezone name. */
1723
+ timezone: string;
1724
+ is_active: boolean;
1725
+ input?: Record<string, unknown> | null;
1726
+ config?: Record<string, unknown> | null;
1727
+ next_run_at?: string | null;
1728
+ last_run_at?: string | null;
1729
+ created_at: string;
1730
+ updated_at: string;
1731
+ created_by: string;
1732
+ }
1733
+ /**
1734
+ * Query parameters for listing schedules.
1735
+ */
1736
+ interface ScheduleListParams {
1737
+ workflowId?: string;
1738
+ isActive?: boolean;
1739
+ limit?: number;
1740
+ offset?: number;
1741
+ }
1742
+ /**
1743
+ * Paginated list of schedules.
1744
+ */
1745
+ interface ScheduleListResponse {
1746
+ schedules: ScheduleResponse[];
1747
+ total: number;
1748
+ limit: number;
1749
+ offset: number;
1750
+ }
1751
+ /**
1752
+ * A single scheduled run record.
1753
+ */
1754
+ interface ScheduleRunResponse {
1755
+ id: string;
1756
+ schedule_id: string;
1757
+ /** Run status (e.g. `"completed"`, `"failed"`, `"running"`). */
1758
+ status: string;
1759
+ started_at: string;
1760
+ completed_at?: string | null;
1761
+ error?: string | null;
1762
+ duration_ms?: number | null;
1763
+ }
1764
+ /**
1765
+ * Query parameters for listing runs belonging to a schedule.
1766
+ */
1767
+ interface ScheduleRunListParams {
1768
+ status?: string;
1769
+ limit?: number;
1770
+ offset?: number;
1771
+ }
1772
+ /**
1773
+ * Query parameters for fetching aggregate run statistics.
1774
+ */
1775
+ interface ScheduleRunStatsParams {
1776
+ /** Number of past days to include in the stats window. */
1777
+ days?: number;
1778
+ }
1779
+ /**
1780
+ * Aggregate run statistics for a schedule.
1781
+ */
1782
+ interface ScheduleRunStatsResponse {
1783
+ total_runs: number;
1784
+ successful_runs: number;
1785
+ failed_runs: number;
1786
+ average_duration_ms: number;
1787
+ }
1788
+
1789
+ /**
1790
+ * Types for workflow templates and creator profiles.
1791
+ * @module types/templates
1792
+ */
1793
+
1794
+ /**
1795
+ * Public profile information for a template creator.
1796
+ */
1797
+ interface CreatorInfo {
1798
+ name: string;
1799
+ display_photo?: string | null;
1800
+ about?: string | null;
1801
+ /** Map of social platform name to profile URL. */
1802
+ socials?: Record<string, string>;
1803
+ }
1804
+ /**
1805
+ * A template record as returned by the API.
1806
+ */
1807
+ interface TemplateResponse {
1808
+ id: string;
1809
+ creator_id: string;
1810
+ creator?: CreatorInfo | null;
1811
+ name: string;
1812
+ description: string | null;
1813
+ tags: string[];
1814
+ workflow_schema: WorkflowDefinition;
1815
+ input?: Record<string, unknown> | null;
1816
+ config?: Record<string, unknown> | null;
1817
+ schema_image_url?: string | null;
1818
+ /** Sharing visibility (e.g. `"private"`, `"public"`). */
1819
+ visibility: string;
1820
+ /** Lifecycle status (e.g. `"draft"`, `"published"`). */
1821
+ status: string;
1822
+ like_count: number;
1823
+ used_count: number;
1824
+ /** Whether the authenticated user has liked this template. */
1825
+ is_liked?: boolean;
1826
+ edit_version?: number | null;
1827
+ created_at: string;
1828
+ updated_at: string;
1829
+ }
1830
+ /**
1831
+ * Response from the public template browse endpoint.
1832
+ */
1833
+ interface TemplateListResponse {
1834
+ templates: TemplateResponse[];
1835
+ /** Whether the response was served from cache. */
1836
+ cached?: boolean;
1837
+ }
1838
+ /**
1839
+ * Response from listing templates created by the authenticated user.
1840
+ */
1841
+ interface MyTemplatesResponse {
1842
+ templates: TemplateResponse[];
1843
+ total: number;
1844
+ }
1845
+ /**
1846
+ * Parameters for publishing a workflow as a template.
1847
+ */
1848
+ interface CreateTemplateParams {
1849
+ /** ID of the saved workflow to publish as a template. */
1850
+ workflowId: string;
1851
+ name?: string;
1852
+ description?: string;
1853
+ tags?: string[];
1854
+ /** URL to a preview image of the workflow canvas. */
1855
+ schemaImageUrl?: string;
1856
+ }
1857
+ /**
1858
+ * Response from using (importing) a template into the user's workspace.
1859
+ */
1860
+ interface TemplateUseResponse {
1861
+ success: boolean;
1862
+ message: string;
1863
+ /** The newly created workflow in the user's workspace. */
1864
+ workflow: WorkflowResponse;
1865
+ used_count: number;
1866
+ }
1867
+ /**
1868
+ * Response from liking or un-liking a template.
1869
+ */
1870
+ interface TemplateLikeResponse {
1871
+ success: boolean;
1872
+ /** `true` if the template is now liked, `false` if the like was removed. */
1873
+ liked: boolean;
1874
+ like_count: number;
1875
+ }
1876
+ /**
1877
+ * Parameters for requesting an update to a published template.
1878
+ */
1879
+ interface UpdateTemplateRequestParams {
1880
+ /** ID of the updated workflow to sync into the template. */
1881
+ workflowId: string;
1882
+ name?: string;
1883
+ description?: string;
1884
+ tags?: string[];
1885
+ schemaImageUrl?: string;
1886
+ }
1887
+ /**
1888
+ * Parameters for creating or updating a template creator profile.
1889
+ */
1890
+ interface CreateCreatorParams {
1891
+ name: string;
1892
+ about?: string;
1893
+ displayPhoto?: string;
1894
+ /** Map of social platform name to profile URL. */
1895
+ socials?: Record<string, string>;
1896
+ }
1897
+
1898
+ /**
1899
+ * Types for the AI Composer — a chat-driven workflow builder.
1900
+ * @module types/composer
1901
+ */
1902
+
1903
+ /**
1904
+ * Parameters for starting a new Composer chat or sending a message to an existing one.
1905
+ */
1906
+ interface ComposerChatParams {
1907
+ /** ID of an existing saved workflow to attach to this Composer session. */
1908
+ workflowId?: string;
1909
+ /** ID of an existing Composer chat to continue. Omit to start a new session. */
1910
+ composerChatId?: string;
1911
+ /** The user's message to the Composer AI. */
1912
+ message: string;
1913
+ /** Override the LLM used by the Composer AI. */
1914
+ llm?: LLMConfig;
1915
+ }
1916
+ /**
1917
+ * Response from starting or continuing a Composer chat session.
1918
+ */
1919
+ interface ComposerChatResponse {
1920
+ status: string;
1921
+ composer_chat_id: string;
1922
+ workflow_id: string | null;
1923
+ run_id: string;
1924
+ thread_id: string;
1925
+ /** URL to an SSE stream for real-time Composer output. */
1926
+ stream_url: string;
1927
+ }
1928
+ /**
1929
+ * A single message within a Composer chat conversation.
1930
+ */
1931
+ interface ComposerMessageResponse {
1932
+ id: string;
1933
+ role: 'human' | 'ai' | 'system';
1934
+ content: string;
1935
+ created_at: string;
1936
+ }
1937
+ /**
1938
+ * Full Composer chat detail including messages and workflow snapshot status.
1939
+ */
1940
+ interface ComposerChatDetailResponse {
1941
+ id: string;
1942
+ workflow_id: string | null;
1943
+ messages: ComposerMessageResponse[];
1944
+ /** Whether there is a saved workflow snapshot associated with this chat. */
1945
+ snapshot_status: string | null;
1946
+ /** Whether the AI has produced changes not yet saved to the workflow. */
1947
+ has_pending_changes: boolean;
1948
+ created_at: string;
1949
+ updated_at: string;
1950
+ }
1951
+ /**
1952
+ * Real-time status of a Composer chat session.
1953
+ */
1954
+ interface ComposerStatusResponse {
1955
+ composer_chat_id: string;
1956
+ workflow_id: string | null;
1957
+ is_running: boolean;
1958
+ running_id: string | null;
1959
+ has_pending_changes: boolean;
1960
+ /** Status of the most recent run attached to this Composer session. */
1961
+ run_status: string | null;
1962
+ }
1963
+ /**
1964
+ * Query parameters for listing Composer chat history.
1965
+ */
1966
+ interface ComposerHistoryParams {
1967
+ limit?: number;
1968
+ }
1969
+ /**
1970
+ * Parameters for deleting a Composer chat session.
1971
+ */
1972
+ interface ComposerDeleteParams {
1973
+ /** If `true`, also permanently delete the associated workflow. */
1974
+ permanent?: boolean;
1975
+ }
1976
+
1977
+ /**
1978
+ * Types for the organization dashboard — activity logs, analytics, and user management.
1979
+ * @module types/dashboard
1980
+ */
1981
+ /**
1982
+ * Query parameters for fetching organization activity logs.
1983
+ */
1984
+ interface DashboardLogsParams {
1985
+ limit?: number;
1986
+ offset?: number;
1987
+ /** Filter by log category (e.g. `"workflow"`, `"credential"`, `"auth"`). */
1988
+ category?: string;
1989
+ /** Filter by operation type (e.g. `"run"`, `"create"`, `"delete"`). */
1990
+ operation?: string;
1991
+ /** ISO-8601 start date for the log window. */
1992
+ startDate?: string;
1993
+ /** ISO-8601 end date for the log window. */
1994
+ endDate?: string;
1995
+ }
1996
+ /**
1997
+ * A single activity log entry.
1998
+ */
1999
+ interface ActivityLogEntry {
2000
+ id: string;
2001
+ category: string;
2002
+ operation: string;
2003
+ user_id: string;
2004
+ resource_id?: string | null;
2005
+ resource_type?: string | null;
2006
+ metadata?: Record<string, unknown>;
2007
+ created_at: string;
2008
+ }
2009
+ /**
2010
+ * Pagination metadata embedded in log responses.
2011
+ */
2012
+ interface LogsPaginationData {
2013
+ logs: ActivityLogEntry[];
2014
+ total_count: number;
2015
+ limit: number;
2016
+ offset: number;
2017
+ has_next: boolean;
2018
+ has_previous: boolean;
2019
+ }
2020
+ /**
2021
+ * Response from the dashboard logs endpoint.
2022
+ */
2023
+ interface DashboardLogsResponse {
2024
+ success: boolean;
2025
+ organization_id: string;
2026
+ data: LogsPaginationData;
2027
+ filters: Record<string, unknown>;
2028
+ meta: Record<string, unknown>;
2029
+ }
2030
+ /**
2031
+ * Query parameters for the analytics overview endpoint.
2032
+ */
2033
+ interface AnalyticsOverviewParams {
2034
+ limit?: number;
2035
+ offset?: number;
2036
+ }
2037
+ /**
2038
+ * Response from the analytics overview endpoint.
2039
+ */
2040
+ interface AnalyticsOverviewResponse {
2041
+ success: boolean;
2042
+ organization_id: string;
2043
+ data: {
2044
+ overview: Record<string, unknown>;
2045
+ };
2046
+ meta: Record<string, unknown>;
2047
+ }
2048
+ /**
2049
+ * Query parameters for the tools analytics endpoint.
2050
+ */
2051
+ interface AnalyticsToolsParams {
2052
+ /** Aggregation period (e.g. `"24h"`, `"7d"`, `"30d"`, `"90d"`). */
2053
+ period?: string;
2054
+ limit?: number;
2055
+ offset?: number;
2056
+ }
2057
+ /**
2058
+ * Response from the tools analytics endpoint.
2059
+ */
2060
+ interface AnalyticsToolsResponse {
2061
+ success: boolean;
2062
+ organization_id: string;
2063
+ data: Record<string, unknown>;
2064
+ meta: Record<string, unknown>;
2065
+ }
2066
+ /**
2067
+ * Response from the LLM usage analytics endpoint.
2068
+ */
2069
+ interface AnalyticsLLMUsageResponse {
2070
+ success: boolean;
2071
+ organization_id: string;
2072
+ data: Record<string, unknown>;
2073
+ meta: Record<string, unknown>;
2074
+ }
2075
+ /**
2076
+ * Query parameters for listing organization members from the dashboard.
2077
+ */
2078
+ interface DashboardUsersParams {
2079
+ search?: string;
2080
+ /** Filter by member status (e.g. `"active"`, `"invited"`, `"suspended"`). */
2081
+ status?: string;
2082
+ /** Field to sort by (e.g. `"created_at"`, `"email"`). */
2083
+ sortBy?: string;
2084
+ /** Sort direction — `"asc"` or `"desc"`. */
2085
+ order?: string;
2086
+ page?: number;
2087
+ limit?: number;
2088
+ }
2089
+ /**
2090
+ * Response from the dashboard users endpoint.
2091
+ */
2092
+ interface DashboardUsersResponse {
2093
+ success: boolean;
2094
+ organization_id: string;
2095
+ users: Record<string, unknown>[];
2096
+ invitation_count: number;
2097
+ max_seats: number;
2098
+ total: number;
2099
+ total_pages: number;
2100
+ current_page: number;
2101
+ limit: number;
2102
+ has_next: boolean;
2103
+ has_previous: boolean;
2104
+ }
2105
+
2106
+ /**
2107
+ * Types for subscription plans, billing, and payment portal management.
2108
+ * @module types/subscriptions
2109
+ */
2110
+ /**
2111
+ * A single price option for a plan (monthly or yearly).
2112
+ */
2113
+ interface PlanPrice {
2114
+ price: number;
2115
+ /** Billing interval (e.g. `"month"`, `"year"`). */
2116
+ interval: string;
2117
+ /** ISO-4217 currency code (e.g. `"usd"`). */
2118
+ currency: string;
2119
+ }
2120
+ /**
2121
+ * A subscription plan available to organizations.
2122
+ */
2123
+ interface Plan {
2124
+ id: string;
2125
+ name: string;
2126
+ /** Display sort order on the pricing page. */
2127
+ sort_order: number;
2128
+ is_enterprise: boolean;
2129
+ /** Discount percentage (0–100). */
2130
+ discount: number;
2131
+ prices: PlanPrice[];
2132
+ /** List of feature descriptions included in this plan. */
2133
+ features: string[];
2134
+ /** Whether the plan can be self-selected (vs. sales-only). */
2135
+ is_selectable?: boolean;
2136
+ }
2137
+ /**
2138
+ * Response from listing available organization plans.
2139
+ */
2140
+ interface OrganizationPlansResponse {
2141
+ plans: Plan[];
2142
+ total: number;
2143
+ }
2144
+ /**
2145
+ * An active subscription record.
2146
+ */
2147
+ interface Subscription {
2148
+ id: string;
2149
+ /** Stripe/payment-provider subscription status (e.g. `"active"`, `"past_due"`). */
2150
+ status: string;
2151
+ current_period_start: string;
2152
+ current_period_end: string;
2153
+ /** Current billing interval (`"month"` or `"year"`). */
2154
+ billing_interval: string;
2155
+ current_price: number;
2156
+ created_at: string;
2157
+ }
2158
+ /**
2159
+ * Billing information for an organization.
2160
+ */
2161
+ interface BillingResponse {
2162
+ has_subscription: boolean;
2163
+ subscription?: Subscription;
2164
+ plan?: Plan;
2165
+ }
2166
+ /**
2167
+ * Parameters for creating a Stripe Checkout session.
2168
+ */
2169
+ interface CheckoutParams {
2170
+ planId: string;
2171
+ interval: 'month' | 'year';
2172
+ }
2173
+ /**
2174
+ * Response from creating a Checkout session.
2175
+ */
2176
+ interface CheckoutResponse {
2177
+ /** Stripe Checkout URL — redirect the user here to complete payment. */
2178
+ url: string;
2179
+ }
2180
+ /**
2181
+ * Response from creating a Stripe Customer Portal session.
2182
+ */
2183
+ interface PortalResponse {
2184
+ /** Stripe Portal URL — redirect the user here to manage billing. */
2185
+ url: string;
2186
+ }
2187
+
2188
+ /**
2189
+ * Types for organization notifications.
2190
+ * @module types/notifications
2191
+ */
2192
+ /**
2193
+ * A notification record as returned by the API.
2194
+ */
2195
+ interface NotificationResponse {
2196
+ id: string;
2197
+ organization_id: string;
2198
+ user_id: string | null;
2199
+ notification_topic: string;
2200
+ message: string;
2201
+ notification_url?: string | null;
2202
+ is_read: boolean;
2203
+ expires_at?: string | null;
2204
+ created_at: string;
2205
+ updated_at: string;
2206
+ }
2207
+ /**
2208
+ * Response from listing notifications for an organization.
2209
+ */
2210
+ interface NotificationListResponse {
2211
+ success: boolean;
2212
+ notifications: NotificationResponse[];
2213
+ total: number;
2214
+ organization_id: string;
2215
+ }
2216
+ /**
2217
+ * Parameters for creating an organization notification.
2218
+ */
2219
+ interface CreateNotificationParams {
2220
+ /** The category / channel for the notification. */
2221
+ notificationTopic: 'integration' | 'attention';
2222
+ message: string;
2223
+ /** User ID to direct the notification to. Omit to send to all org members. */
2224
+ notifiedTo?: string;
2225
+ /** Deep-link URL associated with the notification. */
2226
+ notificationUrl?: string;
2227
+ /** ISO-8601 datetime after which the notification should be hidden. */
2228
+ expiresAt?: string;
2229
+ }
2230
+
2231
+ /**
2232
+ * Auth resource — identity and organization membership endpoints.
2233
+ * @module resources/auth
2234
+ */
2235
+
2236
+ /**
2237
+ * Provides methods for the `/auth` API endpoints.
2238
+ */
2239
+ declare class Auth extends BaseResource {
2240
+ /**
2241
+ * GET /auth/me
2242
+ *
2243
+ * Returns the authenticated user's profile.
2244
+ */
2245
+ me(options?: RequestOptions): Promise<UserResponse>;
2246
+ /**
2247
+ * GET /auth/me/organizations
2248
+ *
2249
+ * Returns the organizations the authenticated user belongs to.
2250
+ */
2251
+ organizations(params?: {
2252
+ role?: string;
2253
+ }, options?: RequestOptions): Promise<OrganizationsResponse>;
2254
+ /**
2255
+ * GET /auth/invitations/my
2256
+ *
2257
+ * Returns pending invitations for the authenticated user.
2258
+ */
2259
+ invitations(options?: RequestOptions): Promise<InvitationsResponse>;
2260
+ /**
2261
+ * POST /auth/invitations/{id}/accept
2262
+ *
2263
+ * Accepts a pending organization invitation.
2264
+ */
2265
+ acceptInvitation(invitationId: string, options?: RequestOptions): Promise<SuccessResponse>;
2266
+ /**
2267
+ * POST /auth/invitations/{id}/reject
2268
+ *
2269
+ * Rejects a pending organization invitation.
2270
+ */
2271
+ rejectInvitation(invitationId: string, options?: RequestOptions): Promise<SuccessResponse>;
2272
+ /**
2273
+ * POST /auth/organizations/leave
2274
+ *
2275
+ * Leaves the current organization (requires organization context).
2276
+ */
2277
+ leaveOrganization(options?: RequestOptions): Promise<LeaveResponse>;
2278
+ }
2279
+
2280
+ /**
2281
+ * ApiKeys resource — API key management endpoints.
2282
+ * @module resources/api-keys
2283
+ */
2284
+
2285
+ /**
2286
+ * Provides methods for the `/api-keys` API endpoints.
2287
+ */
2288
+ declare class ApiKeys extends BaseResource {
2289
+ /**
2290
+ * POST /api-keys
2291
+ *
2292
+ * Creates a new API key. The full key value is returned only once.
2293
+ */
2294
+ create(params: CreateApiKeyParams, options?: RequestOptions): Promise<CreateApiKeyResponse>;
2295
+ /**
2296
+ * GET /api-keys
2297
+ *
2298
+ * Lists all API keys for the authenticated user.
2299
+ */
2300
+ list(params?: {
2301
+ includeRevoked?: boolean;
2302
+ }, options?: RequestOptions): Promise<ApiKeyListResponse>;
2303
+ /**
2304
+ * GET /api-keys/{keyId}
2305
+ *
2306
+ * Returns details for a specific API key (masked — never the full key).
2307
+ */
2308
+ get(keyId: string, options?: RequestOptions): Promise<ApiKeyResponse>;
2309
+ /**
2310
+ * DELETE /api-keys/{keyId}
2311
+ *
2312
+ * Permanently revokes an API key.
2313
+ */
2314
+ revoke(keyId: string, options?: RequestOptions): Promise<RevokeApiKeyResponse>;
2315
+ }
2316
+
2317
+ /**
2318
+ * Organizations resource — organization management endpoints.
2319
+ * @module resources/organizations
2320
+ */
2321
+
2322
+ /**
2323
+ * Provides methods for the `/organizations` API endpoints.
2324
+ */
2325
+ declare class Organizations extends BaseResource {
2326
+ /**
2327
+ * POST /organizations
2328
+ *
2329
+ * Creates a new organization. The authenticated user becomes the owner.
2330
+ */
2331
+ create(params: CreateOrganizationParams, options?: RequestOptions): Promise<CreateOrganizationResponse>;
2332
+ /**
2333
+ * GET /organizations/llms
2334
+ *
2335
+ * Returns the LLM integrations configured for the current organization.
2336
+ */
2337
+ llms(options?: RequestOptions): Promise<LLMsResponse>;
2338
+ /**
2339
+ * POST /organizations/invite
2340
+ *
2341
+ * Sends an invitation email to add a user to the current organization.
2342
+ */
2343
+ invite(params: InviteParams, options?: RequestOptions): Promise<SuccessResponse>;
2344
+ /**
2345
+ * POST /organizations/invitations/{id}/cancel
2346
+ *
2347
+ * Cancels a pending organization invitation.
2348
+ */
2349
+ cancelInvitation(invitationId: string, options?: RequestOptions): Promise<CancelInvitationResponse>;
2350
+ /**
2351
+ * POST /organizations/invitations/{id}/reinvite
2352
+ *
2353
+ * Re-sends an invitation email for a pending invitation.
2354
+ */
2355
+ reinvite(invitationId: string, options?: RequestOptions): Promise<SuccessResponse>;
2356
+ /**
2357
+ * PUT /organizations/{orgId}/users/{userId}/role
2358
+ *
2359
+ * Updates a member's role within an organization.
2360
+ */
2361
+ updateRole(organizationId: string, userId: string, params: RoleUpdateParams, options?: RequestOptions): Promise<RoleUpdateResponse>;
2362
+ /**
2363
+ * DELETE /organizations/{orgId}/users/{userId}
2364
+ *
2365
+ * Removes a user from an organization. Requires owner permission.
2366
+ */
2367
+ removeUser(organizationId: string, userId: string, options?: RequestOptions): Promise<SuccessResponse>;
2368
+ }
2369
+
2370
+ /**
2371
+ * Workflows resource — workflow CRUD and builder endpoints.
2372
+ * @module resources/workflows
2373
+ */
2374
+
2375
+ /**
2376
+ * Provides methods for the `/workflows` API endpoints (CRUD and builder).
2377
+ */
2378
+ declare class Workflows extends BaseResource {
2379
+ /**
2380
+ * POST /workflows
2381
+ *
2382
+ * Creates a new workflow with the given schema.
2383
+ */
2384
+ create(params: CreateWorkflowParams, options?: RequestOptions): Promise<WorkflowResponse>;
2385
+ /**
2386
+ * GET /workflows
2387
+ *
2388
+ * Lists workflows in the current organization.
2389
+ */
2390
+ list(params?: WorkflowListParams, options?: RequestOptions): Promise<WorkflowListResponse>;
2391
+ /**
2392
+ * Auto-pagination — yields all WorkflowSummary records across pages.
2393
+ *
2394
+ * Fetches page=1 with pageSize=100 and continues until all pages have been
2395
+ * exhausted or there are no more results.
2396
+ */
2397
+ listAll(params?: Omit<WorkflowListParams, 'page' | 'pageSize'>, options?: RequestOptions): AsyncGenerator<WorkflowSummary>;
2398
+ /**
2399
+ * GET /workflows/{workflowId}
2400
+ *
2401
+ * Returns a full workflow object including the stored schema.
2402
+ */
2403
+ get(workflowId: string, options?: RequestOptions): Promise<WorkflowResponse>;
2404
+ /**
2405
+ * PUT /workflows/{workflowId}
2406
+ *
2407
+ * Updates an existing workflow. Only provided fields are changed.
2408
+ */
2409
+ update(workflowId: string, params: UpdateWorkflowParams, options?: RequestOptions): Promise<WorkflowResponse>;
2410
+ /**
2411
+ * DELETE /workflows/{workflowId}
2412
+ *
2413
+ * Soft-deletes a workflow.
2414
+ */
2415
+ delete(workflowId: string, options?: RequestOptions): Promise<DeleteWorkflowResponse>;
2416
+ /**
2417
+ * GET /workflows/builder/details
2418
+ *
2419
+ * Returns available node types, integration categories, and counts for
2420
+ * the visual workflow builder. Results are cached for 60 minutes.
2421
+ */
2422
+ builderDetails(params?: BuilderDetailsParams, options?: RequestOptions): Promise<BuilderDetailsResponse>;
2423
+ }
2424
+
2425
+ /**
2426
+ * Executions resource — workflow run, resume, cancel, listen, and state endpoints.
2427
+ * @module resources/executions
2428
+ */
2429
+
2430
+ /**
2431
+ * Provides methods for workflow execution endpoints under `/workflows`.
2432
+ */
2433
+ declare class Executions extends BaseResource {
2434
+ /**
2435
+ * POST /workflows/run
2436
+ *
2437
+ * Initiates a workflow run. Supports four modes: existing workflow, ad-hoc
2438
+ * workflow, direct LLM call, and system workflow. Returns immediately with
2439
+ * run metadata; stream events via `listen()`.
2440
+ */
2441
+ run(params: WorkflowRunParams, options?: RequestOptions): Promise<WorkflowRunResponse>;
2442
+ /**
2443
+ * GET /workflows/state/{threadId}
2444
+ *
2445
+ * Returns the persisted state snapshot of a workflow thread at its latest
2446
+ * checkpoint.
2447
+ */
2448
+ getState(threadId: string, options?: RequestOptions): Promise<WorkflowStateResponse>;
2449
+ /**
2450
+ * POST /workflows/resume/{threadId}
2451
+ *
2452
+ * Resumes a workflow that is waiting at an interrupt node.
2453
+ */
2454
+ resume(params: WorkflowResumeParams, options?: RequestOptions): Promise<WorkflowResumeResponse>;
2455
+ /**
2456
+ * POST /workflows/cancel/{runId}
2457
+ *
2458
+ * Requests cancellation of an in-progress workflow run.
2459
+ */
2460
+ cancel(runId: string, params?: {
2461
+ reason?: string;
2462
+ }, options?: RequestOptions): Promise<CancelResponse>;
2463
+ /**
2464
+ * GET /workflows/listen/{runId} — SSE stream
2465
+ *
2466
+ * Opens a Server-Sent Events stream for real-time execution events of
2467
+ * an in-progress workflow run. Yields typed `WorkflowSSEEvent` values.
2468
+ */
2469
+ listen(runId: string, options?: RequestOptions): AsyncGenerator<WorkflowSSEEvent>;
2470
+ }
2471
+
2472
+ /**
2473
+ * Deployments resource — workflow deployment management endpoints.
2474
+ * @module resources/deployments
2475
+ */
2476
+
2477
+ /**
2478
+ * Provides methods for the `/workflows/{workflowId}/deployments` API endpoints.
2479
+ */
2480
+ declare class Deployments extends BaseResource {
2481
+ /**
2482
+ * POST /workflows/{workflowId}/deploy
2483
+ *
2484
+ * Creates a new deployment snapshot of a workflow.
2485
+ */
2486
+ create(workflowId: string, params?: CreateDeploymentParams, options?: RequestOptions): Promise<DeploymentResponse>;
2487
+ /**
2488
+ * GET /workflows/{workflowId}/deployments
2489
+ *
2490
+ * Lists deployment snapshots for a workflow.
2491
+ */
2492
+ list(workflowId: string, params?: DeploymentListParams, options?: RequestOptions): Promise<DeploymentListResponse>;
2493
+ /**
2494
+ * GET /workflows/{workflowId}/deployments/{deploymentId}
2495
+ *
2496
+ * Returns the full deployment record including the stored workflow schema.
2497
+ */
2498
+ get(workflowId: string, deploymentId: string, options?: RequestOptions): Promise<DeploymentDetailResponse>;
2499
+ /**
2500
+ * PUT /workflows/{workflowId}/deployments/{deploymentId}/activate
2501
+ *
2502
+ * Sets the given deployment as the live (active) version for the workflow.
2503
+ */
2504
+ activate(workflowId: string, deploymentId: string, options?: RequestOptions): Promise<ActivateDeploymentResponse>;
2505
+ /**
2506
+ * DELETE /workflows/{workflowId}/deployments/live
2507
+ *
2508
+ * Deactivates the currently live deployment so no version is active.
2509
+ */
2510
+ deactivate(workflowId: string, options?: RequestOptions): Promise<DeactivateDeploymentResponse>;
2511
+ /**
2512
+ * DELETE /workflows/{workflowId}/deployments/{deploymentId}
2513
+ *
2514
+ * Permanently deletes a deployment snapshot.
2515
+ */
2516
+ delete(workflowId: string, deploymentId: string, options?: RequestOptions): Promise<DeleteDeploymentResponse>;
2517
+ }
2518
+
2519
+ /**
2520
+ * Chats resource — chat session management endpoints.
2521
+ * @module resources/chats
2522
+ */
2523
+
2524
+ /**
2525
+ * Provides methods for the `/chats` API endpoints.
2526
+ */
2527
+ declare class Chats extends BaseResource {
2528
+ /**
2529
+ * GET /chats
2530
+ *
2531
+ * Returns all chats for the current organization, grouped by folder.
2532
+ * Keys include at minimum `"chats"`, `"pinned"`, and `"archived"`.
2533
+ */
2534
+ list(options?: RequestOptions): Promise<ChatListResponse>;
2535
+ /**
2536
+ * GET /chats/stream — SSE
2537
+ *
2538
+ * Opens a Server-Sent Events stream for real-time chat list updates.
2539
+ * Emits `connected`, `chat_list_updated`, and `keepalive` events.
2540
+ */
2541
+ stream(options?: RequestOptions): AsyncGenerator<SSEEvent>;
2542
+ /**
2543
+ * GET /chats/{chatId}
2544
+ *
2545
+ * Returns a single chat session with its embedded messages.
2546
+ */
2547
+ get(chatId: string, options?: RequestOptions): Promise<ChatResponse>;
2548
+ /**
2549
+ * GET /chats/{chatId}/messages
2550
+ *
2551
+ * Returns paginated messages for a chat session.
2552
+ */
2553
+ messages(chatId: string, params?: ChatMessagesParams, options?: RequestOptions): Promise<ChatMessagesResponse>;
2554
+ /**
2555
+ * PATCH /chats/{chatId}
2556
+ *
2557
+ * Updates a chat's title, privacy, or folder assignment.
2558
+ */
2559
+ update(chatId: string, params: UpdateChatParams, options?: RequestOptions): Promise<ChatResponse>;
2560
+ /**
2561
+ * DELETE /chats/{chatId}
2562
+ *
2563
+ * Soft-deletes a chat. Private chats can only be deleted by the creator.
2564
+ */
2565
+ delete(chatId: string, options?: RequestOptions): Promise<SuccessResponse>;
2566
+ }
2567
+
2568
+ /**
2569
+ * Credentials resource — credential management and MCP server endpoints.
2570
+ * @module resources/credentials
2571
+ */
2572
+
2573
+ /**
2574
+ * Provides methods for the `/credentials` API endpoints.
2575
+ */
2576
+ declare class Credentials extends BaseResource {
2577
+ /**
2578
+ * GET /credentials
2579
+ *
2580
+ * Lists credentials for the current organization.
2581
+ * Returns a grouped response by default, or a flat list when
2582
+ * `integrationName` is specified.
2583
+ */
2584
+ list(params?: CredentialListParams, options?: RequestOptions): Promise<CredentialListGrouped | CredentialListFlat>;
2585
+ /**
2586
+ * GET /credentials/{credentialId}
2587
+ *
2588
+ * Returns a single credential record.
2589
+ */
2590
+ get(credentialId: string, params?: {
2591
+ includeMasked?: boolean;
2592
+ }, options?: RequestOptions): Promise<CredentialResponse>;
2593
+ /**
2594
+ * POST /credentials
2595
+ *
2596
+ * Creates a new credential. The auth data is encrypted at rest.
2597
+ */
2598
+ create(params: CreateCredentialParams, options?: RequestOptions): Promise<CredentialResponse>;
2599
+ /**
2600
+ * PUT /credentials/{credentialId}
2601
+ *
2602
+ * Updates a credential's display name or metadata.
2603
+ */
2604
+ update(credentialId: string, params: UpdateCredentialParams, options?: RequestOptions): Promise<CredentialResponse>;
2605
+ /**
2606
+ * DELETE /credentials/{credentialId}
2607
+ *
2608
+ * Permanently deletes a credential. Returns 204 No Content on success.
2609
+ */
2610
+ delete(credentialId: string, options?: RequestOptions): Promise<void>;
2611
+ /**
2612
+ * POST /credentials/{credentialId}/set-default
2613
+ *
2614
+ * Sets the credential as the default for its integration.
2615
+ * Unsets any previously set default.
2616
+ */
2617
+ setDefault(credentialId: string, options?: RequestOptions): Promise<CredentialResponse>;
2618
+ /**
2619
+ * POST /credentials/test-temporary
2620
+ *
2621
+ * Validates a credential's auth data without saving it.
2622
+ */
2623
+ testTemporary(params: TestTemporaryParams, options?: RequestOptions): Promise<TestTemporaryResponse>;
2624
+ /**
2625
+ * POST /credentials/{credentialId}/test
2626
+ *
2627
+ * Tests an existing saved credential by making a live API call.
2628
+ */
2629
+ test(credentialId: string, options?: RequestOptions): Promise<TestCredentialResponse>;
2630
+ /**
2631
+ * GET /credentials/{credentialId}/usage
2632
+ *
2633
+ * Returns usage statistics for a credential.
2634
+ */
2635
+ usage(credentialId: string, params?: CredentialUsageParams, options?: RequestOptions): Promise<CredentialUsageResponse>;
2636
+ /**
2637
+ * GET /credentials/{credentialId}/audit
2638
+ *
2639
+ * Returns the audit log for a credential.
2640
+ */
2641
+ audit(credentialId: string, params?: CredentialAuditParams, options?: RequestOptions): Promise<Record<string, unknown>>;
2642
+ /**
2643
+ * POST /credentials/bulk-modulex-keys/stream — SSE
2644
+ *
2645
+ * Streams bulk ModuleX managed key provisioning events.
2646
+ */
2647
+ bulkModulexKeys(options?: RequestOptions): AsyncGenerator<SSEEvent>;
2648
+ /**
2649
+ * POST /credentials/mcp-server
2650
+ *
2651
+ * Creates a credential for a Model Context Protocol (MCP) server.
2652
+ */
2653
+ mcpServer(params: McpServerParams, options?: RequestOptions): Promise<CredentialResponse>;
2654
+ /**
2655
+ * POST /credentials/{credentialId}/refresh-discovery
2656
+ *
2657
+ * Refreshes the tool discovery cache for an MCP server credential.
2658
+ */
2659
+ refreshDiscovery(credentialId: string, options?: RequestOptions): Promise<RefreshDiscoveryResponse>;
2660
+ /**
2661
+ * GET /credentials/{credentialId}/mcp-tools
2662
+ *
2663
+ * Returns the tools discovered from an MCP server credential.
2664
+ */
2665
+ mcpTools(credentialId: string, options?: RequestOptions): Promise<McpToolsResponse>;
2666
+ }
2667
+
2668
+ /**
2669
+ * Integrations resource — integration catalog and provider detail endpoints.
2670
+ * @module resources/integrations
2671
+ */
2672
+
2673
+ /**
2674
+ * Provides methods for the `/integrations` API endpoints.
2675
+ */
2676
+ declare class Integrations extends BaseResource {
2677
+ /**
2678
+ * GET /integrations/browse
2679
+ *
2680
+ * Returns the integration catalog, optionally filtered by category or type.
2681
+ */
2682
+ browse(params?: BrowseParams, options?: RequestOptions): Promise<BrowseResponse>;
2683
+ /**
2684
+ * GET /integrations/tools
2685
+ *
2686
+ * Returns all available tool integrations, optionally filtered by category.
2687
+ */
2688
+ tools(params?: {
2689
+ category?: string;
2690
+ }, options?: RequestOptions): Promise<Record<string, unknown>>;
2691
+ /**
2692
+ * GET /integrations/tools/{integrationName}
2693
+ *
2694
+ * Returns the full detail for a specific tool integration including its actions.
2695
+ */
2696
+ tool(integrationName: string, options?: RequestOptions): Promise<ToolIntegrationResponse>;
2697
+ /**
2698
+ * GET /integrations/llm-providers
2699
+ *
2700
+ * Returns all available LLM provider integrations, optionally filtered by category.
2701
+ */
2702
+ llmProviders(params?: {
2703
+ category?: string;
2704
+ }, options?: RequestOptions): Promise<Record<string, unknown>>;
2705
+ /**
2706
+ * GET /integrations/llm-providers/{providerName}
2707
+ *
2708
+ * Returns the full detail for a specific LLM provider including available models.
2709
+ */
2710
+ llmProvider(providerName: string, options?: RequestOptions): Promise<LLMProviderResponse>;
2711
+ /**
2712
+ * GET /integrations/knowledge-providers
2713
+ *
2714
+ * Returns all available knowledge provider integrations.
2715
+ */
2716
+ knowledgeProviders(params?: {
2717
+ category?: string;
2718
+ }, options?: RequestOptions): Promise<Record<string, unknown>>;
2719
+ /**
2720
+ * GET /integrations/knowledge-providers/{providerName}
2721
+ *
2722
+ * Returns the full detail for a specific knowledge provider.
2723
+ */
2724
+ knowledgeProvider(providerName: string, options?: RequestOptions): Promise<KnowledgeProviderResponse>;
2725
+ /**
2726
+ * GET /integrations/{integrationName}
2727
+ *
2728
+ * Returns the detail object for any integration by name.
2729
+ */
2730
+ get(integrationName: string, options?: RequestOptions): Promise<IntegrationResponse>;
2731
+ }
2732
+
2733
+ /**
2734
+ * Knowledge resource — knowledge base management, document ingestion, and search.
2735
+ * @module resources/knowledge
2736
+ */
2737
+
2738
+ /**
2739
+ * Provides methods for the `/knowledge-bases` API endpoints.
2740
+ */
2741
+ declare class Knowledge extends BaseResource {
2742
+ /**
2743
+ * GET /knowledge-bases
2744
+ *
2745
+ * Lists knowledge bases for the current organization.
2746
+ */
2747
+ list(params?: KnowledgeBaseListParams, options?: RequestOptions): Promise<KnowledgeBaseListResponse>;
2748
+ /**
2749
+ * POST /knowledge-bases
2750
+ *
2751
+ * Creates a new knowledge base.
2752
+ */
2753
+ create(params: CreateKnowledgeBaseParams, options?: RequestOptions): Promise<KnowledgeBaseResponse>;
2754
+ /**
2755
+ * GET /knowledge-bases/stats
2756
+ *
2757
+ * Returns aggregated statistics across all knowledge bases in the organization.
2758
+ */
2759
+ stats(options?: RequestOptions): Promise<KnowledgeBaseStatsResponse>;
2760
+ /**
2761
+ * GET /knowledge-bases/{kbId}
2762
+ *
2763
+ * Returns a single knowledge base record.
2764
+ */
2765
+ get(knowledgeBaseId: string, options?: RequestOptions): Promise<KnowledgeBaseResponse>;
2766
+ /**
2767
+ * PUT /knowledge-bases/{kbId}
2768
+ *
2769
+ * Updates a knowledge base's name, description, or configuration.
2770
+ */
2771
+ update(knowledgeBaseId: string, params: UpdateKnowledgeBaseParams, options?: RequestOptions): Promise<KnowledgeBaseResponse>;
2772
+ /**
2773
+ * DELETE /knowledge-bases/{kbId}
2774
+ *
2775
+ * Deletes a knowledge base. Pass `deleteFiles: true` to also remove
2776
+ * the underlying stored files.
2777
+ */
2778
+ delete(knowledgeBaseId: string, params?: {
2779
+ deleteFiles?: boolean;
2780
+ }, options?: RequestOptions): Promise<void>;
2781
+ /**
2782
+ * POST /knowledge-bases/{kbId}/archive
2783
+ *
2784
+ * Archives a knowledge base, pausing ingestion without deleting data.
2785
+ */
2786
+ archive(knowledgeBaseId: string, options?: RequestOptions): Promise<SuccessResponse>;
2787
+ /**
2788
+ * GET /knowledge-bases/{kbId}/documents
2789
+ *
2790
+ * Returns documents within a knowledge base.
2791
+ */
2792
+ documents(knowledgeBaseId: string, params?: DocumentListParams, options?: RequestOptions): Promise<Record<string, unknown>>;
2793
+ /**
2794
+ * POST /knowledge-bases/{kbId}/documents — multipart upload
2795
+ *
2796
+ * Uploads a document file to a knowledge base for ingestion.
2797
+ * Builds a `FormData` with the file and optional metadata JSON.
2798
+ */
2799
+ uploadDocument(knowledgeBaseId: string, params: UploadDocumentParams, options?: RequestOptions): Promise<DocumentResponse>;
2800
+ /**
2801
+ * GET /knowledge-bases/{kbId}/documents/{docId}
2802
+ *
2803
+ * Returns a single document record.
2804
+ */
2805
+ getDocument(knowledgeBaseId: string, documentId: string, options?: RequestOptions): Promise<DocumentResponse>;
2806
+ /**
2807
+ * GET /knowledge-bases/{kbId}/documents/{docId}/status
2808
+ *
2809
+ * Returns the processing status and progress of a document.
2810
+ */
2811
+ documentStatus(knowledgeBaseId: string, documentId: string, options?: RequestOptions): Promise<DocumentStatusResponse>;
2812
+ /**
2813
+ * DELETE /knowledge-bases/{kbId}/documents/{docId}
2814
+ *
2815
+ * Deletes a document and its chunks from the knowledge base.
2816
+ * Pass `deleteFile: true` to also remove the source file from storage.
2817
+ */
2818
+ deleteDocument(knowledgeBaseId: string, documentId: string, params?: {
2819
+ deleteFile?: boolean;
2820
+ }, options?: RequestOptions): Promise<void>;
2821
+ /**
2822
+ * POST /knowledge-bases/{kbId}/documents/{docId}/retry
2823
+ *
2824
+ * Retries ingestion of a failed document.
2825
+ */
2826
+ retryDocument(knowledgeBaseId: string, documentId: string, options?: RequestOptions): Promise<Record<string, unknown>>;
2827
+ /**
2828
+ * GET /knowledge-bases/{kbId}/documents/{docId}/chunks
2829
+ *
2830
+ * Returns the processed chunks for a document.
2831
+ */
2832
+ documentChunks(knowledgeBaseId: string, documentId: string, params?: DocumentChunksParams, options?: RequestOptions): Promise<DocumentChunksResponse>;
2833
+ /**
2834
+ * POST /knowledge-bases/{kbId}/search
2835
+ *
2836
+ * Performs a semantic search within a single knowledge base.
2837
+ */
2838
+ search(knowledgeBaseId: string, params: SearchParams, options?: RequestOptions): Promise<SearchResponse>;
2839
+ /**
2840
+ * POST /knowledge-bases/search
2841
+ *
2842
+ * Searches across multiple knowledge bases simultaneously.
2843
+ */
2844
+ searchMultiple(params: MultiSearchParams, options?: RequestOptions): Promise<SearchResponse>;
2845
+ /**
2846
+ * POST /knowledge-bases/{kbId}/hybrid-search
2847
+ *
2848
+ * Performs a hybrid (semantic + keyword) search within a knowledge base.
2849
+ */
2850
+ hybridSearch(knowledgeBaseId: string, params: HybridSearchParams, options?: RequestOptions): Promise<SearchResponse>;
2851
+ /**
2852
+ * POST /knowledge-bases/{kbId}/retrieve-context
2853
+ *
2854
+ * Retrieves a pre-formatted context string from a knowledge base for
2855
+ * prompt injection.
2856
+ */
2857
+ retrieveContext(knowledgeBaseId: string, params: RetrieveContextParams, options?: RequestOptions): Promise<RetrieveContextResponse>;
2858
+ /**
2859
+ * GET /knowledge-bases/info/supported-file-types
2860
+ *
2861
+ * Returns the list of file types accepted by the document ingestion pipeline.
2862
+ */
2863
+ supportedFileTypes(options?: RequestOptions): Promise<SupportedFileTypesResponse>;
2864
+ }
2865
+
2866
+ /**
2867
+ * Schedules resource — workflow schedule management and run history endpoints.
2868
+ * @module resources/schedules
2869
+ */
2870
+
2871
+ /**
2872
+ * Provides methods for the `/schedules` API endpoints.
2873
+ */
2874
+ declare class Schedules extends BaseResource {
2875
+ /**
2876
+ * POST /schedules
2877
+ *
2878
+ * Creates a new workflow schedule.
2879
+ */
2880
+ create(params: CreateScheduleParams, options?: RequestOptions): Promise<ScheduleResponse>;
2881
+ /**
2882
+ * GET /schedules
2883
+ *
2884
+ * Lists schedules for the current organization.
2885
+ */
2886
+ list(params?: ScheduleListParams, options?: RequestOptions): Promise<ScheduleListResponse>;
2887
+ /**
2888
+ * GET /schedules/{scheduleId}
2889
+ *
2890
+ * Returns a single schedule record.
2891
+ */
2892
+ get(scheduleId: string, options?: RequestOptions): Promise<ScheduleResponse>;
2893
+ /**
2894
+ * PUT /schedules/{scheduleId}
2895
+ *
2896
+ * Updates an existing schedule. Only provided fields are changed.
2897
+ */
2898
+ update(scheduleId: string, params: UpdateScheduleParams, options?: RequestOptions): Promise<ScheduleResponse>;
2899
+ /**
2900
+ * DELETE /schedules/{scheduleId}
2901
+ *
2902
+ * Deletes a schedule and cancels all pending executions.
2903
+ */
2904
+ delete(scheduleId: string, options?: RequestOptions): Promise<SuccessResponse>;
2905
+ /**
2906
+ * POST /schedules/{scheduleId}/pause
2907
+ *
2908
+ * Pauses a schedule, preventing future runs until resumed.
2909
+ */
2910
+ pause(scheduleId: string, options?: RequestOptions): Promise<SuccessResponse>;
2911
+ /**
2912
+ * POST /schedules/{scheduleId}/resume
2913
+ *
2914
+ * Resumes a paused schedule.
2915
+ */
2916
+ resume(scheduleId: string, options?: RequestOptions): Promise<SuccessResponse>;
2917
+ /**
2918
+ * GET /schedules/{scheduleId}/runs
2919
+ *
2920
+ * Returns the run history for a schedule.
2921
+ */
2922
+ runs(scheduleId: string, params?: ScheduleRunListParams, options?: RequestOptions): Promise<Record<string, unknown>>;
2923
+ /**
2924
+ * GET /schedules/{scheduleId}/runs/stats
2925
+ *
2926
+ * Returns aggregate run statistics for a schedule.
2927
+ */
2928
+ runStats(scheduleId: string, params?: ScheduleRunStatsParams, options?: RequestOptions): Promise<ScheduleRunStatsResponse>;
2929
+ /**
2930
+ * GET /schedules/{scheduleId}/runs/{runId}
2931
+ *
2932
+ * Returns details for a single scheduled run.
2933
+ */
2934
+ getRun(scheduleId: string, runId: string, options?: RequestOptions): Promise<ScheduleRunResponse>;
2935
+ /**
2936
+ * POST /schedules/{scheduleId}/runs/{runId}/retry
2937
+ *
2938
+ * Retries a failed scheduled run.
2939
+ */
2940
+ retryRun(scheduleId: string, runId: string, options?: RequestOptions): Promise<Record<string, unknown>>;
2941
+ }
2942
+
2943
+ /**
2944
+ * Templates resource — workflow template and creator profile endpoints.
2945
+ * @module resources/templates
2946
+ */
2947
+
2948
+ /**
2949
+ * Provides methods for the `/templates` API endpoints.
2950
+ */
2951
+ declare class Templates extends BaseResource {
2952
+ /**
2953
+ * GET /templates
2954
+ *
2955
+ * Returns the public template library.
2956
+ */
2957
+ list(options?: RequestOptions): Promise<TemplateListResponse>;
2958
+ /**
2959
+ * GET /templates/{templateId}
2960
+ *
2961
+ * Returns a single template including its full workflow schema.
2962
+ */
2963
+ get(templateId: string, options?: RequestOptions): Promise<TemplateResponse>;
2964
+ /**
2965
+ * GET /templates/me
2966
+ *
2967
+ * Returns templates created by the authenticated user.
2968
+ */
2969
+ mine(options?: RequestOptions): Promise<MyTemplatesResponse>;
2970
+ /**
2971
+ * POST /templates
2972
+ *
2973
+ * Publishes a workflow as a new template.
2974
+ */
2975
+ create(params: CreateTemplateParams, options?: RequestOptions): Promise<TemplateResponse>;
2976
+ /**
2977
+ * POST /templates/{templateId}/like
2978
+ *
2979
+ * Toggles the authenticated user's like on a template.
2980
+ */
2981
+ like(templateId: string, options?: RequestOptions): Promise<TemplateLikeResponse>;
2982
+ /**
2983
+ * POST /templates/{templateId}/use
2984
+ *
2985
+ * Imports a template as a new workflow in the current organization.
2986
+ */
2987
+ use(templateId: string, options?: RequestOptions): Promise<TemplateUseResponse>;
2988
+ /**
2989
+ * POST /templates/{templateId}/update-request
2990
+ *
2991
+ * Submits an update request for a published template.
2992
+ */
2993
+ updateRequest(templateId: string, params: UpdateTemplateRequestParams, options?: RequestOptions): Promise<SuccessResponse>;
2994
+ /**
2995
+ * POST /templates/creators
2996
+ *
2997
+ * Creates or updates the authenticated user's template creator profile.
2998
+ */
2999
+ createCreator(params: CreateCreatorParams, options?: RequestOptions): Promise<Record<string, unknown>>;
3000
+ /**
3001
+ * GET /templates/creators/me
3002
+ *
3003
+ * Returns the authenticated user's template creator profile.
3004
+ */
3005
+ getCreator(options?: RequestOptions): Promise<Record<string, unknown>>;
3006
+ }
3007
+
3008
+ /**
3009
+ * Composer resource — AI-driven workflow builder chat endpoints.
3010
+ * @module resources/composer
3011
+ */
3012
+
3013
+ /**
3014
+ * Provides methods for the `/composer` API endpoints.
3015
+ */
3016
+ declare class Composer extends BaseResource {
3017
+ /**
3018
+ * POST /composer/chat
3019
+ *
3020
+ * Starts a new Composer chat or sends a message to an existing session.
3021
+ * Returns a run ID that can be used to listen to the SSE stream.
3022
+ */
3023
+ chat(params: ComposerChatParams, options?: RequestOptions): Promise<ComposerChatResponse>;
3024
+ /**
3025
+ * GET /composer/chat/{composerChatId}
3026
+ *
3027
+ * Returns a Composer chat session with its messages and workflow snapshot status.
3028
+ */
3029
+ get(composerChatId: string, options?: RequestOptions): Promise<ComposerChatDetailResponse>;
3030
+ /**
3031
+ * GET /composer/chat/{composerChatId}/listen/{runId} — SSE
3032
+ *
3033
+ * Opens a Server-Sent Events stream for real-time Composer output during a run.
3034
+ */
3035
+ listen(composerChatId: string, runId: string, options?: RequestOptions): AsyncGenerator<SSEEvent>;
3036
+ /**
3037
+ * POST /composer/chat/{composerChatId}/save
3038
+ *
3039
+ * Saves the Composer's current workflow changes to the associated workflow.
3040
+ */
3041
+ save(composerChatId: string, options?: RequestOptions): Promise<SuccessResponse>;
3042
+ /**
3043
+ * POST /composer/chat/{composerChatId}/revert
3044
+ *
3045
+ * Reverts the Composer's pending changes, restoring the last saved state.
3046
+ */
3047
+ revert(composerChatId: string, options?: RequestOptions): Promise<SuccessResponse>;
3048
+ /**
3049
+ * GET /composer/chat/workflow/{workflowId}/history
3050
+ *
3051
+ * Returns the Composer chat history associated with a workflow.
3052
+ */
3053
+ history(workflowId: string, params?: ComposerHistoryParams, options?: RequestOptions): Promise<Record<string, unknown>>;
3054
+ /**
3055
+ * DELETE /composer/chat/{composerChatId}
3056
+ *
3057
+ * Deletes a Composer chat session. Pass `permanent: true` to also delete
3058
+ * the associated workflow.
3059
+ */
3060
+ delete(composerChatId: string, params?: ComposerDeleteParams, options?: RequestOptions): Promise<SuccessResponse>;
3061
+ /**
3062
+ * GET /composer/chat/{composerChatId}/status
3063
+ *
3064
+ * Returns the real-time status of a Composer chat session.
3065
+ */
3066
+ status(composerChatId: string, options?: RequestOptions): Promise<ComposerStatusResponse>;
3067
+ /**
3068
+ * POST /composer/chat/{composerChatId}/cancel
3069
+ *
3070
+ * Cancels the in-progress run for a Composer chat session.
3071
+ */
3072
+ cancel(composerChatId: string, options?: RequestOptions): Promise<SuccessResponse>;
3073
+ }
3074
+
3075
+ /**
3076
+ * Dashboard resource — activity logs, analytics, and user management endpoints.
3077
+ * @module resources/dashboard
3078
+ */
3079
+
3080
+ /**
3081
+ * Provides methods for the `/dashboard` API endpoints.
3082
+ */
3083
+ declare class Dashboard extends BaseResource {
3084
+ /**
3085
+ * GET /dashboard/logs
3086
+ *
3087
+ * Returns paginated activity logs for the current organization.
3088
+ */
3089
+ logs(params?: DashboardLogsParams, options?: RequestOptions): Promise<DashboardLogsResponse>;
3090
+ /**
3091
+ * GET /dashboard/analytics/overview
3092
+ *
3093
+ * Returns high-level execution and usage analytics for the organization.
3094
+ */
3095
+ analyticsOverview(params?: AnalyticsOverviewParams, options?: RequestOptions): Promise<AnalyticsOverviewResponse>;
3096
+ /**
3097
+ * GET /dashboard/analytics/tools
3098
+ *
3099
+ * Returns tool-usage analytics broken down by integration.
3100
+ */
3101
+ analyticsTools(params?: AnalyticsToolsParams, options?: RequestOptions): Promise<AnalyticsToolsResponse>;
3102
+ /**
3103
+ * GET /dashboard/analytics/llm-usage
3104
+ *
3105
+ * Returns LLM token-usage analytics broken down by model and provider.
3106
+ */
3107
+ analyticsLlmUsage(params?: AnalyticsToolsParams, options?: RequestOptions): Promise<AnalyticsLLMUsageResponse>;
3108
+ /**
3109
+ * GET /dashboard/users
3110
+ *
3111
+ * Returns organization members with pagination and search support.
3112
+ */
3113
+ users(params?: DashboardUsersParams, options?: RequestOptions): Promise<DashboardUsersResponse>;
3114
+ }
3115
+
3116
+ /**
3117
+ * Subscriptions resource — billing and subscription plan management endpoints.
3118
+ * @module resources/subscriptions
3119
+ */
3120
+
3121
+ /**
3122
+ * Provides methods for the `/subscriptions` API endpoints.
3123
+ */
3124
+ declare class Subscriptions extends BaseResource {
3125
+ /**
3126
+ * GET /subscriptions/organization-plans
3127
+ *
3128
+ * Returns the list of available organization subscription plans.
3129
+ */
3130
+ organizationPlans(options?: RequestOptions): Promise<OrganizationPlansResponse>;
3131
+ /**
3132
+ * GET /subscriptions/organization-billing
3133
+ *
3134
+ * Returns the current organization's billing status and active subscription.
3135
+ */
3136
+ billing(options?: RequestOptions): Promise<BillingResponse>;
3137
+ /**
3138
+ * POST /subscriptions/checkout-link
3139
+ *
3140
+ * Creates a Stripe Checkout session and returns the redirect URL.
3141
+ */
3142
+ checkoutLink(params: CheckoutParams, options?: RequestOptions): Promise<CheckoutResponse>;
3143
+ /**
3144
+ * POST /subscriptions/customer-portal
3145
+ *
3146
+ * Creates a Stripe Customer Portal session and returns the redirect URL
3147
+ * for the user to manage their billing.
3148
+ */
3149
+ customerPortal(options?: RequestOptions): Promise<PortalResponse>;
3150
+ }
3151
+
3152
+ /**
3153
+ * Notifications resource — organization notification management endpoints.
3154
+ * @module resources/notifications
3155
+ */
3156
+
3157
+ /**
3158
+ * Provides methods for the `/notifications` API endpoints.
3159
+ */
3160
+ declare class Notifications extends BaseResource {
3161
+ /**
3162
+ * GET /notifications
3163
+ *
3164
+ * Returns notifications for the current organization.
3165
+ */
3166
+ list(options?: RequestOptions): Promise<NotificationListResponse>;
3167
+ /**
3168
+ * POST /notifications/organization
3169
+ *
3170
+ * Creates a new notification for the organization or a specific user.
3171
+ */
3172
+ create(params: CreateNotificationParams, options?: RequestOptions): Promise<Record<string, unknown>>;
3173
+ }
3174
+
3175
+ /**
3176
+ * System resource — health, metrics, and timezone endpoints.
3177
+ * @module resources/system
3178
+ */
3179
+
3180
+ /**
3181
+ * Provides methods for the `/system` API endpoints.
3182
+ */
3183
+ declare class System extends BaseResource {
3184
+ /**
3185
+ * GET /system/health
3186
+ *
3187
+ * Returns the service health status, name, and version.
3188
+ */
3189
+ health(options?: RequestOptions): Promise<{
3190
+ status: string;
3191
+ service: string;
3192
+ version: string;
3193
+ }>;
3194
+ /**
3195
+ * GET /system/metrics
3196
+ *
3197
+ * Returns Prometheus-format metrics as plain text.
3198
+ * This endpoint bypasses the JSON-parsing logic of `BaseResource.get()` and
3199
+ * reads the raw response body as a string.
3200
+ */
3201
+ metrics(options?: RequestOptions): Promise<string>;
3202
+ /**
3203
+ * GET /system/timezones
3204
+ *
3205
+ * Returns the list of supported IANA timezone identifiers.
3206
+ */
3207
+ timezones(options?: RequestOptions): Promise<Record<string, unknown>>;
3208
+ /**
3209
+ * GET /system/timezones/search
3210
+ *
3211
+ * Searches supported IANA timezone identifiers by query string.
3212
+ */
3213
+ searchTimezones(query: string, options?: RequestOptions): Promise<Record<string, unknown>>;
3214
+ }
3215
+
3216
+ /**
3217
+ * The main ModuleX client. Provides access to all API resources.
3218
+ *
3219
+ * @example
3220
+ * ```typescript
3221
+ * import { Modulex } from 'modulex';
3222
+ *
3223
+ * const client = new Modulex({
3224
+ * apiKey: 'mx_live_...',
3225
+ * organizationId: 'your-org-id',
3226
+ * });
3227
+ *
3228
+ * const me = await client.auth.me();
3229
+ * const workflows = await client.workflows.list({ status: 'active' });
3230
+ * ```
3231
+ */
3232
+ declare class Modulex {
3233
+ /** @internal */
3234
+ private readonly _config;
3235
+ private _auth?;
3236
+ private _apiKeys?;
3237
+ private _organizations?;
3238
+ private _workflows?;
3239
+ private _executions?;
3240
+ private _deployments?;
3241
+ private _chats?;
3242
+ private _credentials?;
3243
+ private _integrations?;
3244
+ private _knowledge?;
3245
+ private _schedules?;
3246
+ private _templates?;
3247
+ private _composer?;
3248
+ private _dashboard?;
3249
+ private _subscriptions?;
3250
+ private _notifications?;
3251
+ private _system?;
3252
+ constructor(config: ModulexConfig);
3253
+ /** Authentication and user profile endpoints. */
3254
+ get auth(): Auth;
3255
+ /** API key management endpoints. */
3256
+ get apiKeys(): ApiKeys;
3257
+ /** Organization management endpoints. */
3258
+ get organizations(): Organizations;
3259
+ /** Workflow CRUD endpoints. */
3260
+ get workflows(): Workflows;
3261
+ /** Workflow execution endpoints (run, resume, cancel, listen). */
3262
+ get executions(): Executions;
3263
+ /** Workflow deployment endpoints. */
3264
+ get deployments(): Deployments;
3265
+ /** Chat endpoints. */
3266
+ get chats(): Chats;
3267
+ /** Credential management endpoints. */
3268
+ get credentials(): Credentials;
3269
+ /** Integration browsing endpoints. */
3270
+ get integrations(): Integrations;
3271
+ /** Knowledge base endpoints. */
3272
+ get knowledge(): Knowledge;
3273
+ /** Schedule management endpoints. */
3274
+ get schedules(): Schedules;
3275
+ /** Template endpoints. */
3276
+ get templates(): Templates;
3277
+ /** Composer (AI workflow builder) endpoints. */
3278
+ get composer(): Composer;
3279
+ /** Dashboard and analytics endpoints. */
3280
+ get dashboard(): Dashboard;
3281
+ /** Subscription and billing endpoints. */
3282
+ get subscriptions(): Subscriptions;
3283
+ /** Notification endpoints. */
3284
+ get notifications(): Notifications;
3285
+ /** System health and utility endpoints. */
3286
+ get system(): System;
3287
+ }
3288
+
3289
+ /**
3290
+ * Base error class for all ModuleX SDK errors.
3291
+ */
3292
+ declare class ModulexError extends Error {
3293
+ readonly status: number | undefined;
3294
+ readonly body: unknown;
3295
+ readonly headers: Headers | undefined;
3296
+ constructor(message: string, status: number | undefined, body: unknown, headers: Headers | undefined);
3297
+ }
3298
+ /** Thrown when the API returns 400 Bad Request. */
3299
+ declare class BadRequestError extends ModulexError {
3300
+ constructor(message: string, body: unknown, headers: Headers | undefined);
3301
+ }
3302
+ /** Thrown when the API returns 401 Unauthorized. */
3303
+ declare class AuthenticationError extends ModulexError {
3304
+ constructor(message: string, body: unknown, headers: Headers | undefined);
3305
+ }
3306
+ /** Thrown when the API returns 403 Forbidden. */
3307
+ declare class PermissionError extends ModulexError {
3308
+ constructor(message: string, body: unknown, headers: Headers | undefined);
3309
+ }
3310
+ /** Thrown when the API returns 404 Not Found. */
3311
+ declare class NotFoundError extends ModulexError {
3312
+ constructor(message: string, body: unknown, headers: Headers | undefined);
3313
+ }
3314
+ /** Thrown when the API returns 409 Conflict. */
3315
+ declare class ConflictError extends ModulexError {
3316
+ constructor(message: string, body: unknown, headers: Headers | undefined);
3317
+ }
3318
+ /** Thrown when the API returns 422 Validation Error. */
3319
+ declare class ValidationError extends ModulexError {
3320
+ constructor(message: string, body: unknown, headers: Headers | undefined);
3321
+ }
3322
+ /** Thrown when the API returns 429 Too Many Requests. */
3323
+ declare class RateLimitError extends ModulexError {
3324
+ /** Seconds to wait before retrying (from Retry-After header). */
3325
+ readonly retryAfter: number | undefined;
3326
+ constructor(message: string, body: unknown, headers: Headers | undefined);
3327
+ }
3328
+ /** Thrown when the API returns 500 Internal Server Error. */
3329
+ declare class InternalError extends ModulexError {
3330
+ constructor(message: string, body: unknown, headers: Headers | undefined);
3331
+ }
3332
+ /** Thrown when the API returns 502 Bad Gateway. */
3333
+ declare class ExternalServiceError extends ModulexError {
3334
+ constructor(message: string, body: unknown, headers: Headers | undefined);
3335
+ }
3336
+ /** Thrown when the API returns 503 Service Unavailable. */
3337
+ declare class ServiceUnavailableError extends ModulexError {
3338
+ constructor(message: string, body: unknown, headers: Headers | undefined);
3339
+ }
3340
+ /** Thrown on SSE stream errors. */
3341
+ declare class StreamError extends ModulexError {
3342
+ constructor(message: string);
3343
+ }
3344
+ /** Thrown when a request times out. */
3345
+ declare class TimeoutError extends ModulexError {
3346
+ constructor(message?: string);
3347
+ }
3348
+
3349
+ export { type ActivateDeploymentResponse, type AgentNodeConfig, type AnalyticsLLMUsageResponse, type AnalyticsOverviewParams, type AnalyticsOverviewResponse, type AnalyticsToolsParams, type AnalyticsToolsResponse, type ApiKeyListResponse, type ApiKeyResponse, AuthenticationError, BadRequestError, type BillingResponse, type BrowseParams, type BrowseResponse, type BuilderDetailsParams, type BuilderDetailsResponse, type CancelInvitationResponse, type CancelResponse, type ChatListResponse, type ChatMessageResponse, type ChatMessagesParams, type ChatMessagesResponse, type ChatResponse, type CheckoutParams, type CheckoutResponse, type ChunkResponse, type ChunkingConfig, type ComposerChatDetailResponse, type ComposerChatParams, type ComposerChatResponse, type ComposerDeleteParams, type ComposerHistoryParams, type ComposerStatusResponse, type ConditionalBranch, type ConditionalNodeConfig, ConflictError, type CreateApiKeyParams, type CreateApiKeyResponse, type CreateCreatorParams, type CreateCredentialParams, type CreateDeploymentParams, type CreateKnowledgeBaseParams, type CreateNotificationParams, type CreateOrganizationParams, type CreateOrganizationResponse, type CreateScheduleParams, type CreateTemplateParams, type CreateWorkflowParams, type CreatorInfo, type CredentialAuditParams, type CredentialListFlat, type CredentialListGrouped, type CredentialListParams, type CredentialResponse, type CredentialUsageParams, type CredentialUsageResponse, type DashboardLogsParams, type DashboardLogsResponse, type DashboardUsersParams, type DashboardUsersResponse, type DeactivateDeploymentResponse, type DeleteDeploymentResponse, type DeleteWorkflowResponse, type DeploymentDetailResponse, type DeploymentListParams, type DeploymentListResponse, type DeploymentResponse, type DocumentChunksParams, type DocumentChunksResponse, type DocumentListParams, type DocumentResponse, type DocumentStatusResponse, type DoneEventData, type EdgeDefinition, type EmbeddingConfig, type ErrorEventData, ExternalServiceError, type FunctionNodeConfig, type GuardrailsNodeConfig, type HybridSearchParams, type IntegrationResponse, InternalError, type InterruptEventData, type InterruptNodeConfig, type InvitationResponse, type InvitationsResponse, type InviteParams, type KnowledgeBaseListParams, type KnowledgeBaseListResponse, type KnowledgeBaseResponse, type KnowledgeBaseStatsResponse, type KnowledgeNodeConfig, type KnowledgeProviderResponse, type LLMConfig, type LLMNodeConfig, type LLMProviderResponse, type LLMsResponse, type LeaveResponse, type LoopConfig, type McpServerParams, type McpToolsResponse, type MetadataEventData, Modulex, type ModulexConfig, ModulexError, type MultiSearchParams, type MyTemplatesResponse, type NodeDefinition, type NodeType, type NodeUpdateEventData, NotFoundError, type NotificationListResponse, type NotificationResponse, type OrganizationInfo, type OrganizationPlansResponse, type OrganizationsResponse, type PaginatedList, PermissionError, type Plan, type PlanPrice, type PortalResponse, RateLimitError, type RefreshDiscoveryResponse, type RequestOptions, type ResumedEventData, type RetrieveContextParams, type RetrieveContextResponse, type RetryConfig, type RevokeApiKeyResponse, type RoleUpdateParams, type RoleUpdateResponse, type SSEEvent, type ScheduleListParams, type ScheduleListResponse, type ScheduleResponse, type ScheduleRunListParams, type ScheduleRunResponse, type ScheduleRunStatsParams, type ScheduleRunStatsResponse, type SearchParams, type SearchResponse, type SearchResult, ServiceUnavailableError, type StateSchema, type StateSchemaField, StreamError, type Subscription, type SuccessResponse, type SupportedFileTypesResponse, type TemplateLikeResponse, type TemplateListResponse, type TemplateResponse, type TemplateUseResponse, type TestCredentialResponse, type TestTemporaryParams, type TestTemporaryResponse, TimeoutError, type ToolDefinition, type ToolIntegrationResponse, type ToolNodeConfig, type TransformerNodeConfig, type TransformerOperation, type UpdateChatParams, type UpdateCredentialParams, type UpdateKnowledgeBaseParams, type UpdateScheduleParams, type UpdateTemplateRequestParams, type UpdateWorkflowParams, type UploadDocumentParams, type UserResponse, ValidationError, type WorkflowConfig, type WorkflowDefinition, type WorkflowListParams, type WorkflowListResponse, type WorkflowMetadata, type WorkflowResponse, type WorkflowResumeParams, type WorkflowResumeResponse, type WorkflowRunParams, type WorkflowRunResponse, type WorkflowSSEEvent, type WorkflowStateResponse, type WorkflowSummary };