linkque-cli-v2 1.3.8-beta.1 → 1.3.8
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 +337 -1086
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-BU3S4JYG.js → chunk-AACYYAZ6.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-EFUO43CY.js → chunk-RHMVQTA7.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-7MJID6LL.js → chunk-ZNU4GVF3.js} +19 -103
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +4 -40
- 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 +45 -153
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,
|
|
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;
|
|
12632
12632
|
var init_telemetryEnums = __esm({
|
|
12633
12633
|
"../linkque-agent-protocol/dist/esm/telemetry/telemetryEnums.js"() {
|
|
12634
12634
|
"use strict";
|
|
@@ -12787,20 +12787,7 @@ 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";
|
|
12791
12790
|
})(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 = {}));
|
|
12804
12791
|
(function(ETelemetryOperationName2) {
|
|
12805
12792
|
ETelemetryOperationName2["OPERATION"] = "linkque.operation";
|
|
12806
12793
|
ETelemetryOperationName2["TOOL_INVOKE"] = "harness.tool.invoke";
|
|
@@ -14198,17 +14185,6 @@ var init_linkquegwEventHookExecutor = __esm({
|
|
|
14198
14185
|
}
|
|
14199
14186
|
});
|
|
14200
14187
|
|
|
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
|
-
|
|
14212
14188
|
// ../linkque-agent-runtime/dist/esm/core/skillTools.js
|
|
14213
14189
|
function parseSkillFile(raw, fallbackName) {
|
|
14214
14190
|
const parsed = splitFrontmatter(raw);
|
|
@@ -14277,43 +14253,18 @@ function createActivateSkillTool(records) {
|
|
|
14277
14253
|
required: ["name"],
|
|
14278
14254
|
additionalProperties: false
|
|
14279
14255
|
},
|
|
14280
|
-
execute: async (args
|
|
14256
|
+
execute: async (args) => {
|
|
14281
14257
|
const name = extractName(args);
|
|
14282
|
-
|
|
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
|
-
});
|
|
14258
|
+
if (!name)
|
|
14291
14259
|
return "\u6FC0\u6D3B\u6280\u80FD\u5931\u8D25:\u7F3A\u5C11 name \u53C2\u6570\u3002";
|
|
14292
|
-
}
|
|
14293
14260
|
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
|
-
});
|
|
14300
14261
|
return `\u6FC0\u6D3B\u6280\u80FD\u5931\u8D25:\u672A\u627E\u5230\u6280\u80FD "${name}"\u3002\u53EF\u7528:${[...bodyByName.keys()].join(", ")}`;
|
|
14301
14262
|
}
|
|
14302
14263
|
if (activated.has(name)) {
|
|
14303
|
-
recordContentSection(obs, ETelemetryContentSection.SKILL_OUTPUT, {
|
|
14304
|
-
name,
|
|
14305
|
-
status: "already_loaded",
|
|
14306
|
-
durationMs: Date.now() - startedAt
|
|
14307
|
-
});
|
|
14308
14264
|
return `\u6280\u80FD "${name}" \u5DF2\u5728\u672C\u8F6E\u52A0\u8F7D,\u65E0\u9700\u91CD\u590D\u6FC0\u6D3B\u3002`;
|
|
14309
14265
|
}
|
|
14310
14266
|
activated.add(name);
|
|
14311
14267
|
const body = bodyByName.get(name) ?? "";
|
|
14312
|
-
recordContentSection(obs, ETelemetryContentSection.SKILL_OUTPUT, {
|
|
14313
|
-
name,
|
|
14314
|
-
status: "loaded",
|
|
14315
|
-
durationMs: Date.now() - startedAt
|
|
14316
|
-
});
|
|
14317
14268
|
return `<skill name="${escapeXml(name)}">
|
|
14318
14269
|
${body}
|
|
14319
14270
|
</skill>`;
|
|
@@ -14371,8 +14322,6 @@ var ACTIVATE_SKILL_TOOL_NAME, AVAILABLE_SKILLS_OPEN, AVAILABLE_SKILLS_CLOSE;
|
|
|
14371
14322
|
var init_skillTools = __esm({
|
|
14372
14323
|
"../linkque-agent-runtime/dist/esm/core/skillTools.js"() {
|
|
14373
14324
|
"use strict";
|
|
14374
|
-
init_telemetry();
|
|
14375
|
-
init_contentRecording();
|
|
14376
14325
|
ACTIVATE_SKILL_TOOL_NAME = "activate_skill";
|
|
14377
14326
|
AVAILABLE_SKILLS_OPEN = "<available_skills>";
|
|
14378
14327
|
AVAILABLE_SKILLS_CLOSE = "</available_skills>";
|
|
@@ -14600,7 +14549,7 @@ function createKnowledgeTools(resources, searchPort, agentId) {
|
|
|
14600
14549
|
additionalProperties: false
|
|
14601
14550
|
},
|
|
14602
14551
|
annotations: { readOnlyHint: true },
|
|
14603
|
-
execute: (
|
|
14552
|
+
execute: () => listKnowledge()
|
|
14604
14553
|
},
|
|
14605
14554
|
{
|
|
14606
14555
|
name: KNOWLEDGE_RECALL_TOOL_NAME,
|
|
@@ -14627,46 +14576,24 @@ function createKnowledgeTools(resources, searchPort, agentId) {
|
|
|
14627
14576
|
additionalProperties: false
|
|
14628
14577
|
},
|
|
14629
14578
|
annotations: { readOnlyHint: true },
|
|
14630
|
-
execute: (args, signal
|
|
14579
|
+
execute: (args, signal) => recallKnowledge(args, signal)
|
|
14631
14580
|
}
|
|
14632
14581
|
];
|
|
14633
|
-
async function listKnowledge(
|
|
14634
|
-
|
|
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;
|
|
14582
|
+
async function listKnowledge() {
|
|
14583
|
+
return { knowledgeBases: await getKnowledgeBases() };
|
|
14642
14584
|
}
|
|
14643
|
-
async function recallKnowledge(args, signal
|
|
14585
|
+
async function recallKnowledge(args, signal) {
|
|
14644
14586
|
const parsed = parseRecallArgs(args);
|
|
14645
|
-
const obs = context2?.observation;
|
|
14646
14587
|
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
|
-
});
|
|
14654
14588
|
return { hits: [], error: parsed.error };
|
|
14655
14589
|
}
|
|
14656
|
-
recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_INPUT, {
|
|
14657
|
-
knowledgeBaseId: parsed.knowledgeBaseId,
|
|
14658
|
-
query: parsed.query,
|
|
14659
|
-
topK: parsed.topK
|
|
14660
|
-
});
|
|
14661
14590
|
const knowledgeBases = await getKnowledgeBases();
|
|
14662
14591
|
const bound = knowledgeBases.some((info) => info.knowledgeBaseId === parsed.knowledgeBaseId);
|
|
14663
14592
|
if (!bound) {
|
|
14664
|
-
|
|
14665
|
-
recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_OUTPUT, {
|
|
14593
|
+
return {
|
|
14666
14594
|
hits: [],
|
|
14667
|
-
error:
|
|
14668
|
-
}
|
|
14669
|
-
return { hits: [], error: error40 };
|
|
14595
|
+
error: `knowledgeBaseId \u672A\u7ED1\u5B9A: ${parsed.knowledgeBaseId}\u3002\u8BF7\u5148\u8C03\u7528 knowledge_list \u67E5\u770B\u53EF\u7528\u77E5\u8BC6\u5E93\u3002`
|
|
14596
|
+
};
|
|
14670
14597
|
}
|
|
14671
14598
|
try {
|
|
14672
14599
|
const result = await searchPort.search({
|
|
@@ -14675,18 +14602,10 @@ function createKnowledgeTools(resources, searchPort, agentId) {
|
|
|
14675
14602
|
agentId,
|
|
14676
14603
|
topK: parsed.topK
|
|
14677
14604
|
}, signal);
|
|
14678
|
-
recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_OUTPUT, {
|
|
14679
|
-
hits: result.hits
|
|
14680
|
-
});
|
|
14681
14605
|
return { hits: result.hits };
|
|
14682
14606
|
} catch (e2) {
|
|
14683
14607
|
const msg = e2 instanceof Error ? e2.message : String(e2);
|
|
14684
|
-
|
|
14685
|
-
recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_OUTPUT, {
|
|
14686
|
-
hits: [],
|
|
14687
|
-
error: error40
|
|
14688
|
-
});
|
|
14689
|
-
return { hits: [], error: error40 };
|
|
14608
|
+
return { hits: [], error: `\u77E5\u8BC6\u5E93\u68C0\u7D22\u5931\u8D25: ${msg}` };
|
|
14690
14609
|
}
|
|
14691
14610
|
}
|
|
14692
14611
|
async function getKnowledgeBases() {
|
|
@@ -14700,8 +14619,6 @@ var init_createKnowledgeTools = __esm({
|
|
|
14700
14619
|
"../linkque-agent-runtime/dist/esm/core/createKnowledgeTools.js"() {
|
|
14701
14620
|
"use strict";
|
|
14702
14621
|
init_knowledgeTools();
|
|
14703
|
-
init_telemetry();
|
|
14704
|
-
init_contentRecording();
|
|
14705
14622
|
}
|
|
14706
14623
|
});
|
|
14707
14624
|
|
|
@@ -14732,7 +14649,7 @@ var init_noopRuntimeTelemetry = __esm({
|
|
|
14732
14649
|
startOperation(_operation) {
|
|
14733
14650
|
return this;
|
|
14734
14651
|
}
|
|
14735
|
-
record(_name, _attributes
|
|
14652
|
+
record(_name, _attributes) {
|
|
14736
14653
|
}
|
|
14737
14654
|
finish(_outcome, _attributes) {
|
|
14738
14655
|
}
|
|
@@ -14830,7 +14747,7 @@ var init_runtimeObservation = __esm({
|
|
|
14830
14747
|
find(key) {
|
|
14831
14748
|
return this.associations.get(key);
|
|
14832
14749
|
}
|
|
14833
|
-
record(name, attributes
|
|
14750
|
+
record(name, attributes) {
|
|
14834
14751
|
if (this.abandoned)
|
|
14835
14752
|
return;
|
|
14836
14753
|
try {
|
|
@@ -14838,7 +14755,7 @@ var init_runtimeObservation = __esm({
|
|
|
14838
14755
|
this.resultAttributes = {
|
|
14839
14756
|
[ETelemetryAttribute.LINKQUE_TOOL_FAILURE_STAGE]: attributes[ETelemetryAttribute.LINKQUE_TOOL_FAILURE_STAGE]
|
|
14840
14757
|
};
|
|
14841
|
-
this.sink.record(name, attributes
|
|
14758
|
+
this.sink.record(name, attributes);
|
|
14842
14759
|
} catch {
|
|
14843
14760
|
}
|
|
14844
14761
|
}
|
|
@@ -49138,19 +49055,8 @@ function observeTool(tool, observation) {
|
|
|
49138
49055
|
detached: false,
|
|
49139
49056
|
links: []
|
|
49140
49057
|
});
|
|
49141
|
-
const captureBody = !isSkillTool(tool);
|
|
49142
49058
|
try {
|
|
49143
|
-
|
|
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
|
-
}
|
|
49059
|
+
const result = await tool.execute(args, signal, context2);
|
|
49154
49060
|
operation.finish(toolResultOutcome(result), {
|
|
49155
49061
|
[ETelemetryAttribute.HARNESS_TOOL_RESULT_STATUS]: toolResultOutcome(result)
|
|
49156
49062
|
});
|
|
@@ -49168,16 +49074,13 @@ function observeTool(tool, observation) {
|
|
|
49168
49074
|
}
|
|
49169
49075
|
};
|
|
49170
49076
|
}
|
|
49171
|
-
var import_node_crypto6
|
|
49077
|
+
var import_node_crypto6;
|
|
49172
49078
|
var init_toolObservation = __esm({
|
|
49173
49079
|
"../linkque-agent-runtime/dist/esm/core/telemetry/toolObservation.js"() {
|
|
49174
49080
|
"use strict";
|
|
49175
49081
|
init_telemetry();
|
|
49176
49082
|
init_telemetryEnums2();
|
|
49177
|
-
init_skillTools();
|
|
49178
49083
|
import_node_crypto6 = require("node:crypto");
|
|
49179
|
-
init_contentRecording();
|
|
49180
|
-
isSkillTool = (tool) => (tool.modelName ?? tool.name) === ACTIVATE_SKILL_TOOL_NAME;
|
|
49181
49084
|
}
|
|
49182
49085
|
});
|
|
49183
49086
|
|
|
@@ -207416,32 +207319,11 @@ var init_agentRuntime = __esm({
|
|
|
207416
207319
|
}
|
|
207417
207320
|
}, (observation) => this.runObservedAdvance(request, auth2, options, observation), options.signal);
|
|
207418
207321
|
}
|
|
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
|
-
}
|
|
207439
207322
|
async *runObservedAdvance(request, auth2, options, observation) {
|
|
207440
207323
|
observation.record(ETelemetryEventName.TELEMETRY_COVERAGE, {
|
|
207441
207324
|
[ETelemetryAttribute.LINKQUE_TELEMETRY_COVERAGE]: this.agentLoop instanceof PiAgentLoop ? ETelemetryCoverage.PI_MODEL_TOOL_HOOK : ETelemetryCoverage.CORE_ONLY,
|
|
207442
207325
|
[ETelemetryAttribute.HARNESS_TELEMETRY_COMPLETENESS]: this.agentLoop instanceof PiAgentLoop ? ETelemetryCompleteness.COMPLETE : ETelemetryCompleteness.PARTIAL
|
|
207443
207326
|
});
|
|
207444
|
-
this.recordCurrentQuery(observation, request);
|
|
207445
207327
|
const cleanup = [];
|
|
207446
207328
|
let termination = ETelemetryStreamTermination.CANCEL;
|
|
207447
207329
|
let failed = false;
|
|
@@ -214580,8 +214462,6 @@ var LinkquegwTokenVerifier = class {
|
|
|
214580
214462
|
};
|
|
214581
214463
|
|
|
214582
214464
|
// ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/remoteGatewayMcpServer.js
|
|
214583
|
-
init_telemetry();
|
|
214584
|
-
init_contentRecording();
|
|
214585
214465
|
init_types();
|
|
214586
214466
|
init_logFailure();
|
|
214587
214467
|
var defaultCreateSigner = (config2, getAuthorizationHeader, debugLog) => new RemoteSignatureSigner({
|
|
@@ -214654,8 +214534,6 @@ var RemoteGatewayMcpServerProvider = class {
|
|
|
214654
214534
|
callTool: (params, resultSchema, requestOptions) => request("tools/call", params, () => client.callTool(params, resultSchema, requestOptions))
|
|
214655
214535
|
};
|
|
214656
214536
|
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);
|
|
214659
214537
|
const plan = createArgsMappingPlan(name, args, argsMappingRules);
|
|
214660
214538
|
if (plan.requiresUserId) {
|
|
214661
214539
|
if (config2.signEndpoint !== void 0 && config2.signEndpoint !== DEFAULT_SIGN_ENDPOINT && !config2.verifyTokenEndpoint?.trim())
|
|
@@ -214678,18 +214556,15 @@ var RemoteGatewayMcpServerProvider = class {
|
|
|
214678
214556
|
};
|
|
214679
214557
|
}
|
|
214680
214558
|
const mapped = resolveArgsMappingPlan(plan, invocation.auth);
|
|
214681
|
-
recordContentSection(observation, ETelemetryContentSection.MCP_INPUT, mapped);
|
|
214682
214559
|
invocation.signal.throwIfAborted();
|
|
214683
214560
|
const remaining = Math.max(1, invocation.deadline - performance.now());
|
|
214684
214561
|
try {
|
|
214685
|
-
|
|
214562
|
+
return await loggedClient.callTool({ name, arguments: mapped }, void 0, {
|
|
214686
214563
|
signal: invocation.signal,
|
|
214687
214564
|
timeout: remaining,
|
|
214688
214565
|
maxTotalTimeout: remaining,
|
|
214689
214566
|
resetTimeoutOnProgress: false
|
|
214690
214567
|
});
|
|
214691
|
-
recordContentSection(observation, ETelemetryContentSection.MCP_OUTPUT, result);
|
|
214692
|
-
return result;
|
|
214693
214568
|
} catch (error40) {
|
|
214694
214569
|
invocation.signal.throwIfAborted();
|
|
214695
214570
|
if (invocation.auth && !(error40 instanceof McpInvocationError))
|
|
@@ -214718,7 +214593,7 @@ async function listToolsFromClient(client, resourceId, callTool) {
|
|
|
214718
214593
|
const descriptor = {
|
|
214719
214594
|
name: tool.name,
|
|
214720
214595
|
resourceId,
|
|
214721
|
-
execute: (args, signal
|
|
214596
|
+
execute: (args, signal) => callTool(tool.name, args, signal)
|
|
214722
214597
|
};
|
|
214723
214598
|
if (tool.description !== void 0)
|
|
214724
214599
|
descriptor.description = tool.description;
|
|
@@ -215097,7 +214972,7 @@ var LocalHttpMcpServerProvider = class {
|
|
|
215097
214972
|
}
|
|
215098
214973
|
return body.tools.map((value) => this.createDescriptor(resource.resourceId, value));
|
|
215099
214974
|
},
|
|
215100
|
-
callTool: (name, args, signal
|
|
214975
|
+
callTool: (name, args, signal) => this.callTool(resource.resourceId, name, args, signal)
|
|
215101
214976
|
};
|
|
215102
214977
|
}
|
|
215103
214978
|
createDescriptor(resourceId, value) {
|
|
@@ -216642,7 +216517,7 @@ var OtelRuntimeTelemetry = class {
|
|
|
216642
216517
|
operation.record(`${spec.eventPrefix}.${ETelemetryEventPhase.STARTED}`, {});
|
|
216643
216518
|
return operation;
|
|
216644
216519
|
}
|
|
216645
|
-
emit(operation, name, attributes, critical
|
|
216520
|
+
emit(operation, name, attributes, critical) {
|
|
216646
216521
|
if (this.disposed || this.queue.isExporting)
|
|
216647
216522
|
return;
|
|
216648
216523
|
const contextAttributes = operation.attributes;
|
|
@@ -216681,7 +216556,6 @@ var OtelRuntimeTelemetry = class {
|
|
|
216681
216556
|
eventName: name,
|
|
216682
216557
|
timestamp: time3,
|
|
216683
216558
|
observedTimestamp: time3,
|
|
216684
|
-
...body !== void 0 ? { body } : {},
|
|
216685
216559
|
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,
|
|
216686
216560
|
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],
|
|
216687
216561
|
attributes: record4,
|
|
@@ -216752,11 +216626,10 @@ var OtelObservation = class {
|
|
|
216752
216626
|
return new NoopRuntimeObservation();
|
|
216753
216627
|
return this.owner.createOperation(this.state, spec, this);
|
|
216754
216628
|
}
|
|
216755
|
-
record(name, attributes
|
|
216629
|
+
record(name, attributes) {
|
|
216756
216630
|
if (this.lost || !/^(harness|linkque)\.[a-z0-9_.]{1,128}$/.test(name))
|
|
216757
216631
|
return;
|
|
216758
|
-
|
|
216759
|
-
this.owner.emit(this, name, attributes, critical, body);
|
|
216632
|
+
this.owner.emit(this, name, attributes, name.endsWith(`.${ETelemetryEventPhase.FINISHED}`) || name === ETelemetryEventName.MODEL_USAGE_RECORDED || name === ETelemetryEventName.RUNTIME_UNCAUGHT_ERROR || name.endsWith(`.${ETelemetryEventPhase.OBSERVATION_LOST}`));
|
|
216760
216633
|
}
|
|
216761
216634
|
finish(outcome, attributes) {
|
|
216762
216635
|
if (this.ended)
|
|
@@ -217001,9 +216874,28 @@ var SANDBOX_RUNTIME_CONFIG_DEFAULTS = Object.freeze({
|
|
|
217001
216874
|
LINKQUEGW_TELEMETRY_LOGS_ENDPOINT: `${LINKQUE_ENDPOINT_PROD}/api/telemetry/v1/logs`,
|
|
217002
216875
|
LINKQUEGW_TELEMETRY_TRACES_ENDPOINT: `${LINKQUE_ENDPOINT_PROD}/api/telemetry/v1/traces`
|
|
217003
216876
|
});
|
|
216877
|
+
function resolveTokenVerifyDefault(env2) {
|
|
216878
|
+
const signEndpoint = env2.LINKQUE_MCP_SIGN_ENDPOINT?.trim() || SANDBOX_RUNTIME_CONFIG_DEFAULTS.LINKQUE_MCP_SIGN_ENDPOINT;
|
|
216879
|
+
switch (signEndpoint) {
|
|
216880
|
+
case "https://linkquegw.alipay.com/api/mcp/signature":
|
|
216881
|
+
return "https://linkquegw.alipay.com/api/auth/verify";
|
|
216882
|
+
case "https://linkquegw-pre.alipay.com/api/mcp/signature":
|
|
216883
|
+
return "https://linkquegw-pre.alipay.com/api/auth/verify";
|
|
216884
|
+
default:
|
|
216885
|
+
return "";
|
|
216886
|
+
}
|
|
216887
|
+
}
|
|
217004
216888
|
var SandboxRuntimeConfigProvider = class extends RuntimeConfigProvider {
|
|
217005
216889
|
constructor(env2 = process.env) {
|
|
217006
|
-
super(env2,
|
|
216890
|
+
super(env2, {
|
|
216891
|
+
...SANDBOX_RUNTIME_CONFIG_DEFAULTS,
|
|
216892
|
+
LINKQUEGW_TOKEN_VERIFY_ENDPOINT: resolveTokenVerifyDefault(env2)
|
|
216893
|
+
});
|
|
216894
|
+
}
|
|
216895
|
+
getSource(name) {
|
|
216896
|
+
if (name === "LINKQUEGW_TOKEN_VERIFY_ENDPOINT" && !this.get(name))
|
|
216897
|
+
return "unset";
|
|
216898
|
+
return super.getSource(name);
|
|
217007
216899
|
}
|
|
217008
216900
|
};
|
|
217009
216901
|
|
|
@@ -217754,8 +217646,8 @@ var main = async () => {
|
|
|
217754
217646
|
agentId: protocol.agentId,
|
|
217755
217647
|
remoteBaseUrl: config2.get("LINKQUE_OPEN_MCP_BASE_URL"),
|
|
217756
217648
|
signEndpoint: config2.get("LINKQUE_MCP_SIGN_ENDPOINT"),
|
|
217757
|
-
//
|
|
217758
|
-
verifyTokenEndpoint: config2.
|
|
217649
|
+
// 与启动日志共用环境配置解析;未知网关无默认地址,由运行时拒绝缺失配置。
|
|
217650
|
+
verifyTokenEndpoint: config2.get("LINKQUEGW_TOKEN_VERIFY_ENDPOINT") || void 0
|
|
217759
217651
|
});
|
|
217760
217652
|
return new RemoteGatewayMcpServerProvider({
|
|
217761
217653
|
resolveConfig,
|