@alexkroman1/aai-cli 7.0.0 → 8.0.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-Me06wgeF.mjs} +2 -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-BvcctCn2.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
@@ -1,116 +0,0 @@
1
- #!/usr/bin/env node
2
- import { a as ok, t as CliError } from "./_output-CKkmWs7i.mjs";
3
- import { n as log } from "./_ui-u7T4YooX.mjs";
4
- import { l as readJson, o as errorMessage, p as writeJson, s as fileExists } from "./_utils-B8QmtFhK.mjs";
5
- import { scaffoldDir } from "./_templates-FI3xPEMj.mjs";
6
- import path from "node:path";
7
- import fs from "node:fs/promises";
8
- //#region eject.ts
9
- /**
10
- * `aai eject` — retrofit the self-hosted entrypoint into an existing project.
11
- *
12
- * Every project scaffolded from this CLI version onwards already has
13
- * `server.mjs` and the `prestart`/`start` pair: the scaffold ships them, so
14
- * self-hosting is the default rather than something to opt into. This command
15
- * exists for the projects that predate that — `aai init` before it, or a
16
- * workspace pulled from a studio that was created earlier — where the files
17
- * are simply missing.
18
- *
19
- * It COPIES from the scaffold rather than writing its own contents. Two
20
- * definitions of "the self-hosted entrypoint" would drift, and the one nobody
21
- * runs locally is the one that would rot; this way an ejected project is
22
- * byte-identical to a freshly scaffolded one.
23
- *
24
- * The SCRIPTS are the exception it cannot copy, since a project's package.json
25
- * is its own — so `PRESTART_SCRIPT`/`START_SCRIPT` are written here and pinned
26
- * against the scaffold's manifest by `eject.test.ts`. Both matter: the
27
- * entrypoint boots the BUILT worker, so an ejected project with no `prestart`
28
- * exits at once naming the missing artifact.
29
- */
30
- /** The file `npm start` runs. Named once — the scaffold ships it under this name. */
31
- const SERVER_ENTRY = "server.mjs";
32
- /** The `scripts.start` value that runs {@link SERVER_ENTRY}. */
33
- const START_SCRIPT = `node ${SERVER_ENTRY}`;
34
- /**
35
- * The `scripts.prestart` value, which npm runs before `start`.
36
- *
37
- * {@link SERVER_ENTRY} boots the BUILT worker (`.aai/worker.mjs`), because a
38
- * tool is discovered by the bundler enumerating `tools/` and an un-bundled
39
- * loader would serve an agent with no tools at all — so an entrypoint with no
40
- * build in front of it is not a working project. `--skip-tests` because this
41
- * runs on the way to serving traffic: `npm test` is where a suite belongs, and
42
- * a failing test must not be what stops a container from starting. The
43
- * typecheck stays, since the bundlers strip types unchecked and self-hosting
44
- * has no other gate.
45
- *
46
- * Kept in step with the scaffold's own `package.json`, which the two together
47
- * are the only definition of — `eject.test.ts` asserts they agree.
48
- */
49
- const PRESTART_SCRIPT = "aai build --skip-tests";
50
- /**
51
- * Add `scripts.start` — and the `prestart` that builds what it boots — unless
52
- * the project already declares a `start` of its own.
53
- *
54
- * An existing `start` is left alone even under `--force`: `--force` is about
55
- * replacing the entrypoint file, and silently rewriting the command a project
56
- * boots with is a different, larger act. `prestart` is part of the same act
57
- * rather than a separate one, so it is written only alongside a `start` we
58
- * wrote — bolting a build onto someone else's start command changes what that
59
- * command does, which is precisely what the rule above refuses. The mismatch is
60
- * reported instead, naming both halves, so the choice stays the author's.
61
- */
62
- async function ensureStartScript(cwd) {
63
- const manifestPath = path.join(cwd, "package.json");
64
- const manifest = await readJson(manifestPath);
65
- if (!manifest) {
66
- log.warn(`No package.json here — add "prestart": "${PRESTART_SCRIPT}" and "start": "${START_SCRIPT}" yourself to get \`npm start\`.`);
67
- return false;
68
- }
69
- const existing = manifest.scripts?.start;
70
- if (existing === START_SCRIPT && manifest.scripts?.prestart === "aai build --skip-tests") return false;
71
- if (existing !== void 0 && existing !== START_SCRIPT) {
72
- log.warn(`Kept your existing "start" script (${existing}) — run \`${PRESTART_SCRIPT}\` then \`${START_SCRIPT}\`.`);
73
- return false;
74
- }
75
- manifest.scripts = {
76
- ...manifest.scripts,
77
- prestart: PRESTART_SCRIPT,
78
- start: START_SCRIPT
79
- };
80
- await writeJson(manifestPath, manifest);
81
- return true;
82
- }
83
- /**
84
- * A missing scaffold source means a broken install (or an `AAI_TEMPLATES_DIR`
85
- * pointed somewhere wrong), not anything the user did — so the message names
86
- * the file and where it was looked for.
87
- *
88
- * Built here and thrown by the caller, the shape `build.ts` uses for the same
89
- * reason: `useErrorCause` reads a `throw new Error` inside a `catch` as
90
- * dropping the cause, and cannot see that `CliError` takes its options fourth.
91
- */
92
- function scaffoldMissingError(source, err) {
93
- return new CliError("scaffold_missing", `Could not read the scaffold's ${SERVER_ENTRY} at ${source}: ${errorMessage(err)}`, "Reinstall @alexkroman1/aai-cli.", { cause: err });
94
- }
95
- async function executeEject(opts) {
96
- const { cwd, force } = opts;
97
- const target = path.join(cwd, SERVER_ENTRY);
98
- const overwritten = await fileExists(target);
99
- if (overwritten && !force) throw new CliError("server_exists", `${SERVER_ENTRY} already exists — this project can already be self-hosted.`, `Run \`npm start\`, or re-run with --force to replace it with the current scaffold's copy.`);
100
- const source = path.join(scaffoldDir(), SERVER_ENTRY);
101
- try {
102
- await fs.copyFile(source, target);
103
- } catch (err) {
104
- throw scaffoldMissingError(source, err);
105
- }
106
- const addedScripts = await ensureStartScript(cwd);
107
- log.success(`Wrote ${SERVER_ENTRY}${overwritten ? " (replaced)" : ""}`);
108
- log.info(`Next: npm start — it builds first (\`${PRESTART_SCRIPT}\`), then serves on 127.0.0.1:3000 (PORT and HOST override that)`);
109
- return ok({
110
- file: target,
111
- overwritten,
112
- addedScripts
113
- });
114
- }
115
- //#endregion
116
- export { executeEject };
package/dist/eject.d.ts DELETED
@@ -1,60 +0,0 @@
1
- /**
2
- * `aai eject` — retrofit the self-hosted entrypoint into an existing project.
3
- *
4
- * Every project scaffolded from this CLI version onwards already has
5
- * `server.mjs` and the `prestart`/`start` pair: the scaffold ships them, so
6
- * self-hosting is the default rather than something to opt into. This command
7
- * exists for the projects that predate that — `aai init` before it, or a
8
- * workspace pulled from a studio that was created earlier — where the files
9
- * are simply missing.
10
- *
11
- * It COPIES from the scaffold rather than writing its own contents. Two
12
- * definitions of "the self-hosted entrypoint" would drift, and the one nobody
13
- * runs locally is the one that would rot; this way an ejected project is
14
- * byte-identical to a freshly scaffolded one.
15
- *
16
- * The SCRIPTS are the exception it cannot copy, since a project's package.json
17
- * is its own — so `PRESTART_SCRIPT`/`START_SCRIPT` are written here and pinned
18
- * against the scaffold's manifest by `eject.test.ts`. Both matter: the
19
- * entrypoint boots the BUILT worker, so an ejected project with no `prestart`
20
- * exits at once naming the missing artifact.
21
- */
22
- import { type CommandResult } from "./_output.ts";
23
- /** The file `npm start` runs. Named once — the scaffold ships it under this name. */
24
- export declare const SERVER_ENTRY = "server.mjs";
25
- /** The `scripts.start` value that runs {@link SERVER_ENTRY}. */
26
- export declare const START_SCRIPT = "node server.mjs";
27
- /**
28
- * The `scripts.prestart` value, which npm runs before `start`.
29
- *
30
- * {@link SERVER_ENTRY} boots the BUILT worker (`.aai/worker.mjs`), because a
31
- * tool is discovered by the bundler enumerating `tools/` and an un-bundled
32
- * loader would serve an agent with no tools at all — so an entrypoint with no
33
- * build in front of it is not a working project. `--skip-tests` because this
34
- * runs on the way to serving traffic: `npm test` is where a suite belongs, and
35
- * a failing test must not be what stops a container from starting. The
36
- * typecheck stays, since the bundlers strip types unchecked and self-hosting
37
- * has no other gate.
38
- *
39
- * Kept in step with the scaffold's own `package.json`, which the two together
40
- * are the only definition of — `eject.test.ts` asserts they agree.
41
- */
42
- export declare const PRESTART_SCRIPT = "aai build --skip-tests";
43
- type EjectData = {
44
- /** Absolute path of the entrypoint written. */
45
- file: string;
46
- /** True when an existing `server.mjs` was replaced (`--force`). */
47
- overwritten: boolean;
48
- /**
49
- * True when this run wrote `scripts.prestart`/`scripts.start` into
50
- * package.json. Also true for a project ejected by an older CLI, whose
51
- * `start` is already correct and whose `prestart` is missing — the entrypoint
52
- * this run just wrote needs the build in front of it.
53
- */
54
- addedScripts: boolean;
55
- };
56
- export declare function executeEject(opts: {
57
- cwd: string;
58
- force?: boolean | undefined;
59
- }): Promise<CommandResult<EjectData>>;
60
- export {};
@@ -1,14 +0,0 @@
1
- import { z } from "zod";
2
- import { gameSlot, REPORTED_HISTORY, recordCommand } from "../shared.ts";
3
-
4
- export default gameSlot.updateTool({
5
- description: "Log a player command to the history and increment the move counter.",
6
- inputSchema: z.object({
7
- value: z.string().describe("Command text to log"),
8
- }),
9
- execute(args, game) {
10
- recordCommand(game, args.value);
11
- game.moves++;
12
- return { moves: game.moves, recentHistory: game.history.slice(-REPORTED_HISTORY) };
13
- },
14
- });