agent-inspect 5.4.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@ import { createServer } from 'http';
11
11
  import { createRequire } from 'module';
12
12
 
13
13
  // package.json
14
- var version = "5.4.0";
14
+ var version = "6.0.0";
15
15
 
16
16
  // packages/cli/src/trace-dir-scale.ts
17
17
  var TRACE_COUNT_WARN = 1e3;
@@ -7075,6 +7075,63 @@ async function serveCommand(options = {}) {
7075
7075
  });
7076
7076
  }
7077
7077
 
7078
+ // packages/cli/src/studio-cmd.ts
7079
+ var PACKAGE = "@agent-inspect/studio";
7080
+ function isModuleNotFound3(e) {
7081
+ return e !== null && typeof e === "object" && "code" in e && (e.code === "ERR_MODULE_NOT_FOUND" || e.code === "MODULE_NOT_FOUND");
7082
+ }
7083
+ async function loadStudio() {
7084
+ try {
7085
+ return await import('@agent-inspect/studio');
7086
+ } catch (e) {
7087
+ if (isModuleNotFound3(e)) {
7088
+ console.error(
7089
+ `The optional Studio analyzer is not installed. Run: npm install ${PACKAGE}`
7090
+ );
7091
+ process.exitCode = 1;
7092
+ return null;
7093
+ }
7094
+ const msg = e instanceof Error ? e.message : String(e);
7095
+ console.error(`[AgentInspect] failed to load ${PACKAGE}: ${msg}`);
7096
+ process.exitCode = 1;
7097
+ return null;
7098
+ }
7099
+ }
7100
+ function parsePort2(value) {
7101
+ if (value === void 0) return void 0;
7102
+ const parsed = Number(value);
7103
+ if (!Number.isInteger(parsed) || parsed <= 0 || parsed > 65535) {
7104
+ throw new Error("--port must be an integer between 1 and 65535.");
7105
+ }
7106
+ return parsed;
7107
+ }
7108
+ async function studioCommand(options = {}) {
7109
+ const mod = await loadStudio();
7110
+ if (!mod) return;
7111
+ const port = parsePort2(options.port);
7112
+ const host = options.host?.trim();
7113
+ const info = await mod.startStudioServer({
7114
+ ...host !== void 0 && host.length > 0 ? { host } : {},
7115
+ ...port !== void 0 ? { port } : {},
7116
+ ...options.workspace !== void 0 ? { workspacePath: options.workspace } : {},
7117
+ ...options.db !== void 0 ? { dbPath: options.db } : {},
7118
+ ...options.server === true ? { server: true } : {},
7119
+ ...options.cwd !== void 0 ? { cwd: options.cwd } : {},
7120
+ ...options.auth === "basic" ? { auth: "basic" } : {},
7121
+ ...options.passwordEnv !== void 0 ? { passwordEnv: options.passwordEnv } : {}
7122
+ });
7123
+ console.log(`AgentInspect studio (read-only): ${info.url}`);
7124
+ if (options.open === true && info.host !== "127.0.0.1" && info.host !== "localhost") {
7125
+ console.warn("Skipping browser open for non-local host binding.");
7126
+ } else if (options.open === true) {
7127
+ const openMod = await import('child_process');
7128
+ openMod.exec(`open ${info.url}`, () => {
7129
+ });
7130
+ }
7131
+ await new Promise(() => {
7132
+ });
7133
+ }
7134
+
7078
7135
  // packages/eval/src/index.ts
7079
7136
  function isTraceReadResult(value) {
7080
7137
  return value !== null && typeof value === "object" && "runs" in value && "events" in value && "format" in value;
@@ -9869,23 +9926,23 @@ async function indexCleanCommand(options = {}) {
9869
9926
  process.exitCode = 1;
9870
9927
  }
9871
9928
  }
9872
- var PACKAGE = "@agent-inspect/index-sqlite";
9873
- function isModuleNotFound3(e) {
9929
+ var PACKAGE2 = "@agent-inspect/index-sqlite";
9930
+ function isModuleNotFound4(e) {
9874
9931
  return e !== null && typeof e === "object" && "code" in e && (e.code === "ERR_MODULE_NOT_FOUND" || e.code === "MODULE_NOT_FOUND");
9875
9932
  }
9876
9933
  async function loadIndexSqlite() {
9877
9934
  try {
9878
9935
  return await import('./src-FVNE44UA.mjs');
9879
9936
  } catch (e) {
9880
- if (isModuleNotFound3(e)) {
9937
+ if (isModuleNotFound4(e)) {
9881
9938
  console.error(
9882
- `The optional SQLite index is not installed. Run: npm install ${PACKAGE}`
9939
+ `The optional SQLite index is not installed. Run: npm install ${PACKAGE2}`
9883
9940
  );
9884
9941
  process.exitCode = 1;
9885
9942
  return null;
9886
9943
  }
9887
9944
  const msg = e instanceof Error ? e.message : String(e);
9888
- console.error(`[AgentInspect] failed to load ${PACKAGE}: ${msg}`);
9945
+ console.error(`[AgentInspect] failed to load ${PACKAGE2}: ${msg}`);
9889
9946
  process.exitCode = 1;
9890
9947
  return null;
9891
9948
  }
@@ -10724,6 +10781,11 @@ function createCliProgram() {
10724
10781
  program.command("viewer").description("Start localhost read-only viewer (traces, suite, or workspace) (v5.3+)").option("--dir <path>", "trace directory (trace mode)").option("--suite", "suite evidence mode").option("--workspace", "workspace mode").option("--config <path>", "suite config path (suite mode)").option("--host <host>", "bind host (default 127.0.0.1)", "127.0.0.1").option("--port <number>", "bind port (default 7337)", "7337").option("--open", "open browser locally when host is localhost").action((opts) => {
10725
10782
  runCommand(() => serveCommand(opts));
10726
10783
  });
10784
+ program.command("studio").description(
10785
+ "Start self-hosted read-only Studio analyzer (requires @agent-inspect/studio) (v6.0+)"
10786
+ ).option("--workspace <path>", "studio registry manifest path").option("--db <path>", "studio database path (sqlite file or postgres URL)").option("--host <host>", "bind host (default 127.0.0.1)", "127.0.0.1").option("--port <number>", "bind port (default 7340)", "7340").option("--server", "bind for network access (0.0.0.0; requires explicit opt-in)").option("--auth <mode>", "auth mode: none or basic", "none").option("--password-env <name>", "env var for basic-auth password").option("--open", "open browser locally when host is localhost").action((opts) => {
10787
+ runCommand(() => studioCommand(opts));
10788
+ });
10727
10789
  program.command("eval").description("Run deterministic local evals against a trace").argument("<trace-path-or-run-id>", "trace file, directory, stdin -, or run id").option("--dir <path>", "trace directory for run-id lookup").addOption(
10728
10790
  new Option("--format <format>", "trace input format").choices([
10729
10791
  "agent-inspect-jsonl",