feat(architecture): [EoS/opencode] Migrate OpenCode onto the Embeddable Orchestration System (ADR-1239, #2087)

Route OpenCode (and its Kilo sibling) through the public Host-Integration Interface and
land two Context7-verified capability upgrades. Byte-identical install output for all 16
runtimes (golden parity asserted).

Through the interface (AC2):
- OpenCode/Kilo's bespoke commands+skills+plugin install (the inline
  `else if (isOpencode || isKilo)` block) moves into the engine
  (installOpencodeFamilyCommands/Artifacts in src/install-engine.cts), dispatched by
  installRuntimeArtifacts when the descriptor declares hostBehaviors.combinedFamilyInstall.
  opencode/kilo now flow CLI -> _runtimeAdapter -> installRuntimeArtifacts like the skills
  runtimes. _isSkillsRuntime no longer excludes them; the bespoke block + dead
  copyFlattenedCommands are removed.
- Every hardcoded `runtime === 'opencode'`/`isOpencode` branch is folded into
  descriptor-driven runtime.hostBehaviors. ZERO `runtime === 'opencode'`/`'kilo'`
  string-equality remain in bin/install.js / install-engine.cts / runtime-artifact-conversion.cts.

Upgrades (AC4):
- Background dispatch: OpenCode shipped experimental background subagents in v1.15 and
  made them default-on in v1.17 -> dispatch.background/backgroundDispatch flip to true;
  shouldFlattenDispatch(opencode) now returns false (behavioral change; type: Changed).
- Expanded event surface: the OpenCode plugin subscribes permission.asked/replied +
  session.error.

Tests: opencode-imperative-reference (adapter/profile, shouldFlattenDispatch pin,
fail-closed negotiate, hostBehaviors, AC2 source-guard) + extended plugin surface test.
Docs: capability matrix v1.15/v1.17 citations. Changeset (Changed). gitignore .memdb//.memtrace/.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-07-08 16:53:54 -04:00
parent ab78797ac5
commit 396f44bd0b
16 changed files with 450 additions and 155 deletions

View File

@@ -340,10 +340,15 @@ test('plugin implements the full declared opencode extension-event surface (Clau
}
// Session/file events dispatch through the `event` handler.
assert.equal(typeof handlers.event, 'function', 'plugin exposes an event dispatcher');
// Every declared surface event resolves to a plugin handler.
// Every declared surface event resolves to a plugin handler. Session /
// permission / error events dispatch through the `event` handler (not
// top-level handler keys). #2087 added permission.asked/replied + session.error.
const EVENT_DISPATCHED = new Set([
'session.created', 'session.idle', 'file.edited',
'permission.asked', 'permission.replied', 'session.error',
]);
for (const ev of surface) {
const covered = typeof handlers[ev] === 'function'
|| ev === 'session.created' || ev === 'session.idle' || ev === 'file.edited';
const covered = typeof handlers[ev] === 'function' || EVENT_DISPATCHED.has(ev);
assert.ok(covered, `plugin covers opencode extension event: ${ev}`);
}
});