@andreprado/agentkit 0.1.0-alpha.2 → 0.1.0-alpha.4
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 +45 -6
- package/docs/guides/add-tool.md +1 -1
- package/docs/guides/channels-implementation-map.md +243 -0
- package/docs/guides/create-agent.md +23 -4
- package/docs/guides/prepare-deploy.md +18 -6
- package/docs/guides/run-evals.md +28 -2
- package/docs/guides/security-rules.md +1 -1
- package/docs/guides/use-provider.md +16 -2
- package/docs/llms-full.txt +70 -38
- package/docs/llms.txt +15 -4
- package/package.json +1 -2
- package/src/cli/index.ts +1190 -36
- package/src/cloud/artifact.ts +48 -0
- package/src/cloud/client.ts +79 -0
- package/src/cloud/contracts.ts +47 -0
- package/src/cloud/index.ts +3 -0
- package/src/index.ts +1 -1
- package/src/providers/test.ts +51 -0
- package/src/runtime/chat.ts +59 -4
- package/src/runtime/deploy.ts +1 -1
- package/src/runtime/dev-server.ts +154 -16
- package/src/runtime/runtime-contract.ts +16 -2
- package/src/runtime/targets/cloudflare/build.ts +83 -4
- package/src/storage/sqlite.ts +2 -2
- package/src/templates/blank.ts +52 -9
- package/src/templates/dentista.ts +988 -0
- package/src/templates/index.ts +2 -0
- package/src/templates/support.ts +50 -9
- package/src/runtime/targets/cloudflare/deploy.ts +0 -5475
package/src/templates/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { blankTemplate } from "./blank";
|
|
2
|
+
import { dentistaTemplate } from "./dentista";
|
|
2
3
|
import { supportTemplate } from "./support";
|
|
3
4
|
|
|
4
5
|
export type TemplateFile = {
|
|
@@ -17,6 +18,7 @@ export type AgentTemplateContext = {
|
|
|
17
18
|
|
|
18
19
|
const templates = new Map<string, AgentTemplate>([
|
|
19
20
|
[blankTemplate.name, blankTemplate],
|
|
21
|
+
[dentistaTemplate.name, dentistaTemplate],
|
|
20
22
|
[supportTemplate.name, supportTemplate],
|
|
21
23
|
]);
|
|
22
24
|
|
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
|
{
|
|
@@ -194,28 +195,37 @@ Start building immediately:
|
|
|
194
195
|
- Edit \`prompts/instructions.md\` for support behavior.
|
|
195
196
|
- Edit \`agentkit.config.ts\` for provider, tools, secrets, access, and storage.
|
|
196
197
|
- Add or replace TypeScript tools under \`tools/\` when the requested support agent needs actions or external data.
|
|
198
|
+
- Do not wait for a wizard or recipe. AgentKit provides the scaffold and contract; you decide the implementation from the owner's brief.
|
|
197
199
|
- Ask follow-up questions only when missing information blocks a safe local implementation.
|
|
198
200
|
- State assumptions in the final response.
|
|
199
201
|
|
|
200
202
|
## Local Commands
|
|
201
203
|
|
|
202
|
-
- \`npm install\`:
|
|
204
|
+
- \`npm install\`: restore capsule dependencies if this capsule used \`--no-install\`, install failed, or \`node_modules\` was deleted.
|
|
203
205
|
- \`npm run chat -- --message "hello"\`: send one local chat message.
|
|
204
206
|
- \`npm run agentkit -- tool lookup_order --input '{"orderId":"A100"}'\`: test the example tool directly.
|
|
205
207
|
- \`npm run eval\`: run agent evals.
|
|
206
208
|
- \`npm run dev\`: run the local Agent Capsule runtime.
|
|
207
209
|
- \`npm run agentkit -- inspect\`: print machine-readable capsule state.
|
|
208
|
-
- \`npm run agentkit -- env set <NAME>
|
|
210
|
+
- \`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
211
|
- \`npm run agentkit -- env list\`: list local secret names without printing values.
|
|
210
212
|
- \`npm run agentkit -- docs full\`: print the full AgentKit contract path.
|
|
211
213
|
|
|
214
|
+
## Testing With A UI
|
|
215
|
+
|
|
216
|
+
- Local UI: run \`npm run dev\`, open the printed \`Chat:\` URL, and tell the owner the exact URL.
|
|
217
|
+
- 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.
|
|
218
|
+
- \`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.
|
|
219
|
+
- 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.
|
|
220
|
+
|
|
212
221
|
## Hosted Deploy
|
|
213
222
|
|
|
214
223
|
- Local scaffold, chat, eval, dev, inspect, tool, and build commands are token-free.
|
|
215
224
|
- 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>
|
|
225
|
+
- 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
226
|
- Deploy with \`npm run agentkit -- deploy\`, then check \`npm run agentkit -- deploy status\`.
|
|
218
|
-
- Create client-facing
|
|
227
|
+
- 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.
|
|
228
|
+
- Use \`npm run agentkit -- deploy --smoke "hello"\` or \`npm run agentkit -- deploy smoke --message "hello"\` for an official hosted chat smoke check.
|
|
219
229
|
- Do not run operator/admin commands from a user capsule.
|
|
220
230
|
|
|
221
231
|
## Files
|
|
@@ -251,27 +261,52 @@ Turn the request into a working local capsule:
|
|
|
251
261
|
- Update \`agentkit.config.ts\` when tools, secrets, provider, or access rules change.
|
|
252
262
|
- Add, replace, or remove TypeScript tools under \`tools/\` for real actions or external data.
|
|
253
263
|
- Keep the first version runnable with \`test/fake\` unless the owner explicitly asks for a real provider.
|
|
264
|
+
- Do not use a wizard or recipe. Build the capsule directly from the scaffold, the AgentKit contract, and the owner's brief.
|
|
254
265
|
- Make practical assumptions and list them in your final response.
|
|
255
266
|
- Ask follow-up questions only when missing information blocks a safe local implementation.
|
|
256
267
|
|
|
257
268
|
## Local Commands
|
|
258
269
|
|
|
259
270
|
\`\`\`sh
|
|
260
|
-
npm install
|
|
261
271
|
npm run typecheck
|
|
262
272
|
npm run agentkit -- inspect
|
|
263
273
|
npm run agentkit -- tool lookup_order --input '{"orderId":"A100"}'
|
|
264
274
|
npm run eval
|
|
265
275
|
\`\`\`
|
|
266
276
|
|
|
277
|
+
\`test/fake\` proves the scaffold and deterministic tool paths. It does not prove natural conversation quality.
|
|
278
|
+
|
|
279
|
+
\`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.
|
|
280
|
+
|
|
267
281
|
Set local development secrets without opening code:
|
|
268
282
|
|
|
269
283
|
\`\`\`sh
|
|
270
|
-
npm run agentkit -- env set OPENAI_API_KEY
|
|
284
|
+
printf %s "$OPENAI_API_KEY" | npm run agentkit -- env set OPENAI_API_KEY --stdin
|
|
271
285
|
npm run agentkit -- inspect
|
|
272
286
|
npm run chat -- --message "hello"
|
|
273
287
|
\`\`\`
|
|
274
288
|
|
|
289
|
+
## Testing With A UI
|
|
290
|
+
|
|
291
|
+
Local UI:
|
|
292
|
+
|
|
293
|
+
\`\`\`sh
|
|
294
|
+
npm run dev
|
|
295
|
+
\`\`\`
|
|
296
|
+
|
|
297
|
+
Open the printed \`Chat:\` URL and tell the owner the exact URL.
|
|
298
|
+
|
|
299
|
+
Hosted deploy UI:
|
|
300
|
+
|
|
301
|
+
\`\`\`sh
|
|
302
|
+
npm run agentkit -- deploy
|
|
303
|
+
npm run agentkit -- chat-ui --deploy
|
|
304
|
+
\`\`\`
|
|
305
|
+
|
|
306
|
+
Open the printed \`Chat:\` URL and tell the owner this local UI is connected to the hosted deploy.
|
|
307
|
+
|
|
308
|
+
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.
|
|
309
|
+
|
|
275
310
|
If you add a tool, also run a fake-provider tool smoke test:
|
|
276
311
|
|
|
277
312
|
\`\`\`sh
|
|
@@ -305,9 +340,10 @@ This capsule is deploy-ready by default.
|
|
|
305
340
|
1. Keep tools edge-safe and use \`ctx.db\` instead of importing database drivers.
|
|
306
341
|
2. Run \`npm run agentkit -- build\` only when you want to validate the artifact locally.
|
|
307
342
|
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>
|
|
343
|
+
4. Put production secrets into managed secrets with \`npm run agentkit -- secret set <NAME> --from-local-env\`, \`--from-env\`, or \`--stdin\`.
|
|
309
344
|
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
|
|
345
|
+
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.
|
|
346
|
+
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
347
|
|
|
312
348
|
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
349
|
`,
|
|
@@ -321,6 +357,7 @@ Use AgentKit conventions when editing this support capsule.
|
|
|
321
357
|
- The agent contract lives in \`agentkit.config.ts\`.
|
|
322
358
|
- The example tool lives in \`tools/lookup-order.ts\`.
|
|
323
359
|
- The default provider is \`test/fake\`, which can call tools from JSON messages during local tests.
|
|
360
|
+
- Ask the owner which real provider to use before switching from \`test/fake\`; do not choose OpenRouter, OpenAI, or Anthropic automatically.
|
|
324
361
|
- Keep required local secret names in \`.env.schema\` and values in ignored \`.env\`. AgentKit local commands load \`.env\` directly.
|
|
325
362
|
- Treat the owner's natural-language request as the brief and start implementing inside this capsule.
|
|
326
363
|
`,
|
|
@@ -334,14 +371,18 @@ Generated by AgentKit as a support Agent Capsule.
|
|
|
334
371
|
## Setup
|
|
335
372
|
|
|
336
373
|
\`\`\`sh
|
|
337
|
-
npm install
|
|
338
374
|
npm run chat -- --message "hello"
|
|
339
375
|
npm run agentkit -- tool lookup_order --input '{"orderId":"A100"}'
|
|
340
376
|
npm run eval
|
|
341
377
|
npm run dev
|
|
342
378
|
\`\`\`
|
|
343
379
|
|
|
380
|
+
\`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.
|
|
381
|
+
|
|
344
382
|
The support template includes a local \`lookup_order\` TypeScript tool and uses \`test/fake\` by default.
|
|
383
|
+
\`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.
|
|
384
|
+
|
|
385
|
+
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
386
|
`,
|
|
346
387
|
},
|
|
347
388
|
];
|