@renseiai/agentfactory-mcp-server 0.8.6 → 0.8.8
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/src/tools.d.ts.map +1 -1
- package/dist/src/tools.js +12 -5
- package/dist/src/tools.test.js +23 -29
- package/package.json +2 -2
package/dist/src/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAsCxE;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAuX1D"}
|
package/dist/src/tools.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { getAllSessions, getSessionsByStatus, getSessionState, getSessionStateByIssue, storeSessionState, updateSessionStatus,
|
|
2
|
+
import { getAllSessions, getSessionsByStatus, getSessionState, getSessionStateByIssue, storeSessionState, updateSessionStatus, publishUrgent, } from '@renseiai/agentfactory-server';
|
|
3
3
|
// Work type values for zod enum validation
|
|
4
4
|
const WORK_TYPES = [
|
|
5
5
|
'research',
|
|
6
6
|
'backlog-creation',
|
|
7
7
|
'development',
|
|
8
8
|
'inflight',
|
|
9
|
+
'inflight-coordination',
|
|
9
10
|
'qa',
|
|
10
11
|
'acceptance',
|
|
11
12
|
'refinement',
|
|
@@ -244,20 +245,26 @@ export function registerFleetTools(server) {
|
|
|
244
245
|
isError: true,
|
|
245
246
|
};
|
|
246
247
|
}
|
|
247
|
-
const
|
|
248
|
-
if (!
|
|
248
|
+
const agentId = session.agentId;
|
|
249
|
+
if (!agentId) {
|
|
249
250
|
return {
|
|
250
|
-
content: [{ type: 'text', text: `Error:
|
|
251
|
+
content: [{ type: 'text', text: `Error: Session has no agentId. Cannot publish to agent inbox.` }],
|
|
251
252
|
isError: true,
|
|
252
253
|
};
|
|
253
254
|
}
|
|
255
|
+
const streamId = await publishUrgent(agentId, {
|
|
256
|
+
type: 'directive',
|
|
257
|
+
sessionId: session.linearSessionId,
|
|
258
|
+
payload: args.message,
|
|
259
|
+
createdAt: Date.now(),
|
|
260
|
+
});
|
|
254
261
|
return {
|
|
255
262
|
content: [
|
|
256
263
|
{
|
|
257
264
|
type: 'text',
|
|
258
265
|
text: JSON.stringify({
|
|
259
266
|
forwarded: true,
|
|
260
|
-
|
|
267
|
+
streamId,
|
|
261
268
|
taskId: session.linearSessionId,
|
|
262
269
|
issueId: session.issueId,
|
|
263
270
|
sessionStatus: session.status,
|
package/dist/src/tools.test.js
CHANGED
|
@@ -7,13 +7,13 @@ vi.mock('@renseiai/agentfactory-server', () => ({
|
|
|
7
7
|
getSessionStateByIssue: vi.fn(),
|
|
8
8
|
storeSessionState: vi.fn(),
|
|
9
9
|
updateSessionStatus: vi.fn(),
|
|
10
|
-
|
|
10
|
+
publishUrgent: vi.fn(),
|
|
11
11
|
}));
|
|
12
12
|
// ── Mock @modelcontextprotocol/sdk ──────────────────────────────────────────
|
|
13
13
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js', () => ({
|
|
14
14
|
McpServer: vi.fn(),
|
|
15
15
|
}));
|
|
16
|
-
import { getAllSessions, getSessionsByStatus, getSessionState, getSessionStateByIssue, storeSessionState, updateSessionStatus,
|
|
16
|
+
import { getAllSessions, getSessionsByStatus, getSessionState, getSessionStateByIssue, storeSessionState, updateSessionStatus, publishUrgent, } from '@renseiai/agentfactory-server';
|
|
17
17
|
import { registerFleetTools } from './tools.js';
|
|
18
18
|
/** Capture tool registrations from registerFleetTools */
|
|
19
19
|
function captureTools() {
|
|
@@ -40,6 +40,7 @@ function makeSession(overrides = {}) {
|
|
|
40
40
|
totalCostUsd: 0.5,
|
|
41
41
|
inputTokens: 1000,
|
|
42
42
|
outputTokens: 500,
|
|
43
|
+
agentId: 'agent-001',
|
|
43
44
|
...overrides,
|
|
44
45
|
};
|
|
45
46
|
}
|
|
@@ -247,33 +248,25 @@ describe('stop-agent', () => {
|
|
|
247
248
|
});
|
|
248
249
|
});
|
|
249
250
|
describe('forward-prompt', () => {
|
|
250
|
-
it('forwards a prompt to a running session', async () => {
|
|
251
|
+
it('forwards a prompt to a running session via agent inbox', async () => {
|
|
251
252
|
const handler = tools.get('forward-prompt');
|
|
252
253
|
vi.mocked(getSessionState).mockResolvedValue(makeSession({ status: 'running' }));
|
|
253
|
-
vi.mocked(
|
|
254
|
-
id: 'prm_123',
|
|
255
|
-
sessionId: 'ses-123',
|
|
256
|
-
issueId: 'issue-abc',
|
|
257
|
-
prompt: 'Please also fix the tests',
|
|
258
|
-
createdAt: Date.now(),
|
|
259
|
-
});
|
|
254
|
+
vi.mocked(publishUrgent).mockResolvedValue('1234567890-0');
|
|
260
255
|
const result = await handler({ taskId: 'ses-123', message: 'Please also fix the tests' });
|
|
261
256
|
const data = parseResult(result);
|
|
262
257
|
expect(data.forwarded).toBe(true);
|
|
263
|
-
expect(data.
|
|
258
|
+
expect(data.streamId).toBe('1234567890-0');
|
|
264
259
|
expect(data.taskId).toBe('ses-123');
|
|
265
|
-
expect(
|
|
260
|
+
expect(publishUrgent).toHaveBeenCalledWith('agent-001', expect.objectContaining({
|
|
261
|
+
type: 'directive',
|
|
262
|
+
sessionId: 'ses-123',
|
|
263
|
+
payload: 'Please also fix the tests',
|
|
264
|
+
}));
|
|
266
265
|
});
|
|
267
266
|
it('forwards a prompt to a claimed session', async () => {
|
|
268
267
|
const handler = tools.get('forward-prompt');
|
|
269
268
|
vi.mocked(getSessionState).mockResolvedValue(makeSession({ status: 'claimed' }));
|
|
270
|
-
vi.mocked(
|
|
271
|
-
id: 'prm_456',
|
|
272
|
-
sessionId: 'ses-123',
|
|
273
|
-
issueId: 'issue-abc',
|
|
274
|
-
prompt: 'extra context',
|
|
275
|
-
createdAt: Date.now(),
|
|
276
|
-
});
|
|
269
|
+
vi.mocked(publishUrgent).mockResolvedValue('1234567891-0');
|
|
277
270
|
const result = await handler({ taskId: 'ses-123', message: 'extra context' });
|
|
278
271
|
const data = parseResult(result);
|
|
279
272
|
expect(data.forwarded).toBe(true);
|
|
@@ -283,13 +276,7 @@ describe('forward-prompt', () => {
|
|
|
283
276
|
const handler = tools.get('forward-prompt');
|
|
284
277
|
vi.mocked(getSessionState).mockResolvedValue(null);
|
|
285
278
|
vi.mocked(getSessionStateByIssue).mockResolvedValue(makeSession());
|
|
286
|
-
vi.mocked(
|
|
287
|
-
id: 'prm_789',
|
|
288
|
-
sessionId: 'ses-123',
|
|
289
|
-
issueId: 'issue-abc',
|
|
290
|
-
prompt: 'msg',
|
|
291
|
-
createdAt: Date.now(),
|
|
292
|
-
});
|
|
279
|
+
vi.mocked(publishUrgent).mockResolvedValue('1234567892-0');
|
|
293
280
|
const result = await handler({ taskId: 'issue-abc', message: 'msg' });
|
|
294
281
|
expect(getSessionStateByIssue).toHaveBeenCalledWith('issue-abc');
|
|
295
282
|
expect(result.isError).toBeUndefined();
|
|
@@ -315,12 +302,19 @@ describe('forward-prompt', () => {
|
|
|
315
302
|
expect(result.isError).toBe(true);
|
|
316
303
|
expect(result.content[0].text).toContain('No task found');
|
|
317
304
|
});
|
|
318
|
-
it('returns error when
|
|
305
|
+
it('returns error when session has no agentId', async () => {
|
|
306
|
+
const handler = tools.get('forward-prompt');
|
|
307
|
+
vi.mocked(getSessionState).mockResolvedValue(makeSession({ status: 'running', agentId: undefined }));
|
|
308
|
+
const result = await handler({ taskId: 'ses-123', message: 'hello' });
|
|
309
|
+
expect(result.isError).toBe(true);
|
|
310
|
+
expect(result.content[0].text).toContain('no agentId');
|
|
311
|
+
});
|
|
312
|
+
it('returns error when publishUrgent throws', async () => {
|
|
319
313
|
const handler = tools.get('forward-prompt');
|
|
320
314
|
vi.mocked(getSessionState).mockResolvedValue(makeSession({ status: 'running' }));
|
|
321
|
-
vi.mocked(
|
|
315
|
+
vi.mocked(publishUrgent).mockRejectedValue(new Error('Redis not configured'));
|
|
322
316
|
const result = await handler({ taskId: 'ses-123', message: 'hello' });
|
|
323
317
|
expect(result.isError).toBe(true);
|
|
324
|
-
expect(result.content[0].text).toContain('
|
|
318
|
+
expect(result.content[0].text).toContain('Redis not configured');
|
|
325
319
|
});
|
|
326
320
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@renseiai/agentfactory-mcp-server",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP server exposing AgentFactory fleet capabilities to MCP-aware clients",
|
|
6
6
|
"author": "Rensei AI (https://rensei.ai)",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
39
39
|
"zod": "^4.3.6",
|
|
40
|
-
"@renseiai/agentfactory-server": "0.8.
|
|
40
|
+
"@renseiai/agentfactory-server": "0.8.8"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^22.5.4",
|