@andreprado/agentkit 0.1.0-alpha.2 → 0.1.0-alpha.20

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.
Files changed (135) hide show
  1. package/README.md +67 -6
  2. package/docs/guides/add-channel.md +118 -7
  3. package/docs/guides/add-knowledge.md +144 -0
  4. package/docs/guides/add-managed-composio.md +163 -0
  5. package/docs/guides/add-tool.md +1 -1
  6. package/docs/guides/channel-security.md +97 -32
  7. package/docs/guides/connect-discord.md +178 -0
  8. package/docs/guides/connect-slack.md +126 -0
  9. package/docs/guides/connect-telegram.md +78 -1
  10. package/docs/guides/connect-whatsapp-zapster.md +112 -8
  11. package/docs/guides/create-agent.md +45 -4
  12. package/docs/guides/debug-channel.md +147 -0
  13. package/docs/guides/improve-from-production.md +151 -0
  14. package/docs/guides/prepare-deploy.md +47 -17
  15. package/docs/guides/replay-production-traces.md +72 -0
  16. package/docs/guides/run-evals.md +147 -20
  17. package/docs/guides/security-rules.md +7 -6
  18. package/docs/guides/send-feedback.md +135 -0
  19. package/docs/guides/use-provider.md +27 -3
  20. package/docs/llms-full.txt +303 -55
  21. package/docs/llms.txt +57 -7
  22. package/package.json +2 -5
  23. package/src/cli/args.ts +57 -0
  24. package/src/cli/cloud-client.ts +377 -0
  25. package/src/cli/commands/channels.ts +1315 -0
  26. package/src/cli/commands/feedback.ts +438 -0
  27. package/src/cli/commands/knowledge.ts +136 -0
  28. package/src/cli/commands/transcribe.ts +171 -0
  29. package/src/cli/constants.ts +4 -0
  30. package/src/cli/deploy-chat-ui.ts +535 -0
  31. package/src/cli/deploy-readiness.ts +481 -0
  32. package/src/cli/flags.ts +162 -0
  33. package/src/cli/help.ts +236 -0
  34. package/src/cli/index.ts +1167 -1005
  35. package/src/cli/process.ts +31 -0
  36. package/src/cloud/artifact.ts +139 -0
  37. package/src/cloud/client.ts +80 -0
  38. package/src/cloud/contracts.ts +63 -0
  39. package/src/cloud/index.ts +3 -0
  40. package/src/create-project.ts +21 -6
  41. package/src/index.ts +479 -7
  42. package/src/providers/pi.ts +70 -16
  43. package/src/providers/test.ts +88 -1
  44. package/src/providers/types.ts +7 -0
  45. package/src/runtime/channel-buffer.ts +30 -0
  46. package/src/runtime/channel-test-harness.ts +8 -1
  47. package/src/runtime/channels/discord.ts +896 -0
  48. package/src/runtime/channels/slack.ts +646 -0
  49. package/src/runtime/channels/telegram.ts +466 -23
  50. package/src/runtime/channels/whatsapp-meta.ts +9 -0
  51. package/src/runtime/channels/whatsapp-zapster.ts +677 -40
  52. package/src/runtime/channels.ts +86 -3
  53. package/src/runtime/chat.ts +130 -38
  54. package/src/runtime/config.ts +483 -18
  55. package/src/runtime/core/manifest.ts +103 -5
  56. package/src/runtime/core/targets.ts +5 -5
  57. package/src/runtime/database.ts +93 -2
  58. package/src/runtime/db-commands.ts +9 -0
  59. package/src/runtime/deploy-readiness.ts +46 -4
  60. package/src/runtime/deploy.ts +1 -1
  61. package/src/runtime/dev-server.ts +759 -41
  62. package/src/runtime/env.ts +8 -3
  63. package/src/runtime/evals.ts +589 -43
  64. package/src/runtime/improve.ts +868 -0
  65. package/src/runtime/inspect.ts +194 -4
  66. package/src/runtime/integrations/composio.ts +423 -0
  67. package/src/runtime/knowledge/chunk.ts +333 -0
  68. package/src/runtime/knowledge/config.ts +135 -0
  69. package/src/runtime/knowledge/embeddings.ts +133 -0
  70. package/src/runtime/knowledge/ingest.ts +521 -0
  71. package/src/runtime/knowledge/prompt-policy.ts +30 -0
  72. package/src/runtime/knowledge/retrieve.ts +303 -0
  73. package/src/runtime/knowledge/schema.ts +100 -0
  74. package/src/runtime/knowledge/tool.ts +64 -0
  75. package/src/runtime/knowledge/vector.ts +258 -0
  76. package/src/runtime/prompt-context.ts +141 -0
  77. package/src/runtime/runtime-contract.ts +86 -8
  78. package/src/runtime/skills.ts +95 -0
  79. package/src/runtime/spec.ts +152 -0
  80. package/src/runtime/sync.ts +144 -0
  81. package/src/runtime/targets/cloudflare/build.ts +1430 -185
  82. package/src/runtime/targets/container/server.ts +1 -1
  83. package/src/runtime/targets/vps/deploy.ts +26 -9
  84. package/src/runtime/tool-runner.ts +9 -1
  85. package/src/runtime/tools.ts +128 -2
  86. package/src/runtime/traces.ts +41 -0
  87. package/src/runtime/transcription.ts +483 -0
  88. package/src/storage/sqlite.ts +149 -3
  89. package/src/templates/blank.ts +76 -17
  90. package/src/templates/dentista.ts +1011 -0
  91. package/src/templates/index.ts +2 -0
  92. package/src/templates/skills/agentkit-build-agent/SKILL.md +52 -0
  93. package/src/templates/skills/agentkit-build-agent/templates/appointment-intake.instructions.md +21 -0
  94. package/src/templates/skills/agentkit-build-agent/templates/sales-qualifier.instructions.md +17 -0
  95. package/src/templates/skills/agentkit-build-agent/templates/support-agent.instructions.md +16 -0
  96. package/src/templates/skills/agentkit-capsule/SKILL.md +70 -0
  97. package/src/templates/skills/agentkit-capsule/references/docs-router.md +15 -0
  98. package/src/templates/skills/agentkit-channels/SKILL.md +104 -0
  99. package/src/templates/skills/agentkit-channels/references/channel-buffering.md +65 -0
  100. package/src/templates/skills/agentkit-channels/references/channel-debugging.md +66 -0
  101. package/src/templates/skills/agentkit-channels/references/discord.md +93 -0
  102. package/src/templates/skills/agentkit-channels/references/slack.md +56 -0
  103. package/src/templates/skills/agentkit-channels/references/telegram.md +72 -0
  104. package/src/templates/skills/agentkit-channels/references/whatsapp-zapster.md +77 -0
  105. package/src/templates/skills/agentkit-database/SKILL.md +45 -0
  106. package/src/templates/skills/agentkit-database/templates/appointments.schema.sql +15 -0
  107. package/src/templates/skills/agentkit-database/templates/leads.schema.sql +17 -0
  108. package/src/templates/skills/agentkit-deploy/SKILL.md +50 -0
  109. package/src/templates/skills/agentkit-evals/SKILL.md +109 -0
  110. package/src/templates/skills/agentkit-evals/templates/multi-turn.eval.md +29 -0
  111. package/src/templates/skills/agentkit-evals/templates/no-leak.eval.md +18 -0
  112. package/src/templates/skills/agentkit-evals/templates/smoke.eval.md +18 -0
  113. package/src/templates/skills/agentkit-evals/templates/tool-call.eval.md +27 -0
  114. package/src/templates/skills/agentkit-improve/SKILL.md +86 -0
  115. package/src/templates/skills/agentkit-improve/references/replay-side-effects.md +18 -0
  116. package/src/templates/skills/agentkit-improve/references/trace-packets.md +22 -0
  117. package/src/templates/skills/agentkit-improve/templates/regression.eval.md +18 -0
  118. package/src/templates/skills/agentkit-integrations/SKILL.md +76 -0
  119. package/src/templates/skills/agentkit-knowledge/SKILL.md +43 -0
  120. package/src/templates/skills/agentkit-knowledge/templates/faq.md +14 -0
  121. package/src/templates/skills/agentkit-knowledge/templates/policies.md +14 -0
  122. package/src/templates/skills/agentkit-knowledge/templates/prices.csv +3 -0
  123. package/src/templates/skills/agentkit-prompts/SKILL.md +47 -0
  124. package/src/templates/skills/agentkit-prompts/templates/knowledge-grounded-faq.instructions.md +11 -0
  125. package/src/templates/skills/agentkit-provider/SKILL.md +60 -0
  126. package/src/templates/skills/agentkit-security/SKILL.md +56 -0
  127. package/src/templates/skills/agentkit-tools/SKILL.md +37 -0
  128. package/src/templates/skills/agentkit-tools/examples/database-write.tool.md +35 -0
  129. package/src/templates/skills/agentkit-tools/examples/eval-safe-external-action.tool.md +37 -0
  130. package/src/templates/skills/agentkit-tools/examples/lookup-order.tool.md +46 -0
  131. package/src/templates/skills/agentkit-troubleshooting/SKILL.md +76 -0
  132. package/src/templates/support.ts +77 -18
  133. package/docs/guides/channels-production-handoff.md +0 -99
  134. package/docs/portable-deploy-release-checklist.md +0 -41
  135. package/src/runtime/targets/cloudflare/deploy.ts +0 -5475
@@ -2,6 +2,14 @@ import { relative, resolve } from "node:path";
2
2
 
3
3
  import type { AgentConfig, AgentTool } from "../../index";
4
4
  import type { LoadedAgentCapsule } from "../config";
5
+ import {
6
+ createManagedComposioTools,
7
+ managedComposioRequiredSecrets,
8
+ resolveManagedComposioIntegrations,
9
+ } from "../integrations/composio";
10
+ import { resolveKnowledgeConfig } from "../knowledge/config";
11
+ import { KNOWLEDGE_SEARCH_TOOL_NAME } from "../knowledge/tool";
12
+ import { resolveTranscriptionConfig } from "../transcription";
5
13
 
6
14
  export type ManifestSchema = {
7
15
  source: string;
@@ -13,6 +21,7 @@ export type SharedAgentManifest = {
13
21
  name: string;
14
22
  runtime: AgentConfig["runtime"];
15
23
  provider: AgentConfig["provider"];
24
+ timeZone: string | null;
16
25
  prompt: string;
17
26
  secrets: string[];
18
27
  tools: Array<{
@@ -24,7 +33,48 @@ export type SharedAgentManifest = {
24
33
  permissions: string[];
25
34
  timeoutMs: number | null;
26
35
  }>;
36
+ integrations: Array<{
37
+ name: string;
38
+ provider: "composio";
39
+ mode: "managed";
40
+ toolkits: string[];
41
+ tools: string[];
42
+ userId: string;
43
+ confirmExternalWrites: boolean;
44
+ }>;
27
45
  channels: NonNullable<AgentConfig["channels"]>;
46
+ transcription: {
47
+ enabled: boolean;
48
+ provider: string | null;
49
+ model: string | null;
50
+ secret: string | null;
51
+ language: string | null;
52
+ prompt: string | null;
53
+ limits: {
54
+ maxDurationSeconds: number | null;
55
+ maxBytes: number | null;
56
+ };
57
+ rawAudioTtlSeconds: number | null;
58
+ };
59
+ knowledge: {
60
+ enabled: boolean;
61
+ sources: Array<{
62
+ kind: "file" | "url";
63
+ value: string;
64
+ title: string | null;
65
+ }>;
66
+ embedding: {
67
+ provider: string;
68
+ model: string | null;
69
+ dimensions: number | null;
70
+ secret: string | null;
71
+ };
72
+ retrieval: {
73
+ topK: number;
74
+ hybrid: boolean;
75
+ };
76
+ internalTool: string | null;
77
+ };
28
78
  access: AgentConfig["access"];
29
79
  storage: {
30
80
  driver: AgentConfig["storage"]["driver"];
@@ -57,10 +107,12 @@ export function buildSharedAgentManifest(
57
107
  const requiredSecrets = new Set(capsule.config.secrets);
58
108
  const database = buildDatabaseManifest(capsule, options.databaseSchema ?? null);
59
109
  const files = buildFilesManifest(capsule);
110
+ const knowledge = resolveKnowledgeConfig(capsule.config);
111
+ const integrationTools = createManagedComposioTools(capsule.config);
112
+ const tools = [...integrationTools, ...(capsule.config.tools ?? [])];
113
+ const transcription = resolveTranscriptionConfig(capsule.config.transcription);
60
114
 
61
- if (capsule.config.access.mode === "private") {
62
- requiredSecrets.add("AGENTKIT_PRIVATE_TOKEN");
63
- }
115
+ requiredSecrets.add("AGENTKIT_PRIVATE_TOKEN");
64
116
 
65
117
  if (capsule.config.access.mode === "token") {
66
118
  requiredSecrets.add("AGENTKIT_ACCESS_TOKEN");
@@ -75,7 +127,19 @@ export function buildSharedAgentManifest(
75
127
  requiredSecrets.add("TURSO_AUTH_TOKEN");
76
128
  }
77
129
 
78
- for (const tool of capsule.config.tools ?? []) {
130
+ if (knowledge.embedding.secret) {
131
+ requiredSecrets.add(knowledge.embedding.secret);
132
+ }
133
+
134
+ if (transcription.secret) {
135
+ requiredSecrets.add(transcription.secret);
136
+ }
137
+
138
+ for (const secret of managedComposioRequiredSecrets(capsule.config)) {
139
+ requiredSecrets.add(secret);
140
+ }
141
+
142
+ for (const tool of tools) {
79
143
  for (const secret of tool.secrets ?? []) {
80
144
  requiredSecrets.add(secret);
81
145
  }
@@ -92,9 +156,10 @@ export function buildSharedAgentManifest(
92
156
  name: capsule.config.name,
93
157
  runtime: capsule.config.runtime,
94
158
  provider: capsule.config.provider,
159
+ timeZone: capsule.config.timeZone ?? null,
95
160
  prompt: toCapsulePath(capsule, capsule.instructionsPath),
96
161
  secrets: Array.from(requiredSecrets).sort(),
97
- tools: (capsule.config.tools ?? []).map((tool) => ({
162
+ tools: tools.map((tool) => ({
98
163
  name: tool.name,
99
164
  description: tool.description,
100
165
  inputSchema: tool.inputSchema,
@@ -103,7 +168,40 @@ export function buildSharedAgentManifest(
103
168
  permissions: [...(tool.permissions ?? [])].sort(),
104
169
  timeoutMs: tool.timeoutMs ?? null,
105
170
  })),
171
+ integrations: resolveManagedComposioIntegrations(capsule.config).map((integration) => ({
172
+ name: integration.name,
173
+ provider: integration.provider,
174
+ mode: integration.mode,
175
+ toolkits: integration.toolkits,
176
+ tools: integration.allowedTools,
177
+ userId: integration.userId,
178
+ confirmExternalWrites: integration.confirmExternalWrites !== false,
179
+ })),
106
180
  channels: capsule.config.channels ?? [],
181
+ transcription: {
182
+ enabled: transcription.enabled,
183
+ provider: transcription.enabled ? transcription.provider : null,
184
+ model: transcription.enabled ? transcription.model : null,
185
+ secret: transcription.secret,
186
+ language: transcription.language,
187
+ prompt: transcription.prompt,
188
+ limits: {
189
+ maxDurationSeconds: transcription.limits.maxDurationSeconds ?? null,
190
+ maxBytes: transcription.limits.maxBytes ?? null,
191
+ },
192
+ rawAudioTtlSeconds: transcription.rawAudioTtlSeconds,
193
+ },
194
+ knowledge: {
195
+ enabled: knowledge.enabled,
196
+ sources: knowledge.sources.map((source) => ({
197
+ kind: source.kind,
198
+ value: source.value,
199
+ title: source.title,
200
+ })),
201
+ embedding: knowledge.embedding,
202
+ retrieval: knowledge.retrieval,
203
+ internalTool: knowledge.enabled ? KNOWLEDGE_SEARCH_TOOL_NAME : null,
204
+ },
107
205
  access: capsule.config.access,
108
206
  storage: {
109
207
  driver: capsule.config.storage.driver,
@@ -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";
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"],
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"],
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"],
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"],
78
78
  providers: ["server-env"],
79
79
  },
80
80
  },
@@ -1,5 +1,6 @@
1
- import { readFile } from "node:fs/promises";
2
- import { relative, resolve } from "node:path";
1
+ import { readdir, readFile } from "node:fs/promises";
2
+ import type { Dirent } from "node:fs";
3
+ import { basename, relative, resolve } from "node:path";
3
4
 
4
5
  import type { DatabaseArgs, DatabaseResult, DatabaseRunner, DatabaseStatement } from "../index";
5
6
  import { openCapsuleStore, type SqliteAgentKitStore } from "../storage/sqlite";
@@ -9,6 +10,12 @@ import { AgentKitError } from "./errors";
9
10
  export type LocalDatabasePrepareResult = {
10
11
  store: SqliteAgentKitStore;
11
12
  databasePath: string;
13
+ migrations: {
14
+ configured: boolean;
15
+ path: string | null;
16
+ applied: string[];
17
+ skipped: string[];
18
+ };
12
19
  schema: {
13
20
  configured: boolean;
14
21
  applied: boolean;
@@ -20,10 +27,12 @@ export async function openPreparedCapsuleStore(capsule: LoadedAgentCapsule): Pro
20
27
  const store = await openCapsuleStore(capsule);
21
28
 
22
29
  try {
30
+ const migrations = await applyCapsuleDatabaseMigrations(capsule, store);
23
31
  const schema = await applyCapsuleDatabaseSchema(capsule, store);
24
32
  return {
25
33
  store,
26
34
  databasePath: store.dbPath,
35
+ migrations,
27
36
  schema,
28
37
  };
29
38
  } catch (error) {
@@ -32,6 +41,84 @@ export async function openPreparedCapsuleStore(capsule: LoadedAgentCapsule): Pro
32
41
  }
33
42
  }
34
43
 
44
+ export async function applyCapsuleDatabaseMigrations(
45
+ capsule: LoadedAgentCapsule,
46
+ store: SqliteAgentKitStore,
47
+ ): Promise<LocalDatabasePrepareResult["migrations"]> {
48
+ const database = capsule.config.storage.database;
49
+
50
+ if (!database || database.driver !== "turso") {
51
+ return {
52
+ configured: false,
53
+ path: null,
54
+ applied: [],
55
+ skipped: [],
56
+ };
57
+ }
58
+
59
+ const migrationsPath = resolve(capsule.root, database.migrations ?? "migrations");
60
+ const migrations = await readMigrationFiles(migrationsPath);
61
+
62
+ if (migrations.length === 0) {
63
+ return {
64
+ configured: false,
65
+ path: migrationsPath,
66
+ applied: [],
67
+ skipped: [],
68
+ };
69
+ }
70
+
71
+ try {
72
+ const result = store.applyApplicationMigrations(migrations);
73
+ return {
74
+ configured: true,
75
+ path: migrationsPath,
76
+ applied: result.applied,
77
+ skipped: result.skipped,
78
+ };
79
+ } catch (error) {
80
+ if (error instanceof AgentKitError && error.code === "database_schema_error") {
81
+ throw new AgentKitError(
82
+ "database_schema_error",
83
+ [
84
+ `Could not apply database migrations from ${relative(capsule.root, migrationsPath)}.`,
85
+ "Migrations must be ordered .sql files and should use safe, forward-only changes.",
86
+ error.message,
87
+ ].join(" "),
88
+ { cause: error },
89
+ );
90
+ }
91
+
92
+ throw error;
93
+ }
94
+ }
95
+
96
+ async function readMigrationFiles(directory: string): Promise<Array<{ id: string; sql: string }>> {
97
+ let entries: Dirent[];
98
+
99
+ try {
100
+ entries = await readdir(directory, { withFileTypes: true });
101
+ } catch (error) {
102
+ if (isNodeError(error) && error.code === "ENOENT") {
103
+ return [];
104
+ }
105
+
106
+ throw error;
107
+ }
108
+
109
+ const files = entries
110
+ .filter((entry) => entry.isFile() && entry.name.endsWith(".sql"))
111
+ .map((entry) => entry.name)
112
+ .sort();
113
+
114
+ return Promise.all(
115
+ files.map(async (file) => ({
116
+ id: basename(file, ".sql"),
117
+ sql: await readFile(resolve(directory, file), "utf8"),
118
+ })),
119
+ );
120
+ }
121
+
35
122
  export async function applyCapsuleDatabaseSchema(
36
123
  capsule: LoadedAgentCapsule,
37
124
  store: SqliteAgentKitStore,
@@ -163,3 +250,7 @@ function validateStatements(statements: DatabaseStatement[]): void {
163
250
  validateSql(statement.sql, statement.args ?? []);
164
251
  }
165
252
  }
253
+
254
+ function isNodeError(error: unknown): error is NodeJS.ErrnoException {
255
+ return typeof error === "object" && error !== null && "code" in error;
256
+ }
@@ -10,6 +10,9 @@ import { AgentKitError } from "./errors";
10
10
  export type DbMigrateResult = {
11
11
  root: string;
12
12
  databasePath: string;
13
+ migrationsPath: string | null;
14
+ migrationsApplied: string[];
15
+ migrationsSkipped: string[];
13
16
  schemaPath: string | null;
14
17
  schemaApplied: boolean;
15
18
  };
@@ -43,6 +46,9 @@ export async function migrateLocalDatabase(cwd = process.cwd()): Promise<DbMigra
43
46
  return {
44
47
  root: capsule.root,
45
48
  databasePath: prepared.databasePath,
49
+ migrationsPath: prepared.migrations.path,
50
+ migrationsApplied: prepared.migrations.applied,
51
+ migrationsSkipped: prepared.migrations.skipped,
46
52
  schemaPath: prepared.schema.path,
47
53
  schemaApplied: prepared.schema.applied,
48
54
  };
@@ -87,6 +93,9 @@ export async function seedLocalDatabase(cwd = process.cwd(), seedFile = "seed.sq
87
93
  return {
88
94
  root: capsule.root,
89
95
  databasePath: prepared.databasePath,
96
+ migrationsPath: prepared.migrations.path,
97
+ migrationsApplied: prepared.migrations.applied,
98
+ migrationsSkipped: prepared.migrations.skipped,
90
99
  schemaPath: prepared.schema.path,
91
100
  schemaApplied: prepared.schema.applied,
92
101
  seedPath,
@@ -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;
@@ -24,6 +28,20 @@ export type DeployReadinessContext = {
24
28
  userManagedSecrets: string[];
25
29
  agentKitManagedSecrets: string[];
26
30
  localSecrets: Record<string, DeployReadinessSecretSource>;
31
+ knowledge: {
32
+ enabled: boolean;
33
+ sourceCount: number;
34
+ embeddingProvider: string;
35
+ databaseDriver: "none" | "turso";
36
+ };
37
+ integrations: {
38
+ managedComposio: {
39
+ enabled: boolean;
40
+ toolkits: string[];
41
+ toolCount: number;
42
+ userId: string | null;
43
+ };
44
+ };
27
45
  };
28
46
 
29
47
  export async function loadDeployReadinessContext(
@@ -32,6 +50,7 @@ export async function loadDeployReadinessContext(
32
50
  ): Promise<DeployReadinessContext> {
33
51
  const capsule = await loadAgentCapsule(cwd);
34
52
  const manifest = buildSharedAgentManifest(capsule);
53
+ const managedComposio = resolveManagedComposioIntegrations(capsule.config)[0];
35
54
  const dotenvNames = new Set(await listCapsuleEnv(capsule.root));
36
55
  const requiredSecrets = manifest.secrets;
37
56
  const localSecrets: Record<string, DeployReadinessSecretSource> = {};
@@ -51,6 +70,7 @@ export async function loadDeployReadinessContext(
51
70
  isAgentKitManagedDeploySecret(name, {
52
71
  accessMode: capsule.config.access.mode,
53
72
  databaseDriver: manifest.storage.database.driver,
73
+ managedComposioEnabled: Boolean(managedComposio),
54
74
  }),
55
75
  );
56
76
  const managed = new Set(agentKitManagedSecrets);
@@ -70,22 +90,44 @@ export async function loadDeployReadinessContext(
70
90
  userManagedSecrets: requiredSecrets.filter((name) => !managed.has(name)),
71
91
  agentKitManagedSecrets,
72
92
  localSecrets,
93
+ knowledge: {
94
+ enabled: manifest.knowledge.enabled,
95
+ sourceCount: manifest.knowledge.sources.length,
96
+ embeddingProvider: manifest.knowledge.embedding.provider,
97
+ databaseDriver: manifest.storage.database.driver,
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
+ },
73
107
  };
74
108
  }
75
109
 
76
- export function stableCloudProjectId(name: string): string {
77
- 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)}`;
78
112
  }
79
113
 
80
114
  function isAgentKitManagedDeploySecret(
81
115
  name: string,
82
- context: { accessMode: DeployReadinessContext["accessMode"]; databaseDriver: "none" | "turso" },
116
+ context: {
117
+ accessMode: DeployReadinessContext["accessMode"];
118
+ databaseDriver: "none" | "turso";
119
+ managedComposioEnabled: boolean;
120
+ },
83
121
  ): boolean {
84
122
  if (context.databaseDriver === "turso" && (name === "TURSO_DATABASE_URL" || name === "TURSO_AUTH_TOKEN")) {
85
123
  return true;
86
124
  }
87
125
 
88
- if (context.accessMode === "private" && name === "AGENTKIT_PRIVATE_TOKEN") {
126
+ if (name === "AGENTKIT_PRIVATE_TOKEN") {
127
+ return true;
128
+ }
129
+
130
+ if (context.managedComposioEnabled && name === MANAGED_COMPOSIO_API_KEY_SECRET) {
89
131
  return true;
90
132
  }
91
133
 
@@ -1 +1 @@
1
- export * from "./targets/cloudflare/deploy";
1
+ export * from "../cloud";