@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.
- package/README.md +1 -0
- package/dist/{_bundler-B4RqNF5Z.mjs → _bundler-CDuYl5Gb.mjs} +1 -1
- package/dist/{_dev-server-CiKFH9qw.mjs → _dev-server-Dt3TCjhj.mjs} +6 -2
- package/dist/{_init-CE4HKdgV.mjs → _init-BhEfQ6Yi.mjs} +1 -1
- package/dist/_resource-commands.d.ts +23 -0
- package/dist/{_slug-api-nRFaBEPJ.mjs → _slug-api-z-USxPtL.mjs} +14 -10
- package/dist/_slug-api.d.ts +5 -2
- package/dist/{_templates-FI3xPEMj.mjs → _templates-4WcKOjS5.mjs} +4 -5
- package/dist/_templates.d.ts +3 -4
- package/dist/{build-6jfaakgc.mjs → build-BBxf8vom.mjs} +2 -2
- package/dist/cli.mjs +338 -346
- package/dist/{deploy-DvYeD8ia.mjs → deploy-DRC8jWr8.mjs} +1 -1
- package/dist/{dev-B59JIfWO.mjs → dev-QuuOOUtv.mjs} +1 -1
- package/dist/eval-DfQ8cm5p.mjs +56 -0
- package/dist/eval.d.ts +43 -0
- package/dist/{init-CpJVjEg0.mjs → init-CUo87gcI.mjs} +2 -2
- package/dist/{logs-9q-psa4q.mjs → logs-CQ2T46dr.mjs} +1 -1
- package/dist/scaffold/CLAUDE.md +409 -68
- package/dist/scaffold/package.json +5 -4
- package/dist/scaffold/server.mjs +10 -3
- package/dist/scaffold/tsconfig.json +0 -1
- package/dist/{secret-CVvSLIDV.mjs → secret-Ct34kdgU.mjs} +1 -1
- package/dist/{storage-BvUrnvM3.mjs → storage-i_79ZwAR.mjs} +1 -1
- package/dist/{studio--MUV0cid.mjs → studio-CzTzPqe1.mjs} +1 -1
- package/dist/templates/briefing-desk/agent.test.ts +350 -0
- package/dist/templates/briefing-desk/agent.ts +30 -0
- package/dist/templates/briefing-desk/shared.ts +200 -0
- package/dist/templates/briefing-desk/system-prompt.md +39 -0
- package/dist/templates/briefing-desk/tools/briefing_so_far.ts +35 -0
- package/dist/templates/briefing-desk/tools/research_topic.ts +88 -0
- package/dist/templates/briefing-desk/tools/verify_claim.ts +77 -0
- package/dist/templates/call-audit/agent.eval.test.ts +474 -0
- package/dist/templates/code-interpreter/agent.eval.test.ts +165 -0
- package/dist/templates/dispatch-center/agent.eval.test.ts +349 -0
- package/dist/templates/embedded-assets/agent.eval.test.ts +138 -0
- package/dist/templates/health-assistant/agent.eval.test.ts +167 -0
- package/dist/templates/infocom-adventure/agent.eval.test.ts +158 -0
- package/dist/templates/infocom-adventure/agent.test.ts +49 -18
- package/dist/templates/infocom-adventure/agent.ts +21 -0
- package/dist/templates/infocom-adventure/shared.ts +20 -9
- package/dist/templates/infocom-adventure/system-prompt.md +1 -1
- package/dist/templates/infocom-adventure/tools/game_state_move.ts +3 -2
- package/dist/templates/link-digest/agent.eval.test.ts +195 -0
- package/dist/templates/math-buddy/agent.eval.test.ts +146 -0
- package/dist/templates/night-owl/agent.eval.test.ts +272 -0
- package/dist/templates/personal-finance/agent.eval.test.ts +168 -0
- package/dist/templates/personal-finance/system-prompt.md +4 -0
- package/dist/templates/pipeline-simple/agent.eval.test.ts +78 -0
- package/dist/templates/pipeline-simple/agent.ts +2 -2
- package/dist/templates/pizza-ordering/agent.eval.test.ts +171 -0
- package/dist/templates/pizza-ordering/agent.test.ts +15 -0
- package/dist/templates/pizza-ordering/shared.ts +20 -1
- package/dist/templates/pizza-ordering/system-prompt.md +6 -0
- package/dist/templates/plan-and-execute/agent.eval.test.ts +209 -0
- package/dist/templates/podcast-digest/agent.eval.test.ts +411 -0
- package/dist/templates/podcast-digest/agent.test.ts +30 -59
- package/dist/templates/podcast-digest/agent.ts +1 -1
- package/dist/templates/podcast-digest/workflows/digest.ts +52 -19
- package/dist/templates/podcast-digest/workflows/slack.ts +48 -169
- package/dist/templates/recap-workflow/agent.eval.test.ts +366 -0
- package/dist/templates/redline/agent.eval.test.ts +209 -0
- package/dist/templates/research-workflow/agent.eval.test.ts +329 -0
- package/dist/templates/retail/address.ts +87 -1
- package/dist/templates/retail/agent.eval.test.ts +314 -0
- package/dist/templates/retail/agent.test.ts +171 -91
- package/dist/templates/retail/agent.ts +35 -1
- package/dist/templates/retail/cancel.ts +116 -0
- package/dist/templates/retail/client.tsx +39 -0
- package/dist/templates/retail/payment.ts +107 -0
- package/dist/templates/retail/pending.test.ts +196 -0
- package/dist/templates/retail/pending.ts +137 -0
- package/dist/templates/retail/registry.test.ts +119 -8
- package/dist/templates/retail/returns.ts +102 -0
- package/dist/templates/retail/shared.test.ts +42 -0
- package/dist/templates/retail/shared.ts +35 -0
- package/dist/templates/retail/store.test.ts +6 -4
- package/dist/templates/retail/store.ts +113 -57
- package/dist/templates/retail/swap.test.ts +4 -4
- package/dist/templates/retail/swap.ts +248 -15
- package/dist/templates/retail/system-prompt.md +62 -30
- package/dist/templates/retail/tools/cancel_change.ts +33 -0
- package/dist/templates/retail/tools/cancel_pending_order.ts +15 -59
- package/dist/templates/retail/tools/confirm_change.ts +42 -0
- package/dist/templates/retail/tools/exchange_delivered_order_items.ts +21 -66
- package/dist/templates/retail/tools/modify_pending_order_address.ts +12 -24
- package/dist/templates/retail/tools/modify_pending_order_items.ts +22 -60
- package/dist/templates/retail/tools/modify_pending_order_payment.ts +15 -77
- package/dist/templates/retail/tools/modify_user_address.ts +12 -15
- package/dist/templates/retail/tools/return_delivered_order_items.ts +16 -71
- package/dist/templates/retail/tools/transfer_to_human_agents.ts +4 -2
- package/dist/templates/simple/agent.eval.test.ts +54 -0
- package/dist/templates/solo-rpg/agent.eval.test.ts +320 -0
- package/dist/templates/spoken-summary/agent.eval.test.ts +342 -0
- package/dist/templates/support-line/agent.eval.test.ts +273 -0
- package/dist/templates/support-line/system-prompt.md +2 -1
- package/dist/templates/support-line/tools/answer_question.ts +56 -7
- package/dist/templates/transcription-workflow/agent.eval.test.ts +234 -0
- package/dist/templates/travel-concierge/agent.eval.test.ts +323 -0
- package/dist/templates/travel-concierge/agent.test.ts +110 -10
- package/dist/templates/travel-concierge/agent.ts +18 -9
- package/dist/templates/travel-concierge/shared.ts +110 -9
- package/dist/templates/travel-concierge/system-prompt.md +7 -1
- package/dist/templates/travel-concierge/tools/book_car_rental.ts +6 -3
- package/dist/templates/travel-concierge/tools/book_excursion.ts +6 -3
- package/dist/templates/travel-concierge/tools/book_hotel.ts +6 -3
- package/dist/templates/travel-concierge/tools/cancel_ticket.ts +6 -3
- package/dist/templates/travel-concierge/tools/search_car_rentals.ts +9 -5
- package/dist/templates/travel-concierge/tools/search_excursions.ts +9 -5
- package/dist/templates/travel-concierge/tools/search_flights.ts +9 -6
- package/dist/templates/travel-concierge/tools/search_hotels.ts +9 -5
- package/dist/templates/travel-concierge/tools/update_ticket.ts +6 -3
- package/dist/templates/web-researcher/agent.eval.test.ts +121 -0
- package/dist/templates/web-researcher/system-prompt.md +15 -4
- package/dist/{test-9kPKJI-w.mjs → test-BvyT6sAc.mjs} +24 -10
- package/dist/test.d.ts +29 -5
- package/dist/{worker-bundler-COxnqstQ.mjs → worker-bundler-CCVEDjm1.mjs} +45 -25
- package/dist/worker-bundler.mjs +1 -1
- package/dist/{workflow-D2AQf2Pl.mjs → workflow-BflATMmU.mjs} +19 -11
- package/package.json +5 -5
- package/dist/eject-C9WJyyr2.mjs +0 -116
- package/dist/eject.d.ts +0 -60
- package/dist/templates/infocom-adventure/tools/game_state_history.ts +0 -14
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
You are the Briefing Desk. Someone has phoned you to find out about something,
|
|
2
|
+
and you have a small team of researchers you can put on it.
|
|
3
|
+
|
|
4
|
+
## How you work
|
|
5
|
+
|
|
6
|
+
- You have no way to look anything up yourself. Everything you know about the
|
|
7
|
+
outside world comes back from `research_topic` or `verify_claim`.
|
|
8
|
+
- When the caller names a subject, decide the two or three ANGLES worth
|
|
9
|
+
researching and call `research_topic` once with all of them. Do not call it
|
|
10
|
+
once per angle — they run in parallel, and that is why the caller is not
|
|
11
|
+
waiting four times over.
|
|
12
|
+
- Each angle must stand on its own. A researcher has not heard this call and
|
|
13
|
+
cannot see the others' work, so "the same but for Europe" is not an angle;
|
|
14
|
+
"how European home battery prices moved in 2025" is.
|
|
15
|
+
- Say you are looking it up BEFORE you call the tool. A silent line is the
|
|
16
|
+
worst thing that can happen on a phone call, and a briefing takes a moment.
|
|
17
|
+
|
|
18
|
+
## How you talk
|
|
19
|
+
|
|
20
|
+
- Lead with the through-line — what it all adds up to — in one or two
|
|
21
|
+
sentences. Then the angles, one at a time, in the order that makes the point.
|
|
22
|
+
- Never read a summary out verbatim. They are written to be read, and you are
|
|
23
|
+
being listened to: shorten, and say the number rather than the sentence
|
|
24
|
+
around it.
|
|
25
|
+
- Say where something came from when it matters ("the manufacturers' own
|
|
26
|
+
figures say", "one industry blog says") and say when your researchers
|
|
27
|
+
disagreed. A briefing that flattens a disagreement is worse than no briefing.
|
|
28
|
+
- If the caller pushes back on a fact, check it with `verify_claim` rather than
|
|
29
|
+
defending it. If it comes back contradicted, correct yourself plainly.
|
|
30
|
+
- `briefing_so_far` is for a recap. It costs nothing, so use it rather than
|
|
31
|
+
reciting from memory.
|
|
32
|
+
|
|
33
|
+
## What not to do
|
|
34
|
+
|
|
35
|
+
- Do not answer a factual question about the world from memory. If you have not
|
|
36
|
+
had it researched on this call, say so and offer to look it up.
|
|
37
|
+
- Do not offer more angles than you can hold. Three good ones beat six.
|
|
38
|
+
- Do not describe your researchers, your tools, or how any of this works unless
|
|
39
|
+
the caller asks. They phoned a desk, not an architecture.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { tool } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { briefingSlot } from "../shared.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Read the board back.
|
|
7
|
+
*
|
|
8
|
+
* The one tool here that spends no model at all, and it earns its place for
|
|
9
|
+
* that reason: a caller who says "what have you got so far" after four
|
|
10
|
+
* delegated runs should not cost a fifth. What the desk knows is on the slot;
|
|
11
|
+
* this hands it over.
|
|
12
|
+
*/
|
|
13
|
+
export default tool({
|
|
14
|
+
description:
|
|
15
|
+
"List the angles researched on this call and what each one found. Use it " +
|
|
16
|
+
"when the caller asks for a recap, or before you offer to dig further.",
|
|
17
|
+
inputSchema: z.object({}),
|
|
18
|
+
execute: (_args, ctx) => {
|
|
19
|
+
const board = briefingSlot.get(ctx);
|
|
20
|
+
if (board.findings.length === 0) {
|
|
21
|
+
return {
|
|
22
|
+
topic: null,
|
|
23
|
+
findings: [],
|
|
24
|
+
message: "Nothing researched yet — ask what they want looked into.",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
topic: board.topic,
|
|
29
|
+
findings: board.findings,
|
|
30
|
+
totalSearches: board.findings.reduce((sum, finding) => sum + finding.work.searches, 0),
|
|
31
|
+
totalReads: board.findings.reduce((sum, finding) => sum + finding.work.reads, 0),
|
|
32
|
+
message: "Recap the through-line in one breath, then offer to go deeper on one angle.",
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { errorMessage, tool, toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { Finding } from "../shared.ts";
|
|
4
|
+
import { briefingSlot, MAX_ANGLES, recordFinding, researchAngle } from "../shared.ts";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Fan a topic out across angles, one researcher subagent each, in PARALLEL.
|
|
8
|
+
*
|
|
9
|
+
* **The `Promise.allSettled` is the template's whole point.** Each angle is an
|
|
10
|
+
* independent run with its own context window, so four of them cost the caller
|
|
11
|
+
* the SLOWEST one rather than the sum — and nothing they read reaches this
|
|
12
|
+
* conversation, only what each one concluded. Running the same four angles as
|
|
13
|
+
* four `ctx.generate` calls in one loop would be slower and would put every
|
|
14
|
+
* intermediate page in the desk's own prompt.
|
|
15
|
+
*
|
|
16
|
+
* **`allSettled`, not `all`.** One angle that fails (a provider hiccup, a
|
|
17
|
+
* subagent that ran out of budget with nothing to say) must not sink a
|
|
18
|
+
* briefing whose other three came back — a caller on the phone would rather
|
|
19
|
+
* hear three answers and one apology than an error. The failures are reported
|
|
20
|
+
* BY ANGLE so the desk can say which one is missing and offer to retry it.
|
|
21
|
+
*
|
|
22
|
+
* **The await comes first, then the mutation.** `slot.update`'s window is
|
|
23
|
+
* synchronous by contract, so the fan-out finishes before the board is touched
|
|
24
|
+
* and the whole write lands at once.
|
|
25
|
+
*/
|
|
26
|
+
export default tool({
|
|
27
|
+
description:
|
|
28
|
+
"Research a topic across several angles at once and report what each one " +
|
|
29
|
+
"found. Use this when the caller asks about something you would need to " +
|
|
30
|
+
"look up. Pick the angles yourself from what they said — two or three is " +
|
|
31
|
+
"usually right. Tell them you are looking it up before you call this.",
|
|
32
|
+
inputSchema: z.object({
|
|
33
|
+
topic: z.string().max(200).describe("The subject, in the caller's own terms"),
|
|
34
|
+
angles: z
|
|
35
|
+
.array(z.string().max(200))
|
|
36
|
+
.min(1)
|
|
37
|
+
.max(MAX_ANGLES)
|
|
38
|
+
.describe(
|
|
39
|
+
"The separate questions to research, one per researcher. Each must " +
|
|
40
|
+
"stand on its own: a researcher has not heard the conversation.",
|
|
41
|
+
),
|
|
42
|
+
}),
|
|
43
|
+
async execute(args, ctx) {
|
|
44
|
+
const angles = args.angles.map((angle) => angle.trim()).filter((angle) => angle.length > 0);
|
|
45
|
+
if (angles.length === 0) {
|
|
46
|
+
return toolFailure("No angles to research — say what the caller wants looked up.");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const settled = await Promise.allSettled(
|
|
50
|
+
angles.map((angle) => researchAngle(ctx.delegate, args.topic, angle)),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
// Two typed lists rather than one union filtered twice: `"summary" in one`
|
|
54
|
+
// reads fine and narrows nothing a `.filter` result keeps, so the union
|
|
55
|
+
// version needs a cast — the laundering this repo's ratchet counts.
|
|
56
|
+
const summaries: Finding[] = [];
|
|
57
|
+
const failures: { angle: string; error: string }[] = [];
|
|
58
|
+
settled.forEach((outcome, index) => {
|
|
59
|
+
if (outcome.status === "fulfilled") {
|
|
60
|
+
summaries.push(outcome.value);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
failures.push({ angle: angles[index] ?? "", error: errorMessage(outcome.reason) });
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
if (summaries.length === 0) {
|
|
67
|
+
return toolFailure(
|
|
68
|
+
`Every angle failed. The first said: ${failures[0]?.error ?? "no reason given"}`,
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return briefingSlot.update(ctx, (board) => {
|
|
73
|
+
board.topic = args.topic;
|
|
74
|
+
for (const finding of summaries) recordFinding(board, finding);
|
|
75
|
+
return {
|
|
76
|
+
topic: args.topic,
|
|
77
|
+
findings: summaries,
|
|
78
|
+
failed: failures,
|
|
79
|
+
message:
|
|
80
|
+
"Give the caller the through-line first, in one or two sentences, then " +
|
|
81
|
+
"the angles. Do not read the summaries out verbatim." +
|
|
82
|
+
(failures.length > 0
|
|
83
|
+
? " Mention which angle you could not get to and offer to try it again."
|
|
84
|
+
: ""),
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { errorMessage, omitUndefined, tool, toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { briefingSlot, countWork, factChecker, findByAngle } from "../shared.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Check one sentence against the web, on the narrower of the desk's two
|
|
7
|
+
* subagents.
|
|
8
|
+
*
|
|
9
|
+
* **Why this is a second SUBAGENT and not a second prompt.** Checking a claim
|
|
10
|
+
* needs a search and one sentence back, so it runs on a cheaper model with a
|
|
11
|
+
* third of the researcher's budget and search only — no page reads. Expressing
|
|
12
|
+
* that as `ctx.generate` would mean the desk doing the searching itself, in the
|
|
13
|
+
* conversation's own context; expressing it as one subagent with two modes
|
|
14
|
+
* would mean a run that can browse whenever the model feels like it. A
|
|
15
|
+
* capability a run does not need is one it cannot misuse.
|
|
16
|
+
*
|
|
17
|
+
* **The claim may be quoted from the board.** The caller says "check the second
|
|
18
|
+
* thing you told me", so `about` names an angle and the claim is read out of
|
|
19
|
+
* the slot — a subagent has not heard the call, and handing it "the second
|
|
20
|
+
* thing" as its task would get a confident answer about nothing.
|
|
21
|
+
*/
|
|
22
|
+
export default tool({
|
|
23
|
+
description:
|
|
24
|
+
"Check one specific factual claim against the web. Use it when the caller " +
|
|
25
|
+
"pushes back on something, or asks whether a finding is right. Pass the " +
|
|
26
|
+
"claim as a complete sentence.",
|
|
27
|
+
inputSchema: z.object({
|
|
28
|
+
claim: z
|
|
29
|
+
.string()
|
|
30
|
+
.max(400)
|
|
31
|
+
.describe("The claim to check, stated as one self-contained sentence"),
|
|
32
|
+
about: z
|
|
33
|
+
.string()
|
|
34
|
+
.max(200)
|
|
35
|
+
.optional()
|
|
36
|
+
.describe(
|
|
37
|
+
"The angle this claim came from, when the caller is pointing at " +
|
|
38
|
+
"something already on the board",
|
|
39
|
+
),
|
|
40
|
+
}),
|
|
41
|
+
async execute(args, ctx) {
|
|
42
|
+
const claim = args.claim.trim();
|
|
43
|
+
if (claim === "") return toolFailure("Nothing to check — say the claim in a full sentence.");
|
|
44
|
+
|
|
45
|
+
const board = briefingSlot.get(ctx);
|
|
46
|
+
const source = args.about ? findByAngle(board, args.about) : undefined;
|
|
47
|
+
|
|
48
|
+
let verdict: string;
|
|
49
|
+
let searches: number;
|
|
50
|
+
try {
|
|
51
|
+
// What the checker gets of the conversation, and no more: the finding the
|
|
52
|
+
// claim came out of, so it can tell a misquote from a disagreement.
|
|
53
|
+
// Through `omitUndefined` rather than a truthiness-guarded spread — the
|
|
54
|
+
// repo's one spelling for an optional field, and the shape its own
|
|
55
|
+
// `guard-invariants` rule 22 counts as debt.
|
|
56
|
+
const context = source ? `The desk told the caller: ${source.summary}` : undefined;
|
|
57
|
+
const result = await ctx.delegate(factChecker, {
|
|
58
|
+
task: claim,
|
|
59
|
+
...omitUndefined({ context }),
|
|
60
|
+
});
|
|
61
|
+
verdict = result.text;
|
|
62
|
+
searches = countWork(result.toolCalls).searches;
|
|
63
|
+
} catch (err: unknown) {
|
|
64
|
+
return toolFailure(`The check did not come back: ${errorMessage(err)}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
claim,
|
|
69
|
+
verdict,
|
|
70
|
+
searches,
|
|
71
|
+
checkedAgainst: source?.angle ?? null,
|
|
72
|
+
message:
|
|
73
|
+
"Say the verdict plainly, in the caller's words. If it is contradicted, " +
|
|
74
|
+
"correct what you told them earlier rather than defending it.",
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
});
|