@jsonstudio/llms 0.6.3541 → 0.6.3685
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/dist/conversion/compat/actions/antigravity-thought-signature-cache.js +23 -114
- package/dist/conversion/compat/actions/auto-thinking.js +3 -2
- package/dist/conversion/compat/actions/deepseek-web-response.js +9 -50
- package/dist/conversion/compat/actions/field-mapping.js +2 -153
- package/dist/conversion/compat/actions/gemini-cli-request.d.ts +2 -0
- package/dist/conversion/compat/actions/gemini-cli-request.js +1 -1
- package/dist/conversion/compat/actions/glm-history-image-trim.js +3 -37
- package/dist/conversion/compat/actions/glm-image-content.js +3 -32
- package/dist/conversion/compat/actions/glm-native-compat.d.ts +6 -0
- package/dist/conversion/compat/actions/glm-native-compat.js +34 -0
- package/dist/conversion/compat/actions/glm-vision-prompt.js +3 -76
- package/dist/conversion/compat/actions/glm-web-search.js +10 -43
- package/dist/conversion/compat/actions/iflow-kimi-cli-defaults.js +4 -53
- package/dist/conversion/compat/actions/iflow-kimi-history-media-placeholder.js +5 -141
- package/dist/conversion/compat/actions/iflow-kimi-thinking-reasoning-fill.js +7 -28
- package/dist/conversion/compat/actions/iflow-native-compat.d.ts +6 -0
- package/dist/conversion/compat/actions/iflow-native-compat.js +36 -0
- package/dist/conversion/compat/actions/iflow-response-body-unwrap.js +4 -119
- package/dist/conversion/compat/actions/iflow-web-search.js +14 -55
- package/dist/conversion/compat/actions/lmstudio-responses-input-stringify.js +3 -104
- package/dist/conversion/hub/node-support.js +1 -1
- package/dist/conversion/hub/operation-table/semantic-mappers/anthropic-mapper.js +9 -1
- package/dist/conversion/hub/operation-table/semantic-mappers/archive/chat-mapper.archive.js +5 -0
- package/dist/conversion/hub/operation-table/semantic-mappers/responses-mapper.js +34 -14
- package/dist/conversion/hub/pipeline/hub-pipeline.d.ts +14 -14
- package/dist/conversion/hub/pipeline/hub-pipeline.js +838 -524
- package/dist/conversion/hub/pipeline/hub-stage-timing.d.ts +6 -0
- package/dist/conversion/hub/pipeline/hub-stage-timing.js +178 -0
- package/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage1_format_parse/index.js +6 -4
- package/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/index.js +46 -0
- package/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/context-capture-orchestration.d.ts +3 -0
- package/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/context-capture-orchestration.js +2 -1
- package/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/context-factories.js +2 -0
- package/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/index.js +1 -0
- package/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/responses-context-snapshot.d.ts +3 -2
- package/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/responses-context-snapshot.js +18 -5
- package/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage1_semantic_map/context-merge.d.ts +1 -2
- package/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage1_semantic_map/context-merge.js +0 -16
- package/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage1_semantic_map/index.d.ts +1 -1
- package/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage1_semantic_map/index.js +30 -12
- package/dist/conversion/hub/pipeline/stages/req_process/req_process_stage1_tool_governance/index.d.ts +1 -0
- package/dist/conversion/hub/pipeline/stages/req_process/req_process_stage1_tool_governance/index.js +5 -2
- package/dist/conversion/hub/pipeline/stages/req_process/req_process_stage2_route_select/index.d.ts +1 -1
- package/dist/conversion/hub/pipeline/stages/req_process/req_process_stage2_route_select/index.js +9 -5
- package/dist/conversion/hub/process/chat-process-continue-execution.js +2 -4
- package/dist/conversion/hub/process/chat-process-governance-orchestration.js +3 -1
- package/dist/conversion/hub/process/chat-process-media.d.ts +1 -0
- package/dist/conversion/hub/process/chat-process-media.js +36 -0
- package/dist/conversion/hub/process/chat-process-session-usage.d.ts +25 -0
- package/dist/conversion/hub/process/chat-process-session-usage.js +246 -0
- package/dist/conversion/hub/response/provider-response.js +13 -0
- package/dist/conversion/hub/types/chat-envelope.d.ts +1 -0
- package/dist/conversion/pipeline/codecs/v2/openai-openai-pipeline.js +0 -4
- package/dist/conversion/responses/responses-openai-bridge/response-payload.js +0 -12
- package/dist/conversion/responses/responses-openai-bridge/types.d.ts +1 -9
- package/dist/conversion/responses/responses-openai-bridge.d.ts +1 -0
- package/dist/conversion/responses/responses-openai-bridge.js +51 -24
- package/dist/conversion/shared/anthropic-message-utils.js +14 -1
- package/dist/conversion/shared/reasoning-normalizer.js +61 -0
- package/dist/conversion/shared/tool-governor.js +2 -4
- package/dist/native/router_hotpath_napi.node +0 -0
- package/dist/quota/quota-state.js +1 -6
- package/dist/router/virtual-router/bootstrap/profile-builder.js +1 -0
- package/dist/router/virtual-router/bootstrap/provider-normalization.d.ts +1 -0
- package/dist/router/virtual-router/bootstrap/provider-normalization.js +6 -0
- package/dist/router/virtual-router/bootstrap.js +1 -6
- package/dist/router/virtual-router/engine/routing-state/store.js +21 -2
- package/dist/router/virtual-router/engine-legacy.js +43 -0
- package/dist/router/virtual-router/engine-logging.d.ts +3 -0
- package/dist/router/virtual-router/engine-logging.js +29 -3
- package/dist/router/virtual-router/engine-selection/native-chat-process-governed-filter-semantics.d.ts +1 -0
- package/dist/router/virtual-router/engine-selection/native-chat-process-governed-filter-semantics.js +1 -0
- package/dist/router/virtual-router/engine-selection/native-compat-action-semantics.d.ts +3 -0
- package/dist/router/virtual-router/engine-selection/native-compat-action-semantics.js +72 -0
- package/dist/router/virtual-router/engine-selection/native-hub-bridge-action-semantics.d.ts +1 -1
- package/dist/router/virtual-router/engine-selection/native-hub-bridge-action-semantics.js +1 -1
- package/dist/router/virtual-router/engine-selection/native-hub-pipeline-inbound-outbound-semantics.d.ts +0 -1
- package/dist/router/virtual-router/engine-selection/native-hub-pipeline-inbound-outbound-semantics.js +0 -29
- package/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-process-semantics.d.ts +1 -0
- package/dist/router/virtual-router/engine-selection/native-router-hotpath-loader.js +6 -2
- package/dist/router/virtual-router/engine.js +28 -13
- package/dist/router/virtual-router/provider-registry.js +1 -0
- package/dist/router/virtual-router/routing-instructions/state.js +44 -2
- package/dist/router/virtual-router/routing-instructions/types.d.ts +6 -0
- package/dist/router/virtual-router/token-estimator.js +21 -0
- package/dist/router/virtual-router/types.d.ts +7 -0
- package/dist/servertool/engine.js +3 -34
- package/dist/servertool/handlers/followup-request-builder.js +0 -6
- package/dist/servertool/handlers/gemini-empty-reply-continue.js +3 -274
- package/dist/servertool/handlers/stop-message-auto/runtime-utils.d.ts +0 -3
- package/dist/servertool/handlers/stop-message-auto/runtime-utils.js +0 -29
- package/dist/servertool/handlers/stop-message-auto.js +11 -9
- package/dist/servertool/handlers/vision.js +4 -1
- package/dist/servertool/server-side-tools.d.ts +0 -1
- package/dist/servertool/server-side-tools.js +67 -5
- package/dist/tools/apply-patch/execution-capturer.d.ts +1 -1
- package/dist/tools/apply-patch/execution-capturer.js +1 -2
- package/dist/tools/apply-patch/regression-capturer.js +2 -1
- package/dist/tools/tool-registry.js +1 -2
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { readRuntimeMetadata } from '../../../conversion/runtime-metadata.js';
|
|
2
1
|
import { saveRoutingInstructionStateSync } from '../../../router/virtual-router/sticky-session-store.js';
|
|
3
2
|
import { isStopEligibleForServerTool } from '../../stop-gateway-context.js';
|
|
4
3
|
import { extractResponsesOutputText, hasToolLikeOutput } from './iflow-followup.js';
|
|
@@ -101,17 +100,6 @@ export function getCapturedRequest(adapterContext) {
|
|
|
101
100
|
if (direct && typeof direct === 'object' && !Array.isArray(direct)) {
|
|
102
101
|
return direct;
|
|
103
102
|
}
|
|
104
|
-
const runtime = readRuntimeMetadata(contextRecord);
|
|
105
|
-
const runtimeCaptured = runtime && typeof runtime === 'object' && !Array.isArray(runtime)
|
|
106
|
-
? runtime.capturedChatRequest
|
|
107
|
-
: undefined;
|
|
108
|
-
if (runtimeCaptured && typeof runtimeCaptured === 'object' && !Array.isArray(runtimeCaptured)) {
|
|
109
|
-
return runtimeCaptured;
|
|
110
|
-
}
|
|
111
|
-
const originalRequest = contextRecord.originalRequest;
|
|
112
|
-
if (originalRequest && typeof originalRequest === 'object' && !Array.isArray(originalRequest)) {
|
|
113
|
-
return originalRequest;
|
|
114
|
-
}
|
|
115
103
|
return null;
|
|
116
104
|
}
|
|
117
105
|
export function resolveClientConnectionState(value) {
|
|
@@ -276,23 +264,6 @@ function readSessionScopeValue(record, runtimeMetadata, key) {
|
|
|
276
264
|
if (fromMetadataCapture) {
|
|
277
265
|
return fromMetadataCapture;
|
|
278
266
|
}
|
|
279
|
-
const originalRequest = asRecord(record.originalRequest);
|
|
280
|
-
const fromOriginalMetadata = originalRequest
|
|
281
|
-
? toNonEmptyText(asRecord(originalRequest.metadata)?.[key])
|
|
282
|
-
: '';
|
|
283
|
-
if (fromOriginalMetadata) {
|
|
284
|
-
return fromOriginalMetadata;
|
|
285
|
-
}
|
|
286
|
-
const fromOriginalCapture = originalRequest ? readHubCaptureContextValue(originalRequest, key) : '';
|
|
287
|
-
if (fromOriginalCapture) {
|
|
288
|
-
return fromOriginalCapture;
|
|
289
|
-
}
|
|
290
|
-
const fromOriginalMetadataCapture = originalRequest
|
|
291
|
-
? readHubCaptureContextValue(asRecord(originalRequest.metadata), key)
|
|
292
|
-
: '';
|
|
293
|
-
if (fromOriginalMetadataCapture) {
|
|
294
|
-
return fromOriginalMetadataCapture;
|
|
295
|
-
}
|
|
296
267
|
const runtime = asRecord(runtimeMetadata);
|
|
297
268
|
const fromRuntime = runtime ? toNonEmptyText(runtime[key]) : '';
|
|
298
269
|
if (fromRuntime) {
|
|
@@ -214,15 +214,10 @@ const handler = async (ctx) => {
|
|
|
214
214
|
const stickyKey = strictSessionScope || resolveStickyKey(record, rt);
|
|
215
215
|
let stickyState = stickyKey ? loadRoutingInstructionStateSync(stickyKey) : null;
|
|
216
216
|
let snapshot = resolveStopMessageSnapshot(stickyState);
|
|
217
|
-
if (!snapshot) {
|
|
218
|
-
snapshot = resolveStopMessageSnapshot(rt?.stopMessageState);
|
|
219
|
-
if (snapshot && stickyKey) {
|
|
220
|
-
stickyState = createStopMessageState(snapshot);
|
|
221
|
-
persistStopMessageState(stickyKey, stickyState);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
217
|
const stickyMode = readStopMessageStageMode(stickyState);
|
|
225
|
-
const
|
|
218
|
+
const runtimeStopState = rt?.stopMessageState;
|
|
219
|
+
const runtimeSnapshot = resolveStopMessageSnapshot(runtimeStopState);
|
|
220
|
+
const runtimeMode = readStopMessageStageMode(runtimeStopState);
|
|
226
221
|
const explicitMode = stickyMode ?? runtimeMode;
|
|
227
222
|
if (!snapshot && explicitMode === 'off') {
|
|
228
223
|
debugLog('skip_explicit_mode_off', { stickyKey });
|
|
@@ -235,6 +230,13 @@ const handler = async (ctx) => {
|
|
|
235
230
|
used: 0
|
|
236
231
|
});
|
|
237
232
|
}
|
|
233
|
+
if (!snapshot && runtimeSnapshot) {
|
|
234
|
+
snapshot = runtimeSnapshot;
|
|
235
|
+
if (stickyKey) {
|
|
236
|
+
stickyState = createStopMessageState(snapshot);
|
|
237
|
+
persistStopMessageState(stickyKey, stickyState);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
238
240
|
if (!snapshot) {
|
|
239
241
|
const implicit = STOPMESSAGE_IMPLICIT_GEMINI
|
|
240
242
|
? resolveImplicitGeminiStopMessageSnapshot(ctx, record)
|
|
@@ -379,7 +381,7 @@ const handler = async (ctx) => {
|
|
|
379
381
|
debugLog('skip_failed_build_followup');
|
|
380
382
|
return markSkip('skip_failed_build_followup');
|
|
381
383
|
}
|
|
382
|
-
const historyStateCandidate = stickyState
|
|
384
|
+
const historyStateCandidate = stickyState;
|
|
383
385
|
const existingSeedPrompt = readStopMessageAiSeedPrompt(historyStateCandidate);
|
|
384
386
|
const existingHistory = readStopMessageAiHistory(historyStateCandidate);
|
|
385
387
|
const fallbackCandidateFollowupText = existingSeedPrompt || text || '继续执行';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { registerServerToolHandler } from '../registry.js';
|
|
2
2
|
import { cloneJson, extractTextFromChatLike } from '../server-side-tools.js';
|
|
3
3
|
import { extractCapturedChatSeed } from './followup-request-builder.js';
|
|
4
|
+
import { containsImageAttachment } from '../../conversion/hub/process/chat-process-media.js';
|
|
4
5
|
import { reenterServerToolBackend } from '../reenter-backend.js';
|
|
5
6
|
import { readRuntimeMetadata } from '../../conversion/runtime-metadata.js';
|
|
6
7
|
const FLOW_ID = 'vision_flow';
|
|
@@ -91,7 +92,9 @@ function shouldRunVisionFlow(ctx) {
|
|
|
91
92
|
if (followupFlag) {
|
|
92
93
|
return false;
|
|
93
94
|
}
|
|
94
|
-
const
|
|
95
|
+
const captured = getCapturedRequest(ctx.adapterContext);
|
|
96
|
+
const seed = captured ? extractCapturedChatSeed(captured) : null;
|
|
97
|
+
const hasImageAttachment = Boolean(seed && Array.isArray(seed.messages) && containsImageAttachment(seed.messages));
|
|
95
98
|
if (!hasImageAttachment) {
|
|
96
99
|
return false;
|
|
97
100
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { JsonObject } from '../conversion/hub/types/json.js';
|
|
2
2
|
import type { ServerSideToolEngineOptions, ServerSideToolEngineResult, ToolCall } from './types.js';
|
|
3
3
|
import './handlers/iflow-model-error-retry.js';
|
|
4
|
-
import './handlers/gemini-empty-reply-continue.js';
|
|
5
4
|
import './handlers/antigravity-thought-signature-bootstrap.js';
|
|
6
5
|
import './handlers/stop-message-auto.js';
|
|
7
6
|
import './handlers/clock.js';
|
|
@@ -3,7 +3,6 @@ import { ProviderProtocolError } from '../conversion/provider-protocol-error.js'
|
|
|
3
3
|
import { executeWebSearchBackendPlan } from './handlers/web-search.js';
|
|
4
4
|
import { executeVisionBackendPlan } from './handlers/vision.js';
|
|
5
5
|
import './handlers/iflow-model-error-retry.js';
|
|
6
|
-
import './handlers/gemini-empty-reply-continue.js';
|
|
7
6
|
import './handlers/antigravity-thought-signature-bootstrap.js';
|
|
8
7
|
import './handlers/stop-message-auto.js';
|
|
9
8
|
import './handlers/clock.js';
|
|
@@ -14,6 +13,7 @@ import './handlers/continue-execution.js';
|
|
|
14
13
|
import './handlers/review.js';
|
|
15
14
|
import { runPreCommandHooks } from './pre-command-hooks.js';
|
|
16
15
|
import { readRuntimeMetadata } from '../conversion/runtime-metadata.js';
|
|
16
|
+
import { loadRoutingInstructionStateSync } from '../router/virtual-router/sticky-session-store.js';
|
|
17
17
|
function traceAutoHook(options, event) {
|
|
18
18
|
try {
|
|
19
19
|
options.onAutoHookTrace?.(event);
|
|
@@ -22,7 +22,7 @@ function traceAutoHook(options, event) {
|
|
|
22
22
|
// best-effort trace callback
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
const OPTIONAL_PRIMARY_HOOK_ORDER = ['
|
|
25
|
+
const OPTIONAL_PRIMARY_HOOK_ORDER = ['clock_auto', 'stop_message_auto'];
|
|
26
26
|
const MANDATORY_HOOK_ORDER = [];
|
|
27
27
|
let fallbackToolCallIdSeq = 0;
|
|
28
28
|
function ensureToolCallId(record) {
|
|
@@ -116,6 +116,59 @@ function normalizeServerToolCallName(name) {
|
|
|
116
116
|
}
|
|
117
117
|
return normalized;
|
|
118
118
|
}
|
|
119
|
+
function readText(value) {
|
|
120
|
+
return typeof value === 'string' && value.trim() ? value.trim() : '';
|
|
121
|
+
}
|
|
122
|
+
function resolveStickyKeyFromAdapterContext(record) {
|
|
123
|
+
const runtime = readRuntimeMetadata(record);
|
|
124
|
+
const metadata = record.metadata && typeof record.metadata === 'object' && !Array.isArray(record.metadata)
|
|
125
|
+
? record.metadata
|
|
126
|
+
: undefined;
|
|
127
|
+
const explicitScope = readText(runtime?.stopMessageClientInjectSessionScope) ||
|
|
128
|
+
readText(runtime?.stopMessageClientInjectScope) ||
|
|
129
|
+
readText(record.stopMessageClientInjectSessionScope) ||
|
|
130
|
+
readText(record.stopMessageClientInjectScope);
|
|
131
|
+
if (explicitScope &&
|
|
132
|
+
(explicitScope.startsWith('tmux:') ||
|
|
133
|
+
explicitScope.startsWith('session:') ||
|
|
134
|
+
explicitScope.startsWith('conversation:'))) {
|
|
135
|
+
return explicitScope;
|
|
136
|
+
}
|
|
137
|
+
const tmuxSessionId = readText(record.clientTmuxSessionId) ||
|
|
138
|
+
readText(record.client_tmux_session_id) ||
|
|
139
|
+
readText(record.tmuxSessionId) ||
|
|
140
|
+
readText(record.tmux_session_id) ||
|
|
141
|
+
readText(runtime?.clientTmuxSessionId) ||
|
|
142
|
+
readText(runtime?.client_tmux_session_id) ||
|
|
143
|
+
readText(runtime?.tmuxSessionId) ||
|
|
144
|
+
readText(runtime?.tmux_session_id) ||
|
|
145
|
+
readText(metadata?.clientTmuxSessionId) ||
|
|
146
|
+
readText(metadata?.client_tmux_session_id) ||
|
|
147
|
+
readText(metadata?.tmuxSessionId) ||
|
|
148
|
+
readText(metadata?.tmux_session_id);
|
|
149
|
+
if (tmuxSessionId) {
|
|
150
|
+
return `tmux:${tmuxSessionId}`;
|
|
151
|
+
}
|
|
152
|
+
const sessionId = readText(record.sessionId) ||
|
|
153
|
+
readText(record.session_id) ||
|
|
154
|
+
readText(runtime?.sessionId) ||
|
|
155
|
+
readText(runtime?.session_id) ||
|
|
156
|
+
readText(metadata?.sessionId) ||
|
|
157
|
+
readText(metadata?.session_id);
|
|
158
|
+
if (sessionId) {
|
|
159
|
+
return `session:${sessionId}`;
|
|
160
|
+
}
|
|
161
|
+
const conversationId = readText(record.conversationId) ||
|
|
162
|
+
readText(record.conversation_id) ||
|
|
163
|
+
readText(runtime?.conversationId) ||
|
|
164
|
+
readText(runtime?.conversation_id) ||
|
|
165
|
+
readText(metadata?.conversationId) ||
|
|
166
|
+
readText(metadata?.conversation_id);
|
|
167
|
+
if (conversationId) {
|
|
168
|
+
return `conversation:${conversationId}`;
|
|
169
|
+
}
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
119
172
|
function extractToolCallsFromMessage(message) {
|
|
120
173
|
const toolCalls = getArray(message.tool_calls);
|
|
121
174
|
const out = [];
|
|
@@ -310,9 +363,18 @@ export async function runServerSideToolEngine(options) {
|
|
|
310
363
|
let lastExecution;
|
|
311
364
|
const attemptedToolCallsByMessage = [];
|
|
312
365
|
const runtimeMetadata = readRuntimeMetadata(options.adapterContext);
|
|
313
|
-
const runtimePreCommandState =
|
|
314
|
-
|
|
315
|
-
|
|
366
|
+
const runtimePreCommandState = (() => {
|
|
367
|
+
const stickyKey = resolveStickyKeyFromAdapterContext(options.adapterContext);
|
|
368
|
+
if (!stickyKey) {
|
|
369
|
+
return undefined;
|
|
370
|
+
}
|
|
371
|
+
try {
|
|
372
|
+
return loadRoutingInstructionStateSync(stickyKey) ?? undefined;
|
|
373
|
+
}
|
|
374
|
+
catch {
|
|
375
|
+
return undefined;
|
|
376
|
+
}
|
|
377
|
+
})();
|
|
316
378
|
const choices = getArray(base.choices);
|
|
317
379
|
for (const choice of choices) {
|
|
318
380
|
const choiceObj = asObject(choice);
|
|
@@ -10,4 +10,4 @@ export declare function captureApplyPatchExecutionFailure(content: string, conte
|
|
|
10
10
|
toolCallId?: string;
|
|
11
11
|
toolCallArgs?: string;
|
|
12
12
|
}): void;
|
|
13
|
-
export declare function captureApplyPatchExecutionFailuresFromProcessedRequest(processedRequest: unknown): void;
|
|
13
|
+
export declare function captureApplyPatchExecutionFailuresFromProcessedRequest(processedRequest: unknown, applyPatchToolMode?: 'schema' | 'freeform'): void;
|
|
@@ -120,7 +120,7 @@ export function captureApplyPatchExecutionFailure(content, context) {
|
|
|
120
120
|
// Silently fail to avoid disrupting runtime
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
export function captureApplyPatchExecutionFailuresFromProcessedRequest(processedRequest) {
|
|
123
|
+
export function captureApplyPatchExecutionFailuresFromProcessedRequest(processedRequest, applyPatchToolMode) {
|
|
124
124
|
try {
|
|
125
125
|
if (!EXEC_ERRORSAMPLES_ENABLED)
|
|
126
126
|
return;
|
|
@@ -133,7 +133,6 @@ export function captureApplyPatchExecutionFailuresFromProcessedRequest(processed
|
|
|
133
133
|
const entryEndpoint = typeof metadata?.originalEndpoint === 'string' ? metadata.originalEndpoint : undefined;
|
|
134
134
|
const providerKey = typeof metadata?.providerKey === 'string' ? metadata.providerKey : undefined;
|
|
135
135
|
const model = typeof anyReq?.model === 'string' ? anyReq.model : undefined;
|
|
136
|
-
const applyPatchToolMode = typeof metadata?.applyPatchToolMode === 'string' ? String(metadata.applyPatchToolMode).trim().toLowerCase() : '';
|
|
137
136
|
const resolvedMode = applyPatchToolMode === 'schema' ? 'schema' : 'freeform';
|
|
138
137
|
const toolCallArgsById = new Map();
|
|
139
138
|
for (const msg of messages) {
|
|
@@ -73,8 +73,9 @@ function isContextError(error) {
|
|
|
73
73
|
}
|
|
74
74
|
function stableSampleId(sample) {
|
|
75
75
|
const mode = String(sample.meta?.applyPatchToolMode || '').trim();
|
|
76
|
+
const source = String(sample.source || '').trim();
|
|
76
77
|
const key = `${String(sample.errorType || 'unknown')}:${String(sample.originalArgs ?? '')}:` +
|
|
77
|
-
`${String(sample.normalizedArgs ?? '')}:${String(sample.fixerResult ?? '')}:${String(sample.validationError ?? '')}:${mode}`;
|
|
78
|
+
`${String(sample.normalizedArgs ?? '')}:${String(sample.fixerResult ?? '')}:${String(sample.validationError ?? '')}:${mode}:${source}`;
|
|
78
79
|
return createHash('sha1').update(key).digest('hex').slice(0, 16);
|
|
79
80
|
}
|
|
80
81
|
export function captureApplyPatchRegression(sample) {
|
|
@@ -129,8 +129,7 @@ export function validateToolCall(name, argsString, options) {
|
|
|
129
129
|
originalArgs: typeof argsString === 'string' ? argsString : String(argsString ?? ''),
|
|
130
130
|
normalizedArgs: typeof argsString === 'string' ? argsString : String(argsString ?? ''),
|
|
131
131
|
validationError: reason,
|
|
132
|
-
source: 'tool-registry.validateToolCall'
|
|
133
|
-
meta: { applyPatchToolMode: 'freeform' }
|
|
132
|
+
source: 'tool-registry.validateToolCall'
|
|
134
133
|
});
|
|
135
134
|
return { ok: false, reason };
|
|
136
135
|
}
|