linkque-cli-v2 1.6.4 → 1.6.5
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 +3 -16
- package/linkquejs.js +631 -1015
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-KDHBKVSL.js → anthropic-messages-5DOLTIGP.js} +15 -14
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{azure-openai-responses-NPKMM3LF.js → azure-openai-responses-HVAVRLTK.js} +9 -7
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-JMBJJF7P.js → chunk-4XAZNSEQ.js} +5 -18
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-UZS5YLV2.js → chunk-IATVK6CO.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-J4JCPZDI.js → chunk-Q2Y6LMNC.js} +7 -5
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-RYONFGPP.js +317 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-VBERH5QM.js → chunk-UTJ7DVT7.js} +133 -423
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-XOLFZ4XS.js → chunk-Y3G4J3TB.js} +1 -316
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-CO4I3RJE.js → chunk-YZLXAZFT.js} +2 -15
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{dist-TGBYXSBU.js → dist-ZPLSQEAM.js} +42 -27
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-generative-ai-KD7MXONK.js → google-generative-ai-OLT56CSV.js} +10 -8
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-vertex-TREYA472.js → google-vertex-4DBBJ7SR.js} +11 -9
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{mistral-conversations-OEOTQWE5.js → mistral-conversations-OEBGEDLQ.js} +9 -7
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-codex-responses-GEFKSNVN.js → openai-codex-responses-3KOC6KHN.js} +12 -10
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-completions-TAACO6T5.js → openai-completions-HG6OJRL5.js} +15 -13
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-responses-4DDTXIGI.js → openai-responses-F6V2PG3Y.js} +14 -12
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +60 -181
- 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 +183 -381
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/anthropic-messages-GSYNBLMR.js +0 -17
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{pi-messages-7JN3W3BC.js → pi-messages-DC4DVRAJ.js} +4 -4
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-XOLFZ4XS.js → chunk-Y3G4J3TB.js}
RENAMED
|
@@ -599,326 +599,11 @@ 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
|
-
|
|
913
602
|
export {
|
|
914
603
|
lazyStream,
|
|
915
604
|
lazyApi,
|
|
916
605
|
createModels,
|
|
917
606
|
createProvider,
|
|
918
607
|
calculateCost,
|
|
919
|
-
clampThinkingLevel
|
|
920
|
-
clampMaxTokensToContext,
|
|
921
|
-
buildBaseOptions,
|
|
922
|
-
adjustMaxTokensForThinking,
|
|
923
|
-
transformMessages
|
|
608
|
+
clampThinkingLevel
|
|
924
609
|
};
|
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-CO4I3RJE.js → chunk-YZLXAZFT.js}
RENAMED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
RUNTIME_CONFIG_DEFAULTS,
|
|
23
23
|
RuntimeConfigProvider,
|
|
24
24
|
isDebugLoggingEnabled
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-UTJ7DVT7.js";
|
|
26
26
|
import {
|
|
27
27
|
__commonJS,
|
|
28
28
|
__require,
|
|
@@ -15323,19 +15323,6 @@ var LinkqueGatewayAuthUnconfiguredError = class extends Error {
|
|
|
15323
15323
|
this.name = "LinkqueGatewayAuthUnconfiguredError";
|
|
15324
15324
|
}
|
|
15325
15325
|
};
|
|
15326
|
-
function resolveLinkqueGatewayRequestAuth(headers, env = process.env, logCtx) {
|
|
15327
|
-
const users = Object.entries(headers ?? {}).filter(([key]) => key.toLowerCase() === "x-appwrite-user-id");
|
|
15328
|
-
if (users.length > 1 || users.length === 1 && typeof users[0]?.[1] !== "string") {
|
|
15329
|
-
throw new LinkqueGatewayAuthError("Appwrite\u7528\u6237\u8EAB\u4EFD\u65E0\u6548");
|
|
15330
|
-
}
|
|
15331
|
-
const userId = users[0]?.[1]?.trim();
|
|
15332
|
-
const hasToken = Object.keys(headers ?? {}).some((key) => key.toLowerCase() === LINKQUE_AUTHORIZATION_HEADER);
|
|
15333
|
-
if (userId?.startsWith("lqs_") && !hasToken) {
|
|
15334
|
-
logCtx?.error?.("[auth-resolve] stage=failed, reason=scenario-user-token-required");
|
|
15335
|
-
throw new LinkqueGatewayAuthError("\u573A\u666F\u7528\u6237\u51ED\u8BC1\u7F3A\u5931\uFF0C\u8BF7\u4ECE\u90E8\u7F72\u5165\u53E3\u91CD\u65B0\u767B\u5F55");
|
|
15336
|
-
}
|
|
15337
|
-
return resolveLinkqueGatewayAuth(headers, env, logCtx);
|
|
15338
|
-
}
|
|
15339
15326
|
function resolveLinkqueGatewayAuth(headers, env = process.env, logCtx) {
|
|
15340
15327
|
const config = new AppbaseRuntimeConfigProvider({ ...env });
|
|
15341
15328
|
const log = (...a2) => logCtx?.log?.("[auth-resolve]", ...a2);
|
|
@@ -15895,7 +15882,7 @@ export {
|
|
|
15895
15882
|
describeRuntimeEnv,
|
|
15896
15883
|
LinkqueGatewayAuthError,
|
|
15897
15884
|
LinkqueGatewayAuthUnconfiguredError,
|
|
15898
|
-
|
|
15885
|
+
resolveLinkqueGatewayAuth,
|
|
15899
15886
|
resolveGatewayAuthContext,
|
|
15900
15887
|
resolveBodyJSON,
|
|
15901
15888
|
toAgentRunMessages,
|
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{dist-TGBYXSBU.js → dist-ZPLSQEAM.js}
RENAMED
|
@@ -222,50 +222,64 @@ var require_common = __commonJS({
|
|
|
222
222
|
createDebug.namespaces = namespaces;
|
|
223
223
|
createDebug.names = [];
|
|
224
224
|
createDebug.skips = [];
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
225
|
+
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
226
|
+
for (const ns of split) {
|
|
227
|
+
if (ns[0] === "-") {
|
|
228
|
+
createDebug.skips.push(ns.slice(1));
|
|
229
|
+
} else {
|
|
230
|
+
createDebug.names.push(ns);
|
|
231
231
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function matchesTemplate(search, template) {
|
|
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;
|
|
235
253
|
} else {
|
|
236
|
-
|
|
254
|
+
return false;
|
|
237
255
|
}
|
|
238
256
|
}
|
|
257
|
+
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
258
|
+
templateIndex++;
|
|
259
|
+
}
|
|
260
|
+
return templateIndex === template.length;
|
|
239
261
|
}
|
|
240
262
|
function disable() {
|
|
241
263
|
const namespaces = [
|
|
242
|
-
...createDebug.names
|
|
243
|
-
...createDebug.skips.map(
|
|
264
|
+
...createDebug.names,
|
|
265
|
+
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
244
266
|
].join(",");
|
|
245
267
|
createDebug.enable("");
|
|
246
268
|
return namespaces;
|
|
247
269
|
}
|
|
248
270
|
function enabled(name) {
|
|
249
|
-
|
|
250
|
-
|
|
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)) {
|
|
271
|
+
for (const skip of createDebug.skips) {
|
|
272
|
+
if (matchesTemplate(name, skip)) {
|
|
256
273
|
return false;
|
|
257
274
|
}
|
|
258
275
|
}
|
|
259
|
-
for (
|
|
260
|
-
if (
|
|
276
|
+
for (const ns of createDebug.names) {
|
|
277
|
+
if (matchesTemplate(name, ns)) {
|
|
261
278
|
return true;
|
|
262
279
|
}
|
|
263
280
|
}
|
|
264
281
|
return false;
|
|
265
282
|
}
|
|
266
|
-
function toNamespace(regexp) {
|
|
267
|
-
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
|
|
268
|
-
}
|
|
269
283
|
function coerce(val) {
|
|
270
284
|
if (val instanceof Error) {
|
|
271
285
|
return val.stack || val.message;
|
|
@@ -384,10 +398,11 @@ var require_browser = __commonJS({
|
|
|
384
398
|
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
385
399
|
return false;
|
|
386
400
|
}
|
|
401
|
+
let m;
|
|
387
402
|
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
388
403
|
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
389
404
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
390
|
-
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(
|
|
405
|
+
typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
391
406
|
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
392
407
|
}
|
|
393
408
|
function formatArgs(args) {
|
|
@@ -425,7 +440,7 @@ var require_browser = __commonJS({
|
|
|
425
440
|
function load() {
|
|
426
441
|
let r;
|
|
427
442
|
try {
|
|
428
|
-
r = exports.storage.getItem("debug");
|
|
443
|
+
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
429
444
|
} catch (error) {
|
|
430
445
|
}
|
|
431
446
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
@@ -708,7 +723,7 @@ var require_node = __commonJS({
|
|
|
708
723
|
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
709
724
|
}
|
|
710
725
|
function log(...args) {
|
|
711
|
-
return process.stderr.write(util.
|
|
726
|
+
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
712
727
|
}
|
|
713
728
|
function save(namespaces) {
|
|
714
729
|
if (namespaces) {
|
|
@@ -6,25 +6,27 @@ import {
|
|
|
6
6
|
mapStopReason,
|
|
7
7
|
mapToolChoice,
|
|
8
8
|
retainThoughtSignature
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4XAZNSEQ.js";
|
|
10
10
|
import {
|
|
11
11
|
formatProviderError,
|
|
12
12
|
normalizeProviderError
|
|
13
13
|
} from "./chunk-NKEOCGYU.js";
|
|
14
14
|
import {
|
|
15
|
-
buildBaseOptions
|
|
16
|
-
|
|
17
|
-
clampThinkingLevel
|
|
18
|
-
} from "./chunk-XOLFZ4XS.js";
|
|
19
|
-
import {
|
|
20
|
-
AssistantMessageEventStream
|
|
21
|
-
} from "./chunk-46SEH6ER.js";
|
|
15
|
+
buildBaseOptions
|
|
16
|
+
} from "./chunk-RYONFGPP.js";
|
|
22
17
|
import {
|
|
23
18
|
sanitizeSurrogates
|
|
24
19
|
} from "./chunk-CT4G24PS.js";
|
|
25
20
|
import {
|
|
26
21
|
providerHeadersToRecord
|
|
27
22
|
} from "./chunk-Y6UTJIT4.js";
|
|
23
|
+
import {
|
|
24
|
+
calculateCost,
|
|
25
|
+
clampThinkingLevel
|
|
26
|
+
} from "./chunk-Y3G4J3TB.js";
|
|
27
|
+
import {
|
|
28
|
+
AssistantMessageEventStream
|
|
29
|
+
} from "./chunk-46SEH6ER.js";
|
|
28
30
|
import "./chunk-ETG6PNHQ.js";
|
|
29
31
|
import "./chunk-2ESYSVXG.js";
|
|
30
32
|
|
|
@@ -8,28 +8,30 @@ import {
|
|
|
8
8
|
mapStopReason,
|
|
9
9
|
mapToolChoice,
|
|
10
10
|
retainThoughtSignature
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4XAZNSEQ.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";
|
|
16
25
|
import {
|
|
17
26
|
getProviderEnvValue
|
|
18
27
|
} from "./chunk-B5XRGKYX.js";
|
|
19
28
|
import {
|
|
20
|
-
buildBaseOptions,
|
|
21
29
|
calculateCost,
|
|
22
30
|
clampThinkingLevel
|
|
23
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-Y3G4J3TB.js";
|
|
24
32
|
import {
|
|
25
33
|
AssistantMessageEventStream
|
|
26
34
|
} from "./chunk-46SEH6ER.js";
|
|
27
|
-
import {
|
|
28
|
-
sanitizeSurrogates
|
|
29
|
-
} from "./chunk-CT4G24PS.js";
|
|
30
|
-
import {
|
|
31
|
-
providerHeadersToRecord
|
|
32
|
-
} from "./chunk-Y6UTJIT4.js";
|
|
33
35
|
import "./chunk-ETG6PNHQ.js";
|
|
34
36
|
import "./chunk-2ESYSVXG.js";
|
|
35
37
|
|
|
@@ -37,21 +37,23 @@ 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";
|
|
40
47
|
import {
|
|
41
48
|
parseStreamingJson
|
|
42
49
|
} from "./chunk-WJHOHUET.js";
|
|
43
50
|
import {
|
|
44
|
-
buildBaseOptions,
|
|
45
51
|
calculateCost,
|
|
46
|
-
clampThinkingLevel
|
|
47
|
-
|
|
48
|
-
} from "./chunk-XOLFZ4XS.js";
|
|
52
|
+
clampThinkingLevel
|
|
53
|
+
} from "./chunk-Y3G4J3TB.js";
|
|
49
54
|
import {
|
|
50
55
|
AssistantMessageEventStream
|
|
51
56
|
} from "./chunk-46SEH6ER.js";
|
|
52
|
-
import {
|
|
53
|
-
sanitizeSurrogates
|
|
54
|
-
} from "./chunk-CT4G24PS.js";
|
|
55
57
|
import {
|
|
56
58
|
zodToJsonSchema
|
|
57
59
|
} from "./chunk-XUFLSZM4.js";
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
splitDeferredTools
|
|
3
|
+
} from "./chunk-HTG7JBF2.js";
|
|
1
4
|
import {
|
|
2
5
|
convertResponsesMessages,
|
|
3
6
|
convertResponsesTools,
|
|
4
7
|
processResponsesStream
|
|
5
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-Q2Y6LMNC.js";
|
|
6
9
|
import "./chunk-UFVAKOTZ.js";
|
|
7
10
|
import {
|
|
8
11
|
clampOpenAIPromptCacheKey
|
|
@@ -11,6 +14,13 @@ import {
|
|
|
11
14
|
formatProviderError,
|
|
12
15
|
normalizeProviderError
|
|
13
16
|
} 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";
|
|
14
24
|
import {
|
|
15
25
|
registerSessionResourceCleanup
|
|
16
26
|
} from "./chunk-6MHDOBWO.js";
|
|
@@ -19,24 +29,16 @@ import {
|
|
|
19
29
|
createAssistantMessageDiagnostic,
|
|
20
30
|
formatThrownValue
|
|
21
31
|
} from "./chunk-E2P6TIFG.js";
|
|
22
|
-
import {
|
|
23
|
-
splitDeferredTools
|
|
24
|
-
} from "./chunk-HTG7JBF2.js";
|
|
25
32
|
import {
|
|
26
33
|
getProviderEnvValue
|
|
27
34
|
} from "./chunk-B5XRGKYX.js";
|
|
28
35
|
import "./chunk-WJHOHUET.js";
|
|
29
36
|
import {
|
|
30
|
-
buildBaseOptions,
|
|
31
37
|
clampThinkingLevel
|
|
32
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-Y3G4J3TB.js";
|
|
33
39
|
import {
|
|
34
40
|
AssistantMessageEventStream
|
|
35
41
|
} from "./chunk-46SEH6ER.js";
|
|
36
|
-
import "./chunk-CT4G24PS.js";
|
|
37
|
-
import {
|
|
38
|
-
headersToRecord
|
|
39
|
-
} from "./chunk-Y6UTJIT4.js";
|
|
40
42
|
import "./chunk-2ESYSVXG.js";
|
|
41
43
|
|
|
42
44
|
// ../../node_modules/@earendil-works/pi-ai/dist/utils/abort-signals.js
|