@positronic/core 0.0.77 → 0.0.78
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/dist/src/dsl/brain-runner.js +37 -182
- package/dist/src/dsl/brain-state-machine.js +58 -112
- package/dist/src/dsl/brain.js +1 -0
- package/dist/src/dsl/builder/brain.js +250 -412
- package/dist/src/dsl/builder/continuation.js +67 -0
- package/dist/src/dsl/constants.js +16 -17
- package/dist/src/dsl/create-brain.js +29 -45
- package/dist/src/dsl/example-webhook.js +1 -1
- package/dist/src/dsl/execution/constants.js +0 -4
- package/dist/src/dsl/execution/event-channel.js +77 -0
- package/dist/src/dsl/execution/event-stream.js +1625 -1474
- package/dist/src/dsl/signal-validation.js +0 -1
- package/dist/src/dsl/webhook.js +4 -1
- package/dist/src/files/event-wrapper.js +268 -0
- package/dist/src/files/index.js +1 -0
- package/dist/src/files/mime.js +31 -0
- package/dist/src/files/types.js +13 -0
- package/dist/src/index.js +10 -3
- package/dist/src/jsx-runtime.js +49 -0
- package/dist/src/memory/{scoped-memory.js → create-memory.js} +5 -5
- package/dist/src/plugins/collect-webhooks.js +49 -0
- package/dist/src/plugins/define-plugin.js +15 -0
- package/dist/src/plugins/index.js +1 -0
- package/dist/src/plugins/types.js +4 -0
- package/dist/src/store/types.js +2 -3
- package/dist/src/template/render-html.js +282 -0
- package/dist/src/template/render.js +357 -0
- package/dist/src/tools/index.js +88 -27
- package/dist/src/ui/generate-page-html.js +6 -6
- package/dist/src/ui/{generate-ui.js → generate-page.js} +24 -12
- package/dist/src/ui/parse-form-data.js +1 -11
- package/dist/src/ui/types.js +0 -123
- package/dist/src/yaml/data-validator.js +0 -27
- package/dist/src/yaml/type-inference.js +10 -9
- package/dist/types/clients/types.d.ts +15 -5
- package/dist/types/clients/types.d.ts.map +1 -1
- package/dist/types/dsl/brain-runner.d.ts +9 -14
- package/dist/types/dsl/brain-runner.d.ts.map +1 -1
- package/dist/types/dsl/brain-state-machine.d.ts +18 -28
- package/dist/types/dsl/brain-state-machine.d.ts.map +1 -1
- package/dist/types/dsl/brain.d.ts +3 -2
- package/dist/types/dsl/brain.d.ts.map +1 -1
- package/dist/types/dsl/builder/brain.d.ts +85 -228
- package/dist/types/dsl/builder/brain.d.ts.map +1 -1
- package/dist/types/dsl/builder/continuation.d.ts +16 -0
- package/dist/types/dsl/builder/continuation.d.ts.map +1 -0
- package/dist/types/dsl/constants.d.ts +12 -12
- package/dist/types/dsl/constants.d.ts.map +1 -1
- package/dist/types/dsl/create-brain.d.ts +17 -57
- package/dist/types/dsl/create-brain.d.ts.map +1 -1
- package/dist/types/dsl/definitions/blocks.d.ts +67 -66
- package/dist/types/dsl/definitions/blocks.d.ts.map +1 -1
- package/dist/types/dsl/definitions/brain-types.d.ts +8 -11
- package/dist/types/dsl/definitions/brain-types.d.ts.map +1 -1
- package/dist/types/dsl/definitions/events.d.ts +61 -56
- package/dist/types/dsl/definitions/events.d.ts.map +1 -1
- package/dist/types/dsl/definitions/run-params.d.ts +20 -21
- package/dist/types/dsl/definitions/run-params.d.ts.map +1 -1
- package/dist/types/dsl/definitions/steps.d.ts +1 -1
- package/dist/types/dsl/definitions/steps.d.ts.map +1 -1
- package/dist/types/dsl/example-webhook.d.ts +3 -3
- package/dist/types/dsl/example-webhook.d.ts.map +1 -1
- package/dist/types/dsl/execution/constants.d.ts +0 -5
- package/dist/types/dsl/execution/constants.d.ts.map +1 -1
- package/dist/types/dsl/execution/event-channel.d.ts +16 -0
- package/dist/types/dsl/execution/event-channel.d.ts.map +1 -0
- package/dist/types/dsl/execution/event-stream.d.ts +46 -34
- package/dist/types/dsl/execution/event-stream.d.ts.map +1 -1
- package/dist/types/dsl/signal-validation.d.ts.map +1 -1
- package/dist/types/dsl/types.d.ts +21 -83
- package/dist/types/dsl/types.d.ts.map +1 -1
- package/dist/types/dsl/webhook.d.ts +12 -2
- package/dist/types/dsl/webhook.d.ts.map +1 -1
- package/dist/types/files/event-wrapper.d.ts +20 -0
- package/dist/types/files/event-wrapper.d.ts.map +1 -0
- package/dist/types/files/index.d.ts +2 -0
- package/dist/types/files/index.d.ts.map +1 -0
- package/dist/types/files/mime.d.ts +2 -0
- package/dist/types/files/mime.d.ts.map +1 -0
- package/dist/types/files/types.d.ts +88 -0
- package/dist/types/files/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +22 -13
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/jsx-runtime.d.ts +35 -0
- package/dist/types/jsx-runtime.d.ts.map +1 -0
- package/dist/types/memory/{scoped-memory.d.ts → create-memory.d.ts} +7 -7
- package/dist/types/memory/create-memory.d.ts.map +1 -0
- package/dist/types/memory/types.d.ts +4 -4
- package/dist/types/memory/types.d.ts.map +1 -1
- package/dist/types/plugins/collect-webhooks.d.ts +8 -0
- package/dist/types/plugins/collect-webhooks.d.ts.map +1 -0
- package/dist/types/plugins/define-plugin.d.ts +25 -0
- package/dist/types/plugins/define-plugin.d.ts.map +1 -0
- package/dist/types/plugins/index.d.ts +3 -0
- package/dist/types/plugins/index.d.ts.map +1 -0
- package/dist/types/plugins/types.d.ts +83 -0
- package/dist/types/plugins/types.d.ts.map +1 -0
- package/dist/types/store/index.d.ts +1 -1
- package/dist/types/store/index.d.ts.map +1 -1
- package/dist/types/store/types.d.ts +0 -8
- package/dist/types/store/types.d.ts.map +1 -1
- package/dist/types/template/render-html.d.ts +9 -0
- package/dist/types/template/render-html.d.ts.map +1 -0
- package/dist/types/template/render.d.ts +15 -0
- package/dist/types/template/render.d.ts.map +1 -0
- package/dist/types/tools/index.d.ts +39 -27
- package/dist/types/tools/index.d.ts.map +1 -1
- package/dist/types/ui/generate-page-html.d.ts +4 -6
- package/dist/types/ui/generate-page-html.d.ts.map +1 -1
- package/dist/types/ui/{generate-ui.d.ts → generate-page.d.ts} +6 -6
- package/dist/types/ui/generate-page.d.ts.map +1 -0
- package/dist/types/ui/parse-form-data.d.ts +1 -5
- package/dist/types/ui/parse-form-data.d.ts.map +1 -1
- package/dist/types/ui/types.d.ts +0 -49
- package/dist/types/ui/types.d.ts.map +1 -1
- package/dist/types/yaml/data-validator.d.ts +0 -5
- package/dist/types/yaml/data-validator.d.ts.map +1 -1
- package/dist/types/yaml/type-inference.d.ts +4 -2
- package/dist/types/yaml/type-inference.d.ts.map +1 -1
- package/dist/types/yaml/types.d.ts +0 -1
- package/dist/types/yaml/types.d.ts.map +1 -1
- package/package.json +5 -1
- package/dist/src/dsl/agent-messages.js +0 -5
- package/dist/src/ui/validate-form.js +0 -428
- package/dist/types/dsl/agent-messages.d.ts +0 -12
- package/dist/types/dsl/agent-messages.d.ts.map +0 -1
- package/dist/types/memory/scoped-memory.d.ts.map +0 -1
- package/dist/types/ui/generate-ui.d.ts.map +0 -1
- package/dist/types/ui/validate-form.d.ts +0 -45
- package/dist/types/ui/validate-form.d.ts.map +0 -1
package/dist/types/ui/types.d.ts
CHANGED
|
@@ -14,55 +14,6 @@ export interface Placement {
|
|
|
14
14
|
/** Parent placement ID, null for root components */
|
|
15
15
|
parentId: string | null;
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Represents the inferred type of a data value.
|
|
19
|
-
* Used for validating data bindings against the provided data.
|
|
20
|
-
*/
|
|
21
|
-
export type DataType = {
|
|
22
|
-
kind: 'primitive';
|
|
23
|
-
type: 'string' | 'number' | 'boolean' | 'null';
|
|
24
|
-
} | {
|
|
25
|
-
kind: 'array';
|
|
26
|
-
elementType: DataType;
|
|
27
|
-
} | {
|
|
28
|
-
kind: 'object';
|
|
29
|
-
properties: Record<string, DataType>;
|
|
30
|
-
} | {
|
|
31
|
-
kind: 'unknown';
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Infer the DataType from a sample value.
|
|
35
|
-
*/
|
|
36
|
-
export declare function inferDataType(value: unknown): DataType;
|
|
37
|
-
/**
|
|
38
|
-
* A validation error from ValidateForm.
|
|
39
|
-
*/
|
|
40
|
-
export interface ValidationError {
|
|
41
|
-
type: 'form-schema-mismatch' | 'invalid-binding' | 'unknown-component' | 'missing-prop';
|
|
42
|
-
message: string;
|
|
43
|
-
path?: string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Result of validation.
|
|
47
|
-
*/
|
|
48
|
-
export interface ValidationResult {
|
|
49
|
-
valid: boolean;
|
|
50
|
-
errors: ValidationError[];
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Extracted form field info.
|
|
54
|
-
*/
|
|
55
|
-
export interface ExtractedFormField {
|
|
56
|
-
name: string;
|
|
57
|
-
type: 'string' | 'number' | 'boolean' | 'string[]' | 'number[]';
|
|
58
|
-
insideLoop: boolean;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* The extracted form schema from placements.
|
|
62
|
-
*/
|
|
63
|
-
export interface ExtractedFormSchema {
|
|
64
|
-
fields: ExtractedFormField[];
|
|
65
|
-
}
|
|
66
17
|
/**
|
|
67
18
|
* A UI component that can be used by the LLM to build pages.
|
|
68
19
|
* Combines a React component with metadata for the LLM.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ui/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,oDAAoD;IACpD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAMD
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ui/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAA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oopDataContext = Map<string, unknown>;
|
|
|
44
44
|
* @returns The resolved value, or undefined if the path doesn't resolve
|
|
45
45
|
*/
|
|
46
46
|
export declare function resolvePathValue(path: string, rootData: Record<string, unknown>, loopDataContext: LoopDataContext): unknown;
|
|
47
|
-
/**
|
|
48
|
-
* Summarize a value for LLM consumption.
|
|
49
|
-
* Keeps output compact — no full data dumps.
|
|
50
|
-
*/
|
|
51
|
-
export declare function summarizeValue(value: unknown): string;
|
|
52
47
|
/**
|
|
53
48
|
* Walk the ComponentNode tree and resolve every binding against real data.
|
|
54
49
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-validator.d.ts","sourceRoot":"","sources":["../../../src/yaml/data-validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACR,eAAe,EAEf,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,KAAK,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEzC;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAkCtD;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,GACvB,QAAQ,GAAG,IAAI,CA+BjB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,QAAQ,GACjB,gBAAgB,CA6DlB;AAED;;GAEG;AACH,KAAK,eAAe,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5C;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAkCT;AAED
|
|
1
|
+
{"version":3,"file":"data-validator.d.ts","sourceRoot":"","sources":["../../../src/yaml/data-validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACR,eAAe,EAEf,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,KAAK,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEzC;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAkCtD;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,GACvB,QAAQ,GAAG,IAAI,CA+BjB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,QAAQ,GACjB,gBAAgB,CA6DlB;AAED;;GAEG;AACH,KAAK,eAAe,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5C;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAkCT;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,eAAe,EAAE,CA+DnB"}
|
|
@@ -17,7 +17,7 @@ export declare function inferTypeDescription(value: unknown): string;
|
|
|
17
17
|
* @param indent - Current indentation level
|
|
18
18
|
* @returns Multi-line string describing the type with examples
|
|
19
19
|
*/
|
|
20
|
-
export declare function inferTypeWithExamples(value: unknown, indent?: number): string;
|
|
20
|
+
export declare function inferTypeWithExamples(value: unknown, indent?: number, includeExamples?: boolean): string;
|
|
21
21
|
/**
|
|
22
22
|
* Describe the shape of data in a readable TypeScript-like format.
|
|
23
23
|
* This is the main entry point for generating data descriptions for the LLM.
|
|
@@ -46,5 +46,7 @@ export declare function inferTypeWithExamples(value: unknown, indent?: number):
|
|
|
46
46
|
* // }
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
|
-
export declare function describeDataShape(data: Record<string, unknown
|
|
49
|
+
export declare function describeDataShape(data: Record<string, unknown>, options?: {
|
|
50
|
+
includeExamples?: boolean;
|
|
51
|
+
}): string;
|
|
50
52
|
//# sourceMappingURL=type-inference.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-inference.d.ts","sourceRoot":"","sources":["../../../src/yaml/type-inference.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAkC3D;AA+BD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"type-inference.d.ts","sourceRoot":"","sources":["../../../src/yaml/type-inference.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAkC3D;AA+BD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,EACd,MAAM,SAAI,EACV,eAAe,UAAO,GACrB,MAAM,CAwER;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,GACtC,MAAM,CAER"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/yaml/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CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAChB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAA;CAAE,GACrE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,QAAQ,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positronic/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.78",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
".": {
|
|
18
18
|
"types": "./dist/types/index.d.ts",
|
|
19
19
|
"import": "./dist/src/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./jsx-runtime": {
|
|
22
|
+
"types": "./dist/types/jsx-runtime.d.ts",
|
|
23
|
+
"import": "./dist/src/jsx-runtime.js"
|
|
20
24
|
}
|
|
21
25
|
},
|
|
22
26
|
"scripts": {
|
|
@@ -1,428 +0,0 @@
|
|
|
1
|
-
function _array_like_to_array(arr, len) {
|
|
2
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
-
return arr2;
|
|
5
|
-
}
|
|
6
|
-
function _array_with_holes(arr) {
|
|
7
|
-
if (Array.isArray(arr)) return arr;
|
|
8
|
-
}
|
|
9
|
-
function _array_without_holes(arr) {
|
|
10
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
|
-
}
|
|
12
|
-
function _instanceof(left, right) {
|
|
13
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
14
|
-
return !!right[Symbol.hasInstance](left);
|
|
15
|
-
} else {
|
|
16
|
-
return left instanceof right;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function _iterable_to_array(iter) {
|
|
20
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
21
|
-
}
|
|
22
|
-
function _iterable_to_array_limit(arr, i) {
|
|
23
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
24
|
-
if (_i == null) return;
|
|
25
|
-
var _arr = [];
|
|
26
|
-
var _n = true;
|
|
27
|
-
var _d = false;
|
|
28
|
-
var _s, _e;
|
|
29
|
-
try {
|
|
30
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
31
|
-
_arr.push(_s.value);
|
|
32
|
-
if (i && _arr.length === i) break;
|
|
33
|
-
}
|
|
34
|
-
} catch (err) {
|
|
35
|
-
_d = true;
|
|
36
|
-
_e = err;
|
|
37
|
-
} finally{
|
|
38
|
-
try {
|
|
39
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
40
|
-
} finally{
|
|
41
|
-
if (_d) throw _e;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return _arr;
|
|
45
|
-
}
|
|
46
|
-
function _non_iterable_rest() {
|
|
47
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
48
|
-
}
|
|
49
|
-
function _non_iterable_spread() {
|
|
50
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
51
|
-
}
|
|
52
|
-
function _sliced_to_array(arr, i) {
|
|
53
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
54
|
-
}
|
|
55
|
-
function _to_consumable_array(arr) {
|
|
56
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
57
|
-
}
|
|
58
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
59
|
-
if (!o) return;
|
|
60
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
61
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
62
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
63
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
64
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
65
|
-
}
|
|
66
|
-
import { z } from 'zod';
|
|
67
|
-
import { inferDataType } from './types.js';
|
|
68
|
-
// ============================================
|
|
69
|
-
// BINDING UTILITIES
|
|
70
|
-
// ============================================
|
|
71
|
-
/**
|
|
72
|
-
* Check if a value is a binding expression like "{{path}}".
|
|
73
|
-
*/ export function isBinding(value) {
|
|
74
|
-
return typeof value === 'string' && value.startsWith('{{') && value.endsWith('}}');
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Extract the path from a binding expression.
|
|
78
|
-
* "{{email.subject}}" -> "email.subject"
|
|
79
|
-
*/ export function extractBindingPath(binding) {
|
|
80
|
-
return binding.slice(2, -2).trim();
|
|
81
|
-
}
|
|
82
|
-
// ============================================
|
|
83
|
-
// DATA BINDING VALIDATION
|
|
84
|
-
// ============================================
|
|
85
|
-
/**
|
|
86
|
-
* Components that create loop contexts.
|
|
87
|
-
* Children of these components can reference the loop variable.
|
|
88
|
-
*/ var LOOP_COMPONENTS = {
|
|
89
|
-
List: {
|
|
90
|
-
itemsProp: 'items',
|
|
91
|
-
asProp: 'as',
|
|
92
|
-
defaultAs: 'item'
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Resolve a path like "email.subject" against a DataType.
|
|
97
|
-
* Returns the type at that path, or null if invalid.
|
|
98
|
-
*/ function resolvePathType(path, rootType, loopContext) {
|
|
99
|
-
var parts = path.split('.');
|
|
100
|
-
// Check if the first part is a loop variable
|
|
101
|
-
var loopVar = loopContext.get(parts[0]);
|
|
102
|
-
if (loopVar) {
|
|
103
|
-
if (parts.length === 1) {
|
|
104
|
-
return loopVar;
|
|
105
|
-
}
|
|
106
|
-
return resolvePathInType(parts.slice(1), loopVar);
|
|
107
|
-
}
|
|
108
|
-
return resolvePathInType(parts, rootType);
|
|
109
|
-
}
|
|
110
|
-
function resolvePathInType(parts, type) {
|
|
111
|
-
var current = type;
|
|
112
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
113
|
-
try {
|
|
114
|
-
for(var _iterator = parts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
115
|
-
var part = _step.value;
|
|
116
|
-
if (current.kind === 'object') {
|
|
117
|
-
var prop = current.properties[part];
|
|
118
|
-
if (!prop) {
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
current = prop;
|
|
122
|
-
} else if (current.kind === 'array') {
|
|
123
|
-
// Accessing array by index
|
|
124
|
-
if (/^\d+$/.test(part)) {
|
|
125
|
-
current = current.elementType;
|
|
126
|
-
} else {
|
|
127
|
-
// Trying to access a property on an array - invalid
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
} else {
|
|
131
|
-
// Trying to access a property on a primitive
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
} catch (err) {
|
|
136
|
-
_didIteratorError = true;
|
|
137
|
-
_iteratorError = err;
|
|
138
|
-
} finally{
|
|
139
|
-
try {
|
|
140
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
141
|
-
_iterator.return();
|
|
142
|
-
}
|
|
143
|
-
} finally{
|
|
144
|
-
if (_didIteratorError) {
|
|
145
|
-
throw _iteratorError;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return current;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Get the loop context for a placement by walking up the parent chain.
|
|
153
|
-
*/ function getLoopContext(placement, placements, dataType) {
|
|
154
|
-
var context = new Map();
|
|
155
|
-
var current = placement;
|
|
156
|
-
while(current && current.parentId){
|
|
157
|
-
var parent = placements.find(function(p) {
|
|
158
|
-
return p.id === current.parentId;
|
|
159
|
-
});
|
|
160
|
-
if (!parent) break;
|
|
161
|
-
var loopConfig = LOOP_COMPONENTS[parent.component];
|
|
162
|
-
if (loopConfig) {
|
|
163
|
-
var itemsProp = parent.props[loopConfig.itemsProp];
|
|
164
|
-
var asProp = parent.props[loopConfig.asProp];
|
|
165
|
-
if (isBinding(itemsProp)) {
|
|
166
|
-
var itemsPath = extractBindingPath(itemsProp);
|
|
167
|
-
var itemsType = resolvePathType(itemsPath, dataType, context);
|
|
168
|
-
if (itemsType && itemsType.kind === 'array') {
|
|
169
|
-
var loopVarName = typeof asProp === 'string' ? asProp : loopConfig.defaultAs;
|
|
170
|
-
context.set(loopVarName, itemsType.elementType);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
current = parent;
|
|
175
|
-
}
|
|
176
|
-
return context;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Check if a placement is inside a loop component.
|
|
180
|
-
*/ function isInsideLoop(placement, placements) {
|
|
181
|
-
var current = placement;
|
|
182
|
-
while(current && current.parentId){
|
|
183
|
-
var parent = placements.find(function(p) {
|
|
184
|
-
return p.id === current.parentId;
|
|
185
|
-
});
|
|
186
|
-
if (!parent) break;
|
|
187
|
-
if (LOOP_COMPONENTS[parent.component]) {
|
|
188
|
-
return true;
|
|
189
|
-
}
|
|
190
|
-
current = parent;
|
|
191
|
-
}
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Validate all data bindings in placements against the provided data type.
|
|
196
|
-
*/ export function validateDataBindings(placements, data) {
|
|
197
|
-
var dataType = inferDataType(data);
|
|
198
|
-
var errors = [];
|
|
199
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
200
|
-
try {
|
|
201
|
-
for(var _iterator = placements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
202
|
-
var placement = _step.value;
|
|
203
|
-
var loopContext = getLoopContext(placement, placements, dataType);
|
|
204
|
-
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
205
|
-
try {
|
|
206
|
-
for(var _iterator1 = Object.entries(placement.props)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
207
|
-
var _step_value = _sliced_to_array(_step1.value, 2), propName = _step_value[0], propValue = _step_value[1];
|
|
208
|
-
if (isBinding(propValue)) {
|
|
209
|
-
var path = extractBindingPath(propValue);
|
|
210
|
-
var resolved = resolvePathType(path, dataType, loopContext);
|
|
211
|
-
if (resolved === null) {
|
|
212
|
-
errors.push({
|
|
213
|
-
type: 'invalid-binding',
|
|
214
|
-
message: 'Invalid binding "{{'.concat(path, '}}" - path does not exist in data'),
|
|
215
|
-
path: "".concat(placement.component, ".").concat(propName)
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
} catch (err) {
|
|
221
|
-
_didIteratorError1 = true;
|
|
222
|
-
_iteratorError1 = err;
|
|
223
|
-
} finally{
|
|
224
|
-
try {
|
|
225
|
-
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
226
|
-
_iterator1.return();
|
|
227
|
-
}
|
|
228
|
-
} finally{
|
|
229
|
-
if (_didIteratorError1) {
|
|
230
|
-
throw _iteratorError1;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
} catch (err) {
|
|
236
|
-
_didIteratorError = true;
|
|
237
|
-
_iteratorError = err;
|
|
238
|
-
} finally{
|
|
239
|
-
try {
|
|
240
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
241
|
-
_iterator.return();
|
|
242
|
-
}
|
|
243
|
-
} finally{
|
|
244
|
-
if (_didIteratorError) {
|
|
245
|
-
throw _iteratorError;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
return {
|
|
250
|
-
valid: errors.length === 0,
|
|
251
|
-
errors: errors
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
// ============================================
|
|
255
|
-
// FORM SCHEMA EXTRACTION
|
|
256
|
-
// ============================================
|
|
257
|
-
/**
|
|
258
|
-
* Components that contribute form fields.
|
|
259
|
-
* Maps component name -> how to extract field info.
|
|
260
|
-
*/ var FORM_COMPONENTS = {
|
|
261
|
-
Input: {
|
|
262
|
-
nameProp: 'name',
|
|
263
|
-
fieldType: 'string'
|
|
264
|
-
},
|
|
265
|
-
TextArea: {
|
|
266
|
-
nameProp: 'name',
|
|
267
|
-
fieldType: 'string'
|
|
268
|
-
},
|
|
269
|
-
Checkbox: {
|
|
270
|
-
nameProp: 'name',
|
|
271
|
-
fieldType: 'boolean'
|
|
272
|
-
},
|
|
273
|
-
Select: {
|
|
274
|
-
nameProp: 'name',
|
|
275
|
-
fieldType: 'string'
|
|
276
|
-
},
|
|
277
|
-
MultiTextInput: {
|
|
278
|
-
nameProp: 'name',
|
|
279
|
-
fieldType: 'string[]'
|
|
280
|
-
},
|
|
281
|
-
HiddenInput: {
|
|
282
|
-
nameProp: 'name',
|
|
283
|
-
fieldType: 'string'
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
/**
|
|
287
|
-
* Extract form schema from placements.
|
|
288
|
-
* Finds all form input components and extracts their field info.
|
|
289
|
-
*/ export function extractFormSchema(placements) {
|
|
290
|
-
var fields = [];
|
|
291
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
292
|
-
try {
|
|
293
|
-
var _loop = function() {
|
|
294
|
-
var placement = _step.value;
|
|
295
|
-
var formComponent = FORM_COMPONENTS[placement.component];
|
|
296
|
-
if (formComponent) {
|
|
297
|
-
var nameProp = placement.props[formComponent.nameProp];
|
|
298
|
-
if (typeof nameProp === 'string') {
|
|
299
|
-
var fieldType = formComponent.fieldType;
|
|
300
|
-
// Special handling for Checkbox: if it has a value prop, it returns that string value
|
|
301
|
-
if (placement.component === 'Checkbox' && placement.props.value !== undefined) {
|
|
302
|
-
fieldType = 'string';
|
|
303
|
-
}
|
|
304
|
-
var insideLoop = isInsideLoop(placement, placements);
|
|
305
|
-
// If inside a loop and it's a single value type, it becomes an array
|
|
306
|
-
if (insideLoop && !fieldType.endsWith('[]')) {
|
|
307
|
-
fieldType = "".concat(fieldType, "[]");
|
|
308
|
-
}
|
|
309
|
-
// Check if we already have this field (e.g., multiple checkboxes with same name)
|
|
310
|
-
var existing = fields.find(function(f) {
|
|
311
|
-
return f.name === nameProp;
|
|
312
|
-
});
|
|
313
|
-
if (existing) {
|
|
314
|
-
// Multiple fields with same name = array
|
|
315
|
-
if (!existing.type.endsWith('[]')) {
|
|
316
|
-
existing.type = "".concat(existing.type, "[]");
|
|
317
|
-
}
|
|
318
|
-
} else {
|
|
319
|
-
fields.push({
|
|
320
|
-
name: nameProp,
|
|
321
|
-
type: fieldType,
|
|
322
|
-
insideLoop: insideLoop
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
for(var _iterator = placements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
329
|
-
} catch (err) {
|
|
330
|
-
_didIteratorError = true;
|
|
331
|
-
_iteratorError = err;
|
|
332
|
-
} finally{
|
|
333
|
-
try {
|
|
334
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
335
|
-
_iterator.return();
|
|
336
|
-
}
|
|
337
|
-
} finally{
|
|
338
|
-
if (_didIteratorError) {
|
|
339
|
-
throw _iteratorError;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
return {
|
|
344
|
-
fields: fields
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Validate extracted form schema against a Zod schema.
|
|
349
|
-
*/ export function validateAgainstZod(extracted, zodSchema) {
|
|
350
|
-
var errors = [];
|
|
351
|
-
// Get the shape from the Zod schema
|
|
352
|
-
var shape = zodSchema.shape;
|
|
353
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
354
|
-
try {
|
|
355
|
-
var _loop = function() {
|
|
356
|
-
var _step_value = _sliced_to_array(_step.value, 2), fieldName = _step_value[0], fieldSchema = _step_value[1];
|
|
357
|
-
var isOptional = _instanceof(fieldSchema, z.ZodOptional);
|
|
358
|
-
var extractedField = extracted.fields.find(function(f) {
|
|
359
|
-
return f.name === fieldName;
|
|
360
|
-
});
|
|
361
|
-
if (!isOptional && !extractedField) {
|
|
362
|
-
errors.push({
|
|
363
|
-
type: 'form-schema-mismatch',
|
|
364
|
-
message: "Missing required field: ".concat(fieldName),
|
|
365
|
-
path: fieldName
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
// Check each schema field has a matching form field
|
|
370
|
-
for(var _iterator = Object.entries(shape)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
371
|
-
} catch (err) {
|
|
372
|
-
_didIteratorError = true;
|
|
373
|
-
_iteratorError = err;
|
|
374
|
-
} finally{
|
|
375
|
-
try {
|
|
376
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
377
|
-
_iterator.return();
|
|
378
|
-
}
|
|
379
|
-
} finally{
|
|
380
|
-
if (_didIteratorError) {
|
|
381
|
-
throw _iteratorError;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
return {
|
|
386
|
-
valid: errors.length === 0,
|
|
387
|
-
errors: errors
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Create the ValidateForm tool for the UI generation agent.
|
|
392
|
-
* Validates both form schema and data bindings.
|
|
393
|
-
*/ export function createValidateFormTool(placements, schema, data) {
|
|
394
|
-
return {
|
|
395
|
-
description: "Validate the current form structure. Checks that:\n1. Form fields will produce data matching the expected schema\n2. All data bindings (like {{email.subject}}) reference valid paths in the provided data\nCall this after building your form to verify it's correct.",
|
|
396
|
-
inputSchema: z.object({}),
|
|
397
|
-
execute: function() {
|
|
398
|
-
var _errors;
|
|
399
|
-
var errors = [];
|
|
400
|
-
// 1. Extract form schema from placements
|
|
401
|
-
var extracted = extractFormSchema(placements);
|
|
402
|
-
// 2. Validate against expected Zod schema (if provided)
|
|
403
|
-
if (schema) {
|
|
404
|
-
var _errors1;
|
|
405
|
-
var schemaResult = validateAgainstZod(extracted, schema);
|
|
406
|
-
(_errors1 = errors).push.apply(_errors1, _to_consumable_array(schemaResult.errors));
|
|
407
|
-
}
|
|
408
|
-
// 3. Validate all data bindings
|
|
409
|
-
var bindingResult = validateDataBindings(placements, data);
|
|
410
|
-
(_errors = errors).push.apply(_errors, _to_consumable_array(bindingResult.errors));
|
|
411
|
-
return {
|
|
412
|
-
valid: errors.length === 0,
|
|
413
|
-
errors: errors.map(function(e) {
|
|
414
|
-
return {
|
|
415
|
-
type: e.type,
|
|
416
|
-
message: e.message
|
|
417
|
-
};
|
|
418
|
-
}),
|
|
419
|
-
extractedFields: extracted.fields.map(function(f) {
|
|
420
|
-
return {
|
|
421
|
-
name: f.name,
|
|
422
|
-
type: f.type
|
|
423
|
-
};
|
|
424
|
-
})
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
};
|
|
428
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { JsonObject } from './types.js';
|
|
2
|
-
import type { AgentContext } from './brain-state-machine.js';
|
|
3
|
-
/**
|
|
4
|
-
* Context for resuming an agent execution.
|
|
5
|
-
* Extends the state machine's AgentContext with an optional webhook response.
|
|
6
|
-
* The webhook response is only present when resuming from a webhook (vs a pause).
|
|
7
|
-
*/
|
|
8
|
-
export interface AgentResumeContext extends AgentContext {
|
|
9
|
-
/** The raw webhook response - only present for webhook resume, not pause resume */
|
|
10
|
-
webhookResponse?: JsonObject;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=agent-messages.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-messages.d.ts","sourceRoot":"","sources":["../../../src/dsl/agent-messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,mFAAmF;IACnF,eAAe,CAAC,EAAE,UAAU,CAAC;CAC9B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scoped-memory.d.ts","sourceRoot":"","sources":["../../../src/memory/scoped-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EAKb,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,YAAY,CAkBd"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-ui.d.ts","sourceRoot":"","sources":["../../../src/ui/generate-ui.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAkErE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CAChC;AA2UD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE;IACvC,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7C,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA4D5B"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { Placement, ValidationResult, ExtractedFormSchema } from './types.js';
|
|
3
|
-
import type { FormSchema } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Check if a value is a binding expression like "{{path}}".
|
|
6
|
-
*/
|
|
7
|
-
export declare function isBinding(value: unknown): value is string;
|
|
8
|
-
/**
|
|
9
|
-
* Extract the path from a binding expression.
|
|
10
|
-
* "{{email.subject}}" -> "email.subject"
|
|
11
|
-
*/
|
|
12
|
-
export declare function extractBindingPath(binding: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Validate all data bindings in placements against the provided data type.
|
|
15
|
-
*/
|
|
16
|
-
export declare function validateDataBindings(placements: Placement[], data: Record<string, unknown>): ValidationResult;
|
|
17
|
-
/**
|
|
18
|
-
* Extract form schema from placements.
|
|
19
|
-
* Finds all form input components and extracts their field info.
|
|
20
|
-
*/
|
|
21
|
-
export declare function extractFormSchema(placements: Placement[]): ExtractedFormSchema;
|
|
22
|
-
/**
|
|
23
|
-
* Validate extracted form schema against a Zod schema.
|
|
24
|
-
*/
|
|
25
|
-
export declare function validateAgainstZod(extracted: ExtractedFormSchema, zodSchema: FormSchema): ValidationResult;
|
|
26
|
-
/**
|
|
27
|
-
* Create the ValidateForm tool for the UI generation agent.
|
|
28
|
-
* Validates both form schema and data bindings.
|
|
29
|
-
*/
|
|
30
|
-
export declare function createValidateFormTool(placements: Placement[], schema: FormSchema | undefined, data: Record<string, unknown>): {
|
|
31
|
-
description: string;
|
|
32
|
-
inputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
33
|
-
execute: () => {
|
|
34
|
-
valid: boolean;
|
|
35
|
-
errors: Array<{
|
|
36
|
-
type: string;
|
|
37
|
-
message: string;
|
|
38
|
-
}>;
|
|
39
|
-
extractedFields: Array<{
|
|
40
|
-
name: string;
|
|
41
|
-
type: string;
|
|
42
|
-
}>;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=validate-form.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3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