llmz 0.0.2 → 0.0.4

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 (81) hide show
  1. package/dist/{chunk-RB2L33ZR.js → chunk-4EWY34YA.js} +24 -24
  2. package/dist/{chunk-UG2GCPHF.js → chunk-4KB5WXHR.js} +3 -2
  3. package/dist/{chunk-YPOOKE3A.cjs → chunk-4QTK5ALH.cjs} +59 -28
  4. package/dist/{chunk-BKGPO722.cjs → chunk-5NVNEEYW.cjs} +55 -55
  5. package/dist/{chunk-DFZ6GX5C.js → chunk-5TRUJES5.js} +1 -1
  6. package/dist/{chunk-C2TSWGYC.cjs → chunk-6YWYCVAB.cjs} +5 -4
  7. package/dist/{chunk-7S3UY52U.js → chunk-7WRN4E42.js} +36 -8
  8. package/dist/{chunk-Q4DEJGXD.js → chunk-EFGXTO64.js} +2 -2
  9. package/dist/{chunk-VP6WWAE2.cjs → chunk-FIVFS4HG.cjs} +2 -2
  10. package/dist/{chunk-YUDUY7XW.cjs → chunk-HYVKY3W6.cjs} +23 -24
  11. package/dist/{chunk-PQN6HW7A.cjs → chunk-IKSIOIIP.cjs} +3 -3
  12. package/dist/{chunk-ZUAFUOUR.cjs → chunk-JDABP4SD.cjs} +3 -3
  13. package/dist/{chunk-E5W3P7EO.cjs → chunk-JK2LZW2G.cjs} +20 -2
  14. package/dist/{chunk-RJHDQL4C.js → chunk-JKVVQN2P.js} +1 -1
  15. package/dist/{chunk-MSTBEKOQ.js → chunk-JQBT7UWN.js} +3 -3
  16. package/dist/{chunk-BOLDQGES.cjs → chunk-KMZDFWYZ.cjs} +3 -3
  17. package/dist/{chunk-R2N2UUKC.cjs → chunk-LVKZYKTP.cjs} +14 -8
  18. package/dist/{chunk-7FIPXMZR.js → chunk-ORQP26SZ.js} +1 -1
  19. package/dist/{chunk-ENFB45AI.cjs → chunk-P7J2WCBB.cjs} +7 -7
  20. package/dist/{chunk-DILHJIMP.js → chunk-QBXIE6EY.js} +49 -18
  21. package/dist/{chunk-UVSOAH2H.js → chunk-QT4QF3YA.js} +1 -1
  22. package/dist/{chunk-6QDFMQHA.js → chunk-S6WICIDW.js} +8 -2
  23. package/dist/{chunk-QPSUMPLP.js → chunk-TJQVC4CE.js} +6 -6
  24. package/dist/{chunk-ZSRC3TN4.js → chunk-UNMKB2DA.js} +9 -10
  25. package/dist/{chunk-3CGLDS5T.cjs → chunk-UQOBUJIQ.cjs} +38 -10
  26. package/dist/{chunk-QZGFCB4T.cjs → chunk-VAF2H6UD.cjs} +22 -22
  27. package/dist/{chunk-E2B5DRIC.cjs → chunk-W6U2VXSF.cjs} +25 -25
  28. package/dist/{chunk-3T465BEW.js → chunk-ZCPQ3QOW.js} +19 -1
  29. package/dist/citations.d.ts +63 -0
  30. package/dist/component-HQ5YQNRX.cjs +14 -0
  31. package/dist/component-LQDU72LX.js +14 -0
  32. package/dist/component.d.ts +32 -10
  33. package/dist/component.default.d.ts +334 -8
  34. package/dist/context.d.ts +3 -1
  35. package/dist/dual-modes-QHBOFWHM.js +13 -0
  36. package/dist/dual-modes-YE4S2AIL.cjs +13 -0
  37. package/dist/exit-F6ZUL2NV.js +8 -0
  38. package/dist/exit-IDKGZD7M.cjs +8 -0
  39. package/dist/exit.d.ts +2 -0
  40. package/dist/index.cjs +209 -58
  41. package/dist/index.d.ts +3 -2
  42. package/dist/index.js +193 -42
  43. package/dist/{jsx-CJ2RBODH.js → jsx-AEHVFB3L.js} +2 -3
  44. package/dist/jsx-AJAXBWFE.cjs +13 -0
  45. package/dist/{llmz-WY74UVE3.js → llmz-AS5TGCQS.js} +98 -39
  46. package/dist/{llmz-EGTGPSTX.cjs → llmz-R6XZG3JQ.cjs} +129 -70
  47. package/dist/llmz.d.ts +3 -2
  48. package/dist/snapshots.d.ts +9 -1
  49. package/dist/tool-LY77IWV2.js +11 -0
  50. package/dist/tool-SWJYOR2Z.cjs +11 -0
  51. package/dist/tool.d.ts +34 -9
  52. package/dist/truncator-NYN7BGKJ.cjs +10 -0
  53. package/dist/truncator-WAL2GCUY.js +10 -0
  54. package/dist/types.d.ts +7 -1
  55. package/dist/typings-AIV2OASX.js +10 -0
  56. package/dist/typings-XR6CYHW4.cjs +10 -0
  57. package/dist/{utils-TS23YJPE.js → utils-L5GLCS3C.js} +2 -3
  58. package/dist/utils-QC4I2L6R.cjs +37 -0
  59. package/dist/vm-GJ5R72AP.cjs +12 -0
  60. package/dist/vm-ZUQOSRRM.js +12 -0
  61. package/dist/vm.d.ts +1 -1
  62. package/package.json +8 -6
  63. package/dist/chunk-A7BDFLAE.cjs +0 -30
  64. package/dist/chunk-YSQDPG26.js +0 -30
  65. package/dist/component-DWBRHLEN.cjs +0 -9
  66. package/dist/component-R3ZAVXUC.js +0 -9
  67. package/dist/dual-modes-2VDEOJ5D.js +0 -13
  68. package/dist/dual-modes-3MH5N6RY.cjs +0 -13
  69. package/dist/exit-GYMXZZ4I.js +0 -9
  70. package/dist/exit-PQHMJEOG.cjs +0 -9
  71. package/dist/jsx-PPLE5YTB.cjs +0 -14
  72. package/dist/tool-AY47ML65.cjs +0 -12
  73. package/dist/tool-WVIPESKN.js +0 -12
  74. package/dist/truncator-MTONQESU.js +0 -11
  75. package/dist/truncator-ZKPOW2I3.cjs +0 -11
  76. package/dist/typings-HTYLRNIC.js +0 -11
  77. package/dist/typings-QRJGGNUM.cjs +0 -11
  78. package/dist/utils-UR4IMUHC.cjs +0 -38
  79. package/dist/vm-4JFSZAMR.cjs +0 -13
  80. package/dist/vm-SMMA664M.js +0 -13
  81. package/patches/source-map-js@1.2.1.patch +0 -16
@@ -5,7 +5,6 @@ export type ComponentProperty = {
5
5
  description?: string;
6
6
  required: boolean;
7
7
  };
8
- export type Component = DefaultComponent | LeafComponent | ContainerComponent;
9
8
  export type ExampleUsage = {
10
9
  name: string;
11
10
  description: string;
@@ -13,39 +12,62 @@ export type ExampleUsage = {
13
12
  };
14
13
  export type ComponentChild = {
15
14
  description: string;
16
- component: Component;
15
+ component: ComponentDefinition;
17
16
  };
18
- export type DefaultComponent = {
17
+ export declare function assertValidComponent(component: ComponentDefinition): asserts component is ComponentDefinition;
18
+ export declare function getComponentReference(component: ComponentDefinition): string;
19
+ type TypeMap = {
20
+ string: string;
21
+ boolean: boolean;
22
+ number: number;
23
+ };
24
+ type ExtractPropsFromProperties<T extends readonly ComponentProperty[]> = {
25
+ [K in T[number] as K['name']]: K['required'] extends true ? TypeMap[K['type']] : TypeMap[K['type']] | undefined;
26
+ };
27
+ export type DefaultComponentDefinition<T extends readonly ComponentProperty[] = readonly ComponentProperty[]> = {
19
28
  type: 'default';
20
29
  name: string;
21
30
  aliases: string[];
22
31
  description: string;
23
32
  examples: ExampleUsage[];
24
33
  default: {
25
- props: ComponentProperty[];
34
+ props: T;
26
35
  children: Array<ComponentChild>;
27
36
  };
28
37
  };
29
- export type LeafComponent = {
38
+ export type LeafComponentDefinition<T extends readonly ComponentProperty[] = readonly ComponentProperty[]> = {
30
39
  type: 'leaf';
31
40
  name: string;
32
41
  description: string;
33
42
  aliases?: string[];
34
43
  examples: ExampleUsage[];
35
44
  leaf: {
36
- props: ComponentProperty[];
45
+ props: T;
37
46
  };
38
47
  };
39
- export type ContainerComponent = {
48
+ export type ContainerComponentDefinition<T extends readonly ComponentProperty[] = readonly ComponentProperty[]> = {
40
49
  type: 'container';
41
50
  name: string;
42
51
  description: string;
43
52
  aliases?: string[];
44
53
  examples: ExampleUsage[];
45
54
  container: {
46
- props: ComponentProperty[];
55
+ props: T;
47
56
  children: Array<ComponentChild>;
48
57
  };
49
58
  };
50
- export declare function assertValidComponent(component: Component): asserts component is Component;
51
- export declare function getComponentReference(component: Component): string;
59
+ export type ComponentDefinition = DefaultComponentDefinition | LeafComponentDefinition | ContainerComponentDefinition;
60
+ type ExtractComponentProps<T extends ComponentDefinition> = T extends LeafComponentDefinition<infer P> ? ExtractPropsFromProperties<P> : T extends ContainerComponentDefinition<infer P> ? ExtractPropsFromProperties<P> : T extends DefaultComponentDefinition<infer P> ? ExtractPropsFromProperties<P> : never;
61
+ export type RenderedComponent<TProps = Record<string, any>> = {
62
+ __jsx: true;
63
+ type: string;
64
+ children: any[];
65
+ props: TProps;
66
+ };
67
+ export declare class Component<T extends ComponentDefinition = ComponentDefinition> {
68
+ readonly definition: T;
69
+ readonly propsType: ExtractComponentProps<T>;
70
+ constructor(definition: T);
71
+ }
72
+ export declare function isComponent<T extends ComponentDefinition>(rendered: RenderedComponent<any>, component: Component<T>): rendered is RenderedComponent<ExtractComponentProps<T>>;
73
+ export {};
@@ -1,10 +1,336 @@
1
+ import { Component, RenderedComponent } from './component.js';
2
+ import { Tool } from './tool.js';
3
+ export type SendMessageHandler = (input: RenderedComponent) => Promise<void> | void;
4
+ export declare const messageTool: (handler: SendMessageHandler) => Tool<import("./types.js").ZuiType, import("./types.js").ZuiType>;
1
5
  export declare const DefaultComponents: {
2
- Button: import("./component.js").LeafComponent;
3
- Image: import("./component.js").LeafComponent;
4
- File: import("./component.js").LeafComponent;
5
- Video: import("./component.js").LeafComponent;
6
- Audio: import("./component.js").LeafComponent;
7
- Card: import("./component.js").ContainerComponent;
8
- Carousel: import("./component.js").ContainerComponent;
9
- Text: import("./component.js").DefaultComponent;
6
+ Button: Component<{
7
+ type: "leaf";
8
+ description: string;
9
+ name: string;
10
+ aliases: string[];
11
+ examples: {
12
+ name: string;
13
+ description: string;
14
+ code: string;
15
+ }[];
16
+ leaf: {
17
+ props: ({
18
+ name: string;
19
+ type: "string";
20
+ default: string;
21
+ description: string;
22
+ required: true;
23
+ } | {
24
+ name: string;
25
+ type: "string";
26
+ description: string;
27
+ required: true;
28
+ default?: undefined;
29
+ } | {
30
+ name: string;
31
+ type: "string";
32
+ description: string;
33
+ required: false;
34
+ default?: undefined;
35
+ })[];
36
+ };
37
+ }>;
38
+ Image: Component<{
39
+ type: "leaf";
40
+ name: string;
41
+ description: string;
42
+ aliases: never[];
43
+ examples: {
44
+ name: string;
45
+ description: string;
46
+ code: string;
47
+ }[];
48
+ leaf: {
49
+ props: ({
50
+ name: string;
51
+ type: "string";
52
+ description: string;
53
+ required: true;
54
+ } | {
55
+ name: string;
56
+ type: "string";
57
+ description: string;
58
+ required: false;
59
+ })[];
60
+ };
61
+ }>;
62
+ File: Component<{
63
+ type: "leaf";
64
+ name: string;
65
+ description: string;
66
+ aliases: never[];
67
+ examples: {
68
+ name: string;
69
+ description: string;
70
+ code: string;
71
+ }[];
72
+ leaf: {
73
+ props: ({
74
+ name: string;
75
+ type: "string";
76
+ description: string;
77
+ required: true;
78
+ } | {
79
+ name: string;
80
+ type: "string";
81
+ description: string;
82
+ required: false;
83
+ })[];
84
+ };
85
+ }>;
86
+ Video: Component<{
87
+ type: "leaf";
88
+ name: string;
89
+ description: string;
90
+ aliases: never[];
91
+ examples: {
92
+ name: string;
93
+ description: string;
94
+ code: string;
95
+ }[];
96
+ leaf: {
97
+ props: ({
98
+ name: string;
99
+ type: "string";
100
+ description: string;
101
+ required: true;
102
+ } | {
103
+ name: string;
104
+ type: "string";
105
+ description: string;
106
+ required: false;
107
+ })[];
108
+ };
109
+ }>;
110
+ Audio: Component<{
111
+ type: "leaf";
112
+ name: string;
113
+ description: string;
114
+ aliases: never[];
115
+ examples: {
116
+ name: string;
117
+ description: string;
118
+ code: string;
119
+ }[];
120
+ leaf: {
121
+ props: ({
122
+ name: string;
123
+ type: "string";
124
+ description: string;
125
+ required: true;
126
+ } | {
127
+ name: string;
128
+ type: "string";
129
+ description: string;
130
+ required: false;
131
+ })[];
132
+ };
133
+ }>;
134
+ Card: Component<{
135
+ type: "container";
136
+ name: string;
137
+ description: string;
138
+ aliases: never[];
139
+ examples: {
140
+ name: string;
141
+ description: string;
142
+ code: string;
143
+ }[];
144
+ container: {
145
+ props: ({
146
+ name: string;
147
+ type: "string";
148
+ description: string;
149
+ required: true;
150
+ } | {
151
+ name: string;
152
+ type: "string";
153
+ description: string;
154
+ required: false;
155
+ })[];
156
+ children: ({
157
+ description: string;
158
+ component: {
159
+ type: "leaf";
160
+ name: string;
161
+ description: string;
162
+ aliases: never[];
163
+ examples: {
164
+ name: string;
165
+ description: string;
166
+ code: string;
167
+ }[];
168
+ leaf: {
169
+ props: ({
170
+ name: string;
171
+ type: "string";
172
+ description: string;
173
+ required: true;
174
+ } | {
175
+ name: string;
176
+ type: "string";
177
+ description: string;
178
+ required: false;
179
+ })[];
180
+ };
181
+ };
182
+ } | {
183
+ description: string;
184
+ component: {
185
+ type: "leaf";
186
+ description: string;
187
+ name: string;
188
+ aliases: string[];
189
+ examples: {
190
+ name: string;
191
+ description: string;
192
+ code: string;
193
+ }[];
194
+ leaf: {
195
+ props: ({
196
+ name: string;
197
+ type: "string";
198
+ default: string;
199
+ description: string;
200
+ required: true;
201
+ } | {
202
+ name: string;
203
+ type: "string";
204
+ description: string;
205
+ required: true;
206
+ default?: undefined;
207
+ } | {
208
+ name: string;
209
+ type: "string";
210
+ description: string;
211
+ required: false;
212
+ default?: undefined;
213
+ })[];
214
+ };
215
+ };
216
+ })[];
217
+ };
218
+ }>;
219
+ Carousel: Component<{
220
+ type: "container";
221
+ name: string;
222
+ description: string;
223
+ aliases: never[];
224
+ examples: {
225
+ name: string;
226
+ description: string;
227
+ code: string;
228
+ }[];
229
+ container: {
230
+ props: never[];
231
+ children: {
232
+ description: string;
233
+ component: {
234
+ type: "container";
235
+ name: string;
236
+ description: string;
237
+ aliases: never[];
238
+ examples: {
239
+ name: string;
240
+ description: string;
241
+ code: string;
242
+ }[];
243
+ container: {
244
+ props: ({
245
+ name: string;
246
+ type: "string";
247
+ description: string;
248
+ required: true;
249
+ } | {
250
+ name: string;
251
+ type: "string";
252
+ description: string;
253
+ required: false;
254
+ })[];
255
+ children: ({
256
+ description: string;
257
+ component: {
258
+ type: "leaf";
259
+ name: string;
260
+ description: string;
261
+ aliases: never[];
262
+ examples: {
263
+ name: string;
264
+ description: string;
265
+ code: string;
266
+ }[];
267
+ leaf: {
268
+ props: ({
269
+ name: string;
270
+ type: "string";
271
+ description: string;
272
+ required: true;
273
+ } | {
274
+ name: string;
275
+ type: "string";
276
+ description: string;
277
+ required: false;
278
+ })[];
279
+ };
280
+ };
281
+ } | {
282
+ description: string;
283
+ component: {
284
+ type: "leaf";
285
+ description: string;
286
+ name: string;
287
+ aliases: string[];
288
+ examples: {
289
+ name: string;
290
+ description: string;
291
+ code: string;
292
+ }[];
293
+ leaf: {
294
+ props: ({
295
+ name: string;
296
+ type: "string";
297
+ default: string;
298
+ description: string;
299
+ required: true;
300
+ } | {
301
+ name: string;
302
+ type: "string";
303
+ description: string;
304
+ required: true;
305
+ default?: undefined;
306
+ } | {
307
+ name: string;
308
+ type: "string";
309
+ description: string;
310
+ required: false;
311
+ default?: undefined;
312
+ })[];
313
+ };
314
+ };
315
+ })[];
316
+ };
317
+ };
318
+ }[];
319
+ };
320
+ }>;
321
+ Text: Component<{
322
+ type: "default";
323
+ name: string;
324
+ aliases: string[];
325
+ description: string;
326
+ examples: {
327
+ name: string;
328
+ description: string;
329
+ code: string;
330
+ }[];
331
+ default: {
332
+ props: never[];
333
+ children: never[];
334
+ };
335
+ }>;
10
336
  };
package/dist/context.d.ts CHANGED
@@ -93,7 +93,7 @@ export declare class Iteration {
93
93
  trackMutation(mutation: ObjectMutation): void;
94
94
  private _parameters;
95
95
  get transcript(): TranscriptArray;
96
- get tools(): Tool<unknown, unknown>[];
96
+ get tools(): Tool<import("./types.js").ZuiType, import("./types.js").ZuiType>[];
97
97
  get objects(): ObjectInstance[];
98
98
  get exits(): Exit<unknown>[];
99
99
  get instructions(): string | undefined;
@@ -139,6 +139,7 @@ export declare class Context {
139
139
  exits?: ValueOrGetter<Exit[], Context>;
140
140
  components?: ValueOrGetter<Component[], Context>;
141
141
  version: Prompt;
142
+ timeout: number;
142
143
  loop: number;
143
144
  temperature: number;
144
145
  model?: Model;
@@ -162,6 +163,7 @@ export declare class Context {
162
163
  model?: Model;
163
164
  metadata?: Record<string, any>;
164
165
  snapshot?: Snapshot;
166
+ timeout?: number;
165
167
  });
166
168
  }
167
169
  export {};
@@ -0,0 +1,13 @@
1
+ import {
2
+ DualModePrompt
3
+ } from "./chunk-TJQVC4CE.js";
4
+ import "./chunk-EFGXTO64.js";
5
+ import "./chunk-JQBT7UWN.js";
6
+ import "./chunk-ZCPQ3QOW.js";
7
+ import "./chunk-ORQP26SZ.js";
8
+ import "./chunk-QT4QF3YA.js";
9
+ import "./chunk-5TRUJES5.js";
10
+ import "./chunk-7WRN4E42.js";
11
+ export {
12
+ DualModePrompt
13
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkW6U2VXSFcjs = require('./chunk-W6U2VXSF.cjs');
4
+ require('./chunk-VAF2H6UD.cjs');
5
+ require('./chunk-IKSIOIIP.cjs');
6
+ require('./chunk-JK2LZW2G.cjs');
7
+ require('./chunk-KMZDFWYZ.cjs');
8
+ require('./chunk-FIVFS4HG.cjs');
9
+ require('./chunk-P7J2WCBB.cjs');
10
+ require('./chunk-UQOBUJIQ.cjs');
11
+
12
+
13
+ exports.DualModePrompt = _chunkW6U2VXSFcjs.DualModePrompt;
@@ -0,0 +1,8 @@
1
+ import {
2
+ Exit
3
+ } from "./chunk-S6WICIDW.js";
4
+ import "./chunk-5TRUJES5.js";
5
+ import "./chunk-7WRN4E42.js";
6
+ export {
7
+ Exit
8
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkLVKZYKTPcjs = require('./chunk-LVKZYKTP.cjs');
4
+ require('./chunk-P7J2WCBB.cjs');
5
+ require('./chunk-UQOBUJIQ.cjs');
6
+
7
+
8
+ exports.Exit = _chunkLVKZYKTPcjs.Exit;
package/dist/exit.d.ts CHANGED
@@ -9,6 +9,8 @@ export declare class Exit<T = unknown> {
9
9
  get zSchema(): import("@bpinternal/zui").ZodTypeAny | undefined;
10
10
  rename(name: string): this;
11
11
  clone(): Exit<any>;
12
+ is<T>(exit: Exit<T>): this is Exit<T>;
13
+ parse(exit: Exit, value: unknown): value is T;
12
14
  constructor(props: {
13
15
  name: string;
14
16
  aliases?: string[];