@andreprado/agentkit 0.1.0-alpha.8 → 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/README.md +18 -1
- package/docs/guides/add-channel.md +251 -7
- package/docs/guides/add-knowledge.md +10 -0
- package/docs/guides/add-managed-composio.md +165 -0
- package/docs/guides/add-tool.md +10 -3
- package/docs/guides/channel-security.md +162 -32
- package/docs/guides/connect-discord.md +178 -0
- package/docs/guides/connect-slack.md +126 -0
- package/docs/guides/connect-telegram.md +61 -1
- package/docs/guides/connect-whatsapp-evolution.md +121 -0
- package/docs/guides/connect-whatsapp-uazapi.md +139 -0
- package/docs/guides/connect-whatsapp-zapster.md +119 -16
- package/docs/guides/create-agent.md +31 -4
- package/docs/guides/debug-channel.md +159 -0
- package/docs/guides/improve-from-production.md +151 -0
- package/docs/guides/prepare-deploy.md +32 -14
- package/docs/guides/replay-production-traces.md +72 -0
- package/docs/guides/run-evals.md +95 -25
- package/docs/guides/security-rules.md +9 -5
- package/docs/guides/send-feedback.md +135 -0
- package/docs/guides/use-jev.md +67 -0
- package/docs/guides/use-provider.md +70 -3
- package/docs/llms-full.txt +295 -25
- package/docs/llms.txt +54 -7
- package/package.json +3 -7
- package/src/cli/args.ts +23 -2
- package/src/cli/cloud-client.ts +121 -9
- package/src/cli/commands/channels.ts +1185 -50
- package/src/cli/commands/feedback.ts +438 -0
- package/src/cli/commands/provider.ts +47 -0
- package/src/cli/commands/transcribe.ts +171 -0
- package/src/cli/deploy-chat-ui.ts +232 -18
- package/src/cli/deploy-readiness.ts +227 -14
- package/src/cli/help.ts +68 -8
- package/src/cli/index.ts +740 -35
- package/src/cli/new-command.ts +41 -0
- package/src/cloud/client.ts +4 -3
- package/src/cloud/contracts.ts +1 -1
- package/src/create-project.ts +18 -35
- package/src/index.ts +565 -11
- package/src/providers/codex-auth.ts +111 -0
- package/src/providers/pi.ts +88 -19
- package/src/providers/test.ts +36 -0
- package/src/providers/types.ts +8 -0
- package/src/runtime/channel-test-harness.ts +21 -1
- package/src/runtime/channels/discord.ts +896 -0
- package/src/runtime/channels/generic-webhook.ts +974 -0
- package/src/runtime/channels/slack.ts +646 -0
- package/src/runtime/channels/telegram.ts +466 -23
- package/src/runtime/channels/whatsapp-evolution.ts +1357 -0
- package/src/runtime/channels/whatsapp-meta.ts +9 -0
- package/src/runtime/channels/whatsapp-uazapi.ts +1323 -0
- package/src/runtime/channels/whatsapp-zapster.ts +674 -40
- package/src/runtime/channels.ts +89 -4
- package/src/runtime/chat.ts +70 -44
- package/src/runtime/config.ts +489 -20
- package/src/runtime/core/manifest.ts +75 -5
- package/src/runtime/core/targets.ts +5 -5
- package/src/runtime/deploy-readiness.ts +34 -4
- package/src/runtime/dev-server.ts +639 -39
- package/src/runtime/env.ts +8 -3
- package/src/runtime/evals.ts +445 -74
- package/src/runtime/improve.ts +868 -0
- package/src/runtime/inspect.ts +173 -4
- package/src/runtime/integrations/composio.ts +425 -0
- package/src/runtime/knowledge/retrieve.ts +25 -5
- package/src/runtime/knowledge/schema.ts +45 -1
- package/src/runtime/prompt-context.ts +141 -0
- package/src/runtime/runtime-contract.ts +71 -7
- package/src/runtime/skills.ts +95 -0
- package/src/runtime/targets/cloudflare/build.ts +1010 -208
- package/src/runtime/targets/container/server.ts +1 -1
- package/src/runtime/targets/vps/deploy.ts +26 -9
- package/src/runtime/tool-runner.ts +9 -1
- package/src/runtime/tools.ts +26 -2
- package/src/runtime/transcription.ts +483 -0
- package/src/storage/sqlite.ts +7 -2
- package/src/templates/blank.ts +37 -9
- package/src/templates/dentista.ts +40 -14
- package/src/templates/skills/agentkit-build-agent/SKILL.md +34 -5
- package/src/templates/skills/agentkit-build-agent/templates/appointment-intake.instructions.md +2 -1
- package/src/templates/skills/agentkit-capsule/SKILL.md +32 -3
- package/src/templates/skills/agentkit-capsule/references/docs-router.md +2 -2
- package/src/templates/skills/agentkit-channels/SKILL.md +71 -6
- package/src/templates/skills/agentkit-channels/references/channel-buffering.md +9 -2
- package/src/templates/skills/agentkit-channels/references/channel-debugging.md +34 -5
- package/src/templates/skills/agentkit-channels/references/discord.md +93 -0
- package/src/templates/skills/agentkit-channels/references/slack.md +56 -0
- package/src/templates/skills/agentkit-channels/references/telegram.md +39 -4
- package/src/templates/skills/agentkit-channels/references/whatsapp-evolution.md +57 -0
- package/src/templates/skills/agentkit-channels/references/whatsapp-uazapi.md +54 -0
- package/src/templates/skills/agentkit-channels/references/whatsapp-zapster.md +42 -8
- package/src/templates/skills/agentkit-database/SKILL.md +11 -0
- package/src/templates/skills/agentkit-deploy/SKILL.md +9 -1
- package/src/templates/skills/agentkit-evals/SKILL.md +77 -13
- package/src/templates/skills/agentkit-evals/templates/multi-turn.eval.md +13 -6
- package/src/templates/skills/agentkit-evals/templates/no-leak.eval.md +8 -4
- package/src/templates/skills/agentkit-evals/templates/smoke.eval.md +8 -4
- package/src/templates/skills/agentkit-evals/templates/tool-call.eval.md +16 -7
- package/src/templates/skills/agentkit-improve/SKILL.md +96 -0
- package/src/templates/skills/agentkit-improve/references/replay-side-effects.md +18 -0
- package/src/templates/skills/agentkit-improve/references/trace-packets.md +22 -0
- package/src/templates/skills/agentkit-improve/templates/regression.eval.md +18 -0
- package/src/templates/skills/agentkit-integrations/SKILL.md +98 -0
- package/src/templates/skills/agentkit-knowledge/SKILL.md +4 -1
- package/src/templates/skills/agentkit-prompts/SKILL.md +3 -1
- package/src/templates/skills/agentkit-provider/SKILL.md +29 -4
- package/src/templates/skills/agentkit-security/SKILL.md +5 -2
- package/src/templates/skills/agentkit-tools/SKILL.md +8 -1
- package/src/templates/skills/agentkit-tools/examples/eval-safe-external-action.tool.md +8 -8
- package/src/templates/skills/agentkit-tools/examples/jev-service-fit.tool.md +110 -0
- package/src/templates/skills/agentkit-troubleshooting/SKILL.md +25 -1
- package/src/templates/support.ts +42 -12
- package/docs/guides/agentkit-skills-architecture.md +0 -471
- package/docs/guides/channels-implementation-map.md +0 -243
- package/docs/guides/channels-production-handoff.md +0 -101
- package/docs/portable-deploy-release-checklist.md +0 -41
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createInterface } from "node:readline/promises";
|
|
2
|
+
|
|
3
|
+
const newUsage = "agentkit new [name] [--template blank|support|dentista] [--no-install]";
|
|
4
|
+
|
|
5
|
+
export async function resolveNewProjectName(
|
|
6
|
+
positional: string[],
|
|
7
|
+
promptProjectName: () => Promise<string> = promptForProjectName,
|
|
8
|
+
): Promise<string> {
|
|
9
|
+
const [name] = positional;
|
|
10
|
+
|
|
11
|
+
if (name) {
|
|
12
|
+
return name;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const promptedName = (await promptProjectName()).trim();
|
|
16
|
+
|
|
17
|
+
if (!promptedName) {
|
|
18
|
+
throw new Error(`Project name is required. Usage: ${newUsage}`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return promptedName;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function promptForProjectName(): Promise<string> {
|
|
25
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
26
|
+
throw new Error(
|
|
27
|
+
`Missing project name. Usage: ${newUsage}. Run \`agentkit new\` in an interactive terminal to be prompted, or pass \`agentkit new <name>\` / \`agentkit new .\` in scripts.`,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const readline = createInterface({
|
|
32
|
+
input: process.stdin,
|
|
33
|
+
output: process.stdout,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
return await readline.question("Project folder name (or . for current directory): ");
|
|
38
|
+
} finally {
|
|
39
|
+
readline.close();
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/cloud/client.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
1
|
+
import { chmod, mkdir, writeFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
|
|
4
4
|
import type { AgentBuildResult } from "../runtime/targets/cloudflare/build";
|
|
@@ -15,7 +15,7 @@ export async function deployBuildToAgentKitCloud(
|
|
|
15
15
|
const headers = new Headers({
|
|
16
16
|
"Content-Type": "application/json",
|
|
17
17
|
});
|
|
18
|
-
const apiToken = options.apiToken ?? process.env.AGENTKIT_CLOUD_API_TOKEN;
|
|
18
|
+
const apiToken = options.anonymous ? undefined : options.apiToken ?? process.env.AGENTKIT_CLOUD_API_TOKEN;
|
|
19
19
|
|
|
20
20
|
if (apiToken) {
|
|
21
21
|
headers.set("Authorization", `Bearer ${apiToken}`);
|
|
@@ -70,7 +70,8 @@ export async function writeLocalDeployState(root: string, deploy: CreateDeployRe
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
await mkdir(join(root, ".agentkit"), { recursive: true });
|
|
73
|
-
await writeFile(statePath, `${JSON.stringify(state, null, 2)}\n
|
|
73
|
+
await writeFile(statePath, `${JSON.stringify(state, null, 2)}\n`, { mode: 0o600 });
|
|
74
|
+
await chmod(statePath, 0o600);
|
|
74
75
|
return statePath;
|
|
75
76
|
}
|
|
76
77
|
|
package/src/cloud/contracts.ts
CHANGED
package/src/create-project.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
|
-
import { mkdir, readFile,
|
|
3
|
-
import { basename, dirname, join,
|
|
2
|
+
import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
3
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
4
4
|
import { promisify } from "node:util";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { loadDefaultSkillFiles } from "./runtime/skills";
|
|
8
|
+
import { getTemplate } from "./templates";
|
|
8
9
|
|
|
9
10
|
const execFileAsync = promisify(execFile);
|
|
10
11
|
const moduleDir = dirname(fileURLToPath(import.meta.url));
|
|
@@ -41,8 +42,7 @@ export async function createProject(options: CreateProjectOptions): Promise<Crea
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
for (const file of files) {
|
|
44
|
-
const absolutePath =
|
|
45
|
-
const directory = absolutePath.slice(0, absolutePath.lastIndexOf("/"));
|
|
45
|
+
const { absolutePath, directory } = resolveProjectFilePath(projectPath, file.path);
|
|
46
46
|
|
|
47
47
|
await mkdir(directory, { recursive: true });
|
|
48
48
|
await writeFile(absolutePath, file.contents);
|
|
@@ -57,6 +57,18 @@ export async function createProject(options: CreateProjectOptions): Promise<Crea
|
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
export function resolveProjectFilePath(
|
|
61
|
+
projectPath: string,
|
|
62
|
+
filePath: string,
|
|
63
|
+
pathApi: Pick<typeof import("node:path"), "dirname" | "join"> = { dirname, join },
|
|
64
|
+
): { absolutePath: string; directory: string } {
|
|
65
|
+
const absolutePath = pathApi.join(projectPath, filePath);
|
|
66
|
+
return {
|
|
67
|
+
absolutePath,
|
|
68
|
+
directory: pathApi.dirname(absolutePath),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
60
72
|
function resolveProjectTarget(options: CreateProjectOptions): { name: string; path: string; currentDirectory: boolean } {
|
|
61
73
|
if (options.name === ".") {
|
|
62
74
|
const path = resolve(options.cwd);
|
|
@@ -114,7 +126,7 @@ async function resolveAgentKitDependency(): Promise<string> {
|
|
|
114
126
|
|
|
115
127
|
const packageRoot = resolve(moduleDir, "..");
|
|
116
128
|
|
|
117
|
-
if (await
|
|
129
|
+
if (await pathExists(resolve(packageRoot, "../..", ".git"))) {
|
|
118
130
|
return `file:${packageRoot}`;
|
|
119
131
|
}
|
|
120
132
|
|
|
@@ -129,35 +141,6 @@ async function resolveAgentKitDependency(): Promise<string> {
|
|
|
129
141
|
return packageJson.version;
|
|
130
142
|
}
|
|
131
143
|
|
|
132
|
-
async function loadDefaultSkillFiles(): Promise<TemplateFile[]> {
|
|
133
|
-
const sourceRoot = join(moduleDir, "templates", "skills");
|
|
134
|
-
const sourceFiles = await listFiles(sourceRoot);
|
|
135
|
-
|
|
136
|
-
return Promise.all(
|
|
137
|
-
sourceFiles.map(async (sourcePath) => ({
|
|
138
|
-
path: join("skills", relative(sourceRoot, sourcePath)).replaceAll("\\", "/"),
|
|
139
|
-
contents: await readFile(sourcePath, "utf8"),
|
|
140
|
-
})),
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
async function listFiles(directory: string): Promise<string[]> {
|
|
145
|
-
const entries = await readdir(directory, { withFileTypes: true });
|
|
146
|
-
const files = await Promise.all(
|
|
147
|
-
entries.map(async (entry) => {
|
|
148
|
-
const path = join(directory, entry.name);
|
|
149
|
-
|
|
150
|
-
if (entry.isDirectory()) {
|
|
151
|
-
return listFiles(path);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return entry.isFile() ? [path] : [];
|
|
155
|
-
}),
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
return files.flat().sort();
|
|
159
|
-
}
|
|
160
|
-
|
|
161
144
|
async function directoryExists(path: string): Promise<boolean> {
|
|
162
145
|
try {
|
|
163
146
|
const result = await stat(path);
|