@renseiai/agentfactory-mcp-server 0.8.7 → 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.
@@ -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;AAsCxE;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAqX1D"}
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,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { getAllSessions, getSessionsByStatus, getSessionState, getSessionStateByIssue, storeSessionState, updateSessionStatus, storePendingPrompt, } from '@renseiai/agentfactory-server';
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',
@@ -245,20 +245,26 @@ export function registerFleetTools(server) {
245
245
  isError: true,
246
246
  };
247
247
  }
248
- const pending = await storePendingPrompt(session.linearSessionId, session.issueId, args.message);
249
- if (!pending) {
248
+ const agentId = session.agentId;
249
+ if (!agentId) {
250
250
  return {
251
- content: [{ type: 'text', text: `Error: Failed to store pending prompt. Redis may not be configured.` }],
251
+ content: [{ type: 'text', text: `Error: Session has no agentId. Cannot publish to agent inbox.` }],
252
252
  isError: true,
253
253
  };
254
254
  }
255
+ const streamId = await publishUrgent(agentId, {
256
+ type: 'directive',
257
+ sessionId: session.linearSessionId,
258
+ payload: args.message,
259
+ createdAt: Date.now(),
260
+ });
255
261
  return {
256
262
  content: [
257
263
  {
258
264
  type: 'text',
259
265
  text: JSON.stringify({
260
266
  forwarded: true,
261
- promptId: pending.id,
267
+ streamId,
262
268
  taskId: session.linearSessionId,
263
269
  issueId: session.issueId,
264
270
  sessionStatus: session.status,
@@ -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
- storePendingPrompt: vi.fn(),
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, storePendingPrompt, } from '@renseiai/agentfactory-server';
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(storePendingPrompt).mockResolvedValue({
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.promptId).toBe('prm_123');
258
+ expect(data.streamId).toBe('1234567890-0');
264
259
  expect(data.taskId).toBe('ses-123');
265
- expect(storePendingPrompt).toHaveBeenCalledWith('ses-123', 'issue-abc', 'Please also fix the tests');
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(storePendingPrompt).mockResolvedValue({
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(storePendingPrompt).mockResolvedValue({
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 storePendingPrompt fails', async () => {
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(storePendingPrompt).mockResolvedValue(null);
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('Failed to store pending prompt');
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.7",
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.7"
40
+ "@renseiai/agentfactory-server": "0.8.8"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^22.5.4",