agent-inspect 6.0.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.
|
@@ -11,7 +11,7 @@ import { createServer } from 'http';
|
|
|
11
11
|
import { createRequire } from 'module';
|
|
12
12
|
|
|
13
13
|
// package.json
|
|
14
|
-
var version = "6.
|
|
14
|
+
var version = "6.1.0";
|
|
15
15
|
|
|
16
16
|
// packages/cli/src/trace-dir-scale.ts
|
|
17
17
|
var TRACE_COUNT_WARN = 1e3;
|
|
@@ -7105,9 +7105,103 @@ function parsePort2(value) {
|
|
|
7105
7105
|
}
|
|
7106
7106
|
return parsed;
|
|
7107
7107
|
}
|
|
7108
|
+
function summarizeFileDropResult(result) {
|
|
7109
|
+
if (result.skipped) {
|
|
7110
|
+
console.log(`[AgentInspect studio] file-drop skipped: ${result.reason ?? "disabled"}`);
|
|
7111
|
+
return;
|
|
7112
|
+
}
|
|
7113
|
+
console.log(
|
|
7114
|
+
`[AgentInspect studio] file-drop scanned=${result.scanned} imported=${result.imported} skipped=${result.skippedFiles}`
|
|
7115
|
+
);
|
|
7116
|
+
for (const warning of result.warnings) {
|
|
7117
|
+
console.warn(`[AgentInspect studio] ${warning}`);
|
|
7118
|
+
}
|
|
7119
|
+
for (const error of result.errors) {
|
|
7120
|
+
console.error(`[AgentInspect studio] ${error}`);
|
|
7121
|
+
}
|
|
7122
|
+
}
|
|
7123
|
+
function summarizeGitHubResult(result) {
|
|
7124
|
+
if (result.skipped) {
|
|
7125
|
+
console.log(`[AgentInspect studio] github import skipped: ${result.reason ?? "disabled"}`);
|
|
7126
|
+
return;
|
|
7127
|
+
}
|
|
7128
|
+
if (result.imported) {
|
|
7129
|
+
console.log(
|
|
7130
|
+
`[AgentInspect studio] github artifact imported to ${result.destPath ?? "(unknown)"}`
|
|
7131
|
+
);
|
|
7132
|
+
} else if (result.destPath) {
|
|
7133
|
+
console.log(`[AgentInspect studio] github artifact unchanged: ${result.destPath}`);
|
|
7134
|
+
}
|
|
7135
|
+
for (const warning of result.registryImportWarnings) {
|
|
7136
|
+
console.warn(`[AgentInspect studio] ${warning}`);
|
|
7137
|
+
}
|
|
7138
|
+
for (const error of result.errors) {
|
|
7139
|
+
console.error(`[AgentInspect studio] ${error}`);
|
|
7140
|
+
}
|
|
7141
|
+
}
|
|
7142
|
+
async function studioImportBundleCommand(options) {
|
|
7143
|
+
const mod = await loadStudio();
|
|
7144
|
+
if (!mod) return;
|
|
7145
|
+
const result = await mod.runStudioBundleUploadImport({
|
|
7146
|
+
...options.workspace !== void 0 ? { workspacePath: options.workspace } : {},
|
|
7147
|
+
...options.db !== void 0 ? { dbPath: options.db } : {},
|
|
7148
|
+
bundlePath: options.path,
|
|
7149
|
+
...options.cwd !== void 0 ? { cwd: options.cwd } : {}
|
|
7150
|
+
});
|
|
7151
|
+
if (result.skipped) {
|
|
7152
|
+
console.log(`[AgentInspect studio] bundle import skipped: ${result.reason ?? "disabled"}`);
|
|
7153
|
+
} else if (result.imported) {
|
|
7154
|
+
console.log(`[AgentInspect studio] bundle imported to ${result.destPath ?? "(unknown)"}`);
|
|
7155
|
+
} else if (result.destPath) {
|
|
7156
|
+
console.log(`[AgentInspect studio] bundle unchanged: ${result.destPath}`);
|
|
7157
|
+
}
|
|
7158
|
+
for (const warning of result.registryImportWarnings) {
|
|
7159
|
+
console.warn(`[AgentInspect studio] ${warning}`);
|
|
7160
|
+
}
|
|
7161
|
+
for (const error of result.errors) {
|
|
7162
|
+
console.error(`[AgentInspect studio] ${error}`);
|
|
7163
|
+
}
|
|
7164
|
+
if (result.errors.length > 0) process.exitCode = 1;
|
|
7165
|
+
}
|
|
7166
|
+
async function studioImportGitHubCommand(options) {
|
|
7167
|
+
const mod = await loadStudio();
|
|
7168
|
+
if (!mod) return;
|
|
7169
|
+
const result = await mod.runStudioGitHubArtifactImport({
|
|
7170
|
+
...options.workspace !== void 0 ? { workspacePath: options.workspace } : {},
|
|
7171
|
+
...options.db !== void 0 ? { dbPath: options.db } : {},
|
|
7172
|
+
repo: options.repo,
|
|
7173
|
+
runId: options.runId,
|
|
7174
|
+
artifact: options.artifact,
|
|
7175
|
+
...options.tokenEnv !== void 0 ? { tokenEnv: options.tokenEnv } : {},
|
|
7176
|
+
...options.cwd !== void 0 ? { cwd: options.cwd } : {}
|
|
7177
|
+
});
|
|
7178
|
+
summarizeGitHubResult(result);
|
|
7179
|
+
if (result.errors.length > 0) {
|
|
7180
|
+
process.exitCode = 1;
|
|
7181
|
+
}
|
|
7182
|
+
}
|
|
7183
|
+
async function studioImportDropCommand(options = {}) {
|
|
7184
|
+
const mod = await loadStudio();
|
|
7185
|
+
if (!mod) return;
|
|
7186
|
+
const result = await mod.runStudioFileDropImport({
|
|
7187
|
+
...options.workspace !== void 0 ? { workspacePath: options.workspace } : {},
|
|
7188
|
+
...options.db !== void 0 ? { dbPath: options.db } : {},
|
|
7189
|
+
...options.dir !== void 0 ? { dropDir: options.dir } : {},
|
|
7190
|
+
...options.archive === true ? { archiveAfterImport: true } : {},
|
|
7191
|
+
...options.cwd !== void 0 ? { cwd: options.cwd } : {}
|
|
7192
|
+
});
|
|
7193
|
+
summarizeFileDropResult(result);
|
|
7194
|
+
if (result.errors.length > 0) {
|
|
7195
|
+
process.exitCode = 1;
|
|
7196
|
+
}
|
|
7197
|
+
}
|
|
7108
7198
|
async function studioCommand(options = {}) {
|
|
7109
7199
|
const mod = await loadStudio();
|
|
7110
7200
|
if (!mod) return;
|
|
7201
|
+
const ingest = options.ingest?.trim();
|
|
7202
|
+
if (ingest && ingest !== "file-drop" && ingest !== "http") {
|
|
7203
|
+
throw new Error(`Unsupported --ingest channel: ${ingest}. Supported: file-drop, http`);
|
|
7204
|
+
}
|
|
7111
7205
|
const port = parsePort2(options.port);
|
|
7112
7206
|
const host = options.host?.trim();
|
|
7113
7207
|
const info = await mod.startStudioServer({
|
|
@@ -7118,8 +7212,18 @@ async function studioCommand(options = {}) {
|
|
|
7118
7212
|
...options.server === true ? { server: true } : {},
|
|
7119
7213
|
...options.cwd !== void 0 ? { cwd: options.cwd } : {},
|
|
7120
7214
|
...options.auth === "basic" ? { auth: "basic" } : {},
|
|
7121
|
-
...options.passwordEnv !== void 0 ? { passwordEnv: options.passwordEnv } : {}
|
|
7215
|
+
...options.passwordEnv !== void 0 ? { passwordEnv: options.passwordEnv } : {},
|
|
7216
|
+
...ingest === "file-drop" ? { ingestFileDrop: true } : {},
|
|
7217
|
+
...ingest === "http" ? { ingestHttp: true } : {},
|
|
7218
|
+
...options.ingestTokenEnv !== void 0 ? { ingestTokenEnv: options.ingestTokenEnv } : {},
|
|
7219
|
+
...options.archiveFileDrop === true ? { archiveFileDrop: true } : {}
|
|
7122
7220
|
});
|
|
7221
|
+
if (ingest === "file-drop") {
|
|
7222
|
+
console.log(`[AgentInspect studio] file-drop ingest enabled for startup scan`);
|
|
7223
|
+
}
|
|
7224
|
+
if (ingest === "http") {
|
|
7225
|
+
console.log(`[AgentInspect studio] HTTP ingest enabled (token required on POST routes)`);
|
|
7226
|
+
}
|
|
7123
7227
|
console.log(`AgentInspect studio (read-only): ${info.url}`);
|
|
7124
7228
|
if (options.open === true && info.host !== "127.0.0.1" && info.host !== "localhost") {
|
|
7125
7229
|
console.warn("Skipping browser open for non-local host binding.");
|
|
@@ -10781,11 +10885,21 @@ function createCliProgram() {
|
|
|
10781
10885
|
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) => {
|
|
10782
10886
|
runCommand(() => serveCommand(opts));
|
|
10783
10887
|
});
|
|
10784
|
-
program.command("studio").description(
|
|
10888
|
+
const studioCmd = program.command("studio").description(
|
|
10785
10889
|
"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) => {
|
|
10890
|
+
).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("--ingest <channel>", "enable ingest channel on startup (file-drop, http)").option("--ingest-token-env <name>", "env var for HTTP ingest token (default STUDIO_INGEST_TOKEN)").option("--archive-file-drop", "archive file-drop sources after successful import").option("--open", "open browser locally when host is localhost").action((opts) => {
|
|
10787
10891
|
runCommand(() => studioCommand(opts));
|
|
10788
10892
|
});
|
|
10893
|
+
const studioImportCmd = studioCmd.command("import").description("Import external evidence into Studio (v6.1+)");
|
|
10894
|
+
studioImportCmd.command("drop").description("Import allowlisted files from a file-drop directory").option("--workspace <path>", "studio registry manifest path").option("--db <path>", "studio database path (sqlite file or postgres URL)").option("--dir <path>", "file-drop directory (defaults to registry import.fileDropDir)").option("--archive", "move imported files into .imported/ under the drop dir").action((opts) => {
|
|
10895
|
+
runCommand(() => studioImportDropCommand(opts));
|
|
10896
|
+
});
|
|
10897
|
+
studioImportCmd.command("github").description("Download a GitHub Actions artifact into the studio import dirs").requiredOption("--repo <owner/name>", "GitHub repository").requiredOption("--run-id <id>", "workflow run id").requiredOption("--artifact <name>", "artifact name").option("--workspace <path>", "studio registry manifest path").option("--db <path>", "studio database path (sqlite file or postgres URL)").option("--token-env <name>", "env var for GitHub token (default GITHUB_TOKEN)").action((opts) => {
|
|
10898
|
+
runCommand(() => studioImportGitHubCommand(opts));
|
|
10899
|
+
});
|
|
10900
|
+
studioImportCmd.command("bundle").description("Import a local share-safe bundle directory into Studio").requiredOption("--path <dir>", "bundle directory path").option("--workspace <path>", "studio registry manifest path").option("--db <path>", "studio database path (sqlite file or postgres URL)").action((opts) => {
|
|
10901
|
+
runCommand(() => studioImportBundleCommand(opts));
|
|
10902
|
+
});
|
|
10789
10903
|
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(
|
|
10790
10904
|
new Option("--format <format>", "trace input format").choices([
|
|
10791
10905
|
"agent-inspect-jsonl",
|