@vibe-forge/core 0.7.5 → 0.8.3

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.
Files changed (43) hide show
  1. package/package.json +4 -46
  2. package/src/env.ts +5 -25
  3. package/src/index.ts +0 -5
  4. package/src/types.ts +13 -72
  5. package/src/ws.ts +2 -12
  6. package/src/adapter/index.ts +0 -6
  7. package/src/adapter/loader.ts +0 -11
  8. package/src/adapter/type.ts +0 -117
  9. package/src/config/load.ts +0 -122
  10. package/src/config/types.ts +0 -289
  11. package/src/config.ts +0 -2
  12. package/src/controllers/benchmark/discover.ts +0 -89
  13. package/src/controllers/benchmark/index.ts +0 -24
  14. package/src/controllers/benchmark/result-store.ts +0 -46
  15. package/src/controllers/benchmark/runner.ts +0 -415
  16. package/src/controllers/benchmark/schema.ts +0 -60
  17. package/src/controllers/benchmark/types.ts +0 -80
  18. package/src/controllers/benchmark/utils.ts +0 -144
  19. package/src/controllers/benchmark/workspace.ts +0 -179
  20. package/src/controllers/config/index.ts +0 -214
  21. package/src/controllers/system/assets/completed.mp3 +0 -0
  22. package/src/controllers/system/assets/mcp.png +0 -0
  23. package/src/controllers/system/index.ts +0 -102
  24. package/src/controllers/task/generate-adapter-query-options.ts +0 -25
  25. package/src/controllers/task/index.ts +0 -2
  26. package/src/controllers/task/prepare.ts +0 -74
  27. package/src/controllers/task/run.ts +0 -231
  28. package/src/controllers/task/schema.ts +0 -131
  29. package/src/controllers/task/type.ts +0 -6
  30. package/src/hooks/bridge.ts +0 -368
  31. package/src/hooks/call.ts +0 -74
  32. package/src/hooks/index.ts +0 -41
  33. package/src/hooks/loader.ts +0 -79
  34. package/src/hooks/native.ts +0 -116
  35. package/src/hooks/runtime.ts +0 -139
  36. package/src/hooks/type.ts +0 -145
  37. package/src/utils/cache.ts +0 -58
  38. package/src/utils/create-logger.ts +0 -89
  39. package/src/utils/definition-loader.ts +0 -530
  40. package/src/utils/filter.ts +0 -26
  41. package/src/utils/string-transform.ts +0 -37
  42. package/src/utils/uuid.ts +0 -6
  43. package/src/utils/workspace-assets.ts +0 -919
@@ -1,289 +0,0 @@
1
- import type { ChannelConfig } from '../channel'
2
- import type { PluginConfig } from '../hooks'
3
-
4
- export interface AdapterMap {}
5
-
6
- export interface AdapterBuiltinModel {
7
- value: string
8
- title: string
9
- description: string
10
- }
11
-
12
- export interface ModelServiceConfig {
13
- /**
14
- * 模型服务展示标题
15
- */
16
- title?: string
17
- /**
18
- * 模型服务展示描述
19
- */
20
- description?: string
21
- /**
22
- * 模型服务 API 基础 URL
23
- */
24
- apiBaseUrl: string
25
- /**
26
- * 模型服务 API 密钥
27
- */
28
- apiKey: string
29
- /**
30
- * 模型服务支持的模型列表
31
- */
32
- models?: string[]
33
- /**
34
- * 模型服务支持的模型别名
35
- */
36
- modelsAlias?: Record<string, string[]>
37
- /**
38
- * 模型服务超时(毫秒)。
39
- * - Codex: 映射为 `stream_idle_timeout_ms`
40
- * - Claude Code Router: 映射为全局 `API_TIMEOUT_MS`
41
- * - OpenCode: 映射为 provider `timeout` / `chunkTimeout`
42
- */
43
- timeoutMs?: number
44
- /**
45
- * 模型服务默认最大输出 token。
46
- * - Codex: 对 routed model service 通过本地代理写入 Responses API `max_output_tokens`
47
- * - Claude Code Router: 映射为 `maxtoken` transformer
48
- * - OpenCode: 映射为 model `options.maxOutputTokens` / `limit.output`
49
- */
50
- maxOutputTokens?: number
51
- /**
52
- * 拓展配置,由下游自行消费
53
- */
54
- extra?: Record<string, unknown>
55
- }
56
-
57
- export interface RecommendedModelConfig {
58
- service?: string
59
- model: string
60
- title?: string
61
- description?: string
62
- placement?: 'modelSelector'
63
- }
64
-
65
- export type LanguageCode = 'zh' | 'en'
66
-
67
- export type NotificationTrigger = 'completed' | 'failed' | 'terminated' | 'waiting_input'
68
-
69
- export interface NotificationEventConfig {
70
- title?: string
71
- description?: string
72
- disabled?: boolean
73
- sound?: string
74
- }
75
-
76
- export interface NotificationConfig {
77
- disabled?: boolean
78
- volume?: number
79
- events?: Partial<Record<NotificationTrigger, NotificationEventConfig>>
80
- }
81
-
82
- export interface Config {
83
- /**
84
- * 配置目录
85
- */
86
- baseDir?: string
87
- /**
88
- * 适配器配置
89
- */
90
- adapters?: Partial<AdapterMap>
91
- /**
92
- * 默认适配器名称
93
- */
94
- defaultAdapter?: keyof AdapterMap
95
- /**
96
- * 模型服务配置
97
- */
98
- modelServices?: Record<string, ModelServiceConfig>
99
- /**
100
- * 频道配置
101
- */
102
- channels?: Record<string, ChannelConfig>
103
- /**
104
- * 默认模型服务名称
105
- */
106
- defaultModelService?: string
107
- /**
108
- * 默认模型名称
109
- */
110
- defaultModel?: string
111
- recommendedModels?: RecommendedModelConfig[]
112
- interfaceLanguage?: LanguageCode
113
- modelLanguage?: LanguageCode
114
- /**
115
- * MCP 服务器配置
116
- */
117
- mcpServers?: Record<
118
- string,
119
- & {
120
- /**
121
- * 是否启用
122
- */
123
- enabled?: boolean
124
- /**
125
- * 环境变量配置
126
- */
127
- env?: Record<string, string>
128
- }
129
- & (
130
- | {
131
- type?: undefined
132
- command: string
133
- args: string[]
134
- }
135
- | {
136
- type: 'sse'
137
- url: string
138
- headers: Record<string, string>
139
- }
140
- | {
141
- type: 'http'
142
- url: string
143
- headers?: Record<string, string>
144
- }
145
- )
146
- >
147
- /**
148
- * 默认启用的 MCP 服务器列表
149
- */
150
- defaultIncludeMcpServers?: string[]
151
- /**
152
- * 默认禁用的 MCP 服务器列表
153
- */
154
- defaultExcludeMcpServers?: string[]
155
- noDefaultVibeForgeMcpServer?: boolean
156
- /**
157
- * 权限配置
158
- */
159
- permissions?: {
160
- allow?: string[]
161
- deny?: string[]
162
- ask?: string[]
163
- defaultMode?: 'default' | 'acceptEdits' | 'plan' | 'dontAsk' | 'bypassPermissions'
164
- }
165
- /**
166
- * 环境变量配置
167
- */
168
- env?: Record<string, string>
169
- /**
170
- * 公告配置
171
- */
172
- announcements?: string[]
173
- /**
174
- * 快捷键配置
175
- */
176
- shortcuts?: {
177
- newSession?: string
178
- openConfig?: string
179
- }
180
- notifications?: NotificationConfig
181
- /**
182
- * 会话配置
183
- */
184
- conversation?: {
185
- /**
186
- * 对话风格
187
- * - `friendly`: 友好的对话风格,适合用户与助手交互
188
- * - `programmatic`: 程序化的对话风格,适合助手执行任务
189
- */
190
- style?: 'friendly' | 'programmatic'
191
- /**
192
- * 自定义对话风格。通过指定提示词约束对话风格。
193
- */
194
- customInstructions?: string
195
- /**
196
- * 是否注入 Vibe Forge 自动生成的默认系统提示词
197
- * (例如 rules / skills / entities / specs 生成的提示词)。
198
- * 默认为 true。
199
- */
200
- injectDefaultSystemPrompt?: boolean
201
- }
202
- /**
203
- * 插件配置
204
- */
205
- plugins?: PluginConfig
206
- enabledPlugins?: Record<string, boolean>
207
- extraKnownMarketplaces?: Record<
208
- string,
209
- {
210
- source:
211
- | {
212
- source: 'github'
213
- repo: string
214
- }
215
- | {
216
- source: 'git'
217
- url: string
218
- }
219
- | {
220
- source: 'directory'
221
- path: string
222
- }
223
- }
224
- >
225
- }
226
-
227
- export interface AboutInfo {
228
- version?: string
229
- lastReleaseAt?: string
230
- urls?: {
231
- repo?: string
232
- docs?: string
233
- contact?: string
234
- issues?: string
235
- releases?: string
236
- }
237
- }
238
-
239
- export interface ConfigSection {
240
- general?: {
241
- baseDir?: Config['baseDir']
242
- defaultAdapter?: Config['defaultAdapter']
243
- defaultModelService?: Config['defaultModelService']
244
- defaultModel?: Config['defaultModel']
245
- recommendedModels?: Config['recommendedModels']
246
- interfaceLanguage?: Config['interfaceLanguage']
247
- modelLanguage?: Config['modelLanguage']
248
- announcements?: Config['announcements']
249
- permissions?: Config['permissions']
250
- env?: Config['env']
251
- notifications?: Config['notifications']
252
- }
253
- conversation?: Config['conversation']
254
- modelServices?: Config['modelServices']
255
- channels?: Config['channels']
256
- adapters?: Config['adapters']
257
- adapterBuiltinModels?: Record<string, AdapterBuiltinModel[]>
258
- plugins?: {
259
- plugins?: Config['plugins']
260
- enabledPlugins?: Config['enabledPlugins']
261
- extraKnownMarketplaces?: Config['extraKnownMarketplaces']
262
- }
263
- mcp?: {
264
- mcpServers?: Config['mcpServers']
265
- defaultIncludeMcpServers?: Config['defaultIncludeMcpServers']
266
- defaultExcludeMcpServers?: Config['defaultExcludeMcpServers']
267
- noDefaultVibeForgeMcpServer?: Config['noDefaultVibeForgeMcpServer']
268
- }
269
- shortcuts?: Config['shortcuts']
270
- }
271
-
272
- export interface ConfigResponse {
273
- sources?: {
274
- project?: ConfigSection
275
- user?: ConfigSection
276
- merged?: ConfigSection
277
- }
278
- meta?: {
279
- workspaceFolder?: string
280
- configPresent?: {
281
- project?: boolean
282
- user?: boolean
283
- }
284
- experiments?: Record<string, unknown>
285
- about?: AboutInfo
286
- }
287
- }
288
-
289
- export const defineConfig = (config: Config) => config
package/src/config.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './config/load'
2
- export * from './config/types'
@@ -1,89 +0,0 @@
1
- import { readFile } from 'node:fs/promises'
2
- import { relative, resolve } from 'node:path'
3
- import process from 'node:process'
4
-
5
- import { glob } from 'fast-glob'
6
- import fm from 'front-matter'
7
-
8
- import type { BenchmarkCase, BenchmarkCategory, BenchmarkCaseSelector, BenchmarkListOptions } from './types'
9
- import { BenchmarkFrontmatterSchema } from './schema'
10
- import { readBenchmarkResult } from './result-store'
11
-
12
- export const resolveBenchmarkRoot = (workspaceFolder = process.cwd()) => resolve(workspaceFolder, '.ai/benchmark')
13
-
14
- const resolveSummary = (body: string) => {
15
- const lines = body
16
- .split('\n')
17
- .map(line => line.trim())
18
- .filter(Boolean)
19
- return lines[0] ?? ''
20
- }
21
-
22
- export const listBenchmarkCases = async (options: BenchmarkListOptions = {}): Promise<BenchmarkCase[]> => {
23
- const workspaceFolder = options.workspaceFolder ?? process.cwd()
24
- const benchmarkRoot = resolveBenchmarkRoot(workspaceFolder)
25
- const pattern = options.category == null ? '*/*/rfc.md' : `${options.category}/*/rfc.md`
26
- const rfcPaths = await glob(pattern, {
27
- cwd: benchmarkRoot,
28
- absolute: true
29
- })
30
-
31
- const cases = await Promise.all(rfcPaths.map(async (rfcPath) => {
32
- const relativePath = relative(benchmarkRoot, rfcPath).split('\\').join('/')
33
- const [category, title] = relativePath.split('/')
34
- const caseDir = resolve(benchmarkRoot, category, title)
35
- const rfcRaw = await readFile(rfcPath, 'utf-8')
36
- const { body, attributes } = fm<Record<string, unknown>>(rfcRaw)
37
- const frontmatter = BenchmarkFrontmatterSchema.parse(attributes)
38
- const latestResult = await readBenchmarkResult(workspaceFolder, category, title)
39
-
40
- return {
41
- id: `${category}/${title}`,
42
- category,
43
- title,
44
- caseDir,
45
- rfcPath,
46
- patchPath: resolve(caseDir, 'patch.diff'),
47
- patchTestPath: resolve(caseDir, 'patch.test.diff'),
48
- rfcBody: body.trim(),
49
- rfcRaw,
50
- summary: resolveSummary(body),
51
- frontmatter,
52
- latestResult
53
- } satisfies BenchmarkCase
54
- }))
55
-
56
- return cases.sort((a, b) => a.id.localeCompare(b.id))
57
- }
58
-
59
- export const listBenchmarkCategories = async (options: BenchmarkListOptions = {}): Promise<BenchmarkCategory[]> => {
60
- const cases = await listBenchmarkCases(options)
61
- const categoryMap = new Map<string, BenchmarkCategory>()
62
-
63
- for (const item of cases) {
64
- const existing = categoryMap.get(item.category) ?? {
65
- category: item.category,
66
- caseCount: 0,
67
- lastStatuses: {
68
- pass: 0,
69
- partial: 0,
70
- fail: 0
71
- }
72
- }
73
- existing.caseCount += 1
74
- if (item.latestResult != null) {
75
- existing.lastStatuses[item.latestResult.status] += 1
76
- }
77
- categoryMap.set(item.category, existing)
78
- }
79
-
80
- return [...categoryMap.values()].sort((a, b) => a.category.localeCompare(b.category))
81
- }
82
-
83
- export const getBenchmarkCase = async (input: BenchmarkCaseSelector) => {
84
- const items = await listBenchmarkCases({
85
- workspaceFolder: input.workspaceFolder,
86
- category: input.category
87
- })
88
- return items.find(item => item.title === input.title) ?? null
89
- }
@@ -1,24 +0,0 @@
1
- export { getBenchmarkCase, listBenchmarkCases, listBenchmarkCategories } from './discover'
2
- export { listBenchmarkResults, readBenchmarkResult, resolveBenchmarkResultPath, writeBenchmarkResult } from './result-store'
3
- export { runBenchmarkCase, runBenchmarkCategory } from './runner'
4
- export { BenchmarkFrontmatterSchema, BenchmarkResultSchema, BenchmarkRunSummarySchema } from './schema'
5
- export type {
6
- BenchmarkFrontmatter,
7
- BenchmarkResult,
8
- BenchmarkRunSummary,
9
- BenchmarkScores,
10
- BenchmarkStatus
11
- } from './schema'
12
- export type {
13
- BenchmarkAgentOptions,
14
- BenchmarkCase,
15
- BenchmarkCaseSelector,
16
- BenchmarkCategory,
17
- BenchmarkListOptions,
18
- BenchmarkPermissionMode,
19
- BenchmarkRunCaseInput,
20
- BenchmarkRunCaseOutput,
21
- BenchmarkRunCategoryInput,
22
- BenchmarkRunCategoryOutput,
23
- BenchmarkRunEvent
24
- } from './types'
@@ -1,46 +0,0 @@
1
- import { mkdir, writeFile } from 'node:fs/promises'
2
- import { dirname, resolve } from 'node:path'
3
- import process from 'node:process'
4
-
5
- import { glob } from 'fast-glob'
6
-
7
- import { BenchmarkResultSchema, type BenchmarkResult } from './schema'
8
- import { readTextIfExists } from './utils'
9
-
10
- export const resolveBenchmarkResultPath = (workspaceFolder: string, category: string, title: string) =>
11
- resolve(workspaceFolder, '.ai/results', category, title, 'result.json')
12
-
13
- export const readBenchmarkResult = async (workspaceFolder: string, category: string, title: string) => {
14
- const resultPath = resolveBenchmarkResultPath(workspaceFolder, category, title)
15
- const raw = await readTextIfExists(resultPath)
16
- if (raw == null) return null
17
- const parsed = JSON.parse(raw) as unknown
18
- return BenchmarkResultSchema.parse(parsed)
19
- }
20
-
21
- export const writeBenchmarkResult = async (workspaceFolder: string, result: BenchmarkResult) => {
22
- const resultPath = resolveBenchmarkResultPath(workspaceFolder, result.category, result.title)
23
- await mkdir(dirname(resultPath), { recursive: true })
24
- await writeFile(resultPath, `${JSON.stringify(result, null, 2)}\n`, 'utf-8')
25
- return resultPath
26
- }
27
-
28
- export const listBenchmarkResults = async (workspaceFolder = process.cwd(), category?: string) => {
29
- const pattern = category == null
30
- ? '.ai/results/*/*/result.json'
31
- : `.ai/results/${category}/*/result.json`
32
- const resultPaths = await glob(pattern, {
33
- cwd: workspaceFolder,
34
- absolute: true
35
- })
36
-
37
- const results = await Promise.all(resultPaths.map(async (resultPath) => {
38
- const raw = await readTextIfExists(resultPath)
39
- if (raw == null) return null
40
- return BenchmarkResultSchema.parse(JSON.parse(raw) as unknown)
41
- }))
42
-
43
- return results
44
- .filter((result): result is BenchmarkResult => result != null)
45
- .sort((a, b) => b.timestamp.localeCompare(a.timestamp))
46
- }