@stringsync/splates 0.0.0-stage → 0.0.45
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/LICENSE +21 -0
- package/README.md +308 -2
- package/acp-extensions.d.ts +82 -0
- package/add.d.ts +53 -0
- package/adherence.d.ts +49 -0
- package/age.d.ts +2 -0
- package/agent-connection.d.ts +171 -0
- package/agent-errors.d.ts +2 -0
- package/agent-process.d.ts +65 -0
- package/agent-stream.d.ts +91 -0
- package/agents.d.ts +15 -0
- package/artifact-room.d.ts +47 -0
- package/artifact-viewers.d.ts +6 -0
- package/artifact.d.ts +30 -0
- package/artifacts.d.ts +161 -0
- package/asked.d.ts +146 -0
- package/asked.js +7 -0
- package/assumed.d.ts +34 -0
- package/attach.d.ts +30 -0
- package/attachments.d.ts +43 -0
- package/baselines.d.ts +55 -0
- package/claim.d.ts +17 -0
- package/cloudflare-api.d.ts +25 -0
- package/cloudflare-error.d.ts +5 -0
- package/cloudflared-tunnel-provider.d.ts +27 -0
- package/codex-limits.d.ts +19 -0
- package/compaction.d.ts +17 -0
- package/config-source.d.ts +13 -0
- package/config.d.ts +98 -0
- package/config.js +7 -0
- package/conversation-archive.d.ts +6 -0
- package/conversation-background.d.ts +21 -0
- package/conversation-choice.d.ts +4 -0
- package/conversation-files.d.ts +51 -0
- package/conversation-given.d.ts +8 -0
- package/conversation-host.d.ts +102 -0
- package/conversation-listing.d.ts +15 -0
- package/conversation-log.d.ts +301 -0
- package/conversation-messages.d.ts +18 -0
- package/conversation-name.d.ts +28 -0
- package/conversation-options.d.ts +73 -0
- package/conversation-reference.d.ts +2 -0
- package/conversation-state.d.ts +472 -0
- package/conversation-turns.d.ts +115 -0
- package/conversation.d.ts +209 -0
- package/conversations.d.ts +140 -0
- package/coordinator-state.d.ts +28 -0
- package/creds.d.ts +123 -0
- package/darwin-temperature.d.ts +7 -0
- package/decided.d.ts +18 -0
- package/demo.d.ts +29 -0
- package/dev/api.d.ts +209 -0
- package/dev/assets.d.ts +24 -0
- package/dev/conversation-address.d.ts +47 -0
- package/dev/conversation-feed.d.ts +166 -0
- package/dev/live-stream.d.ts +29 -0
- package/dev/worker.d.ts +33 -0
- package/dev-access.d.ts +61 -0
- package/dev-artifacts.d.ts +22 -0
- package/dev-budgets.d.ts +18 -0
- package/dev-conversation-events.d.ts +39 -0
- package/dev-conversation-routes.d.ts +90 -0
- package/dev-creds.d.ts +17 -0
- package/dev-dictation-connection.d.ts +18 -0
- package/dev-dictation.d.ts +17 -0
- package/dev-http.d.ts +76 -0
- package/dev-open.d.ts +15 -0
- package/dev-options.d.ts +133 -0
- package/dev-outcomes.d.ts +21 -0
- package/dev-pages.d.ts +16 -0
- package/dev-picker.d.ts +57 -0
- package/dev-port-socket.d.ts +26 -0
- package/dev-ports.d.ts +11 -0
- package/dev-project-watch.d.ts +44 -0
- package/dev-project.d.ts +168 -0
- package/dev-push.d.ts +59 -0
- package/dev-restart.d.ts +141 -0
- package/dev-servers.d.ts +30 -0
- package/dev-setup-native.d.ts +23 -0
- package/dev-setup-opencode.d.ts +29 -0
- package/dev-setup.d.ts +16 -0
- package/dev-shell.d.ts +70 -0
- package/dev-slot.d.ts +28 -0
- package/dev-sockets.d.ts +13 -0
- package/dev-task-ports.d.ts +73 -0
- package/dev-tasks.d.ts +20 -0
- package/dev-terminal-connection.d.ts +19 -0
- package/dev-terminal.d.ts +42 -0
- package/dev-todos.d.ts +35 -0
- package/dev-transcriber.d.ts +15 -0
- package/dev-tunnel.d.ts +38 -0
- package/dev-versions.d.ts +53 -0
- package/dev-workers.d.ts +55 -0
- package/dev.d.ts +24 -0
- package/diff.d.ts +29 -0
- package/dispatched.d.ts +16 -0
- package/editors.d.ts +22 -0
- package/escalate.d.ts +27 -0
- package/events.d.ts +311 -0
- package/everywhere.d.ts +41 -0
- package/exhibit.d.ts +21 -0
- package/exit.d.ts +54 -0
- package/fact-todos.d.ts +18 -0
- package/fake-agent.d.ts +107 -0
- package/fake-agent.js +284 -0
- package/finding-facts.d.ts +38 -0
- package/findings.d.ts +84 -0
- package/fold.d.ts +43 -0
- package/follow.d.ts +41 -0
- package/format.d.ts +68 -0
- package/git.d.ts +112 -0
- package/handed-out.d.ts +79 -0
- package/handoff.d.ts +23 -0
- package/heavy-run.d.ts +12 -0
- package/heavy.d.ts +28 -0
- package/heavy.js +16 -0
- package/held.d.ts +22 -0
- package/index-0tfvy823.js +272 -0
- package/index-43pq33n4.js +157 -0
- package/index-4776671w.js +698 -0
- package/index-d4hjrzaq.js +464 -0
- package/index-gcfq7awr.js +740 -0
- package/index-k73tsw5g.js +101 -0
- package/index-kaa44k7q.js +59 -0
- package/index-vcv9m93e.js +1265 -0
- package/index-xmfmy729.js +249 -0
- package/index.d.ts +2 -0
- package/index.js +26928 -0
- package/init.d.ts +28 -0
- package/journal.d.ts +57 -0
- package/landed.d.ts +14 -0
- package/lane-todos.d.ts +44 -0
- package/lane.d.ts +55 -0
- package/lanes-from-tags.d.ts +17 -0
- package/lanes.d.ts +96 -0
- package/legacy-names.d.ts +70 -0
- package/legacy-ps.d.ts +31 -0
- package/limits.d.ts +32 -0
- package/list.d.ts +18 -0
- package/load-config.d.ts +44 -0
- package/log.d.ts +14 -0
- package/machine.d.ts +42 -0
- package/merge.d.ts +35 -0
- package/migrate-config.d.ts +31 -0
- package/models.d.ts +24 -0
- package/needs.d.ts +115 -0
- package/notices.d.ts +39 -0
- package/offered.d.ts +39 -0
- package/opencode-usage.d.ts +37 -0
- package/outcomes.d.ts +114 -0
- package/package.json +74 -5
- package/path.d.ts +13 -0
- package/plan.d.ts +236 -0
- package/port-forward.d.ts +22 -0
- package/port-pipe.d.ts +36 -0
- package/ports-list.d.ts +19 -0
- package/probe-runtime.d.ts +5 -0
- package/probe-runtime.js +13 -0
- package/project-reaches.d.ts +23 -0
- package/projects.d.ts +136 -0
- package/prompts.d.ts +128 -0
- package/pty.d.ts +39 -0
- package/pulse.d.ts +8 -0
- package/recommend.d.ts +31 -0
- package/release.d.ts +41 -0
- package/remote-process.d.ts +26 -0
- package/remote-pty.d.ts +29 -0
- package/remote-worker.d.ts +77 -0
- package/remove.d.ts +31 -0
- package/repository.d.ts +91 -0
- package/retry.d.ts +34 -0
- package/roster.d.ts +63 -0
- package/saved-ports-host.d.ts +25 -0
- package/saved-tunnel.d.ts +44 -0
- package/server-worker-socket.d.ts +21 -0
- package/setup-areas.d.ts +7 -0
- package/setup-opencode-model-error.d.ts +3 -0
- package/setup-opencode-models.d.ts +54 -0
- package/setup-opencode-recipe.d.ts +26 -0
- package/setup-opencode.d.ts +46 -0
- package/setup.d.ts +102 -0
- package/shared-browser.d.ts +50 -0
- package/shell.d.ts +17 -0
- package/show.d.ts +106 -0
- package/skill-checks.d.ts +73 -0
- package/skill-checks.js +10 -0
- package/skills.d.ts +16 -0
- package/slot-tunnel.d.ts +27 -0
- package/slots.d.ts +135 -0
- package/snapshot.d.ts +75 -0
- package/splates-artifact.d.ts +3 -0
- package/splates-creds.d.ts +3 -0
- package/splates-dev.d.ts +22 -0
- package/splates-flags.d.ts +34 -0
- package/splates-lane.d.ts +3 -0
- package/splates-projects.d.ts +3 -0
- package/splates-setup.d.ts +17 -0
- package/splates-slots.d.ts +3 -0
- package/splates-todo.d.ts +3 -0
- package/splates-tunnel.d.ts +3 -0
- package/splates-worker.d.ts +3 -0
- package/splates.d.ts +28 -0
- package/stats.d.ts +186 -0
- package/supervise.d.ts +50 -0
- package/system-changes.d.ts +67 -0
- package/system.d.ts +28 -0
- package/systems.d.ts +119 -0
- package/systems.js +21 -0
- package/table.d.ts +5 -0
- package/task-log.d.ts +35 -0
- package/task-ports.d.ts +25 -0
- package/tell.d.ts +47 -0
- package/todo-edit.d.ts +60 -0
- package/todo-file.d.ts +6 -0
- package/todo-lanes.d.ts +82 -0
- package/todo-list.d.ts +26 -0
- package/todo-take.d.ts +27 -0
- package/todo.d.ts +146 -0
- package/todos.d.ts +157 -0
- package/tool-calls.d.ts +18 -0
- package/tunnel-provider.d.ts +37 -0
- package/tunnel-provider.js +0 -0
- package/tunnel-remove.d.ts +28 -0
- package/tunnel-setup.d.ts +104 -0
- package/unix-worker-listener.d.ts +23 -0
- package/unix-worker-socket.d.ts +30 -0
- package/update.d.ts +29 -0
- package/update.js +10 -0
- package/vocabulary.d.ts +9 -0
- package/wait.d.ts +36 -0
- package/watch.d.ts +46 -0
- package/watched.d.ts +43 -0
- package/websocket-worker-socket.d.ts +18 -0
- package/worker-call-host.d.ts +51 -0
- package/worker-channel.d.ts +83 -0
- package/worker-connection.d.ts +24 -0
- package/worker-daemon.d.ts +64 -0
- package/worker-git.d.ts +18 -0
- package/worker-list.d.ts +49 -0
- package/worker-machine.d.ts +34 -0
- package/worker-port-host.d.ts +21 -0
- package/worker-process-host.d.ts +29 -0
- package/worker-protocol.d.ts +104 -0
- package/worker-pty-host.d.ts +34 -0
- package/worker-registry.d.ts +68 -0
- package/worker-replay.d.ts +25 -0
- package/worker-run.d.ts +20 -0
- package/worker-session.d.ts +189 -0
- package/worker-socket.d.ts +15 -0
- package/worktree-service.d.ts +113 -0
- package/worktree.d.ts +232 -0
package/remove.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Logger } from "webappwiz/log";
|
|
2
|
+
import { type Slots } from "./slots.js";
|
|
3
|
+
import type { Todos } from "./todos.js";
|
|
4
|
+
import type { RemoveReason } from "./worktree.js";
|
|
5
|
+
import type { WorktreeService } from "./worktree-service.js";
|
|
6
|
+
export interface RemoveOptions {
|
|
7
|
+
/** Discard the tree even when another agent holds its lease. */
|
|
8
|
+
force?: boolean;
|
|
9
|
+
/** The `splates server` conversation working on it, when removed from the page. */
|
|
10
|
+
conversation?: string;
|
|
11
|
+
/** Why, kept in its outcome for the Stats page. */
|
|
12
|
+
reason?: RemoveReason;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Discards a whole task: `git worktree remove` plus the branch and the
|
|
16
|
+
* record.
|
|
17
|
+
*
|
|
18
|
+
* Throwing a task away and redoing it against current trunk is usually cheaper
|
|
19
|
+
* than a hard rebase, so this is meant to be used freely.
|
|
20
|
+
*/
|
|
21
|
+
export declare function remove({ service, log, todos, slots, }: {
|
|
22
|
+
service: WorktreeService;
|
|
23
|
+
log: Logger;
|
|
24
|
+
todos: Todos;
|
|
25
|
+
slots: Slots;
|
|
26
|
+
}, task: string, { force, conversation, reason }?: RemoveOptions): Promise<{
|
|
27
|
+
released: {
|
|
28
|
+
id: number;
|
|
29
|
+
subject: string;
|
|
30
|
+
}[];
|
|
31
|
+
}>;
|
package/repository.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { Deps, Middleware } from "webappwiz/cmd";
|
|
2
|
+
import type { HeavyCap } from "webappwiz/system";
|
|
3
|
+
import { type Fs, type Lock } from "webappwiz/system";
|
|
4
|
+
import type { Config } from "./config.js";
|
|
5
|
+
import { Creds, type SecretStores } from "./creds.js";
|
|
6
|
+
import { Format } from "./format.js";
|
|
7
|
+
import { Git } from "./git.js";
|
|
8
|
+
import { Journal } from "./journal.js";
|
|
9
|
+
import { Outcomes } from "./outcomes.js";
|
|
10
|
+
import { Projects, type Reach } from "./projects.js";
|
|
11
|
+
import { Shell } from "./shell.js";
|
|
12
|
+
import { Slots } from "./slots.js";
|
|
13
|
+
import { Todos } from "./todos.js";
|
|
14
|
+
import { WorktreeService } from "./worktree-service.js";
|
|
15
|
+
/** What a command gets to work with, once there is a repository to work in. */
|
|
16
|
+
export interface Repository {
|
|
17
|
+
/** Where splates keeps its records: `.git/splates`, shared by every worktree. */
|
|
18
|
+
splatesDir: string;
|
|
19
|
+
config: Config;
|
|
20
|
+
/** Checked before the command runs, so its records are in this splates's format. */
|
|
21
|
+
format: Format;
|
|
22
|
+
git: Git;
|
|
23
|
+
service: WorktreeService;
|
|
24
|
+
lock: Lock;
|
|
25
|
+
shell: Shell;
|
|
26
|
+
journal: Journal;
|
|
27
|
+
todos: Todos;
|
|
28
|
+
/** How each task on this machine ended, which a merge reads its findings from. */
|
|
29
|
+
outcomes: Outcomes;
|
|
30
|
+
/** Every splates project on this machine, which `splates init` joins this one to. */
|
|
31
|
+
projects: Projects;
|
|
32
|
+
/** The creds agents ask for, and the stores they are kept in. */
|
|
33
|
+
creds: Creds;
|
|
34
|
+
/** The machine's dev slots, which a task gives back as it ends. */
|
|
35
|
+
slots: Slots;
|
|
36
|
+
/** The machine's slots for test runs and installs, which hooks wait for. */
|
|
37
|
+
heavy: HeavyCap;
|
|
38
|
+
}
|
|
39
|
+
/** How `repository` treats records in an older format than this splates's. */
|
|
40
|
+
export interface RepositoryOptions {
|
|
41
|
+
/**
|
|
42
|
+
* Brings them forward before the action runs. Only `splates server` does: a
|
|
43
|
+
* migration is the server's to run, with its sessions settled, so every
|
|
44
|
+
* other command refuses them until it has.
|
|
45
|
+
*/
|
|
46
|
+
migrates?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Sets up the records of a repository that has none first, as only
|
|
49
|
+
* `splates init` does: every other command refuses one.
|
|
50
|
+
*/
|
|
51
|
+
creates?: boolean;
|
|
52
|
+
/** Where to look for the repository; the working directory by default. */
|
|
53
|
+
at?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Runs the action against the repository `cwd` sits in, or the registered
|
|
57
|
+
* project `--project` names, and refuses to run it at all when that is not
|
|
58
|
+
* a repository, its records are in a format this splates does not read, or
|
|
59
|
+
* the command is run from another project that has not been granted what
|
|
60
|
+
* it `needs` there.
|
|
61
|
+
*/
|
|
62
|
+
export declare function repository<C extends Deps & {
|
|
63
|
+
fs: Fs;
|
|
64
|
+
secrets?: SecretStores;
|
|
65
|
+
project?: string;
|
|
66
|
+
}>(opts: Omit<RepositoryOptions, "at"> & {
|
|
67
|
+
needs: Needs;
|
|
68
|
+
}): Middleware<C, C & Repository & Reached>;
|
|
69
|
+
/**
|
|
70
|
+
* What a command needs of the project it runs on, when an agent of another
|
|
71
|
+
* project runs it: a reach that project must have granted, or `own` for a
|
|
72
|
+
* command no other project may run there at all.
|
|
73
|
+
*/
|
|
74
|
+
export type Needs = Reach | "own";
|
|
75
|
+
/** What `repository` adds beyond the repository itself. */
|
|
76
|
+
export interface Reached {
|
|
77
|
+
/**
|
|
78
|
+
* The main tree of the other project the command is run from, as checked
|
|
79
|
+
* against what it `needs`; null when run from this one, or from none.
|
|
80
|
+
*/
|
|
81
|
+
elsewhere: string | null;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* What a command works with in the repository `at` sits in, the working
|
|
85
|
+
* directory by default: what `repository` hands an action, and what `splates
|
|
86
|
+
* dev` opens each project it serves with. Refuses what `repository` does.
|
|
87
|
+
*/
|
|
88
|
+
export declare function openRepository({ fs, ps, log, secrets, }: Deps & {
|
|
89
|
+
fs: Fs;
|
|
90
|
+
secrets?: SecretStores;
|
|
91
|
+
}, { migrates, creates, at }?: RepositoryOptions): Promise<Repository>;
|
package/retry.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Logger } from "webappwiz/log";
|
|
2
|
+
import type { Config } from "./config.js";
|
|
3
|
+
import type { Journal } from "./journal.js";
|
|
4
|
+
import type { Worktree } from "./worktree.js";
|
|
5
|
+
import type { WorktreeService } from "./worktree-service.js";
|
|
6
|
+
/**
|
|
7
|
+
* The way back from `budget_exhausted`. A task that has spent its merge
|
|
8
|
+
* attempts gets another `mergeRetryCount` of them, instead of `remove` and redo.
|
|
9
|
+
*
|
|
10
|
+
* Only from `escalated`, and deliberately: the budget's whole job is to make an
|
|
11
|
+
* agent stop and hand the task over. An agent that could grant itself more
|
|
12
|
+
* would be back to grinding against a moving trunk forever, so the price of a
|
|
13
|
+
* fresh budget is that a human has looked at the tree first.
|
|
14
|
+
*/
|
|
15
|
+
export declare function retry({ service, config, log, }: {
|
|
16
|
+
service: WorktreeService;
|
|
17
|
+
config: Config;
|
|
18
|
+
log: Logger;
|
|
19
|
+
}, task: string): Promise<Granted>;
|
|
20
|
+
/** `retry`, recorded in the journal with the attempts the task had spent. */
|
|
21
|
+
export declare function recordRetry(ctx: {
|
|
22
|
+
journal: Journal;
|
|
23
|
+
service: WorktreeService;
|
|
24
|
+
config: Config;
|
|
25
|
+
log: Logger;
|
|
26
|
+
}, task: string): Promise<Granted>;
|
|
27
|
+
/** A retry that was granted: the task back to working, and the attempts it had spent. */
|
|
28
|
+
export interface Granted {
|
|
29
|
+
worktree: Worktree;
|
|
30
|
+
/** The merge attempts it had spent before the grant. */
|
|
31
|
+
attempts: number;
|
|
32
|
+
}
|
|
33
|
+
/** What `retry` does, without the printing, for `splates server`'s page too. */
|
|
34
|
+
export declare function grantRetry(service: WorktreeService, task: string): Promise<Granted>;
|
package/roster.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Fs, Ps } from "webappwiz/system";
|
|
2
|
+
import type { Agent } from "./conversations.js";
|
|
3
|
+
/**
|
|
4
|
+
* The agents splates can start, and the models each runs, kept in one file
|
|
5
|
+
* under the user's home rather than per project: an orchestrator in any
|
|
6
|
+
* project, of any model family, can read it to delegate to any other.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Roster {
|
|
9
|
+
/** `~/.splates/agents.json`, or a test's own. */
|
|
10
|
+
readonly path: string;
|
|
11
|
+
private readonly deps;
|
|
12
|
+
constructor(
|
|
13
|
+
/** `~/.splates/agents.json`, or a test's own. */
|
|
14
|
+
path: string, deps: {
|
|
15
|
+
fs: Fs;
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Writes the defaults when there is no roster yet, saying whether it did,
|
|
19
|
+
* so the user has a file to edit rather than a list they cannot see.
|
|
20
|
+
*/
|
|
21
|
+
seed(): Promise<boolean>;
|
|
22
|
+
/** Every agent on the roster, in its order; the defaults when there is none. */
|
|
23
|
+
agents(): Promise<RosterAgent[]>;
|
|
24
|
+
}
|
|
25
|
+
/** A model an agent can run, and what picking it buys. */
|
|
26
|
+
export interface RosterModel {
|
|
27
|
+
/** What the agent's Model setting takes: `opus`, `gpt-6-luna`. */
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
/** What it is good at, so an orchestrator can choose it for a job. */
|
|
31
|
+
strengths: string;
|
|
32
|
+
/** What it costs, relative to the others or as a price. */
|
|
33
|
+
cost: string;
|
|
34
|
+
}
|
|
35
|
+
/** An agent on the roster: how to start it, and the models it runs. */
|
|
36
|
+
export interface RosterAgent extends Agent {
|
|
37
|
+
models: RosterModel[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The roster a machine starts with: each agent is the ACP adapter its maker
|
|
41
|
+
* publishes, fetched by `bunx` on first use, and its models are those the
|
|
42
|
+
* adapter offers, by the ids its Model setting takes.
|
|
43
|
+
*/
|
|
44
|
+
export declare const DEFAULT_AGENTS: RosterAgent[];
|
|
45
|
+
/** An agent off the roster, on one of its models, or on its own without one. */
|
|
46
|
+
export interface AgentPick {
|
|
47
|
+
agent: string;
|
|
48
|
+
/** The roster's id for the model, which the agent's Model setting takes. */
|
|
49
|
+
model?: string;
|
|
50
|
+
}
|
|
51
|
+
/** The models `agent` runs, as the roster lists them; none for an agent off it. */
|
|
52
|
+
export declare function modelsOf(agent: Agent): RosterModel[];
|
|
53
|
+
/** `pick` in a word: `claude`, or `claude (opus)` on a model. */
|
|
54
|
+
export declare function pickLabel(pick: AgentPick): string;
|
|
55
|
+
/**
|
|
56
|
+
* `agent` on `model`, named by its id or name in any case, as the roster's
|
|
57
|
+
* ids; OpenCode and provider-qualified models require an exact ID. Refuses an agent or a model the roster does not list, saying so with
|
|
58
|
+
* `data`. An agent whose models the roster leaves out takes the model as
|
|
59
|
+
* given.
|
|
60
|
+
*/
|
|
61
|
+
export declare function pickAgent(agents: RosterAgent[], agent: string, model: string | undefined, data?: Record<string, unknown>): AgentPick;
|
|
62
|
+
/** Where the user's splates files live: `~/.splates`, or `SPLATES_HOME`, as the tests set. */
|
|
63
|
+
export declare function splatesHome(ps: Ps): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Fs } from "webappwiz/system";
|
|
2
|
+
/** What `--ports-host` takes to forget the saved base host. */
|
|
3
|
+
export declare const NO_PORTS_HOST = "none";
|
|
4
|
+
/**
|
|
5
|
+
* The wildcard base host this machine serves task ports under, as
|
|
6
|
+
* `<task>-<port>.<base>`: saved by `splates server --ports-host`, per machine as
|
|
7
|
+
* the tunnel is, in `~/.splates/ports.json`, so a bare `splates server` serves it.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SavedPortsHost {
|
|
10
|
+
/** `~/.splates/ports.json`, or a test's own. */
|
|
11
|
+
readonly path: string;
|
|
12
|
+
private readonly fs;
|
|
13
|
+
constructor(
|
|
14
|
+
/** `~/.splates/ports.json`, or a test's own. */
|
|
15
|
+
path: string, fs: Fs);
|
|
16
|
+
/** The saved base, or null when none is, or its format is newer. */
|
|
17
|
+
read(): Promise<string | null>;
|
|
18
|
+
/** Keeps `base`, over what was there, or forgets it for null. */
|
|
19
|
+
save(base: string | null): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* What `--ports-host` asks for: a base host to save, null to forget the
|
|
23
|
+
* saved one, or undefined to serve whatever was saved.
|
|
24
|
+
*/
|
|
25
|
+
export declare function portsHostFlag(flag: string): string | null | undefined;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { SecretStore } from "webappwiz/creds";
|
|
2
|
+
import type { Fs } from "webappwiz/system";
|
|
3
|
+
/** The name the tunnel's token is kept under in the system's secret store. */
|
|
4
|
+
export declare const TUNNEL_TOKEN = "SPLATES_TUNNEL_TOKEN";
|
|
5
|
+
/** What `splates tunnel setup` made, which a bare `splates server` runs. */
|
|
6
|
+
export interface TunnelRecord {
|
|
7
|
+
/** The public host name the tunnel carries to the page. */
|
|
8
|
+
host: string;
|
|
9
|
+
/** The Zero Trust team, as in `<team>.cloudflareaccess.com`. */
|
|
10
|
+
team: string;
|
|
11
|
+
/** The AUD tag of the Access application in front of `host`. */
|
|
12
|
+
aud: string;
|
|
13
|
+
/** The Cloudflare tunnel's id. */
|
|
14
|
+
tunnel: string;
|
|
15
|
+
/**
|
|
16
|
+
* The cred its token is kept as, when not `TUNNEL_TOKEN`: a slot's own,
|
|
17
|
+
* since every slot runs a tunnel of its own.
|
|
18
|
+
*/
|
|
19
|
+
token?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The tunnel this machine set up, kept per machine rather than per project,
|
|
23
|
+
* since one `splates server` serves every project: what it is in
|
|
24
|
+
* `~/.splates/tunnel.json`, and the token that runs it, a secret of this
|
|
25
|
+
* machine, in the device's secret store, as the cred `TUNNEL_TOKEN`.
|
|
26
|
+
*/
|
|
27
|
+
export declare class SavedTunnel {
|
|
28
|
+
/** `~/.splates/tunnel.json`, or a test's own. */
|
|
29
|
+
readonly path: string;
|
|
30
|
+
private readonly deps;
|
|
31
|
+
constructor(
|
|
32
|
+
/** `~/.splates/tunnel.json`, or a test's own. */
|
|
33
|
+
path: string, deps: {
|
|
34
|
+
fs: Fs;
|
|
35
|
+
/** The device's store, which `splates tunnel setup` saves the token in. */
|
|
36
|
+
store: SecretStore;
|
|
37
|
+
});
|
|
38
|
+
/** What was saved, or null when nothing was, or its format is newer. */
|
|
39
|
+
read(): Promise<TunnelRecord | null>;
|
|
40
|
+
/** The token that runs the saved tunnel, or undefined when the store lost it. */
|
|
41
|
+
token(): Promise<string | undefined>;
|
|
42
|
+
/** Keeps `record` in the file, over what was there; its token is a cred. */
|
|
43
|
+
save(record: TunnelRecord): Promise<void>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Connection } from "./dev-sockets.js";
|
|
2
|
+
import type { WorkerRegistry } from "./worker-registry.js";
|
|
3
|
+
import type { WorkerSocket, WorkerSocketEvents } from "./worker-socket.js";
|
|
4
|
+
/**
|
|
5
|
+
* A worker's WebSocket as `splates server` upgraded it on `/api/workers`, seen as
|
|
6
|
+
* a `WorkerSocket`: the server hands it each socket event, and it hands
|
|
7
|
+
* itself to the registry once open.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ServerWorkerSocket implements WorkerSocket, Connection {
|
|
10
|
+
private readonly registry;
|
|
11
|
+
private readonly dispatcher;
|
|
12
|
+
readonly events: import("webappwiz/events").Events<WorkerSocketEvents>;
|
|
13
|
+
private socket;
|
|
14
|
+
private live;
|
|
15
|
+
constructor(registry: WorkerRegistry);
|
|
16
|
+
send(frame: string | Uint8Array): void;
|
|
17
|
+
dispose(): void;
|
|
18
|
+
open(socket: Bun.ServerWebSocket<Connection>): void;
|
|
19
|
+
message(_socket: Bun.ServerWebSocket<Connection>, message: string | Buffer<ArrayBuffer>): void;
|
|
20
|
+
closed(): void;
|
|
21
|
+
}
|
package/setup-areas.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SetupArea } from "./setup.js";
|
|
2
|
+
/**
|
|
3
|
+
* Everything that makes up setting splates up on a machine, in the order it is
|
|
4
|
+
* best done. Each area is a short list of steps the page and an agent walk
|
|
5
|
+
* the user through one at a time.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SETUP_AREAS: readonly SetupArea[];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Fs, type Ps } from "webappwiz/system";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { type OpenCodeRecipe, OpenCodeRecipes } from "./setup-opencode-recipe.js";
|
|
4
|
+
/** Only metadata commands. The configuration is embedded in the roster argv so
|
|
5
|
+
* a single atomic rename activates both the models and their experiment policy. */
|
|
6
|
+
export declare class OpenCodeModels {
|
|
7
|
+
private readonly deps;
|
|
8
|
+
private readonly metadata;
|
|
9
|
+
private catalog;
|
|
10
|
+
private previewed;
|
|
11
|
+
private saved;
|
|
12
|
+
readonly recipes: OpenCodeRecipes;
|
|
13
|
+
constructor(deps: {
|
|
14
|
+
fs: Fs;
|
|
15
|
+
ps: Ps;
|
|
16
|
+
home: string;
|
|
17
|
+
}, metadata: OpenCodeMetadata);
|
|
18
|
+
read(): OpenCodeModelState;
|
|
19
|
+
invalidate(): void;
|
|
20
|
+
cancel(): void;
|
|
21
|
+
refresh(signal: AbortSignal): Promise<OpenCodeModelState>;
|
|
22
|
+
preview(selection: OpenCodeSelection, signal: AbortSignal): Promise<OpenCodeModelState>;
|
|
23
|
+
apply(token: string, balanceOff: boolean, signal: AbortSignal): Promise<OpenCodeModelState>;
|
|
24
|
+
verifyStored(recipe: OpenCodeRecipe, cwd: string, signal: AbortSignal): Promise<void>;
|
|
25
|
+
private requireModels;
|
|
26
|
+
private discover;
|
|
27
|
+
private agents;
|
|
28
|
+
private verify;
|
|
29
|
+
private roster;
|
|
30
|
+
}
|
|
31
|
+
export declare const openCodeSelection: z.ZodObject<{
|
|
32
|
+
model: z.ZodString;
|
|
33
|
+
auxiliary: z.ZodString;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type OpenCodeSelection = z.infer<typeof openCodeSelection>;
|
|
36
|
+
export interface OpenCodeCatalog {
|
|
37
|
+
models: string[];
|
|
38
|
+
checkedAt: string | null;
|
|
39
|
+
problem: string | null;
|
|
40
|
+
}
|
|
41
|
+
export interface OpenCodePreview extends OpenCodeSelection {
|
|
42
|
+
token: string;
|
|
43
|
+
path: string;
|
|
44
|
+
config: Record<string, unknown>;
|
|
45
|
+
agents: string[];
|
|
46
|
+
}
|
|
47
|
+
export interface OpenCodeModelState {
|
|
48
|
+
catalog: OpenCodeCatalog;
|
|
49
|
+
preview: OpenCodePreview | null;
|
|
50
|
+
saved: OpenCodeSelection | null;
|
|
51
|
+
}
|
|
52
|
+
export interface OpenCodeMetadata {
|
|
53
|
+
run(args: string[], signal: AbortSignal, env?: Record<string, string>, cwd?: string): Promise<string>;
|
|
54
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Fs, type Ps } from "webappwiz/system";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { OpenCodeSelection } from "./setup-opencode-models.js";
|
|
4
|
+
export declare class OpenCodeRecipes {
|
|
5
|
+
private readonly deps;
|
|
6
|
+
constructor(deps: {
|
|
7
|
+
fs: Fs;
|
|
8
|
+
ps: Ps;
|
|
9
|
+
home: string;
|
|
10
|
+
});
|
|
11
|
+
/** Read disk on every revisit; this never asserts readiness or runs a process. */
|
|
12
|
+
stored(): Promise<OpenCodeRecipe | null>;
|
|
13
|
+
unchanged(recipe: OpenCodeRecipe, signal: AbortSignal): Promise<void>;
|
|
14
|
+
/** Only removes the wizard-owned entry; native authentication is untouched. */
|
|
15
|
+
disable(signal: AbortSignal): Promise<void>;
|
|
16
|
+
rawRoster(): Promise<string | null>;
|
|
17
|
+
}
|
|
18
|
+
export declare function managedArgv(value: unknown): boolean;
|
|
19
|
+
export declare const projectOff = "OPENCODE_CONFIG_PROJECT_DISABLE=1";
|
|
20
|
+
export declare const contentPrefix = "OPENCODE_CONFIG_CONTENT=";
|
|
21
|
+
export interface OpenCodeRecipe extends OpenCodeSelection {
|
|
22
|
+
config: Record<string, unknown>;
|
|
23
|
+
env: Record<string, string>;
|
|
24
|
+
raw: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const id: z.ZodString;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Fs, Ps } from "webappwiz/system";
|
|
2
|
+
import { OpenCodeModels, type OpenCodeSelection } from "./setup-opencode-models.js";
|
|
3
|
+
/** Observations only: a stored credential is not proof of entitlement or inference. */
|
|
4
|
+
export interface OpenCodeStatus {
|
|
5
|
+
version: string | null;
|
|
6
|
+
auth: "unchecked" | "missing" | "stored" | "unsupported";
|
|
7
|
+
protocol: "unchecked" | "compatible" | "failed";
|
|
8
|
+
checking: boolean;
|
|
9
|
+
problem: string | null;
|
|
10
|
+
checkedAt: string | null;
|
|
11
|
+
}
|
|
12
|
+
/** Fixed native actions; no arguments, credentials or commands come from the page. */
|
|
13
|
+
export declare const OPENCODE_INSTALL: string[];
|
|
14
|
+
export declare const OPENCODE_LOGIN: string[];
|
|
15
|
+
/** Non-billed installation, native-auth metadata and initialize-only ACP checks. */
|
|
16
|
+
export declare class OpenCodeSetup {
|
|
17
|
+
private readonly deps;
|
|
18
|
+
private status;
|
|
19
|
+
private pending;
|
|
20
|
+
private controller;
|
|
21
|
+
readonly models: OpenCodeModels;
|
|
22
|
+
constructor(deps: {
|
|
23
|
+
fs: Fs;
|
|
24
|
+
ps: Ps;
|
|
25
|
+
home: string;
|
|
26
|
+
});
|
|
27
|
+
configure<T>(operation: (signal: AbortSignal) => Promise<T>, requireConnection?: boolean): Promise<T>;
|
|
28
|
+
readiness(cwd: string, verify?: boolean): Promise<OpenCodeReadiness>;
|
|
29
|
+
get cwd(): string;
|
|
30
|
+
read(): OpenCodeStatus;
|
|
31
|
+
prepare(): Promise<void>;
|
|
32
|
+
check(): Promise<OpenCodeStatus>;
|
|
33
|
+
/** Native actions can change credentials; require new observations afterwards. */
|
|
34
|
+
invalidate(): void;
|
|
35
|
+
cancel(): void;
|
|
36
|
+
private command;
|
|
37
|
+
private probe;
|
|
38
|
+
private handshake;
|
|
39
|
+
}
|
|
40
|
+
export interface OpenCodeReadiness {
|
|
41
|
+
cwd: string;
|
|
42
|
+
selection: OpenCodeSelection | null;
|
|
43
|
+
ready: boolean;
|
|
44
|
+
checkedAt: string | null;
|
|
45
|
+
problem: string | null;
|
|
46
|
+
}
|
package/setup.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { SecretStore } from "webappwiz/creds";
|
|
2
|
+
import type { Fs } from "webappwiz/system";
|
|
3
|
+
import type { OpenCodeSetup } from "./setup-opencode.js";
|
|
4
|
+
/**
|
|
5
|
+
* Setting splates up on this machine: the roster's steps, which the user has
|
|
6
|
+
* skipped, kept in `~/.splates/setup.json` so a skipped step stops asking, and
|
|
7
|
+
* where each stands.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Setup {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(machine: SetupMachine, areas: readonly SetupArea[]);
|
|
12
|
+
/** The step `id` names, refusing one not on the roster. */
|
|
13
|
+
step(id: string): SetupStep;
|
|
14
|
+
/** Every step checked, by area, and the one to do next. */
|
|
15
|
+
read(): Promise<SetupProgress>;
|
|
16
|
+
/** Stops `id` asking, until `unskip`. */
|
|
17
|
+
skip(id: string): Promise<void>;
|
|
18
|
+
/** Asks for `id` again. */
|
|
19
|
+
unskip(id: string): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Marks setup as seen on this machine, so the page stops nudging a fresh
|
|
22
|
+
* one towards it.
|
|
23
|
+
*/
|
|
24
|
+
see(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/** What a step's check reads: this machine's splates home and its device store. */
|
|
27
|
+
export interface SetupMachine {
|
|
28
|
+
/** Explicit checks from the optional native setup panel; never launch on page load. */
|
|
29
|
+
opencode?: OpenCodeSetup;
|
|
30
|
+
fs: Fs;
|
|
31
|
+
/** `~/.splates`, or a test's own. */
|
|
32
|
+
home: string;
|
|
33
|
+
/** The device's secret store, where creds kept for every project live. */
|
|
34
|
+
device: SecretStore;
|
|
35
|
+
/** How a check reaches the network, as for Access; the global one by default. */
|
|
36
|
+
fetch?: typeof globalThis.fetch;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* One thing to set up, small enough that the user does at most one thing for
|
|
40
|
+
* it. Whether it is done comes from its check against real state, never a
|
|
41
|
+
* stored flag, so a step undone by hand shows as left again.
|
|
42
|
+
*/
|
|
43
|
+
export interface SetupStep {
|
|
44
|
+
/** How `splates setup <step>` and the page name it, lowercase-with-dashes. */
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly title: string;
|
|
47
|
+
/** Why it matters, in a sentence. */
|
|
48
|
+
readonly why: string;
|
|
49
|
+
/** The one thing the user does, in markdown. */
|
|
50
|
+
readonly user: string;
|
|
51
|
+
/** What the agent walking the user through it does, in markdown. */
|
|
52
|
+
readonly agent: string;
|
|
53
|
+
/** An optional step can be left undone for good; a required one cannot. */
|
|
54
|
+
readonly optional: boolean;
|
|
55
|
+
/** The steps that must be done first, on the roster before this one. */
|
|
56
|
+
readonly after: readonly SetupStep[];
|
|
57
|
+
/** The cred the user pastes for it, when that is the one thing they do. */
|
|
58
|
+
readonly cred?: string;
|
|
59
|
+
/** Whether it is done, from real state. */
|
|
60
|
+
check(machine: SetupMachine): Promise<boolean>;
|
|
61
|
+
}
|
|
62
|
+
/** A part of setup, such as remote access, and its steps in order. */
|
|
63
|
+
export interface SetupArea {
|
|
64
|
+
readonly id: string;
|
|
65
|
+
readonly title: string;
|
|
66
|
+
readonly steps: readonly SetupStep[];
|
|
67
|
+
}
|
|
68
|
+
/** A step's state: done and skipped are settled, ready can go now, waiting cannot yet. */
|
|
69
|
+
export type StepStatus = "done" | "skipped" | "ready" | "waiting";
|
|
70
|
+
/** A step as `splates setup --json` and `GET /api/setup` give it. */
|
|
71
|
+
export interface StepProgress {
|
|
72
|
+
id: string;
|
|
73
|
+
title: string;
|
|
74
|
+
why: string;
|
|
75
|
+
user: string;
|
|
76
|
+
agent: string;
|
|
77
|
+
optional: boolean;
|
|
78
|
+
after: string[];
|
|
79
|
+
status: StepStatus;
|
|
80
|
+
/** What went wrong checking it, or null when the check ran. */
|
|
81
|
+
problem: string | null;
|
|
82
|
+
/** The cred the user pastes for it, or null. */
|
|
83
|
+
cred: string | null;
|
|
84
|
+
}
|
|
85
|
+
export interface AreaProgress {
|
|
86
|
+
id: string;
|
|
87
|
+
title: string;
|
|
88
|
+
done: number;
|
|
89
|
+
skipped: number;
|
|
90
|
+
/** Steps neither done nor skipped. */
|
|
91
|
+
left: number;
|
|
92
|
+
steps: StepProgress[];
|
|
93
|
+
}
|
|
94
|
+
export interface SetupProgress {
|
|
95
|
+
areas: AreaProgress[];
|
|
96
|
+
/** The one step to do next, or null when nothing is ready. */
|
|
97
|
+
next: string | null;
|
|
98
|
+
/** Whether no one has opened setup on this machine yet. */
|
|
99
|
+
fresh: boolean;
|
|
100
|
+
/** Whether any required step is neither done nor skipped. */
|
|
101
|
+
required: boolean;
|
|
102
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type * as acp from "@agentclientprotocol/sdk";
|
|
2
|
+
import type { AsyncResource } from "webappwiz/disposable";
|
|
3
|
+
import type { Logger } from "webappwiz/log";
|
|
4
|
+
import type { Fs, HeavyCap, Ps } from "webappwiz/system";
|
|
5
|
+
import { Duration, type Timer } from "webappwiz/time";
|
|
6
|
+
/** Pinned, so the browser it installs is the one it launches. */
|
|
7
|
+
export declare const PLAYWRIGHT_MCP = "@playwright/mcp@0.0.83";
|
|
8
|
+
/**
|
|
9
|
+
* The name sessions are offered it by, which an agent's own server of that
|
|
10
|
+
* name gives way to, so its tools keep the names they had.
|
|
11
|
+
*/
|
|
12
|
+
export declare const BROWSER_SERVER = "playwright";
|
|
13
|
+
/** How long the browser stays up with no tool call from any session. */
|
|
14
|
+
export declare const IDLE: Duration;
|
|
15
|
+
/**
|
|
16
|
+
* The MCP servers each agent session is offered, beyond its own.
|
|
17
|
+
*/
|
|
18
|
+
export interface SessionServers {
|
|
19
|
+
servers(): Promise<acp.McpServer[]>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One headless browser for every agent session on the machine: a Playwright
|
|
23
|
+
* MCP over HTTP, started on the first session that asks, giving each session
|
|
24
|
+
* a browser context of its own in one chrome-headless-shell, in place of a
|
|
25
|
+
* full Chrome and an MCP per session. One that cannot start, or dies, is
|
|
26
|
+
* logged and offered to no session, which then runs its agent's own.
|
|
27
|
+
*/
|
|
28
|
+
export declare class SharedBrowser implements SessionServers, AsyncResource {
|
|
29
|
+
private readonly deps;
|
|
30
|
+
/** Where its config is written. */
|
|
31
|
+
private readonly dir;
|
|
32
|
+
/** The MCP while it starts or runs; null before the first ask, or once it died. */
|
|
33
|
+
private running;
|
|
34
|
+
constructor(deps: {
|
|
35
|
+
ps: Ps;
|
|
36
|
+
fs: Fs;
|
|
37
|
+
timer: Timer;
|
|
38
|
+
log: Logger;
|
|
39
|
+
/** Held while the browser installs and its MCP starts. */
|
|
40
|
+
heavy: HeavyCap;
|
|
41
|
+
},
|
|
42
|
+
/** Where its config is written. */
|
|
43
|
+
dir: string);
|
|
44
|
+
servers(): Promise<acp.McpServer[]>;
|
|
45
|
+
disposeAsync(): Promise<void>;
|
|
46
|
+
private start;
|
|
47
|
+
private started;
|
|
48
|
+
/** Where `child` listens, once it says, or null once it dies or `START_WAIT` passes. */
|
|
49
|
+
private listening;
|
|
50
|
+
}
|
package/shell.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Ps, type SpawnCaptureResult, type SpawnOptions, type SpawnResult } from "webappwiz/system";
|
|
2
|
+
/** What a `Shell` spawns through; the real process by default. */
|
|
3
|
+
export interface ShellOptions {
|
|
4
|
+
ps?: Ps;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Runs the commands a repo configures (the lifecycle hooks) as shell strings
|
|
8
|
+
* rather than argv, since that is how a repo writes them.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Shell {
|
|
11
|
+
private readonly ps;
|
|
12
|
+
constructor(opts?: ShellOptions);
|
|
13
|
+
/** Captures output, for commands whose failure has to be reported back. */
|
|
14
|
+
run(command: string, cwd: string, opts?: SpawnOptions): Promise<SpawnCaptureResult>;
|
|
15
|
+
/** Inherits stdio, for commands the agent should watch as they run. */
|
|
16
|
+
stream(command: string, cwd: string, opts?: SpawnOptions): Promise<SpawnResult>;
|
|
17
|
+
}
|