@alexkroman1/aai-cli 16.1.0 → 18.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.
- package/README.md +2 -1
- package/dist/{_build-target-ClEEuUuW.mjs → _build-target-C08aM-Es.mjs} +504 -43
- package/dist/_build-target.d.ts +98 -19
- package/dist/_console-audio.d.ts +17 -0
- package/dist/_console-session.d.ts +70 -0
- package/dist/_deno-target.d.ts +15 -14
- package/dist/_dev-env.d.ts +19 -13
- package/dist/{_dev-server-D1wKiA0_.mjs → _dev-server-Dtp4aAlo.mjs} +26 -18
- package/dist/_dev-server.d.ts +5 -3
- package/dist/_init.d.ts +39 -0
- package/dist/_modal-target.d.ts +11 -6
- package/dist/_preflight-CnW9QiE7.mjs +116 -0
- package/dist/_preflight.d.ts +110 -5
- package/dist/_target-bundle.d.ts +112 -0
- package/dist/_target-entry.d.ts +81 -0
- package/dist/_templates-DXadVNsL.mjs +135 -0
- package/dist/_templates.d.ts +11 -34
- package/dist/{_vitest-runner-BiAMIir1.mjs → _vitest-runner-CZNGj0ZC.mjs} +21 -16
- package/dist/_vitest-runner.d.ts +35 -23
- package/dist/{build-O6BT51x_.mjs → build-DrQTSc2R.mjs} +128 -293
- package/dist/build.d.ts +34 -4
- package/dist/cli.mjs +40 -16
- package/dist/console-BsyE3DyB.mjs +422 -0
- package/dist/console.d.ts +37 -0
- package/dist/{deploy-lldQyJVj.mjs → deploy-B68-x7xM.mjs} +12 -4
- package/dist/deploy.d.ts +9 -0
- package/dist/{dev-Du8pCWFq.mjs → dev-BGWU2zPP.mjs} +1 -1
- package/dist/dev.d.ts +1 -1
- package/dist/{eval-Ducmkt1n.mjs → eval-DB07kTxO.mjs} +1 -1
- package/dist/init-CbOhyNYe.mjs +559 -0
- package/dist/init.d.ts +43 -3
- package/dist/scaffold/CLAUDE.md +161 -166
- package/dist/scaffold/package.json +6 -6
- package/dist/scaffold/vite.config.ts +29 -1
- package/dist/start.d.ts +3 -3
- package/dist/{studio-It7SRfUN.mjs → studio-BRJsw7lr.mjs} +19 -9
- package/dist/templates/applicant-screening-agent/agent.eval.test.ts +20 -6
- package/dist/templates/applicant-screening-agent/agent.test.ts +17 -13
- package/dist/templates/applicant-screening-agent/agent.ts +28 -0
- package/dist/templates/applicant-screening-agent/crews.ts +4 -4
- package/dist/templates/applicant-screening-agent/shared.ts +11 -11
- package/dist/templates/call-audit-workflow/agent.ts +2 -0
- package/dist/templates/code-interpreter-agent/agent.eval.test.ts +3 -2
- package/dist/templates/code-interpreter-agent/agent.test.ts +2 -2
- package/dist/templates/code-interpreter-agent/agent.ts +1 -0
- package/dist/templates/coding-agent/agent.eval.test.ts +136 -0
- package/dist/templates/coding-agent/agent.test.ts +109 -0
- package/dist/templates/coding-agent/agent.ts +45 -0
- package/dist/templates/coding-agent/chat.ts +63 -0
- package/dist/templates/coding-agent/shared.ts +46 -0
- package/dist/templates/coding-agent/system-prompt.md +32 -0
- package/dist/templates/coding-agent/tools/bash.ts +6 -0
- package/dist/templates/coding-agent/tools/delete_file.ts +6 -0
- package/dist/templates/coding-agent/tools/edit_file.ts +6 -0
- package/dist/templates/coding-agent/tools/glob.ts +6 -0
- package/dist/templates/coding-agent/tools/grep.ts +6 -0
- package/dist/templates/coding-agent/tools/list_files.ts +6 -0
- package/dist/templates/coding-agent/tools/read_file.ts +6 -0
- package/dist/templates/coding-agent/tools/todo_write.ts +6 -0
- package/dist/templates/coding-agent/tools/write_file.ts +6 -0
- package/dist/templates/custom-pipeline-agent/agent.ts +3 -2
- package/dist/templates/custom-pipeline-agent/modes.test.ts +4 -4
- package/dist/templates/custom-pipeline-agent/stages.test.ts +75 -83
- package/dist/templates/document-redline-workflow/agent.ts +2 -0
- package/dist/templates/emergency-dispatch-agent/agent.eval.test.ts +1 -1
- package/dist/templates/emergency-dispatch-agent/agent.test.ts +103 -0
- package/dist/templates/emergency-dispatch-agent/agent.ts +15 -0
- package/dist/templates/emergency-dispatch-agent/guardrails.ts +105 -0
- package/dist/templates/emergency-dispatch-agent/system-prompt.md +1 -0
- package/dist/templates/entertainment-picks-agent/agent.eval.test.ts +9 -2
- package/dist/templates/entertainment-picks-agent/agent.ts +1 -0
- package/dist/templates/entertainment-picks-agent/system-prompt.md +6 -0
- package/dist/templates/entertainment-picks-agent/tools/revisit.ts +7 -0
- package/dist/templates/executive-inbox-agent/agent.eval.test.ts +84 -23
- package/dist/templates/executive-inbox-agent/agent.test.ts +35 -25
- package/dist/templates/executive-inbox-agent/agent.ts +1 -0
- package/dist/templates/executive-inbox-agent/calendar.test.ts +13 -7
- package/dist/templates/executive-inbox-agent/meeting.ts +3 -3
- package/dist/templates/executive-inbox-agent/prompts.ts +3 -1
- package/dist/templates/executive-inbox-agent/system-prompt.md +3 -3
- package/dist/templates/executive-inbox-agent/tools/meeting_assistant.ts +3 -3
- package/dist/templates/executive-inbox-agent/tools/open_email.ts +8 -16
- package/dist/templates/front-desk-agent/agent.eval.test.ts +174 -0
- package/dist/templates/front-desk-agent/agent.test.ts +150 -0
- package/dist/templates/front-desk-agent/agent.ts +22 -0
- package/dist/templates/front-desk-agent/shared.ts +234 -0
- package/dist/templates/front-desk-agent/system-prompt.md +13 -0
- package/dist/templates/front-desk-agent/tools/verify_account.ts +41 -0
- package/dist/templates/hotel-reception-agent/agent.eval.test.ts +85 -21
- package/dist/templates/hotel-reception-agent/agent.test.ts +3 -3
- package/dist/templates/hotel-reception-agent/agent.ts +6 -3
- package/dist/templates/hotel-reception-agent/client.tsx +14 -2
- package/dist/templates/hotel-reception-agent/concierge.ts +2 -1
- package/dist/templates/hotel-reception-agent/desk-seams.test.ts +3 -3
- package/dist/templates/hotel-reception-agent/disputes.ts +9 -11
- package/dist/templates/hotel-reception-agent/events.ts +2 -1
- package/dist/templates/hotel-reception-agent/session.ts +56 -0
- package/dist/templates/hotel-reception-agent/shared.ts +20 -21
- package/dist/templates/hotel-reception-agent/system-prompt.md +1 -1
- package/dist/templates/hotel-reception-agent/tools/abandon_booking.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/add_to_waitlist.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/book_airport_car.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/cancel_restaurant_reservation.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/cancel_room_booking.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/check_restaurant_availability.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/check_room_availability.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/choose_room.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/confirm_booking.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/dispatch_emergency.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/dispute_charge.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/flag_late_arrival.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/lookup_booking.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/lookup_guest_history.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/lookup_invoice.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/lookup_restaurant_reservation.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/modify_restaurant_reservation.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/record_card.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/record_followup.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/record_group_inquiry.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/record_guest_details.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/reinstate_booking.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/request_flight_reconfirmation.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/resend_confirmation.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/reserve_table.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/resolve_room_conflict.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/schedule_wakeup_call.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/set_do_not_disturb.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/set_extras.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/set_stay.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/start_booking_modification.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/start_room_booking.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/take_guest_message.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/transfer_call.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/update_card.ts +2 -1
- package/dist/templates/hotel-reception-agent/tools/verify_booking.ts +2 -1
- package/dist/templates/link-digest-workflow/agent.eval.test.ts +16 -1
- package/dist/templates/link-digest-workflow/agent.ts +5 -0
- package/dist/templates/medication-safety-agent/agent.test.ts +57 -4
- package/dist/templates/medication-safety-agent/agent.ts +48 -1
- package/dist/templates/meeting-recap-agent/agent.test.ts +2 -2
- package/dist/templates/meeting-recap-agent/agent.ts +4 -0
- package/dist/templates/pizza-ordering-agent/agent.eval.test.ts +68 -2
- package/dist/templates/pizza-ordering-agent/agent.ts +3 -0
- package/dist/templates/podcast-digest-workflow/agent.ts +4 -0
- package/dist/templates/push-to-talk-agent/agent.eval.test.ts +74 -0
- package/dist/templates/push-to-talk-agent/agent.test.ts +61 -0
- package/dist/templates/push-to-talk-agent/agent.ts +22 -0
- package/dist/templates/push-to-talk-agent/client.tsx +124 -0
- package/dist/templates/push-to-talk-agent/shared.ts +34 -0
- package/dist/templates/push-to-talk-agent/system-prompt.md +11 -0
- package/dist/templates/push-to-talk-agent/tools/list_notes.ts +15 -0
- package/dist/templates/push-to-talk-agent/tools/save_note.ts +26 -0
- package/dist/templates/quickstart-agent/agent.eval.test.ts +91 -3
- package/dist/templates/quickstart-agent/agent.test.ts +22 -0
- package/dist/templates/quickstart-agent/agent.ts +18 -2
- package/dist/templates/quickstart-agent/system-prompt.md +8 -0
- package/dist/templates/quickstart-agent/tools/get_weather.ts +59 -0
- package/dist/templates/research-handoff-agent/agent.eval.test.ts +1 -1
- package/dist/templates/research-handoff-agent/agent.test.ts +34 -26
- package/dist/templates/research-handoff-agent/agent.ts +4 -0
- package/dist/templates/research-planner-agent/agent.eval.test.ts +24 -2
- package/dist/templates/research-planner-agent/agent.test.ts +26 -16
- package/dist/templates/research-planner-agent/agent.ts +3 -0
- package/dist/templates/research-planner-agent/system-prompt.md +1 -1
- package/dist/templates/retail-orders-agent/agent.eval.test.ts +1 -1
- package/dist/templates/retail-orders-agent/agent.ts +32 -3
- package/dist/templates/retail-orders-agent/keyterms.ts +154 -0
- package/dist/templates/retail-orders-agent/resolve.ts +18 -3
- package/dist/templates/roadside-assistance-agent/agent.eval.test.ts +124 -5
- package/dist/templates/roadside-assistance-agent/agent.test.ts +39 -7
- package/dist/templates/roadside-assistance-agent/agent.ts +4 -0
- package/dist/templates/roadside-assistance-agent/shared.ts +12 -0
- package/dist/templates/roadside-assistance-agent/tools/acknowledge_disclosure.ts +14 -0
- package/dist/templates/roadside-assistance-agent/tools/lookup_coverage.ts +11 -0
- package/dist/templates/roadside-assistance-agent/tools/service_disclosure.ts +17 -11
- package/dist/templates/roadside-assistance-agent/yard.test.ts +4 -0
- package/dist/templates/spoken-summary-workflow/agent.ts +4 -0
- package/dist/templates/tabletop-rpg-agent/agent.eval.test.ts +6 -0
- package/dist/templates/tabletop-rpg-agent/agent.test.ts +125 -1
- package/dist/templates/tabletop-rpg-agent/agent.ts +30 -1
- package/dist/templates/tabletop-rpg-agent/shared.ts +81 -0
- package/dist/templates/tabletop-rpg-agent/system-prompt.md +1 -1
- package/dist/templates/tabletop-rpg-agent/tools/check_state.ts +16 -7
- package/dist/templates/technical-support-agent/agent.test.ts +29 -23
- package/dist/templates/technical-support-agent/agent.ts +5 -1
- package/dist/templates/technical-support-agent/knowledge.ts +165 -0
- package/dist/templates/technical-support-agent/nodes.ts +3 -2
- package/dist/templates/technical-support-agent/procedure.ts +7 -6
- package/dist/templates/technical-support-agent/shared.ts +10 -146
- package/dist/templates/technical-support-agent/tools/list_topics.ts +2 -1
- package/dist/templates/text-adventure-agent/agent.eval.test.ts +39 -6
- package/dist/templates/text-adventure-agent/agent.test.ts +79 -1
- package/dist/templates/text-adventure-agent/agent.ts +30 -1
- package/dist/templates/text-adventure-agent/shared.ts +37 -0
- package/dist/templates/text-adventure-agent/system-prompt.md +9 -2
- package/dist/templates/topic-briefing-agent/agent.eval.test.ts +18 -4
- package/dist/templates/topic-briefing-agent/agent.test.ts +61 -36
- package/dist/templates/topic-briefing-agent/agent.ts +4 -1
- package/dist/templates/topic-briefing-agent/shared.ts +19 -18
- package/dist/templates/topic-briefing-agent/system-prompt.md +13 -8
- package/dist/templates/topic-briefing-agent/tools/send_briefing.ts +43 -5
- package/dist/templates/transcription-workflow/agent.ts +3 -0
- package/dist/templates/travel-concierge-agent/agent.eval.test.ts +9 -7
- package/dist/templates/travel-concierge-agent/agent.test.ts +1 -2
- package/dist/templates/travel-concierge-agent/agent.ts +4 -0
- package/dist/templates/web-research-agent/agent.eval.test.ts +31 -5
- package/dist/templates/web-research-agent/agent.test.ts +16 -0
- package/dist/templates/web-research-agent/agent.ts +30 -0
- package/dist/templates/web-research-agent/system-prompt.md +8 -2
- package/dist/templates/word-game-agent/agent.eval.test.ts +79 -18
- package/dist/templates/word-game-agent/agent.test.ts +3 -1
- package/dist/templates/word-game-agent/agent.ts +20 -0
- package/dist/test-CjKPQ9_B.mjs +102 -0
- package/dist/test.d.ts +37 -12
- package/package.json +5 -5
- package/dist/_init-Bp1CjRrU.mjs +0 -199
- package/dist/_preflight-CcAR577V.mjs +0 -46
- package/dist/_templates-CuP74F8D.mjs +0 -291
- package/dist/init-CY4NAXAA.mjs +0 -183
- package/dist/test-PHHv0Vj6.mjs +0 -83
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A coding agent: it reads a codebase, changes it, and runs commands in it.
|
|
3
|
+
*
|
|
4
|
+
* `text: true` is the whole shape of it. A text agent has no audio path at all
|
|
5
|
+
* — no microphone, no speech, no transport — so what runs it is
|
|
6
|
+
* `createTextAgent` rather than a voice session, and a turn is a message in and
|
|
7
|
+
* a reply out. That is the right mode for work measured in files rather than in
|
|
8
|
+
* seconds of silence: a type check that takes 40 seconds is a fine tool call
|
|
9
|
+
* here and a failed turn on a phone call.
|
|
10
|
+
*
|
|
11
|
+
* The tools are the nine in `tools/`, all of them the SDK's
|
|
12
|
+
* (`@alexkroman1/aai/coding-tools`) over one directory — see `shared.ts` for
|
|
13
|
+
* which directory, which is the one decision worth making deliberately before
|
|
14
|
+
* running this.
|
|
15
|
+
*
|
|
16
|
+
* ## Making it yours
|
|
17
|
+
*
|
|
18
|
+
* - **`system-prompt.md` is the agent.** The tools are generic; how carefully
|
|
19
|
+
* it reads before it edits, whether it runs the tests, what it does when it
|
|
20
|
+
* is unsure — all of that is prose in that file, and it is where the first
|
|
21
|
+
* twenty edits go.
|
|
22
|
+
* - **Add a tool by adding a FILE** to `tools/`. The nine here re-export a
|
|
23
|
+
* shared registry; yours is an ordinary `tool({ … })`, and the build
|
|
24
|
+
* enumerates the directory either way.
|
|
25
|
+
* - **`maxSteps` is a budget for a whole task**, not a turn of conversation.
|
|
26
|
+
* Reading four files, editing two and running the tests is already eight
|
|
27
|
+
* calls, and the default (10) is sized for a voice agent's single answer.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { agent } from "@alexkroman1/aai";
|
|
31
|
+
|
|
32
|
+
export default agent({
|
|
33
|
+
name: "Coding Agent",
|
|
34
|
+
description: "Reads, edits and runs a codebase from a terminal chat",
|
|
35
|
+
// No `llm` declared, so it runs the default AssemblyAI LLM gateway on
|
|
36
|
+
// ASSEMBLYAI_API_KEY. Swap in `llm({ provider: "anthropic", model: "claude-opus-5" })` (or
|
|
37
|
+
// any provider from `@alexkroman1/aai/llm`) when a task needs a stronger
|
|
38
|
+
// model — the credential follows the descriptor.
|
|
39
|
+
text: true,
|
|
40
|
+
// Long, deliberately: a real change is read-read-edit-run-fix, and a budget
|
|
41
|
+
// that runs out mid-task leaves a half-applied edit behind. The last step is
|
|
42
|
+
// always spent ANSWERING rather than calling another tool, so a capped task
|
|
43
|
+
// ends with the agent saying where it got to.
|
|
44
|
+
maxSteps: 60,
|
|
45
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run the agent from a terminal: `node chat.ts` (Node 24 runs TypeScript
|
|
3
|
+
* directly), then type a request and press enter.
|
|
4
|
+
*
|
|
5
|
+
* A text agent has no session, so this file is its front door rather than
|
|
6
|
+
* `aai dev`: `createRuntime` REFUSES `text: true` by name, because there are no
|
|
7
|
+
* speech stages for a transport to sit between and no socket for a browser to
|
|
8
|
+
* open. What runs it instead is `createTextAgent` — a message list and a model.
|
|
9
|
+
* Everything else an agent has is the same code a voice agent runs: the tools,
|
|
10
|
+
* the tool executor and its per-call deadline, `ctx`, the step budget, and the
|
|
11
|
+
* last step reserved for an answer.
|
|
12
|
+
*
|
|
13
|
+
* Four lines are doing the interesting work:
|
|
14
|
+
*
|
|
15
|
+
* - `withToolsDir` is what makes a tool a FILE here. A deployed agent gets its
|
|
16
|
+
* tools from the bundler, which enumerates `tools/` at build time; a plain
|
|
17
|
+
* Node process has no bundler, so it reads the directory itself. Without it,
|
|
18
|
+
* `agent.ts`'s default export is an agent with no tools at all.
|
|
19
|
+
* - `env` is where the LLM's credential is read from, and it is also what tool
|
|
20
|
+
* code sees as `ctx.env` — so pass what the agent needs and nothing else.
|
|
21
|
+
* - `toolTimeoutMs` replaces the SDK's default of 30 seconds, which is a VOICE
|
|
22
|
+
* budget: past it a caller is listening to silence, so a slow tool is already
|
|
23
|
+
* a failed turn. Nobody is on a phone here, and a type check or an install is
|
|
24
|
+
* a minute of honest work.
|
|
25
|
+
* - The conversation is a `ModelMessage[]` this file keeps. One `createTextAgent`
|
|
26
|
+
* is one conversation, and what carries the history between turns is the
|
|
27
|
+
* array — so this is also where you would trim it, persist it, or start over.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import path from "node:path";
|
|
31
|
+
import { createInterface } from "node:readline/promises";
|
|
32
|
+
import { createTextAgent, withToolsDir } from "@alexkroman1/aai-runtime";
|
|
33
|
+
import agentDef from "./agent.ts";
|
|
34
|
+
import { WORKSPACE_DIR } from "./shared.ts";
|
|
35
|
+
|
|
36
|
+
const agent = await withToolsDir(agentDef, path.join(import.meta.dirname, "tools"));
|
|
37
|
+
|
|
38
|
+
const chat = createTextAgent({
|
|
39
|
+
agent,
|
|
40
|
+
env: { ASSEMBLYAI_API_KEY: process.env.ASSEMBLYAI_API_KEY ?? "" },
|
|
41
|
+
toolTimeoutMs: 120_000,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// The turn's own message type, read off `stream` rather than imported from
|
|
45
|
+
// `ai` — a project scaffolded from this template declares the SDK packages and
|
|
46
|
+
// not the vendor's, and this needs no second dependency to say the same thing.
|
|
47
|
+
const messages: Parameters<typeof chat.stream>[0]["messages"] = [];
|
|
48
|
+
const io = createInterface({ input: process.stdin, output: process.stdout });
|
|
49
|
+
console.log(`Working in ${WORKSPACE_DIR}\n(ctrl-c to quit)\n`);
|
|
50
|
+
|
|
51
|
+
for (;;) {
|
|
52
|
+
const line = (await io.question("> ")).trim();
|
|
53
|
+
if (line.length === 0) continue;
|
|
54
|
+
messages.push({ role: "user", content: line });
|
|
55
|
+
const result = chat.stream({ messages });
|
|
56
|
+
// Printed as it arrives: a turn that reads four files and edits two is a
|
|
57
|
+
// long wait, and a spinner tells you less than the reply does.
|
|
58
|
+
for await (const delta of result.textStream) process.stdout.write(delta);
|
|
59
|
+
// Every message the turn produced — the assistant's own, plus one per tool
|
|
60
|
+
// call and result — so the next turn sees what this one did.
|
|
61
|
+
messages.push(...(await result.response).messages);
|
|
62
|
+
process.stdout.write("\n\n");
|
|
63
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createCodingTools } from "@alexkroman1/aai/coding-tools";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Where the agent may read and write.
|
|
5
|
+
*
|
|
6
|
+
* Everything the tools do is resolved against this directory and nothing
|
|
7
|
+
* outside it is reachable — a path that escapes is refused rather than
|
|
8
|
+
* followed, whatever the model asks for. So this is the ONE line that decides
|
|
9
|
+
* how much of the machine this agent can touch, and it is worth being
|
|
10
|
+
* deliberate about it: point it at a project, a scratch checkout, or a
|
|
11
|
+
* container's `/workspace`, and not at a home directory.
|
|
12
|
+
*
|
|
13
|
+
* `bash` is the reason to say that plainly. It runs whatever the model wrote
|
|
14
|
+
* with the authority of this process — which is the same authority the write
|
|
15
|
+
* and delete tools already have, so it grants nothing new; what it does is make
|
|
16
|
+
* the grant obvious. Run this agent inside a container and treat the container
|
|
17
|
+
* as the boundary.
|
|
18
|
+
*/
|
|
19
|
+
export const WORKSPACE_DIR = process.env.WORKSPACE_DIR ?? process.cwd();
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The agent's tools, built ONCE over {@link WORKSPACE_DIR}.
|
|
23
|
+
*
|
|
24
|
+
* A tool is normally a FILE — `agent()` takes no `tools` argument, and the
|
|
25
|
+
* build enumerates `tools/`. These nine are files too (see the directory
|
|
26
|
+
* beside this one), but each one re-exports an entry from this registry rather
|
|
27
|
+
* than declaring a tool of its own, because every one of them closes over the
|
|
28
|
+
* same directory: nine `createCodingTools` calls would be nine chances for one
|
|
29
|
+
* of them to be pointed somewhere else.
|
|
30
|
+
*
|
|
31
|
+
* Three seams are worth knowing about before you extend this
|
|
32
|
+
* (`CodingToolsOptions` carries the rest):
|
|
33
|
+
*
|
|
34
|
+
* - `validate` refuses a write BEFORE it lands — return a message and the file
|
|
35
|
+
* on disk is untouched. Parsing the content is the useful check: a file that
|
|
36
|
+
* does not parse cannot be edited back into shape by text matching, so
|
|
37
|
+
* writing it strands the turn.
|
|
38
|
+
* - `afterWrite` appends to a write that SUCCEEDED, which is where a type
|
|
39
|
+
* checker or a linter's output belongs — the agent reads it inside the
|
|
40
|
+
* result of the write that caused it, and fixes it on the next step instead
|
|
41
|
+
* of discovering it a build later.
|
|
42
|
+
* - `env` is what `bash` runs with. It defaults to this process's environment;
|
|
43
|
+
* hand it an allow-list when this agent is running somewhere that holds
|
|
44
|
+
* credentials it has no business reading.
|
|
45
|
+
*/
|
|
46
|
+
export const codingTools = createCodingTools({ dir: WORKSPACE_DIR });
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
You are a coding agent working in one directory. You read code, change it, and run commands in it, and you report what you did in plain prose.
|
|
2
|
+
|
|
3
|
+
You are working with a colleague, not performing for one. Say what you found and what you changed. Do not narrate every tool call, and do not summarize the conversation back at the end of every turn.
|
|
4
|
+
|
|
5
|
+
HOW TO WORK
|
|
6
|
+
|
|
7
|
+
- READ BEFORE YOU EDIT. Never change a file you have not read this conversation, and never write one from what you assume its contents to be. `grep` and `glob` find things far more cheaply than reading whole files — use them to locate, then read the file that matters.
|
|
8
|
+
- PREFER `edit_file`. It replaces one exact snippet and shows you the diff. `write_file` is for a new file or a genuine wholesale rewrite; using it for a small change is how code that was supposed to stay gets silently dropped.
|
|
9
|
+
- MATCH THE CODE AROUND YOU. Read a neighbouring file before adding one. Naming, error handling, comment density, and test style are decisions this project already made — follow them rather than importing your own.
|
|
10
|
+
- VERIFY WHAT YOU CHANGED. If the project has tests, a linter or a type checker, run them with `bash` and fix what they report. A change you have not run is a change you are guessing about, and saying so is better than implying otherwise.
|
|
11
|
+
- WORK IN PARALLEL WHERE IT IS SAFE. Independent reads, searches and writes can be issued in one step; edits to the same file cannot.
|
|
12
|
+
|
|
13
|
+
WHEN SOMETHING IS UNCLEAR
|
|
14
|
+
|
|
15
|
+
- Ask, rather than guessing, when two readings of the request would produce materially different work. Ask once, in one sentence, and say what you would do by default.
|
|
16
|
+
- Do the part you are sure of first. If a request has four steps and one is ambiguous, do the three and name the fourth.
|
|
17
|
+
- If a request would break something you can see, say so in a sentence, then do what was asked unless it is destructive.
|
|
18
|
+
|
|
19
|
+
WHAT NOT TO DO
|
|
20
|
+
|
|
21
|
+
- Do not delete or overwrite files that were not part of the request.
|
|
22
|
+
- Do not run destructive shell commands (`rm -rf`, `git reset --hard`, anything that force-pushes or drops data) unless the request is explicitly about that.
|
|
23
|
+
- Do not disable, skip or delete a failing test to make a check pass. A failing test is a finding; report it.
|
|
24
|
+
- Do not add dependencies, reformat files wholesale, or "clean up" code the request did not mention.
|
|
25
|
+
|
|
26
|
+
PLANNING
|
|
27
|
+
|
|
28
|
+
Use `todo_write` for work with several distinct steps — a change plus its tests, or three separate capabilities. Write the steps up front, keep exactly one `in_progress`, and resend the list as statuses change; the person you are working with reads it as your progress report. Skip it entirely for a question or a one-file change.
|
|
29
|
+
|
|
30
|
+
REPORTING
|
|
31
|
+
|
|
32
|
+
When you finish, say what you changed and where, in one short paragraph or a few lines — file paths, not a diff, which they can read for themselves. If you left something out, or a check is still failing, say that too, plainly and without apologising for it.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { codingTools } from "../shared.ts";
|
|
2
|
+
|
|
3
|
+
// A tool is its FILE, so the name the model calls is this file's name. The
|
|
4
|
+
// definition itself is one entry of the shared registry — see `../shared.ts`
|
|
5
|
+
// for why all nine are built together rather than one per file.
|
|
6
|
+
export default codingTools.bash;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { codingTools } from "../shared.ts";
|
|
2
|
+
|
|
3
|
+
// A tool is its FILE, so the name the model calls is this file's name. The
|
|
4
|
+
// definition itself is one entry of the shared registry — see `../shared.ts`
|
|
5
|
+
// for why all nine are built together rather than one per file.
|
|
6
|
+
export default codingTools.delete_file;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { codingTools } from "../shared.ts";
|
|
2
|
+
|
|
3
|
+
// A tool is its FILE, so the name the model calls is this file's name. The
|
|
4
|
+
// definition itself is one entry of the shared registry — see `../shared.ts`
|
|
5
|
+
// for why all nine are built together rather than one per file.
|
|
6
|
+
export default codingTools.edit_file;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { codingTools } from "../shared.ts";
|
|
2
|
+
|
|
3
|
+
// A tool is its FILE, so the name the model calls is this file's name. The
|
|
4
|
+
// definition itself is one entry of the shared registry — see `../shared.ts`
|
|
5
|
+
// for why all nine are built together rather than one per file.
|
|
6
|
+
export default codingTools.glob;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { codingTools } from "../shared.ts";
|
|
2
|
+
|
|
3
|
+
// A tool is its FILE, so the name the model calls is this file's name. The
|
|
4
|
+
// definition itself is one entry of the shared registry — see `../shared.ts`
|
|
5
|
+
// for why all nine are built together rather than one per file.
|
|
6
|
+
export default codingTools.grep;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { codingTools } from "../shared.ts";
|
|
2
|
+
|
|
3
|
+
// A tool is its FILE, so the name the model calls is this file's name. The
|
|
4
|
+
// definition itself is one entry of the shared registry — see `../shared.ts`
|
|
5
|
+
// for why all nine are built together rather than one per file.
|
|
6
|
+
export default codingTools.list_files;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { codingTools } from "../shared.ts";
|
|
2
|
+
|
|
3
|
+
// A tool is its FILE, so the name the model calls is this file's name. The
|
|
4
|
+
// definition itself is one entry of the shared registry — see `../shared.ts`
|
|
5
|
+
// for why all nine are built together rather than one per file.
|
|
6
|
+
export default codingTools.read_file;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { codingTools } from "../shared.ts";
|
|
2
|
+
|
|
3
|
+
// A tool is its FILE, so the name the model calls is this file's name. The
|
|
4
|
+
// definition itself is one entry of the shared registry — see `../shared.ts`
|
|
5
|
+
// for why all nine are built together rather than one per file.
|
|
6
|
+
export default codingTools.todo_write;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { codingTools } from "../shared.ts";
|
|
2
|
+
|
|
3
|
+
// A tool is its FILE, so the name the model calls is this file's name. The
|
|
4
|
+
// definition itself is one entry of the shared registry — see `../shared.ts`
|
|
5
|
+
// for why all nine are built together rather than one per file.
|
|
6
|
+
export default codingTools.write_file;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { agent } from "@alexkroman1/aai";
|
|
2
|
-
import {
|
|
2
|
+
import { llm } from "@alexkroman1/aai/llm";
|
|
3
3
|
|
|
4
4
|
export default agent({
|
|
5
5
|
name: "Custom Pipeline Assistant",
|
|
6
|
+
description: "Answers general questions on a pipeline whose stages you swap one at a time",
|
|
6
7
|
greeting: "Hi! I'm running in pipeline mode. What can I help with?",
|
|
7
8
|
// Declare only the stage you want elsewhere — here the LLM. Every stage
|
|
8
9
|
// left unset (STT and TTS here) runs on the AssemblyAI default, billed to
|
|
9
10
|
// the one key a published agent is guaranteed to have, so swapping a stage
|
|
10
11
|
// never means restating the other two.
|
|
11
|
-
llm:
|
|
12
|
+
llm: llm({ provider: "anthropic", model: "claude-haiku-4-5" }),
|
|
12
13
|
});
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
type SharedAgentParams,
|
|
24
24
|
type TextAgentParams,
|
|
25
25
|
} from "@alexkroman1/aai";
|
|
26
|
-
import {
|
|
26
|
+
import { llm } from "@alexkroman1/aai/llm";
|
|
27
27
|
import { toAgentConfig } from "@alexkroman1/aai/manifest";
|
|
28
28
|
import { describe, expect, test } from "vitest";
|
|
29
29
|
|
|
@@ -55,7 +55,7 @@ describe("three modes, three arms", () => {
|
|
|
55
55
|
// all-AssemblyAI preset.
|
|
56
56
|
pipeline: {
|
|
57
57
|
...SHARED,
|
|
58
|
-
llm:
|
|
58
|
+
llm: llm({ provider: "anthropic", model: "claude-haiku-4-5" }),
|
|
59
59
|
} satisfies PipelineAgentParams,
|
|
60
60
|
// S2S replaces all three with one service-side loop.
|
|
61
61
|
s2s: { ...SHARED, s2s: assemblyAIS2s() } satisfies S2sAgentParams,
|
|
@@ -94,13 +94,13 @@ test("the preset takes OPTIONS — one setting across the three stages at once",
|
|
|
94
94
|
const options: AssemblyAIPipelineOptions = { region: "eu", voice: "michael" };
|
|
95
95
|
const pipeline = assemblyAIPipeline(options);
|
|
96
96
|
expect(pipeline.stt.options.region).toBe("eu");
|
|
97
|
-
expect(pipeline.llm.options.
|
|
97
|
+
expect(pipeline.llm.options.providerOptions).toMatchObject({ region: "eu" });
|
|
98
98
|
expect(pipeline.tts.options.voice).toBe("michael");
|
|
99
99
|
|
|
100
100
|
// And a stage declared AFTER the spread still wins — that is the whole point
|
|
101
101
|
// of it being a plain object, and it is how this template's own `agent.ts`
|
|
102
102
|
// would read if it wanted the other two stages visible in the config.
|
|
103
|
-
const mine =
|
|
103
|
+
const mine = llm({ provider: "anthropic", model: "claude-haiku-4-5" });
|
|
104
104
|
expect(agent({ ...SHARED, ...pipeline, llm: mine }).llm).toBe(mine);
|
|
105
105
|
});
|
|
106
106
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* The provider catalog: every stage, every vendor, as compiling code.
|
|
3
3
|
*
|
|
4
4
|
* `agent.ts` declares ONE stage, because an agent should. This file is the menu
|
|
5
|
-
* it picked that line off — the shape of each of the other
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* it picked that line off — the shape of each of the other provider factories,
|
|
6
|
+
* the option type each takes, and the published constants an author needs to
|
|
7
|
+
* spell a default out loud.
|
|
8
8
|
*
|
|
9
9
|
* It lives in the spec rather than in `agent.ts` for a reason worth copying: a
|
|
10
10
|
* deployed agent needs a key per vendor it names, and the all-AssemblyAI
|
|
@@ -21,32 +21,14 @@
|
|
|
21
21
|
import type { ProviderCredentialOptions, ProviderDescriptor } from "@alexkroman1/aai";
|
|
22
22
|
import { agent } from "@alexkroman1/aai";
|
|
23
23
|
import {
|
|
24
|
-
type AnthropicLlmOptions,
|
|
25
24
|
ASSEMBLYAI_LLM_DEFAULT_MODEL,
|
|
26
|
-
ASSEMBLYAI_LLM_GATEWAY_EU_URL,
|
|
27
|
-
ASSEMBLYAI_LLM_GATEWAY_URL,
|
|
28
25
|
type AssemblyAIGatewayModel,
|
|
29
|
-
type
|
|
26
|
+
type AssemblyAILlmProviderOptions,
|
|
30
27
|
type AssemblyAIReasoningEffort,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
type GatewayLlmOptions,
|
|
34
|
-
type GoogleLlmOptions,
|
|
35
|
-
type GroqLlmOptions,
|
|
36
|
-
gatewayLlm,
|
|
37
|
-
googleLlm,
|
|
38
|
-
groqLlm,
|
|
28
|
+
type KnownLlmProvider,
|
|
29
|
+
type LlmOptions,
|
|
39
30
|
type LlmProvider,
|
|
40
|
-
|
|
41
|
-
type ModelOptions,
|
|
42
|
-
mistralLlm,
|
|
43
|
-
OPENROUTER_BASE_URL,
|
|
44
|
-
type OpenAILlmOptions,
|
|
45
|
-
type OpenRouterLlmOptions,
|
|
46
|
-
openAILlm,
|
|
47
|
-
openRouterLlm,
|
|
48
|
-
type XAILlmOptions,
|
|
49
|
-
xAILlm,
|
|
31
|
+
llm,
|
|
50
32
|
} from "@alexkroman1/aai/llm";
|
|
51
33
|
import { toAgentConfig } from "@alexkroman1/aai/manifest";
|
|
52
34
|
import {
|
|
@@ -107,41 +89,54 @@ function shape(stage: ProviderDescriptor<string, Record<string, unknown>>): stri
|
|
|
107
89
|
return `${stage.kind}(${Object.keys(stage.options).sort().join(", ")})`;
|
|
108
90
|
}
|
|
109
91
|
|
|
110
|
-
describe("the LLM stage:
|
|
111
|
-
test("
|
|
112
|
-
// Keyed BY the
|
|
113
|
-
// the wrong kind fails on its own row rather than in an aggregate.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
xai:
|
|
92
|
+
describe("the LLM stage: one factory, the provider is data", () => {
|
|
93
|
+
test("`llm({ provider })` returns a descriptor whose `kind` IS the provider", () => {
|
|
94
|
+
// Keyed BY the provider, so the table is its own assertion: a descriptor
|
|
95
|
+
// with the wrong kind fails on its own row rather than in an aggregate.
|
|
96
|
+
// `KnownLlmProvider` is the autocomplete; the field itself is open.
|
|
97
|
+
const byProvider: Record<KnownLlmProvider, LlmProvider> = {
|
|
98
|
+
anthropic: llm({ provider: "anthropic", model: "claude-haiku-4-5" }),
|
|
99
|
+
assemblyai: llm({ provider: "assemblyai", model: ASSEMBLYAI_LLM_DEFAULT_MODEL }),
|
|
100
|
+
cerebras: llm({ provider: "cerebras", model: "qwen-3.8-27b" }),
|
|
101
|
+
gateway: llm({ provider: "gateway", model: "zai/glm-4.6" }),
|
|
102
|
+
google: llm({ provider: "google", model: "gemini-2.5-flash" }),
|
|
103
|
+
groq: llm({ provider: "groq", model: "llama-3.3-70b-versatile" }),
|
|
104
|
+
mistral: llm({ provider: "mistral", model: "mistral-large-latest" }),
|
|
105
|
+
openai: llm({ provider: "openai", model: "gpt-5-mini" }),
|
|
106
|
+
openrouter: llm({ provider: "openrouter", model: "meta-llama/llama-3.3-70b-instruct" }),
|
|
107
|
+
xai: llm({ provider: "xai", model: "grok-4" }),
|
|
126
108
|
};
|
|
127
109
|
|
|
128
|
-
for (const [kind,
|
|
129
|
-
expect(
|
|
110
|
+
for (const [kind, stage] of Object.entries(byProvider)) {
|
|
111
|
+
expect(stage.kind, kind).toBe(kind);
|
|
130
112
|
// And it survives the conversion a deploy runs, which is the claim that
|
|
131
113
|
// matters: a descriptor the config drops is a stage that silently isn't.
|
|
132
|
-
expect(toAgentConfig(agent({ name: NAME, llm })).llm?.kind, kind).toBe(kind);
|
|
114
|
+
expect(toAgentConfig(agent({ name: NAME, llm: stage })).llm?.kind, kind).toBe(kind);
|
|
133
115
|
}
|
|
134
116
|
});
|
|
135
117
|
|
|
136
|
-
test("
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
118
|
+
test("swapping vendors is a one-word edit: every provider takes the same options", () => {
|
|
119
|
+
// One options type for all of them — a model id, plus the optional
|
|
120
|
+
// `baseUrl`, `apiKeyEnv` and `providerOptions` — which is why there is no
|
|
121
|
+
// per-vendor factory to learn.
|
|
122
|
+
const options: LlmOptions<"openai"> = { provider: "openai", model: "gpt-5-mini" };
|
|
123
|
+
expect(shape(llm(options))).toBe("openai(model)");
|
|
124
|
+
expect(shape(llm({ ...options, provider: "google", model: "gemini-2.5-flash" }))).toBe(
|
|
125
|
+
"google(model)",
|
|
126
|
+
);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test("an unlisted provider is reached by naming its OpenAI-compatible endpoint", () => {
|
|
130
|
+
// `provider` is open (`KnownLlmProvider | (string & {})`): a vendor this
|
|
131
|
+
// release has not heard of compiles, and `baseUrl` is what the host
|
|
132
|
+
// resolver dials it through. `aai build` warns about one with neither.
|
|
133
|
+
const stage = llm({
|
|
134
|
+
provider: "my-inference-host",
|
|
135
|
+
model: "my-model",
|
|
136
|
+
baseUrl: "https://inference.example.com/v1",
|
|
137
|
+
apiKeyEnv: "MY_INFERENCE_KEY",
|
|
138
|
+
});
|
|
139
|
+
expect(shape(stage)).toBe("my-inference-host(apiKeyEnv, baseUrl, model)");
|
|
145
140
|
});
|
|
146
141
|
|
|
147
142
|
test("`apiKeyEnv` renames the variable the platform reads for this stage", () => {
|
|
@@ -153,32 +148,31 @@ describe("the LLM stage: nine vendors, one field", () => {
|
|
|
153
148
|
// field only changes WHICH variable it reads, for an agent that keeps two
|
|
154
149
|
// OpenAI keys, or names the vendor's key something of its own.
|
|
155
150
|
const credential: ProviderCredentialOptions = { apiKeyEnv: "TEAM_OPENAI_KEY" };
|
|
156
|
-
const
|
|
157
|
-
expect(
|
|
151
|
+
const stage = llm({ provider: "openai", model: "gpt-5-mini", ...credential });
|
|
152
|
+
expect(stage.options.apiKeyEnv).toBe("TEAM_OPENAI_KEY");
|
|
158
153
|
// Not a secret and not a value — the NAME of an env var, so it is safe in
|
|
159
154
|
// the bundle. Nothing here reads `process.env`.
|
|
160
|
-
expect(
|
|
155
|
+
expect(stage.options.model).toBe("gpt-5-mini");
|
|
161
156
|
});
|
|
162
157
|
|
|
163
|
-
test("the AssemblyAI gateway is the one
|
|
158
|
+
test("the AssemblyAI gateway is the one with a published default model", () => {
|
|
164
159
|
// The stage `agent.ts` leaves unset. It bills to `ASSEMBLYAI_API_KEY` — the
|
|
165
160
|
// one key a published agent is guaranteed to have — so its default model is
|
|
166
|
-
// published rather than implied
|
|
167
|
-
|
|
168
|
-
expect(assemblyAILlm().options.model).toBe(ASSEMBLYAI_LLM_DEFAULT_MODEL);
|
|
161
|
+
// published rather than implied.
|
|
162
|
+
expect(typeof ASSEMBLYAI_LLM_DEFAULT_MODEL).toBe("string");
|
|
169
163
|
// A gateway id is a free-form string the service rejects with a 400 at the
|
|
170
|
-
// first session
|
|
171
|
-
//
|
|
172
|
-
//
|
|
173
|
-
// compiles.
|
|
164
|
+
// first session, so an invented one ships. `AssemblyAIGatewayModel`
|
|
165
|
+
// autocompletes the ids this release knows, and stays open so a model
|
|
166
|
+
// shipped after it still compiles.
|
|
174
167
|
const model: AssemblyAIGatewayModel = "claude-sonnet-4-6";
|
|
175
168
|
// On a voice line, time-to-first-token IS the quality: the measured cost of
|
|
176
169
|
// leaving a reasoning model on its server-side default was 1786ms p50
|
|
177
170
|
// against 999ms with reasoning off.
|
|
178
171
|
const reasoningEffort: AssemblyAIReasoningEffort = "none";
|
|
179
|
-
|
|
172
|
+
const providerOptions: AssemblyAILlmProviderOptions = { reasoningEffort };
|
|
173
|
+
expect(llm({ provider: "assemblyai", model, providerOptions }).options).toMatchObject({
|
|
180
174
|
model,
|
|
181
|
-
reasoningEffort,
|
|
175
|
+
providerOptions: { reasoningEffort },
|
|
182
176
|
});
|
|
183
177
|
});
|
|
184
178
|
});
|
|
@@ -186,33 +180,31 @@ describe("the LLM stage: nine vendors, one field", () => {
|
|
|
186
180
|
describe("EU residency: a shorthand, and the URL it is short for", () => {
|
|
187
181
|
test("`region` sets STT and the LLM gateway; TTS has a single endpoint", () => {
|
|
188
182
|
expect(assemblyAIStt({ region: "eu" }).options.region).toBe("eu");
|
|
189
|
-
|
|
183
|
+
const stage = llm({
|
|
184
|
+
provider: "assemblyai",
|
|
185
|
+
model: "claude-sonnet-4-6",
|
|
186
|
+
providerOptions: { region: "eu" },
|
|
187
|
+
});
|
|
188
|
+
expect(stage.options.providerOptions).toEqual({ region: "eu" });
|
|
190
189
|
});
|
|
191
190
|
|
|
192
191
|
test("an explicit endpoint is the long form, and it WINS over `region`", () => {
|
|
193
192
|
// Naming a URL is deliberate, so the residency shorthand must not silently
|
|
194
|
-
// overwrite it
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
// half a bare `region: "eu"` cannot do for you.
|
|
193
|
+
// overwrite it — and an EU agent must also pick a model the EU gateway
|
|
194
|
+
// carries (Claude and most Gemini ids), which is the half a bare
|
|
195
|
+
// `region: "eu"` cannot do for you.
|
|
198
196
|
const stt = assemblyAIStt({
|
|
199
197
|
streamingUrl: ASSEMBLYAI_STT_EU_URL,
|
|
200
198
|
} satisfies AssemblyAISttOptions);
|
|
201
|
-
const
|
|
202
|
-
|
|
199
|
+
const stage = llm({
|
|
200
|
+
provider: "assemblyai",
|
|
203
201
|
model: "claude-sonnet-4-6",
|
|
202
|
+
baseUrl: "https://llm-gateway.eu.assemblyai.com/v1",
|
|
204
203
|
});
|
|
205
204
|
expect(stt.options.streamingUrl).toBe(ASSEMBLYAI_STT_EU_URL);
|
|
206
|
-
|
|
207
|
-
// The
|
|
208
|
-
|
|
209
|
-
// bases and carry the version path, so they drop into an OpenAI client as
|
|
210
|
-
// they are; `OPENROUTER_BASE_URL` is the third of that shape. The streaming
|
|
211
|
-
// one is a WebSocket URL and carries its own versioned path.
|
|
212
|
-
for (const url of [ASSEMBLYAI_LLM_GATEWAY_URL, OPENROUTER_BASE_URL]) {
|
|
213
|
-
expect(new URL(url).protocol).toBe("https:");
|
|
214
|
-
expect(url.endsWith("/v1"), url).toBe(true);
|
|
215
|
-
}
|
|
205
|
+
// An OpenAI-compatible base carries the version path; the client appends
|
|
206
|
+
// `/chat/completions`. The streaming one is a WebSocket URL.
|
|
207
|
+
expect(stage.options.baseUrl?.toString().endsWith("/v1")).toBe(true);
|
|
216
208
|
expect(new URL(ASSEMBLYAI_STT_EU_URL).protocol).toBe("wss:");
|
|
217
209
|
});
|
|
218
210
|
});
|
|
@@ -103,6 +103,8 @@ export const redline = workflow({
|
|
|
103
103
|
|
|
104
104
|
export default workflowApp({
|
|
105
105
|
name: "Redline",
|
|
106
|
+
description:
|
|
107
|
+
"Takes a brief or a draft and returns a piece that has been through rounds of critique",
|
|
106
108
|
workflows: { redline },
|
|
107
109
|
// Checked at deploy time, so a missing key is a warning naming it rather than
|
|
108
110
|
// a run that fails on its first step.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* this file SHIPS — it is what a scaffolded project runs.
|
|
15
15
|
*/
|
|
16
16
|
import dispatchAgent from "virtual:aai/agent";
|
|
17
|
-
import type { SessionEvent } from "@alexkroman1/aai
|
|
17
|
+
import type { SessionEvent } from "@alexkroman1/aai";
|
|
18
18
|
// An EVAL: does the desk actually behave? Run it with `aai eval`.
|
|
19
19
|
//
|
|
20
20
|
// `agent.test.ts` drives each tool directly. What it cannot ask is whether the
|