@cloudflare/ai-chat 0.1.2 → 0.1.3
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/CHANGELOG.md +6 -0
- package/e2e/playwright.config.ts +5 -4
- package/e2e/worker.ts +0 -2
- package/e2e/wrangler.jsonc +1 -1
- package/package.json +3 -3
- package/e2e/global-setup.ts +0 -34
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @cloudflare/ai-chat
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#954](https://github.com/cloudflare/agents/pull/954) [`943c407`](https://github.com/cloudflare/agents/commit/943c4070992bb836625abb5bf4e3271a6f52f7a2) Thanks [@threepointone](https://github.com/threepointone)! - update dependencies
|
|
8
|
+
|
|
3
9
|
## 0.1.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/e2e/playwright.config.ts
CHANGED
|
@@ -10,15 +10,16 @@ export default defineConfig({
|
|
|
10
10
|
testDir: e2eDir,
|
|
11
11
|
testMatch: "*.spec.ts",
|
|
12
12
|
timeout: 30_000,
|
|
13
|
-
retries:
|
|
13
|
+
retries: 3,
|
|
14
14
|
workers: 1, // Sequential — single wrangler dev instance
|
|
15
|
-
// Kill stale processes on the test port before starting
|
|
16
|
-
globalSetup: [join(e2eDir, "global-setup.ts")],
|
|
17
15
|
use: {
|
|
18
16
|
baseURL: `http://localhost:${PORT}`
|
|
19
17
|
},
|
|
20
18
|
webServer: {
|
|
21
|
-
|
|
19
|
+
// Kill stale processes on the port before starting wrangler.
|
|
20
|
+
// This must be part of the command (not globalSetup) because
|
|
21
|
+
// Playwright starts the webServer before running globalSetup.
|
|
22
|
+
command: `lsof -ti tcp:${PORT} | xargs kill -9 2>/dev/null; npx wrangler dev --config ${configPath} --port ${PORT}`,
|
|
22
23
|
port: PORT,
|
|
23
24
|
reuseExistingServer: !process.env.CI,
|
|
24
25
|
timeout: 20_000
|
package/e2e/worker.ts
CHANGED
|
@@ -68,7 +68,6 @@ export class LlmChatAgent extends AIChatAgent<Env> {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
const result = streamText({
|
|
71
|
-
// @ts-expect-error — model not yet in workers-ai-provider types
|
|
72
71
|
model: workersai("@cf/zai-org/glm-4.7-flash"),
|
|
73
72
|
system:
|
|
74
73
|
"You are a helpful test assistant. Keep responses very short (1-2 sentences max). " +
|
|
@@ -95,7 +94,6 @@ export class ClientToolAgent extends AIChatAgent<Env> {
|
|
|
95
94
|
const workersai = createWorkersAI({ binding: this.env.AI });
|
|
96
95
|
|
|
97
96
|
const result = streamText({
|
|
98
|
-
// @ts-expect-error — model not yet in workers-ai-provider types
|
|
99
97
|
model: workersai("@cf/zai-org/glm-4.7-flash"),
|
|
100
98
|
system:
|
|
101
99
|
"You are a test assistant. Always use the getUserLocation tool when asked about location.",
|
package/e2e/wrangler.jsonc
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/ai-chat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Cloudflare Agents (x) AI SDK Chat",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@playwright/test": "^1.58.2",
|
|
23
23
|
"@types/react": "^19.2.14",
|
|
24
|
-
"ai": "^6.0.
|
|
24
|
+
"ai": "^6.0.94",
|
|
25
25
|
"react": "^19.2.4",
|
|
26
26
|
"vitest-browser-react": "^1.0.1",
|
|
27
27
|
"zod": "^4.3.6"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@ai-sdk/react": "^3.0.0",
|
|
31
|
-
"agents": "^0.5.
|
|
31
|
+
"agents": "^0.5.1",
|
|
32
32
|
"ai": "^6.0.0",
|
|
33
33
|
"react": "^19.0.0",
|
|
34
34
|
"zod": "^3.25.0 || ^4.0.0"
|
package/e2e/global-setup.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Playwright global setup: kill any stale process on the test port
|
|
3
|
-
* left behind by a previous run that was forcefully terminated.
|
|
4
|
-
*/
|
|
5
|
-
import { execSync } from "node:child_process";
|
|
6
|
-
|
|
7
|
-
const PORT = 8799;
|
|
8
|
-
|
|
9
|
-
function killProcessOnPort(port: number): void {
|
|
10
|
-
try {
|
|
11
|
-
const output = execSync(`lsof -ti tcp:${port} 2>/dev/null || true`)
|
|
12
|
-
.toString()
|
|
13
|
-
.trim();
|
|
14
|
-
if (output) {
|
|
15
|
-
const pids = output.split("\n").filter(Boolean);
|
|
16
|
-
for (const pid of pids) {
|
|
17
|
-
try {
|
|
18
|
-
process.kill(Number(pid), "SIGKILL");
|
|
19
|
-
console.log(
|
|
20
|
-
`[global-setup] Killed stale process ${pid} on port ${port}`
|
|
21
|
-
);
|
|
22
|
-
} catch {
|
|
23
|
-
// Process may have already exited
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
} catch {
|
|
28
|
-
// lsof not available or other error — ignore
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default function globalSetup() {
|
|
33
|
-
killProcessOnPort(PORT);
|
|
34
|
-
}
|