@stringsync/splates 0.0.55 → 0.0.56
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 +9 -56
- package/index.js +238 -480
- package/package.json +2 -2
- package/budget.d.ts +0 -3
- package/runners.d.ts +0 -3
package/README.md
CHANGED
|
@@ -59,11 +59,10 @@ in `splates.config.ts` to move the directory, relative to the checkout root
|
|
|
59
59
|
or to an absolute path. Notes change through tasks, just as code does.
|
|
60
60
|
Keep sensitive information out of them.
|
|
61
61
|
|
|
62
|
-
**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
heavy, such as a test suite an agent runs mid-task, in a slot too.
|
|
62
|
+
**One premerge at a time.** Each merge's gate (`postRewrite` and
|
|
63
|
+
`preMerge`) holds the machine's premerge lock, so merges from several agents
|
|
64
|
+
test one after another rather than run the machine out of memory. A gate
|
|
65
|
+
that runs past 3 minutes is killed, and the agent merges again.
|
|
67
66
|
|
|
68
67
|
**Pushing.** With `remote: "origin"` in `splates.config.ts`, each task's
|
|
69
68
|
branch goes to that remote as `splates/<task>`: after every commit an agent
|
|
@@ -251,58 +250,12 @@ traffic, and `--tunnel-name` is refused beside a provider of your own. One
|
|
|
251
250
|
that is not ready, or fails to start, is logged and skipped: the page keeps
|
|
252
251
|
serving on this machine.
|
|
253
252
|
|
|
254
|
-
###
|
|
253
|
+
### Local worker
|
|
255
254
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
```ts
|
|
261
|
-
import type { ConfigFile } from "@stringsync/splates-server/config";
|
|
262
|
-
import type { WorkerProvider } from "@stringsync/splates-server/workers";
|
|
263
|
-
|
|
264
|
-
const myCloud: WorkerProvider = {
|
|
265
|
-
// the machines it makes, with what each costs you per hour
|
|
266
|
-
types: async () => [
|
|
267
|
-
{ name: "small", platform: "linux", slots: 4, dollarsPerHour: 0.05 },
|
|
268
|
-
],
|
|
269
|
-
// build an image by running recipe.script as root on a fresh machine
|
|
270
|
-
snapshot: async (recipe) => ({ id: "img-1", version: recipe.version, builtAt: Date.now() }),
|
|
271
|
-
// boot spec.snapshot and run spec.boot on it, as the `splates` user
|
|
272
|
-
create: async (spec) => ({ id: spec.id, type: spec.type }),
|
|
273
|
-
destroy: async (id) => {},
|
|
274
|
-
// the machines it made that still exist
|
|
275
|
-
list: async () => [],
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
export default { workerProvider: myCloud } satisfies ConfigFile;
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
A made worker boots from a snapshot splates asks for when there is none, and
|
|
282
|
-
again when splates's version changes or the snapshot is a week old; it holds
|
|
283
|
-
bun, git, the browser and splates, and no credentials. Its boot command spends
|
|
284
|
-
a single-use join token, dialing the page at its tunnel host, so the server
|
|
285
|
-
needs a tunnel. Placement makes one only once agents other agents started are
|
|
286
|
-
queued, and only as far as the worker budget allows; none is kept warm.
|
|
287
|
-
`splates worker add --provider [--type <name>]` makes one by hand, past the
|
|
288
|
-
rate cap, and `splates worker remove` destroys its machine.
|
|
289
|
-
|
|
290
|
-
The worker budget is in dollars, at each type's list price, so every figure is
|
|
291
|
-
an estimate: a rate cap on what the made workers running at once cost an hour
|
|
292
|
-
($1/h by default), and limits on what they cost in a day ($15) and a month
|
|
293
|
-
($200), from the start of each in local time. Past the rate cap no worker is
|
|
294
|
-
made, and the queue says which limit holds it, as `rate cap $1.00/h reached`.
|
|
295
|
-
Once a day's or month's limit is spent, made workers take nothing new, their
|
|
296
|
-
agents are asked to stop at a checkpoint, and each is destroyed once its last
|
|
297
|
-
agent ends. Each limit warns at 80%, 90% and 100%, once in its window, by Web
|
|
298
|
-
Push and on the page's header. Agents' own API spend is not counted here.
|
|
299
|
-
|
|
300
|
-
```bash
|
|
301
|
-
bunx @stringsync/splates budget show
|
|
302
|
-
bunx @stringsync/splates budget set day 10 # or `default`
|
|
303
|
-
bunx @stringsync/splates budget raise hour 0.1 --for 1d
|
|
304
|
-
bunx @stringsync/splates budget end 1 # a raise, by its number
|
|
305
|
-
```
|
|
255
|
+
This machine's own worker runs agents over a private Unix socket and
|
|
256
|
+
reconnects when the server restarts. Remote workers cannot join.
|
|
257
|
+
Use `splates worker list` to inspect it, `splates worker slots local <n>`
|
|
258
|
+
to set its slots, and `splates worker drain local --undo` to resume it.
|
|
306
259
|
|
|
307
260
|
### Task ports
|
|
308
261
|
|