@canonmsg/backend-contracts 1.9.0 → 2.0.0
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/dist/agentBehaviorPolicy.d.ts +45 -86
- package/dist/agentBehaviorPolicy.js +0 -53
- package/dist/cjs/agentBehaviorPolicy.js +1 -54
- package/dist/cjs/contactRequest.js +0 -30
- package/dist/cjs/index.js +0 -8
- package/dist/cjs/media.js +0 -13
- package/dist/cjs/message.js +0 -64
- package/dist/cjs/runtimeCardFields.js +1 -58
- package/dist/cjs/turnProtocol.js +1 -41
- package/dist/contactRequest.d.ts +23 -42
- package/dist/contactRequest.js +0 -29
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/media.d.ts +11 -24
- package/dist/media.js +0 -12
- package/dist/message.d.ts +50 -133
- package/dist/message.js +1 -64
- package/dist/runtimeCardFields.d.ts +39 -112
- package/dist/runtimeCardFields.js +0 -57
- package/dist/turnProtocol.d.ts +24 -91
- package/dist/turnProtocol.js +0 -40
- package/package.json +5 -8
- package/dist/bridgeLocal.d.ts +0 -1871
- package/dist/bridgeLocal.js +0 -744
- package/dist/cjs/bridgeLocal.js +0 -747
- package/dist/cjs/controlSignals.js +0 -44
- package/dist/cjs/endpointRegistry.js +0 -264
- package/dist/cjs/hitl.js +0 -171
- package/dist/cjs/inboundFrame.js +0 -92
- package/dist/cjs/restEndpoints.js +0 -237
- package/dist/cjs/sendContextual.js +0 -92
- package/dist/cjs/sseEvents.js +0 -281
- package/dist/controlSignals.d.ts +0 -55
- package/dist/controlSignals.js +0 -41
- package/dist/endpointRegistry.d.ts +0 -13
- package/dist/endpointRegistry.js +0 -261
- package/dist/hitl.d.ts +0 -303
- package/dist/hitl.js +0 -168
- package/dist/inboundFrame.d.ts +0 -229
- package/dist/inboundFrame.js +0 -89
- package/dist/restEndpoints.d.ts +0 -531
- package/dist/restEndpoints.js +0 -234
- package/dist/schemas/agent-behavior-settings-record.schema.json +0 -48
- package/dist/schemas/bridge-connection-state-notification.schema.json +0 -19
- package/dist/schemas/bridge-get-attachment-params.schema.json +0 -24
- package/dist/schemas/bridge-get-attachment-result.schema.json +0 -20
- package/dist/schemas/bridge-hello-params.schema.json +0 -42
- package/dist/schemas/bridge-hello-result.schema.json +0 -105
- package/dist/schemas/bridge-hitl-state.schema.json +0 -38
- package/dist/schemas/bridge-ok-result.schema.json +0 -15
- package/dist/schemas/bridge-publish-streaming-event-params.schema.json +0 -138
- package/dist/schemas/bridge-ready-notification.schema.json +0 -79
- package/dist/schemas/bridge-resync-reason.schema.json +0 -9
- package/dist/schemas/bridge-resync.schema.json +0 -18
- package/dist/schemas/bridge-rpc-error.schema.json +0 -19
- package/dist/schemas/bridge-rpc-id.schema.json +0 -12
- package/dist/schemas/bridge-rpc-notification.schema.json +0 -20
- package/dist/schemas/bridge-rpc-request.schema.json +0 -31
- package/dist/schemas/bridge-rpc-response.schema.json +0 -81
- package/dist/schemas/bridge-status-result.schema.json +0 -76
- package/dist/schemas/bridge-stream-clear-event.schema.json +0 -15
- package/dist/schemas/bridge-stream-event.schema.json +0 -112
- package/dist/schemas/bridge-stream-final-event.schema.json +0 -19
- package/dist/schemas/bridge-stream-text-event.schema.json +0 -31
- package/dist/schemas/bridge-stream-thinking-event.schema.json +0 -15
- package/dist/schemas/bridge-stream-tool-event.schema.json +0 -36
- package/dist/schemas/bridge-upload-media-params.schema.json +0 -28
- package/dist/schemas/bridge-upstream-state.schema.json +0 -10
- package/dist/schemas/contacts-response.schema.json +0 -52
- package/dist/schemas/control-channel-key.schema.json +0 -10
- package/dist/schemas/control-primitive-event.schema.json +0 -30
- package/dist/schemas/control-primitive-map.schema.json +0 -15
- package/dist/schemas/control-session-event.schema.json +0 -26
- package/dist/schemas/control-session-node.schema.json +0 -11
- package/dist/schemas/control-signal-event.schema.json +0 -35
- package/dist/schemas/control-signal-node.schema.json +0 -22
- package/dist/schemas/control-signal-type.schema.json +0 -10
- package/dist/schemas/conversations-response.schema.json +0 -167
- package/dist/schemas/create-contact-request-request.schema.json +0 -17
- package/dist/schemas/create-contact-request-response.schema.json +0 -51
- package/dist/schemas/create-conversation-request.schema.json +0 -82
- package/dist/schemas/create-conversation-response.schema.json +0 -29
- package/dist/schemas/delete-message-response.schema.json +0 -11
- package/dist/schemas/delivery-intent.schema.json +0 -11
- package/dist/schemas/forward-message-request.schema.json +0 -25
- package/dist/schemas/forward-message-response.schema.json +0 -35
- package/dist/schemas/forwarded-from.schema.json +0 -18
- package/dist/schemas/get-messages-query.schema.json +0 -17
- package/dist/schemas/hitl-approval-category.schema.json +0 -15
- package/dist/schemas/hitl-approval-detail.schema.json +0 -21
- package/dist/schemas/hitl-approval-outcome-record.schema.json +0 -33
- package/dist/schemas/hitl-approval-reply-record.schema.json +0 -57
- package/dist/schemas/hitl-approval-request-record.schema.json +0 -105
- package/dist/schemas/hitl-approval-risk.schema.json +0 -11
- package/dist/schemas/hitl-card-outcome-record.schema.json +0 -48
- package/dist/schemas/hitl-card-reply-record.schema.json +0 -46
- package/dist/schemas/hitl-card-request-record.schema.json +0 -73
- package/dist/schemas/hitl-input-answers.schema.json +0 -23
- package/dist/schemas/hitl-input-kind.schema.json +0 -10
- package/dist/schemas/hitl-input-outcome-record.schema.json +0 -46
- package/dist/schemas/hitl-input-question.schema.json +0 -54
- package/dist/schemas/hitl-input-reply-record.schema.json +0 -44
- package/dist/schemas/hitl-input-request-record.schema.json +0 -134
- package/dist/schemas/hitl-pending.schema.json +0 -31
- package/dist/schemas/hitl-request-accepted.schema.json +0 -18
- package/dist/schemas/hitl-request-kind.schema.json +0 -10
- package/dist/schemas/hitl-resolution-status.schema.json +0 -10
- package/dist/schemas/hitl-resolution.schema.json +0 -38
- package/dist/schemas/hitl-session-rule.schema.json +0 -32
- package/dist/schemas/inbound-disposition.schema.json +0 -13
- package/dist/schemas/inbound-frame-attachment-v1.schema.json +0 -94
- package/dist/schemas/inbound-frame-contact-card-v1.schema.json +0 -59
- package/dist/schemas/inbound-frame-group-context-v1.schema.json +0 -96
- package/dist/schemas/inbound-frame-reply-context-v1.schema.json +0 -261
- package/dist/schemas/inbound-frame-shape-v1.schema.json +0 -12
- package/dist/schemas/inbound-frame-v1.schema.json +0 -506
- package/dist/schemas/mark-read-response.schema.json +0 -11
- package/dist/schemas/media-attachment-kind.schema.json +0 -11
- package/dist/schemas/media-attachment.schema.json +0 -42
- package/dist/schemas/messages-page-response.schema.json +0 -290
- package/dist/schemas/participation-decision-input.schema.json +0 -44
- package/dist/schemas/participation-history-message.schema.json +0 -23
- package/dist/schemas/participation-history-snapshot.schema.json +0 -37
- package/dist/schemas/participation-style.schema.json +0 -13
- package/dist/schemas/react-request.schema.json +0 -22
- package/dist/schemas/react-response.schema.json +0 -35
- package/dist/schemas/resolve-admission-request.schema.json +0 -30
- package/dist/schemas/resolve-admission-response.schema.json +0 -129
- package/dist/schemas/resolved-agent-behavior-policy-record.schema.json +0 -81
- package/dist/schemas/rest-contact.schema.json +0 -40
- package/dist/schemas/rest-conversation-last-message.schema.json +0 -77
- package/dist/schemas/rest-conversation.schema.json +0 -155
- package/dist/schemas/rest-message.schema.json +0 -252
- package/dist/schemas/rest-ok-response.schema.json +0 -11
- package/dist/schemas/rest-session-selection.schema.json +0 -40
- package/dist/schemas/runtime-card-field-choice.schema.json +0 -23
- package/dist/schemas/runtime-card-field-type.schema.json +0 -17
- package/dist/schemas/runtime-card-field.schema.json +0 -180
- package/dist/schemas/runtime-card-line-item-column-type.schema.json +0 -12
- package/dist/schemas/runtime-card-line-item-column.schema.json +0 -74
- package/dist/schemas/send-contextual-deferred-response.schema.json +0 -39
- package/dist/schemas/send-contextual-messaged-response.schema.json +0 -42
- package/dist/schemas/send-contextual-request.schema.json +0 -103
- package/dist/schemas/send-contextual-response.schema.json +0 -105
- package/dist/schemas/send-contextual-self-context.schema.json +0 -19
- package/dist/schemas/send-contextual-state-response.schema.json +0 -24
- package/dist/schemas/send-message-request.schema.json +0 -106
- package/dist/schemas/send-message-response.schema.json +0 -14
- package/dist/schemas/sender-type.schema.json +0 -9
- package/dist/schemas/serialize-message-input.schema.json +0 -29
- package/dist/schemas/serialized-agent-client-type.schema.json +0 -12
- package/dist/schemas/serialized-contact-card.schema.json +0 -65
- package/dist/schemas/serialized-contact-request-status.schema.json +0 -11
- package/dist/schemas/serialized-contact-request.schema.json +0 -157
- package/dist/schemas/serialized-content-type.schema.json +0 -13
- package/dist/schemas/serialized-message.schema.json +0 -249
- package/dist/schemas/serialized-reactions.schema.json +0 -14
- package/dist/schemas/serialized-sender-type.schema.json +0 -9
- package/dist/schemas/set-streaming-request.schema.json +0 -67
- package/dist/schemas/set-typing-request.schema.json +0 -25
- package/dist/schemas/sse-access-policy.schema.json +0 -10
- package/dist/schemas/sse-agent-context-payload.schema.json +0 -57
- package/dist/schemas/sse-connected-payload.schema.json +0 -18
- package/dist/schemas/sse-contact-payload.schema.json +0 -40
- package/dist/schemas/sse-contact-removed-payload.schema.json +0 -14
- package/dist/schemas/sse-contact-request-payload.schema.json +0 -157
- package/dist/schemas/sse-conversation-updated-payload.schema.json +0 -48
- package/dist/schemas/sse-error-payload.schema.json +0 -23
- package/dist/schemas/sse-event-envelope.schema.json +0 -40
- package/dist/schemas/sse-event-family.schema.json +0 -12
- package/dist/schemas/sse-event-type.schema.json +0 -26
- package/dist/schemas/sse-heartbeat-payload.schema.json +0 -14
- package/dist/schemas/sse-membership-change.schema.json +0 -28
- package/dist/schemas/sse-message-created-payload.schema.json +0 -414
- package/dist/schemas/sse-message-deleted-payload.schema.json +0 -18
- package/dist/schemas/sse-message-updated-payload.schema.json +0 -46
- package/dist/schemas/sse-presence-payload.schema.json +0 -21
- package/dist/schemas/sse-provenance.schema.json +0 -64
- package/dist/schemas/sse-replay-expired-payload.schema.json +0 -21
- package/dist/schemas/sse-runtime-control-kind.schema.json +0 -13
- package/dist/schemas/sse-runtime-control-payload.schema.json +0 -44
- package/dist/schemas/sse-self-context.schema.json +0 -45
- package/dist/schemas/sse-turn-dispatch.schema.json +0 -29
- package/dist/schemas/sse-typing-payload.schema.json +0 -32
- package/dist/schemas/sse-voice-session-event-payload.schema.json +0 -170
- package/dist/schemas/sse-voice-session.schema.json +0 -157
- package/dist/schemas/trigger-decision.schema.json +0 -27
- package/dist/schemas/turn-lifecycle-state.schema.json +0 -14
- package/dist/schemas/turn-message-semantics.schema.json +0 -10
- package/dist/schemas/turn-metadata.schema.json +0 -56
- package/dist/schemas/turn-state-like.schema.json +0 -39
- package/dist/schemas/update-disposition-request.schema.json +0 -22
- package/dist/schemas/upload-media-request.schema.json +0 -25
- package/dist/schemas/upload-media-response.schema.json +0 -55
- package/dist/sendContextual.d.ts +0 -114
- package/dist/sendContextual.js +0 -89
- package/dist/sseEvents.d.ts +0 -474
- package/dist/sseEvents.js +0 -278
package/dist/restEndpoints.js
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
// Wire contract v1 — request/response schemas for the agent-facing "Canon op"
|
|
2
|
-
// REST surface the bridge proxies (bridge-local-api.md §B).
|
|
3
|
-
//
|
|
4
|
-
// Grounded in the Functions handlers (functions/src/api/*) and the canonical
|
|
5
|
-
// consumer (@canonmsg/core CanonClient) — request bodies mirror what clients
|
|
6
|
-
// send today, response schemas mirror what the handlers emit. This is a
|
|
7
|
-
// re-expression of current behavior, not a redesign.
|
|
8
|
-
import { z } from 'zod';
|
|
9
|
-
import { MediaAttachmentSchema } from './media.js';
|
|
10
|
-
import { SerializedContentTypeSchema, SerializedMessageSchema, SerializedReactionsSchema, } from './message.js';
|
|
11
|
-
import { InboundDispositionSchema } from './turnProtocol.js';
|
|
12
|
-
// ── Shared fragments ───────────────────────────────────────────────────
|
|
13
|
-
export const RestOkResponseSchema = z.looseObject({
|
|
14
|
-
success: z.boolean().optional(),
|
|
15
|
-
});
|
|
16
|
-
/** GET …/messages items — the serialized message plus the soft-delete flag. */
|
|
17
|
-
export const RestMessageSchema = SerializedMessageSchema.extend({
|
|
18
|
-
deleted: z.boolean().optional(),
|
|
19
|
-
});
|
|
20
|
-
/**
|
|
21
|
-
* STRICT WRITES, TOLERANT READS: this is a READ schema over live production
|
|
22
|
-
* data, so it must describe what Firestore actually holds — not what today's
|
|
23
|
-
* writers produce. The GET /conversations serializer
|
|
24
|
-
* (functions/src/api/getConversations.ts) passes `lastMessage` fields through
|
|
25
|
-
* from the conversation doc, and legacy rows (pre-refactor writes,
|
|
26
|
-
* deleted-message repair) hold explicit nulls:
|
|
27
|
-
* - `text` is serialized `?? null` and `timestamp` as
|
|
28
|
-
* `?.toDate?.()?.toISOString() ?? null` — both emit null by construction.
|
|
29
|
-
* - `senderId` / `senderType` / `contentType` are raw pass-throughs; live
|
|
30
|
-
* rows exist with all three null (the getConversations "ghost fix" comment
|
|
31
|
-
* acknowledges null senderId).
|
|
32
|
-
* - conversation `createdAt` is also serialized `?? null`.
|
|
33
|
-
* Writers (onMessageCreated / deletedMessageRepair) stay strict — they always
|
|
34
|
-
* produce the full shape; only the read contract admits the legacy nulls.
|
|
35
|
-
*/
|
|
36
|
-
export const RestConversationLastMessageSchema = z.looseObject({
|
|
37
|
-
text: z.string().nullable(),
|
|
38
|
-
messageId: z.string().optional(),
|
|
39
|
-
senderId: z.string().nullable().optional(),
|
|
40
|
-
senderType: z.enum(['human', 'ai_agent']).nullable().optional(),
|
|
41
|
-
contentType: SerializedContentTypeSchema.nullable().optional(),
|
|
42
|
-
timestamp: z.string().nullable(),
|
|
43
|
-
});
|
|
44
|
-
export const RestConversationSchema = z.looseObject({
|
|
45
|
-
id: z.string(),
|
|
46
|
-
type: z.enum(['direct', 'group']),
|
|
47
|
-
name: z.string().nullable().optional(),
|
|
48
|
-
topic: z.string().nullable().optional(),
|
|
49
|
-
memberIds: z.array(z.string()),
|
|
50
|
-
isAgentChat: z.boolean().optional(),
|
|
51
|
-
/** Resolved agent behavior policy — opaque pass-through. */
|
|
52
|
-
behavior: z.record(z.string(), z.unknown()).optional(),
|
|
53
|
-
hasUnread: z.boolean().optional(),
|
|
54
|
-
lastMessage: RestConversationLastMessageSchema.nullable(),
|
|
55
|
-
createdAt: z.string().nullable().optional(),
|
|
56
|
-
});
|
|
57
|
-
export const RestContactSchema = z.object({
|
|
58
|
-
id: z.string(),
|
|
59
|
-
source: z.string(),
|
|
60
|
-
addedAt: z.string().nullable(),
|
|
61
|
-
displayNameOverride: z.string().nullable(),
|
|
62
|
-
});
|
|
63
|
-
export const RestSessionSelectionSchema = z.union([
|
|
64
|
-
z.object({ mode: z.enum(['new', 'continue_latest', 'continue_or_create']) }),
|
|
65
|
-
z.object({ mode: z.literal('specific'), conversationId: z.string() }),
|
|
66
|
-
]);
|
|
67
|
-
// ── POST /messages/send ────────────────────────────────────────────────
|
|
68
|
-
export const SendMessageRequestSchema = z.object({
|
|
69
|
-
conversationId: z.string(),
|
|
70
|
-
text: z.string().optional(),
|
|
71
|
-
/** Client-supplied idempotency id. */
|
|
72
|
-
messageId: z.string().optional(),
|
|
73
|
-
contentType: SerializedContentTypeSchema.optional(),
|
|
74
|
-
replyTo: z.string().optional(),
|
|
75
|
-
replyToPosition: z.number().optional(),
|
|
76
|
-
attachments: z.array(MediaAttachmentSchema).optional(),
|
|
77
|
-
contactCardUserId: z.string().optional(),
|
|
78
|
-
mentions: z.array(z.string()).optional(),
|
|
79
|
-
selfContextId: z.string().nullable().optional(),
|
|
80
|
-
/** Structured metadata (turn protocol, approval cards, …). */
|
|
81
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
82
|
-
});
|
|
83
|
-
export const SendMessageResponseSchema = z.object({
|
|
84
|
-
messageId: z.string(),
|
|
85
|
-
});
|
|
86
|
-
// ── POST /messages/react ───────────────────────────────────────────────
|
|
87
|
-
export const ReactRequestSchema = z.object({
|
|
88
|
-
conversationId: z.string(),
|
|
89
|
-
messageId: z.string(),
|
|
90
|
-
emoji: z.string(),
|
|
91
|
-
});
|
|
92
|
-
export const ReactResponseSchema = z.object({
|
|
93
|
-
success: z.boolean(),
|
|
94
|
-
action: z.enum(['added', 'removed']),
|
|
95
|
-
reactions: SerializedReactionsSchema,
|
|
96
|
-
});
|
|
97
|
-
// ── POST /messages/forward ─────────────────────────────────────────────
|
|
98
|
-
export const ForwardMessageRequestSchema = z.object({
|
|
99
|
-
sourceConversationId: z.string(),
|
|
100
|
-
targetConversationId: z.string(),
|
|
101
|
-
messageId: z.string(),
|
|
102
|
-
text: z.string().optional(),
|
|
103
|
-
});
|
|
104
|
-
export const ForwardMessageResponseSchema = z.object({
|
|
105
|
-
messageId: z.string(),
|
|
106
|
-
targetConversationId: z.string(),
|
|
107
|
-
forwardedFrom: z.object({
|
|
108
|
-
sourceConversationId: z.string(),
|
|
109
|
-
messageId: z.string(),
|
|
110
|
-
}),
|
|
111
|
-
});
|
|
112
|
-
// ── DELETE /conversations/:id/messages/:id, POST …/read, PATCH …/disposition ──
|
|
113
|
-
export const DeleteMessageResponseSchema = RestOkResponseSchema;
|
|
114
|
-
export const MarkReadResponseSchema = RestOkResponseSchema;
|
|
115
|
-
export const UpdateDispositionRequestSchema = z.object({
|
|
116
|
-
inboundDisposition: InboundDispositionSchema,
|
|
117
|
-
});
|
|
118
|
-
// ── GET /conversations + GET …/messages ────────────────────────────────
|
|
119
|
-
export const ConversationsResponseSchema = z.object({
|
|
120
|
-
conversations: z.array(RestConversationSchema),
|
|
121
|
-
});
|
|
122
|
-
/** Query params: limit, before, includeBehavior. */
|
|
123
|
-
export const GetMessagesQuerySchema = z.object({
|
|
124
|
-
limit: z.string().optional(),
|
|
125
|
-
before: z.string().optional(),
|
|
126
|
-
includeBehavior: z.string().optional(),
|
|
127
|
-
});
|
|
128
|
-
export const MessagesPageResponseSchema = z.looseObject({
|
|
129
|
-
messages: z.array(RestMessageSchema),
|
|
130
|
-
/** Present with includeBehavior=1. */
|
|
131
|
-
behavior: z.record(z.string(), z.unknown()).optional(),
|
|
132
|
-
activeSelfContextIdByMessageId: z.record(z.string(), z.string()).optional(),
|
|
133
|
-
selfContexts: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
134
|
-
});
|
|
135
|
-
// ── POST /conversations/create ─────────────────────────────────────────
|
|
136
|
-
export const CreateConversationRequestSchema = z.object({
|
|
137
|
-
type: z.enum(['direct', 'group']),
|
|
138
|
-
targetUserId: z.string().optional(),
|
|
139
|
-
memberIds: z.array(z.string()).optional(),
|
|
140
|
-
name: z.string().optional(),
|
|
141
|
-
/** Initial session config for first-party coding agents — opaque pass-through. */
|
|
142
|
-
sessionConfig: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
143
|
-
sessionSelection: RestSessionSelectionSchema.optional(),
|
|
144
|
-
});
|
|
145
|
-
export const CreateConversationResponseSchema = z.object({
|
|
146
|
-
conversationId: z.string(),
|
|
147
|
-
created: z.boolean().optional(),
|
|
148
|
-
reused: z.boolean().optional(),
|
|
149
|
-
sessionSelection: z.enum(['new', 'continue_latest', 'continue_or_create', 'specific']).optional(),
|
|
150
|
-
});
|
|
151
|
-
// ── Contacts / admission ───────────────────────────────────────────────
|
|
152
|
-
export const CreateContactRequestRequestSchema = z.object({
|
|
153
|
-
targetId: z.string(),
|
|
154
|
-
message: z.string().optional(),
|
|
155
|
-
});
|
|
156
|
-
export const CreateContactRequestResponseSchema = z.union([
|
|
157
|
-
z.looseObject({ status: z.literal('open') }),
|
|
158
|
-
z.looseObject({ status: z.enum(['created', 'duplicate']), requestId: z.string() }),
|
|
159
|
-
/** Legacy "already a contact" body. */
|
|
160
|
-
z.looseObject({ message: z.string() }),
|
|
161
|
-
]);
|
|
162
|
-
export const ContactsResponseSchema = z.object({
|
|
163
|
-
contacts: z.array(RestContactSchema),
|
|
164
|
-
});
|
|
165
|
-
export const ResolveAdmissionRequestSchema = z.union([
|
|
166
|
-
z.object({ targetUserId: z.string() }),
|
|
167
|
-
z.object({ canonContactId: z.string() }),
|
|
168
|
-
]);
|
|
169
|
-
export const ResolveAdmissionResponseSchema = z.looseObject({
|
|
170
|
-
resolvedTargetUserId: z.string().nullable().optional(),
|
|
171
|
-
target: z.looseObject({
|
|
172
|
-
id: z.string(),
|
|
173
|
-
canonContactId: z.string().optional(),
|
|
174
|
-
displayName: z.string().optional(),
|
|
175
|
-
avatarUrl: z.string().nullable().optional(),
|
|
176
|
-
about: z.string().optional(),
|
|
177
|
-
userType: z.enum(['human', 'ai_agent']).optional(),
|
|
178
|
-
discoverable: z.boolean().optional(),
|
|
179
|
-
inboundPolicy: z.enum(['open', 'approval-required', 'owner-only']).optional(),
|
|
180
|
-
groupJoinPolicy: z.enum(['open', 'approval-required', 'owner-only']).optional(),
|
|
181
|
-
}).nullable(),
|
|
182
|
-
admission: z.looseObject({
|
|
183
|
-
state: z.enum([
|
|
184
|
-
'self',
|
|
185
|
-
'not-found',
|
|
186
|
-
'allowed',
|
|
187
|
-
'request-required',
|
|
188
|
-
'pending-outbound',
|
|
189
|
-
'blocked',
|
|
190
|
-
'inactive',
|
|
191
|
-
'owner-only',
|
|
192
|
-
]),
|
|
193
|
-
canMessage: z.boolean(),
|
|
194
|
-
canRequestContact: z.boolean(),
|
|
195
|
-
isContact: z.boolean(),
|
|
196
|
-
pendingRequestId: z.string().optional(),
|
|
197
|
-
blockedByViewer: z.boolean().optional(),
|
|
198
|
-
blockedByTarget: z.boolean().optional(),
|
|
199
|
-
}),
|
|
200
|
-
});
|
|
201
|
-
// ── Typing / streaming ─────────────────────────────────────────────────
|
|
202
|
-
export const SetTypingRequestSchema = z.object({
|
|
203
|
-
conversationId: z.string(),
|
|
204
|
-
typing: z.boolean(),
|
|
205
|
-
status: z.enum(['thinking', 'typing']).optional(),
|
|
206
|
-
});
|
|
207
|
-
/** POST /streaming — the legacy REST facade over the RTDB streaming bubble. */
|
|
208
|
-
export const SetStreamingRequestSchema = z.union([
|
|
209
|
-
z.object({
|
|
210
|
-
conversationId: z.string(),
|
|
211
|
-
text: z.string(),
|
|
212
|
-
status: z.string(),
|
|
213
|
-
messageId: z.string(),
|
|
214
|
-
turnId: z.string().nullable().optional(),
|
|
215
|
-
/** TurnOutputBlock[] — opaque pass-through. */
|
|
216
|
-
blocks: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
217
|
-
}),
|
|
218
|
-
z.object({
|
|
219
|
-
conversationId: z.string(),
|
|
220
|
-
streaming: z.literal(false),
|
|
221
|
-
}),
|
|
222
|
-
]);
|
|
223
|
-
// ── Media upload ───────────────────────────────────────────────────────
|
|
224
|
-
export const UploadMediaRequestSchema = z.object({
|
|
225
|
-
conversationId: z.string(),
|
|
226
|
-
mimeType: z.string(),
|
|
227
|
-
/** Base64-encoded file content. */
|
|
228
|
-
data: z.string(),
|
|
229
|
-
fileName: z.string().optional(),
|
|
230
|
-
});
|
|
231
|
-
export const UploadMediaResponseSchema = z.object({
|
|
232
|
-
url: z.string(),
|
|
233
|
-
attachment: MediaAttachmentSchema,
|
|
234
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$id": "canon:AgentBehaviorSettingsRecordSchema",
|
|
3
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"participationStyle": {
|
|
7
|
-
"type": "string",
|
|
8
|
-
"enum": [
|
|
9
|
-
"natural",
|
|
10
|
-
"collaborative",
|
|
11
|
-
"mention-first",
|
|
12
|
-
"approval-gated",
|
|
13
|
-
"handoff-only",
|
|
14
|
-
"observer"
|
|
15
|
-
]
|
|
16
|
-
},
|
|
17
|
-
"allowAgentToAgent": {
|
|
18
|
-
"type": "boolean"
|
|
19
|
-
},
|
|
20
|
-
"allowLongRunningCollaboration": {
|
|
21
|
-
"type": "boolean"
|
|
22
|
-
},
|
|
23
|
-
"requireMentionForGroupReplies": {
|
|
24
|
-
"type": "boolean"
|
|
25
|
-
},
|
|
26
|
-
"maxConsecutiveAgentTurns": {
|
|
27
|
-
"anyOf": [
|
|
28
|
-
{
|
|
29
|
-
"type": "number"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"type": "null"
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
},
|
|
36
|
-
"instructions": {
|
|
37
|
-
"anyOf": [
|
|
38
|
-
{
|
|
39
|
-
"type": "string"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"type": "null"
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"additionalProperties": false
|
|
48
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$id": "canon:BridgeConnectionStateNotificationSchema",
|
|
3
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"upstream": {
|
|
7
|
-
"type": "string",
|
|
8
|
-
"enum": [
|
|
9
|
-
"connected",
|
|
10
|
-
"reconnecting",
|
|
11
|
-
"down"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"required": [
|
|
16
|
-
"upstream"
|
|
17
|
-
],
|
|
18
|
-
"additionalProperties": false
|
|
19
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$id": "canon:BridgeGetAttachmentParamsSchema",
|
|
3
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"url": {
|
|
7
|
-
"type": "string"
|
|
8
|
-
},
|
|
9
|
-
"attachmentId": {
|
|
10
|
-
"type": "string"
|
|
11
|
-
},
|
|
12
|
-
"as": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"enum": [
|
|
15
|
-
"path",
|
|
16
|
-
"bytes"
|
|
17
|
-
]
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"required": [
|
|
21
|
-
"as"
|
|
22
|
-
],
|
|
23
|
-
"additionalProperties": false
|
|
24
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$id": "canon:BridgeGetAttachmentResultSchema",
|
|
3
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"path": {
|
|
7
|
-
"type": "string"
|
|
8
|
-
},
|
|
9
|
-
"bytes": {
|
|
10
|
-
"type": "string"
|
|
11
|
-
},
|
|
12
|
-
"mime": {
|
|
13
|
-
"type": "string"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"required": [
|
|
17
|
-
"mime"
|
|
18
|
-
],
|
|
19
|
-
"additionalProperties": false
|
|
20
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$id": "canon:BridgeHelloParamsSchema",
|
|
3
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"protocolVersion": {
|
|
7
|
-
"type": "number"
|
|
8
|
-
},
|
|
9
|
-
"clientType": {
|
|
10
|
-
"type": "string"
|
|
11
|
-
},
|
|
12
|
-
"wantFamilies": {
|
|
13
|
-
"type": "array",
|
|
14
|
-
"items": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"enum": [
|
|
17
|
-
"messages",
|
|
18
|
-
"contacts",
|
|
19
|
-
"typing_presence",
|
|
20
|
-
"runtime_turn",
|
|
21
|
-
"voice"
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"resumeCursor": {
|
|
26
|
-
"type": "string"
|
|
27
|
-
},
|
|
28
|
-
"runtimeDescriptor": {
|
|
29
|
-
"type": "object",
|
|
30
|
-
"propertyNames": {
|
|
31
|
-
"type": "string"
|
|
32
|
-
},
|
|
33
|
-
"additionalProperties": {}
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"required": [
|
|
37
|
-
"protocolVersion",
|
|
38
|
-
"clientType",
|
|
39
|
-
"wantFamilies"
|
|
40
|
-
],
|
|
41
|
-
"additionalProperties": false
|
|
42
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$id": "canon:BridgeHelloResultSchema",
|
|
3
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"protocolVersion": {
|
|
7
|
-
"type": "number"
|
|
8
|
-
},
|
|
9
|
-
"agentId": {
|
|
10
|
-
"type": "string"
|
|
11
|
-
},
|
|
12
|
-
"agentName": {
|
|
13
|
-
"type": "string"
|
|
14
|
-
},
|
|
15
|
-
"agentContext": {
|
|
16
|
-
"type": "object",
|
|
17
|
-
"properties": {
|
|
18
|
-
"agentId": {
|
|
19
|
-
"type": "string"
|
|
20
|
-
},
|
|
21
|
-
"canonContactId": {
|
|
22
|
-
"type": "string"
|
|
23
|
-
},
|
|
24
|
-
"clientType": {
|
|
25
|
-
"type": "string"
|
|
26
|
-
},
|
|
27
|
-
"ownerId": {
|
|
28
|
-
"type": "string"
|
|
29
|
-
},
|
|
30
|
-
"ownerName": {
|
|
31
|
-
"type": "string"
|
|
32
|
-
},
|
|
33
|
-
"defaultBehavior": {
|
|
34
|
-
"type": "object",
|
|
35
|
-
"propertyNames": {
|
|
36
|
-
"type": "string"
|
|
37
|
-
},
|
|
38
|
-
"additionalProperties": {}
|
|
39
|
-
},
|
|
40
|
-
"inboundPolicy": {
|
|
41
|
-
"type": "string",
|
|
42
|
-
"enum": [
|
|
43
|
-
"open",
|
|
44
|
-
"approval-required",
|
|
45
|
-
"owner-only"
|
|
46
|
-
]
|
|
47
|
-
},
|
|
48
|
-
"groupJoinPolicy": {
|
|
49
|
-
"type": "string",
|
|
50
|
-
"enum": [
|
|
51
|
-
"open",
|
|
52
|
-
"approval-required",
|
|
53
|
-
"owner-only"
|
|
54
|
-
]
|
|
55
|
-
},
|
|
56
|
-
"discoverable": {
|
|
57
|
-
"type": "boolean"
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"required": [
|
|
61
|
-
"agentId",
|
|
62
|
-
"ownerId",
|
|
63
|
-
"ownerName",
|
|
64
|
-
"inboundPolicy",
|
|
65
|
-
"groupJoinPolicy",
|
|
66
|
-
"discoverable"
|
|
67
|
-
],
|
|
68
|
-
"additionalProperties": {}
|
|
69
|
-
},
|
|
70
|
-
"sinceCursor": {
|
|
71
|
-
"anyOf": [
|
|
72
|
-
{
|
|
73
|
-
"type": "string"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"type": "null"
|
|
77
|
-
}
|
|
78
|
-
]
|
|
79
|
-
},
|
|
80
|
-
"resync": {
|
|
81
|
-
"type": "object",
|
|
82
|
-
"properties": {
|
|
83
|
-
"reason": {
|
|
84
|
-
"type": "string",
|
|
85
|
-
"enum": [
|
|
86
|
-
"cursor-expired",
|
|
87
|
-
"unknown-cursor"
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
"required": [
|
|
92
|
-
"reason"
|
|
93
|
-
],
|
|
94
|
-
"additionalProperties": false
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
"required": [
|
|
98
|
-
"protocolVersion",
|
|
99
|
-
"agentId",
|
|
100
|
-
"agentName",
|
|
101
|
-
"agentContext",
|
|
102
|
-
"sinceCursor"
|
|
103
|
-
],
|
|
104
|
-
"additionalProperties": false
|
|
105
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$id": "canon:BridgeHitlStateSchema",
|
|
3
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"status": {
|
|
7
|
-
"anyOf": [
|
|
8
|
-
{
|
|
9
|
-
"type": "string",
|
|
10
|
-
"const": "pending"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"type": "string",
|
|
14
|
-
"enum": [
|
|
15
|
-
"submitted",
|
|
16
|
-
"cancelled",
|
|
17
|
-
"timeout"
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
},
|
|
22
|
-
"answer": {
|
|
23
|
-
"type": "object",
|
|
24
|
-
"propertyNames": {
|
|
25
|
-
"type": "string"
|
|
26
|
-
},
|
|
27
|
-
"additionalProperties": {}
|
|
28
|
-
},
|
|
29
|
-
"expiresAt": {
|
|
30
|
-
"type": "string"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"required": [
|
|
34
|
-
"status",
|
|
35
|
-
"expiresAt"
|
|
36
|
-
],
|
|
37
|
-
"additionalProperties": false
|
|
38
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$id": "canon:BridgeOkResultSchema",
|
|
3
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"ok": {
|
|
7
|
-
"type": "boolean",
|
|
8
|
-
"const": true
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
"required": [
|
|
12
|
-
"ok"
|
|
13
|
-
],
|
|
14
|
-
"additionalProperties": false
|
|
15
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$id": "canon:BridgePublishStreamingEventParamsSchema",
|
|
3
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"conversationId": {
|
|
7
|
-
"type": "string"
|
|
8
|
-
},
|
|
9
|
-
"turnId": {
|
|
10
|
-
"anyOf": [
|
|
11
|
-
{
|
|
12
|
-
"type": "string"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"type": "null"
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
"messageId": {
|
|
20
|
-
"type": "string"
|
|
21
|
-
},
|
|
22
|
-
"event": {
|
|
23
|
-
"oneOf": [
|
|
24
|
-
{
|
|
25
|
-
"type": "object",
|
|
26
|
-
"properties": {
|
|
27
|
-
"kind": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"const": "text"
|
|
30
|
-
},
|
|
31
|
-
"id": {
|
|
32
|
-
"type": "string"
|
|
33
|
-
},
|
|
34
|
-
"mode": {
|
|
35
|
-
"type": "string",
|
|
36
|
-
"enum": [
|
|
37
|
-
"append",
|
|
38
|
-
"replace"
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
"text": {
|
|
42
|
-
"type": "string"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"required": [
|
|
46
|
-
"kind",
|
|
47
|
-
"id",
|
|
48
|
-
"mode",
|
|
49
|
-
"text"
|
|
50
|
-
],
|
|
51
|
-
"additionalProperties": false
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"type": "object",
|
|
55
|
-
"properties": {
|
|
56
|
-
"kind": {
|
|
57
|
-
"type": "string",
|
|
58
|
-
"const": "tool"
|
|
59
|
-
},
|
|
60
|
-
"id": {
|
|
61
|
-
"type": "string"
|
|
62
|
-
},
|
|
63
|
-
"status": {
|
|
64
|
-
"type": "string",
|
|
65
|
-
"enum": [
|
|
66
|
-
"running",
|
|
67
|
-
"completed",
|
|
68
|
-
"failed"
|
|
69
|
-
]
|
|
70
|
-
},
|
|
71
|
-
"title": {
|
|
72
|
-
"type": "string"
|
|
73
|
-
},
|
|
74
|
-
"summary": {
|
|
75
|
-
"type": "string"
|
|
76
|
-
},
|
|
77
|
-
"detail": {
|
|
78
|
-
"type": "string"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
"required": [
|
|
82
|
-
"kind",
|
|
83
|
-
"id"
|
|
84
|
-
],
|
|
85
|
-
"additionalProperties": false
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"type": "object",
|
|
89
|
-
"properties": {
|
|
90
|
-
"kind": {
|
|
91
|
-
"type": "string",
|
|
92
|
-
"const": "thinking"
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
"required": [
|
|
96
|
-
"kind"
|
|
97
|
-
],
|
|
98
|
-
"additionalProperties": false
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"type": "object",
|
|
102
|
-
"properties": {
|
|
103
|
-
"kind": {
|
|
104
|
-
"type": "string",
|
|
105
|
-
"const": "final"
|
|
106
|
-
},
|
|
107
|
-
"text": {
|
|
108
|
-
"type": "string"
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
"required": [
|
|
112
|
-
"kind",
|
|
113
|
-
"text"
|
|
114
|
-
],
|
|
115
|
-
"additionalProperties": false
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
"type": "object",
|
|
119
|
-
"properties": {
|
|
120
|
-
"kind": {
|
|
121
|
-
"type": "string",
|
|
122
|
-
"const": "clear"
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
"required": [
|
|
126
|
-
"kind"
|
|
127
|
-
],
|
|
128
|
-
"additionalProperties": false
|
|
129
|
-
}
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
"required": [
|
|
134
|
-
"conversationId",
|
|
135
|
-
"event"
|
|
136
|
-
],
|
|
137
|
-
"additionalProperties": false
|
|
138
|
-
}
|