@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,90 @@
|
|
|
1
|
+
import { type Conversations } from "./conversations.js";
|
|
2
|
+
import type { Project } from "./dev-project.js";
|
|
3
|
+
import { Everywhere } from "./everywhere.js";
|
|
4
|
+
/**
|
|
5
|
+
* How a project's page talks to agents: starting, prompting and steering its
|
|
6
|
+
* conversations, and hearing each change to them as it streams. Each handler
|
|
7
|
+
* is a property, so `serveProject` spreads them into the project's routes;
|
|
8
|
+
* what they work on stays private, out of the spread.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ConversationRoutes {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(project: Project, conversations: Conversations | null, everywhere?: Everywhere | null);
|
|
13
|
+
held(): Conversations;
|
|
14
|
+
/**
|
|
15
|
+
* Asks every conversation at work for a checkpoint, or only those `only`
|
|
16
|
+
* names by id, without waiting on the agents, passing over the idle ones,
|
|
17
|
+
* whose turn has ended already: one whose task is merging
|
|
18
|
+
* gets to finish the merge first. While one is still asked, the
|
|
19
|
+
* checkpoint under way stands, and nothing is asked again. Answers with
|
|
20
|
+
* what settles as each asked answers.
|
|
21
|
+
*/
|
|
22
|
+
readonly checkpoint: (only?: string[]) => Promise<Promise<void>[]>;
|
|
23
|
+
/** Asks the agents that do not send their limits for them, now and then. */
|
|
24
|
+
readonly refreshLimits: () => Promise<Response>;
|
|
25
|
+
readonly listConversations: () => Promise<Response>;
|
|
26
|
+
/** The tree a terminal opens in: `?task=`'s worktree, or the main tree. */
|
|
27
|
+
readonly terminalTree: (request: Request) => Promise<string>;
|
|
28
|
+
readonly startConversation: (request: Request) => Promise<Response>;
|
|
29
|
+
/**
|
|
30
|
+
* The sessions the agents hold in `?task=`'s tree that no conversation
|
|
31
|
+
* does, such as ones started in their CLI, to bring in.
|
|
32
|
+
*/
|
|
33
|
+
readonly listSessions: (request: Request) => Promise<Response>;
|
|
34
|
+
/** Brings in a session an agent holds, as a conversation in `task`'s tree. */
|
|
35
|
+
readonly bringSession: (request: Request) => Promise<Response>;
|
|
36
|
+
readonly moveConversation: (request: Request) => Promise<Response>;
|
|
37
|
+
readonly promptConversation: (request: Request) => Promise<Response>;
|
|
38
|
+
readonly conversationAttachment: (request: Request) => Promise<Response>;
|
|
39
|
+
readonly conversationArtifact: (request: Request) => Promise<Response>;
|
|
40
|
+
readonly answerConversation: (request: Request) => Promise<Response>;
|
|
41
|
+
readonly cancelConversation: (request: Request) => Promise<Response>;
|
|
42
|
+
/**
|
|
43
|
+
* Checkpoints a running agent for the person and leaves it stopped,
|
|
44
|
+
* answering without waiting on the agent; one whose task is merging gets
|
|
45
|
+
* to finish the merge first.
|
|
46
|
+
*/
|
|
47
|
+
readonly pauseConversation: (request: Request) => Promise<Response>;
|
|
48
|
+
/** What a background command prints, as it prints it, until it ends. */
|
|
49
|
+
readonly backgroundOutput: (request: Request) => Promise<Response>;
|
|
50
|
+
readonly stopBackground: (request: Request) => Promise<Response>;
|
|
51
|
+
readonly unqueueConversation: (request: Request) => Promise<Response>;
|
|
52
|
+
readonly sendQueuedNow: (request: Request) => Promise<Response>;
|
|
53
|
+
readonly chooseSetting: (request: Request) => Promise<Response>;
|
|
54
|
+
readonly renameConversation: (request: Request) => Promise<Response>;
|
|
55
|
+
readonly markUnread: (request: Request) => Promise<Response>;
|
|
56
|
+
readonly pinConversation: (request: Request) => Promise<Response>;
|
|
57
|
+
readonly reparentConversation: (request: Request) => Promise<Response>;
|
|
58
|
+
readonly archiveConversation: (request: Request) => Promise<Response>;
|
|
59
|
+
/**
|
|
60
|
+
* Says `text` in a conversation as the person would, for the conversation
|
|
61
|
+
* that handed it its task, as `splates tell` does: the one way in to one
|
|
62
|
+
* that answers to it, and how a lane's orchestrator wakes or stops one it
|
|
63
|
+
* started. With `stop`, the running turn stops first.
|
|
64
|
+
*/
|
|
65
|
+
readonly tellConversation: (request: Request) => Promise<Response>;
|
|
66
|
+
readonly addArtifact: (request: Request) => Promise<Response>;
|
|
67
|
+
readonly removeArtifact: (request: Request) => Promise<Response>;
|
|
68
|
+
readonly deleteArtifactVersion: (request: Request) => Promise<Response>;
|
|
69
|
+
/**
|
|
70
|
+
* The person's way out of a handed-out agent: stops its turn and its
|
|
71
|
+
* process, and tells the conversation that handed it out, which decides
|
|
72
|
+
* what becomes of the task. Its next word from that one resumes it.
|
|
73
|
+
*/
|
|
74
|
+
readonly terminateConversation: (request: Request) => Promise<Response>;
|
|
75
|
+
readonly conversationEvents: () => Promise<Response>;
|
|
76
|
+
disposeAsync(): Promise<void>;
|
|
77
|
+
/** Where a conversation for `task` runs: its worktree, or the main tree. */
|
|
78
|
+
/**
|
|
79
|
+
* `task`'s name, worktree, the branch it was cut from, and the
|
|
80
|
+
* conversation whose agent added it.
|
|
81
|
+
*/
|
|
82
|
+
private treeFor;
|
|
83
|
+
/**
|
|
84
|
+
* Whether a task landing on `base` is a part of `task`, or a part of one
|
|
85
|
+
* of its parts, following each base back while it is a task's branch.
|
|
86
|
+
*/
|
|
87
|
+
private isPartOf;
|
|
88
|
+
/** The conversation a `/api/conversations/<id>` path names. */
|
|
89
|
+
private conversationAt;
|
|
90
|
+
}
|
package/dev-creds.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Project } from "./dev-project.js";
|
|
2
|
+
import type { ProjectWatch } from "./dev-project-watch.js";
|
|
3
|
+
/**
|
|
4
|
+
* How a project's Creds page fills, replaces and removes creds, and turns
|
|
5
|
+
* requests down. A value only ever comes in: no route answers with one.
|
|
6
|
+
* Each handler is a property, so `serveProject` spreads them into the
|
|
7
|
+
* project's routes.
|
|
8
|
+
*/
|
|
9
|
+
export declare class CredRoutes {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(project: Project, watch: ProjectWatch);
|
|
12
|
+
/** What each store keeps, by name, and what the stores are called. */
|
|
13
|
+
readonly listCreds: () => Promise<Response>;
|
|
14
|
+
readonly saveCred: (request: Request) => Promise<Response>;
|
|
15
|
+
readonly removeCred: (request: Request) => Promise<Response>;
|
|
16
|
+
readonly dismissCred: (request: Request) => Promise<Response>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Transcriber } from "webappwiz/dictate";
|
|
2
|
+
import type { Connection } from "./dev-sockets.js";
|
|
3
|
+
/**
|
|
4
|
+
* One dictation's socket, relaying the page's audio to a transcription and
|
|
5
|
+
* its text back. A socket that closes takes its transcription with it: the
|
|
6
|
+
* text heard so far is already in the composer.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DictationConnection implements Connection {
|
|
9
|
+
/** Null when the project has no key, which the Creds page now asks for. */
|
|
10
|
+
private readonly transcriber;
|
|
11
|
+
private relay;
|
|
12
|
+
constructor(
|
|
13
|
+
/** Null when the project has no key, which the Creds page now asks for. */
|
|
14
|
+
transcriber: Promise<Transcriber | null>);
|
|
15
|
+
open(socket: Bun.ServerWebSocket<Connection>): void;
|
|
16
|
+
message(_socket: Bun.ServerWebSocket<Connection>, message: string | Buffer<ArrayBuffer>): void;
|
|
17
|
+
closed(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type HostGate } from "./dev-http.js";
|
|
2
|
+
import type { Served } from "./dev-project.js";
|
|
3
|
+
import type { Connection } from "./dev-sockets.js";
|
|
4
|
+
/** How a dictation finds the project its request names. */
|
|
5
|
+
export interface DictationProjects {
|
|
6
|
+
projectFor(request: Request): Promise<Served>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The composer's dictations, each over a WebSocket: the page streams the
|
|
10
|
+
* mic's audio up, and the text comes back as it is heard.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Dictations {
|
|
13
|
+
private readonly gate;
|
|
14
|
+
private readonly projects;
|
|
15
|
+
constructor(gate: HostGate, projects: DictationProjects);
|
|
16
|
+
readonly open: (request: Request, server: Bun.Server<Connection>) => Promise<Response | undefined>;
|
|
17
|
+
}
|
package/dev-http.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Resource } from "webappwiz/disposable";
|
|
2
|
+
import type { Logger } from "webappwiz/log";
|
|
3
|
+
import type { Attachment } from "./attachments.js";
|
|
4
|
+
import type { Access, Identity } from "./dev-access.js";
|
|
5
|
+
import { type Reason } from "./exit.js";
|
|
6
|
+
/**
|
|
7
|
+
* Which requests `splates server` answers at all: those to a host it may be
|
|
8
|
+
* reached by, and writes only from its own page. Given `access`, a host
|
|
9
|
+
* `hosts` lets in answers only to a request Cloudflare Access verified, and
|
|
10
|
+
* such a request may use conversations and terminals too; without it,
|
|
11
|
+
* those answer only to this machine's own names, so a tunnel still reaches
|
|
12
|
+
* no further than the todos.
|
|
13
|
+
*/
|
|
14
|
+
export declare class HostGate {
|
|
15
|
+
private readonly log;
|
|
16
|
+
readonly access: Access | null;
|
|
17
|
+
private readonly allowed;
|
|
18
|
+
constructor(hosts: string[], log: Logger, access?: Access | null);
|
|
19
|
+
readonly guarded: <Answered extends Response | undefined>(handle: (request: Request) => Promise<Answered>) => (request: Request) => Promise<Answered | Response>;
|
|
20
|
+
/**
|
|
21
|
+
* Who Cloudflare Access says `request` comes from, or null when it comes
|
|
22
|
+
* to this machine's own names or no Access stands in front.
|
|
23
|
+
*/
|
|
24
|
+
readonly identity: (request: Request) => Promise<Identity | null>;
|
|
25
|
+
readonly local: <Answered extends Response | undefined>(handle: (request: Request) => Promise<Answered>) => (request: Request) => Promise<Answered | Response>;
|
|
26
|
+
}
|
|
27
|
+
/** The one address the server binds: this machine, and nothing else. */
|
|
28
|
+
export declare const LOOPBACK = "127.0.0.1";
|
|
29
|
+
/** Names this machine answers to, which a page opened on it always may use. */
|
|
30
|
+
export declare const LOCAL_HOSTS: string[];
|
|
31
|
+
/** A phone photo or a short screen recording fits; a long video does not. */
|
|
32
|
+
export declare const MAX_BODY_BYTES: number;
|
|
33
|
+
/**
|
|
34
|
+
* The images and recordings a todo or a task may hold, by extension, and how
|
|
35
|
+
* each is served; `dev/media.tsx` shows the same ones inline.
|
|
36
|
+
*/
|
|
37
|
+
export declare const MEDIA_TYPES: Record<string, string>;
|
|
38
|
+
/** How a refusal from the core reads over HTTP. */
|
|
39
|
+
export declare const STATUS: Partial<Record<Reason, number>>;
|
|
40
|
+
/** An open server-sent event stream, as the server writes to it. */
|
|
41
|
+
export type EventSink = ReadableStreamDefaultController<Uint8Array>;
|
|
42
|
+
/** What a stream's owner does as pages join and leave it. */
|
|
43
|
+
export interface StreamWatcher {
|
|
44
|
+
/** Called once a page's stream has joined the set. */
|
|
45
|
+
opened(): void;
|
|
46
|
+
/** Called once a page's stream has left the set. */
|
|
47
|
+
closed(): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A server-sent event stream, in `listeners` while its page holds it open,
|
|
51
|
+
* pulsing so the page can tell it went quiet, and telling `watcher` as it
|
|
52
|
+
* joins and leaves.
|
|
53
|
+
*/
|
|
54
|
+
export declare function eventStream(listeners: Set<EventSink>, watcher?: StreamWatcher): Response;
|
|
55
|
+
/** The JSON a write sends, as an object. */
|
|
56
|
+
export declare function body(request: Request): Promise<Record<string, unknown>>;
|
|
57
|
+
/** The files a form carries under `file`, as bytes, each with its type. */
|
|
58
|
+
export declare function uploads(form: FormData): Promise<(Attachment & {
|
|
59
|
+
mimeType: string;
|
|
60
|
+
})[]>;
|
|
61
|
+
/**
|
|
62
|
+
* `bytes`, served as `type`, or to download when it is not an image or a
|
|
63
|
+
* recording, in the part `request` asks for: Safari plays a video only from a
|
|
64
|
+
* server that hands out its parts.
|
|
65
|
+
*/
|
|
66
|
+
export declare function fileResponse(request: Request, bytes: Uint8Array, type: string | undefined, headers: Record<string, string>): Response;
|
|
67
|
+
/** The host a Host header names, without its port. */
|
|
68
|
+
export declare function hostname(host: string): string;
|
|
69
|
+
/** `text` as JSON, or null when it is not. */
|
|
70
|
+
export declare function json(text: string): unknown;
|
|
71
|
+
export declare function refuse(status: number, reason: string, message: string): Response;
|
|
72
|
+
/**
|
|
73
|
+
* Says to `stream`'s page, every pulse, that it is still there, so a page
|
|
74
|
+
* whose stream went quiet, as across a sleep, opens it again.
|
|
75
|
+
*/
|
|
76
|
+
export declare function pulsing(stream: EventSink): Resource;
|
package/dev-open.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** A file to open, and the tree its editor window should hold. */
|
|
2
|
+
export interface InTree {
|
|
3
|
+
tree: string;
|
|
4
|
+
file: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Where `path` opens: inside the task worktree under `worktrees` it is in,
|
|
8
|
+
* or, once that worktree is gone, at the same place in the main tree `root`,
|
|
9
|
+
* or inside `root` itself. Null for a path in neither, which the page may not
|
|
10
|
+
* open.
|
|
11
|
+
*/
|
|
12
|
+
export declare function inTree(path: string, { root, worktrees }: {
|
|
13
|
+
root: string;
|
|
14
|
+
worktrees: string;
|
|
15
|
+
}, exists: (path: string) => Promise<boolean>): Promise<InTree | null>;
|
package/dev-options.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { Pusher, VapidKeys } from "webappwiz/push";
|
|
2
|
+
import type { HeavyCap, PortProvider } from "webappwiz/system";
|
|
3
|
+
import type { Duration } from "webappwiz/time";
|
|
4
|
+
import type { Config } from "./config.js";
|
|
5
|
+
import type { Conversations } from "./conversations.js";
|
|
6
|
+
import type { CoordinatorState } from "./coordinator-state.js";
|
|
7
|
+
import type { AccessConfig } from "./dev-access.js";
|
|
8
|
+
import type { Project } from "./dev-project.js";
|
|
9
|
+
import type { ServerChoice } from "./dev-servers.js";
|
|
10
|
+
import type { TranscriberFor } from "./dev-transcriber.js";
|
|
11
|
+
import type { TunnelConfig } from "./dev-tunnel.js";
|
|
12
|
+
import type { DevWorkers } from "./dev-workers.js";
|
|
13
|
+
import type { Git } from "./git.js";
|
|
14
|
+
import type { MachineSensors } from "./machine.js";
|
|
15
|
+
import type { Slot } from "./slots.js";
|
|
16
|
+
import type { WorkerMachine } from "./worker-machine.js";
|
|
17
|
+
/** What `dev` lets a caller choose. */
|
|
18
|
+
export interface DevOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Where the local worker dials in, a Unix socket path; without it, workers
|
|
21
|
+
* reach this server only through `/api/workers`.
|
|
22
|
+
*/
|
|
23
|
+
workerSocket?: string | null;
|
|
24
|
+
/** Where workers are taken in; one of its own by default. */
|
|
25
|
+
workers?: DevWorkers | null;
|
|
26
|
+
/**
|
|
27
|
+
* What this coordinator keeps across its restarts: the roots of the
|
|
28
|
+
* projects whose agents the last run let go of, served before the worker
|
|
29
|
+
* joins so they are taken back, and written again at the next restart;
|
|
30
|
+
* null keeps nothing, and a restart ends every agent.
|
|
31
|
+
*/
|
|
32
|
+
coordinator?: CoordinatorState | null;
|
|
33
|
+
/**
|
|
34
|
+
* The worker agents and terminals run on, whose process table a restart
|
|
35
|
+
* reads; this machine, read directly, by default.
|
|
36
|
+
*/
|
|
37
|
+
worker?: WorkerMachine | null;
|
|
38
|
+
/**
|
|
39
|
+
* The wildcard base host task ports are served under, as
|
|
40
|
+
* `<task>-<port>.<base>`, behind `access`; null serves them only on
|
|
41
|
+
* loopback ports here. Refused without `access`.
|
|
42
|
+
*/
|
|
43
|
+
portsHost?: string | null;
|
|
44
|
+
/** Where to listen; the port `--port` asked for, and the span above it. */
|
|
45
|
+
ports?: PortProvider;
|
|
46
|
+
/**
|
|
47
|
+
* Host names besides this machine's own that the page may be reached by,
|
|
48
|
+
* like the hostname of a tunnel. Anything else is refused, which is what
|
|
49
|
+
* stops another site from reading the repo through a browser pointed at
|
|
50
|
+
* localhost. Who may use those names is the Access policy's business, not
|
|
51
|
+
* splates's.
|
|
52
|
+
*/
|
|
53
|
+
hosts?: string[];
|
|
54
|
+
/**
|
|
55
|
+
* The Cloudflare Access application in front of `hosts`, or null for none.
|
|
56
|
+
* Given one, a request to those hosts must carry a token it signed, and
|
|
57
|
+
* then may use conversations and terminals too. Anything that exposes the
|
|
58
|
+
* page beyond this machine refuses to without it.
|
|
59
|
+
*/
|
|
60
|
+
access?: AccessConfig | null;
|
|
61
|
+
/**
|
|
62
|
+
* The Cloudflare tunnel to run once listening, whose host `hosts` also
|
|
63
|
+
* lets in. Refused without `access`.
|
|
64
|
+
*/
|
|
65
|
+
tunnel?: TunnelConfig | null;
|
|
66
|
+
/**
|
|
67
|
+
* Makes the conversations a project's page may hold with agents, its
|
|
68
|
+
* records in `splatesDir`, its commands watched through `git`, its limits
|
|
69
|
+
* from `config`; without it no page has any to show, and the routes
|
|
70
|
+
* say they are off.
|
|
71
|
+
*/
|
|
72
|
+
conversations?: ((project: {
|
|
73
|
+
splatesDir: string;
|
|
74
|
+
git: Git;
|
|
75
|
+
config: Config;
|
|
76
|
+
}) => Conversations) | null;
|
|
77
|
+
/**
|
|
78
|
+
* The shell a page's terminal runs, as argv, in the main tree or a task's
|
|
79
|
+
* worktree; without it, the page has no terminal and the route says so.
|
|
80
|
+
*/
|
|
81
|
+
shell?: string[] | null;
|
|
82
|
+
/**
|
|
83
|
+
* What a project's dictations transcribe with, by default OpenAI on the
|
|
84
|
+
* key its creds keep; a test hands in a fake.
|
|
85
|
+
*/
|
|
86
|
+
transcriber?: TranscriberFor;
|
|
87
|
+
/** Opens a registered project by its root; `openRepository` by default. */
|
|
88
|
+
open?: (root: string) => Promise<Project>;
|
|
89
|
+
/**
|
|
90
|
+
* The latest splates on npm, or null when it cannot say, asked as the server
|
|
91
|
+
* starts and hourly after; the page hints at a restart once it is past
|
|
92
|
+
* `running`. Without it, nothing is checked.
|
|
93
|
+
*/
|
|
94
|
+
newest?: () => Promise<string | null>;
|
|
95
|
+
/** The version serving; the one installed by default. */
|
|
96
|
+
running?: string;
|
|
97
|
+
/** How often `newest` is asked after the first time: hourly by default. */
|
|
98
|
+
checkEvery?: Duration;
|
|
99
|
+
/**
|
|
100
|
+
* The last commit to splates's own source, or null when it does not run
|
|
101
|
+
* from a checkout. Asked as the server starts, then every `sourceEvery`;
|
|
102
|
+
* once it moves on, the page hints at a restart. A server started from a
|
|
103
|
+
* checkout asks this in place of `newest`, since a restart runs the
|
|
104
|
+
* checkout again. Without it, nothing is checked.
|
|
105
|
+
*/
|
|
106
|
+
source?: () => Promise<string | null>;
|
|
107
|
+
/** How often `source` is asked after the first time. */
|
|
108
|
+
sourceEvery?: Duration;
|
|
109
|
+
/**
|
|
110
|
+
* Whether building the page failed before this start, so what it serves
|
|
111
|
+
* is the page built before; the page says so.
|
|
112
|
+
*/
|
|
113
|
+
unbuilt?: boolean;
|
|
114
|
+
/** The slot `splates server --slot` serves under, which the page shows; null for none. */
|
|
115
|
+
slot?: Slot | null;
|
|
116
|
+
/**
|
|
117
|
+
* Every `splates server` on this machine, the machine's own and each slot's,
|
|
118
|
+
* which the page's switcher lists beside the projects; none by default.
|
|
119
|
+
*/
|
|
120
|
+
servers?: () => Promise<ServerChoice[]>;
|
|
121
|
+
/**
|
|
122
|
+
* Ends the process with `RESTART` or `UPDATE` once the server has
|
|
123
|
+
* stopped, for its supervisor to start another; without it, the page
|
|
124
|
+
* cannot restart `splates server`.
|
|
125
|
+
*/
|
|
126
|
+
exit?: ((code: number) => void) | null;
|
|
127
|
+
/** Where the page's machine stats come from; this machine's OS for none. */
|
|
128
|
+
sensors?: MachineSensors | null;
|
|
129
|
+
/** Whose test runs and installs the page shows; this machine's for none. */
|
|
130
|
+
heavy?: Pick<HeavyCap, "read"> | null;
|
|
131
|
+
/** What pushes notices to the devices that subscribed; the Web Push services by default. */
|
|
132
|
+
pusher?: (keys: VapidKeys) => Pusher;
|
|
133
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Fs, Ps } from "webappwiz/system";
|
|
2
|
+
import { Adherence } from "./adherence.js";
|
|
3
|
+
import type { Handler } from "./dev-project.js";
|
|
4
|
+
/**
|
|
5
|
+
* What the page reads of how tasks ended, from the records every project on
|
|
6
|
+
* this machine shares, so one not open here still counts: the Stats page's
|
|
7
|
+
* sums, and how one merged task went.
|
|
8
|
+
*/
|
|
9
|
+
export declare class DevOutcomes {
|
|
10
|
+
private readonly outcomes;
|
|
11
|
+
/** What `splates server` judged of each conversation as its turns ended. */
|
|
12
|
+
readonly adherence: Adherence;
|
|
13
|
+
constructor({ fs, ps }: {
|
|
14
|
+
fs: Fs;
|
|
15
|
+
ps: Ps;
|
|
16
|
+
});
|
|
17
|
+
/** `?period=` names the period, as `PERIODS` does, or `all` for all time; 7 days for none. */
|
|
18
|
+
readonly stats: Handler;
|
|
19
|
+
/** How `/api/tasks/:task/outcome`'s task went once it merged in `project`; null when it never did. */
|
|
20
|
+
landed(project: string): Handler;
|
|
21
|
+
}
|
package/dev-pages.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Assets } from "./dev/assets.js";
|
|
2
|
+
/**
|
|
3
|
+
* The page the server hands to browsers: the files built as this run
|
|
4
|
+
* started. It changes only with a restart, which builds it again before the
|
|
5
|
+
* server comes back, so the page always matches the server it talks to.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Pages {
|
|
8
|
+
readonly assets: Assets;
|
|
9
|
+
/** The shell, naming the script and styles by what they hold. */
|
|
10
|
+
readonly page: string;
|
|
11
|
+
constructor(assets: Assets);
|
|
12
|
+
/** The server's routes for the page's own files, spread into its `routes`. */
|
|
13
|
+
routes(): Record<string, (request: Request) => Response>;
|
|
14
|
+
/** `body` as `type`, or a 304 for a request that holds this very build. */
|
|
15
|
+
respond(request: Request, body: string | Uint8Array<ArrayBuffer>, type: string): Response;
|
|
16
|
+
}
|
package/dev-picker.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Deps } from "webappwiz/cmd";
|
|
2
|
+
import type { Fs } from "webappwiz/system";
|
|
3
|
+
import type { SecretStores } from "./creds.js";
|
|
4
|
+
import type { DevMachine } from "./dev-project.js";
|
|
5
|
+
import type { Project } from "./projects.js";
|
|
6
|
+
/**
|
|
7
|
+
* What the page's project picker asks of `splates server` beyond listing: adding
|
|
8
|
+
* a project, committing what `splates init` wrote there, and focusing one. Its
|
|
9
|
+
* handlers are properties, so `dev` hands them to its routes as they are.
|
|
10
|
+
*/
|
|
11
|
+
export declare class Picker {
|
|
12
|
+
private readonly deps;
|
|
13
|
+
constructor(deps: DevMachine);
|
|
14
|
+
/**
|
|
15
|
+
* Adds the repository the body's `path` names, as `splates init` there
|
|
16
|
+
* would, and focuses it.
|
|
17
|
+
*/
|
|
18
|
+
readonly add: (request: Request) => Promise<Response>;
|
|
19
|
+
/** Commits the body's `paths`, which `splates init` wrote, once the person said to. */
|
|
20
|
+
readonly commit: (request: Request) => Promise<Response>;
|
|
21
|
+
/** Makes the body's `project` what an address naming none shows, on any device. */
|
|
22
|
+
readonly focus: (request: Request) => Promise<Response>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* What `splates init` writes in a project: the skill, its link for Claude
|
|
26
|
+
* Code, and the lock `skills` keeps. Uncommitted, each is offered again,
|
|
27
|
+
* even when an earlier init left it so.
|
|
28
|
+
*/
|
|
29
|
+
export declare const INIT_WRITES: string[];
|
|
30
|
+
/** A project the page added, and what `splates init` left in it to commit. */
|
|
31
|
+
export interface Added {
|
|
32
|
+
project: Project;
|
|
33
|
+
/**
|
|
34
|
+
* Each file init wrote that is not committed, as `git status` names it:
|
|
35
|
+
* what the page asks to commit, and all it commits.
|
|
36
|
+
*/
|
|
37
|
+
uncommitted: string[];
|
|
38
|
+
/** The same, each under one of `INIT_WRITES` named by that, for the page to say. */
|
|
39
|
+
shown: string[];
|
|
40
|
+
/** The branch a commit of them lands on; null on a detached HEAD. */
|
|
41
|
+
branch: string | null;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Makes the repository `path` sits in a splates project, as `splates init` run
|
|
45
|
+
* there would, `~` meaning the home directory: its records, made or brought
|
|
46
|
+
* forward, the skill, and its place in the registry, focused. Commits
|
|
47
|
+
* nothing, but says what init wrote, for the page to ask before it commits.
|
|
48
|
+
*/
|
|
49
|
+
export declare function initProject(machine: Deps & {
|
|
50
|
+
fs: Fs;
|
|
51
|
+
secrets?: SecretStores;
|
|
52
|
+
}, path: string): Promise<Added>;
|
|
53
|
+
/**
|
|
54
|
+
* Commits `paths` in the main tree at `root` as setting up splates, on
|
|
55
|
+
* whatever it has checked out, leaving every other change as it was.
|
|
56
|
+
*/
|
|
57
|
+
export declare function commitInit({ ps }: Deps, root: string, paths: string[]): Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Connection } from "./dev-sockets.js";
|
|
2
|
+
/**
|
|
3
|
+
* A page's WebSocket to a task's server, such as a dev server's hot reload,
|
|
4
|
+
* carried on to that server: each message as it came, both ways, and a
|
|
5
|
+
* close at either end closes the other. The server's end opens first, so the
|
|
6
|
+
* page's upgrade can answer with the subprotocol the server chose.
|
|
7
|
+
*/
|
|
8
|
+
export declare class PortSocket implements Connection {
|
|
9
|
+
private readonly upstream;
|
|
10
|
+
private socket;
|
|
11
|
+
/** What the task's server said before the page's end opened. */
|
|
12
|
+
private early;
|
|
13
|
+
private constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Opens a WebSocket to `url` with the page's `headers` and subprotocols,
|
|
16
|
+
* or says why it could not.
|
|
17
|
+
*/
|
|
18
|
+
static open(url: string, headers: Headers, protocols: string[]): Promise<PortSocket | {
|
|
19
|
+
refused: string;
|
|
20
|
+
}>;
|
|
21
|
+
/** The subprotocol the task's server chose, for the page's upgrade to answer with. */
|
|
22
|
+
get protocol(): string;
|
|
23
|
+
open(socket: Bun.ServerWebSocket<Connection>): void;
|
|
24
|
+
message(_socket: Bun.ServerWebSocket<Connection>, message: string | Buffer<ArrayBuffer>): void;
|
|
25
|
+
closed(): void;
|
|
26
|
+
}
|
package/dev-ports.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type PortProvider } from "webappwiz/system";
|
|
2
|
+
/** Preferred, not required: `dev` moves up from here when it is taken. */
|
|
3
|
+
export declare const DEFAULT_PORT = 4269;
|
|
4
|
+
/** How far above the port asked for `dev` will look before giving up. */
|
|
5
|
+
export declare const PORT_SPAN = 20;
|
|
6
|
+
/**
|
|
7
|
+
* Where `dev` will listen, given the port asked for. A flag is outside input,
|
|
8
|
+
* so a port that cannot exist is a refusal with an exit code rather than the
|
|
9
|
+
* assertion `OpenPortProvider` would raise for a bug in here.
|
|
10
|
+
*/
|
|
11
|
+
export declare function devPorts(from: number): PortProvider;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Duration } from "webappwiz/time";
|
|
2
|
+
import { type StreamWatcher } from "./dev-http.js";
|
|
3
|
+
import type { DevContext, Project } from "./dev-project.js";
|
|
4
|
+
import { type Snapshot } from "./snapshot.js";
|
|
5
|
+
/** How long changes to a repo's files settle before it is read again. */
|
|
6
|
+
export declare const SETTLE: Duration;
|
|
7
|
+
/**
|
|
8
|
+
* What one project's pages hear of its repo: its records, read whole, and a
|
|
9
|
+
* stream that says `changed` whenever what they show moved. The repo is
|
|
10
|
+
* watched only while a page listens.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ProjectWatch implements StreamWatcher {
|
|
13
|
+
private readonly project;
|
|
14
|
+
private readonly context;
|
|
15
|
+
/** The streams of the pages listening. */
|
|
16
|
+
private readonly open;
|
|
17
|
+
private last;
|
|
18
|
+
private watches;
|
|
19
|
+
private readonly trees;
|
|
20
|
+
private poll;
|
|
21
|
+
private readonly settle;
|
|
22
|
+
private readonly edits;
|
|
23
|
+
/** Watches `project`, read once now so the first change is told apart. */
|
|
24
|
+
static start(project: Project, context: DevContext): Promise<ProjectWatch>;
|
|
25
|
+
private constructor();
|
|
26
|
+
/** The whole repo, as a page shows it. */
|
|
27
|
+
read(): Promise<Snapshot>;
|
|
28
|
+
tick(): Promise<void>;
|
|
29
|
+
/** Reads the repo again soon, telling its pages if anything moved. */
|
|
30
|
+
readonly changed: () => void;
|
|
31
|
+
private readonly edited;
|
|
32
|
+
/** The stream a page listens to for `changed`. */
|
|
33
|
+
events(): Response;
|
|
34
|
+
opened(): void;
|
|
35
|
+
closed(): void;
|
|
36
|
+
dispose(): void;
|
|
37
|
+
private arm;
|
|
38
|
+
private disarm;
|
|
39
|
+
/**
|
|
40
|
+
* Watches each worktree in `paths`, and no other: its SPLATES.md, and its
|
|
41
|
+
* files as they are edited, which move its counts and its systems.
|
|
42
|
+
*/
|
|
43
|
+
private follow;
|
|
44
|
+
}
|