@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.
Files changed (251) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +308 -2
  3. package/acp-extensions.d.ts +82 -0
  4. package/add.d.ts +53 -0
  5. package/adherence.d.ts +49 -0
  6. package/age.d.ts +2 -0
  7. package/agent-connection.d.ts +171 -0
  8. package/agent-errors.d.ts +2 -0
  9. package/agent-process.d.ts +65 -0
  10. package/agent-stream.d.ts +91 -0
  11. package/agents.d.ts +15 -0
  12. package/artifact-room.d.ts +47 -0
  13. package/artifact-viewers.d.ts +6 -0
  14. package/artifact.d.ts +30 -0
  15. package/artifacts.d.ts +161 -0
  16. package/asked.d.ts +146 -0
  17. package/asked.js +7 -0
  18. package/assumed.d.ts +34 -0
  19. package/attach.d.ts +30 -0
  20. package/attachments.d.ts +43 -0
  21. package/baselines.d.ts +55 -0
  22. package/claim.d.ts +17 -0
  23. package/cloudflare-api.d.ts +25 -0
  24. package/cloudflare-error.d.ts +5 -0
  25. package/cloudflared-tunnel-provider.d.ts +27 -0
  26. package/codex-limits.d.ts +19 -0
  27. package/compaction.d.ts +17 -0
  28. package/config-source.d.ts +13 -0
  29. package/config.d.ts +98 -0
  30. package/config.js +7 -0
  31. package/conversation-archive.d.ts +6 -0
  32. package/conversation-background.d.ts +21 -0
  33. package/conversation-choice.d.ts +4 -0
  34. package/conversation-files.d.ts +51 -0
  35. package/conversation-given.d.ts +8 -0
  36. package/conversation-host.d.ts +102 -0
  37. package/conversation-listing.d.ts +15 -0
  38. package/conversation-log.d.ts +301 -0
  39. package/conversation-messages.d.ts +18 -0
  40. package/conversation-name.d.ts +28 -0
  41. package/conversation-options.d.ts +73 -0
  42. package/conversation-reference.d.ts +2 -0
  43. package/conversation-state.d.ts +472 -0
  44. package/conversation-turns.d.ts +115 -0
  45. package/conversation.d.ts +209 -0
  46. package/conversations.d.ts +140 -0
  47. package/coordinator-state.d.ts +28 -0
  48. package/creds.d.ts +123 -0
  49. package/darwin-temperature.d.ts +7 -0
  50. package/decided.d.ts +18 -0
  51. package/demo.d.ts +29 -0
  52. package/dev/api.d.ts +209 -0
  53. package/dev/assets.d.ts +24 -0
  54. package/dev/conversation-address.d.ts +47 -0
  55. package/dev/conversation-feed.d.ts +166 -0
  56. package/dev/live-stream.d.ts +29 -0
  57. package/dev/worker.d.ts +33 -0
  58. package/dev-access.d.ts +61 -0
  59. package/dev-artifacts.d.ts +22 -0
  60. package/dev-budgets.d.ts +18 -0
  61. package/dev-conversation-events.d.ts +39 -0
  62. package/dev-conversation-routes.d.ts +90 -0
  63. package/dev-creds.d.ts +17 -0
  64. package/dev-dictation-connection.d.ts +18 -0
  65. package/dev-dictation.d.ts +17 -0
  66. package/dev-http.d.ts +76 -0
  67. package/dev-open.d.ts +15 -0
  68. package/dev-options.d.ts +133 -0
  69. package/dev-outcomes.d.ts +21 -0
  70. package/dev-pages.d.ts +16 -0
  71. package/dev-picker.d.ts +57 -0
  72. package/dev-port-socket.d.ts +26 -0
  73. package/dev-ports.d.ts +11 -0
  74. package/dev-project-watch.d.ts +44 -0
  75. package/dev-project.d.ts +168 -0
  76. package/dev-push.d.ts +59 -0
  77. package/dev-restart.d.ts +141 -0
  78. package/dev-servers.d.ts +30 -0
  79. package/dev-setup-native.d.ts +23 -0
  80. package/dev-setup-opencode.d.ts +29 -0
  81. package/dev-setup.d.ts +16 -0
  82. package/dev-shell.d.ts +70 -0
  83. package/dev-slot.d.ts +28 -0
  84. package/dev-sockets.d.ts +13 -0
  85. package/dev-task-ports.d.ts +73 -0
  86. package/dev-tasks.d.ts +20 -0
  87. package/dev-terminal-connection.d.ts +19 -0
  88. package/dev-terminal.d.ts +42 -0
  89. package/dev-todos.d.ts +35 -0
  90. package/dev-transcriber.d.ts +15 -0
  91. package/dev-tunnel.d.ts +38 -0
  92. package/dev-versions.d.ts +53 -0
  93. package/dev-workers.d.ts +55 -0
  94. package/dev.d.ts +24 -0
  95. package/diff.d.ts +29 -0
  96. package/dispatched.d.ts +16 -0
  97. package/editors.d.ts +22 -0
  98. package/escalate.d.ts +27 -0
  99. package/events.d.ts +311 -0
  100. package/everywhere.d.ts +41 -0
  101. package/exhibit.d.ts +21 -0
  102. package/exit.d.ts +54 -0
  103. package/fact-todos.d.ts +18 -0
  104. package/fake-agent.d.ts +107 -0
  105. package/fake-agent.js +284 -0
  106. package/finding-facts.d.ts +38 -0
  107. package/findings.d.ts +84 -0
  108. package/fold.d.ts +43 -0
  109. package/follow.d.ts +41 -0
  110. package/format.d.ts +68 -0
  111. package/git.d.ts +112 -0
  112. package/handed-out.d.ts +79 -0
  113. package/handoff.d.ts +23 -0
  114. package/heavy-run.d.ts +12 -0
  115. package/heavy.d.ts +28 -0
  116. package/heavy.js +16 -0
  117. package/held.d.ts +22 -0
  118. package/index-0tfvy823.js +272 -0
  119. package/index-43pq33n4.js +157 -0
  120. package/index-4776671w.js +698 -0
  121. package/index-d4hjrzaq.js +464 -0
  122. package/index-gcfq7awr.js +740 -0
  123. package/index-k73tsw5g.js +101 -0
  124. package/index-kaa44k7q.js +59 -0
  125. package/index-vcv9m93e.js +1265 -0
  126. package/index-xmfmy729.js +249 -0
  127. package/index.d.ts +2 -0
  128. package/index.js +26928 -0
  129. package/init.d.ts +28 -0
  130. package/journal.d.ts +57 -0
  131. package/landed.d.ts +14 -0
  132. package/lane-todos.d.ts +44 -0
  133. package/lane.d.ts +55 -0
  134. package/lanes-from-tags.d.ts +17 -0
  135. package/lanes.d.ts +96 -0
  136. package/legacy-names.d.ts +70 -0
  137. package/legacy-ps.d.ts +31 -0
  138. package/limits.d.ts +32 -0
  139. package/list.d.ts +18 -0
  140. package/load-config.d.ts +44 -0
  141. package/log.d.ts +14 -0
  142. package/machine.d.ts +42 -0
  143. package/merge.d.ts +35 -0
  144. package/migrate-config.d.ts +31 -0
  145. package/models.d.ts +24 -0
  146. package/needs.d.ts +115 -0
  147. package/notices.d.ts +39 -0
  148. package/offered.d.ts +39 -0
  149. package/opencode-usage.d.ts +37 -0
  150. package/outcomes.d.ts +114 -0
  151. package/package.json +74 -5
  152. package/path.d.ts +13 -0
  153. package/plan.d.ts +236 -0
  154. package/port-forward.d.ts +22 -0
  155. package/port-pipe.d.ts +36 -0
  156. package/ports-list.d.ts +19 -0
  157. package/probe-runtime.d.ts +5 -0
  158. package/probe-runtime.js +13 -0
  159. package/project-reaches.d.ts +23 -0
  160. package/projects.d.ts +136 -0
  161. package/prompts.d.ts +128 -0
  162. package/pty.d.ts +39 -0
  163. package/pulse.d.ts +8 -0
  164. package/recommend.d.ts +31 -0
  165. package/release.d.ts +41 -0
  166. package/remote-process.d.ts +26 -0
  167. package/remote-pty.d.ts +29 -0
  168. package/remote-worker.d.ts +77 -0
  169. package/remove.d.ts +31 -0
  170. package/repository.d.ts +91 -0
  171. package/retry.d.ts +34 -0
  172. package/roster.d.ts +63 -0
  173. package/saved-ports-host.d.ts +25 -0
  174. package/saved-tunnel.d.ts +44 -0
  175. package/server-worker-socket.d.ts +21 -0
  176. package/setup-areas.d.ts +7 -0
  177. package/setup-opencode-model-error.d.ts +3 -0
  178. package/setup-opencode-models.d.ts +54 -0
  179. package/setup-opencode-recipe.d.ts +26 -0
  180. package/setup-opencode.d.ts +46 -0
  181. package/setup.d.ts +102 -0
  182. package/shared-browser.d.ts +50 -0
  183. package/shell.d.ts +17 -0
  184. package/show.d.ts +106 -0
  185. package/skill-checks.d.ts +73 -0
  186. package/skill-checks.js +10 -0
  187. package/skills.d.ts +16 -0
  188. package/slot-tunnel.d.ts +27 -0
  189. package/slots.d.ts +135 -0
  190. package/snapshot.d.ts +75 -0
  191. package/splates-artifact.d.ts +3 -0
  192. package/splates-creds.d.ts +3 -0
  193. package/splates-dev.d.ts +22 -0
  194. package/splates-flags.d.ts +34 -0
  195. package/splates-lane.d.ts +3 -0
  196. package/splates-projects.d.ts +3 -0
  197. package/splates-setup.d.ts +17 -0
  198. package/splates-slots.d.ts +3 -0
  199. package/splates-todo.d.ts +3 -0
  200. package/splates-tunnel.d.ts +3 -0
  201. package/splates-worker.d.ts +3 -0
  202. package/splates.d.ts +28 -0
  203. package/stats.d.ts +186 -0
  204. package/supervise.d.ts +50 -0
  205. package/system-changes.d.ts +67 -0
  206. package/system.d.ts +28 -0
  207. package/systems.d.ts +119 -0
  208. package/systems.js +21 -0
  209. package/table.d.ts +5 -0
  210. package/task-log.d.ts +35 -0
  211. package/task-ports.d.ts +25 -0
  212. package/tell.d.ts +47 -0
  213. package/todo-edit.d.ts +60 -0
  214. package/todo-file.d.ts +6 -0
  215. package/todo-lanes.d.ts +82 -0
  216. package/todo-list.d.ts +26 -0
  217. package/todo-take.d.ts +27 -0
  218. package/todo.d.ts +146 -0
  219. package/todos.d.ts +157 -0
  220. package/tool-calls.d.ts +18 -0
  221. package/tunnel-provider.d.ts +37 -0
  222. package/tunnel-provider.js +0 -0
  223. package/tunnel-remove.d.ts +28 -0
  224. package/tunnel-setup.d.ts +104 -0
  225. package/unix-worker-listener.d.ts +23 -0
  226. package/unix-worker-socket.d.ts +30 -0
  227. package/update.d.ts +29 -0
  228. package/update.js +10 -0
  229. package/vocabulary.d.ts +9 -0
  230. package/wait.d.ts +36 -0
  231. package/watch.d.ts +46 -0
  232. package/watched.d.ts +43 -0
  233. package/websocket-worker-socket.d.ts +18 -0
  234. package/worker-call-host.d.ts +51 -0
  235. package/worker-channel.d.ts +83 -0
  236. package/worker-connection.d.ts +24 -0
  237. package/worker-daemon.d.ts +64 -0
  238. package/worker-git.d.ts +18 -0
  239. package/worker-list.d.ts +49 -0
  240. package/worker-machine.d.ts +34 -0
  241. package/worker-port-host.d.ts +21 -0
  242. package/worker-process-host.d.ts +29 -0
  243. package/worker-protocol.d.ts +104 -0
  244. package/worker-pty-host.d.ts +34 -0
  245. package/worker-registry.d.ts +68 -0
  246. package/worker-replay.d.ts +25 -0
  247. package/worker-run.d.ts +20 -0
  248. package/worker-session.d.ts +189 -0
  249. package/worker-socket.d.ts +15 -0
  250. package/worktree-service.d.ts +113 -0
  251. package/worktree.d.ts +232 -0
package/show.d.ts ADDED
@@ -0,0 +1,106 @@
1
+ import { type Logger } from "webappwiz/log";
2
+ import { type Fs } from "webappwiz/system";
3
+ import { type NamedSystem } from "./systems.js";
4
+ import type { Worktree } from "./worktree.js";
5
+ import type { WorktreeService } from "./worktree-service.js";
6
+ /**
7
+ * One task in full: what `list` shows for it, plus the `SPLATES.md` its agent
8
+ * left at the worktree root. Reading a tree this way takes no lease, so it
9
+ * cannot knock the agent driving it off its own work.
10
+ */
11
+ export declare function show({ service, fs, log }: {
12
+ service: WorktreeService;
13
+ fs: Fs;
14
+ log: Logger;
15
+ }, task: string, opts?: ShowOptions): Promise<void>;
16
+ export interface Details {
17
+ task: string;
18
+ status: string;
19
+ branch: string;
20
+ base: string;
21
+ /** The `splates server` conversation whose agent added it, or null. */
22
+ caller: string | null;
23
+ /**
24
+ * The `splates server` conversation whose agent last took it, or its caller's
25
+ * for a subagent; null for an agent outside the page.
26
+ */
27
+ takenBy: string | null;
28
+ worktree: string;
29
+ lease: "held" | "stale" | "none";
30
+ ahead: number | null;
31
+ added: number | null;
32
+ removed: number | null;
33
+ age: string | null;
34
+ /** When it was added, which `age` counts from. */
35
+ createdAt: string | null;
36
+ /**
37
+ * The last sign of an agent at work on it: a splates command writing its
38
+ * record, a commit on its branch, or an edit to its SPLATES.md or to a file
39
+ * not yet committed. Null when nothing says.
40
+ */
41
+ activeAt: string | null;
42
+ escalation: string | null;
43
+ /** The merges it has tried; at `mergeAttemptLimit`, only `splates retry` lets it try again. */
44
+ mergeAttempts: number;
45
+ mergeAttemptLimit: number;
46
+ /** While escalated, when it was; null otherwise. */
47
+ escalatedAt: string | null;
48
+ /**
49
+ * While escalated to be approved, what to look at before approving; null
50
+ * otherwise.
51
+ */
52
+ review: string | null;
53
+ /**
54
+ * Whether the plan leaves nothing unchecked under `## Blocked` or
55
+ * `## Next`, which `splates merge` and `splates escalate --review` require.
56
+ */
57
+ ready: boolean;
58
+ plan: string | null;
59
+ /** How the `SPLATES.md` departs from the shape the skill prescribes. */
60
+ planProblems: string[];
61
+ /**
62
+ * Whether `splates add --agent` handed it to an agent that `splates server` has
63
+ * yet to start a conversation with.
64
+ */
65
+ dispatched: boolean;
66
+ /**
67
+ * The conversation `splates server` started for the agent another conversation
68
+ * handed it to, which answers to that one, its caller, rather than to the
69
+ * user; null for any other task.
70
+ */
71
+ handedTo: string | null;
72
+ /**
73
+ * The systems its changed files fall in, committed or not, in the order
74
+ * its worktree's `splates.systems.ts` names them.
75
+ */
76
+ systems: NamedSystem[];
77
+ }
78
+ export interface ShowOptions {
79
+ /** Print the details as JSON instead of prose. */
80
+ json?: boolean;
81
+ }
82
+ /** Configures how {@link TaskDetails} gathers a task's info. */
83
+ export interface TaskDetailsOptions {
84
+ /** What the worktree is read through; the real filesystem by default. */
85
+ fs?: Fs;
86
+ }
87
+ /**
88
+ * Everything there is to say about one task. Split out so `dev` can render the
89
+ * same fields this prints, rather than assembling its own and drifting.
90
+ */
91
+ export declare class TaskDetails {
92
+ private readonly fs;
93
+ constructor(opts?: TaskDetailsOptions);
94
+ get(worktree: Worktree): Promise<Details>;
95
+ /**
96
+ * The latest of its record's last write, its own latest commit, and the
97
+ * edits to its SPLATES.md and uncommitted files, as `Details.activeAt`.
98
+ */
99
+ private activeAt;
100
+ /**
101
+ * Read from its own worktree, so a system named during the task counts at
102
+ * once. Its changed files cost three git calls, spent only once there is a
103
+ * system to match them against.
104
+ */
105
+ private systems;
106
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The rules of the splates skill a program can decide, checked over one
3
+ * conversation: what it said and ran, condensed, and what it left behind.
4
+ * `splates server` runs them on its conversations, for the Stats page's pass rate
5
+ * per skill version; the hand-run evals run them on theirs. Rules that take
6
+ * judgment, such as whether a call should have been a question, are left to
7
+ * a model grading the evals.
8
+ */
9
+ /** Each check's verdicts on one conversation, by its id. */
10
+ export declare function judge(transcript: Transcript, end: EndState): Record<string, Verdict[]>;
11
+ /** A conversation as the checks read it: its own words and acts, in order. */
12
+ export interface Transcript {
13
+ beats: Beat[];
14
+ /**
15
+ * Whether another conversation handed it its task, a lane's orchestrator
16
+ * or an agent relaying for it, so it reports to that conversation, which
17
+ * proposes the next todo in its place.
18
+ */
19
+ handed: boolean;
20
+ }
21
+ /**
22
+ * One thing said or done. A `user` beat starts a turn. What the agent's
23
+ * subagents did is left out: the rules are the agent's own.
24
+ */
25
+ export type Beat = {
26
+ kind: "user";
27
+ text: string;
28
+ }
29
+ /** Words the agent said, one stretch of text between its tool calls. */
30
+ | {
31
+ kind: "say";
32
+ text: string;
33
+ }
34
+ /** A shell command, with the end of what it printed and whether it succeeded. */
35
+ | {
36
+ kind: "run";
37
+ command: string;
38
+ output: string;
39
+ ok: boolean;
40
+ }
41
+ /** Files a tool call wrote or edited. */
42
+ | {
43
+ kind: "edit";
44
+ paths: string[];
45
+ };
46
+ /** What the conversation left behind, which its transcript does not say. */
47
+ export interface EndState {
48
+ /** Each task it merged, with the message of each commit that landed. */
49
+ landed: {
50
+ task: string;
51
+ commits: string[];
52
+ }[];
53
+ }
54
+ /** How one place a rule applied went. */
55
+ export interface Verdict {
56
+ ok: boolean;
57
+ /** What was checked, and what was found when it failed. */
58
+ why: string;
59
+ }
60
+ /** A rule a program can decide; `judge` returns no verdicts where it does not apply. */
61
+ export interface Check {
62
+ id: string;
63
+ /** The rule, as the Stats page names it. */
64
+ rule: string;
65
+ judge(transcript: Transcript, end: EndState): Verdict[];
66
+ }
67
+ /** Every check, in the order the Stats page lists them. */
68
+ export declare const CHECKS: readonly Check[];
69
+ /** Each `splates` command `command` runs, by its verb and its words after. */
70
+ export declare function splatesCalls(command: string): {
71
+ verb: string;
72
+ args: string[];
73
+ }[];
@@ -0,0 +1,10 @@
1
+ import {
2
+ judge2,
3
+ CHECKS2,
4
+ splatesCalls2
5
+ } from "./index-0tfvy823.js";
6
+ export {
7
+ CHECKS2 as CHECKS,
8
+ judge2 as judge,
9
+ splatesCalls2 as splatesCalls
10
+ };
package/skills.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import type { Logger } from "webappwiz/log";
2
+ import { ProjectSkills } from "webappwiz/skills";
3
+ import type { Fs, Ps } from "webappwiz/system";
4
+ /**
5
+ * The repository splates's skill comes from: each release is a tag in it, and
6
+ * the skill its `skills/splates/SKILL.md`, which `bunx skills add` finds.
7
+ */
8
+ export declare const SOURCE = "stringsync/splates";
9
+ /** The skills a project at `root` has, installing splates's from `SOURCE`. */
10
+ export declare function projectSkills(root: string, deps: {
11
+ fs: Fs;
12
+ ps: Ps;
13
+ log: Logger;
14
+ }): ProjectSkills;
15
+ /** The installed splates skill's version, or null when absent or unreadable. */
16
+ export declare function installedVersion(fs: Fs, root: string): Promise<string | null>;
@@ -0,0 +1,27 @@
1
+ import type { Logger } from "webappwiz/log";
2
+ import type { Creds } from "./creds.js";
3
+ import type { SavedTunnel, TunnelRecord } from "./saved-tunnel.js";
4
+ import type { Slot } from "./slots.js";
5
+ /** What the Access application in front of every slot is called. */
6
+ export declare const SLOTS_APP = "splates-slots";
7
+ /** The cred a slot's tunnel token is kept as, on the device. */
8
+ export declare function slotToken({ word }: Slot): string;
9
+ /**
10
+ * Makes what carries `<word>.<zone>` to a slot's `splates server`, beside the
11
+ * tunnel `splates tunnel setup` made, through the API with the same token: the
12
+ * slot's tunnel, `splates-<word>`, the DNS record routing its host to it, and,
13
+ * once for every slot, an Access application in front of `*.<zone>` letting
14
+ * in whom the machine's own lets in. Saves them in the slot's home, so its
15
+ * `splates server` runs them as a bare one runs the machine's. What already exists
16
+ * by name is reused, so running it again is safe.
17
+ */
18
+ export declare function slotTunnelSetup({ slot, machine, creds, saved, log, fetch, }: {
19
+ slot: Slot;
20
+ /** What `splates tunnel setup` saved, whose zone, team and policy slots share. */
21
+ machine: TunnelRecord;
22
+ creds: Creds;
23
+ /** The slot home's tunnel, saved here. */
24
+ saved: SavedTunnel;
25
+ log: Logger;
26
+ fetch?: typeof globalThis.fetch;
27
+ }): Promise<TunnelRecord>;
package/slots.d.ts ADDED
@@ -0,0 +1,135 @@
1
+ import type { Logger } from "webappwiz/log";
2
+ import { type Fs, type Lock, type Ps } from "webappwiz/system";
3
+ /** The file in a slot's home that its server writes its pid to. */
4
+ export declare const SERVER_PID = "server.pid";
5
+ /** Set in a slot's server's environment to the word it serves under. */
6
+ export declare const SLOT = "SPLATES_SLOT";
7
+ /**
8
+ * Set in a slot's server's environment to the machine's `SPLATES_HOME`, whose
9
+ * tunnel and slots the page lists to switch between.
10
+ */
11
+ export declare const MACHINE_HOME = "SPLATES_MACHINE_HOME";
12
+ /**
13
+ * Which tree holds which slot, kept in `~/.splates/slots.json` for every
14
+ * checkout on this machine. A tree holds the same word every time, so its host
15
+ * name is worth writing down, for as long as it owns it: a task's worktree
16
+ * owns its word until the task merges or is removed, which stops its server
17
+ * and gives the word back. The main tree of a splates repository owns none,
18
+ * since every agent of it stands there, so one agent's slot would be every
19
+ * other's to stop. A server left running from a tree that owns its word no
20
+ * more still holds its port and its host, so its word goes to no other tree
21
+ * until `prune` stops it.
22
+ */
23
+ export declare class Slots {
24
+ /** `~/.splates/slots.json`, or a test's own. */
25
+ readonly path: string;
26
+ private readonly deps;
27
+ constructor(
28
+ /** `~/.splates/slots.json`, or a test's own. */
29
+ path: string, deps: {
30
+ fs: Fs;
31
+ /** Tells whether a slot's last server still runs. */
32
+ ps: Pick<Ps, "pid" | "alive" | "processes" | "spawnCapture">;
33
+ /** Held while claiming, so two trees starting together get a word each. */
34
+ lock: Lock;
35
+ pool?: readonly {
36
+ word: string;
37
+ emoji: string;
38
+ }[];
39
+ });
40
+ /** The machine's slots, read from inside a slot's server too. */
41
+ static ofMachine({ fs, ps, log }: {
42
+ fs: Fs;
43
+ ps: Ps;
44
+ log: Logger;
45
+ }): Slots;
46
+ /**
47
+ * Whether `tree` can own a word: it exists, and is no splates repository's
48
+ * main tree, whose `.git` is a directory holding splates's records rather
49
+ * than a linked worktree's file.
50
+ */
51
+ owns(tree: string): Promise<boolean>;
52
+ /**
53
+ * The slot `tree` holds, claimed now when it holds none: the first word no
54
+ * tree that owns it holds, and no server still runs on. Throws, naming each
55
+ * holder, when every word is held.
56
+ */
57
+ claim(tree: string): Promise<Slot>;
58
+ /** The slot's home, its `SPLATES_HOME`: `~/.splates/slots/<word>`. */
59
+ home(slot: Slot): string;
60
+ /**
61
+ * The pid of the slot's last server while it still runs, as one does when
62
+ * its wrapper was killed or its worktree merged; null once it has stopped,
63
+ * or for this process itself.
64
+ */
65
+ server(slot: Slot): Promise<number | null>;
66
+ /** Each slot a tree that owns it holds, in the pool's order. */
67
+ list(): Promise<{
68
+ slot: Slot;
69
+ tree: string;
70
+ }[]>;
71
+ /** Every claimed word, owned or orphaned, with its server, in the pool's order. */
72
+ status(): Promise<Held[]>;
73
+ /**
74
+ * Stops the slot's server, if one runs, which ends its cloudflared too:
75
+ * a SIGTERM, then a SIGKILL if it outlives `STOP_WAIT`. Answers with the
76
+ * pid it stopped, or null when none ran.
77
+ */
78
+ stop(slot: Slot): Promise<number | null>;
79
+ /**
80
+ * Gives back the word `tree` holds, stopping its server, as a task's
81
+ * worktree does when it merges or is removed. Answers with what it gave
82
+ * back, or null when the tree held none.
83
+ */
84
+ release(tree: string): Promise<{
85
+ slot: Slot;
86
+ stopped: number | null;
87
+ } | null>;
88
+ /**
89
+ * Frees every orphaned word, as `status` tells them, stopping its server:
90
+ * the only slots any agent may stop, since each of the rest is a task's.
91
+ * Answers with what it freed.
92
+ */
93
+ prune(): Promise<Held[]>;
94
+ private read;
95
+ private write;
96
+ }
97
+ /**
98
+ * The words `splates server --slot` hands out, tried in this order, as
99
+ * sound2score's dev slots are: short animals, spellable into a phone, each
100
+ * with an emoji that is that animal and nothing else.
101
+ * Each one's tunnel is made on its first ever claim and kept, so this is also
102
+ * every host name a slot will ever answer on. When every one is held, add the
103
+ * next: goat 🐐, seal 🦭.
104
+ */
105
+ export declare const SLOT_POOL: readonly {
106
+ word: string;
107
+ emoji: string;
108
+ }[];
109
+ /** A word of the pool, which names a slot's tunnel, host and home. */
110
+ export interface Slot {
111
+ /** Like "fox". */
112
+ word: string;
113
+ /** Like "🦊": shown beside the project's name while this slot serves it. */
114
+ emoji: string;
115
+ }
116
+ /** What `release` gave back, as `merge` and `remove` report it. */
117
+ export declare function freedLine({ slot, stopped, }: {
118
+ slot: Slot;
119
+ stopped: number | null;
120
+ }): string;
121
+ /** The emoji of `word`, or null for a word not in the pool. */
122
+ export declare function slotOf(word: string): Slot | null;
123
+ /** A claimed word, the tree that holds it, and its server while one runs. */
124
+ export interface Held {
125
+ slot: Slot;
126
+ tree: string;
127
+ /** The pid of its server while one runs, as `server` tells. */
128
+ pid: number | null;
129
+ /**
130
+ * Whether no tree can be said to own it any more: its tree is gone, or is
131
+ * the main tree of a splates repository, which every agent of it shares.
132
+ * Only an orphan's server is any agent's to stop, by `prune`.
133
+ */
134
+ orphaned: boolean;
135
+ }
package/snapshot.d.ts ADDED
@@ -0,0 +1,75 @@
1
+ import type { Fs } from "webappwiz/system";
2
+ import type { CredRequest, Creds } from "./creds.js";
3
+ import type { LaneRecord } from "./lanes.js";
4
+ import type { Behind, Release } from "./release.js";
5
+ import { type Details } from "./show.js";
6
+ import type { Slot } from "./slots.js";
7
+ import type { TodoState } from "./todo.js";
8
+ import type { Todos } from "./todos.js";
9
+ import type { WorktreeService } from "./worktree-service.js";
10
+ /**
11
+ * Everything one page shows: `todo list`, and `list` and `show` for each
12
+ * task.
13
+ */
14
+ export interface Snapshot {
15
+ /** The repository's directory name, so a page among many says whose it is. */
16
+ repo: string;
17
+ /** Where the repository sits, with the home directory as `~`. */
18
+ path: string;
19
+ /** The main tree, absolute, which agents' file paths start from. */
20
+ root: string;
21
+ /** The directory that holds each task's worktree, absolute. */
22
+ worktreeRoot: string;
23
+ /** Past this age a todo is offered for removal rather than recommended. */
24
+ todoStalenessMs: number;
25
+ todos: TodoState[];
26
+ /** Every lane, in board order, empty ones too. */
27
+ lanes: LaneRecord[];
28
+ /**
29
+ * The name of every lane there has been, those on the board first, to
30
+ * name a lane's orchestrator after it once the lane is done.
31
+ */
32
+ laneNames: LaneRecord[];
33
+ tasks: Details[];
34
+ /** Every cred agents requested, open or not, the latest first; never a value. */
35
+ creds: CredRequest[];
36
+ /** The branch tasks land on, which the main tree has checked out. */
37
+ trunk: string;
38
+ /** A newer splates than the one serving, once `splates server` has seen one on npm. */
39
+ release: Release | null;
40
+ /** Commits to splates's own source since `splates server` started from it. */
41
+ behind: Behind | null;
42
+ /**
43
+ * Whether building the page failed as `splates server` started, so the page
44
+ * serving is the one built before, and may be out of date.
45
+ */
46
+ unbuilt: boolean;
47
+ /** The slot `splates server --slot` serves under, shown beside the project's name. */
48
+ slot: Slot | null;
49
+ }
50
+ /**
51
+ * Reads the whole repo the way the CLI's read commands do. Takes no lease, so
52
+ * the page can sit open on a live tree without disturbing the agent in it.
53
+ */
54
+ export declare function snapshot({ service, todos, creds, fs, home, release, behind, unbuilt, slot, }: {
55
+ service: WorktreeService;
56
+ todos: Todos;
57
+ creds: Creds;
58
+ fs: Fs;
59
+ /** The home directory to show as `~`, when there is one. */
60
+ home?: string;
61
+ release?: Release | null;
62
+ behind?: Behind | null;
63
+ unbuilt?: boolean;
64
+ slot?: Slot | null;
65
+ }): Promise<Snapshot>;
66
+ /** `list` and `show` for each task, as {@link snapshot} reads them. */
67
+ export declare function tasksOf({ service, fs, }: {
68
+ service: WorktreeService;
69
+ fs: Fs;
70
+ }): Promise<Details[]>;
71
+ /**
72
+ * A key that changes only when what the page shows does, to push a snapshot
73
+ * to open pages only when it differs from the last one pushed.
74
+ */
75
+ export declare function fingerprint({ todos, lanes, laneNames, tasks, creds, release, behind, }: Snapshot): string;
@@ -0,0 +1,3 @@
1
+ import type { SplatesDeps } from "./splates.js";
2
+ /** `splates artifact`, which the root cli mounts after `splates attach`. */
3
+ export declare const splatesArtifact: import("webappwiz/cmd").Cli<SplatesDeps, SplatesDeps>;
@@ -0,0 +1,3 @@
1
+ import type { SplatesDeps } from "./splates.js";
2
+ /** `splates creds`, which the root cli mounts after `splates lane`. */
3
+ export declare const splatesCreds: import("webappwiz/cmd").Cli<SplatesDeps, SplatesDeps>;
@@ -0,0 +1,22 @@
1
+ import { type DevServer } from "./dev.js";
2
+ import type { SplatesDeps } from "./splates.js";
3
+ /**
4
+ * What `splates server` does with its flags: run itself as a supervised child, so
5
+ * the page can restart it, which then serves the page, reached through the
6
+ * tunnel and Access the flags name, or else the ones saved for this machine.
7
+ * It serves every registered project wherever it is started; the page picks
8
+ * which one it shows. The server, from the child; nothing from the
9
+ * supervisor, which exits.
10
+ */
11
+ export declare function serveDev(ctx: SplatesDeps, opts: DevFlags): Promise<DevServer | undefined>;
12
+ /** The flags `splates server` takes, as `serveDev` reads them. */
13
+ export interface DevFlags {
14
+ port: number;
15
+ "allow-hosts": string;
16
+ "access-team": string;
17
+ "access-aud": string;
18
+ tunnel: string;
19
+ "tunnel-name": string;
20
+ "ports-host": string;
21
+ slot: boolean;
22
+ }
@@ -0,0 +1,34 @@
1
+ import { z } from "zod";
2
+ import type { Repository } from "./repository.js";
3
+ import { type AgentPick, Roster, type RosterAgent } from "./roster.js";
4
+ import { SavedPortsHost } from "./saved-ports-host.js";
5
+ import { SavedTunnel } from "./saved-tunnel.js";
6
+ import type { SplatesDeps } from "./splates.js";
7
+ /** A place in the todo list, 1 at the top; absent leaves it to the command. */
8
+ export declare const position: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
9
+ /**
10
+ * The agent `--agent` and `--model` name off the roster: undefined when
11
+ * neither is given, null for `--agent none`.
12
+ */
13
+ export declare function assigneeIn(deps: SplatesDeps, agent: string, model: string): Promise<AgentPick | null | undefined>;
14
+ /** The user's roster, beside the project registry. */
15
+ export declare function rosterOf({ ps, fs }: SplatesDeps): Roster;
16
+ /** The tunnel `splates tunnel setup` saved for this machine. */
17
+ /** The base host `splates server --ports-host` saved for this machine. */
18
+ export declare function savedPortsHostOf({ ps, fs }: SplatesDeps): SavedPortsHost;
19
+ export declare function savedTunnelOf({ ps, fs, secrets, }: SplatesDeps): SavedTunnel;
20
+ /** The tunnel each slot's home may have saved, for every word of the pool. */
21
+ export declare function slotTunnelsOf({ ps, fs, secrets, }: SplatesDeps): SavedTunnel[];
22
+ /** The roster's agents, written out as the defaults first when there is none. */
23
+ export declare function seeded(roster: Roster): Promise<RosterAgent[]>;
24
+ /** `--lane 3`, `new` or `none` as a lane; absent leaves it to the command. */
25
+ export declare function laneIn(raw: string): number | "new" | null | undefined;
26
+ /** `--todo 3,5` as ids, refusing anything that is not one. */
27
+ export declare function todoIds(raw: string): number[];
28
+ /** A comma-separated flag's values, with no empty ones. */
29
+ export declare function commaList(raw: string): string[];
30
+ /**
31
+ * Which task a command that takes no task name is about, so the journal can
32
+ * name it. `merge` and `escalate` read it off the current branch.
33
+ */
34
+ export declare function here({ service, git, ps, project, }: SplatesDeps & Repository): Promise<string | null>;
@@ -0,0 +1,3 @@
1
+ import type { SplatesDeps } from "./splates.js";
2
+ /** `splates lane`, which the root cli mounts after `splates todo`. */
3
+ export declare const splatesLane: import("webappwiz/cmd").Cli<SplatesDeps, SplatesDeps>;
@@ -0,0 +1,3 @@
1
+ import type { SplatesDeps } from "./splates.js";
2
+ /** `splates projects`, which the root cli mounts after `splates lane`. */
3
+ export declare const splatesProjects: import("webappwiz/cmd").Cli<SplatesDeps, SplatesDeps>;
@@ -0,0 +1,17 @@
1
+ import { Setup } from "./setup.js";
2
+ import type { SplatesDeps } from "./splates.js";
3
+ /** This machine's setup, read through `deps`. */
4
+ export declare function setupOf({ fs, ps, secrets, fetch, }: SplatesDeps): Setup;
5
+ /** What `splates setup` was asked for. */
6
+ export interface SetupOptions {
7
+ /** A step's id, or empty for every area's progress. */
8
+ step: string;
9
+ json: boolean;
10
+ skip: boolean;
11
+ unskip: boolean;
12
+ }
13
+ /**
14
+ * `splates setup [step]`: progress by area and the one next step, or one step's
15
+ * why and instructions, after skipping or unskipping it when asked.
16
+ */
17
+ export declare function setup(deps: SplatesDeps, opts: SetupOptions): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { SplatesDeps } from "./splates.js";
2
+ /** `splates slots`, which the root cli mounts after `splates tunnel`. */
3
+ export declare const splatesSlots: import("webappwiz/cmd").Cli<SplatesDeps, SplatesDeps>;
@@ -0,0 +1,3 @@
1
+ import type { SplatesDeps } from "./splates.js";
2
+ /** `splates todo`, which the root cli mounts after the task commands. */
3
+ export declare const splatesTodo: import("webappwiz/cmd").Cli<SplatesDeps, SplatesDeps>;
@@ -0,0 +1,3 @@
1
+ import type { SplatesDeps } from "./splates.js";
2
+ /** `splates tunnel`, which the root cli mounts after `splates lane`. */
3
+ export declare const splatesTunnel: import("webappwiz/cmd").Cli<SplatesDeps, SplatesDeps>;
@@ -0,0 +1,3 @@
1
+ import type { SplatesDeps } from "./splates.js";
2
+ /** `splates worker`, which the root cli mounts after `splates slots`. */
3
+ export declare const splatesWorker: import("webappwiz/cmd").Cli<SplatesDeps, SplatesDeps>;
package/splates.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ import { type Deps } from "webappwiz/cmd";
2
+ import type { Fs } from "webappwiz/system";
3
+ import type { SecretStores } from "./creds.js";
4
+ import type { Assets } from "./dev/assets.js";
5
+ /** Everything `splates` is run with, before the repository middleware adds to it. */
6
+ export interface SplatesDeps extends Deps {
7
+ fs: Fs;
8
+ /**
9
+ * The registered project a leading `--project <slug>` names, which repo
10
+ * commands run on instead of the one the working directory is in.
11
+ */
12
+ project?: string;
13
+ /** The built page `dev` serves as its preview. */
14
+ assets: Assets;
15
+ /** Where creds are kept; the system's stores by default. */
16
+ secrets?: SecretStores;
17
+ /** How `splates tunnel setup` reaches Cloudflare's API; the global one by default. */
18
+ fetch?: typeof fetch;
19
+ }
20
+ /**
21
+ * Splits a leading `--project <slug>`, or `--project=<slug>`, off the
22
+ * arguments, for `run` to be handed as `project`.
23
+ */
24
+ export declare function projectArgs(argv: string[]): {
25
+ project?: string;
26
+ argv: string[];
27
+ };
28
+ export declare const splates: import("webappwiz/cmd").Cli<SplatesDeps, SplatesDeps>;