linkque-cli-v2 1.4.5 → 1.4.6
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 +153 -50
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-NFVKWQGM.js → chunk-JD3IL3IC.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-CLYLJ5MD.js → chunk-PM2UO433.js} +60 -13
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-S75HFRLD.js → chunk-STGFILDE.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +244 -158
- 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/vendor/linkque-agent-appwrite-integrate/package.json +1 -1
- package/worker.js +331 -189
package/linkquejs.js
CHANGED
|
@@ -23871,6 +23871,14 @@ var ETelemetryAttribute;
|
|
|
23871
23871
|
ETelemetryAttribute2["HARNESS_MODEL_PURPOSE"] = "harness.model.purpose";
|
|
23872
23872
|
ETelemetryAttribute2["HARNESS_MODEL_INVOCATION_COUNT"] = "harness.model.invocation_count";
|
|
23873
23873
|
ETelemetryAttribute2["GEN_AI_TOOL_NAME"] = "gen_ai.tool.name";
|
|
23874
|
+
ETelemetryAttribute2["LINKQUE_TOOL_DISPLAY_NAME"] = "linkque.tool.display_name";
|
|
23875
|
+
ETelemetryAttribute2["LINKQUE_CARD_EXECUTION_ID"] = "linkque.card.execution_id";
|
|
23876
|
+
ETelemetryAttribute2["LINKQUE_CARD_REF"] = "linkque.card.ref";
|
|
23877
|
+
ETelemetryAttribute2["LINKQUE_CARD_REVISION"] = "linkque.card.revision";
|
|
23878
|
+
ETelemetryAttribute2["LINKQUE_CARD_DISPLAY_NAME"] = "linkque.card.display_name";
|
|
23879
|
+
ETelemetryAttribute2["LINKQUE_CARD_PHASE"] = "linkque.card.phase";
|
|
23880
|
+
ETelemetryAttribute2["LINKQUE_CARD_SOURCE_ID"] = "linkque.card.source_id";
|
|
23881
|
+
ETelemetryAttribute2["LINKQUE_CARD_DELIVERY"] = "linkque.card.delivery";
|
|
23874
23882
|
ETelemetryAttribute2["GEN_AI_TOOL_CALL_ID"] = "gen_ai.tool.call.id";
|
|
23875
23883
|
ETelemetryAttribute2["HARNESS_TOOL_RESULT_STATUS"] = "harness.tool.result.status";
|
|
23876
23884
|
ETelemetryAttribute2["LINKQUE_TOOL_FAILURE_STAGE"] = "linkque.tool.failure_stage";
|
|
@@ -23964,6 +23972,7 @@ var ETelemetryEventName;
|
|
|
23964
23972
|
ETelemetryEventName2["HOOK_DRAIN_STARTED"] = "linkque.hook.drain.started";
|
|
23965
23973
|
ETelemetryEventName2["HOOK_DRAIN_FINISHED"] = "linkque.hook.drain.finished";
|
|
23966
23974
|
ETelemetryEventName2["CONTENT_RECORDED"] = "linkque.content.recorded";
|
|
23975
|
+
ETelemetryEventName2["TOOL_CONTEXT"] = "linkque.tool.context";
|
|
23967
23976
|
})(ETelemetryEventName || (ETelemetryEventName = {}));
|
|
23968
23977
|
var ETelemetryContentSection;
|
|
23969
23978
|
(function(ETelemetryContentSection2) {
|
|
@@ -34531,6 +34540,14 @@ var allowedAttributeKeys = /* @__PURE__ */ new Set([
|
|
|
34531
34540
|
ETelemetryAttribute.HARNESS_MODEL_PURPOSE,
|
|
34532
34541
|
ETelemetryAttribute.HARNESS_MODEL_INVOCATION_COUNT,
|
|
34533
34542
|
ETelemetryAttribute.GEN_AI_TOOL_NAME,
|
|
34543
|
+
ETelemetryAttribute.LINKQUE_TOOL_DISPLAY_NAME,
|
|
34544
|
+
ETelemetryAttribute.LINKQUE_CARD_EXECUTION_ID,
|
|
34545
|
+
ETelemetryAttribute.LINKQUE_CARD_REF,
|
|
34546
|
+
ETelemetryAttribute.LINKQUE_CARD_REVISION,
|
|
34547
|
+
ETelemetryAttribute.LINKQUE_CARD_DISPLAY_NAME,
|
|
34548
|
+
ETelemetryAttribute.LINKQUE_CARD_PHASE,
|
|
34549
|
+
ETelemetryAttribute.LINKQUE_CARD_SOURCE_ID,
|
|
34550
|
+
ETelemetryAttribute.LINKQUE_CARD_DELIVERY,
|
|
34534
34551
|
ETelemetryAttribute.GEN_AI_TOOL_CALL_ID,
|
|
34535
34552
|
ETelemetryAttribute.HARNESS_TOOL_RESULT_STATUS,
|
|
34536
34553
|
ETelemetryAttribute.LINKQUE_TOOL_FAILURE_STAGE,
|
|
@@ -42149,33 +42166,60 @@ var unzipArchive = (cwd, input, output) => new SourceArchiveExtractor(cwd, input
|
|
|
42149
42166
|
|
|
42150
42167
|
// ../linkque-agent-runtime-trace/dist/esm/utils.js
|
|
42151
42168
|
var decodeAnyValue = (value) => {
|
|
42152
|
-
if (
|
|
42169
|
+
if (value === void 0 || value === null)
|
|
42153
42170
|
return void 0;
|
|
42154
|
-
if (value
|
|
42171
|
+
if (typeof value !== "object" || Array.isArray(value))
|
|
42172
|
+
throw new TypeError("Invalid OTLP AnyValue");
|
|
42173
|
+
if (value.stringValue !== void 0) {
|
|
42174
|
+
if (typeof value.stringValue !== "string")
|
|
42175
|
+
throw new TypeError("Invalid OTLP string");
|
|
42155
42176
|
return value.stringValue;
|
|
42156
|
-
|
|
42157
|
-
|
|
42158
|
-
|
|
42177
|
+
}
|
|
42178
|
+
if (value.intValue !== void 0) {
|
|
42179
|
+
if (!/^-?[0-9]+$/.test(String(value.intValue)))
|
|
42180
|
+
throw new TypeError("Invalid OTLP integer");
|
|
42181
|
+
const number4 = Number(value.intValue);
|
|
42182
|
+
if (!Number.isFinite(number4))
|
|
42183
|
+
throw new TypeError("Invalid OTLP integer");
|
|
42184
|
+
return number4;
|
|
42185
|
+
}
|
|
42186
|
+
if (value.doubleValue !== void 0) {
|
|
42187
|
+
if (typeof value.doubleValue !== "number" || !Number.isFinite(value.doubleValue))
|
|
42188
|
+
throw new TypeError("Invalid OTLP number");
|
|
42159
42189
|
return value.doubleValue;
|
|
42160
|
-
|
|
42190
|
+
}
|
|
42191
|
+
if (value.boolValue !== void 0) {
|
|
42192
|
+
if (typeof value.boolValue !== "boolean")
|
|
42193
|
+
throw new TypeError("Invalid OTLP boolean");
|
|
42161
42194
|
return value.boolValue;
|
|
42162
|
-
|
|
42195
|
+
}
|
|
42196
|
+
if (value.bytesValue !== void 0) {
|
|
42197
|
+
if (typeof value.bytesValue !== "string")
|
|
42198
|
+
throw new TypeError("Invalid OTLP bytes");
|
|
42163
42199
|
return { __otlpBytes: true, base64: value.bytesValue };
|
|
42200
|
+
}
|
|
42164
42201
|
if (value.arrayValue)
|
|
42165
42202
|
return value.arrayValue.values.map((child) => decodeAnyValue(child));
|
|
42166
42203
|
if (value.kvlistValue) {
|
|
42167
|
-
const record2 =
|
|
42168
|
-
for (const { key, value: child } of value.kvlistValue.values)
|
|
42204
|
+
const record2 = /* @__PURE__ */ Object.create(null);
|
|
42205
|
+
for (const { key, value: child } of value.kvlistValue.values) {
|
|
42206
|
+
if (typeof key !== "string")
|
|
42207
|
+
throw new TypeError("Invalid OTLP key");
|
|
42169
42208
|
record2[key] = decodeAnyValue(child);
|
|
42209
|
+
}
|
|
42170
42210
|
return record2;
|
|
42171
42211
|
}
|
|
42172
42212
|
return void 0;
|
|
42173
42213
|
};
|
|
42174
42214
|
var decodeAttributes = (attrs) => {
|
|
42175
|
-
const out =
|
|
42176
|
-
if (
|
|
42215
|
+
const out = /* @__PURE__ */ Object.create(null);
|
|
42216
|
+
if (attrs === void 0 || attrs === null)
|
|
42177
42217
|
return out;
|
|
42218
|
+
if (!Array.isArray(attrs))
|
|
42219
|
+
throw new TypeError("Invalid OTLP attributes");
|
|
42178
42220
|
for (const { key, value } of attrs) {
|
|
42221
|
+
if (typeof key !== "string")
|
|
42222
|
+
throw new TypeError("Invalid OTLP attribute key");
|
|
42179
42223
|
const decoded = decodeAnyValue(value);
|
|
42180
42224
|
if (decoded !== void 0)
|
|
42181
42225
|
out[key] = decoded;
|
|
@@ -42186,13 +42230,36 @@ var nanoToMs = (nano) => {
|
|
|
42186
42230
|
if (!nano || !/^[0-9]+$/.test(nano))
|
|
42187
42231
|
return void 0;
|
|
42188
42232
|
try {
|
|
42189
|
-
|
|
42233
|
+
const milliseconds = Number(BigInt(nano) / 1000000n);
|
|
42234
|
+
return Number.isSafeInteger(milliseconds) ? milliseconds : void 0;
|
|
42190
42235
|
} catch {
|
|
42191
42236
|
return void 0;
|
|
42192
42237
|
}
|
|
42193
42238
|
};
|
|
42194
42239
|
|
|
42195
42240
|
// ../linkque-agent-runtime-trace/dist/esm/decode.js
|
|
42241
|
+
function validateMetadata(attrs) {
|
|
42242
|
+
for (const key of [
|
|
42243
|
+
ETelemetryAttribute.LINKQUE_OPERATION_NAME,
|
|
42244
|
+
ETelemetryAttribute.LINKQUE_OPERATION_PARENT_ID,
|
|
42245
|
+
"gen_ai.request.model"
|
|
42246
|
+
]) {
|
|
42247
|
+
if (attrs[key] !== void 0 && typeof attrs[key] !== "string")
|
|
42248
|
+
throw new TypeError(`Invalid ${key}`);
|
|
42249
|
+
}
|
|
42250
|
+
for (const key of [
|
|
42251
|
+
"gen_ai.usage.input_tokens",
|
|
42252
|
+
"gen_ai.usage.output_tokens",
|
|
42253
|
+
"gen_ai.usage.total_tokens"
|
|
42254
|
+
]) {
|
|
42255
|
+
const value = attrs[key];
|
|
42256
|
+
if (value !== void 0 && (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0))
|
|
42257
|
+
throw new TypeError(`Invalid ${key}`);
|
|
42258
|
+
}
|
|
42259
|
+
const reasons = attrs[ETelemetryAttribute.GEN_AI_RESPONSE_FINISH_REASONS];
|
|
42260
|
+
if (reasons !== void 0 && (!Array.isArray(reasons) || reasons.some((value) => typeof value !== "string")))
|
|
42261
|
+
throw new TypeError("Invalid finish reasons");
|
|
42262
|
+
}
|
|
42196
42263
|
var strAttr = (attrs, key) => {
|
|
42197
42264
|
const value = attrs[key];
|
|
42198
42265
|
return typeof value === "string" && value !== "" ? value : void 0;
|
|
@@ -42212,12 +42279,26 @@ var identityFromAttributes = (source, attrs, span) => {
|
|
|
42212
42279
|
};
|
|
42213
42280
|
var decodeLogRecord = (source, record2, byteRange, push) => {
|
|
42214
42281
|
const attributes = decodeAttributes(record2.attributes);
|
|
42282
|
+
validateMetadata(attributes);
|
|
42215
42283
|
const rawName = record2.eventName ?? record2.name;
|
|
42216
42284
|
const name = typeof rawName === "string" && rawName ? rawName : void 0;
|
|
42217
42285
|
const identity = identityFromAttributes(source, attributes);
|
|
42218
42286
|
const startedAt = nanoToMs(record2.timeUnixNano);
|
|
42219
42287
|
const outcome = strAttr(attributes, ETelemetryAttribute.HARNESS_OPERATION_OUTCOME);
|
|
42220
42288
|
const body = record2.body !== void 0 ? decodeAnyValue(record2.body) : void 0;
|
|
42289
|
+
if (name === "linkque.content.recorded") {
|
|
42290
|
+
if (!body || typeof body !== "object" || Array.isArray(body))
|
|
42291
|
+
throw new TypeError("Invalid content envelope");
|
|
42292
|
+
const content = body;
|
|
42293
|
+
if (typeof content.section !== "string" || !content.section)
|
|
42294
|
+
throw new TypeError("Invalid content section");
|
|
42295
|
+
if (content.valueJson !== void 0 && typeof content.valueJson !== "string")
|
|
42296
|
+
throw new TypeError("Invalid encoded content");
|
|
42297
|
+
if (content.chunkIndex !== void 0 && (typeof content.chunkIndex !== "number" || !Number.isSafeInteger(content.chunkIndex) || content.chunkIndex < 0))
|
|
42298
|
+
throw new TypeError("Invalid content chunk");
|
|
42299
|
+
if (content.final !== void 0 && typeof content.final !== "boolean")
|
|
42300
|
+
throw new TypeError("Invalid content terminal");
|
|
42301
|
+
}
|
|
42221
42302
|
if (body && typeof body === "object" && "valueJson" in body) {
|
|
42222
42303
|
const content = body;
|
|
42223
42304
|
try {
|
|
@@ -42240,9 +42321,10 @@ var decodeLogRecord = (source, record2, byteRange, push) => {
|
|
|
42240
42321
|
};
|
|
42241
42322
|
var decodeSpan = (source, span, byteRange, push) => {
|
|
42242
42323
|
const attributes = decodeAttributes(span.attributes);
|
|
42324
|
+
validateMetadata(attributes);
|
|
42243
42325
|
const spanId = {
|
|
42244
|
-
traceId: span.traceId,
|
|
42245
|
-
spanId: span.spanId
|
|
42326
|
+
traceId: typeof span.traceId === "string" ? span.traceId : void 0,
|
|
42327
|
+
spanId: typeof span.spanId === "string" ? span.spanId : void 0
|
|
42246
42328
|
};
|
|
42247
42329
|
const identity = identityFromAttributes(source, attributes, spanId);
|
|
42248
42330
|
const startedAt = nanoToMs(span.startTimeUnixNano);
|
|
@@ -42274,7 +42356,10 @@ var decodeSpan = (source, span, byteRange, push) => {
|
|
|
42274
42356
|
const events = span.events;
|
|
42275
42357
|
if (Array.isArray(events)) {
|
|
42276
42358
|
for (const event of events) {
|
|
42359
|
+
if (!event || typeof event.name !== "string")
|
|
42360
|
+
throw new TypeError("Invalid span event");
|
|
42277
42361
|
const eventAttributes = decodeAttributes(event.attributes);
|
|
42362
|
+
validateMetadata(eventAttributes);
|
|
42278
42363
|
for (const key of [
|
|
42279
42364
|
ETelemetryAttribute.HARNESS_ADVANCE_ID,
|
|
42280
42365
|
ETelemetryAttribute.LINKQUE_CONVERSATION_ID,
|
|
@@ -42304,46 +42389,44 @@ function decodeOtlpLine(line, source, byteRange) {
|
|
|
42304
42389
|
} catch {
|
|
42305
42390
|
return { facts: [], warnings: ["json_parse_failed"] };
|
|
42306
42391
|
}
|
|
42307
|
-
if (!json || typeof json !== "object") {
|
|
42392
|
+
if (!json || typeof json !== "object" || Array.isArray(json)) {
|
|
42308
42393
|
return { facts: [], warnings: ["not_an_object"] };
|
|
42309
42394
|
}
|
|
42310
42395
|
const root = json;
|
|
42311
42396
|
const facts = [];
|
|
42312
|
-
const
|
|
42313
|
-
|
|
42314
|
-
|
|
42315
|
-
|
|
42316
|
-
|
|
42317
|
-
if (Array.isArray(resourceLogs)) {
|
|
42318
|
-
for (const entry of resourceLogs) {
|
|
42319
|
-
if (!entry || typeof entry !== "object")
|
|
42320
|
-
continue;
|
|
42321
|
-
for (const scope of entry.scopeLogs ?? []) {
|
|
42322
|
-
if (!scope || typeof scope !== "object")
|
|
42323
|
-
continue;
|
|
42324
|
-
for (const record2 of scope.logRecords ?? [])
|
|
42325
|
-
decodeLogRecord(source, record2, byteRange, push);
|
|
42326
|
-
}
|
|
42327
|
-
}
|
|
42328
|
-
} else {
|
|
42329
|
-
warnings.push("logs_without_resourceLogs");
|
|
42397
|
+
const objects = (value, label) => {
|
|
42398
|
+
if (!Array.isArray(value)) {
|
|
42399
|
+
if (value !== void 0)
|
|
42400
|
+
warnings.push(`invalid_${label}`);
|
|
42401
|
+
return [];
|
|
42330
42402
|
}
|
|
42403
|
+
return value.filter((item) => {
|
|
42404
|
+
if (item && typeof item === "object" && !Array.isArray(item))
|
|
42405
|
+
return true;
|
|
42406
|
+
warnings.push(`invalid_${label}_entry`);
|
|
42407
|
+
return false;
|
|
42408
|
+
});
|
|
42409
|
+
};
|
|
42410
|
+
const logs = source === "logs";
|
|
42411
|
+
const resourceKey = logs ? "resourceLogs" : "resourceSpans";
|
|
42412
|
+
const scopeKey = logs ? "scopeLogs" : "scopeSpans";
|
|
42413
|
+
const recordKey = logs ? "logRecords" : "spans";
|
|
42414
|
+
if (!Array.isArray(root[resourceKey])) {
|
|
42415
|
+
warnings.push(logs ? "logs_without_resourceLogs" : "traces_without_resourceSpans");
|
|
42331
42416
|
return { facts, warnings };
|
|
42332
42417
|
}
|
|
42333
|
-
const
|
|
42334
|
-
|
|
42335
|
-
|
|
42336
|
-
|
|
42337
|
-
|
|
42338
|
-
|
|
42339
|
-
|
|
42340
|
-
|
|
42341
|
-
|
|
42342
|
-
|
|
42418
|
+
for (const resource of objects(root[resourceKey], resourceKey)) {
|
|
42419
|
+
for (const scope of objects(resource[scopeKey], scopeKey)) {
|
|
42420
|
+
for (const record2 of objects(scope[recordKey], recordKey)) {
|
|
42421
|
+
const decoded = [];
|
|
42422
|
+
try {
|
|
42423
|
+
(logs ? decodeLogRecord : decodeSpan)(source, record2, byteRange, (fact) => decoded.push(fact));
|
|
42424
|
+
facts.push(...decoded);
|
|
42425
|
+
} catch {
|
|
42426
|
+
warnings.push(`invalid_${recordKey}_record`);
|
|
42427
|
+
}
|
|
42343
42428
|
}
|
|
42344
42429
|
}
|
|
42345
|
-
} else {
|
|
42346
|
-
warnings.push("traces_without_resourceSpans");
|
|
42347
42430
|
}
|
|
42348
42431
|
return { facts, warnings };
|
|
42349
42432
|
}
|
|
@@ -42380,7 +42463,7 @@ var buildOperations = (facts) => {
|
|
|
42380
42463
|
const operations = [];
|
|
42381
42464
|
const relations = [];
|
|
42382
42465
|
for (const group of groups.values()) {
|
|
42383
|
-
const attrs =
|
|
42466
|
+
const attrs = /* @__PURE__ */ Object.create(null);
|
|
42384
42467
|
for (const fact of group)
|
|
42385
42468
|
Object.assign(attrs, fact.attributes);
|
|
42386
42469
|
const starts = group.filter((f3) => f3.kind === "span" || f3.name?.endsWith(".started")).map((f3) => f3.startedAt).filter((n3) => n3 !== void 0);
|
|
@@ -42410,7 +42493,10 @@ var buildOperations = (facts) => {
|
|
|
42410
42493
|
relation: "parent"
|
|
42411
42494
|
});
|
|
42412
42495
|
}
|
|
42413
|
-
const spanOperations = new Map(facts.filter((f3) => f3.kind === "span" && f3.identity.operationId).map((f3) => [
|
|
42496
|
+
const spanOperations = new Map(facts.filter((f3) => f3.kind === "span" && f3.identity.operationId).map((f3) => [
|
|
42497
|
+
`${f3.identity.traceId}:${f3.identity.spanId}`,
|
|
42498
|
+
f3.identity.operationId
|
|
42499
|
+
]));
|
|
42414
42500
|
const linkKeys = /* @__PURE__ */ new Set();
|
|
42415
42501
|
for (const fact of facts) {
|
|
42416
42502
|
if (!fact.identity.operationId)
|
|
@@ -42423,7 +42509,11 @@ var buildOperations = (facts) => {
|
|
|
42423
42509
|
if (linkKeys.has(key))
|
|
42424
42510
|
continue;
|
|
42425
42511
|
linkKeys.add(key);
|
|
42426
|
-
relations.push({
|
|
42512
|
+
relations.push({
|
|
42513
|
+
fromOperationId: source,
|
|
42514
|
+
toOperationId: fact.identity.operationId,
|
|
42515
|
+
relation: link3.relation
|
|
42516
|
+
});
|
|
42427
42517
|
}
|
|
42428
42518
|
}
|
|
42429
42519
|
operations.sort((a, b3) => (a.startedAt ?? Infinity) - (b3.startedAt ?? Infinity) || a.operationId.localeCompare(b3.operationId));
|
|
@@ -42515,9 +42605,17 @@ ${body.section}`;
|
|
|
42515
42605
|
...operationId ? { operationId } : {},
|
|
42516
42606
|
section: body.section,
|
|
42517
42607
|
contentRef,
|
|
42608
|
+
...body.reason === "content_limit" ? { reason: "content_limit" } : {},
|
|
42518
42609
|
valueDigest: (0, import_node_crypto2.createHash)("sha256").update(JSON.stringify(body.value) ?? "").digest("hex"),
|
|
42519
42610
|
...body.value && typeof body.value === "object" && (body.section.endsWith(".output") || body.section === "knowledge.input") ? {
|
|
42520
|
-
result: Object.fromEntries(Object.entries(body.value).filter(([key, value]) => [
|
|
42611
|
+
result: Object.fromEntries(Object.entries(body.value).filter(([key, value]) => [
|
|
42612
|
+
"status",
|
|
42613
|
+
"name",
|
|
42614
|
+
"isError",
|
|
42615
|
+
"action",
|
|
42616
|
+
"server",
|
|
42617
|
+
"knowledgeBaseId"
|
|
42618
|
+
].includes(key) && ["string", "boolean"].includes(typeof value)))
|
|
42521
42619
|
} : {},
|
|
42522
42620
|
availability: body.availability === "available" ? "available" : body.availability === "partial" ? "partial" : body.availability === "unavailable" ? "unavailable" : "not_recorded"
|
|
42523
42621
|
});
|
|
@@ -42532,7 +42630,12 @@ ${body.section}`;
|
|
|
42532
42630
|
byKey.set(key, {
|
|
42533
42631
|
operationId,
|
|
42534
42632
|
section: "model.output",
|
|
42535
|
-
contentRef: {
|
|
42633
|
+
contentRef: {
|
|
42634
|
+
advanceId,
|
|
42635
|
+
operationId,
|
|
42636
|
+
section: "model.output",
|
|
42637
|
+
recordIds: chunks.map((chunk) => chunk.identity.recordId)
|
|
42638
|
+
},
|
|
42536
42639
|
availability: complete ? "available" : "partial"
|
|
42537
42640
|
});
|
|
42538
42641
|
}
|
package/package.json
CHANGED
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-CLYLJ5MD.js → chunk-PM2UO433.js}
RENAMED
|
@@ -26120,6 +26120,14 @@ var ETelemetryAttribute;
|
|
|
26120
26120
|
ETelemetryAttribute2["HARNESS_MODEL_PURPOSE"] = "harness.model.purpose";
|
|
26121
26121
|
ETelemetryAttribute2["HARNESS_MODEL_INVOCATION_COUNT"] = "harness.model.invocation_count";
|
|
26122
26122
|
ETelemetryAttribute2["GEN_AI_TOOL_NAME"] = "gen_ai.tool.name";
|
|
26123
|
+
ETelemetryAttribute2["LINKQUE_TOOL_DISPLAY_NAME"] = "linkque.tool.display_name";
|
|
26124
|
+
ETelemetryAttribute2["LINKQUE_CARD_EXECUTION_ID"] = "linkque.card.execution_id";
|
|
26125
|
+
ETelemetryAttribute2["LINKQUE_CARD_REF"] = "linkque.card.ref";
|
|
26126
|
+
ETelemetryAttribute2["LINKQUE_CARD_REVISION"] = "linkque.card.revision";
|
|
26127
|
+
ETelemetryAttribute2["LINKQUE_CARD_DISPLAY_NAME"] = "linkque.card.display_name";
|
|
26128
|
+
ETelemetryAttribute2["LINKQUE_CARD_PHASE"] = "linkque.card.phase";
|
|
26129
|
+
ETelemetryAttribute2["LINKQUE_CARD_SOURCE_ID"] = "linkque.card.source_id";
|
|
26130
|
+
ETelemetryAttribute2["LINKQUE_CARD_DELIVERY"] = "linkque.card.delivery";
|
|
26123
26131
|
ETelemetryAttribute2["GEN_AI_TOOL_CALL_ID"] = "gen_ai.tool.call.id";
|
|
26124
26132
|
ETelemetryAttribute2["HARNESS_TOOL_RESULT_STATUS"] = "harness.tool.result.status";
|
|
26125
26133
|
ETelemetryAttribute2["LINKQUE_TOOL_FAILURE_STAGE"] = "linkque.tool.failure_stage";
|
|
@@ -26213,6 +26221,7 @@ var ETelemetryEventName;
|
|
|
26213
26221
|
ETelemetryEventName2["HOOK_DRAIN_STARTED"] = "linkque.hook.drain.started";
|
|
26214
26222
|
ETelemetryEventName2["HOOK_DRAIN_FINISHED"] = "linkque.hook.drain.finished";
|
|
26215
26223
|
ETelemetryEventName2["CONTENT_RECORDED"] = "linkque.content.recorded";
|
|
26224
|
+
ETelemetryEventName2["TOOL_CONTEXT"] = "linkque.tool.context";
|
|
26216
26225
|
})(ETelemetryEventName || (ETelemetryEventName = {}));
|
|
26217
26226
|
var ETelemetryContentSection;
|
|
26218
26227
|
(function(ETelemetryContentSection2) {
|
|
@@ -26602,18 +26611,14 @@ var McpProxyTool = class {
|
|
|
26602
26611
|
if (params.server !== void 0) {
|
|
26603
26612
|
return this.executeList(params.server, signal, context2);
|
|
26604
26613
|
}
|
|
26605
|
-
return this.executeStatus();
|
|
26614
|
+
return this.executeStatus(context2);
|
|
26606
26615
|
}
|
|
26607
26616
|
/** 保留代理动作事实,不改变供模型消费的原始返回值。 */
|
|
26608
26617
|
recordAction(context2, action, status, data = {}) {
|
|
26609
|
-
recordContentSection(context2?.observation, ETelemetryContentSection.MCP_ACTION_OUTPUT, {
|
|
26610
|
-
action,
|
|
26611
|
-
status,
|
|
26612
|
-
...data
|
|
26613
|
-
});
|
|
26618
|
+
recordContentSection(context2?.observation, ETelemetryContentSection.MCP_ACTION_OUTPUT, { action, status, ...data });
|
|
26614
26619
|
}
|
|
26615
26620
|
/** `mcp({})` / `mcp({ status: true })`:列各 server 连接状态 + 工具数。 */
|
|
26616
|
-
executeStatus() {
|
|
26621
|
+
executeStatus(context2) {
|
|
26617
26622
|
const lines = [];
|
|
26618
26623
|
let connected = 0;
|
|
26619
26624
|
let totalTools = 0;
|
|
@@ -26632,6 +26637,13 @@ var McpProxyTool = class {
|
|
|
26632
26637
|
lines.push(`\u2717 ${label} (failed${entry.error ? ": " + entry.error : ""})`);
|
|
26633
26638
|
}
|
|
26634
26639
|
}
|
|
26640
|
+
this.recordAction(context2, "status", "completed", {
|
|
26641
|
+
servers: this.specs.map((spec) => ({
|
|
26642
|
+
name: spec.serverName,
|
|
26643
|
+
status: this.entries.get(spec.serverName)?.status ?? "not_connected",
|
|
26644
|
+
toolCount: this.entries.get(spec.serverName)?.tools.length ?? 0
|
|
26645
|
+
}))
|
|
26646
|
+
});
|
|
26635
26647
|
const header = `MCP: ${connected}/${this.specs.length} servers, ${totalTools} tools`;
|
|
26636
26648
|
const hint = this.specs.length > 0 ? '\nmcp({ server: "name" }) to list tools, mcp({ search: "..." }) to search, mcp({ tool: "...", args: {...} }) to call' : "\n(no MCP resources configured)";
|
|
26637
26649
|
return `${header}
|
|
@@ -26648,12 +26660,20 @@ ${lines.join("\n")}${hint}`.trim();
|
|
|
26648
26660
|
this.entries.delete(spec.serverName);
|
|
26649
26661
|
const entry = await this.ensureEntry(spec.serverName, signal);
|
|
26650
26662
|
if (!entry) {
|
|
26651
|
-
this.recordAction(context2, "connect", "failed", {
|
|
26663
|
+
this.recordAction(context2, "connect", "failed", {
|
|
26664
|
+
server: spec.serverName
|
|
26665
|
+
});
|
|
26652
26666
|
const failed = this.entries.get(spec.serverName);
|
|
26653
26667
|
const detail = failed?.error ? `: ${failed.error}` : "";
|
|
26654
26668
|
return `Failed to connect to "${spec.serverName}"${detail}.`;
|
|
26655
26669
|
}
|
|
26656
|
-
this.recordAction(context2, "connect", "matched", {
|
|
26670
|
+
this.recordAction(context2, "connect", "matched", {
|
|
26671
|
+
server: spec.serverName,
|
|
26672
|
+
tools: entry.tools.map((tool) => ({
|
|
26673
|
+
name: tool.name,
|
|
26674
|
+
description: tool.description
|
|
26675
|
+
}))
|
|
26676
|
+
});
|
|
26657
26677
|
return this.formatToolList(spec.serverName, entry.tools);
|
|
26658
26678
|
}
|
|
26659
26679
|
/** `mcp({ server: "name" })`:列该 server 工具名 + 截断 description。 */
|
|
@@ -26668,7 +26688,13 @@ ${lines.join("\n")}${hint}`.trim();
|
|
|
26668
26688
|
this.recordAction(context2, "list", "failed", { server: spec.serverName });
|
|
26669
26689
|
return `Server "${spec.serverName}" is not connected. Use mcp({ connect: "${spec.serverName}" }) to retry.`;
|
|
26670
26690
|
}
|
|
26671
|
-
this.recordAction(context2, "list", "matched", {
|
|
26691
|
+
this.recordAction(context2, "list", "matched", {
|
|
26692
|
+
server: spec.serverName,
|
|
26693
|
+
tools: entry.tools.map((tool) => ({
|
|
26694
|
+
name: tool.name,
|
|
26695
|
+
description: tool.description
|
|
26696
|
+
}))
|
|
26697
|
+
});
|
|
26672
26698
|
return this.formatToolList(spec.serverName, entry.tools);
|
|
26673
26699
|
}
|
|
26674
26700
|
/** `mcp({ search: "query" })`:空格分词 OR 子串匹配 name/description(跨所有 server)。 */
|
|
@@ -26690,9 +26716,18 @@ ${lines.join("\n")}${hint}`.trim();
|
|
|
26690
26716
|
}
|
|
26691
26717
|
}
|
|
26692
26718
|
}
|
|
26693
|
-
const tools = matches.map(({ server, tool }) => ({
|
|
26719
|
+
const tools = matches.map(({ server, tool }) => ({
|
|
26720
|
+
server,
|
|
26721
|
+
name: tool.name,
|
|
26722
|
+
description: tool.description,
|
|
26723
|
+
inputSchema: tool.inputSchema
|
|
26724
|
+
}));
|
|
26694
26725
|
if (matches.length === 0) {
|
|
26695
|
-
return {
|
|
26726
|
+
return {
|
|
26727
|
+
query,
|
|
26728
|
+
tools,
|
|
26729
|
+
text: serverHint ? `No tools matching "${query}" in "${serverHint}"` : `No tools matching "${query}"`
|
|
26730
|
+
};
|
|
26696
26731
|
}
|
|
26697
26732
|
const lines = [`Found ${matches.length} tool(s) matching "${query}":`, ""];
|
|
26698
26733
|
for (const { server, tool } of matches) {
|
|
@@ -26729,7 +26764,11 @@ ${result.text}`).join("\n\n");
|
|
|
26729
26764
|
return `Tool "${toolName}" not found. Use mcp({ search: "..." }) to search.`;
|
|
26730
26765
|
}
|
|
26731
26766
|
const { server, tool } = found;
|
|
26732
|
-
this.recordAction(context2, "describe", "matched", {
|
|
26767
|
+
this.recordAction(context2, "describe", "matched", {
|
|
26768
|
+
server,
|
|
26769
|
+
name: tool.name,
|
|
26770
|
+
inputSchema: tool.inputSchema
|
|
26771
|
+
});
|
|
26733
26772
|
const lines = [
|
|
26734
26773
|
`${tool.name}`,
|
|
26735
26774
|
`Server: ${server}`,
|
|
@@ -37750,6 +37789,14 @@ var allowedAttributeKeys = /* @__PURE__ */ new Set([
|
|
|
37750
37789
|
ETelemetryAttribute.HARNESS_MODEL_PURPOSE,
|
|
37751
37790
|
ETelemetryAttribute.HARNESS_MODEL_INVOCATION_COUNT,
|
|
37752
37791
|
ETelemetryAttribute.GEN_AI_TOOL_NAME,
|
|
37792
|
+
ETelemetryAttribute.LINKQUE_TOOL_DISPLAY_NAME,
|
|
37793
|
+
ETelemetryAttribute.LINKQUE_CARD_EXECUTION_ID,
|
|
37794
|
+
ETelemetryAttribute.LINKQUE_CARD_REF,
|
|
37795
|
+
ETelemetryAttribute.LINKQUE_CARD_REVISION,
|
|
37796
|
+
ETelemetryAttribute.LINKQUE_CARD_DISPLAY_NAME,
|
|
37797
|
+
ETelemetryAttribute.LINKQUE_CARD_PHASE,
|
|
37798
|
+
ETelemetryAttribute.LINKQUE_CARD_SOURCE_ID,
|
|
37799
|
+
ETelemetryAttribute.LINKQUE_CARD_DELIVERY,
|
|
37753
37800
|
ETelemetryAttribute.GEN_AI_TOOL_CALL_ID,
|
|
37754
37801
|
ETelemetryAttribute.HARNESS_TOOL_RESULT_STATUS,
|
|
37755
37802
|
ETelemetryAttribute.LINKQUE_TOOL_FAILURE_STAGE,
|