@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/asked.d.ts ADDED
@@ -0,0 +1,146 @@
1
+ import { type Assumed } from "./assumed.js";
2
+ import { type Demo } from "./demo.js";
3
+ import { type Question } from "./plan.js";
4
+ /**
5
+ * `text` cut where it asks questions: a list numbered from 1 at the margin,
6
+ * outside code blocks, every item a question, the lines indented under each
7
+ * its body and its `- (a)` or `- [a]` choices, read as `## Blocked` reads
8
+ * them. An item is a question when its line ends in `?`, or in `?` and an
9
+ * aside in parentheses: `(all that apply)`; when it goes on past a `?`, which
10
+ * leaves the rest to its body; or when it offers choices. Any other list is
11
+ * only text.
12
+ */
13
+ export declare function stretches(text: string): Stretch[];
14
+ /**
15
+ * A stretch of an agent's message: markdown as it was written, the questions
16
+ * it asks the person in the splates skill's format, its report asking them to
17
+ * review a task before it merges, a design it proposes, its report of how a task ended or what it
18
+ * waits on or that the lanes it orchestrated are done, its word that it
19
+ * started lanes, a todo it proposes, a demo for the person to try, the calls
20
+ * it made without asking, or its word that it requested a cred.
21
+ */
22
+ export type Stretch = {
23
+ type: "text";
24
+ text: string;
25
+ } | {
26
+ type: "questions";
27
+ questions: Question[];
28
+ } | {
29
+ type: "review";
30
+ review: Review;
31
+ } | {
32
+ type: "proposal";
33
+ proposal: Proposal;
34
+ } | {
35
+ type: "report";
36
+ report: Report;
37
+ } | {
38
+ type: "start";
39
+ start: LanesStart;
40
+ } | {
41
+ type: "todo";
42
+ todo: TodoProposal;
43
+ } | {
44
+ type: "demo";
45
+ demo: Demo;
46
+ } | {
47
+ type: "assumed";
48
+ assumed: Assumed[];
49
+ };
50
+ /** A review the skill's `## 🔍 Ready to merge` report asks for. */
51
+ export interface Review {
52
+ task: string;
53
+ base: string;
54
+ /** Its first paragraph: what changed, in a sentence, as markdown. */
55
+ summary: string;
56
+ /** The demo it holds, to try before merging. */
57
+ demo: Demo | null;
58
+ /** The commands its `Checks:` line says passed, in order. */
59
+ checks: string[];
60
+ /** The commands its `Failed:` line says failed, in order. */
61
+ failed: string[];
62
+ /** Whatever else it says, past the summary, as markdown. */
63
+ details: string;
64
+ }
65
+ /**
66
+ * What the agent proposes to do, as the skill's `## 💡 Proposed` report puts
67
+ * it, for the person to approve before it starts. The questions after it are
68
+ * the calls it rests on, those with a `(chosen)` choice already answered.
69
+ */
70
+ export interface Proposal {
71
+ /** What it proposes, as its title says. */
72
+ subject: string;
73
+ /** What it recommends, and the `####` sections saying why, as markdown. */
74
+ body: string;
75
+ }
76
+ /**
77
+ * How a task ended, or what it waits on, or that a lane orchestrator is done
78
+ * with its lanes or waits on the person, as the skill's reports title them.
79
+ */
80
+ export type Ending = "merged" | "removed" | "escalated" | "handed" | "finished" | "waiting" | "working";
81
+ /** A report on a task, or a lane orchestrator's last word on its lanes. */
82
+ export type Report = TaskReport | LanesReport;
83
+ /**
84
+ * A report the skill titles `## ✅ Merged <task> onto <base>`, `## 🛑 Removed
85
+ * <task>: <why>`, `## ⚠️ Escalated <task>: <what it needs>`, `## 🤝 Handed
86
+ * off <task> to <agent>: <why>`, or `## ⏳ Working <task>: on <agent>`, for a
87
+ * task its agent handed on and relays for, as a lane's orchestrator does.
88
+ */
89
+ export interface TaskReport {
90
+ ending: Exclude<Ending, "finished" | "waiting">;
91
+ task: string;
92
+ /** Where it merged; null for the others. */
93
+ base: string | null;
94
+ /** The agent it was handed off to; null for the others. */
95
+ to: string | null;
96
+ /** What the title says after its colon, if anything. */
97
+ reason: string | null;
98
+ /** What changed, and anything else said before what follows, as markdown. */
99
+ body: string;
100
+ /** The markdown the agent wrote for it, from its title to its end. */
101
+ source: string;
102
+ }
103
+ /**
104
+ * The report a lane orchestrator ends on: once every lane it works is done,
105
+ * titled `## 🏁 Finished lanes <name>, <name>`, as there is nothing left for
106
+ * it to hand out; or once each lane not done waits on a task that escalated,
107
+ * titled `## ⏸️ Waiting lanes <name>, <name>: <on what>`, as the person must
108
+ * answer that task before it can go on.
109
+ */
110
+ export interface LanesReport {
111
+ ending: "finished" | "waiting" | "working";
112
+ /** The lanes' names, as the title lists them. */
113
+ lanes: string[];
114
+ /** What the title says after its colon, if anything. */
115
+ reason: string | null;
116
+ /** How each lane stands, and anything else said, as markdown. */
117
+ body: string;
118
+ /** The markdown the agent wrote for it, from its title to its end. */
119
+ source: string;
120
+ }
121
+ /** What an agent says it is starting on: a task, or a lane orchestrator's lanes. */
122
+ export type Start = TaskStart | LanesStart;
123
+ /** A task the agent added for itself or claimed, its Goal from that event. */
124
+ export interface TaskStart {
125
+ task: string;
126
+ /** What done means, as the task's Goal says, as markdown. */
127
+ goal: string;
128
+ }
129
+ /**
130
+ * The lanes an orchestrator says it is starting to work, as `## 🌱 Started
131
+ * lanes <name>, <name>`, what they add up to under it.
132
+ */
133
+ export interface LanesStart {
134
+ /** The lanes' names, as the title lists them. */
135
+ lanes: string[];
136
+ /** What the lanes add up to, as markdown. */
137
+ goal: string;
138
+ }
139
+ /** A todo the skill proposes as `### 📝 <subject> [#<id>]`. */
140
+ export interface TodoProposal {
141
+ id: number;
142
+ /** The subject as the agent wrote it, which may since have changed. */
143
+ subject: string;
144
+ /** What the todo is and why it matters now, as markdown. */
145
+ body: string;
146
+ }
package/asked.js ADDED
@@ -0,0 +1,7 @@
1
+ import {
2
+ stretches2
3
+ } from "./index-gcfq7awr.js";
4
+ import"./index-k73tsw5g.js";
5
+ export {
6
+ stretches2 as stretches
7
+ };
package/assumed.d.ts ADDED
@@ -0,0 +1,34 @@
1
+ import { type Exhibit } from "./exhibit.js";
2
+ import { type Question } from "./plan.js";
3
+ /**
4
+ * A call the agent made without asking, as the skill's `- Assumed <number>:
5
+ * <what>` line says it in a reply: numbered as in its task's `## Assumptions`.
6
+ */
7
+ export interface Assumed {
8
+ number: string;
9
+ /** What it chose, as the line says it. */
10
+ text: string;
11
+ /** What the reply shows it in, when the line captions an exhibit. */
12
+ exhibit?: Exhibit;
13
+ }
14
+ /**
15
+ * Each of `assumed` as its task's `plan` writes it, matched by number: under
16
+ * `## Assumptions`, or under `## Blocked` once challenged, so a reply that
17
+ * challenged it still reads as it did. One the plan has no item for, as
18
+ * outside a task or once it is gone, is its line alone, with no choices.
19
+ * Either way, one the reply captions an exhibit with shows it, unless the
20
+ * plan already shows it something.
21
+ */
22
+ export declare function assumedIn(plan: string, assumed: Assumed[]): Question[];
23
+ /** Whether `line` is a reply's `- Assumed <number>:` line. */
24
+ export declare function isAssumed(line: string): boolean;
25
+ /**
26
+ * The run of `- Assumed <number>:` lines from `start`, blank lines between
27
+ * them, and the line after it; null for any other line. An exhibit in the
28
+ * run, `### 🖼️ <title>` and what it shows, is what the lines right after it
29
+ * caption, up to a blank line; one that captions none ends the run.
30
+ */
31
+ export declare function assumedAt(lines: string[], start: number): {
32
+ assumed: Assumed[];
33
+ end: number;
34
+ } | null;
package/attach.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ import { type Logger } from "webappwiz/log";
2
+ import type { Fs, Ps } from "webappwiz/system";
3
+ import type { Git } from "./git.js";
4
+ import type { WorktreeService } from "./worktree-service.js";
5
+ export interface AttachOptions {
6
+ /** Task whose files these are. Defaults to the one `cwd` is a worktree for. */
7
+ task?: string;
8
+ /** Files it holds to drop first, by path or by the name they were stored under. */
9
+ remove?: string[];
10
+ /**
11
+ * Conversation to keep the files with. Defaults to the one whose agent runs
12
+ * the command; with neither, they stay with the task and go when it does.
13
+ */
14
+ conversation?: string;
15
+ }
16
+ /**
17
+ * Stores files for a task's questions to show, in a folder splates owns, so
18
+ * the screenshots and recordings an agent takes never land in a commit.
19
+ * An agent in a conversation has them kept with it, so a merged task's
20
+ * report card still shows them; any other agent's go when the task merges or
21
+ * is removed. Prints where each was stored, which is the path a question
22
+ * names.
23
+ */
24
+ export declare function attach(deps: {
25
+ service: WorktreeService;
26
+ git: Git;
27
+ log: Logger;
28
+ fs: Fs;
29
+ ps: Ps;
30
+ }, paths: string[], cwd: string, { task, remove, conversation: given }?: AttachOptions): Promise<string[]>;
@@ -0,0 +1,43 @@
1
+ import { type IdProvider } from "webappwiz/id";
2
+ import type { Fs, Ps } from "webappwiz/system";
3
+ /** A file handed over, as bytes so a pasted image needs no temp file. */
4
+ export interface Attachment {
5
+ /** What it was called, kept in the stored name so the files stay apart. */
6
+ name: string;
7
+ bytes: Uint8Array;
8
+ }
9
+ /**
10
+ * The folder of files that belong to a todo or a task: todo 7's beside its
11
+ * record, in `todos/7/`, and task `login`'s in `tasks/login/`.
12
+ * Under `.git/splates`, so nothing here is ever committed and every tree can
13
+ * open what it holds.
14
+ */
15
+ export declare class Attachments {
16
+ readonly dir: string;
17
+ private readonly fs;
18
+ private readonly ids;
19
+ constructor(dir: string, fs: Fs, ids?: IdProvider);
20
+ /** Copies each file in, returning the absolute path each was stored at. */
21
+ store(files: Attachment[]): Promise<string[]>;
22
+ /** Each file stored here, by absolute path, with its size in bytes. */
23
+ held(): Promise<{
24
+ path: string;
25
+ bytes: number;
26
+ }[]>;
27
+ /** Whether `path` is one of this folder's files, and not a way out of it. */
28
+ owns(path: string): boolean;
29
+ /** Deletes the files given that are this folder's; others are left alone. */
30
+ remove(paths: string[]): Promise<void>;
31
+ /** Deletes the folder and everything in it. */
32
+ clear(): Promise<void>;
33
+ }
34
+ /**
35
+ * Reads files named on the command line, relative to the current directory or
36
+ * absolute, refusing the whole command over one that cannot be read.
37
+ */
38
+ export declare function readFiles({ fs, ps }: {
39
+ fs: Fs;
40
+ ps: Ps;
41
+ }, paths: string[]): Promise<Attachment[]>;
42
+ /** The bytes of every file under `dir`, folders included, 0 when it is not there. */
43
+ export declare function folderBytes(fs: Fs, dir: string): Promise<number>;
package/baselines.d.ts ADDED
@@ -0,0 +1,55 @@
1
+ import type { Finding } from "./findings.js";
2
+ import type { Outcome } from "./outcomes.js";
3
+ /** Each project's baseline, over the merged tasks that ended in the window before `now`. */
4
+ export declare function baselines(outcomes: Outcome[], now: Date): Baseline[];
5
+ /**
6
+ * What a project's recent merged tasks were like, so one task can be held
7
+ * against them: each measure's median and 90th percentile, and how often each
8
+ * kind of finding came up.
9
+ */
10
+ export interface Baseline {
11
+ /** The main tree of the repository. */
12
+ project: string;
13
+ /** Its merged tasks in the window. */
14
+ tasks: number;
15
+ /** Each measure over the tasks that kept it; null with too few to compare against. */
16
+ measures: Record<Measure, Spread | null>;
17
+ /** How many of its tasks had each finding, by `findingKeys`. */
18
+ findings: Record<string, number>;
19
+ }
20
+ /** Where a measure's values fall among a project's tasks. */
21
+ export interface Spread {
22
+ /** The tasks that kept it. */
23
+ tasks: number;
24
+ median: number;
25
+ p90: number;
26
+ }
27
+ /** What a task is held against its project's on. */
28
+ export type Measure =
29
+ /** From add to merge, in milliseconds. */
30
+ "spentMs"
31
+ /** What its own turns cost; Codex says none. */
32
+ | "cost"
33
+ /** Lines added and removed. */
34
+ | "lines"
35
+ /** Calls the person made, asked or challenged. */
36
+ | "decidedByYou" | "failedMerges";
37
+ export declare const MEASURES: readonly Measure[];
38
+ /** Each tuned here, so a comparison that cries wolf is one number to change. */
39
+ export declare const BASELINE: {
40
+ /** How far back the tasks compared against ended. */
41
+ readonly windowMs: number;
42
+ /** Fewer tasks than this keeping a measure, and it gives no comparison. */
43
+ readonly minTasks: 10;
44
+ /** A value is an outlier past the 90th percentile, or this many medians. */
45
+ readonly timesMedian: 2;
46
+ };
47
+ /** What `outcome` shows of each measure; null for one it did not keep. */
48
+ export declare function measured(outcome: Outcome): Record<Measure, number | null>;
49
+ /** Whether `value` stands out from `spread`: never against no spread. */
50
+ export declare function outlier(value: number, spread: Spread | null): boolean;
51
+ /**
52
+ * What a finding counts toward: its kind, and, for one that names what
53
+ * failed, that too, so the same failing test is counted apart from others.
54
+ */
55
+ export declare function findingKeys(finding: Finding): string[];
package/claim.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { type Logger } from "webappwiz/log";
2
+ import type { Fs } from "webappwiz/system";
3
+ import type { WorktreeService } from "./worktree-service.js";
4
+ /**
5
+ * The resume entry point: a fresh agent thread picking up existing work. An
6
+ * escalated task goes back to `working`, since someone is on it again; its
7
+ * merge budget stays as it was, which only `retry` refills.
8
+ */
9
+ export declare function claim({ service, log, fs }: {
10
+ service: WorktreeService;
11
+ log: Logger;
12
+ fs: Fs;
13
+ }, task: string): Promise<{
14
+ escalated: boolean;
15
+ tookOver: boolean;
16
+ goal: string;
17
+ }>;
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ /** Where Cloudflare's v4 API answers. */
3
+ export declare const CLOUDFLARE_API = "https://api.cloudflare.com/client/v4";
4
+ /**
5
+ * The few calls `splates tunnel setup` makes of Cloudflare's v4 API, over plain
6
+ * `fetch` rather than the `cloudflare` SDK, which every `bunx` of splates would
7
+ * download for some ten endpoints. Each answer's result is checked against
8
+ * the shape the caller names, so a field that moved fails here, saying where.
9
+ */
10
+ export declare class CloudflareApi {
11
+ private readonly token;
12
+ private readonly fetch;
13
+ constructor(token: string, opts?: {
14
+ fetch?: typeof fetch;
15
+ });
16
+ get<T>(path: string, shape: z.ZodType<T>): Promise<T>;
17
+ /** Every item of the list at `path`, page after page. */
18
+ list<T>(path: string, item: z.ZodType<T>): Promise<T[]>;
19
+ post<T>(path: string, body: unknown, shape: z.ZodType<T>): Promise<T>;
20
+ put<T>(path: string, body: unknown, shape: z.ZodType<T>): Promise<T>;
21
+ patch<T>(path: string, body: unknown, shape: z.ZodType<T>): Promise<T>;
22
+ /** Deletes what is at `path`, whatever Cloudflare answers with. */
23
+ delete(path: string): Promise<void>;
24
+ private call;
25
+ }
@@ -0,0 +1,5 @@
1
+ /** A call Cloudflare refused, with the HTTP status it answered. */
2
+ export declare class CloudflareError extends Error {
3
+ readonly status: number;
4
+ constructor(status: number, message: string);
5
+ }
@@ -0,0 +1,27 @@
1
+ import type { AsyncResource } from "webappwiz/disposable";
2
+ import type { Ps } from "webappwiz/system";
3
+ import type { TunnelProvider, TunnelRoute } from "./tunnel-provider.js";
4
+ /**
5
+ * An `sh -c` script that runs the command after it, `sh -c GUARD sh <argv>`,
6
+ * until the guard's stdin closes or a SIGTERM reaches it, and exits with the
7
+ * command's status. Start it with stdin a pipe, so it dies with its parent.
8
+ */
9
+ export declare const GUARD: string;
10
+ /**
11
+ * A TunnelProvider over the `cloudflared` binary, running the named tunnel
12
+ * the account already has, or the one its own config names, or, given a
13
+ * token, the tunnel `splates tunnel setup` made, with no login or credentials
14
+ * file. One that dies while running is logged, never fatal: the page still
15
+ * answers on this machine.
16
+ */
17
+ export declare class CloudflaredTunnelProvider implements TunnelProvider {
18
+ private readonly ps;
19
+ private readonly name;
20
+ /** The tunnel's token, handed over in the environment, never the argv `ps` lists. */
21
+ private readonly token;
22
+ constructor(ps: Ps, name?: string | null,
23
+ /** The tunnel's token, handed over in the environment, never the argv `ps` lists. */
24
+ token?: string | null);
25
+ ready(): Promise<void>;
26
+ run({ host, url, log }: TunnelRoute): AsyncResource;
27
+ }
@@ -0,0 +1,19 @@
1
+ import { type Timer } from "webappwiz/time";
2
+ import type { Agent, Launch, Limit } from "./conversations.js";
3
+ /** Whether `agent` is Codex's ACP adapter, which says its limits only in `/status`. */
4
+ export declare function isCodex(agent: Agent): boolean;
5
+ /**
6
+ * Asks Codex's app server, the one its ACP adapter runs, for the plan's
7
+ * windows, since the adapter never sends them: a window Claude also has goes
8
+ * by Claude's name, any other by its length, as `43200_minutes`. None when
9
+ * Codex will not say.
10
+ */
11
+ export declare function codexLimits(deps: {
12
+ launch: Launch;
13
+ timer: Timer;
14
+ now: () => number;
15
+ /** Where it runs: anywhere does, since the plan is the account's. */
16
+ cwd: string;
17
+ /** Where `codex` is, as the adapter reads it; `codex` on the path otherwise. */
18
+ codex?: string;
19
+ }): Promise<Limit[]>;
@@ -0,0 +1,17 @@
1
+ import type * as acp from "@agentclientprotocol/sdk";
2
+ import type { Compaction, ConversationState } from "./conversation-state.js";
3
+ /** Whether `update` reports a compaction rather than a tool call of the agent's. */
4
+ export declare function isCompaction(update: acp.ToolCall | acp.ToolCallUpdate): boolean;
5
+ /** Takes what an update says of the compaction into it. */
6
+ export declare function fillCompaction(part: Compaction, update: acp.ToolCall | acp.ToolCallUpdate, at: string | null): void;
7
+ /** The compaction `id`, wherever in the conversation it was; null for none. */
8
+ export declare function compactionIn(state: ConversationState, id: string): Compaction | null;
9
+ /** A compaction `id` just begun at `at`, with nothing said of it yet. */
10
+ export declare function newCompaction(id: string, at: string | null): Compaction;
11
+ /**
12
+ * Takes ACP's `compaction_update` into `part`: its status, and its summary,
13
+ * which replaces the one kept, or clears it when null or empty.
14
+ */
15
+ export declare function updateCompaction(part: Compaction, update: acp.CompactionUpdate, at: string | null): void;
16
+ /** Appends a `compaction_summary_chunk`'s text to the summary `part` keeps. */
17
+ export declare function appendSummary(part: Compaction, chunk: acp.CompactionSummaryChunk): void;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `source` typed by a type-only import of `ConfigFile` and `satisfies` rather
3
+ * than by calling `defineConfig`, so a reader can import it without splates
4
+ * installed; or null unless it imports `defineConfig` alone and calls it
5
+ * once.
6
+ */
7
+ export declare function typedConfig(source: string): string | null;
8
+ /**
9
+ * `source` with the `systems` property of its outermost object taken out,
10
+ * with its line when it has one to itself, or null unless there is exactly
11
+ * one such property.
12
+ */
13
+ export declare function withoutSystems(source: string): string | null;
package/config.d.ts ADDED
@@ -0,0 +1,98 @@
1
+ import type { TunnelProvider } from "./tunnel-provider.js";
2
+ export interface Config {
3
+ /**
4
+ * The integration branch name. `merge` rebases a task onto this branch and
5
+ * then fast-forwards it to the result; new worktrees start from it.
6
+ */
7
+ trunk: string;
8
+ /** Directory holding one worktree per task, a sibling of the repo. */
9
+ worktreeRoot: string;
10
+ /** Command run by `add` in the new worktree, via `sh -c`. */
11
+ postCheckout: string | null;
12
+ /**
13
+ * Command run by `merge` after the rebase, before `preMerge`, via `sh -c`.
14
+ * A rebase can bring in a dependency the worktree has never installed, and
15
+ * whatever `preMerge` runs needs it.
16
+ */
17
+ postRewrite: string | null;
18
+ /**
19
+ * Command run by `merge` after the rebase, via `sh -c`. The last gate before
20
+ * the branch lands: a nonzero exit rolls the branch back and leaves the base
21
+ * untouched. Tests are the obvious thing to put here, but splates has no
22
+ * opinion; a repo with nothing to run leaves it null and merges on a green
23
+ * rebase alone.
24
+ */
25
+ preMerge: string | null;
26
+ /** How long since its last heartbeat before a task's lease is up for grabs. */
27
+ leaseStalenessMs: number;
28
+ /**
29
+ * How many agents one agent may have started at once: the tasks it
30
+ * handed out with `splates add --agent` and that are still out. A lane
31
+ * orchestrator hands out every todo that can go, each to an agent of
32
+ * its own. Past it, `add --agent` refuses, unless the person asked for
33
+ * more and it passes `--over-capacity`.
34
+ */
35
+ agentsPerAgent: number;
36
+ /** Failed `merge` attempts a task gets before it must escalate or be removed. */
37
+ mergeRetryCount: number;
38
+ /**
39
+ * How many removed task names to keep, so `remove` can say "already removed"
40
+ * rather than "never existed". A flat cap with no age policy: losing the
41
+ * oldest costs a nicer message and nothing else.
42
+ */
43
+ removedCapacity: number;
44
+ /**
45
+ * How many events the log holds before it is moved aside and a fresh one
46
+ * starts; moved files are kept for `LOG_KEPT_MS` (`journal.ts`).
47
+ */
48
+ logCapacity: number;
49
+ /**
50
+ * How long a todo can wait before `merge` stops recommending it and offers
51
+ * it for removal instead: work deferred that long has usually been done
52
+ * some other way, or stopped mattering.
53
+ */
54
+ todoStalenessMs: number;
55
+ /**
56
+ * How many bytes of files `splates attach` lets one task hold, all of them
57
+ * together: a screen recording is the one thing here that grows fast.
58
+ */
59
+ attachmentCapacity: number;
60
+ /** How many bytes one artifact a conversation keeps may be (`artifacts.ts`). */
61
+ artifactFileCapacity: number;
62
+ /**
63
+ * How many bytes of artifacts one conversation may keep, every version
64
+ * whose bytes have not been deleted.
65
+ */
66
+ artifactConversationCapacity: number;
67
+ /** How many bytes of artifacts every conversation in the project may keep together. */
68
+ artifactProjectCapacity: number;
69
+ /**
70
+ * The command the `splates server` Budget page runs `scry budgets` with, from
71
+ * the repo's root. Leave it unset when the repo installs `@webappwiz/cli`;
72
+ * name a wrapper of the repo's own otherwise, like `"./bin/splates dev"`.
73
+ */
74
+ wiz: string;
75
+ /**
76
+ * What carries `splates server --tunnel` to its public host, a TunnelProvider
77
+ * of your own for any tunnel; null runs `cloudflared`.
78
+ */
79
+ tunnel: TunnelProvider | null;
80
+ }
81
+ /**
82
+ * What `splates.config.ts` exports as its default, typed by a type-only import
83
+ * so a reader can import the file without splates installed:
84
+ *
85
+ * ```ts
86
+ * import type { ConfigFile } from "@stringsync/splates/config";
87
+ *
88
+ * export default { preMerge: "bun test" } satisfies ConfigFile;
89
+ * ```
90
+ */
91
+ export type ConfigFile = Partial<Config>;
92
+ /**
93
+ * Types a config written before `ConfigFile`, which wraps its default in
94
+ * `defineConfig(...)`, so it still loads until `splates update` rewrites it.
95
+ *
96
+ * @deprecated `satisfies ConfigFile` instead.
97
+ */
98
+ export declare function defineConfig(config: Partial<Config>): Partial<Config>;
package/config.js ADDED
@@ -0,0 +1,7 @@
1
+ // config.ts
2
+ function defineConfig(config) {
3
+ return config;
4
+ }
5
+ export {
6
+ defineConfig
7
+ };
@@ -0,0 +1,6 @@
1
+ import type { ConversationHost } from "./conversation-host.js";
2
+ /** Records archive membership and its timestamp together. */
3
+ export declare function put(host: ConversationHost, { archived, with: withConversation, }: {
4
+ archived: boolean;
5
+ with?: string | undefined;
6
+ }): Promise<void>;
@@ -0,0 +1,21 @@
1
+ import type { AgentConnection } from "./agent-connection.js";
2
+ import type { ConversationDeps, ConversationHost } from "./conversation-host.js";
3
+ /**
4
+ * The commands the agent left running in the background, as the
5
+ * conversation's state lists them: what each has printed, and stopping one.
6
+ */
7
+ export declare class ConversationBackground {
8
+ private readonly host;
9
+ private readonly deps;
10
+ private readonly connection;
11
+ constructor(host: ConversationHost, deps: ConversationDeps, connection: AgentConnection);
12
+ /** Stops background command `id`, leaving the agent's turn as it is. */
13
+ stop(id: string): Promise<void>;
14
+ /**
15
+ * What background command `id` has printed, then more as it prints it,
16
+ * ending once the command has and all of it is read.
17
+ */
18
+ output(id: string): ReadableStream<Uint8Array>;
19
+ /** Background command `id`, refusing one the agent never left. */
20
+ private command;
21
+ }
@@ -0,0 +1,4 @@
1
+ import type { AgentConnection } from "./agent-connection.js";
2
+ import type { ConversationHost } from "./conversation-host.js";
3
+ /** Applies a validated user choice to the session and its log. */
4
+ export declare function choose(host: ConversationHost, connection: AgentConnection, id: string, value: string): Promise<void>;
@@ -0,0 +1,51 @@
1
+ import type * as acp from "@agentclientprotocol/sdk";
2
+ import type { Fs } from "webappwiz/system";
3
+ import type { ProjectRoster } from "./conversation-host.js";
4
+ import type { Message, Sent, Upload } from "./conversation-state.js";
5
+ /**
6
+ * The files the person sent in a conversation, kept beside its log in a
7
+ * directory named for it, and how what they said goes to the agent.
8
+ */
9
+ export declare class ConversationFiles {
10
+ private readonly fs;
11
+ /** Where the files are kept. */
12
+ private readonly dir;
13
+ private readonly projects;
14
+ private readonly home;
15
+ constructor(log: string, fs: Fs, { projects, home, }?: {
16
+ /** The splates projects on this machine, for `#slug`; null for none. */
17
+ projects?: ProjectRoster | null;
18
+ /** The main tree of the project the conversation is in; null for none. */
19
+ home?: string | null;
20
+ });
21
+ /**
22
+ * Saves each file beside the log, named for what is in it, so the page
23
+ * reads it by name rather than with every change to the conversation.
24
+ * An image goes to the agent as itself when it `sees` images; anything
25
+ * else, as a link to where it is kept, which every agent takes.
26
+ */
27
+ keep(files: Upload[], sees: boolean): Promise<Sent[]>;
28
+ /** The file `name` the person sent in `messages`, or null when they sent none by that name. */
29
+ attachment(name: string, messages: Message[]): Promise<{
30
+ bytes: Uint8Array;
31
+ mimeType: string;
32
+ } | null>;
33
+ /**
34
+ * What `messages` say, as one prompt: their images, links to their other
35
+ * files, then their words, with a line on each system they name in
36
+ * `tree`, the one the agent runs in (none for a log too old to say), one
37
+ * on where each project they name sits, and one on reading them as speech
38
+ * when any was dictated.
39
+ */
40
+ content(messages: Message[], tree: string | null, sees?: boolean): Promise<acp.ContentBlock[]>;
41
+ /** Deletes every file kept, for good. */
42
+ remove(): Promise<void>;
43
+ /**
44
+ * A line on each system, conversation UUID and project `text` mentions with `#`,
45
+ * then one on each `#word` that names neither, for the agent alone: the
46
+ * thread keeps the words as typed. Read from `tree` and the projects as
47
+ * it goes, so a system named there a moment ago counts. A system wins
48
+ * over a project of the same name.
49
+ */
50
+ private namedIn;
51
+ }
@@ -0,0 +1,8 @@
1
+ import type { WorktreeService } from "./worktree-service.js";
2
+ /**
3
+ * The conversation a command is about: `given` from `--conversation`, for an
4
+ * agent outside `splates server`, else the one `splates server` started this agent in
5
+ * ($SPLATES_CONVERSATION). Refuses `usage` when neither names one of this
6
+ * repository's.
7
+ */
8
+ export declare function conversationOf(service: WorktreeService, given: string): Promise<string>;