linkque-cli-v2 1.4.3 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/linkquejs.js +147 -48
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-Y36JLYIE.js → chunk-CLYLJ5MD.js} +1257 -1217
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-OMFQ2KRJ.js → chunk-NFVKWQGM.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-SAQYWJAA.js → chunk-S75HFRLD.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +59 -9
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +2 -2
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +2 -2
- package/vendor/linkque-agent-appwrite-integrate/package.json +1 -1
- package/worker.js +468 -383
package/worker.js
CHANGED
|
@@ -11888,6 +11888,371 @@ var init_mcpAggregator = __esm({
|
|
|
11888
11888
|
}
|
|
11889
11889
|
});
|
|
11890
11890
|
|
|
11891
|
+
// ../linkque-agent-protocol/dist/esm/telemetry/telemetryEnums.js
|
|
11892
|
+
var CONTENT_VALUE_MAX_LENGTH, ETelemetryAttribute, ETelemetryEventPrefix, ETelemetryEventPhase, ETelemetryEventName, ETelemetryContentSection, ETelemetryOperationName, ETelemetryOutcome, ETelemetrySignal, ETelemetryLossReason, ETelemetryAdvanceOutcome, ETelemetryStreamTermination, ETelemetryCancelSource, ETelemetryObservationBoundary, ETelemetryRemoteCompletion, ETelemetryCommitStatus, ETelemetryHookMode, ETelemetryHookResult, ETelemetrySource, ETelemetryEvidence, ETelemetryCompleteness, ETelemetryCoverage, ETelemetryUsageSource, ETelemetryAttemptVisibility, ETelemetryLinkRelation, ETelemetryToolFailureStage, ETelemetryTerminalEvidence, ETelemetryTerminalSource, ETelemetryModelPurpose, ETelemetryErrorType, ETelemetrySpanKind, ETelemetryGenAiOperation, ETelemetryVersion;
|
|
11893
|
+
var init_telemetryEnums = __esm({
|
|
11894
|
+
"../linkque-agent-protocol/dist/esm/telemetry/telemetryEnums.js"() {
|
|
11895
|
+
"use strict";
|
|
11896
|
+
CONTENT_VALUE_MAX_LENGTH = 16 * 1024;
|
|
11897
|
+
(function(ETelemetryAttribute2) {
|
|
11898
|
+
ETelemetryAttribute2["HARNESS_TELEMETRY_SCHEMA_VERSION"] = "harness.telemetry.schema.version";
|
|
11899
|
+
ETelemetryAttribute2["LINKQUE_TELEMETRY_SCHEMA_VERSION"] = "linkque.telemetry.schema.version";
|
|
11900
|
+
ETelemetryAttribute2["LINKQUE_TELEMETRY_ADAPTER_VERSION"] = "linkque.telemetry.adapter.version";
|
|
11901
|
+
ETelemetryAttribute2["HARNESS_TELEMETRY_SOURCE"] = "harness.telemetry.source";
|
|
11902
|
+
ETelemetryAttribute2["HARNESS_TELEMETRY_EVIDENCE"] = "harness.telemetry.evidence";
|
|
11903
|
+
ETelemetryAttribute2["HARNESS_TELEMETRY_COMPLETENESS"] = "harness.telemetry.completeness";
|
|
11904
|
+
ETelemetryAttribute2["LINKQUE_RUNTIME_KIND"] = "linkque.runtime.kind";
|
|
11905
|
+
ETelemetryAttribute2["LINKQUE_RUN_ID"] = "linkque.run.id";
|
|
11906
|
+
ETelemetryAttribute2["LINKQUE_AGENT_ID"] = "linkque.agent.id";
|
|
11907
|
+
ETelemetryAttribute2["HARNESS_SESSION_ID"] = "harness.session.id";
|
|
11908
|
+
ETelemetryAttribute2["LINKQUE_CONVERSATION_ID"] = "linkque.conversation.id";
|
|
11909
|
+
ETelemetryAttribute2["LINKQUE_REQUEST_ID"] = "linkque.request.id";
|
|
11910
|
+
ETelemetryAttribute2["LINKQUE_TURN_ID"] = "linkque.turn.id";
|
|
11911
|
+
ETelemetryAttribute2["LINKQUE_ACCOUNT_ID"] = "linkque.account.id";
|
|
11912
|
+
ETelemetryAttribute2["LINKQUE_CHANNEL"] = "linkque.channel";
|
|
11913
|
+
ETelemetryAttribute2["LINKQUE_USER_KEY"] = "linkque.user.key";
|
|
11914
|
+
ETelemetryAttribute2["HARNESS_ADVANCE_ID"] = "harness.advance.id";
|
|
11915
|
+
ETelemetryAttribute2["HARNESS_CALL_ID"] = "harness.call.id";
|
|
11916
|
+
ETelemetryAttribute2["HARNESS_INVOCATION_ID"] = "harness.invocation.id";
|
|
11917
|
+
ETelemetryAttribute2["HARNESS_ATTEMPT_ID"] = "harness.attempt.id";
|
|
11918
|
+
ETelemetryAttribute2["HARNESS_ATTEMPT_VISIBILITY"] = "harness.attempt.visibility";
|
|
11919
|
+
ETelemetryAttribute2["HARNESS_ADVANCE_OUTCOME"] = "harness.advance.outcome";
|
|
11920
|
+
ETelemetryAttribute2["HARNESS_OPERATION_OUTCOME"] = "harness.operation.outcome";
|
|
11921
|
+
ETelemetryAttribute2["HARNESS_REMOTE_COMPLETION"] = "harness.remote.completion";
|
|
11922
|
+
ETelemetryAttribute2["HARNESS_STATE_COMMIT_STATUS"] = "harness.state.commit.status";
|
|
11923
|
+
ETelemetryAttribute2["LINKQUE_OPERATION_ID"] = "linkque.operation.id";
|
|
11924
|
+
ETelemetryAttribute2["LINKQUE_OPERATION_NAME"] = "linkque.operation.name";
|
|
11925
|
+
ETelemetryAttribute2["LINKQUE_OPERATION_PARENT_ID"] = "linkque.operation.parent_id";
|
|
11926
|
+
ETelemetryAttribute2["LINKQUE_SPAN_PARENT_ID"] = "linkque.span.parent_id";
|
|
11927
|
+
ETelemetryAttribute2["HARNESS_RECORD_ID"] = "harness.record.id";
|
|
11928
|
+
ETelemetryAttribute2["HARNESS_EVENT_SEQUENCE"] = "harness.event.sequence";
|
|
11929
|
+
ETelemetryAttribute2["ERROR_TYPE"] = "error.type";
|
|
11930
|
+
ETelemetryAttribute2["LINKQUE_STREAM_TERMINATION"] = "linkque.stream.termination";
|
|
11931
|
+
ETelemetryAttribute2["LINKQUE_STREAM_CANCEL_SOURCE"] = "linkque.stream.cancel_source";
|
|
11932
|
+
ETelemetryAttribute2["LINKQUE_TERMINAL_EVIDENCE"] = "linkque.terminal.evidence";
|
|
11933
|
+
ETelemetryAttribute2["LINKQUE_RUNTIME_CLEANUP_OUTCOME"] = "linkque.runtime.cleanup_outcome";
|
|
11934
|
+
ETelemetryAttribute2["LINKQUE_OBSERVATION_BOUNDARY"] = "linkque.observation.boundary";
|
|
11935
|
+
ETelemetryAttribute2["LINKQUE_LOOP_ITERATION_ID"] = "linkque.loop.iteration.id";
|
|
11936
|
+
ETelemetryAttribute2["LINKQUE_LOOP_ITERATION_INDEX"] = "linkque.loop.iteration.index";
|
|
11937
|
+
ETelemetryAttribute2["LINKQUE_STREAM_TERMINAL_SOURCE"] = "linkque.stream.terminal_source";
|
|
11938
|
+
ETelemetryAttribute2["LINKQUE_STREAM_PUBLIC_TEXT_DELTA_COUNT"] = "linkque.stream.public_text_delta_count";
|
|
11939
|
+
ETelemetryAttribute2["LINKQUE_STREAM_THINKING_DELTA_COUNT"] = "linkque.stream.thinking_delta_count";
|
|
11940
|
+
ETelemetryAttribute2["LINKQUE_MODEL_FIRST_CHUNK_MS"] = "linkque.model.first_chunk_ms";
|
|
11941
|
+
ETelemetryAttribute2["LINKQUE_MODEL_FIRST_TEXT_MS"] = "linkque.model.first_text_ms";
|
|
11942
|
+
ETelemetryAttribute2["LINKQUE_LOOP_FIRST_PUBLIC_TEXT_MS"] = "linkque.loop.first_public_text_ms";
|
|
11943
|
+
ETelemetryAttribute2["LINKQUE_MODEL_CHUNK_COUNT"] = "linkque.model.chunk_count";
|
|
11944
|
+
ETelemetryAttribute2["LINKQUE_MODEL_TEXT_CHARS"] = "linkque.model.text_chars";
|
|
11945
|
+
ETelemetryAttribute2["LINKQUE_MODEL_THINKING_CHARS"] = "linkque.model.thinking_chars";
|
|
11946
|
+
ETelemetryAttribute2["GEN_AI_OPERATION_NAME"] = "gen_ai.operation.name";
|
|
11947
|
+
ETelemetryAttribute2["GEN_AI_AGENT_NAME"] = "gen_ai.agent.name";
|
|
11948
|
+
ETelemetryAttribute2["GEN_AI_PROVIDER_NAME"] = "gen_ai.provider.name";
|
|
11949
|
+
ETelemetryAttribute2["GEN_AI_REQUEST_MODEL"] = "gen_ai.request.model";
|
|
11950
|
+
ETelemetryAttribute2["GEN_AI_RESPONSE_MODEL"] = "gen_ai.response.model";
|
|
11951
|
+
ETelemetryAttribute2["GEN_AI_RESPONSE_ID"] = "gen_ai.response.id";
|
|
11952
|
+
ETelemetryAttribute2["LINKQUE_CONTENT_VALUE_TRUNCATED"] = "linkque.content.value.truncated";
|
|
11953
|
+
ETelemetryAttribute2["GEN_AI_RESPONSE_FINISH_REASONS"] = "gen_ai.response.finish_reasons";
|
|
11954
|
+
ETelemetryAttribute2["GEN_AI_USAGE_INPUT_TOKENS"] = "gen_ai.usage.input_tokens";
|
|
11955
|
+
ETelemetryAttribute2["GEN_AI_USAGE_OUTPUT_TOKENS"] = "gen_ai.usage.output_tokens";
|
|
11956
|
+
ETelemetryAttribute2["GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS"] = "gen_ai.usage.cache_read.input_tokens";
|
|
11957
|
+
ETelemetryAttribute2["GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS"] = "gen_ai.usage.cache_creation.input_tokens";
|
|
11958
|
+
ETelemetryAttribute2["GEN_AI_USAGE_REASONING_OUTPUT_TOKENS"] = "gen_ai.usage.reasoning.output_tokens";
|
|
11959
|
+
ETelemetryAttribute2["HARNESS_USAGE_SOURCE"] = "harness.usage.source";
|
|
11960
|
+
ETelemetryAttribute2["HARNESS_USAGE_ATTEMPT_COVERAGE"] = "harness.usage.attempt_coverage";
|
|
11961
|
+
ETelemetryAttribute2["HARNESS_MODEL_PURPOSE"] = "harness.model.purpose";
|
|
11962
|
+
ETelemetryAttribute2["HARNESS_MODEL_INVOCATION_COUNT"] = "harness.model.invocation_count";
|
|
11963
|
+
ETelemetryAttribute2["GEN_AI_TOOL_NAME"] = "gen_ai.tool.name";
|
|
11964
|
+
ETelemetryAttribute2["GEN_AI_TOOL_CALL_ID"] = "gen_ai.tool.call.id";
|
|
11965
|
+
ETelemetryAttribute2["HARNESS_TOOL_RESULT_STATUS"] = "harness.tool.result.status";
|
|
11966
|
+
ETelemetryAttribute2["LINKQUE_TOOL_FAILURE_STAGE"] = "linkque.tool.failure_stage";
|
|
11967
|
+
ETelemetryAttribute2["HARNESS_HOOK_NAME"] = "harness.hook.name";
|
|
11968
|
+
ETelemetryAttribute2["LINKQUE_HOOK_STAGE"] = "linkque.hook.stage";
|
|
11969
|
+
ETelemetryAttribute2["LINKQUE_HOOK_RESOURCE_ID"] = "linkque.hook.resource_id";
|
|
11970
|
+
ETelemetryAttribute2["LINKQUE_HOOK_EVENT_ID"] = "linkque.hook.event_id";
|
|
11971
|
+
ETelemetryAttribute2["LINKQUE_HOOK_MATCHED_COUNT"] = "linkque.hook.matched_count";
|
|
11972
|
+
ETelemetryAttribute2["LINKQUE_HOOK_PENDING_COUNT"] = "linkque.hook.pending_count";
|
|
11973
|
+
ETelemetryAttribute2["LINKQUE_HOOK_SCHEDULED_COUNT"] = "linkque.hook.scheduled_count";
|
|
11974
|
+
ETelemetryAttribute2["LINKQUE_HOOK_HAS_SIDE_EFFECTS"] = "linkque.hook.has_side_effects";
|
|
11975
|
+
ETelemetryAttribute2["LINKQUE_HOOK_MODE"] = "linkque.hook.mode";
|
|
11976
|
+
ETelemetryAttribute2["LINKQUE_HOOK_TIMEOUT_MS"] = "linkque.hook.timeout_ms";
|
|
11977
|
+
ETelemetryAttribute2["LINKQUE_HOOK_RESULT"] = "linkque.hook.result";
|
|
11978
|
+
ETelemetryAttribute2["HARNESS_MIDDLEWARE_NAME"] = "harness.middleware.name";
|
|
11979
|
+
ETelemetryAttribute2["HARNESS_MIDDLEWARE_INVOCATION_ID"] = "harness.middleware.invocation.id";
|
|
11980
|
+
ETelemetryAttribute2["LINKQUE_HOOK_EXECUTOR_SETTLED"] = "linkque.hook.executor_settled";
|
|
11981
|
+
ETelemetryAttribute2["LINKQUE_HISTORY_MESSAGE_COUNT"] = "linkque.history.message_count";
|
|
11982
|
+
ETelemetryAttribute2["LINKQUE_TELEMETRY_COVERAGE"] = "linkque.telemetry.coverage";
|
|
11983
|
+
ETelemetryAttribute2["LINKQUE_TELEMETRY_LOSS_REASON"] = "linkque.telemetry.loss_reason";
|
|
11984
|
+
ETelemetryAttribute2["LINKQUE_OPERATION_DURATION_MS"] = "linkque.operation.duration_ms";
|
|
11985
|
+
ETelemetryAttribute2["HTTP_RESPONSE_STATUS_CODE"] = "http.response.status_code";
|
|
11986
|
+
ETelemetryAttribute2["SERVICE_NAME"] = "service.name";
|
|
11987
|
+
ETelemetryAttribute2["SERVICE_NAMESPACE"] = "service.namespace";
|
|
11988
|
+
ETelemetryAttribute2["SERVICE_VERSION"] = "service.version";
|
|
11989
|
+
ETelemetryAttribute2["SERVICE_INSTANCE_ID"] = "service.instance.id";
|
|
11990
|
+
ETelemetryAttribute2["DEPLOYMENT_ENVIRONMENT_NAME"] = "deployment.environment.name";
|
|
11991
|
+
ETelemetryAttribute2["LINKQUE_LINK_RELATION"] = "linkque.link.relation";
|
|
11992
|
+
})(ETelemetryAttribute || (ETelemetryAttribute = {}));
|
|
11993
|
+
(function(ETelemetryEventPrefix2) {
|
|
11994
|
+
ETelemetryEventPrefix2["OPERATION"] = "linkque.operation";
|
|
11995
|
+
ETelemetryEventPrefix2["ADVANCE"] = "harness.advance";
|
|
11996
|
+
ETelemetryEventPrefix2["MODEL_INVOKE"] = "harness.model.invoke";
|
|
11997
|
+
ETelemetryEventPrefix2["MODEL_ATTEMPT"] = "harness.model.attempt";
|
|
11998
|
+
ETelemetryEventPrefix2["TOOL_INVOKE"] = "harness.tool.invoke";
|
|
11999
|
+
ETelemetryEventPrefix2["TOOL_ATTEMPT"] = "harness.tool.attempt";
|
|
12000
|
+
ETelemetryEventPrefix2["HOOK_CHAIN"] = "harness.hook.chain";
|
|
12001
|
+
ETelemetryEventPrefix2["MIDDLEWARE"] = "harness.middleware";
|
|
12002
|
+
ETelemetryEventPrefix2["LOOP"] = "linkque.loop";
|
|
12003
|
+
ETelemetryEventPrefix2["LOOP_ITERATION"] = "linkque.loop.iteration";
|
|
12004
|
+
ETelemetryEventPrefix2["HISTORY_APPEND"] = "linkque.history.append";
|
|
12005
|
+
ETelemetryEventPrefix2["HOOK_DRAIN"] = "linkque.hook.drain";
|
|
12006
|
+
})(ETelemetryEventPrefix || (ETelemetryEventPrefix = {}));
|
|
12007
|
+
(function(ETelemetryEventPhase2) {
|
|
12008
|
+
ETelemetryEventPhase2["STARTED"] = "started";
|
|
12009
|
+
ETelemetryEventPhase2["FINISHED"] = "finished";
|
|
12010
|
+
ETelemetryEventPhase2["OBSERVATION_LOST"] = "observation_lost";
|
|
12011
|
+
})(ETelemetryEventPhase || (ETelemetryEventPhase = {}));
|
|
12012
|
+
(function(ETelemetryEventName2) {
|
|
12013
|
+
ETelemetryEventName2["TOOL_EXECUTION_FAILED"] = "linkque.tool.execution.failed";
|
|
12014
|
+
ETelemetryEventName2["TELEMETRY_COVERAGE"] = "linkque.telemetry.coverage";
|
|
12015
|
+
ETelemetryEventName2["HOOK_MATCHED"] = "linkque.hook.matched";
|
|
12016
|
+
ETelemetryEventName2["HOOK_SCHEDULED"] = "linkque.hook.scheduled";
|
|
12017
|
+
ETelemetryEventName2["HOOK_CANCEL_REQUESTED"] = "linkque.hook.cancel_requested";
|
|
12018
|
+
ETelemetryEventName2["HOOK_TIMEOUT_REQUESTED"] = "linkque.hook.timeout_requested";
|
|
12019
|
+
ETelemetryEventName2["HOOK_EXECUTOR_SETTLED"] = "linkque.hook.executor_settled";
|
|
12020
|
+
ETelemetryEventName2["HOOK_WAIT_FINISHED"] = "linkque.hook.wait_finished";
|
|
12021
|
+
ETelemetryEventName2["LOOP_FIRST_PUBLIC_TEXT"] = "linkque.loop.first_public_text";
|
|
12022
|
+
ETelemetryEventName2["STREAM_TERMINAL_OBSERVED"] = "linkque.stream.terminal_observed";
|
|
12023
|
+
ETelemetryEventName2["MODEL_FIRST_CHUNK"] = "harness.model.first_chunk";
|
|
12024
|
+
ETelemetryEventName2["MODEL_FIRST_TEXT"] = "harness.model.first_text";
|
|
12025
|
+
ETelemetryEventName2["MODEL_USAGE_RECORDED"] = "linkque.model.usage.recorded";
|
|
12026
|
+
ETelemetryEventName2["MODEL_RESPONSE_HEADERS"] = "linkque.model.response_headers";
|
|
12027
|
+
ETelemetryEventName2["OPERATION_OBSERVATION_LOST"] = "linkque.operation.observation_lost";
|
|
12028
|
+
ETelemetryEventName2["RUNTIME_UNCAUGHT_ERROR"] = "linkque.runtime.uncaught_error";
|
|
12029
|
+
ETelemetryEventName2["OPERATION_STARTED"] = "linkque.operation.started";
|
|
12030
|
+
ETelemetryEventName2["OPERATION_FINISHED"] = "linkque.operation.finished";
|
|
12031
|
+
ETelemetryEventName2["ADVANCE_STARTED"] = "harness.advance.started";
|
|
12032
|
+
ETelemetryEventName2["ADVANCE_FINISHED"] = "harness.advance.finished";
|
|
12033
|
+
ETelemetryEventName2["MODEL_INVOKE_STARTED"] = "harness.model.invoke.started";
|
|
12034
|
+
ETelemetryEventName2["MODEL_INVOKE_FINISHED"] = "harness.model.invoke.finished";
|
|
12035
|
+
ETelemetryEventName2["MODEL_ATTEMPT_STARTED"] = "harness.model.attempt.started";
|
|
12036
|
+
ETelemetryEventName2["MODEL_ATTEMPT_FINISHED"] = "harness.model.attempt.finished";
|
|
12037
|
+
ETelemetryEventName2["TOOL_INVOKE_STARTED"] = "harness.tool.invoke.started";
|
|
12038
|
+
ETelemetryEventName2["TOOL_INVOKE_FINISHED"] = "harness.tool.invoke.finished";
|
|
12039
|
+
ETelemetryEventName2["TOOL_ATTEMPT_STARTED"] = "harness.tool.attempt.started";
|
|
12040
|
+
ETelemetryEventName2["TOOL_ATTEMPT_FINISHED"] = "harness.tool.attempt.finished";
|
|
12041
|
+
ETelemetryEventName2["HOOK_CHAIN_STARTED"] = "harness.hook.chain.started";
|
|
12042
|
+
ETelemetryEventName2["HOOK_CHAIN_FINISHED"] = "harness.hook.chain.finished";
|
|
12043
|
+
ETelemetryEventName2["MIDDLEWARE_STARTED"] = "harness.middleware.started";
|
|
12044
|
+
ETelemetryEventName2["MIDDLEWARE_FINISHED"] = "harness.middleware.finished";
|
|
12045
|
+
ETelemetryEventName2["LOOP_STARTED"] = "linkque.loop.started";
|
|
12046
|
+
ETelemetryEventName2["LOOP_FINISHED"] = "linkque.loop.finished";
|
|
12047
|
+
ETelemetryEventName2["LOOP_ITERATION_STARTED"] = "linkque.loop.iteration.started";
|
|
12048
|
+
ETelemetryEventName2["LOOP_ITERATION_FINISHED"] = "linkque.loop.iteration.finished";
|
|
12049
|
+
ETelemetryEventName2["HISTORY_APPEND_STARTED"] = "linkque.history.append.started";
|
|
12050
|
+
ETelemetryEventName2["HISTORY_APPEND_FINISHED"] = "linkque.history.append.finished";
|
|
12051
|
+
ETelemetryEventName2["HOOK_DRAIN_STARTED"] = "linkque.hook.drain.started";
|
|
12052
|
+
ETelemetryEventName2["HOOK_DRAIN_FINISHED"] = "linkque.hook.drain.finished";
|
|
12053
|
+
ETelemetryEventName2["CONTENT_RECORDED"] = "linkque.content.recorded";
|
|
12054
|
+
})(ETelemetryEventName || (ETelemetryEventName = {}));
|
|
12055
|
+
(function(ETelemetryContentSection2) {
|
|
12056
|
+
ETelemetryContentSection2["QUERY_INPUT"] = "query.input";
|
|
12057
|
+
ETelemetryContentSection2["MODEL_OUTPUT"] = "model.output";
|
|
12058
|
+
ETelemetryContentSection2["MCP_ACTION_OUTPUT"] = "mcp_action.output";
|
|
12059
|
+
ETelemetryContentSection2["TOOL_INPUT"] = "tool.input";
|
|
12060
|
+
ETelemetryContentSection2["TOOL_OUTPUT"] = "tool.output";
|
|
12061
|
+
ETelemetryContentSection2["MCP_REQUESTED_INPUT"] = "mcp.requested_input";
|
|
12062
|
+
ETelemetryContentSection2["MCP_INPUT"] = "mcp.input";
|
|
12063
|
+
ETelemetryContentSection2["MCP_OUTPUT"] = "mcp.output";
|
|
12064
|
+
ETelemetryContentSection2["SKILL_INPUT"] = "skill.input";
|
|
12065
|
+
ETelemetryContentSection2["SKILL_OUTPUT"] = "skill.output";
|
|
12066
|
+
ETelemetryContentSection2["KNOWLEDGE_INPUT"] = "knowledge.input";
|
|
12067
|
+
ETelemetryContentSection2["KNOWLEDGE_OUTPUT"] = "knowledge.output";
|
|
12068
|
+
})(ETelemetryContentSection || (ETelemetryContentSection = {}));
|
|
12069
|
+
(function(ETelemetryOperationName2) {
|
|
12070
|
+
ETelemetryOperationName2["OPERATION"] = "linkque.operation";
|
|
12071
|
+
ETelemetryOperationName2["TOOL_INVOKE"] = "harness.tool.invoke";
|
|
12072
|
+
ETelemetryOperationName2["ADVANCE"] = "harness.advance";
|
|
12073
|
+
ETelemetryOperationName2["MODEL_INVOKE"] = "harness.model.invoke";
|
|
12074
|
+
ETelemetryOperationName2["MODEL_ATTEMPT"] = "harness.model.attempt";
|
|
12075
|
+
ETelemetryOperationName2["TOOL_ATTEMPT"] = "harness.tool.attempt";
|
|
12076
|
+
ETelemetryOperationName2["HOOK_CHAIN"] = "harness.hook.chain";
|
|
12077
|
+
ETelemetryOperationName2["MIDDLEWARE"] = "harness.middleware";
|
|
12078
|
+
ETelemetryOperationName2["LOOP"] = "linkque.agent.loop";
|
|
12079
|
+
ETelemetryOperationName2["ITERATION"] = "linkque.agent.iteration";
|
|
12080
|
+
ETelemetryOperationName2["SESSION_LOAD"] = "harness.session.load";
|
|
12081
|
+
ETelemetryOperationName2["HISTORY_APPEND"] = "linkque.history.append";
|
|
12082
|
+
ETelemetryOperationName2["CLEANUP"] = "linkque.runtime.cleanup";
|
|
12083
|
+
ETelemetryOperationName2["HOOK_DRAIN"] = "linkque.hook.drain";
|
|
12084
|
+
})(ETelemetryOperationName || (ETelemetryOperationName = {}));
|
|
12085
|
+
(function(ETelemetryOutcome2) {
|
|
12086
|
+
ETelemetryOutcome2["SUCCESS"] = "success";
|
|
12087
|
+
ETelemetryOutcome2["ERROR"] = "error";
|
|
12088
|
+
ETelemetryOutcome2["CANCELLED"] = "cancelled";
|
|
12089
|
+
ETelemetryOutcome2["TIMEOUT"] = "timeout";
|
|
12090
|
+
ETelemetryOutcome2["REJECTED"] = "rejected";
|
|
12091
|
+
ETelemetryOutcome2["UNKNOWN"] = "unknown";
|
|
12092
|
+
})(ETelemetryOutcome || (ETelemetryOutcome = {}));
|
|
12093
|
+
(function(ETelemetrySignal2) {
|
|
12094
|
+
ETelemetrySignal2["LOGS"] = "logs";
|
|
12095
|
+
ETelemetrySignal2["TRACES"] = "traces";
|
|
12096
|
+
})(ETelemetrySignal || (ETelemetrySignal = {}));
|
|
12097
|
+
(function(ETelemetryLossReason2) {
|
|
12098
|
+
ETelemetryLossReason2["UNCAUGHT_ERROR"] = "uncaught_error";
|
|
12099
|
+
ETelemetryLossReason2["ACTIVE_LIMIT"] = "active_limit";
|
|
12100
|
+
ETelemetryLossReason2["ACTIVE_EXPIRED"] = "active_expired";
|
|
12101
|
+
ETelemetryLossReason2["SHUTDOWN"] = "shutdown";
|
|
12102
|
+
})(ETelemetryLossReason || (ETelemetryLossReason = {}));
|
|
12103
|
+
(function(ETelemetryAdvanceOutcome2) {
|
|
12104
|
+
ETelemetryAdvanceOutcome2["FAILED"] = "failed";
|
|
12105
|
+
ETelemetryAdvanceOutcome2["COMPLETED"] = "completed";
|
|
12106
|
+
ETelemetryAdvanceOutcome2["UNKNOWN"] = "unknown";
|
|
12107
|
+
})(ETelemetryAdvanceOutcome || (ETelemetryAdvanceOutcome = {}));
|
|
12108
|
+
(function(ETelemetryStreamTermination2) {
|
|
12109
|
+
ETelemetryStreamTermination2["CANCEL"] = "cancel";
|
|
12110
|
+
ETelemetryStreamTermination2["ERROR"] = "error";
|
|
12111
|
+
ETelemetryStreamTermination2["COMPLETE"] = "complete";
|
|
12112
|
+
ETelemetryStreamTermination2["EXHAUSTED"] = "exhausted";
|
|
12113
|
+
})(ETelemetryStreamTermination || (ETelemetryStreamTermination = {}));
|
|
12114
|
+
(function(ETelemetryCancelSource2) {
|
|
12115
|
+
ETelemetryCancelSource2["HOST_SIGNAL"] = "host_signal";
|
|
12116
|
+
ETelemetryCancelSource2["CONSUMER_RETURN"] = "consumer_return";
|
|
12117
|
+
})(ETelemetryCancelSource || (ETelemetryCancelSource = {}));
|
|
12118
|
+
(function(ETelemetryObservationBoundary2) {
|
|
12119
|
+
ETelemetryObservationBoundary2["LOCAL_WAIT"] = "local_wait";
|
|
12120
|
+
ETelemetryObservationBoundary2["EXECUTOR_SETTLED"] = "executor_settled";
|
|
12121
|
+
ETelemetryObservationBoundary2["GENERATOR_WITH_SETUP_AND_CLEANUP"] = "generator_with_setup_and_cleanup";
|
|
12122
|
+
})(ETelemetryObservationBoundary || (ETelemetryObservationBoundary = {}));
|
|
12123
|
+
(function(ETelemetryRemoteCompletion2) {
|
|
12124
|
+
ETelemetryRemoteCompletion2["UNKNOWN"] = "unknown";
|
|
12125
|
+
ETelemetryRemoteCompletion2["NOT_DISPATCHED"] = "not_dispatched";
|
|
12126
|
+
ETelemetryRemoteCompletion2["CONFIRMED"] = "confirmed";
|
|
12127
|
+
})(ETelemetryRemoteCompletion || (ETelemetryRemoteCompletion = {}));
|
|
12128
|
+
(function(ETelemetryCommitStatus2) {
|
|
12129
|
+
ETelemetryCommitStatus2["COMMITTED"] = "committed";
|
|
12130
|
+
ETelemetryCommitStatus2["FAILED"] = "failed";
|
|
12131
|
+
})(ETelemetryCommitStatus || (ETelemetryCommitStatus = {}));
|
|
12132
|
+
(function(ETelemetryHookMode2) {
|
|
12133
|
+
ETelemetryHookMode2["AWAITED"] = "awaited";
|
|
12134
|
+
ETelemetryHookMode2["DETACHED"] = "detached";
|
|
12135
|
+
})(ETelemetryHookMode || (ETelemetryHookMode = {}));
|
|
12136
|
+
(function(ETelemetryHookResult2) {
|
|
12137
|
+
ETelemetryHookResult2["OK"] = "ok";
|
|
12138
|
+
ETelemetryHookResult2["TIMEOUT"] = "timeout";
|
|
12139
|
+
ETelemetryHookResult2["SKIPPED"] = "skipped";
|
|
12140
|
+
ETelemetryHookResult2["SUCCESS"] = "success";
|
|
12141
|
+
ETelemetryHookResult2["ERROR"] = "error";
|
|
12142
|
+
})(ETelemetryHookResult || (ETelemetryHookResult = {}));
|
|
12143
|
+
(function(ETelemetrySource2) {
|
|
12144
|
+
ETelemetrySource2["KERNEL"] = "kernel";
|
|
12145
|
+
ETelemetrySource2["PROVIDER"] = "provider";
|
|
12146
|
+
})(ETelemetrySource || (ETelemetrySource = {}));
|
|
12147
|
+
(function(ETelemetryEvidence2) {
|
|
12148
|
+
ETelemetryEvidence2["OBSERVED"] = "observed";
|
|
12149
|
+
})(ETelemetryEvidence || (ETelemetryEvidence = {}));
|
|
12150
|
+
(function(ETelemetryCompleteness2) {
|
|
12151
|
+
ETelemetryCompleteness2["COMPLETE"] = "complete";
|
|
12152
|
+
ETelemetryCompleteness2["PARTIAL"] = "partial";
|
|
12153
|
+
})(ETelemetryCompleteness || (ETelemetryCompleteness = {}));
|
|
12154
|
+
(function(ETelemetryCoverage2) {
|
|
12155
|
+
ETelemetryCoverage2["PI_MODEL_TOOL_HOOK"] = "pi_model_tool_hook";
|
|
12156
|
+
ETelemetryCoverage2["CORE_ONLY"] = "core_only";
|
|
12157
|
+
})(ETelemetryCoverage || (ETelemetryCoverage = {}));
|
|
12158
|
+
(function(ETelemetryUsageSource2) {
|
|
12159
|
+
ETelemetryUsageSource2["UNKNOWN"] = "unknown";
|
|
12160
|
+
ETelemetryUsageSource2["PROVIDER_NORMALIZED"] = "provider_normalized";
|
|
12161
|
+
})(ETelemetryUsageSource || (ETelemetryUsageSource = {}));
|
|
12162
|
+
(function(ETelemetryAttemptVisibility2) {
|
|
12163
|
+
ETelemetryAttemptVisibility2["PROVIDER_INVOCATION"] = "provider_invocation";
|
|
12164
|
+
ETelemetryAttemptVisibility2["TOOL_PROVIDER_INVOCATION"] = "tool_provider_invocation";
|
|
12165
|
+
})(ETelemetryAttemptVisibility || (ETelemetryAttemptVisibility = {}));
|
|
12166
|
+
(function(ETelemetryLinkRelation2) {
|
|
12167
|
+
ETelemetryLinkRelation2["GENERATED_BY"] = "generated_by";
|
|
12168
|
+
ETelemetryLinkRelation2["SCHEDULED_BY"] = "scheduled_by";
|
|
12169
|
+
})(ETelemetryLinkRelation || (ETelemetryLinkRelation = {}));
|
|
12170
|
+
(function(ETelemetryToolFailureStage2) {
|
|
12171
|
+
ETelemetryToolFailureStage2["BEFORE_HOOK"] = "before_hook";
|
|
12172
|
+
ETelemetryToolFailureStage2["EXECUTION"] = "execution";
|
|
12173
|
+
ETelemetryToolFailureStage2["AFTER_HOOK"] = "after_hook";
|
|
12174
|
+
})(ETelemetryToolFailureStage || (ETelemetryToolFailureStage = {}));
|
|
12175
|
+
(function(ETelemetryTerminalEvidence2) {
|
|
12176
|
+
ETelemetryTerminalEvidence2["EXPLICIT_DONE_HISTORY_COMMITTED"] = "explicit_done_history_committed";
|
|
12177
|
+
ETelemetryTerminalEvidence2["EXPLICIT_DONE"] = "explicit_done";
|
|
12178
|
+
ETelemetryTerminalEvidence2["STREAM_ERROR"] = "stream_error";
|
|
12179
|
+
ETelemetryTerminalEvidence2["CONSUMER_CANCEL"] = "consumer_cancel";
|
|
12180
|
+
ETelemetryTerminalEvidence2["NATURAL_EXHAUSTION"] = "natural_exhaustion";
|
|
12181
|
+
})(ETelemetryTerminalEvidence || (ETelemetryTerminalEvidence = {}));
|
|
12182
|
+
(function(ETelemetryTerminalSource2) {
|
|
12183
|
+
ETelemetryTerminalSource2["NATIVE_AGENT_END"] = "native_agent_end";
|
|
12184
|
+
ETelemetryTerminalSource2["PROMPT_RESOLVED_FALLBACK"] = "prompt_resolved_fallback";
|
|
12185
|
+
})(ETelemetryTerminalSource || (ETelemetryTerminalSource = {}));
|
|
12186
|
+
(function(ETelemetryModelPurpose2) {
|
|
12187
|
+
ETelemetryModelPurpose2["AGENT_LOOP"] = "agent_loop";
|
|
12188
|
+
})(ETelemetryModelPurpose || (ETelemetryModelPurpose = {}));
|
|
12189
|
+
(function(ETelemetryErrorType2) {
|
|
12190
|
+
ETelemetryErrorType2["PROVIDER_STREAM_ERROR"] = "ProviderStreamError";
|
|
12191
|
+
ETelemetryErrorType2["TOOL_EXECUTION_ERROR"] = "ToolExecutionError";
|
|
12192
|
+
ETelemetryErrorType2["HOOK_DISPATCH_ERROR"] = "HookDispatchError";
|
|
12193
|
+
ETelemetryErrorType2["HOOK_DRAIN_ERROR"] = "HookDrainError";
|
|
12194
|
+
})(ETelemetryErrorType || (ETelemetryErrorType = {}));
|
|
12195
|
+
(function(ETelemetrySpanKind2) {
|
|
12196
|
+
ETelemetrySpanKind2["INTERNAL"] = "internal";
|
|
12197
|
+
ETelemetrySpanKind2["CLIENT"] = "client";
|
|
12198
|
+
})(ETelemetrySpanKind || (ETelemetrySpanKind = {}));
|
|
12199
|
+
(function(ETelemetryGenAiOperation2) {
|
|
12200
|
+
ETelemetryGenAiOperation2["CHAT"] = "chat";
|
|
12201
|
+
ETelemetryGenAiOperation2["EXECUTE_TOOL"] = "execute_tool";
|
|
12202
|
+
ETelemetryGenAiOperation2["INVOKE_AGENT"] = "invoke_agent";
|
|
12203
|
+
})(ETelemetryGenAiOperation || (ETelemetryGenAiOperation = {}));
|
|
12204
|
+
(function(ETelemetryVersion2) {
|
|
12205
|
+
ETelemetryVersion2["V0_2"] = "0.2";
|
|
12206
|
+
ETelemetryVersion2["V1_0"] = "1.0";
|
|
12207
|
+
})(ETelemetryVersion || (ETelemetryVersion = {}));
|
|
12208
|
+
}
|
|
12209
|
+
});
|
|
12210
|
+
|
|
12211
|
+
// ../linkque-agent-protocol/dist/esm/telemetry.js
|
|
12212
|
+
var init_telemetry = __esm({
|
|
12213
|
+
"../linkque-agent-protocol/dist/esm/telemetry.js"() {
|
|
12214
|
+
"use strict";
|
|
12215
|
+
init_telemetryEnums();
|
|
12216
|
+
}
|
|
12217
|
+
});
|
|
12218
|
+
|
|
12219
|
+
// ../linkque-agent-runtime/dist/esm/core/telemetry/contentRecording.js
|
|
12220
|
+
function recordContentSection(observation, section, value, availability = "available") {
|
|
12221
|
+
observation?.record(ETelemetryEventName.CONTENT_RECORDED, {}, { section, value, availability });
|
|
12222
|
+
}
|
|
12223
|
+
function recordMcpContentSection(observation, section, value, schema) {
|
|
12224
|
+
if (!observation)
|
|
12225
|
+
return;
|
|
12226
|
+
const fieldTitles = {};
|
|
12227
|
+
const visit = (node, path9) => {
|
|
12228
|
+
if (!node || typeof node !== "object" || Array.isArray(node))
|
|
12229
|
+
return;
|
|
12230
|
+
const definition = node;
|
|
12231
|
+
if (path9 && typeof definition.title === "string" && definition.title.trim())
|
|
12232
|
+
fieldTitles[path9] = definition.title;
|
|
12233
|
+
const properties = definition.properties;
|
|
12234
|
+
if (properties && typeof properties === "object" && !Array.isArray(properties)) {
|
|
12235
|
+
for (const [key, child] of Object.entries(properties))
|
|
12236
|
+
visit(child, `${path9}/${key.replaceAll("~", "~0").replaceAll("/", "~1")}`);
|
|
12237
|
+
}
|
|
12238
|
+
if (definition.items)
|
|
12239
|
+
visit(definition.items, `${path9}/*`);
|
|
12240
|
+
};
|
|
12241
|
+
visit(schema, section === ETelemetryContentSection.MCP_OUTPUT ? "/structuredContent" : "");
|
|
12242
|
+
observation.record(ETelemetryEventName.CONTENT_RECORDED, {}, {
|
|
12243
|
+
section,
|
|
12244
|
+
value,
|
|
12245
|
+
availability: "available",
|
|
12246
|
+
...Object.keys(fieldTitles).length ? { fieldTitles } : {}
|
|
12247
|
+
});
|
|
12248
|
+
}
|
|
12249
|
+
var init_contentRecording = __esm({
|
|
12250
|
+
"../linkque-agent-runtime/dist/esm/core/telemetry/contentRecording.js"() {
|
|
12251
|
+
"use strict";
|
|
12252
|
+
init_telemetry();
|
|
12253
|
+
}
|
|
12254
|
+
});
|
|
12255
|
+
|
|
11891
12256
|
// ../linkque-agent-runtime/dist/esm/core/mcpProxyTool.js
|
|
11892
12257
|
function resourceIdsForTool(spec, toolName) {
|
|
11893
12258
|
if (!spec.allToolResourceIds && !spec.resourceIdsByTool)
|
|
@@ -11957,6 +12322,8 @@ var MCP_PROXY_TOOL_NAME, McpProxyTool, MCP_BATCH_SEARCH_MAX_ITEMS, MCP_PROXY_DES
|
|
|
11957
12322
|
var init_mcpProxyTool = __esm({
|
|
11958
12323
|
"../linkque-agent-runtime/dist/esm/core/mcpProxyTool.js"() {
|
|
11959
12324
|
"use strict";
|
|
12325
|
+
init_telemetry();
|
|
12326
|
+
init_contentRecording();
|
|
11960
12327
|
init_esm();
|
|
11961
12328
|
init_types();
|
|
11962
12329
|
MCP_PROXY_TOOL_NAME = "mcp";
|
|
@@ -12114,25 +12481,35 @@ var init_mcpProxyTool = __esm({
|
|
|
12114
12481
|
async dispatch(args, signal, context2) {
|
|
12115
12482
|
const params = parseProxyArgs(args);
|
|
12116
12483
|
if (params.connect !== void 0) {
|
|
12117
|
-
return this.executeConnect(params.connect, signal);
|
|
12484
|
+
return this.executeConnect(params.connect, signal, context2);
|
|
12118
12485
|
}
|
|
12119
12486
|
if (params.describe !== void 0) {
|
|
12120
|
-
return this.executeDescribe(params.describe, params.server, signal);
|
|
12487
|
+
return this.executeDescribe(params.describe, params.server, signal, context2);
|
|
12121
12488
|
}
|
|
12122
12489
|
if (params.searches !== void 0) {
|
|
12123
|
-
return this.executeBatchSearch(params.searches, params.server);
|
|
12490
|
+
return this.executeBatchSearch(params.searches, params.server, context2);
|
|
12124
12491
|
}
|
|
12125
12492
|
if (params.search !== void 0) {
|
|
12126
|
-
|
|
12493
|
+
const result = await this.executeSearch(params.search, params.server);
|
|
12494
|
+
this.recordAction(context2, "search", result.tools.length ? "matched" : "no_hits", { query: result.query, tools: result.tools });
|
|
12495
|
+
return result.text;
|
|
12127
12496
|
}
|
|
12128
12497
|
if (params.tool !== void 0) {
|
|
12129
12498
|
return this.executeCall(params.tool, params.args, params.server, signal, context2);
|
|
12130
12499
|
}
|
|
12131
12500
|
if (params.server !== void 0) {
|
|
12132
|
-
return this.executeList(params.server, signal);
|
|
12501
|
+
return this.executeList(params.server, signal, context2);
|
|
12133
12502
|
}
|
|
12134
12503
|
return this.executeStatus();
|
|
12135
12504
|
}
|
|
12505
|
+
/** 保留代理动作事实,不改变供模型消费的原始返回值。 */
|
|
12506
|
+
recordAction(context2, action, status, data = {}) {
|
|
12507
|
+
recordContentSection(context2?.observation, ETelemetryContentSection.MCP_ACTION_OUTPUT, {
|
|
12508
|
+
action,
|
|
12509
|
+
status,
|
|
12510
|
+
...data
|
|
12511
|
+
});
|
|
12512
|
+
}
|
|
12136
12513
|
/** `mcp({})` / `mcp({ status: true })`:列各 server 连接状态 + 工具数。 */
|
|
12137
12514
|
executeStatus() {
|
|
12138
12515
|
const lines = [];
|
|
@@ -12160,35 +12537,43 @@ var init_mcpProxyTool = __esm({
|
|
|
12160
12537
|
${lines.join("\n")}${hint}`.trim();
|
|
12161
12538
|
}
|
|
12162
12539
|
/** `mcp({ connect: "server" })`:显式连接并刷元数据,返回该 server 工具列表。 */
|
|
12163
|
-
async executeConnect(server, signal) {
|
|
12540
|
+
async executeConnect(server, signal, context2) {
|
|
12164
12541
|
const spec = this.findSpec(server);
|
|
12165
|
-
if (!spec)
|
|
12542
|
+
if (!spec) {
|
|
12543
|
+
this.recordAction(context2, "connect", "not_found", { server });
|
|
12166
12544
|
return `Server "${server}" not found. Use mcp({}) to see available servers.`;
|
|
12545
|
+
}
|
|
12167
12546
|
this.entries.delete(spec.serverName);
|
|
12168
12547
|
const entry = await this.ensureEntry(spec.serverName, signal);
|
|
12169
12548
|
if (!entry) {
|
|
12549
|
+
this.recordAction(context2, "connect", "failed", { server: spec.serverName });
|
|
12170
12550
|
const failed = this.entries.get(spec.serverName);
|
|
12171
12551
|
const detail = failed?.error ? `: ${failed.error}` : "";
|
|
12172
12552
|
return `Failed to connect to "${spec.serverName}"${detail}.`;
|
|
12173
12553
|
}
|
|
12554
|
+
this.recordAction(context2, "connect", "matched", { server: spec.serverName, tools: entry.tools.map((tool) => ({ name: tool.name, description: tool.description })) });
|
|
12174
12555
|
return this.formatToolList(spec.serverName, entry.tools);
|
|
12175
12556
|
}
|
|
12176
12557
|
/** `mcp({ server: "name" })`:列该 server 工具名 + 截断 description。 */
|
|
12177
|
-
async executeList(server, signal) {
|
|
12558
|
+
async executeList(server, signal, context2) {
|
|
12178
12559
|
const spec = this.findSpec(server);
|
|
12179
|
-
if (!spec)
|
|
12560
|
+
if (!spec) {
|
|
12561
|
+
this.recordAction(context2, "list", "not_found", { server });
|
|
12180
12562
|
return `Server "${server}" not found. Use mcp({}) to see available servers.`;
|
|
12563
|
+
}
|
|
12181
12564
|
const entry = await this.ensureEntry(spec.serverName, signal);
|
|
12182
12565
|
if (!entry) {
|
|
12566
|
+
this.recordAction(context2, "list", "failed", { server: spec.serverName });
|
|
12183
12567
|
return `Server "${spec.serverName}" is not connected. Use mcp({ connect: "${spec.serverName}" }) to retry.`;
|
|
12184
12568
|
}
|
|
12569
|
+
this.recordAction(context2, "list", "matched", { server: spec.serverName, tools: entry.tools.map((tool) => ({ name: tool.name, description: tool.description })) });
|
|
12185
12570
|
return this.formatToolList(spec.serverName, entry.tools);
|
|
12186
12571
|
}
|
|
12187
12572
|
/** `mcp({ search: "query" })`:空格分词 OR 子串匹配 name/description(跨所有 server)。 */
|
|
12188
12573
|
async executeSearch(query, serverHint) {
|
|
12189
12574
|
const terms = query.trim().split(/\s+/u).filter((t2) => t2.length > 0);
|
|
12190
12575
|
if (terms.length === 0)
|
|
12191
|
-
return "Search query cannot be empty.";
|
|
12576
|
+
return { query, text: "Search query cannot be empty.", tools: [] };
|
|
12192
12577
|
const pattern = new RegExp(terms.map(escapeRegExp).join("|"), "iu");
|
|
12193
12578
|
const specs = serverHint ? this.specsMatching(serverHint) : this.specs;
|
|
12194
12579
|
await Promise.all(specs.map((s2) => this.ensureEntry(s2.serverName)));
|
|
@@ -12203,8 +12588,9 @@ ${lines.join("\n")}${hint}`.trim();
|
|
|
12203
12588
|
}
|
|
12204
12589
|
}
|
|
12205
12590
|
}
|
|
12591
|
+
const tools = matches.map(({ server, tool }) => ({ server, name: tool.name, description: tool.description, inputSchema: tool.inputSchema }));
|
|
12206
12592
|
if (matches.length === 0) {
|
|
12207
|
-
return serverHint ? `No tools matching "${query}" in "${serverHint}"` : `No tools matching "${query}"
|
|
12593
|
+
return { query, tools, text: serverHint ? `No tools matching "${query}" in "${serverHint}"` : `No tools matching "${query}"` };
|
|
12208
12594
|
}
|
|
12209
12595
|
const lines = [`Found ${matches.length} tool(s) matching "${query}":`, ""];
|
|
12210
12596
|
for (const { server, tool } of matches) {
|
|
@@ -12216,10 +12602,10 @@ ${formatSchema(tool.inputSchema, " ")}`);
|
|
|
12216
12602
|
}
|
|
12217
12603
|
lines.push("");
|
|
12218
12604
|
}
|
|
12219
|
-
return lines.join("\n").trim();
|
|
12605
|
+
return { query, tools, text: lines.join("\n").trim() };
|
|
12220
12606
|
}
|
|
12221
12607
|
/** `mcp({ searches: [...] })`:一次连接元数据并按 query 分组执行多组搜索。 */
|
|
12222
|
-
async executeBatchSearch(queries, serverHint) {
|
|
12608
|
+
async executeBatchSearch(queries, serverHint, context2) {
|
|
12223
12609
|
const normalized = [
|
|
12224
12610
|
...new Set(queries.map((query) => query.trim()).filter(Boolean))
|
|
12225
12611
|
].slice(0, MCP_BATCH_SEARCH_MAX_ITEMS);
|
|
@@ -12229,16 +12615,19 @@ ${formatSchema(tool.inputSchema, " ")}`);
|
|
|
12229
12615
|
const specs = serverHint ? this.specsMatching(serverHint) : this.specs;
|
|
12230
12616
|
await Promise.all(specs.map((spec) => this.ensureEntry(spec.serverName)));
|
|
12231
12617
|
const results = await Promise.all(normalized.map((query) => this.executeSearch(query, serverHint)));
|
|
12618
|
+
this.recordAction(context2, "search", results.some((result) => result.tools.length) ? "matched" : "no_hits", { results: results.map(({ query, tools }) => ({ query, tools })) });
|
|
12232
12619
|
return results.map((result, index2) => `Query ${index2 + 1}: "${normalized[index2]}"
|
|
12233
|
-
${result}`).join("\n\n");
|
|
12620
|
+
${result.text}`).join("\n\n");
|
|
12234
12621
|
}
|
|
12235
12622
|
/** `mcp({ describe: "tool" })`:输出工具所属 server + 参数 schema。 */
|
|
12236
|
-
async executeDescribe(toolName, serverHint, signal) {
|
|
12623
|
+
async executeDescribe(toolName, serverHint, signal, context2) {
|
|
12237
12624
|
const found = await this.findTool(toolName, serverHint, signal);
|
|
12238
12625
|
if (!found) {
|
|
12626
|
+
this.recordAction(context2, "describe", "not_found", { name: toolName });
|
|
12239
12627
|
return `Tool "${toolName}" not found. Use mcp({ search: "..." }) to search.`;
|
|
12240
12628
|
}
|
|
12241
12629
|
const { server, tool } = found;
|
|
12630
|
+
this.recordAction(context2, "describe", "matched", { server, name: tool.name, inputSchema: tool.inputSchema });
|
|
12242
12631
|
const lines = [
|
|
12243
12632
|
`${tool.name}`,
|
|
12244
12633
|
`Server: ${server}`,
|
|
@@ -12257,6 +12646,7 @@ ${formatSchema(tool.inputSchema)}`);
|
|
|
12257
12646
|
async executeCall(toolName, args, serverHint, signal, context2) {
|
|
12258
12647
|
const found = await this.findTool(toolName, serverHint, signal);
|
|
12259
12648
|
if (!found) {
|
|
12649
|
+
this.recordAction(context2, "call", "not_found", { name: toolName });
|
|
12260
12650
|
return `Tool "${toolName}" not found. Use mcp({ search: "..." }) to search.`;
|
|
12261
12651
|
}
|
|
12262
12652
|
const { entry, tool, spec } = found;
|
|
@@ -12275,8 +12665,10 @@ ${formatSchema(tool.inputSchema)}`);
|
|
|
12275
12665
|
...headers ? { headers } : {},
|
|
12276
12666
|
...context2 ? { context: context2 } : {}
|
|
12277
12667
|
});
|
|
12668
|
+
this.recordAction(context2, "call", result && typeof result === "object" && "isError" in result && result.isError === true ? "failed" : "completed", { name: tool.name, server: spec.serverName });
|
|
12278
12669
|
return serializeToolResult(result);
|
|
12279
12670
|
} catch (error40) {
|
|
12671
|
+
this.recordAction(context2, "call", signal?.aborted ? "cancelled" : "failed", { name: tool.name, server: spec.serverName });
|
|
12280
12672
|
const message = error40 instanceof Error ? error40.message : String(error40);
|
|
12281
12673
|
return `Tool "${toolName}" call failed: ${message}`;
|
|
12282
12674
|
}
|
|
@@ -12636,330 +13028,6 @@ var init_hookRegistry = __esm({
|
|
|
12636
13028
|
}
|
|
12637
13029
|
});
|
|
12638
13030
|
|
|
12639
|
-
// ../linkque-agent-protocol/dist/esm/telemetry/telemetryEnums.js
|
|
12640
|
-
var ETelemetryAttribute, ETelemetryEventPrefix, ETelemetryEventPhase, ETelemetryEventName, ETelemetryContentSection, ETelemetryOperationName, ETelemetryOutcome, ETelemetrySignal, ETelemetryLossReason, ETelemetryAdvanceOutcome, ETelemetryStreamTermination, ETelemetryCancelSource, ETelemetryObservationBoundary, ETelemetryRemoteCompletion, ETelemetryCommitStatus, ETelemetryHookMode, ETelemetryHookResult, ETelemetrySource, ETelemetryEvidence, ETelemetryCompleteness, ETelemetryCoverage, ETelemetryUsageSource, ETelemetryAttemptVisibility, ETelemetryLinkRelation, ETelemetryToolFailureStage, ETelemetryTerminalEvidence, ETelemetryTerminalSource, ETelemetryModelPurpose, ETelemetryErrorType, ETelemetrySpanKind, ETelemetryGenAiOperation, ETelemetryVersion;
|
|
12641
|
-
var init_telemetryEnums = __esm({
|
|
12642
|
-
"../linkque-agent-protocol/dist/esm/telemetry/telemetryEnums.js"() {
|
|
12643
|
-
"use strict";
|
|
12644
|
-
(function(ETelemetryAttribute2) {
|
|
12645
|
-
ETelemetryAttribute2["HARNESS_TELEMETRY_SCHEMA_VERSION"] = "harness.telemetry.schema.version";
|
|
12646
|
-
ETelemetryAttribute2["LINKQUE_TELEMETRY_SCHEMA_VERSION"] = "linkque.telemetry.schema.version";
|
|
12647
|
-
ETelemetryAttribute2["LINKQUE_TELEMETRY_ADAPTER_VERSION"] = "linkque.telemetry.adapter.version";
|
|
12648
|
-
ETelemetryAttribute2["HARNESS_TELEMETRY_SOURCE"] = "harness.telemetry.source";
|
|
12649
|
-
ETelemetryAttribute2["HARNESS_TELEMETRY_EVIDENCE"] = "harness.telemetry.evidence";
|
|
12650
|
-
ETelemetryAttribute2["HARNESS_TELEMETRY_COMPLETENESS"] = "harness.telemetry.completeness";
|
|
12651
|
-
ETelemetryAttribute2["LINKQUE_RUNTIME_KIND"] = "linkque.runtime.kind";
|
|
12652
|
-
ETelemetryAttribute2["LINKQUE_RUN_ID"] = "linkque.run.id";
|
|
12653
|
-
ETelemetryAttribute2["LINKQUE_AGENT_ID"] = "linkque.agent.id";
|
|
12654
|
-
ETelemetryAttribute2["HARNESS_SESSION_ID"] = "harness.session.id";
|
|
12655
|
-
ETelemetryAttribute2["LINKQUE_CONVERSATION_ID"] = "linkque.conversation.id";
|
|
12656
|
-
ETelemetryAttribute2["LINKQUE_REQUEST_ID"] = "linkque.request.id";
|
|
12657
|
-
ETelemetryAttribute2["LINKQUE_TURN_ID"] = "linkque.turn.id";
|
|
12658
|
-
ETelemetryAttribute2["LINKQUE_ACCOUNT_ID"] = "linkque.account.id";
|
|
12659
|
-
ETelemetryAttribute2["LINKQUE_CHANNEL"] = "linkque.channel";
|
|
12660
|
-
ETelemetryAttribute2["LINKQUE_USER_KEY"] = "linkque.user.key";
|
|
12661
|
-
ETelemetryAttribute2["HARNESS_ADVANCE_ID"] = "harness.advance.id";
|
|
12662
|
-
ETelemetryAttribute2["HARNESS_CALL_ID"] = "harness.call.id";
|
|
12663
|
-
ETelemetryAttribute2["HARNESS_INVOCATION_ID"] = "harness.invocation.id";
|
|
12664
|
-
ETelemetryAttribute2["HARNESS_ATTEMPT_ID"] = "harness.attempt.id";
|
|
12665
|
-
ETelemetryAttribute2["HARNESS_ATTEMPT_VISIBILITY"] = "harness.attempt.visibility";
|
|
12666
|
-
ETelemetryAttribute2["HARNESS_ADVANCE_OUTCOME"] = "harness.advance.outcome";
|
|
12667
|
-
ETelemetryAttribute2["HARNESS_OPERATION_OUTCOME"] = "harness.operation.outcome";
|
|
12668
|
-
ETelemetryAttribute2["HARNESS_REMOTE_COMPLETION"] = "harness.remote.completion";
|
|
12669
|
-
ETelemetryAttribute2["HARNESS_STATE_COMMIT_STATUS"] = "harness.state.commit.status";
|
|
12670
|
-
ETelemetryAttribute2["LINKQUE_OPERATION_ID"] = "linkque.operation.id";
|
|
12671
|
-
ETelemetryAttribute2["LINKQUE_OPERATION_NAME"] = "linkque.operation.name";
|
|
12672
|
-
ETelemetryAttribute2["LINKQUE_OPERATION_PARENT_ID"] = "linkque.operation.parent_id";
|
|
12673
|
-
ETelemetryAttribute2["LINKQUE_SPAN_PARENT_ID"] = "linkque.span.parent_id";
|
|
12674
|
-
ETelemetryAttribute2["HARNESS_RECORD_ID"] = "harness.record.id";
|
|
12675
|
-
ETelemetryAttribute2["HARNESS_EVENT_SEQUENCE"] = "harness.event.sequence";
|
|
12676
|
-
ETelemetryAttribute2["ERROR_TYPE"] = "error.type";
|
|
12677
|
-
ETelemetryAttribute2["LINKQUE_STREAM_TERMINATION"] = "linkque.stream.termination";
|
|
12678
|
-
ETelemetryAttribute2["LINKQUE_STREAM_CANCEL_SOURCE"] = "linkque.stream.cancel_source";
|
|
12679
|
-
ETelemetryAttribute2["LINKQUE_TERMINAL_EVIDENCE"] = "linkque.terminal.evidence";
|
|
12680
|
-
ETelemetryAttribute2["LINKQUE_RUNTIME_CLEANUP_OUTCOME"] = "linkque.runtime.cleanup_outcome";
|
|
12681
|
-
ETelemetryAttribute2["LINKQUE_OBSERVATION_BOUNDARY"] = "linkque.observation.boundary";
|
|
12682
|
-
ETelemetryAttribute2["LINKQUE_LOOP_ITERATION_ID"] = "linkque.loop.iteration.id";
|
|
12683
|
-
ETelemetryAttribute2["LINKQUE_LOOP_ITERATION_INDEX"] = "linkque.loop.iteration.index";
|
|
12684
|
-
ETelemetryAttribute2["LINKQUE_STREAM_TERMINAL_SOURCE"] = "linkque.stream.terminal_source";
|
|
12685
|
-
ETelemetryAttribute2["LINKQUE_STREAM_PUBLIC_TEXT_DELTA_COUNT"] = "linkque.stream.public_text_delta_count";
|
|
12686
|
-
ETelemetryAttribute2["LINKQUE_STREAM_THINKING_DELTA_COUNT"] = "linkque.stream.thinking_delta_count";
|
|
12687
|
-
ETelemetryAttribute2["LINKQUE_MODEL_FIRST_CHUNK_MS"] = "linkque.model.first_chunk_ms";
|
|
12688
|
-
ETelemetryAttribute2["LINKQUE_MODEL_FIRST_TEXT_MS"] = "linkque.model.first_text_ms";
|
|
12689
|
-
ETelemetryAttribute2["LINKQUE_LOOP_FIRST_PUBLIC_TEXT_MS"] = "linkque.loop.first_public_text_ms";
|
|
12690
|
-
ETelemetryAttribute2["LINKQUE_MODEL_CHUNK_COUNT"] = "linkque.model.chunk_count";
|
|
12691
|
-
ETelemetryAttribute2["LINKQUE_MODEL_TEXT_CHARS"] = "linkque.model.text_chars";
|
|
12692
|
-
ETelemetryAttribute2["LINKQUE_MODEL_THINKING_CHARS"] = "linkque.model.thinking_chars";
|
|
12693
|
-
ETelemetryAttribute2["GEN_AI_OPERATION_NAME"] = "gen_ai.operation.name";
|
|
12694
|
-
ETelemetryAttribute2["GEN_AI_AGENT_NAME"] = "gen_ai.agent.name";
|
|
12695
|
-
ETelemetryAttribute2["GEN_AI_PROVIDER_NAME"] = "gen_ai.provider.name";
|
|
12696
|
-
ETelemetryAttribute2["GEN_AI_REQUEST_MODEL"] = "gen_ai.request.model";
|
|
12697
|
-
ETelemetryAttribute2["GEN_AI_RESPONSE_MODEL"] = "gen_ai.response.model";
|
|
12698
|
-
ETelemetryAttribute2["GEN_AI_RESPONSE_ID"] = "gen_ai.response.id";
|
|
12699
|
-
ETelemetryAttribute2["GEN_AI_RESPONSE_FINISH_REASONS"] = "gen_ai.response.finish_reasons";
|
|
12700
|
-
ETelemetryAttribute2["GEN_AI_USAGE_INPUT_TOKENS"] = "gen_ai.usage.input_tokens";
|
|
12701
|
-
ETelemetryAttribute2["GEN_AI_USAGE_OUTPUT_TOKENS"] = "gen_ai.usage.output_tokens";
|
|
12702
|
-
ETelemetryAttribute2["GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS"] = "gen_ai.usage.cache_read.input_tokens";
|
|
12703
|
-
ETelemetryAttribute2["GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS"] = "gen_ai.usage.cache_creation.input_tokens";
|
|
12704
|
-
ETelemetryAttribute2["GEN_AI_USAGE_REASONING_OUTPUT_TOKENS"] = "gen_ai.usage.reasoning.output_tokens";
|
|
12705
|
-
ETelemetryAttribute2["HARNESS_USAGE_SOURCE"] = "harness.usage.source";
|
|
12706
|
-
ETelemetryAttribute2["HARNESS_USAGE_ATTEMPT_COVERAGE"] = "harness.usage.attempt_coverage";
|
|
12707
|
-
ETelemetryAttribute2["HARNESS_MODEL_PURPOSE"] = "harness.model.purpose";
|
|
12708
|
-
ETelemetryAttribute2["HARNESS_MODEL_INVOCATION_COUNT"] = "harness.model.invocation_count";
|
|
12709
|
-
ETelemetryAttribute2["GEN_AI_TOOL_NAME"] = "gen_ai.tool.name";
|
|
12710
|
-
ETelemetryAttribute2["GEN_AI_TOOL_CALL_ID"] = "gen_ai.tool.call.id";
|
|
12711
|
-
ETelemetryAttribute2["HARNESS_TOOL_RESULT_STATUS"] = "harness.tool.result.status";
|
|
12712
|
-
ETelemetryAttribute2["LINKQUE_TOOL_FAILURE_STAGE"] = "linkque.tool.failure_stage";
|
|
12713
|
-
ETelemetryAttribute2["HARNESS_HOOK_NAME"] = "harness.hook.name";
|
|
12714
|
-
ETelemetryAttribute2["LINKQUE_HOOK_STAGE"] = "linkque.hook.stage";
|
|
12715
|
-
ETelemetryAttribute2["LINKQUE_HOOK_RESOURCE_ID"] = "linkque.hook.resource_id";
|
|
12716
|
-
ETelemetryAttribute2["LINKQUE_HOOK_EVENT_ID"] = "linkque.hook.event_id";
|
|
12717
|
-
ETelemetryAttribute2["LINKQUE_HOOK_MATCHED_COUNT"] = "linkque.hook.matched_count";
|
|
12718
|
-
ETelemetryAttribute2["LINKQUE_HOOK_PENDING_COUNT"] = "linkque.hook.pending_count";
|
|
12719
|
-
ETelemetryAttribute2["LINKQUE_HOOK_SCHEDULED_COUNT"] = "linkque.hook.scheduled_count";
|
|
12720
|
-
ETelemetryAttribute2["LINKQUE_HOOK_HAS_SIDE_EFFECTS"] = "linkque.hook.has_side_effects";
|
|
12721
|
-
ETelemetryAttribute2["LINKQUE_HOOK_MODE"] = "linkque.hook.mode";
|
|
12722
|
-
ETelemetryAttribute2["LINKQUE_HOOK_TIMEOUT_MS"] = "linkque.hook.timeout_ms";
|
|
12723
|
-
ETelemetryAttribute2["LINKQUE_HOOK_RESULT"] = "linkque.hook.result";
|
|
12724
|
-
ETelemetryAttribute2["HARNESS_MIDDLEWARE_NAME"] = "harness.middleware.name";
|
|
12725
|
-
ETelemetryAttribute2["HARNESS_MIDDLEWARE_INVOCATION_ID"] = "harness.middleware.invocation.id";
|
|
12726
|
-
ETelemetryAttribute2["LINKQUE_HOOK_EXECUTOR_SETTLED"] = "linkque.hook.executor_settled";
|
|
12727
|
-
ETelemetryAttribute2["LINKQUE_HISTORY_MESSAGE_COUNT"] = "linkque.history.message_count";
|
|
12728
|
-
ETelemetryAttribute2["LINKQUE_TELEMETRY_COVERAGE"] = "linkque.telemetry.coverage";
|
|
12729
|
-
ETelemetryAttribute2["LINKQUE_TELEMETRY_LOSS_REASON"] = "linkque.telemetry.loss_reason";
|
|
12730
|
-
ETelemetryAttribute2["LINKQUE_OPERATION_DURATION_MS"] = "linkque.operation.duration_ms";
|
|
12731
|
-
ETelemetryAttribute2["HTTP_RESPONSE_STATUS_CODE"] = "http.response.status_code";
|
|
12732
|
-
ETelemetryAttribute2["SERVICE_NAME"] = "service.name";
|
|
12733
|
-
ETelemetryAttribute2["SERVICE_NAMESPACE"] = "service.namespace";
|
|
12734
|
-
ETelemetryAttribute2["SERVICE_VERSION"] = "service.version";
|
|
12735
|
-
ETelemetryAttribute2["SERVICE_INSTANCE_ID"] = "service.instance.id";
|
|
12736
|
-
ETelemetryAttribute2["DEPLOYMENT_ENVIRONMENT_NAME"] = "deployment.environment.name";
|
|
12737
|
-
ETelemetryAttribute2["LINKQUE_LINK_RELATION"] = "linkque.link.relation";
|
|
12738
|
-
})(ETelemetryAttribute || (ETelemetryAttribute = {}));
|
|
12739
|
-
(function(ETelemetryEventPrefix2) {
|
|
12740
|
-
ETelemetryEventPrefix2["OPERATION"] = "linkque.operation";
|
|
12741
|
-
ETelemetryEventPrefix2["ADVANCE"] = "harness.advance";
|
|
12742
|
-
ETelemetryEventPrefix2["MODEL_INVOKE"] = "harness.model.invoke";
|
|
12743
|
-
ETelemetryEventPrefix2["MODEL_ATTEMPT"] = "harness.model.attempt";
|
|
12744
|
-
ETelemetryEventPrefix2["TOOL_INVOKE"] = "harness.tool.invoke";
|
|
12745
|
-
ETelemetryEventPrefix2["TOOL_ATTEMPT"] = "harness.tool.attempt";
|
|
12746
|
-
ETelemetryEventPrefix2["HOOK_CHAIN"] = "harness.hook.chain";
|
|
12747
|
-
ETelemetryEventPrefix2["MIDDLEWARE"] = "harness.middleware";
|
|
12748
|
-
ETelemetryEventPrefix2["LOOP"] = "linkque.loop";
|
|
12749
|
-
ETelemetryEventPrefix2["LOOP_ITERATION"] = "linkque.loop.iteration";
|
|
12750
|
-
ETelemetryEventPrefix2["HISTORY_APPEND"] = "linkque.history.append";
|
|
12751
|
-
ETelemetryEventPrefix2["HOOK_DRAIN"] = "linkque.hook.drain";
|
|
12752
|
-
})(ETelemetryEventPrefix || (ETelemetryEventPrefix = {}));
|
|
12753
|
-
(function(ETelemetryEventPhase2) {
|
|
12754
|
-
ETelemetryEventPhase2["STARTED"] = "started";
|
|
12755
|
-
ETelemetryEventPhase2["FINISHED"] = "finished";
|
|
12756
|
-
ETelemetryEventPhase2["OBSERVATION_LOST"] = "observation_lost";
|
|
12757
|
-
})(ETelemetryEventPhase || (ETelemetryEventPhase = {}));
|
|
12758
|
-
(function(ETelemetryEventName2) {
|
|
12759
|
-
ETelemetryEventName2["TOOL_EXECUTION_FAILED"] = "linkque.tool.execution.failed";
|
|
12760
|
-
ETelemetryEventName2["TELEMETRY_COVERAGE"] = "linkque.telemetry.coverage";
|
|
12761
|
-
ETelemetryEventName2["HOOK_MATCHED"] = "linkque.hook.matched";
|
|
12762
|
-
ETelemetryEventName2["HOOK_SCHEDULED"] = "linkque.hook.scheduled";
|
|
12763
|
-
ETelemetryEventName2["HOOK_CANCEL_REQUESTED"] = "linkque.hook.cancel_requested";
|
|
12764
|
-
ETelemetryEventName2["HOOK_TIMEOUT_REQUESTED"] = "linkque.hook.timeout_requested";
|
|
12765
|
-
ETelemetryEventName2["HOOK_EXECUTOR_SETTLED"] = "linkque.hook.executor_settled";
|
|
12766
|
-
ETelemetryEventName2["HOOK_WAIT_FINISHED"] = "linkque.hook.wait_finished";
|
|
12767
|
-
ETelemetryEventName2["LOOP_FIRST_PUBLIC_TEXT"] = "linkque.loop.first_public_text";
|
|
12768
|
-
ETelemetryEventName2["STREAM_TERMINAL_OBSERVED"] = "linkque.stream.terminal_observed";
|
|
12769
|
-
ETelemetryEventName2["MODEL_FIRST_CHUNK"] = "harness.model.first_chunk";
|
|
12770
|
-
ETelemetryEventName2["MODEL_FIRST_TEXT"] = "harness.model.first_text";
|
|
12771
|
-
ETelemetryEventName2["MODEL_USAGE_RECORDED"] = "linkque.model.usage.recorded";
|
|
12772
|
-
ETelemetryEventName2["MODEL_RESPONSE_HEADERS"] = "linkque.model.response_headers";
|
|
12773
|
-
ETelemetryEventName2["OPERATION_OBSERVATION_LOST"] = "linkque.operation.observation_lost";
|
|
12774
|
-
ETelemetryEventName2["RUNTIME_UNCAUGHT_ERROR"] = "linkque.runtime.uncaught_error";
|
|
12775
|
-
ETelemetryEventName2["OPERATION_STARTED"] = "linkque.operation.started";
|
|
12776
|
-
ETelemetryEventName2["OPERATION_FINISHED"] = "linkque.operation.finished";
|
|
12777
|
-
ETelemetryEventName2["ADVANCE_STARTED"] = "harness.advance.started";
|
|
12778
|
-
ETelemetryEventName2["ADVANCE_FINISHED"] = "harness.advance.finished";
|
|
12779
|
-
ETelemetryEventName2["MODEL_INVOKE_STARTED"] = "harness.model.invoke.started";
|
|
12780
|
-
ETelemetryEventName2["MODEL_INVOKE_FINISHED"] = "harness.model.invoke.finished";
|
|
12781
|
-
ETelemetryEventName2["MODEL_ATTEMPT_STARTED"] = "harness.model.attempt.started";
|
|
12782
|
-
ETelemetryEventName2["MODEL_ATTEMPT_FINISHED"] = "harness.model.attempt.finished";
|
|
12783
|
-
ETelemetryEventName2["TOOL_INVOKE_STARTED"] = "harness.tool.invoke.started";
|
|
12784
|
-
ETelemetryEventName2["TOOL_INVOKE_FINISHED"] = "harness.tool.invoke.finished";
|
|
12785
|
-
ETelemetryEventName2["TOOL_ATTEMPT_STARTED"] = "harness.tool.attempt.started";
|
|
12786
|
-
ETelemetryEventName2["TOOL_ATTEMPT_FINISHED"] = "harness.tool.attempt.finished";
|
|
12787
|
-
ETelemetryEventName2["HOOK_CHAIN_STARTED"] = "harness.hook.chain.started";
|
|
12788
|
-
ETelemetryEventName2["HOOK_CHAIN_FINISHED"] = "harness.hook.chain.finished";
|
|
12789
|
-
ETelemetryEventName2["MIDDLEWARE_STARTED"] = "harness.middleware.started";
|
|
12790
|
-
ETelemetryEventName2["MIDDLEWARE_FINISHED"] = "harness.middleware.finished";
|
|
12791
|
-
ETelemetryEventName2["LOOP_STARTED"] = "linkque.loop.started";
|
|
12792
|
-
ETelemetryEventName2["LOOP_FINISHED"] = "linkque.loop.finished";
|
|
12793
|
-
ETelemetryEventName2["LOOP_ITERATION_STARTED"] = "linkque.loop.iteration.started";
|
|
12794
|
-
ETelemetryEventName2["LOOP_ITERATION_FINISHED"] = "linkque.loop.iteration.finished";
|
|
12795
|
-
ETelemetryEventName2["HISTORY_APPEND_STARTED"] = "linkque.history.append.started";
|
|
12796
|
-
ETelemetryEventName2["HISTORY_APPEND_FINISHED"] = "linkque.history.append.finished";
|
|
12797
|
-
ETelemetryEventName2["HOOK_DRAIN_STARTED"] = "linkque.hook.drain.started";
|
|
12798
|
-
ETelemetryEventName2["HOOK_DRAIN_FINISHED"] = "linkque.hook.drain.finished";
|
|
12799
|
-
ETelemetryEventName2["DEBUG_CONTENT_RECORDED"] = "linkque.debug.content.recorded";
|
|
12800
|
-
})(ETelemetryEventName || (ETelemetryEventName = {}));
|
|
12801
|
-
(function(ETelemetryContentSection2) {
|
|
12802
|
-
ETelemetryContentSection2["QUERY_INPUT"] = "query.input";
|
|
12803
|
-
ETelemetryContentSection2["TOOL_INPUT"] = "tool.input";
|
|
12804
|
-
ETelemetryContentSection2["TOOL_OUTPUT"] = "tool.output";
|
|
12805
|
-
ETelemetryContentSection2["MCP_REQUESTED_INPUT"] = "mcp.requested_input";
|
|
12806
|
-
ETelemetryContentSection2["MCP_INPUT"] = "mcp.input";
|
|
12807
|
-
ETelemetryContentSection2["MCP_OUTPUT"] = "mcp.output";
|
|
12808
|
-
ETelemetryContentSection2["SKILL_INPUT"] = "skill.input";
|
|
12809
|
-
ETelemetryContentSection2["SKILL_OUTPUT"] = "skill.output";
|
|
12810
|
-
ETelemetryContentSection2["KNOWLEDGE_INPUT"] = "knowledge.input";
|
|
12811
|
-
ETelemetryContentSection2["KNOWLEDGE_OUTPUT"] = "knowledge.output";
|
|
12812
|
-
})(ETelemetryContentSection || (ETelemetryContentSection = {}));
|
|
12813
|
-
(function(ETelemetryOperationName2) {
|
|
12814
|
-
ETelemetryOperationName2["OPERATION"] = "linkque.operation";
|
|
12815
|
-
ETelemetryOperationName2["TOOL_INVOKE"] = "harness.tool.invoke";
|
|
12816
|
-
ETelemetryOperationName2["ADVANCE"] = "harness.advance";
|
|
12817
|
-
ETelemetryOperationName2["MODEL_INVOKE"] = "harness.model.invoke";
|
|
12818
|
-
ETelemetryOperationName2["MODEL_ATTEMPT"] = "harness.model.attempt";
|
|
12819
|
-
ETelemetryOperationName2["TOOL_ATTEMPT"] = "harness.tool.attempt";
|
|
12820
|
-
ETelemetryOperationName2["HOOK_CHAIN"] = "harness.hook.chain";
|
|
12821
|
-
ETelemetryOperationName2["MIDDLEWARE"] = "harness.middleware";
|
|
12822
|
-
ETelemetryOperationName2["LOOP"] = "linkque.agent.loop";
|
|
12823
|
-
ETelemetryOperationName2["ITERATION"] = "linkque.agent.iteration";
|
|
12824
|
-
ETelemetryOperationName2["SESSION_LOAD"] = "harness.session.load";
|
|
12825
|
-
ETelemetryOperationName2["HISTORY_APPEND"] = "linkque.history.append";
|
|
12826
|
-
ETelemetryOperationName2["CLEANUP"] = "linkque.runtime.cleanup";
|
|
12827
|
-
ETelemetryOperationName2["HOOK_DRAIN"] = "linkque.hook.drain";
|
|
12828
|
-
})(ETelemetryOperationName || (ETelemetryOperationName = {}));
|
|
12829
|
-
(function(ETelemetryOutcome2) {
|
|
12830
|
-
ETelemetryOutcome2["SUCCESS"] = "success";
|
|
12831
|
-
ETelemetryOutcome2["ERROR"] = "error";
|
|
12832
|
-
ETelemetryOutcome2["CANCELLED"] = "cancelled";
|
|
12833
|
-
ETelemetryOutcome2["TIMEOUT"] = "timeout";
|
|
12834
|
-
ETelemetryOutcome2["REJECTED"] = "rejected";
|
|
12835
|
-
ETelemetryOutcome2["UNKNOWN"] = "unknown";
|
|
12836
|
-
})(ETelemetryOutcome || (ETelemetryOutcome = {}));
|
|
12837
|
-
(function(ETelemetrySignal2) {
|
|
12838
|
-
ETelemetrySignal2["LOGS"] = "logs";
|
|
12839
|
-
ETelemetrySignal2["TRACES"] = "traces";
|
|
12840
|
-
})(ETelemetrySignal || (ETelemetrySignal = {}));
|
|
12841
|
-
(function(ETelemetryLossReason2) {
|
|
12842
|
-
ETelemetryLossReason2["UNCAUGHT_ERROR"] = "uncaught_error";
|
|
12843
|
-
ETelemetryLossReason2["ACTIVE_LIMIT"] = "active_limit";
|
|
12844
|
-
ETelemetryLossReason2["ACTIVE_EXPIRED"] = "active_expired";
|
|
12845
|
-
ETelemetryLossReason2["SHUTDOWN"] = "shutdown";
|
|
12846
|
-
})(ETelemetryLossReason || (ETelemetryLossReason = {}));
|
|
12847
|
-
(function(ETelemetryAdvanceOutcome2) {
|
|
12848
|
-
ETelemetryAdvanceOutcome2["FAILED"] = "failed";
|
|
12849
|
-
ETelemetryAdvanceOutcome2["COMPLETED"] = "completed";
|
|
12850
|
-
ETelemetryAdvanceOutcome2["UNKNOWN"] = "unknown";
|
|
12851
|
-
})(ETelemetryAdvanceOutcome || (ETelemetryAdvanceOutcome = {}));
|
|
12852
|
-
(function(ETelemetryStreamTermination2) {
|
|
12853
|
-
ETelemetryStreamTermination2["CANCEL"] = "cancel";
|
|
12854
|
-
ETelemetryStreamTermination2["ERROR"] = "error";
|
|
12855
|
-
ETelemetryStreamTermination2["COMPLETE"] = "complete";
|
|
12856
|
-
ETelemetryStreamTermination2["EXHAUSTED"] = "exhausted";
|
|
12857
|
-
})(ETelemetryStreamTermination || (ETelemetryStreamTermination = {}));
|
|
12858
|
-
(function(ETelemetryCancelSource2) {
|
|
12859
|
-
ETelemetryCancelSource2["HOST_SIGNAL"] = "host_signal";
|
|
12860
|
-
ETelemetryCancelSource2["CONSUMER_RETURN"] = "consumer_return";
|
|
12861
|
-
})(ETelemetryCancelSource || (ETelemetryCancelSource = {}));
|
|
12862
|
-
(function(ETelemetryObservationBoundary2) {
|
|
12863
|
-
ETelemetryObservationBoundary2["LOCAL_WAIT"] = "local_wait";
|
|
12864
|
-
ETelemetryObservationBoundary2["EXECUTOR_SETTLED"] = "executor_settled";
|
|
12865
|
-
ETelemetryObservationBoundary2["GENERATOR_WITH_SETUP_AND_CLEANUP"] = "generator_with_setup_and_cleanup";
|
|
12866
|
-
})(ETelemetryObservationBoundary || (ETelemetryObservationBoundary = {}));
|
|
12867
|
-
(function(ETelemetryRemoteCompletion2) {
|
|
12868
|
-
ETelemetryRemoteCompletion2["UNKNOWN"] = "unknown";
|
|
12869
|
-
ETelemetryRemoteCompletion2["NOT_DISPATCHED"] = "not_dispatched";
|
|
12870
|
-
ETelemetryRemoteCompletion2["CONFIRMED"] = "confirmed";
|
|
12871
|
-
})(ETelemetryRemoteCompletion || (ETelemetryRemoteCompletion = {}));
|
|
12872
|
-
(function(ETelemetryCommitStatus2) {
|
|
12873
|
-
ETelemetryCommitStatus2["COMMITTED"] = "committed";
|
|
12874
|
-
ETelemetryCommitStatus2["FAILED"] = "failed";
|
|
12875
|
-
})(ETelemetryCommitStatus || (ETelemetryCommitStatus = {}));
|
|
12876
|
-
(function(ETelemetryHookMode2) {
|
|
12877
|
-
ETelemetryHookMode2["AWAITED"] = "awaited";
|
|
12878
|
-
ETelemetryHookMode2["DETACHED"] = "detached";
|
|
12879
|
-
})(ETelemetryHookMode || (ETelemetryHookMode = {}));
|
|
12880
|
-
(function(ETelemetryHookResult2) {
|
|
12881
|
-
ETelemetryHookResult2["OK"] = "ok";
|
|
12882
|
-
ETelemetryHookResult2["TIMEOUT"] = "timeout";
|
|
12883
|
-
ETelemetryHookResult2["SKIPPED"] = "skipped";
|
|
12884
|
-
ETelemetryHookResult2["SUCCESS"] = "success";
|
|
12885
|
-
ETelemetryHookResult2["ERROR"] = "error";
|
|
12886
|
-
})(ETelemetryHookResult || (ETelemetryHookResult = {}));
|
|
12887
|
-
(function(ETelemetrySource2) {
|
|
12888
|
-
ETelemetrySource2["KERNEL"] = "kernel";
|
|
12889
|
-
ETelemetrySource2["PROVIDER"] = "provider";
|
|
12890
|
-
})(ETelemetrySource || (ETelemetrySource = {}));
|
|
12891
|
-
(function(ETelemetryEvidence2) {
|
|
12892
|
-
ETelemetryEvidence2["OBSERVED"] = "observed";
|
|
12893
|
-
})(ETelemetryEvidence || (ETelemetryEvidence = {}));
|
|
12894
|
-
(function(ETelemetryCompleteness2) {
|
|
12895
|
-
ETelemetryCompleteness2["COMPLETE"] = "complete";
|
|
12896
|
-
ETelemetryCompleteness2["PARTIAL"] = "partial";
|
|
12897
|
-
})(ETelemetryCompleteness || (ETelemetryCompleteness = {}));
|
|
12898
|
-
(function(ETelemetryCoverage2) {
|
|
12899
|
-
ETelemetryCoverage2["PI_MODEL_TOOL_HOOK"] = "pi_model_tool_hook";
|
|
12900
|
-
ETelemetryCoverage2["CORE_ONLY"] = "core_only";
|
|
12901
|
-
})(ETelemetryCoverage || (ETelemetryCoverage = {}));
|
|
12902
|
-
(function(ETelemetryUsageSource2) {
|
|
12903
|
-
ETelemetryUsageSource2["UNKNOWN"] = "unknown";
|
|
12904
|
-
ETelemetryUsageSource2["PROVIDER_NORMALIZED"] = "provider_normalized";
|
|
12905
|
-
})(ETelemetryUsageSource || (ETelemetryUsageSource = {}));
|
|
12906
|
-
(function(ETelemetryAttemptVisibility2) {
|
|
12907
|
-
ETelemetryAttemptVisibility2["PROVIDER_INVOCATION"] = "provider_invocation";
|
|
12908
|
-
ETelemetryAttemptVisibility2["TOOL_PROVIDER_INVOCATION"] = "tool_provider_invocation";
|
|
12909
|
-
})(ETelemetryAttemptVisibility || (ETelemetryAttemptVisibility = {}));
|
|
12910
|
-
(function(ETelemetryLinkRelation2) {
|
|
12911
|
-
ETelemetryLinkRelation2["GENERATED_BY"] = "generated_by";
|
|
12912
|
-
ETelemetryLinkRelation2["SCHEDULED_BY"] = "scheduled_by";
|
|
12913
|
-
})(ETelemetryLinkRelation || (ETelemetryLinkRelation = {}));
|
|
12914
|
-
(function(ETelemetryToolFailureStage2) {
|
|
12915
|
-
ETelemetryToolFailureStage2["BEFORE_HOOK"] = "before_hook";
|
|
12916
|
-
ETelemetryToolFailureStage2["EXECUTION"] = "execution";
|
|
12917
|
-
ETelemetryToolFailureStage2["AFTER_HOOK"] = "after_hook";
|
|
12918
|
-
})(ETelemetryToolFailureStage || (ETelemetryToolFailureStage = {}));
|
|
12919
|
-
(function(ETelemetryTerminalEvidence2) {
|
|
12920
|
-
ETelemetryTerminalEvidence2["EXPLICIT_DONE_HISTORY_COMMITTED"] = "explicit_done_history_committed";
|
|
12921
|
-
ETelemetryTerminalEvidence2["EXPLICIT_DONE"] = "explicit_done";
|
|
12922
|
-
ETelemetryTerminalEvidence2["STREAM_ERROR"] = "stream_error";
|
|
12923
|
-
ETelemetryTerminalEvidence2["CONSUMER_CANCEL"] = "consumer_cancel";
|
|
12924
|
-
ETelemetryTerminalEvidence2["NATURAL_EXHAUSTION"] = "natural_exhaustion";
|
|
12925
|
-
})(ETelemetryTerminalEvidence || (ETelemetryTerminalEvidence = {}));
|
|
12926
|
-
(function(ETelemetryTerminalSource2) {
|
|
12927
|
-
ETelemetryTerminalSource2["NATIVE_AGENT_END"] = "native_agent_end";
|
|
12928
|
-
ETelemetryTerminalSource2["PROMPT_RESOLVED_FALLBACK"] = "prompt_resolved_fallback";
|
|
12929
|
-
})(ETelemetryTerminalSource || (ETelemetryTerminalSource = {}));
|
|
12930
|
-
(function(ETelemetryModelPurpose2) {
|
|
12931
|
-
ETelemetryModelPurpose2["AGENT_LOOP"] = "agent_loop";
|
|
12932
|
-
})(ETelemetryModelPurpose || (ETelemetryModelPurpose = {}));
|
|
12933
|
-
(function(ETelemetryErrorType2) {
|
|
12934
|
-
ETelemetryErrorType2["PROVIDER_STREAM_ERROR"] = "ProviderStreamError";
|
|
12935
|
-
ETelemetryErrorType2["TOOL_EXECUTION_ERROR"] = "ToolExecutionError";
|
|
12936
|
-
ETelemetryErrorType2["HOOK_DISPATCH_ERROR"] = "HookDispatchError";
|
|
12937
|
-
ETelemetryErrorType2["HOOK_DRAIN_ERROR"] = "HookDrainError";
|
|
12938
|
-
})(ETelemetryErrorType || (ETelemetryErrorType = {}));
|
|
12939
|
-
(function(ETelemetrySpanKind2) {
|
|
12940
|
-
ETelemetrySpanKind2["INTERNAL"] = "internal";
|
|
12941
|
-
ETelemetrySpanKind2["CLIENT"] = "client";
|
|
12942
|
-
})(ETelemetrySpanKind || (ETelemetrySpanKind = {}));
|
|
12943
|
-
(function(ETelemetryGenAiOperation2) {
|
|
12944
|
-
ETelemetryGenAiOperation2["CHAT"] = "chat";
|
|
12945
|
-
ETelemetryGenAiOperation2["EXECUTE_TOOL"] = "execute_tool";
|
|
12946
|
-
ETelemetryGenAiOperation2["INVOKE_AGENT"] = "invoke_agent";
|
|
12947
|
-
})(ETelemetryGenAiOperation || (ETelemetryGenAiOperation = {}));
|
|
12948
|
-
(function(ETelemetryVersion2) {
|
|
12949
|
-
ETelemetryVersion2["V0_2"] = "0.2";
|
|
12950
|
-
ETelemetryVersion2["V1_0"] = "1.0";
|
|
12951
|
-
})(ETelemetryVersion || (ETelemetryVersion = {}));
|
|
12952
|
-
}
|
|
12953
|
-
});
|
|
12954
|
-
|
|
12955
|
-
// ../linkque-agent-protocol/dist/esm/telemetry.js
|
|
12956
|
-
var init_telemetry = __esm({
|
|
12957
|
-
"../linkque-agent-protocol/dist/esm/telemetry.js"() {
|
|
12958
|
-
"use strict";
|
|
12959
|
-
init_telemetryEnums();
|
|
12960
|
-
}
|
|
12961
|
-
});
|
|
12962
|
-
|
|
12963
13031
|
// ../linkque-agent-runtime/dist/esm/core/logFailure.js
|
|
12964
13032
|
function warnLogFailure(stage, error40) {
|
|
12965
13033
|
(0, import_node_process.emitWarning)(`[${stage}] errorType=${error40 instanceof Error ? error40.name : typeof error40}`, { code: "LINKQUE_RUNTIME_DIAGNOSTIC_FAILURE" });
|
|
@@ -14207,43 +14275,6 @@ var init_linkquegwEventHookExecutor = __esm({
|
|
|
14207
14275
|
}
|
|
14208
14276
|
});
|
|
14209
14277
|
|
|
14210
|
-
// ../linkque-agent-runtime/dist/esm/core/telemetry/contentRecording.js
|
|
14211
|
-
function recordContentSection(observation, section, value, availability = "available") {
|
|
14212
|
-
observation?.record(ETelemetryEventName.DEBUG_CONTENT_RECORDED, {}, { section, value, availability });
|
|
14213
|
-
}
|
|
14214
|
-
function recordMcpContentSection(observation, section, value, schema) {
|
|
14215
|
-
if (!observation)
|
|
14216
|
-
return;
|
|
14217
|
-
const fieldTitles = {};
|
|
14218
|
-
const visit = (node, path9) => {
|
|
14219
|
-
if (!node || typeof node !== "object" || Array.isArray(node))
|
|
14220
|
-
return;
|
|
14221
|
-
const definition = node;
|
|
14222
|
-
if (path9 && typeof definition.title === "string" && definition.title.trim())
|
|
14223
|
-
fieldTitles[path9] = definition.title;
|
|
14224
|
-
const properties = definition.properties;
|
|
14225
|
-
if (properties && typeof properties === "object" && !Array.isArray(properties)) {
|
|
14226
|
-
for (const [key, child] of Object.entries(properties))
|
|
14227
|
-
visit(child, `${path9}/${key.replaceAll("~", "~0").replaceAll("/", "~1")}`);
|
|
14228
|
-
}
|
|
14229
|
-
if (definition.items)
|
|
14230
|
-
visit(definition.items, `${path9}/*`);
|
|
14231
|
-
};
|
|
14232
|
-
visit(schema, section === ETelemetryContentSection.MCP_OUTPUT ? "/structuredContent" : "");
|
|
14233
|
-
observation.record(ETelemetryEventName.DEBUG_CONTENT_RECORDED, {}, {
|
|
14234
|
-
section,
|
|
14235
|
-
value,
|
|
14236
|
-
availability: "available",
|
|
14237
|
-
...Object.keys(fieldTitles).length ? { fieldTitles } : {}
|
|
14238
|
-
});
|
|
14239
|
-
}
|
|
14240
|
-
var init_contentRecording = __esm({
|
|
14241
|
-
"../linkque-agent-runtime/dist/esm/core/telemetry/contentRecording.js"() {
|
|
14242
|
-
"use strict";
|
|
14243
|
-
init_telemetry();
|
|
14244
|
-
}
|
|
14245
|
-
});
|
|
14246
|
-
|
|
14247
14278
|
// ../linkque-agent-runtime/dist/esm/core/skillTools.js
|
|
14248
14279
|
function parseSkillFile(raw, fallbackName) {
|
|
14249
14280
|
const parsed = splitFrontmatter(raw);
|
|
@@ -49179,9 +49210,9 @@ function toolResultOutcome(result) {
|
|
|
49179
49210
|
return ETelemetryOutcome.UNKNOWN;
|
|
49180
49211
|
}
|
|
49181
49212
|
const record4 = result;
|
|
49182
|
-
if (record4.isError === true
|
|
49213
|
+
if (record4.isError === true)
|
|
49183
49214
|
return ETelemetryOutcome.ERROR;
|
|
49184
|
-
if (record4.isError === false || record4.
|
|
49215
|
+
if (record4.isError === false || record4.type === "linkque.presentation-tool-result")
|
|
49185
49216
|
return ETelemetryOutcome.SUCCESS;
|
|
49186
49217
|
} catch {
|
|
49187
49218
|
}
|
|
@@ -49350,6 +49381,44 @@ var init_piTelemetry = __esm({
|
|
|
49350
49381
|
PiTelemetry = class {
|
|
49351
49382
|
root;
|
|
49352
49383
|
iterationIndex = 0;
|
|
49384
|
+
replyText = "";
|
|
49385
|
+
replyBytes = 0;
|
|
49386
|
+
replyIndex = 0;
|
|
49387
|
+
replyTruncated = false;
|
|
49388
|
+
maxReplyBytes = 512 * 1024;
|
|
49389
|
+
/** 正文分块独立落盘;每条最坏 JSON 编码也低于日志单行 1 MiB 上限。 */
|
|
49390
|
+
recordReplyChunk(final, complete) {
|
|
49391
|
+
this.root.find(ETelemetryAssociation.MODEL)?.record(ETelemetryEventName.CONTENT_RECORDED, {}, {
|
|
49392
|
+
section: ETelemetryContentSection.MODEL_OUTPUT,
|
|
49393
|
+
value: this.replyText,
|
|
49394
|
+
chunkIndex: this.replyIndex++,
|
|
49395
|
+
final,
|
|
49396
|
+
availability: final && complete && !this.replyTruncated ? "available" : "partial"
|
|
49397
|
+
});
|
|
49398
|
+
this.replyText = "";
|
|
49399
|
+
}
|
|
49400
|
+
flushReply(complete) {
|
|
49401
|
+
if (this.replyBytes)
|
|
49402
|
+
this.recordReplyChunk(true, complete);
|
|
49403
|
+
this.replyBytes = 0;
|
|
49404
|
+
this.replyIndex = 0;
|
|
49405
|
+
this.replyTruncated = false;
|
|
49406
|
+
}
|
|
49407
|
+
appendReply(text2) {
|
|
49408
|
+
if (this.replyTruncated)
|
|
49409
|
+
return;
|
|
49410
|
+
for (const character of text2) {
|
|
49411
|
+
const bytes2 = Buffer.byteLength(character, "utf8");
|
|
49412
|
+
if (this.replyBytes + bytes2 > this.maxReplyBytes) {
|
|
49413
|
+
this.replyTruncated = true;
|
|
49414
|
+
break;
|
|
49415
|
+
}
|
|
49416
|
+
this.replyText += character;
|
|
49417
|
+
this.replyBytes += bytes2;
|
|
49418
|
+
if (this.replyText.length >= 16 * 1024)
|
|
49419
|
+
this.recordReplyChunk(false, false);
|
|
49420
|
+
}
|
|
49421
|
+
}
|
|
49353
49422
|
proposed = /* @__PURE__ */ new Map();
|
|
49354
49423
|
loop;
|
|
49355
49424
|
lastProvider = null;
|
|
@@ -49451,6 +49520,7 @@ var init_piTelemetry = __esm({
|
|
|
49451
49520
|
}
|
|
49452
49521
|
case "message_end":
|
|
49453
49522
|
if (event.message.role === "assistant") {
|
|
49523
|
+
this.flushReply(event.message.stopReason !== "error" && event.message.stopReason !== "aborted");
|
|
49454
49524
|
const failed = event.message.stopReason === "error" || event.message.stopReason === "aborted";
|
|
49455
49525
|
this.root.find(ETelemetryAssociation.MODEL)?.finish(event.message.stopReason === "aborted" ? ETelemetryOutcome.CANCELLED : failed ? ETelemetryOutcome.ERROR : ETelemetryOutcome.SUCCESS, {
|
|
49456
49526
|
[ETelemetryAttribute.GEN_AI_RESPONSE_FINISH_REASONS]: [
|
|
@@ -49465,6 +49535,8 @@ var init_piTelemetry = __esm({
|
|
|
49465
49535
|
break;
|
|
49466
49536
|
case "message_update": {
|
|
49467
49537
|
const update = event.assistantMessageEvent;
|
|
49538
|
+
if (update.type === "text_delta")
|
|
49539
|
+
this.appendReply(update.delta);
|
|
49468
49540
|
if (update.type === "text_delta" && update.delta && !this.publicTextSeen) {
|
|
49469
49541
|
this.publicTextSeen = true;
|
|
49470
49542
|
this.loop.record(ETelemetryEventName.LOOP_FIRST_PUBLIC_TEXT, {
|
|
@@ -49495,6 +49567,7 @@ var init_piTelemetry = __esm({
|
|
|
49495
49567
|
this.terminal = ETelemetryStreamTermination.ERROR;
|
|
49496
49568
|
}
|
|
49497
49569
|
close(cancelled) {
|
|
49570
|
+
this.flushReply(false);
|
|
49498
49571
|
this.proposed.clear();
|
|
49499
49572
|
this.loop.finish(this.terminal === ETelemetryStreamTermination.ERROR ? ETelemetryOutcome.ERROR : cancelled || this.terminal === ETelemetryStreamTermination.CANCEL ? ETelemetryOutcome.CANCELLED : this.terminal === ETelemetryStreamTermination.COMPLETE ? ETelemetryOutcome.SUCCESS : ETelemetryOutcome.UNKNOWN, {
|
|
49500
49573
|
[ETelemetryAttribute.LINKQUE_STREAM_TERMINATION]: this.terminal === ETelemetryStreamTermination.ERROR ? ETelemetryStreamTermination.ERROR : cancelled ? ETelemetryStreamTermination.CANCEL : this.terminal
|
|
@@ -207563,7 +207636,7 @@ var init_agentRuntime = __esm({
|
|
|
207563
207636
|
}
|
|
207564
207637
|
/**
|
|
207565
207638
|
* 记录本次用户输入(RFC §4.1):取进入 Runtime 的本次新消息中最后一条 user message
|
|
207566
|
-
* 的 content,作为 `linkque.
|
|
207639
|
+
* 的 content,作为 `linkque.content.recorded` 的 body 走 record 链路落入
|
|
207567
207640
|
* OTLP logs(body 含 section/value/availability)。不以模型 messages 上下文为输入;
|
|
207568
207641
|
* 无 user 文本(卡片交互等)时按可用性如实标记,不伪造自然语言 Query。
|
|
207569
207642
|
*/
|
|
@@ -207575,15 +207648,17 @@ var init_agentRuntime = __esm({
|
|
|
207575
207648
|
}
|
|
207576
207649
|
const content = lastUser?.content;
|
|
207577
207650
|
const text2 = typeof content === "string" && content ? content : void 0;
|
|
207651
|
+
const value = text2?.slice(0, CONTENT_VALUE_MAX_LENGTH);
|
|
207652
|
+
const truncated = text2 !== void 0 && text2.length > CONTENT_VALUE_MAX_LENGTH;
|
|
207578
207653
|
const card = content && typeof content === "object" && "type" in content && content.type === "a2ui.event" ? content : void 0;
|
|
207579
207654
|
const displayText = card && "displayText" in card && typeof card.displayText === "string" && card.displayText ? card.displayText : void 0;
|
|
207580
207655
|
const body = {
|
|
207581
207656
|
section: ETelemetryContentSection.QUERY_INPUT,
|
|
207582
|
-
...
|
|
207657
|
+
...value !== void 0 ? { value } : {},
|
|
207583
207658
|
...card ? { inputType: "card", ...displayText ? { displayText } : {} } : {},
|
|
207584
207659
|
availability: text2 !== void 0 || card ? "available" : "not_recorded"
|
|
207585
207660
|
};
|
|
207586
|
-
observation.record(ETelemetryEventName.
|
|
207661
|
+
observation.record(ETelemetryEventName.CONTENT_RECORDED, { [ETelemetryAttribute.LINKQUE_CONTENT_VALUE_TRUNCATED]: truncated }, body);
|
|
207587
207662
|
}
|
|
207588
207663
|
async *runObservedAdvance(request, auth2, options, observation) {
|
|
207589
207664
|
observation.record(ETelemetryEventName.TELEMETRY_COVERAGE, {
|
|
@@ -214871,7 +214946,7 @@ var RemoteGatewayMcpServerProvider = class {
|
|
|
214871
214946
|
} catch (error40) {
|
|
214872
214947
|
invocation.signal.throwIfAborted();
|
|
214873
214948
|
if (invocation.auth && !(error40 instanceof McpInvocationError))
|
|
214874
|
-
throw new Error("MCP \u7528\u6237\u5DE5\u5177\u8C03\u7528\u5931\u8D25");
|
|
214949
|
+
throw new Error("MCP \u7528\u6237\u5DE5\u5177\u8C03\u7528\u5931\u8D25", { cause: error40 });
|
|
214875
214950
|
throw error40;
|
|
214876
214951
|
}
|
|
214877
214952
|
}));
|
|
@@ -216538,6 +216613,7 @@ var allowedAttributeKeys = /* @__PURE__ */ new Set([
|
|
|
216538
216613
|
ETelemetryAttribute.GEN_AI_REQUEST_MODEL,
|
|
216539
216614
|
ETelemetryAttribute.GEN_AI_RESPONSE_MODEL,
|
|
216540
216615
|
ETelemetryAttribute.GEN_AI_RESPONSE_ID,
|
|
216616
|
+
ETelemetryAttribute.LINKQUE_CONTENT_VALUE_TRUNCATED,
|
|
216541
216617
|
ETelemetryAttribute.GEN_AI_RESPONSE_FINISH_REASONS,
|
|
216542
216618
|
ETelemetryAttribute.GEN_AI_USAGE_INPUT_TOKENS,
|
|
216543
216619
|
ETelemetryAttribute.GEN_AI_USAGE_OUTPUT_TOKENS,
|
|
@@ -216866,7 +216942,16 @@ var OtelRuntimeTelemetry = class {
|
|
|
216866
216942
|
Math.floor(now / 1e3),
|
|
216867
216943
|
now % 1e3 * 1e6
|
|
216868
216944
|
];
|
|
216869
|
-
const localOnly = name === ETelemetryEventName.
|
|
216945
|
+
const localOnly = name === ETelemetryEventName.CONTENT_RECORDED;
|
|
216946
|
+
if (localOnly && body && typeof body === "object" && "value" in body) {
|
|
216947
|
+
const { value, ...metadata } = body;
|
|
216948
|
+
try {
|
|
216949
|
+
const valueJson = JSON.stringify(value);
|
|
216950
|
+
body = valueJson !== void 0 && Buffer.byteLength(JSON.stringify(valueJson), "utf8") <= 512 * 1024 ? { ...metadata, valueJson } : { ...metadata, availability: "unavailable", reason: "content_limit" };
|
|
216951
|
+
} catch {
|
|
216952
|
+
body = { ...metadata, availability: "unavailable" };
|
|
216953
|
+
}
|
|
216954
|
+
}
|
|
216870
216955
|
if (!localOnly && operation.span.isRecording())
|
|
216871
216956
|
operation.span.addEvent(
|
|
216872
216957
|
name,
|