GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: experimental codemode by rekram1-node · Pull Request #34677 · anomalyco/opencode

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Jun 30, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Closes: #9461
Closes: #34787
Closes: #8625

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
rekram1-node added 25 commits June 29, 2026 18:18
@rekram1-node
feat(opencode): add experimental code mode execute tool
49f20b6
Add an experimental, off-by-default `execute` tool that runs LLM-authored
JavaScript with a `tools.<name>(args)` proxy over connected MCP tools. When
OPENCODE_EXPERIMENTAL_CODE_MODE is enabled and MCP tools are present, the
session exposes the single code-mode tool instead of registering each MCP
tool directly; child calls route through the native permission path.

Code mode is defined via the standard Tool.define/Tool.init machinery so it
inherits arg decoding and output truncation from the shared wrapper. Tool
results are reduced to structured content or text, and the program's return
value is coerced to text without failing on shape.

Note: execution currently uses an in-process AsyncFunction with no isolation
or timeout; sandboxing is tracked as follow-up work.
@rekram1-node
feat(opencode): namespace code mode tools by MCP server
b0aa6bf
Expose connected MCP tools to code mode as per-server namespaces
(`tools.<server>.<tool>(args)`) and generate the execute tool description
from the catalog: one namespace block per server, each tool rendered with a
TypeScript-style input signature derived from its JSON schema plus its
description, and the calling convention stated up front.

The server/tool split is cosmetic; child-call routing re-joins the segments
into the existing flat catalog key, so it stays exact regardless of
underscores in server or tool names.
@rekram1-node
feat(opencode): progressive tool discovery for code mode
cad83ab
Shrink the execute tool description to namespaces only (server name, tool
count, and a brief note reused from the server's MCP instructions) instead of
inlining every tool signature, so the prompt stays small for large catalogs.

Add in-sandbox discovery: `tools.search(query, { namespace?, limit? })` returns
ranked tool paths + descriptions, and `tools.describe(path)` returns the full
signature and input schema on demand (with tool_not_found suggestions). The
proxy is now recursive so both `tools.<server>.<tool>(args)` and the dotted
`tools[path](args)` returned by search resolve to the catalog key.
@rekram1-node
refactor(opencode): simplify code mode namespace listing
caa5f28
Drop the MCP-instructions blending from the execute tool description; just
list namespace names and tool counts on the tool definition. The full server
instructions already live in the system prompt's <mcp_instructions>, and
per-tool detail is fetched on demand via tools.search/tools.describe.
@rekram1-node
chore(opencode): vendor rune interpreter for code mode
3a6621c
Copy the Rune TS AST interpreter into the session package as the
foundation for code-mode execution. Add acorn as a dependency and
promote typescript to a runtime dependency (both required by Rune's
parser/transpile path). Fix effect beta.83 API drift (Schema.Defect
is now a function). Interpreter logic is unchanged; nothing imports
it yet.
@rekram1-node
feat(opencode): code mode result+attachments envelope and typed describe
14527d2
Expose mcp.defs() so code mode can read MCP outputSchema. Tool calls and
the final return now use one { result, attachments? } envelope; media
blocks become FilePart attachments. describe renders typed signatures
with the structured return type when an outputSchema is present.
@rekram1-node
feat(opencode): run code mode on the vendored rune interpreter
71ffc73
Replace the in-process AsyncFunction engine with Rune.execute. MCP tools
are exposed as a host-tool tree (tools.<server>.<tool>) plus top-level
search/describe; each call is permission-gated and coerced to the
{ result, attachments? } envelope. Raise data limits for base64 media.

This adds real sandboxing: host globals are isolated and runaway loops
terminate via the operation limit instead of hanging the event loop.
@rekram1-node
feat(opencode): budgeted tool preview in code mode description
1448f24
Always list every MCP namespace, then inline a preview of individual
tools (path + brief) until a character budget is hit; remaining
namespaces show counts only. Front-loads a useful slice of the catalog
to cut discovery round-trips without dumping the full tool list.
@rekram1-node
test(opencode): end-to-end code mode test over a real MCP server
acc1742
Stand up an in-memory MCP server with text, structured (outputSchema),
image, and failing tools, wire it through convertTool + define, and
exercise search/describe, the result+attachments envelope, structured
composition, image forwarding/suppression, parallel calls, error
propagation, and per-call permission gating.
@rekram1-node
feat(opencode): tokenized, ranked tool search in code mode
ba12049
Replace the contiguous-substring search with tokenized, field-weighted
scoring adapted from the deferred-tool-search bridge (#34368): exact tool
name > path > description > indexed parameter text, summed across terms
and ranked by relevance. Index each tool's parameter names/descriptions
so tools are findable by their inputs. Keep the namespace filter and
{ items, total } shape. Add unit + end-to-end search tests.
@rekram1-node
feat(opencode): unify code mode discovery under tools.$rune
a3bfba8
Remove Rune's vestigial built-in $rune.search/$rune.describe (which only
saw effect-Schema Definitions, never our dynamic MCP tools) and the
reserved-namespace guard. Move our ranked search and typed describe under
tools.$rune.* — the runtime's own namespace, separate from MCP server
namespaces and collision-proof since $ never appears in a sanitized
server name. One discovery implementation, no dead code.
@rekram1-node
refactor(opencode): single source of discovery docs, clearer attachme…
cbcc67b
…nt wording

- Reword the attachment line in the execute description: attachments are
  opaque media handles you forward to the user, not byte-readable in code.
- Strip the hardcoded tools.$rune.search/describe block from the runtime's
  instructions(): discovery is not a runtime feature (the embedder registers
  and documents it), and the baked-in object-arg form contradicted code
  mode's positional API. Removes the only prompt discrepancy.
- Make the runtime's unknown-tool suggestion generic instead of naming $rune.

Discovery is now documented in exactly one place (code-mode describe()).
@rekram1-node
fix(opencode): describe attachments as routable values, not opaque
79275e6
The previous wording claimed attachment bytes 'aren't available in code',
but a tool result's { result, attachments } envelope is copied straight
into the sandbox (tool-runtime invoke -> checkedCopyIn), so attachment.url
is a real data: URL string the program can read and route — e.g. feed one
tool's media into another tool's input, which is exactly what code mode is
uniquely good at. Reword the description to say so. Still not the emit
pattern: only `result` becomes conversation text; returned attachments
lower to FileParts and nothing else in the sandbox re-enters the chat.

Add an integration test asserting the data URL is readable in-program.
@rekram1-node
docs(opencode): add rune.md (how it works, what's missing)
394c370
@rekram1-node
feat(opencode): inline budgeted call signatures in code mode preview
55aa8cc
The preview previously showed name + prose per tool but no parameters, so
the model couldn't call a tool correctly without a $rune.describe round-trip
(or a failed guess — e.g. calling context7 resolve-library-id with only
libraryName, missing the required query). Replace the prose preview with a
compact, directly-callable input signature:

  tools.context7["resolve-library-id"](input: { query: string; libraryName: string })

All namespaces are still always listed with counts; the budget now caps
inlined signatures, and the description states explicitly that any tool not
shown must be found via $rune.search/$rune.describe first. The full typed
signature (with the Promise return) and schemas remain $rune.describe-only.
@rekram1-node
feat(opencode): state whether the code mode tool list is complete or …
dc75ea0
…partial

The preview now reports its own comprehensiveness so the model knows when it
has the whole catalog vs. when it must search:

- Overall: "This is the COMPLETE list ..." when every tool fits the budget,
  else "This is a PARTIAL list — X of Y tools are shown ...".
- Per namespace: a fully-shown server reads `- github (2 tools)`; a truncated
  one is annotated `- alpha (70 tools, 31 shown)` or `- zeta (1 tool, none shown)`.

When complete, the model isn't pushed toward needless $rune.search calls; when
partial, exactly what's missing is unambiguous.
@rekram1-node
feat: live code-mode execute UI in the TUI
bc427b1
Backend: code-mode execute now streams per-call progress. Metadata.toolCalls
becomes CallEntry[] ({ tool: dotted-path, status: running|completed|error })
and is published via ctx.metadata on every status change — when a child MCP
call starts and when it resolves/fails — so the tool part updates live.

TUI: add an Execute component (dispatched for the "execute" tool). Condensed
view shows a run header (spinner while running, ✓ when done) plus a live `↳`
line per child tool call, colored on failure; clicking toggles a syntax-
highlighted view of the program source. Unlike Task, there is no child session,
so the call list is sourced entirely from the streamed metadata.
@rekram1-node
fix(tui): normalize execute tool styling
2726a74
@rekram1-node
fix(tui): surface execute child call details
05b9346
@rekram1-node
feat(opencode): render code-mode types as TypeScript, not JSON Schema
5085a13
tools.$rune.describe now returns { path, description, signature, input,
output? } with input/output as TypeScript instead of raw JSON Schema.
Rewrite renderType into a total, cycle-safe JSON-Schema -> TS renderer:
resolve local $refs (collapsing recursive refs to their name), render
enums/const as literals, anyOf/oneOf and nullable type arrays as unions,
allOf as an intersection (unwrapping the Pydantic allOf:[{$ref}] shape),
tuples, and additionalProperties as an index signature. Pretty mode emits
JSDoc (multi-line preserved) for described fields, with */ neutralized.
Falls back to any/object and never throws; depth-capped.

Docs updated; code-mode/renderType test coverage expanded.
@rekram1-node
feat(opencode): JSDoc tags, Result<T> return hints, and opaque attach…
c16bba8
…ments

- describe/preview now surface each tool's return type as Result<T> (alias
  defined once in the prompt); the inline preview shows it too, so the model
  sees a tool's result shape without a describe round-trip. T is the declared
  outputSchema else unknown, with prose telling the model to inspect an unknown
  result before assuming fields.
- renderType pretty mode emits JSDoc tags a TS type can't express: @default,
  @Format, @deprecated, @minItems/@Maxitems (multi-line descriptions preserved).
- Attachments are now opaque handles: a tool's media becomes
  { type:'file', id, mime, filename?, bytes } with no inline bytes. Real bytes
  stay host-side in a per-execution attachmentTable; the program propagates or
  drops a handle (return it to surface the image to the model+user) but cannot
  read or leak the base64. Documents the divergence from prior art in rune.md.
- Records the throw/catch (not errors-as-values) decision in rune.md.
@rekram1-node
fix(tui): simplify execute running state
2d9015c
@rekram1-node
feat(opencode): capture console output and surface it to the model
064c34b
- console.log/warn/error/info/debug are now a real Rune interpreter builtin:
  a seeded global that formats its args (strings verbatim, objects/arrays as
  JSON, space-joined) and appends a line to a per-run LogCollector. It is not a
  tool call (spends no tool-call budget), returns undefined, and any other
  member throws. Formatting is charged to maxOperations and total captured
  output is bounded by maxAuditBytes so a logging loop can't exhaust memory.
- The collector is shared by reference with parallel interpreter forks (like the
  operation budget) and lives in execute()'s outer scope, so logs are surfaced
  on every ExecuteResult path — success, thrown error, and timeout.
- ExecuteResult (and its schema) gain a logs field; code mode appends captured
  logs to the model-facing output as a trailing '[level] message' section on
  both the success and error paths (withLogs). Logs go to the model only.
- Documents console in rune.md; drops the now-satisfied 'not done yet' entry.
@rekram1-node
fix(opencode): make Rune tolerate idiomatic defensive JavaScript
cc437b9
Bring the Rune interpreter closer to JS semantics so ordinary defensive code
stops crashing where real JS would quietly yield undefined or succeed:

- Unknown property reads on strings, numbers, and arrays now yield undefined
  instead of throwing (including under optional chaining, which only guards
  null/undefined receivers). MCP results are frequently JSON strings, so
  `result?.field ?? result` reads the field when present and falls back to the
  raw string otherwise. The method allowlist still errors (e.g. arr.splice keeps
  its rewrite hint).
- `typeof undeclaredIdentifier` is now "undefined" rather than a reference
  error, so `typeof x !== "undefined"` feature-detection guards are safe.
- Object spread of null/undefined is a no-op, so `{ ...maybeOpts, override }`
  merges work when the operand is absent.
- Builtin coercions (Boolean/String/Number) are accepted as array callbacks, so
  filter(Boolean) / map(String) / map(Number) work.

Adds rune-parity.test.ts covering each fix plus its guardrails, and documents
the parity behavior in rune.md.
@rekram1-node
fix(opencode): let NaN/Infinity flow in Rune, normalize to null at th…
e06a099
…e boundary

Rune previously threw the instant any non-finite number materialized, which
killed the program before the model's own guard could run — so idiomatic code
like parseInt(x) || 0, Number(x) then Number.isNaN(x), averages, and counters
crashed mid-expression. Real JS (and a real-engine sandbox) let these values
flow and rely on JSON serialization to turn them into null at the edge.

- copyIn no longer rejects non-finite numbers, so NaN/Infinity exist as ordinary
  in-sandbox intermediates and defensive guards can run.
- copyOut normalizes non-finite numbers to null as a value leaves the sandbox;
  final return and tool-call arguments both funnel through it, so one check pins
  both boundaries (matching JSON.stringify, which produces null anyway).
- NaN/Infinity are now bindable identifiers (e.g. reduce(max, -Infinity)).

Extends rune-parity.test.ts (guards run, non-finite -> null out incl. nested, a
direct copyOut unit test) and updates rune.md.
@opencode-agent opencode-agent Bot mentioned this pull request Jul 1, 2026
Design and implement CodeMode runtime + OpenCode MCP adapter #34787
Closed
rekram1-node added 4 commits July 2, 2026 10:58
@rekram1-node
feat(codemode): add @opencode-ai/codemode confined execution package
51ea0ac
Effect-native code execution over explicit schema-described tools: a
hand-rolled interpreter over acorn ASTs (TypeScript stripped via
transpileModule) with forgiving JS semantics, Date/RegExp/Map/Set value
types, first-class promises (eager-fork, budgeted, timeout-interruptible),
Tool.make over Effect Schema or render-only JSON Schema, ranked search
with namespace scoping and exact-path lookup, a budgeted instruction
catalog with workflow/rules prompting, tool-call start/end hooks, and
public limits {timeoutMs, maxToolCalls, maxOutputBytes} with owned
output truncation. Program failures are data, never Effect failures.

156 tests; see packages/codemode/codemode.md for design decisions.
@rekram1-node
feat(opencode): rebuild code mode as an MCP adapter over @opencode-ai…
90b4af6
…/codemode

Replaces the vendored rune interpreter with a thin adapter: MCP defs
become Tool.make definitions grouped as tools.<server>.<tool>, results
prefer structuredContent over joined text, media is stripped host-side
into tool-result attachments (media-only calls return a text marker),
per-child permission asks are preserved, and start/end hooks drive the
existing TUI toolCalls metadata. Deletes src/session/rune/ and moves
acorn/typescript deps into the new package.
@rekram1-node
feat(codemode): simplify limits, enrich search, condense instructions
2a13900
Post-review refinement pass over the initial package:

- Limits are exactly the three public knobs. timeoutMs and maxToolCalls
  have no defaults (absent = unbounded; budgets are host policy); the
  internal limit system (maxOperations, maxDataBytes, maxSourceBytes,
  maxAuditBytes, maxCollectionLength) is deleted — concurrency (8) and
  boundary depth (32) survive as fixed constants. The timeout alone
  interrupts pure busy loops; a regression test locks that in.
- The inline catalog budget is estimated tokens (chars/4, default 2000)
  instead of bytes, selection is round-robin across namespaces so no
  server is starved to a bare count, and every namespace is always
  listed regardless of budget.
- Search-result signatures are JSDoc-annotated: per-field descriptions
  plus @default/@format/@deprecated/@minItems/@Maxitems tags, rendered
  from either schema kind; catalog lines stay compact. The renderer
  gained a recursion ceiling and $ref cycle guard. Search terms also
  match naive singular forms.
- Instructions condensed ~40%: Workflow/Rules deduped, the Syntax
  allowlist inverted to name only what is unusual or missing (and that
  TypeScript annotations are stripped), console/media rules replaced by
  a neutral unknown-shape warning.
@rekram1-node
feat(opencode): run code mode without execution limits
cafcec4
Drop the adapter's 30s timeout — OpenCode passes no limits at all.
Cancelling the tool call interrupts the execution fiber and structured
concurrency takes in-flight child calls down with it; every child call
is permission-gated, and CodeMode's 32KB output truncation remains the
only active bound. Adapter tests track the round-robin catalog and
JSDoc search signatures.
rekram1-node added 13 commits July 2, 2026 19:07
@rekram1-node
feat(codemode): expand JS parity and make output truncation opt-in
560fc7f
Interpreter-surface parity pass:

- Real error values: the seven standard error constructors are callable
  globals; instanceof works for Error types (a specific type matches
  itself and Error, never a sibling) plus Date/RegExp/Map/Set/Array/
  Object/Promise. Caught failures carry the name the equivalent real-JS
  failure would have — JSON.parse and invalid regex patterns are
  SyntaxError, unknown identifiers and TDZ access ReferenceError,
  assignment to a constant TypeError, a bad normalize form RangeError;
  anything without a specific analogue stays plain Error and internal
  class names never leak. JSON.parse failures now include the engine's
  position detail. Error values remain plain { name, message } data;
  the brand rides on a non-enumerable symbol, so serialization is
  unchanged and spread loses it like JS loses the prototype.
- Array splice/fill/copyWithin and keys/values/entries; string
  localeCompare/normalize/trimLeft/trimRight; regex failures now name
  the offending pattern or flags, the engine reason, and how to fix it.
- Sandbox values survive intra-sandbox checkpoints: Object.* helpers,
  coercions, and spread pass Date/RegExp/Map/Set through by reference
  (copyIn gained a preserving mode), so Object.values({d}).getTime()
  works. The host boundary — results, tool arguments, JSON.stringify —
  still serializes JSON forms exactly as documented.
- Console formatting is total and deep: NaN/Infinity print literally,
  nested sandbox values render their friendly forms, opaque references
  become in-place markers, cycles render [Circular]; console can no
  longer fail a program.
- maxOutputBytes lost its 32,000 default, completing uniform no-default
  limits: absent now means no truncation, for hosts that bound tool
  output themselves. Explicit values validate and truncate as before.
@rekram1-node
feat(opencode): rely on native tool-output truncation for code mode
27fbf7c
CodeMode no longer truncates execute output — with no limits passed,
maxOutputBytes is unset and results reach the shared Tool.define
wrapper intact, where OpenCode's native truncation applies to execute
like any other tool (and is the richer layer: full output saved to a
file with a follow-up hint, instead of an inline marker).
@rekram1-node
docs(codemode): fix stale claims, log wiring-review findings
231144f
- DiscoveryOptions JSDoc claimed the pre-trim 4,000 default and the old
  alphabetical cheapest-first inlining; now 2,000 and round-robin.
- README claimed effect is a peer dependency; it is a regular
  dependency — hosts depend on effect themselves because the API
  surface is Effect-typed.
- codemode.md brought current: committed/pushed status, six-commit
  history, triaged findings from the integration review (pre-PR cut vs
  post-MVP), and the cancellation fix record.
@rekram1-node
fix(opencode): interrupt code mode execution on cancel
9a6fdc4
The shared tool runner does not wire ctx.abort to fiber interruption
(run.promise -> Effect.runPromise), so cancelling execute abandoned the
promise while the interpreter fiber kept running — an infinite loop was
uncancellable with no timeout backstop, contradicting the documented
no-limits rationale.

The adapter now races execution against an abort-signal watcher:
cancel interrupts the execution fiber (structured concurrency takes
in-flight child calls down with it; interpreter auto-yield makes busy
loops preemptible) and resolves to an Execution cancelled result so the
runner's post-abort bookkeeping stays on its normal path. A pre-aborted
signal short-circuits before the program starts, since racing alone
still lets the loser run its first steps.
@rekram1-node
refactor(opencode): align code mode module with session conventions
9be249a
- Add the SessionCodeMode self-reexport footer and replace the star
  import in tools.ts with the named projection, matching the other
  session modules.
- Guard the groupByServer fallback: a key without an underscore now
  uses the whole key as the server name instead of silently dropping
  its last character (unreachable today; pinned by a test).
- Use CODE_MODE_TOOL at the result/metadata title sites instead of
  hardcoding the string.
@rekram1-node
feat(codemode): render bracket notation for non-identifier tool names
8f330de
Catalog and search signatures are now valid JavaScript expressions rooted
at `tools` (e.g. tools.context7["resolve-library-id"]), so every rendered
path is directly usable as a call site. Exact-lookup search accepts the
rendered expression as well as the canonical path. Instructions now state
that only listed/searchable tools exist inside `tools` and note that
bracket notation may appear for names that are not identifiers.
@rekram1-node
refactor(opencode): promote code mode to a registry tool service
9431ba3
Code mode was constructed ad-hoc in SessionTools.resolve and bolted onto
the registry's output, which meant it bypassed the tool.definition plugin
hook and — the real bug — baked permission-denied MCP tools into its
catalog before request-prep filtering could run.

It is now a proper registry citizen following the TaskTool pattern:

- CodeModeTool (src/tool/code-mode.ts, moved from src/session/) is a
  Tool.define service depending on MCP/Agent/Session; the registry yields
  it, gates it on the experimental flag plus connected MCP tools, and
  appends the grouped catalog per agent via describeCodeMode — the same
  composition point as describeTask, so plugins see the base description.
- Permission.visibleTools is the shared visibility predicate (delegating
  to Permission.disabled): only a hard deny hides a tool; ask-level rules
  stay visible and prompt at call time. Used by both request-prep
  resolveTools and the code-mode catalog so the two cannot drift.
- Execution rebuilds the runtime per call from a fresh MCP snapshot
  filtered with the merged agent+session ruleset, so a denied tool is not
  dispatchable even if the model guesses its name (it gets the normal
  unknown-tool diagnostic).
- SessionTools.resolve keeps only the raw-MCP-registration suppression;
  the special-case construction is gone.

Tests move to test/tool/ with new coverage: deny hides from catalog and
search, ask stays visible and callable, denied tools not dispatchable,
and registry-level enablement.
@rekram1-node
Merge remote-tracking branch 'origin/dev' into codemode-v2
3b3c6d6
# Conflicts:
#	packages/opencode/src/permission/index.ts
#	packages/opencode/src/tool/registry.ts
@rekram1-node
fix(codemode): quote non-identifier keys in signatures; unify compoun…
fedae57
…d assignment coercion

Two externally reported interpreter/rendering bugs, both verified with
failing tests before fixing:

- renderSchema emitted raw property names, producing invalid TypeScript
  for schema properties like foo-bar/@type/x.y. Object keys now render
  bare for identifiers and JSON-quoted otherwise, in both compact and
  pretty renderings. The identifierSegment regex moves to tool.ts as the
  single source of truth; tool-runtime's bracket-notation toolExpression
  imports it.

- applyCompoundAssignment applied raw JS operators to interpreter
  wrapper objects, so x += y diverged from x = x + y (a sandbox Date
  d += 1 produced "[object Object]1"; d -= 400 gave NaN instead of
  epoch arithmetic). The operator table and coercion move verbatim from
  evaluateBinaryExpression into a shared applyBinaryOperator; compound
  assignment validates against the compoundable set and dispatches
  through it. Logical assignments keep their short-circuit path, and
  compound assignment now rejects opaque references, consistent with
  binary operators.
@rekram1-node
refactor(opencode): share the MCP invocation middle between direct an…
1b7f565
…d code-mode calls

The legacy per-MCP registration and code-mode child dispatch each carried
their own copy of the invoke sequence, and the code-mode copy silently
missed the plugin tool.execute hooks and the tracing span.

McpInvoke.invoke (src/mcp/invoke.ts) now owns the shared middle: plugin
before hook -> permission ask -> Tool.execute span -> dispatch through
the ai-sdk execute -> plugin after hook, returning the raw result. Each
caller keeps its shaping edge (model shaping/truncation vs
toSandboxResult). The after hook fires with the raw MCP result on both
paths - exactly what the legacy loop always passed - so legacy behavior
is preserved and the payload cannot drift.

Code-mode child calls report the MCP key with a synthetic
parentCallID/N call id (opaque; the ai-sdk toolCallId is unchanged), and
any failure inside a child call - plugin hook, permission denial, or
tool error - fails only that call as a catchable in-program error.

Also pins SessionTools.resolve at the real-registry seam: raw per-MCP
registration is suppressed behind execute when code mode is on, present
when off, and legacy hook firing is covered.
@rekram1-node
fix(opencode): isolate the code-mode integration suite from bun modul…
8ca700f
…e mocks

test/mcp/lifecycle.test.ts replaces @modelcontextprotocol/sdk/client via
bun's mock.module, which is process-global and irreversible — in a full
bun test run (CI) any later import of the SDK Client gets the mock,
whose listTools returns a canned test_tool. The code-mode integration
suite imported that Client, so in CI its catalog rendered the mock's
tool and every real fixture call failed with unknown-tool.

The suite now speaks raw JSON-RPC over the in-memory transport with a
minimal client of its own (initialize handshake, tools/list,
tools/call), keeping the real-server/real-protocol property while being
immune to module-mock contamination. Full-package bun test now passes
(3124 pass / 0 fail).
@rekram1-node
fix(ci): pin node-gyp so native install scripts stop resolving node-g…
dca428c
…yp@latest

Installs began failing on every cache-miss bun install: the
tree-sitter-powershell install script has no local node-gyp, so bun's
lifecycle shim runs bunx node-gyp@latest, which resolved to last
night's node-gyp 13.0.1 release - incompatible with the runners'
Node 20.20 (its bundled undici calls webidl.util.markAsUncloneable,
which does not exist there). Pinning node-gyp 12.4.0 at the workspace
root puts a known-good version on the lifecycle PATH ahead of the
bunx fallback.
@rekram1-node
fix(codemode): align code-mode catalog filtering and schema union ren…
16f3c8e
…dering

Address review findings from PR #34677:

- ToolRegistry.tools now accepts optional session/request permissions and
  SessionTools.resolve passes the session ruleset through. The code-mode
  catalog is rendered with the same merged agent+session visibility rules
  used at execute time, so session-level hard-denied MCP tools are not
  advertised while ask-level tools stay visible.
- The JSON Schema renderer no longer collapses every anyOf/oneOf that
  contains a number branch to just number. It only collapses Effect's
  number-schema sentinel artifact (number plus NaN/Infinity string enums),
  while real JSON Schema unions like string | number and number | null
  render all alternatives.

Adds regression coverage for both cases.
@github-actions github-actions Bot mentioned this pull request Jul 3, 2026
📊 AI CLI 工具社区动态日报 2026-07-03 litang9/big_model_radar#154
Open
@rekram1-node
rekram1-node merged commit cb93114 into dev Jul 3, 2026
13 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node
rekram1-node deleted the codemode-v2 branch July 3, 2026 04:48
This was referenced Jul 3, 2026
revert: back out experimental codemode #35077
Merged
feat(tui): render code-mode execute tool with child calls #35113
Merged
Wiktor102 pushed a commit to Wiktor102/opencode that referenced this pull request Jul 5, 2026
@rekram1-node @Wiktor102
feat: experimental codemode (anomalyco#34677)
bf39890
github-actions Bot added a commit to wallentx/opencode-termux that referenced this pull request Jul 6, 2026
@github-actions @wallentx
opencode @vglafirov @opencode-agent @adamdotdevin @fwang @Hona @usrnk1 @jayair @rekram1-node @Brendonovich @arvsrn @StarpTech @kitlangton @jlongster @simonklee
Termux v1.17.13 (#4)
768e090
* ci: Add Android build and publish workflow with APK artifact upload

Signed-off-by: wallentx <[email protected]>

* ci: Allow publish workflow to run with android_only input

Signed-off-by: wallentx <[email protected]>

* ci: Use github.token instead of committer output in publish workflow

Signed-off-by: wallentx <[email protected]>

* feat: Add aarch64-linux-android target to sidecar binaries

Signed-off-by: wallentx <[email protected]>

* ci: Simplify publish workflow and fix Android build conditions

Signed-off-by: wallentx <[email protected]>

* feat: Refactor app initialization and add WSL path conversion

Signed-off-by: wallentx <[email protected]>

* ci: Fix Android-only workflow condition and update dependencies

Signed-off-by: wallentx <[email protected]>

* sync release versions for v1.17.13

* chore: bump gitlab-ai-provider to 6.10.0 (anomalyco#34756)

* chore: update nix node_modules hashes

* feat(stats): redesign lab hero

* feat(stats): add lab overview

* feat(stats): redesign lab usage

* feat(data): another redesigned lab section

* feat(stats): use catalog descriptions

* chore: generate

* fix(stats): refine lab page tooltips

* fix(stats): include locale header in vary (anomalyco#34789)

* zen: new inference

* fix(desktop): keep window tabs across app close (anomalyco#34807)

* fix(app): stabilize session timeline layout continuity (anomalyco#34533)

* feat(desktop): refine session tab preview popover (anomalyco#34792)

* fix(ui): raise v2 tooltip layer (anomalyco#34455)

Co-authored-by: Jay <[email protected]>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>

* chore: update nix node_modules hashes

* fix(opencode): update Cerebras SDK reasoning replay (anomalyco#34826)

Co-authored-by: Aiden Cline <[email protected]>

* chore: update nix node_modules hashes

* fix(app): resolve target session lineage outside router transition (anomalyco#34838)

* chore: generate

* fix(opencode): filter session list by resolved instance directory (anomalyco#34842)

* fix(app): only allow \(...\) syntax for inline latex (anomalyco#34850)

* test(opencode): cover Windows session list directory spellings (anomalyco#34857)

* fix(app): scope session tab indicators to the tab's server (anomalyco#34861)

* chore: generate

* fix(app): clear original prompt after retarget (anomalyco#34863)

* fix(app): seed session status before warming session info (anomalyco#34864)

* feat(app): v2 review panel overhaul (anomalyco#31882)

Co-authored-by: LukeParkerDev <[email protected]>

* fix(app): keep terminal mounted when switching session tabs in a workspace (anomalyco#34852)

Co-authored-by: Brendan Allan <[email protected]>

* fix(ui): resolve toast icon inside the toast component (anomalyco#34874)

* fix(copilot): honor advertised model endpoints (anomalyco#34958)

* fix(stats): polish lab pages

* feat(stats): redesign model hero

* chore: generate

* feat(tui): add debug info dialog with copy to clipboard (anomalyco#35004)

* zen: new inference

* zen: new inference

* feat(app): navigate tabs on mousedown in new layout (anomalyco#35042)

* zen: new inference

* zen: new inference

* fix(app): keep v2 review pane mounted across session tab switches (anomalyco#35074)

* feat: experimental codemode (anomalyco#34677)

* chore: generate

* fix(ci): setup Node 24 before bun install for node-gyp (anomalyco#35076)

* revert: back out experimental codemode (anomalyco#35077)

* feat(codemode): add confined execution package (anomalyco#35079)

* chore: generate

* chore: update nix node_modules hashes

* chore: remove root node-gyp pin after Node 24 setup (anomalyco#35092)

* feat(desktop): add recently closed projects to home (anomalyco#34926)

* feat(app): align subagent UI with v2 (anomalyco#34931)

Co-authored-by: Luke Parker <[email protected]>

* chore: generate

* feat(desktop): papercut fixes (anomalyco#34939)

* refactor(opencode): expose MCP tools in native shape from the service (anomalyco#35103)

* feat(app): improvements to model search (anomalyco#34954)

* chore: generate

* feat(opencode): add code-mode MCP adapter (anomalyco#35085)

* chore: generate

* chore: update nix node_modules hashes

* feat(app): dropdown search fix (anomalyco#34961)

Co-authored-by: Brendan Allan <[email protected]>

* fix(opencode): provide Observability beneath all route service graphs (anomalyco#35171)

* chore: upgrade turbo (anomalyco#35173)

* feat(stats): add model momentum section

* chore: generate

* fix(core): rewrite replacements while hoisting layers (anomalyco#35175)

* fix(stats): link market share labs

* chore: artifacts

* chore: generate

* feat(tui): render code-mode execute tool with child calls (anomalyco#35113)

* refactor(opencode): fail the execute tool on program failure (anomalyco#35180)

* fix(tui): align execute child calls with task indentation (anomalyco#35190)

* refactor(core): move path resolve into fs service (anomalyco#35202)

* feat(opencode): gate execute tool behind code mode flag (anomalyco#35185)

* chore: generate

* cleanup: tweak compaction prompt (anomalyco#35220)

Co-authored-by: Aiden Cline <[email protected]>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>

* fix(app): restore unfocused composer typing (anomalyco#35249)

* fix(app): delay initial tab preview (anomalyco#35266)

Co-authored-by: Jay <[email protected]>

* fix(desktop): stabilize esm shim injection (anomalyco#35270)

* fix(app): match new session panel corners (anomalyco#35257)

* tui: preserve spinner registration (anomalyco#35292)

* feat: Add aarch64-linux-android target to sidecar binaries

Signed-off-by: wallentx <[email protected]>

* chore(ci): Improve workflow portability and add Android build support

Signed-off-by: wallentx <[email protected]>

* feat(ci): Add Android artifact build workflow and guidance

Signed-off-by: wallentx <[email protected]>

* fix(opencode): use NDK sysroot for Android artifact build

* fix(opencode): pass Android NDK libc paths to Zig

* fix(opencode): patch OpenTUI Android system libs

* fix(opencode): rely on NDK libc config for Android

* fix(opencode): resolve Android OpenTUI loader relatively

* chore(ci): add Android Bun compile smoke target

* fix(opencode): relocate Android Bun payload pointer

* chore(ci): build Android Bun runtime from source

* fix(ci): install LLVM for Android Bun source build

* fix(ci): bootstrap LLVM 21 for Android Bun build

* fix(ci): keep Bun Android build inside source tree

* fix(ci): link Android NDK runtimes for Bun build

* fix(ci): use Android strip for Bun runtime build

* chore(termux): add release mirror workflows

* chore(termux): align app token variables

* chore(termux): use app client id input

* chore(termux): fall back to github token

* chore(termux): prepare v1.17.13

---------

Signed-off-by: wallentx <[email protected]>
Co-authored-by: wallentx <[email protected]>
Co-authored-by: opencode <[email protected]>
Co-authored-by: Vladimir Glafirov <[email protected]>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: Adam <[email protected]>
Co-authored-by: Frank <[email protected]>
Co-authored-by: Luke Parker <[email protected]>
Co-authored-by: usrnk1 <[email protected]>
Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: Jay <[email protected]>
Co-authored-by: Aiden Cline <[email protected]>
Co-authored-by: Brendan Allan <[email protected]>
Co-authored-by: Aarav Sareen <[email protected]>
Co-authored-by: Brendan Allan <[email protected]>
Co-authored-by: Dustin Deus <[email protected]>
Co-authored-by: Kit Langton <[email protected]>
Co-authored-by: James Long <[email protected]>
Co-authored-by: Simon Klee <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
drewr pushed a commit to drewr/opencode that referenced this pull request Jul 7, 2026
@rekram1-node @drewr
feat: experimental codemode (anomalyco#34677)
9176447
@JRedeker JRedeker mentioned this pull request Jul 27, 2026
Plugin agent manifest tools: question: true does not override inherited default question: deny permission #39022
Closed
MarsQiu007 referenced this pull request in MarsQiu007/openNovel Jul 31, 2026
@rekram1-node
feat: experimental codemode (#34677)
8c3206f
rldona pushed a commit to plazoleta-dev/FlupCode that referenced this pull request Sep 24, 2026
@rekram1-node
feat: experimental codemode (anomalyco#34677)
cf61894
Ichinose-Kazuki pushed a commit to Ichinose-Kazuki/opencode that referenced this pull request Oct 7, 2026
@rekram1-node
feat: experimental codemode (anomalyco#34677)
64860e3
@lidge-jun lidge-jun mentioned this pull request Oct 23, 2026
feat(pi): declare GOAT tools by the server always-load flag and approve reads through goat_call goat-si/goat#994
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Design and implement CodeMode runtime + OpenCode MCP adapter [FEATURE]: Claude-style Tool Search Tool Implementation in OpenCode [FEATURE]:Add mcp search tool, reduce mcp tool occupying a lot of context

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@rekram1-node
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.