@canonmsg/backend-contracts 1.8.1 → 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 -1729
- package/dist/bridgeLocal.js +0 -673
- package/dist/cjs/bridgeLocal.js +0 -676
- package/dist/cjs/controlSignals.js +0 -44
- package/dist/cjs/endpointRegistry.js +0 -264
- package/dist/cjs/hitl.js +0 -0
- 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 -298
- 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-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-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 -42
- package/dist/schemas/sse-event-family.schema.json +0 -12
- package/dist/schemas/sse-event-type.schema.json +0 -28
- 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-runtime-updated-payload.schema.json +0 -78
- package/dist/schemas/sse-self-context.schema.json +0 -45
- package/dist/schemas/sse-turn-dispatch.schema.json +0 -29
- package/dist/schemas/sse-turn-updated-payload.schema.json +0 -33
- 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 -494
- package/dist/sseEvents.js +0 -295
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ControlPrimitiveEventSchema = exports.ControlSessionEventSchema = exports.ControlSignalEventSchema = exports.ControlPrimitiveMapSchema = exports.ControlSessionNodeSchema = exports.ControlSignalNodeSchema = exports.ControlChannelKeySchema = exports.ControlSignalTypeSchema = void 0;
|
|
4
|
-
// Wire contract v1 — RTDB control-channel signal + session-control records.
|
|
5
|
-
//
|
|
6
|
-
// Grounded in @canonmsg/core's ControlChannelPoller (the consumer every host
|
|
7
|
-
// uses for `/control/{conversationId}/{agentId}` reads) and stream-service's
|
|
8
|
-
// `runtime.control` mirror. Three channel keys, read in order:
|
|
9
|
-
// session — human changed a runtime control (model/effort/permission …)
|
|
10
|
-
// signal — interrupt / stop_and_drop / new_session
|
|
11
|
-
// primitive — keyed request map (requestId → value)
|
|
12
|
-
const zod_1 = require("zod");
|
|
13
|
-
exports.ControlSignalTypeSchema = zod_1.z.enum(['interrupt', 'stop_and_drop', 'new_session']);
|
|
14
|
-
exports.ControlChannelKeySchema = zod_1.z.enum(['session', 'signal', 'primitive']);
|
|
15
|
-
// ── RTDB node records (what is written at /control/{convo}/{agent}/…) ──
|
|
16
|
-
/** `/control/{convo}/{agent}/signal` node. Consumed by writing null. */
|
|
17
|
-
exports.ControlSignalNodeSchema = zod_1.z.looseObject({
|
|
18
|
-
type: exports.ControlSignalTypeSchema,
|
|
19
|
-
updatedAt: zod_1.z.number().optional(),
|
|
20
|
-
});
|
|
21
|
-
/** `/control/{convo}/{agent}/session` node — the session-control primitive record. */
|
|
22
|
-
exports.ControlSessionNodeSchema = zod_1.z.looseObject({
|
|
23
|
-
updatedAt: zod_1.z.number().optional(),
|
|
24
|
-
});
|
|
25
|
-
/** `/control/{convo}/{agent}/primitive` — map of requestId → request value. */
|
|
26
|
-
exports.ControlPrimitiveMapSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()));
|
|
27
|
-
// ── Dispatched events (what a runtime's handler receives) ──────────────
|
|
28
|
-
exports.ControlSignalEventSchema = zod_1.z.object({
|
|
29
|
-
conversationId: zod_1.z.string(),
|
|
30
|
-
type: exports.ControlSignalTypeSchema,
|
|
31
|
-
updatedAt: zod_1.z.number(),
|
|
32
|
-
raw: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
33
|
-
});
|
|
34
|
-
exports.ControlSessionEventSchema = zod_1.z.object({
|
|
35
|
-
conversationId: zod_1.z.string(),
|
|
36
|
-
updatedAt: zod_1.z.number(),
|
|
37
|
-
control: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
38
|
-
});
|
|
39
|
-
exports.ControlPrimitiveEventSchema = zod_1.z.object({
|
|
40
|
-
conversationId: zod_1.z.string(),
|
|
41
|
-
requestId: zod_1.z.string(),
|
|
42
|
-
updatedAt: zod_1.z.number(),
|
|
43
|
-
value: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
44
|
-
});
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CANON_MEDIA_UPLOAD_ENDPOINT = exports.CANON_REST_ENDPOINTS = void 0;
|
|
4
|
-
const restEndpoints_js_1 = require("./restEndpoints.js");
|
|
5
|
-
const sendContextual_js_1 = require("./sendContextual.js");
|
|
6
|
-
exports.CANON_REST_ENDPOINTS = [
|
|
7
|
-
// ── Identity ─────────────────────────────────────────────────────────
|
|
8
|
-
{
|
|
9
|
-
method: 'POST',
|
|
10
|
-
path: '/agents/register',
|
|
11
|
-
section: 'identity',
|
|
12
|
-
note: 'Public registration request. No API key required.',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
method: 'GET',
|
|
16
|
-
path: '/agents/status/:requestId',
|
|
17
|
-
section: 'identity',
|
|
18
|
-
note: 'Poll approval status. Requires `x-canon-poll-token` with the `pollToken` returned by registration. After approval, the response includes the `apiKey` plaintext until the request is acknowledged.',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
method: 'POST',
|
|
22
|
-
path: '/agents/status/:requestId/ack',
|
|
23
|
-
section: 'identity',
|
|
24
|
-
note: 'Acknowledge delivery. Requires `x-canon-poll-token`; clears the plaintext key from the registration request record so subsequent GET reads return `apiKeyDelivered: true`. Unacked plaintext keys are also auto-scrubbed 48 hours after approval; subsequent GET reads then return `apiKeyExpired: true` and the registrant must re-register (or the owner re-issues via key rotation).',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
method: 'GET',
|
|
28
|
-
path: '/agents/me',
|
|
29
|
-
section: 'identity',
|
|
30
|
-
note: 'Authenticated agent identity and context.',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
method: 'PATCH',
|
|
34
|
-
path: '/agents/profile',
|
|
35
|
-
section: 'identity',
|
|
36
|
-
note: 'Update agent profile fields.',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
method: 'POST',
|
|
40
|
-
path: '/agents/auth-token',
|
|
41
|
-
section: 'identity',
|
|
42
|
-
note: 'Exchange API key for live agent-channel access when needed.',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
method: 'POST',
|
|
46
|
-
path: '/agents/keys/rotate',
|
|
47
|
-
section: 'identity',
|
|
48
|
-
note: 'Agent-initiated key rotation. Returns the new plaintext key once.',
|
|
49
|
-
},
|
|
50
|
-
// ── Messaging ────────────────────────────────────────────────────────
|
|
51
|
-
{
|
|
52
|
-
method: 'POST',
|
|
53
|
-
path: '/messages/send',
|
|
54
|
-
section: 'messaging',
|
|
55
|
-
note: 'Send a durable message into a conversation.',
|
|
56
|
-
request: restEndpoints_js_1.SendMessageRequestSchema,
|
|
57
|
-
response: restEndpoints_js_1.SendMessageResponseSchema,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
method: 'POST',
|
|
61
|
-
path: '/messages/send-contextual',
|
|
62
|
-
section: 'messaging',
|
|
63
|
-
note: 'Cross-conversation message with private agent self-context.',
|
|
64
|
-
request: sendContextual_js_1.SendContextualRequestSchema,
|
|
65
|
-
response: sendContextual_js_1.SendContextualResponseSchema,
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
method: 'POST',
|
|
69
|
-
path: '/messages/react',
|
|
70
|
-
section: 'messaging',
|
|
71
|
-
note: 'Toggle an emoji reaction.',
|
|
72
|
-
request: restEndpoints_js_1.ReactRequestSchema,
|
|
73
|
-
response: restEndpoints_js_1.ReactResponseSchema,
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
method: 'POST',
|
|
77
|
-
path: '/messages/forward',
|
|
78
|
-
section: 'messaging',
|
|
79
|
-
note: 'Forward an existing message.',
|
|
80
|
-
request: restEndpoints_js_1.ForwardMessageRequestSchema,
|
|
81
|
-
response: restEndpoints_js_1.ForwardMessageResponseSchema,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
method: 'DELETE',
|
|
85
|
-
path: '/conversations/:conversationId/messages/:messageId',
|
|
86
|
-
section: 'messaging',
|
|
87
|
-
note: "Soft-delete the agent's own message.",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
method: 'PATCH',
|
|
91
|
-
path: '/conversations/:conversationId/messages/:messageId/disposition',
|
|
92
|
-
section: 'messaging',
|
|
93
|
-
note: 'Update message disposition metadata.',
|
|
94
|
-
request: restEndpoints_js_1.UpdateDispositionRequestSchema,
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
method: 'POST',
|
|
98
|
-
path: '/typing',
|
|
99
|
-
section: 'messaging',
|
|
100
|
-
note: 'Publish typing state.',
|
|
101
|
-
request: restEndpoints_js_1.SetTypingRequestSchema,
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
method: 'POST',
|
|
105
|
-
path: '/streaming',
|
|
106
|
-
section: 'messaging',
|
|
107
|
-
note: 'Publish live streaming/progress state through REST. Most current runtimes prefer shared live-state helpers.',
|
|
108
|
-
request: restEndpoints_js_1.SetStreamingRequestSchema,
|
|
109
|
-
},
|
|
110
|
-
// ── Conversations ────────────────────────────────────────────────────
|
|
111
|
-
{
|
|
112
|
-
method: 'GET',
|
|
113
|
-
path: '/conversations',
|
|
114
|
-
section: 'conversations',
|
|
115
|
-
note: 'List conversations the agent participates in.',
|
|
116
|
-
response: restEndpoints_js_1.ConversationsResponseSchema,
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
method: 'GET',
|
|
120
|
-
path: '/conversations/:conversationId/messages',
|
|
121
|
-
section: 'conversations',
|
|
122
|
-
note: 'Fetch recent messages.',
|
|
123
|
-
request: restEndpoints_js_1.GetMessagesQuerySchema,
|
|
124
|
-
response: restEndpoints_js_1.MessagesPageResponseSchema,
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
method: 'POST',
|
|
128
|
-
path: '/conversations/create',
|
|
129
|
-
section: 'conversations',
|
|
130
|
-
note: 'Create or find a direct/group conversation when allowed.',
|
|
131
|
-
request: restEndpoints_js_1.CreateConversationRequestSchema,
|
|
132
|
-
response: restEndpoints_js_1.CreateConversationResponseSchema,
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
method: 'PATCH',
|
|
136
|
-
path: '/conversations/:conversationId/topic',
|
|
137
|
-
section: 'conversations',
|
|
138
|
-
note: 'Update the topic.',
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
method: 'PATCH',
|
|
142
|
-
path: '/conversations/:conversationId/name',
|
|
143
|
-
section: 'conversations',
|
|
144
|
-
note: 'Update group name when allowed.',
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
method: 'PATCH',
|
|
148
|
-
path: '/conversations/:conversationId/avatar',
|
|
149
|
-
section: 'conversations',
|
|
150
|
-
note: 'Update group avatar when allowed.',
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
method: 'POST',
|
|
154
|
-
path: '/conversations/:conversationId/read',
|
|
155
|
-
section: 'conversations',
|
|
156
|
-
note: 'Mark read.',
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
method: 'POST',
|
|
160
|
-
path: '/conversations/:conversationId/mute',
|
|
161
|
-
section: 'conversations',
|
|
162
|
-
note: 'Mute for the agent.',
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
method: 'POST',
|
|
166
|
-
path: '/conversations/:conversationId/unmute',
|
|
167
|
-
section: 'conversations',
|
|
168
|
-
note: 'Unmute for the agent.',
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
method: 'POST',
|
|
172
|
-
path: '/conversations/:conversationId/hide',
|
|
173
|
-
section: 'conversations',
|
|
174
|
-
note: 'Hide until new inbound activity.',
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
method: 'POST',
|
|
178
|
-
path: '/conversations/:conversationId/leave',
|
|
179
|
-
section: 'conversations',
|
|
180
|
-
note: 'Leave a group.',
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
method: 'POST',
|
|
184
|
-
path: '/conversations/:conversationId/members',
|
|
185
|
-
section: 'conversations',
|
|
186
|
-
note: 'Add a member when allowed.',
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
method: 'DELETE',
|
|
190
|
-
path: '/conversations/:conversationId/members/:userId',
|
|
191
|
-
section: 'conversations',
|
|
192
|
-
note: 'Remove a member when allowed.',
|
|
193
|
-
},
|
|
194
|
-
// ── Contacts and access ──────────────────────────────────────────────
|
|
195
|
-
{
|
|
196
|
-
method: 'POST',
|
|
197
|
-
path: '/contacts/request',
|
|
198
|
-
section: 'contacts',
|
|
199
|
-
note: 'Agent-side request for access.',
|
|
200
|
-
request: restEndpoints_js_1.CreateContactRequestRequestSchema,
|
|
201
|
-
response: restEndpoints_js_1.CreateContactRequestResponseSchema,
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
method: 'GET',
|
|
205
|
-
path: '/contacts/requests',
|
|
206
|
-
section: 'contacts',
|
|
207
|
-
note: 'Read-only awareness surface for requests involving the agent.',
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
method: 'GET',
|
|
211
|
-
path: '/contacts',
|
|
212
|
-
section: 'contacts',
|
|
213
|
-
note: "List the authenticated agent's contacts.",
|
|
214
|
-
response: restEndpoints_js_1.ContactsResponseSchema,
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
method: 'GET',
|
|
218
|
-
path: '/contacts/:contactId',
|
|
219
|
-
section: 'contacts',
|
|
220
|
-
note: 'Fetch a single contact entry; 404 if missing.',
|
|
221
|
-
response: restEndpoints_js_1.RestContactSchema,
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
method: 'DELETE',
|
|
225
|
-
path: '/contacts/:contactId',
|
|
226
|
-
section: 'contacts',
|
|
227
|
-
note: 'Remove a contact.',
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
method: 'POST',
|
|
231
|
-
path: '/users/block',
|
|
232
|
-
section: 'contacts',
|
|
233
|
-
note: 'Block a user.',
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
method: 'POST',
|
|
237
|
-
path: '/users/unblock',
|
|
238
|
-
section: 'contacts',
|
|
239
|
-
note: 'Unblock a user.',
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
method: 'POST',
|
|
243
|
-
path: '/admission/resolve',
|
|
244
|
-
section: 'contacts',
|
|
245
|
-
note: 'Resolve live admission state for a target user (used by `agent.reachOut` and contact-card CTAs to avoid acting on stale snapshots).',
|
|
246
|
-
request: restEndpoints_js_1.ResolveAdmissionRequestSchema,
|
|
247
|
-
response: restEndpoints_js_1.ResolveAdmissionResponseSchema,
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
method: 'POST',
|
|
251
|
-
path: '/admission/resolve-group',
|
|
252
|
-
section: 'contacts',
|
|
253
|
-
note: 'Resolve live group-join admission state (reads `groupJoinPolicy`).',
|
|
254
|
-
},
|
|
255
|
-
];
|
|
256
|
-
// Referenced for completeness of the registry import surface.
|
|
257
|
-
exports.CANON_MEDIA_UPLOAD_ENDPOINT = {
|
|
258
|
-
method: 'POST',
|
|
259
|
-
path: '/media/upload',
|
|
260
|
-
section: 'messaging',
|
|
261
|
-
note: 'Upload media; returns a Storage URL plus a normalized attachment.',
|
|
262
|
-
request: restEndpoints_js_1.UploadMediaRequestSchema,
|
|
263
|
-
response: restEndpoints_js_1.UploadMediaResponseSchema,
|
|
264
|
-
};
|
package/dist/cjs/hitl.js
DELETED
|
File without changes
|
package/dist/cjs/inboundFrame.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InboundFrameV1Schema = exports.InboundFrameGroupContextV1Schema = exports.InboundFrameReplyContextV1Schema = exports.InboundFrameContactCardV1Schema = exports.InboundFrameAttachmentV1Schema = exports.InboundFrameShapeV1Schema = exports.INBOUND_FRAME_SCHEMA_V1 = void 0;
|
|
4
|
-
// Wire contract v1 — the canon.inbound_frame.v1 schema.
|
|
5
|
-
//
|
|
6
|
-
// Mirrors @canonmsg/core's CanonInboundFrameV1 (core/src/inbound-frame.ts),
|
|
7
|
-
// the structured projection every host/adapter renders its inbound prompt
|
|
8
|
-
// from. core keeps building the frame; a follow-up (post-P2 merge) flips core
|
|
9
|
-
// to infer its type from this schema. A compile-time assignability guard
|
|
10
|
-
// between core's type and this schema lives in @canonmsg/test-fixtures.
|
|
11
|
-
const zod_1 = require("zod");
|
|
12
|
-
const message_js_1 = require("./message.js");
|
|
13
|
-
const sseEvents_js_1 = require("./sseEvents.js");
|
|
14
|
-
exports.INBOUND_FRAME_SCHEMA_V1 = 'canon.inbound_frame.v1';
|
|
15
|
-
exports.InboundFrameShapeV1Schema = zod_1.z.enum([
|
|
16
|
-
'direct_owner',
|
|
17
|
-
'direct_human',
|
|
18
|
-
'direct_agent',
|
|
19
|
-
'group',
|
|
20
|
-
'unknown',
|
|
21
|
-
]);
|
|
22
|
-
exports.InboundFrameAttachmentV1Schema = zod_1.z.object({
|
|
23
|
-
index: zod_1.z.number(),
|
|
24
|
-
kind: zod_1.z.enum(['image', 'audio', 'video', 'file']),
|
|
25
|
-
placeholder: zod_1.z.string(),
|
|
26
|
-
fileName: zod_1.z.string().nullable(),
|
|
27
|
-
mimeType: zod_1.z.string().nullable(),
|
|
28
|
-
sizeBytes: zod_1.z.number().nullable(),
|
|
29
|
-
width: zod_1.z.number().nullable(),
|
|
30
|
-
height: zod_1.z.number().nullable(),
|
|
31
|
-
durationMs: zod_1.z.number().nullable(),
|
|
32
|
-
});
|
|
33
|
-
exports.InboundFrameContactCardV1Schema = zod_1.z.object({
|
|
34
|
-
userId: zod_1.z.string(),
|
|
35
|
-
canonContactId: zod_1.z.string().nullable(),
|
|
36
|
-
displayName: zod_1.z.string(),
|
|
37
|
-
userType: zod_1.z.enum(['human', 'ai_agent']),
|
|
38
|
-
ownerName: zod_1.z.string().nullable(),
|
|
39
|
-
about: zod_1.z.string().nullable(),
|
|
40
|
-
});
|
|
41
|
-
/** CanonTurnContextReplyContextV2 — the reply-to summary carried by the frame. */
|
|
42
|
-
exports.InboundFrameReplyContextV1Schema = zod_1.z.object({
|
|
43
|
-
messageId: zod_1.z.string(),
|
|
44
|
-
found: zod_1.z.boolean(),
|
|
45
|
-
senderId: zod_1.z.string().nullable(),
|
|
46
|
-
senderName: zod_1.z.string().nullable(),
|
|
47
|
-
senderType: zod_1.z.enum(['human', 'ai_agent']).nullable(),
|
|
48
|
-
contentType: message_js_1.SerializedContentTypeSchema.nullable(),
|
|
49
|
-
text: zod_1.z.string().nullable(),
|
|
50
|
-
body: zod_1.z.string(),
|
|
51
|
-
replyToPosition: zod_1.z.number().nullable(),
|
|
52
|
-
attachments: zod_1.z.array(exports.InboundFrameAttachmentV1Schema),
|
|
53
|
-
contactCard: exports.InboundFrameContactCardV1Schema.nullable(),
|
|
54
|
-
});
|
|
55
|
-
exports.InboundFrameGroupContextV1Schema = zod_1.z.object({
|
|
56
|
-
memberCount: zod_1.z.number(),
|
|
57
|
-
memberIds: zod_1.z.array(zod_1.z.string()),
|
|
58
|
-
ownerId: zod_1.z.string(),
|
|
59
|
-
ownerName: zod_1.z.string(),
|
|
60
|
-
ownerPresent: zod_1.z.boolean(),
|
|
61
|
-
knownRecentParticipants: zod_1.z.array(zod_1.z.object({
|
|
62
|
-
id: zod_1.z.string(),
|
|
63
|
-
name: zod_1.z.string(),
|
|
64
|
-
userType: zod_1.z.enum(['human', 'ai_agent', 'unknown']),
|
|
65
|
-
isOwner: zod_1.z.boolean(),
|
|
66
|
-
isSelf: zod_1.z.boolean(),
|
|
67
|
-
})),
|
|
68
|
-
membershipChange: sseEvents_js_1.SseMembershipChangeSchema.optional(),
|
|
69
|
-
});
|
|
70
|
-
exports.InboundFrameV1Schema = zod_1.z.object({
|
|
71
|
-
schema: zod_1.z.literal(exports.INBOUND_FRAME_SCHEMA_V1),
|
|
72
|
-
shape: exports.InboundFrameShapeV1Schema,
|
|
73
|
-
sender: zod_1.z.object({
|
|
74
|
-
name: zod_1.z.string(),
|
|
75
|
-
type: zod_1.z.enum(['human', 'ai_agent']),
|
|
76
|
-
isOwner: zod_1.z.boolean(),
|
|
77
|
-
}),
|
|
78
|
-
conversation: zod_1.z.object({
|
|
79
|
-
type: zod_1.z.enum(['direct', 'group', 'unknown']),
|
|
80
|
-
memberCount: zod_1.z.number().nullable(),
|
|
81
|
-
}),
|
|
82
|
-
addressed: zod_1.z.boolean(),
|
|
83
|
-
message: zod_1.z.object({
|
|
84
|
-
text: zod_1.z.string(),
|
|
85
|
-
contentType: message_js_1.SerializedContentTypeSchema.nullable(),
|
|
86
|
-
}),
|
|
87
|
-
replyContext: exports.InboundFrameReplyContextV1Schema.nullable(),
|
|
88
|
-
groupContext: exports.InboundFrameGroupContextV1Schema.nullable(),
|
|
89
|
-
groupContextMode: zod_1.z.enum(['initial', 'membership_change']).optional(),
|
|
90
|
-
selfContexts: zod_1.z.array(zod_1.z.string()),
|
|
91
|
-
behaviorInstructions: zod_1.z.array(zod_1.z.string()),
|
|
92
|
-
});
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UploadMediaResponseSchema = exports.UploadMediaRequestSchema = exports.SetStreamingRequestSchema = exports.SetTypingRequestSchema = exports.ResolveAdmissionResponseSchema = exports.ResolveAdmissionRequestSchema = exports.ContactsResponseSchema = exports.CreateContactRequestResponseSchema = exports.CreateContactRequestRequestSchema = exports.CreateConversationResponseSchema = exports.CreateConversationRequestSchema = exports.MessagesPageResponseSchema = exports.GetMessagesQuerySchema = exports.ConversationsResponseSchema = exports.UpdateDispositionRequestSchema = exports.MarkReadResponseSchema = exports.DeleteMessageResponseSchema = exports.ForwardMessageResponseSchema = exports.ForwardMessageRequestSchema = exports.ReactResponseSchema = exports.ReactRequestSchema = exports.SendMessageResponseSchema = exports.SendMessageRequestSchema = exports.RestSessionSelectionSchema = exports.RestContactSchema = exports.RestConversationSchema = exports.RestConversationLastMessageSchema = exports.RestMessageSchema = exports.RestOkResponseSchema = void 0;
|
|
4
|
-
// Wire contract v1 — request/response schemas for the agent-facing "Canon op"
|
|
5
|
-
// REST surface the bridge proxies (bridge-local-api.md §B).
|
|
6
|
-
//
|
|
7
|
-
// Grounded in the Functions handlers (functions/src/api/*) and the canonical
|
|
8
|
-
// consumer (@canonmsg/core CanonClient) — request bodies mirror what clients
|
|
9
|
-
// send today, response schemas mirror what the handlers emit. This is a
|
|
10
|
-
// re-expression of current behavior, not a redesign.
|
|
11
|
-
const zod_1 = require("zod");
|
|
12
|
-
const media_js_1 = require("./media.js");
|
|
13
|
-
const message_js_1 = require("./message.js");
|
|
14
|
-
const turnProtocol_js_1 = require("./turnProtocol.js");
|
|
15
|
-
// ── Shared fragments ───────────────────────────────────────────────────
|
|
16
|
-
exports.RestOkResponseSchema = zod_1.z.looseObject({
|
|
17
|
-
success: zod_1.z.boolean().optional(),
|
|
18
|
-
});
|
|
19
|
-
/** GET …/messages items — the serialized message plus the soft-delete flag. */
|
|
20
|
-
exports.RestMessageSchema = message_js_1.SerializedMessageSchema.extend({
|
|
21
|
-
deleted: zod_1.z.boolean().optional(),
|
|
22
|
-
});
|
|
23
|
-
/**
|
|
24
|
-
* STRICT WRITES, TOLERANT READS: this is a READ schema over live production
|
|
25
|
-
* data, so it must describe what Firestore actually holds — not what today's
|
|
26
|
-
* writers produce. The GET /conversations serializer
|
|
27
|
-
* (functions/src/api/getConversations.ts) passes `lastMessage` fields through
|
|
28
|
-
* from the conversation doc, and legacy rows (pre-refactor writes,
|
|
29
|
-
* deleted-message repair) hold explicit nulls:
|
|
30
|
-
* - `text` is serialized `?? null` and `timestamp` as
|
|
31
|
-
* `?.toDate?.()?.toISOString() ?? null` — both emit null by construction.
|
|
32
|
-
* - `senderId` / `senderType` / `contentType` are raw pass-throughs; live
|
|
33
|
-
* rows exist with all three null (the getConversations "ghost fix" comment
|
|
34
|
-
* acknowledges null senderId).
|
|
35
|
-
* - conversation `createdAt` is also serialized `?? null`.
|
|
36
|
-
* Writers (onMessageCreated / deletedMessageRepair) stay strict — they always
|
|
37
|
-
* produce the full shape; only the read contract admits the legacy nulls.
|
|
38
|
-
*/
|
|
39
|
-
exports.RestConversationLastMessageSchema = zod_1.z.looseObject({
|
|
40
|
-
text: zod_1.z.string().nullable(),
|
|
41
|
-
messageId: zod_1.z.string().optional(),
|
|
42
|
-
senderId: zod_1.z.string().nullable().optional(),
|
|
43
|
-
senderType: zod_1.z.enum(['human', 'ai_agent']).nullable().optional(),
|
|
44
|
-
contentType: message_js_1.SerializedContentTypeSchema.nullable().optional(),
|
|
45
|
-
timestamp: zod_1.z.string().nullable(),
|
|
46
|
-
});
|
|
47
|
-
exports.RestConversationSchema = zod_1.z.looseObject({
|
|
48
|
-
id: zod_1.z.string(),
|
|
49
|
-
type: zod_1.z.enum(['direct', 'group']),
|
|
50
|
-
name: zod_1.z.string().nullable().optional(),
|
|
51
|
-
topic: zod_1.z.string().nullable().optional(),
|
|
52
|
-
memberIds: zod_1.z.array(zod_1.z.string()),
|
|
53
|
-
isAgentChat: zod_1.z.boolean().optional(),
|
|
54
|
-
/** Resolved agent behavior policy — opaque pass-through. */
|
|
55
|
-
behavior: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
56
|
-
hasUnread: zod_1.z.boolean().optional(),
|
|
57
|
-
lastMessage: exports.RestConversationLastMessageSchema.nullable(),
|
|
58
|
-
createdAt: zod_1.z.string().nullable().optional(),
|
|
59
|
-
});
|
|
60
|
-
exports.RestContactSchema = zod_1.z.object({
|
|
61
|
-
id: zod_1.z.string(),
|
|
62
|
-
source: zod_1.z.string(),
|
|
63
|
-
addedAt: zod_1.z.string().nullable(),
|
|
64
|
-
displayNameOverride: zod_1.z.string().nullable(),
|
|
65
|
-
});
|
|
66
|
-
exports.RestSessionSelectionSchema = zod_1.z.union([
|
|
67
|
-
zod_1.z.object({ mode: zod_1.z.enum(['new', 'continue_latest', 'continue_or_create']) }),
|
|
68
|
-
zod_1.z.object({ mode: zod_1.z.literal('specific'), conversationId: zod_1.z.string() }),
|
|
69
|
-
]);
|
|
70
|
-
// ── POST /messages/send ────────────────────────────────────────────────
|
|
71
|
-
exports.SendMessageRequestSchema = zod_1.z.object({
|
|
72
|
-
conversationId: zod_1.z.string(),
|
|
73
|
-
text: zod_1.z.string().optional(),
|
|
74
|
-
/** Client-supplied idempotency id. */
|
|
75
|
-
messageId: zod_1.z.string().optional(),
|
|
76
|
-
contentType: message_js_1.SerializedContentTypeSchema.optional(),
|
|
77
|
-
replyTo: zod_1.z.string().optional(),
|
|
78
|
-
replyToPosition: zod_1.z.number().optional(),
|
|
79
|
-
attachments: zod_1.z.array(media_js_1.MediaAttachmentSchema).optional(),
|
|
80
|
-
contactCardUserId: zod_1.z.string().optional(),
|
|
81
|
-
mentions: zod_1.z.array(zod_1.z.string()).optional(),
|
|
82
|
-
selfContextId: zod_1.z.string().nullable().optional(),
|
|
83
|
-
/** Structured metadata (turn protocol, approval cards, …). */
|
|
84
|
-
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
85
|
-
});
|
|
86
|
-
exports.SendMessageResponseSchema = zod_1.z.object({
|
|
87
|
-
messageId: zod_1.z.string(),
|
|
88
|
-
});
|
|
89
|
-
// ── POST /messages/react ───────────────────────────────────────────────
|
|
90
|
-
exports.ReactRequestSchema = zod_1.z.object({
|
|
91
|
-
conversationId: zod_1.z.string(),
|
|
92
|
-
messageId: zod_1.z.string(),
|
|
93
|
-
emoji: zod_1.z.string(),
|
|
94
|
-
});
|
|
95
|
-
exports.ReactResponseSchema = zod_1.z.object({
|
|
96
|
-
success: zod_1.z.boolean(),
|
|
97
|
-
action: zod_1.z.enum(['added', 'removed']),
|
|
98
|
-
reactions: message_js_1.SerializedReactionsSchema,
|
|
99
|
-
});
|
|
100
|
-
// ── POST /messages/forward ─────────────────────────────────────────────
|
|
101
|
-
exports.ForwardMessageRequestSchema = zod_1.z.object({
|
|
102
|
-
sourceConversationId: zod_1.z.string(),
|
|
103
|
-
targetConversationId: zod_1.z.string(),
|
|
104
|
-
messageId: zod_1.z.string(),
|
|
105
|
-
text: zod_1.z.string().optional(),
|
|
106
|
-
});
|
|
107
|
-
exports.ForwardMessageResponseSchema = zod_1.z.object({
|
|
108
|
-
messageId: zod_1.z.string(),
|
|
109
|
-
targetConversationId: zod_1.z.string(),
|
|
110
|
-
forwardedFrom: zod_1.z.object({
|
|
111
|
-
sourceConversationId: zod_1.z.string(),
|
|
112
|
-
messageId: zod_1.z.string(),
|
|
113
|
-
}),
|
|
114
|
-
});
|
|
115
|
-
// ── DELETE /conversations/:id/messages/:id, POST …/read, PATCH …/disposition ──
|
|
116
|
-
exports.DeleteMessageResponseSchema = exports.RestOkResponseSchema;
|
|
117
|
-
exports.MarkReadResponseSchema = exports.RestOkResponseSchema;
|
|
118
|
-
exports.UpdateDispositionRequestSchema = zod_1.z.object({
|
|
119
|
-
inboundDisposition: turnProtocol_js_1.InboundDispositionSchema,
|
|
120
|
-
});
|
|
121
|
-
// ── GET /conversations + GET …/messages ────────────────────────────────
|
|
122
|
-
exports.ConversationsResponseSchema = zod_1.z.object({
|
|
123
|
-
conversations: zod_1.z.array(exports.RestConversationSchema),
|
|
124
|
-
});
|
|
125
|
-
/** Query params: limit, before, includeBehavior. */
|
|
126
|
-
exports.GetMessagesQuerySchema = zod_1.z.object({
|
|
127
|
-
limit: zod_1.z.string().optional(),
|
|
128
|
-
before: zod_1.z.string().optional(),
|
|
129
|
-
includeBehavior: zod_1.z.string().optional(),
|
|
130
|
-
});
|
|
131
|
-
exports.MessagesPageResponseSchema = zod_1.z.looseObject({
|
|
132
|
-
messages: zod_1.z.array(exports.RestMessageSchema),
|
|
133
|
-
/** Present with includeBehavior=1. */
|
|
134
|
-
behavior: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
135
|
-
activeSelfContextIdByMessageId: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
|
136
|
-
selfContexts: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown())).optional(),
|
|
137
|
-
});
|
|
138
|
-
// ── POST /conversations/create ─────────────────────────────────────────
|
|
139
|
-
exports.CreateConversationRequestSchema = zod_1.z.object({
|
|
140
|
-
type: zod_1.z.enum(['direct', 'group']),
|
|
141
|
-
targetUserId: zod_1.z.string().optional(),
|
|
142
|
-
memberIds: zod_1.z.array(zod_1.z.string()).optional(),
|
|
143
|
-
name: zod_1.z.string().optional(),
|
|
144
|
-
/** Initial session config for first-party coding agents — opaque pass-through. */
|
|
145
|
-
sessionConfig: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable().optional(),
|
|
146
|
-
sessionSelection: exports.RestSessionSelectionSchema.optional(),
|
|
147
|
-
});
|
|
148
|
-
exports.CreateConversationResponseSchema = zod_1.z.object({
|
|
149
|
-
conversationId: zod_1.z.string(),
|
|
150
|
-
created: zod_1.z.boolean().optional(),
|
|
151
|
-
reused: zod_1.z.boolean().optional(),
|
|
152
|
-
sessionSelection: zod_1.z.enum(['new', 'continue_latest', 'continue_or_create', 'specific']).optional(),
|
|
153
|
-
});
|
|
154
|
-
// ── Contacts / admission ───────────────────────────────────────────────
|
|
155
|
-
exports.CreateContactRequestRequestSchema = zod_1.z.object({
|
|
156
|
-
targetId: zod_1.z.string(),
|
|
157
|
-
message: zod_1.z.string().optional(),
|
|
158
|
-
});
|
|
159
|
-
exports.CreateContactRequestResponseSchema = zod_1.z.union([
|
|
160
|
-
zod_1.z.looseObject({ status: zod_1.z.literal('open') }),
|
|
161
|
-
zod_1.z.looseObject({ status: zod_1.z.enum(['created', 'duplicate']), requestId: zod_1.z.string() }),
|
|
162
|
-
/** Legacy "already a contact" body. */
|
|
163
|
-
zod_1.z.looseObject({ message: zod_1.z.string() }),
|
|
164
|
-
]);
|
|
165
|
-
exports.ContactsResponseSchema = zod_1.z.object({
|
|
166
|
-
contacts: zod_1.z.array(exports.RestContactSchema),
|
|
167
|
-
});
|
|
168
|
-
exports.ResolveAdmissionRequestSchema = zod_1.z.union([
|
|
169
|
-
zod_1.z.object({ targetUserId: zod_1.z.string() }),
|
|
170
|
-
zod_1.z.object({ canonContactId: zod_1.z.string() }),
|
|
171
|
-
]);
|
|
172
|
-
exports.ResolveAdmissionResponseSchema = zod_1.z.looseObject({
|
|
173
|
-
resolvedTargetUserId: zod_1.z.string().nullable().optional(),
|
|
174
|
-
target: zod_1.z.looseObject({
|
|
175
|
-
id: zod_1.z.string(),
|
|
176
|
-
canonContactId: zod_1.z.string().optional(),
|
|
177
|
-
displayName: zod_1.z.string().optional(),
|
|
178
|
-
avatarUrl: zod_1.z.string().nullable().optional(),
|
|
179
|
-
about: zod_1.z.string().optional(),
|
|
180
|
-
userType: zod_1.z.enum(['human', 'ai_agent']).optional(),
|
|
181
|
-
discoverable: zod_1.z.boolean().optional(),
|
|
182
|
-
inboundPolicy: zod_1.z.enum(['open', 'approval-required', 'owner-only']).optional(),
|
|
183
|
-
groupJoinPolicy: zod_1.z.enum(['open', 'approval-required', 'owner-only']).optional(),
|
|
184
|
-
}).nullable(),
|
|
185
|
-
admission: zod_1.z.looseObject({
|
|
186
|
-
state: zod_1.z.enum([
|
|
187
|
-
'self',
|
|
188
|
-
'not-found',
|
|
189
|
-
'allowed',
|
|
190
|
-
'request-required',
|
|
191
|
-
'pending-outbound',
|
|
192
|
-
'blocked',
|
|
193
|
-
'inactive',
|
|
194
|
-
'owner-only',
|
|
195
|
-
]),
|
|
196
|
-
canMessage: zod_1.z.boolean(),
|
|
197
|
-
canRequestContact: zod_1.z.boolean(),
|
|
198
|
-
isContact: zod_1.z.boolean(),
|
|
199
|
-
pendingRequestId: zod_1.z.string().optional(),
|
|
200
|
-
blockedByViewer: zod_1.z.boolean().optional(),
|
|
201
|
-
blockedByTarget: zod_1.z.boolean().optional(),
|
|
202
|
-
}),
|
|
203
|
-
});
|
|
204
|
-
// ── Typing / streaming ─────────────────────────────────────────────────
|
|
205
|
-
exports.SetTypingRequestSchema = zod_1.z.object({
|
|
206
|
-
conversationId: zod_1.z.string(),
|
|
207
|
-
typing: zod_1.z.boolean(),
|
|
208
|
-
status: zod_1.z.enum(['thinking', 'typing']).optional(),
|
|
209
|
-
});
|
|
210
|
-
/** POST /streaming — the legacy REST facade over the RTDB streaming bubble. */
|
|
211
|
-
exports.SetStreamingRequestSchema = zod_1.z.union([
|
|
212
|
-
zod_1.z.object({
|
|
213
|
-
conversationId: zod_1.z.string(),
|
|
214
|
-
text: zod_1.z.string(),
|
|
215
|
-
status: zod_1.z.string(),
|
|
216
|
-
messageId: zod_1.z.string(),
|
|
217
|
-
turnId: zod_1.z.string().nullable().optional(),
|
|
218
|
-
/** TurnOutputBlock[] — opaque pass-through. */
|
|
219
|
-
blocks: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown())).optional(),
|
|
220
|
-
}),
|
|
221
|
-
zod_1.z.object({
|
|
222
|
-
conversationId: zod_1.z.string(),
|
|
223
|
-
streaming: zod_1.z.literal(false),
|
|
224
|
-
}),
|
|
225
|
-
]);
|
|
226
|
-
// ── Media upload ───────────────────────────────────────────────────────
|
|
227
|
-
exports.UploadMediaRequestSchema = zod_1.z.object({
|
|
228
|
-
conversationId: zod_1.z.string(),
|
|
229
|
-
mimeType: zod_1.z.string(),
|
|
230
|
-
/** Base64-encoded file content. */
|
|
231
|
-
data: zod_1.z.string(),
|
|
232
|
-
fileName: zod_1.z.string().optional(),
|
|
233
|
-
});
|
|
234
|
-
exports.UploadMediaResponseSchema = zod_1.z.object({
|
|
235
|
-
url: zod_1.z.string(),
|
|
236
|
-
attachment: media_js_1.MediaAttachmentSchema,
|
|
237
|
-
});
|