@cargo-ai/cli 1.0.1
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 +114 -0
- package/build/api.d.ts +4 -0
- package/build/api.d.ts.map +1 -0
- package/build/api.js +10 -0
- package/build/commands/ai/agent.d.ts +4 -0
- package/build/commands/ai/agent.d.ts.map +1 -0
- package/build/commands/ai/agent.js +83 -0
- package/build/commands/ai/chat.d.ts +4 -0
- package/build/commands/ai/chat.d.ts.map +1 -0
- package/build/commands/ai/chat.js +71 -0
- package/build/commands/ai/document.d.ts +4 -0
- package/build/commands/ai/document.d.ts.map +1 -0
- package/build/commands/ai/document.js +59 -0
- package/build/commands/ai/file.d.ts +4 -0
- package/build/commands/ai/file.d.ts.map +1 -0
- package/build/commands/ai/file.js +74 -0
- package/build/commands/ai/index.d.ts +4 -0
- package/build/commands/ai/index.d.ts.map +1 -0
- package/build/commands/ai/index.js +33 -0
- package/build/commands/ai/mcpClient.d.ts +4 -0
- package/build/commands/ai/mcpClient.d.ts.map +1 -0
- package/build/commands/ai/mcpClient.js +31 -0
- package/build/commands/ai/mcpServer.d.ts +4 -0
- package/build/commands/ai/mcpServer.d.ts.map +1 -0
- package/build/commands/ai/mcpServer.js +62 -0
- package/build/commands/ai/memory.d.ts +4 -0
- package/build/commands/ai/memory.d.ts.map +1 -0
- package/build/commands/ai/memory.js +50 -0
- package/build/commands/ai/message.d.ts +4 -0
- package/build/commands/ai/message.d.ts.map +1 -0
- package/build/commands/ai/message.js +86 -0
- package/build/commands/ai/prompt.d.ts +4 -0
- package/build/commands/ai/prompt.d.ts.map +1 -0
- package/build/commands/ai/prompt.js +34 -0
- package/build/commands/ai/release.d.ts +4 -0
- package/build/commands/ai/release.d.ts.map +1 -0
- package/build/commands/ai/release.js +150 -0
- package/build/commands/ai/skill.d.ts +4 -0
- package/build/commands/ai/skill.d.ts.map +1 -0
- package/build/commands/ai/skill.js +96 -0
- package/build/commands/ai/suggestedAction.d.ts +4 -0
- package/build/commands/ai/suggestedAction.d.ts.map +1 -0
- package/build/commands/ai/suggestedAction.js +37 -0
- package/build/commands/ai/template.d.ts +4 -0
- package/build/commands/ai/template.d.ts.map +1 -0
- package/build/commands/ai/template.js +14 -0
- package/build/commands/ai/vote.d.ts +4 -0
- package/build/commands/ai/vote.d.ts.map +1 -0
- package/build/commands/ai/vote.js +28 -0
- package/build/commands/auth.d.ts +3 -0
- package/build/commands/auth.d.ts.map +1 -0
- package/build/commands/auth.js +73 -0
- package/build/commands/billing/index.d.ts +4 -0
- package/build/commands/billing/index.d.ts.map +1 -0
- package/build/commands/billing/index.js +9 -0
- package/build/commands/billing/subscription.d.ts +4 -0
- package/build/commands/billing/subscription.d.ts.map +1 -0
- package/build/commands/billing/subscription.js +119 -0
- package/build/commands/billing/usage.d.ts +4 -0
- package/build/commands/billing/usage.d.ts.map +1 -0
- package/build/commands/billing/usage.js +33 -0
- package/build/commands/connection/connector.d.ts +4 -0
- package/build/commands/connection/connector.d.ts.map +1 -0
- package/build/commands/connection/connector.js +129 -0
- package/build/commands/connection/index.d.ts +4 -0
- package/build/commands/connection/index.d.ts.map +1 -0
- package/build/commands/connection/index.js +11 -0
- package/build/commands/connection/integration.d.ts +4 -0
- package/build/commands/connection/integration.d.ts.map +1 -0
- package/build/commands/connection/integration.js +35 -0
- package/build/commands/connection/nativeIntegration.d.ts +4 -0
- package/build/commands/connection/nativeIntegration.d.ts.map +1 -0
- package/build/commands/connection/nativeIntegration.js +14 -0
- package/build/commands/expression/expressionEval.d.ts +4 -0
- package/build/commands/expression/expressionEval.d.ts.map +1 -0
- package/build/commands/expression/expressionEval.js +32 -0
- package/build/commands/expression/favoriteRecipe.d.ts +4 -0
- package/build/commands/expression/favoriteRecipe.d.ts.map +1 -0
- package/build/commands/expression/favoriteRecipe.js +24 -0
- package/build/commands/expression/index.d.ts +4 -0
- package/build/commands/expression/index.d.ts.map +1 -0
- package/build/commands/expression/index.js +11 -0
- package/build/commands/expression/recipe.d.ts +4 -0
- package/build/commands/expression/recipe.d.ts.map +1 -0
- package/build/commands/expression/recipe.js +98 -0
- package/build/commands/init.d.ts +4 -0
- package/build/commands/init.d.ts.map +1 -0
- package/build/commands/init.js +11 -0
- package/build/commands/orchestration/batch.d.ts +4 -0
- package/build/commands/orchestration/batch.d.ts.map +1 -0
- package/build/commands/orchestration/batch.js +106 -0
- package/build/commands/orchestration/draftRelease.d.ts +4 -0
- package/build/commands/orchestration/draftRelease.d.ts.map +1 -0
- package/build/commands/orchestration/draftRelease.js +73 -0
- package/build/commands/orchestration/index.d.ts +4 -0
- package/build/commands/orchestration/index.d.ts.map +1 -0
- package/build/commands/orchestration/index.js +25 -0
- package/build/commands/orchestration/node.d.ts +4 -0
- package/build/commands/orchestration/node.d.ts.map +1 -0
- package/build/commands/orchestration/node.js +44 -0
- package/build/commands/orchestration/play.d.ts +4 -0
- package/build/commands/orchestration/play.d.ts.map +1 -0
- package/build/commands/orchestration/play.js +63 -0
- package/build/commands/orchestration/record.d.ts +4 -0
- package/build/commands/orchestration/record.d.ts.map +1 -0
- package/build/commands/orchestration/record.js +194 -0
- package/build/commands/orchestration/release.d.ts +4 -0
- package/build/commands/orchestration/release.d.ts.map +1 -0
- package/build/commands/orchestration/release.js +27 -0
- package/build/commands/orchestration/run.d.ts +4 -0
- package/build/commands/orchestration/run.d.ts.map +1 -0
- package/build/commands/orchestration/run.js +196 -0
- package/build/commands/orchestration/template.d.ts +4 -0
- package/build/commands/orchestration/template.d.ts.map +1 -0
- package/build/commands/orchestration/template.js +22 -0
- package/build/commands/orchestration/tool.d.ts +4 -0
- package/build/commands/orchestration/tool.d.ts.map +1 -0
- package/build/commands/orchestration/tool.js +72 -0
- package/build/commands/orchestration/workflow.d.ts +4 -0
- package/build/commands/orchestration/workflow.d.ts.map +1 -0
- package/build/commands/orchestration/workflow.js +14 -0
- package/build/commands/revenueOrganization/allocation.d.ts +4 -0
- package/build/commands/revenueOrganization/allocation.d.ts.map +1 -0
- package/build/commands/revenueOrganization/allocation.js +45 -0
- package/build/commands/revenueOrganization/capacity.d.ts +4 -0
- package/build/commands/revenueOrganization/capacity.d.ts.map +1 -0
- package/build/commands/revenueOrganization/capacity.js +94 -0
- package/build/commands/revenueOrganization/index.d.ts +4 -0
- package/build/commands/revenueOrganization/index.d.ts.map +1 -0
- package/build/commands/revenueOrganization/index.js +13 -0
- package/build/commands/revenueOrganization/member.d.ts +4 -0
- package/build/commands/revenueOrganization/member.d.ts.map +1 -0
- package/build/commands/revenueOrganization/member.js +62 -0
- package/build/commands/revenueOrganization/territory.d.ts +4 -0
- package/build/commands/revenueOrganization/territory.d.ts.map +1 -0
- package/build/commands/revenueOrganization/territory.js +72 -0
- package/build/commands/runHandler.d.ts +4 -0
- package/build/commands/runHandler.d.ts.map +1 -0
- package/build/commands/runHandler.js +33 -0
- package/build/commands/segmentation/change.d.ts +4 -0
- package/build/commands/segmentation/change.d.ts.map +1 -0
- package/build/commands/segmentation/change.js +61 -0
- package/build/commands/segmentation/index.d.ts +4 -0
- package/build/commands/segmentation/index.d.ts.map +1 -0
- package/build/commands/segmentation/index.js +11 -0
- package/build/commands/segmentation/record.d.ts +4 -0
- package/build/commands/segmentation/record.d.ts.map +1 -0
- package/build/commands/segmentation/record.js +21 -0
- package/build/commands/segmentation/segment.d.ts +4 -0
- package/build/commands/segmentation/segment.d.ts.map +1 -0
- package/build/commands/segmentation/segment.js +130 -0
- package/build/commands/storage/column.d.ts +4 -0
- package/build/commands/storage/column.d.ts.map +1 -0
- package/build/commands/storage/column.js +84 -0
- package/build/commands/storage/dataset.d.ts +4 -0
- package/build/commands/storage/dataset.d.ts.map +1 -0
- package/build/commands/storage/dataset.js +20 -0
- package/build/commands/storage/index.d.ts +4 -0
- package/build/commands/storage/index.d.ts.map +1 -0
- package/build/commands/storage/index.js +17 -0
- package/build/commands/storage/model.d.ts +4 -0
- package/build/commands/storage/model.d.ts.map +1 -0
- package/build/commands/storage/model.js +141 -0
- package/build/commands/storage/record.d.ts +4 -0
- package/build/commands/storage/record.d.ts.map +1 -0
- package/build/commands/storage/record.js +15 -0
- package/build/commands/storage/relationship.d.ts +4 -0
- package/build/commands/storage/relationship.d.ts.map +1 -0
- package/build/commands/storage/relationship.js +27 -0
- package/build/commands/storage/run.d.ts +4 -0
- package/build/commands/storage/run.d.ts.map +1 -0
- package/build/commands/storage/run.js +42 -0
- package/build/commands/systemOfRecordIntegration/client.d.ts +4 -0
- package/build/commands/systemOfRecordIntegration/client.d.ts.map +1 -0
- package/build/commands/systemOfRecordIntegration/client.js +46 -0
- package/build/commands/systemOfRecordIntegration/index.d.ts +4 -0
- package/build/commands/systemOfRecordIntegration/index.d.ts.map +1 -0
- package/build/commands/systemOfRecordIntegration/index.js +11 -0
- package/build/commands/systemOfRecordIntegration/log.d.ts +4 -0
- package/build/commands/systemOfRecordIntegration/log.d.ts.map +1 -0
- package/build/commands/systemOfRecordIntegration/log.js +36 -0
- package/build/commands/systemOfRecordIntegration/systemOfRecord.d.ts +4 -0
- package/build/commands/systemOfRecordIntegration/systemOfRecord.d.ts.map +1 -0
- package/build/commands/systemOfRecordIntegration/systemOfRecord.js +72 -0
- package/build/commands/userManagement/index.d.ts +4 -0
- package/build/commands/userManagement/index.d.ts.map +1 -0
- package/build/commands/userManagement/index.js +32 -0
- package/build/commands/workspace/file.d.ts +4 -0
- package/build/commands/workspace/file.d.ts.map +1 -0
- package/build/commands/workspace/file.js +44 -0
- package/build/commands/workspace/folder.d.ts +4 -0
- package/build/commands/workspace/folder.d.ts.map +1 -0
- package/build/commands/workspace/folder.js +64 -0
- package/build/commands/workspace/index.d.ts +4 -0
- package/build/commands/workspace/index.d.ts.map +1 -0
- package/build/commands/workspace/index.js +17 -0
- package/build/commands/workspace/role.d.ts +4 -0
- package/build/commands/workspace/role.d.ts.map +1 -0
- package/build/commands/workspace/role.js +12 -0
- package/build/commands/workspace/token.d.ts +4 -0
- package/build/commands/workspace/token.d.ts.map +1 -0
- package/build/commands/workspace/token.js +31 -0
- package/build/commands/workspace/user.d.ts +4 -0
- package/build/commands/workspace/user.d.ts.map +1 -0
- package/build/commands/workspace/user.js +105 -0
- package/build/commands/workspace/workspaces.d.ts +4 -0
- package/build/commands/workspace/workspaces.d.ts.map +1 -0
- package/build/commands/workspace/workspaces.js +74 -0
- package/build/config.d.ts +7 -0
- package/build/config.d.ts.map +1 -0
- package/build/config.js +45 -0
- package/build/credentials.d.ts +10 -0
- package/build/credentials.d.ts.map +1 -0
- package/build/credentials.js +31 -0
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +37 -0
- package/package.json +44 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { clearCredentials, getCredentialsPath, loadCredentials, saveCredentials, } from "../credentials.js";
|
|
2
|
+
import { outputJson } from "./runHandler.js";
|
|
3
|
+
const DEFAULT_BASE_URL = "https://api.getcargo.io";
|
|
4
|
+
export function registerAuthCommands(program) {
|
|
5
|
+
program
|
|
6
|
+
.command("login")
|
|
7
|
+
.description("Save API credentials for future use")
|
|
8
|
+
.requiredOption("--token <token>", "Cargo API token")
|
|
9
|
+
.option("--workspace-uuid <uuid>", "Default workspace UUID")
|
|
10
|
+
.option("--base-url <url>", `API base URL (default: ${DEFAULT_BASE_URL})`)
|
|
11
|
+
.action((opts) => {
|
|
12
|
+
saveCredentials({
|
|
13
|
+
accessToken: opts.token,
|
|
14
|
+
workspaceUuid: opts.workspaceUuid,
|
|
15
|
+
baseUrl: opts.baseUrl,
|
|
16
|
+
});
|
|
17
|
+
outputJson({
|
|
18
|
+
ok: true,
|
|
19
|
+
credentialsFile: getCredentialsPath(),
|
|
20
|
+
baseUrl: opts.baseUrl !== undefined ? opts.baseUrl : DEFAULT_BASE_URL,
|
|
21
|
+
workspaceUuid: opts.workspaceUuid !== undefined ? opts.workspaceUuid : null,
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
program
|
|
25
|
+
.command("logout")
|
|
26
|
+
.description("Remove saved API credentials")
|
|
27
|
+
.action(() => {
|
|
28
|
+
const removed = clearCredentials();
|
|
29
|
+
outputJson({
|
|
30
|
+
ok: true,
|
|
31
|
+
removed,
|
|
32
|
+
credentialsFile: getCredentialsPath(),
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
program
|
|
36
|
+
.command("whoami")
|
|
37
|
+
.description("Show current authentication configuration")
|
|
38
|
+
.action(() => {
|
|
39
|
+
const envToken = process.env["CARGO_API_TOKEN"];
|
|
40
|
+
const envBaseUrl = process.env["CARGO_BASE_URL"];
|
|
41
|
+
const envWorkspace = process.env["CARGO_WORKSPACE_UUID"];
|
|
42
|
+
const creds = loadCredentials();
|
|
43
|
+
const token = envToken !== undefined
|
|
44
|
+
? envToken
|
|
45
|
+
: creds !== undefined
|
|
46
|
+
? creds.accessToken
|
|
47
|
+
: undefined;
|
|
48
|
+
const baseUrl = envBaseUrl !== undefined
|
|
49
|
+
? envBaseUrl
|
|
50
|
+
: creds !== undefined && creds.baseUrl !== undefined
|
|
51
|
+
? creds.baseUrl
|
|
52
|
+
: DEFAULT_BASE_URL;
|
|
53
|
+
const workspaceUuid = envWorkspace !== undefined
|
|
54
|
+
? envWorkspace
|
|
55
|
+
: creds !== undefined
|
|
56
|
+
? creds.workspaceUuid
|
|
57
|
+
: undefined;
|
|
58
|
+
outputJson({
|
|
59
|
+
authenticated: token !== undefined,
|
|
60
|
+
source: envToken !== undefined
|
|
61
|
+
? "environment"
|
|
62
|
+
: creds !== undefined
|
|
63
|
+
? "credentials-file"
|
|
64
|
+
: "none",
|
|
65
|
+
baseUrl,
|
|
66
|
+
workspaceUuid: workspaceUuid !== undefined ? workspaceUuid : null,
|
|
67
|
+
credentialsFile: getCredentialsPath(),
|
|
68
|
+
tokenPreview: token !== undefined
|
|
69
|
+
? `${token.slice(0, 8)}...${token.slice(-4)}`
|
|
70
|
+
: null,
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/billing/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAIxC,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAON"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { registerSubscriptionCommands } from "./subscription.js";
|
|
2
|
+
import { registerUsageCommands } from "./usage.js";
|
|
3
|
+
export function registerBillingCommands(parent, getApi) {
|
|
4
|
+
const billing = parent
|
|
5
|
+
.command("billing")
|
|
6
|
+
.description("Usage and subscription");
|
|
7
|
+
registerUsageCommands(billing, getApi);
|
|
8
|
+
registerSubscriptionCommands(billing, getApi);
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../../src/commands/billing/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAkKN"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { handleApiCall, outputJson } from "../runHandler.js";
|
|
2
|
+
export function registerSubscriptionCommands(parent, getApi) {
|
|
3
|
+
const subscription = parent
|
|
4
|
+
.command("subscription")
|
|
5
|
+
.description("Subscription operations");
|
|
6
|
+
subscription
|
|
7
|
+
.command("get")
|
|
8
|
+
.description("Get current subscription")
|
|
9
|
+
.action(async () => {
|
|
10
|
+
const api = getApi();
|
|
11
|
+
const result = await handleApiCall(() => api.billing.subscription.get());
|
|
12
|
+
outputJson(result);
|
|
13
|
+
});
|
|
14
|
+
subscription
|
|
15
|
+
.command("get-invoices")
|
|
16
|
+
.description("Get invoices")
|
|
17
|
+
.action(async () => {
|
|
18
|
+
const api = getApi();
|
|
19
|
+
const result = await handleApiCall(() => api.billing.subscription.getInvoices());
|
|
20
|
+
outputJson(result);
|
|
21
|
+
});
|
|
22
|
+
subscription
|
|
23
|
+
.command("get-credit-card")
|
|
24
|
+
.description("Get credit card")
|
|
25
|
+
.action(async () => {
|
|
26
|
+
const api = getApi();
|
|
27
|
+
const result = await handleApiCall(() => api.billing.subscription.getCreditCard());
|
|
28
|
+
outputJson(result);
|
|
29
|
+
});
|
|
30
|
+
subscription
|
|
31
|
+
.command("create-setup-intent")
|
|
32
|
+
.description("Create a setup intent")
|
|
33
|
+
.action(async () => {
|
|
34
|
+
const api = getApi();
|
|
35
|
+
const result = await handleApiCall(() => api.billing.subscription.createSetupIntent());
|
|
36
|
+
outputJson(result);
|
|
37
|
+
});
|
|
38
|
+
subscription
|
|
39
|
+
.command("update-payment-method")
|
|
40
|
+
.description("Update payment method")
|
|
41
|
+
.requiredOption("--payment-method-id <id>", "Stripe payment method ID")
|
|
42
|
+
.action(async (opts) => {
|
|
43
|
+
const api = getApi();
|
|
44
|
+
const result = await handleApiCall(() => api.billing.subscription.updatePaymentMethod({
|
|
45
|
+
paymentMethodId: opts.paymentMethodId,
|
|
46
|
+
}));
|
|
47
|
+
outputJson(result);
|
|
48
|
+
});
|
|
49
|
+
subscription
|
|
50
|
+
.command("create-portal-session")
|
|
51
|
+
.description("Create a portal session")
|
|
52
|
+
.action(async () => {
|
|
53
|
+
const api = getApi();
|
|
54
|
+
const result = await handleApiCall(() => api.billing.subscription.createPortalSession());
|
|
55
|
+
outputJson(result);
|
|
56
|
+
});
|
|
57
|
+
subscription
|
|
58
|
+
.command("create-stripe-credits-checkout-session")
|
|
59
|
+
.description("Create a Stripe credits checkout session")
|
|
60
|
+
.action(async () => {
|
|
61
|
+
const api = getApi();
|
|
62
|
+
const result = await handleApiCall(() => api.billing.subscription.createStripeCreditsCheckoutSession());
|
|
63
|
+
outputJson(result);
|
|
64
|
+
});
|
|
65
|
+
subscription
|
|
66
|
+
.command("update-plan")
|
|
67
|
+
.description("Update subscription plan")
|
|
68
|
+
.requiredOption("--credits-count <n>", "Number of credits")
|
|
69
|
+
.requiredOption("--cadence <cadence>", "Subscription cadence")
|
|
70
|
+
.action(async (opts) => {
|
|
71
|
+
const api = getApi();
|
|
72
|
+
const result = await handleApiCall(() => api.billing.subscription.updatePlan({
|
|
73
|
+
creditsCount: parseInt(opts.creditsCount, 10),
|
|
74
|
+
cadence: opts.cadence,
|
|
75
|
+
}));
|
|
76
|
+
outputJson(result);
|
|
77
|
+
});
|
|
78
|
+
subscription
|
|
79
|
+
.command("update-topup")
|
|
80
|
+
.description("Update topup settings")
|
|
81
|
+
.option("--enabled", "Enable topup")
|
|
82
|
+
.requiredOption("--credits-count <n>", "Number of credits")
|
|
83
|
+
.requiredOption("--threshold <n>", "Threshold")
|
|
84
|
+
.action(async (opts) => {
|
|
85
|
+
const api = getApi();
|
|
86
|
+
const result = await handleApiCall(() => api.billing.subscription.updateTopup({
|
|
87
|
+
enabled: opts.enabled === true,
|
|
88
|
+
creditsCount: parseInt(opts.creditsCount, 10),
|
|
89
|
+
threshold: parseInt(opts.threshold, 10),
|
|
90
|
+
}));
|
|
91
|
+
outputJson(result);
|
|
92
|
+
});
|
|
93
|
+
subscription
|
|
94
|
+
.command("update-credits-overage-behaviors")
|
|
95
|
+
.description("Update credits overage behaviors")
|
|
96
|
+
.requiredOption("--behavior <unit:action>", "Behavior as unit:action (e.g. billing.credits:deny), repeatable", (val, acc) => {
|
|
97
|
+
acc.push(val);
|
|
98
|
+
return acc;
|
|
99
|
+
}, [])
|
|
100
|
+
.action(async (opts) => {
|
|
101
|
+
const creditsOverageBehaviors = opts.behavior.map((b) => {
|
|
102
|
+
const parts = b.split(":");
|
|
103
|
+
if (parts.length < 2) {
|
|
104
|
+
throw new Error(`Invalid behavior format "${b}", expected unit:action (e.g. billing.credits:deny)`);
|
|
105
|
+
}
|
|
106
|
+
const unit = parts[0];
|
|
107
|
+
const action = parts[1];
|
|
108
|
+
return {
|
|
109
|
+
unit: unit,
|
|
110
|
+
action: action,
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
const api = getApi();
|
|
114
|
+
const result = await handleApiCall(() => api.billing.subscription.updateCreditsOverageBehaviors({
|
|
115
|
+
creditsOverageBehaviors,
|
|
116
|
+
}));
|
|
117
|
+
outputJson(result);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/commands/billing/usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAmDN"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { handleApiCall, outputJson } from "../runHandler.js";
|
|
2
|
+
export function registerUsageCommands(parent, getApi) {
|
|
3
|
+
const usage = parent.command("usage").description("Usage metrics");
|
|
4
|
+
usage
|
|
5
|
+
.command("get-metrics")
|
|
6
|
+
.description("Get usage metrics")
|
|
7
|
+
.requiredOption("--from <date>", "Start date")
|
|
8
|
+
.requiredOption("--to <date>", "End date")
|
|
9
|
+
.option("--workflow-uuid <uuid>", "Workflow UUID")
|
|
10
|
+
.option("--model-uuid <uuid>", "Model UUID")
|
|
11
|
+
.option("--connector-uuid <uuid>", "Connector UUID")
|
|
12
|
+
.option("--integration-slug <slug>", "Integration slug")
|
|
13
|
+
.option("--slug <slug>", "Slug")
|
|
14
|
+
.option("--agent-uuid <uuid>", "Agent UUID")
|
|
15
|
+
.option("--group-by <value>", "Group by field")
|
|
16
|
+
.option("--unit <unit>", "Usage unit")
|
|
17
|
+
.action(async (opts) => {
|
|
18
|
+
const api = getApi();
|
|
19
|
+
const result = await handleApiCall(() => api.billing.usage.getMetrics({
|
|
20
|
+
from: opts.from,
|
|
21
|
+
to: opts.to,
|
|
22
|
+
workflowUuid: opts.workflowUuid,
|
|
23
|
+
modelUuid: opts.modelUuid,
|
|
24
|
+
connectorUuid: opts.connectorUuid,
|
|
25
|
+
integrationSlug: opts.integrationSlug,
|
|
26
|
+
slug: opts.slug,
|
|
27
|
+
agentUuid: opts.agentUuid,
|
|
28
|
+
groupBy: opts.groupBy,
|
|
29
|
+
unit: opts.unit,
|
|
30
|
+
}));
|
|
31
|
+
outputJson(result);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../../src/commands/connection/connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CA+LN"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
|
|
2
|
+
export function registerConnectorCommands(parent, getApi) {
|
|
3
|
+
const connector = parent
|
|
4
|
+
.command("connector")
|
|
5
|
+
.description("Connector operations");
|
|
6
|
+
connector
|
|
7
|
+
.command("list")
|
|
8
|
+
.description("List all connectors")
|
|
9
|
+
.action(async () => {
|
|
10
|
+
const api = getApi();
|
|
11
|
+
const result = await handleApiCall(() => api.connection.connector.all());
|
|
12
|
+
outputJson(result);
|
|
13
|
+
});
|
|
14
|
+
connector
|
|
15
|
+
.command("remove <uuid>")
|
|
16
|
+
.description("Remove a connector")
|
|
17
|
+
.action(async (uuid) => {
|
|
18
|
+
const api = getApi();
|
|
19
|
+
await handleApiCall(() => api.connection.connector.remove(uuid));
|
|
20
|
+
outputJson({ ok: true });
|
|
21
|
+
});
|
|
22
|
+
connector
|
|
23
|
+
.command("get-language-models <connectorUuid>")
|
|
24
|
+
.description("Get language models for a connector")
|
|
25
|
+
.action(async (connectorUuid) => {
|
|
26
|
+
const api = getApi();
|
|
27
|
+
const result = await handleApiCall(() => api.connection.connector.getLanguageModels({ connectorUuid }));
|
|
28
|
+
outputJson(result);
|
|
29
|
+
});
|
|
30
|
+
connector
|
|
31
|
+
.command("autocomplete")
|
|
32
|
+
.description("Autocomplete connector values")
|
|
33
|
+
.requiredOption("--connector-uuid <uuid>", "Connector UUID")
|
|
34
|
+
.requiredOption("--slug <slug>", "Slug")
|
|
35
|
+
.requiredOption("--params <json>", "Params (JSON object)")
|
|
36
|
+
.option("--value <value>", "Search value")
|
|
37
|
+
.option("--refresh", "Refresh cached results")
|
|
38
|
+
.option("--variables <json>", 'Variables (JSON object, e.g. {"key":"value"})')
|
|
39
|
+
.action(async (opts) => {
|
|
40
|
+
const api = getApi();
|
|
41
|
+
const result = await handleApiCall(() => api.connection.connector.autocomplete({
|
|
42
|
+
connectorUuid: opts.connectorUuid,
|
|
43
|
+
slug: opts.slug,
|
|
44
|
+
params: parseJson(opts.params, "--params"),
|
|
45
|
+
value: opts.value,
|
|
46
|
+
refresh: opts.refresh,
|
|
47
|
+
variables: opts.variables !== undefined
|
|
48
|
+
? parseJson(opts.variables, "--variables")
|
|
49
|
+
: undefined,
|
|
50
|
+
}));
|
|
51
|
+
outputJson(result);
|
|
52
|
+
});
|
|
53
|
+
connector
|
|
54
|
+
.command("get-dynamic-schema")
|
|
55
|
+
.description("Get dynamic schema for a connector")
|
|
56
|
+
.requiredOption("--connector-uuid <uuid>", "Connector UUID")
|
|
57
|
+
.requiredOption("--slug <slug>", "Slug")
|
|
58
|
+
.requiredOption("--params <json>", "Params (JSON object)")
|
|
59
|
+
.action(async (opts) => {
|
|
60
|
+
const api = getApi();
|
|
61
|
+
const result = await handleApiCall(() => api.connection.connector.getDynamicSchema({
|
|
62
|
+
connectorUuid: opts.connectorUuid,
|
|
63
|
+
slug: opts.slug,
|
|
64
|
+
params: parseJson(opts.params, "--params"),
|
|
65
|
+
}));
|
|
66
|
+
outputJson(result);
|
|
67
|
+
});
|
|
68
|
+
connector
|
|
69
|
+
.command("create")
|
|
70
|
+
.description("Create a connector")
|
|
71
|
+
.requiredOption("--name <name>", "Connector name")
|
|
72
|
+
.requiredOption("--slug <slug>", "Connector slug")
|
|
73
|
+
.requiredOption("--integration-slug <slug>", "Integration slug")
|
|
74
|
+
.option("--config <json>", "Configuration (JSON object)")
|
|
75
|
+
.option("--rate-limit <json>", 'Rate limit (JSON, e.g. {"maxRequests":100,"windowMs":60000})')
|
|
76
|
+
.option("--cache-ttl-milliseconds <n>", "Cache TTL in milliseconds")
|
|
77
|
+
.action(async (opts) => {
|
|
78
|
+
const api = getApi();
|
|
79
|
+
const result = await handleApiCall(() => api.connection.connector.create({
|
|
80
|
+
name: opts.name,
|
|
81
|
+
slug: opts.slug,
|
|
82
|
+
integrationSlug: opts.integrationSlug,
|
|
83
|
+
config: opts.config !== undefined
|
|
84
|
+
? parseJson(opts.config, "--config")
|
|
85
|
+
: undefined,
|
|
86
|
+
rateLimit: opts.rateLimit !== undefined
|
|
87
|
+
? parseJson(opts.rateLimit, "--rate-limit")
|
|
88
|
+
: undefined,
|
|
89
|
+
cacheTtlMilliseconds: opts.cacheTtlMilliseconds !== undefined
|
|
90
|
+
? parseInt(opts.cacheTtlMilliseconds, 10)
|
|
91
|
+
: undefined,
|
|
92
|
+
}));
|
|
93
|
+
outputJson(result);
|
|
94
|
+
});
|
|
95
|
+
connector
|
|
96
|
+
.command("update")
|
|
97
|
+
.description("Update a connector")
|
|
98
|
+
.requiredOption("--uuid <uuid>", "Connector UUID")
|
|
99
|
+
.option("--name <name>", "Connector name")
|
|
100
|
+
.option("--config <json>", "Configuration (JSON object)")
|
|
101
|
+
.option("--rate-limit <json>", 'Rate limit (JSON, e.g. {"maxRequests":100,"windowMs":60000})')
|
|
102
|
+
.option("--cache-ttl-milliseconds <n>", "Cache TTL in milliseconds")
|
|
103
|
+
.action(async (opts) => {
|
|
104
|
+
const api = getApi();
|
|
105
|
+
const result = await handleApiCall(() => api.connection.connector.update({
|
|
106
|
+
uuid: opts.uuid,
|
|
107
|
+
name: opts.name,
|
|
108
|
+
config: opts.config !== undefined
|
|
109
|
+
? parseJson(opts.config, "--config")
|
|
110
|
+
: undefined,
|
|
111
|
+
rateLimit: opts.rateLimit !== undefined
|
|
112
|
+
? parseJson(opts.rateLimit, "--rate-limit")
|
|
113
|
+
: undefined,
|
|
114
|
+
cacheTtlMilliseconds: opts.cacheTtlMilliseconds !== undefined
|
|
115
|
+
? parseInt(opts.cacheTtlMilliseconds, 10)
|
|
116
|
+
: undefined,
|
|
117
|
+
}));
|
|
118
|
+
outputJson(result);
|
|
119
|
+
});
|
|
120
|
+
connector
|
|
121
|
+
.command("exists-by-slug")
|
|
122
|
+
.description("Check if a connector exists by slug")
|
|
123
|
+
.requiredOption("--slug <slug>", "Connector slug")
|
|
124
|
+
.action(async (opts) => {
|
|
125
|
+
const api = getApi();
|
|
126
|
+
const result = await handleApiCall(() => api.connection.connector.existsBySlug({ slug: opts.slug }));
|
|
127
|
+
outputJson(result);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/connection/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAKxC,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAQN"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { registerConnectorCommands } from "./connector.js";
|
|
2
|
+
import { registerIntegrationCommands } from "./integration.js";
|
|
3
|
+
import { registerNativeIntegrationCommands } from "./nativeIntegration.js";
|
|
4
|
+
export function registerConnectionCommands(parent, getApi) {
|
|
5
|
+
const connection = parent
|
|
6
|
+
.command("connection")
|
|
7
|
+
.description("Connectors and integrations");
|
|
8
|
+
registerConnectorCommands(connection, getApi);
|
|
9
|
+
registerIntegrationCommands(connection, getApi);
|
|
10
|
+
registerNativeIntegrationCommands(connection, getApi);
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../src/commands/connection/integration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CA0CN"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
|
|
2
|
+
export function registerIntegrationCommands(parent, getApi) {
|
|
3
|
+
const integration = parent
|
|
4
|
+
.command("integration")
|
|
5
|
+
.description("Integration operations");
|
|
6
|
+
integration
|
|
7
|
+
.command("list")
|
|
8
|
+
.description("List all integrations")
|
|
9
|
+
.action(async () => {
|
|
10
|
+
const api = getApi();
|
|
11
|
+
const result = await handleApiCall(() => api.connection.integration.all());
|
|
12
|
+
outputJson(result);
|
|
13
|
+
});
|
|
14
|
+
integration
|
|
15
|
+
.command("get-documentation <slug>")
|
|
16
|
+
.description("Get integration documentation by slug")
|
|
17
|
+
.action(async (slug) => {
|
|
18
|
+
const api = getApi();
|
|
19
|
+
const result = await handleApiCall(() => api.connection.integration.getDocumentation(slug));
|
|
20
|
+
outputJson(result);
|
|
21
|
+
});
|
|
22
|
+
integration
|
|
23
|
+
.command("complete-oauth")
|
|
24
|
+
.description("Complete OAuth for an integration")
|
|
25
|
+
.requiredOption("--slug <slug>", "Integration slug")
|
|
26
|
+
.requiredOption("--params <json>", "OAuth params (JSON object)")
|
|
27
|
+
.action(async (opts) => {
|
|
28
|
+
const api = getApi();
|
|
29
|
+
const result = await handleApiCall(() => api.connection.integration.completeOauth({
|
|
30
|
+
slug: opts.slug,
|
|
31
|
+
params: parseJson(opts.params, "--params"),
|
|
32
|
+
}));
|
|
33
|
+
outputJson(result);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeIntegration.d.ts","sourceRoot":"","sources":["../../../src/commands/connection/nativeIntegration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAeN"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { handleApiCall, outputJson } from "../runHandler.js";
|
|
2
|
+
export function registerNativeIntegrationCommands(parent, getApi) {
|
|
3
|
+
const nativeIntegration = parent
|
|
4
|
+
.command("native-integration")
|
|
5
|
+
.description("Native integration");
|
|
6
|
+
nativeIntegration
|
|
7
|
+
.command("get")
|
|
8
|
+
.description("Get native integration")
|
|
9
|
+
.action(async () => {
|
|
10
|
+
const api = getApi();
|
|
11
|
+
const result = await handleApiCall(() => api.connection.nativeIntegration.get());
|
|
12
|
+
outputJson(result);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expressionEval.d.ts","sourceRoot":"","sources":["../../../src/commands/expression/expressionEval.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CA6CN"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
|
|
2
|
+
export function registerExpressionEvalCommands(parent, getApi) {
|
|
3
|
+
const expr = parent
|
|
4
|
+
.command("eval")
|
|
5
|
+
.description("Expression evaluate and generate");
|
|
6
|
+
expr
|
|
7
|
+
.command("evaluate")
|
|
8
|
+
.description("Evaluate an expression")
|
|
9
|
+
.requiredOption("--expression <json>", "Expression definition (JSON object)")
|
|
10
|
+
.requiredOption("--variables <json>", 'Variables (JSON object, e.g. {"key":"value"})')
|
|
11
|
+
.action(async (opts) => {
|
|
12
|
+
const api = getApi();
|
|
13
|
+
const result = await handleApiCall(() => api.expression.expression.evaluate({
|
|
14
|
+
expression: parseJson(opts.expression, "--expression"),
|
|
15
|
+
variables: parseJson(opts.variables, "--variables"),
|
|
16
|
+
}));
|
|
17
|
+
outputJson(result);
|
|
18
|
+
});
|
|
19
|
+
expr
|
|
20
|
+
.command("generate")
|
|
21
|
+
.description("Generate an expression")
|
|
22
|
+
.requiredOption("--prompt <text>", "Prompt")
|
|
23
|
+
.requiredOption("--variables <json>", 'Variables (JSON object, e.g. {"key":"value"})')
|
|
24
|
+
.action(async (opts) => {
|
|
25
|
+
const api = getApi();
|
|
26
|
+
const result = await handleApiCall(() => api.expression.expression.generate({
|
|
27
|
+
prompt: opts.prompt,
|
|
28
|
+
variables: parseJson(opts.variables, "--variables"),
|
|
29
|
+
}));
|
|
30
|
+
outputJson(result);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"favoriteRecipe.d.ts","sourceRoot":"","sources":["../../../src/commands/expression/favoriteRecipe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CA4BN"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { handleApiCall, outputJson } from "../runHandler.js";
|
|
2
|
+
export function registerFavoriteRecipeCommands(parent, getApi) {
|
|
3
|
+
const favoriteRecipe = parent
|
|
4
|
+
.command("favorite-recipe")
|
|
5
|
+
.description("Favorite recipe operations");
|
|
6
|
+
favoriteRecipe
|
|
7
|
+
.command("create")
|
|
8
|
+
.description("Create a favorite recipe")
|
|
9
|
+
.requiredOption("--recipe-uuid <uuid>", "Recipe UUID")
|
|
10
|
+
.action(async (opts) => {
|
|
11
|
+
const api = getApi();
|
|
12
|
+
const result = await handleApiCall(() => api.expression.favoriteRecipe.create({ recipeUuid: opts.recipeUuid }));
|
|
13
|
+
outputJson(result);
|
|
14
|
+
});
|
|
15
|
+
favoriteRecipe
|
|
16
|
+
.command("delete")
|
|
17
|
+
.description("Delete a favorite recipe")
|
|
18
|
+
.requiredOption("--recipe-uuid <uuid>", "Recipe UUID")
|
|
19
|
+
.action(async (opts) => {
|
|
20
|
+
const api = getApi();
|
|
21
|
+
await handleApiCall(() => api.expression.favoriteRecipe.delete({ recipeUuid: opts.recipeUuid }));
|
|
22
|
+
outputJson({ ok: true });
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/expression/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAKxC,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAQN"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { registerExpressionEvalCommands } from "./expressionEval.js";
|
|
2
|
+
import { registerFavoriteRecipeCommands } from "./favoriteRecipe.js";
|
|
3
|
+
import { registerRecipeCommands } from "./recipe.js";
|
|
4
|
+
export function registerExpressionCommands(parent, getApi) {
|
|
5
|
+
const expression = parent
|
|
6
|
+
.command("expression")
|
|
7
|
+
.description("Recipes and expression evaluation");
|
|
8
|
+
registerRecipeCommands(expression, getApi);
|
|
9
|
+
registerExpressionEvalCommands(expression, getApi);
|
|
10
|
+
registerFavoriteRecipeCommands(expression, getApi);
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipe.d.ts","sourceRoot":"","sources":["../../../src/commands/expression/recipe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAwKN"}
|