@evident-ai/runner-cdk 3.4.1-dev.59c7df3 → 3.4.1-dev.c03b461

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.
@@ -49949,6 +49949,7 @@ function decide({
49949
49949
  runnerId,
49950
49950
  microvmId,
49951
49951
  startedAt,
49952
+ imageVersion,
49952
49953
  shapes,
49953
49954
  polled
49954
49955
  }) {
@@ -49966,6 +49967,7 @@ function decide({
49966
49967
  reason,
49967
49968
  ...microvmId === void 0 ? {} : { microvm_id: microvmId },
49968
49969
  ...startedAt === void 0 ? {} : { microvm_started_at: startedAt.toISOString() },
49970
+ ...imageVersion === void 0 ? {} : { image_version: imageVersion },
49969
49971
  ...shapes === void 0 ? {} : { shapes },
49970
49972
  ...polled === true ? { polled: true } : {}
49971
49973
  }),
@@ -50122,7 +50124,8 @@ async function handleWakeDoorbell(doorbell, shape, microvm, timing) {
50122
50124
  runnerId: doorbell.runnerId,
50123
50125
  microvmId: doorbell.microvmId,
50124
50126
  polled,
50125
- startedAt: described.startedAt
50127
+ startedAt: described.startedAt,
50128
+ imageVersion: described.imageVersion
50126
50129
  });
50127
50130
  case "SUSPENDED":
50128
50131
  if (await shouldRecreateForNewerImage(doorbell, shape, described.imageVersion, microvm)) {
@@ -50143,7 +50146,8 @@ async function handleWakeDoorbell(doorbell, shape, microvm, timing) {
50143
50146
  microvm,
50144
50147
  timing,
50145
50148
  polled,
50146
- described.startedAt
50149
+ described.startedAt,
50150
+ described.imageVersion
50147
50151
  );
50148
50152
  default:
50149
50153
  return runMicrovm(
@@ -50220,10 +50224,11 @@ async function runMicrovm(doorbell, shape, microvm, timing, polled, reason, stat
50220
50224
  runnerId: doorbell.runnerId,
50221
50225
  microvmId: started.microvmId,
50222
50226
  polled,
50223
- startedAt: started.startedAt
50227
+ startedAt: started.startedAt,
50228
+ imageVersion: started.imageVersion
50224
50229
  });
50225
50230
  }
50226
- async function resumeMicrovm(doorbell, microvmId, shape, microvm, timing, polled, startedAt) {
50231
+ async function resumeMicrovm(doorbell, microvmId, shape, microvm, timing, polled, startedAt, imageVersion) {
50227
50232
  try {
50228
50233
  await withThrottleRetry(() => microvm.resume(microvmId), timing);
50229
50234
  } catch (error3) {
@@ -50248,7 +50253,8 @@ async function resumeMicrovm(doorbell, microvmId, shape, microvm, timing, polled
50248
50253
  runnerId: doorbell.runnerId,
50249
50254
  microvmId,
50250
50255
  polled,
50251
- startedAt
50256
+ startedAt,
50257
+ imageVersion
50252
50258
  });
50253
50259
  }
50254
50260
  async function suspendMicrovm(doorbell, microvm, timing) {
@@ -50443,7 +50449,7 @@ function createRuntimeMicrovm(executionRoleArn) {
50443
50449
  return latestActiveImageVersion;
50444
50450
  },
50445
50451
  async run({ imageIdentifier, runHookPayload, clientToken }) {
50446
- const { microvmId, startedAt } = await microvms.send(
50452
+ const { microvmId, startedAt, imageVersion } = await microvms.send(
50447
50453
  new import_client_lambda_microvms.RunMicrovmCommand({
50448
50454
  imageIdentifier,
50449
50455
  executionRoleArn,
@@ -50476,7 +50482,7 @@ function createRuntimeMicrovm(executionRoleArn) {
50476
50482
  if (!microvmId) {
50477
50483
  throw new Error("RunMicrovm returned no microvmId");
50478
50484
  }
50479
- return { microvmId, startedAt };
50485
+ return { microvmId, startedAt, imageVersion };
50480
50486
  },
50481
50487
  async resume(microvmId) {
50482
50488
  await microvms.send(new import_client_lambda_microvms.ResumeMicrovmCommand({ microvmIdentifier: microvmId }));
@@ -37,7 +37,7 @@ const LOG_ACTION = {
37
37
  rejected: 'reject',
38
38
  describe: 'describe',
39
39
  };
40
- function decide({ statusCode, action, reason, state, runnerId, microvmId, startedAt, shapes, polled, }) {
40
+ function decide({ statusCode, action, reason, state, runnerId, microvmId, startedAt, imageVersion, shapes, polled, }) {
41
41
  const line = `[doorbell] state=${state ?? 'none'} action=${LOG_ACTION[action]} ` +
42
42
  `microvm_id=${microvmId ?? '-'} runner_id=${runnerId ?? '-'} reason=${reason}` +
43
43
  (polled === undefined ? '' : ` polled=${polled}`);
@@ -56,6 +56,7 @@ function decide({ statusCode, action, reason, state, runnerId, microvmId, starte
56
56
  reason,
57
57
  ...(microvmId === undefined ? {} : { microvm_id: microvmId }),
58
58
  ...(startedAt === undefined ? {} : { microvm_started_at: startedAt.toISOString() }),
59
+ ...(imageVersion === undefined ? {} : { image_version: imageVersion }),
59
60
  ...(shapes === undefined ? {} : { shapes }),
60
61
  ...(polled === true ? { polled: true } : {}),
61
62
  }),
@@ -283,6 +284,7 @@ async function handleWakeDoorbell(doorbell, shape, microvm, timing) {
283
284
  microvmId: doorbell.microvmId,
284
285
  polled,
285
286
  startedAt: described.startedAt,
287
+ imageVersion: described.imageVersion,
286
288
  });
287
289
  case 'SUSPENDED':
288
290
  // A newer image has been published since this VM booted: resuming would
@@ -292,7 +294,7 @@ async function handleWakeDoorbell(doorbell, shape, microvm, timing) {
292
294
  if (await shouldRecreateForNewerImage(doorbell, shape, described.imageVersion, microvm)) {
293
295
  return runMicrovm(doorbell, shape, microvm, timing, polled, REASON.imageVersionOutdated, state);
294
296
  }
295
- return resumeMicrovm(doorbell, doorbell.microvmId, shape, microvm, timing, polled, described.startedAt);
297
+ return resumeMicrovm(doorbell, doorbell.microvmId, shape, microvm, timing, polled, described.startedAt, described.imageVersion);
296
298
  default:
297
299
  // TERMINATED, TERMINATING, not_found — gone or going, so a fresh VM either
298
300
  // way. This is what self-heals a stale `microvm_id`.
@@ -387,13 +389,13 @@ async function runMicrovm(doorbell, shape, microvm, timing, polled, reason, stat
387
389
  microvmId: started.microvmId,
388
390
  polled,
389
391
  startedAt: started.startedAt,
392
+ imageVersion: started.imageVersion,
390
393
  });
391
394
  }
392
395
  async function resumeMicrovm(doorbell, microvmId, shape, microvm, timing, polled,
393
- // Threaded in from the `describe()` result that led here — `ResumeMicrovm`
394
- // itself returns no `startedAt` (its response is empty), so this arm has no
395
- // timestamp of its own to report.
396
- startedAt) {
396
+ // Both values come from the `describe()` result that led here because
397
+ // `ResumeMicrovm` returns no lifecycle metadata of its own.
398
+ startedAt, imageVersion) {
397
399
  try {
398
400
  await (0, throttle_retry_1.withThrottleRetry)(() => microvm.resume(microvmId), timing);
399
401
  }
@@ -411,6 +413,7 @@ startedAt) {
411
413
  microvmId,
412
414
  polled,
413
415
  startedAt,
416
+ imageVersion,
414
417
  });
415
418
  }
416
419
  async function suspendMicrovm(doorbell, microvm, timing) {
@@ -69,6 +69,12 @@ export interface MicrovmClient {
69
69
  * none. Never synthesize one (e.g. `new Date()`) here or in any caller.
70
70
  */
71
71
  startedAt?: Date;
72
+ /**
73
+ * The image version this VM booted on, straight from `RunMicrovm`'s own
74
+ * `imageVersion`. Absent means AWS omitted it and must be read as UNKNOWN;
75
+ * see `MicrovmDescription.imageVersion` above.
76
+ */
77
+ imageVersion?: string;
72
78
  }>;
73
79
  resume(microvmId: string): Promise<void>;
74
80
  suspend(microvmId: string): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evident-ai/runner-cdk",
3
- "version": "3.4.1-dev.59c7df3",
3
+ "version": "3.4.1-dev.c03b461",
4
4
  "description": "Reusable CDK constructs for an Evident agent runner: a single scale-to-zero Fargate runner (task + service + per-agent self-stop role + waker Lambda), or a per-session AWS Lambda MicroVM that boots on demand and suspends between messages. Instantiate once per agent from your own stack.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",