@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,102 @@
|
|
|
1
|
+
import type { Events } from "webappwiz/events";
|
|
2
|
+
import type { IdProvider } from "webappwiz/id";
|
|
3
|
+
import type { Fs, Lock } from "webappwiz/system";
|
|
4
|
+
import type { Timer, WallClock } from "webappwiz/time";
|
|
5
|
+
import type { Agent, Launcher } from "./agent-process.js";
|
|
6
|
+
import type { ArtifactRoom } from "./artifact-room.js";
|
|
7
|
+
import type { ArtifactLimits } from "./artifacts.js";
|
|
8
|
+
import type { ConversationLog } from "./conversation-log.js";
|
|
9
|
+
import type { ConversationState } from "./conversation-state.js";
|
|
10
|
+
import type { Reach } from "./projects.js";
|
|
11
|
+
import type { SessionServers } from "./shared-browser.js";
|
|
12
|
+
import type { Watch } from "./watch.js";
|
|
13
|
+
import type { WorkerMachine } from "./worker-machine.js";
|
|
14
|
+
/**
|
|
15
|
+
* What a conversation's parts, its connection, its turns and its background
|
|
16
|
+
* commands, share of it: its state and log, and the few things they do to
|
|
17
|
+
* the whole. `Conversation` implements it.
|
|
18
|
+
*/
|
|
19
|
+
export interface ConversationHost {
|
|
20
|
+
readonly state: ConversationState;
|
|
21
|
+
readonly log: ConversationLog;
|
|
22
|
+
readonly events: Events<ConversationEvents>;
|
|
23
|
+
/** What runs it; null when its agent is no longer known. */
|
|
24
|
+
readonly agent: Agent | null;
|
|
25
|
+
/** Where it runs; null for a log too old to say. */
|
|
26
|
+
readonly cwd: string | null;
|
|
27
|
+
/** Under way while the agent starts or comes back, for a prompt to wait on. */
|
|
28
|
+
readonly opening: Promise<void> | null;
|
|
29
|
+
now(): string;
|
|
30
|
+
set(next: Partial<ConversationState>): void;
|
|
31
|
+
changed(): void;
|
|
32
|
+
/** A turn ended, with `error` for one that failed. */
|
|
33
|
+
ended(error: string | null): void;
|
|
34
|
+
/** Ends the agent's process, with `error` for one that failed. */
|
|
35
|
+
close(error: string | null): Promise<void>;
|
|
36
|
+
/** Brings a stopped conversation back: a new process, the same session or a new one. */
|
|
37
|
+
resume(): Promise<void>;
|
|
38
|
+
/** Back on the list, stopped until the next prompt. */
|
|
39
|
+
unarchive(): Promise<void>;
|
|
40
|
+
/** Marks it `unread` or not. */
|
|
41
|
+
flag(unread: boolean): void;
|
|
42
|
+
}
|
|
43
|
+
export type ConversationEvents = {
|
|
44
|
+
changed: undefined;
|
|
45
|
+
chosen: string;
|
|
46
|
+
};
|
|
47
|
+
/** What every conversation in a repo is made with. */
|
|
48
|
+
export interface ConversationDeps {
|
|
49
|
+
fs: Fs;
|
|
50
|
+
/** What names the files artifacts are kept in. */
|
|
51
|
+
ids: IdProvider;
|
|
52
|
+
/** How many bytes of artifacts it may keep (`artifacts.ts`). */
|
|
53
|
+
artifacts: ArtifactLimits;
|
|
54
|
+
/** What makes room for an add across the project; none refuses one past it. */
|
|
55
|
+
room?: ArtifactRoom;
|
|
56
|
+
timer: Timer;
|
|
57
|
+
clock: WallClock;
|
|
58
|
+
/** What starts each agent, and takes one back after a restart. */
|
|
59
|
+
launcher: Launcher;
|
|
60
|
+
/** Where the agent runs, which its background commands' output is read from. */
|
|
61
|
+
machine: WorkerMachine;
|
|
62
|
+
/**
|
|
63
|
+
* Hold it while an agent's process starts, until it answers
|
|
64
|
+
* `initialize`, so agents start one at a time.
|
|
65
|
+
*/
|
|
66
|
+
starting: Lock;
|
|
67
|
+
/** Where `splates server` answers, for the agent's CLI to tell it things. */
|
|
68
|
+
url: string | null;
|
|
69
|
+
/** What watches the agent's commands; null to leave them be. */
|
|
70
|
+
watch: Watch | null;
|
|
71
|
+
/** The main tree, where a conversation carries on once its worktree is gone. */
|
|
72
|
+
root: string | null;
|
|
73
|
+
/** The splates projects on this machine, for `#slug`; null for none. */
|
|
74
|
+
projects: ProjectRoster | null;
|
|
75
|
+
/** The MCP servers each session is offered, beyond the agent's own; null for none. */
|
|
76
|
+
servers: SessionServers | null;
|
|
77
|
+
}
|
|
78
|
+
/** The splates projects on this machine, as `Projects` lists them. */
|
|
79
|
+
export interface ProjectRoster {
|
|
80
|
+
/** Each project, flagged `gone` when its repository is no longer there. */
|
|
81
|
+
list(): Promise<(ProjectRef & {
|
|
82
|
+
gone: boolean;
|
|
83
|
+
})[]>;
|
|
84
|
+
/** What the project at `from` may do in the one at `to`. */
|
|
85
|
+
reach(from: string, to: string): Promise<Reach>;
|
|
86
|
+
}
|
|
87
|
+
/** A splates project a prompt can name as `#slug`. */
|
|
88
|
+
export interface ProjectRef {
|
|
89
|
+
slug: string;
|
|
90
|
+
/** Its main tree's root. */
|
|
91
|
+
root: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* `changed`, `ended` (a turn ended, however it did, or the agent failed to
|
|
95
|
+
* start) and `removed` each carry a conversation's id.
|
|
96
|
+
*/
|
|
97
|
+
export type ConversationsEvents = {
|
|
98
|
+
settings: undefined;
|
|
99
|
+
changed: string;
|
|
100
|
+
ended: string;
|
|
101
|
+
removed: string;
|
|
102
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Conversations } from "./conversations.js";
|
|
2
|
+
/** The conversations and saved agent defaults offered to the page. */
|
|
3
|
+
export declare function listing(all: Conversations): Promise<{
|
|
4
|
+
agents: {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
models: {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
}[];
|
|
11
|
+
settings: import("./conversation-state.js").Setting[];
|
|
12
|
+
limits: import("./conversation-state.js").Limit[];
|
|
13
|
+
}[];
|
|
14
|
+
conversations: import("./conversation-state.js").ConversationState[];
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import type * as acp from "@agentclientprotocol/sdk";
|
|
2
|
+
import { type Eventful } from "webappwiz/events";
|
|
3
|
+
import type { Fs } from "webappwiz/system";
|
|
4
|
+
import { type Timer } from "webappwiz/time";
|
|
5
|
+
import { type AsyncTaskUpdate } from "./acp-extensions.js";
|
|
6
|
+
import type { ProcessHandle } from "./agent-process.js";
|
|
7
|
+
import { type ArtifactChange } from "./artifacts.js";
|
|
8
|
+
import { type Ask, type Attached, type Checkpoint, type ConversationState, type Decision, type Device, type Image, type Limit, type Setting } from "./conversation-state.js";
|
|
9
|
+
import { type ObservedTurn } from "./opencode-usage.js";
|
|
10
|
+
import type { Flag } from "./watch.js";
|
|
11
|
+
/** What a `ConversationLog` says of its saves. */
|
|
12
|
+
export interface ConversationLogEvents extends Record<string, unknown> {
|
|
13
|
+
/** A save reached the file: `savedThrough` may have moved. */
|
|
14
|
+
saved: undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A conversation's log, one JSON line per entry: `write` each entry as it
|
|
18
|
+
* happens, and `replay` the file to read the conversation back.
|
|
19
|
+
*/
|
|
20
|
+
export declare class ConversationLog implements Eventful<ConversationLogEvents> {
|
|
21
|
+
readonly path: string;
|
|
22
|
+
private readonly fs;
|
|
23
|
+
private readonly dispatcher;
|
|
24
|
+
readonly events: import("webappwiz/events").Events<ConversationLogEvents>;
|
|
25
|
+
/** The lines not yet appended to the file, each with its seq. */
|
|
26
|
+
private readonly unsaved;
|
|
27
|
+
private saving;
|
|
28
|
+
private readonly saves;
|
|
29
|
+
/** The seq of the agent's frame being handled; 0 before the first. */
|
|
30
|
+
private seq;
|
|
31
|
+
/** The seq of the last entry the file holds. */
|
|
32
|
+
private lastSaved;
|
|
33
|
+
constructor(path: string, fs: Fs, timer: Timer);
|
|
34
|
+
/**
|
|
35
|
+
* The highest seq every entry at or under which the file holds: the seq
|
|
36
|
+
* before the first unsaved entry, or the last saved one with none unsaved.
|
|
37
|
+
*/
|
|
38
|
+
get savedThrough(): number;
|
|
39
|
+
/** Stamps what is written from now on with frame `seq`. */
|
|
40
|
+
heard(seq: number): void;
|
|
41
|
+
/**
|
|
42
|
+
* What the log adds up to, read back: the conversation as its entries
|
|
43
|
+
* left it, stopped, whatever it was doing, unless its process is still
|
|
44
|
+
* out there (`live`), in which case it is left as it stands for whoever
|
|
45
|
+
* takes the process back, or `stopped` once nobody can. Null for a log
|
|
46
|
+
* that does not start one.
|
|
47
|
+
*/
|
|
48
|
+
replay(): Promise<Replayed | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Leaves `replayed` as a conversation whose process is gone: its turn cut
|
|
51
|
+
* short, its commands ended, its question unanswered, and, for one read
|
|
52
|
+
* back live, an `end` so the next read finds it stopped too.
|
|
53
|
+
*/
|
|
54
|
+
stopped(replayed: Replayed): Promise<void>;
|
|
55
|
+
/** Appends `entry`, with whatever else is written before the next save. */
|
|
56
|
+
write(entry: Entry): void;
|
|
57
|
+
/** Settles once everything written so far is in the file. */
|
|
58
|
+
flush(): Promise<void>;
|
|
59
|
+
/** Deletes the file, once the last save has reached it. */
|
|
60
|
+
remove(): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
/** What a log read back says of its conversation, beyond its state. */
|
|
63
|
+
export interface Replayed {
|
|
64
|
+
state: ConversationState;
|
|
65
|
+
/** The agent's session, once it opened one. */
|
|
66
|
+
session: string | null;
|
|
67
|
+
/** Explicit requested model, including failed selections. */
|
|
68
|
+
model: string | null;
|
|
69
|
+
/** Original session directory, independent of task moves. */
|
|
70
|
+
sessionCwd: string | null;
|
|
71
|
+
/** Where it runs; null for a log too old to say. */
|
|
72
|
+
cwd: string | null;
|
|
73
|
+
/** Its settings as last set, by id, for the resumed session to match. */
|
|
74
|
+
picks: Record<string, string>;
|
|
75
|
+
/** Its process, still running on a worker; null once it is gone. */
|
|
76
|
+
live: Live | null;
|
|
77
|
+
/** Whether the log says a turn is running. */
|
|
78
|
+
running: boolean;
|
|
79
|
+
/** When the log last said anything happened; null for one that never did. */
|
|
80
|
+
last: string | null;
|
|
81
|
+
}
|
|
82
|
+
/** What a log read back live says of the process to take back. */
|
|
83
|
+
export interface Live {
|
|
84
|
+
handle: ProcessHandle;
|
|
85
|
+
/** The last frame the log holds, past which the worker's replay carries on. */
|
|
86
|
+
held: number;
|
|
87
|
+
/** The highest request id this side sent, past which the next stream numbers its own. */
|
|
88
|
+
lastId: number;
|
|
89
|
+
/** The prompt request still open, by its id; null when no turn waits on one. */
|
|
90
|
+
prompt: number | null;
|
|
91
|
+
/** What the agent is asking, and the request id to answer it on, when known; null for nothing. */
|
|
92
|
+
ask: {
|
|
93
|
+
rpc: acp.JsonRpcId | null;
|
|
94
|
+
ask: Ask;
|
|
95
|
+
} | null;
|
|
96
|
+
/** Whether the agent takes a prompt into its running turn. */
|
|
97
|
+
steers: boolean;
|
|
98
|
+
/** Whether the agent takes images in a prompt. */
|
|
99
|
+
sees: boolean;
|
|
100
|
+
/** Whether the agent has said a turn ended, so one it starts can end. */
|
|
101
|
+
tells: boolean;
|
|
102
|
+
/** Whether the agent says on its session list when a turn ends. */
|
|
103
|
+
follows: boolean;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* A line of a conversation's log: what was said, in the order it was. Each
|
|
107
|
+
* carries the `seq` of the agent's frame being handled when it was written;
|
|
108
|
+
* missing before the first frame, and from older logs.
|
|
109
|
+
*/
|
|
110
|
+
export type Entry = Said & {
|
|
111
|
+
seq?: number;
|
|
112
|
+
};
|
|
113
|
+
type Said = {
|
|
114
|
+
kind: "start";
|
|
115
|
+
id: string;
|
|
116
|
+
agent: string;
|
|
117
|
+
task: string | null;
|
|
118
|
+
/** Where it runs; missing from logs written before resuming. */
|
|
119
|
+
cwd?: string;
|
|
120
|
+
/** The task's base; missing from logs written before parts nested. */
|
|
121
|
+
base?: string | null;
|
|
122
|
+
/** Who added the task; missing from logs written before tasks remembered it. */
|
|
123
|
+
caller?: string | null;
|
|
124
|
+
createdAt: string;
|
|
125
|
+
/** Missing from logs written before assignments were kept apart. */
|
|
126
|
+
assigned?: boolean;
|
|
127
|
+
/** Who handed it its task; missing for one nobody did. */
|
|
128
|
+
handedBy?: string;
|
|
129
|
+
/** The lane orchestrator that handed it its task; missing for one nobody did. */
|
|
130
|
+
startedBy?: string;
|
|
131
|
+
/** The project's splates skill version; missing when it had none, or before it was kept. */
|
|
132
|
+
skill?: string;
|
|
133
|
+
} | {
|
|
134
|
+
kind: "session";
|
|
135
|
+
session: string;
|
|
136
|
+
cwd?: string;
|
|
137
|
+
} | {
|
|
138
|
+
kind: "model-request";
|
|
139
|
+
model: string;
|
|
140
|
+
}
|
|
141
|
+
/** Moved into a task's worktree, or back to the main tree. */
|
|
142
|
+
| {
|
|
143
|
+
kind: "task";
|
|
144
|
+
task: string | null;
|
|
145
|
+
cwd: string;
|
|
146
|
+
/** The task's base; missing from logs written before parts nested. */
|
|
147
|
+
base?: string | null;
|
|
148
|
+
/** Who added the task; missing from logs written before tasks remembered it. */
|
|
149
|
+
caller?: string | null;
|
|
150
|
+
}
|
|
151
|
+
/** What the session offered and had set, kept so the next one can start alike. */
|
|
152
|
+
| {
|
|
153
|
+
kind: "settings";
|
|
154
|
+
settings: Setting[];
|
|
155
|
+
}
|
|
156
|
+
/** `at` is missing from logs written before older archived ones were deleted. */
|
|
157
|
+
| {
|
|
158
|
+
kind: "archive";
|
|
159
|
+
archived: boolean;
|
|
160
|
+
at?: string;
|
|
161
|
+
/** The conversation whose archiving took this one with it. */
|
|
162
|
+
with?: string;
|
|
163
|
+
} | {
|
|
164
|
+
kind: "rename";
|
|
165
|
+
name: string | null;
|
|
166
|
+
} | {
|
|
167
|
+
kind: "unread";
|
|
168
|
+
unread: boolean;
|
|
169
|
+
} | {
|
|
170
|
+
kind: "pin";
|
|
171
|
+
pinned: boolean;
|
|
172
|
+
} | {
|
|
173
|
+
kind: "parent";
|
|
174
|
+
parent: {
|
|
175
|
+
id: string | null;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/** `at` is missing from logs written before the page showed how long things took. */
|
|
179
|
+
| {
|
|
180
|
+
kind: "prompt";
|
|
181
|
+
text: string;
|
|
182
|
+
at?: string;
|
|
183
|
+
queued?: true;
|
|
184
|
+
steered?: true;
|
|
185
|
+
/** The conversation that said it with `splates tell`. */
|
|
186
|
+
told?: string;
|
|
187
|
+
/** Said into the mic; missing from logs written before the page said. */
|
|
188
|
+
dictated?: true;
|
|
189
|
+
/** The page's id for it; missing for an agent's word, or from older logs. */
|
|
190
|
+
id?: string;
|
|
191
|
+
/** Where the person said it on the page; missing for an agent's word, or from older logs. */
|
|
192
|
+
from?: Device;
|
|
193
|
+
/** Missing from logs written before the page sent images. */
|
|
194
|
+
images?: Image[];
|
|
195
|
+
/** Missing from logs written before the page sent other files. */
|
|
196
|
+
files?: Attached[];
|
|
197
|
+
}
|
|
198
|
+
/** Every queued prompt went out. */
|
|
199
|
+
| {
|
|
200
|
+
kind: "sent";
|
|
201
|
+
count?: number;
|
|
202
|
+
at?: string;
|
|
203
|
+
}
|
|
204
|
+
/** The person stopped the agent's turn. */
|
|
205
|
+
| {
|
|
206
|
+
kind: "stopped";
|
|
207
|
+
at: string;
|
|
208
|
+
}
|
|
209
|
+
/** The agent's turn ended early, its connection lost or its process gone. */
|
|
210
|
+
| {
|
|
211
|
+
kind: "interrupted";
|
|
212
|
+
at: string;
|
|
213
|
+
}
|
|
214
|
+
/** A turn started or ended, so one a dead process left running shows as cut short. */
|
|
215
|
+
| {
|
|
216
|
+
kind: "turn";
|
|
217
|
+
running: boolean;
|
|
218
|
+
at?: string;
|
|
219
|
+
} | {
|
|
220
|
+
kind: "observed-turn";
|
|
221
|
+
turn: ObservedTurn;
|
|
222
|
+
}
|
|
223
|
+
/** The `index`th queued prompt was taken back. */
|
|
224
|
+
| {
|
|
225
|
+
kind: "unqueue";
|
|
226
|
+
index: number;
|
|
227
|
+
}
|
|
228
|
+
/** Where a checkpoint stands, and what comes after it. */
|
|
229
|
+
| {
|
|
230
|
+
kind: "checkpoint";
|
|
231
|
+
checkpoint: Checkpoint | null;
|
|
232
|
+
} | {
|
|
233
|
+
kind: "update";
|
|
234
|
+
update: acp.SessionUpdate;
|
|
235
|
+
at?: string;
|
|
236
|
+
}
|
|
237
|
+
/** The tokens a turn used, as the agent said when it ended. */
|
|
238
|
+
| {
|
|
239
|
+
kind: "usage";
|
|
240
|
+
usage: acp.Usage;
|
|
241
|
+
}
|
|
242
|
+
/** The plan's windows, as asked of an agent that does not send them. */
|
|
243
|
+
| {
|
|
244
|
+
kind: "limits";
|
|
245
|
+
limits: Limit[];
|
|
246
|
+
}
|
|
247
|
+
/** What a finished command did to git that it should not have. */
|
|
248
|
+
| {
|
|
249
|
+
kind: "flags";
|
|
250
|
+
tool: string;
|
|
251
|
+
flags: Flag[];
|
|
252
|
+
}
|
|
253
|
+
/** How the person answered the agent asking permission for a tool call. */
|
|
254
|
+
| {
|
|
255
|
+
kind: "decision";
|
|
256
|
+
tool: string;
|
|
257
|
+
decision: Decision;
|
|
258
|
+
}
|
|
259
|
+
/** An artifact added, removed, or its bytes deleted. */
|
|
260
|
+
| {
|
|
261
|
+
kind: "artifact";
|
|
262
|
+
change: ArtifactChange;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The agent's session is open on a process a worker runs, which a
|
|
266
|
+
* coordinator started again takes back by `handle`, until `end`.
|
|
267
|
+
*/
|
|
268
|
+
| {
|
|
269
|
+
kind: "launched";
|
|
270
|
+
handle: ProcessHandle;
|
|
271
|
+
/** Whether the agent takes a prompt into its running turn. */
|
|
272
|
+
steers: boolean;
|
|
273
|
+
/** Whether the agent takes images in a prompt. */
|
|
274
|
+
sees: boolean;
|
|
275
|
+
/** Whether the agent says on its session list when a turn ends; missing from older logs. */
|
|
276
|
+
follows?: boolean;
|
|
277
|
+
}
|
|
278
|
+
/** A request this side sent the agent, by the id it went out with. */
|
|
279
|
+
| {
|
|
280
|
+
kind: "request";
|
|
281
|
+
id: number;
|
|
282
|
+
method: string;
|
|
283
|
+
}
|
|
284
|
+
/** What the agent asks the person, by the request id `rpc` to answer on, when known; null once answered. */
|
|
285
|
+
| {
|
|
286
|
+
kind: "ask";
|
|
287
|
+
rpc: acp.JsonRpcId | null;
|
|
288
|
+
ask: Ask;
|
|
289
|
+
} | {
|
|
290
|
+
kind: "ask";
|
|
291
|
+
ask: null;
|
|
292
|
+
}
|
|
293
|
+
/** Word of a command the agent left running in the background. */
|
|
294
|
+
| {
|
|
295
|
+
kind: "background";
|
|
296
|
+
update: AsyncTaskUpdate;
|
|
297
|
+
} | {
|
|
298
|
+
kind: "end";
|
|
299
|
+
error: string | null;
|
|
300
|
+
};
|
|
301
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Attached, Image, Message, Sent } from "./conversation-state.js";
|
|
2
|
+
/** What the person said, `at`: what they sent with it, then their words. */
|
|
3
|
+
export declare function said(text: string, at: string | null, sent?: Sent[]): Message;
|
|
4
|
+
/** How many of `messages` went out, as the thread shows them. */
|
|
5
|
+
export declare function sent(messages: Message[]): number;
|
|
6
|
+
/** A prompt entry's images and files, each left out of the log when there are none. */
|
|
7
|
+
export declare function shown(sent: Sent[]): {
|
|
8
|
+
images?: Image[];
|
|
9
|
+
files?: Attached[];
|
|
10
|
+
};
|
|
11
|
+
/** The words of `message`, without what was sent with them. */
|
|
12
|
+
export declare function textOf(message: Message): string;
|
|
13
|
+
/** Marks up to `count` queued messages as gone out, all by default. */
|
|
14
|
+
export declare function delivered(messages: Message[], count?: number, at?: string): void;
|
|
15
|
+
/** Removes the `index`th queued message, returning it if there was one. */
|
|
16
|
+
export declare function takeBack(messages: Message[], index: number): Message | null;
|
|
17
|
+
/** What an error says, whether it is an `Error` or only shaped like one. */
|
|
18
|
+
export declare function messageOf(error: unknown): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ConversationState } from "./conversations.js";
|
|
2
|
+
import type { LaneRecord } from "./lanes.js";
|
|
3
|
+
/**
|
|
4
|
+
* What a conversation goes by: its real name (see `realName`), else a
|
|
5
|
+
* stand-in until it has one: the first line of what the person first said,
|
|
6
|
+
* else "Not started".
|
|
7
|
+
*/
|
|
8
|
+
export declare function nameOf(conversation: ConversationState, lanes: readonly LaneRecord[]): string;
|
|
9
|
+
/**
|
|
10
|
+
* The name a conversation has earned, or null: the name the person gave it,
|
|
11
|
+
* else the lanes it was started on, so an orchestrator's follows a lane's
|
|
12
|
+
* renames and keeps them through a todo it does itself, else the task its
|
|
13
|
+
* agent holds, so it follows the agent from task to task, or held last, so a
|
|
14
|
+
* finished task keeps its name until the agent takes another, else the
|
|
15
|
+
* agent's title.
|
|
16
|
+
*/
|
|
17
|
+
export declare function realName(conversation: ConversationState, lanes: readonly LaneRecord[]): string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Whether a conversation goes by the task its agent holds or held last, as
|
|
20
|
+
* `nameOf` names it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function namedForTask(conversation: ConversationState): boolean;
|
|
23
|
+
/** What each `[SPLATES LANE ...]` the person's first words start with names. */
|
|
24
|
+
export declare function lanesOf(conversation: ConversationState): string[];
|
|
25
|
+
/** The lanes each Started card `conversation`'s agent said names. */
|
|
26
|
+
export declare function startedLanes(conversation: ConversationState): string[];
|
|
27
|
+
/** The first line the person said in a conversation, or null before they say any. */
|
|
28
|
+
export declare function openingOf(conversation: ConversationState): string | null;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { IdProvider } from "webappwiz/id";
|
|
2
|
+
import type { Fs, Lock } from "webappwiz/system";
|
|
3
|
+
import type { Timer, WallClock } from "webappwiz/time";
|
|
4
|
+
import type { Adherence } from "./adherence.js";
|
|
5
|
+
import type { Agent, Launch, Launcher } from "./agent-process.js";
|
|
6
|
+
import type { ArtifactLimits } from "./artifacts.js";
|
|
7
|
+
import type { ProjectRoster } from "./conversation-host.js";
|
|
8
|
+
import type { Limit } from "./conversation-state.js";
|
|
9
|
+
import type { Limits } from "./limits.js";
|
|
10
|
+
import type { Offered } from "./offered.js";
|
|
11
|
+
import type { Outcomes } from "./outcomes.js";
|
|
12
|
+
import type { SessionServers } from "./shared-browser.js";
|
|
13
|
+
import type { Watch } from "./watch.js";
|
|
14
|
+
import type { WorkerMachine } from "./worker-machine.js";
|
|
15
|
+
export interface ConversationsOptions {
|
|
16
|
+
fs?: Fs;
|
|
17
|
+
/** How many bytes of artifacts each may keep; `ARTIFACT_LIMITS` by default. */
|
|
18
|
+
artifacts?: ArtifactLimits;
|
|
19
|
+
ids?: IdProvider;
|
|
20
|
+
/** What starts agents, when nothing takes one back after a restart; this process by default. */
|
|
21
|
+
launch?: Launch;
|
|
22
|
+
/** What starts agents and takes them back after a restart, over `launch`: a worker. */
|
|
23
|
+
launcher?: Launcher;
|
|
24
|
+
/**
|
|
25
|
+
* Where agents run, which their background output is read from; this
|
|
26
|
+
* machine by default.
|
|
27
|
+
*/
|
|
28
|
+
machine?: WorkerMachine;
|
|
29
|
+
/**
|
|
30
|
+
* Held while each agent starts, shared by every project's conversations
|
|
31
|
+
* so no two start at once; one of their own by default.
|
|
32
|
+
*/
|
|
33
|
+
starting?: Lock;
|
|
34
|
+
timer?: Timer;
|
|
35
|
+
clock?: WallClock;
|
|
36
|
+
/** What watches the agents' commands for what they do to git; none by default. */
|
|
37
|
+
watch?: Watch | null;
|
|
38
|
+
/** Where what each agent's sessions offer is kept across projects; nowhere by default. */
|
|
39
|
+
offered?: Offered | null;
|
|
40
|
+
/** Where each agent's plan limits are kept across projects; nowhere by default. */
|
|
41
|
+
limits?: Limits | null;
|
|
42
|
+
/**
|
|
43
|
+
* Where how each conversation followed the splates skill is kept across
|
|
44
|
+
* projects, judged as each turn ends; nowhere by default.
|
|
45
|
+
*/
|
|
46
|
+
adherence?: Adherence | null;
|
|
47
|
+
/**
|
|
48
|
+
* Where how each task ended is kept across projects, credited with the
|
|
49
|
+
* turn it ended in once that turn ends; nowhere by default.
|
|
50
|
+
*/
|
|
51
|
+
outcomes?: Outcomes | null;
|
|
52
|
+
/**
|
|
53
|
+
* Asks an agent that does not send its plan's windows for them, after
|
|
54
|
+
* each of its turns; none by default.
|
|
55
|
+
*/
|
|
56
|
+
readLimits?: ((agent: Agent) => Promise<Limit[]>) | null;
|
|
57
|
+
/**
|
|
58
|
+
* The main tree, where a conversation carries on once its task's worktree
|
|
59
|
+
* is gone, as when the task landed while `splates server` was not there to hear
|
|
60
|
+
* of it; without it, such a conversation cannot resume.
|
|
61
|
+
*/
|
|
62
|
+
root?: string | null;
|
|
63
|
+
/**
|
|
64
|
+
* The splates projects on this machine, for a prompt's `#slug` to name one
|
|
65
|
+
* by; none by default.
|
|
66
|
+
*/
|
|
67
|
+
projects?: ProjectRoster | null;
|
|
68
|
+
/**
|
|
69
|
+
* The MCP servers each session is offered, beyond the agent's own, shared
|
|
70
|
+
* across projects like the browser they serve; none by default.
|
|
71
|
+
*/
|
|
72
|
+
servers?: SessionServers | null;
|
|
73
|
+
}
|