sentinelayer-cli 0.32.4 → 0.32.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sentinelayer-cli",
3
- "version": "0.32.4",
3
+ "version": "0.32.5",
4
4
  "description": "Scaffold Sentinelayer spec/prompt/guide artifacts with secure browser auth and token bootstrap.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -124,7 +124,7 @@ function hostedRollupToJson(rollup, fallbackLabel = "") {
124
124
  const hasCustomerCost = Boolean(bag.hasCustomerCost ?? bag.has_customer_cost ?? bag.customerCostUsd != null ?? bag.customer_cost_usd != null);
125
125
  return {
126
126
  label: normalize(bag.label ?? bag.agentId ?? bag.agent_id ?? bag.action ?? fallbackLabel) || "unknown",
127
- entries: nonNegativeInt(bag.entries ?? bag.count),
127
+ entries: nonNegativeInt(bag.entries ?? bag.entryCount ?? bag.entry_count ?? bag.count ?? bag.interactions),
128
128
  inputTokens: nonNegativeInt(bag.inputTokens ?? bag.input_tokens),
129
129
  outputTokens: nonNegativeInt(bag.outputTokens ?? bag.output_tokens),
130
130
  totalTokens: nonNegativeInt(bag.totalTokens ?? bag.total_tokens),
@@ -249,11 +249,24 @@ export function buildSessionUsageReportFromLedgerPayload({
249
249
  ? embedded
250
250
  : root;
251
251
  const entries = sourceArray(source.entries).map(hostedEntryToJson);
252
- const totals = hostedRollupToJson(object(source.totals), "session");
253
- const priceBookVersions = sourceArray(source.priceBooks || source.price_books || source.priceBookVersions || source.price_book_versions)
252
+ const sourceTotals = object(source.totals);
253
+ const totals = hostedRollupToJson(sourceTotals, "session");
254
+ const priceBookVersions = sourceArray(
255
+ source.priceBooks ||
256
+ source.price_books ||
257
+ source.priceBookVersions ||
258
+ source.price_book_versions ||
259
+ sourceTotals.priceBooks ||
260
+ sourceTotals.price_books ||
261
+ sourceTotals.priceBookVersions ||
262
+ sourceTotals.price_book_versions,
263
+ )
254
264
  .map(normalize)
255
265
  .filter(Boolean)
256
266
  .sort();
267
+ const resolvedPriceBookVersions = priceBookVersions.length
268
+ ? priceBookVersions
269
+ : [...new Set(entries.map((entry) => normalize(entry.priceBookVersion)).filter(Boolean))].sort();
257
270
  const limit = clampRecentLimit(recentLimit);
258
271
  return {
259
272
  schema: SESSION_USAGE_REPORT_SCHEMA,
@@ -268,12 +281,28 @@ export function buildSessionUsageReportFromLedgerPayload({
268
281
  providerCostUsd: totals.providerCostUsd,
269
282
  customerCostUsd: totals.customerCostUsd,
270
283
  unpriced: totals.unpriced,
271
- priceBookVersions,
284
+ priceBookVersions: resolvedPriceBookVersions,
272
285
  },
273
- perAgent: sourceArray(source.agents || source.perAgent || source.per_agent || source.agentsById || source.agents_by_id)
286
+ perAgent: sourceArray(
287
+ source.agents ||
288
+ source.perAgent ||
289
+ source.per_agent ||
290
+ source.byAgent ||
291
+ source.by_agent ||
292
+ source.agentsById ||
293
+ source.agents_by_id,
294
+ )
274
295
  .map((rollup) => hostedRollupToJson(rollup))
275
296
  .sort((a, b) => b.providerCostUsd - a.providerCostUsd || b.totalTokens - a.totalTokens || a.label.localeCompare(b.label)),
276
- perAction: sourceArray(source.actions || source.perAction || source.per_action || source.actionsById || source.actions_by_id)
297
+ perAction: sourceArray(
298
+ source.actions ||
299
+ source.perAction ||
300
+ source.per_action ||
301
+ source.byAction ||
302
+ source.by_action ||
303
+ source.actionsById ||
304
+ source.actions_by_id,
305
+ )
277
306
  .map((rollup) => hostedRollupToJson(rollup))
278
307
  .sort((a, b) => b.providerCostUsd - a.providerCostUsd || b.totalTokens - a.totalTokens || a.label.localeCompare(b.label)),
279
308
  recentEntries: recentReportEntries(entries, limit),