@jsonstudio/llms 0.6.34 → 0.6.74

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.
Files changed (44) hide show
  1. package/dist/conversion/codecs/gemini-openai-codec.js +1 -2
  2. package/dist/conversion/codecs/responses-openai-codec.js +16 -1
  3. package/dist/conversion/compat/profiles/chat-glm.json +17 -0
  4. package/dist/conversion/compat/profiles/chat-iflow.json +36 -0
  5. package/dist/conversion/compat/profiles/chat-lmstudio.json +37 -0
  6. package/dist/conversion/compat/profiles/chat-qwen.json +18 -0
  7. package/dist/conversion/compat/profiles/responses-c4m.json +45 -0
  8. package/dist/conversion/config/compat-profiles.json +38 -0
  9. package/dist/conversion/config/sample-config.json +314 -0
  10. package/dist/conversion/config/version-switch.json +150 -0
  11. package/dist/conversion/hub/pipeline/compat/compat-engine.d.ts +4 -0
  12. package/dist/conversion/hub/pipeline/compat/compat-engine.js +667 -0
  13. package/dist/conversion/hub/pipeline/compat/compat-profile-store.d.ts +2 -0
  14. package/dist/conversion/hub/pipeline/compat/compat-profile-store.js +76 -0
  15. package/dist/conversion/hub/pipeline/compat/compat-types.d.ts +62 -0
  16. package/dist/conversion/hub/pipeline/compat/compat-types.js +1 -0
  17. package/dist/conversion/hub/pipeline/hub-pipeline.d.ts +1 -0
  18. package/dist/conversion/hub/pipeline/hub-pipeline.js +76 -28
  19. package/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/index.js +0 -13
  20. package/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage3_compat/index.d.ts +14 -0
  21. package/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage3_compat/index.js +23 -0
  22. package/dist/conversion/hub/response/provider-response.js +18 -0
  23. package/dist/conversion/hub/response/response-mappers.d.ts +1 -1
  24. package/dist/conversion/hub/response/response-mappers.js +2 -12
  25. package/dist/conversion/responses/responses-openai-bridge.d.ts +1 -0
  26. package/dist/conversion/responses/responses-openai-bridge.js +71 -0
  27. package/dist/conversion/shared/responses-output-builder.js +22 -43
  28. package/dist/conversion/shared/responses-response-utils.js +1 -47
  29. package/dist/conversion/shared/text-markup-normalizer.js +2 -2
  30. package/dist/conversion/shared/tool-canonicalizer.js +16 -118
  31. package/dist/conversion/shared/tool-filter-pipeline.js +63 -21
  32. package/dist/conversion/shared/tool-mapping.js +52 -32
  33. package/dist/filters/config/openai-openai.fieldmap.json +18 -0
  34. package/dist/filters/special/request-tools-normalize.js +20 -1
  35. package/dist/index.d.ts +0 -1
  36. package/dist/index.js +0 -1
  37. package/dist/router/virtual-router/bootstrap.js +18 -33
  38. package/dist/router/virtual-router/classifier.js +51 -77
  39. package/dist/router/virtual-router/features.js +338 -111
  40. package/dist/router/virtual-router/types.d.ts +2 -4
  41. package/dist/router/virtual-router/types.js +2 -2
  42. package/dist/sse/sse-to-json/builders/response-builder.js +1 -0
  43. package/dist/tools/tool-registry.js +4 -3
  44. package/package.json +3 -3
@@ -5,7 +5,6 @@ import type { StandardizedRequest } from '../../conversion/hub/types/standardize
5
5
  export declare const DEFAULT_ROUTE = "default";
6
6
  export declare const ROUTE_PRIORITY: string[];
7
7
  export type RoutingPools = Record<string, string[]>;
8
- export type PreviousToolCategory = 'context_read' | 'plan' | 'vision' | 'coding';
9
8
  export interface ProviderAuthConfig {
10
9
  type: 'apiKey' | 'oauth';
11
10
  secretRef?: string;
@@ -48,14 +47,12 @@ export interface ProviderRuntimeProfile {
48
47
  processMode?: 'chat' | 'passthrough';
49
48
  responsesConfig?: ResponsesProviderConfig;
50
49
  }
51
- export type RouteKeywordCategory = 'thinking' | 'background' | 'vision' | 'coding';
52
50
  export interface VirtualRouterClassifierConfig {
53
51
  longContextThresholdTokens?: number;
54
52
  thinkingKeywords?: string[];
55
53
  codingKeywords?: string[];
56
54
  backgroundKeywords?: string[];
57
55
  visionKeywords?: string[];
58
- keywordInjections?: Partial<Record<RouteKeywordCategory, string[]>>;
59
56
  }
60
57
  export interface LoadBalancingPolicy {
61
58
  strategy: 'round-robin' | 'weighted' | 'sticky';
@@ -114,7 +111,8 @@ export interface RoutingFeatures {
114
111
  hasCodingTool: boolean;
115
112
  hasThinkingKeyword: boolean;
116
113
  estimatedTokens: number;
117
- previousToolCategory?: PreviousToolCategory | null;
114
+ lastAssistantToolCategory?: 'read' | 'write' | 'search' | 'other';
115
+ lastAssistantToolName?: string;
118
116
  metadata: RouterMetadataInput;
119
117
  }
120
118
  export interface ClassificationResult {
@@ -3,11 +3,11 @@
3
3
  */
4
4
  export const DEFAULT_ROUTE = 'default';
5
5
  export const ROUTE_PRIORITY = [
6
- 'longcontext',
7
- 'thinking',
8
6
  'vision',
7
+ 'longcontext',
9
8
  'websearch',
10
9
  'coding',
10
+ 'thinking',
11
11
  'tools',
12
12
  'background',
13
13
  DEFAULT_ROUTE
@@ -112,6 +112,7 @@ export class ResponsesResponseBuilder {
112
112
  this.handleOutputItemDone(event);
113
113
  break;
114
114
  case 'required_action':
115
+ case 'response.required_action':
115
116
  this.handleRequiredAction(event);
116
117
  break;
117
118
  case 'response.done':
@@ -95,11 +95,12 @@ export function validateToolCall(name, argsString) {
95
95
  const rawArgs = tryParseJson(typeof argsString === 'string' ? argsString : '{}');
96
96
  switch (normalizedName) {
97
97
  case 'apply_patch': {
98
- const patch = asString(rawArgs.patch);
98
+ const input = asString(rawArgs.input);
99
+ const patch = asString(rawArgs.patch) ?? input;
99
100
  if (!patch) {
100
- return { ok: false, reason: 'missing_patch' };
101
+ return { ok: false, reason: 'missing_input' };
101
102
  }
102
- return { ok: true, normalizedArgs: toJson({ patch }) };
103
+ return { ok: true, normalizedArgs: toJson({ input: patch, patch }) };
103
104
  }
104
105
  case 'shell': {
105
106
  const rawCommand = rawArgs.command;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@jsonstudio/llms",
3
- "version": "0.6.034",
3
+ "version": "0.6.074",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
9
- "build": "node scripts/bump-version.mjs && tsc -p tsconfig.json",
10
- "build:dev": "node scripts/bump-version.mjs && tsc -p tsconfig.json",
9
+ "build": "node scripts/bump-version.mjs && tsc -p tsconfig.json && node scripts/tools/copy-compat-profiles.mjs",
10
+ "build:dev": "node scripts/bump-version.mjs && tsc -p tsconfig.json && node scripts/tools/copy-compat-profiles.mjs",
11
11
  "lint": "eslint --no-eslintrc -c .eslintrc.json src --ext .ts --no-cache",
12
12
  "lint:fix": "eslint --no-eslintrc -c .eslintrc.json src --ext .ts --no-cache --fix",
13
13
  "postbuild": "node scripts/tests/run-matrix-ci.mjs",