@evident-ai/runner-cdk 0.1.1-dev.da70cd4 → 3.4.1-dev.1856549
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 +76 -19
- package/dist/controller-lambda/handler.js +50523 -0
- package/dist/evident-scale-to-zero-construct.js +4 -5
- package/dist/index.d.ts +4 -0
- package/dist/index.js +14 -1
- package/dist/microvm/constants.d.ts +7 -0
- package/dist/microvm/constants.js +34 -0
- package/dist/microvm/construct.d.ts +87 -0
- package/dist/microvm/construct.js +253 -0
- package/dist/microvm/controller/doorbell.d.ts +73 -0
- package/dist/microvm/controller/doorbell.js +107 -0
- package/dist/microvm/controller/handle-doorbell.d.ts +27 -0
- package/dist/microvm/controller/handle-doorbell.js +480 -0
- package/dist/microvm/controller/microvm-client.d.ts +75 -0
- package/dist/microvm/controller/microvm-client.js +7 -0
- package/dist/microvm/controller/shape-catalogue.d.ts +64 -0
- package/dist/microvm/controller/shape-catalogue.js +108 -0
- package/dist/microvm/controller/throttle-retry.d.ts +11 -0
- package/dist/microvm/controller/throttle-retry.js +27 -0
- package/dist/microvm/image/stage-context.d.ts +33 -0
- package/dist/microvm/image/stage-context.js +148 -0
- package/dist/microvm/shapes.d.ts +72 -0
- package/dist/microvm/shapes.js +93 -0
- package/dist/microvm-image-context/Dockerfile +227 -0
- package/dist/microvm-image-context/hook-server.js +286 -0
- package/dist/microvm-image-context/hooks/common.sh +1418 -0
- package/dist/microvm-image-context/hooks/resume +79 -0
- package/dist/microvm-image-context/hooks/run +117 -0
- package/dist/microvm-image-context/hooks/suspend +19 -0
- package/dist/microvm-image-context/hooks/terminate +34 -0
- package/dist/waker/construct.js +1 -1
- package/package.json +15 -7
package/README.md
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
# `@evident-ai/runner-cdk`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
the
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
Reusable AWS CDK constructs for running an [Evident](https://evident.run) agent runner in
|
|
4
|
+
**your** AWS account, against **your** repo. Two runner strategies:
|
|
5
|
+
|
|
6
|
+
- **`EvidentScaleToZeroConstruct`** — **one scale-to-zero agent runner** on Fargate,
|
|
7
|
+
covered by the rest of this README. The runner sleeps when nobody is talking to it:
|
|
8
|
+
after `idleTimeoutSeconds` of inactivity the task scales its own service to
|
|
9
|
+
`desiredCount 0`, and an HMAC-authenticated waker Lambda scales it back up on the next
|
|
10
|
+
message. You pay for the time the agent is actually working.
|
|
11
|
+
- **`EvidentMicrovmConstruct`** — a per-session AWS Lambda MicroVM that boots on demand
|
|
12
|
+
and suspends between messages. Installing the `@dev` tag of this package is all you
|
|
13
|
+
need: the image build context ships inside it (see [The MicroVM image](#the-microvm-image)
|
|
14
|
+
below), so there is no checkout of `sroze/evident` involved. See
|
|
15
|
+
[the AWS runner doc](https://evident.run/docs/aws-runner) for the full picture of both
|
|
16
|
+
strategies.
|
|
10
17
|
|
|
11
18
|
## What it creates
|
|
12
19
|
|
|
@@ -27,8 +34,9 @@ cluster can host several agents.
|
|
|
27
34
|
## Getting started
|
|
28
35
|
|
|
29
36
|
For a full end-to-end walkthrough — shared infra, secrets without SOPS/KMS, the image,
|
|
30
|
-
the two grants, deploy, and wiring the wake webhook — see
|
|
31
|
-
|
|
37
|
+
the two grants, deploy, and wiring the wake webhook — see `GETTING-STARTED.md` in this
|
|
38
|
+
package's directory (not published to npm; read it from a checkout of the repo). The
|
|
39
|
+
snippet below is the short version.
|
|
32
40
|
|
|
33
41
|
```ts
|
|
34
42
|
import { EvidentScaleToZeroConstruct } from "@evident-ai/runner-cdk";
|
|
@@ -104,18 +112,67 @@ the construct's own dogfooding consumer.
|
|
|
104
112
|
|
|
105
113
|
This construct never builds an image. Pass any `ecs.ContainerImage` — from a registry, or
|
|
106
114
|
built from a `Dockerfile` you control. The generic runner image lives separately in
|
|
107
|
-
`
|
|
115
|
+
`runner/docker-images/fargate`, so you can adopt the image, the construct, or both.
|
|
116
|
+
|
|
117
|
+
## The MicroVM image
|
|
118
|
+
|
|
119
|
+
`EvidentMicrovmConstruct`'s `imageSource` is a **local directory** holding the image build
|
|
120
|
+
context, which `cdk deploy` zips and uploads. The Lambda MicroVM service then builds the
|
|
121
|
+
image in *your* account, from a base image ARN you discover there — so, unlike the Fargate
|
|
122
|
+
strategy, there is no registry image to pull.
|
|
123
|
+
|
|
124
|
+
The context has two halves, and this package ships the half that is ours: the Dockerfile,
|
|
125
|
+
the per-phase hook scripts and the bundled hook server, published inside the tarball at
|
|
126
|
+
`dist/microvm-image-context/`. The other half is **your** repository, which is baked in as
|
|
127
|
+
the agent's workspace. `stageMicrovmImageContext()` puts the two together:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
import path from 'node:path';
|
|
131
|
+
import {
|
|
132
|
+
EvidentMicrovmConstruct,
|
|
133
|
+
HOOKS_PORT,
|
|
134
|
+
HOOK_TIMEOUT_SECONDS,
|
|
135
|
+
stageMicrovmImageContext,
|
|
136
|
+
} from '@evident-ai/runner-cdk';
|
|
137
|
+
|
|
138
|
+
new EvidentMicrovmConstruct(this, 'Runner', {
|
|
139
|
+
imageSource: stageMicrovmImageContext({
|
|
140
|
+
// A full (non-shallow) clone: the agent branches, commits and opens PRs.
|
|
141
|
+
repositoryPath: '/path/to/your/checkout',
|
|
142
|
+
// Credential-free — this string ships inside the shared snapshot. The
|
|
143
|
+
// token the agent pushes with arrives per-session, never baked in.
|
|
144
|
+
originUrl: 'https://github.com/acme/widgets.git',
|
|
145
|
+
destination: path.join(__dirname, '..', 'build', 'image'),
|
|
146
|
+
}),
|
|
147
|
+
// Must match the published image these were baked into, so export them
|
|
148
|
+
// rather than restating the numbers.
|
|
149
|
+
hooksPort: HOOKS_PORT,
|
|
150
|
+
hookTimeoutSeconds: HOOK_TIMEOUT_SECONDS,
|
|
151
|
+
baseImageArn,
|
|
152
|
+
baseImageVersion,
|
|
153
|
+
doorbellSecret,
|
|
154
|
+
runnerSecret,
|
|
155
|
+
runnerOpencodeConfigPath: 'opencode.runner.jsonc',
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Your repo does not have to be a pnpm workspace. If it commits a `pnpm-lock.yaml` the image
|
|
160
|
+
pre-installs dependencies at build time (a faster first boot); if not, that step is skipped
|
|
161
|
+
and the agent installs on first use.
|
|
162
|
+
|
|
163
|
+
| MicroVM prop | Omitted behavior |
|
|
164
|
+
| --- | --- |
|
|
165
|
+
| `runnerSecret` | No GitHub or MCP credentials are exported at `/run`. |
|
|
166
|
+
| `runnerOpencodeConfigPath` | OpenCode uses the baked project configuration. Relative paths resolve from the workspace; absolute paths resolve in the image. |
|
|
167
|
+
| `gitUserName` / `gitUserEmail` | The hook uses the Evident bot defaults for git identity. |
|
|
108
168
|
|
|
109
169
|
## Status / limitations
|
|
110
170
|
|
|
111
|
-
- **
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
`@evident-ai/runner-synchroniser`) and hasn't happened yet; until then this repo's own
|
|
118
|
-
consumer (`infrastructure/evident-runner`) keeps consuming it as a `workspace:*`
|
|
119
|
-
dependency, and following this guide outside this repo means working from a checkout.
|
|
171
|
+
- **Published to npm** as `@evident-ai/runner-cdk` (MIT). Install the `@dev` tag —
|
|
172
|
+
`npm install @evident-ai/runner-cdk@dev` (or `pnpm add`/`yarn add`); no checkout of
|
|
173
|
+
this repo is required. It builds to a self-contained `dist/` (`pnpm --filter
|
|
174
|
+
@evident-ai/runner-cdk build`) with no `workspace:`/`@evident/*` runtime dependency.
|
|
175
|
+
This repo's own consumer (`infrastructure/evident-runner`) still consumes it as a
|
|
176
|
+
`workspace:*` dependency for dogfooding.
|
|
120
177
|
- **AWS/ECS-specific.** Non-AWS clouds are an open question on the epic, not a supported
|
|
121
178
|
path.
|