llmz 0.0.8 → 0.0.10

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 (92) hide show
  1. package/package.json +3 -3
  2. package/dist/chat.d.ts +0 -17
  3. package/dist/chunk-276Q6EWP.cjs +0 -224
  4. package/dist/chunk-4L6D2A6O.cjs +0 -283
  5. package/dist/chunk-4MNIJGK6.js +0 -224
  6. package/dist/chunk-7WRN4E42.js +0 -3087
  7. package/dist/chunk-BEPRLBPK.cjs +0 -3123
  8. package/dist/chunk-C6WNNTEV.cjs +0 -212
  9. package/dist/chunk-D3ESDRLH.js +0 -3123
  10. package/dist/chunk-GGWM6X2K.js +0 -184
  11. package/dist/chunk-GWFYZDUR.cjs +0 -105
  12. package/dist/chunk-HJKOSEH2.cjs +0 -722
  13. package/dist/chunk-IH2WQFO5.js +0 -283
  14. package/dist/chunk-IKSIOIIP.cjs +0 -28
  15. package/dist/chunk-JAGB2AOU.js +0 -212
  16. package/dist/chunk-JDABP4SD.cjs +0 -161
  17. package/dist/chunk-JGVAZO4X.cjs +0 -152
  18. package/dist/chunk-JKVVQN2P.js +0 -161
  19. package/dist/chunk-JMSZKB4T.js +0 -105
  20. package/dist/chunk-JQBT7UWN.js +0 -28
  21. package/dist/chunk-KH6JQYQA.js +0 -796
  22. package/dist/chunk-KMZDFWYZ.cjs +0 -33
  23. package/dist/chunk-ORQP26SZ.js +0 -33
  24. package/dist/chunk-PRVFVXT4.js +0 -722
  25. package/dist/chunk-SHJDRZF5.cjs +0 -796
  26. package/dist/chunk-SNDVQU5A.js +0 -152
  27. package/dist/chunk-UQOBUJIQ.cjs +0 -3087
  28. package/dist/chunk-ZRCU35UV.cjs +0 -184
  29. package/dist/citations.d.ts +0 -63
  30. package/dist/compiler/compiler.d.ts +0 -28
  31. package/dist/compiler/index.d.ts +0 -2
  32. package/dist/compiler/plugins/async-iterator.d.ts +0 -4
  33. package/dist/compiler/plugins/braces-tsx.d.ts +0 -3
  34. package/dist/compiler/plugins/jsx-preserve-newlines.d.ts +0 -5
  35. package/dist/compiler/plugins/line-tracking.d.ts +0 -5
  36. package/dist/compiler/plugins/replace-comment.d.ts +0 -5
  37. package/dist/compiler/plugins/return-async.d.ts +0 -4
  38. package/dist/compiler/plugins/track-tool-calls.d.ts +0 -16
  39. package/dist/compiler/plugins/variable-extraction.d.ts +0 -5
  40. package/dist/component-R4WTW6DZ.cjs +0 -18
  41. package/dist/component-WFVDVSDK.js +0 -18
  42. package/dist/component.d.ts +0 -66
  43. package/dist/component.default.d.ts +0 -316
  44. package/dist/context.d.ts +0 -176
  45. package/dist/dual-modes-T53P72CH.js +0 -12
  46. package/dist/dual-modes-VLIGPIHX.cjs +0 -12
  47. package/dist/errors.d.ts +0 -64
  48. package/dist/exit-TRXEU4OU.cjs +0 -8
  49. package/dist/exit-YORW76T3.js +0 -8
  50. package/dist/exit.d.ts +0 -26
  51. package/dist/formatting.d.ts +0 -5
  52. package/dist/getter.d.ts +0 -2
  53. package/dist/handlers.d.ts +0 -10
  54. package/dist/hoist.d.ts +0 -2
  55. package/dist/index.cjs +0 -921
  56. package/dist/index.d.ts +0 -23
  57. package/dist/index.js +0 -921
  58. package/dist/inspect.d.ts +0 -6
  59. package/dist/jsx-AEHVFB3L.js +0 -13
  60. package/dist/jsx-AJAXBWFE.cjs +0 -13
  61. package/dist/jsx.d.ts +0 -11
  62. package/dist/llmz-QLZBDG2Z.cjs +0 -576
  63. package/dist/llmz-ROOX7RYI.js +0 -576
  64. package/dist/llmz.d.ts +0 -40
  65. package/dist/objects.d.ts +0 -24
  66. package/dist/prompts/chat-mode/system.md.d.ts +0 -2
  67. package/dist/prompts/chat-mode/user.md.d.ts +0 -2
  68. package/dist/prompts/common.d.ts +0 -6
  69. package/dist/prompts/dual-modes.d.ts +0 -2
  70. package/dist/prompts/prompt.d.ts +0 -55
  71. package/dist/prompts/worker-mode/system.md.d.ts +0 -2
  72. package/dist/prompts/worker-mode/user.md.d.ts +0 -2
  73. package/dist/result.d.ts +0 -33
  74. package/dist/snapshots.d.ts +0 -69
  75. package/dist/stack-traces.d.ts +0 -1
  76. package/dist/tool-N6ODRRGH.js +0 -11
  77. package/dist/tool-QP4MVRWI.cjs +0 -11
  78. package/dist/tool.d.ts +0 -56
  79. package/dist/transcript.d.ts +0 -36
  80. package/dist/truncator-DUMWEGQO.cjs +0 -10
  81. package/dist/truncator-IY2MXOMC.js +0 -10
  82. package/dist/truncator.d.ts +0 -20
  83. package/dist/types.d.ts +0 -105
  84. package/dist/typings-2CPHOFDN.cjs +0 -10
  85. package/dist/typings-GDMY6VY2.js +0 -10
  86. package/dist/typings.d.ts +0 -5
  87. package/dist/utils-A7WNEFTA.cjs +0 -39
  88. package/dist/utils-N24IHDFA.js +0 -39
  89. package/dist/utils.d.ts +0 -23
  90. package/dist/vm-2DLG7V4G.cjs +0 -12
  91. package/dist/vm-FLBMZUA2.js +0 -12
  92. package/dist/vm.d.ts +0 -3
@@ -1,184 +0,0 @@
1
- import {
2
- isAnyJsxComponent,
3
- isJsxComponent
4
- } from "./chunk-ORQP26SZ.js";
5
-
6
- // src/component.ts
7
- import { z } from "@bpinternal/zui";
8
- function assertValidComponent(component) {
9
- if (!component.name) {
10
- throw new Error("Component must have a name");
11
- }
12
- const nameRegex = /^[A-Z]{3,50}$/i;
13
- if (!nameRegex.test(component.name)) {
14
- throw new Error(
15
- `Component name "${component.name}" must be 3-50 characters long and start with an uppercase letter`
16
- );
17
- }
18
- if (component.aliases) {
19
- for (const alias of component.aliases) {
20
- if (!nameRegex.test(alias)) {
21
- throw new Error(`Alias "${alias}" must be 3-50 characters long and start with an uppercase letter`);
22
- }
23
- }
24
- }
25
- if (!component.description) {
26
- throw new Error("Component must have a description");
27
- }
28
- if (!component.examples || component.examples.length === 0) {
29
- throw new Error("Component must have at least one example");
30
- }
31
- if (component.type === "default" && !component.default) {
32
- throw new Error("Default component must have default props and children");
33
- }
34
- if (component.type === "leaf" && !component.leaf) {
35
- throw new Error("Leaf component must have leaf props");
36
- }
37
- if (component.type === "container" && !component.container) {
38
- throw new Error("Container component must have container props and children");
39
- }
40
- }
41
- var getDefaultValue = (schema) => {
42
- if (schema._def.defaultValue !== void 0) {
43
- if (typeof schema._def.defaultValue === "function") {
44
- return String(schema._def.defaultValue()).toString();
45
- } else {
46
- return String(schema._def.defaultValue);
47
- }
48
- }
49
- return "";
50
- };
51
- function getComponentReference(component) {
52
- let doc = `### <${component.name}>
53
-
54
- `;
55
- doc += `${component.description}
56
-
57
- `;
58
- const getPropsDoc = (props) => {
59
- const shape = props.shape;
60
- if (Object.keys(shape).length === 0)
61
- return "_No props._\n\n";
62
- const zodTypeToTsType = {
63
- ZodString: "string",
64
- ZodNumber: "number",
65
- ZodBoolean: "boolean",
66
- ZodEnum: "enum",
67
- ZodArray: "array",
68
- ZodObject: "object",
69
- ZodDate: "date",
70
- ZodBigInt: "bigint",
71
- ZodSymbol: "symbol",
72
- ZodUndefined: "undefined",
73
- ZodNull: "null",
74
- ZodVoid: "void",
75
- ZodNever: "never",
76
- ZodUnknown: "unknown",
77
- ZodAny: "any"
78
- };
79
- return Object.entries(shape).map(([name, schema]) => {
80
- const naked = schema.naked();
81
- const zodType = naked._def.typeName;
82
- const defValue = getDefaultValue(schema);
83
- const typings = naked instanceof z.ZodEnum ? naked._def.values.map((x) => `"${x}"`).join(" | ") : zodTypeToTsType[zodType] || zodType;
84
- const required = !schema.isOptional() ? "**(required)**" : "(optional)";
85
- const def = defValue ? ` _Default: \`${defValue}\`_` : "";
86
- const description = schema.description || schema.naked().description || (schema == null ? void 0 : schema._def.description) || "";
87
- return `- \`${name}: ${typings}\` ${required} \u2014 ${description}${def}`;
88
- }).join("\n") + "\n\n";
89
- };
90
- const getChildrenDoc = (children) => {
91
- if (children.length === 0)
92
- return "_None allowed._\n\n";
93
- return "Can contain:\n" + children.map((child) => `- ${child.description} \u2014 \`<${child.component.name}>\``).join("\n") + "\n\n";
94
- };
95
- const getExamplesDoc = (examples) => {
96
- if (!examples.length)
97
- return "";
98
- return "**Examples:**\n\n" + examples.map((example) => `**${example.name}** \u2014 ${example.description}
99
-
100
- \`\`\`tsx
101
- ${example.code.trim()}
102
- \`\`\`
103
- `).join("\n");
104
- };
105
- switch (component.type) {
106
- case "leaf":
107
- doc += "**Props:**\n\n";
108
- doc += getPropsDoc(component.leaf.props);
109
- doc += "**Children:**\n\n";
110
- doc += getChildrenDoc([]);
111
- doc += getExamplesDoc(component.examples);
112
- break;
113
- case "container":
114
- doc += "**Props:**\n\n";
115
- doc += getPropsDoc(component.container.props);
116
- doc += "**Children:**\n\n";
117
- doc += getChildrenDoc(component.container.children);
118
- doc += getExamplesDoc(component.examples);
119
- break;
120
- case "default":
121
- default:
122
- doc += "**Props:**\n\n";
123
- doc += getPropsDoc(component.default.props);
124
- doc += "**Children:**\n\n";
125
- doc += getChildrenDoc(component.default.children);
126
- doc += getExamplesDoc(component.examples);
127
- break;
128
- }
129
- return doc.trim();
130
- }
131
- var Component = class {
132
- definition;
133
- propsType;
134
- // phantom type for inference
135
- constructor(definition) {
136
- assertValidComponent(definition);
137
- this.definition = definition;
138
- }
139
- };
140
- function isComponent(rendered, component) {
141
- return isJsxComponent(component.definition.name, rendered);
142
- }
143
- function isAnyComponent(message) {
144
- return isAnyJsxComponent(message);
145
- }
146
- function renderToTsx(component) {
147
- const props = Object.entries(component.props).map(([key, value]) => {
148
- if (typeof value === "string") {
149
- return `${key}="${value}"`;
150
- }
151
- if (typeof value === "boolean") {
152
- return value ? key : "";
153
- }
154
- if (typeof value === "number") {
155
- return `${key}={${value}}`;
156
- }
157
- if (value === null || value === void 0) {
158
- return "";
159
- }
160
- if (typeof value === "object") {
161
- return `${key}={${JSON.stringify(value)}}`;
162
- }
163
- return `${key}={${String(value)}}`;
164
- }).filter(Boolean).join(" ");
165
- const children = component.children.map((child) => {
166
- if (typeof child === "string") {
167
- return child;
168
- }
169
- if (isAnyComponent(child)) {
170
- return renderToTsx(child);
171
- }
172
- return String(child);
173
- }).join("");
174
- return `<${component.type}${props ? " " + props : ""}>${children}</${component.type}>`;
175
- }
176
-
177
- export {
178
- assertValidComponent,
179
- getComponentReference,
180
- Component,
181
- isComponent,
182
- isAnyComponent,
183
- renderToTsx
184
- };
@@ -1,105 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
2
-
3
-
4
-
5
- var _chunk276Q6EWPcjs = require('./chunk-276Q6EWP.cjs');
6
-
7
-
8
- var _chunkUQOBUJIQcjs = require('./chunk-UQOBUJIQ.cjs');
9
-
10
- // src/exit.ts
11
- var _zui = require('@bpinternal/zui');
12
- var Exit = (_class = class _Exit {
13
-
14
- __init() {this.aliases = []}
15
-
16
-
17
-
18
- get zSchema() {
19
- return this.schema ? _zui.transforms.fromJSONSchemaLegacy(this.schema) : void 0;
20
- }
21
- rename(name) {
22
- const before = this.name;
23
- if (!_chunk276Q6EWPcjs.isValidIdentifier.call(void 0, name)) {
24
- throw new Error(
25
- `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.`
26
- );
27
- }
28
- this.name = name;
29
- this.aliases = _chunkUQOBUJIQcjs.uniq_default.call(void 0, [name, ...this.aliases.map((alias) => alias === before ? name : alias)]);
30
- return this;
31
- }
32
- clone() {
33
- return new _Exit({
34
- name: this.name,
35
- aliases: [...this.aliases],
36
- description: this.description,
37
- metadata: JSON.parse(JSON.stringify(this.metadata)),
38
- schema: this.zSchema
39
- });
40
- }
41
- is(exit) {
42
- return this.name === exit.name;
43
- }
44
- match(result) {
45
- return result.exit instanceof _Exit && this.name === result.exit.name;
46
- }
47
- constructor(props) {;_class.prototype.__init.call(this);
48
- if (!_chunk276Q6EWPcjs.isValidIdentifier.call(void 0, props.name)) {
49
- throw new Error(
50
- `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.`
51
- );
52
- }
53
- if (typeof props.description !== "string" || props.description.trim().length === 0) {
54
- throw new Error(
55
- `Invalid description for exit ${props.name}. Expected a non-empty string, but got type "${typeof props.description}"`
56
- );
57
- }
58
- if (props.metadata !== void 0 && typeof props.metadata !== "object") {
59
- throw new Error(
60
- `Invalid metadata for exit ${props.name}. Expected an object, but got type "${typeof props.metadata}"`
61
- );
62
- }
63
- if (props.aliases !== void 0 && !Array.isArray(props.aliases)) {
64
- throw new Error(
65
- `Invalid aliases for exit ${props.name}. Expected an array, but got type "${typeof props.aliases}"`
66
- );
67
- }
68
- if (props.aliases && props.aliases.some((alias) => !_chunk276Q6EWPcjs.isValidIdentifier.call(void 0, alias))) {
69
- throw new Error(`Invalid aliases for exit ${props.name}. Expected an array of valid identifiers.`);
70
- }
71
- if (typeof props.schema !== "undefined") {
72
- if (_chunk276Q6EWPcjs.isZuiSchema.call(void 0, props.schema)) {
73
- this.schema = _zui.transforms.toJSONSchemaLegacy(props.schema);
74
- } else if (_chunk276Q6EWPcjs.isJsonSchema.call(void 0, props.schema)) {
75
- this.schema = props.schema;
76
- } else {
77
- throw new Error(
78
- `Invalid input schema for exit ${props.name}. Expected a ZodType or JSONSchema, but got type "${typeof props.schema}"`
79
- );
80
- }
81
- }
82
- this.name = props.name;
83
- this.aliases = _chunkUQOBUJIQcjs.uniq_default.call(void 0, [props.name, ..._nullishCoalesce(props.aliases, () => ( []))]);
84
- this.description = props.description;
85
- this.metadata = _nullishCoalesce(props.metadata, () => ( {}));
86
- }
87
- static __initStatic() {this.withUniqueNames = (exits) => {
88
- const names = /* @__PURE__ */ new Set();
89
- return exits.map((exit) => {
90
- if (exits.filter((t) => t.name === exit.name).length === 1) {
91
- return exit;
92
- }
93
- let counter = 1;
94
- let exitName = exit.name + counter;
95
- while (names.has(exitName)) {
96
- exitName = `${exit.name}${++counter}`;
97
- }
98
- return exit.rename(exitName);
99
- });
100
- }}
101
- }, _class.__initStatic(), _class);
102
-
103
-
104
-
105
- exports.Exit = Exit;