@jacobbd/relay-ai 0.7.2 → 0.7.3
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/dist/{chunk-LNQ46VW7.js → chunk-5LPUIWNJ.js} +116 -13
- package/dist/chunk-5LPUIWNJ.js.map +1 -0
- package/dist/cli.js +5 -50
- package/dist/cli.js.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/ui/public/app.js +139 -7
- package/dist/ui/public/provider-model-browser.js +27 -8
- package/dist/ui/public/style.css +122 -5
- package/dist/{ui-command-5VEFZ5GM.js → ui-command-DMPYSK7W.js} +74 -5
- package/dist/ui-command-DMPYSK7W.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-LNQ46VW7.js.map +0 -1
- package/dist/ui-command-5VEFZ5GM.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
addOpencodeCloudFromApiKey,
|
|
15
15
|
addProviderFromTemplate,
|
|
16
16
|
aliasModelId,
|
|
17
|
+
anthropicMessagesEndpoint,
|
|
18
|
+
anthropicModelsEndpoint,
|
|
17
19
|
appendCodexBodyDump,
|
|
18
20
|
authenticateProvider,
|
|
19
21
|
buildAntigravityChildEnv,
|
|
@@ -45,6 +47,7 @@ import {
|
|
|
45
47
|
effectiveProviderBaseUrl,
|
|
46
48
|
effortProviderOptions,
|
|
47
49
|
encodeToolUseId,
|
|
50
|
+
estimateAnthropicInputTokens,
|
|
48
51
|
evaluateAgySwitchCompatibility,
|
|
49
52
|
extractApiKey,
|
|
50
53
|
favoriteProviderDisplayName,
|
|
@@ -174,7 +177,7 @@ import {
|
|
|
174
177
|
validateCustomEndpointUrl,
|
|
175
178
|
writeSecureLogLine,
|
|
176
179
|
zenRegistryStub
|
|
177
|
-
} from "./chunk-
|
|
180
|
+
} from "./chunk-5LPUIWNJ.js";
|
|
178
181
|
import {
|
|
179
182
|
filterTemplates,
|
|
180
183
|
init_provider_templates,
|
|
@@ -11464,54 +11467,6 @@ import * as https from "https";
|
|
|
11464
11467
|
import * as net from "net";
|
|
11465
11468
|
import { randomBytes as randomBytes2, timingSafeEqual } from "crypto";
|
|
11466
11469
|
import { URL as URL2 } from "url";
|
|
11467
|
-
|
|
11468
|
-
// src/anthropic-endpoints.ts
|
|
11469
|
-
var MESSAGE_PATH = "/v1/messages";
|
|
11470
|
-
var COUNT_TOKENS_PATH = "/v1/messages/count_tokens";
|
|
11471
|
-
var MODELS_PATH = "/v1/models";
|
|
11472
|
-
function anthropicModelsEndpoint(url) {
|
|
11473
|
-
if (!url) return null;
|
|
11474
|
-
try {
|
|
11475
|
-
const pathname = new URL(url, "http://relay.local").pathname;
|
|
11476
|
-
if (pathname === MODELS_PATH || pathname === `${MODELS_PATH}/`) return "list";
|
|
11477
|
-
if (pathname.startsWith(`${MODELS_PATH}/`)) {
|
|
11478
|
-
const id = decodeURIComponent(pathname.slice(MODELS_PATH.length + 1));
|
|
11479
|
-
if (id) return { id };
|
|
11480
|
-
}
|
|
11481
|
-
} catch {
|
|
11482
|
-
}
|
|
11483
|
-
return null;
|
|
11484
|
-
}
|
|
11485
|
-
function anthropicMessagesEndpoint(url) {
|
|
11486
|
-
if (!url) return null;
|
|
11487
|
-
try {
|
|
11488
|
-
const pathname = new URL(url, "http://relay.local").pathname;
|
|
11489
|
-
if (pathname === MESSAGE_PATH) return "messages";
|
|
11490
|
-
if (pathname === COUNT_TOKENS_PATH) return "count_tokens";
|
|
11491
|
-
} catch {
|
|
11492
|
-
}
|
|
11493
|
-
return null;
|
|
11494
|
-
}
|
|
11495
|
-
var NON_CONTEXT_FIELDS = /* @__PURE__ */ new Set([
|
|
11496
|
-
"model",
|
|
11497
|
-
"stream",
|
|
11498
|
-
"max_tokens",
|
|
11499
|
-
"temperature",
|
|
11500
|
-
"top_p",
|
|
11501
|
-
"top_k",
|
|
11502
|
-
"stop_sequences",
|
|
11503
|
-
"metadata"
|
|
11504
|
-
]);
|
|
11505
|
-
function estimateAnthropicInputTokens(body) {
|
|
11506
|
-
const contextBody = Object.fromEntries(
|
|
11507
|
-
Object.entries(body).filter(([key]) => !NON_CONTEXT_FIELDS.has(key))
|
|
11508
|
-
);
|
|
11509
|
-
const serialized = JSON.stringify(contextBody);
|
|
11510
|
-
if (!serialized || serialized === "{}") return 0;
|
|
11511
|
-
return Math.max(1, Math.ceil(Buffer.byteLength(serialized, "utf8") / 4));
|
|
11512
|
-
}
|
|
11513
|
-
|
|
11514
|
-
// src/http-proxy/server.ts
|
|
11515
11470
|
var ANTHROPIC_HOST = RELAY_SENTINEL_HOST;
|
|
11516
11471
|
var MAX_BODY_BYTES = 50 * 1024 * 1024;
|
|
11517
11472
|
var PROXY_USERNAME = "relay-ai";
|
|
@@ -13438,7 +13393,7 @@ Options:
|
|
|
13438
13393
|
--trace Write debug logs under ~/.relay-ai/logs/`);
|
|
13439
13394
|
return 0;
|
|
13440
13395
|
}
|
|
13441
|
-
const { runUiCommand } = await import("./ui-command-
|
|
13396
|
+
const { runUiCommand } = await import("./ui-command-DMPYSK7W.js");
|
|
13442
13397
|
return runUiCommand({ trace: parsed.trace, serverMode: parsed.uiServerMode });
|
|
13443
13398
|
}
|
|
13444
13399
|
if (parsed.command === "models") {
|