@andreprado/agentkit 0.1.1 → 0.3.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.
Files changed (97) hide show
  1. package/README.md +8 -77
  2. package/docs/guides/add-channel.md +14 -92
  3. package/docs/guides/add-knowledge.md +0 -21
  4. package/docs/guides/add-tool.md +5 -11
  5. package/docs/guides/channel-security.md +3 -207
  6. package/docs/guides/connect-discord.md +7 -172
  7. package/docs/guides/connect-slack.md +6 -121
  8. package/docs/guides/connect-telegram.md +6 -165
  9. package/docs/guides/connect-whatsapp-evolution.md +6 -116
  10. package/docs/guides/connect-whatsapp-uazapi.md +6 -134
  11. package/docs/guides/connect-whatsapp-zapster.md +6 -202
  12. package/docs/guides/create-agent.md +5 -14
  13. package/docs/guides/debug-channel.md +4 -156
  14. package/docs/guides/improve-local.md +13 -0
  15. package/docs/guides/local-only-migration.md +35 -0
  16. package/docs/guides/replay-local-traces.md +11 -0
  17. package/docs/guides/run-evals.md +2 -4
  18. package/docs/guides/security-rules.md +5 -154
  19. package/docs/guides/use-jev.md +3 -6
  20. package/docs/guides/use-provider.md +5 -6
  21. package/docs/guides/write-feedback.md +10 -0
  22. package/docs/llms-full.txt +27 -448
  23. package/docs/llms.txt +8 -44
  24. package/package.json +3 -5
  25. package/src/cli/commands/channels.ts +8 -1613
  26. package/src/cli/commands/feedback.ts +8 -86
  27. package/src/cli/commands/provider.ts +29 -11
  28. package/src/cli/constants.ts +0 -3
  29. package/src/cli/flags.ts +0 -28
  30. package/src/cli/help.ts +16 -92
  31. package/src/cli/index.ts +15 -1091
  32. package/src/index.ts +6 -158
  33. package/src/providers/codex-auth.ts +16 -2
  34. package/src/providers/pi.ts +36 -19
  35. package/src/runtime/channels/discord.ts +2 -2
  36. package/src/runtime/chat.ts +5 -3
  37. package/src/runtime/config.ts +14 -148
  38. package/src/runtime/database.ts +2 -2
  39. package/src/runtime/dev-server.ts +8 -8
  40. package/src/runtime/env.ts +11 -0
  41. package/src/runtime/improve.ts +2 -262
  42. package/src/runtime/inspect.ts +13 -73
  43. package/src/runtime/knowledge/ingest.ts +1 -1
  44. package/src/runtime/knowledge/tool.ts +16 -2
  45. package/src/runtime/knowledge/vector.ts +1 -1
  46. package/src/runtime/tool-runner.ts +5 -3
  47. package/src/runtime/tools.ts +10 -14
  48. package/src/storage/sqlite.ts +11 -32
  49. package/src/templates/blank.ts +15 -102
  50. package/src/templates/common.ts +60 -0
  51. package/src/templates/dentista.ts +7 -74
  52. package/src/templates/skills/agentkit-capsule/SKILL.md +5 -7
  53. package/src/templates/skills/agentkit-capsule/references/docs-router.md +2 -3
  54. package/src/templates/skills/agentkit-channels/SKILL.md +6 -119
  55. package/src/templates/skills/agentkit-channels/references/channel-buffering.md +0 -9
  56. package/src/templates/skills/agentkit-channels/references/channel-debugging.md +1 -64
  57. package/src/templates/skills/agentkit-channels/references/discord.md +2 -92
  58. package/src/templates/skills/agentkit-channels/references/slack.md +2 -55
  59. package/src/templates/skills/agentkit-channels/references/telegram.md +2 -71
  60. package/src/templates/skills/agentkit-channels/references/whatsapp-evolution.md +2 -56
  61. package/src/templates/skills/agentkit-channels/references/whatsapp-uazapi.md +2 -53
  62. package/src/templates/skills/agentkit-channels/references/whatsapp-zapster.md +2 -70
  63. package/src/templates/skills/agentkit-database/SKILL.md +2 -4
  64. package/src/templates/skills/agentkit-evals/SKILL.md +1 -1
  65. package/src/templates/skills/agentkit-improve/SKILL.md +6 -85
  66. package/src/templates/skills/agentkit-improve/references/trace-packets.md +1 -1
  67. package/src/templates/skills/agentkit-provider/SKILL.md +1 -2
  68. package/src/templates/skills/agentkit-security/SKILL.md +1 -3
  69. package/src/templates/skills/agentkit-tools/SKILL.md +1 -1
  70. package/src/templates/skills/agentkit-tools/examples/database-write.tool.md +1 -2
  71. package/src/templates/skills/agentkit-troubleshooting/SKILL.md +5 -11
  72. package/src/templates/support.ts +8 -92
  73. package/docs/guides/add-managed-composio.md +0 -165
  74. package/docs/guides/improve-from-production.md +0 -151
  75. package/docs/guides/prepare-deploy.md +0 -227
  76. package/docs/guides/replay-production-traces.md +0 -72
  77. package/docs/guides/send-feedback.md +0 -135
  78. package/src/cli/cloud-client.ts +0 -377
  79. package/src/cli/deploy-chat-ui.ts +0 -606
  80. package/src/cli/deploy-readiness.ts +0 -561
  81. package/src/cloud/artifact.ts +0 -139
  82. package/src/cloud/client.ts +0 -80
  83. package/src/cloud/contracts.ts +0 -63
  84. package/src/cloud/index.ts +0 -3
  85. package/src/runtime/build.ts +0 -43
  86. package/src/runtime/core/deploy-state.ts +0 -54
  87. package/src/runtime/core/manifest.ts +0 -283
  88. package/src/runtime/core/targets.ts +0 -133
  89. package/src/runtime/deploy-readiness.ts +0 -135
  90. package/src/runtime/deploy.ts +0 -1
  91. package/src/runtime/integrations/composio.ts +0 -425
  92. package/src/runtime/targets/cloudflare/build.ts +0 -3319
  93. package/src/runtime/targets/container/build.ts +0 -146
  94. package/src/runtime/targets/container/server.ts +0 -33
  95. package/src/runtime/targets/vps/deploy.ts +0 -223
  96. package/src/templates/skills/agentkit-deploy/SKILL.md +0 -52
  97. package/src/templates/skills/agentkit-integrations/SKILL.md +0 -98
@@ -39,10 +39,10 @@ agentkit eval from-conversation <conversation-id>
39
39
  agentkit eval run
40
40
  ```
41
41
 
42
- Create evals from hosted or local production evidence:
42
+ Create evals from local production evidence:
43
43
 
44
44
  ```sh
45
- agentkit improve collect --deploy --since 24h
45
+ agentkit improve collect --since 24h
46
46
  agentkit improve evals .agentkit/improve/<run>
47
47
  agentkit replay .agentkit/improve/<run> --against local
48
48
  agentkit eval run
@@ -245,5 +245,3 @@ Tool eval hits a real API:
245
245
  Make the registered tool return deterministic fixture output when `ctx.runtime.environment === "eval"`, then rerun the eval suite. AgentKit does not expose a separate eval-only mock registry yet.
246
246
 
247
247
  ## Backend Contracts Used
248
-
249
- Future hosted evals use `EvalCase` and `EvalResult` resources. The current local implementation stores conversations, messages, runs, and tool calls only.
@@ -1,160 +1,11 @@
1
1
  # Security Rules
2
2
 
3
- ## Goal
3
+ Keep secret values in ignored `.env`; commit only names in `.env.schema` and config. Use `agentkit env set <NAME> --stdin` or `--from-env`, and inspect secret status with `agentkit inspect`. Provider OAuth credentials live outside capsules. Never print credentials or commit `.agentkit/`.
4
4
 
5
- Keep local and hosted AgentKit work from leaking secrets, exposing client data, or giving tools more power than they need.
5
+ Tools are trusted local TypeScript, not sandboxed code. Validate input/output schemas, declare scoped secret names, and use narrow permissions. Permissions ending in `:read` may run through model-driven chat; other declared permissions require direct invocation with `agentkit tool` after reviewing the exact input. Model-generated confirmation is not owner authorization.
6
6
 
7
- ## When To Use This
7
+ Guard external writes in evals with `ctx.runtime.environment === "eval"` and deterministic fixtures. Do not send real messages or modify external services from tests unless explicitly authorized.
8
8
 
9
- Use this before adding provider keys, tool secrets, external APIs, public access, deploys, or evals created from real conversations.
9
+ Only authenticated channel webhook routes may accept an HTTPS tunnel. Keep dev UI, chat, tools, files, and conversation APIs loopback-only. Preserve provider signature checks, secret tokens, media URL restrictions, and outbound SSRF protection. See `docs/guides/channel-security.md`.
10
10
 
11
- ## Commands
12
-
13
- Local checks:
14
-
15
- ```sh
16
- git status --short
17
- npm run agentkit -- env list
18
- npm run agentkit -- inspect
19
- npm run typecheck
20
- ```
21
-
22
- Search for accidental local secret files:
23
-
24
- ```sh
25
- find . -maxdepth 3 \( -name .env -o -path './.agentkit/*' \) -print
26
- ```
27
-
28
- Hosted alpha secret commands:
29
-
30
- ```sh
31
- agentkit login --token agk_user_...
32
- agentkit secret set OPENAI_API_KEY --from-local-env
33
- agentkit secret list
34
- agentkit secret unset OPENAI_API_KEY
35
- ```
36
-
37
- ## Files Created Or Edited
38
-
39
- Allowed committed files:
40
-
41
- ```txt
42
- .env.schema
43
- agentkit.config.ts
44
- prompts/
45
- tools/
46
- evals/
47
- AGENTS.md
48
- CLAUDE.md
49
- README.md
50
- ```
51
-
52
- Never commit:
53
-
54
- ```txt
55
- .env
56
- .agentkit/
57
- node_modules/
58
- ```
59
-
60
- ## Minimal Working Example
61
-
62
- Declare secret names:
63
-
64
- ```ts
65
- export default defineAgent({
66
- secrets: ["OPENAI_API_KEY"],
67
- });
68
- ```
69
-
70
- Set local secret names in `.env.schema`, keep values in ignored `.env`, and run AgentKit commands normally:
71
-
72
- ```sh
73
- npm run agentkit -- inspect
74
- npm run chat -- --message "hello"
75
- ```
76
-
77
- Declare tool-specific secrets:
78
-
79
- ```ts
80
- defineTool({
81
- name: "lookup_customer",
82
- secrets: ["CRM_API_KEY"],
83
- permissions: ["crm:contacts:read"],
84
- execute(input, ctx) {
85
- return fetchCustomer(input, ctx.secrets.CRM_API_KEY);
86
- },
87
- });
88
- ```
89
-
90
- ## Safety Rules
91
-
92
- - An Agent Capsule is executable TypeScript. Run AgentKit commands only in Capsules whose config, tools, evals, and sync code you trust; AgentKit does not sandbox Capsule code from the local filesystem, network, or process environment.
93
- - `.env` is local-only.
94
- - `.env.schema` is the committed contract for local secret names.
95
- - AgentKit local commands load `.env` directly so inspect, chat, tools, and evals share the same secret loader.
96
- - Production uses managed secrets.
97
- - Hosted deploys require `cloudflare_deploy_alpha` or purchased/manual deploy slots; local commands do not require login.
98
- - Secret values must not appear in config, docs, prompts, evals, logs, exports, or SQLite.
99
- - A tool receives only secrets listed in that tool.
100
- - Avoid direct `process.env` reads inside tools.
101
- - Use `permissions` to describe external capabilities.
102
- - Permissions ending in `:read` may run from chat, channels, and evals. Any other declared permission is operator-only and must be invoked directly with `agentkit tool <name> --input '<json>'` after reviewing the exact action.
103
- - Local dev access accepts only loopback Host/Origin values and limits JSON and webhook bodies to 1 MiB. Keep public tunnels behind authenticated access instead of weakening these checks.
104
- - Add timeouts to network tools.
105
- - Treat hosted deploy URLs as addresses, not access control.
106
- - Use deploy access tokens for hosted chat, hosted conversation reads, hosted trace reads, and any client app that talks to AgentKit Cloud.
107
- - Remove client PII before writing evals.
108
- - Review `.agentkit/feedback/` drafts before sending AgentKit product feedback. Do not paste `.env` values, provider keys, cookies, client PII, or full private transcripts into feedback messages.
109
-
110
- ## Verification
111
-
112
- ```sh
113
- npm run agentkit -- inspect
114
- git status --short
115
- git diff --check
116
- ```
117
-
118
- Expected:
119
-
120
- - Inspect shows secret names as `set` or `missing`.
121
- - Inspect does not show secret values.
122
- - `.env` and `.agentkit/` are untracked or ignored.
123
- - Tool calls persist without secret values.
124
-
125
- ## Troubleshooting
126
-
127
- Secret value appears in a file:
128
-
129
- Remove it, rotate the provider key, and check git history before sharing the branch.
130
-
131
- Tool needs a secret but receives `{}`:
132
-
133
- Add the secret name to the tool `secrets` field and set it locally:
134
-
135
- ```sh
136
- npm run agentkit -- inspect
137
- ```
138
-
139
- Hosted URL is reachable without a token:
140
-
141
- Treat this as a security bug. Hosted AgentKit Cloud routes should reject missing deploy tokens except authenticated channel webhook ingress.
142
-
143
- ## Backend Contracts Used
144
-
145
- Hosted secrets use:
146
-
147
- ```txt
148
- PUT /v1/projects/{project_id}/secrets/{name}
149
- GET /v1/projects/{project_id}/secrets
150
- DELETE /v1/projects/{project_id}/secrets/{name}
151
- ```
152
-
153
- Hosted access uses:
154
-
155
- ```txt
156
- PATCH /v1/deploys/{deploy_id}/access
157
- POST /v1/deploys/{deploy_id}/access-tokens
158
- ```
159
-
160
- Backend responses never return secret values.
11
+ Review traces, improve bundles, and feedback drafts before sharing. They may contain customer data even after redaction. Rotate leaked credentials at their provider, then update the local value and check affected traces.
@@ -12,7 +12,7 @@ Read the live [TypeSafe docs index](https://docs.typesafe.ai/llms.txt), [buildin
12
12
  - [Noul](https://docs.typesafe.ai/primitives/noul): estimate the probability of a yes/no condition. It has no separate confidence field.
13
13
  - [Score](https://docs.typesafe.ai/primitives/score): rate along concrete ordered levels.
14
14
 
15
- Use the closest cookbook from the index for the requested workflow. If the official `typesafe-ai` skill is installed, use it; it is optional and this workflow does not depend on a personal skill or helper being present. Check the current [HTTP contract](https://docs.typesafe.ai/api) when using the example, or the [JavaScript SDK](https://docs.typesafe.ai/sdk/javascript) if the capsule already uses it. Verify SDK compatibility with the capsule's deploy target before adding a dependency.
15
+ Use the closest cookbook from the index for the requested workflow. If the official `typesafe-ai` skill is installed, use it; it is optional and this workflow does not depend on a personal skill or helper being present. Check the current [HTTP contract](https://docs.typesafe.ai/api) when using the example, or the [JavaScript SDK](https://docs.typesafe.ai/sdk/javascript) if the capsule already uses it. Verify SDK compatibility with the capsule's Node runtime before adding a dependency.
16
16
 
17
17
  ## Build The Requested Capability
18
18
 
@@ -37,17 +37,14 @@ Set the real value through the local secret prompt:
37
37
  npm run agentkit -- env set TYPESAFE_API_KEY
38
38
  ```
39
39
 
40
- Read it only from `ctx.secrets.TYPESAFE_API_KEY` inside the tool. For a hosted capsule, follow [Prepare Deploy](prepare-deploy.md) and upload the key through managed secrets:
40
+ Read it only from `ctx.secrets.TYPESAFE_API_KEY` inside the tool. Keep the value in ignored local `.env`.
41
41
 
42
- ```sh
43
- npm run agentkit -- secret set TYPESAFE_API_KEY --from-local-env
44
- ```
45
42
 
46
43
  Send only the state needed for the judgment. Tool inputs and outputs are recorded, so avoid secrets, unnecessary client identifiers, and full conversation histories. Do not echo upstream response bodies or headers in errors. Forward `ctx.signal`, set a tool timeout, and validate returned values before using them. A timeout, 429, invalid response, or missing key must remain an explicit failure or a deliberately designed fallback; never turn it into a successful judgment.
47
44
 
48
45
  ## Verify
49
46
 
50
- The bundled example includes a fixture eval. In an isolated offline test capsule, supply a non-secret dummy `TYPESAFE_API_KEY`: AgentKit resolves declared secrets before entering the tool, even for eval fixtures. The fixture branch runs only in `eval` or `test`; `test/fake` as the conversational provider alone does not prevent live tool calls. Never upload a dummy key to a hosted capsule or substitute fixtures for production failures.
47
+ The bundled example includes a fixture eval. In an isolated offline test capsule, supply a non-secret dummy `TYPESAFE_API_KEY`: AgentKit resolves declared secrets before entering the tool, even for eval fixtures. The fixture branch runs only in `eval` or `test`; `test/fake` as the conversational provider alone does not prevent live tool calls. Never substitute fixtures for real runtime failures.
51
48
 
52
49
  ```sh
53
50
  npm run typecheck
@@ -49,12 +49,12 @@ To use the Codex subscription login instead of an OpenAI API key:
49
49
  npm run agentkit -- provider login openai-codex
50
50
  ```
51
51
 
52
- Run this in an interactive terminal, open the printed URL, and sign in with ChatGPT. If the browser callback cannot reach the terminal, paste the redirect URL into the prompt. This uses Pi's Codex OAuth flow and creates an AgentKit session; it does not read or change the Codex app/CLI credential cache.
52
+ Run this in an interactive terminal, choose browser login (default) or device code login for headless machines, then sign in with ChatGPT. If the browser callback cannot reach the terminal, paste the redirect URL into the prompt. This uses Pi's Codex OAuth flow and creates an AgentKit session; it does not read or change the Codex app/CLI credential cache.
53
53
 
54
54
  Configure the capsule:
55
55
 
56
56
  ```ts
57
- provider: { name: "openai-codex", model: "gpt-5.4" },
57
+ provider: { name: "openai-codex", model: "gpt-5.5" },
58
58
  secrets: [], // Keep any secrets required by your tools or other services.
59
59
  ```
60
60
 
@@ -68,7 +68,6 @@ npm run agentkit -- provider logout openai-codex
68
68
 
69
69
  `status` reports `logged_out`, `logged_in`, or `refresh_required` without token values. It checks the local cache, not account access at OpenAI. Local chat, dev, and eval renew expiring credentials through Pi automatically. Credentials live outside the capsule at `~/.agentkit/providers/openai-codex.json` with owner-only file permissions. The login is shared by local capsules under the same OS user. Logout removes this AgentKit session locally; it does not revoke the session at OpenAI or sign out the Codex app.
70
70
 
71
- This provider currently supports local execution only. Cloudflare, container, and VPS builds reject it with `target_runtime_incompatible`; choose an API-key provider and managed secrets for deployment. AgentKit never uploads the local OAuth session or falls back to API-key billing.
72
71
 
73
72
  If refresh fails, rerun login. If `provider_auth_busy` persists after a crashed process, stop AgentKit processes before removing the `.lock` directory next to the credential file, then retry.
74
73
 
@@ -103,7 +102,7 @@ Anthropic:
103
102
  ```ts
104
103
  provider: {
105
104
  name: "anthropic",
106
- model: "claude-3-5-haiku-latest",
105
+ model: "claude-haiku-4-5",
107
106
  },
108
107
  secrets: ["ANTHROPIC_API_KEY"],
109
108
  ```
@@ -194,6 +193,8 @@ npm run agentkit -- inspect
194
193
 
195
194
  For OpenAI, Anthropic, OpenCode Zen, or OpenCode Go, use a model id known to the installed Pi SDK for that provider. For OpenRouter, prefer a known Pi alias when possible; otherwise a raw OpenRouter model id is passed through and any remaining model error comes from OpenRouter.
196
195
 
196
+ After upgrading to AgentKit 0.3.0 (Pi 0.99), `openai-codex` no longer offers `gpt-5.4` or `gpt-5.4-mini`, and `anthropic` no longer offers `claude-3-5-haiku-latest`. Switch to a listed model such as `gpt-5.5` or `claude-haiku-4-5`; the error message lists examples.
197
+
197
198
  Provider returns auth failure:
198
199
 
199
200
  Check the key value, provider account status, and model access.
@@ -203,5 +204,3 @@ Check the key value, provider account status, and model access.
203
204
  `custom` is reserved in config but not implemented in the local adapter yet.
204
205
 
205
206
  ## Backend Contracts Used
206
-
207
- Local provider keys come from ignored `.env`, loaded directly by AgentKit. Hosted production uses `agentkit secret set <NAME> --from-local-env`, `--from-env`, or `--stdin` and the secret API. Secret values have no readback in hosted responses.
@@ -0,0 +1,10 @@
1
+ # Write AgentKit Feedback
2
+
3
+ Create a local, redacted report when a command fails or documentation is unclear:
4
+
5
+ ```sh
6
+ agentkit feedback create --about last-run --kind bug --summary "what failed"
7
+ agentkit feedback preview .agentkit/feedback/<draft>.json
8
+ ```
9
+
10
+ Drafts include current capsule metadata, not a saved last-command transcript. JSON and Markdown files stay under `.agentkit/feedback/` unless `--out` is specified. Review redaction before sharing them manually. AgentKit does not upload reports.