@andreprado/agentkit 0.1.0 → 0.2.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 (104) 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 +0 -3
  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 +2 -4
  25. package/src/cli/commands/channels.ts +8 -1613
  26. package/src/cli/commands/feedback.ts +8 -86
  27. package/src/cli/constants.ts +0 -3
  28. package/src/cli/flags.ts +0 -28
  29. package/src/cli/help.ts +16 -92
  30. package/src/cli/index.ts +15 -1091
  31. package/src/index.ts +6 -158
  32. package/src/providers/pi.ts +2 -0
  33. package/src/runtime/channels/discord.ts +16 -8
  34. package/src/runtime/channels/generic-webhook.ts +21 -313
  35. package/src/runtime/channels/net-guard.ts +480 -0
  36. package/src/runtime/channels/provider-fetch.ts +54 -0
  37. package/src/runtime/channels/slack.ts +9 -3
  38. package/src/runtime/channels/telegram.ts +43 -10
  39. package/src/runtime/channels/whatsapp-evolution.ts +33 -60
  40. package/src/runtime/channels/whatsapp-uazapi.ts +33 -164
  41. package/src/runtime/channels/whatsapp-zapster.ts +35 -7
  42. package/src/runtime/chat.ts +5 -3
  43. package/src/runtime/config.ts +36 -147
  44. package/src/runtime/database.ts +2 -2
  45. package/src/runtime/dev-server.ts +8 -8
  46. package/src/runtime/env.ts +11 -0
  47. package/src/runtime/improve.ts +2 -262
  48. package/src/runtime/inspect.ts +13 -73
  49. package/src/runtime/knowledge/embeddings.ts +45 -7
  50. package/src/runtime/knowledge/ingest.ts +70 -7
  51. package/src/runtime/knowledge/tool.ts +16 -2
  52. package/src/runtime/knowledge/vector.ts +31 -31
  53. package/src/runtime/tool-runner.ts +5 -3
  54. package/src/runtime/tools.ts +10 -14
  55. package/src/storage/sqlite.ts +11 -32
  56. package/src/templates/blank.ts +15 -102
  57. package/src/templates/common.ts +60 -0
  58. package/src/templates/dentista.ts +7 -74
  59. package/src/templates/skills/agentkit-capsule/SKILL.md +5 -7
  60. package/src/templates/skills/agentkit-capsule/references/docs-router.md +2 -3
  61. package/src/templates/skills/agentkit-channels/SKILL.md +6 -119
  62. package/src/templates/skills/agentkit-channels/references/channel-buffering.md +0 -9
  63. package/src/templates/skills/agentkit-channels/references/channel-debugging.md +1 -64
  64. package/src/templates/skills/agentkit-channels/references/discord.md +2 -92
  65. package/src/templates/skills/agentkit-channels/references/slack.md +2 -55
  66. package/src/templates/skills/agentkit-channels/references/telegram.md +2 -71
  67. package/src/templates/skills/agentkit-channels/references/whatsapp-evolution.md +2 -56
  68. package/src/templates/skills/agentkit-channels/references/whatsapp-uazapi.md +2 -53
  69. package/src/templates/skills/agentkit-channels/references/whatsapp-zapster.md +2 -70
  70. package/src/templates/skills/agentkit-database/SKILL.md +2 -4
  71. package/src/templates/skills/agentkit-evals/SKILL.md +1 -1
  72. package/src/templates/skills/agentkit-improve/SKILL.md +6 -85
  73. package/src/templates/skills/agentkit-improve/references/trace-packets.md +1 -1
  74. package/src/templates/skills/agentkit-provider/SKILL.md +0 -1
  75. package/src/templates/skills/agentkit-security/SKILL.md +1 -3
  76. package/src/templates/skills/agentkit-tools/SKILL.md +1 -1
  77. package/src/templates/skills/agentkit-tools/examples/database-write.tool.md +1 -2
  78. package/src/templates/skills/agentkit-troubleshooting/SKILL.md +5 -11
  79. package/src/templates/support.ts +8 -92
  80. package/docs/guides/add-managed-composio.md +0 -165
  81. package/docs/guides/improve-from-production.md +0 -151
  82. package/docs/guides/prepare-deploy.md +0 -227
  83. package/docs/guides/replay-production-traces.md +0 -72
  84. package/docs/guides/send-feedback.md +0 -135
  85. package/src/cli/cloud-client.ts +0 -377
  86. package/src/cli/deploy-chat-ui.ts +0 -606
  87. package/src/cli/deploy-readiness.ts +0 -561
  88. package/src/cloud/artifact.ts +0 -139
  89. package/src/cloud/client.ts +0 -80
  90. package/src/cloud/contracts.ts +0 -63
  91. package/src/cloud/index.ts +0 -3
  92. package/src/runtime/build.ts +0 -43
  93. package/src/runtime/core/deploy-state.ts +0 -54
  94. package/src/runtime/core/manifest.ts +0 -283
  95. package/src/runtime/core/targets.ts +0 -133
  96. package/src/runtime/deploy-readiness.ts +0 -135
  97. package/src/runtime/deploy.ts +0 -1
  98. package/src/runtime/integrations/composio.ts +0 -425
  99. package/src/runtime/targets/cloudflare/build.ts +0 -3319
  100. package/src/runtime/targets/container/build.ts +0 -146
  101. package/src/runtime/targets/container/server.ts +0 -33
  102. package/src/runtime/targets/vps/deploy.ts +0 -223
  103. package/src/templates/skills/agentkit-deploy/SKILL.md +0 -52
  104. 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
@@ -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
 
@@ -203,5 +202,3 @@ Check the key value, provider account status, and model access.
203
202
  `custom` is reserved in config but not implemented in the local adapter yet.
204
203
 
205
204
  ## 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.