aimyapi 1.0.9 → 1.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.
- package/README.md +28 -2
- package/dist/index.cjs +232 -111
- package/dist/index.d.cts +16 -8
- package/dist/index.d.mts +16 -8
- package/dist/index.d.ts +16 -8
- package/dist/index.js +232 -111
- package/dist/index.mjs +234 -113
- package/example/example1.ts +21 -10
- package/example/sales_api.md +1 -5
- package/example/sales_api.ts +4 -2
- package/example/sales_api_impl.ts +18 -4
- package/package.json +2 -3
- package/prompts/generate-code-prompt.md +37 -0
- package/src/index.ts +519 -495
- package/src/log-tester-inject.ts +233 -0
- package/src/log-tester.ts +185 -0
- package/src/logger.ts +113 -0
- package/src/sandbox-wrappers.ts +91 -46
- package/src/sandbox.ts +254 -277
- package/src/utils.ts +31 -1
- package/prompts/create-task-prompt.md +0 -37
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { ChatCompletionMessageParam } from 'openai/resources/index.mjs';
|
|
2
2
|
import { QuickJSWASMModule } from 'quickjs-emscripten';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
type LogSource = "sandbox" | "compiler" | "runner";
|
|
5
|
+
type SandboxLog = {
|
|
6
|
+
type: "log" | "error";
|
|
7
|
+
args: any[];
|
|
8
|
+
source: LogSource;
|
|
9
|
+
} | {
|
|
10
|
+
type: "trace";
|
|
11
|
+
fnName: string;
|
|
12
|
+
fnArgs: any[];
|
|
13
|
+
result: any;
|
|
14
|
+
};
|
|
4
15
|
|
|
5
16
|
interface GlobalOption {
|
|
6
17
|
value: any;
|
|
@@ -9,11 +20,6 @@ interface GlobalOption {
|
|
|
9
20
|
interface Globals {
|
|
10
21
|
[key: string]: GlobalOption;
|
|
11
22
|
}
|
|
12
|
-
type SandboxLog = {
|
|
13
|
-
type: "log" | "error";
|
|
14
|
-
args: any[];
|
|
15
|
-
source: string;
|
|
16
|
-
};
|
|
17
23
|
type CodeRunResult = {
|
|
18
24
|
success: boolean;
|
|
19
25
|
logs: SandboxLog[];
|
|
@@ -44,7 +50,9 @@ interface GenerateCodeResult {
|
|
|
44
50
|
code?: string;
|
|
45
51
|
comments?: string;
|
|
46
52
|
}
|
|
47
|
-
declare function zodParseJSON<T>(schema:
|
|
53
|
+
declare function zodParseJSON<T>(schema: {
|
|
54
|
+
parse: any;
|
|
55
|
+
}): (input: string) => T;
|
|
48
56
|
declare function createBasePrompt(apiFilePath: string, apiGlobalName: string, documentationPath?: string): string;
|
|
49
57
|
declare const generateCode: (instance: AIMyAPIInstance, queryText: string, userChatHistory: ChatCompletionMessageParam[], createTaskPrompt: string, debug?: boolean, hideLogsFromAgent?: boolean, model?: string, additionalModelOptions?: object, attempt?: number) => Promise<GenerateCodeResult | null>;
|
|
50
58
|
interface AIMyAPIModuleExports {
|
|
@@ -55,4 +63,4 @@ interface AIMyAPIModuleExports {
|
|
|
55
63
|
}
|
|
56
64
|
declare const AIMyAPI: AIMyAPIModuleExports;
|
|
57
65
|
|
|
58
|
-
export { AIMyAPI, type AIMyAPIInstance, type AIMyAPIModuleExports, type AIMyAPIOptions, type CodeRunResult, type GenerateCodeResult, type GlobalOption, type Globals,
|
|
66
|
+
export { AIMyAPI, type AIMyAPIInstance, type AIMyAPIModuleExports, type AIMyAPIOptions, type CodeRunResult, type GenerateCodeResult, type GlobalOption, type Globals, createBasePrompt, generateCode, zodParseJSON };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { ChatCompletionMessageParam } from 'openai/resources/index.mjs';
|
|
2
2
|
import { QuickJSWASMModule } from 'quickjs-emscripten';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
type LogSource = "sandbox" | "compiler" | "runner";
|
|
5
|
+
type SandboxLog = {
|
|
6
|
+
type: "log" | "error";
|
|
7
|
+
args: any[];
|
|
8
|
+
source: LogSource;
|
|
9
|
+
} | {
|
|
10
|
+
type: "trace";
|
|
11
|
+
fnName: string;
|
|
12
|
+
fnArgs: any[];
|
|
13
|
+
result: any;
|
|
14
|
+
};
|
|
4
15
|
|
|
5
16
|
interface GlobalOption {
|
|
6
17
|
value: any;
|
|
@@ -9,11 +20,6 @@ interface GlobalOption {
|
|
|
9
20
|
interface Globals {
|
|
10
21
|
[key: string]: GlobalOption;
|
|
11
22
|
}
|
|
12
|
-
type SandboxLog = {
|
|
13
|
-
type: "log" | "error";
|
|
14
|
-
args: any[];
|
|
15
|
-
source: string;
|
|
16
|
-
};
|
|
17
23
|
type CodeRunResult = {
|
|
18
24
|
success: boolean;
|
|
19
25
|
logs: SandboxLog[];
|
|
@@ -44,7 +50,9 @@ interface GenerateCodeResult {
|
|
|
44
50
|
code?: string;
|
|
45
51
|
comments?: string;
|
|
46
52
|
}
|
|
47
|
-
declare function zodParseJSON<T>(schema:
|
|
53
|
+
declare function zodParseJSON<T>(schema: {
|
|
54
|
+
parse: any;
|
|
55
|
+
}): (input: string) => T;
|
|
48
56
|
declare function createBasePrompt(apiFilePath: string, apiGlobalName: string, documentationPath?: string): string;
|
|
49
57
|
declare const generateCode: (instance: AIMyAPIInstance, queryText: string, userChatHistory: ChatCompletionMessageParam[], createTaskPrompt: string, debug?: boolean, hideLogsFromAgent?: boolean, model?: string, additionalModelOptions?: object, attempt?: number) => Promise<GenerateCodeResult | null>;
|
|
50
58
|
interface AIMyAPIModuleExports {
|
|
@@ -55,4 +63,4 @@ interface AIMyAPIModuleExports {
|
|
|
55
63
|
}
|
|
56
64
|
declare const AIMyAPI: AIMyAPIModuleExports;
|
|
57
65
|
|
|
58
|
-
export { AIMyAPI, type AIMyAPIInstance, type AIMyAPIModuleExports, type AIMyAPIOptions, type CodeRunResult, type GenerateCodeResult, type GlobalOption, type Globals,
|
|
66
|
+
export { AIMyAPI, type AIMyAPIInstance, type AIMyAPIModuleExports, type AIMyAPIOptions, type CodeRunResult, type GenerateCodeResult, type GlobalOption, type Globals, createBasePrompt, generateCode, zodParseJSON };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { ChatCompletionMessageParam } from 'openai/resources/index.mjs';
|
|
2
2
|
import { QuickJSWASMModule } from 'quickjs-emscripten';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
type LogSource = "sandbox" | "compiler" | "runner";
|
|
5
|
+
type SandboxLog = {
|
|
6
|
+
type: "log" | "error";
|
|
7
|
+
args: any[];
|
|
8
|
+
source: LogSource;
|
|
9
|
+
} | {
|
|
10
|
+
type: "trace";
|
|
11
|
+
fnName: string;
|
|
12
|
+
fnArgs: any[];
|
|
13
|
+
result: any;
|
|
14
|
+
};
|
|
4
15
|
|
|
5
16
|
interface GlobalOption {
|
|
6
17
|
value: any;
|
|
@@ -9,11 +20,6 @@ interface GlobalOption {
|
|
|
9
20
|
interface Globals {
|
|
10
21
|
[key: string]: GlobalOption;
|
|
11
22
|
}
|
|
12
|
-
type SandboxLog = {
|
|
13
|
-
type: "log" | "error";
|
|
14
|
-
args: any[];
|
|
15
|
-
source: string;
|
|
16
|
-
};
|
|
17
23
|
type CodeRunResult = {
|
|
18
24
|
success: boolean;
|
|
19
25
|
logs: SandboxLog[];
|
|
@@ -44,7 +50,9 @@ interface GenerateCodeResult {
|
|
|
44
50
|
code?: string;
|
|
45
51
|
comments?: string;
|
|
46
52
|
}
|
|
47
|
-
declare function zodParseJSON<T>(schema:
|
|
53
|
+
declare function zodParseJSON<T>(schema: {
|
|
54
|
+
parse: any;
|
|
55
|
+
}): (input: string) => T;
|
|
48
56
|
declare function createBasePrompt(apiFilePath: string, apiGlobalName: string, documentationPath?: string): string;
|
|
49
57
|
declare const generateCode: (instance: AIMyAPIInstance, queryText: string, userChatHistory: ChatCompletionMessageParam[], createTaskPrompt: string, debug?: boolean, hideLogsFromAgent?: boolean, model?: string, additionalModelOptions?: object, attempt?: number) => Promise<GenerateCodeResult | null>;
|
|
50
58
|
interface AIMyAPIModuleExports {
|
|
@@ -55,4 +63,4 @@ interface AIMyAPIModuleExports {
|
|
|
55
63
|
}
|
|
56
64
|
declare const AIMyAPI: AIMyAPIModuleExports;
|
|
57
65
|
|
|
58
|
-
export { AIMyAPI, type AIMyAPIInstance, type AIMyAPIModuleExports, type AIMyAPIOptions, type CodeRunResult, type GenerateCodeResult, type GlobalOption, type Globals,
|
|
66
|
+
export { AIMyAPI, type AIMyAPIInstance, type AIMyAPIModuleExports, type AIMyAPIOptions, type CodeRunResult, type GenerateCodeResult, type GlobalOption, type Globals, createBasePrompt, generateCode, zodParseJSON };
|