@stringsync/splates 0.0.54 → 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 -73
- package/handoff.d.ts +13 -0
- package/index.js +405 -605
- package/package.json +2 -2
- package/replica.d.ts +3 -0
- package/server.d.ts +1 -2
- package/budget.d.ts +0 -3
- package/infra.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,75 +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
|
-
`splates
|
|
259
|
-
|
|
260
|
-
```ts
|
|
261
|
-
import { AwsCloud } from "@stringsync/splates-server/cloud";
|
|
262
|
-
import type { ConfigFile } from "@stringsync/splates-server/config";
|
|
263
|
-
|
|
264
|
-
export default { cloud: new AwsCloud() } satisfies ConfigFile;
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
`AwsCloud` comes with splates, signed with the AWS CLI's sign-in or the
|
|
268
|
-
instance role. Another is a class that implements
|
|
269
|
-
`CloudProvider` from `@stringsync/splates-server/cloud`: making, listing and
|
|
270
|
-
deleting tagged machines, snapshots, SSH keys and firewalls through the
|
|
271
|
-
cloud's API, with its machine types and prices. splates makes both the
|
|
272
|
-
workers and the coordinator's box (`splates server deploy`) over it.
|
|
273
|
-
|
|
274
|
-
For machines that are not a cloud's, give it a `workerProvider` instead, any
|
|
275
|
-
object that implements `WorkerProvider`:
|
|
276
|
-
|
|
277
|
-
```ts
|
|
278
|
-
import type { ConfigFile } from "@stringsync/splates-server/config";
|
|
279
|
-
import type { WorkerProvider } from "@stringsync/splates-server/workers";
|
|
280
|
-
|
|
281
|
-
const myCloud: WorkerProvider = {
|
|
282
|
-
// the machines it makes, with what each costs you per hour
|
|
283
|
-
types: async () => [
|
|
284
|
-
{ name: "small", platform: "linux", slots: 4, dollarsPerHour: 0.05 },
|
|
285
|
-
],
|
|
286
|
-
// build an image by running recipe.script as root on a fresh machine
|
|
287
|
-
snapshot: async (recipe) => ({ id: "img-1", version: recipe.version, builtAt: Date.now() }),
|
|
288
|
-
// boot spec.snapshot and run spec.boot on it, as the `splates` user
|
|
289
|
-
create: async (spec) => ({ id: spec.id, type: spec.type }),
|
|
290
|
-
destroy: async (id) => {},
|
|
291
|
-
// the machines it made that still exist
|
|
292
|
-
list: async () => [],
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
export default { workerProvider: myCloud } satisfies ConfigFile;
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
A made worker boots from a snapshot splates asks for when there is none, and
|
|
299
|
-
again when splates's version changes or the snapshot is a week old; it holds
|
|
300
|
-
bun, git, the browser and splates, and no credentials. Its boot command spends
|
|
301
|
-
a single-use join token, dialing the page at its tunnel host, so the server
|
|
302
|
-
needs a tunnel. Placement makes one only once agents other agents started are
|
|
303
|
-
queued, and only as far as the worker budget allows; none is kept warm.
|
|
304
|
-
`splates worker add --provider [--type <name>]` makes one by hand, past the
|
|
305
|
-
rate cap, and `splates worker remove` destroys its machine.
|
|
306
|
-
|
|
307
|
-
The worker budget is in dollars, at each type's list price, so every figure is
|
|
308
|
-
an estimate: a rate cap on what the made workers running at once cost an hour
|
|
309
|
-
($0.25/h by default), and limits on what they cost in a day ($5) and a month
|
|
310
|
-
($75), from the start of each in local time. Past the rate cap no worker is
|
|
311
|
-
made, and the queue says which limit holds it, as `rate cap $0.25/h reached`.
|
|
312
|
-
Once a day's or month's limit is spent, made workers take nothing new, their
|
|
313
|
-
agents are asked to stop at a checkpoint, and each is destroyed once its last
|
|
314
|
-
agent ends. Each limit warns at 80%, 90% and 100%, once in its window, by Web
|
|
315
|
-
Push and on the page's header. Agents' own API spend is not counted here.
|
|
316
|
-
|
|
317
|
-
```bash
|
|
318
|
-
bunx @stringsync/splates budget show
|
|
319
|
-
bunx @stringsync/splates budget set day 10 # or `default`
|
|
320
|
-
bunx @stringsync/splates budget raise hour 0.1 --for 1d
|
|
321
|
-
bunx @stringsync/splates budget end 1 # a raise, by its number
|
|
322
|
-
```
|
|
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.
|
|
323
259
|
|
|
324
260
|
### Task ports
|
|
325
261
|
|
package/handoff.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Set by `checkout.ts` once `splates dev` is mounted on this process. */
|
|
2
|
+
export declare const devMounted: {
|
|
3
|
+
value: boolean;
|
|
4
|
+
};
|
|
5
|
+
/** The nearest directory at or above `cwd` that is a splates checkout. */
|
|
6
|
+
export declare function checkoutAbove(cwd: string): string | null;
|
|
7
|
+
/**
|
|
8
|
+
* The release has no `splates dev`, and would print help and exit 0, which
|
|
9
|
+
* reads as a passing `splates dev test`. Standing in a checkout, run the
|
|
10
|
+
* checkout's own `bin/splates` instead; anywhere else, fail saying so.
|
|
11
|
+
* Returns the exit code, or null when `argv` is no `dev` command.
|
|
12
|
+
*/
|
|
13
|
+
export declare function handOffDev(argv: string[], cwd: string): Promise<number | null>;
|