@otto-code/protocol 0.8.9 → 0.8.12

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 (60) hide show
  1. package/dist/agent-queue.d.ts +87 -0
  2. package/dist/agent-queue.js +106 -0
  3. package/dist/brain.d.ts +2321 -0
  4. package/dist/brain.js +1082 -0
  5. package/dist/client-capabilities.d.ts +2 -0
  6. package/dist/client-capabilities.js +10 -0
  7. package/dist/code-intelligence.d.ts +917 -0
  8. package/dist/code-intelligence.js +699 -0
  9. package/dist/communications.d.ts +1106 -0
  10. package/dist/communications.js +384 -0
  11. package/dist/context.d.ts +787 -0
  12. package/dist/context.js +295 -0
  13. package/dist/daemon-config.d.ts +377 -0
  14. package/dist/daemon-config.js +395 -0
  15. package/dist/file-operations.d.ts +380 -0
  16. package/dist/file-operations.js +282 -0
  17. package/dist/generated/validation/ws-outbound.aot.js +54927 -48878
  18. package/dist/git-hosting.d.ts +117 -0
  19. package/dist/git-hosting.js +109 -0
  20. package/dist/git-operations.d.ts +255 -0
  21. package/dist/git-operations.js +221 -0
  22. package/dist/integration-authorization.d.ts +195 -0
  23. package/dist/integration-authorization.js +125 -0
  24. package/dist/kanban.d.ts +341 -0
  25. package/dist/kanban.js +273 -0
  26. package/dist/loop/rpc-schemas.d.ts +6 -6
  27. package/dist/meetings.d.ts +95 -0
  28. package/dist/meetings.js +57 -0
  29. package/dist/messages.d.ts +21054 -24042
  30. package/dist/messages.js +4355 -8731
  31. package/dist/orchestration.d.ts +726 -0
  32. package/dist/orchestration.js +232 -0
  33. package/dist/personality-schemas.d.ts +221 -0
  34. package/dist/personality-schemas.js +340 -0
  35. package/dist/preview.d.ts +140 -0
  36. package/dist/preview.js +98 -0
  37. package/dist/project-knowledge.d.ts +740 -0
  38. package/dist/project-knowledge.js +229 -0
  39. package/dist/project-links.d.ts +102 -0
  40. package/dist/project-links.js +62 -0
  41. package/dist/provider-config.d.ts +87 -2
  42. package/dist/provider-config.js +110 -0
  43. package/dist/refine.d.ts +93 -0
  44. package/dist/refine.js +78 -0
  45. package/dist/schedule/rpc-schemas.d.ts +47 -47
  46. package/dist/schedule/types.d.ts +13 -13
  47. package/dist/speech.d.ts +180 -0
  48. package/dist/speech.js +177 -0
  49. package/dist/storage.d.ts +79 -0
  50. package/dist/storage.js +107 -0
  51. package/dist/suggested-tasks.d.ts +106 -0
  52. package/dist/suggested-tasks.js +81 -0
  53. package/dist/terminal-compatibility.d.ts +55 -0
  54. package/dist/terminal-compatibility.js +35 -0
  55. package/dist/usage-stats.d.ts +255 -0
  56. package/dist/usage-stats.js +162 -0
  57. package/dist/validation/ws-outbound-schema-metadata.d.ts +1404 -274
  58. package/dist/worktree-ops.d.ts +81 -0
  59. package/dist/worktree-ops.js +88 -0
  60. package/package.json +1 -1
@@ -0,0 +1,384 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Provider-neutral communications vocabulary. Provider adapters translate their
4
+ * native models at this boundary; provider-specific identifiers never escape it.
5
+ *
6
+ * This deliberately describes the read model only. Connection credentials,
7
+ * provider OAuth mechanics, message composition, and notification policy have
8
+ * separate lifecycles and must not leak into the common conversation model.
9
+ */
10
+ export const CommunicationProviderIdSchema = z.string().trim().min(1);
11
+ export const CommunicationProviderConnectionStateSchema = z.enum([
12
+ "disconnected",
13
+ "connecting",
14
+ "connected",
15
+ "reauth_required",
16
+ "error",
17
+ ]);
18
+ export const CommunicationProviderSummarySchema = z.object({
19
+ providerId: CommunicationProviderIdSchema,
20
+ label: z.string().trim().min(1),
21
+ connectionState: CommunicationProviderConnectionStateSchema,
22
+ accountLabel: z.string().nullable(),
23
+ error: z.string().nullable(),
24
+ /** Otto's daemon-owned availability toggle, distinct from provider OAuth. */
25
+ enabled: z.boolean().optional(),
26
+ });
27
+ /**
28
+ * Presence is intentionally a small common vocabulary. Providers retain richer
29
+ * client-only states as `unknown` while carrying an optional observed display
30
+ * label where presenting that distinction matters.
31
+ */
32
+ export const CommunicationPresenceStatusSchema = z.enum([
33
+ "available",
34
+ "busy",
35
+ "do_not_disturb",
36
+ "away",
37
+ "out_of_office",
38
+ "unknown",
39
+ ]);
40
+ export const CommunicationPresenceSchema = z.object({
41
+ providerId: CommunicationProviderIdSchema,
42
+ status: CommunicationPresenceStatusSchema,
43
+ /**
44
+ * The provider's exact live label when the common vocabulary cannot express
45
+ * it without losing meaning. For example, Zoom's Offline is an observed
46
+ * presence and is not Otto's local Chat disable switch.
47
+ *
48
+ * Optional for old daemons and clients.
49
+ */
50
+ observedStatusLabel: z.string().trim().min(1).nullable().optional(),
51
+ canSetStatus: z.boolean(),
52
+ /** Kept optional so older clients can parse a newer daemon response. */
53
+ enabled: z.boolean().optional(),
54
+ /** Daemon-authoritative earliest time another provider update is permitted. */
55
+ statusChangeAvailableAt: z.string().datetime().nullable().optional(),
56
+ /**
57
+ * Remaining daemon-measured cooldown at the moment this snapshot was sent.
58
+ * Clients count this down locally so remote-daemon clock skew cannot make the
59
+ * visible gate expire before the daemon will send another provider request.
60
+ */
61
+ statusChangeAvailableInMs: z.number().int().nonnegative().nullable().optional(),
62
+ /** A daemon-owned desired status currently being applied to the provider. */
63
+ pendingStatus: CommunicationPresenceStatusSchema.nullable().optional(),
64
+ /** Safe, user-actionable explanation when no status change remains pending. */
65
+ statusChangeError: z.string().trim().min(1).nullable().optional(),
66
+ });
67
+ /**
68
+ * A provider's conversation categorization, normalized only as far as Otto can
69
+ * present it honestly. Providers with richer topology retain it inside their
70
+ * adapter instead of expanding this shared enum.
71
+ */
72
+ export const CommunicationConversationKindSchema = z.enum([
73
+ "direct",
74
+ "group",
75
+ "channel",
76
+ "unknown",
77
+ ]);
78
+ export const CommunicationConversationSummarySchema = z.object({
79
+ providerId: CommunicationProviderIdSchema,
80
+ conversationId: z.string().trim().min(1),
81
+ kind: CommunicationConversationKindSchema,
82
+ title: z.string().trim().min(1),
83
+ preview: z.string().nullable(),
84
+ updatedAt: z.string().datetime().nullable(),
85
+ unreadCount: z.number().int().nonnegative(),
86
+ /** Native provider favorite state. Optional for old daemon payloads. */
87
+ favorite: z.boolean().optional(),
88
+ /** Whether this destination supports a reversible native favorite mutation. */
89
+ canFavorite: z.boolean().optional(),
90
+ });
91
+ /**
92
+ * A compact, selectable destination returned by a provider's search. The
93
+ * destination is deliberately a conversation summary so choosing either a
94
+ * person or a channel follows the same open/send path without exposing a
95
+ * provider's contact object to the renderer.
96
+ */
97
+ export const CommunicationSearchResultSchema = z.object({
98
+ providerId: CommunicationProviderIdSchema,
99
+ category: z.enum(["person", "conversation"]),
100
+ conversation: CommunicationConversationSummarySchema,
101
+ /** A safe disambiguator such as an email address or “Channel”. */
102
+ detail: z.string().trim().min(1).nullable(),
103
+ /** Presence belongs to a searched person, never to a conversation. */
104
+ presenceStatus: CommunicationPresenceStatusSchema.nullable().optional(),
105
+ presenceLabel: z.string().trim().min(1).nullable().optional(),
106
+ });
107
+ /** A provider-confirmed aggregate attached to one stable message identity. */
108
+ export const CommunicationReactionSchema = z.object({
109
+ emoji: z.string().trim().min(1),
110
+ count: z.number().int().nonnegative(),
111
+ reactedByCurrentUser: z.boolean().optional(),
112
+ });
113
+ /** The message affordances the connected provider can actually honor. */
114
+ export const CommunicationRoomCapabilitiesSchema = z.object({
115
+ canCompose: z.boolean(),
116
+ canReply: z.boolean(),
117
+ canRetrieveThreads: z.boolean(),
118
+ canReact: z.boolean(),
119
+ canMarkRead: z.boolean(),
120
+ /** Truthful provider/API limitation, never a daemon-version compatibility message. */
121
+ unavailableReason: z.string().trim().min(1).nullable(),
122
+ });
123
+ /**
124
+ * A room message has a stable provider identity and an explicit parent link.
125
+ * Renderers must never infer thread topology from chronology or indentation.
126
+ */
127
+ export const CommunicationMessageSchema = z.object({
128
+ providerId: CommunicationProviderIdSchema,
129
+ conversationId: z.string().trim().min(1),
130
+ messageId: z.string().trim().min(1),
131
+ senderId: z.string().trim().min(1).nullable(),
132
+ text: z.string(),
133
+ sentAt: z.string().datetime().nullable(),
134
+ /** Optional additions keep old daemon payloads readable. */
135
+ senderDisplayName: z.string().trim().min(1).nullable().optional(),
136
+ /** Explicit provider-confirmed authorship. Never infer this from timeline order. */
137
+ isFromCurrentUser: z.boolean().optional(),
138
+ parentMessageId: z.string().trim().min(1).nullable().optional(),
139
+ replyCount: z.number().int().nonnegative().optional(),
140
+ reactions: z.array(CommunicationReactionSchema).optional(),
141
+ });
142
+ /** The durable room read model shared by popup and workspace-tab surfaces. */
143
+ export const CommunicationRoomSchema = z.object({
144
+ conversation: CommunicationConversationSummarySchema,
145
+ messages: z.array(CommunicationMessageSchema),
146
+ capabilities: CommunicationRoomCapabilitiesSchema,
147
+ });
148
+ /**
149
+ * A non-message grouping a provider exposes in its home surface, such as a
150
+ * shared space or a future provider's folder. It is intentionally not
151
+ * selectable as a conversation: an adapter must explicitly expose its child
152
+ * conversations before Otto can open it.
153
+ */
154
+ export const CommunicationHomeCollectionSchema = z.object({
155
+ providerId: CommunicationProviderIdSchema,
156
+ collectionId: z.string().trim().min(1),
157
+ kind: z.enum(["space", "folder", "unknown"]),
158
+ title: z.string().trim().min(1),
159
+ description: z.string().nullable(),
160
+ });
161
+ export const CommunicationHomeSectionSchema = z.object({
162
+ id: z.string().trim().min(1),
163
+ label: z.string().trim().min(1),
164
+ conversations: z.array(CommunicationConversationSummarySchema),
165
+ collections: z.array(CommunicationHomeCollectionSchema),
166
+ });
167
+ /**
168
+ * A local Otto notification. Acknowledging it only changes Otto's inbox
169
+ * projection; it is not evidence that a provider message was marked read.
170
+ */
171
+ export const CommunicationNotificationSchema = z.object({
172
+ notificationId: z.string().trim().min(1),
173
+ conversation: CommunicationConversationSummarySchema,
174
+ });
175
+ /** A provider-owned, deliberately compact home surface for its chat topology. */
176
+ export const CommunicationsInboxHomeSchema = z.object({
177
+ provider: CommunicationProviderSummarySchema,
178
+ sections: z.array(CommunicationHomeSectionSchema),
179
+ /** Optional so clients and daemons spanning the room feature stay compatible. */
180
+ notifications: z.array(CommunicationNotificationSchema).optional(),
181
+ });
182
+ /**
183
+ * The small projection used by a title-bar inbox. The daemon owns this
184
+ * projection and may return an empty list before any provider is connected.
185
+ */
186
+ export const CommunicationsOverviewSchema = z.object({
187
+ providers: z.array(CommunicationProviderSummarySchema),
188
+ conversations: z.array(CommunicationConversationSummarySchema),
189
+ unreadCount: z.number().int().nonnegative(),
190
+ });
191
+ // Communications is a daemon-owned, provider-neutral integration family. The
192
+ // first contract intentionally exposes only a compact read projection; OAuth,
193
+ // message send, and provider-specific controls arrive only after the Zoom proof
194
+ // demonstrates that this boundary is reliable. Gated by features.communications.
195
+ export const CommunicationsGetOverviewRequestSchema = z.object({
196
+ type: z.literal("communications.get_overview.request"),
197
+ requestId: z.string(),
198
+ });
199
+ export const CommunicationsGetOverviewResponseSchema = z.object({
200
+ type: z.literal("communications.get_overview.response"),
201
+ payload: z.object({
202
+ overview: CommunicationsOverviewSchema,
203
+ requestId: z.string(),
204
+ }),
205
+ });
206
+ // A connected provider's title-bar home is more detailed than the global
207
+ // overview and is independently capability-gated by communicationsChatHome.
208
+ export const CommunicationsInboxGetHomeRequestSchema = z.object({
209
+ type: z.literal("communications.inbox.get_home.request"),
210
+ requestId: z.string(),
211
+ providerId: z.string().trim().min(1),
212
+ });
213
+ export const CommunicationsInboxGetHomeResponseSchema = z.object({
214
+ type: z.literal("communications.inbox.get_home.response"),
215
+ payload: z.object({
216
+ home: CommunicationsInboxHomeSchema,
217
+ requestId: z.string(),
218
+ }),
219
+ });
220
+ // COMPAT(communicationsInboxSearch): added in v0.8.11, remove gate after
221
+ // 2027-02-15. Destination search is a new capability and newer clients must
222
+ // not issue this request to older hosts.
223
+ export const CommunicationsInboxSearchRequestSchema = z.object({
224
+ type: z.literal("communications.inbox.search.request"),
225
+ requestId: z.string(),
226
+ providerId: z.string().trim().min(1),
227
+ query: z.string().trim().min(2).max(100),
228
+ });
229
+ export const CommunicationsInboxSearchResponseSchema = z.object({
230
+ type: z.literal("communications.inbox.search.response"),
231
+ payload: z.object({
232
+ results: z.array(CommunicationSearchResultSchema),
233
+ requestId: z.string(),
234
+ }),
235
+ });
236
+ // COMPAT(communicationsFavorites): added in v0.8.11, remove gate after
237
+ // 2027-02-15. A host without provider-native favorite mutations must not
238
+ // receive this request from a newer frontend.
239
+ export const CommunicationsInboxSetFavoriteRequestSchema = z.object({
240
+ type: z.literal("communications.inbox.set_favorite.request"),
241
+ requestId: z.string(),
242
+ providerId: z.string().trim().min(1),
243
+ conversationId: z.string().trim().min(1),
244
+ favorite: z.boolean(),
245
+ });
246
+ export const CommunicationsInboxSetFavoriteResponseSchema = z.object({
247
+ type: z.literal("communications.inbox.set_favorite.response"),
248
+ payload: z.object({
249
+ // Return fresh daemon-owned Home state, not renderer-local toggle intent.
250
+ home: CommunicationsInboxHomeSchema,
251
+ requestId: z.string(),
252
+ }),
253
+ });
254
+ // COMPAT(communicationsRoomNotifications): added in v0.8.11, remove gate after
255
+ // 2027-02-15. Acknowledgement is daemon-local and must not be sent to old hosts.
256
+ export const CommunicationsInboxNotificationsAcknowledgeRequestSchema = z.object({
257
+ type: z.literal("communications.inbox.notifications.acknowledge.request"),
258
+ requestId: z.string(),
259
+ providerId: z.string().trim().min(1),
260
+ notificationIds: z.array(z.string().trim().min(1)).optional(),
261
+ conversationId: z.string().trim().min(1).optional(),
262
+ clearAll: z.boolean().optional(),
263
+ });
264
+ export const CommunicationsInboxNotificationsAcknowledgeResponseSchema = z.object({
265
+ type: z.literal("communications.inbox.notifications.acknowledge.response"),
266
+ payload: z.object({ home: CommunicationsInboxHomeSchema, requestId: z.string() }),
267
+ });
268
+ export const CommunicationsInboxGetPresenceRequestSchema = z.object({
269
+ type: z.literal("communications.inbox.get_presence.request"),
270
+ requestId: z.string(),
271
+ providerId: z.string().trim().min(1),
272
+ });
273
+ export const CommunicationsInboxGetPresenceResponseSchema = z.object({
274
+ type: z.literal("communications.inbox.get_presence.response"),
275
+ payload: z.object({ presence: CommunicationPresenceSchema, requestId: z.string() }),
276
+ });
277
+ // COMPAT(communicationsPresenceUpdates): added in v0.8.11, remove gate after
278
+ // 2027-02-14. The daemon publishes the authoritative status queue and cooldown
279
+ // state to capable frontends, so an open popup never has to be closed and
280
+ // reopened to observe a retry, completion, or failure.
281
+ export const CommunicationsInboxPresenceChangedNotificationSchema = z.object({
282
+ type: z.literal("communications.inbox.presence.changed.notification"),
283
+ payload: z.object({ presence: CommunicationPresenceSchema }),
284
+ });
285
+ export const CommunicationsInboxSetPresenceRequestSchema = z.object({
286
+ type: z.literal("communications.inbox.set_presence.request"),
287
+ requestId: z.string(),
288
+ providerId: z.string().trim().min(1),
289
+ status: CommunicationPresenceStatusSchema,
290
+ });
291
+ export const CommunicationsInboxSetPresenceResponseSchema = z.object({
292
+ type: z.literal("communications.inbox.set_presence.response"),
293
+ payload: z.object({ presence: CommunicationPresenceSchema, requestId: z.string() }),
294
+ });
295
+ // The Chat availability toggle is separate from provider presence: disabling
296
+ // Otto Chat must not discard the user's provider authorization or impersonate
297
+ // an unsupported native presence value. Gated by communicationsChatAvailability.
298
+ export const CommunicationsInboxSetEnabledRequestSchema = z.object({
299
+ type: z.literal("communications.inbox.set_enabled.request"),
300
+ requestId: z.string(),
301
+ providerId: z.string().trim().min(1),
302
+ enabled: z.boolean(),
303
+ });
304
+ export const CommunicationsInboxSetEnabledResponseSchema = z.object({
305
+ type: z.literal("communications.inbox.set_enabled.response"),
306
+ payload: z.object({ presence: CommunicationPresenceSchema, requestId: z.string() }),
307
+ });
308
+ export const CommunicationsInboxGetMessagesRequestSchema = z.object({
309
+ type: z.literal("communications.inbox.get_messages.request"),
310
+ requestId: z.string(),
311
+ providerId: z.string().trim().min(1),
312
+ conversationId: z.string().trim().min(1),
313
+ });
314
+ export const CommunicationsInboxGetMessagesResponseSchema = z.object({
315
+ type: z.literal("communications.inbox.get_messages.response"),
316
+ payload: z.object({
317
+ messages: z.array(CommunicationMessageSchema),
318
+ requestId: z.string(),
319
+ }),
320
+ });
321
+ export const CommunicationsInboxSendMessageRequestSchema = z.object({
322
+ type: z.literal("communications.inbox.send_message.request"),
323
+ requestId: z.string(),
324
+ providerId: z.string().trim().min(1),
325
+ conversationId: z.string().trim().min(1),
326
+ text: z.string().trim().min(1),
327
+ });
328
+ export const CommunicationsInboxSendMessageResponseSchema = z.object({
329
+ type: z.literal("communications.inbox.send_message.response"),
330
+ payload: z.object({
331
+ message: CommunicationMessageSchema,
332
+ requestId: z.string(),
333
+ }),
334
+ });
335
+ // COMPAT(communicationsRooms): added in v0.8.11, remove gate after 2027-02-15.
336
+ // Room operations are deliberately a separate, provider-neutral surface. Older
337
+ // hosts must never receive them from newer popup or workspace-tab renderers.
338
+ export const CommunicationsRoomGetRequestSchema = z.object({
339
+ type: z.literal("communications.room.get.request"),
340
+ requestId: z.string(),
341
+ providerId: z.string().trim().min(1),
342
+ conversationId: z.string().trim().min(1),
343
+ });
344
+ export const CommunicationsRoomGetResponseSchema = z.object({
345
+ type: z.literal("communications.room.get.response"),
346
+ payload: z.object({ room: CommunicationRoomSchema, requestId: z.string() }),
347
+ });
348
+ export const CommunicationsRoomThreadGetRequestSchema = z.object({
349
+ type: z.literal("communications.room.thread.get.request"),
350
+ requestId: z.string(),
351
+ providerId: z.string().trim().min(1),
352
+ conversationId: z.string().trim().min(1),
353
+ parentMessageId: z.string().trim().min(1),
354
+ });
355
+ export const CommunicationsRoomThreadGetResponseSchema = z.object({
356
+ type: z.literal("communications.room.thread.get.response"),
357
+ payload: z.object({ messages: z.array(CommunicationMessageSchema), requestId: z.string() }),
358
+ });
359
+ export const CommunicationsRoomMessageSendRequestSchema = z.object({
360
+ type: z.literal("communications.room.message.send.request"),
361
+ requestId: z.string(),
362
+ providerId: z.string().trim().min(1),
363
+ conversationId: z.string().trim().min(1),
364
+ text: z.string().trim().min(1),
365
+ parentMessageId: z.string().trim().min(1).nullable().optional(),
366
+ });
367
+ export const CommunicationsRoomMessageSendResponseSchema = z.object({
368
+ type: z.literal("communications.room.message.send.response"),
369
+ payload: z.object({ message: CommunicationMessageSchema, requestId: z.string() }),
370
+ });
371
+ export const CommunicationsRoomReactionSetRequestSchema = z.object({
372
+ type: z.literal("communications.room.reaction.set.request"),
373
+ requestId: z.string(),
374
+ providerId: z.string().trim().min(1),
375
+ conversationId: z.string().trim().min(1),
376
+ messageId: z.string().trim().min(1),
377
+ emoji: z.string().trim().min(1),
378
+ active: z.boolean(),
379
+ });
380
+ export const CommunicationsRoomReactionSetResponseSchema = z.object({
381
+ type: z.literal("communications.room.reaction.set.response"),
382
+ payload: z.object({ message: CommunicationMessageSchema, requestId: z.string() }),
383
+ });
384
+ //# sourceMappingURL=communications.js.map