@strayl/agent 0.1.2 → 0.1.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/agent.js CHANGED
@@ -12044,14 +12044,13 @@ function runFind(pattern, searchPath, workDir) {
12044
12044
  async function proxyFetch(service, directUrl, directApiKey, init, env) {
12045
12045
  if (env.STRAYL_LLM_DIRECT === "1") {
12046
12046
  const key = env[directApiKey];
12047
- if (!key) {
12048
- throw new Error(`${directApiKey} not configured (direct mode)`);
12049
- }
12050
- const headers2 = new Headers(init.headers);
12051
- if (!headers2.has("Authorization")) {
12052
- headers2.set("Authorization", `Bearer ${key}`);
12047
+ if (key) {
12048
+ const headers2 = new Headers(init.headers);
12049
+ if (!headers2.has("Authorization")) {
12050
+ headers2.set("Authorization", `Bearer ${key}`);
12051
+ }
12052
+ return fetch(directUrl, { ...init, headers: headers2 });
12053
12053
  }
12054
- return fetch(directUrl, { ...init, headers: headers2 });
12055
12054
  }
12056
12055
  const apiUrl = env.STRAYL_API_URL ?? "https://api.strayl.dev";
12057
12056
  const token = env.STRAYL_SESSION_TOKEN ?? "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strayl/agent",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -26,16 +26,16 @@ export async function proxyFetch(
26
26
  env: Record<string, string>,
27
27
  ): Promise<Response> {
28
28
  if (env.STRAYL_LLM_DIRECT === "1") {
29
- // Direct mode — use raw API key
29
+ // Direct mode — use raw API key if available, otherwise fall back to proxy
30
30
  const key = env[directApiKey];
31
- if (!key) {
32
- throw new Error(`${directApiKey} not configured (direct mode)`);
31
+ if (key) {
32
+ const headers = new Headers(init.headers);
33
+ if (!headers.has("Authorization")) {
34
+ headers.set("Authorization", `Bearer ${key}`);
35
+ }
36
+ return fetch(directUrl, { ...init, headers });
33
37
  }
34
- const headers = new Headers(init.headers);
35
- if (!headers.has("Authorization")) {
36
- headers.set("Authorization", `Bearer ${key}`);
37
- }
38
- return fetch(directUrl, { ...init, headers });
38
+ // Key not in env — fall through to proxy mode
39
39
  }
40
40
 
41
41
  // Proxy mode — route through api.strayl.dev