@ai.ntellect/core 0.6.0 → 0.6.1

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.
@@ -1,73 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export interface SchemaConfig {
4
- schema: z.ZodType;
5
- instructions?: string;
6
- outputExamples?: {
7
- input: string;
8
- output: string;
9
- }[];
10
- }
11
-
12
- export class SchemaGenerator {
13
- static generate(config: SchemaConfig): {
14
- schema: string;
15
- instructions: string;
16
- outputExamples: string;
17
- } {
18
- const {
19
- schema,
20
- instructions = "Output only the JSON schema, no 'triple quotes'json or any other text. Only the JSON schema.",
21
- outputExamples = [],
22
- } = config;
23
-
24
- const getSchemaString = (schema: z.ZodType): string => {
25
- if (schema instanceof z.ZodObject) {
26
- const entries = Object.entries(schema.shape);
27
- const fields = entries.map(([key, value]) => {
28
- const description = (value as any)._def.description;
29
- const schemaStr = getSchemaString(value as z.ZodType);
30
- return description
31
- ? `${key}: ${schemaStr} // ${description}`
32
- : `${key}: ${schemaStr}`;
33
- });
34
- return `z.object({${fields.join(", ")}})`;
35
- }
36
-
37
- if (schema instanceof z.ZodArray) {
38
- return `z.array(${getSchemaString(schema.element)})`;
39
- }
40
-
41
- if (schema instanceof z.ZodString) {
42
- return "z.string()";
43
- }
44
-
45
- if (schema instanceof z.ZodNumber) {
46
- return "z.number()";
47
- }
48
-
49
- if (schema instanceof z.ZodBoolean) {
50
- return "z.boolean()";
51
- }
52
-
53
- // Fallback for other Zod types
54
- return `z.unknown()`;
55
- };
56
-
57
- const schemaString = getSchemaString(schema);
58
-
59
- return {
60
- schema: schemaString,
61
- instructions,
62
- outputExamples: outputExamples
63
- .map(
64
- (example) =>
65
- `Input: ${JSON.stringify(example.input)}, Output: ${JSON.stringify(
66
- example.output
67
- )}`
68
- )
69
- .join("\n")
70
- .trim(),
71
- };
72
- }
73
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StateManager = void 0;
4
- class StateManager {
5
- /**
6
- * Updates the shared state while preserving immutability
7
- * @param currentState Current shared state
8
- * @param updates Partial updates to apply
9
- * @returns Updated shared state
10
- */
11
- static updateState(state, updates) {
12
- return Object.assign(Object.assign({}, state), { context: Object.assign(Object.assign({}, (state.context || {})), updates) });
13
- }
14
- static createUpdate(updates) {
15
- return {
16
- context: Object.assign({}, updates),
17
- };
18
- }
19
- }
20
- exports.StateManager = StateManager;
@@ -1,30 +0,0 @@
1
- import { SharedState } from "../types";
2
-
3
- export class StateManager {
4
- /**
5
- * Updates the shared state while preserving immutability
6
- * @param currentState Current shared state
7
- * @param updates Partial updates to apply
8
- * @returns Updated shared state
9
- */
10
- static updateState<T>(
11
- state: SharedState<T>,
12
- updates: Partial<T>
13
- ): SharedState<T> {
14
- return {
15
- ...state,
16
- context: {
17
- ...(state.context || {}),
18
- ...updates,
19
- },
20
- };
21
- }
22
-
23
- static createUpdate<T>(updates: Partial<T>) {
24
- return {
25
- context: {
26
- ...updates,
27
- },
28
- };
29
- }
30
- }