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.js CHANGED
@@ -259,13 +259,17 @@ var OrchestratorAsync = class {
259
259
  // Tasks
260
260
  // ------------------------------------------------------------------
261
261
  async listTasks(params) {
262
- const data = await this._get("/tasks", {
263
- workflow_id: params?.workflowId,
264
- status: params?.status,
265
- limit: params?.limit,
266
- offset: params?.offset,
267
- sort_by: params?.sortBy,
268
- sort_order: params?.sortOrder
262
+ const headers = {};
263
+ if (params?.locale) headers["X-Locale"] = params.locale;
264
+ const data = await this._request("GET", "/tasks", {
265
+ params: {
266
+ page: params?.page,
267
+ limit: params?.limit,
268
+ order_by: params?.orderBy,
269
+ order_direction: params?.orderDirection,
270
+ workflow_id: params?.workflowId
271
+ },
272
+ headers
269
273
  });
270
274
  const tasks = (data.tasks ?? []).map(
271
275
  buildTaskSummary
@@ -273,22 +277,36 @@ var OrchestratorAsync = class {
273
277
  return { tasks, pagination: buildPagination(data) };
274
278
  }
275
279
  async createTask(params) {
276
- const data = await this._post("/tasks", {
280
+ const data = await this._post("/task/create", {
277
281
  workflow_id: params.workflowId,
278
282
  goal_prompt: params.goalPrompt,
279
283
  max_iterations: params.maxIterations,
280
- options: params.options,
284
+ reasoning_effort: params.reasoningEffort,
285
+ system_prompt: params.systemPrompt,
286
+ developer_prompt: params.developerPrompt,
281
287
  ticket_id: params.ticketId,
282
- title: params.title,
283
- model_id: params.modelId
288
+ ticket_text: params.ticketText,
289
+ summary: params.summary,
290
+ problem_summary: params.problemSummary,
291
+ solution_strategy: params.solutionStrategy,
292
+ agent_model_id: params.agentModelId,
293
+ orchestrator_model_id: params.orchestratorModelId,
294
+ available_tools: params.availableTools,
295
+ attachment_ids: params.attachmentIds,
296
+ options: params.options
284
297
  });
285
298
  return {
286
299
  taskId: data.taskId ?? data.task_id ?? "",
287
300
  status: data.status ?? ""
288
301
  };
289
302
  }
290
- async getTaskStatus(taskId) {
291
- const data = await this._get(`/tasks/${taskId}`);
303
+ async getTaskStatus(taskId, locale) {
304
+ const headers = {};
305
+ if (locale) headers["X-Locale"] = locale;
306
+ const data = await this._request("GET", "/task/status", {
307
+ params: { task_id: taskId },
308
+ headers
309
+ });
292
310
  return {
293
311
  ...buildTaskSummary(data),
294
312
  subtaskIds: data.subtaskIds ?? data.subtask_ids ?? [],
@@ -296,10 +314,24 @@ var OrchestratorAsync = class {
296
314
  options: data.options ?? null
297
315
  };
298
316
  }
299
- async getTaskConversation(taskId) {
300
- const data = await this._get(
301
- `/tasks/${taskId}/conversation`
302
- );
317
+ async setTaskStatus(taskId, status) {
318
+ const data = await this._post("/task/set_status", {
319
+ task_id: taskId,
320
+ status
321
+ });
322
+ return { message: data.message ?? "" };
323
+ }
324
+ async getTaskConversation(taskId, params) {
325
+ const headers = {};
326
+ if (params?.locale) headers["X-Locale"] = params.locale;
327
+ const data = await this._request("GET", "/task/conversation", {
328
+ params: {
329
+ task_id: taskId,
330
+ include_summaries: params?.includeSummaries,
331
+ exclude_archived: params?.excludeArchived
332
+ },
333
+ headers
334
+ });
303
335
  return {
304
336
  taskId: data.taskId ?? data.task_id ?? taskId,
305
337
  conversation: (data.conversation ?? []).map((m) => m)
@@ -307,19 +339,20 @@ var OrchestratorAsync = class {
307
339
  }
308
340
  async getArchivedMessageContent(taskId, messageId) {
309
341
  return this._get(
310
- `/tasks/${taskId}/conversation/messages/${messageId}/archived`
342
+ "/task/message/archived-content",
343
+ { task_id: taskId, message_id: messageId }
311
344
  );
312
345
  }
313
346
  async getTaskCompactions(taskId) {
314
- const data = await this._get(
315
- `/tasks/${taskId}/compactions`
316
- );
347
+ const data = await this._get("/task/compactions", {
348
+ task_id: taskId
349
+ });
317
350
  return data.compactions ?? [];
318
351
  }
319
352
  async getTaskJournal(taskId) {
320
- const data = await this._get(
321
- `/tasks/${taskId}/journal`
322
- );
353
+ const data = await this._get("/task/journal", {
354
+ task_id: taskId
355
+ });
323
356
  return {
324
357
  taskId: data.taskId ?? data.task_id ?? taskId,
325
358
  exists: data.exists ?? false,
@@ -330,15 +363,22 @@ var OrchestratorAsync = class {
330
363
  };
331
364
  }
332
365
  async cancelTask(taskId) {
333
- const data = await this._post(
334
- `/tasks/${taskId}/cancel`
335
- );
336
- return { message: data.message ?? "" };
366
+ const data = await this._post("/task/cancel", {
367
+ task_id: taskId
368
+ });
369
+ return {
370
+ taskId: data.taskId ?? data.task_id ?? taskId,
371
+ killed: data.killed ?? false,
372
+ via: data.via ?? "none",
373
+ holderId: data.holderId ?? data.holder_id ?? void 0,
374
+ reason: data.reason ?? void 0,
375
+ message: data.message ?? ""
376
+ };
337
377
  }
338
378
  async deleteTask(taskId) {
339
- const data = await this._delete(
340
- `/tasks/${taskId}`
341
- );
379
+ const data = await this._post("/task/delete", {
380
+ task_id: taskId
381
+ });
342
382
  return {
343
383
  deletedTasks: data.deletedTasks ?? data.deleted_tasks ?? [],
344
384
  failedTasks: data.failedTasks ?? data.failed_tasks ?? [],
@@ -347,9 +387,10 @@ var OrchestratorAsync = class {
347
387
  };
348
388
  }
349
389
  async deleteTasks(taskIds) {
350
- const data = await this._post("/tasks/delete", {
351
- task_ids: taskIds
352
- });
390
+ const data = await this._post(
391
+ "/task/delete/multiple",
392
+ { task_ids: taskIds }
393
+ );
353
394
  return {
354
395
  deletedTasks: data.deletedTasks ?? data.deleted_tasks ?? [],
355
396
  failedTasks: data.failedTasks ?? data.failed_tasks ?? [],
@@ -360,18 +401,15 @@ var OrchestratorAsync = class {
360
401
  // ------------------------------------------------------------------
361
402
  // Attachments
362
403
  // ------------------------------------------------------------------
363
- async uploadAttachment(taskId, file, filename) {
404
+ async uploadAttachment(file, filename) {
364
405
  const formData = new FormData();
365
406
  formData.append("file", file, filename);
366
407
  const headers = await this._resolveHeaders();
367
- const response = await this._fetch(
368
- this._makeUrl(`/tasks/${taskId}/attachments`),
369
- {
370
- method: "POST",
371
- headers: { ...headers },
372
- body: formData
373
- }
374
- );
408
+ const response = await this._fetch(this._makeUrl("/attachment"), {
409
+ method: "POST",
410
+ headers: { ...headers },
411
+ body: formData
412
+ });
375
413
  if (!response.ok) {
376
414
  throw new OrchestratorAPIError(
377
415
  `Attachment upload failed: ${response.statusText}`,
@@ -389,13 +427,11 @@ var OrchestratorAsync = class {
389
427
  tokenCount: data.tokenCount ?? data.token_count ?? null
390
428
  };
391
429
  }
392
- async downloadAttachment(taskId, attachmentId) {
430
+ async downloadAttachment(attachmentId) {
393
431
  const headers = await this._resolveHeaders();
394
432
  const response = await this._fetch(
395
- this._makeUrl(`/tasks/${taskId}/attachments/${attachmentId}`),
396
- {
397
- headers
398
- }
433
+ this._makeUrl(`/attachment/${attachmentId}`),
434
+ { headers }
399
435
  );
400
436
  if (!response.ok) {
401
437
  throw new OrchestratorAPIError(
@@ -408,126 +444,135 @@ var OrchestratorAsync = class {
408
444
  // ------------------------------------------------------------------
409
445
  // Interactive workflow
410
446
  // ------------------------------------------------------------------
411
- async sendInteractiveMessage(taskId, content) {
447
+ async sendInteractiveMessage(taskId, message, attachmentIds) {
412
448
  const data = await this._post(
413
- `/tasks/${taskId}/interactive/message`,
414
- {
415
- content
416
- }
449
+ "/task/interactive/message",
450
+ { task_id: taskId, message, attachment_ids: attachmentIds }
417
451
  );
418
452
  return { message: data.message ?? "" };
419
453
  }
420
454
  async markInteractiveComplete(taskId) {
421
455
  const data = await this._post(
422
- `/tasks/${taskId}/interactive/complete`
456
+ "/task/interactive/mark_complete",
457
+ { task_id: taskId }
423
458
  );
424
459
  return { message: data.message ?? "" };
425
460
  }
426
461
  async markInteractiveFailed(taskId) {
427
462
  const data = await this._post(
428
- `/tasks/${taskId}/interactive/failed`
463
+ "/task/interactive/mark_failed",
464
+ { task_id: taskId }
429
465
  );
430
466
  return { message: data.message ?? "" };
431
467
  }
432
- async approveInteractiveAction(taskId) {
468
+ async approveInteractiveAction(taskId, approved = true) {
433
469
  const data = await this._post(
434
- `/tasks/${taskId}/interactive/approve`
470
+ "/task/interactive/action",
471
+ { task_id: taskId, approved }
472
+ );
473
+ return { message: data.message ?? "" };
474
+ }
475
+ async stopInteractive(taskId) {
476
+ const data = await this._post(
477
+ "/task/interactive/stop",
478
+ { task_id: taskId }
435
479
  );
436
480
  return { message: data.message ?? "" };
437
481
  }
438
482
  // ------------------------------------------------------------------
439
483
  // Proactive workflow
440
484
  // ------------------------------------------------------------------
441
- async sendProactiveGuide(taskId, guide) {
485
+ async sendProactiveGuide(taskId, message, attachmentIds) {
442
486
  const data = await this._post(
443
- `/tasks/${taskId}/proactive/guide`,
444
- {
445
- guide
446
- }
487
+ "/task/proactive/guide",
488
+ { task_id: taskId, message, attachment_ids: attachmentIds }
447
489
  );
448
490
  return { message: data.message ?? "" };
449
491
  }
450
492
  async respondProactiveHelp(taskId, response) {
451
493
  const data = await this._post(
452
- `/tasks/${taskId}/proactive/respond`,
453
- {
454
- response
455
- }
494
+ "/task/proactive/help",
495
+ { task_id: taskId, response }
456
496
  );
457
497
  return { message: data.message ?? "" };
458
498
  }
459
- async approveProactiveAction(taskId) {
499
+ async approveProactiveAction(taskId, approved = true) {
460
500
  const data = await this._post(
461
- `/tasks/${taskId}/proactive/approve`
501
+ "/task/proactive/action",
502
+ { task_id: taskId, approved }
462
503
  );
463
504
  return { message: data.message ?? "" };
464
505
  }
465
506
  // ------------------------------------------------------------------
466
507
  // Ticket workflow
467
508
  // ------------------------------------------------------------------
468
- async sendTicketGuide(taskId, guide) {
509
+ async sendTicketGuide(taskId, message, attachmentIds) {
469
510
  const data = await this._post(
470
- `/tasks/${taskId}/ticket/guide`,
471
- {
472
- guide
473
- }
511
+ "/task/ticket/guide",
512
+ { task_id: taskId, message, attachment_ids: attachmentIds }
474
513
  );
475
514
  return { message: data.message ?? "" };
476
515
  }
477
516
  async respondTicketHelp(taskId, response) {
478
517
  const data = await this._post(
479
- `/tasks/${taskId}/ticket/respond`,
480
- {
481
- response
482
- }
518
+ "/task/ticket/help",
519
+ { task_id: taskId, response }
483
520
  );
484
521
  return { message: data.message ?? "" };
485
522
  }
486
- async approveTicketAction(taskId) {
523
+ async approveTicketAction(taskId, approved = true) {
487
524
  const data = await this._post(
488
- `/tasks/${taskId}/ticket/approve`
525
+ "/task/ticket/action",
526
+ { task_id: taskId, approved }
489
527
  );
490
528
  return { message: data.message ?? "" };
491
529
  }
492
530
  async wakeTicket(taskId) {
493
531
  const data = await this._post(
494
- `/tasks/${taskId}/ticket/wake`
532
+ "/task/ticket/wake",
533
+ { task_id: taskId }
495
534
  );
496
535
  return { message: data.message ?? "" };
497
536
  }
498
537
  // ------------------------------------------------------------------
499
538
  // Matrix workflow
500
539
  // ------------------------------------------------------------------
501
- async sendMatrixMessage(taskId, content) {
540
+ async sendMatrixMessage(taskId, message, attachmentIds) {
502
541
  const data = await this._post(
503
- `/tasks/${taskId}/matrix/message`,
504
- {
505
- content
506
- }
542
+ "/task/matrix/message",
543
+ { task_id: taskId, message, attachment_ids: attachmentIds }
507
544
  );
508
545
  return { message: data.message ?? "" };
509
546
  }
510
547
  async markMatrixComplete(taskId) {
511
548
  const data = await this._post(
512
- `/tasks/${taskId}/matrix/complete`
549
+ "/task/matrix/mark_complete",
550
+ { task_id: taskId }
513
551
  );
514
552
  return { message: data.message ?? "" };
515
553
  }
516
554
  async markMatrixFailed(taskId) {
517
555
  const data = await this._post(
518
- `/tasks/${taskId}/matrix/failed`
556
+ "/task/matrix/mark_failed",
557
+ { task_id: taskId }
519
558
  );
520
559
  return { message: data.message ?? "" };
521
560
  }
522
- async approveMatrixAction(taskId) {
561
+ async approveMatrixAction(taskId, approved = true) {
523
562
  const data = await this._post(
524
- `/tasks/${taskId}/matrix/approve`
563
+ "/task/matrix/action",
564
+ { task_id: taskId, approved }
525
565
  );
526
566
  return { message: data.message ?? "" };
527
567
  }
528
- async getMatrixConversation(taskId) {
568
+ async getMatrixConversation(taskId, phase, includeSummaries) {
529
569
  const data = await this._get(
530
- `/tasks/${taskId}/matrix/conversation`
570
+ "/task/matrix/conversation",
571
+ {
572
+ task_id: taskId,
573
+ phase,
574
+ include_summaries: includeSummaries
575
+ }
531
576
  );
532
577
  return {
533
578
  taskId: data.taskId ?? data.task_id ?? taskId,
@@ -539,72 +584,84 @@ var OrchestratorAsync = class {
539
584
  // ------------------------------------------------------------------
540
585
  async createVSATask(params) {
541
586
  const body = {
587
+ user_id: params.userId,
542
588
  goal_prompt: params.goalPrompt,
543
589
  title: params.title,
544
- model_id: params.modelId
590
+ agent_model_id: params.agentModelId,
591
+ orchestrator_model_id: params.orchestratorModelId,
592
+ attachment_ids: params.attachmentIds,
593
+ options: params.options
545
594
  };
546
595
  if (params.delegatedToken !== void 0) {
547
596
  body.delegated_token = params.delegatedToken;
548
597
  }
549
- const data = await this._post("/tasks/vsa", body);
598
+ const data = await this._post(
599
+ "/task/vsa/create",
600
+ body
601
+ );
550
602
  return {
551
603
  taskId: data.taskId ?? data.task_id ?? "",
552
604
  status: data.status ?? ""
553
605
  };
554
606
  }
555
- async sendVSAMessage(taskId, content, options) {
556
- const body = { content };
607
+ async sendVSAMessage(taskId, message, options) {
608
+ const body = {
609
+ task_id: taskId,
610
+ message,
611
+ attachment_ids: options?.attachmentIds
612
+ };
557
613
  if (options?.delegatedToken !== void 0) {
558
614
  body.delegated_token = options.delegatedToken;
559
615
  }
560
616
  const data = await this._post(
561
- `/tasks/${taskId}/vsa/message`,
617
+ "/task/vsa/message",
562
618
  body
563
619
  );
564
620
  return { message: data.message ?? "" };
565
621
  }
566
622
  async renameVSATask(taskId, title) {
567
- const data = await this._post(
568
- `/tasks/${taskId}/vsa/rename`,
569
- {
570
- title
571
- }
572
- );
623
+ const data = await this._post("/task/vsa/rename", {
624
+ task_id: taskId,
625
+ title
626
+ });
573
627
  return { message: data.message ?? "" };
574
628
  }
575
629
  async regenerateVSATitle(taskId) {
576
630
  const data = await this._post(
577
- `/tasks/${taskId}/vsa/regenerate-title`
631
+ "/task/vsa/regenerate_title",
632
+ { task_id: taskId }
578
633
  );
579
634
  return { message: data.message ?? "" };
580
635
  }
581
636
  async markVSAComplete(taskId) {
582
637
  const data = await this._post(
583
- `/tasks/${taskId}/vsa/complete`
638
+ "/task/vsa/mark_complete",
639
+ { task_id: taskId }
584
640
  );
585
641
  return { message: data.message ?? "" };
586
642
  }
587
643
  async markVSAFailed(taskId) {
588
644
  const data = await this._post(
589
- `/tasks/${taskId}/vsa/failed`
645
+ "/task/vsa/mark_failed",
646
+ { task_id: taskId }
590
647
  );
591
648
  return { message: data.message ?? "" };
592
649
  }
593
650
  async stopVSA(taskId) {
594
- const data = await this._post(
595
- `/tasks/${taskId}/vsa/stop`
596
- );
651
+ const data = await this._post("/task/vsa/stop", {
652
+ task_id: taskId
653
+ });
597
654
  return { message: data.message ?? "" };
598
655
  }
599
656
  async deleteVSA(taskId) {
600
- const data = await this._delete(
601
- `/tasks/${taskId}/vsa`
602
- );
657
+ const data = await this._post("/task/vsa/delete", {
658
+ task_id: taskId
659
+ });
603
660
  return { message: data.message ?? "" };
604
661
  }
605
- async listVSATasks(params) {
606
- const data = await this._get("/tasks/vsa", {
607
- status: params?.status,
662
+ async listVSATasks(userId, params) {
663
+ const data = await this._get("/task/vsa/list", {
664
+ user_id: userId,
608
665
  limit: params?.limit,
609
666
  offset: params?.offset
610
667
  });
@@ -613,9 +670,11 @@ var OrchestratorAsync = class {
613
670
  );
614
671
  return { tasks, pagination: buildPagination(data) };
615
672
  }
616
- async searchVSATasks(query) {
617
- const data = await this._get("/tasks/vsa/search", {
618
- q: query
673
+ async searchVSATasks(userId, query, limit) {
674
+ const data = await this._get("/task/vsa/search", {
675
+ user_id: userId,
676
+ query,
677
+ limit
619
678
  });
620
679
  const tasks = (data.tasks ?? []).map(
621
680
  buildTaskSummary
@@ -624,91 +683,123 @@ var OrchestratorAsync = class {
624
683
  }
625
684
  async deleteVSATasksBulk(taskIds) {
626
685
  const data = await this._post(
627
- "/tasks/vsa/delete-bulk",
628
- {
629
- task_ids: taskIds
630
- }
686
+ "/task/vsa/delete_bulk",
687
+ { task_ids: taskIds }
631
688
  );
632
- return { message: data.message ?? "" };
689
+ return {
690
+ deletedTasks: data.deletedTasks ?? data.deleted_tasks ?? [],
691
+ failedTasks: data.failedTasks ?? data.failed_tasks ?? [],
692
+ totalDeleted: data.totalDeleted ?? data.total_deleted ?? 0,
693
+ totalFailed: data.totalFailed ?? data.total_failed ?? 0
694
+ };
633
695
  }
634
696
  // ------------------------------------------------------------------
635
- // MIO workflow
697
+ // MIO (self_managed) workflow
636
698
  // ------------------------------------------------------------------
637
- async sendMioMessage(taskId, content) {
699
+ async sendMioMessage(taskId, message, attachmentIds) {
638
700
  const data = await this._post(
639
- `/tasks/${taskId}/mio/message`,
640
- {
641
- content
642
- }
701
+ "/task/self_managed/message",
702
+ { task_id: taskId, message, attachment_ids: attachmentIds }
643
703
  );
644
704
  return { message: data.message ?? "" };
645
705
  }
646
- async approveMioAction(taskId) {
706
+ async approveMioAction(taskId, approved = true, feedback) {
647
707
  const data = await this._post(
648
- `/tasks/${taskId}/mio/approve`
708
+ "/task/self_managed/action",
709
+ { task_id: taskId, approved, feedback }
649
710
  );
650
711
  return { message: data.message ?? "" };
651
712
  }
652
713
  async wakeMio(taskId) {
653
714
  const data = await this._post(
654
- `/tasks/${taskId}/mio/wake`
715
+ "/task/self_managed/wake",
716
+ { task_id: taskId }
655
717
  );
656
718
  return { message: data.message ?? "" };
657
719
  }
658
720
  async sendMioUserAway(taskId) {
659
721
  const data = await this._post(
660
- `/tasks/${taskId}/mio/user-away`
722
+ "/task/self_managed/user_away",
723
+ { task_id: taskId }
661
724
  );
662
725
  return { message: data.message ?? "" };
663
726
  }
664
727
  async markMioComplete(taskId) {
665
728
  const data = await this._post(
666
- `/tasks/${taskId}/mio/complete`
729
+ "/task/self_managed/mark_complete",
730
+ { task_id: taskId }
667
731
  );
668
732
  return { message: data.message ?? "" };
669
733
  }
670
734
  async markMioFailed(taskId) {
671
735
  const data = await this._post(
672
- `/tasks/${taskId}/mio/failed`
736
+ "/task/self_managed/mark_failed",
737
+ { task_id: taskId }
673
738
  );
674
739
  return { message: data.message ?? "" };
675
740
  }
676
741
  async archiveMio(taskId) {
677
742
  const data = await this._post(
678
- `/tasks/${taskId}/mio/archive`
743
+ "/task/self_managed/archive",
744
+ { task_id: taskId }
679
745
  );
680
746
  return { message: data.message ?? "" };
681
747
  }
682
748
  async getMioContext(taskId) {
683
749
  const data = await this._get(
684
- `/tasks/${taskId}/mio/context`
750
+ "/task/self_managed/context",
751
+ { task_id: taskId }
685
752
  );
686
753
  return {
687
754
  taskId: data.taskId ?? data.task_id ?? taskId,
755
+ modelId: data.modelId ?? data.model_id ?? "",
688
756
  currentTokens: data.currentTokens ?? data.current_tokens ?? 0,
689
757
  contextLimit: data.contextLimit ?? data.context_limit ?? 0,
690
758
  usagePercentage: data.usagePercentage ?? data.usage_percentage ?? 0,
691
- archivedCount: data.archivedCount ?? data.archived_count ?? 0,
692
- activeCount: data.activeCount ?? data.active_count ?? 0
759
+ totalMessages: data.totalMessages ?? data.total_messages ?? 0,
760
+ activeMessages: data.activeMessages ?? data.active_messages ?? 0,
761
+ archivedMessages: data.archivedMessages ?? data.archived_messages ?? 0,
762
+ messagesWithoutTokenCount: data.messagesWithoutTokenCount ?? data.messages_without_token_count ?? 0
763
+ };
764
+ }
765
+ async getMioMemories(taskId, includeCommon) {
766
+ const data = await this._get(
767
+ "/task/self_managed/memories",
768
+ { task_id: taskId, include_common: includeCommon }
769
+ );
770
+ return {
771
+ memories: data.memories ?? [],
772
+ total: data.total ?? 0
693
773
  };
694
774
  }
695
775
  // ------------------------------------------------------------------
696
776
  // Tools
697
777
  // ------------------------------------------------------------------
698
778
  async listTools() {
699
- const data = await this._get("/tools");
779
+ const data = await this._get("/tools/all");
700
780
  return {
701
- tools: (data.tools ?? data.tools ?? []).map((t) => t),
781
+ tools: (data.tools ?? []).map(
782
+ (t) => t
783
+ ),
702
784
  totalTools: data.totalTools ?? data.total_tools ?? 0,
703
785
  servers: data.servers ?? []
704
786
  };
705
787
  }
788
+ async getToolCatalog() {
789
+ return this._get("/tools/catalog");
790
+ }
791
+ async refreshMCPTools() {
792
+ return this._post("/tools/mcp/refresh");
793
+ }
794
+ async validateToolCatalog() {
795
+ return this._get("/tools/validate");
796
+ }
706
797
  // ------------------------------------------------------------------
707
798
  // Debug / Admin
708
799
  // ------------------------------------------------------------------
709
800
  async getWorkflowStates() {
710
801
  const data = await this._get(
711
- "/debug/workflow-states"
802
+ "/debug/workflow_states"
712
803
  );
713
804
  return {
714
805
  validStates: data.validStates ?? data.valid_states ?? {},
@@ -720,65 +811,65 @@ var OrchestratorAsync = class {
720
811
  }
721
812
  async updateTaskModels(taskId, models) {
722
813
  const data = await this._post(
723
- `/tasks/${taskId}/models`,
814
+ "/debug/task/models",
724
815
  {
725
- agent: models.agent,
726
- orchestrator: models.orchestrator
816
+ task_id: taskId,
817
+ agent_model_id: models.agentModelId,
818
+ orchestrator_model_id: models.orchestratorModelId
727
819
  }
728
820
  );
729
821
  return { message: data.message ?? "" };
730
822
  }
731
- async updateTaskIteration(taskId, iteration) {
823
+ async updateTaskIteration(taskId, iteration, maxIterations) {
732
824
  const data = await this._post(
733
- `/tasks/${taskId}/iteration`,
734
- {
735
- iteration
736
- }
825
+ "/debug/task/iteration",
826
+ { task_id: taskId, iteration, max_iterations: maxIterations }
737
827
  );
738
828
  return { message: data.message ?? "" };
739
829
  }
740
830
  async updateTaskWorkflowData(taskId, workflowData) {
741
831
  const data = await this._post(
742
- `/tasks/${taskId}/workflow-data`,
743
- {
744
- workflow_data: workflowData
745
- }
832
+ "/debug/task/workflow_data",
833
+ { task_id: taskId, workflow_data: workflowData }
746
834
  );
747
835
  return { message: data.message ?? "" };
748
836
  }
749
837
  async deleteMessage(taskId, messageId) {
750
- const data = await this._delete(
751
- `/tasks/${taskId}/conversation/messages/${messageId}`
838
+ const data = await this._post(
839
+ "/debug/task/message/delete",
840
+ { task_id: taskId, message_id: messageId }
752
841
  );
753
842
  return { message: data.message ?? "" };
754
843
  }
755
844
  async deleteMessages(taskId, messageIds) {
756
845
  const data = await this._post(
757
- `/tasks/${taskId}/conversation/messages/delete`,
758
- { message_ids: messageIds }
846
+ "/debug/task/message/delete/multiple",
847
+ { task_id: taskId, message_ids: messageIds }
759
848
  );
760
- return { message: data.message ?? "" };
849
+ return {
850
+ deletedIds: data.deletedIds ?? data.deleted_ids ?? [],
851
+ failedIds: data.failedIds ?? data.failed_ids ?? [],
852
+ totalDeleted: data.totalDeleted ?? data.total_deleted ?? 0,
853
+ totalFailed: data.totalFailed ?? data.total_failed ?? 0
854
+ };
761
855
  }
762
856
  async updateMessage(taskId, messageId, update) {
763
- const data = await this._put(
764
- `/tasks/${taskId}/conversation/messages/${messageId}`,
765
- update
857
+ const data = await this._post(
858
+ "/debug/task/message/update",
859
+ { task_id: taskId, message_id: messageId, ...update }
766
860
  );
767
861
  return { message: data.message ?? "" };
768
862
  }
769
863
  async resetMatrixToPhase(taskId, phase) {
770
864
  const data = await this._post(
771
- `/tasks/${taskId}/matrix/reset`,
772
- { phase }
865
+ "/debug/task/matrix/reset_to_phase",
866
+ { task_id: taskId, phase }
773
867
  );
774
868
  return { message: data.message ?? "" };
775
869
  }
776
- async getMessageTranslations(taskId, messageId, locale) {
777
- const params = {};
778
- if (locale) params.locale = locale;
870
+ async getMessageTranslations(taskId, messageId) {
779
871
  const data = await this._get(
780
- `/tasks/${taskId}/conversation/messages/${messageId}/translations`,
781
- params
872
+ `/debug/task/${taskId}/message/${messageId}/translations`
782
873
  );
783
874
  return {
784
875
  messageId: data.messageId ?? data.message_id ?? messageId,
@@ -789,19 +880,46 @@ var OrchestratorAsync = class {
789
880
  // Error events
790
881
  // ------------------------------------------------------------------
791
882
  async listErrors(params) {
792
- const queryParams = {};
793
- if (params?.since) queryParams.since = params.since;
794
- if (params?.severity) queryParams.severity = params.severity;
795
- if (params?.source) queryParams.source = params.source;
796
- if (params?.limit) queryParams.limit = params.limit;
797
- if (params?.offset) queryParams.offset = params.offset;
798
- const data = await this._get(
799
- "/errors",
800
- queryParams
801
- );
802
- return (data.errors ?? []).map(
803
- (e) => e
804
- );
883
+ const authHeaders = await this._resolveHeaders();
884
+ const url = new URL(this._makeUrl("/errors"));
885
+ if (params?.page !== void 0)
886
+ url.searchParams.set("page", String(params.page));
887
+ if (params?.limit !== void 0)
888
+ url.searchParams.set("limit", String(params.limit));
889
+ if (params?.taskId) url.searchParams.set("task_id", params.taskId);
890
+ if (params?.workflowId)
891
+ url.searchParams.set("workflow_id", params.workflowId);
892
+ if (params?.errorCode) url.searchParams.set("error_code", params.errorCode);
893
+ if (params?.exceptionType)
894
+ url.searchParams.set("exception_type", params.exceptionType);
895
+ if (params?.holderId) url.searchParams.set("holder_id", params.holderId);
896
+ if (params?.requestId) url.searchParams.set("request_id", params.requestId);
897
+ if (params?.search) url.searchParams.set("search", params.search);
898
+ if (params?.since) url.searchParams.set("since", params.since);
899
+ if (params?.until) url.searchParams.set("until", params.until);
900
+ if (params?.orderDirection)
901
+ url.searchParams.set("order_direction", params.orderDirection);
902
+ for (const s of params?.severity ?? []) {
903
+ url.searchParams.append("severity", s);
904
+ }
905
+ for (const s of params?.source ?? []) {
906
+ url.searchParams.append("source", s);
907
+ }
908
+ const response = await this._fetch(url.toString(), {
909
+ method: "GET",
910
+ headers: { ...authHeaders }
911
+ });
912
+ if (!response.ok) {
913
+ throw new OrchestratorAPIError(
914
+ `listErrors failed: ${response.statusText}`,
915
+ response.status
916
+ );
917
+ }
918
+ const data = await response.json();
919
+ return {
920
+ items: (data.items ?? data.errors ?? []).map((e) => e),
921
+ pagination: buildPagination(data)
922
+ };
805
923
  }
806
924
  async getErrorDetail(errorId) {
807
925
  return this._get(`/errors/${errorId}`);
@@ -826,13 +944,13 @@ var OrchestratorAsync = class {
826
944
  return this._get("/health");
827
945
  }
828
946
  async healthDetailed() {
829
- return this._get("/health/detail");
947
+ return this._get("/health/detailed");
830
948
  }
831
949
  async ready() {
832
950
  return this._get("/ready");
833
951
  }
834
952
  async healthLeader() {
835
- return this._get("/leader");
953
+ return this._get("/health/leader");
836
954
  }
837
955
  async getMetrics(types) {
838
956
  const params = {};
@@ -843,107 +961,122 @@ var OrchestratorAsync = class {
843
961
  // Configuration
844
962
  // ------------------------------------------------------------------
845
963
  async getSystemStatus() {
846
- return this._get("/config/status");
964
+ return this._get("/configuration/system/status");
847
965
  }
848
966
  async updateSettings(settings) {
849
- return this._post("/config/settings", settings);
967
+ return this._post("/configuration/system/settings", settings);
850
968
  }
851
969
  async getConfigurationStatus() {
852
- return this._get("/config");
970
+ return this._get("/configuration/status");
853
971
  }
854
972
  async setAgentModel(model) {
855
973
  const data = await this._post(
856
- "/config/models/agent",
857
- { model }
974
+ "/configuration/agent",
975
+ { model_name: model }
858
976
  );
859
977
  return { message: data.message ?? "" };
860
978
  }
861
979
  async setOrchestratorModel(model) {
862
980
  const data = await this._post(
863
- "/config/models/orchestrator",
864
- { model }
981
+ "/configuration/orchestrator",
982
+ { model_name: model }
865
983
  );
866
984
  return { message: data.message ?? "" };
867
985
  }
868
986
  async getLLMBackendStatus() {
869
- return this._get("/config/llmbackends");
987
+ return this._get(
988
+ "/configuration/llmbackend/status"
989
+ );
870
990
  }
871
991
  async addLLMBackend(host, apiKey) {
872
992
  const data = await this._post(
873
- "/config/llmbackends",
874
- {
875
- host,
876
- api_key: apiKey
877
- }
993
+ "/configuration/llmbackend/add",
994
+ { backends: [{ url: host, api_key: apiKey }] }
878
995
  );
879
996
  return { message: data.message ?? "" };
880
997
  }
881
998
  async removeLLMBackend(host) {
882
- const data = await this._delete(
883
- `/config/llmbackends/${encodeURIComponent(host)}`
999
+ const data = await this._post(
1000
+ "/configuration/llmbackend/remove",
1001
+ { host }
884
1002
  );
885
1003
  return { message: data.message ?? "" };
886
1004
  }
887
1005
  async getMCPServerStatus() {
888
- return this._get("/config/mcpservers");
1006
+ return this._get(
1007
+ "/configuration/mcpserver/status"
1008
+ );
889
1009
  }
890
1010
  async addMCPServer(host, apiKey) {
891
1011
  const data = await this._post(
892
- "/config/mcpservers",
893
- {
894
- host,
895
- api_key: apiKey
896
- }
1012
+ "/configuration/mcpserver/add",
1013
+ { servers: [{ url: host, api_key: apiKey }] }
897
1014
  );
898
1015
  return { message: data.message ?? "" };
899
1016
  }
900
1017
  async removeMCPServer(host) {
901
- const data = await this._delete(
902
- `/config/mcpservers/${encodeURIComponent(host)}`
1018
+ const data = await this._post(
1019
+ "/configuration/mcpserver/remove",
1020
+ { host }
903
1021
  );
904
1022
  return { message: data.message ?? "" };
905
1023
  }
906
1024
  async getTaskHandlerStatus() {
907
- return this._get("/config/taskhandler");
1025
+ return this._get("/configuration/taskhandler/status");
908
1026
  }
909
1027
  async getTaskHandlerStatusLocal() {
910
- return this._get("/config/taskhandler/local");
1028
+ return this._get(
1029
+ "/configuration/taskhandler/status/local"
1030
+ );
911
1031
  }
912
1032
  async setConcurrentTasksPerReplica(maxTasks) {
913
- const data = await this._post(
914
- "/config/taskhandler/concurrency",
915
- {
916
- max_tasks: maxTasks
917
- }
1033
+ const data = await this._request(
1034
+ "POST",
1035
+ "/configuration/taskhandler/concurrent-per-replica",
1036
+ { params: { max_tasks: maxTasks } }
918
1037
  );
919
1038
  return { message: data.message ?? "" };
920
1039
  }
921
1040
  async getSummaryWorkerStatus() {
922
- return this._get("/config/summary-worker");
1041
+ return this._get(
1042
+ "/configuration/summary-worker/status"
1043
+ );
923
1044
  }
924
1045
  async setCompactorModel(modelName) {
925
1046
  const data = await this._post(
926
- "/config/models/compactor",
927
- {
928
- model_name: modelName
929
- }
1047
+ "/configuration/summary-worker/model",
1048
+ { model_name: modelName }
930
1049
  );
931
1050
  return { message: data.message ?? "" };
932
1051
  }
933
1052
  async setTranslateModel(modelName) {
934
1053
  const data = await this._post(
935
- "/config/models/translate",
936
- {
937
- model_name: modelName
938
- }
1054
+ "/configuration/summary-worker/translate-model",
1055
+ { model_name: modelName }
939
1056
  );
940
1057
  return { message: data.message ?? "" };
941
1058
  }
942
1059
  async getTokenWorkerStatus() {
943
- return this._get("/config/token-worker");
1060
+ return this._get("/configuration/token-worker/status");
944
1061
  }
945
1062
  async getSlotsStatus() {
946
- return this._get("/config/slots");
1063
+ return this._get("/configuration/slots/status");
1064
+ }
1065
+ async getSubagentsStatus() {
1066
+ return this._get("/configuration/subagents/status");
1067
+ }
1068
+ async setSubagentsEnabled(enabled) {
1069
+ const data = await this._post(
1070
+ "/configuration/subagents",
1071
+ { enabled }
1072
+ );
1073
+ return { message: data.message ?? "" };
1074
+ }
1075
+ async reloadServices() {
1076
+ return this._post("/configuration/reload");
1077
+ }
1078
+ async getReloadStatus() {
1079
+ return this._get("/configuration/reload/status");
947
1080
  }
948
1081
  // ------------------------------------------------------------------
949
1082
  // Auth / WebSocket status
@@ -961,10 +1094,10 @@ var OrchestratorAsync = class {
961
1094
  const headers = await this._resolveHeaders();
962
1095
  headers.Accept = "text/event-stream";
963
1096
  const response = await this._fetch(
964
- this._makeUrl(`/tasks/${taskId}/stream`),
965
- {
966
- headers
967
- }
1097
+ this._makeUrl(
1098
+ `/task/stream_status?task_id=${encodeURIComponent(taskId)}`
1099
+ ),
1100
+ { headers }
968
1101
  );
969
1102
  if (!response.ok) {
970
1103
  throw new OrchestratorAPIError(
@@ -1031,11 +1164,14 @@ var Orchestrator = class {
1031
1164
  createTask(params) {
1032
1165
  return runSync(this._async.createTask(params));
1033
1166
  }
1034
- getTaskStatus(taskId) {
1035
- return runSync(this._async.getTaskStatus(taskId));
1167
+ getTaskStatus(taskId, locale) {
1168
+ return runSync(this._async.getTaskStatus(taskId, locale));
1169
+ }
1170
+ setTaskStatus(taskId, status) {
1171
+ return runSync(this._async.setTaskStatus(taskId, status));
1036
1172
  }
1037
- getTaskConversation(taskId) {
1038
- return runSync(this._async.getTaskConversation(taskId));
1173
+ getTaskConversation(taskId, params) {
1174
+ return runSync(this._async.getTaskConversation(taskId, params));
1039
1175
  }
1040
1176
  getArchivedMessageContent(taskId, messageId) {
1041
1177
  return runSync(this._async.getArchivedMessageContent(taskId, messageId));
@@ -1058,17 +1194,19 @@ var Orchestrator = class {
1058
1194
  // ------------------------------------------------------------------
1059
1195
  // Attachments
1060
1196
  // ------------------------------------------------------------------
1061
- uploadAttachment(taskId, file, filename) {
1062
- return runSync(this._async.uploadAttachment(taskId, file, filename));
1197
+ uploadAttachment(file, filename) {
1198
+ return runSync(this._async.uploadAttachment(file, filename));
1063
1199
  }
1064
- downloadAttachment(taskId, attachmentId) {
1065
- return runSync(this._async.downloadAttachment(taskId, attachmentId));
1200
+ downloadAttachment(attachmentId) {
1201
+ return runSync(this._async.downloadAttachment(attachmentId));
1066
1202
  }
1067
1203
  // ------------------------------------------------------------------
1068
1204
  // Interactive workflow
1069
1205
  // ------------------------------------------------------------------
1070
- sendInteractiveMessage(taskId, content) {
1071
- return runSync(this._async.sendInteractiveMessage(taskId, content));
1206
+ sendInteractiveMessage(taskId, message, attachmentIds) {
1207
+ return runSync(
1208
+ this._async.sendInteractiveMessage(taskId, message, attachmentIds)
1209
+ );
1072
1210
  }
1073
1211
  markInteractiveComplete(taskId) {
1074
1212
  return runSync(this._async.markInteractiveComplete(taskId));
@@ -1076,32 +1214,37 @@ var Orchestrator = class {
1076
1214
  markInteractiveFailed(taskId) {
1077
1215
  return runSync(this._async.markInteractiveFailed(taskId));
1078
1216
  }
1079
- approveInteractiveAction(taskId) {
1080
- return runSync(this._async.approveInteractiveAction(taskId));
1217
+ approveInteractiveAction(taskId, approved = true) {
1218
+ return runSync(this._async.approveInteractiveAction(taskId, approved));
1219
+ }
1220
+ stopInteractive(taskId) {
1221
+ return runSync(this._async.stopInteractive(taskId));
1081
1222
  }
1082
1223
  // ------------------------------------------------------------------
1083
1224
  // Proactive workflow
1084
1225
  // ------------------------------------------------------------------
1085
- sendProactiveGuide(taskId, guide) {
1086
- return runSync(this._async.sendProactiveGuide(taskId, guide));
1226
+ sendProactiveGuide(taskId, message, attachmentIds) {
1227
+ return runSync(
1228
+ this._async.sendProactiveGuide(taskId, message, attachmentIds)
1229
+ );
1087
1230
  }
1088
1231
  respondProactiveHelp(taskId, response) {
1089
1232
  return runSync(this._async.respondProactiveHelp(taskId, response));
1090
1233
  }
1091
- approveProactiveAction(taskId) {
1092
- return runSync(this._async.approveProactiveAction(taskId));
1234
+ approveProactiveAction(taskId, approved = true) {
1235
+ return runSync(this._async.approveProactiveAction(taskId, approved));
1093
1236
  }
1094
1237
  // ------------------------------------------------------------------
1095
1238
  // Ticket workflow
1096
1239
  // ------------------------------------------------------------------
1097
- sendTicketGuide(taskId, guide) {
1098
- return runSync(this._async.sendTicketGuide(taskId, guide));
1240
+ sendTicketGuide(taskId, message, attachmentIds) {
1241
+ return runSync(this._async.sendTicketGuide(taskId, message, attachmentIds));
1099
1242
  }
1100
1243
  respondTicketHelp(taskId, response) {
1101
1244
  return runSync(this._async.respondTicketHelp(taskId, response));
1102
1245
  }
1103
- approveTicketAction(taskId) {
1104
- return runSync(this._async.approveTicketAction(taskId));
1246
+ approveTicketAction(taskId, approved = true) {
1247
+ return runSync(this._async.approveTicketAction(taskId, approved));
1105
1248
  }
1106
1249
  wakeTicket(taskId) {
1107
1250
  return runSync(this._async.wakeTicket(taskId));
@@ -1109,8 +1252,10 @@ var Orchestrator = class {
1109
1252
  // ------------------------------------------------------------------
1110
1253
  // Matrix workflow
1111
1254
  // ------------------------------------------------------------------
1112
- sendMatrixMessage(taskId, content) {
1113
- return runSync(this._async.sendMatrixMessage(taskId, content));
1255
+ sendMatrixMessage(taskId, message, attachmentIds) {
1256
+ return runSync(
1257
+ this._async.sendMatrixMessage(taskId, message, attachmentIds)
1258
+ );
1114
1259
  }
1115
1260
  markMatrixComplete(taskId) {
1116
1261
  return runSync(this._async.markMatrixComplete(taskId));
@@ -1118,11 +1263,13 @@ var Orchestrator = class {
1118
1263
  markMatrixFailed(taskId) {
1119
1264
  return runSync(this._async.markMatrixFailed(taskId));
1120
1265
  }
1121
- approveMatrixAction(taskId) {
1122
- return runSync(this._async.approveMatrixAction(taskId));
1266
+ approveMatrixAction(taskId, approved = true) {
1267
+ return runSync(this._async.approveMatrixAction(taskId, approved));
1123
1268
  }
1124
- getMatrixConversation(taskId) {
1125
- return runSync(this._async.getMatrixConversation(taskId));
1269
+ getMatrixConversation(taskId, phase, includeSummaries) {
1270
+ return runSync(
1271
+ this._async.getMatrixConversation(taskId, phase, includeSummaries)
1272
+ );
1126
1273
  }
1127
1274
  // ------------------------------------------------------------------
1128
1275
  // VSA workflow
@@ -1130,8 +1277,8 @@ var Orchestrator = class {
1130
1277
  createVSATask(params) {
1131
1278
  return runSync(this._async.createVSATask(params));
1132
1279
  }
1133
- sendVSAMessage(taskId, content, options) {
1134
- return runSync(this._async.sendVSAMessage(taskId, content, options));
1280
+ sendVSAMessage(taskId, message, options) {
1281
+ return runSync(this._async.sendVSAMessage(taskId, message, options));
1135
1282
  }
1136
1283
  renameVSATask(taskId, title) {
1137
1284
  return runSync(this._async.renameVSATask(taskId, title));
@@ -1151,23 +1298,23 @@ var Orchestrator = class {
1151
1298
  deleteVSA(taskId) {
1152
1299
  return runSync(this._async.deleteVSA(taskId));
1153
1300
  }
1154
- listVSATasks(params) {
1155
- return runSync(this._async.listVSATasks(params));
1301
+ listVSATasks(userId, params) {
1302
+ return runSync(this._async.listVSATasks(userId, params));
1156
1303
  }
1157
- searchVSATasks(query) {
1158
- return runSync(this._async.searchVSATasks(query));
1304
+ searchVSATasks(userId, query, limit) {
1305
+ return runSync(this._async.searchVSATasks(userId, query, limit));
1159
1306
  }
1160
1307
  deleteVSATasksBulk(taskIds) {
1161
1308
  return runSync(this._async.deleteVSATasksBulk(taskIds));
1162
1309
  }
1163
1310
  // ------------------------------------------------------------------
1164
- // MIO workflow
1311
+ // MIO (self_managed) workflow
1165
1312
  // ------------------------------------------------------------------
1166
- sendMioMessage(taskId, content) {
1167
- return runSync(this._async.sendMioMessage(taskId, content));
1313
+ sendMioMessage(taskId, message, attachmentIds) {
1314
+ return runSync(this._async.sendMioMessage(taskId, message, attachmentIds));
1168
1315
  }
1169
- approveMioAction(taskId) {
1170
- return runSync(this._async.approveMioAction(taskId));
1316
+ approveMioAction(taskId, approved = true, feedback) {
1317
+ return runSync(this._async.approveMioAction(taskId, approved, feedback));
1171
1318
  }
1172
1319
  wakeMio(taskId) {
1173
1320
  return runSync(this._async.wakeMio(taskId));
@@ -1187,12 +1334,24 @@ var Orchestrator = class {
1187
1334
  getMioContext(taskId) {
1188
1335
  return runSync(this._async.getMioContext(taskId));
1189
1336
  }
1337
+ getMioMemories(taskId, includeCommon) {
1338
+ return runSync(this._async.getMioMemories(taskId, includeCommon));
1339
+ }
1190
1340
  // ------------------------------------------------------------------
1191
1341
  // Tools
1192
1342
  // ------------------------------------------------------------------
1193
1343
  listTools() {
1194
1344
  return runSync(this._async.listTools());
1195
1345
  }
1346
+ getToolCatalog() {
1347
+ return runSync(this._async.getToolCatalog());
1348
+ }
1349
+ refreshMCPTools() {
1350
+ return runSync(this._async.refreshMCPTools());
1351
+ }
1352
+ validateToolCatalog() {
1353
+ return runSync(this._async.validateToolCatalog());
1354
+ }
1196
1355
  // ------------------------------------------------------------------
1197
1356
  // Debug / Admin
1198
1357
  // ------------------------------------------------------------------
@@ -1202,8 +1361,10 @@ var Orchestrator = class {
1202
1361
  updateTaskModels(taskId, models) {
1203
1362
  return runSync(this._async.updateTaskModels(taskId, models));
1204
1363
  }
1205
- updateTaskIteration(taskId, iteration) {
1206
- return runSync(this._async.updateTaskIteration(taskId, iteration));
1364
+ updateTaskIteration(taskId, iteration, maxIterations) {
1365
+ return runSync(
1366
+ this._async.updateTaskIteration(taskId, iteration, maxIterations)
1367
+ );
1207
1368
  }
1208
1369
  updateTaskWorkflowData(taskId, workflowData) {
1209
1370
  return runSync(this._async.updateTaskWorkflowData(taskId, workflowData));
@@ -1220,10 +1381,8 @@ var Orchestrator = class {
1220
1381
  resetMatrixToPhase(taskId, phase) {
1221
1382
  return runSync(this._async.resetMatrixToPhase(taskId, phase));
1222
1383
  }
1223
- getMessageTranslations(taskId, messageId, locale) {
1224
- return runSync(
1225
- this._async.getMessageTranslations(taskId, messageId, locale)
1226
- );
1384
+ getMessageTranslations(taskId, messageId) {
1385
+ return runSync(this._async.getMessageTranslations(taskId, messageId));
1227
1386
  }
1228
1387
  // ------------------------------------------------------------------
1229
1388
  // Error events
@@ -1321,6 +1480,18 @@ var Orchestrator = class {
1321
1480
  getSlotsStatus() {
1322
1481
  return runSync(this._async.getSlotsStatus());
1323
1482
  }
1483
+ getSubagentsStatus() {
1484
+ return runSync(this._async.getSubagentsStatus());
1485
+ }
1486
+ setSubagentsEnabled(enabled) {
1487
+ return runSync(this._async.setSubagentsEnabled(enabled));
1488
+ }
1489
+ reloadServices() {
1490
+ return runSync(this._async.reloadServices());
1491
+ }
1492
+ getReloadStatus() {
1493
+ return runSync(this._async.getReloadStatus());
1494
+ }
1324
1495
  // ------------------------------------------------------------------
1325
1496
  // Auth / WebSocket status
1326
1497
  // ------------------------------------------------------------------
@@ -1492,6 +1663,7 @@ var RealtimeClient = class {
1492
1663
  this._socket.on("disconnect", () => {
1493
1664
  this._connected = false;
1494
1665
  });
1666
+ this._socket.on("message", (payload) => this._dispatch(payload));
1495
1667
  return new Promise((resolve, reject) => {
1496
1668
  if (!this._socket) {
1497
1669
  reject(new Error("RealtimeClient not connected"));
@@ -1511,53 +1683,126 @@ var RealtimeClient = class {
1511
1683
  }
1512
1684
  this._connected = false;
1513
1685
  }
1686
+ /**
1687
+ * Dispatch a message envelope to registered handlers.
1688
+ * The server sends: socket.emit("message", {type: "message", event: {..., event_type: "...", ...}})
1689
+ */
1690
+ _dispatch(payload) {
1691
+ const envelope = payload;
1692
+ const event = envelope.event ?? envelope;
1693
+ const eventType = event.event_type;
1694
+ if (!eventType) return;
1695
+ const handlers = this._handlers.get(eventType);
1696
+ if (handlers) {
1697
+ for (const h of handlers) {
1698
+ h(event);
1699
+ }
1700
+ }
1701
+ }
1514
1702
  /**
1515
1703
  * Subscribe to realtime events for a specific task.
1704
+ * Emits a `join` event with `{rooms: ["task:{taskId}"]}`.
1516
1705
  */
1517
- async subscribeTask(taskId) {
1706
+ subscribeTask(taskId) {
1518
1707
  if (!this._socket) throw new Error("RealtimeClient not connected");
1519
- return new Promise((resolve, reject) => {
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
- );
1528
- });
1708
+ this._socket.emit("join", { rooms: [`task:${taskId}`] });
1529
1709
  }
1530
1710
  /**
1531
1711
  * Unsubscribe from realtime events for a specific task.
1712
+ * Emits a `leave` event with `{rooms: ["task:{taskId}"]}`.
1532
1713
  */
1533
- async unsubscribeTask(taskId) {
1714
+ unsubscribeTask(taskId) {
1534
1715
  if (!this._socket) throw new Error("RealtimeClient not connected");
1535
- return new Promise((resolve, reject) => {
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
- );
1544
- });
1716
+ this._socket.emit("leave", { rooms: [`task:${taskId}`] });
1717
+ }
1718
+ /**
1719
+ * Subscribe to event-type-scoped rooms.
1720
+ * e.g. subscribeEvents("task_created", "task_deleted")
1721
+ */
1722
+ subscribeEvents(...eventTypes) {
1723
+ if (!this._socket) throw new Error("RealtimeClient not connected");
1724
+ const rooms = eventTypes.map((t) => `event:${t}`);
1725
+ this._socket.emit("join", { rooms });
1726
+ }
1727
+ /**
1728
+ * Unsubscribe from event-type-scoped rooms.
1729
+ */
1730
+ unsubscribeEvents(...eventTypes) {
1731
+ if (!this._socket) throw new Error("RealtimeClient not connected");
1732
+ const rooms = eventTypes.map((t) => `event:${t}`);
1733
+ this._socket.emit("leave", { rooms });
1734
+ }
1735
+ /**
1736
+ * Subscribe to the `all` broadcast room (receives all events).
1737
+ */
1738
+ subscribeAll() {
1739
+ if (!this._socket) throw new Error("RealtimeClient not connected");
1740
+ this._socket.emit("join", { rooms: ["all"] });
1741
+ }
1742
+ /**
1743
+ * Subscribe to a locale-specific room.
1744
+ */
1745
+ subscribeLocale(locale) {
1746
+ if (!this._socket) throw new Error("RealtimeClient not connected");
1747
+ this._socket.emit("join", { rooms: [`locale:${locale}`] });
1748
+ }
1749
+ /**
1750
+ * Unsubscribe from a locale-specific room.
1751
+ */
1752
+ unsubscribeLocale(locale) {
1753
+ if (!this._socket) throw new Error("RealtimeClient not connected");
1754
+ this._socket.emit("leave", { rooms: [`locale:${locale}`] });
1755
+ }
1756
+ /**
1757
+ * Join arbitrary rooms by name.
1758
+ */
1759
+ joinRooms(rooms) {
1760
+ if (!this._socket) throw new Error("RealtimeClient not connected");
1761
+ this._socket.emit("join", { rooms });
1762
+ }
1763
+ /**
1764
+ * Leave arbitrary rooms by name.
1765
+ */
1766
+ leaveRooms(rooms) {
1767
+ if (!this._socket) throw new Error("RealtimeClient not connected");
1768
+ this._socket.emit("leave", { rooms });
1769
+ }
1770
+ /**
1771
+ * Send a ping to the server.
1772
+ */
1773
+ ping() {
1774
+ if (!this._socket) throw new Error("RealtimeClient not connected");
1775
+ this._socket.emit("ping");
1545
1776
  }
1546
1777
  /**
1547
1778
  * Register a handler for a specific event type.
1779
+ *
1780
+ * Domain events (task_created, task_status_changed, etc.) are dispatched
1781
+ * via the message envelope. Raw socket events (connect, disconnect,
1782
+ * connection_established, rooms_updated, pong) are wired directly.
1548
1783
  */
1549
1784
  on(event, handler) {
1550
1785
  if (!this._handlers.has(event)) {
1551
1786
  this._handlers.set(event, /* @__PURE__ */ new Set());
1552
1787
  if (this._socket) {
1553
- this._socket.on(event, (...args) => {
1554
- const handlers2 = this._handlers.get(event);
1555
- if (handlers2) {
1556
- for (const h of handlers2) {
1557
- h(...args);
1788
+ const rawSocketEvents = /* @__PURE__ */ new Set([
1789
+ "connect",
1790
+ "disconnect",
1791
+ "connect_error",
1792
+ "connection_established",
1793
+ "rooms_updated",
1794
+ "pong"
1795
+ ]);
1796
+ if (rawSocketEvents.has(event)) {
1797
+ this._socket.on(event, (...args) => {
1798
+ const handlers2 = this._handlers.get(event);
1799
+ if (handlers2) {
1800
+ for (const h of handlers2) {
1801
+ h(...args);
1802
+ }
1558
1803
  }
1559
- }
1560
- });
1804
+ });
1805
+ }
1561
1806
  }
1562
1807
  }
1563
1808
  const handlers = this._handlers.get(event);