@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/stats.d.ts
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import type { Judged } from "./adherence.js";
|
|
2
|
+
import { type Baseline } from "./baselines.js";
|
|
3
|
+
import type { Outcome } from "./outcomes.js";
|
|
4
|
+
import { type MergeFailure, type RemoveReason } from "./worktree.js";
|
|
5
|
+
/** What the Stats page shows: how tasks ended, bar by bar and by who did them. */
|
|
6
|
+
export interface Stats {
|
|
7
|
+
/**
|
|
8
|
+
* Each bar of the period, oldest first, those with nothing ended among
|
|
9
|
+
* them: `start` is when it starts, as an ISO time.
|
|
10
|
+
*/
|
|
11
|
+
buckets: ({
|
|
12
|
+
start: string;
|
|
13
|
+
} & Tally)[];
|
|
14
|
+
/**
|
|
15
|
+
* The as long a span before the period, summed, to compare it with; null
|
|
16
|
+
* for all time, which has nothing before it.
|
|
17
|
+
*/
|
|
18
|
+
previous: Tally | null;
|
|
19
|
+
/** By the model that ended each task in the period, the most first; null for unknown. */
|
|
20
|
+
models: ({
|
|
21
|
+
model: string | null;
|
|
22
|
+
} & Tally)[];
|
|
23
|
+
/**
|
|
24
|
+
* By where the person worked each task in the period from, the most
|
|
25
|
+
* first: null for none, as for an external agent, or one that ended
|
|
26
|
+
* before it was kept.
|
|
27
|
+
*/
|
|
28
|
+
devices: ({
|
|
29
|
+
device: WorkedFrom | null;
|
|
30
|
+
} & Tally)[];
|
|
31
|
+
/** By the main tree each task in the period was in, the most first. */
|
|
32
|
+
projects: ({
|
|
33
|
+
project: string;
|
|
34
|
+
} & Tally)[];
|
|
35
|
+
/**
|
|
36
|
+
* By each system a task in the period touched, the most first: a task
|
|
37
|
+
* counts in each of its systems, and in `null` when it touched none or
|
|
38
|
+
* ended before systems were kept.
|
|
39
|
+
*/
|
|
40
|
+
systems: ({
|
|
41
|
+
system: string | null;
|
|
42
|
+
} & Tally)[];
|
|
43
|
+
/**
|
|
44
|
+
* Who made the calls tasks in the period made, by size: `SIZES` in order, then any
|
|
45
|
+
* other word an older scheme used, then null for those with none, which
|
|
46
|
+
* holds every call from before sizes were kept.
|
|
47
|
+
*/
|
|
48
|
+
sizes: SizeTally[];
|
|
49
|
+
/** When the first outcome was written, the start of what there is to show. */
|
|
50
|
+
since: string | null;
|
|
51
|
+
/**
|
|
52
|
+
* How conversations followed the splates skill, by the version each started
|
|
53
|
+
* on, newest first: over all time, since a version is its own span.
|
|
54
|
+
*/
|
|
55
|
+
skill: SkillVersion[];
|
|
56
|
+
/** Each project's recent merged tasks, to hold one against: over the week before now, whatever the period. */
|
|
57
|
+
baselines: Baseline[];
|
|
58
|
+
}
|
|
59
|
+
/** How a group of ended tasks went, summed. */
|
|
60
|
+
export interface Tally {
|
|
61
|
+
merged: number;
|
|
62
|
+
removed: number;
|
|
63
|
+
/** Of `merged`, those that landed without a person answering a question. */
|
|
64
|
+
clean: number;
|
|
65
|
+
/** Over every task in the group, merged and removed alike. */
|
|
66
|
+
questionRounds: number;
|
|
67
|
+
reviewRounds: number;
|
|
68
|
+
failedMerges: number;
|
|
69
|
+
/** Questions that offered the agent's pick and were answered with a choice. */
|
|
70
|
+
picksAsked: number;
|
|
71
|
+
/** Of `picksAsked`, those answered with another choice. */
|
|
72
|
+
picksOverturned: number;
|
|
73
|
+
/** Of `picksAsked`, those answered with the agent's choice and words added. */
|
|
74
|
+
picksAmended: number;
|
|
75
|
+
/** Calls made without asking. */
|
|
76
|
+
assumptionsMade: number;
|
|
77
|
+
/** Of `assumptionsMade`, those challenged. */
|
|
78
|
+
assumptionsChallenged: number;
|
|
79
|
+
/** Calls the person made: questions put to them, assumptions challenged. */
|
|
80
|
+
decidedByYou: number;
|
|
81
|
+
/** Calls agents made that stood without the person: assumptions left alone. */
|
|
82
|
+
decidedByAgents: number;
|
|
83
|
+
/** Tasks whose time waiting on a person was kept; older ones were not. */
|
|
84
|
+
timed: number;
|
|
85
|
+
/** Of the `timed` tasks, how long they waited on a person, in milliseconds. */
|
|
86
|
+
waitedMs: number;
|
|
87
|
+
/** Of the `timed` tasks, how long they took from add to end, in milliseconds. */
|
|
88
|
+
spentMs: number;
|
|
89
|
+
/** Tasks whose own usage was kept; older ones and external agents' were not. */
|
|
90
|
+
used: number;
|
|
91
|
+
/** Of the `used` tasks, tokens read, those from cache among them, and written. */
|
|
92
|
+
inputTokens: number;
|
|
93
|
+
outputTokens: number;
|
|
94
|
+
/** Of the `used` tasks, those whose agent said what they cost; Codex does not. */
|
|
95
|
+
costed: number;
|
|
96
|
+
/** Of the `costed` tasks, what they cost, summed. */
|
|
97
|
+
cost: number;
|
|
98
|
+
/** Of the `used` tasks, how long their agents worked, in milliseconds. */
|
|
99
|
+
workedMs: number;
|
|
100
|
+
/** Tasks whose diff size was kept. */
|
|
101
|
+
sized: number;
|
|
102
|
+
/** Of the `sized` tasks, the files and lines they changed. */
|
|
103
|
+
filesChanged: number;
|
|
104
|
+
linesAdded: number;
|
|
105
|
+
linesRemoved: number;
|
|
106
|
+
/** Failed merges by why, where it was kept. */
|
|
107
|
+
failedBy: Record<MergeFailure, number>;
|
|
108
|
+
/** Removed tasks by why; `unsaid` for one removed without `--reason`, or before it was kept. */
|
|
109
|
+
removedFor: Record<RemoveReason | "unsaid", number>;
|
|
110
|
+
}
|
|
111
|
+
/** Who made the calls of one size: the person, or agents without asking. */
|
|
112
|
+
export interface SizeTally extends Decided {
|
|
113
|
+
size: string | null;
|
|
114
|
+
/** The same, bar by bar, in the order of `Stats.buckets`. */
|
|
115
|
+
buckets: Decided[];
|
|
116
|
+
/** The same over the as long a span before, as `Stats.previous`; null for all time. */
|
|
117
|
+
previous: Decided | null;
|
|
118
|
+
}
|
|
119
|
+
/** How many calls the person made, and how many agents made without them. */
|
|
120
|
+
export interface Decided {
|
|
121
|
+
decidedByYou: number;
|
|
122
|
+
decidedByAgents: number;
|
|
123
|
+
}
|
|
124
|
+
/** Where the person spoke to a task's conversation from: a phone, a desktop, or both. */
|
|
125
|
+
export type WorkedFrom = "phone" | "desktop" | "both";
|
|
126
|
+
/** Where `outcome`'s prompts came from, or null when none was said from the page. */
|
|
127
|
+
export declare function workedFrom(outcome: Outcome): WorkedFrom | null;
|
|
128
|
+
/**
|
|
129
|
+
* The spans the page can look at, as `?period=` names them: how long each
|
|
130
|
+
* runs back from now, and how long each of its bars is.
|
|
131
|
+
*/
|
|
132
|
+
export declare const PERIODS: {
|
|
133
|
+
readonly "6h": {
|
|
134
|
+
readonly span: number;
|
|
135
|
+
readonly bucket: number;
|
|
136
|
+
};
|
|
137
|
+
readonly "1d": {
|
|
138
|
+
readonly span: number;
|
|
139
|
+
readonly bucket: number;
|
|
140
|
+
};
|
|
141
|
+
readonly "3d": {
|
|
142
|
+
readonly span: number;
|
|
143
|
+
readonly bucket: number;
|
|
144
|
+
};
|
|
145
|
+
readonly "7d": {
|
|
146
|
+
readonly span: number;
|
|
147
|
+
readonly bucket: number;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
/** A span in `PERIODS`, or `all` for all time, a bar a week. */
|
|
151
|
+
export type PeriodId = keyof typeof PERIODS | "all";
|
|
152
|
+
export declare function isPeriodId(value: string): value is PeriodId;
|
|
153
|
+
/** How long each bar of `period` is, in milliseconds: a week for all time. */
|
|
154
|
+
export declare function bucketOf(period: PeriodId): number;
|
|
155
|
+
export interface SummarizeOptions {
|
|
156
|
+
period?: PeriodId;
|
|
157
|
+
now?: Date;
|
|
158
|
+
/** Each conversation's skill checks as last judged. */
|
|
159
|
+
judged?: Judged[];
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Sums the outcomes written so far for the page, over `period`. A part,
|
|
163
|
+
* which lands on its caller's branch rather than trunk, is left out: it is a
|
|
164
|
+
* piece of a task that is counted when its caller ends.
|
|
165
|
+
*/
|
|
166
|
+
export declare function summarize(outcomes: Outcome[], { period, now, judged }?: SummarizeOptions): Stats;
|
|
167
|
+
/** Tallies added up, as for the bars of a period. */
|
|
168
|
+
export declare function combine(tallies: Tally[]): Tally;
|
|
169
|
+
/** How one check went over the conversations on one skill version. */
|
|
170
|
+
export interface CheckRate {
|
|
171
|
+
id: string;
|
|
172
|
+
rule: string;
|
|
173
|
+
/** The conversations it applied in. */
|
|
174
|
+
applied: number;
|
|
175
|
+
/** Of `applied`, those where it passed every time. */
|
|
176
|
+
passed: number;
|
|
177
|
+
}
|
|
178
|
+
/** How the conversations on one splates skill version followed it. */
|
|
179
|
+
export interface SkillVersion {
|
|
180
|
+
/** Null for conversations whose version is unknown. */
|
|
181
|
+
skill: string | null;
|
|
182
|
+
conversations: number;
|
|
183
|
+
checks: CheckRate[];
|
|
184
|
+
}
|
|
185
|
+
/** Each skill version's pass rates, the newest version first and unknown last. */
|
|
186
|
+
export declare function rates(judged: Judged[]): SkillVersion[];
|
package/supervise.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Ps } from "webappwiz/system";
|
|
2
|
+
import { type Timer } from "webappwiz/time";
|
|
3
|
+
/** What a server exits with to be started again as it was. */
|
|
4
|
+
export declare const RESTART = 75;
|
|
5
|
+
/** What a server exits with to be started again on the newest splates. */
|
|
6
|
+
export declare const UPDATE = 76;
|
|
7
|
+
/**
|
|
8
|
+
* Set in the server's environment, so the `splates server` it runs serves rather
|
|
9
|
+
* than supervising another.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SERVING = "SPLATES_DEV_SERVING";
|
|
12
|
+
/**
|
|
13
|
+
* Set in the server's environment to tell it its page failed to build, so
|
|
14
|
+
* the page says it may be out of date.
|
|
15
|
+
*/
|
|
16
|
+
export declare const UNBUILT = "SPLATES_DEV_UNBUILT";
|
|
17
|
+
/** What `supervise` starts the server with, beyond the process it runs in. */
|
|
18
|
+
export interface SuperviseOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Builds the page, run before each start of the same splates, as from a
|
|
21
|
+
* checkout, whose page `bun install` built last and the commits since may
|
|
22
|
+
* have changed, packages they added included; null for one installed from
|
|
23
|
+
* npm, whose page shipped built.
|
|
24
|
+
*/
|
|
25
|
+
build?: {
|
|
26
|
+
argv: string[];
|
|
27
|
+
cwd: string;
|
|
28
|
+
} | null;
|
|
29
|
+
/** Added to the server's environment, as a slot's home is. */
|
|
30
|
+
env?: Record<string, string>;
|
|
31
|
+
/** Where the server runs, the working directory by default. */
|
|
32
|
+
cwd?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The arguments of a worker to run beside the server, as `["worker",
|
|
35
|
+
* "run"]`: started again whenever it ends, on the newest splates once the
|
|
36
|
+
* server updates, and stopped with this. Null for none.
|
|
37
|
+
*/
|
|
38
|
+
worker?: string[] | null;
|
|
39
|
+
timer?: Timer;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Runs `splates server` as a child of this process, sharing its terminal, and
|
|
43
|
+
* starts another each time the child exits to restart: as this one was
|
|
44
|
+
* started, or on the newest splates when it asks to update. Ctrl-C reaches the
|
|
45
|
+
* child too, and its exit ends this. A SIGTERM or SIGHUP to this one stops the
|
|
46
|
+
* child with a SIGTERM and ends this, since the child would otherwise outlive
|
|
47
|
+
* it, listening on its port. A `worker` runs beside it as a second child.
|
|
48
|
+
* Answers with the exit code to end on.
|
|
49
|
+
*/
|
|
50
|
+
export declare function supervise(ps: Ps, { build, env, cwd, worker, timer, }?: SuperviseOptions): Promise<number>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Commit } from "./git.js";
|
|
2
|
+
import type { Systems } from "./systems.js";
|
|
3
|
+
/** How many of trunk's latest commits the Systems page looks through. */
|
|
4
|
+
export declare const RECENT_COMMITS = 500;
|
|
5
|
+
/** How many of those commits each system lists, newest first. */
|
|
6
|
+
export declare const CHANGES_SHOWN = 10;
|
|
7
|
+
/**
|
|
8
|
+
* How many uncovered files a directory holds before they are split into
|
|
9
|
+
* groups by the first word of their names.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SPLIT = 30;
|
|
12
|
+
/** One commit that changed a system. */
|
|
13
|
+
export type Change = Omit<Commit, "files">;
|
|
14
|
+
/** What one system is made of on trunk, and how it moved lately. */
|
|
15
|
+
export interface SystemChanges {
|
|
16
|
+
/** The system's name. */
|
|
17
|
+
name: string;
|
|
18
|
+
/** How many files trunk tracks in it. */
|
|
19
|
+
files: number;
|
|
20
|
+
/** Its globs that take in no file trunk tracks. */
|
|
21
|
+
unmatched: string[];
|
|
22
|
+
/** How many of the commits looked through changed it. */
|
|
23
|
+
changed: number;
|
|
24
|
+
/** The latest of them, up to `CHANGES_SHOWN`, newest first. */
|
|
25
|
+
changes: Change[];
|
|
26
|
+
/**
|
|
27
|
+
* Each other system some of those commits changed too, the most first.
|
|
28
|
+
* A task lands as one commit, so this is how often its tasks reach there.
|
|
29
|
+
*/
|
|
30
|
+
overlaps: Overlap[];
|
|
31
|
+
}
|
|
32
|
+
/** Another system that commits changing one system changed too. */
|
|
33
|
+
export interface Overlap {
|
|
34
|
+
/** The other system's name. */
|
|
35
|
+
name: string;
|
|
36
|
+
/** How many of the commits changing both. */
|
|
37
|
+
changed: number;
|
|
38
|
+
}
|
|
39
|
+
/** What the Systems page reads: every system, and how far back it looked. */
|
|
40
|
+
export interface SystemsReport {
|
|
41
|
+
systems: SystemChanges[];
|
|
42
|
+
/** When the oldest commit looked through was written, or null for none. */
|
|
43
|
+
since: string | null;
|
|
44
|
+
/** How many commits were looked through. */
|
|
45
|
+
scanned: number;
|
|
46
|
+
/** How many files trunk tracks that no system covers. */
|
|
47
|
+
uncovered: number;
|
|
48
|
+
/**
|
|
49
|
+
* Those files as globs: those of several files first, then each lot
|
|
50
|
+
* changed most lately first.
|
|
51
|
+
*/
|
|
52
|
+
groups: Uncovered[];
|
|
53
|
+
}
|
|
54
|
+
/** Files no system covers, as one glob a system could be named for. */
|
|
55
|
+
export interface Uncovered {
|
|
56
|
+
/** A glob taking in the files, such as `src/upload/*` or `src/upload*`. */
|
|
57
|
+
glob: string;
|
|
58
|
+
/** How many uncovered files it takes in. */
|
|
59
|
+
files: number;
|
|
60
|
+
/** How many of the commits looked through changed one of them. */
|
|
61
|
+
changed: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* How each of `systems` stands in a tree whose tracked files are `files`,
|
|
65
|
+
* and which of `commits`, newest first, changed it.
|
|
66
|
+
*/
|
|
67
|
+
export declare function systemsReport(systems: Systems, files: string[], commits: Commit[]): SystemsReport;
|
package/system.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Logger } from "webappwiz/log";
|
|
2
|
+
import type { Fs } from "webappwiz/system";
|
|
3
|
+
import type { Git } from "./git.js";
|
|
4
|
+
import type { WorktreeService } from "./worktree-service.js";
|
|
5
|
+
export interface ShowSystemsOptions {
|
|
6
|
+
/** A system to print alone, by its name or an alias. */
|
|
7
|
+
name?: string;
|
|
8
|
+
/** Print only the systems this task's changed files fall in. */
|
|
9
|
+
task?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The task the command runs in, read off the current branch: with no
|
|
12
|
+
* `task`, its worktree's systems are the ones read.
|
|
13
|
+
*/
|
|
14
|
+
here?: string | null;
|
|
15
|
+
/** Print the systems as JSON instead of prose. */
|
|
16
|
+
json?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The systems `splates.systems.ts` names: every one, one by name, or those a
|
|
20
|
+
* task touches. Read from the task's own worktree, so one it names counts
|
|
21
|
+
* before it lands.
|
|
22
|
+
*/
|
|
23
|
+
export declare function systems({ service, git, fs, log, }: {
|
|
24
|
+
service: WorktreeService;
|
|
25
|
+
git: Git;
|
|
26
|
+
fs: Fs;
|
|
27
|
+
log: Logger;
|
|
28
|
+
}, { name, task, here, json }?: ShowSystemsOptions): Promise<void>;
|
package/systems.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { type Fs, type Glob } from "webappwiz/system";
|
|
2
|
+
/** The file a repo names its systems in, at its root. */
|
|
3
|
+
export declare const SYSTEMS_FILE = "splates.systems.ts";
|
|
4
|
+
/** One named part of the code: the files it is made of. */
|
|
5
|
+
export interface System {
|
|
6
|
+
/** What it is for in one short line, never how it works, which goes stale. */
|
|
7
|
+
description?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Other names people call it by, at most two, so one part of the code
|
|
10
|
+
* keeps one word for it.
|
|
11
|
+
*/
|
|
12
|
+
aliases?: string[];
|
|
13
|
+
/** Repo-relative globs of the files it is made of. */
|
|
14
|
+
globs: string[];
|
|
15
|
+
/** Globs of files the `globs` take in that are not part of it. */
|
|
16
|
+
ignore?: string[];
|
|
17
|
+
}
|
|
18
|
+
/** A system with the name `splates.systems.ts` keys it by. */
|
|
19
|
+
export interface NamedSystem extends System {
|
|
20
|
+
name: string;
|
|
21
|
+
}
|
|
22
|
+
/** Configures where {@link Systems.at} reads and how it matches. */
|
|
23
|
+
export interface SystemsOptions {
|
|
24
|
+
/** What `splates.systems.ts` is read through; the real one by default. */
|
|
25
|
+
fs?: Fs;
|
|
26
|
+
/** What paths are matched against globs with; `node:path`'s by default. */
|
|
27
|
+
glob?: Glob;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* What `splates.systems.ts` exports as its default, keyed by name:
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* import type { SystemsFile } from "@stringsync/splates/systems";
|
|
34
|
+
*
|
|
35
|
+
* export default {
|
|
36
|
+
* playback: { description: "Playing a song", globs: ["src/audio/**"] },
|
|
37
|
+
* } satisfies SystemsFile;
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* The import is only a type, so a reader can import the file without splates
|
|
41
|
+
* installed.
|
|
42
|
+
*/
|
|
43
|
+
export type SystemsFile = Record<string, System>;
|
|
44
|
+
/**
|
|
45
|
+
* The systems one tree's `splates.systems.ts` names, and which of them a set of
|
|
46
|
+
* paths falls in.
|
|
47
|
+
*/
|
|
48
|
+
export declare class Systems {
|
|
49
|
+
private readonly named;
|
|
50
|
+
private readonly glob;
|
|
51
|
+
private constructor();
|
|
52
|
+
/**
|
|
53
|
+
* The systems the tree at `root` names as it stands now: read afresh, so
|
|
54
|
+
* one named in a task's worktree counts there at once.
|
|
55
|
+
*/
|
|
56
|
+
static at(root: string, opts?: SystemsOptions): Promise<Systems>;
|
|
57
|
+
static of(systems: Record<string, System>, glob?: Glob): Systems;
|
|
58
|
+
/** Every system, in the order `splates.systems.ts` names them. */
|
|
59
|
+
all(): NamedSystem[];
|
|
60
|
+
/** The system called `name`, by its name or one of its aliases. */
|
|
61
|
+
find(name: string): NamedSystem | null;
|
|
62
|
+
/** The systems any of `paths`, repo-relative, falls in. */
|
|
63
|
+
touchedBy(paths: string[]): NamedSystem[];
|
|
64
|
+
/** Those of `paths`, repo-relative, that fall in `system`. */
|
|
65
|
+
within(system: System, paths: string[]): string[];
|
|
66
|
+
/**
|
|
67
|
+
* The globs of `system` that take in none of `paths`: as a rule, ones
|
|
68
|
+
* left behind when the files they named moved.
|
|
69
|
+
*/
|
|
70
|
+
unmatched(system: System, paths: string[]): string[];
|
|
71
|
+
/**
|
|
72
|
+
* The systems `text` mentions as `#name` or `#alias`, each once, in the
|
|
73
|
+
* order first mentioned. A `#` that names no system, such as `#12`, is
|
|
74
|
+
* left alone.
|
|
75
|
+
*/
|
|
76
|
+
mentioned(text: string): NamedSystem[];
|
|
77
|
+
/**
|
|
78
|
+
* The words `text` mentions as `#word` that no system answers to, each
|
|
79
|
+
* once, in the order first mentioned. A number, such as `#12`, is a todo
|
|
80
|
+
* rather than a system, and one in code means something else.
|
|
81
|
+
*/
|
|
82
|
+
unknown(text: string): string[];
|
|
83
|
+
private contains;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Each word `text` mentions as `#word` outside code, once, in the order first
|
|
87
|
+
* mentioned: in code, a `#` means something else.
|
|
88
|
+
*/
|
|
89
|
+
export declare function hashed(text: string): string[];
|
|
90
|
+
/**
|
|
91
|
+
* One line telling an agent what a mentioned system is made of:
|
|
92
|
+
*
|
|
93
|
+
* ```
|
|
94
|
+
* #playback (player, audio engine): Playing a song. Made of src/player/**, src/audio/**; not src/player/*.test.ts
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export declare function mentionLine(system: NamedSystem): string;
|
|
98
|
+
/**
|
|
99
|
+
* One line asking an agent to find the code an unknown `#name` means, so the
|
|
100
|
+
* user can name it as a system, or give one that covers it the alias.
|
|
101
|
+
*/
|
|
102
|
+
export declare function unknownLine(name: string): string;
|
|
103
|
+
/** The longest {@link System.description} splates takes. */
|
|
104
|
+
export declare const DESCRIPTION_MAX = 80;
|
|
105
|
+
/**
|
|
106
|
+
* The systems `root`'s `splates.systems.ts` names, checked, or none when there
|
|
107
|
+
* is no such file. Read afresh each time, so a long-running `splates server` sees a
|
|
108
|
+
* system named mid-task without a restart. Throws while `splates.config.ts`
|
|
109
|
+
* still names systems, which `splates update` moves.
|
|
110
|
+
*/
|
|
111
|
+
export declare function readSystems(root: string, fs?: Fs): Promise<Record<string, System>>;
|
|
112
|
+
/**
|
|
113
|
+
* `systems` in the shape {@link System} names, or throws
|
|
114
|
+
* naming `path` for one that is not, one with more than two aliases or a
|
|
115
|
+
* description longer than one short line, or two
|
|
116
|
+
* that answer to the same name, which would leave `splates systems <name>`
|
|
117
|
+
* guessing.
|
|
118
|
+
*/
|
|
119
|
+
export declare function checkSystems(path: string, systems: unknown): Record<string, System>;
|
package/systems.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SYSTEMS_FILE2,
|
|
3
|
+
Systems2,
|
|
4
|
+
hashed2,
|
|
5
|
+
mentionLine2,
|
|
6
|
+
unknownLine2,
|
|
7
|
+
DESCRIPTION_MAX2,
|
|
8
|
+
readSystems2,
|
|
9
|
+
checkSystems2
|
|
10
|
+
} from "./index-4776671w.js";
|
|
11
|
+
import"./index-k73tsw5g.js";
|
|
12
|
+
export {
|
|
13
|
+
DESCRIPTION_MAX2 as DESCRIPTION_MAX,
|
|
14
|
+
SYSTEMS_FILE2 as SYSTEMS_FILE,
|
|
15
|
+
Systems2 as Systems,
|
|
16
|
+
checkSystems2 as checkSystems,
|
|
17
|
+
hashed2 as hashed,
|
|
18
|
+
mentionLine2 as mentionLine,
|
|
19
|
+
readSystems2 as readSystems,
|
|
20
|
+
unknownLine2 as unknownLine
|
|
21
|
+
};
|
package/table.d.ts
ADDED
package/task-log.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Fs } from "webappwiz/system";
|
|
2
|
+
/** What a task's turns used, apart from the rest of its conversation's. */
|
|
3
|
+
export interface TaskUsage {
|
|
4
|
+
/** Tokens read, those from cache among them. */
|
|
5
|
+
input: number;
|
|
6
|
+
cached: number;
|
|
7
|
+
output: number;
|
|
8
|
+
/** What it cost; null for an agent that never says, as Codex does not. */
|
|
9
|
+
cost: {
|
|
10
|
+
amount: number;
|
|
11
|
+
currency: string;
|
|
12
|
+
} | null;
|
|
13
|
+
}
|
|
14
|
+
/** What a task's stretch of its conversation shows of how the work went. */
|
|
15
|
+
export interface TaskLog {
|
|
16
|
+
/** OpenCode observations have different scope; kept in the conversation, not legacy task totals. */
|
|
17
|
+
usage: TaskUsage | undefined;
|
|
18
|
+
/** Each agent turn's span, start to last move, summed. */
|
|
19
|
+
workedMs: number;
|
|
20
|
+
/** When the person stopped the agent's turn, each time. */
|
|
21
|
+
stopped: string[];
|
|
22
|
+
/** When a lost connection cut the agent's turn short, each time. */
|
|
23
|
+
interrupted: string[];
|
|
24
|
+
/** How many times each command failed. */
|
|
25
|
+
failedCommands: Record<string, number>;
|
|
26
|
+
/** Lines the agent's edits took out and put in, its plan's aside. */
|
|
27
|
+
editedLines: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Reads the conversation logged at `log` from `since` to `until`: a
|
|
31
|
+
* conversation can outlive the task, or come to it already under way. Null
|
|
32
|
+
* when there is no such log. Read raw rather than replayed, since the agent
|
|
33
|
+
* merging is still writing it.
|
|
34
|
+
*/
|
|
35
|
+
export declare function taskLog(log: string, fs: Fs, since: string, until: string): Promise<TaskLog | null>;
|
package/task-ports.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ListeningEntry, ProcessEntry } from "webappwiz/system";
|
|
2
|
+
/** What ties a process to a task: its worktree, and the agents at work in it. */
|
|
3
|
+
export interface PortOwners {
|
|
4
|
+
worktrees: {
|
|
5
|
+
task: string;
|
|
6
|
+
path: string;
|
|
7
|
+
}[];
|
|
8
|
+
/** The pid of each agent `splates server` runs in a task. */
|
|
9
|
+
agents: {
|
|
10
|
+
task: string;
|
|
11
|
+
pid: number;
|
|
12
|
+
}[];
|
|
13
|
+
}
|
|
14
|
+
/** One port a task's processes listen on, on the worker that runs them. */
|
|
15
|
+
export interface TaskPort {
|
|
16
|
+
task: string;
|
|
17
|
+
port: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The ports each task serves, as an editor finds the ports to forward: each
|
|
21
|
+
* one a process listens on that runs in the task's worktree, or under one of
|
|
22
|
+
* its agents, whatever directory it moved to. Each port once, in the order
|
|
23
|
+
* of its task, then its number.
|
|
24
|
+
*/
|
|
25
|
+
export declare function taskPorts(table: ProcessEntry[], listening: ListeningEntry[], owners: PortOwners): TaskPort[];
|
package/tell.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Logger } from "webappwiz/log";
|
|
2
|
+
import type { Ps } from "webappwiz/system";
|
|
3
|
+
import type { Projects } from "./projects.js";
|
|
4
|
+
import type { Worktree } from "./worktree.js";
|
|
5
|
+
import type { WorktreeService } from "./worktree-service.js";
|
|
6
|
+
/** What `fetch` is used for here, so a test can stand in for it. */
|
|
7
|
+
type Send = (url: string, init: RequestInit) => Promise<Response>;
|
|
8
|
+
/**
|
|
9
|
+
* The two ends of a task one conversation handed to an agent with `splates add
|
|
10
|
+
* --agent`: the caller that handed it out, and the conversation `splates server`
|
|
11
|
+
* started for the agent. Null for any other task, which answers to the user
|
|
12
|
+
* alone.
|
|
13
|
+
*/
|
|
14
|
+
export declare function handOff(worktree: Worktree): {
|
|
15
|
+
caller: string;
|
|
16
|
+
conversation: string;
|
|
17
|
+
} | null;
|
|
18
|
+
/**
|
|
19
|
+
* Says `text` in the conversation of the agent a task was handed to, as the
|
|
20
|
+
* user would, for the conversation that handed it out to wake it, pass on
|
|
21
|
+
* answers, or what the earlier steps of its lane taught it; with `stop`, its
|
|
22
|
+
* running turn stopped first, for a change of plans. Only that conversation
|
|
23
|
+
* may, not whoever else asks. Answers with that agent's conversation.
|
|
24
|
+
*/
|
|
25
|
+
export declare function tell({ ps, service, send, }: {
|
|
26
|
+
ps: Ps;
|
|
27
|
+
service: WorktreeService;
|
|
28
|
+
send?: Send;
|
|
29
|
+
}, task: string, text: string, { stop }?: {
|
|
30
|
+
stop?: boolean;
|
|
31
|
+
}): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Tells the conversation that handed `worktree` out that the task stopped,
|
|
34
|
+
* escalated, merged or removed, with `[SPLATES REPORT <task>]`, when its agent
|
|
35
|
+
* answers to that conversation, or that conversation is another project's. Run before the record
|
|
36
|
+
* goes, by the command that stops it. Outside `splates server`, or for a task
|
|
37
|
+
* nobody handed out, it says nothing; a server that cannot be reached is
|
|
38
|
+
* worth a line, never a failure, since the command has done its work.
|
|
39
|
+
*/
|
|
40
|
+
export declare function reportToCaller({ ps, log, service, projects, send, }: {
|
|
41
|
+
ps: Ps;
|
|
42
|
+
log: Logger;
|
|
43
|
+
service: WorktreeService;
|
|
44
|
+
projects: Projects;
|
|
45
|
+
send?: Send;
|
|
46
|
+
}, worktree: Worktree): Promise<void>;
|
|
47
|
+
export {};
|
package/todo-edit.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type Logger } from "webappwiz/log";
|
|
2
|
+
import type { Fs, Ps } from "webappwiz/system";
|
|
3
|
+
import type { Facts } from "./events.js";
|
|
4
|
+
import type { AgentPick } from "./roster.js";
|
|
5
|
+
import type { Todo, TodoOrigin } from "./todo.js";
|
|
6
|
+
import type { Todos } from "./todos.js";
|
|
7
|
+
export interface TodoFileOptions {
|
|
8
|
+
/** Files to attach, relative to the current directory or absolute. */
|
|
9
|
+
files?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface TodoAddOptions extends TodoFileOptions {
|
|
12
|
+
/** Whatever more there is to say than the subject. */
|
|
13
|
+
text?: string;
|
|
14
|
+
/** Where it goes in the list, 1 at the top; the bottom by default. */
|
|
15
|
+
position?: number;
|
|
16
|
+
/** The todos blocking it: each has to merge before it starts. */
|
|
17
|
+
blockedBy?: number[];
|
|
18
|
+
/** The lane it goes in, `"new"` for one of its own; none by default. */
|
|
19
|
+
lane?: number | "new" | null;
|
|
20
|
+
/** The agent that should work it; none by default. */
|
|
21
|
+
assignee?: AgentPick | null;
|
|
22
|
+
/** The other project it is added from; none by default. */
|
|
23
|
+
origin?: TodoOrigin;
|
|
24
|
+
}
|
|
25
|
+
export declare function todoAdd(deps: {
|
|
26
|
+
todos: Todos;
|
|
27
|
+
log: Logger;
|
|
28
|
+
fs: Fs;
|
|
29
|
+
ps: Ps;
|
|
30
|
+
}, subject: string, from: string | null, { text, files, position, blockedBy, lane, assignee, origin, }?: TodoAddOptions): Promise<Todo>;
|
|
31
|
+
/** What a `todo add` event says of the todo it added. */
|
|
32
|
+
export declare function addedFacts(todo: Todo): Facts["todo add"];
|
|
33
|
+
export interface TodoUpdateOptions extends TodoFileOptions {
|
|
34
|
+
/** A new line; the old one stays when this is absent or empty. */
|
|
35
|
+
subject?: string;
|
|
36
|
+
/** New detail; the old stays when this is absent or empty. */
|
|
37
|
+
text?: string;
|
|
38
|
+
/** Where to move it in the list, 1 at the top; it stays put when absent. */
|
|
39
|
+
position?: number;
|
|
40
|
+
/** Attached files to drop, by path or by the name they were stored under. */
|
|
41
|
+
removeFiles?: string[];
|
|
42
|
+
/** Todos blocking it from now on, besides those that already do. */
|
|
43
|
+
blockedBy?: number[];
|
|
44
|
+
/** Todos no longer blocking it. */
|
|
45
|
+
removeBlockedBy?: number[];
|
|
46
|
+
/** The lane it moves to, `"new"` for one of its own, null for none; it stays when absent. */
|
|
47
|
+
lane?: number | "new" | null;
|
|
48
|
+
/** The agent that should work it, null for none; it stays when absent. */
|
|
49
|
+
assignee?: AgentPick | null;
|
|
50
|
+
}
|
|
51
|
+
export declare function todoUpdate(deps: {
|
|
52
|
+
todos: Todos;
|
|
53
|
+
log: Logger;
|
|
54
|
+
fs: Fs;
|
|
55
|
+
ps: Ps;
|
|
56
|
+
}, id: number, { subject, text, position, files, removeFiles, blockedBy, removeBlockedBy, lane, assignee, }?: TodoUpdateOptions): Promise<Todo>;
|
|
57
|
+
export declare function todoRemove({ todos, log }: {
|
|
58
|
+
todos: Todos;
|
|
59
|
+
log: Logger;
|
|
60
|
+
}, id: number): Promise<Todo>;
|