frinus-mcp 3.1.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.
@@ -0,0 +1,71 @@
1
+ /**
2
+ * HTTP client for the Frinus Agent Service.
3
+ */
4
+ import axios from "axios";
5
+ import { getResolvedTenantOrgId } from "./memory-client.js";
6
+ export class AgentClient {
7
+ client;
8
+ constructor(baseURL, apiKey) {
9
+ this.client = axios.create({
10
+ baseURL,
11
+ timeout: 30000,
12
+ });
13
+ this.client.interceptors.request.use((config) => {
14
+ config.headers = config.headers || {};
15
+ config.headers['X-API-Key'] = apiKey;
16
+ const orgId = getResolvedTenantOrgId();
17
+ if (orgId)
18
+ config.headers['X-Tenant-ID'] = orgId;
19
+ return config;
20
+ });
21
+ }
22
+ async createAgent(data) {
23
+ const response = await this.client.post("/api/v1/agents", data);
24
+ return response.data;
25
+ }
26
+ async listAgents(orgId) {
27
+ const params = orgId ? { org_id: orgId } : {};
28
+ const response = await this.client.get("/api/v1/agents", { params });
29
+ return response.data;
30
+ }
31
+ async getAgent(agentId) {
32
+ const response = await this.client.get(`/api/v1/agents/${agentId}`);
33
+ return response.data;
34
+ }
35
+ async updateAgentPersona(agentId, data) {
36
+ const response = await this.client.put(`/api/v1/agents/${agentId}/persona`, data);
37
+ return response.data;
38
+ }
39
+ async deleteAgent(agentId) {
40
+ const response = await this.client.delete(`/api/v1/agents/${agentId}`);
41
+ if (response.status === 204) {
42
+ return { deleted: true };
43
+ }
44
+ return response.data;
45
+ }
46
+ async bootstrapAgent(agentId) {
47
+ const response = await this.client.post(`/api/v1/agents/${agentId}/bootstrap`);
48
+ return response.data;
49
+ }
50
+ async invokeAgent(data) {
51
+ // Resolve agent_id from name if needed
52
+ let agentId = data.agent_id;
53
+ if (!agentId && data.agent_name) {
54
+ const agents = await this.listAgents();
55
+ const found = agents.find((a) => a.name?.toLowerCase() === data.agent_name.toLowerCase());
56
+ if (found)
57
+ agentId = found.id;
58
+ else
59
+ throw new Error(`Agent '${data.agent_name}' not found`);
60
+ }
61
+ if (!agentId)
62
+ throw new Error("Either agent_id or agent_name is required");
63
+ const response = await this.client.post(`/api/v1/agents/${agentId}/invoke`, {
64
+ task_id: data.task_id || "00000000-0000-0000-0000-000000000000",
65
+ message: data.message,
66
+ context: data.context,
67
+ timeout_seconds: data.timeout_seconds || 120,
68
+ }, { timeout: (data.timeout_seconds || 120) * 1000 + 5000 });
69
+ return response.data;
70
+ }
71
+ }
@@ -0,0 +1,20 @@
1
+ import type { CpClientInterface } from "../types/index.js";
2
+ export declare class CpClient implements CpClientInterface {
3
+ private client;
4
+ constructor(baseURL: string, apiKey: string);
5
+ createUniverse(orgId: string, data: {
6
+ name: string;
7
+ slug: string;
8
+ description?: string;
9
+ }): Promise<any>;
10
+ listUniverses(orgId: string): Promise<any>;
11
+ updateUniverse(orgId: string, universeId: string, data: {
12
+ name?: string;
13
+ description?: string;
14
+ }): Promise<any>;
15
+ deleteUniverse(orgId: string, universeId: string): Promise<void>;
16
+ storeCredential(integrationRef: string, data: Record<string, unknown>, metadata?: Record<string, unknown>): Promise<any>;
17
+ getCredential(integrationRef: string): Promise<any>;
18
+ listCredentials(): Promise<any>;
19
+ deleteCredential(integrationRef: string): Promise<void>;
20
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * HTTP client for the Frinus Control Plane.
3
+ */
4
+ import axios from "axios";
5
+ import { getResolvedTenantOrgId } from "./memory-client.js";
6
+ export class CpClient {
7
+ client;
8
+ constructor(baseURL, apiKey) {
9
+ this.client = axios.create({
10
+ baseURL,
11
+ timeout: 30000,
12
+ });
13
+ this.client.interceptors.request.use((config) => {
14
+ config.headers = config.headers || {};
15
+ config.headers['X-API-Key'] = apiKey;
16
+ const orgId = getResolvedTenantOrgId();
17
+ if (orgId)
18
+ config.headers['X-Tenant-ID'] = orgId;
19
+ return config;
20
+ });
21
+ }
22
+ async createUniverse(orgId, data) {
23
+ const response = await this.client.post(`/api/v1/orgs/${orgId}/universes`, data);
24
+ return response.data;
25
+ }
26
+ async listUniverses(orgId) {
27
+ const response = await this.client.get(`/api/v1/orgs/${orgId}/universes`);
28
+ return response.data;
29
+ }
30
+ async updateUniverse(orgId, universeId, data) {
31
+ const response = await this.client.put(`/api/v1/orgs/${orgId}/universes/${universeId}`, data);
32
+ return response.data;
33
+ }
34
+ async deleteUniverse(orgId, universeId) {
35
+ await this.client.delete(`/api/v1/orgs/${orgId}/universes/${universeId}`);
36
+ }
37
+ // =========================================================================
38
+ // Credential Vault
39
+ // =========================================================================
40
+ async storeCredential(integrationRef, data, metadata) {
41
+ const response = await this.client.post(`/api/v1/credentials/${integrationRef}`, {
42
+ data,
43
+ metadata: metadata || {},
44
+ });
45
+ return response.data;
46
+ }
47
+ async getCredential(integrationRef) {
48
+ const response = await this.client.get(`/api/v1/credentials/${integrationRef}`);
49
+ return response.data;
50
+ }
51
+ async listCredentials() {
52
+ const response = await this.client.get(`/api/v1/credentials`);
53
+ return response.data;
54
+ }
55
+ async deleteCredential(integrationRef) {
56
+ await this.client.delete(`/api/v1/credentials/${integrationRef}`);
57
+ }
58
+ }
@@ -0,0 +1,200 @@
1
+ import type { MemoryClientInterface } from "../types/index.js";
2
+ export declare function getResolvedTenantOrgId(): string | null;
3
+ export declare function setResolvedTenantOrgId(v: string | null): void;
4
+ export declare function getResolvedUserEmail(): string | null;
5
+ export declare function setResolvedUserEmail(v: string | null): void;
6
+ export declare function getResolvedUserId(): string | null;
7
+ export declare function setResolvedUserId(v: string | null): void;
8
+ /** Reset all mutable module state. Useful for tests or server reinitialization. */
9
+ export declare function resetState(): void;
10
+ export declare class MemoryClient implements MemoryClientInterface {
11
+ private client;
12
+ constructor(baseURL: string, apiKey: string);
13
+ /** Return the current tenant org ID (if resolved). */
14
+ getTenantOrgId(): string | null;
15
+ getAuthMe(): Promise<any>;
16
+ startSession(data: {
17
+ agent_id?: string;
18
+ parent_session_id?: string;
19
+ }): Promise<any>;
20
+ endSession(sessionId: string): Promise<any>;
21
+ getSessionContext(data: {
22
+ session_id: string;
23
+ query: string;
24
+ agent_id?: string;
25
+ max_working_memory?: number;
26
+ max_long_term?: number;
27
+ include_topics?: boolean;
28
+ }): Promise<any>;
29
+ getSessionSummary(sessionId: string): Promise<any>;
30
+ clearSession(sessionId: string): Promise<any>;
31
+ storeMemory(data: {
32
+ agent_id: string;
33
+ content: string;
34
+ memory_type?: string;
35
+ scope?: string;
36
+ importance?: number;
37
+ user_id?: string;
38
+ created_by_user_id?: string;
39
+ metadata?: Record<string, unknown>;
40
+ context_id?: string;
41
+ credential_ref?: string;
42
+ }): Promise<any>;
43
+ searchMemories(data: {
44
+ query_text: string;
45
+ agent_id?: string;
46
+ memory_types?: string[];
47
+ limit?: number;
48
+ }): Promise<any>;
49
+ getMemory(memoryId: string): Promise<any>;
50
+ getAgentMemories(agentId: string, memoryType?: string, limit?: number): Promise<any>;
51
+ deleteMemory(memoryId: string): Promise<any>;
52
+ buildContext(data: {
53
+ agent_id: string;
54
+ task_description: string;
55
+ max_tokens?: number;
56
+ }): Promise<any>;
57
+ reinforceMemory(memoryId: string, boost?: number): Promise<any>;
58
+ weakenMemory(memoryId: string, penalty?: number): Promise<any>;
59
+ getWorkingMemory(contextId: string): Promise<any>;
60
+ addWorkingMemory(data: {
61
+ context_id: string;
62
+ content: string;
63
+ agent_id?: string;
64
+ task_id?: string;
65
+ ttl_seconds?: number;
66
+ }): Promise<any>;
67
+ clearWorkingMemory(contextId: string): Promise<any>;
68
+ captureStream(data: {
69
+ session_id: string;
70
+ content: string;
71
+ direction: string;
72
+ agent_id?: string;
73
+ importance?: number;
74
+ metadata?: Record<string, unknown>;
75
+ }): Promise<any>;
76
+ getSessionItems(sessionId: string, limit?: number): Promise<any>;
77
+ getRecentStreamItems(agentId?: string, limit?: number, includeForgotten?: boolean): Promise<any>;
78
+ processStream(batchSize?: number): Promise<any>;
79
+ searchWithAttention(data: {
80
+ query_text: string;
81
+ task_type?: string;
82
+ limit?: number;
83
+ agent_id?: string;
84
+ user_id?: string;
85
+ }): Promise<any>;
86
+ getUserContext(taskDescription: string, userEmail?: string): Promise<any>;
87
+ heartbeatTick(data: {
88
+ agent_id?: string;
89
+ context_id?: string;
90
+ session_id?: string;
91
+ }): Promise<any>;
92
+ reorientAgent(agentId: string, focus?: string): Promise<any>;
93
+ runSleepCycle(phases?: string[]): Promise<any>;
94
+ detectConflicts(similarityThreshold?: number, limit?: number): Promise<any>;
95
+ resolveConflict(data: {
96
+ keep_id: string;
97
+ supersede_id: string;
98
+ resolution_note: string;
99
+ }): Promise<any>;
100
+ detectRedundant(similarityThreshold?: number, limit?: number): Promise<any>;
101
+ hierarchyConsolidate(data: {
102
+ memory_ids: string[];
103
+ summary_content?: string;
104
+ agent_id?: string;
105
+ }): Promise<any>;
106
+ getHierarchyTree(memoryId: string): Promise<any>;
107
+ createConcept(data: {
108
+ name: string;
109
+ universe_id: string;
110
+ description?: string;
111
+ }): Promise<any>;
112
+ listUniverseConcepts(universeId: string): Promise<any>;
113
+ updateConcept(conceptId: string, data: {
114
+ name?: string;
115
+ description?: string;
116
+ }): Promise<any>;
117
+ deleteConcept(conceptId: string): Promise<any>;
118
+ createTheme(data: {
119
+ name: string;
120
+ concept_id: string;
121
+ description?: string;
122
+ }): Promise<any>;
123
+ listConceptThemes(conceptId: string): Promise<any>;
124
+ updateTheme(themeId: string, data: {
125
+ name?: string;
126
+ description?: string;
127
+ }): Promise<any>;
128
+ deleteTheme(themeId: string): Promise<any>;
129
+ createTopic(data: {
130
+ name: string;
131
+ theme_id: string;
132
+ description?: string;
133
+ status?: string;
134
+ }): Promise<any>;
135
+ listThemeTopics(themeId: string): Promise<any>;
136
+ updateTopic(topicId: string, data: {
137
+ name?: string;
138
+ description?: string;
139
+ }): Promise<any>;
140
+ updateTopicStatus(topicId: string, status: string): Promise<any>;
141
+ deleteTopic(topicId: string): Promise<any>;
142
+ createPoint(data: {
143
+ name: string;
144
+ topic_id: string;
145
+ description?: string;
146
+ status?: string;
147
+ }): Promise<any>;
148
+ listTopicPoints(topicId: string): Promise<any>;
149
+ updatePoint(pointId: string, data: {
150
+ name?: string;
151
+ description?: string;
152
+ content?: string;
153
+ }): Promise<any>;
154
+ updatePointStatus(pointId: string, status: string): Promise<any>;
155
+ deletePoint(pointId: string): Promise<any>;
156
+ getUniverseHierarchy(universeId: string): Promise<any>;
157
+ trainingTeach(data: {
158
+ content: string;
159
+ type?: string;
160
+ importance?: number;
161
+ universe_id?: string;
162
+ }): Promise<any>;
163
+ trainingQa(data: {
164
+ pairs: Array<{
165
+ question: string;
166
+ answer: string;
167
+ }>;
168
+ importance?: number;
169
+ universe_id?: string;
170
+ }): Promise<any>;
171
+ trainingStats(): Promise<any>;
172
+ trainingGaps(): Promise<any>;
173
+ trainingRecent(data?: {
174
+ limit?: number;
175
+ }): Promise<any>;
176
+ createTask(data: {
177
+ title: string;
178
+ description?: string;
179
+ assigned_agent_id?: string;
180
+ parent_task_id?: string;
181
+ priority?: number;
182
+ input_data?: Record<string, unknown>;
183
+ }): Promise<any>;
184
+ getTask(taskId: string): Promise<any>;
185
+ listTasks(data?: {
186
+ status?: string;
187
+ assigned_agent_id?: string;
188
+ parent_task_id?: string;
189
+ limit?: number;
190
+ }): Promise<any>;
191
+ updateTask(taskId: string, data: {
192
+ status?: string;
193
+ output_data?: Record<string, unknown>;
194
+ error_message?: string;
195
+ }): Promise<any>;
196
+ listSkills(category?: string): Promise<any>;
197
+ getAgentSkills(agentId: string): Promise<any>;
198
+ assignSkill(agentId: string, skillId: string, permission?: string): Promise<any>;
199
+ removeSkill(agentId: string, skillId: string): Promise<any>;
200
+ }