@soat/cli 0.14.1 → 0.14.3

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 +87 -7
  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.14.1";
14
+ var version = "0.14.3";
15
15
 
16
16
  //#endregion
17
17
  //#region src/cli-wrappers/wrappers/formations.ts
@@ -67,6 +67,7 @@ var readTemplateFromPath = args => {
67
67
  throw new Error(`Template file must contain valid JSON or YAML: ${templatePath}`);
68
68
  }
69
69
  };
70
+ var OMIT_PARAMETER = Symbol("omit-parameter");
70
71
  var resolveEnvRef = args => {
71
72
  const {
72
73
  value,
@@ -75,8 +76,7 @@ var resolveEnvRef = args => {
75
76
  const atRef = /^@([A-Za-z_][A-Za-z0-9_]*)$/.exec(value);
76
77
  if (atRef) {
77
78
  const resolved = env[atRef[1]];
78
- if (resolved === void 0) throw new Error(`Missing environment variable: ${atRef[1]}`);
79
- return resolved;
79
+ return resolved === void 0 ? OMIT_PARAMETER : resolved;
80
80
  }
81
81
  const simple = /^\$([A-Za-z_][A-Za-z0-9_]*)$/.exec(value);
82
82
  if (simple) {
@@ -103,10 +103,9 @@ var resolveParameterPair = args => {
103
103
  const key = pair.trim();
104
104
  if (!key) throw new Error(`Invalid --${PARAMETER_FLAG} value "${pair}". Parameter key cannot be empty.`);
105
105
  const resolved = env[key];
106
- if (resolved === void 0) throw new Error(`Missing environment variable: ${key}`);
107
106
  return {
108
107
  key,
109
- value: resolved
108
+ value: resolved === void 0 ? OMIT_PARAMETER : resolved
110
109
  };
111
110
  }
112
111
  const key = pair.slice(0, eqIdx).trim();
@@ -130,7 +129,7 @@ var formationsWrapper = {
130
129
  type: "string"
131
130
  }, {
132
131
  name: "parameter",
133
- description: "Template parameter in key=value format (repeatable). Values support env var references: $VAR, ${VAR}, or @VAR_NAME (shell-safe). Omit the value entirely (--parameter KEY) to auto-read KEY from the merged env.",
132
+ description: "Template parameter in key=value format (repeatable). Values support env var references: $VAR, ${VAR}, or @VAR_NAME (shell-safe). Omit the value entirely (--parameter KEY) to auto-read KEY from the merged env. For @VAR_NAME and bare KEY, an unset env var omits the parameter instead of failing, so the server reuses a previous value (formation parameters declared `use_previous_value`) or errors if none exists.",
134
133
  required: false,
135
134
  type: "string"
136
135
  }, {
@@ -182,7 +181,7 @@ var formationsWrapper = {
182
181
  pair,
183
182
  env: mergedEnv
184
183
  });
185
- resolvedParameters[key] = value;
184
+ if (value !== OMIT_PARAMETER) resolvedParameters[key] = value;
186
185
  }
187
186
  forcedBody[PARAMETERS_FIELD] = resolvedParameters;
188
187
  }
@@ -1010,6 +1009,12 @@ var routes = {
1010
1009
  "required": false,
1011
1010
  "type": "object",
1012
1011
  "in": "body"
1012
+ }, {
1013
+ "name": "action_id",
1014
+ "description": "Logical action label recorded on the generation's usage meter, so spend can be rolled up per action (e.g. an A/B/C/D operating action).",
1015
+ "required": false,
1016
+ "type": "string",
1017
+ "in": "body"
1013
1018
  }, {
1014
1019
  "name": "knowledge_config",
1015
1020
  "description": "Per-generation knowledge retrieval override. Array filters (memory_ids, memory_tags, document_ids, document_paths) are unioned with the agent's stored knowledge_config; scalar fields (min_score, limit) use the per-generation value when present.",
@@ -4939,6 +4944,81 @@ var routes = {
4939
4944
  "in": "path"
4940
4945
  }]
4941
4946
  },
4947
+ "list-usage-meters": {
4948
+ serviceClass: "Usage",
4949
+ operationId: "listUsageMeters",
4950
+ 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.",
4951
+ moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/usage",
4952
+ pathParams: [],
4953
+ queryParams: ["agent_id", "generation_id", "trace_id", "trigger_id", "action_id", "limit", "offset"],
4954
+ flags: [{
4955
+ "name": "agent_id",
4956
+ "description": "Filter by agent public ID",
4957
+ "required": false,
4958
+ "type": "string",
4959
+ "in": "query"
4960
+ }, {
4961
+ "name": "generation_id",
4962
+ "description": "Filter by generation public ID",
4963
+ "required": false,
4964
+ "type": "string",
4965
+ "in": "query"
4966
+ }, {
4967
+ "name": "trace_id",
4968
+ "description": "Filter by trace public ID",
4969
+ "required": false,
4970
+ "type": "string",
4971
+ "in": "query"
4972
+ }, {
4973
+ "name": "trigger_id",
4974
+ "description": "Filter by the trigger that initiated the generation",
4975
+ "required": false,
4976
+ "type": "string",
4977
+ "in": "query"
4978
+ }, {
4979
+ "name": "action_id",
4980
+ "description": "Filter by logical action id",
4981
+ "required": false,
4982
+ "type": "string",
4983
+ "in": "query"
4984
+ }, {
4985
+ "name": "limit",
4986
+ "description": "",
4987
+ "required": false,
4988
+ "type": "integer",
4989
+ "in": "query"
4990
+ }, {
4991
+ "name": "offset",
4992
+ "description": "",
4993
+ "required": false,
4994
+ "type": "integer",
4995
+ "in": "query"
4996
+ }]
4997
+ },
4998
+ "get-price-book": {
4999
+ serviceClass: "Usage",
5000
+ operationId: "getPriceBook",
5001
+ description: "Returns the global price book — the versioned per-provider/model unit prices used to compute usage cost at write time. Readable by any authenticated user.",
5002
+ moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/usage",
5003
+ pathParams: [],
5004
+ queryParams: [],
5005
+ flags: []
5006
+ },
5007
+ "upsert-price-book": {
5008
+ serviceClass: "Usage",
5009
+ operationId: "upsertPriceBook",
5010
+ description: "Upserts price rows keyed on (provider, model, effective_from). Admin only. `effective_from` must be in the future — past prices are immutable so recorded costs stay explainable; ship corrections as new future-dated rows.",
5011
+ moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/usage",
5012
+ pathParams: [],
5013
+ queryParams: [],
5014
+ flags: [{
5015
+ "name": "prices",
5016
+ "description": "",
5017
+ "required": true,
5018
+ "type": "array",
5019
+ "in": "body"
5020
+ }]
5021
+ },
4942
5022
  "get-current-user": {
4943
5023
  serviceClass: "Users",
4944
5024
  operationId: "getCurrentUser",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soat/cli",
3
- "version": "0.14.1",
3
+ "version": "0.14.3",
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.14.1"
11
+ "@soat/sdk": "0.14.3"
12
12
  },
13
13
  "devDependencies": {
14
14
  "@ttoss/config": "^1.37.17",