@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
@@ -0,0 +1,209 @@
1
+ import type { Resource } from "webappwiz/disposable";
2
+ import { type Eventful } from "webappwiz/events";
3
+ import type { Agent, ProcessHandle } from "./agent-process.js";
4
+ import { Artifacts } from "./artifacts.js";
5
+ import type { ConversationDeps, ConversationEvents, ConversationHost } from "./conversation-host.js";
6
+ import { ConversationLog } from "./conversation-log.js";
7
+ import { type Answer, type Attached, type ConversationState, type Device, type Limit, type Upload } from "./conversation-state.js";
8
+ import { type PromptOptions } from "./conversation-turns.js";
9
+ /**
10
+ * One conversation with one agent. Live, it holds the agent's process; read
11
+ * back from its log, it is what was said, and resumes on the next prompt.
12
+ */
13
+ export declare class Conversation implements Eventful<ConversationEvents>, Resource, ConversationHost {
14
+ readonly state: ConversationState;
15
+ readonly log: ConversationLog;
16
+ private readonly deps;
17
+ /** What to run to resume it; null when its agent is no longer known. */
18
+ readonly agent: Agent | null;
19
+ /** Where it runs; null for a log too old to say. */
20
+ private dir;
21
+ private readonly dispatcher;
22
+ readonly events: import("webappwiz/events").Events<ConversationEvents>;
23
+ private readonly files;
24
+ /** The files its agent kept as its outputs, read and changed here. */
25
+ readonly artifacts: Artifacts;
26
+ private readonly connection;
27
+ private readonly turns;
28
+ private readonly background;
29
+ /** Under way while the agent starts or comes back, for a prompt to wait on. */
30
+ opening: Promise<void> | null;
31
+ /** Stops the agent once it has sat idle `IDLE_STOP`; null while it works. */
32
+ private resting;
33
+ /** Let go of its process for a restart: nothing here ends it now. */
34
+ private detached;
35
+ private constructor();
36
+ /**
37
+ * A conversation as its log at `path` left it: stopped, whatever it was
38
+ * doing, unless its agent still runs on a worker, which the launcher
39
+ * takes back, and the conversation carries on where the log leaves off.
40
+ */
41
+ static read(path: string, agents: Agent[], deps: ConversationDeps): Promise<Conversation | null>;
42
+ /** Starts `agent` in `cwd` and opens a session with it. */
43
+ static start({ settings, model, ...opening }: Opening & {
44
+ /** Values to set, by setting id, once the session offers them. */
45
+ settings?: Record<string, string>;
46
+ /**
47
+ * The model to pick, by its value or name in the session's model
48
+ * setting, over what `settings` says. An unavailable choice fails.
49
+ */
50
+ model?: string;
51
+ }, deps: ConversationDeps): Promise<Conversation>;
52
+ /**
53
+ * Brings in `session`, one `agent` holds outside splates, such as from its
54
+ * CLI: loads it in `cwd`, writing what the agent replays of it to a new
55
+ * log, from which it resumes like any other.
56
+ */
57
+ static bring({ session, title, ...opening }: Opening & {
58
+ session: string;
59
+ /** What the agent listed it as, until the replay says otherwise. */
60
+ title: string | null;
61
+ }, deps: ConversationDeps): Promise<Conversation>;
62
+ /** A new conversation with `agent` in `cwd`, its log begun, not yet opened. */
63
+ private static begin;
64
+ get id(): string;
65
+ /** The agent's pid while it runs, for the commands it left running. */
66
+ get pid(): number | null;
67
+ /**
68
+ * The handle for reattaching after a coordinator restart, or null when
69
+ * this process cannot survive a restart.
70
+ */
71
+ get handle(): ProcessHandle | null;
72
+ /** The agent's session, once it has opened one. */
73
+ get sessionId(): string | null;
74
+ /** Where it runs; null for a log too old to say. */
75
+ get cwd(): string | null;
76
+ /**
77
+ * When it was archived, or when it started for a log too old to say; null
78
+ * while it is not archived.
79
+ */
80
+ get archivedSince(): string | null;
81
+ /** Whether a checkpoint has ended and nothing has been said since. */
82
+ get stoppedByCheckpoint(): boolean;
83
+ now(): string;
84
+ /** Says `text` to the agent, with `files` (see `ConversationTurns`). */
85
+ prompt(text: string, files?: Upload[], from?: Device, opts?: PromptOptions): Promise<void>;
86
+ /** Takes back the `index`th queued message, answering with its words and files. */
87
+ unqueue(index: number): {
88
+ text: string;
89
+ files: Attached[];
90
+ };
91
+ /** Sends what is queued now, stopping the running turn first. */
92
+ sendNow(): Promise<void>;
93
+ /** Stops the agent's turn for the person, and stays open for the next. */
94
+ cancel(): Promise<void>;
95
+ /** Asks the agent to bring its `SPLATES.md` up to date and stop (see `ConversationTurns`). */
96
+ checkpoint(merging: boolean): Promise<void>;
97
+ /**
98
+ * Checkpoints the agent for the person, as `checkpoint` does, and leaves
99
+ * it stopped there: nothing resumes a pause, and Power leaves it alone.
100
+ */
101
+ pause(merging: boolean): Promise<void>;
102
+ /** Forgets the checkpoint, done or not, so the next starts afresh. */
103
+ dismissCheckpoint(): void;
104
+ /** Settles once the checkpoint asked is no longer under way. */
105
+ answered(): Promise<void>;
106
+ /** Settles the agent's pending ask, if `id` is still the one it is on. */
107
+ answer(id: string, answer: Answer): void;
108
+ /** The file `name` the person sent, or null when they sent none by that name. */
109
+ attachment(name: string): Promise<{
110
+ bytes: Uint8Array;
111
+ mimeType: string;
112
+ } | null>;
113
+ /** Keeps the plan's windows in `limits`, asked of the agent's maker. */
114
+ hear(limits: Limit[]): void;
115
+ /** Stops background command `id`, leaving the agent's turn as it is. */
116
+ stopBackground(id: string): Promise<void>;
117
+ /** What background command `id` has printed, then more as it prints it. */
118
+ backgroundOutput(id: string): ReadableStream<Uint8Array>;
119
+ /**
120
+ * Sets the session's setting `id` to `value`, one the agent offers: at once
121
+ * while the agent runs, or, while it is stopped, when it next resumes.
122
+ */
123
+ choose(id: string, value: string): Promise<void>;
124
+ /**
125
+ * Brings a stopped conversation back: a new process, the same session, or
126
+ * a new one when its agent died before opening one.
127
+ */
128
+ resume(): Promise<void>;
129
+ /**
130
+ * Follows the agent into a task's worktree, or back to the main tree: a
131
+ * running session keeps the directory it opened in, and the agent works by
132
+ * absolute path; a resumed one opens in the new.
133
+ */
134
+ move(task: string | null, cwd: string, base?: string | null, caller?: string | null): void;
135
+ /** Stops the agent; the next prompt resumes where it left off. */
136
+ stop(): Promise<void>;
137
+ /**
138
+ * Lets go of the agent's process without ending it, for a coordinator
139
+ * started again to take back from the worker: its log, flushed, says
140
+ * where it stopped. Answers whether there was one to let go of; a
141
+ * conversation with none, or one nothing could take back, stops as ever.
142
+ */
143
+ detach(): Promise<boolean>;
144
+ /**
145
+ * Stops it and puts it away, off the list of conversations; `with`, the
146
+ * conversation whose archiving takes it along, which brings it back.
147
+ * Its artifacts keep only what their panel shows.
148
+ */
149
+ archive(withConversation?: string): Promise<void>;
150
+ /** Names it `name` over the agent's title; blank goes back to the title. */
151
+ rename(name: string): Promise<void>;
152
+ /** Back on the list, stopped until the next prompt. */
153
+ unarchive(): Promise<void>;
154
+ /** Keeps it atop the list, or lets it go back among the rest. */
155
+ pin(pinned: boolean): Promise<void>;
156
+ /**
157
+ * Nests it in the list under the conversation `id`, or at the top for
158
+ * null, over where its task would, cutting it loose from the conversation
159
+ * that started it or added its task: that one no longer tells it, hears
160
+ * from it, or archives it along. Never for a subagent, which stays with
161
+ * the one it answers to.
162
+ */
163
+ reparent(id: string | null): Promise<void>;
164
+ /** Settles once everything said so far is in its log, for a reader of the file. */
165
+ saved(): Promise<void>;
166
+ /** Marks it seen, or unseen again for the person to come back to. */
167
+ markUnread(unread: boolean): Promise<void>;
168
+ /** Stops it and deletes its log and files, for good. */
169
+ delete(): Promise<void>;
170
+ dispose(): void;
171
+ /** Marks it `unread` or not, keeping how much was seen when it was read. */
172
+ flag(unread: boolean): void;
173
+ /** Back to idle once a turn ends, then on to what was queued meanwhile. */
174
+ ended(error: string | null): void;
175
+ /** Ends the agent's process, with `error` for one that failed, and keeps that it stopped. */
176
+ close(error: string | null): Promise<void>;
177
+ set(next: Partial<ConversationState>): void;
178
+ changed(): void;
179
+ /**
180
+ * Stops an agent left idle `IDLE_STOP`, with no command running in the background,
181
+ * no question open and no checkpoint, so its process exits and takes what
182
+ * it started along, MCP servers and browsers included. The next prompt
183
+ * resumes the same session.
184
+ */
185
+ private rest;
186
+ /** Opens the agent in `cwd`, clearing `opening` once it has or failed to. */
187
+ private wake;
188
+ }
189
+ /** What a conversation is opened with, started afresh or brought in. */
190
+ interface Opening {
191
+ id: string;
192
+ agent: Agent;
193
+ task: string | null;
194
+ /** The branch `task` was cut from. */
195
+ base?: string | null;
196
+ /** The conversation whose agent added `task`. */
197
+ caller?: string | null;
198
+ cwd: string;
199
+ log: string;
200
+ /** Started on what a todo or `splates add --agent` assigned. */
201
+ assigned?: boolean;
202
+ /** The conversation that handed it its task, which it answers to. */
203
+ handedBy?: string | null;
204
+ /** The lane orchestrator that handed it its task, which hears when it stops. */
205
+ startedBy?: string | null;
206
+ /** The project's splates skill version as it starts; null when it has none. */
207
+ skill?: string | null;
208
+ }
209
+ export {};
@@ -0,0 +1,140 @@
1
+ import type { ConversationsOptions } from "./conversation-options.js";
2
+ export type { ConversationsOptions } from "./conversation-options.js";
3
+ import type { Resource } from "webappwiz/disposable";
4
+ import { type Eventful } from "webappwiz/events";
5
+ import { type Agent, type Session } from "./agent-process.js";
6
+ import { Conversation } from "./conversation.js";
7
+ import type { ConversationsEvents } from "./conversation-host.js";
8
+ import type { Limit, Setting } from "./conversation-state.js";
9
+ /** How many archived conversations are kept; older archived ones are deleted. */
10
+ export declare const ARCHIVED_KEPT = 200;
11
+ /**
12
+ * Every conversation in the repo: the live ones this process started, and
13
+ * the stopped ones read back from their logs, one JSON-lines file each under
14
+ * `.git/splates/conversations`.
15
+ */
16
+ export declare class Conversations implements Eventful<ConversationsEvents>, Resource {
17
+ readonly dir: string;
18
+ readonly agents: Agent[];
19
+ private readonly dispatcher;
20
+ readonly events: import("webappwiz/events").Events<ConversationsEvents>;
21
+ private readonly known;
22
+ private readonly fs;
23
+ private readonly ids;
24
+ private readonly launcher;
25
+ private readonly machine;
26
+ private readonly starting;
27
+ private readonly timer;
28
+ private readonly clock;
29
+ private readonly watch;
30
+ private readonly offered;
31
+ private readonly limited;
32
+ private readonly adherence;
33
+ private readonly outcomes;
34
+ private readonly readLimits;
35
+ private readonly root;
36
+ private readonly projects;
37
+ private readonly servers;
38
+ private readonly artifacts;
39
+ /** What every conversation's artifacts make room through, across the project. */
40
+ private readonly room;
41
+ /** The read of the records on disk, shared by every caller until it settles. */
42
+ private loaded;
43
+ /** The last deletion of archived conversations past `ARCHIVED_KEPT`, so they run one at a time. */
44
+ private pruning;
45
+ /** When each agent's limits were last asked for, by its id, in epoch ms. */
46
+ private readonly asked;
47
+ /** Where `splates server` answers, once it does, for the agents' CLI. */
48
+ url: string | null;
49
+ /** New starts use the refreshed roster; existing conversations retain their snapshot. */
50
+ refreshRoster(agents: Agent[]): void;
51
+ constructor(dir: string, agents: Agent[], opts?: ConversationsOptions);
52
+ /** What each conversation is made with. */
53
+ private get deps();
54
+ /**
55
+ * What each agent's sessions last offered, from any project, by its id:
56
+ * what a first conversation with one shows before it starts.
57
+ */
58
+ settings(): Promise<Record<string, Setting[]>>;
59
+ /**
60
+ * Each agent's plan limits as it last said, from any project, by its id:
61
+ * what a new conversation shows before one here says.
62
+ */
63
+ limits(): Promise<Record<string, Limit[]>>;
64
+ /**
65
+ * Asks each agent that does not send its limits for them, unless it was
66
+ * asked within `LIMITS_FRESH`, and keeps what it says for every project.
67
+ */
68
+ refreshLimits(): Promise<void>;
69
+ /** Every conversation, newest first. */
70
+ list(): Promise<Conversation[]>;
71
+ find(id: string): Promise<Conversation>;
72
+ /**
73
+ * Starts a conversation with `agent` in `cwd`, for `task` if it is one's,
74
+ * with `settings` set once the session offers them.
75
+ */
76
+ start(agent: string, { task, base, caller, cwd, settings, model, assigned, handedBy, startedBy, }: {
77
+ task: string | null;
78
+ /** The branch `task` was cut from. */
79
+ base?: string | null;
80
+ /** The conversation whose agent added `task`. */
81
+ caller?: string | null;
82
+ cwd: string;
83
+ settings?: Record<string, string>;
84
+ /** The model to start on, by its value or name in the model setting. */
85
+ model?: string;
86
+ /** Whether a todo or `splates add --agent` assigned the agent and model. */
87
+ assigned?: boolean;
88
+ /** The conversation that handed it its task, which it answers to. */
89
+ handedBy?: string | null;
90
+ /** The lane orchestrator that handed it its task, which hears when it stops. */
91
+ startedBy?: string | null;
92
+ }): Promise<Conversation>;
93
+ /**
94
+ * The sessions each agent holds in `cwd` that splates does not, such as ones
95
+ * started in its CLI, to bring in: newest first, from every agent that
96
+ * lists and loads sessions.
97
+ */
98
+ sessions(cwd: string): Promise<Session[]>;
99
+ /**
100
+ * Brings in `session`, one `agent` holds outside splates, as a conversation
101
+ * in `cwd`, for `task` if it is one's.
102
+ */
103
+ bring(agent: string, session: string, { task, base, caller, cwd, title, }: {
104
+ task: string | null;
105
+ /** The branch `task` was cut from. */
106
+ base?: string | null;
107
+ /** The conversation whose agent added `task`. */
108
+ caller?: string | null;
109
+ cwd: string;
110
+ title?: string | null;
111
+ }): Promise<Conversation>;
112
+ /**
113
+ * Deletes the archived conversations past the `ARCHIVED_KEPT` archived
114
+ * most recently, so their logs do not pile up, their artifacts and
115
+ * attached files going with them.
116
+ */
117
+ prune(): Promise<void>;
118
+ /** Stops every live conversation, so no agent outlives the server. */
119
+ disposeAsync(): Promise<void>;
120
+ /**
121
+ * Lets go of every agent a worker runs, for a coordinator started again
122
+ * to take back, and says whether there was any: the rest stop as ever.
123
+ */
124
+ detachAsync(): Promise<boolean>;
125
+ dispose(): void;
126
+ private track;
127
+ /** Asks for `conversation`'s agent's limits, when it does not send them. */
128
+ private askLimits;
129
+ private load;
130
+ private trim;
131
+ private read;
132
+ }
133
+ export type { Agent, AgentProcess, Launch, Launcher, Session, } from "./agent-process.js";
134
+ export { launch } from "./agent-process.js";
135
+ export type { Artifact, ArtifactGone, ArtifactVersion, } from "./artifacts.js";
136
+ export { Conversation } from "./conversation.js";
137
+ export type { ConversationEvents, ConversationsEvents, } from "./conversation-host.js";
138
+ export type { After, Answer, Ask, Attached, Background, BackgroundState, Checkpoint, Command, Compaction, ConversationState, Decision, Device, Edit, Field, Image, Limit, Message, Part, Setting, Status, Step, Taking, Tool, Upload, Usage, } from "./conversation-state.js";
139
+ export { DEVICES, FROM_HEADER, unused } from "./conversation-state.js";
140
+ export { fold, heard } from "./fold.js";
@@ -0,0 +1,28 @@
1
+ import type { Fs } from "webappwiz/system";
2
+ import type { KeptShell } from "./dev-shell.js";
3
+ /**
4
+ * What one `splates server` keeps across its own restarts, in
5
+ * `~/.splates/coordinator.json`: the session id its workers know it by, so a
6
+ * worker finds the next run unchanged and keeps every agent it runs for it,
7
+ * and the roots of the projects whose agents it let go of at its last
8
+ * restart, for the next run to serve before the worker joins and take them
9
+ * back, and the shells it let go of, for the next run to take back too.
10
+ */
11
+ export declare class CoordinatorState {
12
+ readonly path: string;
13
+ private readonly fs;
14
+ /** What this coordinator's worker sessions answer as, the same across restarts. */
15
+ readonly session: string;
16
+ /** The projects with agents on the worker at the last restart; none after a fresh start. */
17
+ readonly roots: string[];
18
+ /** The pages' shells on the worker at the last restart, by key. */
19
+ readonly terminals: KeptShell[];
20
+ private constructor();
21
+ /**
22
+ * Reads what the last run kept at `path`, or starts afresh with a session
23
+ * of its own, written there so the next run answers as the same.
24
+ */
25
+ static open(path: string, fs: Fs): Promise<CoordinatorState>;
26
+ /** Keeps `roots` as the projects whose agents, and `terminals` as the shells, the next run takes back. */
27
+ write(roots: string[], terminals: KeptShell[]): Promise<void>;
28
+ }
package/creds.d.ts ADDED
@@ -0,0 +1,123 @@
1
+ import { Credentials, type SecretStore } from "webappwiz/creds";
2
+ import { type Fs, type Lock } from "webappwiz/system";
3
+ import { Duration } from "webappwiz/time";
4
+ import { z } from "zod";
5
+ /** Where a cred is kept: for this project alone, or every project on this device. */
6
+ export declare const SCOPES: readonly ["project", "device"];
7
+ export type Scope = (typeof SCOPES)[number];
8
+ /** How long `wait` gives a request before handing the wait back to its caller. */
9
+ export declare const DEFAULT_TIMEOUT: Duration;
10
+ /** The two stores a cred can be kept in, the system's unless a test says otherwise. */
11
+ export interface SecretStores {
12
+ /** The store of the project whose main tree is at `root`. */
13
+ project(root: string): Promise<SecretStore>;
14
+ device: SecretStore;
15
+ }
16
+ /** The operating system's own stores, shared with `wiz creds`. */
17
+ export declare const SYSTEM_STORES: SecretStores;
18
+ declare const REQUEST: z.ZodObject<{
19
+ name: z.ZodString;
20
+ scope: z.ZodEnum<{
21
+ device: "device";
22
+ project: "project";
23
+ }>;
24
+ purpose: z.ZodDefault<z.ZodString>;
25
+ instructions: z.ZodString;
26
+ task: z.ZodNullable<z.ZodString>;
27
+ status: z.ZodEnum<{
28
+ dismissed: "dismissed";
29
+ open: "open";
30
+ saved: "saved";
31
+ }>;
32
+ requestedAt: z.ZodString;
33
+ }, z.core.$strip>;
34
+ /** A cred an agent asked a person for, with what for and how to get it. */
35
+ export type CredRequest = z.infer<typeof REQUEST>;
36
+ /** A cred a store keeps, by name; never its value. */
37
+ export interface KeptCred {
38
+ name: string;
39
+ scope: Scope;
40
+ /** The tool that saved it, when one said so; null when a person did. */
41
+ savedBy: string | null;
42
+ }
43
+ /**
44
+ * A project's creds: the requests agents make for them, which `splates server`
45
+ * shows on its Creds page for a person to fill, and the two stores they are
46
+ * kept in, the project's and the device's, as `wiz creds` keeps them. A value
47
+ * goes into a store and never comes out through here but to code reading it
48
+ * through `credentials`, so no agent, page or log ever holds it.
49
+ */
50
+ export declare class Creds {
51
+ #private;
52
+ /** The record of requests, `.git/splates/creds.json`. */
53
+ readonly file: string;
54
+ /** Held while the record is read and written back. */
55
+ private readonly lock;
56
+ private readonly stores;
57
+ constructor(
58
+ /** The record of requests, `.git/splates/creds.json`. */
59
+ file: string,
60
+ /** Held while the record is read and written back. */
61
+ lock: Lock, stores: Record<Scope, SecretStore>, opts?: {
62
+ fs?: Fs;
63
+ });
64
+ /** The project's creds, kept in `stores`. */
65
+ static open(splatesDir: string, root: string, lock: Lock, stores: SecretStores, opts?: {
66
+ fs?: Fs;
67
+ }): Promise<Creds>;
68
+ /**
69
+ * Where code reads a cred's value: the project's store, then the device's.
70
+ * Never the environment, so a stray export is not what splates reads.
71
+ */
72
+ get credentials(): Credentials;
73
+ /** Every request, open or not, the latest first. */
74
+ requests(): Promise<CredRequest[]>;
75
+ /**
76
+ * Asks a person for `name`, saying what for, kept in `scope`'s store once they save it.
77
+ * Asks nothing, returning null, when that store already keeps it, unless
78
+ * `replace` says the value kept there does not work, and then a purpose or
79
+ * instructions left off are those of the last request for `name`.
80
+ */
81
+ request(name: string, { scope, purpose, instructions, task, replace, }: {
82
+ scope: Scope;
83
+ purpose: string;
84
+ instructions: string;
85
+ task: string | null;
86
+ replace?: boolean;
87
+ }): Promise<CredRequest | null>;
88
+ /**
89
+ * Blocks until a person fills or dismisses the request for `name`,
90
+ * returning what became of it; gives up with `timeout`.
91
+ */
92
+ wait(name: string, { timeout, poll, }?: {
93
+ timeout?: Duration;
94
+ poll?: Duration;
95
+ }): Promise<"saved" | "dismissed">;
96
+ /**
97
+ * Keeps `value` as `name`, filling its request if one is open, in the
98
+ * request's scope, else in `scope`. `by` names the tool saving it, for
99
+ * the page to say; a person's own save says nothing.
100
+ */
101
+ save(name: string, value: string, { scope, by }?: {
102
+ scope?: Scope;
103
+ by?: string | null;
104
+ }): Promise<Scope>;
105
+ /** Turns down the open request for `name`, so its agent stops waiting. */
106
+ dismiss(name: string): Promise<void>;
107
+ /** Deletes `name` from `scope`'s store; whether there was one. */
108
+ remove(name: string, scope: Scope): Promise<boolean>;
109
+ /**
110
+ * Copies each cred kept under arbor's `ARBOR_*` name to its `SPLATES_*`
111
+ * one in the same store, unless that is kept already. The old one stays,
112
+ * for an arbor still running, and any record naming it, to read.
113
+ */
114
+ copyLegacy(): Promise<void>;
115
+ /** Every cred either store keeps, the project's first, by name. */
116
+ kept(): Promise<KeptCred[]>;
117
+ /** What a person calls `scope`'s store, as in "the macOS Keychain". */
118
+ label(scope: Scope): string;
119
+ private has;
120
+ private read;
121
+ private change;
122
+ }
123
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The hottest CPU die sensor on an Apple Silicon Mac, in °C, or null when
3
+ * none answers. macOS has no public API for these, and `powermetrics` needs
4
+ * sudo, so this asks IOKit's private HID event system the way macmon and
5
+ * Stats do, which any user may.
6
+ */
7
+ export declare function darwinTemperature(): number | null;
package/decided.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ import type { Outcome } from "./outcomes.js";
2
+ import type { Decision } from "./plan.js";
3
+ /**
4
+ * Who made `decision`: the person, for one put to them or an assumption
5
+ * they challenged, which took their attention either way; otherwise the
6
+ * agent, whose assumption stood without them.
7
+ */
8
+ export declare function whose(decision: Pick<Decision, "how" | "ended">): "decidedByYou" | "decidedByAgents";
9
+ /** How many calls in `outcome` `who` made. */
10
+ export declare function madeBy(outcome: Outcome, who: ReturnType<typeof whose>): number;
11
+ /**
12
+ * The calls `outcome` made, each with how many it stands for: its own
13
+ * decisions one each, or for a line from before they were kept, its counts
14
+ * read back as unsized calls.
15
+ */
16
+ export declare function decided(outcome: Outcome): [Pick<Decision, "size" | "how" | "ended">, number][];
17
+ /** Whether `outcome` kept its calls at all: lines from before any were kept say nothing of them. */
18
+ export declare function keptDecisions(outcome: Outcome): boolean;
package/demo.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Something to try, as the skill writes it under `### 🎬 Demo: <title>`:
3
+ * where, then numbered steps.
4
+ */
5
+ export interface Demo {
6
+ /** What it shows, from its heading; null when the heading says none. */
7
+ title: string | null;
8
+ /** Where to try it and anything said before the steps, as markdown. */
9
+ intro: string;
10
+ steps: Step[];
11
+ }
12
+ /** A step of a demo: what to do, on its line, and what to see, under it. */
13
+ export interface Step {
14
+ number: string;
15
+ action: string;
16
+ /** What should happen, screenshots included, as markdown. */
17
+ expect: string;
18
+ }
19
+ /**
20
+ * The demo titled at `start`: what it says up to its steps, or to `until`,
21
+ * where something else begins, then its steps, and the line after them; null
22
+ * for any other line.
23
+ */
24
+ export declare function demoAt(lines: string[], start: number, until: number): {
25
+ demo: Demo;
26
+ end: number;
27
+ } | null;
28
+ /** Whether `line` titles a demo. */
29
+ export declare function isDemoTitle(line: string): boolean;