@vibe-forge/mcp 0.9.1 → 0.9.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-forge/mcp",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Vibe Forge MCP server",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#~/*.js": {
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
34
34
|
"commander": "^12.1.0",
|
|
35
35
|
"zod": "^3.24.1",
|
|
36
|
-
"@vibe-forge/register": "^0.9.1",
|
|
37
36
|
"@vibe-forge/config": "^0.9.0",
|
|
38
|
-
"@vibe-forge/hooks": "^0.9.1",
|
|
39
|
-
"@vibe-forge/types": "^0.9.0",
|
|
40
|
-
"@vibe-forge/utils": "^0.9.1",
|
|
41
37
|
"@vibe-forge/cli-helper": "^0.9.0",
|
|
42
|
-
"@vibe-forge/task": "^0.9.0"
|
|
38
|
+
"@vibe-forge/task": "^0.9.0",
|
|
39
|
+
"@vibe-forge/register": "^0.9.0",
|
|
40
|
+
"@vibe-forge/hooks": "^0.9.1",
|
|
41
|
+
"@vibe-forge/utils": "^0.9.0",
|
|
42
|
+
"@vibe-forge/types": "^0.9.0"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"test": "pnpm -C ../.. exec vitest run --workspace vitest.workspace.ts --project bundler packages/mcp/__tests__"
|
package/src/command.ts
CHANGED
|
@@ -59,5 +59,5 @@ export const configureMcpCommand = (command: Command, version: string) => (
|
|
|
59
59
|
)
|
|
60
60
|
|
|
61
61
|
export function registerMcpCommand(program: Command, version: string) {
|
|
62
|
-
return configureMcpCommand(program
|
|
62
|
+
return configureMcpCommand(program, version)
|
|
63
63
|
}
|
|
@@ -16,7 +16,11 @@ const Schema = z.object({
|
|
|
16
16
|
currentMode: z.enum(['default', 'acceptEdits', 'plan', 'dontAsk', 'bypassPermissions']).optional(),
|
|
17
17
|
suggestedMode: z.enum(['default', 'acceptEdits', 'plan', 'dontAsk', 'bypassPermissions']).optional(),
|
|
18
18
|
deniedTools: z.array(z.string()).optional(),
|
|
19
|
-
reasons: z.array(z.string()).optional()
|
|
19
|
+
reasons: z.array(z.string()).optional(),
|
|
20
|
+
subjectKey: z.string().optional(),
|
|
21
|
+
subjectLabel: z.string().optional(),
|
|
22
|
+
scope: z.enum(['tool']).optional(),
|
|
23
|
+
projectConfigPath: z.string().optional()
|
|
20
24
|
}).optional().describe('Extra context for permission escalation prompts')
|
|
21
25
|
})
|
|
22
26
|
|
package/src/tools/task/index.ts
CHANGED
|
@@ -65,7 +65,7 @@ export const createTaskRegister = () => {
|
|
|
65
65
|
await callHook('StartTasks', {
|
|
66
66
|
cwd: process.cwd(),
|
|
67
67
|
sessionId: process.env.__VF_PROJECT_AI_SESSION_ID__!,
|
|
68
|
-
tasks
|
|
68
|
+
tasks
|
|
69
69
|
})
|
|
70
70
|
const syncResults = parentSessionId
|
|
71
71
|
? await Promise.allSettled(resolvedTasks.map(task =>
|
|
@@ -3,7 +3,7 @@ import process from 'node:process'
|
|
|
3
3
|
import { loadInjectDefaultSystemPromptValue, mergeSystemPrompts } from '@vibe-forge/config'
|
|
4
4
|
import { callHook } from '@vibe-forge/hooks'
|
|
5
5
|
import { generateAdapterQueryOptions, run } from '@vibe-forge/task'
|
|
6
|
-
import type {
|
|
6
|
+
import type { AdapterOutputEvent, ChatMessage, McpTaskSession, SessionPermissionMode } from '@vibe-forge/types'
|
|
7
7
|
import { extractTextFromMessage } from '@vibe-forge/utils/chat-message'
|
|
8
8
|
|
|
9
9
|
import { fetchSessionMessages, postSessionEvent } from '#~/sync.js'
|
|
@@ -118,7 +118,7 @@ export class TaskManager {
|
|
|
118
118
|
mcpServers: resolvedConfig.mcpServers,
|
|
119
119
|
promptAssetIds: resolvedConfig.promptAssetIds,
|
|
120
120
|
assetBundle: resolvedConfig.assetBundle,
|
|
121
|
-
onEvent: (event:
|
|
121
|
+
onEvent: (event: AdapterOutputEvent) => {
|
|
122
122
|
this.handleEvent(taskId, event)
|
|
123
123
|
}
|
|
124
124
|
})
|
|
@@ -165,7 +165,7 @@ export class TaskManager {
|
|
|
165
165
|
return { taskId }
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
private handleEvent(taskId: string, event:
|
|
168
|
+
private handleEvent(taskId: string, event: AdapterOutputEvent) {
|
|
169
169
|
const task = this.tasks.get(taskId)
|
|
170
170
|
if (!task) return
|
|
171
171
|
|
|
@@ -221,6 +221,8 @@ export class TaskManager {
|
|
|
221
221
|
this.stopServerPolling(taskId)
|
|
222
222
|
task.onStop?.()
|
|
223
223
|
break
|
|
224
|
+
default:
|
|
225
|
+
break
|
|
224
226
|
}
|
|
225
227
|
}
|
|
226
228
|
|
|
@@ -272,7 +274,7 @@ export class TaskManager {
|
|
|
272
274
|
}
|
|
273
275
|
}
|
|
274
276
|
|
|
275
|
-
private async syncEvent(task: TaskInfo, event:
|
|
277
|
+
private async syncEvent(task: TaskInfo, event: AdapterOutputEvent) {
|
|
276
278
|
if (!task.serverSync) return
|
|
277
279
|
try {
|
|
278
280
|
await postSessionEvent(task.serverSync.sessionId, event as unknown as Record<string, unknown>)
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
-
|
|
3
|
-
const mocks = vi.hoisted(() => ({
|
|
4
|
-
callHook: vi.fn(),
|
|
5
|
-
uuid: vi.fn(),
|
|
6
|
-
createChildSession: vi.fn(),
|
|
7
|
-
getParentSessionId: vi.fn(),
|
|
8
|
-
startTask: vi.fn(),
|
|
9
|
-
getTask: vi.fn()
|
|
10
|
-
}))
|
|
11
|
-
|
|
12
|
-
vi.mock('@vibe-forge/hooks', () => ({
|
|
13
|
-
callHook: mocks.callHook
|
|
14
|
-
}))
|
|
15
|
-
|
|
16
|
-
vi.mock('@vibe-forge/utils/uuid', () => ({
|
|
17
|
-
uuid: mocks.uuid
|
|
18
|
-
}))
|
|
19
|
-
|
|
20
|
-
vi.mock('#~/sync.js', () => ({
|
|
21
|
-
createChildSession: mocks.createChildSession,
|
|
22
|
-
getParentSessionId: mocks.getParentSessionId
|
|
23
|
-
}))
|
|
24
|
-
|
|
25
|
-
vi.mock('#~/tools/task/manager.js', () => ({
|
|
26
|
-
TaskManager: class {
|
|
27
|
-
startTask = mocks.startTask
|
|
28
|
-
getTask = mocks.getTask
|
|
29
|
-
}
|
|
30
|
-
}))
|
|
31
|
-
|
|
32
|
-
import { createTaskRegister } from '#~/tools/task/index.js'
|
|
33
|
-
|
|
34
|
-
import { createToolTester } from './mcp-test-utils.js'
|
|
35
|
-
|
|
36
|
-
describe('StartTasks hook payload', () => {
|
|
37
|
-
beforeEach(() => {
|
|
38
|
-
vi.clearAllMocks()
|
|
39
|
-
mocks.callHook.mockResolvedValue({ continue: true })
|
|
40
|
-
mocks.getParentSessionId.mockReturnValue(undefined)
|
|
41
|
-
mocks.startTask.mockImplementation(async ({ taskId }: { taskId: string }) => ({ taskId }))
|
|
42
|
-
mocks.getTask.mockImplementation((taskId: string) => ({
|
|
43
|
-
taskId,
|
|
44
|
-
status: 'running',
|
|
45
|
-
logs: []
|
|
46
|
-
}))
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
it('passes resolved task ids to the StartTasks hook before launching child tasks', async () => {
|
|
50
|
-
mocks.uuid
|
|
51
|
-
.mockReturnValueOnce('task-1')
|
|
52
|
-
.mockReturnValueOnce('task-2')
|
|
53
|
-
|
|
54
|
-
const tester = createToolTester()
|
|
55
|
-
createTaskRegister()(tester.mockRegister)
|
|
56
|
-
|
|
57
|
-
await tester.callTool('StartTasks', {
|
|
58
|
-
tasks: [
|
|
59
|
-
{ description: 'first task', type: 'entity', name: 'alpha' },
|
|
60
|
-
{ description: 'second task', type: 'spec', name: 'beta', background: false }
|
|
61
|
-
]
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
expect(mocks.callHook).toHaveBeenCalledWith(
|
|
65
|
-
'StartTasks',
|
|
66
|
-
expect.objectContaining({
|
|
67
|
-
tasks: [
|
|
68
|
-
{
|
|
69
|
-
taskId: 'task-1',
|
|
70
|
-
description: 'first task',
|
|
71
|
-
type: 'entity',
|
|
72
|
-
name: 'alpha'
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
taskId: 'task-2',
|
|
76
|
-
description: 'second task',
|
|
77
|
-
type: 'spec',
|
|
78
|
-
name: 'beta',
|
|
79
|
-
background: false
|
|
80
|
-
}
|
|
81
|
-
]
|
|
82
|
-
})
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
expect(mocks.startTask).toHaveBeenNthCalledWith(
|
|
86
|
-
1,
|
|
87
|
-
expect.objectContaining({ taskId: 'task-1' })
|
|
88
|
-
)
|
|
89
|
-
expect(mocks.startTask).toHaveBeenNthCalledWith(
|
|
90
|
-
2,
|
|
91
|
-
expect.objectContaining({ taskId: 'task-2' })
|
|
92
|
-
)
|
|
93
|
-
})
|
|
94
|
-
})
|