pantheon-opencode 2.1.5 → 2.1.6

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.
@@ -13,6 +13,11 @@ import { generateMarkdownDocument } from './plan-projection.ts'
13
13
  import {
14
14
  type DeepworkPlan,
15
15
  DeepworkPlanSchema,
16
+ type PlanAcceptanceCriterion,
17
+ type PlanAcceptanceKind,
18
+ type PlanDecision,
19
+ type PlanMetadata,
20
+ type PlanRisk,
16
21
  type PlanTask,
17
22
  type TaskState,
18
23
  } from './plan-schema.ts'
@@ -81,17 +86,288 @@ export function computeTaskReadiness(plan: DeepworkPlan): DeepworkPlan {
81
86
  return { ...plan, tasks: updatedTasks }
82
87
  }
83
88
 
89
+ export function inferAcceptanceKind(check: string): PlanAcceptanceKind {
90
+ const lower = check.toLowerCase()
91
+ if (lower.includes('test') || lower.includes('pytest') || lower.includes('assert')) return 'test'
92
+ if (
93
+ lower.includes('file') ||
94
+ lower.includes('exist') ||
95
+ lower.includes('criado') ||
96
+ lower.includes('path')
97
+ )
98
+ return 'file'
99
+ if (
100
+ lower.startsWith('npm ') ||
101
+ lower.startsWith('bash ') ||
102
+ lower.startsWith('alembic ') ||
103
+ lower.startsWith('git ') ||
104
+ lower.includes(' && ') ||
105
+ lower.includes(' || ')
106
+ )
107
+ return 'command'
108
+ return 'manual'
109
+ }
110
+
111
+ /**
112
+ * Normalizes unstructured or loosely structured plan input into a canonical DeepworkPlan.
113
+ * Resilient to agent variations: owner vs agent, @-prefixes, array of strings for acceptance,
114
+ * choices in decisions, and string phases.
115
+ */
116
+ export function normalizePlanData(data: unknown, fallbackSlug = 'plan'): DeepworkPlan {
117
+ const obj = (data && typeof data === 'object' ? data : {}) as Record<string, unknown>
118
+ const slug = String(obj.plan_id ?? obj.slug ?? fallbackSlug).trim() || fallbackSlug
119
+ const title = String(obj.title ?? slug).trim() || slug
120
+ const intent = String(obj.intent ?? '').trim() || 'Plano de deepwork estruturado.'
121
+ const done_when = Array.isArray(obj.done_when)
122
+ ? obj.done_when.map((s) => String(s).trim()).filter(Boolean)
123
+ : []
124
+
125
+ const rawDecisions = Array.isArray(obj.decisions_needed)
126
+ ? obj.decisions_needed
127
+ : Array.isArray(obj.decisions)
128
+ ? obj.decisions
129
+ : []
130
+
131
+ const decisions_needed: PlanDecision[] = rawDecisions.map((d: unknown, idx: number) => {
132
+ const dec = (d && typeof d === 'object' ? d : {}) as Record<string, unknown>
133
+ const id = String(dec.id ?? `D${String(idx + 1).padStart(2, '0')}`).trim()
134
+ const question = String(dec.question ?? dec.title ?? 'Decisão necessária').trim()
135
+ const rawOptions = Array.isArray(dec.options)
136
+ ? dec.options
137
+ : typeof dec.options === 'string'
138
+ ? [dec.options]
139
+ : []
140
+ const options = rawOptions.map((opt) => String(opt).trim()).filter(Boolean)
141
+ const chosenVal = dec.chosen ?? dec.choice
142
+ const chosen = typeof chosenVal === 'string' ? chosenVal : undefined
143
+ const statusVal = String(dec.status ?? '')
144
+ .trim()
145
+ .toLowerCase()
146
+ const status: 'pending' | 'resolved' =
147
+ statusVal === 'resolved' || chosen !== undefined ? 'resolved' : 'pending'
148
+ return {
149
+ id,
150
+ question,
151
+ options,
152
+ chosen,
153
+ choice: chosen,
154
+ status,
155
+ resolved_at: typeof dec.resolved_at === 'string' ? dec.resolved_at : undefined,
156
+ }
157
+ })
158
+
159
+ const rawRisks = Array.isArray(obj.risks) ? obj.risks : []
160
+ const risks: PlanRisk[] = rawRisks.map((r: unknown, idx: number) => {
161
+ const risk = (r && typeof r === 'object' ? r : {}) as Record<string, unknown>
162
+ return {
163
+ id: String(risk.id ?? `R${String(idx + 1).padStart(2, '0')}`).trim(),
164
+ description: String(risk.description ?? risk.risk ?? '').trim() || 'Risco não especificado',
165
+ mitigation: typeof risk.mitigation === 'string' ? risk.mitigation : undefined,
166
+ }
167
+ })
168
+
169
+ const out_of_scope = Array.isArray(obj.out_of_scope)
170
+ ? obj.out_of_scope.map((s) => String(s).trim()).filter(Boolean)
171
+ : []
172
+
173
+ const rawTasks = Array.isArray(obj.tasks) ? obj.tasks : []
174
+ const tasks: PlanTask[] = rawTasks.map((t: unknown, idx: number) => {
175
+ const task = (t && typeof t === 'object' ? t : {}) as Record<string, unknown>
176
+ const id = String(task.id ?? `T${String(idx + 1).padStart(2, '0')}`).trim()
177
+ const taskTitle = String(task.title ?? task.name ?? `Task ${idx + 1}`).trim()
178
+ const description = typeof task.description === 'string' ? task.description : undefined
179
+ const rawAgent = task.agent ?? task.owner ?? task.assignee
180
+ const agent =
181
+ typeof rawAgent === 'string' && rawAgent.trim().length > 0
182
+ ? rawAgent.replace(/^@/, '').trim()
183
+ : 'zeus'
184
+
185
+ const rawPhase = task.phase
186
+ let phase = 1
187
+ if (typeof rawPhase === 'number' && Number.isFinite(rawPhase)) {
188
+ phase = rawPhase
189
+ } else if (typeof rawPhase === 'string') {
190
+ const match = rawPhase.match(/\d+/)
191
+ if (match) phase = Number.parseInt(match[0], 10)
192
+ }
193
+
194
+ const rawState = String(task.state ?? task.status ?? 'pending')
195
+ .trim()
196
+ .toLowerCase()
197
+ const validStates: TaskState[] = [
198
+ 'pending',
199
+ 'ready',
200
+ 'in_progress',
201
+ 'done',
202
+ 'failed',
203
+ 'blocked',
204
+ ]
205
+ const state: TaskState = validStates.includes(rawState as TaskState)
206
+ ? (rawState as TaskState)
207
+ : 'pending'
208
+
209
+ const depends_on = Array.isArray(task.depends_on)
210
+ ? task.depends_on.map((dep) => String(dep).trim()).filter(Boolean)
211
+ : []
212
+ const parallel_safe = Boolean(task.parallel_safe ?? task.parallel)
213
+
214
+ const rawAcceptance = Array.isArray(task.acceptance)
215
+ ? task.acceptance
216
+ : Array.isArray(task.acceptance_criteria)
217
+ ? task.acceptance_criteria
218
+ : Array.isArray(task.criteria)
219
+ ? task.criteria
220
+ : []
221
+
222
+ const acceptance: PlanAcceptanceCriterion[] = rawAcceptance.map((a: unknown) => {
223
+ if (typeof a === 'string') {
224
+ const checkText = a.trim()
225
+ return {
226
+ kind: inferAcceptanceKind(checkText),
227
+ check: checkText,
228
+ fails_now: true,
229
+ verified: false,
230
+ }
231
+ }
232
+ const acc = (a && typeof a === 'object' ? a : {}) as Record<string, unknown>
233
+ const checkText = String(
234
+ acc.check ?? acc.description ?? acc.title ?? acc.name ?? 'verify',
235
+ ).trim()
236
+ const rawKind = String(acc.kind ?? '')
237
+ .trim()
238
+ .toLowerCase()
239
+ const validKinds = ['test', 'command', 'file', 'manual'] as const
240
+ const kind = (
241
+ validKinds.includes(rawKind as (typeof validKinds)[number])
242
+ ? rawKind
243
+ : inferAcceptanceKind(checkText)
244
+ ) as PlanAcceptanceKind
245
+ return {
246
+ kind,
247
+ check: checkText || 'verify',
248
+ fails_now: typeof acc.fails_now === 'boolean' ? acc.fails_now : true,
249
+ verified: Boolean(acc.verified),
250
+ proof: typeof acc.proof === 'string' ? acc.proof : undefined,
251
+ }
252
+ })
253
+
254
+ const rawResult =
255
+ task.result && typeof task.result === 'object'
256
+ ? (task.result as Record<string, unknown>)
257
+ : undefined
258
+ const result = rawResult
259
+ ? {
260
+ summary: typeof rawResult.summary === 'string' ? rawResult.summary : undefined,
261
+ verified_at:
262
+ typeof rawResult.verified_at === 'string' ? rawResult.verified_at : undefined,
263
+ artifacts: Array.isArray(rawResult.artifacts)
264
+ ? rawResult.artifacts.map((art) => String(art))
265
+ : undefined,
266
+ }
267
+ : undefined
268
+
269
+ return {
270
+ id,
271
+ title: taskTitle,
272
+ description,
273
+ agent,
274
+ phase,
275
+ state,
276
+ depends_on,
277
+ parallel_safe,
278
+ acceptance,
279
+ result,
280
+ }
281
+ })
282
+
283
+ const rawMeta =
284
+ obj.metadata && typeof obj.metadata === 'object'
285
+ ? (obj.metadata as Record<string, unknown>)
286
+ : {}
287
+ const now = new Date().toISOString()
288
+ const metadata: PlanMetadata = {
289
+ created_at: typeof rawMeta.created_at === 'string' ? rawMeta.created_at : now,
290
+ updated_at: typeof rawMeta.updated_at === 'string' ? rawMeta.updated_at : now,
291
+ version: typeof rawMeta.version === 'number' ? rawMeta.version : 1,
292
+ }
293
+
294
+ return computeTaskReadiness({
295
+ plan_id: slug,
296
+ title,
297
+ intent,
298
+ done_when,
299
+ decisions_needed,
300
+ risks,
301
+ out_of_scope,
302
+ tasks,
303
+ metadata,
304
+ })
305
+ }
306
+
84
307
  /**
85
- * Read the canonical JSON plan. Returns null if absent or corrupt.
308
+ * Read the canonical JSON plan. Returns null if absent.
309
+ * Automatically normalizes minor schema variations (single options, string criteria, owner aliases).
86
310
  */
87
311
  export async function readPlan(cwd = process.cwd(), slug: string): Promise<DeepworkPlan | null> {
88
312
  const path = deepworkPlanJsonPath(cwd, slug)
313
+ let raw: string
314
+ try {
315
+ raw = await readFile(path, 'utf8')
316
+ } catch (err: unknown) {
317
+ if ((err as NodeJS.ErrnoException).code === 'ENOENT') {
318
+ return null
319
+ }
320
+ throw err
321
+ }
322
+
323
+ let parsed: unknown
324
+ try {
325
+ parsed = JSON.parse(raw)
326
+ } catch (err: unknown) {
327
+ throw new Error(`Plano '${slug}' em ${path} contém JSON inválido: ${(err as Error).message}`)
328
+ }
329
+
330
+ const result = DeepworkPlanSchema.safeParse(parsed)
331
+ if (result.success) {
332
+ return result.data
333
+ }
334
+
89
335
  try {
90
- const raw = await readFile(path, 'utf8')
91
- const parsed = JSON.parse(raw)
92
- return DeepworkPlanSchema.parse(parsed)
336
+ const normalized = normalizePlanData(parsed, slug)
337
+ const repairedResult = DeepworkPlanSchema.safeParse(normalized)
338
+ if (repairedResult.success) {
339
+ return repairedResult.data
340
+ }
93
341
  } catch {
94
- return null
342
+ // fall through to schema issue reporting
343
+ }
344
+
345
+ const issues = result.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join(', ')
346
+ throw new Error(`Plano '${slug}' em ${path} falhou na validação de schema: ${issues}`)
347
+ }
348
+
349
+ const planLocks = new Map<string, Promise<unknown>>()
350
+
351
+ /**
352
+ * Execute an async operation with serialized exclusivity per plan slug.
353
+ * Prevents concurrent read-modify-write race conditions and clashing tempfiles.
354
+ */
355
+ export async function withPlanLock<T>(cwd: string, slug: string, fn: () => Promise<T>): Promise<T> {
356
+ const key = `${cwd}::${slug}`
357
+ const prev = planLocks.get(key) ?? Promise.resolve()
358
+ let resolveCurrent: (() => void) | undefined
359
+ const current = new Promise<void>((resolve) => {
360
+ resolveCurrent = resolve
361
+ })
362
+ planLocks.set(key, current)
363
+ try {
364
+ await prev
365
+ return await fn()
366
+ } finally {
367
+ resolveCurrent?.()
368
+ if (planLocks.get(key) === current) {
369
+ planLocks.delete(key)
370
+ }
95
371
  }
96
372
  }
97
373
 
@@ -111,16 +387,20 @@ export async function writePlan(cwd = process.cwd(), plan: DeepworkPlan): Promis
111
387
  },
112
388
  })
113
389
 
390
+ const randomSuffix = `${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2)}`
391
+
114
392
  // Atomic write for plan.json
115
393
  const jsonPath = deepworkPlanJsonPath(cwd, plan.plan_id)
116
- const jsonTmp = `${jsonPath}.tmp`
394
+ const jsonTmp = `${jsonPath}.tmp.${randomSuffix}`
117
395
  await writeFile(jsonTmp, `${JSON.stringify(normalized, null, 2)}\n`, 'utf8')
118
396
  await rename(jsonTmp, jsonPath)
119
397
 
120
398
  // Projection write for PLAN.md
121
399
  const mdPath = deepworkPlanMdPath(cwd, plan.plan_id)
400
+ const mdTmp = `${mdPath}.tmp.${randomSuffix}`
122
401
  const mdContent = generateMarkdownDocument(normalized)
123
- await writeFile(mdPath, mdContent, 'utf8')
402
+ await writeFile(mdTmp, mdContent, 'utf8')
403
+ await rename(mdTmp, mdPath)
124
404
  }
125
405
 
126
406
  /**
@@ -164,38 +444,42 @@ export async function updateTaskState(
164
444
  state: TaskState,
165
445
  result?: { summary?: string; verified_at?: string; artifacts?: string[] },
166
446
  ): Promise<DeepworkPlan> {
167
- const plan = await readPlan(cwd, slug)
168
- if (!plan) {
169
- throw new Error(`Deepwork plan "${slug}" not found`)
170
- }
447
+ return withPlanLock(cwd, slug, async () => {
448
+ const plan = await readPlan(cwd, slug)
449
+ if (!plan) {
450
+ throw new Error(`Deepwork plan "${slug}" not found`)
451
+ }
171
452
 
172
- const taskIndex = plan.tasks.findIndex((t) => t.id === taskId)
173
- const existingTask = plan.tasks[taskIndex]
174
- if (taskIndex === -1 || !existingTask) {
175
- throw new Error(`Task "${taskId}" not found in plan "${slug}"`)
176
- }
453
+ const taskIndex = plan.tasks.findIndex((t) => t.id === taskId)
454
+ const existingTask = plan.tasks[taskIndex]
455
+ if (taskIndex === -1 || !existingTask) {
456
+ throw new Error(`Task "${taskId}" not found in plan "${slug}"`)
457
+ }
177
458
 
178
- const updatedResult = result ? { ...(existingTask.result ?? {}), ...result } : existingTask.result
459
+ const updatedResult = result
460
+ ? { ...(existingTask.result ?? {}), ...result }
461
+ : existingTask.result
179
462
 
180
- const updatedTask: PlanTask = {
181
- ...existingTask,
182
- state,
183
- ...(updatedResult !== undefined ? { result: updatedResult } : {}),
184
- }
463
+ const updatedTask: PlanTask = {
464
+ ...existingTask,
465
+ state,
466
+ ...(updatedResult !== undefined ? { result: updatedResult } : {}),
467
+ }
185
468
 
186
- const updatedTasks = [...plan.tasks]
187
- updatedTasks[taskIndex] = updatedTask
469
+ const updatedTasks = [...plan.tasks]
470
+ updatedTasks[taskIndex] = updatedTask
188
471
 
189
- const nextPlan: DeepworkPlan = { ...plan, tasks: updatedTasks }
190
- await writePlan(cwd, nextPlan)
472
+ const nextPlan: DeepworkPlan = { ...plan, tasks: updatedTasks }
473
+ await writePlan(cwd, nextPlan)
191
474
 
192
- await appendJournal(cwd, slug, {
193
- type: 'task_state_changed',
194
- timestamp: new Date().toISOString(),
195
- payload: { taskId, state, result },
196
- })
475
+ await appendJournal(cwd, slug, {
476
+ type: 'task_state_changed',
477
+ timestamp: new Date().toISOString(),
478
+ payload: { taskId, state, result },
479
+ })
197
480
 
198
- return (await readPlan(cwd, slug)) ?? nextPlan
481
+ return (await readPlan(cwd, slug)) ?? nextPlan
482
+ })
199
483
  }
200
484
 
201
485
  /**
@@ -209,49 +493,51 @@ export async function verifyTaskAcceptance(
209
493
  verified: boolean,
210
494
  proof?: string,
211
495
  ): Promise<DeepworkPlan> {
212
- const plan = await readPlan(cwd, slug)
213
- if (!plan) {
214
- throw new Error(`Deepwork plan "${slug}" not found`)
215
- }
496
+ return withPlanLock(cwd, slug, async () => {
497
+ const plan = await readPlan(cwd, slug)
498
+ if (!plan) {
499
+ throw new Error(`Deepwork plan "${slug}" not found`)
500
+ }
216
501
 
217
- const taskIndex = plan.tasks.findIndex((t) => t.id === taskId)
218
- const task = plan.tasks[taskIndex]
219
- if (taskIndex === -1 || !task) {
220
- throw new Error(`Task "${taskId}" not found in plan "${slug}"`)
221
- }
502
+ const taskIndex = plan.tasks.findIndex((t) => t.id === taskId)
503
+ const task = plan.tasks[taskIndex]
504
+ if (taskIndex === -1 || !task) {
505
+ throw new Error(`Task "${taskId}" not found in plan "${slug}"`)
506
+ }
222
507
 
223
- const currentAcc = task.acceptance[checkIndex]
224
- if (!currentAcc) {
225
- throw new Error(`Acceptance criterion index ${checkIndex} not found in task "${taskId}"`)
226
- }
508
+ const currentAcc = task.acceptance[checkIndex]
509
+ if (!currentAcc) {
510
+ throw new Error(`Acceptance criterion index ${checkIndex} not found in task "${taskId}"`)
511
+ }
227
512
 
228
- const updatedAcceptance = [...task.acceptance]
229
- const resolvedProof = proof ?? currentAcc.proof
230
- updatedAcceptance[checkIndex] = {
231
- ...currentAcc,
232
- verified,
233
- ...(resolvedProof !== undefined ? { proof: resolvedProof } : {}),
234
- }
513
+ const updatedAcceptance = [...task.acceptance]
514
+ const resolvedProof = proof ?? currentAcc.proof
515
+ updatedAcceptance[checkIndex] = {
516
+ ...currentAcc,
517
+ verified,
518
+ ...(resolvedProof !== undefined ? { proof: resolvedProof } : {}),
519
+ }
235
520
 
236
- const allVerified = updatedAcceptance.every((acc) => acc.verified)
521
+ const allVerified = updatedAcceptance.every((acc) => acc.verified)
237
522
 
238
- const updatedTasks = [...plan.tasks]
239
- updatedTasks[taskIndex] = {
240
- ...task,
241
- acceptance: updatedAcceptance,
242
- state: allVerified ? 'done' : task.state,
243
- }
523
+ const updatedTasks = [...plan.tasks]
524
+ updatedTasks[taskIndex] = {
525
+ ...task,
526
+ acceptance: updatedAcceptance,
527
+ state: allVerified ? 'done' : task.state,
528
+ }
244
529
 
245
- const nextPlan: DeepworkPlan = { ...plan, tasks: updatedTasks }
246
- await writePlan(cwd, nextPlan)
530
+ const nextPlan: DeepworkPlan = { ...plan, tasks: updatedTasks }
531
+ await writePlan(cwd, nextPlan)
247
532
 
248
- await appendJournal(cwd, slug, {
249
- type: 'acceptance_verified',
250
- timestamp: new Date().toISOString(),
251
- payload: { taskId, checkIndex, verified, proof, allVerified },
252
- })
533
+ await appendJournal(cwd, slug, {
534
+ type: 'acceptance_verified',
535
+ timestamp: new Date().toISOString(),
536
+ payload: { taskId, checkIndex, verified, proof, allVerified },
537
+ })
253
538
 
254
- return (await readPlan(cwd, slug)) ?? nextPlan
539
+ return (await readPlan(cwd, slug)) ?? nextPlan
540
+ })
255
541
  }
256
542
 
257
543
  /**
@@ -263,34 +549,38 @@ export async function resolvePlanDecision(
263
549
  decisionId: string,
264
550
  chosen: string,
265
551
  ): Promise<DeepworkPlan> {
266
- const plan = await readPlan(cwd, slug)
267
- if (!plan) {
268
- throw new Error(`Deepwork plan "${slug}" not found`)
269
- }
552
+ return withPlanLock(cwd, slug, async () => {
553
+ const plan = await readPlan(cwd, slug)
554
+ if (!plan) {
555
+ throw new Error(`Deepwork plan "${slug}" not found`)
556
+ }
270
557
 
271
- const decIndex = plan.decisions_needed.findIndex((d) => d.id === decisionId)
272
- const existingDec = plan.decisions_needed[decIndex]
273
- if (decIndex === -1 || !existingDec) {
274
- throw new Error(`Decision "${decisionId}" not found in plan "${slug}"`)
275
- }
558
+ const decIndex = plan.decisions_needed.findIndex((d) => d.id === decisionId)
559
+ const existingDec = plan.decisions_needed[decIndex]
560
+ if (decIndex === -1 || !existingDec) {
561
+ throw new Error(`Decision "${decisionId}" not found in plan "${slug}"`)
562
+ }
276
563
 
277
- const updatedDecisions = [...plan.decisions_needed]
278
- updatedDecisions[decIndex] = {
279
- ...existingDec,
280
- chosen,
281
- status: 'resolved',
282
- }
564
+ const updatedDecisions = [...plan.decisions_needed]
565
+ updatedDecisions[decIndex] = {
566
+ ...existingDec,
567
+ chosen,
568
+ choice: chosen,
569
+ status: 'resolved',
570
+ resolved_at: new Date().toISOString(),
571
+ }
283
572
 
284
- const nextPlan: DeepworkPlan = { ...plan, decisions_needed: updatedDecisions }
285
- await writePlan(cwd, nextPlan)
573
+ const nextPlan: DeepworkPlan = { ...plan, decisions_needed: updatedDecisions }
574
+ await writePlan(cwd, nextPlan)
286
575
 
287
- await appendJournal(cwd, slug, {
288
- type: 'decision_resolved',
289
- timestamp: new Date().toISOString(),
290
- payload: { decisionId, chosen },
291
- })
576
+ await appendJournal(cwd, slug, {
577
+ type: 'decision_resolved',
578
+ timestamp: new Date().toISOString(),
579
+ payload: { decisionId, chosen },
580
+ })
292
581
 
293
- return (await readPlan(cwd, slug)) ?? nextPlan
582
+ return (await readPlan(cwd, slug)) ?? nextPlan
583
+ })
294
584
  }
295
585
 
296
586
  /**
@@ -872,14 +872,8 @@ const JEV_INPUT_SCHEMA: Record<string, unknown> = {
872
872
  type: 'object',
873
873
  additionalProperties: false,
874
874
  required: ['schemaVersion'],
875
- anyOf: [
876
- { required: ['state'] },
877
- { required: ['delegateId', 'resultSummaryKind', 'resultMetrics', 'criteria'] },
878
- { required: ['candidates'] },
879
- { required: ['claims'] },
880
- ],
881
875
  properties: {
882
- schemaVersion: { type: 'integer', const: 1 },
876
+ schemaVersion: { type: 'integer', enum: [1] },
883
877
  state: { type: 'string', minLength: 1, maxLength: 12_000 },
884
878
  mode: { type: 'string', enum: ['skills', 'delegation', 'review', 'rank', 'verify', 'order'] },
885
879
  questions: { type: 'array', minItems: 1, maxItems: 4, items: questionSchema },
@@ -114,7 +114,7 @@ const v2InputSchema: Record<string, unknown> = {
114
114
  'complexity',
115
115
  ],
116
116
  properties: {
117
- schemaVersion: { type: 'integer', const: 1 },
117
+ schemaVersion: { type: 'integer', enum: [1] },
118
118
  candidateAgents: { type: 'array', maxItems: 14, items: { type: 'string', minLength: 1 } },
119
119
  domain: { type: ['string', 'null'] },
120
120
  candidateSkillIds: { type: 'array', maxItems: 64, items: { type: 'string', minLength: 1 } },
@@ -576,7 +576,7 @@ export function createV2VisionTool(runtime: V2VisionRuntime): V2VisionToolDefini
576
576
  return {
577
577
  name: 'vision_describe',
578
578
  description:
579
- 'Analyze an image with an OpenCode Zen multimodal model confirmed by the current V2 model catalog. ' +
579
+ 'Analyze an image with an OpenCode Zen multimodal model confirmed by the current model catalog. ' +
580
580
  'Prefers the OpenCode Go MiMo 2.6 Flash model and falls back to another live image-capable Zen model. ' +
581
581
  'Free-tier models are excluded (the direct gateway rejects them). ' +
582
582
  'Accepts a local path, file URL, public HTTP(S) URL, or base64 image data URI.',