@vibe-forge/workspace-assets 3.2.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.
- package/__tests__/__snapshots__/workspace-assets-rich.snapshot.json +1 -1
- package/__tests__/prompt-builders.spec.ts +30 -3
- package/package.json +4 -4
- package/src/bundle-internal.ts +3 -3
- package/src/configured-skills.ts +5 -1
- package/src/prompt-builders.ts +4 -2
- package/src/skills-cli-dependency.ts +14 -6
- package/src/task-tool-guidance.ts +19 -6
- package/src/workspace-prompt.ts +4 -2
|
@@ -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 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
|
|
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'
|
|
@@ -184,10 +195,10 @@ describe('workspace asset prompt builders', () => {
|
|
|
184
195
|
expect(prompt).toContain('"background":true')
|
|
185
196
|
expect(prompt).toContain('write one `session.start` line per child task')
|
|
186
197
|
expect(prompt).toContain('typed runtime protocol envelopes')
|
|
187
|
-
expect(prompt).toContain('do not treat dedicated
|
|
198
|
+
expect(prompt).toContain('do not treat dedicated agent subcommands as the standard integration surface')
|
|
188
199
|
expect(prompt).toContain('Read the returned `sessionId`')
|
|
189
200
|
expect(prompt).toContain('Ordinary new sessions stay session-scoped')
|
|
190
|
-
expect(prompt).toContain('Do not use MCP task tools,
|
|
201
|
+
expect(prompt).toContain('Do not use MCP task tools, dedicated agent subcommands, legacy StartTasks')
|
|
191
202
|
expect(prompt).toContain('hand-written DB edits')
|
|
192
203
|
expect(prompt).toContain('ad-hoc TS scripts')
|
|
193
204
|
expect(prompt).toContain('server-managed host session')
|
|
@@ -237,6 +248,22 @@ describe('workspace asset prompt builders', () => {
|
|
|
237
248
|
expect(prompt).not.toContain('VibeForge.StartTasks')
|
|
238
249
|
})
|
|
239
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`')
|
|
265
|
+
})
|
|
266
|
+
|
|
240
267
|
it('builds skill route prompts without preloading content', () => {
|
|
241
268
|
const cwd = '/tmp/project'
|
|
242
269
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-forge/workspace-assets",
|
|
3
|
-
"version": "3.2.
|
|
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.2.0",
|
|
33
32
|
"@vibe-forge/definition-core": "3.2.0",
|
|
34
|
-
"@vibe-forge/
|
|
35
|
-
"@vibe-forge/
|
|
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"
|
package/src/bundle-internal.ts
CHANGED
|
@@ -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
|
-
|
|
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 =
|
|
163
|
-
const userHomeBridge =
|
|
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,
|
package/src/configured-skills.ts
CHANGED
|
@@ -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
|
})
|
package/src/prompt-builders.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import type { Definition, Entity, Rule, Skill, Spec } from '@vibe-forge/types'
|
|
8
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
|
|
@@ -168,6 +168,8 @@ export const generateSpecRoutePrompt = (
|
|
|
168
168
|
|
|
169
169
|
export const generateEntitiesRoutePrompt = (entities: Definition<Entity>[]) => {
|
|
170
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
|
-
|
|
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
|
-
) =>
|
|
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
|
|
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
|
|
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
|
|
98
|
+
registry
|
|
91
99
|
})
|
|
92
100
|
: await installSkillsCliSkillToTemp({
|
|
93
|
-
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
|
|
107
|
+
registry,
|
|
100
108
|
skill: resolvedTarget.skill,
|
|
101
109
|
source: resolvedTarget.source,
|
|
102
110
|
version: params.dependency.version
|
|
@@ -1,19 +1,32 @@
|
|
|
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
|
+
|
|
1
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
16
|
'Agent runtime guide:',
|
|
4
|
-
|
|
5
|
-
'- Send typed runtime protocol envelopes such as `session.start`, `session.message`, `session.status`, `session.events`, `session.submit`, and `session.stop`; do not treat dedicated
|
|
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.',
|
|
6
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.',
|
|
7
|
-
'- Do not use MCP task tools,
|
|
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.',
|
|
8
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.',
|
|
9
22
|
'- Copyable JSONL example; write one `session.start` line per child task, and use multiple lines for multiple subtasks:',
|
|
10
23
|
'```bash',
|
|
11
|
-
|
|
24
|
+
`cat <<'JSONL' | ${runtimeProtocolCommand}`,
|
|
12
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}',
|
|
13
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}',
|
|
14
27
|
'JSONL',
|
|
15
28
|
'```',
|
|
16
|
-
'- 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
|
|
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.',
|
|
17
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.',
|
|
18
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.',
|
|
19
32
|
'- Use a follow/read-events workflow when you need to watch progress instead of repeatedly restarting work.',
|
|
@@ -21,7 +34,7 @@ export const buildManagedTaskToolGuidance = () => {
|
|
|
21
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.',
|
|
22
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.',
|
|
23
36
|
'- Use a `session.stop` protocol command for graceful cancellation and set `mode` to `force` only when stop cannot recover the session.',
|
|
24
|
-
'- Compatibility aliases such as
|
|
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.',
|
|
25
38
|
'- When a session is still making progress, use `wait` between checks and inspect status/events instead of starting a replacement session.'
|
|
26
39
|
].join('\n')
|
|
27
40
|
}
|
package/src/workspace-prompt.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WorkspaceDefinitionPayload } from '@vibe-forge/types'
|
|
2
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,
|
|
@@ -9,6 +9,8 @@ export const generateWorkspaceRoutePrompt = (
|
|
|
9
9
|
) => {
|
|
10
10
|
if (workspaces.length === 0) return ''
|
|
11
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
|
-
|
|
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'
|