@x-otto/cli 0.0.1-alpha.49 → 0.0.1-alpha.50
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/{auth-command-D1T16ed-.js → auth-command-BYaFM76w.js} +2 -2
- package/dist/{auth-command-D1T16ed-.js.map → auth-command-BYaFM76w.js.map} +1 -1
- package/dist/backend-handler-DUafuNWw.js +3 -0
- package/dist/backend-handler-DUafuNWw.js.map +1 -0
- package/dist/build-id-DjE6eVpQ.js +3 -0
- package/dist/build-id-DjE6eVpQ.js.map +1 -0
- package/dist/bundled-extensions/plugin-feedback/otto-plugin.json +24 -0
- package/dist/bundled-extensions/plugin-feedback/panels/feedback.tsx +348 -0
- package/dist/bundled-extensions/plugin-feedback/panels/panel-host-globals.d.ts +67 -0
- package/dist/bundled-extensions/plugin-feedback/panels-dist/feedback.mjs +257 -0
- package/dist/bundled-extensions/plugin-feedback/plugin-dist/meta.json +1 -0
- package/dist/bundled-extensions/plugin-feedback/plugin-dist/plugin.cjs +11304 -0
- package/dist/bundled-extensions/plugin-feedback/plugin.ts +198 -0
- package/dist/bundled-extensions/plugin-feedback/src/coding-adapter.ts +183 -0
- package/dist/bundled-extensions/plugin-feedback/src/coding-lister.ts +26 -0
- package/dist/bundled-extensions/plugin-feedback/src/github-lister.ts +230 -0
- package/dist/bundled-extensions/plugin-feedback/src/issue-aggregator.ts +109 -0
- package/dist/bundled-extensions/plugin-feedback/src/issue-submitter.ts +241 -0
- package/dist/bundled-extensions/plugin-feedback/src/platform-resolver.ts +76 -0
- package/dist/bundled-extensions/plugin-feedback/src/pulse-survey-sink.ts +114 -0
- package/dist/bundled-extensions/plugin-feedback/src/resolved-sink.ts +163 -0
- package/dist/bundled-extensions/plugin-otto-wire-protocols/plugin-dist/meta.json +1 -1
- package/dist/bundled-extensions/plugin-otto-wire-protocols/plugin-dist/plugin.cjs +605 -725
- package/dist/bundled-extensions/plugin-otto-wire-protocols/src/anthropic-messages.ts +4 -22
- package/dist/bundled-extensions/plugin-otto-wire-protocols/src/openai-completions.ts +5 -5
- package/dist/bundled-extensions/plugin-otto-wire-protocols/src/openai-responses.ts +3 -15
- package/dist/command-dispatcher-BLT8IO4K.js +18 -0
- package/dist/command-dispatcher-BLT8IO4K.js.map +1 -0
- package/dist/create-host-app-CbJ8ptv-.js +3 -0
- package/dist/{create-host-app-BXQ8bU-B.js.map → create-host-app-CbJ8ptv-.js.map} +1 -1
- package/dist/{daemon-base-Y1XI61JY.js → daemon-base-D015ew5y.js} +1 -1
- package/dist/{daemon-base-Y1XI61JY.js.map → daemon-base-D015ew5y.js.map} +1 -1
- package/dist/{doctor-DXBLkbkP.js → doctor-EndB-ycb.js} +3 -3
- package/dist/{doctor-DXBLkbkP.js.map → doctor-EndB-ycb.js.map} +1 -1
- package/dist/{doctor-attach-DEMuyBOk.js → doctor-attach-DEoE7eFx.js} +2 -2
- package/dist/{doctor-attach-DEMuyBOk.js.map → doctor-attach-DEoE7eFx.js.map} +1 -1
- package/dist/{doctor-cdp-CnJUVNOB.js → doctor-cdp-Cj9IFpEP.js} +1 -1
- package/dist/{doctor-cdp-CnJUVNOB.js.map → doctor-cdp-Cj9IFpEP.js.map} +1 -1
- package/dist/{doctor-heap-Eu3LZj-F.js → doctor-heap-SIxiRvL8.js} +2 -2
- package/dist/{doctor-heap-Eu3LZj-F.js.map → doctor-heap-SIxiRvL8.js.map} +1 -1
- package/dist/{doctor-ps-JBgCH77n.js → doctor-ps-DNVOF6yY.js} +2 -2
- package/dist/{doctor-ps-JBgCH77n.js.map → doctor-ps-DNVOF6yY.js.map} +1 -1
- package/dist/extension-CoJqqktf.js +2 -0
- package/dist/extension-Dpn8gltG.js +179 -0
- package/dist/extension-Dpn8gltG.js.map +1 -0
- package/dist/feedback-QcONRnO3.js +30 -0
- package/dist/feedback-QcONRnO3.js.map +1 -0
- package/dist/feedback-backend-methods-BNm38ddr.js +3 -0
- package/dist/feedback-backend-methods-BNm38ddr.js.map +1 -0
- package/dist/{feishu-setup-5ZoxtH0J.js → feishu-setup-DbAq_BRH.js} +1 -1
- package/dist/feishu-setup-DbAq_BRH.js.map +1 -0
- package/dist/{ftue-doctor-recovery-8FeDBFOc.js → ftue-doctor-recovery-CKTMnxM8.js} +1 -1
- package/dist/{ftue-doctor-recovery-8FeDBFOc.js.map → ftue-doctor-recovery-CKTMnxM8.js.map} +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/install-CEPczuet.js +11 -0
- package/dist/install-CEPczuet.js.map +1 -0
- package/dist/install-CG6b6fox.js +2 -0
- package/dist/interactive-schedule-Bv__2Kwc.js +3 -0
- package/dist/interactive-schedule-Bv__2Kwc.js.map +1 -0
- package/dist/{mcp-Cm4-OhXI.js → mcp-DjReRjuu.js} +1 -1
- package/dist/{mcp-Cm4-OhXI.js.map → mcp-DjReRjuu.js.map} +1 -1
- package/dist/{mcp-server-Dpza3yn2.js → mcp-server-Rr__aWO7.js} +3 -3
- package/dist/mcp-server-Rr__aWO7.js.map +1 -0
- package/dist/{migrate-RlBJqJnB.js → migrate-BBi3Txu2.js} +1 -1
- package/dist/{migrate-RlBJqJnB.js.map → migrate-BBi3Txu2.js.map} +1 -1
- package/dist/{observe-Dxfud-t7.js → observe-BqLCpmFD.js} +2 -2
- package/dist/{observe-Dxfud-t7.js.map → observe-BqLCpmFD.js.map} +1 -1
- package/dist/parse-cli-Db8pF_Ya.js +3 -0
- package/dist/parse-cli-Db8pF_Ya.js.map +1 -0
- package/dist/{persistence-CRFhOYx6.js → persistence-BvLRnpfi.js} +2 -2
- package/dist/{persistence-CRFhOYx6.js.map → persistence-BvLRnpfi.js.map} +1 -1
- package/dist/{plugin-assembly-check-DEozmcJ7.js → plugin-assembly-check-BntT5W6H.js} +1 -1
- package/dist/{plugin-assembly-check-DEozmcJ7.js.map → plugin-assembly-check-BntT5W6H.js.map} +1 -1
- package/dist/{proxy-evg7ZvoD.js → proxy-CFZDVIwI.js} +1 -1
- package/dist/proxy-CFZDVIwI.js.map +1 -0
- package/dist/proxy-CkSf8ziQ.js +2 -0
- package/dist/{ps-DiKCLKbs.js → ps-BVKv6rAo.js} +1 -1
- package/dist/{ps-DiKCLKbs.js.map → ps-BVKv6rAo.js.map} +1 -1
- package/dist/{registry-BdCcwyGy.js → registry-BUvu-es1.js} +4 -4
- package/dist/registry-BUvu-es1.js.map +1 -0
- package/dist/registry-DYHR-ONu.js +2 -0
- package/dist/{run-attach-DDpMk2_N.js → run-attach-X35puJ_n.js} +2 -2
- package/dist/{run-attach-DDpMk2_N.js.map → run-attach-X35puJ_n.js.map} +1 -1
- package/dist/schedule-Ke0jwatM.js +5 -0
- package/dist/schedule-Ke0jwatM.js.map +1 -0
- package/dist/serve-K6BOT5K_.js +21 -0
- package/dist/serve-K6BOT5K_.js.map +1 -0
- package/dist/{service-client-Cr4sxDVM.js → service-client-cfUUP4EE.js} +1 -1
- package/dist/{service-client-Cr4sxDVM.js.map → service-client-cfUUP4EE.js.map} +1 -1
- package/dist/{version-BrSIyY6s.js → version-DrCy32wR.js} +2 -2
- package/dist/{version-BrSIyY6s.js.map → version-DrCy32wR.js.map} +1 -1
- package/package.json +16 -13
- package/dist/build-id-DxfuzdUE.js +0 -3
- package/dist/build-id-DxfuzdUE.js.map +0 -1
- package/dist/command-dispatcher-DTOPjtZP.js +0 -21
- package/dist/command-dispatcher-DTOPjtZP.js.map +0 -1
- package/dist/create-host-app-BXQ8bU-B.js +0 -3
- package/dist/create-host-app-DG58-vRA.js +0 -2
- package/dist/extension-CTyrcdT1.js +0 -2
- package/dist/extension-DVEml5IN.js +0 -179
- package/dist/extension-DVEml5IN.js.map +0 -1
- package/dist/feedback-DvWUvSc4.js +0 -21
- package/dist/feedback-DvWUvSc4.js.map +0 -1
- package/dist/feedback-DzPLfcfN.js +0 -2
- package/dist/feishu-setup-5ZoxtH0J.js.map +0 -1
- package/dist/install-DlVJRHRT.js +0 -11
- package/dist/install-DlVJRHRT.js.map +0 -1
- package/dist/install-WCcQ9k9M.js +0 -2
- package/dist/mcp-server-Dpza3yn2.js.map +0 -1
- package/dist/parse-cli-BvcxTK88.js +0 -3
- package/dist/parse-cli-BvcxTK88.js.map +0 -1
- package/dist/proxy-BvdBsB1O.js +0 -2
- package/dist/proxy-evg7ZvoD.js.map +0 -1
- package/dist/registry-BOX7DaxS.js +0 -2
- package/dist/registry-BdCcwyGy.js.map +0 -1
- package/dist/serve-Ke0nwN9Y.js +0 -21
- package/dist/serve-Ke0nwN9Y.js.map +0 -1
|
@@ -9516,8 +9516,8 @@ var require_mime_types = __commonJS({
|
|
|
9516
9516
|
return;
|
|
9517
9517
|
}
|
|
9518
9518
|
extensions[type] = exts;
|
|
9519
|
-
for (var
|
|
9520
|
-
var extension2 = exts[
|
|
9519
|
+
for (var i3 = 0; i3 < exts.length; i3++) {
|
|
9520
|
+
var extension2 = exts[i3];
|
|
9521
9521
|
types[extension2] = _preferredType(extension2, types[extension2], type);
|
|
9522
9522
|
const legacyType = _preferredTypeLegacy(
|
|
9523
9523
|
extension2,
|
|
@@ -9581,9 +9581,9 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
9581
9581
|
if (array.length > 200 || comparator) {
|
|
9582
9582
|
return array.sort(comparator);
|
|
9583
9583
|
}
|
|
9584
|
-
for (let
|
|
9585
|
-
const currentValue = array[
|
|
9586
|
-
let position =
|
|
9584
|
+
for (let i3 = 1; i3 < array.length; i3++) {
|
|
9585
|
+
const currentValue = array[i3];
|
|
9586
|
+
let position = i3;
|
|
9587
9587
|
while (position !== 0 && array[position - 1] > currentValue) {
|
|
9588
9588
|
array[position] = array[position - 1];
|
|
9589
9589
|
position--;
|
|
@@ -9609,8 +9609,8 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
9609
9609
|
}
|
|
9610
9610
|
const whitespace = separator === "," ? "" : " ";
|
|
9611
9611
|
let res = `"0":${whitespace}${array[0]}`;
|
|
9612
|
-
for (let
|
|
9613
|
-
res += `${separator}"${
|
|
9612
|
+
for (let i3 = 1; i3 < maximumBreadth; i3++) {
|
|
9613
|
+
res += `${separator}"${i3}":${whitespace}${array[i3]}`;
|
|
9614
9614
|
}
|
|
9615
9615
|
return res;
|
|
9616
9616
|
}
|
|
@@ -9752,13 +9752,13 @@ ${indentation}`;
|
|
|
9752
9752
|
${indentation}`;
|
|
9753
9753
|
}
|
|
9754
9754
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
9755
|
-
let
|
|
9756
|
-
for (;
|
|
9757
|
-
const tmp2 = stringifyFnReplacer(String(
|
|
9755
|
+
let i3 = 0;
|
|
9756
|
+
for (; i3 < maximumValuesToStringify - 1; i3++) {
|
|
9757
|
+
const tmp2 = stringifyFnReplacer(String(i3), value, stack, replacer, spacer, indentation);
|
|
9758
9758
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
9759
9759
|
res += join;
|
|
9760
9760
|
}
|
|
9761
|
-
const tmp = stringifyFnReplacer(String(
|
|
9761
|
+
const tmp = stringifyFnReplacer(String(i3), value, stack, replacer, spacer, indentation);
|
|
9762
9762
|
res += tmp !== void 0 ? tmp : "null";
|
|
9763
9763
|
if (value.length - 1 > maximumBreadth) {
|
|
9764
9764
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
@@ -9792,8 +9792,8 @@ ${indentation}`;
|
|
|
9792
9792
|
keys = sort(keys, comparator);
|
|
9793
9793
|
}
|
|
9794
9794
|
stack.push(value);
|
|
9795
|
-
for (let
|
|
9796
|
-
const key2 = keys[
|
|
9795
|
+
for (let i3 = 0; i3 < maximumPropertiesToStringify; i3++) {
|
|
9796
|
+
const key2 = keys[i3];
|
|
9797
9797
|
const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
|
|
9798
9798
|
if (tmp !== void 0) {
|
|
9799
9799
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
@@ -9861,13 +9861,13 @@ ${indentation}`;
|
|
|
9861
9861
|
${indentation}`;
|
|
9862
9862
|
}
|
|
9863
9863
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
9864
|
-
let
|
|
9865
|
-
for (;
|
|
9866
|
-
const tmp2 = stringifyArrayReplacer(String(
|
|
9864
|
+
let i3 = 0;
|
|
9865
|
+
for (; i3 < maximumValuesToStringify - 1; i3++) {
|
|
9866
|
+
const tmp2 = stringifyArrayReplacer(String(i3), value[i3], stack, replacer, spacer, indentation);
|
|
9867
9867
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
9868
9868
|
res += join;
|
|
9869
9869
|
}
|
|
9870
|
-
const tmp = stringifyArrayReplacer(String(
|
|
9870
|
+
const tmp = stringifyArrayReplacer(String(i3), value[i3], stack, replacer, spacer, indentation);
|
|
9871
9871
|
res += tmp !== void 0 ? tmp : "null";
|
|
9872
9872
|
if (value.length - 1 > maximumBreadth) {
|
|
9873
9873
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
@@ -9954,13 +9954,13 @@ ${indentation}`;
|
|
|
9954
9954
|
const join2 = `,
|
|
9955
9955
|
${indentation}`;
|
|
9956
9956
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
9957
|
-
let
|
|
9958
|
-
for (;
|
|
9959
|
-
const tmp2 = stringifyIndent(String(
|
|
9957
|
+
let i3 = 0;
|
|
9958
|
+
for (; i3 < maximumValuesToStringify - 1; i3++) {
|
|
9959
|
+
const tmp2 = stringifyIndent(String(i3), value[i3], stack, spacer, indentation);
|
|
9960
9960
|
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
9961
9961
|
res2 += join2;
|
|
9962
9962
|
}
|
|
9963
|
-
const tmp = stringifyIndent(String(
|
|
9963
|
+
const tmp = stringifyIndent(String(i3), value[i3], stack, spacer, indentation);
|
|
9964
9964
|
res2 += tmp !== void 0 ? tmp : "null";
|
|
9965
9965
|
if (value.length - 1 > maximumBreadth) {
|
|
9966
9966
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
@@ -9995,8 +9995,8 @@ ${indentation}`;
|
|
|
9995
9995
|
keys = sort(keys, comparator);
|
|
9996
9996
|
}
|
|
9997
9997
|
stack.push(value);
|
|
9998
|
-
for (let
|
|
9999
|
-
const key2 = keys[
|
|
9998
|
+
for (let i3 = 0; i3 < maximumPropertiesToStringify; i3++) {
|
|
9999
|
+
const key2 = keys[i3];
|
|
10000
10000
|
const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
|
|
10001
10001
|
if (tmp !== void 0) {
|
|
10002
10002
|
res += `${separator}${strEscape(key2)}: ${tmp}`;
|
|
@@ -10062,13 +10062,13 @@ ${originalIndentation}`;
|
|
|
10062
10062
|
}
|
|
10063
10063
|
stack.push(value);
|
|
10064
10064
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
10065
|
-
let
|
|
10066
|
-
for (;
|
|
10067
|
-
const tmp2 = stringifySimple(String(
|
|
10065
|
+
let i3 = 0;
|
|
10066
|
+
for (; i3 < maximumValuesToStringify - 1; i3++) {
|
|
10067
|
+
const tmp2 = stringifySimple(String(i3), value[i3], stack);
|
|
10068
10068
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
10069
10069
|
res += ",";
|
|
10070
10070
|
}
|
|
10071
|
-
const tmp = stringifySimple(String(
|
|
10071
|
+
const tmp = stringifySimple(String(i3), value[i3], stack);
|
|
10072
10072
|
res += tmp !== void 0 ? tmp : "null";
|
|
10073
10073
|
if (value.length - 1 > maximumBreadth) {
|
|
10074
10074
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
@@ -10097,8 +10097,8 @@ ${originalIndentation}`;
|
|
|
10097
10097
|
keys = sort(keys, comparator);
|
|
10098
10098
|
}
|
|
10099
10099
|
stack.push(value);
|
|
10100
|
-
for (let
|
|
10101
|
-
const key2 = keys[
|
|
10100
|
+
for (let i3 = 0; i3 < maximumPropertiesToStringify; i3++) {
|
|
10101
|
+
const key2 = keys[i3];
|
|
10102
10102
|
const tmp = stringifySimple(key2, value[key2], stack);
|
|
10103
10103
|
if (tmp !== void 0) {
|
|
10104
10104
|
res += `${separator}${strEscape(key2)}:${tmp}`;
|
|
@@ -10173,27 +10173,27 @@ __export(plugin_exports, {
|
|
|
10173
10173
|
module.exports = __toCommonJS(plugin_exports);
|
|
10174
10174
|
|
|
10175
10175
|
// otto-sdk-shim:otto-plugin-sdk
|
|
10176
|
-
var definePlugin = (
|
|
10176
|
+
var definePlugin = (f) => f;
|
|
10177
10177
|
|
|
10178
10178
|
// ../../extensions/plugin-otto-wire-protocols/src/anthropic-messages.ts
|
|
10179
10179
|
var import_node_crypto = require("node:crypto");
|
|
10180
10180
|
|
|
10181
10181
|
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.88.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/tslib.mjs
|
|
10182
|
-
function __classPrivateFieldSet(receiver, state, value, kind,
|
|
10182
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
10183
10183
|
if (kind === "m")
|
|
10184
10184
|
throw new TypeError("Private method is not writable");
|
|
10185
|
-
if (kind === "a" && !
|
|
10185
|
+
if (kind === "a" && !f)
|
|
10186
10186
|
throw new TypeError("Private accessor was defined without a setter");
|
|
10187
|
-
if (typeof state === "function" ? receiver !== state || !
|
|
10187
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
10188
10188
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10189
|
-
return kind === "a" ?
|
|
10189
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
10190
10190
|
}
|
|
10191
|
-
function __classPrivateFieldGet(receiver, state, kind,
|
|
10192
|
-
if (kind === "a" && !
|
|
10191
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
10192
|
+
if (kind === "a" && !f)
|
|
10193
10193
|
throw new TypeError("Private accessor was defined without a getter");
|
|
10194
|
-
if (typeof state === "function" ? receiver !== state || !
|
|
10194
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
10195
10195
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10196
|
-
return kind === "m" ?
|
|
10196
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
10197
10197
|
}
|
|
10198
10198
|
|
|
10199
10199
|
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.88.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/uuid.mjs
|
|
@@ -10205,7 +10205,7 @@ var uuid4 = function() {
|
|
|
10205
10205
|
}
|
|
10206
10206
|
const u8 = new Uint8Array(1);
|
|
10207
10207
|
const randomByte = crypto ? () => crypto.getRandomValues(u8)[0] : () => Math.random() * 255 & 255;
|
|
10208
|
-
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (
|
|
10208
|
+
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c3) => (+c3 ^ randomByte() & 15 >> +c3 / 4).toString(16));
|
|
10209
10209
|
};
|
|
10210
10210
|
|
|
10211
10211
|
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.88.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/errors.mjs
|
|
@@ -10338,11 +10338,11 @@ var isAbsoluteURL = (url) => {
|
|
|
10338
10338
|
};
|
|
10339
10339
|
var isArray = (val) => (isArray = Array.isArray, isArray(val));
|
|
10340
10340
|
var isReadonlyArray = isArray;
|
|
10341
|
-
function maybeObj(
|
|
10342
|
-
if (typeof
|
|
10341
|
+
function maybeObj(x3) {
|
|
10342
|
+
if (typeof x3 !== "object") {
|
|
10343
10343
|
return {};
|
|
10344
10344
|
}
|
|
10345
|
-
return
|
|
10345
|
+
return x3 ?? {};
|
|
10346
10346
|
}
|
|
10347
10347
|
function isEmptyObj(obj) {
|
|
10348
10348
|
if (!obj)
|
|
@@ -10354,14 +10354,14 @@ function isEmptyObj(obj) {
|
|
|
10354
10354
|
function hasOwn(obj, key) {
|
|
10355
10355
|
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
10356
10356
|
}
|
|
10357
|
-
var validatePositiveInteger = (name,
|
|
10358
|
-
if (typeof
|
|
10357
|
+
var validatePositiveInteger = (name, n5) => {
|
|
10358
|
+
if (typeof n5 !== "number" || !Number.isInteger(n5)) {
|
|
10359
10359
|
throw new AnthropicError(`${name} must be an integer`);
|
|
10360
10360
|
}
|
|
10361
|
-
if (
|
|
10361
|
+
if (n5 < 0) {
|
|
10362
10362
|
throw new AnthropicError(`${name} must be a positive integer`);
|
|
10363
10363
|
}
|
|
10364
|
-
return
|
|
10364
|
+
return n5;
|
|
10365
10365
|
};
|
|
10366
10366
|
var safeJSON = (text) => {
|
|
10367
10367
|
try {
|
|
@@ -10554,9 +10554,9 @@ function ReadableStreamToAsyncIterable(stream) {
|
|
|
10554
10554
|
if (result?.done)
|
|
10555
10555
|
reader.releaseLock();
|
|
10556
10556
|
return result;
|
|
10557
|
-
} catch (
|
|
10557
|
+
} catch (e8) {
|
|
10558
10558
|
reader.releaseLock();
|
|
10559
|
-
throw
|
|
10559
|
+
throw e8;
|
|
10560
10560
|
}
|
|
10561
10561
|
},
|
|
10562
10562
|
async return() {
|
|
@@ -10595,7 +10595,7 @@ var FallbackEncoder = ({ headers, body }) => {
|
|
|
10595
10595
|
|
|
10596
10596
|
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.88.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/query.mjs
|
|
10597
10597
|
function stringifyQuery(query) {
|
|
10598
|
-
return Object.entries(query).filter(([
|
|
10598
|
+
return Object.entries(query).filter(([_3, value]) => typeof value !== "undefined").map(([key, value]) => {
|
|
10599
10599
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
10600
10600
|
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
|
10601
10601
|
}
|
|
@@ -10681,12 +10681,12 @@ LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r]/g;
|
|
|
10681
10681
|
function findNewlineIndex(buffer, startIndex) {
|
|
10682
10682
|
const newline = 10;
|
|
10683
10683
|
const carriage = 13;
|
|
10684
|
-
for (let
|
|
10685
|
-
if (buffer[
|
|
10686
|
-
return { preceding:
|
|
10684
|
+
for (let i3 = startIndex ?? 0; i3 < buffer.length; i3++) {
|
|
10685
|
+
if (buffer[i3] === newline) {
|
|
10686
|
+
return { preceding: i3, index: i3 + 1, carriage: false };
|
|
10687
10687
|
}
|
|
10688
|
-
if (buffer[
|
|
10689
|
-
return { preceding:
|
|
10688
|
+
if (buffer[i3] === carriage) {
|
|
10689
|
+
return { preceding: i3, index: i3 + 1, carriage: true };
|
|
10690
10690
|
}
|
|
10691
10691
|
}
|
|
10692
10692
|
return null;
|
|
@@ -10694,15 +10694,15 @@ function findNewlineIndex(buffer, startIndex) {
|
|
|
10694
10694
|
function findDoubleNewlineIndex(buffer) {
|
|
10695
10695
|
const newline = 10;
|
|
10696
10696
|
const carriage = 13;
|
|
10697
|
-
for (let
|
|
10698
|
-
if (buffer[
|
|
10699
|
-
return
|
|
10697
|
+
for (let i3 = 0; i3 < buffer.length - 1; i3++) {
|
|
10698
|
+
if (buffer[i3] === newline && buffer[i3 + 1] === newline) {
|
|
10699
|
+
return i3 + 2;
|
|
10700
10700
|
}
|
|
10701
|
-
if (buffer[
|
|
10702
|
-
return
|
|
10701
|
+
if (buffer[i3] === carriage && buffer[i3 + 1] === carriage) {
|
|
10702
|
+
return i3 + 2;
|
|
10703
10703
|
}
|
|
10704
|
-
if (buffer[
|
|
10705
|
-
return
|
|
10704
|
+
if (buffer[i3] === carriage && buffer[i3 + 1] === newline && i3 + 3 < buffer.length && buffer[i3 + 2] === carriage && buffer[i3 + 3] === newline) {
|
|
10705
|
+
return i3 + 4;
|
|
10706
10706
|
}
|
|
10707
10707
|
}
|
|
10708
10708
|
return -1;
|
|
@@ -10804,19 +10804,19 @@ var Stream = class _Stream {
|
|
|
10804
10804
|
if (sse.event === "completion") {
|
|
10805
10805
|
try {
|
|
10806
10806
|
yield JSON.parse(sse.data);
|
|
10807
|
-
} catch (
|
|
10807
|
+
} catch (e8) {
|
|
10808
10808
|
logger.error(`Could not parse message into JSON:`, sse.data);
|
|
10809
10809
|
logger.error(`From chunk:`, sse.raw);
|
|
10810
|
-
throw
|
|
10810
|
+
throw e8;
|
|
10811
10811
|
}
|
|
10812
10812
|
}
|
|
10813
10813
|
if (sse.event === "message_start" || sse.event === "message_delta" || sse.event === "message_stop" || sse.event === "content_block_start" || sse.event === "content_block_delta" || sse.event === "content_block_stop" || sse.event === "message") {
|
|
10814
10814
|
try {
|
|
10815
10815
|
yield JSON.parse(sse.data);
|
|
10816
|
-
} catch (
|
|
10816
|
+
} catch (e8) {
|
|
10817
10817
|
logger.error(`Could not parse message into JSON:`, sse.data);
|
|
10818
10818
|
logger.error(`From chunk:`, sse.raw);
|
|
10819
|
-
throw
|
|
10819
|
+
throw e8;
|
|
10820
10820
|
}
|
|
10821
10821
|
}
|
|
10822
10822
|
if (sse.event === "ping") {
|
|
@@ -10829,10 +10829,10 @@ var Stream = class _Stream {
|
|
|
10829
10829
|
}
|
|
10830
10830
|
}
|
|
10831
10831
|
done = true;
|
|
10832
|
-
} catch (
|
|
10833
|
-
if (isAbortError(
|
|
10832
|
+
} catch (e8) {
|
|
10833
|
+
if (isAbortError(e8))
|
|
10834
10834
|
return;
|
|
10835
|
-
throw
|
|
10835
|
+
throw e8;
|
|
10836
10836
|
} finally {
|
|
10837
10837
|
if (!done)
|
|
10838
10838
|
controller.abort();
|
|
@@ -10872,10 +10872,10 @@ var Stream = class _Stream {
|
|
|
10872
10872
|
yield JSON.parse(line);
|
|
10873
10873
|
}
|
|
10874
10874
|
done = true;
|
|
10875
|
-
} catch (
|
|
10876
|
-
if (isAbortError(
|
|
10875
|
+
} catch (e8) {
|
|
10876
|
+
if (isAbortError(e8))
|
|
10877
10877
|
return;
|
|
10878
|
-
throw
|
|
10878
|
+
throw e8;
|
|
10879
10879
|
} finally {
|
|
10880
10880
|
if (!done)
|
|
10881
10881
|
controller.abort();
|
|
@@ -11012,7 +11012,7 @@ var SSEDecoder = class {
|
|
|
11012
11012
|
if (line.startsWith(":")) {
|
|
11013
11013
|
return null;
|
|
11014
11014
|
}
|
|
11015
|
-
let [fieldname,
|
|
11015
|
+
let [fieldname, _3, value] = partition(line, ":");
|
|
11016
11016
|
if (value.startsWith(" ")) {
|
|
11017
11017
|
value = value.substring(1);
|
|
11018
11018
|
}
|
|
@@ -11109,7 +11109,7 @@ var APIPromise = class _APIPromise extends Promise {
|
|
|
11109
11109
|
* to your `tsconfig.json`.
|
|
11110
11110
|
*/
|
|
11111
11111
|
asResponse() {
|
|
11112
|
-
return this.responsePromise.then((
|
|
11112
|
+
return this.responsePromise.then((p) => p.response);
|
|
11113
11113
|
}
|
|
11114
11114
|
/**
|
|
11115
11115
|
* Gets the parsed response data, the raw `Response` instance and the ID of the request,
|
|
@@ -11401,7 +11401,7 @@ function propsForError(value) {
|
|
|
11401
11401
|
if (typeof value !== "object" || value === null)
|
|
11402
11402
|
return "";
|
|
11403
11403
|
const props = Object.getOwnPropertyNames(value);
|
|
11404
|
-
return `; props: [${props.map((
|
|
11404
|
+
return `; props: [${props.map((p) => `"${p}"`).join(", ")}]`;
|
|
11405
11405
|
}
|
|
11406
11406
|
|
|
11407
11407
|
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.88.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/resource.mjs
|
|
@@ -11511,7 +11511,7 @@ var createPathTagFunction = (pathEncoder = encodeURIPath) => function path2(stat
|
|
|
11511
11511
|
error: `Value "${match[0]}" can't be safely passed as a path parameter`
|
|
11512
11512
|
});
|
|
11513
11513
|
}
|
|
11514
|
-
invalidSegments.sort((
|
|
11514
|
+
invalidSegments.sort((a3, b3) => a3.start - b3.start);
|
|
11515
11515
|
if (invalidSegments.length > 0) {
|
|
11516
11516
|
let lastEnd = 0;
|
|
11517
11517
|
const underline = invalidSegments.reduce((acc, segment) => {
|
|
@@ -11521,7 +11521,7 @@ var createPathTagFunction = (pathEncoder = encodeURIPath) => function path2(stat
|
|
|
11521
11521
|
return acc + spaces + arrows;
|
|
11522
11522
|
}, "");
|
|
11523
11523
|
throw new AnthropicError(`Path parameters result in path with invalid segments:
|
|
11524
|
-
${invalidSegments.map((
|
|
11524
|
+
${invalidSegments.map((e8) => e8.error).join("\n")}
|
|
11525
11525
|
${path3}
|
|
11526
11526
|
${underline}`);
|
|
11527
11527
|
}
|
|
@@ -12937,7 +12937,7 @@ var BetaMessageStream = class _BetaMessageStream {
|
|
|
12937
12937
|
return stream.toReadableStream();
|
|
12938
12938
|
}
|
|
12939
12939
|
};
|
|
12940
|
-
function checkNever(
|
|
12940
|
+
function checkNever(x3) {
|
|
12941
12941
|
}
|
|
12942
12942
|
|
|
12943
12943
|
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.88.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/tools/ToolError.mjs
|
|
@@ -13226,7 +13226,7 @@ var BetaToolRunner = class {
|
|
|
13226
13226
|
*/
|
|
13227
13227
|
async runUntilDone() {
|
|
13228
13228
|
if (!__classPrivateFieldGet(this, _BetaToolRunner_consumed, "f")) {
|
|
13229
|
-
for await (const
|
|
13229
|
+
for await (const _3 of this) {
|
|
13230
13230
|
}
|
|
13231
13231
|
}
|
|
13232
13232
|
return this.done();
|
|
@@ -13294,7 +13294,7 @@ async function generateToolResponse(params, lastMessage = params.messages.at(-1)
|
|
|
13294
13294
|
return null;
|
|
13295
13295
|
}
|
|
13296
13296
|
const toolResults = await Promise.all(toolUseBlocks.map(async (toolUse) => {
|
|
13297
|
-
const tool = params.tools.find((
|
|
13297
|
+
const tool = params.tools.find((t6) => ("name" in t6 ? t6.name : t6.mcp_server_name) === toolUse.name);
|
|
13298
13298
|
if (!tool || !("run" in tool)) {
|
|
13299
13299
|
return {
|
|
13300
13300
|
type: "tool_result",
|
|
@@ -13552,7 +13552,7 @@ var Batches = class extends APIResource {
|
|
|
13552
13552
|
]),
|
|
13553
13553
|
stream: true,
|
|
13554
13554
|
__binaryResponse: true
|
|
13555
|
-
})._thenUnwrap((
|
|
13555
|
+
})._thenUnwrap((_3, props) => JSONLDecoder.fromResponse(props.response, props.controller));
|
|
13556
13556
|
}
|
|
13557
13557
|
};
|
|
13558
13558
|
|
|
@@ -15190,7 +15190,7 @@ var MessageStream = class _MessageStream {
|
|
|
15190
15190
|
return stream.toReadableStream();
|
|
15191
15191
|
}
|
|
15192
15192
|
};
|
|
15193
|
-
function checkNever2(
|
|
15193
|
+
function checkNever2(x3) {
|
|
15194
15194
|
}
|
|
15195
15195
|
|
|
15196
15196
|
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.88.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/messages/batches.mjs
|
|
@@ -15330,7 +15330,7 @@ var Batches2 = class extends APIResource {
|
|
|
15330
15330
|
headers: buildHeaders([{ Accept: "application/binary" }, options?.headers]),
|
|
15331
15331
|
stream: true,
|
|
15332
15332
|
__binaryResponse: true
|
|
15333
|
-
})._thenUnwrap((
|
|
15333
|
+
})._thenUnwrap((_3, props) => JSONLDecoder.fromResponse(props.response, props.controller));
|
|
15334
15334
|
}
|
|
15335
15335
|
};
|
|
15336
15336
|
|
|
@@ -15966,50 +15966,6 @@ Anthropic.Messages = Messages2;
|
|
|
15966
15966
|
Anthropic.Models = Models2;
|
|
15967
15967
|
Anthropic.Beta = Beta;
|
|
15968
15968
|
|
|
15969
|
-
// ../shared/dist/event-bus-CABu09lC.js
|
|
15970
|
-
var e = class {
|
|
15971
|
-
listeners = {};
|
|
15972
|
-
on(e4, t3) {
|
|
15973
|
-
let n3 = this.listeners[e4];
|
|
15974
|
-
return n3 || (n3 = /* @__PURE__ */ new Set(), this.listeners[e4] = n3), n3.add(t3), () => this.off(e4, t3);
|
|
15975
|
-
}
|
|
15976
|
-
off(e4, t3) {
|
|
15977
|
-
this.listeners[e4]?.delete(t3);
|
|
15978
|
-
}
|
|
15979
|
-
emit(e4, ...t3) {
|
|
15980
|
-
let n3 = this.listeners[e4];
|
|
15981
|
-
if (n3) for (let e5 of [...n3]) e5(...t3);
|
|
15982
|
-
}
|
|
15983
|
-
once(e4, t3) {
|
|
15984
|
-
let n3 = ((...r3) => {
|
|
15985
|
-
this.off(e4, n3), t3(...r3);
|
|
15986
|
-
});
|
|
15987
|
-
return this.on(e4, n3);
|
|
15988
|
-
}
|
|
15989
|
-
removeAllListeners(e4) {
|
|
15990
|
-
if (e4 !== void 0) delete this.listeners[e4];
|
|
15991
|
-
else for (let e5 of Object.keys(this.listeners)) delete this.listeners[e5];
|
|
15992
|
-
}
|
|
15993
|
-
listenerCount(e4) {
|
|
15994
|
-
return this.listeners[e4]?.size ?? 0;
|
|
15995
|
-
}
|
|
15996
|
-
};
|
|
15997
|
-
var t = class extends e {
|
|
15998
|
-
publish(e4) {
|
|
15999
|
-
let t3 = (e5, ...t4) => this.emit(e5, ...t4);
|
|
16000
|
-
for (let [n3, r3] of Object.entries(e4)) {
|
|
16001
|
-
let e5 = r3 ?? [];
|
|
16002
|
-
t3(n3, ...e5), t3(`*`, n3, ...e5);
|
|
16003
|
-
}
|
|
16004
|
-
}
|
|
16005
|
-
subscribe(e4, t3, n3 = false) {
|
|
16006
|
-
return n3 ? this.once(e4, t3) : this.on(e4, t3);
|
|
16007
|
-
}
|
|
16008
|
-
subscribeAll(e4) {
|
|
16009
|
-
return this.subscribe(`*`, e4);
|
|
16010
|
-
}
|
|
16011
|
-
};
|
|
16012
|
-
|
|
16013
15969
|
// ../shared/dist/index.js
|
|
16014
15970
|
var import_node_module = require("node:module");
|
|
16015
15971
|
var import_pino = __toESM(require_pino(), 1);
|
|
@@ -16018,45 +15974,43 @@ var import_pino = __toESM(require_pino(), 1);
|
|
|
16018
15974
|
var import_node_os = require("node:os");
|
|
16019
15975
|
var import_node_fs = require("node:fs");
|
|
16020
15976
|
var import_node_path = require("node:path");
|
|
16021
|
-
|
|
16022
|
-
|
|
16023
|
-
var E = [];
|
|
16024
|
-
var k = (e4, t3) => {
|
|
16025
|
-
if (e4 === void 0) return t3;
|
|
16026
|
-
let n3 = parseInt(e4, 10);
|
|
16027
|
-
return isNaN(n3) || n3 <= 0 ? (E.push(`Invalid environment variable value: ${e4}. Using default: ${t3}`), t3) : n3;
|
|
16028
|
-
};
|
|
16029
|
-
function j(e4) {
|
|
16030
|
-
return (0, import_node_path.normalize)(e4).replaceAll(import_node_path.sep === `\\` ? `\\` : import_node_path.sep, `/`);
|
|
15977
|
+
function l(e8) {
|
|
15978
|
+
return (0, import_node_path.normalize)(e8).replaceAll(import_node_path.sep === `\\` ? `\\` : import_node_path.sep, `/`);
|
|
16031
15979
|
}
|
|
16032
|
-
|
|
15980
|
+
var w = [];
|
|
15981
|
+
var E = (e8, t6) => {
|
|
15982
|
+
if (e8 === void 0) return t6;
|
|
15983
|
+
let n5 = parseInt(e8, 10);
|
|
15984
|
+
return isNaN(n5) || n5 <= 0 ? (w.push(`Invalid environment variable value: ${e8}. Using default: ${t6}`), t6) : n5;
|
|
15985
|
+
};
|
|
15986
|
+
function k() {
|
|
16033
15987
|
try {
|
|
16034
|
-
let
|
|
16035
|
-
return JSON.parse((0, import_node_fs.readFileSync)(
|
|
15988
|
+
let e8 = l(`${l(new URL(`.`, __otto_plugin_import_meta_url).pathname)}/../package.json`);
|
|
15989
|
+
return JSON.parse((0, import_node_fs.readFileSync)(e8, `utf-8`)).version || `unknown`;
|
|
16036
15990
|
} catch {
|
|
16037
15991
|
return `unknown`;
|
|
16038
15992
|
}
|
|
16039
15993
|
}
|
|
16040
|
-
var
|
|
16041
|
-
var
|
|
16042
|
-
var
|
|
16043
|
-
var
|
|
16044
|
-
var
|
|
16045
|
-
var
|
|
16046
|
-
var
|
|
16047
|
-
var
|
|
16048
|
-
var
|
|
16049
|
-
var
|
|
16050
|
-
var
|
|
16051
|
-
var
|
|
16052
|
-
var
|
|
16053
|
-
var
|
|
16054
|
-
var
|
|
16055
|
-
var
|
|
16056
|
-
var
|
|
16057
|
-
var
|
|
16058
|
-
var
|
|
16059
|
-
var $ =
|
|
15994
|
+
var A = k();
|
|
15995
|
+
var j = `otto/${A}`;
|
|
15996
|
+
var M = `.otto`;
|
|
15997
|
+
var N = process.env.OTTO_CONFIG_FILENAME || `config.json`;
|
|
15998
|
+
var P = `${M}/${N}`;
|
|
15999
|
+
var F = l(process.env.OTTO_HOME || `${(0, import_node_os.homedir)()}/.otto`);
|
|
16000
|
+
var I = `${F}/sessions`;
|
|
16001
|
+
var L = `${I}/locks`;
|
|
16002
|
+
var R = `${F}/daemon`;
|
|
16003
|
+
var z = l((0, import_node_os.homedir)() + `/.config/otto`);
|
|
16004
|
+
var B = l(`${process.cwd()}/${M}`);
|
|
16005
|
+
var V = `.claude`;
|
|
16006
|
+
var H = l(`${(0, import_node_os.homedir)()}/${V}`);
|
|
16007
|
+
var K = process.env.OTTO_LOG_FILE ? l(process.env.OTTO_LOG_FILE) : ``;
|
|
16008
|
+
var q = E(process.env.OTTO_SERVICE_PORT, 8417);
|
|
16009
|
+
var J = process.env.OTTO_SERVICE_URL ?? `http://127.0.0.1:${q}`;
|
|
16010
|
+
var Z = process.env.OTTO_LOG_LEVEL || (process.env.NODE_ENV === `production` ? `info` : `trace`);
|
|
16011
|
+
var Q = process.env.OTTO_OFFLINE === `1` || process.env.OTTO_OFFLINE?.toLowerCase() === `true` || process.env.OTTO_OFFLINE?.toLowerCase() === `yes`;
|
|
16012
|
+
var ne = l(process.env.OTTO_AUTH_PATH || `${z}/auth.json`);
|
|
16013
|
+
var $ = l(process.env.OTTO_IDENTITY_PATH || `${F}/identity.json`);
|
|
16060
16014
|
|
|
16061
16015
|
// ../shared/dist/index.js
|
|
16062
16016
|
var import_node_stream = require("node:stream");
|
|
@@ -16172,7 +16126,7 @@ function splitLines(chunk) {
|
|
|
16172
16126
|
|
|
16173
16127
|
// ../shared/dist/index.js
|
|
16174
16128
|
var import_undici = __toESM(require_undici(), 1);
|
|
16175
|
-
var
|
|
16129
|
+
var y = class extends Error {
|
|
16176
16130
|
code;
|
|
16177
16131
|
cause;
|
|
16178
16132
|
status;
|
|
@@ -16180,283 +16134,225 @@ var x2 = class extends Error {
|
|
|
16180
16134
|
errorType;
|
|
16181
16135
|
pluginSource;
|
|
16182
16136
|
abortKind;
|
|
16183
|
-
constructor(
|
|
16184
|
-
super(
|
|
16137
|
+
constructor(e8, t6) {
|
|
16138
|
+
super(e8, { cause: t6.cause }), this.name = new.target.name, this.code = t6.code, this.cause = t6.cause, this.status = t6.status, this.headers = t6.headers, this.errorType = t6.errorType, this.pluginSource = t6.pluginSource, this.abortKind = t6.abortKind;
|
|
16185
16139
|
}
|
|
16186
16140
|
};
|
|
16187
|
-
var
|
|
16141
|
+
var b = class extends y {
|
|
16188
16142
|
};
|
|
16189
|
-
var
|
|
16143
|
+
var we = class extends y {
|
|
16190
16144
|
};
|
|
16191
|
-
var { setPrototypeOf:
|
|
16192
|
-
return
|
|
16145
|
+
var { setPrototypeOf: De = function(e8, t6) {
|
|
16146
|
+
return e8.__proto__ = t6, e8;
|
|
16193
16147
|
} } = Object;
|
|
16194
|
-
var
|
|
16148
|
+
var Oe = class e3 extends Error {
|
|
16195
16149
|
framesToPop = 1;
|
|
16196
16150
|
name = `Invariant Violation`;
|
|
16197
|
-
constructor(
|
|
16198
|
-
super(typeof
|
|
16151
|
+
constructor(t6 = `Invariant Violation`) {
|
|
16152
|
+
super(typeof t6 == `number` ? `Invariant Violation: ${t6}` : t6), De(this, e3.prototype);
|
|
16199
16153
|
}
|
|
16200
16154
|
};
|
|
16201
|
-
function
|
|
16202
|
-
if (typeof
|
|
16203
|
-
else if (!
|
|
16155
|
+
function S(e8, t6) {
|
|
16156
|
+
if (typeof e8 == `function`) S(e8(), t6);
|
|
16157
|
+
else if (!e8) throw new Oe(t6);
|
|
16204
16158
|
}
|
|
16205
|
-
var
|
|
16206
|
-
|
|
16207
|
-
|
|
16159
|
+
var ke = class {
|
|
16160
|
+
listeners = {};
|
|
16161
|
+
on(e8, t6) {
|
|
16162
|
+
let n5 = this.listeners[e8];
|
|
16163
|
+
return n5 || (n5 = /* @__PURE__ */ new Set(), this.listeners[e8] = n5), n5.add(t6), () => this.off(e8, t6);
|
|
16164
|
+
}
|
|
16165
|
+
off(e8, t6) {
|
|
16166
|
+
this.listeners[e8]?.delete(t6);
|
|
16167
|
+
}
|
|
16168
|
+
emit(e8, ...t6) {
|
|
16169
|
+
let n5 = this.listeners[e8];
|
|
16170
|
+
if (n5) for (let e9 of [...n5]) e9(...t6);
|
|
16171
|
+
}
|
|
16172
|
+
once(e8, t6) {
|
|
16173
|
+
let n5 = ((...r4) => {
|
|
16174
|
+
this.off(e8, n5), t6(...r4);
|
|
16175
|
+
});
|
|
16176
|
+
return this.on(e8, n5);
|
|
16177
|
+
}
|
|
16178
|
+
removeAllListeners(e8) {
|
|
16179
|
+
if (e8 !== void 0) delete this.listeners[e8];
|
|
16180
|
+
else for (let e9 of Object.keys(this.listeners)) delete this.listeners[e9];
|
|
16181
|
+
}
|
|
16182
|
+
listenerCount(e8) {
|
|
16183
|
+
return this.listeners[e8]?.size ?? 0;
|
|
16184
|
+
}
|
|
16185
|
+
};
|
|
16186
|
+
var Ae = class extends ke {
|
|
16187
|
+
publish(e8) {
|
|
16188
|
+
let t6 = (e9, ...t7) => this.emit(e9, ...t7);
|
|
16189
|
+
for (let [n5, r4] of Object.entries(e8)) {
|
|
16190
|
+
let e9 = r4 ?? [];
|
|
16191
|
+
t6(n5, ...e9), t6(`*`, n5, ...e9);
|
|
16192
|
+
}
|
|
16193
|
+
}
|
|
16194
|
+
subscribe(e8, t6, n5 = false) {
|
|
16195
|
+
return n5 ? this.once(e8, t6) : this.on(e8, t6);
|
|
16196
|
+
}
|
|
16197
|
+
subscribeAll(e8) {
|
|
16198
|
+
return this.subscribe(`*`, e8);
|
|
16199
|
+
}
|
|
16200
|
+
};
|
|
16201
|
+
var je = /* @__PURE__ */ new Set([`trace`, `debug`, `info`, `warn`, `error`, `fatal`]);
|
|
16202
|
+
function C(e8) {
|
|
16203
|
+
return je.has(e8) ? e8 : `info`;
|
|
16208
16204
|
}
|
|
16209
|
-
var
|
|
16205
|
+
var Me = (() => {
|
|
16210
16206
|
try {
|
|
16211
16207
|
return (0, import_node_module.createRequire)(__otto_plugin_import_meta_url);
|
|
16212
16208
|
} catch {
|
|
16213
16209
|
return;
|
|
16214
16210
|
}
|
|
16215
16211
|
})();
|
|
16216
|
-
function
|
|
16217
|
-
if (!
|
|
16212
|
+
function Ne() {
|
|
16213
|
+
if (!Me) return false;
|
|
16218
16214
|
try {
|
|
16219
|
-
return
|
|
16215
|
+
return Me.resolve(`pino-pretty`), true;
|
|
16220
16216
|
} catch {
|
|
16221
16217
|
return false;
|
|
16222
16218
|
}
|
|
16223
16219
|
}
|
|
16224
|
-
function
|
|
16225
|
-
return
|
|
16220
|
+
function Pe(e8) {
|
|
16221
|
+
return e8 === `stdout` ? 1 : e8 === `stderr` ? 2 : e8;
|
|
16226
16222
|
}
|
|
16227
|
-
function
|
|
16223
|
+
function Fe() {
|
|
16228
16224
|
return process.env.OTTO_LOG_STDERR === `0`;
|
|
16229
16225
|
}
|
|
16230
|
-
function
|
|
16226
|
+
function Ie() {
|
|
16231
16227
|
return process.env.OTTO_LOG_FILE || `${process.env.HOME || process.env.USERPROFILE || `.`}/.otto/logs/otto.log`;
|
|
16232
16228
|
}
|
|
16233
|
-
function
|
|
16234
|
-
let
|
|
16235
|
-
if (!
|
|
16236
|
-
let
|
|
16237
|
-
return
|
|
16229
|
+
function Le(e8, t6) {
|
|
16230
|
+
let n5 = Ne(), r4 = Fe(), i3 = { target: n5 ? `pino-pretty` : `pino/file`, options: n5 ? { colorize: true, destination: 2 } : { destination: 2 }, level: t6 };
|
|
16231
|
+
if (!e8 || e8 === `stdout` || e8 === `stderr`) return r4 ? [{ target: `pino/file`, options: { destination: Ie(), mkdir: true }, level: t6 }] : [i3];
|
|
16232
|
+
let a3 = { target: `pino/file`, options: { destination: Pe(e8), mkdir: true }, level: t6 };
|
|
16233
|
+
return r4 ? [a3] : [a3, i3];
|
|
16238
16234
|
}
|
|
16239
|
-
var
|
|
16240
|
-
var
|
|
16241
|
-
|
|
16235
|
+
var w2 = new import_node_stream.PassThrough();
|
|
16236
|
+
var Re = new Ae();
|
|
16237
|
+
w2.on(`data`, (e8) => {
|
|
16242
16238
|
try {
|
|
16243
|
-
|
|
16244
|
-
} catch (
|
|
16245
|
-
console.warn(`Failed to parse log chunk for listener:`,
|
|
16239
|
+
Re.publish({ log: [JSON.parse(e8.toString())] });
|
|
16240
|
+
} catch (t6) {
|
|
16241
|
+
console.warn(`Failed to parse log chunk for listener:`, e8.toString(), t6);
|
|
16246
16242
|
}
|
|
16247
16243
|
});
|
|
16248
|
-
var
|
|
16249
|
-
var
|
|
16250
|
-
var
|
|
16251
|
-
var
|
|
16252
|
-
function
|
|
16253
|
-
return globalThis.__miniv8_wasm === void 0 ? { write(
|
|
16254
|
-
|
|
16255
|
-
} } : { write: (
|
|
16256
|
-
|
|
16244
|
+
var T = null;
|
|
16245
|
+
var E2 = C(Z);
|
|
16246
|
+
var D = /* @__PURE__ */ new Set();
|
|
16247
|
+
var O = null;
|
|
16248
|
+
function He(e8, n5) {
|
|
16249
|
+
return globalThis.__miniv8_wasm === void 0 ? { write(r4) {
|
|
16250
|
+
O ??= import_pino.default.transport({ targets: Le(e8, n5) }), O.write(r4);
|
|
16251
|
+
} } : { write: (e9) => {
|
|
16252
|
+
w2.write(e9);
|
|
16257
16253
|
} };
|
|
16258
16254
|
}
|
|
16259
|
-
function
|
|
16260
|
-
return
|
|
16255
|
+
function k2(e8, n5) {
|
|
16256
|
+
return T ??= (0, import_pino.default)({ level: e8 }, import_pino.default.multistream([{ level: e8, stream: w2 }, { level: e8, stream: He(n5, e8) }])), E2 = C(T.level), T;
|
|
16261
16257
|
}
|
|
16262
|
-
function
|
|
16263
|
-
|
|
16264
|
-
let
|
|
16265
|
-
return
|
|
16258
|
+
function A2(e8, t6) {
|
|
16259
|
+
k2(t6?.level ?? C(Z), t6?.destination ?? K), S(T, `Root logger is not initialized`);
|
|
16260
|
+
let i3 = T.child({ name: e8 }, { level: t6?.level ?? E2 });
|
|
16261
|
+
return D.add(i3), i3;
|
|
16266
16262
|
}
|
|
16267
|
-
var
|
|
16263
|
+
var We = 10 * 1024 * 1024;
|
|
16268
16264
|
var F2;
|
|
16269
|
-
function
|
|
16270
|
-
let
|
|
16271
|
-
if (
|
|
16272
|
-
return new import_undici.ProxyAgent({ uri:
|
|
16265
|
+
function L2(e8) {
|
|
16266
|
+
let t6 = e8 || F2;
|
|
16267
|
+
if (t6) try {
|
|
16268
|
+
return new import_undici.ProxyAgent({ uri: t6 });
|
|
16273
16269
|
} catch {
|
|
16274
16270
|
return;
|
|
16275
16271
|
}
|
|
16276
16272
|
}
|
|
16277
|
-
var
|
|
16278
|
-
var
|
|
16279
|
-
function
|
|
16280
|
-
return
|
|
16273
|
+
var gt = { kind: `idle` };
|
|
16274
|
+
var _t = { kind: `wallclock` };
|
|
16275
|
+
function vt(e8, t6) {
|
|
16276
|
+
return e8 ? t6.idleTimeout : t6.firstTokenIdleTimeout;
|
|
16281
16277
|
}
|
|
16282
|
-
function
|
|
16283
|
-
let
|
|
16284
|
-
return { timeout: Math.max(
|
|
16278
|
+
function yt(e8) {
|
|
16279
|
+
let t6 = e8.idleTimeout ?? 12e4, n5 = e8.firstTokenIdleTimeout ?? Math.max(t6, 9e5), r4 = e8.timeout ?? 3e5;
|
|
16280
|
+
return { timeout: Math.max(r4, n5 + 6e4), idleTimeout: t6, firstTokenIdleTimeout: n5 };
|
|
16285
16281
|
}
|
|
16286
|
-
function
|
|
16287
|
-
let
|
|
16288
|
-
return typeof
|
|
16282
|
+
function bt(e8) {
|
|
16283
|
+
let t6 = e8.signal.reason;
|
|
16284
|
+
return typeof t6 == `object` && t6 && `kind` in t6 ? t6.kind : `external`;
|
|
16289
16285
|
}
|
|
16290
|
-
async function*
|
|
16291
|
-
let { url:
|
|
16292
|
-
|
|
16293
|
-
},
|
|
16286
|
+
async function* xt(e8) {
|
|
16287
|
+
let { url: t6, method: n5 = `POST`, headers: r4 = {}, body: i3, signal: a3 } = e8, { timeout: o3, idleTimeout: s3, firstTokenIdleTimeout: c3 } = yt(e8), l2 = new AbortController(), u = a3 ? AbortSignal.any([a3, l2.signal]) : l2.signal, d = setTimeout(() => l2.abort(_t), o3), f, p = false, m = () => {
|
|
16288
|
+
f && clearTimeout(f), f = setTimeout(() => l2.abort(gt), vt(p, { idleTimeout: s3, firstTokenIdleTimeout: c3 }));
|
|
16289
|
+
}, h;
|
|
16294
16290
|
try {
|
|
16295
|
-
let
|
|
16296
|
-
if (!
|
|
16297
|
-
let
|
|
16298
|
-
|
|
16299
|
-
let
|
|
16291
|
+
let a4 = L2(e8.proxy), o4 = { method: n5, headers: { "content-type": `application/json`, accept: `text/event-stream`, ...r4 }, body: i3 ? typeof i3 == `string` ? i3 : JSON.stringify(i3) : void 0, signal: u }, s4 = await fetch(t6, a4 ? { ...o4, dispatcher: a4 } : o4);
|
|
16292
|
+
if (!s4.ok) {
|
|
16293
|
+
let e9 = await s4.text(), t7 = `BAD_RESPONSE`;
|
|
16294
|
+
s4.status === 429 ? t7 = `RATE_LIMIT` : s4.status === 529 ? t7 = `OVERLOADED` : s4.status >= 500 ? t7 = `SERVER_ERROR` : s4.status >= 400 && (t7 = `REQUEST_ERROR`);
|
|
16295
|
+
let n6;
|
|
16300
16296
|
try {
|
|
16301
|
-
let
|
|
16302
|
-
|
|
16297
|
+
let t8 = JSON.parse(e9)?.error;
|
|
16298
|
+
n6 = t8?.code ?? t8?.type;
|
|
16303
16299
|
} catch {
|
|
16304
16300
|
}
|
|
16305
|
-
throw new
|
|
16301
|
+
throw new b(`Http request failed ${s4.status}: ${e9}`, { code: t7, status: s4.status, headers: s4.headers, errorType: n6 });
|
|
16306
16302
|
}
|
|
16307
|
-
if (
|
|
16308
|
-
|
|
16309
|
-
let
|
|
16310
|
-
l3.push({ event:
|
|
16303
|
+
if (e8.onResponse?.(s4.headers), !s4.body) throw new b(`Response body is empty`, { code: `BAD_RESPONSE` });
|
|
16304
|
+
h = s4.body.getReader();
|
|
16305
|
+
let c4 = new TextDecoder(), l3 = [], d2 = createParser({ onEvent(e9) {
|
|
16306
|
+
l3.push({ event: e9.event || void 0, data: e9.data, id: e9.id || void 0 });
|
|
16311
16307
|
} });
|
|
16312
16308
|
for (m(); ; ) {
|
|
16313
|
-
let { done:
|
|
16314
|
-
if (
|
|
16315
|
-
for (m(),
|
|
16316
|
-
let
|
|
16317
|
-
|
|
16309
|
+
let { done: e9, value: t7 } = await h.read();
|
|
16310
|
+
if (e9) break;
|
|
16311
|
+
for (m(), d2.feed(c4.decode(t7, { stream: true })); l3.length > 0; ) {
|
|
16312
|
+
let e10 = l3.shift();
|
|
16313
|
+
e10 && (p || (p = true, m()), yield e10);
|
|
16318
16314
|
}
|
|
16319
16315
|
}
|
|
16320
|
-
for (
|
|
16321
|
-
let
|
|
16322
|
-
|
|
16316
|
+
for (d2.feed(c4.decode()); l3.length > 0; ) {
|
|
16317
|
+
let e9 = l3.shift();
|
|
16318
|
+
e9 && (p || (p = true, m()), yield e9);
|
|
16323
16319
|
}
|
|
16324
|
-
} catch (
|
|
16325
|
-
throw
|
|
16320
|
+
} catch (e9) {
|
|
16321
|
+
throw e9 instanceof b ? e9 : l2.signal.aborted || e9 instanceof DOMException && e9.name === `AbortError` ? new b(`Stream aborted or timed out`, { code: `TIMEOUT`, cause: e9 instanceof Error ? e9 : Error(String(e9)), abortKind: bt(l2) }) : new b(`Stream request failed`, { code: `NETWORK_ERROR`, cause: e9 instanceof Error ? e9 : Error(String(e9)) });
|
|
16326
16322
|
} finally {
|
|
16327
|
-
clearTimeout(
|
|
16323
|
+
clearTimeout(d), f && clearTimeout(f), h && h.cancel().catch(() => {
|
|
16328
16324
|
});
|
|
16329
16325
|
}
|
|
16330
16326
|
}
|
|
16331
|
-
function wt(
|
|
16332
|
-
if (
|
|
16333
|
-
if (typeof
|
|
16334
|
-
let
|
|
16335
|
-
for (let
|
|
16336
|
-
let
|
|
16337
|
-
return typeof
|
|
16338
|
-
}
|
|
16339
|
-
}
|
|
16340
|
-
var R2 = { Bash: `bash`, Read: `read`, Write: `write`, Edit: `edit`, MultiEdit: `edit`, Grep: `grep`, Glob: `find`, WebFetch: `web_fetch`, WebSearch: `web_search`, Task: `task_delegate`, TodoWrite: `write_todos` };
|
|
16341
|
-
var kt = Object.fromEntries(Object.entries(R2).reverse().map(([e4, t3]) => [t3, e4]));
|
|
16342
|
-
function Ft() {
|
|
16343
|
-
return `<span class="otto-wordmark">OTTO</span>`;
|
|
16344
|
-
}
|
|
16345
|
-
function It() {
|
|
16346
|
-
return `<svg viewBox="0 0 52 52" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
16347
|
-
<circle cx="26" cy="26" r="24" fill="var(--gray-3)" stroke="var(--gray-5)" stroke-width="2"/>
|
|
16348
|
-
<path d="M15.5 27l7 6.5 14-15" stroke="var(--gray-12)" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round"/>
|
|
16349
|
-
</svg>`;
|
|
16350
|
-
}
|
|
16351
|
-
function Lt() {
|
|
16352
|
-
return `<svg viewBox="0 0 52 52" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
16353
|
-
<circle cx="26" cy="26" r="24" fill="var(--gray-3)" stroke="var(--gray-5)" stroke-width="2"/>
|
|
16354
|
-
<path d="M19 19l14 14M33 19l-14 14" stroke="var(--gray-9)" stroke-width="2.8" stroke-linecap="round"/>
|
|
16355
|
-
</svg>`;
|
|
16356
|
-
}
|
|
16357
|
-
function H2(e4) {
|
|
16358
|
-
return e4.replace(/[&<>"']/g, (e5) => ({ "&": `&`, "<": `<`, ">": `>`, '"': `"`, "'": `'` })[e5] ?? e5);
|
|
16359
|
-
}
|
|
16360
|
-
function Rt(e4, t3, n3, r3) {
|
|
16361
|
-
let i2 = e4 === `success` ? It() : Lt();
|
|
16362
|
-
return `<!doctype html>
|
|
16363
|
-
<html lang="en">
|
|
16364
|
-
<head>
|
|
16365
|
-
<meta charset="utf-8">
|
|
16366
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
16367
|
-
<title>${H2(t3)}</title>
|
|
16368
|
-
<style>
|
|
16369
|
-
:root {
|
|
16370
|
-
--gray-1:#FFFFFF;--gray-2:#F5F6FA;--gray-3:#EEF0F9;
|
|
16371
|
-
--gray-5:#DBDDEB;--gray-7:#AEB2C8;--gray-9:#7A7EA0;
|
|
16372
|
-
--gray-11:#565A78;--gray-12:#12152B;
|
|
16373
|
-
--radius-xl:24px;
|
|
16374
|
-
--shadow-card:0 1px 2px rgba(18,21,43,.04),0 8px 24px rgba(18,21,43,.06);
|
|
16375
|
-
--hairline:.75px;
|
|
16376
|
-
--pixel:"Silkscreen","Press Start 2P","Pixelify Sans","SF Mono",monospace;
|
|
16377
|
-
}
|
|
16378
|
-
|
|
16379
|
-
@media (prefers-color-scheme:dark) {
|
|
16380
|
-
:root:not([data-theme=light]) {
|
|
16381
|
-
--gray-1:#191F39;--gray-2:#111529;--gray-3:rgba(255,255,255,.08);
|
|
16382
|
-
--gray-5:rgba(255,255,255,.11);--gray-7:rgba(255,255,255,.18);
|
|
16383
|
-
--gray-9:rgba(255,255,255,.34);--gray-11:#AAB2CC;--gray-12:#F4F6FF;
|
|
16384
|
-
--shadow-card:0 1px 2px rgba(0,0,0,.14),0 8px 24px rgba(0,0,0,.22);
|
|
16385
|
-
}
|
|
16386
|
-
}
|
|
16387
|
-
|
|
16388
|
-
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
|
|
16389
|
-
body{
|
|
16390
|
-
min-height:100dvh;display:grid;place-items:center;padding:32px;
|
|
16391
|
-
background:var(--gray-2);-webkit-font-smoothing:antialiased;
|
|
16392
|
-
}
|
|
16393
|
-
|
|
16394
|
-
.page{width:min(440px,100%);text-align:center}
|
|
16395
|
-
|
|
16396
|
-
.otto-wordmark{font-family:var(--pixel);font-size:28px;font-weight:700;letter-spacing:.04em;color:var(--gray-12);margin-bottom:28px}
|
|
16397
|
-
|
|
16398
|
-
.card{
|
|
16399
|
-
padding:36px 40px;border-radius:var(--radius-xl);
|
|
16400
|
-
border:var(--hairline) solid var(--gray-3);background:var(--gray-1);
|
|
16401
|
-
box-shadow:var(--shadow-card);
|
|
16327
|
+
function wt(e8, t6) {
|
|
16328
|
+
if (e8 == null) return;
|
|
16329
|
+
if (typeof e8.get == `function`) return e8.get(t6) ?? void 0;
|
|
16330
|
+
let n5 = e8;
|
|
16331
|
+
for (let e9 of Object.keys(n5)) if (e9.toLowerCase() === t6) {
|
|
16332
|
+
let t7 = n5[e9];
|
|
16333
|
+
return typeof t7 == `string` ? t7 : void 0;
|
|
16402
16334
|
}
|
|
16403
|
-
|
|
16404
|
-
.status-icon{display:inline-block;margin-bottom:22px}
|
|
16405
|
-
.status-icon svg{width:52px;height:52px}
|
|
16406
|
-
|
|
16407
|
-
.card *{font-family:var(--pixel)}
|
|
16408
|
-
.kicker{
|
|
16409
|
-
font-size:11px;font-weight:700;letter-spacing:.16em;text-transform:uppercase;
|
|
16410
|
-
color:var(--gray-7);margin-bottom:10px;
|
|
16411
|
-
}
|
|
16412
|
-
h1{font-size:22px;font-weight:700;line-height:1.3;letter-spacing:.02em;color:var(--gray-12)}
|
|
16413
|
-
.desc{
|
|
16414
|
-
margin-top:14px;font-size:13px;line-height:1.7;color:var(--gray-11);
|
|
16415
|
-
max-width:300px;margin-left:auto;margin-right:auto;
|
|
16416
|
-
}
|
|
16417
|
-
.separator{
|
|
16418
|
-
width:60px;height:2px;margin:24px auto 20px;background:var(--gray-3)
|
|
16419
|
-
}
|
|
16420
|
-
.footer{
|
|
16421
|
-
font-size:11px;color:var(--gray-7);font-weight:600;letter-spacing:.06em;
|
|
16422
|
-
text-transform:uppercase;
|
|
16423
|
-
}
|
|
16424
|
-
</style>
|
|
16425
|
-
</head>
|
|
16426
|
-
<body>
|
|
16427
|
-
<main class="page" aria-labelledby="title">
|
|
16428
|
-
${Ft()}
|
|
16429
|
-
<section class="card">
|
|
16430
|
-
<div class="status-icon">${i2}</div>
|
|
16431
|
-
<p class="kicker">${e4 === `success` ? `Authentication` : `Error`}</p>
|
|
16432
|
-
<h1 id="title">${H2(t3)}</h1>
|
|
16433
|
-
<p class="desc">${H2(n3)}</p>
|
|
16434
|
-
<div class="separator"></div>
|
|
16435
|
-
<p class="footer">${H2(r3)}</p>
|
|
16436
|
-
</section>
|
|
16437
|
-
</main>
|
|
16438
|
-
</body>
|
|
16439
|
-
</html>`;
|
|
16440
16335
|
}
|
|
16441
|
-
var
|
|
16442
|
-
var
|
|
16443
|
-
var
|
|
16444
|
-
var
|
|
16336
|
+
var B2 = { Bash: `bash`, Read: `read`, Write: `write`, Edit: `edit`, MultiEdit: `edit`, Grep: `grep`, Glob: `find`, WebFetch: `web_fetch`, WebSearch: `web_search`, Task: `task_delegate`, TodoWrite: `write_todos` };
|
|
16337
|
+
var kt = Object.fromEntries(Object.entries(B2).reverse().map(([e8, t6]) => [t6, e8]));
|
|
16338
|
+
var Kt = 5 * 1024 * 1024;
|
|
16339
|
+
var qt = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
16340
|
+
var Jt = Buffer.from(`GIF8`, `ascii`);
|
|
16445
16341
|
var K2 = process.env.OTTO_STARTUP_TRACE === `1`;
|
|
16446
|
-
var
|
|
16447
|
-
var Y =
|
|
16342
|
+
var dn = K2 ? performance.now() : 0;
|
|
16343
|
+
var Y = A2(`@x-otto/shared:file-lock`);
|
|
16448
16344
|
|
|
16449
|
-
// ../interchange/dist/
|
|
16450
|
-
var
|
|
16451
|
-
function
|
|
16452
|
-
let
|
|
16453
|
-
return { base64:
|
|
16345
|
+
// ../interchange/dist/image.js
|
|
16346
|
+
var e4 = /^data:([^;,]*)(?:;[^,]*)?,(.*)$/s;
|
|
16347
|
+
function t3(t6, r4) {
|
|
16348
|
+
let i3 = e4.exec(t6), a3 = (i3 ? i3[2] ?? `` : t6).replace(/\s+/g, ``);
|
|
16349
|
+
return { base64: a3, mediaType: ((i3 ? i3[1] : ``) || r4 || ``).toLowerCase(), valid: n2(a3) };
|
|
16454
16350
|
}
|
|
16455
|
-
function
|
|
16456
|
-
return
|
|
16351
|
+
function n2(e8) {
|
|
16352
|
+
return e8.length === 0 || e8 === `undefined` || e8.length % 4 == 1 ? false : /^[A-Za-z0-9+/]*={0,2}$/.test(e8);
|
|
16457
16353
|
}
|
|
16458
|
-
function
|
|
16459
|
-
switch (
|
|
16354
|
+
function r2(e8, t6) {
|
|
16355
|
+
switch (e8.toLowerCase()) {
|
|
16460
16356
|
case `image/jpeg`:
|
|
16461
16357
|
case `image/jpg`:
|
|
16462
16358
|
return `image/jpeg`;
|
|
@@ -16467,101 +16363,119 @@ function f(e4, t3) {
|
|
|
16467
16363
|
case `image/webp`:
|
|
16468
16364
|
return `image/webp`;
|
|
16469
16365
|
default:
|
|
16470
|
-
return
|
|
16366
|
+
return i2(t6);
|
|
16471
16367
|
}
|
|
16472
16368
|
}
|
|
16473
|
-
function
|
|
16474
|
-
return
|
|
16369
|
+
function i2(e8) {
|
|
16370
|
+
return e8.startsWith(`/9j/`) ? `image/jpeg` : e8.startsWith(`iVBOR`) ? `image/png` : e8.startsWith(`R0lGOD`) ? `image/gif` : e8.startsWith(`UklGR`) ? `image/webp` : `image/png`;
|
|
16475
16371
|
}
|
|
16476
16372
|
|
|
16373
|
+
// ../interchange/dist/index.js
|
|
16374
|
+
var _ = { toolGuidance: { name: `tool-guidance-injection`, priority: 20, lane: `stable`, budgetBytes: 2e4 }, skillLoopGuidance: { name: `skill-loop-guidance-injection`, priority: 21, lane: `stable`, budgetBytes: 2e3 }, environment: { name: `runtime:environment`, priority: 25, lane: `stable`, budgetBytes: 8e3 }, agentKnowledge: { name: `agent-knowledge-injection`, priority: 35, lane: `stable`, budgetBytes: 28e3 }, skillCatalog: { name: `skill-catalog-injection`, priority: 38, lane: `stable`, budgetBytes: 12e3 }, lessonRelevantHints: { name: `lesson-relevant-hints`, priority: 41, lane: `volatile`, budgetBytes: 4e3 }, internalize: { name: `internalize-skill-injection`, priority: 42, lane: `volatile`, budgetBytes: 4e3 }, memoryDelta: { name: `memory-delta-injection`, priority: 60, lane: `volatile`, budgetBytes: 8e3 }, todoReminder: { name: `todo-reminder-injection`, priority: 62, lane: `volatile`, budgetBytes: 4e3 }, docSyncReminder: { name: `doc-sync-reminder-injection`, priority: 64, lane: `volatile`, budgetBytes: 4e3 } };
|
|
16375
|
+
var v = Object.values(_);
|
|
16376
|
+
|
|
16477
16377
|
// ../provider/dist/index.js
|
|
16478
|
-
var
|
|
16479
|
-
|
|
16480
|
-
|
|
16481
|
-
|
|
16482
|
-
|
|
16378
|
+
var _2 = { debug: () => {
|
|
16379
|
+
}, info: () => {
|
|
16380
|
+
}, warn: () => {
|
|
16381
|
+
}, error: () => {
|
|
16382
|
+
} };
|
|
16383
|
+
async function v2(e8, t6, n5) {
|
|
16384
|
+
let r4 = process.env[e8];
|
|
16385
|
+
if (r4) return r4;
|
|
16386
|
+
if (t6) {
|
|
16387
|
+
let e9 = await t6();
|
|
16388
|
+
if (e9) return e9;
|
|
16389
|
+
}
|
|
16390
|
+
return n5;
|
|
16391
|
+
}
|
|
16392
|
+
var y2 = A2(`@x-otto/provider:tool-roundtrip`);
|
|
16393
|
+
function b2(e8) {
|
|
16394
|
+
let t6 = [], n5 = [], r4 = () => {
|
|
16395
|
+
for (let e9 of n5) y2.warn({ toolCallId: e9.id, toolName: e9.name }, `Synthesizing placeholder for unanswered tool_call`), t6.push(x2(e9));
|
|
16396
|
+
n5 = [];
|
|
16483
16397
|
};
|
|
16484
|
-
for (let
|
|
16485
|
-
if (
|
|
16486
|
-
let
|
|
16487
|
-
if (
|
|
16488
|
-
|
|
16398
|
+
for (let i3 of e8) {
|
|
16399
|
+
if (i3.role === `tool_result`) {
|
|
16400
|
+
let e9 = n5.findIndex((e10) => e10.id === i3.toolCallId);
|
|
16401
|
+
if (e9 === -1) {
|
|
16402
|
+
y2.warn({ toolCallId: i3.toolCallId, toolName: i3.toolName }, `Dropping orphan tool_result with no preceding tool_call`);
|
|
16489
16403
|
continue;
|
|
16490
16404
|
}
|
|
16491
|
-
|
|
16405
|
+
n5.splice(e9, 1), t6.push(i3);
|
|
16492
16406
|
continue;
|
|
16493
16407
|
}
|
|
16494
|
-
|
|
16408
|
+
r4(), t6.push(i3), i3.role === `assistant` && (n5 = i3.content.filter((e9) => e9.type === `tool_call`));
|
|
16495
16409
|
}
|
|
16496
|
-
return
|
|
16410
|
+
return r4(), t6;
|
|
16497
16411
|
}
|
|
16498
|
-
function
|
|
16499
|
-
return { role: `tool_result`, toolCallId:
|
|
16412
|
+
function x2(e8) {
|
|
16413
|
+
return { role: `tool_result`, toolCallId: e8.id, toolName: e8.name, content: [{ type: `text`, text: `[tool result unavailable]` }], details: void 0, isError: true, timestamp: 0 };
|
|
16500
16414
|
}
|
|
16501
|
-
function
|
|
16502
|
-
return `[System notification] ${
|
|
16415
|
+
function S2(e8) {
|
|
16416
|
+
return `[System notification] ${e8}`;
|
|
16503
16417
|
}
|
|
16504
|
-
function
|
|
16505
|
-
let
|
|
16506
|
-
for (let
|
|
16507
|
-
let
|
|
16508
|
-
if (
|
|
16509
|
-
|
|
16510
|
-
${
|
|
16418
|
+
function C2(e8) {
|
|
16419
|
+
let t6 = [];
|
|
16420
|
+
for (let n5 of e8) {
|
|
16421
|
+
let e9 = t6.at(-1);
|
|
16422
|
+
if (n5.role === `system_notification` && e9?.role === `system_notification`) {
|
|
16423
|
+
t6[t6.length - 1] = { ...e9, content: `${e9.content}
|
|
16424
|
+
${n5.content}`, isError: e9.isError || n5.isError };
|
|
16511
16425
|
continue;
|
|
16512
16426
|
}
|
|
16513
|
-
|
|
16427
|
+
t6.push(n5);
|
|
16514
16428
|
}
|
|
16515
|
-
return
|
|
16429
|
+
return t6;
|
|
16516
16430
|
}
|
|
16517
|
-
function
|
|
16518
|
-
for (let
|
|
16519
|
-
let
|
|
16520
|
-
if (
|
|
16521
|
-
let
|
|
16522
|
-
|
|
16523
|
-
let
|
|
16524
|
-
|
|
16431
|
+
function ee(e8) {
|
|
16432
|
+
for (let t6 = 0; t6 < e8.length; t6++) {
|
|
16433
|
+
let n5 = e8[t6];
|
|
16434
|
+
if (n5.role !== `system_notification`) continue;
|
|
16435
|
+
let r4 = t6 > 0 ? e8[t6 - 1] : void 0;
|
|
16436
|
+
r4 !== void 0 && (r4.role === `tool_result` || r4.role === `assistant`) || y2.warn({ index: t6, relatedToolCallId: n5.relatedToolCallId, precedingRole: r4?.role ?? `(start of array)` }, `system_notification message does not immediately follow a tool_result/assistant turn (Anthropic placement rule violation risk) \u2014 sending anyway, provider may reject`);
|
|
16437
|
+
let i3 = t6 + 1 < e8.length ? e8[t6 + 1] : void 0;
|
|
16438
|
+
i3 === void 0 || i3.role === `assistant` || y2.warn({ index: t6, relatedToolCallId: n5.relatedToolCallId, followingRole: i3?.role }, `system_notification message is not the last entry and is not immediately followed by an assistant turn (Anthropic placement rule violation risk) \u2014 sending anyway, provider may reject`);
|
|
16525
16439
|
}
|
|
16526
16440
|
}
|
|
16527
|
-
function
|
|
16528
|
-
return
|
|
16441
|
+
function w3(e8) {
|
|
16442
|
+
return e8.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g, `\uFFFD`);
|
|
16529
16443
|
}
|
|
16530
|
-
function
|
|
16531
|
-
return
|
|
16444
|
+
function T2(e8) {
|
|
16445
|
+
return e8.toJSONSchema?.() ?? {};
|
|
16532
16446
|
}
|
|
16533
|
-
var
|
|
16534
|
-
function
|
|
16535
|
-
if (!
|
|
16536
|
-
let
|
|
16537
|
-
for (let
|
|
16447
|
+
var E3 = [`low`, `medium`, `high`, `xhigh`, `max`];
|
|
16448
|
+
function D2(e8, t6) {
|
|
16449
|
+
if (!t6 || t6.length === 0 || t6.includes(e8)) return e8;
|
|
16450
|
+
let n5 = E3.indexOf(e8), r4 = [...t6].sort((e9, t7) => E3.indexOf(e9) - E3.indexOf(t7)), i3;
|
|
16451
|
+
for (let e9 of r4) if (E3.indexOf(e9) <= n5) i3 = e9;
|
|
16538
16452
|
else break;
|
|
16539
|
-
return
|
|
16453
|
+
return i3 ?? r4[0];
|
|
16540
16454
|
}
|
|
16541
|
-
function te2(
|
|
16542
|
-
for (let
|
|
16455
|
+
function te2(e8) {
|
|
16456
|
+
for (let t6 of e8) if (t6.role === `tool_result` || t6.role === `assistant` && t6.content.some((e9) => e9.type === `tool_call`)) return true;
|
|
16543
16457
|
return false;
|
|
16544
16458
|
}
|
|
16545
|
-
function
|
|
16546
|
-
let
|
|
16547
|
-
|
|
16548
|
-
for (let
|
|
16549
|
-
if (
|
|
16550
|
-
if (
|
|
16551
|
-
let { base64:
|
|
16552
|
-
return
|
|
16459
|
+
function O2(t6) {
|
|
16460
|
+
let n5 = [];
|
|
16461
|
+
t6.systemPrompt && n5.push({ role: `system`, content: w3(t6.systemPrompt) });
|
|
16462
|
+
for (let r4 of b2(t6.messages)) if (r4.role === `user`) typeof r4.content == `string` ? n5.push({ role: `user`, content: w3(r4.content) }) : n5.push({ role: `user`, content: r4.content.map((t7) => {
|
|
16463
|
+
if (t7.type === `text`) return { type: `text`, text: w3(t7.text) };
|
|
16464
|
+
if (t7.type === `image`) {
|
|
16465
|
+
let { base64: n6, mediaType: r5, valid: i3 } = t3(t7.source, t7.mime);
|
|
16466
|
+
return i3 ? { type: `image_url`, image_url: { url: `data:${r5 || `image/png`};base64,${n6}` } } : { type: `text`, text: `[image omitted: corrupted or empty data]` };
|
|
16553
16467
|
}
|
|
16554
16468
|
return { type: `text`, text: `[unsupported]` };
|
|
16555
16469
|
}) });
|
|
16556
|
-
else if (
|
|
16557
|
-
let
|
|
16558
|
-
if (!
|
|
16559
|
-
|
|
16560
|
-
} else
|
|
16561
|
-
return
|
|
16470
|
+
else if (r4.role === `assistant`) {
|
|
16471
|
+
let e8 = r4.content.filter((e9) => e9.type === `tool_call`).map((e9) => ({ id: e9.id, type: `function`, function: { name: e9.name, arguments: JSON.stringify(e9.arguments) } })), t7 = r4.content.filter((e9) => e9.type === `text`).filter((e9) => e9.text.trim().length > 0).map((e9) => w3(e9.text)).join(``);
|
|
16472
|
+
if (!t7 && e8.length === 0) continue;
|
|
16473
|
+
n5.push({ role: `assistant`, content: t7 || null, ...e8.length > 0 ? { tool_calls: e8 } : {} });
|
|
16474
|
+
} else r4.role === `tool_result` ? n5.push({ role: `tool`, tool_call_id: r4.toolCallId, content: w3(r4.content.map((e8) => e8.type === `text` ? e8.text : ``).join(``)) }) : r4.role === `system_notification` && n5.push({ role: `user`, content: w3(S2(r4.content)) });
|
|
16475
|
+
return n5;
|
|
16562
16476
|
}
|
|
16563
|
-
function
|
|
16564
|
-
switch (
|
|
16477
|
+
function ne2(e8) {
|
|
16478
|
+
switch (e8) {
|
|
16565
16479
|
case `low`:
|
|
16566
16480
|
case `medium`:
|
|
16567
16481
|
case `high`:
|
|
@@ -16573,100 +16487,100 @@ function ne(e4) {
|
|
|
16573
16487
|
return `high`;
|
|
16574
16488
|
}
|
|
16575
16489
|
}
|
|
16576
|
-
function re(
|
|
16577
|
-
let
|
|
16578
|
-
return
|
|
16490
|
+
function re(e8, t6, n5 = {}) {
|
|
16491
|
+
let r4 = { model: n5.modelName ?? e8.name, messages: O2(t6), max_tokens: t6.maxTokens ?? e8.maxOutputTokens, stream: true, stream_options: { include_usage: true } };
|
|
16492
|
+
return t6.temperature !== void 0 && !e8.reasoning && (r4.temperature = t6.temperature), e8.reasoning && t6.thinkingLevel && (r4.reasoning_effort = ne2(D2(t6.thinkingLevel, e8.thinkingLevels))), t6.tools && t6.tools.length > 0 ? r4.tools = t6.tools.map((e9) => ({ type: `function`, function: { name: e9.name, description: e9.description, parameters: T2(e9.parameters) } })) : te2(t6.messages) && (r4.tools = []), r4;
|
|
16579
16493
|
}
|
|
16580
|
-
var
|
|
16581
|
-
function
|
|
16582
|
-
let
|
|
16583
|
-
let
|
|
16584
|
-
if (
|
|
16585
|
-
let
|
|
16586
|
-
return Number.isFinite(
|
|
16587
|
-
},
|
|
16588
|
-
let
|
|
16589
|
-
if (!
|
|
16590
|
-
let
|
|
16591
|
-
if (!
|
|
16592
|
-
let
|
|
16593
|
-
if (
|
|
16594
|
-
if (
|
|
16595
|
-
if (
|
|
16596
|
-
},
|
|
16597
|
-
if (!Object.values(
|
|
16494
|
+
var ie = A2(`@x-otto/provider:openai-usage`);
|
|
16495
|
+
function ae2(e8) {
|
|
16496
|
+
let t6 = (t7) => {
|
|
16497
|
+
let n6 = e8.get(t7);
|
|
16498
|
+
if (n6 === null) return;
|
|
16499
|
+
let r5 = Number(n6);
|
|
16500
|
+
return Number.isFinite(r5) ? r5 : void 0;
|
|
16501
|
+
}, n5 = (t7) => {
|
|
16502
|
+
let n6 = e8.get(t7);
|
|
16503
|
+
if (!n6) return;
|
|
16504
|
+
let r5 = n6.match(/^(\d+(?:\.\d+)?)(m|s|ms)$/);
|
|
16505
|
+
if (!r5) return;
|
|
16506
|
+
let i3 = Number(r5[1]), a3 = r5[2];
|
|
16507
|
+
if (a3 === `ms`) return i3;
|
|
16508
|
+
if (a3 === `s`) return i3 * 1e3;
|
|
16509
|
+
if (a3 === `m`) return i3 * 60 * 1e3;
|
|
16510
|
+
}, r4 = { remainingRequests: t6(`x-ratelimit-remaining-requests`), remainingTokens: t6(`x-ratelimit-remaining-tokens`), limitRequests: t6(`x-ratelimit-limit-requests`), limitTokens: t6(`x-ratelimit-limit-tokens`), resetRequestsMs: n5(`x-ratelimit-reset-requests`), resetTokensMs: n5(`x-ratelimit-reset-tokens`) };
|
|
16511
|
+
if (!Object.values(r4).every((e9) => e9 === void 0)) return r4;
|
|
16598
16512
|
}
|
|
16599
|
-
function
|
|
16600
|
-
if (!
|
|
16601
|
-
let
|
|
16602
|
-
if (
|
|
16603
|
-
let
|
|
16604
|
-
|
|
16605
|
-
let
|
|
16606
|
-
|
|
16607
|
-
}),
|
|
16608
|
-
%s`,
|
|
16513
|
+
function oe2(e8) {
|
|
16514
|
+
if (!e8) return null;
|
|
16515
|
+
let t6 = ae2(e8);
|
|
16516
|
+
if (ie.isLevelEnabled(`trace`)) {
|
|
16517
|
+
let t7 = [];
|
|
16518
|
+
e8.forEach((e9, n5) => {
|
|
16519
|
+
let r4 = n5.startsWith(`x-ratelimit-`) || e9.length < 40 ? e9 : e9.slice(0, 20) + `\u2026`;
|
|
16520
|
+
t7.push(` ${n5}: ${r4}`);
|
|
16521
|
+
}), ie.trace(`OpenAI Codex response headers (%d):
|
|
16522
|
+
%s`, t7.length, t7.sort().join(`
|
|
16609
16523
|
`));
|
|
16610
16524
|
}
|
|
16611
|
-
return
|
|
16525
|
+
return t6 ? { status: `unknown`, standardLimits: t6 } : null;
|
|
16612
16526
|
}
|
|
16613
|
-
var
|
|
16614
|
-
function
|
|
16527
|
+
var se = A2(`@x-otto/provider:stream-state`);
|
|
16528
|
+
function k3() {
|
|
16615
16529
|
return { inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0 };
|
|
16616
16530
|
}
|
|
16617
|
-
function
|
|
16531
|
+
function A3(e8, t6) {
|
|
16618
16532
|
try {
|
|
16619
|
-
return { args: JSON.parse(
|
|
16533
|
+
return { args: JSON.parse(e8), parseFailed: false };
|
|
16620
16534
|
} catch {
|
|
16621
|
-
return
|
|
16535
|
+
return se.debug({ toolName: t6 }, `Failed to parse tool arguments JSON`), { args: {}, parseFailed: true };
|
|
16622
16536
|
}
|
|
16623
16537
|
}
|
|
16624
|
-
function
|
|
16625
|
-
return new Set(
|
|
16538
|
+
function le2(e8) {
|
|
16539
|
+
return new Set(e8?.map((e9) => e9.name) ?? []);
|
|
16626
16540
|
}
|
|
16627
|
-
function
|
|
16628
|
-
let { args:
|
|
16629
|
-
return { type: `tool_call`, id:
|
|
16541
|
+
function j2(e8, t6, n5) {
|
|
16542
|
+
let { args: r4, parseFailed: i3 } = A3(n5, t6);
|
|
16543
|
+
return { type: `tool_call`, id: e8, name: t6, arguments: r4, ...i3 ? { argumentsParseFailed: true } : {} };
|
|
16630
16544
|
}
|
|
16631
|
-
function
|
|
16632
|
-
if (
|
|
16633
|
-
let
|
|
16634
|
-
if (
|
|
16635
|
-
let
|
|
16636
|
-
if (!
|
|
16637
|
-
let
|
|
16638
|
-
return
|
|
16545
|
+
function M2(e8, t6) {
|
|
16546
|
+
if (e8.content.some((e9) => e9.type === `tool_call`)) return e8;
|
|
16547
|
+
let n5 = e8.content.findLastIndex((e9) => e9.type === `text`);
|
|
16548
|
+
if (n5 < 0) return e8;
|
|
16549
|
+
let r4 = e8.content[n5], i3 = P2(r4.text, t6);
|
|
16550
|
+
if (!i3) return e8;
|
|
16551
|
+
let a3 = [...e8.content], o3 = r4.text.slice(0, i3.matchStart).trimEnd();
|
|
16552
|
+
return o3.length > 0 ? a3[n5] = { ...r4, text: o3 } : a3.splice(n5, 1), a3.push(j2(`recovered_${n5}`, i3.name, i3.argumentsJson)), { ...e8, content: a3 };
|
|
16639
16553
|
}
|
|
16640
|
-
var
|
|
16641
|
-
var
|
|
16642
|
-
function
|
|
16643
|
-
let
|
|
16644
|
-
if (!
|
|
16645
|
-
let
|
|
16646
|
-
if (!
|
|
16647
|
-
let
|
|
16648
|
-
for (
|
|
16649
|
-
return { name:
|
|
16554
|
+
var ue2 = /<invoke name="([^"]+)">((?:(?!<invoke name=")[\s\S])*?)<\/invoke>\s*$/;
|
|
16555
|
+
var N2 = /<parameter name="([^"]+)">([\s\S]*?)<\/parameter>/g;
|
|
16556
|
+
function P2(e8, t6) {
|
|
16557
|
+
let n5 = e8.trimEnd(), r4 = ue2.exec(n5);
|
|
16558
|
+
if (!r4) return null;
|
|
16559
|
+
let i3 = r4[1];
|
|
16560
|
+
if (!t6.has(i3)) return null;
|
|
16561
|
+
let a3 = {}, o3 = r4[2], s3;
|
|
16562
|
+
for (N2.lastIndex = 0; (s3 = N2.exec(o3)) !== null; ) a3[s3[1]] = s3[2];
|
|
16563
|
+
return { name: i3, argumentsJson: JSON.stringify(a3), matchStart: r4.index };
|
|
16650
16564
|
}
|
|
16651
|
-
function
|
|
16652
|
-
return { ...
|
|
16565
|
+
function F3() {
|
|
16566
|
+
return { ...k3(), textContent: ``, thinkingText: ``, toolCalls: /* @__PURE__ */ new Map(), stopReason: `end_turn` };
|
|
16653
16567
|
}
|
|
16654
|
-
function
|
|
16655
|
-
let
|
|
16656
|
-
if (
|
|
16657
|
-
return
|
|
16568
|
+
function I2(e8, t6 = true) {
|
|
16569
|
+
let n5 = [];
|
|
16570
|
+
if (e8.thinkingText && n5.push({ type: `thinking`, text: e8.thinkingText }), e8.textContent && n5.push({ type: `text`, text: e8.textContent }), t6) for (let [, t7] of e8.toolCalls) n5.push(j2(t7.id, t7.name, t7.argumentsJson));
|
|
16571
|
+
return n5;
|
|
16658
16572
|
}
|
|
16659
|
-
function
|
|
16660
|
-
let
|
|
16661
|
-
for (let [,
|
|
16662
|
-
return
|
|
16573
|
+
function fe2(e8, t6 = true) {
|
|
16574
|
+
let n5 = [], r4 = [...e8.entries()].sort(([e9], [t7]) => e9 - t7);
|
|
16575
|
+
for (let [, e9] of r4) e9.kind === `thinking` ? e9.text && n5.push({ type: `thinking`, text: e9.text, ...e9.signature === void 0 ? {} : { signature: e9.signature } }) : e9.kind === `text` ? e9.text && n5.push({ type: `text`, text: e9.text }) : t6 && n5.push(j2(e9.id, e9.name, e9.argumentsJson));
|
|
16576
|
+
return n5;
|
|
16663
16577
|
}
|
|
16664
|
-
function
|
|
16665
|
-
return { role: `assistant`, content:
|
|
16578
|
+
function L3(e8, t6, n5, r4) {
|
|
16579
|
+
return { role: `assistant`, content: t6, api: e8.api, provider: e8.provider, model: e8.model, usage: { inputTokens: n5.inputTokens, outputTokens: n5.outputTokens, cacheReadTokens: n5.cacheReadTokens, cacheWriteTokens: n5.cacheWriteTokens }, stopReason: r4 };
|
|
16666
16580
|
}
|
|
16667
|
-
var
|
|
16668
|
-
function
|
|
16669
|
-
switch (
|
|
16581
|
+
var pe = A2(`@x-otto/provider:chat-completions-stream`);
|
|
16582
|
+
function R2(e8) {
|
|
16583
|
+
switch (e8) {
|
|
16670
16584
|
case `stop`:
|
|
16671
16585
|
return `end_turn`;
|
|
16672
16586
|
case `length`:
|
|
@@ -16676,123 +16590,123 @@ function I3(e4) {
|
|
|
16676
16590
|
case `content_filter`:
|
|
16677
16591
|
return `refusal`;
|
|
16678
16592
|
default:
|
|
16679
|
-
return
|
|
16593
|
+
return pe.warn(`Unknown chat-completions finish_reason: ${e8}`), `end_turn`;
|
|
16680
16594
|
}
|
|
16681
16595
|
}
|
|
16682
|
-
async function*
|
|
16683
|
-
let { url:
|
|
16684
|
-
|
|
16596
|
+
async function* me(e8) {
|
|
16597
|
+
let { url: t6, headers: r4, body: i3, identity: a3, signal: o3, timeout: s3, idleTimeout: c3, onResponse: l2, registeredToolNames: u } = e8, d = F3(), p = (e9 = false) => L3(a3, I2(d, e9), d, d.stopReason), m = false, h = false, g = false, _3, v3 = xt({ url: t6, body: i3, headers: r4, signal: o3, timeout: s3, idleTimeout: c3, onResponse: (e9) => {
|
|
16598
|
+
_3 = e9, l2?.(e9);
|
|
16685
16599
|
} });
|
|
16686
16600
|
try {
|
|
16687
|
-
for await (let
|
|
16688
|
-
if (
|
|
16689
|
-
let
|
|
16601
|
+
for await (let e9 of v3) {
|
|
16602
|
+
if (e9.data === `[DONE]`) break;
|
|
16603
|
+
let t7;
|
|
16690
16604
|
try {
|
|
16691
|
-
|
|
16605
|
+
t7 = JSON.parse(e9.data);
|
|
16692
16606
|
} catch {
|
|
16693
16607
|
continue;
|
|
16694
16608
|
}
|
|
16695
|
-
if (
|
|
16696
|
-
let
|
|
16697
|
-
throw new
|
|
16609
|
+
if (t7.error) {
|
|
16610
|
+
let e10 = t7.error, r6 = typeof e10.message == `string` ? e10.message : JSON.stringify(e10), i5 = e10.code, a5 = typeof i5 == `number` ? i5 : typeof i5 == `string` && /^\d+/.test(i5) ? Number(i5.match(/^\d+/)?.[0]) : void 0;
|
|
16611
|
+
throw new we(`Chat Completions stream error: ${r6}`, { code: `PROVIDER_API_ERROR`, status: a5 });
|
|
16698
16612
|
}
|
|
16699
|
-
if (
|
|
16700
|
-
let
|
|
16701
|
-
|
|
16613
|
+
if (t7.usage) {
|
|
16614
|
+
let e10 = t7.usage, n5 = e10.prompt_tokens ?? 0, r6 = e10.completion_tokens ?? 0, i5 = e10.prompt_tokens_details?.cached_tokens ?? e10.prompt_cache_hit_tokens ?? 0;
|
|
16615
|
+
d.inputTokens = n5 - i5, d.cacheReadTokens = i5, d.outputTokens = r6;
|
|
16702
16616
|
}
|
|
16703
|
-
let
|
|
16704
|
-
if (!
|
|
16705
|
-
let
|
|
16706
|
-
if (m || (m = true, yield { type: `start`, partial:
|
|
16707
|
-
if (
|
|
16708
|
-
let
|
|
16709
|
-
|
|
16617
|
+
let r5 = t7.choices?.[0];
|
|
16618
|
+
if (!r5) continue;
|
|
16619
|
+
let i4 = r5.delta;
|
|
16620
|
+
if (m || (m = true, yield { type: `start`, partial: p() }), r5.finish_reason && (d.stopReason = R2(r5.finish_reason)), !i4) continue;
|
|
16621
|
+
if (i4.content) {
|
|
16622
|
+
let e10 = i4.content;
|
|
16623
|
+
h || (h = true, yield { type: `text_start`, index: 0, partial: p() }), d.textContent += e10, yield { type: `text_delta`, index: 0, delta: e10, partial: p() };
|
|
16710
16624
|
}
|
|
16711
|
-
let
|
|
16712
|
-
if (
|
|
16713
|
-
let
|
|
16714
|
-
|
|
16715
|
-
let
|
|
16716
|
-
if (
|
|
16717
|
-
let
|
|
16718
|
-
|
|
16625
|
+
let a4 = i4.reasoning_content ?? i4.reasoning ?? i4.reasoning_text ?? null;
|
|
16626
|
+
if (a4 && (g || (g = true, yield { type: `thinking_start`, index: 0, partial: p() }), d.thinkingText += a4, yield { type: `thinking_delta`, index: 0, delta: a4, partial: p() }), i4.tool_calls) for (let e10 of i4.tool_calls) {
|
|
16627
|
+
let t8 = e10.index, n5 = e10.function;
|
|
16628
|
+
d.toolCalls.has(t8) || (d.toolCalls.set(t8, { id: e10.id ?? `call_${t8}`, name: n5?.name ?? ``, argumentsJson: `` }), yield { type: `tool_call_start`, index: t8, partial: p() });
|
|
16629
|
+
let r6 = d.toolCalls.get(t8);
|
|
16630
|
+
if (n5?.arguments) {
|
|
16631
|
+
let e11 = n5.arguments;
|
|
16632
|
+
r6.argumentsJson += e11, yield { type: `tool_call_delta`, index: t8, delta: e11, partial: p() };
|
|
16719
16633
|
}
|
|
16720
16634
|
}
|
|
16721
16635
|
}
|
|
16722
|
-
|
|
16723
|
-
for (let [
|
|
16724
|
-
yield { type: `done`, reason:
|
|
16725
|
-
} catch (
|
|
16726
|
-
yield { type: `error`, error:
|
|
16636
|
+
g && (yield { type: `thinking_end`, index: 0, content: d.thinkingText, partial: p() }), h && (yield { type: `text_end`, index: 0, content: d.textContent, partial: p() });
|
|
16637
|
+
for (let [e9, t7] of d.toolCalls) yield { type: `tool_call_end`, index: e9, toolCall: j2(t7.id, t7.name, t7.argumentsJson), partial: p() };
|
|
16638
|
+
yield { type: `done`, reason: d.stopReason, message: M2(p(true), u ?? /* @__PURE__ */ new Set()), providerUsage: oe2(_3) };
|
|
16639
|
+
} catch (e9) {
|
|
16640
|
+
yield { type: `error`, error: e9 instanceof Error ? e9 : new we(`Unknown Chat Completions stream error`, { code: `PROVIDER_STREAM_ERROR` }) };
|
|
16727
16641
|
}
|
|
16728
16642
|
}
|
|
16729
|
-
function
|
|
16730
|
-
for (let
|
|
16731
|
-
if (!
|
|
16732
|
-
let
|
|
16733
|
-
if (
|
|
16734
|
-
let
|
|
16735
|
-
if (
|
|
16736
|
-
let
|
|
16737
|
-
if (typeof
|
|
16643
|
+
function z2(e8, t6, n5) {
|
|
16644
|
+
for (let r4 of e8) {
|
|
16645
|
+
if (!r4) continue;
|
|
16646
|
+
let e9 = r4.split(`.`)[1];
|
|
16647
|
+
if (e9) try {
|
|
16648
|
+
let r5 = JSON.parse(Buffer.from(e9, `base64url`).toString(`utf-8`));
|
|
16649
|
+
if (n5) {
|
|
16650
|
+
let e10 = r5[n5]?.[t6] ?? r5[t6];
|
|
16651
|
+
if (typeof e10 == `string`) return e10;
|
|
16738
16652
|
} else {
|
|
16739
|
-
let
|
|
16740
|
-
if (typeof
|
|
16653
|
+
let e10 = r5[t6];
|
|
16654
|
+
if (typeof e10 == `string`) return e10;
|
|
16741
16655
|
}
|
|
16742
16656
|
} catch {
|
|
16743
16657
|
}
|
|
16744
16658
|
}
|
|
16745
16659
|
}
|
|
16746
|
-
var
|
|
16747
|
-
var
|
|
16748
|
-
var
|
|
16749
|
-
function
|
|
16750
|
-
let
|
|
16751
|
-
if (!
|
|
16752
|
-
for (let [
|
|
16753
|
-
let
|
|
16754
|
-
if (!
|
|
16755
|
-
|
|
16660
|
+
var he = /* @__PURE__ */ new Set([`authorization`, `x-api-key`]);
|
|
16661
|
+
var ge = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
16662
|
+
var _e = /[\u0000-\u001f\u007f]/g;
|
|
16663
|
+
function B3(e8, t6, n5, r4) {
|
|
16664
|
+
let i3 = /* @__PURE__ */ new Map();
|
|
16665
|
+
if (!e8) return i3;
|
|
16666
|
+
for (let [a3, o3] of Object.entries(e8)) {
|
|
16667
|
+
let e9 = a3.trim();
|
|
16668
|
+
if (!ge.test(e9)) {
|
|
16669
|
+
n5?.warn({ provider: r4, source: t6, header: a3 }, `dropped request header with invalid name (RFC 7230 token expected)`);
|
|
16756
16670
|
continue;
|
|
16757
16671
|
}
|
|
16758
|
-
if (typeof
|
|
16759
|
-
let
|
|
16760
|
-
|
|
16672
|
+
if (typeof o3 != `string`) continue;
|
|
16673
|
+
let s3 = o3.replace(_e, ``).trim();
|
|
16674
|
+
s3 && i3.set(e9.toLowerCase(), { name: e9, value: s3 });
|
|
16761
16675
|
}
|
|
16762
|
-
return
|
|
16676
|
+
return i3;
|
|
16763
16677
|
}
|
|
16764
|
-
function
|
|
16765
|
-
if (!
|
|
16766
|
-
let
|
|
16767
|
-
for (let
|
|
16768
|
-
if (
|
|
16769
|
-
let
|
|
16770
|
-
|
|
16771
|
-
}
|
|
16772
|
-
return Object.keys(
|
|
16678
|
+
function ve(e8) {
|
|
16679
|
+
if (!e8?.headers.length) return;
|
|
16680
|
+
let t6 = {};
|
|
16681
|
+
for (let n5 of e8.headers) {
|
|
16682
|
+
if (n5.source.kind !== `jwt-claim`) continue;
|
|
16683
|
+
let r4 = z2(n5.source.tokenSources?.length ? n5.source.tokenSources.map((t7) => t7 === `access_token` ? e8.token : void 0) : [e8.token], n5.source.claim, n5.source.namespace);
|
|
16684
|
+
r4 && (t6[n5.header] = r4);
|
|
16685
|
+
}
|
|
16686
|
+
return Object.keys(t6).length > 0 ? t6 : void 0;
|
|
16773
16687
|
}
|
|
16774
|
-
function
|
|
16775
|
-
let { logger:
|
|
16776
|
-
for (let { label:
|
|
16777
|
-
if (!
|
|
16778
|
-
|
|
16688
|
+
function ye(e8) {
|
|
16689
|
+
let { logger: t6, diagnosticLabel: n5, allowAuthHeaderOverride: r4 } = e8, i3 = [{ label: `protocolDefaults`, entries: B3(e8.protocolDefaults, `protocolDefaults`, t6, n5) }, { label: `staticHeaders`, entries: B3(e8.staticHeaders, `staticHeaders`, t6, n5) }, { label: `tokenDerived`, entries: B3(ve(e8.tokenDerived), `tokenDerived`, t6, n5) }, { label: `customized`, entries: B3(e8.customized, `customized`, t6, n5) }], a3 = /* @__PURE__ */ new Set([`staticHeaders`, `tokenDerived`, `customized`]), o3 = /* @__PURE__ */ new Map();
|
|
16690
|
+
for (let { label: e9, entries: s4 } of i3) for (let [i4, c3] of s4) {
|
|
16691
|
+
if (!r4 && a3.has(e9) && he.has(i4)) {
|
|
16692
|
+
t6?.warn({ provider: n5, source: e9, header: c3.name }, `dropped attempt to override auth header (declare allowAuthHeaderOverride to permit)`);
|
|
16779
16693
|
continue;
|
|
16780
16694
|
}
|
|
16781
|
-
let
|
|
16782
|
-
|
|
16695
|
+
let s5 = o3.get(i4);
|
|
16696
|
+
s5 && e9 === `customized` && s5.value !== c3.value && t6?.debug({ provider: n5, header: c3.name }, `customizeRequest overrode a previously declared request header`), o3.set(i4, c3);
|
|
16783
16697
|
}
|
|
16784
|
-
for (let [
|
|
16785
|
-
if (
|
|
16786
|
-
|
|
16698
|
+
for (let [i4, a4] of B3(e8.auth, `auth`, t6, n5)) {
|
|
16699
|
+
if (r4 && o3.has(i4)) {
|
|
16700
|
+
t6?.debug({ provider: n5, header: a4.name }, `provider-declared auth header kept (allowAuthHeaderOverride); otto-resolved credential not applied`);
|
|
16787
16701
|
continue;
|
|
16788
16702
|
}
|
|
16789
|
-
|
|
16703
|
+
o3.set(i4, a4);
|
|
16790
16704
|
}
|
|
16791
|
-
let
|
|
16792
|
-
for (let { name:
|
|
16793
|
-
return
|
|
16705
|
+
let s3 = {};
|
|
16706
|
+
for (let { name: e9, value: t7 } of o3.values()) s3[e9] = t7;
|
|
16707
|
+
return s3;
|
|
16794
16708
|
}
|
|
16795
|
-
var
|
|
16709
|
+
var V2 = A2(`@x-otto/provider:oauth:templates`);
|
|
16796
16710
|
|
|
16797
16711
|
// ../../extensions/plugin-otto-wire-protocols/src/anthropic-usage.ts
|
|
16798
16712
|
var LIMIT_TYPE_ABBREVIATION = {
|
|
@@ -16808,9 +16722,9 @@ function readBucketUtilization(headers, limitType) {
|
|
|
16808
16722
|
if (!abbr) return void 0;
|
|
16809
16723
|
const raw = wt(headers, `anthropic-ratelimit-unified-${abbr}-utilization`);
|
|
16810
16724
|
if (raw === void 0) return void 0;
|
|
16811
|
-
const
|
|
16812
|
-
if (!Number.isFinite(
|
|
16813
|
-
return Math.round(
|
|
16725
|
+
const n5 = Number(raw);
|
|
16726
|
+
if (!Number.isFinite(n5)) return void 0;
|
|
16727
|
+
return Math.round(n5 * 100);
|
|
16814
16728
|
}
|
|
16815
16729
|
function extractProviderUsageFromHeaders(headers) {
|
|
16816
16730
|
if (!headers) return null;
|
|
@@ -16836,24 +16750,6 @@ function extractProviderUsageFromHeaders(headers) {
|
|
|
16836
16750
|
}
|
|
16837
16751
|
|
|
16838
16752
|
// ../../extensions/plugin-otto-wire-protocols/src/anthropic-messages.ts
|
|
16839
|
-
var noopLogger2 = { debug: () => {
|
|
16840
|
-
}, info: () => {
|
|
16841
|
-
}, warn: () => {
|
|
16842
|
-
}, error: () => {
|
|
16843
|
-
} };
|
|
16844
|
-
async function resolveBaseUrl(modelBaseUrl, resolver) {
|
|
16845
|
-
const envUrl = process.env["ANTHROPIC_BASE_URL"];
|
|
16846
|
-
if (envUrl) {
|
|
16847
|
-
return envUrl;
|
|
16848
|
-
}
|
|
16849
|
-
if (resolver) {
|
|
16850
|
-
const authUrl = await resolver();
|
|
16851
|
-
if (authUrl) {
|
|
16852
|
-
return authUrl;
|
|
16853
|
-
}
|
|
16854
|
-
}
|
|
16855
|
-
return modelBaseUrl;
|
|
16856
|
-
}
|
|
16857
16753
|
function toBudgetTokens(level, maxOutputTokens) {
|
|
16858
16754
|
let budget;
|
|
16859
16755
|
switch (level) {
|
|
@@ -16930,22 +16826,22 @@ function withMessageCacheBreakpoint(messages, cacheControl = CACHE_CONTROL) {
|
|
|
16930
16826
|
}
|
|
16931
16827
|
function buildSystemBlocks(systemPrompt, segments, cacheControl = CACHE_CONTROL) {
|
|
16932
16828
|
const source = segments && segments.length > 0 ? segments : systemPrompt ? [{ text: systemPrompt }] : [];
|
|
16933
|
-
const blocks = source.filter((
|
|
16829
|
+
const blocks = source.filter((s3) => s3.text.length > 0);
|
|
16934
16830
|
if (blocks.length === 0) {
|
|
16935
16831
|
return void 0;
|
|
16936
16832
|
}
|
|
16937
16833
|
let breakpoint = -1;
|
|
16938
16834
|
if (cacheControl) {
|
|
16939
|
-
for (const [
|
|
16835
|
+
for (const [i3, seg] of blocks.entries()) {
|
|
16940
16836
|
if ((seg.cache ?? "stable") === "stable") {
|
|
16941
|
-
breakpoint =
|
|
16837
|
+
breakpoint = i3;
|
|
16942
16838
|
}
|
|
16943
16839
|
}
|
|
16944
16840
|
}
|
|
16945
|
-
return blocks.map((seg,
|
|
16841
|
+
return blocks.map((seg, i3) => ({
|
|
16946
16842
|
type: "text",
|
|
16947
16843
|
text: seg.text,
|
|
16948
|
-
...
|
|
16844
|
+
...i3 === breakpoint && cacheControl ? { cache_control: cacheControl } : {}
|
|
16949
16845
|
}));
|
|
16950
16846
|
}
|
|
16951
16847
|
function supportsMidConversationSystemMessage(model) {
|
|
@@ -16961,9 +16857,9 @@ function sanitizeToolUseId(id) {
|
|
|
16961
16857
|
function buildAnthropicMessages(messages, model) {
|
|
16962
16858
|
const result = [];
|
|
16963
16859
|
const nativeSystemMessageSupported = model ? supportsMidConversationSystemMessage(model) : false;
|
|
16964
|
-
const normalized = nativeSystemMessageSupported ?
|
|
16965
|
-
|
|
16966
|
-
for (const msg of
|
|
16860
|
+
const normalized = nativeSystemMessageSupported ? C2(messages) : messages;
|
|
16861
|
+
ee(normalized);
|
|
16862
|
+
for (const msg of b2(normalized)) {
|
|
16967
16863
|
if (msg.role === "user") {
|
|
16968
16864
|
if (typeof msg.content === "string") {
|
|
16969
16865
|
result.push({ role: "user", content: msg.content });
|
|
@@ -16975,13 +16871,13 @@ function buildAnthropicMessages(messages, model) {
|
|
|
16975
16871
|
content.push({ type: "text", text: part.text });
|
|
16976
16872
|
}
|
|
16977
16873
|
} else if (part.type === "image") {
|
|
16978
|
-
const { base64, mediaType, valid } =
|
|
16874
|
+
const { base64, mediaType, valid } = t3(part.source, part.mime);
|
|
16979
16875
|
if (valid) {
|
|
16980
16876
|
content.push({
|
|
16981
16877
|
type: "image",
|
|
16982
16878
|
source: {
|
|
16983
16879
|
type: "base64",
|
|
16984
|
-
media_type:
|
|
16880
|
+
media_type: r2(mediaType, base64),
|
|
16985
16881
|
data: base64
|
|
16986
16882
|
}
|
|
16987
16883
|
});
|
|
@@ -17021,19 +16917,19 @@ function buildAnthropicMessages(messages, model) {
|
|
|
17021
16917
|
}
|
|
17022
16918
|
} else if (msg.role === "tool_result") {
|
|
17023
16919
|
const toolContent = [];
|
|
17024
|
-
for (const
|
|
17025
|
-
if (
|
|
17026
|
-
if (
|
|
17027
|
-
toolContent.push({ type: "text", text:
|
|
16920
|
+
for (const c3 of msg.content) {
|
|
16921
|
+
if (c3.type === "text") {
|
|
16922
|
+
if (c3.text.length > 0) {
|
|
16923
|
+
toolContent.push({ type: "text", text: c3.text });
|
|
17028
16924
|
}
|
|
17029
|
-
} else if (
|
|
17030
|
-
const { base64, mediaType, valid } =
|
|
16925
|
+
} else if (c3.type === "image") {
|
|
16926
|
+
const { base64, mediaType, valid } = t3(c3.source, c3.mime);
|
|
17031
16927
|
if (valid) {
|
|
17032
16928
|
toolContent.push({
|
|
17033
16929
|
type: "image",
|
|
17034
16930
|
source: {
|
|
17035
16931
|
type: "base64",
|
|
17036
|
-
media_type:
|
|
16932
|
+
media_type: r2(mediaType, base64),
|
|
17037
16933
|
data: base64
|
|
17038
16934
|
}
|
|
17039
16935
|
});
|
|
@@ -17057,17 +16953,17 @@ function buildAnthropicMessages(messages, model) {
|
|
|
17057
16953
|
if (nativeSystemMessageSupported) {
|
|
17058
16954
|
result.push({ role: "system", content: msg.content });
|
|
17059
16955
|
} else {
|
|
17060
|
-
result.push({ role: "user", content:
|
|
16956
|
+
result.push({ role: "user", content: S2(msg.content) });
|
|
17061
16957
|
}
|
|
17062
16958
|
}
|
|
17063
16959
|
}
|
|
17064
16960
|
if (nativeSystemMessageSupported) {
|
|
17065
|
-
for (let
|
|
17066
|
-
if (result[
|
|
17067
|
-
const next = result[
|
|
16961
|
+
for (let i3 = 0; i3 < result.length; i3++) {
|
|
16962
|
+
if (result[i3].role === "system") {
|
|
16963
|
+
const next = result[i3 + 1];
|
|
17068
16964
|
if (next && next.role !== "assistant") {
|
|
17069
|
-
const text = typeof result[
|
|
17070
|
-
result[
|
|
16965
|
+
const text = typeof result[i3].content === "string" ? result[i3].content : "";
|
|
16966
|
+
result[i3] = { role: "user", content: S2(text) };
|
|
17071
16967
|
}
|
|
17072
16968
|
}
|
|
17073
16969
|
}
|
|
@@ -17092,16 +16988,16 @@ function mapStopReason(reason) {
|
|
|
17092
16988
|
}
|
|
17093
16989
|
function initStreamState(modelId) {
|
|
17094
16990
|
return {
|
|
17095
|
-
...
|
|
16991
|
+
...k3(),
|
|
17096
16992
|
model: modelId,
|
|
17097
16993
|
blocks: /* @__PURE__ */ new Map(),
|
|
17098
16994
|
stopReason: "end_turn"
|
|
17099
16995
|
};
|
|
17100
16996
|
}
|
|
17101
16997
|
function buildAssistantMessage(state, final = false) {
|
|
17102
|
-
return
|
|
16998
|
+
return L3(
|
|
17103
16999
|
{ api: "anthropic-messages", provider: "anthropic", model: state.model },
|
|
17104
|
-
|
|
17000
|
+
fe2(state.blocks, final),
|
|
17105
17001
|
state,
|
|
17106
17002
|
state.stopReason
|
|
17107
17003
|
);
|
|
@@ -17109,14 +17005,14 @@ function buildAssistantMessage(state, final = false) {
|
|
|
17109
17005
|
function dispatchStreamEvent(event, state) {
|
|
17110
17006
|
switch (event.type) {
|
|
17111
17007
|
case "message_start": {
|
|
17112
|
-
const
|
|
17113
|
-
state.inputTokens =
|
|
17114
|
-
state.outputTokens =
|
|
17115
|
-
if (
|
|
17116
|
-
state.cacheReadTokens =
|
|
17008
|
+
const u = event.message.usage;
|
|
17009
|
+
state.inputTokens = u.input_tokens;
|
|
17010
|
+
state.outputTokens = u.output_tokens;
|
|
17011
|
+
if (u.cache_read_input_tokens != null) {
|
|
17012
|
+
state.cacheReadTokens = u.cache_read_input_tokens;
|
|
17117
17013
|
}
|
|
17118
|
-
if (
|
|
17119
|
-
state.cacheWriteTokens =
|
|
17014
|
+
if (u.cache_creation_input_tokens != null) {
|
|
17015
|
+
state.cacheWriteTokens = u.cache_creation_input_tokens;
|
|
17120
17016
|
}
|
|
17121
17017
|
return [];
|
|
17122
17018
|
}
|
|
@@ -17195,7 +17091,7 @@ function dispatchStreamEvent(event, state) {
|
|
|
17195
17091
|
return [{
|
|
17196
17092
|
type: "tool_call_end",
|
|
17197
17093
|
index,
|
|
17198
|
-
toolCall:
|
|
17094
|
+
toolCall: j2(block.id, block.name, block.argumentsJson),
|
|
17199
17095
|
partial: buildAssistantMessage(state)
|
|
17200
17096
|
}];
|
|
17201
17097
|
}
|
|
@@ -17220,7 +17116,7 @@ function dispatchStreamEvent(event, state) {
|
|
|
17220
17116
|
}
|
|
17221
17117
|
}
|
|
17222
17118
|
var AnthropicStream = class {
|
|
17223
|
-
constructor(resolveCredential, baseUrlResolver, authResolver, customizeRequest, logger =
|
|
17119
|
+
constructor(resolveCredential, baseUrlResolver, authResolver, customizeRequest, logger = _2, staticHeaders, tokenDerivedHeaders, allowAuthHeaderOverride) {
|
|
17224
17120
|
this.resolveCredential = resolveCredential;
|
|
17225
17121
|
this.baseUrlResolver = baseUrlResolver;
|
|
17226
17122
|
this.authResolver = authResolver;
|
|
@@ -17266,15 +17162,15 @@ var AnthropicStream = class {
|
|
|
17266
17162
|
if (envKey) {
|
|
17267
17163
|
return { token: envKey, mode: "api_key" };
|
|
17268
17164
|
}
|
|
17269
|
-
throw new
|
|
17165
|
+
throw new we(
|
|
17270
17166
|
"Missing Anthropic API key. Set ANTHROPIC_API_KEY or configure via auth file.",
|
|
17271
17167
|
{ code: "PROVIDER_AUTH_MISSING" }
|
|
17272
17168
|
);
|
|
17273
17169
|
}
|
|
17274
17170
|
async buildRequestParams(model, context, auth) {
|
|
17275
|
-
const baseURL = await
|
|
17171
|
+
const baseURL = await v2("ANTHROPIC_BASE_URL", this.baseUrlResolver, model.baseUrl);
|
|
17276
17172
|
const customization = this.customizeRequest?.({ auth, sessionId: this.requestSessionId });
|
|
17277
|
-
const defaultHeaders =
|
|
17173
|
+
const defaultHeaders = ye({
|
|
17278
17174
|
staticHeaders: this.staticHeaders,
|
|
17279
17175
|
tokenDerived: this.tokenDerivedHeaders?.length ? { headers: this.tokenDerivedHeaders, token: auth.token } : void 0,
|
|
17280
17176
|
customized: customization?.defaultHeaders,
|
|
@@ -17296,10 +17192,10 @@ var AnthropicStream = class {
|
|
|
17296
17192
|
...headerOptions
|
|
17297
17193
|
});
|
|
17298
17194
|
const cacheControl = cacheControlFor(context.cacheRetention);
|
|
17299
|
-
const tools = context.tools ? context.tools.map((
|
|
17300
|
-
name:
|
|
17301
|
-
description:
|
|
17302
|
-
input_schema:
|
|
17195
|
+
const tools = context.tools ? context.tools.map((t6) => ({
|
|
17196
|
+
name: t6.name,
|
|
17197
|
+
description: t6.description,
|
|
17198
|
+
input_schema: t6.parameters.toJSONSchema?.() ?? {}
|
|
17303
17199
|
})) : [];
|
|
17304
17200
|
const lastTool = tools[tools.length - 1];
|
|
17305
17201
|
if (lastTool && cacheControl) {
|
|
@@ -17308,7 +17204,7 @@ var AnthropicStream = class {
|
|
|
17308
17204
|
const effectiveMaxTokens = context.maxTokens ?? model.maxOutputTokens;
|
|
17309
17205
|
const thinkingConfig = buildThinkingConfig(
|
|
17310
17206
|
// RFC-235:按模型声明的 thinkingLevels 降级后再算预算(clamp 单一真源)。
|
|
17311
|
-
context.thinkingLevel ?
|
|
17207
|
+
context.thinkingLevel ? D2(context.thinkingLevel, model.thinkingLevels) : void 0,
|
|
17312
17208
|
model.reasoning,
|
|
17313
17209
|
effectiveMaxTokens,
|
|
17314
17210
|
model.thinkingMode
|
|
@@ -17330,7 +17226,7 @@ var AnthropicStream = class {
|
|
|
17330
17226
|
...context.temperature !== void 0 && !model.reasoning ? { temperature: context.temperature } : {},
|
|
17331
17227
|
...thinkingConfig ? { thinking: thinkingConfig } : {},
|
|
17332
17228
|
// adaptive 模式:网关要求顶层 output_config.effort 控制推理投入(与 thinking.type.adaptive 配对)。
|
|
17333
|
-
...thinkingConfig?.type === "adaptive" && context.thinkingLevel ? { output_config: { effort: toAdaptiveEffort(
|
|
17229
|
+
...thinkingConfig?.type === "adaptive" && context.thinkingLevel ? { output_config: { effort: toAdaptiveEffort(D2(context.thinkingLevel, model.thinkingLevels)) } } : {},
|
|
17334
17230
|
...customization?.metadata ? { metadata: customization.metadata } : {}
|
|
17335
17231
|
};
|
|
17336
17232
|
return { client, requestParams, baseURL };
|
|
@@ -17361,14 +17257,14 @@ var AnthropicStream = class {
|
|
|
17361
17257
|
// RFC-232(终局修正):跨 wire 协议救回"模型把工具调用写成字面文本 XML"违约响应
|
|
17362
17258
|
// (见 stream-state.ts recoverLiteralInvokeToolCalls 头注释)。判据内部短路,
|
|
17363
17259
|
// 无违约态时零开销(引用相等,不构造新对象)。
|
|
17364
|
-
message:
|
|
17260
|
+
message: M2(doneMessage, le2(context.tools)),
|
|
17365
17261
|
providerUsage
|
|
17366
17262
|
};
|
|
17367
17263
|
} catch (error) {
|
|
17368
17264
|
if (error instanceof Anthropic.APIError) {
|
|
17369
17265
|
yield {
|
|
17370
17266
|
type: "error",
|
|
17371
|
-
error: new
|
|
17267
|
+
error: new we(`Anthropic API error ${error.status}: ${error.message}`, {
|
|
17372
17268
|
code: "PROVIDER_API_ERROR",
|
|
17373
17269
|
cause: error,
|
|
17374
17270
|
// 把 SDK 的 HTTP status/headers 转成 ProviderError 的 typed 字段
|
|
@@ -17386,7 +17282,7 @@ var AnthropicStream = class {
|
|
|
17386
17282
|
} else {
|
|
17387
17283
|
yield {
|
|
17388
17284
|
type: "error",
|
|
17389
|
-
error: new
|
|
17285
|
+
error: new we("Unknown Anthropic stream error", {
|
|
17390
17286
|
code: "PROVIDER_STREAM_ERROR"
|
|
17391
17287
|
})
|
|
17392
17288
|
};
|
|
@@ -17409,11 +17305,6 @@ function createAnthropicProvider(options = {}) {
|
|
|
17409
17305
|
|
|
17410
17306
|
// ../../extensions/plugin-otto-wire-protocols/src/openai-responses.ts
|
|
17411
17307
|
var import_node_crypto2 = require("node:crypto");
|
|
17412
|
-
var noopLogger3 = { debug: () => {
|
|
17413
|
-
}, info: () => {
|
|
17414
|
-
}, warn: () => {
|
|
17415
|
-
}, error: () => {
|
|
17416
|
-
} };
|
|
17417
17308
|
function toReasoningEffort(level) {
|
|
17418
17309
|
switch (level) {
|
|
17419
17310
|
case "low":
|
|
@@ -17430,22 +17321,22 @@ function toReasoningEffort(level) {
|
|
|
17430
17321
|
}
|
|
17431
17322
|
function buildResponsesInput(context) {
|
|
17432
17323
|
const input = [];
|
|
17433
|
-
for (const msg of
|
|
17324
|
+
for (const msg of b2(context.messages)) {
|
|
17434
17325
|
if (msg.role === "user") {
|
|
17435
17326
|
if (typeof msg.content === "string") {
|
|
17436
17327
|
input.push({
|
|
17437
17328
|
role: "user",
|
|
17438
|
-
content: [{ type: "input_text", text:
|
|
17329
|
+
content: [{ type: "input_text", text: w3(msg.content) }]
|
|
17439
17330
|
});
|
|
17440
17331
|
} else {
|
|
17441
17332
|
input.push({
|
|
17442
17333
|
role: "user",
|
|
17443
17334
|
content: msg.content.map((part) => {
|
|
17444
17335
|
if (part.type === "text") {
|
|
17445
|
-
return { type: "input_text", text:
|
|
17336
|
+
return { type: "input_text", text: w3(part.text) };
|
|
17446
17337
|
}
|
|
17447
17338
|
if (part.type === "image") {
|
|
17448
|
-
const { base64, mediaType, valid } =
|
|
17339
|
+
const { base64, mediaType, valid } = t3(part.source, part.mime);
|
|
17449
17340
|
if (!valid) {
|
|
17450
17341
|
return { type: "input_text", text: "[image omitted: corrupted or empty data]" };
|
|
17451
17342
|
}
|
|
@@ -17459,20 +17350,20 @@ function buildResponsesInput(context) {
|
|
|
17459
17350
|
});
|
|
17460
17351
|
}
|
|
17461
17352
|
} else if (msg.role === "assistant") {
|
|
17462
|
-
const textParts = msg.content.filter((
|
|
17353
|
+
const textParts = msg.content.filter((c3) => c3.type === "text").filter((c3) => c3.text.trim().length > 0).map((c3) => w3(c3.text)).join("");
|
|
17463
17354
|
if (textParts) {
|
|
17464
17355
|
input.push({
|
|
17465
17356
|
role: "assistant",
|
|
17466
17357
|
content: [{ type: "output_text", text: textParts }]
|
|
17467
17358
|
});
|
|
17468
17359
|
}
|
|
17469
|
-
for (const
|
|
17470
|
-
if (
|
|
17360
|
+
for (const c3 of msg.content) {
|
|
17361
|
+
if (c3.type === "tool_call") {
|
|
17471
17362
|
input.push({
|
|
17472
17363
|
type: "function_call",
|
|
17473
|
-
call_id:
|
|
17474
|
-
name:
|
|
17475
|
-
arguments: JSON.stringify(
|
|
17364
|
+
call_id: c3.id,
|
|
17365
|
+
name: c3.name,
|
|
17366
|
+
arguments: JSON.stringify(c3.arguments)
|
|
17476
17367
|
});
|
|
17477
17368
|
}
|
|
17478
17369
|
}
|
|
@@ -17480,15 +17371,15 @@ function buildResponsesInput(context) {
|
|
|
17480
17371
|
input.push({
|
|
17481
17372
|
type: "function_call_output",
|
|
17482
17373
|
call_id: msg.toolCallId,
|
|
17483
|
-
output:
|
|
17484
|
-
msg.content.map((
|
|
17374
|
+
output: w3(
|
|
17375
|
+
msg.content.map((c3) => c3.type === "text" ? c3.text : "").join("")
|
|
17485
17376
|
)
|
|
17486
17377
|
});
|
|
17487
17378
|
} else if (msg.role === "system_notification") {
|
|
17488
17379
|
input.push({
|
|
17489
17380
|
role: "user",
|
|
17490
17381
|
content: [
|
|
17491
|
-
{ type: "input_text", text:
|
|
17382
|
+
{ type: "input_text", text: w3(S2(msg.content)) }
|
|
17492
17383
|
]
|
|
17493
17384
|
});
|
|
17494
17385
|
}
|
|
@@ -17510,20 +17401,20 @@ function buildResponsesBody(model, context) {
|
|
|
17510
17401
|
body.max_output_tokens = context.maxTokens ?? model.maxOutputTokens;
|
|
17511
17402
|
}
|
|
17512
17403
|
if (context.systemPrompt) {
|
|
17513
|
-
body.instructions =
|
|
17404
|
+
body.instructions = w3(context.systemPrompt);
|
|
17514
17405
|
}
|
|
17515
17406
|
if (context.temperature !== void 0 && !model.reasoning) {
|
|
17516
17407
|
body.temperature = context.temperature;
|
|
17517
17408
|
}
|
|
17518
17409
|
if (model.reasoning && context.thinkingLevel) {
|
|
17519
|
-
body.reasoning = { effort: toReasoningEffort(
|
|
17410
|
+
body.reasoning = { effort: toReasoningEffort(D2(context.thinkingLevel, model.thinkingLevels)) };
|
|
17520
17411
|
}
|
|
17521
17412
|
if (context.tools && context.tools.length > 0) {
|
|
17522
17413
|
body.tools = context.tools.map((tool) => ({
|
|
17523
17414
|
type: "function",
|
|
17524
17415
|
name: tool.name,
|
|
17525
17416
|
description: tool.description,
|
|
17526
|
-
parameters:
|
|
17417
|
+
parameters: T2(tool.parameters)
|
|
17527
17418
|
}));
|
|
17528
17419
|
}
|
|
17529
17420
|
return body;
|
|
@@ -17538,16 +17429,16 @@ function ensureBlock(blocks, index, kind) {
|
|
|
17538
17429
|
}
|
|
17539
17430
|
function initStreamState2(model) {
|
|
17540
17431
|
return {
|
|
17541
|
-
...
|
|
17432
|
+
...k3(),
|
|
17542
17433
|
model,
|
|
17543
17434
|
blocks: /* @__PURE__ */ new Map(),
|
|
17544
17435
|
stopReason: "end_turn"
|
|
17545
17436
|
};
|
|
17546
17437
|
}
|
|
17547
17438
|
function buildAssistantMessage2(state, final = false) {
|
|
17548
|
-
return
|
|
17439
|
+
return L3(
|
|
17549
17440
|
{ api: state.model.api, provider: state.model.provider, model: state.model.id },
|
|
17550
|
-
|
|
17441
|
+
fe2(state.blocks, final),
|
|
17551
17442
|
state,
|
|
17552
17443
|
state.stopReason
|
|
17553
17444
|
);
|
|
@@ -17635,7 +17526,7 @@ function dispatchResponsesSSEEvent(type, data, state) {
|
|
|
17635
17526
|
return {
|
|
17636
17527
|
events: [{
|
|
17637
17528
|
type: "error",
|
|
17638
|
-
error: new
|
|
17529
|
+
error: new we(`OpenAI Responses API error: ${message}`, {
|
|
17639
17530
|
code: "PROVIDER_API_ERROR",
|
|
17640
17531
|
errorType
|
|
17641
17532
|
})
|
|
@@ -17648,7 +17539,7 @@ function dispatchResponsesSSEEvent(type, data, state) {
|
|
|
17648
17539
|
}
|
|
17649
17540
|
}
|
|
17650
17541
|
var OpenAIResponsesStream = class {
|
|
17651
|
-
constructor(resolveCredential, baseUrlResolver, tokenDerivedHeaders, staticHeaders, logger =
|
|
17542
|
+
constructor(resolveCredential, baseUrlResolver, tokenDerivedHeaders, staticHeaders, logger = _2, customizeRequest, allowAuthHeaderOverride) {
|
|
17652
17543
|
this.resolveCredential = resolveCredential;
|
|
17653
17544
|
this.baseUrlResolver = baseUrlResolver;
|
|
17654
17545
|
this.tokenDerivedHeaders = tokenDerivedHeaders;
|
|
@@ -17683,22 +17574,12 @@ var OpenAIResponsesStream = class {
|
|
|
17683
17574
|
if (envKey) {
|
|
17684
17575
|
return { token: envKey, mode: "api_key" };
|
|
17685
17576
|
}
|
|
17686
|
-
throw new
|
|
17577
|
+
throw new we("Missing OpenAI credential. Set OPENAI_API_KEY or login via OAuth.", {
|
|
17687
17578
|
code: "PROVIDER_AUTH_MISSING"
|
|
17688
17579
|
});
|
|
17689
17580
|
}
|
|
17690
17581
|
async resolveBaseUrl(model) {
|
|
17691
|
-
|
|
17692
|
-
if (envUrl) {
|
|
17693
|
-
return envUrl;
|
|
17694
|
-
}
|
|
17695
|
-
if (this.baseUrlResolver) {
|
|
17696
|
-
const url = await this.baseUrlResolver();
|
|
17697
|
-
if (url) {
|
|
17698
|
-
return url;
|
|
17699
|
-
}
|
|
17700
|
-
}
|
|
17701
|
-
return model.baseUrl;
|
|
17582
|
+
return v2("OPENAI_BASE_URL", this.baseUrlResolver, model.baseUrl);
|
|
17702
17583
|
}
|
|
17703
17584
|
/**
|
|
17704
17585
|
* RFC-270 D1:头组装收敛到 @x-otto/provider 的统一管线(此前本方法自行合并,且注释声称
|
|
@@ -17710,7 +17591,7 @@ var OpenAIResponsesStream = class {
|
|
|
17710
17591
|
auth: { mode: auth.mode, beta: auth.beta },
|
|
17711
17592
|
sessionId: this.requestSessionId
|
|
17712
17593
|
});
|
|
17713
|
-
return
|
|
17594
|
+
return ye({
|
|
17714
17595
|
staticHeaders: this.staticHeaders,
|
|
17715
17596
|
tokenDerived: this.tokenDerivedHeaders?.length ? { headers: this.tokenDerivedHeaders, token: auth.token } : void 0,
|
|
17716
17597
|
customized: customization?.defaultHeaders,
|
|
@@ -17730,7 +17611,7 @@ var OpenAIResponsesStream = class {
|
|
|
17730
17611
|
let started = false;
|
|
17731
17612
|
try {
|
|
17732
17613
|
let responseHeaders;
|
|
17733
|
-
const sse =
|
|
17614
|
+
const sse = xt({
|
|
17734
17615
|
url,
|
|
17735
17616
|
body,
|
|
17736
17617
|
headers: this.buildHeaders(auth, model.provider),
|
|
@@ -17739,8 +17620,8 @@ var OpenAIResponsesStream = class {
|
|
|
17739
17620
|
// 使分段计时成为死代码。`stream()` 会按 `max(requested, firstTokenIdle + 余量)`
|
|
17740
17621
|
// 统一解析,保证墙钟总是大于首字节阈值。o3/o1 等 reasoning 模型的长思考同样受益。
|
|
17741
17622
|
timeout: options.timeout,
|
|
17742
|
-
onResponse: (
|
|
17743
|
-
responseHeaders =
|
|
17623
|
+
onResponse: (h) => {
|
|
17624
|
+
responseHeaders = h;
|
|
17744
17625
|
}
|
|
17745
17626
|
});
|
|
17746
17627
|
for await (const ev of sse) {
|
|
@@ -17763,13 +17644,13 @@ var OpenAIResponsesStream = class {
|
|
|
17763
17644
|
yield* result.events;
|
|
17764
17645
|
if (result.fatal) return;
|
|
17765
17646
|
}
|
|
17766
|
-
const orderedTools = [...state.blocks.entries()].sort(([
|
|
17647
|
+
const orderedTools = [...state.blocks.entries()].sort(([a3], [b3]) => a3 - b3);
|
|
17767
17648
|
for (const [index, block] of orderedTools) {
|
|
17768
17649
|
if (block.kind === "tool_call") {
|
|
17769
17650
|
yield {
|
|
17770
17651
|
type: "tool_call_end",
|
|
17771
17652
|
index,
|
|
17772
|
-
toolCall:
|
|
17653
|
+
toolCall: j2(block.id, block.name, block.argumentsJson),
|
|
17773
17654
|
partial: buildAssistantMessage2(state)
|
|
17774
17655
|
};
|
|
17775
17656
|
} else if (block.kind === "text") {
|
|
@@ -17787,8 +17668,8 @@ var OpenAIResponsesStream = class {
|
|
|
17787
17668
|
type: "done",
|
|
17788
17669
|
reason: state.stopReason,
|
|
17789
17670
|
// RFC-232(终局修正):跨 wire 协议救回违约响应,见 @x-otto/provider stream-state.ts。
|
|
17790
|
-
message:
|
|
17791
|
-
providerUsage:
|
|
17671
|
+
message: M2(buildAssistantMessage2(state, true), le2(context.tools)),
|
|
17672
|
+
providerUsage: oe2(responseHeaders)
|
|
17792
17673
|
};
|
|
17793
17674
|
} catch (error) {
|
|
17794
17675
|
if (error instanceof Error) {
|
|
@@ -17796,7 +17677,7 @@ var OpenAIResponsesStream = class {
|
|
|
17796
17677
|
} else {
|
|
17797
17678
|
yield {
|
|
17798
17679
|
type: "error",
|
|
17799
|
-
error: new
|
|
17680
|
+
error: new we("Unknown OpenAI Responses stream error", {
|
|
17800
17681
|
code: "PROVIDER_STREAM_ERROR"
|
|
17801
17682
|
})
|
|
17802
17683
|
};
|
|
@@ -17818,13 +17699,8 @@ function createOpenAIResponsesProvider(options = {}) {
|
|
|
17818
17699
|
|
|
17819
17700
|
// ../../extensions/plugin-otto-wire-protocols/src/openai-completions.ts
|
|
17820
17701
|
var import_node_crypto3 = require("node:crypto");
|
|
17821
|
-
var noopLogger4 = { debug: () => {
|
|
17822
|
-
}, info: () => {
|
|
17823
|
-
}, warn: () => {
|
|
17824
|
-
}, error: () => {
|
|
17825
|
-
} };
|
|
17826
17702
|
var OpenAICompletionsStream = class {
|
|
17827
|
-
constructor(resolveCredential, extraHeaders, tokenDerivedHeaders, logger =
|
|
17703
|
+
constructor(resolveCredential, extraHeaders, tokenDerivedHeaders, logger = _2, customizeRequest, allowAuthHeaderOverride) {
|
|
17828
17704
|
this.resolveCredential = resolveCredential;
|
|
17829
17705
|
this.extraHeaders = extraHeaders;
|
|
17830
17706
|
this.tokenDerivedHeaders = tokenDerivedHeaders;
|
|
@@ -17853,7 +17729,7 @@ var OpenAICompletionsStream = class {
|
|
|
17853
17729
|
return { token: key, mode: "api_key" };
|
|
17854
17730
|
}
|
|
17855
17731
|
}
|
|
17856
|
-
throw new
|
|
17732
|
+
throw new we(
|
|
17857
17733
|
`Missing credential for provider '${model.provider}' (openai-completions).`,
|
|
17858
17734
|
{ code: "PROVIDER_AUTH_MISSING" }
|
|
17859
17735
|
);
|
|
@@ -17866,7 +17742,7 @@ var OpenAICompletionsStream = class {
|
|
|
17866
17742
|
auth: { mode: auth.mode, beta: auth.beta },
|
|
17867
17743
|
sessionId: this.requestSessionId
|
|
17868
17744
|
});
|
|
17869
|
-
const headers =
|
|
17745
|
+
const headers = ye({
|
|
17870
17746
|
staticHeaders: this.extraHeaders,
|
|
17871
17747
|
tokenDerived: this.tokenDerivedHeaders?.length ? { headers: this.tokenDerivedHeaders, token: key } : void 0,
|
|
17872
17748
|
customized: customization?.defaultHeaders,
|
|
@@ -17875,8 +17751,12 @@ var OpenAICompletionsStream = class {
|
|
|
17875
17751
|
logger: this.logger,
|
|
17876
17752
|
diagnosticLabel: `openai-completions:${model.provider}`
|
|
17877
17753
|
});
|
|
17878
|
-
yield*
|
|
17879
|
-
url: `${
|
|
17754
|
+
yield* me({
|
|
17755
|
+
url: `${await v2(
|
|
17756
|
+
model.provider === "deepseek" ? "DEEPSEEK_BASE_URL" : "OPENAI_BASE_URL",
|
|
17757
|
+
void 0,
|
|
17758
|
+
model.baseUrl
|
|
17759
|
+
)}/chat/completions`,
|
|
17880
17760
|
headers,
|
|
17881
17761
|
body: re(model, context),
|
|
17882
17762
|
identity: { api: model.api, provider: model.provider, model: model.id },
|
|
@@ -17895,7 +17775,7 @@ var OpenAICompletionsStream = class {
|
|
|
17895
17775
|
// 区分——分段判据比"模型是否声明 reasoning"更准(同一个 reasoning 模型的不同 turn,
|
|
17896
17776
|
// 思考时长差异极大,用模型属性预测本就是弱相关变量)。
|
|
17897
17777
|
// RFC-232(终局修正):跨 wire 协议救回违约响应,见 @x-otto/provider stream-state.ts。
|
|
17898
|
-
registeredToolNames:
|
|
17778
|
+
registeredToolNames: le2(context.tools)
|
|
17899
17779
|
});
|
|
17900
17780
|
}
|
|
17901
17781
|
};
|
|
@@ -17913,7 +17793,7 @@ function createOpenAICompletionsProvider(options = {}) {
|
|
|
17913
17793
|
// ../../extensions/plugin-otto-wire-protocols/plugin.ts
|
|
17914
17794
|
function adaptToOpenAICompletions(input) {
|
|
17915
17795
|
return createOpenAICompletionsProvider({
|
|
17916
|
-
resolveKey: () => input.resolveAuth().then((
|
|
17796
|
+
resolveKey: () => input.resolveAuth().then((a3) => a3?.token),
|
|
17917
17797
|
headers: input.headers,
|
|
17918
17798
|
tokenDerivedHeaders: input.tokenDerivedHeaders,
|
|
17919
17799
|
logger: input.logger,
|
|
@@ -17924,7 +17804,7 @@ function adaptToOpenAICompletions(input) {
|
|
|
17924
17804
|
}
|
|
17925
17805
|
function adaptToOpenAIResponses(input) {
|
|
17926
17806
|
return createOpenAIResponsesProvider({
|
|
17927
|
-
resolveKey: () => input.resolveAuth().then((
|
|
17807
|
+
resolveKey: () => input.resolveAuth().then((a3) => a3?.token),
|
|
17928
17808
|
resolveBaseUrl: input.resolveBaseUrl,
|
|
17929
17809
|
tokenDerivedHeaders: input.tokenDerivedHeaders,
|
|
17930
17810
|
headers: input.headers,
|