@andreprado/agentkit 0.1.0-alpha.2 → 0.1.0-alpha.21
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 +68 -6
- package/docs/guides/add-channel.md +189 -7
- package/docs/guides/add-knowledge.md +144 -0
- package/docs/guides/add-managed-composio.md +163 -0
- package/docs/guides/add-tool.md +1 -1
- package/docs/guides/channel-security.md +128 -32
- package/docs/guides/connect-discord.md +178 -0
- package/docs/guides/connect-slack.md +126 -0
- package/docs/guides/connect-telegram.md +78 -1
- package/docs/guides/connect-whatsapp-evolution.md +121 -0
- package/docs/guides/connect-whatsapp-uazapi.md +126 -0
- package/docs/guides/connect-whatsapp-zapster.md +112 -8
- package/docs/guides/create-agent.md +45 -4
- package/docs/guides/debug-channel.md +147 -0
- package/docs/guides/improve-from-production.md +151 -0
- package/docs/guides/prepare-deploy.md +47 -17
- package/docs/guides/replay-production-traces.md +72 -0
- package/docs/guides/run-evals.md +147 -20
- package/docs/guides/security-rules.md +7 -6
- package/docs/guides/send-feedback.md +135 -0
- package/docs/guides/use-provider.md +27 -3
- package/docs/llms-full.txt +348 -55
- package/docs/llms.txt +62 -7
- package/package.json +2 -5
- package/src/cli/args.ts +57 -0
- package/src/cli/cloud-client.ts +377 -0
- package/src/cli/commands/channels.ts +1586 -0
- package/src/cli/commands/feedback.ts +438 -0
- package/src/cli/commands/knowledge.ts +136 -0
- package/src/cli/commands/transcribe.ts +171 -0
- package/src/cli/constants.ts +4 -0
- package/src/cli/deploy-chat-ui.ts +535 -0
- package/src/cli/deploy-readiness.ts +481 -0
- package/src/cli/flags.ts +162 -0
- package/src/cli/help.ts +236 -0
- package/src/cli/index.ts +1167 -1005
- package/src/cli/process.ts +31 -0
- package/src/cloud/artifact.ts +139 -0
- package/src/cloud/client.ts +80 -0
- package/src/cloud/contracts.ts +63 -0
- package/src/cloud/index.ts +3 -0
- package/src/create-project.ts +21 -6
- package/src/index.ts +517 -8
- package/src/providers/pi.ts +70 -16
- package/src/providers/test.ts +88 -1
- package/src/providers/types.ts +7 -0
- package/src/runtime/channel-buffer.ts +30 -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 +225 -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 +1327 -0
- package/src/runtime/channels/whatsapp-zapster.ts +677 -40
- package/src/runtime/channels.ts +87 -4
- package/src/runtime/chat.ts +130 -38
- package/src/runtime/config.ts +519 -19
- package/src/runtime/core/manifest.ts +103 -5
- package/src/runtime/core/targets.ts +5 -5
- package/src/runtime/database.ts +93 -2
- package/src/runtime/db-commands.ts +9 -0
- package/src/runtime/deploy-readiness.ts +46 -4
- package/src/runtime/deploy.ts +1 -1
- package/src/runtime/dev-server.ts +779 -45
- package/src/runtime/env.ts +8 -3
- package/src/runtime/evals.ts +589 -43
- package/src/runtime/improve.ts +868 -0
- package/src/runtime/inspect.ts +194 -4
- package/src/runtime/integrations/composio.ts +423 -0
- package/src/runtime/knowledge/chunk.ts +333 -0
- package/src/runtime/knowledge/config.ts +135 -0
- package/src/runtime/knowledge/embeddings.ts +133 -0
- package/src/runtime/knowledge/ingest.ts +521 -0
- package/src/runtime/knowledge/prompt-policy.ts +30 -0
- package/src/runtime/knowledge/retrieve.ts +303 -0
- package/src/runtime/knowledge/schema.ts +100 -0
- package/src/runtime/knowledge/tool.ts +64 -0
- package/src/runtime/knowledge/vector.ts +258 -0
- package/src/runtime/prompt-context.ts +141 -0
- package/src/runtime/runtime-contract.ts +86 -8
- package/src/runtime/skills.ts +95 -0
- package/src/runtime/spec.ts +152 -0
- package/src/runtime/sync.ts +144 -0
- package/src/runtime/targets/cloudflare/build.ts +1468 -203
- 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 +128 -2
- package/src/runtime/traces.ts +41 -0
- package/src/runtime/transcription.ts +483 -0
- package/src/storage/sqlite.ts +149 -3
- package/src/templates/blank.ts +76 -17
- package/src/templates/dentista.ts +1011 -0
- package/src/templates/index.ts +2 -0
- package/src/templates/skills/agentkit-build-agent/SKILL.md +52 -0
- package/src/templates/skills/agentkit-build-agent/templates/appointment-intake.instructions.md +21 -0
- package/src/templates/skills/agentkit-build-agent/templates/sales-qualifier.instructions.md +17 -0
- package/src/templates/skills/agentkit-build-agent/templates/support-agent.instructions.md +16 -0
- package/src/templates/skills/agentkit-capsule/SKILL.md +70 -0
- package/src/templates/skills/agentkit-capsule/references/docs-router.md +15 -0
- package/src/templates/skills/agentkit-channels/SKILL.md +127 -0
- package/src/templates/skills/agentkit-channels/references/channel-buffering.md +65 -0
- package/src/templates/skills/agentkit-channels/references/channel-debugging.md +66 -0
- 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 +72 -0
- package/src/templates/skills/agentkit-channels/references/whatsapp-evolution.md +57 -0
- package/src/templates/skills/agentkit-channels/references/whatsapp-uazapi.md +61 -0
- package/src/templates/skills/agentkit-channels/references/whatsapp-zapster.md +77 -0
- package/src/templates/skills/agentkit-database/SKILL.md +45 -0
- package/src/templates/skills/agentkit-database/templates/appointments.schema.sql +15 -0
- package/src/templates/skills/agentkit-database/templates/leads.schema.sql +17 -0
- package/src/templates/skills/agentkit-deploy/SKILL.md +50 -0
- package/src/templates/skills/agentkit-evals/SKILL.md +109 -0
- package/src/templates/skills/agentkit-evals/templates/multi-turn.eval.md +29 -0
- package/src/templates/skills/agentkit-evals/templates/no-leak.eval.md +18 -0
- package/src/templates/skills/agentkit-evals/templates/smoke.eval.md +18 -0
- package/src/templates/skills/agentkit-evals/templates/tool-call.eval.md +27 -0
- package/src/templates/skills/agentkit-improve/SKILL.md +86 -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 +76 -0
- package/src/templates/skills/agentkit-knowledge/SKILL.md +43 -0
- package/src/templates/skills/agentkit-knowledge/templates/faq.md +14 -0
- package/src/templates/skills/agentkit-knowledge/templates/policies.md +14 -0
- package/src/templates/skills/agentkit-knowledge/templates/prices.csv +3 -0
- package/src/templates/skills/agentkit-prompts/SKILL.md +47 -0
- package/src/templates/skills/agentkit-prompts/templates/knowledge-grounded-faq.instructions.md +11 -0
- package/src/templates/skills/agentkit-provider/SKILL.md +60 -0
- package/src/templates/skills/agentkit-security/SKILL.md +56 -0
- package/src/templates/skills/agentkit-tools/SKILL.md +37 -0
- package/src/templates/skills/agentkit-tools/examples/database-write.tool.md +35 -0
- package/src/templates/skills/agentkit-tools/examples/eval-safe-external-action.tool.md +37 -0
- package/src/templates/skills/agentkit-tools/examples/lookup-order.tool.md +46 -0
- package/src/templates/skills/agentkit-troubleshooting/SKILL.md +76 -0
- package/src/templates/support.ts +77 -18
- package/docs/guides/channels-production-handoff.md +0 -99
- package/docs/portable-deploy-release-checklist.md +0 -41
- package/src/runtime/targets/cloudflare/deploy.ts +0 -5475
package/src/templates/support.ts
CHANGED
|
@@ -63,6 +63,7 @@ node_modules/
|
|
|
63
63
|
contents: `# Optional: add real provider keys after switching away from test/fake.
|
|
64
64
|
OPENAI_API_KEY=
|
|
65
65
|
ANTHROPIC_API_KEY=
|
|
66
|
+
OPENROUTER_API_KEY=
|
|
66
67
|
`,
|
|
67
68
|
},
|
|
68
69
|
{
|
|
@@ -110,7 +111,9 @@ export default defineAgent({
|
|
|
110
111
|
},
|
|
111
112
|
{
|
|
112
113
|
path: "tools/lookup-order.ts",
|
|
113
|
-
contents: `
|
|
114
|
+
contents: `import type { AgentTool } from "@andreprado/agentkit";
|
|
115
|
+
|
|
116
|
+
const orders: Record<string, { status: string; eta: string }> = {
|
|
114
117
|
A100: { status: "preparing", eta: "today" },
|
|
115
118
|
B200: { status: "shipped", eta: "tomorrow" },
|
|
116
119
|
};
|
|
@@ -156,7 +159,7 @@ export const lookupOrder = {
|
|
|
156
159
|
eta: order.eta,
|
|
157
160
|
};
|
|
158
161
|
},
|
|
159
|
-
};
|
|
162
|
+
} satisfies AgentTool;
|
|
160
163
|
`,
|
|
161
164
|
},
|
|
162
165
|
{
|
|
@@ -168,13 +171,18 @@ Help users with clear answers. When order status is needed, use the lookup_order
|
|
|
168
171
|
},
|
|
169
172
|
{
|
|
170
173
|
path: "evals/smoke.eval.ts",
|
|
171
|
-
contents: `
|
|
174
|
+
contents: `import { defineEval } from "@andreprado/agentkit";
|
|
175
|
+
|
|
176
|
+
export default defineEval({
|
|
172
177
|
name: "smoke",
|
|
173
178
|
input: "Say hello as a support agent.",
|
|
174
179
|
expect: {
|
|
175
|
-
|
|
180
|
+
response: {
|
|
181
|
+
caseInsensitiveContains: "hello",
|
|
182
|
+
maxLength: 200,
|
|
183
|
+
},
|
|
176
184
|
},
|
|
177
|
-
};
|
|
185
|
+
});
|
|
178
186
|
`,
|
|
179
187
|
},
|
|
180
188
|
{
|
|
@@ -189,33 +197,48 @@ When the owner opens this folder in Codex, Claude Code, or another coding agent
|
|
|
189
197
|
|
|
190
198
|
Start building immediately:
|
|
191
199
|
|
|
192
|
-
-
|
|
200
|
+
- Start with \`skills/agentkit-capsule/SKILL.md\`, then use \`npm run agentkit -- docs llms\` as the docs router.
|
|
201
|
+
- Create or update \`AGENT_SPEC.md\` from the owner's request with \`npm run agentkit -- spec init --brief "<owner request>"\`; the owner should not fill this file by hand before work starts.
|
|
193
202
|
- Infer the first useful version from the owner's request.
|
|
194
203
|
- Edit \`prompts/instructions.md\` for support behavior.
|
|
195
204
|
- Edit \`agentkit.config.ts\` for provider, tools, secrets, access, and storage.
|
|
196
205
|
- Add or replace TypeScript tools under \`tools/\` when the requested support agent needs actions or external data.
|
|
206
|
+
- Add \`sync.ts\`, \`seed.sql\`, and ordered \`migrations/*.sql\` when the support agent depends on external catalogs or production-shaped data changes.
|
|
207
|
+
- Do not wait for a wizard or recipe. AgentKit provides the scaffold and contract; you decide the implementation from the owner's brief.
|
|
197
208
|
- Ask follow-up questions only when missing information blocks a safe local implementation.
|
|
198
209
|
- State assumptions in the final response.
|
|
199
210
|
|
|
200
211
|
## Local Commands
|
|
201
212
|
|
|
202
|
-
- \`npm install\`:
|
|
213
|
+
- \`npm install\`: restore capsule dependencies if this capsule used \`--no-install\`, install failed, or \`node_modules\` was deleted.
|
|
203
214
|
- \`npm run chat -- --message "hello"\`: send one local chat message.
|
|
204
215
|
- \`npm run agentkit -- tool lookup_order --input '{"orderId":"A100"}'\`: test the example tool directly.
|
|
205
216
|
- \`npm run eval\`: run agent evals.
|
|
217
|
+
- \`npm run agentkit -- spec check\`: verify the local agent implementation contract exists.
|
|
218
|
+
- \`npm run agentkit -- eval from-conversation <conversation-id>\`: turn a real conversation into a regression eval.
|
|
219
|
+
- \`npm run agentkit -- conversations trace <conversation-id>\`: inspect messages, runs, tool calls, inputs, outputs, rendered output, and final responses.
|
|
206
220
|
- \`npm run dev\`: run the local Agent Capsule runtime.
|
|
207
221
|
- \`npm run agentkit -- inspect\`: print machine-readable capsule state.
|
|
208
|
-
- \`npm run agentkit -- env set <NAME>
|
|
222
|
+
- \`printf %s "$VALUE" | npm run agentkit -- env set <NAME> --stdin\`: write a local secret value to ignored \`.env\` without putting it in shell history.
|
|
209
223
|
- \`npm run agentkit -- env list\`: list local secret names without printing values.
|
|
210
|
-
- \`npm run agentkit -- docs
|
|
224
|
+
- \`npm run agentkit -- docs llms\`: print the lightweight AgentKit docs router.
|
|
225
|
+
- \`npm run agentkit -- docs full\`: print the full AgentKit contract path only when a skill asks for it.
|
|
226
|
+
|
|
227
|
+
## Testing With A UI
|
|
228
|
+
|
|
229
|
+
- Local UI: run \`npm run dev\`, open the printed \`Chat:\` URL, and tell the owner the exact URL.
|
|
230
|
+
- Hosted UI: after \`npm run agentkit -- deploy\`, run \`npm run agentkit -- chat-ui --deploy\`, open the printed \`Chat:\` URL, and tell the owner it is connected to the hosted deploy.
|
|
231
|
+
- \`test/fake\` is deterministic. It is useful for scaffold checks, direct tool checks, and fake-provider evals, but it does not validate natural conversation quality.
|
|
232
|
+
- Before claiming real conversation behavior is tested, ask the owner which provider to use: OpenRouter, OpenAI, Anthropic, or another supported provider. Do not choose for them.
|
|
211
233
|
|
|
212
234
|
## Hosted Deploy
|
|
213
235
|
|
|
214
236
|
- Local scaffold, chat, eval, dev, inspect, tool, and build commands are token-free.
|
|
215
237
|
- Hosted deploy requires an invited AgentKit Cloud alpha token. If no token is stored yet, ask the owner for one and run \`npm run agentkit -- login --token <token>\`.
|
|
216
|
-
- Put production secret values into managed secrets with \`npm run agentkit -- secret set <NAME>
|
|
238
|
+
- Put production secret values into managed secrets with \`npm run agentkit -- secret set <NAME> --from-local-env\`, \`--from-env\`, or \`--stdin\`, not into committed files or shell history.
|
|
217
239
|
- Deploy with \`npm run agentkit -- deploy\`, then check \`npm run agentkit -- deploy status\`.
|
|
218
|
-
- Create client-facing
|
|
240
|
+
- Hosted deploy writes the local chat/UI deploy access token to \`.agentkit/chat-access-token.json\`. Create extra client-facing tokens with \`npm run agentkit -- access token create <name> --out <path>\` when a separate website or app needs its own credential.
|
|
241
|
+
- Use \`npm run agentkit -- deploy --smoke "hello"\` or \`npm run agentkit -- deploy smoke --message "hello"\` for an official hosted chat smoke check.
|
|
219
242
|
- Do not run operator/admin commands from a user capsule.
|
|
220
243
|
|
|
221
244
|
## Files
|
|
@@ -248,42 +271,71 @@ Example owner request:
|
|
|
248
271
|
Turn the request into a working local capsule:
|
|
249
272
|
|
|
250
273
|
- Update \`prompts/instructions.md\` with domain-specific behavior, boundaries, intake questions, and escalation rules.
|
|
274
|
+
- Create or update \`AGENT_SPEC.md\` with \`npm run agentkit -- spec init --brief "<owner request>"\`. The owner gives the general idea; the coding agent turns it into the structured contract.
|
|
251
275
|
- Update \`agentkit.config.ts\` when tools, secrets, provider, or access rules change.
|
|
252
276
|
- Add, replace, or remove TypeScript tools under \`tools/\` for real actions or external data.
|
|
277
|
+
- Use \`npm run agentkit -- sync init\` when the agent needs catalog sync, fixture seed data, or ordered migrations.
|
|
253
278
|
- Keep the first version runnable with \`test/fake\` unless the owner explicitly asks for a real provider.
|
|
279
|
+
- Do not use a wizard or recipe. Build the capsule directly from the scaffold, the AgentKit contract, and the owner's brief.
|
|
254
280
|
- Make practical assumptions and list them in your final response.
|
|
255
281
|
- Ask follow-up questions only when missing information blocks a safe local implementation.
|
|
256
282
|
|
|
257
283
|
## Local Commands
|
|
258
284
|
|
|
259
285
|
\`\`\`sh
|
|
260
|
-
npm install
|
|
261
286
|
npm run typecheck
|
|
262
287
|
npm run agentkit -- inspect
|
|
263
288
|
npm run agentkit -- tool lookup_order --input '{"orderId":"A100"}'
|
|
264
289
|
npm run eval
|
|
265
290
|
\`\`\`
|
|
266
291
|
|
|
292
|
+
\`test/fake\` proves the scaffold and deterministic tool paths. It does not prove natural conversation quality.
|
|
293
|
+
|
|
294
|
+
\`agentkit new\` installs dependencies by default. Run \`npm install\` only if the capsule was created with \`--no-install\`, install failed, or \`node_modules\` was deleted.
|
|
295
|
+
|
|
267
296
|
Set local development secrets without opening code:
|
|
268
297
|
|
|
269
298
|
\`\`\`sh
|
|
270
|
-
npm run agentkit -- env set OPENAI_API_KEY
|
|
299
|
+
printf %s "$OPENAI_API_KEY" | npm run agentkit -- env set OPENAI_API_KEY --stdin
|
|
271
300
|
npm run agentkit -- inspect
|
|
272
301
|
npm run chat -- --message "hello"
|
|
273
302
|
\`\`\`
|
|
274
303
|
|
|
304
|
+
## Testing With A UI
|
|
305
|
+
|
|
306
|
+
Local UI:
|
|
307
|
+
|
|
308
|
+
\`\`\`sh
|
|
309
|
+
npm run dev
|
|
310
|
+
\`\`\`
|
|
311
|
+
|
|
312
|
+
Open the printed \`Chat:\` URL and tell the owner the exact URL.
|
|
313
|
+
|
|
314
|
+
Hosted deploy UI:
|
|
315
|
+
|
|
316
|
+
\`\`\`sh
|
|
317
|
+
npm run agentkit -- deploy
|
|
318
|
+
npm run agentkit -- chat-ui --deploy
|
|
319
|
+
\`\`\`
|
|
320
|
+
|
|
321
|
+
Open the printed \`Chat:\` URL and tell the owner this local UI is connected to the hosted deploy.
|
|
322
|
+
|
|
323
|
+
Before claiming real conversation behavior has been tested, ask the owner which provider to use: OpenRouter, OpenAI, Anthropic, or another supported provider. Do not choose for them. After they choose, update \`agentkit.config.ts\`, \`.env.schema\`, local secrets, hosted secrets if deploying, then rerun chat/UI checks.
|
|
324
|
+
|
|
275
325
|
If you add a tool, also run a fake-provider tool smoke test:
|
|
276
326
|
|
|
277
327
|
\`\`\`sh
|
|
278
328
|
npm run agentkit -- tool tool_name --input '{}'
|
|
279
329
|
\`\`\`
|
|
280
330
|
|
|
281
|
-
For the
|
|
331
|
+
For the lightweight docs router, read the path printed by:
|
|
282
332
|
|
|
283
333
|
\`\`\`sh
|
|
284
|
-
npm run agentkit -- docs
|
|
334
|
+
npm run agentkit -- docs llms
|
|
285
335
|
\`\`\`
|
|
286
336
|
|
|
337
|
+
Read the full framework contract with \`npm run agentkit -- docs full\` only when a skill asks for it.
|
|
338
|
+
|
|
287
339
|
## Database Tools
|
|
288
340
|
|
|
289
341
|
Tools that need agent-owned tables should use canonical \`ctx.db\` from the tool context. \`ctx.database\` and \`ctx.storage.sql\` are aliases. Do not import local database drivers or Node-only APIs in a tool.
|
|
@@ -305,9 +357,10 @@ This capsule is deploy-ready by default.
|
|
|
305
357
|
1. Keep tools edge-safe and use \`ctx.db\` instead of importing database drivers.
|
|
306
358
|
2. Run \`npm run agentkit -- build\` only when you want to validate the artifact locally.
|
|
307
359
|
3. If the owner has not logged in yet, ask for an invited AgentKit Cloud alpha token and run \`npm run agentkit -- login --token <token>\`.
|
|
308
|
-
4. Put production secrets into managed secrets with \`npm run agentkit -- secret set <NAME>
|
|
360
|
+
4. Put production secrets into managed secrets with \`npm run agentkit -- secret set <NAME> --from-local-env\`, \`--from-env\`, or \`--stdin\`.
|
|
309
361
|
5. Run \`npm run agentkit -- deploy\`.
|
|
310
|
-
6. Create client-facing deploy access tokens with \`npm run agentkit -- access token create <name>\` when a website or app needs
|
|
362
|
+
6. Run \`npm run agentkit -- chat-ui --deploy\` to test the hosted agent through a local UI using the auto-created \`.agentkit/chat-access-token.json\`. Create extra client-facing deploy access tokens with \`npm run agentkit -- access token create <name> --out <path>\` when a separate website or app needs its own credential.
|
|
363
|
+
7. Use \`npm run agentkit -- deploy --smoke "hello"\` during deploy or \`npm run agentkit -- deploy smoke --message "hello"\` afterward for an official hosted smoke check.
|
|
311
364
|
|
|
312
365
|
AgentKit owns hosted infrastructure and production secrets. Do not put production secret values in this capsule. Do not run operator/admin commands from a user capsule.
|
|
313
366
|
`,
|
|
@@ -321,8 +374,10 @@ Use AgentKit conventions when editing this support capsule.
|
|
|
321
374
|
- The agent contract lives in \`agentkit.config.ts\`.
|
|
322
375
|
- The example tool lives in \`tools/lookup-order.ts\`.
|
|
323
376
|
- The default provider is \`test/fake\`, which can call tools from JSON messages during local tests.
|
|
377
|
+
- Ask the owner which real provider to use before switching from \`test/fake\`; do not choose OpenRouter, OpenAI, or Anthropic automatically.
|
|
324
378
|
- Keep required local secret names in \`.env.schema\` and values in ignored \`.env\`. AgentKit local commands load \`.env\` directly.
|
|
325
379
|
- Treat the owner's natural-language request as the brief and start implementing inside this capsule.
|
|
380
|
+
- Start with \`skills/agentkit-capsule/SKILL.md\` when the task is not obvious.
|
|
326
381
|
`,
|
|
327
382
|
},
|
|
328
383
|
{
|
|
@@ -334,14 +389,18 @@ Generated by AgentKit as a support Agent Capsule.
|
|
|
334
389
|
## Setup
|
|
335
390
|
|
|
336
391
|
\`\`\`sh
|
|
337
|
-
npm install
|
|
338
392
|
npm run chat -- --message "hello"
|
|
339
393
|
npm run agentkit -- tool lookup_order --input '{"orderId":"A100"}'
|
|
340
394
|
npm run eval
|
|
341
395
|
npm run dev
|
|
342
396
|
\`\`\`
|
|
343
397
|
|
|
398
|
+
\`agentkit new\` installs dependencies by default. Run \`npm install\` only if this capsule was created with \`--no-install\`, install failed, or \`node_modules\` was deleted.
|
|
399
|
+
|
|
344
400
|
The support template includes a local \`lookup_order\` TypeScript tool and uses \`test/fake\` by default.
|
|
401
|
+
\`test/fake\` does not validate real conversation quality. The owner must choose OpenRouter, OpenAI, Anthropic, or another supported provider before real model behavior is tested.
|
|
402
|
+
|
|
403
|
+
For UI testing, run \`npm run dev\` and open the printed \`Chat:\` URL. After hosted deploy, run \`npm run agentkit -- chat-ui --deploy\` and open its printed \`Chat:\` URL.
|
|
345
404
|
`,
|
|
346
405
|
},
|
|
347
406
|
];
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
# Channels Production Handoff
|
|
2
|
-
|
|
3
|
-
## Goal
|
|
4
|
-
|
|
5
|
-
Move Channels from local fake control-plane tests to production safely.
|
|
6
|
-
|
|
7
|
-
## Deployment Order
|
|
8
|
-
|
|
9
|
-
1. Build and typecheck:
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
npm run typecheck
|
|
13
|
-
bun test
|
|
14
|
-
agentkit build --target cloudflare
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
2. Deploy AgentKit Cloud/control plane with:
|
|
18
|
-
|
|
19
|
-
```txt
|
|
20
|
-
Cloudflare Worker
|
|
21
|
-
Cloudflare Queue for channel jobs
|
|
22
|
-
Durable Object namespace for channel coordination
|
|
23
|
-
R2 bucket for large/raw payload handoff when enabled
|
|
24
|
-
Turso/Postgres control-plane tables for deploys, channels, deliveries, events, and identities
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
3. Set managed secrets:
|
|
28
|
-
|
|
29
|
-
```txt
|
|
30
|
-
OPENAI_API_KEY or another model provider key
|
|
31
|
-
TELEGRAM_BOT_TOKEN
|
|
32
|
-
TELEGRAM_WEBHOOK_SECRET
|
|
33
|
-
ZAPSTER_API_KEY
|
|
34
|
-
ZAPSTER_WEBHOOK_SECRET
|
|
35
|
-
META_WHATSAPP_ACCESS_TOKEN
|
|
36
|
-
META_WHATSAPP_APP_SECRET
|
|
37
|
-
META_WHATSAPP_VERIFY_TOKEN
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
4. Create channels:
|
|
41
|
-
|
|
42
|
-
```sh
|
|
43
|
-
agentkit channels add telegram support-telegram
|
|
44
|
-
agentkit channels add whatsapp support-whatsapp --provider zapster
|
|
45
|
-
agentkit channels setup support-telegram --apply
|
|
46
|
-
agentkit channels setup support-whatsapp
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
5. Run smoke checks:
|
|
50
|
-
|
|
51
|
-
```sh
|
|
52
|
-
agentkit channels status support-telegram
|
|
53
|
-
agentkit channels test support-telegram --message "hello"
|
|
54
|
-
agentkit channels status support-whatsapp
|
|
55
|
-
agentkit channels test support-whatsapp --message "hello"
|
|
56
|
-
agentkit channels deliveries list support-telegram --since 1h
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Local Fake Versus Real Provider Gates
|
|
60
|
-
|
|
61
|
-
Default tests are offline and must pass without provider credentials:
|
|
62
|
-
|
|
63
|
-
```sh
|
|
64
|
-
bun test
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Real-provider smoke tests are opt-in:
|
|
68
|
-
|
|
69
|
-
```sh
|
|
70
|
-
AGENTKIT_RUN_TELEGRAM_CHANNEL_TESTS=1 bun test
|
|
71
|
-
AGENTKIT_RUN_ZAPSTER_CHANNEL_TESTS=1 bun test
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Telegram smoke requires `TELEGRAM_BOT_TOKEN`, `TELEGRAM_WEBHOOK_SECRET`, and `AGENTKIT_TELEGRAM_WEBHOOK_URL`.
|
|
75
|
-
|
|
76
|
-
Zapster smoke requires `ZAPSTER_API_KEY`, `AGENTKIT_ZAPSTER_SEND_URL`, and `AGENTKIT_ZAPSTER_TO`.
|
|
77
|
-
|
|
78
|
-
## Smoke Checks
|
|
79
|
-
|
|
80
|
-
- Unknown channel ID returns `404` and creates no tenant record.
|
|
81
|
-
- Invalid Telegram/Zapster signature returns `401` and creates a failed delivery.
|
|
82
|
-
- Duplicate provider event returns `200` with `duplicate` and creates no second queue job.
|
|
83
|
-
- Accepted inbound text creates one queue job and one outbound delivery.
|
|
84
|
-
- Retryable failures dead-letter after the configured retry ceiling.
|
|
85
|
-
- `channel_limit_exceeded` does not create queue backlog.
|
|
86
|
-
|
|
87
|
-
## Rollback
|
|
88
|
-
|
|
89
|
-
- Disable the channel resource first; do not delete delivery history.
|
|
90
|
-
- Remove provider webhook registration if the provider keeps retrying.
|
|
91
|
-
- Roll back the Worker only after queue drain or pause.
|
|
92
|
-
- Keep managed secrets; rotate only if a secret may have leaked.
|
|
93
|
-
|
|
94
|
-
## Production Defaults
|
|
95
|
-
|
|
96
|
-
- Start with conservative per-channel daily message and cost limits.
|
|
97
|
-
- Keep raw body storage disabled unless there is an explicit encrypted R2 retention policy.
|
|
98
|
-
- Delivery APIs return hashes and redacted metadata, not payload bodies.
|
|
99
|
-
- Turso remains reserved for the user's agent application data, not AgentKit channel plumbing.
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Portable Deploy Release Checklist
|
|
2
|
-
|
|
3
|
-
Run this before merging portable deploy target work.
|
|
4
|
-
|
|
5
|
-
## Tests
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
bun test
|
|
9
|
-
npm run typecheck
|
|
10
|
-
npm run agentkit -- build --target cloudflare
|
|
11
|
-
npm run agentkit -- build --target container
|
|
12
|
-
npm run agentkit -- deploy --target vps --host agent.example.com --dry-run
|
|
13
|
-
docker compose -f .agentkit/build/vps/compose.yaml config
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Smoke
|
|
17
|
-
|
|
18
|
-
- Cloudflare build contains `worker.js`, `wrangler.jsonc`, `durable-object-schema.sql`, and `agent.manifest.json`.
|
|
19
|
-
- Container build contains `server.js`, `Dockerfile`, `migrations/`, and `agent.manifest.json`.
|
|
20
|
-
- VPS build contains `compose.yaml`, `.env.production.example`, `SECRETS.md`, and `PRODUCTION_HANDOFF.md`.
|
|
21
|
-
- `/health`, `/_agentkit`, `/chat`, `/tools/:name`, `/files/:key`, and channel webhook fixtures pass on the local/container runtime.
|
|
22
|
-
|
|
23
|
-
## Secrets
|
|
24
|
-
|
|
25
|
-
```sh
|
|
26
|
-
rg -n "sk-|OPENAI_API_KEY=.*[A-Za-z0-9]" .agentkit/build || true
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Expected: no secret values. Generated files may contain secret names only.
|
|
30
|
-
|
|
31
|
-
## Production Handoff
|
|
32
|
-
|
|
33
|
-
- Cloudflare deploy has target-aware `.agentkit/deploy.json` with `target`, `runtime`, and `resources`.
|
|
34
|
-
- VPS handoff documents `PORT`, `AGENTKIT_SQLITE_PATH`, reverse proxy expectations, smoke checks, SQLite backup, Postgres upgrade path, and rollback.
|
|
35
|
-
- Rollback command is present in `.agentkit/build/vps/PRODUCTION_HANDOFF.md`.
|
|
36
|
-
|
|
37
|
-
## External Smokes
|
|
38
|
-
|
|
39
|
-
- Cloudflare deployed smoke requires Cloudflare credentials and a provider key.
|
|
40
|
-
- Docker image smoke requires a running Docker daemon.
|
|
41
|
-
- Telegram/Zapster real send smoke requires explicit provider credentials.
|