@economic/agents-react 0.2.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.mjs +7 -4
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -36,23 +36,26 @@ function useAIChatAgent(options) {
36
36
  updateConnectionStatus("disconnected");
37
37
  onCloseProp?.(event);
38
38
  },
39
- onError: onErrorProp
39
+ onError: onErrorProp,
40
+ protocols
40
41
  });
41
42
  const chat = useAgentChat({
42
43
  agent,
43
- body: toolContext ?? {}
44
+ body: toolContext ?? {},
45
+ headers
44
46
  });
45
47
  const hasSentWelcome = React.useRef(false);
46
48
  React.useEffect(() => {
47
49
  if (welcomeMessage && connectionStatus === "connected" && chat.messages.length === 0 && !hasSentWelcome.current) {
48
50
  hasSentWelcome.current = true;
49
- chat.sendMessage({
51
+ chat.setMessages([{
52
+ id: "welcome-message",
50
53
  role: "assistant",
51
54
  parts: [{
52
55
  type: "text",
53
56
  text: welcomeMessage
54
57
  }]
55
- });
58
+ }]);
56
59
  }
57
60
  }, [
58
61
  connectionStatus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@economic/agents-react",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@cloudflare/ai-chat": ">=0.1.0 <1.0.0",
33
- "agents": "^0.10.1",
33
+ "agents": "^0.11.0",
34
34
  "ai": "^6.0.0",
35
35
  "react": "^19.2.5"
36
36
  }