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.js
CHANGED
|
@@ -82,7 +82,10 @@ var OrchestratorAsync = class {
|
|
|
82
82
|
constructor(opts = {}) {
|
|
83
83
|
this._abortController = null;
|
|
84
84
|
this._insecure = false;
|
|
85
|
-
this._baseUrl = (opts.baseUrl ?? "http://localhost:8080").replace(
|
|
85
|
+
this._baseUrl = (opts.baseUrl ?? "http://localhost:8080").replace(
|
|
86
|
+
/\/+$/,
|
|
87
|
+
""
|
|
88
|
+
);
|
|
86
89
|
this._apiKey = opts.apiKey;
|
|
87
90
|
this._getToken = opts.getToken;
|
|
88
91
|
this._timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
@@ -104,11 +107,11 @@ var OrchestratorAsync = class {
|
|
|
104
107
|
async _resolveHeaders() {
|
|
105
108
|
const headers = {};
|
|
106
109
|
if (this._apiKey) {
|
|
107
|
-
headers
|
|
110
|
+
headers.Authorization = `Bearer ${this._apiKey}`;
|
|
108
111
|
} else if (this._getToken) {
|
|
109
112
|
const token = await this._getToken();
|
|
110
113
|
if (token) {
|
|
111
|
-
headers
|
|
114
|
+
headers.Authorization = `Bearer ${token}`;
|
|
112
115
|
}
|
|
113
116
|
}
|
|
114
117
|
return headers;
|
|
@@ -264,7 +267,9 @@ var OrchestratorAsync = class {
|
|
|
264
267
|
sort_by: params?.sortBy,
|
|
265
268
|
sort_order: params?.sortOrder
|
|
266
269
|
});
|
|
267
|
-
const tasks = (data.tasks ?? []).map(
|
|
270
|
+
const tasks = (data.tasks ?? []).map(
|
|
271
|
+
buildTaskSummary
|
|
272
|
+
);
|
|
268
273
|
return { tasks, pagination: buildPagination(data) };
|
|
269
274
|
}
|
|
270
275
|
async createTask(params) {
|
|
@@ -292,12 +297,12 @@ var OrchestratorAsync = class {
|
|
|
292
297
|
};
|
|
293
298
|
}
|
|
294
299
|
async getTaskConversation(taskId) {
|
|
295
|
-
const data = await this._get(
|
|
300
|
+
const data = await this._get(
|
|
301
|
+
`/tasks/${taskId}/conversation`
|
|
302
|
+
);
|
|
296
303
|
return {
|
|
297
304
|
taskId: data.taskId ?? data.task_id ?? taskId,
|
|
298
|
-
conversation: (data.conversation ?? []).map(
|
|
299
|
-
(m) => m
|
|
300
|
-
)
|
|
305
|
+
conversation: (data.conversation ?? []).map((m) => m)
|
|
301
306
|
};
|
|
302
307
|
}
|
|
303
308
|
async getArchivedMessageContent(taskId, messageId) {
|
|
@@ -306,11 +311,15 @@ var OrchestratorAsync = class {
|
|
|
306
311
|
);
|
|
307
312
|
}
|
|
308
313
|
async getTaskCompactions(taskId) {
|
|
309
|
-
const data = await this._get(
|
|
314
|
+
const data = await this._get(
|
|
315
|
+
`/tasks/${taskId}/compactions`
|
|
316
|
+
);
|
|
310
317
|
return data.compactions ?? [];
|
|
311
318
|
}
|
|
312
319
|
async getTaskJournal(taskId) {
|
|
313
|
-
const data = await this._get(
|
|
320
|
+
const data = await this._get(
|
|
321
|
+
`/tasks/${taskId}/journal`
|
|
322
|
+
);
|
|
314
323
|
return {
|
|
315
324
|
taskId: data.taskId ?? data.task_id ?? taskId,
|
|
316
325
|
exists: data.exists ?? false,
|
|
@@ -321,11 +330,15 @@ var OrchestratorAsync = class {
|
|
|
321
330
|
};
|
|
322
331
|
}
|
|
323
332
|
async cancelTask(taskId) {
|
|
324
|
-
const data = await this._post(
|
|
333
|
+
const data = await this._post(
|
|
334
|
+
`/tasks/${taskId}/cancel`
|
|
335
|
+
);
|
|
325
336
|
return { message: data.message ?? "" };
|
|
326
337
|
}
|
|
327
338
|
async deleteTask(taskId) {
|
|
328
|
-
const data = await this._delete(
|
|
339
|
+
const data = await this._delete(
|
|
340
|
+
`/tasks/${taskId}`
|
|
341
|
+
);
|
|
329
342
|
return {
|
|
330
343
|
deletedTasks: data.deletedTasks ?? data.deleted_tasks ?? [],
|
|
331
344
|
failedTasks: data.failedTasks ?? data.failed_tasks ?? [],
|
|
@@ -334,7 +347,9 @@ var OrchestratorAsync = class {
|
|
|
334
347
|
};
|
|
335
348
|
}
|
|
336
349
|
async deleteTasks(taskIds) {
|
|
337
|
-
const data = await this._post("/tasks/delete", {
|
|
350
|
+
const data = await this._post("/tasks/delete", {
|
|
351
|
+
task_ids: taskIds
|
|
352
|
+
});
|
|
338
353
|
return {
|
|
339
354
|
deletedTasks: data.deletedTasks ?? data.deleted_tasks ?? [],
|
|
340
355
|
failedTasks: data.failedTasks ?? data.failed_tasks ?? [],
|
|
@@ -349,11 +364,14 @@ var OrchestratorAsync = class {
|
|
|
349
364
|
const formData = new FormData();
|
|
350
365
|
formData.append("file", file, filename);
|
|
351
366
|
const headers = await this._resolveHeaders();
|
|
352
|
-
const response = await this._fetch(
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
367
|
+
const response = await this._fetch(
|
|
368
|
+
this._makeUrl(`/tasks/${taskId}/attachments`),
|
|
369
|
+
{
|
|
370
|
+
method: "POST",
|
|
371
|
+
headers: { ...headers },
|
|
372
|
+
body: formData
|
|
373
|
+
}
|
|
374
|
+
);
|
|
357
375
|
if (!response.ok) {
|
|
358
376
|
throw new OrchestratorAPIError(
|
|
359
377
|
`Attachment upload failed: ${response.statusText}`,
|
|
@@ -373,9 +391,12 @@ var OrchestratorAsync = class {
|
|
|
373
391
|
}
|
|
374
392
|
async downloadAttachment(taskId, attachmentId) {
|
|
375
393
|
const headers = await this._resolveHeaders();
|
|
376
|
-
const response = await this._fetch(
|
|
377
|
-
|
|
378
|
-
|
|
394
|
+
const response = await this._fetch(
|
|
395
|
+
this._makeUrl(`/tasks/${taskId}/attachments/${attachmentId}`),
|
|
396
|
+
{
|
|
397
|
+
headers
|
|
398
|
+
}
|
|
399
|
+
);
|
|
379
400
|
if (!response.ok) {
|
|
380
401
|
throw new OrchestratorAPIError(
|
|
381
402
|
`Attachment download failed: ${response.statusText}`,
|
|
@@ -388,139 +409,197 @@ var OrchestratorAsync = class {
|
|
|
388
409
|
// Interactive workflow
|
|
389
410
|
// ------------------------------------------------------------------
|
|
390
411
|
async sendInteractiveMessage(taskId, content) {
|
|
391
|
-
const data = await this._post(
|
|
392
|
-
|
|
393
|
-
|
|
412
|
+
const data = await this._post(
|
|
413
|
+
`/tasks/${taskId}/interactive/message`,
|
|
414
|
+
{
|
|
415
|
+
content
|
|
416
|
+
}
|
|
417
|
+
);
|
|
394
418
|
return { message: data.message ?? "" };
|
|
395
419
|
}
|
|
396
420
|
async markInteractiveComplete(taskId) {
|
|
397
|
-
const data = await this._post(
|
|
421
|
+
const data = await this._post(
|
|
422
|
+
`/tasks/${taskId}/interactive/complete`
|
|
423
|
+
);
|
|
398
424
|
return { message: data.message ?? "" };
|
|
399
425
|
}
|
|
400
426
|
async markInteractiveFailed(taskId) {
|
|
401
|
-
const data = await this._post(
|
|
427
|
+
const data = await this._post(
|
|
428
|
+
`/tasks/${taskId}/interactive/failed`
|
|
429
|
+
);
|
|
402
430
|
return { message: data.message ?? "" };
|
|
403
431
|
}
|
|
404
432
|
async approveInteractiveAction(taskId) {
|
|
405
|
-
const data = await this._post(
|
|
433
|
+
const data = await this._post(
|
|
434
|
+
`/tasks/${taskId}/interactive/approve`
|
|
435
|
+
);
|
|
406
436
|
return { message: data.message ?? "" };
|
|
407
437
|
}
|
|
408
438
|
// ------------------------------------------------------------------
|
|
409
439
|
// Proactive workflow
|
|
410
440
|
// ------------------------------------------------------------------
|
|
411
441
|
async sendProactiveGuide(taskId, guide) {
|
|
412
|
-
const data = await this._post(
|
|
413
|
-
guide
|
|
414
|
-
|
|
442
|
+
const data = await this._post(
|
|
443
|
+
`/tasks/${taskId}/proactive/guide`,
|
|
444
|
+
{
|
|
445
|
+
guide
|
|
446
|
+
}
|
|
447
|
+
);
|
|
415
448
|
return { message: data.message ?? "" };
|
|
416
449
|
}
|
|
417
450
|
async respondProactiveHelp(taskId, response) {
|
|
418
|
-
const data = await this._post(
|
|
419
|
-
|
|
420
|
-
|
|
451
|
+
const data = await this._post(
|
|
452
|
+
`/tasks/${taskId}/proactive/respond`,
|
|
453
|
+
{
|
|
454
|
+
response
|
|
455
|
+
}
|
|
456
|
+
);
|
|
421
457
|
return { message: data.message ?? "" };
|
|
422
458
|
}
|
|
423
459
|
async approveProactiveAction(taskId) {
|
|
424
|
-
const data = await this._post(
|
|
460
|
+
const data = await this._post(
|
|
461
|
+
`/tasks/${taskId}/proactive/approve`
|
|
462
|
+
);
|
|
425
463
|
return { message: data.message ?? "" };
|
|
426
464
|
}
|
|
427
465
|
// ------------------------------------------------------------------
|
|
428
466
|
// Ticket workflow
|
|
429
467
|
// ------------------------------------------------------------------
|
|
430
468
|
async sendTicketGuide(taskId, guide) {
|
|
431
|
-
const data = await this._post(
|
|
432
|
-
guide
|
|
433
|
-
|
|
469
|
+
const data = await this._post(
|
|
470
|
+
`/tasks/${taskId}/ticket/guide`,
|
|
471
|
+
{
|
|
472
|
+
guide
|
|
473
|
+
}
|
|
474
|
+
);
|
|
434
475
|
return { message: data.message ?? "" };
|
|
435
476
|
}
|
|
436
477
|
async respondTicketHelp(taskId, response) {
|
|
437
|
-
const data = await this._post(
|
|
438
|
-
|
|
439
|
-
|
|
478
|
+
const data = await this._post(
|
|
479
|
+
`/tasks/${taskId}/ticket/respond`,
|
|
480
|
+
{
|
|
481
|
+
response
|
|
482
|
+
}
|
|
483
|
+
);
|
|
440
484
|
return { message: data.message ?? "" };
|
|
441
485
|
}
|
|
442
486
|
async approveTicketAction(taskId) {
|
|
443
|
-
const data = await this._post(
|
|
487
|
+
const data = await this._post(
|
|
488
|
+
`/tasks/${taskId}/ticket/approve`
|
|
489
|
+
);
|
|
444
490
|
return { message: data.message ?? "" };
|
|
445
491
|
}
|
|
446
492
|
async wakeTicket(taskId) {
|
|
447
|
-
const data = await this._post(
|
|
493
|
+
const data = await this._post(
|
|
494
|
+
`/tasks/${taskId}/ticket/wake`
|
|
495
|
+
);
|
|
448
496
|
return { message: data.message ?? "" };
|
|
449
497
|
}
|
|
450
498
|
// ------------------------------------------------------------------
|
|
451
499
|
// Matrix workflow
|
|
452
500
|
// ------------------------------------------------------------------
|
|
453
501
|
async sendMatrixMessage(taskId, content) {
|
|
454
|
-
const data = await this._post(
|
|
455
|
-
|
|
456
|
-
|
|
502
|
+
const data = await this._post(
|
|
503
|
+
`/tasks/${taskId}/matrix/message`,
|
|
504
|
+
{
|
|
505
|
+
content
|
|
506
|
+
}
|
|
507
|
+
);
|
|
457
508
|
return { message: data.message ?? "" };
|
|
458
509
|
}
|
|
459
510
|
async markMatrixComplete(taskId) {
|
|
460
|
-
const data = await this._post(
|
|
511
|
+
const data = await this._post(
|
|
512
|
+
`/tasks/${taskId}/matrix/complete`
|
|
513
|
+
);
|
|
461
514
|
return { message: data.message ?? "" };
|
|
462
515
|
}
|
|
463
516
|
async markMatrixFailed(taskId) {
|
|
464
|
-
const data = await this._post(
|
|
517
|
+
const data = await this._post(
|
|
518
|
+
`/tasks/${taskId}/matrix/failed`
|
|
519
|
+
);
|
|
465
520
|
return { message: data.message ?? "" };
|
|
466
521
|
}
|
|
467
522
|
async approveMatrixAction(taskId) {
|
|
468
|
-
const data = await this._post(
|
|
523
|
+
const data = await this._post(
|
|
524
|
+
`/tasks/${taskId}/matrix/approve`
|
|
525
|
+
);
|
|
469
526
|
return { message: data.message ?? "" };
|
|
470
527
|
}
|
|
471
528
|
async getMatrixConversation(taskId) {
|
|
472
|
-
const data = await this._get(
|
|
529
|
+
const data = await this._get(
|
|
530
|
+
`/tasks/${taskId}/matrix/conversation`
|
|
531
|
+
);
|
|
473
532
|
return {
|
|
474
533
|
taskId: data.taskId ?? data.task_id ?? taskId,
|
|
475
|
-
conversation: (data.conversation ?? []).map(
|
|
476
|
-
(m) => m
|
|
477
|
-
)
|
|
534
|
+
conversation: (data.conversation ?? []).map((m) => m)
|
|
478
535
|
};
|
|
479
536
|
}
|
|
480
537
|
// ------------------------------------------------------------------
|
|
481
538
|
// VSA workflow
|
|
482
539
|
// ------------------------------------------------------------------
|
|
483
540
|
async createVSATask(params) {
|
|
484
|
-
const
|
|
541
|
+
const body = {
|
|
485
542
|
goal_prompt: params.goalPrompt,
|
|
486
543
|
title: params.title,
|
|
487
544
|
model_id: params.modelId
|
|
488
|
-
}
|
|
545
|
+
};
|
|
546
|
+
if (params.delegatedToken !== void 0) {
|
|
547
|
+
body.delegated_token = params.delegatedToken;
|
|
548
|
+
}
|
|
549
|
+
const data = await this._post("/tasks/vsa", body);
|
|
489
550
|
return {
|
|
490
551
|
taskId: data.taskId ?? data.task_id ?? "",
|
|
491
552
|
status: data.status ?? ""
|
|
492
553
|
};
|
|
493
554
|
}
|
|
494
|
-
async sendVSAMessage(taskId, content) {
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
-
|
|
555
|
+
async sendVSAMessage(taskId, content, options) {
|
|
556
|
+
const body = { content };
|
|
557
|
+
if (options?.delegatedToken !== void 0) {
|
|
558
|
+
body.delegated_token = options.delegatedToken;
|
|
559
|
+
}
|
|
560
|
+
const data = await this._post(
|
|
561
|
+
`/tasks/${taskId}/vsa/message`,
|
|
562
|
+
body
|
|
563
|
+
);
|
|
498
564
|
return { message: data.message ?? "" };
|
|
499
565
|
}
|
|
500
566
|
async renameVSATask(taskId, title) {
|
|
501
|
-
const data = await this._post(
|
|
502
|
-
|
|
503
|
-
|
|
567
|
+
const data = await this._post(
|
|
568
|
+
`/tasks/${taskId}/vsa/rename`,
|
|
569
|
+
{
|
|
570
|
+
title
|
|
571
|
+
}
|
|
572
|
+
);
|
|
504
573
|
return { message: data.message ?? "" };
|
|
505
574
|
}
|
|
506
575
|
async regenerateVSATitle(taskId) {
|
|
507
|
-
const data = await this._post(
|
|
576
|
+
const data = await this._post(
|
|
577
|
+
`/tasks/${taskId}/vsa/regenerate-title`
|
|
578
|
+
);
|
|
508
579
|
return { message: data.message ?? "" };
|
|
509
580
|
}
|
|
510
581
|
async markVSAComplete(taskId) {
|
|
511
|
-
const data = await this._post(
|
|
582
|
+
const data = await this._post(
|
|
583
|
+
`/tasks/${taskId}/vsa/complete`
|
|
584
|
+
);
|
|
512
585
|
return { message: data.message ?? "" };
|
|
513
586
|
}
|
|
514
587
|
async markVSAFailed(taskId) {
|
|
515
|
-
const data = await this._post(
|
|
588
|
+
const data = await this._post(
|
|
589
|
+
`/tasks/${taskId}/vsa/failed`
|
|
590
|
+
);
|
|
516
591
|
return { message: data.message ?? "" };
|
|
517
592
|
}
|
|
518
593
|
async stopVSA(taskId) {
|
|
519
|
-
const data = await this._post(
|
|
594
|
+
const data = await this._post(
|
|
595
|
+
`/tasks/${taskId}/vsa/stop`
|
|
596
|
+
);
|
|
520
597
|
return { message: data.message ?? "" };
|
|
521
598
|
}
|
|
522
599
|
async deleteVSA(taskId) {
|
|
523
|
-
const data = await this._delete(
|
|
600
|
+
const data = await this._delete(
|
|
601
|
+
`/tasks/${taskId}/vsa`
|
|
602
|
+
);
|
|
524
603
|
return { message: data.message ?? "" };
|
|
525
604
|
}
|
|
526
605
|
async listVSATasks(params) {
|
|
@@ -529,55 +608,81 @@ var OrchestratorAsync = class {
|
|
|
529
608
|
limit: params?.limit,
|
|
530
609
|
offset: params?.offset
|
|
531
610
|
});
|
|
532
|
-
const tasks = (data.tasks ?? []).map(
|
|
611
|
+
const tasks = (data.tasks ?? []).map(
|
|
612
|
+
buildTaskSummary
|
|
613
|
+
);
|
|
533
614
|
return { tasks, pagination: buildPagination(data) };
|
|
534
615
|
}
|
|
535
616
|
async searchVSATasks(query) {
|
|
536
|
-
const data = await this._get("/tasks/vsa/search", {
|
|
537
|
-
|
|
617
|
+
const data = await this._get("/tasks/vsa/search", {
|
|
618
|
+
q: query
|
|
619
|
+
});
|
|
620
|
+
const tasks = (data.tasks ?? []).map(
|
|
621
|
+
buildTaskSummary
|
|
622
|
+
);
|
|
538
623
|
return { tasks, pagination: buildPagination(data) };
|
|
539
624
|
}
|
|
540
625
|
async deleteVSATasksBulk(taskIds) {
|
|
541
|
-
const data = await this._post(
|
|
542
|
-
|
|
543
|
-
|
|
626
|
+
const data = await this._post(
|
|
627
|
+
"/tasks/vsa/delete-bulk",
|
|
628
|
+
{
|
|
629
|
+
task_ids: taskIds
|
|
630
|
+
}
|
|
631
|
+
);
|
|
544
632
|
return { message: data.message ?? "" };
|
|
545
633
|
}
|
|
546
634
|
// ------------------------------------------------------------------
|
|
547
635
|
// MIO workflow
|
|
548
636
|
// ------------------------------------------------------------------
|
|
549
637
|
async sendMioMessage(taskId, content) {
|
|
550
|
-
const data = await this._post(
|
|
551
|
-
|
|
552
|
-
|
|
638
|
+
const data = await this._post(
|
|
639
|
+
`/tasks/${taskId}/mio/message`,
|
|
640
|
+
{
|
|
641
|
+
content
|
|
642
|
+
}
|
|
643
|
+
);
|
|
553
644
|
return { message: data.message ?? "" };
|
|
554
645
|
}
|
|
555
646
|
async approveMioAction(taskId) {
|
|
556
|
-
const data = await this._post(
|
|
647
|
+
const data = await this._post(
|
|
648
|
+
`/tasks/${taskId}/mio/approve`
|
|
649
|
+
);
|
|
557
650
|
return { message: data.message ?? "" };
|
|
558
651
|
}
|
|
559
652
|
async wakeMio(taskId) {
|
|
560
|
-
const data = await this._post(
|
|
653
|
+
const data = await this._post(
|
|
654
|
+
`/tasks/${taskId}/mio/wake`
|
|
655
|
+
);
|
|
561
656
|
return { message: data.message ?? "" };
|
|
562
657
|
}
|
|
563
658
|
async sendMioUserAway(taskId) {
|
|
564
|
-
const data = await this._post(
|
|
659
|
+
const data = await this._post(
|
|
660
|
+
`/tasks/${taskId}/mio/user-away`
|
|
661
|
+
);
|
|
565
662
|
return { message: data.message ?? "" };
|
|
566
663
|
}
|
|
567
664
|
async markMioComplete(taskId) {
|
|
568
|
-
const data = await this._post(
|
|
665
|
+
const data = await this._post(
|
|
666
|
+
`/tasks/${taskId}/mio/complete`
|
|
667
|
+
);
|
|
569
668
|
return { message: data.message ?? "" };
|
|
570
669
|
}
|
|
571
670
|
async markMioFailed(taskId) {
|
|
572
|
-
const data = await this._post(
|
|
671
|
+
const data = await this._post(
|
|
672
|
+
`/tasks/${taskId}/mio/failed`
|
|
673
|
+
);
|
|
573
674
|
return { message: data.message ?? "" };
|
|
574
675
|
}
|
|
575
676
|
async archiveMio(taskId) {
|
|
576
|
-
const data = await this._post(
|
|
677
|
+
const data = await this._post(
|
|
678
|
+
`/tasks/${taskId}/mio/archive`
|
|
679
|
+
);
|
|
577
680
|
return { message: data.message ?? "" };
|
|
578
681
|
}
|
|
579
682
|
async getMioContext(taskId) {
|
|
580
|
-
const data = await this._get(
|
|
683
|
+
const data = await this._get(
|
|
684
|
+
`/tasks/${taskId}/mio/context`
|
|
685
|
+
);
|
|
581
686
|
return {
|
|
582
687
|
taskId: data.taskId ?? data.task_id ?? taskId,
|
|
583
688
|
currentTokens: data.currentTokens ?? data.current_tokens ?? 0,
|
|
@@ -593,9 +698,7 @@ var OrchestratorAsync = class {
|
|
|
593
698
|
async listTools() {
|
|
594
699
|
const data = await this._get("/tools");
|
|
595
700
|
return {
|
|
596
|
-
tools: (data.tools ?? data.tools ?? []).map(
|
|
597
|
-
(t) => t
|
|
598
|
-
),
|
|
701
|
+
tools: (data.tools ?? data.tools ?? []).map((t) => t),
|
|
599
702
|
totalTools: data.totalTools ?? data.total_tools ?? 0,
|
|
600
703
|
servers: data.servers ?? []
|
|
601
704
|
};
|
|
@@ -604,7 +707,9 @@ var OrchestratorAsync = class {
|
|
|
604
707
|
// Debug / Admin
|
|
605
708
|
// ------------------------------------------------------------------
|
|
606
709
|
async getWorkflowStates() {
|
|
607
|
-
const data = await this._get(
|
|
710
|
+
const data = await this._get(
|
|
711
|
+
"/debug/workflow-states"
|
|
712
|
+
);
|
|
608
713
|
return {
|
|
609
714
|
validStates: data.validStates ?? data.valid_states ?? {},
|
|
610
715
|
processableStates: data.processableStates ?? data.processable_states ?? {},
|
|
@@ -614,22 +719,31 @@ var OrchestratorAsync = class {
|
|
|
614
719
|
};
|
|
615
720
|
}
|
|
616
721
|
async updateTaskModels(taskId, models) {
|
|
617
|
-
const data = await this._post(
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
722
|
+
const data = await this._post(
|
|
723
|
+
`/tasks/${taskId}/models`,
|
|
724
|
+
{
|
|
725
|
+
agent: models.agent,
|
|
726
|
+
orchestrator: models.orchestrator
|
|
727
|
+
}
|
|
728
|
+
);
|
|
621
729
|
return { message: data.message ?? "" };
|
|
622
730
|
}
|
|
623
731
|
async updateTaskIteration(taskId, iteration) {
|
|
624
|
-
const data = await this._post(
|
|
625
|
-
iteration
|
|
626
|
-
|
|
732
|
+
const data = await this._post(
|
|
733
|
+
`/tasks/${taskId}/iteration`,
|
|
734
|
+
{
|
|
735
|
+
iteration
|
|
736
|
+
}
|
|
737
|
+
);
|
|
627
738
|
return { message: data.message ?? "" };
|
|
628
739
|
}
|
|
629
740
|
async updateTaskWorkflowData(taskId, workflowData) {
|
|
630
|
-
const data = await this._post(
|
|
631
|
-
|
|
632
|
-
|
|
741
|
+
const data = await this._post(
|
|
742
|
+
`/tasks/${taskId}/workflow-data`,
|
|
743
|
+
{
|
|
744
|
+
workflow_data: workflowData
|
|
745
|
+
}
|
|
746
|
+
);
|
|
633
747
|
return { message: data.message ?? "" };
|
|
634
748
|
}
|
|
635
749
|
async deleteMessage(taskId, messageId) {
|
|
@@ -668,9 +782,7 @@ var OrchestratorAsync = class {
|
|
|
668
782
|
);
|
|
669
783
|
return {
|
|
670
784
|
messageId: data.messageId ?? data.message_id ?? messageId,
|
|
671
|
-
translations: (data.translations ?? []).map(
|
|
672
|
-
(t) => t
|
|
673
|
-
)
|
|
785
|
+
translations: (data.translations ?? []).map((t) => t)
|
|
674
786
|
};
|
|
675
787
|
}
|
|
676
788
|
// ------------------------------------------------------------------
|
|
@@ -683,7 +795,10 @@ var OrchestratorAsync = class {
|
|
|
683
795
|
if (params?.source) queryParams.source = params.source;
|
|
684
796
|
if (params?.limit) queryParams.limit = params.limit;
|
|
685
797
|
if (params?.offset) queryParams.offset = params.offset;
|
|
686
|
-
const data = await this._get(
|
|
798
|
+
const data = await this._get(
|
|
799
|
+
"/errors",
|
|
800
|
+
queryParams
|
|
801
|
+
);
|
|
687
802
|
return (data.errors ?? []).map(
|
|
688
803
|
(e) => e
|
|
689
804
|
);
|
|
@@ -737,39 +852,55 @@ var OrchestratorAsync = class {
|
|
|
737
852
|
return this._get("/config");
|
|
738
853
|
}
|
|
739
854
|
async setAgentModel(model) {
|
|
740
|
-
const data = await this._post(
|
|
855
|
+
const data = await this._post(
|
|
856
|
+
"/config/models/agent",
|
|
857
|
+
{ model }
|
|
858
|
+
);
|
|
741
859
|
return { message: data.message ?? "" };
|
|
742
860
|
}
|
|
743
861
|
async setOrchestratorModel(model) {
|
|
744
|
-
const data = await this._post(
|
|
862
|
+
const data = await this._post(
|
|
863
|
+
"/config/models/orchestrator",
|
|
864
|
+
{ model }
|
|
865
|
+
);
|
|
745
866
|
return { message: data.message ?? "" };
|
|
746
867
|
}
|
|
747
868
|
async getLLMBackendStatus() {
|
|
748
869
|
return this._get("/config/llmbackends");
|
|
749
870
|
}
|
|
750
871
|
async addLLMBackend(host, apiKey) {
|
|
751
|
-
const data = await this._post(
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
872
|
+
const data = await this._post(
|
|
873
|
+
"/config/llmbackends",
|
|
874
|
+
{
|
|
875
|
+
host,
|
|
876
|
+
api_key: apiKey
|
|
877
|
+
}
|
|
878
|
+
);
|
|
755
879
|
return { message: data.message ?? "" };
|
|
756
880
|
}
|
|
757
881
|
async removeLLMBackend(host) {
|
|
758
|
-
const data = await this._delete(
|
|
882
|
+
const data = await this._delete(
|
|
883
|
+
`/config/llmbackends/${encodeURIComponent(host)}`
|
|
884
|
+
);
|
|
759
885
|
return { message: data.message ?? "" };
|
|
760
886
|
}
|
|
761
887
|
async getMCPServerStatus() {
|
|
762
888
|
return this._get("/config/mcpservers");
|
|
763
889
|
}
|
|
764
890
|
async addMCPServer(host, apiKey) {
|
|
765
|
-
const data = await this._post(
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
891
|
+
const data = await this._post(
|
|
892
|
+
"/config/mcpservers",
|
|
893
|
+
{
|
|
894
|
+
host,
|
|
895
|
+
api_key: apiKey
|
|
896
|
+
}
|
|
897
|
+
);
|
|
769
898
|
return { message: data.message ?? "" };
|
|
770
899
|
}
|
|
771
900
|
async removeMCPServer(host) {
|
|
772
|
-
const data = await this._delete(
|
|
901
|
+
const data = await this._delete(
|
|
902
|
+
`/config/mcpservers/${encodeURIComponent(host)}`
|
|
903
|
+
);
|
|
773
904
|
return { message: data.message ?? "" };
|
|
774
905
|
}
|
|
775
906
|
async getTaskHandlerStatus() {
|
|
@@ -779,24 +910,33 @@ var OrchestratorAsync = class {
|
|
|
779
910
|
return this._get("/config/taskhandler/local");
|
|
780
911
|
}
|
|
781
912
|
async setConcurrentTasksPerReplica(maxTasks) {
|
|
782
|
-
const data = await this._post(
|
|
783
|
-
|
|
784
|
-
|
|
913
|
+
const data = await this._post(
|
|
914
|
+
"/config/taskhandler/concurrency",
|
|
915
|
+
{
|
|
916
|
+
max_tasks: maxTasks
|
|
917
|
+
}
|
|
918
|
+
);
|
|
785
919
|
return { message: data.message ?? "" };
|
|
786
920
|
}
|
|
787
921
|
async getSummaryWorkerStatus() {
|
|
788
922
|
return this._get("/config/summary-worker");
|
|
789
923
|
}
|
|
790
924
|
async setCompactorModel(modelName) {
|
|
791
|
-
const data = await this._post(
|
|
792
|
-
|
|
793
|
-
|
|
925
|
+
const data = await this._post(
|
|
926
|
+
"/config/models/compactor",
|
|
927
|
+
{
|
|
928
|
+
model_name: modelName
|
|
929
|
+
}
|
|
930
|
+
);
|
|
794
931
|
return { message: data.message ?? "" };
|
|
795
932
|
}
|
|
796
933
|
async setTranslateModel(modelName) {
|
|
797
|
-
const data = await this._post(
|
|
798
|
-
|
|
799
|
-
|
|
934
|
+
const data = await this._post(
|
|
935
|
+
"/config/models/translate",
|
|
936
|
+
{
|
|
937
|
+
model_name: modelName
|
|
938
|
+
}
|
|
939
|
+
);
|
|
800
940
|
return { message: data.message ?? "" };
|
|
801
941
|
}
|
|
802
942
|
async getTokenWorkerStatus() {
|
|
@@ -819,10 +959,13 @@ var OrchestratorAsync = class {
|
|
|
819
959
|
// ------------------------------------------------------------------
|
|
820
960
|
async *streamTaskStatus(taskId) {
|
|
821
961
|
const headers = await this._resolveHeaders();
|
|
822
|
-
headers
|
|
823
|
-
const response = await this._fetch(
|
|
824
|
-
|
|
825
|
-
|
|
962
|
+
headers.Accept = "text/event-stream";
|
|
963
|
+
const response = await this._fetch(
|
|
964
|
+
this._makeUrl(`/tasks/${taskId}/stream`),
|
|
965
|
+
{
|
|
966
|
+
headers
|
|
967
|
+
}
|
|
968
|
+
);
|
|
826
969
|
if (!response.ok) {
|
|
827
970
|
throw new OrchestratorAPIError(
|
|
828
971
|
`Stream connection failed: ${response.statusText}`,
|
|
@@ -862,7 +1005,9 @@ function combineSignals(...signals) {
|
|
|
862
1005
|
controller.abort(signal.reason);
|
|
863
1006
|
return controller.signal;
|
|
864
1007
|
}
|
|
865
|
-
signal.addEventListener("abort", () => controller.abort(signal.reason), {
|
|
1008
|
+
signal.addEventListener("abort", () => controller.abort(signal.reason), {
|
|
1009
|
+
once: true
|
|
1010
|
+
});
|
|
866
1011
|
}
|
|
867
1012
|
return controller.signal;
|
|
868
1013
|
}
|
|
@@ -985,8 +1130,8 @@ var Orchestrator = class {
|
|
|
985
1130
|
createVSATask(params) {
|
|
986
1131
|
return runSync(this._async.createVSATask(params));
|
|
987
1132
|
}
|
|
988
|
-
sendVSAMessage(taskId, content) {
|
|
989
|
-
return runSync(this._async.sendVSAMessage(taskId, content));
|
|
1133
|
+
sendVSAMessage(taskId, content, options) {
|
|
1134
|
+
return runSync(this._async.sendVSAMessage(taskId, content, options));
|
|
990
1135
|
}
|
|
991
1136
|
renameVSATask(taskId, title) {
|
|
992
1137
|
return runSync(this._async.renameVSATask(taskId, title));
|
|
@@ -1076,7 +1221,9 @@ var Orchestrator = class {
|
|
|
1076
1221
|
return runSync(this._async.resetMatrixToPhase(taskId, phase));
|
|
1077
1222
|
}
|
|
1078
1223
|
getMessageTranslations(taskId, messageId, locale) {
|
|
1079
|
-
return runSync(
|
|
1224
|
+
return runSync(
|
|
1225
|
+
this._async.getMessageTranslations(taskId, messageId, locale)
|
|
1226
|
+
);
|
|
1080
1227
|
}
|
|
1081
1228
|
// ------------------------------------------------------------------
|
|
1082
1229
|
// Error events
|
|
@@ -1346,10 +1493,13 @@ var RealtimeClient = class {
|
|
|
1346
1493
|
this._connected = false;
|
|
1347
1494
|
});
|
|
1348
1495
|
return new Promise((resolve, reject) => {
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1496
|
+
if (!this._socket) {
|
|
1497
|
+
reject(new Error("RealtimeClient not connected"));
|
|
1498
|
+
return;
|
|
1499
|
+
}
|
|
1500
|
+
this._socket.on("connect", () => resolve());
|
|
1501
|
+
this._socket.on("connect_error", (err) => reject(err));
|
|
1502
|
+
if (this._socket.connected) {
|
|
1353
1503
|
resolve();
|
|
1354
1504
|
}
|
|
1355
1505
|
});
|
|
@@ -1367,10 +1517,14 @@ var RealtimeClient = class {
|
|
|
1367
1517
|
async subscribeTask(taskId) {
|
|
1368
1518
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1369
1519
|
return new Promise((resolve, reject) => {
|
|
1370
|
-
this._socket
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1520
|
+
this._socket?.emit(
|
|
1521
|
+
"subscribe",
|
|
1522
|
+
{ task_id: taskId },
|
|
1523
|
+
(response) => {
|
|
1524
|
+
if (response.ok) resolve();
|
|
1525
|
+
else reject(new Error(response.error ?? "Subscription failed"));
|
|
1526
|
+
}
|
|
1527
|
+
);
|
|
1374
1528
|
});
|
|
1375
1529
|
}
|
|
1376
1530
|
/**
|
|
@@ -1379,10 +1533,14 @@ var RealtimeClient = class {
|
|
|
1379
1533
|
async unsubscribeTask(taskId) {
|
|
1380
1534
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1381
1535
|
return new Promise((resolve, reject) => {
|
|
1382
|
-
this._socket
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1536
|
+
this._socket?.emit(
|
|
1537
|
+
"unsubscribe",
|
|
1538
|
+
{ task_id: taskId },
|
|
1539
|
+
(response) => {
|
|
1540
|
+
if (response.ok) resolve();
|
|
1541
|
+
else reject(new Error(response.error ?? "Unsubscription failed"));
|
|
1542
|
+
}
|
|
1543
|
+
);
|
|
1386
1544
|
});
|
|
1387
1545
|
}
|
|
1388
1546
|
/**
|
|
@@ -1393,16 +1551,19 @@ var RealtimeClient = class {
|
|
|
1393
1551
|
this._handlers.set(event, /* @__PURE__ */ new Set());
|
|
1394
1552
|
if (this._socket) {
|
|
1395
1553
|
this._socket.on(event, (...args) => {
|
|
1396
|
-
const
|
|
1397
|
-
if (
|
|
1398
|
-
for (const h of
|
|
1554
|
+
const handlers2 = this._handlers.get(event);
|
|
1555
|
+
if (handlers2) {
|
|
1556
|
+
for (const h of handlers2) {
|
|
1399
1557
|
h(...args);
|
|
1400
1558
|
}
|
|
1401
1559
|
}
|
|
1402
1560
|
});
|
|
1403
1561
|
}
|
|
1404
1562
|
}
|
|
1405
|
-
this._handlers.get(event)
|
|
1563
|
+
const handlers = this._handlers.get(event);
|
|
1564
|
+
if (handlers) {
|
|
1565
|
+
handlers.add(handler);
|
|
1566
|
+
}
|
|
1406
1567
|
}
|
|
1407
1568
|
/**
|
|
1408
1569
|
* Remove a registered handler.
|
|
@@ -1424,12 +1585,11 @@ var RealtimeClient = class {
|
|
|
1424
1585
|
*/
|
|
1425
1586
|
wait() {
|
|
1426
1587
|
return new Promise((resolve) => {
|
|
1427
|
-
|
|
1428
|
-
if (!socket) {
|
|
1588
|
+
if (!this._socket) {
|
|
1429
1589
|
resolve();
|
|
1430
1590
|
return;
|
|
1431
1591
|
}
|
|
1432
|
-
|
|
1592
|
+
this._socket.on("disconnect", () => resolve());
|
|
1433
1593
|
});
|
|
1434
1594
|
}
|
|
1435
1595
|
};
|