llmz 0.8.0 → 0.9.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 (54) hide show
  1. package/README.md +45 -11
  2. package/dist/chat.d.ts +6 -6
  3. package/dist/{common-pgJjFu2Y.js → common-BlRFtdf2.js} +233 -22
  4. package/dist/{common-DdArNQhl.cjs → common-BnvrDnIT.cjs} +238 -21
  5. package/dist/{component-BXS8vAwO.cjs → component-C6Agl2ns.cjs} +1 -1
  6. package/dist/{component-Dq7ZLdvy.js → component-DGG7d_Mz.js} +1 -1
  7. package/dist/component.default.d.ts +10 -0
  8. package/dist/context.d.ts +4 -8
  9. package/dist/{custom-client-2V9lmzUf.js → custom-client-ChuZ63zp.js} +15 -12
  10. package/dist/{custom-client-HkM1Sdzv.cjs → custom-client-DAsGRnYc.cjs} +18 -15
  11. package/dist/{dual-modes-Cy0_W4O2.js → dual-modes-DDkoCp3R.js} +1246 -1170
  12. package/dist/{dual-modes-Cb7ThvoV.cjs → dual-modes-DPXiuvNe.cjs} +1239 -1169
  13. package/dist/example-format.d.ts +8 -0
  14. package/dist/{execute-Aw4cbIx-.js → execute-BWcdv9so.js} +64 -85
  15. package/dist/{execute-COIHOIKR.cjs → execute-DM2-7y86.cjs} +64 -85
  16. package/dist/index.cjs +254 -11
  17. package/dist/index.js +253 -10
  18. package/dist/index.workerd.js +8646 -8108
  19. package/dist/inspect.d.ts +2 -0
  20. package/dist/isPlainObject-CSxXVKCk.cjs +56 -0
  21. package/dist/isPlainObject-D39AzPO2.js +51 -0
  22. package/dist/{jsx-B0iYyvfr.js → jsx-CIgdGGVs.js} +2 -50
  23. package/dist/{jsx-D5Y2cPo-.cjs → jsx-owqxrquU.cjs} +2 -56
  24. package/dist/message-stream/instructions.d.ts +8 -0
  25. package/dist/message-stream/parser.d.ts +6 -0
  26. package/dist/message-stream/response-parser.d.ts +24 -0
  27. package/dist/message-stream/response-parser.test.d.ts +1 -0
  28. package/dist/message-stream/types.d.ts +3 -2
  29. package/dist/prompts/adherence.test.d.ts +1 -0
  30. package/dist/prompts/catalogue-examples.test.d.ts +1 -0
  31. package/dist/prompts/chat-mode/protocol.d.ts +2 -0
  32. package/dist/prompts/chat-mode/system.d.ts +1 -1
  33. package/dist/prompts/chat-mode/user.d.ts +1 -1
  34. package/dist/prompts/code-examples.d.ts +2 -0
  35. package/dist/prompts/code-examples.test.d.ts +1 -0
  36. package/dist/prompts/common.d.ts +2 -1
  37. package/dist/prompts/concrete-patterns.test.d.ts +1 -0
  38. package/dist/prompts/long-search.test.d.ts +1 -0
  39. package/dist/prompts/prompt.d.ts +5 -2
  40. package/dist/prompts/protocol-basics.d.ts +5 -0
  41. package/dist/prompts/protocol-simple.test.d.ts +1 -0
  42. package/dist/prompts/protocol.d.ts +13 -0
  43. package/dist/prompts/sections.test.d.ts +1 -0
  44. package/dist/prompts/worker-mode/protocol.d.ts +2 -0
  45. package/dist/prompts/worker-mode/system.d.ts +1 -1
  46. package/dist/prompts/worker-mode/user.d.ts +1 -1
  47. package/dist/runtime/citations.test.d.ts +1 -0
  48. package/dist/runtime/fixtures/long-search.d.ts +19 -0
  49. package/dist/runtime/fixtures/protocol-languages.d.ts +74 -0
  50. package/dist/runtime/fixtures/qwen-protocol-failures.d.ts +29 -0
  51. package/dist/runtime/generate.d.ts +2 -9
  52. package/dist/runtime/protocol-adherence.test.d.ts +1 -0
  53. package/dist/runtime/types.d.ts +4 -7
  54. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,18 +1,18 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_common = require("./common-DdArNQhl.cjs");
3
- const require_dual_modes = require("./dual-modes-Cb7ThvoV.cjs");
4
- const require_custom_client = require("./custom-client-HkM1Sdzv.cjs");
2
+ const require_dual_modes = require("./dual-modes-DPXiuvNe.cjs");
3
+ const require_common = require("./common-BnvrDnIT.cjs");
4
+ const require_custom_client = require("./custom-client-DAsGRnYc.cjs");
5
5
  const require_utils = require("./utils-3ESwP3yg.cjs");
6
- const require_component = require("./component-BXS8vAwO.cjs");
7
6
  const require_tool = require("./tool-Dy6AJpJH.cjs");
8
7
  const require_errors = require("./errors-C962uJdS.cjs");
9
8
  const require_typings = require("./typings-3lsqCbkn.cjs");
10
9
  const require_exit = require("./exit-DUM96DN1.cjs");
10
+ const require_component = require("./component-C6Agl2ns.cjs");
11
11
  const require_truncator = require("./truncator-CLkouTCO.cjs");
12
12
  const require_quickjs_variant = require("./quickjs-variant-CsIwTVFC.cjs");
13
13
  let _bpinternal_zui = require("@bpinternal/zui");
14
14
  //#region package.json
15
- var version = "0.8.0";
15
+ var version = "0.9.0";
16
16
  //#endregion
17
17
  //#region src/hoist.ts
18
18
  /**
@@ -792,6 +792,249 @@ var CitationsManager = class {
792
792
  }
793
793
  };
794
794
  //#endregion
795
+ //#region src/component.default.ts
796
+ const Button = new require_component.Component({
797
+ type: "leaf",
798
+ description: "A button component that can perform actions when clicked",
799
+ name: "Button",
800
+ aliases: ["btn"],
801
+ generation: {
802
+ usage: "Offer quick actions or choices after a message. It is common to send several buttons together: write one separate ■send=button block per choice in the SAME response. Each button has its own props and no body. Send all the choices before the final exit; do not wait for a user reply between buttons.",
803
+ examples: [
804
+ { props: {
805
+ action: "say",
806
+ label: "Track my order"
807
+ } },
808
+ { props: {
809
+ action: "url",
810
+ label: "View guide",
811
+ url: "https://example.com/guide"
812
+ } },
813
+ { props: {
814
+ action: "postback",
815
+ label: "Choose Standard",
816
+ value: "plan_standard"
817
+ } },
818
+ [
819
+ { props: {
820
+ action: "say",
821
+ label: "Track my order"
822
+ } },
823
+ { props: {
824
+ action: "say",
825
+ label: "Return an item"
826
+ } },
827
+ { props: {
828
+ action: "say",
829
+ label: "Contact support"
830
+ } }
831
+ ]
832
+ ]
833
+ },
834
+ leaf: { props: _bpinternal_zui.z.object({
835
+ action: _bpinternal_zui.z.enum([
836
+ "say",
837
+ "url",
838
+ "postback"
839
+ ]).default("say").describe("The action to perform when the button is clicked. Can be \"say\", \"url\", or \"postback\""),
840
+ label: _bpinternal_zui.z.string().describe("The text displayed on the button (min 1 character, max 250 characters)"),
841
+ value: _bpinternal_zui.z.string().optional().describe("The postback value to send when the button is clicked. Required if action is \"postback\""),
842
+ url: _bpinternal_zui.z.string().optional().describe("The URL to open when the button is clicked. Required if action is \"url\"")
843
+ }) }
844
+ });
845
+ const Image = new require_component.Component({
846
+ type: "leaf",
847
+ name: "Image",
848
+ description: "Displays an image from a URL.",
849
+ aliases: [],
850
+ generation: {
851
+ usage: "Use a known image URL from the user or tool results; never invent an image URL. No body.",
852
+ examples: [{ props: {
853
+ url: "https://example.com/trail.jpg",
854
+ alt: "Forest trail beside a lake"
855
+ } }]
856
+ },
857
+ leaf: { props: _bpinternal_zui.z.object({
858
+ url: _bpinternal_zui.z.string().describe("The URL of the image (must be valid)"),
859
+ alt: _bpinternal_zui.z.string().optional().describe("Alternative text describing the image")
860
+ }) }
861
+ });
862
+ const File = new require_component.Component({
863
+ type: "leaf",
864
+ name: "File",
865
+ description: "Sends a downloadable file to the user.",
866
+ aliases: [],
867
+ generation: { examples: [{ props: {
868
+ url: "https://example.com/report.pdf",
869
+ name: "Report.pdf"
870
+ } }] },
871
+ leaf: { props: _bpinternal_zui.z.object({
872
+ url: _bpinternal_zui.z.string().describe("The URL of the file (must be valid)"),
873
+ name: _bpinternal_zui.z.string().optional().describe("The display name of the file")
874
+ }) }
875
+ });
876
+ const Video = new require_component.Component({
877
+ type: "leaf",
878
+ name: "Video",
879
+ description: "Embeds a video from a URL.",
880
+ aliases: [],
881
+ generation: { examples: [{ props: {
882
+ url: "https://example.com/intro.mp4",
883
+ title: "Welcome"
884
+ } }] },
885
+ leaf: { props: _bpinternal_zui.z.object({
886
+ url: _bpinternal_zui.z.string().describe("The URL of the video (must be valid)"),
887
+ title: _bpinternal_zui.z.string().optional().describe("Title for the video")
888
+ }) }
889
+ });
890
+ const Audio = new require_component.Component({
891
+ type: "leaf",
892
+ name: "Audio",
893
+ description: "Plays an audio clip from a URL.",
894
+ aliases: [],
895
+ generation: { examples: [{ props: {
896
+ url: "https://example.com/audio.mp3",
897
+ title: "Sample"
898
+ } }] },
899
+ leaf: { props: _bpinternal_zui.z.object({
900
+ url: _bpinternal_zui.z.string().describe("The URL of the audio clip (must be valid)"),
901
+ title: _bpinternal_zui.z.string().optional().describe("Title for the audio clip")
902
+ }) }
903
+ });
904
+ const Card = new require_component.Component({
905
+ type: "container",
906
+ name: "Card",
907
+ description: "A card with a title, optional subtitle, and Markdown body.",
908
+ aliases: [],
909
+ generation: {
910
+ usage: "Present one item. The block body is Markdown, not nested component blocks or JSX.",
911
+ examples: [{
912
+ props: {
913
+ title: "Standard plan",
914
+ subtitle: "$20/month"
915
+ },
916
+ body: "Includes 5 projects and email support."
917
+ }]
918
+ },
919
+ container: {
920
+ props: _bpinternal_zui.z.object({
921
+ title: _bpinternal_zui.z.string().min(1).max(250).describe("Title text (1–250 characters)"),
922
+ subtitle: _bpinternal_zui.z.string().optional().describe("Optional subtitle for the card")
923
+ }),
924
+ children: [{
925
+ description: "Image (optional, max 1)",
926
+ component: Image.definition
927
+ }, {
928
+ description: "Button (optional, up to 5)",
929
+ component: Button.definition
930
+ }]
931
+ }
932
+ });
933
+ const carouselProps = _bpinternal_zui.z.object({ cards: _bpinternal_zui.z.array(Card.definition.container.props.extend({
934
+ body: _bpinternal_zui.z.string().optional().describe("Markdown text for this card"),
935
+ image: Image.definition.leaf.props.optional().describe("Optional image for this card; use a known URL"),
936
+ buttons: _bpinternal_zui.z.array(Button.definition.leaf.props).max(5).optional().describe("Up to 5 actions for this card")
937
+ })).min(1).max(10).describe("1–10 cards, in display order. Each card has its own title, optional subtitle, body, image, and buttons") });
938
+ var CarouselComponent = class extends require_component.Component {
939
+ render(props, children = []) {
940
+ if (!("cards" in props) && children.length && children.every((child) => require_component.isComponent(child, Card))) return super.render(props, children);
941
+ const { cards } = carouselProps.parse(props);
942
+ const renderedCards = cards.map(({ body, image, buttons, ...cardProps }) => Card.render(cardProps, [
943
+ ...body ? [body] : [],
944
+ ...image ? [Image.render(image)] : [],
945
+ ...(buttons ?? []).map((button) => Button.render(button))
946
+ ]));
947
+ return super.render({}, renderedCards);
948
+ }
949
+ };
950
+ const DefaultComponents = {
951
+ Button,
952
+ Image,
953
+ File,
954
+ Video,
955
+ Audio,
956
+ Card,
957
+ Carousel: new CarouselComponent({
958
+ type: "container",
959
+ name: "Carousel",
960
+ description: "Displays a horizontally scrollable collection of cards, each with its own content and actions.",
961
+ aliases: [],
962
+ body: false,
963
+ generation: {
964
+ usage: "Use for several comparable items. Put ALL cards in the cards array of ONE send block. Each card can include title, subtitle, body, image {url, alt?}, and buttons [{action, label, value?, url?}]. Do not write a Markdown list or separate Card blocks; those do not form a carousel.",
965
+ examples: [{ props: { cards: [{
966
+ title: "Standard plan",
967
+ subtitle: "$20/month",
968
+ body: "5 projects and email support.",
969
+ image: {
970
+ url: "https://example.com/standard.jpg",
971
+ alt: "Standard plan"
972
+ },
973
+ buttons: [{
974
+ action: "postback",
975
+ label: "Choose Standard",
976
+ value: "plan_standard"
977
+ }]
978
+ }, {
979
+ title: "Team plan",
980
+ subtitle: "$50/month",
981
+ body: "20 projects and priority support.",
982
+ image: {
983
+ url: "https://example.com/team.jpg",
984
+ alt: "Team plan"
985
+ },
986
+ buttons: [{
987
+ action: "postback",
988
+ label: "Choose Team",
989
+ value: "plan_team"
990
+ }]
991
+ }] } }]
992
+ },
993
+ container: {
994
+ props: carouselProps,
995
+ children: [{
996
+ description: "Card component (required, 1–10 allowed)",
997
+ component: Card.definition
998
+ }]
999
+ }
1000
+ }),
1001
+ Text: new require_component.Component({
1002
+ type: "default",
1003
+ name: "Message",
1004
+ aliases: ["Text", "Markdown"],
1005
+ description: "A Markdown-formatted text message. Long answers are written the same way: plain Markdown prose.",
1006
+ generation: { examples: [{ body: `To reset your password:
1007
+
1008
+ 1. Open the sign-in page and select **Forgot password?**
1009
+ 2. Enter the email address you use for your account.
1010
+ 3. Open the reset link in your email and choose a new password.
1011
+
1012
+ If the email does not arrive, check your spam folder. If you sign in through your organization, use its password reset process.` }, { body: "How do you currently manage board meetings?" }] },
1013
+ default: {
1014
+ props: _bpinternal_zui.z.object({}),
1015
+ children: []
1016
+ }
1017
+ }),
1018
+ Speech: new require_component.Component({
1019
+ type: "default",
1020
+ name: "Speech",
1021
+ aliases: ["speak", "spoken"],
1022
+ description: "A message spoken aloud to the user via text-to-speech.",
1023
+ body: {
1024
+ format: "text",
1025
+ description: "Plain conversational prose only, written to be read aloud: no Markdown, no links or URLs, no emojis, no code, no bullet points, tables or headings. Write everything the way it should be pronounced — spell out numbers, dates, units and abbreviations (e.g. \"June third at three thirty PM\", not \"06/03 @ 3:30pm\")."
1026
+ },
1027
+ generation: {
1028
+ usage: "Use when the reply will be played back as audio (voice conversations).",
1029
+ examples: [{ body: "Sure! Your order shipped this morning and should arrive on Tuesday, June third, around noon." }]
1030
+ },
1031
+ default: {
1032
+ props: _bpinternal_zui.z.object({}),
1033
+ children: []
1034
+ }
1035
+ })
1036
+ };
1037
+ //#endregion
795
1038
  //#region src/chat.ts
796
1039
  /**
797
1040
  * Base class for implementing chat interfaces in LLMz agents.
@@ -1450,7 +1693,7 @@ const utils = {
1450
1693
  * })
1451
1694
  */
1452
1695
  const execute = async (props) => {
1453
- const { executeContext } = await Promise.resolve().then(() => require("./execute-COIHOIKR.cjs"));
1696
+ const { executeContext } = await Promise.resolve().then(() => require("./execute-DM2-7y86.cjs"));
1454
1697
  return executeContext(props);
1455
1698
  };
1456
1699
  /**
@@ -1459,16 +1702,16 @@ const execute = async (props) => {
1459
1702
  * It's recommended to call this function at the beginning of your application without awaiting it (void init())
1460
1703
  */
1461
1704
  const init = async () => {
1462
- await Promise.resolve().then(() => require("./execute-COIHOIKR.cjs"));
1463
- await Promise.resolve().then(() => require("./component-BXS8vAwO.cjs")).then((n) => n.component_exports);
1705
+ await Promise.resolve().then(() => require("./execute-DM2-7y86.cjs"));
1706
+ await Promise.resolve().then(() => require("./component-C6Agl2ns.cjs")).then((n) => n.component_exports);
1464
1707
  await Promise.resolve().then(() => require("./tool-Dy6AJpJH.cjs")).then((n) => n.tool_exports);
1465
1708
  await Promise.resolve().then(() => require("./exit-DUM96DN1.cjs")).then((n) => n.exit_exports);
1466
- await Promise.resolve().then(() => require("./jsx-D5Y2cPo-.cjs")).then((n) => n.jsx_exports);
1709
+ await Promise.resolve().then(() => require("./jsx-owqxrquU.cjs")).then((n) => n.jsx_exports);
1467
1710
  await Promise.resolve().then(() => require("./vm-D6s1zF6M.cjs"));
1468
1711
  await Promise.resolve().then(() => require("./utils-3ESwP3yg.cjs")).then((n) => n.utils_exports);
1469
1712
  await Promise.resolve().then(() => require("./truncator-CLkouTCO.cjs")).then((n) => n.truncator_exports);
1470
1713
  await Promise.resolve().then(() => require("./typings-3lsqCbkn.cjs")).then((n) => n.typings_exports);
1471
- await Promise.resolve().then(() => require("./dual-modes-Cb7ThvoV.cjs")).then((n) => n.dual_modes_exports);
1714
+ await Promise.resolve().then(() => require("./dual-modes-DPXiuvNe.cjs")).then((n) => n.dual_modes_exports);
1472
1715
  };
1473
1716
  //#endregion
1474
1717
  exports.BaseResponse = BaseResponse;
@@ -1476,7 +1719,7 @@ exports.Chat = Chat;
1476
1719
  exports.CitationsManager = CitationsManager;
1477
1720
  exports.Component = require_component.Component;
1478
1721
  exports.ComponentRegistry = require_dual_modes.ComponentRegistry;
1479
- exports.DefaultComponents = require_dual_modes.DefaultComponents;
1722
+ exports.DefaultComponents = DefaultComponents;
1480
1723
  exports.DefaultExit = require_custom_client.DefaultExit;
1481
1724
  exports.ErrorExecutionResult = require_custom_client.ErrorExecutionResult;
1482
1725
  exports.Example = require_dual_modes.Example;
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
- import { a as StreamingMessageParser, c as NAME_REGEX, o as tryParseJson, s as MARKER } from "./common-pgJjFu2Y.js";
2
- import { a as Example, h as ComponentRegistry, m as validateProps, o as generateInstructions, p as validateComponent, s as DefaultComponents } from "./dual-modes-Cy0_W4O2.js";
3
- import { a as ThinkExit, c as ExecutionResult, d as Snapshot, f as parseExit, i as ListenExit, l as PartialExecutionResult, o as getValue, r as DefaultExit, s as ErrorExecutionResult, t as _CustomModelClient, u as SuccessExecutionResult } from "./custom-client-2V9lmzUf.js";
1
+ import { d as generateInstructions, f as validateComponent, m as ComponentRegistry, p as validateProps, u as Example } from "./dual-modes-DDkoCp3R.js";
2
+ import { c as MARKER, l as NAME_REGEX, o as StreamingMessageParser, s as tryParseJson } from "./common-BlRFtdf2.js";
3
+ import { a as ThinkExit, c as ExecutionResult, d as Snapshot, f as parseExit, i as ListenExit, l as PartialExecutionResult, o as getValue, r as DefaultExit, s as ErrorExecutionResult, t as _CustomModelClient, u as SuccessExecutionResult } from "./custom-client-ChuZ63zp.js";
4
4
  import { a as getMultilineComment, c as isJsonSchema, l as isValidIdentifier, m as toValidObjectName, n as escapeString, p as toValidFunctionName, t as configureTokenizer, u as isZuiSchema, v as upperFirst } from "./utils-UBeAFeEI.js";
5
- import { a as isComponent, i as isAnyComponent, n as assertValidComponent, t as Component } from "./component-Dq7ZLdvy.js";
6
5
  import { t as Tool } from "./tool-Bv8N4IPj.js";
7
6
  import { c as SnapshotSignal, l as ThinkSignal, o as LoopExceededError, r as CodeFormattingError } from "./errors-Cg1G0Awu.js";
8
7
  import { a as isPunct, i as isGroup, o as parse, r as formatTypings, s as tokenize, t as getTypings } from "./typings-CrBa7Tyy.js";
9
8
  import { t as Exit } from "./exit-CDdxDBRT.js";
9
+ import { a as isComponent, i as isAnyComponent, n as assertValidComponent, t as Component } from "./component-DGG7d_Mz.js";
10
10
  import { i as wrapContent, n as truncateWrappedContent, t as stripTruncationTags } from "./truncator-DZqEqnpD.js";
11
11
  import { t as configureQuickJS } from "./quickjs-variant-BYhMBpwU.js";
12
12
  import { transforms, z } from "@bpinternal/zui";
13
13
  //#region package.json
14
- var version = "0.8.0";
14
+ var version = "0.9.0";
15
15
  //#endregion
16
16
  //#region src/hoist.ts
17
17
  /**
@@ -791,6 +791,249 @@ var CitationsManager = class {
791
791
  }
792
792
  };
793
793
  //#endregion
794
+ //#region src/component.default.ts
795
+ const Button = new Component({
796
+ type: "leaf",
797
+ description: "A button component that can perform actions when clicked",
798
+ name: "Button",
799
+ aliases: ["btn"],
800
+ generation: {
801
+ usage: "Offer quick actions or choices after a message. It is common to send several buttons together: write one separate ■send=button block per choice in the SAME response. Each button has its own props and no body. Send all the choices before the final exit; do not wait for a user reply between buttons.",
802
+ examples: [
803
+ { props: {
804
+ action: "say",
805
+ label: "Track my order"
806
+ } },
807
+ { props: {
808
+ action: "url",
809
+ label: "View guide",
810
+ url: "https://example.com/guide"
811
+ } },
812
+ { props: {
813
+ action: "postback",
814
+ label: "Choose Standard",
815
+ value: "plan_standard"
816
+ } },
817
+ [
818
+ { props: {
819
+ action: "say",
820
+ label: "Track my order"
821
+ } },
822
+ { props: {
823
+ action: "say",
824
+ label: "Return an item"
825
+ } },
826
+ { props: {
827
+ action: "say",
828
+ label: "Contact support"
829
+ } }
830
+ ]
831
+ ]
832
+ },
833
+ leaf: { props: z.object({
834
+ action: z.enum([
835
+ "say",
836
+ "url",
837
+ "postback"
838
+ ]).default("say").describe("The action to perform when the button is clicked. Can be \"say\", \"url\", or \"postback\""),
839
+ label: z.string().describe("The text displayed on the button (min 1 character, max 250 characters)"),
840
+ value: z.string().optional().describe("The postback value to send when the button is clicked. Required if action is \"postback\""),
841
+ url: z.string().optional().describe("The URL to open when the button is clicked. Required if action is \"url\"")
842
+ }) }
843
+ });
844
+ const Image = new Component({
845
+ type: "leaf",
846
+ name: "Image",
847
+ description: "Displays an image from a URL.",
848
+ aliases: [],
849
+ generation: {
850
+ usage: "Use a known image URL from the user or tool results; never invent an image URL. No body.",
851
+ examples: [{ props: {
852
+ url: "https://example.com/trail.jpg",
853
+ alt: "Forest trail beside a lake"
854
+ } }]
855
+ },
856
+ leaf: { props: z.object({
857
+ url: z.string().describe("The URL of the image (must be valid)"),
858
+ alt: z.string().optional().describe("Alternative text describing the image")
859
+ }) }
860
+ });
861
+ const File = new Component({
862
+ type: "leaf",
863
+ name: "File",
864
+ description: "Sends a downloadable file to the user.",
865
+ aliases: [],
866
+ generation: { examples: [{ props: {
867
+ url: "https://example.com/report.pdf",
868
+ name: "Report.pdf"
869
+ } }] },
870
+ leaf: { props: z.object({
871
+ url: z.string().describe("The URL of the file (must be valid)"),
872
+ name: z.string().optional().describe("The display name of the file")
873
+ }) }
874
+ });
875
+ const Video = new Component({
876
+ type: "leaf",
877
+ name: "Video",
878
+ description: "Embeds a video from a URL.",
879
+ aliases: [],
880
+ generation: { examples: [{ props: {
881
+ url: "https://example.com/intro.mp4",
882
+ title: "Welcome"
883
+ } }] },
884
+ leaf: { props: z.object({
885
+ url: z.string().describe("The URL of the video (must be valid)"),
886
+ title: z.string().optional().describe("Title for the video")
887
+ }) }
888
+ });
889
+ const Audio = new Component({
890
+ type: "leaf",
891
+ name: "Audio",
892
+ description: "Plays an audio clip from a URL.",
893
+ aliases: [],
894
+ generation: { examples: [{ props: {
895
+ url: "https://example.com/audio.mp3",
896
+ title: "Sample"
897
+ } }] },
898
+ leaf: { props: z.object({
899
+ url: z.string().describe("The URL of the audio clip (must be valid)"),
900
+ title: z.string().optional().describe("Title for the audio clip")
901
+ }) }
902
+ });
903
+ const Card = new Component({
904
+ type: "container",
905
+ name: "Card",
906
+ description: "A card with a title, optional subtitle, and Markdown body.",
907
+ aliases: [],
908
+ generation: {
909
+ usage: "Present one item. The block body is Markdown, not nested component blocks or JSX.",
910
+ examples: [{
911
+ props: {
912
+ title: "Standard plan",
913
+ subtitle: "$20/month"
914
+ },
915
+ body: "Includes 5 projects and email support."
916
+ }]
917
+ },
918
+ container: {
919
+ props: z.object({
920
+ title: z.string().min(1).max(250).describe("Title text (1–250 characters)"),
921
+ subtitle: z.string().optional().describe("Optional subtitle for the card")
922
+ }),
923
+ children: [{
924
+ description: "Image (optional, max 1)",
925
+ component: Image.definition
926
+ }, {
927
+ description: "Button (optional, up to 5)",
928
+ component: Button.definition
929
+ }]
930
+ }
931
+ });
932
+ const carouselProps = z.object({ cards: z.array(Card.definition.container.props.extend({
933
+ body: z.string().optional().describe("Markdown text for this card"),
934
+ image: Image.definition.leaf.props.optional().describe("Optional image for this card; use a known URL"),
935
+ buttons: z.array(Button.definition.leaf.props).max(5).optional().describe("Up to 5 actions for this card")
936
+ })).min(1).max(10).describe("1–10 cards, in display order. Each card has its own title, optional subtitle, body, image, and buttons") });
937
+ var CarouselComponent = class extends Component {
938
+ render(props, children = []) {
939
+ if (!("cards" in props) && children.length && children.every((child) => isComponent(child, Card))) return super.render(props, children);
940
+ const { cards } = carouselProps.parse(props);
941
+ const renderedCards = cards.map(({ body, image, buttons, ...cardProps }) => Card.render(cardProps, [
942
+ ...body ? [body] : [],
943
+ ...image ? [Image.render(image)] : [],
944
+ ...(buttons ?? []).map((button) => Button.render(button))
945
+ ]));
946
+ return super.render({}, renderedCards);
947
+ }
948
+ };
949
+ const DefaultComponents = {
950
+ Button,
951
+ Image,
952
+ File,
953
+ Video,
954
+ Audio,
955
+ Card,
956
+ Carousel: new CarouselComponent({
957
+ type: "container",
958
+ name: "Carousel",
959
+ description: "Displays a horizontally scrollable collection of cards, each with its own content and actions.",
960
+ aliases: [],
961
+ body: false,
962
+ generation: {
963
+ usage: "Use for several comparable items. Put ALL cards in the cards array of ONE send block. Each card can include title, subtitle, body, image {url, alt?}, and buttons [{action, label, value?, url?}]. Do not write a Markdown list or separate Card blocks; those do not form a carousel.",
964
+ examples: [{ props: { cards: [{
965
+ title: "Standard plan",
966
+ subtitle: "$20/month",
967
+ body: "5 projects and email support.",
968
+ image: {
969
+ url: "https://example.com/standard.jpg",
970
+ alt: "Standard plan"
971
+ },
972
+ buttons: [{
973
+ action: "postback",
974
+ label: "Choose Standard",
975
+ value: "plan_standard"
976
+ }]
977
+ }, {
978
+ title: "Team plan",
979
+ subtitle: "$50/month",
980
+ body: "20 projects and priority support.",
981
+ image: {
982
+ url: "https://example.com/team.jpg",
983
+ alt: "Team plan"
984
+ },
985
+ buttons: [{
986
+ action: "postback",
987
+ label: "Choose Team",
988
+ value: "plan_team"
989
+ }]
990
+ }] } }]
991
+ },
992
+ container: {
993
+ props: carouselProps,
994
+ children: [{
995
+ description: "Card component (required, 1–10 allowed)",
996
+ component: Card.definition
997
+ }]
998
+ }
999
+ }),
1000
+ Text: new Component({
1001
+ type: "default",
1002
+ name: "Message",
1003
+ aliases: ["Text", "Markdown"],
1004
+ description: "A Markdown-formatted text message. Long answers are written the same way: plain Markdown prose.",
1005
+ generation: { examples: [{ body: `To reset your password:
1006
+
1007
+ 1. Open the sign-in page and select **Forgot password?**
1008
+ 2. Enter the email address you use for your account.
1009
+ 3. Open the reset link in your email and choose a new password.
1010
+
1011
+ If the email does not arrive, check your spam folder. If you sign in through your organization, use its password reset process.` }, { body: "How do you currently manage board meetings?" }] },
1012
+ default: {
1013
+ props: z.object({}),
1014
+ children: []
1015
+ }
1016
+ }),
1017
+ Speech: new Component({
1018
+ type: "default",
1019
+ name: "Speech",
1020
+ aliases: ["speak", "spoken"],
1021
+ description: "A message spoken aloud to the user via text-to-speech.",
1022
+ body: {
1023
+ format: "text",
1024
+ description: "Plain conversational prose only, written to be read aloud: no Markdown, no links or URLs, no emojis, no code, no bullet points, tables or headings. Write everything the way it should be pronounced — spell out numbers, dates, units and abbreviations (e.g. \"June third at three thirty PM\", not \"06/03 @ 3:30pm\")."
1025
+ },
1026
+ generation: {
1027
+ usage: "Use when the reply will be played back as audio (voice conversations).",
1028
+ examples: [{ body: "Sure! Your order shipped this morning and should arrive on Tuesday, June third, around noon." }]
1029
+ },
1030
+ default: {
1031
+ props: z.object({}),
1032
+ children: []
1033
+ }
1034
+ })
1035
+ };
1036
+ //#endregion
794
1037
  //#region src/chat.ts
795
1038
  /**
796
1039
  * Base class for implementing chat interfaces in LLMz agents.
@@ -1449,7 +1692,7 @@ const utils = {
1449
1692
  * })
1450
1693
  */
1451
1694
  const execute = async (props) => {
1452
- const { executeContext } = await import("./execute-Aw4cbIx-.js");
1695
+ const { executeContext } = await import("./execute-BWcdv9so.js");
1453
1696
  return executeContext(props);
1454
1697
  };
1455
1698
  /**
@@ -1458,16 +1701,16 @@ const execute = async (props) => {
1458
1701
  * It's recommended to call this function at the beginning of your application without awaiting it (void init())
1459
1702
  */
1460
1703
  const init = async () => {
1461
- await import("./execute-Aw4cbIx-.js");
1462
- await import("./component-Dq7ZLdvy.js").then((n) => n.r);
1704
+ await import("./execute-BWcdv9so.js");
1705
+ await import("./component-DGG7d_Mz.js").then((n) => n.r);
1463
1706
  await import("./tool-Bv8N4IPj.js").then((n) => n.n);
1464
1707
  await import("./exit-CDdxDBRT.js").then((n) => n.n);
1465
- await import("./jsx-B0iYyvfr.js").then((n) => n.i);
1708
+ await import("./jsx-CIgdGGVs.js").then((n) => n.i);
1466
1709
  await import("./vm-BLsHw1da.js");
1467
1710
  await import("./utils-UBeAFeEI.js").then((n) => n.h);
1468
1711
  await import("./truncator-DZqEqnpD.js").then((n) => n.r);
1469
1712
  await import("./typings-CrBa7Tyy.js").then((n) => n.n);
1470
- await import("./dual-modes-Cy0_W4O2.js").then((n) => n.n);
1713
+ await import("./dual-modes-DDkoCp3R.js").then((n) => n.n);
1471
1714
  };
1472
1715
  //#endregion
1473
1716
  export { BaseResponse, Chat, CitationsManager, Component, ComponentRegistry, DefaultComponents, DefaultExit, ErrorExecutionResult, Example, ExecutionResult, Exit, ListenExit, LoopExceededError, MARKER, NAME_REGEX, NextResponse, ObjectInstance, PartialExecutionResult, ReplayableAsyncIterable, RunResponse, SendResponse, Snapshot, SnapshotSignal, StreamingMessageParser, SuccessExecutionResult, ThinkExit, ThinkSignal, Tool, _CustomModelClient, assertValidComponent, collectText, configureQuickJS, configureTokenizer, execute, generateInstructions, getValue, init, isAnyComponent, isComponent, normalizeComponentDefinition, normalizeComponentName, normalizePropsSchema, parseExit, parseStream, parseText, sanitizeMessageText, tryParseJson, utils, validateComponent, validateProps, version };