@tuturuuu/ai 0.2.0 → 0.2.2
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 +5 -0
- package/package.json +38 -38
- package/src/chat/google/route.ts +2 -3
- package/src/chat-sdk/zalo-personal.ts +15 -11
- package/src/tools/executors/search.ts +2 -3
- package/src/tools/google-search-tool.ts +12 -0
package/README.md
CHANGED
|
@@ -61,6 +61,11 @@ yarn add @tuturuuu/ai
|
|
|
61
61
|
bun add @tuturuuu/ai
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
Published artifacts replace local `workspace:*` dependencies with exact
|
|
65
|
+
registry versions before packing. If a public consumer cannot install this
|
|
66
|
+
package, rerun the package release from the current production commit so its
|
|
67
|
+
manifest points at published Tuturuuu package versions.
|
|
68
|
+
|
|
64
69
|
## Development
|
|
65
70
|
|
|
66
71
|
```bash
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuturuuu/ai",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/tutur3u/platform",
|
|
@@ -22,34 +22,34 @@
|
|
|
22
22
|
"type-check": "tsgo --project tsconfig.typecheck.json"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@ai-sdk/amazon-bedrock": "^4.0.
|
|
26
|
-
"@ai-sdk/anthropic": "^3.0.
|
|
27
|
-
"@ai-sdk/azure": "^3.0.
|
|
28
|
-
"@ai-sdk/cerebras": "^2.0.
|
|
29
|
-
"@ai-sdk/cohere": "^3.0.
|
|
30
|
-
"@ai-sdk/deepgram": "^2.0.
|
|
31
|
-
"@ai-sdk/deepinfra": "^2.0.
|
|
32
|
-
"@ai-sdk/deepseek": "^2.0.
|
|
33
|
-
"@ai-sdk/elevenlabs": "^2.0.
|
|
34
|
-
"@ai-sdk/fal": "^2.0.
|
|
35
|
-
"@ai-sdk/fireworks": "^2.0.
|
|
36
|
-
"@ai-sdk/gateway": "^3.0.
|
|
37
|
-
"@ai-sdk/gladia": "^2.0.
|
|
38
|
-
"@ai-sdk/google": "^3.0.
|
|
39
|
-
"@ai-sdk/google-vertex": "^4.0.
|
|
40
|
-
"@ai-sdk/groq": "^3.0.
|
|
41
|
-
"@ai-sdk/hume": "^2.0.
|
|
42
|
-
"@ai-sdk/lmnt": "^2.0.
|
|
43
|
-
"@ai-sdk/luma": "^2.0.
|
|
44
|
-
"@ai-sdk/mistral": "^3.0.
|
|
45
|
-
"@ai-sdk/openai": "^3.0.
|
|
46
|
-
"@ai-sdk/openai-compatible": "^2.0.
|
|
47
|
-
"@ai-sdk/perplexity": "^3.0.
|
|
48
|
-
"@ai-sdk/react": "^3.0.
|
|
49
|
-
"@ai-sdk/replicate": "^2.0.
|
|
50
|
-
"@ai-sdk/revai": "^2.0.
|
|
51
|
-
"@ai-sdk/togetherai": "^2.0.
|
|
52
|
-
"@ai-sdk/xai": "^3.0.
|
|
25
|
+
"@ai-sdk/amazon-bedrock": "^4.0.114",
|
|
26
|
+
"@ai-sdk/anthropic": "^3.0.82",
|
|
27
|
+
"@ai-sdk/azure": "^3.0.72",
|
|
28
|
+
"@ai-sdk/cerebras": "^2.0.55",
|
|
29
|
+
"@ai-sdk/cohere": "^3.0.37",
|
|
30
|
+
"@ai-sdk/deepgram": "^2.0.34",
|
|
31
|
+
"@ai-sdk/deepinfra": "^2.0.53",
|
|
32
|
+
"@ai-sdk/deepseek": "^2.0.36",
|
|
33
|
+
"@ai-sdk/elevenlabs": "^2.0.34",
|
|
34
|
+
"@ai-sdk/fal": "^2.0.35",
|
|
35
|
+
"@ai-sdk/fireworks": "^2.0.54",
|
|
36
|
+
"@ai-sdk/gateway": "^3.0.127",
|
|
37
|
+
"@ai-sdk/gladia": "^2.0.34",
|
|
38
|
+
"@ai-sdk/google": "^3.0.81",
|
|
39
|
+
"@ai-sdk/google-vertex": "^4.0.143",
|
|
40
|
+
"@ai-sdk/groq": "^3.0.40",
|
|
41
|
+
"@ai-sdk/hume": "^2.0.34",
|
|
42
|
+
"@ai-sdk/lmnt": "^2.0.34",
|
|
43
|
+
"@ai-sdk/luma": "^2.0.34",
|
|
44
|
+
"@ai-sdk/mistral": "^3.0.38",
|
|
45
|
+
"@ai-sdk/openai": "^3.0.69",
|
|
46
|
+
"@ai-sdk/openai-compatible": "^2.0.49",
|
|
47
|
+
"@ai-sdk/perplexity": "^3.0.34",
|
|
48
|
+
"@ai-sdk/react": "^3.0.201",
|
|
49
|
+
"@ai-sdk/replicate": "^2.0.34",
|
|
50
|
+
"@ai-sdk/revai": "^2.0.34",
|
|
51
|
+
"@ai-sdk/togetherai": "^2.0.54",
|
|
52
|
+
"@ai-sdk/xai": "^3.0.94",
|
|
53
53
|
"@beeper/chat-adapter-matrix": "^0.2.0",
|
|
54
54
|
"@bitbasti/chat-adapter-webex": "^0.1.0",
|
|
55
55
|
"@chat-adapter/discord": "^4.30.0",
|
|
@@ -68,20 +68,20 @@
|
|
|
68
68
|
"@chat-adapter/whatsapp": "^4.30.0",
|
|
69
69
|
"@json-render/core": "^0.19.0",
|
|
70
70
|
"@json-render/react": "^0.19.0",
|
|
71
|
-
"@liveblocks/chat-sdk-adapter": "^3.19.
|
|
71
|
+
"@liveblocks/chat-sdk-adapter": "^3.19.5",
|
|
72
72
|
"@octokit/rest": "^22.0.1",
|
|
73
73
|
"@resend/chat-sdk-adapter": "^0.2.2",
|
|
74
74
|
"@streamdown/cjk": "^1.0.3",
|
|
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.
|
|
79
|
-
"@tuturuuu/internal-api": "0.
|
|
78
|
+
"@tuturuuu/google": "0.0.2",
|
|
79
|
+
"@tuturuuu/internal-api": "0.7.1",
|
|
80
80
|
"@tuturuuu/supabase": "0.3.3",
|
|
81
|
-
"@tuturuuu/utils": "0.
|
|
82
|
-
"@vercel/sandbox": "^2.
|
|
81
|
+
"@tuturuuu/utils": "0.6.1",
|
|
82
|
+
"@vercel/sandbox": "^2.2.0",
|
|
83
83
|
"@zernio/chat-sdk-adapter": "^0.3.0",
|
|
84
|
-
"ai": "^6.0.
|
|
84
|
+
"ai": "^6.0.199",
|
|
85
85
|
"bash-tool": "^1.3.17",
|
|
86
86
|
"chat": "^4.30.0",
|
|
87
87
|
"chat-adapter-baileys": "^2.0.3",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"chat-state-cloudflare-do": "^0.2.0",
|
|
94
94
|
"chat-state-mysql": "^0.1.0",
|
|
95
95
|
"dayjs": "^1.11.20",
|
|
96
|
-
"next": "^16.2.
|
|
96
|
+
"next": "^16.2.9",
|
|
97
97
|
"qrcode": "^1.5.4",
|
|
98
98
|
"react": "^19.2.7",
|
|
99
99
|
"react-dom": "^19.2.7",
|
|
@@ -103,9 +103,9 @@
|
|
|
103
103
|
"zod": "^4.4.3"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
|
-
"@tuturuuu/types": "0.
|
|
106
|
+
"@tuturuuu/types": "0.8.0",
|
|
107
107
|
"@tuturuuu/typescript-config": "0.1.1",
|
|
108
|
-
"@types/node": "^25.9.
|
|
108
|
+
"@types/node": "^25.9.3",
|
|
109
109
|
"@types/qrcode": "^1.5.6",
|
|
110
110
|
"@types/react": "^19.2.17",
|
|
111
111
|
"typescript": "^6.0.3"
|
package/src/chat/google/route.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
resolvePlanModel,
|
|
19
19
|
} from '../../credits/resolve-plan-model';
|
|
20
20
|
import { withAiMemory } from '../../memory';
|
|
21
|
+
import { createGoogleSearchToolSet } from '../../tools/google-search-tool';
|
|
21
22
|
import type { CreditSource as SharedCreditSource } from '../credit-source';
|
|
22
23
|
import {
|
|
23
24
|
shouldForceGoogleSearchForLatestUserMessage,
|
|
@@ -495,9 +496,7 @@ export function createPOST(
|
|
|
495
496
|
);
|
|
496
497
|
|
|
497
498
|
// Provider-native Google Search tool for non-Mira mode.
|
|
498
|
-
const googleSearchTool =
|
|
499
|
-
google_search: google.tools.googleSearch({}),
|
|
500
|
-
};
|
|
499
|
+
const googleSearchTool = createGoogleSearchToolSet();
|
|
501
500
|
|
|
502
501
|
type PrepareStep = NonNullable<
|
|
503
502
|
NonNullable<Parameters<typeof streamText>[0]>['prepareStep']
|
|
@@ -1256,16 +1256,15 @@ export function createZaloPersonalAdapter(
|
|
|
1256
1256
|
});
|
|
1257
1257
|
}
|
|
1258
1258
|
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
if (!requestViaWebSocket) {
|
|
1259
|
+
if (!requestViaWebSocket) {
|
|
1260
|
+
try {
|
|
1261
|
+
await transferApi.tuturuuuRequestPhoneSync?.({
|
|
1262
|
+
data: syncPayload,
|
|
1263
|
+
reqId: requestId,
|
|
1264
|
+
});
|
|
1265
|
+
requestViaHttp = true;
|
|
1266
|
+
} catch (error) {
|
|
1267
|
+
requestHttpError = toSafePhoneSyncError(error);
|
|
1269
1268
|
throw error;
|
|
1270
1269
|
}
|
|
1271
1270
|
}
|
|
@@ -1341,7 +1340,12 @@ export function createZaloPersonalAdapter(
|
|
|
1341
1340
|
.tuturuuuCleanMobileSync?.({ publicKey })
|
|
1342
1341
|
.then(() => true)
|
|
1343
1342
|
.catch(() => false)) ?? false;
|
|
1344
|
-
} else if (
|
|
1343
|
+
} else if (
|
|
1344
|
+
requestAccepted &&
|
|
1345
|
+
lastError &&
|
|
1346
|
+
messages.length === 0 &&
|
|
1347
|
+
!isPhoneSyncApprovalPendingError(lastError)
|
|
1348
|
+
) {
|
|
1345
1349
|
await transferApi
|
|
1346
1350
|
.tuturuuuCancelMobileMessages?.({ publicKey })
|
|
1347
1351
|
.catch(() => undefined);
|
|
@@ -2,6 +2,7 @@ import { google } from '@ai-sdk/google';
|
|
|
2
2
|
import { generateText, stepCountIs } from 'ai';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { withAiMemory } from '../../memory';
|
|
5
|
+
import { createGoogleSearchToolSet } from '../google-search-tool';
|
|
5
6
|
import type { MiraToolContext } from '../mira-tools';
|
|
6
7
|
|
|
7
8
|
const SEARCH_WRAPPER_MODEL = 'gemini-3.1-flash-lite';
|
|
@@ -85,9 +86,7 @@ async function runGoogleSearchWrapper(
|
|
|
85
86
|
userId: ctx.userId,
|
|
86
87
|
wsId: ctx.workspaceContext?.wsId ?? ctx.wsId,
|
|
87
88
|
}),
|
|
88
|
-
tools:
|
|
89
|
-
google_search: google.tools.googleSearch({}),
|
|
90
|
-
},
|
|
89
|
+
tools: createGoogleSearchToolSet(),
|
|
91
90
|
prompt,
|
|
92
91
|
stopWhen: stepCountIs(4),
|
|
93
92
|
...(forceTool ? { toolChoice: 'required' as const } : {}),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { google } from '@ai-sdk/google';
|
|
2
|
+
import type { ToolSet } from 'ai';
|
|
3
|
+
|
|
4
|
+
export function createGoogleSearchToolSet(): ToolSet {
|
|
5
|
+
return {
|
|
6
|
+
// Google executes this provider tool itself; AI SDK's public ToolSet type
|
|
7
|
+
// still narrows provider tools through the local-tool generic union.
|
|
8
|
+
google_search: google.tools.googleSearch<never>(
|
|
9
|
+
{}
|
|
10
|
+
) as unknown as ToolSet[string],
|
|
11
|
+
};
|
|
12
|
+
}
|