@andreprado/agentkit 0.1.0-alpha.9 → 0.1.1
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 +856 -36
- 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 +67 -9
- 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 +904 -0
- package/src/runtime/channels/generic-webhook.ts +682 -0
- package/src/runtime/channels/net-guard.ts +480 -0
- package/src/runtime/channels/provider-fetch.ts +54 -0
- package/src/runtime/channels/slack.ts +652 -0
- package/src/runtime/channels/telegram.ts +379 -15
- package/src/runtime/channels/whatsapp-evolution.ts +1330 -0
- package/src/runtime/channels/whatsapp-meta.ts +9 -0
- package/src/runtime/channels/whatsapp-uazapi.ts +1192 -0
- package/src/runtime/channels/whatsapp-zapster.ts +702 -40
- package/src/runtime/channels.ts +83 -3
- package/src/runtime/chat.ts +70 -44
- package/src/runtime/config.ts +512 -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/embeddings.ts +45 -7
- package/src/runtime/knowledge/ingest.ts +69 -6
- package/src/runtime/knowledge/retrieve.ts +25 -5
- package/src/runtime/knowledge/schema.ts +45 -1
- package/src/runtime/knowledge/vector.ts +30 -30
- 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 +66 -1
- package/src/templates/skills/agentkit-channels/references/channel-buffering.md +8 -1
- package/src/templates/skills/agentkit-channels/references/channel-debugging.md +28 -3
- 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 +34 -0
- 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
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { relative, resolve } from "node:path";
|
|
2
2
|
|
|
3
|
+
import { AgentKitError } from "../errors";
|
|
4
|
+
|
|
3
5
|
import type { AgentConfig, AgentTool } from "../../index";
|
|
4
6
|
import type { LoadedAgentCapsule } from "../config";
|
|
7
|
+
import {
|
|
8
|
+
createManagedComposioTools,
|
|
9
|
+
managedComposioRequiredSecrets,
|
|
10
|
+
resolveManagedComposioIntegrations,
|
|
11
|
+
} from "../integrations/composio";
|
|
5
12
|
import { resolveKnowledgeConfig } from "../knowledge/config";
|
|
6
13
|
import { KNOWLEDGE_SEARCH_TOOL_NAME } from "../knowledge/tool";
|
|
14
|
+
import { resolveTranscriptionConfig } from "../transcription";
|
|
7
15
|
|
|
8
16
|
export type ManifestSchema = {
|
|
9
17
|
source: string;
|
|
@@ -15,6 +23,7 @@ export type SharedAgentManifest = {
|
|
|
15
23
|
name: string;
|
|
16
24
|
runtime: AgentConfig["runtime"];
|
|
17
25
|
provider: AgentConfig["provider"];
|
|
26
|
+
timeZone: string | null;
|
|
18
27
|
prompt: string;
|
|
19
28
|
secrets: string[];
|
|
20
29
|
tools: Array<{
|
|
@@ -26,7 +35,29 @@ export type SharedAgentManifest = {
|
|
|
26
35
|
permissions: string[];
|
|
27
36
|
timeoutMs: number | null;
|
|
28
37
|
}>;
|
|
38
|
+
integrations: Array<{
|
|
39
|
+
name: string;
|
|
40
|
+
provider: "composio";
|
|
41
|
+
mode: "managed";
|
|
42
|
+
toolkits: string[];
|
|
43
|
+
tools: string[];
|
|
44
|
+
userId: string;
|
|
45
|
+
confirmExternalWrites: boolean;
|
|
46
|
+
}>;
|
|
29
47
|
channels: NonNullable<AgentConfig["channels"]>;
|
|
48
|
+
transcription: {
|
|
49
|
+
enabled: boolean;
|
|
50
|
+
provider: string | null;
|
|
51
|
+
model: string | null;
|
|
52
|
+
secret: string | null;
|
|
53
|
+
language: string | null;
|
|
54
|
+
prompt: string | null;
|
|
55
|
+
limits: {
|
|
56
|
+
maxDurationSeconds: number | null;
|
|
57
|
+
maxBytes: number | null;
|
|
58
|
+
};
|
|
59
|
+
rawAudioTtlSeconds: number | null;
|
|
60
|
+
};
|
|
30
61
|
knowledge: {
|
|
31
62
|
enabled: boolean;
|
|
32
63
|
sources: Array<{
|
|
@@ -75,14 +106,22 @@ export function buildSharedAgentManifest(
|
|
|
75
106
|
capsule: LoadedAgentCapsule,
|
|
76
107
|
options: { databaseSchema?: ManifestSchema | null } = {},
|
|
77
108
|
): SharedAgentManifest {
|
|
109
|
+
if (capsule.config.provider.name === "openai-codex") {
|
|
110
|
+
throw new AgentKitError(
|
|
111
|
+
"target_runtime_incompatible",
|
|
112
|
+
"openai-codex uses a local ChatGPT login. Use agentkit dev/chat/eval locally, or select an API-key provider with managed secrets for Cloudflare, container, or VPS deployment.",
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
78
116
|
const requiredSecrets = new Set(capsule.config.secrets);
|
|
79
117
|
const database = buildDatabaseManifest(capsule, options.databaseSchema ?? null);
|
|
80
118
|
const files = buildFilesManifest(capsule);
|
|
81
119
|
const knowledge = resolveKnowledgeConfig(capsule.config);
|
|
120
|
+
const integrationTools = createManagedComposioTools(capsule.config);
|
|
121
|
+
const tools = [...integrationTools, ...(capsule.config.tools ?? [])];
|
|
122
|
+
const transcription = resolveTranscriptionConfig(capsule.config.transcription);
|
|
82
123
|
|
|
83
|
-
|
|
84
|
-
requiredSecrets.add("AGENTKIT_PRIVATE_TOKEN");
|
|
85
|
-
}
|
|
124
|
+
requiredSecrets.add("AGENTKIT_PRIVATE_TOKEN");
|
|
86
125
|
|
|
87
126
|
if (capsule.config.access.mode === "token") {
|
|
88
127
|
requiredSecrets.add("AGENTKIT_ACCESS_TOKEN");
|
|
@@ -101,7 +140,15 @@ export function buildSharedAgentManifest(
|
|
|
101
140
|
requiredSecrets.add(knowledge.embedding.secret);
|
|
102
141
|
}
|
|
103
142
|
|
|
104
|
-
|
|
143
|
+
if (transcription.secret) {
|
|
144
|
+
requiredSecrets.add(transcription.secret);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
for (const secret of managedComposioRequiredSecrets(capsule.config)) {
|
|
148
|
+
requiredSecrets.add(secret);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
for (const tool of tools) {
|
|
105
152
|
for (const secret of tool.secrets ?? []) {
|
|
106
153
|
requiredSecrets.add(secret);
|
|
107
154
|
}
|
|
@@ -118,9 +165,10 @@ export function buildSharedAgentManifest(
|
|
|
118
165
|
name: capsule.config.name,
|
|
119
166
|
runtime: capsule.config.runtime,
|
|
120
167
|
provider: capsule.config.provider,
|
|
168
|
+
timeZone: capsule.config.timeZone ?? null,
|
|
121
169
|
prompt: toCapsulePath(capsule, capsule.instructionsPath),
|
|
122
170
|
secrets: Array.from(requiredSecrets).sort(),
|
|
123
|
-
tools:
|
|
171
|
+
tools: tools.map((tool) => ({
|
|
124
172
|
name: tool.name,
|
|
125
173
|
description: tool.description,
|
|
126
174
|
inputSchema: tool.inputSchema,
|
|
@@ -129,7 +177,29 @@ export function buildSharedAgentManifest(
|
|
|
129
177
|
permissions: [...(tool.permissions ?? [])].sort(),
|
|
130
178
|
timeoutMs: tool.timeoutMs ?? null,
|
|
131
179
|
})),
|
|
180
|
+
integrations: resolveManagedComposioIntegrations(capsule.config).map((integration) => ({
|
|
181
|
+
name: integration.name,
|
|
182
|
+
provider: integration.provider,
|
|
183
|
+
mode: integration.mode,
|
|
184
|
+
toolkits: integration.toolkits,
|
|
185
|
+
tools: integration.allowedTools,
|
|
186
|
+
userId: integration.userId,
|
|
187
|
+
confirmExternalWrites: integration.confirmExternalWrites !== false,
|
|
188
|
+
})),
|
|
132
189
|
channels: capsule.config.channels ?? [],
|
|
190
|
+
transcription: {
|
|
191
|
+
enabled: transcription.enabled,
|
|
192
|
+
provider: transcription.enabled ? transcription.provider : null,
|
|
193
|
+
model: transcription.enabled ? transcription.model : null,
|
|
194
|
+
secret: transcription.secret,
|
|
195
|
+
language: transcription.language,
|
|
196
|
+
prompt: transcription.prompt,
|
|
197
|
+
limits: {
|
|
198
|
+
maxDurationSeconds: transcription.limits.maxDurationSeconds ?? null,
|
|
199
|
+
maxBytes: transcription.limits.maxBytes ?? null,
|
|
200
|
+
},
|
|
201
|
+
rawAudioTtlSeconds: transcription.rawAudioTtlSeconds,
|
|
202
|
+
},
|
|
133
203
|
knowledge: {
|
|
134
204
|
enabled: knowledge.enabled,
|
|
135
205
|
sources: knowledge.sources.map((source) => ({
|
|
@@ -6,7 +6,7 @@ export type RuntimeTargetId = (typeof runtimeTargetIds)[number];
|
|
|
6
6
|
export type RuntimeTargetCapabilityState = "available" | "planned" | "unsupported";
|
|
7
7
|
export type RuntimeStorageCapability = "agentkit" | "durable-object-sqlite" | "local-sqlite" | "postgres";
|
|
8
8
|
export type RuntimeFilesCapability = "none" | "r2" | "local-disk" | "s3-compatible";
|
|
9
|
-
export type RuntimeChannelCapability = "website" | "telegram" | "whatsapp";
|
|
9
|
+
export type RuntimeChannelCapability = "website" | "telegram" | "whatsapp" | "discord" | "slack" | "webhook";
|
|
10
10
|
export type RuntimeProviderSupport = "pi-local" | "edge-compatible" | "server-env";
|
|
11
11
|
|
|
12
12
|
export type RuntimeTargetCapabilities = {
|
|
@@ -35,7 +35,7 @@ export const runtimeTargets: Readonly<Record<RuntimeTargetId, RuntimeTarget>> =
|
|
|
35
35
|
dev: "available",
|
|
36
36
|
storage: ["local-sqlite"],
|
|
37
37
|
files: ["local-disk"],
|
|
38
|
-
channels: ["website"],
|
|
38
|
+
channels: ["website", "slack", "webhook"],
|
|
39
39
|
providers: ["pi-local"],
|
|
40
40
|
},
|
|
41
41
|
},
|
|
@@ -48,7 +48,7 @@ export const runtimeTargets: Readonly<Record<RuntimeTargetId, RuntimeTarget>> =
|
|
|
48
48
|
dev: "planned",
|
|
49
49
|
storage: ["agentkit", "durable-object-sqlite", "postgres"],
|
|
50
50
|
files: ["none", "r2"],
|
|
51
|
-
channels: ["website", "telegram", "whatsapp"],
|
|
51
|
+
channels: ["website", "telegram", "whatsapp", "discord", "slack", "webhook"],
|
|
52
52
|
providers: ["edge-compatible"],
|
|
53
53
|
},
|
|
54
54
|
},
|
|
@@ -61,7 +61,7 @@ export const runtimeTargets: Readonly<Record<RuntimeTargetId, RuntimeTarget>> =
|
|
|
61
61
|
dev: "planned",
|
|
62
62
|
storage: ["local-sqlite", "postgres"],
|
|
63
63
|
files: ["none", "local-disk", "s3-compatible"],
|
|
64
|
-
channels: ["website", "telegram", "whatsapp"],
|
|
64
|
+
channels: ["website", "telegram", "whatsapp", "discord", "slack", "webhook"],
|
|
65
65
|
providers: ["server-env"],
|
|
66
66
|
},
|
|
67
67
|
},
|
|
@@ -74,7 +74,7 @@ export const runtimeTargets: Readonly<Record<RuntimeTargetId, RuntimeTarget>> =
|
|
|
74
74
|
dev: "unsupported",
|
|
75
75
|
storage: ["local-sqlite", "postgres"],
|
|
76
76
|
files: ["none", "local-disk", "s3-compatible"],
|
|
77
|
-
channels: ["website", "telegram", "whatsapp"],
|
|
77
|
+
channels: ["website", "telegram", "whatsapp", "discord", "slack", "webhook"],
|
|
78
78
|
providers: ["server-env"],
|
|
79
79
|
},
|
|
80
80
|
},
|
|
@@ -3,6 +3,10 @@ import { createHash } from "node:crypto";
|
|
|
3
3
|
import { loadAgentCapsule } from "./config";
|
|
4
4
|
import { buildSharedAgentManifest } from "./core/manifest";
|
|
5
5
|
import { listCapsuleEnv } from "./env";
|
|
6
|
+
import {
|
|
7
|
+
MANAGED_COMPOSIO_API_KEY_SECRET,
|
|
8
|
+
resolveManagedComposioIntegrations,
|
|
9
|
+
} from "./integrations/composio";
|
|
6
10
|
|
|
7
11
|
export type DeployReadinessSecretSource = {
|
|
8
12
|
dotenv: boolean;
|
|
@@ -30,6 +34,14 @@ export type DeployReadinessContext = {
|
|
|
30
34
|
embeddingProvider: string;
|
|
31
35
|
databaseDriver: "none" | "turso";
|
|
32
36
|
};
|
|
37
|
+
integrations: {
|
|
38
|
+
managedComposio: {
|
|
39
|
+
enabled: boolean;
|
|
40
|
+
toolkits: string[];
|
|
41
|
+
toolCount: number;
|
|
42
|
+
userId: string | null;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
33
45
|
};
|
|
34
46
|
|
|
35
47
|
export async function loadDeployReadinessContext(
|
|
@@ -38,6 +50,7 @@ export async function loadDeployReadinessContext(
|
|
|
38
50
|
): Promise<DeployReadinessContext> {
|
|
39
51
|
const capsule = await loadAgentCapsule(cwd);
|
|
40
52
|
const manifest = buildSharedAgentManifest(capsule);
|
|
53
|
+
const managedComposio = resolveManagedComposioIntegrations(capsule.config)[0];
|
|
41
54
|
const dotenvNames = new Set(await listCapsuleEnv(capsule.root));
|
|
42
55
|
const requiredSecrets = manifest.secrets;
|
|
43
56
|
const localSecrets: Record<string, DeployReadinessSecretSource> = {};
|
|
@@ -57,6 +70,7 @@ export async function loadDeployReadinessContext(
|
|
|
57
70
|
isAgentKitManagedDeploySecret(name, {
|
|
58
71
|
accessMode: capsule.config.access.mode,
|
|
59
72
|
databaseDriver: manifest.storage.database.driver,
|
|
73
|
+
managedComposioEnabled: Boolean(managedComposio),
|
|
60
74
|
}),
|
|
61
75
|
);
|
|
62
76
|
const managed = new Set(agentKitManagedSecrets);
|
|
@@ -82,22 +96,38 @@ export async function loadDeployReadinessContext(
|
|
|
82
96
|
embeddingProvider: manifest.knowledge.embedding.provider,
|
|
83
97
|
databaseDriver: manifest.storage.database.driver,
|
|
84
98
|
},
|
|
99
|
+
integrations: {
|
|
100
|
+
managedComposio: {
|
|
101
|
+
enabled: Boolean(managedComposio),
|
|
102
|
+
toolkits: managedComposio?.toolkits ?? [],
|
|
103
|
+
toolCount: managedComposio?.allowedTools.length ?? 0,
|
|
104
|
+
userId: managedComposio?.userId ?? null,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
85
107
|
};
|
|
86
108
|
}
|
|
87
109
|
|
|
88
|
-
export function stableCloudProjectId(name: string): string {
|
|
89
|
-
return `proj_${createHash("sha256").update(name).digest("hex").slice(0, 16)}`;
|
|
110
|
+
export function stableCloudProjectId(name: string, accountId?: string | null): string {
|
|
111
|
+
return `proj_${createHash("sha256").update(`${accountId ? `account:${accountId}` : "anonymous"}:${name}`).digest("hex").slice(0, 16)}`;
|
|
90
112
|
}
|
|
91
113
|
|
|
92
114
|
function isAgentKitManagedDeploySecret(
|
|
93
115
|
name: string,
|
|
94
|
-
context: {
|
|
116
|
+
context: {
|
|
117
|
+
accessMode: DeployReadinessContext["accessMode"];
|
|
118
|
+
databaseDriver: "none" | "turso";
|
|
119
|
+
managedComposioEnabled: boolean;
|
|
120
|
+
},
|
|
95
121
|
): boolean {
|
|
96
122
|
if (context.databaseDriver === "turso" && (name === "TURSO_DATABASE_URL" || name === "TURSO_AUTH_TOKEN")) {
|
|
97
123
|
return true;
|
|
98
124
|
}
|
|
99
125
|
|
|
100
|
-
if (
|
|
126
|
+
if (name === "AGENTKIT_PRIVATE_TOKEN") {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (context.managedComposioEnabled && name === MANAGED_COMPOSIO_API_KEY_SECRET) {
|
|
101
131
|
return true;
|
|
102
132
|
}
|
|
103
133
|
|