@jsonstudio/llms 0.6.3686 → 0.6.3688
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare function isHubStageTimingDetailEnabled(): boolean;
|
|
1
2
|
export declare function logHubStageTiming(requestId: string, stage: string, phase: 'start' | 'completed' | 'error', details?: Record<string, unknown>): void;
|
|
2
3
|
export declare function measureHubStage<T>(requestId: string, stage: string, fn: () => Promise<T> | T, options?: {
|
|
3
4
|
startDetails?: Record<string, unknown>;
|
|
@@ -21,15 +21,11 @@ function isHubStageTimingEnabled() {
|
|
|
21
21
|
const explicit = process.env.ROUTECODEX_STAGE_TIMING ??
|
|
22
22
|
process.env.RCC_STAGE_TIMING ??
|
|
23
23
|
process.env.ROUTECODEX_HUB_STAGE_TIMING ??
|
|
24
|
-
process.env.RCC_HUB_STAGE_TIMING
|
|
25
|
-
process.env.ROUTECODEX_BUILD_MODE ??
|
|
26
|
-
process.env.RCC_BUILD_MODE ??
|
|
27
|
-
process.env.BUILD_MODE ??
|
|
28
|
-
process.env.LLMSWITCH_BUILD_MODE;
|
|
24
|
+
process.env.RCC_HUB_STAGE_TIMING;
|
|
29
25
|
if (explicit !== undefined) {
|
|
30
|
-
return resolveBool(explicit,
|
|
26
|
+
return resolveBool(explicit, false);
|
|
31
27
|
}
|
|
32
|
-
return
|
|
28
|
+
return false;
|
|
33
29
|
}
|
|
34
30
|
function isHubStageTimingVerboseEnabled() {
|
|
35
31
|
const explicit = process.env.ROUTECODEX_STAGE_TIMING_VERBOSE ??
|
|
@@ -41,6 +37,16 @@ function isHubStageTimingVerboseEnabled() {
|
|
|
41
37
|
}
|
|
42
38
|
return false;
|
|
43
39
|
}
|
|
40
|
+
export function isHubStageTimingDetailEnabled() {
|
|
41
|
+
const explicit = process.env.ROUTECODEX_STAGE_TIMING_DETAIL ??
|
|
42
|
+
process.env.RCC_STAGE_TIMING_DETAIL ??
|
|
43
|
+
process.env.ROUTECODEX_HUB_STAGE_TIMING_DETAIL ??
|
|
44
|
+
process.env.RCC_HUB_STAGE_TIMING_DETAIL;
|
|
45
|
+
if (explicit !== undefined) {
|
|
46
|
+
return resolveBool(explicit, false);
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
44
50
|
function resolveHubStageTimingMinMs() {
|
|
45
51
|
const raw = process.env.ROUTECODEX_STAGE_TIMING_MIN_MS ??
|
|
46
52
|
process.env.RCC_STAGE_TIMING_MIN_MS ??
|
|
@@ -127,7 +133,7 @@ export function logHubStageTiming(requestId, stage, phase, details) {
|
|
|
127
133
|
const timing = advanceTiming(requestId);
|
|
128
134
|
if (phase !== 'error') {
|
|
129
135
|
const forceLog = details?.forceLog === true;
|
|
130
|
-
if (forceLog) {
|
|
136
|
+
if (forceLog && isHubStageTimingDetailEnabled()) {
|
|
131
137
|
const detailSuffix = renderDetails(details);
|
|
132
138
|
const line = `[hub.detail][${requestId}] ${stage}.${phase}${timing.label}${detailSuffix}`;
|
|
133
139
|
console.log(line);
|
package/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage1_semantic_map/index.js
CHANGED
|
@@ -3,12 +3,10 @@ import { recordStage } from '../../../stages/utils.js';
|
|
|
3
3
|
import { applyContextSnapshotToChatEnvelope, applyToolCallIdStyleMetadata } from './context-merge.js';
|
|
4
4
|
import { shouldAttachReqOutboundContextSnapshotWithNative, standardizedToChatEnvelopeWithNative } from '../../../../../../router/virtual-router/engine-selection/native-hub-pipeline-req-outbound-semantics.js';
|
|
5
5
|
import { validateChatEnvelopeWithNative } from '../../../../../../router/virtual-router/engine-selection/native-hub-pipeline-edge-stage-semantics.js';
|
|
6
|
-
import { logHubStageTiming } from '../../../hub-stage-timing.js';
|
|
6
|
+
import { isHubStageTimingDetailEnabled, logHubStageTiming } from '../../../hub-stage-timing.js';
|
|
7
7
|
export async function runReqOutboundStage1SemanticMap(options) {
|
|
8
8
|
const requestId = options.adapterContext.requestId || 'unknown';
|
|
9
|
-
const forceDetailLog =
|
|
10
|
-
.trim()
|
|
11
|
-
.toLowerCase() === '1';
|
|
9
|
+
const forceDetailLog = isHubStageTimingDetailEnabled();
|
|
12
10
|
logHubStageTiming(requestId, 'req_outbound.stage1_native_to_chat_envelope', 'start');
|
|
13
11
|
const toChatStart = Date.now();
|
|
14
12
|
const chatEnvelope = standardizedToChatEnvelopeWithNative({
|