linkque-cli-v2 1.6.2 → 1.6.4
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/dev/worker.js +16 -3
- package/linkquejs.js +1030 -644
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/anthropic-messages-GSYNBLMR.js +17 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{azure-openai-responses-HVAVRLTK.js → azure-openai-responses-NPKMM3LF.js} +7 -9
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-2HV35GH7.js → chunk-CO4I3RJE.js} +15 -2
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-Q2Y6LMNC.js → chunk-J4JCPZDI.js} +5 -7
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-4XAZNSEQ.js → chunk-JMBJJF7P.js} +18 -5
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{anthropic-messages-5DOLTIGP.js → chunk-KDHBKVSL.js} +14 -15
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-SDEXPSW4.js → chunk-UZS5YLV2.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-2CFN5G5A.js → chunk-VBERH5QM.js} +419 -73
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-Y3G4J3TB.js → chunk-XOLFZ4XS.js} +316 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{dist-ZPLSQEAM.js → dist-TGBYXSBU.js} +27 -42
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-generative-ai-OLT56CSV.js → google-generative-ai-KD7MXONK.js} +8 -10
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-vertex-4DBBJ7SR.js → google-vertex-TREYA472.js} +9 -11
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{mistral-conversations-OEBGEDLQ.js → mistral-conversations-OEOTQWE5.js} +7 -9
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-codex-responses-3KOC6KHN.js → openai-codex-responses-GEFKSNVN.js} +10 -12
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-completions-HG6OJRL5.js → openai-completions-TAACO6T5.js} +13 -15
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-responses-F6V2PG3Y.js → openai-responses-4DDTXIGI.js} +12 -14
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +197 -61
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +2 -2
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +2 -2
- package/worker.js +387 -106
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-RYONFGPP.js +0 -317
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{pi-messages-DC4DVRAJ.js → pi-messages-7JN3W3BC.js} +4 -4
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-Y3G4J3TB.js → chunk-XOLFZ4XS.js}
RENAMED
|
@@ -599,11 +599,326 @@ function clampThinkingLevel(model, level) {
|
|
|
599
599
|
return availableLevels[0] ?? "off";
|
|
600
600
|
}
|
|
601
601
|
|
|
602
|
+
// ../../node_modules/@earendil-works/pi-ai/dist/utils/estimate.js
|
|
603
|
+
var CHARS_PER_TOKEN = 4;
|
|
604
|
+
var ESTIMATED_IMAGE_CHARS = 4800;
|
|
605
|
+
function calculateContextTokens(usage) {
|
|
606
|
+
return usage.totalTokens || usage.input + usage.output + usage.cacheRead + usage.cacheWrite;
|
|
607
|
+
}
|
|
608
|
+
function safeJsonStringify(value) {
|
|
609
|
+
try {
|
|
610
|
+
return JSON.stringify(value) ?? "undefined";
|
|
611
|
+
} catch {
|
|
612
|
+
return "[unserializable]";
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
function estimateTextAndImageContentChars(content) {
|
|
616
|
+
if (typeof content === "string")
|
|
617
|
+
return content.length;
|
|
618
|
+
let chars = 0;
|
|
619
|
+
for (const block of content)
|
|
620
|
+
chars += block.type === "text" ? block.text.length : ESTIMATED_IMAGE_CHARS;
|
|
621
|
+
return chars;
|
|
622
|
+
}
|
|
623
|
+
function estimateTextTokens(text) {
|
|
624
|
+
return Math.ceil(text.length / CHARS_PER_TOKEN);
|
|
625
|
+
}
|
|
626
|
+
function estimateTextAndImageContentTokens(content) {
|
|
627
|
+
return Math.ceil(estimateTextAndImageContentChars(content) / CHARS_PER_TOKEN);
|
|
628
|
+
}
|
|
629
|
+
function estimateMessageTokens(message) {
|
|
630
|
+
let chars = 0;
|
|
631
|
+
if (message.role === "user")
|
|
632
|
+
return estimateTextAndImageContentTokens(message.content);
|
|
633
|
+
if (message.role === "toolResult")
|
|
634
|
+
return estimateTextAndImageContentTokens(message.content);
|
|
635
|
+
for (const block of message.content) {
|
|
636
|
+
if (block.type === "text") {
|
|
637
|
+
chars += block.text.length;
|
|
638
|
+
} else if (block.type === "thinking") {
|
|
639
|
+
chars += block.thinking.length;
|
|
640
|
+
} else {
|
|
641
|
+
chars += block.name.length + safeJsonStringify(block.arguments).length;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return Math.ceil(chars / CHARS_PER_TOKEN);
|
|
645
|
+
}
|
|
646
|
+
function getLastAssistantUsageInfo(messages) {
|
|
647
|
+
let latestPrefixTimestamp = Number.NEGATIVE_INFINITY;
|
|
648
|
+
let usageInfo;
|
|
649
|
+
for (let i = 0; i < messages.length; i++) {
|
|
650
|
+
const message = messages[i];
|
|
651
|
+
if (message.role === "assistant") {
|
|
652
|
+
const assistant = message;
|
|
653
|
+
const usageAppliesToPrefix = assistant.timestamp >= latestPrefixTimestamp;
|
|
654
|
+
if (usageAppliesToPrefix && assistant.stopReason !== "aborted" && assistant.stopReason !== "error" && calculateContextTokens(assistant.usage) > 0) {
|
|
655
|
+
usageInfo = { usage: assistant.usage, index: i };
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
latestPrefixTimestamp = Math.max(latestPrefixTimestamp, message.timestamp);
|
|
659
|
+
}
|
|
660
|
+
return usageInfo;
|
|
661
|
+
}
|
|
662
|
+
function estimateMessages(messages) {
|
|
663
|
+
const usageInfo = getLastAssistantUsageInfo(messages);
|
|
664
|
+
if (usageInfo) {
|
|
665
|
+
const usageTokens = calculateContextTokens(usageInfo.usage);
|
|
666
|
+
let trailingTokens = 0;
|
|
667
|
+
for (let i = usageInfo.index + 1; i < messages.length; i++) {
|
|
668
|
+
trailingTokens += estimateMessageTokens(messages[i]);
|
|
669
|
+
}
|
|
670
|
+
return { tokens: usageTokens + trailingTokens, usageTokens, trailingTokens, lastUsageIndex: usageInfo.index };
|
|
671
|
+
}
|
|
672
|
+
let tokens = 0;
|
|
673
|
+
for (const message of messages)
|
|
674
|
+
tokens += estimateMessageTokens(message);
|
|
675
|
+
return { tokens, usageTokens: 0, trailingTokens: tokens, lastUsageIndex: null };
|
|
676
|
+
}
|
|
677
|
+
function estimateToolsTokens(tools) {
|
|
678
|
+
if (!tools || tools.length === 0)
|
|
679
|
+
return 0;
|
|
680
|
+
return estimateTextTokens(safeJsonStringify(tools));
|
|
681
|
+
}
|
|
682
|
+
function isMessageArray(value) {
|
|
683
|
+
return Array.isArray(value);
|
|
684
|
+
}
|
|
685
|
+
function estimateContextTokens(context) {
|
|
686
|
+
if (isMessageArray(context))
|
|
687
|
+
return estimateMessages(context);
|
|
688
|
+
const estimate = estimateMessages(context.messages);
|
|
689
|
+
if (estimate.lastUsageIndex !== null) {
|
|
690
|
+
const addedNames = new Set(context.messages.slice(estimate.lastUsageIndex + 1).filter((message) => message.role === "toolResult").flatMap((message) => message.addedToolNames ?? []));
|
|
691
|
+
const addedToolTokens = estimateToolsTokens(context.tools?.filter((tool) => addedNames.has(tool.name)));
|
|
692
|
+
return {
|
|
693
|
+
tokens: estimate.tokens + addedToolTokens,
|
|
694
|
+
usageTokens: estimate.usageTokens,
|
|
695
|
+
trailingTokens: estimate.trailingTokens + addedToolTokens,
|
|
696
|
+
lastUsageIndex: estimate.lastUsageIndex
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
const prefixTokens = (context.systemPrompt ? estimateTextTokens(context.systemPrompt) : 0) + estimateToolsTokens(context.tools);
|
|
700
|
+
return {
|
|
701
|
+
tokens: estimate.tokens + prefixTokens,
|
|
702
|
+
usageTokens: estimate.usageTokens,
|
|
703
|
+
trailingTokens: estimate.trailingTokens + prefixTokens,
|
|
704
|
+
lastUsageIndex: estimate.lastUsageIndex
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// ../../node_modules/@earendil-works/pi-ai/dist/api/simple-options.js
|
|
709
|
+
var CONTEXT_SAFETY_TOKENS = 4096;
|
|
710
|
+
var MIN_MAX_TOKENS = 1;
|
|
711
|
+
function clampMaxTokensToContext(model, context, maxTokens) {
|
|
712
|
+
if (model.contextWindow <= 0)
|
|
713
|
+
return Math.max(MIN_MAX_TOKENS, maxTokens);
|
|
714
|
+
const available = model.contextWindow - estimateContextTokens(context).tokens - CONTEXT_SAFETY_TOKENS;
|
|
715
|
+
return Math.min(maxTokens, Math.max(MIN_MAX_TOKENS, available));
|
|
716
|
+
}
|
|
717
|
+
function buildBaseOptions(model, context, options, apiKey) {
|
|
718
|
+
return {
|
|
719
|
+
temperature: options?.temperature,
|
|
720
|
+
maxTokens: clampMaxTokensToContext(model, context, options?.maxTokens ?? model.maxTokens),
|
|
721
|
+
signal: options?.signal,
|
|
722
|
+
apiKey: apiKey || options?.apiKey,
|
|
723
|
+
transport: options?.transport,
|
|
724
|
+
cacheRetention: options?.cacheRetention,
|
|
725
|
+
sessionId: options?.sessionId,
|
|
726
|
+
headers: options?.headers,
|
|
727
|
+
onPayload: options?.onPayload,
|
|
728
|
+
onResponse: options?.onResponse,
|
|
729
|
+
timeoutMs: options?.timeoutMs,
|
|
730
|
+
websocketConnectTimeoutMs: options?.websocketConnectTimeoutMs,
|
|
731
|
+
maxRetries: options?.maxRetries,
|
|
732
|
+
maxRetryDelayMs: options?.maxRetryDelayMs,
|
|
733
|
+
metadata: options?.metadata,
|
|
734
|
+
env: options?.env
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
function clampReasoning(effort) {
|
|
738
|
+
return effort === "xhigh" || effort === "max" ? "high" : effort;
|
|
739
|
+
}
|
|
740
|
+
function adjustMaxTokensForThinking(baseMaxTokens, modelMaxTokens, reasoningLevel, customBudgets) {
|
|
741
|
+
const defaultBudgets = {
|
|
742
|
+
minimal: 1024,
|
|
743
|
+
low: 2048,
|
|
744
|
+
medium: 8192,
|
|
745
|
+
high: 16384
|
|
746
|
+
};
|
|
747
|
+
const budgets = { ...defaultBudgets, ...customBudgets };
|
|
748
|
+
const minOutputTokens = 1024;
|
|
749
|
+
const level = clampReasoning(reasoningLevel);
|
|
750
|
+
let thinkingBudget = budgets[level];
|
|
751
|
+
const maxTokens = baseMaxTokens === void 0 ? modelMaxTokens : Math.min(baseMaxTokens + thinkingBudget, modelMaxTokens);
|
|
752
|
+
if (maxTokens <= thinkingBudget) {
|
|
753
|
+
thinkingBudget = Math.max(0, maxTokens - minOutputTokens);
|
|
754
|
+
}
|
|
755
|
+
return { maxTokens, thinkingBudget };
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// ../../node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js
|
|
759
|
+
var NON_VISION_USER_IMAGE_PLACEHOLDER = "(image omitted: model does not support images)";
|
|
760
|
+
var NON_VISION_TOOL_IMAGE_PLACEHOLDER = "(tool image omitted: model does not support images)";
|
|
761
|
+
function replaceImagesWithPlaceholder(content, placeholder) {
|
|
762
|
+
const result = [];
|
|
763
|
+
let previousWasPlaceholder = false;
|
|
764
|
+
for (const block of content) {
|
|
765
|
+
if (block.type === "image") {
|
|
766
|
+
if (!previousWasPlaceholder) {
|
|
767
|
+
result.push({ type: "text", text: placeholder });
|
|
768
|
+
}
|
|
769
|
+
previousWasPlaceholder = true;
|
|
770
|
+
continue;
|
|
771
|
+
}
|
|
772
|
+
result.push(block);
|
|
773
|
+
previousWasPlaceholder = block.text === placeholder;
|
|
774
|
+
}
|
|
775
|
+
return result;
|
|
776
|
+
}
|
|
777
|
+
function downgradeUnsupportedImages(messages, model) {
|
|
778
|
+
if (model.input.includes("image")) {
|
|
779
|
+
return messages;
|
|
780
|
+
}
|
|
781
|
+
return messages.map((msg) => {
|
|
782
|
+
if (msg.role === "user" && Array.isArray(msg.content)) {
|
|
783
|
+
return {
|
|
784
|
+
...msg,
|
|
785
|
+
content: replaceImagesWithPlaceholder(msg.content, NON_VISION_USER_IMAGE_PLACEHOLDER)
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
if (msg.role === "toolResult") {
|
|
789
|
+
return {
|
|
790
|
+
...msg,
|
|
791
|
+
content: replaceImagesWithPlaceholder(msg.content, NON_VISION_TOOL_IMAGE_PLACEHOLDER)
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
return msg;
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
function transformMessages(messages, model, normalizeToolCallId) {
|
|
798
|
+
const toolCallIdMap = /* @__PURE__ */ new Map();
|
|
799
|
+
const normalizedMessages = messages.map((msg) => msg.content == null ? { ...msg, content: [] } : msg);
|
|
800
|
+
const imageAwareMessages = downgradeUnsupportedImages(normalizedMessages, model);
|
|
801
|
+
const transformed = imageAwareMessages.map((msg) => {
|
|
802
|
+
if (msg.role === "user") {
|
|
803
|
+
return msg;
|
|
804
|
+
}
|
|
805
|
+
if (msg.role === "toolResult") {
|
|
806
|
+
const normalizedId = toolCallIdMap.get(msg.toolCallId);
|
|
807
|
+
if (normalizedId && normalizedId !== msg.toolCallId) {
|
|
808
|
+
return { ...msg, toolCallId: normalizedId };
|
|
809
|
+
}
|
|
810
|
+
return msg;
|
|
811
|
+
}
|
|
812
|
+
if (msg.role === "assistant") {
|
|
813
|
+
const assistantMsg = msg;
|
|
814
|
+
const isSameModel = assistantMsg.provider === model.provider && assistantMsg.api === model.api && assistantMsg.model === model.id;
|
|
815
|
+
const transformedContent = assistantMsg.content.flatMap((block) => {
|
|
816
|
+
if (block.type === "thinking") {
|
|
817
|
+
if (block.redacted) {
|
|
818
|
+
return isSameModel ? block : [];
|
|
819
|
+
}
|
|
820
|
+
if (isSameModel && block.thinkingSignature)
|
|
821
|
+
return block;
|
|
822
|
+
if (!block.thinking || block.thinking.trim() === "")
|
|
823
|
+
return [];
|
|
824
|
+
if (isSameModel)
|
|
825
|
+
return block;
|
|
826
|
+
return {
|
|
827
|
+
type: "text",
|
|
828
|
+
text: block.thinking
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
if (block.type === "text") {
|
|
832
|
+
if (isSameModel)
|
|
833
|
+
return block;
|
|
834
|
+
return {
|
|
835
|
+
type: "text",
|
|
836
|
+
text: block.text
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
if (block.type === "toolCall") {
|
|
840
|
+
const toolCall = block;
|
|
841
|
+
let normalizedToolCall = toolCall;
|
|
842
|
+
if (!isSameModel && toolCall.thoughtSignature) {
|
|
843
|
+
normalizedToolCall = { ...toolCall };
|
|
844
|
+
delete normalizedToolCall.thoughtSignature;
|
|
845
|
+
}
|
|
846
|
+
if (!isSameModel && normalizeToolCallId) {
|
|
847
|
+
const normalizedId = normalizeToolCallId(toolCall.id, model, assistantMsg);
|
|
848
|
+
if (normalizedId !== toolCall.id) {
|
|
849
|
+
toolCallIdMap.set(toolCall.id, normalizedId);
|
|
850
|
+
normalizedToolCall = { ...normalizedToolCall, id: normalizedId };
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
return normalizedToolCall;
|
|
854
|
+
}
|
|
855
|
+
return block;
|
|
856
|
+
});
|
|
857
|
+
return {
|
|
858
|
+
...assistantMsg,
|
|
859
|
+
content: transformedContent
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
return msg;
|
|
863
|
+
});
|
|
864
|
+
const result = [];
|
|
865
|
+
let pendingToolCalls = [];
|
|
866
|
+
let existingToolResultIds = /* @__PURE__ */ new Set();
|
|
867
|
+
const insertSyntheticToolResults = () => {
|
|
868
|
+
if (pendingToolCalls.length > 0) {
|
|
869
|
+
for (const tc of pendingToolCalls) {
|
|
870
|
+
if (!existingToolResultIds.has(tc.id)) {
|
|
871
|
+
result.push({
|
|
872
|
+
role: "toolResult",
|
|
873
|
+
toolCallId: tc.id,
|
|
874
|
+
toolName: tc.name,
|
|
875
|
+
content: [{ type: "text", text: "No result provided" }],
|
|
876
|
+
isError: true,
|
|
877
|
+
timestamp: Date.now()
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
pendingToolCalls = [];
|
|
882
|
+
existingToolResultIds = /* @__PURE__ */ new Set();
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
for (let i = 0; i < transformed.length; i++) {
|
|
886
|
+
const msg = transformed[i];
|
|
887
|
+
if (msg.role === "assistant") {
|
|
888
|
+
insertSyntheticToolResults();
|
|
889
|
+
const assistantMsg = msg;
|
|
890
|
+
if (assistantMsg.stopReason === "error" || assistantMsg.stopReason === "aborted") {
|
|
891
|
+
continue;
|
|
892
|
+
}
|
|
893
|
+
const toolCalls = assistantMsg.content.filter((b) => b.type === "toolCall");
|
|
894
|
+
if (toolCalls.length > 0) {
|
|
895
|
+
pendingToolCalls = toolCalls;
|
|
896
|
+
existingToolResultIds = /* @__PURE__ */ new Set();
|
|
897
|
+
}
|
|
898
|
+
result.push(msg);
|
|
899
|
+
} else if (msg.role === "toolResult") {
|
|
900
|
+
existingToolResultIds.add(msg.toolCallId);
|
|
901
|
+
result.push(msg);
|
|
902
|
+
} else if (msg.role === "user") {
|
|
903
|
+
insertSyntheticToolResults();
|
|
904
|
+
result.push(msg);
|
|
905
|
+
} else {
|
|
906
|
+
result.push(msg);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
insertSyntheticToolResults();
|
|
910
|
+
return result;
|
|
911
|
+
}
|
|
912
|
+
|
|
602
913
|
export {
|
|
603
914
|
lazyStream,
|
|
604
915
|
lazyApi,
|
|
605
916
|
createModels,
|
|
606
917
|
createProvider,
|
|
607
918
|
calculateCost,
|
|
608
|
-
clampThinkingLevel
|
|
919
|
+
clampThinkingLevel,
|
|
920
|
+
clampMaxTokensToContext,
|
|
921
|
+
buildBaseOptions,
|
|
922
|
+
adjustMaxTokensForThinking,
|
|
923
|
+
transformMessages
|
|
609
924
|
};
|
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{dist-ZPLSQEAM.js → dist-TGBYXSBU.js}
RENAMED
|
@@ -222,64 +222,50 @@ var require_common = __commonJS({
|
|
|
222
222
|
createDebug.namespaces = namespaces;
|
|
223
223
|
createDebug.names = [];
|
|
224
224
|
createDebug.skips = [];
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
225
|
+
let i;
|
|
226
|
+
const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
|
|
227
|
+
const len = split.length;
|
|
228
|
+
for (i = 0; i < len; i++) {
|
|
229
|
+
if (!split[i]) {
|
|
230
|
+
continue;
|
|
231
231
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
let searchIndex = 0;
|
|
236
|
-
let templateIndex = 0;
|
|
237
|
-
let starIndex = -1;
|
|
238
|
-
let matchIndex = 0;
|
|
239
|
-
while (searchIndex < search.length) {
|
|
240
|
-
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
241
|
-
if (template[templateIndex] === "*") {
|
|
242
|
-
starIndex = templateIndex;
|
|
243
|
-
matchIndex = searchIndex;
|
|
244
|
-
templateIndex++;
|
|
245
|
-
} else {
|
|
246
|
-
searchIndex++;
|
|
247
|
-
templateIndex++;
|
|
248
|
-
}
|
|
249
|
-
} else if (starIndex !== -1) {
|
|
250
|
-
templateIndex = starIndex + 1;
|
|
251
|
-
matchIndex++;
|
|
252
|
-
searchIndex = matchIndex;
|
|
232
|
+
namespaces = split[i].replace(/\*/g, ".*?");
|
|
233
|
+
if (namespaces[0] === "-") {
|
|
234
|
+
createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
|
|
253
235
|
} else {
|
|
254
|
-
|
|
236
|
+
createDebug.names.push(new RegExp("^" + namespaces + "$"));
|
|
255
237
|
}
|
|
256
238
|
}
|
|
257
|
-
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
258
|
-
templateIndex++;
|
|
259
|
-
}
|
|
260
|
-
return templateIndex === template.length;
|
|
261
239
|
}
|
|
262
240
|
function disable() {
|
|
263
241
|
const namespaces = [
|
|
264
|
-
...createDebug.names,
|
|
265
|
-
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
242
|
+
...createDebug.names.map(toNamespace),
|
|
243
|
+
...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace)
|
|
266
244
|
].join(",");
|
|
267
245
|
createDebug.enable("");
|
|
268
246
|
return namespaces;
|
|
269
247
|
}
|
|
270
248
|
function enabled(name) {
|
|
271
|
-
|
|
272
|
-
|
|
249
|
+
if (name[name.length - 1] === "*") {
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
let i;
|
|
253
|
+
let len;
|
|
254
|
+
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
255
|
+
if (createDebug.skips[i].test(name)) {
|
|
273
256
|
return false;
|
|
274
257
|
}
|
|
275
258
|
}
|
|
276
|
-
for (
|
|
277
|
-
if (
|
|
259
|
+
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
|
260
|
+
if (createDebug.names[i].test(name)) {
|
|
278
261
|
return true;
|
|
279
262
|
}
|
|
280
263
|
}
|
|
281
264
|
return false;
|
|
282
265
|
}
|
|
266
|
+
function toNamespace(regexp) {
|
|
267
|
+
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
|
|
268
|
+
}
|
|
283
269
|
function coerce(val) {
|
|
284
270
|
if (val instanceof Error) {
|
|
285
271
|
return val.stack || val.message;
|
|
@@ -398,11 +384,10 @@ var require_browser = __commonJS({
|
|
|
398
384
|
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
399
385
|
return false;
|
|
400
386
|
}
|
|
401
|
-
let m;
|
|
402
387
|
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
403
388
|
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
404
389
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
405
|
-
typeof navigator !== "undefined" && navigator.userAgent &&
|
|
390
|
+
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
406
391
|
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
407
392
|
}
|
|
408
393
|
function formatArgs(args) {
|
|
@@ -440,7 +425,7 @@ var require_browser = __commonJS({
|
|
|
440
425
|
function load() {
|
|
441
426
|
let r;
|
|
442
427
|
try {
|
|
443
|
-
r = exports.storage.getItem("debug")
|
|
428
|
+
r = exports.storage.getItem("debug");
|
|
444
429
|
} catch (error) {
|
|
445
430
|
}
|
|
446
431
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
@@ -723,7 +708,7 @@ var require_node = __commonJS({
|
|
|
723
708
|
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
724
709
|
}
|
|
725
710
|
function log(...args) {
|
|
726
|
-
return process.stderr.write(util.
|
|
711
|
+
return process.stderr.write(util.format(...args) + "\n");
|
|
727
712
|
}
|
|
728
713
|
function save(namespaces) {
|
|
729
714
|
if (namespaces) {
|
|
@@ -6,27 +6,25 @@ import {
|
|
|
6
6
|
mapStopReason,
|
|
7
7
|
mapToolChoice,
|
|
8
8
|
retainThoughtSignature
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JMBJJF7P.js";
|
|
10
10
|
import {
|
|
11
11
|
formatProviderError,
|
|
12
12
|
normalizeProviderError
|
|
13
13
|
} from "./chunk-NKEOCGYU.js";
|
|
14
14
|
import {
|
|
15
|
-
buildBaseOptions
|
|
16
|
-
|
|
15
|
+
buildBaseOptions,
|
|
16
|
+
calculateCost,
|
|
17
|
+
clampThinkingLevel
|
|
18
|
+
} from "./chunk-XOLFZ4XS.js";
|
|
19
|
+
import {
|
|
20
|
+
AssistantMessageEventStream
|
|
21
|
+
} from "./chunk-46SEH6ER.js";
|
|
17
22
|
import {
|
|
18
23
|
sanitizeSurrogates
|
|
19
24
|
} from "./chunk-CT4G24PS.js";
|
|
20
25
|
import {
|
|
21
26
|
providerHeadersToRecord
|
|
22
27
|
} from "./chunk-Y6UTJIT4.js";
|
|
23
|
-
import {
|
|
24
|
-
calculateCost,
|
|
25
|
-
clampThinkingLevel
|
|
26
|
-
} from "./chunk-Y3G4J3TB.js";
|
|
27
|
-
import {
|
|
28
|
-
AssistantMessageEventStream
|
|
29
|
-
} from "./chunk-46SEH6ER.js";
|
|
30
28
|
import "./chunk-ETG6PNHQ.js";
|
|
31
29
|
import "./chunk-2ESYSVXG.js";
|
|
32
30
|
|
|
@@ -8,30 +8,28 @@ import {
|
|
|
8
8
|
mapStopReason,
|
|
9
9
|
mapToolChoice,
|
|
10
10
|
retainThoughtSignature
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-JMBJJF7P.js";
|
|
12
12
|
import {
|
|
13
13
|
formatProviderError,
|
|
14
14
|
normalizeProviderError
|
|
15
15
|
} from "./chunk-NKEOCGYU.js";
|
|
16
|
-
import {
|
|
17
|
-
buildBaseOptions
|
|
18
|
-
} from "./chunk-RYONFGPP.js";
|
|
19
|
-
import {
|
|
20
|
-
sanitizeSurrogates
|
|
21
|
-
} from "./chunk-CT4G24PS.js";
|
|
22
|
-
import {
|
|
23
|
-
providerHeadersToRecord
|
|
24
|
-
} from "./chunk-Y6UTJIT4.js";
|
|
25
16
|
import {
|
|
26
17
|
getProviderEnvValue
|
|
27
18
|
} from "./chunk-B5XRGKYX.js";
|
|
28
19
|
import {
|
|
20
|
+
buildBaseOptions,
|
|
29
21
|
calculateCost,
|
|
30
22
|
clampThinkingLevel
|
|
31
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-XOLFZ4XS.js";
|
|
32
24
|
import {
|
|
33
25
|
AssistantMessageEventStream
|
|
34
26
|
} from "./chunk-46SEH6ER.js";
|
|
27
|
+
import {
|
|
28
|
+
sanitizeSurrogates
|
|
29
|
+
} from "./chunk-CT4G24PS.js";
|
|
30
|
+
import {
|
|
31
|
+
providerHeadersToRecord
|
|
32
|
+
} from "./chunk-Y6UTJIT4.js";
|
|
35
33
|
import "./chunk-ETG6PNHQ.js";
|
|
36
34
|
import "./chunk-2ESYSVXG.js";
|
|
37
35
|
|
|
@@ -37,23 +37,21 @@ import {
|
|
|
37
37
|
import {
|
|
38
38
|
shortHash
|
|
39
39
|
} from "./chunk-UFVAKOTZ.js";
|
|
40
|
-
import {
|
|
41
|
-
buildBaseOptions,
|
|
42
|
-
transformMessages
|
|
43
|
-
} from "./chunk-RYONFGPP.js";
|
|
44
|
-
import {
|
|
45
|
-
sanitizeSurrogates
|
|
46
|
-
} from "./chunk-CT4G24PS.js";
|
|
47
40
|
import {
|
|
48
41
|
parseStreamingJson
|
|
49
42
|
} from "./chunk-WJHOHUET.js";
|
|
50
43
|
import {
|
|
44
|
+
buildBaseOptions,
|
|
51
45
|
calculateCost,
|
|
52
|
-
clampThinkingLevel
|
|
53
|
-
|
|
46
|
+
clampThinkingLevel,
|
|
47
|
+
transformMessages
|
|
48
|
+
} from "./chunk-XOLFZ4XS.js";
|
|
54
49
|
import {
|
|
55
50
|
AssistantMessageEventStream
|
|
56
51
|
} from "./chunk-46SEH6ER.js";
|
|
52
|
+
import {
|
|
53
|
+
sanitizeSurrogates
|
|
54
|
+
} from "./chunk-CT4G24PS.js";
|
|
57
55
|
import {
|
|
58
56
|
zodToJsonSchema
|
|
59
57
|
} from "./chunk-XUFLSZM4.js";
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
splitDeferredTools
|
|
3
|
-
} from "./chunk-HTG7JBF2.js";
|
|
4
1
|
import {
|
|
5
2
|
convertResponsesMessages,
|
|
6
3
|
convertResponsesTools,
|
|
7
4
|
processResponsesStream
|
|
8
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-J4JCPZDI.js";
|
|
9
6
|
import "./chunk-UFVAKOTZ.js";
|
|
10
7
|
import {
|
|
11
8
|
clampOpenAIPromptCacheKey
|
|
@@ -14,13 +11,6 @@ import {
|
|
|
14
11
|
formatProviderError,
|
|
15
12
|
normalizeProviderError
|
|
16
13
|
} from "./chunk-NKEOCGYU.js";
|
|
17
|
-
import {
|
|
18
|
-
buildBaseOptions
|
|
19
|
-
} from "./chunk-RYONFGPP.js";
|
|
20
|
-
import "./chunk-CT4G24PS.js";
|
|
21
|
-
import {
|
|
22
|
-
headersToRecord
|
|
23
|
-
} from "./chunk-Y6UTJIT4.js";
|
|
24
14
|
import {
|
|
25
15
|
registerSessionResourceCleanup
|
|
26
16
|
} from "./chunk-6MHDOBWO.js";
|
|
@@ -29,16 +19,24 @@ import {
|
|
|
29
19
|
createAssistantMessageDiagnostic,
|
|
30
20
|
formatThrownValue
|
|
31
21
|
} from "./chunk-E2P6TIFG.js";
|
|
22
|
+
import {
|
|
23
|
+
splitDeferredTools
|
|
24
|
+
} from "./chunk-HTG7JBF2.js";
|
|
32
25
|
import {
|
|
33
26
|
getProviderEnvValue
|
|
34
27
|
} from "./chunk-B5XRGKYX.js";
|
|
35
28
|
import "./chunk-WJHOHUET.js";
|
|
36
29
|
import {
|
|
30
|
+
buildBaseOptions,
|
|
37
31
|
clampThinkingLevel
|
|
38
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-XOLFZ4XS.js";
|
|
39
33
|
import {
|
|
40
34
|
AssistantMessageEventStream
|
|
41
35
|
} from "./chunk-46SEH6ER.js";
|
|
36
|
+
import "./chunk-CT4G24PS.js";
|
|
37
|
+
import {
|
|
38
|
+
headersToRecord
|
|
39
|
+
} from "./chunk-Y6UTJIT4.js";
|
|
42
40
|
import "./chunk-2ESYSVXG.js";
|
|
43
41
|
|
|
44
42
|
// ../../node_modules/@earendil-works/pi-ai/dist/utils/abort-signals.js
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildCopilotDynamicHeaders,
|
|
3
|
-
hasCopilotVisionInput
|
|
4
|
-
} from "./chunk-XMVFOHGJ.js";
|
|
5
1
|
import {
|
|
6
2
|
clampOpenAIPromptCacheKey
|
|
7
3
|
} from "./chunk-FHNQ6DPF.js";
|
|
@@ -13,15 +9,9 @@ import {
|
|
|
13
9
|
normalizeProviderError
|
|
14
10
|
} from "./chunk-NKEOCGYU.js";
|
|
15
11
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import {
|
|
20
|
-
sanitizeSurrogates
|
|
21
|
-
} from "./chunk-CT4G24PS.js";
|
|
22
|
-
import {
|
|
23
|
-
headersToRecord
|
|
24
|
-
} from "./chunk-Y6UTJIT4.js";
|
|
12
|
+
buildCopilotDynamicHeaders,
|
|
13
|
+
hasCopilotVisionInput
|
|
14
|
+
} from "./chunk-XMVFOHGJ.js";
|
|
25
15
|
import {
|
|
26
16
|
getProviderEnvValue
|
|
27
17
|
} from "./chunk-B5XRGKYX.js";
|
|
@@ -29,12 +19,20 @@ import {
|
|
|
29
19
|
parseStreamingJson
|
|
30
20
|
} from "./chunk-WJHOHUET.js";
|
|
31
21
|
import {
|
|
22
|
+
buildBaseOptions,
|
|
32
23
|
calculateCost,
|
|
33
|
-
clampThinkingLevel
|
|
34
|
-
|
|
24
|
+
clampThinkingLevel,
|
|
25
|
+
transformMessages
|
|
26
|
+
} from "./chunk-XOLFZ4XS.js";
|
|
35
27
|
import {
|
|
36
28
|
AssistantMessageEventStream
|
|
37
29
|
} from "./chunk-46SEH6ER.js";
|
|
30
|
+
import {
|
|
31
|
+
sanitizeSurrogates
|
|
32
|
+
} from "./chunk-CT4G24PS.js";
|
|
33
|
+
import {
|
|
34
|
+
headersToRecord
|
|
35
|
+
} from "./chunk-Y6UTJIT4.js";
|
|
38
36
|
import "./chunk-2ESYSVXG.js";
|
|
39
37
|
|
|
40
38
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js
|