@soat/cli 0.15.2 → 0.15.4

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 (2) hide show
  1. package/dist/index.mjs +147 -8
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import { load } from "js-yaml";
11
11
  import * as os from "node:os";
12
12
 
13
13
  //#region package.json
14
- var version = "0.15.2";
14
+ var version = "0.15.4";
15
15
 
16
16
  //#endregion
17
17
  //#region src/cli-wrappers/wrappers/formations.ts
@@ -2166,13 +2166,25 @@ var routes = {
2166
2166
  description: "Returns all documents the caller has access to. If projectId is provided, returns only documents in that project. project keys are scoped to a single project automatically. JWT users without projectId receive documents across all their accessible projects.",
2167
2167
  moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/documents",
2168
2168
  pathParams: [],
2169
- queryParams: ["project_id"],
2169
+ queryParams: ["project_id", "limit", "offset"],
2170
2170
  flags: [{
2171
2171
  "name": "project_id",
2172
2172
  "description": "Project ID (optional)",
2173
2173
  "required": false,
2174
2174
  "type": "string",
2175
2175
  "in": "query"
2176
+ }, {
2177
+ "name": "limit",
2178
+ "description": "Maximum number of results to return",
2179
+ "required": false,
2180
+ "type": "integer",
2181
+ "in": "query"
2182
+ }, {
2183
+ "name": "offset",
2184
+ "description": "Number of results to skip",
2185
+ "required": false,
2186
+ "type": "integer",
2187
+ "in": "query"
2176
2188
  }]
2177
2189
  },
2178
2190
  "create-document": {
@@ -5154,7 +5166,7 @@ var routes = {
5154
5166
  description: "Returns the raw usage-meter rows the caller can access, most recent first, optionally filtered by agent and generation. Each row is the per-generation token usage as reported by the provider, for audit and reconciliation.",
5155
5167
  moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/usage",
5156
5168
  pathParams: [],
5157
- queryParams: ["agent_id", "generation_id", "trace_id", "trigger_id", "action_id", "limit", "offset"],
5169
+ queryParams: ["agent_id", "generation_id", "trace_id", "trigger_id", "action_id", "meter_type", "limit", "offset"],
5158
5170
  flags: [{
5159
5171
  "name": "agent_id",
5160
5172
  "description": "Filter by agent public ID",
@@ -5185,6 +5197,12 @@ var routes = {
5185
5197
  "required": false,
5186
5198
  "type": "string",
5187
5199
  "in": "query"
5200
+ }, {
5201
+ "name": "meter_type",
5202
+ "description": "Filter by meter type (e.g. `llm_tokens`, `compute_execution`, `api_request`, `storage`)\n",
5203
+ "required": false,
5204
+ "type": "string",
5205
+ "in": "query"
5188
5206
  }, {
5189
5207
  "name": "limit",
5190
5208
  "description": "",
@@ -5199,17 +5217,119 @@ var routes = {
5199
5217
  "in": "query"
5200
5218
  }]
5201
5219
  },
5220
+ "get-usage": {
5221
+ serviceClass: "Usage",
5222
+ operationId: "getUsage",
5223
+ description: "Returns a project's usage rolled up over an optional `[from, to]` time window, bucketed by a single dimension. Each group and the grand total carry summed token counts and `cost_usd` (null when no event in the bucket was priced). This is the per-project cost-by-range/by-category query — a monthly figure without scanning raw meter rows client-side.",
5224
+ moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/usage",
5225
+ pathParams: [],
5226
+ queryParams: ["project_id", "group_by", "from", "to"],
5227
+ flags: [{
5228
+ "name": "project_id",
5229
+ "description": "Project public ID to aggregate usage for",
5230
+ "required": true,
5231
+ "type": "string",
5232
+ "in": "query"
5233
+ }, {
5234
+ "name": "group_by",
5235
+ "description": "Dimension to bucket by. `day` buckets on the event's UTC calendar day; the others bucket on the matching column.\n",
5236
+ "required": true,
5237
+ "type": "string",
5238
+ "in": "query"
5239
+ }, {
5240
+ "name": "from",
5241
+ "description": "Inclusive lower bound (ISO-8601 timestamp) on the event created_at. Omit for no lower bound.\n",
5242
+ "required": false,
5243
+ "type": "string",
5244
+ "in": "query"
5245
+ }, {
5246
+ "name": "to",
5247
+ "description": "Inclusive upper bound (ISO-8601 timestamp) on the event created_at. Omit for no upper bound.\n",
5248
+ "required": false,
5249
+ "type": "string",
5250
+ "in": "query"
5251
+ }]
5252
+ },
5253
+ "list-usage-thresholds": {
5254
+ serviceClass: "Usage",
5255
+ operationId: "listUsageThresholds",
5256
+ description: "Lists the usage alert thresholds the caller can access, optionally filtered by project_id. Each threshold fires the `usage.threshold_crossed` webhook when a project's cost or token usage over a calendar-month or rolling-24h window crosses the configured value.",
5257
+ moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/usage",
5258
+ pathParams: [],
5259
+ queryParams: ["project_id"],
5260
+ flags: [{
5261
+ "name": "project_id",
5262
+ "description": "Filter by project public ID",
5263
+ "required": false,
5264
+ "type": "string",
5265
+ "in": "query"
5266
+ }]
5267
+ },
5268
+ "create-usage-threshold": {
5269
+ serviceClass: "Usage",
5270
+ operationId: "createUsageThreshold",
5271
+ description: "Creates a usage alert threshold on a project. Thresholds are immutable apart from deletion — to change one, delete and recreate it (which resets its fire state).",
5272
+ moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/usage",
5273
+ pathParams: [],
5274
+ queryParams: [],
5275
+ flags: [{
5276
+ "name": "project_id",
5277
+ "description": "",
5278
+ "required": true,
5279
+ "type": "string",
5280
+ "in": "body"
5281
+ }, {
5282
+ "name": "metric",
5283
+ "description": "",
5284
+ "required": true,
5285
+ "type": "string",
5286
+ "in": "body"
5287
+ }, {
5288
+ "name": "window",
5289
+ "description": "",
5290
+ "required": true,
5291
+ "type": "string",
5292
+ "in": "body"
5293
+ }, {
5294
+ "name": "threshold",
5295
+ "description": "Must be greater than 0",
5296
+ "required": true,
5297
+ "type": "number",
5298
+ "in": "body"
5299
+ }]
5300
+ },
5301
+ "delete-usage-threshold": {
5302
+ serviceClass: "Usage",
5303
+ operationId: "deleteUsageThreshold",
5304
+ description: "Deletes a usage threshold, resetting its fire state. Recreating a threshold starts its once-per-window / hysteresis state fresh.",
5305
+ moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/usage",
5306
+ pathParams: ["threshold_id"],
5307
+ queryParams: [],
5308
+ flags: [{
5309
+ "name": "threshold_id",
5310
+ "description": "Threshold public ID",
5311
+ "required": true,
5312
+ "type": "string",
5313
+ "in": "path"
5314
+ }]
5315
+ },
5202
5316
  "get-usage-receipt": {
5203
5317
  serviceClass: "Usage",
5204
5318
  operationId: "getUsageReceipt",
5205
- description: "Returns a billing receipt for a completed generation: per-model line items (tokens, the price-book version that priced them, and cost) plus totals.",
5319
+ description: "Returns a billing receipt. Pass generation_id for a per-generation receipt, or run_id for a per-run receipt summed across the orchestration run's meters — both share the same shape (per-model line items with tokens, the price-book version that priced them, and cost, plus totals). Exactly one of generation_id or run_id must be supplied.",
5206
5320
  moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/usage",
5207
5321
  pathParams: [],
5208
- queryParams: ["generation_id"],
5322
+ queryParams: ["generation_id", "run_id"],
5209
5323
  flags: [{
5210
5324
  "name": "generation_id",
5211
- "description": "Generation public ID",
5212
- "required": true,
5325
+ "description": "Generation public ID. Mutually exclusive with run_id.\n",
5326
+ "required": false,
5327
+ "type": "string",
5328
+ "in": "query"
5329
+ }, {
5330
+ "name": "run_id",
5331
+ "description": "Orchestration run public ID. Returns the receipt summed across every generation the run metered. Mutually exclusive with generation_id.\n",
5332
+ "required": false,
5213
5333
  "type": "string",
5214
5334
  "in": "query"
5215
5335
  }]
@@ -5615,6 +5735,21 @@ var parseFlagValue = value => {
5615
5735
  }
5616
5736
  return value;
5617
5737
  };
5738
+ /**
5739
+ * Build the value for an array-typed flag. Collects repeated occurrences
5740
+ * (`--document_paths /a/ --document_paths /b/`) into a list, coercing each
5741
+ * element with `parseFlagValue`. A single JSON-array literal
5742
+ * (`--document_ids '["doc_1","doc_2"]'`) is passed through as-is rather than
5743
+ * being wrapped again, and a single scalar (`--document_paths /playbooks/`)
5744
+ * becomes a one-element array.
5745
+ */
5746
+ var buildArrayFlagValue = rawValues => {
5747
+ const parsed = rawValues.map(v => {
5748
+ return parseFlagValue(v);
5749
+ });
5750
+ if (parsed.length === 1 && Array.isArray(parsed[0])) return parsed[0];
5751
+ return parsed;
5752
+ };
5618
5753
  /** Normalize symbol names to compare exports across acronym casing differences. */
5619
5754
  var normalizeSymbol = name => {
5620
5755
  return name.toLowerCase().replace(/[^a-z0-9]/g, "");
@@ -5799,13 +5934,17 @@ program.argument("[command]", "API command in kebab-case (e.g. list-actors)").ar
5799
5934
  })
5800
5935
  });
5801
5936
  const flags = wrapped.flags.single;
5937
+ const repeatedFlags = wrapped.flags.repeated;
5938
+ const flagTypeByCanonical = new Map(route.flags.map(f => {
5939
+ return [toCanonical(f.name), f.type];
5940
+ }));
5802
5941
  const pathArgs = {};
5803
5942
  const queryArgs = {};
5804
5943
  const bodyArgs = {};
5805
5944
  for (const [flagKey, val] of Object.entries(flags)) {
5806
5945
  if (flagKey === "profile" || flagKey === "id") continue;
5807
5946
  const canonical = toCanonical(flagKey);
5808
- const parsedValue = parseFlagValue(val);
5947
+ const parsedValue = flagTypeByCanonical.get(canonical) === "array" ? buildArrayFlagValue(repeatedFlags[flagKey] ?? [val]) : parseFlagValue(val);
5809
5948
  const pathParam = route.pathParams.find(p => {
5810
5949
  return toCanonical(p) === canonical;
5811
5950
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soat/cli",
3
- "version": "0.15.2",
3
+ "version": "0.15.4",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@inquirer/input": "^5.1.2",
@@ -8,7 +8,7 @@
8
8
  "@ttoss/logger": "^0.8.19",
9
9
  "commander": "^15.0.0",
10
10
  "js-yaml": "^5.2.1",
11
- "@soat/sdk": "0.15.2"
11
+ "@soat/sdk": "0.15.4"
12
12
  },
13
13
  "devDependencies": {
14
14
  "@ttoss/config": "^1.37.17",