@stringsync/splates 0.0.0-stage → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +308 -2
- package/acp-extensions.d.ts +82 -0
- package/add.d.ts +53 -0
- package/adherence.d.ts +49 -0
- package/age.d.ts +2 -0
- package/agent-connection.d.ts +171 -0
- package/agent-errors.d.ts +2 -0
- package/agent-process.d.ts +65 -0
- package/agent-stream.d.ts +91 -0
- package/agents.d.ts +15 -0
- package/artifact-room.d.ts +47 -0
- package/artifact-viewers.d.ts +6 -0
- package/artifact.d.ts +30 -0
- package/artifacts.d.ts +161 -0
- package/asked.d.ts +146 -0
- package/asked.js +7 -0
- package/assumed.d.ts +34 -0
- package/attach.d.ts +30 -0
- package/attachments.d.ts +43 -0
- package/baselines.d.ts +55 -0
- package/claim.d.ts +17 -0
- package/cloudflare-api.d.ts +25 -0
- package/cloudflare-error.d.ts +5 -0
- package/cloudflared-tunnel-provider.d.ts +27 -0
- package/codex-limits.d.ts +19 -0
- package/compaction.d.ts +17 -0
- package/config-source.d.ts +13 -0
- package/config.d.ts +98 -0
- package/config.js +7 -0
- package/conversation-archive.d.ts +6 -0
- package/conversation-background.d.ts +21 -0
- package/conversation-choice.d.ts +4 -0
- package/conversation-files.d.ts +51 -0
- package/conversation-given.d.ts +8 -0
- package/conversation-host.d.ts +102 -0
- package/conversation-listing.d.ts +15 -0
- package/conversation-log.d.ts +301 -0
- package/conversation-messages.d.ts +18 -0
- package/conversation-name.d.ts +28 -0
- package/conversation-options.d.ts +73 -0
- package/conversation-reference.d.ts +2 -0
- package/conversation-state.d.ts +472 -0
- package/conversation-turns.d.ts +115 -0
- package/conversation.d.ts +209 -0
- package/conversations.d.ts +140 -0
- package/coordinator-state.d.ts +28 -0
- package/creds.d.ts +123 -0
- package/darwin-temperature.d.ts +7 -0
- package/decided.d.ts +18 -0
- package/demo.d.ts +29 -0
- package/dev/api.d.ts +209 -0
- package/dev/assets.d.ts +24 -0
- package/dev/conversation-address.d.ts +47 -0
- package/dev/conversation-feed.d.ts +166 -0
- package/dev/live-stream.d.ts +29 -0
- package/dev/worker.d.ts +33 -0
- package/dev-access.d.ts +61 -0
- package/dev-artifacts.d.ts +22 -0
- package/dev-budgets.d.ts +18 -0
- package/dev-conversation-events.d.ts +39 -0
- package/dev-conversation-routes.d.ts +90 -0
- package/dev-creds.d.ts +17 -0
- package/dev-dictation-connection.d.ts +18 -0
- package/dev-dictation.d.ts +17 -0
- package/dev-http.d.ts +76 -0
- package/dev-open.d.ts +15 -0
- package/dev-options.d.ts +133 -0
- package/dev-outcomes.d.ts +21 -0
- package/dev-pages.d.ts +16 -0
- package/dev-picker.d.ts +57 -0
- package/dev-port-socket.d.ts +26 -0
- package/dev-ports.d.ts +11 -0
- package/dev-project-watch.d.ts +44 -0
- package/dev-project.d.ts +168 -0
- package/dev-push.d.ts +59 -0
- package/dev-restart.d.ts +141 -0
- package/dev-servers.d.ts +30 -0
- package/dev-setup-native.d.ts +23 -0
- package/dev-setup-opencode.d.ts +29 -0
- package/dev-setup.d.ts +16 -0
- package/dev-shell.d.ts +70 -0
- package/dev-slot.d.ts +28 -0
- package/dev-sockets.d.ts +13 -0
- package/dev-task-ports.d.ts +73 -0
- package/dev-tasks.d.ts +20 -0
- package/dev-terminal-connection.d.ts +19 -0
- package/dev-terminal.d.ts +42 -0
- package/dev-todos.d.ts +35 -0
- package/dev-transcriber.d.ts +15 -0
- package/dev-tunnel.d.ts +38 -0
- package/dev-versions.d.ts +53 -0
- package/dev-workers.d.ts +55 -0
- package/dev.d.ts +24 -0
- package/diff.d.ts +29 -0
- package/dispatched.d.ts +16 -0
- package/editors.d.ts +22 -0
- package/escalate.d.ts +27 -0
- package/events.d.ts +311 -0
- package/everywhere.d.ts +41 -0
- package/exhibit.d.ts +21 -0
- package/exit.d.ts +54 -0
- package/fact-todos.d.ts +18 -0
- package/fake-agent.d.ts +107 -0
- package/fake-agent.js +284 -0
- package/finding-facts.d.ts +38 -0
- package/findings.d.ts +84 -0
- package/fold.d.ts +43 -0
- package/follow.d.ts +41 -0
- package/format.d.ts +68 -0
- package/git.d.ts +112 -0
- package/handed-out.d.ts +79 -0
- package/handoff.d.ts +23 -0
- package/heavy-run.d.ts +12 -0
- package/heavy.d.ts +28 -0
- package/heavy.js +16 -0
- package/held.d.ts +22 -0
- package/index-0tfvy823.js +272 -0
- package/index-43pq33n4.js +157 -0
- package/index-4776671w.js +698 -0
- package/index-d4hjrzaq.js +464 -0
- package/index-gcfq7awr.js +740 -0
- package/index-k73tsw5g.js +101 -0
- package/index-kaa44k7q.js +59 -0
- package/index-vcv9m93e.js +1265 -0
- package/index-xmfmy729.js +249 -0
- package/index.d.ts +2 -0
- package/index.js +26928 -0
- package/init.d.ts +28 -0
- package/journal.d.ts +57 -0
- package/landed.d.ts +14 -0
- package/lane-todos.d.ts +44 -0
- package/lane.d.ts +55 -0
- package/lanes-from-tags.d.ts +17 -0
- package/lanes.d.ts +96 -0
- package/legacy-names.d.ts +70 -0
- package/legacy-ps.d.ts +31 -0
- package/limits.d.ts +32 -0
- package/list.d.ts +18 -0
- package/load-config.d.ts +44 -0
- package/log.d.ts +14 -0
- package/machine.d.ts +42 -0
- package/merge.d.ts +35 -0
- package/migrate-config.d.ts +31 -0
- package/models.d.ts +24 -0
- package/needs.d.ts +115 -0
- package/notices.d.ts +39 -0
- package/offered.d.ts +39 -0
- package/opencode-usage.d.ts +37 -0
- package/outcomes.d.ts +114 -0
- package/package.json +74 -5
- package/path.d.ts +13 -0
- package/plan.d.ts +236 -0
- package/port-forward.d.ts +22 -0
- package/port-pipe.d.ts +36 -0
- package/ports-list.d.ts +19 -0
- package/probe-runtime.d.ts +5 -0
- package/probe-runtime.js +13 -0
- package/project-reaches.d.ts +23 -0
- package/projects.d.ts +136 -0
- package/prompts.d.ts +128 -0
- package/pty.d.ts +39 -0
- package/pulse.d.ts +8 -0
- package/recommend.d.ts +31 -0
- package/release.d.ts +41 -0
- package/remote-process.d.ts +26 -0
- package/remote-pty.d.ts +29 -0
- package/remote-worker.d.ts +77 -0
- package/remove.d.ts +31 -0
- package/repository.d.ts +91 -0
- package/retry.d.ts +34 -0
- package/roster.d.ts +63 -0
- package/saved-ports-host.d.ts +25 -0
- package/saved-tunnel.d.ts +44 -0
- package/server-worker-socket.d.ts +21 -0
- package/setup-areas.d.ts +7 -0
- package/setup-opencode-model-error.d.ts +3 -0
- package/setup-opencode-models.d.ts +54 -0
- package/setup-opencode-recipe.d.ts +26 -0
- package/setup-opencode.d.ts +46 -0
- package/setup.d.ts +102 -0
- package/shared-browser.d.ts +50 -0
- package/shell.d.ts +17 -0
- package/show.d.ts +106 -0
- package/skill-checks.d.ts +73 -0
- package/skill-checks.js +10 -0
- package/skills.d.ts +16 -0
- package/slot-tunnel.d.ts +27 -0
- package/slots.d.ts +135 -0
- package/snapshot.d.ts +75 -0
- package/splates-artifact.d.ts +3 -0
- package/splates-creds.d.ts +3 -0
- package/splates-dev.d.ts +22 -0
- package/splates-flags.d.ts +34 -0
- package/splates-lane.d.ts +3 -0
- package/splates-projects.d.ts +3 -0
- package/splates-setup.d.ts +17 -0
- package/splates-slots.d.ts +3 -0
- package/splates-todo.d.ts +3 -0
- package/splates-tunnel.d.ts +3 -0
- package/splates-worker.d.ts +3 -0
- package/splates.d.ts +28 -0
- package/stats.d.ts +186 -0
- package/supervise.d.ts +50 -0
- package/system-changes.d.ts +67 -0
- package/system.d.ts +28 -0
- package/systems.d.ts +119 -0
- package/systems.js +21 -0
- package/table.d.ts +5 -0
- package/task-log.d.ts +35 -0
- package/task-ports.d.ts +25 -0
- package/tell.d.ts +47 -0
- package/todo-edit.d.ts +60 -0
- package/todo-file.d.ts +6 -0
- package/todo-lanes.d.ts +82 -0
- package/todo-list.d.ts +26 -0
- package/todo-take.d.ts +27 -0
- package/todo.d.ts +146 -0
- package/todos.d.ts +157 -0
- package/tool-calls.d.ts +18 -0
- package/tunnel-provider.d.ts +37 -0
- package/tunnel-provider.js +0 -0
- package/tunnel-remove.d.ts +28 -0
- package/tunnel-setup.d.ts +104 -0
- package/unix-worker-listener.d.ts +23 -0
- package/unix-worker-socket.d.ts +30 -0
- package/update.d.ts +29 -0
- package/update.js +10 -0
- package/vocabulary.d.ts +9 -0
- package/wait.d.ts +36 -0
- package/watch.d.ts +46 -0
- package/watched.d.ts +43 -0
- package/websocket-worker-socket.d.ts +18 -0
- package/worker-call-host.d.ts +51 -0
- package/worker-channel.d.ts +83 -0
- package/worker-connection.d.ts +24 -0
- package/worker-daemon.d.ts +64 -0
- package/worker-git.d.ts +18 -0
- package/worker-list.d.ts +49 -0
- package/worker-machine.d.ts +34 -0
- package/worker-port-host.d.ts +21 -0
- package/worker-process-host.d.ts +29 -0
- package/worker-protocol.d.ts +104 -0
- package/worker-pty-host.d.ts +34 -0
- package/worker-registry.d.ts +68 -0
- package/worker-replay.d.ts +25 -0
- package/worker-run.d.ts +20 -0
- package/worker-session.d.ts +189 -0
- package/worker-socket.d.ts +15 -0
- package/worktree-service.d.ts +113 -0
- package/worktree.d.ts +232 -0
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import { Duration } from "webappwiz/time";
|
|
2
|
+
import type { Artifact } from "./artifacts.js";
|
|
3
|
+
import type { Event } from "./events.js";
|
|
4
|
+
import type { OpenCodeUsage } from "./opencode-usage.js";
|
|
5
|
+
import type { Flag } from "./watch.js";
|
|
6
|
+
/** Everything the page shows of one conversation. */
|
|
7
|
+
export interface ConversationState {
|
|
8
|
+
id: string;
|
|
9
|
+
agent: string;
|
|
10
|
+
/** The task whose worktree it runs in; null for the main tree. */
|
|
11
|
+
task: string | null;
|
|
12
|
+
/**
|
|
13
|
+
* The task it runs in, or last ran in once that task merged or went; null
|
|
14
|
+
* until it runs in one.
|
|
15
|
+
*/
|
|
16
|
+
lastTask: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* The branch `lastTask` was cut from, `task/<caller>` for a part, kept once
|
|
19
|
+
* it merges so the page still nests it under its caller; null for none.
|
|
20
|
+
*/
|
|
21
|
+
lastBase: string | null;
|
|
22
|
+
/**
|
|
23
|
+
* The conversation whose agent added `lastTask`, kept once it merges so
|
|
24
|
+
* the page still nests it under that one; null for none.
|
|
25
|
+
*/
|
|
26
|
+
lastCaller: string | null;
|
|
27
|
+
/** What the agent calls it, once it says. */
|
|
28
|
+
title: string | null;
|
|
29
|
+
/** What the person renamed it to, over the agent's title. */
|
|
30
|
+
name: string | null;
|
|
31
|
+
status: Status;
|
|
32
|
+
/** Why it failed, for `failed`. */
|
|
33
|
+
error: string | null;
|
|
34
|
+
/**
|
|
35
|
+
* When splates stopped its agent for sitting idle `IDLE_STOP`; null otherwise,
|
|
36
|
+
* and again once it starts.
|
|
37
|
+
*/
|
|
38
|
+
stoppedIdle: string | null;
|
|
39
|
+
/**
|
|
40
|
+
* When splates next asks it, idle with an agent it handed a task to at
|
|
41
|
+
* work, to check on its agents; null while none is due.
|
|
42
|
+
*/
|
|
43
|
+
heartbeat: string | null;
|
|
44
|
+
messages: Message[];
|
|
45
|
+
/**
|
|
46
|
+
* What splates did at its agent's word, oldest first, read from the journal
|
|
47
|
+
* rather than its log, so the page can show each among its messages.
|
|
48
|
+
*/
|
|
49
|
+
events: Event[];
|
|
50
|
+
ask: Ask | null;
|
|
51
|
+
/** What the session lets the person pick: its mode, model, effort. */
|
|
52
|
+
settings: Setting[];
|
|
53
|
+
/** The skills and commands a message can start with, as the agent last said. */
|
|
54
|
+
commands: Command[];
|
|
55
|
+
createdAt: string;
|
|
56
|
+
/** Put away: stopped, kept off the list, shown with the archived ones. */
|
|
57
|
+
archived: boolean;
|
|
58
|
+
/** When it was archived; null when not archived, or for a log too old to say. */
|
|
59
|
+
archivedAt: string | null;
|
|
60
|
+
/**
|
|
61
|
+
* The conversation whose archiving put this one away with it, which
|
|
62
|
+
* unarchiving that one brings back; null when it was archived alone, or
|
|
63
|
+
* is not archived.
|
|
64
|
+
*/
|
|
65
|
+
archivedWith: string | null;
|
|
66
|
+
/** Kept atop the list, archived or not, until unpinned. */
|
|
67
|
+
pinned: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Where the person nested it in the list, over where its task would:
|
|
70
|
+
* under the conversation `id`, or at the top for a null `id`. Null until
|
|
71
|
+
* they do, while it nests by its task.
|
|
72
|
+
*/
|
|
73
|
+
parent: {
|
|
74
|
+
id: string | null;
|
|
75
|
+
} | null;
|
|
76
|
+
/**
|
|
77
|
+
* The conversation that handed it its task with `splates add --agent`, which
|
|
78
|
+
* it answers to in place of the person: the page writes nothing to it but
|
|
79
|
+
* an answer to what its agent asks permission for, and its terminating.
|
|
80
|
+
* Set when it starts, and kept once the task is gone.
|
|
81
|
+
*/
|
|
82
|
+
handedBy: string | null;
|
|
83
|
+
/**
|
|
84
|
+
* The lane orchestrator that handed it its task with `splates add --agent`:
|
|
85
|
+
* it answers to the person, as any conversation does, and that one only
|
|
86
|
+
* hears when it stops, and may wake, stop or remove it. Set when it
|
|
87
|
+
* starts, and kept once the task is gone.
|
|
88
|
+
*/
|
|
89
|
+
startedBy: string | null;
|
|
90
|
+
/**
|
|
91
|
+
* The `version:` of the project's splates skill as it started, which the
|
|
92
|
+
* Stats page tells adherence apart by; null when it had none, or for a log
|
|
93
|
+
* written before it was kept.
|
|
94
|
+
*/
|
|
95
|
+
skill: string | null;
|
|
96
|
+
/**
|
|
97
|
+
* Started on the agent and model a todo or `splates add --agent` assigned,
|
|
98
|
+
* rather than ones the person picked, so a new conversation does not start
|
|
99
|
+
* where this one left its settings.
|
|
100
|
+
*/
|
|
101
|
+
assigned: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* The agent ended a turn the person has not seen yet: set as each turn
|
|
104
|
+
* ends, and cleared once the page shows it.
|
|
105
|
+
*/
|
|
106
|
+
unread: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* How many of its messages, those not queued, the person had seen when it
|
|
109
|
+
* was last marked read: an unread one opens at the one after.
|
|
110
|
+
*/
|
|
111
|
+
seen: number;
|
|
112
|
+
/**
|
|
113
|
+
* Where the last checkpoint asked stands, kept in the log so a restart
|
|
114
|
+
* still shows it; null when none was, or once the work went on past it.
|
|
115
|
+
*/
|
|
116
|
+
checkpoint: Checkpoint | null;
|
|
117
|
+
/**
|
|
118
|
+
* Whether the checkpoint asked is the person's pause, which Power leaves
|
|
119
|
+
* alone and nothing resumes: forgotten once it ends.
|
|
120
|
+
*/
|
|
121
|
+
pausing: boolean;
|
|
122
|
+
/** What a message said now would do, so the page places it as the server will. */
|
|
123
|
+
taking: Taking;
|
|
124
|
+
usage: Usage;
|
|
125
|
+
/** The commands the agent left in the background, oldest first. */
|
|
126
|
+
background: Background[];
|
|
127
|
+
/** The files its agent kept as its outputs, in the order first added, removed ones too. */
|
|
128
|
+
artifacts: Artifact[];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Where the agent is: `stopped` and `failed` have no process, and the next
|
|
132
|
+
* prompt resumes the session in a new one.
|
|
133
|
+
*/
|
|
134
|
+
export type Status = "starting" | "idle" | "running" | "stopped" | "failed";
|
|
135
|
+
/**
|
|
136
|
+
* What a message said to a conversation would do: `start` a turn of its own,
|
|
137
|
+
* `steer` into the running turn, or `queue` for the turn's end.
|
|
138
|
+
*/
|
|
139
|
+
export type Taking = "start" | "steer" | "queue";
|
|
140
|
+
/** How long an agent sits idle before splates stops its process. */
|
|
141
|
+
export declare const IDLE_STOP: Duration;
|
|
142
|
+
/**
|
|
143
|
+
* How long the conversation that handed tasks out sits idle, with an agent it
|
|
144
|
+
* handed one to at work, before splates asks it to check on them.
|
|
145
|
+
*/
|
|
146
|
+
export declare const HEARTBEAT_IDLE: Duration;
|
|
147
|
+
/**
|
|
148
|
+
* Where a checkpoint stands: asked of the agent, done once its turn ends,
|
|
149
|
+
* failed with the turn, or unanswered after `CHECKPOINT_WAIT`.
|
|
150
|
+
*/
|
|
151
|
+
export type Checkpoint = "asked" | "done" | "failed" | "unanswered";
|
|
152
|
+
/**
|
|
153
|
+
* What follows a checkpoint once every agent is done: `splates server` restarts
|
|
154
|
+
* and tells each to carry on, or shuts down, and its next start does.
|
|
155
|
+
*/
|
|
156
|
+
export type After = "resume" | "shutdown";
|
|
157
|
+
/** One turn's worth of words, the person's or the agent's. */
|
|
158
|
+
export interface Message {
|
|
159
|
+
role: "user" | "agent";
|
|
160
|
+
parts: Part[];
|
|
161
|
+
/** The agent's plan, as last sent; null when it sent none. */
|
|
162
|
+
plan: Step[] | null;
|
|
163
|
+
/** When it began and last moved; null in a log too old to say. */
|
|
164
|
+
at: string | null;
|
|
165
|
+
until: string | null;
|
|
166
|
+
/**
|
|
167
|
+
* Said while the agent worked, to an agent that cannot take it mid-turn:
|
|
168
|
+
* it goes out when the turn ends.
|
|
169
|
+
*/
|
|
170
|
+
queued?: true;
|
|
171
|
+
/** When a queued prompt reached the agent; absent for prompts sent immediately or old logs. */
|
|
172
|
+
sentAt?: string;
|
|
173
|
+
/** When the person stopped the agent's turn, for one they stopped. */
|
|
174
|
+
stopped?: string;
|
|
175
|
+
/** When the connection to the agent was lost mid-turn, for one it cut short. */
|
|
176
|
+
interrupted?: string;
|
|
177
|
+
/** Said while the agent worked, and taken into the turn it was running. */
|
|
178
|
+
steered?: true;
|
|
179
|
+
/** The conversation that said it with `splates tell`, for one the person did not say. */
|
|
180
|
+
told?: string;
|
|
181
|
+
/** Said into the mic rather than typed. */
|
|
182
|
+
dictated?: true;
|
|
183
|
+
/** The id the page gave it as it sent it, so it knows its own copy when it comes back. */
|
|
184
|
+
id?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Still on its way to the server, unanswered for a while: set only by the
|
|
187
|
+
* page, on its own copy, never by the server.
|
|
188
|
+
*/
|
|
189
|
+
sending?: true;
|
|
190
|
+
}
|
|
191
|
+
/** One piece of what someone in a conversation said or did. */
|
|
192
|
+
export type Part =
|
|
193
|
+
/**
|
|
194
|
+
* `at` is when the agent began saying it, where the server knows;
|
|
195
|
+
* `message` is the agent's id for its latest message here, if it gave one.
|
|
196
|
+
*/
|
|
197
|
+
{
|
|
198
|
+
type: "text";
|
|
199
|
+
text: string;
|
|
200
|
+
at?: string | null;
|
|
201
|
+
message?: string | null;
|
|
202
|
+
}
|
|
203
|
+
/** `at` is when the agent began it; null in a log too old to say. */
|
|
204
|
+
| {
|
|
205
|
+
type: "thought";
|
|
206
|
+
text: string;
|
|
207
|
+
at: string | null;
|
|
208
|
+
message?: string | null;
|
|
209
|
+
} | ({
|
|
210
|
+
type: "image";
|
|
211
|
+
} & Image) | ({
|
|
212
|
+
type: "file";
|
|
213
|
+
} & Attached) | Tool | Compaction;
|
|
214
|
+
/** An image the person sent, kept beside the conversation's log as `name`. */
|
|
215
|
+
export interface Image {
|
|
216
|
+
name: string;
|
|
217
|
+
mimeType: string;
|
|
218
|
+
/**
|
|
219
|
+
* Preview URL to display while the image uploads.
|
|
220
|
+
*/
|
|
221
|
+
url?: string;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* A file the person sent, other than an image the agent sees, kept beside
|
|
225
|
+
* the conversation's log as `name`; the agent is sent a link to it.
|
|
226
|
+
*/
|
|
227
|
+
export interface Attached extends Image {
|
|
228
|
+
/** What the person called it. */
|
|
229
|
+
title: string;
|
|
230
|
+
}
|
|
231
|
+
/** A file the person sent, as the page sends it, before it is kept. */
|
|
232
|
+
/** Where the person said something on the page: its phone layout or its wide one. */
|
|
233
|
+
export type Device = "phone" | "desktop";
|
|
234
|
+
export declare const DEVICES: readonly Device[];
|
|
235
|
+
/** The header a prompt from the page names its `Device` in. */
|
|
236
|
+
export declare const FROM_HEADER = "splates-from";
|
|
237
|
+
export interface Upload {
|
|
238
|
+
/** What the person called it. */
|
|
239
|
+
title: string;
|
|
240
|
+
mimeType: string;
|
|
241
|
+
bytes: Uint8Array;
|
|
242
|
+
}
|
|
243
|
+
/** What the person sent with their words, as their message holds it. */
|
|
244
|
+
export type Sent = Extract<Part, {
|
|
245
|
+
type: "image" | "file";
|
|
246
|
+
}>;
|
|
247
|
+
/** A tool call the agent made, as much of it as the page shows. */
|
|
248
|
+
export interface Tool {
|
|
249
|
+
type: "tool";
|
|
250
|
+
id: string;
|
|
251
|
+
title: string;
|
|
252
|
+
status: "pending" | "in_progress" | "completed" | "failed";
|
|
253
|
+
/** What ACP says it does: read, edit, execute, search, think, and so on. */
|
|
254
|
+
kind: string | null;
|
|
255
|
+
/** The command it runs, for one that runs one. */
|
|
256
|
+
command: string | null;
|
|
257
|
+
/** What it searches for or fetches, as its input names it: a pattern, a query or a URL. */
|
|
258
|
+
target: string | null;
|
|
259
|
+
/** The end of what it printed, at most `TOOL_CHARS`. */
|
|
260
|
+
output: string;
|
|
261
|
+
/** The reported process exit code; absent until reported, or in older state. */
|
|
262
|
+
exitCode?: number;
|
|
263
|
+
/** The changes it made to files. */
|
|
264
|
+
edits: Edit[];
|
|
265
|
+
/** The files it touched. */
|
|
266
|
+
paths: string[];
|
|
267
|
+
/** The subagent's tool call it was made under, if one made it. */
|
|
268
|
+
parent: string | null;
|
|
269
|
+
/**
|
|
270
|
+
* For a call that starts a subagent, as Claude's Agent tool: its type and
|
|
271
|
+
* the model it was asked to run on, each null when the call names none.
|
|
272
|
+
*/
|
|
273
|
+
subagent?: {
|
|
274
|
+
type: string | null;
|
|
275
|
+
model: string | null;
|
|
276
|
+
};
|
|
277
|
+
/** When it began and finished; null in a log too old to say, or until it has. */
|
|
278
|
+
at: string | null;
|
|
279
|
+
until: string | null;
|
|
280
|
+
/** What a command did to git that it should not have. */
|
|
281
|
+
flags: Flag[];
|
|
282
|
+
/** How the person answered the agent asking to make it; null when it never asked. */
|
|
283
|
+
decision: Decision | null;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* The agent folding its context into a summary, as Claude does at its
|
|
287
|
+
* window's limit or on `/compact`: what came before it is only remembered as
|
|
288
|
+
* that summary from then on.
|
|
289
|
+
*/
|
|
290
|
+
export interface Compaction {
|
|
291
|
+
type: "compaction";
|
|
292
|
+
id: string;
|
|
293
|
+
status: "in_progress" | "completed" | "failed";
|
|
294
|
+
/** Whether the agent compacted on its own, at its limit, or was told to; null until it says. */
|
|
295
|
+
trigger: "automatic" | "manual" | null;
|
|
296
|
+
/** Tokens in context before and after; null until the agent says. */
|
|
297
|
+
before: number | null;
|
|
298
|
+
after: number | null;
|
|
299
|
+
/** What the agent kept of the thread above the line; null until it says, or when it does not. */
|
|
300
|
+
summary: string | null;
|
|
301
|
+
/** When it began and finished; null in a log too old to say, or until it has. */
|
|
302
|
+
at: string | null;
|
|
303
|
+
until: string | null;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* A command the agent left running in the background, as Claude's Bash with
|
|
307
|
+
* `run_in_background`, kept once it ends until the agent's process does.
|
|
308
|
+
*/
|
|
309
|
+
export interface Background {
|
|
310
|
+
/** The agent's id for it, which stopping it names. */
|
|
311
|
+
id: string;
|
|
312
|
+
/** What the agent said it is for. */
|
|
313
|
+
name: string;
|
|
314
|
+
/** The command it runs, from the tool call that started it; null when unknown. */
|
|
315
|
+
command: string | null;
|
|
316
|
+
/**
|
|
317
|
+
* The subagent whose call started it, by that subagent's tool call; null
|
|
318
|
+
* for one the agent started itself, or when the call is unknown.
|
|
319
|
+
*/
|
|
320
|
+
subagent: {
|
|
321
|
+
id: string;
|
|
322
|
+
title: string;
|
|
323
|
+
} | null;
|
|
324
|
+
state: BackgroundState;
|
|
325
|
+
/** The file the agent writes what it prints to; null until it says. */
|
|
326
|
+
output: string | null;
|
|
327
|
+
}
|
|
328
|
+
export type BackgroundState = "running" | "completed" | "failed" | "stopped";
|
|
329
|
+
/** How the person answered an agent asking permission for a tool call. */
|
|
330
|
+
export interface Decision {
|
|
331
|
+
/** When permission was requested; absent in older logs. */
|
|
332
|
+
askedAt?: string;
|
|
333
|
+
/** The option they picked; null for an ask dismissed, as by stopping the turn. */
|
|
334
|
+
option: {
|
|
335
|
+
name: string;
|
|
336
|
+
kind: string;
|
|
337
|
+
} | null;
|
|
338
|
+
at: string;
|
|
339
|
+
}
|
|
340
|
+
/** A change to one file: `old` is null for a file the edit created. */
|
|
341
|
+
export interface Edit {
|
|
342
|
+
path: string;
|
|
343
|
+
old: string | null;
|
|
344
|
+
new: string;
|
|
345
|
+
}
|
|
346
|
+
/** A step of the agent's plan for the turn. */
|
|
347
|
+
export interface Step {
|
|
348
|
+
text: string;
|
|
349
|
+
status: "pending" | "in_progress" | "completed";
|
|
350
|
+
}
|
|
351
|
+
/** A field of a question an agent asks, answered with one of `choices` or in words. */
|
|
352
|
+
export interface Field {
|
|
353
|
+
key: string;
|
|
354
|
+
title: string;
|
|
355
|
+
description: string | null;
|
|
356
|
+
/** Absent for a field answered in words. */
|
|
357
|
+
choices: {
|
|
358
|
+
value: string;
|
|
359
|
+
title: string;
|
|
360
|
+
description: string | null;
|
|
361
|
+
}[] | null;
|
|
362
|
+
}
|
|
363
|
+
/** What the agent is waiting on the person for, since `at`. */
|
|
364
|
+
export type Ask = Asked & {
|
|
365
|
+
at: string;
|
|
366
|
+
};
|
|
367
|
+
/** What the agent asks, before it is stamped with when. */
|
|
368
|
+
export type Asked = {
|
|
369
|
+
type: "permission";
|
|
370
|
+
id: string;
|
|
371
|
+
title: string;
|
|
372
|
+
options: {
|
|
373
|
+
id: string;
|
|
374
|
+
name: string;
|
|
375
|
+
kind: string;
|
|
376
|
+
}[];
|
|
377
|
+
} | {
|
|
378
|
+
type: "question";
|
|
379
|
+
id: string;
|
|
380
|
+
message: string;
|
|
381
|
+
fields: Field[];
|
|
382
|
+
};
|
|
383
|
+
/** How an `Ask` was answered. */
|
|
384
|
+
export type Answer = {
|
|
385
|
+
type: "permission";
|
|
386
|
+
option: string;
|
|
387
|
+
} | {
|
|
388
|
+
type: "question";
|
|
389
|
+
values: Record<string, string>;
|
|
390
|
+
} | {
|
|
391
|
+
type: "dismiss";
|
|
392
|
+
};
|
|
393
|
+
/** A choice the agent offers for the session, like its model. */
|
|
394
|
+
export interface Setting {
|
|
395
|
+
id: string;
|
|
396
|
+
name: string;
|
|
397
|
+
/**
|
|
398
|
+
* A pick among its options, or an on/off toggle, like fast mode, whose
|
|
399
|
+
* options are `on` and `off`.
|
|
400
|
+
*/
|
|
401
|
+
type: "select" | "boolean";
|
|
402
|
+
/** What it sets, as ACP names it: mode, model, thought_level, or its own. */
|
|
403
|
+
category: string | null;
|
|
404
|
+
current: string;
|
|
405
|
+
options: {
|
|
406
|
+
value: string;
|
|
407
|
+
name: string;
|
|
408
|
+
description: string | null;
|
|
409
|
+
}[];
|
|
410
|
+
}
|
|
411
|
+
/** A command the agent runs when a message starts with `/` and its name. */
|
|
412
|
+
export interface Command {
|
|
413
|
+
name: string;
|
|
414
|
+
description: string;
|
|
415
|
+
/** What to write after its name, for one that takes input. */
|
|
416
|
+
hint: string | null;
|
|
417
|
+
}
|
|
418
|
+
/** What a session has used, as far as its agent says. */
|
|
419
|
+
export interface Usage {
|
|
420
|
+
/** OpenCode draft ACP observations, separate from legacy accounting. */
|
|
421
|
+
opencode?: OpenCodeUsage;
|
|
422
|
+
/** Tokens in the context window, of the most it holds; null until said. */
|
|
423
|
+
context: {
|
|
424
|
+
used: number;
|
|
425
|
+
size: number;
|
|
426
|
+
} | null;
|
|
427
|
+
/** Tokens read over every turn the agent counted, those from cache among them. */
|
|
428
|
+
input: number;
|
|
429
|
+
/** Of `input`, those read from cache. */
|
|
430
|
+
cached: number;
|
|
431
|
+
/** Tokens written over every turn the agent counted. */
|
|
432
|
+
output: number;
|
|
433
|
+
/**
|
|
434
|
+
* What the session cost, over every process it ran in; null for an agent
|
|
435
|
+
* that never says, as Codex does not.
|
|
436
|
+
*/
|
|
437
|
+
cost: {
|
|
438
|
+
amount: number;
|
|
439
|
+
currency: string;
|
|
440
|
+
/**
|
|
441
|
+
* What the agent last said it had cost: Claude counts from naught in
|
|
442
|
+
* each new process, so a figure below it starts a new count.
|
|
443
|
+
*/
|
|
444
|
+
said: number;
|
|
445
|
+
} | null;
|
|
446
|
+
/** The plan's windows of use, as the agent last said; none from Codex. */
|
|
447
|
+
limits: Limit[];
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* One window of the plan's use, as Claude says with each reply: the account's,
|
|
451
|
+
* not the session's, so every conversation with the agent shares it.
|
|
452
|
+
*/
|
|
453
|
+
export interface Limit {
|
|
454
|
+
/** As Claude names it: `five_hour`, `seven_day`, `seven_day_opus`. */
|
|
455
|
+
window: string;
|
|
456
|
+
/** How much of it is used, from 0 to 1. */
|
|
457
|
+
used: number;
|
|
458
|
+
/** When it starts over, as an ISO timestamp. */
|
|
459
|
+
resets: string;
|
|
460
|
+
/** When the agent said so; null in logs written before it was kept. */
|
|
461
|
+
at: string | null;
|
|
462
|
+
}
|
|
463
|
+
/** What a session has used before its agent says anything of it. */
|
|
464
|
+
export declare function unused(): Usage;
|
|
465
|
+
/** A conversation as it starts, before its agent has said anything. */
|
|
466
|
+
export declare function blank(id: string, agent: string, task: string | null, createdAt: string, base?: string | null, caller?: string | null, assigned?: boolean, handedBy?: string | null, startedBy?: string | null): ConversationState;
|
|
467
|
+
/**
|
|
468
|
+
* Who added the task a conversation moves to, as it keeps it: kept from
|
|
469
|
+
* before for none, and none for the task it was moved away from in the list,
|
|
470
|
+
* whose caller it was cut loose from.
|
|
471
|
+
*/
|
|
472
|
+
export declare function callerAfter(state: Pick<ConversationState, "lastCaller" | "lastTask" | "parent">, task: string | null, caller: string | null): string | null;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { AgentConnection } from "./agent-connection.js";
|
|
2
|
+
import type { ConversationFiles } from "./conversation-files.js";
|
|
3
|
+
import type { ConversationDeps, ConversationHost } from "./conversation-host.js";
|
|
4
|
+
import type { Attached, Checkpoint, Device, Taking, Upload } from "./conversation-state.js";
|
|
5
|
+
/** What else a prompt says about who said it. */
|
|
6
|
+
export interface PromptOptions {
|
|
7
|
+
/** The conversation that said it with `splates tell`, when the person did not. */
|
|
8
|
+
told?: string;
|
|
9
|
+
/** Whether the person said it into the mic rather than typed it. */
|
|
10
|
+
dictated?: boolean;
|
|
11
|
+
/** The id the page gave it, so the page knows its own copy when it comes back. */
|
|
12
|
+
id?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether it stops the running turn and follows it, rather than joining
|
|
15
|
+
* it, for a change of plans.
|
|
16
|
+
*/
|
|
17
|
+
stop?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The turns of a conversation: what the person says goes to the agent as a
|
|
21
|
+
* prompt, steered into the turn it is running or queued for when that ends,
|
|
22
|
+
* and a checkpoint asks it to stop where it is.
|
|
23
|
+
*/
|
|
24
|
+
export declare class ConversationTurns {
|
|
25
|
+
private readonly host;
|
|
26
|
+
private readonly deps;
|
|
27
|
+
private readonly connection;
|
|
28
|
+
private readonly files;
|
|
29
|
+
/** Whether the person cancelled the last turn, which holds the queue. */
|
|
30
|
+
private held;
|
|
31
|
+
/** Gives up on an asked checkpoint once `CHECKPOINT_WAIT` is out. */
|
|
32
|
+
private waiting;
|
|
33
|
+
/** Whether a checkpoint is cancelling the turn, whose end is not its own. */
|
|
34
|
+
private interrupting;
|
|
35
|
+
constructor(host: ConversationHost, deps: ConversationDeps, connection: AgentConnection, files: ConversationFiles);
|
|
36
|
+
/**
|
|
37
|
+
* Says `text` to the agent, with `files`, once it has started, resuming
|
|
38
|
+
* the session first when it stopped and unarchiving it when archived.
|
|
39
|
+
* While the agent works, it joins the
|
|
40
|
+
* running turn when the agent can take it there, and otherwise waits for
|
|
41
|
+
* the turn to end.
|
|
42
|
+
*/
|
|
43
|
+
prompt(text: string, files?: Upload[], from?: Device, { told, dictated, stop, id }?: PromptOptions): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* What `prompt` would do with a message said now, which the page shows it
|
|
46
|
+
* as: it follows the same rules as `prompt` does.
|
|
47
|
+
*/
|
|
48
|
+
taking(): Taking;
|
|
49
|
+
/**
|
|
50
|
+
* Back to idle once a turn ends, then on to what was queued meanwhile,
|
|
51
|
+
* unless the person cancelled the turn: that holds the queue until they
|
|
52
|
+
* say something.
|
|
53
|
+
*/
|
|
54
|
+
ended(error: string | null): void;
|
|
55
|
+
/**
|
|
56
|
+
* Marks a running turn as cut short, as when the connection is lost or the
|
|
57
|
+
* process exits, unless the person stopped it, which says so already.
|
|
58
|
+
*/
|
|
59
|
+
interrupt(): void;
|
|
60
|
+
/** Whether a checkpoint has ended and nothing has been said since. */
|
|
61
|
+
get stoppedByCheckpoint(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Asks the agent to bring its `SPLATES.md` up to date and stop, cancelling
|
|
64
|
+
* the turn it is on first, unless that turn is `merging`, which it says
|
|
65
|
+
* the checkpoint into, or queues it after. An idle agent is not asked,
|
|
66
|
+
* having ended its turn already. What the person queued stays queued, for
|
|
67
|
+
* the next prompt to send. A `pause` is forgotten once it ends, so
|
|
68
|
+
* nothing resumes it.
|
|
69
|
+
*/
|
|
70
|
+
checkpoint(merging: boolean, pause?: boolean): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Forgets the checkpoint, done or not, so the next starts afresh; an agent
|
|
73
|
+
* still on it carries on with its turn.
|
|
74
|
+
*/
|
|
75
|
+
dismissCheckpoint(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Keeps where the checkpoint stands, giving up the wait once it is past
|
|
78
|
+
* asked; a pause past asked is forgotten.
|
|
79
|
+
*/
|
|
80
|
+
mark(checkpoint: Checkpoint | null): void;
|
|
81
|
+
/** Settles once the checkpoint asked is no longer under way. */
|
|
82
|
+
answered(): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Takes back the `index`th queued message before the agent hears it,
|
|
85
|
+
* answering with its words and files, for the person to edit and send
|
|
86
|
+
* again.
|
|
87
|
+
*/
|
|
88
|
+
unqueue(index: number): {
|
|
89
|
+
text: string;
|
|
90
|
+
files: Attached[];
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Sends what is queued now: stops the running turn, whose end sends it,
|
|
94
|
+
* or, with no turn running, sends it as one.
|
|
95
|
+
*/
|
|
96
|
+
sendNow(): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Stops the agent's turn for the person, marking the turn as one they
|
|
99
|
+
* stopped, and leaves the conversation open for the next.
|
|
100
|
+
*/
|
|
101
|
+
cancel(): Promise<void>;
|
|
102
|
+
/** Holds `words` and `sent` for when the turn ends, shown as said. */
|
|
103
|
+
private queue;
|
|
104
|
+
/**
|
|
105
|
+
* Starts a turn on `fresh`, with every message still queued ahead of it,
|
|
106
|
+
* as one prompt, or on `fresh` alone, leaving the queue as it is.
|
|
107
|
+
*/
|
|
108
|
+
private send;
|
|
109
|
+
/** What `messages` say, as one prompt, for the tree the agent runs in. */
|
|
110
|
+
private content;
|
|
111
|
+
/** Settles once no turn is running, or the checkpoint has given up. */
|
|
112
|
+
private idle;
|
|
113
|
+
/** Stops the agent's turn, holding what is queued for the next prompt. */
|
|
114
|
+
private halt;
|
|
115
|
+
}
|