@stringsync/splates 0.0.45 → 0.0.46

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 (254) hide show
  1. package/README.md +121 -9
  2. package/artifact.d.ts +3 -30
  3. package/budget.d.ts +3 -0
  4. package/coordinator.d.ts +3 -0
  5. package/creds.d.ts +3 -123
  6. package/flags.d.ts +37 -0
  7. package/index.js +729 -26375
  8. package/lane.d.ts +3 -55
  9. package/main.d.ts +6 -0
  10. package/package.json +3 -42
  11. package/projects.d.ts +3 -136
  12. package/queue.d.ts +3 -0
  13. package/setup.d.ts +16 -98
  14. package/slots.d.ts +3 -135
  15. package/splates.d.ts +1 -19
  16. package/todo.d.ts +3 -146
  17. package/{splates-tunnel.d.ts → tunnel.d.ts} +1 -1
  18. package/{splates-worker.d.ts → worker.d.ts} +1 -1
  19. package/acp-extensions.d.ts +0 -82
  20. package/add.d.ts +0 -53
  21. package/adherence.d.ts +0 -49
  22. package/age.d.ts +0 -2
  23. package/agent-connection.d.ts +0 -171
  24. package/agent-errors.d.ts +0 -2
  25. package/agent-process.d.ts +0 -65
  26. package/agent-stream.d.ts +0 -91
  27. package/agents.d.ts +0 -15
  28. package/artifact-room.d.ts +0 -47
  29. package/artifact-viewers.d.ts +0 -6
  30. package/artifacts.d.ts +0 -161
  31. package/asked.d.ts +0 -146
  32. package/asked.js +0 -7
  33. package/assumed.d.ts +0 -34
  34. package/attach.d.ts +0 -30
  35. package/attachments.d.ts +0 -43
  36. package/baselines.d.ts +0 -55
  37. package/claim.d.ts +0 -17
  38. package/cloudflare-api.d.ts +0 -25
  39. package/cloudflare-error.d.ts +0 -5
  40. package/cloudflared-tunnel-provider.d.ts +0 -27
  41. package/codex-limits.d.ts +0 -19
  42. package/compaction.d.ts +0 -17
  43. package/config-source.d.ts +0 -13
  44. package/config.d.ts +0 -98
  45. package/config.js +0 -7
  46. package/conversation-archive.d.ts +0 -6
  47. package/conversation-background.d.ts +0 -21
  48. package/conversation-choice.d.ts +0 -4
  49. package/conversation-files.d.ts +0 -51
  50. package/conversation-given.d.ts +0 -8
  51. package/conversation-host.d.ts +0 -102
  52. package/conversation-listing.d.ts +0 -15
  53. package/conversation-log.d.ts +0 -301
  54. package/conversation-messages.d.ts +0 -18
  55. package/conversation-name.d.ts +0 -28
  56. package/conversation-options.d.ts +0 -73
  57. package/conversation-reference.d.ts +0 -2
  58. package/conversation-state.d.ts +0 -472
  59. package/conversation-turns.d.ts +0 -115
  60. package/conversation.d.ts +0 -209
  61. package/conversations.d.ts +0 -140
  62. package/coordinator-state.d.ts +0 -28
  63. package/darwin-temperature.d.ts +0 -7
  64. package/decided.d.ts +0 -18
  65. package/demo.d.ts +0 -29
  66. package/dev/api.d.ts +0 -209
  67. package/dev/assets.d.ts +0 -24
  68. package/dev/conversation-address.d.ts +0 -47
  69. package/dev/conversation-feed.d.ts +0 -166
  70. package/dev/live-stream.d.ts +0 -29
  71. package/dev/worker.d.ts +0 -33
  72. package/dev-access.d.ts +0 -61
  73. package/dev-artifacts.d.ts +0 -22
  74. package/dev-budgets.d.ts +0 -18
  75. package/dev-conversation-events.d.ts +0 -39
  76. package/dev-conversation-routes.d.ts +0 -90
  77. package/dev-creds.d.ts +0 -17
  78. package/dev-dictation-connection.d.ts +0 -18
  79. package/dev-dictation.d.ts +0 -17
  80. package/dev-http.d.ts +0 -76
  81. package/dev-open.d.ts +0 -15
  82. package/dev-options.d.ts +0 -133
  83. package/dev-outcomes.d.ts +0 -21
  84. package/dev-pages.d.ts +0 -16
  85. package/dev-picker.d.ts +0 -57
  86. package/dev-port-socket.d.ts +0 -26
  87. package/dev-ports.d.ts +0 -11
  88. package/dev-project-watch.d.ts +0 -44
  89. package/dev-project.d.ts +0 -168
  90. package/dev-push.d.ts +0 -59
  91. package/dev-restart.d.ts +0 -141
  92. package/dev-servers.d.ts +0 -30
  93. package/dev-setup-native.d.ts +0 -23
  94. package/dev-setup-opencode.d.ts +0 -29
  95. package/dev-setup.d.ts +0 -16
  96. package/dev-shell.d.ts +0 -70
  97. package/dev-slot.d.ts +0 -28
  98. package/dev-sockets.d.ts +0 -13
  99. package/dev-task-ports.d.ts +0 -73
  100. package/dev-tasks.d.ts +0 -20
  101. package/dev-terminal-connection.d.ts +0 -19
  102. package/dev-terminal.d.ts +0 -42
  103. package/dev-todos.d.ts +0 -35
  104. package/dev-transcriber.d.ts +0 -15
  105. package/dev-tunnel.d.ts +0 -38
  106. package/dev-versions.d.ts +0 -53
  107. package/dev-workers.d.ts +0 -55
  108. package/dev.d.ts +0 -24
  109. package/diff.d.ts +0 -29
  110. package/dispatched.d.ts +0 -16
  111. package/editors.d.ts +0 -22
  112. package/escalate.d.ts +0 -27
  113. package/events.d.ts +0 -311
  114. package/everywhere.d.ts +0 -41
  115. package/exhibit.d.ts +0 -21
  116. package/exit.d.ts +0 -54
  117. package/fact-todos.d.ts +0 -18
  118. package/fake-agent.d.ts +0 -107
  119. package/fake-agent.js +0 -284
  120. package/finding-facts.d.ts +0 -38
  121. package/findings.d.ts +0 -84
  122. package/fold.d.ts +0 -43
  123. package/follow.d.ts +0 -41
  124. package/format.d.ts +0 -68
  125. package/git.d.ts +0 -112
  126. package/handed-out.d.ts +0 -79
  127. package/handoff.d.ts +0 -23
  128. package/heavy-run.d.ts +0 -12
  129. package/heavy.d.ts +0 -28
  130. package/heavy.js +0 -16
  131. package/held.d.ts +0 -22
  132. package/index-0tfvy823.js +0 -272
  133. package/index-43pq33n4.js +0 -157
  134. package/index-4776671w.js +0 -698
  135. package/index-d4hjrzaq.js +0 -464
  136. package/index-gcfq7awr.js +0 -740
  137. package/index-k73tsw5g.js +0 -101
  138. package/index-kaa44k7q.js +0 -59
  139. package/index-vcv9m93e.js +0 -1265
  140. package/index-xmfmy729.js +0 -249
  141. package/init.d.ts +0 -28
  142. package/journal.d.ts +0 -57
  143. package/landed.d.ts +0 -14
  144. package/lane-todos.d.ts +0 -44
  145. package/lanes-from-tags.d.ts +0 -17
  146. package/lanes.d.ts +0 -96
  147. package/legacy-names.d.ts +0 -70
  148. package/legacy-ps.d.ts +0 -31
  149. package/limits.d.ts +0 -32
  150. package/list.d.ts +0 -18
  151. package/load-config.d.ts +0 -44
  152. package/log.d.ts +0 -14
  153. package/machine.d.ts +0 -42
  154. package/merge.d.ts +0 -35
  155. package/migrate-config.d.ts +0 -31
  156. package/models.d.ts +0 -24
  157. package/needs.d.ts +0 -115
  158. package/notices.d.ts +0 -39
  159. package/offered.d.ts +0 -39
  160. package/opencode-usage.d.ts +0 -37
  161. package/outcomes.d.ts +0 -114
  162. package/path.d.ts +0 -13
  163. package/plan.d.ts +0 -236
  164. package/port-forward.d.ts +0 -22
  165. package/port-pipe.d.ts +0 -36
  166. package/ports-list.d.ts +0 -19
  167. package/probe-runtime.d.ts +0 -5
  168. package/probe-runtime.js +0 -13
  169. package/project-reaches.d.ts +0 -23
  170. package/prompts.d.ts +0 -128
  171. package/pty.d.ts +0 -39
  172. package/pulse.d.ts +0 -8
  173. package/recommend.d.ts +0 -31
  174. package/release.d.ts +0 -41
  175. package/remote-process.d.ts +0 -26
  176. package/remote-pty.d.ts +0 -29
  177. package/remote-worker.d.ts +0 -77
  178. package/remove.d.ts +0 -31
  179. package/repository.d.ts +0 -91
  180. package/retry.d.ts +0 -34
  181. package/roster.d.ts +0 -63
  182. package/saved-ports-host.d.ts +0 -25
  183. package/saved-tunnel.d.ts +0 -44
  184. package/server-worker-socket.d.ts +0 -21
  185. package/setup-areas.d.ts +0 -7
  186. package/setup-opencode-model-error.d.ts +0 -3
  187. package/setup-opencode-models.d.ts +0 -54
  188. package/setup-opencode-recipe.d.ts +0 -26
  189. package/setup-opencode.d.ts +0 -46
  190. package/shared-browser.d.ts +0 -50
  191. package/shell.d.ts +0 -17
  192. package/show.d.ts +0 -106
  193. package/skill-checks.d.ts +0 -73
  194. package/skill-checks.js +0 -10
  195. package/skills.d.ts +0 -16
  196. package/slot-tunnel.d.ts +0 -27
  197. package/snapshot.d.ts +0 -75
  198. package/splates-artifact.d.ts +0 -3
  199. package/splates-creds.d.ts +0 -3
  200. package/splates-dev.d.ts +0 -22
  201. package/splates-flags.d.ts +0 -34
  202. package/splates-lane.d.ts +0 -3
  203. package/splates-projects.d.ts +0 -3
  204. package/splates-setup.d.ts +0 -17
  205. package/splates-slots.d.ts +0 -3
  206. package/splates-todo.d.ts +0 -3
  207. package/stats.d.ts +0 -186
  208. package/supervise.d.ts +0 -50
  209. package/system-changes.d.ts +0 -67
  210. package/system.d.ts +0 -28
  211. package/systems.d.ts +0 -119
  212. package/systems.js +0 -21
  213. package/table.d.ts +0 -5
  214. package/task-log.d.ts +0 -35
  215. package/task-ports.d.ts +0 -25
  216. package/tell.d.ts +0 -47
  217. package/todo-edit.d.ts +0 -60
  218. package/todo-file.d.ts +0 -6
  219. package/todo-lanes.d.ts +0 -82
  220. package/todo-list.d.ts +0 -26
  221. package/todo-take.d.ts +0 -27
  222. package/todos.d.ts +0 -157
  223. package/tool-calls.d.ts +0 -18
  224. package/tunnel-provider.d.ts +0 -37
  225. package/tunnel-provider.js +0 -0
  226. package/tunnel-remove.d.ts +0 -28
  227. package/tunnel-setup.d.ts +0 -104
  228. package/unix-worker-listener.d.ts +0 -23
  229. package/unix-worker-socket.d.ts +0 -30
  230. package/update.d.ts +0 -29
  231. package/update.js +0 -10
  232. package/vocabulary.d.ts +0 -9
  233. package/wait.d.ts +0 -36
  234. package/watch.d.ts +0 -46
  235. package/watched.d.ts +0 -43
  236. package/websocket-worker-socket.d.ts +0 -18
  237. package/worker-call-host.d.ts +0 -51
  238. package/worker-channel.d.ts +0 -83
  239. package/worker-connection.d.ts +0 -24
  240. package/worker-daemon.d.ts +0 -64
  241. package/worker-git.d.ts +0 -18
  242. package/worker-list.d.ts +0 -49
  243. package/worker-machine.d.ts +0 -34
  244. package/worker-port-host.d.ts +0 -21
  245. package/worker-process-host.d.ts +0 -29
  246. package/worker-protocol.d.ts +0 -104
  247. package/worker-pty-host.d.ts +0 -34
  248. package/worker-registry.d.ts +0 -68
  249. package/worker-replay.d.ts +0 -25
  250. package/worker-run.d.ts +0 -20
  251. package/worker-session.d.ts +0 -189
  252. package/worker-socket.d.ts +0 -15
  253. package/worktree-service.d.ts +0 -113
  254. package/worktree.d.ts +0 -232
@@ -1,189 +0,0 @@
1
- import { type Resource } from "webappwiz/disposable";
2
- import { type Eventful } from "webappwiz/events";
3
- import { type Clock, Duration, type Timer, type WallClock } from "webappwiz/time";
4
- import { WorkerChannel } from "./worker-channel.js";
5
- import { type Frame, type Json, type Negotiated } from "./worker-protocol.js";
6
- import type { WorkerSocket } from "./worker-socket.js";
7
- /** A worker's hello, which the coordinator reads to pick its session. */
8
- export type WorkerHello = Extract<Frame, {
9
- type: "hello";
10
- }>;
11
- /** What a `WorkerSession` hears. */
12
- export interface WorkerSessionEvents extends Record<string, unknown> {
13
- /** The other end opened a channel. */
14
- channel: WorkerChannel;
15
- /** A handshake settled, and what the other end missed has been sent again. */
16
- connected: undefined;
17
- /** The connection went, by hang-up, missed heartbeats or a bad frame; channels stay. */
18
- lost: {
19
- reason: string;
20
- };
21
- /** Acks brought unacked bytes back under the bound: writers may go on. */
22
- drain: undefined;
23
- /** The other end acked something; `acked()` waits on it. */
24
- acked: undefined;
25
- }
26
- /** How a `WorkerSession` paces and bounds itself. */
27
- export interface WorkerSessionOptions {
28
- /**
29
- * What its hello or welcome names it by: the id a coordinator started
30
- * again answers as, so its worker finds it unchanged and keeps every
31
- * channel; new by default.
32
- */
33
- id?: string;
34
- capabilities?: string[];
35
- /** Unacked bytes kept for replay before writes return `false`. */
36
- bufferBytes?: number;
37
- /** How often each end pings the other. */
38
- heartbeat?: Duration;
39
- /** How long without a frame before the other end counts as gone. */
40
- timeout?: Duration;
41
- /** How long acks gather before they go, so a burst costs one ack. */
42
- ackDelay?: Duration;
43
- /**
44
- * `delivery` acks data and messages once listeners have them; `manual`
45
- * waits for `WorkerChannel.ack`, for an end that must first write them
46
- * down. Opens and closes are acked on arrival either way.
47
- */
48
- acks?: "delivery" | "manual";
49
- timer?: Timer;
50
- clock?: Clock;
51
- /** Stamps `lastHeard`. */
52
- wall?: WallClock;
53
- }
54
- /**
55
- * One end of the link between a coordinator and a worker, the same code on
56
- * both. It outlives any one connection: channels stay open across a
57
- * reconnect, every channel frame is kept until the other end acks it, and a
58
- * new connection replays what was not acked, in order, once.
59
- */
60
- export declare class WorkerSession implements Eventful<WorkerSessionEvents>, Resource {
61
- readonly role: "worker" | "coordinator";
62
- /** What its hello or welcome names it by, so the other end can tell one started again. */
63
- readonly id: string;
64
- private readonly dispatcher;
65
- readonly events: import("webappwiz/events").Events<WorkerSessionEvents>;
66
- private readonly channels;
67
- private readonly replay;
68
- private readonly sent;
69
- private readonly received;
70
- /** Channels taken back without knowing where the other end's replay starts: its first frame says. */
71
- private readonly unplaced;
72
- /** Channels taken back from the session this one resumes, until the first handshake says the other end holds them. */
73
- private readonly taken;
74
- /**
75
- * What was sent on a taken channel before that handshake, which says
76
- * where its seqs carry on from: numbered and sent then.
77
- */
78
- private readonly deferred;
79
- private readonly held;
80
- private readonly pendingAcks;
81
- /** Channels both ends closed, kept until a pong proves the other end has their ack. */
82
- private readonly forgetting;
83
- private readonly capabilities;
84
- private readonly heartbeat;
85
- private readonly timeout;
86
- private readonly ackDelay;
87
- private readonly acks;
88
- private readonly timer;
89
- private readonly clock;
90
- private readonly wall;
91
- private readonly link;
92
- private connection;
93
- private nextChannel;
94
- private nextPing;
95
- private wasFull;
96
- private _negotiated;
97
- private _lastHeard;
98
- private disposed;
99
- /** Hung up for a restart: its channels live on at the other end, for the next session to take back. */
100
- private detached;
101
- /** Made with an id, so the other end may hold channels of the session it resumes. */
102
- private readonly resumed;
103
- /** The other end's session at the last handshake; null before the first. */
104
- private peer;
105
- constructor(role: "worker" | "coordinator", opts?: WorkerSessionOptions);
106
- /**
107
- * Reads the first frame of a new connection, which must be a worker's
108
- * hello, so the coordinator can pick the session it resumes.
109
- */
110
- static hello(socket: WorkerSocket): Promise<WorkerHello>;
111
- /** What the last handshake settled on, once there has been one. */
112
- get negotiated(): Negotiated | undefined;
113
- /** When any frame last came from the other end, in epoch milliseconds; null before the first. */
114
- get lastHeard(): number | null;
115
- get connected(): boolean;
116
- /** False while unacked bytes are at the bound; `drain` says when that ends. */
117
- get writable(): boolean;
118
- /** Settles once writes may go on: at once, or at the next `drain`. */
119
- drained(): Promise<void>;
120
- /** Opens a channel to the other end, which hears it as `channel`. */
121
- open(kind: string, params?: Json): WorkerChannel;
122
- /**
123
- * Takes back channel `id`, which the other end still holds from the
124
- * session this one resumes, before the handshake: `held` is the last seq
125
- * of the other end's this end has, which its replay then follows, or null
126
- * to take the replay from wherever it starts. What this end sends on it
127
- * carries on from what the other end's hello says it received.
128
- */
129
- resume(id: number, kind: string, params: Json, held: number | null): WorkerChannel;
130
- /**
131
- * The worker's side of a handshake: says hello on `socket`, and on welcome
132
- * replays what the coordinator does not hold. Resolves with what was
133
- * negotiated, or why not: refused for another major, or the link went.
134
- */
135
- connect(socket: WorkerSocket, hello: {
136
- id: string;
137
- info?: {
138
- [key: string]: Json;
139
- };
140
- }): Promise<Negotiated>;
141
- /**
142
- * The coordinator's side of a handshake, given the hello
143
- * `WorkerSession.hello` read: welcomes the worker and replays what it
144
- * does not hold, or refuses one on another major, hanging up, so the
145
- * coordinator can drain it with the reason.
146
- */
147
- accept(socket: WorkerSocket, hello: WorkerHello): Negotiated;
148
- /**
149
- * What the worker's hello says it holds of the channels of the session
150
- * this one resumes, at its first handshake: this end sends on each from
151
- * past that, opens new ones past them all, and closes those nobody took
152
- * back, which ends what they ran. One taken back that the worker does
153
- * not hold, as after the worker too started again, ends here.
154
- */
155
- private takeBack;
156
- /**
157
- * Hangs up for a restart, keeping every channel open at the other end:
158
- * a session with this id takes them back once it comes up.
159
- */
160
- detach(): void;
161
- /** Settles once the other end has acked everything sent, or at once with nothing out. */
162
- acked(): Promise<void>;
163
- /** Hangs up and closes every channel; the other end hears them close. */
164
- dispose(): void;
165
- private attach;
166
- private go;
167
- private hear;
168
- private handshake;
169
- private receive;
170
- /** Holds `frame` for the handshake that says what seq it goes out as. */
171
- private defer;
172
- private sendOnChannel;
173
- private nextSeq;
174
- private ack;
175
- private flushAcks;
176
- private acknowledged;
177
- /**
178
- * Ends every channel at this end, for another end started again, which
179
- * knows none of them: what they ran stops, as when the old one hung up.
180
- */
181
- private forget;
182
- private channelDone;
183
- private ponged;
184
- private beat;
185
- private write;
186
- private lose;
187
- private assertRole;
188
- private assertOpen;
189
- }
@@ -1,15 +0,0 @@
1
- import type { Resource } from "webappwiz/disposable";
2
- import type { Eventful } from "webappwiz/events";
3
- /** What a `WorkerSocket` hears: one whole frame, or that it is gone. */
4
- export interface WorkerSocketEvents extends Record<string, unknown> {
5
- frame: string | Uint8Array;
6
- close: undefined;
7
- }
8
- /**
9
- * One connection between a coordinator and a worker, carrying whole frames in
10
- * order: a WebSocket as it is, or a Unix socket behind length-prefixed
11
- * framing. Disposing it hangs up, and both ends then hear `close`.
12
- */
13
- export interface WorkerSocket extends Eventful<WorkerSocketEvents>, Resource {
14
- send(frame: string | Uint8Array): void;
15
- }
@@ -1,113 +0,0 @@
1
- import { type Fs, type Ps } from "webappwiz/system";
2
- import type { Adherence } from "./adherence.js";
3
- import { Attachments } from "./attachments.js";
4
- import type { Config } from "./config.js";
5
- import type { Git, GitResult } from "./git.js";
6
- import { type Outcomes } from "./outcomes.js";
7
- import { type DiscardOptions, type TaskState, Worktree } from "./worktree.js";
8
- export interface AddOptions {
9
- /** Branch the new worktree starts from. Defaults to the trunk. */
10
- base?: string;
11
- }
12
- /**
13
- * Where tasks live and everything persistent about them: the worktree
14
- * directories, the records under `.git/splates/tasks`, and the names of tasks
15
- * already removed. One name, one lookup, whatever state it turns out to be in.
16
- */
17
- /** What a `WorktreeService` works through; the real ones by default. */
18
- export interface WorktreeServiceOptions {
19
- fs?: Fs;
20
- ps?: Ps;
21
- /** Where each task's ending is written down; none, and nothing is. */
22
- outcomes?: Outcomes;
23
- /** How closely conversations follow the skill, which an ending's findings read. */
24
- adherence?: Adherence;
25
- }
26
- export declare class WorktreeService {
27
- readonly git: Git;
28
- readonly config: Config;
29
- private readonly tasksDir;
30
- private readonly removedDir;
31
- private readonly conversationsDir;
32
- private readonly fs;
33
- private readonly outcomes;
34
- private readonly adherence;
35
- readonly ps: Ps;
36
- constructor(git: Git, config: Config, splatesDir: string, opts?: WorktreeServiceOptions);
37
- /**
38
- * The `splates server` conversation whose agent runs this command, when it is
39
- * one of this repo's: an agent from another project's page working here
40
- * is, to this repo, an agent outside the page.
41
- */
42
- conversation(): Promise<string | undefined>;
43
- /** Where the log of the conversation `id` is kept. */
44
- conversationLog(id: string): string;
45
- /** Whether the `splates server` conversation `id` is one of this repo's. */
46
- holds(id: string): Promise<boolean>;
47
- init(): Promise<void>;
48
- get trunk(): string;
49
- /** Where a task's worktree lives: a sibling of the repo, never inside it. */
50
- pathFor(task: string): string;
51
- branchFor(task: string): string;
52
- taskFor(branch: string | null): string | null;
53
- recordPath(task: string): string;
54
- /**
55
- * Where a task's files live, beside its record: the screenshots and videos
56
- * its questions show, in `tasks/<task>/`. They go when the task does.
57
- */
58
- files(task: string): Attachments;
59
- /**
60
- * Where a task's files live when it attaches them from `conversation`:
61
- * beside that conversation's artifacts, in `attached/<task>/`, so they
62
- * outlive the task and a merged card's images still show.
63
- */
64
- attached(conversation: string, task: string): Attachments;
65
- /**
66
- * Every folder holding files `task` attached: its own, and one in each
67
- * conversation that attached some.
68
- */
69
- filesOf(task: string): Promise<Attachments[]>;
70
- /**
71
- * The bytes `conversation` keeps on disk, its artifacts and attached
72
- * files, which together are held to `artifactConversationCapacity`.
73
- */
74
- conversationBytes(conversation: string): Promise<number>;
75
- /**
76
- * Whether `path` is a file some task or conversation holds for a task:
77
- * one level inside a task's folder, or inside a conversation's
78
- * `attached/<task>/`, never a record or log, and not a way out of here.
79
- */
80
- owns(path: string): boolean;
81
- /** Always answers; the returned worktree's status says what was found. */
82
- find(task: string): Promise<Worktree>;
83
- list(): Promise<Worktree[]>;
84
- /** Adds the branch and the working directory. The record comes after. */
85
- add(task: string, { base }?: AddOptions): Promise<GitResult>;
86
- discard(worktree: Worktree, ended: "merged" | "removed", opts?: DiscardOptions): Promise<GitResult>;
87
- /** Writes a task's record. A concurrent reader sees the old one or the new. */
88
- saveRecord(state: TaskState): Promise<void>;
89
- /**
90
- * Writes down how a task with a record ended. One with none, a stray
91
- * branch or a bare directory, never ran as a task, so says nothing.
92
- */
93
- /**
94
- * What a task leaves to read as it ends: its plan's questions, and the
95
- * systems its changes fall in, by the config in its own tree.
96
- */
97
- private ending;
98
- private recordOutcome;
99
- private readRecord;
100
- /**
101
- * Drops the files of every task with no record left: what a process that
102
- * died between discarding a task and clearing its folder left behind.
103
- */
104
- private sweep;
105
- private removedPath;
106
- private removedAt;
107
- /**
108
- * Remembers a removed name so a second `remove` can say "already removed"
109
- * instead of "never existed", then drops the oldest so the list of
110
- * remembered names cannot grow without bound.
111
- */
112
- private rememberRemoved;
113
- }
package/worktree.d.ts DELETED
@@ -1,232 +0,0 @@
1
- import { type FileDiff } from "./diff.js";
2
- import type { GitResult } from "./git.js";
3
- import type { WorktreeService } from "./worktree-service.js";
4
- /**
5
- * One task, whether or not it is still there. Commands ask the service for
6
- * one of these and read its status rather than assembling the same handful of
7
- * existence checks themselves.
8
- */
9
- export declare class Worktree {
10
- private readonly service;
11
- private readonly snapshot;
12
- constructor(service: WorktreeService, snapshot: WorktreeSnapshot);
13
- get task(): string;
14
- get branch(): string;
15
- /** Where this task's work lands: its recorded base branch, else trunk. */
16
- get base(): string;
17
- /** The conversation whose agent added the task, or null. */
18
- get caller(): string | null;
19
- get path(): string;
20
- get state(): TaskState | null;
21
- get lease(): LeaseState | null;
22
- /** The `splates server` conversation whose agent last took the task, or null. */
23
- get takenBy(): string | null;
24
- get leaseHeld(): boolean;
25
- get leaseStatus(): "held" | "stale" | "none";
26
- get leaseOurs(): boolean;
27
- get leaseHeldByOther(): boolean;
28
- get mergeAttempts(): number;
29
- /** How many merge attempts a task gets before `merge` stops on `budget_exhausted`. */
30
- get mergeAttemptLimit(): number;
31
- get exists(): boolean;
32
- get hasBranch(): boolean;
33
- get removedAt(): string | null;
34
- get status(): WorktreeStatus;
35
- get gone(): boolean;
36
- /**
37
- * Merges changes into the record and writes it. Works on a name that has no
38
- * record yet, which is how `add` writes the first one and how `claim`
39
- * rebuilds one from a worktree found on disk.
40
- */
41
- save(changes?: Partial<TaskState>): Promise<Worktree>;
42
- take(changes?: Partial<TaskState>): Promise<Worktree>;
43
- /** Re-reads from disk. `merge` needs this: the record is the truth. */
44
- reload(): Promise<Worktree>;
45
- /**
46
- * Removes the directory, the branch, and the record; remembers the name,
47
- * and how the task ended.
48
- */
49
- discard(ended: "merged" | "removed", opts?: DiscardOptions): Promise<GitResult>;
50
- /** The message of each commit it has that its base does not, oldest first. */
51
- commitMessages(): Promise<string[] | null>;
52
- commitsAhead(): Promise<number | null>;
53
- /** Files and lines across all its pending work, as `diff` shows it; null without a branch. */
54
- size(): Promise<DiffSize | null>;
55
- /**
56
- * Its committed and uncommitted changes, new files among them, parsed;
57
- * null without a branch.
58
- */
59
- diff(): Promise<FileDiff[] | null>;
60
- /** Committed and uncommitted paths this task touches; null without a branch. */
61
- changedFiles(): Promise<string[] | null>;
62
- uncommitted(): Promise<string[]>;
63
- /** When its branch's latest commit was made, or null without a branch. */
64
- committedAt(): Promise<string | null>;
65
- interruptedOps(): Promise<string[]>;
66
- }
67
- export interface DiscardOptions {
68
- /**
69
- * The `splates server` conversation working on it, when ended from the page
70
- * rather than by the agent, whose env names it.
71
- */
72
- conversation?: string;
73
- /**
74
- * The repo-relative paths the task changed, for a merge, which reads them
75
- * before landing leaves nothing between the branch and its base. Read
76
- * from the branch when not given.
77
- */
78
- changed?: string[];
79
- /**
80
- * The message of each commit a merge lands, read before landing as
81
- * `changed` is.
82
- */
83
- commits?: string[];
84
- /** Why it was removed, as `splates remove --reason` gives it. */
85
- reason?: RemoveReason;
86
- /** What a merge lands, read before landing as `changed` is. */
87
- size?: DiffSize;
88
- }
89
- /** How big a change is, as its diff counts it. */
90
- export interface DiffSize {
91
- files: number;
92
- added: number;
93
- removed: number;
94
- }
95
- /** Why a task can be removed rather than merged, as `--reason` names it. */
96
- export declare const REMOVE_REASONS: readonly ["nothing", "moot", "superseded", "redo"];
97
- /** Why a task was removed rather than merged. */
98
- export type RemoveReason = (typeof REMOVE_REASONS)[number];
99
- /** The status a task's own record carries. */
100
- export type RecordStatus = "working" | "merging" | "escalated";
101
- /** What a task's record stores about who is driving it. */
102
- export interface LeaseState {
103
- pid: number;
104
- hostname: string;
105
- heartbeatAt: string;
106
- /**
107
- * The `splates server` conversation whose agent took it, or its caller's for a
108
- * subagent; absent for an agent outside the page, and in older records.
109
- */
110
- conversation?: string;
111
- }
112
- export interface Escalation {
113
- reason: string;
114
- at: string;
115
- /**
116
- * Set for a task handed over to be approved rather than to answer
117
- * questions, the reason saying what to look at.
118
- */
119
- review?: true | string;
120
- /**
121
- * When `claim` took the task back up, ending the wait on a person; absent
122
- * while it waits, and in records from before it was kept.
123
- */
124
- resumedAt?: string;
125
- }
126
- /** Why a merge failed, as `merge` refuses it. */
127
- export type MergeFailure = "conflict" | "tests_failed" | "merge_failed";
128
- /** A test the gate named as failing, and what it said, as far as the runner printed. */
129
- export interface FailedTest {
130
- name: string;
131
- message: string;
132
- }
133
- /** One time `merge` turned a task away, and what it said of why. */
134
- export interface GateFailure {
135
- reason: MergeFailure | "budget_exhausted";
136
- at: string;
137
- /** The files the rebase conflicted in, for a conflict. */
138
- files?: string[];
139
- /** What git said, for a conflict that named no file: why the rebase failed. */
140
- output?: string;
141
- /** The tests the gate named as failing, for `tests_failed`. */
142
- tests?: string[];
143
- /** Those tests with what each said, for `tests_failed`. Absent in old records. */
144
- failures?: FailedTest[];
145
- /** What git said, for `merge_failed`. */
146
- error?: string;
147
- }
148
- export interface TaskState {
149
- task: string;
150
- branch: string;
151
- worktree: string;
152
- /** The branch this task lands on. Absent in old records: trunk. */
153
- base?: string;
154
- status: RecordStatus;
155
- lease: LeaseState | null;
156
- mergeAttempts: number;
157
- /**
158
- * Every merge that failed, which `retry` leaves alone while it hands back
159
- * the attempts. Absent in old records: none counted yet.
160
- */
161
- mergeFailures?: number;
162
- /** `mergeFailures` by why each failed. Absent in old records. */
163
- mergeFailuresBy?: Partial<Record<MergeFailure, number>>;
164
- /**
165
- * Each time the gate turned it away, oldest first, with what it named:
166
- * every failed merge, and each refusal once its attempts ran out. Absent in
167
- * old records.
168
- */
169
- gateFailures?: GateFailure[];
170
- /** How many times `splates retry` granted it more attempts. Absent in old records. */
171
- retries?: number;
172
- createdAt: string;
173
- updatedAt: string;
174
- escalations?: Escalation[];
175
- /**
176
- * The agent `splates add --agent` or `splates handoff` handed the task to, for
177
- * `splates server` to start.
178
- */
179
- dispatch?: Dispatched;
180
- /**
181
- * The `splates server` conversation whose agent added the task, which the page
182
- * nests it under. Absent for one added outside a conversation, or before
183
- * tasks remembered it.
184
- */
185
- caller?: string;
186
- }
187
- /**
188
- * Who `splates add --agent` or `splates handoff` handed a task to. `splates server` starts the agent in
189
- * the task's tree and writes down the conversation it started, so it starts
190
- * once.
191
- */
192
- export interface Dispatched {
193
- agent: string;
194
- /** The model to pick, by the session's model setting; absent, the agent's own. */
195
- model?: string;
196
- /** What the agent is told beyond claiming the task. */
197
- prompt?: string;
198
- /** The conversation `splates server` started, once it has. */
199
- conversation?: string;
200
- /**
201
- * Set while the postCheckout hook readies the tree; `splates server` starts the
202
- * agent once it clears.
203
- */
204
- pending?: true;
205
- /**
206
- * Set when the agent at work on the task handed it on with `splates
207
- * handoff`, so the one started is told `[SPLATES HANDOFF <task>]`.
208
- */
209
- handoff?: true;
210
- /**
211
- * Whether the agent started answers to the task's caller rather than the
212
- * person, as for `splates handoff --relay`. Absent in records written
213
- * before it was kept, when a handoff with a caller always relayed.
214
- */
215
- relay?: boolean;
216
- }
217
- /**
218
- * Everything a name can turn out to be. The record's own status when the
219
- * task is intact, and otherwise the way in which it is not.
220
- */
221
- export type WorktreeStatus = RecordStatus | "absent" | "removed" | "orphaned" | "stray" | "unrecorded" | "unknown";
222
- /** What the service found on disk. */
223
- export interface WorktreeSnapshot {
224
- task: string;
225
- branch: string;
226
- path: string;
227
- state: TaskState | null;
228
- exists: boolean;
229
- hasBranch: boolean;
230
- removedAt: string | null;
231
- corrupt: boolean;
232
- }