@code-yeongyu/senpi-ai 2026.8.13 → 2026.8.16

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 (113) hide show
  1. package/README.md +2 -0
  2. package/dist/api/anthropic-messages.d.ts.map +1 -1
  3. package/dist/api/anthropic-messages.js +40 -14
  4. package/dist/api/anthropic-messages.js.map +1 -1
  5. package/dist/api/bedrock-converse-stream.d.ts.map +1 -1
  6. package/dist/api/bedrock-converse-stream.js +16 -4
  7. package/dist/api/bedrock-converse-stream.js.map +1 -1
  8. package/dist/api/cloudflare-gateway-binding.d.ts +69 -0
  9. package/dist/api/cloudflare-gateway-binding.d.ts.map +1 -0
  10. package/dist/api/cloudflare-gateway-binding.js +159 -0
  11. package/dist/api/cloudflare-gateway-binding.js.map +1 -0
  12. package/dist/api/constrained-sampling.d.ts +3 -0
  13. package/dist/api/constrained-sampling.d.ts.map +1 -1
  14. package/dist/api/constrained-sampling.js +125 -5
  15. package/dist/api/constrained-sampling.js.map +1 -1
  16. package/dist/api/google-generative-ai.js +7 -3
  17. package/dist/api/google-generative-ai.js.map +1 -1
  18. package/dist/api/google-shared.d.ts +1 -1
  19. package/dist/api/google-shared.d.ts.map +1 -1
  20. package/dist/api/google-shared.js +13 -9
  21. package/dist/api/google-shared.js.map +1 -1
  22. package/dist/api/google-vertex.js +7 -3
  23. package/dist/api/google-vertex.js.map +1 -1
  24. package/dist/api/mistral-conversations.d.ts +1 -1
  25. package/dist/api/mistral-conversations.d.ts.map +1 -1
  26. package/dist/api/mistral-conversations.js +208 -42
  27. package/dist/api/mistral-conversations.js.map +1 -1
  28. package/dist/api/openai-codex-responses.d.ts.map +1 -1
  29. package/dist/api/openai-codex-responses.js +13 -4
  30. package/dist/api/openai-codex-responses.js.map +1 -1
  31. package/dist/api/openai-completions.d.ts.map +1 -1
  32. package/dist/api/openai-completions.js +10 -7
  33. package/dist/api/openai-completions.js.map +1 -1
  34. package/dist/api/openai-responses-shared.d.ts +1 -0
  35. package/dist/api/openai-responses-shared.d.ts.map +1 -1
  36. package/dist/api/openai-responses-shared.js +31 -7
  37. package/dist/api/openai-responses-shared.js.map +1 -1
  38. package/dist/api/openai-responses.d.ts.map +1 -1
  39. package/dist/api/openai-responses.js +8 -1
  40. package/dist/api/openai-responses.js.map +1 -1
  41. package/dist/auth/oauth/cursor.d.ts +16 -0
  42. package/dist/auth/oauth/cursor.d.ts.map +1 -0
  43. package/dist/auth/oauth/cursor.js +234 -0
  44. package/dist/auth/oauth/cursor.js.map +1 -0
  45. package/dist/auth/oauth/github-copilot.d.ts.map +1 -1
  46. package/dist/auth/oauth/github-copilot.js +6 -3
  47. package/dist/auth/oauth/github-copilot.js.map +1 -1
  48. package/dist/auth/oauth/load.d.ts +2 -0
  49. package/dist/auth/oauth/load.d.ts.map +1 -1
  50. package/dist/auth/oauth/load.js +5 -0
  51. package/dist/auth/oauth/load.js.map +1 -1
  52. package/dist/auth/resolve.js +44 -9
  53. package/dist/auth/resolve.js.map +1 -1
  54. package/dist/auth/types.d.ts +2 -0
  55. package/dist/auth/types.d.ts.map +1 -1
  56. package/dist/auth/types.js.map +1 -1
  57. package/dist/bun-oauth.d.ts.map +1 -1
  58. package/dist/bun-oauth.js +2 -0
  59. package/dist/bun-oauth.js.map +1 -1
  60. package/dist/image-models.generated.d.ts +15 -0
  61. package/dist/image-models.generated.d.ts.map +1 -1
  62. package/dist/image-models.generated.js +15 -0
  63. package/dist/image-models.generated.js.map +1 -1
  64. package/dist/providers/all.d.ts.map +1 -1
  65. package/dist/providers/all.js +2 -0
  66. package/dist/providers/all.js.map +1 -1
  67. package/dist/providers/cursor.d.ts +15 -0
  68. package/dist/providers/cursor.d.ts.map +1 -0
  69. package/dist/providers/cursor.js +32 -0
  70. package/dist/providers/cursor.js.map +1 -0
  71. package/dist/providers/data/.manifest.json +1 -1
  72. package/dist/providers/data/alibaba-token-plan.json +1 -1
  73. package/dist/providers/data/baseten.json +1 -1
  74. package/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  75. package/dist/providers/data/cloudflare-workers-ai.json +1 -1
  76. package/dist/providers/data/deepseek.json +1 -1
  77. package/dist/providers/data/fireworks.json +1 -1
  78. package/dist/providers/data/github-copilot.json +1 -1
  79. package/dist/providers/data/google-vertex.json +1 -1
  80. package/dist/providers/data/google.json +1 -1
  81. package/dist/providers/data/huggingface.json +1 -1
  82. package/dist/providers/data/kimi-coding.json +1 -1
  83. package/dist/providers/data/nvidia.json +1 -1
  84. package/dist/providers/data/openai-codex.json +1 -1
  85. package/dist/providers/data/openai.json +1 -1
  86. package/dist/providers/data/opencode-go.json +1 -1
  87. package/dist/providers/data/opencode.json +1 -1
  88. package/dist/providers/data/openrouter.json +1 -1
  89. package/dist/providers/data/qwen-token-plan-cn.json +1 -1
  90. package/dist/providers/data/qwen-token-plan.json +1 -1
  91. package/dist/providers/data/vercel-ai-gateway.json +1 -1
  92. package/dist/providers/data/zai-coding-cn.json +1 -1
  93. package/dist/providers/data/zai.json +1 -1
  94. package/dist/types.d.ts +14 -3
  95. package/dist/types.d.ts.map +1 -1
  96. package/dist/types.js.map +1 -1
  97. package/dist/utils/overflow.d.ts.map +1 -1
  98. package/dist/utils/overflow.js +2 -0
  99. package/dist/utils/overflow.js.map +1 -1
  100. package/dist/utils/pi-user-agent.d.ts +2 -0
  101. package/dist/utils/pi-user-agent.d.ts.map +1 -0
  102. package/dist/utils/pi-user-agent.js +12 -0
  103. package/dist/utils/pi-user-agent.js.map +1 -0
  104. package/dist/utils/prompt-cache-ttl.d.ts.map +1 -1
  105. package/dist/utils/prompt-cache-ttl.js +3 -2
  106. package/dist/utils/prompt-cache-ttl.js.map +1 -1
  107. package/dist/utils/retry.d.ts.map +1 -1
  108. package/dist/utils/retry.js +1 -0
  109. package/dist/utils/retry.js.map +1 -1
  110. package/dist/utils/validation.d.ts.map +1 -1
  111. package/dist/utils/validation.js +34 -0
  112. package/dist/utils/validation.js.map +1 -1
  113. package/package.json +2 -2
@@ -11,7 +11,7 @@ import { retryProviderStreamRequest } from "../utils/provider-retry.js";
11
11
  import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
12
12
  import { isForcedToolChoiceUnsupportedError, omitToolChoiceParam } from "../utils/tool-choice-fallback.js";
13
13
  import { normalizeToolParametersForMoonshot, normalizeToolParametersForOpenAICompat, } from "../utils/tool-schema-compat.js";
14
- import { appendGrammarToolInputJsonDelta, createGrammarToolInputProperties, getGrammarToolInput, resolveGrammarConstrainedSampling, resolveJsonSchemaStrictSampling, } from "./constrained-sampling.js";
14
+ import { appendGrammarToolInputJsonDelta, createGrammarToolInputProperties, getGrammarToolInput, getJsonSchemaToolParameters, resolveGrammarConstrainedSampling, resolveJsonSchemaStrictSampling, } from "./constrained-sampling.js";
15
15
  import { buildCopilotDynamicHeaders, hasCopilotVisionInput } from "./github-copilot-headers.js";
16
16
  import { resolveOpenAIClientAuth } from "./openai-client-auth.js";
17
17
  import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.js";
@@ -68,7 +68,7 @@ function getThinkingLevelMap(model, compat) {
68
68
  const isKimiK3 = id === "k3" || id.startsWith("k3-") || /(?:^|[/:-])kimi-k3(?:$|[/.:_-])/.test(id);
69
69
  const isDeepSeek = id.includes("deepseek");
70
70
  const isMiMo = /\bmimo\b/.test(id);
71
- const isGlm52 = /(?:^|[/:-])glm-5\.2(?:$|[/.:_-])/.test(id);
71
+ const isGlm5x = /(?:^|[/:-])glm-5\.[23](?:$|[/.:_-])/.test(id);
72
72
  if (model.provider === "ollama") {
73
73
  return OLLAMA_THINKING_LEVEL_MAP;
74
74
  }
@@ -84,7 +84,7 @@ function getThinkingLevelMap(model, compat) {
84
84
  if (isDeepSeek) {
85
85
  return DEEPSEEK_THINKING_LEVEL_MAP;
86
86
  }
87
- if (isGlm52) {
87
+ if (isGlm5x) {
88
88
  if (compat.thinkingFormat === "zai") {
89
89
  return DEEPSEEK_THINKING_LEVEL_MAP;
90
90
  }
@@ -756,8 +756,10 @@ function buildParams(model, context, options, compat = getCompat(model), cacheRe
756
756
  params.tool_choice = options.toolChoice;
757
757
  }
758
758
  if (compat.thinkingFormat === "zai" && model.reasoning) {
759
+ const isGlm53 = /(?:^|[/:-])glm-5\.3(?:$|[/.:_-])/.test(model.id.toLowerCase());
759
760
  const zaiParams = params;
760
- zaiParams.thinking = options?.reasoningEffort ? { type: "enabled", clear_thinking: false } : { type: "disabled" };
761
+ zaiParams.thinking =
762
+ options?.reasoningEffort || isGlm53 ? { type: "enabled", clear_thinking: false } : { type: "disabled" };
761
763
  if (options?.reasoningEffort && compat.supportsReasoningEffort) {
762
764
  const effort = resolveReasoningEffort(thinkingLevelMap, options.reasoningEffort);
763
765
  if (effort !== undefined) {
@@ -1307,10 +1309,11 @@ function convertTools(tools, compat) {
1307
1309
  if (tool.freeform) {
1308
1310
  throw new Error("Freeform tools cannot be sent to OpenAI Chat Completions; use Responses API");
1309
1311
  }
1310
- const normalizedParameters = compat.toolSchemaFlavor === "moonshot-mfjs"
1311
- ? normalizeToolParametersForMoonshot(tool.parameters)
1312
- : normalizeToolParametersForOpenAICompat(tool.parameters);
1313
1312
  const strict = resolveJsonSchemaStrictSampling(tool, compat.supportsStrictMode !== false);
1313
+ const schemaParameters = getJsonSchemaToolParameters(tool, strict);
1314
+ const normalizedParameters = compat.toolSchemaFlavor === "moonshot-mfjs"
1315
+ ? normalizeToolParametersForMoonshot(schemaParameters)
1316
+ : normalizeToolParametersForOpenAICompat(schemaParameters);
1314
1317
  return {
1315
1318
  type: "function",
1316
1319
  function: {