@oneuptime/common 14.0.91 → 14.0.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/Models/DatabaseModels/Alert.js +8 -1
  2. package/Models/DatabaseModels/AlertEpisodeMember.d.mts +1 -0
  3. package/Models/DatabaseModels/AlertEpisodeMember.d.ts +1 -0
  4. package/Models/DatabaseModels/AlertEpisodeMember.js +50 -0
  5. package/Models/DatabaseModels/AutoRemediationRule.js +1 -1
  6. package/Models/DatabaseModels/CodeRepository.d.mts +1 -0
  7. package/Models/DatabaseModels/CodeRepository.d.ts +1 -0
  8. package/Models/DatabaseModels/CodeRepository.js +69 -6
  9. package/Models/DatabaseModels/IncidentEpisodeMember.d.mts +1 -0
  10. package/Models/DatabaseModels/IncidentEpisodeMember.d.ts +1 -0
  11. package/Models/DatabaseModels/IncidentEpisodeMember.js +50 -0
  12. package/Models/DatabaseModels/IncomingCallPolicy.js +1 -1
  13. package/Models/DatabaseModels/LlmProvider.js +1 -1
  14. package/Models/DatabaseModels/MonitorTemplate.js +10 -4
  15. package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +13 -13
  16. package/Models/DatabaseModels/OnCallDutyPolicy.js +1 -1
  17. package/Models/DatabaseModels/ScheduledMaintenanceReminderRule.js +1 -1
  18. package/Models/DatabaseModels/StatusPage.d.mts +2 -0
  19. package/Models/DatabaseModels/StatusPage.d.ts +2 -0
  20. package/Models/DatabaseModels/StatusPage.js +100 -0
  21. package/Types/AI/CodeTask.d.mts +1 -0
  22. package/Types/AI/CodeTask.d.ts +1 -0
  23. package/Types/AI/TelemetryAiActivity.d.mts +1 -0
  24. package/Types/AI/TelemetryAiActivity.d.ts +1 -0
  25. package/Types/AI/TelemetryAiActivity.js +4 -0
  26. package/Types/CodeRepository/CodeRepositorySetting.d.mts +15 -0
  27. package/Types/CodeRepository/CodeRepositorySetting.d.ts +15 -0
  28. package/Types/CodeRepository/CodeRepositorySetting.js +49 -0
  29. package/Types/CodeRepository/CodeRepositorySetting.mjs +3 -0
  30. package/Types/Database/BlankColumnValue.d.mts +6 -0
  31. package/Types/Database/BlankColumnValue.d.ts +6 -0
  32. package/Types/Database/BlankColumnValue.js +77 -0
  33. package/Types/Database/BlankColumnValue.mjs +4 -0
  34. package/Types/Date.d.mts +10 -0
  35. package/Types/Date.d.ts +10 -0
  36. package/Types/Date.js +385 -98
  37. package/Types/DateLanguage.d.mts +67 -0
  38. package/Types/DateLanguage.d.ts +67 -0
  39. package/Types/DateLanguage.js +478 -0
  40. package/Types/DateLanguage.mjs +21 -0
  41. package/Types/Email/EmailTemplateType.d.mts +1 -0
  42. package/Types/Email/EmailTemplateType.d.ts +1 -0
  43. package/Types/Email/EmailTemplateType.js +1 -0
  44. package/Types/IncomingCall/IncomingCallPolicyRepeat.d.mts +6 -0
  45. package/Types/IncomingCall/IncomingCallPolicyRepeat.d.ts +6 -0
  46. package/Types/IncomingCall/IncomingCallPolicyRepeat.js +41 -14
  47. package/Types/IncomingCall/IncomingCallPolicyRepeat.mjs +3 -0
  48. package/Types/Monitor/CriteriaFilter.d.mts +1 -0
  49. package/Types/Monitor/CriteriaFilter.d.ts +1 -0
  50. package/Types/Monitor/CriteriaFilter.js +9 -0
  51. package/Types/Monitor/DatabaseMetricCatalog.js +2 -2
  52. package/Types/Monitor/KubernetesEventAlertTemplates.d.mts +20 -0
  53. package/Types/Monitor/KubernetesEventAlertTemplates.d.ts +20 -0
  54. package/Types/Monitor/KubernetesEventAlertTemplates.js +232 -0
  55. package/Types/Monitor/KubernetesEventAlertTemplates.mjs +8 -0
  56. package/Types/Monitor/MonitorType.js +12 -2
  57. package/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js +27 -2
  58. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.d.mts +1 -0
  59. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.d.ts +1 -0
  60. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.js +31 -1
  61. package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.d.mts +3 -1
  62. package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.d.ts +3 -1
  63. package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +3 -2
  64. package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.d.mts +1 -0
  65. package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.d.ts +1 -0
  66. package/Types/NotificationSetting/NotificationEmailRollupCategory.js +2 -0
  67. package/Types/NotificationSetting/NotificationEmailRollupPolicy.js +10 -3
  68. package/Types/NotificationSetting/NotificationSettingEventType.d.mts +1 -0
  69. package/Types/NotificationSetting/NotificationSettingEventType.d.ts +1 -0
  70. package/Types/NotificationSetting/NotificationSettingEventType.js +7 -0
  71. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.d.mts +7 -0
  72. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.d.ts +7 -0
  73. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.js +51 -0
  74. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.mjs +4 -0
  75. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.d.mts +8 -0
  76. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.d.ts +8 -0
  77. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.js +55 -0
  78. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.mjs +5 -0
  79. package/Types/Runner/CodeRepositoryRunner.d.mts +7 -0
  80. package/Types/Runner/CodeRepositoryRunner.d.ts +7 -0
  81. package/Types/Runner/CodeRepositoryRunner.js +60 -14
  82. package/Types/Runner/CodeRepositoryRunner.mjs +1 -0
  83. package/Types/SecurityEvent/OcsfProcessActivity.d.mts +25 -0
  84. package/Types/SecurityEvent/OcsfProcessActivity.d.ts +25 -0
  85. package/Types/SecurityEvent/OcsfProcessActivity.js +131 -0
  86. package/Types/SecurityEvent/OcsfProcessActivity.mjs +8 -0
  87. package/Types/Workflow/Templates.js +2 -5
  88. package/UI/Utils/TranslateTemplate.d.mts +73 -0
  89. package/UI/Utils/TranslateTemplate.d.ts +73 -0
  90. package/Utils/ColorContrast.d.mts +3 -0
  91. package/Utils/ColorContrast.d.ts +3 -0
  92. package/Utils/ColorContrast.js +41 -3
  93. package/Utils/ColorContrast.mjs +2 -0
  94. package/Utils/CronTab.d.mts +41 -3
  95. package/Utils/CronTab.d.ts +41 -3
  96. package/Utils/CronTab.js +112 -38
  97. package/Utils/Incident/WhoOpenedItRootCause.d.mts +2 -0
  98. package/Utils/Incident/WhoOpenedItRootCause.d.ts +2 -0
  99. package/Utils/Incident/WhoOpenedItRootCause.js +50 -0
  100. package/Utils/Incident/WhoOpenedItRootCause.mjs +3 -0
  101. package/Utils/Monitor/MonitorOverviewTargetUtil.d.mts +2 -0
  102. package/Utils/Monitor/MonitorOverviewTargetUtil.d.ts +2 -0
  103. package/Utils/Monitor/MonitorOverviewTargetUtil.js +13 -2
  104. package/Utils/Monitor/SyntheticMonitorStepsUtil.d.mts +18 -0
  105. package/Utils/Monitor/SyntheticMonitorStepsUtil.d.ts +18 -0
  106. package/Utils/Monitor/SyntheticMonitorStepsUtil.js +129 -0
  107. package/Utils/Monitor/SyntheticMonitorStepsUtil.mjs +4 -0
  108. package/Utils/Rules/RuleRunSummary.d.mts +1 -0
  109. package/Utils/Rules/RuleRunSummary.d.ts +1 -0
  110. package/Utils/Rules/RuleRunSummary.js +19 -1
  111. package/Utils/Rules/RuleRunSummary.mjs +1 -0
  112. package/Utils/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.d.mts +5 -0
  113. package/Utils/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.d.ts +5 -0
  114. package/Utils/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.js +219 -58
  115. package/Utils/SecurityEvent/OcsfNormalizer.js +22 -13
  116. package/Utils/Slo/SloDuration.d.mts +1 -0
  117. package/Utils/Slo/SloDuration.d.ts +1 -0
  118. package/Utils/Slo/SloDuration.js +57 -8
  119. package/Utils/Slo/SloDuration.mjs +1 -0
  120. package/Utils/Sms/Gsm7Text.js +9 -1
  121. package/Utils/Sms/OnCallPageSms.d.mts +2 -0
  122. package/Utils/Sms/OnCallPageSms.d.ts +2 -0
  123. package/Utils/Sms/OnCallPageSms.js +19 -2
  124. package/Utils/Sms/OnCallPageSms.mjs +1 -0
  125. package/Utils/Sms/SubscriberSms.d.mts +2 -0
  126. package/Utils/Sms/SubscriberSms.d.ts +2 -0
  127. package/Utils/Sms/SubscriberSms.js +35 -0
  128. package/Utils/Sms/SubscriberSms.mjs +3 -0
  129. package/Utils/Suggestions/CodeFixSuggestion.d.mts +15 -0
  130. package/Utils/Suggestions/CodeFixSuggestion.d.ts +15 -0
  131. package/Utils/Suggestions/CodeFixSuggestion.js +62 -1
  132. package/Utils/Suggestions/CodeFixSuggestion.mjs +4 -0
  133. package/Utils/Suggestions/ProfileFixSuggestion.js +4 -0
  134. package/Utils/Suggestions/SuggestionBlocker.d.mts +8 -0
  135. package/Utils/Suggestions/SuggestionBlocker.d.ts +8 -0
  136. package/Utils/Suggestions/SuggestionBlocker.js +51 -0
  137. package/Utils/Suggestions/SuggestionBlocker.mjs +4 -0
  138. package/Utils/Suggestions/SuggestionOffer.d.mts +2 -1
  139. package/Utils/Suggestions/SuggestionOffer.d.ts +2 -1
  140. package/Utils/Suggestions/SuggestionOffer.js +5 -0
  141. package/Utils/Suggestions/TelemetryAiFixSuggestion.d.mts +2 -7
  142. package/Utils/Suggestions/TelemetryAiFixSuggestion.d.ts +2 -7
  143. package/Utils/Suggestions/TelemetryAiFixSuggestion.js +8 -36
  144. package/Utils/Suggestions/TelemetryImprovementSuggestion.d.mts +1 -0
  145. package/Utils/Suggestions/TelemetryImprovementSuggestion.d.ts +1 -0
  146. package/Utils/Suggestions/TelemetryImprovementSuggestion.js +1 -0
  147. package/Utils/Suggestions/TracePerformanceFixSuggestion.d.mts +6 -0
  148. package/Utils/Suggestions/TracePerformanceFixSuggestion.d.ts +6 -0
  149. package/Utils/Suggestions/TracePerformanceFixSuggestion.js +46 -5
  150. package/package.json +8 -1
  151. package/Utils/Monitor/MonitorCheckScheduleUtil.d.mts +0 -61
  152. package/Utils/Monitor/MonitorCheckScheduleUtil.d.ts +0 -61
  153. package/Utils/Monitor/MonitorCheckScheduleUtil.js +0 -476
  154. package/Utils/Monitor/MonitorCheckScheduleUtil.mjs +0 -3
  155. package/Utils/Monitor/MonitorOverviewFamily.d.mts +0 -39
  156. package/Utils/Monitor/MonitorOverviewFamily.d.ts +0 -39
  157. package/Utils/Monitor/MonitorOverviewFamily.js +0 -206
  158. package/Utils/Monitor/MonitorOverviewFamily.mjs +0 -4
  159. package/Utils/Monitor/MonitorOverviewPresentationUtil.d.mts +0 -189
  160. package/Utils/Monitor/MonitorOverviewPresentationUtil.d.ts +0 -189
  161. package/Utils/Monitor/MonitorOverviewPresentationUtil.js +0 -1480
  162. package/Utils/Monitor/MonitorOverviewPresentationUtil.mjs +0 -5
  163. package/Utils/Monitor/MonitorOverviewProbeUtil.d.mts +0 -112
  164. package/Utils/Monitor/MonitorOverviewProbeUtil.d.ts +0 -112
  165. package/Utils/Monitor/MonitorOverviewProbeUtil.js +0 -640
  166. package/Utils/Monitor/MonitorOverviewProbeUtil.mjs +0 -3
  167. package/Utils/Monitor/MonitorStatusHistoryUtil.d.mts +0 -27
  168. package/Utils/Monitor/MonitorStatusHistoryUtil.d.ts +0 -27
  169. package/Utils/Monitor/MonitorStatusHistoryUtil.js +0 -132
  170. package/Utils/Monitor/MonitorStatusHistoryUtil.mjs +0 -2
  171. package/Utils/Monitor/MonitorUptimeSummaryUtil.d.mts +0 -42
  172. package/Utils/Monitor/MonitorUptimeSummaryUtil.d.ts +0 -42
  173. package/Utils/Monitor/MonitorUptimeSummaryUtil.js +0 -468
  174. package/Utils/Monitor/MonitorUptimeSummaryUtil.mjs +0 -2
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.buildOnCallPageSms = exports.describeWhatHappened = exports.MAX_PAGE_SMS_SEGMENTS = exports.MIN_TITLE_CHARACTERS = exports.ON_CALL_PAGE_SMS_CUT_MARK = exports.ON_CALL_PAGE_SMS_ACTION = exports.ON_CALL_PAGE_SMS_KIND_WORDS = exports.OnCallPageSmsKind = void 0;
6
+ exports.buildOnCallPageSms = exports.describeWhatHappened = exports.MAX_PAGE_SMS_SEGMENTS = exports.MIN_TITLE_CHARACTERS = exports.ON_CALL_PAGE_SMS_CUT_MARK = exports.ON_CALL_PAGE_SMS_STILL_NOT_RESOLVED = exports.ON_CALL_PAGE_SMS_ACTION = exports.ON_CALL_PAGE_SMS_KIND_WORDS = exports.OnCallPageSmsKind = void 0;
7
7
  const Text_1 = __importDefault(require("../../Types/Text"));
8
8
  const Gsm7Text_1 = require("./Gsm7Text");
9
9
  const SmsSegments_1 = require("./SmsSegments");
@@ -24,6 +24,16 @@ const SmsSegments_1 = require("./SmsSegments");
24
24
  * project, the title and the link. A severity named after what it rates
25
25
  * ("Critical Incident") is not followed by the word again.
26
26
  *
27
+ * A PAGE AGAIN - a policy paging again because a record acknowledged a while
28
+ * ago is still not resolved (OnCallAcknowledgementTimeout) - says so after
29
+ * the project, where a first page goes straight on to the title:
30
+ *
31
+ * OneUptime: Critical Incident INC-42 in Acme Prod is still not resolved:
32
+ * Checkout API is down. Ack or escalate: https://oneuptime.com/l/XJlaZRsd
33
+ *
34
+ * The person paged acknowledged it once already; worded as a first page,
35
+ * the text read like a second alarm about something new.
36
+ *
27
37
  * THE FITTING RULE. The text takes the fewest parts it can, trying for one
28
38
  * part, then two, and so on. For each number of parts:
29
39
  *
@@ -35,7 +45,8 @@ const SmsSegments_1 = require("./SmsSegments");
35
45
  * happened, so then the text takes one more part instead.
36
46
  *
37
47
  * The product name, the severity, the number and the link are never cut:
38
- * they say who sends it, how bad it is, which one it is and where to act.
48
+ * they say who sends it, how bad it is, which one it is and where to act -
49
+ * and nor is a page again's "is still not resolved", which says why.
39
50
  *
40
51
  * Every value is written in the characters an SMS carries cheaply
41
52
  * (Gsm7Text): a curly quote or an emoji in a title no longer makes the page
@@ -68,6 +79,8 @@ exports.ON_CALL_PAGE_SMS_KIND_WORDS = {
68
79
  * it: the same word as every other place says (OnCallPagePassOn).
69
80
  */
70
81
  exports.ON_CALL_PAGE_SMS_ACTION = "Ack or escalate:";
82
+ // What a page again says after the project: the record is still open.
83
+ exports.ON_CALL_PAGE_SMS_STILL_NOT_RESOLVED = "is still not resolved";
71
84
  // What a cut title ends with: three full stops, which GSM-7 has (… it has not).
72
85
  exports.ON_CALL_PAGE_SMS_CUT_MARK = "...";
73
86
  // The fewest characters of a title a cut leaves.
@@ -163,6 +176,9 @@ const compose = (parts, options) => {
163
176
  if (options.withProject && parts.projectName) {
164
177
  head += ` in ${parts.projectName}`;
165
178
  }
179
+ if (parts.isPageAgain) {
180
+ head += ` ${exports.ON_CALL_PAGE_SMS_STILL_NOT_RESOLVED}`;
181
+ }
166
182
  let sentence = head;
167
183
  if (options.title) {
168
184
  sentence += `: ${options.title}`;
@@ -230,6 +246,7 @@ const buildOnCallPageSms = (input) => {
230
246
  projectName: toSmsValue(input.projectName),
231
247
  title: Array.from(toSmsValue(input.title)),
232
248
  link: input.link.trim(),
249
+ isPageAgain: input.isPageAgain === true,
233
250
  };
234
251
  const wholeTitle = parts.title.join("");
235
252
  const measure = (text) => {
@@ -4,6 +4,7 @@ export const MIN_TITLE_CHARACTERS = commonJsModule.MIN_TITLE_CHARACTERS;
4
4
  export const ON_CALL_PAGE_SMS_ACTION = commonJsModule.ON_CALL_PAGE_SMS_ACTION;
5
5
  export const ON_CALL_PAGE_SMS_CUT_MARK = commonJsModule.ON_CALL_PAGE_SMS_CUT_MARK;
6
6
  export const ON_CALL_PAGE_SMS_KIND_WORDS = commonJsModule.ON_CALL_PAGE_SMS_KIND_WORDS;
7
+ export const ON_CALL_PAGE_SMS_STILL_NOT_RESOLVED = commonJsModule.ON_CALL_PAGE_SMS_STILL_NOT_RESOLVED;
7
8
  export const OnCallPageSmsKind = commonJsModule.OnCallPageSmsKind;
8
9
  export const buildOnCallPageSms = commonJsModule.buildOnCallPageSms;
9
10
  export const describeWhatHappened = commonJsModule.describeWhatHappened;
@@ -0,0 +1,2 @@
1
+ export declare const writeDefaultSubscriberSms: (text: string) => string;
2
+ export default writeDefaultSubscriberSms;
@@ -0,0 +1,2 @@
1
+ export declare const writeDefaultSubscriberSms: (text: string) => string;
2
+ export default writeDefaultSubscriberSms;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writeDefaultSubscriberSms = void 0;
4
+ const Gsm7Text_1 = require("./Gsm7Text");
5
+ /*
6
+ * THE TEXT MESSAGES A STATUS PAGE'S SUBSCRIBERS GET, AS ONEUPTIME WRITES THEM.
7
+ *
8
+ * A status page texts its SMS subscribers about incidents, their states and
9
+ * notes, incident episodes, scheduled maintenance, announcements and
10
+ * postmortems, and about their own subscription (the confirmation link, the
11
+ * welcome, the manage link). A single character outside the GSM 7-bit
12
+ * alphabet - a curly apostrophe in an incident's title or in the page's
13
+ * name, an en dash, an emoji - made the whole text UCS-2, 70 characters a
14
+ * part instead of 160, so each subscriber's text cost two or three times as
15
+ * much (SmsSegments).
16
+ *
17
+ * OneUptime's own texts are written in GSM-7's characters wherever a
18
+ * character has a plain look-alike (Gsm7Text: curly quotes as ' and ",
19
+ * dashes as -, an emoji left out), as an on-call page's are. The links - the
20
+ * details link, and the unsubscribe or confirmation link with its token -
21
+ * go out exactly as written: a link is an address, and a look-alike would
22
+ * lead somewhere else. Letters of other scripts are kept as written.
23
+ *
24
+ * A custom SMS template a team wrote for its page goes out as written, with
25
+ * every value it places: the team chose its words and texts through its own
26
+ * Twilio account (a custom SMS template is used only with one), where
27
+ * Twilio's own Smart Encoding can do the same if they want it.
28
+ *
29
+ * Pure, with no Node or browser APIs. Linear in the text's length.
30
+ */
31
+ const writeDefaultSubscriberSms = (text) => {
32
+ return (0, Gsm7Text_1.toGsm7Message)(text).trim();
33
+ };
34
+ exports.writeDefaultSubscriberSms = writeDefaultSubscriberSms;
35
+ exports.default = exports.writeDefaultSubscriberSms;
@@ -0,0 +1,3 @@
1
+ import commonJsModule from "./SubscriberSms.js";
2
+ export default commonJsModule.default;
3
+ export const writeDefaultSubscriberSms = commonJsModule.writeDefaultSubscriberSms;
@@ -1,9 +1,24 @@
1
+ import AIRunStatus from "../../Types/AI/AIRunStatus.mjs";
2
+ import { CodeTaskStateInput } from "../../Types/AI/CodeTask.mjs";
1
3
  import SuggestionOffer from "./SuggestionOffer.mjs";
2
4
  export interface CodeFixSuggestionInput {
3
5
  isAiEnabled: boolean;
4
6
  applies: boolean;
5
7
  hasActiveFix: boolean;
8
+ hasFinishedFix?: boolean | undefined;
6
9
  hasConnectedRepository: boolean;
10
+ isBlocked?: boolean | undefined;
7
11
  isBackedByEvidence: boolean;
8
12
  }
9
13
  export declare function getCodeFixOffer(input: CodeFixSuggestionInput): SuggestionOffer;
14
+ export declare enum FinishedFixOutcome {
15
+ Fixed = "Fixed",
16
+ NothingToChange = "NothingToChange",
17
+ WaitingForYou = "WaitingForYou"
18
+ }
19
+ export declare function parseFinishedFixOutcome(value: unknown): FinishedFixOutcome | null;
20
+ export declare const FINISHED_FIX_STATUSES: ReadonlyArray<AIRunStatus>;
21
+ export declare function getFinishedFixOutcome(data: {
22
+ fix: CodeTaskStateInput;
23
+ latestTurn: CodeTaskStateInput;
24
+ }): FinishedFixOutcome | null;
@@ -1,9 +1,24 @@
1
+ import AIRunStatus from "../../Types/AI/AIRunStatus";
2
+ import { CodeTaskStateInput } from "../../Types/AI/CodeTask";
1
3
  import SuggestionOffer from "./SuggestionOffer";
2
4
  export interface CodeFixSuggestionInput {
3
5
  isAiEnabled: boolean;
4
6
  applies: boolean;
5
7
  hasActiveFix: boolean;
8
+ hasFinishedFix?: boolean | undefined;
6
9
  hasConnectedRepository: boolean;
10
+ isBlocked?: boolean | undefined;
7
11
  isBackedByEvidence: boolean;
8
12
  }
9
13
  export declare function getCodeFixOffer(input: CodeFixSuggestionInput): SuggestionOffer;
14
+ export declare enum FinishedFixOutcome {
15
+ Fixed = "Fixed",
16
+ NothingToChange = "NothingToChange",
17
+ WaitingForYou = "WaitingForYou"
18
+ }
19
+ export declare function parseFinishedFixOutcome(value: unknown): FinishedFixOutcome | null;
20
+ export declare const FINISHED_FIX_STATUSES: ReadonlyArray<AIRunStatus>;
21
+ export declare function getFinishedFixOutcome(data: {
22
+ fix: CodeTaskStateInput;
23
+ latestTurn: CodeTaskStateInput;
24
+ }): FinishedFixOutcome | null;
@@ -3,7 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FINISHED_FIX_STATUSES = exports.FinishedFixOutcome = void 0;
6
7
  exports.getCodeFixOffer = getCodeFixOffer;
8
+ exports.parseFinishedFixOutcome = parseFinishedFixOutcome;
9
+ exports.getFinishedFixOutcome = getFinishedFixOutcome;
10
+ const AIRunStatus_1 = __importDefault(require("../../Types/AI/AIRunStatus"));
11
+ const CodeTask_1 = require("../../Types/AI/CodeTask");
7
12
  const SuggestionOffer_1 = __importDefault(require("./SuggestionOffer"));
8
13
  function getCodeFixOffer(input) {
9
14
  if (!input.isAiEnabled || !input.applies) {
@@ -12,10 +17,66 @@ function getCodeFixOffer(input) {
12
17
  if (input.hasActiveFix) {
13
18
  return SuggestionOffer_1.default.InProgress;
14
19
  }
15
- if (!input.hasConnectedRepository) {
20
+ if (input.hasFinishedFix) {
21
+ return SuggestionOffer_1.default.Done;
22
+ }
23
+ if (!input.hasConnectedRepository || input.isBlocked) {
16
24
  return input.isBackedByEvidence
17
25
  ? SuggestionOffer_1.default.SetUp
18
26
  : SuggestionOffer_1.default.None;
19
27
  }
20
28
  return SuggestionOffer_1.default.Act;
21
29
  }
30
+ /*
31
+ * How a fix that did its work came out (a Done offer), in the words its
32
+ * task says it in, in Code: its pull request is open for review, the AI
33
+ * read the code and found nothing to change, or it stopped with a question
34
+ * for the person.
35
+ */
36
+ var FinishedFixOutcome;
37
+ (function (FinishedFixOutcome) {
38
+ FinishedFixOutcome["Fixed"] = "Fixed";
39
+ FinishedFixOutcome["NothingToChange"] = "NothingToChange";
40
+ FinishedFixOutcome["WaitingForYou"] = "WaitingForYou";
41
+ })(FinishedFixOutcome || (exports.FinishedFixOutcome = FinishedFixOutcome = {}));
42
+ const ALL_FINISHED_FIX_OUTCOMES = Object.values(FinishedFixOutcome);
43
+ // Reads an outcome off the wire; anything this build does not know is null.
44
+ function parseFinishedFixOutcome(value) {
45
+ if (typeof value === "string" && ALL_FINISHED_FIX_OUTCOMES.includes(value)) {
46
+ return value;
47
+ }
48
+ return null;
49
+ }
50
+ // The run statuses of a fix that did its work.
51
+ exports.FINISHED_FIX_STATUSES = [
52
+ AIRunStatus_1.default.Completed,
53
+ AIRunStatus_1.default.NoFixFound,
54
+ ];
55
+ /*
56
+ * How a fix that did its work stands now, from the fix itself (its task's
57
+ * first turn) and the task's latest turn - a reply someone sent in Code, or
58
+ * the fix again when nobody has replied - as Code reads the task
59
+ * (CodeTaskStateUtil):
60
+ *
61
+ * - null while the task is working again (a reply is under way): the
62
+ * page links to it as work in progress;
63
+ * - WaitingForYou while the task waits for an answer;
64
+ * - otherwise how the fix came out: nothing to change when it found
65
+ * nothing, its pull request when it made one. A reply that failed or
66
+ * was stopped leaves the fix as it came out.
67
+ *
68
+ * A fix that did not do its work (it failed, or was stopped) is no
69
+ * finished fix: the caller offers it again.
70
+ */
71
+ function getFinishedFixOutcome(data) {
72
+ const state = CodeTask_1.CodeTaskStateUtil.fromRun(data.latestTurn);
73
+ if (state === CodeTask_1.CodeTaskState.Working) {
74
+ return null;
75
+ }
76
+ if (state === CodeTask_1.CodeTaskState.WaitingForYou) {
77
+ return FinishedFixOutcome.WaitingForYou;
78
+ }
79
+ return data.fix.status === AIRunStatus_1.default.NoFixFound
80
+ ? FinishedFixOutcome.NothingToChange
81
+ : FinishedFixOutcome.Fixed;
82
+ }
@@ -1,2 +1,6 @@
1
1
  import commonJsModule from "./CodeFixSuggestion.js";
2
+ export const FINISHED_FIX_STATUSES = commonJsModule.FINISHED_FIX_STATUSES;
3
+ export const FinishedFixOutcome = commonJsModule.FinishedFixOutcome;
2
4
  export const getCodeFixOffer = commonJsModule.getCodeFixOffer;
5
+ export const getFinishedFixOutcome = commonJsModule.getFinishedFixOutcome;
6
+ export const parseFinishedFixOutcome = commonJsModule.parseFinishedFixOutcome;
@@ -292,6 +292,10 @@ function parseProfileFixSuggestion(value) {
292
292
  blocker,
293
293
  repository });
294
294
  }
295
+ // A finished fix is something this suggestion never says (it says None).
296
+ if (offer !== SuggestionOffer_1.default.Act) {
297
+ return exports.NO_PROFILE_FIX_SUGGESTION;
298
+ }
295
299
  // Act: somewhere to ask it.
296
300
  if (!repository && repositories.length === 0) {
297
301
  return exports.NO_PROFILE_FIX_SUGGESTION;
@@ -0,0 +1,8 @@
1
+ import { CodeTaskBlocker } from "../../Types/AI/CodeTask.mjs";
2
+ import { JSONObject } from "../../Types/JSON.mjs";
3
+ export interface SuggestionBlocker extends CodeTaskBlocker {
4
+ repositoryId?: string | undefined;
5
+ }
6
+ export declare function toSuggestionBlocker(blocker: CodeTaskBlocker, repositoryId?: string | null | undefined): SuggestionBlocker;
7
+ export declare function parseSuggestionBlocker(value: unknown): SuggestionBlocker | null;
8
+ export declare function suggestionBlockerToJSON(blocker: SuggestionBlocker): JSONObject;
@@ -0,0 +1,8 @@
1
+ import { CodeTaskBlocker } from "../../Types/AI/CodeTask";
2
+ import { JSONObject } from "../../Types/JSON";
3
+ export interface SuggestionBlocker extends CodeTaskBlocker {
4
+ repositoryId?: string | undefined;
5
+ }
6
+ export declare function toSuggestionBlocker(blocker: CodeTaskBlocker, repositoryId?: string | null | undefined): SuggestionBlocker;
7
+ export declare function parseSuggestionBlocker(value: unknown): SuggestionBlocker | null;
8
+ export declare function suggestionBlockerToJSON(blocker: SuggestionBlocker): JSONObject;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toSuggestionBlocker = toSuggestionBlocker;
4
+ exports.parseSuggestionBlocker = parseSuggestionBlocker;
5
+ exports.suggestionBlockerToJSON = suggestionBlockerToJSON;
6
+ const CodeTask_1 = require("../../Types/AI/CodeTask");
7
+ // Code's gate's answer as a suggestion carries it.
8
+ function toSuggestionBlocker(blocker, repositoryId) {
9
+ return Object.assign(Object.assign({ type: blocker.type, message: blocker.message }, (blocker.runnerName ? { runnerName: blocker.runnerName } : {})), (repositoryId ? { repositoryId } : {}));
10
+ }
11
+ function isBlockerType(value) {
12
+ return (typeof value === "string" &&
13
+ Object.values(CodeTask_1.CodeTaskBlockerType).includes(value));
14
+ }
15
+ function readText(value) {
16
+ return typeof value === "string" && value.trim().length > 0 ? value : null;
17
+ }
18
+ /*
19
+ * Reads a blocker off the wire, or null when it is not one this build can
20
+ * draw: a type it does not know, or no sentence to fall back on.
21
+ */
22
+ function parseSuggestionBlocker(value) {
23
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
24
+ return null;
25
+ }
26
+ const record = value;
27
+ if (!isBlockerType(record["type"])) {
28
+ return null;
29
+ }
30
+ const message = readText(record["message"]);
31
+ if (!message) {
32
+ return null;
33
+ }
34
+ const blocker = {
35
+ type: record["type"],
36
+ message,
37
+ };
38
+ const runnerName = readText(record["runnerName"]);
39
+ if (runnerName) {
40
+ blocker.runnerName = runnerName;
41
+ }
42
+ const repositoryId = readText(record["repositoryId"]);
43
+ if (repositoryId) {
44
+ blocker.repositoryId = repositoryId;
45
+ }
46
+ return blocker;
47
+ }
48
+ // A blocker as JSON (the server's side of the reader above).
49
+ function suggestionBlockerToJSON(blocker) {
50
+ return Object.assign(Object.assign({ type: blocker.type, message: blocker.message }, (blocker.runnerName ? { runnerName: blocker.runnerName } : {})), (blocker.repositoryId ? { repositoryId: blocker.repositoryId } : {}));
51
+ }
@@ -0,0 +1,4 @@
1
+ import commonJsModule from "./SuggestionBlocker.js";
2
+ export const parseSuggestionBlocker = commonJsModule.parseSuggestionBlocker;
3
+ export const suggestionBlockerToJSON = commonJsModule.suggestionBlockerToJSON;
4
+ export const toSuggestionBlocker = commonJsModule.toSuggestionBlocker;
@@ -2,7 +2,8 @@ declare enum SuggestionOffer {
2
2
  None = "None",
3
3
  Act = "Act",
4
4
  SetUp = "SetUp",
5
- InProgress = "InProgress"
5
+ InProgress = "InProgress",
6
+ Done = "Done"
6
7
  }
7
8
  export default SuggestionOffer;
8
9
  export declare function parseSuggestionOffer(value: unknown): SuggestionOffer;
@@ -2,7 +2,8 @@ declare enum SuggestionOffer {
2
2
  None = "None",
3
3
  Act = "Act",
4
4
  SetUp = "SetUp",
5
- InProgress = "InProgress"
5
+ InProgress = "InProgress",
6
+ Done = "Done"
6
7
  }
7
8
  export default SuggestionOffer;
8
9
  export declare function parseSuggestionOffer(value: unknown): SuggestionOffer;
@@ -37,6 +37,11 @@ var SuggestionOffer;
37
37
  * links to that work instead of offering it a second time.
38
38
  */
39
39
  SuggestionOffer["InProgress"] = "InProgress";
40
+ /*
41
+ * Somebody already acted on it and the work is done: the page says how
42
+ * it came out and links to it, instead of offering it a second time.
43
+ */
44
+ SuggestionOffer["Done"] = "Done";
40
45
  })(SuggestionOffer || (SuggestionOffer = {}));
41
46
  exports.default = SuggestionOffer;
42
47
  const ALL_OFFERS = Object.values(SuggestionOffer);
@@ -1,16 +1,11 @@
1
- import { CodeTaskBlockerType } from "../../Types/AI/CodeTask.mjs";
2
1
  import { JSONObject } from "../../Types/JSON.mjs";
2
+ import { SuggestionBlocker } from "./SuggestionBlocker.mjs";
3
3
  import SuggestionOffer from "./SuggestionOffer.mjs";
4
4
  export interface TelemetryAiFixRepository {
5
5
  id: string;
6
6
  name: string;
7
7
  }
8
- export interface TelemetryAiFixBlocker {
9
- type: CodeTaskBlockerType;
10
- message: string;
11
- runnerName?: string | undefined;
12
- repositoryId?: string | undefined;
13
- }
8
+ export type TelemetryAiFixBlocker = SuggestionBlocker;
14
9
  export interface TelemetryAiFixSuggestion {
15
10
  offer: SuggestionOffer;
16
11
  blocker: TelemetryAiFixBlocker | null;
@@ -1,16 +1,11 @@
1
- import { CodeTaskBlockerType } from "../../Types/AI/CodeTask";
2
1
  import { JSONObject } from "../../Types/JSON";
2
+ import { SuggestionBlocker } from "./SuggestionBlocker";
3
3
  import SuggestionOffer from "./SuggestionOffer";
4
4
  export interface TelemetryAiFixRepository {
5
5
  id: string;
6
6
  name: string;
7
7
  }
8
- export interface TelemetryAiFixBlocker {
9
- type: CodeTaskBlockerType;
10
- message: string;
11
- runnerName?: string | undefined;
12
- repositoryId?: string | undefined;
13
- }
8
+ export type TelemetryAiFixBlocker = SuggestionBlocker;
14
9
  export interface TelemetryAiFixSuggestion {
15
10
  offer: SuggestionOffer;
16
11
  blocker: TelemetryAiFixBlocker | null;
@@ -40,6 +40,7 @@ exports.telemetryAiFixSuggestionToJSON = telemetryAiFixSuggestionToJSON;
40
40
  const CodeTask_1 = require("../../Types/AI/CodeTask");
41
41
  const CodeFixTaskType_1 = require("../../Types/AI/CodeFixTaskType");
42
42
  const CodeFixSuggestion_1 = require("./CodeFixSuggestion");
43
+ const SuggestionBlocker_1 = require("./SuggestionBlocker");
43
44
  const SuggestionOffer_1 = __importStar(require("./SuggestionOffer"));
44
45
  exports.NO_TELEMETRY_AI_FIX_SUGGESTION = {
45
46
  offer: SuggestionOffer_1.default.None,
@@ -79,10 +80,6 @@ function getTelemetryAiFixOffer(input) {
79
80
  }
80
81
  return { offer, blocker: null };
81
82
  }
82
- function isBlockerType(value) {
83
- return (typeof value === "string" &&
84
- Object.values(CodeTask_1.CodeTaskBlockerType).includes(value));
85
- }
86
83
  function readText(value) {
87
84
  return typeof value === "string" && value.trim().length > 0 ? value : null;
88
85
  }
@@ -95,32 +92,6 @@ function parseRepository(value) {
95
92
  const name = readText(record["name"]);
96
93
  return id && name ? { id, name } : null;
97
94
  }
98
- function parseBlocker(value) {
99
- if (!value || typeof value !== "object" || Array.isArray(value)) {
100
- return null;
101
- }
102
- const record = value;
103
- if (!isBlockerType(record["type"])) {
104
- return null;
105
- }
106
- const message = readText(record["message"]);
107
- if (!message) {
108
- return null;
109
- }
110
- const blocker = {
111
- type: record["type"],
112
- message,
113
- };
114
- const runnerName = readText(record["runnerName"]);
115
- if (runnerName) {
116
- blocker.runnerName = runnerName;
117
- }
118
- const repositoryId = readText(record["repositoryId"]);
119
- if (repositoryId) {
120
- blocker.repositoryId = repositoryId;
121
- }
122
- return blocker;
123
- }
124
95
  /*
125
96
  * Reads the suggestion route's answer. Whatever does not hold together - an
126
97
  * in-progress offer with no task, a set-up step with no blocker, an action
@@ -141,11 +112,15 @@ function parseTelemetryAiFixSuggestion(value) {
141
112
  return taskId
142
113
  ? Object.assign(Object.assign({}, exports.NO_TELEMETRY_AI_FIX_SUGGESTION), { offer, taskId }) : exports.NO_TELEMETRY_AI_FIX_SUGGESTION;
143
114
  }
144
- const blocker = parseBlocker(record["blocker"]);
115
+ const blocker = (0, SuggestionBlocker_1.parseSuggestionBlocker)(record["blocker"]);
145
116
  if (offer === SuggestionOffer_1.default.SetUp) {
146
117
  return blocker
147
118
  ? Object.assign(Object.assign({}, exports.NO_TELEMETRY_AI_FIX_SUGGESTION), { offer, blocker }) : exports.NO_TELEMETRY_AI_FIX_SUGGESTION;
148
119
  }
120
+ // A finished fix is something this suggestion never says (it says None).
121
+ if (offer !== SuggestionOffer_1.default.Act) {
122
+ return exports.NO_TELEMETRY_AI_FIX_SUGGESTION;
123
+ }
149
124
  const repository = parseRepository(record["repository"]);
150
125
  const repositories = (Array.isArray(record["repositories"])
151
126
  ? record["repositories"]
@@ -166,11 +141,8 @@ function parseTelemetryAiFixSuggestion(value) {
166
141
  // The route's answer as JSON (the server's side of the parser above).
167
142
  function telemetryAiFixSuggestionToJSON(suggestion) {
168
143
  const blocker = suggestion.blocker
169
- ? Object.assign(Object.assign({ type: suggestion.blocker.type, message: suggestion.blocker.message }, (suggestion.blocker.runnerName
170
- ? { runnerName: suggestion.blocker.runnerName }
171
- : {})), (suggestion.blocker.repositoryId
172
- ? { repositoryId: suggestion.blocker.repositoryId }
173
- : {})) : null;
144
+ ? (0, SuggestionBlocker_1.suggestionBlockerToJSON)(suggestion.blocker)
145
+ : null;
174
146
  return Object.assign({ offer: suggestion.offer, blocker, repository: suggestion.repository
175
147
  ? { id: suggestion.repository.id, name: suggestion.repository.name }
176
148
  : null, repositories: suggestion.repositories.map((repository) => {
@@ -4,6 +4,7 @@ export interface TelemetryImprovementOfferInput {
4
4
  isAiEnabled: boolean;
5
5
  hasActiveFix: boolean;
6
6
  hasConnectedRepository: boolean;
7
+ isBlocked?: boolean | undefined;
7
8
  }
8
9
  export declare function getTelemetryImprovementOffer(input: TelemetryImprovementOfferInput): SuggestionOffer;
9
10
  export interface TelemetryImprovementSuggestion {
@@ -4,6 +4,7 @@ export interface TelemetryImprovementOfferInput {
4
4
  isAiEnabled: boolean;
5
5
  hasActiveFix: boolean;
6
6
  hasConnectedRepository: boolean;
7
+ isBlocked?: boolean | undefined;
7
8
  }
8
9
  export declare function getTelemetryImprovementOffer(input: TelemetryImprovementOfferInput): SuggestionOffer;
9
10
  export interface TelemetryImprovementSuggestion {
@@ -45,6 +45,7 @@ function getTelemetryImprovementOffer(input) {
45
45
  applies: true,
46
46
  hasActiveFix: input.hasActiveFix,
47
47
  hasConnectedRepository: input.hasConnectedRepository,
48
+ isBlocked: input.isBlocked,
48
49
  isBackedByEvidence: false,
49
50
  });
50
51
  }
@@ -1,5 +1,7 @@
1
1
  import { PerformanceFinding, PerformanceFindingType } from "../../Types/AI/CodeFixTaskContext.mjs";
2
2
  import { JSONObject } from "../../Types/JSON.mjs";
3
+ import { FinishedFixOutcome } from "./CodeFixSuggestion.mjs";
4
+ import { SuggestionBlocker } from "./SuggestionBlocker.mjs";
3
5
  import SuggestionOffer from "./SuggestionOffer.mjs";
4
6
  export declare const WORTH_FIXING_MIN_MS: Readonly<Record<PerformanceFindingType, number>>;
5
7
  export declare const WORTH_FIXING_MIN_PERCENT_OF_TRACE: number;
@@ -10,12 +12,16 @@ export interface TracePerformanceFixOfferInput {
10
12
  findings: ReadonlyArray<PerformanceFinding>;
11
13
  isAiEnabled: boolean;
12
14
  hasActiveFix: boolean;
15
+ finishedFix?: FinishedFixOutcome | null | undefined;
13
16
  hasConnectedRepository: boolean;
17
+ blocker?: SuggestionBlocker | null | undefined;
14
18
  }
15
19
  export interface TracePerformanceFixOffer {
16
20
  offer: SuggestionOffer;
17
21
  finding: PerformanceFinding | null;
18
22
  findingCount: number;
23
+ fixOutcome: FinishedFixOutcome | null;
24
+ blocker: SuggestionBlocker | null;
19
25
  }
20
26
  export declare function getTracePerformanceFixOffer(input: TracePerformanceFixOfferInput): TracePerformanceFixOffer;
21
27
  export declare function isDatabaseFinding(finding: PerformanceFinding): boolean;
@@ -1,5 +1,7 @@
1
1
  import { PerformanceFinding, PerformanceFindingType } from "../../Types/AI/CodeFixTaskContext";
2
2
  import { JSONObject } from "../../Types/JSON";
3
+ import { FinishedFixOutcome } from "./CodeFixSuggestion";
4
+ import { SuggestionBlocker } from "./SuggestionBlocker";
3
5
  import SuggestionOffer from "./SuggestionOffer";
4
6
  export declare const WORTH_FIXING_MIN_MS: Readonly<Record<PerformanceFindingType, number>>;
5
7
  export declare const WORTH_FIXING_MIN_PERCENT_OF_TRACE: number;
@@ -10,12 +12,16 @@ export interface TracePerformanceFixOfferInput {
10
12
  findings: ReadonlyArray<PerformanceFinding>;
11
13
  isAiEnabled: boolean;
12
14
  hasActiveFix: boolean;
15
+ finishedFix?: FinishedFixOutcome | null | undefined;
13
16
  hasConnectedRepository: boolean;
17
+ blocker?: SuggestionBlocker | null | undefined;
14
18
  }
15
19
  export interface TracePerformanceFixOffer {
16
20
  offer: SuggestionOffer;
17
21
  finding: PerformanceFinding | null;
18
22
  findingCount: number;
23
+ fixOutcome: FinishedFixOutcome | null;
24
+ blocker: SuggestionBlocker | null;
19
25
  }
20
26
  export declare function getTracePerformanceFixOffer(input: TracePerformanceFixOfferInput): TracePerformanceFixOffer;
21
27
  export declare function isDatabaseFinding(finding: PerformanceFinding): boolean;