@codeworksh/schema 0.0.0-stage → 0.1.0-canary.165.2.g336229f9
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 +47 -2
- package/common.d.mts +86 -0
- package/common.mjs +88 -0
- package/common.mjs.map +1 -0
- package/daemon.d.mts +12 -0
- package/daemon.mjs +22 -0
- package/daemon.mjs.map +1 -0
- package/door.d.mts +33 -0
- package/door.mjs +52 -0
- package/door.mjs.map +1 -0
- package/event.d.mts +79 -0
- package/event.mjs +35 -0
- package/event.mjs.map +1 -0
- package/forwarded.d.mts +13 -0
- package/forwarded.mjs +25 -0
- package/forwarded.mjs.map +1 -0
- package/host/envelope.d.mts +36 -0
- package/host/envelope.mjs +35 -0
- package/host/envelope.mjs.map +1 -0
- package/host/part.d.mts +2 -0
- package/host/part.mjs +60 -0
- package/host/part.mjs.map +1 -0
- package/host/principal.d.mts +36 -0
- package/host/principal.mjs +24 -0
- package/host/principal.mjs.map +1 -0
- package/host/records.d.mts +1051 -0
- package/host/records.mjs +494 -0
- package/host/records.mjs.map +1 -0
- package/host.d.mts +2224 -0
- package/host.mjs +812 -0
- package/host.mjs.map +1 -0
- package/ids.d.mts +53 -0
- package/ids.mjs +60 -0
- package/ids.mjs.map +1 -0
- package/jws.d.mts +84 -0
- package/jws.mjs +119 -0
- package/jws.mjs.map +1 -0
- package/location.d.mts +55 -0
- package/location.mjs +51 -0
- package/location.mjs.map +1 -0
- package/machine.d.mts +77 -0
- package/machine.mjs +48 -0
- package/machine.mjs.map +1 -0
- package/mcp.d.mts +24 -0
- package/mcp.mjs +36 -0
- package/mcp.mjs.map +1 -0
- package/model.d.mts +18 -0
- package/model.mjs +35 -0
- package/model.mjs.map +1 -0
- package/package.json +182 -5
- package/pairing.d.mts +67 -0
- package/pairing.mjs +67 -0
- package/pairing.mjs.map +1 -0
- package/part-Bzm-yNax.d.mts +69 -0
- package/project.d.mts +30 -0
- package/project.mjs +27 -0
- package/project.mjs.map +1 -0
- package/records-316ZUpKX.mjs +127 -0
- package/records-316ZUpKX.mjs.map +1 -0
- package/relay.d.mts +285 -0
- package/relay.mjs +115 -0
- package/relay.mjs.map +1 -0
- package/repo.d.mts +42 -0
- package/repo.mjs +46 -0
- package/repo.mjs.map +1 -0
- package/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/sandbox/driver.d.mts +10 -0
- package/sandbox/driver.mjs +13 -0
- package/sandbox/driver.mjs.map +1 -0
- package/sandbox/errors.d.mts +130 -0
- package/sandbox/errors.mjs +112 -0
- package/sandbox/errors.mjs.map +1 -0
- package/sandbox/instance.d.mts +152 -0
- package/sandbox/instance.mjs +150 -0
- package/sandbox/instance.mjs.map +1 -0
- package/session.d.mts +59 -0
- package/session.mjs +69 -0
- package/session.mjs.map +1 -0
- package/settings.d.mts +22 -0
- package/settings.mjs +32 -0
- package/settings.mjs.map +1 -0
- package/shell.d.mts +5 -0
- package/shell.mjs +7 -0
- package/shell.mjs.map +1 -0
- package/space-CR-9UxdT.d.mts +25 -0
- package/space.d.mts +2 -0
- package/space.mjs +33 -0
- package/space.mjs.map +1 -0
- package/thread.d.mts +50 -0
- package/thread.mjs +69 -0
- package/thread.mjs.map +1 -0
- package/usage-B_TDmpKC.d.mts +15 -0
- package/usage.d.mts +2 -0
- package/usage.mjs +43 -0
- package/usage.mjs.map +1 -0
package/host.mjs
ADDED
|
@@ -0,0 +1,812 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { AbsolutePath, optional } from "./common.mjs";
|
|
3
|
+
import { DaemonCallError } from "./daemon.mjs";
|
|
4
|
+
import { SubscriptionOverflowError } from "./event.mjs";
|
|
5
|
+
import { EncodingError, EventEnvelope } from "./host/envelope.mjs";
|
|
6
|
+
import { Door, Forbidden } from "./host/principal.mjs";
|
|
7
|
+
import { MessageID, SessionID, ThreadID } from "./ids.mjs";
|
|
8
|
+
import { ModelCatalogError, ThinkingLevel } from "./model.mjs";
|
|
9
|
+
import { ID, Selection } from "./sandbox/instance.mjs";
|
|
10
|
+
import { Delivery, PromptConflictError, RelinkError, SessionLinkedSpaceNotFoundError, SessionNotFoundError } from "./session.mjs";
|
|
11
|
+
import { ForkError, RunError, RunOutcome, RunState, ThreadNotFoundError } from "./thread.mjs";
|
|
12
|
+
import { edges } from "./usage.mjs";
|
|
13
|
+
import { Part, ToolCall } from "./host/part.mjs";
|
|
14
|
+
import { Clone, ClonePhase, CloneStage, DeviceInfo, Folder, HistoryEntry, HostError, HostRecords as records_exports, IndexItem, LiveDelta, LogSynced, ModelList, ModelProvider, OAuthCredentials, OAuthError, OAuthInfo, OAuthProvider, ProjectInfo, QueuedPrompt, Repository, RuntimeConfig, SandboxInfo, SessionInfo, SpaceInfo, ThreadInfo, ThreadItem, ThreadOrigin, ThreadRun, ThreadSummary, ThreadUsage, UsageItem } from "./host/records.mjs";
|
|
15
|
+
import { ProjectCheckoutError, ProjectNotFoundError } from "./project.mjs";
|
|
16
|
+
import { DirectoryNotFoundError, NotDirectoryError } from "./location.mjs";
|
|
17
|
+
import { ConnectError, ConnectEvent, Disconnect, Disconnected, Status } from "./machine.mjs";
|
|
18
|
+
import { McpSkipped, McpState, UnknownServerError } from "./mcp.mjs";
|
|
19
|
+
import { SandboxBusyError, SandboxDriverNotRegisteredError, SandboxDriverRegistrationError, SandboxNotFoundError, SandboxProviderError, SandboxRemovedError, SandboxTransitionConflictError, SandboxUnavailError, SandboxUnsupportedError } from "./sandbox/errors.mjs";
|
|
20
|
+
import { SettingsConflictError, SettingsError } from "./settings.mjs";
|
|
21
|
+
import { Schema } from "effect";
|
|
22
|
+
import { Rpc, RpcGroup } from "effect/rpc";
|
|
23
|
+
//#region src/host.ts
|
|
24
|
+
var host_exports = /* @__PURE__ */ __exportAll({
|
|
25
|
+
Api: () => Api,
|
|
26
|
+
Clone: () => Clone,
|
|
27
|
+
ClonePhase: () => ClonePhase,
|
|
28
|
+
CloneStage: () => CloneStage,
|
|
29
|
+
DaemonCallError: () => DaemonCallError,
|
|
30
|
+
Delivery: () => Delivery,
|
|
31
|
+
DeviceInfo: () => DeviceInfo,
|
|
32
|
+
EncodingError: () => EncodingError,
|
|
33
|
+
EventEnvelope: () => EventEnvelope,
|
|
34
|
+
Folder: () => Folder,
|
|
35
|
+
Forbidden: () => Forbidden,
|
|
36
|
+
ForkError: () => ForkError,
|
|
37
|
+
HistoryEntry: () => HistoryEntry,
|
|
38
|
+
Host: () => host_exports,
|
|
39
|
+
HostError: () => HostError,
|
|
40
|
+
HostRecords: () => records_exports,
|
|
41
|
+
IndexItem: () => IndexItem,
|
|
42
|
+
LiveDelta: () => LiveDelta,
|
|
43
|
+
LogSynced: () => LogSynced,
|
|
44
|
+
ModelCatalogError: () => ModelCatalogError,
|
|
45
|
+
ModelList: () => ModelList,
|
|
46
|
+
ModelProvider: () => ModelProvider,
|
|
47
|
+
OAuthCredentials: () => OAuthCredentials,
|
|
48
|
+
OAuthError: () => OAuthError,
|
|
49
|
+
OAuthInfo: () => OAuthInfo,
|
|
50
|
+
OAuthProvider: () => OAuthProvider,
|
|
51
|
+
Part: () => Part,
|
|
52
|
+
ProjectCheckoutError: () => ProjectCheckoutError,
|
|
53
|
+
ProjectInfo: () => ProjectInfo,
|
|
54
|
+
ProjectNotFoundError: () => ProjectNotFoundError,
|
|
55
|
+
PromptConflictError: () => PromptConflictError,
|
|
56
|
+
QueuedPrompt: () => QueuedPrompt,
|
|
57
|
+
RelinkError: () => RelinkError,
|
|
58
|
+
Repository: () => Repository,
|
|
59
|
+
RunError: () => RunError,
|
|
60
|
+
RunOutcome: () => RunOutcome,
|
|
61
|
+
RunState: () => RunState,
|
|
62
|
+
RuntimeConfig: () => RuntimeConfig,
|
|
63
|
+
SandboxInfo: () => SandboxInfo,
|
|
64
|
+
SessionInfo: () => SessionInfo,
|
|
65
|
+
SessionLinkedSpaceNotFoundError: () => SessionLinkedSpaceNotFoundError,
|
|
66
|
+
SessionNotFoundError: () => SessionNotFoundError,
|
|
67
|
+
SettingsConflictError: () => SettingsConflictError,
|
|
68
|
+
SettingsError: () => SettingsError,
|
|
69
|
+
SpaceInfo: () => SpaceInfo,
|
|
70
|
+
SubscriptionOverflowError: () => SubscriptionOverflowError,
|
|
71
|
+
ThinkingLevel: () => ThinkingLevel,
|
|
72
|
+
ThreadInfo: () => ThreadInfo,
|
|
73
|
+
ThreadItem: () => ThreadItem,
|
|
74
|
+
ThreadNotFoundError: () => ThreadNotFoundError,
|
|
75
|
+
ThreadOrigin: () => ThreadOrigin,
|
|
76
|
+
ThreadRun: () => ThreadRun,
|
|
77
|
+
ThreadSummary: () => ThreadSummary,
|
|
78
|
+
ThreadUsage: () => ThreadUsage,
|
|
79
|
+
ToolCall: () => ToolCall,
|
|
80
|
+
UnknownServerError: () => UnknownServerError,
|
|
81
|
+
UsageItem: () => UsageItem,
|
|
82
|
+
edges: () => edges,
|
|
83
|
+
path: () => path
|
|
84
|
+
});
|
|
85
|
+
/** The HTTP path the RPC endpoint is served on; the version moves with breaking wire changes. */
|
|
86
|
+
const path = "/rpc/v1";
|
|
87
|
+
/** A thread of a session: `threadId`, or the session's `main` thread when absent. */
|
|
88
|
+
const ThreadRef = {
|
|
89
|
+
sessionId: SessionID,
|
|
90
|
+
threadId: optional(ThreadID)
|
|
91
|
+
};
|
|
92
|
+
/** A thread's MCP server, by the name its `mcp.json` gives it. */
|
|
93
|
+
const McpServerRef = {
|
|
94
|
+
...ThreadRef,
|
|
95
|
+
server: Schema.String
|
|
96
|
+
};
|
|
97
|
+
const SandboxRef = Selection;
|
|
98
|
+
/** A project's name as a client sets it: trimmed, never empty. */
|
|
99
|
+
const ProjectName = Schema.Trimmed.check(Schema.isNonEmpty());
|
|
100
|
+
const SessionErrors = Schema.Union([
|
|
101
|
+
SessionNotFoundError,
|
|
102
|
+
ThreadNotFoundError,
|
|
103
|
+
SessionLinkedSpaceNotFoundError,
|
|
104
|
+
RelinkError
|
|
105
|
+
]);
|
|
106
|
+
const ThreadErrors = Schema.Union([SessionNotFoundError, ThreadNotFoundError]);
|
|
107
|
+
const SandboxErrors = Schema.Union([
|
|
108
|
+
SandboxNotFoundError,
|
|
109
|
+
SandboxDriverNotRegisteredError,
|
|
110
|
+
SandboxDriverRegistrationError,
|
|
111
|
+
SandboxUnsupportedError,
|
|
112
|
+
SandboxProviderError,
|
|
113
|
+
SandboxUnavailError,
|
|
114
|
+
SandboxRemovedError,
|
|
115
|
+
SandboxTransitionConflictError,
|
|
116
|
+
SandboxBusyError
|
|
117
|
+
]);
|
|
118
|
+
const LocationErrors = Schema.Union([DirectoryNotFoundError, NotDirectoryError]);
|
|
119
|
+
/** One of a thread's MCP servers as that thread sees it. */
|
|
120
|
+
const McpStatus = Schema.Struct({
|
|
121
|
+
server: Schema.String,
|
|
122
|
+
state: McpState,
|
|
123
|
+
error: optional(Schema.String),
|
|
124
|
+
/** Tools the server offered when last listed, each with its exposure in the thread. */
|
|
125
|
+
tools: Schema.Array(Schema.Struct({
|
|
126
|
+
name: Schema.String,
|
|
127
|
+
exposure: Schema.Literals([
|
|
128
|
+
"direct",
|
|
129
|
+
"codemode",
|
|
130
|
+
"deferred",
|
|
131
|
+
"hidden"
|
|
132
|
+
])
|
|
133
|
+
})),
|
|
134
|
+
resources: Schema.Boolean,
|
|
135
|
+
/** Tools it listed last that were left out because the MCP SDK rejects them; absent when none were. */
|
|
136
|
+
skipped: optional(McpSkipped)
|
|
137
|
+
});
|
|
138
|
+
const McpErrors = Schema.Union([ThreadErrors, UnknownServerError]);
|
|
139
|
+
const SettingsFileRef = {
|
|
140
|
+
projectId: optional(Schema.String),
|
|
141
|
+
file: Schema.Literals(["settings", "mcp"])
|
|
142
|
+
};
|
|
143
|
+
/** The settings a project's `settings.jsonc` falls back to, as the page shows them. */
|
|
144
|
+
const Inherited = Schema.Struct({ retry: Schema.Struct({
|
|
145
|
+
maxRetries: Schema.Int,
|
|
146
|
+
baseDelayMs: Schema.Int,
|
|
147
|
+
maxDelayMs: Schema.Int
|
|
148
|
+
}) });
|
|
149
|
+
const SettingsFileErrors = Schema.Union([
|
|
150
|
+
SettingsError,
|
|
151
|
+
ProjectNotFoundError,
|
|
152
|
+
ProjectCheckoutError
|
|
153
|
+
]);
|
|
154
|
+
const Api = RpcGroup.make(
|
|
155
|
+
/**
|
|
156
|
+
* The server's own identity: the process and build a client is talking to.
|
|
157
|
+
*
|
|
158
|
+
* The health probe: a discovery registration names a pid and version, and a
|
|
159
|
+
* caller confirms the process answering is the one that registered before it
|
|
160
|
+
* trusts the endpoint. Like every other capability it rides the RPC channel,
|
|
161
|
+
* so there is no separate HTTP surface to keep in step.
|
|
162
|
+
*/
|
|
163
|
+
Rpc.make("server.info", {
|
|
164
|
+
payload: {},
|
|
165
|
+
success: Schema.Struct({
|
|
166
|
+
pid: Schema.Int,
|
|
167
|
+
version: Schema.String,
|
|
168
|
+
/** The harness store this server serves; a sync cursor is only valid against it. */
|
|
169
|
+
storeId: Schema.String,
|
|
170
|
+
/** The store's head: the last revision taken. */
|
|
171
|
+
rev: Schema.Int,
|
|
172
|
+
/** The machine it runs on, by the name its user knows it; absent when the OS names it nothing. */
|
|
173
|
+
host: optional(Schema.Struct({ name: Schema.String })),
|
|
174
|
+
/** The id in the home's `machine.json`; absent until the home has one. */
|
|
175
|
+
machineId: optional(Schema.String)
|
|
176
|
+
})
|
|
177
|
+
}),
|
|
178
|
+
/**
|
|
179
|
+
* The index of this machine: every project, space, session and thread whose revision is past
|
|
180
|
+
* `after`, in revision order, then `Synced` at the head read when the call began; then the same
|
|
181
|
+
* live after each commit. `after: 0` reads the whole index. A row written again moves to a later
|
|
182
|
+
* revision and is sent again; the latest wins. A deleted session arrives as `Removed`. `boot` is
|
|
183
|
+
* the one the last `Synced` carried: when the store left that line (a restored backup), it reads
|
|
184
|
+
* from zero instead.
|
|
185
|
+
*/
|
|
186
|
+
Rpc.make("index.sync", {
|
|
187
|
+
payload: {
|
|
188
|
+
after: Schema.Int,
|
|
189
|
+
boot: optional(Schema.String)
|
|
190
|
+
},
|
|
191
|
+
success: IndexItem,
|
|
192
|
+
stream: true
|
|
193
|
+
}),
|
|
194
|
+
/**
|
|
195
|
+
* The usage rollup of this machine: every `usage` and `tally` row whose revision is past `after`,
|
|
196
|
+
* in revision order, then `Synced` at the head read when the call began; then the same live after
|
|
197
|
+
* each commit. `after: 0` reads every row. A row written again moves to a later revision and is
|
|
198
|
+
* sent again in full; the latest wins. Rows carry running totals, not deltas: a client replaces a
|
|
199
|
+
* row by its key, never adds to it. A deleted session's rows stay. `boot` is the one the last
|
|
200
|
+
* `Synced` carried: when the store left that line (a restored backup), it reads from zero instead.
|
|
201
|
+
*/
|
|
202
|
+
Rpc.make("usage.sync", {
|
|
203
|
+
payload: {
|
|
204
|
+
after: Schema.Int,
|
|
205
|
+
boot: optional(Schema.String)
|
|
206
|
+
},
|
|
207
|
+
success: UsageItem,
|
|
208
|
+
stream: true
|
|
209
|
+
}),
|
|
210
|
+
Rpc.make("auth.save", {
|
|
211
|
+
payload: { credentials: OAuthCredentials },
|
|
212
|
+
success: OAuthInfo,
|
|
213
|
+
error: OAuthError
|
|
214
|
+
}),
|
|
215
|
+
Rpc.make("auth.status", {
|
|
216
|
+
payload: { provider: OAuthProvider },
|
|
217
|
+
success: Schema.NullOr(OAuthInfo),
|
|
218
|
+
error: OAuthError
|
|
219
|
+
}),
|
|
220
|
+
Rpc.make("auth.refresh", {
|
|
221
|
+
payload: { provider: OAuthProvider },
|
|
222
|
+
success: Schema.NullOr(OAuthInfo),
|
|
223
|
+
error: OAuthError
|
|
224
|
+
}),
|
|
225
|
+
Rpc.make("auth.logout", {
|
|
226
|
+
payload: { provider: OAuthProvider },
|
|
227
|
+
success: Schema.Void,
|
|
228
|
+
error: OAuthError
|
|
229
|
+
}),
|
|
230
|
+
/** A session and its `main` thread; the main thread's info, with the session embedded. */
|
|
231
|
+
Rpc.make("session.create", {
|
|
232
|
+
payload: {
|
|
233
|
+
/** The main thread's title; absent = its first prompt names it. */
|
|
234
|
+
title: optional(Schema.String),
|
|
235
|
+
directory: optional(Schema.String),
|
|
236
|
+
/**
|
|
237
|
+
* The host directory this session is anchored to, usually the caller's project root.
|
|
238
|
+
* Unrelated to `directory`, which names a place inside the session's space.
|
|
239
|
+
*
|
|
240
|
+
* It is an anchor and nothing more: whatever needs a host-side directory resolves from
|
|
241
|
+
* here rather than from wherever the server happens to be running. What reads it is the
|
|
242
|
+
* reader's business, not this field's.
|
|
243
|
+
*
|
|
244
|
+
* Optional and honoured as given. Omitting it is normal, not a failure.
|
|
245
|
+
*/
|
|
246
|
+
hostDir: optional(AbsolutePath),
|
|
247
|
+
sandbox: optional(SandboxRef),
|
|
248
|
+
runtime: optional(RuntimeConfig),
|
|
249
|
+
/**
|
|
250
|
+
* Names the project when this session creates it, ahead of the repository's and the
|
|
251
|
+
* folder's name. A project that already exists keeps its name; `project.rename` changes it.
|
|
252
|
+
*/
|
|
253
|
+
project: optional(Schema.Struct({ name: ProjectName }))
|
|
254
|
+
},
|
|
255
|
+
success: ThreadInfo,
|
|
256
|
+
/** `HostError` when `hostDir` is a clone still running, failed or cancelled. */
|
|
257
|
+
error: Schema.Union([
|
|
258
|
+
SessionErrors,
|
|
259
|
+
SandboxErrors,
|
|
260
|
+
LocationErrors,
|
|
261
|
+
HostError
|
|
262
|
+
])
|
|
263
|
+
}),
|
|
264
|
+
/** The `origin` URL of a project's main checkout on the host, credentials taken out; null when there is none. */
|
|
265
|
+
Rpc.make("project.remote", {
|
|
266
|
+
payload: { projectId: Schema.String },
|
|
267
|
+
success: Schema.Struct({ url: Schema.NullOr(Schema.String) }),
|
|
268
|
+
error: ProjectNotFoundError
|
|
269
|
+
}),
|
|
270
|
+
Rpc.make("project.rename", {
|
|
271
|
+
payload: {
|
|
272
|
+
projectId: Schema.String,
|
|
273
|
+
name: ProjectName
|
|
274
|
+
},
|
|
275
|
+
success: Schema.Struct({
|
|
276
|
+
id: Schema.String,
|
|
277
|
+
name: Schema.String
|
|
278
|
+
}),
|
|
279
|
+
error: ProjectNotFoundError
|
|
280
|
+
}),
|
|
281
|
+
/**
|
|
282
|
+
* A settings file as written: the project's when `projectId` is given -- the one sessions in its
|
|
283
|
+
* main checkout read -- otherwise the user's. `version` is what `settings.write` is held to;
|
|
284
|
+
* `error` is what the runtime would reject in the file as it stands.
|
|
285
|
+
*/
|
|
286
|
+
Rpc.make("settings.read", {
|
|
287
|
+
payload: SettingsFileRef,
|
|
288
|
+
success: Schema.Struct({
|
|
289
|
+
path: Schema.String,
|
|
290
|
+
source: Schema.String,
|
|
291
|
+
exists: Schema.Boolean,
|
|
292
|
+
version: Schema.String,
|
|
293
|
+
/** The file's JSONC as a value; absent when it does not parse. */
|
|
294
|
+
value: optional(Schema.Unknown),
|
|
295
|
+
error: optional(Schema.String),
|
|
296
|
+
/**
|
|
297
|
+
* For `settings.jsonc`: what applies where this file sets nothing -- the user's settings over the
|
|
298
|
+
* defaults for a project's file, the defaults for the user's. Absent when a lower file is broken.
|
|
299
|
+
*/
|
|
300
|
+
inherited: optional(Inherited),
|
|
301
|
+
/**
|
|
302
|
+
* For `mcp.json`: the servers as sessions use them, user and project merged; entries the runtime
|
|
303
|
+
* skips are left out. `from` is the file that defines the server, not one that only overrides it.
|
|
304
|
+
*/
|
|
305
|
+
servers: optional(Schema.Array(Schema.Struct({
|
|
306
|
+
name: Schema.String,
|
|
307
|
+
from: Schema.Literals(["user", "project"]),
|
|
308
|
+
enabled: Schema.Boolean
|
|
309
|
+
})))
|
|
310
|
+
}),
|
|
311
|
+
error: SettingsFileErrors
|
|
312
|
+
}),
|
|
313
|
+
/** The whole file, written only when it is still at `version` and the runtime would accept it. */
|
|
314
|
+
Rpc.make("settings.write", {
|
|
315
|
+
payload: {
|
|
316
|
+
...SettingsFileRef,
|
|
317
|
+
source: Schema.String,
|
|
318
|
+
version: Schema.String
|
|
319
|
+
},
|
|
320
|
+
success: Schema.Struct({ version: Schema.String }),
|
|
321
|
+
error: Schema.Union([SettingsFileErrors, SettingsConflictError])
|
|
322
|
+
}),
|
|
323
|
+
/**
|
|
324
|
+
* One value at `at` set in place, keeping the rest of the file as written; no `value` removes it.
|
|
325
|
+
* Refused when the result would not be accepted.
|
|
326
|
+
*/
|
|
327
|
+
Rpc.make("settings.set", {
|
|
328
|
+
payload: {
|
|
329
|
+
...SettingsFileRef,
|
|
330
|
+
at: Schema.NonEmptyArray(Schema.Union([Schema.String, Schema.Int])),
|
|
331
|
+
value: optional(Schema.Unknown)
|
|
332
|
+
},
|
|
333
|
+
success: Schema.Struct({ version: Schema.String }),
|
|
334
|
+
error: SettingsFileErrors
|
|
335
|
+
}),
|
|
336
|
+
/**
|
|
337
|
+
* The models a session anchored at `hostDir` can use: providers this server holds credentials
|
|
338
|
+
* for, in the catalog plus that project's settings, and the model a session runs when it names
|
|
339
|
+
* none: the one settings name, else one picked from those providers. `default` is absent when
|
|
340
|
+
* neither gives one. Without `hostDir`, only the user's settings apply. Credentials are checked
|
|
341
|
+
* for presence, not validity.
|
|
342
|
+
*/
|
|
343
|
+
Rpc.make("model.list", {
|
|
344
|
+
payload: { hostDir: optional(AbsolutePath) },
|
|
345
|
+
success: ModelList,
|
|
346
|
+
error: Schema.Union([SettingsError, ModelCatalogError])
|
|
347
|
+
}),
|
|
348
|
+
/**
|
|
349
|
+
* Point an existing session at a host directory, or clear it with `null`.
|
|
350
|
+
*
|
|
351
|
+
* Not `session.relink`: that moves where the *work* happens, this changes which host directory
|
|
352
|
+
* the session is *anchored to*. Conflating them would recreate exactly the `cwd`/`hostDir`
|
|
353
|
+
* confusion the split exists to remove, which is why they sound alike and stay apart.
|
|
354
|
+
*/
|
|
355
|
+
Rpc.make("session.link", {
|
|
356
|
+
payload: {
|
|
357
|
+
sessionId: SessionID,
|
|
358
|
+
/** Absent clears the anchor, leaving the session with no host directory. */
|
|
359
|
+
hostDir: optional(AbsolutePath)
|
|
360
|
+
},
|
|
361
|
+
success: SessionInfo,
|
|
362
|
+
error: SessionNotFoundError
|
|
363
|
+
}),
|
|
364
|
+
/**
|
|
365
|
+
* Moves where the work happens. Without `threadId`, the session's default space and directory,
|
|
366
|
+
* which every thread without its own placement follows; with it, that thread's placement only.
|
|
367
|
+
* Answers with the addressed thread (`main` when absent): its `placement` and embedded session
|
|
368
|
+
* show where it now runs.
|
|
369
|
+
*/
|
|
370
|
+
Rpc.make("session.relink", {
|
|
371
|
+
payload: {
|
|
372
|
+
sessionId: SessionID,
|
|
373
|
+
threadId: optional(ThreadID),
|
|
374
|
+
sandbox: optional(SandboxRef),
|
|
375
|
+
directory: optional(Schema.String)
|
|
376
|
+
},
|
|
377
|
+
success: ThreadInfo,
|
|
378
|
+
error: Schema.Union([
|
|
379
|
+
SessionErrors,
|
|
380
|
+
SandboxErrors,
|
|
381
|
+
LocationErrors
|
|
382
|
+
])
|
|
383
|
+
}),
|
|
384
|
+
/** Stops every thread, then removes the session with its log. `deleted` is false when it did not exist. */
|
|
385
|
+
Rpc.make("session.delete", {
|
|
386
|
+
payload: { sessionId: SessionID },
|
|
387
|
+
success: Schema.Struct({ deleted: Schema.Boolean })
|
|
388
|
+
}),
|
|
389
|
+
/** Interrupts every running thread of the session. */
|
|
390
|
+
Rpc.make("session.interrupt", {
|
|
391
|
+
payload: { sessionId: SessionID },
|
|
392
|
+
success: Schema.Struct({ interrupted: Schema.Boolean })
|
|
393
|
+
}),
|
|
394
|
+
/**
|
|
395
|
+
* A session's durable events after `after` (exclusive; omitted reads from the start), then a
|
|
396
|
+
* `log.synced` marker at the head read when the call began. With `follow`, each event then
|
|
397
|
+
* streams as it commits; without it the stream ends at the marker. Every thread of the session
|
|
398
|
+
* writes this one log; events name their `threadId`.
|
|
399
|
+
* Ephemeral events (text and tool progress deltas) are never stored, so they are not here;
|
|
400
|
+
* `event.subscribe` carries them live. To resume, pass the higher of the last event's
|
|
401
|
+
* `durable.seq` and the last marker's `seq`: the marker can sit past the last event sent.
|
|
402
|
+
* With `threadId`, only that thread's events; the marker still names the session's head. A fork's
|
|
403
|
+
* own log starts at its `session.thread.forked`: what it inherits is in `thread.history`.
|
|
404
|
+
*/
|
|
405
|
+
Rpc.make("session.log", {
|
|
406
|
+
payload: {
|
|
407
|
+
sessionId: SessionID,
|
|
408
|
+
threadId: optional(ThreadID),
|
|
409
|
+
after: optional(Schema.Int),
|
|
410
|
+
follow: optional(Schema.Boolean)
|
|
411
|
+
},
|
|
412
|
+
success: Schema.Union([EventEnvelope, LogSynced]),
|
|
413
|
+
error: Schema.Union([SessionNotFoundError, EncodingError]),
|
|
414
|
+
stream: true
|
|
415
|
+
}),
|
|
416
|
+
/** Threads newest first, each with its session embedded: of one session, or all. */
|
|
417
|
+
Rpc.make("thread.list", {
|
|
418
|
+
payload: { sessionId: optional(SessionID) },
|
|
419
|
+
success: Schema.Array(ThreadInfo)
|
|
420
|
+
}),
|
|
421
|
+
Rpc.make("thread.info", {
|
|
422
|
+
payload: ThreadRef,
|
|
423
|
+
success: ThreadInfo,
|
|
424
|
+
error: ThreadErrors
|
|
425
|
+
}),
|
|
426
|
+
/**
|
|
427
|
+
* The conversation in a thread's line: user and assistant messages, inherited ones first, oldest
|
|
428
|
+
* first. The harness's own entries (compactions, resets, notices) are left out.
|
|
429
|
+
*/
|
|
430
|
+
Rpc.make("thread.history", {
|
|
431
|
+
payload: ThreadRef,
|
|
432
|
+
success: Schema.Struct({ entries: Schema.Array(HistoryEntry) }),
|
|
433
|
+
error: ThreadErrors
|
|
434
|
+
}),
|
|
435
|
+
/**
|
|
436
|
+
* Prompts admitted to the thread but not yet promoted, in admission order. Admission and
|
|
437
|
+
* promotion are durable events, so a client following `session.log` rereads this whenever the
|
|
438
|
+
* log moves.
|
|
439
|
+
*/
|
|
440
|
+
Rpc.make("thread.queue", {
|
|
441
|
+
payload: ThreadRef,
|
|
442
|
+
success: Schema.Struct({ entries: Schema.Array(QueuedPrompt) }),
|
|
443
|
+
error: ThreadErrors
|
|
444
|
+
}),
|
|
445
|
+
/**
|
|
446
|
+
* One thread's detail. Without `after`, the newest entries of its line (inherited ones
|
|
447
|
+
* included) within `budget` bytes (default 1 MiB) and its pending inbox, then `Synced` with
|
|
448
|
+
* `floor`. With `after`, its own entries and inbox rows whose revision is past it, then
|
|
449
|
+
* `Synced`. Then the same live after each commit, with the thread's text and thinking deltas
|
|
450
|
+
* as `Delta` between.
|
|
451
|
+
*/
|
|
452
|
+
Rpc.make("thread.sync", {
|
|
453
|
+
payload: {
|
|
454
|
+
sessionId: SessionID,
|
|
455
|
+
threadId: ThreadID,
|
|
456
|
+
after: optional(Schema.Int),
|
|
457
|
+
budget: optional(Schema.Int)
|
|
458
|
+
},
|
|
459
|
+
success: ThreadItem,
|
|
460
|
+
error: Schema.Union([
|
|
461
|
+
ThreadErrors,
|
|
462
|
+
SubscriptionOverflowError,
|
|
463
|
+
EncodingError
|
|
464
|
+
]),
|
|
465
|
+
stream: true
|
|
466
|
+
}),
|
|
467
|
+
/**
|
|
468
|
+
* Older entries of a thread's line (inherited ones included), oldest first: the newest `limit`
|
|
469
|
+
* whose `seq` is below `before`, cut to `budget` bytes (default 1 MiB). The newest is always sent.
|
|
470
|
+
*/
|
|
471
|
+
Rpc.make("thread.page", {
|
|
472
|
+
payload: {
|
|
473
|
+
sessionId: SessionID,
|
|
474
|
+
threadId: ThreadID,
|
|
475
|
+
before: Schema.Int,
|
|
476
|
+
limit: Schema.Int,
|
|
477
|
+
budget: optional(Schema.Int)
|
|
478
|
+
},
|
|
479
|
+
success: Schema.Struct({ entries: Schema.Array(HistoryEntry) }),
|
|
480
|
+
error: ThreadErrors
|
|
481
|
+
}),
|
|
482
|
+
Rpc.make("thread.configure", {
|
|
483
|
+
payload: {
|
|
484
|
+
...ThreadRef,
|
|
485
|
+
runtime: RuntimeConfig
|
|
486
|
+
},
|
|
487
|
+
success: ThreadInfo,
|
|
488
|
+
error: ThreadErrors
|
|
489
|
+
}),
|
|
490
|
+
/**
|
|
491
|
+
* A new thread whose history continues from this one's line through `entryId`, which must be
|
|
492
|
+
* committed. `before` stops at the entry's predecessor and returns its text to edit again.
|
|
493
|
+
*/
|
|
494
|
+
Rpc.make("thread.fork", {
|
|
495
|
+
payload: {
|
|
496
|
+
...ThreadRef,
|
|
497
|
+
entryId: Schema.String,
|
|
498
|
+
mode: optional(Schema.Literals(["at", "before"]))
|
|
499
|
+
},
|
|
500
|
+
success: Schema.Struct({
|
|
501
|
+
thread: ThreadInfo,
|
|
502
|
+
text: optional(Schema.String)
|
|
503
|
+
}),
|
|
504
|
+
error: Schema.Union([ThreadErrors, ForkError])
|
|
505
|
+
}),
|
|
506
|
+
Rpc.make("thread.prompt", {
|
|
507
|
+
payload: {
|
|
508
|
+
...ThreadRef,
|
|
509
|
+
text: Schema.String,
|
|
510
|
+
delivery: optional(Delivery),
|
|
511
|
+
id: optional(MessageID)
|
|
512
|
+
},
|
|
513
|
+
success: Schema.Struct({ threadId: ThreadID }),
|
|
514
|
+
error: Schema.Union([ThreadErrors, PromptConflictError])
|
|
515
|
+
}),
|
|
516
|
+
/**
|
|
517
|
+
* Withdraws a queued prompt before it joins the conversation. `cancelled` is false when it had
|
|
518
|
+
* already been promoted (it then stays in the conversation) or no pending prompt has that id.
|
|
519
|
+
*/
|
|
520
|
+
Rpc.make("thread.cancel", {
|
|
521
|
+
payload: {
|
|
522
|
+
...ThreadRef,
|
|
523
|
+
messageId: MessageID
|
|
524
|
+
},
|
|
525
|
+
success: Schema.Struct({ cancelled: Schema.Boolean }),
|
|
526
|
+
error: ThreadErrors
|
|
527
|
+
}),
|
|
528
|
+
/**
|
|
529
|
+
* Moves a queued prompt to the other lane or rewrites it, keeping its place in the queue.
|
|
530
|
+
* `delivery: "steer"` also wakes the thread, so a prompt left waiting after a stop runs now.
|
|
531
|
+
* `updated` is false when it had already been promoted or cancelled, or no pending prompt has that id.
|
|
532
|
+
*/
|
|
533
|
+
Rpc.make("thread.update", {
|
|
534
|
+
payload: {
|
|
535
|
+
...ThreadRef,
|
|
536
|
+
messageId: MessageID,
|
|
537
|
+
delivery: optional(Delivery),
|
|
538
|
+
text: optional(Schema.String)
|
|
539
|
+
},
|
|
540
|
+
success: Schema.Struct({ updated: Schema.Boolean }),
|
|
541
|
+
error: ThreadErrors
|
|
542
|
+
}),
|
|
543
|
+
Rpc.make("thread.interrupt", {
|
|
544
|
+
payload: ThreadRef,
|
|
545
|
+
success: Schema.Struct({ interrupted: Schema.Boolean }),
|
|
546
|
+
error: ThreadErrors
|
|
547
|
+
}),
|
|
548
|
+
/**
|
|
549
|
+
* Whether a prompt materialized into the thread's conversation. An admitted prompt that is still
|
|
550
|
+
* queued has no entry yet, so this is the projection a client reconciles against when the
|
|
551
|
+
* volatile stream left it unsure.
|
|
552
|
+
*/
|
|
553
|
+
Rpc.make("thread.message", {
|
|
554
|
+
payload: {
|
|
555
|
+
...ThreadRef,
|
|
556
|
+
messageId: MessageID
|
|
557
|
+
},
|
|
558
|
+
success: Schema.Struct({ found: Schema.Boolean }),
|
|
559
|
+
error: ThreadErrors
|
|
560
|
+
}),
|
|
561
|
+
Rpc.make("thread.wait", {
|
|
562
|
+
payload: ThreadRef,
|
|
563
|
+
success: Schema.Void,
|
|
564
|
+
error: ThreadErrors
|
|
565
|
+
}),
|
|
566
|
+
/**
|
|
567
|
+
* Re-import every configured plugin, for the whole server.
|
|
568
|
+
*
|
|
569
|
+
* The one thing an exchange cannot notice on its own: a local plugin whose contents changed
|
|
570
|
+
* while its path did not. A failure keeps the previous set and is reported here rather than
|
|
571
|
+
* emptying a running server's tool registry.
|
|
572
|
+
*/
|
|
573
|
+
Rpc.make("plugin.reload", {
|
|
574
|
+
payload: {},
|
|
575
|
+
success: Schema.Struct({
|
|
576
|
+
plugins: Schema.Int,
|
|
577
|
+
failure: optional(Schema.String)
|
|
578
|
+
})
|
|
579
|
+
}),
|
|
580
|
+
/**
|
|
581
|
+
* Close the instance behind a thread's MCP server, or its attempt, and connect it afresh, for
|
|
582
|
+
* every thread sharing it. Answers once that attempt finished, with the server's state then.
|
|
583
|
+
*/
|
|
584
|
+
Rpc.make("mcp.connect", {
|
|
585
|
+
payload: McpServerRef,
|
|
586
|
+
success: McpStatus,
|
|
587
|
+
error: McpErrors
|
|
588
|
+
}),
|
|
589
|
+
/** Close it, for every thread sharing it, and keep it closed until `mcp.connect` or a config change. */
|
|
590
|
+
Rpc.make("mcp.disconnect", {
|
|
591
|
+
payload: McpServerRef,
|
|
592
|
+
success: McpStatus,
|
|
593
|
+
error: McpErrors
|
|
594
|
+
}),
|
|
595
|
+
/** This machine and the workspaces it is connected to. */
|
|
596
|
+
Rpc.make("machine.info", {
|
|
597
|
+
payload: {},
|
|
598
|
+
success: Status
|
|
599
|
+
}),
|
|
600
|
+
/** Names this machine for people; an empty name goes back to the OS's. */
|
|
601
|
+
Rpc.make("machine.rename", {
|
|
602
|
+
payload: { givenName: Schema.String },
|
|
603
|
+
success: Status
|
|
604
|
+
}),
|
|
605
|
+
/** Leaves a workspace: the relay revokes this machine's link, and the machine forgets it. */
|
|
606
|
+
Rpc.make("machine.disconnect", {
|
|
607
|
+
payload: Disconnect,
|
|
608
|
+
success: Disconnected,
|
|
609
|
+
error: ConnectError
|
|
610
|
+
}),
|
|
611
|
+
/**
|
|
612
|
+
* Connects this machine to a workspace: the code a member approves, then the link once they have.
|
|
613
|
+
* `workspaceId` is the workspace it is meant for; without one the approver picks it.
|
|
614
|
+
*/
|
|
615
|
+
Rpc.make("machine.connect", {
|
|
616
|
+
payload: { workspaceId: Schema.optional(Schema.String) },
|
|
617
|
+
success: ConnectEvent,
|
|
618
|
+
error: ConnectError,
|
|
619
|
+
stream: true
|
|
620
|
+
}),
|
|
621
|
+
/**
|
|
622
|
+
* A one-time code another computer exchanges at `POST /api/v1/devices` to pair its key, and the
|
|
623
|
+
* fingerprint of this machine's key, which that computer keeps. Valid 10 minutes, once; held in
|
|
624
|
+
* memory, so a restart forgets it. Local callers only.
|
|
625
|
+
*/
|
|
626
|
+
Rpc.make("device.pair", {
|
|
627
|
+
payload: {},
|
|
628
|
+
success: Schema.Struct({
|
|
629
|
+
code: Schema.String,
|
|
630
|
+
expiresAt: Schema.Finite,
|
|
631
|
+
fingerprint: Schema.String
|
|
632
|
+
}),
|
|
633
|
+
error: Forbidden
|
|
634
|
+
}),
|
|
635
|
+
/** Every paired device, oldest first. Local callers only. */
|
|
636
|
+
Rpc.make("device.list", {
|
|
637
|
+
payload: {},
|
|
638
|
+
success: Schema.Array(DeviceInfo),
|
|
639
|
+
error: Forbidden
|
|
640
|
+
}),
|
|
641
|
+
/** Forgets a device and ends its open connections; `applied` is false when none has `id`. Local callers only. */
|
|
642
|
+
Rpc.make("device.revoke", {
|
|
643
|
+
payload: { id: Schema.String },
|
|
644
|
+
success: Schema.Struct({ applied: Schema.Boolean }),
|
|
645
|
+
error: Forbidden
|
|
646
|
+
}),
|
|
647
|
+
/**
|
|
648
|
+
* Ends the calling device's own pairing, as `device.revoke` would. Its sockets end with it, this one
|
|
649
|
+
* too, so the reply may never arrive: the connection dropping after the call is sent means it left.
|
|
650
|
+
* Devices only; a local caller has no pairing to leave.
|
|
651
|
+
*/
|
|
652
|
+
Rpc.make("device.leave", {
|
|
653
|
+
payload: {},
|
|
654
|
+
error: Forbidden
|
|
655
|
+
}),
|
|
656
|
+
/** The OS home directory, and the folder `host.create` makes projects in. */
|
|
657
|
+
Rpc.make("host.info", {
|
|
658
|
+
payload: {},
|
|
659
|
+
success: Schema.Struct({
|
|
660
|
+
home: Schema.String,
|
|
661
|
+
projects: Schema.String
|
|
662
|
+
})
|
|
663
|
+
}),
|
|
664
|
+
/**
|
|
665
|
+
* The directories in `path` (a leading `~` is the OS home), hidden ones included, symlinks and
|
|
666
|
+
* files left out. One the server may not read lists as empty with `readable` false: it can still
|
|
667
|
+
* be added, as a folder macOS keeps from the server can.
|
|
668
|
+
*/
|
|
669
|
+
Rpc.make("host.browse", {
|
|
670
|
+
payload: { path: Schema.String },
|
|
671
|
+
success: Schema.Struct({
|
|
672
|
+
path: Schema.String,
|
|
673
|
+
entries: Schema.Array(Folder),
|
|
674
|
+
readable: optional(Schema.Boolean)
|
|
675
|
+
}),
|
|
676
|
+
error: HostError
|
|
677
|
+
}),
|
|
678
|
+
/**
|
|
679
|
+
* A new folder under `host.info`'s `projects`, named after `name`, with a git repository and a
|
|
680
|
+
* README. A first commit git refused is not fatal: `commitError` says why it was skipped.
|
|
681
|
+
*/
|
|
682
|
+
Rpc.make("host.create", {
|
|
683
|
+
payload: { name: Schema.String },
|
|
684
|
+
success: Schema.Struct({
|
|
685
|
+
path: Schema.String,
|
|
686
|
+
commitError: optional(Schema.String)
|
|
687
|
+
}),
|
|
688
|
+
error: HostError
|
|
689
|
+
}),
|
|
690
|
+
/** An existing folder as an absolute path; a missing one is created. */
|
|
691
|
+
Rpc.make("host.add", {
|
|
692
|
+
payload: { path: Schema.String },
|
|
693
|
+
success: Schema.Struct({ path: Schema.String }),
|
|
694
|
+
error: HostError
|
|
695
|
+
}),
|
|
696
|
+
/**
|
|
697
|
+
* Starts a background clone of `remote` into `path`, which must be missing or empty, and answers
|
|
698
|
+
* at once with the destination and the redacted remote; `host.clones` follows it. Git never prompts.
|
|
699
|
+
*/
|
|
700
|
+
Rpc.make("host.clone", {
|
|
701
|
+
payload: {
|
|
702
|
+
remote: Schema.String,
|
|
703
|
+
path: Schema.String
|
|
704
|
+
},
|
|
705
|
+
success: Schema.Struct({
|
|
706
|
+
path: Schema.String,
|
|
707
|
+
remote: Schema.String
|
|
708
|
+
}),
|
|
709
|
+
error: HostError
|
|
710
|
+
}),
|
|
711
|
+
/** Every tracked clone now, then the whole list again on each change. A finished one leaves 30 seconds after. */
|
|
712
|
+
Rpc.make("host.clones", {
|
|
713
|
+
payload: {},
|
|
714
|
+
success: Schema.Array(Clone),
|
|
715
|
+
stream: true
|
|
716
|
+
}),
|
|
717
|
+
/** Stops a running clone and empties its folder; `applied` is false when it was not running. */
|
|
718
|
+
Rpc.make("host.cancel", {
|
|
719
|
+
payload: { path: Schema.String },
|
|
720
|
+
success: Schema.Struct({ applied: Schema.Boolean })
|
|
721
|
+
}),
|
|
722
|
+
/** Clones a failed or cancelled one again into its emptied folder; `applied` is false otherwise. */
|
|
723
|
+
Rpc.make("host.retry", {
|
|
724
|
+
payload: { path: Schema.String },
|
|
725
|
+
success: Schema.Struct({ applied: Schema.Boolean }),
|
|
726
|
+
error: HostError
|
|
727
|
+
}),
|
|
728
|
+
/** Stops tracking a clone, stopping it and emptying its folder unless it finished. */
|
|
729
|
+
Rpc.make("host.discard", {
|
|
730
|
+
payload: { path: Schema.String },
|
|
731
|
+
success: Schema.Void
|
|
732
|
+
}),
|
|
733
|
+
/** Whether `gh` is installed and signed in; `hint` says what to do when it is not. */
|
|
734
|
+
Rpc.make("github.status", {
|
|
735
|
+
payload: {},
|
|
736
|
+
success: Schema.Struct({
|
|
737
|
+
ready: Schema.Boolean,
|
|
738
|
+
hint: optional(Schema.String)
|
|
739
|
+
})
|
|
740
|
+
}),
|
|
741
|
+
/** A repository by `owner/name`, `host/owner/name`, its URL, or a bare name of the signed-in user's. */
|
|
742
|
+
Rpc.make("github.lookup", {
|
|
743
|
+
payload: { repository: Schema.String },
|
|
744
|
+
success: Repository,
|
|
745
|
+
error: HostError
|
|
746
|
+
}),
|
|
747
|
+
Rpc.make("sandbox.drivers", {
|
|
748
|
+
payload: {},
|
|
749
|
+
success: Schema.Array(Schema.Struct({
|
|
750
|
+
name: Schema.String,
|
|
751
|
+
kind: Schema.String
|
|
752
|
+
}))
|
|
753
|
+
}),
|
|
754
|
+
Rpc.make("sandbox.list", {
|
|
755
|
+
payload: {},
|
|
756
|
+
success: Schema.Array(SandboxInfo)
|
|
757
|
+
}),
|
|
758
|
+
Rpc.make("sandbox.create", {
|
|
759
|
+
payload: { driver: Schema.String },
|
|
760
|
+
success: SandboxInfo,
|
|
761
|
+
error: SandboxErrors
|
|
762
|
+
}),
|
|
763
|
+
Rpc.make("sandbox.register", {
|
|
764
|
+
payload: {
|
|
765
|
+
driver: Schema.String,
|
|
766
|
+
providerResourceId: Schema.String
|
|
767
|
+
},
|
|
768
|
+
success: SandboxInfo,
|
|
769
|
+
error: SandboxErrors
|
|
770
|
+
}),
|
|
771
|
+
Rpc.make("sandbox.stop", {
|
|
772
|
+
payload: { sandboxId: ID },
|
|
773
|
+
success: Schema.Void,
|
|
774
|
+
error: SandboxErrors
|
|
775
|
+
}),
|
|
776
|
+
/**
|
|
777
|
+
* Calls a method of a space daemon running in `spaceId`, such as `git.diff`. Never starts a daemon
|
|
778
|
+
* and never wakes a sandbox: `unavailable` when none runs there, `detached` when the space is not
|
|
779
|
+
* mounted.
|
|
780
|
+
*/
|
|
781
|
+
Rpc.make("daemon.call", {
|
|
782
|
+
payload: {
|
|
783
|
+
plugin: Schema.String,
|
|
784
|
+
spaceId: Schema.String,
|
|
785
|
+
method: Schema.String,
|
|
786
|
+
input: optional(Schema.Unknown)
|
|
787
|
+
},
|
|
788
|
+
success: Schema.Unknown,
|
|
789
|
+
error: DaemonCallError
|
|
790
|
+
}),
|
|
791
|
+
/**
|
|
792
|
+
* Every event the server publishes, live, after a `server.connected` frame. With `threadId`,
|
|
793
|
+
* only the events naming that thread; the frame still comes first.
|
|
794
|
+
*/
|
|
795
|
+
Rpc.make("event.subscribe", {
|
|
796
|
+
payload: {
|
|
797
|
+
threadId: optional(ThreadID),
|
|
798
|
+
/**
|
|
799
|
+
* Only these event types. The last event of each type that a space daemon published is sent
|
|
800
|
+
* first, after `server.connected`: a client that was away catches up without a change.
|
|
801
|
+
*/
|
|
802
|
+
types: optional(Schema.Array(Schema.String))
|
|
803
|
+
},
|
|
804
|
+
success: EventEnvelope,
|
|
805
|
+
error: Schema.Union([SubscriptionOverflowError, EncodingError]),
|
|
806
|
+
stream: true
|
|
807
|
+
})
|
|
808
|
+
).middleware(Door);
|
|
809
|
+
//#endregion
|
|
810
|
+
export { Api, Clone, ClonePhase, CloneStage, DaemonCallError, Delivery, DeviceInfo, EncodingError, EventEnvelope, Folder, Forbidden, ForkError, HistoryEntry, host_exports as Host, HostError, records_exports as HostRecords, IndexItem, LiveDelta, LogSynced, ModelCatalogError, ModelList, ModelProvider, OAuthCredentials, OAuthError, OAuthInfo, OAuthProvider, Part, ProjectCheckoutError, ProjectInfo, ProjectNotFoundError, PromptConflictError, QueuedPrompt, RelinkError, Repository, RunError, RunOutcome, RunState, RuntimeConfig, SandboxInfo, SessionInfo, SessionLinkedSpaceNotFoundError, SessionNotFoundError, SettingsConflictError, SettingsError, SpaceInfo, SubscriptionOverflowError, ThinkingLevel, ThreadInfo, ThreadItem, ThreadNotFoundError, ThreadOrigin, ThreadRun, ThreadSummary, ThreadUsage, ToolCall, UnknownServerError, UsageItem, edges, path };
|
|
811
|
+
|
|
812
|
+
//# sourceMappingURL=host.mjs.map
|