linkque-cli-v2 1.4.4 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4514,13 +4514,14 @@ var require_fast_uri = __commonJS({
4514
4514
  if (!malformedIPLiteral) {
4515
4515
  malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
4516
4516
  }
4517
- if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4518
- if (uri.indexOf("%") !== -1) {
4519
- if (parsed.host !== void 0 && !malformedIPLiteral) {
4520
- const host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
4521
- parsed.host = reescapeHostDelimiters(host, isIP);
4522
- }
4517
+ if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
4518
+ let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
4519
+ if (!isIP) {
4520
+ host = normalizePercentEncoding(host.toLowerCase());
4523
4521
  }
4522
+ parsed.host = reescapeHostDelimiters(host, isIP);
4523
+ }
4524
+ if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4524
4525
  if (parsed.path) {
4525
4526
  parsed.path = normalizePathEncoding(parsed.path);
4526
4527
  }
@@ -22825,10 +22826,24 @@ var EDebugLogScope;
22825
22826
  EDebugLogScope2["LLM"] = "LLM";
22826
22827
  EDebugLogScope2["PI_EVENT"] = "PI_EVENT";
22827
22828
  EDebugLogScope2["MCP"] = "MCP";
22829
+ EDebugLogScope2["SKILL"] = "SKILL";
22828
22830
  EDebugLogScope2["HTTP"] = "HTTP";
22829
22831
  EDebugLogScope2["HOOK"] = "HOOK";
22830
22832
  })(EDebugLogScope || (EDebugLogScope = {}));
22831
22833
 
22834
+ // ../linkque-agent-runtime/dist/esm/core/debugLog.js
22835
+ function isDebugLoggingEnabled(level) {
22836
+ return level?.trim().toLowerCase() === "debug";
22837
+ }
22838
+ function createRuntimeDebugLog(level, sink) {
22839
+ const debug = isDebugLoggingEnabled(level);
22840
+ return (line, scope) => {
22841
+ if (!debug && (scope === EDebugLogScope.PI_EVENT || scope === EDebugLogScope.HTTP || scope === EDebugLogScope.MCP || scope === EDebugLogScope.SKILL))
22842
+ return;
22843
+ sink(line, scope);
22844
+ };
22845
+ }
22846
+
22832
22847
  // ../linkque-agent-runtime/dist/esm/core/cardTools.js
22833
22848
  import { randomUUID } from "node:crypto";
22834
22849
 
@@ -26035,6 +26050,392 @@ function resolvePhoneAuthorizationDependency(protocol, resourceIds, toolName) {
26035
26050
  return dependencies.length ? { required: dependencies.some((dependency) => dependency.required) } : void 0;
26036
26051
  }
26037
26052
 
26053
+ // ../linkque-agent-protocol/dist/esm/telemetry/telemetryEnums.js
26054
+ var CONTENT_VALUE_MAX_LENGTH = 16 * 1024;
26055
+ var ETelemetryAttribute;
26056
+ (function(ETelemetryAttribute2) {
26057
+ ETelemetryAttribute2["HARNESS_TELEMETRY_SCHEMA_VERSION"] = "harness.telemetry.schema.version";
26058
+ ETelemetryAttribute2["LINKQUE_TELEMETRY_SCHEMA_VERSION"] = "linkque.telemetry.schema.version";
26059
+ ETelemetryAttribute2["LINKQUE_TELEMETRY_ADAPTER_VERSION"] = "linkque.telemetry.adapter.version";
26060
+ ETelemetryAttribute2["HARNESS_TELEMETRY_SOURCE"] = "harness.telemetry.source";
26061
+ ETelemetryAttribute2["HARNESS_TELEMETRY_EVIDENCE"] = "harness.telemetry.evidence";
26062
+ ETelemetryAttribute2["HARNESS_TELEMETRY_COMPLETENESS"] = "harness.telemetry.completeness";
26063
+ ETelemetryAttribute2["LINKQUE_RUNTIME_KIND"] = "linkque.runtime.kind";
26064
+ ETelemetryAttribute2["LINKQUE_RUN_ID"] = "linkque.run.id";
26065
+ ETelemetryAttribute2["LINKQUE_AGENT_ID"] = "linkque.agent.id";
26066
+ ETelemetryAttribute2["HARNESS_SESSION_ID"] = "harness.session.id";
26067
+ ETelemetryAttribute2["LINKQUE_CONVERSATION_ID"] = "linkque.conversation.id";
26068
+ ETelemetryAttribute2["LINKQUE_REQUEST_ID"] = "linkque.request.id";
26069
+ ETelemetryAttribute2["LINKQUE_TURN_ID"] = "linkque.turn.id";
26070
+ ETelemetryAttribute2["LINKQUE_ACCOUNT_ID"] = "linkque.account.id";
26071
+ ETelemetryAttribute2["LINKQUE_CHANNEL"] = "linkque.channel";
26072
+ ETelemetryAttribute2["LINKQUE_USER_KEY"] = "linkque.user.key";
26073
+ ETelemetryAttribute2["HARNESS_ADVANCE_ID"] = "harness.advance.id";
26074
+ ETelemetryAttribute2["HARNESS_CALL_ID"] = "harness.call.id";
26075
+ ETelemetryAttribute2["HARNESS_INVOCATION_ID"] = "harness.invocation.id";
26076
+ ETelemetryAttribute2["HARNESS_ATTEMPT_ID"] = "harness.attempt.id";
26077
+ ETelemetryAttribute2["HARNESS_ATTEMPT_VISIBILITY"] = "harness.attempt.visibility";
26078
+ ETelemetryAttribute2["HARNESS_ADVANCE_OUTCOME"] = "harness.advance.outcome";
26079
+ ETelemetryAttribute2["HARNESS_OPERATION_OUTCOME"] = "harness.operation.outcome";
26080
+ ETelemetryAttribute2["HARNESS_REMOTE_COMPLETION"] = "harness.remote.completion";
26081
+ ETelemetryAttribute2["HARNESS_STATE_COMMIT_STATUS"] = "harness.state.commit.status";
26082
+ ETelemetryAttribute2["LINKQUE_OPERATION_ID"] = "linkque.operation.id";
26083
+ ETelemetryAttribute2["LINKQUE_OPERATION_NAME"] = "linkque.operation.name";
26084
+ ETelemetryAttribute2["LINKQUE_OPERATION_PARENT_ID"] = "linkque.operation.parent_id";
26085
+ ETelemetryAttribute2["LINKQUE_SPAN_PARENT_ID"] = "linkque.span.parent_id";
26086
+ ETelemetryAttribute2["HARNESS_RECORD_ID"] = "harness.record.id";
26087
+ ETelemetryAttribute2["HARNESS_EVENT_SEQUENCE"] = "harness.event.sequence";
26088
+ ETelemetryAttribute2["ERROR_TYPE"] = "error.type";
26089
+ ETelemetryAttribute2["LINKQUE_STREAM_TERMINATION"] = "linkque.stream.termination";
26090
+ ETelemetryAttribute2["LINKQUE_STREAM_CANCEL_SOURCE"] = "linkque.stream.cancel_source";
26091
+ ETelemetryAttribute2["LINKQUE_TERMINAL_EVIDENCE"] = "linkque.terminal.evidence";
26092
+ ETelemetryAttribute2["LINKQUE_RUNTIME_CLEANUP_OUTCOME"] = "linkque.runtime.cleanup_outcome";
26093
+ ETelemetryAttribute2["LINKQUE_OBSERVATION_BOUNDARY"] = "linkque.observation.boundary";
26094
+ ETelemetryAttribute2["LINKQUE_LOOP_ITERATION_ID"] = "linkque.loop.iteration.id";
26095
+ ETelemetryAttribute2["LINKQUE_LOOP_ITERATION_INDEX"] = "linkque.loop.iteration.index";
26096
+ ETelemetryAttribute2["LINKQUE_STREAM_TERMINAL_SOURCE"] = "linkque.stream.terminal_source";
26097
+ ETelemetryAttribute2["LINKQUE_STREAM_PUBLIC_TEXT_DELTA_COUNT"] = "linkque.stream.public_text_delta_count";
26098
+ ETelemetryAttribute2["LINKQUE_STREAM_THINKING_DELTA_COUNT"] = "linkque.stream.thinking_delta_count";
26099
+ ETelemetryAttribute2["LINKQUE_MODEL_FIRST_CHUNK_MS"] = "linkque.model.first_chunk_ms";
26100
+ ETelemetryAttribute2["LINKQUE_MODEL_FIRST_TEXT_MS"] = "linkque.model.first_text_ms";
26101
+ ETelemetryAttribute2["LINKQUE_LOOP_FIRST_PUBLIC_TEXT_MS"] = "linkque.loop.first_public_text_ms";
26102
+ ETelemetryAttribute2["LINKQUE_MODEL_CHUNK_COUNT"] = "linkque.model.chunk_count";
26103
+ ETelemetryAttribute2["LINKQUE_MODEL_TEXT_CHARS"] = "linkque.model.text_chars";
26104
+ ETelemetryAttribute2["LINKQUE_MODEL_THINKING_CHARS"] = "linkque.model.thinking_chars";
26105
+ ETelemetryAttribute2["GEN_AI_OPERATION_NAME"] = "gen_ai.operation.name";
26106
+ ETelemetryAttribute2["GEN_AI_AGENT_NAME"] = "gen_ai.agent.name";
26107
+ ETelemetryAttribute2["GEN_AI_PROVIDER_NAME"] = "gen_ai.provider.name";
26108
+ ETelemetryAttribute2["GEN_AI_REQUEST_MODEL"] = "gen_ai.request.model";
26109
+ ETelemetryAttribute2["GEN_AI_RESPONSE_MODEL"] = "gen_ai.response.model";
26110
+ ETelemetryAttribute2["GEN_AI_RESPONSE_ID"] = "gen_ai.response.id";
26111
+ ETelemetryAttribute2["LINKQUE_CONTENT_VALUE_TRUNCATED"] = "linkque.content.value.truncated";
26112
+ ETelemetryAttribute2["GEN_AI_RESPONSE_FINISH_REASONS"] = "gen_ai.response.finish_reasons";
26113
+ ETelemetryAttribute2["GEN_AI_USAGE_INPUT_TOKENS"] = "gen_ai.usage.input_tokens";
26114
+ ETelemetryAttribute2["GEN_AI_USAGE_OUTPUT_TOKENS"] = "gen_ai.usage.output_tokens";
26115
+ ETelemetryAttribute2["GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS"] = "gen_ai.usage.cache_read.input_tokens";
26116
+ ETelemetryAttribute2["GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS"] = "gen_ai.usage.cache_creation.input_tokens";
26117
+ ETelemetryAttribute2["GEN_AI_USAGE_REASONING_OUTPUT_TOKENS"] = "gen_ai.usage.reasoning.output_tokens";
26118
+ ETelemetryAttribute2["HARNESS_USAGE_SOURCE"] = "harness.usage.source";
26119
+ ETelemetryAttribute2["HARNESS_USAGE_ATTEMPT_COVERAGE"] = "harness.usage.attempt_coverage";
26120
+ ETelemetryAttribute2["HARNESS_MODEL_PURPOSE"] = "harness.model.purpose";
26121
+ ETelemetryAttribute2["HARNESS_MODEL_INVOCATION_COUNT"] = "harness.model.invocation_count";
26122
+ ETelemetryAttribute2["GEN_AI_TOOL_NAME"] = "gen_ai.tool.name";
26123
+ ETelemetryAttribute2["LINKQUE_TOOL_DISPLAY_NAME"] = "linkque.tool.display_name";
26124
+ ETelemetryAttribute2["LINKQUE_CARD_EXECUTION_ID"] = "linkque.card.execution_id";
26125
+ ETelemetryAttribute2["LINKQUE_CARD_REF"] = "linkque.card.ref";
26126
+ ETelemetryAttribute2["LINKQUE_CARD_REVISION"] = "linkque.card.revision";
26127
+ ETelemetryAttribute2["LINKQUE_CARD_DISPLAY_NAME"] = "linkque.card.display_name";
26128
+ ETelemetryAttribute2["LINKQUE_CARD_PHASE"] = "linkque.card.phase";
26129
+ ETelemetryAttribute2["LINKQUE_CARD_SOURCE_ID"] = "linkque.card.source_id";
26130
+ ETelemetryAttribute2["LINKQUE_CARD_DELIVERY"] = "linkque.card.delivery";
26131
+ ETelemetryAttribute2["GEN_AI_TOOL_CALL_ID"] = "gen_ai.tool.call.id";
26132
+ ETelemetryAttribute2["HARNESS_TOOL_RESULT_STATUS"] = "harness.tool.result.status";
26133
+ ETelemetryAttribute2["LINKQUE_TOOL_FAILURE_STAGE"] = "linkque.tool.failure_stage";
26134
+ ETelemetryAttribute2["HARNESS_HOOK_NAME"] = "harness.hook.name";
26135
+ ETelemetryAttribute2["LINKQUE_HOOK_STAGE"] = "linkque.hook.stage";
26136
+ ETelemetryAttribute2["LINKQUE_HOOK_RESOURCE_ID"] = "linkque.hook.resource_id";
26137
+ ETelemetryAttribute2["LINKQUE_HOOK_EVENT_ID"] = "linkque.hook.event_id";
26138
+ ETelemetryAttribute2["LINKQUE_HOOK_MATCHED_COUNT"] = "linkque.hook.matched_count";
26139
+ ETelemetryAttribute2["LINKQUE_HOOK_PENDING_COUNT"] = "linkque.hook.pending_count";
26140
+ ETelemetryAttribute2["LINKQUE_HOOK_SCHEDULED_COUNT"] = "linkque.hook.scheduled_count";
26141
+ ETelemetryAttribute2["LINKQUE_HOOK_HAS_SIDE_EFFECTS"] = "linkque.hook.has_side_effects";
26142
+ ETelemetryAttribute2["LINKQUE_HOOK_MODE"] = "linkque.hook.mode";
26143
+ ETelemetryAttribute2["LINKQUE_HOOK_TIMEOUT_MS"] = "linkque.hook.timeout_ms";
26144
+ ETelemetryAttribute2["LINKQUE_HOOK_RESULT"] = "linkque.hook.result";
26145
+ ETelemetryAttribute2["HARNESS_MIDDLEWARE_NAME"] = "harness.middleware.name";
26146
+ ETelemetryAttribute2["HARNESS_MIDDLEWARE_INVOCATION_ID"] = "harness.middleware.invocation.id";
26147
+ ETelemetryAttribute2["LINKQUE_HOOK_EXECUTOR_SETTLED"] = "linkque.hook.executor_settled";
26148
+ ETelemetryAttribute2["LINKQUE_HISTORY_MESSAGE_COUNT"] = "linkque.history.message_count";
26149
+ ETelemetryAttribute2["LINKQUE_TELEMETRY_COVERAGE"] = "linkque.telemetry.coverage";
26150
+ ETelemetryAttribute2["LINKQUE_TELEMETRY_LOSS_REASON"] = "linkque.telemetry.loss_reason";
26151
+ ETelemetryAttribute2["LINKQUE_OPERATION_DURATION_MS"] = "linkque.operation.duration_ms";
26152
+ ETelemetryAttribute2["HTTP_RESPONSE_STATUS_CODE"] = "http.response.status_code";
26153
+ ETelemetryAttribute2["SERVICE_NAME"] = "service.name";
26154
+ ETelemetryAttribute2["SERVICE_NAMESPACE"] = "service.namespace";
26155
+ ETelemetryAttribute2["SERVICE_VERSION"] = "service.version";
26156
+ ETelemetryAttribute2["SERVICE_INSTANCE_ID"] = "service.instance.id";
26157
+ ETelemetryAttribute2["DEPLOYMENT_ENVIRONMENT_NAME"] = "deployment.environment.name";
26158
+ ETelemetryAttribute2["LINKQUE_LINK_RELATION"] = "linkque.link.relation";
26159
+ })(ETelemetryAttribute || (ETelemetryAttribute = {}));
26160
+ var ETelemetryEventPrefix;
26161
+ (function(ETelemetryEventPrefix2) {
26162
+ ETelemetryEventPrefix2["OPERATION"] = "linkque.operation";
26163
+ ETelemetryEventPrefix2["ADVANCE"] = "harness.advance";
26164
+ ETelemetryEventPrefix2["MODEL_INVOKE"] = "harness.model.invoke";
26165
+ ETelemetryEventPrefix2["MODEL_ATTEMPT"] = "harness.model.attempt";
26166
+ ETelemetryEventPrefix2["TOOL_INVOKE"] = "harness.tool.invoke";
26167
+ ETelemetryEventPrefix2["TOOL_ATTEMPT"] = "harness.tool.attempt";
26168
+ ETelemetryEventPrefix2["HOOK_CHAIN"] = "harness.hook.chain";
26169
+ ETelemetryEventPrefix2["MIDDLEWARE"] = "harness.middleware";
26170
+ ETelemetryEventPrefix2["LOOP"] = "linkque.loop";
26171
+ ETelemetryEventPrefix2["LOOP_ITERATION"] = "linkque.loop.iteration";
26172
+ ETelemetryEventPrefix2["HISTORY_APPEND"] = "linkque.history.append";
26173
+ ETelemetryEventPrefix2["HOOK_DRAIN"] = "linkque.hook.drain";
26174
+ })(ETelemetryEventPrefix || (ETelemetryEventPrefix = {}));
26175
+ var ETelemetryEventPhase;
26176
+ (function(ETelemetryEventPhase2) {
26177
+ ETelemetryEventPhase2["STARTED"] = "started";
26178
+ ETelemetryEventPhase2["FINISHED"] = "finished";
26179
+ ETelemetryEventPhase2["OBSERVATION_LOST"] = "observation_lost";
26180
+ })(ETelemetryEventPhase || (ETelemetryEventPhase = {}));
26181
+ var ETelemetryEventName;
26182
+ (function(ETelemetryEventName2) {
26183
+ ETelemetryEventName2["TOOL_EXECUTION_FAILED"] = "linkque.tool.execution.failed";
26184
+ ETelemetryEventName2["TELEMETRY_COVERAGE"] = "linkque.telemetry.coverage";
26185
+ ETelemetryEventName2["HOOK_MATCHED"] = "linkque.hook.matched";
26186
+ ETelemetryEventName2["HOOK_SCHEDULED"] = "linkque.hook.scheduled";
26187
+ ETelemetryEventName2["HOOK_CANCEL_REQUESTED"] = "linkque.hook.cancel_requested";
26188
+ ETelemetryEventName2["HOOK_TIMEOUT_REQUESTED"] = "linkque.hook.timeout_requested";
26189
+ ETelemetryEventName2["HOOK_EXECUTOR_SETTLED"] = "linkque.hook.executor_settled";
26190
+ ETelemetryEventName2["HOOK_WAIT_FINISHED"] = "linkque.hook.wait_finished";
26191
+ ETelemetryEventName2["LOOP_FIRST_PUBLIC_TEXT"] = "linkque.loop.first_public_text";
26192
+ ETelemetryEventName2["STREAM_TERMINAL_OBSERVED"] = "linkque.stream.terminal_observed";
26193
+ ETelemetryEventName2["MODEL_FIRST_CHUNK"] = "harness.model.first_chunk";
26194
+ ETelemetryEventName2["MODEL_FIRST_TEXT"] = "harness.model.first_text";
26195
+ ETelemetryEventName2["MODEL_USAGE_RECORDED"] = "linkque.model.usage.recorded";
26196
+ ETelemetryEventName2["MODEL_RESPONSE_HEADERS"] = "linkque.model.response_headers";
26197
+ ETelemetryEventName2["OPERATION_OBSERVATION_LOST"] = "linkque.operation.observation_lost";
26198
+ ETelemetryEventName2["RUNTIME_UNCAUGHT_ERROR"] = "linkque.runtime.uncaught_error";
26199
+ ETelemetryEventName2["OPERATION_STARTED"] = "linkque.operation.started";
26200
+ ETelemetryEventName2["OPERATION_FINISHED"] = "linkque.operation.finished";
26201
+ ETelemetryEventName2["ADVANCE_STARTED"] = "harness.advance.started";
26202
+ ETelemetryEventName2["ADVANCE_FINISHED"] = "harness.advance.finished";
26203
+ ETelemetryEventName2["MODEL_INVOKE_STARTED"] = "harness.model.invoke.started";
26204
+ ETelemetryEventName2["MODEL_INVOKE_FINISHED"] = "harness.model.invoke.finished";
26205
+ ETelemetryEventName2["MODEL_ATTEMPT_STARTED"] = "harness.model.attempt.started";
26206
+ ETelemetryEventName2["MODEL_ATTEMPT_FINISHED"] = "harness.model.attempt.finished";
26207
+ ETelemetryEventName2["TOOL_INVOKE_STARTED"] = "harness.tool.invoke.started";
26208
+ ETelemetryEventName2["TOOL_INVOKE_FINISHED"] = "harness.tool.invoke.finished";
26209
+ ETelemetryEventName2["TOOL_ATTEMPT_STARTED"] = "harness.tool.attempt.started";
26210
+ ETelemetryEventName2["TOOL_ATTEMPT_FINISHED"] = "harness.tool.attempt.finished";
26211
+ ETelemetryEventName2["HOOK_CHAIN_STARTED"] = "harness.hook.chain.started";
26212
+ ETelemetryEventName2["HOOK_CHAIN_FINISHED"] = "harness.hook.chain.finished";
26213
+ ETelemetryEventName2["MIDDLEWARE_STARTED"] = "harness.middleware.started";
26214
+ ETelemetryEventName2["MIDDLEWARE_FINISHED"] = "harness.middleware.finished";
26215
+ ETelemetryEventName2["LOOP_STARTED"] = "linkque.loop.started";
26216
+ ETelemetryEventName2["LOOP_FINISHED"] = "linkque.loop.finished";
26217
+ ETelemetryEventName2["LOOP_ITERATION_STARTED"] = "linkque.loop.iteration.started";
26218
+ ETelemetryEventName2["LOOP_ITERATION_FINISHED"] = "linkque.loop.iteration.finished";
26219
+ ETelemetryEventName2["HISTORY_APPEND_STARTED"] = "linkque.history.append.started";
26220
+ ETelemetryEventName2["HISTORY_APPEND_FINISHED"] = "linkque.history.append.finished";
26221
+ ETelemetryEventName2["HOOK_DRAIN_STARTED"] = "linkque.hook.drain.started";
26222
+ ETelemetryEventName2["HOOK_DRAIN_FINISHED"] = "linkque.hook.drain.finished";
26223
+ ETelemetryEventName2["CONTENT_RECORDED"] = "linkque.content.recorded";
26224
+ ETelemetryEventName2["TOOL_CONTEXT"] = "linkque.tool.context";
26225
+ })(ETelemetryEventName || (ETelemetryEventName = {}));
26226
+ var ETelemetryContentSection;
26227
+ (function(ETelemetryContentSection2) {
26228
+ ETelemetryContentSection2["QUERY_INPUT"] = "query.input";
26229
+ ETelemetryContentSection2["MODEL_OUTPUT"] = "model.output";
26230
+ ETelemetryContentSection2["MCP_ACTION_OUTPUT"] = "mcp_action.output";
26231
+ ETelemetryContentSection2["TOOL_INPUT"] = "tool.input";
26232
+ ETelemetryContentSection2["TOOL_OUTPUT"] = "tool.output";
26233
+ ETelemetryContentSection2["MCP_REQUESTED_INPUT"] = "mcp.requested_input";
26234
+ ETelemetryContentSection2["MCP_INPUT"] = "mcp.input";
26235
+ ETelemetryContentSection2["MCP_OUTPUT"] = "mcp.output";
26236
+ ETelemetryContentSection2["SKILL_INPUT"] = "skill.input";
26237
+ ETelemetryContentSection2["SKILL_OUTPUT"] = "skill.output";
26238
+ ETelemetryContentSection2["KNOWLEDGE_INPUT"] = "knowledge.input";
26239
+ ETelemetryContentSection2["KNOWLEDGE_OUTPUT"] = "knowledge.output";
26240
+ })(ETelemetryContentSection || (ETelemetryContentSection = {}));
26241
+ var ETelemetryOperationName;
26242
+ (function(ETelemetryOperationName2) {
26243
+ ETelemetryOperationName2["OPERATION"] = "linkque.operation";
26244
+ ETelemetryOperationName2["TOOL_INVOKE"] = "harness.tool.invoke";
26245
+ ETelemetryOperationName2["ADVANCE"] = "harness.advance";
26246
+ ETelemetryOperationName2["MODEL_INVOKE"] = "harness.model.invoke";
26247
+ ETelemetryOperationName2["MODEL_ATTEMPT"] = "harness.model.attempt";
26248
+ ETelemetryOperationName2["TOOL_ATTEMPT"] = "harness.tool.attempt";
26249
+ ETelemetryOperationName2["HOOK_CHAIN"] = "harness.hook.chain";
26250
+ ETelemetryOperationName2["MIDDLEWARE"] = "harness.middleware";
26251
+ ETelemetryOperationName2["LOOP"] = "linkque.agent.loop";
26252
+ ETelemetryOperationName2["ITERATION"] = "linkque.agent.iteration";
26253
+ ETelemetryOperationName2["SESSION_LOAD"] = "harness.session.load";
26254
+ ETelemetryOperationName2["HISTORY_APPEND"] = "linkque.history.append";
26255
+ ETelemetryOperationName2["CLEANUP"] = "linkque.runtime.cleanup";
26256
+ ETelemetryOperationName2["HOOK_DRAIN"] = "linkque.hook.drain";
26257
+ })(ETelemetryOperationName || (ETelemetryOperationName = {}));
26258
+ var ETelemetryOutcome;
26259
+ (function(ETelemetryOutcome2) {
26260
+ ETelemetryOutcome2["SUCCESS"] = "success";
26261
+ ETelemetryOutcome2["ERROR"] = "error";
26262
+ ETelemetryOutcome2["CANCELLED"] = "cancelled";
26263
+ ETelemetryOutcome2["TIMEOUT"] = "timeout";
26264
+ ETelemetryOutcome2["REJECTED"] = "rejected";
26265
+ ETelemetryOutcome2["UNKNOWN"] = "unknown";
26266
+ })(ETelemetryOutcome || (ETelemetryOutcome = {}));
26267
+ var ETelemetrySignal;
26268
+ (function(ETelemetrySignal2) {
26269
+ ETelemetrySignal2["LOGS"] = "logs";
26270
+ ETelemetrySignal2["TRACES"] = "traces";
26271
+ })(ETelemetrySignal || (ETelemetrySignal = {}));
26272
+ var ETelemetryLossReason;
26273
+ (function(ETelemetryLossReason2) {
26274
+ ETelemetryLossReason2["UNCAUGHT_ERROR"] = "uncaught_error";
26275
+ ETelemetryLossReason2["ACTIVE_LIMIT"] = "active_limit";
26276
+ ETelemetryLossReason2["ACTIVE_EXPIRED"] = "active_expired";
26277
+ ETelemetryLossReason2["SHUTDOWN"] = "shutdown";
26278
+ })(ETelemetryLossReason || (ETelemetryLossReason = {}));
26279
+ var ETelemetryAdvanceOutcome;
26280
+ (function(ETelemetryAdvanceOutcome2) {
26281
+ ETelemetryAdvanceOutcome2["FAILED"] = "failed";
26282
+ ETelemetryAdvanceOutcome2["COMPLETED"] = "completed";
26283
+ ETelemetryAdvanceOutcome2["UNKNOWN"] = "unknown";
26284
+ })(ETelemetryAdvanceOutcome || (ETelemetryAdvanceOutcome = {}));
26285
+ var ETelemetryStreamTermination;
26286
+ (function(ETelemetryStreamTermination2) {
26287
+ ETelemetryStreamTermination2["CANCEL"] = "cancel";
26288
+ ETelemetryStreamTermination2["ERROR"] = "error";
26289
+ ETelemetryStreamTermination2["COMPLETE"] = "complete";
26290
+ ETelemetryStreamTermination2["EXHAUSTED"] = "exhausted";
26291
+ })(ETelemetryStreamTermination || (ETelemetryStreamTermination = {}));
26292
+ var ETelemetryCancelSource;
26293
+ (function(ETelemetryCancelSource2) {
26294
+ ETelemetryCancelSource2["HOST_SIGNAL"] = "host_signal";
26295
+ ETelemetryCancelSource2["CONSUMER_RETURN"] = "consumer_return";
26296
+ })(ETelemetryCancelSource || (ETelemetryCancelSource = {}));
26297
+ var ETelemetryObservationBoundary;
26298
+ (function(ETelemetryObservationBoundary2) {
26299
+ ETelemetryObservationBoundary2["LOCAL_WAIT"] = "local_wait";
26300
+ ETelemetryObservationBoundary2["EXECUTOR_SETTLED"] = "executor_settled";
26301
+ ETelemetryObservationBoundary2["GENERATOR_WITH_SETUP_AND_CLEANUP"] = "generator_with_setup_and_cleanup";
26302
+ })(ETelemetryObservationBoundary || (ETelemetryObservationBoundary = {}));
26303
+ var ETelemetryRemoteCompletion;
26304
+ (function(ETelemetryRemoteCompletion2) {
26305
+ ETelemetryRemoteCompletion2["UNKNOWN"] = "unknown";
26306
+ ETelemetryRemoteCompletion2["NOT_DISPATCHED"] = "not_dispatched";
26307
+ ETelemetryRemoteCompletion2["CONFIRMED"] = "confirmed";
26308
+ })(ETelemetryRemoteCompletion || (ETelemetryRemoteCompletion = {}));
26309
+ var ETelemetryCommitStatus;
26310
+ (function(ETelemetryCommitStatus2) {
26311
+ ETelemetryCommitStatus2["COMMITTED"] = "committed";
26312
+ ETelemetryCommitStatus2["FAILED"] = "failed";
26313
+ })(ETelemetryCommitStatus || (ETelemetryCommitStatus = {}));
26314
+ var ETelemetryHookMode;
26315
+ (function(ETelemetryHookMode2) {
26316
+ ETelemetryHookMode2["AWAITED"] = "awaited";
26317
+ ETelemetryHookMode2["DETACHED"] = "detached";
26318
+ })(ETelemetryHookMode || (ETelemetryHookMode = {}));
26319
+ var ETelemetryHookResult;
26320
+ (function(ETelemetryHookResult2) {
26321
+ ETelemetryHookResult2["OK"] = "ok";
26322
+ ETelemetryHookResult2["TIMEOUT"] = "timeout";
26323
+ ETelemetryHookResult2["SKIPPED"] = "skipped";
26324
+ ETelemetryHookResult2["SUCCESS"] = "success";
26325
+ ETelemetryHookResult2["ERROR"] = "error";
26326
+ })(ETelemetryHookResult || (ETelemetryHookResult = {}));
26327
+ var ETelemetrySource;
26328
+ (function(ETelemetrySource2) {
26329
+ ETelemetrySource2["KERNEL"] = "kernel";
26330
+ ETelemetrySource2["PROVIDER"] = "provider";
26331
+ })(ETelemetrySource || (ETelemetrySource = {}));
26332
+ var ETelemetryEvidence;
26333
+ (function(ETelemetryEvidence2) {
26334
+ ETelemetryEvidence2["OBSERVED"] = "observed";
26335
+ })(ETelemetryEvidence || (ETelemetryEvidence = {}));
26336
+ var ETelemetryCompleteness;
26337
+ (function(ETelemetryCompleteness2) {
26338
+ ETelemetryCompleteness2["COMPLETE"] = "complete";
26339
+ ETelemetryCompleteness2["PARTIAL"] = "partial";
26340
+ })(ETelemetryCompleteness || (ETelemetryCompleteness = {}));
26341
+ var ETelemetryCoverage;
26342
+ (function(ETelemetryCoverage2) {
26343
+ ETelemetryCoverage2["PI_MODEL_TOOL_HOOK"] = "pi_model_tool_hook";
26344
+ ETelemetryCoverage2["CORE_ONLY"] = "core_only";
26345
+ })(ETelemetryCoverage || (ETelemetryCoverage = {}));
26346
+ var ETelemetryUsageSource;
26347
+ (function(ETelemetryUsageSource2) {
26348
+ ETelemetryUsageSource2["UNKNOWN"] = "unknown";
26349
+ ETelemetryUsageSource2["PROVIDER_NORMALIZED"] = "provider_normalized";
26350
+ })(ETelemetryUsageSource || (ETelemetryUsageSource = {}));
26351
+ var ETelemetryAttemptVisibility;
26352
+ (function(ETelemetryAttemptVisibility2) {
26353
+ ETelemetryAttemptVisibility2["PROVIDER_INVOCATION"] = "provider_invocation";
26354
+ ETelemetryAttemptVisibility2["TOOL_PROVIDER_INVOCATION"] = "tool_provider_invocation";
26355
+ })(ETelemetryAttemptVisibility || (ETelemetryAttemptVisibility = {}));
26356
+ var ETelemetryLinkRelation;
26357
+ (function(ETelemetryLinkRelation2) {
26358
+ ETelemetryLinkRelation2["GENERATED_BY"] = "generated_by";
26359
+ ETelemetryLinkRelation2["SCHEDULED_BY"] = "scheduled_by";
26360
+ })(ETelemetryLinkRelation || (ETelemetryLinkRelation = {}));
26361
+ var ETelemetryToolFailureStage;
26362
+ (function(ETelemetryToolFailureStage2) {
26363
+ ETelemetryToolFailureStage2["BEFORE_HOOK"] = "before_hook";
26364
+ ETelemetryToolFailureStage2["EXECUTION"] = "execution";
26365
+ ETelemetryToolFailureStage2["AFTER_HOOK"] = "after_hook";
26366
+ })(ETelemetryToolFailureStage || (ETelemetryToolFailureStage = {}));
26367
+ var ETelemetryTerminalEvidence;
26368
+ (function(ETelemetryTerminalEvidence2) {
26369
+ ETelemetryTerminalEvidence2["EXPLICIT_DONE_HISTORY_COMMITTED"] = "explicit_done_history_committed";
26370
+ ETelemetryTerminalEvidence2["EXPLICIT_DONE"] = "explicit_done";
26371
+ ETelemetryTerminalEvidence2["STREAM_ERROR"] = "stream_error";
26372
+ ETelemetryTerminalEvidence2["CONSUMER_CANCEL"] = "consumer_cancel";
26373
+ ETelemetryTerminalEvidence2["NATURAL_EXHAUSTION"] = "natural_exhaustion";
26374
+ })(ETelemetryTerminalEvidence || (ETelemetryTerminalEvidence = {}));
26375
+ var ETelemetryTerminalSource;
26376
+ (function(ETelemetryTerminalSource2) {
26377
+ ETelemetryTerminalSource2["NATIVE_AGENT_END"] = "native_agent_end";
26378
+ ETelemetryTerminalSource2["PROMPT_RESOLVED_FALLBACK"] = "prompt_resolved_fallback";
26379
+ })(ETelemetryTerminalSource || (ETelemetryTerminalSource = {}));
26380
+ var ETelemetryModelPurpose;
26381
+ (function(ETelemetryModelPurpose2) {
26382
+ ETelemetryModelPurpose2["AGENT_LOOP"] = "agent_loop";
26383
+ })(ETelemetryModelPurpose || (ETelemetryModelPurpose = {}));
26384
+ var ETelemetryErrorType;
26385
+ (function(ETelemetryErrorType2) {
26386
+ ETelemetryErrorType2["PROVIDER_STREAM_ERROR"] = "ProviderStreamError";
26387
+ ETelemetryErrorType2["TOOL_EXECUTION_ERROR"] = "ToolExecutionError";
26388
+ ETelemetryErrorType2["HOOK_DISPATCH_ERROR"] = "HookDispatchError";
26389
+ ETelemetryErrorType2["HOOK_DRAIN_ERROR"] = "HookDrainError";
26390
+ })(ETelemetryErrorType || (ETelemetryErrorType = {}));
26391
+ var ETelemetrySpanKind;
26392
+ (function(ETelemetrySpanKind2) {
26393
+ ETelemetrySpanKind2["INTERNAL"] = "internal";
26394
+ ETelemetrySpanKind2["CLIENT"] = "client";
26395
+ })(ETelemetrySpanKind || (ETelemetrySpanKind = {}));
26396
+ var ETelemetryGenAiOperation;
26397
+ (function(ETelemetryGenAiOperation2) {
26398
+ ETelemetryGenAiOperation2["CHAT"] = "chat";
26399
+ ETelemetryGenAiOperation2["EXECUTE_TOOL"] = "execute_tool";
26400
+ ETelemetryGenAiOperation2["INVOKE_AGENT"] = "invoke_agent";
26401
+ })(ETelemetryGenAiOperation || (ETelemetryGenAiOperation = {}));
26402
+ var ETelemetryVersion;
26403
+ (function(ETelemetryVersion2) {
26404
+ ETelemetryVersion2["V0_2"] = "0.2";
26405
+ ETelemetryVersion2["V1_0"] = "1.0";
26406
+ })(ETelemetryVersion || (ETelemetryVersion = {}));
26407
+
26408
+ // ../linkque-agent-runtime/dist/esm/core/telemetry/contentRecording.js
26409
+ function recordContentSection(observation, section, value, availability = "available") {
26410
+ observation?.record(ETelemetryEventName.CONTENT_RECORDED, {}, { section, value, availability });
26411
+ }
26412
+ function recordMcpContentSection(observation, section, value, schema) {
26413
+ if (!observation)
26414
+ return;
26415
+ const fieldTitles = {};
26416
+ const visit = (node, path2) => {
26417
+ if (!node || typeof node !== "object" || Array.isArray(node))
26418
+ return;
26419
+ const definition = node;
26420
+ if (path2 && typeof definition.title === "string" && definition.title.trim())
26421
+ fieldTitles[path2] = definition.title;
26422
+ const properties = definition.properties;
26423
+ if (properties && typeof properties === "object" && !Array.isArray(properties)) {
26424
+ for (const [key, child] of Object.entries(properties))
26425
+ visit(child, `${path2}/${key.replaceAll("~", "~0").replaceAll("/", "~1")}`);
26426
+ }
26427
+ if (definition.items)
26428
+ visit(definition.items, `${path2}/*`);
26429
+ };
26430
+ visit(schema, section === ETelemetryContentSection.MCP_OUTPUT ? "/structuredContent" : "");
26431
+ observation.record(ETelemetryEventName.CONTENT_RECORDED, {}, {
26432
+ section,
26433
+ value,
26434
+ availability: "available",
26435
+ ...Object.keys(fieldTitles).length ? { fieldTitles } : {}
26436
+ });
26437
+ }
26438
+
26038
26439
  // ../linkque-agent-runtime/dist/esm/core/mcpProxyTool.js
26039
26440
  var MCP_PROXY_TOOL_NAME = "mcp";
26040
26441
  var McpProxyTool = class {
@@ -26094,6 +26495,10 @@ var McpProxyTool = class {
26094
26495
  context: context2
26095
26496
  });
26096
26497
  return entry.server.callTool(tool.name, args, sig, {
26498
+ toolSchema: {
26499
+ inputSchema: tool.inputSchema,
26500
+ outputSchema: tool.outputSchema
26501
+ },
26097
26502
  ...headers ? { headers } : {},
26098
26503
  ...context2 ? { context: context2 } : {}
26099
26504
  });
@@ -26187,27 +26592,33 @@ var McpProxyTool = class {
26187
26592
  async dispatch(args, signal, context2) {
26188
26593
  const params = parseProxyArgs(args);
26189
26594
  if (params.connect !== void 0) {
26190
- return this.executeConnect(params.connect, signal);
26595
+ return this.executeConnect(params.connect, signal, context2);
26191
26596
  }
26192
26597
  if (params.describe !== void 0) {
26193
- return this.executeDescribe(params.describe, params.server, signal);
26598
+ return this.executeDescribe(params.describe, params.server, signal, context2);
26194
26599
  }
26195
26600
  if (params.searches !== void 0) {
26196
- return this.executeBatchSearch(params.searches, params.server);
26601
+ return this.executeBatchSearch(params.searches, params.server, context2);
26197
26602
  }
26198
26603
  if (params.search !== void 0) {
26199
- return this.executeSearch(params.search, params.server);
26604
+ const result = await this.executeSearch(params.search, params.server);
26605
+ this.recordAction(context2, "search", result.tools.length ? "matched" : "no_hits", { query: result.query, tools: result.tools });
26606
+ return result.text;
26200
26607
  }
26201
26608
  if (params.tool !== void 0) {
26202
26609
  return this.executeCall(params.tool, params.args, params.server, signal, context2);
26203
26610
  }
26204
26611
  if (params.server !== void 0) {
26205
- return this.executeList(params.server, signal);
26612
+ return this.executeList(params.server, signal, context2);
26206
26613
  }
26207
- return this.executeStatus();
26614
+ return this.executeStatus(context2);
26615
+ }
26616
+ /** 保留代理动作事实,不改变供模型消费的原始返回值。 */
26617
+ recordAction(context2, action, status, data = {}) {
26618
+ recordContentSection(context2?.observation, ETelemetryContentSection.MCP_ACTION_OUTPUT, { action, status, ...data });
26208
26619
  }
26209
26620
  /** `mcp({})` / `mcp({ status: true })`:列各 server 连接状态 + 工具数。 */
26210
- executeStatus() {
26621
+ executeStatus(context2) {
26211
26622
  const lines = [];
26212
26623
  let connected = 0;
26213
26624
  let totalTools = 0;
@@ -26226,6 +26637,13 @@ var McpProxyTool = class {
26226
26637
  lines.push(`\u2717 ${label} (failed${entry.error ? ": " + entry.error : ""})`);
26227
26638
  }
26228
26639
  }
26640
+ this.recordAction(context2, "status", "completed", {
26641
+ servers: this.specs.map((spec) => ({
26642
+ name: spec.serverName,
26643
+ status: this.entries.get(spec.serverName)?.status ?? "not_connected",
26644
+ toolCount: this.entries.get(spec.serverName)?.tools.length ?? 0
26645
+ }))
26646
+ });
26229
26647
  const header = `MCP: ${connected}/${this.specs.length} servers, ${totalTools} tools`;
26230
26648
  const hint = this.specs.length > 0 ? '\nmcp({ server: "name" }) to list tools, mcp({ search: "..." }) to search, mcp({ tool: "...", args: {...} }) to call' : "\n(no MCP resources configured)";
26231
26649
  return `${header}
@@ -26233,35 +26651,57 @@ var McpProxyTool = class {
26233
26651
  ${lines.join("\n")}${hint}`.trim();
26234
26652
  }
26235
26653
  /** `mcp({ connect: "server" })`:显式连接并刷元数据,返回该 server 工具列表。 */
26236
- async executeConnect(server, signal) {
26654
+ async executeConnect(server, signal, context2) {
26237
26655
  const spec = this.findSpec(server);
26238
- if (!spec)
26656
+ if (!spec) {
26657
+ this.recordAction(context2, "connect", "not_found", { server });
26239
26658
  return `Server "${server}" not found. Use mcp({}) to see available servers.`;
26659
+ }
26240
26660
  this.entries.delete(spec.serverName);
26241
26661
  const entry = await this.ensureEntry(spec.serverName, signal);
26242
26662
  if (!entry) {
26663
+ this.recordAction(context2, "connect", "failed", {
26664
+ server: spec.serverName
26665
+ });
26243
26666
  const failed = this.entries.get(spec.serverName);
26244
26667
  const detail = failed?.error ? `: ${failed.error}` : "";
26245
26668
  return `Failed to connect to "${spec.serverName}"${detail}.`;
26246
26669
  }
26670
+ this.recordAction(context2, "connect", "matched", {
26671
+ server: spec.serverName,
26672
+ tools: entry.tools.map((tool) => ({
26673
+ name: tool.name,
26674
+ description: tool.description
26675
+ }))
26676
+ });
26247
26677
  return this.formatToolList(spec.serverName, entry.tools);
26248
26678
  }
26249
26679
  /** `mcp({ server: "name" })`:列该 server 工具名 + 截断 description。 */
26250
- async executeList(server, signal) {
26680
+ async executeList(server, signal, context2) {
26251
26681
  const spec = this.findSpec(server);
26252
- if (!spec)
26682
+ if (!spec) {
26683
+ this.recordAction(context2, "list", "not_found", { server });
26253
26684
  return `Server "${server}" not found. Use mcp({}) to see available servers.`;
26685
+ }
26254
26686
  const entry = await this.ensureEntry(spec.serverName, signal);
26255
26687
  if (!entry) {
26688
+ this.recordAction(context2, "list", "failed", { server: spec.serverName });
26256
26689
  return `Server "${spec.serverName}" is not connected. Use mcp({ connect: "${spec.serverName}" }) to retry.`;
26257
26690
  }
26691
+ this.recordAction(context2, "list", "matched", {
26692
+ server: spec.serverName,
26693
+ tools: entry.tools.map((tool) => ({
26694
+ name: tool.name,
26695
+ description: tool.description
26696
+ }))
26697
+ });
26258
26698
  return this.formatToolList(spec.serverName, entry.tools);
26259
26699
  }
26260
26700
  /** `mcp({ search: "query" })`:空格分词 OR 子串匹配 name/description(跨所有 server)。 */
26261
26701
  async executeSearch(query, serverHint) {
26262
26702
  const terms = query.trim().split(/\s+/u).filter((t) => t.length > 0);
26263
26703
  if (terms.length === 0)
26264
- return "Search query cannot be empty.";
26704
+ return { query, text: "Search query cannot be empty.", tools: [] };
26265
26705
  const pattern = new RegExp(terms.map(escapeRegExp).join("|"), "iu");
26266
26706
  const specs = serverHint ? this.specsMatching(serverHint) : this.specs;
26267
26707
  await Promise.all(specs.map((s) => this.ensureEntry(s.serverName)));
@@ -26276,8 +26716,18 @@ ${lines.join("\n")}${hint}`.trim();
26276
26716
  }
26277
26717
  }
26278
26718
  }
26719
+ const tools = matches.map(({ server, tool }) => ({
26720
+ server,
26721
+ name: tool.name,
26722
+ description: tool.description,
26723
+ inputSchema: tool.inputSchema
26724
+ }));
26279
26725
  if (matches.length === 0) {
26280
- return serverHint ? `No tools matching "${query}" in "${serverHint}"` : `No tools matching "${query}"`;
26726
+ return {
26727
+ query,
26728
+ tools,
26729
+ text: serverHint ? `No tools matching "${query}" in "${serverHint}"` : `No tools matching "${query}"`
26730
+ };
26281
26731
  }
26282
26732
  const lines = [`Found ${matches.length} tool(s) matching "${query}":`, ""];
26283
26733
  for (const { server, tool } of matches) {
@@ -26289,10 +26739,10 @@ ${formatSchema(tool.inputSchema, " ")}`);
26289
26739
  }
26290
26740
  lines.push("");
26291
26741
  }
26292
- return lines.join("\n").trim();
26742
+ return { query, tools, text: lines.join("\n").trim() };
26293
26743
  }
26294
26744
  /** `mcp({ searches: [...] })`:一次连接元数据并按 query 分组执行多组搜索。 */
26295
- async executeBatchSearch(queries, serverHint) {
26745
+ async executeBatchSearch(queries, serverHint, context2) {
26296
26746
  const normalized = [
26297
26747
  ...new Set(queries.map((query) => query.trim()).filter(Boolean))
26298
26748
  ].slice(0, MCP_BATCH_SEARCH_MAX_ITEMS);
@@ -26302,16 +26752,23 @@ ${formatSchema(tool.inputSchema, " ")}`);
26302
26752
  const specs = serverHint ? this.specsMatching(serverHint) : this.specs;
26303
26753
  await Promise.all(specs.map((spec) => this.ensureEntry(spec.serverName)));
26304
26754
  const results = await Promise.all(normalized.map((query) => this.executeSearch(query, serverHint)));
26755
+ this.recordAction(context2, "search", results.some((result) => result.tools.length) ? "matched" : "no_hits", { results: results.map(({ query, tools }) => ({ query, tools })) });
26305
26756
  return results.map((result, index) => `Query ${index + 1}: "${normalized[index]}"
26306
- ${result}`).join("\n\n");
26757
+ ${result.text}`).join("\n\n");
26307
26758
  }
26308
26759
  /** `mcp({ describe: "tool" })`:输出工具所属 server + 参数 schema。 */
26309
- async executeDescribe(toolName, serverHint, signal) {
26760
+ async executeDescribe(toolName, serverHint, signal, context2) {
26310
26761
  const found = await this.findTool(toolName, serverHint, signal);
26311
26762
  if (!found) {
26763
+ this.recordAction(context2, "describe", "not_found", { name: toolName });
26312
26764
  return `Tool "${toolName}" not found. Use mcp({ search: "..." }) to search.`;
26313
26765
  }
26314
26766
  const { server, tool } = found;
26767
+ this.recordAction(context2, "describe", "matched", {
26768
+ server,
26769
+ name: tool.name,
26770
+ inputSchema: tool.inputSchema
26771
+ });
26315
26772
  const lines = [
26316
26773
  `${tool.name}`,
26317
26774
  `Server: ${server}`,
@@ -26330,6 +26787,7 @@ ${formatSchema(tool.inputSchema)}`);
26330
26787
  async executeCall(toolName, args, serverHint, signal, context2) {
26331
26788
  const found = await this.findTool(toolName, serverHint, signal);
26332
26789
  if (!found) {
26790
+ this.recordAction(context2, "call", "not_found", { name: toolName });
26333
26791
  return `Tool "${toolName}" not found. Use mcp({ search: "..." }) to search.`;
26334
26792
  }
26335
26793
  const { entry, tool, spec } = found;
@@ -26341,11 +26799,17 @@ ${formatSchema(tool.inputSchema)}`);
26341
26799
  context: context2
26342
26800
  });
26343
26801
  const result = await entry.server.callTool(tool.name, args, signal, {
26802
+ toolSchema: {
26803
+ inputSchema: tool.inputSchema,
26804
+ outputSchema: tool.outputSchema
26805
+ },
26344
26806
  ...headers ? { headers } : {},
26345
26807
  ...context2 ? { context: context2 } : {}
26346
26808
  });
26809
+ this.recordAction(context2, "call", result && typeof result === "object" && "isError" in result && result.isError === true ? "failed" : "completed", { name: tool.name, server: spec.serverName });
26347
26810
  return serializeToolResult(result);
26348
26811
  } catch (error) {
26812
+ this.recordAction(context2, "call", signal?.aborted ? "cancelled" : "failed", { name: tool.name, server: spec.serverName });
26349
26813
  const message = error instanceof Error ? error.message : String(error);
26350
26814
  return `Tool "${toolName}" call failed: ${message}`;
26351
26815
  }
@@ -27196,334 +27660,6 @@ function normalizeHookResources(resources) {
27196
27660
  }).sort((a, b) => (a.config.order ?? 0) - (b.config.order ?? 0));
27197
27661
  }
27198
27662
 
27199
- // ../linkque-agent-protocol/dist/esm/telemetry/telemetryEnums.js
27200
- var ETelemetryAttribute;
27201
- (function(ETelemetryAttribute2) {
27202
- ETelemetryAttribute2["HARNESS_TELEMETRY_SCHEMA_VERSION"] = "harness.telemetry.schema.version";
27203
- ETelemetryAttribute2["LINKQUE_TELEMETRY_SCHEMA_VERSION"] = "linkque.telemetry.schema.version";
27204
- ETelemetryAttribute2["LINKQUE_TELEMETRY_ADAPTER_VERSION"] = "linkque.telemetry.adapter.version";
27205
- ETelemetryAttribute2["HARNESS_TELEMETRY_SOURCE"] = "harness.telemetry.source";
27206
- ETelemetryAttribute2["HARNESS_TELEMETRY_EVIDENCE"] = "harness.telemetry.evidence";
27207
- ETelemetryAttribute2["HARNESS_TELEMETRY_COMPLETENESS"] = "harness.telemetry.completeness";
27208
- ETelemetryAttribute2["LINKQUE_RUNTIME_KIND"] = "linkque.runtime.kind";
27209
- ETelemetryAttribute2["LINKQUE_RUN_ID"] = "linkque.run.id";
27210
- ETelemetryAttribute2["LINKQUE_AGENT_ID"] = "linkque.agent.id";
27211
- ETelemetryAttribute2["HARNESS_SESSION_ID"] = "harness.session.id";
27212
- ETelemetryAttribute2["LINKQUE_CONVERSATION_ID"] = "linkque.conversation.id";
27213
- ETelemetryAttribute2["LINKQUE_REQUEST_ID"] = "linkque.request.id";
27214
- ETelemetryAttribute2["LINKQUE_TURN_ID"] = "linkque.turn.id";
27215
- ETelemetryAttribute2["LINKQUE_ACCOUNT_ID"] = "linkque.account.id";
27216
- ETelemetryAttribute2["LINKQUE_CHANNEL"] = "linkque.channel";
27217
- ETelemetryAttribute2["LINKQUE_USER_KEY"] = "linkque.user.key";
27218
- ETelemetryAttribute2["HARNESS_ADVANCE_ID"] = "harness.advance.id";
27219
- ETelemetryAttribute2["HARNESS_CALL_ID"] = "harness.call.id";
27220
- ETelemetryAttribute2["HARNESS_INVOCATION_ID"] = "harness.invocation.id";
27221
- ETelemetryAttribute2["HARNESS_ATTEMPT_ID"] = "harness.attempt.id";
27222
- ETelemetryAttribute2["HARNESS_ATTEMPT_VISIBILITY"] = "harness.attempt.visibility";
27223
- ETelemetryAttribute2["HARNESS_ADVANCE_OUTCOME"] = "harness.advance.outcome";
27224
- ETelemetryAttribute2["HARNESS_OPERATION_OUTCOME"] = "harness.operation.outcome";
27225
- ETelemetryAttribute2["HARNESS_REMOTE_COMPLETION"] = "harness.remote.completion";
27226
- ETelemetryAttribute2["HARNESS_STATE_COMMIT_STATUS"] = "harness.state.commit.status";
27227
- ETelemetryAttribute2["LINKQUE_OPERATION_ID"] = "linkque.operation.id";
27228
- ETelemetryAttribute2["LINKQUE_OPERATION_NAME"] = "linkque.operation.name";
27229
- ETelemetryAttribute2["LINKQUE_OPERATION_PARENT_ID"] = "linkque.operation.parent_id";
27230
- ETelemetryAttribute2["LINKQUE_SPAN_PARENT_ID"] = "linkque.span.parent_id";
27231
- ETelemetryAttribute2["HARNESS_RECORD_ID"] = "harness.record.id";
27232
- ETelemetryAttribute2["HARNESS_EVENT_SEQUENCE"] = "harness.event.sequence";
27233
- ETelemetryAttribute2["ERROR_TYPE"] = "error.type";
27234
- ETelemetryAttribute2["LINKQUE_STREAM_TERMINATION"] = "linkque.stream.termination";
27235
- ETelemetryAttribute2["LINKQUE_STREAM_CANCEL_SOURCE"] = "linkque.stream.cancel_source";
27236
- ETelemetryAttribute2["LINKQUE_TERMINAL_EVIDENCE"] = "linkque.terminal.evidence";
27237
- ETelemetryAttribute2["LINKQUE_RUNTIME_CLEANUP_OUTCOME"] = "linkque.runtime.cleanup_outcome";
27238
- ETelemetryAttribute2["LINKQUE_OBSERVATION_BOUNDARY"] = "linkque.observation.boundary";
27239
- ETelemetryAttribute2["LINKQUE_LOOP_ITERATION_ID"] = "linkque.loop.iteration.id";
27240
- ETelemetryAttribute2["LINKQUE_LOOP_ITERATION_INDEX"] = "linkque.loop.iteration.index";
27241
- ETelemetryAttribute2["LINKQUE_STREAM_TERMINAL_SOURCE"] = "linkque.stream.terminal_source";
27242
- ETelemetryAttribute2["LINKQUE_STREAM_PUBLIC_TEXT_DELTA_COUNT"] = "linkque.stream.public_text_delta_count";
27243
- ETelemetryAttribute2["LINKQUE_STREAM_THINKING_DELTA_COUNT"] = "linkque.stream.thinking_delta_count";
27244
- ETelemetryAttribute2["LINKQUE_MODEL_FIRST_CHUNK_MS"] = "linkque.model.first_chunk_ms";
27245
- ETelemetryAttribute2["LINKQUE_MODEL_FIRST_TEXT_MS"] = "linkque.model.first_text_ms";
27246
- ETelemetryAttribute2["LINKQUE_LOOP_FIRST_PUBLIC_TEXT_MS"] = "linkque.loop.first_public_text_ms";
27247
- ETelemetryAttribute2["LINKQUE_MODEL_CHUNK_COUNT"] = "linkque.model.chunk_count";
27248
- ETelemetryAttribute2["LINKQUE_MODEL_TEXT_CHARS"] = "linkque.model.text_chars";
27249
- ETelemetryAttribute2["LINKQUE_MODEL_THINKING_CHARS"] = "linkque.model.thinking_chars";
27250
- ETelemetryAttribute2["GEN_AI_OPERATION_NAME"] = "gen_ai.operation.name";
27251
- ETelemetryAttribute2["GEN_AI_AGENT_NAME"] = "gen_ai.agent.name";
27252
- ETelemetryAttribute2["GEN_AI_PROVIDER_NAME"] = "gen_ai.provider.name";
27253
- ETelemetryAttribute2["GEN_AI_REQUEST_MODEL"] = "gen_ai.request.model";
27254
- ETelemetryAttribute2["GEN_AI_RESPONSE_MODEL"] = "gen_ai.response.model";
27255
- ETelemetryAttribute2["GEN_AI_RESPONSE_ID"] = "gen_ai.response.id";
27256
- ETelemetryAttribute2["GEN_AI_RESPONSE_FINISH_REASONS"] = "gen_ai.response.finish_reasons";
27257
- ETelemetryAttribute2["GEN_AI_USAGE_INPUT_TOKENS"] = "gen_ai.usage.input_tokens";
27258
- ETelemetryAttribute2["GEN_AI_USAGE_OUTPUT_TOKENS"] = "gen_ai.usage.output_tokens";
27259
- ETelemetryAttribute2["GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS"] = "gen_ai.usage.cache_read.input_tokens";
27260
- ETelemetryAttribute2["GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS"] = "gen_ai.usage.cache_creation.input_tokens";
27261
- ETelemetryAttribute2["GEN_AI_USAGE_REASONING_OUTPUT_TOKENS"] = "gen_ai.usage.reasoning.output_tokens";
27262
- ETelemetryAttribute2["HARNESS_USAGE_SOURCE"] = "harness.usage.source";
27263
- ETelemetryAttribute2["HARNESS_USAGE_ATTEMPT_COVERAGE"] = "harness.usage.attempt_coverage";
27264
- ETelemetryAttribute2["HARNESS_MODEL_PURPOSE"] = "harness.model.purpose";
27265
- ETelemetryAttribute2["HARNESS_MODEL_INVOCATION_COUNT"] = "harness.model.invocation_count";
27266
- ETelemetryAttribute2["GEN_AI_TOOL_NAME"] = "gen_ai.tool.name";
27267
- ETelemetryAttribute2["GEN_AI_TOOL_CALL_ID"] = "gen_ai.tool.call.id";
27268
- ETelemetryAttribute2["HARNESS_TOOL_RESULT_STATUS"] = "harness.tool.result.status";
27269
- ETelemetryAttribute2["LINKQUE_TOOL_FAILURE_STAGE"] = "linkque.tool.failure_stage";
27270
- ETelemetryAttribute2["HARNESS_HOOK_NAME"] = "harness.hook.name";
27271
- ETelemetryAttribute2["LINKQUE_HOOK_STAGE"] = "linkque.hook.stage";
27272
- ETelemetryAttribute2["LINKQUE_HOOK_RESOURCE_ID"] = "linkque.hook.resource_id";
27273
- ETelemetryAttribute2["LINKQUE_HOOK_EVENT_ID"] = "linkque.hook.event_id";
27274
- ETelemetryAttribute2["LINKQUE_HOOK_MATCHED_COUNT"] = "linkque.hook.matched_count";
27275
- ETelemetryAttribute2["LINKQUE_HOOK_PENDING_COUNT"] = "linkque.hook.pending_count";
27276
- ETelemetryAttribute2["LINKQUE_HOOK_SCHEDULED_COUNT"] = "linkque.hook.scheduled_count";
27277
- ETelemetryAttribute2["LINKQUE_HOOK_HAS_SIDE_EFFECTS"] = "linkque.hook.has_side_effects";
27278
- ETelemetryAttribute2["LINKQUE_HOOK_MODE"] = "linkque.hook.mode";
27279
- ETelemetryAttribute2["LINKQUE_HOOK_TIMEOUT_MS"] = "linkque.hook.timeout_ms";
27280
- ETelemetryAttribute2["LINKQUE_HOOK_RESULT"] = "linkque.hook.result";
27281
- ETelemetryAttribute2["HARNESS_MIDDLEWARE_NAME"] = "harness.middleware.name";
27282
- ETelemetryAttribute2["HARNESS_MIDDLEWARE_INVOCATION_ID"] = "harness.middleware.invocation.id";
27283
- ETelemetryAttribute2["LINKQUE_HOOK_EXECUTOR_SETTLED"] = "linkque.hook.executor_settled";
27284
- ETelemetryAttribute2["LINKQUE_HISTORY_MESSAGE_COUNT"] = "linkque.history.message_count";
27285
- ETelemetryAttribute2["LINKQUE_TELEMETRY_COVERAGE"] = "linkque.telemetry.coverage";
27286
- ETelemetryAttribute2["LINKQUE_TELEMETRY_LOSS_REASON"] = "linkque.telemetry.loss_reason";
27287
- ETelemetryAttribute2["LINKQUE_OPERATION_DURATION_MS"] = "linkque.operation.duration_ms";
27288
- ETelemetryAttribute2["HTTP_RESPONSE_STATUS_CODE"] = "http.response.status_code";
27289
- ETelemetryAttribute2["SERVICE_NAME"] = "service.name";
27290
- ETelemetryAttribute2["SERVICE_NAMESPACE"] = "service.namespace";
27291
- ETelemetryAttribute2["SERVICE_VERSION"] = "service.version";
27292
- ETelemetryAttribute2["SERVICE_INSTANCE_ID"] = "service.instance.id";
27293
- ETelemetryAttribute2["DEPLOYMENT_ENVIRONMENT_NAME"] = "deployment.environment.name";
27294
- ETelemetryAttribute2["LINKQUE_LINK_RELATION"] = "linkque.link.relation";
27295
- })(ETelemetryAttribute || (ETelemetryAttribute = {}));
27296
- var ETelemetryEventPrefix;
27297
- (function(ETelemetryEventPrefix2) {
27298
- ETelemetryEventPrefix2["OPERATION"] = "linkque.operation";
27299
- ETelemetryEventPrefix2["ADVANCE"] = "harness.advance";
27300
- ETelemetryEventPrefix2["MODEL_INVOKE"] = "harness.model.invoke";
27301
- ETelemetryEventPrefix2["MODEL_ATTEMPT"] = "harness.model.attempt";
27302
- ETelemetryEventPrefix2["TOOL_INVOKE"] = "harness.tool.invoke";
27303
- ETelemetryEventPrefix2["TOOL_ATTEMPT"] = "harness.tool.attempt";
27304
- ETelemetryEventPrefix2["HOOK_CHAIN"] = "harness.hook.chain";
27305
- ETelemetryEventPrefix2["MIDDLEWARE"] = "harness.middleware";
27306
- ETelemetryEventPrefix2["LOOP"] = "linkque.loop";
27307
- ETelemetryEventPrefix2["LOOP_ITERATION"] = "linkque.loop.iteration";
27308
- ETelemetryEventPrefix2["HISTORY_APPEND"] = "linkque.history.append";
27309
- ETelemetryEventPrefix2["HOOK_DRAIN"] = "linkque.hook.drain";
27310
- })(ETelemetryEventPrefix || (ETelemetryEventPrefix = {}));
27311
- var ETelemetryEventPhase;
27312
- (function(ETelemetryEventPhase2) {
27313
- ETelemetryEventPhase2["STARTED"] = "started";
27314
- ETelemetryEventPhase2["FINISHED"] = "finished";
27315
- ETelemetryEventPhase2["OBSERVATION_LOST"] = "observation_lost";
27316
- })(ETelemetryEventPhase || (ETelemetryEventPhase = {}));
27317
- var ETelemetryEventName;
27318
- (function(ETelemetryEventName2) {
27319
- ETelemetryEventName2["TOOL_EXECUTION_FAILED"] = "linkque.tool.execution.failed";
27320
- ETelemetryEventName2["TELEMETRY_COVERAGE"] = "linkque.telemetry.coverage";
27321
- ETelemetryEventName2["HOOK_MATCHED"] = "linkque.hook.matched";
27322
- ETelemetryEventName2["HOOK_SCHEDULED"] = "linkque.hook.scheduled";
27323
- ETelemetryEventName2["HOOK_CANCEL_REQUESTED"] = "linkque.hook.cancel_requested";
27324
- ETelemetryEventName2["HOOK_TIMEOUT_REQUESTED"] = "linkque.hook.timeout_requested";
27325
- ETelemetryEventName2["HOOK_EXECUTOR_SETTLED"] = "linkque.hook.executor_settled";
27326
- ETelemetryEventName2["HOOK_WAIT_FINISHED"] = "linkque.hook.wait_finished";
27327
- ETelemetryEventName2["LOOP_FIRST_PUBLIC_TEXT"] = "linkque.loop.first_public_text";
27328
- ETelemetryEventName2["STREAM_TERMINAL_OBSERVED"] = "linkque.stream.terminal_observed";
27329
- ETelemetryEventName2["MODEL_FIRST_CHUNK"] = "harness.model.first_chunk";
27330
- ETelemetryEventName2["MODEL_FIRST_TEXT"] = "harness.model.first_text";
27331
- ETelemetryEventName2["MODEL_USAGE_RECORDED"] = "linkque.model.usage.recorded";
27332
- ETelemetryEventName2["MODEL_RESPONSE_HEADERS"] = "linkque.model.response_headers";
27333
- ETelemetryEventName2["OPERATION_OBSERVATION_LOST"] = "linkque.operation.observation_lost";
27334
- ETelemetryEventName2["RUNTIME_UNCAUGHT_ERROR"] = "linkque.runtime.uncaught_error";
27335
- ETelemetryEventName2["OPERATION_STARTED"] = "linkque.operation.started";
27336
- ETelemetryEventName2["OPERATION_FINISHED"] = "linkque.operation.finished";
27337
- ETelemetryEventName2["ADVANCE_STARTED"] = "harness.advance.started";
27338
- ETelemetryEventName2["ADVANCE_FINISHED"] = "harness.advance.finished";
27339
- ETelemetryEventName2["MODEL_INVOKE_STARTED"] = "harness.model.invoke.started";
27340
- ETelemetryEventName2["MODEL_INVOKE_FINISHED"] = "harness.model.invoke.finished";
27341
- ETelemetryEventName2["MODEL_ATTEMPT_STARTED"] = "harness.model.attempt.started";
27342
- ETelemetryEventName2["MODEL_ATTEMPT_FINISHED"] = "harness.model.attempt.finished";
27343
- ETelemetryEventName2["TOOL_INVOKE_STARTED"] = "harness.tool.invoke.started";
27344
- ETelemetryEventName2["TOOL_INVOKE_FINISHED"] = "harness.tool.invoke.finished";
27345
- ETelemetryEventName2["TOOL_ATTEMPT_STARTED"] = "harness.tool.attempt.started";
27346
- ETelemetryEventName2["TOOL_ATTEMPT_FINISHED"] = "harness.tool.attempt.finished";
27347
- ETelemetryEventName2["HOOK_CHAIN_STARTED"] = "harness.hook.chain.started";
27348
- ETelemetryEventName2["HOOK_CHAIN_FINISHED"] = "harness.hook.chain.finished";
27349
- ETelemetryEventName2["MIDDLEWARE_STARTED"] = "harness.middleware.started";
27350
- ETelemetryEventName2["MIDDLEWARE_FINISHED"] = "harness.middleware.finished";
27351
- ETelemetryEventName2["LOOP_STARTED"] = "linkque.loop.started";
27352
- ETelemetryEventName2["LOOP_FINISHED"] = "linkque.loop.finished";
27353
- ETelemetryEventName2["LOOP_ITERATION_STARTED"] = "linkque.loop.iteration.started";
27354
- ETelemetryEventName2["LOOP_ITERATION_FINISHED"] = "linkque.loop.iteration.finished";
27355
- ETelemetryEventName2["HISTORY_APPEND_STARTED"] = "linkque.history.append.started";
27356
- ETelemetryEventName2["HISTORY_APPEND_FINISHED"] = "linkque.history.append.finished";
27357
- ETelemetryEventName2["HOOK_DRAIN_STARTED"] = "linkque.hook.drain.started";
27358
- ETelemetryEventName2["HOOK_DRAIN_FINISHED"] = "linkque.hook.drain.finished";
27359
- })(ETelemetryEventName || (ETelemetryEventName = {}));
27360
- var ETelemetryOperationName;
27361
- (function(ETelemetryOperationName2) {
27362
- ETelemetryOperationName2["OPERATION"] = "linkque.operation";
27363
- ETelemetryOperationName2["TOOL_INVOKE"] = "harness.tool.invoke";
27364
- ETelemetryOperationName2["ADVANCE"] = "harness.advance";
27365
- ETelemetryOperationName2["MODEL_INVOKE"] = "harness.model.invoke";
27366
- ETelemetryOperationName2["MODEL_ATTEMPT"] = "harness.model.attempt";
27367
- ETelemetryOperationName2["TOOL_ATTEMPT"] = "harness.tool.attempt";
27368
- ETelemetryOperationName2["HOOK_CHAIN"] = "harness.hook.chain";
27369
- ETelemetryOperationName2["MIDDLEWARE"] = "harness.middleware";
27370
- ETelemetryOperationName2["LOOP"] = "linkque.agent.loop";
27371
- ETelemetryOperationName2["ITERATION"] = "linkque.agent.iteration";
27372
- ETelemetryOperationName2["SESSION_LOAD"] = "harness.session.load";
27373
- ETelemetryOperationName2["HISTORY_APPEND"] = "linkque.history.append";
27374
- ETelemetryOperationName2["CLEANUP"] = "linkque.runtime.cleanup";
27375
- ETelemetryOperationName2["HOOK_DRAIN"] = "linkque.hook.drain";
27376
- })(ETelemetryOperationName || (ETelemetryOperationName = {}));
27377
- var ETelemetryOutcome;
27378
- (function(ETelemetryOutcome2) {
27379
- ETelemetryOutcome2["SUCCESS"] = "success";
27380
- ETelemetryOutcome2["ERROR"] = "error";
27381
- ETelemetryOutcome2["CANCELLED"] = "cancelled";
27382
- ETelemetryOutcome2["TIMEOUT"] = "timeout";
27383
- ETelemetryOutcome2["REJECTED"] = "rejected";
27384
- ETelemetryOutcome2["UNKNOWN"] = "unknown";
27385
- })(ETelemetryOutcome || (ETelemetryOutcome = {}));
27386
- var ETelemetrySignal;
27387
- (function(ETelemetrySignal2) {
27388
- ETelemetrySignal2["LOGS"] = "logs";
27389
- ETelemetrySignal2["TRACES"] = "traces";
27390
- })(ETelemetrySignal || (ETelemetrySignal = {}));
27391
- var ETelemetryLossReason;
27392
- (function(ETelemetryLossReason2) {
27393
- ETelemetryLossReason2["UNCAUGHT_ERROR"] = "uncaught_error";
27394
- ETelemetryLossReason2["ACTIVE_LIMIT"] = "active_limit";
27395
- ETelemetryLossReason2["ACTIVE_EXPIRED"] = "active_expired";
27396
- ETelemetryLossReason2["SHUTDOWN"] = "shutdown";
27397
- })(ETelemetryLossReason || (ETelemetryLossReason = {}));
27398
- var ETelemetryAdvanceOutcome;
27399
- (function(ETelemetryAdvanceOutcome2) {
27400
- ETelemetryAdvanceOutcome2["FAILED"] = "failed";
27401
- ETelemetryAdvanceOutcome2["COMPLETED"] = "completed";
27402
- ETelemetryAdvanceOutcome2["UNKNOWN"] = "unknown";
27403
- })(ETelemetryAdvanceOutcome || (ETelemetryAdvanceOutcome = {}));
27404
- var ETelemetryStreamTermination;
27405
- (function(ETelemetryStreamTermination2) {
27406
- ETelemetryStreamTermination2["CANCEL"] = "cancel";
27407
- ETelemetryStreamTermination2["ERROR"] = "error";
27408
- ETelemetryStreamTermination2["COMPLETE"] = "complete";
27409
- ETelemetryStreamTermination2["EXHAUSTED"] = "exhausted";
27410
- })(ETelemetryStreamTermination || (ETelemetryStreamTermination = {}));
27411
- var ETelemetryCancelSource;
27412
- (function(ETelemetryCancelSource2) {
27413
- ETelemetryCancelSource2["HOST_SIGNAL"] = "host_signal";
27414
- ETelemetryCancelSource2["CONSUMER_RETURN"] = "consumer_return";
27415
- })(ETelemetryCancelSource || (ETelemetryCancelSource = {}));
27416
- var ETelemetryObservationBoundary;
27417
- (function(ETelemetryObservationBoundary2) {
27418
- ETelemetryObservationBoundary2["LOCAL_WAIT"] = "local_wait";
27419
- ETelemetryObservationBoundary2["EXECUTOR_SETTLED"] = "executor_settled";
27420
- ETelemetryObservationBoundary2["GENERATOR_WITH_SETUP_AND_CLEANUP"] = "generator_with_setup_and_cleanup";
27421
- })(ETelemetryObservationBoundary || (ETelemetryObservationBoundary = {}));
27422
- var ETelemetryRemoteCompletion;
27423
- (function(ETelemetryRemoteCompletion2) {
27424
- ETelemetryRemoteCompletion2["UNKNOWN"] = "unknown";
27425
- ETelemetryRemoteCompletion2["NOT_DISPATCHED"] = "not_dispatched";
27426
- ETelemetryRemoteCompletion2["CONFIRMED"] = "confirmed";
27427
- })(ETelemetryRemoteCompletion || (ETelemetryRemoteCompletion = {}));
27428
- var ETelemetryCommitStatus;
27429
- (function(ETelemetryCommitStatus2) {
27430
- ETelemetryCommitStatus2["COMMITTED"] = "committed";
27431
- ETelemetryCommitStatus2["FAILED"] = "failed";
27432
- })(ETelemetryCommitStatus || (ETelemetryCommitStatus = {}));
27433
- var ETelemetryHookMode;
27434
- (function(ETelemetryHookMode2) {
27435
- ETelemetryHookMode2["AWAITED"] = "awaited";
27436
- ETelemetryHookMode2["DETACHED"] = "detached";
27437
- })(ETelemetryHookMode || (ETelemetryHookMode = {}));
27438
- var ETelemetryHookResult;
27439
- (function(ETelemetryHookResult2) {
27440
- ETelemetryHookResult2["OK"] = "ok";
27441
- ETelemetryHookResult2["TIMEOUT"] = "timeout";
27442
- ETelemetryHookResult2["SKIPPED"] = "skipped";
27443
- ETelemetryHookResult2["SUCCESS"] = "success";
27444
- ETelemetryHookResult2["ERROR"] = "error";
27445
- })(ETelemetryHookResult || (ETelemetryHookResult = {}));
27446
- var ETelemetrySource;
27447
- (function(ETelemetrySource2) {
27448
- ETelemetrySource2["KERNEL"] = "kernel";
27449
- ETelemetrySource2["PROVIDER"] = "provider";
27450
- })(ETelemetrySource || (ETelemetrySource = {}));
27451
- var ETelemetryEvidence;
27452
- (function(ETelemetryEvidence2) {
27453
- ETelemetryEvidence2["OBSERVED"] = "observed";
27454
- })(ETelemetryEvidence || (ETelemetryEvidence = {}));
27455
- var ETelemetryCompleteness;
27456
- (function(ETelemetryCompleteness2) {
27457
- ETelemetryCompleteness2["COMPLETE"] = "complete";
27458
- ETelemetryCompleteness2["PARTIAL"] = "partial";
27459
- })(ETelemetryCompleteness || (ETelemetryCompleteness = {}));
27460
- var ETelemetryCoverage;
27461
- (function(ETelemetryCoverage2) {
27462
- ETelemetryCoverage2["PI_MODEL_TOOL_HOOK"] = "pi_model_tool_hook";
27463
- ETelemetryCoverage2["CORE_ONLY"] = "core_only";
27464
- })(ETelemetryCoverage || (ETelemetryCoverage = {}));
27465
- var ETelemetryUsageSource;
27466
- (function(ETelemetryUsageSource2) {
27467
- ETelemetryUsageSource2["UNKNOWN"] = "unknown";
27468
- ETelemetryUsageSource2["PROVIDER_NORMALIZED"] = "provider_normalized";
27469
- })(ETelemetryUsageSource || (ETelemetryUsageSource = {}));
27470
- var ETelemetryAttemptVisibility;
27471
- (function(ETelemetryAttemptVisibility2) {
27472
- ETelemetryAttemptVisibility2["PROVIDER_INVOCATION"] = "provider_invocation";
27473
- ETelemetryAttemptVisibility2["TOOL_PROVIDER_INVOCATION"] = "tool_provider_invocation";
27474
- })(ETelemetryAttemptVisibility || (ETelemetryAttemptVisibility = {}));
27475
- var ETelemetryLinkRelation;
27476
- (function(ETelemetryLinkRelation2) {
27477
- ETelemetryLinkRelation2["GENERATED_BY"] = "generated_by";
27478
- ETelemetryLinkRelation2["SCHEDULED_BY"] = "scheduled_by";
27479
- })(ETelemetryLinkRelation || (ETelemetryLinkRelation = {}));
27480
- var ETelemetryToolFailureStage;
27481
- (function(ETelemetryToolFailureStage2) {
27482
- ETelemetryToolFailureStage2["BEFORE_HOOK"] = "before_hook";
27483
- ETelemetryToolFailureStage2["EXECUTION"] = "execution";
27484
- ETelemetryToolFailureStage2["AFTER_HOOK"] = "after_hook";
27485
- })(ETelemetryToolFailureStage || (ETelemetryToolFailureStage = {}));
27486
- var ETelemetryTerminalEvidence;
27487
- (function(ETelemetryTerminalEvidence2) {
27488
- ETelemetryTerminalEvidence2["EXPLICIT_DONE_HISTORY_COMMITTED"] = "explicit_done_history_committed";
27489
- ETelemetryTerminalEvidence2["EXPLICIT_DONE"] = "explicit_done";
27490
- ETelemetryTerminalEvidence2["STREAM_ERROR"] = "stream_error";
27491
- ETelemetryTerminalEvidence2["CONSUMER_CANCEL"] = "consumer_cancel";
27492
- ETelemetryTerminalEvidence2["NATURAL_EXHAUSTION"] = "natural_exhaustion";
27493
- })(ETelemetryTerminalEvidence || (ETelemetryTerminalEvidence = {}));
27494
- var ETelemetryTerminalSource;
27495
- (function(ETelemetryTerminalSource2) {
27496
- ETelemetryTerminalSource2["NATIVE_AGENT_END"] = "native_agent_end";
27497
- ETelemetryTerminalSource2["PROMPT_RESOLVED_FALLBACK"] = "prompt_resolved_fallback";
27498
- })(ETelemetryTerminalSource || (ETelemetryTerminalSource = {}));
27499
- var ETelemetryModelPurpose;
27500
- (function(ETelemetryModelPurpose2) {
27501
- ETelemetryModelPurpose2["AGENT_LOOP"] = "agent_loop";
27502
- })(ETelemetryModelPurpose || (ETelemetryModelPurpose = {}));
27503
- var ETelemetryErrorType;
27504
- (function(ETelemetryErrorType2) {
27505
- ETelemetryErrorType2["PROVIDER_STREAM_ERROR"] = "ProviderStreamError";
27506
- ETelemetryErrorType2["TOOL_EXECUTION_ERROR"] = "ToolExecutionError";
27507
- ETelemetryErrorType2["HOOK_DISPATCH_ERROR"] = "HookDispatchError";
27508
- ETelemetryErrorType2["HOOK_DRAIN_ERROR"] = "HookDrainError";
27509
- })(ETelemetryErrorType || (ETelemetryErrorType = {}));
27510
- var ETelemetrySpanKind;
27511
- (function(ETelemetrySpanKind2) {
27512
- ETelemetrySpanKind2["INTERNAL"] = "internal";
27513
- ETelemetrySpanKind2["CLIENT"] = "client";
27514
- })(ETelemetrySpanKind || (ETelemetrySpanKind = {}));
27515
- var ETelemetryGenAiOperation;
27516
- (function(ETelemetryGenAiOperation2) {
27517
- ETelemetryGenAiOperation2["CHAT"] = "chat";
27518
- ETelemetryGenAiOperation2["EXECUTE_TOOL"] = "execute_tool";
27519
- ETelemetryGenAiOperation2["INVOKE_AGENT"] = "invoke_agent";
27520
- })(ETelemetryGenAiOperation || (ETelemetryGenAiOperation = {}));
27521
- var ETelemetryVersion;
27522
- (function(ETelemetryVersion2) {
27523
- ETelemetryVersion2["V0_2"] = "0.2";
27524
- ETelemetryVersion2["V1_0"] = "1.0";
27525
- })(ETelemetryVersion || (ETelemetryVersion = {}));
27526
-
27527
27663
  // ../linkque-agent-runtime/dist/esm/core/hook/hookDispatcher.js
27528
27664
  import { randomUUID as randomUUID2 } from "node:crypto";
27529
27665
 
@@ -28754,18 +28890,45 @@ function createActivateSkillTool(records) {
28754
28890
  required: ["name"],
28755
28891
  additionalProperties: false
28756
28892
  },
28757
- execute: async (args) => {
28893
+ execute: async (args, _signal, context2) => {
28758
28894
  const name = extractName(args);
28759
- if (!name)
28895
+ const startedAt = Date.now();
28896
+ const obs = context2?.observation;
28897
+ recordContentSection(obs, ETelemetryContentSection.SKILL_INPUT, {
28898
+ name: name ?? null
28899
+ });
28900
+ if (!name) {
28901
+ recordContentSection(obs, ETelemetryContentSection.SKILL_OUTPUT, {
28902
+ status: "failed",
28903
+ error: "\u7F3A\u5C11 name \u53C2\u6570",
28904
+ durationMs: Date.now() - startedAt
28905
+ });
28760
28906
  return "\u6FC0\u6D3B\u6280\u80FD\u5931\u8D25:\u7F3A\u5C11 name \u53C2\u6570\u3002";
28907
+ }
28761
28908
  if (!bodyByName.has(name)) {
28909
+ recordContentSection(obs, ETelemetryContentSection.SKILL_OUTPUT, {
28910
+ name,
28911
+ status: "failed",
28912
+ error: `\u672A\u627E\u5230\u6280\u80FD "${name}"`,
28913
+ durationMs: Date.now() - startedAt
28914
+ });
28762
28915
  return `\u6FC0\u6D3B\u6280\u80FD\u5931\u8D25:\u672A\u627E\u5230\u6280\u80FD "${name}"\u3002\u53EF\u7528:${[...bodyByName.keys()].join(", ")}`;
28763
28916
  }
28764
28917
  if (activated.has(name)) {
28918
+ recordContentSection(obs, ETelemetryContentSection.SKILL_OUTPUT, {
28919
+ name,
28920
+ status: "already_loaded",
28921
+ durationMs: Date.now() - startedAt
28922
+ });
28765
28923
  return `\u6280\u80FD "${name}" \u5DF2\u5728\u672C\u8F6E\u52A0\u8F7D,\u65E0\u9700\u91CD\u590D\u6FC0\u6D3B\u3002`;
28766
28924
  }
28767
28925
  activated.add(name);
28768
28926
  const body = bodyByName.get(name) ?? "";
28927
+ recordContentSection(obs, ETelemetryContentSection.SKILL_OUTPUT, {
28928
+ name,
28929
+ status: "loaded",
28930
+ durationMs: Date.now() - startedAt
28931
+ });
28769
28932
  return `<skill name="${escapeXml(name)}">
28770
28933
  ${body}
28771
28934
  </skill>`;
@@ -29016,7 +29179,7 @@ function createKnowledgeTools(resources, searchPort, agentId) {
29016
29179
  additionalProperties: false
29017
29180
  },
29018
29181
  annotations: { readOnlyHint: true },
29019
- execute: () => listKnowledge()
29182
+ execute: (_args, _signal, context2) => listKnowledge(context2)
29020
29183
  },
29021
29184
  {
29022
29185
  name: KNOWLEDGE_RECALL_TOOL_NAME,
@@ -29043,24 +29206,48 @@ function createKnowledgeTools(resources, searchPort, agentId) {
29043
29206
  additionalProperties: false
29044
29207
  },
29045
29208
  annotations: { readOnlyHint: true },
29046
- execute: (args, signal) => recallKnowledge(args, signal)
29209
+ execute: (args, signal, context2) => recallKnowledge(args, signal, context2)
29047
29210
  }
29048
29211
  ];
29049
- async function listKnowledge() {
29050
- return { knowledgeBases: await getKnowledgeBases() };
29212
+ async function listKnowledge(context2) {
29213
+ const result = { knowledgeBases: await getKnowledgeBases() };
29214
+ recordContentSection(context2?.observation, ETelemetryContentSection.KNOWLEDGE_OUTPUT, {
29215
+ knowledgeBases: result.knowledgeBases.map((kb) => ({
29216
+ knowledgeBaseId: kb.knowledgeBaseId,
29217
+ knowledgeDesc: kb.knowledgeDesc
29218
+ }))
29219
+ });
29220
+ return result;
29051
29221
  }
29052
- async function recallKnowledge(args, signal) {
29222
+ async function recallKnowledge(args, signal, context2) {
29053
29223
  const parsed = parseRecallArgs(args);
29224
+ const obs = context2?.observation;
29054
29225
  if ("error" in parsed) {
29226
+ recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_INPUT, {
29227
+ error: parsed.error
29228
+ });
29229
+ recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_OUTPUT, {
29230
+ status: "failed",
29231
+ hits: [],
29232
+ error: parsed.error
29233
+ });
29055
29234
  return { hits: [], error: parsed.error };
29056
29235
  }
29236
+ recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_INPUT, {
29237
+ knowledgeBaseId: parsed.knowledgeBaseId,
29238
+ query: parsed.query,
29239
+ topK: parsed.topK
29240
+ });
29057
29241
  const knowledgeBases = await getKnowledgeBases();
29058
29242
  const bound = knowledgeBases.some((info) => info.knowledgeBaseId === parsed.knowledgeBaseId);
29059
29243
  if (!bound) {
29060
- return {
29244
+ const error = `knowledgeBaseId \u672A\u7ED1\u5B9A: ${parsed.knowledgeBaseId}\u3002\u8BF7\u5148\u8C03\u7528 knowledge_list \u67E5\u770B\u53EF\u7528\u77E5\u8BC6\u5E93\u3002`;
29245
+ recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_OUTPUT, {
29246
+ status: "failed",
29061
29247
  hits: [],
29062
- error: `knowledgeBaseId \u672A\u7ED1\u5B9A: ${parsed.knowledgeBaseId}\u3002\u8BF7\u5148\u8C03\u7528 knowledge_list \u67E5\u770B\u53EF\u7528\u77E5\u8BC6\u5E93\u3002`
29063
- };
29248
+ error
29249
+ });
29250
+ return { hits: [], error };
29064
29251
  }
29065
29252
  try {
29066
29253
  const result = await searchPort.search({
@@ -29069,10 +29256,20 @@ function createKnowledgeTools(resources, searchPort, agentId) {
29069
29256
  agentId,
29070
29257
  topK: parsed.topK
29071
29258
  }, signal);
29259
+ recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_OUTPUT, {
29260
+ status: result.hits.length ? "matched" : "no_hits",
29261
+ hits: result.hits
29262
+ });
29072
29263
  return { hits: result.hits };
29073
29264
  } catch (e) {
29074
29265
  const msg = e instanceof Error ? e.message : String(e);
29075
- return { hits: [], error: `\u77E5\u8BC6\u5E93\u68C0\u7D22\u5931\u8D25: ${msg}` };
29266
+ const error = `\u77E5\u8BC6\u5E93\u68C0\u7D22\u5931\u8D25: ${msg}`;
29267
+ recordContentSection(obs, ETelemetryContentSection.KNOWLEDGE_OUTPUT, {
29268
+ status: "failed",
29269
+ hits: [],
29270
+ error
29271
+ });
29272
+ return { hits: [], error };
29076
29273
  }
29077
29274
  }
29078
29275
  async function getKnowledgeBases() {
@@ -29099,7 +29296,7 @@ var NoopRuntimeObservation = class {
29099
29296
  startOperation(_operation) {
29100
29297
  return this;
29101
29298
  }
29102
- record(_name, _attributes) {
29299
+ record(_name, _attributes, _body) {
29103
29300
  }
29104
29301
  finish(_outcome, _attributes) {
29105
29302
  }
@@ -29182,7 +29379,7 @@ var RuntimeObservation = class _RuntimeObservation {
29182
29379
  find(key) {
29183
29380
  return this.associations.get(key);
29184
29381
  }
29185
- record(name, attributes) {
29382
+ record(name, attributes, body) {
29186
29383
  if (this.abandoned)
29187
29384
  return;
29188
29385
  try {
@@ -29190,7 +29387,7 @@ var RuntimeObservation = class _RuntimeObservation {
29190
29387
  this.resultAttributes = {
29191
29388
  [ETelemetryAttribute.LINKQUE_TOOL_FAILURE_STAGE]: attributes[ETelemetryAttribute.LINKQUE_TOOL_FAILURE_STAGE]
29192
29389
  };
29193
- this.sink.record(name, attributes);
29390
+ this.sink.record(name, attributes, body);
29194
29391
  } catch {
29195
29392
  }
29196
29393
  }
@@ -35782,7 +35979,14 @@ var RemoteGatewayMcpServerProvider = class {
35782
35979
  if (!this.debugLog)
35783
35980
  return;
35784
35981
  try {
35785
- this.debugLog(`[mcp-client] ${JSON.stringify({ serverName, resourceId: resource.resourceId, requestId, method, phase, payload: this.invocationContext.current()?.auth ? { redacted: true } : payload })}`, EDebugLogScope.MCP);
35982
+ this.debugLog(`[mcp-client] ${JSON.stringify({
35983
+ serverName,
35984
+ resourceId: resource.resourceId,
35985
+ requestId,
35986
+ method,
35987
+ phase,
35988
+ payload: this.invocationContext.current()?.auth ? { redacted: true } : payload
35989
+ })}`, EDebugLogScope.MCP);
35786
35990
  } catch (error) {
35787
35991
  warnLogFailure("remoteGatewayMcpServer.log", error);
35788
35992
  }
@@ -35802,6 +36006,8 @@ var RemoteGatewayMcpServerProvider = class {
35802
36006
  callTool: (params, resultSchema, requestOptions) => request("tools/call", params, () => client.callTool(params, resultSchema, requestOptions))
35803
36007
  };
35804
36008
  const callTool = (name, args, signal, options) => callHeaders.run(options?.headers ?? {}, () => this.invocationContext.run(timeoutMs, signal, async (invocation) => {
36009
+ const observation = options?.context?.observation;
36010
+ recordMcpContentSection(observation, ETelemetryContentSection.MCP_REQUESTED_INPUT, args, options?.toolSchema?.inputSchema);
35805
36011
  const plan = createArgsMappingPlan(name, args, argsMappingRules);
35806
36012
  if (plan.requiresUserId) {
35807
36013
  if (config.signEndpoint !== void 0 && config.signEndpoint !== DEFAULT_SIGN_ENDPOINT && !config.verifyTokenEndpoint?.trim())
@@ -35824,19 +36030,22 @@ var RemoteGatewayMcpServerProvider = class {
35824
36030
  };
35825
36031
  }
35826
36032
  const mapped = resolveArgsMappingPlan(plan, invocation.auth);
36033
+ recordMcpContentSection(observation, ETelemetryContentSection.MCP_INPUT, mapped, options?.toolSchema?.inputSchema);
35827
36034
  invocation.signal.throwIfAborted();
35828
36035
  const remaining = Math.max(1, invocation.deadline - performance.now());
35829
36036
  try {
35830
- return await loggedClient.callTool({ name, arguments: mapped }, void 0, {
36037
+ const result = await loggedClient.callTool({ name, arguments: mapped }, void 0, {
35831
36038
  signal: invocation.signal,
35832
36039
  timeout: remaining,
35833
36040
  maxTotalTimeout: remaining,
35834
36041
  resetTimeoutOnProgress: false
35835
36042
  });
36043
+ recordMcpContentSection(observation, ETelemetryContentSection.MCP_OUTPUT, result, options?.toolSchema?.outputSchema);
36044
+ return result;
35836
36045
  } catch (error) {
35837
36046
  invocation.signal.throwIfAborted();
35838
36047
  if (invocation.auth && !(error instanceof McpInvocationError))
35839
- throw new Error("MCP \u7528\u6237\u5DE5\u5177\u8C03\u7528\u5931\u8D25");
36048
+ throw new Error("MCP \u7528\u6237\u5DE5\u5177\u8C03\u7528\u5931\u8D25", { cause: error });
35840
36049
  throw error;
35841
36050
  }
35842
36051
  }));
@@ -35861,7 +36070,13 @@ async function listToolsFromClient(client, resourceId, callTool) {
35861
36070
  const descriptor = {
35862
36071
  name: tool.name,
35863
36072
  resourceId,
35864
- execute: (args, signal) => callTool(tool.name, args, signal)
36073
+ execute: (args, signal, context2) => callTool(tool.name, args, signal, {
36074
+ context: context2,
36075
+ toolSchema: {
36076
+ inputSchema: tool.inputSchema,
36077
+ outputSchema: tool.outputSchema
36078
+ }
36079
+ })
35865
36080
  };
35866
36081
  if (tool.description !== void 0)
35867
36082
  descriptor.description = tool.description;
@@ -36895,7 +37110,7 @@ var WebSkillLoader = class {
36895
37110
  return records.filter((record2, idx) => {
36896
37111
  if (record2 !== void 0)
36897
37112
  return true;
36898
- this.debugLog?.(`[skill] \u8DF3\u8FC7\u8D44\u6E90 ${resources[idx]?.resourceId ?? "?"}:SKILL.md \u7F3A description(\u524D\u7F6E\u65E0\u6548),\u6309 spec \u4E0D\u52A0\u8F7D`);
37113
+ this.debugLog?.(`[skill] \u8DF3\u8FC7\u8D44\u6E90 ${resources[idx]?.resourceId ?? "?"}:SKILL.md \u7F3A description(\u524D\u7F6E\u65E0\u6548),\u6309 spec \u4E0D\u52A0\u8F7D`, EDebugLogScope.SKILL);
36899
37114
  return false;
36900
37115
  });
36901
37116
  }
@@ -37562,6 +37777,7 @@ var allowedAttributeKeys = /* @__PURE__ */ new Set([
37562
37777
  ETelemetryAttribute.GEN_AI_REQUEST_MODEL,
37563
37778
  ETelemetryAttribute.GEN_AI_RESPONSE_MODEL,
37564
37779
  ETelemetryAttribute.GEN_AI_RESPONSE_ID,
37780
+ ETelemetryAttribute.LINKQUE_CONTENT_VALUE_TRUNCATED,
37565
37781
  ETelemetryAttribute.GEN_AI_RESPONSE_FINISH_REASONS,
37566
37782
  ETelemetryAttribute.GEN_AI_USAGE_INPUT_TOKENS,
37567
37783
  ETelemetryAttribute.GEN_AI_USAGE_OUTPUT_TOKENS,
@@ -37573,6 +37789,14 @@ var allowedAttributeKeys = /* @__PURE__ */ new Set([
37573
37789
  ETelemetryAttribute.HARNESS_MODEL_PURPOSE,
37574
37790
  ETelemetryAttribute.HARNESS_MODEL_INVOCATION_COUNT,
37575
37791
  ETelemetryAttribute.GEN_AI_TOOL_NAME,
37792
+ ETelemetryAttribute.LINKQUE_TOOL_DISPLAY_NAME,
37793
+ ETelemetryAttribute.LINKQUE_CARD_EXECUTION_ID,
37794
+ ETelemetryAttribute.LINKQUE_CARD_REF,
37795
+ ETelemetryAttribute.LINKQUE_CARD_REVISION,
37796
+ ETelemetryAttribute.LINKQUE_CARD_DISPLAY_NAME,
37797
+ ETelemetryAttribute.LINKQUE_CARD_PHASE,
37798
+ ETelemetryAttribute.LINKQUE_CARD_SOURCE_ID,
37799
+ ETelemetryAttribute.LINKQUE_CARD_DELIVERY,
37576
37800
  ETelemetryAttribute.GEN_AI_TOOL_CALL_ID,
37577
37801
  ETelemetryAttribute.HARNESS_TOOL_RESULT_STATUS,
37578
37802
  ETelemetryAttribute.LINKQUE_TOOL_FAILURE_STAGE,
@@ -37720,7 +37944,7 @@ var OtelRuntimeTelemetry = class {
37720
37944
  {
37721
37945
  onEmit: (record2, ctx) => {
37722
37946
  const route = ctx?.getValue(this.routeKey);
37723
- this.output(ETelemetrySignal.LOGS, import_otlp_transformer.JsonLogsSerializer.serializeRequest([record2]), route?.route, route?.critical ?? false);
37947
+ this.output(ETelemetrySignal.LOGS, import_otlp_transformer.JsonLogsSerializer.serializeRequest([record2]), route?.route, route?.critical ?? false, route?.localOnly ?? false);
37724
37948
  },
37725
37949
  forceFlush: async () => void 0,
37726
37950
  shutdown: async () => void 0
@@ -37728,12 +37952,13 @@ var OtelRuntimeTelemetry = class {
37728
37952
  ]
37729
37953
  });
37730
37954
  }
37731
- output(signal, encoded, route, critical) {
37955
+ output(signal, encoded, route, critical, localOnly = false) {
37732
37956
  if (!encoded || this.outputActive || this.disposed)
37733
37957
  return;
37734
37958
  this.outputActive = true;
37735
37959
  try {
37736
- this.queue.enqueue(route, signal, encoded, critical);
37960
+ if (!localOnly)
37961
+ this.queue.enqueue(route, signal, encoded, critical);
37737
37962
  if (this.options.localSink) {
37738
37963
  try {
37739
37964
  const payload = JSON.parse(new TextDecoder().decode(encoded));
@@ -37758,7 +37983,6 @@ var OtelRuntimeTelemetry = class {
37758
37983
  return new NoopRuntimeObservation();
37759
37984
  }
37760
37985
  const state = {
37761
- agentId: input.agentId,
37762
37986
  sequence: 0,
37763
37987
  route: auth2 ? this.queue.authorize(auth2) : void 0,
37764
37988
  attributes: sanitizeTelemetryAttributes({
@@ -37814,7 +38038,6 @@ var OtelRuntimeTelemetry = class {
37814
38038
  isRemote: upstream !== null,
37815
38039
  traceState: parentContext.traceState ? createTraceState(parentContext.traceState) : void 0
37816
38040
  });
37817
- const spanName = spec.name === ETelemetryOperationName.MODEL_ATTEMPT ? `${ETelemetryGenAiOperation.CHAT} ${spec.attributes[ETelemetryAttribute.GEN_AI_REQUEST_MODEL]}` : spec.name === ETelemetryOperationName.TOOL_INVOKE ? `${ETelemetryGenAiOperation.EXECUTE_TOOL} ${spec.attributes[ETelemetryAttribute.GEN_AI_TOOL_NAME]}` : spec.name === ETelemetryOperationName.ADVANCE && state.agentId ? `${ETelemetryGenAiOperation.INVOKE_AGENT} ${state.agentId}` : spec.name;
37818
38041
  const attributes = sanitizeTelemetryAttributes({
37819
38042
  ...state.attributes,
37820
38043
  ...parent?.attributes,
@@ -37832,11 +38055,11 @@ var OtelRuntimeTelemetry = class {
37832
38055
  ETelemetryAttribute.LINKQUE_CONVERSATION_ID
37833
38056
  ].some((attribute) => attribute === key))),
37834
38057
  [ETelemetryAttribute.LINKQUE_OPERATION_ID]: randomUUID5(),
37835
- [ETelemetryAttribute.LINKQUE_OPERATION_NAME]: spanName,
38058
+ [ETelemetryAttribute.LINKQUE_OPERATION_NAME]: spec.name,
37836
38059
  [ETelemetryAttribute.LINKQUE_OPERATION_PARENT_ID]: spec.detached ? "" : parent?.operationId ?? "",
37837
38060
  [ETelemetryAttribute.LINKQUE_SPAN_PARENT_ID]: spec.detached ? "" : parentContext?.spanId ?? ""
37838
38061
  });
37839
- const span = this.tracerProvider.getTracer(ETelemetryMetadata.SCOPE_NAME, ETelemetryVersion.V1_0).startSpan(spanName.slice(0, 256), {
38062
+ const span = this.tracerProvider.getTracer(ETelemetryMetadata.SCOPE_NAME, ETelemetryVersion.V1_0).startSpan(spec.name, {
37840
38063
  kind: spec.name === ETelemetryOperationName.MODEL_ATTEMPT ? SpanKind.CLIENT : SpanKind.INTERNAL,
37841
38064
  attributes,
37842
38065
  links: spec.links.filter((link) => validContext(link.context)).slice(0, 16).map((link) => ({
@@ -37864,7 +38087,7 @@ var OtelRuntimeTelemetry = class {
37864
38087
  operation.record(`${spec.eventPrefix}.${ETelemetryEventPhase.STARTED}`, {});
37865
38088
  return operation;
37866
38089
  }
37867
- emit(operation, name, attributes, critical) {
38090
+ emit(operation, name, attributes, critical, body) {
37868
38091
  if (this.disposed || this.queue.isExporting)
37869
38092
  return;
37870
38093
  const contextAttributes = operation.attributes;
@@ -37891,18 +38114,33 @@ var OtelRuntimeTelemetry = class {
37891
38114
  Math.floor(now / 1e3),
37892
38115
  now % 1e3 * 1e6
37893
38116
  ];
37894
- if (operation.span.isRecording())
38117
+ const localOnly = name === ETelemetryEventName.CONTENT_RECORDED;
38118
+ if (localOnly && body && typeof body === "object" && "value" in body) {
38119
+ const { value, ...metadata } = body;
38120
+ try {
38121
+ const valueJson = JSON.stringify(value);
38122
+ body = valueJson !== void 0 && Buffer.byteLength(JSON.stringify(valueJson), "utf8") <= 512 * 1024 ? { ...metadata, valueJson } : { ...metadata, availability: "unavailable", reason: "content_limit" };
38123
+ } catch {
38124
+ body = { ...metadata, availability: "unavailable" };
38125
+ }
38126
+ }
38127
+ if (!localOnly && operation.span.isRecording())
37895
38128
  operation.span.addEvent(
37896
38129
  name,
37897
38130
  // 复用已投影的属性;Span 已持有上下文,事件只保留本次事实及去重字段。
37898
38131
  Object.fromEntries(Object.entries(record2).filter(([key]) => Object.hasOwn(attributes, key) || key === ETelemetryAttribute.HARNESS_RECORD_ID || key === ETelemetryAttribute.HARNESS_EVENT_SEQUENCE)),
37899
38132
  time
37900
38133
  );
37901
- const ctx = trace.setSpan(ROOT_CONTEXT, operation.span).setValue(this.routeKey, { route: operation.state.route, critical });
38134
+ const ctx = trace.setSpan(ROOT_CONTEXT, operation.span).setValue(this.routeKey, {
38135
+ route: operation.state.route,
38136
+ critical,
38137
+ localOnly
38138
+ });
37902
38139
  this.loggerProvider.getLogger(ETelemetryMetadata.SCOPE_NAME, ETelemetryVersion.V1_0).emit({
37903
38140
  eventName: name,
37904
38141
  timestamp: time,
37905
38142
  observedTimestamp: time,
38143
+ ...body !== void 0 ? { body } : {},
37906
38144
  severityNumber: record2[ETelemetryAttribute.HARNESS_OPERATION_OUTCOME] === ETelemetryOutcome.ERROR || record2[ETelemetryAttribute.HARNESS_OPERATION_OUTCOME] === ETelemetryOutcome.TIMEOUT ? import_api_logs.SeverityNumber.ERROR : import_api_logs.SeverityNumber.INFO,
37907
38145
  severityText: record2[ETelemetryAttribute.HARNESS_OPERATION_OUTCOME] === ETelemetryOutcome.ERROR || record2[ETelemetryAttribute.HARNESS_OPERATION_OUTCOME] === ETelemetryOutcome.TIMEOUT ? import_api_logs.SeverityNumber[import_api_logs.SeverityNumber.ERROR] : import_api_logs.SeverityNumber[import_api_logs.SeverityNumber.INFO],
37908
38146
  attributes: record2,
@@ -37973,10 +38211,11 @@ var OtelObservation = class {
37973
38211
  return new NoopRuntimeObservation();
37974
38212
  return this.owner.createOperation(this.state, spec, this);
37975
38213
  }
37976
- record(name, attributes) {
38214
+ record(name, attributes, body) {
37977
38215
  if (this.lost || !/^(harness|linkque)\.[a-z0-9_.]{1,128}$/.test(name))
37978
38216
  return;
37979
- 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}`));
38217
+ const critical = name.endsWith(`.${ETelemetryEventPhase.FINISHED}`) || name === ETelemetryEventName.MODEL_USAGE_RECORDED || name === ETelemetryEventName.RUNTIME_UNCAUGHT_ERROR || name.endsWith(`.${ETelemetryEventPhase.OBSERVATION_LOST}`);
38218
+ this.owner.emit(this, name, attributes, critical, body);
37980
38219
  }
37981
38220
  finish(outcome, attributes) {
37982
38221
  if (this.ended)
@@ -38022,6 +38261,8 @@ function validContext(value) {
38022
38261
  export {
38023
38262
  EModelRequestSource,
38024
38263
  EDebugLogScope,
38264
+ isDebugLoggingEnabled,
38265
+ createRuntimeDebugLog,
38025
38266
  EModelProvider,
38026
38267
  EResourceType,
38027
38268
  EResourceProviderType,
@@ -38049,22 +38290,11 @@ export {
38049
38290
  McpPhoneAuthorizationFailedError,
38050
38291
  isMcpPhoneAuthorizationError,
38051
38292
  resolvePhoneAuthorizationDependency,
38052
- McpProxyTool,
38053
- executeHomeData,
38054
- CardActionDiagnostics,
38055
- executeCardAction,
38056
- executeFunctionActionMcp,
38057
- FOLLOW_UP_CONTEXT_MAX_HISTORY_RUNS,
38058
- prepareFollowUpQuestionContext,
38059
- normalizeFollowUpQuestionStrings,
38060
- InMemorySessionManager,
38061
- NoopSkillLoader,
38062
- NoopMcpServerProvider,
38063
- buildHookCommonParams,
38064
- normalizeHookResources,
38293
+ CONTENT_VALUE_MAX_LENGTH,
38065
38294
  ETelemetryAttribute,
38066
38295
  ETelemetryEventPrefix,
38067
38296
  ETelemetryEventName,
38297
+ ETelemetryContentSection,
38068
38298
  ETelemetryOperationName,
38069
38299
  ETelemetryOutcome,
38070
38300
  ETelemetryLossReason,
@@ -38086,6 +38316,20 @@ export {
38086
38316
  ETelemetryModelPurpose,
38087
38317
  ETelemetryErrorType,
38088
38318
  ETelemetryGenAiOperation,
38319
+ recordContentSection,
38320
+ McpProxyTool,
38321
+ executeHomeData,
38322
+ CardActionDiagnostics,
38323
+ executeCardAction,
38324
+ executeFunctionActionMcp,
38325
+ FOLLOW_UP_CONTEXT_MAX_HISTORY_RUNS,
38326
+ prepareFollowUpQuestionContext,
38327
+ normalizeFollowUpQuestionStrings,
38328
+ InMemorySessionManager,
38329
+ NoopSkillLoader,
38330
+ NoopMcpServerProvider,
38331
+ buildHookCommonParams,
38332
+ normalizeHookResources,
38089
38333
  warnLogFailure,
38090
38334
  HookDispatcher,
38091
38335
  DEFAULT_HOOK_DRAIN_BUDGET_MS,
@@ -38100,6 +38344,7 @@ export {
38100
38344
  summarizeBody,
38101
38345
  formatHttpLogLine,
38102
38346
  LinkquegwEventHookExecutor,
38347
+ ACTIVATE_SKILL_TOOL_NAME,
38103
38348
  parseSkillFile,
38104
38349
  buildSkillCatalog,
38105
38350
  createActivateSkillTool,