@tuturuuu/ai 0.3.0 → 0.4.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tuturuuu/ai",
3
3
  "license": "MIT",
4
- "version": "0.3.0",
4
+ "version": "0.4.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/tutur3u/platform",
@@ -22,34 +22,34 @@
22
22
  "type-check": "tsc --project tsconfig.typecheck.json"
23
23
  },
24
24
  "dependencies": {
25
- "@ai-sdk/amazon-bedrock": "^5.0.24",
26
- "@ai-sdk/anthropic": "^4.0.16",
27
- "@ai-sdk/azure": "^4.0.17",
28
- "@ai-sdk/cerebras": "^3.0.12",
29
- "@ai-sdk/cohere": "^4.0.11",
30
- "@ai-sdk/deepgram": "^3.0.11",
31
- "@ai-sdk/deepinfra": "^3.0.12",
32
- "@ai-sdk/deepseek": "^3.0.12",
33
- "@ai-sdk/elevenlabs": "^3.0.12",
34
- "@ai-sdk/fal": "^3.0.12",
35
- "@ai-sdk/fireworks": "^3.0.13",
36
- "@ai-sdk/gateway": "^4.0.23",
37
- "@ai-sdk/gladia": "^3.0.11",
38
- "@ai-sdk/google": "^4.0.18",
39
- "@ai-sdk/google-vertex": "^5.0.22",
40
- "@ai-sdk/groq": "^4.0.12",
41
- "@ai-sdk/hume": "^3.0.11",
42
- "@ai-sdk/lmnt": "^3.0.11",
43
- "@ai-sdk/luma": "^3.0.12",
44
- "@ai-sdk/mistral": "^4.0.13",
45
- "@ai-sdk/openai": "^4.0.16",
46
- "@ai-sdk/openai-compatible": "^3.0.12",
47
- "@ai-sdk/perplexity": "^4.0.12",
48
- "@ai-sdk/react": "^4.0.34",
49
- "@ai-sdk/replicate": "^3.0.12",
50
- "@ai-sdk/revai": "^3.0.11",
51
- "@ai-sdk/togetherai": "^3.0.13",
52
- "@ai-sdk/xai": "^4.0.16",
25
+ "@ai-sdk/amazon-bedrock": "^5.0.29",
26
+ "@ai-sdk/anthropic": "^4.0.18",
27
+ "@ai-sdk/azure": "^4.0.20",
28
+ "@ai-sdk/cerebras": "^3.0.14",
29
+ "@ai-sdk/cohere": "^4.0.12",
30
+ "@ai-sdk/deepgram": "^3.0.12",
31
+ "@ai-sdk/deepinfra": "^3.0.14",
32
+ "@ai-sdk/deepseek": "^3.0.13",
33
+ "@ai-sdk/elevenlabs": "^3.0.13",
34
+ "@ai-sdk/fal": "^3.0.13",
35
+ "@ai-sdk/fireworks": "^3.0.15",
36
+ "@ai-sdk/gateway": "^4.0.27",
37
+ "@ai-sdk/gladia": "^3.0.12",
38
+ "@ai-sdk/google": "^4.0.23",
39
+ "@ai-sdk/google-vertex": "^5.0.27",
40
+ "@ai-sdk/groq": "^4.0.13",
41
+ "@ai-sdk/hume": "^3.0.12",
42
+ "@ai-sdk/lmnt": "^3.0.12",
43
+ "@ai-sdk/luma": "^3.0.13",
44
+ "@ai-sdk/mistral": "^4.0.14",
45
+ "@ai-sdk/openai": "^4.0.19",
46
+ "@ai-sdk/openai-compatible": "^3.0.14",
47
+ "@ai-sdk/perplexity": "^4.0.13",
48
+ "@ai-sdk/react": "^4.0.39",
49
+ "@ai-sdk/replicate": "^3.0.13",
50
+ "@ai-sdk/revai": "^3.0.12",
51
+ "@ai-sdk/togetherai": "^3.0.15",
52
+ "@ai-sdk/xai": "^4.0.18",
53
53
  "@beeper/chat-adapter-matrix": "^0.2.0",
54
54
  "@bitbasti/chat-adapter-webex": "^0.1.0",
55
55
  "@chat-adapter/discord": "^4.34.0",
@@ -75,16 +75,16 @@
75
75
  "@streamdown/code": "^1.1.1",
76
76
  "@streamdown/math": "^1.0.2",
77
77
  "@streamdown/mermaid": "^1.0.2",
78
- "@tuturuuu/google": "0.0.3",
79
- "@tuturuuu/internal-api": "0.20.0",
80
- "@tuturuuu/supabase": "0.4.1",
81
- "@tuturuuu/utils": "0.17.0",
82
- "@vercel/sandbox": "^2.7.1",
78
+ "@tuturuuu/google": "0.1.0",
79
+ "@tuturuuu/internal-api": "0.22.0",
80
+ "@tuturuuu/supabase": "0.5.0",
81
+ "@tuturuuu/utils": "0.18.0",
82
+ "@vercel/sandbox": "^2.8.0",
83
83
  "@zernio/chat-sdk-adapter": "^0.4.0",
84
- "ai": "^7.0.31",
84
+ "ai": "^7.0.36",
85
85
  "bash-tool": "^1.3.18",
86
86
  "chat": "^4.34.0",
87
- "chat-adapter-baileys": "^2.0.3",
87
+ "chat-adapter-baileys": "^2.1.0",
88
88
  "chat-adapter-blooio": "^0.1.0",
89
89
  "chat-adapter-imessage": "^1.1.0",
90
90
  "chat-adapter-mattermost": "^1.1.3",
@@ -92,18 +92,18 @@
92
92
  "chat-adapter-zalo": "^0.1.0",
93
93
  "chat-state-cloudflare-do": "^0.2.0",
94
94
  "chat-state-mysql": "^0.1.0",
95
- "dayjs": "^1.11.20",
96
- "next": "^16.3.0-preview.6",
95
+ "dayjs": "^1.11.21",
96
+ "next": "^16.3.0-preview.9",
97
97
  "qrcode": "^1.5.4",
98
- "react": "^19.2.7",
99
- "react-dom": "^19.2.7",
98
+ "react": "^19.2.8",
99
+ "react-dom": "^19.2.8",
100
100
  "streamdown": "^2.5.0",
101
101
  "uuid": "^14.0.1",
102
102
  "zca-js": "^2.1.2",
103
103
  "zod": "^4.4.3"
104
104
  },
105
105
  "devDependencies": {
106
- "@tuturuuu/types": "0.19.0",
106
+ "@tuturuuu/types": "0.21.0",
107
107
  "@tuturuuu/typescript-config": "0.1.1",
108
108
  "@types/node": "^26.1.1",
109
109
  "@types/qrcode": "^1.5.6",
@@ -0,0 +1,16 @@
1
+ export type ChatThinkingMode = 'fast' | 'thinking';
2
+
3
+ /**
4
+ * Use the AI SDK's provider-neutral reasoning effort so each Google model
5
+ * receives the configuration it supports. The Google provider maps `none` to
6
+ * a zero budget for Gemini 2.5 and to `minimal` for Gemini 3, while `high`
7
+ * uses the model's supported high-effort setting.
8
+ */
9
+ export function resolveChatReasoningSettings(mode: ChatThinkingMode) {
10
+ const includeThoughts = mode === 'thinking';
11
+
12
+ return {
13
+ effort: includeThoughts ? ('high' as const) : ('none' as const),
14
+ includeThoughts,
15
+ };
16
+ }
@@ -31,6 +31,7 @@ import {
31
31
  import { ChatRequestBodySchema, mapToUIMessages } from './chat-request-schema';
32
32
  import { systemInstruction } from './default-system-instruction';
33
33
  import { prepareMiraToolStep } from './mira-step-preparation';
34
+ import { resolveChatReasoningSettings } from './reasoning-settings';
34
35
  import {
35
36
  type AiRouteAuthResult,
36
37
  isInternalTuturuuuAiUser,
@@ -51,8 +52,6 @@ import {
51
52
  persistAssistantResponse,
52
53
  } from './stream-finish-persistence';
53
54
 
54
- type ThinkingMode = 'fast' | 'thinking';
55
-
56
55
  function splitSystemMessages(messages: ModelMessage[]) {
57
56
  const systemMessages: string[] = [];
58
57
  const nonSystemMessages: ModelMessage[] = [];
@@ -144,8 +143,7 @@ export function createPOST(
144
143
  observabilityContext,
145
144
  taskBoardContext,
146
145
  } = parsedBody.data;
147
- const thinkingMode: ThinkingMode =
148
- rawThinkingMode === 'thinking' ? 'thinking' : 'fast';
146
+ const thinkingMode = rawThinkingMode === 'thinking' ? 'thinking' : 'fast';
149
147
 
150
148
  if (!messages) {
151
149
  console.error('Missing messages');
@@ -461,20 +459,7 @@ export function createPOST(
461
459
  wsId: billingWsId ?? normalizedWsId,
462
460
  });
463
461
 
464
- // Reasoning mode: default to fast unless the client explicitly requests thinking.
465
- const modelLower = resolvedModelId.toLowerCase();
466
- const supportsThinking =
467
- modelLower.includes('gemini-2.5') || modelLower.includes('gemini-3');
468
- const thinkingConfig = supportsThinking
469
- ? thinkingMode === 'thinking'
470
- ? { thinkingConfig: { includeThoughts: true } }
471
- : {
472
- thinkingConfig: {
473
- thinkingBudget: 0,
474
- includeThoughts: false,
475
- },
476
- }
477
- : {};
462
+ const reasoningSettings = resolveChatReasoningSettings(thinkingMode);
478
463
  const forceRenderUi = shouldForceRenderUiForLatestUserMessage(
479
464
  promptMessages.messages
480
465
  );
@@ -540,6 +525,7 @@ export function createPOST(
540
525
  maxRetries: 0,
541
526
  model: resolvedGatewayModel,
542
527
  messages: promptMessages.messages,
528
+ reasoning: reasoningSettings.effort,
543
529
  system: mergeSystemInstructions(
544
530
  isMiraMode && miraSystemPrompt ? miraSystemPrompt : systemInstruction,
545
531
  promptMessages.system
@@ -561,7 +547,9 @@ export function createPOST(
561
547
  }),
562
548
  providerOptions: {
563
549
  google: {
564
- ...thinkingConfig,
550
+ thinkingConfig: {
551
+ includeThoughts: reasoningSettings.includeThoughts,
552
+ },
565
553
  safetySettings: [
566
554
  {
567
555
  category: 'HARM_CATEGORY_DANGEROUS_CONTENT',
@@ -582,7 +570,9 @@ export function createPOST(
582
570
  ],
583
571
  },
584
572
  vertex: {
585
- ...thinkingConfig,
573
+ thinkingConfig: {
574
+ includeThoughts: reasoningSettings.includeThoughts,
575
+ },
586
576
  safetySettings: [
587
577
  {
588
578
  category: 'HARM_CATEGORY_HARASSMENT',