@cdot65/prisma-airs-cli 4.3.1 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +47 -11
- package/package.json +2 -2
package/dist/cli/index.js
CHANGED
|
@@ -4549,6 +4549,12 @@ function registerAiGatewayInventory(root) {
|
|
|
4549
4549
|
);
|
|
4550
4550
|
}
|
|
4551
4551
|
|
|
4552
|
+
// src/cli/commands/aigateway/telemetry.ts
|
|
4553
|
+
import {
|
|
4554
|
+
AI_GW_GROUP_COLUMNS,
|
|
4555
|
+
AI_GW_GROUP_DIMENSIONS
|
|
4556
|
+
} from "@cdot65/prisma-airs-sdk";
|
|
4557
|
+
|
|
4552
4558
|
// src/cli/commands/aigateway/telemetry-filters.ts
|
|
4553
4559
|
import { AIGatewayChartFiltersSchema as AIGatewayChartFiltersSchema2 } from "@cdot65/prisma-airs-sdk";
|
|
4554
4560
|
function addChartFilterOptions(command) {
|
|
@@ -4648,6 +4654,25 @@ function registerFilteredMetric(telemetry, name, description) {
|
|
|
4648
4654
|
await runDetail(command, opts, (client) => client.telemetry[name](options));
|
|
4649
4655
|
});
|
|
4650
4656
|
}
|
|
4657
|
+
var groupDimensions = [...AI_GW_GROUP_DIMENSIONS, "status_code", "users"];
|
|
4658
|
+
function isGroupDimension(value) {
|
|
4659
|
+
return groupDimensions.some((dimension) => dimension === value);
|
|
4660
|
+
}
|
|
4661
|
+
function isGroupColumn(value) {
|
|
4662
|
+
return AI_GW_GROUP_COLUMNS.some((column) => column === value);
|
|
4663
|
+
}
|
|
4664
|
+
function groupOptionsFrom(dimension, opts) {
|
|
4665
|
+
const options = { ...windowFrom(opts), ...chartFiltersFrom(opts) };
|
|
4666
|
+
if (opts.columns !== void 0) {
|
|
4667
|
+
if (dimension === "users") throw new CliUsageError("User grouping does not support --columns");
|
|
4668
|
+
const columns = opts.columns.split(",").map((column) => column.trim());
|
|
4669
|
+
if (!columns.every(isGroupColumn)) {
|
|
4670
|
+
throw new CliUsageError(`Invalid --columns: choose from ${AI_GW_GROUP_COLUMNS.join(", ")}`);
|
|
4671
|
+
}
|
|
4672
|
+
options.columns = columns;
|
|
4673
|
+
}
|
|
4674
|
+
return options;
|
|
4675
|
+
}
|
|
4651
4676
|
function registerAiGatewayTelemetryReads(telemetry) {
|
|
4652
4677
|
const cache = showHelpOnEmpty(telemetry.command("cache").description("Inspect cache telemetry"));
|
|
4653
4678
|
const cacheSummary = addWindowOptions(cache.command("summary").description("Get cache totals"));
|
|
@@ -4675,19 +4700,30 @@ function registerAiGatewayTelemetryReads(telemetry) {
|
|
|
4675
4700
|
(opts) => runDetail(command, opts, (client) => client.telemetry[method](windowFrom(opts)))
|
|
4676
4701
|
);
|
|
4677
4702
|
}
|
|
4678
|
-
const groupBy =
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
groupBy.action(
|
|
4682
|
-
(dimension, opts) => runDetail(
|
|
4683
|
-
groupBy,
|
|
4684
|
-
opts,
|
|
4685
|
-
(client) => client.telemetry.groupBy(dimension, {
|
|
4686
|
-
...windowFrom(opts),
|
|
4687
|
-
...opts.columns ? { columns: opts.columns.split(",").map((value) => value.trim()) } : {}
|
|
4688
|
-
})
|
|
4703
|
+
const groupBy = addChartFilterOptions(
|
|
4704
|
+
addWindowOptions(
|
|
4705
|
+
telemetry.command("group-by <dimension>").description(`Aggregate telemetry by ${groupDimensions.join(", ")}`).option("--columns <names>", "Comma-separated aggregate columns (not supported for users)")
|
|
4689
4706
|
)
|
|
4690
4707
|
);
|
|
4708
|
+
groupBy.action(async (dimension, opts) => {
|
|
4709
|
+
let options;
|
|
4710
|
+
try {
|
|
4711
|
+
if (!isGroupDimension(dimension)) {
|
|
4712
|
+
throw new CliUsageError(
|
|
4713
|
+
`Invalid grouping dimension: choose from ${groupDimensions.join(", ")}`
|
|
4714
|
+
);
|
|
4715
|
+
}
|
|
4716
|
+
options = groupOptionsFrom(dimension, opts);
|
|
4717
|
+
} catch (error) {
|
|
4718
|
+
failAiGateway(error);
|
|
4719
|
+
}
|
|
4720
|
+
await runDetail(groupBy, opts, (client) => {
|
|
4721
|
+
if (dimension === "users") return client.telemetry.byUser(options);
|
|
4722
|
+
if (dimension === "status_code") return client.telemetry.byStatusCode(options);
|
|
4723
|
+
if (isGroupDimension(dimension)) return client.telemetry.groupBy(dimension, options);
|
|
4724
|
+
throw new CliUsageError("Invalid grouping dimension");
|
|
4725
|
+
});
|
|
4726
|
+
});
|
|
4691
4727
|
registerFilteredMetric(telemetry, "latency", "Get latency telemetry");
|
|
4692
4728
|
const logs = showHelpOnEmpty(telemetry.command("logs").description("Inspect request logs"));
|
|
4693
4729
|
const logsList = addWindowOptions(
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdot65/prisma-airs-cli",
|
|
3
3
|
"packageManager": "pnpm@10.6.5",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.4.0",
|
|
5
5
|
"description": "CLI and library for Palo Alto Prisma AIRS — guardrail refinement, AI red teaming, model security scanning, profile audits",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"license": "MIT",
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@cdot65/prisma-airs-sdk": "0.
|
|
62
|
+
"@cdot65/prisma-airs-sdk": "0.25.0",
|
|
63
63
|
"@inquirer/prompts": "^8.3.0",
|
|
64
64
|
"chalk": "^5.6.2",
|
|
65
65
|
"commander": "^14.0.3",
|