@jsonstudio/llms 0.6.3275 → 0.6.3405
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/bridge-message-utils.d.ts +4 -4
- package/dist/conversion/bridge-message-utils.js +28 -538
- package/dist/conversion/compat/actions/claude-thinking-tools.d.ts +1 -14
- package/dist/conversion/compat/actions/claude-thinking-tools.js +3 -71
- package/dist/conversion/compat/actions/lmstudio-responses-fc-ids.d.ts +0 -8
- package/dist/conversion/compat/actions/lmstudio-responses-fc-ids.js +2 -57
- package/dist/conversion/compat/actions/normalize-tool-call-ids.d.ts +0 -9
- package/dist/conversion/compat/actions/normalize-tool-call-ids.js +6 -136
- package/dist/conversion/compat/actions/request-rules.js +2 -61
- package/dist/conversion/compat/actions/response-blacklist.d.ts +0 -4
- package/dist/conversion/compat/actions/response-blacklist.js +2 -77
- package/dist/conversion/compat/actions/response-normalize.js +2 -119
- package/dist/conversion/compat/actions/response-validate.js +2 -74
- package/dist/conversion/compat/actions/strip-orphan-function-calls-tag.js +2 -150
- package/dist/conversion/compat/profiles/responses-crs.json +15 -0
- package/dist/conversion/hub/operation-table/semantic-mappers/anthropic-mapper.js +24 -1
- package/dist/conversion/hub/operation-table/semantic-mappers/chat-mapper.js +16 -5
- package/dist/conversion/hub/pipeline/hub-pipeline.js +91 -0
- package/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage1_tool_governance/index.js +1 -6
- package/dist/conversion/hub/response/response-runtime.js +14 -6
- package/dist/conversion/responses/responses-openai-bridge/response-payload.js +11 -11
- package/dist/conversion/shared/anthropic-message-utils.js +2 -12
- package/dist/conversion/shared/chat-request-filters.js +2 -61
- package/dist/conversion/shared/reasoning-mapping.js +3 -0
- package/dist/conversion/shared/reasoning-normalizer.d.ts +1 -0
- package/dist/conversion/shared/reasoning-normalizer.js +35 -388
- package/dist/conversion/shared/reasoning-tool-normalizer.js +8 -15
- package/dist/conversion/shared/reasoning-tool-parser.js +7 -8
- package/dist/conversion/shared/reasoning-utils.js +13 -35
- package/dist/conversion/shared/responses-response-utils.js +3 -48
- package/dist/conversion/shared/responses-tool-utils.d.ts +1 -1
- package/dist/conversion/shared/responses-tool-utils.js +74 -180
- package/dist/conversion/shared/streaming-text-extractor.d.ts +0 -5
- package/dist/conversion/shared/streaming-text-extractor.js +18 -111
- package/dist/conversion/shared/text-markup-normalizer/normalize.d.ts +1 -1
- package/dist/conversion/shared/text-markup-normalizer/normalize.js +3 -91
- package/dist/conversion/shared/thought-signature-validator.js +19 -133
- package/dist/conversion/shared/tool-argument-repairer.js +16 -19
- package/dist/conversion/shared/tool-call-id-manager.d.ts +1 -5
- package/dist/conversion/shared/tool-call-id-manager.js +74 -98
- package/dist/conversion/shared/tool-harvester.js +19 -382
- package/dist/conversion/shared/tool-mapping.d.ts +2 -3
- package/dist/conversion/shared/tool-mapping.js +28 -184
- package/dist/conversion/shared/tooling.js +20 -151
- package/dist/filters/special/response-tool-arguments-stringify.js +9 -1
- package/dist/guidance/index.js +2 -2
- package/dist/native/router_hotpath_napi.node +0 -0
- package/dist/router/virtual-router/bootstrap/web-search-config.js +25 -0
- package/dist/router/virtual-router/bootstrap.js +21 -16
- package/dist/router/virtual-router/engine-legacy/helpers.js +1 -1
- package/dist/router/virtual-router/engine-selection/native-compat-action-semantics.d.ts +6 -0
- package/dist/router/virtual-router/engine-selection/native-compat-action-semantics.js +171 -0
- package/dist/router/virtual-router/engine-selection/native-hub-bridge-action-semantics.d.ts +39 -0
- package/dist/router/virtual-router/engine-selection/native-hub-bridge-action-semantics.js +196 -0
- package/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-inbound-semantics.d.ts +1 -0
- package/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-inbound-semantics.js +27 -0
- package/dist/router/virtual-router/engine-selection/native-router-hotpath-loader.js +45 -0
- package/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics.d.ts +70 -1
- package/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics.js +993 -55
- package/dist/router/virtual-router/engine.js +3 -2
- package/dist/router/virtual-router/routing-instructions/parse.js +30 -3
- package/dist/router/virtual-router/types.d.ts +23 -0
- package/dist/servertool/handlers/web-search.js +26 -1
- package/dist/servertool/server-side-tools.js +11 -2
- package/dist/servertool/types.d.ts +4 -0
- package/dist/sse/sse-to-json/builders/anthropic-response-builder.js +28 -3
- package/dist/sse/types/anthropic-types.d.ts +3 -1
- package/dist/tools/apply-patch/args-normalizer/extract-patch.js +2 -2
- package/dist/tools/apply-patch/patch-text/looks-like-patch.js +3 -6
- package/dist/tools/apply-patch/patch-text/normalize.js +14 -3
- package/dist/tools/tool-registry.js +12 -0
- package/package.json +6 -1
|
@@ -38,6 +38,20 @@ function parseOutput(raw) {
|
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
function parseEnsureMessagesArrayOutput(raw) {
|
|
42
|
+
try {
|
|
43
|
+
const parsed = JSON.parse(raw);
|
|
44
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const row = parsed;
|
|
48
|
+
const messages = Array.isArray(row.messages) ? row.messages : [];
|
|
49
|
+
return { messages };
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
41
55
|
function parseBridgeHistoryOutput(raw) {
|
|
42
56
|
try {
|
|
43
57
|
const parsed = JSON.parse(raw);
|
|
@@ -68,6 +82,14 @@ function parseBridgeHistoryOutput(raw) {
|
|
|
68
82
|
return null;
|
|
69
83
|
}
|
|
70
84
|
}
|
|
85
|
+
function parseBridgeInputToChatOutput(raw) {
|
|
86
|
+
const parsed = parseRecord(raw);
|
|
87
|
+
if (!parsed || !Array.isArray(parsed.messages)) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const messages = parsed.messages.filter((entry) => Boolean(entry) && typeof entry === 'object' && !Array.isArray(entry));
|
|
91
|
+
return { messages };
|
|
92
|
+
}
|
|
71
93
|
function parseBridgeActionState(raw) {
|
|
72
94
|
try {
|
|
73
95
|
const parsed = JSON.parse(raw);
|
|
@@ -517,6 +539,180 @@ export function applyBridgeEnsureToolPlaceholdersWithNative(input) {
|
|
|
517
539
|
return fail(reason);
|
|
518
540
|
}
|
|
519
541
|
}
|
|
542
|
+
export function convertBridgeInputToChatMessagesWithNative(input) {
|
|
543
|
+
const capability = 'convertBridgeInputToChatMessagesJson';
|
|
544
|
+
const fail = (reason) => failNativeRequired(capability, reason);
|
|
545
|
+
if (isNativeDisabledByEnv()) {
|
|
546
|
+
return fail('native disabled');
|
|
547
|
+
}
|
|
548
|
+
const fn = readNativeFunction(capability);
|
|
549
|
+
if (!fn) {
|
|
550
|
+
return fail();
|
|
551
|
+
}
|
|
552
|
+
const payloadJson = safeStringify({
|
|
553
|
+
input: input.input,
|
|
554
|
+
tools: input.tools,
|
|
555
|
+
toolResultFallbackText: input.toolResultFallbackText,
|
|
556
|
+
normalizeFunctionName: input.normalizeFunctionName
|
|
557
|
+
});
|
|
558
|
+
if (!payloadJson) {
|
|
559
|
+
return fail('json stringify failed');
|
|
560
|
+
}
|
|
561
|
+
try {
|
|
562
|
+
const raw = fn(payloadJson);
|
|
563
|
+
if (typeof raw !== 'string' || !raw) {
|
|
564
|
+
return fail('empty result');
|
|
565
|
+
}
|
|
566
|
+
const parsed = parseBridgeInputToChatOutput(raw);
|
|
567
|
+
return parsed ?? fail('invalid payload');
|
|
568
|
+
}
|
|
569
|
+
catch (error) {
|
|
570
|
+
const reason = error instanceof Error ? error.message : String(error ?? 'unknown');
|
|
571
|
+
return fail(reason);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
export function coerceBridgeRoleWithNative(role) {
|
|
575
|
+
const capability = 'coerceBridgeRoleJson';
|
|
576
|
+
const fail = (reason) => failNativeRequired(capability, reason);
|
|
577
|
+
if (isNativeDisabledByEnv()) {
|
|
578
|
+
return fail('native disabled');
|
|
579
|
+
}
|
|
580
|
+
const fn = readNativeFunction(capability);
|
|
581
|
+
if (!fn) {
|
|
582
|
+
return fail();
|
|
583
|
+
}
|
|
584
|
+
const payloadJson = safeStringify({ role });
|
|
585
|
+
if (!payloadJson) {
|
|
586
|
+
return fail('json stringify failed');
|
|
587
|
+
}
|
|
588
|
+
try {
|
|
589
|
+
const raw = fn(payloadJson);
|
|
590
|
+
if (typeof raw !== 'string' || !raw) {
|
|
591
|
+
return fail('empty result');
|
|
592
|
+
}
|
|
593
|
+
const parsed = JSON.parse(raw);
|
|
594
|
+
return typeof parsed === 'string' ? parsed : fail('invalid payload');
|
|
595
|
+
}
|
|
596
|
+
catch (error) {
|
|
597
|
+
const reason = error instanceof Error ? error.message : String(error ?? 'unknown');
|
|
598
|
+
return fail(reason);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
export function serializeToolOutputWithNative(input) {
|
|
602
|
+
const capability = 'serializeToolOutputJson';
|
|
603
|
+
const fail = (reason) => failNativeRequired(capability, reason);
|
|
604
|
+
if (isNativeDisabledByEnv()) {
|
|
605
|
+
return fail('native disabled');
|
|
606
|
+
}
|
|
607
|
+
const fn = readNativeFunction(capability);
|
|
608
|
+
if (!fn) {
|
|
609
|
+
return fail();
|
|
610
|
+
}
|
|
611
|
+
const payloadJson = safeStringify({ output: input.output });
|
|
612
|
+
if (!payloadJson) {
|
|
613
|
+
return fail('json stringify failed');
|
|
614
|
+
}
|
|
615
|
+
try {
|
|
616
|
+
const raw = fn(payloadJson);
|
|
617
|
+
if (typeof raw !== 'string') {
|
|
618
|
+
return fail('empty result');
|
|
619
|
+
}
|
|
620
|
+
const parsed = JSON.parse(raw);
|
|
621
|
+
return typeof parsed === 'string' || parsed === null ? parsed : fail('invalid payload');
|
|
622
|
+
}
|
|
623
|
+
catch (error) {
|
|
624
|
+
const reason = error instanceof Error ? error.message : String(error ?? 'unknown');
|
|
625
|
+
return fail(reason);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
export function serializeToolArgumentsWithNative(input) {
|
|
629
|
+
const capability = 'serializeToolArgumentsJson';
|
|
630
|
+
const fail = (reason) => failNativeRequired(capability, reason);
|
|
631
|
+
if (isNativeDisabledByEnv()) {
|
|
632
|
+
return fail('native disabled');
|
|
633
|
+
}
|
|
634
|
+
const fn = readNativeFunction(capability);
|
|
635
|
+
if (!fn) {
|
|
636
|
+
return fail();
|
|
637
|
+
}
|
|
638
|
+
const payloadJson = safeStringify({ args: input.args });
|
|
639
|
+
if (!payloadJson) {
|
|
640
|
+
return fail('json stringify failed');
|
|
641
|
+
}
|
|
642
|
+
try {
|
|
643
|
+
const raw = fn(payloadJson);
|
|
644
|
+
if (typeof raw !== 'string' || !raw) {
|
|
645
|
+
return fail('empty result');
|
|
646
|
+
}
|
|
647
|
+
const parsed = JSON.parse(raw);
|
|
648
|
+
return typeof parsed === 'string' ? parsed : fail('invalid payload');
|
|
649
|
+
}
|
|
650
|
+
catch (error) {
|
|
651
|
+
const reason = error instanceof Error ? error.message : String(error ?? 'unknown');
|
|
652
|
+
return fail(reason);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
export function ensureMessagesArrayWithNative(input) {
|
|
656
|
+
const capability = 'ensureMessagesArrayJson';
|
|
657
|
+
const fail = (reason) => failNativeRequired(capability, reason);
|
|
658
|
+
if (isNativeDisabledByEnv()) {
|
|
659
|
+
return fail('native disabled');
|
|
660
|
+
}
|
|
661
|
+
const fn = readNativeFunction(capability);
|
|
662
|
+
if (!fn) {
|
|
663
|
+
return fail();
|
|
664
|
+
}
|
|
665
|
+
const payloadJson = safeStringify({ state: input.state });
|
|
666
|
+
if (!payloadJson) {
|
|
667
|
+
return fail('json stringify failed');
|
|
668
|
+
}
|
|
669
|
+
try {
|
|
670
|
+
const raw = fn(payloadJson);
|
|
671
|
+
if (typeof raw !== 'string' || !raw) {
|
|
672
|
+
return fail('empty result');
|
|
673
|
+
}
|
|
674
|
+
const parsed = parseEnsureMessagesArrayOutput(raw);
|
|
675
|
+
return parsed ?? fail('invalid payload');
|
|
676
|
+
}
|
|
677
|
+
catch (error) {
|
|
678
|
+
const reason = error instanceof Error ? error.message : String(error ?? 'unknown');
|
|
679
|
+
return fail(reason);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
export function harvestToolsWithNative(input) {
|
|
683
|
+
const capability = 'harvestToolsJson';
|
|
684
|
+
const fail = (reason) => failNativeRequired(capability, reason);
|
|
685
|
+
if (isNativeDisabledByEnv()) {
|
|
686
|
+
return fail('native disabled');
|
|
687
|
+
}
|
|
688
|
+
const fn = readNativeFunction(capability);
|
|
689
|
+
if (!fn) {
|
|
690
|
+
return fail();
|
|
691
|
+
}
|
|
692
|
+
const payloadJson = safeStringify({ signal: input.signal, context: input.context });
|
|
693
|
+
if (!payloadJson) {
|
|
694
|
+
return fail('json stringify failed');
|
|
695
|
+
}
|
|
696
|
+
try {
|
|
697
|
+
const raw = fn(payloadJson);
|
|
698
|
+
if (typeof raw !== 'string' || !raw) {
|
|
699
|
+
return fail('empty result');
|
|
700
|
+
}
|
|
701
|
+
const parsed = JSON.parse(raw);
|
|
702
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
703
|
+
return fail('invalid payload');
|
|
704
|
+
}
|
|
705
|
+
const row = parsed;
|
|
706
|
+
if (!Array.isArray(row.deltaEvents)) {
|
|
707
|
+
return fail('invalid payload');
|
|
708
|
+
}
|
|
709
|
+
return row;
|
|
710
|
+
}
|
|
711
|
+
catch (error) {
|
|
712
|
+
const reason = error instanceof Error ? error.message : String(error ?? 'unknown');
|
|
713
|
+
return fail(reason);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
520
716
|
export function ensureBridgeOutputFieldsWithNative(input) {
|
|
521
717
|
const capability = 'ensureBridgeOutputFieldsJson';
|
|
522
718
|
const fail = (reason) => failNativeRequired(capability, reason);
|
package/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-inbound-semantics.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface NativeReqInboundChatToStandardizedInput {
|
|
|
13
13
|
endpoint: string;
|
|
14
14
|
requestId?: string;
|
|
15
15
|
}
|
|
16
|
+
export declare function pruneChatRequestPayloadWithNative(payload: Record<string, unknown>, preserveStreamField?: boolean): Record<string, unknown>;
|
|
16
17
|
export declare function sanitizeReqInboundFormatEnvelopeWithNative<T>(candidate: unknown): T;
|
|
17
18
|
export declare function mapReqInboundResumeToolOutputsDetailedWithNative(responsesResume: unknown): Array<{
|
|
18
19
|
tool_call_id: string;
|
package/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-inbound-semantics.js
CHANGED
|
@@ -87,6 +87,33 @@ function replaceRecord(target, source) {
|
|
|
87
87
|
}
|
|
88
88
|
Object.assign(target, source);
|
|
89
89
|
}
|
|
90
|
+
export function pruneChatRequestPayloadWithNative(payload, preserveStreamField = false) {
|
|
91
|
+
const capability = 'pruneChatRequestPayloadJson';
|
|
92
|
+
const fail = (reason) => failNativeRequired(capability, reason);
|
|
93
|
+
if (isNativeDisabledByEnv()) {
|
|
94
|
+
return fail('native disabled');
|
|
95
|
+
}
|
|
96
|
+
const fn = readNativeFunction(capability);
|
|
97
|
+
if (!fn) {
|
|
98
|
+
return fail();
|
|
99
|
+
}
|
|
100
|
+
const payloadJson = safeStringify({ payload, preserveStreamField });
|
|
101
|
+
if (!payloadJson) {
|
|
102
|
+
return fail('json stringify failed');
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
const raw = fn(payloadJson);
|
|
106
|
+
if (typeof raw !== 'string' || !raw) {
|
|
107
|
+
return fail('empty result');
|
|
108
|
+
}
|
|
109
|
+
const parsed = parseRecord(raw);
|
|
110
|
+
return parsed ?? fail('invalid payload');
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
const reason = error instanceof Error ? error.message : String(error ?? 'unknown');
|
|
114
|
+
return fail(reason);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
90
117
|
export function sanitizeReqInboundFormatEnvelopeWithNative(candidate) {
|
|
91
118
|
return sanitizeFormatEnvelopeWithNative(candidate);
|
|
92
119
|
}
|
|
@@ -51,6 +51,33 @@ const REQUIRED_NATIVE_EXPORTS = [
|
|
|
51
51
|
'applyBridgeCaptureToolResultsJson',
|
|
52
52
|
'applyBridgeNormalizeToolIdentifiersJson',
|
|
53
53
|
'applyBridgeEnsureToolPlaceholdersJson',
|
|
54
|
+
'convertBridgeInputToChatMessagesJson',
|
|
55
|
+
'coerceBridgeRoleJson',
|
|
56
|
+
'harvestToolsJson',
|
|
57
|
+
'serializeToolArgumentsJson',
|
|
58
|
+
'pruneChatRequestPayloadJson',
|
|
59
|
+
'enforceToolCallIdStyleJson',
|
|
60
|
+
'transformToolCallIdJson',
|
|
61
|
+
'createToolCallIdTransformerJson',
|
|
62
|
+
'extractToolCallIdJson',
|
|
63
|
+
'normalizeIdValueJson',
|
|
64
|
+
'extractStreamingToolCallsJson',
|
|
65
|
+
'chunkStringJson',
|
|
66
|
+
'flattenByCommaJson',
|
|
67
|
+
'packShellArgsJson',
|
|
68
|
+
'splitCommandStringJson',
|
|
69
|
+
'repairFindMetaJson',
|
|
70
|
+
'removeTrailingUnsignedThinkingBlocksJson',
|
|
71
|
+
'filterInvalidThinkingBlocksJson',
|
|
72
|
+
'sanitizeThinkingBlockJson',
|
|
73
|
+
'hasValidThoughtSignatureJson',
|
|
74
|
+
'serializeToolOutputJson',
|
|
75
|
+
'ensureMessagesArrayJson',
|
|
76
|
+
'normalizeReasoningInChatPayloadJson',
|
|
77
|
+
'normalizeReasoningInResponsesPayloadJson',
|
|
78
|
+
'normalizeReasoningInGeminiPayloadJson',
|
|
79
|
+
'normalizeReasoningInAnthropicPayloadJson',
|
|
80
|
+
'normalizeReasoningInOpenAIPayloadJson',
|
|
54
81
|
'buildContinueExecutionOperationsJson',
|
|
55
82
|
'buildDueReminderUserMessageJson',
|
|
56
83
|
'buildGovernedFilterPayloadJson',
|
|
@@ -67,8 +94,15 @@ const REQUIRED_NATIVE_EXPORTS = [
|
|
|
67
94
|
'mapOpenaiChatToChatJson',
|
|
68
95
|
'mapOpenaiChatFromChatJson',
|
|
69
96
|
'mapChatToolsToBridgeJson',
|
|
97
|
+
'bridgeToolToChatDefinitionJson',
|
|
98
|
+
'chatToolToBridgeDefinitionJson',
|
|
99
|
+
'mapBridgeToolsToChatWithOptionsJson',
|
|
100
|
+
'mapChatToolsToBridgeWithOptionsJson',
|
|
101
|
+
'collectToolCallsFromResponsesJson',
|
|
102
|
+
'resolveFinishReasonJson',
|
|
70
103
|
'captureReqInboundResponsesContextSnapshotJson',
|
|
71
104
|
'computeQuotaBucketsJson',
|
|
105
|
+
'extractReasoningSegmentsJson',
|
|
72
106
|
'deserializeStopMessageStateJson',
|
|
73
107
|
'detectProviderResponseShapeJson',
|
|
74
108
|
'extractClockReminderDirectivesJson',
|
|
@@ -135,6 +169,15 @@ const REQUIRED_NATIVE_EXPORTS = [
|
|
|
135
169
|
'normalizeChatResponseReasoningToolsJson',
|
|
136
170
|
'normalizeBridgeToolCallIdsJson',
|
|
137
171
|
'normalizeChatMessageContentJson',
|
|
172
|
+
'validateResponsePayloadJson',
|
|
173
|
+
'normalizeResponsePayloadJson',
|
|
174
|
+
'applyResponseBlacklistJson',
|
|
175
|
+
'normalizeToolCallIdsJson',
|
|
176
|
+
'normalizeResponsesToolCallIdsJson',
|
|
177
|
+
'resolveToolCallIdStyleJson',
|
|
178
|
+
'stripInternalToolingMetadataJson',
|
|
179
|
+
'enforceLmstudioResponsesFcToolCallIdsJson',
|
|
180
|
+
'applyRequestRulesJson',
|
|
138
181
|
'normalizeArgsBySchemaJson',
|
|
139
182
|
'normalizeToolsJson',
|
|
140
183
|
'normalizeFunctionCallIdJson',
|
|
@@ -206,6 +249,8 @@ const REQUIRED_NATIVE_EXPORTS = [
|
|
|
206
249
|
'deriveToolCallKeyJson',
|
|
207
250
|
'extractToolCallsFromReasoningTextJson',
|
|
208
251
|
'mapReasoningContentToResponsesOutputJson',
|
|
252
|
+
'validateToolArgumentsJson',
|
|
253
|
+
'repairToolCallsJson',
|
|
209
254
|
'isImagePathJson',
|
|
210
255
|
'resolveServerToolFollowupSnapshotJson',
|
|
211
256
|
'resolveSseStreamModeJson',
|
|
@@ -4,10 +4,56 @@ export declare function extractToolCallsFromReasoningTextWithNative(text: string
|
|
|
4
4
|
cleanedText: string;
|
|
5
5
|
toolCalls: Array<Record<string, unknown>>;
|
|
6
6
|
};
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function extractReasoningSegmentsWithNative(source: string): {
|
|
8
|
+
text: string;
|
|
9
|
+
segments: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare function normalizeAssistantTextToToolCallsWithNative(message: Record<string, unknown>, options?: Record<string, unknown>): Record<string, unknown>;
|
|
12
|
+
export declare function normalizeReasoningInChatPayloadWithNative(payload: unknown): unknown;
|
|
13
|
+
export declare function normalizeReasoningInResponsesPayloadWithNative(payload: unknown, options?: Record<string, unknown>): unknown;
|
|
14
|
+
export declare function normalizeReasoningInGeminiPayloadWithNative(payload: unknown): unknown;
|
|
15
|
+
export declare function normalizeReasoningInAnthropicPayloadWithNative(payload: unknown): unknown;
|
|
16
|
+
export declare function normalizeReasoningInOpenAIPayloadWithNative(payload: unknown): unknown;
|
|
17
|
+
export declare function bridgeToolToChatDefinitionWithNative(tool: Record<string, unknown>, options?: {
|
|
18
|
+
sanitizeMode?: string;
|
|
19
|
+
}): Record<string, unknown> | null;
|
|
20
|
+
export declare function chatToolToBridgeDefinitionWithNative(tool: Record<string, unknown>, options?: {
|
|
21
|
+
sanitizeMode?: string;
|
|
22
|
+
}): Record<string, unknown> | null;
|
|
23
|
+
export declare function mapBridgeToolsToChatWithNative(rawTools: unknown, options?: {
|
|
24
|
+
sanitizeMode?: string;
|
|
25
|
+
}): Array<Record<string, unknown>>;
|
|
26
|
+
export declare function mapChatToolsToBridgeWithNative(rawTools: unknown, options?: {
|
|
27
|
+
sanitizeMode?: string;
|
|
28
|
+
}): Array<Record<string, unknown>>;
|
|
29
|
+
export declare function collectToolCallsFromResponsesWithNative(response: Record<string, unknown>): Array<Record<string, unknown>>;
|
|
30
|
+
export declare function resolveFinishReasonWithNative(response: Record<string, unknown>, toolCalls: Array<Record<string, unknown>>): string;
|
|
31
|
+
export declare function hasValidThoughtSignatureWithNative(block: unknown, options?: Record<string, unknown>): boolean;
|
|
32
|
+
export declare function sanitizeThinkingBlockWithNative(block: unknown): Record<string, unknown>;
|
|
33
|
+
export declare function filterInvalidThinkingBlocksWithNative(messages: unknown, options?: Record<string, unknown>): unknown[];
|
|
34
|
+
export declare function removeTrailingUnsignedThinkingBlocksWithNative(blocks: unknown, options?: Record<string, unknown>): unknown[];
|
|
8
35
|
export declare function sanitizeReasoningTaggedTextWithNative(text: string): string;
|
|
9
36
|
export declare function ensureBridgeInstructionsWithNative(payload: Record<string, unknown>): Record<string, unknown>;
|
|
37
|
+
export declare function repairFindMetaWithNative(script: string): string;
|
|
38
|
+
export declare function splitCommandStringWithNative(input: string): string[];
|
|
39
|
+
export declare function packShellArgsWithNative(input: Record<string, unknown>): Record<string, unknown>;
|
|
40
|
+
export declare function flattenByCommaWithNative(items: string[]): string[];
|
|
41
|
+
export declare function chunkStringWithNative(s: string, minParts?: number, maxParts?: number, targetChunk?: number): string[];
|
|
10
42
|
export declare function deriveToolCallKeyWithNative(call: Record<string, unknown> | null | undefined): string | null;
|
|
43
|
+
export declare function normalizeIdValueWithNative(value: unknown, forceGenerate?: boolean): string;
|
|
44
|
+
export declare function extractToolCallIdWithNative(obj: unknown): string | undefined;
|
|
45
|
+
export declare function createToolCallIdTransformerWithNative(style: string): Record<string, unknown>;
|
|
46
|
+
export declare function transformToolCallIdWithNative(state: Record<string, unknown>, id: string): {
|
|
47
|
+
id: string;
|
|
48
|
+
state: Record<string, unknown>;
|
|
49
|
+
};
|
|
50
|
+
export declare function enforceToolCallIdStyleWithNative(messages: unknown[], state: Record<string, unknown>): {
|
|
51
|
+
messages: unknown[];
|
|
52
|
+
state: Record<string, unknown>;
|
|
53
|
+
};
|
|
54
|
+
export declare function normalizeResponsesToolCallIdsWithNative(payload: unknown): Record<string, unknown> | null;
|
|
55
|
+
export declare function resolveToolCallIdStyleWithNative(metadata: unknown): string;
|
|
56
|
+
export declare function stripInternalToolingMetadataWithNative(metadata: unknown): Record<string, unknown> | null;
|
|
11
57
|
export declare function buildProviderProtocolErrorWithNative(input: {
|
|
12
58
|
message: string;
|
|
13
59
|
code: string;
|
|
@@ -76,7 +122,30 @@ export declare function mapReasoningContentToResponsesOutputWithNative(reasoning
|
|
|
76
122
|
type: 'reasoning';
|
|
77
123
|
content: string;
|
|
78
124
|
}>;
|
|
125
|
+
export declare function validateToolArgumentsWithNative(toolName: string | undefined, args: unknown): {
|
|
126
|
+
repaired: string;
|
|
127
|
+
success: boolean;
|
|
128
|
+
error?: string;
|
|
129
|
+
};
|
|
130
|
+
export declare function repairToolCallsWithNative(toolCalls: Array<{
|
|
131
|
+
name?: string;
|
|
132
|
+
arguments?: unknown;
|
|
133
|
+
}>): Array<{
|
|
134
|
+
name?: string;
|
|
135
|
+
arguments: string;
|
|
136
|
+
}>;
|
|
79
137
|
export declare function isImagePathWithNative(pathValue: unknown): boolean;
|
|
138
|
+
export declare function extractStreamingToolCallsWithNative(input: {
|
|
139
|
+
buffer: string;
|
|
140
|
+
text: string;
|
|
141
|
+
idPrefix: string;
|
|
142
|
+
idCounter: number;
|
|
143
|
+
nowMs: number;
|
|
144
|
+
}): {
|
|
145
|
+
buffer: string;
|
|
146
|
+
idCounter: number;
|
|
147
|
+
toolCalls: Array<Record<string, unknown>>;
|
|
148
|
+
};
|
|
80
149
|
export declare function isCompactionRequestWithNative(payload: unknown): boolean;
|
|
81
150
|
export declare function encodeMetadataPassthroughWithNative(parameters: unknown, prefix: string, keys: readonly string[]): Record<string, string> | undefined;
|
|
82
151
|
export declare function extractMetadataPassthroughWithNative(metadataField: unknown, prefix: string, keys: readonly string[]): {
|