linkque-cli-v2 1.3.6 → 1.3.7
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/linkquejs.js +21 -7
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-NHRW2KQW.js → chunk-AACYYAZ6.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-HM7KNEG3.js → chunk-DNTEEBEH.js} +5 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-EAODRPW4.js +518 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-7SF3H2GM.js → chunk-RHMVQTA7.js} +6 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-RHFHCJYP.js → chunk-ZNU4GVF3.js} +15155 -379
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-bsd-H2ZLZRGB.js → getMachineId-bsd-JGCLGHFY.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-darwin-HUKYR46U.js → getMachineId-darwin-COHLFNXH.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-linux-M5ZADHBA.js → getMachineId-linux-XV3Z5FQG.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-unsupported-BM5RZZVM.js → getMachineId-unsupported-FCRKLIZL.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-win-BQPUF5TW.js → getMachineId-win-A4WRNVV6.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{mistral-conversations-TQA2MPJJ.js → mistral-conversations-5RZTVEO2.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{otel-RXJWJ2TU.js → otel-WGS5CC2J.js} +250 -267
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +97 -18
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +4 -3
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +4 -3
- package/worker.js +270 -47
|
@@ -38,13 +38,13 @@ import {
|
|
|
38
38
|
resolveLinkqueGatewayAuth,
|
|
39
39
|
resolveRunStorage,
|
|
40
40
|
toAgentRunMessages
|
|
41
|
-
} from "../../chunk-
|
|
41
|
+
} from "../../chunk-RHMVQTA7.js";
|
|
42
42
|
import "../../chunk-IWOFD643.js";
|
|
43
43
|
import "../../chunk-PXCGFBV5.js";
|
|
44
44
|
import "../../chunk-ETG6PNHQ.js";
|
|
45
45
|
import {
|
|
46
46
|
getBakedProtocol
|
|
47
|
-
} from "../../chunk-
|
|
47
|
+
} from "../../chunk-AACYYAZ6.js";
|
|
48
48
|
import {
|
|
49
49
|
CANCEL_CONVERSATION_RUN_OPERATION,
|
|
50
50
|
CONVERSATION_HISTORY_VERSION,
|
|
@@ -104,6 +104,7 @@ import {
|
|
|
104
104
|
NoopRuntimeTelemetry,
|
|
105
105
|
NoopSkillLoader,
|
|
106
106
|
NoopWebSearchPort,
|
|
107
|
+
OtelRuntimeTelemetry,
|
|
107
108
|
RUNTIME_CONFIG_DEFAULTS,
|
|
108
109
|
RemoteGatewayMcpServerProvider,
|
|
109
110
|
SideEffectRunner,
|
|
@@ -153,10 +154,11 @@ import {
|
|
|
153
154
|
summarizeBody,
|
|
154
155
|
warnLogFailure,
|
|
155
156
|
wrapToolWithHooks
|
|
156
|
-
} from "../../chunk-
|
|
157
|
+
} from "../../chunk-ZNU4GVF3.js";
|
|
157
158
|
import "../../chunk-XUFLSZM4.js";
|
|
159
|
+
import "../../chunk-EAODRPW4.js";
|
|
158
160
|
import "../../chunk-GAYNLDWK.js";
|
|
159
|
-
import "../../chunk-
|
|
161
|
+
import "../../chunk-DNTEEBEH.js";
|
|
160
162
|
import {
|
|
161
163
|
__commonJS,
|
|
162
164
|
__export,
|
|
@@ -8267,7 +8269,7 @@ var googleGenerativeAIApi = () => lazyApi(() => import("../../google-generative-
|
|
|
8267
8269
|
var googleVertexApi = () => lazyApi(() => import("../../google-vertex-RIGAEYLC.js"));
|
|
8268
8270
|
|
|
8269
8271
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.js
|
|
8270
|
-
var mistralConversationsApi = () => lazyApi(() => import("../../mistral-conversations-
|
|
8272
|
+
var mistralConversationsApi = () => lazyApi(() => import("../../mistral-conversations-5RZTVEO2.js"));
|
|
8271
8273
|
|
|
8272
8274
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.js
|
|
8273
8275
|
var openAICodexResponsesApi = () => lazyApi(() => import("../../openai-codex-responses-WLREQPZK.js"));
|
|
@@ -42960,6 +42962,8 @@ function resolveLinkqueEndpoints(env, envSelector) {
|
|
|
42960
42962
|
const config = new AppbaseRuntimeConfigProvider(env);
|
|
42961
42963
|
const isPre = envSelector === "PRE";
|
|
42962
42964
|
return {
|
|
42965
|
+
telemetryLogsEndpoint: config.get(isPre ? "LINKQUEGW_TELEMETRY_LOGS_ENDPOINT_PRE" : "LINKQUEGW_TELEMETRY_LOGS_ENDPOINT"),
|
|
42966
|
+
telemetryTracesEndpoint: config.get(isPre ? "LINKQUEGW_TELEMETRY_TRACES_ENDPOINT_PRE" : "LINKQUEGW_TELEMETRY_TRACES_ENDPOINT"),
|
|
42963
42967
|
linkqueBaseUrl: config.get(isPre ? "LINKQUE_BASE_URL_PRE" : "LINKQUE_BASE_URL"),
|
|
42964
42968
|
knowledgeBaseUrl: config.get(isPre ? "LINKQUEGW_KNOWLEDGE_BASE_URL_PRE" : "LINKQUEGW_KNOWLEDGE_BASE_URL"),
|
|
42965
42969
|
webSearchBaseUrl: config.get(isPre ? "LINKQUEGW_WEB_SEARCH_BASE_URL_PRE" : "LINKQUEGW_WEB_SEARCH_BASE_URL"),
|
|
@@ -42975,6 +42979,8 @@ function createAppBaseRuntime(protocol, env = process.env, ports = {}, logCtx) {
|
|
|
42975
42979
|
logCtx.log?.(prefix + line);
|
|
42976
42980
|
} : void 0;
|
|
42977
42981
|
const runtimePorts = {};
|
|
42982
|
+
if (ports.telemetry)
|
|
42983
|
+
runtimePorts.telemetry = ports.telemetry;
|
|
42978
42984
|
if (ports.linkqueBaseUrl) {
|
|
42979
42985
|
runtimePorts.linkqueBaseUrl = ports.linkqueBaseUrl;
|
|
42980
42986
|
log("linkqueBaseUrl: ->", ports.linkqueBaseUrl);
|
|
@@ -44842,6 +44848,64 @@ function errorMessage(error, fallback) {
|
|
|
44842
44848
|
return error instanceof Error && error.message.trim() ? error.message : fallback;
|
|
44843
44849
|
}
|
|
44844
44850
|
|
|
44851
|
+
// ../linkque-agent-appwrite-integrate/dist/esm/runtime/appbaseTelemetry.js
|
|
44852
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
44853
|
+
function createAppbaseTelemetry(options) {
|
|
44854
|
+
const diagnostic = (code) => {
|
|
44855
|
+
try {
|
|
44856
|
+
options.logCtx?.log?.("[telemetry]", code);
|
|
44857
|
+
} catch {
|
|
44858
|
+
}
|
|
44859
|
+
};
|
|
44860
|
+
let telemetry;
|
|
44861
|
+
try {
|
|
44862
|
+
telemetry = new OtelRuntimeTelemetry({
|
|
44863
|
+
serviceName: "linkque-appbase",
|
|
44864
|
+
serviceVersion: "0.0.0",
|
|
44865
|
+
environment: options.environment,
|
|
44866
|
+
logsEndpoint: options.logsEndpoint,
|
|
44867
|
+
tracesEndpoint: options.tracesEndpoint,
|
|
44868
|
+
diagnostic: ({ code }) => diagnostic(code)
|
|
44869
|
+
});
|
|
44870
|
+
} catch {
|
|
44871
|
+
diagnostic("initialization_failed");
|
|
44872
|
+
telemetry = new NoopRuntimeTelemetry();
|
|
44873
|
+
}
|
|
44874
|
+
const { authorizationHeader, mode } = options.gatewayAuth;
|
|
44875
|
+
const version = createHash3("sha256").update(authorizationHeader).digest("hex");
|
|
44876
|
+
return {
|
|
44877
|
+
telemetry,
|
|
44878
|
+
createContext(requestId) {
|
|
44879
|
+
return {
|
|
44880
|
+
parent: null,
|
|
44881
|
+
authorization: {
|
|
44882
|
+
subject: version,
|
|
44883
|
+
version,
|
|
44884
|
+
mode: mode === "user-token" ? "bearer" : "aak",
|
|
44885
|
+
agentId: options.agentId,
|
|
44886
|
+
environment: options.environment,
|
|
44887
|
+
getHeaders: () => ({
|
|
44888
|
+
authorization: authorizationHeader,
|
|
44889
|
+
"x-linkque-agent-id": options.agentId
|
|
44890
|
+
})
|
|
44891
|
+
},
|
|
44892
|
+
requestId,
|
|
44893
|
+
turnId: "",
|
|
44894
|
+
accountId: "",
|
|
44895
|
+
channel: "appbase",
|
|
44896
|
+
userKey: ""
|
|
44897
|
+
};
|
|
44898
|
+
},
|
|
44899
|
+
async shutdown() {
|
|
44900
|
+
try {
|
|
44901
|
+
await telemetry.shutdown({ timeoutMs: 2e3, authorization: null });
|
|
44902
|
+
} catch {
|
|
44903
|
+
diagnostic("shutdown_failed");
|
|
44904
|
+
}
|
|
44905
|
+
}
|
|
44906
|
+
};
|
|
44907
|
+
}
|
|
44908
|
+
|
|
44845
44909
|
// ../linkque-agent-appwrite-integrate/dist/esm/runtime/securityAnswerPlugin.js
|
|
44846
44910
|
var SECURITY_ANSWER_HEADER = "x-linkque-guardrails-action";
|
|
44847
44911
|
var SECURITY_ANSWER_ACTION = "SECURITY_ANSWER";
|
|
@@ -45007,7 +45071,7 @@ function resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envS
|
|
|
45007
45071
|
chunkSize = storage.chunkSize;
|
|
45008
45072
|
}
|
|
45009
45073
|
const mcpAuthorizationHeaderProvider = async () => resolved.authorizationHeader;
|
|
45010
|
-
const { linkqueBaseUrl, knowledgeBaseUrl, webSearchBaseUrl, eventBaseUrl, mcpSignEndpoint, openMcpBaseUrl } = resolveLinkqueEndpoints(env, envSelector);
|
|
45074
|
+
const { linkqueBaseUrl, knowledgeBaseUrl, webSearchBaseUrl, eventBaseUrl, mcpSignEndpoint, openMcpBaseUrl, telemetryLogsEndpoint, telemetryTracesEndpoint } = resolveLinkqueEndpoints(env, envSelector);
|
|
45011
45075
|
const mcpConfigResolver = createAppbaseMcpConfigResolver({
|
|
45012
45076
|
agentId: protocol.agentId,
|
|
45013
45077
|
remoteBaseUrl: openMcpBaseUrl,
|
|
@@ -45019,7 +45083,16 @@ function resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envS
|
|
|
45019
45083
|
});
|
|
45020
45084
|
const mcpServerProvider = rawMcpServerProvider;
|
|
45021
45085
|
const securityAnswerPlugin = deps?.securityAnswerPlugin ?? createSecurityAnswerPlugin(historyStore, logCtx?.log);
|
|
45086
|
+
const telemetry = deps?.runtime ? void 0 : createAppbaseTelemetry({
|
|
45087
|
+
agentId: protocol.agentId,
|
|
45088
|
+
gatewayAuth: resolved,
|
|
45089
|
+
environment: new AppbaseRuntimeConfigProvider(env).get("LINKQUE_TELEMETRY_ENVIRONMENT") ?? (envSelector === "PRE" ? "pre" : "prod"),
|
|
45090
|
+
logsEndpoint: telemetryLogsEndpoint,
|
|
45091
|
+
tracesEndpoint: telemetryTracesEndpoint,
|
|
45092
|
+
logCtx
|
|
45093
|
+
});
|
|
45022
45094
|
const runtime = deps?.runtime ?? createAppBaseRuntime(protocol, env, {
|
|
45095
|
+
telemetry: telemetry?.telemetry,
|
|
45023
45096
|
...appwriteApiKey ? { appBaseApiKey: appwriteApiKey } : {},
|
|
45024
45097
|
mcpServerProvider,
|
|
45025
45098
|
mcpConfigResolver,
|
|
@@ -45042,6 +45115,7 @@ function resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envS
|
|
|
45042
45115
|
model: protocol.agent.model.defaultModel || void 0,
|
|
45043
45116
|
protocol,
|
|
45044
45117
|
runtime,
|
|
45118
|
+
telemetry,
|
|
45045
45119
|
store,
|
|
45046
45120
|
sessionLease,
|
|
45047
45121
|
historyStore,
|
|
@@ -45361,6 +45435,7 @@ async function runAgentToChunks(deps, request, env, logCtx, authenticatedUserId,
|
|
|
45361
45435
|
};
|
|
45362
45436
|
}
|
|
45363
45437
|
const runOptions = {
|
|
45438
|
+
telemetryContext: deps.telemetry?.createContext(request.runId),
|
|
45364
45439
|
requestSource: EModelRequestSource.APPBASE_FUNCTION,
|
|
45365
45440
|
runtimeContext: {
|
|
45366
45441
|
agentId: deps.protocol.agentId,
|
|
@@ -45567,17 +45642,6 @@ async function runChat(method, bodyJSON, env, deps, logCtx, historyOwnerId, appw
|
|
|
45567
45642
|
const leaseOwnerId = randomUUID7();
|
|
45568
45643
|
let leaseAcquired = false;
|
|
45569
45644
|
let leaseReleased = false;
|
|
45570
|
-
if (cfg.sessionLease && !isPresentationRun) {
|
|
45571
|
-
try {
|
|
45572
|
-
leaseAcquired = await cfg.sessionLease.acquire(request.threadId, leaseOwnerId);
|
|
45573
|
-
} catch (err2) {
|
|
45574
|
-
logError("session \u79DF\u7EA6\u83B7\u53D6\u5931\u8D25:", err2);
|
|
45575
|
-
return jsonError(500, "session_lock_failed", err2 instanceof Error ? err2.message : "\u4F1A\u8BDD\u79DF\u7EA6\u83B7\u53D6\u5931\u8D25");
|
|
45576
|
-
}
|
|
45577
|
-
if (!leaseAcquired) {
|
|
45578
|
-
return jsonError(409, "thread_busy", "\u8BE5\u4F1A\u8BDD\u5DF2\u6709\u6B63\u5728\u8FD0\u884C\u7684\u8BF7\u6C42");
|
|
45579
|
-
}
|
|
45580
|
-
}
|
|
45581
45645
|
const releaseLease = async () => {
|
|
45582
45646
|
if (!leaseAcquired || !cfg.sessionLease)
|
|
45583
45647
|
return true;
|
|
@@ -45593,6 +45657,17 @@ async function runChat(method, bodyJSON, env, deps, logCtx, historyOwnerId, appw
|
|
|
45593
45657
|
}
|
|
45594
45658
|
};
|
|
45595
45659
|
try {
|
|
45660
|
+
if (cfg.sessionLease && !isPresentationRun) {
|
|
45661
|
+
try {
|
|
45662
|
+
leaseAcquired = await cfg.sessionLease.acquire(request.threadId, leaseOwnerId);
|
|
45663
|
+
} catch (err2) {
|
|
45664
|
+
logError("session \u79DF\u7EA6\u83B7\u53D6\u5931\u8D25:", err2);
|
|
45665
|
+
return jsonError(500, "session_lock_failed", err2 instanceof Error ? err2.message : "\u4F1A\u8BDD\u79DF\u7EA6\u83B7\u53D6\u5931\u8D25");
|
|
45666
|
+
}
|
|
45667
|
+
if (!leaseAcquired) {
|
|
45668
|
+
return jsonError(409, "thread_busy", "\u8BE5\u4F1A\u8BDD\u5DF2\u6709\u6B63\u5728\u8FD0\u884C\u7684\u8BF7\u6C42");
|
|
45669
|
+
}
|
|
45670
|
+
}
|
|
45596
45671
|
if (cfg.historyStore && !isPresentationRun) {
|
|
45597
45672
|
try {
|
|
45598
45673
|
await cfg.historyStore.beginRun(request, cfg.protocol.agentId);
|
|
@@ -45743,7 +45818,11 @@ async function runChat(method, bodyJSON, env, deps, logCtx, historyOwnerId, appw
|
|
|
45743
45818
|
}
|
|
45744
45819
|
return execution.response;
|
|
45745
45820
|
} finally {
|
|
45746
|
-
|
|
45821
|
+
try {
|
|
45822
|
+
await releaseLease();
|
|
45823
|
+
} finally {
|
|
45824
|
+
await cfg.telemetry?.shutdown();
|
|
45825
|
+
}
|
|
45747
45826
|
}
|
|
45748
45827
|
}
|
|
45749
45828
|
function readSearchableUserContent(request) {
|
package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js
CHANGED
|
@@ -3,14 +3,15 @@ import {
|
|
|
3
3
|
runClientCapability,
|
|
4
4
|
runClientCapabilityCleanup,
|
|
5
5
|
runClientCapabilityResult
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-RHMVQTA7.js";
|
|
7
7
|
import "../../chunk-IWOFD643.js";
|
|
8
8
|
import "../../chunk-PXCGFBV5.js";
|
|
9
9
|
import "../../chunk-ETG6PNHQ.js";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-ZNU4GVF3.js";
|
|
11
11
|
import "../../chunk-XUFLSZM4.js";
|
|
12
|
+
import "../../chunk-EAODRPW4.js";
|
|
12
13
|
import "../../chunk-GAYNLDWK.js";
|
|
13
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-DNTEEBEH.js";
|
|
14
15
|
import "../../chunk-2ESYSVXG.js";
|
|
15
16
|
export {
|
|
16
17
|
clientCapability as default,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getBakedProtocol,
|
|
3
3
|
setBakedProtocol
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-AACYYAZ6.js";
|
|
5
|
+
import "../chunk-ZNU4GVF3.js";
|
|
6
6
|
import "../chunk-XUFLSZM4.js";
|
|
7
|
+
import "../chunk-EAODRPW4.js";
|
|
7
8
|
import "../chunk-GAYNLDWK.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-DNTEEBEH.js";
|
|
9
10
|
import "../chunk-2ESYSVXG.js";
|
|
10
11
|
export {
|
|
11
12
|
getBakedProtocol,
|