orchestrator-client 5.7.0 → 5.7.1
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 +545 -300
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +251 -77
- package/dist/index.d.ts +251 -77
- package/dist/index.js +545 -300
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -317,13 +317,17 @@ var OrchestratorAsync = class {
|
|
|
317
317
|
// Tasks
|
|
318
318
|
// ------------------------------------------------------------------
|
|
319
319
|
async listTasks(params) {
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
320
|
+
const headers = {};
|
|
321
|
+
if (params?.locale) headers["X-Locale"] = params.locale;
|
|
322
|
+
const data = await this._request("GET", "/tasks", {
|
|
323
|
+
params: {
|
|
324
|
+
page: params?.page,
|
|
325
|
+
limit: params?.limit,
|
|
326
|
+
order_by: params?.orderBy,
|
|
327
|
+
order_direction: params?.orderDirection,
|
|
328
|
+
workflow_id: params?.workflowId
|
|
329
|
+
},
|
|
330
|
+
headers
|
|
327
331
|
});
|
|
328
332
|
const tasks = (data.tasks ?? []).map(
|
|
329
333
|
buildTaskSummary
|
|
@@ -331,22 +335,36 @@ var OrchestratorAsync = class {
|
|
|
331
335
|
return { tasks, pagination: buildPagination(data) };
|
|
332
336
|
}
|
|
333
337
|
async createTask(params) {
|
|
334
|
-
const data = await this._post("/
|
|
338
|
+
const data = await this._post("/task/create", {
|
|
335
339
|
workflow_id: params.workflowId,
|
|
336
340
|
goal_prompt: params.goalPrompt,
|
|
337
341
|
max_iterations: params.maxIterations,
|
|
338
|
-
|
|
342
|
+
reasoning_effort: params.reasoningEffort,
|
|
343
|
+
system_prompt: params.systemPrompt,
|
|
344
|
+
developer_prompt: params.developerPrompt,
|
|
339
345
|
ticket_id: params.ticketId,
|
|
340
|
-
|
|
341
|
-
|
|
346
|
+
ticket_text: params.ticketText,
|
|
347
|
+
summary: params.summary,
|
|
348
|
+
problem_summary: params.problemSummary,
|
|
349
|
+
solution_strategy: params.solutionStrategy,
|
|
350
|
+
agent_model_id: params.agentModelId,
|
|
351
|
+
orchestrator_model_id: params.orchestratorModelId,
|
|
352
|
+
available_tools: params.availableTools,
|
|
353
|
+
attachment_ids: params.attachmentIds,
|
|
354
|
+
options: params.options
|
|
342
355
|
});
|
|
343
356
|
return {
|
|
344
357
|
taskId: data.taskId ?? data.task_id ?? "",
|
|
345
358
|
status: data.status ?? ""
|
|
346
359
|
};
|
|
347
360
|
}
|
|
348
|
-
async getTaskStatus(taskId) {
|
|
349
|
-
const
|
|
361
|
+
async getTaskStatus(taskId, locale) {
|
|
362
|
+
const headers = {};
|
|
363
|
+
if (locale) headers["X-Locale"] = locale;
|
|
364
|
+
const data = await this._request("GET", "/task/status", {
|
|
365
|
+
params: { task_id: taskId },
|
|
366
|
+
headers
|
|
367
|
+
});
|
|
350
368
|
return {
|
|
351
369
|
...buildTaskSummary(data),
|
|
352
370
|
subtaskIds: data.subtaskIds ?? data.subtask_ids ?? [],
|
|
@@ -354,10 +372,24 @@ var OrchestratorAsync = class {
|
|
|
354
372
|
options: data.options ?? null
|
|
355
373
|
};
|
|
356
374
|
}
|
|
357
|
-
async
|
|
358
|
-
const data = await this.
|
|
359
|
-
|
|
360
|
-
|
|
375
|
+
async setTaskStatus(taskId, status) {
|
|
376
|
+
const data = await this._post("/task/set_status", {
|
|
377
|
+
task_id: taskId,
|
|
378
|
+
status
|
|
379
|
+
});
|
|
380
|
+
return { message: data.message ?? "" };
|
|
381
|
+
}
|
|
382
|
+
async getTaskConversation(taskId, params) {
|
|
383
|
+
const headers = {};
|
|
384
|
+
if (params?.locale) headers["X-Locale"] = params.locale;
|
|
385
|
+
const data = await this._request("GET", "/task/conversation", {
|
|
386
|
+
params: {
|
|
387
|
+
task_id: taskId,
|
|
388
|
+
include_summaries: params?.includeSummaries,
|
|
389
|
+
exclude_archived: params?.excludeArchived
|
|
390
|
+
},
|
|
391
|
+
headers
|
|
392
|
+
});
|
|
361
393
|
return {
|
|
362
394
|
taskId: data.taskId ?? data.task_id ?? taskId,
|
|
363
395
|
conversation: (data.conversation ?? []).map((m) => m)
|
|
@@ -365,19 +397,20 @@ var OrchestratorAsync = class {
|
|
|
365
397
|
}
|
|
366
398
|
async getArchivedMessageContent(taskId, messageId) {
|
|
367
399
|
return this._get(
|
|
368
|
-
|
|
400
|
+
"/task/message/archived-content",
|
|
401
|
+
{ task_id: taskId, message_id: messageId }
|
|
369
402
|
);
|
|
370
403
|
}
|
|
371
404
|
async getTaskCompactions(taskId) {
|
|
372
|
-
const data = await this._get(
|
|
373
|
-
|
|
374
|
-
);
|
|
405
|
+
const data = await this._get("/task/compactions", {
|
|
406
|
+
task_id: taskId
|
|
407
|
+
});
|
|
375
408
|
return data.compactions ?? [];
|
|
376
409
|
}
|
|
377
410
|
async getTaskJournal(taskId) {
|
|
378
|
-
const data = await this._get(
|
|
379
|
-
|
|
380
|
-
);
|
|
411
|
+
const data = await this._get("/task/journal", {
|
|
412
|
+
task_id: taskId
|
|
413
|
+
});
|
|
381
414
|
return {
|
|
382
415
|
taskId: data.taskId ?? data.task_id ?? taskId,
|
|
383
416
|
exists: data.exists ?? false,
|
|
@@ -388,15 +421,22 @@ var OrchestratorAsync = class {
|
|
|
388
421
|
};
|
|
389
422
|
}
|
|
390
423
|
async cancelTask(taskId) {
|
|
391
|
-
const data = await this._post(
|
|
392
|
-
|
|
393
|
-
);
|
|
394
|
-
return {
|
|
424
|
+
const data = await this._post("/task/cancel", {
|
|
425
|
+
task_id: taskId
|
|
426
|
+
});
|
|
427
|
+
return {
|
|
428
|
+
taskId: data.taskId ?? data.task_id ?? taskId,
|
|
429
|
+
killed: data.killed ?? false,
|
|
430
|
+
via: data.via ?? "none",
|
|
431
|
+
holderId: data.holderId ?? data.holder_id ?? void 0,
|
|
432
|
+
reason: data.reason ?? void 0,
|
|
433
|
+
message: data.message ?? ""
|
|
434
|
+
};
|
|
395
435
|
}
|
|
396
436
|
async deleteTask(taskId) {
|
|
397
|
-
const data = await this.
|
|
398
|
-
|
|
399
|
-
);
|
|
437
|
+
const data = await this._post("/task/delete", {
|
|
438
|
+
task_id: taskId
|
|
439
|
+
});
|
|
400
440
|
return {
|
|
401
441
|
deletedTasks: data.deletedTasks ?? data.deleted_tasks ?? [],
|
|
402
442
|
failedTasks: data.failedTasks ?? data.failed_tasks ?? [],
|
|
@@ -405,9 +445,10 @@ var OrchestratorAsync = class {
|
|
|
405
445
|
};
|
|
406
446
|
}
|
|
407
447
|
async deleteTasks(taskIds) {
|
|
408
|
-
const data = await this._post(
|
|
409
|
-
|
|
410
|
-
|
|
448
|
+
const data = await this._post(
|
|
449
|
+
"/task/delete/multiple",
|
|
450
|
+
{ task_ids: taskIds }
|
|
451
|
+
);
|
|
411
452
|
return {
|
|
412
453
|
deletedTasks: data.deletedTasks ?? data.deleted_tasks ?? [],
|
|
413
454
|
failedTasks: data.failedTasks ?? data.failed_tasks ?? [],
|
|
@@ -418,18 +459,15 @@ var OrchestratorAsync = class {
|
|
|
418
459
|
// ------------------------------------------------------------------
|
|
419
460
|
// Attachments
|
|
420
461
|
// ------------------------------------------------------------------
|
|
421
|
-
async uploadAttachment(
|
|
462
|
+
async uploadAttachment(file, filename) {
|
|
422
463
|
const formData = new FormData();
|
|
423
464
|
formData.append("file", file, filename);
|
|
424
465
|
const headers = await this._resolveHeaders();
|
|
425
|
-
const response = await this._fetch(
|
|
426
|
-
|
|
427
|
-
{
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
body: formData
|
|
431
|
-
}
|
|
432
|
-
);
|
|
466
|
+
const response = await this._fetch(this._makeUrl("/attachment"), {
|
|
467
|
+
method: "POST",
|
|
468
|
+
headers: { ...headers },
|
|
469
|
+
body: formData
|
|
470
|
+
});
|
|
433
471
|
if (!response.ok) {
|
|
434
472
|
throw new OrchestratorAPIError(
|
|
435
473
|
`Attachment upload failed: ${response.statusText}`,
|
|
@@ -447,13 +485,11 @@ var OrchestratorAsync = class {
|
|
|
447
485
|
tokenCount: data.tokenCount ?? data.token_count ?? null
|
|
448
486
|
};
|
|
449
487
|
}
|
|
450
|
-
async downloadAttachment(
|
|
488
|
+
async downloadAttachment(attachmentId) {
|
|
451
489
|
const headers = await this._resolveHeaders();
|
|
452
490
|
const response = await this._fetch(
|
|
453
|
-
this._makeUrl(`/
|
|
454
|
-
{
|
|
455
|
-
headers
|
|
456
|
-
}
|
|
491
|
+
this._makeUrl(`/attachment/${attachmentId}`),
|
|
492
|
+
{ headers }
|
|
457
493
|
);
|
|
458
494
|
if (!response.ok) {
|
|
459
495
|
throw new OrchestratorAPIError(
|
|
@@ -466,126 +502,135 @@ var OrchestratorAsync = class {
|
|
|
466
502
|
// ------------------------------------------------------------------
|
|
467
503
|
// Interactive workflow
|
|
468
504
|
// ------------------------------------------------------------------
|
|
469
|
-
async sendInteractiveMessage(taskId,
|
|
505
|
+
async sendInteractiveMessage(taskId, message, attachmentIds) {
|
|
470
506
|
const data = await this._post(
|
|
471
|
-
|
|
472
|
-
{
|
|
473
|
-
content
|
|
474
|
-
}
|
|
507
|
+
"/task/interactive/message",
|
|
508
|
+
{ task_id: taskId, message, attachment_ids: attachmentIds }
|
|
475
509
|
);
|
|
476
510
|
return { message: data.message ?? "" };
|
|
477
511
|
}
|
|
478
512
|
async markInteractiveComplete(taskId) {
|
|
479
513
|
const data = await this._post(
|
|
480
|
-
|
|
514
|
+
"/task/interactive/mark_complete",
|
|
515
|
+
{ task_id: taskId }
|
|
481
516
|
);
|
|
482
517
|
return { message: data.message ?? "" };
|
|
483
518
|
}
|
|
484
519
|
async markInteractiveFailed(taskId) {
|
|
485
520
|
const data = await this._post(
|
|
486
|
-
|
|
521
|
+
"/task/interactive/mark_failed",
|
|
522
|
+
{ task_id: taskId }
|
|
487
523
|
);
|
|
488
524
|
return { message: data.message ?? "" };
|
|
489
525
|
}
|
|
490
|
-
async approveInteractiveAction(taskId) {
|
|
526
|
+
async approveInteractiveAction(taskId, approved = true) {
|
|
491
527
|
const data = await this._post(
|
|
492
|
-
|
|
528
|
+
"/task/interactive/action",
|
|
529
|
+
{ task_id: taskId, approved }
|
|
530
|
+
);
|
|
531
|
+
return { message: data.message ?? "" };
|
|
532
|
+
}
|
|
533
|
+
async stopInteractive(taskId) {
|
|
534
|
+
const data = await this._post(
|
|
535
|
+
"/task/interactive/stop",
|
|
536
|
+
{ task_id: taskId }
|
|
493
537
|
);
|
|
494
538
|
return { message: data.message ?? "" };
|
|
495
539
|
}
|
|
496
540
|
// ------------------------------------------------------------------
|
|
497
541
|
// Proactive workflow
|
|
498
542
|
// ------------------------------------------------------------------
|
|
499
|
-
async sendProactiveGuide(taskId,
|
|
543
|
+
async sendProactiveGuide(taskId, message, attachmentIds) {
|
|
500
544
|
const data = await this._post(
|
|
501
|
-
|
|
502
|
-
{
|
|
503
|
-
guide
|
|
504
|
-
}
|
|
545
|
+
"/task/proactive/guide",
|
|
546
|
+
{ task_id: taskId, message, attachment_ids: attachmentIds }
|
|
505
547
|
);
|
|
506
548
|
return { message: data.message ?? "" };
|
|
507
549
|
}
|
|
508
550
|
async respondProactiveHelp(taskId, response) {
|
|
509
551
|
const data = await this._post(
|
|
510
|
-
|
|
511
|
-
{
|
|
512
|
-
response
|
|
513
|
-
}
|
|
552
|
+
"/task/proactive/help",
|
|
553
|
+
{ task_id: taskId, response }
|
|
514
554
|
);
|
|
515
555
|
return { message: data.message ?? "" };
|
|
516
556
|
}
|
|
517
|
-
async approveProactiveAction(taskId) {
|
|
557
|
+
async approveProactiveAction(taskId, approved = true) {
|
|
518
558
|
const data = await this._post(
|
|
519
|
-
|
|
559
|
+
"/task/proactive/action",
|
|
560
|
+
{ task_id: taskId, approved }
|
|
520
561
|
);
|
|
521
562
|
return { message: data.message ?? "" };
|
|
522
563
|
}
|
|
523
564
|
// ------------------------------------------------------------------
|
|
524
565
|
// Ticket workflow
|
|
525
566
|
// ------------------------------------------------------------------
|
|
526
|
-
async sendTicketGuide(taskId,
|
|
567
|
+
async sendTicketGuide(taskId, message, attachmentIds) {
|
|
527
568
|
const data = await this._post(
|
|
528
|
-
|
|
529
|
-
{
|
|
530
|
-
guide
|
|
531
|
-
}
|
|
569
|
+
"/task/ticket/guide",
|
|
570
|
+
{ task_id: taskId, message, attachment_ids: attachmentIds }
|
|
532
571
|
);
|
|
533
572
|
return { message: data.message ?? "" };
|
|
534
573
|
}
|
|
535
574
|
async respondTicketHelp(taskId, response) {
|
|
536
575
|
const data = await this._post(
|
|
537
|
-
|
|
538
|
-
{
|
|
539
|
-
response
|
|
540
|
-
}
|
|
576
|
+
"/task/ticket/help",
|
|
577
|
+
{ task_id: taskId, response }
|
|
541
578
|
);
|
|
542
579
|
return { message: data.message ?? "" };
|
|
543
580
|
}
|
|
544
|
-
async approveTicketAction(taskId) {
|
|
581
|
+
async approveTicketAction(taskId, approved = true) {
|
|
545
582
|
const data = await this._post(
|
|
546
|
-
|
|
583
|
+
"/task/ticket/action",
|
|
584
|
+
{ task_id: taskId, approved }
|
|
547
585
|
);
|
|
548
586
|
return { message: data.message ?? "" };
|
|
549
587
|
}
|
|
550
588
|
async wakeTicket(taskId) {
|
|
551
589
|
const data = await this._post(
|
|
552
|
-
|
|
590
|
+
"/task/ticket/wake",
|
|
591
|
+
{ task_id: taskId }
|
|
553
592
|
);
|
|
554
593
|
return { message: data.message ?? "" };
|
|
555
594
|
}
|
|
556
595
|
// ------------------------------------------------------------------
|
|
557
596
|
// Matrix workflow
|
|
558
597
|
// ------------------------------------------------------------------
|
|
559
|
-
async sendMatrixMessage(taskId,
|
|
598
|
+
async sendMatrixMessage(taskId, message, attachmentIds) {
|
|
560
599
|
const data = await this._post(
|
|
561
|
-
|
|
562
|
-
{
|
|
563
|
-
content
|
|
564
|
-
}
|
|
600
|
+
"/task/matrix/message",
|
|
601
|
+
{ task_id: taskId, message, attachment_ids: attachmentIds }
|
|
565
602
|
);
|
|
566
603
|
return { message: data.message ?? "" };
|
|
567
604
|
}
|
|
568
605
|
async markMatrixComplete(taskId) {
|
|
569
606
|
const data = await this._post(
|
|
570
|
-
|
|
607
|
+
"/task/matrix/mark_complete",
|
|
608
|
+
{ task_id: taskId }
|
|
571
609
|
);
|
|
572
610
|
return { message: data.message ?? "" };
|
|
573
611
|
}
|
|
574
612
|
async markMatrixFailed(taskId) {
|
|
575
613
|
const data = await this._post(
|
|
576
|
-
|
|
614
|
+
"/task/matrix/mark_failed",
|
|
615
|
+
{ task_id: taskId }
|
|
577
616
|
);
|
|
578
617
|
return { message: data.message ?? "" };
|
|
579
618
|
}
|
|
580
|
-
async approveMatrixAction(taskId) {
|
|
619
|
+
async approveMatrixAction(taskId, approved = true) {
|
|
581
620
|
const data = await this._post(
|
|
582
|
-
|
|
621
|
+
"/task/matrix/action",
|
|
622
|
+
{ task_id: taskId, approved }
|
|
583
623
|
);
|
|
584
624
|
return { message: data.message ?? "" };
|
|
585
625
|
}
|
|
586
|
-
async getMatrixConversation(taskId) {
|
|
626
|
+
async getMatrixConversation(taskId, phase, includeSummaries) {
|
|
587
627
|
const data = await this._get(
|
|
588
|
-
|
|
628
|
+
"/task/matrix/conversation",
|
|
629
|
+
{
|
|
630
|
+
task_id: taskId,
|
|
631
|
+
phase,
|
|
632
|
+
include_summaries: includeSummaries
|
|
633
|
+
}
|
|
589
634
|
);
|
|
590
635
|
return {
|
|
591
636
|
taskId: data.taskId ?? data.task_id ?? taskId,
|
|
@@ -597,72 +642,84 @@ var OrchestratorAsync = class {
|
|
|
597
642
|
// ------------------------------------------------------------------
|
|
598
643
|
async createVSATask(params) {
|
|
599
644
|
const body = {
|
|
645
|
+
user_id: params.userId,
|
|
600
646
|
goal_prompt: params.goalPrompt,
|
|
601
647
|
title: params.title,
|
|
602
|
-
|
|
648
|
+
agent_model_id: params.agentModelId,
|
|
649
|
+
orchestrator_model_id: params.orchestratorModelId,
|
|
650
|
+
attachment_ids: params.attachmentIds,
|
|
651
|
+
options: params.options
|
|
603
652
|
};
|
|
604
653
|
if (params.delegatedToken !== void 0) {
|
|
605
654
|
body.delegated_token = params.delegatedToken;
|
|
606
655
|
}
|
|
607
|
-
const data = await this._post(
|
|
656
|
+
const data = await this._post(
|
|
657
|
+
"/task/vsa/create",
|
|
658
|
+
body
|
|
659
|
+
);
|
|
608
660
|
return {
|
|
609
661
|
taskId: data.taskId ?? data.task_id ?? "",
|
|
610
662
|
status: data.status ?? ""
|
|
611
663
|
};
|
|
612
664
|
}
|
|
613
|
-
async sendVSAMessage(taskId,
|
|
614
|
-
const body = {
|
|
665
|
+
async sendVSAMessage(taskId, message, options) {
|
|
666
|
+
const body = {
|
|
667
|
+
task_id: taskId,
|
|
668
|
+
message,
|
|
669
|
+
attachment_ids: options?.attachmentIds
|
|
670
|
+
};
|
|
615
671
|
if (options?.delegatedToken !== void 0) {
|
|
616
672
|
body.delegated_token = options.delegatedToken;
|
|
617
673
|
}
|
|
618
674
|
const data = await this._post(
|
|
619
|
-
|
|
675
|
+
"/task/vsa/message",
|
|
620
676
|
body
|
|
621
677
|
);
|
|
622
678
|
return { message: data.message ?? "" };
|
|
623
679
|
}
|
|
624
680
|
async renameVSATask(taskId, title) {
|
|
625
|
-
const data = await this._post(
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
}
|
|
630
|
-
);
|
|
681
|
+
const data = await this._post("/task/vsa/rename", {
|
|
682
|
+
task_id: taskId,
|
|
683
|
+
title
|
|
684
|
+
});
|
|
631
685
|
return { message: data.message ?? "" };
|
|
632
686
|
}
|
|
633
687
|
async regenerateVSATitle(taskId) {
|
|
634
688
|
const data = await this._post(
|
|
635
|
-
|
|
689
|
+
"/task/vsa/regenerate_title",
|
|
690
|
+
{ task_id: taskId }
|
|
636
691
|
);
|
|
637
692
|
return { message: data.message ?? "" };
|
|
638
693
|
}
|
|
639
694
|
async markVSAComplete(taskId) {
|
|
640
695
|
const data = await this._post(
|
|
641
|
-
|
|
696
|
+
"/task/vsa/mark_complete",
|
|
697
|
+
{ task_id: taskId }
|
|
642
698
|
);
|
|
643
699
|
return { message: data.message ?? "" };
|
|
644
700
|
}
|
|
645
701
|
async markVSAFailed(taskId) {
|
|
646
702
|
const data = await this._post(
|
|
647
|
-
|
|
703
|
+
"/task/vsa/mark_failed",
|
|
704
|
+
{ task_id: taskId }
|
|
648
705
|
);
|
|
649
706
|
return { message: data.message ?? "" };
|
|
650
707
|
}
|
|
651
708
|
async stopVSA(taskId) {
|
|
652
|
-
const data = await this._post(
|
|
653
|
-
|
|
654
|
-
);
|
|
709
|
+
const data = await this._post("/task/vsa/stop", {
|
|
710
|
+
task_id: taskId
|
|
711
|
+
});
|
|
655
712
|
return { message: data.message ?? "" };
|
|
656
713
|
}
|
|
657
714
|
async deleteVSA(taskId) {
|
|
658
|
-
const data = await this.
|
|
659
|
-
|
|
660
|
-
);
|
|
715
|
+
const data = await this._post("/task/vsa/delete", {
|
|
716
|
+
task_id: taskId
|
|
717
|
+
});
|
|
661
718
|
return { message: data.message ?? "" };
|
|
662
719
|
}
|
|
663
|
-
async listVSATasks(params) {
|
|
664
|
-
const data = await this._get("/
|
|
665
|
-
|
|
720
|
+
async listVSATasks(userId, params) {
|
|
721
|
+
const data = await this._get("/task/vsa/list", {
|
|
722
|
+
user_id: userId,
|
|
666
723
|
limit: params?.limit,
|
|
667
724
|
offset: params?.offset
|
|
668
725
|
});
|
|
@@ -671,9 +728,11 @@ var OrchestratorAsync = class {
|
|
|
671
728
|
);
|
|
672
729
|
return { tasks, pagination: buildPagination(data) };
|
|
673
730
|
}
|
|
674
|
-
async searchVSATasks(query) {
|
|
675
|
-
const data = await this._get("/
|
|
676
|
-
|
|
731
|
+
async searchVSATasks(userId, query, limit) {
|
|
732
|
+
const data = await this._get("/task/vsa/search", {
|
|
733
|
+
user_id: userId,
|
|
734
|
+
query,
|
|
735
|
+
limit
|
|
677
736
|
});
|
|
678
737
|
const tasks = (data.tasks ?? []).map(
|
|
679
738
|
buildTaskSummary
|
|
@@ -682,91 +741,123 @@ var OrchestratorAsync = class {
|
|
|
682
741
|
}
|
|
683
742
|
async deleteVSATasksBulk(taskIds) {
|
|
684
743
|
const data = await this._post(
|
|
685
|
-
"/
|
|
686
|
-
{
|
|
687
|
-
task_ids: taskIds
|
|
688
|
-
}
|
|
744
|
+
"/task/vsa/delete_bulk",
|
|
745
|
+
{ task_ids: taskIds }
|
|
689
746
|
);
|
|
690
|
-
return {
|
|
747
|
+
return {
|
|
748
|
+
deletedTasks: data.deletedTasks ?? data.deleted_tasks ?? [],
|
|
749
|
+
failedTasks: data.failedTasks ?? data.failed_tasks ?? [],
|
|
750
|
+
totalDeleted: data.totalDeleted ?? data.total_deleted ?? 0,
|
|
751
|
+
totalFailed: data.totalFailed ?? data.total_failed ?? 0
|
|
752
|
+
};
|
|
691
753
|
}
|
|
692
754
|
// ------------------------------------------------------------------
|
|
693
|
-
// MIO workflow
|
|
755
|
+
// MIO (self_managed) workflow
|
|
694
756
|
// ------------------------------------------------------------------
|
|
695
|
-
async sendMioMessage(taskId,
|
|
757
|
+
async sendMioMessage(taskId, message, attachmentIds) {
|
|
696
758
|
const data = await this._post(
|
|
697
|
-
|
|
698
|
-
{
|
|
699
|
-
content
|
|
700
|
-
}
|
|
759
|
+
"/task/self_managed/message",
|
|
760
|
+
{ task_id: taskId, message, attachment_ids: attachmentIds }
|
|
701
761
|
);
|
|
702
762
|
return { message: data.message ?? "" };
|
|
703
763
|
}
|
|
704
|
-
async approveMioAction(taskId) {
|
|
764
|
+
async approveMioAction(taskId, approved = true, feedback) {
|
|
705
765
|
const data = await this._post(
|
|
706
|
-
|
|
766
|
+
"/task/self_managed/action",
|
|
767
|
+
{ task_id: taskId, approved, feedback }
|
|
707
768
|
);
|
|
708
769
|
return { message: data.message ?? "" };
|
|
709
770
|
}
|
|
710
771
|
async wakeMio(taskId) {
|
|
711
772
|
const data = await this._post(
|
|
712
|
-
|
|
773
|
+
"/task/self_managed/wake",
|
|
774
|
+
{ task_id: taskId }
|
|
713
775
|
);
|
|
714
776
|
return { message: data.message ?? "" };
|
|
715
777
|
}
|
|
716
778
|
async sendMioUserAway(taskId) {
|
|
717
779
|
const data = await this._post(
|
|
718
|
-
|
|
780
|
+
"/task/self_managed/user_away",
|
|
781
|
+
{ task_id: taskId }
|
|
719
782
|
);
|
|
720
783
|
return { message: data.message ?? "" };
|
|
721
784
|
}
|
|
722
785
|
async markMioComplete(taskId) {
|
|
723
786
|
const data = await this._post(
|
|
724
|
-
|
|
787
|
+
"/task/self_managed/mark_complete",
|
|
788
|
+
{ task_id: taskId }
|
|
725
789
|
);
|
|
726
790
|
return { message: data.message ?? "" };
|
|
727
791
|
}
|
|
728
792
|
async markMioFailed(taskId) {
|
|
729
793
|
const data = await this._post(
|
|
730
|
-
|
|
794
|
+
"/task/self_managed/mark_failed",
|
|
795
|
+
{ task_id: taskId }
|
|
731
796
|
);
|
|
732
797
|
return { message: data.message ?? "" };
|
|
733
798
|
}
|
|
734
799
|
async archiveMio(taskId) {
|
|
735
800
|
const data = await this._post(
|
|
736
|
-
|
|
801
|
+
"/task/self_managed/archive",
|
|
802
|
+
{ task_id: taskId }
|
|
737
803
|
);
|
|
738
804
|
return { message: data.message ?? "" };
|
|
739
805
|
}
|
|
740
806
|
async getMioContext(taskId) {
|
|
741
807
|
const data = await this._get(
|
|
742
|
-
|
|
808
|
+
"/task/self_managed/context",
|
|
809
|
+
{ task_id: taskId }
|
|
743
810
|
);
|
|
744
811
|
return {
|
|
745
812
|
taskId: data.taskId ?? data.task_id ?? taskId,
|
|
813
|
+
modelId: data.modelId ?? data.model_id ?? "",
|
|
746
814
|
currentTokens: data.currentTokens ?? data.current_tokens ?? 0,
|
|
747
815
|
contextLimit: data.contextLimit ?? data.context_limit ?? 0,
|
|
748
816
|
usagePercentage: data.usagePercentage ?? data.usage_percentage ?? 0,
|
|
749
|
-
|
|
750
|
-
|
|
817
|
+
totalMessages: data.totalMessages ?? data.total_messages ?? 0,
|
|
818
|
+
activeMessages: data.activeMessages ?? data.active_messages ?? 0,
|
|
819
|
+
archivedMessages: data.archivedMessages ?? data.archived_messages ?? 0,
|
|
820
|
+
messagesWithoutTokenCount: data.messagesWithoutTokenCount ?? data.messages_without_token_count ?? 0
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
async getMioMemories(taskId, includeCommon) {
|
|
824
|
+
const data = await this._get(
|
|
825
|
+
"/task/self_managed/memories",
|
|
826
|
+
{ task_id: taskId, include_common: includeCommon }
|
|
827
|
+
);
|
|
828
|
+
return {
|
|
829
|
+
memories: data.memories ?? [],
|
|
830
|
+
total: data.total ?? 0
|
|
751
831
|
};
|
|
752
832
|
}
|
|
753
833
|
// ------------------------------------------------------------------
|
|
754
834
|
// Tools
|
|
755
835
|
// ------------------------------------------------------------------
|
|
756
836
|
async listTools() {
|
|
757
|
-
const data = await this._get("/tools");
|
|
837
|
+
const data = await this._get("/tools/all");
|
|
758
838
|
return {
|
|
759
|
-
tools: (data.tools ??
|
|
839
|
+
tools: (data.tools ?? []).map(
|
|
840
|
+
(t) => t
|
|
841
|
+
),
|
|
760
842
|
totalTools: data.totalTools ?? data.total_tools ?? 0,
|
|
761
843
|
servers: data.servers ?? []
|
|
762
844
|
};
|
|
763
845
|
}
|
|
846
|
+
async getToolCatalog() {
|
|
847
|
+
return this._get("/tools/catalog");
|
|
848
|
+
}
|
|
849
|
+
async refreshMCPTools() {
|
|
850
|
+
return this._post("/tools/mcp/refresh");
|
|
851
|
+
}
|
|
852
|
+
async validateToolCatalog() {
|
|
853
|
+
return this._get("/tools/validate");
|
|
854
|
+
}
|
|
764
855
|
// ------------------------------------------------------------------
|
|
765
856
|
// Debug / Admin
|
|
766
857
|
// ------------------------------------------------------------------
|
|
767
858
|
async getWorkflowStates() {
|
|
768
859
|
const data = await this._get(
|
|
769
|
-
"/debug/
|
|
860
|
+
"/debug/workflow_states"
|
|
770
861
|
);
|
|
771
862
|
return {
|
|
772
863
|
validStates: data.validStates ?? data.valid_states ?? {},
|
|
@@ -778,65 +869,65 @@ var OrchestratorAsync = class {
|
|
|
778
869
|
}
|
|
779
870
|
async updateTaskModels(taskId, models) {
|
|
780
871
|
const data = await this._post(
|
|
781
|
-
|
|
872
|
+
"/debug/task/models",
|
|
782
873
|
{
|
|
783
|
-
|
|
784
|
-
|
|
874
|
+
task_id: taskId,
|
|
875
|
+
agent_model_id: models.agentModelId,
|
|
876
|
+
orchestrator_model_id: models.orchestratorModelId
|
|
785
877
|
}
|
|
786
878
|
);
|
|
787
879
|
return { message: data.message ?? "" };
|
|
788
880
|
}
|
|
789
|
-
async updateTaskIteration(taskId, iteration) {
|
|
881
|
+
async updateTaskIteration(taskId, iteration, maxIterations) {
|
|
790
882
|
const data = await this._post(
|
|
791
|
-
|
|
792
|
-
{
|
|
793
|
-
iteration
|
|
794
|
-
}
|
|
883
|
+
"/debug/task/iteration",
|
|
884
|
+
{ task_id: taskId, iteration, max_iterations: maxIterations }
|
|
795
885
|
);
|
|
796
886
|
return { message: data.message ?? "" };
|
|
797
887
|
}
|
|
798
888
|
async updateTaskWorkflowData(taskId, workflowData) {
|
|
799
889
|
const data = await this._post(
|
|
800
|
-
|
|
801
|
-
{
|
|
802
|
-
workflow_data: workflowData
|
|
803
|
-
}
|
|
890
|
+
"/debug/task/workflow_data",
|
|
891
|
+
{ task_id: taskId, workflow_data: workflowData }
|
|
804
892
|
);
|
|
805
893
|
return { message: data.message ?? "" };
|
|
806
894
|
}
|
|
807
895
|
async deleteMessage(taskId, messageId) {
|
|
808
|
-
const data = await this.
|
|
809
|
-
|
|
896
|
+
const data = await this._post(
|
|
897
|
+
"/debug/task/message/delete",
|
|
898
|
+
{ task_id: taskId, message_id: messageId }
|
|
810
899
|
);
|
|
811
900
|
return { message: data.message ?? "" };
|
|
812
901
|
}
|
|
813
902
|
async deleteMessages(taskId, messageIds) {
|
|
814
903
|
const data = await this._post(
|
|
815
|
-
|
|
816
|
-
{ message_ids: messageIds }
|
|
904
|
+
"/debug/task/message/delete/multiple",
|
|
905
|
+
{ task_id: taskId, message_ids: messageIds }
|
|
817
906
|
);
|
|
818
|
-
return {
|
|
907
|
+
return {
|
|
908
|
+
deletedIds: data.deletedIds ?? data.deleted_ids ?? [],
|
|
909
|
+
failedIds: data.failedIds ?? data.failed_ids ?? [],
|
|
910
|
+
totalDeleted: data.totalDeleted ?? data.total_deleted ?? 0,
|
|
911
|
+
totalFailed: data.totalFailed ?? data.total_failed ?? 0
|
|
912
|
+
};
|
|
819
913
|
}
|
|
820
914
|
async updateMessage(taskId, messageId, update) {
|
|
821
|
-
const data = await this.
|
|
822
|
-
|
|
823
|
-
update
|
|
915
|
+
const data = await this._post(
|
|
916
|
+
"/debug/task/message/update",
|
|
917
|
+
{ task_id: taskId, message_id: messageId, ...update }
|
|
824
918
|
);
|
|
825
919
|
return { message: data.message ?? "" };
|
|
826
920
|
}
|
|
827
921
|
async resetMatrixToPhase(taskId, phase) {
|
|
828
922
|
const data = await this._post(
|
|
829
|
-
|
|
830
|
-
{ phase }
|
|
923
|
+
"/debug/task/matrix/reset_to_phase",
|
|
924
|
+
{ task_id: taskId, phase }
|
|
831
925
|
);
|
|
832
926
|
return { message: data.message ?? "" };
|
|
833
927
|
}
|
|
834
|
-
async getMessageTranslations(taskId, messageId
|
|
835
|
-
const params = {};
|
|
836
|
-
if (locale) params.locale = locale;
|
|
928
|
+
async getMessageTranslations(taskId, messageId) {
|
|
837
929
|
const data = await this._get(
|
|
838
|
-
`/
|
|
839
|
-
params
|
|
930
|
+
`/debug/task/${taskId}/message/${messageId}/translations`
|
|
840
931
|
);
|
|
841
932
|
return {
|
|
842
933
|
messageId: data.messageId ?? data.message_id ?? messageId,
|
|
@@ -847,19 +938,46 @@ var OrchestratorAsync = class {
|
|
|
847
938
|
// Error events
|
|
848
939
|
// ------------------------------------------------------------------
|
|
849
940
|
async listErrors(params) {
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
if (params?.
|
|
853
|
-
|
|
854
|
-
if (params?.limit
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
);
|
|
860
|
-
|
|
861
|
-
(
|
|
862
|
-
);
|
|
941
|
+
const authHeaders = await this._resolveHeaders();
|
|
942
|
+
const url = new URL(this._makeUrl("/errors"));
|
|
943
|
+
if (params?.page !== void 0)
|
|
944
|
+
url.searchParams.set("page", String(params.page));
|
|
945
|
+
if (params?.limit !== void 0)
|
|
946
|
+
url.searchParams.set("limit", String(params.limit));
|
|
947
|
+
if (params?.taskId) url.searchParams.set("task_id", params.taskId);
|
|
948
|
+
if (params?.workflowId)
|
|
949
|
+
url.searchParams.set("workflow_id", params.workflowId);
|
|
950
|
+
if (params?.errorCode) url.searchParams.set("error_code", params.errorCode);
|
|
951
|
+
if (params?.exceptionType)
|
|
952
|
+
url.searchParams.set("exception_type", params.exceptionType);
|
|
953
|
+
if (params?.holderId) url.searchParams.set("holder_id", params.holderId);
|
|
954
|
+
if (params?.requestId) url.searchParams.set("request_id", params.requestId);
|
|
955
|
+
if (params?.search) url.searchParams.set("search", params.search);
|
|
956
|
+
if (params?.since) url.searchParams.set("since", params.since);
|
|
957
|
+
if (params?.until) url.searchParams.set("until", params.until);
|
|
958
|
+
if (params?.orderDirection)
|
|
959
|
+
url.searchParams.set("order_direction", params.orderDirection);
|
|
960
|
+
for (const s of params?.severity ?? []) {
|
|
961
|
+
url.searchParams.append("severity", s);
|
|
962
|
+
}
|
|
963
|
+
for (const s of params?.source ?? []) {
|
|
964
|
+
url.searchParams.append("source", s);
|
|
965
|
+
}
|
|
966
|
+
const response = await this._fetch(url.toString(), {
|
|
967
|
+
method: "GET",
|
|
968
|
+
headers: { ...authHeaders }
|
|
969
|
+
});
|
|
970
|
+
if (!response.ok) {
|
|
971
|
+
throw new OrchestratorAPIError(
|
|
972
|
+
`listErrors failed: ${response.statusText}`,
|
|
973
|
+
response.status
|
|
974
|
+
);
|
|
975
|
+
}
|
|
976
|
+
const data = await response.json();
|
|
977
|
+
return {
|
|
978
|
+
items: (data.items ?? data.errors ?? []).map((e) => e),
|
|
979
|
+
pagination: buildPagination(data)
|
|
980
|
+
};
|
|
863
981
|
}
|
|
864
982
|
async getErrorDetail(errorId) {
|
|
865
983
|
return this._get(`/errors/${errorId}`);
|
|
@@ -884,13 +1002,13 @@ var OrchestratorAsync = class {
|
|
|
884
1002
|
return this._get("/health");
|
|
885
1003
|
}
|
|
886
1004
|
async healthDetailed() {
|
|
887
|
-
return this._get("/health/
|
|
1005
|
+
return this._get("/health/detailed");
|
|
888
1006
|
}
|
|
889
1007
|
async ready() {
|
|
890
1008
|
return this._get("/ready");
|
|
891
1009
|
}
|
|
892
1010
|
async healthLeader() {
|
|
893
|
-
return this._get("/leader");
|
|
1011
|
+
return this._get("/health/leader");
|
|
894
1012
|
}
|
|
895
1013
|
async getMetrics(types) {
|
|
896
1014
|
const params = {};
|
|
@@ -901,107 +1019,122 @@ var OrchestratorAsync = class {
|
|
|
901
1019
|
// Configuration
|
|
902
1020
|
// ------------------------------------------------------------------
|
|
903
1021
|
async getSystemStatus() {
|
|
904
|
-
return this._get("/
|
|
1022
|
+
return this._get("/configuration/system/status");
|
|
905
1023
|
}
|
|
906
1024
|
async updateSettings(settings) {
|
|
907
|
-
return this._post("/
|
|
1025
|
+
return this._post("/configuration/system/settings", settings);
|
|
908
1026
|
}
|
|
909
1027
|
async getConfigurationStatus() {
|
|
910
|
-
return this._get("/
|
|
1028
|
+
return this._get("/configuration/status");
|
|
911
1029
|
}
|
|
912
1030
|
async setAgentModel(model) {
|
|
913
1031
|
const data = await this._post(
|
|
914
|
-
"/
|
|
915
|
-
{ model }
|
|
1032
|
+
"/configuration/agent",
|
|
1033
|
+
{ model_name: model }
|
|
916
1034
|
);
|
|
917
1035
|
return { message: data.message ?? "" };
|
|
918
1036
|
}
|
|
919
1037
|
async setOrchestratorModel(model) {
|
|
920
1038
|
const data = await this._post(
|
|
921
|
-
"/
|
|
922
|
-
{ model }
|
|
1039
|
+
"/configuration/orchestrator",
|
|
1040
|
+
{ model_name: model }
|
|
923
1041
|
);
|
|
924
1042
|
return { message: data.message ?? "" };
|
|
925
1043
|
}
|
|
926
1044
|
async getLLMBackendStatus() {
|
|
927
|
-
return this._get(
|
|
1045
|
+
return this._get(
|
|
1046
|
+
"/configuration/llmbackend/status"
|
|
1047
|
+
);
|
|
928
1048
|
}
|
|
929
1049
|
async addLLMBackend(host, apiKey) {
|
|
930
1050
|
const data = await this._post(
|
|
931
|
-
"/
|
|
932
|
-
{
|
|
933
|
-
host,
|
|
934
|
-
api_key: apiKey
|
|
935
|
-
}
|
|
1051
|
+
"/configuration/llmbackend/add",
|
|
1052
|
+
{ backends: [{ url: host, api_key: apiKey }] }
|
|
936
1053
|
);
|
|
937
1054
|
return { message: data.message ?? "" };
|
|
938
1055
|
}
|
|
939
1056
|
async removeLLMBackend(host) {
|
|
940
|
-
const data = await this.
|
|
941
|
-
|
|
1057
|
+
const data = await this._post(
|
|
1058
|
+
"/configuration/llmbackend/remove",
|
|
1059
|
+
{ host }
|
|
942
1060
|
);
|
|
943
1061
|
return { message: data.message ?? "" };
|
|
944
1062
|
}
|
|
945
1063
|
async getMCPServerStatus() {
|
|
946
|
-
return this._get(
|
|
1064
|
+
return this._get(
|
|
1065
|
+
"/configuration/mcpserver/status"
|
|
1066
|
+
);
|
|
947
1067
|
}
|
|
948
1068
|
async addMCPServer(host, apiKey) {
|
|
949
1069
|
const data = await this._post(
|
|
950
|
-
"/
|
|
951
|
-
{
|
|
952
|
-
host,
|
|
953
|
-
api_key: apiKey
|
|
954
|
-
}
|
|
1070
|
+
"/configuration/mcpserver/add",
|
|
1071
|
+
{ servers: [{ url: host, api_key: apiKey }] }
|
|
955
1072
|
);
|
|
956
1073
|
return { message: data.message ?? "" };
|
|
957
1074
|
}
|
|
958
1075
|
async removeMCPServer(host) {
|
|
959
|
-
const data = await this.
|
|
960
|
-
|
|
1076
|
+
const data = await this._post(
|
|
1077
|
+
"/configuration/mcpserver/remove",
|
|
1078
|
+
{ host }
|
|
961
1079
|
);
|
|
962
1080
|
return { message: data.message ?? "" };
|
|
963
1081
|
}
|
|
964
1082
|
async getTaskHandlerStatus() {
|
|
965
|
-
return this._get("/
|
|
1083
|
+
return this._get("/configuration/taskhandler/status");
|
|
966
1084
|
}
|
|
967
1085
|
async getTaskHandlerStatusLocal() {
|
|
968
|
-
return this._get(
|
|
1086
|
+
return this._get(
|
|
1087
|
+
"/configuration/taskhandler/status/local"
|
|
1088
|
+
);
|
|
969
1089
|
}
|
|
970
1090
|
async setConcurrentTasksPerReplica(maxTasks) {
|
|
971
|
-
const data = await this.
|
|
972
|
-
"
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
}
|
|
1091
|
+
const data = await this._request(
|
|
1092
|
+
"POST",
|
|
1093
|
+
"/configuration/taskhandler/concurrent-per-replica",
|
|
1094
|
+
{ params: { max_tasks: maxTasks } }
|
|
976
1095
|
);
|
|
977
1096
|
return { message: data.message ?? "" };
|
|
978
1097
|
}
|
|
979
1098
|
async getSummaryWorkerStatus() {
|
|
980
|
-
return this._get(
|
|
1099
|
+
return this._get(
|
|
1100
|
+
"/configuration/summary-worker/status"
|
|
1101
|
+
);
|
|
981
1102
|
}
|
|
982
1103
|
async setCompactorModel(modelName) {
|
|
983
1104
|
const data = await this._post(
|
|
984
|
-
"/
|
|
985
|
-
{
|
|
986
|
-
model_name: modelName
|
|
987
|
-
}
|
|
1105
|
+
"/configuration/summary-worker/model",
|
|
1106
|
+
{ model_name: modelName }
|
|
988
1107
|
);
|
|
989
1108
|
return { message: data.message ?? "" };
|
|
990
1109
|
}
|
|
991
1110
|
async setTranslateModel(modelName) {
|
|
992
1111
|
const data = await this._post(
|
|
993
|
-
"/
|
|
994
|
-
{
|
|
995
|
-
model_name: modelName
|
|
996
|
-
}
|
|
1112
|
+
"/configuration/summary-worker/translate-model",
|
|
1113
|
+
{ model_name: modelName }
|
|
997
1114
|
);
|
|
998
1115
|
return { message: data.message ?? "" };
|
|
999
1116
|
}
|
|
1000
1117
|
async getTokenWorkerStatus() {
|
|
1001
|
-
return this._get("/
|
|
1118
|
+
return this._get("/configuration/token-worker/status");
|
|
1002
1119
|
}
|
|
1003
1120
|
async getSlotsStatus() {
|
|
1004
|
-
return this._get("/
|
|
1121
|
+
return this._get("/configuration/slots/status");
|
|
1122
|
+
}
|
|
1123
|
+
async getSubagentsStatus() {
|
|
1124
|
+
return this._get("/configuration/subagents/status");
|
|
1125
|
+
}
|
|
1126
|
+
async setSubagentsEnabled(enabled) {
|
|
1127
|
+
const data = await this._post(
|
|
1128
|
+
"/configuration/subagents",
|
|
1129
|
+
{ enabled }
|
|
1130
|
+
);
|
|
1131
|
+
return { message: data.message ?? "" };
|
|
1132
|
+
}
|
|
1133
|
+
async reloadServices() {
|
|
1134
|
+
return this._post("/configuration/reload");
|
|
1135
|
+
}
|
|
1136
|
+
async getReloadStatus() {
|
|
1137
|
+
return this._get("/configuration/reload/status");
|
|
1005
1138
|
}
|
|
1006
1139
|
// ------------------------------------------------------------------
|
|
1007
1140
|
// Auth / WebSocket status
|
|
@@ -1019,10 +1152,10 @@ var OrchestratorAsync = class {
|
|
|
1019
1152
|
const headers = await this._resolveHeaders();
|
|
1020
1153
|
headers.Accept = "text/event-stream";
|
|
1021
1154
|
const response = await this._fetch(
|
|
1022
|
-
this._makeUrl(
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
}
|
|
1155
|
+
this._makeUrl(
|
|
1156
|
+
`/task/stream_status?task_id=${encodeURIComponent(taskId)}`
|
|
1157
|
+
),
|
|
1158
|
+
{ headers }
|
|
1026
1159
|
);
|
|
1027
1160
|
if (!response.ok) {
|
|
1028
1161
|
throw new OrchestratorAPIError(
|
|
@@ -1089,11 +1222,14 @@ var Orchestrator = class {
|
|
|
1089
1222
|
createTask(params) {
|
|
1090
1223
|
return runSync(this._async.createTask(params));
|
|
1091
1224
|
}
|
|
1092
|
-
getTaskStatus(taskId) {
|
|
1093
|
-
return runSync(this._async.getTaskStatus(taskId));
|
|
1225
|
+
getTaskStatus(taskId, locale) {
|
|
1226
|
+
return runSync(this._async.getTaskStatus(taskId, locale));
|
|
1227
|
+
}
|
|
1228
|
+
setTaskStatus(taskId, status) {
|
|
1229
|
+
return runSync(this._async.setTaskStatus(taskId, status));
|
|
1094
1230
|
}
|
|
1095
|
-
getTaskConversation(taskId) {
|
|
1096
|
-
return runSync(this._async.getTaskConversation(taskId));
|
|
1231
|
+
getTaskConversation(taskId, params) {
|
|
1232
|
+
return runSync(this._async.getTaskConversation(taskId, params));
|
|
1097
1233
|
}
|
|
1098
1234
|
getArchivedMessageContent(taskId, messageId) {
|
|
1099
1235
|
return runSync(this._async.getArchivedMessageContent(taskId, messageId));
|
|
@@ -1116,17 +1252,19 @@ var Orchestrator = class {
|
|
|
1116
1252
|
// ------------------------------------------------------------------
|
|
1117
1253
|
// Attachments
|
|
1118
1254
|
// ------------------------------------------------------------------
|
|
1119
|
-
uploadAttachment(
|
|
1120
|
-
return runSync(this._async.uploadAttachment(
|
|
1255
|
+
uploadAttachment(file, filename) {
|
|
1256
|
+
return runSync(this._async.uploadAttachment(file, filename));
|
|
1121
1257
|
}
|
|
1122
|
-
downloadAttachment(
|
|
1123
|
-
return runSync(this._async.downloadAttachment(
|
|
1258
|
+
downloadAttachment(attachmentId) {
|
|
1259
|
+
return runSync(this._async.downloadAttachment(attachmentId));
|
|
1124
1260
|
}
|
|
1125
1261
|
// ------------------------------------------------------------------
|
|
1126
1262
|
// Interactive workflow
|
|
1127
1263
|
// ------------------------------------------------------------------
|
|
1128
|
-
sendInteractiveMessage(taskId,
|
|
1129
|
-
return runSync(
|
|
1264
|
+
sendInteractiveMessage(taskId, message, attachmentIds) {
|
|
1265
|
+
return runSync(
|
|
1266
|
+
this._async.sendInteractiveMessage(taskId, message, attachmentIds)
|
|
1267
|
+
);
|
|
1130
1268
|
}
|
|
1131
1269
|
markInteractiveComplete(taskId) {
|
|
1132
1270
|
return runSync(this._async.markInteractiveComplete(taskId));
|
|
@@ -1134,32 +1272,37 @@ var Orchestrator = class {
|
|
|
1134
1272
|
markInteractiveFailed(taskId) {
|
|
1135
1273
|
return runSync(this._async.markInteractiveFailed(taskId));
|
|
1136
1274
|
}
|
|
1137
|
-
approveInteractiveAction(taskId) {
|
|
1138
|
-
return runSync(this._async.approveInteractiveAction(taskId));
|
|
1275
|
+
approveInteractiveAction(taskId, approved = true) {
|
|
1276
|
+
return runSync(this._async.approveInteractiveAction(taskId, approved));
|
|
1277
|
+
}
|
|
1278
|
+
stopInteractive(taskId) {
|
|
1279
|
+
return runSync(this._async.stopInteractive(taskId));
|
|
1139
1280
|
}
|
|
1140
1281
|
// ------------------------------------------------------------------
|
|
1141
1282
|
// Proactive workflow
|
|
1142
1283
|
// ------------------------------------------------------------------
|
|
1143
|
-
sendProactiveGuide(taskId,
|
|
1144
|
-
return runSync(
|
|
1284
|
+
sendProactiveGuide(taskId, message, attachmentIds) {
|
|
1285
|
+
return runSync(
|
|
1286
|
+
this._async.sendProactiveGuide(taskId, message, attachmentIds)
|
|
1287
|
+
);
|
|
1145
1288
|
}
|
|
1146
1289
|
respondProactiveHelp(taskId, response) {
|
|
1147
1290
|
return runSync(this._async.respondProactiveHelp(taskId, response));
|
|
1148
1291
|
}
|
|
1149
|
-
approveProactiveAction(taskId) {
|
|
1150
|
-
return runSync(this._async.approveProactiveAction(taskId));
|
|
1292
|
+
approveProactiveAction(taskId, approved = true) {
|
|
1293
|
+
return runSync(this._async.approveProactiveAction(taskId, approved));
|
|
1151
1294
|
}
|
|
1152
1295
|
// ------------------------------------------------------------------
|
|
1153
1296
|
// Ticket workflow
|
|
1154
1297
|
// ------------------------------------------------------------------
|
|
1155
|
-
sendTicketGuide(taskId,
|
|
1156
|
-
return runSync(this._async.sendTicketGuide(taskId,
|
|
1298
|
+
sendTicketGuide(taskId, message, attachmentIds) {
|
|
1299
|
+
return runSync(this._async.sendTicketGuide(taskId, message, attachmentIds));
|
|
1157
1300
|
}
|
|
1158
1301
|
respondTicketHelp(taskId, response) {
|
|
1159
1302
|
return runSync(this._async.respondTicketHelp(taskId, response));
|
|
1160
1303
|
}
|
|
1161
|
-
approveTicketAction(taskId) {
|
|
1162
|
-
return runSync(this._async.approveTicketAction(taskId));
|
|
1304
|
+
approveTicketAction(taskId, approved = true) {
|
|
1305
|
+
return runSync(this._async.approveTicketAction(taskId, approved));
|
|
1163
1306
|
}
|
|
1164
1307
|
wakeTicket(taskId) {
|
|
1165
1308
|
return runSync(this._async.wakeTicket(taskId));
|
|
@@ -1167,8 +1310,10 @@ var Orchestrator = class {
|
|
|
1167
1310
|
// ------------------------------------------------------------------
|
|
1168
1311
|
// Matrix workflow
|
|
1169
1312
|
// ------------------------------------------------------------------
|
|
1170
|
-
sendMatrixMessage(taskId,
|
|
1171
|
-
return runSync(
|
|
1313
|
+
sendMatrixMessage(taskId, message, attachmentIds) {
|
|
1314
|
+
return runSync(
|
|
1315
|
+
this._async.sendMatrixMessage(taskId, message, attachmentIds)
|
|
1316
|
+
);
|
|
1172
1317
|
}
|
|
1173
1318
|
markMatrixComplete(taskId) {
|
|
1174
1319
|
return runSync(this._async.markMatrixComplete(taskId));
|
|
@@ -1176,11 +1321,13 @@ var Orchestrator = class {
|
|
|
1176
1321
|
markMatrixFailed(taskId) {
|
|
1177
1322
|
return runSync(this._async.markMatrixFailed(taskId));
|
|
1178
1323
|
}
|
|
1179
|
-
approveMatrixAction(taskId) {
|
|
1180
|
-
return runSync(this._async.approveMatrixAction(taskId));
|
|
1324
|
+
approveMatrixAction(taskId, approved = true) {
|
|
1325
|
+
return runSync(this._async.approveMatrixAction(taskId, approved));
|
|
1181
1326
|
}
|
|
1182
|
-
getMatrixConversation(taskId) {
|
|
1183
|
-
return runSync(
|
|
1327
|
+
getMatrixConversation(taskId, phase, includeSummaries) {
|
|
1328
|
+
return runSync(
|
|
1329
|
+
this._async.getMatrixConversation(taskId, phase, includeSummaries)
|
|
1330
|
+
);
|
|
1184
1331
|
}
|
|
1185
1332
|
// ------------------------------------------------------------------
|
|
1186
1333
|
// VSA workflow
|
|
@@ -1188,8 +1335,8 @@ var Orchestrator = class {
|
|
|
1188
1335
|
createVSATask(params) {
|
|
1189
1336
|
return runSync(this._async.createVSATask(params));
|
|
1190
1337
|
}
|
|
1191
|
-
sendVSAMessage(taskId,
|
|
1192
|
-
return runSync(this._async.sendVSAMessage(taskId,
|
|
1338
|
+
sendVSAMessage(taskId, message, options) {
|
|
1339
|
+
return runSync(this._async.sendVSAMessage(taskId, message, options));
|
|
1193
1340
|
}
|
|
1194
1341
|
renameVSATask(taskId, title) {
|
|
1195
1342
|
return runSync(this._async.renameVSATask(taskId, title));
|
|
@@ -1209,23 +1356,23 @@ var Orchestrator = class {
|
|
|
1209
1356
|
deleteVSA(taskId) {
|
|
1210
1357
|
return runSync(this._async.deleteVSA(taskId));
|
|
1211
1358
|
}
|
|
1212
|
-
listVSATasks(params) {
|
|
1213
|
-
return runSync(this._async.listVSATasks(params));
|
|
1359
|
+
listVSATasks(userId, params) {
|
|
1360
|
+
return runSync(this._async.listVSATasks(userId, params));
|
|
1214
1361
|
}
|
|
1215
|
-
searchVSATasks(query) {
|
|
1216
|
-
return runSync(this._async.searchVSATasks(query));
|
|
1362
|
+
searchVSATasks(userId, query, limit) {
|
|
1363
|
+
return runSync(this._async.searchVSATasks(userId, query, limit));
|
|
1217
1364
|
}
|
|
1218
1365
|
deleteVSATasksBulk(taskIds) {
|
|
1219
1366
|
return runSync(this._async.deleteVSATasksBulk(taskIds));
|
|
1220
1367
|
}
|
|
1221
1368
|
// ------------------------------------------------------------------
|
|
1222
|
-
// MIO workflow
|
|
1369
|
+
// MIO (self_managed) workflow
|
|
1223
1370
|
// ------------------------------------------------------------------
|
|
1224
|
-
sendMioMessage(taskId,
|
|
1225
|
-
return runSync(this._async.sendMioMessage(taskId,
|
|
1371
|
+
sendMioMessage(taskId, message, attachmentIds) {
|
|
1372
|
+
return runSync(this._async.sendMioMessage(taskId, message, attachmentIds));
|
|
1226
1373
|
}
|
|
1227
|
-
approveMioAction(taskId) {
|
|
1228
|
-
return runSync(this._async.approveMioAction(taskId));
|
|
1374
|
+
approveMioAction(taskId, approved = true, feedback) {
|
|
1375
|
+
return runSync(this._async.approveMioAction(taskId, approved, feedback));
|
|
1229
1376
|
}
|
|
1230
1377
|
wakeMio(taskId) {
|
|
1231
1378
|
return runSync(this._async.wakeMio(taskId));
|
|
@@ -1245,12 +1392,24 @@ var Orchestrator = class {
|
|
|
1245
1392
|
getMioContext(taskId) {
|
|
1246
1393
|
return runSync(this._async.getMioContext(taskId));
|
|
1247
1394
|
}
|
|
1395
|
+
getMioMemories(taskId, includeCommon) {
|
|
1396
|
+
return runSync(this._async.getMioMemories(taskId, includeCommon));
|
|
1397
|
+
}
|
|
1248
1398
|
// ------------------------------------------------------------------
|
|
1249
1399
|
// Tools
|
|
1250
1400
|
// ------------------------------------------------------------------
|
|
1251
1401
|
listTools() {
|
|
1252
1402
|
return runSync(this._async.listTools());
|
|
1253
1403
|
}
|
|
1404
|
+
getToolCatalog() {
|
|
1405
|
+
return runSync(this._async.getToolCatalog());
|
|
1406
|
+
}
|
|
1407
|
+
refreshMCPTools() {
|
|
1408
|
+
return runSync(this._async.refreshMCPTools());
|
|
1409
|
+
}
|
|
1410
|
+
validateToolCatalog() {
|
|
1411
|
+
return runSync(this._async.validateToolCatalog());
|
|
1412
|
+
}
|
|
1254
1413
|
// ------------------------------------------------------------------
|
|
1255
1414
|
// Debug / Admin
|
|
1256
1415
|
// ------------------------------------------------------------------
|
|
@@ -1260,8 +1419,10 @@ var Orchestrator = class {
|
|
|
1260
1419
|
updateTaskModels(taskId, models) {
|
|
1261
1420
|
return runSync(this._async.updateTaskModels(taskId, models));
|
|
1262
1421
|
}
|
|
1263
|
-
updateTaskIteration(taskId, iteration) {
|
|
1264
|
-
return runSync(
|
|
1422
|
+
updateTaskIteration(taskId, iteration, maxIterations) {
|
|
1423
|
+
return runSync(
|
|
1424
|
+
this._async.updateTaskIteration(taskId, iteration, maxIterations)
|
|
1425
|
+
);
|
|
1265
1426
|
}
|
|
1266
1427
|
updateTaskWorkflowData(taskId, workflowData) {
|
|
1267
1428
|
return runSync(this._async.updateTaskWorkflowData(taskId, workflowData));
|
|
@@ -1278,10 +1439,8 @@ var Orchestrator = class {
|
|
|
1278
1439
|
resetMatrixToPhase(taskId, phase) {
|
|
1279
1440
|
return runSync(this._async.resetMatrixToPhase(taskId, phase));
|
|
1280
1441
|
}
|
|
1281
|
-
getMessageTranslations(taskId, messageId
|
|
1282
|
-
return runSync(
|
|
1283
|
-
this._async.getMessageTranslations(taskId, messageId, locale)
|
|
1284
|
-
);
|
|
1442
|
+
getMessageTranslations(taskId, messageId) {
|
|
1443
|
+
return runSync(this._async.getMessageTranslations(taskId, messageId));
|
|
1285
1444
|
}
|
|
1286
1445
|
// ------------------------------------------------------------------
|
|
1287
1446
|
// Error events
|
|
@@ -1379,6 +1538,18 @@ var Orchestrator = class {
|
|
|
1379
1538
|
getSlotsStatus() {
|
|
1380
1539
|
return runSync(this._async.getSlotsStatus());
|
|
1381
1540
|
}
|
|
1541
|
+
getSubagentsStatus() {
|
|
1542
|
+
return runSync(this._async.getSubagentsStatus());
|
|
1543
|
+
}
|
|
1544
|
+
setSubagentsEnabled(enabled) {
|
|
1545
|
+
return runSync(this._async.setSubagentsEnabled(enabled));
|
|
1546
|
+
}
|
|
1547
|
+
reloadServices() {
|
|
1548
|
+
return runSync(this._async.reloadServices());
|
|
1549
|
+
}
|
|
1550
|
+
getReloadStatus() {
|
|
1551
|
+
return runSync(this._async.getReloadStatus());
|
|
1552
|
+
}
|
|
1382
1553
|
// ------------------------------------------------------------------
|
|
1383
1554
|
// Auth / WebSocket status
|
|
1384
1555
|
// ------------------------------------------------------------------
|
|
@@ -1550,6 +1721,7 @@ var RealtimeClient = class {
|
|
|
1550
1721
|
this._socket.on("disconnect", () => {
|
|
1551
1722
|
this._connected = false;
|
|
1552
1723
|
});
|
|
1724
|
+
this._socket.on("message", (payload) => this._dispatch(payload));
|
|
1553
1725
|
return new Promise((resolve, reject) => {
|
|
1554
1726
|
if (!this._socket) {
|
|
1555
1727
|
reject(new Error("RealtimeClient not connected"));
|
|
@@ -1569,53 +1741,126 @@ var RealtimeClient = class {
|
|
|
1569
1741
|
}
|
|
1570
1742
|
this._connected = false;
|
|
1571
1743
|
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Dispatch a message envelope to registered handlers.
|
|
1746
|
+
* The server sends: socket.emit("message", {type: "message", event: {..., event_type: "...", ...}})
|
|
1747
|
+
*/
|
|
1748
|
+
_dispatch(payload) {
|
|
1749
|
+
const envelope = payload;
|
|
1750
|
+
const event = envelope.event ?? envelope;
|
|
1751
|
+
const eventType = event.event_type;
|
|
1752
|
+
if (!eventType) return;
|
|
1753
|
+
const handlers = this._handlers.get(eventType);
|
|
1754
|
+
if (handlers) {
|
|
1755
|
+
for (const h of handlers) {
|
|
1756
|
+
h(event);
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1572
1760
|
/**
|
|
1573
1761
|
* Subscribe to realtime events for a specific task.
|
|
1762
|
+
* Emits a `join` event with `{rooms: ["task:{taskId}"]}`.
|
|
1574
1763
|
*/
|
|
1575
|
-
|
|
1764
|
+
subscribeTask(taskId) {
|
|
1576
1765
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1577
|
-
|
|
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
|
-
);
|
|
1586
|
-
});
|
|
1766
|
+
this._socket.emit("join", { rooms: [`task:${taskId}`] });
|
|
1587
1767
|
}
|
|
1588
1768
|
/**
|
|
1589
1769
|
* Unsubscribe from realtime events for a specific task.
|
|
1770
|
+
* Emits a `leave` event with `{rooms: ["task:{taskId}"]}`.
|
|
1590
1771
|
*/
|
|
1591
|
-
|
|
1772
|
+
unsubscribeTask(taskId) {
|
|
1592
1773
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
});
|
|
1774
|
+
this._socket.emit("leave", { rooms: [`task:${taskId}`] });
|
|
1775
|
+
}
|
|
1776
|
+
/**
|
|
1777
|
+
* Subscribe to event-type-scoped rooms.
|
|
1778
|
+
* e.g. subscribeEvents("task_created", "task_deleted")
|
|
1779
|
+
*/
|
|
1780
|
+
subscribeEvents(...eventTypes) {
|
|
1781
|
+
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1782
|
+
const rooms = eventTypes.map((t) => `event:${t}`);
|
|
1783
|
+
this._socket.emit("join", { rooms });
|
|
1784
|
+
}
|
|
1785
|
+
/**
|
|
1786
|
+
* Unsubscribe from event-type-scoped rooms.
|
|
1787
|
+
*/
|
|
1788
|
+
unsubscribeEvents(...eventTypes) {
|
|
1789
|
+
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1790
|
+
const rooms = eventTypes.map((t) => `event:${t}`);
|
|
1791
|
+
this._socket.emit("leave", { rooms });
|
|
1792
|
+
}
|
|
1793
|
+
/**
|
|
1794
|
+
* Subscribe to the `all` broadcast room (receives all events).
|
|
1795
|
+
*/
|
|
1796
|
+
subscribeAll() {
|
|
1797
|
+
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1798
|
+
this._socket.emit("join", { rooms: ["all"] });
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* Subscribe to a locale-specific room.
|
|
1802
|
+
*/
|
|
1803
|
+
subscribeLocale(locale) {
|
|
1804
|
+
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1805
|
+
this._socket.emit("join", { rooms: [`locale:${locale}`] });
|
|
1806
|
+
}
|
|
1807
|
+
/**
|
|
1808
|
+
* Unsubscribe from a locale-specific room.
|
|
1809
|
+
*/
|
|
1810
|
+
unsubscribeLocale(locale) {
|
|
1811
|
+
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1812
|
+
this._socket.emit("leave", { rooms: [`locale:${locale}`] });
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* Join arbitrary rooms by name.
|
|
1816
|
+
*/
|
|
1817
|
+
joinRooms(rooms) {
|
|
1818
|
+
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1819
|
+
this._socket.emit("join", { rooms });
|
|
1820
|
+
}
|
|
1821
|
+
/**
|
|
1822
|
+
* Leave arbitrary rooms by name.
|
|
1823
|
+
*/
|
|
1824
|
+
leaveRooms(rooms) {
|
|
1825
|
+
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1826
|
+
this._socket.emit("leave", { rooms });
|
|
1827
|
+
}
|
|
1828
|
+
/**
|
|
1829
|
+
* Send a ping to the server.
|
|
1830
|
+
*/
|
|
1831
|
+
ping() {
|
|
1832
|
+
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1833
|
+
this._socket.emit("ping");
|
|
1603
1834
|
}
|
|
1604
1835
|
/**
|
|
1605
1836
|
* Register a handler for a specific event type.
|
|
1837
|
+
*
|
|
1838
|
+
* Domain events (task_created, task_status_changed, etc.) are dispatched
|
|
1839
|
+
* via the message envelope. Raw socket events (connect, disconnect,
|
|
1840
|
+
* connection_established, rooms_updated, pong) are wired directly.
|
|
1606
1841
|
*/
|
|
1607
1842
|
on(event, handler) {
|
|
1608
1843
|
if (!this._handlers.has(event)) {
|
|
1609
1844
|
this._handlers.set(event, /* @__PURE__ */ new Set());
|
|
1610
1845
|
if (this._socket) {
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1846
|
+
const rawSocketEvents = /* @__PURE__ */ new Set([
|
|
1847
|
+
"connect",
|
|
1848
|
+
"disconnect",
|
|
1849
|
+
"connect_error",
|
|
1850
|
+
"connection_established",
|
|
1851
|
+
"rooms_updated",
|
|
1852
|
+
"pong"
|
|
1853
|
+
]);
|
|
1854
|
+
if (rawSocketEvents.has(event)) {
|
|
1855
|
+
this._socket.on(event, (...args) => {
|
|
1856
|
+
const handlers2 = this._handlers.get(event);
|
|
1857
|
+
if (handlers2) {
|
|
1858
|
+
for (const h of handlers2) {
|
|
1859
|
+
h(...args);
|
|
1860
|
+
}
|
|
1616
1861
|
}
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1619
1864
|
}
|
|
1620
1865
|
}
|
|
1621
1866
|
const handlers = this._handlers.get(event);
|