@alexkroman1/aai-cli 7.0.0 → 8.1.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 (122) hide show
  1. package/README.md +1 -0
  2. package/dist/{_bundler-B4RqNF5Z.mjs → _bundler-CDuYl5Gb.mjs} +1 -1
  3. package/dist/{_dev-server-CiKFH9qw.mjs → _dev-server-Dt3TCjhj.mjs} +6 -2
  4. package/dist/{_init-CE4HKdgV.mjs → _init-BhEfQ6Yi.mjs} +1 -1
  5. package/dist/_resource-commands.d.ts +23 -0
  6. package/dist/{_slug-api-nRFaBEPJ.mjs → _slug-api-z-USxPtL.mjs} +14 -10
  7. package/dist/_slug-api.d.ts +5 -2
  8. package/dist/{_templates-FI3xPEMj.mjs → _templates-4WcKOjS5.mjs} +4 -5
  9. package/dist/_templates.d.ts +3 -4
  10. package/dist/{build-6jfaakgc.mjs → build-BBxf8vom.mjs} +2 -2
  11. package/dist/cli.mjs +338 -346
  12. package/dist/{deploy-DvYeD8ia.mjs → deploy-DRC8jWr8.mjs} +1 -1
  13. package/dist/{dev-B59JIfWO.mjs → dev-QuuOOUtv.mjs} +1 -1
  14. package/dist/eval-DfQ8cm5p.mjs +56 -0
  15. package/dist/eval.d.ts +43 -0
  16. package/dist/{init-CpJVjEg0.mjs → init-CUo87gcI.mjs} +2 -2
  17. package/dist/{logs-9q-psa4q.mjs → logs-CQ2T46dr.mjs} +1 -1
  18. package/dist/scaffold/CLAUDE.md +409 -68
  19. package/dist/scaffold/package.json +5 -4
  20. package/dist/scaffold/server.mjs +10 -3
  21. package/dist/scaffold/tsconfig.json +0 -1
  22. package/dist/{secret-CVvSLIDV.mjs → secret-Ct34kdgU.mjs} +1 -1
  23. package/dist/{storage-BvUrnvM3.mjs → storage-i_79ZwAR.mjs} +1 -1
  24. package/dist/{studio--MUV0cid.mjs → studio-CzTzPqe1.mjs} +1 -1
  25. package/dist/templates/briefing-desk/agent.test.ts +350 -0
  26. package/dist/templates/briefing-desk/agent.ts +30 -0
  27. package/dist/templates/briefing-desk/shared.ts +200 -0
  28. package/dist/templates/briefing-desk/system-prompt.md +39 -0
  29. package/dist/templates/briefing-desk/tools/briefing_so_far.ts +35 -0
  30. package/dist/templates/briefing-desk/tools/research_topic.ts +88 -0
  31. package/dist/templates/briefing-desk/tools/verify_claim.ts +77 -0
  32. package/dist/templates/call-audit/agent.eval.test.ts +474 -0
  33. package/dist/templates/code-interpreter/agent.eval.test.ts +165 -0
  34. package/dist/templates/dispatch-center/agent.eval.test.ts +349 -0
  35. package/dist/templates/embedded-assets/agent.eval.test.ts +138 -0
  36. package/dist/templates/health-assistant/agent.eval.test.ts +167 -0
  37. package/dist/templates/infocom-adventure/agent.eval.test.ts +158 -0
  38. package/dist/templates/infocom-adventure/agent.test.ts +49 -18
  39. package/dist/templates/infocom-adventure/agent.ts +21 -0
  40. package/dist/templates/infocom-adventure/shared.ts +20 -9
  41. package/dist/templates/infocom-adventure/system-prompt.md +1 -1
  42. package/dist/templates/infocom-adventure/tools/game_state_move.ts +3 -2
  43. package/dist/templates/link-digest/agent.eval.test.ts +195 -0
  44. package/dist/templates/math-buddy/agent.eval.test.ts +146 -0
  45. package/dist/templates/night-owl/agent.eval.test.ts +272 -0
  46. package/dist/templates/personal-finance/agent.eval.test.ts +168 -0
  47. package/dist/templates/personal-finance/system-prompt.md +4 -0
  48. package/dist/templates/pipeline-simple/agent.eval.test.ts +78 -0
  49. package/dist/templates/pipeline-simple/agent.ts +2 -2
  50. package/dist/templates/pizza-ordering/agent.eval.test.ts +171 -0
  51. package/dist/templates/pizza-ordering/agent.test.ts +15 -0
  52. package/dist/templates/pizza-ordering/shared.ts +20 -1
  53. package/dist/templates/pizza-ordering/system-prompt.md +6 -0
  54. package/dist/templates/plan-and-execute/agent.eval.test.ts +209 -0
  55. package/dist/templates/podcast-digest/agent.eval.test.ts +411 -0
  56. package/dist/templates/podcast-digest/agent.test.ts +30 -59
  57. package/dist/templates/podcast-digest/agent.ts +1 -1
  58. package/dist/templates/podcast-digest/workflows/digest.ts +52 -19
  59. package/dist/templates/podcast-digest/workflows/slack.ts +48 -169
  60. package/dist/templates/recap-workflow/agent.eval.test.ts +366 -0
  61. package/dist/templates/redline/agent.eval.test.ts +209 -0
  62. package/dist/templates/research-workflow/agent.eval.test.ts +329 -0
  63. package/dist/templates/retail/address.ts +87 -1
  64. package/dist/templates/retail/agent.eval.test.ts +314 -0
  65. package/dist/templates/retail/agent.test.ts +171 -91
  66. package/dist/templates/retail/agent.ts +35 -1
  67. package/dist/templates/retail/cancel.ts +116 -0
  68. package/dist/templates/retail/client.tsx +39 -0
  69. package/dist/templates/retail/payment.ts +107 -0
  70. package/dist/templates/retail/pending.test.ts +196 -0
  71. package/dist/templates/retail/pending.ts +137 -0
  72. package/dist/templates/retail/registry.test.ts +119 -8
  73. package/dist/templates/retail/returns.ts +102 -0
  74. package/dist/templates/retail/shared.test.ts +42 -0
  75. package/dist/templates/retail/shared.ts +35 -0
  76. package/dist/templates/retail/store.test.ts +6 -4
  77. package/dist/templates/retail/store.ts +113 -57
  78. package/dist/templates/retail/swap.test.ts +4 -4
  79. package/dist/templates/retail/swap.ts +248 -15
  80. package/dist/templates/retail/system-prompt.md +62 -30
  81. package/dist/templates/retail/tools/cancel_change.ts +33 -0
  82. package/dist/templates/retail/tools/cancel_pending_order.ts +15 -59
  83. package/dist/templates/retail/tools/confirm_change.ts +42 -0
  84. package/dist/templates/retail/tools/exchange_delivered_order_items.ts +21 -66
  85. package/dist/templates/retail/tools/modify_pending_order_address.ts +12 -24
  86. package/dist/templates/retail/tools/modify_pending_order_items.ts +22 -60
  87. package/dist/templates/retail/tools/modify_pending_order_payment.ts +15 -77
  88. package/dist/templates/retail/tools/modify_user_address.ts +12 -15
  89. package/dist/templates/retail/tools/return_delivered_order_items.ts +16 -71
  90. package/dist/templates/retail/tools/transfer_to_human_agents.ts +4 -2
  91. package/dist/templates/simple/agent.eval.test.ts +54 -0
  92. package/dist/templates/solo-rpg/agent.eval.test.ts +320 -0
  93. package/dist/templates/spoken-summary/agent.eval.test.ts +342 -0
  94. package/dist/templates/support-line/agent.eval.test.ts +273 -0
  95. package/dist/templates/support-line/system-prompt.md +2 -1
  96. package/dist/templates/support-line/tools/answer_question.ts +56 -7
  97. package/dist/templates/transcription-workflow/agent.eval.test.ts +234 -0
  98. package/dist/templates/travel-concierge/agent.eval.test.ts +323 -0
  99. package/dist/templates/travel-concierge/agent.test.ts +110 -10
  100. package/dist/templates/travel-concierge/agent.ts +18 -9
  101. package/dist/templates/travel-concierge/shared.ts +110 -9
  102. package/dist/templates/travel-concierge/system-prompt.md +7 -1
  103. package/dist/templates/travel-concierge/tools/book_car_rental.ts +6 -3
  104. package/dist/templates/travel-concierge/tools/book_excursion.ts +6 -3
  105. package/dist/templates/travel-concierge/tools/book_hotel.ts +6 -3
  106. package/dist/templates/travel-concierge/tools/cancel_ticket.ts +6 -3
  107. package/dist/templates/travel-concierge/tools/search_car_rentals.ts +9 -5
  108. package/dist/templates/travel-concierge/tools/search_excursions.ts +9 -5
  109. package/dist/templates/travel-concierge/tools/search_flights.ts +9 -6
  110. package/dist/templates/travel-concierge/tools/search_hotels.ts +9 -5
  111. package/dist/templates/travel-concierge/tools/update_ticket.ts +6 -3
  112. package/dist/templates/web-researcher/agent.eval.test.ts +121 -0
  113. package/dist/templates/web-researcher/system-prompt.md +15 -4
  114. package/dist/{test-9kPKJI-w.mjs → test-BvyT6sAc.mjs} +24 -10
  115. package/dist/test.d.ts +29 -5
  116. package/dist/{worker-bundler-COxnqstQ.mjs → worker-bundler-CCVEDjm1.mjs} +45 -25
  117. package/dist/worker-bundler.mjs +1 -1
  118. package/dist/{workflow-D2AQf2Pl.mjs → workflow-BflATMmU.mjs} +19 -11
  119. package/package.json +5 -5
  120. package/dist/eject-C9WJyyr2.mjs +0 -116
  121. package/dist/eject.d.ts +0 -60
  122. package/dist/templates/infocom-adventure/tools/game_state_history.ts +0 -14
@@ -3,7 +3,7 @@ import { a as ok } from "./_output-CKkmWs7i.mjs";
3
3
  import { n as log, r as notify, t as fmtUrl } from "./_ui-u7T4YooX.mjs";
4
4
  import { o as errorMessage$1 } from "./_utils-B8QmtFhK.mjs";
5
5
  import { s as updateProjectConfig } from "./_config-CmJOFsAP.mjs";
6
- import { i as evalWorkerConfig, t as buildAgentBundle } from "./_bundler-B4RqNF5Z.mjs";
6
+ import { i as evalWorkerConfig, t as buildAgentBundle } from "./_bundler-CDuYl5Gb.mjs";
7
7
  import { t as resolveServerEnv } from "./_server-common-6e0QI4mq.mjs";
8
8
  import { a as resolveDeployTarget } from "./_agent-BTwZJu4P.mjs";
9
9
  import { assertTypechecks } from "./_typecheck-gate-BXvUNnfs.mjs";
@@ -12,7 +12,7 @@ import { styleText } from "node:util";
12
12
  async function executeDev(opts) {
13
13
  const port = parsePort(opts.port);
14
14
  const agentName = path.basename(path.resolve(opts.cwd));
15
- const { startDevServer } = await import("./_dev-server-CiKFH9qw.mjs");
15
+ const { startDevServer } = await import("./_dev-server-Dt3TCjhj.mjs");
16
16
  let cleanup;
17
17
  let shuttingDown = false;
18
18
  const onSignal = () => {
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ import { a as ok, n as fail } from "./_output-CKkmWs7i.mjs";
3
+ import { n as log } from "./_ui-u7T4YooX.mjs";
4
+ import { t as resolveServerEnv } from "./_server-common-6e0QI4mq.mjs";
5
+ import { classifyVitestError, runVitest } from "./test-BvyT6sAc.mjs";
6
+ //#region eval.ts
7
+ /**
8
+ * `aai eval` — run the agent's behaviour evals via vitest.
9
+ *
10
+ * An eval is not a test, and this is a separate command rather than part of
11
+ * `aai test` for the three reasons that follow from that:
12
+ *
13
+ * - **It spends money.** Every case drives a real LLM on a real key, so it
14
+ * cannot run on every save, in `aai build`, or in a pre-commit hook the way
15
+ * the unit tests do.
16
+ * - **It is a noisy instrument.** A behaviour eval measures a probabilistic
17
+ * system: identical code has scored 0.56 and 0.60 on the same task set with
18
+ * 9 of 25 tasks flipping outcome. A green run is weaker evidence than a green
19
+ * test run, and a red one is not automatically a regression. Mixing the two
20
+ * into one verdict devalues the reliable half.
21
+ * - **It is slow by construction** — one model turn per utterance. Hence the
22
+ * per-case budget below rather than vitest's 5s default, which no case that
23
+ * waits on a live reply can meet.
24
+ *
25
+ * What it runs is an ordinary vitest file, `agent.eval.test.ts`, which is why
26
+ * there is no eval DSL here: the project already has a runner, and the harness
27
+ * that makes an agent drivable from text is published
28
+ * (`@alexkroman1/aai-runtime/eval`).
29
+ */
30
+ /** The files `aai eval` runs, in preference order. */
31
+ const EVAL_FILES = ["agent.eval.test.ts", "agent.eval.test.js"];
32
+ /** Execute the agent's evals and return a structured result. */
33
+ async function executeEval(cwd) {
34
+ log.step("Running agent evals");
35
+ const env = await resolveServerEnv(cwd);
36
+ try {
37
+ if (!runVitest(cwd, {
38
+ candidates: EVAL_FILES,
39
+ extraArgs: ["--testTimeout", String(3e5)],
40
+ env
41
+ })) {
42
+ log.info("No eval file found. Create agent.eval.test.ts to measure what the agent does — see `openEvalSession` in @alexkroman1/aai-runtime/eval.");
43
+ return ok({
44
+ passed: true,
45
+ skipped: true
46
+ });
47
+ }
48
+ log.success("Evals passed");
49
+ return ok({ passed: true });
50
+ } catch (err) {
51
+ const { code, message } = classifyVitestError(err, "Evals");
52
+ return fail(code, message);
53
+ }
54
+ }
55
+ //#endregion
56
+ export { executeEval };
package/dist/eval.d.ts ADDED
@@ -0,0 +1,43 @@
1
+ /**
2
+ * `aai eval` — run the agent's behaviour evals via vitest.
3
+ *
4
+ * An eval is not a test, and this is a separate command rather than part of
5
+ * `aai test` for the three reasons that follow from that:
6
+ *
7
+ * - **It spends money.** Every case drives a real LLM on a real key, so it
8
+ * cannot run on every save, in `aai build`, or in a pre-commit hook the way
9
+ * the unit tests do.
10
+ * - **It is a noisy instrument.** A behaviour eval measures a probabilistic
11
+ * system: identical code has scored 0.56 and 0.60 on the same task set with
12
+ * 9 of 25 tasks flipping outcome. A green run is weaker evidence than a green
13
+ * test run, and a red one is not automatically a regression. Mixing the two
14
+ * into one verdict devalues the reliable half.
15
+ * - **It is slow by construction** — one model turn per utterance. Hence the
16
+ * per-case budget below rather than vitest's 5s default, which no case that
17
+ * waits on a live reply can meet.
18
+ *
19
+ * What it runs is an ordinary vitest file, `agent.eval.test.ts`, which is why
20
+ * there is no eval DSL here: the project already has a runner, and the harness
21
+ * that makes an agent drivable from text is published
22
+ * (`@alexkroman1/aai-runtime/eval`).
23
+ */
24
+ import { type CommandResult } from "./_output.ts";
25
+ type EvalData = {
26
+ passed: boolean;
27
+ skipped?: boolean;
28
+ };
29
+ /** The files `aai eval` runs, in preference order. */
30
+ export declare const EVAL_FILES: readonly ["agent.eval.test.ts", "agent.eval.test.js"];
31
+ /**
32
+ * How long one eval case may run.
33
+ *
34
+ * Vitest's default is 5s, which is shorter than a single live model turn on a
35
+ * slow day — so without this every case fails as a timeout and the report says
36
+ * nothing about the agent. Generous rather than tuned: the harness has its own
37
+ * 90s per-turn timeout with a message naming the events it saw, and that is the
38
+ * diagnostic worth reaching. This ceiling only exists so a wedged run ends.
39
+ */
40
+ export declare const EVAL_TEST_TIMEOUT_MS = 300000;
41
+ /** Execute the agent's evals and return a structured result. */
42
+ export declare function executeEval(cwd: string): Promise<CommandResult<EvalData>>;
43
+ export {};
@@ -105,7 +105,7 @@ function collectWarnings() {
105
105
  }
106
106
  /** Publish after init and return deploy metadata if successful. */
107
107
  async function tryPublish(cwd, server, warn) {
108
- const { executePublish } = await import("./studio--MUV0cid.mjs");
108
+ const { executePublish } = await import("./studio-CzTzPqe1.mjs");
109
109
  try {
110
110
  const result = await executePublish({
111
111
  cwd,
@@ -126,7 +126,7 @@ async function tryPublish(cwd, server, warn) {
126
126
  }
127
127
  /** Scaffold the project, optionally showing a spinner. */
128
128
  async function scaffoldProject(dir, cwd, template, silent) {
129
- const { runInit } = await import("./_init-CE4HKdgV.mjs");
129
+ const { runInit } = await import("./_init-BhEfQ6Yi.mjs");
130
130
  await withSpinner(silent, {
131
131
  start: `Creating ${dir}`,
132
132
  done: "Project created",
@@ -2,7 +2,7 @@
2
2
  import { a as ok } from "./_output-CKkmWs7i.mjs";
3
3
  import { n as log } from "./_ui-u7T4YooX.mjs";
4
4
  import { f as checkedResponse } from "./_studio-DR5yzZ1T.mjs";
5
- import { n as slugRequest } from "./_slug-api-nRFaBEPJ.mjs";
5
+ import { n as slugRequest } from "./_slug-api-z-USxPtL.mjs";
6
6
  import { isRecord, omitUndefined } from "@alexkroman1/aai/utils";
7
7
  import { sleep } from "@alexkroman1/aai/internal";
8
8
  function isLogsPage(value) {