@pylonsync/client 0.3.369 → 0.3.371

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.
@@ -31,14 +31,26 @@ export interface ChatBotProps {
31
31
  * chunks are also accepted so this works with apps that just yield
32
32
  * `event.delta` directly.
33
33
  *
34
- * Server-side authoring (5 lines):
34
+ * Server-side authoring:
35
35
  * ```ts
36
36
  * export default action({
37
37
  * args: { messages: v.array(v.object({ role: v.string(), content: v.string() })) },
38
+ * // Streaming does NOT extend the call deadline (PYLON_FN_CALL_TIMEOUT,
39
+ * // 30s default) — raise it here for long answers.
40
+ * timeout: 120,
38
41
  * async handler(ctx, { messages }) {
39
- * return ctx.llm.streamMessage({ model: "claude-haiku", messages });
42
+ * await ctx.llm.stream({ messages }, (e) => {
43
+ * if (e.type === "text_delta") ctx.stream.write(e.text);
44
+ * });
40
45
  * },
41
46
  * });
42
47
  * ```
48
+ *
49
+ * `ctx.llm.stream` resolves with the same assembled response
50
+ * `ctx.llm.complete` returns, so a handler that runs tools can inspect
51
+ * `res.stop_reason` and loop while still streaming text to this
52
+ * component. `ctx.stream.write` reaches only the client holding this
53
+ * request — to fan the same output out to every device watching, also
54
+ * push it with `ctx.rooms.broadcast(room, topic, data)`.
43
55
  */
44
56
  export declare function ChatBot({ fn, extraArgs, systemPrompt, initialMessages, placeholder, title, className, }: ChatBotProps): React.JSX.Element;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.369",
6
+ "version": "0.3.371",
7
7
  "type": "module",
8
8
  "main": "src/index.ts",
9
9
  "types": "./dist/index.d.ts",
@@ -20,8 +20,8 @@
20
20
  "prepack": "bun run build"
21
21
  },
22
22
  "dependencies": {
23
- "@pylonsync/react": "0.3.369",
24
- "@pylonsync/sync": "0.3.369",
23
+ "@pylonsync/react": "0.3.371",
24
+ "@pylonsync/sync": "0.3.371",
25
25
  "clsx": "^2.1.1"
26
26
  },
27
27
  "peerDependencies": {
@@ -45,15 +45,27 @@ export interface ChatBotProps {
45
45
  * chunks are also accepted so this works with apps that just yield
46
46
  * `event.delta` directly.
47
47
  *
48
- * Server-side authoring (5 lines):
48
+ * Server-side authoring:
49
49
  * ```ts
50
50
  * export default action({
51
51
  * args: { messages: v.array(v.object({ role: v.string(), content: v.string() })) },
52
+ * // Streaming does NOT extend the call deadline (PYLON_FN_CALL_TIMEOUT,
53
+ * // 30s default) — raise it here for long answers.
54
+ * timeout: 120,
52
55
  * async handler(ctx, { messages }) {
53
- * return ctx.llm.streamMessage({ model: "claude-haiku", messages });
56
+ * await ctx.llm.stream({ messages }, (e) => {
57
+ * if (e.type === "text_delta") ctx.stream.write(e.text);
58
+ * });
54
59
  * },
55
60
  * });
56
61
  * ```
62
+ *
63
+ * `ctx.llm.stream` resolves with the same assembled response
64
+ * `ctx.llm.complete` returns, so a handler that runs tools can inspect
65
+ * `res.stop_reason` and loop while still streaming text to this
66
+ * component. `ctx.stream.write` reaches only the client holding this
67
+ * request — to fan the same output out to every device watching, also
68
+ * push it with `ctx.rooms.broadcast(room, topic, data)`.
57
69
  */
58
70
  export function ChatBot({
59
71
  fn,