@oxygen-agent/cli 1.139.9 → 1.142.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.
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -420,9 +420,13 @@ export function createProgram() {
|
|
|
420
420
|
}))
|
|
421
421
|
.addCommand(new Command("migrate")
|
|
422
422
|
.description("Apply pending tenant database migrations for the current organization.")
|
|
423
|
+
.option("--rotate-credentials", "Rotate the tenant runtime/read DB passwords and rewrite stored credentials. Use only to repair a tenant whose stored credentials are out of sync; routine migrations do not need it.")
|
|
423
424
|
.option("--json", "Print a JSON envelope.")
|
|
424
425
|
.action(async (options) => {
|
|
425
|
-
await handleAsyncAction("db migrate", options, async () => requestOxygen("/api/cli/db/migrate", {
|
|
426
|
+
await handleAsyncAction("db migrate", options, async () => requestOxygen("/api/cli/db/migrate", {
|
|
427
|
+
method: "POST",
|
|
428
|
+
body: options.rotateCredentials ? { rotate_credentials: true } : {},
|
|
429
|
+
}));
|
|
426
430
|
}))
|
|
427
431
|
.addCommand(new Command("migrate-all")
|
|
428
432
|
.description("Apply pending tenant database migrations across all ready tenants (staff only).")
|
|
@@ -1732,10 +1736,12 @@ export function createProgram() {
|
|
|
1732
1736
|
.option("--max-credits <n>", "Maximum managed/provider credits to reserve for this run.")
|
|
1733
1737
|
.option("--max-concurrency <n>", "Maximum concurrent row items for this run.")
|
|
1734
1738
|
.option("--metadata-json <json>", "Optional metadata object to attach to the run.")
|
|
1739
|
+
.option("--then-json <json>", "JSON array of sequential follow-up steps. Each step runs after the previous terminates with completed or completed_with_errors. Paid steps require selection and max_credits. Shape: [{actions:[{type:'tool_column',column}],selection,force,max_concurrency,max_credits,metadata,run_on_failure}].")
|
|
1735
1740
|
.option("--json", "Print a JSON envelope.")
|
|
1736
1741
|
.action(async (table, options) => {
|
|
1737
1742
|
const maxCredits = readPositiveNumber(options.maxCredits);
|
|
1738
1743
|
const maxConcurrency = readPositiveInt(options.maxConcurrency);
|
|
1744
|
+
const chainSteps = readChainStepsOption(options.thenJson);
|
|
1739
1745
|
await handleAsyncAction("table-runs create", options, async () => requestOxygen("/api/cli/table-action-runs", {
|
|
1740
1746
|
method: "POST",
|
|
1741
1747
|
body: {
|
|
@@ -1747,6 +1753,7 @@ export function createProgram() {
|
|
|
1747
1753
|
...(maxCredits !== undefined ? { max_credits: maxCredits } : {}),
|
|
1748
1754
|
...(maxConcurrency ? { max_concurrency: maxConcurrency } : {}),
|
|
1749
1755
|
...(options.metadataJson ? { metadata: parseJsonObject(options.metadataJson) } : {}),
|
|
1756
|
+
...(chainSteps.length > 0 ? { then: chainSteps } : {}),
|
|
1750
1757
|
},
|
|
1751
1758
|
}));
|
|
1752
1759
|
}))
|
|
@@ -2276,22 +2283,50 @@ export function createProgram() {
|
|
|
2276
2283
|
await handleAsyncAction("billing balance", options, async () => requestOxygen("/api/cli/billing/balance"));
|
|
2277
2284
|
}))
|
|
2278
2285
|
.addCommand(new Command("usage")
|
|
2279
|
-
.description("Show
|
|
2286
|
+
.description("Show credit ledger events.")
|
|
2280
2287
|
.option("--days <n>", "Lookback window in days. Defaults to 30.")
|
|
2288
|
+
.option("--from <iso>", "Only include ledger events at or after this ISO timestamp.")
|
|
2289
|
+
.option("--to <iso>", "Only include ledger events at or before this ISO timestamp.")
|
|
2281
2290
|
.option("--limit <n>", "Maximum events to return. Defaults to 50.")
|
|
2291
|
+
.option("--cursor <cursor>", "Opaque cursor from a previous usage response.")
|
|
2292
|
+
.option("--type <type>", "Filter by transaction type, such as reserve, capture, release, grant, or byok_usage.")
|
|
2293
|
+
.option("--category <category>", "Filter by transaction category, such as managed_enrichment, managed_ai, byok, subscription, or admin.")
|
|
2294
|
+
.option("--provider <provider>", "Filter by provider id.")
|
|
2295
|
+
.option("--source <source_id>", "Filter by source_id/provider operation.")
|
|
2296
|
+
.option("--source-id <source_id>", "Alias for --source.")
|
|
2297
|
+
.option("--run-id <run_id>", "Filter by run id recorded in ledger metadata.")
|
|
2298
|
+
.option("--nonzero", "Only include events that changed available or reserved credits.")
|
|
2282
2299
|
.option("--json", "Print a JSON envelope.")
|
|
2283
2300
|
.action(async (options) => {
|
|
2284
2301
|
await handleAsyncAction("billing usage", options, async () => {
|
|
2285
|
-
const params =
|
|
2286
|
-
const days = readPositiveInt(options.days);
|
|
2287
|
-
const limit = readPositiveInt(options.limit);
|
|
2288
|
-
if (days)
|
|
2289
|
-
params.set("days", String(days));
|
|
2290
|
-
if (limit)
|
|
2291
|
-
params.set("limit", String(limit));
|
|
2302
|
+
const params = buildBillingLedgerParams(options);
|
|
2292
2303
|
const suffix = params.toString() ? `?${params.toString()}` : "";
|
|
2293
2304
|
return requestOxygen(`/api/cli/billing/usage${suffix}`);
|
|
2294
2305
|
});
|
|
2306
|
+
}))
|
|
2307
|
+
.addCommand(new Command("audit")
|
|
2308
|
+
.description("Summarize where managed credits were granted, reserved, captured, released, or spent.")
|
|
2309
|
+
.option("--days <n>", "Lookback window in days. Defaults to 365.")
|
|
2310
|
+
.option("--from <iso>", "Only include ledger events at or after this ISO timestamp.")
|
|
2311
|
+
.option("--to <iso>", "Only include ledger events at or before this ISO timestamp.")
|
|
2312
|
+
.option("--limit <n>", "Maximum grouped rows to return. Defaults to 100.")
|
|
2313
|
+
.option("--group-by <keys>", "Comma-separated grouping keys. Defaults to provider,source.")
|
|
2314
|
+
.option("--type <type>", "Filter by transaction type, such as reserve, capture, release, grant, or byok_usage.")
|
|
2315
|
+
.option("--category <category>", "Filter by transaction category, such as managed_enrichment, managed_ai, byok, subscription, or admin.")
|
|
2316
|
+
.option("--provider <provider>", "Filter by provider id.")
|
|
2317
|
+
.option("--source <source_id>", "Filter by source_id/provider operation.")
|
|
2318
|
+
.option("--source-id <source_id>", "Alias for --source.")
|
|
2319
|
+
.option("--run-id <run_id>", "Filter by run id recorded in ledger metadata.")
|
|
2320
|
+
.option("--nonzero", "Only include events that changed available or reserved credits. Default for audit except BYOK filters.")
|
|
2321
|
+
.option("--json", "Print a JSON envelope.")
|
|
2322
|
+
.action(async (options) => {
|
|
2323
|
+
await handleAsyncAction("billing audit", options, async () => {
|
|
2324
|
+
const params = buildBillingLedgerParams(options);
|
|
2325
|
+
if (readOption(options.groupBy))
|
|
2326
|
+
params.set("group_by", readOption(options.groupBy));
|
|
2327
|
+
const suffix = params.toString() ? `?${params.toString()}` : "";
|
|
2328
|
+
return requestOxygen(`/api/cli/billing/audit${suffix}`);
|
|
2329
|
+
});
|
|
2295
2330
|
}))
|
|
2296
2331
|
.addCommand(new Command("grant")
|
|
2297
2332
|
.description("Grant managed credits to the current organization (staff only).")
|
|
@@ -3753,6 +3788,24 @@ function readTableRunActions(options) {
|
|
|
3753
3788
|
exitCode: 1,
|
|
3754
3789
|
});
|
|
3755
3790
|
}
|
|
3791
|
+
// Parse --then-json into an array of chain steps. Server validates the shape;
|
|
3792
|
+
// we only enforce that the top-level value is an array of objects so users get
|
|
3793
|
+
// a clear local error before round-tripping to the API.
|
|
3794
|
+
function readChainStepsOption(value) {
|
|
3795
|
+
if (!value)
|
|
3796
|
+
return [];
|
|
3797
|
+
const parsed = parseJsonArray(value);
|
|
3798
|
+
for (let i = 0; i < parsed.length; i += 1) {
|
|
3799
|
+
const entry = parsed[i];
|
|
3800
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
3801
|
+
throw new OxygenError("invalid_table_run", "--then-json entries must be objects.", {
|
|
3802
|
+
details: { index: i },
|
|
3803
|
+
exitCode: 1,
|
|
3804
|
+
});
|
|
3805
|
+
}
|
|
3806
|
+
}
|
|
3807
|
+
return parsed;
|
|
3808
|
+
}
|
|
3756
3809
|
function readTableRunSelection(options) {
|
|
3757
3810
|
const hasAll = Boolean(options.all);
|
|
3758
3811
|
const limit = readPositiveInt(options.limit);
|
|
@@ -6143,6 +6196,35 @@ function contextAssetsQuery(options) {
|
|
|
6143
6196
|
const value = query.toString();
|
|
6144
6197
|
return value ? `?${value}` : "";
|
|
6145
6198
|
}
|
|
6199
|
+
function buildBillingLedgerParams(options) {
|
|
6200
|
+
const params = new URLSearchParams();
|
|
6201
|
+
const days = readPositiveInt(options.days);
|
|
6202
|
+
const limit = readPositiveInt(options.limit);
|
|
6203
|
+
if (days)
|
|
6204
|
+
params.set("days", String(days));
|
|
6205
|
+
if (limit)
|
|
6206
|
+
params.set("limit", String(limit));
|
|
6207
|
+
if (readOption(options.from))
|
|
6208
|
+
params.set("from", readOption(options.from));
|
|
6209
|
+
if (readOption(options.to))
|
|
6210
|
+
params.set("to", readOption(options.to));
|
|
6211
|
+
if (readOption(options.cursor))
|
|
6212
|
+
params.set("cursor", readOption(options.cursor));
|
|
6213
|
+
if (readOption(options.type))
|
|
6214
|
+
params.set("type", readOption(options.type));
|
|
6215
|
+
if (readOption(options.category))
|
|
6216
|
+
params.set("category", readOption(options.category));
|
|
6217
|
+
if (readOption(options.provider))
|
|
6218
|
+
params.set("provider", readOption(options.provider));
|
|
6219
|
+
const sourceId = readOption(options.sourceId) ?? readOption(options.source);
|
|
6220
|
+
if (sourceId)
|
|
6221
|
+
params.set("source_id", sourceId);
|
|
6222
|
+
if (readOption(options.runId))
|
|
6223
|
+
params.set("run_id", readOption(options.runId));
|
|
6224
|
+
if (options.nonzero)
|
|
6225
|
+
params.set("nonzero", "true");
|
|
6226
|
+
return params;
|
|
6227
|
+
}
|
|
6146
6228
|
function buildContextResolveBody(options) {
|
|
6147
6229
|
const assetTypes = readCsvOption(options.assetType);
|
|
6148
6230
|
const tags = readCsvOption(options.tags);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const OXYGEN_VERSION = "1.
|
|
1
|
+
export declare const OXYGEN_VERSION = "1.142.4";
|
|
2
2
|
export declare const OXYGEN_MINIMUM_CLI_VERSION = "1.135.0";
|