linkque-cli-v2 1.6.6 → 1.6.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 +3 -3
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-FC6S43DG.js → chunk-C2TN5LPS.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-FH2M6YD6.js → chunk-Y2STWI2J.js} +30 -9
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-ICPH34ZQ.js → chunk-Z2A5GMVJ.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 +25 -12
- 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 +23 -3
package/linkquejs.js
CHANGED
|
@@ -35750,11 +35750,11 @@ var RUN_TABLE_COLUMNS = [
|
|
|
35750
35750
|
},
|
|
35751
35751
|
{
|
|
35752
35752
|
key: "lines",
|
|
35753
|
-
type: "
|
|
35753
|
+
type: "longtext",
|
|
35754
35754
|
required: false,
|
|
35755
35755
|
array: true,
|
|
35756
|
-
// 单条 SSE data 行可能承载完整 A2UI Config,使用
|
|
35757
|
-
size:
|
|
35756
|
+
// 单条 SSE data 行可能承载完整 A2UI Config,使用 longtext 数组避免 varchar 长度限制。
|
|
35757
|
+
size: 0,
|
|
35758
35758
|
default: null
|
|
35759
35759
|
},
|
|
35760
35760
|
{
|
package/package.json
CHANGED
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-FH2M6YD6.js → chunk-Y2STWI2J.js}
RENAMED
|
@@ -388,8 +388,9 @@ import {
|
|
|
388
388
|
esm_exports,
|
|
389
389
|
init_esm,
|
|
390
390
|
isSpanContextValid,
|
|
391
|
+
isValidTraceId,
|
|
391
392
|
trace
|
|
392
|
-
} from "./chunk-
|
|
393
|
+
} from "./chunk-SICWMO5Y.js";
|
|
393
394
|
import {
|
|
394
395
|
__commonJS,
|
|
395
396
|
__esm,
|
|
@@ -12858,19 +12859,19 @@ var require_getMachineId = __commonJS({
|
|
|
12858
12859
|
if (!getMachineIdImpl) {
|
|
12859
12860
|
switch (process2.platform) {
|
|
12860
12861
|
case "darwin":
|
|
12861
|
-
getMachineIdImpl = (await import("./getMachineId-darwin-
|
|
12862
|
+
getMachineIdImpl = (await import("./getMachineId-darwin-OPTJOAYC.js")).getMachineId;
|
|
12862
12863
|
break;
|
|
12863
12864
|
case "linux":
|
|
12864
|
-
getMachineIdImpl = (await import("./getMachineId-linux-
|
|
12865
|
+
getMachineIdImpl = (await import("./getMachineId-linux-5SQRYTUJ.js")).getMachineId;
|
|
12865
12866
|
break;
|
|
12866
12867
|
case "freebsd":
|
|
12867
|
-
getMachineIdImpl = (await import("./getMachineId-bsd-
|
|
12868
|
+
getMachineIdImpl = (await import("./getMachineId-bsd-NYGVHXGN.js")).getMachineId;
|
|
12868
12869
|
break;
|
|
12869
12870
|
case "win32":
|
|
12870
|
-
getMachineIdImpl = (await import("./getMachineId-win-
|
|
12871
|
+
getMachineIdImpl = (await import("./getMachineId-win-SLTTCNXU.js")).getMachineId;
|
|
12871
12872
|
break;
|
|
12872
12873
|
default:
|
|
12873
|
-
getMachineIdImpl = (await import("./getMachineId-unsupported-
|
|
12874
|
+
getMachineIdImpl = (await import("./getMachineId-unsupported-OJE7WPEH.js")).getMachineId;
|
|
12874
12875
|
break;
|
|
12875
12876
|
}
|
|
12876
12877
|
}
|
|
@@ -14262,7 +14263,7 @@ var require_RandomIdGenerator = __commonJS({
|
|
|
14262
14263
|
exports.RandomIdGenerator = void 0;
|
|
14263
14264
|
var SPAN_ID_BYTES = 8;
|
|
14264
14265
|
var TRACE_ID_BYTES = 16;
|
|
14265
|
-
var
|
|
14266
|
+
var RandomIdGenerator2 = class {
|
|
14266
14267
|
/**
|
|
14267
14268
|
* Returns a random 16-byte trace ID formatted/encoded as a 32 lowercase hex
|
|
14268
14269
|
* characters corresponding to 128 bits.
|
|
@@ -14274,7 +14275,7 @@ var require_RandomIdGenerator = __commonJS({
|
|
|
14274
14275
|
*/
|
|
14275
14276
|
generateSpanId = getIdGenerator(SPAN_ID_BYTES);
|
|
14276
14277
|
};
|
|
14277
|
-
exports.RandomIdGenerator =
|
|
14278
|
+
exports.RandomIdGenerator = RandomIdGenerator2;
|
|
14278
14279
|
var SHARED_BUFFER = Buffer.allocUnsafe(TRACE_ID_BYTES);
|
|
14279
14280
|
function getIdGenerator(bytes2) {
|
|
14280
14281
|
return function generateId() {
|
|
@@ -39204,6 +39205,24 @@ function sanitizeAttributeValue(value) {
|
|
|
39204
39205
|
}
|
|
39205
39206
|
|
|
39206
39207
|
// ../linkque-agent-runtime/dist/esm/impl/telemetry/otelRuntimeTelemetry.js
|
|
39208
|
+
var InitialRootTraceIdGenerator = class {
|
|
39209
|
+
initialRootTraceId;
|
|
39210
|
+
fallback = new import_sdk_trace_base.RandomIdGenerator();
|
|
39211
|
+
constructor(initialRootTraceId) {
|
|
39212
|
+
this.initialRootTraceId = initialRootTraceId;
|
|
39213
|
+
}
|
|
39214
|
+
generateTraceId() {
|
|
39215
|
+
if (this.initialRootTraceId) {
|
|
39216
|
+
const traceId = this.initialRootTraceId;
|
|
39217
|
+
this.initialRootTraceId = void 0;
|
|
39218
|
+
return traceId;
|
|
39219
|
+
}
|
|
39220
|
+
return this.fallback.generateTraceId();
|
|
39221
|
+
}
|
|
39222
|
+
generateSpanId() {
|
|
39223
|
+
return this.fallback.generateSpanId();
|
|
39224
|
+
}
|
|
39225
|
+
};
|
|
39207
39226
|
var OtelRuntimeTelemetry = class {
|
|
39208
39227
|
options;
|
|
39209
39228
|
queue;
|
|
@@ -39223,9 +39242,10 @@ var OtelRuntimeTelemetry = class {
|
|
|
39223
39242
|
this.options = options;
|
|
39224
39243
|
this.queue = new IdentityQueue(options);
|
|
39225
39244
|
const ratio = options.sampleRatio ?? 1;
|
|
39245
|
+
const initialRootTraceId = options.initialRootTraceId?.toLowerCase();
|
|
39226
39246
|
this.maxActive = options.maxActiveOperations ?? 4096;
|
|
39227
39247
|
this.maxAge = options.operationMaxAgeMs ?? 24 * 60 * 60 * 1e3;
|
|
39228
|
-
if (!options.serviceName || !options.serviceVersion || !options.environment || !Number.isFinite(ratio) || ratio < 0 || ratio > 1 || !Number.isSafeInteger(this.maxActive) || this.maxActive < 1 || !Number.isSafeInteger(this.maxAge) || this.maxAge < 1)
|
|
39248
|
+
if (!options.serviceName || !options.serviceVersion || !options.environment || !Number.isFinite(ratio) || ratio < 0 || ratio > 1 || !Number.isSafeInteger(this.maxActive) || this.maxActive < 1 || !Number.isSafeInteger(this.maxAge) || this.maxAge < 1 || initialRootTraceId !== void 0 && !isValidTraceId(initialRootTraceId))
|
|
39229
39249
|
throw new Error("\u975E\u6CD5\u9065\u6D4B\u5B9E\u4F8B\u914D\u7F6E");
|
|
39230
39250
|
const resource = (0, import_resources.resourceFromAttributes)({
|
|
39231
39251
|
[ETelemetryAttribute.SERVICE_NAME]: options.serviceName,
|
|
@@ -39236,6 +39256,7 @@ var OtelRuntimeTelemetry = class {
|
|
|
39236
39256
|
});
|
|
39237
39257
|
this.tracerProvider = new import_sdk_trace_base.BasicTracerProvider({
|
|
39238
39258
|
resource,
|
|
39259
|
+
idGenerator: new InitialRootTraceIdGenerator(initialRootTraceId),
|
|
39239
39260
|
sampler: new import_sdk_trace_base.ParentBasedSampler({
|
|
39240
39261
|
root: new import_sdk_trace_base.TraceIdRatioBasedSampler(ratio)
|
|
39241
39262
|
}),
|
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-ICPH34ZQ.js → chunk-Z2A5GMVJ.js}
RENAMED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
RUNTIME_CONFIG_DEFAULTS,
|
|
23
23
|
RuntimeConfigProvider,
|
|
24
24
|
isDebugLoggingEnabled
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-Y2STWI2J.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-Z2A5GMVJ.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-C2TN5LPS.js";
|
|
60
62
|
import {
|
|
61
63
|
ACTIVATE_SKILL_TOOL_NAME,
|
|
62
64
|
CANCEL_CONVERSATION_RUN_OPERATION,
|
|
@@ -194,11 +196,11 @@ import {
|
|
|
194
196
|
warnLogFailure,
|
|
195
197
|
wrapToolWithHooks,
|
|
196
198
|
writeJsonPointer
|
|
197
|
-
} from "../../chunk-
|
|
199
|
+
} from "../../chunk-Y2STWI2J.js";
|
|
198
200
|
import "../../chunk-EAODRPW4.js";
|
|
199
201
|
import "../../chunk-XUFLSZM4.js";
|
|
200
202
|
import "../../chunk-GAYNLDWK.js";
|
|
201
|
-
import "../../chunk-
|
|
203
|
+
import "../../chunk-SICWMO5Y.js";
|
|
202
204
|
import {
|
|
203
205
|
__commonJS,
|
|
204
206
|
__export,
|
|
@@ -8447,7 +8449,7 @@ var googleGenerativeAIApi = () => lazyApi(() => import("../../google-generative-
|
|
|
8447
8449
|
var googleVertexApi = () => lazyApi(() => import("../../google-vertex-TREYA472.js"));
|
|
8448
8450
|
|
|
8449
8451
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.js
|
|
8450
|
-
var mistralConversationsApi = () => lazyApi(() => import("../../mistral-conversations-
|
|
8452
|
+
var mistralConversationsApi = () => lazyApi(() => import("../../mistral-conversations-C43A6QIS.js"));
|
|
8451
8453
|
|
|
8452
8454
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.js
|
|
8453
8455
|
var openAICodexResponsesApi = () => lazyApi(() => import("../../openai-codex-responses-GEFKSNVN.js"));
|
|
@@ -46263,6 +46265,7 @@ function createAppbaseTelemetry(options) {
|
|
|
46263
46265
|
environment: options.environment,
|
|
46264
46266
|
logsEndpoint: options.logsEndpoint,
|
|
46265
46267
|
tracesEndpoint: options.tracesEndpoint,
|
|
46268
|
+
...options.initialRootTraceId ? { initialRootTraceId: options.initialRootTraceId } : {},
|
|
46266
46269
|
diagnostic: ({ code }) => diagnostic(code)
|
|
46267
46270
|
});
|
|
46268
46271
|
} catch {
|
|
@@ -46413,7 +46416,7 @@ function createSecurityAnswerPlugin(historyStore, log) {
|
|
|
46413
46416
|
}
|
|
46414
46417
|
|
|
46415
46418
|
// ../linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chatConfig.js
|
|
46416
|
-
function resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, gatewayAuth, temporaryFrontendAppId) {
|
|
46419
|
+
function resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, gatewayAuth, temporaryFrontendAppId, initialRootTraceId) {
|
|
46417
46420
|
const log = (...a) => logCtx?.log?.("[chat]", ...a);
|
|
46418
46421
|
const logError = (...a) => logCtx?.error?.("[chat]", ...a);
|
|
46419
46422
|
const protocol = deps?.protocol ?? getBakedProtocol();
|
|
@@ -46511,6 +46514,7 @@ function resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envS
|
|
|
46511
46514
|
environment: new AppbaseRuntimeConfigProvider(env).get("LINKQUE_TELEMETRY_ENVIRONMENT") ?? (envSelector === "PRE" ? "pre" : "prod"),
|
|
46512
46515
|
logsEndpoint: telemetryLogsEndpoint,
|
|
46513
46516
|
tracesEndpoint: telemetryTracesEndpoint,
|
|
46517
|
+
...initialRootTraceId ? { initialRootTraceId } : {},
|
|
46514
46518
|
logCtx
|
|
46515
46519
|
});
|
|
46516
46520
|
const runtime = deps?.runtime ?? createAppBaseRuntime(protocol, env, {
|
|
@@ -47222,7 +47226,7 @@ function failure2(status, code, message, retryable = false) {
|
|
|
47222
47226
|
}
|
|
47223
47227
|
|
|
47224
47228
|
// ../linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js
|
|
47225
|
-
async function runChat(method, bodyJSON, env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId) {
|
|
47229
|
+
async function runChat(method, bodyJSON, env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId, otelTraceId) {
|
|
47226
47230
|
const log = (...args) => logCtx?.log?.("[chat]", ...args);
|
|
47227
47231
|
const logError = (...args) => logCtx?.error?.("[chat]", ...args);
|
|
47228
47232
|
const guarded = guardChatRequest(method, bodyJSON, logCtx);
|
|
@@ -47230,7 +47234,7 @@ async function runChat(method, bodyJSON, env, deps, logCtx, historyOwnerId, appw
|
|
|
47230
47234
|
return guarded;
|
|
47231
47235
|
let request = guarded;
|
|
47232
47236
|
const isPresentationRun = request.executionScope === "presentation";
|
|
47233
|
-
const cfg = resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, gatewayAuth, temporaryFrontendAppId);
|
|
47237
|
+
const cfg = resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, gatewayAuth, temporaryFrontendAppId, otelTraceId);
|
|
47234
47238
|
if ("status" in cfg)
|
|
47235
47239
|
return cfg;
|
|
47236
47240
|
const leaseOwnerId = randomUUID8();
|
|
@@ -47539,7 +47543,7 @@ function waitForCancellationPoll(delayMs, signal) {
|
|
|
47539
47543
|
}
|
|
47540
47544
|
});
|
|
47541
47545
|
}
|
|
47542
|
-
async function runGateway(method, bodyJSON, env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId, mcpPhoneAuthorization) {
|
|
47546
|
+
async function runGateway(method, bodyJSON, env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId, mcpPhoneAuthorization, otelTraceId) {
|
|
47543
47547
|
const operation = readOperation(bodyJSON);
|
|
47544
47548
|
const startedAt = Date.now();
|
|
47545
47549
|
const logGateway = (event, fields = {}, failed = false) => {
|
|
@@ -47620,7 +47624,7 @@ async function runGateway(method, bodyJSON, env, deps, logCtx, historyOwnerId, a
|
|
|
47620
47624
|
if (operation) {
|
|
47621
47625
|
return observe(() => jsonError(400, "operation_unsupported", `\u4E0D\u652F\u6301\u7684 operation: ${operation}`));
|
|
47622
47626
|
}
|
|
47623
|
-
return observe(() => runChat(method, bodyJSON, env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId));
|
|
47627
|
+
return observe(() => runChat(method, bodyJSON, env, deps, logCtx, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId, otelTraceId));
|
|
47624
47628
|
}
|
|
47625
47629
|
async function chat(ctx) {
|
|
47626
47630
|
let result;
|
|
@@ -47629,9 +47633,18 @@ async function chat(ctx) {
|
|
|
47629
47633
|
const bodyJSON = resolveBodyJSON(ctx.req);
|
|
47630
47634
|
const historyOwnerId = readAuthenticatedUserId(ctx.req.headers);
|
|
47631
47635
|
const appwriteApiKey = readAppwriteApiKey(ctx.req.headers);
|
|
47632
|
-
|
|
47636
|
+
const otelTraceIdResult = readOtelTraceId(ctx.req.headers);
|
|
47637
|
+
if (otelTraceIdResult.kind === "invalid") {
|
|
47638
|
+
result = jsonError(400, "invalid_otel_trace_id", "x-linkque-otel-trace-id \u683C\u5F0F\u975E\u6CD5");
|
|
47639
|
+
} else if (readOperation(bodyJSON) === REPLACE_ANSWER_OPERATION) {
|
|
47633
47640
|
const control = await runReplaceAnswer(ctx.req.method, bodyJSON, process.env, void 0, logCtx, appwriteApiKey);
|
|
47634
|
-
|
|
47641
|
+
result = control;
|
|
47642
|
+
} else {
|
|
47643
|
+
const envSelector2 = readEnvSelector(ctx.req.headers);
|
|
47644
|
+
const traceId2 = readTraceId(ctx.req.headers);
|
|
47645
|
+
const temporaryFrontendAppId2 = readTemporaryFrontendAppId(ctx.req.headers);
|
|
47646
|
+
const gatewayAuth2 = historyOwnerId ? resolveLinkqueGatewayAuth(ctx.req.headers, process.env, logCtx) : void 0;
|
|
47647
|
+
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");
|
|
47635
47648
|
}
|
|
47636
47649
|
const envSelector = readEnvSelector(ctx.req.headers);
|
|
47637
47650
|
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-Z2A5GMVJ.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-Y2STWI2J.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-C2TN5LPS.js";
|
|
5
|
+
import "../chunk-Y2STWI2J.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,
|
package/worker.js
CHANGED
|
@@ -41998,7 +41998,7 @@ var require_RandomIdGenerator = __commonJS({
|
|
|
41998
41998
|
exports2.RandomIdGenerator = void 0;
|
|
41999
41999
|
var SPAN_ID_BYTES = 8;
|
|
42000
42000
|
var TRACE_ID_BYTES = 16;
|
|
42001
|
-
var
|
|
42001
|
+
var RandomIdGenerator2 = class {
|
|
42002
42002
|
/**
|
|
42003
42003
|
* Returns a random 16-byte trace ID formatted/encoded as a 32 lowercase hex
|
|
42004
42004
|
* characters corresponding to 128 bits.
|
|
@@ -42010,7 +42010,7 @@ var require_RandomIdGenerator = __commonJS({
|
|
|
42010
42010
|
*/
|
|
42011
42011
|
generateSpanId = getIdGenerator(SPAN_ID_BYTES);
|
|
42012
42012
|
};
|
|
42013
|
-
exports2.RandomIdGenerator =
|
|
42013
|
+
exports2.RandomIdGenerator = RandomIdGenerator2;
|
|
42014
42014
|
var SHARED_BUFFER = Buffer.allocUnsafe(TRACE_ID_BYTES);
|
|
42015
42015
|
function getIdGenerator(bytes2) {
|
|
42016
42016
|
return function generateId() {
|
|
@@ -219132,6 +219132,24 @@ function sanitizeAttributeValue(value) {
|
|
|
219132
219132
|
}
|
|
219133
219133
|
|
|
219134
219134
|
// ../linkque-agent-runtime/dist/esm/impl/telemetry/otelRuntimeTelemetry.js
|
|
219135
|
+
var InitialRootTraceIdGenerator = class {
|
|
219136
|
+
initialRootTraceId;
|
|
219137
|
+
fallback = new import_sdk_trace_base.RandomIdGenerator();
|
|
219138
|
+
constructor(initialRootTraceId) {
|
|
219139
|
+
this.initialRootTraceId = initialRootTraceId;
|
|
219140
|
+
}
|
|
219141
|
+
generateTraceId() {
|
|
219142
|
+
if (this.initialRootTraceId) {
|
|
219143
|
+
const traceId = this.initialRootTraceId;
|
|
219144
|
+
this.initialRootTraceId = void 0;
|
|
219145
|
+
return traceId;
|
|
219146
|
+
}
|
|
219147
|
+
return this.fallback.generateTraceId();
|
|
219148
|
+
}
|
|
219149
|
+
generateSpanId() {
|
|
219150
|
+
return this.fallback.generateSpanId();
|
|
219151
|
+
}
|
|
219152
|
+
};
|
|
219135
219153
|
var OtelRuntimeTelemetry = class {
|
|
219136
219154
|
options;
|
|
219137
219155
|
queue;
|
|
@@ -219151,9 +219169,10 @@ var OtelRuntimeTelemetry = class {
|
|
|
219151
219169
|
this.options = options;
|
|
219152
219170
|
this.queue = new IdentityQueue(options);
|
|
219153
219171
|
const ratio = options.sampleRatio ?? 1;
|
|
219172
|
+
const initialRootTraceId = options.initialRootTraceId?.toLowerCase();
|
|
219154
219173
|
this.maxActive = options.maxActiveOperations ?? 4096;
|
|
219155
219174
|
this.maxAge = options.operationMaxAgeMs ?? 24 * 60 * 60 * 1e3;
|
|
219156
|
-
if (!options.serviceName || !options.serviceVersion || !options.environment || !Number.isFinite(ratio) || ratio < 0 || ratio > 1 || !Number.isSafeInteger(this.maxActive) || this.maxActive < 1 || !Number.isSafeInteger(this.maxAge) || this.maxAge < 1)
|
|
219175
|
+
if (!options.serviceName || !options.serviceVersion || !options.environment || !Number.isFinite(ratio) || ratio < 0 || ratio > 1 || !Number.isSafeInteger(this.maxActive) || this.maxActive < 1 || !Number.isSafeInteger(this.maxAge) || this.maxAge < 1 || initialRootTraceId !== void 0 && !isValidTraceId(initialRootTraceId))
|
|
219157
219176
|
throw new Error("\u975E\u6CD5\u9065\u6D4B\u5B9E\u4F8B\u914D\u7F6E");
|
|
219158
219177
|
const resource = (0, import_resources.resourceFromAttributes)({
|
|
219159
219178
|
[ETelemetryAttribute.SERVICE_NAME]: options.serviceName,
|
|
@@ -219164,6 +219183,7 @@ var OtelRuntimeTelemetry = class {
|
|
|
219164
219183
|
});
|
|
219165
219184
|
this.tracerProvider = new import_sdk_trace_base.BasicTracerProvider({
|
|
219166
219185
|
resource,
|
|
219186
|
+
idGenerator: new InitialRootTraceIdGenerator(initialRootTraceId),
|
|
219167
219187
|
sampler: new import_sdk_trace_base.ParentBasedSampler({
|
|
219168
219188
|
root: new import_sdk_trace_base.TraceIdRatioBasedSampler(ratio)
|
|
219169
219189
|
}),
|