linkque-cli-v2 1.3.7 → 1.3.8-beta.1
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 +1085 -317
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-ZNU4GVF3.js → chunk-7MJID6LL.js} +103 -19
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-AACYYAZ6.js → chunk-BU3S4JYG.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-RHMVQTA7.js → chunk-EFUO43CY.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +40 -4
- 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 +150 -23
package/worker.js
CHANGED
|
@@ -12628,7 +12628,7 @@ var init_hookRegistry = __esm({
|
|
|
12628
12628
|
});
|
|
12629
12629
|
|
|
12630
12630
|
// ../linkque-agent-protocol/dist/esm/telemetry/telemetryEnums.js
|
|
12631
|
-
var ETelemetryAttribute, ETelemetryEventPrefix, ETelemetryEventPhase, ETelemetryEventName, ETelemetryOperationName, ETelemetryOutcome, ETelemetrySignal, ETelemetryLossReason, ETelemetryAdvanceOutcome, ETelemetryStreamTermination, ETelemetryCancelSource, ETelemetryObservationBoundary, ETelemetryRemoteCompletion, ETelemetryCommitStatus, ETelemetryHookMode, ETelemetryHookResult, ETelemetrySource, ETelemetryEvidence, ETelemetryCompleteness, ETelemetryCoverage, ETelemetryUsageSource, ETelemetryAttemptVisibility, ETelemetryLinkRelation, ETelemetryToolFailureStage, ETelemetryTerminalEvidence, ETelemetryTerminalSource, ETelemetryModelPurpose, ETelemetryErrorType, ETelemetrySpanKind, ETelemetryGenAiOperation, ETelemetryVersion;
|
|
12631
|
+
var ETelemetryAttribute, ETelemetryEventPrefix, ETelemetryEventPhase, ETelemetryEventName, ETelemetryContentSection, ETelemetryOperationName, ETelemetryOutcome, ETelemetrySignal, ETelemetryLossReason, ETelemetryAdvanceOutcome, ETelemetryStreamTermination, ETelemetryCancelSource, ETelemetryObservationBoundary, ETelemetryRemoteCompletion, ETelemetryCommitStatus, ETelemetryHookMode, ETelemetryHookResult, ETelemetrySource, ETelemetryEvidence, ETelemetryCompleteness, ETelemetryCoverage, ETelemetryUsageSource, ETelemetryAttemptVisibility, ETelemetryLinkRelation, ETelemetryToolFailureStage, ETelemetryTerminalEvidence, ETelemetryTerminalSource, ETelemetryModelPurpose, ETelemetryErrorType, ETelemetrySpanKind, ETelemetryGenAiOperation, ETelemetryVersion;
|
|
12632
12632
|
var init_telemetryEnums = __esm({
|
|
12633
12633
|
"../linkque-agent-protocol/dist/esm/telemetry/telemetryEnums.js"() {
|
|
12634
12634
|
"use strict";
|
|
@@ -12787,7 +12787,20 @@ var init_telemetryEnums = __esm({
|
|
|
12787
12787
|
ETelemetryEventName2["HISTORY_APPEND_FINISHED"] = "linkque.history.append.finished";
|
|
12788
12788
|
ETelemetryEventName2["HOOK_DRAIN_STARTED"] = "linkque.hook.drain.started";
|
|
12789
12789
|
ETelemetryEventName2["HOOK_DRAIN_FINISHED"] = "linkque.hook.drain.finished";
|
|
12790
|
+
ETelemetryEventName2["DEBUG_CONTENT_RECORDED"] = "linkque.debug.content.recorded";
|
|
12790
12791
|
})(ETelemetryEventName || (ETelemetryEventName = {}));
|
|
12792
|
+
(function(ETelemetryContentSection2) {
|
|
12793
|
+
ETelemetryContentSection2["QUERY_INPUT"] = "query.input";
|
|
12794
|
+
ETelemetryContentSection2["TOOL_INPUT"] = "tool.input";
|
|
12795
|
+
ETelemetryContentSection2["TOOL_OUTPUT"] = "tool.output";
|
|
12796
|
+
ETelemetryContentSection2["MCP_REQUESTED_INPUT"] = "mcp.requested_input";
|
|
12797
|
+
ETelemetryContentSection2["MCP_INPUT"] = "mcp.input";
|
|
12798
|
+
ETelemetryContentSection2["MCP_OUTPUT"] = "mcp.output";
|
|
12799
|
+
ETelemetryContentSection2["SKILL_INPUT"] = "skill.input";
|
|
12800
|
+
ETelemetryContentSection2["SKILL_OUTPUT"] = "skill.output";
|
|
12801
|
+
ETelemetryContentSection2["KNOWLEDGE_INPUT"] = "knowledge.input";
|
|
12802
|
+
ETelemetryContentSection2["KNOWLEDGE_OUTPUT"] = "knowledge.output";
|
|
12803
|
+
})(ETelemetryContentSection || (ETelemetryContentSection = {}));
|
|
12791
12804
|
(function(ETelemetryOperationName2) {
|
|
12792
12805
|
ETelemetryOperationName2["OPERATION"] = "linkque.operation";
|
|
12793
12806
|
ETelemetryOperationName2["TOOL_INVOKE"] = "harness.tool.invoke";
|
|
@@ -14185,6 +14198,17 @@ var init_linkquegwEventHookExecutor = __esm({
|
|
|
14185
14198
|
}
|
|
14186
14199
|
});
|
|
14187
14200
|
|
|
14201
|
+
// ../linkque-agent-runtime/dist/esm/core/telemetry/contentRecording.js
|
|
14202
|
+
function recordContentSection(observation, section, value, availability = "available") {
|
|
14203
|
+
observation?.record(ETelemetryEventName.DEBUG_CONTENT_RECORDED, {}, { section, value, availability });
|
|
14204
|
+
}
|
|
14205
|
+
var init_contentRecording = __esm({
|
|
14206
|
+
"../linkque-agent-runtime/dist/esm/core/telemetry/contentRecording.js"() {
|
|
14207
|
+
"use strict";
|
|
14208
|
+
init_telemetry();
|
|
14209
|
+
}
|
|
14210
|
+
});
|
|
14211
|
+
|
|
14188
14212
|
// ../linkque-agent-runtime/dist/esm/core/skillTools.js
|
|
14189
14213
|
function parseSkillFile(raw, fallbackName) {
|
|
14190
14214
|
const parsed = splitFrontmatter(raw);
|
|
@@ -14253,18 +14277,43 @@ function createActivateSkillTool(records) {
|
|
|
14253
14277
|
required: ["name"],
|
|
14254
14278
|
additionalProperties: false
|
|
14255
14279
|
},
|
|
14256
|
-
execute: async (args) => {
|
|
14280
|
+
execute: async (args, _signal, context2) => {
|
|
14257
14281
|
const name = extractName(args);
|
|
14258
|
-
|
|
14282
|
+
const startedAt = Date.now();
|
|
14283
|
+
const obs = context2?.observation;
|
|
14284
|
+
recordContentSection(obs, ETelemetryContentSection.SKILL_INPUT, { name: name ?? null });
|
|
14285
|
+
if (!name) {
|
|
14286
|
+
recordContentSection(obs, ETelemetryContentSection.SKILL_OUTPUT, {
|
|
14287
|
+
status: "failed",
|
|
14288
|
+
error: "\u7F3A\u5C11 name \u53C2\u6570",
|
|
14289
|
+
durationMs: Date.now() - startedAt
|
|
14290
|
+
});
|
|
14259
14291
|
return "\u6FC0\u6D3B\u6280\u80FD\u5931\u8D25:\u7F3A\u5C11 name \u53C2\u6570\u3002";
|
|
14292
|
+
}
|
|
14260
14293
|
if (!bodyByName.has(name)) {
|
|
14294
|
+
recordContentSection(obs, ETelemetryContentSection.SKILL_OUTPUT, {
|
|
14295
|
+
name,
|
|
14296
|
+
status: "failed",
|
|
14297
|
+
error: `\u672A\u627E\u5230\u6280\u80FD "${name}"`,
|
|
14298
|
+
durationMs: Date.now() - startedAt
|
|
14299
|
+
});
|
|
14261
14300
|
return `\u6FC0\u6D3B\u6280\u80FD\u5931\u8D25:\u672A\u627E\u5230\u6280\u80FD "${name}"\u3002\u53EF\u7528:${[...bodyByName.keys()].join(", ")}`;
|
|
14262
14301
|
}
|
|
14263
14302
|
if (activated.has(name)) {
|
|
14303
|
+
recordContentSection(obs, ETelemetryContentSection.SKILL_OUTPUT, {
|
|
14304
|
+
name,
|
|
14305
|
+
status: "already_loaded",
|
|
14306
|
+
durationMs: Date.now() - startedAt
|
|
14307
|
+
});
|
|
14264
14308
|
return `\u6280\u80FD "${name}" \u5DF2\u5728\u672C\u8F6E\u52A0\u8F7D,\u65E0\u9700\u91CD\u590D\u6FC0\u6D3B\u3002`;
|
|
14265
14309
|
}
|
|
14266
14310
|
activated.add(name);
|
|
14267
14311
|
const body = bodyByName.get(name) ?? "";
|
|
14312
|
+
recordContentSection(obs, ETelemetryContentSection.SKILL_OUTPUT, {
|
|
14313
|
+
name,
|
|
14314
|
+
status: "loaded",
|
|
14315
|
+
durationMs: Date.now() - startedAt
|
|
14316
|
+
});
|
|
14268
14317
|
return `<skill name="${escapeXml(name)}">
|
|
14269
14318
|
${body}
|
|
14270
14319
|
</skill>`;
|
|
@@ -14322,6 +14371,8 @@ var ACTIVATE_SKILL_TOOL_NAME, AVAILABLE_SKILLS_OPEN, AVAILABLE_SKILLS_CLOSE;
|
|
|
14322
14371
|
var init_skillTools = __esm({
|
|
14323
14372
|
"../linkque-agent-runtime/dist/esm/core/skillTools.js"() {
|
|
14324
14373
|
"use strict";
|
|
14374
|
+
init_telemetry();
|
|
14375
|
+
init_contentRecording();
|
|
14325
14376
|
ACTIVATE_SKILL_TOOL_NAME = "activate_skill";
|
|
14326
14377
|
AVAILABLE_SKILLS_OPEN = "<available_skills>";
|
|
14327
14378
|
AVAILABLE_SKILLS_CLOSE = "</available_skills>";
|
|
@@ -14549,7 +14600,7 @@ function createKnowledgeTools(resources, searchPort, agentId) {
|
|
|
14549
14600
|
additionalProperties: false
|
|
14550
14601
|
},
|
|
14551
14602
|
annotations: { readOnlyHint: true },
|
|
14552
|
-
execute: () => listKnowledge()
|
|
14603
|
+
execute: (_args, _signal, context2) => listKnowledge(context2)
|
|
14553
14604
|
},
|
|
14554
14605
|
{
|
|
14555
14606
|
name: KNOWLEDGE_RECALL_TOOL_NAME,
|
|
@@ -14576,24 +14627,46 @@ function createKnowledgeTools(resources, searchPort, agentId) {
|
|
|
14576
14627
|
additionalProperties: false
|
|
14577
14628
|
},
|
|
14578
14629
|
annotations: { readOnlyHint: true },
|
|
14579
|
-
execute: (args, signal) => recallKnowledge(args, signal)
|
|
14630
|
+
execute: (args, signal, context2) => recallKnowledge(args, signal, context2)
|
|
14580
14631
|
}
|
|
14581
14632
|
];
|
|
14582
|
-
async function listKnowledge() {
|
|
14583
|
-
|
|
14633
|
+
async function listKnowledge(context2) {
|
|
14634
|
+
const result = { knowledgeBases: await getKnowledgeBases() };
|
|
14635
|
+
recordContentSection(context2?.observation, ETelemetryContentSection.KNOWLEDGE_OUTPUT, {
|
|
14636
|
+
knowledgeBases: result.knowledgeBases.map((kb) => ({
|
|
14637
|
+
knowledgeBaseId: kb.knowledgeBaseId,
|
|
14638
|
+
knowledgeDesc: kb.knowledgeDesc
|
|
14639
|
+
}))
|
|
14640
|
+
});
|
|
14641
|
+
return result;
|
|
14584
14642
|
}
|
|
14585
|
-
async function recallKnowledge(args, signal) {
|
|
14643
|
+
async function recallKnowledge(args, signal, context2) {
|
|
14586
14644
|
const parsed = parseRecallArgs(args);
|
|
14645
|
+
const obs = context2?.observation;
|
|
14587
14646
|
if ("error" in parsed) {
|
|
14647
|
+
recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_INPUT, {
|
|
14648
|
+
error: parsed.error
|
|
14649
|
+
});
|
|
14650
|
+
recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_OUTPUT, {
|
|
14651
|
+
hits: [],
|
|
14652
|
+
error: parsed.error
|
|
14653
|
+
});
|
|
14588
14654
|
return { hits: [], error: parsed.error };
|
|
14589
14655
|
}
|
|
14656
|
+
recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_INPUT, {
|
|
14657
|
+
knowledgeBaseId: parsed.knowledgeBaseId,
|
|
14658
|
+
query: parsed.query,
|
|
14659
|
+
topK: parsed.topK
|
|
14660
|
+
});
|
|
14590
14661
|
const knowledgeBases = await getKnowledgeBases();
|
|
14591
14662
|
const bound = knowledgeBases.some((info) => info.knowledgeBaseId === parsed.knowledgeBaseId);
|
|
14592
14663
|
if (!bound) {
|
|
14593
|
-
|
|
14664
|
+
const error40 = `knowledgeBaseId \u672A\u7ED1\u5B9A: ${parsed.knowledgeBaseId}\u3002\u8BF7\u5148\u8C03\u7528 knowledge_list \u67E5\u770B\u53EF\u7528\u77E5\u8BC6\u5E93\u3002`;
|
|
14665
|
+
recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_OUTPUT, {
|
|
14594
14666
|
hits: [],
|
|
14595
|
-
error:
|
|
14596
|
-
};
|
|
14667
|
+
error: error40
|
|
14668
|
+
});
|
|
14669
|
+
return { hits: [], error: error40 };
|
|
14597
14670
|
}
|
|
14598
14671
|
try {
|
|
14599
14672
|
const result = await searchPort.search({
|
|
@@ -14602,10 +14675,18 @@ function createKnowledgeTools(resources, searchPort, agentId) {
|
|
|
14602
14675
|
agentId,
|
|
14603
14676
|
topK: parsed.topK
|
|
14604
14677
|
}, signal);
|
|
14678
|
+
recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_OUTPUT, {
|
|
14679
|
+
hits: result.hits
|
|
14680
|
+
});
|
|
14605
14681
|
return { hits: result.hits };
|
|
14606
14682
|
} catch (e2) {
|
|
14607
14683
|
const msg = e2 instanceof Error ? e2.message : String(e2);
|
|
14608
|
-
|
|
14684
|
+
const error40 = `\u77E5\u8BC6\u5E93\u68C0\u7D22\u5931\u8D25: ${msg}`;
|
|
14685
|
+
recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_OUTPUT, {
|
|
14686
|
+
hits: [],
|
|
14687
|
+
error: error40
|
|
14688
|
+
});
|
|
14689
|
+
return { hits: [], error: error40 };
|
|
14609
14690
|
}
|
|
14610
14691
|
}
|
|
14611
14692
|
async function getKnowledgeBases() {
|
|
@@ -14619,6 +14700,8 @@ var init_createKnowledgeTools = __esm({
|
|
|
14619
14700
|
"../linkque-agent-runtime/dist/esm/core/createKnowledgeTools.js"() {
|
|
14620
14701
|
"use strict";
|
|
14621
14702
|
init_knowledgeTools();
|
|
14703
|
+
init_telemetry();
|
|
14704
|
+
init_contentRecording();
|
|
14622
14705
|
}
|
|
14623
14706
|
});
|
|
14624
14707
|
|
|
@@ -14649,7 +14732,7 @@ var init_noopRuntimeTelemetry = __esm({
|
|
|
14649
14732
|
startOperation(_operation) {
|
|
14650
14733
|
return this;
|
|
14651
14734
|
}
|
|
14652
|
-
record(_name, _attributes) {
|
|
14735
|
+
record(_name, _attributes, _body) {
|
|
14653
14736
|
}
|
|
14654
14737
|
finish(_outcome, _attributes) {
|
|
14655
14738
|
}
|
|
@@ -14747,7 +14830,7 @@ var init_runtimeObservation = __esm({
|
|
|
14747
14830
|
find(key) {
|
|
14748
14831
|
return this.associations.get(key);
|
|
14749
14832
|
}
|
|
14750
|
-
record(name, attributes) {
|
|
14833
|
+
record(name, attributes, body) {
|
|
14751
14834
|
if (this.abandoned)
|
|
14752
14835
|
return;
|
|
14753
14836
|
try {
|
|
@@ -14755,7 +14838,7 @@ var init_runtimeObservation = __esm({
|
|
|
14755
14838
|
this.resultAttributes = {
|
|
14756
14839
|
[ETelemetryAttribute.LINKQUE_TOOL_FAILURE_STAGE]: attributes[ETelemetryAttribute.LINKQUE_TOOL_FAILURE_STAGE]
|
|
14757
14840
|
};
|
|
14758
|
-
this.sink.record(name, attributes);
|
|
14841
|
+
this.sink.record(name, attributes, body);
|
|
14759
14842
|
} catch {
|
|
14760
14843
|
}
|
|
14761
14844
|
}
|
|
@@ -49055,8 +49138,19 @@ function observeTool(tool, observation) {
|
|
|
49055
49138
|
detached: false,
|
|
49056
49139
|
links: []
|
|
49057
49140
|
});
|
|
49141
|
+
const captureBody = !isSkillTool(tool);
|
|
49058
49142
|
try {
|
|
49059
|
-
|
|
49143
|
+
if (captureBody) {
|
|
49144
|
+
recordContentSection(operation, ETelemetryContentSection.TOOL_INPUT, args);
|
|
49145
|
+
}
|
|
49146
|
+
const execContext = {
|
|
49147
|
+
...context2 ?? { toolCallId: "", emit: () => void 0 },
|
|
49148
|
+
observation: operation
|
|
49149
|
+
};
|
|
49150
|
+
const result = await tool.execute(args, signal, execContext);
|
|
49151
|
+
if (captureBody) {
|
|
49152
|
+
recordContentSection(operation, ETelemetryContentSection.TOOL_OUTPUT, result);
|
|
49153
|
+
}
|
|
49060
49154
|
operation.finish(toolResultOutcome(result), {
|
|
49061
49155
|
[ETelemetryAttribute.HARNESS_TOOL_RESULT_STATUS]: toolResultOutcome(result)
|
|
49062
49156
|
});
|
|
@@ -49074,13 +49168,16 @@ function observeTool(tool, observation) {
|
|
|
49074
49168
|
}
|
|
49075
49169
|
};
|
|
49076
49170
|
}
|
|
49077
|
-
var import_node_crypto6;
|
|
49171
|
+
var import_node_crypto6, isSkillTool;
|
|
49078
49172
|
var init_toolObservation = __esm({
|
|
49079
49173
|
"../linkque-agent-runtime/dist/esm/core/telemetry/toolObservation.js"() {
|
|
49080
49174
|
"use strict";
|
|
49081
49175
|
init_telemetry();
|
|
49082
49176
|
init_telemetryEnums2();
|
|
49177
|
+
init_skillTools();
|
|
49083
49178
|
import_node_crypto6 = require("node:crypto");
|
|
49179
|
+
init_contentRecording();
|
|
49180
|
+
isSkillTool = (tool) => (tool.modelName ?? tool.name) === ACTIVATE_SKILL_TOOL_NAME;
|
|
49084
49181
|
}
|
|
49085
49182
|
});
|
|
49086
49183
|
|
|
@@ -207319,11 +207416,32 @@ var init_agentRuntime = __esm({
|
|
|
207319
207416
|
}
|
|
207320
207417
|
}, (observation) => this.runObservedAdvance(request, auth2, options, observation), options.signal);
|
|
207321
207418
|
}
|
|
207419
|
+
/**
|
|
207420
|
+
* 记录本次用户输入(RFC §4.1):取进入 Runtime 的本次新消息中最后一条 user message
|
|
207421
|
+
* 的 content,作为 `linkque.debug.content.recorded` 的 body 走 record 链路落入
|
|
207422
|
+
* OTLP logs(body 含 section/value/availability)。不以模型 messages 上下文为输入;
|
|
207423
|
+
* 无 user 文本(卡片交互等)时按可用性如实标记,不伪造自然语言 Query。
|
|
207424
|
+
*/
|
|
207425
|
+
recordCurrentQuery(observation, request) {
|
|
207426
|
+
let lastUser;
|
|
207427
|
+
for (const message of request.messages) {
|
|
207428
|
+
if (message.role === "user")
|
|
207429
|
+
lastUser = message;
|
|
207430
|
+
}
|
|
207431
|
+
const text2 = typeof lastUser?.content === "string" ? lastUser.content : "";
|
|
207432
|
+
const body = {
|
|
207433
|
+
section: ETelemetryContentSection.QUERY_INPUT,
|
|
207434
|
+
value: text2,
|
|
207435
|
+
availability: text2 ? "available" : "not_recorded"
|
|
207436
|
+
};
|
|
207437
|
+
observation.record(ETelemetryEventName.DEBUG_CONTENT_RECORDED, {}, body);
|
|
207438
|
+
}
|
|
207322
207439
|
async *runObservedAdvance(request, auth2, options, observation) {
|
|
207323
207440
|
observation.record(ETelemetryEventName.TELEMETRY_COVERAGE, {
|
|
207324
207441
|
[ETelemetryAttribute.LINKQUE_TELEMETRY_COVERAGE]: this.agentLoop instanceof PiAgentLoop ? ETelemetryCoverage.PI_MODEL_TOOL_HOOK : ETelemetryCoverage.CORE_ONLY,
|
|
207325
207442
|
[ETelemetryAttribute.HARNESS_TELEMETRY_COMPLETENESS]: this.agentLoop instanceof PiAgentLoop ? ETelemetryCompleteness.COMPLETE : ETelemetryCompleteness.PARTIAL
|
|
207326
207443
|
});
|
|
207444
|
+
this.recordCurrentQuery(observation, request);
|
|
207327
207445
|
const cleanup = [];
|
|
207328
207446
|
let termination = ETelemetryStreamTermination.CANCEL;
|
|
207329
207447
|
let failed = false;
|
|
@@ -214462,6 +214580,8 @@ var LinkquegwTokenVerifier = class {
|
|
|
214462
214580
|
};
|
|
214463
214581
|
|
|
214464
214582
|
// ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/remoteGatewayMcpServer.js
|
|
214583
|
+
init_telemetry();
|
|
214584
|
+
init_contentRecording();
|
|
214465
214585
|
init_types();
|
|
214466
214586
|
init_logFailure();
|
|
214467
214587
|
var defaultCreateSigner = (config2, getAuthorizationHeader, debugLog) => new RemoteSignatureSigner({
|
|
@@ -214534,6 +214654,8 @@ var RemoteGatewayMcpServerProvider = class {
|
|
|
214534
214654
|
callTool: (params, resultSchema, requestOptions) => request("tools/call", params, () => client.callTool(params, resultSchema, requestOptions))
|
|
214535
214655
|
};
|
|
214536
214656
|
const callTool = (name, args, signal, options) => callHeaders.run(options?.headers ?? {}, () => this.invocationContext.run(timeoutMs, signal, async (invocation) => {
|
|
214657
|
+
const observation = options?.context?.observation;
|
|
214658
|
+
recordContentSection(observation, ETelemetryContentSection.MCP_REQUESTED_INPUT, args);
|
|
214537
214659
|
const plan = createArgsMappingPlan(name, args, argsMappingRules);
|
|
214538
214660
|
if (plan.requiresUserId) {
|
|
214539
214661
|
if (config2.signEndpoint !== void 0 && config2.signEndpoint !== DEFAULT_SIGN_ENDPOINT && !config2.verifyTokenEndpoint?.trim())
|
|
@@ -214556,15 +214678,18 @@ var RemoteGatewayMcpServerProvider = class {
|
|
|
214556
214678
|
};
|
|
214557
214679
|
}
|
|
214558
214680
|
const mapped = resolveArgsMappingPlan(plan, invocation.auth);
|
|
214681
|
+
recordContentSection(observation, ETelemetryContentSection.MCP_INPUT, mapped);
|
|
214559
214682
|
invocation.signal.throwIfAborted();
|
|
214560
214683
|
const remaining = Math.max(1, invocation.deadline - performance.now());
|
|
214561
214684
|
try {
|
|
214562
|
-
|
|
214685
|
+
const result = await loggedClient.callTool({ name, arguments: mapped }, void 0, {
|
|
214563
214686
|
signal: invocation.signal,
|
|
214564
214687
|
timeout: remaining,
|
|
214565
214688
|
maxTotalTimeout: remaining,
|
|
214566
214689
|
resetTimeoutOnProgress: false
|
|
214567
214690
|
});
|
|
214691
|
+
recordContentSection(observation, ETelemetryContentSection.MCP_OUTPUT, result);
|
|
214692
|
+
return result;
|
|
214568
214693
|
} catch (error40) {
|
|
214569
214694
|
invocation.signal.throwIfAborted();
|
|
214570
214695
|
if (invocation.auth && !(error40 instanceof McpInvocationError))
|
|
@@ -214593,7 +214718,7 @@ async function listToolsFromClient(client, resourceId, callTool) {
|
|
|
214593
214718
|
const descriptor = {
|
|
214594
214719
|
name: tool.name,
|
|
214595
214720
|
resourceId,
|
|
214596
|
-
execute: (args, signal) => callTool(tool.name, args, signal)
|
|
214721
|
+
execute: (args, signal, context2) => callTool(tool.name, args, signal, { context: context2 })
|
|
214597
214722
|
};
|
|
214598
214723
|
if (tool.description !== void 0)
|
|
214599
214724
|
descriptor.description = tool.description;
|
|
@@ -214972,7 +215097,7 @@ var LocalHttpMcpServerProvider = class {
|
|
|
214972
215097
|
}
|
|
214973
215098
|
return body.tools.map((value) => this.createDescriptor(resource.resourceId, value));
|
|
214974
215099
|
},
|
|
214975
|
-
callTool: (name, args, signal) => this.callTool(resource.resourceId, name, args, signal)
|
|
215100
|
+
callTool: (name, args, signal, _options) => this.callTool(resource.resourceId, name, args, signal)
|
|
214976
215101
|
};
|
|
214977
215102
|
}
|
|
214978
215103
|
createDescriptor(resourceId, value) {
|
|
@@ -216517,7 +216642,7 @@ var OtelRuntimeTelemetry = class {
|
|
|
216517
216642
|
operation.record(`${spec.eventPrefix}.${ETelemetryEventPhase.STARTED}`, {});
|
|
216518
216643
|
return operation;
|
|
216519
216644
|
}
|
|
216520
|
-
emit(operation, name, attributes, critical) {
|
|
216645
|
+
emit(operation, name, attributes, critical, body) {
|
|
216521
216646
|
if (this.disposed || this.queue.isExporting)
|
|
216522
216647
|
return;
|
|
216523
216648
|
const contextAttributes = operation.attributes;
|
|
@@ -216556,6 +216681,7 @@ var OtelRuntimeTelemetry = class {
|
|
|
216556
216681
|
eventName: name,
|
|
216557
216682
|
timestamp: time3,
|
|
216558
216683
|
observedTimestamp: time3,
|
|
216684
|
+
...body !== void 0 ? { body } : {},
|
|
216559
216685
|
severityNumber: record4[ETelemetryAttribute.HARNESS_OPERATION_OUTCOME] === ETelemetryOutcome.ERROR || record4[ETelemetryAttribute.HARNESS_OPERATION_OUTCOME] === ETelemetryOutcome.TIMEOUT ? import_api_logs.SeverityNumber.ERROR : import_api_logs.SeverityNumber.INFO,
|
|
216560
216686
|
severityText: record4[ETelemetryAttribute.HARNESS_OPERATION_OUTCOME] === ETelemetryOutcome.ERROR || record4[ETelemetryAttribute.HARNESS_OPERATION_OUTCOME] === ETelemetryOutcome.TIMEOUT ? import_api_logs.SeverityNumber[import_api_logs.SeverityNumber.ERROR] : import_api_logs.SeverityNumber[import_api_logs.SeverityNumber.INFO],
|
|
216561
216687
|
attributes: record4,
|
|
@@ -216626,10 +216752,11 @@ var OtelObservation = class {
|
|
|
216626
216752
|
return new NoopRuntimeObservation();
|
|
216627
216753
|
return this.owner.createOperation(this.state, spec, this);
|
|
216628
216754
|
}
|
|
216629
|
-
record(name, attributes) {
|
|
216755
|
+
record(name, attributes, body) {
|
|
216630
216756
|
if (this.lost || !/^(harness|linkque)\.[a-z0-9_.]{1,128}$/.test(name))
|
|
216631
216757
|
return;
|
|
216632
|
-
|
|
216758
|
+
const critical = name.endsWith(`.${ETelemetryEventPhase.FINISHED}`) || name === ETelemetryEventName.MODEL_USAGE_RECORDED || name === ETelemetryEventName.RUNTIME_UNCAUGHT_ERROR || name.endsWith(`.${ETelemetryEventPhase.OBSERVATION_LOST}`);
|
|
216759
|
+
this.owner.emit(this, name, attributes, critical, body);
|
|
216633
216760
|
}
|
|
216634
216761
|
finish(outcome, attributes) {
|
|
216635
216762
|
if (this.ended)
|