Skip to content

refactor(harness): source harness↔model compatibility from @tangle-network/agent-interface#153

Merged
vutuanlinh2k2 merged 1 commit into
mainfrom
feat/harness-compat-delegate-agent-interface
Jun 29, 2026
Merged

refactor(harness): source harness↔model compatibility from @tangle-network/agent-interface#153
vutuanlinh2k2 merged 1 commit into
mainfrom
feat/harness-compat-delegate-agent-interface

Conversation

@vutuanlinh2k2

Copy link
Copy Markdown
Contributor

What

Deletes agent-app's hand-rolled harness↔model compatibility/snapping fork in
src/harness/index.ts and delegates to @tangle-network/agent-interface — the single source of
truth shared with the sandbox-ui pickers and the cli-bridge backends.

Changes

  • isModelCompatibleWithHarness, snapModelToHarness, snapHarnessToModel,
    assertHarnessModelCompatible, modelProvider now delegate to agent-interface (same names
    and signatures, so the call sites in src/sandbox/index.ts and src/web-react/... are untouched).
  • Removed the duplicated HARNESS_MODEL_POLICIES, PROVIDER_PREFERRED_HARNESS, and the
    HarnessModelPolicy interface. Confirmed nothing outside this file (in any repo) imports them.
  • Kept the parts this module rightly owns: the Harness taxonomy (KNOWN_HARNESSES,
    isHarness, coerceHarness, DEFAULT_HARNESS) and the resolveSessionHarness session-lock
    invariant.
  • Added @tangle-network/agent-interface as a required peer dep (+ dev), >=0.15.0.

The one seam: as HarnessType

agent-app's Harness is a superset of agent-interface's HarnessType — it carries forge /
cursor, which agent-interface doesn't list (and omits nanoclaw/gemini/aliases). The
delegations cast harness as HarnessType. This is safe: those agent-app-only runners have no
provider lock
in agent-interface, so they resolve as router-backed (any model) — the correct
behavior — and the snap helpers only ever return a vendor-locked harness or opencode, all valid
Harness values. Full harness-taxonomy unification (so the cast can go away) is a deliberate
follow-up, not part of this PR.

Why

The harness↔model rule was hand-copied into three diverging places (agent-interface, sandbox-ui,
and this fork). agent-interface is now the source (tangle-network/agent-sdk#8, published as
agent-interface@0.15.0); this makes agent-app import it so the policy can't drift — and the
nanoclaw correction (router-backed) flows from one place.

Verification (against published agent-interface@0.15.0)

  • pnpm typecheck — clean (the casts type-check; nothing references the removed symbols).
  • vitest run src/harness/index.test.ts12/12 pass (compat, snap, assert throw, session lock).
  • vitest run src/sandbox/index.test.ts — the harness-lifecycle cases (deletes and recreates on harness mismatch, driveSandboxTurn) pass. The only 3 failures are pre-existing and
    environment-specific (deferred-file tests that shell out and hit a local .bash_profile error —
    unrelated to this change).

Notes

  • No version bump/changelog here — that's the chore(release) flow's job. A release is needed so
    gtm-agent can bump to an agent-app that carries this.
  • Part of the selector unification tracked in tangle-network/gtm-agent#395. Siblings:
    agent-sdk#8 (merged + published), sandbox-ui#142 (draft), then gtm-agent dep bumps.

Draft until released and validated downstream.

…twork/agent-interface

Delete agent-app's hand-rolled compatibility/snapping fork; delegate to the canonical helpers so
the shell guard, the sandbox-ui pickers, and the cli-bridge backends read one policy.

- isModelCompatibleWithHarness / snapModelToHarness / snapHarnessToModel / assertHarnessModelCompatible
  / modelProvider now delegate to agent-interface. agent-app's Harness taxonomy is a superset of
  agent-interface's HarnessType (forge/cursor), so the calls cast 'as HarnessType' — safe because
  those extra runners are router-backed (no provider lock) there.
- remove the duplicated HARNESS_MODEL_POLICIES / PROVIDER_PREFERRED_HARNESS / HarnessModelPolicy
  (no consumer imports them); keep the harness taxonomy + session-lock invariant here.
- add @tangle-network/agent-interface as a required peer (+ dev) dep, >=0.15.0.

Part of the harness/model/effort selector unification (tangle-network/gtm-agent#395).
@vutuanlinh2k2 vutuanlinh2k2 marked this pull request as ready for review June 29, 2026 14:17
@vutuanlinh2k2 vutuanlinh2k2 merged commit e42ece4 into main Jun 29, 2026
1 check passed
@vutuanlinh2k2 vutuanlinh2k2 deleted the feat/harness-compat-delegate-agent-interface branch June 29, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant