@otto-code/protocol 0.8.10 → 0.8.13

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.
Files changed (83) hide show
  1. package/dist/agent-labels.d.ts +3 -0
  2. package/dist/agent-labels.js +10 -0
  3. package/dist/agent-personalities.d.ts +4 -3
  4. package/dist/agent-personalities.js +13 -20
  5. package/dist/agent-queue.d.ts +87 -0
  6. package/dist/agent-queue.js +106 -0
  7. package/dist/agent-types.d.ts +24 -4
  8. package/dist/binary-frames/terminal.d.ts +4 -0
  9. package/dist/binary-frames/terminal.js +1 -0
  10. package/dist/brain.d.ts +2412 -0
  11. package/dist/brain.js +1100 -0
  12. package/dist/chat/rpc-schemas.js +1 -0
  13. package/dist/chat/types.js +1 -0
  14. package/dist/client-capabilities.d.ts +3 -0
  15. package/dist/client-capabilities.js +14 -0
  16. package/dist/code-intelligence.d.ts +917 -0
  17. package/dist/code-intelligence.js +699 -0
  18. package/dist/communications.d.ts +1106 -0
  19. package/dist/communications.js +384 -0
  20. package/dist/context.d.ts +787 -0
  21. package/dist/context.js +295 -0
  22. package/dist/daemon-config.d.ts +383 -0
  23. package/dist/daemon-config.js +401 -0
  24. package/dist/file-operations.d.ts +380 -0
  25. package/dist/file-operations.js +282 -0
  26. package/dist/generated/validation/ws-outbound.aot.js +67260 -57392
  27. package/dist/git-hosting.d.ts +117 -0
  28. package/dist/git-hosting.js +109 -0
  29. package/dist/git-operations.d.ts +255 -0
  30. package/dist/git-operations.js +221 -0
  31. package/dist/integration-authorization.d.ts +195 -0
  32. package/dist/integration-authorization.js +125 -0
  33. package/dist/kanban.d.ts +341 -0
  34. package/dist/kanban.js +273 -0
  35. package/dist/loop/rpc-schemas.d.ts +6 -6
  36. package/dist/loop/rpc-schemas.js +1 -0
  37. package/dist/meetings.d.ts +95 -0
  38. package/dist/meetings.js +57 -0
  39. package/dist/messages.d.ts +11175 -11039
  40. package/dist/messages.js +4756 -8700
  41. package/dist/orchestration.d.ts +726 -0
  42. package/dist/orchestration.js +232 -0
  43. package/dist/personality-schemas.d.ts +221 -0
  44. package/dist/personality-schemas.js +340 -0
  45. package/dist/preview.d.ts +140 -0
  46. package/dist/preview.js +98 -0
  47. package/dist/project-knowledge.d.ts +740 -0
  48. package/dist/project-knowledge.js +229 -0
  49. package/dist/project-links.d.ts +102 -0
  50. package/dist/project-links.js +62 -0
  51. package/dist/provider-config.d.ts +87 -2
  52. package/dist/provider-config.js +110 -0
  53. package/dist/provider-manifest.js +7 -0
  54. package/dist/provider-snapshot-codec.d.ts +18 -0
  55. package/dist/provider-snapshot-codec.js +71 -0
  56. package/dist/refine.d.ts +93 -0
  57. package/dist/refine.js +78 -0
  58. package/dist/schedule/rpc-schemas.d.ts +55 -111
  59. package/dist/schedule/types.d.ts +16 -37
  60. package/dist/schedule/types.js +1 -11
  61. package/dist/search/text-match.d.ts +55 -0
  62. package/dist/search/text-match.js +262 -0
  63. package/dist/speech.d.ts +180 -0
  64. package/dist/speech.js +177 -0
  65. package/dist/storage.d.ts +79 -0
  66. package/dist/storage.js +107 -0
  67. package/dist/suggested-tasks.d.ts +106 -0
  68. package/dist/suggested-tasks.js +81 -0
  69. package/dist/terminal-compatibility.d.ts +55 -0
  70. package/dist/terminal-compatibility.js +35 -0
  71. package/dist/terminal-input-mode.d.ts +4 -0
  72. package/dist/terminal-input-mode.js +35 -6
  73. package/dist/terminal-key-input.js +15 -6
  74. package/dist/terminal-profiles.d.ts +35 -0
  75. package/dist/terminal-profiles.js +246 -4
  76. package/dist/tool-call-display.d.ts +2 -2
  77. package/dist/tool-call-display.js +6 -6
  78. package/dist/usage-stats.d.ts +255 -0
  79. package/dist/usage-stats.js +162 -0
  80. package/dist/validation/ws-outbound-schema-metadata.d.ts +1906 -266
  81. package/dist/worktree-ops.d.ts +81 -0
  82. package/dist/worktree-ops.js +88 -0
  83. package/package.json +1 -1
@@ -0,0 +1,340 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Otto agent-personality wire schemas. Kept out of agent-personalities.ts because that module imports from messages.ts, and out of messages.ts because personalities are a fork-only capability.
4
+ */
5
+ // Canonical personality roles, in display order. Kept as an exported const so
6
+ // the daemon and app share one vocabulary, but the wire schema stores roles as
7
+ // plain strings (below) - adding a role later must never break an older peer's
8
+ // parsing. Consumers filter incoming role arrays to this known set. The retired
9
+ // "worker" role is mapped to "coder" on the way in (see LEGACY_ROLE_ALIASES in
10
+ // agent-personalities.ts) so personalities persisted before the split keep their
11
+ // role rather than silently losing it.
12
+ export const PERSONALITY_ROLES = [
13
+ // Surfaces - the interactive / host-facing entry points.
14
+ "chatter",
15
+ "artificer",
16
+ "scheduler",
17
+ // Thinking workers - read-only, return structured findings, never edit.
18
+ "researcher",
19
+ "planner",
20
+ "judger",
21
+ "advisor",
22
+ // Making workers - produce code, design, or short text.
23
+ "coder",
24
+ "designer",
25
+ "writer",
26
+ // Conductor - the sole role whose whole job is planning and driving a team.
27
+ "orchestrator",
28
+ ];
29
+ // Plain strings on the wire, like personality roles and effort levels, so the
30
+ // daemon can grow the vocabulary without breaking old peers. Logical values:
31
+ // scope "project" | "global"; source "agent" | "user" | "review" | "transfer".
32
+ export const PersonalityMemoryEntrySchema = z
33
+ .object({
34
+ id: z.string(),
35
+ text: z.string(),
36
+ scope: z.string(),
37
+ // Absolute, daemon-side. Present only on project-scoped entries.
38
+ projectRoot: z.string().optional(),
39
+ createdAt: z.string(),
40
+ updatedAt: z.string(),
41
+ source: z.string(),
42
+ // How many times the lesson has been restated. Drives injection order and
43
+ // is shown in the brief, because a repeatedly-relearned gotcha is stronger
44
+ // evidence than a one-off observation.
45
+ reinforcedCount: z.number().optional(),
46
+ transferredFrom: z.string().optional(),
47
+ })
48
+ .passthrough();
49
+ export const PersonalityMemoryListRequestMessageSchema = z.object({
50
+ type: z.literal("personality.memory.list.request"),
51
+ requestId: z.string(),
52
+ personalityId: z.string(),
53
+ // Which project's lessons count as in-scope for the returned brief. Prefer
54
+ // `workspaceId` and let the daemon resolve the root: a client computing repo
55
+ // roots would disagree with the daemon the moment a worktree is involved.
56
+ workspaceId: z.string().optional(),
57
+ // Explicit root, for callers with no workspace. Ignored when `workspaceId`
58
+ // resolves. Omitted (with no workspace) means global lessons only.
59
+ projectRoot: z.string().optional(),
60
+ });
61
+ export const PersonalityMemoryListResponseMessageSchema = z.object({
62
+ type: z.literal("personality.memory.list.response"),
63
+ payload: z.object({
64
+ requestId: z.string(),
65
+ personalityId: z.string(),
66
+ personalityName: z.string(),
67
+ /** Whether this personality is accruing (the `memoryEnabled` switch). */
68
+ enabled: z.boolean(),
69
+ /** Every stored entry, including other projects' - the UI shows them all. */
70
+ entries: z.array(PersonalityMemoryEntrySchema),
71
+ // The EXACT text the daemon would inject for `projectRoot`, not a
72
+ // reconstruction. Memory is only trustworthy if it is inspectable, and the
73
+ // only way the shown text cannot drift from the injected text is for both
74
+ // to come from one composer.
75
+ brief: z.string(),
76
+ briefTokens: z.number(),
77
+ /** Entries the injection budget cut, so the UI can say so. */
78
+ briefOmittedCount: z.number().optional(),
79
+ // The root the brief was composed for, so the UI can tell a project-scoped
80
+ // entry that applies here from one belonging to another project. Without it
81
+ // every project entry looks the same and an empty brief next to a list of
82
+ // lessons reads as a bug. Absent when the request named no workspace.
83
+ projectRoot: z.string().optional(),
84
+ }),
85
+ });
86
+ // One write RPC covers add / edit / delete: no `entryId` = add a new lesson,
87
+ // `drop: true` = forget one. The user-facing editing path from Context
88
+ // Management (charter §2.4).
89
+ export const PersonalityMemoryUpdateRequestMessageSchema = z.object({
90
+ type: z.literal("personality.memory.update.request"),
91
+ requestId: z.string(),
92
+ personalityId: z.string(),
93
+ entryId: z.string().optional(),
94
+ text: z.string().optional(),
95
+ scope: z.string().optional(),
96
+ // Which project a `scope: "project"` write binds to. Same rule as the list
97
+ // request: prefer `workspaceId` and let the daemon resolve the root, because a
98
+ // project-scoped entry whose root does not match the daemon's resolution is
99
+ // filtered out of every brief and is therefore stored but never sent.
100
+ workspaceId: z.string().optional(),
101
+ // Explicit root, for callers with no workspace. Ignored when `workspaceId`
102
+ // resolves.
103
+ projectRoot: z.string().optional(),
104
+ drop: z.boolean().optional(),
105
+ });
106
+ export const PersonalityMemoryUpdateResponseMessageSchema = z.object({
107
+ type: z.literal("personality.memory.update.response"),
108
+ payload: z.object({
109
+ requestId: z.string(),
110
+ ok: z.boolean(),
111
+ error: z.string().optional(),
112
+ }),
113
+ });
114
+ // Deleting a personality must never silently destroy what it learned, so the
115
+ // delete flow resolves here first: `mode: "transfer"` moves the lessons to
116
+ // `toPersonalityId` (merging near-duplicates), `mode: "delete"` discards them.
117
+ export const PersonalityMemoryTransferRequestMessageSchema = z.object({
118
+ type: z.literal("personality.memory.transfer.request"),
119
+ requestId: z.string(),
120
+ fromPersonalityId: z.string(),
121
+ toPersonalityId: z.string().optional(),
122
+ mode: z.string(),
123
+ });
124
+ export const PersonalityMemoryTransferResponseMessageSchema = z.object({
125
+ type: z.literal("personality.memory.transfer.response"),
126
+ payload: z.object({
127
+ requestId: z.string(),
128
+ ok: z.boolean(),
129
+ /** Entries that landed as new rows in the destination. */
130
+ transferred: z.number().optional(),
131
+ /** Entries that merged into a lesson the destination already knew. */
132
+ merged: z.number().optional(),
133
+ error: z.string().optional(),
134
+ }),
135
+ });
136
+ // Per-personality lesson counts. Its own RPC over its own file, mirroring
137
+ // agentPersonalities.get_stats - counts must not ride the daemon-config
138
+ // broadcast, or every recorded lesson would fan a config change to every client.
139
+ export const PersonalityMemoryStatsRequestMessageSchema = z.object({
140
+ type: z.literal("personality.memory.stats.request"),
141
+ requestId: z.string(),
142
+ });
143
+ export const PersonalityMemoryStatsResponseMessageSchema = z.object({
144
+ type: z.literal("personality.memory.stats.response"),
145
+ payload: z.object({
146
+ requestId: z.string(),
147
+ counts: z.record(z.string(), z.number()),
148
+ }),
149
+ });
150
+ // A team's avatar. v1 ships only `color` (hex, validated at the editor like
151
+ // spinner colors); `imageId` is reserved for the future themed avatar set -
152
+ // when present it wins over color, and color stays the fallback so an old
153
+ // client that doesn't know `imageId` keeps rendering the swatch. Plain
154
+ // strings for forward compat.
155
+ export const AgentTeamAvatarSchema = z
156
+ .object({
157
+ color: z.string().min(1).optional(),
158
+ imageId: z.string().min(1).optional(),
159
+ })
160
+ .passthrough();
161
+ // A named, per-host grouping of agent personalities that acts as an operating
162
+ // template: which personalities are on deck, plus a shared team prompt stacked
163
+ // directly ahead of the member's personality prompt at spawn. `id` is the
164
+ // stable identity everything binds to; `name` is a freely-renamable label.
165
+ // `memberIds` bind personality ids (order = display order) - an entry pointing
166
+ // at a deleted personality is tolerated and ignored everywhere, then pruned on
167
+ // the next save of that team. Membership is many-to-many.
168
+ export const AgentTeamSchema = z
169
+ .object({
170
+ id: z.string().min(1),
171
+ name: z.string().min(1),
172
+ avatar: AgentTeamAvatarSchema.optional(),
173
+ teamPrompt: z.string().optional(),
174
+ memberIds: z.array(z.string().min(1)).optional(),
175
+ })
176
+ .passthrough();
177
+ export const AgentPersonalitiesGetStatsRequestSchema = z.object({
178
+ type: z.literal("agentPersonalities.get_stats.request"),
179
+ requestId: z.string(),
180
+ });
181
+ // COMPAT(personalityProfile): added in v0.7.5; gate lives in
182
+ // features.personalityProfile. Author a personality PROFILE (the prose
183
+ // `personalityPrompt` that shapes how an agent behaves) from the only things
184
+ // the editor knows before one exists: the handle, the roles it will be spawned
185
+ // for, and its two spinner colors. Like the voice-cue RPC this is described
186
+ // inline (not a stored id) so the editor can generate for an unsaved draft, and
187
+ // is an editor-time action: the result lands in the prompt field for the user to
188
+ // edit, and is stored on the personality by the ordinary save.
189
+ export const AgentPersonalitiesGenerateProfileRequestSchema = z.object({
190
+ type: z.literal("agentPersonalities.generate_profile.request"),
191
+ requestId: z.string(),
192
+ name: z.string(),
193
+ // Permissive strings to match the stored personality shape (forward-compatible
194
+ // with roles this daemon predates); the daemon filters to its known set.
195
+ roles: z.array(z.string().min(1)).optional(),
196
+ // The spinner glow pair, read as a palette (temperature, energy) and never
197
+ // quoted literally in the profile.
198
+ glowA: z.string().optional(),
199
+ glowB: z.string().optional(),
200
+ // Scopes provider resolution to a workspace; omitted falls back to any
201
+ // resolvable one.
202
+ cwd: z.string().optional(),
203
+ });
204
+ export const AgentPersonalitiesGetStatsResponseSchema = z.object({
205
+ type: z.literal("agentPersonalities.get_stats.response"),
206
+ payload: z
207
+ .object({
208
+ requestId: z.string(),
209
+ // Per-personality spawn counts, keyed by personality id.
210
+ stats: z.record(z.string(), z.number()),
211
+ })
212
+ .passthrough(),
213
+ });
214
+ export const AgentPersonalitiesGenerateProfileResponseSchema = z.object({
215
+ type: z.literal("agentPersonalities.generate_profile.response"),
216
+ payload: z
217
+ .object({
218
+ requestId: z.string(),
219
+ // The authored personality prompt, ready to drop into the editor's prompt
220
+ // field. Absent when generation failed (see error) or no writer/provider
221
+ // resolves on this host.
222
+ profile: z.string().optional(),
223
+ error: z.string().optional(),
224
+ })
225
+ .passthrough(),
226
+ });
227
+ // The Visualizer lifecycle moments a personality voice-cue line can belong to.
228
+ // Protocol owns this vocabulary - the daemon's cue generator, the personality
229
+ // editor, and the Visualizer playback hook all import it from here.
230
+ // "waiting" is the parent's turn ending while its observed sub-agents are still
231
+ // running; it DEFERS "done" rather than replacing it (see docs/visualizer.md).
232
+ export const CUE_MOMENTS = ["join", "thinking", "waiting", "done"];
233
+ // Two glow colors for the personality's thinking spinner (BlobLoader glowA/glowB).
234
+ export const AgentPersonalitySpinnerSchema = z
235
+ .object({
236
+ glowA: z.string().min(1),
237
+ glowB: z.string().min(1),
238
+ })
239
+ .passthrough();
240
+ // A TTS voice for the personality's spoken identity. Stored self-describing -
241
+ // provider + model + voice name - because voice names are namespaced per TTS
242
+ // engine/model (the same speaker index maps to different names across models),
243
+ // so a bare name is ambiguous across hosts. All plain strings (like the speech
244
+ // config) for forward-compat. This is a soft binding: an unavailable voice
245
+ // degrades to the host default at playback time, it never takes the personality
246
+ // out of commission.
247
+ export const AgentPersonalityVoiceSchema = z
248
+ .object({
249
+ provider: z.string().min(1),
250
+ model: z.string().min(1),
251
+ name: z.string().min(1),
252
+ })
253
+ .passthrough();
254
+ // Pre-generated (and user-editable) spoken "voice cue" lines for the personality
255
+ // - a few short variations for each Visualizer moment (its node joins the graph,
256
+ // first starts thinking, finishes its turn but waits on sub-agents, completes).
257
+ // Stored on the personality so they're deterministic and hand-tunable in the
258
+ // editor; the Visualizer reads them directly (no runtime generation). All groups
259
+ // optional/loose - a personality may have none, or only some (personalities
260
+ // authored before "waiting" existed simply stay silent for that moment).
261
+ // See docs/visualizer.md "Voice cues".
262
+ export const AgentPersonalityVoiceCuesSchema = z
263
+ .object({
264
+ join: z.array(z.string()).optional(),
265
+ thinking: z.array(z.string()).optional(),
266
+ waiting: z.array(z.string()).optional(),
267
+ done: z.array(z.string()).optional(),
268
+ })
269
+ .passthrough();
270
+ // A named, reusable agent template stored per-host. `id` is the stable identity
271
+ // everything binds to; `name` is a freely-renamable label. Effort and roles are
272
+ // plain strings on the wire (like speech engine/model ids) so the daemon can
273
+ // grow the vocabulary without breaking old peers; the daemon validates them
274
+ // against its own catalog when applying a patch.
275
+ export const AgentPersonalitySchema = z
276
+ .object({
277
+ id: z.string().min(1),
278
+ name: z.string().min(1),
279
+ provider: z.string().min(1),
280
+ model: z.string().min(1),
281
+ // Canonical effort level ("off".."max"); resolved to the bound model's
282
+ // nearest advertised option at spawn.
283
+ effortLevel: z.string().min(1).optional(),
284
+ modeId: z.string().min(1).optional(),
285
+ personalityPrompt: z.string().optional(),
286
+ // Default true: the daemon-global appendSystemPrompt still stacks on top of
287
+ // the personality prompt. False = the personality prompt stands alone.
288
+ respectGlobalAppendPrompt: z.boolean().optional(),
289
+ roles: z.array(z.string().min(1)).optional(),
290
+ spinner: AgentPersonalitySpinnerSchema.optional(),
291
+ voice: AgentPersonalityVoiceSchema.optional(),
292
+ voiceCues: AgentPersonalityVoiceCuesSchema.optional(),
293
+ // Whether this personality accrues lessons across sessions (personality
294
+ // memory). ABSENT MEANS ON: a personality with no lessons injects nothing
295
+ // and costs nothing, so an off-by-default switch would only mean the feature
296
+ // never starts working for anyone who did not go looking for it. The switch
297
+ // exists to stop a personality accruing, not to start it.
298
+ // See docs/agent-personalities.md § Memory.
299
+ memoryEnabled: z.boolean().optional(),
300
+ })
301
+ .passthrough();
302
+ // COMPAT(visualizerVoiceCues): added in v0.6.3; gate lives in
303
+ // features.visualizerVoiceCues. Author short spoken "cue" lines for a
304
+ // personality - a handful of variations each for three Visualizer moments
305
+ // (join / thinking / done) - via the Writer mini-task chain, flavored by the
306
+ // persona's `name` + `prompt`. The persona is passed inline (not a stored id)
307
+ // so the personality editor can generate for an unsaved draft too; the result
308
+ // is stored on the personality (`voiceCues`) and edited there, so this is an
309
+ // editor-time action, not a runtime one. `cwd` scopes provider resolution to a
310
+ // workspace; omitted falls back to any resolvable one.
311
+ export const VisualizerVoiceCuesGenerateRequestSchema = z.object({
312
+ type: z.literal("visualizer.voiceCues.generate.request"),
313
+ requestId: z.string(),
314
+ name: z.string(),
315
+ prompt: z.string().optional(),
316
+ cwd: z.string().optional(),
317
+ // The persona's roles (e.g. "researcher", "coder") so the writer can flavor
318
+ // the lines to what the agent does. Permissive strings to match the stored
319
+ // personality shape (forward-compatible with roles this daemon predates).
320
+ roles: z.array(z.string().min(1)).optional(),
321
+ // When present, author only this one moment's lines (a focused single-moment
322
+ // prompt) and return only that group. The editor issues one request per
323
+ // moment so it can show generation progress and keep the moments distinct.
324
+ // Omitted → author all three at once (the original all-in-one path, still
325
+ // used by older clients).
326
+ moment: z.enum(CUE_MOMENTS).optional(),
327
+ });
328
+ export const VisualizerVoiceCuesGenerateResponseSchema = z.object({
329
+ type: z.literal("visualizer.voiceCues.generate.response"),
330
+ payload: z
331
+ .object({
332
+ requestId: z.string(),
333
+ // Absent when generation failed (see error) or no writer/provider
334
+ // resolves on this host. Reuses the stored-cues shape.
335
+ cues: AgentPersonalityVoiceCuesSchema.optional(),
336
+ error: z.string().optional(),
337
+ })
338
+ .passthrough(),
339
+ });
340
+ //# sourceMappingURL=personality-schemas.js.map
@@ -0,0 +1,140 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Otto preview wire schemas (dev-server supervision). Fork-only capability, so it owns its schemas rather than declaring them in messages.ts, matching kanban.ts and artifacts/rpc-schemas.ts.
4
+ */
5
+ /**
6
+ * UI-initiated preview RPCs (the Preview toolbar button), distinct from the
7
+ * agent-facing preview_* tools in packages/server/src/server/preview/preview-tools.ts.
8
+ * Both sides drive the same DevServerManager; only the caller differs.
9
+ */
10
+ export declare const PreviewListConfigRequestSchema: z.ZodObject<{
11
+ type: z.ZodLiteral<"preview.list_config.request">;
12
+ cwd: z.ZodString;
13
+ requestId: z.ZodString;
14
+ }, z.core.$strip>;
15
+ export declare const PreviewStartRequestSchema: z.ZodObject<{
16
+ type: z.ZodLiteral<"preview.start.request">;
17
+ cwd: z.ZodString;
18
+ name: z.ZodString;
19
+ requestId: z.ZodString;
20
+ }, z.core.$strip>;
21
+ export declare const PreviewBindTabRequestSchema: z.ZodObject<{
22
+ type: z.ZodLiteral<"preview.bind_tab.request">;
23
+ serverId: z.ZodString;
24
+ browserId: z.ZodString;
25
+ requestId: z.ZodString;
26
+ }, z.core.$strip>;
27
+ export declare const PreviewStopRequestSchema: z.ZodObject<{
28
+ type: z.ZodLiteral<"preview.stop.request">;
29
+ serverId: z.ZodString;
30
+ requestId: z.ZodString;
31
+ }, z.core.$strip>;
32
+ export declare const PreviewConfiguredServerSchema: z.ZodObject<{
33
+ name: z.ZodString;
34
+ port: z.ZodNumber;
35
+ }, z.core.$strip>;
36
+ export declare const PreviewServerStatusSchema: z.ZodEnum<{
37
+ running: "running";
38
+ starting: "starting";
39
+ exited: "exited";
40
+ }>;
41
+ export declare const PreviewRunningServerSchema: z.ZodObject<{
42
+ serverId: z.ZodString;
43
+ name: z.ZodString;
44
+ url: z.ZodString;
45
+ port: z.ZodNumber;
46
+ status: z.ZodEnum<{
47
+ running: "running";
48
+ starting: "starting";
49
+ exited: "exited";
50
+ }>;
51
+ }, z.core.$strip>;
52
+ export declare const PreviewListConfigResponseSchema: z.ZodObject<{
53
+ type: z.ZodLiteral<"preview.list_config.response">;
54
+ payload: z.ZodObject<{
55
+ cwd: z.ZodString;
56
+ configured: z.ZodBoolean;
57
+ servers: z.ZodArray<z.ZodObject<{
58
+ name: z.ZodString;
59
+ port: z.ZodNumber;
60
+ }, z.core.$strip>>;
61
+ runningServers: z.ZodOptional<z.ZodArray<z.ZodObject<{
62
+ serverId: z.ZodString;
63
+ name: z.ZodString;
64
+ url: z.ZodString;
65
+ port: z.ZodNumber;
66
+ status: z.ZodEnum<{
67
+ running: "running";
68
+ starting: "starting";
69
+ exited: "exited";
70
+ }>;
71
+ }, z.core.$strip>>>;
72
+ error: z.ZodNullable<z.ZodString>;
73
+ requestId: z.ZodString;
74
+ }, z.core.$strip>;
75
+ }, z.core.$strip>;
76
+ export declare const EXTERNAL_PREVIEW_SERVER_ID_PREFIX = "ext:";
77
+ export declare function isExternalPreviewServerId(serverId: string): boolean;
78
+ export declare const PreviewServerSummaryPayloadSchema: z.ZodObject<{
79
+ serverId: z.ZodString;
80
+ name: z.ZodString;
81
+ url: z.ZodString;
82
+ port: z.ZodNumber;
83
+ status: z.ZodEnum<{
84
+ running: "running";
85
+ starting: "starting";
86
+ exited: "exited";
87
+ }>;
88
+ boundBrowserId: z.ZodNullable<z.ZodString>;
89
+ }, z.core.$strip>;
90
+ export declare const PreviewStartResponseSchema: z.ZodObject<{
91
+ type: z.ZodLiteral<"preview.start.response">;
92
+ payload: z.ZodObject<{
93
+ cwd: z.ZodString;
94
+ success: z.ZodBoolean;
95
+ server: z.ZodNullable<z.ZodObject<{
96
+ serverId: z.ZodString;
97
+ name: z.ZodString;
98
+ url: z.ZodString;
99
+ port: z.ZodNumber;
100
+ status: z.ZodEnum<{
101
+ running: "running";
102
+ starting: "starting";
103
+ exited: "exited";
104
+ }>;
105
+ boundBrowserId: z.ZodNullable<z.ZodString>;
106
+ }, z.core.$strip>>;
107
+ reused: z.ZodBoolean;
108
+ error: z.ZodNullable<z.ZodString>;
109
+ requestId: z.ZodString;
110
+ }, z.core.$strip>;
111
+ }, z.core.$strip>;
112
+ export declare const PreviewBindTabResponseSchema: z.ZodObject<{
113
+ type: z.ZodLiteral<"preview.bind_tab.response">;
114
+ payload: z.ZodObject<{
115
+ success: z.ZodBoolean;
116
+ error: z.ZodNullable<z.ZodString>;
117
+ requestId: z.ZodString;
118
+ }, z.core.$strip>;
119
+ }, z.core.$strip>;
120
+ export declare const PreviewStopResponseSchema: z.ZodObject<{
121
+ type: z.ZodLiteral<"preview.stop.response">;
122
+ payload: z.ZodObject<{
123
+ success: z.ZodBoolean;
124
+ error: z.ZodNullable<z.ZodString>;
125
+ requestId: z.ZodString;
126
+ }, z.core.$strip>;
127
+ }, z.core.$strip>;
128
+ export type PreviewListConfigRequest = z.infer<typeof PreviewListConfigRequestSchema>;
129
+ export type PreviewConfiguredServer = z.infer<typeof PreviewConfiguredServerSchema>;
130
+ export type PreviewRunningServer = z.infer<typeof PreviewRunningServerSchema>;
131
+ export type PreviewServerStatus = z.infer<typeof PreviewServerStatusSchema>;
132
+ export type PreviewListConfigResponse = z.infer<typeof PreviewListConfigResponseSchema>;
133
+ export type PreviewStartRequest = z.infer<typeof PreviewStartRequestSchema>;
134
+ export type PreviewServerSummaryPayload = z.infer<typeof PreviewServerSummaryPayloadSchema>;
135
+ export type PreviewStartResponse = z.infer<typeof PreviewStartResponseSchema>;
136
+ export type PreviewBindTabRequest = z.infer<typeof PreviewBindTabRequestSchema>;
137
+ export type PreviewBindTabResponse = z.infer<typeof PreviewBindTabResponseSchema>;
138
+ export type PreviewStopRequest = z.infer<typeof PreviewStopRequestSchema>;
139
+ export type PreviewStopResponse = z.infer<typeof PreviewStopResponseSchema>;
140
+ //# sourceMappingURL=preview.d.ts.map
@@ -0,0 +1,98 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Otto preview wire schemas (dev-server supervision). Fork-only capability, so it owns its schemas rather than declaring them in messages.ts, matching kanban.ts and artifacts/rpc-schemas.ts.
4
+ */
5
+ /**
6
+ * UI-initiated preview RPCs (the Preview toolbar button), distinct from the
7
+ * agent-facing preview_* tools in packages/server/src/server/preview/preview-tools.ts.
8
+ * Both sides drive the same DevServerManager; only the caller differs.
9
+ */
10
+ export const PreviewListConfigRequestSchema = z.object({
11
+ type: z.literal("preview.list_config.request"),
12
+ cwd: z.string(),
13
+ requestId: z.string(),
14
+ });
15
+ export const PreviewStartRequestSchema = z.object({
16
+ type: z.literal("preview.start.request"),
17
+ cwd: z.string(),
18
+ name: z.string(),
19
+ requestId: z.string(),
20
+ });
21
+ export const PreviewBindTabRequestSchema = z.object({
22
+ type: z.literal("preview.bind_tab.request"),
23
+ serverId: z.string(),
24
+ browserId: z.string(),
25
+ requestId: z.string(),
26
+ });
27
+ export const PreviewStopRequestSchema = z.object({
28
+ type: z.literal("preview.stop.request"),
29
+ serverId: z.string(),
30
+ requestId: z.string(),
31
+ });
32
+ export const PreviewConfiguredServerSchema = z.object({
33
+ name: z.string(),
34
+ port: z.number().int().positive(),
35
+ });
36
+ export const PreviewServerStatusSchema = z.enum(["starting", "running", "exited"]);
37
+ export const PreviewRunningServerSchema = z.object({
38
+ serverId: z.string(),
39
+ name: z.string(),
40
+ url: z.string(),
41
+ port: z.number().int().positive(),
42
+ status: PreviewServerStatusSchema,
43
+ });
44
+ export const PreviewListConfigResponseSchema = z.object({
45
+ type: z.literal("preview.list_config.response"),
46
+ payload: z.object({
47
+ cwd: z.string(),
48
+ configured: z.boolean(),
49
+ servers: z.array(PreviewConfiguredServerSchema),
50
+ runningServers: z.array(PreviewRunningServerSchema).optional(),
51
+ error: z.string().nullable(),
52
+ requestId: z.string(),
53
+ }),
54
+ });
55
+ // Preview servers the daemon did not spawn (port-probed from launch.json, e.g.
56
+ // a dev server the user started by hand) are addressed by an "ext:<port>" id.
57
+ // Stopping one tree-kills whatever process owns the port, so bulk cleanup paths
58
+ // must skip external servers and only explicit user action may stop them.
59
+ export const EXTERNAL_PREVIEW_SERVER_ID_PREFIX = "ext:";
60
+ export function isExternalPreviewServerId(serverId) {
61
+ return serverId.startsWith(EXTERNAL_PREVIEW_SERVER_ID_PREFIX);
62
+ }
63
+ export const PreviewServerSummaryPayloadSchema = z.object({
64
+ serverId: z.string(),
65
+ name: z.string(),
66
+ url: z.string(),
67
+ port: z.number().int().positive(),
68
+ status: z.enum(["starting", "running", "exited"]),
69
+ boundBrowserId: z.string().nullable(),
70
+ });
71
+ export const PreviewStartResponseSchema = z.object({
72
+ type: z.literal("preview.start.response"),
73
+ payload: z.object({
74
+ cwd: z.string(),
75
+ success: z.boolean(),
76
+ server: PreviewServerSummaryPayloadSchema.nullable(),
77
+ reused: z.boolean(),
78
+ error: z.string().nullable(),
79
+ requestId: z.string(),
80
+ }),
81
+ });
82
+ export const PreviewBindTabResponseSchema = z.object({
83
+ type: z.literal("preview.bind_tab.response"),
84
+ payload: z.object({
85
+ success: z.boolean(),
86
+ error: z.string().nullable(),
87
+ requestId: z.string(),
88
+ }),
89
+ });
90
+ export const PreviewStopResponseSchema = z.object({
91
+ type: z.literal("preview.stop.response"),
92
+ payload: z.object({
93
+ success: z.boolean(),
94
+ error: z.string().nullable(),
95
+ requestId: z.string(),
96
+ }),
97
+ });
98
+ //# sourceMappingURL=preview.js.map