@evident-ai/runner-cdk 3.5.2-dev.43244a2 → 3.5.2-dev.bcf1140
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.
|
@@ -39,6 +39,7 @@ const constructs_1 = require("constructs");
|
|
|
39
39
|
const ec2 = __importStar(require("aws-cdk-lib/aws-ec2"));
|
|
40
40
|
const ecs = __importStar(require("aws-cdk-lib/aws-ecs"));
|
|
41
41
|
const iam = __importStar(require("aws-cdk-lib/aws-iam"));
|
|
42
|
+
const constants_1 = require("./microvm/constants");
|
|
42
43
|
const construct_1 = require("./waker/construct");
|
|
43
44
|
/** Current fixed value of `resourcePrefix`, kept as the default so an adopter
|
|
44
45
|
* omitting the prop reproduces today's physical names exactly. */
|
|
@@ -111,15 +112,7 @@ class EvidentScaleToZeroConstruct extends constructs_1.Construct {
|
|
|
111
112
|
GIT_BRANCH: gitBranch ?? 'main',
|
|
112
113
|
// Scale-to-zero self-stop inputs (the entrypoint uses these to scale to 0).
|
|
113
114
|
EVIDENT_IDLE_TIMEOUT_SECONDS: String(idleTimeoutSeconds),
|
|
114
|
-
|
|
115
|
-
// retention rule is set, sweeps OpenCode sessions idle longer than the
|
|
116
|
-
// window (protected/active sessions are never touched). Tightened from 7d
|
|
117
|
-
// to 24h per #537: at 7d, opencode.db was observed growing ~11x (77 MB ->
|
|
118
|
-
// 849 MB) in ~24h, so 7d was far too permissive at the observed growth
|
|
119
|
-
// rate. 24h is the tighter mitigation that came out of that (see also the
|
|
120
|
-
// OPENCODE_VERSION pin above). Sweep runs on the default 1h interval and
|
|
121
|
-
// never touches a protected/active session.
|
|
122
|
-
EVIDENT_SESSION_CLEANUP_MAX_AGE: '24h',
|
|
115
|
+
EVIDENT_SESSION_CLEANUP_MAX_AGE: constants_1.SESSION_CLEANUP_MAX_AGE,
|
|
123
116
|
CLUSTER: cluster.clusterName,
|
|
124
117
|
SERVICE: serviceName,
|
|
125
118
|
EVIDENT_SELFSTOP_ROLE_ARN: selfStopRole.roleArn,
|
|
@@ -5,3 +5,5 @@ export declare const RUN_HOOK_PAYLOAD_MAX_BYTES = 16384;
|
|
|
5
5
|
export declare const SUSPENDING_POLL_ATTEMPTS = 4;
|
|
6
6
|
export declare const SUSPENDING_POLL_INTERVAL_MS = 500;
|
|
7
7
|
export declare const MICROVM_MAX_RUN_SECONDS = 28800;
|
|
8
|
+
export declare const SESSION_CLEANUP_MAX_AGE = "24h";
|
|
9
|
+
export declare const DOORBELL_SECRET_KEY = "DOORBELL_SECRET";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Shared literals for the MicroVM controller and
|
|
2
|
+
// Shared literals for the MicroVM controller, its image, and the Fargate runner.
|
|
3
3
|
// Every module imports from here rather than restating a value that must match
|
|
4
4
|
// across them. The image template pins matching copies, guarded by
|
|
5
5
|
// `microvm/image/dockerfile.test.ts`.
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.MICROVM_MAX_RUN_SECONDS = exports.SUSPENDING_POLL_INTERVAL_MS = exports.SUSPENDING_POLL_ATTEMPTS = exports.RUN_HOOK_PAYLOAD_MAX_BYTES = exports.HOOK_TIMEOUT_SECONDS = exports.HOOKS_DIR = exports.HOOKS_PORT = void 0;
|
|
7
|
+
exports.DOORBELL_SECRET_KEY = exports.SESSION_CLEANUP_MAX_AGE = exports.MICROVM_MAX_RUN_SECONDS = exports.SUSPENDING_POLL_INTERVAL_MS = exports.SUSPENDING_POLL_ATTEMPTS = exports.RUN_HOOK_PAYLOAD_MAX_BYTES = exports.HOOK_TIMEOUT_SECONDS = exports.HOOKS_DIR = exports.HOOKS_PORT = void 0;
|
|
8
8
|
// The port the image's hook server binds, baked into the published Dockerfile
|
|
9
9
|
// (`ENV HOOKS_PORT`) and passed to the construct as `hooksPort`. Exported from
|
|
10
10
|
// the package index because a consumer building the published image context
|
|
@@ -32,3 +32,12 @@ exports.SUSPENDING_POLL_INTERVAL_MS = 500;
|
|
|
32
32
|
// longer than any VM can possibly still be running, no VM started before the
|
|
33
33
|
// deactivation can outlive it. The two MUST move together.
|
|
34
34
|
exports.MICROVM_MAX_RUN_SECONDS = 28800;
|
|
35
|
+
// Auto-cleanup (issue #190): `evident run` reads this directly from the Fargate
|
|
36
|
+
// task and MicroVM image. Setting a retention rule makes it sweep OpenCode
|
|
37
|
+
// sessions idle longer than 24h; protected/active sessions are never touched.
|
|
38
|
+
// The 24h window rather than 7d keeps the session database bounded at the growth
|
|
39
|
+
// rate observed in #537. The sweep runs on the default 1h interval.
|
|
40
|
+
exports.SESSION_CLEANUP_MAX_AGE = '24h';
|
|
41
|
+
// The JSON field inside the doorbell secret is shared by the Lambdas that name
|
|
42
|
+
// it and by whatever produces the secret; this is never the secret value.
|
|
43
|
+
exports.DOORBELL_SECRET_KEY = 'DOORBELL_SECRET';
|
|
@@ -40,14 +40,12 @@ const constructs_1 = require("constructs");
|
|
|
40
40
|
const lambda = __importStar(require("aws-cdk-lib/aws-lambda"));
|
|
41
41
|
const s3 = __importStar(require("aws-cdk-lib/aws-s3"));
|
|
42
42
|
const lambda_microvm_cdk_1 = require("@evident-ai/lambda-microvm-cdk");
|
|
43
|
+
const constants_1 = require("./constants");
|
|
43
44
|
const shapes_1 = require("./shapes");
|
|
44
45
|
const construct_1 = require("./image-version-reporter/construct");
|
|
45
46
|
// Image hooks build the snapshot, so they get minutes where the runtime hooks
|
|
46
47
|
// get AWS's 60 s.
|
|
47
48
|
const IMAGE_HOOK_TIMEOUT_SECONDS = 600;
|
|
48
|
-
// The field inside the doorbell secret, shared by this construct (which
|
|
49
|
-
// names it for the controller) and whatever produced `props.doorbellSecret`.
|
|
50
|
-
const DOORBELL_SECRET_KEY = 'DOORBELL_SECRET';
|
|
51
49
|
/**
|
|
52
50
|
* The customer-account half of the per-session runner (#558): the MicroVM
|
|
53
51
|
* image and the roles it builds and runs as, plus the stateless controller
|
|
@@ -127,10 +125,8 @@ class EvidentMicrovmConstruct extends constructs_1.Construct {
|
|
|
127
125
|
// ("Environment variable key 'AWS_REGION' is reserved", 400), which is
|
|
128
126
|
// also why the synchroniser's S3 client does not need it set — the
|
|
129
127
|
// MicroVM runtime supplies the region itself.
|
|
130
|
-
// Read by `evident run` itself (not the hooks), the same 24h window ECS
|
|
131
|
-
// already bakes in for its own runners (evident-scale-to-zero-construct.ts:191).
|
|
132
128
|
// Safe to bake: identical for every VM from this image version.
|
|
133
|
-
EVIDENT_SESSION_CLEANUP_MAX_AGE:
|
|
129
|
+
EVIDENT_SESSION_CLEANUP_MAX_AGE: constants_1.SESSION_CLEANUP_MAX_AGE,
|
|
134
130
|
...(props.runnerOpencodeConfigPath
|
|
135
131
|
? { RUNNER_OPENCODE_CONFIG: props.runnerOpencodeConfigPath }
|
|
136
132
|
: {}),
|
|
@@ -240,7 +236,7 @@ class EvidentMicrovmConstruct extends constructs_1.Construct {
|
|
|
240
236
|
// Secrets Manager at runtime, so the key is not exposed to anyone with
|
|
241
237
|
// lambda:GetFunctionConfiguration.
|
|
242
238
|
DOORBELL_SECRET_ARN: props.doorbellSecret.secretArn,
|
|
243
|
-
DOORBELL_SECRET_KEY: DOORBELL_SECRET_KEY,
|
|
239
|
+
DOORBELL_SECRET_KEY: constants_1.DOORBELL_SECRET_KEY,
|
|
244
240
|
MICROVM_SHAPES: shapeCatalogueJson,
|
|
245
241
|
// The role every shape's MicroVM shares (D3) — still one role, still
|
|
246
242
|
// this same expression, now documented as shared rather than singular.
|
|
@@ -39,8 +39,7 @@ const cdk = __importStar(require("aws-cdk-lib"));
|
|
|
39
39
|
const constructs_1 = require("constructs");
|
|
40
40
|
const lambda = __importStar(require("aws-cdk-lib/aws-lambda"));
|
|
41
41
|
const cr = __importStar(require("aws-cdk-lib/custom-resources"));
|
|
42
|
-
|
|
43
|
-
const DOORBELL_SECRET_KEY = 'DOORBELL_SECRET';
|
|
42
|
+
const constants_1 = require("../constants");
|
|
44
43
|
/**
|
|
45
44
|
* Deploy-time push: reports each shape's just-published MicroVM image version to
|
|
46
45
|
* Evident, once per deploy that actually changes it. `imageVersions` is the
|
|
@@ -66,7 +65,7 @@ class ImageVersionReporter extends constructs_1.Construct {
|
|
|
66
65
|
environment: {
|
|
67
66
|
// ARN + field name only, never the value (mirrors the controller and waker).
|
|
68
67
|
DOORBELL_SECRET_ARN: props.doorbellSecret.secretArn,
|
|
69
|
-
DOORBELL_SECRET_KEY: DOORBELL_SECRET_KEY,
|
|
68
|
+
DOORBELL_SECRET_KEY: constants_1.DOORBELL_SECRET_KEY,
|
|
70
69
|
EVIDENT_API_URL: props.evidentApiUrl,
|
|
71
70
|
EVIDENT_RUNNER_ID: props.evidentRunnerId,
|
|
72
71
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evident-ai/runner-cdk",
|
|
3
|
-
"version": "3.5.2-dev.
|
|
3
|
+
"version": "3.5.2-dev.bcf1140",
|
|
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",
|