@stringsync/splates 0.0.55 → 0.0.57
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 +12 -57
- package/index.js +236 -493
- package/package.json +2 -2
- package/budget.d.ts +0 -3
- package/runners.d.ts +0 -3
package/README.md
CHANGED
|
@@ -47,7 +47,8 @@ removes the worktree. A conflict or a failing check goes back to the agent that
|
|
|
47
47
|
made the change, which fixes it and merges again. A check that writes a JUnit
|
|
48
48
|
XML report to `$SPLATES_TEST_REPORT` (`bun test --reporter=junit
|
|
49
49
|
--reporter-outfile="$SPLATES_TEST_REPORT"`) queues a task for each test slower
|
|
50
|
-
than 5 seconds.
|
|
50
|
+
than 5 seconds. A check that appends `{"phase": "<name>", "ms": <n>}` lines to
|
|
51
|
+
`$SPLATES_GATE_PHASES` has those phase times kept in the merge's log entry.
|
|
51
52
|
|
|
52
53
|
**Project notes.** Keep durable conventions, decisions and other project context
|
|
53
54
|
as short Markdown files in `notes/`, one thing per file, edited in place.
|
|
@@ -59,11 +60,11 @@ in `splates.config.ts` to move the directory, relative to the checkout root
|
|
|
59
60
|
or to an absolute path. Notes change through tasks, just as code does.
|
|
60
61
|
Keep sensitive information out of them.
|
|
61
62
|
|
|
62
|
-
**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
**One premerge at a time.** Each merge's gate (`postRewrite` and
|
|
64
|
+
`preMerge`) holds the machine's premerge lock, so merges from several agents
|
|
65
|
+
test one after another rather than run the machine out of memory. A gate
|
|
66
|
+
that runs past 3 minutes is killed, and the agent merges again. A `preLock`
|
|
67
|
+
command, if set, runs before the wait, so checks that need no lock fail first.
|
|
67
68
|
|
|
68
69
|
**Pushing.** With `remote: "origin"` in `splates.config.ts`, each task's
|
|
69
70
|
branch goes to that remote as `splates/<task>`: after every commit an agent
|
|
@@ -251,58 +252,12 @@ traffic, and `--tunnel-name` is refused beside a provider of your own. One
|
|
|
251
252
|
that is not ready, or fails to start, is logged and skipped: the page keeps
|
|
252
253
|
serving on this machine.
|
|
253
254
|
|
|
254
|
-
###
|
|
255
|
+
### Local worker
|
|
255
256
|
|
|
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
|
-
```
|
|
257
|
+
This machine's own worker runs agents over a private Unix socket and
|
|
258
|
+
reconnects when the server restarts. Remote workers cannot join.
|
|
259
|
+
It runs as many agents at once as are started. Use `splates worker list` to
|
|
260
|
+
inspect it, and `splates worker drain local --undo` to resume it.
|
|
306
261
|
|
|
307
262
|
### Task ports
|
|
308
263
|
|