@agentkitforge/core 0.1.0
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/CHANGELOG.md +35 -0
- package/CLI.md +177 -0
- package/LICENSE +69 -0
- package/README.md +326 -0
- package/SECURITY.md +33 -0
- package/SPEC.md +159 -0
- package/VERSIONING.md +45 -0
- package/dist/adapters/claudeCode.d.ts +11 -0
- package/dist/adapters/claudeCode.js +120 -0
- package/dist/adapters/claudeCode.js.map +1 -0
- package/dist/adapters/codex.d.ts +12 -0
- package/dist/adapters/codex.js +141 -0
- package/dist/adapters/codex.js.map +1 -0
- package/dist/app/exampleInputDocuments.d.ts +21 -0
- package/dist/app/exampleInputDocuments.js +24 -0
- package/dist/app/exampleInputDocuments.js.map +1 -0
- package/dist/app/inspect.d.ts +15 -0
- package/dist/app/inspect.js +96 -0
- package/dist/app/inspect.js.map +1 -0
- package/dist/app/loadAsDraft.d.ts +7 -0
- package/dist/app/loadAsDraft.js +148 -0
- package/dist/app/loadAsDraft.js.map +1 -0
- package/dist/app/summary.d.ts +17 -0
- package/dist/app/summary.js +89 -0
- package/dist/app/summary.js.map +1 -0
- package/dist/artifacts/naming.d.ts +8 -0
- package/dist/artifacts/naming.js +26 -0
- package/dist/artifacts/naming.js.map +1 -0
- package/dist/builder/draftRequest.d.ts +24 -0
- package/dist/builder/draftRequest.js +87 -0
- package/dist/builder/draftRequest.js.map +1 -0
- package/dist/builder/instructions.d.ts +1 -0
- package/dist/builder/instructions.js +30 -0
- package/dist/builder/instructions.js.map +1 -0
- package/dist/builder/revisionRequest.d.ts +24 -0
- package/dist/builder/revisionRequest.js +94 -0
- package/dist/builder/revisionRequest.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +5 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/program.d.ts +2 -0
- package/dist/cli/program.js +273 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/context/builder.d.ts +2 -0
- package/dist/context/builder.js +159 -0
- package/dist/context/builder.js.map +1 -0
- package/dist/context/types.d.ts +23 -0
- package/dist/context/types.js +2 -0
- package/dist/context/types.js.map +1 -0
- package/dist/domains/catalog.d.ts +7 -0
- package/dist/domains/catalog.js +45 -0
- package/dist/domains/catalog.js.map +1 -0
- package/dist/draft/render.d.ts +13 -0
- package/dist/draft/render.js +207 -0
- package/dist/draft/render.js.map +1 -0
- package/dist/draft/schema.d.ts +107 -0
- package/dist/draft/schema.js +78 -0
- package/dist/draft/schema.js.map +1 -0
- package/dist/draft/session.d.ts +56 -0
- package/dist/draft/session.js +115 -0
- package/dist/draft/session.js.map +1 -0
- package/dist/export/onefile.d.ts +1 -0
- package/dist/export/onefile.js +109 -0
- package/dist/export/onefile.js.map +1 -0
- package/dist/fs/safety.d.ts +26 -0
- package/dist/fs/safety.js +187 -0
- package/dist/fs/safety.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/init/create.d.ts +14 -0
- package/dist/init/create.js +48 -0
- package/dist/init/create.js.map +1 -0
- package/dist/init/templates.d.ts +12 -0
- package/dist/init/templates.js +202 -0
- package/dist/init/templates.js.map +1 -0
- package/dist/package/packager.d.ts +5 -0
- package/dist/package/packager.js +30 -0
- package/dist/package/packager.js.map +1 -0
- package/dist/package/reader.d.ts +3 -0
- package/dist/package/reader.js +21 -0
- package/dist/package/reader.js.map +1 -0
- package/dist/prompts/prompts.d.ts +35 -0
- package/dist/prompts/prompts.js +206 -0
- package/dist/prompts/prompts.js.map +1 -0
- package/dist/prompts/schema.d.ts +71 -0
- package/dist/prompts/schema.js +46 -0
- package/dist/prompts/schema.js.map +1 -0
- package/dist/providers/catalog.d.ts +15 -0
- package/dist/providers/catalog.js +211 -0
- package/dist/providers/catalog.js.map +1 -0
- package/dist/providers/types.d.ts +30 -0
- package/dist/providers/types.js +2 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/schema/agentkit.d.ts +54 -0
- package/dist/schema/agentkit.js +63 -0
- package/dist/schema/agentkit.js.map +1 -0
- package/dist/types.d.ts +69 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/validation/skill.d.ts +3 -0
- package/dist/validation/skill.js +83 -0
- package/dist/validation/skill.js.map +1 -0
- package/dist/validation/validator.d.ts +2 -0
- package/dist/validation/validator.js +247 -0
- package/dist/validation/validator.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../src/app/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAiB9D,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,SAAiB;IAC9D,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QAC9B,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,KAAK;YACb,WAAW,EAAE,KAAK;YAClB,iBAAiB,EAAE,KAAK;YACxB,oBAAoB,EAAE,CAAC,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,4BAA4B,CAAC;YACrG,sBAAsB,EAAE,CAAC,QAAQ,CAAC;YAClC,UAAU,EAAE,EAAE;YACd,WAAW,EAAE,EAAE;YACf,gBAAgB,EAAE,CAAC,sCAAsC,CAAC;YAC1D,eAAe,EAAE,+BAA+B,QAAQ,EAAE;SAC3D,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;QACzB,OAAO;Y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,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;YACzF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAED,KAAK,UAAU,MAAM,CAAC,QAAgB;IACpC,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,MAAgB;IACpC,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,0BAA0B,CAAC;IACjD,CAAC;IAED,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AgentKitDraft } from "../draft/schema.js";
|
|
2
|
+
export interface LoadAgentKitAsDraftResult {
|
|
3
|
+
draft: AgentKitDraft;
|
|
4
|
+
warnings: string[];
|
|
5
|
+
sourceFiles: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function loadAgentKitAsDraft(kitPath: string): Promise<LoadAgentKitAsDraftResult>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { readdir, readFile, stat } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import YAML from "yaml";
|
|
4
|
+
import { resolveInside } from "../fs/safety.js";
|
|
5
|
+
import { parseSkillMarkdown } from "../validation/skill.js";
|
|
6
|
+
import { readAgentKit } from "../package/reader.js";
|
|
7
|
+
import { listPreparedPrompts } from "../prompts/prompts.js";
|
|
8
|
+
export async function loadAgentKitAsDraft(kitPath) {
|
|
9
|
+
const kit = await readAgentKit(kitPath);
|
|
10
|
+
if (!kit.manifest) {
|
|
11
|
+
throw new Error("Unable to load Agent Kit as draft because agentkit.yaml is invalid.");
|
|
12
|
+
}
|
|
13
|
+
const warnings = [];
|
|
14
|
+
const sourceFiles = ["agentkit.yaml"];
|
|
15
|
+
const preparedPrompts = await listPreparedPrompts(kit.rootPath);
|
|
16
|
+
sourceFiles.push(...preparedPrompts.map((prompt) => `prompts/${prompt.id}.yaml`));
|
|
17
|
+
const skills = [];
|
|
18
|
+
for (const skill of kit.manifest.skills) {
|
|
19
|
+
const skillPath = resolveInside(kit.rootPath, skill.path);
|
|
20
|
+
const parsed = parseSkillMarkdown(await readFile(skillPath, "utf8"), skillPath);
|
|
21
|
+
sourceFiles.push(skill.path);
|
|
22
|
+
skills.push({
|
|
23
|
+
id: skill.id,
|
|
24
|
+
name: String(parsed.frontmatter.name ?? skill.id),
|
|
25
|
+
description: skill.description,
|
|
26
|
+
triggers: skill.triggers,
|
|
27
|
+
riskLevel: String(parsed.frontmatter.riskLevel ?? kit.manifest.risk.level),
|
|
28
|
+
useWhen: extractSection(parsed.body, "Use when") ?? "Use when this skill is relevant.",
|
|
29
|
+
procedure: extractSection(parsed.body, "Procedure") ?? "Follow the skill instructions.",
|
|
30
|
+
output: extractSection(parsed.body, "Output") ?? "Return Markdown."
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const policies = await loadPolicies(kit.rootPath, sourceFiles, warnings);
|
|
34
|
+
const templates = await loadTemplates(kit.rootPath, sourceFiles);
|
|
35
|
+
const examples = await loadExamples(kit.rootPath, sourceFiles);
|
|
36
|
+
const workflowFiles = await listDirectoryFiles(path.join(kit.rootPath, "workflows"));
|
|
37
|
+
const referenceFiles = await listDirectoryFiles(path.join(kit.rootPath, "references"));
|
|
38
|
+
if (workflowFiles.length > 0) {
|
|
39
|
+
warnings.push("Workflows are not fully represented in AgentKitDraft yet.");
|
|
40
|
+
sourceFiles.push(...workflowFiles.map((file) => normalizePath(path.relative(kit.rootPath, file))));
|
|
41
|
+
}
|
|
42
|
+
if (referenceFiles.length > 0) {
|
|
43
|
+
warnings.push("References are not fully represented in AgentKitDraft yet.");
|
|
44
|
+
sourceFiles.push(...referenceFiles.map((file) => normalizePath(path.relative(kit.rootPath, file))));
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
draft: {
|
|
48
|
+
schemaVersion: kit.manifest.schemaVersion,
|
|
49
|
+
id: kit.manifest.id,
|
|
50
|
+
name: kit.manifest.name,
|
|
51
|
+
version: kit.manifest.version,
|
|
52
|
+
description: kit.manifest.description,
|
|
53
|
+
author: kit.manifest.author,
|
|
54
|
+
license: kit.manifest.license,
|
|
55
|
+
setupLevel: kit.manifest.userExperience.setupLevel,
|
|
56
|
+
compatibilityTargets: kit.manifest.compatibility.targets,
|
|
57
|
+
riskLevel: kit.manifest.risk.level,
|
|
58
|
+
skills,
|
|
59
|
+
policies,
|
|
60
|
+
examples,
|
|
61
|
+
templates,
|
|
62
|
+
preparedPrompts
|
|
63
|
+
},
|
|
64
|
+
warnings,
|
|
65
|
+
sourceFiles: [...new Set(sourceFiles)].sort()
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
async function loadPolicies(rootPath, sourceFiles, warnings) {
|
|
69
|
+
const files = await listDirectoryFiles(path.join(rootPath, "policies"));
|
|
70
|
+
return Promise.all(files
|
|
71
|
+
.filter((file) => file.endsWith(".yaml") || file.endsWith(".yml"))
|
|
72
|
+
.map(async (file) => {
|
|
73
|
+
sourceFiles.push(normalizePath(path.relative(rootPath, file)));
|
|
74
|
+
const parsed = YAML.parse(await readFile(file, "utf8"));
|
|
75
|
+
return {
|
|
76
|
+
id: parsed.id ?? path.basename(file, path.extname(file)),
|
|
77
|
+
description: parsed.description,
|
|
78
|
+
rules: parsed.rules && parsed.rules.length > 0 ? parsed.rules : ["Review this policy before use."]
|
|
79
|
+
};
|
|
80
|
+
})).catch(() => {
|
|
81
|
+
warnings.push("Some policies could not be converted to draft policy objects.");
|
|
82
|
+
return [];
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
async function loadTemplates(rootPath, sourceFiles) {
|
|
86
|
+
const files = await listDirectoryFiles(path.join(rootPath, "templates"));
|
|
87
|
+
return Promise.all(files.map(async (file) => {
|
|
88
|
+
const relativePath = normalizePath(path.relative(path.join(rootPath, "templates"), file));
|
|
89
|
+
sourceFiles.push(normalizePath(path.relative(rootPath, file)));
|
|
90
|
+
return {
|
|
91
|
+
id: path.basename(file, path.extname(file)),
|
|
92
|
+
path: relativePath,
|
|
93
|
+
content: await readFile(file, "utf8")
|
|
94
|
+
};
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
async function loadExamples(rootPath, sourceFiles) {
|
|
98
|
+
const promptFiles = await listDirectoryFiles(path.join(rootPath, "examples", "prompts"));
|
|
99
|
+
const outputFiles = await listDirectoryFiles(path.join(rootPath, "examples", "outputs"));
|
|
100
|
+
const outputs = new Map(outputFiles.map((file) => [path.basename(file, path.extname(file)), file]));
|
|
101
|
+
return Promise.all(promptFiles.map(async (file) => {
|
|
102
|
+
const id = path.basename(file, path.extname(file));
|
|
103
|
+
sourceFiles.push(normalizePath(path.relative(rootPath, file)));
|
|
104
|
+
const outputFile = outputs.get(id);
|
|
105
|
+
if (outputFile) {
|
|
106
|
+
sourceFiles.push(normalizePath(path.relative(rootPath, outputFile)));
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
id,
|
|
110
|
+
prompt: await readFile(file, "utf8"),
|
|
111
|
+
output: outputFile ? await readFile(outputFile, "utf8") : undefined
|
|
112
|
+
};
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
function extractSection(body, heading) {
|
|
116
|
+
const match = new RegExp(`^## ${heading}\\s*\\n([\\s\\S]*?)(?=^## |\\s*$)`, "m").exec(body);
|
|
117
|
+
return match?.[1]?.trim();
|
|
118
|
+
}
|
|
119
|
+
async function listDirectoryFiles(directoryPath) {
|
|
120
|
+
if (!(await exists(directoryPath))) {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
const entries = await readdir(directoryPath, { withFileTypes: true });
|
|
124
|
+
const files = [];
|
|
125
|
+
for (const entry of entries) {
|
|
126
|
+
const entryPath = path.join(directoryPath, entry.name);
|
|
127
|
+
if (entry.isDirectory()) {
|
|
128
|
+
files.push(...(await listDirectoryFiles(entryPath)));
|
|
129
|
+
}
|
|
130
|
+
else if (entry.isFile()) {
|
|
131
|
+
files.push(entryPath);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return files.sort();
|
|
135
|
+
}
|
|
136
|
+
async function exists(filePath) {
|
|
137
|
+
try {
|
|
138
|
+
await stat(filePath);
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function normalizePath(input) {
|
|
146
|
+
return input.replaceAll("\\", "/");
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=loadAsDraft.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadAsDraft.js","sourceRoot":"","sources":["../../src/app/loadAsDraft.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAS5D,MAAM,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AAC,SAAS,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;AACtB,CAAC;AAED,KAAK,UAAU,MAAM,CAAC,QAAgB;IACpC,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface AgentKitSummary {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
version: string;
|
|
5
|
+
description: string;
|
|
6
|
+
domain?: string;
|
|
7
|
+
targetUsers?: string[];
|
|
8
|
+
validationStatus: "valid" | "invalid";
|
|
9
|
+
counts: Record<string, number>;
|
|
10
|
+
lists: Record<string, unknown[]>;
|
|
11
|
+
paths: {
|
|
12
|
+
rootPath: string;
|
|
13
|
+
manifestPath: string;
|
|
14
|
+
};
|
|
15
|
+
warnings: string[];
|
|
16
|
+
}
|
|
17
|
+
export declare function getAgentKitSummary(kitPath: string): Promise<AgentKitSummary>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { readdir, stat } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { readAgentKit } from "../package/reader.js";
|
|
4
|
+
import { listPreparedPrompts } from "../prompts/prompts.js";
|
|
5
|
+
import { validateAgentKit } from "../validation/validator.js";
|
|
6
|
+
export async function getAgentKitSummary(kitPath) {
|
|
7
|
+
const kit = await readAgentKit(kitPath);
|
|
8
|
+
if (!kit.manifest) {
|
|
9
|
+
throw new Error("Unable to summarize Agent Kit because agentkit.yaml is invalid.");
|
|
10
|
+
}
|
|
11
|
+
const prompts = await listPreparedPrompts(kit.rootPath);
|
|
12
|
+
const validation = await validateAgentKit(kit.rootPath, "local-valid");
|
|
13
|
+
const directories = ["policies", "templates", "examples", "workflows", "references", "evals", "scripts"];
|
|
14
|
+
const counts = {
|
|
15
|
+
skills: kit.manifest.skills.length,
|
|
16
|
+
preparedPrompts: prompts.length
|
|
17
|
+
};
|
|
18
|
+
const lists = {
|
|
19
|
+
skills: kit.manifest.skills.map((skill) => ({
|
|
20
|
+
id: skill.id,
|
|
21
|
+
name: skill.id,
|
|
22
|
+
description: skill.description
|
|
23
|
+
})),
|
|
24
|
+
preparedPrompts: prompts.map((prompt) => ({
|
|
25
|
+
id: prompt.id,
|
|
26
|
+
name: prompt.name,
|
|
27
|
+
description: prompt.description,
|
|
28
|
+
inputCount: prompt.inputs.length,
|
|
29
|
+
documentLikeOutput: prompt.documentLikeOutput === true
|
|
30
|
+
}))
|
|
31
|
+
};
|
|
32
|
+
for (const directory of directories) {
|
|
33
|
+
const files = await listDirectoryFiles(path.join(kit.rootPath, directory));
|
|
34
|
+
counts[directory] = files.length;
|
|
35
|
+
lists[directory] = files.map((file) => ({
|
|
36
|
+
id: path.basename(file, path.extname(file)),
|
|
37
|
+
name: path.basename(file),
|
|
38
|
+
path: normalizePath(path.relative(kit.rootPath, file))
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
id: kit.manifest.id,
|
|
43
|
+
name: kit.manifest.name,
|
|
44
|
+
version: kit.manifest.version,
|
|
45
|
+
description: kit.manifest.description,
|
|
46
|
+
domain: typeof kit.manifest.domain === "string" ? kit.manifest.domain : undefined,
|
|
47
|
+
targetUsers: Array.isArray(kit.manifest.targetUsers)
|
|
48
|
+
? kit.manifest.targetUsers.filter((value) => typeof value === "string")
|
|
49
|
+
: undefined,
|
|
50
|
+
validationStatus: validation.valid ? "valid" : "invalid",
|
|
51
|
+
counts,
|
|
52
|
+
lists,
|
|
53
|
+
paths: {
|
|
54
|
+
rootPath: kit.rootPath,
|
|
55
|
+
manifestPath: kit.manifestPath
|
|
56
|
+
},
|
|
57
|
+
warnings: validation.issues.map((issue) => issue.message)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
async function listDirectoryFiles(directoryPath) {
|
|
61
|
+
if (!(await exists(directoryPath))) {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
const entries = await readdir(directoryPath, { withFileTypes: true });
|
|
65
|
+
const files = [];
|
|
66
|
+
for (const entry of entries) {
|
|
67
|
+
const entryPath = path.join(directoryPath, entry.name);
|
|
68
|
+
if (entry.isDirectory()) {
|
|
69
|
+
files.push(...(await listDirectoryFiles(entryPath)));
|
|
70
|
+
}
|
|
71
|
+
else if (entry.isFile()) {
|
|
72
|
+
files.push(entryPath);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return files.sort();
|
|
76
|
+
}
|
|
77
|
+
async function exists(filePath) {
|
|
78
|
+
try {
|
|
79
|
+
await stat(filePath);
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function normalizePath(input) {
|
|
87
|
+
return input.replaceAll("\\", "/");
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../src/app/summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAmB9D,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAAe;IACtD,MAAM,GAAG,GAAG,MAAM,YA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AACrC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ArtifactNameMetadata {
|
|
2
|
+
id?: string;
|
|
3
|
+
version?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function sanitizeArtifactName(value: string): string;
|
|
6
|
+
export declare function getDefaultOneFileName(manifestOrMetadata: ArtifactNameMetadata): string;
|
|
7
|
+
export declare function getDefaultPackageName(manifestOrMetadata: ArtifactNameMetadata): string;
|
|
8
|
+
export declare function getDefaultOutputName(manifestOrMetadata: ArtifactNameMetadata, timestamp?: Date): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function sanitizeArtifactName(value) {
|
|
2
|
+
return (value
|
|
3
|
+
.trim()
|
|
4
|
+
.toLowerCase()
|
|
5
|
+
.replace(/[^a-z0-9._-]+/g, "-")
|
|
6
|
+
.replace(/-+/g, "-")
|
|
7
|
+
.replace(/^[-.]+|[-.]+$/g, "") || "agentkit");
|
|
8
|
+
}
|
|
9
|
+
export function getDefaultOneFileName(manifestOrMetadata) {
|
|
10
|
+
const id = sanitizeArtifactName(manifestOrMetadata.id ?? "agentkit");
|
|
11
|
+
const version = sanitizeArtifactName(manifestOrMetadata.version ?? "0.1.0");
|
|
12
|
+
return `${id}-${version}.onefile.md`;
|
|
13
|
+
}
|
|
14
|
+
export function getDefaultPackageName(manifestOrMetadata) {
|
|
15
|
+
const id = sanitizeArtifactName(manifestOrMetadata.id ?? "agentkit");
|
|
16
|
+
const version = sanitizeArtifactName(manifestOrMetadata.version ?? "0.1.0");
|
|
17
|
+
return `${id}-${version}.agentkit.zip`;
|
|
18
|
+
}
|
|
19
|
+
export function getDefaultOutputName(manifestOrMetadata, timestamp = new Date()) {
|
|
20
|
+
const id = sanitizeArtifactName(manifestOrMetadata.id ?? "agentkit");
|
|
21
|
+
return `${id}-output-${formatTimestamp(timestamp)}.md`;
|
|
22
|
+
}
|
|
23
|
+
function formatTimestamp(date) {
|
|
24
|
+
return date.toISOString().replaceAll("-", "").replaceAll(":", "").replace(/\.\d{3}Z$/, "Z");
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=naming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naming.js","sourceRoot":"","sources":["../../src/artifacts/naming.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,OAAO,CACL,KAAK;SACF,IAAI,EAAE;SACN,WAAW,EAAE;SACb,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC;SAC9B,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,IAAI,UAAU,CAC/C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,kBAAwC;IAC5E,MAAM,EAAE,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,EAAE,IAAI,UAAU,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC;IAC5E,OAAO,GAAG,EAAE,IAAI,OAAO,aAAa,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,kBAAwC;IAC5E,MAAM,EAAE,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,EAAE,IAAI,UAAU,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC;IAC5E,OAAO,GAAG,EAAE,IAAI,OAAO,eAAe,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,kBAAwC,EACxC,YAAkB,IAAI,IAAI,EAAE;IAE5B,MAAM,EAAE,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,EAAE,IAAI,UAAU,CAAC,CAAC;IACrE,OAAO,GAAG,EAAE,WAAW,eAAe,CAAC,SAAS,CAAC,KAAK,CAAC;AACzD,CAAC;AAED,SAAS,eAAe,CAAC,IAAU;IACjC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AAC9F,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ExampleInputDocument } from "../app/exampleInputDocuments.js";
|
|
2
|
+
import type { AgentKitValidationProfile } from "../types.js";
|
|
3
|
+
export interface CreateAgentKitDraftRequestInput {
|
|
4
|
+
userRequest: string;
|
|
5
|
+
targetUsers?: string[];
|
|
6
|
+
domain?: string;
|
|
7
|
+
desiredValidationLevel?: AgentKitValidationProfile;
|
|
8
|
+
constraints?: string[];
|
|
9
|
+
sourceNotes?: string[];
|
|
10
|
+
existingKitSummary?: string;
|
|
11
|
+
requestedSections?: string[];
|
|
12
|
+
excludedSections?: string[];
|
|
13
|
+
exampleInputDocuments?: ExampleInputDocument[];
|
|
14
|
+
}
|
|
15
|
+
export interface AgentKitDraftRequest {
|
|
16
|
+
responseFormatName: "agent_kit_draft";
|
|
17
|
+
builderInstructions: string;
|
|
18
|
+
systemInstructions: string;
|
|
19
|
+
userPrompt: string;
|
|
20
|
+
expectedJsonSchema: unknown;
|
|
21
|
+
warnings: string[];
|
|
22
|
+
input: CreateAgentKitDraftRequestInput;
|
|
23
|
+
}
|
|
24
|
+
export declare function createAgentKitDraftRequest(input: CreateAgentKitDraftRequestInput): AgentKitDraftRequest;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { summarizeExampleInputDocument } from "../app/exampleInputDocuments.js";
|
|
3
|
+
import { agentKitDraftSchema } from "../draft/schema.js";
|
|
4
|
+
import { createAgentKitBuilderInstructions } from "./instructions.js";
|
|
5
|
+
export function createAgentKitDraftRequest(input) {
|
|
6
|
+
if (!input.userRequest.trim()) {
|
|
7
|
+
throw new Error("userRequest is required");
|
|
8
|
+
}
|
|
9
|
+
const normalizedInput = {
|
|
10
|
+
...input,
|
|
11
|
+
targetUsers: normalizeList(input.targetUsers),
|
|
12
|
+
constraints: normalizeList(input.constraints),
|
|
13
|
+
sourceNotes: normalizeList(input.sourceNotes),
|
|
14
|
+
desiredValidationLevel: input.desiredValidationLevel ?? "local-valid"
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
responseFormatName: "agent_kit_draft",
|
|
18
|
+
builderInstructions: createAgentKitBuilderInstructions,
|
|
19
|
+
systemInstructions: "You design provider-neutral AgentKitForge AgentKitDraft JSON. Return only JSON matching the supplied schema. Do not call external tools, assume API keys, or add desktop, infrastructure, or marketplace behavior.",
|
|
20
|
+
userPrompt: buildUserPrompt(normalizedInput),
|
|
21
|
+
expectedJsonSchema: {
|
|
22
|
+
title: "AgentKitDraft",
|
|
23
|
+
...z.toJSONSchema(agentKitDraftSchema)
|
|
24
|
+
},
|
|
25
|
+
warnings: buildWarnings(normalizedInput.desiredValidationLevel ?? "local-valid"),
|
|
26
|
+
input: normalizedInput
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function buildUserPrompt(input) {
|
|
30
|
+
const lines = [
|
|
31
|
+
"Create an AgentKitDraft JSON object for this request.",
|
|
32
|
+
"",
|
|
33
|
+
`User request: ${input.userRequest}`,
|
|
34
|
+
`Desired validation level: ${input.desiredValidationLevel ?? "local-valid"}`
|
|
35
|
+
];
|
|
36
|
+
if (input.domain) {
|
|
37
|
+
lines.push(`Domain: ${input.domain}`);
|
|
38
|
+
}
|
|
39
|
+
appendList(lines, "Target users", input.targetUsers);
|
|
40
|
+
appendList(lines, "Constraints", input.constraints);
|
|
41
|
+
appendList(lines, "Source notes", input.sourceNotes);
|
|
42
|
+
appendList(lines, "Requested sections", input.requestedSections);
|
|
43
|
+
appendList(lines, "Excluded sections", input.excludedSections);
|
|
44
|
+
if (!input.requestedSections?.includes("scripts")) {
|
|
45
|
+
lines.push("", "Do not generate scripts unless scripts are explicitly requested.");
|
|
46
|
+
}
|
|
47
|
+
lines.push("Generate requested sections. Do not generate excluded sections unless required for validity.", "Prefer simple useful kits over overly complex kits.", "Prepared prompts should include inputs and variables when repeatable workflows need them.");
|
|
48
|
+
if (input.exampleInputDocuments && input.exampleInputDocuments.length > 0) {
|
|
49
|
+
lines.push("", "Example input document summaries:");
|
|
50
|
+
for (const document of input.exampleInputDocuments.map(summarizeExampleInputDocument)) {
|
|
51
|
+
lines.push(`- ${document.name} (${document.filename}, ${document.kind})${document.notes ? `: ${document.notes}` : ""}`);
|
|
52
|
+
}
|
|
53
|
+
lines.push("Use example input documents to infer formatting, terminology, output style, required inputs, skill procedures, templates, and prepared prompt variables.", "Do not quote excessive source text. Summarize patterns into skills, templates, and prepared prompts.");
|
|
54
|
+
}
|
|
55
|
+
if (input.existingKitSummary) {
|
|
56
|
+
lines.push("", "Existing kit summary for revision:", input.existingKitSummary);
|
|
57
|
+
}
|
|
58
|
+
lines.push("", "Return only an AgentKitDraft JSON object. Keep ids lowercase and hyphenated. Keep Markdown readable.");
|
|
59
|
+
return lines.join("\n");
|
|
60
|
+
}
|
|
61
|
+
function buildWarnings(level) {
|
|
62
|
+
const warnings = [];
|
|
63
|
+
if (level === "publishable" || level === "trusted" || level === "verified") {
|
|
64
|
+
warnings.push("Publishable kits require README.md and LICENSE. The draft renderer emits these from readme/license fields or defaults.");
|
|
65
|
+
}
|
|
66
|
+
if (level === "trusted" || level === "verified") {
|
|
67
|
+
warnings.push("Trusted kits require CHANGELOG.md, policies/, and examples/. Include changelog, at least one policy, and at least one example in the draft.");
|
|
68
|
+
}
|
|
69
|
+
if (level === "verified") {
|
|
70
|
+
warnings.push("Verified kits require evals/. AgentKitDraft does not render evals yet, so add eval support before expecting verified output.");
|
|
71
|
+
}
|
|
72
|
+
return warnings;
|
|
73
|
+
}
|
|
74
|
+
function appendList(lines, label, values) {
|
|
75
|
+
if (!values || values.length === 0) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
lines.push("", `${label}:`);
|
|
79
|
+
for (const value of values) {
|
|
80
|
+
lines.push(`- ${value}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function normalizeList(values) {
|
|
84
|
+
const normalized = values?.map((value) => value.trim()).filter(Boolean);
|
|
85
|
+
return normalized && normalized.length > 0 ? normalized : undefined;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=draftRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draftRequest.js","sourceRoot":"","sources":["../../src/builder/draftRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,iCAAiC,EAAE,MAAM,mBAAmB,CAAC;AAyBtE,MAAM,UAAU,0BAA0B,CACxC,KAAsC;IAEtC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,eAAe,GAAoC;QACvD,GAAG,KAAK;QACR,WAAW,EAAE,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC;QAC7C,WAAW,EAAE,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC;QAC7C,WAAW,EAAE,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC;QAC7C,sBAAsB,EAAE,KAAK,CAAC,sBAAsB,IAAI,aAAa;KACtE,CAAC;IAEF,OAAO;QACL,kBAAkB,EAAE,iBAAiB;QACrC,mBAAmB,EAAE,iCAAiC;QACtD,kBAAkB,EAChB,oNAAoN;QACtN,UAAU,EAAE,eAAe,CAAC,eAAe,CAAC;QAC5C,kBAAkB,EAAE;YAClB,KAAK,EAAE,eAAe;YACtB,GAAG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B;IAC9E,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO;IACT,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,KAAK,GAAG,CAAC,CAAC;IAC5B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,MAA4B;IACjD,MAAM,UAAU,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACxE,OAAO,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createAgentKitBuilderInstructions = "---\nid: create-agent-kit\nname: Create Agent Kit Draft\ndescription: Design an AgentKitForge AgentKitDraft JSON object from a user request.\ntriggers:\n - create agent kit\n - design agent kit\n - draft agent kit\nriskLevel: medium\n---\n\n# Create Agent Kit Draft\n\n## Use when\n\nUse this skill when a user describes an Agent Kit they want to build and needs a structured AgentKitDraft JSON object.\n\n## Procedure\n\nRead the user's request, target users, domain, constraints, source notes, and any existing kit summary. Design a focused Agent Kit with clear skills, readable instructions, and practical examples. Prefer a small coherent kit over a broad collection of vague skills.\n\nFor each skill, provide a stable lowercase hyphenated id, concise name, description, trigger phrases, risk level, use-when guidance, procedure, and expected output. Include policies and examples when the requested validation level needs trusted content or when the domain has material risk. Do not invent provider-specific API calls, credentials, marketplace metadata, desktop app behavior, or infrastructure.\n\nReturn only JSON matching the provided AgentKitDraft schema. Do not wrap the JSON in Markdown.\n\n## Output\n\nReturn an AgentKitDraft JSON object ready for validation and rendering by AgentKitForge Core.\n";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const createAgentKitBuilderInstructions = `---
|
|
2
|
+
id: create-agent-kit
|
|
3
|
+
name: Create Agent Kit Draft
|
|
4
|
+
description: Design an AgentKitForge AgentKitDraft JSON object from a user request.
|
|
5
|
+
triggers:
|
|
6
|
+
- create agent kit
|
|
7
|
+
- design agent kit
|
|
8
|
+
- draft agent kit
|
|
9
|
+
riskLevel: medium
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Create Agent Kit Draft
|
|
13
|
+
|
|
14
|
+
## Use when
|
|
15
|
+
|
|
16
|
+
Use this skill when a user describes an Agent Kit they want to build and needs a structured AgentKitDraft JSON object.
|
|
17
|
+
|
|
18
|
+
## Procedure
|
|
19
|
+
|
|
20
|
+
Read the user's request, target users, domain, constraints, source notes, and any existing kit summary. Design a focused Agent Kit with clear skills, readable instructions, and practical examples. Prefer a small coherent kit over a broad collection of vague skills.
|
|
21
|
+
|
|
22
|
+
For each skill, provide a stable lowercase hyphenated id, concise name, description, trigger phrases, risk level, use-when guidance, procedure, and expected output. Include policies and examples when the requested validation level needs trusted content or when the domain has material risk. Do not invent provider-specific API calls, credentials, marketplace metadata, desktop app behavior, or infrastructure.
|
|
23
|
+
|
|
24
|
+
Return only JSON matching the provided AgentKitDraft schema. Do not wrap the JSON in Markdown.
|
|
25
|
+
|
|
26
|
+
## Output
|
|
27
|
+
|
|
28
|
+
Return an AgentKitDraft JSON object ready for validation and rendering by AgentKitForge Core.
|
|
29
|
+
`;
|
|
30
|
+
//# sourceMappingURL=instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/builder/instructions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iCAAiC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BhD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ExampleInputDocument } from "../app/exampleInputDocuments.js";
|
|
2
|
+
import { type AgentKitDraft } from "../draft/schema.js";
|
|
3
|
+
import type { AgentKitValidationProfile } from "../types.js";
|
|
4
|
+
export interface CreateAgentKitDraftRevisionRequestInput {
|
|
5
|
+
currentDraft: AgentKitDraft;
|
|
6
|
+
changeRequest: string;
|
|
7
|
+
originalRequest?: string;
|
|
8
|
+
desiredValidationLevel?: AgentKitValidationProfile;
|
|
9
|
+
constraints?: string[];
|
|
10
|
+
sourceNotes?: string[];
|
|
11
|
+
requestedSections?: string[];
|
|
12
|
+
excludedSections?: string[];
|
|
13
|
+
exampleInputDocuments?: ExampleInputDocument[];
|
|
14
|
+
}
|
|
15
|
+
export interface AgentKitDraftRevisionRequest {
|
|
16
|
+
responseFormatName: "agent_kit_draft_revision";
|
|
17
|
+
builderInstructions: string;
|
|
18
|
+
systemInstructions: string;
|
|
19
|
+
userPrompt: string;
|
|
20
|
+
expectedJsonSchema: unknown;
|
|
21
|
+
warnings: string[];
|
|
22
|
+
input: CreateAgentKitDraftRevisionRequestInput;
|
|
23
|
+
}
|
|
24
|
+
export declare function createAgentKitDraftRevisionRequest(input: CreateAgentKitDraftRevisionRequestInput): AgentKitDraftRevisionRequest;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { summarizeExampleInputDocument } from "../app/exampleInputDocuments.js";
|
|
3
|
+
import { agentKitDraftSchema } from "../draft/schema.js";
|
|
4
|
+
import { createAgentKitBuilderInstructions } from "./instructions.js";
|
|
5
|
+
export function createAgentKitDraftRevisionRequest(input) {
|
|
6
|
+
const parsedDraft = agentKitDraftSchema.safeParse(input.currentDraft);
|
|
7
|
+
if (!parsedDraft.success) {
|
|
8
|
+
throw new Error(`Invalid current AgentKitDraft: ${parsedDraft.error.issues
|
|
9
|
+
.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`)
|
|
10
|
+
.join("; ")}`);
|
|
11
|
+
}
|
|
12
|
+
if (!input.changeRequest.trim()) {
|
|
13
|
+
throw new Error("changeRequest is required");
|
|
14
|
+
}
|
|
15
|
+
const normalizedInput = {
|
|
16
|
+
...input,
|
|
17
|
+
currentDraft: parsedDraft.data,
|
|
18
|
+
constraints: normalizeList(input.constraints),
|
|
19
|
+
sourceNotes: normalizeList(input.sourceNotes),
|
|
20
|
+
desiredValidationLevel: input.desiredValidationLevel ?? "local-valid"
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
responseFormatName: "agent_kit_draft_revision",
|
|
24
|
+
builderInstructions: createAgentKitBuilderInstructions,
|
|
25
|
+
systemInstructions: "You are revising an existing AgentKitForge AgentKitDraft. Return only the full updated AgentKitDraft JSON. Do not return a patch.",
|
|
26
|
+
userPrompt: buildRevisionPrompt(normalizedInput),
|
|
27
|
+
expectedJsonSchema: {
|
|
28
|
+
title: "AgentKitDraft",
|
|
29
|
+
...z.toJSONSchema(agentKitDraftSchema)
|
|
30
|
+
},
|
|
31
|
+
warnings: buildRevisionWarnings(normalizedInput),
|
|
32
|
+
input: normalizedInput
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function buildRevisionPrompt(input) {
|
|
36
|
+
const lines = [
|
|
37
|
+
"Revise the existing AgentKitDraft JSON.",
|
|
38
|
+
"",
|
|
39
|
+
"Return the full updated AgentKitDraft JSON.",
|
|
40
|
+
"Do not return a patch, diff, prose summary, or Markdown wrapper.",
|
|
41
|
+
"Preserve useful existing content.",
|
|
42
|
+
"Apply the requested change.",
|
|
43
|
+
"Keep IDs stable unless the requested change requires changing them.",
|
|
44
|
+
"Preserve prepared prompts unless asked to remove or change them.",
|
|
45
|
+
"Add prepared prompts and input variables when the user asks for reusable prompts or required inputs.",
|
|
46
|
+
"Generate requested sections. Do not generate excluded sections unless required for validity.",
|
|
47
|
+
"Prefer simple useful kits over overly complex kits.",
|
|
48
|
+
"Do not generate scripts unless scripts are explicitly requested.",
|
|
49
|
+
"Keep output valid against the AgentKitDraft schema.",
|
|
50
|
+
"",
|
|
51
|
+
`Requested change: ${input.changeRequest}`,
|
|
52
|
+
`Desired validation level: ${input.desiredValidationLevel ?? "local-valid"}`
|
|
53
|
+
];
|
|
54
|
+
if (input.originalRequest) {
|
|
55
|
+
lines.push("", `Original request: ${input.originalRequest}`);
|
|
56
|
+
}
|
|
57
|
+
appendList(lines, "Constraints", input.constraints);
|
|
58
|
+
appendList(lines, "Source notes", input.sourceNotes);
|
|
59
|
+
appendList(lines, "Requested sections", input.requestedSections);
|
|
60
|
+
appendList(lines, "Excluded sections", input.excludedSections);
|
|
61
|
+
if (input.exampleInputDocuments && input.exampleInputDocuments.length > 0) {
|
|
62
|
+
lines.push("", "Example input document summaries:");
|
|
63
|
+
for (const document of input.exampleInputDocuments.map(summarizeExampleInputDocument)) {
|
|
64
|
+
lines.push(`- ${document.name} (${document.filename}, ${document.kind})${document.notes ? `: ${document.notes}` : ""}`);
|
|
65
|
+
}
|
|
66
|
+
lines.push("Use example input documents to infer formatting and expected outputs.", "Do not quote excessive source text. Summarize patterns into skills, templates, and prepared prompts.");
|
|
67
|
+
}
|
|
68
|
+
lines.push("", "Current AgentKitDraft JSON:", JSON.stringify(input.currentDraft, null, 2));
|
|
69
|
+
return lines.join("\n");
|
|
70
|
+
}
|
|
71
|
+
function buildRevisionWarnings(input) {
|
|
72
|
+
const warnings = [];
|
|
73
|
+
if ((input.currentDraft.preparedPrompts ?? []).length > 0) {
|
|
74
|
+
warnings.push("Current draft includes preparedPrompts; preserve or update them unless the change request says otherwise.");
|
|
75
|
+
}
|
|
76
|
+
if (input.desiredValidationLevel === "trusted" || input.desiredValidationLevel === "verified") {
|
|
77
|
+
warnings.push("Trusted and verified outputs should retain or add policies and examples where appropriate.");
|
|
78
|
+
}
|
|
79
|
+
return warnings;
|
|
80
|
+
}
|
|
81
|
+
function appendList(lines, label, values) {
|
|
82
|
+
if (!values || values.length === 0) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
lines.push("", `${label}:`);
|
|
86
|
+
for (const value of values) {
|
|
87
|
+
lines.push(`- ${value}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function normalizeList(values) {
|
|
91
|
+
const normalized = values?.map((value) => value.trim()).filter(Boolean);
|
|
92
|
+
return normalized && normalized.length > 0 ? normalized : undefined;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=revisionRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revisionRequest.js","sourceRoot":"","sources":["../../src/builder/revisionRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAsB,MAAM,oBAAoB,CAAC;AAE7E,OAAO,EAAE,iCAAiC,EAAE,MAAM,mBAAmB,CAAC;AAwBtE,MAAM,UAAU,kCAAkC,CAChD,KAA8C;IAE9C,MAAM,WAAW,GAAG,mBAAmB,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACtE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,kCAAkC,WAAW,CAAC,KAAK,CAAC,MAAM;aACvD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;aACvE,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,eAAe,GAA4C;QAC/D,GAAG,KAAK;QACR,YAAY,EAAE,WAAW,CAAC,IAAI;QAC9B,WAA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