@jacobbd/relay-ai 0.6.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -53,6 +53,7 @@ Pick your backend:
53
53
  | `relay-ai antigravity-ide` | Launch Antigravity IDE with Relay models, macOS ([warning + guide](docs/ANTIGRAVITY.md)) |
54
54
  | `relay-ai providers auth <id>` | Authenticate an OAuth provider (GitHub Copilot, xAI, OpenAI) |
55
55
  | `relay-ai --ai` | Full agent reference for scripts and alef-agent ([guide](docs/AI-AGENTS.md)) |
56
+ | `@jacobbd/relay-ai/core` | Embed Relay AI in a Node app in-process — no CLI/UI/server ([guide](docs/CORE.md)) |
56
57
 
57
58
  ## Features
58
59
 
@@ -406,6 +407,31 @@ export ANTHROPIC_API_KEY="anything"
406
407
  unset CLAUDE_CODE_USE_VERTEX ANTHROPIC_VERTEX_PROJECT_ID CLOUD_ML_REGION
407
408
  ```
408
409
 
410
+ ## Embedded usage (`@jacobbd/relay-ai/core`)
411
+
412
+ Node.js applications can embed Relay AI in-process — no CLI, UI, or server — to list the configured model catalog and obtain ready [Vercel AI SDK](https://sdk.vercel.ai) `LanguageModel` instances:
413
+
414
+ ```ts
415
+ import { listRelayModels, createRelayModel, isRelayCoreError } from '@jacobbd/relay-ai/core';
416
+ import { streamText } from 'ai';
417
+
418
+ const models = listRelayModels(); // credential-free catalog
419
+ const model = await createRelayModel(models[0].routeId);
420
+ const result = await streamText({ model, prompt: 'Hello!' });
421
+ ```
422
+
423
+ **Route ids** are unconditionally scoped: `` `${providerId}::${modelId}` `` (split on the first `::`; model ids may contain `/` and `:`, e.g. `openrouter::vendor/model:free`). Because they are never bare, a route id persisted by your app stays valid even when a second provider later exposes the same model id.
424
+
425
+ **Ownership boundary:** Relay AI keeps sole ownership of provider registration, credentials, the OS keyring, and OAuth login/refresh. `createRelayModel()` resolves credentials (refreshing expiring OAuth tokens) at call time and returns only the SDK model — your app never receives or stores credential material. Re-authentication always happens through Relay (`relay-ai ui`), never through the consumer.
426
+
427
+ **No server required:** the Core API reads the same registry and config as the CLI (`~/.relay-ai`, overridable with `RELAY_AI_HOME`) and never starts a server, opens a browser, or writes to disk. `createRelayModel()` re-reads state on every call, so provider changes take effect without restarting your app. Errors are thrown as `RelayCoreError` with a machine-readable `code` (see `isRelayCoreError`) and never contain credential material.
428
+
429
+ **Schema compatibility:** Core supports registry schema v1. A registry written by a newer Relay version fails fast with `UNSUPPORTED_REGISTRY_VERSION` — upgrade relay-ai rather than downgrading the file.
430
+
431
+ **Capability detection:** `capabilities.tools` and `capabilities.vision` are always `'unknown'` today — the cached model catalog carries no tools/vision metadata, and Core deliberately never guesses from a model's name. Don't filter on `=== true` for these two fields; use `capabilities.reasoning` (`'none' | 'fixed' | 'adjustable' | 'unknown'`), which is derived from real provider metadata.
432
+
433
+ **Full guide:** prerequisites, the complete API and error-code reference, and troubleshooting — see **[docs/CORE.md](docs/CORE.md)**.
434
+
409
435
  ## Antigravity CLI, app, and IDE support
410
436
 
411
437
  Relay AI can launch the Antigravity CLI, standalone Antigravity app, and Antigravity IDE through a local Cloud Code gateway. This lets Antigravity's native model picker show Relay models from your configured providers.
@@ -11,7 +11,7 @@ import { join } from "path";
11
11
  // package.json
12
12
  var package_default = {
13
13
  name: "@jacobbd/relay-ai",
14
- version: "0.6.3",
14
+ version: "0.7.0",
15
15
  publishConfig: {
16
16
  access: "public"
17
17
  },
@@ -46,7 +46,7 @@ var package_default = {
46
46
  node: ">=18"
47
47
  },
48
48
  scripts: {
49
- build: "tsup && node scripts/copy-ui-assets.mjs",
49
+ build: "tsup && tsup --config tsup.core.config.ts && node scripts/copy-ui-assets.mjs",
50
50
  dev: "tsup --watch",
51
51
  test: "vitest run",
52
52
  "test:watch": "vitest",
@@ -100,6 +100,14 @@ var package_default = {
100
100
  },
101
101
  overrides: {
102
102
  ws: "^8.21.0"
103
+ },
104
+ exports: {
105
+ "./core": {
106
+ types: "./dist/core/index.d.ts",
107
+ import: "./dist/core/index.js",
108
+ default: "./dist/core/index.js"
109
+ },
110
+ "./package.json": "./package.json"
103
111
  }
104
112
  };
105
113
 
@@ -3627,7 +3635,7 @@ function parseRegistry(raw) {
3627
3635
  if (typeof data.pricingCacheAt === "string") registry.pricingCacheAt = data.pricingCacheAt;
3628
3636
  return registry;
3629
3637
  }
3630
- function loadRegistry(path = getProvidersPath()) {
3638
+ function loadRegistry(path = getProvidersPath(), { persist = true } = {}) {
3631
3639
  if (!existsSync6(path)) {
3632
3640
  return { schemaVersion: REGISTRY_SCHEMA_VERSION, providers: [] };
3633
3641
  }
@@ -3638,7 +3646,7 @@ function loadRegistry(path = getProvidersPath()) {
3638
3646
  if (migrateOAuthOpenAiProvider(registry)) migrated = true;
3639
3647
  if (migrateOAuthXaiProvider(registry)) migrated = true;
3640
3648
  if (migrateAlibabaDashScopeChinaLabel(registry)) migrated = true;
3641
- if (migrated) {
3649
+ if (migrated && persist) {
3642
3650
  try {
3643
3651
  saveRegistry(registry, path);
3644
3652
  } catch {
@@ -11103,4 +11111,4 @@ export {
11103
11111
  supportsClaudeTransparentMode,
11104
11112
  buildHttpProxyRoutes
11105
11113
  };
11106
- //# sourceMappingURL=chunk-WHEMJ7C3.js.map
11114
+ //# sourceMappingURL=chunk-IYYLLN5T.js.map