@evident-ai/runner-synchroniser 0.1.0 → 0.1.1-dev.7568241

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 (2) hide show
  1. package/README.md +50 -28
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -15,8 +15,10 @@ the boot script gates on. It also renders the `litestream.yml` that covers the s
15
15
  database, so both halves read their bucket, prefix and paths from one config module
16
16
  instead of two.
17
17
 
18
- It is a CLI, not a library: the runner's `entrypoint.sh` invokes it as a single
19
- self-contained bundle (`node cli.js <command>`).
18
+ It is a CLI, not a library, invoked by two consumers that differ in how they get the
19
+ binary: the Fargate runner image installs the published package and invokes it by name
20
+ (`runner-synchroniser <command>`); the MicroVM still builds it from source and runs the
21
+ bundle directly (`node cli.js <command>`).
20
22
 
21
23
  ## Install
22
24
 
@@ -30,11 +32,25 @@ npx @evident-ai/runner-synchroniser@dev env
30
32
  `dist/cli.js` is a single self-contained ESM bundle with **no runtime dependencies** —
31
33
  the AWS SDK is bundled at build time, so installing it pulls nothing else in.
32
34
 
33
- > Publishing is being rolled out (#612). The `dev` tag is published on every merge to
34
- > `main` that touches this package; the first publish is a human bootstrap (#694), and
35
- > the `latest`-on-release path is not wired up yet. Nothing in this repo installs the
36
- > package: the runner image and the MicroVM still build the bundle from source, and will
37
- > keep doing so until that flip lands.
35
+ ### Versioning
36
+
37
+ The package's version **tracks the product release version**, exactly like
38
+ `@evident-ai/cli`. `latest` is published on a product release, at the release
39
+ version. `dev` is published on every merge to `main` that touches this package or
40
+ the root `package.json`, at `<root major>.<minor>.<patch+1>-dev.<sha>`, so `dev`
41
+ stays strictly ahead of `latest`.
42
+
43
+ The version committed in this package's `package.json` is **vestigial** — CI
44
+ overwrites it before every publish. This is why `latest` jumped straight from
45
+ `0.1.0` to `3.x.y`: the `0.1.x` line predates the policy, not a missing
46
+ major-version story, and because npm publishes are immutable that jump is
47
+ permanent.
48
+
49
+ The two consumers still differ in how they get the binary: the Fargate runner
50
+ image installs the published package
51
+ (`ARG RUNNER_SYNCHRONISER_VERSION=dev`, resolved to a concrete version by the
52
+ deploy workflow); the MicroVM still builds it from source and reads no npm
53
+ version at all.
38
54
 
39
55
  ## Commands
40
56
 
@@ -47,9 +63,9 @@ the AWS SDK is bundled at build time, so installing it pulls nothing else in.
47
63
  | `model-auth-ready` | — | `0` = ready, `10` = not ready; other = tool broken |
48
64
  | `self-stop` | — | `0` = stopped, `20` = keep the task; other = tool broken |
49
65
 
50
- `self-stop` scales this agent's own ECS service to `desiredCount=0` on a clean idle
51
- exit, reading `CLUSTER`, `SERVICE` and (optionally) `EVIDENT_SELFSTOP_ROLE_ARN` from the
52
- environment. It exits `0` **only** on a confirmed `desiredCount` of 0.
66
+ `self-stop` scales this agent's own ECS service to `desiredCount=0` on a clean idle exit
67
+ (see Configuration for `CLUSTER`/`SERVICE`/`EVIDENT_SELFSTOP_ROLE_ARN`). It exits `0`
68
+ **only** on a confirmed `desiredCount` of 0.
53
69
 
54
70
  Everything the operator needs to read goes to **stderr**, prefixed `[auth-persistence]`,
55
71
  so a caller can safely capture stdout. The prefix now covers more than credentials — the
@@ -96,23 +112,28 @@ real violation also rejects correct rewrites.
96
112
 
97
113
  ## Configuration
98
114
 
99
- All configuration is environment variables, resolved once in `src/config.ts`.
115
+ Configuration is environment variables; `src/config.ts` resolves the shared paths, keys
116
+ and settings below once for every command. The three variables marked † are read
117
+ directly by `self-stop` instead — they configure that one command, not a shared path or
118
+ key, so they never appear in `env`'s output or `litestream.yml`.
119
+
120
+ | Variable | Meaning | When absent |
121
+ | ------------------------------------------ | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
122
+ | `HOME` | Every credential and database path is derived from it. | Throws; logged `FATAL:`, exits `1`. Affects every command. |
123
+ | `LITESTREAM_BUCKET` / `LITESTREAM_PREFIX` | Object-store bucket and key prefix. | Persistence off (needs **both**): `restore`/`sync-once` no-op, `env` warns. |
124
+ | `AWS_REGION` | Region for the AWS clients (S3, and the ECS/STS calls `self-stop` makes). | Left to the SDK's own resolution. |
125
+ | `CREDS_SYNC_INTERVAL` | Seconds between sync ticks, reported by `env` for the caller's loop. | Falls back to `60`; also on unparseable or non-positive values. |
126
+ | `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` | Presence alone counts as configured model auth (see `model-auth-ready`). | No API-key fallback; `model-auth-ready` then depends solely on the credential files. |
127
+ | `CLUSTER` † / `SERVICE` † | ECS cluster/service `self-stop` scales to `desiredCount=0`. | Warns "cannot self-stop" and exits `20` (keep the task). Ignored by every other command. |
128
+ | `EVIDENT_SELFSTOP_ROLE_ARN` † | Role `self-stop` assumes for its ECS calls. | Optional: falls back to the task role's own credentials. A failed/incomplete assume-role → `20`. |
100
129
 
101
- | Variable | Meaning |
102
- | -------------------------------------- | -------------------------------------------------------------------------------------------- |
103
- | `HOME` | **Required.** Every credential and database path is derived from it; unset is a fatal error. |
104
- | `LITESTREAM_BUCKET` | Object-store bucket. |
105
- | `LITESTREAM_PREFIX` | Key prefix within the bucket. |
106
- | `AWS_REGION` | Region for the S3 client. Unset leaves it to the SDK's own resolution. |
107
- | `CREDS_SYNC_INTERVAL` | Seconds between sync ticks, reported by `env` for the caller's loop. Defaults to `60`. |
108
- | `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` | Presence alone counts as configured model auth (see `model-auth-ready`). |
130
+ `packages/runner-image/README.md` documents these same three from the deployment side —
131
+ keep them in sync.
109
132
 
110
- **Persistence is enabled only when both `LITESTREAM_BUCKET` and `LITESTREAM_PREFIX` are
111
- set.** With either missing, `restore` and `sync-once` become no-ops and `env` warns
112
- loudly that credentials will be lost when the task is replaced — half a location can
113
- never produce a malformed key.
133
+ Requiring **both** `LITESTREAM_BUCKET` and `LITESTREAM_PREFIX` (never just one) means
134
+ half a location can never produce a malformed key.
114
135
 
115
- The paths and keys that follow from that:
136
+ The paths and keys that follow from the bucket/prefix:
116
137
 
117
138
  | Store | Local path | Object key |
118
139
  | ----------- | ----------------------------------------- | ----------------------------------- |
@@ -171,10 +192,11 @@ pnpm lint
171
192
 
172
193
  From the repository root, prefix with `pnpm --filter @evident-ai/runner-synchroniser`.
173
194
 
174
- The bundle must stay a **single file**: the runner image copies exactly one artifact out
175
- of its builder stage, so code splitting would ship a `cli.js` importing chunks that are
176
- not there. `tsup.config.ts` disables splitting and bundles the AWS SDK, and the
177
- Dockerfile asserts the output is one file.
195
+ The bundle must stay a **single file**: both consumers need a self-contained
196
+ `dist/cli.js` with no sibling chunks the npm `files: ["dist"]` install ships
197
+ whatever `dist` contains, and the MicroVM runs `dist/cli.js` directly with no
198
+ `node_modules` alongside it. `tsup.config.ts` disables splitting and bundles the
199
+ AWS SDK so neither consumer needs anything else.
178
200
 
179
201
  The restore/sync/CLI tests need neither AWS nor a real filesystem — rather than shimming
180
202
  a fake `aws` binary onto `PATH`, they inject two ports: `InMemoryObjectStore` (in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evident-ai/runner-synchroniser",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-dev.7568241",
4
4
  "description": "Restores and syncs the Evident runner's OpenCode credential stores (and litestream config) to an object store, so a runner survives task replacement with almost no state loss.",
5
5
  "type": "module",
6
6
  "main": "./dist/cli.js",