@oneuptime/common 14.0.104 → 14.0.105
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/Models/DatabaseModels/CloudAccount.d.mts +1 -0
- package/Models/DatabaseModels/CloudAccount.d.ts +1 -0
- package/Models/DatabaseModels/CloudAccount.js +21 -0
- package/Models/DatabaseModels/CloudBudget.d.mts +1 -0
- package/Models/DatabaseModels/CloudBudget.d.ts +1 -0
- package/Models/DatabaseModels/CloudBudget.js +38 -3
- package/Models/DatabaseModels/CloudCostRecommendation.d.mts +2 -0
- package/Models/DatabaseModels/CloudCostRecommendation.d.ts +2 -0
- package/Models/DatabaseModels/CloudCostRecommendation.js +30 -2
- package/Models/DatabaseModels/DetectionRule.js +8 -7
- package/Types/AI/ResourceAiAccessApi.d.mts +1 -0
- package/Types/AI/ResourceAiAccessApi.d.ts +1 -0
- package/Types/AI/ResourceAiAccessApi.js +6 -1
- package/Types/AI/ResourceAiAccessApi.mjs +1 -0
- package/Types/AI/ResourceAiAccessPermissions.d.mts +2 -0
- package/Types/AI/ResourceAiAccessPermissions.d.ts +2 -0
- package/Types/AI/ResourceAiAccessPermissions.js +13 -0
- package/Types/AI/ResourceAiAccessPermissions.mjs +2 -0
- package/Types/Cloud/CloudCost.d.mts +8 -0
- package/Types/Cloud/CloudCost.d.ts +8 -0
- package/Types/Cloud/CloudCost.js +37 -0
- package/Types/Cloud/CloudCost.mjs +1 -0
- package/Types/Cloud/CloudCostAnomaly.d.mts +34 -0
- package/Types/Cloud/CloudCostAnomaly.d.ts +34 -0
- package/Types/Cloud/CloudCostAnomaly.js +236 -0
- package/Types/Cloud/CloudCostAnomaly.mjs +18 -0
- package/Types/Cloud/CloudLogGroups.d.mts +6 -1
- package/Types/Cloud/CloudLogGroups.d.ts +6 -1
- package/Types/Cloud/CloudLogGroups.js +59 -3
- package/Types/Cloud/CloudLogGroups.mjs +1 -0
- package/Types/Cloud/CloudPlatform.js +9 -8
- package/Types/Cloud/CloudRightSizing.d.mts +140 -0
- package/Types/Cloud/CloudRightSizing.d.ts +140 -0
- package/Types/Cloud/CloudRightSizing.js +867 -0
- package/Types/Cloud/CloudRightSizing.mjs +53 -0
- package/Types/CloudConnection/CloudAiAgentKey.d.mts +65 -0
- package/Types/CloudConnection/CloudAiAgentKey.d.ts +65 -0
- package/Types/CloudConnection/CloudAiAgentKey.js +289 -0
- package/Types/CloudConnection/CloudAiAgentKey.mjs +18 -0
- package/Types/CloudConnection/CloudAiAgentSetupCommands.d.mts +5 -2
- package/Types/CloudConnection/CloudAiAgentSetupCommands.d.ts +5 -2
- package/Types/CloudConnection/CloudAiAgentSetupCommands.js +114 -43
- package/Types/CloudConnection/CloudAiAgentSetupCommands.mjs +4 -1
- package/Types/CloudConnection/CloudStream.d.mts +4 -0
- package/Types/CloudConnection/CloudStream.d.ts +4 -0
- package/Types/CloudConnection/CloudStream.js +18 -1
- package/Types/CloudConnection/CloudStream.mjs +4 -0
- package/Types/CloudConnection/CloudStreamTemplate.d.mts +2 -0
- package/Types/CloudConnection/CloudStreamTemplate.d.ts +2 -0
- package/Types/CloudConnection/CloudStreamTemplate.js +89 -6
- package/Types/CloudConnection/CloudStreamTemplate.mjs +2 -0
- package/Types/InstallScripts/InstallScripts.js +1 -1
- package/Types/ResourceAiAgent/CloudAiAgentNames.d.mts +6 -0
- package/Types/ResourceAiAgent/CloudAiAgentNames.d.ts +6 -0
- package/Types/ResourceAiAgent/CloudAiAgentNames.js +11 -1
- package/Types/ResourceAiAgent/CloudAiAgentNames.mjs +3 -0
- package/Types/ResourceAiAgent/ResourceAiAccess.d.mts +3 -1
- package/Types/ResourceAiAgent/ResourceAiAccess.d.ts +3 -1
- package/Types/ResourceAiAgent/ResourceAiAccess.js +13 -2
- package/Types/ResourceAiAgent/ResourceAiAccess.mjs +2 -0
- package/Types/SecurityCase/SecurityCaseContext.d.mts +2 -1
- package/Types/SecurityCase/SecurityCaseContext.d.ts +2 -1
- package/Types/SecurityCase/SecurityConnection.d.mts +2 -1
- package/Types/SecurityCase/SecurityConnection.d.ts +2 -1
- package/Types/SecurityEvent/RealTimeDetection.d.mts +14 -5
- package/Types/SecurityEvent/RealTimeDetection.d.ts +14 -5
- package/Types/SecurityEvent/RealTimeDetection.js +75 -25
- package/Types/SecurityEvent/RealTimeDetection.mjs +3 -3
- package/Types/SecurityPlaybook/SecurityPlaybookAction.d.mts +4 -2
- package/Types/SecurityPlaybook/SecurityPlaybookAction.d.ts +4 -2
- package/Types/SecurityPlaybook/SecurityPlaybookAction.js +22 -3
- package/Types/SecurityPlaybook/SecurityPlaybookStep.d.mts +7 -2
- package/Types/SecurityPlaybook/SecurityPlaybookStep.d.ts +7 -2
- package/Types/SecurityPlaybook/SecurityPlaybookStep.js +96 -39
- package/Types/SecurityPlaybook/SecurityPlaybookStep.mjs +2 -0
- package/Types/SecurityPlaybook/SecurityPlaybookStepCondition.d.mts +17 -2
- package/Types/SecurityPlaybook/SecurityPlaybookStepCondition.d.ts +17 -2
- package/Types/SecurityPlaybook/SecurityPlaybookStepCondition.js +174 -33
- package/Types/SecurityPlaybook/SecurityPlaybookStepCondition.mjs +7 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.d.mts +5 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.d.ts +5 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.js +10 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.mjs +1 -0
- package/Utils/Telemetry/CloudChangeTitle.d.mts +37 -0
- package/Utils/Telemetry/CloudChangeTitle.d.ts +37 -0
- package/Utils/Telemetry/CloudChangeTitle.js +315 -3
- package/Utils/Telemetry/CloudChangeTitle.mjs +13 -0
- package/package.json +1 -1
|
@@ -148,6 +148,16 @@ let CloudAccount = class CloudAccount extends DatabaseBaseModel_1.default {
|
|
|
148
148
|
* operator chose settings, perhaps before deploying the agent".
|
|
149
149
|
*/
|
|
150
150
|
this.aiAccessConfiguredAt = undefined;
|
|
151
|
+
/*
|
|
152
|
+
* The SHA-256 of the keys this account's Cloud AI agent may connect with
|
|
153
|
+
* (Types/CloudConnection/CloudAiAgentKey): the agent's own, the ones made
|
|
154
|
+
* for a setup command that has not connected yet, and whether the
|
|
155
|
+
* project's ingestion key may still connect it. The keys themselves are
|
|
156
|
+
* never stored, and even their hashes are nobody's to read: the key route
|
|
157
|
+
* and Reset agent write this column, registration reads it. Empty for an
|
|
158
|
+
* account whose agent was set up before agents had keys of their own.
|
|
159
|
+
*/
|
|
160
|
+
this.aiAgentKeys = undefined;
|
|
151
161
|
}
|
|
152
162
|
};
|
|
153
163
|
__decorate([
|
|
@@ -733,6 +743,17 @@ __decorate([
|
|
|
733
743
|
}),
|
|
734
744
|
__metadata("design:type", Date)
|
|
735
745
|
], CloudAccount.prototype, "aiAccessConfiguredAt", void 0);
|
|
746
|
+
__decorate([
|
|
747
|
+
(0, ColumnAccessControl_1.default)({ create: [], read: [], update: [] }),
|
|
748
|
+
(0, TableColumn_1.default)({
|
|
749
|
+
type: TableColumnType_1.default.JSON,
|
|
750
|
+
required: false,
|
|
751
|
+
title: "AI Agent Keys",
|
|
752
|
+
description: "SHA-256 of the keys the account's Cloud AI agent connects with, and of the ones made for a setup command. Server only; never readable.",
|
|
753
|
+
}),
|
|
754
|
+
(0, typeorm_1.Column)({ type: ColumnType_1.default.JSON, nullable: true }),
|
|
755
|
+
__metadata("design:type", Object)
|
|
756
|
+
], CloudAccount.prototype, "aiAgentKeys", void 0);
|
|
736
757
|
CloudAccount = __decorate([
|
|
737
758
|
(0, AccessControlColumn_1.default)("labels"),
|
|
738
759
|
(0, EnableDocumentation_1.default)(),
|
|
@@ -18,6 +18,7 @@ export default class CloudBudget extends BaseModel {
|
|
|
18
18
|
currency?: string;
|
|
19
19
|
alertThresholds?: string;
|
|
20
20
|
alertOnProjection?: boolean;
|
|
21
|
+
alertOnAnomaly?: boolean;
|
|
21
22
|
alertSeverity?: AlertSeverity;
|
|
22
23
|
alertSeverityId?: ObjectID;
|
|
23
24
|
onCallDutyPolicies?: Array<OnCallDutyPolicy>;
|
|
@@ -18,6 +18,7 @@ export default class CloudBudget extends BaseModel {
|
|
|
18
18
|
currency?: string;
|
|
19
19
|
alertThresholds?: string;
|
|
20
20
|
alertOnProjection?: boolean;
|
|
21
|
+
alertOnAnomaly?: boolean;
|
|
21
22
|
alertSeverity?: AlertSeverity;
|
|
22
23
|
alertSeverityId?: ObjectID;
|
|
23
24
|
onCallDutyPolicies?: Array<OnCallDutyPolicy>;
|
|
@@ -26,6 +26,7 @@ const ColumnLength_1 = __importDefault(require("../../Types/Database/ColumnLengt
|
|
|
26
26
|
const ColumnType_1 = __importDefault(require("../../Types/Database/ColumnType"));
|
|
27
27
|
const CrudApiEndpoint_1 = __importDefault(require("../../Types/Database/CrudApiEndpoint"));
|
|
28
28
|
const EnableDocumentation_1 = __importDefault(require("../../Types/Database/EnableDocumentation"));
|
|
29
|
+
const EnableMCP_1 = __importDefault(require("../../Types/Database/EnableMCP"));
|
|
29
30
|
const TableColumn_1 = __importDefault(require("../../Types/Database/TableColumn"));
|
|
30
31
|
const TableColumnType_1 = __importDefault(require("../../Types/Database/TableColumnType"));
|
|
31
32
|
const TableMetadata_1 = __importDefault(require("../../Types/Database/TableMetadata"));
|
|
@@ -41,12 +42,17 @@ const typeorm_1 = require("typeorm");
|
|
|
41
42
|
* enabled budget with what its accounts cost this month so far and what
|
|
42
43
|
* they are on course to cost (CloudAccount.costSummary), and raises an
|
|
43
44
|
* alert the first time in a month the spend passes each threshold - 80% and
|
|
44
|
-
* 100% of the budget by default -
|
|
45
|
-
*
|
|
46
|
-
*
|
|
45
|
+
* 100% of the budget by default - when the month is on course to pass it:
|
|
46
|
+
* before the money is spent - and, unless turned off, on a day that cost
|
|
47
|
+
* far more than usual (CloudBudgetEvaluator). A new month starts again from
|
|
48
|
+
* nothing, and the last month's alerts are resolved.
|
|
47
49
|
*
|
|
48
50
|
* Who may set one: those who may change the cloud resources (the Cloud
|
|
49
51
|
* Resource permissions, as an account's are).
|
|
52
|
+
*
|
|
53
|
+
* The MCP server has its create, get, list, update, delete and count tools,
|
|
54
|
+
* and the CLI its `cloud-budget` command, so AI agents and scripts manage
|
|
55
|
+
* budgets as people do.
|
|
50
56
|
*/
|
|
51
57
|
// Postgres answers a decimal as text: read it back as the number it is.
|
|
52
58
|
const decimalTransformer = {
|
|
@@ -115,6 +121,13 @@ let CloudBudget = class CloudBudget extends DatabaseBaseModel_1.default {
|
|
|
115
121
|
this.currency = undefined;
|
|
116
122
|
this.alertThresholds = undefined;
|
|
117
123
|
this.alertOnProjection = undefined;
|
|
124
|
+
/*
|
|
125
|
+
* A day that cost far more than usual - a service at twice its usual day,
|
|
126
|
+
* or the whole account at half again (CloudCostAnomaly) - is an alert of
|
|
127
|
+
* its own, the day after: a budget sees a month, and a spike adds up for
|
|
128
|
+
* days before it passes a share of one.
|
|
129
|
+
*/
|
|
130
|
+
this.alertOnAnomaly = undefined;
|
|
118
131
|
this.alertSeverity = undefined;
|
|
119
132
|
this.alertSeverityId = undefined;
|
|
120
133
|
this.onCallDutyPolicies = undefined;
|
|
@@ -377,6 +390,27 @@ __decorate([
|
|
|
377
390
|
}),
|
|
378
391
|
__metadata("design:type", Boolean)
|
|
379
392
|
], CloudBudget.prototype, "alertOnProjection", void 0);
|
|
393
|
+
__decorate([
|
|
394
|
+
(0, ColumnAccessControl_1.default)({
|
|
395
|
+
create: createPermissions,
|
|
396
|
+
read: readPermissions,
|
|
397
|
+
update: updatePermissions,
|
|
398
|
+
}),
|
|
399
|
+
(0, TableColumn_1.default)({
|
|
400
|
+
required: true,
|
|
401
|
+
type: TableColumnType_1.default.Boolean,
|
|
402
|
+
title: "Alert On Unusual Days",
|
|
403
|
+
description: "Also alert when a day costs far more than usual: a service at twice its usual day, or the whole account at one and a half times.",
|
|
404
|
+
defaultValue: true,
|
|
405
|
+
isDefaultValueColumn: true,
|
|
406
|
+
}),
|
|
407
|
+
(0, typeorm_1.Column)({
|
|
408
|
+
type: ColumnType_1.default.Boolean,
|
|
409
|
+
nullable: false,
|
|
410
|
+
default: true,
|
|
411
|
+
}),
|
|
412
|
+
__metadata("design:type", Boolean)
|
|
413
|
+
], CloudBudget.prototype, "alertOnAnomaly", void 0);
|
|
380
414
|
__decorate([
|
|
381
415
|
(0, ColumnAccessControl_1.default)({
|
|
382
416
|
create: createPermissions,
|
|
@@ -607,6 +641,7 @@ __decorate([
|
|
|
607
641
|
], CloudBudget.prototype, "deletedByUserId", void 0);
|
|
608
642
|
CloudBudget = __decorate([
|
|
609
643
|
(0, EnableDocumentation_1.default)(),
|
|
644
|
+
(0, EnableMCP_1.default)(),
|
|
610
645
|
(0, TableBillingAccessControl_1.default)({
|
|
611
646
|
create: SubscriptionPlan_1.PlanType.Free,
|
|
612
647
|
read: SubscriptionPlan_1.PlanType.Free,
|
|
@@ -5,6 +5,7 @@ import User from "./User.mjs";
|
|
|
5
5
|
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel.mjs";
|
|
6
6
|
import { CloudSavingKind } from "../../Types/Cloud/CloudCost.mjs";
|
|
7
7
|
import { CloudProvider } from "../../Types/Cloud/CloudPlatform.mjs";
|
|
8
|
+
import { JSONObject } from "../../Types/JSON.mjs";
|
|
8
9
|
import ObjectID from "../../Types/ObjectID.mjs";
|
|
9
10
|
export default class CloudCostRecommendation extends BaseModel {
|
|
10
11
|
project?: Project;
|
|
@@ -28,6 +29,7 @@ export default class CloudCostRecommendation extends BaseModel {
|
|
|
28
29
|
currency?: string;
|
|
29
30
|
effort?: string;
|
|
30
31
|
source?: string;
|
|
32
|
+
evidence?: JSONObject;
|
|
31
33
|
lastSeenAt?: Date;
|
|
32
34
|
createdByUserId?: ObjectID;
|
|
33
35
|
deletedByUser?: User;
|
|
@@ -5,6 +5,7 @@ import User from "./User";
|
|
|
5
5
|
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
6
6
|
import { CloudSavingKind } from "../../Types/Cloud/CloudCost";
|
|
7
7
|
import { CloudProvider } from "../../Types/Cloud/CloudPlatform";
|
|
8
|
+
import { JSONObject } from "../../Types/JSON";
|
|
8
9
|
import ObjectID from "../../Types/ObjectID";
|
|
9
10
|
export default class CloudCostRecommendation extends BaseModel {
|
|
10
11
|
project?: Project;
|
|
@@ -28,6 +29,7 @@ export default class CloudCostRecommendation extends BaseModel {
|
|
|
28
29
|
currency?: string;
|
|
29
30
|
effort?: string;
|
|
30
31
|
source?: string;
|
|
32
|
+
evidence?: JSONObject;
|
|
31
33
|
lastSeenAt?: Date;
|
|
32
34
|
createdByUserId?: ObjectID;
|
|
33
35
|
deletedByUser?: User;
|
|
@@ -48,6 +48,12 @@ const typeorm_1 = require("typeorm");
|
|
|
48
48
|
* recommender: a recommendation it no longer makes is removed. Not
|
|
49
49
|
* user-editable. Cloud > Savings, an account's Costs and a resource's
|
|
50
50
|
* Overview list them.
|
|
51
|
+
*
|
|
52
|
+
* Where no recommender covers a resource, OneUptime right-sizes it from its
|
|
53
|
+
* own readings of its CPU and memory (Types/Cloud/CloudRightSizing,
|
|
54
|
+
* CloudRightSizingWriter): source OneUptime, its recommendationId
|
|
55
|
+
* "oneuptime-rightsize:<the resource's id>", kept in step by that writer
|
|
56
|
+
* and never by the cloud's.
|
|
51
57
|
*/
|
|
52
58
|
// Postgres answers a decimal as text: read it back as the number it is.
|
|
53
59
|
const decimalTransformer = {
|
|
@@ -102,6 +108,14 @@ let CloudCostRecommendation = class CloudCostRecommendation extends DatabaseBase
|
|
|
102
108
|
this.currency = undefined;
|
|
103
109
|
this.effort = undefined;
|
|
104
110
|
this.source = undefined;
|
|
111
|
+
/*
|
|
112
|
+
* What made a right-sizing OneUptime worked out from its own readings
|
|
113
|
+
* (CloudRightSizing's CloudRightSizingEvidence): its CPU's 95th
|
|
114
|
+
* percentile and highest reading, its memory's peak and the days read,
|
|
115
|
+
* so a page says why in the reader's language. Empty for the clouds'
|
|
116
|
+
* own recommendations.
|
|
117
|
+
*/
|
|
118
|
+
this.evidence = undefined;
|
|
105
119
|
this.lastSeenAt = undefined;
|
|
106
120
|
this.createdByUserId = undefined;
|
|
107
121
|
this.deletedByUser = undefined;
|
|
@@ -449,7 +463,7 @@ __decorate([
|
|
|
449
463
|
required: true,
|
|
450
464
|
type: TableColumnType_1.default.ShortText,
|
|
451
465
|
title: "Source",
|
|
452
|
-
description: "Which recommender made it: AWS Cost Optimization Hub, Azure Advisor
|
|
466
|
+
description: "Which recommender made it: AWS Cost Optimization Hub, Azure Advisor, Google Cloud Recommender or OneUptime.",
|
|
453
467
|
}),
|
|
454
468
|
(0, typeorm_1.Column)({
|
|
455
469
|
nullable: false,
|
|
@@ -458,6 +472,20 @@ __decorate([
|
|
|
458
472
|
}),
|
|
459
473
|
__metadata("design:type", String)
|
|
460
474
|
], CloudCostRecommendation.prototype, "source", void 0);
|
|
475
|
+
__decorate([
|
|
476
|
+
(0, ColumnAccessControl_1.default)({ create: [], read: READ_PERMISSIONS, update: [] }),
|
|
477
|
+
(0, TableColumn_1.default)({
|
|
478
|
+
required: false,
|
|
479
|
+
type: TableColumnType_1.default.JSON,
|
|
480
|
+
title: "Evidence",
|
|
481
|
+
description: "For a right-sizing OneUptime worked out from its own readings: the CPU and memory readings and the days it was judged from.",
|
|
482
|
+
}),
|
|
483
|
+
(0, typeorm_1.Column)({
|
|
484
|
+
nullable: true,
|
|
485
|
+
type: ColumnType_1.default.JSON,
|
|
486
|
+
}),
|
|
487
|
+
__metadata("design:type", Object)
|
|
488
|
+
], CloudCostRecommendation.prototype, "evidence", void 0);
|
|
461
489
|
__decorate([
|
|
462
490
|
(0, ColumnAccessControl_1.default)({ create: [], read: READ_PERMISSIONS, update: [] }),
|
|
463
491
|
(0, TableColumn_1.default)({
|
|
@@ -539,7 +567,7 @@ CloudCostRecommendation = __decorate([
|
|
|
539
567
|
singularName: "Cloud Cost Recommendation",
|
|
540
568
|
pluralName: "Cloud Cost Recommendations",
|
|
541
569
|
icon: IconProp_1.default.Billing,
|
|
542
|
-
tableDescription: "Ways to spend less in your connected cloud accounts - rightsizing, idle resources, newer generations and commitments - with what each saves a month, from AWS Cost Optimization Hub, Azure Advisor
|
|
570
|
+
tableDescription: "Ways to spend less in your connected cloud accounts - rightsizing, idle resources, newer generations and commitments - with what each saves a month, from AWS Cost Optimization Hub, Azure Advisor, Google Cloud's Recommender and OneUptime's own CPU and memory readings. Written by the cloud connections; not user-editable.",
|
|
543
571
|
}),
|
|
544
572
|
(0, typeorm_1.Index)(["projectId", "provider", "recommendationId"], {
|
|
545
573
|
unique: true,
|
|
@@ -92,12 +92,13 @@ let DetectionRule = class DetectionRule extends DatabaseBaseModel_1.default {
|
|
|
92
92
|
this.isEnabled = undefined;
|
|
93
93
|
this.evaluationIntervalInMinutes = undefined;
|
|
94
94
|
/*
|
|
95
|
-
* A rule
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* === true, so an
|
|
95
|
+
* A rule can be checked as events arrive (Types/SecurityEvent/
|
|
96
|
+
* RealTimeDetection): within seconds instead of on its interval, which it
|
|
97
|
+
* then no longer runs on - a rule that counts, and a correlation, count
|
|
98
|
+
* in windows of it instead. Off by default, and on every rule saved
|
|
99
|
+
* before the column existed: a scheduled rule stays scheduled until
|
|
100
|
+
* somebody chooses otherwise. The evaluator gates on === true, so an
|
|
101
|
+
* unset column reads as off.
|
|
101
102
|
*/
|
|
102
103
|
this.isRealTime = undefined;
|
|
103
104
|
this.groupByField = undefined;
|
|
@@ -315,7 +316,7 @@ __decorate([
|
|
|
315
316
|
type: TableColumnType_1.default.Boolean,
|
|
316
317
|
canReadOnRelationQuery: true,
|
|
317
318
|
title: "Run in Real Time",
|
|
318
|
-
description: "Whether
|
|
319
|
+
description: "Whether events are checked against this rule as they arrive, within seconds, instead of every evaluation interval. A rule that counts, and a correlation, count in windows as long as the evaluation interval and fire at most once in each. Not for a rule with a regular expression.",
|
|
319
320
|
defaultValue: false,
|
|
320
321
|
isDefaultValueColumn: true,
|
|
321
322
|
}),
|
|
@@ -5,6 +5,7 @@ export declare const RESOURCE_AI_ACCESS_TEST_PATH: string;
|
|
|
5
5
|
export declare const RESOURCE_AI_ACCESS_RESET_AGENT_PATH: string;
|
|
6
6
|
export declare const RESOURCE_AI_ACCESS_LOGS_PATH: string;
|
|
7
7
|
export declare const RESOURCE_AI_ACCESS_INSIGHTS_PATH: string;
|
|
8
|
+
export declare const RESOURCE_AI_ACCESS_AGENT_KEY_PATH: string;
|
|
8
9
|
export interface ResourceAiAccessRequest {
|
|
9
10
|
resourceType: AiResourceType | string;
|
|
10
11
|
resourceId: string;
|
|
@@ -5,6 +5,7 @@ export declare const RESOURCE_AI_ACCESS_TEST_PATH: string;
|
|
|
5
5
|
export declare const RESOURCE_AI_ACCESS_RESET_AGENT_PATH: string;
|
|
6
6
|
export declare const RESOURCE_AI_ACCESS_LOGS_PATH: string;
|
|
7
7
|
export declare const RESOURCE_AI_ACCESS_INSIGHTS_PATH: string;
|
|
8
|
+
export declare const RESOURCE_AI_ACCESS_AGENT_KEY_PATH: string;
|
|
8
9
|
export interface ResourceAiAccessRequest {
|
|
9
10
|
resourceType: AiResourceType | string;
|
|
10
11
|
resourceId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RESOURCE_AI_LOGS_RATIONALE_MAX_LENGTH = exports.RESOURCE_AI_LOGS_COMMAND_WINDOW_IN_DAYS = exports.RESOURCE_AI_LOGS_LIMIT = exports.RESOURCE_AI_ACCESS_INSIGHTS_PATH = exports.RESOURCE_AI_ACCESS_LOGS_PATH = exports.RESOURCE_AI_ACCESS_RESET_AGENT_PATH = exports.RESOURCE_AI_ACCESS_TEST_PATH = exports.RESOURCE_AI_ACCESS_STATUS_PATH = void 0;
|
|
3
|
+
exports.RESOURCE_AI_LOGS_RATIONALE_MAX_LENGTH = exports.RESOURCE_AI_LOGS_COMMAND_WINDOW_IN_DAYS = exports.RESOURCE_AI_LOGS_LIMIT = exports.RESOURCE_AI_ACCESS_AGENT_KEY_PATH = exports.RESOURCE_AI_ACCESS_INSIGHTS_PATH = exports.RESOURCE_AI_ACCESS_LOGS_PATH = exports.RESOURCE_AI_ACCESS_RESET_AGENT_PATH = exports.RESOURCE_AI_ACCESS_TEST_PATH = exports.RESOURCE_AI_ACCESS_STATUS_PATH = void 0;
|
|
4
4
|
/*
|
|
5
5
|
* The dashboard-facing calls behind an infrastructure resource's AI pages
|
|
6
6
|
* (AI → Insights, AI → Logs and AI → AI agent) for every resource a resource
|
|
@@ -16,6 +16,11 @@ exports.RESOURCE_AI_ACCESS_RESET_AGENT_PATH = "/resource-ai-access/reset-agent";
|
|
|
16
16
|
exports.RESOURCE_AI_ACCESS_LOGS_PATH = "/resource-ai-access/logs";
|
|
17
17
|
// Answers AiActivityInsights (Common/Types/AI/AiActivityInsights.ts).
|
|
18
18
|
exports.RESOURCE_AI_ACCESS_INSIGHTS_PATH = "/resource-ai-access/insights";
|
|
19
|
+
/*
|
|
20
|
+
* A cloud account only: a new key for its Cloud AI agent, shown once
|
|
21
|
+
* (CloudAiAgentKeyResponse in Types/CloudConnection/CloudAiAgentKey).
|
|
22
|
+
*/
|
|
23
|
+
exports.RESOURCE_AI_ACCESS_AGENT_KEY_PATH = "/resource-ai-access/agent-key";
|
|
19
24
|
/*
|
|
20
25
|
* POST /resource-ai-access/logs: everything OneUptime AI did on one
|
|
21
26
|
* resource, newest first, as summaries — what the resource's AI Logs page
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import commonJsModule from "./ResourceAiAccessApi.js";
|
|
2
|
+
export const RESOURCE_AI_ACCESS_AGENT_KEY_PATH = commonJsModule.RESOURCE_AI_ACCESS_AGENT_KEY_PATH;
|
|
2
3
|
export const RESOURCE_AI_ACCESS_INSIGHTS_PATH = commonJsModule.RESOURCE_AI_ACCESS_INSIGHTS_PATH;
|
|
3
4
|
export const RESOURCE_AI_ACCESS_LOGS_PATH = commonJsModule.RESOURCE_AI_ACCESS_LOGS_PATH;
|
|
4
5
|
export const RESOURCE_AI_ACCESS_RESET_AGENT_PATH = commonJsModule.RESOURCE_AI_ACCESS_RESET_AGENT_PATH;
|
|
@@ -8,4 +8,6 @@ export declare const RESOURCE_AI_REMEDIATION_MODE_LABELS: Readonly<Record<Resour
|
|
|
8
8
|
export declare const RESOURCE_AI_ALLOWLIST_EXAMPLES: Readonly<Record<AiResourceType, string>>;
|
|
9
9
|
export declare function getResourceAiAccessAdminRefusal(resourceType: AiResourceType): string;
|
|
10
10
|
export declare function getResourceAiAgentResetEditRefusal(resourceType: AiResourceType): string;
|
|
11
|
+
export declare function getCloudAiAgentKeyRefusal(resourceType: AiResourceType): string;
|
|
12
|
+
export declare function getCloudAiAgentKeyEditRefusal(resourceType: AiResourceType): string;
|
|
11
13
|
export declare function getResourceAiAgentResetRefusal(resourceType: AiResourceType): string;
|
|
@@ -8,4 +8,6 @@ export declare const RESOURCE_AI_REMEDIATION_MODE_LABELS: Readonly<Record<Resour
|
|
|
8
8
|
export declare const RESOURCE_AI_ALLOWLIST_EXAMPLES: Readonly<Record<AiResourceType, string>>;
|
|
9
9
|
export declare function getResourceAiAccessAdminRefusal(resourceType: AiResourceType): string;
|
|
10
10
|
export declare function getResourceAiAgentResetEditRefusal(resourceType: AiResourceType): string;
|
|
11
|
+
export declare function getCloudAiAgentKeyRefusal(resourceType: AiResourceType): string;
|
|
12
|
+
export declare function getCloudAiAgentKeyEditRefusal(resourceType: AiResourceType): string;
|
|
11
13
|
export declare function getResourceAiAgentResetRefusal(resourceType: AiResourceType): string;
|
|
@@ -38,6 +38,8 @@ exports.getResourceSentenceName = getResourceSentenceName;
|
|
|
38
38
|
exports.getResourceAgentName = getResourceAgentName;
|
|
39
39
|
exports.getResourceAiAccessAdminRefusal = getResourceAiAccessAdminRefusal;
|
|
40
40
|
exports.getResourceAiAgentResetEditRefusal = getResourceAiAgentResetEditRefusal;
|
|
41
|
+
exports.getCloudAiAgentKeyRefusal = getCloudAiAgentKeyRefusal;
|
|
42
|
+
exports.getCloudAiAgentKeyEditRefusal = getCloudAiAgentKeyEditRefusal;
|
|
41
43
|
exports.getResourceAiAgentResetRefusal = getResourceAiAgentResetRefusal;
|
|
42
44
|
const Permission_1 = __importStar(require("../Permission"));
|
|
43
45
|
const AiResourceType_1 = __importStar(require("../ResourceAiAgent/AiResourceType"));
|
|
@@ -149,6 +151,17 @@ function getResourceAiAccessAdminRefusal(resourceType) {
|
|
|
149
151
|
function getResourceAiAgentResetEditRefusal(resourceType) {
|
|
150
152
|
return `You need permission to edit this ${getResourceSentenceName(resourceType)} to reset its ${getResourceAgentName(resourceType)}.`;
|
|
151
153
|
}
|
|
154
|
+
/*
|
|
155
|
+
* Making a key for a cloud account's Cloud AI agent sets that agent up: it
|
|
156
|
+
* takes what resetting it takes - one of RESOURCE_AI_ACCESS_ADMIN_PERMISSIONS
|
|
157
|
+
* and an edit of the account itself.
|
|
158
|
+
*/
|
|
159
|
+
function getCloudAiAgentKeyRefusal(resourceType) {
|
|
160
|
+
return `You need one of these permissions to set up this ${getResourceSentenceName(resourceType)}'s ${getResourceAgentName(resourceType)}: ${Permission_1.PermissionHelper.getPermissionTitles(exports.RESOURCE_AI_ACCESS_ADMIN_PERMISSIONS).join(", ")}.`;
|
|
161
|
+
}
|
|
162
|
+
function getCloudAiAgentKeyEditRefusal(resourceType) {
|
|
163
|
+
return `You need permission to edit this ${getResourceSentenceName(resourceType)} to set up its ${getResourceAgentName(resourceType)}.`;
|
|
164
|
+
}
|
|
152
165
|
// The refusal for a caller who may not reset the resource's AI agent.
|
|
153
166
|
function getResourceAiAgentResetRefusal(resourceType) {
|
|
154
167
|
return `You need one of these permissions to reset this ${getResourceSentenceName(resourceType)}'s ${getResourceAgentName(resourceType)}: ${Permission_1.PermissionHelper.getPermissionTitles(exports.RESOURCE_AI_ACCESS_ADMIN_PERMISSIONS).join(", ")}.`;
|
|
@@ -2,6 +2,8 @@ import commonJsModule from "./ResourceAiAccessPermissions.js";
|
|
|
2
2
|
export const RESOURCE_AI_ACCESS_ADMIN_PERMISSIONS = commonJsModule.RESOURCE_AI_ACCESS_ADMIN_PERMISSIONS;
|
|
3
3
|
export const RESOURCE_AI_ALLOWLIST_EXAMPLES = commonJsModule.RESOURCE_AI_ALLOWLIST_EXAMPLES;
|
|
4
4
|
export const RESOURCE_AI_REMEDIATION_MODE_LABELS = commonJsModule.RESOURCE_AI_REMEDIATION_MODE_LABELS;
|
|
5
|
+
export const getCloudAiAgentKeyEditRefusal = commonJsModule.getCloudAiAgentKeyEditRefusal;
|
|
6
|
+
export const getCloudAiAgentKeyRefusal = commonJsModule.getCloudAiAgentKeyRefusal;
|
|
5
7
|
export const getResourceAgentName = commonJsModule.getResourceAgentName;
|
|
6
8
|
export const getResourceAiAccessAdminRefusal = commonJsModule.getResourceAiAccessAdminRefusal;
|
|
7
9
|
export const getResourceAiAgentResetEditRefusal = commonJsModule.getResourceAiAgentResetEditRefusal;
|
|
@@ -24,8 +24,16 @@ export interface CloudAccountCostSummary {
|
|
|
24
24
|
amount: number;
|
|
25
25
|
}>;
|
|
26
26
|
latestDay?: string | undefined;
|
|
27
|
+
anomalies?: Array<CloudCostAnomaly> | undefined;
|
|
27
28
|
readAt: string;
|
|
28
29
|
}
|
|
30
|
+
export interface CloudCostAnomaly {
|
|
31
|
+
day: string;
|
|
32
|
+
service: string;
|
|
33
|
+
amount: number;
|
|
34
|
+
usual: number;
|
|
35
|
+
}
|
|
36
|
+
export declare function readCloudCostAnomaly(value: unknown): CloudCostAnomaly | null;
|
|
29
37
|
export declare const CLOUD_COST_SUMMARY_TOP_SERVICES: number;
|
|
30
38
|
export declare function toCloudCostDay(date: Date): string;
|
|
31
39
|
export declare function fromCloudCostDay(day: string): Date;
|
|
@@ -24,8 +24,16 @@ export interface CloudAccountCostSummary {
|
|
|
24
24
|
amount: number;
|
|
25
25
|
}>;
|
|
26
26
|
latestDay?: string | undefined;
|
|
27
|
+
anomalies?: Array<CloudCostAnomaly> | undefined;
|
|
27
28
|
readAt: string;
|
|
28
29
|
}
|
|
30
|
+
export interface CloudCostAnomaly {
|
|
31
|
+
day: string;
|
|
32
|
+
service: string;
|
|
33
|
+
amount: number;
|
|
34
|
+
usual: number;
|
|
35
|
+
}
|
|
36
|
+
export declare function readCloudCostAnomaly(value: unknown): CloudCostAnomaly | null;
|
|
29
37
|
export declare const CLOUD_COST_SUMMARY_TOP_SERVICES: number;
|
|
30
38
|
export declare function toCloudCostDay(date: Date): string;
|
|
31
39
|
export declare function fromCloudCostDay(day: string): Date;
|
package/Types/Cloud/CloudCost.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CLOUD_BUDGET_THRESHOLD_MAX = exports.CLOUD_BUDGET_THRESHOLD_MIN = exports.CLOUD_BUDGET_DEFAULT_THRESHOLDS = exports.CLOUD_SAVINGS_SOURCE_GCP = exports.CLOUD_SAVINGS_SOURCE_AZURE = exports.CLOUD_SAVINGS_SOURCE_AWS = exports.CLOUD_SAVING_ACTION_WORDS = exports.CLOUD_SAVING_KIND_LABELS = exports.CloudSavingKind = exports.CLOUD_COST_SUMMARY_TOP_SERVICES = exports.CloudCostState = exports.CLOUD_COST_DEFAULT_CURRENCY = exports.CLOUD_COST_PACE_DAYS = exports.CLOUD_SAVINGS_INTERVAL_MS = exports.CLOUD_COSTS_INTERVAL_MS = exports.CLOUD_COST_HISTORY_DAYS = void 0;
|
|
4
|
+
exports.readCloudCostAnomaly = readCloudCostAnomaly;
|
|
4
5
|
exports.toCloudCostDay = toCloudCostDay;
|
|
5
6
|
exports.fromCloudCostDay = fromCloudCostDay;
|
|
6
7
|
exports.startOfUtcMonth = startOfUtcMonth;
|
|
@@ -74,6 +75,32 @@ var CloudCostState;
|
|
|
74
75
|
CloudCostState["NotSetUp"] = "not-set-up";
|
|
75
76
|
CloudCostState["Failed"] = "failed";
|
|
76
77
|
})(CloudCostState || (exports.CloudCostState = CloudCostState = {}));
|
|
78
|
+
// A day as the costs keep it, as text: "2026-11-02".
|
|
79
|
+
const CLOUD_COST_DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
80
|
+
// An anomaly as stored, read back: null when it is malformed.
|
|
81
|
+
function readCloudCostAnomaly(value) {
|
|
82
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
const record = value;
|
|
86
|
+
const day = record["day"];
|
|
87
|
+
const amount = Number(record["amount"]);
|
|
88
|
+
const usual = Number(record["usual"]);
|
|
89
|
+
if (typeof day !== "string" ||
|
|
90
|
+
!CLOUD_COST_DAY.test(day) ||
|
|
91
|
+
!Number.isFinite(amount) ||
|
|
92
|
+
!Number.isFinite(usual) ||
|
|
93
|
+
amount <= 0 ||
|
|
94
|
+
usual < 0) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
day,
|
|
99
|
+
service: typeof record["service"] === "string" ? record["service"] : "",
|
|
100
|
+
amount,
|
|
101
|
+
usual,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
77
104
|
// At most this many services are kept on an account's summary.
|
|
78
105
|
exports.CLOUD_COST_SUMMARY_TOP_SERVICES = 5;
|
|
79
106
|
// A day as the costs keep it: "2026-11-02", in UTC.
|
|
@@ -294,6 +321,16 @@ function readCloudAccountCostSummary(value) {
|
|
|
294
321
|
latestDay: typeof record["latestDay"] === "string" && record["latestDay"]
|
|
295
322
|
? record["latestDay"]
|
|
296
323
|
: undefined,
|
|
324
|
+
anomalies: Array.isArray(record["anomalies"])
|
|
325
|
+
? record["anomalies"]
|
|
326
|
+
.map(readCloudCostAnomaly)
|
|
327
|
+
.filter((anomaly) => {
|
|
328
|
+
return anomaly !== null;
|
|
329
|
+
})
|
|
330
|
+
.map((anomaly) => {
|
|
331
|
+
return anomaly;
|
|
332
|
+
})
|
|
333
|
+
: undefined,
|
|
297
334
|
readAt: typeof record["readAt"] === "string" ? record["readAt"] : "",
|
|
298
335
|
};
|
|
299
336
|
}
|
|
@@ -31,6 +31,7 @@ export const projectCloudMonthCost = commonJsModule.projectCloudMonthCost;
|
|
|
31
31
|
export const readCloudAccountCostSummary = commonJsModule.readCloudAccountCostSummary;
|
|
32
32
|
export const readCloudAccountSavingsSummary = commonJsModule.readCloudAccountSavingsSummary;
|
|
33
33
|
export const readCloudBudgetThresholds = commonJsModule.readCloudBudgetThresholds;
|
|
34
|
+
export const readCloudCostAnomaly = commonJsModule.readCloudCostAnomaly;
|
|
34
35
|
export const roundCost = commonJsModule.roundCost;
|
|
35
36
|
export const splitCloudBudgetThresholds = commonJsModule.splitCloudBudgetThresholds;
|
|
36
37
|
export const startOfUtcDay = commonJsModule.startOfUtcDay;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CloudCostAnomaly } from "./CloudCost.mjs";
|
|
2
|
+
export declare const CLOUD_COST_ANOMALY_BASELINE_DAYS: number;
|
|
3
|
+
export declare const CLOUD_COST_ANOMALY_MIN_HISTORY_DAYS: number;
|
|
4
|
+
export declare const CLOUD_COST_ANOMALY_SERVICE_RATIO: number;
|
|
5
|
+
export declare const CLOUD_COST_ANOMALY_ACCOUNT_RATIO: number;
|
|
6
|
+
export declare const CLOUD_COST_ANOMALY_MIN_INCREASE: number;
|
|
7
|
+
export declare const CLOUD_COST_ANOMALY_MIN_SHARE_PERCENT: number;
|
|
8
|
+
export declare const CLOUD_COST_ANOMALY_DAYS_JUDGED: number;
|
|
9
|
+
export declare const CLOUD_COST_ANOMALIES_PER_DAY: number;
|
|
10
|
+
export declare const CLOUD_COST_ANOMALIES_KEPT: number;
|
|
11
|
+
export declare function getCloudCostMedian(amounts: Array<number>): number;
|
|
12
|
+
export declare function getCloudCostAnomalyDay(latestDay: string | undefined): string | undefined;
|
|
13
|
+
export declare function getCloudCostAnomalyRatio(anomaly: CloudCostAnomaly): number;
|
|
14
|
+
export declare function getCloudCostAnomalyIncrease(anomaly: CloudCostAnomaly): number;
|
|
15
|
+
export declare function findCloudCostDayAnomalies(data: {
|
|
16
|
+
dailyServiceTotals: Map<string, Map<string, number>>;
|
|
17
|
+
day: string;
|
|
18
|
+
}): Array<CloudCostAnomaly>;
|
|
19
|
+
export declare function findCloudCostAnomalies(data: {
|
|
20
|
+
dailyServiceTotals: Map<string, Map<string, number>>;
|
|
21
|
+
latestDay: string | undefined;
|
|
22
|
+
days?: number | undefined;
|
|
23
|
+
}): Array<CloudCostAnomaly>;
|
|
24
|
+
export declare function groupCloudCostAnomaliesByDay(anomalies: Array<CloudCostAnomaly>): Array<{
|
|
25
|
+
day: string;
|
|
26
|
+
anomalies: Array<CloudCostAnomaly>;
|
|
27
|
+
}>;
|
|
28
|
+
export declare function getStartedCloudCostAnomalies(groups: Array<{
|
|
29
|
+
day: string;
|
|
30
|
+
anomalies: Array<CloudCostAnomaly>;
|
|
31
|
+
}>): Array<{
|
|
32
|
+
day: string;
|
|
33
|
+
anomalies: Array<CloudCostAnomaly>;
|
|
34
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CloudCostAnomaly } from "./CloudCost";
|
|
2
|
+
export declare const CLOUD_COST_ANOMALY_BASELINE_DAYS: number;
|
|
3
|
+
export declare const CLOUD_COST_ANOMALY_MIN_HISTORY_DAYS: number;
|
|
4
|
+
export declare const CLOUD_COST_ANOMALY_SERVICE_RATIO: number;
|
|
5
|
+
export declare const CLOUD_COST_ANOMALY_ACCOUNT_RATIO: number;
|
|
6
|
+
export declare const CLOUD_COST_ANOMALY_MIN_INCREASE: number;
|
|
7
|
+
export declare const CLOUD_COST_ANOMALY_MIN_SHARE_PERCENT: number;
|
|
8
|
+
export declare const CLOUD_COST_ANOMALY_DAYS_JUDGED: number;
|
|
9
|
+
export declare const CLOUD_COST_ANOMALIES_PER_DAY: number;
|
|
10
|
+
export declare const CLOUD_COST_ANOMALIES_KEPT: number;
|
|
11
|
+
export declare function getCloudCostMedian(amounts: Array<number>): number;
|
|
12
|
+
export declare function getCloudCostAnomalyDay(latestDay: string | undefined): string | undefined;
|
|
13
|
+
export declare function getCloudCostAnomalyRatio(anomaly: CloudCostAnomaly): number;
|
|
14
|
+
export declare function getCloudCostAnomalyIncrease(anomaly: CloudCostAnomaly): number;
|
|
15
|
+
export declare function findCloudCostDayAnomalies(data: {
|
|
16
|
+
dailyServiceTotals: Map<string, Map<string, number>>;
|
|
17
|
+
day: string;
|
|
18
|
+
}): Array<CloudCostAnomaly>;
|
|
19
|
+
export declare function findCloudCostAnomalies(data: {
|
|
20
|
+
dailyServiceTotals: Map<string, Map<string, number>>;
|
|
21
|
+
latestDay: string | undefined;
|
|
22
|
+
days?: number | undefined;
|
|
23
|
+
}): Array<CloudCostAnomaly>;
|
|
24
|
+
export declare function groupCloudCostAnomaliesByDay(anomalies: Array<CloudCostAnomaly>): Array<{
|
|
25
|
+
day: string;
|
|
26
|
+
anomalies: Array<CloudCostAnomaly>;
|
|
27
|
+
}>;
|
|
28
|
+
export declare function getStartedCloudCostAnomalies(groups: Array<{
|
|
29
|
+
day: string;
|
|
30
|
+
anomalies: Array<CloudCostAnomaly>;
|
|
31
|
+
}>): Array<{
|
|
32
|
+
day: string;
|
|
33
|
+
anomalies: Array<CloudCostAnomaly>;
|
|
34
|
+
}>;
|