@vibe-forge/workspace-assets 3.1.0 → 3.2.1

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.
@@ -467,7 +467,7 @@
467
467
  ]
468
468
  },
469
469
  "options": {
470
- "systemPrompt": "<system-prompt>\nThe project system rules are:\n# review\n\n> 必须检查发布改动的回归风险。\n\n# demo/security\n\n> Use when: 插件安全规则\n> Rule file path: node_modules/@vibe-forge/plugin-demo/rules/security.md\n> Only read this rule file when the task matches the scenario above.\n</system-prompt>\n\n\n<system-prompt>\nThe following skill modules are loaded for the project:\n# research\n\n> Skill description: 检索资料\n> Skill file path: .ai/skills/research/SKILL.md\n> Resolve relative paths in the resource content relative to the directory containing this skill file.\n\n<skill-content>\n先阅读 README.md,再补充结论。\n</skill-content>\n</system-prompt>\n\n\n<system-prompt>\nThe project includes the following entities:\n - architect: 负责拆解方案的实体\n\nWhen solving user problems, you may specify entities through `VibeForge.StartTasks` as needed and have them coordinate multiple entity types to complete the work; use `VibeForge.GetTaskInfo` and `wait` to track progress.\nTask tool guide:\n- Use `VibeForge.StartTasks` to start a new child task when the work should run in a separate entity or workspace, or when it needs to continue independently from the current turn.\n- After starting a task, use `VibeForge.GetTaskInfo` with `{ taskId }` to inspect one task. It is also the right tool when a task seems stalled, failed, or might be waiting for input.\n- By default, `GetTaskInfo` returns the 10 most recent log entries in descending order, so newer entries appear earlier in the `logs` array. Pass `logLimit` to inspect a different number of recent logs, and set `logOrder` to `\"asc\"` when you want the selected log window in oldest-to-newest order.\n- Use `VibeForge.ListTasks` with the same `logLimit` and `logOrder` fields when you need to find a taskId or inspect multiple tasks at once.\n- Use `VibeForge.SendTaskMessage` with `{ taskId, message }` when you need to give a task another instruction. Running tasks continue immediately; completed or failed tasks resume the same conversation instead of forcing a replacement task.\n- Use `VibeForge.SubmitTaskInput` only when `VibeForge.GetTaskInfo` or `VibeForge.ListTasks` shows `pendingInput` or `pendingInteraction`, or the task status is `waiting_input`. Do not use it for ordinary follow-up instructions.\n- If a task is `completed` or `failed` but you want to keep working in that same thread of execution, prefer `VibeForge.SendTaskMessage` to resume it. Start a new task only when you actually want a replacement task.\n- When a task is still making progress, use `wait` between checks instead of repeatedly restarting it.\n</system-prompt>\n\n\n<system-prompt>\nYou are a professional project execution manager who can skillfully direct other entities to work toward your goal. Expectations:\n\n- Never complete code development work alone\n- You must coordinate other developers to complete tasks\n- You must keep them aligned with the goal and verify that their completion reports meet the requirements\n\nChoose the appropriate workflow based on the user's needs and the actual development goal, and use the workflow identifier to locate and load the corresponding definition.\n- Pass the identifier based on the actual need. This is not a path; use the standard workflow loading capability to resolve it.\n- Decide how to pass parameters based on their descriptions and actual usage scenarios.\nThe project includes the following workflows:\n- Workflow name: release\n - Description: 正式发布流程\n - Identifier: release\n - Parameters:\n - None\n\n- Workflow name: demo/release\n - Description: 插件发布流程\n - Identifier: demo/release\n - Parameters:\n - None\n\n</system-prompt>\n\n\n执行正式发布,并整理变更摘要。",
470
+ "systemPrompt": "<system-prompt>\nThe project system rules are:\n# review\n\n> 必须检查发布改动的回归风险。\n\n# demo/security\n\n> Use when: 插件安全规则\n> Rule file path: node_modules/@vibe-forge/plugin-demo/rules/security.md\n> Only read this rule file when the task matches the scenario above.\n</system-prompt>\n\n\n<system-prompt>\nThe following skill modules are loaded for the project:\n# research\n\n> Skill description: 检索资料\n> Skill file path: .ai/skills/research/SKILL.md\n> Resolve relative paths in the resource content relative to the directory containing this skill file.\n\n<skill-content>\n先阅读 README.md,再补充结论。\n</skill-content>\n</system-prompt>\n\n\n<system-prompt>\nThe project includes the following entities:\n - architect: 负责拆解方案的实体\n\nWhen solving user problems, you may start child runtime sessions with `vf run --input-format stream-json --output-format stream-json` and a `session.start` protocol envelope as needed; use `session.status`, `session.events`, and `wait` to track progress.\nAgent runtime guide:\n- Use unified CLI protocol mode, `vf run --input-format stream-json --output-format stream-json`, to start a child runtime session when the work should run in a separate entity or continue independently from the current turn.\n- Send typed runtime protocol envelopes such as `session.start`, `session.message`, `session.status`, `session.events`, `session.submit`, and `session.stop`; do not treat dedicated agent subcommands as the standard integration surface.\n- Ordinary new sessions stay session-scoped. A room is created or discovered only when a unified CLI runtime protocol start command launches a child runtime session from a server-managed host session and the server projects runtime store metadata/events.\n- Do not use MCP task tools, dedicated agent subcommands, legacy StartTasks, hand-written DB edits, or ad-hoc TS scripts as the task consumer surface. Use CLI protocol mode and the runtime protocol/store for start, status, events, follow-up messages, input submission, and cancellation.\n- Server-managed host sessions inject the current adapter, model, effort, and permission mode as runtime protocol defaults. Omit these fields to inherit the host selection, or set them explicitly only when a child task must use a different runtime profile.\n- Copyable JSONL example; write one `session.start` line per child task, and use multiple lines for multiple subtasks:\n```bash\ncat <<'JSONL' | vf run --input-format stream-json --output-format stream-json\n{\"commandId\":\"start-planner\",\"type\":\"session.start\",\"payload\":{\"title\":\"Plan Agent Room UI fix\",\"message\":\"Plan the frontend changes and tests for the Agent Room UI fix.\",\"entity\":\"dev-planner\",\"background\":true},\"title\":\"Plan Agent Room UI fix\",\"message\":\"Plan the frontend changes and tests for the Agent Room UI fix.\",\"entity\":\"dev-planner\",\"background\":true}\n{\"commandId\":\"start-reviewer\",\"type\":\"session.start\",\"payload\":{\"title\":\"Review Agent Room UI fix\",\"message\":\"Review the implemented Agent Room UI fix for regressions and missing tests.\",\"entity\":\"dev-reviewer\",\"background\":true},\"title\":\"Review Agent Room UI fix\",\"message\":\"Review the implemented Agent Room UI fix for regressions and missing tests.\",\"entity\":\"dev-reviewer\",\"background\":true}\nJSONL\n```\n- Keep `payload.title`, `payload.message`, `payload.entity`, and `payload.background: true` explicit in each start envelope. The mirrored top-level fields make the JSONL executable by the current runtime protocol reader.\n- Include a short `title` when the task prompt is long; it becomes the child session title and room run label. Put any room or workspace context in the title and initial message.\n- Read the returned `sessionId` and use it for follow-up protocol commands. Read the latest runtime snapshot from the runtime store or a `session.status` protocol command, and read progress from runtime events or a `session.events` protocol command.\n- Use a follow/read-events workflow when you need to watch progress instead of repeatedly restarting work.\n- Use a `session.message` protocol command to give an existing session another instruction. Running sessions continue immediately; completed or failed sessions resume the same conversation when the runtime allows resume.\n- When the chat UI sends a `[ROOM_TASK_MESSAGE] ... [/ROOM_TASK_MESSAGE]` block, treat it as a runtime relay envelope instead of ordinary prose. Parse the `sessionId` or legacy `taskId`, `message`, and optional `mode` / `request` fields. If the envelope indicates `mode: interaction`, or runtime status shows `waiting_input` / pending input, use a `session.submit` protocol command. Otherwise use `session.message`. Do not reply inline instead of routing the relay.\n- Use `session.submit` only when a runtime session is waiting for an explicit input or approval request. Do not use it for ordinary follow-up instructions.\n- Use a `session.stop` protocol command for graceful cancellation and set `mode` to `force` only when stop cannot recover the session.\n- Compatibility aliases such as dedicated agent start/status/events/send/submit/stop subcommands may exist for debugging or legacy scripts, but they are not the primary guidance for new agent workflows.\n- When a session is still making progress, use `wait` between checks and inspect status/events instead of starting a replacement session.\n</system-prompt>\n\n\n<system-prompt>\nYou are a professional project execution manager who can skillfully direct other entities to work toward your goal. Expectations:\n\n- Never complete code development work alone\n- You must coordinate other developers to complete tasks\n- You must keep them aligned with the goal and verify that their completion reports meet the requirements\n\nChoose the appropriate workflow based on the user's needs and the actual development goal, and use the workflow identifier to locate and load the corresponding definition.\n- Pass the identifier based on the actual need. This is not a path; use the standard workflow loading capability to resolve it.\n- Decide how to pass parameters based on their descriptions and actual usage scenarios.\nThe project includes the following workflows:\n- Workflow name: release\n - Description: 正式发布流程\n - Identifier: release\n - Parameters:\n - None\n\n- Workflow name: demo/release\n - Description: 插件发布流程\n - Identifier: demo/release\n - Parameters:\n - None\n\n</system-prompt>\n\n\n执行正式发布,并整理变更摘要。",
471
471
  "tools": {
472
472
  "include": [
473
473
  "Edit",
@@ -1,6 +1,7 @@
1
1
  import { join } from 'node:path'
2
+ import process from 'node:process'
2
3
 
3
- import { describe, expect, it } from 'vitest'
4
+ import { afterEach, describe, expect, it } from 'vitest'
4
5
 
5
6
  import {
6
7
  generateEntitiesRoutePrompt,
@@ -11,6 +12,16 @@ import {
11
12
  } from '#~/prompt-builders.js'
12
13
  import { generateWorkspaceRoutePrompt } from '#~/workspace-prompt.js'
13
14
 
15
+ const originalCliResumeCommandPrefix = process.env.__VF_CLI_RESUME_COMMAND_PREFIX__
16
+
17
+ afterEach(() => {
18
+ if (originalCliResumeCommandPrefix == null) {
19
+ delete process.env.__VF_CLI_RESUME_COMMAND_PREFIX__
20
+ } else {
21
+ process.env.__VF_CLI_RESUME_COMMAND_PREFIX__ = originalCliResumeCommandPrefix
22
+ }
23
+ })
24
+
14
25
  describe('workspace asset prompt builders', () => {
15
26
  it('builds skill prompts with stable names, descriptions, and relative paths', () => {
16
27
  const cwd = '/tmp/project'
@@ -174,20 +185,35 @@ describe('workspace asset prompt builders', () => {
174
185
  ])
175
186
 
176
187
  expect(prompt).toContain('reviewer: 负责代码审查')
177
- expect(prompt).toContain('`VibeForge.StartTasks`')
178
- expect(prompt).toContain('`VibeForge.GetTaskInfo`')
179
- expect(prompt).toContain('Task tool guide:')
180
- expect(prompt).toContain('After starting a task')
181
- expect(prompt).toContain('10 most recent log entries')
182
- expect(prompt).toContain('`logLimit`')
183
- expect(prompt).toContain('`logOrder`')
184
- expect(prompt).toContain('`VibeForge.SendTaskMessage`')
185
- expect(prompt).toContain('`{ taskId, message }`')
186
- expect(prompt).toContain('`VibeForge.SubmitTaskInput`')
188
+ expect(prompt).toContain('Agent runtime guide:')
189
+ expect(prompt).toContain('`vf run --input-format stream-json --output-format stream-json`')
190
+ expect(prompt).toContain("cat <<'JSONL' | vf run --input-format stream-json --output-format stream-json")
191
+ expect(prompt).toContain('"commandId":"start-planner"')
192
+ expect(prompt).toContain('"type":"session.start"')
193
+ expect(prompt).toContain('"payload":{"title":"Plan Agent Room UI fix"')
194
+ expect(prompt).toContain('"entity":"dev-planner"')
195
+ expect(prompt).toContain('"background":true')
196
+ expect(prompt).toContain('write one `session.start` line per child task')
197
+ expect(prompt).toContain('typed runtime protocol envelopes')
198
+ expect(prompt).toContain('do not treat dedicated agent subcommands as the standard integration surface')
199
+ expect(prompt).toContain('Read the returned `sessionId`')
200
+ expect(prompt).toContain('Ordinary new sessions stay session-scoped')
201
+ expect(prompt).toContain('Do not use MCP task tools, dedicated agent subcommands, legacy StartTasks')
202
+ expect(prompt).toContain('hand-written DB edits')
203
+ expect(prompt).toContain('ad-hoc TS scripts')
204
+ expect(prompt).toContain('server-managed host session')
205
+ expect(prompt).toContain('server projects runtime store metadata/events')
206
+ expect(prompt).toContain('`session.status` protocol command')
207
+ expect(prompt).toContain('`session.events` protocol command')
208
+ expect(prompt).toContain('`session.message` protocol command')
209
+ expect(prompt).toContain('[ROOM_TASK_MESSAGE]')
210
+ expect(prompt).toContain('`mode: interaction`')
211
+ expect(prompt).toContain('`waiting_input`')
212
+ expect(prompt).toContain('`session.submit` protocol command')
187
213
  expect(prompt).toContain('Do not use it for ordinary follow-up instructions')
188
- expect(prompt).toContain('completed or failed tasks resume the same conversation')
189
- expect(prompt).toContain('keep working in that same thread of execution')
214
+ expect(prompt).toContain('completed or failed sessions resume the same conversation')
190
215
  expect(prompt).toContain('`wait`')
216
+ expect(prompt).not.toContain('VibeForge.StartTasks')
191
217
  expect(prompt).not.toContain('run-tasks')
192
218
  expect(prompt).not.toContain('需要关注变更风险')
193
219
  expect(prompt).not.toContain('hidden')
@@ -207,14 +233,35 @@ describe('workspace asset prompt builders', () => {
207
233
 
208
234
  expect(prompt).toContain('The project includes the following registered workspaces')
209
235
  expect(prompt).toContain('Identifier: billing')
210
- expect(prompt).toContain('`VibeForge.StartTasks`')
211
- expect(prompt).toContain('type: "workspace"')
212
- expect(prompt).toContain('Task tool guide:')
213
- expect(prompt).toContain('`VibeForge.GetTaskInfo`')
214
- expect(prompt).toContain('`VibeForge.ListTasks`')
215
- expect(prompt).toContain('`VibeForge.SendTaskMessage`')
216
- expect(prompt).toContain('`VibeForge.SubmitTaskInput`')
236
+ expect(prompt).toContain('workspace identifier and path')
237
+ expect(prompt).toContain('Agent runtime guide:')
238
+ expect(prompt).toContain('`vf run --input-format stream-json --output-format stream-json`')
239
+ expect(prompt).toContain('"payload":{"title":"Plan Agent Room UI fix"')
240
+ expect(prompt).toContain('"payload":{"title":"Review Agent Room UI fix"')
241
+ expect(prompt).toContain('payload.background: true')
242
+ expect(prompt).toContain('multiple subtasks')
243
+ expect(prompt).toContain('`session.status` protocol command')
244
+ expect(prompt).toContain('`session.events` protocol command')
245
+ expect(prompt).toContain('`session.message` protocol command')
246
+ expect(prompt).toContain('`session.submit`')
217
247
  expect(prompt).toContain('Do not directly edit files inside a registered workspace')
248
+ expect(prompt).not.toContain('VibeForge.StartTasks')
249
+ })
250
+
251
+ it('uses forwarded cli names in managed task guidance', () => {
252
+ process.env.__VF_CLI_RESUME_COMMAND_PREFIX__ = 'dyai'
253
+
254
+ const prompt = generateEntitiesRoutePrompt([
255
+ {
256
+ path: '/tmp/project/.ai/entities/reviewer/README.md',
257
+ body: '负责代码审查',
258
+ attributes: {}
259
+ }
260
+ ])
261
+
262
+ expect(prompt).toContain('`dyai run --input-format stream-json --output-format stream-json`')
263
+ expect(prompt).toContain("cat <<'JSONL' | dyai run --input-format stream-json --output-format stream-json")
264
+ expect(prompt).not.toContain('`vf run --input-format stream-json --output-format stream-json`')
218
265
  })
219
266
 
220
267
  it('builds skill route prompts without preloading content', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-forge/workspace-assets",
3
- "version": "3.1.0",
3
+ "version": "3.2.1",
4
4
  "description": "Workspace asset resolution and adapter asset planning for Vibe Forge",
5
5
  "imports": {
6
6
  "#~/*.js": {
@@ -29,10 +29,10 @@
29
29
  "fast-glob": "^3.3.3",
30
30
  "front-matter": "^4.0.2",
31
31
  "js-yaml": "^4.1.1",
32
- "@vibe-forge/types": "3.1.0",
33
- "@vibe-forge/config": "3.1.0",
34
- "@vibe-forge/utils": "3.1.0",
35
- "@vibe-forge/definition-core": "3.1.0"
32
+ "@vibe-forge/definition-core": "3.2.0",
33
+ "@vibe-forge/config": "3.2.2",
34
+ "@vibe-forge/types": "3.2.2",
35
+ "@vibe-forge/utils": "3.2.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/js-yaml": "^4.0.9"
@@ -10,7 +10,7 @@ import {
10
10
  } from '@vibe-forge/config'
11
11
  import type { Config, Definition, Entity, PluginConfig, WorkspaceAsset, WorkspaceAssetKind } from '@vibe-forge/types'
12
12
  import {
13
- isLegacySkillsConfig,
13
+ isObjectSkillsConfig,
14
14
  resolveProjectAiBaseDir,
15
15
  resolveProjectAiEntitiesDir,
16
16
  resolveRelativePath
@@ -159,8 +159,8 @@ const warnInvalidHomeSkillRoot = (root: string) => {
159
159
 
160
160
  const resolveHomeBridgeConfig = (configs: [Config?, Config?]) => {
161
161
  const [config, userConfig] = configs
162
- const projectHomeBridge = isLegacySkillsConfig(config?.skills) ? config.skills.homeBridge : undefined
163
- const userHomeBridge = isLegacySkillsConfig(userConfig?.skills) ? userConfig.skills.homeBridge : undefined
162
+ const projectHomeBridge = isObjectSkillsConfig(config?.skills) ? config.skills.homeBridge : undefined
163
+ const userHomeBridge = isObjectSkillsConfig(userConfig?.skills) ? userConfig.skills.homeBridge : undefined
164
164
 
165
165
  return {
166
166
  enabled: userHomeBridge?.enabled ?? projectHomeBridge?.enabled ?? true,
@@ -6,7 +6,8 @@ import {
6
6
  installProjectSkill,
7
7
  normalizeProjectSkillInstall,
8
8
  resolveConfiguredSkillInstalls as resolveDeclaredConfiguredSkillInstalls,
9
- resolveProjectAiPath
9
+ resolveProjectAiPath,
10
+ resolveSkillsRegistry
10
11
  } from '@vibe-forge/utils'
11
12
  import type { NormalizedProjectSkillInstall } from '@vibe-forge/utils'
12
13
 
@@ -47,6 +48,8 @@ export const ensureConfiguredProjectSkills = async (params: {
47
48
  updateInstalledSkills?: boolean
48
49
  workspaceFolder: string
49
50
  }) => {
51
+ const defaultRegistry = resolveSkillsRegistry(params.configs[1]?.skills) ??
52
+ resolveSkillsRegistry(params.configs[0]?.skills)
50
53
  const installs = resolveConfiguredSkillInstalls(params.configs)
51
54
  if (installs.length === 0) {
52
55
  return []
@@ -75,6 +78,7 @@ export const ensureConfiguredProjectSkills = async (params: {
75
78
  ensured.push(
76
79
  await installProjectSkill({
77
80
  force: true,
81
+ registry: defaultRegistry,
78
82
  skill,
79
83
  workspaceFolder: params.workspaceFolder
80
84
  })
@@ -5,9 +5,9 @@ import {
5
5
  resolveSpecIdentifier
6
6
  } from '@vibe-forge/definition-core'
7
7
  import type { Definition, Entity, Rule, Skill, Spec } from '@vibe-forge/types'
8
- import { CANONICAL_VIBE_FORGE_MCP_SERVER_NAME, resolvePromptPath } from '@vibe-forge/utils'
8
+ import { resolvePromptPath } from '@vibe-forge/utils'
9
9
 
10
- import { buildManagedTaskToolGuidance } from './task-tool-guidance'
10
+ import { buildManagedTaskToolGuidance, resolveRuntimeProtocolCliCommand } from './task-tool-guidance'
11
11
 
12
12
  const toMarkdownBlockquote = (content: string) => (
13
13
  content
@@ -167,7 +167,9 @@ export const generateSpecRoutePrompt = (
167
167
  }
168
168
 
169
169
  export const generateEntitiesRoutePrompt = (entities: Definition<Entity>[]) => {
170
- const taskToolGuidance = buildManagedTaskToolGuidance(CANONICAL_VIBE_FORGE_MCP_SERVER_NAME)
170
+ const taskToolGuidance = buildManagedTaskToolGuidance()
171
+ const runtimeProtocolCommand =
172
+ `${resolveRuntimeProtocolCliCommand()} --input-format stream-json --output-format stream-json`
171
173
  return (
172
174
  '<system-prompt>\n' +
173
175
  'The project includes the following entities:\n' +
@@ -181,7 +183,7 @@ export const generateEntitiesRoutePrompt = (entities: Definition<Entity>[]) => {
181
183
  })
182
184
  .join('')
183
185
  }\n` +
184
- `When solving user problems, you may specify entities through \`${CANONICAL_VIBE_FORGE_MCP_SERVER_NAME}.StartTasks\` as needed and have them coordinate multiple entity types to complete the work; use \`${CANONICAL_VIBE_FORGE_MCP_SERVER_NAME}.GetTaskInfo\` and \`wait\` to track progress.\n` +
186
+ `When solving user problems, you may start child runtime sessions with \`${runtimeProtocolCommand}\` and a \`session.start\` protocol envelope as needed; use \`session.status\`, \`session.events\`, and \`wait\` to track progress.\n` +
185
187
  `${taskToolGuidance}\n` +
186
188
  '</system-prompt>\n'
187
189
  )
@@ -3,6 +3,7 @@ import { resolve } from 'node:path'
3
3
  import process from 'node:process'
4
4
 
5
5
  import type { Config } from '@vibe-forge/types'
6
+ import { isObjectSkillsConfig, resolveSkillsRegistry } from '@vibe-forge/utils'
6
7
  import { findSkillsCli, installSkillsCliRefToTemp, installSkillsCliSkillToTemp } from '@vibe-forge/utils/skills-cli'
7
8
 
8
9
  import type { NormalizedSkillDependency } from './skill-dependencies'
@@ -17,7 +18,11 @@ import {
17
18
  const resolveAutoDownloadDependenciesEnabled = (
18
19
  projectConfig: Config | undefined,
19
20
  userConfig: Config | undefined
20
- ) => userConfig?.skills?.autoDownloadDependencies ?? projectConfig?.skills?.autoDownloadDependencies ?? true
21
+ ) => (
22
+ (isObjectSkillsConfig(userConfig?.skills) ? userConfig.skills.autoDownloadDependencies : undefined) ??
23
+ (isObjectSkillsConfig(projectConfig?.skills) ? projectConfig.skills.autoDownloadDependencies : undefined) ??
24
+ true
25
+ )
21
26
 
22
27
  export const installSkillsCliDependency = async (params: {
23
28
  cwd: string
@@ -26,6 +31,9 @@ export const installSkillsCliDependency = async (params: {
26
31
  }) => {
27
32
  const [projectConfig, userConfig] = params.configs
28
33
  const autoDownloadDependenciesEnabled = resolveAutoDownloadDependenciesEnabled(projectConfig, userConfig)
34
+ const defaultRegistry = resolveSkillsRegistry(params.configs[1]?.skills) ??
35
+ resolveSkillsRegistry(params.configs[0]?.skills)
36
+ const registry = params.dependency.registry ?? defaultRegistry
29
37
  const resolvedTarget = await (async () => {
30
38
  if (params.dependency.source != null) {
31
39
  return {
@@ -42,7 +50,7 @@ export const installSkillsCliDependency = async (params: {
42
50
 
43
51
  return await (async () => {
44
52
  const searchResults = await findSkillsCli({
45
- registry: params.dependency.registry,
53
+ registry,
46
54
  query: params.dependency.name
47
55
  })
48
56
  const selected = pickSearchResult(searchResults, params.dependency.name)
@@ -60,7 +68,7 @@ export const installSkillsCliDependency = async (params: {
60
68
 
61
69
  const installDir = buildInstallDir({
62
70
  cwd: params.cwd,
63
- registry: params.dependency.registry,
71
+ registry,
64
72
  skill: resolvedTarget.skill,
65
73
  source: resolvedTarget.source,
66
74
  version: params.dependency.version
@@ -87,16 +95,16 @@ export const installSkillsCliDependency = async (params: {
87
95
  ? params.dependency.version == null
88
96
  ? await installSkillsCliRefToTemp({
89
97
  installRef: resolvedTarget.installRef,
90
- registry: params.dependency.registry
98
+ registry
91
99
  })
92
100
  : await installSkillsCliSkillToTemp({
93
- registry: params.dependency.registry,
101
+ registry,
94
102
  skill: resolvedTarget.skill,
95
103
  source: resolvedTarget.source,
96
104
  version: params.dependency.version
97
105
  })
98
106
  : await installSkillsCliSkillToTemp({
99
- registry: params.dependency.registry,
107
+ registry,
100
108
  skill: resolvedTarget.skill,
101
109
  source: resolvedTarget.source,
102
110
  version: params.dependency.version
@@ -1,13 +1,40 @@
1
- export const buildManagedTaskToolGuidance = (serverName: string) => {
1
+ import process from 'node:process'
2
+
3
+ export const resolveRuntimeProtocolCliCommand = (env: NodeJS.ProcessEnv = process.env) => {
4
+ const prefix = env.__VF_CLI_RESUME_COMMAND_PREFIX__?.trim()
5
+ if (prefix == null || prefix === '') {
6
+ return 'vf run'
7
+ }
8
+ return prefix.split(/\s+/).at(-1) === 'run' ? prefix : `${prefix} run`
9
+ }
10
+
11
+ export const buildManagedTaskToolGuidance = () => {
12
+ const runtimeCliCommand = resolveRuntimeProtocolCliCommand()
13
+ const runtimeProtocolCommand = `${runtimeCliCommand} --input-format stream-json --output-format stream-json`
14
+
2
15
  return [
3
- 'Task tool guide:',
4
- `- Use \`${serverName}.StartTasks\` to start a new child task when the work should run in a separate entity or workspace, or when it needs to continue independently from the current turn.`,
5
- `- After starting a task, use \`${serverName}.GetTaskInfo\` with \`{ taskId }\` to inspect one task. It is also the right tool when a task seems stalled, failed, or might be waiting for input.`,
6
- '- By default, `GetTaskInfo` returns the 10 most recent log entries in descending order, so newer entries appear earlier in the `logs` array. Pass `logLimit` to inspect a different number of recent logs, and set `logOrder` to `"asc"` when you want the selected log window in oldest-to-newest order.',
7
- `- Use \`${serverName}.ListTasks\` with the same \`logLimit\` and \`logOrder\` fields when you need to find a taskId or inspect multiple tasks at once.`,
8
- `- Use \`${serverName}.SendTaskMessage\` with \`{ taskId, message }\` when you need to give a task another instruction. Running tasks continue immediately; completed or failed tasks resume the same conversation instead of forcing a replacement task.`,
9
- `- Use \`${serverName}.SubmitTaskInput\` only when \`${serverName}.GetTaskInfo\` or \`${serverName}.ListTasks\` shows \`pendingInput\` or \`pendingInteraction\`, or the task status is \`waiting_input\`. Do not use it for ordinary follow-up instructions.`,
10
- `- If a task is \`completed\` or \`failed\` but you want to keep working in that same thread of execution, prefer \`${serverName}.SendTaskMessage\` to resume it. Start a new task only when you actually want a replacement task.`,
11
- '- When a task is still making progress, use `wait` between checks instead of repeatedly restarting it.'
16
+ 'Agent runtime guide:',
17
+ `- Use unified CLI protocol mode, \`${runtimeProtocolCommand}\`, to start a child runtime session when the work should run in a separate entity or continue independently from the current turn.`,
18
+ '- Send typed runtime protocol envelopes such as `session.start`, `session.message`, `session.status`, `session.events`, `session.submit`, and `session.stop`; do not treat dedicated agent subcommands as the standard integration surface.',
19
+ '- Ordinary new sessions stay session-scoped. A room is created or discovered only when a unified CLI runtime protocol start command launches a child runtime session from a server-managed host session and the server projects runtime store metadata/events.',
20
+ '- Do not use MCP task tools, dedicated agent subcommands, legacy StartTasks, hand-written DB edits, or ad-hoc TS scripts as the task consumer surface. Use CLI protocol mode and the runtime protocol/store for start, status, events, follow-up messages, input submission, and cancellation.',
21
+ '- Server-managed host sessions inject the current adapter, model, effort, and permission mode as runtime protocol defaults. Omit these fields to inherit the host selection, or set them explicitly only when a child task must use a different runtime profile.',
22
+ '- Copyable JSONL example; write one `session.start` line per child task, and use multiple lines for multiple subtasks:',
23
+ '```bash',
24
+ `cat <<'JSONL' | ${runtimeProtocolCommand}`,
25
+ '{"commandId":"start-planner","type":"session.start","payload":{"title":"Plan Agent Room UI fix","message":"Plan the frontend changes and tests for the Agent Room UI fix.","entity":"dev-planner","background":true},"title":"Plan Agent Room UI fix","message":"Plan the frontend changes and tests for the Agent Room UI fix.","entity":"dev-planner","background":true}',
26
+ '{"commandId":"start-reviewer","type":"session.start","payload":{"title":"Review Agent Room UI fix","message":"Review the implemented Agent Room UI fix for regressions and missing tests.","entity":"dev-reviewer","background":true},"title":"Review Agent Room UI fix","message":"Review the implemented Agent Room UI fix for regressions and missing tests.","entity":"dev-reviewer","background":true}',
27
+ 'JSONL',
28
+ '```',
29
+ '- Keep `payload.title`, `payload.message`, `payload.entity`, and `payload.background: true` explicit in each start envelope. The mirrored top-level fields make the JSONL executable by the current runtime protocol reader.',
30
+ '- Include a short `title` when the task prompt is long; it becomes the child session title and room run label. Put any room or workspace context in the title and initial message.',
31
+ '- Read the returned `sessionId` and use it for follow-up protocol commands. Read the latest runtime snapshot from the runtime store or a `session.status` protocol command, and read progress from runtime events or a `session.events` protocol command.',
32
+ '- Use a follow/read-events workflow when you need to watch progress instead of repeatedly restarting work.',
33
+ '- Use a `session.message` protocol command to give an existing session another instruction. Running sessions continue immediately; completed or failed sessions resume the same conversation when the runtime allows resume.',
34
+ '- When the chat UI sends a `[ROOM_TASK_MESSAGE] ... [/ROOM_TASK_MESSAGE]` block, treat it as a runtime relay envelope instead of ordinary prose. Parse the `sessionId` or legacy `taskId`, `message`, and optional `mode` / `request` fields. If the envelope indicates `mode: interaction`, or runtime status shows `waiting_input` / pending input, use a `session.submit` protocol command. Otherwise use `session.message`. Do not reply inline instead of routing the relay.',
35
+ '- Use `session.submit` only when a runtime session is waiting for an explicit input or approval request. Do not use it for ordinary follow-up instructions.',
36
+ '- Use a `session.stop` protocol command for graceful cancellation and set `mode` to `force` only when stop cannot recover the session.',
37
+ '- Compatibility aliases such as dedicated agent start/status/events/send/submit/stop subcommands may exist for debugging or legacy scripts, but they are not the primary guidance for new agent workflows.',
38
+ '- When a session is still making progress, use `wait` between checks and inspect status/events instead of starting a replacement session.'
12
39
  ].join('\n')
13
40
  }
@@ -1,14 +1,16 @@
1
1
  import type { WorkspaceDefinitionPayload } from '@vibe-forge/types'
2
- import { CANONICAL_VIBE_FORGE_MCP_SERVER_NAME, resolvePromptPath } from '@vibe-forge/utils'
2
+ import { resolvePromptPath } from '@vibe-forge/utils'
3
3
 
4
- import { buildManagedTaskToolGuidance } from './task-tool-guidance'
4
+ import { buildManagedTaskToolGuidance, resolveRuntimeProtocolCliCommand } from './task-tool-guidance'
5
5
 
6
6
  export const generateWorkspaceRoutePrompt = (
7
7
  cwd: string,
8
8
  workspaces: WorkspaceDefinitionPayload[]
9
9
  ) => {
10
10
  if (workspaces.length === 0) return ''
11
- const taskToolGuidance = buildManagedTaskToolGuidance(CANONICAL_VIBE_FORGE_MCP_SERVER_NAME)
11
+ const taskToolGuidance = buildManagedTaskToolGuidance()
12
+ const runtimeProtocolCommand =
13
+ `${resolveRuntimeProtocolCliCommand()} --input-format stream-json --output-format stream-json`
12
14
 
13
15
  const workspaceList = workspaces
14
16
  .map((workspace) => {
@@ -25,7 +27,7 @@ export const generateWorkspaceRoutePrompt = (
25
27
  '<system-prompt>\n' +
26
28
  'The project includes the following registered workspaces:\n' +
27
29
  `${workspaceList}\n` +
28
- `When a user request targets one of these workspaces, start a child task with \`${CANONICAL_VIBE_FORGE_MCP_SERVER_NAME}.StartTasks\` using \`type: "workspace"\` and \`name\` set to the workspace identifier. ` +
30
+ `When a user request targets one of these workspaces, start a child runtime session with \`${runtimeProtocolCommand}\` and a \`session.start\` envelope; include the workspace identifier and path in the title and message. ` +
29
31
  'Do not directly edit files inside a registered workspace from the current session unless the user explicitly asks this session to work in that directory.\n' +
30
32
  `${taskToolGuidance}\n` +
31
33
  '</system-prompt>\n'