@mondaydotcomorg/z2h-shared-utils 0.18.0 → 0.19.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.
@@ -13,4 +13,6 @@ export declare const PREVIEW_APP_NAME_PREFIX = "zth-preview-";
13
13
  export declare const APP_USAGE_BUCKET_NAME = "de-integration-bigbrain";
14
14
  export declare const APP_USAGE_PREFIX = "prod/studio/entity=app_usage";
15
15
  export declare const appUsageFolder: (appName: string, appId: number) => string;
16
+ export declare const RECOVERY_SNAPSHOT_RESULTS: readonly ["saved", "clean", "no-remote", "no-master"];
17
+ export type RecoverySnapshotResult = (typeof RECOVERY_SNAPSHOT_RESULTS)[number];
16
18
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,qCAAqC,CAAC;AACpE,eAAO,MAAM,MAAM,cAAc,CAAC;AAClC,eAAO,MAAM,gBAAgB,wEAA4D,CAAC;AAE1F,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAC7D,eAAO,MAAM,mBAAmB,+CAAgD,CAAC;AAGjF,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAI7C,eAAO,MAAM,YAAY,cAAc,CAAC;AACxC,eAAO,MAAM,iBAAiB,yDAA2C,CAAC;AAG1E,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AAGrE,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAGhD,eAAO,MAAM,gBAAgB,QAA2B,CAAC;AAEzD,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAGtD,eAAO,MAAM,qBAAqB,4BAA4B,CAAC;AAC/D,eAAO,MAAM,gBAAgB,iCAAiC,CAAC;AAC/D,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,EAAE,OAAO,MAAM,WAA8C,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,qCAAqC,CAAC;AACpE,eAAO,MAAM,MAAM,cAAc,CAAC;AAClC,eAAO,MAAM,gBAAgB,wEAA4D,CAAC;AAE1F,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAC7D,eAAO,MAAM,mBAAmB,+CAAgD,CAAC;AAGjF,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAI7C,eAAO,MAAM,YAAY,cAAc,CAAC;AACxC,eAAO,MAAM,iBAAiB,yDAA2C,CAAC;AAG1E,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AAGrE,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAGhD,eAAO,MAAM,gBAAgB,QAA2B,CAAC;AAEzD,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAGtD,eAAO,MAAM,qBAAqB,4BAA4B,CAAC;AAC/D,eAAO,MAAM,gBAAgB,iCAAiC,CAAC;AAC/D,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,EAAE,OAAO,MAAM,WAA8C,CAAC;AAG5G,eAAO,MAAM,yBAAyB,uDAAwD,CAAC;AAC/F,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC"}
package/dist/constants.js CHANGED
@@ -22,6 +22,8 @@ const PREVIEW_APP_NAME_PREFIX = 'zth-preview-';
22
22
  const APP_USAGE_BUCKET_NAME = 'de-integration-bigbrain';
23
23
  const APP_USAGE_PREFIX = 'prod/studio/entity=app_usage';
24
24
  const appUsageFolder = (appName, appId) => `${APP_USAGE_PREFIX}/${appName}_${appId}`;
25
+ // `z2h-cli recovery-snapshot`'s JSON `result`: what it did with an app's local work. The agent reads it.
26
+ const RECOVERY_SNAPSHOT_RESULTS = ['saved', 'clean', 'no-remote', 'no-master'];
25
27
 
26
28
  exports.APP_NAME_PATTERN = APP_NAME_PATTERN;
27
29
  exports.APP_USAGE_BUCKET_NAME = APP_USAGE_BUCKET_NAME;
@@ -34,6 +36,7 @@ exports.DATAVIZ_SKILLS_PREFIX = DATAVIZ_SKILLS_PREFIX;
34
36
  exports.MANIFEST_KEY = MANIFEST_KEY;
35
37
  exports.MANIFEST_READ_URL = MANIFEST_READ_URL;
36
38
  exports.PREVIEW_APP_NAME_PREFIX = PREVIEW_APP_NAME_PREFIX;
39
+ exports.RECOVERY_SNAPSHOT_RESULTS = RECOVERY_SNAPSHOT_RESULTS;
37
40
  exports.REGION = REGION;
38
41
  exports.S3_PREVIEWS_FOLDER = S3_PREVIEWS_FOLDER;
39
42
  exports.S3_SKILLS_BUCKET_NAME = S3_SKILLS_BUCKET_NAME;
@@ -13,4 +13,6 @@ export declare const PREVIEW_APP_NAME_PREFIX = "zth-preview-";
13
13
  export declare const APP_USAGE_BUCKET_NAME = "de-integration-bigbrain";
14
14
  export declare const APP_USAGE_PREFIX = "prod/studio/entity=app_usage";
15
15
  export declare const appUsageFolder: (appName: string, appId: number) => string;
16
+ export declare const RECOVERY_SNAPSHOT_RESULTS: readonly ["saved", "clean", "no-remote", "no-master"];
17
+ export type RecoverySnapshotResult = (typeof RECOVERY_SNAPSHOT_RESULTS)[number];
16
18
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,qCAAqC,CAAC;AACpE,eAAO,MAAM,MAAM,cAAc,CAAC;AAClC,eAAO,MAAM,gBAAgB,wEAA4D,CAAC;AAE1F,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAC7D,eAAO,MAAM,mBAAmB,+CAAgD,CAAC;AAGjF,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAI7C,eAAO,MAAM,YAAY,cAAc,CAAC;AACxC,eAAO,MAAM,iBAAiB,yDAA2C,CAAC;AAG1E,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AAGrE,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAGhD,eAAO,MAAM,gBAAgB,QAA2B,CAAC;AAEzD,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAGtD,eAAO,MAAM,qBAAqB,4BAA4B,CAAC;AAC/D,eAAO,MAAM,gBAAgB,iCAAiC,CAAC;AAC/D,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,EAAE,OAAO,MAAM,WAA8C,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,qCAAqC,CAAC;AACpE,eAAO,MAAM,MAAM,cAAc,CAAC;AAClC,eAAO,MAAM,gBAAgB,wEAA4D,CAAC;AAE1F,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAC7D,eAAO,MAAM,mBAAmB,+CAAgD,CAAC;AAGjF,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAI7C,eAAO,MAAM,YAAY,cAAc,CAAC;AACxC,eAAO,MAAM,iBAAiB,yDAA2C,CAAC;AAG1E,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AAGrE,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAGhD,eAAO,MAAM,gBAAgB,QAA2B,CAAC;AAEzD,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAGtD,eAAO,MAAM,qBAAqB,4BAA4B,CAAC;AAC/D,eAAO,MAAM,gBAAgB,iCAAiC,CAAC;AAC/D,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,EAAE,OAAO,MAAM,WAA8C,CAAC;AAG5G,eAAO,MAAM,yBAAyB,uDAAwD,CAAC;AAC/F,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -20,5 +20,7 @@ const PREVIEW_APP_NAME_PREFIX = 'zth-preview-';
20
20
  const APP_USAGE_BUCKET_NAME = 'de-integration-bigbrain';
21
21
  const APP_USAGE_PREFIX = 'prod/studio/entity=app_usage';
22
22
  const appUsageFolder = (appName, appId) => `${APP_USAGE_PREFIX}/${appName}_${appId}`;
23
+ // `z2h-cli recovery-snapshot`'s JSON `result`: what it did with an app's local work. The agent reads it.
24
+ const RECOVERY_SNAPSHOT_RESULTS = ['saved', 'clean', 'no-remote', 'no-master'];
23
25
 
24
- export { APP_NAME_PATTERN, APP_USAGE_BUCKET_NAME, APP_USAGE_PREFIX, BUCKET_READ_DNS_NAME, BUCKET_READ_DNS_URL, BUCKET_WRITE_NAME, BUCKET_WRITE_URL, DATAVIZ_SKILLS_PREFIX, MANIFEST_KEY, MANIFEST_READ_URL, PREVIEW_APP_NAME_PREFIX, REGION, S3_PREVIEWS_FOLDER, S3_SKILLS_BUCKET_NAME, appUsageFolder };
26
+ export { APP_NAME_PATTERN, APP_USAGE_BUCKET_NAME, APP_USAGE_PREFIX, BUCKET_READ_DNS_NAME, BUCKET_READ_DNS_URL, BUCKET_WRITE_NAME, BUCKET_WRITE_URL, DATAVIZ_SKILLS_PREFIX, MANIFEST_KEY, MANIFEST_READ_URL, PREVIEW_APP_NAME_PREFIX, RECOVERY_SNAPSHOT_RESULTS, REGION, S3_PREVIEWS_FOLDER, S3_SKILLS_BUCKET_NAME, appUsageFolder };
@@ -1,3 +1,3 @@
1
- export { APP_NAME_PATTERN, APP_USAGE_BUCKET_NAME, APP_USAGE_PREFIX, BUCKET_READ_DNS_NAME, BUCKET_READ_DNS_URL, BUCKET_WRITE_NAME, BUCKET_WRITE_URL, DATAVIZ_SKILLS_PREFIX, MANIFEST_KEY, MANIFEST_READ_URL, PREVIEW_APP_NAME_PREFIX, REGION, S3_PREVIEWS_FOLDER, S3_SKILLS_BUCKET_NAME, appUsageFolder } from './constants.mjs';
1
+ export { APP_NAME_PATTERN, APP_USAGE_BUCKET_NAME, APP_USAGE_PREFIX, BUCKET_READ_DNS_NAME, BUCKET_READ_DNS_URL, BUCKET_WRITE_NAME, BUCKET_WRITE_URL, DATAVIZ_SKILLS_PREFIX, MANIFEST_KEY, MANIFEST_READ_URL, PREVIEW_APP_NAME_PREFIX, RECOVERY_SNAPSHOT_RESULTS, REGION, S3_PREVIEWS_FOLDER, S3_SKILLS_BUCKET_NAME, appUsageFolder } from './constants.mjs';
2
2
  export { z2hAssets } from './z2hAssets.mjs';
3
3
  export { ALWAYS_ON_CHANNELS, CUSTOM_INTEGRATION_HOST_STATUSES, DECLARED_INTEGRATIONS } from './integrations.mjs';
@@ -41,6 +41,12 @@ export declare const BackendRunnerEvents: {
41
41
  readonly customIntegration: {
42
42
  readonly hostDeniedMetric: "z2h.custom_integration.host_denied";
43
43
  };
44
+ readonly mondayFile: {
45
+ readonly transferMetric: "z2h.channel.monday_file.transfer";
46
+ readonly bytesMetric: "z2h.channel.monday_file.bytes";
47
+ readonly phaseDurationMetric: "z2h.channel.monday_file.phase_ms";
48
+ readonly biEvent: "z2h_monday_file_transfer";
49
+ };
44
50
  readonly integrationToken: {
45
51
  readonly decryptFailedMetric: "z2h.integration_token.decrypt_failed";
46
52
  readonly unexpectedShapeMetric: "z2h.integration_token.unexpected_shape";
@@ -100,6 +106,15 @@ export declare const Z2hAgentEvents: {
100
106
  readonly biEvent: "z2h_agent_tool_call";
101
107
  };
102
108
  readonly gitSync: "z2h.agent_git_sync";
109
+ readonly gracefulShutdown: {
110
+ readonly unfinished: "z2h.agent_graceful_shutdown.unfinished";
111
+ };
112
+ readonly commandTracker: {
113
+ readonly stopped: "z2h.agent_command_tracker.stopped";
114
+ readonly appDetected: "z2h.agent_command_tracker.app_detected";
115
+ readonly backgroundLeft: "z2h.agent_command_tracker.background_left";
116
+ readonly scanIncomplete: "z2h.agent_command_tracker.scan_incomplete";
117
+ };
103
118
  };
104
119
  /**
105
120
  * BI events tracked in `z2h-cli`. Every event the CLI sends is named here.
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/observability/events.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CtB,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCnB,CAAC;AAEX,oDAAoD;AACpD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;CAgBjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;CAWf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/observability/events.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDtB,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCnB,CAAC;AAEX,oDAAoD;AACpD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;CAmCjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;CAWf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
@@ -41,6 +41,12 @@ const BackendRunnerEvents = {
41
41
  customIntegration: {
42
42
  hostDeniedMetric: 'z2h.custom_integration.host_denied',
43
43
  },
44
+ mondayFile: {
45
+ transferMetric: 'z2h.channel.monday_file.transfer',
46
+ bytesMetric: 'z2h.channel.monday_file.bytes',
47
+ phaseDurationMetric: 'z2h.channel.monday_file.phase_ms',
48
+ biEvent: 'z2h_monday_file_transfer',
49
+ },
44
50
  integrationToken: {
45
51
  decryptFailedMetric: 'z2h.integration_token.decrypt_failed',
46
52
  unexpectedShapeMetric: 'z2h.integration_token.unexpected_shape',
@@ -102,6 +108,25 @@ const Z2hAgentEvents = {
102
108
  // Distribution of a CLI call's duration in ms, tagged by phase (pull, push), status (success, failure) and,
103
109
  // on a pull, cold: whether it had to clone the app. A push that lost a race is retried inside the CLI.
104
110
  gitSync: 'z2h.agent_git_sync',
111
+ gracefulShutdown: {
112
+ // A turn or a save still running when the shutdown's time ran out, tagged kind (turn, save). Such a turn's work
113
+ // is only in the backup taken at the deadline: its own save never ran.
114
+ unfinished: 'z2h.agent_graceful_shutdown.unfinished',
115
+ },
116
+ commandTracker: {
117
+ // A command (or background processes a finished one left) the tracker stopped, tagged by reason (turn_stopped,
118
+ // turn_end, shutdown) and background: whether its shell had exited already.
119
+ stopped: 'z2h.agent_command_tracker.stopped',
120
+ // An app added to a turn, counted once when it is new to the turn, tagged by the source that found it: z2h-cli's
121
+ // report of the apps it opens (cli), the files a command changed (scan), or a file tool's path (file_tool).
122
+ // `scan` is what neither of the others saw; `other_turn` counts changed apps left to the live turn that owns them.
123
+ appDetected: 'z2h.agent_command_tracker.app_detected',
124
+ // A command left a background job running after its shell exited. What such a job writes later in another app
125
+ // isn't scanned: this shows whether that's worth handling.
126
+ backgroundLeft: 'z2h.agent_command_tracker.background_left',
127
+ // The changed-files scan stopped early (its time limit, or a folder it couldn't read): apps may be missing.
128
+ scanIncomplete: 'z2h.agent_command_tracker.scan_incomplete',
129
+ },
105
130
  };
106
131
  /**
107
132
  * BI events tracked in `z2h-cli`. Every event the CLI sends is named here.
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ exports.DATAVIZ_SKILLS_PREFIX = constants.DATAVIZ_SKILLS_PREFIX;
17
17
  exports.MANIFEST_KEY = constants.MANIFEST_KEY;
18
18
  exports.MANIFEST_READ_URL = constants.MANIFEST_READ_URL;
19
19
  exports.PREVIEW_APP_NAME_PREFIX = constants.PREVIEW_APP_NAME_PREFIX;
20
+ exports.RECOVERY_SNAPSHOT_RESULTS = constants.RECOVERY_SNAPSHOT_RESULTS;
20
21
  exports.REGION = constants.REGION;
21
22
  exports.S3_PREVIEWS_FOLDER = constants.S3_PREVIEWS_FOLDER;
22
23
  exports.S3_SKILLS_BUCKET_NAME = constants.S3_SKILLS_BUCKET_NAME;
@@ -41,6 +41,12 @@ export declare const BackendRunnerEvents: {
41
41
  readonly customIntegration: {
42
42
  readonly hostDeniedMetric: "z2h.custom_integration.host_denied";
43
43
  };
44
+ readonly mondayFile: {
45
+ readonly transferMetric: "z2h.channel.monday_file.transfer";
46
+ readonly bytesMetric: "z2h.channel.monday_file.bytes";
47
+ readonly phaseDurationMetric: "z2h.channel.monday_file.phase_ms";
48
+ readonly biEvent: "z2h_monday_file_transfer";
49
+ };
44
50
  readonly integrationToken: {
45
51
  readonly decryptFailedMetric: "z2h.integration_token.decrypt_failed";
46
52
  readonly unexpectedShapeMetric: "z2h.integration_token.unexpected_shape";
@@ -100,6 +106,15 @@ export declare const Z2hAgentEvents: {
100
106
  readonly biEvent: "z2h_agent_tool_call";
101
107
  };
102
108
  readonly gitSync: "z2h.agent_git_sync";
109
+ readonly gracefulShutdown: {
110
+ readonly unfinished: "z2h.agent_graceful_shutdown.unfinished";
111
+ };
112
+ readonly commandTracker: {
113
+ readonly stopped: "z2h.agent_command_tracker.stopped";
114
+ readonly appDetected: "z2h.agent_command_tracker.app_detected";
115
+ readonly backgroundLeft: "z2h.agent_command_tracker.background_left";
116
+ readonly scanIncomplete: "z2h.agent_command_tracker.scan_incomplete";
117
+ };
103
118
  };
104
119
  /**
105
120
  * BI events tracked in `z2h-cli`. Every event the CLI sends is named here.
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/observability/events.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CtB,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCnB,CAAC;AAEX,oDAAoD;AACpD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;CAgBjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;CAWf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/observability/events.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDtB,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCnB,CAAC;AAEX,oDAAoD;AACpD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;CAmCjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;CAWf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
@@ -43,6 +43,12 @@ const BackendRunnerEvents = {
43
43
  customIntegration: {
44
44
  hostDeniedMetric: 'z2h.custom_integration.host_denied',
45
45
  },
46
+ mondayFile: {
47
+ transferMetric: 'z2h.channel.monday_file.transfer',
48
+ bytesMetric: 'z2h.channel.monday_file.bytes',
49
+ phaseDurationMetric: 'z2h.channel.monday_file.phase_ms',
50
+ biEvent: 'z2h_monday_file_transfer',
51
+ },
46
52
  integrationToken: {
47
53
  decryptFailedMetric: 'z2h.integration_token.decrypt_failed',
48
54
  unexpectedShapeMetric: 'z2h.integration_token.unexpected_shape',
@@ -104,6 +110,25 @@ const Z2hAgentEvents = {
104
110
  // Distribution of a CLI call's duration in ms, tagged by phase (pull, push), status (success, failure) and,
105
111
  // on a pull, cold: whether it had to clone the app. A push that lost a race is retried inside the CLI.
106
112
  gitSync: 'z2h.agent_git_sync',
113
+ gracefulShutdown: {
114
+ // A turn or a save still running when the shutdown's time ran out, tagged kind (turn, save). Such a turn's work
115
+ // is only in the backup taken at the deadline: its own save never ran.
116
+ unfinished: 'z2h.agent_graceful_shutdown.unfinished',
117
+ },
118
+ commandTracker: {
119
+ // A command (or background processes a finished one left) the tracker stopped, tagged by reason (turn_stopped,
120
+ // turn_end, shutdown) and background: whether its shell had exited already.
121
+ stopped: 'z2h.agent_command_tracker.stopped',
122
+ // An app added to a turn, counted once when it is new to the turn, tagged by the source that found it: z2h-cli's
123
+ // report of the apps it opens (cli), the files a command changed (scan), or a file tool's path (file_tool).
124
+ // `scan` is what neither of the others saw; `other_turn` counts changed apps left to the live turn that owns them.
125
+ appDetected: 'z2h.agent_command_tracker.app_detected',
126
+ // A command left a background job running after its shell exited. What such a job writes later in another app
127
+ // isn't scanned: this shows whether that's worth handling.
128
+ backgroundLeft: 'z2h.agent_command_tracker.background_left',
129
+ // The changed-files scan stopped early (its time limit, or a folder it couldn't read): apps may be missing.
130
+ scanIncomplete: 'z2h.agent_command_tracker.scan_incomplete',
131
+ },
107
132
  };
108
133
  /**
109
134
  * BI events tracked in `z2h-cli`. Every event the CLI sends is named here.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mondaydotcomorg/z2h-shared-utils",
3
- "version": "0.18.0",
3
+ "version": "0.19.1",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {
package/src/constants.ts CHANGED
@@ -28,3 +28,7 @@ export const PREVIEW_APP_NAME_PREFIX = 'zth-preview-';
28
28
  export const APP_USAGE_BUCKET_NAME = 'de-integration-bigbrain';
29
29
  export const APP_USAGE_PREFIX = 'prod/studio/entity=app_usage';
30
30
  export const appUsageFolder = (appName: string, appId: number) => `${APP_USAGE_PREFIX}/${appName}_${appId}`;
31
+
32
+ // `z2h-cli recovery-snapshot`'s JSON `result`: what it did with an app's local work. The agent reads it.
33
+ export const RECOVERY_SNAPSHOT_RESULTS = ['saved', 'clean', 'no-remote', 'no-master'] as const;
34
+ export type RecoverySnapshotResult = (typeof RECOVERY_SNAPSHOT_RESULTS)[number];
@@ -41,6 +41,12 @@ export const BackendRunnerEvents = {
41
41
  customIntegration: {
42
42
  hostDeniedMetric: 'z2h.custom_integration.host_denied',
43
43
  },
44
+ mondayFile: {
45
+ transferMetric: 'z2h.channel.monday_file.transfer',
46
+ bytesMetric: 'z2h.channel.monday_file.bytes',
47
+ phaseDurationMetric: 'z2h.channel.monday_file.phase_ms',
48
+ biEvent: 'z2h_monday_file_transfer',
49
+ },
44
50
  integrationToken: {
45
51
  decryptFailedMetric: 'z2h.integration_token.decrypt_failed',
46
52
  unexpectedShapeMetric: 'z2h.integration_token.unexpected_shape',
@@ -104,6 +110,25 @@ export const Z2hAgentEvents = {
104
110
  // Distribution of a CLI call's duration in ms, tagged by phase (pull, push), status (success, failure) and,
105
111
  // on a pull, cold: whether it had to clone the app. A push that lost a race is retried inside the CLI.
106
112
  gitSync: 'z2h.agent_git_sync',
113
+ gracefulShutdown: {
114
+ // A turn or a save still running when the shutdown's time ran out, tagged kind (turn, save). Such a turn's work
115
+ // is only in the backup taken at the deadline: its own save never ran.
116
+ unfinished: 'z2h.agent_graceful_shutdown.unfinished',
117
+ },
118
+ commandTracker: {
119
+ // A command (or background processes a finished one left) the tracker stopped, tagged by reason (turn_stopped,
120
+ // turn_end, shutdown) and background: whether its shell had exited already.
121
+ stopped: 'z2h.agent_command_tracker.stopped',
122
+ // An app added to a turn, counted once when it is new to the turn, tagged by the source that found it: z2h-cli's
123
+ // report of the apps it opens (cli), the files a command changed (scan), or a file tool's path (file_tool).
124
+ // `scan` is what neither of the others saw; `other_turn` counts changed apps left to the live turn that owns them.
125
+ appDetected: 'z2h.agent_command_tracker.app_detected',
126
+ // A command left a background job running after its shell exited. What such a job writes later in another app
127
+ // isn't scanned: this shows whether that's worth handling.
128
+ backgroundLeft: 'z2h.agent_command_tracker.background_left',
129
+ // The changed-files scan stopped early (its time limit, or a folder it couldn't read): apps may be missing.
130
+ scanIncomplete: 'z2h.agent_command_tracker.scan_incomplete',
131
+ },
107
132
  } as const;
108
133
 
109
134
  /**