alchemy 0.1.11 → 0.1.13
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 +324 -0
- package/lib/$.d.ts +8 -3
- package/lib/$.d.ts.map +1 -1
- package/lib/$.js +38 -27
- package/lib/$.js.map +1 -1
- package/lib/alchemize.d.ts.map +1 -1
- package/lib/alchemize.js +7 -0
- package/lib/alchemize.js.map +1 -1
- package/lib/apply.d.ts +2 -2
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +3 -3
- package/lib/apply.js.map +1 -1
- package/lib/aws/index.d.ts +1 -0
- package/lib/aws/index.d.ts.map +1 -1
- package/lib/aws/index.js +1 -0
- package/lib/aws/index.js.map +1 -1
- package/lib/aws/ses.d.ts +75 -0
- package/lib/aws/ses.d.ts.map +1 -0
- package/lib/aws/ses.js +197 -0
- package/lib/aws/ses.js.map +1 -0
- package/lib/cloudflare/api.d.ts +88 -0
- package/lib/cloudflare/api.d.ts.map +1 -0
- package/lib/cloudflare/api.js +184 -0
- package/lib/cloudflare/api.js.map +1 -0
- package/lib/cloudflare/asset-manifest.d.ts +15 -0
- package/lib/cloudflare/asset-manifest.d.ts.map +1 -0
- package/lib/cloudflare/asset-manifest.js +2 -0
- package/lib/cloudflare/asset-manifest.js.map +1 -0
- package/lib/cloudflare/auth.d.ts +52 -0
- package/lib/cloudflare/auth.d.ts.map +1 -0
- package/lib/cloudflare/auth.js +114 -0
- package/lib/cloudflare/auth.js.map +1 -0
- package/lib/cloudflare/bindings.d.ts +254 -0
- package/lib/cloudflare/bindings.d.ts.map +1 -0
- package/lib/cloudflare/bindings.js +2 -0
- package/lib/cloudflare/bindings.js.map +1 -0
- package/lib/cloudflare/durable-object-namespace.d.ts +23 -0
- package/lib/cloudflare/durable-object-namespace.d.ts.map +1 -0
- package/lib/cloudflare/durable-object-namespace.js +26 -0
- package/lib/cloudflare/durable-object-namespace.js.map +1 -0
- package/lib/cloudflare/generate-asset-manifest.d.ts +3 -0
- package/lib/cloudflare/generate-asset-manifest.d.ts.map +1 -0
- package/lib/cloudflare/generate-asset-manifest.js +69 -0
- package/lib/cloudflare/generate-asset-manifest.js.map +1 -0
- package/lib/cloudflare/index.d.ts +7 -0
- package/lib/cloudflare/index.d.ts.map +1 -0
- package/lib/cloudflare/index.js +7 -0
- package/lib/cloudflare/index.js.map +1 -0
- package/lib/cloudflare/kv-namespace.d.ts +61 -0
- package/lib/cloudflare/kv-namespace.d.ts.map +1 -0
- package/lib/cloudflare/kv-namespace.js +93 -0
- package/lib/cloudflare/kv-namespace.js.map +1 -0
- package/lib/cloudflare/state.d.ts +83 -0
- package/lib/cloudflare/state.d.ts.map +1 -0
- package/lib/cloudflare/state.js +109 -0
- package/lib/cloudflare/state.js.map +1 -0
- package/lib/cloudflare/static-site-router.d.ts +19 -0
- package/lib/cloudflare/static-site-router.d.ts.map +1 -0
- package/lib/cloudflare/static-site-router.js +110 -0
- package/lib/cloudflare/static-site-router.js.map +1 -0
- package/lib/cloudflare/static-site.d.ts +166 -0
- package/lib/cloudflare/static-site.d.ts.map +1 -0
- package/lib/cloudflare/static-site.js +168 -0
- package/lib/cloudflare/static-site.js.map +1 -0
- package/lib/cloudflare/types.d.ts +52 -0
- package/lib/cloudflare/types.d.ts.map +1 -0
- package/lib/cloudflare/types.js +21 -0
- package/lib/cloudflare/types.js.map +1 -0
- package/lib/cloudflare/upload-asset-manifest.d.ts +12 -0
- package/lib/cloudflare/upload-asset-manifest.d.ts.map +1 -0
- package/lib/cloudflare/upload-asset-manifest.js +55 -0
- package/lib/cloudflare/upload-asset-manifest.js.map +1 -0
- package/lib/cloudflare/worker-metadata.d.ts +130 -0
- package/lib/cloudflare/worker-metadata.d.ts.map +1 -0
- package/lib/cloudflare/worker-metadata.js +2 -0
- package/lib/cloudflare/worker-metadata.js.map +1 -0
- package/lib/cloudflare/worker-migration.d.ts +110 -0
- package/lib/cloudflare/worker-migration.d.ts.map +1 -0
- package/lib/cloudflare/worker-migration.js +11 -0
- package/lib/cloudflare/worker-migration.js.map +1 -0
- package/lib/cloudflare/worker.d.ts +105 -0
- package/lib/cloudflare/worker.d.ts.map +1 -0
- package/lib/cloudflare/worker.js +358 -0
- package/lib/cloudflare/worker.js.map +1 -0
- package/lib/destroy.d.ts +1 -1
- package/lib/destroy.d.ts.map +1 -1
- package/lib/destroy.js +2 -1
- package/lib/destroy.js.map +1 -1
- package/lib/esbuild.d.ts +83 -1
- package/lib/esbuild.d.ts.map +1 -1
- package/lib/esbuild.js +27 -18
- package/lib/esbuild.js.map +1 -1
- package/lib/fs.d.ts +1 -1
- package/lib/global.d.ts +0 -2
- package/lib/global.d.ts.map +1 -1
- package/lib/global.js +3 -3
- package/lib/global.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/main.js +1 -1
- package/lib/main.js.map +1 -1
- package/lib/output.d.ts +18 -13
- package/lib/output.d.ts.map +1 -1
- package/lib/output.js +12 -5
- package/lib/output.js.map +1 -1
- package/lib/print.d.ts +7 -0
- package/lib/print.d.ts.map +1 -0
- package/lib/print.js +10 -0
- package/lib/print.js.map +1 -0
- package/lib/resource.d.ts +9 -4
- package/lib/resource.d.ts.map +1 -1
- package/lib/resource.js +127 -93
- package/lib/resource.js.map +1 -1
- package/lib/scope.d.ts +3 -0
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +4 -12
- package/lib/scope.js.map +1 -1
- package/lib/utils/content-type.d.ts +8 -0
- package/lib/utils/content-type.d.ts.map +1 -0
- package/lib/utils/content-type.js +41 -0
- package/lib/utils/content-type.js.map +1 -0
- package/package.json +27 -8
- package/src/$.ts +63 -30
- package/src/alchemize.ts +12 -0
- package/src/apply.ts +6 -6
- package/src/aws/index.ts +1 -0
- package/src/aws/ses.ts +346 -0
- package/src/cloudflare/api.ts +282 -0
- package/src/cloudflare/asset-manifest.ts +16 -0
- package/src/cloudflare/auth.ts +187 -0
- package/src/cloudflare/bindings.ts +297 -0
- package/src/cloudflare/durable-object-namespace.ts +43 -0
- package/src/cloudflare/generate-asset-manifest.ts +93 -0
- package/src/cloudflare/index.ts +6 -0
- package/src/cloudflare/kv-namespace.ts +195 -0
- package/src/cloudflare/state.ts +138 -0
- package/src/cloudflare/static-site-router.ts +150 -0
- package/src/cloudflare/static-site.ts +395 -0
- package/src/cloudflare/types.ts +71 -0
- package/src/cloudflare/upload-asset-manifest.ts +83 -0
- package/src/cloudflare/worker-metadata.ts +154 -0
- package/src/cloudflare/worker-migration.ts +145 -0
- package/src/cloudflare/worker.ts +666 -0
- package/src/destroy.ts +2 -2
- package/src/esbuild.ts +34 -22
- package/src/global.ts +1 -3
- package/src/index.ts +1 -1
- package/src/main.ts +1 -1
- package/src/output.ts +53 -37
- package/src/print.ts +18 -0
- package/src/resource.ts +163 -116
- package/src/scope.ts +7 -12
- package/src/utils/content-type.ts +42 -0
- package/lib/agent/ai.d.ts +0 -40
- package/lib/agent/ai.d.ts.map +0 -1
- package/lib/agent/ai.js +0 -132
- package/lib/agent/ai.js.map +0 -1
- package/lib/agent/anthropic.d.ts +0 -9
- package/lib/agent/anthropic.d.ts.map +0 -1
- package/lib/agent/anthropic.js +0 -25
- package/lib/agent/anthropic.js.map +0 -1
- package/lib/agent/dependencies.d.ts +0 -4
- package/lib/agent/dependencies.d.ts.map +0 -1
- package/lib/agent/dependencies.js +0 -48
- package/lib/agent/dependencies.js.map +0 -1
- package/lib/agent/file-context.d.ts +0 -13
- package/lib/agent/file-context.d.ts.map +0 -1
- package/lib/agent/file-context.js +0 -6
- package/lib/agent/file-context.js.map +0 -1
- package/lib/agent/index.d.ts +0 -10
- package/lib/agent/index.d.ts.map +0 -1
- package/lib/agent/index.js +0 -10
- package/lib/agent/index.js.map +0 -1
- package/lib/agent/model.d.ts +0 -8
- package/lib/agent/model.d.ts.map +0 -1
- package/lib/agent/model.js +0 -29
- package/lib/agent/model.js.map +0 -1
- package/lib/agent/module.d.ts +0 -81
- package/lib/agent/module.d.ts.map +0 -1
- package/lib/agent/module.js +0 -309
- package/lib/agent/module.js.map +0 -1
- package/lib/agent/openai.d.ts +0 -6
- package/lib/agent/openai.d.ts.map +0 -1
- package/lib/agent/openai.js +0 -41
- package/lib/agent/openai.js.map +0 -1
- package/lib/agent/program.d.ts +0 -12
- package/lib/agent/program.d.ts.map +0 -1
- package/lib/agent/program.js +0 -21
- package/lib/agent/program.js.map +0 -1
- package/lib/agent/prompts.d.ts +0 -4
- package/lib/agent/prompts.d.ts.map +0 -1
- package/lib/agent/prompts.js +0 -11
- package/lib/agent/prompts.js.map +0 -1
- package/lib/agent/scrape.d.ts +0 -71
- package/lib/agent/scrape.d.ts.map +0 -1
- package/lib/agent/scrape.js +0 -45
- package/lib/agent/scrape.js.map +0 -1
- package/lib/aws/auto/docs.d.ts +0 -11
- package/lib/aws/auto/docs.d.ts.map +0 -1
- package/lib/aws/auto/docs.js +0 -56
- package/lib/aws/auto/docs.js.map +0 -1
- package/lib/aws/auto/index.d.ts +0 -5
- package/lib/aws/auto/index.d.ts.map +0 -1
- package/lib/aws/auto/index.js +0 -5
- package/lib/aws/auto/index.js.map +0 -1
- package/lib/aws/auto/resource.d.ts +0 -24
- package/lib/aws/auto/resource.d.ts.map +0 -1
- package/lib/aws/auto/resource.js +0 -194
- package/lib/aws/auto/resource.js.map +0 -1
- package/lib/aws/auto/service.d.ts +0 -10
- package/lib/aws/auto/service.d.ts.map +0 -1
- package/lib/aws/auto/service.js +0 -34
- package/lib/aws/auto/service.js.map +0 -1
- package/lib/aws/auto/spec.d.ts +0 -83
- package/lib/aws/auto/spec.d.ts.map +0 -1
- package/lib/aws/auto/spec.js +0 -58
- package/lib/aws/auto/spec.js.map +0 -1
- package/lib/markdown/design.d.ts +0 -17
- package/lib/markdown/design.d.ts.map +0 -1
- package/lib/markdown/design.js +0 -92
- package/lib/markdown/design.js.map +0 -1
- package/lib/markdown/extract.d.ts +0 -7
- package/lib/markdown/extract.d.ts.map +0 -1
- package/lib/markdown/extract.js +0 -10
- package/lib/markdown/extract.js.map +0 -1
- package/lib/markdown/index.d.ts +0 -4
- package/lib/markdown/index.d.ts.map +0 -1
- package/lib/markdown/index.js +0 -4
- package/lib/markdown/index.js.map +0 -1
- package/lib/markdown/requirements.d.ts +0 -79
- package/lib/markdown/requirements.d.ts.map +0 -1
- package/lib/markdown/requirements.js +0 -105
- package/lib/markdown/requirements.js.map +0 -1
- package/lib/typescript/check-omission.d.ts +0 -2
- package/lib/typescript/check-omission.d.ts.map +0 -1
- package/lib/typescript/check-omission.js +0 -43
- package/lib/typescript/check-omission.js.map +0 -1
- package/lib/typescript/debug-type-errors.d.ts +0 -3
- package/lib/typescript/debug-type-errors.d.ts.map +0 -1
- package/lib/typescript/debug-type-errors.js +0 -35
- package/lib/typescript/debug-type-errors.js.map +0 -1
- package/lib/typescript/extract.d.ts +0 -7
- package/lib/typescript/extract.d.ts.map +0 -1
- package/lib/typescript/extract.js +0 -10
- package/lib/typescript/extract.js.map +0 -1
- package/lib/typescript/index.d.ts +0 -7
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/index.js +0 -7
- package/lib/typescript/index.js.map +0 -1
- package/lib/typescript/install-dependencies.d.ts +0 -29
- package/lib/typescript/install-dependencies.d.ts.map +0 -1
- package/lib/typescript/install-dependencies.js +0 -52
- package/lib/typescript/install-dependencies.js.map +0 -1
- package/lib/typescript/package.d.ts +0 -157
- package/lib/typescript/package.d.ts.map +0 -1
- package/lib/typescript/package.js +0 -115
- package/lib/typescript/package.js.map +0 -1
- package/lib/typescript/repair-omissions.d.ts +0 -3
- package/lib/typescript/repair-omissions.d.ts.map +0 -1
- package/lib/typescript/repair-omissions.js +0 -23
- package/lib/typescript/repair-omissions.js.map +0 -1
- package/lib/typescript/repair.d.ts +0 -3
- package/lib/typescript/repair.d.ts.map +0 -1
- package/lib/typescript/repair.js +0 -34
- package/lib/typescript/repair.js.map +0 -1
- package/lib/typescript/tsconfig.d.ts +0 -469
- package/lib/typescript/tsconfig.d.ts.map +0 -1
- package/lib/typescript/tsconfig.js +0 -143
- package/lib/typescript/tsconfig.js.map +0 -1
- package/lib/typescript/typescript.d.ts +0 -107
- package/lib/typescript/typescript.d.ts.map +0 -1
- package/lib/typescript/typescript.js +0 -180
- package/lib/typescript/typescript.js.map +0 -1
- package/lib/typescript/validate.d.ts +0 -10
- package/lib/typescript/validate.d.ts.map +0 -1
- package/lib/typescript/validate.js +0 -49
- package/lib/typescript/validate.js.map +0 -1
- package/src/agent/ai.ts +0 -215
- package/src/agent/anthropic.ts +0 -31
- package/src/agent/dependencies.ts +0 -62
- package/src/agent/file-context.ts +0 -8
- package/src/agent/index.ts +0 -9
- package/src/agent/model.ts +0 -39
- package/src/agent/module.ts +0 -418
- package/src/agent/openai.ts +0 -50
- package/src/agent/program.md +0 -38
- package/src/agent/program.ts +0 -37
- package/src/agent/prompts.ts +0 -20
- package/src/agent/scrape.ts +0 -47
- package/src/aws/auto/cfn.json +0 -225310
- package/src/aws/auto/docs.ts +0 -73
- package/src/aws/auto/index.ts +0 -4
- package/src/aws/auto/resource.ts +0 -269
- package/src/aws/auto/service.ts +0 -51
- package/src/aws/auto/spec.ts +0 -160
- package/src/markdown/design.ts +0 -125
- package/src/markdown/extract.ts +0 -9
- package/src/markdown/index.ts +0 -3
- package/src/markdown/requirements.ts +0 -135
- package/src/typescript/check-omission.ts +0 -47
- package/src/typescript/debug-type-errors.ts +0 -42
- package/src/typescript/extract.ts +0 -9
- package/src/typescript/index.ts +0 -6
- package/src/typescript/install-dependencies.ts +0 -61
- package/src/typescript/package.ts +0 -143
- package/src/typescript/repair-omissions.ts +0 -31
- package/src/typescript/repair.ts +0 -45
- package/src/typescript/tsconfig.ts +0 -170
- package/src/typescript/typescript.ts +0 -217
- package/src/typescript/validate.ts +0 -73
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
|
|
3
|
+
// Common MIME types
|
|
4
|
+
const mimeTypes: Record<string, string> = {
|
|
5
|
+
".html": "text/html",
|
|
6
|
+
".htm": "text/html",
|
|
7
|
+
".css": "text/css",
|
|
8
|
+
".js": "application/javascript",
|
|
9
|
+
".json": "application/json",
|
|
10
|
+
".xml": "application/xml",
|
|
11
|
+
".txt": "text/plain",
|
|
12
|
+
".md": "text/markdown",
|
|
13
|
+
".png": "image/png",
|
|
14
|
+
".jpg": "image/jpeg",
|
|
15
|
+
".jpeg": "image/jpeg",
|
|
16
|
+
".gif": "image/gif",
|
|
17
|
+
".webp": "image/webp",
|
|
18
|
+
".svg": "image/svg+xml",
|
|
19
|
+
".ico": "image/x-icon",
|
|
20
|
+
".pdf": "application/pdf",
|
|
21
|
+
".zip": "application/zip",
|
|
22
|
+
".woff": "font/woff",
|
|
23
|
+
".woff2": "font/woff2",
|
|
24
|
+
".ttf": "font/ttf",
|
|
25
|
+
".otf": "font/otf",
|
|
26
|
+
".eot": "application/vnd.ms-fontobject",
|
|
27
|
+
".mp4": "video/mp4",
|
|
28
|
+
".webm": "video/webm",
|
|
29
|
+
".mp3": "audio/mpeg",
|
|
30
|
+
".wav": "audio/wav",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Gets the content type for a file based on its extension
|
|
35
|
+
*
|
|
36
|
+
* @param filePath Path to the file
|
|
37
|
+
* @returns The content type for the file
|
|
38
|
+
*/
|
|
39
|
+
export function getContentType(filePath: string): string {
|
|
40
|
+
const extension = path.extname(filePath).toLowerCase();
|
|
41
|
+
return mimeTypes[extension] || "application/octet-stream";
|
|
42
|
+
}
|
package/lib/agent/ai.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { generateObject as _generateObject, generateText as _generateText } from "ai";
|
|
2
|
-
/**
|
|
3
|
-
* Rate-limited wrapper around generateText
|
|
4
|
-
*/
|
|
5
|
-
export declare const generateText: typeof _generateText;
|
|
6
|
-
/**
|
|
7
|
-
* Rate-limited wrapper around generateObject
|
|
8
|
-
*/
|
|
9
|
-
export declare const generateObject: typeof _generateObject;
|
|
10
|
-
/**
|
|
11
|
-
* Configuration for rate limiting and retries
|
|
12
|
-
*/
|
|
13
|
-
export interface RateLimitConfig {
|
|
14
|
-
/**
|
|
15
|
-
* Maximum number of concurrent requests
|
|
16
|
-
* @default 3
|
|
17
|
-
*/
|
|
18
|
-
maxConcurrent?: number;
|
|
19
|
-
/**
|
|
20
|
-
* Base delay for exponential backoff (in milliseconds)
|
|
21
|
-
* @default 1000
|
|
22
|
-
*/
|
|
23
|
-
baseDelay?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Maximum number of retries
|
|
26
|
-
* @default 3
|
|
27
|
-
*/
|
|
28
|
-
maxRetries?: number;
|
|
29
|
-
/**
|
|
30
|
-
* Maximum delay for exponential backoff (in milliseconds)
|
|
31
|
-
* @default 30000
|
|
32
|
-
*/
|
|
33
|
-
maxDelay?: number;
|
|
34
|
-
/**
|
|
35
|
-
* Jitter factor for randomizing delays (between 0 and 1)
|
|
36
|
-
* @default 0.1
|
|
37
|
-
*/
|
|
38
|
-
jitter?: number;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=ai.d.ts.map
|
package/lib/agent/ai.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/agent/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,IAAI,eAAe,EACjC,YAAY,IAAI,aAAa,EAC9B,MAAM,IAAI,CAAC;AAWZ;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,OAAO,aAEjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,OAAO,eAM3B,CAAC;AAkCV;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/lib/agent/ai.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { generateObject as _generateObject, generateText as _generateText, } from "ai";
|
|
2
|
-
import { isOpenAIModel } from "./openai";
|
|
3
|
-
/**
|
|
4
|
-
* Rate-limited wrapper around generateText
|
|
5
|
-
*/
|
|
6
|
-
export const generateText = async (options) => {
|
|
7
|
-
return withRateLimit(() => _generateText(options), options);
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Rate-limited wrapper around generateObject
|
|
11
|
-
*/
|
|
12
|
-
export const generateObject = (async (options) => {
|
|
13
|
-
return withRateLimit(() => _generateObject(options), options);
|
|
14
|
-
});
|
|
15
|
-
/**
|
|
16
|
-
* A simple async semaphore implementation for rate limiting
|
|
17
|
-
*/
|
|
18
|
-
class AsyncSemaphore {
|
|
19
|
-
permits;
|
|
20
|
-
queue = [];
|
|
21
|
-
constructor(permits) {
|
|
22
|
-
this.permits = permits;
|
|
23
|
-
}
|
|
24
|
-
async acquire() {
|
|
25
|
-
if (this.permits > 0) {
|
|
26
|
-
this.permits--;
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
return new Promise((resolve) => {
|
|
30
|
-
this.queue.push(resolve);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
release() {
|
|
34
|
-
if (this.queue.length > 0) {
|
|
35
|
-
const next = this.queue.shift();
|
|
36
|
-
next?.();
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
this.permits++;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
// Global semaphore instances per client configuration
|
|
44
|
-
const defaultConfig = {
|
|
45
|
-
maxConcurrent: 3,
|
|
46
|
-
baseDelay: 1000,
|
|
47
|
-
maxRetries: 10,
|
|
48
|
-
maxDelay: 30000,
|
|
49
|
-
jitter: 0.1,
|
|
50
|
-
};
|
|
51
|
-
// WeakMap to store semaphores per client
|
|
52
|
-
const clientSemaphores = new Map();
|
|
53
|
-
/**
|
|
54
|
-
* Gets or creates a semaphore for a specific client
|
|
55
|
-
*/
|
|
56
|
-
function getSemaphore(client) {
|
|
57
|
-
let semaphore = clientSemaphores.get(client);
|
|
58
|
-
if (!semaphore) {
|
|
59
|
-
semaphore = new AsyncSemaphore(defaultConfig.maxConcurrent);
|
|
60
|
-
clientSemaphores.set(client, semaphore);
|
|
61
|
-
}
|
|
62
|
-
return semaphore;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Calculates the delay for exponential backoff with jitter
|
|
66
|
-
*/
|
|
67
|
-
function calculateBackoffDelay(attempt, { baseDelay, maxDelay, jitter }) {
|
|
68
|
-
const exponentialDelay = Math.min(baseDelay * Math.pow(2, attempt), maxDelay);
|
|
69
|
-
const jitterAmount = exponentialDelay * jitter;
|
|
70
|
-
return exponentialDelay + (Math.random() * 2 - 1) * jitterAmount;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Checks if an error is a rate limit related error
|
|
74
|
-
*/
|
|
75
|
-
function isRateLimitError(error) {
|
|
76
|
-
if (error.url === "https://api.anthropic.com/v1/messages") {
|
|
77
|
-
return error.status === 429;
|
|
78
|
-
}
|
|
79
|
-
const openAIError = error;
|
|
80
|
-
// Check for specific OpenAI rate limit error codes
|
|
81
|
-
if (openAIError.code) {
|
|
82
|
-
return [
|
|
83
|
-
"rate_limit_exceeded",
|
|
84
|
-
"insufficient_quota",
|
|
85
|
-
"tokens_quota_exceeded",
|
|
86
|
-
"requests_quota_exceeded",
|
|
87
|
-
].includes(openAIError.code);
|
|
88
|
-
}
|
|
89
|
-
// Check for HTTP 429 status
|
|
90
|
-
if (openAIError.status === 429)
|
|
91
|
-
return true;
|
|
92
|
-
// Check error types
|
|
93
|
-
if (openAIError.type) {
|
|
94
|
-
return ["tokens", "requests", "rate_limit", "capacity"].includes(openAIError.type.toLowerCase());
|
|
95
|
-
}
|
|
96
|
-
// Fallback to message content check
|
|
97
|
-
return (openAIError.message.toLowerCase().includes("rate") ||
|
|
98
|
-
openAIError.message.toLowerCase().includes("quota") ||
|
|
99
|
-
openAIError.message.toLowerCase().includes("capacity") ||
|
|
100
|
-
openAIError.message.toLowerCase().includes("throttle"));
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Wraps an async function with rate limiting and exponential backoff
|
|
104
|
-
*/
|
|
105
|
-
async function withRateLimit(fn, options, config = {}) {
|
|
106
|
-
const finalConfig = { ...defaultConfig, ...config };
|
|
107
|
-
const client = options.model;
|
|
108
|
-
const semaphore = getSemaphore(isOpenAIModel(client.modelId) ? "openai" : "anthropic");
|
|
109
|
-
for (let attempt = 0; attempt <= finalConfig.maxRetries; attempt++) {
|
|
110
|
-
try {
|
|
111
|
-
await semaphore.acquire();
|
|
112
|
-
const result = await fn();
|
|
113
|
-
return result;
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
if (attempt === finalConfig.maxRetries) {
|
|
117
|
-
throw error;
|
|
118
|
-
}
|
|
119
|
-
if (!isRateLimitError(error)) {
|
|
120
|
-
throw error;
|
|
121
|
-
}
|
|
122
|
-
const delay = calculateBackoffDelay(attempt, finalConfig);
|
|
123
|
-
console.log(`Rate limit error, retrying... (attempt ${attempt + 1}/${finalConfig.maxRetries + 1}, waiting ${Math.round(delay)}ms)`);
|
|
124
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
125
|
-
}
|
|
126
|
-
finally {
|
|
127
|
-
semaphore.release();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
throw new Error("Unexpected: Should not reach this point");
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=ai.js.map
|
package/lib/agent/ai.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai.js","s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ACnE,IAAI,CAAC;YACH,MAAM,SAAS,CAAC,OAAO,EAAE,CAAC;YAC1B,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;YAC1B,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,OAAO,KAAK,WAAW,CAAC,UAAU,EAAE,CAAC;gBACvC,MAAM,KAAK,CAAC;YACd,CAAC;YAED,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7B,MAAM,KAAK,CAAC;YACd,CAAC;YAED,MAAM,KAAK,GAAG,qBAAqB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAC1D,OAAO,CAAC,GAAG,CACT,0CAA0C,OAAO,GAAG,CAAC,IAAI,WAAW,CAAC,UAAU,GAAG,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CACvH,CAAC;YACF,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;QAC7D,CAAC;gBAAS,CAAC;YACT,SAAS,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;AAC7D,CAAC"}
|
package/lib/agent/anthropic.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* @see https://docs.anthropic.com/en/docs/about-claude/models#model-comparison-table
|
|
4
|
-
*/
|
|
5
|
-
export declare const AnthropicModels: readonly ["claude-3-5-sonnet-latest", "claude-3-5-sonnet-20241022", "claude-3-5-sonnet-20240620", "claude-3-5-haiku-latest", "claude-3-5-haiku-20241022", "claude-3-opus", "claude-3-opus-20240229", "claude-3-sonnet", "claude-3-sonnet-20240229", "claude-3-haiku", "claude-3-haiku-20240307"];
|
|
6
|
-
export declare const AnthropicModel: z.ZodEnum<["claude-3-5-sonnet-latest", "claude-3-5-sonnet-20241022", "claude-3-5-sonnet-20240620", "claude-3-5-haiku-latest", "claude-3-5-haiku-20241022", "claude-3-opus", "claude-3-opus-20240229", "claude-3-sonnet", "claude-3-sonnet-20240229", "claude-3-haiku", "claude-3-haiku-20240307"]>;
|
|
7
|
-
export type AnthropicModelId = (typeof AnthropicModels)[number] | (string & {});
|
|
8
|
-
export declare function isAnthropicModel(model: string): model is AnthropicModelId;
|
|
9
|
-
//# sourceMappingURL=anthropic.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/agent/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,eAAe,kSAiBlB,CAAC;AAEX,eAAO,MAAM,cAAc,oSAA0B,CAAC;AAEtD,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEhF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,gBAAgB,CAEzE"}
|
package/lib/agent/anthropic.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* @see https://docs.anthropic.com/en/docs/about-claude/models#model-comparison-table
|
|
4
|
-
*/
|
|
5
|
-
export const AnthropicModels = [
|
|
6
|
-
// Claude 3.5 Sonnet models
|
|
7
|
-
"claude-3-5-sonnet-latest",
|
|
8
|
-
"claude-3-5-sonnet-20241022",
|
|
9
|
-
"claude-3-5-sonnet-20240620",
|
|
10
|
-
// Claude 3.5 Haiku models
|
|
11
|
-
"claude-3-5-haiku-latest",
|
|
12
|
-
"claude-3-5-haiku-20241022",
|
|
13
|
-
// Claude 3 models
|
|
14
|
-
"claude-3-opus",
|
|
15
|
-
"claude-3-opus-20240229",
|
|
16
|
-
"claude-3-sonnet",
|
|
17
|
-
"claude-3-sonnet-20240229",
|
|
18
|
-
"claude-3-haiku",
|
|
19
|
-
"claude-3-haiku-20240307",
|
|
20
|
-
];
|
|
21
|
-
export const AnthropicModel = z.enum(AnthropicModels);
|
|
22
|
-
export function isAnthropicModel(model) {
|
|
23
|
-
return model.startsWith("claude-");
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=anthropic.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../src/agent/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,2BAA2B;IAC3B,0BAA0B;IAC1B,4BAA4B;IAC5B,4BAA4B;IAE5B,0BAA0B;IAC1B,yBAAyB;IACzB,2BAA2B;IAE3B,kBAAkB;IAClB,eAAe;IACf,wBAAwB;IACxB,iBAAiB;IACjB,0BAA0B;IAC1B,gBAAgB;IAChB,yBAAyB;CACjB,CAAC;AAEX,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAItD,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,OAAO,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/agent/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,WAAW,EAAE,GAAG,SAAS,GACtC,WAAW,EAAE,CAyBf"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export function dependenciesAsMessages(dependencies) {
|
|
2
|
-
if (!dependencies?.length)
|
|
3
|
-
return [];
|
|
4
|
-
const fileTree = generateFileTree(dependencies);
|
|
5
|
-
return [
|
|
6
|
-
{
|
|
7
|
-
role: "user",
|
|
8
|
-
content: [
|
|
9
|
-
`Here are some relevant upstream files that you may need to reference.`,
|
|
10
|
-
`Existing file structure:`,
|
|
11
|
-
fileTree,
|
|
12
|
-
`File contents:`,
|
|
13
|
-
dependencies
|
|
14
|
-
.flatMap((dep) => dep.content ? [`// ${dep.path}\n${dep.content}`] : [])
|
|
15
|
-
.join("\n\n"),
|
|
16
|
-
].join("\n"),
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
role: "assistant",
|
|
20
|
-
content: "Thanks, I'll refer to those where relevant.",
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
}
|
|
24
|
-
function generateFileTree(dependencies) {
|
|
25
|
-
const tree = {};
|
|
26
|
-
// Sort dependencies by path for consistent ordering
|
|
27
|
-
dependencies.sort((a, b) => a.path.localeCompare(b.path));
|
|
28
|
-
for (const dep of dependencies) {
|
|
29
|
-
const parts = dep.path.split("/");
|
|
30
|
-
let currentPath = "";
|
|
31
|
-
for (let i = 0; i < parts.length; i++) {
|
|
32
|
-
const part = parts[i];
|
|
33
|
-
const newPath = currentPath ? `${currentPath}/${part}` : part;
|
|
34
|
-
tree[newPath] = true;
|
|
35
|
-
currentPath = newPath;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const paths = Object.keys(tree);
|
|
39
|
-
let result = "";
|
|
40
|
-
for (const path of paths) {
|
|
41
|
-
const depth = path.split("/").length - 1;
|
|
42
|
-
const prefix = " ".repeat(depth);
|
|
43
|
-
const name = path.split("/").pop();
|
|
44
|
-
result += `${prefix}${depth > 0 ? "└─ " : ""}${name}\n`;
|
|
45
|
-
}
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=dependencies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/agent/dependencies.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,sBAAsB,CACpC,YAAuC;IAEvC,IAAI,CAAC,YAAY,EAAE,MAAM;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAEhD,OAAO;QACL;YACE,IAAI,EAAE,MAAe;YACrB,OAAO,EAAE;gBACP,uEAAuE;gBACvE,0BAA0B;gBAC1B,QAAQ;gBACR,gBAAgB;gBAChB,YAAY;qBACT,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CACf,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CACtD;qBACA,IAAI,CAAC,MAAM,CAAC;aAChB,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;QACD;YACE,IAAI,EAAE,WAAoB;YAC1B,OAAO,EAAE,6CAA6C;SACvD;KACF,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,YAA2B;IACnD,MAAM,IAAI,GAA+B,EAAE,CAAC;IAE5C,oDAAoD;IACpD,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAE1D,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,WAAW,GAAG,EAAE,CAAC;QAErB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACtB,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;YAC9D,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;YACrB,WAAW,GAAG,OAAO,CAAC;QACxB,CAAC;IACH,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QACzC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG,CAAC;QACpC,MAAM,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,IAAI,CAAC;IAC1D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export type FileContext = z.infer<typeof FileContext>;
|
|
3
|
-
export declare const FileContext: z.ZodObject<{
|
|
4
|
-
path: z.ZodString;
|
|
5
|
-
content: z.ZodOptional<z.ZodString>;
|
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
path: string;
|
|
8
|
-
content?: string | undefined;
|
|
9
|
-
}, {
|
|
10
|
-
path: string;
|
|
11
|
-
content?: string | undefined;
|
|
12
|
-
}>;
|
|
13
|
-
//# sourceMappingURL=file-context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-context.d.ts","sourceRoot":"","sources":["../../src/agent/file-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,eAAO,MAAM,WAAW;;;;;;;;;EAGtB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-context.js","sourceRoot":"","sources":["../../src/agent/file-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC"}
|
package/lib/agent/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./ai";
|
|
2
|
-
export * from "./anthropic";
|
|
3
|
-
export * from "./dependencies";
|
|
4
|
-
export * from "./file-context";
|
|
5
|
-
export * from "./model";
|
|
6
|
-
export * from "./module";
|
|
7
|
-
export * from "./openai";
|
|
8
|
-
export * from "./program";
|
|
9
|
-
export * from "./scrape";
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
package/lib/agent/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|
package/lib/agent/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./ai";
|
|
2
|
-
export * from "./anthropic";
|
|
3
|
-
export * from "./dependencies";
|
|
4
|
-
export * from "./file-context";
|
|
5
|
-
export * from "./model";
|
|
6
|
-
export * from "./module";
|
|
7
|
-
export * from "./openai";
|
|
8
|
-
export * from "./program";
|
|
9
|
-
export * from "./scrape";
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
package/lib/agent/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|
package/lib/agent/model.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { LanguageModelV1 } from "ai";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { type AnthropicModelId } from "./anthropic";
|
|
4
|
-
import { type OpenAIChatModelId } from "./openai";
|
|
5
|
-
export type ModelId = OpenAIChatModelId | AnthropicModelId;
|
|
6
|
-
export declare const ModelId: z.ZodUnion<[z.ZodEnum<["o3-mini", "o1", "o1-2024-12-17", "o1-mini", "o1-mini-2024-09-12", "o1-preview", "o1-preview-2024-09-12", "gpt-4o", "gpt-4o-2024-05-13", "gpt-4o-2024-08-06", "gpt-4o-2024-11-20", "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-10-01", "gpt-4o-audio-preview-2024-12-17", "gpt-4o-mini", "gpt-4o-mini-2024-07-18", "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-turbo-preview", "gpt-4-0125-preview", "gpt-4-1106-preview", "gpt-4", "gpt-4-0613", "gpt-3.5-turbo-0125", "gpt-3.5-turbo", "gpt-3.5-turbo-1106"]>, z.ZodEnum<["claude-3-5-sonnet-latest", "claude-3-5-sonnet-20241022", "claude-3-5-sonnet-20240620", "claude-3-5-haiku-latest", "claude-3-5-haiku-20241022", "claude-3-opus", "claude-3-opus-20240229", "claude-3-sonnet", "claude-3-sonnet-20240229", "claude-3-haiku", "claude-3-haiku-20240307"]>]>;
|
|
7
|
-
export declare function resolveModel(modelId: ModelId): Promise<LanguageModelV1>;
|
|
8
|
-
//# sourceMappingURL=model.d.ts.map
|
package/lib/agent/model.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/agent/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,iBAAiB,EAA8B,MAAM,UAAU,CAAC;AAE9E,MAAM,MAAM,OAAO,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAE3D,eAAO,MAAM,OAAO,yzBAAyC,CAAC;AAI9D,wBAAsB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAuB7E"}
|
package/lib/agent/model.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { AnthropicModel, isAnthropicModel, } from "./anthropic";
|
|
3
|
-
import { OpenAIModel, isOpenAIModel } from "./openai";
|
|
4
|
-
export const ModelId = z.union([OpenAIModel, AnthropicModel]);
|
|
5
|
-
const modelCache = new Map();
|
|
6
|
-
export async function resolveModel(modelId) {
|
|
7
|
-
const cached = modelCache.get(modelId);
|
|
8
|
-
if (cached) {
|
|
9
|
-
return await cached;
|
|
10
|
-
}
|
|
11
|
-
const client = (async () => {
|
|
12
|
-
let client;
|
|
13
|
-
if (isOpenAIModel(modelId)) {
|
|
14
|
-
const { openai } = await import("@ai-sdk/openai");
|
|
15
|
-
client = openai(modelId);
|
|
16
|
-
}
|
|
17
|
-
else if (isAnthropicModel(modelId)) {
|
|
18
|
-
const { anthropic } = await import("@ai-sdk/anthropic");
|
|
19
|
-
client = anthropic(modelId);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
throw new Error(`Unsupported model ID: ${modelId}`);
|
|
23
|
-
}
|
|
24
|
-
return client;
|
|
25
|
-
})();
|
|
26
|
-
modelCache.set(modelId, client);
|
|
27
|
-
return client;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=model.js.map
|
package/lib/agent/model.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/agent/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,cAAc,EAEd,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAA0B,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9E,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;AAE9D,MAAM,UAAU,GAAG,IAAI,GAAG,EAAqC,CAAC;AAEhE,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAgB;IACjD,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvC,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,MAAM,MAAM,CAAC;IACtB,CAAC;IAED,MAAM,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;QACzB,IAAI,MAAuB,CAAC;QAC5B,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3B,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAClD,MAAM,GAAG,MAAM,CAAC,OAA4B,CAAC,CAAC;QAChD,CAAC;aAAM,IAAI,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;YACrC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;YACxD,MAAM,GAAG,SAAS,CAAC,OAA2B,CAAC,CAAC;QAClD,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,yBAAyB,OAAO,EAAE,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,EAAE,CAAC;IAEL,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/lib/agent/module.d.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { Folder } from "../fs";
|
|
3
|
-
import { TypeScriptFile } from "../typescript";
|
|
4
|
-
import type { PackageJson } from "../typescript/package";
|
|
5
|
-
import type { TypeScriptConfig } from "../typescript/tsconfig";
|
|
6
|
-
import type { FileContext } from "./file-context";
|
|
7
|
-
import { type ModelId } from "./model";
|
|
8
|
-
export type CreatePlan = z.infer<typeof CreatePlan>;
|
|
9
|
-
export declare const CreatePlan: z.ZodObject<{
|
|
10
|
-
files: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
11
|
-
type: z.ZodEnum<["folder", "design", "typescript", "css", "scss", "javascript", "html"]>;
|
|
12
|
-
upstream: z.ZodArray<z.ZodString, "many">;
|
|
13
|
-
operation: z.ZodEnum<["create"]>;
|
|
14
|
-
}, "strip", z.ZodTypeAny, {
|
|
15
|
-
type: "design" | "folder" | "typescript" | "css" | "scss" | "javascript" | "html";
|
|
16
|
-
upstream: string[];
|
|
17
|
-
operation: "create";
|
|
18
|
-
}, {
|
|
19
|
-
type: "design" | "folder" | "typescript" | "css" | "scss" | "javascript" | "html";
|
|
20
|
-
upstream: string[];
|
|
21
|
-
operation: "create";
|
|
22
|
-
}>>;
|
|
23
|
-
}, "strip", z.ZodTypeAny, {
|
|
24
|
-
files: Record<string, {
|
|
25
|
-
type: "design" | "folder" | "typescript" | "css" | "scss" | "javascript" | "html";
|
|
26
|
-
upstream: string[];
|
|
27
|
-
operation: "create";
|
|
28
|
-
}>;
|
|
29
|
-
}, {
|
|
30
|
-
files: Record<string, {
|
|
31
|
-
type: "design" | "folder" | "typescript" | "css" | "scss" | "javascript" | "html";
|
|
32
|
-
upstream: string[];
|
|
33
|
-
operation: "create";
|
|
34
|
-
}>;
|
|
35
|
-
}>;
|
|
36
|
-
export type UpdatePlan = z.infer<typeof UpdatePlan>;
|
|
37
|
-
export declare const UpdatePlan: z.ZodObject<{
|
|
38
|
-
files: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
39
|
-
type: z.ZodEnum<["folder", "design", "typescript", "css", "scss", "javascript", "html"]>;
|
|
40
|
-
upstream: z.ZodArray<z.ZodString, "many">;
|
|
41
|
-
operation: z.ZodEnum<["create", "update"]>;
|
|
42
|
-
}, "strip", z.ZodTypeAny, {
|
|
43
|
-
type: "design" | "folder" | "typescript" | "css" | "scss" | "javascript" | "html";
|
|
44
|
-
upstream: string[];
|
|
45
|
-
operation: "create" | "update";
|
|
46
|
-
}, {
|
|
47
|
-
type: "design" | "folder" | "typescript" | "css" | "scss" | "javascript" | "html";
|
|
48
|
-
upstream: string[];
|
|
49
|
-
operation: "create" | "update";
|
|
50
|
-
}>, z.ZodEnum<["delete", "noop"]>]>>;
|
|
51
|
-
}, "strip", z.ZodTypeAny, {
|
|
52
|
-
files: Record<string, "delete" | {
|
|
53
|
-
type: "design" | "folder" | "typescript" | "css" | "scss" | "javascript" | "html";
|
|
54
|
-
upstream: string[];
|
|
55
|
-
operation: "create" | "update";
|
|
56
|
-
} | "noop">;
|
|
57
|
-
}, {
|
|
58
|
-
files: Record<string, "delete" | {
|
|
59
|
-
type: "design" | "folder" | "typescript" | "css" | "scss" | "javascript" | "html";
|
|
60
|
-
upstream: string[];
|
|
61
|
-
operation: "create" | "update";
|
|
62
|
-
} | "noop">;
|
|
63
|
-
}>;
|
|
64
|
-
type OutputFile = TypeScriptFile | PackageJson | TypeScriptConfig | Folder | Module;
|
|
65
|
-
export interface ModuleOutput {
|
|
66
|
-
path: string;
|
|
67
|
-
content: string;
|
|
68
|
-
plan: CreatePlan | UpdatePlan;
|
|
69
|
-
files: Record<string, OutputFile>;
|
|
70
|
-
}
|
|
71
|
-
export interface ModuleInput {
|
|
72
|
-
path: string;
|
|
73
|
-
content: string;
|
|
74
|
-
model?: ModelId;
|
|
75
|
-
dependencies?: FileContext[];
|
|
76
|
-
}
|
|
77
|
-
declare const Module_base: import("../resource").Provider<"Module", [props: ModuleInput], ModuleOutput>;
|
|
78
|
-
export declare class Module extends Module_base {
|
|
79
|
-
}
|
|
80
|
-
export {};
|
|
81
|
-
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/agent/module.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAE,cAAc,EAA4B,MAAM,eAAe,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,SAAS,CAAC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