@alexkroman1/aai-cli 13.2.0 → 13.3.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.
Files changed (70) hide show
  1. package/bin.mjs +1 -1
  2. package/dist/{_agent-BTwZJu4P.mjs → _agent-Clbq3a4h.mjs} +2 -2
  3. package/dist/{_bundler-C31rlcYz.mjs → _bundler-DEkjO1d8.mjs} +3 -3
  4. package/dist/{_config-CmJOFsAP.mjs → _config-ZY2euhdh.mjs} +7 -4
  5. package/dist/_config.d.ts +25 -1
  6. package/dist/{_dev-server-DWvkNoIS.mjs → _dev-server-C13xuGB1.mjs} +13 -13
  7. package/dist/_e2e-test-utils.d.ts +15 -7
  8. package/dist/{_init-BURbdHNM.mjs → _init-Ci4QGjp8.mjs} +58 -10
  9. package/dist/{_output-CKkmWs7i.mjs → _output-DbJt9gsl.mjs} +34 -3
  10. package/dist/_output.d.ts +17 -1
  11. package/dist/{_preflight-Co1G9Jww.mjs → _preflight-B2laWPdU.mjs} +1 -1
  12. package/dist/{_server-common-6e0QI4mq.mjs → _server-common-BV4_CrP3.mjs} +3 -3
  13. package/dist/{_slug-api-CfGQq1Tt.mjs → _slug-api-DlKpj91X.mjs} +3 -3
  14. package/dist/{_studio-B1waXMuR.mjs → _studio-DTi3EdXQ.mjs} +3 -3
  15. package/dist/{_templates-0Zr2z6yA.mjs → _templates-V4l5sZJy.mjs} +2 -2
  16. package/dist/{_typecheck-gate-BXvUNnfs.mjs → _typecheck-gate-sV4N5F93.mjs} +3 -3
  17. package/dist/{_ui-u7T4YooX.mjs → _ui-DCt4qZrk.mjs} +1 -1
  18. package/dist/{_utils-B8QmtFhK.mjs → _utils-Dhd058D9.mjs} +1 -1
  19. package/dist/{_vite-env-D9Qj6KPX.mjs → _vite-env-kejF0p2L.mjs} +1 -1
  20. package/dist/{_workflow-determinism-f9J-5Zlj.mjs → _workflow-determinism-C9l8uC2R.mjs} +1 -1
  21. package/dist/{build-BLlLOrng.mjs → build-CWyFGe-W.mjs} +11 -8
  22. package/dist/cli.d.ts +2 -1
  23. package/dist/cli.mjs +120 -46
  24. package/dist/{client-bundler-j5c46x0G.mjs → client-bundler-CT-_26c5.mjs} +4 -4
  25. package/dist/client-bundler.mjs +1 -1
  26. package/dist/{delete-X_CRgCf6.mjs → delete-RqlQZ6Y_.mjs} +6 -6
  27. package/dist/{deploy-BzZ-r4iM.mjs → deploy-B7f3CK7v.mjs} +13 -13
  28. package/dist/{dev-BDykFvcc.mjs → dev-DamXieW_.mjs} +5 -5
  29. package/dist/{eval-0qEOdm0l.mjs → eval-h3DTVfRw.mjs} +27 -11
  30. package/dist/eval.d.ts +2 -0
  31. package/dist/{init-BtJI306C.mjs → init-D-vFrV8h.mjs} +7 -7
  32. package/dist/{login-DeUETobb.mjs → login-CDiemNmC.mjs} +5 -5
  33. package/dist/{logs-hWnJ66Bl.mjs → logs-DGwPNCzB.mjs} +4 -4
  34. package/dist/project-config.mjs +1 -1
  35. package/dist/scaffold/.env.example +17 -1
  36. package/dist/scaffold/package.json +6 -5
  37. package/dist/secret-V1w7y9-j.mjs +162 -0
  38. package/dist/secret.d.ts +41 -8
  39. package/dist/{studio-BxAS_FQQ.mjs → studio-BpMCfUNx.mjs} +9 -9
  40. package/dist/templates/briefing-desk/agent.test.ts +7 -3
  41. package/dist/templates/call-audit/agent.test.ts +14 -3
  42. package/dist/templates/call-audit/client.tsx +14 -17
  43. package/dist/templates/embedded-assets/agent.test.ts +7 -1
  44. package/dist/templates/health-assistant/agent.test.ts +8 -4
  45. package/dist/templates/link-digest/agent.test.ts +7 -1
  46. package/dist/templates/link-digest/client.tsx +17 -21
  47. package/dist/templates/night-owl/agent.test.ts +6 -1
  48. package/dist/templates/pipeline-simple/agent.test.ts +31 -14
  49. package/dist/templates/podcast-digest/agent.test.ts +13 -3
  50. package/dist/templates/podcast-digest/client.tsx +12 -15
  51. package/dist/templates/recap-workflow/agent.test.ts +22 -9
  52. package/dist/templates/redline/agent.test.ts +7 -1
  53. package/dist/templates/redline/client.tsx +12 -15
  54. package/dist/templates/research-workflow/agent.test.ts +7 -1
  55. package/dist/templates/retail/registry.test.ts +99 -58
  56. package/dist/templates/simple/agent.test.ts +39 -6
  57. package/dist/templates/spoken-summary/agent.test.ts +12 -3
  58. package/dist/templates/spoken-summary/client.tsx +14 -18
  59. package/dist/templates/transcription-workflow/agent.test.ts +16 -8
  60. package/dist/templates/transcription-workflow/client.tsx +19 -26
  61. package/dist/test-guenJUxi.mjs +255 -0
  62. package/dist/test.d.ts +97 -31
  63. package/dist/typecheck.mjs +2 -2
  64. package/dist/worker-bundler.mjs +3 -3
  65. package/dist/{workflow-BBu5oEDw.mjs → workflow-BZyKLkhV.mjs} +5 -5
  66. package/package.json +10 -10
  67. package/dist/bin.d.mts +0 -2
  68. package/dist/secret-B-3T5tvr.mjs +0 -61
  69. package/dist/test-CiLab-AA.mjs +0 -182
  70. package/dist/tsdown.config.d.ts +0 -2
package/dist/cli.mjs CHANGED
@@ -1,13 +1,13 @@
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-CKkmWs7i.mjs";
3
- import { n as log, o as silenceOutput } from "./_ui-u7T4YooX.mjs";
4
- import { d as resolveCwd, o as errorMessage$1, s as fileExists, t as AGENT_ENTRY, u as readPackageJson } from "./_utils-B8QmtFhK.mjs";
2
+ import { i as installStdoutGuard, n as fail, o as writeLine, r as getOutputMode, t as CliError } from "./_output-DbJt9gsl.mjs";
3
+ import { n as log, o as silenceOutput } from "./_ui-DCt4qZrk.mjs";
4
+ import { d as resolveCwd, o as errorMessage$1, s as fileExists, t as AGENT_ENTRY, u as readPackageJson } from "./_utils-Dhd058D9.mjs";
5
5
  import { existsSync } 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
9
  import { isRecord } from "@alexkroman1/aai/utils";
10
- //#region _cli-common.ts
10
+ //#region src/_cli-common.ts
11
11
  /** Shared arg definitions for citty commands. */
12
12
  const sharedArgs = {
13
13
  server: {
@@ -238,16 +238,33 @@ function defineExec(spec) {
238
238
  });
239
239
  }
240
240
  //#endregion
241
- //#region _resource-commands.ts
241
+ //#region src/_resource-commands.ts
242
+ /**
243
+ * Refuse `aai secret put NAME value` instead of dropping the value.
244
+ *
245
+ * `value` is not a declared positional, and citty drops an undeclared one
246
+ * silently — so the natural guess set the secret to whatever stdin later
247
+ * yielded (usually nothing) and reported no problem, which is the same class
248
+ * of failure as the unknown flag `assertKnownFlags` exists for.
249
+ *
250
+ * REFUSED rather than accepted, deliberately: a value in argv is in the
251
+ * user's shell history and in `ps` output for every process on the machine,
252
+ * and this is the command whose whole subject is a credential. The extra
253
+ * token is NOT echoed back for the same reason.
254
+ */
255
+ function refuseValueInArgv(positionals) {
256
+ if (!positionals || positionals.length <= 1) return;
257
+ throw new CliError("usage", "`aai secret put` takes only the secret NAME — the value is read from stdin.", "Pipe it in: `printf %s \"$VALUE\" | aai secret put NAME`. A value passed as an argument would be left in your shell history and visible in `ps`.");
258
+ }
242
259
  const secretPut = defineExec({
243
260
  meta: {
244
261
  name: "put",
245
- description: "Create or update a secret"
262
+ description: "Create or update a secret (value read from stdin, or prompted on a terminal)"
246
263
  },
247
264
  args: {
248
265
  name: {
249
266
  type: "positional",
250
- description: "Secret name",
267
+ description: "Secret name. The VALUE is not an argument — pipe it in (`printf %s \"$VALUE\" | aai secret put NAME`), or be prompted, masked, when stdin is a terminal",
251
268
  required: true
252
269
  },
253
270
  server: sharedArgs.server,
@@ -255,9 +272,9 @@ const secretPut = defineExec({
255
272
  },
256
273
  cwd: "any",
257
274
  async run({ args, mode, cwd }) {
258
- const { executeSecretPut, NO_INPUT, readStdin } = await import("./secret-B-3T5tvr.mjs");
259
- const value = mode === "json" ? await readStdin() : void 0;
260
- if (mode === "json" && !value) throw new CliError(...NO_INPUT);
275
+ refuseValueInArgv(args._);
276
+ const { executeSecretPut, resolveSecretValue } = await import("./secret-V1w7y9-j.mjs");
277
+ const value = await resolveSecretValue(args.name, mode);
261
278
  return executeSecretPut(cwd, args.name, value, args.server);
262
279
  }
263
280
  });
@@ -277,7 +294,7 @@ const secretDelete = defineExec({
277
294
  },
278
295
  cwd: "any",
279
296
  async run({ args, cwd }) {
280
- const { executeSecretDelete } = await import("./secret-B-3T5tvr.mjs");
297
+ const { executeSecretDelete } = await import("./secret-V1w7y9-j.mjs");
281
298
  return executeSecretDelete(cwd, args.name, args.server);
282
299
  }
283
300
  });
@@ -292,7 +309,7 @@ const secretList = defineExec({
292
309
  },
293
310
  cwd: "any",
294
311
  async run({ args, cwd }) {
295
- const { executeSecretList } = await import("./secret-B-3T5tvr.mjs");
312
+ const { executeSecretList } = await import("./secret-V1w7y9-j.mjs");
296
313
  return executeSecretList(cwd, args.server);
297
314
  }
298
315
  });
@@ -332,7 +349,7 @@ const logs = defineExec({
332
349
  },
333
350
  cwd: "any",
334
351
  async run({ args, cwd }) {
335
- const { executeLogs } = await import("./logs-hWnJ66Bl.mjs");
352
+ const { executeLogs } = await import("./logs-DGwPNCzB.mjs");
336
353
  return executeLogs(resolveDirArg(cwd, args.dir), {
337
354
  server: args.server,
338
355
  follow: args.follow
@@ -340,7 +357,7 @@ const logs = defineExec({
340
357
  }
341
358
  });
342
359
  //#endregion
343
- //#region _studio-commands.ts
360
+ //#region src/_studio-commands.ts
344
361
  /**
345
362
  * The fast-forward override `push` and `publish` share — `publish` pushes
346
363
  * first, so the two must always describe the same thing to the user.
@@ -363,7 +380,7 @@ const list = defineExec({
363
380
  },
364
381
  cwd: "any",
365
382
  async run({ args, cwd }) {
366
- const { executeList } = await import("./studio-BxAS_FQQ.mjs");
383
+ const { executeList } = await import("./studio-BpMCfUNx.mjs");
367
384
  return executeList({
368
385
  cwd,
369
386
  server: args.server
@@ -396,7 +413,7 @@ const pull = defineExec({
396
413
  },
397
414
  cwd: "any",
398
415
  async run({ args, cwd }) {
399
- const { executePull } = await import("./studio-BxAS_FQQ.mjs");
416
+ const { executePull } = await import("./studio-BpMCfUNx.mjs");
400
417
  return executePull({
401
418
  cwd,
402
419
  project: args.project,
@@ -418,7 +435,7 @@ const push = defineExec({
418
435
  },
419
436
  cwd: "agent",
420
437
  async run({ args, cwd }) {
421
- const { executePush } = await import("./studio-BxAS_FQQ.mjs");
438
+ const { executePush } = await import("./studio-BpMCfUNx.mjs");
422
439
  return executePush({
423
440
  cwd,
424
441
  server: args.server,
@@ -442,7 +459,7 @@ const publish = defineExec({
442
459
  },
443
460
  cwd: "agent",
444
461
  async run({ args, cwd }) {
445
- const { executePublish } = await import("./studio-BxAS_FQQ.mjs");
462
+ const { executePublish } = await import("./studio-BpMCfUNx.mjs");
446
463
  return executePublish({
447
464
  cwd,
448
465
  server: args.server,
@@ -452,7 +469,7 @@ const publish = defineExec({
452
469
  }
453
470
  });
454
471
  //#endregion
455
- //#region cli-workflow.ts
472
+ //#region src/cli-workflow.ts
456
473
  /**
457
474
  * The `aai workflow` subcommand group.
458
475
  *
@@ -523,7 +540,7 @@ const workflowList = defineExec({
523
540
  args: workflowArgs,
524
541
  cwd: WORKFLOW_CWD,
525
542
  async run({ args, cwd }) {
526
- const { executeWorkflowList } = await import("./workflow-BBu5oEDw.mjs");
543
+ const { executeWorkflowList } = await import("./workflow-BZyKLkhV.mjs");
527
544
  return executeWorkflowList(cwd, {
528
545
  server: args.server,
529
546
  token: args.token,
@@ -550,7 +567,7 @@ const workflowRuns = defineExec({
550
567
  },
551
568
  cwd: WORKFLOW_CWD,
552
569
  async run({ args, cwd }) {
553
- const { executeWorkflowRuns } = await import("./workflow-BBu5oEDw.mjs");
570
+ const { executeWorkflowRuns } = await import("./workflow-BZyKLkhV.mjs");
554
571
  const limit = args.limit === void 0 ? void 0 : Number(args.limit);
555
572
  if (limit !== void 0 && !Number.isFinite(limit)) throw new CliError("bad_limit", "--limit must be a number");
556
573
  return executeWorkflowRuns(cwd, args.workflow, {
@@ -572,7 +589,7 @@ const workflowShow = defineExec({
572
589
  },
573
590
  cwd: WORKFLOW_CWD,
574
591
  async run({ args, cwd }) {
575
- const { executeWorkflowShow } = await import("./workflow-BBu5oEDw.mjs");
592
+ const { executeWorkflowShow } = await import("./workflow-BZyKLkhV.mjs");
576
593
  return executeWorkflowShow(cwd, args.runId, {
577
594
  server: args.server,
578
595
  token: args.token,
@@ -591,7 +608,7 @@ const workflowCancel = defineExec({
591
608
  },
592
609
  cwd: WORKFLOW_CWD,
593
610
  async run({ args, cwd }) {
594
- const { executeWorkflowCancel } = await import("./workflow-BBu5oEDw.mjs");
611
+ const { executeWorkflowCancel } = await import("./workflow-BZyKLkhV.mjs");
595
612
  return executeWorkflowCancel(cwd, args.runId, {
596
613
  server: args.server,
597
614
  token: args.token,
@@ -612,11 +629,11 @@ const workflow = defineCommand({
612
629
  }
613
630
  });
614
631
  //#endregion
615
- //#region cli.ts
632
+ //#region src/cli.ts
616
633
  const cliDir = path.dirname(fileURLToPath(import.meta.url));
617
634
  /**
618
- * Read this CLI's own version from its package.json (source layout keeps it
619
- * next to cli.ts; dist layout one level up). A missing or corrupt file must
635
+ * Read this CLI's own version from its package.json (one level up in both the
636
+ * source `src/` layout and the dist layout). A missing or corrupt file must
620
637
  * not brick every command over a cosmetic string — warn and fall back.
621
638
  */
622
639
  function readCliVersion(dir) {
@@ -678,7 +695,7 @@ const init = defineExec({
678
695
  },
679
696
  cwd: "none",
680
697
  async run({ args, mode }) {
681
- const { executeInit } = await import("./init-BtJI306C.mjs");
698
+ const { executeInit } = await import("./init-D-vFrV8h.mjs");
682
699
  return executeInit({
683
700
  dir: args.dir,
684
701
  force: args.force,
@@ -709,7 +726,7 @@ const dev = defineExec({
709
726
  },
710
727
  cwd: "agent",
711
728
  async run({ args, cwd }) {
712
- const { executeDev } = await import("./dev-BDykFvcc.mjs");
729
+ const { executeDev } = await import("./dev-DamXieW_.mjs");
713
730
  return executeDev({
714
731
  cwd,
715
732
  port: args.port,
@@ -722,11 +739,17 @@ const test = defineExec({
722
739
  name: "test",
723
740
  description: "Run agent tests"
724
741
  },
725
- args: { json: sharedArgs.json },
742
+ args: {
743
+ json: sharedArgs.json,
744
+ all: {
745
+ type: "boolean",
746
+ description: "Run every spec in the project, not just agent.test.ts"
747
+ }
748
+ },
726
749
  cwd: "agent",
727
- async run({ cwd }) {
728
- const { executeTest } = await import("./test-CiLab-AA.mjs");
729
- return executeTest(cwd);
750
+ async run({ args, cwd }) {
751
+ const { executeTest } = await import("./test-guenJUxi.mjs");
752
+ return executeTest(cwd, { all: args.all === true });
730
753
  }
731
754
  });
732
755
  const evalCommand = defineExec({
@@ -737,7 +760,7 @@ const evalCommand = defineExec({
737
760
  args: { json: sharedArgs.json },
738
761
  cwd: "agent",
739
762
  async run({ cwd }) {
740
- const { executeEval } = await import("./eval-0qEOdm0l.mjs");
763
+ const { executeEval } = await import("./eval-h3DTVfRw.mjs");
741
764
  return executeEval(cwd);
742
765
  }
743
766
  });
@@ -759,7 +782,7 @@ const build = defineExec({
759
782
  },
760
783
  cwd: "agent",
761
784
  async run({ args, cwd }) {
762
- const { executeBuild } = await import("./build-BLlLOrng.mjs");
785
+ const { executeBuild } = await import("./build-CWyFGe-W.mjs");
763
786
  return executeBuild({
764
787
  cwd,
765
788
  skipTests: args.skipTests,
@@ -787,7 +810,7 @@ const deploy = defineExec({
787
810
  },
788
811
  cwd: "agent",
789
812
  async run({ args, cwd }) {
790
- const { executeDeploy } = await import("./deploy-BzZ-r4iM.mjs");
813
+ const { executeDeploy } = await import("./deploy-B7f3CK7v.mjs");
791
814
  return executeDeploy({
792
815
  cwd,
793
816
  server: args.server,
@@ -807,7 +830,7 @@ const del = defineExec({
807
830
  },
808
831
  cwd: "any",
809
832
  async run({ args, cwd }) {
810
- const { executeDelete } = await import("./delete-X_CRgCf6.mjs");
833
+ const { executeDelete } = await import("./delete-RqlQZ6Y_.mjs");
811
834
  return executeDelete({
812
835
  cwd,
813
836
  server: args.server
@@ -825,7 +848,7 @@ const login = defineExec({
825
848
  },
826
849
  cwd: "none",
827
850
  async run({ args }) {
828
- const { executeLogin } = await import("./login-DeUETobb.mjs");
851
+ const { executeLogin } = await import("./login-CDiemNmC.mjs");
829
852
  return executeLogin({ server: args.server });
830
853
  }
831
854
  });
@@ -837,7 +860,7 @@ const templates = defineExec({
837
860
  args: { json: sharedArgs.json },
838
861
  cwd: "none",
839
862
  async run({ mode }) {
840
- const { listTemplates } = await import("./_templates-0Zr2z6yA.mjs");
863
+ const { listTemplates } = await import("./_templates-V4l5sZJy.mjs");
841
864
  const names = await listTemplates();
842
865
  if (mode === "human") {
843
866
  for (const name of names) log.message(name);
@@ -913,6 +936,63 @@ if (process.env.VITEST !== "true") {
913
936
  await writeLine(`${JSON.stringify(fail("usage", `Invalid arguments for \`${named}\`.`, `Run \`${named} --help\` to see the arguments it accepts.`))}\n`);
914
937
  };
915
938
  /**
939
+ * Report a pre-parse failure the way the active output mode allows, then
940
+ * exit 1.
941
+ *
942
+ * Mode-aware for the same reason `usageForMode` is: JSON mode promises
943
+ * exactly one result line on stdout, and it is auto-detected on a pipe —
944
+ * so a clack block here left `aai push --json --serverr=x` emitting a
945
+ * human error where a script's `jq` expected a result, and no JSON at all.
946
+ * The guards below run BEFORE citty parses, so neither can lean on
947
+ * `defineExec`'s mode plumbing.
948
+ */
949
+ const reportAndExit = async (label, hint) => {
950
+ if (getOutputMode({}) === "json") await writeLine(`${JSON.stringify(fail("usage", label, hint))}\n`);
951
+ else {
952
+ log.error(label);
953
+ log.info(hint);
954
+ }
955
+ process.exit(1);
956
+ };
957
+ /**
958
+ * Resolve a citty `Resolvable` field. The cast is `Resolvable<T>` admitting
959
+ * `T` itself, so `typeof value === "function"` narrows to `T & Function`
960
+ * alongside the two thunk signatures; `_cli-common.ts`'s copy does the same.
961
+ */
962
+ const resolveField = async (value) => typeof value === "function" ? await value() : await value;
963
+ /**
964
+ * Answer an unknown SUBCOMMAND here rather than leaving it to citty.
965
+ *
966
+ * citty throws `Unknown command ${cyan(name)}` and its own catch writes that
967
+ * message with `console.error` — colour escapes and all, whatever the output
968
+ * mode and whether or not stderr is a terminal — AFTER `showUsage` has
969
+ * already emitted the result line. So `aai deploy-now | jq` produced an
970
+ * envelope that named `aai` instead of the token the user typed, plus an
971
+ * ANSI-studded sentence on stderr that no JSON consumer asked for. Reported
972
+ * here instead: the envelope names the command, and nothing colours a pipe.
973
+ *
974
+ * The tree walk is the same one `unknownFlagsForArgv` does in
975
+ * `_cli-common.ts`, which cannot report this case (it returns `[]` for it,
976
+ * because the flags would be matched against the wrong command). Worth
977
+ * hoisting into that module next to it.
978
+ */
979
+ const assertKnownCommand = async () => {
980
+ let cmd = mainCommand;
981
+ const named = ["aai"];
982
+ for (const token of process.argv.slice(2)) {
983
+ if (token.startsWith("-")) return;
984
+ const subCommands = await resolveField(cmd.subCommands);
985
+ if (!subCommands || Object.keys(subCommands).length === 0) return;
986
+ const next = await resolveField(subCommands[token]);
987
+ if (next === void 0) {
988
+ await reportAndExit(`Unknown command: ${token}`, `Run \`${named.join(" ")} --help\` to see the commands it accepts.`);
989
+ return;
990
+ }
991
+ cmd = next;
992
+ named.push(token);
993
+ }
994
+ };
995
+ /**
916
996
  * Refuse an unrecognized flag instead of ignoring it.
917
997
  *
918
998
  * citty drops one silently, so `aai push --serverr=http://x` exited 0 having
@@ -923,15 +1003,9 @@ if (process.env.VITEST !== "true") {
923
1003
  const unknown = await unknownFlagsForArgv(mainCommand, process.argv.slice(2));
924
1004
  if (unknown.length === 0) return;
925
1005
  const label = `Unknown ${unknown.length === 1 ? "option" : "options"}: ${unknown.join(", ")}`;
926
- const hint = "Run `aai <command> --help` to see the options it accepts.";
927
- if (getOutputMode({}) === "json") await writeLine(`${JSON.stringify(fail("usage", label, hint))}\n`);
928
- else {
929
- log.error(label);
930
- log.info(hint);
931
- }
932
- process.exit(1);
1006
+ await reportAndExit(label, "Run `aai <command> --help` to see the options it accepts.");
933
1007
  };
934
- runDefault().then(assertKnownFlags).then(() => runMain(mainCommand, { showUsage: usageForMode })).catch((err) => {
1008
+ runDefault().then(assertKnownCommand).then(assertKnownFlags).then(() => runMain(mainCommand, { showUsage: usageForMode })).catch((err) => {
935
1009
  log.error(errorMessage$1(err));
936
1010
  process.exitCode = 1;
937
1011
  });
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import { o as errorMessage$1, s as fileExists } from "./_utils-B8QmtFhK.mjs";
3
- import { n as withPreservedNodeEnv, t as DEDUPED_PEERS } from "./_vite-env-D9Qj6KPX.mjs";
2
+ import { o as errorMessage$1, s as fileExists } from "./_utils-Dhd058D9.mjs";
3
+ import { n as withPreservedNodeEnv, t as DEDUPED_PEERS } from "./_vite-env-kejF0p2L.mjs";
4
4
  import { existsSync, unlinkSync, writeFileSync } from "node:fs";
5
5
  import path from "node:path";
6
6
  import { omitUndefined } from "@alexkroman1/aai/utils";
7
7
  import fs from "node:fs/promises";
8
8
  import { isTextAssetPath } from "@alexkroman1/aai/internal";
9
9
  import { build } from "vite";
10
- //#region _default-html.ts
10
+ //#region src/_default-html.ts
11
11
  /**
12
12
  * Default index.html for agents with a custom client.tsx but no index.html.
13
13
  * Used by both the dev server (Vite HMR) and the production bundler.
@@ -71,7 +71,7 @@ function writeTempHtml(root) {
71
71
  return cleanup;
72
72
  }
73
73
  //#endregion
74
- //#region client-bundler.ts
74
+ //#region src/client-bundler.ts
75
75
  const DEFAULT_OUT_DIR = ".aai/client";
76
76
  /**
77
77
  * Build the client SPA with Vite if `client.tsx` exists.
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import { t as buildClient } from "./client-bundler-j5c46x0G.mjs";
2
+ import { t as buildClient } from "./client-bundler-CT-_26c5.mjs";
3
3
  export { buildClient };
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { a as ok } from "./_output-CKkmWs7i.mjs";
3
- import { n as log } from "./_ui-u7T4YooX.mjs";
4
- import { l as writeProjectConfig } from "./_config-CmJOFsAP.mjs";
5
- import { a as resolveDeployTarget, i as requireDeployedSlug } from "./_agent-BTwZJu4P.mjs";
6
- import { d as apiTestSeam, l as HINT_NOT_DEPLOYED, s as studioProjectApiUrl, u as apiRequest } from "./_studio-B1waXMuR.mjs";
2
+ import { a as ok } from "./_output-DbJt9gsl.mjs";
3
+ import { n as log } from "./_ui-DCt4qZrk.mjs";
4
+ import { l as writeProjectConfig } from "./_config-ZY2euhdh.mjs";
5
+ import { a as resolveDeployTarget, i as requireDeployedSlug } from "./_agent-Clbq3a4h.mjs";
6
+ import { d as apiTestSeam, l as HINT_NOT_DEPLOYED, s as studioProjectApiUrl, u as apiRequest } from "./_studio-DTi3EdXQ.mjs";
7
7
  import { omitUndefined } from "@alexkroman1/aai/utils";
8
- //#region delete.ts
8
+ //#region src/delete.ts
9
9
  async function runDelete(opts) {
10
10
  await apiRequest(`${opts.url}/${opts.slug}`, {
11
11
  method: "DELETE",
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
- import { a as ok } from "./_output-CKkmWs7i.mjs";
3
- import { n as log, r as notify, t as fmtUrl } from "./_ui-u7T4YooX.mjs";
4
- import { o as errorMessage$1 } from "./_utils-B8QmtFhK.mjs";
5
- import { s as updateProjectConfig } from "./_config-CmJOFsAP.mjs";
6
- import { i as evalWorkerConfig, t as buildAgentBundle } from "./_bundler-C31rlcYz.mjs";
7
- import { t as resolveServerEnv } from "./_server-common-6e0QI4mq.mjs";
8
- import { a as resolveDeployTarget } from "./_agent-BTwZJu4P.mjs";
9
- import { assertTypechecks } from "./_typecheck-gate-BXvUNnfs.mjs";
10
- import { n as scanWorkflowDeterminism, t as determinismWarnings } from "./_workflow-determinism-f9J-5Zlj.mjs";
11
- import { d as apiTestSeam, f as checkedResponse, i as projectNameFromDir, u as apiRequest } from "./_studio-B1waXMuR.mjs";
2
+ import { a as ok } from "./_output-DbJt9gsl.mjs";
3
+ import { n as log, r as notify, t as fmtUrl } from "./_ui-DCt4qZrk.mjs";
4
+ import { o as errorMessage$1 } from "./_utils-Dhd058D9.mjs";
5
+ import { s as updateProjectConfig } from "./_config-ZY2euhdh.mjs";
6
+ import { i as evalWorkerConfig, t as buildAgentBundle } from "./_bundler-DEkjO1d8.mjs";
7
+ import { t as resolveServerEnv } from "./_server-common-BV4_CrP3.mjs";
8
+ import { a as resolveDeployTarget } from "./_agent-Clbq3a4h.mjs";
9
+ import { assertTypechecks } from "./_typecheck-gate-sV4N5F93.mjs";
10
+ import { n as scanWorkflowDeterminism, t as determinismWarnings } from "./_workflow-determinism-C9l8uC2R.mjs";
11
+ import { d as apiTestSeam, f as checkedResponse, i as projectNameFromDir, u as apiRequest } from "./_studio-DTi3EdXQ.mjs";
12
12
  import { isRecord, omitUndefined } from "@alexkroman1/aai/utils";
13
13
  import { gzipSync } from "node:zlib";
14
- //#region _deploy.ts
14
+ //#region src/_deploy.ts
15
15
  async function runDeploy(opts) {
16
16
  const body = gzipSync(JSON.stringify({
17
17
  ...omitUndefined({ slug: opts.slug }),
@@ -36,12 +36,12 @@ async function runDeploy(opts) {
36
36
  return checkedResponse(data, (value) => isRecord(value) && typeof value.slug === "string", `the deploy route at ${opts.url}`);
37
37
  }
38
38
  //#endregion
39
- //#region deploy.ts
39
+ //#region src/deploy.ts
40
40
  async function executeDeploy(opts) {
41
41
  const { cwd } = opts;
42
42
  const { config: projectConfig, serverUrl, apiKey } = await resolveDeployTarget(cwd, opts.server);
43
43
  if (!opts.skipTypecheck) await assertTypechecks(cwd);
44
- const preflightModule = import("./_preflight-Co1G9Jww.mjs");
44
+ const preflightModule = import("./_preflight-B2laWPdU.mjs");
45
45
  const bundle = await buildAgentBundle(cwd, { minify: true });
46
46
  const slug = projectConfig?.slug ?? projectNameFromDir(cwd) ?? void 0;
47
47
  const uploadEnv = {
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { a as ok } from "./_output-CKkmWs7i.mjs";
3
- import { a as parsePort, n as log, r as notify, t as fmtUrl } from "./_ui-u7T4YooX.mjs";
4
- import { a as errorDetail } from "./_utils-B8QmtFhK.mjs";
2
+ import { a as ok } from "./_output-DbJt9gsl.mjs";
3
+ import { a as parsePort, n as log, r as notify, t as fmtUrl } from "./_ui-DCt4qZrk.mjs";
4
+ import { a as errorDetail } from "./_utils-Dhd058D9.mjs";
5
5
  import path from "node:path";
6
6
  import { styleText } from "node:util";
7
- //#region dev.ts
7
+ //#region src/dev.ts
8
8
  /**
9
9
  * Start the dev server and return the result.
10
10
  * The process stays alive after this returns — caller handles signals.
@@ -12,7 +12,7 @@ import { styleText } from "node:util";
12
12
  async function executeDev(opts) {
13
13
  const port = parsePort(opts.port);
14
14
  const agentName = path.basename(path.resolve(opts.cwd));
15
- const { startDevServer } = await import("./_dev-server-DWvkNoIS.mjs");
15
+ const { startDevServer } = await import("./_dev-server-C13xuGB1.mjs");
16
16
  let cleanup;
17
17
  let shuttingDown = false;
18
18
  const onSignal = () => {
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { a as ok, n as fail } from "./_output-CKkmWs7i.mjs";
3
- import { n as log } from "./_ui-u7T4YooX.mjs";
4
- import { t as resolveServerEnv } from "./_server-common-6e0QI4mq.mjs";
5
- import { classifyVitestError, runVitest } from "./test-CiLab-AA.mjs";
6
- //#region eval.ts
2
+ import { a as ok, n as fail } from "./_output-DbJt9gsl.mjs";
3
+ import { n as log } from "./_ui-DCt4qZrk.mjs";
4
+ import { t as resolveServerEnv } from "./_server-common-BV4_CrP3.mjs";
5
+ import { classifyVitestError, runVitest } from "./test-guenJUxi.mjs";
6
+ //#region src/eval.ts
7
7
  /**
8
8
  * `aai eval` — run the agent's behaviour evals via vitest.
9
9
  *
@@ -29,24 +29,40 @@ import { classifyVitestError, runVitest } from "./test-CiLab-AA.mjs";
29
29
  */
30
30
  /** The files `aai eval` runs, in preference order. */
31
31
  const EVAL_FILES = ["agent.eval.test.ts", "agent.eval.test.js"];
32
+ /**
33
+ * How long one eval case may run.
34
+ *
35
+ * Vitest's default is 5s, which is shorter than a single live model turn on a
36
+ * slow day — so without this every case fails as a timeout and the report says
37
+ * nothing about the agent. Generous rather than tuned: the harness has its own
38
+ * 90s per-turn timeout with a message naming the events it saw, and that is the
39
+ * diagnostic worth reaching. This ceiling only exists so a wedged run ends.
40
+ */
41
+ const EVAL_TEST_TIMEOUT_MS = 3e5;
32
42
  /** Execute the agent's evals and return a structured result. */
33
43
  async function executeEval(cwd) {
34
44
  log.step("Running agent evals");
35
45
  const env = await resolveServerEnv(cwd);
36
46
  try {
37
- if (!runVitest(cwd, {
47
+ const ran = runVitest(cwd, {
38
48
  candidates: EVAL_FILES,
39
- extraArgs: ["--testTimeout", String(3e5)],
40
- env
41
- })) {
49
+ extraArgs: ["--testTimeout", String(EVAL_TEST_TIMEOUT_MS)],
50
+ env,
51
+ announceUnrun: false
52
+ });
53
+ if (!ran) {
42
54
  log.info("No eval file found. Create agent.eval.test.ts to measure what the agent does — see `openEvalSession` in @alexkroman1/aai-runtime/eval.");
43
55
  return ok({
44
56
  passed: true,
45
- skipped: true
57
+ skipped: true,
58
+ ran: []
46
59
  });
47
60
  }
48
61
  log.success("Evals passed");
49
- return ok({ passed: true });
62
+ return ok({
63
+ passed: true,
64
+ ran
65
+ });
50
66
  } catch (err) {
51
67
  const { code, message } = classifyVitestError(err, "Evals");
52
68
  return fail(code, message);
package/dist/eval.d.ts CHANGED
@@ -25,6 +25,8 @@ import { type CommandResult } from "./_output.ts";
25
25
  type EvalData = {
26
26
  passed: boolean;
27
27
  skipped?: boolean;
28
+ /** The eval file(s) this run covered — `aai test`'s result names its set too. */
29
+ ran: string[];
28
30
  };
29
31
  /** The files `aai eval` runs, in preference order. */
30
32
  export declare const EVAL_FILES: readonly ["agent.eval.test.ts", "agent.eval.test.js"];
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import { a as ok } from "./_output-CKkmWs7i.mjs";
3
- import { n as log, s as unwrapCancel } from "./_ui-u7T4YooX.mjs";
4
- import { d as resolveCwd, l as readJson, o as errorMessage$1, s as fileExists, t as AGENT_ENTRY } from "./_utils-B8QmtFhK.mjs";
5
- import { r as isDevMode, t as getMonorepoRoot } from "./_agent-BTwZJu4P.mjs";
2
+ import { a as ok } from "./_output-DbJt9gsl.mjs";
3
+ import { n as log, s as unwrapCancel } from "./_ui-DCt4qZrk.mjs";
4
+ import { d as resolveCwd, l as readJson, o as errorMessage$1, s as fileExists, t as AGENT_ENTRY } from "./_utils-Dhd058D9.mjs";
5
+ import { r as isDevMode, t as getMonorepoRoot } from "./_agent-Clbq3a4h.mjs";
6
6
  import path from "node:path";
7
7
  import { omitUndefined } from "@alexkroman1/aai/utils";
8
8
  import { styleText } from "node:util";
9
9
  import * as p from "@clack/prompts";
10
10
  import { execa } from "execa";
11
- //#region init.ts
11
+ //#region src/init.ts
12
12
  /**
13
13
  * Run `fn` behind a clack spinner, stopping it in EVERY outcome.
14
14
  *
@@ -106,7 +106,7 @@ function collectWarnings() {
106
106
  }
107
107
  /** Publish after init and return deploy metadata if successful. */
108
108
  async function tryPublish(cwd, server, warn) {
109
- const { executePublish } = await import("./studio-BxAS_FQQ.mjs");
109
+ const { executePublish } = await import("./studio-BpMCfUNx.mjs");
110
110
  try {
111
111
  const result = await executePublish({
112
112
  cwd,
@@ -127,7 +127,7 @@ async function tryPublish(cwd, server, warn) {
127
127
  }
128
128
  /** Scaffold the project, optionally showing a spinner. */
129
129
  async function scaffoldProject(dir, cwd, template, silent) {
130
- const { runInit } = await import("./_init-BURbdHNM.mjs");
130
+ const { runInit } = await import("./_init-Ci4QGjp8.mjs");
131
131
  await withSpinner(silent, {
132
132
  start: `Creating ${dir}`,
133
133
  done: "Project created",
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { a as ok, t as CliError } from "./_output-CKkmWs7i.mjs";
3
- import { n as log } from "./_ui-u7T4YooX.mjs";
4
- import { o as updateGlobalConfig, r as readGlobalConfig, t as approveServer } from "./_config-CmJOFsAP.mjs";
5
- import { o as resolveServerUrl } from "./_agent-BTwZJu4P.mjs";
2
+ import { a as ok, t as CliError } from "./_output-DbJt9gsl.mjs";
3
+ import { n as log } from "./_ui-DCt4qZrk.mjs";
4
+ import { o as updateGlobalConfig, r as readGlobalConfig, t as approveServer } from "./_config-ZY2euhdh.mjs";
5
+ import { o as resolveServerUrl } from "./_agent-Clbq3a4h.mjs";
6
6
  import { linkConfirmationCode, sleep } from "@alexkroman1/aai/internal";
7
7
  import { spawn } from "node:child_process";
8
8
  import { randomBytes } from "node:crypto";
9
- //#region login.ts
9
+ //#region src/login.ts
10
10
  /**
11
11
  * `aai login` — link the CLI to an account that is ALREADY signed in to the
12
12
  * browser studio, ending with the account's AssemblyAI API key stored in
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { a as ok } from "./_output-CKkmWs7i.mjs";
3
- import { n as log } from "./_ui-u7T4YooX.mjs";
4
- import { f as checkedResponse } from "./_studio-B1waXMuR.mjs";
5
- import { n as slugRequest } from "./_slug-api-CfGQq1Tt.mjs";
2
+ import { a as ok } from "./_output-DbJt9gsl.mjs";
3
+ import { n as log } from "./_ui-DCt4qZrk.mjs";
4
+ import { f as checkedResponse } from "./_studio-DTi3EdXQ.mjs";
5
+ import { n as slugRequest } from "./_slug-api-DlKpj91X.mjs";
6
6
  import { isRecord, omitUndefined } from "@alexkroman1/aai/utils";
7
7
  import { sleep } from "@alexkroman1/aai/internal";
8
8
  function isLogsPage(value) {
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import { c as writeGlobalConfig, s as updateProjectConfig } from "./_config-CmJOFsAP.mjs";
2
+ import { c as writeGlobalConfig, s as updateProjectConfig } from "./_config-ZY2euhdh.mjs";
3
3
  export { updateProjectConfig, writeGlobalConfig as writeConfigHome };