alchemy 0.1.8 → 0.1.9
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/lib/$.d.ts +7 -0
- package/lib/$.d.ts.map +1 -0
- package/lib/$.js +31 -0
- package/lib/$.js.map +1 -0
- package/lib/agent/ai.d.ts +40 -0
- package/lib/agent/ai.d.ts.map +1 -0
- package/lib/agent/ai.js +132 -0
- package/lib/agent/ai.js.map +1 -0
- package/lib/agent/anthropic.d.ts +9 -0
- package/lib/agent/anthropic.d.ts.map +1 -0
- package/lib/agent/anthropic.js +25 -0
- package/lib/agent/anthropic.js.map +1 -0
- package/lib/agent/dependencies.d.ts +4 -0
- package/lib/agent/dependencies.d.ts.map +1 -0
- package/lib/agent/dependencies.js +48 -0
- package/lib/agent/dependencies.js.map +1 -0
- package/lib/agent/file-context.d.ts +13 -0
- package/lib/agent/file-context.d.ts.map +1 -0
- package/lib/agent/file-context.js +6 -0
- package/lib/agent/file-context.js.map +1 -0
- package/lib/agent/index.d.ts +10 -0
- package/lib/agent/index.d.ts.map +1 -0
- package/lib/agent/index.js +10 -0
- package/lib/agent/index.js.map +1 -0
- package/lib/agent/model.d.ts +8 -0
- package/lib/agent/model.d.ts.map +1 -0
- package/lib/agent/model.js +29 -0
- package/lib/agent/model.js.map +1 -0
- package/lib/agent/module.d.ts +81 -0
- package/lib/agent/module.d.ts.map +1 -0
- package/lib/agent/module.js +309 -0
- package/lib/agent/module.js.map +1 -0
- package/lib/agent/openai.d.ts +6 -0
- package/lib/agent/openai.d.ts.map +1 -0
- package/lib/agent/openai.js +41 -0
- package/lib/agent/openai.js.map +1 -0
- package/lib/agent/program.d.ts +12 -0
- package/lib/agent/program.d.ts.map +1 -0
- package/lib/agent/program.js +21 -0
- package/lib/agent/program.js.map +1 -0
- package/lib/agent/prompts.d.ts +4 -0
- package/lib/agent/prompts.d.ts.map +1 -0
- package/lib/agent/prompts.js +11 -0
- package/lib/agent/prompts.js.map +1 -0
- package/lib/agent/scrape.d.ts +71 -0
- package/lib/agent/scrape.d.ts.map +1 -0
- package/lib/agent/scrape.js +45 -0
- package/lib/agent/scrape.js.map +1 -0
- package/lib/alchemize.d.ts +43 -0
- package/lib/alchemize.d.ts.map +1 -0
- package/lib/alchemize.js +105 -0
- package/lib/alchemize.js.map +1 -0
- package/lib/apply.d.ts +23 -0
- package/lib/apply.d.ts.map +1 -0
- package/lib/apply.js +84 -0
- package/lib/apply.js.map +1 -0
- package/lib/aws/auto/docs.d.ts +11 -0
- package/lib/aws/auto/docs.d.ts.map +1 -0
- package/lib/aws/auto/docs.js +56 -0
- package/lib/aws/auto/docs.js.map +1 -0
- package/lib/aws/auto/index.d.ts +5 -0
- package/lib/aws/auto/index.d.ts.map +1 -0
- package/lib/aws/auto/index.js +5 -0
- package/lib/aws/auto/index.js.map +1 -0
- package/lib/aws/auto/resource.d.ts +24 -0
- package/lib/aws/auto/resource.d.ts.map +1 -0
- package/lib/aws/auto/resource.js +194 -0
- package/lib/aws/auto/resource.js.map +1 -0
- package/lib/aws/auto/service.d.ts +10 -0
- package/lib/aws/auto/service.d.ts.map +1 -0
- package/lib/aws/auto/service.js +34 -0
- package/lib/aws/auto/service.js.map +1 -0
- package/lib/aws/auto/spec.d.ts +83 -0
- package/lib/aws/auto/spec.d.ts.map +1 -0
- package/lib/aws/auto/spec.js +58 -0
- package/lib/aws/auto/spec.js.map +1 -0
- package/lib/aws/bucket.d.ts +21 -0
- package/lib/aws/bucket.d.ts.map +1 -0
- package/lib/aws/bucket.js +114 -0
- package/lib/aws/bucket.js.map +1 -0
- package/lib/aws/function.d.ts +53 -0
- package/lib/aws/function.d.ts.map +1 -0
- package/lib/aws/function.js +195 -0
- package/lib/aws/function.js.map +1 -0
- package/lib/aws/index.d.ts +7 -0
- package/lib/aws/index.d.ts.map +1 -0
- package/lib/aws/index.js +7 -0
- package/lib/aws/index.js.map +1 -0
- package/lib/aws/policy.d.ts +46 -0
- package/lib/aws/policy.d.ts.map +1 -0
- package/lib/aws/policy.js +139 -0
- package/lib/aws/policy.js.map +1 -0
- package/lib/aws/queue.d.ts +38 -0
- package/lib/aws/queue.d.ts.map +1 -0
- package/lib/aws/queue.js +162 -0
- package/lib/aws/queue.js.map +1 -0
- package/lib/aws/role.d.ts +27 -0
- package/lib/aws/role.d.ts.map +1 -0
- package/lib/aws/role.js +149 -0
- package/lib/aws/role.js.map +1 -0
- package/lib/aws/table.d.ts +26 -0
- package/lib/aws/table.d.ts.map +1 -0
- package/lib/aws/table.js +120 -0
- package/lib/aws/table.js.map +1 -0
- package/lib/destroy.d.ts +19 -0
- package/lib/destroy.d.ts.map +1 -0
- package/lib/destroy.js +47 -0
- package/lib/destroy.js.map +1 -0
- package/lib/error.d.ts +2 -0
- package/lib/error.d.ts.map +1 -0
- package/lib/error.js +13 -0
- package/lib/error.js.map +1 -0
- package/lib/esbuild.d.ts +70 -0
- package/lib/esbuild.d.ts.map +1 -0
- package/lib/esbuild.js +58 -0
- package/lib/esbuild.js.map +1 -0
- package/lib/fs.d.ts +12 -0
- package/lib/fs.d.ts.map +1 -0
- package/lib/fs.js +41 -0
- package/lib/fs.js.map +1 -0
- package/lib/global.d.ts +18 -0
- package/lib/global.d.ts.map +1 -0
- package/lib/global.js +42 -0
- package/lib/global.js.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -0
- package/lib/input.d.ts +6 -0
- package/lib/input.d.ts.map +1 -0
- package/lib/input.js +2 -0
- package/lib/input.js.map +1 -0
- package/lib/main.d.ts +3 -0
- package/lib/main.d.ts.map +1 -0
- package/lib/main.js +32 -0
- package/lib/main.js.map +1 -0
- package/lib/markdown/design.d.ts +17 -0
- package/lib/markdown/design.d.ts.map +1 -0
- package/lib/markdown/design.js +92 -0
- package/lib/markdown/design.js.map +1 -0
- package/lib/markdown/extract.d.ts +7 -0
- package/lib/markdown/extract.d.ts.map +1 -0
- package/lib/markdown/extract.js +10 -0
- package/lib/markdown/extract.js.map +1 -0
- package/lib/markdown/index.d.ts +4 -0
- package/lib/markdown/index.d.ts.map +1 -0
- package/lib/markdown/index.js +4 -0
- package/lib/markdown/index.js.map +1 -0
- package/lib/markdown/requirements.d.ts +79 -0
- package/lib/markdown/requirements.d.ts.map +1 -0
- package/lib/markdown/requirements.js +105 -0
- package/lib/markdown/requirements.js.map +1 -0
- package/lib/output.d.ts +19 -0
- package/lib/output.d.ts.map +1 -0
- package/lib/output.js +16 -0
- package/lib/output.js.map +1 -0
- package/lib/resource.d.ts +66 -0
- package/lib/resource.d.ts.map +1 -0
- package/lib/resource.js +242 -0
- package/lib/resource.js.map +1 -0
- package/lib/scope.d.ts +15 -0
- package/lib/scope.d.ts.map +1 -0
- package/lib/scope.js +38 -0
- package/lib/scope.js.map +1 -0
- package/lib/slug.d.ts +2 -0
- package/lib/slug.d.ts.map +1 -0
- package/lib/slug.js +4 -0
- package/lib/slug.js.map +1 -0
- package/lib/state.d.ts +40 -0
- package/lib/state.d.ts.map +1 -0
- package/lib/state.js +73 -0
- package/lib/state.js.map +1 -0
- package/lib/stripe/index.d.ts +4 -0
- package/lib/stripe/index.d.ts.map +1 -0
- package/lib/stripe/index.js +4 -0
- package/lib/stripe/index.js.map +1 -0
- package/lib/stripe/price.d.ts +109 -0
- package/lib/stripe/price.d.ts.map +1 -0
- package/lib/stripe/price.js +112 -0
- package/lib/stripe/price.js.map +1 -0
- package/lib/stripe/product.d.ts +86 -0
- package/lib/stripe/product.d.ts.map +1 -0
- package/lib/stripe/product.js +90 -0
- package/lib/stripe/product.js.map +1 -0
- package/lib/stripe/webhook.d.ts +73 -0
- package/lib/stripe/webhook.d.ts.map +1 -0
- package/lib/stripe/webhook.js +94 -0
- package/lib/stripe/webhook.js.map +1 -0
- package/lib/typescript/check-omission.d.ts +2 -0
- package/lib/typescript/check-omission.d.ts.map +1 -0
- package/lib/typescript/check-omission.js +43 -0
- package/lib/typescript/check-omission.js.map +1 -0
- package/lib/typescript/debug-type-errors.d.ts +3 -0
- package/lib/typescript/debug-type-errors.d.ts.map +1 -0
- package/lib/typescript/debug-type-errors.js +35 -0
- package/lib/typescript/debug-type-errors.js.map +1 -0
- package/lib/typescript/extract.d.ts +7 -0
- package/lib/typescript/extract.d.ts.map +1 -0
- package/lib/typescript/extract.js +10 -0
- package/lib/typescript/extract.js.map +1 -0
- package/lib/typescript/index.d.ts +7 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/index.js +7 -0
- package/lib/typescript/index.js.map +1 -0
- package/lib/typescript/install-dependencies.d.ts +29 -0
- package/lib/typescript/install-dependencies.d.ts.map +1 -0
- package/lib/typescript/install-dependencies.js +52 -0
- package/lib/typescript/install-dependencies.js.map +1 -0
- package/lib/typescript/package.d.ts +157 -0
- package/lib/typescript/package.d.ts.map +1 -0
- package/lib/typescript/package.js +115 -0
- package/lib/typescript/package.js.map +1 -0
- package/lib/typescript/repair-omissions.d.ts +3 -0
- package/lib/typescript/repair-omissions.d.ts.map +1 -0
- package/lib/typescript/repair-omissions.js +23 -0
- package/lib/typescript/repair-omissions.js.map +1 -0
- package/lib/typescript/repair.d.ts +3 -0
- package/lib/typescript/repair.d.ts.map +1 -0
- package/lib/typescript/repair.js +34 -0
- package/lib/typescript/repair.js.map +1 -0
- package/lib/typescript/tsconfig.d.ts +469 -0
- package/lib/typescript/tsconfig.d.ts.map +1 -0
- package/lib/typescript/tsconfig.js +143 -0
- package/lib/typescript/tsconfig.js.map +1 -0
- package/lib/typescript/typescript.d.ts +107 -0
- package/lib/typescript/typescript.d.ts.map +1 -0
- package/lib/typescript/typescript.js +180 -0
- package/lib/typescript/typescript.js.map +1 -0
- package/lib/typescript/validate.d.ts +10 -0
- package/lib/typescript/validate.d.ts.map +1 -0
- package/lib/typescript/validate.js +49 -0
- package/lib/typescript/validate.js.map +1 -0
- package/package.json +2 -1
- package/test/aws/function.test.ts +0 -144
- package/test/aws/queue.test.ts +0 -85
- package/test/aws/role.test.ts +0 -153
- package/test/aws/table.test.ts +0 -73
- package/test/esbuild.test.ts +0 -41
- package/test/handler.ts +0 -9
- package/test/scope.test.ts +0 -67
- package/test/stripe/stripe.test.ts +0 -136
- package/tsconfig.json +0 -33
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { createPatch } from "diff";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { Folder } from "../fs";
|
|
5
|
+
import { Design } from "../markdown/design";
|
|
6
|
+
import { Requirements } from "../markdown/requirements";
|
|
7
|
+
import { Resource, } from "../resource";
|
|
8
|
+
import { slugify } from "../slug";
|
|
9
|
+
import { TypeScriptFile } from "../typescript";
|
|
10
|
+
import { generateObject } from "./ai";
|
|
11
|
+
import { dependenciesAsMessages } from "./dependencies";
|
|
12
|
+
import { resolveModel } from "./model";
|
|
13
|
+
import { Prompts } from "./prompts";
|
|
14
|
+
const ProjectFileType = z.enum([
|
|
15
|
+
"folder",
|
|
16
|
+
"design",
|
|
17
|
+
"typescript",
|
|
18
|
+
// "package.json",
|
|
19
|
+
// "tsconfig.json",
|
|
20
|
+
"css",
|
|
21
|
+
"scss",
|
|
22
|
+
"javascript",
|
|
23
|
+
"html",
|
|
24
|
+
]);
|
|
25
|
+
const upstream = z
|
|
26
|
+
.array(z.string())
|
|
27
|
+
.describe([
|
|
28
|
+
"A list of all this file's upstream dependencies (files and folders).",
|
|
29
|
+
"These files and folders must exist prior to creating or updating 'this' file.",
|
|
30
|
+
"'this' meaning the file described by the key in the object.",
|
|
31
|
+
"If the plan includes a type: folder to be created, and a file is contained",
|
|
32
|
+
"within that folder, then it must also be listed in the upstream dependencies.",
|
|
33
|
+
"Don't include files as upstream dependencies if that file's content is not relevant to this file.",
|
|
34
|
+
].join(" "));
|
|
35
|
+
const CreateFile = z.object({
|
|
36
|
+
type: ProjectFileType,
|
|
37
|
+
upstream,
|
|
38
|
+
operation: z.enum(["create"]),
|
|
39
|
+
});
|
|
40
|
+
const UpdateFile = z.object({
|
|
41
|
+
type: ProjectFileType,
|
|
42
|
+
upstream,
|
|
43
|
+
operation: z
|
|
44
|
+
.enum(["create", "update"])
|
|
45
|
+
.describe([
|
|
46
|
+
"The operation to perform on this fle (one of: create, update, delete, noop).",
|
|
47
|
+
"If the document describes a new file that needs to be created, the operation is 'create'.",
|
|
48
|
+
"If the document's content has changed such that a file that was previously created must be updated, the operation is 'update'.",
|
|
49
|
+
"If the document's content has changed, but not in a way that is relevant to this file, the operation is 'noop'.",
|
|
50
|
+
"If a file that was previously created is no longer mentioned in the document, the operation is 'delete'.",
|
|
51
|
+
].join(" ")),
|
|
52
|
+
});
|
|
53
|
+
export const CreatePlan = z.object({
|
|
54
|
+
files: z.record(CreateFile),
|
|
55
|
+
});
|
|
56
|
+
export const UpdatePlan = z.object({
|
|
57
|
+
files: z.record(z.union([UpdateFile, z.enum(["delete", "noop"])])),
|
|
58
|
+
});
|
|
59
|
+
export class Module extends Resource("Module", async (ctx, props) => {
|
|
60
|
+
if (ctx.event === "delete") {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const model = await resolveModel(props.model ?? "gpt-4o");
|
|
64
|
+
const plan = ctx.event === "create"
|
|
65
|
+
? await createPlan(ctx, props, model)
|
|
66
|
+
: await updatePlan(ctx, props, model);
|
|
67
|
+
console.log(JSON.stringify(plan, null, 2));
|
|
68
|
+
const dependencies = Object.fromEntries(Object.entries(plan.files).flatMap(([path, file]) => file === "delete" || file === "noop" ? [] : [[path, file.upstream]]));
|
|
69
|
+
const files = {};
|
|
70
|
+
for (const filePath of topoSort(dependencies)) {
|
|
71
|
+
const filePlan = plan.files[filePath];
|
|
72
|
+
if (filePlan !== "delete") {
|
|
73
|
+
const file = await createFile(filePath, filePlan === "noop"
|
|
74
|
+
? "noop"
|
|
75
|
+
: filePlan.operation, filePlan === "noop" ? null : filePlan, dependencies[filePath]?.map((dep) => files[dep]));
|
|
76
|
+
if (file) {
|
|
77
|
+
files[filePath] = file;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
path: props.path,
|
|
83
|
+
plan,
|
|
84
|
+
content: props.content,
|
|
85
|
+
// @ts-ignore - TODO: fix this
|
|
86
|
+
files,
|
|
87
|
+
};
|
|
88
|
+
async function createFile(filePath, op, filePlan, dependencies) {
|
|
89
|
+
const slug = slugify(filePath);
|
|
90
|
+
// cache inputs for no-ops
|
|
91
|
+
async function inputs(key, input) {
|
|
92
|
+
return (op === "noop" ? await ctx.get(key) : input) ?? input;
|
|
93
|
+
}
|
|
94
|
+
if (filePlan === null) {
|
|
95
|
+
// restore the file plan from the cache for no-ops
|
|
96
|
+
filePlan = (await ctx.get(filePath));
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
await ctx.set(filePath, filePlan);
|
|
100
|
+
}
|
|
101
|
+
if (filePlan.type === "design") {
|
|
102
|
+
const design = new Design(`${slug}-design`, await inputs(`${slug}-design`, {
|
|
103
|
+
path: filePath,
|
|
104
|
+
prompt: [
|
|
105
|
+
"Context:",
|
|
106
|
+
props.content,
|
|
107
|
+
"",
|
|
108
|
+
`Produce the design: ${filePath}`,
|
|
109
|
+
].join("\n"),
|
|
110
|
+
dependencies,
|
|
111
|
+
model: "o3-mini",
|
|
112
|
+
}));
|
|
113
|
+
const module = new Module(slug, await inputs(slug, {
|
|
114
|
+
model: props.model,
|
|
115
|
+
path: filePath,
|
|
116
|
+
content: design.content,
|
|
117
|
+
dependencies,
|
|
118
|
+
}));
|
|
119
|
+
return module;
|
|
120
|
+
}
|
|
121
|
+
else if (filePlan.type === "typescript") {
|
|
122
|
+
const requirementsSlug = slug.replace(".ts", ".md");
|
|
123
|
+
const requirements = new Requirements(requirementsSlug, await inputs(requirementsSlug, {
|
|
124
|
+
// file: file.path.replace(".ts", ".md").replace("src/", "design/"),
|
|
125
|
+
requirements: [
|
|
126
|
+
"Context:",
|
|
127
|
+
props.content,
|
|
128
|
+
"Define the low-level requirements for this TypeScript file:",
|
|
129
|
+
filePath,
|
|
130
|
+
],
|
|
131
|
+
dependencies,
|
|
132
|
+
}));
|
|
133
|
+
return new TypeScriptFile(slug, await inputs(slug, {
|
|
134
|
+
path: filePath,
|
|
135
|
+
requirements: requirements.content,
|
|
136
|
+
dependencies,
|
|
137
|
+
}));
|
|
138
|
+
// } else if (filePlan.type === "package.json") {
|
|
139
|
+
// return new PackageJson(
|
|
140
|
+
// slugify(filePath),
|
|
141
|
+
// await inputs<PackageJsonInput>(slug, {
|
|
142
|
+
// path: filePath,
|
|
143
|
+
// name: "todo",
|
|
144
|
+
// requirements: [
|
|
145
|
+
// "Context:",
|
|
146
|
+
// props.content,
|
|
147
|
+
// "Create the package.json:",
|
|
148
|
+
// filePath,
|
|
149
|
+
// ],
|
|
150
|
+
// dependencies,
|
|
151
|
+
// }),
|
|
152
|
+
// );
|
|
153
|
+
// } else if (filePlan.type === "tsconfig.json") {
|
|
154
|
+
// return new TypeScriptConfig(
|
|
155
|
+
// slugify(filePath),
|
|
156
|
+
// await inputs<TypeScriptConfigInput>(slug, {
|
|
157
|
+
// path: filePath,
|
|
158
|
+
// requirements: [props.content],
|
|
159
|
+
// dependencies,
|
|
160
|
+
// }),
|
|
161
|
+
// );
|
|
162
|
+
}
|
|
163
|
+
else if (filePlan.type === "folder") {
|
|
164
|
+
return new Folder(slug, filePath, ...dependencies.map((d) => d.path));
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
console.error(`Unknown file type: ${filePlan.type}`);
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}) {
|
|
172
|
+
}
|
|
173
|
+
async function createPlan(ctx, props, model) {
|
|
174
|
+
const result = await generateObject({
|
|
175
|
+
model,
|
|
176
|
+
schema: CreatePlan,
|
|
177
|
+
temperature: 0.1,
|
|
178
|
+
messages: [
|
|
179
|
+
{
|
|
180
|
+
role: "system",
|
|
181
|
+
content: Prompts.program,
|
|
182
|
+
},
|
|
183
|
+
...excludeDependenciesFromPlan(props.dependencies),
|
|
184
|
+
{
|
|
185
|
+
role: "user",
|
|
186
|
+
content: [
|
|
187
|
+
"Derive the execution plan for this document:",
|
|
188
|
+
"```md",
|
|
189
|
+
props.content,
|
|
190
|
+
"```",
|
|
191
|
+
"You must only include files explicitly mentioned in the document.",
|
|
192
|
+
"Do not preemptively assume that any other files are needed.",
|
|
193
|
+
].join("\n\n"),
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
});
|
|
197
|
+
return result.object;
|
|
198
|
+
}
|
|
199
|
+
async function updatePlan(ctx, props, model) {
|
|
200
|
+
const newContent = await fs.readFile(props.path, "utf-8");
|
|
201
|
+
const oldContent = ctx.output.content;
|
|
202
|
+
const patch = createPatch(props.path, oldContent, newContent);
|
|
203
|
+
console.log({
|
|
204
|
+
role: "assistant",
|
|
205
|
+
content: JSON.stringify(ctx.output.plan),
|
|
206
|
+
});
|
|
207
|
+
try {
|
|
208
|
+
const result = await generateObject({
|
|
209
|
+
model,
|
|
210
|
+
schema: UpdatePlan,
|
|
211
|
+
temperature: 0.1,
|
|
212
|
+
messages: [
|
|
213
|
+
{
|
|
214
|
+
role: "system",
|
|
215
|
+
content: Prompts.program,
|
|
216
|
+
},
|
|
217
|
+
...excludeDependenciesFromPlan(props.dependencies),
|
|
218
|
+
{
|
|
219
|
+
role: "user",
|
|
220
|
+
content: [
|
|
221
|
+
"Derive the execution plan for this document:",
|
|
222
|
+
"```md",
|
|
223
|
+
oldContent,
|
|
224
|
+
"```",
|
|
225
|
+
].join("\n\n"),
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
role: "assistant",
|
|
229
|
+
content: JSON.stringify(ctx.output.plan),
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
role: "user",
|
|
233
|
+
content: [
|
|
234
|
+
"I've made the following changes to the document:",
|
|
235
|
+
"```diff",
|
|
236
|
+
patch,
|
|
237
|
+
"```",
|
|
238
|
+
"Please update the plan to reflect the changes.",
|
|
239
|
+
"You must only include files explicitly mentioned in the document.",
|
|
240
|
+
"Do not preemptively assume that any other files are needed.",
|
|
241
|
+
].join("\n"),
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
});
|
|
245
|
+
return result.object;
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
console.log("Failed to update plan");
|
|
249
|
+
console.error(error);
|
|
250
|
+
throw error;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
function excludeDependenciesFromPlan(dependencies) {
|
|
254
|
+
if (dependencies) {
|
|
255
|
+
return [
|
|
256
|
+
...dependenciesAsMessages(dependencies),
|
|
257
|
+
...(dependencies
|
|
258
|
+
? [
|
|
259
|
+
{
|
|
260
|
+
role: "user",
|
|
261
|
+
content: [
|
|
262
|
+
"Remember that these files don't need to be create",
|
|
263
|
+
...dependencies.map((dep) => `- ${dep.path}`),
|
|
264
|
+
].join("\n"),
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
role: "assistant",
|
|
268
|
+
content: [
|
|
269
|
+
"Got it, I acknowledge that the following files will not be included as create/update/delete/noop nodes in the plan",
|
|
270
|
+
...dependencies.map((dep) => `- ${dep.path}`),
|
|
271
|
+
].join("\n"),
|
|
272
|
+
},
|
|
273
|
+
]
|
|
274
|
+
: []),
|
|
275
|
+
];
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
return [];
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function topoSort(dependencies) {
|
|
282
|
+
const visited = new Set();
|
|
283
|
+
const temp = new Set();
|
|
284
|
+
const order = [];
|
|
285
|
+
function visit(file) {
|
|
286
|
+
if (temp.has(file)) {
|
|
287
|
+
throw new Error(`Circular dependency detected involving ${file}`);
|
|
288
|
+
}
|
|
289
|
+
if (visited.has(file)) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
temp.add(file);
|
|
293
|
+
const deps = dependencies[file] || [];
|
|
294
|
+
for (const dep of deps) {
|
|
295
|
+
visit(dep);
|
|
296
|
+
}
|
|
297
|
+
temp.delete(file);
|
|
298
|
+
visited.add(file);
|
|
299
|
+
order.push(file);
|
|
300
|
+
}
|
|
301
|
+
const files = Object.keys(dependencies);
|
|
302
|
+
for (const file of files) {
|
|
303
|
+
if (!visited.has(file)) {
|
|
304
|
+
visit(file);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return order;
|
|
308
|
+
}
|
|
309
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/agent/module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAoB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAA0B,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAGL,QAAQ,GAET,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,cAAc,EAA4B,MAAM,eAAe,CAAC;AAGzE,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAgB,YAAY,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7B,QAAQ;IACR,QAAQ;IACR,YAAY;IACZ,kBAAkB;IAClB,mBAAmB;IACnB,KAAK;IACL,MAAM;IACN,YAAY;IACZ,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,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I,CAAC,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACxC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,KAAK,CAAC,IAAI,CAAC,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const OpenAIModels: readonly ["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"];
|
|
3
|
+
export declare const OpenAIModel: 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"]>;
|
|
4
|
+
export type OpenAIChatModelId = (typeof OpenAIModels)[number] | (string & {});
|
|
5
|
+
export declare function isOpenAIModel(model: string): model is OpenAIChatModelId;
|
|
6
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/agent/openai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,eAAO,MAAM,YAAY,qgBAmCf,CAAC;AAEX,eAAO,MAAM,WAAW,ugBAAuB,CAAC;AAEhD,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAE9E,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,iBAAiB,CAOvE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const OpenAIModels = [
|
|
3
|
+
"o3-mini",
|
|
4
|
+
// O1 models
|
|
5
|
+
"o1",
|
|
6
|
+
"o1-2024-12-17",
|
|
7
|
+
"o1-mini",
|
|
8
|
+
"o1-mini-2024-09-12",
|
|
9
|
+
"o1-preview",
|
|
10
|
+
"o1-preview-2024-09-12",
|
|
11
|
+
// GPT-4O models
|
|
12
|
+
"gpt-4o",
|
|
13
|
+
"gpt-4o-2024-05-13",
|
|
14
|
+
"gpt-4o-2024-08-06",
|
|
15
|
+
"gpt-4o-2024-11-20",
|
|
16
|
+
"gpt-4o-audio-preview",
|
|
17
|
+
"gpt-4o-audio-preview-2024-10-01",
|
|
18
|
+
"gpt-4o-audio-preview-2024-12-17",
|
|
19
|
+
"gpt-4o-mini",
|
|
20
|
+
"gpt-4o-mini-2024-07-18",
|
|
21
|
+
// GPT-4 models
|
|
22
|
+
"gpt-4-turbo",
|
|
23
|
+
"gpt-4-turbo-2024-04-09",
|
|
24
|
+
"gpt-4-turbo-preview",
|
|
25
|
+
"gpt-4-0125-preview",
|
|
26
|
+
"gpt-4-1106-preview",
|
|
27
|
+
"gpt-4",
|
|
28
|
+
"gpt-4-0613",
|
|
29
|
+
// GPT-3.5 models
|
|
30
|
+
"gpt-3.5-turbo-0125",
|
|
31
|
+
"gpt-3.5-turbo",
|
|
32
|
+
"gpt-3.5-turbo-1106",
|
|
33
|
+
];
|
|
34
|
+
export const OpenAIModel = z.enum(OpenAIModels);
|
|
35
|
+
export function isOpenAIModel(model) {
|
|
36
|
+
return (model.startsWith("gpt-") ||
|
|
37
|
+
model.startsWith("o1") ||
|
|
38
|
+
model.startsWith("o3") ||
|
|
39
|
+
model.startsWith("gpt-4o"));
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=openai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/agent/openai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,SAAS;IAET,YAAY;IACZ,IAAI;IACJ,eAAe;IACf,SAAS;IACT,oBAAoB;IACpB,YAAY;IACZ,uBAAuB;IAEvB,gBAAgB;IAChB,QAAQ;IACR,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;IACnB,sBAAsB;IACtB,iCAAiC;IACjC,iCAAiC;IACjC,aAAa;IACb,wBAAwB;IAExB,eAAe;IACf,aAAa;IACb,wBAAwB;IACxB,qBAAqB;IACrB,oBAAoB;IACpB,oBAAoB;IACpB,OAAO;IACP,YAAY;IAEZ,iBAAiB;IACjB,oBAAoB;IACpB,eAAe;IACf,oBAAoB;CACZ,CAAC;AAEX,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AAIhD,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,CACL,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC;QACxB,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC;QACtB,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC;QACtB,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,CAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ModelId } from "./model";
|
|
2
|
+
import { Module } from "./module";
|
|
3
|
+
declare const Program_base: import("../resource").Provider<"Program", [props: {
|
|
4
|
+
path: string;
|
|
5
|
+
model?: ModelId;
|
|
6
|
+
}], {
|
|
7
|
+
module: Module;
|
|
8
|
+
}>;
|
|
9
|
+
export declare class Program extends Program_base {
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=program.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/agent/program.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;;UAYtB,MAAM;YACJ,OAAO;;YAJP,MAAM;;AAPpB,qBAAa,OAAQ,SAAQ,YA8B5B;CAAG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import { Resource } from "../resource";
|
|
3
|
+
import { Module } from "./module";
|
|
4
|
+
export class Program extends Resource("Program", {
|
|
5
|
+
alwaysUpdate: true,
|
|
6
|
+
}, async (ctx, props) => {
|
|
7
|
+
if (ctx.event === "delete") {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const content = await fs.readFile(props.path, "utf-8");
|
|
11
|
+
const module = new Module("module", {
|
|
12
|
+
path: props.path,
|
|
13
|
+
content,
|
|
14
|
+
model: props.model,
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
module,
|
|
18
|
+
};
|
|
19
|
+
}) {
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=program.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../src/agent/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,OAAO,OAAQ,SAAQ,QAAQ,CACnC,SAAS,EACT;IACE,YAAY,EAAE,IAAI;CACnB,EACD,KAAK,EACH,GAEE,EACF,KAGC,EACD,EAAE;IACF,IAAI,GAAG,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEvD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE;QAClC,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO;QACP,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC,CAAC;IAEH,OAAO;QACL,MAAM;KACP,CAAC;AACJ,CAAC,CACF;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/agent/prompts.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,OAAO,sBAAuB,CAAC;AAErC,eAAO,MAAM,OAAO,EAOf,GACF,GAAG,IAAI,CAAC,OAAO,OAAO,EAAE,MAAM,CAAC,GAAG,MAAM,GAC1C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
// TODO: replace with import.meta.glob
|
|
4
|
+
// see: https://github.com/oven-sh/bun/issues/6060
|
|
5
|
+
const __dirname = new URL(".", import.meta.url).pathname;
|
|
6
|
+
const prompts = ["program"];
|
|
7
|
+
export const Prompts = Object.fromEntries(await Promise.all(prompts.map(async (prompt) => [
|
|
8
|
+
prompt,
|
|
9
|
+
await fs.readFile(path.join(__dirname, `${prompt}.md`), "utf-8"),
|
|
10
|
+
])));
|
|
11
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/agent/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,sCAAsC;AACtC,kDAAkD;AAElD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;AAEzD,MAAM,OAAO,GAAG,CAAC,SAAS,CAAU,CAAC;AAErC,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CACvC,MAAM,OAAO,CAAC,GAAG,CACf,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC;IAC5B,MAAM;IACN,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,MAAM,KAAK,CAAC,EAAE,OAAO,CAAC;CACjE,CAAC,CACH,CAGF,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const scrapeWebPage: import("ai").Tool<z.ZodObject<{
|
|
3
|
+
url: z.ZodString;
|
|
4
|
+
turndownOptions: z.ZodOptional<z.ZodObject<{
|
|
5
|
+
headingStyle: z.ZodOptional<z.ZodEnum<["setext", "atx"]>>;
|
|
6
|
+
hr: z.ZodOptional<z.ZodString>;
|
|
7
|
+
bulletListMarker: z.ZodOptional<z.ZodEnum<["-", "*", "+"]>>;
|
|
8
|
+
codeBlockStyle: z.ZodOptional<z.ZodEnum<["indented", "fenced"]>>;
|
|
9
|
+
emDelimiter: z.ZodOptional<z.ZodEnum<["_", "*"]>>;
|
|
10
|
+
strongDelimiter: z.ZodOptional<z.ZodEnum<["__", "**"]>>;
|
|
11
|
+
linkStyle: z.ZodOptional<z.ZodEnum<["inlined", "referenced"]>>;
|
|
12
|
+
linkReferenceStyle: z.ZodOptional<z.ZodEnum<["full", "collapsed", "shortcut"]>>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
headingStyle?: "setext" | "atx" | undefined;
|
|
15
|
+
hr?: string | undefined;
|
|
16
|
+
bulletListMarker?: "-" | "*" | "+" | undefined;
|
|
17
|
+
codeBlockStyle?: "indented" | "fenced" | undefined;
|
|
18
|
+
emDelimiter?: "_" | "*" | undefined;
|
|
19
|
+
strongDelimiter?: "__" | "**" | undefined;
|
|
20
|
+
linkStyle?: "inlined" | "referenced" | undefined;
|
|
21
|
+
linkReferenceStyle?: "full" | "collapsed" | "shortcut" | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
headingStyle?: "setext" | "atx" | undefined;
|
|
24
|
+
hr?: string | undefined;
|
|
25
|
+
bulletListMarker?: "-" | "*" | "+" | undefined;
|
|
26
|
+
codeBlockStyle?: "indented" | "fenced" | undefined;
|
|
27
|
+
emDelimiter?: "_" | "*" | undefined;
|
|
28
|
+
strongDelimiter?: "__" | "**" | undefined;
|
|
29
|
+
linkStyle?: "inlined" | "referenced" | undefined;
|
|
30
|
+
linkReferenceStyle?: "full" | "collapsed" | "shortcut" | undefined;
|
|
31
|
+
}>>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
url: string;
|
|
34
|
+
turndownOptions?: {
|
|
35
|
+
headingStyle?: "setext" | "atx" | undefined;
|
|
36
|
+
hr?: string | undefined;
|
|
37
|
+
bulletListMarker?: "-" | "*" | "+" | undefined;
|
|
38
|
+
codeBlockStyle?: "indented" | "fenced" | undefined;
|
|
39
|
+
emDelimiter?: "_" | "*" | undefined;
|
|
40
|
+
strongDelimiter?: "__" | "**" | undefined;
|
|
41
|
+
linkStyle?: "inlined" | "referenced" | undefined;
|
|
42
|
+
linkReferenceStyle?: "full" | "collapsed" | "shortcut" | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
url: string;
|
|
46
|
+
turndownOptions?: {
|
|
47
|
+
headingStyle?: "setext" | "atx" | undefined;
|
|
48
|
+
hr?: string | undefined;
|
|
49
|
+
bulletListMarker?: "-" | "*" | "+" | undefined;
|
|
50
|
+
codeBlockStyle?: "indented" | "fenced" | undefined;
|
|
51
|
+
emDelimiter?: "_" | "*" | undefined;
|
|
52
|
+
strongDelimiter?: "__" | "**" | undefined;
|
|
53
|
+
linkStyle?: "inlined" | "referenced" | undefined;
|
|
54
|
+
linkReferenceStyle?: "full" | "collapsed" | "shortcut" | undefined;
|
|
55
|
+
} | undefined;
|
|
56
|
+
}>, string> & {
|
|
57
|
+
execute: (args: {
|
|
58
|
+
url: string;
|
|
59
|
+
turndownOptions?: {
|
|
60
|
+
headingStyle?: "setext" | "atx" | undefined;
|
|
61
|
+
hr?: string | undefined;
|
|
62
|
+
bulletListMarker?: "-" | "*" | "+" | undefined;
|
|
63
|
+
codeBlockStyle?: "indented" | "fenced" | undefined;
|
|
64
|
+
emDelimiter?: "_" | "*" | undefined;
|
|
65
|
+
strongDelimiter?: "__" | "**" | undefined;
|
|
66
|
+
linkStyle?: "inlined" | "referenced" | undefined;
|
|
67
|
+
linkReferenceStyle?: "full" | "collapsed" | "shortcut" | undefined;
|
|
68
|
+
} | undefined;
|
|
69
|
+
}, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=scrape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrape.d.ts","sourceRoot":"","sources":["../../src/agent/scrape.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CxB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { tool } from "ai";
|
|
2
|
+
import TurndownService from "turndown";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
export const scrapeWebPage = tool({
|
|
5
|
+
description: "Scrapes a web page and converts HTML content to Markdown",
|
|
6
|
+
parameters: z.object({
|
|
7
|
+
url: z.string().url().describe("The URL to scrape content from"),
|
|
8
|
+
turndownOptions: z
|
|
9
|
+
.object({
|
|
10
|
+
headingStyle: z.enum(["setext", "atx"]).optional(),
|
|
11
|
+
hr: z.string().optional(),
|
|
12
|
+
bulletListMarker: z.enum(["-", "*", "+"]).optional(),
|
|
13
|
+
codeBlockStyle: z.enum(["indented", "fenced"]).optional(),
|
|
14
|
+
emDelimiter: z.enum(["_", "*"]).optional(),
|
|
15
|
+
strongDelimiter: z.enum(["__", "**"]).optional(),
|
|
16
|
+
linkStyle: z.enum(["inlined", "referenced"]).optional(),
|
|
17
|
+
linkReferenceStyle: z
|
|
18
|
+
.enum(["full", "collapsed", "shortcut"])
|
|
19
|
+
.optional(),
|
|
20
|
+
})
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Custom options for Turndown HTML to Markdown conversion"),
|
|
23
|
+
}),
|
|
24
|
+
execute: async ({ url, turndownOptions }) => {
|
|
25
|
+
console.log("Scraping web page:", url);
|
|
26
|
+
try {
|
|
27
|
+
// Fetch the page content
|
|
28
|
+
const response = await fetch(url);
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
throw new Error(`Failed to fetch ${url}: ${response.statusText}`);
|
|
31
|
+
}
|
|
32
|
+
// Get the HTML content
|
|
33
|
+
const html = await response.text();
|
|
34
|
+
// Initialize Turndown with options
|
|
35
|
+
const turndownService = new TurndownService(turndownOptions);
|
|
36
|
+
// Convert HTML to Markdown and return
|
|
37
|
+
return turndownService.turndown(html);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.error("Error scraping web page:", error);
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=scrape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrape.js","sourceRoot":"","sources":["../../src/agent/scrape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,eAAe,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;IAChC,WAAW,EAAE,0DAA0D;IACvE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;QACnB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;QAChE,eAAe,EAAE,CAAC;aACf,MAAM,CAAC;YACN,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE;YAClD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YACzB,gBAAgB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE;YACpD,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;YACzD,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,E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import { type Scope } from "./scope";
|
|
2
|
+
import type { StateStoreType } from "./state";
|
|
3
|
+
export interface AlchemizeOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Determines whether the resources will be created/updated or deleted.
|
|
6
|
+
*
|
|
7
|
+
* @default "up"
|
|
8
|
+
*/
|
|
9
|
+
mode?: "up" | "destroy";
|
|
10
|
+
/**
|
|
11
|
+
* Name to scope the resource state under (e.g. `.alchemy/{stage}/..`).
|
|
12
|
+
*
|
|
13
|
+
* @default - your POSIX username
|
|
14
|
+
*/
|
|
15
|
+
stage?: string;
|
|
16
|
+
/**
|
|
17
|
+
* If true, will not prune resources that were dropped from the root stack.
|
|
18
|
+
*
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
destroyOrphans?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* A custom state store to use instead of the default file system store.
|
|
24
|
+
*/
|
|
25
|
+
stateStore?: StateStoreType;
|
|
26
|
+
/**
|
|
27
|
+
* A custom scope to use instead of the default root scope.
|
|
28
|
+
*/
|
|
29
|
+
scope?: Scope;
|
|
30
|
+
/**
|
|
31
|
+
* If true, will not print any Create/Update/Delete messages.
|
|
32
|
+
*
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
quiet?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Explicitly finalize the program by deleting any resources that were dropped from the root stack.
|
|
39
|
+
*
|
|
40
|
+
* By default, this will be called when
|
|
41
|
+
*/
|
|
42
|
+
export declare function alchemize(options?: AlchemizeOptions): Promise<void>;
|
|
43
|
+
//# sourceMappingURL=alchemize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alchemize.d.ts","sourceRoot":"","sources":["../src/alchemize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,KAAK,EAAY,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IACxB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB,iBA0HzD"}
|