Skip to content

feat(agent-interface): centralize harness↔model snapping; fix nanoclaw capabilities#8

Merged
drewstone merged 1 commit into
mainfrom
feat/agent-interface-harness-snapping
Jun 29, 2026
Merged

feat(agent-interface): centralize harness↔model snapping; fix nanoclaw capabilities#8
drewstone merged 1 commit into
mainfrom
feat/agent-interface-harness-snapping

Conversation

@vutuanlinh2k2

Copy link
Copy Markdown
Contributor

What

Makes @tangle-network/agent-interface the single source of truth for harness↔model
snapping, and corrects nanoclaw's capabilities.

Changes (packages/agent-interface/src/harness-capabilities.ts)

  • nanoclaw is router-backed, not Anthropic-locked. Removed nanoclaw: ["anthropic"] from
    harnessProviderLock. Its runner routes every provider through the Tangle router
    (TANGLE_ROUTER_MODEL + OpenAI/OpenRouter/Anthropic base URLs all → gateway), so it runs any
    model like opencode. harnessSupportsModel("nanoclaw", <anything>) is now true.
  • nanoclaw reasoning ceiling ultracode → none. Its runner sends no thinking flag, so
    reasoningEffortsFor("nanoclaw") now returns ["none"] instead of over-advertising the full ladder.
  • Added the catalog-snap layer (previously hand-rolled, identically, in both sandbox-ui and
    agent-app): snapModelToHarness(harness, modelId, candidateIds) and
    snapHarnessToModel(harness, modelId), plus a private harnessPreferredModelPatterns ranking
    table. Both reuse the existing harnessSupportsModel / preferredHarnessForModel and are
    catalog-agnostic (take readonly string[] of canonical ids), so consumers can delete their forks.

Supporting

  • New src/harness-capabilities.test.ts (16 cases): compatibility + aliases, nanoclaw = any model,
    snap ranking (opus-before-sonnet, gpt-frontier-before-mini), the router-backed "don't snap" path,
    reasoning ceilings (incl. nanoclaw = none), and model-capability narrowing.
  • package.json: test / test:watch scripts + vitest devDep (catalog).
  • tsconfig.json: exclude *.test.ts from the build so tests don't ship in dist.
  • Changeset → minor (0.14.0 → 0.15.0): new exports + the nanoclaw behavior change.

Why

The harness↔model compatibility rule (and the snap helpers) were hand-copied into three places
that disagree — agent-interface, sandbox-ui/src/chat/harness-model-compat.ts, and
agent-app/src/harness/index.ts. Today the two consumers don't even call agent-interface's
copy, so its wrong nanoclaw lock is dead code; it would become a live regression the moment they
migrate. This PR fixes nanoclaw and lands the snap helpers here first, so the consumer PRs can
delete their forks and import from one source.

Verification

  • pnpm --filter @tangle-network/agent-interface build — clean; no test files in dist.
  • check-types — passes.
  • pnpm --filter @tangle-network/agent-interface test16/16 pass, single run.
  • Swept the monorepo: nothing else depends on nanoclaw's old lock.

Scope / follow-ups

First of a multi-repo unification tracked in tangle-network/gtm-agent#395:

  1. (this PR) agent-interface: fix nanoclaw + add snap helpers.
  2. sandbox-ui: rewrite harness-model-compat.ts to delegate to these exports (keep its 5 public
    re-exports stable).
  3. agent-app: add agent-interface as a peerDep; delegate the policy via a documented as HarnessType
    boundary cast (its Harness taxonomy — forge/cursor — diverges; full taxonomy unification is a
    separate follow-up).
  4. gtm-agent: dep bumps only.

Draft until 0.15.0 is published and the consumer PRs are validated against it.

…w capabilities

- nanoclaw is router-backed (runs any model via the Tangle router), not Anthropic-locked
- nanoclaw reasoning ceiling is 'none' (its runner sends no thinking flag), was 'ultracode'
- add snapModelToHarness / snapHarnessToModel (+ ranking patterns) so sandbox-ui and agent-app
  import the catalog-aware snap logic instead of hand-rolling divergent copies
- add a vitest suite; exclude test files from the published dist

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 12:42
@vutuanlinh2k2 vutuanlinh2k2 requested a review from drewstone June 29, 2026 12:49
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.

2 participants