@alexkroman1/aai-cli 5.3.0 → 5.4.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 +51 -0
- package/dist/{_bundler-DFS4xxqE.mjs → _bundler-Cjaxa2wi.mjs} +1 -1
- package/dist/{_dev-server-BBUWo0sb.mjs → _dev-server-cigzayJe.mjs} +2 -2
- package/dist/{_init-DU-sXH6S.mjs → _init-_G8l4lh2.mjs} +2 -55
- package/dist/_templates-DW9CvuDN.mjs +69 -0
- package/dist/_templates.d.ts +6 -0
- package/dist/{build-Xq1xxoSg.mjs → build-D_PgQOD4.mjs} +1 -1
- package/dist/cli.mjs +35 -10
- package/dist/{client-bundler-BWDkUeEP.mjs → client-bundler-yiWoXrgb.mjs} +3 -0
- package/dist/client-bundler.d.ts +9 -0
- package/dist/client-bundler.mjs +1 -1
- package/dist/{deploy-Ci0X1gp2.mjs → deploy-C0VLnnJe.mjs} +1 -1
- package/dist/{dev-g7sGt8qX.mjs → dev-2oUsvgRX.mjs} +1 -1
- package/dist/{init-BjeK8crW.mjs → init-BkW9BuZF.mjs} +2 -2
- package/dist/scaffold/CLAUDE.md +154 -100
- package/dist/scaffold/package.json +3 -3
- package/dist/templates/dispatch-center/agent.test.ts +3 -3
- package/dist/templates/dispatch-center/agent.ts +2 -2
- package/dist/templates/dispatch-center/tools/incident_add_note.ts +1 -1
- package/dist/templates/dispatch-center/tools/incident_create.ts +1 -1
- package/dist/templates/dispatch-center/tools/incident_escalate.ts +1 -1
- package/dist/templates/dispatch-center/tools/incident_get.ts +1 -1
- package/dist/templates/dispatch-center/tools/incident_triage.ts +1 -1
- package/dist/templates/dispatch-center/tools/incident_update_status.ts +1 -1
- package/dist/templates/dispatch-center/tools/ops_protocols.ts +1 -1
- package/dist/templates/dispatch-center/tools/ops_run_scenario.ts +1 -1
- package/dist/templates/dispatch-center/tools/resources_dispatch.ts +1 -1
- package/dist/templates/dispatch-center/tools/resources_get_available.ts +1 -1
- package/dist/templates/dispatch-center/tools/resources_update_status.ts +1 -1
- package/dist/templates/embedded-assets/agent.ts +1 -1
- package/dist/templates/health-assistant/agent.ts +2 -2
- package/dist/templates/infocom-adventure/agent.ts +7 -7
- package/dist/templates/math-buddy/agent.ts +1 -1
- package/dist/templates/night-owl/agent.ts +1 -1
- package/dist/templates/pizza-ordering/agent.test.ts +13 -11
- package/dist/templates/pizza-ordering/agent.ts +4 -4
- package/dist/templates/simple/agent.test.ts +18 -0
- package/dist/templates/simple/agent.ts +2 -0
- package/dist/templates/solo-rpg/agent.test.ts +2 -2
- package/dist/templates/solo-rpg/tools/action_roll.ts +1 -1
- package/dist/templates/solo-rpg/tools/load_game.ts +1 -1
- package/dist/templates/solo-rpg/tools/oracle.ts +1 -1
- package/dist/templates/solo-rpg/tools/save_game.ts +1 -1
- package/dist/templates/solo-rpg/tools/setup_character.ts +1 -1
- package/dist/templates/solo-rpg/tools/update_state.ts +1 -1
- package/dist/typecheck.d.ts +18 -0
- package/dist/typecheck.mjs +8 -0
- package/dist/worker-bundler.d.ts +9 -1
- package/dist/worker-bundler.mjs +8 -0
- package/package.json +3 -3
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
export const incidentCreate = tool({
|
|
15
15
|
description: "Create a new incident from an incoming emergency call.",
|
|
16
|
-
|
|
16
|
+
inputSchema: z.object({
|
|
17
17
|
location: z.string().max(300).describe("Address or location description"),
|
|
18
18
|
description: z.string().max(2000).describe("Nature of the emergency as described by caller"),
|
|
19
19
|
callerName: z.string().max(120).describe("Caller's name").optional(),
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
|
|
12
12
|
export const incidentEscalate = tool({
|
|
13
13
|
description: "Escalate an incident when it exceeds current capacity or severity increases.",
|
|
14
|
-
|
|
14
|
+
inputSchema: z.object({
|
|
15
15
|
incidentId: z.string().max(20).describe("The incident ID"),
|
|
16
16
|
reason: z.string().max(1000).describe("Reason for escalation"),
|
|
17
17
|
requestMutualAid: z
|
|
@@ -4,7 +4,7 @@ import { findIncident, getApplicableProtocols, getState, incidentAgeMinutes } fr
|
|
|
4
4
|
|
|
5
5
|
export const incidentGet = tool({
|
|
6
6
|
description: "Get full details on a specific incident including timeline and assigned resources.",
|
|
7
|
-
|
|
7
|
+
inputSchema: z.object({
|
|
8
8
|
incidentId: z.string().max(20).describe("The incident ID"),
|
|
9
9
|
}),
|
|
10
10
|
async execute(args, ctx) {
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
export const incidentTriage = tool({
|
|
16
16
|
description:
|
|
17
17
|
"Triage an incident — confirm or override severity, type, hazards, and casualty count.",
|
|
18
|
-
|
|
18
|
+
inputSchema: z.object({
|
|
19
19
|
incidentId: z.string().max(20).describe("The incident ID"),
|
|
20
20
|
severity: z.enum(SEVERITIES).describe("Confirmed severity after triage").optional(),
|
|
21
21
|
type: z.enum(INCIDENT_TYPES).describe("Confirmed incident type").optional(),
|
|
@@ -4,7 +4,7 @@ import { assertNotResolved, findIncident, logEvent, updateState } from "../share
|
|
|
4
4
|
|
|
5
5
|
export const incidentUpdateStatus = tool({
|
|
6
6
|
description: "Update an incident's status (en_route, on_scene, resolved, escalated).",
|
|
7
|
-
|
|
7
|
+
inputSchema: z.object({
|
|
8
8
|
incidentId: z.string().max(20).describe("The incident ID"),
|
|
9
9
|
status: z.enum(["en_route", "on_scene", "resolved", "escalated"]).describe("New status"),
|
|
10
10
|
notes: z.string().max(1000).describe("Status update notes").optional(),
|
|
@@ -4,7 +4,7 @@ import { getApplicableProtocols, INCIDENT_TYPES, SEVERITIES } from "../shared.ts
|
|
|
4
4
|
|
|
5
5
|
export const opsProtocols = tool({
|
|
6
6
|
description: "Look up step-by-step response protocols for a given incident type and severity.",
|
|
7
|
-
|
|
7
|
+
inputSchema: z.object({
|
|
8
8
|
incidentType: z.enum(INCIDENT_TYPES).describe("Type of incident"),
|
|
9
9
|
severity: z.enum(SEVERITIES).describe("Severity level"),
|
|
10
10
|
}),
|
|
@@ -119,7 +119,7 @@ const SCENARIO_NAMES = Object.keys(scenarios) as [ScenarioName, ...ScenarioName[
|
|
|
119
119
|
|
|
120
120
|
export const opsRunScenario = tool({
|
|
121
121
|
description: "Run a training scenario that creates simulated incidents for dispatch practice.",
|
|
122
|
-
|
|
122
|
+
inputSchema: z.object({
|
|
123
123
|
scenario: z.enum(SCENARIO_NAMES).describe("Scenario type to simulate"),
|
|
124
124
|
}),
|
|
125
125
|
async execute(args, ctx) {
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
export const resourcesDispatch = tool({
|
|
13
13
|
description:
|
|
14
14
|
"Dispatch units to an incident. Can auto-dispatch recommended resources or manually specify callsigns.",
|
|
15
|
-
|
|
15
|
+
inputSchema: z.object({
|
|
16
16
|
incidentId: z.string().max(20).describe("The incident ID"),
|
|
17
17
|
callsigns: z
|
|
18
18
|
.array(z.string().max(50))
|
|
@@ -4,7 +4,7 @@ import { getState, RESOURCE_TYPES } from "../shared.ts";
|
|
|
4
4
|
|
|
5
5
|
export const resourcesGetAvailable = tool({
|
|
6
6
|
description: "List available resources, optionally filtered by type.",
|
|
7
|
-
|
|
7
|
+
inputSchema: z.object({
|
|
8
8
|
type: z
|
|
9
9
|
.enum([...RESOURCE_TYPES, "all"])
|
|
10
10
|
.describe("Filter by resource type, or 'all'")
|
|
@@ -4,7 +4,7 @@ import { logEvent, RESOURCE_STATUSES, updateState } from "../shared.ts";
|
|
|
4
4
|
|
|
5
5
|
export const resourcesUpdateStatus = tool({
|
|
6
6
|
description: "Update a resource unit's status when it radios in.",
|
|
7
|
-
|
|
7
|
+
inputSchema: z.object({
|
|
8
8
|
callsign: z.string().max(50).describe("The resource callsign"),
|
|
9
9
|
status: z.enum(RESOURCE_STATUSES).describe("New status"),
|
|
10
10
|
notes: z.string().max(1000).describe("Status notes").optional(),
|
|
@@ -31,7 +31,7 @@ export default agent({
|
|
|
31
31
|
search_knowledge: tool({
|
|
32
32
|
description:
|
|
33
33
|
"Search the embedded FAQ knowledge base for an answer matching the user's question.",
|
|
34
|
-
|
|
34
|
+
inputSchema: z.object({
|
|
35
35
|
query: z.string().describe("The user's question to search for"),
|
|
36
36
|
}),
|
|
37
37
|
async execute(args) {
|
|
@@ -86,7 +86,7 @@ export default agent({
|
|
|
86
86
|
check_drug_interaction: tool({
|
|
87
87
|
description:
|
|
88
88
|
"Check for interactions between two or more medications using FDA drug label data. Looks up each drug's official label and reports where one drug's Drug Interactions section mentions another. Absence of a mention does not guarantee safety.",
|
|
89
|
-
|
|
89
|
+
inputSchema: z.object({
|
|
90
90
|
drugs: z
|
|
91
91
|
.array(z.string().min(1))
|
|
92
92
|
.min(2)
|
|
@@ -142,7 +142,7 @@ export default agent({
|
|
|
142
142
|
medication_lookup: tool({
|
|
143
143
|
description:
|
|
144
144
|
"Look up detailed information about a single medication, including purpose, warnings, dosage, side effects, and manufacturer. Works with both generic and brand names.",
|
|
145
|
-
|
|
145
|
+
inputSchema: z.object({
|
|
146
146
|
name: z
|
|
147
147
|
.string()
|
|
148
148
|
.describe("Medication name (generic or brand, e.g. 'ibuprofen' or 'Advil')"),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { agent, assemblyAIPipeline, tool } from "@alexkroman1/aai";
|
|
2
|
-
import {
|
|
2
|
+
import { assemblyAITts } from "@alexkroman1/aai/tts";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { getGameState, resetGameState } from "./shared.ts";
|
|
5
5
|
import systemPrompt from "./system-prompt.md?raw";
|
|
@@ -19,7 +19,7 @@ export default agent({
|
|
|
19
19
|
tools: {
|
|
20
20
|
game_state_drop: tool({
|
|
21
21
|
description: "Remove an item from the player's inventory.",
|
|
22
|
-
|
|
22
|
+
inputSchema: z.object({
|
|
23
23
|
value: z.string().describe("Item name to drop"),
|
|
24
24
|
}),
|
|
25
25
|
async execute(args, ctx) {
|
|
@@ -31,7 +31,7 @@ export default agent({
|
|
|
31
31
|
|
|
32
32
|
game_state_flag: tool({
|
|
33
33
|
description: "Set a game flag to true, used for tracking puzzle and event state.",
|
|
34
|
-
|
|
34
|
+
inputSchema: z.object({
|
|
35
35
|
value: z.string().describe("Flag name to set"),
|
|
36
36
|
}),
|
|
37
37
|
async execute(args, ctx) {
|
|
@@ -59,7 +59,7 @@ export default agent({
|
|
|
59
59
|
|
|
60
60
|
game_state_history: tool({
|
|
61
61
|
description: "Log a player command to the history and increment the move counter.",
|
|
62
|
-
|
|
62
|
+
inputSchema: z.object({
|
|
63
63
|
value: z.string().describe("Command text to log"),
|
|
64
64
|
}),
|
|
65
65
|
async execute(args, ctx) {
|
|
@@ -72,7 +72,7 @@ export default agent({
|
|
|
72
72
|
|
|
73
73
|
game_state_move: tool({
|
|
74
74
|
description: "Move the player to a new room and increment the move counter.",
|
|
75
|
-
|
|
75
|
+
inputSchema: z.object({
|
|
76
76
|
value: z.string().describe("Room name to move to"),
|
|
77
77
|
}),
|
|
78
78
|
async execute(args, ctx) {
|
|
@@ -94,7 +94,7 @@ export default agent({
|
|
|
94
94
|
|
|
95
95
|
game_state_score: tool({
|
|
96
96
|
description: "Add points to the player's score.",
|
|
97
|
-
|
|
97
|
+
inputSchema: z.object({
|
|
98
98
|
value: z.number().describe("Points to add"),
|
|
99
99
|
}),
|
|
100
100
|
async execute(args, ctx) {
|
|
@@ -106,7 +106,7 @@ export default agent({
|
|
|
106
106
|
|
|
107
107
|
game_state_take: tool({
|
|
108
108
|
description: "Add an item to the player's inventory.",
|
|
109
|
-
|
|
109
|
+
inputSchema: z.object({
|
|
110
110
|
value: z.string().describe("Item name to take"),
|
|
111
111
|
}),
|
|
112
112
|
async execute(args, ctx) {
|
|
@@ -76,17 +76,19 @@ describe("pricing (shared.ts)", () => {
|
|
|
76
76
|
expect(calculateTotal([a, b])).toBeCloseTo(8.99 * 4, 5);
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
test("add_pizza schema defaults quantity to 1 and rejects non-positive quantities", () => {
|
|
80
|
-
const schema = getTool("add_pizza").
|
|
81
|
-
if (!schema) throw new Error("add_pizza has no
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
)
|
|
87
|
-
expect(()
|
|
88
|
-
|
|
89
|
-
).
|
|
79
|
+
test("add_pizza schema defaults quantity to 1 and rejects non-positive quantities", async () => {
|
|
80
|
+
const schema = getTool("add_pizza").inputSchema;
|
|
81
|
+
if (!schema) throw new Error("add_pizza has no input schema");
|
|
82
|
+
// Validate through the Standard Schema contract — the vendor-neutral
|
|
83
|
+
// interface every inputSchema carries.
|
|
84
|
+
const validate = (value: unknown) => schema["~standard"].validate(value);
|
|
85
|
+
const ok = await validate({ size: "small", crust: "thin", toppings: [] });
|
|
86
|
+
if (ok.issues) throw new Error("expected valid input");
|
|
87
|
+
expect((ok.value as { quantity: number }).quantity).toBe(1);
|
|
88
|
+
const zero = await validate({ size: "small", crust: "thin", toppings: [], quantity: 0 });
|
|
89
|
+
expect(zero.issues).toBeDefined();
|
|
90
|
+
const frac = await validate({ size: "small", crust: "thin", toppings: [], quantity: 1.5 });
|
|
91
|
+
expect(frac.issues).toBeDefined();
|
|
90
92
|
});
|
|
91
93
|
});
|
|
92
94
|
|
|
@@ -35,7 +35,7 @@ export default agent({
|
|
|
35
35
|
tools: {
|
|
36
36
|
add_pizza: tool({
|
|
37
37
|
description: "Add a pizza to the order. Use when the customer has decided on a pizza.",
|
|
38
|
-
|
|
38
|
+
inputSchema: z.object({
|
|
39
39
|
size: sizes,
|
|
40
40
|
crust: crusts,
|
|
41
41
|
toppings: z
|
|
@@ -93,7 +93,7 @@ export default agent({
|
|
|
93
93
|
|
|
94
94
|
remove_pizza: tool({
|
|
95
95
|
description: "Remove a pizza from the order by its ID.",
|
|
96
|
-
|
|
96
|
+
inputSchema: z.object({
|
|
97
97
|
pizza_id: z.number().describe("The pizza ID to remove"),
|
|
98
98
|
}),
|
|
99
99
|
async execute(args, ctx) {
|
|
@@ -113,7 +113,7 @@ export default agent({
|
|
|
113
113
|
|
|
114
114
|
set_customer_name: tool({
|
|
115
115
|
description: "Set the customer name for the order.",
|
|
116
|
-
|
|
116
|
+
inputSchema: z.object({
|
|
117
117
|
name: z.string(),
|
|
118
118
|
}),
|
|
119
119
|
async execute(args, ctx) {
|
|
@@ -124,7 +124,7 @@ export default agent({
|
|
|
124
124
|
|
|
125
125
|
update_pizza: tool({
|
|
126
126
|
description: "Update an existing pizza in the order. Only provided fields are changed.",
|
|
127
|
-
|
|
127
|
+
inputSchema: z.object({
|
|
128
128
|
pizza_id: z.number(),
|
|
129
129
|
size: sizes.optional(),
|
|
130
130
|
crust: crusts.optional(),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { toAgentConfig } from "@alexkroman1/aai/manifest";
|
|
2
|
+
import { describe, expect, test } from "vitest";
|
|
3
|
+
import agentDef from "./agent.ts";
|
|
4
|
+
|
|
5
|
+
describe("simple template", () => {
|
|
6
|
+
test("config passes manifest validation", () => {
|
|
7
|
+
// Same conversion `aai build`/`aai deploy` run.
|
|
8
|
+
expect(() => toAgentConfig(agentDef)).not.toThrow();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test("exports an agent with a name and no explicit providers", () => {
|
|
12
|
+
// No provider fields declared: the default all-AssemblyAI pipeline is
|
|
13
|
+
// injected at parse time (see `assemblyAIPipeline`).
|
|
14
|
+
expect(agentDef.name).toBe("Simple Assistant");
|
|
15
|
+
expect(agentDef.stt).toBeUndefined();
|
|
16
|
+
expect(agentDef.s2s).toBeUndefined();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -408,7 +408,7 @@ describe("update_state", () => {
|
|
|
408
408
|
});
|
|
409
409
|
|
|
410
410
|
test("zod schemas reject out-of-range and malformed inputs", () => {
|
|
411
|
-
const params = updateState.
|
|
411
|
+
const params = updateState.inputSchema!;
|
|
412
412
|
expect(() => params.parse({ addClockSegments: 1 })).toThrow(); // below min
|
|
413
413
|
expect(() => params.parse({ addClockSegments: 13 })).toThrow(); // above max
|
|
414
414
|
expect(() => params.parse({ addClockSegments: 2.5 })).toThrow(); // non-integer
|
|
@@ -419,7 +419,7 @@ describe("update_state", () => {
|
|
|
419
419
|
params.parse({ addClockSegments: 6, updateNpcBond: 4, timeOfDay: "night" }),
|
|
420
420
|
).toBeTruthy();
|
|
421
421
|
|
|
422
|
-
const slotParams = saveGame.
|
|
422
|
+
const slotParams = saveGame.inputSchema!;
|
|
423
423
|
expect(() => slotParams.parse({ slot: "../../etc" })).toThrow();
|
|
424
424
|
expect(() => slotParams.parse({ slot: "a".repeat(40) })).toThrow();
|
|
425
425
|
expect(slotParams.parse({ slot: "chapter-2" })).toBeTruthy();
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
export const actionRoll = tool({
|
|
16
16
|
description:
|
|
17
17
|
"Core mechanic. Roll 2d6 + stat (capped at 10) vs 2d10 challenge dice. Also applies consequences (health/spirit/supply/momentum changes, clock advancement) based on move type, position, and result. Call for ANY risky action. Pure conversation needs no roll.",
|
|
18
|
-
|
|
18
|
+
inputSchema: z.object({
|
|
19
19
|
move: z.enum(MOVES).describe("Which move the player is making"),
|
|
20
20
|
stat: z.enum(["edge", "heart", "iron", "shadow", "wits"]).describe("Which stat to roll"),
|
|
21
21
|
position: z
|
|
@@ -7,7 +7,7 @@ import { loadState, saveGameState, saveSlotKey, saveSlotParam } from "../shared.
|
|
|
7
7
|
// `aai dev`); the rest of the game works without it.
|
|
8
8
|
export const loadGame = tool({
|
|
9
9
|
description: "Load a previously saved game.",
|
|
10
|
-
|
|
10
|
+
inputSchema: z.object({ slot: saveSlotParam }),
|
|
11
11
|
async execute(args, ctx) {
|
|
12
12
|
const saved = await loadState<GameState>(ctx, saveSlotKey(args.slot));
|
|
13
13
|
if (!saved) return { error: "No save found." };
|
|
@@ -205,7 +205,7 @@ const THEMES = [
|
|
|
205
205
|
export const oracle = tool({
|
|
206
206
|
description:
|
|
207
207
|
"Consult the oracle for narrative inspiration. Generates random prompts from thematic tables.",
|
|
208
|
-
|
|
208
|
+
inputSchema: z.object({
|
|
209
209
|
type: z
|
|
210
210
|
.enum(["action_theme", "npc_reaction", "scene_twist", "yes_no", "chaos_check"])
|
|
211
211
|
.describe("Type of oracle consultation"),
|
|
@@ -6,7 +6,7 @@ import { getGameState, saveSlotKey, saveSlotParam, saveState } from "../shared.t
|
|
|
6
6
|
// `aai dev`); the rest of the game works without it.
|
|
7
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
11
|
const state = getGameState(ctx);
|
|
12
12
|
await saveState(ctx, saveSlotKey(args.slot), state);
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
export const setupCharacter = tool({
|
|
22
22
|
description:
|
|
23
23
|
"Set up the entire game in one call. Starts a completely fresh game (any previous unsaved game is replaced), generates stats, initializes state, and marks the game as ready. After this returns, just narrate the opening scene. No need to call update_state — everything is already done.",
|
|
24
|
-
|
|
24
|
+
inputSchema: z.object({
|
|
25
25
|
genre: z.string().max(100).describe("Chosen genre code or custom description"),
|
|
26
26
|
tone: z.string().max(100).describe("Chosen tone code or custom description"),
|
|
27
27
|
archetype: z.string().max(100).describe("Chosen archetype code or custom description"),
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
export const updateState = tool({
|
|
23
23
|
description:
|
|
24
24
|
"Lightweight state sync for during gameplay. Handles location changes, NPC additions, clock additions, time changes, and session log entries. Resource changes (health/spirit/supply/momentum) are auto-applied by action_roll — only use those fields here for manual adjustments like resting or trading. Pass only what changed.",
|
|
25
|
-
|
|
25
|
+
inputSchema: z.object({
|
|
26
26
|
location: z.string().max(200).describe("New location name").optional(),
|
|
27
27
|
locationDesc: z.string().max(500).describe("Short location description").optional(),
|
|
28
28
|
timeOfDay: z.enum(TIME_PHASES).describe("New time of day").optional(),
|
package/dist/typecheck.d.ts
CHANGED
|
@@ -11,6 +11,21 @@
|
|
|
11
11
|
* checked with it; one that doesn't isn't (scaffolded projects and studio
|
|
12
12
|
* workspaces always have one). TypeScript itself resolves from the
|
|
13
13
|
* PROJECT'S node_modules — the user's pinned compiler, not ours.
|
|
14
|
+
*
|
|
15
|
+
* @internal — build hook for aai-server/the studio; not a supported public
|
|
16
|
+
* API and not covered by semver. The lack of a `_` prefix is packaging (the
|
|
17
|
+
* subpath must be importable cross-package), not an invitation: user code
|
|
18
|
+
* should never import from `@alexkroman1/aai-cli`.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Outcome of one {@link typecheckProject} run — a discriminated union on
|
|
22
|
+
* `ok`: `{ ok: true, skipped }` when the check passed (`skipped: true`
|
|
23
|
+
* meaning the project has no `tsconfig.json` so nothing ran), or
|
|
24
|
+
* `{ ok: false, output }` with the formatted tsc diagnostics (tail-capped)
|
|
25
|
+
* ready to surface as build feedback.
|
|
26
|
+
*
|
|
27
|
+
* @internal — build hook for aai-server/the studio; not a supported public
|
|
28
|
+
* API and not covered by semver.
|
|
14
29
|
*/
|
|
15
30
|
export type TypecheckResult = {
|
|
16
31
|
ok: true;
|
|
@@ -22,5 +37,8 @@ export type TypecheckResult = {
|
|
|
22
37
|
/**
|
|
23
38
|
* Typecheck the project at `cwd` with its own tsconfig + compiler.
|
|
24
39
|
* Skips (ok, skipped: true) when the project has no tsconfig.json.
|
|
40
|
+
*
|
|
41
|
+
* @internal — build hook for aai-server/the studio; not a supported public
|
|
42
|
+
* API and not covered by semver.
|
|
25
43
|
*/
|
|
26
44
|
export declare function typecheckProject(cwd: string): Promise<TypecheckResult>;
|
package/dist/typecheck.mjs
CHANGED
|
@@ -17,6 +17,11 @@ import { spawn } from "node:child_process";
|
|
|
17
17
|
* checked with it; one that doesn't isn't (scaffolded projects and studio
|
|
18
18
|
* workspaces always have one). TypeScript itself resolves from the
|
|
19
19
|
* PROJECT'S node_modules — the user's pinned compiler, not ours.
|
|
20
|
+
*
|
|
21
|
+
* @internal — build hook for aai-server/the studio; not a supported public
|
|
22
|
+
* API and not covered by semver. The lack of a `_` prefix is packaging (the
|
|
23
|
+
* subpath must be importable cross-package), not an invitation: user code
|
|
24
|
+
* should never import from `@alexkroman1/aai-cli`.
|
|
20
25
|
*/
|
|
21
26
|
/** Bound on one typecheck run — a hung compiler must not wedge a deploy. */
|
|
22
27
|
const TYPECHECK_TIMEOUT_MS = 12e4;
|
|
@@ -62,6 +67,9 @@ function resolveTscEntry(cwd) {
|
|
|
62
67
|
/**
|
|
63
68
|
* Typecheck the project at `cwd` with its own tsconfig + compiler.
|
|
64
69
|
* Skips (ok, skipped: true) when the project has no tsconfig.json.
|
|
70
|
+
*
|
|
71
|
+
* @internal — build hook for aai-server/the studio; not a supported public
|
|
72
|
+
* API and not covered by semver.
|
|
65
73
|
*/
|
|
66
74
|
async function typecheckProject(cwd) {
|
|
67
75
|
if (!existsSync(path.join(cwd, "tsconfig.json"))) return {
|
package/dist/worker-bundler.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { type PluginOption } from "vite";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Options for worker bundling.
|
|
4
|
+
*
|
|
5
|
+
* @internal — build hook for aai-server/the studio; not a supported public
|
|
6
|
+
* API and not covered by semver.
|
|
7
|
+
*/
|
|
3
8
|
export type BuildWorkerOptions = {
|
|
4
9
|
/**
|
|
5
10
|
* Minify the worker with Oxc (Vite 8's native minifier). Deploy builds set
|
|
@@ -25,5 +30,8 @@ export type BuildWorkerOptions = {
|
|
|
25
30
|
*
|
|
26
31
|
* Zod is bundled in — zod 4's `Function()` usage is wrapped in try/catch
|
|
27
32
|
* and gracefully degrades in restricted environments like Deno.
|
|
33
|
+
*
|
|
34
|
+
* @internal — build hook for aai-server/the studio; not a supported public
|
|
35
|
+
* API and not covered by semver.
|
|
28
36
|
*/
|
|
29
37
|
export declare function buildWorker(cwd: string, opts?: BuildWorkerOptions): Promise<string>;
|
package/dist/worker-bundler.mjs
CHANGED
|
@@ -13,6 +13,11 @@ import { build } from "vite";
|
|
|
13
13
|
* worker published from the browser comes out of the same Vite/Rollup pass as
|
|
14
14
|
* one from `aai deploy`.
|
|
15
15
|
*
|
|
16
|
+
* @internal — build hook for aai-server/the studio; not a supported public
|
|
17
|
+
* API and not covered by semver. The lack of a `_` prefix is packaging (the
|
|
18
|
+
* subpath must be importable cross-package), not an invitation: user code
|
|
19
|
+
* should never import from `@alexkroman1/aai-cli`.
|
|
20
|
+
*
|
|
16
21
|
* Every worker is built through a generated wrapper entry that re-exports the
|
|
17
22
|
* agent *and* its extracted config as `__aaiConfig` (via the dependency-free
|
|
18
23
|
* `@alexkroman1/aai/manifest` helpers, bundled in). The guest harness returns
|
|
@@ -60,6 +65,9 @@ ${runtime ? `export const __aaiCreateRuntime = (opts: Record<string, unknown>) =
|
|
|
60
65
|
*
|
|
61
66
|
* Zod is bundled in — zod 4's `Function()` usage is wrapped in try/catch
|
|
62
67
|
* and gracefully degrades in restricted environments like Deno.
|
|
68
|
+
*
|
|
69
|
+
* @internal — build hook for aai-server/the studio; not a supported public
|
|
70
|
+
* API and not covered by semver.
|
|
63
71
|
*/
|
|
64
72
|
async function buildWorker(cwd, opts = {}) {
|
|
65
73
|
const wrapperPath = path.join(cwd, WRAPPER_ENTRY_REL);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexkroman1/aai-cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"aai": "dist/cli.mjs"
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"p-timeout": "^7.0.1",
|
|
38
38
|
"vite": "^8.1.5",
|
|
39
39
|
"zod": "^4.4.3",
|
|
40
|
-
"@alexkroman1/aai": "5.
|
|
41
|
-
"@alexkroman1/aai
|
|
40
|
+
"@alexkroman1/aai-ui": "5.4.0",
|
|
41
|
+
"@alexkroman1/aai": "5.4.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"playwright": "^1.61.1",
|