@alexkroman1/aai-cli 0.15.4 → 0.15.5

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.
@@ -15,10 +15,10 @@
15
15
  "publish:agent": "aai publish"
16
16
  },
17
17
  "dependencies": {
18
- "@alexkroman1/aai": "^0.15.4",
19
- "@alexkroman1/aai-cli": "^0.15.4",
20
- "@alexkroman1/aai-runtime": "^0.15.4",
21
- "@alexkroman1/aai-ui": "^0.15.4",
18
+ "@alexkroman1/aai": "^0.15.5",
19
+ "@alexkroman1/aai-cli": "^0.15.5",
20
+ "@alexkroman1/aai-runtime": "^0.15.5",
21
+ "@alexkroman1/aai-ui": "^0.15.5",
22
22
  "react": "^19.3.0",
23
23
  "react-dom": "^19.3.0",
24
24
  "tailwindcss": "^4.0.0",
@@ -71,6 +71,21 @@ const REWRITE = JSON.stringify({
71
71
  const DRAFT =
72
72
  "Yes — the on-prem deployment runs the speech models inside your VPC; nothing calls out.";
73
73
 
74
+ /**
75
+ * The request, then the drafting nudge only if the request did not already stage.
76
+ *
77
+ * Whether the desk chains `draft_reply` into its first reply is a coin the live
78
+ * model flips. Sent unconditionally, the nudge can land on a WAITING draft,
79
+ * where it reads as dictated content and is answered with `edit`.
80
+ */
81
+ async function untilStaged(session: EvalSession, request: string, nudge: string) {
82
+ const turns = [await session.say(request)];
83
+ if (!toolNames(turns[0]!.toolCalls).includes("draft_reply")) {
84
+ turns.push(await session.say(nudge));
85
+ }
86
+ return turns;
87
+ }
88
+
74
89
  describeEval(agentDef, (test) => {
75
90
  test(
76
91
  "the call opens with a triage, and a triage sends nothing",
@@ -133,10 +148,16 @@ describeEval(agentDef, (test) => {
133
148
  // for me" was no better. What works is an instruction to ACT that names
134
149
  // the reply AND its content while saying nothing about sending — there is
135
150
  // no yes in it to mishear, and nothing to read as "wait".
136
- const turns = await session.sayAll([
151
+ //
152
+ // And the nudge is sent ONLY when the first turn stopped short of staging.
153
+ // A desk that chained `draft_reply` into its first reply hears the nudge
154
+ // while the draft is waiting, as dictated content — which is `edit`, and
155
+ // `edit` sends.
156
+ const turns = await untilStaged(
157
+ session,
137
158
  "Open the one from Dana at Northwind and reply that yes, inference stays inside their VPC.",
138
159
  "Write the reply now — say yes, it stays inside their VPC.",
139
- ]);
160
+ );
140
161
  const calls = toolCallsInTurns(turns);
141
162
  const names = toolNames(calls);
142
163
  // Across BOTH turns, and named: "expected [ 'open_email' ] to include
@@ -194,11 +215,13 @@ describeEval(agentDef, (test) => {
194
215
  // rather than chaining the staging into the same reply, which left this
195
216
  // case failing on a draft that had not happened yet rather than on the
196
217
  // gate it is here to measure. The yes is still the only send.
197
- const turns = await session.sayAll([
218
+ // The middle one is sent only when needed, for the reason the case above gives.
219
+ const turns = await untilStaged(
220
+ session,
198
221
  "Open Dana's email from Northwind and reply that inference stays inside their VPC.",
199
222
  "Write the reply now — say inference stays inside their VPC.",
200
- "Yes. Send it.",
201
- ]);
223
+ );
224
+ turns.push(await session.say("Yes. Send it."));
202
225
  const calls = toolCallsInTurns(turns);
203
226
  const names = toolNames(calls);
204
227
  // Staged first, sent second, once each — reversed, or a send with nothing
@@ -317,7 +317,9 @@ const applyEdit = failable(async (args: InferSchemaOutput<typeof EDIT_ARGS>, ctx
317
317
  export function editTool(): ToolDef {
318
318
  return reviewFlow.tool({
319
319
  description:
320
- `${name} dictated changes to the draft or the invite — send THEIR version. Give the ` +
320
+ `${name} dictated changes to the draft or the invite — send THEIR version. Only when ` +
321
+ "their words CHANGE what you read back; a restatement of it is not an edit, so ask " +
322
+ "whether to send. Give the " +
321
323
  "whole corrected email text, not the change; for an invite, the fields that change. " +
322
324
  "Use respond instead when they want you to redraft it yourself.",
323
325
  when: AWAITING,
@@ -395,7 +395,7 @@ const reviewSpec = {
395
395
  instruction:
396
396
  "Something is waiting on the executive's word. Read it back and hear their " +
397
397
  "answer, then call exactly one of accept, edit, ignore or respond. Nothing is " +
398
- "sent until accept has run.",
398
+ "sent until accept or edit has run.",
399
399
  on: { SETTLED: "inbox", REDRAFT: "drafting" },
400
400
  },
401
401
  },
@@ -93,6 +93,9 @@ export default agent({
93
93
  "keep_transcript with their answer.",
94
94
  "If they ask how it is going, call recap_progress. If they ask about earlier work, call",
95
95
  "recap_status. If they say to stop or forget it, call cancel_recap.",
96
+ "If they ask to start it again while one is running, call request_recap — it tells you",
97
+ "about the run they already have — and never cancel_recap first: a restart pays for a",
98
+ "second transcription of the same audio.",
96
99
  "Keep replies to one or two sentences; this is a voice call.",
97
100
  ].join(" "),
98
101
 
@@ -2,7 +2,9 @@ import { tool } from "@alexkroman1/aai";
2
2
  import { recap } from "../shared.ts";
3
3
 
4
4
  export default tool({
5
- description: "Stop the recap that is running. Use when the caller says to forget it.",
5
+ description:
6
+ "Stop the recap that is running. Use when the caller says to forget it — never as a " +
7
+ "step toward starting it again.",
6
8
  execute: async (_args, ctx) => {
7
9
  const [latest] = await ctx.workflows.find(recap, ctx.sessionId, { limit: 1 });
8
10
  if (!latest) return { cancelled: false, note: "Nothing started yet." };
@@ -7,6 +7,9 @@ The menu (sizes, crusts, toppings, and prices) is appended below this prompt —
7
7
  Behavior:
8
8
  - When a customer wants a pizza, collect size, crust, and toppings, then use add_pizza to add it.
9
9
  - If they just say something like "pepperoni pizza", assume medium, regular crust, and confirm before adding.
10
+ - If they name the size and toppings but not the crust, add it on regular crust
11
+ right away and say the crust when you confirm — they can change it. Do not
12
+ hold the order for a crust question.
10
13
  - Always confirm what you added after using add_pizza.
11
14
  - NEVER say a pizza was added, changed, or removed unless the matching tool has
12
15
  returned it. Saying "I've added that" with no tool call leaves the customer's
@@ -120,7 +120,11 @@ describeEval(agentDef, (test) => {
120
120
  // scripted case never writes.
121
121
  const call = await simulate({
122
122
  persona: "a friendly commuter on a phone, who answers in short sentences",
123
- goal: "find out whether to bring an umbrella in Seattle today",
123
+ // "Ask … in so many words": a short-sentence caller told only to FIND
124
+ // OUT answered the greeting's "which city?" with "Seattle.", heard a
125
+ // clear forecast and hung up — and the judge then graded the agent on a
126
+ // question nobody had said out loud.
127
+ goal: "ask, in so many words, whether you need an umbrella in Seattle today",
124
128
  });
125
129
 
126
130
  // The call ending on the caller's terms is the first thing to know: a
@@ -3,6 +3,8 @@ sentences — a caller is listening, not reading.
3
3
 
4
4
  Use the get_weather tool whenever someone asks what it is like somewhere, and
5
5
  answer from what it returns rather than from memory. Round temperatures to
6
- whole degrees and say the city back, so a mishearing is obvious.
6
+ whole degrees and say the city back, so a mishearing is obvious. Answer the
7
+ question they actually asked: if it was "do I need an umbrella?" or "should I
8
+ wear a coat?", say yes or no, with the weather as the reason.
7
9
 
8
10
  If a lookup fails, say so plainly and offer to try another city.
@@ -41,7 +41,9 @@ describeEval(agentDef, (test) => {
41
41
  "takes where they are and what they are driving before anything else",
42
42
  async ({ session }) => {
43
43
  const turn = await session.say(
44
- "Hi — my car just died on me. I'm on route nine eastbound, past the Millfield exit, " +
44
+ // "Won't start", not "died": `report_location` says not to guess the
45
+ // situation, and "died" is `battery` as much as `wont_start`.
46
+ "Hi — my car won't start. I'm on route nine eastbound, past the Millfield exit, " +
45
47
  "it's a silver Toyota Corolla. I'm well off the road on the grass.",
46
48
  );
47
49
 
@@ -98,7 +98,7 @@ CORRECTION SYSTEM:
98
98
  If the player starts a message with ##, treat it as a correction to the previous turn. Acknowledge the correction and rewrite the scene.
99
99
 
100
100
  FLOW:
101
- 1. The LIVE CAMPAIGN SHEET at the end of these instructions is refreshed before every reply: the tracks, momentum, chaos factor, clocks, cast, and which act you are in. It is the engine's own record and it is never a turn behind, so read it rather than remembering, and never state a number that contradicts it. You do not have to open a turn with a tool call to find out where you are. `check_state` is still there for the full board — the chronicle, the whole NPC records, the story blueprint — and for the position (`state` and `instruction`) restated on demand; every other tool answers with that same pair, and a tool that is not available yet refuses and tells you what has to happen first.
101
+ 1. The LIVE CAMPAIGN SHEET at the end of these instructions is refreshed before every reply: the tracks, momentum, chaos factor, clocks, cast, and which act you are in. It is the engine's own record and it is never a turn behind, so read it rather than remembering, and never state a number that contradicts it. You do not have to open a turn with a tool call to find out where you are. `check_state` is still there for the full board — the chronicle, the whole NPC records, the story blueprint — and for the position (`state` and `instruction`) restated on demand — when the player asks you to check the state, or whether the story is over, call it rather than answering from the sheet; every other tool answers with that same pair, and a tool that is not available yet refuses and tells you what has to happen first.
102
102
  2. Present situations with tension and choice. Two to three options, but accept anything.
103
103
  3. For ANY risky action, you MUST call action_roll. NEVER narrate success or failure without rolling. NEVER reduce health, spirit, supply, or momentum yourself — action_roll does this through code. If you narrate damage without calling action_roll, the sidebar will be wrong and the game will break.
104
104
  4. After location changes, new NPCs, or other world changes, call update_state. But NEVER manually set health, spirit, supply, or momentum in update_state unless the player is resting or trading — action_roll handles combat and risk.
@@ -9,6 +9,10 @@ and you have a small team of researchers you can put on it.
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`.
12
+ - When the caller brings you one claim to check — something they heard or
13
+ read, "is that right?" — call `verify_claim` with that claim in full, not
14
+ `research_topic`, however broad its subject sounds. Offer a full briefing
15
+ afterwards if they want one.
12
16
  - When the caller names a subject, decide the two or three ANGLES worth
13
17
  researching and call `research_topic` once with all of them. Do not call it
14
18
  once per angle — they run in parallel, and that is why the caller is not
@@ -135,7 +135,9 @@ describeEval(agentDef, (test) => {
135
135
  // before `to_flight_assistant` is told so and recovers inside the turn.
136
136
  // That refusal is a legal step and it is asserted rather than tolerated —
137
137
  // its own message is what pointed the model at the way in.
138
- for (const attempt of attempts.filter((call) => call !== staged)) {
138
+ // A second staging is not one: a desk that hears the request again
139
+ // without a yes may `cancel_action` and stage it afresh.
140
+ for (const attempt of attempts.filter((call) => !stagedSomething(call))) {
139
141
  expect(attempt.result).toMatch(
140
142
  new RegExp(`to_flight_assistant|${dialogRefusalPattern().source}`),
141
143
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexkroman1/aai-cli",
3
- "version": "0.15.4",
3
+ "version": "0.15.5",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -58,9 +58,9 @@
58
58
  "vite": "^8.3.1",
59
59
  "xstate": "^5.33.2",
60
60
  "zod": "^4.6.5",
61
- "@alexkroman1/aai": "0.15.4",
62
- "@alexkroman1/aai-runtime": "0.15.4",
63
- "@alexkroman1/aai-ui": "0.15.4"
61
+ "@alexkroman1/aai": "0.15.5",
62
+ "@alexkroman1/aai-runtime": "0.15.5",
63
+ "@alexkroman1/aai-ui": "0.15.5"
64
64
  },
65
65
  "devDependencies": {
66
66
  "playwright": "^1.63.0",