@botbotgo/agent-harness 0.0.28 → 0.0.29
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.28";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.28";
|
|
@@ -15,17 +15,44 @@ const MODEL_SAFE_TOOL_NAME_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
|
|
15
15
|
function asObject(value) {
|
|
16
16
|
return typeof value === "object" && value ? value : undefined;
|
|
17
17
|
}
|
|
18
|
+
function isPlaceholderApiKey(value) {
|
|
19
|
+
return typeof value === "string" && value.trim().toLowerCase() === "dummy";
|
|
20
|
+
}
|
|
21
|
+
function buildAuthOmittingFetch(baseFetch = fetch) {
|
|
22
|
+
return async (input, init) => {
|
|
23
|
+
const sanitizedHeaders = new Headers(input instanceof Request ? input.headers : undefined);
|
|
24
|
+
const initHeaders = new Headers(init?.headers);
|
|
25
|
+
initHeaders.forEach((value, key) => {
|
|
26
|
+
sanitizedHeaders.set(key, value);
|
|
27
|
+
});
|
|
28
|
+
sanitizedHeaders.delete("authorization");
|
|
29
|
+
if (input instanceof Request) {
|
|
30
|
+
return baseFetch(new Request(input, {
|
|
31
|
+
...init,
|
|
32
|
+
headers: sanitizedHeaders,
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
return baseFetch(input, {
|
|
36
|
+
...init,
|
|
37
|
+
headers: sanitizedHeaders,
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
}
|
|
18
41
|
function normalizeOpenAICompatibleInit(init) {
|
|
19
42
|
const normalized = { ...init };
|
|
20
43
|
const configuration = asObject(init.configuration) ?? {};
|
|
21
44
|
const baseUrl = typeof init.baseUrl === "string" && init.baseUrl.trim() ? init.baseUrl.trim() : undefined;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
45
|
+
const omitAuthHeader = init.omitAuthHeader === true || isPlaceholderApiKey(init.apiKey);
|
|
46
|
+
const nextConfiguration = { ...configuration };
|
|
47
|
+
if (baseUrl && typeof nextConfiguration.baseURL !== "string") {
|
|
48
|
+
nextConfiguration.baseURL = baseUrl;
|
|
49
|
+
}
|
|
50
|
+
if (omitAuthHeader) {
|
|
51
|
+
nextConfiguration.fetch = buildAuthOmittingFetch(typeof configuration.fetch === "function" ? configuration.fetch : fetch);
|
|
27
52
|
}
|
|
53
|
+
normalized.configuration = nextConfiguration;
|
|
28
54
|
delete normalized.baseUrl;
|
|
55
|
+
delete normalized.omitAuthHeader;
|
|
29
56
|
return normalized;
|
|
30
57
|
}
|
|
31
58
|
function sanitizeToolNameForModel(name) {
|