@alexkroman1/aai-cli 5.13.2 → 5.14.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 (64) hide show
  1. package/dist/scaffold/package.json +3 -3
  2. package/dist/scaffold/pnpm-workspace.yaml +24 -0
  3. package/dist/templates/dispatch-center/agent.test.ts +10 -17
  4. package/dist/templates/dispatch-center/agent.ts +2 -2
  5. package/dist/templates/dispatch-center/client.tsx +9 -13
  6. package/dist/templates/dispatch-center/shared.ts +36 -63
  7. package/dist/templates/dispatch-center/tools/incident_add_note.ts +4 -4
  8. package/dist/templates/dispatch-center/tools/incident_create.ts +2 -2
  9. package/dist/templates/dispatch-center/tools/incident_escalate.ts +4 -4
  10. package/dist/templates/dispatch-center/tools/incident_get.ts +9 -4
  11. package/dist/templates/dispatch-center/tools/incident_triage.ts +4 -4
  12. package/dist/templates/dispatch-center/tools/incident_update_status.ts +4 -4
  13. package/dist/templates/dispatch-center/tools/ops_dashboard.ts +2 -2
  14. package/dist/templates/dispatch-center/tools/ops_run_scenario.ts +2 -2
  15. package/dist/templates/dispatch-center/tools/resources_dispatch.ts +4 -4
  16. package/dist/templates/dispatch-center/tools/resources_get_available.ts +2 -2
  17. package/dist/templates/dispatch-center/tools/resources_update_status.ts +2 -2
  18. package/dist/templates/infocom-adventure/agent.ts +10 -10
  19. package/dist/templates/infocom-adventure/client.tsx +5 -17
  20. package/dist/templates/infocom-adventure/shared.ts +17 -14
  21. package/dist/templates/pizza-ordering/agent.test.ts +27 -31
  22. package/dist/templates/pizza-ordering/agent.ts +8 -8
  23. package/dist/templates/pizza-ordering/client.tsx +4 -4
  24. package/dist/templates/pizza-ordering/shared.ts +14 -20
  25. package/dist/templates/retail/agent.test.ts +137 -138
  26. package/dist/templates/retail/agent.ts +7 -10
  27. package/dist/templates/retail/authenticate.ts +2 -2
  28. package/dist/templates/retail/client.tsx +13 -14
  29. package/dist/templates/retail/registry.test.ts +9 -9
  30. package/dist/templates/retail/resolve.test.ts +17 -16
  31. package/dist/templates/retail/resolve.ts +5 -4
  32. package/dist/templates/retail/shared.test.ts +17 -16
  33. package/dist/templates/retail/shared.ts +39 -18
  34. package/dist/templates/retail/store.test.ts +40 -47
  35. package/dist/templates/retail/store.ts +39 -65
  36. package/dist/templates/retail/swap.test.ts +20 -17
  37. package/dist/templates/retail/swap.ts +7 -14
  38. package/dist/templates/retail/tools/cancel_pending_order.ts +5 -4
  39. package/dist/templates/retail/tools/exchange_delivered_order_items.ts +6 -5
  40. package/dist/templates/retail/tools/find_user_id_by_email.ts +2 -2
  41. package/dist/templates/retail/tools/find_user_id_by_name_zip.ts +2 -2
  42. package/dist/templates/retail/tools/get_item_details.ts +4 -3
  43. package/dist/templates/retail/tools/get_order_details.ts +4 -3
  44. package/dist/templates/retail/tools/get_product_details.ts +4 -3
  45. package/dist/templates/retail/tools/get_user_details.ts +4 -3
  46. package/dist/templates/retail/tools/list_all_product_types.ts +2 -2
  47. package/dist/templates/retail/tools/modify_pending_order_address.ts +4 -3
  48. package/dist/templates/retail/tools/modify_pending_order_items.ts +6 -6
  49. package/dist/templates/retail/tools/modify_pending_order_payment.ts +6 -6
  50. package/dist/templates/retail/tools/modify_user_address.ts +4 -3
  51. package/dist/templates/retail/tools/return_delivered_order_items.ts +6 -6
  52. package/dist/templates/solo-rpg/agent.test.ts +26 -34
  53. package/dist/templates/solo-rpg/agent.ts +2 -2
  54. package/dist/templates/solo-rpg/client.tsx +1 -1
  55. package/dist/templates/solo-rpg/shared.ts +6 -14
  56. package/dist/templates/solo-rpg/tools/action_roll.ts +2 -2
  57. package/dist/templates/solo-rpg/tools/burn_momentum.ts +2 -2
  58. package/dist/templates/solo-rpg/tools/check_state.ts +2 -2
  59. package/dist/templates/solo-rpg/tools/load_game.ts +2 -2
  60. package/dist/templates/solo-rpg/tools/oracle.ts +3 -3
  61. package/dist/templates/solo-rpg/tools/save_game.ts +2 -2
  62. package/dist/templates/solo-rpg/tools/setup_character.ts +2 -2
  63. package/dist/templates/solo-rpg/tools/update_state.ts +12 -11
  64. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  import { tool } from "@alexkroman1/aai";
2
2
  import { z } from "zod";
3
- import { checkChaosInterrupt, creativitySeed, d, getGameState, pick } from "../shared.ts";
3
+ import { checkChaosInterrupt, creativitySeed, d, gameSlot, pick } from "../shared.ts";
4
4
 
5
5
  const REACTIONS = [
6
6
  "Acts on their agenda",
@@ -218,8 +218,8 @@ export const oracle = tool({
218
218
  }
219
219
 
220
220
  if (args.type === "chaos_check") {
221
- // getGameState returns the live state object — mutations stick.
222
- const state = getGameState(ctx);
221
+ // gameSlot.get returns the live state object — mutations stick.
222
+ const state = gameSlot.get(ctx);
223
223
  const interrupt = checkChaosInterrupt(state);
224
224
  return {
225
225
  type: "chaos_check",
@@ -1,6 +1,6 @@
1
1
  import { tool } from "@alexkroman1/aai";
2
2
  import { z } from "zod";
3
- import { getGameState, saveSlotKey, saveSlotParam, saveState } from "../shared.ts";
3
+ import { gameSlot, saveSlotKey, saveSlotParam, saveState } from "../shared.ts";
4
4
 
5
5
  // Requires storage — `aai storage enable` (or DATABASE_URL in .env under
6
6
  // `aai dev`); the rest of the game works without it.
@@ -8,7 +8,7 @@ export const saveGame = tool({
8
8
  description: "Save current game to persistent storage.",
9
9
  inputSchema: z.object({ slot: saveSlotParam }),
10
10
  async execute(args, ctx) {
11
- const state = getGameState(ctx);
11
+ const state = gameSlot.get(ctx);
12
12
  await saveState(ctx, saveSlotKey(args.slot), state);
13
13
  return {
14
14
  saved: true,
@@ -8,10 +8,10 @@ import {
8
8
  DEFAULT_STATE,
9
9
  DISPOSITIONS,
10
10
  GENRES,
11
+ gameSlot,
11
12
  MAX_CLOCK_SEGMENTS,
12
13
  MIN_CLOCK_SEGMENTS,
13
14
  makeNpc,
14
- saveGameState,
15
15
  shuffle,
16
16
  stateSummary,
17
17
  TIME_PHASES,
@@ -191,7 +191,7 @@ export const setupCharacter = tool({
191
191
  state.phase = "playing";
192
192
  state.sceneCount = 1;
193
193
 
194
- saveGameState(ctx, state);
194
+ gameSlot.set(ctx, state);
195
195
 
196
196
  return {
197
197
  success: true,
@@ -1,9 +1,9 @@
1
- import { tool } from "@alexkroman1/aai";
1
+ import { pushCapped, tool } from "@alexkroman1/aai";
2
2
  import { z } from "zod";
3
3
  import {
4
4
  DEFAULT_CLOCK_SEGMENTS,
5
5
  DISPOSITIONS,
6
- getGameState,
6
+ gameSlot,
7
7
  MAX_BOND,
8
8
  MAX_CLOCK_SEGMENTS,
9
9
  MAX_CLOCKS,
@@ -55,7 +55,7 @@ export const updateState = tool({
55
55
  logEntry: z.string().max(500).describe("Short log entry for this scene").optional(),
56
56
  }),
57
57
  async execute(args, ctx) {
58
- const state = getGameState(ctx);
58
+ const state = gameSlot.get(ctx);
59
59
  const warnings: string[] = [];
60
60
  const clockEvents: { clock: string; trigger: string }[] = [];
61
61
 
@@ -147,14 +147,15 @@ export const updateState = tool({
147
147
 
148
148
  // Session log
149
149
  if (args.logEntry) {
150
- state.sessionLog.push({
151
- scene: state.sceneCount,
152
- summary: args.logEntry,
153
- location: state.currentLocation,
154
- });
155
- if (state.sessionLog.length > MAX_SESSION_LOG) {
156
- state.sessionLog = state.sessionLog.slice(-MAX_SESSION_LOG);
157
- }
150
+ pushCapped(
151
+ state.sessionLog,
152
+ {
153
+ scene: state.sceneCount,
154
+ summary: args.logEntry,
155
+ location: state.currentLocation,
156
+ },
157
+ MAX_SESSION_LOG,
158
+ );
158
159
  }
159
160
 
160
161
  // Crisis check
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexkroman1/aai-cli",
3
- "version": "5.13.2",
3
+ "version": "5.14.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "aai": "bin.mjs"
@@ -43,8 +43,8 @@
43
43
  "p-timeout": "^7.0.1",
44
44
  "vite": "^8.1.5",
45
45
  "zod": "^4.4.3",
46
- "@alexkroman1/aai-ui": "5.13.2",
47
- "@alexkroman1/aai": "5.13.2"
46
+ "@alexkroman1/aai": "5.14.0",
47
+ "@alexkroman1/aai-ui": "5.14.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "playwright": "^1.61.1",