@evident-ai/runner-cdk 3.5.2-dev.df1ae49 → 3.5.2-dev.e22029a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -116,6 +116,17 @@ built from a `Dockerfile` you control. The generic runner image lives separately
116
116
 
117
117
  ## The MicroVM image
118
118
 
119
+ ### Prune image versions
120
+
121
+ MicroVM image versions are quota-bound. `@evident-ai/lambda-microvm-cdk` ships the
122
+ `prune-microvm-image-versions` CLI; enable it with one `package.json` script line:
123
+
124
+ ```json
125
+ "microvm:prune": "prune-microvm-image-versions --image-arn arn:aws:lambda:eu-west-1:000000000000:microvm-image:your-image"
126
+ ```
127
+
128
+ See the `@evident-ai/lambda-microvm-cdk` package README for the CLI flags and safety semantics.
129
+
119
130
  `EvidentMicrovmConstruct`'s `imageSource` is a **local directory** holding the image build
120
131
  context, which `cdk deploy` zips and uploads. The Lambda MicroVM service then builds the
121
132
  image in *your* account, from a base image ARN you discover there — so, unlike the Fargate
@@ -157,6 +157,13 @@ class EvidentScaleToZeroConstruct extends constructs_1.Construct {
157
157
  // Object Get/Put/Delete scoped to this agent's prefix. DeleteObject is
158
158
  // required: Litestream's retention/compaction prunes old LTX files.
159
159
  replicaBucket.grantReadWrite(taskRole, `${this.replicaPrefix}/*`);
160
+ // Vault credentials are read and conditionally written, so this shared prefix
161
+ // needs no delete or list permission; conditional writes use request headers.
162
+ taskRole.addToPrincipalPolicy(new iam.PolicyStatement({
163
+ sid: 'ReadWriteCredentialVaultObjects',
164
+ actions: ['s3:GetObject', 's3:PutObject'],
165
+ resources: [replicaBucket.arnForObjects('credential-vaults/*')],
166
+ }));
160
167
  this.service = new ecs.FargateService(this, 'Service', {
161
168
  cluster,
162
169
  taskDefinition,
@@ -37,6 +37,7 @@ exports.EvidentMicrovmConstruct = void 0;
37
37
  const path = __importStar(require("path"));
38
38
  const cdk = __importStar(require("aws-cdk-lib"));
39
39
  const constructs_1 = require("constructs");
40
+ const iam = __importStar(require("aws-cdk-lib/aws-iam"));
40
41
  const lambda = __importStar(require("aws-cdk-lib/aws-lambda"));
41
42
  const s3 = __importStar(require("aws-cdk-lib/aws-s3"));
42
43
  const lambda_microvm_cdk_1 = require("@evident-ai/lambda-microvm-cdk");
@@ -189,13 +190,14 @@ class EvidentMicrovmConstruct extends constructs_1.Construct {
189
190
  hooks: imageHooks,
190
191
  }));
191
192
  }
192
- // Bucket-wide rather than per-prefix (as the ECS runner's task role is):
193
- // the prefix arrives at /run, so it cannot be named at synth, and one
194
- // execution role is shared by every VM of every shape (D3). So a VM can
195
- // read another session's credential store — acceptable within a single
196
- // customer account, and what Phase 4 (#263) has to tighten when this goes
197
- // multi-tenant.
198
- durableState.grantReadWrite(defaultImage.executionRole);
193
+ // The execution role serves every image shape, so per-session state is scoped
194
+ // to the `runners/` root; vault credentials need only GetObject and PutObject.
195
+ durableState.grantReadWrite(defaultImage.executionRole, 'runners/*');
196
+ defaultImage.executionRole.addToPrincipalPolicy(new iam.PolicyStatement({
197
+ sid: 'ReadWriteCredentialVaultObjects',
198
+ actions: ['s3:GetObject', 's3:PutObject'],
199
+ resources: [durableState.arnForObjects('credential-vaults/*')],
200
+ }));
199
201
  // The image receives only an ARN; `/run` reads the secret value at runtime.
200
202
  props.runnerSecret?.grantRead(defaultImage.executionRole);
201
203
  // The shape catalogue the controller resolves a doorbell's `shape` field
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evident-ai/runner-cdk",
3
- "version": "3.5.2-dev.df1ae49",
3
+ "version": "3.5.2-dev.e22029a",
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",