Skip to content

Commit 6cd6b96

Browse files
Version Packages (#38)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent ff0679f commit 6cd6b96

File tree

6 files changed

+55
-47
lines changed

6 files changed

+55
-47
lines changed

.changeset/brave-papers-follow.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/agents/CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,45 @@
11
# @cloudflare/agents
22

3+
## 0.0.21
4+
5+
### Patch Changes
6+
7+
- [#37](https://github.com/cloudflare/agents/pull/37) [`ff0679f`](https://github.com/cloudflare/agents/commit/ff0679f638d377c8629a1fd2762c58045ec397b5) Thanks [@threepointone](https://github.com/threepointone)! - `Agent::initialState`
8+
9+
You can now set an initial state for an agent
10+
11+
```ts
12+
type State = {
13+
counter: number;
14+
text: string;
15+
color: string;
16+
};
17+
18+
class MyAgent extends Agent<Env, State> {
19+
initialState = {
20+
counter: 0,
21+
text: "",
22+
color: "#3B82F6",
23+
};
24+
25+
doSomething() {
26+
console.log(this.state); // {counter: 0, text: "", color: "#3B82F6"}, if you haven't set the state yet
27+
}
28+
}
29+
```
30+
31+
As before, this gets synced to useAgent, so you can do:
32+
33+
```ts
34+
const [state, setState] = useState<State>();
35+
const agent = useAgent<State>({
36+
agent: "my-agent",
37+
onStateUpdate: (state) => {
38+
setState(state);
39+
},
40+
});
41+
```
42+
343
## 0.0.20
444

545
### Patch Changes

packages/agents/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "agents-sdk",
3-
"version": "0.0.20",
3+
"version": "0.0.21",
44
"main": "src/index.ts",
55
"type": "module",
66
"scripts": {

packages/hono-agents/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# hono-agents
22

3+
## 0.0.9
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [[`ff0679f`](https://github.com/cloudflare/agents/commit/ff0679f638d377c8629a1fd2762c58045ec397b5)]:
8+
9+
310
## 0.0.8
411

512
### Patch Changes

packages/hono-agents/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hono-agents",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"main": "src/index.ts",
55
"type": "module",
66
"scripts": {
@@ -35,11 +35,11 @@
3535
"license": "MIT",
3636
"description": "Add Cloudflare Agents to your Hono app",
3737
"peerDependencies": {
38-
"agents-sdk": "^0.0.20",
38+
"agents-sdk": "^0.0.21",
3939
"hono": "^4.6.17"
4040
},
4141
"devDependencies": {
42-
"agents-sdk": "^0.0.20",
42+
"agents-sdk": "^0.0.21",
4343
"hono": "^4.6.17"
4444
}
4545
}

0 commit comments

Comments
 (0)