Skip to content

feat: add Warp provider adapter#350

Open
Amirault wants to merge 1 commit into
getagentseal:mainfrom
Amirault:feat/warp-provider
Open

feat: add Warp provider adapter#350
Amirault wants to merge 1 commit into
getagentseal:mainfrom
Amirault:feat/warp-provider

Conversation

@Amirault
Copy link
Copy Markdown

Summary

  • add a new lazy-loaded warp provider that reads Oz sessions from Warp SQLite (warp.sqlite) with WARP_DB_PATH override support
  • parse finalized Warp exchanges from agent_conversations + ai_queries, estimate per-exchange token attribution from conversation totals, and normalize Warp model identifiers to priced model aliases
  • attribute Warp run_command blocks from blocks to the nearest preceding exchange and extract bash command usage
  • wire Warp into provider registry discovery, model aliasing, and session-cache environment fingerprinting
  • add provider docs (docs/providers/warp.md), README/provider index updates, and dedicated Warp tests

Validation

  • npm run test (63 files, 876 tests passed)
  • npm run build
  • npm run test -- tests/providers/warp.test.ts tests/provider-registry.test.ts
  • npm run dev -- status --provider warp --format json

Artifacts

Co-Authored-By: Oz oz-agent@warp.dev

Add Warp SQLite session discovery and parsing, wire provider registry/model aliases/cache env fingerprinting, and document/test provider behavior.

Co-Authored-By: Oz <oz-agent@warp.dev>
Copy link
Copy Markdown
Member

@iamtoruk iamtoruk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review — Performance, Security & Compatibility Audit

Ran this against a real local Warp DB (macOS, 301MB warp.sqlite, 3 conversations). Provider discovers and parses correctly. No crashes. Full test suite passes (876/876).

Must Fix

1. Remove bare auto-efficient / auto-powerful from BUILTIN_ALIASES (src/models.ts:176-177)

These two generic keys create a global collision risk — any future provider emitting a model named auto-efficient would silently resolve to gpt-5.3-codex. They're also redundant: Warp's own normalizeModel() already maps auto-efficientwarp-auto-efficient before the name reaches BUILTIN_ALIASES, so the bare keys are dead code.

Remove these two lines:

-  'auto-efficient':                'gpt-5.3-codex',
-  'auto-powerful':                 'claude-opus-4-6',

The prefixed warp-auto-efficient and warp-auto-powerful (lines 174-175) are sufficient.

2. Remove unscoped README changes

The Node badge bump (20→22) and better-sqlite3 requirements rewrite are pre-existing doc debt, not Warp-specific. Please split these into a separate commit/PR so the changelog stays accurate.

Should Consider

3. outputTokens: 0 always

All tokens are attributed to inputTokens and cost is calculated at the input rate. For models where output costs 3-5x more than input (Opus), this significantly underestimates cost. The costIsEstimated: true flag helps, but consider a heuristic 60/40 split or at least a code comment explaining the trade-off.

4. Duplicate display-name aliases

'Claude Sonnet 4.6', 'Claude Haiku 4.5', etc. appear in both BUILTIN_ALIASES (models.ts) and modelAliases (warp.ts). These will drift. Consider removing the display-name entries from warp.ts since resolveAlias in models.ts already handles them globally.

5. toolSequence for retry detection

We just landed #353 which adds toolSequence to fix 100% one-shot rates for providers that aggregate tools per-session. Warp emits per-exchange so it's not technically broken, but if a single exchange involves multiple sequential tool invocations (Edit→Bash→Edit), those get flattened into one tools[]. Consider setting toolSequence: undefined explicitly or adding a comment noting the limitation.

Verified Safe

Area Finding
SQL injection All 6 queries use parameterized ? placeholders. No string interpolation.
DB access Opened readOnly: true (sqlite.ts:124). Malicious WARP_DB_PATH → failed open, caught by try/catch.
decodeSourcePath colon split macOS paths can't contain :. Edge case with crafted DB → failed open, no harm.
blobToText / XSS Data flows to JSON, no HTML rendering context.
Blocks query performance Full table scan with json_extract on read-only DB (can't add index). Acceptable for typical Warp DBs (<50k blocks). ~50-200ms worst case.
Discovery N+1 Correlated subquery per conversation. Fine for a few hundred conversations.
assignCommandBlocksToExchanges O(blocks × exchanges) with early break. Both sets tiny per-conversation.
Provider registry (index.ts) Lazy-load pattern matches Goose/Cursor/Crush exactly.
Session cache (session-cache.ts) WARP_DB_PATH fingerprint isolated to Warp section.

Overall well-structured contribution. Items 1 and 2 are the only blockers.

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.

3 participants