orchestrator-client 5.6.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,907 @@
1
+ interface Pagination$1 {
2
+ currentPage: number;
3
+ perPage: number;
4
+ totalItems: number;
5
+ totalPages: number;
6
+ hasNext: boolean;
7
+ hasPrev: boolean;
8
+ }
9
+
10
+ /** Pagination metadata returned by paginated list endpoints. */
11
+ interface Pagination {
12
+ currentPage: number;
13
+ perPage: number;
14
+ totalItems: number;
15
+ totalPages: number;
16
+ hasNext: boolean;
17
+ hasPrev: boolean;
18
+ }
19
+ /** Core task summary — returned in list endpoints. */
20
+ interface TaskSummary {
21
+ id: string;
22
+ status: string;
23
+ workflowId: string;
24
+ iteration: number;
25
+ maxIterations: number;
26
+ goalPrompt: string;
27
+ result: string;
28
+ resultLocalized: string | null;
29
+ approvalReason: string;
30
+ ticketId: string | null;
31
+ availableTools: string[] | null;
32
+ insight: string | null;
33
+ insightLocalized: string | null;
34
+ createdAt: string;
35
+ updatedAt: string;
36
+ pendingTranslationsForLocales?: string[] | null;
37
+ }
38
+ /** Per-task feature toggles set at creation time. */
39
+ interface TaskOptions {
40
+ disableSummaries: boolean;
41
+ disableTranslation: boolean;
42
+ }
43
+ /** Full task status including fields returned by GET /task/status. */
44
+ interface TaskDetail extends TaskSummary {
45
+ subtaskIds: string[];
46
+ workflowData: Record<string, unknown> | null;
47
+ options: Record<string, unknown> | null;
48
+ }
49
+ interface TaskListResult {
50
+ tasks: TaskSummary[];
51
+ pagination: Pagination;
52
+ }
53
+ interface TaskCreateResponse {
54
+ taskId: string;
55
+ status: string;
56
+ }
57
+ interface TaskCancelResponse {
58
+ taskId: string;
59
+ killed: boolean;
60
+ }
61
+ interface VSATaskCreateResponse extends TaskCreateResponse {
62
+ }
63
+ interface TaskDeleteResult {
64
+ deletedTasks: string[];
65
+ failedTasks: string[];
66
+ totalDeleted: number;
67
+ totalFailed: number;
68
+ }
69
+
70
+ interface AttachmentMeta {
71
+ id: string;
72
+ filename: string;
73
+ mimeType: string;
74
+ size: number;
75
+ width: number | null;
76
+ height: number | null;
77
+ tokenCount: number | null;
78
+ }
79
+ interface ToolCall {
80
+ id: string;
81
+ type: string;
82
+ function: Record<string, unknown>;
83
+ }
84
+ interface Message {
85
+ id: number;
86
+ role: string;
87
+ content: string;
88
+ createdAt: string;
89
+ kind: string | null;
90
+ name: string | null;
91
+ toolCalls: ToolCall[] | null;
92
+ toolCallId: string | null;
93
+ reasoning: string | null;
94
+ reasoningSummary: string | null;
95
+ toolCallSummary: string | null;
96
+ toolOutputSummary: string | null;
97
+ summarySource: string | null;
98
+ archived: boolean;
99
+ archivedReason: string | null;
100
+ attachments: AttachmentMeta[];
101
+ }
102
+ interface ConversationResult {
103
+ taskId: string;
104
+ conversation: Message[];
105
+ }
106
+ interface MatrixConversationResult {
107
+ taskId: string;
108
+ conversation: Message[];
109
+ }
110
+ interface ArchivedContent {
111
+ id: number;
112
+ content: string;
113
+ archived: boolean;
114
+ archivedReason: string | null;
115
+ createdAt: string;
116
+ }
117
+ interface MessageTranslation {
118
+ locale: string;
119
+ kind: string;
120
+ translatedText: string;
121
+ isFallback: boolean;
122
+ createdAt: string | null;
123
+ }
124
+ interface MessageTranslationsResult {
125
+ messageId: number;
126
+ translations: MessageTranslation[];
127
+ }
128
+ interface MessageTranslationReadyEvent {
129
+ taskId: string;
130
+ messageId: number;
131
+ locale: string;
132
+ messageIndex: number;
133
+ translatedContent: string | null;
134
+ translatedReasoning: string | null;
135
+ translatedReasoningSummary: string | null;
136
+ translatedToolCallSummary: string | null;
137
+ translationFailed: boolean;
138
+ eventType: string;
139
+ }
140
+
141
+ interface ErrorEvent {
142
+ id: string;
143
+ createdAt: string;
144
+ severity: string;
145
+ source: string;
146
+ taskId: string | null;
147
+ workflowId: string | null;
148
+ errorCode: string | null;
149
+ exceptionType: string | null;
150
+ message: string;
151
+ holderId: string | null;
152
+ requestId: string | null;
153
+ }
154
+ interface ErrorEventDetail extends ErrorEvent {
155
+ traceback: string | null;
156
+ context: Record<string, unknown> | null;
157
+ }
158
+ interface ErrorStatsResult {
159
+ total: number;
160
+ bySeverity: Record<string, number>;
161
+ bySource: Record<string, number>;
162
+ byWorkflowId: Record<string, number>;
163
+ byExceptionType: Record<string, number>;
164
+ topTaskIds: Record<string, unknown>[];
165
+ topHolderIds: Record<string, unknown>[];
166
+ }
167
+ interface ErrorCountResult {
168
+ count: number;
169
+ }
170
+ interface ErrorPurgeResult {
171
+ deleted: number;
172
+ }
173
+
174
+ interface HealthStatus {
175
+ status: string;
176
+ message: string;
177
+ version: string;
178
+ }
179
+ interface ComponentHealth {
180
+ connected: boolean | null;
181
+ running: boolean | null;
182
+ latencyMs: number | null;
183
+ }
184
+ interface HealthDetail extends HealthStatus {
185
+ components: Record<string, ComponentHealth>;
186
+ }
187
+ interface ReadinessCheck {
188
+ ok: boolean;
189
+ detail: string | null;
190
+ }
191
+ interface ReadinessResult {
192
+ ready: boolean;
193
+ reason: string | null;
194
+ isStartupComplete: boolean;
195
+ isShuttingDown: boolean;
196
+ checks: Record<string, ReadinessCheck>;
197
+ }
198
+ interface LockStatus {
199
+ name: string;
200
+ isLeader: boolean;
201
+ isRunning: boolean;
202
+ ttlSeconds: number;
203
+ token: string | null;
204
+ }
205
+ interface LeaderStatus {
206
+ holderId: string;
207
+ locks: LockStatus[];
208
+ }
209
+ interface MetricSnapshot {
210
+ uptimeSeconds: number | null;
211
+ activeTasks: number | null;
212
+ openTasks: number | null;
213
+ llmGeneratedTokens: number | null;
214
+ llmAvgResponseTimeSec: number | null;
215
+ llmRequestsPerMinute: number | null;
216
+ avgTaskSolutionTimeSec: number | null;
217
+ }
218
+
219
+ interface SystemStatusSettings {
220
+ agentModelId: string | null;
221
+ orchestratorModelId: string | null;
222
+ compactorModelId: string | null;
223
+ journalModelId: string | null;
224
+ summaryModelId: string | null;
225
+ translateModelId: string | null;
226
+ maxConcurrentTasksPerReplica: number | null;
227
+ subagentsEnabled: boolean | null;
228
+ localizationTargets: Record<string, string>[] | null;
229
+ }
230
+ interface SystemStatus {
231
+ isConfigured: boolean;
232
+ missingFields: string[];
233
+ settings: SystemStatusSettings;
234
+ version: number;
235
+ }
236
+ interface LLMBackendInfo {
237
+ host: string;
238
+ models: string[];
239
+ }
240
+ interface MCPServerInfo {
241
+ baseUrl: string;
242
+ name: string;
243
+ description: string;
244
+ tools: string[];
245
+ }
246
+ interface TaskHandlerReplica {
247
+ holderId: string;
248
+ maxConcurrentTasksPerReplica: number;
249
+ currentlyRunningTasks: number;
250
+ runningTaskIds: string[];
251
+ leaseTtlSeconds: number;
252
+ startedAt: string;
253
+ lastHeartbeatAt: string;
254
+ }
255
+ interface TaskHandlerCluster {
256
+ maxConcurrentTasksPerReplica: number;
257
+ currentlyRunningTasks: number;
258
+ runningTaskIds: string[];
259
+ replicasAlive: number;
260
+ queuedTasks: number;
261
+ activeTasks: number;
262
+ totalTasks: number;
263
+ }
264
+ interface TaskHandlerStatus {
265
+ cluster: TaskHandlerCluster;
266
+ replicas: TaskHandlerReplica[];
267
+ }
268
+ interface TaskHandlerStatusLocal {
269
+ running: boolean;
270
+ maxConcurrentTasks: number;
271
+ currentlyRunningTasks: number;
272
+ runningTaskIds: string[];
273
+ holderId: string;
274
+ totalTasks: number;
275
+ queuedTasks: number;
276
+ activeTasks: number;
277
+ }
278
+ interface SummaryWorkerStatus {
279
+ running: boolean;
280
+ uptimeSeconds: number;
281
+ maxConcurrentSummaries: number;
282
+ processedCount: number;
283
+ queuedCount: number;
284
+ pendingCount: number;
285
+ queueSize: number;
286
+ errorCount: number;
287
+ modelId: string;
288
+ translateModelId: string;
289
+ isLeader: boolean;
290
+ }
291
+ interface TokenWorkerStatus {
292
+ running: boolean;
293
+ uptimeSeconds: number;
294
+ processedCount: number;
295
+ queueSize: number;
296
+ errorCount: number;
297
+ encoding: string;
298
+ }
299
+ interface SlotInfo {
300
+ id: string;
301
+ ip: string;
302
+ status: string;
303
+ taskId: string | null;
304
+ lastActivity: string | null;
305
+ idleSeconds: number | null;
306
+ }
307
+ interface SlotsStatus {
308
+ enabled: boolean;
309
+ totalSlots: number;
310
+ availableSlots: number;
311
+ slotTools: string[];
312
+ acquireTimeoutSeconds: number;
313
+ slots: SlotInfo[];
314
+ }
315
+ interface ConfigurationStatus {
316
+ agentModel: string | null;
317
+ orchestratorModel: string | null;
318
+ summaryModel: string | null;
319
+ translateModel: string | null;
320
+ localizationTargets: Record<string, string>[];
321
+ llmbackends: LLMBackendInfo[];
322
+ mcpservers: MCPServerInfo[];
323
+ builtinTools: string[];
324
+ }
325
+
326
+ interface ToolInfo {
327
+ name: string;
328
+ description: string;
329
+ server: string;
330
+ }
331
+ interface ToolsListResult {
332
+ tools: ToolInfo[];
333
+ totalTools: number;
334
+ servers: string[];
335
+ }
336
+
337
+ interface CompactionEvent {
338
+ id: number;
339
+ taskId: string;
340
+ triggeredAt: string;
341
+ triggerReason: string;
342
+ preTokenCount: number;
343
+ postTokenCount: number;
344
+ clearedToolCount: number;
345
+ messagesArchived: number;
346
+ boundaryMessageId: number | null;
347
+ consecutiveFailuresAtStart: number;
348
+ durationMs: number;
349
+ workflowId: string;
350
+ compactorModelId: string;
351
+ }
352
+ interface TaskJournal {
353
+ taskId: string;
354
+ exists: boolean;
355
+ content: string | null;
356
+ updatedAt: string | null;
357
+ version: number | null;
358
+ sectionsOverBudget: Record<string, number> | null;
359
+ }
360
+ interface AttachmentUploadResponse {
361
+ id: string;
362
+ filename: string;
363
+ mimeType: string;
364
+ size: number;
365
+ width: number | null;
366
+ height: number | null;
367
+ tokenCount: number | null;
368
+ }
369
+
370
+ interface AuthConfig {
371
+ keycloakEnabled: boolean;
372
+ keycloakUrl: string | null;
373
+ keycloakRealm: string | null;
374
+ keycloakClientId: string | null;
375
+ }
376
+ interface WebSocketClientInfo {
377
+ clientId: string;
378
+ subscription: Record<string, unknown>;
379
+ connected: boolean;
380
+ }
381
+ interface WebSocketStatus {
382
+ connectedClients: number;
383
+ clients: WebSocketClientInfo[];
384
+ }
385
+
386
+ interface SuccessResponse {
387
+ message: string;
388
+ }
389
+ interface MioContext {
390
+ taskId: string;
391
+ currentTokens: number;
392
+ contextLimit: number;
393
+ usagePercentage: number;
394
+ archivedCount: number;
395
+ activeCount: number;
396
+ }
397
+ interface WorkflowStates {
398
+ validStates: Record<string, string[]>;
399
+ processableStates: Record<string, string[]>;
400
+ waitingStates: Record<string, string[]>;
401
+ stoppedStates: Record<string, string[]>;
402
+ intermediateStates: Record<string, string[]>;
403
+ }
404
+
405
+ /**
406
+ * OrchestratorAsync — async REST API wrapper for the DAMIT AIOps Orchestrator.
407
+ *
408
+ * Provides a complete mapping of the orchestrator's HTTP endpoints using
409
+ * native fetch with automatic retry (exponential backoff), typed responses,
410
+ * and configurable auth via bearer token or callback.
411
+ *
412
+ * Usage:
413
+ *
414
+ * const client = new OrchestratorAsync({ baseUrl: "http://localhost:8080" });
415
+ * const tasks = await client.listTasks({ workflowId: "proactive" });
416
+ * for (const t of tasks.tasks) {
417
+ * console.log(t.id, t.status);
418
+ * }
419
+ * await client.close();
420
+ */
421
+
422
+ interface OrchestratorClientOptions {
423
+ /** Base URL of the orchestrator (e.g. "http://localhost:8080"). */
424
+ baseUrl?: string;
425
+ /** Optional static bearer token. */
426
+ apiKey?: string;
427
+ /** Async function that returns a bearer token (called on each request). */
428
+ getToken?: () => string | Promise<string>;
429
+ /** Request timeout in milliseconds (default: 30000). */
430
+ timeoutMs?: number;
431
+ /** Max retry attempts on transient failures (default: 3). */
432
+ maxRetries?: number;
433
+ /**
434
+ * Custom fetch implementation override.
435
+ *
436
+ * Use this to inject a fetch that ignores SSL errors (self-signed certs):
437
+ *
438
+ * new Orchestrator({
439
+ * fetch: await createInsecureFetch(),
440
+ * })
441
+ *
442
+ * When not provided, `globalThis.fetch` is used.
443
+ */
444
+ fetch?: typeof globalThis.fetch;
445
+ /**
446
+ * Allow self-signed / invalid SSL certificates.
447
+ *
448
+ * When true and no custom `fetch` is provided, creates an internal fetch
449
+ * that uses Node.js `https.Agent` with `rejectUnauthorized: false`.
450
+ * Only works in Node.js; ignored in browsers.
451
+ */
452
+ insecure?: boolean;
453
+ }
454
+ declare class OrchestratorAsync {
455
+ protected _baseUrl: string;
456
+ protected _apiKey: string | undefined;
457
+ protected _getToken: (() => string | Promise<string>) | undefined;
458
+ protected _timeoutMs: number;
459
+ protected _maxRetries: number;
460
+ protected _fetch: typeof globalThis.fetch;
461
+ protected _abortController: AbortController | null;
462
+ constructor(opts?: OrchestratorClientOptions);
463
+ protected _insecure: boolean;
464
+ close(): Promise<void>;
465
+ protected _makeUrl(path: string): string;
466
+ protected _resolveHeaders(): Promise<Record<string, string>>;
467
+ protected _request(method: string, path: string, opts?: {
468
+ jsonBody?: unknown;
469
+ params?: Record<string, string | number | boolean | undefined>;
470
+ headers?: Record<string, string>;
471
+ rawResponse?: boolean;
472
+ signal?: AbortSignal;
473
+ }): Promise<Response | unknown>;
474
+ protected _get<T>(path: string, params?: Record<string, string | number | boolean | undefined>): Promise<T>;
475
+ protected _post<T>(path: string, body?: unknown): Promise<T>;
476
+ protected _put<T>(path: string, body?: unknown): Promise<T>;
477
+ protected _delete<T>(path: string): Promise<T>;
478
+ listTasks(params?: {
479
+ workflowId?: string;
480
+ status?: string;
481
+ limit?: number;
482
+ offset?: number;
483
+ sortBy?: string;
484
+ sortOrder?: string;
485
+ }): Promise<TaskListResult>;
486
+ createTask(params: {
487
+ workflowId: string;
488
+ goalPrompt: string;
489
+ maxIterations?: number;
490
+ options?: Record<string, boolean>;
491
+ ticketId?: string;
492
+ title?: string;
493
+ modelId?: string;
494
+ }): Promise<TaskCreateResponse>;
495
+ getTaskStatus(taskId: string): Promise<TaskDetail>;
496
+ getTaskConversation(taskId: string): Promise<ConversationResult>;
497
+ getArchivedMessageContent(taskId: string, messageId: number): Promise<Record<string, unknown>>;
498
+ getTaskCompactions(taskId: string): Promise<CompactionEvent[]>;
499
+ getTaskJournal(taskId: string): Promise<TaskJournal>;
500
+ cancelTask(taskId: string): Promise<SuccessResponse>;
501
+ deleteTask(taskId: string): Promise<TaskDeleteResult>;
502
+ deleteTasks(taskIds: string[]): Promise<TaskDeleteResult>;
503
+ uploadAttachment(taskId: string, file: File | Blob, filename?: string): Promise<AttachmentUploadResponse>;
504
+ downloadAttachment(taskId: string, attachmentId: string): Promise<Blob>;
505
+ sendInteractiveMessage(taskId: string, content: string): Promise<SuccessResponse>;
506
+ markInteractiveComplete(taskId: string): Promise<SuccessResponse>;
507
+ markInteractiveFailed(taskId: string): Promise<SuccessResponse>;
508
+ approveInteractiveAction(taskId: string): Promise<SuccessResponse>;
509
+ sendProactiveGuide(taskId: string, guide: string): Promise<SuccessResponse>;
510
+ respondProactiveHelp(taskId: string, response: string): Promise<SuccessResponse>;
511
+ approveProactiveAction(taskId: string): Promise<SuccessResponse>;
512
+ sendTicketGuide(taskId: string, guide: string): Promise<SuccessResponse>;
513
+ respondTicketHelp(taskId: string, response: string): Promise<SuccessResponse>;
514
+ approveTicketAction(taskId: string): Promise<SuccessResponse>;
515
+ wakeTicket(taskId: string): Promise<SuccessResponse>;
516
+ sendMatrixMessage(taskId: string, content: string): Promise<SuccessResponse>;
517
+ markMatrixComplete(taskId: string): Promise<SuccessResponse>;
518
+ markMatrixFailed(taskId: string): Promise<SuccessResponse>;
519
+ approveMatrixAction(taskId: string): Promise<SuccessResponse>;
520
+ getMatrixConversation(taskId: string): Promise<MatrixConversationResult>;
521
+ createVSATask(params: {
522
+ goalPrompt: string;
523
+ title?: string;
524
+ modelId?: string;
525
+ }): Promise<VSATaskCreateResponse>;
526
+ sendVSAMessage(taskId: string, content: string): Promise<SuccessResponse>;
527
+ renameVSATask(taskId: string, title: string): Promise<SuccessResponse>;
528
+ regenerateVSATitle(taskId: string): Promise<SuccessResponse>;
529
+ markVSAComplete(taskId: string): Promise<SuccessResponse>;
530
+ markVSAFailed(taskId: string): Promise<SuccessResponse>;
531
+ stopVSA(taskId: string): Promise<SuccessResponse>;
532
+ deleteVSA(taskId: string): Promise<SuccessResponse>;
533
+ listVSATasks(params?: {
534
+ status?: string;
535
+ limit?: number;
536
+ offset?: number;
537
+ }): Promise<TaskListResult>;
538
+ searchVSATasks(query: string): Promise<TaskListResult>;
539
+ deleteVSATasksBulk(taskIds: string[]): Promise<SuccessResponse>;
540
+ sendMioMessage(taskId: string, content: string): Promise<SuccessResponse>;
541
+ approveMioAction(taskId: string): Promise<SuccessResponse>;
542
+ wakeMio(taskId: string): Promise<SuccessResponse>;
543
+ sendMioUserAway(taskId: string): Promise<SuccessResponse>;
544
+ markMioComplete(taskId: string): Promise<SuccessResponse>;
545
+ markMioFailed(taskId: string): Promise<SuccessResponse>;
546
+ archiveMio(taskId: string): Promise<SuccessResponse>;
547
+ getMioContext(taskId: string): Promise<MioContext>;
548
+ listTools(): Promise<ToolsListResult>;
549
+ getWorkflowStates(): Promise<WorkflowStates>;
550
+ updateTaskModels(taskId: string, models: {
551
+ agent?: string;
552
+ orchestrator?: string;
553
+ }): Promise<SuccessResponse>;
554
+ updateTaskIteration(taskId: string, iteration: number): Promise<SuccessResponse>;
555
+ updateTaskWorkflowData(taskId: string, workflowData: Record<string, unknown>): Promise<SuccessResponse>;
556
+ deleteMessage(taskId: string, messageId: number): Promise<SuccessResponse>;
557
+ deleteMessages(taskId: string, messageIds: number[]): Promise<SuccessResponse>;
558
+ updateMessage(taskId: string, messageId: number, update: {
559
+ content?: string;
560
+ reasoning?: string;
561
+ }): Promise<SuccessResponse>;
562
+ resetMatrixToPhase(taskId: string, phase: number): Promise<SuccessResponse>;
563
+ getMessageTranslations(taskId: string, messageId: number, locale?: string): Promise<MessageTranslationsResult>;
564
+ listErrors(params?: {
565
+ since?: string;
566
+ severity?: string;
567
+ source?: string;
568
+ limit?: number;
569
+ offset?: number;
570
+ }): Promise<ErrorEventDetail[]>;
571
+ getErrorDetail(errorId: string): Promise<ErrorEventDetail>;
572
+ getErrorStats(since?: string): Promise<ErrorStatsResult>;
573
+ countErrors(since?: string): Promise<ErrorCountResult>;
574
+ purgeErrors(): Promise<ErrorPurgeResult>;
575
+ health(): Promise<HealthStatus>;
576
+ healthDetailed(): Promise<HealthDetail>;
577
+ ready(): Promise<ReadinessResult>;
578
+ healthLeader(): Promise<LeaderStatus>;
579
+ getMetrics(types?: string): Promise<MetricSnapshot>;
580
+ getSystemStatus(): Promise<SystemStatus>;
581
+ updateSettings(settings: Record<string, unknown>): Promise<SystemStatus>;
582
+ getConfigurationStatus(): Promise<ConfigurationStatus>;
583
+ setAgentModel(model: string): Promise<SuccessResponse>;
584
+ setOrchestratorModel(model: string): Promise<SuccessResponse>;
585
+ getLLMBackendStatus(): Promise<Record<string, unknown>>;
586
+ addLLMBackend(host: string, apiKey: string): Promise<SuccessResponse>;
587
+ removeLLMBackend(host: string): Promise<SuccessResponse>;
588
+ getMCPServerStatus(): Promise<Record<string, unknown>>;
589
+ addMCPServer(host: string, apiKey: string): Promise<SuccessResponse>;
590
+ removeMCPServer(host: string): Promise<SuccessResponse>;
591
+ getTaskHandlerStatus(): Promise<TaskHandlerStatus>;
592
+ getTaskHandlerStatusLocal(): Promise<TaskHandlerStatusLocal>;
593
+ setConcurrentTasksPerReplica(maxTasks: number): Promise<SuccessResponse>;
594
+ getSummaryWorkerStatus(): Promise<SummaryWorkerStatus>;
595
+ setCompactorModel(modelName: string): Promise<SuccessResponse>;
596
+ setTranslateModel(modelName: string): Promise<SuccessResponse>;
597
+ getTokenWorkerStatus(): Promise<TokenWorkerStatus>;
598
+ getSlotsStatus(): Promise<SlotsStatus>;
599
+ getAuthConfig(): Promise<AuthConfig>;
600
+ getWebSocketStatus(): Promise<WebSocketStatus>;
601
+ streamTaskStatus(taskId: string): AsyncGenerator<Record<string, unknown>>;
602
+ }
603
+
604
+ /**
605
+ * Synchronous wrapper around OrchestratorAsync.
606
+ *
607
+ * Manages its own resolution so every method returns synchronously.
608
+ * Cannot be used from within an active async context.
609
+ */
610
+ declare class Orchestrator {
611
+ private _async;
612
+ constructor(opts?: OrchestratorClientOptions);
613
+ /** Close the underlying resources. */
614
+ close(): void;
615
+ listTasks(params?: Parameters<OrchestratorAsync["listTasks"]>[0]): TaskListResult;
616
+ createTask(params: Parameters<OrchestratorAsync["createTask"]>[0]): TaskCreateResponse;
617
+ getTaskStatus(taskId: string): TaskDetail;
618
+ getTaskConversation(taskId: string): ConversationResult;
619
+ getArchivedMessageContent(taskId: string, messageId: number): Record<string, unknown>;
620
+ getTaskCompactions(taskId: string): CompactionEvent[];
621
+ getTaskJournal(taskId: string): TaskJournal;
622
+ cancelTask(taskId: string): SuccessResponse;
623
+ deleteTask(taskId: string): TaskDeleteResult;
624
+ deleteTasks(taskIds: string[]): TaskDeleteResult;
625
+ uploadAttachment(taskId: string, file: File | Blob, filename?: string): AttachmentUploadResponse;
626
+ downloadAttachment(taskId: string, attachmentId: string): Blob;
627
+ sendInteractiveMessage(taskId: string, content: string): SuccessResponse;
628
+ markInteractiveComplete(taskId: string): SuccessResponse;
629
+ markInteractiveFailed(taskId: string): SuccessResponse;
630
+ approveInteractiveAction(taskId: string): SuccessResponse;
631
+ sendProactiveGuide(taskId: string, guide: string): SuccessResponse;
632
+ respondProactiveHelp(taskId: string, response: string): SuccessResponse;
633
+ approveProactiveAction(taskId: string): SuccessResponse;
634
+ sendTicketGuide(taskId: string, guide: string): SuccessResponse;
635
+ respondTicketHelp(taskId: string, response: string): SuccessResponse;
636
+ approveTicketAction(taskId: string): SuccessResponse;
637
+ wakeTicket(taskId: string): SuccessResponse;
638
+ sendMatrixMessage(taskId: string, content: string): SuccessResponse;
639
+ markMatrixComplete(taskId: string): SuccessResponse;
640
+ markMatrixFailed(taskId: string): SuccessResponse;
641
+ approveMatrixAction(taskId: string): SuccessResponse;
642
+ getMatrixConversation(taskId: string): MatrixConversationResult;
643
+ createVSATask(params: Parameters<OrchestratorAsync["createVSATask"]>[0]): VSATaskCreateResponse;
644
+ sendVSAMessage(taskId: string, content: string): SuccessResponse;
645
+ renameVSATask(taskId: string, title: string): SuccessResponse;
646
+ regenerateVSATitle(taskId: string): SuccessResponse;
647
+ markVSAComplete(taskId: string): SuccessResponse;
648
+ markVSAFailed(taskId: string): SuccessResponse;
649
+ stopVSA(taskId: string): SuccessResponse;
650
+ deleteVSA(taskId: string): SuccessResponse;
651
+ listVSATasks(params?: Parameters<OrchestratorAsync["listVSATasks"]>[0]): TaskListResult;
652
+ searchVSATasks(query: string): TaskListResult;
653
+ deleteVSATasksBulk(taskIds: string[]): SuccessResponse;
654
+ sendMioMessage(taskId: string, content: string): SuccessResponse;
655
+ approveMioAction(taskId: string): SuccessResponse;
656
+ wakeMio(taskId: string): SuccessResponse;
657
+ sendMioUserAway(taskId: string): SuccessResponse;
658
+ markMioComplete(taskId: string): SuccessResponse;
659
+ markMioFailed(taskId: string): SuccessResponse;
660
+ archiveMio(taskId: string): SuccessResponse;
661
+ getMioContext(taskId: string): MioContext;
662
+ listTools(): ToolsListResult;
663
+ getWorkflowStates(): WorkflowStates;
664
+ updateTaskModels(taskId: string, models: {
665
+ agent?: string;
666
+ orchestrator?: string;
667
+ }): SuccessResponse;
668
+ updateTaskIteration(taskId: string, iteration: number): SuccessResponse;
669
+ updateTaskWorkflowData(taskId: string, workflowData: Record<string, unknown>): SuccessResponse;
670
+ deleteMessage(taskId: string, messageId: number): SuccessResponse;
671
+ deleteMessages(taskId: string, messageIds: number[]): SuccessResponse;
672
+ updateMessage(taskId: string, messageId: number, update: {
673
+ content?: string;
674
+ reasoning?: string;
675
+ }): SuccessResponse;
676
+ resetMatrixToPhase(taskId: string, phase: number): SuccessResponse;
677
+ getMessageTranslations(taskId: string, messageId: number, locale?: string): MessageTranslationsResult;
678
+ listErrors(params?: Parameters<OrchestratorAsync["listErrors"]>[0]): ErrorEventDetail[];
679
+ getErrorDetail(errorId: string): ErrorEventDetail;
680
+ getErrorStats(since?: string): ErrorStatsResult;
681
+ countErrors(since?: string): ErrorCountResult;
682
+ purgeErrors(): ErrorPurgeResult;
683
+ health(): HealthStatus;
684
+ healthDetailed(): HealthDetail;
685
+ ready(): ReadinessResult;
686
+ healthLeader(): LeaderStatus;
687
+ getMetrics(types?: string): MetricSnapshot;
688
+ getSystemStatus(): SystemStatus;
689
+ updateSettings(settings: Record<string, unknown>): SystemStatus;
690
+ getConfigurationStatus(): ConfigurationStatus;
691
+ setAgentModel(model: string): SuccessResponse;
692
+ setOrchestratorModel(model: string): SuccessResponse;
693
+ getLLMBackendStatus(): Record<string, unknown>;
694
+ addLLMBackend(host: string, apiKey: string): SuccessResponse;
695
+ removeLLMBackend(host: string): SuccessResponse;
696
+ getMCPServerStatus(): Record<string, unknown>;
697
+ addMCPServer(host: string, apiKey: string): SuccessResponse;
698
+ removeMCPServer(host: string): SuccessResponse;
699
+ getTaskHandlerStatus(): TaskHandlerStatus;
700
+ getTaskHandlerStatusLocal(): TaskHandlerStatusLocal;
701
+ setConcurrentTasksPerReplica(maxTasks: number): SuccessResponse;
702
+ getSummaryWorkerStatus(): SummaryWorkerStatus;
703
+ setCompactorModel(modelName: string): SuccessResponse;
704
+ setTranslateModel(modelName: string): SuccessResponse;
705
+ getTokenWorkerStatus(): TokenWorkerStatus;
706
+ getSlotsStatus(): SlotsStatus;
707
+ getAuthConfig(): AuthConfig;
708
+ getWebSocketStatus(): WebSocketStatus;
709
+ streamTaskStatus(_taskId: string): Record<string, unknown>[];
710
+ }
711
+
712
+ /**
713
+ * Environment-based configuration for the orchestrator client.
714
+ *
715
+ * All settings are read from environment variables with sensible defaults,
716
+ * so upstream applications can configure the client without passing args.
717
+ */
718
+ interface OrchestratorConfig {
719
+ /** Base URL of the orchestrator (e.g. "http://localhost:8080"). */
720
+ baseUrl: string;
721
+ /** Optional static bearer token sent as `Authorization: Bearer <key>`. */
722
+ apiKey?: string;
723
+ /** Default timeout in milliseconds for HTTP requests. */
724
+ timeoutMs: number;
725
+ /** Maximum retry attempts on transient failures. */
726
+ maxRetries: number;
727
+ }
728
+ /**
729
+ * Build configuration from environment variables.
730
+ *
731
+ * - `ORCHESTRATOR_URL` — base URL (default: "http://localhost:8080")
732
+ * - `ORCHESTRATOR_API_KEY` — optional bearer token
733
+ * - `ORCHESTRATOR_TIMEOUT_MS` — timeout in ms (default: 30000)
734
+ * - `ORCHESTRATOR_MAX_RETRIES` — max retries (default: 3)
735
+ */
736
+ declare function loadConfig(overrides?: Partial<OrchestratorConfig>): OrchestratorConfig;
737
+
738
+ /**
739
+ * Create a fetch implementation that ignores SSL certificate errors.
740
+ *
741
+ * Useful for connecting to orchestrator instances with self-signed or
742
+ * internally-issued certificates during development or in isolated networks.
743
+ *
744
+ * Usage:
745
+ *
746
+ * import { Orchestrator, createInsecureFetch } from "orchestrator-client";
747
+ *
748
+ * const client = new Orchestrator({
749
+ * baseUrl: "https://orchestrator.internal:8443",
750
+ * fetch: await createInsecureFetch(),
751
+ * });
752
+ *
753
+ * Note: Only works in Node.js (uses `https.Agent` underneath).
754
+ * In browser environments, the global `fetch` is returned as-is.
755
+ */
756
+ declare function createInsecureFetch(): Promise<typeof globalThis.fetch>;
757
+
758
+ /**
759
+ * RealtimeClient — Socket.IO wrapper for orchestrator realtime events.
760
+ *
761
+ * Connects to the orchestrator's Socket.IO endpoint (same host:port as the
762
+ * REST API) and provides a typed subscription layer using the server's
763
+ * room-based event system.
764
+ *
765
+ * Usage:
766
+ *
767
+ * const rt = new RealtimeClient("http://localhost:8080");
768
+ * await rt.connect();
769
+ * await rt.subscribeTask("task-abc123");
770
+ *
771
+ * rt.on("task_status_changed", (event) => {
772
+ * console.log(event.new_status);
773
+ * });
774
+ */
775
+ declare const EVENT_TASK_CREATED = "task_created";
776
+ declare const EVENT_TASK_STATUS_CHANGED = "task_status_changed";
777
+ declare const EVENT_TASK_ITERATION_CHANGED = "task_iteration_changed";
778
+ declare const EVENT_TASK_DELETED = "task_deleted";
779
+ declare const EVENT_TASK_RESULT_UPDATED = "task_result_updated";
780
+ declare const EVENT_TASK_INSIGHT_UPDATED = "task_insight_updated";
781
+ declare const EVENT_MESSAGE_ADDED = "message_added";
782
+ declare const EVENT_MESSAGE_STREAMING = "message_streaming";
783
+ declare const EVENT_MESSAGE_SUMMARY_GENERATED = "message_summary_generated";
784
+ declare const EVENT_MESSAGE_TRANSLATION_READY = "message_translation_ready";
785
+ declare const EVENT_ERROR_EVENT_RECORDED = "error_event_recorded";
786
+ type EventHandler = (...args: unknown[]) => void;
787
+ interface RealtimeClientOptions {
788
+ /** Socket.IO connection options. */
789
+ socketOptions?: Record<string, unknown>;
790
+ /** Optional bearer token or async token getter. */
791
+ getToken?: (() => string | Promise<string>) | string;
792
+ /** Whether to auto-connect on construction (default: false). */
793
+ autoConnect?: boolean;
794
+ }
795
+ /**
796
+ * Socket.IO-based realtime client for receiving orchestrator events.
797
+ *
798
+ * Requires the consumer to provide their own `socket.io-client` instance
799
+ * to avoid version conflicts.
800
+ */
801
+ declare class RealtimeClient {
802
+ private _baseUrl;
803
+ private _socketOptions;
804
+ private _getToken?;
805
+ private _socket;
806
+ private _handlers;
807
+ private _connected;
808
+ constructor(baseUrl: string, opts: RealtimeClientOptions);
809
+ get connected(): boolean;
810
+ connect(): Promise<void>;
811
+ disconnect(): Promise<void>;
812
+ /**
813
+ * Subscribe to realtime events for a specific task.
814
+ */
815
+ subscribeTask(taskId: string): Promise<void>;
816
+ /**
817
+ * Unsubscribe from realtime events for a specific task.
818
+ */
819
+ unsubscribeTask(taskId: string): Promise<void>;
820
+ /**
821
+ * Register a handler for a specific event type.
822
+ */
823
+ on(event: string, handler: EventHandler): void;
824
+ /**
825
+ * Remove a registered handler.
826
+ */
827
+ off(event: string, handler: EventHandler): void;
828
+ /**
829
+ * Wait for the connection to close (for long-running listeners).
830
+ */
831
+ wait(): Promise<void>;
832
+ }
833
+
834
+ /**
835
+ * Typed exception hierarchy for orchestrator API interactions.
836
+ *
837
+ * Every error carries `statusCode` and `errorCode` extracted from the
838
+ * server's uniform error envelope, making it easy for callers to handle
839
+ * specific error conditions programmatically.
840
+ */
841
+ /**
842
+ * Base error for all orchestrator-related errors.
843
+ */
844
+ declare class OrchestratorError extends Error {
845
+ readonly statusCode: number | null;
846
+ readonly errorCode: string | null;
847
+ readonly details: Record<string, unknown>;
848
+ constructor(message: string, opts?: {
849
+ statusCode?: number | null;
850
+ errorCode?: string | null;
851
+ details?: Record<string, unknown>;
852
+ });
853
+ }
854
+ /**
855
+ * Orchestrator is unreachable (network / DNS / timeout).
856
+ */
857
+ declare class OrchestratorConnectionError extends OrchestratorError {
858
+ constructor(message: string);
859
+ }
860
+ /**
861
+ * Authentication or authorization failure (401/403).
862
+ */
863
+ declare class OrchestratorAuthError extends OrchestratorError {
864
+ constructor(message: string, statusCode?: number);
865
+ }
866
+ /**
867
+ * Requested resource does not exist (404).
868
+ */
869
+ declare class OrchestratorNotFoundError extends OrchestratorError {
870
+ readonly resourceType: string;
871
+ readonly resourceId: string;
872
+ constructor(resourceType: string, resourceId: string, message?: string);
873
+ }
874
+ /**
875
+ * Non-2xx response from the orchestrator API.
876
+ *
877
+ * Covers 400 Bad Request, 500 Internal Server Error, and any other
878
+ * unexpected status that isn't auth or not-found specific.
879
+ */
880
+ declare class OrchestratorAPIError extends OrchestratorError {
881
+ constructor(message: string, statusCode: number, errorCode?: string | null, details?: Record<string, unknown>);
882
+ }
883
+ /**
884
+ * Invalid or missing client configuration (bad env vars, etc.).
885
+ */
886
+ declare class OrchestratorConfigError extends OrchestratorError {
887
+ constructor(message: string);
888
+ }
889
+
890
+ /**
891
+ * orchestrator-client — TypeScript/JavaScript client for the DAMIT AIOps Orchestrator.
892
+ *
893
+ * Provides a complete wrapper for the orchestrator's REST API and
894
+ * Socket.IO realtime events, with typed responses, automatic retry,
895
+ * and configurable auth.
896
+ *
897
+ * Main components:
898
+ *
899
+ * - {@link Orchestrator} — synchronous REST client (primary interface)
900
+ * - {@link OrchestratorAsync} — async REST client (for async contexts)
901
+ * - {@link RealtimeClient} — Socket.IO event subscription layer
902
+ * - Typed exception hierarchy ({@link OrchestratorError} and subclasses)
903
+ * - Typed response interfaces for all response shapes
904
+ */
905
+ declare const VERSION = "5.6.0";
906
+
907
+ export { type ArchivedContent, type AttachmentMeta, type AttachmentUploadResponse, type AuthConfig, type CompactionEvent, type ComponentHealth, type ConfigurationStatus, type ConversationResult, EVENT_ERROR_EVENT_RECORDED, EVENT_MESSAGE_ADDED, EVENT_MESSAGE_STREAMING, EVENT_MESSAGE_SUMMARY_GENERATED, EVENT_MESSAGE_TRANSLATION_READY, EVENT_TASK_CREATED, EVENT_TASK_DELETED, EVENT_TASK_INSIGHT_UPDATED, EVENT_TASK_ITERATION_CHANGED, EVENT_TASK_RESULT_UPDATED, EVENT_TASK_STATUS_CHANGED, type ErrorCountResult, type ErrorEvent, type ErrorEventDetail, type ErrorPurgeResult, type ErrorStatsResult, type EventHandler, type HealthDetail, type HealthStatus, type LLMBackendInfo, type LeaderStatus, type LockStatus, type MCPServerInfo, type MatrixConversationResult, type Message, type MessageTranslation, type MessageTranslationReadyEvent, type MessageTranslationsResult, type MetricSnapshot, type MioContext, Orchestrator, OrchestratorAPIError, OrchestratorAsync, OrchestratorAuthError, type OrchestratorClientOptions, type OrchestratorConfig, OrchestratorConfigError, OrchestratorConnectionError, OrchestratorError, OrchestratorNotFoundError, type Pagination$1 as Pagination, type ReadinessCheck, type ReadinessResult, RealtimeClient, type RealtimeClientOptions, type SlotInfo, type SlotsStatus, type SuccessResponse, type SummaryWorkerStatus, type SystemStatus, type SystemStatusSettings, type TaskCancelResponse, type TaskCreateResponse, type TaskDeleteResult, type TaskDetail, type TaskHandlerCluster, type TaskHandlerReplica, type TaskHandlerStatus, type TaskHandlerStatusLocal, type TaskJournal, type TaskListResult, type TaskOptions, type TaskSummary, type TokenWorkerStatus, type ToolCall, type ToolInfo, type ToolsListResult, VERSION, type VSATaskCreateResponse, type WebSocketClientInfo, type WebSocketStatus, type WorkflowStates, createInsecureFetch, loadConfig };