Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
refactor(console): drop the runtime version pin constants and their tests (#198)
Louis Amaudruz62e9ed42f802
diff --git a/.github/workflows/switch-agent-runtime-publish.yml b/.github/workflows/switch-agent-runtime-publish.ymlindex aa22563de..92d02b345 100644--- a/.github/workflows/switch-agent-runtime-publish.yml+++ b/.github/workflows/switch-agent-runtime-publish.yml@@ -172,6 +172,5 @@ jobs:*) npm publish --access public --provenance ;;esacecho "Published $name@$version"- echo "Point the sessions at it: bump the three pins that name the" \- "version — both connectors' .mcp.json and" \- "SWITCH_AGENT_RUNTIME_VERSION — plus the plugin versions."+ echo "Point the sessions at it: bump the version in both connectors'" \+ ".mcp.json — plus the plugin versions."diff --git a/console/AGENTS.md b/console/AGENTS.mdindex b904e69ba..592bade3b 100644--- a/console/AGENTS.md+++ b/console/AGENTS.md@@ -438,21 +438,21 @@ forgotten and someone will debug a build they think is newer than it is.|---|---|---|| Remote sidecar | `src/sidecar/sidecar-version.ts` | any behaviour change; **major only** on a client↔sidecar wire break (ready line, endpoint shapes, shared on-disk layout) || Claude Code plugin | `connectors/claude-code-plugin/.claude-plugin/plugin.json` | any change to the plugin — installs will not pick it up otherwise |-| Codex plugin | `connectors/codex-plugin/.codex-plugin/plugin.json` | any change to the plugin (it ships only the skill) — installs will not pick it up otherwise |-| Agent runtime package | `packages/switch-agent-runtime/package.json` | any change; it is published, and two pins name the version sessions actually run — the Claude connector `.mcp.json`, and `SWITCH_AGENT_RUNTIME_VERSION` in `src/shared/core/switch-rooms/switch-agent-runtime.ts` (which the Codex profile uses) |+| Codex plugin | `connectors/codex-plugin/.codex-plugin/plugin.json` | any change to the plugin (it ships the skill and its own `.mcp.json`) — installs will not pick it up otherwise |+| Agent runtime package | `packages/switch-agent-runtime/package.json` | any change; it is published, and **both** connectors' `.mcp.json` pin the version sessions actually run. Nothing in the app pins it — the plugins register the runtime themselves — so those two files are the only pins |"Non-trivial" means anything a user could observe: behaviour, protocol, wiring,dependencies. A comment or a rename that changes nothing does not need one.-**The runtime's version and its two pins move at different times, in this-order.** Bump `package.json` with the change; the pins must keep naming a+**The runtime's version and the connector pins move at different times, in+this order.** Bump `package.json` with the change; the pins must keep naming aversion that is *published*, so they stay behind until the tag exists(`git tag switch-agent-runtime-v<version> && git push origin <tag>`), and onlythen move to it. Pinning ahead points every session at something the registry-does not have. `switch-agent-runtime.test.ts` enforces exactly this: the two-pins must agree with each other, and neither may run ahead of `package.json`.-The cost of the lag is real and worth stating in the PR — a change to `bin.ts`-reaches no session until the tag is pushed and the pins follow.+does not have. Nothing checks this for you — the pins and `package.json` are+free to sit apart, and how far apart is a release decision rather than an+invariant. The cost of the lag is real and worth stating in the PR — a change+to `bin.ts` reaches no session until the tag is pushed and the pins follow.Two traps worth knowing rather than rediscovering:diff --git a/console/apps/switch-console-desktop/src/shared/core/switch-rooms/switch-agent-runtime.test.ts b/console/apps/switch-console-desktop/src/shared/core/switch-rooms/switch-agent-runtime.test.tsindex d1f205c43..d6f81ba0f 100644--- a/console/apps/switch-console-desktop/src/shared/core/switch-rooms/switch-agent-runtime.test.ts+++ b/console/apps/switch-console-desktop/src/shared/core/switch-rooms/switch-agent-runtime.test.ts@@ -3,8 +3,6 @@ import { dirname, join } from 'node:path';import { fileURLToPath } from 'node:url';import { describe, expect, it } from 'vitest';import {- SWITCH_AGENT_RUNTIME_PACKAGE,- SWITCH_AGENT_RUNTIME_VERSION,SWITCH_RUNTIME_ENV_VARS,SWITCH_RUNTIME_OPTIONAL_ENV,SWITCH_RUNTIME_REQUIRED_ENV,@@ -44,50 +42,6 @@ function switchServerIn(relative: string): SwitchServerEntry {const claudeSwitchServer = (): SwitchServerEntry => switchServerIn(CLAUDE_MCP_JSON);const codexSwitchServer = (): SwitchServerEntry => switchServerIn(CODEX_MCP_JSON);-/** The runtime package's own version, the third pin nothing else checks. */-function runtimePackageVersion(): string {- let dir = dirname(fileURLToPath(import.meta.url));- for (let i = 0; i < 12; i++) {- const candidate = join(dir, 'console/packages/switch-agent-runtime/package.json');- if (existsSync(candidate)) {- return (JSON.parse(readFileSync(candidate, 'utf8')) as { version: string }).version;- }- const parent = dirname(dir);- if (parent === dir) break;- dir = parent;- }- throw new Error('could not locate packages/switch-agent-runtime/package.json');-}--describe('the pinned runtime version', () => {- it.each([- ['Claude', CLAUDE_MCP_JSON],- ['Codex', CODEX_MCP_JSON],- ])('is the version the %s connector .mcp.json registers', (_host, relative) => {- // Both connectors register this runtime from their own bundled .mcp.json,- // and both must run the same published version; this guards the pins from- // drifting when only one is bumped.- const args = switchServerIn(relative).args ?? [];- expect(args).toContain(`${SWITCH_AGENT_RUNTIME_PACKAGE}@${SWITCH_AGENT_RUNTIME_VERSION}`);- });-- it('never pins a version ahead of the one the package declares', () => {- // The third pin AGENTS.md names. Not an equality: the package version may- // run ahead while a release is prepared, and the pin must keep naming a- // published version until then — pinning ahead points every session at- // something the registry does not have. Behind is staged; ahead is broken.- const pinned = SWITCH_AGENT_RUNTIME_VERSION.split('.').map(Number);- const declared = runtimePackageVersion().split('.').map(Number);- expect(pinned.length).toBe(3);- for (let i = 0; i < 3; i++) {- if (pinned[i]! !== declared[i]!) {- expect(pinned[i]!).toBeLessThan(declared[i]!);- return;- }- }- });-});-describe('the credentials the runtime needs', () => {it('are declared by the Claude connector not at all, so a standalone session can start', () => {// Claude expands ${VAR} and fails the WHOLE server when one resolves todiff --git a/console/apps/switch-console-desktop/src/shared/core/switch-rooms/switch-agent-runtime.ts b/console/apps/switch-console-desktop/src/shared/core/switch-rooms/switch-agent-runtime.tsindex 9daf833a1..ab4125185 100644--- a/console/apps/switch-console-desktop/src/shared/core/switch-rooms/switch-agent-runtime.ts+++ b/console/apps/switch-console-desktop/src/shared/core/switch-rooms/switch-agent-runtime.ts@@ -10,16 +10,6 @@* Electron and the database) spawns from it.*/-/** npm package name of the local Switch MCP runtime. */-export const SWITCH_AGENT_RUNTIME_PACKAGE = '@sandboxaq/switch-agent-runtime';--/**- * Exact version the runtime is pinned to. Must match the pin in- * `connectors/claude-code-plugin/.mcp.json`; `switch-agent-runtime.test.ts`- * fails if the two drift. Bump both together when the runtime is republished.- */-export const SWITCH_AGENT_RUNTIME_VERSION = '0.3.0';-/*** The credentials switchdash injects into a session it launches. The runtime* takes all three together as its identity and asks no further questions —