orchestrator-client 5.6.0 → 5.7.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.
- package/dist/index.cjs +308 -148
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +308 -148
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -140,7 +140,10 @@ var OrchestratorAsync = class {
|
|
|
140
140
|
constructor(opts = {}) {
|
|
141
141
|
this._abortController = null;
|
|
142
142
|
this._insecure = false;
|
|
143
|
-
this._baseUrl = (opts.baseUrl ?? "http://localhost:8080").replace(
|
|
143
|
+
this._baseUrl = (opts.baseUrl ?? "http://localhost:8080").replace(
|
|
144
|
+
/\/+$/,
|
|
145
|
+
""
|
|
146
|
+
);
|
|
144
147
|
this._apiKey = opts.apiKey;
|
|
145
148
|
this._getToken = opts.getToken;
|
|
146
149
|
this._timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
@@ -162,11 +165,11 @@ var OrchestratorAsync = class {
|
|
|
162
165
|
async _resolveHeaders() {
|
|
163
166
|
const headers = {};
|
|
164
167
|
if (this._apiKey) {
|
|
165
|
-
headers
|
|
168
|
+
headers.Authorization = `Bearer ${this._apiKey}`;
|
|
166
169
|
} else if (this._getToken) {
|
|
167
170
|
const token = await this._getToken();
|
|
168
171
|
if (token) {
|
|
169
|
-
headers
|
|
172
|
+
headers.Authorization = `Bearer ${token}`;
|
|
170
173
|
}
|
|
171
174
|
}
|
|
172
175
|
return headers;
|
|
@@ -322,7 +325,9 @@ var OrchestratorAsync = class {
|
|
|
322
325
|
sort_by: params?.sortBy,
|
|
323
326
|
sort_order: params?.sortOrder
|
|
324
327
|
});
|
|
325
|
-
const tasks = (data.tasks ?? []).map(
|
|
328
|
+
const tasks = (data.tasks ?? []).map(
|
|
329
|
+
buildTaskSummary
|
|
330
|
+
);
|
|
326
331
|
return { tasks, pagination: buildPagination(data) };
|
|
327
332
|
}
|
|
328
333
|
async createTask(params) {
|
|
@@ -350,12 +355,12 @@ var OrchestratorAsync = class {
|
|
|
350
355
|
};
|
|
351
356
|
}
|
|
352
357
|
async getTaskConversation(taskId) {
|
|
353
|
-
const data = await this._get(
|
|
358
|
+
const data = await this._get(
|
|
359
|
+
`/tasks/${taskId}/conversation`
|
|
360
|
+
);
|
|
354
361
|
return {
|
|
355
362
|
taskId: data.taskId ?? data.task_id ?? taskId,
|
|
356
|
-
conversation: (data.conversation ?? []).map(
|
|
357
|
-
(m) => m
|
|
358
|
-
)
|
|
363
|
+
conversation: (data.conversation ?? []).map((m) => m)
|
|
359
364
|
};
|
|
360
365
|
}
|
|
361
366
|
async getArchivedMessageContent(taskId, messageId) {
|
|
@@ -364,11 +369,15 @@ var OrchestratorAsync = class {
|
|
|
364
369
|
);
|
|
365
370
|
}
|
|
366
371
|
async getTaskCompactions(taskId) {
|
|
367
|
-
const data = await this._get(
|
|
372
|
+
const data = await this._get(
|
|
373
|
+
`/tasks/${taskId}/compactions`
|
|
374
|
+
);
|
|
368
375
|
return data.compactions ?? [];
|
|
369
376
|
}
|
|
370
377
|
async getTaskJournal(taskId) {
|
|
371
|
-
const data = await this._get(
|
|
378
|
+
const data = await this._get(
|
|
379
|
+
`/tasks/${taskId}/journal`
|
|
380
|
+
);
|
|
372
381
|
return {
|
|
373
382
|
taskId: data.taskId ?? data.task_id ?? taskId,
|
|
374
383
|
exists: data.exists ?? false,
|
|
@@ -379,11 +388,15 @@ var OrchestratorAsync = class {
|
|
|
379
388
|
};
|
|
380
389
|
}
|
|
381
390
|
async cancelTask(taskId) {
|
|
382
|
-
const data = await this._post(
|
|
391
|
+
const data = await this._post(
|
|
392
|
+
`/tasks/${taskId}/cancel`
|
|
393
|
+
);
|
|
383
394
|
return { message: data.message ?? "" };
|
|
384
395
|
}
|
|
385
396
|
async deleteTask(taskId) {
|
|
386
|
-
const data = await this._delete(
|
|
397
|
+
const data = await this._delete(
|
|
398
|
+
`/tasks/${taskId}`
|
|
399
|
+
);
|
|
387
400
|
return {
|
|
388
401
|
deletedTasks: data.deletedTasks ?? data.deleted_tasks ?? [],
|
|
389
402
|
failedTasks: data.failedTasks ?? data.failed_tasks ?? [],
|
|
@@ -392,7 +405,9 @@ var OrchestratorAsync = class {
|
|
|
392
405
|
};
|
|
393
406
|
}
|
|
394
407
|
async deleteTasks(taskIds) {
|
|
395
|
-
const data = await this._post("/tasks/delete", {
|
|
408
|
+
const data = await this._post("/tasks/delete", {
|
|
409
|
+
task_ids: taskIds
|
|
410
|
+
});
|
|
396
411
|
return {
|
|
397
412
|
deletedTasks: data.deletedTasks ?? data.deleted_tasks ?? [],
|
|
398
413
|
failedTasks: data.failedTasks ?? data.failed_tasks ?? [],
|
|
@@ -407,11 +422,14 @@ var OrchestratorAsync = class {
|
|
|
407
422
|
const formData = new FormData();
|
|
408
423
|
formData.append("file", file, filename);
|
|
409
424
|
const headers = await this._resolveHeaders();
|
|
410
|
-
const response = await this._fetch(
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
425
|
+
const response = await this._fetch(
|
|
426
|
+
this._makeUrl(`/tasks/${taskId}/attachments`),
|
|
427
|
+
{
|
|
428
|
+
method: "POST",
|
|
429
|
+
headers: { ...headers },
|
|
430
|
+
body: formData
|
|
431
|
+
}
|
|
432
|
+
);
|
|
415
433
|
if (!response.ok) {
|
|
416
434
|
throw new OrchestratorAPIError(
|
|
417
435
|
`Attachment upload failed: ${response.statusText}`,
|
|
@@ -431,9 +449,12 @@ var OrchestratorAsync = class {
|
|
|
431
449
|
}
|
|
432
450
|
async downloadAttachment(taskId, attachmentId) {
|
|
433
451
|
const headers = await this._resolveHeaders();
|
|
434
|
-
const response = await this._fetch(
|
|
435
|
-
|
|
436
|
-
|
|
452
|
+
const response = await this._fetch(
|
|
453
|
+
this._makeUrl(`/tasks/${taskId}/attachments/${attachmentId}`),
|
|
454
|
+
{
|
|
455
|
+
headers
|
|
456
|
+
}
|
|
457
|
+
);
|
|
437
458
|
if (!response.ok) {
|
|
438
459
|
throw new OrchestratorAPIError(
|
|
439
460
|
`Attachment download failed: ${response.statusText}`,
|
|
@@ -446,139 +467,197 @@ var OrchestratorAsync = class {
|
|
|
446
467
|
// Interactive workflow
|
|
447
468
|
// ------------------------------------------------------------------
|
|
448
469
|
async sendInteractiveMessage(taskId, content) {
|
|
449
|
-
const data = await this._post(
|
|
450
|
-
|
|
451
|
-
|
|
470
|
+
const data = await this._post(
|
|
471
|
+
`/tasks/${taskId}/interactive/message`,
|
|
472
|
+
{
|
|
473
|
+
content
|
|
474
|
+
}
|
|
475
|
+
);
|
|
452
476
|
return { message: data.message ?? "" };
|
|
453
477
|
}
|
|
454
478
|
async markInteractiveComplete(taskId) {
|
|
455
|
-
const data = await this._post(
|
|
479
|
+
const data = await this._post(
|
|
480
|
+
`/tasks/${taskId}/interactive/complete`
|
|
481
|
+
);
|
|
456
482
|
return { message: data.message ?? "" };
|
|
457
483
|
}
|
|
458
484
|
async markInteractiveFailed(taskId) {
|
|
459
|
-
const data = await this._post(
|
|
485
|
+
const data = await this._post(
|
|
486
|
+
`/tasks/${taskId}/interactive/failed`
|
|
487
|
+
);
|
|
460
488
|
return { message: data.message ?? "" };
|
|
461
489
|
}
|
|
462
490
|
async approveInteractiveAction(taskId) {
|
|
463
|
-
const data = await this._post(
|
|
491
|
+
const data = await this._post(
|
|
492
|
+
`/tasks/${taskId}/interactive/approve`
|
|
493
|
+
);
|
|
464
494
|
return { message: data.message ?? "" };
|
|
465
495
|
}
|
|
466
496
|
// ------------------------------------------------------------------
|
|
467
497
|
// Proactive workflow
|
|
468
498
|
// ------------------------------------------------------------------
|
|
469
499
|
async sendProactiveGuide(taskId, guide) {
|
|
470
|
-
const data = await this._post(
|
|
471
|
-
guide
|
|
472
|
-
|
|
500
|
+
const data = await this._post(
|
|
501
|
+
`/tasks/${taskId}/proactive/guide`,
|
|
502
|
+
{
|
|
503
|
+
guide
|
|
504
|
+
}
|
|
505
|
+
);
|
|
473
506
|
return { message: data.message ?? "" };
|
|
474
507
|
}
|
|
475
508
|
async respondProactiveHelp(taskId, response) {
|
|
476
|
-
const data = await this._post(
|
|
477
|
-
|
|
478
|
-
|
|
509
|
+
const data = await this._post(
|
|
510
|
+
`/tasks/${taskId}/proactive/respond`,
|
|
511
|
+
{
|
|
512
|
+
response
|
|
513
|
+
}
|
|
514
|
+
);
|
|
479
515
|
return { message: data.message ?? "" };
|
|
480
516
|
}
|
|
481
517
|
async approveProactiveAction(taskId) {
|
|
482
|
-
const data = await this._post(
|
|
518
|
+
const data = await this._post(
|
|
519
|
+
`/tasks/${taskId}/proactive/approve`
|
|
520
|
+
);
|
|
483
521
|
return { message: data.message ?? "" };
|
|
484
522
|
}
|
|
485
523
|
// ------------------------------------------------------------------
|
|
486
524
|
// Ticket workflow
|
|
487
525
|
// ------------------------------------------------------------------
|
|
488
526
|
async sendTicketGuide(taskId, guide) {
|
|
489
|
-
const data = await this._post(
|
|
490
|
-
guide
|
|
491
|
-
|
|
527
|
+
const data = await this._post(
|
|
528
|
+
`/tasks/${taskId}/ticket/guide`,
|
|
529
|
+
{
|
|
530
|
+
guide
|
|
531
|
+
}
|
|
532
|
+
);
|
|
492
533
|
return { message: data.message ?? "" };
|
|
493
534
|
}
|
|
494
535
|
async respondTicketHelp(taskId, response) {
|
|
495
|
-
const data = await this._post(
|
|
496
|
-
|
|
497
|
-
|
|
536
|
+
const data = await this._post(
|
|
537
|
+
`/tasks/${taskId}/ticket/respond`,
|
|
538
|
+
{
|
|
539
|
+
response
|
|
540
|
+
}
|
|
541
|
+
);
|
|
498
542
|
return { message: data.message ?? "" };
|
|
499
543
|
}
|
|
500
544
|
async approveTicketAction(taskId) {
|
|
501
|
-
const data = await this._post(
|
|
545
|
+
const data = await this._post(
|
|
546
|
+
`/tasks/${taskId}/ticket/approve`
|
|
547
|
+
);
|
|
502
548
|
return { message: data.message ?? "" };
|
|
503
549
|
}
|
|
504
550
|
async wakeTicket(taskId) {
|
|
505
|
-
const data = await this._post(
|
|
551
|
+
const data = await this._post(
|
|
552
|
+
`/tasks/${taskId}/ticket/wake`
|
|
553
|
+
);
|
|
506
554
|
return { message: data.message ?? "" };
|
|
507
555
|
}
|
|
508
556
|
// ------------------------------------------------------------------
|
|
509
557
|
// Matrix workflow
|
|
510
558
|
// ------------------------------------------------------------------
|
|
511
559
|
async sendMatrixMessage(taskId, content) {
|
|
512
|
-
const data = await this._post(
|
|
513
|
-
|
|
514
|
-
|
|
560
|
+
const data = await this._post(
|
|
561
|
+
`/tasks/${taskId}/matrix/message`,
|
|
562
|
+
{
|
|
563
|
+
content
|
|
564
|
+
}
|
|
565
|
+
);
|
|
515
566
|
return { message: data.message ?? "" };
|
|
516
567
|
}
|
|
517
568
|
async markMatrixComplete(taskId) {
|
|
518
|
-
const data = await this._post(
|
|
569
|
+
const data = await this._post(
|
|
570
|
+
`/tasks/${taskId}/matrix/complete`
|
|
571
|
+
);
|
|
519
572
|
return { message: data.message ?? "" };
|
|
520
573
|
}
|
|
521
574
|
async markMatrixFailed(taskId) {
|
|
522
|
-
const data = await this._post(
|
|
575
|
+
const data = await this._post(
|
|
576
|
+
`/tasks/${taskId}/matrix/failed`
|
|
577
|
+
);
|
|
523
578
|
return { message: data.message ?? "" };
|
|
524
579
|
}
|
|
525
580
|
async approveMatrixAction(taskId) {
|
|
526
|
-
const data = await this._post(
|
|
581
|
+
const data = await this._post(
|
|
582
|
+
`/tasks/${taskId}/matrix/approve`
|
|
583
|
+
);
|
|
527
584
|
return { message: data.message ?? "" };
|
|
528
585
|
}
|
|
529
586
|
async getMatrixConversation(taskId) {
|
|
530
|
-
const data = await this._get(
|
|
587
|
+
const data = await this._get(
|
|
588
|
+
`/tasks/${taskId}/matrix/conversation`
|
|
589
|
+
);
|
|
531
590
|
return {
|
|
532
591
|
taskId: data.taskId ?? data.task_id ?? taskId,
|
|
533
|
-
conversation: (data.conversation ?? []).map(
|
|
534
|
-
(m) => m
|
|
535
|
-
)
|
|
592
|
+
conversation: (data.conversation ?? []).map((m) => m)
|
|
536
593
|
};
|
|
537
594
|
}
|
|
538
595
|
// ------------------------------------------------------------------
|
|
539
596
|
// VSA workflow
|
|
540
597
|
// ------------------------------------------------------------------
|
|
541
598
|
async createVSATask(params) {
|
|
542
|
-
const
|
|
599
|
+
const body = {
|
|
543
600
|
goal_prompt: params.goalPrompt,
|
|
544
601
|
title: params.title,
|
|
545
602
|
model_id: params.modelId
|
|
546
|
-
}
|
|
603
|
+
};
|
|
604
|
+
if (params.delegatedToken !== void 0) {
|
|
605
|
+
body.delegated_token = params.delegatedToken;
|
|
606
|
+
}
|
|
607
|
+
const data = await this._post("/tasks/vsa", body);
|
|
547
608
|
return {
|
|
548
609
|
taskId: data.taskId ?? data.task_id ?? "",
|
|
549
610
|
status: data.status ?? ""
|
|
550
611
|
};
|
|
551
612
|
}
|
|
552
|
-
async sendVSAMessage(taskId, content) {
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
|
|
613
|
+
async sendVSAMessage(taskId, content, options) {
|
|
614
|
+
const body = { content };
|
|
615
|
+
if (options?.delegatedToken !== void 0) {
|
|
616
|
+
body.delegated_token = options.delegatedToken;
|
|
617
|
+
}
|
|
618
|
+
const data = await this._post(
|
|
619
|
+
`/tasks/${taskId}/vsa/message`,
|
|
620
|
+
body
|
|
621
|
+
);
|
|
556
622
|
return { message: data.message ?? "" };
|
|
557
623
|
}
|
|
558
624
|
async renameVSATask(taskId, title) {
|
|
559
|
-
const data = await this._post(
|
|
560
|
-
|
|
561
|
-
|
|
625
|
+
const data = await this._post(
|
|
626
|
+
`/tasks/${taskId}/vsa/rename`,
|
|
627
|
+
{
|
|
628
|
+
title
|
|
629
|
+
}
|
|
630
|
+
);
|
|
562
631
|
return { message: data.message ?? "" };
|
|
563
632
|
}
|
|
564
633
|
async regenerateVSATitle(taskId) {
|
|
565
|
-
const data = await this._post(
|
|
634
|
+
const data = await this._post(
|
|
635
|
+
`/tasks/${taskId}/vsa/regenerate-title`
|
|
636
|
+
);
|
|
566
637
|
return { message: data.message ?? "" };
|
|
567
638
|
}
|
|
568
639
|
async markVSAComplete(taskId) {
|
|
569
|
-
const data = await this._post(
|
|
640
|
+
const data = await this._post(
|
|
641
|
+
`/tasks/${taskId}/vsa/complete`
|
|
642
|
+
);
|
|
570
643
|
return { message: data.message ?? "" };
|
|
571
644
|
}
|
|
572
645
|
async markVSAFailed(taskId) {
|
|
573
|
-
const data = await this._post(
|
|
646
|
+
const data = await this._post(
|
|
647
|
+
`/tasks/${taskId}/vsa/failed`
|
|
648
|
+
);
|
|
574
649
|
return { message: data.message ?? "" };
|
|
575
650
|
}
|
|
576
651
|
async stopVSA(taskId) {
|
|
577
|
-
const data = await this._post(
|
|
652
|
+
const data = await this._post(
|
|
653
|
+
`/tasks/${taskId}/vsa/stop`
|
|
654
|
+
);
|
|
578
655
|
return { message: data.message ?? "" };
|
|
579
656
|
}
|
|
580
657
|
async deleteVSA(taskId) {
|
|
581
|
-
const data = await this._delete(
|
|
658
|
+
const data = await this._delete(
|
|
659
|
+
`/tasks/${taskId}/vsa`
|
|
660
|
+
);
|
|
582
661
|
return { message: data.message ?? "" };
|
|
583
662
|
}
|
|
584
663
|
async listVSATasks(params) {
|
|
@@ -587,55 +666,81 @@ var OrchestratorAsync = class {
|
|
|
587
666
|
limit: params?.limit,
|
|
588
667
|
offset: params?.offset
|
|
589
668
|
});
|
|
590
|
-
const tasks = (data.tasks ?? []).map(
|
|
669
|
+
const tasks = (data.tasks ?? []).map(
|
|
670
|
+
buildTaskSummary
|
|
671
|
+
);
|
|
591
672
|
return { tasks, pagination: buildPagination(data) };
|
|
592
673
|
}
|
|
593
674
|
async searchVSATasks(query) {
|
|
594
|
-
const data = await this._get("/tasks/vsa/search", {
|
|
595
|
-
|
|
675
|
+
const data = await this._get("/tasks/vsa/search", {
|
|
676
|
+
q: query
|
|
677
|
+
});
|
|
678
|
+
const tasks = (data.tasks ?? []).map(
|
|
679
|
+
buildTaskSummary
|
|
680
|
+
);
|
|
596
681
|
return { tasks, pagination: buildPagination(data) };
|
|
597
682
|
}
|
|
598
683
|
async deleteVSATasksBulk(taskIds) {
|
|
599
|
-
const data = await this._post(
|
|
600
|
-
|
|
601
|
-
|
|
684
|
+
const data = await this._post(
|
|
685
|
+
"/tasks/vsa/delete-bulk",
|
|
686
|
+
{
|
|
687
|
+
task_ids: taskIds
|
|
688
|
+
}
|
|
689
|
+
);
|
|
602
690
|
return { message: data.message ?? "" };
|
|
603
691
|
}
|
|
604
692
|
// ------------------------------------------------------------------
|
|
605
693
|
// MIO workflow
|
|
606
694
|
// ------------------------------------------------------------------
|
|
607
695
|
async sendMioMessage(taskId, content) {
|
|
608
|
-
const data = await this._post(
|
|
609
|
-
|
|
610
|
-
|
|
696
|
+
const data = await this._post(
|
|
697
|
+
`/tasks/${taskId}/mio/message`,
|
|
698
|
+
{
|
|
699
|
+
content
|
|
700
|
+
}
|
|
701
|
+
);
|
|
611
702
|
return { message: data.message ?? "" };
|
|
612
703
|
}
|
|
613
704
|
async approveMioAction(taskId) {
|
|
614
|
-
const data = await this._post(
|
|
705
|
+
const data = await this._post(
|
|
706
|
+
`/tasks/${taskId}/mio/approve`
|
|
707
|
+
);
|
|
615
708
|
return { message: data.message ?? "" };
|
|
616
709
|
}
|
|
617
710
|
async wakeMio(taskId) {
|
|
618
|
-
const data = await this._post(
|
|
711
|
+
const data = await this._post(
|
|
712
|
+
`/tasks/${taskId}/mio/wake`
|
|
713
|
+
);
|
|
619
714
|
return { message: data.message ?? "" };
|
|
620
715
|
}
|
|
621
716
|
async sendMioUserAway(taskId) {
|
|
622
|
-
const data = await this._post(
|
|
717
|
+
const data = await this._post(
|
|
718
|
+
`/tasks/${taskId}/mio/user-away`
|
|
719
|
+
);
|
|
623
720
|
return { message: data.message ?? "" };
|
|
624
721
|
}
|
|
625
722
|
async markMioComplete(taskId) {
|
|
626
|
-
const data = await this._post(
|
|
723
|
+
const data = await this._post(
|
|
724
|
+
`/tasks/${taskId}/mio/complete`
|
|
725
|
+
);
|
|
627
726
|
return { message: data.message ?? "" };
|
|
628
727
|
}
|
|
629
728
|
async markMioFailed(taskId) {
|
|
630
|
-
const data = await this._post(
|
|
729
|
+
const data = await this._post(
|
|
730
|
+
`/tasks/${taskId}/mio/failed`
|
|
731
|
+
);
|
|
631
732
|
return { message: data.message ?? "" };
|
|
632
733
|
}
|
|
633
734
|
async archiveMio(taskId) {
|
|
634
|
-
const data = await this._post(
|
|
735
|
+
const data = await this._post(
|
|
736
|
+
`/tasks/${taskId}/mio/archive`
|
|
737
|
+
);
|
|
635
738
|
return { message: data.message ?? "" };
|
|
636
739
|
}
|
|
637
740
|
async getMioContext(taskId) {
|
|
638
|
-
const data = await this._get(
|
|
741
|
+
const data = await this._get(
|
|
742
|
+
`/tasks/${taskId}/mio/context`
|
|
743
|
+
);
|
|
639
744
|
return {
|
|
640
745
|
taskId: data.taskId ?? data.task_id ?? taskId,
|
|
641
746
|
currentTokens: data.currentTokens ?? data.current_tokens ?? 0,
|
|
@@ -651,9 +756,7 @@ var OrchestratorAsync = class {
|
|
|
651
756
|
async listTools() {
|
|
652
757
|
const data = await this._get("/tools");
|
|
653
758
|
return {
|
|
654
|
-
tools: (data.tools ?? data.tools ?? []).map(
|
|
655
|
-
(t) => t
|
|
656
|
-
),
|
|
759
|
+
tools: (data.tools ?? data.tools ?? []).map((t) => t),
|
|
657
760
|
totalTools: data.totalTools ?? data.total_tools ?? 0,
|
|
658
761
|
servers: data.servers ?? []
|
|
659
762
|
};
|
|
@@ -662,7 +765,9 @@ var OrchestratorAsync = class {
|
|
|
662
765
|
// Debug / Admin
|
|
663
766
|
// ------------------------------------------------------------------
|
|
664
767
|
async getWorkflowStates() {
|
|
665
|
-
const data = await this._get(
|
|
768
|
+
const data = await this._get(
|
|
769
|
+
"/debug/workflow-states"
|
|
770
|
+
);
|
|
666
771
|
return {
|
|
667
772
|
validStates: data.validStates ?? data.valid_states ?? {},
|
|
668
773
|
processableStates: data.processableStates ?? data.processable_states ?? {},
|
|
@@ -672,22 +777,31 @@ var OrchestratorAsync = class {
|
|
|
672
777
|
};
|
|
673
778
|
}
|
|
674
779
|
async updateTaskModels(taskId, models) {
|
|
675
|
-
const data = await this._post(
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
780
|
+
const data = await this._post(
|
|
781
|
+
`/tasks/${taskId}/models`,
|
|
782
|
+
{
|
|
783
|
+
agent: models.agent,
|
|
784
|
+
orchestrator: models.orchestrator
|
|
785
|
+
}
|
|
786
|
+
);
|
|
679
787
|
return { message: data.message ?? "" };
|
|
680
788
|
}
|
|
681
789
|
async updateTaskIteration(taskId, iteration) {
|
|
682
|
-
const data = await this._post(
|
|
683
|
-
iteration
|
|
684
|
-
|
|
790
|
+
const data = await this._post(
|
|
791
|
+
`/tasks/${taskId}/iteration`,
|
|
792
|
+
{
|
|
793
|
+
iteration
|
|
794
|
+
}
|
|
795
|
+
);
|
|
685
796
|
return { message: data.message ?? "" };
|
|
686
797
|
}
|
|
687
798
|
async updateTaskWorkflowData(taskId, workflowData) {
|
|
688
|
-
const data = await this._post(
|
|
689
|
-
|
|
690
|
-
|
|
799
|
+
const data = await this._post(
|
|
800
|
+
`/tasks/${taskId}/workflow-data`,
|
|
801
|
+
{
|
|
802
|
+
workflow_data: workflowData
|
|
803
|
+
}
|
|
804
|
+
);
|
|
691
805
|
return { message: data.message ?? "" };
|
|
692
806
|
}
|
|
693
807
|
async deleteMessage(taskId, messageId) {
|
|
@@ -726,9 +840,7 @@ var OrchestratorAsync = class {
|
|
|
726
840
|
);
|
|
727
841
|
return {
|
|
728
842
|
messageId: data.messageId ?? data.message_id ?? messageId,
|
|
729
|
-
translations: (data.translations ?? []).map(
|
|
730
|
-
(t) => t
|
|
731
|
-
)
|
|
843
|
+
translations: (data.translations ?? []).map((t) => t)
|
|
732
844
|
};
|
|
733
845
|
}
|
|
734
846
|
// ------------------------------------------------------------------
|
|
@@ -741,7 +853,10 @@ var OrchestratorAsync = class {
|
|
|
741
853
|
if (params?.source) queryParams.source = params.source;
|
|
742
854
|
if (params?.limit) queryParams.limit = params.limit;
|
|
743
855
|
if (params?.offset) queryParams.offset = params.offset;
|
|
744
|
-
const data = await this._get(
|
|
856
|
+
const data = await this._get(
|
|
857
|
+
"/errors",
|
|
858
|
+
queryParams
|
|
859
|
+
);
|
|
745
860
|
return (data.errors ?? []).map(
|
|
746
861
|
(e) => e
|
|
747
862
|
);
|
|
@@ -795,39 +910,55 @@ var OrchestratorAsync = class {
|
|
|
795
910
|
return this._get("/config");
|
|
796
911
|
}
|
|
797
912
|
async setAgentModel(model) {
|
|
798
|
-
const data = await this._post(
|
|
913
|
+
const data = await this._post(
|
|
914
|
+
"/config/models/agent",
|
|
915
|
+
{ model }
|
|
916
|
+
);
|
|
799
917
|
return { message: data.message ?? "" };
|
|
800
918
|
}
|
|
801
919
|
async setOrchestratorModel(model) {
|
|
802
|
-
const data = await this._post(
|
|
920
|
+
const data = await this._post(
|
|
921
|
+
"/config/models/orchestrator",
|
|
922
|
+
{ model }
|
|
923
|
+
);
|
|
803
924
|
return { message: data.message ?? "" };
|
|
804
925
|
}
|
|
805
926
|
async getLLMBackendStatus() {
|
|
806
927
|
return this._get("/config/llmbackends");
|
|
807
928
|
}
|
|
808
929
|
async addLLMBackend(host, apiKey) {
|
|
809
|
-
const data = await this._post(
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
930
|
+
const data = await this._post(
|
|
931
|
+
"/config/llmbackends",
|
|
932
|
+
{
|
|
933
|
+
host,
|
|
934
|
+
api_key: apiKey
|
|
935
|
+
}
|
|
936
|
+
);
|
|
813
937
|
return { message: data.message ?? "" };
|
|
814
938
|
}
|
|
815
939
|
async removeLLMBackend(host) {
|
|
816
|
-
const data = await this._delete(
|
|
940
|
+
const data = await this._delete(
|
|
941
|
+
`/config/llmbackends/${encodeURIComponent(host)}`
|
|
942
|
+
);
|
|
817
943
|
return { message: data.message ?? "" };
|
|
818
944
|
}
|
|
819
945
|
async getMCPServerStatus() {
|
|
820
946
|
return this._get("/config/mcpservers");
|
|
821
947
|
}
|
|
822
948
|
async addMCPServer(host, apiKey) {
|
|
823
|
-
const data = await this._post(
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
949
|
+
const data = await this._post(
|
|
950
|
+
"/config/mcpservers",
|
|
951
|
+
{
|
|
952
|
+
host,
|
|
953
|
+
api_key: apiKey
|
|
954
|
+
}
|
|
955
|
+
);
|
|
827
956
|
return { message: data.message ?? "" };
|
|
828
957
|
}
|
|
829
958
|
async removeMCPServer(host) {
|
|
830
|
-
const data = await this._delete(
|
|
959
|
+
const data = await this._delete(
|
|
960
|
+
`/config/mcpservers/${encodeURIComponent(host)}`
|
|
961
|
+
);
|
|
831
962
|
return { message: data.message ?? "" };
|
|
832
963
|
}
|
|
833
964
|
async getTaskHandlerStatus() {
|
|
@@ -837,24 +968,33 @@ var OrchestratorAsync = class {
|
|
|
837
968
|
return this._get("/config/taskhandler/local");
|
|
838
969
|
}
|
|
839
970
|
async setConcurrentTasksPerReplica(maxTasks) {
|
|
840
|
-
const data = await this._post(
|
|
841
|
-
|
|
842
|
-
|
|
971
|
+
const data = await this._post(
|
|
972
|
+
"/config/taskhandler/concurrency",
|
|
973
|
+
{
|
|
974
|
+
max_tasks: maxTasks
|
|
975
|
+
}
|
|
976
|
+
);
|
|
843
977
|
return { message: data.message ?? "" };
|
|
844
978
|
}
|
|
845
979
|
async getSummaryWorkerStatus() {
|
|
846
980
|
return this._get("/config/summary-worker");
|
|
847
981
|
}
|
|
848
982
|
async setCompactorModel(modelName) {
|
|
849
|
-
const data = await this._post(
|
|
850
|
-
|
|
851
|
-
|
|
983
|
+
const data = await this._post(
|
|
984
|
+
"/config/models/compactor",
|
|
985
|
+
{
|
|
986
|
+
model_name: modelName
|
|
987
|
+
}
|
|
988
|
+
);
|
|
852
989
|
return { message: data.message ?? "" };
|
|
853
990
|
}
|
|
854
991
|
async setTranslateModel(modelName) {
|
|
855
|
-
const data = await this._post(
|
|
856
|
-
|
|
857
|
-
|
|
992
|
+
const data = await this._post(
|
|
993
|
+
"/config/models/translate",
|
|
994
|
+
{
|
|
995
|
+
model_name: modelName
|
|
996
|
+
}
|
|
997
|
+
);
|
|
858
998
|
return { message: data.message ?? "" };
|
|
859
999
|
}
|
|
860
1000
|
async getTokenWorkerStatus() {
|
|
@@ -877,10 +1017,13 @@ var OrchestratorAsync = class {
|
|
|
877
1017
|
// ------------------------------------------------------------------
|
|
878
1018
|
async *streamTaskStatus(taskId) {
|
|
879
1019
|
const headers = await this._resolveHeaders();
|
|
880
|
-
headers
|
|
881
|
-
const response = await this._fetch(
|
|
882
|
-
|
|
883
|
-
|
|
1020
|
+
headers.Accept = "text/event-stream";
|
|
1021
|
+
const response = await this._fetch(
|
|
1022
|
+
this._makeUrl(`/tasks/${taskId}/stream`),
|
|
1023
|
+
{
|
|
1024
|
+
headers
|
|
1025
|
+
}
|
|
1026
|
+
);
|
|
884
1027
|
if (!response.ok) {
|
|
885
1028
|
throw new OrchestratorAPIError(
|
|
886
1029
|
`Stream connection failed: ${response.statusText}`,
|
|
@@ -920,7 +1063,9 @@ function combineSignals(...signals) {
|
|
|
920
1063
|
controller.abort(signal.reason);
|
|
921
1064
|
return controller.signal;
|
|
922
1065
|
}
|
|
923
|
-
signal.addEventListener("abort", () => controller.abort(signal.reason), {
|
|
1066
|
+
signal.addEventListener("abort", () => controller.abort(signal.reason), {
|
|
1067
|
+
once: true
|
|
1068
|
+
});
|
|
924
1069
|
}
|
|
925
1070
|
return controller.signal;
|
|
926
1071
|
}
|
|
@@ -1043,8 +1188,8 @@ var Orchestrator = class {
|
|
|
1043
1188
|
createVSATask(params) {
|
|
1044
1189
|
return runSync(this._async.createVSATask(params));
|
|
1045
1190
|
}
|
|
1046
|
-
sendVSAMessage(taskId, content) {
|
|
1047
|
-
return runSync(this._async.sendVSAMessage(taskId, content));
|
|
1191
|
+
sendVSAMessage(taskId, content, options) {
|
|
1192
|
+
return runSync(this._async.sendVSAMessage(taskId, content, options));
|
|
1048
1193
|
}
|
|
1049
1194
|
renameVSATask(taskId, title) {
|
|
1050
1195
|
return runSync(this._async.renameVSATask(taskId, title));
|
|
@@ -1134,7 +1279,9 @@ var Orchestrator = class {
|
|
|
1134
1279
|
return runSync(this._async.resetMatrixToPhase(taskId, phase));
|
|
1135
1280
|
}
|
|
1136
1281
|
getMessageTranslations(taskId, messageId, locale) {
|
|
1137
|
-
return runSync(
|
|
1282
|
+
return runSync(
|
|
1283
|
+
this._async.getMessageTranslations(taskId, messageId, locale)
|
|
1284
|
+
);
|
|
1138
1285
|
}
|
|
1139
1286
|
// ------------------------------------------------------------------
|
|
1140
1287
|
// Error events
|
|
@@ -1404,10 +1551,13 @@ var RealtimeClient = class {
|
|
|
1404
1551
|
this._connected = false;
|
|
1405
1552
|
});
|
|
1406
1553
|
return new Promise((resolve, reject) => {
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1554
|
+
if (!this._socket) {
|
|
1555
|
+
reject(new Error("RealtimeClient not connected"));
|
|
1556
|
+
return;
|
|
1557
|
+
}
|
|
1558
|
+
this._socket.on("connect", () => resolve());
|
|
1559
|
+
this._socket.on("connect_error", (err) => reject(err));
|
|
1560
|
+
if (this._socket.connected) {
|
|
1411
1561
|
resolve();
|
|
1412
1562
|
}
|
|
1413
1563
|
});
|
|
@@ -1425,10 +1575,14 @@ var RealtimeClient = class {
|
|
|
1425
1575
|
async subscribeTask(taskId) {
|
|
1426
1576
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1427
1577
|
return new Promise((resolve, reject) => {
|
|
1428
|
-
this._socket
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1578
|
+
this._socket?.emit(
|
|
1579
|
+
"subscribe",
|
|
1580
|
+
{ task_id: taskId },
|
|
1581
|
+
(response) => {
|
|
1582
|
+
if (response.ok) resolve();
|
|
1583
|
+
else reject(new Error(response.error ?? "Subscription failed"));
|
|
1584
|
+
}
|
|
1585
|
+
);
|
|
1432
1586
|
});
|
|
1433
1587
|
}
|
|
1434
1588
|
/**
|
|
@@ -1437,10 +1591,14 @@ var RealtimeClient = class {
|
|
|
1437
1591
|
async unsubscribeTask(taskId) {
|
|
1438
1592
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1439
1593
|
return new Promise((resolve, reject) => {
|
|
1440
|
-
this._socket
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1594
|
+
this._socket?.emit(
|
|
1595
|
+
"unsubscribe",
|
|
1596
|
+
{ task_id: taskId },
|
|
1597
|
+
(response) => {
|
|
1598
|
+
if (response.ok) resolve();
|
|
1599
|
+
else reject(new Error(response.error ?? "Unsubscription failed"));
|
|
1600
|
+
}
|
|
1601
|
+
);
|
|
1444
1602
|
});
|
|
1445
1603
|
}
|
|
1446
1604
|
/**
|
|
@@ -1451,16 +1609,19 @@ var RealtimeClient = class {
|
|
|
1451
1609
|
this._handlers.set(event, /* @__PURE__ */ new Set());
|
|
1452
1610
|
if (this._socket) {
|
|
1453
1611
|
this._socket.on(event, (...args) => {
|
|
1454
|
-
const
|
|
1455
|
-
if (
|
|
1456
|
-
for (const h of
|
|
1612
|
+
const handlers2 = this._handlers.get(event);
|
|
1613
|
+
if (handlers2) {
|
|
1614
|
+
for (const h of handlers2) {
|
|
1457
1615
|
h(...args);
|
|
1458
1616
|
}
|
|
1459
1617
|
}
|
|
1460
1618
|
});
|
|
1461
1619
|
}
|
|
1462
1620
|
}
|
|
1463
|
-
this._handlers.get(event)
|
|
1621
|
+
const handlers = this._handlers.get(event);
|
|
1622
|
+
if (handlers) {
|
|
1623
|
+
handlers.add(handler);
|
|
1624
|
+
}
|
|
1464
1625
|
}
|
|
1465
1626
|
/**
|
|
1466
1627
|
* Remove a registered handler.
|
|
@@ -1482,12 +1643,11 @@ var RealtimeClient = class {
|
|
|
1482
1643
|
*/
|
|
1483
1644
|
wait() {
|
|
1484
1645
|
return new Promise((resolve) => {
|
|
1485
|
-
|
|
1486
|
-
if (!socket) {
|
|
1646
|
+
if (!this._socket) {
|
|
1487
1647
|
resolve();
|
|
1488
1648
|
return;
|
|
1489
1649
|
}
|
|
1490
|
-
|
|
1650
|
+
this._socket.on("disconnect", () => resolve());
|
|
1491
1651
|
});
|
|
1492
1652
|
}
|
|
1493
1653
|
};
|