chainlesschain 0.66.0 → 0.132.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.
- package/bin/chainlesschain.js +0 -0
- package/package.json +1 -1
- package/src/commands/a2a.js +380 -0
- package/src/commands/agent-network.js +254 -1
- package/src/commands/audit.js +302 -0
- package/src/commands/automation.js +271 -1
- package/src/commands/bi.js +348 -0
- package/src/commands/codegen.js +224 -0
- package/src/commands/collab.js +341 -0
- package/src/commands/compliance.js +1035 -0
- package/src/commands/cowork.js +221 -0
- package/src/commands/crosschain.js +218 -0
- package/src/commands/dbevo.js +284 -0
- package/src/commands/dev.js +252 -0
- package/src/commands/did.js +358 -0
- package/src/commands/dlp.js +341 -0
- package/src/commands/encrypt.js +341 -0
- package/src/commands/evomap.js +394 -0
- package/src/commands/export.js +256 -1
- package/src/commands/federation.js +283 -0
- package/src/commands/fusion.js +258 -0
- package/src/commands/governance.js +325 -0
- package/src/commands/hardening.js +411 -0
- package/src/commands/hook.js +148 -0
- package/src/commands/import.js +252 -0
- package/src/commands/incentive.js +322 -0
- package/src/commands/inference.js +318 -0
- package/src/commands/infra.js +244 -0
- package/src/commands/instinct.js +260 -0
- package/src/commands/ipfs.js +318 -0
- package/src/commands/kg.js +387 -0
- package/src/commands/llm.js +263 -0
- package/src/commands/lowcode.js +356 -0
- package/src/commands/marketplace.js +256 -0
- package/src/commands/mcp.js +221 -0
- package/src/commands/memory.js +248 -0
- package/src/commands/multimodal.js +296 -0
- package/src/commands/nlprog.js +356 -0
- package/src/commands/note.js +244 -0
- package/src/commands/ops.js +354 -0
- package/src/commands/orchestrate.js +166 -0
- package/src/commands/org.js +277 -0
- package/src/commands/p2p.js +390 -0
- package/src/commands/perception.js +290 -0
- package/src/commands/permmem.js +251 -0
- package/src/commands/plugin-ecosystem.js +273 -0
- package/src/commands/pqc.js +393 -0
- package/src/commands/privacy.js +321 -0
- package/src/commands/quantization.js +351 -0
- package/src/commands/rcache.js +271 -0
- package/src/commands/recommend.js +340 -0
- package/src/commands/reputation.js +261 -0
- package/src/commands/runtime.js +307 -0
- package/src/commands/scim.js +262 -0
- package/src/commands/session.js +258 -0
- package/src/commands/siem.js +246 -0
- package/src/commands/skill.js +267 -1
- package/src/commands/sla.js +259 -0
- package/src/commands/social.js +256 -0
- package/src/commands/sso.js +186 -1
- package/src/commands/stress.js +230 -0
- package/src/commands/sync.js +256 -0
- package/src/commands/tech.js +338 -0
- package/src/commands/tenant.js +351 -0
- package/src/commands/terraform.js +245 -0
- package/src/commands/tokens.js +269 -0
- package/src/commands/trust.js +249 -0
- package/src/commands/wallet.js +277 -0
- package/src/commands/workflow.js +171 -0
- package/src/commands/zkp.js +335 -0
- package/src/index.js +4 -0
- package/src/lib/a2a-protocol.js +451 -0
- package/src/lib/agent-coordinator.js +325 -0
- package/src/lib/agent-network.js +387 -0
- package/src/lib/agent-router.js +395 -0
- package/src/lib/aiops.js +478 -0
- package/src/lib/app-builder.js +239 -0
- package/src/lib/audit-logger.js +379 -0
- package/src/lib/automation-engine.js +330 -0
- package/src/lib/autonomous-developer.js +350 -0
- package/src/lib/bi-engine.js +338 -0
- package/src/lib/code-agent.js +323 -0
- package/src/lib/collaboration-governance.js +364 -0
- package/src/lib/community-governance.js +436 -0
- package/src/lib/compliance-manager.js +434 -0
- package/src/lib/content-recommendation.js +469 -0
- package/src/lib/cross-chain.js +345 -0
- package/src/lib/crypto-manager.js +350 -0
- package/src/lib/dbevo.js +338 -0
- package/src/lib/decentral-infra.js +340 -0
- package/src/lib/did-manager.js +367 -0
- package/src/lib/dlp-engine.js +389 -0
- package/src/lib/evomap-federation.js +177 -0
- package/src/lib/evomap-governance.js +276 -0
- package/src/lib/federation-hardening.js +259 -0
- package/src/lib/hardening-manager.js +348 -0
- package/src/lib/hook-manager.js +380 -0
- package/src/lib/inference-network.js +330 -0
- package/src/lib/instinct-manager.js +332 -0
- package/src/lib/ipfs-storage.js +334 -0
- package/src/lib/knowledge-exporter.js +381 -0
- package/src/lib/knowledge-graph.js +432 -0
- package/src/lib/knowledge-importer.js +379 -0
- package/src/lib/llm-providers.js +391 -0
- package/src/lib/mcp-registry.js +333 -0
- package/src/lib/memory-manager.js +330 -0
- package/src/lib/multimodal.js +346 -0
- package/src/lib/nl-programming.js +343 -0
- package/src/lib/note-versioning.js +327 -0
- package/src/lib/org-manager.js +323 -0
- package/src/lib/p2p-manager.js +387 -0
- package/src/lib/perception.js +346 -0
- package/src/lib/perf-tuning.js +4 -1
- package/src/lib/permanent-memory.js +320 -0
- package/src/lib/plugin-ecosystem.js +377 -0
- package/src/lib/pqc-manager.js +368 -0
- package/src/lib/privacy-computing.js +427 -0
- package/src/lib/protocol-fusion.js +417 -0
- package/src/lib/quantization.js +325 -0
- package/src/lib/reputation-optimizer.js +299 -0
- package/src/lib/response-cache.js +327 -0
- package/src/lib/scim-manager.js +329 -0
- package/src/lib/session-manager.js +329 -0
- package/src/lib/siem-exporter.js +333 -0
- package/src/lib/skill-loader.js +377 -0
- package/src/lib/skill-marketplace.js +325 -0
- package/src/lib/sla-manager.js +275 -0
- package/src/lib/social-manager.js +326 -0
- package/src/lib/sso-manager.js +332 -0
- package/src/lib/stress-tester.js +330 -0
- package/src/lib/sync-manager.js +326 -0
- package/src/lib/tech-learning-engine.js +369 -0
- package/src/lib/tenant-saas.js +460 -0
- package/src/lib/terraform-manager.js +363 -0
- package/src/lib/threat-intel.js +335 -0
- package/src/lib/token-incentive.js +293 -0
- package/src/lib/token-tracker.js +329 -0
- package/src/lib/trust-security.js +390 -0
- package/src/lib/ueba.js +389 -0
- package/src/lib/universal-runtime.js +325 -0
- package/src/lib/wallet-manager.js +326 -0
- package/src/lib/workflow-engine.js +322 -0
- package/src/lib/zkp-engine.js +274 -0
|
@@ -12,6 +12,22 @@ import {
|
|
|
12
12
|
createWorkspace,
|
|
13
13
|
planRun,
|
|
14
14
|
listRuns,
|
|
15
|
+
// V2
|
|
16
|
+
RUN_STATUS_V2,
|
|
17
|
+
RUN_TYPE_V2,
|
|
18
|
+
WORKSPACE_STATUS_V2,
|
|
19
|
+
TERRAFORM_DEFAULT_MAX_CONCURRENT,
|
|
20
|
+
setMaxConcurrentRuns,
|
|
21
|
+
getMaxConcurrentRuns,
|
|
22
|
+
createWorkspaceV2,
|
|
23
|
+
setWorkspaceStatus,
|
|
24
|
+
archiveWorkspace,
|
|
25
|
+
planRunV2,
|
|
26
|
+
setRunStatus,
|
|
27
|
+
cancelRun,
|
|
28
|
+
failRun,
|
|
29
|
+
getActiveRunCount,
|
|
30
|
+
getTerraformStatsV2,
|
|
15
31
|
} from "../lib/terraform-manager.js";
|
|
16
32
|
|
|
17
33
|
export function registerTerraformCommand(program) {
|
|
@@ -145,4 +161,233 @@ export function registerTerraformCommand(program) {
|
|
|
145
161
|
process.exit(1);
|
|
146
162
|
}
|
|
147
163
|
});
|
|
164
|
+
|
|
165
|
+
/* ── V2 Subcommands (Phase 56) ──────────────────────────── */
|
|
166
|
+
|
|
167
|
+
const withDb = async (fn) => {
|
|
168
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
169
|
+
if (!ctx.db) {
|
|
170
|
+
logger.error("Database not available");
|
|
171
|
+
process.exit(1);
|
|
172
|
+
}
|
|
173
|
+
try {
|
|
174
|
+
const db = ctx.db.getDatabase();
|
|
175
|
+
ensureTerraformTables(db);
|
|
176
|
+
return await fn(db);
|
|
177
|
+
} finally {
|
|
178
|
+
await shutdown();
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
terraform
|
|
183
|
+
.command("run-statuses")
|
|
184
|
+
.description("List RUN_STATUS_V2 enum values")
|
|
185
|
+
.action(() => {
|
|
186
|
+
console.log(JSON.stringify(Object.values(RUN_STATUS_V2), null, 2));
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
terraform
|
|
190
|
+
.command("run-types")
|
|
191
|
+
.description("List RUN_TYPE_V2 enum values")
|
|
192
|
+
.action(() => {
|
|
193
|
+
console.log(JSON.stringify(Object.values(RUN_TYPE_V2), null, 2));
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
terraform
|
|
197
|
+
.command("workspace-statuses")
|
|
198
|
+
.description("List WORKSPACE_STATUS_V2 enum values")
|
|
199
|
+
.action(() => {
|
|
200
|
+
console.log(JSON.stringify(Object.values(WORKSPACE_STATUS_V2), null, 2));
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
terraform
|
|
204
|
+
.command("default-max-concurrent")
|
|
205
|
+
.description("Show TERRAFORM_DEFAULT_MAX_CONCURRENT")
|
|
206
|
+
.action(() => {
|
|
207
|
+
console.log(TERRAFORM_DEFAULT_MAX_CONCURRENT);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
terraform
|
|
211
|
+
.command("active-run-count")
|
|
212
|
+
.description("Show current active (non-terminal) run count")
|
|
213
|
+
.action(() => {
|
|
214
|
+
console.log(getActiveRunCount());
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
terraform
|
|
218
|
+
.command("set-max-concurrent <n>")
|
|
219
|
+
.description("Set max concurrent runs")
|
|
220
|
+
.action(async (n) => {
|
|
221
|
+
try {
|
|
222
|
+
const value = setMaxConcurrentRuns(Number(n));
|
|
223
|
+
logger.success(`maxConcurrentRuns = ${value}`);
|
|
224
|
+
} catch (err) {
|
|
225
|
+
logger.error(`Failed: ${err.message}`);
|
|
226
|
+
process.exit(1);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
terraform
|
|
231
|
+
.command("max-concurrent")
|
|
232
|
+
.description("Show current max concurrent runs")
|
|
233
|
+
.action(() => {
|
|
234
|
+
console.log(getMaxConcurrentRuns());
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
terraform
|
|
238
|
+
.command("create-workspace-v2 <name>")
|
|
239
|
+
.description("Create workspace (V2, unique-name enforced)")
|
|
240
|
+
.option("-d, --description <text>", "Workspace description")
|
|
241
|
+
.option("--tf-version <version>", "Terraform version")
|
|
242
|
+
.option("--auto-apply", "Enable auto-apply")
|
|
243
|
+
.option("--providers <list>", "Comma-separated providers")
|
|
244
|
+
.action(async (name, options) => {
|
|
245
|
+
await withDb(async (db) => {
|
|
246
|
+
try {
|
|
247
|
+
const ws = createWorkspaceV2(db, {
|
|
248
|
+
name,
|
|
249
|
+
description: options.description,
|
|
250
|
+
terraformVersion: options.tfVersion,
|
|
251
|
+
autoApply: options.autoApply,
|
|
252
|
+
providers: options.providers
|
|
253
|
+
? options.providers.split(",").map((s) => s.trim())
|
|
254
|
+
: undefined,
|
|
255
|
+
});
|
|
256
|
+
logger.success("Workspace created (V2)");
|
|
257
|
+
logger.log(` ID: ${chalk.cyan(ws.id)}`);
|
|
258
|
+
logger.log(` Name: ${ws.name}`);
|
|
259
|
+
logger.log(` Status: ${ws.status}`);
|
|
260
|
+
} catch (err) {
|
|
261
|
+
logger.error(`Failed: ${err.message}`);
|
|
262
|
+
process.exit(1);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
terraform
|
|
268
|
+
.command("set-workspace-status <workspace-id> <status>")
|
|
269
|
+
.description("Set workspace status (state-machine guarded)")
|
|
270
|
+
.action(async (workspaceId, status) => {
|
|
271
|
+
await withDb(async (db) => {
|
|
272
|
+
try {
|
|
273
|
+
const result = setWorkspaceStatus(db, workspaceId, status);
|
|
274
|
+
logger.success(
|
|
275
|
+
`Workspace ${workspaceId.slice(0, 8)} → ${result.status}`,
|
|
276
|
+
);
|
|
277
|
+
} catch (err) {
|
|
278
|
+
logger.error(`Failed: ${err.message}`);
|
|
279
|
+
process.exit(1);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
terraform
|
|
285
|
+
.command("archive-workspace <workspace-id>")
|
|
286
|
+
.description("Archive a workspace (shortcut)")
|
|
287
|
+
.action(async (workspaceId) => {
|
|
288
|
+
await withDb(async (db) => {
|
|
289
|
+
try {
|
|
290
|
+
const result = archiveWorkspace(db, workspaceId);
|
|
291
|
+
logger.success(`Workspace archived: ${result.status}`);
|
|
292
|
+
} catch (err) {
|
|
293
|
+
logger.error(`Failed: ${err.message}`);
|
|
294
|
+
process.exit(1);
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
terraform
|
|
300
|
+
.command("plan-run-v2 <workspace-id>")
|
|
301
|
+
.description("Create a V2 run (pending state, concurrency-limited)")
|
|
302
|
+
.option("-t, --run-type <type>", "Run type: plan|apply|destroy", "plan")
|
|
303
|
+
.option("--triggered-by <who>", "Who triggered the run")
|
|
304
|
+
.action(async (workspaceId, options) => {
|
|
305
|
+
await withDb(async (db) => {
|
|
306
|
+
try {
|
|
307
|
+
const run = planRunV2(db, {
|
|
308
|
+
workspaceId,
|
|
309
|
+
runType: options.runType,
|
|
310
|
+
triggeredBy: options.triggeredBy,
|
|
311
|
+
});
|
|
312
|
+
logger.success("Run created (V2)");
|
|
313
|
+
logger.log(` ID: ${chalk.cyan(run.id)}`);
|
|
314
|
+
logger.log(` Type: ${run.runType}`);
|
|
315
|
+
logger.log(` Status: ${run.status}`);
|
|
316
|
+
} catch (err) {
|
|
317
|
+
logger.error(`Failed: ${err.message}`);
|
|
318
|
+
process.exit(1);
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
terraform
|
|
324
|
+
.command("set-run-status <run-id> <status>")
|
|
325
|
+
.description("Set run status (state-machine guarded)")
|
|
326
|
+
.option("--plan-output <text>", "Plan output summary")
|
|
327
|
+
.option("--apply-output <text>", "Apply output summary")
|
|
328
|
+
.option("--resources-added <n>", "Resources added count")
|
|
329
|
+
.option("--resources-changed <n>", "Resources changed count")
|
|
330
|
+
.option("--resources-destroyed <n>", "Resources destroyed count")
|
|
331
|
+
.option("--error-message <text>", "Error message")
|
|
332
|
+
.action(async (runId, status, options) => {
|
|
333
|
+
await withDb(async (db) => {
|
|
334
|
+
try {
|
|
335
|
+
const patch = {};
|
|
336
|
+
if (options.planOutput) patch.planOutput = options.planOutput;
|
|
337
|
+
if (options.applyOutput) patch.applyOutput = options.applyOutput;
|
|
338
|
+
if (options.resourcesAdded !== undefined)
|
|
339
|
+
patch.resourcesAdded = Number(options.resourcesAdded);
|
|
340
|
+
if (options.resourcesChanged !== undefined)
|
|
341
|
+
patch.resourcesChanged = Number(options.resourcesChanged);
|
|
342
|
+
if (options.resourcesDestroyed !== undefined)
|
|
343
|
+
patch.resourcesDestroyed = Number(options.resourcesDestroyed);
|
|
344
|
+
if (options.errorMessage) patch.errorMessage = options.errorMessage;
|
|
345
|
+
const run = setRunStatus(db, runId, status, patch);
|
|
346
|
+
logger.success(`Run ${runId.slice(0, 8)} → ${run.status}`);
|
|
347
|
+
} catch (err) {
|
|
348
|
+
logger.error(`Failed: ${err.message}`);
|
|
349
|
+
process.exit(1);
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
terraform
|
|
355
|
+
.command("cancel-run <run-id>")
|
|
356
|
+
.description("Cancel a run (shortcut)")
|
|
357
|
+
.action(async (runId) => {
|
|
358
|
+
await withDb(async (db) => {
|
|
359
|
+
try {
|
|
360
|
+
const run = cancelRun(db, runId);
|
|
361
|
+
logger.success(`Run cancelled: ${run.status}`);
|
|
362
|
+
} catch (err) {
|
|
363
|
+
logger.error(`Failed: ${err.message}`);
|
|
364
|
+
process.exit(1);
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
terraform
|
|
370
|
+
.command("fail-run <run-id> <error-message>")
|
|
371
|
+
.description("Mark a run as errored (shortcut)")
|
|
372
|
+
.action(async (runId, errorMessage) => {
|
|
373
|
+
await withDb(async (db) => {
|
|
374
|
+
try {
|
|
375
|
+
const run = failRun(db, runId, errorMessage);
|
|
376
|
+
logger.success(`Run errored: ${run.errorMessage}`);
|
|
377
|
+
} catch (err) {
|
|
378
|
+
logger.error(`Failed: ${err.message}`);
|
|
379
|
+
process.exit(1);
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
terraform
|
|
385
|
+
.command("stats-v2")
|
|
386
|
+
.description("Show V2 terraform stats")
|
|
387
|
+
.action(async () => {
|
|
388
|
+
await withDb(async () => {
|
|
389
|
+
const stats = getTerraformStatsV2();
|
|
390
|
+
console.log(JSON.stringify(stats, null, 2));
|
|
391
|
+
});
|
|
392
|
+
});
|
|
148
393
|
}
|
package/src/commands/tokens.js
CHANGED
|
@@ -11,6 +11,37 @@ import {
|
|
|
11
11
|
getTodayStats,
|
|
12
12
|
getCostBreakdown,
|
|
13
13
|
getRecentUsage,
|
|
14
|
+
BUDGET_MATURITY_V2,
|
|
15
|
+
USAGE_RECORD_LIFECYCLE_V2,
|
|
16
|
+
getMaxActiveBudgetsPerOwnerV2,
|
|
17
|
+
setMaxActiveBudgetsPerOwnerV2,
|
|
18
|
+
getMaxPendingRecordsPerBudgetV2,
|
|
19
|
+
setMaxPendingRecordsPerBudgetV2,
|
|
20
|
+
getBudgetIdleMsV2,
|
|
21
|
+
setBudgetIdleMsV2,
|
|
22
|
+
getRecordStuckMsV2,
|
|
23
|
+
setRecordStuckMsV2,
|
|
24
|
+
registerBudgetV2,
|
|
25
|
+
getBudgetV2,
|
|
26
|
+
listBudgetsV2,
|
|
27
|
+
setBudgetStatusV2,
|
|
28
|
+
activateBudgetV2,
|
|
29
|
+
suspendBudgetV2,
|
|
30
|
+
archiveBudgetV2,
|
|
31
|
+
touchBudgetV2,
|
|
32
|
+
getActiveBudgetCountV2,
|
|
33
|
+
createUsageRecordV2,
|
|
34
|
+
getUsageRecordV2,
|
|
35
|
+
listUsageRecordsV2,
|
|
36
|
+
setUsageRecordStatusV2,
|
|
37
|
+
recordUsageV2,
|
|
38
|
+
billUsageV2,
|
|
39
|
+
rejectUsageV2,
|
|
40
|
+
refundUsageV2,
|
|
41
|
+
getPendingRecordCountV2,
|
|
42
|
+
autoSuspendIdleBudgetsV2,
|
|
43
|
+
autoRejectStaleRecordsV2,
|
|
44
|
+
getTokenTrackerStatsV2,
|
|
14
45
|
} from "../lib/token-tracker.js";
|
|
15
46
|
import {
|
|
16
47
|
getCacheStats,
|
|
@@ -211,4 +242,242 @@ export function registerTokensCommand(program) {
|
|
|
211
242
|
process.exit(1);
|
|
212
243
|
}
|
|
213
244
|
});
|
|
245
|
+
|
|
246
|
+
// ── V2 Surface ──
|
|
247
|
+
|
|
248
|
+
const out = (json, obj) => {
|
|
249
|
+
if (json) console.log(JSON.stringify(obj, null, 2));
|
|
250
|
+
else console.log(JSON.stringify(obj, null, 2));
|
|
251
|
+
};
|
|
252
|
+
const tryRun = (fn) => {
|
|
253
|
+
try {
|
|
254
|
+
fn();
|
|
255
|
+
} catch (err) {
|
|
256
|
+
logger.error(err.message);
|
|
257
|
+
process.exit(1);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
tokens
|
|
262
|
+
.command("budget-maturities-v2")
|
|
263
|
+
.description("List V2 budget maturity states")
|
|
264
|
+
.action(() => out(true, Object.values(BUDGET_MATURITY_V2)));
|
|
265
|
+
|
|
266
|
+
tokens
|
|
267
|
+
.command("usage-record-lifecycles-v2")
|
|
268
|
+
.description("List V2 usage record lifecycle states")
|
|
269
|
+
.action(() => out(true, Object.values(USAGE_RECORD_LIFECYCLE_V2)));
|
|
270
|
+
|
|
271
|
+
tokens
|
|
272
|
+
.command("stats-v2")
|
|
273
|
+
.description("V2 token-tracker stats")
|
|
274
|
+
.action(() => out(true, getTokenTrackerStatsV2()));
|
|
275
|
+
|
|
276
|
+
tokens
|
|
277
|
+
.command("get-max-active-budgets-v2")
|
|
278
|
+
.description("Get max active budgets per owner (V2)")
|
|
279
|
+
.action(() =>
|
|
280
|
+
out(true, { maxActiveBudgetsPerOwner: getMaxActiveBudgetsPerOwnerV2() }),
|
|
281
|
+
);
|
|
282
|
+
|
|
283
|
+
tokens
|
|
284
|
+
.command("set-max-active-budgets-v2 <n>")
|
|
285
|
+
.description("Set max active budgets per owner (V2)")
|
|
286
|
+
.action((n) =>
|
|
287
|
+
tryRun(() => {
|
|
288
|
+
setMaxActiveBudgetsPerOwnerV2(Number(n));
|
|
289
|
+
out(true, {
|
|
290
|
+
maxActiveBudgetsPerOwner: getMaxActiveBudgetsPerOwnerV2(),
|
|
291
|
+
});
|
|
292
|
+
}),
|
|
293
|
+
);
|
|
294
|
+
|
|
295
|
+
tokens
|
|
296
|
+
.command("get-max-pending-records-v2")
|
|
297
|
+
.description("Get max pending records per budget (V2)")
|
|
298
|
+
.action(() =>
|
|
299
|
+
out(true, {
|
|
300
|
+
maxPendingRecordsPerBudget: getMaxPendingRecordsPerBudgetV2(),
|
|
301
|
+
}),
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
tokens
|
|
305
|
+
.command("set-max-pending-records-v2 <n>")
|
|
306
|
+
.description("Set max pending records per budget (V2)")
|
|
307
|
+
.action((n) =>
|
|
308
|
+
tryRun(() => {
|
|
309
|
+
setMaxPendingRecordsPerBudgetV2(Number(n));
|
|
310
|
+
out(true, {
|
|
311
|
+
maxPendingRecordsPerBudget: getMaxPendingRecordsPerBudgetV2(),
|
|
312
|
+
});
|
|
313
|
+
}),
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
tokens
|
|
317
|
+
.command("get-budget-idle-ms-v2")
|
|
318
|
+
.description("Get budget idle threshold (V2)")
|
|
319
|
+
.action(() => out(true, { budgetIdleMs: getBudgetIdleMsV2() }));
|
|
320
|
+
|
|
321
|
+
tokens
|
|
322
|
+
.command("set-budget-idle-ms-v2 <ms>")
|
|
323
|
+
.description("Set budget idle threshold (V2)")
|
|
324
|
+
.action((ms) =>
|
|
325
|
+
tryRun(() => {
|
|
326
|
+
setBudgetIdleMsV2(Number(ms));
|
|
327
|
+
out(true, { budgetIdleMs: getBudgetIdleMsV2() });
|
|
328
|
+
}),
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
tokens
|
|
332
|
+
.command("get-record-stuck-ms-v2")
|
|
333
|
+
.description("Get record stuck threshold (V2)")
|
|
334
|
+
.action(() => out(true, { recordStuckMs: getRecordStuckMsV2() }));
|
|
335
|
+
|
|
336
|
+
tokens
|
|
337
|
+
.command("set-record-stuck-ms-v2 <ms>")
|
|
338
|
+
.description("Set record stuck threshold (V2)")
|
|
339
|
+
.action((ms) =>
|
|
340
|
+
tryRun(() => {
|
|
341
|
+
setRecordStuckMsV2(Number(ms));
|
|
342
|
+
out(true, { recordStuckMs: getRecordStuckMsV2() });
|
|
343
|
+
}),
|
|
344
|
+
);
|
|
345
|
+
|
|
346
|
+
tokens
|
|
347
|
+
.command("active-budget-count-v2 <ownerId>")
|
|
348
|
+
.description("Active budget count for owner (V2)")
|
|
349
|
+
.action((ownerId) =>
|
|
350
|
+
out(true, { ownerId, count: getActiveBudgetCountV2(ownerId) }),
|
|
351
|
+
);
|
|
352
|
+
|
|
353
|
+
tokens
|
|
354
|
+
.command("pending-record-count-v2 <budgetId>")
|
|
355
|
+
.description("Pending record count for budget (V2)")
|
|
356
|
+
.action((budgetId) =>
|
|
357
|
+
out(true, { budgetId, count: getPendingRecordCountV2(budgetId) }),
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
tokens
|
|
361
|
+
.command("register-budget-v2 <id>")
|
|
362
|
+
.description("Register a V2 budget")
|
|
363
|
+
.requiredOption("-o, --owner <id>", "owner id")
|
|
364
|
+
.requiredOption("-l, --label <label>", "budget label")
|
|
365
|
+
.action((id, opts) =>
|
|
366
|
+
tryRun(() =>
|
|
367
|
+
out(
|
|
368
|
+
true,
|
|
369
|
+
registerBudgetV2(id, { ownerId: opts.owner, label: opts.label }),
|
|
370
|
+
),
|
|
371
|
+
),
|
|
372
|
+
);
|
|
373
|
+
|
|
374
|
+
tokens
|
|
375
|
+
.command("get-budget-v2 <id>")
|
|
376
|
+
.description("Get a V2 budget")
|
|
377
|
+
.action((id) => out(true, getBudgetV2(id)));
|
|
378
|
+
|
|
379
|
+
tokens
|
|
380
|
+
.command("list-budgets-v2")
|
|
381
|
+
.description("List V2 budgets")
|
|
382
|
+
.option("-o, --owner <id>", "filter by owner")
|
|
383
|
+
.option("-s, --status <status>", "filter by status")
|
|
384
|
+
.action((opts) =>
|
|
385
|
+
out(true, listBudgetsV2({ ownerId: opts.owner, status: opts.status })),
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
tokens
|
|
389
|
+
.command("set-budget-status-v2 <id> <next>")
|
|
390
|
+
.description("Set V2 budget status")
|
|
391
|
+
.action((id, next) => tryRun(() => out(true, setBudgetStatusV2(id, next))));
|
|
392
|
+
|
|
393
|
+
tokens
|
|
394
|
+
.command("activate-budget-v2 <id>")
|
|
395
|
+
.description("Activate a V2 budget")
|
|
396
|
+
.action((id) => tryRun(() => out(true, activateBudgetV2(id))));
|
|
397
|
+
|
|
398
|
+
tokens
|
|
399
|
+
.command("suspend-budget-v2 <id>")
|
|
400
|
+
.description("Suspend a V2 budget")
|
|
401
|
+
.action((id) => tryRun(() => out(true, suspendBudgetV2(id))));
|
|
402
|
+
|
|
403
|
+
tokens
|
|
404
|
+
.command("archive-budget-v2 <id>")
|
|
405
|
+
.description("Archive a V2 budget")
|
|
406
|
+
.action((id) => tryRun(() => out(true, archiveBudgetV2(id))));
|
|
407
|
+
|
|
408
|
+
tokens
|
|
409
|
+
.command("touch-budget-v2 <id>")
|
|
410
|
+
.description("Touch a V2 budget")
|
|
411
|
+
.action((id) => tryRun(() => out(true, touchBudgetV2(id))));
|
|
412
|
+
|
|
413
|
+
tokens
|
|
414
|
+
.command("create-usage-record-v2 <id>")
|
|
415
|
+
.description("Create a V2 usage record")
|
|
416
|
+
.requiredOption("-b, --budget <id>", "budget id")
|
|
417
|
+
.requiredOption("-u, --units <n>", "usage units")
|
|
418
|
+
.action((id, opts) =>
|
|
419
|
+
tryRun(() =>
|
|
420
|
+
out(
|
|
421
|
+
true,
|
|
422
|
+
createUsageRecordV2(id, {
|
|
423
|
+
budgetId: opts.budget,
|
|
424
|
+
units: Number(opts.units),
|
|
425
|
+
}),
|
|
426
|
+
),
|
|
427
|
+
),
|
|
428
|
+
);
|
|
429
|
+
|
|
430
|
+
tokens
|
|
431
|
+
.command("get-usage-record-v2 <id>")
|
|
432
|
+
.description("Get a V2 usage record")
|
|
433
|
+
.action((id) => out(true, getUsageRecordV2(id)));
|
|
434
|
+
|
|
435
|
+
tokens
|
|
436
|
+
.command("list-usage-records-v2")
|
|
437
|
+
.description("List V2 usage records")
|
|
438
|
+
.option("-b, --budget <id>", "filter by budget")
|
|
439
|
+
.option("-s, --status <status>", "filter by status")
|
|
440
|
+
.action((opts) =>
|
|
441
|
+
out(
|
|
442
|
+
true,
|
|
443
|
+
listUsageRecordsV2({ budgetId: opts.budget, status: opts.status }),
|
|
444
|
+
),
|
|
445
|
+
);
|
|
446
|
+
|
|
447
|
+
tokens
|
|
448
|
+
.command("set-usage-record-status-v2 <id> <next>")
|
|
449
|
+
.description("Set V2 usage record status")
|
|
450
|
+
.action((id, next) =>
|
|
451
|
+
tryRun(() => out(true, setUsageRecordStatusV2(id, next))),
|
|
452
|
+
);
|
|
453
|
+
|
|
454
|
+
tokens
|
|
455
|
+
.command("record-usage-v2 <id>")
|
|
456
|
+
.description("Mark V2 usage record recorded")
|
|
457
|
+
.action((id) => tryRun(() => out(true, recordUsageV2(id))));
|
|
458
|
+
|
|
459
|
+
tokens
|
|
460
|
+
.command("bill-usage-v2 <id>")
|
|
461
|
+
.description("Bill V2 usage record")
|
|
462
|
+
.action((id) => tryRun(() => out(true, billUsageV2(id))));
|
|
463
|
+
|
|
464
|
+
tokens
|
|
465
|
+
.command("reject-usage-v2 <id>")
|
|
466
|
+
.description("Reject V2 usage record")
|
|
467
|
+
.action((id) => tryRun(() => out(true, rejectUsageV2(id))));
|
|
468
|
+
|
|
469
|
+
tokens
|
|
470
|
+
.command("refund-usage-v2 <id>")
|
|
471
|
+
.description("Refund V2 usage record")
|
|
472
|
+
.action((id) => tryRun(() => out(true, refundUsageV2(id))));
|
|
473
|
+
|
|
474
|
+
tokens
|
|
475
|
+
.command("auto-suspend-idle-budgets-v2")
|
|
476
|
+
.description("Auto-suspend idle V2 budgets")
|
|
477
|
+
.action(() => out(true, autoSuspendIdleBudgetsV2()));
|
|
478
|
+
|
|
479
|
+
tokens
|
|
480
|
+
.command("auto-reject-stale-records-v2")
|
|
481
|
+
.description("Auto-reject stale V2 records")
|
|
482
|
+
.action(() => out(true, autoRejectStaleRecordsV2()));
|
|
214
483
|
}
|