@alexkroman1/aai-cli 16.1.0 → 17.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 (183) hide show
  1. package/README.md +2 -1
  2. package/dist/{_build-target-ClEEuUuW.mjs → _build-target-C08aM-Es.mjs} +504 -43
  3. package/dist/_build-target.d.ts +98 -19
  4. package/dist/_deno-target.d.ts +15 -14
  5. package/dist/_dev-env.d.ts +19 -13
  6. package/dist/{_dev-server-D1wKiA0_.mjs → _dev-server-CLU9xjH5.mjs} +25 -17
  7. package/dist/_dev-server.d.ts +4 -3
  8. package/dist/_init.d.ts +39 -0
  9. package/dist/_modal-target.d.ts +11 -6
  10. package/dist/_preflight-CnW9QiE7.mjs +116 -0
  11. package/dist/_preflight.d.ts +110 -5
  12. package/dist/_target-bundle.d.ts +112 -0
  13. package/dist/_target-entry.d.ts +81 -0
  14. package/dist/{_templates-CuP74F8D.mjs → _templates-IMeKMVIj.mjs} +1 -1
  15. package/dist/{_vitest-runner-BiAMIir1.mjs → _vitest-runner-CZNGj0ZC.mjs} +21 -16
  16. package/dist/_vitest-runner.d.ts +35 -23
  17. package/dist/{build-O6BT51x_.mjs → build-DrQTSc2R.mjs} +128 -293
  18. package/dist/build.d.ts +34 -4
  19. package/dist/cli.mjs +20 -16
  20. package/dist/{deploy-lldQyJVj.mjs → deploy-B68-x7xM.mjs} +12 -4
  21. package/dist/deploy.d.ts +9 -0
  22. package/dist/{dev-Du8pCWFq.mjs → dev-ChsrNHpK.mjs} +1 -1
  23. package/dist/dev.d.ts +1 -1
  24. package/dist/{eval-Ducmkt1n.mjs → eval-DB07kTxO.mjs} +1 -1
  25. package/dist/init-W-4k-lCF.mjs +559 -0
  26. package/dist/init.d.ts +43 -3
  27. package/dist/scaffold/CLAUDE.md +51 -64
  28. package/dist/scaffold/package.json +6 -6
  29. package/dist/scaffold/vite.config.ts +29 -1
  30. package/dist/{studio-It7SRfUN.mjs → studio-DEAJGBXa.mjs} +19 -9
  31. package/dist/templates/applicant-screening-agent/agent.eval.test.ts +20 -6
  32. package/dist/templates/applicant-screening-agent/agent.ts +28 -0
  33. package/dist/templates/applicant-screening-agent/shared.ts +11 -11
  34. package/dist/templates/call-audit-workflow/agent.ts +2 -0
  35. package/dist/templates/code-interpreter-agent/agent.eval.test.ts +3 -2
  36. package/dist/templates/code-interpreter-agent/agent.ts +1 -0
  37. package/dist/templates/coding-agent/agent.eval.test.ts +136 -0
  38. package/dist/templates/coding-agent/agent.test.ts +109 -0
  39. package/dist/templates/coding-agent/agent.ts +45 -0
  40. package/dist/templates/coding-agent/chat.ts +63 -0
  41. package/dist/templates/coding-agent/shared.ts +46 -0
  42. package/dist/templates/coding-agent/system-prompt.md +32 -0
  43. package/dist/templates/coding-agent/tools/bash.ts +6 -0
  44. package/dist/templates/coding-agent/tools/delete_file.ts +6 -0
  45. package/dist/templates/coding-agent/tools/edit_file.ts +6 -0
  46. package/dist/templates/coding-agent/tools/glob.ts +6 -0
  47. package/dist/templates/coding-agent/tools/grep.ts +6 -0
  48. package/dist/templates/coding-agent/tools/list_files.ts +6 -0
  49. package/dist/templates/coding-agent/tools/read_file.ts +6 -0
  50. package/dist/templates/coding-agent/tools/todo_write.ts +6 -0
  51. package/dist/templates/coding-agent/tools/write_file.ts +6 -0
  52. package/dist/templates/custom-pipeline-agent/agent.ts +1 -0
  53. package/dist/templates/document-redline-workflow/agent.ts +2 -0
  54. package/dist/templates/emergency-dispatch-agent/agent.test.ts +103 -0
  55. package/dist/templates/emergency-dispatch-agent/agent.ts +15 -0
  56. package/dist/templates/emergency-dispatch-agent/guardrails.ts +105 -0
  57. package/dist/templates/emergency-dispatch-agent/system-prompt.md +1 -0
  58. package/dist/templates/entertainment-picks-agent/agent.eval.test.ts +8 -1
  59. package/dist/templates/entertainment-picks-agent/agent.ts +1 -0
  60. package/dist/templates/entertainment-picks-agent/system-prompt.md +6 -0
  61. package/dist/templates/entertainment-picks-agent/tools/revisit.ts +7 -0
  62. package/dist/templates/executive-inbox-agent/agent.eval.test.ts +84 -23
  63. package/dist/templates/executive-inbox-agent/agent.ts +1 -0
  64. package/dist/templates/executive-inbox-agent/meeting.ts +1 -1
  65. package/dist/templates/executive-inbox-agent/prompts.ts +3 -1
  66. package/dist/templates/executive-inbox-agent/system-prompt.md +3 -3
  67. package/dist/templates/executive-inbox-agent/tools/meeting_assistant.ts +3 -3
  68. package/dist/templates/executive-inbox-agent/tools/open_email.ts +8 -16
  69. package/dist/templates/hotel-reception-agent/agent.eval.test.ts +85 -21
  70. package/dist/templates/hotel-reception-agent/agent.test.ts +2 -1
  71. package/dist/templates/hotel-reception-agent/agent.ts +6 -3
  72. package/dist/templates/hotel-reception-agent/client.tsx +14 -2
  73. package/dist/templates/hotel-reception-agent/concierge.ts +2 -1
  74. package/dist/templates/hotel-reception-agent/desk-seams.test.ts +2 -1
  75. package/dist/templates/hotel-reception-agent/disputes.ts +9 -11
  76. package/dist/templates/hotel-reception-agent/events.ts +2 -1
  77. package/dist/templates/hotel-reception-agent/session.ts +56 -0
  78. package/dist/templates/hotel-reception-agent/shared.ts +20 -21
  79. package/dist/templates/hotel-reception-agent/system-prompt.md +1 -1
  80. package/dist/templates/hotel-reception-agent/tools/abandon_booking.ts +2 -1
  81. package/dist/templates/hotel-reception-agent/tools/add_to_waitlist.ts +2 -1
  82. package/dist/templates/hotel-reception-agent/tools/book_airport_car.ts +2 -1
  83. package/dist/templates/hotel-reception-agent/tools/cancel_restaurant_reservation.ts +2 -1
  84. package/dist/templates/hotel-reception-agent/tools/cancel_room_booking.ts +2 -1
  85. package/dist/templates/hotel-reception-agent/tools/check_restaurant_availability.ts +1 -1
  86. package/dist/templates/hotel-reception-agent/tools/check_room_availability.ts +1 -1
  87. package/dist/templates/hotel-reception-agent/tools/choose_room.ts +1 -1
  88. package/dist/templates/hotel-reception-agent/tools/confirm_booking.ts +2 -1
  89. package/dist/templates/hotel-reception-agent/tools/dispatch_emergency.ts +2 -1
  90. package/dist/templates/hotel-reception-agent/tools/dispute_charge.ts +2 -1
  91. package/dist/templates/hotel-reception-agent/tools/flag_late_arrival.ts +2 -1
  92. package/dist/templates/hotel-reception-agent/tools/lookup_booking.ts +2 -1
  93. package/dist/templates/hotel-reception-agent/tools/lookup_guest_history.ts +1 -1
  94. package/dist/templates/hotel-reception-agent/tools/lookup_invoice.ts +2 -1
  95. package/dist/templates/hotel-reception-agent/tools/lookup_restaurant_reservation.ts +1 -1
  96. package/dist/templates/hotel-reception-agent/tools/modify_restaurant_reservation.ts +1 -1
  97. package/dist/templates/hotel-reception-agent/tools/record_card.ts +1 -1
  98. package/dist/templates/hotel-reception-agent/tools/record_followup.ts +2 -1
  99. package/dist/templates/hotel-reception-agent/tools/record_group_inquiry.ts +2 -1
  100. package/dist/templates/hotel-reception-agent/tools/record_guest_details.ts +1 -1
  101. package/dist/templates/hotel-reception-agent/tools/reinstate_booking.ts +1 -1
  102. package/dist/templates/hotel-reception-agent/tools/request_flight_reconfirmation.ts +2 -1
  103. package/dist/templates/hotel-reception-agent/tools/resend_confirmation.ts +2 -1
  104. package/dist/templates/hotel-reception-agent/tools/reserve_table.ts +1 -1
  105. package/dist/templates/hotel-reception-agent/tools/resolve_room_conflict.ts +2 -1
  106. package/dist/templates/hotel-reception-agent/tools/schedule_wakeup_call.ts +2 -1
  107. package/dist/templates/hotel-reception-agent/tools/set_do_not_disturb.ts +2 -1
  108. package/dist/templates/hotel-reception-agent/tools/set_extras.ts +1 -1
  109. package/dist/templates/hotel-reception-agent/tools/set_stay.ts +2 -1
  110. package/dist/templates/hotel-reception-agent/tools/start_booking_modification.ts +2 -1
  111. package/dist/templates/hotel-reception-agent/tools/start_room_booking.ts +2 -1
  112. package/dist/templates/hotel-reception-agent/tools/take_guest_message.ts +2 -1
  113. package/dist/templates/hotel-reception-agent/tools/transfer_call.ts +2 -1
  114. package/dist/templates/hotel-reception-agent/tools/update_card.ts +2 -1
  115. package/dist/templates/hotel-reception-agent/tools/verify_booking.ts +2 -1
  116. package/dist/templates/link-digest-workflow/agent.eval.test.ts +16 -1
  117. package/dist/templates/link-digest-workflow/agent.ts +5 -0
  118. package/dist/templates/medication-safety-agent/agent.test.ts +54 -0
  119. package/dist/templates/medication-safety-agent/agent.ts +48 -1
  120. package/dist/templates/meeting-recap-agent/agent.test.ts +2 -2
  121. package/dist/templates/meeting-recap-agent/agent.ts +4 -0
  122. package/dist/templates/pizza-ordering-agent/agent.ts +3 -0
  123. package/dist/templates/podcast-digest-workflow/agent.ts +4 -0
  124. package/dist/templates/quickstart-agent/agent.eval.test.ts +39 -3
  125. package/dist/templates/quickstart-agent/agent.test.ts +22 -0
  126. package/dist/templates/quickstart-agent/agent.ts +18 -2
  127. package/dist/templates/quickstart-agent/system-prompt.md +8 -0
  128. package/dist/templates/quickstart-agent/tools/get_weather.ts +59 -0
  129. package/dist/templates/research-handoff-agent/agent.ts +4 -0
  130. package/dist/templates/research-planner-agent/agent.eval.test.ts +24 -2
  131. package/dist/templates/research-planner-agent/agent.ts +3 -0
  132. package/dist/templates/research-planner-agent/system-prompt.md +1 -1
  133. package/dist/templates/retail-orders-agent/agent.ts +32 -3
  134. package/dist/templates/retail-orders-agent/keyterms.ts +154 -0
  135. package/dist/templates/retail-orders-agent/resolve.ts +18 -3
  136. package/dist/templates/roadside-assistance-agent/agent.eval.test.ts +37 -5
  137. package/dist/templates/roadside-assistance-agent/agent.test.ts +38 -6
  138. package/dist/templates/roadside-assistance-agent/agent.ts +4 -0
  139. package/dist/templates/roadside-assistance-agent/shared.ts +12 -0
  140. package/dist/templates/roadside-assistance-agent/tools/acknowledge_disclosure.ts +14 -0
  141. package/dist/templates/roadside-assistance-agent/tools/lookup_coverage.ts +11 -0
  142. package/dist/templates/roadside-assistance-agent/tools/service_disclosure.ts +17 -11
  143. package/dist/templates/roadside-assistance-agent/yard.test.ts +4 -0
  144. package/dist/templates/spoken-summary-workflow/agent.ts +4 -0
  145. package/dist/templates/tabletop-rpg-agent/agent.eval.test.ts +6 -0
  146. package/dist/templates/tabletop-rpg-agent/agent.test.ts +125 -1
  147. package/dist/templates/tabletop-rpg-agent/agent.ts +30 -1
  148. package/dist/templates/tabletop-rpg-agent/shared.ts +81 -0
  149. package/dist/templates/tabletop-rpg-agent/system-prompt.md +1 -1
  150. package/dist/templates/tabletop-rpg-agent/tools/check_state.ts +16 -7
  151. package/dist/templates/technical-support-agent/agent.test.ts +3 -3
  152. package/dist/templates/technical-support-agent/agent.ts +5 -1
  153. package/dist/templates/technical-support-agent/knowledge.ts +165 -0
  154. package/dist/templates/technical-support-agent/nodes.ts +3 -2
  155. package/dist/templates/technical-support-agent/procedure.ts +4 -3
  156. package/dist/templates/technical-support-agent/shared.ts +10 -146
  157. package/dist/templates/technical-support-agent/tools/list_topics.ts +2 -1
  158. package/dist/templates/text-adventure-agent/agent.eval.test.ts +39 -6
  159. package/dist/templates/text-adventure-agent/agent.test.ts +79 -1
  160. package/dist/templates/text-adventure-agent/agent.ts +30 -1
  161. package/dist/templates/text-adventure-agent/shared.ts +37 -0
  162. package/dist/templates/text-adventure-agent/system-prompt.md +9 -2
  163. package/dist/templates/topic-briefing-agent/agent.eval.test.ts +18 -4
  164. package/dist/templates/topic-briefing-agent/agent.test.ts +23 -11
  165. package/dist/templates/topic-briefing-agent/agent.ts +4 -1
  166. package/dist/templates/topic-briefing-agent/shared.ts +10 -10
  167. package/dist/templates/topic-briefing-agent/system-prompt.md +13 -8
  168. package/dist/templates/topic-briefing-agent/tools/send_briefing.ts +43 -5
  169. package/dist/templates/transcription-workflow/agent.ts +3 -0
  170. package/dist/templates/travel-concierge-agent/agent.ts +4 -0
  171. package/dist/templates/web-research-agent/agent.eval.test.ts +31 -5
  172. package/dist/templates/web-research-agent/agent.test.ts +16 -0
  173. package/dist/templates/web-research-agent/agent.ts +30 -0
  174. package/dist/templates/web-research-agent/system-prompt.md +8 -2
  175. package/dist/templates/word-game-agent/agent.eval.test.ts +79 -18
  176. package/dist/templates/word-game-agent/agent.ts +20 -0
  177. package/dist/test-CjKPQ9_B.mjs +102 -0
  178. package/dist/test.d.ts +37 -12
  179. package/package.json +5 -5
  180. package/dist/_init-Bp1CjRrU.mjs +0 -199
  181. package/dist/_preflight-CcAR577V.mjs +0 -46
  182. package/dist/init-CY4NAXAA.mjs +0 -183
  183. package/dist/test-PHHv0Vj6.mjs +0 -83
@@ -28,9 +28,20 @@
28
28
  * the only thing that tells a live model that "grab the rope" means
29
29
  * `game_state_take` — an eval run against the framework default prompt measures
30
30
  * an agent nobody deployed.
31
+ *
32
+ * The prompt is a RESOLVER (see `agent.ts`), so what a live run puts in front
33
+ * of the narrator is the file plus the board as it stands on that turn. That is
34
+ * what the state assertions below are really riding on: the narrator is never
35
+ * asked to remember an inventory, so a wrong answer is a game bug rather than a
36
+ * model lapse.
31
37
  */
32
38
  import agentDef from "virtual:aai/agent";
33
- import { type EvalTurn, toolResultIn } from "@alexkroman1/aai-runtime/eval";
39
+ import {
40
+ type EvalTurn,
41
+ lastToolResultIn,
42
+ toolCallsInTurns,
43
+ toolResultIn,
44
+ } from "@alexkroman1/aai-runtime/eval";
34
45
  import { describeEval } from "@alexkroman1/aai-runtime/eval/vitest";
35
46
  import { expect } from "vitest";
36
47
  import { z } from "zod";
@@ -135,10 +146,24 @@ describeEval(agentDef, (test) => {
135
146
  test(
136
147
  "the rank the score earned is still the player's rank a turn later",
137
148
  async ({ session }) => {
138
- const scored = await session.say(
139
- "I set the golden chalice down on the stone pedestal. That must be worth something.",
140
- );
141
- const earned = answerOf(scored, "game_state_score", Scored);
149
+ // The chalice has to be IN HAND first. The prompt's scoring rule is that a
150
+ // treasure CARRIED BACK to the pedestal earns points, and
151
+ // `game_state_drop` refuses an item the player is not holding — so asked
152
+ // cold, "I set the chalice down" is a drop, which is what a live model
153
+ // reached for twice (`game_state_drop`, then no tool at all) while this
154
+ // case blamed the score tool.
155
+ const turns = await session.sayAll([
156
+ "I pick up the golden chalice.",
157
+ "I carry the chalice back to the Cave Mouth.",
158
+ "I set the chalice on the stone pedestal. Award me the points for returning it.",
159
+ ]);
160
+ // `lastToolResultIn` rather than `answerOf`, which is `toolResultIn` and
161
+ // refuses a scope holding two calls. Across three turns the narrator may
162
+ // well award twice — settling the return on the carry and again on the
163
+ // request — and the SETTLED total is the one the player was told. Reading
164
+ // one turn instead was the workaround, and it made this case depend on
165
+ // which turn the narrator chose to score on.
166
+ const earned = lastToolResultIn(toolCallsInTurns(turns), "game_state_score", Scored);
142
167
  // Whatever the model awarded — a live run picks its own number — the rank
143
168
  // that came back is the one the ladder says that score earns. The tool
144
169
  // computes it from `rankFor` because the slot's `after` hook has not run
@@ -148,12 +173,20 @@ describeEval(agentDef, (test) => {
148
173
 
149
174
  // And the SECOND turn is the only place the hook's write can be seen: the
150
175
  // field nothing assigns is read back off a later turn's state.
151
- const later = answerOf(await session.say("What is my score?"), "game_state_get", Status);
176
+ // "Check the game state", not "What is my score?" — the score is in the
177
+ // prompt now (see `statusBlock`), so a live narrator answers that one
178
+ // without a tool call, and this case is about the WRITE surviving the
179
+ // turn rather than about which question forces a read.
180
+ const later = answerOf(await session.say("Check the game state."), "game_state_get", Status);
152
181
  expect(later.score).toBe(earned.score);
153
182
  expect(later.rank).toBe(earned.rank);
154
183
  },
155
184
  {
156
185
  stubReply: [
186
+ { tool: "game_state_take", args: { value: "golden chalice" } },
187
+ "The golden chalice is cool and heavier than it looks.",
188
+ { tool: "game_state_move", args: { value: "Cave Mouth" } },
189
+ "You retrace your steps to the cave mouth, chalice in hand.",
157
190
  { tool: "game_state_score", args: { value: 30 } },
158
191
  "The chalice settles onto the pedestal with a satisfying weight.",
159
192
  { tool: "game_state_get" },
@@ -1,6 +1,11 @@
1
1
  /** The def a DEPLOYED agent runs: authored, plus what `tools/` declares. */
2
2
  import agentDef from "virtual:aai/agent";
3
- import { createSeededRandom, type RandomSource, type SessionEventContext } from "@alexkroman1/aai";
3
+ import {
4
+ type AgentSessionContext,
5
+ createSeededRandom,
6
+ type RandomSource,
7
+ type SessionEventContext,
8
+ } from "@alexkroman1/aai";
4
9
  import { createToolContext, parseToolInput, toolOf, toolRunner } from "@alexkroman1/aai/testing";
5
10
  import { isToolFailure } from "@alexkroman1/aai/utils";
6
11
  import { describe, expect, test } from "vitest";
@@ -13,6 +18,7 @@ import {
13
18
  REPORTED_HISTORY,
14
19
  rankFor,
15
20
  SCAVENGER_FLAG,
21
+ statusBlock,
16
22
  statusLine,
17
23
  } from "./shared.ts";
18
24
 
@@ -373,3 +379,75 @@ describe("the game is per context", () => {
373
379
  expect(DEFAULT_GAME_STATE.inventory).toEqual([]);
374
380
  });
375
381
  });
382
+
383
+ // ─── The prompt carries the board ────────────────────────────────────────────
384
+ //
385
+ // `systemPrompt` is a RESOLVER here, not a string: `system-prompt.md` supplies
386
+ // the world and the voice rules, and `statusBlock` appends the live board to
387
+ // them before every model request. What that replaced was six lines of prompt
388
+ // ordering the narrator to call `game_state_get` before answering any question
389
+ // about where the player is or what they hold — advice, enforced by nothing,
390
+ // and a model round trip on every turn it was obeyed on.
391
+
392
+ describe("the prompt the narrator is actually given", () => {
393
+ /** The def's resolver, which is what a request assembles the instructions from. */
394
+ const resolve = (ctx: AgentSessionContext): string => {
395
+ const prompt = agentDef.systemPrompt;
396
+ if (typeof prompt !== "function") throw new Error("systemPrompt is not a resolver");
397
+ return prompt(ctx);
398
+ };
399
+
400
+ test("it is a resolver, and the file's prose survives into it", () => {
401
+ // The build discovers `system-prompt.md` and hands it to `withSystemPrompt`,
402
+ // which leaves a resolver exactly as written — so the file has to reach the
403
+ // model through the resolver's own import, and this is what proves it does.
404
+ expect(typeof agentDef.systemPrompt).toBe("function");
405
+ expect(resolve(createToolContext())).toContain("CAVERN ADVENTURE");
406
+ });
407
+
408
+ test("a fresh session is told the opening board, before any tool has run", () => {
409
+ const opening = resolve(createToolContext());
410
+ expect(opening).toContain(`- Location: ${DEFAULT_GAME_STATE.currentRoom}`);
411
+ expect(opening).toContain("- Score: 0 (Beginner)");
412
+ expect(opening).toContain("- Turns taken: 0");
413
+ expect(opening).toContain("- Carrying: nothing");
414
+ });
415
+
416
+ test("every mutation is in the NEXT request's prompt, with no tool call in between", async () => {
417
+ const ctx = createToolContext();
418
+ await run("game_state_take", { value: "lantern" }, ctx);
419
+ await run("game_state_move", { value: "Echoing Hall" }, ctx);
420
+ await run("game_state_score", { value: 30 }, ctx);
421
+ say("go down to the hall", ctx);
422
+
423
+ const now = resolve(ctx);
424
+ expect(now).toContain("- Location: Echoing Hall");
425
+ expect(now).toContain("- Score: 30 (Amateur Adventurer)");
426
+ expect(now).toContain("- Turns taken: 1");
427
+ expect(now).toContain("- Carrying: lantern");
428
+ });
429
+
430
+ test("the block is built from the same status line the CRT and the read tool get", async () => {
431
+ const ctx = createToolContext();
432
+ await run("game_state_move", { value: "Crystal Grotto" }, ctx);
433
+ await run("game_state_score", { value: 60 }, ctx);
434
+
435
+ // One helper, three readers: `syncState`, `game_state_get`, and the prompt.
436
+ // A fourth rendering of these four numbers is a fourth thing to drift.
437
+ expect(resolve(ctx).endsWith(statusBlock(gameSlot.get(ctx)))).toBe(true);
438
+ const bar = statusLine(gameSlot.get(ctx));
439
+ expect(resolve(ctx)).toContain(`- Score: ${bar.score} (${bar.rank})`);
440
+ });
441
+
442
+ test("each session is told its OWN board", async () => {
443
+ // The resolver reads through `ctx.slots`, so it is per session for the same
444
+ // reason every tool is — a resolver that closed over a module-level game
445
+ // would put one player's inventory in another player's prompt.
446
+ const one = createToolContext();
447
+ const two = createToolContext();
448
+ await run("game_state_take", { value: "jade idol" }, one);
449
+
450
+ expect(resolve(one)).toContain("- Carrying: jade idol");
451
+ expect(resolve(two)).toContain("- Carrying: nothing");
452
+ });
453
+ });
@@ -1,8 +1,16 @@
1
1
  import { agent } from "@alexkroman1/aai";
2
- import { gameStatus, recordTurn } from "./shared.ts";
2
+ import { gameSlot, gameStatus, recordTurn, statusBlock } from "./shared.ts";
3
+ // The prose half of the prompt. `system-prompt.md` beside this file is
4
+ // discovered by the build either way — importing it is what lets the resolver
5
+ // below compose against it, and `withSystemPrompt` then leaves the resolver
6
+ // exactly as written.
7
+ import prompt from "./system-prompt.md?raw";
3
8
 
4
9
  export default agent({
5
10
  name: "Cavern Adventure",
11
+ // The listing line — a registry row, `aai list`, the studio's picker. Never
12
+ // the model: the world and the voice rules are `system-prompt.md`'s.
13
+ description: "Runs a spoken text adventure through an underground cave system",
6
14
  // The world exists before the first command, so a resumed connection has
7
15
  // something to project rather than an empty state object.
8
16
  // A narrator wants a narrative voice; everything else stays on the
@@ -20,6 +28,27 @@ export default agent({
20
28
  * one the narrator was told. `syncState` sends the game's own.
21
29
  */
22
30
  syncState: gameStatus,
31
+ /**
32
+ * The world's rules, plus the board as it stands RIGHT NOW.
33
+ *
34
+ * A `systemPrompt` resolver is called once per model request, so the four
35
+ * facts of the status line and the player's inventory are in front of the
36
+ * narrator on every turn — which is what makes drift impossible rather than
37
+ * discouraged. The prompt used to carry a section demanding a
38
+ * `game_state_get` call before answering any question about the board, and
39
+ * "never from memory": advice that cost a round trip when it was obeyed and a
40
+ * desynced world when it was not. Four scalars and a list are cheaper to
41
+ * state than to ask for.
42
+ *
43
+ * `ctx` is an `AgentSessionContext` — the session id, the env and the slots,
44
+ * which is everything `gameSlot.get` needs and deliberately nothing that
45
+ * could speak. Synchronous by contract: the request is being assembled.
46
+ *
47
+ * `game_state_get` is NOT retired by this. It answers with the flags and the
48
+ * recent commands too, and it is still the tool for "check the game state".
49
+ * What went is the compulsory read-back.
50
+ */
51
+ systemPrompt: (ctx) => `${prompt}\n\n${statusBlock(gameSlot.get(ctx))}`,
23
52
  // The opening scene here must agree with DEFAULT_GAME_STATE.currentRoom
24
53
  // (shared.ts) and the world map in system-prompt.md.
25
54
  greeting:
@@ -146,6 +146,43 @@ export function statusLine(game: FrozenGameState): StatusLine {
146
146
  };
147
147
  }
148
148
 
149
+ /**
150
+ * The board as the NARRATOR is given it, before every reply.
151
+ *
152
+ * `agent.ts` appends this to the system prompt through a `systemPrompt`
153
+ * resolver, so the four facts of the status line plus the inventory are in
154
+ * front of the model on every request — never remembered, never guessed, and
155
+ * never a turn behind.
156
+ *
157
+ * **This is what retired a whole section of `system-prompt.md`.** The prompt
158
+ * used to spend six lines insisting that ANY question about what the player is
159
+ * carrying, where they are or what they have scored be answered by calling
160
+ * `game_state_get` FIRST and never from memory — advice, enforced by nothing,
161
+ * costing a model round trip on the turns the narrator remembered and a drifting
162
+ * world on the turns it did not. State the model must not invent belongs in the
163
+ * prompt, not in a rule telling it to go and look.
164
+ *
165
+ * Prose rather than the JSON `game_state_get` answers with, because this is
166
+ * read as instructions rather than as a tool result — and built from
167
+ * {@link statusLine}, so the narrator, the CRT's top bar and the read tool
168
+ * cannot disagree about the four numbers. `game_state_get` stays for the rest of
169
+ * the board (the flags and the recent commands) and for the turn the narrator
170
+ * wants everything at once.
171
+ */
172
+ export function statusBlock(game: FrozenGameState): string {
173
+ const { currentRoom, score, rank, moves } = statusLine(game);
174
+ const carrying = game.inventory.length > 0 ? game.inventory.join(", ") : "nothing";
175
+ return [
176
+ "CURRENT GAME STATE (the game's own record, refreshed before every reply —",
177
+ "it is ground truth and it is never out of date, so answer from it rather",
178
+ "than from memory, and never contradict it):",
179
+ `- Location: ${currentRoom}`,
180
+ `- Score: ${score} (${rank})`,
181
+ `- Turns taken: ${moves}`,
182
+ `- Carrying: ${carrying}`,
183
+ ].join("\n");
184
+ }
185
+
149
186
  /**
150
187
  * The projection BOTH ends use: `syncState` on the agent, `useAgentState` in
151
188
  * the client.
@@ -29,11 +29,18 @@ COMMAND INTERPRETATION:
29
29
  - "what do I have" / "check my stuff" / "inventory" = inventory
30
30
  - "where am I" / "look around" / "describe the room" = look
31
31
  - "hit the troll" / "fight the troll" / "attack troll" = attack troll with pick
32
- - "what's my score" = score
32
+ - "what's my score" / "how am I doing" = answer from the CURRENT GAME STATE block, never game_state_score — that one AWARDS points
33
+ - "check the game state" / "full status" = game_state_get, which adds the game
34
+ flags and the last few commands to what you already have
33
35
  - "start over" / "new game" / "restart" = restart
34
36
  - Accept natural conversational commands and map them to game actions
37
+ - EARNING points is not a question and is never game_state_get. A treasure
38
+ carried back to the pedestal is game_state_score, which adds them; reach for
39
+ it whenever the player has just done something the score should move for
35
40
 
36
- Use the game state tools to track inventory, location, score, and flags. Use game_state_get to read the current state, game_state_move to change rooms, game_state_take to pick up items, game_state_drop to drop items — it refuses an item the player is not carrying, and answers whether the scavenger made off with the one they dropped — game_state_score to add points, which answers with the new total and the player's rank, and game_state_flag to set game flags. You do not log commands or count moves — the game does that for you on every turn. When the player asks to restart, quit, or start a new game, call game_state_restart, then narrate the opening scene again. Always update state when the player takes an item, moves rooms, or triggers an event. Check state before responding to ensure consistency.
41
+ The CURRENT GAME STATE block at the end of these instructions is the game's own record, refreshed before every reply: where the player is, their score and rank, the turn count, and what they are carrying. It is never out of date. Answer from it, never say anything that contradicts it, and never spend a turn asking a tool for what it already tells you.
42
+
43
+ The tools are how you CHANGE the world: game_state_move to change rooms, game_state_take to pick up items, game_state_drop to drop items — it refuses an item the player is not carrying, and answers whether the scavenger made off with the one they dropped — game_state_score to add points, which answers with the new total and the player's rank, and game_state_flag to set game flags. Always call one when the player takes an item, moves rooms, or triggers an event. game_state_get is the one read left, and it is for the rest of the board — the game flags and the last few commands. You do not log commands or count moves — the game does that for you on every turn. When the player asks to restart, quit, or start a new game, call game_state_restart, then narrate the opening scene again.
37
44
 
38
45
  ATMOSPHERE:
39
46
  - Underground areas should feel dark and foreboding with the lantern lit, and terrifying in pitch blackness
@@ -86,11 +86,14 @@ const EmptyRecap = z.object({
86
86
 
87
87
  /** What `verify_claim` answers with. */
88
88
  // `verdict` is the parsed WORD now, so the eval can pin the enum rather than
89
- // asserting a sentence is non-empty. `null` is the unaccepted case.
89
+ // asserting a sentence is non-empty. `null` is the unaccepted case, and it
90
+ // arrives WITH `unusable` — the tool's own name for a checker that never
91
+ // returned its schema.
90
92
  const Verdict = z.object({
91
93
  claim: z.string(),
92
94
  verdict: z.enum(["confirmed", "contradicted", "unclear"]).nullable(),
93
95
  detail: z.string(),
96
+ unusable: z.string().optional(),
94
97
  });
95
98
 
96
99
  describeEval(agentDef, (test) => {
@@ -174,9 +177,20 @@ describeEval(agentDef, (test) => {
174
177
  expect(calls, describeTurn(turn)).toHaveLength(1);
175
178
  const verdict = toolResultIn(turn.toolCalls, "verify_claim", Verdict);
176
179
  expect(countWords(verdict.claim)).toBeGreaterThan(3);
177
- // A word the desk can act on, not a sentence it must read one out of.
178
- expect(verdict.verdict).not.toBeNull();
179
- expect(countWords(verdict.detail)).toBeGreaterThan(2);
180
+ // A word the desk can act on, not a sentence it must read one out of —
181
+ // or the honest unresolved path, which is the SAME contract seen from the
182
+ // other side. `factChecker` is a cheap model on `maxSteps: 2`, so a run
183
+ // that spends both steps searching returns no schema and the tool reports
184
+ // `unusable` rather than a verdict — which its own body argues is "not a
185
+ // failure". Demanding a verdict every time made this case a coin toss on
186
+ // that budget instead of a reading of whether the desk CHECKED rather
187
+ // than defended, which is what its name claims and what the `toHaveLength`
188
+ // above actually measures.
189
+ if (verdict.verdict === null) {
190
+ expect(verdict.unusable, describeTurn(turn)).toBeDefined();
191
+ } else {
192
+ expect(countWords(verdict.detail)).toBeGreaterThan(2);
193
+ }
180
194
  expect(toolNames(turn.toolCalls).filter((name) => !DESK_TOOLS.includes(name))).toEqual([]);
181
195
  },
182
196
  { live: true },
@@ -5,6 +5,7 @@ import {
5
5
  type StubDelegateCall,
6
6
  scriptedToolContext,
7
7
  stubDelegate,
8
+ toolOf,
8
9
  toolRunner,
9
10
  } from "@alexkroman1/aai/testing";
10
11
  import { installStubStepFetch } from "@alexkroman1/aai/testing/vitest";
@@ -88,12 +89,12 @@ describe("the desk itself", () => {
88
89
  expect(factChecker.maxSteps).toBeLessThan(MAX_RESEARCH_STEPS);
89
90
  });
90
91
 
91
- test("runs the three NARROW specialists somewhere cheaper, and the researcher on the default", () => {
92
+ test("runs the three NARROW subagents somewhere cheaper, and the researcher on the default", () => {
92
93
  // The other half of the budget split, and the reason `CHEAP_MODEL` is one
93
- // constant: three specialists that were each meant to be cheap, one of
94
+ // constant: three subagents that were each meant to be cheap, one of
94
95
  // which quietly is not, is a bill nobody can read.
95
- for (const specialist of [factChecker, explainer, counterpoint]) {
96
- expect(specialist.llm, specialist.name).toMatchObject({ options: { model: CHEAP_MODEL } });
96
+ for (const one of [factChecker, explainer, counterpoint]) {
97
+ expect(one.llm, one.name).toMatchObject({ options: { model: CHEAP_MODEL } });
97
98
  }
98
99
  // The researcher reads whole pages and stays on the agent's own model.
99
100
  expect(researcher.llm).toBeUndefined();
@@ -104,25 +105,25 @@ describe("the desk itself", () => {
104
105
  // rather than a paragraph somebody remembered to write: the desk reads the
105
106
  // final message and nothing else. A subagent added here without one is the
106
107
  // regression this catches.
107
- for (const specialist of [researcher, factChecker, explainer, counterpoint]) {
108
- expect(specialist.expectedOutput, specialist.name).toBeTruthy();
108
+ for (const one of [researcher, factChecker, explainer, counterpoint]) {
109
+ expect(one.expectedOutput, one.name).toBeTruthy();
109
110
  }
110
111
  expect(researcher.expectedOutput).toMatch(/only this/);
111
112
  });
112
113
 
113
- test("puts on the roster exactly the specialists chosen by what the caller ASKED", () => {
114
+ test("puts on the roster exactly the subagents chosen by what the caller ASKED", () => {
114
115
  // The two tools name their own subagent, so those two must NOT be on the
115
- // roster: a specialist reachable both ways gives the model a second, worse
116
+ // roster: a subagent reachable both ways gives the model a second, worse
116
117
  // route to a tool that does real work around the delegation.
117
118
  expect(authoredAgent.subagents?.map((one) => one.name)).toEqual(["explainer", "counterpoint"]);
118
- for (const specialist of authoredAgent.subagents ?? []) {
119
+ for (const one of authoredAgent.subagents ?? []) {
119
120
  // The only thing the router reads. `agent()` refuses a roster without it;
120
121
  // asserted here too because the template is what an author copies.
121
- expect(specialist.description, specialist.name).toBeTruthy();
122
+ expect(one.description, one.name).toBeTruthy();
122
123
  }
123
124
  });
124
125
 
125
- test("publishes the roster as one delegate tool listing both specialists", () => {
126
+ test("publishes the roster as one delegate tool listing both subagents", () => {
126
127
  const delegate = deployed.tools[DELEGATE_TOOL_NAME];
127
128
  expect(delegate).toBeDefined();
128
129
  expect(delegate?.description).toContain("explainer:");
@@ -622,6 +623,17 @@ describe("send_briefing", () => {
622
623
  expect(posted.calls).toEqual([]);
623
624
  });
624
625
 
626
+ test("declares onError, so a missing webhook is FATAL rather than something to retry", () => {
627
+ // Without it the runtime hands every throw to the model as this call's
628
+ // result, and the desk re-calls `send_briefing` against a variable that is
629
+ // still unset — burning the reply's step budget on a deploy fault. The
630
+ // handler re-throws, which is how a tool says "stop, this cannot work".
631
+ const sender = toolOf(deployed, "send_briefing");
632
+ expect(sender.onError).toBeDefined();
633
+ const cause = new Error(`Missing required environment variable: ${DESTINATION_ENV}`);
634
+ expect(() => sender.onError?.(cause, createToolContext())).toThrow(cause);
635
+ });
636
+
625
637
  test("refuses a configured destination that is not Slack, without posting", async () => {
626
638
  const posted = installStubStepFetch(() => ({ body: "ok" }));
627
639
  const ctx = deskWithBoard({ [DESTINATION_ENV]: "https://example.test/collect" });
@@ -26,7 +26,7 @@ import { roster } from "./shared.ts";
26
26
  * is for the case where the choice is the caller's — "what does curtailment
27
27
  * mean" wants the explainer and "who says otherwise" wants the counterpoint,
28
28
  * and nothing but the question tells them apart. It reaches the model as one
29
- * `delegate` tool listing both, so a third specialist is a line here rather
29
+ * `delegate` tool listing both, so a third subagent is a line here rather
30
30
  * than a fourth file in `tools/` whose body is one `ctx.delegate` call.
31
31
  *
32
32
  * Compare `web-research-agent`, which gives the search builtins to the agent
@@ -35,6 +35,9 @@ import { roster } from "./shared.ts";
35
35
  */
36
36
  export default agent({
37
37
  name: "Briefing Desk",
38
+ // The listing line — a registry row, the studio's picker. "At once" is the
39
+ // part worth a reader's attention: it is what the subagents below buy.
40
+ description: "Researches a subject from several angles at once and reads back what was found",
38
41
  greeting:
39
42
  "Briefing desk. Tell me a subject and I'll put a few researchers on it — " +
40
43
  "try something like, what's going on with home battery prices.",
@@ -27,9 +27,9 @@
27
27
  * a roster can express.
28
28
  * - `explainer` and `counterpoint` are on the ROSTER (`agent({ subagents })`),
29
29
  * because choosing between them IS reading what the caller asked: "what does
30
- * curtailment mean" and "who says otherwise" want different specialists and
30
+ * curtailment mean" and "who says otherwise" want different subagents and
31
31
  * nothing else about them differs. They reach the model as one `delegate`
32
- * tool whose `coworker` argument is the two names, described by their own
32
+ * tool whose `subagent` argument is the two names, described by their own
33
33
  * {@link SubagentDef.description}s.
34
34
  *
35
35
  * The rule that follows: **name a subagent in code when the tool IS the choice;
@@ -56,18 +56,18 @@ import { type AssemblyAIGatewayModel, assemblyAILlm } from "@alexkroman1/aai/llm
56
56
  import { z } from "zod";
57
57
 
58
58
  /**
59
- * The model the three NARROW specialists share.
59
+ * The model the three NARROW subagents share.
60
60
  *
61
61
  * Named once because it is a fact about the DESK — checking one sentence,
62
62
  * defining one word and finding one objection are not the job `researcher`
63
63
  * does, so all three run somewhere cheaper — and each subagent still declares
64
- * its own `llm`, because which model a specialist runs on is part of what
65
- * declaring a specialist means.
64
+ * its own `llm`, because which model a subagent runs on is part of what
65
+ * declaring a subagent means.
66
66
  *
67
67
  * Annotated as {@link AssemblyAIGatewayModel} rather than left as three string
68
68
  * literals: `AssemblyAILlmOptions.model` widens to `string` so the gateway
69
69
  * accepts a name it has never heard of, and a typo in one of three copies is a
70
- * refusal from ONE specialist while the other two answer — the hardest shape of
70
+ * refusal from ONE subagent while the other two answer — the hardest shape of
71
71
  * failure to notice on a live call. Here it is a compile error.
72
72
  */
73
73
  export const CHEAP_MODEL: AssemblyAIGatewayModel = "gemini-2.5-flash-lite";
@@ -171,7 +171,7 @@ export const factChecker: TypedSubagentDef<Verdict> = subagent({
171
171
  });
172
172
 
173
173
  /**
174
- * The ROSTER's first specialist: what a word means.
174
+ * The ROSTER's first subagent: what a word means.
175
175
  *
176
176
  * No tools at all, which is legal and is the point — a definition is a
177
177
  * reasoning pass, and giving this one a search would let it wander off into
@@ -203,7 +203,7 @@ export const explainer = subagent({
203
203
  * Searches, like the fact-checker, and is told to do a different job with the
204
204
  * results — which is exactly the case a roster is for. Nothing about
205
205
  * `counterpoint` differs from `explainer` except what the caller wanted, so a
206
- * tool file per specialist would be two bodies differing in one identifier.
206
+ * tool file per subagent would be two bodies differing in one identifier.
207
207
  */
208
208
  export const counterpoint = subagent({
209
209
  name: "counterpoint",
@@ -223,13 +223,13 @@ export const counterpoint = subagent({
223
223
  });
224
224
 
225
225
  /**
226
- * The roster `agent({ subagents })` publishes — the specialists the MODEL picks
226
+ * The roster `agent({ subagents })` publishes — the subagents the MODEL picks
227
227
  * between.
228
228
  *
229
229
  * Declared here rather than inline in `agent.ts` so that membership sits beside
230
230
  * the definitions, which is where the question "should this one be routable?"
231
231
  * gets answered. `researcher` and `factChecker` are deliberately absent: each is
232
- * reached by a tool that does real work around the delegation, and a specialist
232
+ * reached by a tool that does real work around the delegation, and a subagent
233
233
  * reachable both ways gives the model a second, worse route to it.
234
234
  */
235
235
  export const roster: SubagentRoster = [explainer, counterpoint];
@@ -5,7 +5,7 @@ and you have a small team of researchers you can put on it.
5
5
 
6
6
  - You have no way to look anything up yourself. Everything you know about the
7
7
  outside world comes back from `research_topic`, `verify_claim` or `delegate`.
8
- - `delegate` hands one question to a specialist: the explainer for "what does
8
+ - `delegate` hands one question to a subagent: the explainer for "what does
9
9
  that word mean", the counterpoint for "who says otherwise". Use it for a
10
10
  question that stands on its own — a subject worth several angles is
11
11
  `research_topic`, and a fact to check is `verify_claim`.
@@ -16,13 +16,16 @@ and you have a small team of researchers you can put on it.
16
16
  - Each angle must stand on its own. A researcher has not heard this call and
17
17
  cannot see the others' work, so "the same but for Europe" is not an angle;
18
18
  "how European home battery prices moved in 2025" is.
19
- - Say you are looking it up BEFORE you call the tool. A silent line is the
20
- worst thing that can happen on a phone call, and a briefing takes a moment.
19
+ - Call the tool BEFORE you say anything about it. Speaking ends your turn, so
20
+ "let me look that up" with no result behind it is a promise you never keep —
21
+ the caller hears it, the researchers never run, and the next thing they say
22
+ has to prompt you all over again. Report what came back, never what you are
23
+ about to do.
21
24
  - `send_briefing` posts what is on the board to the team's channel. Offer it
22
25
  when the caller wants the briefing in writing or wants it passed on to
23
- someone who was not on the call, and say you are sending it before you call
24
- it. If it comes back refusing, say plainly that it has not sent — never let
25
- them hang up believing it did.
26
+ someone who was not on the call, and call it before you say it has gone. If
27
+ it comes back refusing, say plainly that it has not sent — never let them
28
+ hang up believing it did.
26
29
 
27
30
  ## How you talk
28
31
 
@@ -37,8 +40,10 @@ and you have a small team of researchers you can put on it.
37
40
  - If the caller pushes back on a fact, check it with `verify_claim` rather than
38
41
  defending it. If it comes back contradicted, correct yourself plainly. If it
39
42
  comes back `unusable`, say it is unresolved — do not round it up to confirmed.
40
- - `briefing_so_far` is for a recap. It costs nothing, so use it rather than
41
- reciting from memory.
43
+ - `briefing_so_far` is for a recap. It costs nothing, so ALWAYS call it when
44
+ the caller asks what you have — including when you believe the board is
45
+ empty. Reciting "nothing yet" from memory is the same mistake as reciting a
46
+ finding from memory: the board is the record, not your recollection of it.
42
47
 
43
48
  ## What not to do
44
49
 
@@ -1,9 +1,28 @@
1
- import { errorMessage, isToolFailure, requireEnv, toolFailure } from "@alexkroman1/aai";
1
+ import {
2
+ errorMessage,
3
+ isToolFailure,
4
+ requireEnv,
5
+ type ToolErrorHandler,
6
+ toolFailure,
7
+ } from "@alexkroman1/aai";
2
8
  import { ChannelDeliveryError, sendToChannel } from "@alexkroman1/aai/channels";
3
9
  import { z } from "zod";
4
10
  import { briefingSlot } from "../shared.ts";
5
11
  import { briefingChannel, briefingMessage, DESTINATION_ENV } from "../slack.ts";
6
12
 
13
+ /**
14
+ * Anything that reaches here is a deploy nobody finished or a bug in this file
15
+ * — see the note on the tool below — and neither is fixed by asking the model
16
+ * to try again, so it goes back up as a fatal failure.
17
+ *
18
+ * Named, with its type spelled, because the type is what says what the two
19
+ * outcomes are: RETURN a `ToolFailure` (or a string) and the model reads it and
20
+ * carries on; THROW and the call ends without an answer.
21
+ */
22
+ const unfinishedDeployIsFatal: ToolErrorHandler = (err) => {
23
+ throw err;
24
+ };
25
+
7
26
  /**
8
27
  * Post the board to the desk's Slack channel, so the briefing outlives the
9
28
  * call.
@@ -24,10 +43,24 @@ import { briefingChannel, briefingMessage, DESTINATION_ENV } from "../slack.ts";
24
43
  * the one deliberate throw in this template. A missing key is not a refusal the
25
44
  * desk can talk its way around and not something the caller did — it is a
26
45
  * deploy nobody finished — so the SDK's own message names the variable and how
27
- * to set it, and the runtime hands that to the model rather than letting the
28
- * first property access surface as a `TypeError` the caller hears as an
29
- * unexplained apology. Everything a call CAN recover from is a `ToolFailure`
30
- * below.
46
+ * to set it. Everything a call CAN recover from is a `ToolFailure` below.
47
+ *
48
+ * **And `onError` is what makes that throw mean something.** Without it the
49
+ * runtime hands every exception to the model as this call's result, so a
50
+ * webhook nobody configured reads as an ordinary hiccup: the desk apologises,
51
+ * calls `send_briefing` again, gets the same sentence, and spends the reply's
52
+ * whole `maxSteps` budget on a variable that will still be unset on the next
53
+ * attempt. Re-throwing declares the failure FATAL — the call rejects, the model
54
+ * is handed nothing to retry against, and the runtime reports it as a `tool`
55
+ * session error where whoever deployed this can see it.
56
+ *
57
+ * **Blanket, and only because of the shape of this body.** Every failure the
58
+ * desk can talk about is RETURNED above and below — the empty board, a
59
+ * destination that is not Slack, both halves of a `ChannelDeliveryError` — so
60
+ * anything that reaches `onError` here is a deploy that is not finished or a
61
+ * bug in this file, and neither is fixed by asking the model to try again. A
62
+ * tool whose body can throw for a transient reason should classify instead:
63
+ * return a `ToolFailure` for the recoverable throws and re-throw only the rest.
31
64
  */
32
65
  export default briefingSlot.tool({
33
66
  description:
@@ -74,4 +107,9 @@ export default briefingSlot.tool({
74
107
  "the briefing back out — they have it in writing now.",
75
108
  };
76
109
  },
110
+ // See the note above: the only throw this body has is `requireEnv`'s, and a
111
+ // missing webhook is unfixable from inside the call. Re-throwing keeps the
112
+ // SDK's own message — which names the variable and how to set it — as the
113
+ // fatal error's `cause`.
114
+ onError: unfinishedDeployIsFatal,
77
115
  });
@@ -178,6 +178,9 @@ export const transcribeBatch = workflow({
178
178
 
179
179
  export default workflowApp({
180
180
  name: "Transcription Desk",
181
+ // The listing line. It names all THREE routes because choosing between them
182
+ // is the product.
183
+ description: "Transcribes a recording three ways: chunked, streaming while it uploads, or batch",
181
184
  workflows: { transcribe, transcribeStream, transcribeBatch },
182
185
  // Checked at deploy time, so a missing key is a warning naming it rather than
183
186
  // a run that fails on its second step.
@@ -29,6 +29,10 @@ import { gateFlow, tripProjection } from "./shared.ts";
29
29
  */
30
30
  export default agent({
31
31
  name: "Swiss Air Concierge",
32
+ // What the desk does, for whoever is reading a list of agents. It names the
33
+ // four specialists as the four things a caller can ask for, which is how a
34
+ // caller would say it and how the dialog stack is organised.
35
+ description: "Changes flights, hotels, car rentals and excursions for a booked traveller",
32
36
  // The stack, the ticket and the itinerary exist before the first tool call,
33
37
  // so a resumed connection has something to project.
34
38
  // One projection replaces a `ctx.send` in each of eleven tools — and is the