@evident-ai/runner-cdk 0.1.1-dev.0fe02fb → 0.1.1-dev.8f13d30

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.
Files changed (30) hide show
  1. package/README.md +64 -16
  2. package/dist/controller-lambda/handler.js +50523 -0
  3. package/dist/index.d.ts +4 -0
  4. package/dist/index.js +14 -1
  5. package/dist/microvm/constants.d.ts +7 -0
  6. package/dist/microvm/constants.js +35 -0
  7. package/dist/microvm/construct.d.ts +73 -0
  8. package/dist/microvm/construct.js +245 -0
  9. package/dist/microvm/controller/doorbell.d.ts +73 -0
  10. package/dist/microvm/controller/doorbell.js +107 -0
  11. package/dist/microvm/controller/handle-doorbell.d.ts +27 -0
  12. package/dist/microvm/controller/handle-doorbell.js +480 -0
  13. package/dist/microvm/controller/microvm-client.d.ts +75 -0
  14. package/dist/microvm/controller/microvm-client.js +7 -0
  15. package/dist/microvm/controller/shape-catalogue.d.ts +64 -0
  16. package/dist/microvm/controller/shape-catalogue.js +108 -0
  17. package/dist/microvm/controller/throttle-retry.d.ts +11 -0
  18. package/dist/microvm/controller/throttle-retry.js +27 -0
  19. package/dist/microvm/image/stage-context.d.ts +33 -0
  20. package/dist/microvm/image/stage-context.js +148 -0
  21. package/dist/microvm/shapes.d.ts +72 -0
  22. package/dist/microvm/shapes.js +93 -0
  23. package/dist/microvm-image-context/Dockerfile +224 -0
  24. package/dist/microvm-image-context/hook-server.js +290 -0
  25. package/dist/microvm-image-context/hooks/common.sh +1255 -0
  26. package/dist/microvm-image-context/hooks/resume +79 -0
  27. package/dist/microvm-image-context/hooks/run +111 -0
  28. package/dist/microvm-image-context/hooks/suspend +19 -0
  29. package/dist/microvm-image-context/hooks/terminate +34 -0
  30. package/package.json +9 -3
package/README.md CHANGED
@@ -1,12 +1,19 @@
1
1
  # `@evident-ai/runner-cdk`
2
2
 
3
- A reusable AWS CDK construct for running **one scale-to-zero [Evident](https://evident.run)
4
- agent runner** on Fargate, in **your** AWS account, against **your** repo.
5
-
6
- The runner sleeps when nobody is talking to it: after `idleTimeoutSeconds` of inactivity
7
- the task scales its own service to `desiredCount 0`, and an HMAC-authenticated waker
8
- Lambda scales it back up on the next message. You pay for the time the agent is actually
9
- working.
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 this package is all you need: the image build
13
+ context ships inside it (see [The MicroVM image](#the-microvm-image) below), so there is
14
+ 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
 
@@ -106,16 +113,57 @@ This construct never builds an image. Pass any `ecs.ContainerImage` — from a r
106
113
  built from a `Dockerfile` you control. The generic runner image lives separately in
107
114
  `packages/runner-image`, so you can adopt the image, the construct, or both.
108
115
 
116
+ ## The MicroVM image
117
+
118
+ `EvidentMicrovmConstruct`'s `imageSource` is a **local directory** holding the image build
119
+ context, which `cdk deploy` zips and uploads. The Lambda MicroVM service then builds the
120
+ image in *your* account, from a base image ARN you discover there — so, unlike the Fargate
121
+ strategy, there is no registry image to pull.
122
+
123
+ The context has two halves, and this package ships the half that is ours: the Dockerfile,
124
+ the per-phase hook scripts and the bundled hook server, published inside the tarball at
125
+ `dist/microvm-image-context/`. The other half is **your** repository, which is baked in as
126
+ the agent's workspace. `stageMicrovmImageContext()` puts the two together:
127
+
128
+ ```ts
129
+ import {
130
+ EvidentMicrovmConstruct,
131
+ HOOKS_PORT,
132
+ HOOK_TIMEOUT_SECONDS,
133
+ stageMicrovmImageContext,
134
+ } from '@evident-ai/runner-cdk';
135
+
136
+ new EvidentMicrovmConstruct(this, 'Runner', {
137
+ imageSource: stageMicrovmImageContext({
138
+ // A full (non-shallow) clone: the agent branches, commits and opens PRs.
139
+ repositoryPath: '/path/to/your/checkout',
140
+ // Credential-free — this string ships inside the shared snapshot. The
141
+ // token the agent pushes with arrives per-session, never baked in.
142
+ originUrl: 'https://github.com/acme/widgets.git',
143
+ destination: path.join(__dirname, '..', 'build', 'image'),
144
+ }),
145
+ // Must match the published image these were baked into, so export them
146
+ // rather than restating the numbers.
147
+ hooksPort: HOOKS_PORT,
148
+ hookTimeoutSeconds: HOOK_TIMEOUT_SECONDS,
149
+ baseImageArn,
150
+ baseImageVersion,
151
+ doorbellSecret,
152
+ });
153
+ ```
154
+
155
+ Your repo does not have to be a pnpm workspace. If it commits a `pnpm-lock.yaml` the image
156
+ pre-installs dependencies at build time (a faster first boot); if not, that step is skipped
157
+ and the agent installs on first use.
158
+
109
159
  ## Status / limitations
110
160
 
111
- - **Publishable, but not yet published.** The package is `@evident-ai/runner-cdk`
112
- (MIT), buildable to a self-contained `dist/` (`pnpm --filter @evident-ai/runner-cdk
113
- build`) with no `workspace:`/`@evident/*` runtime dependency see
114
- [#957](https://github.com/sroze/evident/issues/957). The **first** `npm publish` is a
115
- one-time human bootstrap step (OIDC/Trusted Publishing can't perform a package's
116
- first publish, same as [#612](https://github.com/sroze/evident/issues/612) was for
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.
161
+ - **Published to npm** as `@evident-ai/runner-cdk` (MIT) — see
162
+ [#957](https://github.com/sroze/evident/issues/957). Install it with `npm install
163
+ @evident-ai/runner-cdk` (or `pnpm add`/`yarn add`); no checkout of this repo is
164
+ required. It builds to a self-contained `dist/` (`pnpm --filter @evident-ai/runner-cdk
165
+ build`) with no `workspace:`/`@evident/*` runtime dependency. This repo's own
166
+ consumer (`infrastructure/evident-runner`) still consumes it as a `workspace:*`
167
+ dependency for dogfooding.
120
168
  - **AWS/ECS-specific.** Non-AWS clouds are an open question on the epic, not a supported
121
169
  path.