OmniRoute/@omniroute/opencode-provider/package.json
Mourad Maatoug 57354ac6d7 feat(@omniroute/opencode-provider): model capabilities, agent block, mode block (UI helpers)
Adds three UI-surface helpers on top of T1–T8 in PR #2375:

A) Model capability flags
   - ModelCapabilities interface (label, attachment, reasoning, temperature, tool_call)
   - OMNIROUTE_DEFAULT_MODEL_CAPABILITIES seeds capabilities for all 7 default
     model ids
   - OmniRouteProviderOptions.modelCapabilities merges over defaults per id
   - createOmniRouteProvider emits capability flags inline in models[id], per
     OpenCode's ProviderConfig.models schema (snake_case JSON keys, optional)
   - Label precedence: modelCapabilities[id].label > modelLabels[id] > id

B) createOmniRouteAgentBlock
   - OmniRouteAgentRole + OmniRouteAgentBlockOptions + OpenCodeAgentEntry
   - Emits Record<role, { model: 'omniroute/<id>', temperature?, top_p?,
     tools?: Record<string, boolean>, prompt? }>
   - Only fields present in OpenCode's AgentConfig schema are emitted
   - Tools normalized to Record<string, boolean> per schema (not string[])
   - Roles with empty modelId are skipped

C) createOmniRouteModesBlock (deprecated alias)
   - Same shape as createOmniRouteAgentBlock since OpenCode treats top-level
     'mode' block identically to 'agent' (both reference AgentConfig)
   - Helper kept for back-compat; @deprecated tags steer callers to agent

Shared helper buildAgentEntry eliminates duplication between A/B helpers.

Schema validation
- All emitted keys verified against https://opencode.ai/config.json
- Removed initially-considered reasoningEffort + max_tokens fields (not in
  AgentConfig schema)
- tools shape changed from string[] to Record<string, boolean> per schema

Build hygiene
- tsconfig.json narrowed to lib: ['ES2022'] + types: ['node'] (no DOM lib
  leakage); @types/node added as devDep
- Tests: 32 → 45 green (+13 net)
- Build: ESM 10.39 KB / CJS 11.01 KB / DTS 18.87 KB
2026-05-18 17:06:13 +02:00

60 lines
1.5 KiB
JSON

{
"name": "@omniroute/opencode-provider",
"version": "0.1.0",
"description": "OpenCode provider helper for the OmniRoute AI Gateway. Generates a schema-valid provider entry for opencode.json that delegates the runtime to @ai-sdk/openai-compatible.",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"files": [
"dist",
"README.md",
"LICENSE"
],
"scripts": {
"build": "tsup",
"clean": "rm -rf dist",
"test": "node --import tsx/esm --test tests/**/*.test.ts",
"prepublishOnly": "npm run clean && npm run build && npm test"
},
"keywords": [
"omniroute",
"opencode",
"opencode-ai",
"ai-sdk",
"openai-compatible",
"provider",
"ai-gateway",
"llm-router"
],
"author": "OmniRoute contributors",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/diegosouzapw/OmniRoute.git",
"directory": "@omniroute/opencode-provider"
},
"bugs": {
"url": "https://github.com/diegosouzapw/OmniRoute/issues"
},
"homepage": "https://github.com/diegosouzapw/OmniRoute/tree/main/%40omniroute/opencode-provider#readme",
"engines": {
"node": ">=20.20.2"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@types/node": "^20.19.41",
"tsup": "^8.5.0",
"tsx": "^4.20.0",
"typescript": "^5.9.0"
}
}