alchemy 0.1.11 → 0.1.12
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/apply.d.ts +2 -2
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +2 -2
- 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 +84 -0
- package/lib/cloudflare/api.d.ts.map +1 -0
- package/lib/cloudflare/api.js +178 -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 +244 -0
- package/lib/cloudflare/bindings.d.ts.map +1 -0
- package/lib/cloudflare/bindings.js +7 -0
- package/lib/cloudflare/bindings.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 +6 -0
- package/lib/cloudflare/index.d.ts.map +1 -0
- package/lib/cloudflare/index.js +6 -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 +10 -0
- package/lib/cloudflare/static-site-router.d.ts.map +1 -0
- package/lib/cloudflare/static-site-router.js +88 -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 +152 -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.d.ts +87 -0
- package/lib/cloudflare/worker.d.ts.map +1 -0
- package/lib/cloudflare/worker.js +364 -0
- package/lib/cloudflare/worker.js.map +1 -0
- package/lib/esbuild.d.ts +82 -0
- package/lib/esbuild.d.ts.map +1 -1
- package/lib/esbuild.js +24 -17
- package/lib/esbuild.js.map +1 -1
- package/lib/fs.d.ts +1 -1
- package/lib/global.d.ts.map +1 -1
- package/lib/global.js +3 -1
- package/lib/global.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- 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 +17 -13
- package/lib/output.d.ts.map +1 -1
- package/lib/output.js +2 -2
- package/lib/output.js.map +1 -1
- package/lib/resource.d.ts +3 -2
- package/lib/resource.d.ts.map +1 -1
- package/lib/resource.js +2 -2
- package/lib/resource.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 +26 -8
- package/src/apply.ts +5 -5
- package/src/aws/index.ts +1 -0
- package/src/aws/ses.ts +346 -0
- package/src/cloudflare/api.ts +276 -0
- package/src/cloudflare/asset-manifest.ts +16 -0
- package/src/cloudflare/auth.ts +187 -0
- package/src/cloudflare/bindings.ts +286 -0
- package/src/cloudflare/generate-asset-manifest.ts +93 -0
- package/src/cloudflare/index.ts +5 -0
- package/src/cloudflare/kv-namespace.ts +195 -0
- package/src/cloudflare/state.ts +138 -0
- package/src/cloudflare/static-site-router.ts +108 -0
- package/src/cloudflare/static-site.ts +379 -0
- package/src/cloudflare/types.ts +71 -0
- package/src/cloudflare/upload-asset-manifest.ts +83 -0
- package/src/cloudflare/worker.ts +568 -0
- package/src/esbuild.ts +31 -22
- package/src/global.ts +1 -0
- package/src/index.ts +0 -1
- package/src/main.ts +1 -1
- package/src/output.ts +32 -32
- package/src/resource.ts +11 -5
- package/src/utils/content-type.ts +42 -0
- package/lib/$.d.ts +0 -7
- package/lib/$.d.ts.map +0 -1
- package/lib/$.js +0 -31
- package/lib/$.js.map +0 -1
- 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/$.ts +0 -36
- 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
package/lib/markdown/design.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { tool } from "ai";
|
|
2
|
-
import fs from "node:fs/promises";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import { dependenciesAsMessages, generateText, resolveModel, } from "../agent";
|
|
6
|
-
import { Prompts } from "../agent/prompts";
|
|
7
|
-
import { rm } from "../fs";
|
|
8
|
-
import { extractMarkdown } from "../markdown/extract";
|
|
9
|
-
import { Resource } from "../resource";
|
|
10
|
-
export class Design extends Resource("design", async (ctx, props) => {
|
|
11
|
-
if (ctx.event === "delete") {
|
|
12
|
-
await rm(props.path);
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const model = await resolveModel(props.model ?? "gpt-4o");
|
|
16
|
-
const loadFile = tool({
|
|
17
|
-
description: "Load a relevant file into context",
|
|
18
|
-
parameters: z.object({
|
|
19
|
-
file: z.string(),
|
|
20
|
-
}),
|
|
21
|
-
execute: async ({ file }) => fs.readFile(file, "utf-8"),
|
|
22
|
-
});
|
|
23
|
-
let existingContent = undefined;
|
|
24
|
-
if (ctx.event === "update") {
|
|
25
|
-
if (props.path) {
|
|
26
|
-
try {
|
|
27
|
-
existingContent = await fs.readFile(props.path, "utf-8");
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
// File doesn't exist yet, continue with empty content
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
existingContent = ctx.output.content;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
console.log(ctx.event === "create" ? "Designing" : "Revising design", ":", props.path);
|
|
38
|
-
const result = await generateText({
|
|
39
|
-
model,
|
|
40
|
-
// tools: {
|
|
41
|
-
// import: importFile,
|
|
42
|
-
// },
|
|
43
|
-
providerOptions: props.model === "o3-mini"
|
|
44
|
-
? {
|
|
45
|
-
openai: {
|
|
46
|
-
reasoningEffort: "high",
|
|
47
|
-
},
|
|
48
|
-
}
|
|
49
|
-
: undefined,
|
|
50
|
-
messages: [
|
|
51
|
-
{
|
|
52
|
-
role: "system",
|
|
53
|
-
content: Prompts.program,
|
|
54
|
-
},
|
|
55
|
-
...dependenciesAsMessages(props.dependencies),
|
|
56
|
-
...(existingContent
|
|
57
|
-
? [
|
|
58
|
-
{
|
|
59
|
-
role: "user",
|
|
60
|
-
content: `Here is the prior version of ${props.path}:\n${existingContent}`,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
role: "assistant",
|
|
64
|
-
content: "Thanks, I'll make sure to consider this when producing the next revision.",
|
|
65
|
-
},
|
|
66
|
-
]
|
|
67
|
-
: []),
|
|
68
|
-
{
|
|
69
|
-
role: "user",
|
|
70
|
-
content: props.prompt,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
role: "user",
|
|
74
|
-
content: [
|
|
75
|
-
`Make sure to list each of the files that need to be implemented and`,
|
|
76
|
-
"and to follow best practices in term of separation of concerns.",
|
|
77
|
-
"Ideally, each component has its own dedicated file.",
|
|
78
|
-
"Each file should be referenced using markdown links, e.g. [file.ts](./file.ts).",
|
|
79
|
-
].join(" "),
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
});
|
|
83
|
-
const content = extractMarkdown(result.text);
|
|
84
|
-
await fs.mkdir(path.dirname(props.path), { recursive: true });
|
|
85
|
-
await fs.writeFile(props.path, content);
|
|
86
|
-
return {
|
|
87
|
-
path: props.path,
|
|
88
|
-
content,
|
|
89
|
-
};
|
|
90
|
-
}) {
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=design.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"design.js","sourceRoot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,CAAC,IAAI,CAAC,GAAG,CAAC;aACZ;SACF;KACF,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE7C,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE9D,MAAM,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAExC,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO;KACR,CAAC;AACJ,CAAC,CACF;CAAG"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts markdown content from a code block or returns the full content
|
|
3
|
-
* @param text Response text that may contain markdown code blocks
|
|
4
|
-
* @returns The markdown content from code block if found, otherwise returns the full text
|
|
5
|
-
*/
|
|
6
|
-
export declare function extractMarkdown(text: string): string;
|
|
7
|
-
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/markdown/extract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGpD"}
|
package/lib/markdown/extract.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts markdown content from a code block or returns the full content
|
|
3
|
-
* @param text Response text that may contain markdown code blocks
|
|
4
|
-
* @returns The markdown content from code block if found, otherwise returns the full text
|
|
5
|
-
*/
|
|
6
|
-
export function extractMarkdown(text) {
|
|
7
|
-
const matches = text.match(/```md\n([\s\S]*?)```/);
|
|
8
|
-
return matches?.[1]?.trim() ?? text.trim();
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=extract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../src/markdown/extract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACnD,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;AAC7C,CAAC"}
|
package/lib/markdown/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/markdown/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
|
package/lib/markdown/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/markdown/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const ReasoningEffort: z.ZodEnum<["low", "medium", "high"]>;
|
|
3
|
-
export declare const RequirementsInput: z.ZodObject<{
|
|
4
|
-
/**
|
|
5
|
-
* The ID of the model to use for generating requirements documentation
|
|
6
|
-
* @default "gpt-4o"
|
|
7
|
-
*/
|
|
8
|
-
modelId: z.ZodOptional<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"]>]>>;
|
|
9
|
-
/**
|
|
10
|
-
* The effort to put into reasoning about the requirements
|
|
11
|
-
*/
|
|
12
|
-
reasoningEffort: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
13
|
-
/**
|
|
14
|
-
* List of requirements to document and analyze
|
|
15
|
-
*/
|
|
16
|
-
requirements: z.ZodArray<z.ZodString, "many">;
|
|
17
|
-
/**
|
|
18
|
-
* List of dependencies for the requirements document
|
|
19
|
-
*/
|
|
20
|
-
dependencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
|
-
path: z.ZodString;
|
|
22
|
-
content: z.ZodOptional<z.ZodString>;
|
|
23
|
-
}, "strip", z.ZodTypeAny, {
|
|
24
|
-
path: string;
|
|
25
|
-
content?: string | undefined;
|
|
26
|
-
}, {
|
|
27
|
-
path: string;
|
|
28
|
-
content?: string | undefined;
|
|
29
|
-
}>, "many">>;
|
|
30
|
-
/**
|
|
31
|
-
* Temperature setting for model generation (higher = more creative, lower = more focused)
|
|
32
|
-
* @default 0.7
|
|
33
|
-
*/
|
|
34
|
-
temperature: z.ZodOptional<z.ZodNumber>;
|
|
35
|
-
/**
|
|
36
|
-
* File path where the requirements document should be written
|
|
37
|
-
*/
|
|
38
|
-
file: z.ZodOptional<z.ZodString>;
|
|
39
|
-
}, "strip", z.ZodTypeAny, {
|
|
40
|
-
requirements: string[];
|
|
41
|
-
temperature?: number | undefined;
|
|
42
|
-
file?: string | undefined;
|
|
43
|
-
reasoningEffort?: "high" | "low" | "medium" | undefined;
|
|
44
|
-
modelId?: "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" | "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" | undefined;
|
|
45
|
-
dependencies?: {
|
|
46
|
-
path: string;
|
|
47
|
-
content?: string | undefined;
|
|
48
|
-
}[] | undefined;
|
|
49
|
-
}, {
|
|
50
|
-
requirements: string[];
|
|
51
|
-
temperature?: number | undefined;
|
|
52
|
-
file?: string | undefined;
|
|
53
|
-
reasoningEffort?: "high" | "low" | "medium" | undefined;
|
|
54
|
-
modelId?: "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" | "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" | undefined;
|
|
55
|
-
dependencies?: {
|
|
56
|
-
path: string;
|
|
57
|
-
content?: string | undefined;
|
|
58
|
-
}[] | undefined;
|
|
59
|
-
}>;
|
|
60
|
-
export declare const RequirementsOutput: z.ZodObject<{
|
|
61
|
-
/**
|
|
62
|
-
* Generated markdown document containing organized and analyzed requirements
|
|
63
|
-
*/
|
|
64
|
-
content: z.ZodString;
|
|
65
|
-
}, "strip", z.ZodTypeAny, {
|
|
66
|
-
content: string;
|
|
67
|
-
}, {
|
|
68
|
-
content: string;
|
|
69
|
-
}>;
|
|
70
|
-
export interface RequirementsInput extends z.infer<typeof RequirementsInput> {
|
|
71
|
-
}
|
|
72
|
-
export type RequirementsOutput = z.infer<typeof RequirementsOutput>;
|
|
73
|
-
declare const Requirements_base: import("../resource").Provider<"code::Requirements", [props: RequirementsInput], {
|
|
74
|
-
content: string;
|
|
75
|
-
}>;
|
|
76
|
-
export declare class Requirements extends Requirements_base {
|
|
77
|
-
}
|
|
78
|
-
export {};
|
|
79
|
-
//# sourceMappingURL=requirements.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"requirements.d.ts","sourceRoot":"","sources":["../../src/markdown/requirements.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,eAAe,sCAAoC,CAAC;AAEjE,eAAO,MAAM,iBAAiB;IAC5B;;;OAGG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;IAGH;;;OAGG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,eAAO,MAAM,kBAAkB;IAC7B;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,WAAW,iBAAkB,SAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC;CAAG;AAC/E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;;;;AAEpE,qBAAa,YAAa,SAAQ,iBA2EjC;CAAG"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
2
|
-
import { dirname } from "path";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { FileContext, ModelId, dependenciesAsMessages, generateText, resolveModel, } from "../agent";
|
|
5
|
-
import { rm } from "../fs";
|
|
6
|
-
import { Resource } from "../resource";
|
|
7
|
-
export const ReasoningEffort = z.enum(["low", "medium", "high"]);
|
|
8
|
-
export const RequirementsInput = z.object({
|
|
9
|
-
/**
|
|
10
|
-
* The ID of the model to use for generating requirements documentation
|
|
11
|
-
* @default "gpt-4o"
|
|
12
|
-
*/
|
|
13
|
-
modelId: ModelId.optional(),
|
|
14
|
-
/**
|
|
15
|
-
* The effort to put into reasoning about the requirements
|
|
16
|
-
*/
|
|
17
|
-
reasoningEffort: ReasoningEffort.optional(),
|
|
18
|
-
/**
|
|
19
|
-
* List of requirements to document and analyze
|
|
20
|
-
*/
|
|
21
|
-
requirements: z.array(z.string()),
|
|
22
|
-
/**
|
|
23
|
-
* List of dependencies for the requirements document
|
|
24
|
-
*/
|
|
25
|
-
dependencies: z.array(FileContext).optional(),
|
|
26
|
-
/**
|
|
27
|
-
* Temperature setting for model generation (higher = more creative, lower = more focused)
|
|
28
|
-
* @default 0.7
|
|
29
|
-
*/
|
|
30
|
-
temperature: z.number().optional(),
|
|
31
|
-
/**
|
|
32
|
-
* File path where the requirements document should be written
|
|
33
|
-
*/
|
|
34
|
-
file: z.string().optional(),
|
|
35
|
-
});
|
|
36
|
-
export const RequirementsOutput = z.object({
|
|
37
|
-
/**
|
|
38
|
-
* Generated markdown document containing organized and analyzed requirements
|
|
39
|
-
*/
|
|
40
|
-
content: z.string(),
|
|
41
|
-
});
|
|
42
|
-
export class Requirements extends Resource("code::Requirements", async (ctx, props) => {
|
|
43
|
-
if (ctx.event === "delete") {
|
|
44
|
-
if (props.file) {
|
|
45
|
-
await rm(props.file);
|
|
46
|
-
}
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (props.file) {
|
|
50
|
-
console.log(ctx.event === "create" ? "Designing" : "Revising", "requirements", props.file);
|
|
51
|
-
}
|
|
52
|
-
// Get the appropriate model based on the ID
|
|
53
|
-
const model = await resolveModel(props.modelId ?? "gpt-4o");
|
|
54
|
-
// Generate the requirements document
|
|
55
|
-
const { text } = await generateText({
|
|
56
|
-
model,
|
|
57
|
-
temperature: props.temperature ?? 0.7,
|
|
58
|
-
maxSteps: 3, // Allow multiple steps for potential tool usage
|
|
59
|
-
providerOptions: props.reasoningEffort
|
|
60
|
-
? {
|
|
61
|
-
openai: {
|
|
62
|
-
reasoningEffort: props.reasoningEffort,
|
|
63
|
-
},
|
|
64
|
-
}
|
|
65
|
-
: undefined,
|
|
66
|
-
tools: {
|
|
67
|
-
// scrapeWebPage,
|
|
68
|
-
},
|
|
69
|
-
messages: [
|
|
70
|
-
{
|
|
71
|
-
role: "system",
|
|
72
|
-
content: "You are a helpful assistant that creates markdown documents from requirements. You can use the scrapeWebPage tool to get additional requirements from relevant URLs if needed.",
|
|
73
|
-
},
|
|
74
|
-
...dependenciesAsMessages(props.dependencies ?? []),
|
|
75
|
-
{
|
|
76
|
-
role: "user",
|
|
77
|
-
content: `Please analyze the following system requirements and create a comprehensive, unambiguous markdown document that covers all aspects:
|
|
78
|
-
|
|
79
|
-
Requirements:
|
|
80
|
-
${props.requirements.map((req) => `- ${req}`).join("\n")}
|
|
81
|
-
|
|
82
|
-
Guidelines:
|
|
83
|
-
1. Make explicit decisions for any ambiguous requirements - do not leave open questions
|
|
84
|
-
2. Document the reasoning behind key decisions
|
|
85
|
-
3. Be specific about technical choices and implementation details
|
|
86
|
-
4. Avoid phrases like "could be", "might need", or "possibly requires" - be definitive
|
|
87
|
-
5. Organize requirements into logical sections with clear dependencies and relationships
|
|
88
|
-
|
|
89
|
-
Format the output in markdown with appropriate headers, lists, and sections, starting with the title as an H1 header.
|
|
90
|
-
Include technical considerations and implementation details, ensuring every requirement has a clear, actionable specification.`,
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
});
|
|
94
|
-
if (props.file) {
|
|
95
|
-
// Ensure the directory exists
|
|
96
|
-
await mkdir(dirname(props.file), { recursive: true });
|
|
97
|
-
// Write the requirements to the file
|
|
98
|
-
await writeFile(props.file, text);
|
|
99
|
-
}
|
|
100
|
-
return {
|
|
101
|
-
content: text,
|
|
102
|
-
};
|
|
103
|
-
}) {
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=requirements.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"requirements.js","sourceRoot":"","sources":["../../src/markdown/requirements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,OAAO,EACP,sBAAsB,EACtB,YAAY,EACZ,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAgB,QAAQ,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,CAAC,M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../src/typescript/check-omission.ts"],"names":[],"mappings":"AAWA,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAmCzE"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { generateObject } from "../agent/ai";
|
|
3
|
-
import { resolveModel } from "../agent/model";
|
|
4
|
-
const CodeOmissionCheck = z.object({
|
|
5
|
-
hasOmittedCode: z.boolean(),
|
|
6
|
-
explanation: z.string(),
|
|
7
|
-
});
|
|
8
|
-
const haiku = await resolveModel("claude-3-5-haiku-latest");
|
|
9
|
-
export async function checkForCodeOmission(code) {
|
|
10
|
-
const result = await generateObject({
|
|
11
|
-
model: haiku,
|
|
12
|
-
schema: CodeOmissionCheck,
|
|
13
|
-
temperature: 0.1,
|
|
14
|
-
messages: [
|
|
15
|
-
{
|
|
16
|
-
role: "system",
|
|
17
|
-
content: "You are checking for signs of code omission in TypeScript code. Look for comments that indicate abbreviated or omitted content.",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
role: "user",
|
|
21
|
-
content: `Check this code for any signs of content being lazily omitted:
|
|
22
|
-
|
|
23
|
-
\`\`\`typescript
|
|
24
|
-
${code}
|
|
25
|
-
\`\`\`
|
|
26
|
-
|
|
27
|
-
Look for patterns like:
|
|
28
|
-
- "// rest of the ..."
|
|
29
|
-
- "// remaining code ..."
|
|
30
|
-
- "// ... existing code ..."
|
|
31
|
-
- "// other methods ..."
|
|
32
|
-
- "// etc ..."
|
|
33
|
-
- "// Implementation would go here"
|
|
34
|
-
- "// For now just ..."
|
|
35
|
-
- Any similar comments that indicate code was abbreviated
|
|
36
|
-
|
|
37
|
-
Only answer true if you find such comments indicating omitted content. Otherwise answer false.`,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
});
|
|
41
|
-
return result.object.hasOmittedCode;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=check-omission.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check-omission.js","sourceRoot":"","sources":["../../src/typescript/check-omission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;IAC3B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;CACxB,CAAC,CAAC;AAEH,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,yBAAyB,CAAC,CAAC;AAE5D,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAAY;IACrD,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC;QAClC,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,iBAAiB;QACzB,WAAW,EAAE,GAAG;QAChB,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,QAAQ;gBACd,OAAO,EACL,iIAAiI;aACpI;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;;;EAGf,IAAI;;;;;;;;;;;;;+FAayF;aACxF;SACF;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;AACtC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug-type-errors.d.ts","sourceRoot":"","sources":["../../src/typescript/debug-type-errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAItC,wBAAsB,eAAe,CACnC,QAAQ,EAAE,WAAW,EAAE,EACvB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAkCjB"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { generateText } from "../agent/ai";
|
|
2
|
-
import { resolveModel } from "../agent/model";
|
|
3
|
-
export async function debugTypeErrors(messages, typeErrors) {
|
|
4
|
-
const o3Model = await resolveModel("o3-mini");
|
|
5
|
-
// Get diagnostic analysis from o3-mini
|
|
6
|
-
const consultationMessages = [
|
|
7
|
-
...messages,
|
|
8
|
-
{
|
|
9
|
-
role: "user",
|
|
10
|
-
content: `Analyze these TypeScript errors and the code to identify the root causes:
|
|
11
|
-
|
|
12
|
-
TypeScript errors:
|
|
13
|
-
${typeErrors}
|
|
14
|
-
|
|
15
|
-
Please help by:
|
|
16
|
-
1. Diagnosing the root cause of any type errors
|
|
17
|
-
2. Identifying specific sections of code that need to change
|
|
18
|
-
3. Providing step-by-step guidance on how to fix them
|
|
19
|
-
|
|
20
|
-
Focus only on type-related issues and necessary fixes.`,
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
const { text: analysis } = await generateText({
|
|
24
|
-
model: o3Model,
|
|
25
|
-
temperature: 0.1,
|
|
26
|
-
providerOptions: {
|
|
27
|
-
openai: {
|
|
28
|
-
reasoningEffort: "high",
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
messages: consultationMessages,
|
|
32
|
-
});
|
|
33
|
-
return analysis;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=debug-type-errors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug-type-errors.js","sourceRoot":"","sources":["../../src/typescript/debug-type-errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,QAAuB,EACvB,UAAkB;IAElB,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,SAAS,CAAC,CAAC;IAE9C,uCAAuC;IACvC,MAAM,oBAAoB,GAAkB;QAC1C,GAAG,QAAQ;QACX;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;;;EAGb,UAAU;;;;;;;uDAO2C;SAClD;KACF,CAAC;IAEF,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,YAAY,CAAC;QAC5C,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,GAAG;QAChB,eAAe,EAAE;YACf,MAAM,EAAE;gBACN,eAAe,EAAE,MAAM;aACxB;SACF;QACD,QAAQ,EAAE,oBAAoB;KAC/B,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts TypeScript code from a markdown code block
|
|
3
|
-
* @param text Response text that may contain markdown
|
|
4
|
-
* @returns The TypeScript code if found, undefined otherwise
|
|
5
|
-
*/
|
|
6
|
-
export declare function extractTypeScriptCode(text: string): string | undefined;
|
|
7
|
-
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/typescript/extract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGtE"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts TypeScript code from a markdown code block
|
|
3
|
-
* @param text Response text that may contain markdown
|
|
4
|
-
* @returns The TypeScript code if found, undefined otherwise
|
|
5
|
-
*/
|
|
6
|
-
export function extractTypeScriptCode(text) {
|
|
7
|
-
const matches = text.match(/```(?:ts|typescript)\n([\s\S]*?)```/);
|
|
8
|
-
return matches?.[1]?.trim();
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=extract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../src/typescript/extract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;IAClE,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/typescript/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
package/lib/typescript/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/typescript/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const installDependencies: import("ai").Tool<z.ZodObject<{
|
|
3
|
-
packages: z.ZodArray<z.ZodString, "many">;
|
|
4
|
-
type: z.ZodOptional<z.ZodEnum<["runtime", "dev", "peer"]>>;
|
|
5
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
packages: string[];
|
|
7
|
-
type?: "dev" | "runtime" | "peer" | undefined;
|
|
8
|
-
}, {
|
|
9
|
-
packages: string[];
|
|
10
|
-
type?: "dev" | "runtime" | "peer" | undefined;
|
|
11
|
-
}>, {
|
|
12
|
-
success: boolean;
|
|
13
|
-
command: string;
|
|
14
|
-
output: string;
|
|
15
|
-
packages: string[];
|
|
16
|
-
type: "dev" | "runtime" | "peer" | undefined;
|
|
17
|
-
}> & {
|
|
18
|
-
execute: (args: {
|
|
19
|
-
packages: string[];
|
|
20
|
-
type?: "dev" | "runtime" | "peer" | undefined;
|
|
21
|
-
}, options: import("ai").ToolExecutionOptions) => PromiseLike<{
|
|
22
|
-
success: boolean;
|
|
23
|
-
command: string;
|
|
24
|
-
output: string;
|
|
25
|
-
packages: string[];
|
|
26
|
-
type: "dev" | "runtime" | "peer" | undefined;
|
|
27
|
-
}>;
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=install-dependencies.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install-dependencies.d.ts","sourceRoot":"","sources":["../../src/typescript/install-dependencies.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;CAqD9B,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { tool } from "ai";
|
|
2
|
-
import { exec } from "child_process";
|
|
3
|
-
import { promisify } from "util";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
const execAsync = promisify(exec);
|
|
6
|
-
export const installDependencies = tool({
|
|
7
|
-
description: "Installs dependencies using bun with support for different dependency types (runtime, dev, or peer)",
|
|
8
|
-
parameters: z.object({
|
|
9
|
-
packages: z.array(z.string()).describe("Array of package names to install"),
|
|
10
|
-
type: z
|
|
11
|
-
.enum(["runtime", "dev", "peer"])
|
|
12
|
-
.optional()
|
|
13
|
-
.describe("Type of dependency to install: runtime, dev, or peer. Default 'runtime'."),
|
|
14
|
-
}),
|
|
15
|
-
execute: async ({ packages, type }) => {
|
|
16
|
-
if (packages.length === 0) {
|
|
17
|
-
throw new Error("No packages specified for installation");
|
|
18
|
-
}
|
|
19
|
-
let command = "bun add";
|
|
20
|
-
// Add appropriate flags based on dependency type
|
|
21
|
-
switch (type) {
|
|
22
|
-
case "dev":
|
|
23
|
-
command += " -D";
|
|
24
|
-
break;
|
|
25
|
-
case "peer":
|
|
26
|
-
command += " --peer";
|
|
27
|
-
break;
|
|
28
|
-
// runtime dependencies don't need a special flag
|
|
29
|
-
}
|
|
30
|
-
// Add packages to the command
|
|
31
|
-
command += " " + packages.join(" ");
|
|
32
|
-
try {
|
|
33
|
-
console.log(`Executing: ${command}`);
|
|
34
|
-
const { stdout, stderr } = await execAsync(command);
|
|
35
|
-
if (stderr) {
|
|
36
|
-
console.warn("Installation warnings:", stderr);
|
|
37
|
-
}
|
|
38
|
-
return {
|
|
39
|
-
success: true,
|
|
40
|
-
command,
|
|
41
|
-
output: stdout,
|
|
42
|
-
packages,
|
|
43
|
-
type,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
console.error("Installation failed:", error);
|
|
48
|
-
throw new Error(`Failed to install packages: ${error.message}`);
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
//# sourceMappingURL=install-dependencies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install-dependencies.js","sourceRoot":"","sources":["../../src/typescript/install-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAElC,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;IACtC,WAAW,EACT,qGAAqG;IACvG,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;QACnB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,mCAAmC,CAAC;QAC3E,IAAI,EAAE,CAAC;aACJ,IAAI,CA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