@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
package/fake-agent.js
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import {
|
|
2
|
+
framed2
|
|
3
|
+
} from "./index-d4hjrzaq.js";
|
|
4
|
+
import"./index-k73tsw5g.js";
|
|
5
|
+
|
|
6
|
+
// fake-agent.ts
|
|
7
|
+
import * as acp from "@agentclientprotocol/sdk";
|
|
8
|
+
var AGENT = { id: "fake", name: "Fake", argv: ["fake-acp"] };
|
|
9
|
+
var ROSTERED = {
|
|
10
|
+
...AGENT,
|
|
11
|
+
models: [
|
|
12
|
+
{ id: "big", name: "Big", strengths: "hard problems", cost: "high" },
|
|
13
|
+
{ id: "small", name: "Small", strengths: "quick edits", cost: "low" }
|
|
14
|
+
]
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
class FakeAgent {
|
|
18
|
+
turn = async () => "end_turn";
|
|
19
|
+
cancelled = 0;
|
|
20
|
+
resumed = [];
|
|
21
|
+
steering = null;
|
|
22
|
+
steered = [];
|
|
23
|
+
beforeSteer = async () => {};
|
|
24
|
+
lists = false;
|
|
25
|
+
subscribed = [];
|
|
26
|
+
capabilities = null;
|
|
27
|
+
stoppedBackground = [];
|
|
28
|
+
sees = false;
|
|
29
|
+
usage = null;
|
|
30
|
+
held = null;
|
|
31
|
+
loaded = [];
|
|
32
|
+
opened = [];
|
|
33
|
+
http = false;
|
|
34
|
+
mcp = [];
|
|
35
|
+
prompts = [];
|
|
36
|
+
chosen = [];
|
|
37
|
+
options = structuredClone(OPTIONS);
|
|
38
|
+
resumes = true;
|
|
39
|
+
protocolVersion = acp.PROTOCOL_VERSION;
|
|
40
|
+
disconnect = () => {};
|
|
41
|
+
ignoreChoices = false;
|
|
42
|
+
hold = null;
|
|
43
|
+
dying = 0;
|
|
44
|
+
stderr = "fake agent fell over";
|
|
45
|
+
launched = [];
|
|
46
|
+
killed = 0;
|
|
47
|
+
pid = null;
|
|
48
|
+
exit = () => {};
|
|
49
|
+
launch = (argv, cwd, env) => {
|
|
50
|
+
this.launched.push({ argv, cwd, env });
|
|
51
|
+
const toAgent = new TransformStream;
|
|
52
|
+
const toClient = new TransformStream({
|
|
53
|
+
start: (controller) => {
|
|
54
|
+
this.disconnect = () => controller.terminate();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
new acp.AgentSideConnection((client) => this.agent(client), acp.ndJsonStream(toClient.writable, toAgent.readable));
|
|
58
|
+
const exited = new Promise((resolve) => {
|
|
59
|
+
this.exit = resolve;
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
pid: this.pid,
|
|
63
|
+
input: toAgent.writable,
|
|
64
|
+
output: framed2(toClient.readable),
|
|
65
|
+
ack: () => {},
|
|
66
|
+
handle: null,
|
|
67
|
+
stderr: () => this.stderr,
|
|
68
|
+
exited,
|
|
69
|
+
kill: () => {
|
|
70
|
+
this.killed++;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
crash() {
|
|
75
|
+
this.exit(1);
|
|
76
|
+
}
|
|
77
|
+
async say(update) {
|
|
78
|
+
await this.client?.sessionUpdate({ sessionId: "s1", update });
|
|
79
|
+
}
|
|
80
|
+
async list(state, endedAt) {
|
|
81
|
+
await this.client?.extNotification("_session/list/changes", {
|
|
82
|
+
subscriptionId: "list-1",
|
|
83
|
+
sessions: [
|
|
84
|
+
{
|
|
85
|
+
sessionId: "s1",
|
|
86
|
+
cwd: this.subscribed.at(-1) ?? "/",
|
|
87
|
+
_meta: {
|
|
88
|
+
jetbrains: {
|
|
89
|
+
air: {
|
|
90
|
+
state,
|
|
91
|
+
...endedAt === undefined ? {} : { lastTurnEndedAt: endedAt }
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
client = null;
|
|
100
|
+
agent(client) {
|
|
101
|
+
this.client = client;
|
|
102
|
+
return {
|
|
103
|
+
initialize: async ({ clientCapabilities }) => {
|
|
104
|
+
if (this.dying > 0) {
|
|
105
|
+
this.dying--;
|
|
106
|
+
this.exit(1);
|
|
107
|
+
throw new Error("ACP connection closed");
|
|
108
|
+
}
|
|
109
|
+
await this.hold;
|
|
110
|
+
this.capabilities = clientCapabilities ?? null;
|
|
111
|
+
return {
|
|
112
|
+
protocolVersion: this.protocolVersion,
|
|
113
|
+
agentCapabilities: {
|
|
114
|
+
...this.http ? { mcpCapabilities: { http: true } } : {},
|
|
115
|
+
...this.sees ? { promptCapabilities: { image: true } } : {},
|
|
116
|
+
loadSession: this.held !== null,
|
|
117
|
+
sessionCapabilities: {
|
|
118
|
+
...this.resumes ? { resume: {} } : {},
|
|
119
|
+
...this.held === null ? {} : { list: {} }
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
_meta: {
|
|
123
|
+
...this.steering === null ? {} : { steering: { supported: true } },
|
|
124
|
+
...this.lists ? {
|
|
125
|
+
jetbrains: {
|
|
126
|
+
air: { version: 1, capabilities: ["sessionListSubscribe"] }
|
|
127
|
+
}
|
|
128
|
+
} : {}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
extMethod: async (method, params) => {
|
|
133
|
+
if (method === "_session/async_task/stop") {
|
|
134
|
+
const id = String(params.asyncTaskId);
|
|
135
|
+
this.stoppedBackground.push(id);
|
|
136
|
+
await client.sessionUpdate({
|
|
137
|
+
sessionId: String(params.sessionId),
|
|
138
|
+
update: backgroundEnded(id, "stopped")
|
|
139
|
+
});
|
|
140
|
+
return { stopped: true };
|
|
141
|
+
}
|
|
142
|
+
if (method === "_session/list/subscribe" && this.lists) {
|
|
143
|
+
this.subscribed.push(String(params.cwd));
|
|
144
|
+
return { subscriptionId: "list-1" };
|
|
145
|
+
}
|
|
146
|
+
if (method !== "_session/steering" || this.steering === null) {
|
|
147
|
+
throw acp.RequestError.methodNotFound(method);
|
|
148
|
+
}
|
|
149
|
+
const prompt = params.prompt;
|
|
150
|
+
await this.beforeSteer();
|
|
151
|
+
if (this.steering === "injected" || this.steering === "startedNewTurn") {
|
|
152
|
+
this.steered.push(prompt.map((block) => block.type === "text" ? block.text : "").join(""));
|
|
153
|
+
}
|
|
154
|
+
return { outcome: this.steering };
|
|
155
|
+
},
|
|
156
|
+
newSession: async ({ _meta, mcpServers }) => {
|
|
157
|
+
this.opened.push(_meta);
|
|
158
|
+
this.mcp.push(mcpServers);
|
|
159
|
+
return { sessionId: "s1", configOptions: this.options };
|
|
160
|
+
},
|
|
161
|
+
listSessions: async ({ cwd }) => ({
|
|
162
|
+
sessions: (this.held ?? []).filter((each) => cwd == null || each.cwd === cwd).map(({ replay: _, ...info }) => info)
|
|
163
|
+
}),
|
|
164
|
+
loadSession: async ({ sessionId, _meta, mcpServers }) => {
|
|
165
|
+
this.opened.push(_meta);
|
|
166
|
+
this.mcp.push(mcpServers);
|
|
167
|
+
const session = this.held?.find((each) => each.sessionId === sessionId);
|
|
168
|
+
if (session === undefined) {
|
|
169
|
+
throw acp.RequestError.resourceNotFound(sessionId);
|
|
170
|
+
}
|
|
171
|
+
this.loaded.push(sessionId);
|
|
172
|
+
for (const update of session.replay) {
|
|
173
|
+
await client.sessionUpdate({ sessionId, update });
|
|
174
|
+
}
|
|
175
|
+
return { configOptions: this.options };
|
|
176
|
+
},
|
|
177
|
+
resumeSession: async ({ sessionId, _meta, mcpServers }) => {
|
|
178
|
+
this.opened.push(_meta);
|
|
179
|
+
this.mcp.push(mcpServers ?? []);
|
|
180
|
+
this.resumed.push(sessionId);
|
|
181
|
+
return { configOptions: this.options };
|
|
182
|
+
},
|
|
183
|
+
authenticate: async () => ({}),
|
|
184
|
+
setSessionConfigOption: async ({ configId, value }) => {
|
|
185
|
+
this.chosen.push({ configId, value });
|
|
186
|
+
this.options = this.options.map((option) => option.id === configId && !this.ignoreChoices ? {
|
|
187
|
+
...option,
|
|
188
|
+
currentValue: typeof value === "boolean" ? value : String(value)
|
|
189
|
+
} : option);
|
|
190
|
+
return { configOptions: this.options };
|
|
191
|
+
},
|
|
192
|
+
prompt: async ({ sessionId, prompt }) => {
|
|
193
|
+
this.prompts.push(prompt);
|
|
194
|
+
return {
|
|
195
|
+
stopReason: await this.turn(client, sessionId, prompt.map((block) => block.type === "text" ? block.text : "").join("")),
|
|
196
|
+
usage: this.usage
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
cancel: async () => {
|
|
200
|
+
this.cancelled++;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
function heard(text) {
|
|
206
|
+
return {
|
|
207
|
+
sessionUpdate: "user_message_chunk",
|
|
208
|
+
content: { type: "text", text }
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function say(text) {
|
|
212
|
+
return {
|
|
213
|
+
sessionUpdate: "agent_message_chunk",
|
|
214
|
+
content: { type: "text", text }
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function backgroundStarted(id, description, tool, taskType = "shell", output) {
|
|
218
|
+
return {
|
|
219
|
+
sessionUpdate: "async_task_spawned",
|
|
220
|
+
asyncTaskId: id,
|
|
221
|
+
name: description,
|
|
222
|
+
taskType,
|
|
223
|
+
description,
|
|
224
|
+
showInTranscript: true,
|
|
225
|
+
canStop: true,
|
|
226
|
+
toolCallId: tool,
|
|
227
|
+
...output === undefined ? {} : { outputFilePath: output }
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function backgroundEnded(id, state) {
|
|
231
|
+
return {
|
|
232
|
+
sessionUpdate: "async_task_state_update",
|
|
233
|
+
asyncTaskId: id,
|
|
234
|
+
state
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function backgroundWrites(id, output) {
|
|
238
|
+
return {
|
|
239
|
+
sessionUpdate: "async_task_progress",
|
|
240
|
+
asyncTaskId: id,
|
|
241
|
+
outputFilePath: output
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
var OPTIONS = [
|
|
245
|
+
{
|
|
246
|
+
id: "mode",
|
|
247
|
+
name: "Mode",
|
|
248
|
+
category: "mode",
|
|
249
|
+
type: "select",
|
|
250
|
+
currentValue: "ask",
|
|
251
|
+
options: [
|
|
252
|
+
{ value: "ask", name: "Ask" },
|
|
253
|
+
{ value: "auto", name: "Auto" }
|
|
254
|
+
]
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
id: "model",
|
|
258
|
+
name: "Model",
|
|
259
|
+
category: "model",
|
|
260
|
+
type: "select",
|
|
261
|
+
currentValue: "big",
|
|
262
|
+
options: [
|
|
263
|
+
{ value: "big", name: "Big" },
|
|
264
|
+
{ value: "small", name: "Small", description: "Fast" }
|
|
265
|
+
]
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
id: "fast",
|
|
269
|
+
name: "Fast mode",
|
|
270
|
+
category: "model_config",
|
|
271
|
+
type: "boolean",
|
|
272
|
+
currentValue: false
|
|
273
|
+
}
|
|
274
|
+
];
|
|
275
|
+
export {
|
|
276
|
+
AGENT,
|
|
277
|
+
FakeAgent,
|
|
278
|
+
ROSTERED,
|
|
279
|
+
backgroundEnded,
|
|
280
|
+
backgroundStarted,
|
|
281
|
+
backgroundWrites,
|
|
282
|
+
heard,
|
|
283
|
+
say
|
|
284
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Finding } from "./findings.js";
|
|
2
|
+
import type { Landed } from "./landed.js";
|
|
3
|
+
/** One thing that went worse than it could have, as the merged card says it. */
|
|
4
|
+
export interface Fact {
|
|
5
|
+
text: string;
|
|
6
|
+
/** "3rd time this week" when it came up before in its project; null otherwise. */
|
|
7
|
+
again: string | null;
|
|
8
|
+
/** What it was found from; null for an older outcome's count of failed merges. */
|
|
9
|
+
finding: Finding | null;
|
|
10
|
+
}
|
|
11
|
+
/** What went worse in a merged task: the gate's turn-aways, and the rest. */
|
|
12
|
+
export interface FoundFacts {
|
|
13
|
+
/** Null when the gate passed it the first time. */
|
|
14
|
+
gate: Fact[] | null;
|
|
15
|
+
/** Most severe first. */
|
|
16
|
+
findings: Fact[];
|
|
17
|
+
}
|
|
18
|
+
/** A todo made of a fact: its line, and what more there is to say. */
|
|
19
|
+
export interface FactTodo {
|
|
20
|
+
subject: string;
|
|
21
|
+
text: string;
|
|
22
|
+
}
|
|
23
|
+
/** The findings that are not the gate's, the most worth acting on first. */
|
|
24
|
+
export declare const SEVERITY: Finding["kind"][];
|
|
25
|
+
/** What went worse in `landed`, from what its outcome kept. */
|
|
26
|
+
export declare function foundFacts({ outcome, baseline }: Landed): FoundFacts;
|
|
27
|
+
/**
|
|
28
|
+
* Findings the merged card lists but no todo is made of: the person's own
|
|
29
|
+
* calls on the agent's picks, which are asking working as meant.
|
|
30
|
+
*/
|
|
31
|
+
export declare const UNTODOED: Finding["kind"][];
|
|
32
|
+
/**
|
|
33
|
+
* The todos `splates merge` adds for what went worse in `landed`, the gate's
|
|
34
|
+
* first: one a fact, as the merged card lists them, but for `UNTODOED`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function factTodos(landed: Landed): FactTodo[];
|
|
37
|
+
/** The todo made of `fact`, found in `task` as it merged. */
|
|
38
|
+
export declare function deferred(task: string, fact: Fact): FactTodo;
|
package/findings.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Judged } from "./adherence.js";
|
|
2
|
+
import type { TaskLog } from "./task-log.js";
|
|
3
|
+
import type { GateFailure } from "./worktree.js";
|
|
4
|
+
/** What went worse than it could have, in the order `Finding` lists the kinds. */
|
|
5
|
+
export declare function findings(evidence: Evidence): Finding[];
|
|
6
|
+
/**
|
|
7
|
+
* Where a finding starts: each tuned here, so a finding that fires too often
|
|
8
|
+
* or too rarely is one number to change.
|
|
9
|
+
*/
|
|
10
|
+
export declare const FINDING_THRESHOLDS: {
|
|
11
|
+
/** A command failing this many times in one task. */
|
|
12
|
+
readonly repeatedFailures: 3;
|
|
13
|
+
/** Lines edited this many times over the lines that landed. */
|
|
14
|
+
readonly churnRatio: 4;
|
|
15
|
+
/** And at least this many lines edited, so a small task's retouching is not churn. */
|
|
16
|
+
readonly churnLines: 300;
|
|
17
|
+
/** A skill check passed less than this share of the times it applied. */
|
|
18
|
+
readonly adherenceBelow: 0.5;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Something that went worse than it could have in one task, kept with what it
|
|
22
|
+
* names, so a later count can tell how often each kind recurs.
|
|
23
|
+
*/
|
|
24
|
+
export type Finding =
|
|
25
|
+
/** The gate turned it away, even once. */
|
|
26
|
+
({
|
|
27
|
+
kind: "gate";
|
|
28
|
+
} & GateFailure)
|
|
29
|
+
/** `splates retry` granted it more merge attempts. */
|
|
30
|
+
| {
|
|
31
|
+
kind: "retried";
|
|
32
|
+
times: number;
|
|
33
|
+
}
|
|
34
|
+
/** The person stopped the agent's turn. */
|
|
35
|
+
| {
|
|
36
|
+
kind: "stopped";
|
|
37
|
+
at: string;
|
|
38
|
+
}
|
|
39
|
+
/** A lost connection cut the agent's turn short. */
|
|
40
|
+
| {
|
|
41
|
+
kind: "interrupted";
|
|
42
|
+
at: string;
|
|
43
|
+
}
|
|
44
|
+
/** The person answered picks with another choice than the agent's. */
|
|
45
|
+
| {
|
|
46
|
+
kind: "overturned";
|
|
47
|
+
picks: number;
|
|
48
|
+
}
|
|
49
|
+
/** The person challenged assumptions the agent made. */
|
|
50
|
+
| {
|
|
51
|
+
kind: "challenged";
|
|
52
|
+
assumptions: number;
|
|
53
|
+
}
|
|
54
|
+
/** One command failed again and again. */
|
|
55
|
+
| {
|
|
56
|
+
kind: "repeated_failure";
|
|
57
|
+
command: string;
|
|
58
|
+
times: number;
|
|
59
|
+
}
|
|
60
|
+
/** Far more lines edited than landed. */
|
|
61
|
+
| {
|
|
62
|
+
kind: "churn";
|
|
63
|
+
edited: number;
|
|
64
|
+
landed: number;
|
|
65
|
+
}
|
|
66
|
+
/** A skill check its conversation mostly failed. */
|
|
67
|
+
| {
|
|
68
|
+
kind: "adherence";
|
|
69
|
+
check: string;
|
|
70
|
+
passed: number;
|
|
71
|
+
failed: number;
|
|
72
|
+
};
|
|
73
|
+
/** What a task leaves to find in, each part absent when it was not kept. */
|
|
74
|
+
export interface Evidence {
|
|
75
|
+
gateFailures: GateFailure[];
|
|
76
|
+
retries: number;
|
|
77
|
+
picksOverturned: number;
|
|
78
|
+
assumptionsChallenged: number;
|
|
79
|
+
log: TaskLog | null;
|
|
80
|
+
/** Lines the landed diff added and removed; null when unknown. */
|
|
81
|
+
landedLines: number | null;
|
|
82
|
+
/** Its conversation's skill checks as last judged; null when unjudged. */
|
|
83
|
+
adherence: Judged | null;
|
|
84
|
+
}
|
package/fold.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type * as acp from "@agentclientprotocol/sdk";
|
|
2
|
+
import type { ConversationState, Field, Limit, Message, Setting } from "./conversation-state.js";
|
|
3
|
+
/**
|
|
4
|
+
* Folds one ACP update, sent `at`, into the messages: text runs on in the
|
|
5
|
+
* message it started, and a tool call is one part that fills in as it runs.
|
|
6
|
+
*/
|
|
7
|
+
export declare function fold(state: ConversationState, update: acp.SessionUpdate, at?: string | null): void;
|
|
8
|
+
/**
|
|
9
|
+
* The windows Claude's rate limit info in `update` tells of: every one in
|
|
10
|
+
* `unifiedWindows` when it sends them, else the one it names. Its
|
|
11
|
+
* `utilization` runs from 0 to 1, and `resetsAt` is in seconds.
|
|
12
|
+
*/
|
|
13
|
+
export declare function limitsIn(update: acp.UsageUpdate, at: string | null): Limit[];
|
|
14
|
+
/** `limits`, each window in `news` replaced by what it says now. */
|
|
15
|
+
export declare function heard(limits: Limit[], news: Limit[]): Limit[];
|
|
16
|
+
/** Adds the tokens a turn used to those of the turns before it. */
|
|
17
|
+
export declare function tally(state: ConversationState, usage: acp.Usage): void;
|
|
18
|
+
/**
|
|
19
|
+
* The agent's message at the end, started if the person spoke last, marked
|
|
20
|
+
* as having moved `at`. Queued messages stay below it: the agent has yet to
|
|
21
|
+
* hear them, so nothing it says meanwhile answers them.
|
|
22
|
+
*/
|
|
23
|
+
export declare function agentTurn(state: ConversationState, at: string | null): Message;
|
|
24
|
+
/** Marks the agent's message at the end, if it is the last, as having moved `at`. */
|
|
25
|
+
export declare function moved(state: ConversationState, at: string | null): void;
|
|
26
|
+
/** Whether `update` is the agent at work, as it is only in a turn. */
|
|
27
|
+
export declare function starts(update: acp.SessionUpdate): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether `update` ends a turn: Claude says where each turn came from in the
|
|
30
|
+
* usage it sends at the turn's end, and only then.
|
|
31
|
+
*/
|
|
32
|
+
export declare function result(update: acp.SessionUpdate): boolean;
|
|
33
|
+
/** The session's settings the agent lets the person pick from, in its order. */
|
|
34
|
+
export declare function settingsIn(options: acp.SessionConfigOption[] | null | undefined): Setting[];
|
|
35
|
+
/** `value` for `setting` as ACP sets it: a toggle's as a boolean. */
|
|
36
|
+
export declare function configValue(setting: Setting, value: string): {
|
|
37
|
+
type: "boolean";
|
|
38
|
+
value: boolean;
|
|
39
|
+
} | {
|
|
40
|
+
value: string;
|
|
41
|
+
};
|
|
42
|
+
/** A form an agent asks with, as the fields the page shows. */
|
|
43
|
+
export declare function fieldsIn(schema: unknown): Field[];
|
package/follow.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Logger } from "webappwiz/log";
|
|
2
|
+
import type { Ps } from "webappwiz/system";
|
|
3
|
+
import type { Git } from "./git.js";
|
|
4
|
+
import type { Projects } from "./projects.js";
|
|
5
|
+
/** What `fetch` is used for here, so a test can stand in for it. */
|
|
6
|
+
type Send = (url: string, init: RequestInit) => Promise<Response>;
|
|
7
|
+
/**
|
|
8
|
+
* Tells `splates server` that the agent in a conversation took or left a task, so
|
|
9
|
+
* the conversation follows it into that worktree, or back to the main tree.
|
|
10
|
+
* An agent started from the page runs with its conversation and the server
|
|
11
|
+
* in its env; any other `splates` has neither, and says nothing. A server that
|
|
12
|
+
* cannot be reached is worth a line, never a failure: the task command has
|
|
13
|
+
* done its work.
|
|
14
|
+
*/
|
|
15
|
+
export declare function follow({ ps, log, send }: {
|
|
16
|
+
ps: Ps;
|
|
17
|
+
log: Logger;
|
|
18
|
+
send?: Send;
|
|
19
|
+
}, task: string | null, { from, base, }?: {
|
|
20
|
+
/** The task being left; given, the conversation moves only out of it. */
|
|
21
|
+
from?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The branch `task` lands on, for an add to send before the task's
|
|
24
|
+
* record names it, so the server can tell a part from a task to follow.
|
|
25
|
+
*/
|
|
26
|
+
base?: string;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Asks `splates server` to serve the project `git` is in, so the agent a task
|
|
30
|
+
* there was just handed to from another project starts: the server opens a
|
|
31
|
+
* project only once something asks for it. Outside `splates server` it says
|
|
32
|
+
* nothing; a server that cannot be reached is worth a line.
|
|
33
|
+
*/
|
|
34
|
+
export declare function serveProject({ ps, log, git, projects, send, }: {
|
|
35
|
+
ps: Ps;
|
|
36
|
+
log: Logger;
|
|
37
|
+
git: Git;
|
|
38
|
+
projects: Projects;
|
|
39
|
+
send?: Send;
|
|
40
|
+
}): Promise<void>;
|
|
41
|
+
export {};
|
package/format.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Logger } from "webappwiz/log";
|
|
2
|
+
import type { Fs, Lock } from "webappwiz/system";
|
|
3
|
+
/**
|
|
4
|
+
* One step forward in the format of the records under `.git/splates`: from the
|
|
5
|
+
* version before it to its own. A step can be interrupted and run again, and
|
|
6
|
+
* finds no records to change in a repository that has none yet.
|
|
7
|
+
*/
|
|
8
|
+
export interface Migration {
|
|
9
|
+
/** What the step changes, said as it runs: "moves lanes into their own files". */
|
|
10
|
+
does: string;
|
|
11
|
+
run(splatesDir: string, fs: Fs): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Every step from version 1, in order: the one at index 0 takes records from
|
|
15
|
+
* version 1 to 2. Forward only; splates never writes an older format.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MIGRATIONS: readonly Migration[];
|
|
18
|
+
/**
|
|
19
|
+
* The version of the records under `.git/splates` this splates reads and writes:
|
|
20
|
+
* tasks, todos, lanes, the journal and conversations, as one. A change an
|
|
21
|
+
* older splates would misread adds a step to `MIGRATIONS`, which moves it on.
|
|
22
|
+
*/
|
|
23
|
+
export declare const FORMAT: number;
|
|
24
|
+
/** What a `Format` works with. */
|
|
25
|
+
export interface FormatOptions {
|
|
26
|
+
fs: Fs;
|
|
27
|
+
/** Held while migrating, so two commands never run the same step at once. */
|
|
28
|
+
lock: Lock;
|
|
29
|
+
log: Logger;
|
|
30
|
+
/** The steps from version 1; a test passes its own. */
|
|
31
|
+
migrations?: readonly Migration[];
|
|
32
|
+
}
|
|
33
|
+
/** The format of one repository's records, kept in `<splatesDir>/format`. */
|
|
34
|
+
export declare class Format {
|
|
35
|
+
readonly splatesDir: string;
|
|
36
|
+
private readonly fs;
|
|
37
|
+
private readonly lock;
|
|
38
|
+
private readonly log;
|
|
39
|
+
private readonly migrations;
|
|
40
|
+
private readonly path;
|
|
41
|
+
constructor(splatesDir: string, { fs, lock, log, migrations }: FormatOptions);
|
|
42
|
+
/** The version this splates reads and writes. */
|
|
43
|
+
get current(): number;
|
|
44
|
+
/**
|
|
45
|
+
* Makes the repository a splates project, as only `splates init` does: stamps
|
|
46
|
+
* records from before formats were stamped as version 1, and a repository
|
|
47
|
+
* with none yet as this splates's. Leaves stamped records alone.
|
|
48
|
+
*/
|
|
49
|
+
create(): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Refuses records in any format but this splates's, which it would misread or
|
|
52
|
+
* overwrite: a newer one until splates is updated, an older one until
|
|
53
|
+
* `splates server` has migrated it. Refuses a repository with none stamped
|
|
54
|
+
* until `splates init` has made it a splates project.
|
|
55
|
+
*/
|
|
56
|
+
check(): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Moves older records forward to this splates's format, a step at a time,
|
|
59
|
+
* then checks them as `check` does.
|
|
60
|
+
*/
|
|
61
|
+
migrate(): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* The stored version, or null for records from before formats were
|
|
64
|
+
* stamped, which are version 1. Refuses one this splates cannot read.
|
|
65
|
+
*/
|
|
66
|
+
private stored;
|
|
67
|
+
private write;
|
|
68
|
+
}
|
package/git.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { type Fs, type Ps } from "webappwiz/system";
|
|
2
|
+
export interface GitResult {
|
|
3
|
+
code: number;
|
|
4
|
+
stdout: string;
|
|
5
|
+
stderr: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Every git call splates makes, scoped to one repository. Agents are not allowed
|
|
9
|
+
* to run these themselves, since going through splates is what makes concurrent
|
|
10
|
+
* work safe, so this is the only place git is spoken.
|
|
11
|
+
*/
|
|
12
|
+
/** What a `Git` works through; the real ones by default. */
|
|
13
|
+
export interface GitOptions {
|
|
14
|
+
ps?: Ps;
|
|
15
|
+
fs?: Fs;
|
|
16
|
+
}
|
|
17
|
+
/** One commit as `Git.log` reads it. */
|
|
18
|
+
export interface Commit {
|
|
19
|
+
hash: string;
|
|
20
|
+
/** When it was written, as ISO 8601. */
|
|
21
|
+
at: string;
|
|
22
|
+
author: string;
|
|
23
|
+
/** Its message's first line. */
|
|
24
|
+
subject: string;
|
|
25
|
+
/** The paths it changed, repo-relative. */
|
|
26
|
+
files: string[];
|
|
27
|
+
}
|
|
28
|
+
export declare class Git {
|
|
29
|
+
/** The main worktree, where trunk lives. */
|
|
30
|
+
readonly root: string;
|
|
31
|
+
private readonly ps;
|
|
32
|
+
private readonly fs;
|
|
33
|
+
constructor(
|
|
34
|
+
/** The main worktree, where trunk lives. */
|
|
35
|
+
root: string, opts?: GitOptions);
|
|
36
|
+
run(cwd: string, ...args: string[]): Promise<GitResult>;
|
|
37
|
+
out(cwd: string, ...args: string[]): Promise<string>;
|
|
38
|
+
branchExists(branch: string): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* The branch `origin/HEAD` points at, or null when the repo has no such ref:
|
|
41
|
+
* no remote, or a clone that never fetched it.
|
|
42
|
+
*/
|
|
43
|
+
defaultBranch(): Promise<string | null>;
|
|
44
|
+
/**
|
|
45
|
+
* The branch checked out at `cwd`, or null where there is none: a detached
|
|
46
|
+
* HEAD, or a directory outside any repository. Any other failure throws, so
|
|
47
|
+
* it is not mistaken for being off a task's branch.
|
|
48
|
+
*/
|
|
49
|
+
currentBranch(cwd: string): Promise<string | null>;
|
|
50
|
+
head(cwd: string): Promise<string>;
|
|
51
|
+
shortHead(cwd: string): Promise<string>;
|
|
52
|
+
porcelain(cwd: string): Promise<string[]>;
|
|
53
|
+
conflictedPaths(cwd: string): Promise<string[]>;
|
|
54
|
+
commitsAhead(trunk: string, branch: string): Promise<number | null>;
|
|
55
|
+
/** When `ref`'s latest commit was committed, as ISO 8601; null when git cannot say. */
|
|
56
|
+
committedAt(ref: string): Promise<string | null>;
|
|
57
|
+
/**
|
|
58
|
+
* The message of each commit on `branch` since it left `trunk`, oldest
|
|
59
|
+
* first; null when git cannot say.
|
|
60
|
+
*/
|
|
61
|
+
commitMessages(trunk: string, branch: string): Promise<string[] | null>;
|
|
62
|
+
/**
|
|
63
|
+
* What `branch` changed since it left `trunk`, as a unified diff, along
|
|
64
|
+
* with all the work still uncommitted in `worktree` when there is one, new
|
|
65
|
+
* files git does not track yet among it; `uncommitted` names the paths
|
|
66
|
+
* that have some. Untrimmed, since a diff's lines keep their leading spaces.
|
|
67
|
+
*/
|
|
68
|
+
diff(trunk: string, branch: string, worktree: string | null): Promise<{
|
|
69
|
+
text: string;
|
|
70
|
+
uncommitted: string[];
|
|
71
|
+
} | null>;
|
|
72
|
+
/**
|
|
73
|
+
* Every path `branch` touches since it left `trunk`, plus what is still
|
|
74
|
+
* uncommitted in `worktree` when there is one: an agent mid-task has usually
|
|
75
|
+
* committed nothing yet, and its edits are the overlap that matters most.
|
|
76
|
+
*/
|
|
77
|
+
changedFiles(trunk: string, branch: string, worktree: string | null): Promise<string[] | null>;
|
|
78
|
+
/**
|
|
79
|
+
* Every path a person might point an agent at in the tree at `cwd`: the
|
|
80
|
+
* files git tracks, the new ones it does not ignore, and each directory
|
|
81
|
+
* above them, which ends in `/`. Sorted, relative to the tree's root.
|
|
82
|
+
*/
|
|
83
|
+
paths(cwd: string): Promise<string[]>;
|
|
84
|
+
/**
|
|
85
|
+
* The latest `count` commits on `ref`, newest first, each with the paths
|
|
86
|
+
* it changed. Empty when `ref` names nothing, as in a repo with no commit.
|
|
87
|
+
*/
|
|
88
|
+
log(ref: string, count: number): Promise<Commit[]>;
|
|
89
|
+
/** Every path git tracks at `ref`, or none when `ref` names nothing. */
|
|
90
|
+
files(ref: string): Promise<string[]>;
|
|
91
|
+
rebase(cwd: string, onto: string): Promise<GitResult>;
|
|
92
|
+
resetHard(cwd: string, commit: string): Promise<GitResult>;
|
|
93
|
+
checkout(branch: string): Promise<GitResult>;
|
|
94
|
+
mergeFfOnly(cwd: string, branch: string): Promise<GitResult>;
|
|
95
|
+
/**
|
|
96
|
+
* The worktree with `branch` checked out, or null when no worktree has it.
|
|
97
|
+
* Git allows one worktree per branch and that is the only place the branch
|
|
98
|
+
* can be advanced, so this is where a fast-forward has to happen.
|
|
99
|
+
*/
|
|
100
|
+
worktreeFor(branch: string): Promise<string | null>;
|
|
101
|
+
addWorktree(branch: string, path: string, from: string): Promise<GitResult>;
|
|
102
|
+
removeWorktree(path: string): Promise<GitResult>;
|
|
103
|
+
/** Drops metadata for worktrees whose directories are gone. */
|
|
104
|
+
pruneWorktrees(): Promise<GitResult>;
|
|
105
|
+
deleteBranch(branch: string): Promise<GitResult>;
|
|
106
|
+
/** The one `.git` every worktree of this repo shares. */
|
|
107
|
+
commonDir(): Promise<string>;
|
|
108
|
+
/** The git directory belonging to a worktree, or null if it has none. */
|
|
109
|
+
worktreeGitDir(worktree: string): Promise<string | null>;
|
|
110
|
+
/** Half-finished merges and rebases a resuming agent is standing in. */
|
|
111
|
+
interruptedOps(worktree: string): Promise<string[]>;
|
|
112
|
+
}
|