linkque-cli-v2 1.4.5 → 1.5.0

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.
@@ -22683,6 +22683,7 @@ var EHookExecutorName;
22683
22683
  EHookExecutorName2["LinkquegwEventHookExecutor"] = "LinkquegwEventHookExecutor";
22684
22684
  EHookExecutorName2["SecurityAnswerHookExecutor"] = "SecurityAnswerHookExecutor";
22685
22685
  EHookExecutorName2["ImageUnderstandingHookExecutor"] = "ImageUnderstandingHookExecutor";
22686
+ EHookExecutorName2["McpDiscoveryHookExecutor"] = "McpDiscoveryHookExecutor";
22686
22687
  })(EHookExecutorName || (EHookExecutorName = {}));
22687
22688
 
22688
22689
  // ../linkque-agent-runtime/dist/esm/core/followUpQuestions.js
@@ -26120,6 +26121,14 @@ var ETelemetryAttribute;
26120
26121
  ETelemetryAttribute2["HARNESS_MODEL_PURPOSE"] = "harness.model.purpose";
26121
26122
  ETelemetryAttribute2["HARNESS_MODEL_INVOCATION_COUNT"] = "harness.model.invocation_count";
26122
26123
  ETelemetryAttribute2["GEN_AI_TOOL_NAME"] = "gen_ai.tool.name";
26124
+ ETelemetryAttribute2["LINKQUE_TOOL_DISPLAY_NAME"] = "linkque.tool.display_name";
26125
+ ETelemetryAttribute2["LINKQUE_CARD_EXECUTION_ID"] = "linkque.card.execution_id";
26126
+ ETelemetryAttribute2["LINKQUE_CARD_REF"] = "linkque.card.ref";
26127
+ ETelemetryAttribute2["LINKQUE_CARD_REVISION"] = "linkque.card.revision";
26128
+ ETelemetryAttribute2["LINKQUE_CARD_DISPLAY_NAME"] = "linkque.card.display_name";
26129
+ ETelemetryAttribute2["LINKQUE_CARD_PHASE"] = "linkque.card.phase";
26130
+ ETelemetryAttribute2["LINKQUE_CARD_SOURCE_ID"] = "linkque.card.source_id";
26131
+ ETelemetryAttribute2["LINKQUE_CARD_DELIVERY"] = "linkque.card.delivery";
26123
26132
  ETelemetryAttribute2["GEN_AI_TOOL_CALL_ID"] = "gen_ai.tool.call.id";
26124
26133
  ETelemetryAttribute2["HARNESS_TOOL_RESULT_STATUS"] = "harness.tool.result.status";
26125
26134
  ETelemetryAttribute2["LINKQUE_TOOL_FAILURE_STAGE"] = "linkque.tool.failure_stage";
@@ -26155,6 +26164,7 @@ var ETelemetryEventPrefix;
26155
26164
  ETelemetryEventPrefix2["ADVANCE"] = "harness.advance";
26156
26165
  ETelemetryEventPrefix2["MODEL_INVOKE"] = "harness.model.invoke";
26157
26166
  ETelemetryEventPrefix2["MODEL_ATTEMPT"] = "harness.model.attempt";
26167
+ ETelemetryEventPrefix2["MODEL_REASONING"] = "harness.model.reasoning";
26158
26168
  ETelemetryEventPrefix2["TOOL_INVOKE"] = "harness.tool.invoke";
26159
26169
  ETelemetryEventPrefix2["TOOL_ATTEMPT"] = "harness.tool.attempt";
26160
26170
  ETelemetryEventPrefix2["HOOK_CHAIN"] = "harness.hook.chain";
@@ -26196,6 +26206,8 @@ var ETelemetryEventName;
26196
26206
  ETelemetryEventName2["MODEL_INVOKE_FINISHED"] = "harness.model.invoke.finished";
26197
26207
  ETelemetryEventName2["MODEL_ATTEMPT_STARTED"] = "harness.model.attempt.started";
26198
26208
  ETelemetryEventName2["MODEL_ATTEMPT_FINISHED"] = "harness.model.attempt.finished";
26209
+ ETelemetryEventName2["MODEL_REASONING_STARTED"] = "harness.model.reasoning.started";
26210
+ ETelemetryEventName2["MODEL_REASONING_FINISHED"] = "harness.model.reasoning.finished";
26199
26211
  ETelemetryEventName2["TOOL_INVOKE_STARTED"] = "harness.tool.invoke.started";
26200
26212
  ETelemetryEventName2["TOOL_INVOKE_FINISHED"] = "harness.tool.invoke.finished";
26201
26213
  ETelemetryEventName2["TOOL_ATTEMPT_STARTED"] = "harness.tool.attempt.started";
@@ -26213,11 +26225,17 @@ var ETelemetryEventName;
26213
26225
  ETelemetryEventName2["HOOK_DRAIN_STARTED"] = "linkque.hook.drain.started";
26214
26226
  ETelemetryEventName2["HOOK_DRAIN_FINISHED"] = "linkque.hook.drain.finished";
26215
26227
  ETelemetryEventName2["CONTENT_RECORDED"] = "linkque.content.recorded";
26228
+ ETelemetryEventName2["TOOL_CONTEXT"] = "linkque.tool.context";
26216
26229
  })(ETelemetryEventName || (ETelemetryEventName = {}));
26217
26230
  var ETelemetryContentSection;
26218
26231
  (function(ETelemetryContentSection2) {
26219
26232
  ETelemetryContentSection2["QUERY_INPUT"] = "query.input";
26233
+ ETelemetryContentSection2["MODEL_INPUT_DIGEST"] = "model.input.digest";
26234
+ ETelemetryContentSection2["MODEL_OUT_RAW"] = "model.out.raw";
26220
26235
  ETelemetryContentSection2["MODEL_OUTPUT"] = "model.output";
26236
+ ETelemetryContentSection2["MODEL_REASONING"] = "model.reasoning";
26237
+ ETelemetryContentSection2["FOLLOW_UP_QUESTION_INPUT"] = "follow_up_question.input";
26238
+ ETelemetryContentSection2["FOLLOW_UP_QUESTION_OUTPUT"] = "follow_up_question.output";
26221
26239
  ETelemetryContentSection2["MCP_ACTION_OUTPUT"] = "mcp_action.output";
26222
26240
  ETelemetryContentSection2["TOOL_INPUT"] = "tool.input";
26223
26241
  ETelemetryContentSection2["TOOL_OUTPUT"] = "tool.output";
@@ -26236,6 +26254,7 @@ var ETelemetryOperationName;
26236
26254
  ETelemetryOperationName2["ADVANCE"] = "harness.advance";
26237
26255
  ETelemetryOperationName2["MODEL_INVOKE"] = "harness.model.invoke";
26238
26256
  ETelemetryOperationName2["MODEL_ATTEMPT"] = "harness.model.attempt";
26257
+ ETelemetryOperationName2["MODEL_REASONING"] = "harness.model.reasoning";
26239
26258
  ETelemetryOperationName2["TOOL_ATTEMPT"] = "harness.tool.attempt";
26240
26259
  ETelemetryOperationName2["HOOK_CHAIN"] = "harness.hook.chain";
26241
26260
  ETelemetryOperationName2["MIDDLEWARE"] = "harness.middleware";
@@ -26371,6 +26390,7 @@ var ETelemetryTerminalSource;
26371
26390
  var ETelemetryModelPurpose;
26372
26391
  (function(ETelemetryModelPurpose2) {
26373
26392
  ETelemetryModelPurpose2["AGENT_LOOP"] = "agent_loop";
26393
+ ETelemetryModelPurpose2["FOLLOW_UP_QUESTION"] = "follow_up_question";
26374
26394
  })(ETelemetryModelPurpose || (ETelemetryModelPurpose = {}));
26375
26395
  var ETelemetryErrorType;
26376
26396
  (function(ETelemetryErrorType2) {
@@ -26427,11 +26447,143 @@ function recordMcpContentSection(observation, section, value, schema) {
26427
26447
  });
26428
26448
  }
26429
26449
 
26450
+ // ../linkque-agent-runtime/dist/esm/core/abort.js
26451
+ function waitWithSignal(operation, signal) {
26452
+ if (typeof operation === "function") {
26453
+ if (signal?.aborted)
26454
+ return Promise.reject(signal.reason);
26455
+ try {
26456
+ return waitForPromise(operation(signal), signal);
26457
+ } catch (error) {
26458
+ return Promise.reject(error);
26459
+ }
26460
+ }
26461
+ return waitForPromise(operation, signal);
26462
+ }
26463
+ function waitForPromise(operation, signal) {
26464
+ if (!signal)
26465
+ return operation;
26466
+ return new Promise((resolve, reject) => {
26467
+ const abort = () => {
26468
+ signal.removeEventListener("abort", abort);
26469
+ reject(signal.reason);
26470
+ };
26471
+ signal.addEventListener("abort", abort, { once: true });
26472
+ operation.then((value) => {
26473
+ signal.removeEventListener("abort", abort);
26474
+ resolve(value);
26475
+ }, (error) => {
26476
+ signal.removeEventListener("abort", abort);
26477
+ reject(error);
26478
+ });
26479
+ if (signal.aborted)
26480
+ abort();
26481
+ });
26482
+ }
26483
+
26484
+ // ../linkque-agent-runtime/dist/esm/core/cancellationScope.js
26485
+ var MAX_TIMER_DELAY_MS = 2147483647;
26486
+ var CancellationScope = class {
26487
+ controller = new AbortController();
26488
+ listeners = [];
26489
+ timeoutReason;
26490
+ parent;
26491
+ ref;
26492
+ timer;
26493
+ disposed = false;
26494
+ context;
26495
+ constructor(options = {}) {
26496
+ const { parent, signals = [], timeoutMs } = options;
26497
+ if (timeoutMs !== void 0 && (!Number.isFinite(timeoutMs) || timeoutMs <= 0))
26498
+ throw new Error("\u53D6\u6D88\u4F5C\u7528\u57DF timeoutMs \u5FC5\u987B\u4E3A\u6709\u9650\u6B63\u6570");
26499
+ this.parent = parent;
26500
+ this.ref = options.ref ?? true;
26501
+ this.timeoutReason = options.timeoutReason ?? new DOMException("\u64CD\u4F5C\u8D85\u65F6", "TimeoutError");
26502
+ const ownDeadline = timeoutMs === void 0 ? void 0 : performance.now() + timeoutMs;
26503
+ const deadline = ownDeadline === void 0 ? parent?.deadline : parent?.deadline === void 0 ? ownDeadline : Math.min(ownDeadline, parent.deadline);
26504
+ this.context = {
26505
+ signal: this.controller.signal,
26506
+ deadline,
26507
+ remainingMs: () => deadline === void 0 ? Infinity : Math.max(0, deadline - performance.now()),
26508
+ throwIfAborted: () => {
26509
+ this.controller.signal.throwIfAborted();
26510
+ if (deadline !== void 0 && performance.now() >= deadline) {
26511
+ try {
26512
+ parent?.throwIfAborted();
26513
+ } catch {
26514
+ }
26515
+ if (parent?.signal.aborted)
26516
+ this.cancel(parent.signal.reason);
26517
+ else
26518
+ this.cancel(this.timeoutReason);
26519
+ }
26520
+ this.controller.signal.throwIfAborted();
26521
+ }
26522
+ };
26523
+ for (const source of [parent?.signal, ...signals]) {
26524
+ if (!source)
26525
+ continue;
26526
+ if (source.aborted) {
26527
+ this.cancel(source.reason);
26528
+ break;
26529
+ }
26530
+ const forward = () => this.cancel(source.reason);
26531
+ source.addEventListener("abort", forward, { once: true });
26532
+ this.listeners.push(() => source.removeEventListener("abort", forward));
26533
+ }
26534
+ if (!this.controller.signal.aborted && deadline !== void 0)
26535
+ this.armTimer(deadline);
26536
+ }
26537
+ cancel(reason = new DOMException("\u64CD\u4F5C\u5DF2\u53D6\u6D88", "AbortError")) {
26538
+ if (this.disposed || this.controller.signal.aborted)
26539
+ return;
26540
+ this.controller.abort(reason);
26541
+ this.release();
26542
+ }
26543
+ dispose() {
26544
+ if (this.disposed)
26545
+ return;
26546
+ this.disposed = true;
26547
+ this.release();
26548
+ }
26549
+ armTimer(deadline) {
26550
+ if (this.timer !== void 0)
26551
+ clearTimeout(this.timer);
26552
+ const remaining = deadline - performance.now();
26553
+ if (remaining <= 0) {
26554
+ try {
26555
+ this.parent?.throwIfAborted();
26556
+ } catch {
26557
+ }
26558
+ if (this.parent?.signal.aborted)
26559
+ this.cancel(this.parent.signal.reason);
26560
+ else
26561
+ this.cancel(this.timeoutReason);
26562
+ return;
26563
+ }
26564
+ this.timer = setTimeout(() => {
26565
+ this.timer = void 0;
26566
+ this.armTimer(deadline);
26567
+ }, Math.min(remaining, MAX_TIMER_DELAY_MS));
26568
+ if (!this.ref)
26569
+ this.timer.unref?.();
26570
+ }
26571
+ release() {
26572
+ if (this.timer !== void 0)
26573
+ clearTimeout(this.timer);
26574
+ this.timer = void 0;
26575
+ for (const remove of this.listeners.splice(0))
26576
+ remove();
26577
+ }
26578
+ };
26579
+
26430
26580
  // ../linkque-agent-runtime/dist/esm/core/mcpProxyTool.js
26431
26581
  var MCP_PROXY_TOOL_NAME = "mcp";
26432
26582
  var McpProxyTool = class {
26433
26583
  provider;
26434
26584
  /** serverName → 缓存条目(同 serverName 多 resourceId 聚合为一个连接)。 */
26585
+ lifetime;
26586
+ closing = /* @__PURE__ */ new WeakMap();
26435
26587
  entries = /* @__PURE__ */ new Map();
26436
26588
  /** 进行中的连接(去重并发 ensureEntry)。 */
26437
26589
  inFlight = /* @__PURE__ */ new Map();
@@ -26443,6 +26595,9 @@ var McpProxyTool = class {
26443
26595
  authorizeCall;
26444
26596
  constructor(provider, specs, options = {}) {
26445
26597
  this.provider = provider;
26598
+ this.lifetime = new CancellationScope({
26599
+ signals: options.signal ? [options.signal] : []
26600
+ });
26446
26601
  this.specs = specs;
26447
26602
  this.specByServerName = new Map(specs.map((spec) => [spec.serverName, spec]));
26448
26603
  this.specByResourceId = new Map(specs.flatMap((spec) => spec.resourceIds.map((id) => [id, spec])));
@@ -26496,40 +26651,121 @@ var McpProxyTool = class {
26496
26651
  }
26497
26652
  };
26498
26653
  }
26499
- /** 关闭所有已连 server(忽略单 server 关闭错误)。 */
26500
- async closeAll() {
26501
- await Promise.all([...this.entries.values()].map(async (entry) => {
26502
- if (!entry.server)
26503
- return;
26654
+ /** 并发发现所有 server;每个 server 独立限时,失败结果不阻断其他目录。 */
26655
+ async discover(signal) {
26656
+ signal?.throwIfAborted();
26657
+ const results = await Promise.all(this.specs.map(async (spec) => {
26658
+ const scope = new CancellationScope({
26659
+ parent: this.lifetime.context,
26660
+ signals: signal ? [signal] : [],
26661
+ timeoutMs: 5e3,
26662
+ timeoutReason: new DOMException("MCP \u76EE\u5F55\u9884\u52A0\u8F7D\u8D85\u65F6", "TimeoutError")
26663
+ });
26504
26664
  try {
26505
- await entry.server.close?.();
26665
+ const entry = await this.ensureEntry(spec.serverName, scope.context.signal);
26666
+ return {
26667
+ serverName: spec.serverName,
26668
+ status: entry ? "connected" : "failed",
26669
+ tools: (entry?.tools ?? []).map(({ name, description }) => {
26670
+ const metadata = { name };
26671
+ if (description !== void 0)
26672
+ metadata.description = description;
26673
+ return metadata;
26674
+ })
26675
+ };
26506
26676
  } catch (error) {
26507
- try {
26508
- this.debugLog(`[mcp] server ${entry.server.serverName} close failed: ${error instanceof Error ? error.message : "unknown error"}`, EDebugLogScope.MCP);
26509
- } catch {
26677
+ if (signal?.aborted || this.lifetime.context.signal.aborted)
26678
+ throw error;
26679
+ if (scope.context.signal.aborted) {
26680
+ return {
26681
+ serverName: spec.serverName,
26682
+ status: "failed",
26683
+ tools: []
26684
+ };
26510
26685
  }
26686
+ throw error;
26687
+ } finally {
26688
+ scope.dispose();
26511
26689
  }
26512
26690
  }));
26691
+ signal?.throwIfAborted();
26692
+ this.lifetime.context.throwIfAborted();
26693
+ return results;
26694
+ }
26695
+ /** 关闭缓存连接并取消在途连接;忽略取消的 provider 返回后也会立即清理。 */
26696
+ async closeAll() {
26697
+ this.lifetime.cancel(new DOMException("MCP Run \u5DF2\u7ED3\u675F", "AbortError"));
26698
+ for (const attempt of this.inFlight.values()) {
26699
+ attempt.abandoned = true;
26700
+ attempt.scope.cancel(this.lifetime.context.signal.reason);
26701
+ }
26702
+ this.inFlight.clear();
26703
+ await Promise.all([...this.entries.values()].map((entry) => entry.server ? this.closeServer(entry.server) : Promise.resolve()));
26704
+ this.entries.clear();
26705
+ this.lifetime.dispose();
26706
+ }
26707
+ /** 单个连接只关闭一次,诊断失败不得影响资源清理。 */
26708
+ closeServer(server) {
26709
+ const existing = this.closing.get(server);
26710
+ if (existing)
26711
+ return existing;
26712
+ const closing = Promise.resolve().then(() => server.close?.()).then(() => void 0).catch((error) => {
26713
+ this.log(`[mcp] server ${server.serverName} close failed: ${String(error)}`);
26714
+ });
26715
+ this.closing.set(server, closing);
26716
+ return closing;
26717
+ }
26718
+ log(message) {
26719
+ try {
26720
+ this.debugLog(message, EDebugLogScope.MCP);
26721
+ } catch {
26722
+ }
26513
26723
  }
26514
26724
  // —— 内部:连接与缓存 ——
26515
26725
  /** 确保某 server 已连;返回 connected 条目,依失败返回 null(不抛错)。 */
26516
26726
  async ensureEntry(serverName, signal) {
26727
+ this.lifetime.context.throwIfAborted();
26728
+ signal?.throwIfAborted();
26517
26729
  const existing = this.entries.get(serverName);
26518
26730
  if (existing) {
26519
26731
  return existing.status === "connected" ? existing : null;
26520
26732
  }
26521
- let promise = this.inFlight.get(serverName);
26522
- if (!promise) {
26523
- promise = this.connect(serverName, signal).finally(() => {
26524
- this.inFlight.delete(serverName);
26733
+ let attempt = this.inFlight.get(serverName);
26734
+ if (!attempt) {
26735
+ const scope = new CancellationScope({ parent: this.lifetime.context });
26736
+ attempt = {
26737
+ promise: Promise.resolve({}),
26738
+ scope,
26739
+ waiters: 0,
26740
+ settled: false,
26741
+ abandoned: false
26742
+ };
26743
+ const current = attempt;
26744
+ this.inFlight.set(serverName, current);
26745
+ current.promise = this.connect(serverName, scope.context.signal, current).finally(() => {
26746
+ current.settled = true;
26747
+ if (this.inFlight.get(serverName) === current)
26748
+ this.inFlight.delete(serverName);
26749
+ scope.dispose();
26525
26750
  });
26526
- this.inFlight.set(serverName, promise);
26527
26751
  }
26528
- const entry = await promise;
26529
- return entry.status === "connected" ? entry : null;
26752
+ attempt.waiters += 1;
26753
+ try {
26754
+ const entry = await waitWithSignal(attempt.promise, signal);
26755
+ return entry.status === "connected" ? entry : null;
26756
+ } finally {
26757
+ attempt.waiters -= 1;
26758
+ if (attempt.waiters === 0 && !attempt.settled) {
26759
+ attempt.abandoned = true;
26760
+ if (this.inFlight.get(serverName) === attempt)
26761
+ this.inFlight.delete(serverName);
26762
+ attempt.scope.cancel(new DOMException("MCP \u5EFA\u8FDE\u5DF2\u65E0\u7B49\u5F85\u8005", "AbortError"));
26763
+ }
26764
+ }
26530
26765
  }
26531
26766
  /** 连单个 server 并 listTools;按 spec.allowedTools 过滤后缓存;失败记为 failed。 */
26532
- async connect(serverName, _signal) {
26767
+ async connect(serverName, signal, attempt) {
26768
+ const isCurrent = () => !attempt.abandoned && this.inFlight.get(serverName) === attempt && !this.lifetime.context.signal.aborted;
26533
26769
  const spec = this.specByServerName.get(serverName);
26534
26770
  if (!spec) {
26535
26771
  const entry = {
@@ -26538,11 +26774,19 @@ var McpProxyTool = class {
26538
26774
  status: "failed",
26539
26775
  error: `unknown serverName: ${serverName}`
26540
26776
  };
26541
- this.entries.set(serverName, entry);
26777
+ if (isCurrent())
26778
+ this.entries.set(serverName, entry);
26542
26779
  this.debugLog(`[mcp] server ${serverName} unknown serverName`, EDebugLogScope.MCP);
26543
26780
  return entry;
26544
26781
  }
26782
+ let server;
26783
+ const onAbort = () => {
26784
+ if (server)
26785
+ void this.closeServer(server);
26786
+ };
26787
+ signal.addEventListener("abort", onAbort, { once: true });
26545
26788
  try {
26789
+ signal.throwIfAborted();
26546
26790
  const synthetic = {
26547
26791
  resourceId: spec.serverName,
26548
26792
  resourceType: EResourceType.MCP,
@@ -26554,18 +26798,35 @@ var McpProxyTool = class {
26554
26798
  argsMappingRules: spec.argsMappingRules
26555
26799
  }
26556
26800
  };
26557
- const servers = await this.provider.servers([synthetic]);
26558
- const server = servers[0];
26801
+ const pending = this.provider.servers([synthetic], signal).then((servers2) => {
26802
+ server = servers2[0];
26803
+ if (signal.aborted) {
26804
+ for (const item of servers2)
26805
+ void this.closeServer(item);
26806
+ signal.throwIfAborted();
26807
+ }
26808
+ return servers2;
26809
+ });
26810
+ const servers = await waitWithSignal(pending, signal);
26811
+ server = servers[0];
26559
26812
  if (!server) {
26560
26813
  throw new Error(`provider returned no server for ${spec.serverName}`);
26561
26814
  }
26562
- const all = await server.listTools();
26815
+ const all = await waitWithSignal(server.listTools(signal), signal);
26816
+ signal.throwIfAborted();
26563
26817
  const tools = spec.allowedTools ? all.filter((tool) => spec.allowedTools.has(tool.name)) : all;
26564
26818
  const entry = { server, tools, status: "connected" };
26819
+ if (!isCurrent()) {
26820
+ void this.closeServer(server);
26821
+ signal.throwIfAborted();
26822
+ return { server: null, tools: [], status: "failed" };
26823
+ }
26565
26824
  this.entries.set(serverName, entry);
26566
- this.debugLog(`[mcp] server ${spec.serverName} connected (${tools.length}/${all.length} tools)`, EDebugLogScope.MCP);
26825
+ this.log(`[mcp] server ${spec.serverName} connected (${tools.length}/${all.length} tools)`);
26567
26826
  return entry;
26568
26827
  } catch (error) {
26828
+ if (server)
26829
+ void this.closeServer(server);
26569
26830
  const message = error instanceof Error ? error.message : String(error);
26570
26831
  const entry = {
26571
26832
  server: null,
@@ -26573,9 +26834,12 @@ var McpProxyTool = class {
26573
26834
  status: "failed",
26574
26835
  error: message
26575
26836
  };
26576
- this.entries.set(serverName, entry);
26577
- this.debugLog(`[mcp] server ${spec.serverName} connect failed: ${message}`, EDebugLogScope.MCP);
26837
+ if (isCurrent())
26838
+ this.entries.set(serverName, entry);
26839
+ this.log(`[mcp] server ${spec.serverName} connect failed: ${message}`);
26578
26840
  return entry;
26841
+ } finally {
26842
+ signal.removeEventListener("abort", onAbort);
26579
26843
  }
26580
26844
  }
26581
26845
  // —— 派发 ——
@@ -26602,18 +26866,14 @@ var McpProxyTool = class {
26602
26866
  if (params.server !== void 0) {
26603
26867
  return this.executeList(params.server, signal, context2);
26604
26868
  }
26605
- return this.executeStatus();
26869
+ return this.executeStatus(context2);
26606
26870
  }
26607
26871
  /** 保留代理动作事实,不改变供模型消费的原始返回值。 */
26608
26872
  recordAction(context2, action, status, data = {}) {
26609
- recordContentSection(context2?.observation, ETelemetryContentSection.MCP_ACTION_OUTPUT, {
26610
- action,
26611
- status,
26612
- ...data
26613
- });
26873
+ recordContentSection(context2?.observation, ETelemetryContentSection.MCP_ACTION_OUTPUT, { action, status, ...data });
26614
26874
  }
26615
26875
  /** `mcp({})` / `mcp({ status: true })`:列各 server 连接状态 + 工具数。 */
26616
- executeStatus() {
26876
+ executeStatus(context2) {
26617
26877
  const lines = [];
26618
26878
  let connected = 0;
26619
26879
  let totalTools = 0;
@@ -26632,6 +26892,13 @@ var McpProxyTool = class {
26632
26892
  lines.push(`\u2717 ${label} (failed${entry.error ? ": " + entry.error : ""})`);
26633
26893
  }
26634
26894
  }
26895
+ this.recordAction(context2, "status", "completed", {
26896
+ servers: this.specs.map((spec) => ({
26897
+ name: spec.serverName,
26898
+ status: this.entries.get(spec.serverName)?.status ?? "not_connected",
26899
+ toolCount: this.entries.get(spec.serverName)?.tools.length ?? 0
26900
+ }))
26901
+ });
26635
26902
  const header = `MCP: ${connected}/${this.specs.length} servers, ${totalTools} tools`;
26636
26903
  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
26904
  return `${header}
@@ -26645,15 +26912,28 @@ ${lines.join("\n")}${hint}`.trim();
26645
26912
  this.recordAction(context2, "connect", "not_found", { server });
26646
26913
  return `Server "${server}" not found. Use mcp({}) to see available servers.`;
26647
26914
  }
26648
- this.entries.delete(spec.serverName);
26915
+ if (!this.inFlight.has(spec.serverName)) {
26916
+ const previous = this.entries.get(spec.serverName);
26917
+ this.entries.delete(spec.serverName);
26918
+ if (previous?.server)
26919
+ await this.closeServer(previous.server);
26920
+ }
26649
26921
  const entry = await this.ensureEntry(spec.serverName, signal);
26650
26922
  if (!entry) {
26651
- this.recordAction(context2, "connect", "failed", { server: spec.serverName });
26923
+ this.recordAction(context2, "connect", "failed", {
26924
+ server: spec.serverName
26925
+ });
26652
26926
  const failed = this.entries.get(spec.serverName);
26653
26927
  const detail = failed?.error ? `: ${failed.error}` : "";
26654
26928
  return `Failed to connect to "${spec.serverName}"${detail}.`;
26655
26929
  }
26656
- this.recordAction(context2, "connect", "matched", { server: spec.serverName, tools: entry.tools.map((tool) => ({ name: tool.name, description: tool.description })) });
26930
+ this.recordAction(context2, "connect", "matched", {
26931
+ server: spec.serverName,
26932
+ tools: entry.tools.map((tool) => ({
26933
+ name: tool.name,
26934
+ description: tool.description
26935
+ }))
26936
+ });
26657
26937
  return this.formatToolList(spec.serverName, entry.tools);
26658
26938
  }
26659
26939
  /** `mcp({ server: "name" })`:列该 server 工具名 + 截断 description。 */
@@ -26668,7 +26948,13 @@ ${lines.join("\n")}${hint}`.trim();
26668
26948
  this.recordAction(context2, "list", "failed", { server: spec.serverName });
26669
26949
  return `Server "${spec.serverName}" is not connected. Use mcp({ connect: "${spec.serverName}" }) to retry.`;
26670
26950
  }
26671
- this.recordAction(context2, "list", "matched", { server: spec.serverName, tools: entry.tools.map((tool) => ({ name: tool.name, description: tool.description })) });
26951
+ this.recordAction(context2, "list", "matched", {
26952
+ server: spec.serverName,
26953
+ tools: entry.tools.map((tool) => ({
26954
+ name: tool.name,
26955
+ description: tool.description
26956
+ }))
26957
+ });
26672
26958
  return this.formatToolList(spec.serverName, entry.tools);
26673
26959
  }
26674
26960
  /** `mcp({ search: "query" })`:空格分词 OR 子串匹配 name/description(跨所有 server)。 */
@@ -26690,9 +26976,18 @@ ${lines.join("\n")}${hint}`.trim();
26690
26976
  }
26691
26977
  }
26692
26978
  }
26693
- const tools = matches.map(({ server, tool }) => ({ server, name: tool.name, description: tool.description, inputSchema: tool.inputSchema }));
26979
+ const tools = matches.map(({ server, tool }) => ({
26980
+ server,
26981
+ name: tool.name,
26982
+ description: tool.description,
26983
+ inputSchema: tool.inputSchema
26984
+ }));
26694
26985
  if (matches.length === 0) {
26695
- return { query, tools, text: serverHint ? `No tools matching "${query}" in "${serverHint}"` : `No tools matching "${query}"` };
26986
+ return {
26987
+ query,
26988
+ tools,
26989
+ text: serverHint ? `No tools matching "${query}" in "${serverHint}"` : `No tools matching "${query}"`
26990
+ };
26696
26991
  }
26697
26992
  const lines = [`Found ${matches.length} tool(s) matching "${query}":`, ""];
26698
26993
  for (const { server, tool } of matches) {
@@ -26729,7 +27024,11 @@ ${result.text}`).join("\n\n");
26729
27024
  return `Tool "${toolName}" not found. Use mcp({ search: "..." }) to search.`;
26730
27025
  }
26731
27026
  const { server, tool } = found;
26732
- this.recordAction(context2, "describe", "matched", { server, name: tool.name, inputSchema: tool.inputSchema });
27027
+ this.recordAction(context2, "describe", "matched", {
27028
+ server,
27029
+ name: tool.name,
27030
+ inputSchema: tool.inputSchema
27031
+ });
26733
27032
  const lines = [
26734
27033
  `${tool.name}`,
26735
27034
  `Server: ${server}`,
@@ -27610,7 +27909,7 @@ function buildHookContextBase(resource, stage, commonParams, eventId, timestamp)
27610
27909
  // ../linkque-agent-runtime/dist/esm/core/hook/hookRegistry.js
27611
27910
  var DEFAULT_HOOK_ORDER = 100;
27612
27911
  var DEFAULT_HOOK_TIMEOUT_MS = 1e3;
27613
- var MAX_HOOK_TIMEOUT_MS = 5e3;
27912
+ var MAX_HOOK_TIMEOUT_MS = 6e3;
27614
27913
  function normalizeHookResources(resources) {
27615
27914
  return resources.filter((resource) => resource.config.enabled !== false).map((resource) => {
27616
27915
  const config = Object.assign({}, resource.config, {
@@ -28004,13 +28303,17 @@ var HookDispatcher = class {
28004
28303
  writeHookLog(this.deps.debugLog, { ...baseRecord, event: "started" });
28005
28304
  let result;
28006
28305
  try {
28007
- const controller = new AbortController();
28008
28306
  const timeoutMs = resource.config.timeoutMs ?? 1e3;
28009
- const executorSignal = runtimeInput?.signal ? AbortSignal.any([controller.signal, runtimeInput.signal]) : controller.signal;
28010
- let timeout;
28307
+ const timeoutReason = new Error(`\u72B6\u6001\u578B Hook ${resource.config.name} \u6267\u884C\u8D85\u65F6(${timeoutMs}ms)`);
28308
+ const scope = new CancellationScope({
28309
+ signals: runtimeInput?.signal ? [runtimeInput.signal] : [],
28310
+ timeoutMs,
28311
+ timeoutReason
28312
+ });
28313
+ const executorSignal = scope.context.signal;
28011
28314
  let onAbort;
28012
28315
  try {
28013
- executorSignal.throwIfAborted();
28316
+ scope.context.throwIfAborted();
28014
28317
  observation = parent?.startOperation({
28015
28318
  name: ETelemetryOperationName.MIDDLEWARE,
28016
28319
  eventPrefix: ETelemetryEventPrefix.MIDDLEWARE,
@@ -28025,57 +28328,46 @@ var HookDispatcher = class {
28025
28328
  detached: false,
28026
28329
  links: []
28027
28330
  });
28028
- const aborted = new Promise((_, reject) => {
28029
- onAbort = () => {
28030
- cancelled = true;
28031
- observation?.record(ETelemetryEventName.HOOK_CANCEL_REQUESTED, {});
28032
- reject(executorSignal.reason instanceof Error ? executorSignal.reason : new Error("\u72B6\u6001\u578B Hook \u6267\u884C\u5DF2\u53D6\u6D88"));
28033
- };
28034
- executorSignal.addEventListener("abort", onAbort, { once: true });
28035
- });
28036
- timeout = setTimeout(() => {
28037
- timedOut = true;
28038
- observation?.record(ETelemetryEventName.HOOK_TIMEOUT_REQUESTED, {});
28039
- controller.abort(new Error(`\u72B6\u6001\u578B Hook ${resource.config.name} \u6267\u884C\u8D85\u65F6(${timeoutMs}ms)`));
28040
- }, timeoutMs);
28041
- result = await Promise.race([
28042
- this.deps.hookExecutor.execute(resource, context2, {
28043
- signal: executorSignal,
28044
- ...runtimeInput === void 0 ? {} : { runtimeInput }
28045
- }).then((value) => {
28046
- settled = true;
28047
- observation?.record(ETelemetryEventName.HOOK_EXECUTOR_SETTLED, {
28331
+ onAbort = () => {
28332
+ timedOut = executorSignal.reason === timeoutReason;
28333
+ cancelled = !timedOut;
28334
+ observation?.record(timedOut ? ETelemetryEventName.HOOK_TIMEOUT_REQUESTED : ETelemetryEventName.HOOK_CANCEL_REQUESTED, {});
28335
+ };
28336
+ executorSignal.addEventListener("abort", onAbort, { once: true });
28337
+ result = await waitWithSignal(this.deps.hookExecutor.execute(resource, context2, {
28338
+ signal: executorSignal,
28339
+ ...runtimeInput === void 0 ? {} : { runtimeInput }
28340
+ }).then((value) => {
28341
+ settled = true;
28342
+ observation?.record(ETelemetryEventName.HOOK_EXECUTOR_SETTLED, {
28343
+ [ETelemetryAttribute.LINKQUE_HOOK_EXECUTOR_SETTLED]: true,
28344
+ [ETelemetryAttribute.LINKQUE_HOOK_RESULT]: value.skipped ? ETelemetryHookResult.SKIPPED : value.ok ? ETelemetryHookResult.SUCCESS : ETelemetryHookResult.ERROR
28345
+ });
28346
+ if (timedOut || cancelled)
28347
+ observation?.finish(timedOut ? ETelemetryOutcome.TIMEOUT : ETelemetryOutcome.CANCELLED, {
28348
+ [ETelemetryAttribute.LINKQUE_OBSERVATION_BOUNDARY]: ETelemetryObservationBoundary.EXECUTOR_SETTLED,
28048
28349
  [ETelemetryAttribute.LINKQUE_HOOK_EXECUTOR_SETTLED]: true,
28049
28350
  [ETelemetryAttribute.LINKQUE_HOOK_RESULT]: value.skipped ? ETelemetryHookResult.SKIPPED : value.ok ? ETelemetryHookResult.SUCCESS : ETelemetryHookResult.ERROR
28050
28351
  });
28051
- if (timedOut || cancelled)
28052
- observation?.finish(timedOut ? ETelemetryOutcome.TIMEOUT : ETelemetryOutcome.CANCELLED, {
28053
- [ETelemetryAttribute.LINKQUE_OBSERVATION_BOUNDARY]: ETelemetryObservationBoundary.EXECUTOR_SETTLED,
28054
- [ETelemetryAttribute.LINKQUE_HOOK_EXECUTOR_SETTLED]: true,
28055
- [ETelemetryAttribute.LINKQUE_HOOK_RESULT]: value.skipped ? ETelemetryHookResult.SKIPPED : value.ok ? ETelemetryHookResult.SUCCESS : ETelemetryHookResult.ERROR
28056
- });
28057
- return value;
28058
- }, (error) => {
28059
- settled = true;
28060
- observation?.record(ETelemetryEventName.HOOK_EXECUTOR_SETTLED, {
28352
+ return value;
28353
+ }, (error) => {
28354
+ settled = true;
28355
+ observation?.record(ETelemetryEventName.HOOK_EXECUTOR_SETTLED, {
28356
+ [ETelemetryAttribute.LINKQUE_HOOK_EXECUTOR_SETTLED]: true,
28357
+ [ETelemetryAttribute.LINKQUE_HOOK_RESULT]: ETelemetryHookResult.ERROR
28358
+ });
28359
+ if (timedOut || cancelled)
28360
+ observation?.finish(timedOut ? ETelemetryOutcome.TIMEOUT : ETelemetryOutcome.CANCELLED, {
28361
+ [ETelemetryAttribute.LINKQUE_OBSERVATION_BOUNDARY]: ETelemetryObservationBoundary.EXECUTOR_SETTLED,
28061
28362
  [ETelemetryAttribute.LINKQUE_HOOK_EXECUTOR_SETTLED]: true,
28062
28363
  [ETelemetryAttribute.LINKQUE_HOOK_RESULT]: ETelemetryHookResult.ERROR
28063
28364
  });
28064
- if (timedOut || cancelled)
28065
- observation?.finish(timedOut ? ETelemetryOutcome.TIMEOUT : ETelemetryOutcome.CANCELLED, {
28066
- [ETelemetryAttribute.LINKQUE_OBSERVATION_BOUNDARY]: ETelemetryObservationBoundary.EXECUTOR_SETTLED,
28067
- [ETelemetryAttribute.LINKQUE_HOOK_EXECUTOR_SETTLED]: true,
28068
- [ETelemetryAttribute.LINKQUE_HOOK_RESULT]: ETelemetryHookResult.ERROR
28069
- });
28070
- throw error;
28071
- }),
28072
- aborted
28073
- ]);
28365
+ throw error;
28366
+ }), executorSignal);
28074
28367
  } finally {
28075
- if (timeout !== void 0)
28076
- clearTimeout(timeout);
28077
28368
  if (onAbort !== void 0)
28078
28369
  executorSignal.removeEventListener("abort", onAbort);
28370
+ scope.dispose();
28079
28371
  }
28080
28372
  } catch (error) {
28081
28373
  if (!settled && (timedOut || cancelled)) {
@@ -28181,16 +28473,21 @@ var SideEffectRunner = class {
28181
28473
  return this.pending.size;
28182
28474
  }
28183
28475
  schedule(task) {
28184
- const controller = new AbortController();
28185
28476
  let timedOut = false;
28186
- const timer = setTimeout(() => {
28187
- timedOut = true;
28188
- controller.abort();
28189
- }, task.timeoutMs);
28190
- timer.unref?.();
28191
- const promise = this.runTask(task, controller.signal, () => timedOut).catch(() => {
28477
+ const timeoutReason = new DOMException("\u65C1\u8DEF Hook \u6267\u884C\u8D85\u65F6", "TimeoutError");
28478
+ const scope = new CancellationScope({
28479
+ timeoutMs: task.timeoutMs,
28480
+ timeoutReason,
28481
+ ref: false
28482
+ });
28483
+ const onAbort = () => {
28484
+ timedOut = scope.context.signal.reason === timeoutReason;
28485
+ };
28486
+ scope.context.signal.addEventListener("abort", onAbort, { once: true });
28487
+ const promise = this.runTask(task, scope.context.signal, () => timedOut).catch(() => {
28192
28488
  }).finally(() => {
28193
- clearTimeout(timer);
28489
+ scope.context.signal.removeEventListener("abort", onAbort);
28490
+ scope.dispose();
28194
28491
  this.pending.delete(promise);
28195
28492
  });
28196
28493
  this.pending.add(promise);
@@ -28214,15 +28511,22 @@ var SideEffectRunner = class {
28214
28511
  traceId: this.attribution.traceId
28215
28512
  }
28216
28513
  });
28217
- let timer;
28218
- const timeout = new Promise((resolve) => {
28219
- timer = setTimeout(() => resolve("timeout"), options.timeoutMs);
28220
- timer.unref?.();
28221
- });
28222
28514
  const settled = Promise.allSettled(this.pending).then(() => "completed");
28223
- const outcome = await Promise.race([settled, timeout]);
28224
- if (timer !== void 0)
28225
- clearTimeout(timer);
28515
+ let outcome = "timeout";
28516
+ if (options.timeoutMs > 0) {
28517
+ const scope = new CancellationScope({
28518
+ timeoutMs: options.timeoutMs,
28519
+ ref: false
28520
+ });
28521
+ try {
28522
+ outcome = await waitWithSignal(settled, scope.context.signal);
28523
+ } catch (error) {
28524
+ if (!scope.context.signal.aborted)
28525
+ throw error;
28526
+ } finally {
28527
+ scope.dispose();
28528
+ }
28529
+ }
28226
28530
  const costMs = this.now() - startedAt;
28227
28531
  const completed = outcome === "completed";
28228
28532
  writeHookLog(this.debugLog, {
@@ -29002,26 +29306,7 @@ function throwIfWebSearchAborted(signal) {
29002
29306
  throw new DOMException("\u5168\u7F51\u641C\u7D22\u5DF2\u53D6\u6D88", "AbortError");
29003
29307
  }
29004
29308
  async function awaitWebSearchOperation(operation, signal) {
29005
- signal?.throwIfAborted();
29006
- if (!signal)
29007
- return operation();
29008
- let onAbort = () => {
29009
- };
29010
- const cancelled = new Promise((_, reject) => {
29011
- onAbort = () => reject(signal.reason);
29012
- signal.addEventListener("abort", onAbort, { once: true });
29013
- });
29014
- try {
29015
- return await Promise.race([
29016
- Promise.resolve().then(() => {
29017
- signal.throwIfAborted();
29018
- return operation();
29019
- }),
29020
- cancelled
29021
- ]);
29022
- } finally {
29023
- signal.removeEventListener("abort", onAbort);
29024
- }
29309
+ return waitWithSignal(operation, signal);
29025
29310
  }
29026
29311
 
29027
29312
  // ../linkque-agent-runtime/dist/esm/core/webSearchResource.js
@@ -33886,26 +34171,52 @@ var Client = class extends Protocol {
33886
34171
  // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
33887
34172
  var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
33888
34173
 
34174
+ // ../linkque-agent-runtime/dist/esm/impl/abortableDelay.js
34175
+ import { setTimeout as delay } from "node:timers/promises";
34176
+ async function abortableDelay(delayMs, signal, ref = true) {
34177
+ signal?.throwIfAborted();
34178
+ try {
34179
+ await delay(delayMs, void 0, { signal, ref });
34180
+ } catch (error) {
34181
+ signal?.throwIfAborted();
34182
+ throw error;
34183
+ }
34184
+ }
34185
+
33889
34186
  // ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/connectRetry.js
33890
34187
  var DEFAULT_MAX_CONNECT_ATTEMPTS = 3;
33891
34188
  var DEFAULT_RECONNECT_BACKOFF_MS = 1e3;
33892
34189
  var MAX_RECONNECT_BACKOFF_MS = 8e3;
33893
- async function connectMcpClientWithRetry(config, factories) {
34190
+ async function connectMcpClientWithRetry(config, factories, signal) {
33894
34191
  const maxAttempts = Math.max(1, config.maxConnectAttempts ?? DEFAULT_MAX_CONNECT_ATTEMPTS);
33895
34192
  const backoffBase = config.reconnectBackoffMs ?? DEFAULT_RECONNECT_BACKOFF_MS;
33896
34193
  let lastError;
33897
34194
  for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
34195
+ signal?.throwIfAborted();
33898
34196
  const transport = factories.createTransport();
33899
34197
  const client = factories.createClient();
34198
+ let closing;
34199
+ const close = () => closing ??= safeClose(transport, client);
33900
34200
  try {
33901
- await client.connect(transport);
34201
+ const connecting = client.connect(transport).then(() => {
34202
+ if (signal?.aborted) {
34203
+ void close();
34204
+ signal.throwIfAborted();
34205
+ }
34206
+ });
34207
+ await waitWithSignal(connecting, signal);
34208
+ signal?.throwIfAborted();
33902
34209
  return { transport, client };
33903
34210
  } catch (error) {
33904
34211
  lastError = error;
33905
- await safeClose(transport, client);
34212
+ if (signal?.aborted) {
34213
+ void close();
34214
+ signal.throwIfAborted();
34215
+ }
34216
+ await waitWithSignal(close(), signal);
33906
34217
  if (attempt < maxAttempts) {
33907
- const delay = Math.min(backoffBase * 2 ** (attempt - 1), MAX_RECONNECT_BACKOFF_MS);
33908
- await sleep(delay);
34218
+ const delay2 = Math.min(backoffBase * 2 ** (attempt - 1), MAX_RECONNECT_BACKOFF_MS);
34219
+ await abortableDelay(delay2, signal, false);
33909
34220
  }
33910
34221
  }
33911
34222
  }
@@ -33924,33 +34235,11 @@ async function safeClose(transport, client) {
33924
34235
  } catch {
33925
34236
  }
33926
34237
  }
33927
- function sleep(ms) {
33928
- return new Promise((resolve) => {
33929
- const timer = setTimeout(resolve, ms);
33930
- timer.unref?.();
33931
- });
33932
- }
33933
34238
 
33934
34239
  // ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/mcpInvocationContext.js
33935
34240
  import { AsyncLocalStorage } from "node:async_hooks";
33936
34241
  async function waitForMcpOperation(operation, signal) {
33937
- signal.throwIfAborted();
33938
- let onAbort = () => {
33939
- };
33940
- try {
33941
- return await Promise.race([
33942
- new Promise((_, reject) => {
33943
- onAbort = () => reject(signal.reason);
33944
- signal.addEventListener("abort", onAbort, { once: true });
33945
- }),
33946
- Promise.resolve().then(() => {
33947
- signal.throwIfAborted();
33948
- return operation();
33949
- })
33950
- ]);
33951
- } finally {
33952
- signal.removeEventListener("abort", onAbort);
33953
- }
34242
+ return waitWithSignal(operation, signal);
33954
34243
  }
33955
34244
  var McpInvocationContext = class {
33956
34245
  storage = new AsyncLocalStorage();
@@ -33961,19 +34250,22 @@ var McpInvocationContext = class {
33961
34250
  if (!Number.isFinite(timeoutMs) || timeoutMs <= 0)
33962
34251
  throw new Error("MCP \u8D85\u65F6\u5FC5\u987B\u4E3A\u6709\u9650\u6B63\u6570");
33963
34252
  signal?.throwIfAborted();
33964
- const controller = new AbortController();
34253
+ const scope = new CancellationScope({
34254
+ signals: signal ? [signal] : [],
34255
+ timeoutMs,
34256
+ timeoutReason: new DOMException("MCP \u8C03\u7528\u603B\u9884\u7B97\u5DF2\u8017\u5C3D", "TimeoutError")
34257
+ });
33965
34258
  const context2 = {
33966
- signal: signal ? AbortSignal.any([signal, controller.signal]) : controller.signal,
33967
- deadline: performance.now() + timeoutMs
34259
+ signal: scope.context.signal,
34260
+ deadline: scope.context.deadline
33968
34261
  };
33969
- const timer = setTimeout(() => controller.abort(new DOMException("MCP \u8C03\u7528\u603B\u9884\u7B97\u5DF2\u8017\u5C3D", "TimeoutError")), Math.min(timeoutMs, 2147483647));
33970
34262
  try {
33971
- return await this.storage.run(context2, () => waitForMcpOperation(() => operation(context2), context2.signal));
34263
+ return await this.storage.run(context2, () => waitWithSignal(() => operation(context2), context2.signal));
33972
34264
  } catch (error) {
33973
- context2.signal.throwIfAborted();
34265
+ scope.context.throwIfAborted();
33974
34266
  throw error;
33975
34267
  } finally {
33976
- clearTimeout(timer);
34268
+ scope.dispose();
33977
34269
  }
33978
34270
  }
33979
34271
  };
@@ -35686,8 +35978,12 @@ function withTimeout(fetch2, timeoutMs) {
35686
35978
  if (init?.signal) {
35687
35979
  return fetch2(url2, init);
35688
35980
  }
35689
- const signal = AbortSignal.timeout(timeoutMs);
35690
- return fetch2(url2, { ...init, signal });
35981
+ const scope = new CancellationScope({ timeoutMs });
35982
+ try {
35983
+ return await fetch2(url2, { ...init, signal: scope.context.signal });
35984
+ } finally {
35985
+ scope.dispose();
35986
+ }
35691
35987
  };
35692
35988
  }
35693
35989
  function createSseTransport(config, signer, onTraceId, debugLog, getCallHeaders, invocationContext) {
@@ -35916,12 +36212,13 @@ var RemoteGatewayMcpServerProvider = class {
35916
36212
  this.onTraceId = options.onTraceId;
35917
36213
  this.debugLog = options.debugLog;
35918
36214
  }
35919
- async servers(resources) {
35920
- return Promise.all(resources.map((r) => this.connectOne(r)));
36215
+ async servers(resources, signal) {
36216
+ return Promise.all(resources.map((r) => this.connectOne(r, signal)));
35921
36217
  }
35922
36218
  /** 连单个远端 server 并包装成 IMcpServer。建连失败有限重试 + 失败清理由 helper 负责。 */
35923
- async connectOne(resource) {
36219
+ async connectOne(resource, connectSignal) {
35924
36220
  const config = await this.resolveConfig(resource);
36221
+ connectSignal?.throwIfAborted();
35925
36222
  const timeoutMs = config.requestTimeoutMs ?? 18e4;
35926
36223
  if (!Number.isFinite(timeoutMs) || timeoutMs <= 0)
35927
36224
  throw new Error("MCP \u8D85\u65F6\u5FC5\u987B\u4E3A\u6709\u9650\u6B63\u6570");
@@ -35930,7 +36227,7 @@ var RemoteGatewayMcpServerProvider = class {
35930
36227
  const { client } = await connectMcpClientWithRetry(config, {
35931
36228
  createTransport: () => createSseTransport(config, this.createSigner(config, this.getAuthorizationHeader), this.onTraceId, this.debugLog, () => callHeaders.getStore(), this.invocationContext),
35932
36229
  createClient: () => this.createClient()
35933
- });
36230
+ }, connectSignal);
35934
36231
  const serverName = resource.config.serverName ?? resource.resourceId;
35935
36232
  const argsMappingRules = resource.config.argsMappingRules ?? [];
35936
36233
  let requestSequence = 0;
@@ -35963,7 +36260,7 @@ var RemoteGatewayMcpServerProvider = class {
35963
36260
  }
35964
36261
  };
35965
36262
  const loggedClient = {
35966
- listTools: () => request("tools/list", {}, () => client.listTools()),
36263
+ listTools: (params, options) => request("tools/list", params ?? {}, () => client.listTools(params, options)),
35967
36264
  callTool: (params, resultSchema, requestOptions) => request("tools/call", params, () => client.callTool(params, resultSchema, requestOptions))
35968
36265
  };
35969
36266
  const callTool = (name, args, signal, options) => callHeaders.run(options?.headers ?? {}, () => this.invocationContext.run(timeoutMs, signal, async (invocation) => {
@@ -36013,7 +36310,7 @@ var RemoteGatewayMcpServerProvider = class {
36013
36310
  return {
36014
36311
  resourceId: resource.resourceId,
36015
36312
  serverName,
36016
- listTools: () => listToolsFromClient(loggedClient, resource.resourceId, callTool),
36313
+ listTools: (signal) => listToolsFromClient(loggedClient, resource.resourceId, callTool, signal),
36017
36314
  callTool,
36018
36315
  close: async () => {
36019
36316
  try {
@@ -36024,8 +36321,9 @@ var RemoteGatewayMcpServerProvider = class {
36024
36321
  };
36025
36322
  }
36026
36323
  };
36027
- async function listToolsFromClient(client, resourceId, callTool) {
36028
- const result = await client.listTools();
36324
+ async function listToolsFromClient(client, resourceId, callTool, listSignal) {
36325
+ listSignal?.throwIfAborted();
36326
+ const result = await client.listTools(void 0, listSignal ? { signal: listSignal } : void 0);
36029
36327
  const tools = result.tools ?? [];
36030
36328
  return tools.map((tool) => {
36031
36329
  const descriptor = {
@@ -36094,28 +36392,20 @@ var LinkqueKnowledgeSearchPort = class {
36094
36392
  "content-type": "application/json",
36095
36393
  ...await this.getAuthHeaders()
36096
36394
  };
36097
- const controller = new AbortController();
36098
- const timer = setTimeout(() => controller.abort(), this.timeoutMs);
36099
- const onAbort = () => controller.abort();
36100
- if (signal) {
36101
- if (signal.aborted) {
36102
- controller.abort();
36103
- } else {
36104
- signal.addEventListener("abort", onAbort, { once: true });
36105
- }
36106
- }
36395
+ const scope = new CancellationScope({
36396
+ signals: signal ? [signal] : [],
36397
+ timeoutMs: this.timeoutMs
36398
+ });
36107
36399
  let resp;
36108
36400
  try {
36109
36401
  resp = await this.fetchImpl(url2, {
36110
36402
  method: "POST",
36111
36403
  headers,
36112
36404
  body,
36113
- signal: controller.signal
36405
+ signal: scope.context.signal
36114
36406
  });
36115
36407
  } finally {
36116
- clearTimeout(timer);
36117
- if (signal)
36118
- signal.removeEventListener("abort", onAbort);
36408
+ scope.dispose();
36119
36409
  }
36120
36410
  if (!resp.ok) {
36121
36411
  const text = await safeText2(resp);
@@ -36189,13 +36479,12 @@ var LinkqueWebSearchPort = class {
36189
36479
  }
36190
36480
  async search(input, signal) {
36191
36481
  const startedAt = Date.now();
36192
- const controller = new AbortController();
36193
- const onAbort = () => controller.abort(new DOMException("\u5168\u7F51\u641C\u7D22\u5DF2\u53D6\u6D88", "AbortError"));
36194
- signal?.addEventListener("abort", onAbort, { once: true });
36195
- if (signal?.aborted)
36196
- onAbort();
36197
- const timer = setTimeout(() => controller.abort(new WebSearchError("WEB_SEARCH_TIMEOUT")), this.timeoutMs);
36198
- const requestSignal = controller.signal;
36482
+ const scope = new CancellationScope({
36483
+ signals: signal ? [signal] : [],
36484
+ timeoutMs: this.timeoutMs,
36485
+ timeoutReason: new WebSearchError("WEB_SEARCH_TIMEOUT")
36486
+ });
36487
+ const requestSignal = scope.context.signal;
36199
36488
  let outcome = "success";
36200
36489
  let status;
36201
36490
  let count = 0;
@@ -36240,8 +36529,7 @@ var LinkqueWebSearchPort = class {
36240
36529
  outcome = failure5.code;
36241
36530
  throw new WebSearchError(failure5.code);
36242
36531
  } finally {
36243
- clearTimeout(timer);
36244
- signal?.removeEventListener("abort", onAbort);
36532
+ scope.dispose();
36245
36533
  try {
36246
36534
  this.options.debugLog?.(JSON.stringify({
36247
36535
  tag: "web-search-http",
@@ -37353,9 +37641,9 @@ var import_otlp_transformer = __toESM(require_src7(), 1);
37353
37641
  import { randomUUID as randomUUID5 } from "node:crypto";
37354
37642
 
37355
37643
  // ../linkque-agent-runtime/dist/esm/impl/telemetry/identityQueue.js
37644
+ import { AsyncLocalStorage as AsyncLocalStorage3 } from "node:async_hooks";
37356
37645
  init_esm();
37357
37646
  var import_core5 = __toESM(require_src(), 1);
37358
- import { AsyncLocalStorage as AsyncLocalStorage3 } from "node:async_hooks";
37359
37647
  function authorizationKey(auth2) {
37360
37648
  return JSON.stringify([
37361
37649
  auth2.subject,
@@ -37393,7 +37681,7 @@ var IdentityQueue = class {
37393
37681
  maxBytes: options.maxBytes ?? 16 * 1024 * 1024,
37394
37682
  maxPartitions: options.maxPartitions ?? 32,
37395
37683
  batchMaxRecords: options.batchMaxRecords ?? 100,
37396
- batchMaxBytes: options.batchMaxBytes ?? 256 * 1024,
37684
+ batchMaxBytes: options.batchMaxBytes ?? 1024 * 1024,
37397
37685
  intervalMs: options.intervalMs ?? 1e3,
37398
37686
  sendTimeoutMs: options.sendTimeoutMs ?? 2e3,
37399
37687
  maxAgeMs: options.maxAgeMs ?? 6e4,
@@ -37481,7 +37769,7 @@ var IdentityQueue = class {
37481
37769
  const resource = body[signal === ETelemetrySignal.LOGS ? "resourceLogs" : "resourceSpans"][0];
37482
37770
  const bytes2 = Buffer.byteLength(JSON.stringify(resource)) + 1;
37483
37771
  const ratio = critical ? 1 : 1 - this.limits.terminalReserveRatio;
37484
- if (bytes2 + 32 > this.limits.batchMaxBytes || bytes2 > 16 * 1024 || part.records.length + 1 > Math.floor(this.limits.partitionMaxRecords * ratio) || part.bytes + bytes2 > this.limits.partitionMaxBytes * ratio || this.bytes + bytes2 > this.limits.maxBytes * ratio) {
37772
+ if (bytes2 + 32 > this.limits.batchMaxBytes || part.records.length + 1 > Math.floor(this.limits.partitionMaxRecords * ratio) || part.bytes + bytes2 > this.limits.partitionMaxBytes * ratio || this.bytes + bytes2 > this.limits.maxBytes * ratio) {
37485
37773
  this.drop(ETelemetryDiagnosticCode.QUEUE_LIMIT, 1, part);
37486
37774
  return;
37487
37775
  }
@@ -37543,97 +37831,90 @@ var IdentityQueue = class {
37543
37831
  batch.push(record2);
37544
37832
  bytes2 += record2.bytes;
37545
37833
  }
37546
- const controller = new AbortController();
37547
- this.controllers.add(controller);
37548
- let timer;
37549
- const timeout = new Promise((_, reject) => {
37550
- controller.signal.addEventListener("abort", () => reject(new Error("\u9065\u6D4B\u53D1\u9001\u7EC8\u6B62")), { once: true });
37551
- timer = setTimeout(() => controller.abort(), this.limits.sendTimeoutMs);
37552
- timer.unref?.();
37834
+ const scope = new CancellationScope({
37835
+ timeoutMs: this.limits.sendTimeoutMs,
37836
+ timeoutReason: new Error("\u9065\u6D4B\u53D1\u9001\u7EC8\u6B62"),
37837
+ ref: false
37553
37838
  });
37839
+ this.controllers.add(scope);
37554
37840
  try {
37555
- await Promise.race([
37556
- this.exportContext.run(true, () => context.with((0, import_core5.suppressTracing)(context.active()), async () => {
37557
- const headers = await part.authorization.getHeaders();
37558
- if (controller.signal.aborted || this.closed)
37559
- return;
37560
- const response = await (this.options.fetch ?? fetch)(signal === ETelemetrySignal.LOGS ? this.options.logsEndpoint : this.options.tracesEndpoint, {
37561
- method: "POST",
37562
- redirect: "error",
37563
- signal: controller.signal,
37564
- headers: { ...headers, "content-type": "application/json" },
37565
- body: JSON.stringify({
37566
- [signal === ETelemetrySignal.LOGS ? "resourceLogs" : "resourceSpans"]: batch.map((record2) => record2.resource)
37567
- })
37568
- });
37569
- if (controller.signal.aborted || this.closed)
37570
- return;
37571
- if (response.status === 200) {
37572
- const reader = response.body?.getReader();
37573
- const chunks = [];
37574
- let size = 0;
37575
- if (reader) {
37576
- try {
37577
- for (; ; ) {
37578
- const next = await reader.read();
37579
- if (next.done)
37580
- break;
37581
- size += next.value.length;
37582
- if (size > 64 * 1024)
37583
- throw new Error("\u9065\u6D4B\u54CD\u5E94\u8D85\u9650");
37584
- chunks.push(next.value);
37585
- }
37586
- } finally {
37587
- await reader.cancel().catch(() => void 0);
37841
+ await waitWithSignal(() => this.exportContext.run(true, () => context.with((0, import_core5.suppressTracing)(context.active()), async () => {
37842
+ const headers = await part.authorization.getHeaders();
37843
+ if (scope.context.signal.aborted || this.closed)
37844
+ return;
37845
+ const response = await (this.options.fetch ?? fetch)(signal === ETelemetrySignal.LOGS ? this.options.logsEndpoint : this.options.tracesEndpoint, {
37846
+ method: "POST",
37847
+ redirect: "error",
37848
+ signal: scope.context.signal,
37849
+ headers: { ...headers, "content-type": "application/json" },
37850
+ body: JSON.stringify({
37851
+ [signal === ETelemetrySignal.LOGS ? "resourceLogs" : "resourceSpans"]: batch.map((record2) => record2.resource)
37852
+ })
37853
+ });
37854
+ if (scope.context.signal.aborted || this.closed)
37855
+ return;
37856
+ if (response.status === 200) {
37857
+ const reader = response.body?.getReader();
37858
+ const chunks = [];
37859
+ let size = 0;
37860
+ if (reader) {
37861
+ try {
37862
+ for (; ; ) {
37863
+ const next = await reader.read();
37864
+ if (next.done)
37865
+ break;
37866
+ size += next.value.length;
37867
+ if (size > 64 * 1024)
37868
+ throw new Error("\u9065\u6D4B\u54CD\u5E94\u8D85\u9650");
37869
+ chunks.push(next.value);
37588
37870
  }
37871
+ } finally {
37872
+ await reader.cancel().catch(() => void 0);
37589
37873
  }
37590
- const raw = Buffer.concat(chunks).toString("utf8");
37591
- const result = raw ? JSON.parse(raw) : {};
37592
- if (!result || typeof result !== "object" || Array.isArray(result))
37593
- throw new Error("\u9065\u6D4B\u54CD\u5E94\u975E\u6CD5");
37594
- const rejected = Number(result.partialSuccess?.[signal === ETelemetrySignal.LOGS ? "rejectedLogRecords" : "rejectedSpans"] ?? 0);
37595
- if (!Number.isSafeInteger(rejected) || rejected < 0 || rejected > batch.length)
37596
- throw new Error("\u9065\u6D4B\u62D2\u6536\u8BA1\u6570\u975E\u6CD5");
37597
- if (controller.signal.aborted || this.closed)
37598
- return;
37599
- this.remove(part, batch);
37600
- this.sent += batch.length - rejected;
37601
- part.sent += batch.length - rejected;
37602
- if (rejected)
37603
- this.drop(ETelemetryDiagnosticCode.PARTIAL_SUCCESS, rejected, part);
37604
- part.retry = 0;
37605
- part.nextAt = 0;
37874
+ }
37875
+ const raw = Buffer.concat(chunks).toString("utf8");
37876
+ const result = raw ? JSON.parse(raw) : {};
37877
+ if (!result || typeof result !== "object" || Array.isArray(result))
37878
+ throw new Error("\u9065\u6D4B\u54CD\u5E94\u975E\u6CD5");
37879
+ const rejected = Number(result.partialSuccess?.[signal === ETelemetrySignal.LOGS ? "rejectedLogRecords" : "rejectedSpans"] ?? 0);
37880
+ if (!Number.isSafeInteger(rejected) || rejected < 0 || rejected > batch.length)
37881
+ throw new Error("\u9065\u6D4B\u62D2\u6536\u8BA1\u6570\u975E\u6CD5");
37882
+ if (scope.context.signal.aborted || this.closed)
37883
+ return;
37884
+ this.remove(part, batch);
37885
+ this.sent += batch.length - rejected;
37886
+ part.sent += batch.length - rejected;
37887
+ if (rejected)
37888
+ this.drop(ETelemetryDiagnosticCode.PARTIAL_SUCCESS, rejected, part);
37889
+ part.retry = 0;
37890
+ part.nextAt = 0;
37891
+ } else {
37892
+ await response.body?.cancel().catch(() => void 0);
37893
+ if (scope.context.signal.aborted || this.closed)
37894
+ return;
37895
+ if ([429, 502, 503, 504].includes(response.status)) {
37896
+ const value = response.headers.get("retry-after");
37897
+ const delay2 = value === null ? 0 : /^\d+$/.test(value) ? Number(value) * 1e3 : Math.max(0, Date.parse(value) - Date.now());
37898
+ this.retry(part, Number.isFinite(delay2) ? delay2 : 0);
37606
37899
  } else {
37607
- await response.body?.cancel().catch(() => void 0);
37608
- if (controller.signal.aborted || this.closed)
37609
- return;
37610
- if ([429, 502, 503, 504].includes(response.status)) {
37611
- const value = response.headers.get("retry-after");
37612
- const delay = value === null ? 0 : /^\d+$/.test(value) ? Number(value) * 1e3 : Math.max(0, Date.parse(value) - Date.now());
37613
- this.retry(part, Number.isFinite(delay) ? delay : 0);
37900
+ if ([401, 403].includes(response.status)) {
37901
+ part.blocked = true;
37902
+ const records = [...part.records];
37903
+ this.remove(part, records);
37904
+ this.drop(ETelemetryDiagnosticCode.AUTHORIZATION_REJECTED, records.length, part);
37614
37905
  } else {
37615
- if ([401, 403].includes(response.status)) {
37616
- part.blocked = true;
37617
- const records = [...part.records];
37618
- this.remove(part, records);
37619
- this.drop(ETelemetryDiagnosticCode.AUTHORIZATION_REJECTED, records.length, part);
37620
- } else {
37621
- this.remove(part, batch);
37622
- this.drop(ETelemetryDiagnosticCode.PERMANENT_REJECTION, batch.length, part);
37623
- }
37906
+ this.remove(part, batch);
37907
+ this.drop(ETelemetryDiagnosticCode.PERMANENT_REJECTION, batch.length, part);
37624
37908
  }
37625
37909
  }
37626
- })),
37627
- timeout
37628
- ]);
37910
+ }
37911
+ })), scope.context.signal);
37629
37912
  } catch {
37630
37913
  if (!this.closed)
37631
37914
  this.retry(part);
37632
37915
  } finally {
37633
- if (timer)
37634
- clearTimeout(timer);
37635
- controller.abort();
37636
- this.controllers.delete(controller);
37916
+ scope.dispose();
37917
+ this.controllers.delete(scope);
37637
37918
  }
37638
37919
  }
37639
37920
  retry(part, minimum = 0) {
@@ -37669,8 +37950,8 @@ var IdentityQueue = class {
37669
37950
  this.closed = true;
37670
37951
  if (this.timer)
37671
37952
  clearInterval(this.timer);
37672
- for (const controller of this.controllers)
37673
- controller.abort();
37953
+ for (const scope of this.controllers)
37954
+ scope.cancel(new Error("\u9065\u6D4B\u53D1\u9001\u7EC8\u6B62"));
37674
37955
  const count = this.pending();
37675
37956
  if (count)
37676
37957
  this.drop(ETelemetryDiagnosticCode.SHUTDOWN_DROP, count);
@@ -37750,6 +38031,14 @@ var allowedAttributeKeys = /* @__PURE__ */ new Set([
37750
38031
  ETelemetryAttribute.HARNESS_MODEL_PURPOSE,
37751
38032
  ETelemetryAttribute.HARNESS_MODEL_INVOCATION_COUNT,
37752
38033
  ETelemetryAttribute.GEN_AI_TOOL_NAME,
38034
+ ETelemetryAttribute.LINKQUE_TOOL_DISPLAY_NAME,
38035
+ ETelemetryAttribute.LINKQUE_CARD_EXECUTION_ID,
38036
+ ETelemetryAttribute.LINKQUE_CARD_REF,
38037
+ ETelemetryAttribute.LINKQUE_CARD_REVISION,
38038
+ ETelemetryAttribute.LINKQUE_CARD_DISPLAY_NAME,
38039
+ ETelemetryAttribute.LINKQUE_CARD_PHASE,
38040
+ ETelemetryAttribute.LINKQUE_CARD_SOURCE_ID,
38041
+ ETelemetryAttribute.LINKQUE_CARD_DELIVERY,
37753
38042
  ETelemetryAttribute.GEN_AI_TOOL_CALL_ID,
37754
38043
  ETelemetryAttribute.HARNESS_TOOL_RESULT_STATUS,
37755
38044
  ETelemetryAttribute.LINKQUE_TOOL_FAILURE_STAGE,
@@ -37897,7 +38186,7 @@ var OtelRuntimeTelemetry = class {
37897
38186
  {
37898
38187
  onEmit: (record2, ctx) => {
37899
38188
  const route = ctx?.getValue(this.routeKey);
37900
- this.output(ETelemetrySignal.LOGS, import_otlp_transformer.JsonLogsSerializer.serializeRequest([record2]), route?.route, route?.critical ?? false, route?.localOnly ?? false);
38189
+ this.output(ETelemetrySignal.LOGS, import_otlp_transformer.JsonLogsSerializer.serializeRequest([record2]), route?.route, route?.critical ?? false);
37901
38190
  },
37902
38191
  forceFlush: async () => void 0,
37903
38192
  shutdown: async () => void 0
@@ -37905,13 +38194,12 @@ var OtelRuntimeTelemetry = class {
37905
38194
  ]
37906
38195
  });
37907
38196
  }
37908
- output(signal, encoded, route, critical, localOnly = false) {
38197
+ output(signal, encoded, route, critical) {
37909
38198
  if (!encoded || this.outputActive || this.disposed)
37910
38199
  return;
37911
38200
  this.outputActive = true;
37912
38201
  try {
37913
- if (!localOnly)
37914
- this.queue.enqueue(route, signal, encoded, critical);
38202
+ this.queue.enqueue(route, signal, encoded, critical);
37915
38203
  if (this.options.localSink) {
37916
38204
  try {
37917
38205
  const payload = JSON.parse(new TextDecoder().decode(encoded));
@@ -38067,28 +38355,28 @@ var OtelRuntimeTelemetry = class {
38067
38355
  Math.floor(now / 1e3),
38068
38356
  now % 1e3 * 1e6
38069
38357
  ];
38070
- const localOnly = name === ETelemetryEventName.CONTENT_RECORDED;
38071
- if (localOnly && body && typeof body === "object" && "value" in body) {
38358
+ const contentRecord = name === ETelemetryEventName.CONTENT_RECORDED;
38359
+ if (contentRecord && body && typeof body === "object" && "value" in body) {
38072
38360
  const { value, ...metadata } = body;
38073
38361
  try {
38074
38362
  const valueJson = JSON.stringify(value);
38075
- body = valueJson !== void 0 && Buffer.byteLength(JSON.stringify(valueJson), "utf8") <= 512 * 1024 ? { ...metadata, valueJson } : { ...metadata, availability: "unavailable", reason: "content_limit" };
38363
+ body = valueJson !== void 0 && Buffer.byteLength(JSON.stringify(valueJson), "utf8") <= 512 * 1024 ? { ...metadata, valueJson } : {
38364
+ ...metadata,
38365
+ availability: "unavailable",
38366
+ reason: "content_limit"
38367
+ };
38076
38368
  } catch {
38077
38369
  body = { ...metadata, availability: "unavailable" };
38078
38370
  }
38079
38371
  }
38080
- if (!localOnly && operation.span.isRecording())
38372
+ if (!contentRecord && operation.span.isRecording())
38081
38373
  operation.span.addEvent(
38082
38374
  name,
38083
38375
  // 复用已投影的属性;Span 已持有上下文,事件只保留本次事实及去重字段。
38084
38376
  Object.fromEntries(Object.entries(record2).filter(([key]) => Object.hasOwn(attributes, key) || key === ETelemetryAttribute.HARNESS_RECORD_ID || key === ETelemetryAttribute.HARNESS_EVENT_SEQUENCE)),
38085
38377
  time
38086
38378
  );
38087
- const ctx = trace.setSpan(ROOT_CONTEXT, operation.span).setValue(this.routeKey, {
38088
- route: operation.state.route,
38089
- critical,
38090
- localOnly
38091
- });
38379
+ const ctx = trace.setSpan(ROOT_CONTEXT, operation.span).setValue(this.routeKey, { route: operation.state.route, critical });
38092
38380
  this.loggerProvider.getLogger(ETelemetryMetadata.SCOPE_NAME, ETelemetryVersion.V1_0).emit({
38093
38381
  eventName: name,
38094
38382
  timestamp: time,
@@ -38270,6 +38558,8 @@ export {
38270
38558
  ETelemetryErrorType,
38271
38559
  ETelemetryGenAiOperation,
38272
38560
  recordContentSection,
38561
+ waitWithSignal,
38562
+ CancellationScope,
38273
38563
  McpProxyTool,
38274
38564
  executeHomeData,
38275
38565
  CardActionDiagnostics,
@@ -38307,6 +38597,7 @@ export {
38307
38597
  NoopWebSearchPort,
38308
38598
  NoopRuntimeTelemetry,
38309
38599
  startRuntimeObservation,
38600
+ abortableDelay,
38310
38601
  RemoteGatewayMcpServerProvider,
38311
38602
  LinkqueKnowledgeSearchPort,
38312
38603
  LinkqueWebSearchPort,