@jsonstudio/llms 0.4.2 → 0.4.4
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/README.md +3 -1
- package/dist/bridge/routecodex-adapter.js +6 -3
- package/dist/config-unified/enhanced-path-resolver.js +14 -6
- package/dist/config-unified/unified-config.js +103 -59
- package/dist/conversion/codec-registry.js +4 -2
- package/dist/conversion/hub/pipeline/hub-pipeline.js +4 -5
- package/dist/conversion/hub/process/chat-process.js +258 -41
- package/dist/conversion/hub/response/provider-response.js +8 -2
- package/dist/conversion/hub/tool-governance/engine.d.ts +16 -0
- package/dist/conversion/hub/tool-governance/engine.js +266 -0
- package/dist/conversion/hub/tool-governance/index.d.ts +3 -0
- package/dist/conversion/hub/tool-governance/index.js +2 -0
- package/dist/conversion/hub/tool-governance/rules.d.ts +2 -0
- package/dist/conversion/hub/tool-governance/rules.js +76 -0
- package/dist/conversion/hub/tool-governance/types.d.ts +38 -0
- package/dist/conversion/index.d.ts +1 -0
- package/dist/conversion/index.js +1 -0
- package/dist/conversion/responses/responses-openai-bridge.js +5 -3
- package/dist/conversion/shared/responses-id-utils.js +18 -5
- package/dist/sse/sse-to-json/builders/response-builder.js +2 -1
- package/dist/sse/sse-to-json/chat-sse-to-json-converter.js +37 -23
- package/dist/sse/sse-to-json/parsers/sse-parser.js +20 -12
- package/dist/sse/sse-to-json/responses-sse-to-json-converter.d.ts +1 -0
- package/dist/sse/sse-to-json/responses-sse-to-json-converter.js +10 -8
- package/dist/sse/types/chat-types.d.ts +9 -6
- package/dist/sse/types/conversion-context.d.ts +14 -11
- package/dist/sse/types/core-interfaces.d.ts +6 -2
- package/dist/sse/types/index.d.ts +1 -1
- package/dist/sse/types/responses-types.d.ts +20 -20
- package/dist/sse/types/sse-events.d.ts +4 -3
- package/dist/sse/types/stream-state.d.ts +34 -39
- package/dist/sse/types/utility-types.d.ts +47 -43
- package/dist/sse/types/utility-types.js +10 -13
- package/dist/tools/tool-registry.js +156 -98
- package/package.json +6 -6
- package/dist/api/index.d.ts +0 -10
- package/dist/api/index.js +0 -11
- package/dist/api/llmswitch-config.d.ts +0 -15
- package/dist/api/llmswitch-config.js +0 -415
- package/dist/api/llmswitch-types.d.ts +0 -412
- package/dist/api/llmswitch-types.js +0 -60
- package/dist/bridge/routecodex-adapter.d.ts +0 -74
- package/dist/config/index.d.ts +0 -3
- package/dist/config/index.js +0 -5
- package/dist/config-unified/enhanced-path-resolver.d.ts +0 -5
- package/dist/config-unified/unified-config.d.ts +0 -26
- package/dist/conversion/codec-registry.d.ts +0 -10
- package/dist/conversion/codecs/anthropic-openai-codec.d.ts +0 -23
- package/dist/conversion/codecs/gemini-openai-codec.d.ts +0 -16
- package/dist/conversion/codecs/openai-openai-codec.d.ts +0 -12
- package/dist/conversion/codecs/responses-openai-codec.d.ts +0 -12
- package/dist/conversion/config/config-manager.d.ts +0 -212
- package/dist/conversion/conversion-v3/adapters/index.d.ts +0 -2
- package/dist/conversion/conversion-v3/adapters/index.js +0 -1
- package/dist/conversion/conversion-v3/adapters/v3-to-standard-adapter.d.ts +0 -38
- package/dist/conversion/conversion-v3/adapters/v3-to-standard-adapter.js +0 -55
- package/dist/conversion/conversion-v3/compatibility/compatibility-profiles.d.ts +0 -22
- package/dist/conversion/conversion-v3/compatibility/compatibility-profiles.js +0 -84
- package/dist/conversion/conversion-v3/compatibility/compatibility-stages.d.ts +0 -4
- package/dist/conversion/conversion-v3/compatibility/compatibility-stages.js +0 -285
- package/dist/conversion/conversion-v3/compatibility/index.d.ts +0 -3
- package/dist/conversion/conversion-v3/compatibility/index.js +0 -2
- package/dist/conversion/conversion-v3/config/default-configs.d.ts +0 -48
- package/dist/conversion/conversion-v3/config/default-configs.js +0 -1083
- package/dist/conversion/conversion-v3/config/index.d.ts +0 -5
- package/dist/conversion/conversion-v3/config/index.js +0 -5
- package/dist/conversion/conversion-v3/config/pipeline-config-manager.d.ts +0 -49
- package/dist/conversion/conversion-v3/config/pipeline-config-manager.js +0 -65
- package/dist/conversion/conversion-v3/index.d.ts +0 -11
- package/dist/conversion/conversion-v3/index.js +0 -17
- package/dist/conversion/conversion-v3/nodes/index.d.ts +0 -56
- package/dist/conversion/conversion-v3/nodes/index.js +0 -149
- package/dist/conversion/conversion-v3/nodes/input/anthropic-input-node.d.ts +0 -25
- package/dist/conversion/conversion-v3/nodes/input/anthropic-input-node.js +0 -56
- package/dist/conversion/conversion-v3/nodes/input/base-input-node.d.ts +0 -75
- package/dist/conversion/conversion-v3/nodes/input/base-input-node.js +0 -237
- package/dist/conversion/conversion-v3/nodes/input/chat-input-node.d.ts +0 -25
- package/dist/conversion/conversion-v3/nodes/input/chat-input-node.js +0 -56
- package/dist/conversion/conversion-v3/nodes/input/chat-shape-helpers.d.ts +0 -4
- package/dist/conversion/conversion-v3/nodes/input/chat-shape-helpers.js +0 -197
- package/dist/conversion/conversion-v3/nodes/input/gemini-input-node.d.ts +0 -16
- package/dist/conversion/conversion-v3/nodes/input/gemini-input-node.js +0 -125
- package/dist/conversion/conversion-v3/nodes/input/index.d.ts +0 -8
- package/dist/conversion/conversion-v3/nodes/input/index.js +0 -8
- package/dist/conversion/conversion-v3/nodes/input/input-decision.d.ts +0 -46
- package/dist/conversion/conversion-v3/nodes/input/input-decision.js +0 -125
- package/dist/conversion/conversion-v3/nodes/input/responses-input-node.d.ts +0 -20
- package/dist/conversion/conversion-v3/nodes/input/responses-input-node.js +0 -51
- package/dist/conversion/conversion-v3/nodes/output/anthropic-output-node.d.ts +0 -71
- package/dist/conversion/conversion-v3/nodes/output/anthropic-output-node.js +0 -320
- package/dist/conversion/conversion-v3/nodes/output/base-output-node.d.ts +0 -116
- package/dist/conversion/conversion-v3/nodes/output/base-output-node.js +0 -512
- package/dist/conversion/conversion-v3/nodes/output/index.d.ts +0 -7
- package/dist/conversion/conversion-v3/nodes/output/index.js +0 -7
- package/dist/conversion/conversion-v3/nodes/output/openai-output-node.d.ts +0 -71
- package/dist/conversion/conversion-v3/nodes/output/openai-output-node.js +0 -293
- package/dist/conversion/conversion-v3/nodes/output/output-decision.d.ts +0 -68
- package/dist/conversion/conversion-v3/nodes/output/output-decision.js +0 -161
- package/dist/conversion/conversion-v3/nodes/output/responses-output-node.d.ts +0 -64
- package/dist/conversion/conversion-v3/nodes/output/responses-output-node.js +0 -323
- package/dist/conversion/conversion-v3/nodes/process/base-process-node.d.ts +0 -72
- package/dist/conversion/conversion-v3/nodes/process/base-process-node.js +0 -246
- package/dist/conversion/conversion-v3/nodes/process/chat-process-node.d.ts +0 -135
- package/dist/conversion/conversion-v3/nodes/process/chat-process-node.js +0 -854
- package/dist/conversion/conversion-v3/nodes/process/compatibility-process-node.d.ts +0 -29
- package/dist/conversion/conversion-v3/nodes/process/compatibility-process-node.js +0 -181
- package/dist/conversion/conversion-v3/nodes/process/index.d.ts +0 -10
- package/dist/conversion/conversion-v3/nodes/process/index.js +0 -10
- package/dist/conversion/conversion-v3/nodes/process/passthrough-process-node.d.ts +0 -59
- package/dist/conversion/conversion-v3/nodes/process/passthrough-process-node.js +0 -243
- package/dist/conversion/conversion-v3/nodes/process/response-process-node.d.ts +0 -17
- package/dist/conversion/conversion-v3/nodes/process/response-process-node.js +0 -213
- package/dist/conversion/conversion-v3/nodes/process/tool-process-node.d.ts +0 -26
- package/dist/conversion/conversion-v3/nodes/process/tool-process-node.js +0 -299
- package/dist/conversion/conversion-v3/nodes/process/virtual-router-process-node.d.ts +0 -40
- package/dist/conversion/conversion-v3/nodes/process/virtual-router-process-node.js +0 -430
- package/dist/conversion/conversion-v3/nodes/response/anthropic-response-input-node.d.ts +0 -12
- package/dist/conversion/conversion-v3/nodes/response/anthropic-response-input-node.js +0 -129
- package/dist/conversion/conversion-v3/nodes/response/chat-to-responses-response-node.d.ts +0 -15
- package/dist/conversion/conversion-v3/nodes/response/chat-to-responses-response-node.js +0 -57
- package/dist/conversion/conversion-v3/nodes/response/index.d.ts +0 -4
- package/dist/conversion/conversion-v3/nodes/response/index.js +0 -4
- package/dist/conversion/conversion-v3/nodes/response/openai-response-input-node.d.ts +0 -15
- package/dist/conversion/conversion-v3/nodes/response/openai-response-input-node.js +0 -87
- package/dist/conversion/conversion-v3/nodes/response/response-utils.d.ts +0 -1
- package/dist/conversion/conversion-v3/nodes/response/response-utils.js +0 -1
- package/dist/conversion/conversion-v3/nodes/response/responses-response-input-node.d.ts +0 -12
- package/dist/conversion/conversion-v3/nodes/response/responses-response-input-node.js +0 -67
- package/dist/conversion/conversion-v3/nodes/sse/index.d.ts +0 -3
- package/dist/conversion/conversion-v3/nodes/sse/index.js +0 -3
- package/dist/conversion/conversion-v3/nodes/sse/sse-input-node.d.ts +0 -27
- package/dist/conversion/conversion-v3/nodes/sse/sse-input-node.js +0 -165
- package/dist/conversion/conversion-v3/nodes/sse/sse-output-node.d.ts +0 -19
- package/dist/conversion/conversion-v3/nodes/sse/sse-output-node.js +0 -267
- package/dist/conversion/conversion-v3/nodes/sse/sse-passthrough-node.d.ts +0 -18
- package/dist/conversion/conversion-v3/nodes/sse/sse-passthrough-node.js +0 -48
- package/dist/conversion/conversion-v3/pipelines/index.d.ts +0 -6
- package/dist/conversion/conversion-v3/pipelines/index.js +0 -6
- package/dist/conversion/conversion-v3/pipelines/super-pipeline.d.ts +0 -112
- package/dist/conversion/conversion-v3/pipelines/super-pipeline.js +0 -566
- package/dist/conversion/conversion-v3/response/provider-response-converter.d.ts +0 -28
- package/dist/conversion/conversion-v3/response/provider-response-converter.js +0 -249
- package/dist/conversion/conversion-v3/sse/index.d.ts +0 -140
- package/dist/conversion/conversion-v3/sse/index.js +0 -115
- package/dist/conversion/conversion-v3/sse/json-to-sse/anthropic-json-to-sse-converter.d.ts +0 -11
- package/dist/conversion/conversion-v3/sse/json-to-sse/anthropic-json-to-sse-converter.js +0 -79
- package/dist/conversion/conversion-v3/sse/json-to-sse/chat-json-to-sse-converter.d.ts +0 -79
- package/dist/conversion/conversion-v3/sse/json-to-sse/chat-json-to-sse-converter.js +0 -296
- package/dist/conversion/conversion-v3/sse/json-to-sse/event-generators/chat.d.ts +0 -55
- package/dist/conversion/conversion-v3/sse/json-to-sse/event-generators/chat.js +0 -233
- package/dist/conversion/conversion-v3/sse/json-to-sse/event-generators/responses.d.ts +0 -99
- package/dist/conversion/conversion-v3/sse/json-to-sse/event-generators/responses.js +0 -599
- package/dist/conversion/conversion-v3/sse/json-to-sse/index.d.ts +0 -6
- package/dist/conversion/conversion-v3/sse/json-to-sse/index.js +0 -7
- package/dist/conversion/conversion-v3/sse/json-to-sse/responses-json-to-sse-converter.d.ts +0 -79
- package/dist/conversion/conversion-v3/sse/json-to-sse/responses-json-to-sse-converter.js +0 -322
- package/dist/conversion/conversion-v3/sse/json-to-sse/sequencers/chat-sequencer.d.ts +0 -37
- package/dist/conversion/conversion-v3/sse/json-to-sse/sequencers/chat-sequencer.js +0 -218
- package/dist/conversion/conversion-v3/sse/json-to-sse/sequencers/responses-sequencer.d.ts +0 -40
- package/dist/conversion/conversion-v3/sse/json-to-sse/sequencers/responses-sequencer.js +0 -263
- package/dist/conversion/conversion-v3/sse/registry/sse-codec-registry.d.ts +0 -32
- package/dist/conversion/conversion-v3/sse/registry/sse-codec-registry.js +0 -106
- package/dist/conversion/conversion-v3/sse/shared/chat-serializer.d.ts +0 -4
- package/dist/conversion/conversion-v3/sse/shared/chat-serializer.js +0 -40
- package/dist/conversion/conversion-v3/sse/shared/constants.d.ts +0 -272
- package/dist/conversion/conversion-v3/sse/shared/constants.js +0 -321
- package/dist/conversion/conversion-v3/sse/shared/serializers/base-serializer.d.ts +0 -158
- package/dist/conversion/conversion-v3/sse/shared/serializers/base-serializer.js +0 -210
- package/dist/conversion/conversion-v3/sse/shared/serializers/chat-event-serializer.d.ts +0 -82
- package/dist/conversion/conversion-v3/sse/shared/serializers/chat-event-serializer.js +0 -275
- package/dist/conversion/conversion-v3/sse/shared/serializers/index.d.ts +0 -39
- package/dist/conversion/conversion-v3/sse/shared/serializers/index.js +0 -54
- package/dist/conversion/conversion-v3/sse/shared/serializers/responses-event-serializer.d.ts +0 -123
- package/dist/conversion/conversion-v3/sse/shared/serializers/responses-event-serializer.js +0 -356
- package/dist/conversion/conversion-v3/sse/shared/serializers/types.d.ts +0 -51
- package/dist/conversion/conversion-v3/sse/shared/serializers/types.js +0 -4
- package/dist/conversion/conversion-v3/sse/shared/utils.d.ts +0 -254
- package/dist/conversion/conversion-v3/sse/shared/utils.js +0 -543
- package/dist/conversion/conversion-v3/sse/shared/writer.d.ts +0 -111
- package/dist/conversion/conversion-v3/sse/shared/writer.js +0 -268
- package/dist/conversion/conversion-v3/sse/sse-to-json/anthropic-sse-to-json-converter.d.ts +0 -13
- package/dist/conversion/conversion-v3/sse/sse-to-json/anthropic-sse-to-json-converter.js +0 -139
- package/dist/conversion/conversion-v3/sse/sse-to-json/builders/response-builder.d.ts +0 -165
- package/dist/conversion/conversion-v3/sse/sse-to-json/builders/response-builder.js +0 -776
- package/dist/conversion/conversion-v3/sse/sse-to-json/chat-sse-to-json-converter.d.ts +0 -106
- package/dist/conversion/conversion-v3/sse/sse-to-json/chat-sse-to-json-converter.js +0 -540
- package/dist/conversion/conversion-v3/sse/sse-to-json/index.d.ts +0 -6
- package/dist/conversion/conversion-v3/sse/sse-to-json/index.js +0 -7
- package/dist/conversion/conversion-v3/sse/sse-to-json/parsers/sse-parser.d.ts +0 -73
- package/dist/conversion/conversion-v3/sse/sse-to-json/parsers/sse-parser.js +0 -332
- package/dist/conversion/conversion-v3/sse/sse-to-json/responses-sse-to-json-converter.d.ts +0 -59
- package/dist/conversion/conversion-v3/sse/sse-to-json/responses-sse-to-json-converter.js +0 -270
- package/dist/conversion/conversion-v3/sse/types/anthropic-types.d.ts +0 -87
- package/dist/conversion/conversion-v3/sse/types/anthropic-types.js +0 -5
- package/dist/conversion/conversion-v3/sse/types/chat-types.d.ts +0 -308
- package/dist/conversion/conversion-v3/sse/types/chat-types.js +0 -32
- package/dist/conversion/conversion-v3/sse/types/conversion-context.d.ts +0 -211
- package/dist/conversion/conversion-v3/sse/types/conversion-context.js +0 -20
- package/dist/conversion/conversion-v3/sse/types/core-interfaces.d.ts +0 -90
- package/dist/conversion/conversion-v3/sse/types/core-interfaces.js +0 -5
- package/dist/conversion/conversion-v3/sse/types/index.d.ts +0 -14
- package/dist/conversion/conversion-v3/sse/types/index.js +0 -7
- package/dist/conversion/conversion-v3/sse/types/responses-types.d.ts +0 -328
- package/dist/conversion/conversion-v3/sse/types/responses-types.js +0 -38
- package/dist/conversion/conversion-v3/sse/types/sse-events.d.ts +0 -180
- package/dist/conversion/conversion-v3/sse/types/sse-events.js +0 -150
- package/dist/conversion/conversion-v3/sse/types/stream-state.d.ts +0 -204
- package/dist/conversion/conversion-v3/sse/types/stream-state.js +0 -44
- package/dist/conversion/conversion-v3/sse/types/utility-types.d.ts +0 -230
- package/dist/conversion/conversion-v3/sse/types/utility-types.js +0 -49
- package/dist/conversion/conversion-v3/standards/context-adapter.d.ts +0 -146
- package/dist/conversion/conversion-v3/standards/context-adapter.js +0 -438
- package/dist/conversion/conversion-v3/standards/errors.d.ts +0 -38
- package/dist/conversion/conversion-v3/standards/errors.js +0 -27
- package/dist/conversion/conversion-v3/standards/index.d.ts +0 -15
- package/dist/conversion/conversion-v3/standards/index.js +0 -11
- package/dist/conversion/conversion-v3/standards/node-capabilities.d.ts +0 -123
- package/dist/conversion/conversion-v3/standards/node-capabilities.js +0 -330
- package/dist/conversion/conversion-v3/standards/pipeline-context.d.ts +0 -237
- package/dist/conversion/conversion-v3/standards/pipeline-context.js +0 -84
- package/dist/conversion/conversion-v3/standards/pipeline-node.d.ts +0 -196
- package/dist/conversion/conversion-v3/standards/pipeline-node.js +0 -316
- package/dist/conversion/conversion-v3/standards/snapshot-handles.d.ts +0 -24
- package/dist/conversion/conversion-v3/standards/snapshot-handles.js +0 -49
- package/dist/conversion/conversion-v3/types/config-types.d.ts +0 -242
- package/dist/conversion/conversion-v3/types/config-types.js +0 -13
- package/dist/conversion/conversion-v3/types/index.d.ts +0 -8
- package/dist/conversion/conversion-v3/types/index.js +0 -11
- package/dist/conversion/conversion-v3/types/node-types.d.ts +0 -211
- package/dist/conversion/conversion-v3/types/node-types.js +0 -20
- package/dist/conversion/conversion-v3/types/pipeline-types.d.ts +0 -246
- package/dist/conversion/conversion-v3/types/pipeline-types.js +0 -26
- package/dist/conversion/conversion-v3/types/request-types.d.ts +0 -293
- package/dist/conversion/conversion-v3/types/request-types.js +0 -26
- package/dist/conversion/conversion-v3/utils/provider-payload-sanitizer.d.ts +0 -10
- package/dist/conversion/conversion-v3/utils/provider-payload-sanitizer.js +0 -103
- package/dist/conversion/conversion-v3/validations/index.d.ts +0 -8
- package/dist/conversion/conversion-v3/validations/index.js +0 -7
- package/dist/conversion/conversion-v3/validations/node-graph-validator.d.ts +0 -116
- package/dist/conversion/conversion-v3/validations/node-graph-validator.js +0 -505
- package/dist/conversion/conversion-v3/validations/tool-governance-enforcer.d.ts +0 -139
- package/dist/conversion/conversion-v3/validations/tool-governance-enforcer.js +0 -338
- package/dist/conversion/hub/config/types.d.ts +0 -26
- package/dist/conversion/hub/core/detour-registry.d.ts +0 -9
- package/dist/conversion/hub/core/hub-context.d.ts +0 -21
- package/dist/conversion/hub/core/index.d.ts +0 -3
- package/dist/conversion/hub/core/stage-driver.d.ts +0 -30
- package/dist/conversion/hub/format-adapters/anthropic-format-adapter.d.ts +0 -16
- package/dist/conversion/hub/format-adapters/chat-format-adapter.d.ts +0 -17
- package/dist/conversion/hub/format-adapters/gemini-format-adapter.d.ts +0 -16
- package/dist/conversion/hub/format-adapters/index.d.ts +0 -21
- package/dist/conversion/hub/format-adapters/responses-format-adapter.d.ts +0 -17
- package/dist/conversion/hub/hub-feature.d.ts +0 -1
- package/dist/conversion/hub/node-support.d.ts +0 -19
- package/dist/conversion/hub/pipeline/hub-pipeline.d.ts +0 -68
- package/dist/conversion/hub/pipelines/inbound.d.ts +0 -22
- package/dist/conversion/hub/pipelines/outbound.d.ts +0 -22
- package/dist/conversion/hub/process/chat-process.d.ts +0 -13
- package/dist/conversion/hub/registry.d.ts +0 -28
- package/dist/conversion/hub/response/chat-response-utils.d.ts +0 -6
- package/dist/conversion/hub/response/provider-response.d.ts +0 -20
- package/dist/conversion/hub/response/response-mappers.d.ts +0 -19
- package/dist/conversion/hub/response/response-runtime.d.ts +0 -3
- package/dist/conversion/hub/semantic-mappers/anthropic-mapper.d.ts +0 -7
- package/dist/conversion/hub/semantic-mappers/chat-mapper.d.ts +0 -7
- package/dist/conversion/hub/semantic-mappers/gemini-mapper.d.ts +0 -7
- package/dist/conversion/hub/semantic-mappers/index.d.ts +0 -4
- package/dist/conversion/hub/semantic-mappers/responses-mapper.d.ts +0 -21
- package/dist/conversion/hub/snapshot-recorder.d.ts +0 -12
- package/dist/conversion/hub/standardized-bridge.d.ts +0 -12
- package/dist/conversion/hub/types/chat-envelope.d.ts +0 -67
- package/dist/conversion/hub/types/chat-schema.d.ts +0 -112
- package/dist/conversion/hub/types/errors.d.ts +0 -5
- package/dist/conversion/hub/types/format-envelope.d.ts +0 -7
- package/dist/conversion/hub/types/index.d.ts +0 -6
- package/dist/conversion/hub/types/json.d.ts +0 -9
- package/dist/conversion/hub/types/node.d.ts +0 -31
- package/dist/conversion/hub/types/standardized.d.ts +0 -94
- package/dist/conversion/responses/responses-openai-bridge.d.ts +0 -95
- package/dist/conversion/schema-validator.d.ts +0 -7
- package/dist/conversion/shared/args-mapping.d.ts +0 -18
- package/dist/conversion/shared/chat-request-filters.d.ts +0 -9
- package/dist/conversion/shared/jsonish.d.ts +0 -3
- package/dist/conversion/shared/mcp-injection.d.ts +0 -2
- package/dist/conversion/shared/media.d.ts +0 -1
- package/dist/conversion/shared/openai-finalizer.d.ts +0 -9
- package/dist/conversion/shared/openai-message-normalize.d.ts +0 -1
- package/dist/conversion/shared/payload-budget.d.ts +0 -13
- package/dist/conversion/shared/reasoning-mapping.d.ts +0 -5
- package/dist/conversion/shared/responses-conversation-store.d.ts +0 -41
- package/dist/conversion/shared/responses-id-utils.d.ts +0 -7
- package/dist/conversion/shared/responses-instructions.d.ts +0 -1
- package/dist/conversion/shared/responses-metadata.d.ts +0 -1
- package/dist/conversion/shared/responses-request-adapter.d.ts +0 -66
- package/dist/conversion/shared/snapshot-hooks.d.ts +0 -12
- package/dist/conversion/shared/streaming-text-extractor.d.ts +0 -26
- package/dist/conversion/shared/text-markup-normalizer.d.ts +0 -9
- package/dist/conversion/shared/tool-canonicalizer.d.ts +0 -2
- package/dist/conversion/shared/tool-filter-pipeline.d.ts +0 -17
- package/dist/conversion/shared/tool-governor.d.ts +0 -27
- package/dist/conversion/shared/tool-harvester.d.ts +0 -31
- package/dist/conversion/shared/tool-mapping.d.ts +0 -10
- package/dist/conversion/shared/tooling.d.ts +0 -26
- package/dist/conversion/types.d.ts +0 -33
- package/dist/core/index.d.ts +0 -6
- package/dist/core/index.js +0 -9
- package/dist/core/llmswitch-engine-v2.d.ts +0 -132
- package/dist/core/llmswitch-engine-v2.js +0 -649
- package/dist/core/llmswitch-factory-v2.d.ts +0 -123
- package/dist/core/llmswitch-factory-v2.js +0 -521
- package/dist/endpoints/base-endpoint-handler.d.ts +0 -128
- package/dist/endpoints/base-endpoint-handler.js +0 -545
- package/dist/endpoints/chat-endpoint-handler.d.ts +0 -115
- package/dist/endpoints/chat-endpoint-handler.js +0 -218
- package/dist/endpoints/endpoint-router.d.ts +0 -127
- package/dist/endpoints/endpoint-router.js +0 -438
- package/dist/endpoints/index.d.ts +0 -13
- package/dist/endpoints/index.js +0 -11
- package/dist/endpoints/messages-endpoint-handler.d.ts +0 -171
- package/dist/endpoints/messages-endpoint-handler.js +0 -238
- package/dist/endpoints/responses-endpoint-handler.d.ts +0 -147
- package/dist/endpoints/responses-endpoint-handler.js +0 -233
- package/dist/filters/builtin/add-fields-filter.d.ts +0 -8
- package/dist/filters/builtin/blacklist-filter.d.ts +0 -8
- package/dist/filters/builtin/whitelist-filter.d.ts +0 -8
- package/dist/filters/engine.d.ts +0 -16
- package/dist/filters/index.d.ts +0 -19
- package/dist/filters/special/request-streaming-to-nonstreaming.d.ts +0 -12
- package/dist/filters/special/request-tool-choice-policy.d.ts +0 -11
- package/dist/filters/special/request-tool-list-filter.d.ts +0 -11
- package/dist/filters/special/request-toolcalls-stringify.d.ts +0 -10
- package/dist/filters/special/request-tools-normalize.d.ts +0 -12
- package/dist/filters/special/response-finish-invariants.d.ts +0 -11
- package/dist/filters/special/response-openai-to-responses-bridge.d.ts +0 -13
- package/dist/filters/special/response-tool-arguments-blacklist.d.ts +0 -12
- package/dist/filters/special/response-tool-arguments-schema-converge.d.ts +0 -13
- package/dist/filters/special/response-tool-arguments-stringify.d.ts +0 -9
- package/dist/filters/special/response-tool-arguments-toon-decode.d.ts +0 -10
- package/dist/filters/special/response-tool-arguments-whitelist.d.ts +0 -11
- package/dist/filters/special/response-tool-text-canonicalize.d.ts +0 -10
- package/dist/filters/special/tool-filter-hooks.d.ts +0 -19
- package/dist/filters/special/tool-post-constraints.d.ts +0 -31
- package/dist/filters/types.d.ts +0 -68
- package/dist/filters/utils/fieldmap-loader.d.ts +0 -2
- package/dist/filters/utils/snapshot-writer.d.ts +0 -10
- package/dist/guidance/index.d.ts +0 -3
- package/dist/hooks/hooks-integration.d.ts +0 -161
- package/dist/hooks/hooks-integration.js +0 -519
- package/dist/hooks/index.d.ts +0 -10
- package/dist/hooks/index.js +0 -13
- package/dist/html-to-markdown.d.ts +0 -5
- package/dist/html-to-markdown.js +0 -66
- package/dist/http/sse-response.d.ts +0 -22
- package/dist/router/virtual-router/bootstrap.d.ts +0 -6
- package/dist/router/virtual-router/classifier.d.ts +0 -10
- package/dist/router/virtual-router/engine.d.ts +0 -35
- package/dist/router/virtual-router/error-center.d.ts +0 -10
- package/dist/router/virtual-router/features.d.ts +0 -3
- package/dist/router/virtual-router/health-manager.d.ts +0 -18
- package/dist/router/virtual-router/load-balancer.d.ts +0 -18
- package/dist/router/virtual-router/provider-registry.d.ts +0 -11
- package/dist/router/virtual-router/types.d.ts +0 -206
- package/dist/sse/json-to-sse/anthropic-json-to-sse-converter.d.ts +0 -11
- package/dist/sse/json-to-sse/chat-json-to-sse-converter.d.ts +0 -79
- package/dist/sse/json-to-sse/event-generators/chat.d.ts +0 -55
- package/dist/sse/json-to-sse/event-generators/responses.d.ts +0 -99
- package/dist/sse/json-to-sse/index.d.ts +0 -6
- package/dist/sse/json-to-sse/responses-json-to-sse-converter.d.ts +0 -79
- package/dist/sse/json-to-sse/sequencers/chat-sequencer.d.ts +0 -37
- package/dist/sse/json-to-sse/sequencers/responses-sequencer.d.ts +0 -40
- package/dist/sse/registry/sse-codec-registry.d.ts +0 -32
- package/dist/sse/shared/chat-serializer.d.ts +0 -4
- package/dist/sse/shared/constants.d.ts +0 -272
- package/dist/sse/shared/serializers/base-serializer.d.ts +0 -158
- package/dist/sse/shared/serializers/chat-event-serializer.d.ts +0 -82
- package/dist/sse/shared/serializers/index.d.ts +0 -39
- package/dist/sse/shared/serializers/responses-event-serializer.d.ts +0 -123
- package/dist/sse/shared/serializers/types.d.ts +0 -51
- package/dist/sse/shared/utils.d.ts +0 -254
- package/dist/sse/shared/writer.d.ts +0 -111
- package/dist/sse/sse-to-json/anthropic-sse-to-json-converter.d.ts +0 -13
- package/dist/sse/sse-to-json/builders/response-builder.d.ts +0 -165
- package/dist/sse/sse-to-json/chat-sse-to-json-converter.d.ts +0 -106
- package/dist/sse/sse-to-json/index.d.ts +0 -6
- package/dist/sse/sse-to-json/parsers/sse-parser.d.ts +0 -73
- package/dist/sse/types/anthropic-types.d.ts +0 -87
- package/dist/tools/proxy/anthropic-tool-proxy.d.ts +0 -19
- package/dist/tools/proxy/anthropic-tool-proxy.js +0 -57
- package/dist/tools/proxy/executors/web-fetch.d.ts +0 -6
- package/dist/tools/proxy/executors/web-fetch.js +0 -39
- package/dist/tools/proxy/registry.d.ts +0 -8
- package/dist/tools/proxy/registry.js +0 -14
- package/dist/tools/proxy/types.d.ts +0 -29
- package/dist/tools/tool-registry.d.ts +0 -8
- package/dist/tools/web-fetch-html.d.ts +0 -15
- package/dist/tools/web-fetch-html.js +0 -83
- package/dist/utils/conversion-adapter.d.ts +0 -65
- package/dist/utils/conversion-adapter.js +0 -183
- package/dist/utils/error-factory.d.ts +0 -88
- package/dist/utils/error-factory.js +0 -138
- package/dist/utils/error-utils.d.ts +0 -334
- package/dist/utils/error-utils.js +0 -782
- package/dist/utils/index.d.ts +0 -8
- package/dist/utils/index.js +0 -13
- package/dist/utils/performance-utils.d.ts +0 -205
- package/dist/utils/performance-utils.js +0 -440
- package/dist/utils/profile-mapper.d.ts +0 -32
- package/dist/utils/profile-mapper.js +0 -269
- package/dist/utils/request-processor.d.ts +0 -52
- package/dist/utils/request-processor.js +0 -210
- package/dist/utils/request-utils.d.ts +0 -117
- package/dist/utils/request-utils.js +0 -333
- package/dist/utils/response-utils.d.ts +0 -127
- package/dist/utils/response-utils.js +0 -516
- package/dist/utils/token-counter.d.ts +0 -89
- package/dist/utils/token-counter.js +0 -541
- /package/dist/{tools/proxy → conversion/hub/tool-governance}/types.js +0 -0
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
export type ResponsesContentPart = {
|
|
2
|
-
type: string;
|
|
3
|
-
text?: string;
|
|
4
|
-
content?: unknown;
|
|
5
|
-
};
|
|
6
|
-
export type ResponsesInputItem = {
|
|
7
|
-
type: string;
|
|
8
|
-
role?: string;
|
|
9
|
-
content?: Array<ResponsesContentPart> | null;
|
|
10
|
-
name?: string;
|
|
11
|
-
arguments?: unknown;
|
|
12
|
-
call_id?: string;
|
|
13
|
-
output?: unknown;
|
|
14
|
-
function?: {
|
|
15
|
-
name?: string;
|
|
16
|
-
arguments?: unknown;
|
|
17
|
-
};
|
|
18
|
-
message?: {
|
|
19
|
-
role?: string;
|
|
20
|
-
content?: Array<ResponsesContentPart>;
|
|
21
|
-
};
|
|
22
|
-
id?: string;
|
|
23
|
-
tool_call_id?: string;
|
|
24
|
-
tool_use_id?: string;
|
|
25
|
-
text?: string;
|
|
26
|
-
};
|
|
27
|
-
export type ResponsesToolDefinition = {
|
|
28
|
-
type: string;
|
|
29
|
-
name?: string;
|
|
30
|
-
description?: string;
|
|
31
|
-
strict?: boolean;
|
|
32
|
-
parameters?: unknown;
|
|
33
|
-
};
|
|
34
|
-
export interface ResponsesRequestContext {
|
|
35
|
-
requestId?: string;
|
|
36
|
-
instructions?: string;
|
|
37
|
-
originalSystemMessages?: string[];
|
|
38
|
-
input?: ResponsesInputItem[];
|
|
39
|
-
include?: unknown;
|
|
40
|
-
store?: unknown;
|
|
41
|
-
toolChoice?: unknown;
|
|
42
|
-
parallelToolCalls?: boolean;
|
|
43
|
-
metadata?: Record<string, unknown> | undefined;
|
|
44
|
-
responseFormat?: unknown;
|
|
45
|
-
stream?: boolean;
|
|
46
|
-
instructionsIsRaw?: boolean;
|
|
47
|
-
isChatPayload?: boolean;
|
|
48
|
-
isResponsesPayload?: boolean;
|
|
49
|
-
historyMessages?: Array<{
|
|
50
|
-
role: string;
|
|
51
|
-
content: string;
|
|
52
|
-
}>;
|
|
53
|
-
currentMessage?: {
|
|
54
|
-
role: string;
|
|
55
|
-
content: string;
|
|
56
|
-
} | null;
|
|
57
|
-
toolsRaw?: ResponsesToolDefinition[];
|
|
58
|
-
toolsNormalized?: Array<Record<string, unknown>>;
|
|
59
|
-
}
|
|
60
|
-
export interface BuildChatRequestResult {
|
|
61
|
-
request: Record<string, unknown>;
|
|
62
|
-
toolsNormalized?: Array<Record<string, unknown>>;
|
|
63
|
-
}
|
|
64
|
-
export interface BuildResponsesRequestResult {
|
|
65
|
-
request: Record<string, unknown>;
|
|
66
|
-
originalSystemMessages?: string[];
|
|
67
|
-
}
|
|
68
|
-
export declare function captureResponsesContext(payload: Record<string, unknown>, dto?: {
|
|
69
|
-
route?: {
|
|
70
|
-
requestId?: string;
|
|
71
|
-
};
|
|
72
|
-
}): ResponsesRequestContext;
|
|
73
|
-
export declare function buildChatRequestFromResponses(payload: Record<string, unknown>, context: ResponsesRequestContext): BuildChatRequestResult;
|
|
74
|
-
/**
|
|
75
|
-
* Chat 请求 → Responses 请求(非流),用于 V3 process=chat 且 providerWire=responses 的请求编码。
|
|
76
|
-
*
|
|
77
|
-
* 设计目标:
|
|
78
|
-
* - 保留 model / tools / tool_choice / parallel_tool_calls 等字段;
|
|
79
|
-
* - 将 system 消息折叠到 instructions;
|
|
80
|
-
* - 将 user/assistant/tool 消息编码为 input[] 中的 message 块,使得 mapResponsesInputToChat 能够还原为等价 Chat 请求。
|
|
81
|
-
*/
|
|
82
|
-
export declare function buildResponsesRequestFromChat(payload: Record<string, unknown>, ctx?: ResponsesRequestContext): BuildResponsesRequestResult;
|
|
83
|
-
export declare function buildResponsesPayloadFromChat(payload: unknown, context?: ResponsesRequestContext): Record<string, unknown> | unknown;
|
|
84
|
-
export declare function extractRequestIdFromResponse(response: any): string | undefined;
|
|
85
|
-
/**
|
|
86
|
-
* 将非流式 ResponsesResponse 形状还原为等价的 ChatResponse 形状(用于闭环测试)。
|
|
87
|
-
*
|
|
88
|
-
* - id / model / created(_at) / usage → 直接透传
|
|
89
|
-
* - output_text / output[] → choices[0].message.content
|
|
90
|
-
* - required_action.submit_tool_outputs.tool_calls → choices[0].message.tool_calls
|
|
91
|
-
* - finish_reason:metadata.finish_reason 优先,其次 status/tool_calls 推断
|
|
92
|
-
*
|
|
93
|
-
* 若 payload 已是 ChatCompletion 形状,则直接返回。
|
|
94
|
-
*/
|
|
95
|
-
export declare function buildChatResponseFromResponses(payload: unknown): Record<string, unknown> | unknown;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type Unknown = Record<string, unknown>;
|
|
2
|
-
export interface NormalizeResult<T = Record<string, unknown>> {
|
|
3
|
-
ok: boolean;
|
|
4
|
-
value?: T;
|
|
5
|
-
errors?: string[];
|
|
6
|
-
}
|
|
7
|
-
type JsonSchema = {
|
|
8
|
-
type?: string | string[];
|
|
9
|
-
properties?: Record<string, JsonSchema & {
|
|
10
|
-
['x-aliases']?: string[];
|
|
11
|
-
}>;
|
|
12
|
-
required?: string[];
|
|
13
|
-
items?: JsonSchema;
|
|
14
|
-
additionalProperties?: boolean;
|
|
15
|
-
};
|
|
16
|
-
export declare function normalizeArgsBySchema(input: any, schema?: JsonSchema): NormalizeResult;
|
|
17
|
-
export declare function normalizeTools(tools: any[]): Unknown[];
|
|
18
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ConversionContext, ConversionProfile } from '../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* 统一的 Chat 请求侧过滤链路。
|
|
4
|
-
*
|
|
5
|
-
* 目标:
|
|
6
|
-
* - 所有进入 Provider 的 Chat 形状请求(无论入口为 /v1/chat、/v1/responses 还是 /v1/messages),
|
|
7
|
-
* 都在这里走同一套工具治理与参数标准化逻辑。
|
|
8
|
-
*/
|
|
9
|
-
export declare function runStandardChatRequestFilters(chatRequest: any, profile: ConversionProfile, context: ConversionContext): Promise<any>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isImagePath(p: unknown): boolean;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type ProcessingMode = 'streaming' | 'non-streaming' | 'auto';
|
|
2
|
-
export interface FinalizeOptions {
|
|
3
|
-
requestId?: string;
|
|
4
|
-
endpoint?: string;
|
|
5
|
-
processingMode?: ProcessingMode;
|
|
6
|
-
stream?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare function finalizeOpenAIChatResponse(chatLike: unknown, opts?: FinalizeOptions): Promise<unknown>;
|
|
9
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function normalizeChatRequest(request: any): any;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare function resolveBudgetForModelSync(modelId: string): {
|
|
2
|
-
maxBytes: number;
|
|
3
|
-
safetyRatio: number;
|
|
4
|
-
allowedBytes: number;
|
|
5
|
-
source: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const resolveBudgetForModel: (modelId: string) => Promise<{
|
|
8
|
-
maxBytes: number;
|
|
9
|
-
safetyRatio: number;
|
|
10
|
-
allowedBytes: number;
|
|
11
|
-
source: string;
|
|
12
|
-
}>;
|
|
13
|
-
export declare function enforceChatBudget(chat: any, modelId: string): any;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { ResponsesRequestContext } from './responses-request-adapter.js';
|
|
2
|
-
declare class ResponsesConversationStore {
|
|
3
|
-
private requestMap;
|
|
4
|
-
private responseIndex;
|
|
5
|
-
captureRequestContext(args: {
|
|
6
|
-
requestId: string;
|
|
7
|
-
payload: Record<string, unknown>;
|
|
8
|
-
context: ResponsesRequestContext;
|
|
9
|
-
}): void;
|
|
10
|
-
recordResponse(args: {
|
|
11
|
-
requestId: string;
|
|
12
|
-
response: Record<string, unknown>;
|
|
13
|
-
}): void;
|
|
14
|
-
resumeConversation(responseId: string, submitPayload: Record<string, unknown>, options?: {
|
|
15
|
-
requestId?: string;
|
|
16
|
-
}): {
|
|
17
|
-
payload: Record<string, unknown>;
|
|
18
|
-
meta: Record<string, unknown>;
|
|
19
|
-
};
|
|
20
|
-
clearRequest(requestId: string): void;
|
|
21
|
-
private cleanupEntry;
|
|
22
|
-
private prune;
|
|
23
|
-
}
|
|
24
|
-
export declare const responsesConversationStore: ResponsesConversationStore;
|
|
25
|
-
export declare function captureResponsesRequestContext(args: {
|
|
26
|
-
requestId: string;
|
|
27
|
-
payload: Record<string, unknown>;
|
|
28
|
-
context: ResponsesRequestContext;
|
|
29
|
-
}): void;
|
|
30
|
-
export declare function recordResponsesResponse(args: {
|
|
31
|
-
requestId: string;
|
|
32
|
-
response: Record<string, unknown>;
|
|
33
|
-
}): void;
|
|
34
|
-
export declare function resumeResponsesConversation(responseId: string, submitPayload: Record<string, unknown>, options?: {
|
|
35
|
-
requestId?: string;
|
|
36
|
-
}): {
|
|
37
|
-
payload: Record<string, unknown>;
|
|
38
|
-
meta: Record<string, unknown>;
|
|
39
|
-
};
|
|
40
|
-
export declare function clearResponsesConversationByRequestId(requestId: string): void;
|
|
41
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function ensureResponsesInstructions(payload: Record<string, unknown>): string | undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const RESPONSES_RAW_SYSTEM_METADATA_KEY = "__rcc_raw_system";
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
export type ResponsesContentPart = {
|
|
2
|
-
type: string;
|
|
3
|
-
text?: string;
|
|
4
|
-
content?: unknown;
|
|
5
|
-
};
|
|
6
|
-
export type ResponsesInputItem = {
|
|
7
|
-
type: string;
|
|
8
|
-
role?: string;
|
|
9
|
-
content?: Array<ResponsesContentPart> | null;
|
|
10
|
-
name?: string;
|
|
11
|
-
arguments?: unknown;
|
|
12
|
-
call_id?: string;
|
|
13
|
-
output?: unknown;
|
|
14
|
-
function?: {
|
|
15
|
-
name?: string;
|
|
16
|
-
arguments?: unknown;
|
|
17
|
-
};
|
|
18
|
-
message?: {
|
|
19
|
-
role?: string;
|
|
20
|
-
content?: Array<ResponsesContentPart>;
|
|
21
|
-
};
|
|
22
|
-
id?: string;
|
|
23
|
-
tool_call_id?: string;
|
|
24
|
-
tool_use_id?: string;
|
|
25
|
-
text?: string;
|
|
26
|
-
};
|
|
27
|
-
export type ResponsesToolDefinition = {
|
|
28
|
-
type: string;
|
|
29
|
-
name?: string;
|
|
30
|
-
description?: string;
|
|
31
|
-
strict?: boolean;
|
|
32
|
-
parameters?: unknown;
|
|
33
|
-
function?: {
|
|
34
|
-
name?: string;
|
|
35
|
-
description?: string;
|
|
36
|
-
strict?: boolean;
|
|
37
|
-
parameters?: unknown;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export interface ResponsesRequestContext {
|
|
41
|
-
requestId?: string;
|
|
42
|
-
instructions?: string;
|
|
43
|
-
originalSystemMessages?: string[];
|
|
44
|
-
input?: ResponsesInputItem[];
|
|
45
|
-
include?: unknown;
|
|
46
|
-
store?: unknown;
|
|
47
|
-
toolChoice?: unknown;
|
|
48
|
-
parallelToolCalls?: boolean;
|
|
49
|
-
metadata?: Record<string, unknown>;
|
|
50
|
-
responseFormat?: unknown;
|
|
51
|
-
toolsRaw?: ResponsesToolDefinition[];
|
|
52
|
-
stream?: boolean;
|
|
53
|
-
instructionsIsRaw?: boolean;
|
|
54
|
-
isChatPayload?: boolean;
|
|
55
|
-
isResponsesPayload?: boolean;
|
|
56
|
-
}
|
|
57
|
-
export interface BuildChatRequestResult {
|
|
58
|
-
request: Record<string, unknown>;
|
|
59
|
-
toolsNormalized?: Array<Record<string, unknown>>;
|
|
60
|
-
}
|
|
61
|
-
export declare function captureResponsesContext(payload: Record<string, unknown>, dto?: {
|
|
62
|
-
route?: {
|
|
63
|
-
requestId?: string;
|
|
64
|
-
};
|
|
65
|
-
}): ResponsesRequestContext;
|
|
66
|
-
export declare function buildChatRequestFromResponses(payload: Record<string, unknown>, context: ResponsesRequestContext): BuildChatRequestResult;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface SnapshotHookOptions {
|
|
2
|
-
endpoint: string;
|
|
3
|
-
stage: string;
|
|
4
|
-
requestId: string;
|
|
5
|
-
data: unknown;
|
|
6
|
-
verbosity?: 'minimal' | 'verbose';
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Hub pipeline no longer exposes the legacy hooks runtime.
|
|
10
|
-
* Keep a tiny shim so existing callers can continue awaiting the same API surface.
|
|
11
|
-
*/
|
|
12
|
-
export declare function writeSnapshotViaHooks(_options: SnapshotHookOptions): Promise<void>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export interface StreamingToolCall {
|
|
2
|
-
id?: string;
|
|
3
|
-
type: 'function';
|
|
4
|
-
function: {
|
|
5
|
-
name?: string;
|
|
6
|
-
arguments?: string;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
export interface StreamingToolExtractorOptions {
|
|
10
|
-
idPrefix?: string;
|
|
11
|
-
}
|
|
12
|
-
export declare class StreamingTextToolExtractor {
|
|
13
|
-
private opts;
|
|
14
|
-
private buffer;
|
|
15
|
-
private idCounter;
|
|
16
|
-
private pendingPatch;
|
|
17
|
-
constructor(opts?: StreamingToolExtractorOptions);
|
|
18
|
-
reset(): void;
|
|
19
|
-
feedText(text: string): StreamingToolCall[];
|
|
20
|
-
private genId;
|
|
21
|
-
private toToolCall;
|
|
22
|
-
private tryExtractUnifiedDiffBlocks;
|
|
23
|
-
private tryExtractFunctionExecuteBlocks;
|
|
24
|
-
private splitCommand;
|
|
25
|
-
}
|
|
26
|
-
export declare function createStreamingToolExtractor(opts?: StreamingToolExtractorOptions): StreamingTextToolExtractor;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export type ToolCallLite = {
|
|
2
|
-
id?: string;
|
|
3
|
-
name: string;
|
|
4
|
-
args: string;
|
|
5
|
-
};
|
|
6
|
-
export declare function extractApplyPatchCallsFromText(text: string): ToolCallLite[] | null;
|
|
7
|
-
export declare function extractExecuteBlocksFromText(text: string): ToolCallLite[] | null;
|
|
8
|
-
export declare function extractXMLToolCallsFromText(text: string): ToolCallLite[] | null;
|
|
9
|
-
export declare function normalizeAssistantTextToToolCalls(message: Record<string, any>): Record<string, any>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ToolFilterHints } from '../../filters/index.js';
|
|
2
|
-
interface RequestFilterOptions {
|
|
3
|
-
entryEndpoint?: string;
|
|
4
|
-
requestId?: string;
|
|
5
|
-
model?: string;
|
|
6
|
-
profile?: string;
|
|
7
|
-
stream?: boolean;
|
|
8
|
-
toolFilterHints?: ToolFilterHints;
|
|
9
|
-
}
|
|
10
|
-
interface ResponseFilterOptions {
|
|
11
|
-
entryEndpoint?: string;
|
|
12
|
-
requestId?: string;
|
|
13
|
-
profile?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function runChatRequestToolFilters(chatRequest: any, options?: RequestFilterOptions): Promise<any>;
|
|
16
|
-
export declare function runChatResponseToolFilters(chatJson: any, options?: ResponseFilterOptions): Promise<any>;
|
|
17
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
type Unknown = Record<string, unknown>;
|
|
2
|
-
export interface ToolGovernanceOptions {
|
|
3
|
-
injectGuidance?: boolean;
|
|
4
|
-
snapshot?: {
|
|
5
|
-
enabled?: boolean;
|
|
6
|
-
endpoint?: string;
|
|
7
|
-
requestId?: string;
|
|
8
|
-
baseDir?: string;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Process OpenAI Chat request (messages/tools) with unified 标准 governance.
|
|
13
|
-
* - Augment tools (strict schemas)
|
|
14
|
-
* - Inject/Refine system tool guidance (idempotent)
|
|
15
|
-
* - Canonicalize textual tool markup to tool_calls; set content=null when applicable
|
|
16
|
-
*/
|
|
17
|
-
export declare function processChatRequestTools(request: Unknown, opts?: ToolGovernanceOptions): Unknown;
|
|
18
|
-
export declare function processChatResponseTools(resp: Unknown): Unknown;
|
|
19
|
-
export interface GovernContext extends ToolGovernanceOptions {
|
|
20
|
-
phase: 'request' | 'response';
|
|
21
|
-
endpoint?: 'chat' | 'responses' | 'messages';
|
|
22
|
-
stream?: boolean;
|
|
23
|
-
produceRequiredAction?: boolean;
|
|
24
|
-
requestId?: string;
|
|
25
|
-
}
|
|
26
|
-
export declare function governTools(payload: Unknown, ctx: GovernContext): Unknown;
|
|
27
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
type Unknown = Record<string, unknown>;
|
|
2
|
-
export interface HarvestContext {
|
|
3
|
-
requestId?: string;
|
|
4
|
-
idPrefix?: string;
|
|
5
|
-
chunkSize?: number;
|
|
6
|
-
source?: 'chat' | 'responses' | 'messages';
|
|
7
|
-
}
|
|
8
|
-
export interface HarvestSignal {
|
|
9
|
-
type: 'delta' | 'final' | 'compat';
|
|
10
|
-
payload: Unknown;
|
|
11
|
-
}
|
|
12
|
-
export interface DeltaEvent {
|
|
13
|
-
tool_calls?: Array<{
|
|
14
|
-
index: number;
|
|
15
|
-
id: string;
|
|
16
|
-
type: 'function';
|
|
17
|
-
function: {
|
|
18
|
-
name?: string;
|
|
19
|
-
arguments?: string;
|
|
20
|
-
};
|
|
21
|
-
}>;
|
|
22
|
-
content?: string;
|
|
23
|
-
role?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface HarvestResult {
|
|
26
|
-
deltaEvents: DeltaEvent[];
|
|
27
|
-
normalized?: Unknown;
|
|
28
|
-
stats?: Unknown;
|
|
29
|
-
}
|
|
30
|
-
export declare function harvestTools(signal: HarvestSignal, ctx?: HarvestContext): HarvestResult;
|
|
31
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared helpers for standard tool normalization (shell packing rules).
|
|
3
|
-
* The goal is deterministic, minimal shaping so executors succeed consistently.
|
|
4
|
-
*/
|
|
5
|
-
export interface ShellArgs {
|
|
6
|
-
command: string | string[];
|
|
7
|
-
workdir?: string;
|
|
8
|
-
timeout_ms?: number;
|
|
9
|
-
}
|
|
10
|
-
export declare function splitCommandString(input: string): string[];
|
|
11
|
-
/**
|
|
12
|
-
* Pack shell arguments per unified rules:
|
|
13
|
-
* - command: string -> ["bash","-lc","<string>"]
|
|
14
|
-
* - command: tokens[]
|
|
15
|
-
* - if starts with ["cd", path, ...rest]:
|
|
16
|
-
* - set workdir to path when absent
|
|
17
|
-
* - if rest empty => command=["pwd"]
|
|
18
|
-
* - else if rest has control tokens => command=["bash","-lc", join(rest)]
|
|
19
|
-
* - else command=rest (argv)
|
|
20
|
-
* - else if tokens contain control tokens => command=["bash","-lc", join(tokens)]
|
|
21
|
-
* - else command=tokens (argv)
|
|
22
|
-
* - join(rest) uses single-space join without extra quoting
|
|
23
|
-
*/
|
|
24
|
-
export declare function packShellArgs(input: Record<string, unknown>): Record<string, unknown>;
|
|
25
|
-
export declare function flattenByComma(arr: string[]): string[];
|
|
26
|
-
export declare function chunkString(s: string, minParts?: number, maxParts?: number, targetChunk?: number): string[];
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export interface ConversionProfile {
|
|
2
|
-
id: string;
|
|
3
|
-
incomingProtocol: string;
|
|
4
|
-
outgoingProtocol: string;
|
|
5
|
-
codec: string;
|
|
6
|
-
inputSchema?: string;
|
|
7
|
-
canonicalRequestSchema?: string;
|
|
8
|
-
canonicalResponseSchema?: string;
|
|
9
|
-
clientResponseSchema?: string;
|
|
10
|
-
trace?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface ConversionConfigFile {
|
|
13
|
-
profiles: Record<string, Omit<ConversionProfile, 'id'>>;
|
|
14
|
-
endpointBindings?: Record<string, string>;
|
|
15
|
-
}
|
|
16
|
-
export interface ConversionContext {
|
|
17
|
-
requestId?: string;
|
|
18
|
-
endpoint?: string;
|
|
19
|
-
entryEndpoint?: string;
|
|
20
|
-
targetProtocol?: string;
|
|
21
|
-
stream?: boolean;
|
|
22
|
-
metadata?: Record<string, unknown>;
|
|
23
|
-
}
|
|
24
|
-
export interface ConversionResult {
|
|
25
|
-
profile: ConversionProfile;
|
|
26
|
-
payload: any;
|
|
27
|
-
}
|
|
28
|
-
export interface ConversionCodec {
|
|
29
|
-
readonly id: string;
|
|
30
|
-
initialize(): Promise<void>;
|
|
31
|
-
convertRequest(payload: any, profile: ConversionProfile, context: ConversionContext): Promise<any>;
|
|
32
|
-
convertResponse(payload: any, profile: ConversionProfile, context: ConversionContext): Promise<any>;
|
|
33
|
-
}
|
package/dist/core/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 核心模块导出
|
|
3
|
-
*/
|
|
4
|
-
export { LLMSwitchEngineV2 } from './llmswitch-engine-v2.js';
|
|
5
|
-
export { LLMSwitchFactoryV2 } from './llmswitch-factory-v2.js';
|
|
6
|
-
export { createLLMSwitchV2, createLLMSwitchV2Development, createLLMSwitchV2Production, createLLMSwitchV2Test, getDefaultLLMSwitchV2 } from './llmswitch-factory-v2.js';
|
package/dist/core/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 核心模块导出
|
|
3
|
-
*/
|
|
4
|
-
// 核心引擎
|
|
5
|
-
export { LLMSwitchEngineV2 } from './llmswitch-engine-v2.js';
|
|
6
|
-
// 工厂类
|
|
7
|
-
export { LLMSwitchFactoryV2 } from './llmswitch-factory-v2.js';
|
|
8
|
-
// 便捷函数
|
|
9
|
-
export { createLLMSwitchV2, createLLMSwitchV2Development, createLLMSwitchV2Production, createLLMSwitchV2Test, getDefaultLLMSwitchV2 } from './llmswitch-factory-v2.js';
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LLMSwitch V2 引擎
|
|
3
|
-
*
|
|
4
|
-
* 基于现有Hooks系统的多端点转换引擎,支持Chat、Responses、Messages三个端点
|
|
5
|
-
* 每个转换节点前后都有Hooks支持,并提供基于入口端点的路径隔离快照系统
|
|
6
|
-
*/
|
|
7
|
-
import type { ILLMSwitchV2, LLMSwitchV2Config, EndpointType, ProtocolType, LLMSwitchHookContext, SSEEvent, LLMSwitchProcessingResult, LLMSwitchMetrics, LLMSwitchHealthCheck } from '../api/llmswitch-types.js';
|
|
8
|
-
import { LLMSwitchHookStage } from '../api/llmswitch-types.js';
|
|
9
|
-
/**
|
|
10
|
-
* LLMSwitch V2 引擎核心实现
|
|
11
|
-
*/
|
|
12
|
-
export declare class LLMSwitchEngineV2 implements ILLMSwitchV2 {
|
|
13
|
-
private config;
|
|
14
|
-
private state;
|
|
15
|
-
private hooksAdapter;
|
|
16
|
-
private endpointRouter;
|
|
17
|
-
private metrics;
|
|
18
|
-
private startTime;
|
|
19
|
-
private hookHandlers;
|
|
20
|
-
constructor(config: LLMSwitchV2Config);
|
|
21
|
-
/**
|
|
22
|
-
* 初始化引擎
|
|
23
|
-
*/
|
|
24
|
-
initialize(): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* 启动引擎
|
|
27
|
-
*/
|
|
28
|
-
start(): Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* 停止引擎
|
|
31
|
-
*/
|
|
32
|
-
stop(): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* 关闭引擎
|
|
35
|
-
*/
|
|
36
|
-
shutdown(): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* 处理请求
|
|
39
|
-
*/
|
|
40
|
-
processRequest(request: any, endpoint?: EndpointType, context?: Partial<LLMSwitchHookContext>): Promise<LLMSwitchProcessingResult>;
|
|
41
|
-
/**
|
|
42
|
-
* 处理响应
|
|
43
|
-
*/
|
|
44
|
-
processResponse(response: any, originalEndpoint: EndpointType, context: LLMSwitchHookContext): Promise<LLMSwitchProcessingResult>;
|
|
45
|
-
/**
|
|
46
|
-
* 流式请求处理
|
|
47
|
-
*/
|
|
48
|
-
processStreamingRequest(request: any, endpoint?: EndpointType, context?: Partial<LLMSwitchHookContext>): Promise<AsyncIterable<SSEEvent>>;
|
|
49
|
-
/**
|
|
50
|
-
* 配置管理
|
|
51
|
-
*/
|
|
52
|
-
configure(config: LLMSwitchV2Config): Promise<void>;
|
|
53
|
-
updateConfig(updates: Partial<LLMSwitchV2Config>): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* 健康检查
|
|
56
|
-
*/
|
|
57
|
-
healthCheck(): Promise<LLMSwitchHealthCheck>;
|
|
58
|
-
convertRequest(payload: any, profile: any, context: any): Promise<any>;
|
|
59
|
-
convertResponse(payload: any, profile: any, context: any): Promise<any>;
|
|
60
|
-
private executeRequestFlow;
|
|
61
|
-
private executeResponseFlow;
|
|
62
|
-
private createHooksAdapter;
|
|
63
|
-
private createEndpointRouter;
|
|
64
|
-
/**
|
|
65
|
-
* 注册默认的工具治理 Hooks:
|
|
66
|
-
* - request_4_tools_pre: 请求侧仅做 augment + 指引注入(不做文本→工具)
|
|
67
|
-
* - response_3_tools_pre: 响应侧做文本→工具;Responses 非流追加 required_action
|
|
68
|
-
*
|
|
69
|
-
* DISABLED: Tool governance is now handled exclusively in ChatProcessNode (conversion-v3)
|
|
70
|
-
* to avoid duplicate processing and interference with TOON decoding.
|
|
71
|
-
*/
|
|
72
|
-
private registerDefaultToolHooks;
|
|
73
|
-
private validateConfig;
|
|
74
|
-
private detectProcessingMode;
|
|
75
|
-
private detectEndpointFromPayload;
|
|
76
|
-
private generateRequestId;
|
|
77
|
-
private generateExecutionId;
|
|
78
|
-
private generatePathIdentifier;
|
|
79
|
-
private getEndpointPath;
|
|
80
|
-
private initializeMetrics;
|
|
81
|
-
registerHookHandler(stage: LLMSwitchHookStage, handler: (context: LLMSwitchHookContext, data: any) => Promise<any>): void;
|
|
82
|
-
unregisterHookHandler(stage: LLMSwitchHookStage): void;
|
|
83
|
-
getHookStats(): any;
|
|
84
|
-
/**
|
|
85
|
-
* V2 核心功能:请求预处理(为workflow准备)
|
|
86
|
-
*/
|
|
87
|
-
preprocessRequest(request: any, endpoint: EndpointType, context?: Partial<LLMSwitchHookContext>): Promise<LLMSwitchProcessingResult>;
|
|
88
|
-
/**
|
|
89
|
-
* V2 核心功能:响应后处理(从workflow接收)
|
|
90
|
-
*/
|
|
91
|
-
postprocessResponse(response: any, originalEndpoint: EndpointType, context: LLMSwitchHookContext): Promise<LLMSwitchProcessingResult>;
|
|
92
|
-
/**
|
|
93
|
-
* 协议转换到统一格式(为workflow准备)
|
|
94
|
-
*/
|
|
95
|
-
convertToUnifiedProtocol(request: any, sourceProtocol: ProtocolType): Promise<any>;
|
|
96
|
-
/**
|
|
97
|
-
* 统一工具处理(三端工具调用的唯一入口)
|
|
98
|
-
*/
|
|
99
|
-
processToolCalls(request: any, endpoint: EndpointType): Promise<any>;
|
|
100
|
-
/**
|
|
101
|
-
* 系统工具指引注入
|
|
102
|
-
*/
|
|
103
|
-
injectSystemToolGuidance(request: any, tools: any[]): Promise<any>;
|
|
104
|
-
/**
|
|
105
|
-
* 流式请求预处理
|
|
106
|
-
*/
|
|
107
|
-
preprocessStreamingRequest(request: any, endpoint: EndpointType, context?: Partial<LLMSwitchHookContext>): Promise<AsyncIterable<SSEEvent>>;
|
|
108
|
-
/**
|
|
109
|
-
* 流式响应后处理
|
|
110
|
-
*/
|
|
111
|
-
postprocessStreamingResponse(events: AsyncIterable<SSEEvent>, originalEndpoint: EndpointType, context: LLMSwitchHookContext): Promise<AsyncIterable<SSEEvent>>;
|
|
112
|
-
/**
|
|
113
|
-
* 获取配置
|
|
114
|
-
*/
|
|
115
|
-
getConfig(): LLMSwitchV2Config;
|
|
116
|
-
/**
|
|
117
|
-
* 获取指标
|
|
118
|
-
*/
|
|
119
|
-
getMetrics(): LLMSwitchMetrics;
|
|
120
|
-
/**
|
|
121
|
-
* 执行Hooks
|
|
122
|
-
*/
|
|
123
|
-
executeHooks(stage: LLMSwitchHookStage, context: LLMSwitchHookContext, data: any): Promise<any>;
|
|
124
|
-
/**
|
|
125
|
-
* 捕获快照
|
|
126
|
-
*/
|
|
127
|
-
captureSnapshot(stage: LLMSwitchHookStage, context: LLMSwitchHookContext, data: any): Promise<void>;
|
|
128
|
-
/**
|
|
129
|
-
* 获取快照路径
|
|
130
|
-
*/
|
|
131
|
-
getSnapshotPath(stage: LLMSwitchHookStage, context: LLMSwitchHookContext): string;
|
|
132
|
-
}
|