@naturali/cli 0.125.0 → 0.127.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.
Files changed (2) hide show
  1. package/dist/index.mjs +350 -1
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -14,7 +14,7 @@ var __exportAll = (all, no_symbols) => {
14
14
  };
15
15
  //#endregion
16
16
  //#region package.json
17
- var version = "0.125.0";
17
+ var version = "0.127.0";
18
18
  //#endregion
19
19
  //#region ../sdk/src/generated/core/bodySerializer.gen.ts
20
20
  const serializeFormDataPair = (data, key, value) => {
@@ -1138,6 +1138,20 @@ var Admin = class {
1138
1138
  }
1139
1139
  });
1140
1140
  }
1141
+ /**
1142
+ * Read the global price book
1143
+ *
1144
+ * The upstream runtime's global default prices — the rows carrying neither a provider nor a project, which is all the upstream listing returns, so no tenant's own rates appear here.
1145
+ *
1146
+ * These are a cost basis, not a tariff: what a customer pays is the plan they bought plus the multiplier in PRICING.md section 3, applied when spend is reconciled. This is the read behind the storage-rate assertion at boot and the pinned embedding rate.
1147
+ *
1148
+ */
1149
+ static getAdminPriceBook(options) {
1150
+ return (options?.client ?? client).get({
1151
+ url: "/v1/admin/usage/prices",
1152
+ ...options
1153
+ });
1154
+ }
1141
1155
  };
1142
1156
  var Agents = class {
1143
1157
  /**
@@ -3665,6 +3679,75 @@ var Projects = class {
3665
3679
  ...options
3666
3680
  });
3667
3681
  }
3682
+ /**
3683
+ * List project usage events
3684
+ *
3685
+ * The rows a rollup summed — one per metered occurrence, most recent first. Takes the same narrowings [the meter](/docs/api/projects/get-project-usage) does, so a query that produced a bucket answers here unchanged and reads back what went into it. This is the audit and reconciliation view: what was measured, when, against which agent, session, actor and provider, and what each component was priced at.
3686
+ *
3687
+ * An id naming nothing in this project yields an empty page rather than dropping the filter, so a mistyped narrowing can never widen the list past what was asked for.
3688
+ *
3689
+ */
3690
+ static listProjectUsageEvents(options) {
3691
+ return (options.client ?? client).get({
3692
+ url: "/v1/projects/{project_id}/usage/events",
3693
+ ...options
3694
+ });
3695
+ }
3696
+ /**
3697
+ * Get a generation or orchestration-run billing receipt
3698
+ *
3699
+ * What one occurrence was billed, line by line: per-event line items with their measured components and unit prices, a per-meter-type split, and the totals. Pass generation_id for one generation, or orchestration_run_id for a receipt summed across every event the run metered. Exactly one of the two is required.
3700
+ *
3701
+ * This is the itemisation behind a single number — where [the meter](/docs/api/projects/get-project-usage) says a window cost $12.40, a receipt says which components of which call made up one occurrence of it. On an orchestration-run receipt every line carries node_id, so grouping by it gives the per-node cost the total hides; a retried node contributes one line per attempt, which is the intended reading for spend.
3702
+ *
3703
+ */
3704
+ static getProjectUsageReceipt(options) {
3705
+ return (options.client ?? client).get({
3706
+ url: "/v1/projects/{project_id}/usage/receipt",
3707
+ ...options
3708
+ });
3709
+ }
3710
+ /**
3711
+ * List usage thresholds
3712
+ *
3713
+ * The spend alerts this project has set. A threshold fires the usage.threshold_crossed event when the project's windowed usage crosses it, so one is only useful alongside a webhook subscribed to that event.
3714
+ *
3715
+ */
3716
+ static listProjectUsageThresholds(options) {
3717
+ return (options.client ?? client).get({
3718
+ url: "/v1/projects/{project_id}/usage/thresholds",
3719
+ ...options
3720
+ });
3721
+ }
3722
+ /**
3723
+ * Set a usage threshold
3724
+ *
3725
+ * Creates an alert on this project's windowed usage. Crossing it fires usage.threshold_crossed once per window — a calendar_month threshold fires at most once in a month, and a rolling_24h one re-arms when the windowed total falls back below 90% of the threshold, so a total hovering at the line does not alert repeatedly.
3726
+ *
3727
+ * Requires the admin role: an alerting rule belongs to the account that pays, not to one member.
3728
+ *
3729
+ */
3730
+ static createProjectUsageThreshold(options) {
3731
+ return (options.client ?? client).post({
3732
+ url: "/v1/projects/{project_id}/usage/thresholds",
3733
+ ...options,
3734
+ headers: {
3735
+ "Content-Type": "application/json",
3736
+ ...options.headers
3737
+ }
3738
+ });
3739
+ }
3740
+ /**
3741
+ * Delete a usage threshold
3742
+ *
3743
+ * Stops the alert. Requires the admin role.
3744
+ */
3745
+ static deleteProjectUsageThreshold(options) {
3746
+ return (options.client ?? client).delete({
3747
+ url: "/v1/projects/{project_id}/usage/thresholds/{threshold_id}",
3748
+ ...options
3749
+ });
3750
+ }
3668
3751
  };
3669
3752
  var Quotas = class {
3670
3753
  /**
@@ -6003,6 +6086,16 @@ const routes = {
6003
6086
  }
6004
6087
  ]
6005
6088
  },
6089
+ "get-admin-price-book": {
6090
+ serviceClass: "Admin",
6091
+ operationId: "getAdminPriceBook",
6092
+ description: "The upstream runtime's global default prices — the rows carrying neither a provider nor a project, which is all the upstream listing returns, so no tenant's own rates appear here. These are a cost basis, not a tariff: what a customer pays is the plan they bought plus the multiplier in PRICING.md section 3, applied when spend is reconciled. This is the read behind the storage-rate assertion at boot and the pinned embedding rate.",
6093
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/admin",
6094
+ httpMethod: "get",
6095
+ pathParams: [],
6096
+ queryParams: [],
6097
+ flags: []
6098
+ },
6006
6099
  "list-agents": {
6007
6100
  serviceClass: "Agents",
6008
6101
  operationId: "listAgents",
@@ -13771,6 +13864,262 @@ const routes = {
13771
13864
  }
13772
13865
  ]
13773
13866
  },
13867
+ "list-project-usage-events": {
13868
+ serviceClass: "Projects",
13869
+ operationId: "listProjectUsageEvents",
13870
+ description: "The rows a rollup summed — one per metered occurrence, most recent first. Takes the same narrowings [the meter](/docs/api/projects/get-project-usage) does, so a query that produced a bucket answers here unchanged and reads back what went into it. This is the audit and reconciliation view: what was measured, when, against which agent, session, actor and provider, and what each component was priced at. An id naming nothing in this project yields an empty page rather than dropping the filter, so a mistyped narrowing can never widen the list past what was asked for.",
13871
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/projects",
13872
+ httpMethod: "get",
13873
+ pathParams: ["project_id"],
13874
+ queryParams: [
13875
+ "meter_type",
13876
+ "session_id",
13877
+ "actor_id",
13878
+ "agent_id",
13879
+ "ai_provider_id",
13880
+ "orchestration_run_id",
13881
+ "orchestration_id",
13882
+ "generation_id",
13883
+ "trace_id",
13884
+ "source",
13885
+ "trigger_id",
13886
+ "action_id",
13887
+ "limit",
13888
+ "offset"
13889
+ ],
13890
+ flags: [
13891
+ {
13892
+ "name": "project_id",
13893
+ "description": "Project public ID (proj_ prefix).",
13894
+ "required": true,
13895
+ "type": "string",
13896
+ "in": "path"
13897
+ },
13898
+ {
13899
+ "name": "meter_type",
13900
+ "description": "Narrow the rollup to one meter type (llm_tokens, compute_execution, api_request, storage). Omit to include every meter. Useful with group_by=model, whose dimension otherwise mixes model ids with platform SKUs. An unrecognized value yields an empty rollup, not an error.\n",
13901
+ "required": false,
13902
+ "type": "string",
13903
+ "in": "query"
13904
+ },
13905
+ {
13906
+ "name": "session_id",
13907
+ "description": "Narrow the whole rollup — every bucket and the top-level totals alike — to one session's traffic. Combines with group_by: group_by=day&session_id=... is one conversation's spend per day, group_by=model the same spend split by model. This is the figure behind the usage roll-up a single session read carries, broken down. An id naming no session in this project yields an empty rollup, never the project total.\n",
13908
+ "required": false,
13909
+ "type": "string",
13910
+ "in": "query"
13911
+ },
13912
+ {
13913
+ "name": "actor_id",
13914
+ "description": "The same narrowing, for one end user across every session they appear in — what a customer re-billing their own users charges each of them for. An id naming no actor in this project yields an empty rollup, never the project total.\n",
13915
+ "required": false,
13916
+ "type": "string",
13917
+ "in": "query"
13918
+ },
13919
+ {
13920
+ "name": "agent_id",
13921
+ "description": "Narrow to one agent's traffic, across every session, run and trigger that dispatched it.\n",
13922
+ "required": false,
13923
+ "type": "string",
13924
+ "in": "query"
13925
+ },
13926
+ {
13927
+ "name": "ai_provider_id",
13928
+ "description": "Narrow to the spend billed against one provider record — a routed generation's serving target, or the agent's pinned provider.\n",
13929
+ "required": false,
13930
+ "type": "string",
13931
+ "in": "query"
13932
+ },
13933
+ {
13934
+ "name": "orchestration_run_id",
13935
+ "description": "Narrow to the events one orchestration run metered.",
13936
+ "required": false,
13937
+ "type": "string",
13938
+ "in": "query"
13939
+ },
13940
+ {
13941
+ "name": "orchestration_id",
13942
+ "description": "Narrow to the runs of one orchestration — the ones it started itself, never the subtree a loop or sub-orchestration node started under it, which is metered against the child orchestration where it was incurred. Additive: summed across a project's orchestrations the figures reach the project total exactly once.\n",
13943
+ "required": false,
13944
+ "type": "string",
13945
+ "in": "query"
13946
+ },
13947
+ {
13948
+ "name": "generation_id",
13949
+ "description": "Narrow to one generation's events. A generation writes more than one when it meters several dimensions, such as tokens and compute.\n",
13950
+ "required": false,
13951
+ "type": "string",
13952
+ "in": "query"
13953
+ },
13954
+ {
13955
+ "name": "trace_id",
13956
+ "description": "Narrow to the events recorded under one trace.",
13957
+ "required": false,
13958
+ "type": "string",
13959
+ "in": "query"
13960
+ },
13961
+ {
13962
+ "name": "source",
13963
+ "description": "Narrow by what the spend was incurred for — eval and eval_judge are verification spend. Ordinary traffic carries no source, so it cannot be selected by this filter; omit the filter for everything.\n",
13964
+ "required": false,
13965
+ "type": "string",
13966
+ "in": "query"
13967
+ },
13968
+ {
13969
+ "name": "trigger_id",
13970
+ "description": "Narrow to the spend one trigger initiated. Matched as recorded rather than resolved, so it still selects the spend of a trigger that has since been deleted.\n",
13971
+ "required": false,
13972
+ "type": "string",
13973
+ "in": "query"
13974
+ },
13975
+ {
13976
+ "name": "action_id",
13977
+ "description": "Narrow to one caller-supplied action label, for per-action spend. Matched as recorded, like trigger_id.\n",
13978
+ "required": false,
13979
+ "type": "string",
13980
+ "in": "query"
13981
+ },
13982
+ {
13983
+ "name": "limit",
13984
+ "description": "Maximum number of events to return. A value above 100 is refused rather than clamped, so a caller paging by their own stride never silently skips a row.\n",
13985
+ "required": false,
13986
+ "type": "integer",
13987
+ "in": "query"
13988
+ },
13989
+ {
13990
+ "name": "offset",
13991
+ "description": "Number of events to skip.",
13992
+ "required": false,
13993
+ "type": "integer",
13994
+ "in": "query"
13995
+ }
13996
+ ]
13997
+ },
13998
+ "get-project-usage-receipt": {
13999
+ serviceClass: "Projects",
14000
+ operationId: "getProjectUsageReceipt",
14001
+ description: "What one occurrence was billed, line by line: per-event line items with their measured components and unit prices, a per-meter-type split, and the totals. Pass generation_id for one generation, or orchestration_run_id for a receipt summed across every event the run metered. Exactly one of the two is required. This is the itemisation behind a single number — where [the meter](/docs/api/projects/get-project-usage) says a window cost $12.40, a receipt says which components of which call made up one occurrence of it. On an orchestration-run receipt every line carries node_id, so grouping by it gives the per-node cost the total hides; a retried node contributes one line per attempt, which is the intended reading for spend.",
14002
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/projects",
14003
+ httpMethod: "get",
14004
+ pathParams: ["project_id"],
14005
+ queryParams: ["generation_id", "orchestration_run_id"],
14006
+ flags: [
14007
+ {
14008
+ "name": "project_id",
14009
+ "description": "Project public ID (proj_ prefix).",
14010
+ "required": true,
14011
+ "type": "string",
14012
+ "in": "path"
14013
+ },
14014
+ {
14015
+ "name": "generation_id",
14016
+ "description": "Generation public ID. Mutually exclusive with orchestration_run_id.\n",
14017
+ "required": false,
14018
+ "type": "string",
14019
+ "in": "query"
14020
+ },
14021
+ {
14022
+ "name": "orchestration_run_id",
14023
+ "description": "Orchestration run public ID. Returns the receipt summed across every generation the run metered. Mutually exclusive with generation_id.\n",
14024
+ "required": false,
14025
+ "type": "string",
14026
+ "in": "query"
14027
+ }
14028
+ ]
14029
+ },
14030
+ "list-project-usage-thresholds": {
14031
+ serviceClass: "Projects",
14032
+ operationId: "listProjectUsageThresholds",
14033
+ description: "The spend alerts this project has set. A threshold fires the usage.threshold_crossed event when the project's windowed usage crosses it, so one is only useful alongside a webhook subscribed to that event.",
14034
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/projects",
14035
+ httpMethod: "get",
14036
+ pathParams: ["project_id"],
14037
+ queryParams: ["limit", "offset"],
14038
+ flags: [
14039
+ {
14040
+ "name": "project_id",
14041
+ "description": "Project public ID (proj_ prefix).",
14042
+ "required": true,
14043
+ "type": "string",
14044
+ "in": "path"
14045
+ },
14046
+ {
14047
+ "name": "limit",
14048
+ "description": "",
14049
+ "required": false,
14050
+ "type": "integer",
14051
+ "in": "query"
14052
+ },
14053
+ {
14054
+ "name": "offset",
14055
+ "description": "",
14056
+ "required": false,
14057
+ "type": "integer",
14058
+ "in": "query"
14059
+ }
14060
+ ]
14061
+ },
14062
+ "create-project-usage-threshold": {
14063
+ serviceClass: "Projects",
14064
+ operationId: "createProjectUsageThreshold",
14065
+ description: "Creates an alert on this project's windowed usage. Crossing it fires usage.threshold_crossed once per window — a calendar_month threshold fires at most once in a month, and a rolling_24h one re-arms when the windowed total falls back below 90% of the threshold, so a total hovering at the line does not alert repeatedly. Requires the admin role: an alerting rule belongs to the account that pays, not to one member.",
14066
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/projects",
14067
+ httpMethod: "post",
14068
+ pathParams: ["project_id"],
14069
+ queryParams: [],
14070
+ flags: [
14071
+ {
14072
+ "name": "project_id",
14073
+ "description": "Project public ID (proj_ prefix).",
14074
+ "required": true,
14075
+ "type": "string",
14076
+ "in": "path"
14077
+ },
14078
+ {
14079
+ "name": "metric",
14080
+ "description": "",
14081
+ "required": true,
14082
+ "type": "string",
14083
+ "in": "body"
14084
+ },
14085
+ {
14086
+ "name": "window",
14087
+ "description": "",
14088
+ "required": true,
14089
+ "type": "string",
14090
+ "in": "body"
14091
+ },
14092
+ {
14093
+ "name": "threshold",
14094
+ "description": "Must be greater than zero.",
14095
+ "required": true,
14096
+ "type": "number",
14097
+ "in": "body"
14098
+ }
14099
+ ]
14100
+ },
14101
+ "delete-project-usage-threshold": {
14102
+ serviceClass: "Projects",
14103
+ operationId: "deleteProjectUsageThreshold",
14104
+ description: "Stops the alert. Requires the admin role.",
14105
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/projects",
14106
+ httpMethod: "delete",
14107
+ pathParams: ["project_id", "threshold_id"],
14108
+ queryParams: [],
14109
+ flags: [{
14110
+ "name": "project_id",
14111
+ "description": "Project public ID (proj_ prefix).",
14112
+ "required": true,
14113
+ "type": "string",
14114
+ "in": "path"
14115
+ }, {
14116
+ "name": "threshold_id",
14117
+ "description": "",
14118
+ "required": true,
14119
+ "type": "string",
14120
+ "in": "path"
14121
+ }]
14122
+ },
13774
14123
  "list-quotas": {
13775
14124
  serviceClass: "Quotas",
13776
14125
  operationId: "listQuotas",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/cli",
3
- "version": "0.125.0",
3
+ "version": "0.127.0",
4
4
  "description": "Command-line interface for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "type": "module",
6
6
  "bin": {
@@ -30,7 +30,7 @@
30
30
  "tsx": "^4.23.1",
31
31
  "typescript": "~6.0.3",
32
32
  "vitest": "^4.1.10",
33
- "@naturali/sdk": "0.125.0"
33
+ "@naturali/sdk": "0.127.0"
34
34
  },
35
35
  "scripts": {
36
36
  "generate": "tsx scripts/generate.ts",