pupt-lib 1.2.5 → 1.3.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.
- package/README.md +292 -256
- package/dist/index.d.ts +458 -29
- package/dist/index.js +2061 -362
- package/dist/jsx-dev-runtime.d.ts +483 -0
- package/dist/jsx-runtime/index.d.ts +2 -29
- package/dist/jsx-runtime/jsx-dev-runtime.d.ts +2 -26
- package/package.json +4 -4
- package/dist/api.d.ts +0 -38
- package/dist/api.d.ts.map +0 -1
- package/dist/component.d.ts +0 -83
- package/dist/component.d.ts.map +0 -1
- package/dist/components/ask/Choice.d.ts +0 -156
- package/dist/components/ask/Choice.d.ts.map +0 -1
- package/dist/components/ask/Confirm.d.ts +0 -61
- package/dist/components/ask/Confirm.d.ts.map +0 -1
- package/dist/components/ask/Date.d.ts +0 -79
- package/dist/components/ask/Date.d.ts.map +0 -1
- package/dist/components/ask/Editor.d.ts +0 -67
- package/dist/components/ask/Editor.d.ts.map +0 -1
- package/dist/components/ask/File.d.ts +0 -85
- package/dist/components/ask/File.d.ts.map +0 -1
- package/dist/components/ask/Label.d.ts +0 -28
- package/dist/components/ask/Label.d.ts.map +0 -1
- package/dist/components/ask/MultiSelect.d.ts +0 -148
- package/dist/components/ask/MultiSelect.d.ts.map +0 -1
- package/dist/components/ask/Number.d.ts +0 -73
- package/dist/components/ask/Number.d.ts.map +0 -1
- package/dist/components/ask/Option.d.ts +0 -29
- package/dist/components/ask/Option.d.ts.map +0 -1
- package/dist/components/ask/Path.d.ts +0 -73
- package/dist/components/ask/Path.d.ts.map +0 -1
- package/dist/components/ask/Rating.d.ts +0 -79
- package/dist/components/ask/Rating.d.ts.map +0 -1
- package/dist/components/ask/ReviewFile.d.ts +0 -79
- package/dist/components/ask/ReviewFile.d.ts.map +0 -1
- package/dist/components/ask/Secret.d.ts +0 -67
- package/dist/components/ask/Secret.d.ts.map +0 -1
- package/dist/components/ask/Select.d.ts +0 -136
- package/dist/components/ask/Select.d.ts.map +0 -1
- package/dist/components/ask/Text.d.ts +0 -67
- package/dist/components/ask/Text.d.ts.map +0 -1
- package/dist/components/ask/index.d.ts +0 -34
- package/dist/components/ask/index.d.ts.map +0 -1
- package/dist/components/ask/utils.d.ts +0 -26
- package/dist/components/ask/utils.d.ts.map +0 -1
- package/dist/components/control/ForEach.d.ts +0 -32
- package/dist/components/control/ForEach.d.ts.map +0 -1
- package/dist/components/control/If.d.ts +0 -24
- package/dist/components/control/If.d.ts.map +0 -1
- package/dist/components/data/Code.d.ts +0 -31
- package/dist/components/data/Code.d.ts.map +0 -1
- package/dist/components/data/Data.d.ts +0 -31
- package/dist/components/data/Data.d.ts.map +0 -1
- package/dist/components/data/File.d.ts +0 -37
- package/dist/components/data/File.d.ts.map +0 -1
- package/dist/components/data/Json.d.ts +0 -25
- package/dist/components/data/Json.d.ts.map +0 -1
- package/dist/components/data/Xml.d.ts +0 -25
- package/dist/components/data/Xml.d.ts.map +0 -1
- package/dist/components/data/index.d.ts +0 -6
- package/dist/components/data/index.d.ts.map +0 -1
- package/dist/components/examples/Example.d.ts +0 -17
- package/dist/components/examples/Example.d.ts.map +0 -1
- package/dist/components/examples/ExampleInput.d.ts +0 -13
- package/dist/components/examples/ExampleInput.d.ts.map +0 -1
- package/dist/components/examples/ExampleOutput.d.ts +0 -13
- package/dist/components/examples/ExampleOutput.d.ts.map +0 -1
- package/dist/components/examples/Examples.d.ts +0 -13
- package/dist/components/examples/Examples.d.ts.map +0 -1
- package/dist/components/examples/index.d.ts +0 -5
- package/dist/components/examples/index.d.ts.map +0 -1
- package/dist/components/index.d.ts +0 -11
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/meta/Uses.d.ts +0 -98
- package/dist/components/meta/Uses.d.ts.map +0 -1
- package/dist/components/meta/index.d.ts +0 -2
- package/dist/components/meta/index.d.ts.map +0 -1
- package/dist/components/post-execution/OpenUrl.d.ts +0 -29
- package/dist/components/post-execution/OpenUrl.d.ts.map +0 -1
- package/dist/components/post-execution/PostExecution.d.ts +0 -13
- package/dist/components/post-execution/PostExecution.d.ts.map +0 -1
- package/dist/components/post-execution/ReviewFile.d.ts +0 -29
- package/dist/components/post-execution/ReviewFile.d.ts.map +0 -1
- package/dist/components/post-execution/RunCommand.d.ts +0 -35
- package/dist/components/post-execution/RunCommand.d.ts.map +0 -1
- package/dist/components/post-execution/index.d.ts +0 -5
- package/dist/components/post-execution/index.d.ts.map +0 -1
- package/dist/components/reasoning/Step.d.ts +0 -25
- package/dist/components/reasoning/Step.d.ts.map +0 -1
- package/dist/components/reasoning/Steps.d.ts +0 -14
- package/dist/components/reasoning/Steps.d.ts.map +0 -1
- package/dist/components/reasoning/index.d.ts +0 -3
- package/dist/components/reasoning/index.d.ts.map +0 -1
- package/dist/components/structural/Audience.d.ts +0 -25
- package/dist/components/structural/Audience.d.ts.map +0 -1
- package/dist/components/structural/Constraint.d.ts +0 -31
- package/dist/components/structural/Constraint.d.ts.map +0 -1
- package/dist/components/structural/Context.d.ts +0 -25
- package/dist/components/structural/Context.d.ts.map +0 -1
- package/dist/components/structural/Criterion.d.ts +0 -13
- package/dist/components/structural/Criterion.d.ts.map +0 -1
- package/dist/components/structural/Format.d.ts +0 -37
- package/dist/components/structural/Format.d.ts.map +0 -1
- package/dist/components/structural/Prompt.d.ts +0 -43
- package/dist/components/structural/Prompt.d.ts.map +0 -1
- package/dist/components/structural/Role.d.ts +0 -37
- package/dist/components/structural/Role.d.ts.map +0 -1
- package/dist/components/structural/Section.d.ts +0 -31
- package/dist/components/structural/Section.d.ts.map +0 -1
- package/dist/components/structural/SuccessCriteria.d.ts +0 -25
- package/dist/components/structural/SuccessCriteria.d.ts.map +0 -1
- package/dist/components/structural/Task.d.ts +0 -25
- package/dist/components/structural/Task.d.ts.map +0 -1
- package/dist/components/structural/Tone.d.ts +0 -25
- package/dist/components/structural/Tone.d.ts.map +0 -1
- package/dist/components/structural/index.d.ts +0 -12
- package/dist/components/structural/index.d.ts.map +0 -1
- package/dist/components/utility/Cwd.d.ts +0 -11
- package/dist/components/utility/Cwd.d.ts.map +0 -1
- package/dist/components/utility/DateTime.d.ts +0 -23
- package/dist/components/utility/DateTime.d.ts.map +0 -1
- package/dist/components/utility/Hostname.d.ts +0 -11
- package/dist/components/utility/Hostname.d.ts.map +0 -1
- package/dist/components/utility/Timestamp.d.ts +0 -11
- package/dist/components/utility/Timestamp.d.ts.map +0 -1
- package/dist/components/utility/UUID.d.ts +0 -11
- package/dist/components/utility/UUID.d.ts.map +0 -1
- package/dist/components/utility/Username.d.ts +0 -11
- package/dist/components/utility/Username.d.ts.map +0 -1
- package/dist/components/utility/index.d.ts +0 -7
- package/dist/components/utility/index.d.ts.map +0 -1
- package/dist/create-prompt.d.ts +0 -118
- package/dist/create-prompt.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/jsx-runtime/index.d.ts.map +0 -1
- package/dist/jsx-runtime/jsx-dev-runtime.d.ts.map +0 -1
- package/dist/render.d.ts +0 -19
- package/dist/render.d.ts.map +0 -1
- package/dist/services/babel-plugins/index.d.ts +0 -3
- package/dist/services/babel-plugins/index.d.ts.map +0 -1
- package/dist/services/babel-plugins/name-hoisting.d.ts +0 -8
- package/dist/services/babel-plugins/name-hoisting.d.ts.map +0 -1
- package/dist/services/babel-plugins/uses-to-import.d.ts +0 -16
- package/dist/services/babel-plugins/uses-to-import.d.ts.map +0 -1
- package/dist/services/browser-support.d.ts +0 -185
- package/dist/services/browser-support.d.ts.map +0 -1
- package/dist/services/file-search-engine.d.ts +0 -162
- package/dist/services/file-search-engine.d.ts.map +0 -1
- package/dist/services/formula-parser.d.ts +0 -9
- package/dist/services/formula-parser.d.ts.map +0 -1
- package/dist/services/input-iterator.d.ts +0 -54
- package/dist/services/input-iterator.d.ts.map +0 -1
- package/dist/services/module-evaluator.d.ts +0 -38
- package/dist/services/module-evaluator.d.ts.map +0 -1
- package/dist/services/module-loader.d.ts +0 -92
- package/dist/services/module-loader.d.ts.map +0 -1
- package/dist/services/preprocessor.d.ts +0 -52
- package/dist/services/preprocessor.d.ts.map +0 -1
- package/dist/services/prop-validator.d.ts +0 -21
- package/dist/services/prop-validator.d.ts.map +0 -1
- package/dist/services/search-engine.d.ts +0 -10
- package/dist/services/search-engine.d.ts.map +0 -1
- package/dist/services/transformer.d.ts +0 -38
- package/dist/services/transformer.d.ts.map +0 -1
- package/dist/types/component.d.ts +0 -30
- package/dist/types/component.d.ts.map +0 -1
- package/dist/types/context.d.ts +0 -341
- package/dist/types/context.d.ts.map +0 -1
- package/dist/types/element.d.ts +0 -47
- package/dist/types/element.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -11
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/input.d.ts +0 -61
- package/dist/types/input.d.ts.map +0 -1
- package/dist/types/module.d.ts +0 -61
- package/dist/types/module.d.ts.map +0 -1
- package/dist/types/render.d.ts +0 -92
- package/dist/types/render.d.ts.map +0 -1
- package/dist/types/search.d.ts +0 -59
- package/dist/types/search.d.ts.map +0 -1
- package/dist/types/symbols.d.ts +0 -9
- package/dist/types/symbols.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,458 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ZodObject } from 'zod';
|
|
3
|
+
import { ZodRawShape } from 'zod';
|
|
4
|
+
|
|
5
|
+
/** Symbol for element children */
|
|
6
|
+
declare const CHILDREN: unique symbol;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Abstract base class for pupt-lib components.
|
|
10
|
+
* Extend this class to create class-based components with access to render context.
|
|
11
|
+
*
|
|
12
|
+
* Components can implement:
|
|
13
|
+
* - `resolve()` only: Compute a value (rendered as string, no visual output)
|
|
14
|
+
* - `render()` only: Produce visual output (backward compatible)
|
|
15
|
+
* - Both `resolve()` and `render()`: Compute value, then render with that value
|
|
16
|
+
*
|
|
17
|
+
* Both resolve and render methods can be synchronous or asynchronous.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Component with resolve() only - value is stringified
|
|
22
|
+
* class ValueComponent extends Component<{ value: string }, string> {
|
|
23
|
+
* resolve(props: { value: string }) {
|
|
24
|
+
* return props.value.toUpperCase();
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* // Component with only render() (backward compatible)
|
|
29
|
+
* class Greeting extends Component<{ name: string }> {
|
|
30
|
+
* render(props: { name: string }) {
|
|
31
|
+
* return `Hello, ${props.name}!`;
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* // Component with both resolve() and render()
|
|
36
|
+
* class DataFetcher extends Component<{ id: number }, { data: string }> {
|
|
37
|
+
* resolve(props: { id: number }) {
|
|
38
|
+
* return { data: `Data for ${props.id}` };
|
|
39
|
+
* }
|
|
40
|
+
* render(props: { id: number }, value: { data: string }) {
|
|
41
|
+
* return `Fetched: ${value.data}`;
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare abstract class Component<Props = Record<string, unknown>, ResolveType = void> {
|
|
47
|
+
static [COMPONENT_MARKER]: boolean;
|
|
48
|
+
/** Zod schema for validating component props (excluding children) */
|
|
49
|
+
static schema: ZodObject<ZodRawShape>;
|
|
50
|
+
/** Optional Zod schema for validating the resolved value */
|
|
51
|
+
static resolveSchema?: ZodObject<ZodRawShape>;
|
|
52
|
+
/**
|
|
53
|
+
* When true, the name-hoisting Babel plugin will hoist this component's
|
|
54
|
+
* `name` prop to a variable declaration. Components that use `name` for
|
|
55
|
+
* variable creation (e.g., File, ReviewFile) should set this to true.
|
|
56
|
+
* Components that use `name` for identification (e.g., Section, Role)
|
|
57
|
+
* leave this unset.
|
|
58
|
+
*/
|
|
59
|
+
static hoistName?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Optional: Compute the resolved value for this component.
|
|
62
|
+
*
|
|
63
|
+
* If implemented, this method is called before render().
|
|
64
|
+
* The resolved value is stored and can be passed to other components.
|
|
65
|
+
*
|
|
66
|
+
* @param props - The properties passed to the component
|
|
67
|
+
* @param context - The render context containing environment and inputs
|
|
68
|
+
* @returns The resolved value, or a Promise resolving to the value for async components
|
|
69
|
+
*/
|
|
70
|
+
resolve?(props: Props, context: RenderContext): ResolveType | Promise<ResolveType>;
|
|
71
|
+
/**
|
|
72
|
+
* Get the LLM provider from the render context.
|
|
73
|
+
*
|
|
74
|
+
* @param context - The render context
|
|
75
|
+
* @returns The LLM provider string
|
|
76
|
+
*/
|
|
77
|
+
protected getProvider(context: RenderContext): LlmProvider;
|
|
78
|
+
/**
|
|
79
|
+
* Get the appropriate delimiter based on the output format in the render context.
|
|
80
|
+
* Returns 'markdown' if the output format is markdown, otherwise 'xml'.
|
|
81
|
+
*
|
|
82
|
+
* @param context - The render context
|
|
83
|
+
* @returns The delimiter style to use
|
|
84
|
+
*/
|
|
85
|
+
protected getDelimiter(context: RenderContext): 'xml' | 'markdown' | 'none';
|
|
86
|
+
/**
|
|
87
|
+
* Check if children has meaningful content.
|
|
88
|
+
* Returns false for undefined, null, empty arrays, and empty strings.
|
|
89
|
+
*/
|
|
90
|
+
protected hasContent(children: PuptNode): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Optional: Render the component with the given props and resolved value.
|
|
93
|
+
*
|
|
94
|
+
* If the component has a resolve() method, the resolved value is passed as the
|
|
95
|
+
* second argument. For backward compatibility, components without resolve() will
|
|
96
|
+
* receive undefined as the resolved value.
|
|
97
|
+
*
|
|
98
|
+
* @param props - The properties passed to the component
|
|
99
|
+
* @param resolvedValue - The value returned by resolve(), or undefined if no resolve() method
|
|
100
|
+
* @param context - The render context containing environment and inputs
|
|
101
|
+
* @returns The rendered output as a PuptNode, or a Promise resolving to a PuptNode for async components
|
|
102
|
+
*/
|
|
103
|
+
render?(props: Props, resolvedValue: ResolveType, context: RenderContext): PuptNode | Promise<PuptNode>;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Symbol used to mark Component classes for identification
|
|
108
|
+
*/
|
|
109
|
+
declare const COMPONENT_MARKER: unique symbol;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* ComponentType can be either a class component (extending Component)
|
|
113
|
+
* or a function component.
|
|
114
|
+
*/
|
|
115
|
+
declare type ComponentType<P = Record<string, unknown>> = (new () => Component<P>) | ((props: P & {
|
|
116
|
+
children?: PuptNode;
|
|
117
|
+
}) => PuptNode);
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Environment context containing all configuration
|
|
121
|
+
*/
|
|
122
|
+
declare type EnvironmentContext = z.infer<typeof environmentContextSchema>;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Schema for the full environment context
|
|
126
|
+
*/
|
|
127
|
+
declare const environmentContextSchema: z.ZodObject<{
|
|
128
|
+
llm: z.ZodDefault<z.ZodEffects<z.ZodObject<{
|
|
129
|
+
model: z.ZodDefault<z.ZodString>;
|
|
130
|
+
provider: z.ZodDefault<z.ZodEnum<["anthropic", "openai", "google", "meta", "mistral", "deepseek", "xai", "cohere", "unspecified"]>>;
|
|
131
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
132
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
}, "strip", z.ZodTypeAny, {
|
|
134
|
+
model: string;
|
|
135
|
+
provider: "unspecified" | "anthropic" | "openai" | "google" | "meta" | "mistral" | "deepseek" | "xai" | "cohere";
|
|
136
|
+
maxTokens?: number | undefined;
|
|
137
|
+
temperature?: number | undefined;
|
|
138
|
+
}, {
|
|
139
|
+
model?: string | undefined;
|
|
140
|
+
provider?: "unspecified" | "anthropic" | "openai" | "google" | "meta" | "mistral" | "deepseek" | "xai" | "cohere" | undefined;
|
|
141
|
+
maxTokens?: number | undefined;
|
|
142
|
+
temperature?: number | undefined;
|
|
143
|
+
}>, {
|
|
144
|
+
model: string;
|
|
145
|
+
provider: "unspecified" | "anthropic" | "openai" | "google" | "meta" | "mistral" | "deepseek" | "xai" | "cohere";
|
|
146
|
+
maxTokens?: number | undefined;
|
|
147
|
+
temperature?: number | undefined;
|
|
148
|
+
}, {
|
|
149
|
+
model?: string | undefined;
|
|
150
|
+
provider?: "unspecified" | "anthropic" | "openai" | "google" | "meta" | "mistral" | "deepseek" | "xai" | "cohere" | undefined;
|
|
151
|
+
maxTokens?: number | undefined;
|
|
152
|
+
temperature?: number | undefined;
|
|
153
|
+
}>>;
|
|
154
|
+
output: z.ZodDefault<z.ZodObject<{
|
|
155
|
+
format: z.ZodDefault<z.ZodEnum<["xml", "markdown", "json", "text", "unspecified"]>>;
|
|
156
|
+
trim: z.ZodDefault<z.ZodBoolean>;
|
|
157
|
+
indent: z.ZodDefault<z.ZodString>;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
format: "unspecified" | "xml" | "markdown" | "json" | "text";
|
|
160
|
+
trim: boolean;
|
|
161
|
+
indent: string;
|
|
162
|
+
}, {
|
|
163
|
+
format?: "unspecified" | "xml" | "markdown" | "json" | "text" | undefined;
|
|
164
|
+
trim?: boolean | undefined;
|
|
165
|
+
indent?: string | undefined;
|
|
166
|
+
}>>;
|
|
167
|
+
code: z.ZodDefault<z.ZodObject<{
|
|
168
|
+
language: z.ZodDefault<z.ZodString>;
|
|
169
|
+
highlight: z.ZodOptional<z.ZodBoolean>;
|
|
170
|
+
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
language: string;
|
|
172
|
+
highlight?: boolean | undefined;
|
|
173
|
+
}, {
|
|
174
|
+
language?: string | undefined;
|
|
175
|
+
highlight?: boolean | undefined;
|
|
176
|
+
}>>;
|
|
177
|
+
user: z.ZodDefault<z.ZodObject<{
|
|
178
|
+
editor: z.ZodDefault<z.ZodString>;
|
|
179
|
+
}, "strip", z.ZodTypeAny, {
|
|
180
|
+
editor: string;
|
|
181
|
+
}, {
|
|
182
|
+
editor?: string | undefined;
|
|
183
|
+
}>>;
|
|
184
|
+
runtime: z.ZodDefault<z.ZodObject<{
|
|
185
|
+
hostname: z.ZodOptional<z.ZodString>;
|
|
186
|
+
username: z.ZodOptional<z.ZodString>;
|
|
187
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
188
|
+
platform: z.ZodOptional<z.ZodString>;
|
|
189
|
+
os: z.ZodOptional<z.ZodString>;
|
|
190
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
191
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
192
|
+
date: z.ZodOptional<z.ZodString>;
|
|
193
|
+
time: z.ZodOptional<z.ZodString>;
|
|
194
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
195
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
196
|
+
hostname: z.ZodOptional<z.ZodString>;
|
|
197
|
+
username: z.ZodOptional<z.ZodString>;
|
|
198
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
199
|
+
platform: z.ZodOptional<z.ZodString>;
|
|
200
|
+
os: z.ZodOptional<z.ZodString>;
|
|
201
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
202
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
date: z.ZodOptional<z.ZodString>;
|
|
204
|
+
time: z.ZodOptional<z.ZodString>;
|
|
205
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
206
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
207
|
+
hostname: z.ZodOptional<z.ZodString>;
|
|
208
|
+
username: z.ZodOptional<z.ZodString>;
|
|
209
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
210
|
+
platform: z.ZodOptional<z.ZodString>;
|
|
211
|
+
os: z.ZodOptional<z.ZodString>;
|
|
212
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
213
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
214
|
+
date: z.ZodOptional<z.ZodString>;
|
|
215
|
+
time: z.ZodOptional<z.ZodString>;
|
|
216
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
217
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
218
|
+
prompt: z.ZodDefault<z.ZodObject<{
|
|
219
|
+
includeRole: z.ZodDefault<z.ZodBoolean>;
|
|
220
|
+
includeFormat: z.ZodDefault<z.ZodBoolean>;
|
|
221
|
+
includeConstraints: z.ZodDefault<z.ZodBoolean>;
|
|
222
|
+
includeSuccessCriteria: z.ZodDefault<z.ZodBoolean>;
|
|
223
|
+
includeGuardrails: z.ZodDefault<z.ZodBoolean>;
|
|
224
|
+
defaultRole: z.ZodDefault<z.ZodString>;
|
|
225
|
+
defaultExpertise: z.ZodDefault<z.ZodString>;
|
|
226
|
+
delimiter: z.ZodDefault<z.ZodEnum<["xml", "markdown", "none"]>>;
|
|
227
|
+
}, "strip", z.ZodTypeAny, {
|
|
228
|
+
includeRole: boolean;
|
|
229
|
+
includeFormat: boolean;
|
|
230
|
+
includeConstraints: boolean;
|
|
231
|
+
includeSuccessCriteria: boolean;
|
|
232
|
+
includeGuardrails: boolean;
|
|
233
|
+
defaultRole: string;
|
|
234
|
+
defaultExpertise: string;
|
|
235
|
+
delimiter: "xml" | "markdown" | "none";
|
|
236
|
+
}, {
|
|
237
|
+
includeRole?: boolean | undefined;
|
|
238
|
+
includeFormat?: boolean | undefined;
|
|
239
|
+
includeConstraints?: boolean | undefined;
|
|
240
|
+
includeSuccessCriteria?: boolean | undefined;
|
|
241
|
+
includeGuardrails?: boolean | undefined;
|
|
242
|
+
defaultRole?: string | undefined;
|
|
243
|
+
defaultExpertise?: string | undefined;
|
|
244
|
+
delimiter?: "xml" | "markdown" | "none" | undefined;
|
|
245
|
+
}>>;
|
|
246
|
+
}, "strip", z.ZodTypeAny, {
|
|
247
|
+
code: {
|
|
248
|
+
language: string;
|
|
249
|
+
highlight?: boolean | undefined;
|
|
250
|
+
};
|
|
251
|
+
llm: {
|
|
252
|
+
model: string;
|
|
253
|
+
provider: "unspecified" | "anthropic" | "openai" | "google" | "meta" | "mistral" | "deepseek" | "xai" | "cohere";
|
|
254
|
+
maxTokens?: number | undefined;
|
|
255
|
+
temperature?: number | undefined;
|
|
256
|
+
};
|
|
257
|
+
output: {
|
|
258
|
+
format: "unspecified" | "xml" | "markdown" | "json" | "text";
|
|
259
|
+
trim: boolean;
|
|
260
|
+
indent: string;
|
|
261
|
+
};
|
|
262
|
+
user: {
|
|
263
|
+
editor: string;
|
|
264
|
+
};
|
|
265
|
+
runtime: {
|
|
266
|
+
hostname?: string | undefined;
|
|
267
|
+
username?: string | undefined;
|
|
268
|
+
cwd?: string | undefined;
|
|
269
|
+
platform?: string | undefined;
|
|
270
|
+
os?: string | undefined;
|
|
271
|
+
locale?: string | undefined;
|
|
272
|
+
timestamp?: number | undefined;
|
|
273
|
+
date?: string | undefined;
|
|
274
|
+
time?: string | undefined;
|
|
275
|
+
uuid?: string | undefined;
|
|
276
|
+
} & {
|
|
277
|
+
[k: string]: unknown;
|
|
278
|
+
};
|
|
279
|
+
prompt: {
|
|
280
|
+
includeRole: boolean;
|
|
281
|
+
includeFormat: boolean;
|
|
282
|
+
includeConstraints: boolean;
|
|
283
|
+
includeSuccessCriteria: boolean;
|
|
284
|
+
includeGuardrails: boolean;
|
|
285
|
+
defaultRole: string;
|
|
286
|
+
defaultExpertise: string;
|
|
287
|
+
delimiter: "xml" | "markdown" | "none";
|
|
288
|
+
};
|
|
289
|
+
}, {
|
|
290
|
+
code?: {
|
|
291
|
+
language?: string | undefined;
|
|
292
|
+
highlight?: boolean | undefined;
|
|
293
|
+
} | undefined;
|
|
294
|
+
llm?: {
|
|
295
|
+
model?: string | undefined;
|
|
296
|
+
provider?: "unspecified" | "anthropic" | "openai" | "google" | "meta" | "mistral" | "deepseek" | "xai" | "cohere" | undefined;
|
|
297
|
+
maxTokens?: number | undefined;
|
|
298
|
+
temperature?: number | undefined;
|
|
299
|
+
} | undefined;
|
|
300
|
+
output?: {
|
|
301
|
+
format?: "unspecified" | "xml" | "markdown" | "json" | "text" | undefined;
|
|
302
|
+
trim?: boolean | undefined;
|
|
303
|
+
indent?: string | undefined;
|
|
304
|
+
} | undefined;
|
|
305
|
+
user?: {
|
|
306
|
+
editor?: string | undefined;
|
|
307
|
+
} | undefined;
|
|
308
|
+
runtime?: z.objectInputType<{
|
|
309
|
+
hostname: z.ZodOptional<z.ZodString>;
|
|
310
|
+
username: z.ZodOptional<z.ZodString>;
|
|
311
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
312
|
+
platform: z.ZodOptional<z.ZodString>;
|
|
313
|
+
os: z.ZodOptional<z.ZodString>;
|
|
314
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
315
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
316
|
+
date: z.ZodOptional<z.ZodString>;
|
|
317
|
+
time: z.ZodOptional<z.ZodString>;
|
|
318
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
319
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
320
|
+
prompt?: {
|
|
321
|
+
includeRole?: boolean | undefined;
|
|
322
|
+
includeFormat?: boolean | undefined;
|
|
323
|
+
includeConstraints?: boolean | undefined;
|
|
324
|
+
includeSuccessCriteria?: boolean | undefined;
|
|
325
|
+
includeGuardrails?: boolean | undefined;
|
|
326
|
+
defaultRole?: string | undefined;
|
|
327
|
+
defaultExpertise?: string | undefined;
|
|
328
|
+
delimiter?: "xml" | "markdown" | "none" | undefined;
|
|
329
|
+
} | undefined;
|
|
330
|
+
}>;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Fragment symbol for grouping elements without a wrapper
|
|
334
|
+
*/
|
|
335
|
+
export declare const Fragment: unique symbol;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Create a JSX element with a single child.
|
|
339
|
+
* Called by the JSX transform for elements with one child.
|
|
340
|
+
*
|
|
341
|
+
* @param type - Element type (string tag, symbol like Fragment, or component)
|
|
342
|
+
* @param props - Properties including children
|
|
343
|
+
* @returns A PuptElement
|
|
344
|
+
*/
|
|
345
|
+
export declare function jsx<P extends Record<string, unknown>>(type: string | symbol | ComponentType<P>, props: P & {
|
|
346
|
+
children?: PuptNode;
|
|
347
|
+
}): PuptElement<P>;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Create a JSX element with multiple children.
|
|
351
|
+
* Called by the JSX transform for elements with multiple children.
|
|
352
|
+
* Implementation is the same as jsx since we normalize children either way.
|
|
353
|
+
*
|
|
354
|
+
* @param type - Element type (string tag, symbol like Fragment, or component)
|
|
355
|
+
* @param props - Properties including children array
|
|
356
|
+
* @returns A PuptElement
|
|
357
|
+
*/
|
|
358
|
+
export declare function jsxs<P extends Record<string, unknown>>(type: string | symbol | ComponentType<P>, props: P & {
|
|
359
|
+
children?: PuptNode;
|
|
360
|
+
}): PuptElement<P>;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Known LLM providers (model creators, not hosting platforms).
|
|
364
|
+
* Hosting platforms like AWS Bedrock and Azure are not included here
|
|
365
|
+
* because the provider represents who created the model, which determines
|
|
366
|
+
* the prompt optimization strategy.
|
|
367
|
+
*/
|
|
368
|
+
declare const LLM_PROVIDERS: readonly ["anthropic", "openai", "google", "meta", "mistral", "deepseek", "xai", "cohere", "unspecified"];
|
|
369
|
+
|
|
370
|
+
declare type LlmProvider = typeof LLM_PROVIDERS[number];
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Action to open a URL in a browser
|
|
374
|
+
*/
|
|
375
|
+
declare interface OpenUrlAction {
|
|
376
|
+
type: 'openUrl';
|
|
377
|
+
url: string;
|
|
378
|
+
browser?: string;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Actions to be executed after the LLM response
|
|
383
|
+
*/
|
|
384
|
+
declare type PostExecutionAction = ReviewFileAction | OpenUrlAction | RunCommandAction;
|
|
385
|
+
|
|
386
|
+
/** Symbol for element props */
|
|
387
|
+
declare const PROPS: unique symbol;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* PuptElement represents a JSX element in the pupt-lib tree.
|
|
391
|
+
* Uses symbols for internal properties to prevent collision with property access.
|
|
392
|
+
*/
|
|
393
|
+
declare interface PuptElement<P = Record<string, unknown>> {
|
|
394
|
+
[TYPE]: string | symbol | ComponentType<P>;
|
|
395
|
+
[PROPS]: P;
|
|
396
|
+
[CHILDREN]: PuptNode[];
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* PuptNode represents any valid child of a JSX element.
|
|
401
|
+
* Can be primitives, elements, or arrays of nodes.
|
|
402
|
+
*/
|
|
403
|
+
declare type PuptNode = string | number | boolean | null | undefined | PuptElement | PuptNode[];
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Render context passed to components during rendering
|
|
407
|
+
*/
|
|
408
|
+
declare interface RenderContext {
|
|
409
|
+
inputs: Map<string, unknown>;
|
|
410
|
+
env: EnvironmentContext;
|
|
411
|
+
postExecution: PostExecutionAction[];
|
|
412
|
+
errors: RenderError[];
|
|
413
|
+
metadata: Map<string, unknown>;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* A validation or runtime error encountered during rendering
|
|
418
|
+
*/
|
|
419
|
+
declare interface RenderError {
|
|
420
|
+
/** Component class name or registry name, e.g. "Section" */
|
|
421
|
+
component: string;
|
|
422
|
+
/** The specific prop that failed validation, or null for cross-field/runtime errors */
|
|
423
|
+
prop: string | null;
|
|
424
|
+
/** Human-readable error message */
|
|
425
|
+
message: string;
|
|
426
|
+
/** Error code (Zod issue code or 'runtime_error' / 'missing_schema') */
|
|
427
|
+
code: string;
|
|
428
|
+
/** Path within the props object */
|
|
429
|
+
path: (string | number)[];
|
|
430
|
+
/** The value that was received */
|
|
431
|
+
received?: unknown;
|
|
432
|
+
/** The expected type or constraint */
|
|
433
|
+
expected?: string;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Action to open a file for review in an editor
|
|
438
|
+
*/
|
|
439
|
+
declare interface ReviewFileAction {
|
|
440
|
+
type: 'reviewFile';
|
|
441
|
+
file: string;
|
|
442
|
+
editor?: string;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Action to execute a shell command
|
|
447
|
+
*/
|
|
448
|
+
declare interface RunCommandAction {
|
|
449
|
+
type: 'runCommand';
|
|
450
|
+
command: string;
|
|
451
|
+
cwd?: string;
|
|
452
|
+
env?: Record<string, string>;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/** Symbol for element type */
|
|
456
|
+
declare const TYPE: unique symbol;
|
|
457
|
+
|
|
458
|
+
export { }
|