opencodekit 0.15.10 → 0.15.12

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.
@@ -0,0 +1,126 @@
1
+ # OpenCode MCP Bug Report
2
+
3
+ ## Title
4
+
5
+ MCP tool calls fail with `TypeError: undefined is not an object (evaluating 'output.output.includes')` despite successful connection
6
+
7
+ ## Environment
8
+
9
+ - **OpenCode version**: 1.1.36
10
+ - **OS**: macOS (darwin)
11
+ - **Node version**: (run `node --version` to fill in)
12
+
13
+ ## MCP Servers Affected
14
+
15
+ - `context7` (https://mcp.context7.com/mcp)
16
+ - `gh_grep` (https://mcp.grep.app)
17
+
18
+ ## Description
19
+
20
+ MCP tool calls from the AI agent fail with a TypeError, even though the MCP servers connect successfully and respond with HTTP 200 OK.
21
+
22
+ ## Steps to Reproduce
23
+
24
+ 1. Configure MCP servers in `opencode.json`:
25
+
26
+ ```json
27
+ {
28
+ "mcp": {
29
+ "context7": {
30
+ "type": "remote",
31
+ "url": "https://mcp.context7.com/mcp",
32
+ "headers": {
33
+ "CONTEXT7_API_KEY": "{env:CONTEXT7_API_KEY}"
34
+ }
35
+ },
36
+ "gh_grep": {
37
+ "type": "remote",
38
+ "url": "https://mcp.grep.app"
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ 2. Set the `CONTEXT7_API_KEY` environment variable
45
+
46
+ 3. Verify MCP servers are connected:
47
+
48
+ ```bash
49
+ $ opencode mcp list
50
+ ✓ context7 connected - https://mcp.context7.com/mcp
51
+ ✓ gh_grep connected - https://mcp.grep.app
52
+ ```
53
+
54
+ 4. Debug shows successful connection:
55
+
56
+ ```bash
57
+ $ opencode mcp debug context7
58
+ HTTP response: 200 OK
59
+ Server info: name=Context7, version=2.0.2
60
+
61
+ $ opencode mcp debug gh_grep
62
+ HTTP response: 200 OK
63
+ ```
64
+
65
+ 5. Use the AI agent to call a tool:
66
+
67
+ ```
68
+ context7_resolve-library-id(query="React hooks", libraryName="react")
69
+ ```
70
+
71
+ ## Expected Behavior
72
+
73
+ The tool should return library information from Context7.
74
+
75
+ ## Actual Behavior
76
+
77
+ ```
78
+ TypeError: undefined is not an object (evaluating 'output.output.includes')
79
+ ```
80
+
81
+ ## Analysis
82
+
83
+ The error `output.output.includes` suggests there's code in OpenCode that does something like:
84
+
85
+ ```javascript
86
+ if (output.output.includes(...)) { ... }
87
+ ```
88
+
89
+ When `output` is undefined or doesn't have an `output` property, this crashes.
90
+
91
+ The bug is in **OpenCode's tool response handler**, not the MCP connection layer, because:
92
+
93
+ 1. `opencode mcp list` shows both servers as "connected"
94
+ 2. `opencode mcp debug` shows HTTP 200 OK responses
95
+ 3. The error happens only when the AI agent calls the tool
96
+
97
+ ## Workaround
98
+
99
+ Use alternative tools that don't go through MCP:
100
+
101
+ - `codesearch` (Exa Code API) - works
102
+ - `websearch` (Exa Web Search) - works
103
+
104
+ ## Related Issues
105
+
106
+ - #6972 - May be related to Accept header issues
107
+ - #834 - SSE transport issues
108
+
109
+ ## Additional Context
110
+
111
+ Log entries show benign errors that don't cause the crash:
112
+
113
+ ```
114
+ ERROR service=mcp clientName=context7 error=MCP error -32601: Method not found failed to get prompts
115
+ ```
116
+
117
+ This is expected (prompts method not implemented), but the TypeError happens later in the response processing pipeline.
118
+
119
+ ---
120
+
121
+ ## How to File
122
+
123
+ 1. Go to: https://github.com/anomalyco/opencode/issues/new
124
+ 2. Title: `MCP tool calls fail with TypeError: output.output.includes despite successful connection`
125
+ 3. Copy the content above
126
+ 4. Add labels: `bug`, `mcp`
@@ -10,11 +10,11 @@
10
10
  },
11
11
  "explore": {
12
12
  "description": "Fast codebase search specialist",
13
- "model": "opencode/grok-code"
13
+ "model": "opencode/big-pickle"
14
14
  },
15
15
  "general": {
16
16
  "description": "General-purpose subagent for fast, well-defined tasks; delegates complexity quickly",
17
- "model": "opencode/grok-code"
17
+ "model": "opencode/big-pickle"
18
18
  },
19
19
  "looker": {
20
20
  "description": "Media extraction specialist for images, PDFs, diagrams",
@@ -49,22 +49,53 @@
49
49
  "experimental": {},
50
50
  "formatter": {
51
51
  "biome": {
52
- "command": ["npx", "@biomejs/biome", "check", "--write", "$FILE"],
53
- "extensions": [".js", ".jsx", ".ts", ".tsx", ".json", ".jsonc"]
52
+ "command": [
53
+ "npx",
54
+ "@biomejs/biome",
55
+ "check",
56
+ "--write",
57
+ "$FILE"
58
+ ],
59
+ "extensions": [
60
+ ".js",
61
+ ".jsx",
62
+ ".ts",
63
+ ".tsx",
64
+ ".json",
65
+ ".jsonc"
66
+ ]
54
67
  },
55
68
  "cargo-fmt": {
56
- "command": ["cargo", "fmt", "--", "$FILE"],
57
- "extensions": [".rs"]
69
+ "command": [
70
+ "cargo",
71
+ "fmt",
72
+ "--",
73
+ "$FILE"
74
+ ],
75
+ "extensions": [
76
+ ".rs"
77
+ ]
58
78
  },
59
79
  "java-formatter": {
60
- "command": ["google-java-format", "--replace", "$FILE"],
80
+ "command": [
81
+ "google-java-format",
82
+ "--replace",
83
+ "$FILE"
84
+ ],
61
85
  "environment": {
62
86
  "JAVA_HOME": "{env:JAVA_HOME}"
63
87
  },
64
- "extensions": [".java"]
88
+ "extensions": [
89
+ ".java"
90
+ ]
65
91
  },
66
92
  "oxfmt": {
67
- "command": ["npx", "oxfmt", "--write", "$FILE"],
93
+ "command": [
94
+ "npx",
95
+ "oxfmt",
96
+ "--write",
97
+ "$FILE"
98
+ ],
68
99
  "extensions": [
69
100
  ".js",
70
101
  ".jsx",
@@ -83,11 +114,22 @@
83
114
  ]
84
115
  },
85
116
  "laravel-pint": {
86
- "command": ["npx", "laravel-pint", "--preset", "psr12", "$FILE"],
87
- "extensions": [".php"]
117
+ "command": [
118
+ "npx",
119
+ "laravel-pint",
120
+ "--preset",
121
+ "psr12",
122
+ "$FILE"
123
+ ],
124
+ "extensions": [
125
+ ".php"
126
+ ]
88
127
  }
89
128
  },
90
- "instructions": [".opencode/memory/user.md", ".opencode/memory/project/*.md"],
129
+ "instructions": [
130
+ ".opencode/memory/user.md",
131
+ ".opencode/memory/project/*.md"
132
+ ],
91
133
  "keybinds": {
92
134
  "command_list": ";",
93
135
  "leader": "`",
@@ -97,18 +139,13 @@
97
139
  },
98
140
  "mcp": {
99
141
  "context7": {
100
- "command": [
101
- "npx",
102
- "-y",
103
- "@upstash/context7-mcp",
104
- "--api-key",
105
- "{env:CONTEXT7_API_KEY}"
106
- ],
107
- "enabled": true,
108
- "type": "local"
142
+ "type": "remote",
143
+ "url": "https://mcp.context7.com/mcp",
144
+ "headers": {
145
+ "CONTEXT7_API_KEY": "{env:CONTEXT7_API_KEY}"
146
+ }
109
147
  },
110
148
  "gh_grep": {
111
- "enabled": true,
112
149
  "type": "remote",
113
150
  "url": "https://mcp.grep.app"
114
151
  },
@@ -301,13 +338,17 @@
301
338
  "disabled": true
302
339
  },
303
340
  "high": {
304
- "include": ["reasoning.encrypted_content"],
341
+ "include": [
342
+ "reasoning.encrypted_content"
343
+ ],
305
344
  "reasoningEffort": "high",
306
345
  "reasoningSummary": "auto",
307
346
  "textVerbosity": "low"
308
347
  },
309
348
  "medium": {
310
- "include": ["reasoning.encrypted_content"],
349
+ "include": [
350
+ "reasoning.encrypted_content"
351
+ ],
311
352
  "reasoningEffort": "medium",
312
353
  "reasoningSummary": "auto",
313
354
  "textVerbosity": "low"
@@ -320,13 +361,17 @@
320
361
  "disabled": true
321
362
  },
322
363
  "high": {
323
- "include": ["reasoning.encrypted_content"],
364
+ "include": [
365
+ "reasoning.encrypted_content"
366
+ ],
324
367
  "reasoningEffort": "high",
325
368
  "reasoningSummary": "auto",
326
369
  "textVerbosity": "low"
327
370
  },
328
371
  "medium": {
329
- "include": ["reasoning.encrypted_content"],
372
+ "include": [
373
+ "reasoning.encrypted_content"
374
+ ],
330
375
  "reasoningEffort": "medium",
331
376
  "reasoningSummary": "auto",
332
377
  "textVerbosity": "low"
@@ -357,8 +402,14 @@
357
402
  },
358
403
  "name": "Gemini 2 5 Computer Use Preview 10 2025",
359
404
  "modalities": {
360
- "input": ["text", "image", "pdf"],
361
- "output": ["text"]
405
+ "input": [
406
+ "text",
407
+ "image",
408
+ "pdf"
409
+ ],
410
+ "output": [
411
+ "text"
412
+ ]
362
413
  }
363
414
  },
364
415
  "gemini-2.5-flash": {
@@ -368,8 +419,14 @@
368
419
  },
369
420
  "name": "Gemini 2 5 Flash",
370
421
  "modalities": {
371
- "input": ["text", "image", "pdf"],
372
- "output": ["text"]
422
+ "input": [
423
+ "text",
424
+ "image",
425
+ "pdf"
426
+ ],
427
+ "output": [
428
+ "text"
429
+ ]
373
430
  }
374
431
  },
375
432
  "gemini-2.5-flash-lite": {
@@ -379,8 +436,14 @@
379
436
  },
380
437
  "name": "Gemini 2 5 Flash Lite",
381
438
  "modalities": {
382
- "input": ["text", "image", "pdf"],
383
- "output": ["text"]
439
+ "input": [
440
+ "text",
441
+ "image",
442
+ "pdf"
443
+ ],
444
+ "output": [
445
+ "text"
446
+ ]
384
447
  }
385
448
  },
386
449
  "gemini-2.5-pro": {
@@ -390,8 +453,14 @@
390
453
  },
391
454
  "name": "Gemini 2 5 Pro",
392
455
  "modalities": {
393
- "input": ["text", "image", "pdf"],
394
- "output": ["text"]
456
+ "input": [
457
+ "text",
458
+ "image",
459
+ "pdf"
460
+ ],
461
+ "output": [
462
+ "text"
463
+ ]
395
464
  }
396
465
  },
397
466
  "gemini-3-flash-preview": {
@@ -401,8 +470,14 @@
401
470
  },
402
471
  "name": "Gemini 3 Flash Preview",
403
472
  "modalities": {
404
- "input": ["text", "image", "pdf"],
405
- "output": ["text"]
473
+ "input": [
474
+ "text",
475
+ "image",
476
+ "pdf"
477
+ ],
478
+ "output": [
479
+ "text"
480
+ ]
406
481
  },
407
482
  "variants": {
408
483
  "low": {
@@ -424,8 +499,14 @@
424
499
  },
425
500
  "name": "Gemini 3 Pro Image Preview",
426
501
  "modalities": {
427
- "input": ["text", "image", "pdf"],
428
- "output": ["text"]
502
+ "input": [
503
+ "text",
504
+ "image",
505
+ "pdf"
506
+ ],
507
+ "output": [
508
+ "text"
509
+ ]
429
510
  }
430
511
  },
431
512
  "gemini-3-pro-preview": {
@@ -435,8 +516,14 @@
435
516
  },
436
517
  "name": "Gemini 3 Pro Preview",
437
518
  "modalities": {
438
- "input": ["text", "image", "pdf"],
439
- "output": ["text"]
519
+ "input": [
520
+ "text",
521
+ "image",
522
+ "pdf"
523
+ ],
524
+ "output": [
525
+ "text"
526
+ ]
440
527
  },
441
528
  "variants": {
442
529
  "low": {
@@ -454,8 +541,14 @@
454
541
  "output": 64000
455
542
  },
456
543
  "modalities": {
457
- "input": ["text", "image", "pdf"],
458
- "output": ["text"]
544
+ "input": [
545
+ "text",
546
+ "image",
547
+ "pdf"
548
+ ],
549
+ "output": [
550
+ "text"
551
+ ]
459
552
  },
460
553
  "name": "Gemini Claude Opus 4 5 Thinking",
461
554
  "variants": {
@@ -478,8 +571,14 @@
478
571
  "output": 64000
479
572
  },
480
573
  "modalities": {
481
- "input": ["text", "image", "pdf"],
482
- "output": ["text"]
574
+ "input": [
575
+ "text",
576
+ "image",
577
+ "pdf"
578
+ ],
579
+ "output": [
580
+ "text"
581
+ ]
483
582
  },
484
583
  "name": "Gemini Claude Sonnet 4 5"
485
584
  },
@@ -489,8 +588,14 @@
489
588
  "output": 64000
490
589
  },
491
590
  "modalities": {
492
- "input": ["text", "image", "pdf"],
493
- "output": ["text"]
591
+ "input": [
592
+ "text",
593
+ "image",
594
+ "pdf"
595
+ ],
596
+ "output": [
597
+ "text"
598
+ ]
494
599
  },
495
600
  "name": "Gemini Claude Sonnet 4 5 Thinking",
496
601
  "variants": {
@@ -11,7 +11,7 @@
11
11
  "type-check": "tsc --noEmit"
12
12
  },
13
13
  "dependencies": {
14
- "@opencode-ai/plugin": "1.1.34"
14
+ "@opencode-ai/plugin": "1.1.39"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@types/node": "^25.0.3",
@@ -0,0 +1,123 @@
1
+ # Swarm Protocol (Beads-as-Board)
2
+
3
+ ## Goal
4
+
5
+ Use `.beads/` as the single source of truth for task state + dependencies, while agents coordinate through structured artifacts (not freeform chatter) and verification gates.
6
+
7
+ ## Roles (Strict)
8
+
9
+ - Lead: Owns scope, prioritization, and all Beads state transitions.
10
+ - Planner: Turns intent into Beads tasks + dependency DAG; no code changes.
11
+ - Worker: Executes exactly one claimed task; posts a structured report.
12
+ - Verifier: Independently validates acceptance checks; blocks close on missing evidence.
13
+
14
+ ## Board = Beads
15
+
16
+ Canonical state lives in `.beads/issues.jsonl` (tasks) and `.beads/artifacts/<id>/` (task artifacts).
17
+
18
+ - Create tasks: `bd create "Title" -p <1-3>`
19
+ - See unblocked work: `bd ready`
20
+ - Inspect context: `bd show <id>`
21
+ - Claim work: `bd update <id> --status=in_progress`
22
+ - Close work: `bd close <id> --reason="..."` then `bd sync`
23
+
24
+ ## Task Artifact Contract
25
+
26
+ Every task MUST have `.beads/artifacts/<id>/spec.md`.
27
+
28
+ Optional supporting files:
29
+
30
+ - `.beads/artifacts/<id>/plan.md`: multi-step implementation plan, files touched, and gates
31
+ - `.beads/artifacts/<id>/review.md`: verifier notes + evidence summary
32
+
33
+ ### spec.md (Minimum Template)
34
+
35
+ - Context: why this exists
36
+ - Scope: in / out
37
+ - Constraints: MUST / MUST NOT (security, deps, dist/, etc.)
38
+ - Acceptance Criteria: checkboxes, each with a verification method
39
+ - Evidence Required: exact commands and expected signals (e.g. "typecheck command passes")
40
+
41
+ #### Verification Defaults (Language-Agnostic)
42
+
43
+ Do NOT assume npm/bun/pytest/etc. Prefer this pattern:
44
+
45
+ - `typecheck`: `<command>`
46
+ - `lint`: `<command>`
47
+ - `test`: `<command>`
48
+ - `build` (optional): `<command>`
49
+
50
+ If the repository has a canonical list of commands, reference it (e.g. `.opencode/memory/project/commands.md`).
51
+
52
+ Common stacks (examples only):
53
+
54
+ | Stack | typecheck | lint | test |
55
+ | ------- | ------------------------------------------ | ---------------------------- | ------------------------ |
56
+ | Node/TS | `npm run typecheck` or `bun run typecheck` | `npm run lint` | `bun test` or `npm test` |
57
+ | Python | `python -m mypy .` | `ruff check .` | `pytest` |
58
+ | Go | `go test ./...` (compile+test) | `golangci-lint run` | `go test ./...` |
59
+ | Rust | `cargo check` | `cargo fmt --check` (format) | `cargo test` |
60
+
61
+ ## Delegation Packet (Worker Input)
62
+
63
+ Every delegated task MUST include the following envelope:
64
+
65
+ - TASK: `<id> - <title>`
66
+ - EXPECTED OUTCOME: measurable end state
67
+ - REQUIRED TOOLS: e.g. `read`, `grep`, `lsp`, `bash`
68
+ - MUST DO: e.g. LSP-before-edits, run typecheck, run lint
69
+ - MUST NOT DO: e.g. no new deps, no dist/ edits, no git push
70
+ - ACCEPTANCE CHECKS: list of commands + pass criteria
71
+ - CONTEXT: links to `.beads/artifacts/<id>/spec.md` + relevant files
72
+
73
+ ### Helper Tool
74
+
75
+ If available, use the custom tool `swarm-delegate` to generate (and optionally write) a delegation packet:
76
+
77
+ ```ts
78
+ swarm -
79
+ delegate({
80
+ bead_id: "opencodekit-template-xyz",
81
+ expected_outcome: "<measurable end state>",
82
+ required_tools: "read, grep, lsp, bash",
83
+ must_do: "LSP before edits, run project verification commands",
84
+ must_not_do: "no new deps, don't edit dist/",
85
+ acceptance_checks: "typecheck: <command>, lint: <command>, test: <command>",
86
+ context: "See .beads/artifacts/<id>/spec.md",
87
+ write: true,
88
+ });
89
+ ```
90
+
91
+ ## Worker Report (Worker Output)
92
+
93
+ Workers MUST respond with a structured report:
94
+
95
+ - Result: done / blocked / needs replan
96
+ - Changes: file list + what changed (with file references)
97
+ - Verification: commands run + pass/fail summary
98
+ - Risks/Notes: edge cases, follow-ups
99
+ - Confidence: high / medium / low
100
+
101
+ ## Gates (Non-Negotiable)
102
+
103
+ - Planning gate: `.beads/artifacts/<id>/spec.md` exists with acceptance criteria BEFORE implementation starts
104
+ - Execution gate: worker provides verification evidence BEFORE close
105
+ - Review gate (risk-based): verifier signs off in `review.md` BEFORE close
106
+
107
+ ## Replan Triggers
108
+
109
+ Immediately stop execution and return to planning if:
110
+
111
+ - Scope expands to 4+ files unexpectedly
112
+ - Requirement ambiguity changes implementation choice
113
+ - Two-strike tool failures
114
+ - New dependency or `.opencode/` structure change would be needed
115
+
116
+ ## Lead Checklist
117
+
118
+ 1. `bd ready` -> pick task -> `bd show <id>`
119
+ 2. Ensure `.beads/artifacts/<id>/spec.md` has acceptance checks
120
+ 3. `bd update <id> --status=in_progress`
121
+ 4. Delegate with the packet format
122
+ 5. Require worker report + evidence
123
+ 6. `bd close <id> --reason="..."` + `bd sync`
@@ -80,6 +80,16 @@ Session 3: read_session("previous") → Tests (90k) → close
80
80
  - High-priority or in-progress TODOs → Inject continuation prompt
81
81
  - Low-priority pending TODOs → OS notification only (no forced continuation)
82
82
 
83
+ ### swarm-enforcer.ts
84
+
85
+ **Swarm protocol guardrails (Beads-as-board)** - nudges agents to follow the Beads-first workflow.
86
+
87
+ - Treats `.beads/` as the single source of truth for the swarm task board
88
+ - If user expresses implementation intent and no task is `in_progress`, injects a nudge to use `bd ready/show/update`
89
+ - If there are `in_progress` tasks but `.beads/artifacts/<id>/spec.md` is missing, nudges to create it before implementation
90
+ - On `file.edited`, warns if code is being changed without a claimed task or with missing `spec.md`
91
+ - On `session.idle`, reminds to `bd close` + `bd sync` when work is done
92
+
83
93
  ### notification.ts
84
94
 
85
95
  **Session completion alerts** - sends native notifications when AI finishes.