@alexkroman1/aai-cli 5.14.0 → 6.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/dist/{_agent-C8Jk-ZcP.mjs → _agent-vGW5SBnX.mjs} +23 -5
- package/dist/_agent.d.ts +18 -0
- package/dist/{_api-client-BX8Qv51n.mjs → _api-client-LgLksMhN.mjs} +45 -8
- package/dist/_api-client.d.ts +39 -0
- package/dist/{_bundler-BuIyDdvs.mjs → _bundler-BapCUUJN.mjs} +42 -14
- package/dist/_bundler.d.ts +43 -5
- package/dist/_cli-common.d.ts +67 -3
- package/dist/{_config-CzwAWOWr.mjs → _config-D_s09e7g.mjs} +36 -18
- package/dist/_deploy.d.ts +2 -5
- package/dist/_dev-restart.d.ts +6 -1
- package/dist/{_dev-server-Ch7K8e8i.mjs → _dev-server-DQ1t9sbw.mjs} +94 -38
- package/dist/_dev-server.d.ts +30 -2
- package/dist/_e2e-test-utils.d.ts +80 -0
- package/dist/_fault-mode.d.ts +175 -0
- package/dist/{_init-CbkrE2wq.mjs → _init-CpISqoR8.mjs} +3 -3
- package/dist/{_output-CC300DzW.mjs → _output-CKkmWs7i.mjs} +8 -1
- package/dist/_output.d.ts +9 -2
- package/dist/{_server-common-61fL__39.mjs → _server-common-6e0QI4mq.mjs} +1 -1
- package/dist/{_slug-api-D30zPmsn.mjs → _slug-api-D2heILuC.mjs} +2 -2
- package/dist/{_studio-D2ciIhbi.mjs → _studio-zAJycZ8j.mjs} +3 -3
- package/dist/{_templates-B1kt3BGt.mjs → _templates-iDGjGiPf.mjs} +4 -6
- package/dist/{_typecheck-gate-4v9UBZHh.mjs → _typecheck-gate-BXvUNnfs.mjs} +1 -1
- package/dist/{_utils-0DHbcqUb.mjs → _utils-B8QmtFhK.mjs} +21 -7
- package/dist/_utils.d.ts +18 -2
- package/dist/{_vite-env-Dg_QlVv0.mjs → _vite-env-BNveawd1.mjs} +31 -1
- package/dist/_vite-env.d.ts +30 -0
- package/dist/build-BO1Ni6oJ.mjs +62 -0
- package/dist/build.d.ts +19 -0
- package/dist/cli-workflow.d.ts +10 -0
- package/dist/cli.d.ts +1 -2
- package/dist/cli.mjs +406 -224
- package/dist/{client-bundler-C9qXL8A2.mjs → client-bundler-B8Q9F8gJ.mjs} +3 -22
- package/dist/client-bundler.mjs +1 -1
- package/dist/{delete-DCRX3d96.mjs → delete-4I0uNR4a.mjs} +6 -7
- package/dist/delete.d.ts +2 -8
- package/dist/{deploy-DjsEV-40.mjs → deploy-DJ3HRcia.mjs} +13 -14
- package/dist/{dev-CvPH5dbF.mjs → dev-C6SWaAZP.mjs} +3 -3
- package/dist/{eject-LgBRfnbH.mjs → eject-Zrzk5KV3.mjs} +41 -15
- package/dist/eject.d.ts +30 -3
- package/dist/{init-BppxMR8r.mjs → init-BTRGiPQr.mjs} +61 -26
- package/dist/init.d.ts +11 -0
- package/dist/{login-BQQaxJhL.mjs → login-k0Z3VQu9.mjs} +5 -5
- package/dist/project-config.mjs +1 -1
- package/dist/scaffold/CLAUDE.md +498 -91
- package/dist/scaffold/package.json +11 -8
- package/dist/scaffold/pnpm-workspace.yaml +8 -0
- package/dist/scaffold/server.mjs +53 -57
- package/dist/{secret-Ds9dvqAj.mjs → secret-DzSQx1Ds.mjs} +6 -3
- package/dist/{storage-DbrQSHFk.mjs → storage-C-Do0mIA.mjs} +18 -6
- package/dist/{studio-GSFd4s5O.mjs → studio-BGVmCA2G.mjs} +10 -10
- package/dist/templates/code-interpreter/agent.ts +0 -2
- package/dist/templates/dispatch-center/agent.test.ts +17 -19
- package/dist/templates/dispatch-center/agent.ts +2 -29
- package/dist/templates/dispatch-center/client.tsx +33 -16
- package/dist/templates/dispatch-center/shared.ts +53 -19
- package/dist/templates/dispatch-center/tools/incident_add_note.ts +12 -14
- package/dist/templates/dispatch-center/tools/incident_create.ts +41 -44
- package/dist/templates/dispatch-center/tools/incident_escalate.ts +59 -61
- package/dist/templates/dispatch-center/tools/incident_get.ts +3 -4
- package/dist/templates/dispatch-center/tools/incident_triage.ts +43 -45
- package/dist/templates/dispatch-center/tools/incident_update_status.ts +39 -41
- package/dist/templates/dispatch-center/tools/ops_dashboard.ts +2 -5
- package/dist/templates/dispatch-center/tools/ops_protocols.ts +1 -1
- package/dist/templates/dispatch-center/tools/ops_run_scenario.ts +20 -23
- package/dist/templates/dispatch-center/tools/resources_dispatch.ts +52 -54
- package/dist/templates/dispatch-center/tools/resources_get_available.ts +2 -4
- package/dist/templates/dispatch-center/tools/resources_update_status.ts +39 -42
- package/dist/templates/embedded-assets/agent.test.ts +83 -0
- package/dist/templates/embedded-assets/agent.ts +1 -48
- package/dist/templates/embedded-assets/shared.ts +17 -0
- package/dist/templates/embedded-assets/system-prompt.md +13 -0
- package/dist/templates/embedded-assets/tools/list_topics.ts +9 -0
- package/dist/templates/embedded-assets/tools/search_knowledge.ts +26 -0
- package/dist/templates/health-assistant/agent.test.ts +169 -0
- package/dist/templates/health-assistant/agent.ts +1 -166
- package/dist/templates/health-assistant/fda.ts +100 -0
- package/dist/templates/health-assistant/tools/check_drug_interaction.ts +59 -0
- package/dist/templates/health-assistant/tools/medication_lookup.ts +31 -0
- package/dist/templates/infocom-adventure/agent.test.ts +205 -0
- package/dist/templates/infocom-adventure/agent.ts +3 -106
- package/dist/templates/infocom-adventure/client.tsx +28 -12
- package/dist/templates/infocom-adventure/shared.ts +28 -11
- package/dist/templates/infocom-adventure/tools/game_state_drop.ts +13 -0
- package/dist/templates/infocom-adventure/tools/game_state_flag.ts +13 -0
- package/dist/templates/infocom-adventure/tools/game_state_get.ts +16 -0
- package/dist/templates/infocom-adventure/tools/game_state_history.ts +14 -0
- package/dist/templates/infocom-adventure/tools/game_state_move.ts +14 -0
- package/dist/templates/infocom-adventure/tools/game_state_restart.ts +13 -0
- package/dist/templates/infocom-adventure/tools/game_state_score.ts +13 -0
- package/dist/templates/infocom-adventure/tools/game_state_take.ts +13 -0
- package/dist/templates/link-digest/agent.test.ts +223 -0
- package/dist/templates/link-digest/agent.ts +79 -0
- package/dist/templates/link-digest/client.tsx +146 -0
- package/dist/templates/link-digest/workflows/digest.ts +248 -0
- package/dist/templates/math-buddy/agent.ts +0 -2
- package/dist/templates/night-owl/agent.test.ts +80 -0
- package/dist/templates/night-owl/agent.ts +1 -68
- package/dist/templates/night-owl/system-prompt.md +10 -0
- package/dist/templates/night-owl/tools/recommend.ts +64 -0
- package/dist/templates/personal-finance/agent.ts +0 -2
- package/dist/templates/pizza-ordering/agent.test.ts +52 -47
- package/dist/templates/pizza-ordering/agent.ts +9 -158
- package/dist/templates/pizza-ordering/shared.ts +35 -12
- package/dist/templates/pizza-ordering/tools/add_pizza.ts +31 -0
- package/dist/templates/pizza-ordering/tools/place_order.ts +22 -0
- package/dist/templates/pizza-ordering/tools/remove_pizza.ts +22 -0
- package/dist/templates/pizza-ordering/tools/set_customer_name.ts +13 -0
- package/dist/templates/pizza-ordering/tools/update_pizza.ts +28 -0
- package/dist/templates/pizza-ordering/tools/view_order.ts +21 -0
- package/dist/templates/plan-and-execute/agent.test.ts +411 -0
- package/dist/templates/plan-and-execute/agent.ts +23 -0
- package/dist/templates/plan-and-execute/client.tsx +115 -0
- package/dist/templates/plan-and-execute/graph.ts +178 -0
- package/dist/templates/plan-and-execute/prompts.ts +110 -0
- package/dist/templates/plan-and-execute/shared.ts +161 -0
- package/dist/templates/plan-and-execute/system-prompt.md +18 -0
- package/dist/templates/plan-and-execute/tools/plan_status.ts +20 -0
- package/dist/templates/plan-and-execute/tools/revise_plan.ts +63 -0
- package/dist/templates/plan-and-execute/tools/start_plan.ts +51 -0
- package/dist/templates/plan-and-execute/tools/work_next_step.ts +101 -0
- package/dist/templates/recap-workflow/agent.test.ts +762 -0
- package/dist/templates/recap-workflow/agent.ts +95 -0
- package/dist/templates/recap-workflow/shared.ts +43 -0
- package/dist/templates/recap-workflow/tools/cancel_recap.ts +23 -0
- package/dist/templates/recap-workflow/tools/keep_transcript.ts +31 -0
- package/dist/templates/recap-workflow/tools/recap_progress.ts +27 -0
- package/dist/templates/recap-workflow/tools/recap_status.ts +46 -0
- package/dist/templates/recap-workflow/tools/request_recap.ts +43 -0
- package/dist/templates/recap-workflow/workflows/recap.ts +544 -0
- package/dist/templates/recap-workflow/workflows/tokens.ts +26 -0
- package/dist/templates/redline/agent.test.ts +222 -0
- package/dist/templates/redline/agent.ts +89 -0
- package/dist/templates/redline/client.tsx +184 -0
- package/dist/templates/redline/workflows/prompts.ts +68 -0
- package/dist/templates/redline/workflows/redline.ts +258 -0
- package/dist/templates/research-workflow/agent.test.ts +525 -0
- package/dist/templates/research-workflow/agent.ts +94 -0
- package/dist/templates/research-workflow/shared.ts +35 -0
- package/dist/templates/research-workflow/tools/file_it_now.ts +22 -0
- package/dist/templates/research-workflow/tools/request_research.ts +33 -0
- package/dist/templates/research-workflow/tools/research_progress.ts +26 -0
- package/dist/templates/research-workflow/tools/research_status.ts +40 -0
- package/dist/templates/research-workflow/workflows/prompts.ts +143 -0
- package/dist/templates/research-workflow/workflows/research.ts +558 -0
- package/dist/templates/retail/agent.test.ts +236 -172
- package/dist/templates/retail/agent.ts +5 -42
- package/dist/templates/retail/client.tsx +33 -11
- package/dist/templates/retail/registry.test.ts +31 -16
- package/dist/templates/retail/resolve.ts +28 -64
- package/dist/templates/retail/shared.test.ts +4 -3
- package/dist/templates/retail/shared.ts +24 -7
- package/dist/templates/retail/store.test.ts +12 -10
- package/dist/templates/retail/store.ts +69 -30
- package/dist/templates/retail/tools/cancel_pending_order.ts +4 -9
- package/dist/templates/retail/tools/exchange_delivered_order_items.ts +22 -11
- package/dist/templates/retail/tools/find_user_id_by_email.ts +5 -9
- package/dist/templates/retail/tools/find_user_id_by_name_zip.ts +5 -7
- package/dist/templates/retail/tools/get_item_details.ts +5 -7
- package/dist/templates/retail/tools/get_order_details.ts +5 -7
- package/dist/templates/retail/tools/get_product_details.ts +4 -7
- package/dist/templates/retail/tools/get_user_details.ts +4 -7
- package/dist/templates/retail/tools/list_all_product_types.ts +5 -7
- package/dist/templates/retail/tools/modify_pending_order_address.ts +4 -9
- package/dist/templates/retail/tools/modify_pending_order_items.ts +4 -16
- package/dist/templates/retail/tools/modify_pending_order_payment.ts +3 -9
- package/dist/templates/retail/tools/modify_user_address.ts +4 -9
- package/dist/templates/retail/tools/return_delivered_order_items.ts +3 -9
- package/dist/templates/retail/tools/transfer_to_human_agents.ts +1 -1
- package/dist/templates/solo-rpg/agent.test.ts +152 -29
- package/dist/templates/solo-rpg/agent.ts +3 -21
- package/dist/templates/solo-rpg/client.tsx +19 -6
- package/dist/templates/solo-rpg/shared.ts +19 -11
- package/dist/templates/solo-rpg/tools/action_roll.ts +2 -4
- package/dist/templates/solo-rpg/tools/burn_momentum.ts +2 -4
- package/dist/templates/solo-rpg/tools/check_state.ts +6 -6
- package/dist/templates/solo-rpg/tools/load_game.ts +1 -1
- package/dist/templates/solo-rpg/tools/oracle.ts +18 -11
- package/dist/templates/solo-rpg/tools/save_game.ts +10 -7
- package/dist/templates/solo-rpg/tools/setup_character.ts +1 -1
- package/dist/templates/solo-rpg/tools/update_state.ts +3 -4
- package/dist/templates/support-line/agent.test.ts +343 -0
- package/dist/templates/support-line/agent.ts +27 -0
- package/dist/templates/support-line/client.tsx +122 -0
- package/dist/templates/support-line/graph.ts +224 -0
- package/dist/templates/support-line/knowledge.json +65 -0
- package/dist/templates/support-line/prompts.ts +95 -0
- package/dist/templates/support-line/shared.ts +240 -0
- package/dist/templates/support-line/system-prompt.md +17 -0
- package/dist/templates/support-line/tools/answer_question.ts +72 -0
- package/dist/templates/support-line/tools/list_topics.ts +22 -0
- package/dist/templates/support-line/tools/log_ticket.ts +30 -0
- package/dist/templates/transcription-workflow/agent.test.ts +563 -0
- package/dist/templates/transcription-workflow/agent.ts +92 -0
- package/dist/templates/transcription-workflow/client.tsx +234 -0
- package/dist/templates/transcription-workflow/workflows/transcribe.ts +416 -0
- package/dist/templates/transcription-workflow/workflows/wav.ts +314 -0
- package/dist/templates/travel-concierge/agent.test.ts +338 -0
- package/dist/templates/travel-concierge/agent.ts +29 -0
- package/dist/templates/travel-concierge/client.tsx +161 -0
- package/dist/templates/travel-concierge/routing.ts +138 -0
- package/dist/templates/travel-concierge/shared.ts +547 -0
- package/dist/templates/travel-concierge/system-prompt.md +24 -0
- package/dist/templates/travel-concierge/tools/book_car_rental.ts +20 -0
- package/dist/templates/travel-concierge/tools/book_excursion.ts +18 -0
- package/dist/templates/travel-concierge/tools/book_hotel.ts +20 -0
- package/dist/templates/travel-concierge/tools/cancel_action.ts +7 -0
- package/dist/templates/travel-concierge/tools/cancel_ticket.ts +16 -0
- package/dist/templates/travel-concierge/tools/complete_or_escalate.ts +7 -0
- package/dist/templates/travel-concierge/tools/confirm_action.ts +7 -0
- package/dist/templates/travel-concierge/tools/lookup_booking.ts +35 -0
- package/dist/templates/travel-concierge/tools/search_car_rentals.ts +33 -0
- package/dist/templates/travel-concierge/tools/search_excursions.ts +37 -0
- package/dist/templates/travel-concierge/tools/search_flights.ts +43 -0
- package/dist/templates/travel-concierge/tools/search_hotels.ts +36 -0
- package/dist/templates/travel-concierge/tools/to_car_rental_assistant.ts +11 -0
- package/dist/templates/travel-concierge/tools/to_excursion_assistant.ts +11 -0
- package/dist/templates/travel-concierge/tools/to_flight_assistant.ts +11 -0
- package/dist/templates/travel-concierge/tools/to_hotel_assistant.ts +11 -0
- package/dist/templates/travel-concierge/tools/update_ticket.ts +22 -0
- package/dist/templates/web-researcher/agent.ts +0 -2
- package/dist/templates/web-researcher/system-prompt.md +10 -0
- package/dist/{test-2LWBcXvY.mjs → test-B6ZBxSpk.mjs} +2 -2
- package/dist/typecheck.mjs +17 -15
- package/dist/worker-bundler-CIdDhZ0c.mjs +398 -0
- package/dist/worker-bundler.d.ts +14 -0
- package/dist/worker-bundler.mjs +1 -108
- package/dist/workflow-B-O97AqI.mjs +125 -0
- package/dist/workflow-bundler.d.ts +133 -0
- package/dist/workflow.d.ts +67 -0
- package/package.json +13 -9
- package/dist/build-DQJ1ZSm9.mjs +0 -39
package/dist/cli.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as installStdoutGuard, n as fail, o as writeLine, r as getOutputMode, t as CliError } from "./_output-
|
|
2
|
+
import { i as installStdoutGuard, n as fail, o as writeLine, r as getOutputMode, t as CliError } from "./_output-CKkmWs7i.mjs";
|
|
3
3
|
import { n as log, o as silenceOutput } from "./_ui-u7T4YooX.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { d as resolveCwd, o as errorMessage$1, s as fileExists, t as AGENT_ENTRY } from "./_utils-B8QmtFhK.mjs";
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { defineCommand, runMain, showUsage } from "citty";
|
|
9
|
+
import { isRecord } from "@alexkroman1/aai/utils";
|
|
9
10
|
//#region _cli-common.ts
|
|
10
11
|
/** Shared arg definitions for citty commands. */
|
|
11
12
|
const sharedArgs = {
|
|
@@ -87,6 +88,24 @@ async function resolve(value) {
|
|
|
87
88
|
return typeof value === "function" ? await value() : await value;
|
|
88
89
|
}
|
|
89
90
|
/**
|
|
91
|
+
* `aai secret put` for a subcommand, `aai` for the root — the name to put in
|
|
92
|
+
* front of `--help` when telling someone which usage to read.
|
|
93
|
+
*
|
|
94
|
+
* Beside {@link resolve} because it is the same job: `meta` is a `Resolvable`,
|
|
95
|
+
* so only the plain-object form carries a name synchronously and anything else
|
|
96
|
+
* degrades to the binary name rather than blocking an error path on a resolve.
|
|
97
|
+
* This module owns citty's `Resolvable` handling; `cli.ts` had its own copy of
|
|
98
|
+
* the narrowing.
|
|
99
|
+
*/
|
|
100
|
+
function commandPath(cmd, parent) {
|
|
101
|
+
const nameOf = (c) => {
|
|
102
|
+
const meta = c?.meta;
|
|
103
|
+
return isRecord(meta) && typeof meta.name === "string" ? meta.name : void 0;
|
|
104
|
+
};
|
|
105
|
+
const named = [nameOf(parent), nameOf(cmd)].filter((n) => n !== void 0).join(" ");
|
|
106
|
+
return named.startsWith("aai") ? named : `aai ${named}`.trim();
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
90
109
|
* Unknown flags in `argv` for whichever (possibly nested) subcommand it
|
|
91
110
|
* selects — `[]` when everything is declared.
|
|
92
111
|
*
|
|
@@ -131,8 +150,19 @@ async function setup(opts) {
|
|
|
131
150
|
* key, and commands with no platform traffic never prompt at all.
|
|
132
151
|
*
|
|
133
152
|
* A thrown error and a returned `fail(...)` converge here on one emitter:
|
|
134
|
-
* human mode logs the message, JSON mode writes exactly one
|
|
135
|
-
* and both exit 1.
|
|
153
|
+
* human mode logs the message and the hint, JSON mode writes exactly one
|
|
154
|
+
* result line, and both exit 1.
|
|
155
|
+
*
|
|
156
|
+
* That convergence is the whole contract and it was HALF TRUE for a long
|
|
157
|
+
* time: only the `catch` printed anything, so a body that RETURNED a failure
|
|
158
|
+
* fell straight through to the JSON check and `process.exit(1)`. In human
|
|
159
|
+
* mode that is a bare exit 1 with an empty terminal — `aai test` with no
|
|
160
|
+
* runner binary on PATH (message and "is it on your PATH?" both discarded),
|
|
161
|
+
* every `aai workflow` verb against a booting sandbox (the agent's own
|
|
162
|
+
* sentence plus `HINT_BROKER` discarded), `aai secret put` with an empty
|
|
163
|
+
* value, and `aai storage disable`'s "re-run with --force". Nine paths, all
|
|
164
|
+
* silent. Emitting is therefore driven by the RESULT rather than by which
|
|
165
|
+
* arm produced it.
|
|
136
166
|
*/
|
|
137
167
|
async function runCommand(args, fn) {
|
|
138
168
|
const mode = getOutputMode(args);
|
|
@@ -143,18 +173,73 @@ async function runCommand(args, fn) {
|
|
|
143
173
|
} catch (err) {
|
|
144
174
|
const code = err instanceof CliError ? err.code : "command_failed";
|
|
145
175
|
const hint = err instanceof CliError ? err.hint : void 0;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
176
|
+
result = fail(code, errorMessage$1(err), hint);
|
|
177
|
+
}
|
|
178
|
+
if (mode === "human" && !result.ok) {
|
|
179
|
+
log.error(result.error);
|
|
180
|
+
if (result.hint) log.info(result.hint);
|
|
151
181
|
}
|
|
152
182
|
if (mode === "json") await writeLine(`${JSON.stringify(result)}\n`);
|
|
153
183
|
if (!result.ok) process.exit(1);
|
|
154
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* `--json` as citty parsed it, or undefined when it was not passed.
|
|
187
|
+
*
|
|
188
|
+
* `Record<string, unknown>` because that is what a generic `ParsedArgs<T>`
|
|
189
|
+
* satisfies: citty's parsed shape carries an index signature, and a parameter
|
|
190
|
+
* typed `{ json?: boolean }` is a WEAK type, which TypeScript refuses an
|
|
191
|
+
* argument whose known properties it cannot see through the generic.
|
|
192
|
+
*/
|
|
193
|
+
function jsonFlag(args) {
|
|
194
|
+
return typeof args.json === "boolean" ? args.json : void 0;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* The one place a {@link CwdPolicy} turns into a directory.
|
|
198
|
+
*
|
|
199
|
+
* The two casts are the conditional return type: TypeScript cannot verify a
|
|
200
|
+
* `P extends "none" ? undefined : string` from inside a body generic in `P`,
|
|
201
|
+
* and the runtime branch is the same test the type is. Callers get the exact
|
|
202
|
+
* type, which is the point — a `"none"` body cannot read a `cwd`.
|
|
203
|
+
*/
|
|
204
|
+
async function resolvePolicyCwd(policy) {
|
|
205
|
+
if (policy === "none") return void 0;
|
|
206
|
+
return await setup(policy === "agent" ? { agent: true } : void 0);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Define a citty command whose body is an EXECUTOR — the shape all
|
|
210
|
+
* twenty-four of this CLI's leaf commands have.
|
|
211
|
+
*
|
|
212
|
+
* Written longhand, each one restates the same four lines (`async run({ args
|
|
213
|
+
* })`, `await runCommand(args, async (mode) => …)`, a cwd resolution, a lazy
|
|
214
|
+
* `await import`) and, in the middle of them, DECIDES the working-directory
|
|
215
|
+
* policy — which is the part that is not boilerplate and the part that has
|
|
216
|
+
* been wrong in production: `aai test` shipped calling `setup()` bare instead
|
|
217
|
+
* of `setup({ agent: true })`, so in a directory with no `agent.ts` it found
|
|
218
|
+
* no test file, reported `{ passed: true, skipped: true }` and exited 0. A
|
|
219
|
+
* green result for a project that is not there reads, in CI, exactly like a
|
|
220
|
+
* passing suite.
|
|
221
|
+
*
|
|
222
|
+
* `cwd` is a required field of the spec, so that decision is stated once per
|
|
223
|
+
* command in the one place a reader looks for it, and "forgot to pass
|
|
224
|
+
* `{ agent: true }`" stops being a representable mistake — the alternative
|
|
225
|
+
* spelling is a policy name that does not exist.
|
|
226
|
+
*/
|
|
227
|
+
function defineExec(spec) {
|
|
228
|
+
return defineCommand({
|
|
229
|
+
meta: spec.meta,
|
|
230
|
+
args: spec.args,
|
|
231
|
+
async run({ args }) {
|
|
232
|
+
await runCommand({ json: jsonFlag(args) }, async (mode) => spec.run({
|
|
233
|
+
args,
|
|
234
|
+
mode,
|
|
235
|
+
cwd: await resolvePolicyCwd(spec.cwd)
|
|
236
|
+
}));
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
155
240
|
//#endregion
|
|
156
241
|
//#region _studio-commands.ts
|
|
157
|
-
const list =
|
|
242
|
+
const list = defineExec({
|
|
158
243
|
meta: {
|
|
159
244
|
name: "list",
|
|
160
245
|
description: "List your studio projects"
|
|
@@ -163,18 +248,16 @@ const list = defineCommand({
|
|
|
163
248
|
server: sharedArgs.server,
|
|
164
249
|
json: sharedArgs.json
|
|
165
250
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
server: args.server
|
|
173
|
-
});
|
|
251
|
+
cwd: "any",
|
|
252
|
+
async run({ args, cwd }) {
|
|
253
|
+
const { executeList } = await import("./studio-BGVmCA2G.mjs");
|
|
254
|
+
return executeList({
|
|
255
|
+
cwd,
|
|
256
|
+
server: args.server
|
|
174
257
|
});
|
|
175
258
|
}
|
|
176
259
|
});
|
|
177
|
-
const pull =
|
|
260
|
+
const pull = defineExec({
|
|
178
261
|
meta: {
|
|
179
262
|
name: "pull",
|
|
180
263
|
description: "Pull a studio project into a local directory"
|
|
@@ -198,21 +281,19 @@ const pull = defineCommand({
|
|
|
198
281
|
server: sharedArgs.server,
|
|
199
282
|
json: sharedArgs.json
|
|
200
283
|
},
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
server: args.server
|
|
211
|
-
});
|
|
284
|
+
cwd: "any",
|
|
285
|
+
async run({ args, cwd }) {
|
|
286
|
+
const { executePull } = await import("./studio-BGVmCA2G.mjs");
|
|
287
|
+
return executePull({
|
|
288
|
+
cwd,
|
|
289
|
+
project: args.project,
|
|
290
|
+
dir: args.dir,
|
|
291
|
+
force: args.force,
|
|
292
|
+
server: args.server
|
|
212
293
|
});
|
|
213
294
|
}
|
|
214
295
|
});
|
|
215
|
-
const push =
|
|
296
|
+
const push = defineExec({
|
|
216
297
|
meta: {
|
|
217
298
|
name: "push",
|
|
218
299
|
description: "Sync this project's source to its studio workspace"
|
|
@@ -226,19 +307,17 @@ const push = defineCommand({
|
|
|
226
307
|
server: sharedArgs.server,
|
|
227
308
|
json: sharedArgs.json
|
|
228
309
|
},
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
force: args.force
|
|
237
|
-
});
|
|
310
|
+
cwd: "agent",
|
|
311
|
+
async run({ args, cwd }) {
|
|
312
|
+
const { executePush } = await import("./studio-BGVmCA2G.mjs");
|
|
313
|
+
return executePush({
|
|
314
|
+
cwd,
|
|
315
|
+
server: args.server,
|
|
316
|
+
force: args.force
|
|
238
317
|
});
|
|
239
318
|
}
|
|
240
319
|
});
|
|
241
|
-
const publish =
|
|
320
|
+
const publish = defineExec({
|
|
242
321
|
meta: {
|
|
243
322
|
name: "publish",
|
|
244
323
|
description: "Push to the studio and deploy to production (the studio's Publish button)"
|
|
@@ -256,20 +335,150 @@ const publish = defineCommand({
|
|
|
256
335
|
description: "Skip type checking before publishing"
|
|
257
336
|
}
|
|
258
337
|
},
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
skipTypecheck: args.skipTypecheck
|
|
268
|
-
});
|
|
338
|
+
cwd: "agent",
|
|
339
|
+
async run({ args, cwd }) {
|
|
340
|
+
const { executePublish } = await import("./studio-BGVmCA2G.mjs");
|
|
341
|
+
return executePublish({
|
|
342
|
+
cwd,
|
|
343
|
+
server: args.server,
|
|
344
|
+
force: args.force,
|
|
345
|
+
skipTypecheck: args.skipTypecheck
|
|
269
346
|
});
|
|
270
347
|
}
|
|
271
348
|
});
|
|
272
349
|
//#endregion
|
|
350
|
+
//#region cli-workflow.ts
|
|
351
|
+
/**
|
|
352
|
+
* The `aai workflow` subcommand group.
|
|
353
|
+
*
|
|
354
|
+
* Its own module because `cli.ts` is near the 500-line cap and this is the
|
|
355
|
+
* natural seam: four verbs over one surface, none of which shares anything with
|
|
356
|
+
* the deploy/secret/storage commands beyond `sharedArgs`. The executors are in
|
|
357
|
+
* `workflow.ts` and are imported lazily, exactly as every other command here
|
|
358
|
+
* does it — the CLI's startup path must not pay for a group nobody invoked.
|
|
359
|
+
*/
|
|
360
|
+
/**
|
|
361
|
+
* `--token` for an agent whose operator set `AAI_WORKFLOW_API_TOKEN`.
|
|
362
|
+
*
|
|
363
|
+
* Not the caller's API key: the workflow API is the agent's own surface and
|
|
364
|
+
* takes its own bearer, so sending a platform credential there would be both
|
|
365
|
+
* useless and a leak. See `workflow.ts`.
|
|
366
|
+
*/
|
|
367
|
+
const workflowToken = {
|
|
368
|
+
type: "string",
|
|
369
|
+
description: "Bearer for an agent that sets AAI_WORKFLOW_API_TOKEN"
|
|
370
|
+
};
|
|
371
|
+
/** The positional every run-scoped verb takes. */
|
|
372
|
+
const runIdArg = {
|
|
373
|
+
type: "positional",
|
|
374
|
+
description: "Run id",
|
|
375
|
+
required: true
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* Every verb here reads `.aai/project.json` for the origin and the published
|
|
379
|
+
* slug, and none of them touches `agent.ts` — a directory `aai pull`ed but
|
|
380
|
+
* never edited still names a deployed agent whose runs are worth asking about.
|
|
381
|
+
*/
|
|
382
|
+
const WORKFLOW_CWD = "any";
|
|
383
|
+
const workflow = defineCommand({
|
|
384
|
+
meta: {
|
|
385
|
+
name: "workflow",
|
|
386
|
+
description: "Inspect and steer durable workflow runs"
|
|
387
|
+
},
|
|
388
|
+
subCommands: {
|
|
389
|
+
list: defineExec({
|
|
390
|
+
meta: {
|
|
391
|
+
name: "list",
|
|
392
|
+
description: "List the workflows this agent declares"
|
|
393
|
+
},
|
|
394
|
+
args: {
|
|
395
|
+
server: sharedArgs.server,
|
|
396
|
+
json: sharedArgs.json,
|
|
397
|
+
token: workflowToken
|
|
398
|
+
},
|
|
399
|
+
cwd: WORKFLOW_CWD,
|
|
400
|
+
async run({ args, cwd }) {
|
|
401
|
+
const { executeWorkflowList } = await import("./workflow-B-O97AqI.mjs");
|
|
402
|
+
return executeWorkflowList(cwd, {
|
|
403
|
+
server: args.server,
|
|
404
|
+
token: args.token
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
}),
|
|
408
|
+
runs: defineExec({
|
|
409
|
+
meta: {
|
|
410
|
+
name: "runs",
|
|
411
|
+
description: "List recent runs of one workflow, newest first"
|
|
412
|
+
},
|
|
413
|
+
args: {
|
|
414
|
+
workflow: {
|
|
415
|
+
type: "positional",
|
|
416
|
+
description: "Workflow name",
|
|
417
|
+
required: true
|
|
418
|
+
},
|
|
419
|
+
limit: {
|
|
420
|
+
type: "string",
|
|
421
|
+
description: "How many runs to list"
|
|
422
|
+
},
|
|
423
|
+
server: sharedArgs.server,
|
|
424
|
+
json: sharedArgs.json,
|
|
425
|
+
token: workflowToken
|
|
426
|
+
},
|
|
427
|
+
cwd: WORKFLOW_CWD,
|
|
428
|
+
async run({ args, cwd }) {
|
|
429
|
+
const { executeWorkflowRuns } = await import("./workflow-B-O97AqI.mjs");
|
|
430
|
+
const limit = args.limit === void 0 ? void 0 : Number(args.limit);
|
|
431
|
+
if (limit !== void 0 && !Number.isFinite(limit)) throw new CliError("bad_limit", "--limit must be a number");
|
|
432
|
+
return executeWorkflowRuns(cwd, args.workflow, {
|
|
433
|
+
server: args.server,
|
|
434
|
+
token: args.token,
|
|
435
|
+
limit
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
}),
|
|
439
|
+
show: defineExec({
|
|
440
|
+
meta: {
|
|
441
|
+
name: "show",
|
|
442
|
+
description: "Show one run, including its output"
|
|
443
|
+
},
|
|
444
|
+
args: {
|
|
445
|
+
runId: runIdArg,
|
|
446
|
+
server: sharedArgs.server,
|
|
447
|
+
json: sharedArgs.json,
|
|
448
|
+
token: workflowToken
|
|
449
|
+
},
|
|
450
|
+
cwd: WORKFLOW_CWD,
|
|
451
|
+
async run({ args, cwd }) {
|
|
452
|
+
const { executeWorkflowShow } = await import("./workflow-B-O97AqI.mjs");
|
|
453
|
+
return executeWorkflowShow(cwd, args.runId, {
|
|
454
|
+
server: args.server,
|
|
455
|
+
token: args.token
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
}),
|
|
459
|
+
cancel: defineExec({
|
|
460
|
+
meta: {
|
|
461
|
+
name: "cancel",
|
|
462
|
+
description: "Stop a running workflow run"
|
|
463
|
+
},
|
|
464
|
+
args: {
|
|
465
|
+
runId: runIdArg,
|
|
466
|
+
server: sharedArgs.server,
|
|
467
|
+
json: sharedArgs.json,
|
|
468
|
+
token: workflowToken
|
|
469
|
+
},
|
|
470
|
+
cwd: WORKFLOW_CWD,
|
|
471
|
+
async run({ args, cwd }) {
|
|
472
|
+
const { executeWorkflowCancel } = await import("./workflow-B-O97AqI.mjs");
|
|
473
|
+
return executeWorkflowCancel(cwd, args.runId, {
|
|
474
|
+
server: args.server,
|
|
475
|
+
token: args.token
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
})
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
//#endregion
|
|
273
482
|
//#region cli.ts
|
|
274
483
|
const cliDir = path.dirname(fileURLToPath(import.meta.url));
|
|
275
484
|
/**
|
|
@@ -285,24 +494,27 @@ function readCliVersion(dir) {
|
|
|
285
494
|
process.stderr.write("warning: could not read aai's package.json — reporting version unknown\n");
|
|
286
495
|
return "unknown";
|
|
287
496
|
}
|
|
288
|
-
const VERSION = readCliVersion(cliDir);
|
|
289
497
|
/**
|
|
290
|
-
*
|
|
291
|
-
* front of `--help` when telling someone which usage to read.
|
|
498
|
+
* The version, read on FIRST ACCESS rather than at module load.
|
|
292
499
|
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
500
|
+
* Two synchronous reads and a parse used to run for every invocation of every
|
|
501
|
+
* subcommand, on the startup path this package deliberately budgets (the same
|
|
502
|
+
* one that keeps zod out of `_utils.ts` and `_ui.ts`, and that `bin.mjs` exists
|
|
503
|
+
* to put `module.enableCompileCache()` in front of). Only `--version` and the
|
|
504
|
+
* usage renderer read `meta.version`, and citty reads it as a property — so a
|
|
505
|
+
* getter is transparent to both while charging the file read to the two
|
|
506
|
+
* commands that display it. Memoized because usage rendering reads it twice.
|
|
296
507
|
*/
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
|
|
508
|
+
let _version;
|
|
509
|
+
const mainMeta = {
|
|
510
|
+
name: "aai",
|
|
511
|
+
description: "Voice agent development kit",
|
|
512
|
+
get version() {
|
|
513
|
+
_version ??= readCliVersion(cliDir);
|
|
514
|
+
return _version;
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
const init = defineExec({
|
|
306
518
|
meta: {
|
|
307
519
|
name: "init",
|
|
308
520
|
description: "Scaffold a new agent project"
|
|
@@ -331,21 +543,20 @@ const init = defineCommand({
|
|
|
331
543
|
description: "Skip deploy after scaffolding"
|
|
332
544
|
}
|
|
333
545
|
},
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
});
|
|
546
|
+
cwd: "none",
|
|
547
|
+
async run({ args, mode }) {
|
|
548
|
+
const { executeInit } = await import("./init-BTRGiPQr.mjs");
|
|
549
|
+
return executeInit({
|
|
550
|
+
dir: args.dir,
|
|
551
|
+
force: args.force,
|
|
552
|
+
template: args.template,
|
|
553
|
+
yes: mode === "json" ? true : args.yes,
|
|
554
|
+
skipDeploy: args.skipDeploy,
|
|
555
|
+
server: args.server
|
|
556
|
+
}, mode === "json" ? { silent: true } : void 0);
|
|
346
557
|
}
|
|
347
558
|
});
|
|
348
|
-
const dev =
|
|
559
|
+
const dev = defineExec({
|
|
349
560
|
meta: {
|
|
350
561
|
name: "dev",
|
|
351
562
|
description: "Start a local development server"
|
|
@@ -359,32 +570,28 @@ const dev = defineCommand({
|
|
|
359
570
|
},
|
|
360
571
|
json: sharedArgs.json
|
|
361
572
|
},
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
port: args.port
|
|
369
|
-
});
|
|
573
|
+
cwd: "agent",
|
|
574
|
+
async run({ args, cwd }) {
|
|
575
|
+
const { executeDev } = await import("./dev-C6SWaAZP.mjs");
|
|
576
|
+
return executeDev({
|
|
577
|
+
cwd,
|
|
578
|
+
port: args.port
|
|
370
579
|
});
|
|
371
580
|
}
|
|
372
581
|
});
|
|
373
|
-
const test =
|
|
582
|
+
const test = defineExec({
|
|
374
583
|
meta: {
|
|
375
584
|
name: "test",
|
|
376
585
|
description: "Run agent tests"
|
|
377
586
|
},
|
|
378
587
|
args: { json: sharedArgs.json },
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
return executeTest(cwd);
|
|
384
|
-
});
|
|
588
|
+
cwd: "agent",
|
|
589
|
+
async run({ cwd }) {
|
|
590
|
+
const { executeTest } = await import("./test-B6ZBxSpk.mjs");
|
|
591
|
+
return executeTest(cwd);
|
|
385
592
|
}
|
|
386
593
|
});
|
|
387
|
-
const build =
|
|
594
|
+
const build = defineExec({
|
|
388
595
|
meta: {
|
|
389
596
|
name: "build",
|
|
390
597
|
description: "Bundle agent without deploying"
|
|
@@ -400,19 +607,17 @@ const build = defineCommand({
|
|
|
400
607
|
description: "Skip type checking before build"
|
|
401
608
|
}
|
|
402
609
|
},
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
skipTypecheck: args.skipTypecheck
|
|
411
|
-
});
|
|
610
|
+
cwd: "agent",
|
|
611
|
+
async run({ args, cwd }) {
|
|
612
|
+
const { executeBuild } = await import("./build-BO1Ni6oJ.mjs");
|
|
613
|
+
return executeBuild({
|
|
614
|
+
cwd,
|
|
615
|
+
skipTests: args.skipTests,
|
|
616
|
+
skipTypecheck: args.skipTypecheck
|
|
412
617
|
});
|
|
413
618
|
}
|
|
414
619
|
});
|
|
415
|
-
const eject =
|
|
620
|
+
const eject = defineExec({
|
|
416
621
|
meta: {
|
|
417
622
|
name: "eject",
|
|
418
623
|
description: "Add the self-hosted server.mjs entrypoint to an older project"
|
|
@@ -425,18 +630,16 @@ const eject = defineCommand({
|
|
|
425
630
|
},
|
|
426
631
|
json: sharedArgs.json
|
|
427
632
|
},
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
force: args.force
|
|
435
|
-
});
|
|
633
|
+
cwd: "agent",
|
|
634
|
+
async run({ args, cwd }) {
|
|
635
|
+
const { executeEject } = await import("./eject-Zrzk5KV3.mjs");
|
|
636
|
+
return executeEject({
|
|
637
|
+
cwd,
|
|
638
|
+
force: args.force
|
|
436
639
|
});
|
|
437
640
|
}
|
|
438
641
|
});
|
|
439
|
-
const deploy =
|
|
642
|
+
const deploy = defineExec({
|
|
440
643
|
meta: {
|
|
441
644
|
name: "deploy",
|
|
442
645
|
description: "(internal) used by studio Publish",
|
|
@@ -454,20 +657,18 @@ const deploy = defineCommand({
|
|
|
454
657
|
description: "Skip type checking before deploy"
|
|
455
658
|
}
|
|
456
659
|
},
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
skipTypecheck: args.skipTypecheck
|
|
466
|
-
});
|
|
660
|
+
cwd: "agent",
|
|
661
|
+
async run({ args, cwd }) {
|
|
662
|
+
const { executeDeploy } = await import("./deploy-DJ3HRcia.mjs");
|
|
663
|
+
return executeDeploy({
|
|
664
|
+
cwd,
|
|
665
|
+
server: args.server,
|
|
666
|
+
allowPreviewSlug: args.allowPreviewSlug,
|
|
667
|
+
skipTypecheck: args.skipTypecheck
|
|
467
668
|
});
|
|
468
669
|
}
|
|
469
670
|
});
|
|
470
|
-
const del =
|
|
671
|
+
const del = defineExec({
|
|
471
672
|
meta: {
|
|
472
673
|
name: "delete",
|
|
473
674
|
description: "Delete the studio project and its deployed agents"
|
|
@@ -476,14 +677,12 @@ const del = defineCommand({
|
|
|
476
677
|
server: sharedArgs.server,
|
|
477
678
|
json: sharedArgs.json
|
|
478
679
|
},
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
server: args.server
|
|
486
|
-
});
|
|
680
|
+
cwd: "any",
|
|
681
|
+
async run({ args, cwd }) {
|
|
682
|
+
const { executeDelete } = await import("./delete-4I0uNR4a.mjs");
|
|
683
|
+
return executeDelete({
|
|
684
|
+
cwd,
|
|
685
|
+
server: args.server
|
|
487
686
|
});
|
|
488
687
|
}
|
|
489
688
|
});
|
|
@@ -493,7 +692,7 @@ const secret = defineCommand({
|
|
|
493
692
|
description: "Manage agent secrets"
|
|
494
693
|
},
|
|
495
694
|
subCommands: {
|
|
496
|
-
put:
|
|
695
|
+
put: defineExec({
|
|
497
696
|
meta: {
|
|
498
697
|
name: "put",
|
|
499
698
|
description: "Create or update a secret"
|
|
@@ -507,17 +706,15 @@ const secret = defineCommand({
|
|
|
507
706
|
server: sharedArgs.server,
|
|
508
707
|
json: sharedArgs.json
|
|
509
708
|
},
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
return executeSecretPut(cwd, args.name, value, args.server);
|
|
517
|
-
});
|
|
709
|
+
cwd: "any",
|
|
710
|
+
async run({ args, mode, cwd }) {
|
|
711
|
+
const { executeSecretPut, NO_INPUT, readStdin } = await import("./secret-DzSQx1Ds.mjs");
|
|
712
|
+
const value = mode === "json" ? await readStdin() : void 0;
|
|
713
|
+
if (mode === "json" && !value) throw new CliError(...NO_INPUT);
|
|
714
|
+
return executeSecretPut(cwd, args.name, value, args.server);
|
|
518
715
|
}
|
|
519
716
|
}),
|
|
520
|
-
delete:
|
|
717
|
+
delete: defineExec({
|
|
521
718
|
meta: {
|
|
522
719
|
name: "delete",
|
|
523
720
|
description: "Delete a secret"
|
|
@@ -531,15 +728,13 @@ const secret = defineCommand({
|
|
|
531
728
|
server: sharedArgs.server,
|
|
532
729
|
json: sharedArgs.json
|
|
533
730
|
},
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
return executeSecretDelete(cwd, args.name, args.server);
|
|
539
|
-
});
|
|
731
|
+
cwd: "any",
|
|
732
|
+
async run({ args, cwd }) {
|
|
733
|
+
const { executeSecretDelete } = await import("./secret-DzSQx1Ds.mjs");
|
|
734
|
+
return executeSecretDelete(cwd, args.name, args.server);
|
|
540
735
|
}
|
|
541
736
|
}),
|
|
542
|
-
list:
|
|
737
|
+
list: defineExec({
|
|
543
738
|
meta: {
|
|
544
739
|
name: "list",
|
|
545
740
|
description: "List all secrets"
|
|
@@ -548,19 +743,16 @@ const secret = defineCommand({
|
|
|
548
743
|
server: sharedArgs.server,
|
|
549
744
|
json: sharedArgs.json
|
|
550
745
|
},
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
return executeSecretList(cwd, args.server);
|
|
556
|
-
});
|
|
746
|
+
cwd: "any",
|
|
747
|
+
async run({ args, cwd }) {
|
|
748
|
+
const { executeSecretList } = await import("./secret-DzSQx1Ds.mjs");
|
|
749
|
+
return executeSecretList(cwd, args.server);
|
|
557
750
|
}
|
|
558
751
|
})
|
|
559
752
|
}
|
|
560
753
|
});
|
|
561
|
-
/**
|
|
562
|
-
function resolveStorageCwd(dir) {
|
|
563
|
-
const cwd = resolveCwd();
|
|
754
|
+
/** A storage subcommand's optional [dir], resolved against the working directory. */
|
|
755
|
+
function resolveStorageCwd(cwd, dir) {
|
|
564
756
|
return dir ? path.resolve(cwd, dir) : cwd;
|
|
565
757
|
}
|
|
566
758
|
const storageDir = {
|
|
@@ -574,7 +766,7 @@ const storage = defineCommand({
|
|
|
574
766
|
description: "Manage the agent's app database"
|
|
575
767
|
},
|
|
576
768
|
subCommands: {
|
|
577
|
-
status:
|
|
769
|
+
status: defineExec({
|
|
578
770
|
meta: {
|
|
579
771
|
name: "status",
|
|
580
772
|
description: "Show whether storage is enabled"
|
|
@@ -584,14 +776,13 @@ const storage = defineCommand({
|
|
|
584
776
|
server: sharedArgs.server,
|
|
585
777
|
json: sharedArgs.json
|
|
586
778
|
},
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
});
|
|
779
|
+
cwd: "any",
|
|
780
|
+
async run({ args, cwd }) {
|
|
781
|
+
const { executeStorageStatus } = await import("./storage-C-Do0mIA.mjs");
|
|
782
|
+
return executeStorageStatus(resolveStorageCwd(cwd, args.dir), args.server);
|
|
592
783
|
}
|
|
593
784
|
}),
|
|
594
|
-
enable:
|
|
785
|
+
enable: defineExec({
|
|
595
786
|
meta: {
|
|
596
787
|
name: "enable",
|
|
597
788
|
description: "Enable the agent's app database"
|
|
@@ -601,14 +792,13 @@ const storage = defineCommand({
|
|
|
601
792
|
server: sharedArgs.server,
|
|
602
793
|
json: sharedArgs.json
|
|
603
794
|
},
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
});
|
|
795
|
+
cwd: "any",
|
|
796
|
+
async run({ args, cwd }) {
|
|
797
|
+
const { executeStorageEnable } = await import("./storage-C-Do0mIA.mjs");
|
|
798
|
+
return executeStorageEnable(resolveStorageCwd(cwd, args.dir), args.server);
|
|
609
799
|
}
|
|
610
800
|
}),
|
|
611
|
-
disable:
|
|
801
|
+
disable: defineExec({
|
|
612
802
|
meta: {
|
|
613
803
|
name: "disable",
|
|
614
804
|
description: "Disable storage and DROP the database schema with all its data"
|
|
@@ -623,61 +813,19 @@ const storage = defineCommand({
|
|
|
623
813
|
server: sharedArgs.server,
|
|
624
814
|
json: sharedArgs.json
|
|
625
815
|
},
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
});
|
|
816
|
+
cwd: "any",
|
|
817
|
+
async run({ args, cwd }) {
|
|
818
|
+
const { executeStorageDisable } = await import("./storage-C-Do0mIA.mjs");
|
|
819
|
+
return executeStorageDisable(resolveStorageCwd(cwd, args.dir), {
|
|
820
|
+
server: args.server,
|
|
821
|
+
force: args.force
|
|
633
822
|
});
|
|
634
823
|
}
|
|
635
824
|
})
|
|
636
825
|
}
|
|
637
826
|
});
|
|
638
|
-
const login = defineCommand({
|
|
639
|
-
meta: {
|
|
640
|
-
name: "login",
|
|
641
|
-
description: "Link your signed-in browser account and save your API key"
|
|
642
|
-
},
|
|
643
|
-
args: {
|
|
644
|
-
server: sharedArgs.server,
|
|
645
|
-
json: sharedArgs.json
|
|
646
|
-
},
|
|
647
|
-
async run({ args }) {
|
|
648
|
-
await runCommand(args, async () => {
|
|
649
|
-
const { executeLogin } = await import("./login-BQQaxJhL.mjs");
|
|
650
|
-
return executeLogin({ server: args.server });
|
|
651
|
-
});
|
|
652
|
-
}
|
|
653
|
-
});
|
|
654
|
-
const templates = defineCommand({
|
|
655
|
-
meta: {
|
|
656
|
-
name: "templates",
|
|
657
|
-
description: "List available project templates"
|
|
658
|
-
},
|
|
659
|
-
args: { json: sharedArgs.json },
|
|
660
|
-
async run({ args }) {
|
|
661
|
-
await runCommand(args, async (mode) => {
|
|
662
|
-
const { listTemplates } = await import("./_templates-B1kt3BGt.mjs");
|
|
663
|
-
const names = await listTemplates();
|
|
664
|
-
if (mode === "human") {
|
|
665
|
-
for (const name of names) log.message(name);
|
|
666
|
-
log.info("Scaffold one with `aai init --template <name>`.");
|
|
667
|
-
}
|
|
668
|
-
return {
|
|
669
|
-
ok: true,
|
|
670
|
-
data: { templates: names }
|
|
671
|
-
};
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
});
|
|
675
827
|
const mainCommand = defineCommand({
|
|
676
|
-
meta:
|
|
677
|
-
name: "aai",
|
|
678
|
-
version: VERSION,
|
|
679
|
-
description: "Voice agent development kit"
|
|
680
|
-
},
|
|
828
|
+
meta: mainMeta,
|
|
681
829
|
subCommands: {
|
|
682
830
|
init,
|
|
683
831
|
dev,
|
|
@@ -690,10 +838,44 @@ const mainCommand = defineCommand({
|
|
|
690
838
|
publish,
|
|
691
839
|
deploy,
|
|
692
840
|
delete: del,
|
|
693
|
-
login
|
|
841
|
+
login: defineExec({
|
|
842
|
+
meta: {
|
|
843
|
+
name: "login",
|
|
844
|
+
description: "Link your signed-in browser account and save your API key"
|
|
845
|
+
},
|
|
846
|
+
args: {
|
|
847
|
+
server: sharedArgs.server,
|
|
848
|
+
json: sharedArgs.json
|
|
849
|
+
},
|
|
850
|
+
cwd: "none",
|
|
851
|
+
async run({ args }) {
|
|
852
|
+
const { executeLogin } = await import("./login-k0Z3VQu9.mjs");
|
|
853
|
+
return executeLogin({ server: args.server });
|
|
854
|
+
}
|
|
855
|
+
}),
|
|
694
856
|
secret,
|
|
695
857
|
storage,
|
|
696
|
-
|
|
858
|
+
workflow,
|
|
859
|
+
templates: defineExec({
|
|
860
|
+
meta: {
|
|
861
|
+
name: "templates",
|
|
862
|
+
description: "List available project templates"
|
|
863
|
+
},
|
|
864
|
+
args: { json: sharedArgs.json },
|
|
865
|
+
cwd: "none",
|
|
866
|
+
async run({ mode }) {
|
|
867
|
+
const { listTemplates } = await import("./_templates-iDGjGiPf.mjs");
|
|
868
|
+
const names = await listTemplates();
|
|
869
|
+
if (mode === "human") {
|
|
870
|
+
for (const name of names) log.message(name);
|
|
871
|
+
log.info("Scaffold one with `aai init --template <name>`.");
|
|
872
|
+
}
|
|
873
|
+
return {
|
|
874
|
+
ok: true,
|
|
875
|
+
data: { templates: names }
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
})
|
|
697
879
|
}
|
|
698
880
|
});
|
|
699
881
|
if (process.env.VITEST !== "true") {
|
|
@@ -752,7 +934,7 @@ if (process.env.VITEST !== "true") {
|
|
|
752
934
|
process.exit(1);
|
|
753
935
|
};
|
|
754
936
|
runDefault().then(assertKnownFlags).then(() => runMain(mainCommand, { showUsage: usageForMode })).catch((err) => {
|
|
755
|
-
log.error(errorMessage(err));
|
|
937
|
+
log.error(errorMessage$1(err));
|
|
756
938
|
process.exitCode = 1;
|
|
757
939
|
});
|
|
758
940
|
}
|