pantheon-opencode 2.1.5 → 2.2.0-beta.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.
Files changed (38) hide show
  1. package/AGENTS.global.md +1 -1
  2. package/AGENTS.md +1 -1
  3. package/CHANGELOG.md +58 -0
  4. package/README.md +60 -242
  5. package/README.pt-BR.md +64 -220
  6. package/package.json +7 -1
  7. package/plugin.json +1 -1
  8. package/pyproject.toml +1 -1
  9. package/scripts/build-plugin.mjs +1 -1
  10. package/scripts/install/opencode.mjs +12 -0
  11. package/scripts/install-mcp.mjs +55 -27
  12. package/src/agents/roster.json +562 -0
  13. package/src/agents/zeus.md +4 -1
  14. package/src/instructions/backend-standards.instructions.md +5 -0
  15. package/src/mcp/pantheon-mcp-server.mjs +508 -0
  16. package/src/mcp/pantheon_vision.py +4 -1
  17. package/src/pantheon/deepwork/deepwork-tool.ts +23 -75
  18. package/src/pantheon/deepwork/plan-schema.ts +4 -2
  19. package/src/pantheon/deepwork/plan-tracker.ts +380 -90
  20. package/src/pantheon/jev-decision-tool.ts +1 -7
  21. package/src/pantheon/local-decision-tool.ts +1 -1
  22. package/src/pantheon/native-vision.ts +1 -1
  23. package/src/pantheon/skill-search-tool.ts +118 -44
  24. package/src/pantheon/tool-context.ts +23 -0
  25. package/src/pantheon/tools.ts +46 -42
  26. package/src/plugin/index.js +9008 -361
  27. package/src/plugin/index.ts +42 -14
  28. package/src/plugin.ts +53 -1
  29. package/src/plugins/tui/dist/tui.d.ts +73 -6
  30. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  31. package/src/plugins/tui/dist/tui.js +1201 -444
  32. package/src/plugins/tui/dist/tui.js.map +1 -1
  33. package/src/plugins/tui/package-lock.json +2 -2
  34. package/src/plugins/tui/package.json +1 -1
  35. package/src/plugins/tui/src/index.tsx +639 -116
  36. package/src/plugins/tui/src/pantheon-settings.tsx +64 -13
  37. package/src/plugins/tui/src/quota-state.ts +128 -0
  38. package/src/plugins/tui/src/tui-prefs.ts +164 -21
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import { z } from 'zod'
9
- import type { ToolContextLike } from '../tool-context.ts'
9
+ import { resolveToolCwd } from '../tool-context.ts'
10
10
  import type { V2ToolDef, V2ToolResult } from '../tools.ts'
11
11
  import {
12
12
  buildApprovalQuestion,
@@ -15,14 +15,15 @@ import {
15
15
  } from './plan-projection.ts'
16
16
  import {
17
17
  appendJournal,
18
- computeTaskReadiness,
19
18
  deepworkPlanJsonPath,
20
19
  deepworkPlanMdPath,
21
20
  listPlans,
21
+ normalizePlanData,
22
22
  readPlan,
23
23
  resolvePlanDecision,
24
24
  updateTaskState,
25
25
  verifyTaskAcceptance,
26
+ withPlanLock,
26
27
  writePlan,
27
28
  } from './plan-tracker.ts'
28
29
 
@@ -140,10 +141,7 @@ export function createDeepworkTool(cwd = process.cwd()): V2ToolDef {
140
141
  output: {},
141
142
  async execute(input: Record<string, unknown>, context: unknown): Promise<V2ToolResult> {
142
143
  const parsed = DeepworkToolInputSchema.parse(input)
143
- const effectiveCwd =
144
- typeof (context as ToolContextLike)?.directory === 'string'
145
- ? (context as ToolContextLike).directory
146
- : cwd
144
+ const effectiveCwd = resolveToolCwd(context, cwd)
147
145
 
148
146
  if (parsed.action === 'list') {
149
147
  const plans = await listPlans(effectiveCwd)
@@ -175,81 +173,31 @@ export function createDeepworkTool(cwd = process.cwd()): V2ToolDef {
175
173
  }
176
174
 
177
175
  if (parsed.action === 'init') {
178
- const title = parsed.title?.trim() || slug
179
- const intent = parsed.intent?.trim() || 'Plano de deepwork estruturado.'
180
- const rawTasks = parsed.tasks ?? []
181
- const rawDecisions = parsed.decisions ?? []
182
- const doneWhen = parsed.done_when ?? []
183
-
184
- const tasks = rawTasks.map((t, idx) => ({
185
- id: typeof t.id === 'string' ? t.id : `T${String(idx + 1).padStart(2, '0')}`,
186
- title: typeof t.title === 'string' ? t.title : `Task ${idx + 1}`,
187
- description: typeof t.description === 'string' ? t.description : undefined,
188
- agent: typeof t.agent === 'string' ? t.agent : 'zeus',
189
- phase: typeof t.phase === 'number' ? t.phase : 1,
190
- state: (typeof t.state === 'string' ? t.state : 'pending') as
191
- | 'pending'
192
- | 'ready'
193
- | 'in_progress'
194
- | 'done'
195
- | 'failed'
196
- | 'blocked',
197
- depends_on: Array.isArray(t.depends_on) ? (t.depends_on as string[]) : [],
198
- parallel_safe: Boolean(t.parallel_safe),
199
- acceptance: Array.isArray(t.acceptance)
200
- ? (
201
- t.acceptance as Array<{
202
- kind: 'test' | 'command' | 'file' | 'manual'
203
- check: string
204
- fails_now?: boolean
205
- verified?: boolean
206
- proof?: string
207
- }>
208
- ).map((a) => ({
209
- kind: a.kind || 'command',
210
- check: a.check || 'verify',
211
- fails_now: a.fails_now ?? true,
212
- verified: a.verified ?? false,
213
- proof: a.proof,
214
- }))
215
- : [],
216
- }))
217
-
218
- const decisions = rawDecisions.map((d, idx) => ({
219
- id: typeof d.id === 'string' ? d.id : `D${String(idx + 1).padStart(2, '0')}`,
220
- question: typeof d.question === 'string' ? d.question : 'Decisão necessária',
221
- options: Array.isArray(d.options) ? (d.options as string[]) : ['Sim', 'Não'],
222
- chosen: typeof d.chosen === 'string' ? d.chosen : undefined,
223
- status: (d.chosen ? 'resolved' : 'pending') as 'pending' | 'resolved',
224
- }))
225
-
226
- const initialPlan = computeTaskReadiness({
227
- plan_id: slug,
228
- title,
229
- intent,
230
- done_when: doneWhen,
231
- decisions_needed: decisions,
232
- risks: [],
233
- out_of_scope: [],
234
- tasks,
235
- metadata: {
236
- created_at: new Date().toISOString(),
237
- updated_at: new Date().toISOString(),
238
- version: 1,
176
+ const initialPlan = normalizePlanData(
177
+ {
178
+ plan_id: slug,
179
+ title: parsed.title,
180
+ intent: parsed.intent,
181
+ done_when: parsed.done_when,
182
+ decisions_needed: parsed.decisions,
183
+ tasks: parsed.tasks,
239
184
  },
240
- })
185
+ slug,
186
+ )
241
187
 
242
- await writePlan(effectiveCwd, initialPlan)
243
- await appendJournal(effectiveCwd, slug, {
244
- type: 'plan_created',
245
- timestamp: new Date().toISOString(),
246
- payload: { slug, title, tasks_count: tasks.length },
188
+ await withPlanLock(effectiveCwd, slug, async () => {
189
+ await writePlan(effectiveCwd, initialPlan)
190
+ await appendJournal(effectiveCwd, slug, {
191
+ type: 'plan_created',
192
+ timestamp: new Date().toISOString(),
193
+ payload: { slug, title: initialPlan.title, tasks_count: initialPlan.tasks.length },
194
+ })
247
195
  })
248
196
 
249
197
  const projection = generateChatProjection(initialPlan, effectiveCwd)
250
198
  const approvalQ = buildApprovalQuestion(initialPlan)
251
199
  const todoPayload = {
252
- todos: tasks.map((t) => ({
200
+ todos: initialPlan.tasks.map((t) => ({
253
201
  content: `[${t.id}] ${t.title}`,
254
202
  status:
255
203
  t.state === 'done'
@@ -262,7 +210,7 @@ export function createDeepworkTool(cwd = process.cwd()): V2ToolDef {
262
210
 
263
211
  return {
264
212
  output: [
265
- `✅ Plano de Deepwork '${title}' inicializado com sucesso em \`.pantheon/deepwork/${slug}/\`!`,
213
+ `✅ Plano de Deepwork '${initialPlan.title}' inicializado com sucesso em \`.pantheon/deepwork/${slug}/\`!`,
266
214
  `- 🔗 **Deeplink PLAN.md:** [Abrir PLAN.md](file://${deepworkPlanMdPath(effectiveCwd, slug)})`,
267
215
  `- 🔗 **Deeplink plan.json:** [Abrir plan.json](file://${deepworkPlanJsonPath(effectiveCwd, slug)})`,
268
216
  '',
@@ -55,9 +55,11 @@ export type DecisionStatus = z.infer<typeof DecisionStatusSchema>
55
55
  export const PlanDecisionSchema = z.object({
56
56
  id: z.string().min(1),
57
57
  question: z.string().min(1),
58
- options: z.array(z.string()).min(2),
58
+ options: z.array(z.string()).default([]),
59
59
  chosen: z.string().optional(),
60
+ choice: z.string().optional(),
60
61
  status: DecisionStatusSchema.default('pending'),
62
+ resolved_at: z.string().optional(),
61
63
  })
62
64
  export type PlanDecision = z.infer<typeof PlanDecisionSchema>
63
65
 
@@ -78,7 +80,7 @@ export type PlanMetadata = z.infer<typeof PlanMetadataSchema>
78
80
  export const DeepworkPlanSchema = z.object({
79
81
  plan_id: z.string().min(1),
80
82
  title: z.string().min(1),
81
- intent: z.string().min(1),
83
+ intent: z.string().default('Plano de deepwork estruturado.'),
82
84
  done_when: z.array(z.string()).default([]),
83
85
  decisions_needed: z.array(PlanDecisionSchema).default([]),
84
86
  risks: z.array(PlanRiskSchema).default([]),