llmz 0.0.2

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 (96) hide show
  1. package/README.md +41 -0
  2. package/dist/chunk-3CGLDS5T.cjs +3059 -0
  3. package/dist/chunk-3T465BEW.js +96 -0
  4. package/dist/chunk-6QDFMQHA.js +98 -0
  5. package/dist/chunk-7FIPXMZR.js +33 -0
  6. package/dist/chunk-7S3UY52U.js +3059 -0
  7. package/dist/chunk-A7BDFLAE.cjs +30 -0
  8. package/dist/chunk-BKGPO722.cjs +3079 -0
  9. package/dist/chunk-BOLDQGES.cjs +33 -0
  10. package/dist/chunk-C2TSWGYC.cjs +91 -0
  11. package/dist/chunk-DFZ6GX5C.js +220 -0
  12. package/dist/chunk-DILHJIMP.js +180 -0
  13. package/dist/chunk-E2B5DRIC.cjs +419 -0
  14. package/dist/chunk-E5W3P7EO.cjs +96 -0
  15. package/dist/chunk-ENFB45AI.cjs +220 -0
  16. package/dist/chunk-MSTBEKOQ.js +28 -0
  17. package/dist/chunk-PQN6HW7A.cjs +28 -0
  18. package/dist/chunk-Q4DEJGXD.js +344 -0
  19. package/dist/chunk-QPSUMPLP.js +419 -0
  20. package/dist/chunk-QZGFCB4T.cjs +344 -0
  21. package/dist/chunk-R2N2UUKC.cjs +98 -0
  22. package/dist/chunk-RB2L33ZR.js +3079 -0
  23. package/dist/chunk-RJHDQL4C.js +161 -0
  24. package/dist/chunk-UG2GCPHF.js +91 -0
  25. package/dist/chunk-UVSOAH2H.js +152 -0
  26. package/dist/chunk-VP6WWAE2.cjs +152 -0
  27. package/dist/chunk-YPOOKE3A.cjs +180 -0
  28. package/dist/chunk-YSQDPG26.js +30 -0
  29. package/dist/chunk-YUDUY7XW.cjs +284 -0
  30. package/dist/chunk-ZSRC3TN4.js +284 -0
  31. package/dist/chunk-ZUAFUOUR.cjs +161 -0
  32. package/dist/compiler/compiler.d.ts +28 -0
  33. package/dist/compiler/index.d.ts +2 -0
  34. package/dist/compiler/plugins/async-iterator.d.ts +4 -0
  35. package/dist/compiler/plugins/braces-tsx.d.ts +3 -0
  36. package/dist/compiler/plugins/jsx-preserve-newlines.d.ts +5 -0
  37. package/dist/compiler/plugins/line-tracking.d.ts +5 -0
  38. package/dist/compiler/plugins/replace-comment.d.ts +5 -0
  39. package/dist/compiler/plugins/return-async.d.ts +4 -0
  40. package/dist/compiler/plugins/track-tool-calls.d.ts +16 -0
  41. package/dist/compiler/plugins/variable-extraction.d.ts +5 -0
  42. package/dist/component-DWBRHLEN.cjs +9 -0
  43. package/dist/component-R3ZAVXUC.js +9 -0
  44. package/dist/component.d.ts +51 -0
  45. package/dist/component.default.d.ts +10 -0
  46. package/dist/context.d.ts +167 -0
  47. package/dist/dual-modes-2VDEOJ5D.js +13 -0
  48. package/dist/dual-modes-3MH5N6RY.cjs +13 -0
  49. package/dist/errors.d.ts +64 -0
  50. package/dist/exit-GYMXZZ4I.js +9 -0
  51. package/dist/exit-PQHMJEOG.cjs +9 -0
  52. package/dist/exit.d.ts +20 -0
  53. package/dist/formatting.d.ts +5 -0
  54. package/dist/getter.d.ts +2 -0
  55. package/dist/handlers.d.ts +10 -0
  56. package/dist/hoist.d.ts +2 -0
  57. package/dist/index.cjs +811 -0
  58. package/dist/index.d.ts +18 -0
  59. package/dist/index.js +811 -0
  60. package/dist/inspect.d.ts +6 -0
  61. package/dist/jsx-CJ2RBODH.js +14 -0
  62. package/dist/jsx-PPLE5YTB.cjs +14 -0
  63. package/dist/jsx.d.ts +11 -0
  64. package/dist/llmz-EGTGPSTX.cjs +1049 -0
  65. package/dist/llmz-WY74UVE3.js +1049 -0
  66. package/dist/llmz.d.ts +41 -0
  67. package/dist/objects.d.ts +24 -0
  68. package/dist/openai.d.ts +8 -0
  69. package/dist/prompts/chat-mode/system.md.d.ts +2 -0
  70. package/dist/prompts/chat-mode/user.md.d.ts +2 -0
  71. package/dist/prompts/common.d.ts +6 -0
  72. package/dist/prompts/dual-modes.d.ts +2 -0
  73. package/dist/prompts/prompt.d.ts +50 -0
  74. package/dist/prompts/worker-mode/system.md.d.ts +2 -0
  75. package/dist/prompts/worker-mode/user.md.d.ts +2 -0
  76. package/dist/snapshots.d.ts +61 -0
  77. package/dist/stack-traces.d.ts +1 -0
  78. package/dist/tool-AY47ML65.cjs +12 -0
  79. package/dist/tool-WVIPESKN.js +12 -0
  80. package/dist/tool.d.ts +30 -0
  81. package/dist/transcript.d.ts +9 -0
  82. package/dist/truncator-MTONQESU.js +11 -0
  83. package/dist/truncator-ZKPOW2I3.cjs +11 -0
  84. package/dist/truncator.d.ts +21 -0
  85. package/dist/types.d.ts +131 -0
  86. package/dist/typings-HTYLRNIC.js +11 -0
  87. package/dist/typings-QRJGGNUM.cjs +11 -0
  88. package/dist/typings.d.ts +5 -0
  89. package/dist/utils-TS23YJPE.js +38 -0
  90. package/dist/utils-UR4IMUHC.cjs +38 -0
  91. package/dist/utils.d.ts +21 -0
  92. package/dist/vm-4JFSZAMR.cjs +13 -0
  93. package/dist/vm-SMMA664M.js +13 -0
  94. package/dist/vm.d.ts +3 -0
  95. package/package.json +85 -0
  96. package/patches/source-map-js@1.2.1.patch +16 -0
@@ -0,0 +1,96 @@
1
+ // src/component.ts
2
+ function assertValidComponent(component) {
3
+ if (!component.name) {
4
+ throw new Error("Component must have a name");
5
+ }
6
+ const nameRegex = /^[A-Z]{3,50}$/i;
7
+ if (!nameRegex.test(component.name)) {
8
+ throw new Error(
9
+ `Component name "${component.name}" must be 3-50 characters long and start with an uppercase letter`
10
+ );
11
+ }
12
+ if (component.aliases) {
13
+ for (const alias of component.aliases) {
14
+ if (!nameRegex.test(alias)) {
15
+ throw new Error(`Alias "${alias}" must be 3-50 characters long and start with an uppercase letter`);
16
+ }
17
+ }
18
+ }
19
+ if (!component.description) {
20
+ throw new Error("Component must have a description");
21
+ }
22
+ if (!component.examples || component.examples.length === 0) {
23
+ throw new Error("Component must have at least one example");
24
+ }
25
+ if (component.type === "default" && !component.default) {
26
+ throw new Error("Default component must have default props and children");
27
+ }
28
+ if (component.type === "leaf" && !component.leaf) {
29
+ throw new Error("Leaf component must have leaf props");
30
+ }
31
+ if (component.type === "container" && !component.container) {
32
+ throw new Error("Container component must have container props and children");
33
+ }
34
+ }
35
+ function getComponentReference(component) {
36
+ let doc = `### <${component.name}>
37
+
38
+ `;
39
+ doc += `${component.description}
40
+
41
+ `;
42
+ const getPropsDoc = (props) => {
43
+ if (props.length === 0)
44
+ return "_No props._\n\n";
45
+ return props.map((prop) => {
46
+ const required = prop.required ? "**(required)**" : "(optional)";
47
+ const def = prop.default !== void 0 ? ` _Default: \`${prop.default}\`_` : "";
48
+ return `- \`${prop.name}: ${prop.type}\` ${required} \u2014 ${prop.description || ""}${def}`;
49
+ }).join("\n") + "\n\n";
50
+ };
51
+ const getChildrenDoc = (children) => {
52
+ if (children.length === 0)
53
+ return "_None allowed._\n\n";
54
+ return "Can contain:\n" + children.map((child) => `- ${child.description} \u2014 \`<${child.component.name}>\``).join("\n") + "\n\n";
55
+ };
56
+ const getExamplesDoc = (examples) => {
57
+ if (!examples.length)
58
+ return "";
59
+ return "**Examples:**\n\n" + examples.map((example) => `**${example.name}** \u2014 ${example.description}
60
+
61
+ \`\`\`tsx
62
+ ${example.code.trim()}
63
+ \`\`\`
64
+ `).join("\n");
65
+ };
66
+ switch (component.type) {
67
+ case "leaf":
68
+ doc += "**Props:**\n\n";
69
+ doc += getPropsDoc(component.leaf.props);
70
+ doc += "**Children:**\n\n";
71
+ doc += getChildrenDoc([]);
72
+ doc += getExamplesDoc(component.examples);
73
+ break;
74
+ case "container":
75
+ doc += "**Props:**\n\n";
76
+ doc += getPropsDoc(component.container.props);
77
+ doc += "**Children:**\n\n";
78
+ doc += getChildrenDoc(component.container.children);
79
+ doc += getExamplesDoc(component.examples);
80
+ break;
81
+ case "default":
82
+ default:
83
+ doc += "**Props:**\n\n";
84
+ doc += getPropsDoc(component.default.props);
85
+ doc += "**Children:**\n\n";
86
+ doc += getChildrenDoc(component.default.children);
87
+ doc += getExamplesDoc(component.examples);
88
+ break;
89
+ }
90
+ return doc.trim();
91
+ }
92
+
93
+ export {
94
+ assertValidComponent,
95
+ getComponentReference
96
+ };
@@ -0,0 +1,98 @@
1
+ import {
2
+ isJsonSchema,
3
+ isValidIdentifier
4
+ } from "./chunk-DFZ6GX5C.js";
5
+ import {
6
+ uniq_default
7
+ } from "./chunk-7S3UY52U.js";
8
+
9
+ // src/exit.ts
10
+ import { z } from "@bpinternal/zui";
11
+ var Exit = class _Exit {
12
+ name;
13
+ aliases = [];
14
+ description;
15
+ metadata;
16
+ schema;
17
+ get zSchema() {
18
+ return this.schema ? z.fromJsonSchema(this.schema) : void 0;
19
+ }
20
+ rename(name) {
21
+ const before = this.name;
22
+ if (!isValidIdentifier(name)) {
23
+ throw new Error(
24
+ `Invalid name for exit ${name}. An exit name must start with a letter and contain only letters, numbers, and underscores. It must be 1-50 characters long.`
25
+ );
26
+ }
27
+ this.name = name;
28
+ this.aliases = uniq_default([name, ...this.aliases.map((alias) => alias === before ? name : alias)]);
29
+ return this;
30
+ }
31
+ clone() {
32
+ return new _Exit({
33
+ name: this.name,
34
+ aliases: [...this.aliases],
35
+ description: this.description,
36
+ metadata: JSON.parse(JSON.stringify(this.metadata)),
37
+ schema: this.zSchema
38
+ });
39
+ }
40
+ constructor(props) {
41
+ if (!isValidIdentifier(props.name)) {
42
+ throw new Error(
43
+ `Invalid name for exit ${props.name}. A exit name must start with a letter and contain only letters, numbers, and underscores. It must be 1-50 characters long.`
44
+ );
45
+ }
46
+ if (typeof props.description !== "string" || props.description.trim().length === 0) {
47
+ throw new Error(
48
+ `Invalid description for exit ${props.name}. Expected a non-empty string, but got type "${typeof props.description}"`
49
+ );
50
+ }
51
+ if (props.metadata !== void 0 && typeof props.metadata !== "object") {
52
+ throw new Error(
53
+ `Invalid metadata for exit ${props.name}. Expected an object, but got type "${typeof props.metadata}"`
54
+ );
55
+ }
56
+ if (props.aliases !== void 0 && !Array.isArray(props.aliases)) {
57
+ throw new Error(
58
+ `Invalid aliases for exit ${props.name}. Expected an array, but got type "${typeof props.aliases}"`
59
+ );
60
+ }
61
+ if (props.aliases && props.aliases.some((alias) => !isValidIdentifier(alias))) {
62
+ throw new Error(`Invalid aliases for exit ${props.name}. Expected an array of valid identifiers.`);
63
+ }
64
+ if (typeof props.schema !== "undefined") {
65
+ if (props.schema && "toJsonSchema" in props.schema && typeof props.schema.toJsonSchema === "function") {
66
+ this.schema = props.schema.toJsonSchema();
67
+ } else if (isJsonSchema(props.schema)) {
68
+ this.schema = props.schema;
69
+ } else {
70
+ throw new Error(
71
+ `Invalid input schema for exit ${props.name}. Expected a ZodType or JSONSchema, but got type "${typeof props.schema}"`
72
+ );
73
+ }
74
+ }
75
+ this.name = props.name;
76
+ this.aliases = uniq_default([props.name, ...props.aliases ?? []]);
77
+ this.description = props.description;
78
+ this.metadata = props.metadata ?? {};
79
+ }
80
+ static withUniqueNames = (exits) => {
81
+ const names = /* @__PURE__ */ new Set();
82
+ return exits.map((exit) => {
83
+ if (exits.filter((t) => t.name === exit.name).length === 1) {
84
+ return exit;
85
+ }
86
+ let counter = 1;
87
+ let exitName = exit.name + counter;
88
+ while (names.has(exitName)) {
89
+ exitName = `${exit.name}${++counter}`;
90
+ }
91
+ return exit.rename(exitName);
92
+ });
93
+ };
94
+ };
95
+
96
+ export {
97
+ Exit
98
+ };
@@ -0,0 +1,33 @@
1
+ import {
2
+ isPlainObject_default,
3
+ isString_default
4
+ } from "./chunk-7S3UY52U.js";
5
+
6
+ // src/jsx.ts
7
+ import { z } from "@bpinternal/zui";
8
+ function isAnyJsxComponent(component) {
9
+ return typeof component === "object" && component !== null && "__jsx" in component && component.__jsx === true && typeof component.type === "string";
10
+ }
11
+ function isJsxComponent(type, component) {
12
+ return typeof component === "object" && component !== null && "__jsx" in component && component.__jsx === true && typeof component.type === "string" && typeof type === "string" && component.type.toUpperCase().trim() === type.toUpperCase().trim();
13
+ }
14
+ var createJsxComponent = (props) => ({
15
+ __jsx: true,
16
+ type: isString_default(props.type) ? props.type.toUpperCase() : "__unknown__",
17
+ children: Array.isArray(props.children) ? props.children : props.children ? [props.children] : [],
18
+ props: isPlainObject_default(props.props) ? props.props : {}
19
+ });
20
+ var Jsx = z.custom(
21
+ (value) => isAnyJsxComponent(value),
22
+ (value) => ({
23
+ params: { value },
24
+ message: `Invalid JSX component: ${value}`
25
+ })
26
+ );
27
+
28
+ export {
29
+ isAnyJsxComponent,
30
+ isJsxComponent,
31
+ createJsxComponent,
32
+ Jsx
33
+ };