agent-orchestrator-mcp-server 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -30
- package/build/index.js +4 -4
- package/package.json +1 -1
- package/shared/orchestrator-client/orchestrator-client.d.ts +128 -3
- package/shared/orchestrator-client/orchestrator-client.integration-mock.js +313 -1
- package/shared/orchestrator-client/orchestrator-client.js +205 -0
- package/shared/resources.js +9 -4
- package/shared/tools/action-health.d.ts +58 -0
- package/shared/tools/action-health.js +101 -0
- package/shared/tools/action-notification.d.ts +46 -0
- package/shared/tools/action-notification.js +99 -0
- package/shared/tools/action-session.d.ts +33 -9
- package/shared/tools/action-session.js +177 -15
- package/shared/tools/action-trigger.d.ts +114 -0
- package/shared/tools/action-trigger.js +177 -0
- package/shared/tools/get-notifications.d.ts +70 -0
- package/shared/tools/get-notifications.js +113 -0
- package/shared/tools/get-session.d.ts +8 -0
- package/shared/tools/get-session.js +21 -2
- package/shared/tools/get-system-health.d.ts +38 -0
- package/shared/tools/get-system-health.js +69 -0
- package/shared/tools/get-transcript-archive.d.ts +27 -0
- package/shared/tools/get-transcript-archive.js +64 -0
- package/shared/tools/manage-enqueued-messages.d.ts +94 -0
- package/shared/tools/manage-enqueued-messages.js +259 -0
- package/shared/tools/search-sessions.d.ts +3 -10
- package/shared/tools/search-sessions.js +10 -15
- package/shared/tools/search-triggers.d.ts +78 -0
- package/shared/tools/search-triggers.js +145 -0
- package/shared/tools.d.ts +7 -9
- package/shared/tools.js +105 -32
- package/shared/types.d.ts +162 -1
|
@@ -111,7 +111,6 @@ export function createIntegrationMockOrchestratorClient(initialMockData) {
|
|
|
111
111
|
const paginatedSessions = sessions.slice(start, start + perPage);
|
|
112
112
|
return {
|
|
113
113
|
query,
|
|
114
|
-
search_contents: options?.search_contents || false,
|
|
115
114
|
sessions: paginatedSessions,
|
|
116
115
|
pagination: {
|
|
117
116
|
page,
|
|
@@ -443,5 +442,318 @@ export function createIntegrationMockOrchestratorClient(initialMockData) {
|
|
|
443
442
|
session_id: session.id,
|
|
444
443
|
};
|
|
445
444
|
},
|
|
445
|
+
// Session Extensions
|
|
446
|
+
async forkSession(id, _messageIndex) {
|
|
447
|
+
const session = mockData.sessions?.find((s) => s.id === Number(id) || s.slug === String(id));
|
|
448
|
+
if (!session)
|
|
449
|
+
throw new Error(`API Error (404): Session not found`);
|
|
450
|
+
sessionIdCounter++;
|
|
451
|
+
const forked = {
|
|
452
|
+
...session,
|
|
453
|
+
id: sessionIdCounter,
|
|
454
|
+
title: `Forked: ${session.title}`,
|
|
455
|
+
status: 'waiting',
|
|
456
|
+
created_at: new Date().toISOString(),
|
|
457
|
+
updated_at: new Date().toISOString(),
|
|
458
|
+
};
|
|
459
|
+
mockData.sessions?.push(forked);
|
|
460
|
+
return { session: forked, message: 'Session forked successfully' };
|
|
461
|
+
},
|
|
462
|
+
async refreshSession(id) {
|
|
463
|
+
const session = mockData.sessions?.find((s) => s.id === Number(id) || s.slug === String(id));
|
|
464
|
+
if (!session)
|
|
465
|
+
throw new Error(`API Error (404): Session not found`);
|
|
466
|
+
return { session, message: 'Session refreshed' };
|
|
467
|
+
},
|
|
468
|
+
async refreshAllSessions() {
|
|
469
|
+
return {
|
|
470
|
+
message: 'All sessions refreshed',
|
|
471
|
+
refreshed: mockData.sessions?.length || 0,
|
|
472
|
+
restarted: 0,
|
|
473
|
+
continued: 0,
|
|
474
|
+
errors: 0,
|
|
475
|
+
};
|
|
476
|
+
},
|
|
477
|
+
async updateSessionNotes(id, _notes) {
|
|
478
|
+
const session = mockData.sessions?.find((s) => s.id === Number(id) || s.slug === String(id));
|
|
479
|
+
if (!session)
|
|
480
|
+
throw new Error(`API Error (404): Session not found`);
|
|
481
|
+
session.updated_at = new Date().toISOString();
|
|
482
|
+
return session;
|
|
483
|
+
},
|
|
484
|
+
async toggleFavorite(id) {
|
|
485
|
+
const session = mockData.sessions?.find((s) => s.id === Number(id) || s.slug === String(id));
|
|
486
|
+
if (!session)
|
|
487
|
+
throw new Error(`API Error (404): Session not found`);
|
|
488
|
+
return { ...session, favorited: true };
|
|
489
|
+
},
|
|
490
|
+
async bulkArchiveSessions(sessionIds) {
|
|
491
|
+
let archived = 0;
|
|
492
|
+
for (const sid of sessionIds) {
|
|
493
|
+
const session = mockData.sessions?.find((s) => s.id === sid);
|
|
494
|
+
if (session) {
|
|
495
|
+
session.status = 'archived';
|
|
496
|
+
session.archived_at = new Date().toISOString();
|
|
497
|
+
archived++;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
return { archived_count: archived, errors: [] };
|
|
501
|
+
},
|
|
502
|
+
async getTranscript(_id, _format) {
|
|
503
|
+
return { transcript_text: 'User: Hello\nAssistant: Hi there!' };
|
|
504
|
+
},
|
|
505
|
+
// Enqueued Messages
|
|
506
|
+
async listEnqueuedMessages(_sessionId, options) {
|
|
507
|
+
const page = options?.page || 1;
|
|
508
|
+
const perPage = options?.per_page || 25;
|
|
509
|
+
return {
|
|
510
|
+
enqueued_messages: [],
|
|
511
|
+
pagination: { page, per_page: perPage, total_count: 0, total_pages: 0 },
|
|
512
|
+
};
|
|
513
|
+
},
|
|
514
|
+
async getEnqueuedMessage(_sessionId, messageId) {
|
|
515
|
+
return {
|
|
516
|
+
id: messageId,
|
|
517
|
+
session_id: 1,
|
|
518
|
+
content: 'Test message',
|
|
519
|
+
stop_condition: null,
|
|
520
|
+
position: 1,
|
|
521
|
+
status: 'pending',
|
|
522
|
+
created_at: new Date().toISOString(),
|
|
523
|
+
updated_at: new Date().toISOString(),
|
|
524
|
+
};
|
|
525
|
+
},
|
|
526
|
+
async createEnqueuedMessage(sessionId, data) {
|
|
527
|
+
return {
|
|
528
|
+
id: 1,
|
|
529
|
+
session_id: Number(sessionId),
|
|
530
|
+
content: data.content,
|
|
531
|
+
stop_condition: data.stop_condition || null,
|
|
532
|
+
position: 1,
|
|
533
|
+
status: 'pending',
|
|
534
|
+
created_at: new Date().toISOString(),
|
|
535
|
+
updated_at: new Date().toISOString(),
|
|
536
|
+
};
|
|
537
|
+
},
|
|
538
|
+
async updateEnqueuedMessage(_sessionId, messageId, data) {
|
|
539
|
+
return {
|
|
540
|
+
id: messageId,
|
|
541
|
+
session_id: 1,
|
|
542
|
+
content: data.content || 'Updated message',
|
|
543
|
+
stop_condition: data.stop_condition || null,
|
|
544
|
+
position: 1,
|
|
545
|
+
status: 'pending',
|
|
546
|
+
created_at: new Date().toISOString(),
|
|
547
|
+
updated_at: new Date().toISOString(),
|
|
548
|
+
};
|
|
549
|
+
},
|
|
550
|
+
async deleteEnqueuedMessage(_sessionId, _messageId) {
|
|
551
|
+
// No-op
|
|
552
|
+
},
|
|
553
|
+
async reorderEnqueuedMessage(_sessionId, messageId, position) {
|
|
554
|
+
return {
|
|
555
|
+
id: messageId,
|
|
556
|
+
session_id: 1,
|
|
557
|
+
content: 'Test message',
|
|
558
|
+
stop_condition: null,
|
|
559
|
+
position,
|
|
560
|
+
status: 'pending',
|
|
561
|
+
created_at: new Date().toISOString(),
|
|
562
|
+
updated_at: new Date().toISOString(),
|
|
563
|
+
};
|
|
564
|
+
},
|
|
565
|
+
async interruptEnqueuedMessage(sessionId, _messageId) {
|
|
566
|
+
const session = mockData.sessions?.find((s) => s.id === Number(sessionId) || s.slug === String(sessionId));
|
|
567
|
+
if (!session)
|
|
568
|
+
throw new Error(`API Error (404): Session not found`);
|
|
569
|
+
return { session, message: 'Message sent as interrupt' };
|
|
570
|
+
},
|
|
571
|
+
// Triggers
|
|
572
|
+
async listTriggers(options) {
|
|
573
|
+
const page = options?.page || 1;
|
|
574
|
+
const perPage = options?.per_page || 25;
|
|
575
|
+
return {
|
|
576
|
+
triggers: [],
|
|
577
|
+
pagination: { page, per_page: perPage, total_count: 0, total_pages: 0 },
|
|
578
|
+
};
|
|
579
|
+
},
|
|
580
|
+
async getTrigger(id) {
|
|
581
|
+
const trigger = {
|
|
582
|
+
id,
|
|
583
|
+
name: 'Test Trigger',
|
|
584
|
+
trigger_type: 'schedule',
|
|
585
|
+
status: 'enabled',
|
|
586
|
+
agent_root_name: 'mcp-servers',
|
|
587
|
+
prompt_template: 'Test prompt',
|
|
588
|
+
stop_condition: null,
|
|
589
|
+
reuse_session: false,
|
|
590
|
+
mcp_servers: [],
|
|
591
|
+
configuration: {},
|
|
592
|
+
schedule_description: 'Every day',
|
|
593
|
+
last_session_id: null,
|
|
594
|
+
last_triggered_at: null,
|
|
595
|
+
last_polled_at: null,
|
|
596
|
+
sessions_created_count: 0,
|
|
597
|
+
created_at: new Date().toISOString(),
|
|
598
|
+
updated_at: new Date().toISOString(),
|
|
599
|
+
};
|
|
600
|
+
return { trigger, recent_sessions: [] };
|
|
601
|
+
},
|
|
602
|
+
async createTrigger(data) {
|
|
603
|
+
return {
|
|
604
|
+
id: 1,
|
|
605
|
+
name: data.name,
|
|
606
|
+
trigger_type: data.trigger_type,
|
|
607
|
+
status: data.status || 'enabled',
|
|
608
|
+
agent_root_name: data.agent_root_name,
|
|
609
|
+
prompt_template: data.prompt_template,
|
|
610
|
+
stop_condition: data.stop_condition || null,
|
|
611
|
+
reuse_session: data.reuse_session || false,
|
|
612
|
+
mcp_servers: data.mcp_servers || [],
|
|
613
|
+
configuration: data.configuration || {},
|
|
614
|
+
schedule_description: null,
|
|
615
|
+
last_session_id: null,
|
|
616
|
+
last_triggered_at: null,
|
|
617
|
+
last_polled_at: null,
|
|
618
|
+
sessions_created_count: 0,
|
|
619
|
+
created_at: new Date().toISOString(),
|
|
620
|
+
updated_at: new Date().toISOString(),
|
|
621
|
+
};
|
|
622
|
+
},
|
|
623
|
+
async updateTrigger(id, data) {
|
|
624
|
+
return {
|
|
625
|
+
id,
|
|
626
|
+
name: data.name || 'Updated Trigger',
|
|
627
|
+
trigger_type: data.trigger_type || 'schedule',
|
|
628
|
+
status: data.status || 'enabled',
|
|
629
|
+
agent_root_name: data.agent_root_name || 'mcp-servers',
|
|
630
|
+
prompt_template: data.prompt_template || 'Test prompt',
|
|
631
|
+
stop_condition: data.stop_condition || null,
|
|
632
|
+
reuse_session: data.reuse_session || false,
|
|
633
|
+
mcp_servers: data.mcp_servers || [],
|
|
634
|
+
configuration: data.configuration || {},
|
|
635
|
+
schedule_description: null,
|
|
636
|
+
last_session_id: null,
|
|
637
|
+
last_triggered_at: null,
|
|
638
|
+
last_polled_at: null,
|
|
639
|
+
sessions_created_count: 0,
|
|
640
|
+
created_at: new Date().toISOString(),
|
|
641
|
+
updated_at: new Date().toISOString(),
|
|
642
|
+
};
|
|
643
|
+
},
|
|
644
|
+
async deleteTrigger(_id) {
|
|
645
|
+
// No-op
|
|
646
|
+
},
|
|
647
|
+
async toggleTrigger(id) {
|
|
648
|
+
return {
|
|
649
|
+
id,
|
|
650
|
+
name: 'Toggled Trigger',
|
|
651
|
+
trigger_type: 'schedule',
|
|
652
|
+
status: 'disabled',
|
|
653
|
+
agent_root_name: 'mcp-servers',
|
|
654
|
+
prompt_template: 'Test prompt',
|
|
655
|
+
stop_condition: null,
|
|
656
|
+
reuse_session: false,
|
|
657
|
+
mcp_servers: [],
|
|
658
|
+
configuration: {},
|
|
659
|
+
schedule_description: null,
|
|
660
|
+
last_session_id: null,
|
|
661
|
+
last_triggered_at: null,
|
|
662
|
+
last_polled_at: null,
|
|
663
|
+
sessions_created_count: 0,
|
|
664
|
+
created_at: new Date().toISOString(),
|
|
665
|
+
updated_at: new Date().toISOString(),
|
|
666
|
+
};
|
|
667
|
+
},
|
|
668
|
+
async getTriggerChannels() {
|
|
669
|
+
return {
|
|
670
|
+
channels: [{ id: 'C123', name: 'general', is_private: false, num_members: 50 }],
|
|
671
|
+
};
|
|
672
|
+
},
|
|
673
|
+
// Notification Management
|
|
674
|
+
async listNotifications(options) {
|
|
675
|
+
const page = options?.page || 1;
|
|
676
|
+
const perPage = options?.per_page || 25;
|
|
677
|
+
return {
|
|
678
|
+
notifications: [],
|
|
679
|
+
pagination: { page, per_page: perPage, total_count: 0, total_pages: 0 },
|
|
680
|
+
};
|
|
681
|
+
},
|
|
682
|
+
async getNotification(id) {
|
|
683
|
+
return {
|
|
684
|
+
id,
|
|
685
|
+
session_id: 1,
|
|
686
|
+
notification_type: 'session_needs_input',
|
|
687
|
+
read: false,
|
|
688
|
+
stale: false,
|
|
689
|
+
created_at: new Date().toISOString(),
|
|
690
|
+
updated_at: new Date().toISOString(),
|
|
691
|
+
};
|
|
692
|
+
},
|
|
693
|
+
async getNotificationBadge() {
|
|
694
|
+
return { pending_count: 0 };
|
|
695
|
+
},
|
|
696
|
+
async markNotificationRead(id) {
|
|
697
|
+
return {
|
|
698
|
+
id,
|
|
699
|
+
session_id: 1,
|
|
700
|
+
notification_type: 'session_needs_input',
|
|
701
|
+
read: true,
|
|
702
|
+
stale: false,
|
|
703
|
+
created_at: new Date().toISOString(),
|
|
704
|
+
updated_at: new Date().toISOString(),
|
|
705
|
+
};
|
|
706
|
+
},
|
|
707
|
+
async markAllNotificationsRead() {
|
|
708
|
+
return { marked_count: 0, pending_count: 0 };
|
|
709
|
+
},
|
|
710
|
+
async dismissNotification(_id) {
|
|
711
|
+
// No-op
|
|
712
|
+
},
|
|
713
|
+
async dismissAllReadNotifications() {
|
|
714
|
+
return { dismissed_count: 0, pending_count: 0 };
|
|
715
|
+
},
|
|
716
|
+
// Health
|
|
717
|
+
async getHealth() {
|
|
718
|
+
return {
|
|
719
|
+
health_report: { sessions: { running: 1 } },
|
|
720
|
+
timestamp: new Date().toISOString(),
|
|
721
|
+
rails_env: 'test',
|
|
722
|
+
ruby_version: '3.3.0',
|
|
723
|
+
};
|
|
724
|
+
},
|
|
725
|
+
async cleanupProcesses() {
|
|
726
|
+
return { cleaned: 0, message: 'No orphaned processes' };
|
|
727
|
+
},
|
|
728
|
+
async retrySessions(_sessionIds) {
|
|
729
|
+
return { retried: 0, message: 'No sessions to retry' };
|
|
730
|
+
},
|
|
731
|
+
async archiveOldSessions(_days) {
|
|
732
|
+
return { archived: 0, message: 'No old sessions' };
|
|
733
|
+
},
|
|
734
|
+
// CLIs
|
|
735
|
+
async getCliStatus() {
|
|
736
|
+
return { cli_status: {}, unauthenticated_count: 0 };
|
|
737
|
+
},
|
|
738
|
+
async refreshCli() {
|
|
739
|
+
return { queued: true, message: 'CLI refresh queued' };
|
|
740
|
+
},
|
|
741
|
+
async clearCliCache() {
|
|
742
|
+
return { queued: true, message: 'CLI cache clear queued' };
|
|
743
|
+
},
|
|
744
|
+
// Transcript Archive
|
|
745
|
+
async getTranscriptArchiveStatus() {
|
|
746
|
+
return {
|
|
747
|
+
generated_at: '2025-01-15T15:00:00Z',
|
|
748
|
+
session_count: 10,
|
|
749
|
+
file_size_bytes: 524288,
|
|
750
|
+
};
|
|
751
|
+
},
|
|
752
|
+
getTranscriptArchiveDownloadUrl() {
|
|
753
|
+
return {
|
|
754
|
+
url: 'http://localhost:3000/api/v1/transcript_archive/download',
|
|
755
|
+
apiKey: 'test-api-key',
|
|
756
|
+
};
|
|
757
|
+
},
|
|
446
758
|
};
|
|
447
759
|
}
|
|
@@ -98,6 +98,67 @@ export class AgentOrchestratorClient {
|
|
|
98
98
|
}
|
|
99
99
|
return response.json();
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Like request(), but reads the response as text and wraps it in a TranscriptResponse.
|
|
103
|
+
* Used for API endpoints that return raw text instead of JSON (e.g., transcript with format=text).
|
|
104
|
+
*/
|
|
105
|
+
async requestText(method, path, body, queryParams) {
|
|
106
|
+
const url = new URL(`${this.baseUrl}${path}`);
|
|
107
|
+
if (queryParams) {
|
|
108
|
+
Object.entries(queryParams).forEach(([key, value]) => {
|
|
109
|
+
if (value !== undefined && value !== null) {
|
|
110
|
+
url.searchParams.append(key, String(value));
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
const headers = {
|
|
115
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
116
|
+
};
|
|
117
|
+
if (body) {
|
|
118
|
+
headers['Content-Type'] = 'application/json';
|
|
119
|
+
}
|
|
120
|
+
const controller = new AbortController();
|
|
121
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
122
|
+
const options = {
|
|
123
|
+
method,
|
|
124
|
+
headers,
|
|
125
|
+
signal: controller.signal,
|
|
126
|
+
};
|
|
127
|
+
if (body && (method === 'POST' || method === 'PATCH' || method === 'PUT')) {
|
|
128
|
+
options.body = JSON.stringify(body);
|
|
129
|
+
}
|
|
130
|
+
let response;
|
|
131
|
+
try {
|
|
132
|
+
response = await fetch(url.toString(), options);
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
clearTimeout(timeoutId);
|
|
136
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
137
|
+
throw new Error(`Request timeout after ${this.timeoutMs}ms`);
|
|
138
|
+
}
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
finally {
|
|
142
|
+
clearTimeout(timeoutId);
|
|
143
|
+
}
|
|
144
|
+
if (!response.ok) {
|
|
145
|
+
const errorText = await response.text();
|
|
146
|
+
let errorMessage;
|
|
147
|
+
try {
|
|
148
|
+
const errorJson = JSON.parse(errorText);
|
|
149
|
+
errorMessage = errorJson.message || errorJson.error || errorText;
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
errorMessage = errorText;
|
|
153
|
+
}
|
|
154
|
+
throw new Error(`API Error (${response.status}): ${errorMessage}`);
|
|
155
|
+
}
|
|
156
|
+
if (response.status === 204) {
|
|
157
|
+
return { transcript_text: '' };
|
|
158
|
+
}
|
|
159
|
+
const text = await response.text();
|
|
160
|
+
return { transcript_text: text };
|
|
161
|
+
}
|
|
101
162
|
// Sessions
|
|
102
163
|
async listSessions(options) {
|
|
103
164
|
return this.request('GET', '/sessions', undefined, options);
|
|
@@ -207,4 +268,148 @@ export class AgentOrchestratorClient {
|
|
|
207
268
|
message,
|
|
208
269
|
});
|
|
209
270
|
}
|
|
271
|
+
// Session Extensions
|
|
272
|
+
async forkSession(id, messageIndex) {
|
|
273
|
+
return this.request('POST', `/sessions/${id}/fork`, {
|
|
274
|
+
message_index: messageIndex,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
async refreshSession(id) {
|
|
278
|
+
return this.request('POST', `/sessions/${id}/refresh`);
|
|
279
|
+
}
|
|
280
|
+
async refreshAllSessions() {
|
|
281
|
+
return this.request('POST', '/sessions/refresh_all');
|
|
282
|
+
}
|
|
283
|
+
async updateSessionNotes(id, notes) {
|
|
284
|
+
const response = await this.request('PATCH', `/sessions/${id}/notes`, {
|
|
285
|
+
session_notes: notes,
|
|
286
|
+
});
|
|
287
|
+
return response.session;
|
|
288
|
+
}
|
|
289
|
+
async toggleFavorite(id) {
|
|
290
|
+
return this.request('POST', `/sessions/${id}/toggle_favorite`);
|
|
291
|
+
}
|
|
292
|
+
async bulkArchiveSessions(sessionIds) {
|
|
293
|
+
return this.request('POST', '/sessions/bulk_archive', {
|
|
294
|
+
session_ids: sessionIds,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
async getTranscript(id, format = 'json') {
|
|
298
|
+
if (format === 'text') {
|
|
299
|
+
// The API returns raw text (not JSON) when format=text,
|
|
300
|
+
// so we must use response.text() instead of response.json()
|
|
301
|
+
return this.requestText('GET', `/sessions/${id}/transcript`, undefined, { format });
|
|
302
|
+
}
|
|
303
|
+
return this.request('GET', `/sessions/${id}/transcript`, undefined, {
|
|
304
|
+
format,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
// Enqueued Messages
|
|
308
|
+
async listEnqueuedMessages(sessionId, options) {
|
|
309
|
+
return this.request('GET', `/sessions/${sessionId}/enqueued_messages`, undefined, options);
|
|
310
|
+
}
|
|
311
|
+
async getEnqueuedMessage(sessionId, messageId) {
|
|
312
|
+
const response = await this.request('GET', `/sessions/${sessionId}/enqueued_messages/${messageId}`);
|
|
313
|
+
return response.enqueued_message;
|
|
314
|
+
}
|
|
315
|
+
async createEnqueuedMessage(sessionId, data) {
|
|
316
|
+
const response = await this.request('POST', `/sessions/${sessionId}/enqueued_messages`, data);
|
|
317
|
+
return response.enqueued_message;
|
|
318
|
+
}
|
|
319
|
+
async updateEnqueuedMessage(sessionId, messageId, data) {
|
|
320
|
+
const response = await this.request('PATCH', `/sessions/${sessionId}/enqueued_messages/${messageId}`, data);
|
|
321
|
+
return response.enqueued_message;
|
|
322
|
+
}
|
|
323
|
+
async deleteEnqueuedMessage(sessionId, messageId) {
|
|
324
|
+
await this.request('DELETE', `/sessions/${sessionId}/enqueued_messages/${messageId}`);
|
|
325
|
+
}
|
|
326
|
+
async reorderEnqueuedMessage(sessionId, messageId, position) {
|
|
327
|
+
const response = await this.request('PATCH', `/sessions/${sessionId}/enqueued_messages/${messageId}/reorder`, { position });
|
|
328
|
+
return response.enqueued_message;
|
|
329
|
+
}
|
|
330
|
+
async interruptEnqueuedMessage(sessionId, messageId) {
|
|
331
|
+
return this.request('POST', `/sessions/${sessionId}/enqueued_messages/${messageId}/interrupt`);
|
|
332
|
+
}
|
|
333
|
+
// Triggers
|
|
334
|
+
async listTriggers(options) {
|
|
335
|
+
return this.request('GET', '/triggers', undefined, options);
|
|
336
|
+
}
|
|
337
|
+
async getTrigger(id) {
|
|
338
|
+
return this.request('GET', `/triggers/${id}`);
|
|
339
|
+
}
|
|
340
|
+
async createTrigger(data) {
|
|
341
|
+
const response = await this.request('POST', '/triggers', data);
|
|
342
|
+
return response.trigger;
|
|
343
|
+
}
|
|
344
|
+
async updateTrigger(id, data) {
|
|
345
|
+
const response = await this.request('PATCH', `/triggers/${id}`, data);
|
|
346
|
+
return response.trigger;
|
|
347
|
+
}
|
|
348
|
+
async deleteTrigger(id) {
|
|
349
|
+
await this.request('DELETE', `/triggers/${id}`);
|
|
350
|
+
}
|
|
351
|
+
async toggleTrigger(id) {
|
|
352
|
+
const response = await this.request('POST', `/triggers/${id}/toggle`);
|
|
353
|
+
return response.trigger;
|
|
354
|
+
}
|
|
355
|
+
async getTriggerChannels() {
|
|
356
|
+
return this.request('GET', '/triggers/channels');
|
|
357
|
+
}
|
|
358
|
+
// Notification Management
|
|
359
|
+
async listNotifications(options) {
|
|
360
|
+
return this.request('GET', '/notifications', undefined, options);
|
|
361
|
+
}
|
|
362
|
+
async getNotification(id) {
|
|
363
|
+
const response = await this.request('GET', `/notifications/${id}`);
|
|
364
|
+
return response.notification;
|
|
365
|
+
}
|
|
366
|
+
async getNotificationBadge() {
|
|
367
|
+
return this.request('GET', '/notifications/badge');
|
|
368
|
+
}
|
|
369
|
+
async markNotificationRead(id) {
|
|
370
|
+
const response = await this.request('PATCH', `/notifications/${id}/mark_read`);
|
|
371
|
+
return response.notification;
|
|
372
|
+
}
|
|
373
|
+
async markAllNotificationsRead() {
|
|
374
|
+
return this.request('PATCH', '/notifications/mark_all_read');
|
|
375
|
+
}
|
|
376
|
+
async dismissNotification(id) {
|
|
377
|
+
await this.request('DELETE', `/notifications/${id}`);
|
|
378
|
+
}
|
|
379
|
+
async dismissAllReadNotifications() {
|
|
380
|
+
return this.request('DELETE', '/notifications/dismiss_all_read');
|
|
381
|
+
}
|
|
382
|
+
// Health
|
|
383
|
+
async getHealth() {
|
|
384
|
+
return this.request('GET', '/health');
|
|
385
|
+
}
|
|
386
|
+
async cleanupProcesses() {
|
|
387
|
+
return this.request('POST', '/health/cleanup_processes');
|
|
388
|
+
}
|
|
389
|
+
async retrySessions(sessionIds) {
|
|
390
|
+
return this.request('POST', '/health/retry_sessions', sessionIds ? { session_ids: sessionIds } : undefined);
|
|
391
|
+
}
|
|
392
|
+
async archiveOldSessions(days) {
|
|
393
|
+
return this.request('POST', '/health/archive_old', days ? { days } : undefined);
|
|
394
|
+
}
|
|
395
|
+
// CLIs
|
|
396
|
+
async getCliStatus() {
|
|
397
|
+
return this.request('GET', '/clis/status');
|
|
398
|
+
}
|
|
399
|
+
async refreshCli() {
|
|
400
|
+
return this.request('POST', '/clis/refresh');
|
|
401
|
+
}
|
|
402
|
+
async clearCliCache() {
|
|
403
|
+
return this.request('POST', '/clis/clear_cache');
|
|
404
|
+
}
|
|
405
|
+
// Transcript Archive
|
|
406
|
+
async getTranscriptArchiveStatus() {
|
|
407
|
+
return this.request('GET', '/transcript_archive/status');
|
|
408
|
+
}
|
|
409
|
+
getTranscriptArchiveDownloadUrl() {
|
|
410
|
+
return {
|
|
411
|
+
url: `${this.baseUrl}/api/v1/transcript_archive/download`,
|
|
412
|
+
apiKey: this.apiKey,
|
|
413
|
+
};
|
|
414
|
+
}
|
|
210
415
|
}
|
package/shared/resources.js
CHANGED
|
@@ -58,7 +58,7 @@ export function createRegisterResources(clientFactory) {
|
|
|
58
58
|
AGENT_ORCHESTRATOR_API_KEY: process.env.AGENT_ORCHESTRATOR_API_KEY
|
|
59
59
|
? '***configured***'
|
|
60
60
|
: 'not set',
|
|
61
|
-
|
|
61
|
+
TOOL_GROUPS: process.env.TOOL_GROUPS || 'all (default)',
|
|
62
62
|
SKIP_HEALTH_CHECKS: process.env.SKIP_HEALTH_CHECKS || 'false',
|
|
63
63
|
},
|
|
64
64
|
capabilities: {
|
|
@@ -66,9 +66,14 @@ export function createRegisterResources(clientFactory) {
|
|
|
66
66
|
resources: true,
|
|
67
67
|
},
|
|
68
68
|
toolGroups: {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
sessions: 'All session tools (read + write): search, get, configs, start, action, enqueued messages',
|
|
70
|
+
sessions_readonly: 'Session tools (read only): quick_search_sessions, get_session, get_configs',
|
|
71
|
+
notifications: 'All notification tools (read + write): get, send, mark read, dismiss',
|
|
72
|
+
notifications_readonly: 'Notification tools (read only): get_notifications',
|
|
73
|
+
triggers: 'All trigger tools (read + write): search, create, update, delete, toggle',
|
|
74
|
+
triggers_readonly: 'Trigger tools (read only): search_triggers',
|
|
75
|
+
health: 'All health tools (read + write): health report, CLI status, maintenance actions',
|
|
76
|
+
health_readonly: 'Health tools (read only): get_system_health',
|
|
72
77
|
},
|
|
73
78
|
};
|
|
74
79
|
return {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { IAgentOrchestratorClient } from '../orchestrator-client/orchestrator-client.js';
|
|
4
|
+
export declare const ActionHealthSchema: z.ZodObject<{
|
|
5
|
+
action: z.ZodEnum<["cleanup_processes", "retry_sessions", "archive_old", "cli_refresh", "cli_clear_cache"]>;
|
|
6
|
+
session_ids: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
7
|
+
days: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
action: "cleanup_processes" | "retry_sessions" | "archive_old" | "cli_refresh" | "cli_clear_cache";
|
|
10
|
+
session_ids?: number[] | undefined;
|
|
11
|
+
days?: number | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
action: "cleanup_processes" | "retry_sessions" | "archive_old" | "cli_refresh" | "cli_clear_cache";
|
|
14
|
+
session_ids?: number[] | undefined;
|
|
15
|
+
days?: number | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export declare function actionHealthTool(_server: Server, clientFactory: () => IAgentOrchestratorClient): {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: "object";
|
|
22
|
+
properties: {
|
|
23
|
+
action: {
|
|
24
|
+
type: string;
|
|
25
|
+
enum: readonly ["cleanup_processes", "retry_sessions", "archive_old", "cli_refresh", "cli_clear_cache"];
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
session_ids: {
|
|
29
|
+
type: string;
|
|
30
|
+
items: {
|
|
31
|
+
type: string;
|
|
32
|
+
};
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
days: {
|
|
36
|
+
type: string;
|
|
37
|
+
minimum: number;
|
|
38
|
+
maximum: number;
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
required: string[];
|
|
43
|
+
};
|
|
44
|
+
handler: (args: unknown) => Promise<{
|
|
45
|
+
content: {
|
|
46
|
+
type: string;
|
|
47
|
+
text: string;
|
|
48
|
+
}[];
|
|
49
|
+
isError: boolean;
|
|
50
|
+
} | {
|
|
51
|
+
content: {
|
|
52
|
+
type: string;
|
|
53
|
+
text: string;
|
|
54
|
+
}[];
|
|
55
|
+
isError?: undefined;
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=action-health.d.ts.map
|