@fabric-harness/cloudflare 0.4.0 → 0.5.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/README.md +6 -3
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -13,10 +13,12 @@ npm install @fabric-harness/cloudflare @fabric-harness/sdk
|
|
|
13
13
|
## Quick start
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
|
-
import {
|
|
16
|
+
import { agent } from '@fabric-harness/sdk';
|
|
17
17
|
import { getCloudflareSandbox } from '@fabric-harness/cloudflare';
|
|
18
18
|
|
|
19
|
-
export default
|
|
19
|
+
export default agent({
|
|
20
|
+
name: 'edge-assistant', triggers: { webhook: true },
|
|
21
|
+
run: async ({ init, payload, env }) => {
|
|
20
22
|
const sandbox = await getCloudflareSandbox(env.SANDBOX, 'session-1');
|
|
21
23
|
const session = await (await init({
|
|
22
24
|
sandbox,
|
|
@@ -24,7 +26,8 @@ export default defineAgent(async ({ init, payload, env }) => {
|
|
|
24
26
|
runtime: 'stateless',
|
|
25
27
|
})).session();
|
|
26
28
|
return { reply: await session.prompt<string>(String((payload as any)?.message ?? '')) };
|
|
27
|
-
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
28
31
|
```
|
|
29
32
|
|
|
30
33
|
Build with `fh build --target cloudflare` to produce an artifact ready for `wrangler deploy`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabric-harness/cloudflare",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Cloudflare Workers and Sandbox adapter for Fabric Harness.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Fabric",
|
|
@@ -38,13 +38,8 @@
|
|
|
38
38
|
"README.md",
|
|
39
39
|
"LICENSE"
|
|
40
40
|
],
|
|
41
|
-
"scripts": {
|
|
42
|
-
"build": "tsc -p tsconfig.json",
|
|
43
|
-
"check": "tsc -b tsconfig.json",
|
|
44
|
-
"test": "vitest run"
|
|
45
|
-
},
|
|
46
41
|
"dependencies": {
|
|
47
|
-
"@fabric-harness/sdk": "
|
|
42
|
+
"@fabric-harness/sdk": "0.5.0"
|
|
48
43
|
},
|
|
49
44
|
"peerDependencies": {
|
|
50
45
|
"@cloudflare/sandbox": "*"
|
|
@@ -57,5 +52,10 @@
|
|
|
57
52
|
"devDependencies": {
|
|
58
53
|
"typescript": "^5.8.3",
|
|
59
54
|
"vitest": "^4.1.5"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsc -p tsconfig.json",
|
|
58
|
+
"check": "tsc -b tsconfig.json",
|
|
59
|
+
"test": "vitest run"
|
|
60
60
|
}
|
|
61
|
-
}
|
|
61
|
+
}
|