linkque-cli-v2 1.6.9 → 1.6.10
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 +110 -3
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-BJXGRRWL.js → chunk-P7NPWFEB.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-DNTEEBEH.js → chunk-SICWMO5Y.js} +1 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-NJKO34ZC.js → chunk-UPH5CD2J.js} +632 -558
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-HGKCCOSQ.js → chunk-YODH5M5T.js} +26 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-bsd-JGCLGHFY.js → getMachineId-bsd-NYGVHXGN.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-darwin-COHLFNXH.js → getMachineId-darwin-OPTJOAYC.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-linux-XV3Z5FQG.js → getMachineId-linux-5SQRYTUJ.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-unsupported-FCRKLIZL.js → getMachineId-unsupported-OJE7WPEH.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-win-A4WRNVV6.js → getMachineId-win-SLTTCNXU.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{mistral-conversations-OEOTQWE5.js → mistral-conversations-C43A6QIS.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{otel-WGS5CC2J.js → otel-RUUFBBFE.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +26 -13
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +3 -3
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +3 -3
- package/worker.js +739 -666
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-HGKCCOSQ.js → chunk-YODH5M5T.js}
RENAMED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
RUNTIME_CONFIG_DEFAULTS,
|
|
23
23
|
RuntimeConfigProvider,
|
|
24
24
|
isDebugLoggingEnabled
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-UPH5CD2J.js";
|
|
26
26
|
import {
|
|
27
27
|
__commonJS,
|
|
28
28
|
__require,
|
|
@@ -15663,6 +15663,7 @@ var API_KEY_HEADER = "x-appwrite-key";
|
|
|
15663
15663
|
var TRIGGER_HEADER = "x-appwrite-trigger";
|
|
15664
15664
|
var ENV_SELECTOR_HEADER = "x-linkque-env";
|
|
15665
15665
|
var TRACE_ID_HEADER = "x-trace-id";
|
|
15666
|
+
var OTEL_TRACE_ID_HEADER = "x-linkque-otel-trace-id";
|
|
15666
15667
|
var TEMPORARY_FRONTEND_APP_ID_HEADER = "x-linkque-alipay-app-id";
|
|
15667
15668
|
var ALIPAY_AUTH_CODE_HEADER = "x-alipay-authcode";
|
|
15668
15669
|
var AUTH_UNAVAILABLE_HEADER = "x-linkque-phone-auth-unavailable";
|
|
@@ -15742,6 +15743,28 @@ function readTraceId(headers) {
|
|
|
15742
15743
|
}
|
|
15743
15744
|
return void 0;
|
|
15744
15745
|
}
|
|
15746
|
+
function readOtelTraceId(headers) {
|
|
15747
|
+
if (!headers)
|
|
15748
|
+
return { kind: "missing" };
|
|
15749
|
+
let found = Object.prototype.hasOwnProperty.call(headers, OTEL_TRACE_ID_HEADER);
|
|
15750
|
+
let value = found ? headers[OTEL_TRACE_ID_HEADER] : void 0;
|
|
15751
|
+
if (!found) {
|
|
15752
|
+
for (const [key, candidate] of Object.entries(headers)) {
|
|
15753
|
+
if (key.toLowerCase() === OTEL_TRACE_ID_HEADER) {
|
|
15754
|
+
found = true;
|
|
15755
|
+
value = candidate;
|
|
15756
|
+
break;
|
|
15757
|
+
}
|
|
15758
|
+
}
|
|
15759
|
+
}
|
|
15760
|
+
if (!found)
|
|
15761
|
+
return { kind: "missing" };
|
|
15762
|
+
const raw = headValue(value);
|
|
15763
|
+
if (!raw)
|
|
15764
|
+
return { kind: "invalid" };
|
|
15765
|
+
const traceId = raw.toLowerCase();
|
|
15766
|
+
return /^[0-9a-f]{32}$/u.test(traceId) && traceId !== "00000000000000000000000000000000" ? { kind: "valid", traceId } : { kind: "invalid" };
|
|
15767
|
+
}
|
|
15745
15768
|
function readTemporaryFrontendAppId(headers) {
|
|
15746
15769
|
if (!headers)
|
|
15747
15770
|
return void 0;
|
|
@@ -15908,6 +15931,7 @@ export {
|
|
|
15908
15931
|
LinkqueGatewayAuthError,
|
|
15909
15932
|
LinkqueGatewayAuthUnconfiguredError,
|
|
15910
15933
|
resolveLinkqueGatewayRequestAuth,
|
|
15934
|
+
resolveLinkqueGatewayAuth,
|
|
15911
15935
|
resolveGatewayAuthContext,
|
|
15912
15936
|
resolveBodyJSON,
|
|
15913
15937
|
toAgentRunMessages,
|
|
@@ -15916,6 +15940,7 @@ export {
|
|
|
15916
15940
|
mcpPhoneAuthorizationChallenge,
|
|
15917
15941
|
readEnvSelector,
|
|
15918
15942
|
readTraceId,
|
|
15943
|
+
readOtelTraceId,
|
|
15919
15944
|
readTemporaryFrontendAppId,
|
|
15920
15945
|
readAuthenticatedUserId,
|
|
15921
15946
|
readAppwriteApiKey,
|
|
@@ -388,7 +388,7 @@ async function getObservabilityModule() {
|
|
|
388
388
|
return observabilityModule;
|
|
389
389
|
}
|
|
390
390
|
try {
|
|
391
|
-
observabilityModule = await import("./otel-
|
|
391
|
+
observabilityModule = await import("./otel-RUUFBBFE.js");
|
|
392
392
|
} catch {
|
|
393
393
|
observabilityModule = null;
|
|
394
394
|
}
|
|
@@ -42,21 +42,23 @@ import {
|
|
|
42
42
|
readAuthenticatedUserId,
|
|
43
43
|
readEnvSelector,
|
|
44
44
|
readMcpPhoneAuthorization,
|
|
45
|
+
readOtelTraceId,
|
|
45
46
|
readTemporaryFrontendAppId,
|
|
46
47
|
readTraceId,
|
|
47
48
|
resolveBodyJSON,
|
|
48
49
|
resolveGatewayAuthContext,
|
|
50
|
+
resolveLinkqueGatewayAuth,
|
|
49
51
|
resolveLinkqueGatewayRequestAuth,
|
|
50
52
|
resolveRunStorage,
|
|
51
53
|
toAgentRunMessages,
|
|
52
54
|
withIsoTimestamp
|
|
53
|
-
} from "../../chunk-
|
|
55
|
+
} from "../../chunk-YODH5M5T.js";
|
|
54
56
|
import "../../chunk-IWOFD643.js";
|
|
55
57
|
import "../../chunk-PXCGFBV5.js";
|
|
56
58
|
import "../../chunk-ETG6PNHQ.js";
|
|
57
59
|
import {
|
|
58
60
|
getBakedProtocol
|
|
59
|
-
} from "../../chunk-
|
|
61
|
+
} from "../../chunk-P7NPWFEB.js";
|
|
60
62
|
import {
|
|
61
63
|
ACTIVATE_SKILL_TOOL_NAME,
|
|
62
64
|
CANCEL_CONVERSATION_RUN_OPERATION,
|
|
@@ -196,11 +198,11 @@ import {
|
|
|
196
198
|
warnLogFailure,
|
|
197
199
|
wrapToolWithHooks,
|
|
198
200
|
writeJsonPointer
|
|
199
|
-
} from "../../chunk-
|
|
201
|
+
} from "../../chunk-UPH5CD2J.js";
|
|
200
202
|
import "../../chunk-EAODRPW4.js";
|
|
201
203
|
import "../../chunk-XUFLSZM4.js";
|
|
202
204
|
import "../../chunk-GAYNLDWK.js";
|
|
203
|
-
import "../../chunk-
|
|
205
|
+
import "../../chunk-SICWMO5Y.js";
|
|
204
206
|
import {
|
|
205
207
|
__commonJS,
|
|
206
208
|
__export,
|
|
@@ -8449,7 +8451,7 @@ var googleGenerativeAIApi = () => lazyApi(() => import("../../google-generative-
|
|
|
8449
8451
|
var googleVertexApi = () => lazyApi(() => import("../../google-vertex-TREYA472.js"));
|
|
8450
8452
|
|
|
8451
8453
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.js
|
|
8452
|
-
var mistralConversationsApi = () => lazyApi(() => import("../../mistral-conversations-
|
|
8454
|
+
var mistralConversationsApi = () => lazyApi(() => import("../../mistral-conversations-C43A6QIS.js"));
|
|
8453
8455
|
|
|
8454
8456
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.js
|
|
8455
8457
|
var openAICodexResponsesApi = () => lazyApi(() => import("../../openai-codex-responses-GEFKSNVN.js"));
|
|
@@ -44134,7 +44136,7 @@ var DEFAULT_OPEN_MCP_BASE_URL = APPBASE_RUNTIME_CONFIG_DEFAULTS.LINKQUE_OPEN_MCP
|
|
|
44134
44136
|
function createAppbaseMcpConfigResolver(options) {
|
|
44135
44137
|
return (resource) => ({
|
|
44136
44138
|
remoteBaseUrl: options.remoteBaseUrl ?? DEFAULT_OPEN_MCP_BASE_URL,
|
|
44137
|
-
sseEndpoint: `api/v1/open/mcps/${resource.config.serverName}/
|
|
44139
|
+
sseEndpoint: `api/v1/open/mcps/${resource.config.serverName}/mcp`,
|
|
44138
44140
|
agentId: options.agentId,
|
|
44139
44141
|
...options.signEndpoint ? { signEndpoint: options.signEndpoint } : {}
|
|
44140
44142
|
});
|
|
@@ -46245,6 +46247,7 @@ function createAppbaseTelemetry(options) {
|
|
|
46245
46247
|
environment: options.environment,
|
|
46246
46248
|
logsEndpoint: options.logsEndpoint,
|
|
46247
46249
|
tracesEndpoint: options.tracesEndpoint,
|
|
46250
|
+
...options.initialRootTraceId ? { initialRootTraceId: options.initialRootTraceId } : {},
|
|
46248
46251
|
diagnostic: ({ code }) => diagnostic(code)
|
|
46249
46252
|
});
|
|
46250
46253
|
} catch {
|
|
@@ -46395,7 +46398,7 @@ function createSecurityAnswerPlugin(historyStore, log) {
|
|
|
46395
46398
|
}
|
|
46396
46399
|
|
|
46397
46400
|
// ../linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chatConfig.js
|
|
46398
|
-
function resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, gatewayAuth, temporaryFrontendAppId) {
|
|
46401
|
+
function resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, gatewayAuth, temporaryFrontendAppId, initialRootTraceId) {
|
|
46399
46402
|
const log = (...a) => logCtx?.log?.("[chat]", ...a);
|
|
46400
46403
|
const logError = (...a) => logCtx?.error?.("[chat]", ...a);
|
|
46401
46404
|
const protocol = deps?.protocol ?? getBakedProtocol();
|
|
@@ -46494,6 +46497,7 @@ function resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envS
|
|
|
46494
46497
|
environment: new AppbaseRuntimeConfigProvider(env).get("LINKQUE_TELEMETRY_ENVIRONMENT") ?? (envSelector === "PRE" ? "pre" : "prod"),
|
|
46495
46498
|
logsEndpoint: telemetryLogsEndpoint,
|
|
46496
46499
|
tracesEndpoint: telemetryTracesEndpoint,
|
|
46500
|
+
...initialRootTraceId ? { initialRootTraceId } : {},
|
|
46497
46501
|
logCtx
|
|
46498
46502
|
});
|
|
46499
46503
|
const runtime = deps?.runtime ?? createAppBaseRuntime(protocol, env, {
|
|
@@ -47205,7 +47209,7 @@ function failure2(status, code, message, retryable = false) {
|
|
|
47205
47209
|
}
|
|
47206
47210
|
|
|
47207
47211
|
// ../linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js
|
|
47208
|
-
async function runChat(method, bodyJSON, env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId) {
|
|
47212
|
+
async function runChat(method, bodyJSON, env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId, otelTraceId) {
|
|
47209
47213
|
const log = (...args) => logCtx?.log?.("[chat]", ...args);
|
|
47210
47214
|
const logError = (...args) => logCtx?.error?.("[chat]", ...args);
|
|
47211
47215
|
const guarded = guardChatRequest(method, bodyJSON, logCtx);
|
|
@@ -47213,7 +47217,7 @@ async function runChat(method, bodyJSON, env, deps, logCtx, historyOwnerId, appw
|
|
|
47213
47217
|
return guarded;
|
|
47214
47218
|
let request = guarded;
|
|
47215
47219
|
const isPresentationRun = request.executionScope === "presentation";
|
|
47216
|
-
const cfg = resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, gatewayAuth, temporaryFrontendAppId);
|
|
47220
|
+
const cfg = resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, gatewayAuth, temporaryFrontendAppId, otelTraceId);
|
|
47217
47221
|
if ("status" in cfg)
|
|
47218
47222
|
return cfg;
|
|
47219
47223
|
const leaseOwnerId = randomUUID8();
|
|
@@ -47522,7 +47526,7 @@ function waitForCancellationPoll(delayMs, signal) {
|
|
|
47522
47526
|
}
|
|
47523
47527
|
});
|
|
47524
47528
|
}
|
|
47525
|
-
async function runGateway(method, bodyJSON, env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId, mcpPhoneAuthorization) {
|
|
47529
|
+
async function runGateway(method, bodyJSON, env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId, mcpPhoneAuthorization, otelTraceId) {
|
|
47526
47530
|
const operation = readOperation(bodyJSON);
|
|
47527
47531
|
const startedAt = Date.now();
|
|
47528
47532
|
const logGateway = (event, fields = {}, failed = false) => {
|
|
@@ -47603,7 +47607,7 @@ async function runGateway(method, bodyJSON, env, deps, logCtx, historyOwnerId, a
|
|
|
47603
47607
|
if (operation) {
|
|
47604
47608
|
return observe(() => jsonError(400, "operation_unsupported", `\u4E0D\u652F\u6301\u7684 operation: ${operation}`));
|
|
47605
47609
|
}
|
|
47606
|
-
return observe(() => runChat(method, bodyJSON, env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId));
|
|
47610
|
+
return observe(() => runChat(method, bodyJSON, env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId, otelTraceId));
|
|
47607
47611
|
}
|
|
47608
47612
|
async function chat(ctx) {
|
|
47609
47613
|
let result;
|
|
@@ -47612,9 +47616,18 @@ async function chat(ctx) {
|
|
|
47612
47616
|
const bodyJSON = resolveBodyJSON(ctx.req);
|
|
47613
47617
|
const historyOwnerId = readAuthenticatedUserId(ctx.req.headers);
|
|
47614
47618
|
const appwriteApiKey = readAppwriteApiKey(ctx.req.headers);
|
|
47615
|
-
|
|
47619
|
+
const otelTraceIdResult = readOtelTraceId(ctx.req.headers);
|
|
47620
|
+
if (otelTraceIdResult.kind === "invalid") {
|
|
47621
|
+
result = jsonError(400, "invalid_otel_trace_id", "x-linkque-otel-trace-id \u683C\u5F0F\u975E\u6CD5");
|
|
47622
|
+
} else if (readOperation(bodyJSON) === REPLACE_ANSWER_OPERATION) {
|
|
47616
47623
|
const control = await runReplaceAnswer(ctx.req.method, bodyJSON, process.env, void 0, logCtx, appwriteApiKey);
|
|
47617
|
-
|
|
47624
|
+
result = control;
|
|
47625
|
+
} else {
|
|
47626
|
+
const envSelector2 = readEnvSelector(ctx.req.headers);
|
|
47627
|
+
const traceId2 = readTraceId(ctx.req.headers);
|
|
47628
|
+
const temporaryFrontendAppId2 = readTemporaryFrontendAppId(ctx.req.headers);
|
|
47629
|
+
const gatewayAuth2 = historyOwnerId ? resolveLinkqueGatewayAuth(ctx.req.headers, process.env, logCtx) : void 0;
|
|
47630
|
+
result = historyOwnerId ? await runGateway(ctx.req.method, bodyJSON, process.env, void 0, logCtx, historyOwnerId, appwriteApiKey, envSelector2, traceId2, gatewayAuth2, temporaryFrontendAppId2, readMcpPhoneAuthorization(ctx.req.headers), otelTraceIdResult.kind === "valid" ? otelTraceIdResult.traceId : void 0) : jsonError(401, "authentication_required", "\u7F3A\u5C11 Appwrite \u8BA4\u8BC1\u7528\u6237");
|
|
47618
47631
|
}
|
|
47619
47632
|
const envSelector = readEnvSelector(ctx.req.headers);
|
|
47620
47633
|
const traceId = readTraceId(ctx.req.headers);
|
package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js
CHANGED
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
runClientCapability,
|
|
4
4
|
runClientCapabilityCleanup,
|
|
5
5
|
runClientCapabilityResult
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-YODH5M5T.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-UPH5CD2J.js";
|
|
11
11
|
import "../../chunk-EAODRPW4.js";
|
|
12
12
|
import "../../chunk-XUFLSZM4.js";
|
|
13
13
|
import "../../chunk-GAYNLDWK.js";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-SICWMO5Y.js";
|
|
15
15
|
import "../../chunk-2ESYSVXG.js";
|
|
16
16
|
export {
|
|
17
17
|
clientCapability as default,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getBakedProtocol,
|
|
3
3
|
setBakedProtocol
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-P7NPWFEB.js";
|
|
5
|
+
import "../chunk-UPH5CD2J.js";
|
|
6
6
|
import "../chunk-EAODRPW4.js";
|
|
7
7
|
import "../chunk-XUFLSZM4.js";
|
|
8
8
|
import "../chunk-GAYNLDWK.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-SICWMO5Y.js";
|
|
10
10
|
import "../chunk-2ESYSVXG.js";
|
|
11
11
|
export {
|
|
12
12
|
getBakedProtocol,
|