@canonmsg/backend-contracts 6.4.0 → 8.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/README.md +3 -3
- package/dist/canon-verb-wire.schema.json +0 -73
- package/dist/canon-verbs.limits.json +0 -5
- package/dist/canon-verbs.schema.json +7 -233
- package/dist/cjs/communication.js +31 -0
- package/dist/cjs/firestoreValues.js +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/replyAuthority.js +2 -0
- package/dist/cjs/verbContract.js +1 -17
- package/dist/cjs/verbSchemas.js +11 -149
- package/dist/cjs/verbWire.js +1 -36
- package/dist/communication.d.ts +109 -0
- package/dist/communication.js +27 -0
- package/dist/firestoreValues.d.ts +1 -1
- package/dist/firestoreValues.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/replyAuthority.d.ts +12 -0
- package/dist/replyAuthority.js +1 -0
- package/dist/verbContract.d.ts +5 -65
- package/dist/verbContract.js +0 -16
- package/dist/verbSchemas.d.ts +3 -210
- package/dist/verbSchemas.js +10 -148
- package/dist/verbWire.d.ts +4 -61
- package/dist/verbWire.js +2 -37
- package/package.json +2 -2
- package/dist/accessPolicy.d.ts +0 -9
- package/dist/accessPolicy.js +0 -12
- package/dist/cjs/accessPolicy.js +0 -15
- package/dist/cjs/contactRequest.js +0 -163
- package/dist/contactRequest.d.ts +0 -50
- package/dist/contactRequest.js +0 -157
package/dist/verbSchemas.js
CHANGED
|
@@ -29,18 +29,6 @@
|
|
|
29
29
|
*/
|
|
30
30
|
import { CANON_VERBS_SCHEMA_ID, CANON_VERB_NAMES, SELF_CONTEXT_TYPE, VERB_ID_PATTERNS, VERB_LIMITS, } from './verbContract.js';
|
|
31
31
|
const REF = (def) => ({ $ref: `#/$defs/${def}` });
|
|
32
|
-
const groupInviteRequirementsDef = {
|
|
33
|
-
type: 'object',
|
|
34
|
-
description: 'Independent gates on a pending group invite. policyApproval is social '
|
|
35
|
-
+ 'consent; ownerSessionSetup means the agent owner must choose the '
|
|
36
|
-
+ 'runtime session configuration before membership is activated.',
|
|
37
|
-
required: ['policyApproval', 'ownerSessionSetup'],
|
|
38
|
-
additionalProperties: false,
|
|
39
|
-
properties: {
|
|
40
|
-
policyApproval: { type: 'boolean' },
|
|
41
|
-
ownerSessionSetup: { type: 'boolean' },
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
32
|
const selfContextDef = {
|
|
45
33
|
type: 'object',
|
|
46
34
|
description: 'Private note-to-self attached to a cross-conversation send. Visible only to the '
|
|
@@ -310,50 +298,6 @@ export const VERB_NATIVE_METADATA_JSON_SCHEMA = {
|
|
|
310
298
|
},
|
|
311
299
|
},
|
|
312
300
|
};
|
|
313
|
-
const sessionConfigValueDef = {
|
|
314
|
-
type: 'string',
|
|
315
|
-
pattern: VERB_ID_PATTERNS.runtimeOptionValue,
|
|
316
|
-
maxLength: VERB_LIMITS.sessionConfigValueChars,
|
|
317
|
-
};
|
|
318
|
-
export const VERB_SESSION_CONFIG_JSON_SCHEMA = {
|
|
319
|
-
type: 'object',
|
|
320
|
-
description: 'Typed setup policy for an agent target. Values are stable runtime-advertised '
|
|
321
|
-
+ 'option ids and are validated against the target descriptor before session creation; '
|
|
322
|
-
+ 'labels, prompts, workspace paths, and arbitrary fields are not permitted.',
|
|
323
|
-
additionalProperties: false,
|
|
324
|
-
properties: {
|
|
325
|
-
model: sessionConfigValueDef,
|
|
326
|
-
permissionMode: sessionConfigValueDef,
|
|
327
|
-
effort: sessionConfigValueDef,
|
|
328
|
-
workspaceId: {
|
|
329
|
-
type: 'string',
|
|
330
|
-
pattern: VERB_ID_PATTERNS.workspaceOptionId,
|
|
331
|
-
maxLength: VERB_LIMITS.sessionConfigValueChars,
|
|
332
|
-
},
|
|
333
|
-
executionMode: { enum: ['worktree', 'locked'] },
|
|
334
|
-
runtimeControlValues: {
|
|
335
|
-
type: 'object',
|
|
336
|
-
maxProperties: VERB_LIMITS.sessionConfigValues,
|
|
337
|
-
propertyNames: {
|
|
338
|
-
pattern: VERB_ID_PATTERNS.runtimeControlId,
|
|
339
|
-
not: {
|
|
340
|
-
enum: [
|
|
341
|
-
'model',
|
|
342
|
-
'workspace',
|
|
343
|
-
'executionMode',
|
|
344
|
-
'permissionMode',
|
|
345
|
-
'effort',
|
|
346
|
-
'interrupt',
|
|
347
|
-
'runtimeControlValues',
|
|
348
|
-
'updatedAt',
|
|
349
|
-
'updatedBy',
|
|
350
|
-
],
|
|
351
|
-
},
|
|
352
|
-
},
|
|
353
|
-
additionalProperties: sessionConfigValueDef,
|
|
354
|
-
},
|
|
355
|
-
},
|
|
356
|
-
};
|
|
357
301
|
const timeoutFields = (maxMs, ceilingNote) => ({
|
|
358
302
|
timeoutMs: {
|
|
359
303
|
type: 'integer',
|
|
@@ -383,7 +327,7 @@ const send_to_input = {
|
|
|
383
327
|
+ 'sends -> admission resolve + create + send (the core reachOut composite). User '
|
|
384
328
|
+ 'targets resolve admission first: open targets get the message, approval-required '
|
|
385
329
|
+ 'targets get a contact request (send deferred and auto-fulfilled on approval), '
|
|
386
|
-
+ "
|
|
330
|
+
+ "closed targets surface as status 'unavailable' with reason closed.",
|
|
387
331
|
additionalProperties: false,
|
|
388
332
|
properties: {
|
|
389
333
|
targetConversationId: { type: 'string', pattern: VERB_ID_PATTERNS.runtimeId },
|
|
@@ -407,11 +351,6 @@ const send_to_input = {
|
|
|
407
351
|
+ `truncate to ${VERB_LIMITS.contactRequestNoteChars} chars.`,
|
|
408
352
|
},
|
|
409
353
|
sessionSelection: REF('sessionSelection'),
|
|
410
|
-
sessionConfig: {
|
|
411
|
-
oneOf: [REF('sessionConfig'), { type: 'null' }],
|
|
412
|
-
description: 'Coding-agent session setup (model/permissionMode/effort/workspaceId/executionMode); '
|
|
413
|
-
+ 'only applied to agent targets, stripped for humans.',
|
|
414
|
-
},
|
|
415
354
|
messageOptions: REF('messageOptions'),
|
|
416
355
|
},
|
|
417
356
|
oneOf: [
|
|
@@ -838,11 +777,9 @@ const create_group_input = {
|
|
|
838
777
|
description: "Create a group conversation. Each target's groupJoinPolicy is enforced "
|
|
839
778
|
+ 'server-side with staged admission: directly-addable members join at '
|
|
840
779
|
+ 'creation, approval-required members become pending group_invite '
|
|
841
|
-
+ 'requests;
|
|
842
|
-
+ 'owner requests; hard-denied members are skipped (see the result). A '
|
|
780
|
+
+ 'requests; hard-denied members are skipped (see the result). A '
|
|
843
781
|
+ 'creator-only group is valid when at least one requested member has a '
|
|
844
|
-
+ 'pending invite.
|
|
845
|
-
+ 'groups (403 CREATE_GROUP_CREATOR_SETUP_REQUIRED). Under MLS, membership '
|
|
782
|
+
+ 'pending invite. Under MLS, membership '
|
|
846
783
|
+ 'changes are Add/Remove proposals + Commit — a group operation is a '
|
|
847
784
|
+ 'cryptographic state change, not a codec swap.',
|
|
848
785
|
required: ['name', 'memberIds'],
|
|
@@ -861,8 +798,8 @@ const create_group_input = {
|
|
|
861
798
|
const create_group_result = {
|
|
862
799
|
type: 'object',
|
|
863
800
|
description: 'Staged admission: the group exists with the directly-added members; '
|
|
864
|
-
+ '`pending` lists group_invite requests awaiting policy approval
|
|
865
|
-
+ '
|
|
801
|
+
+ '`pending` lists group_invite requests awaiting policy approval; '
|
|
802
|
+
+ '`skipped` lists hard-denied targets.',
|
|
866
803
|
required: ['status', 'conversationId', 'added', 'pending', 'skipped'],
|
|
867
804
|
additionalProperties: true,
|
|
868
805
|
properties: {
|
|
@@ -876,12 +813,11 @@ const create_group_result = {
|
|
|
876
813
|
type: 'array',
|
|
877
814
|
items: {
|
|
878
815
|
type: 'object',
|
|
879
|
-
required: ['userId', 'requestId'
|
|
816
|
+
required: ['userId', 'requestId'],
|
|
880
817
|
additionalProperties: true,
|
|
881
818
|
properties: {
|
|
882
819
|
userId: { type: 'string' },
|
|
883
820
|
requestId: { type: 'string' },
|
|
884
|
-
requirements: REF('groupInviteRequirements'),
|
|
885
821
|
},
|
|
886
822
|
},
|
|
887
823
|
},
|
|
@@ -901,8 +837,8 @@ const create_group_result = {
|
|
|
901
837
|
};
|
|
902
838
|
const add_member_input = {
|
|
903
839
|
type: 'object',
|
|
904
|
-
description: 'A target needing policy approval
|
|
905
|
-
+ '
|
|
840
|
+
description: 'A target needing policy approval yields one pending group_invite. '
|
|
841
|
+
+ 'Under MLS an add is an Add proposal '
|
|
906
842
|
+ '+ Commit (new epoch), not a server-side membership write — the verb '
|
|
907
843
|
+ 'semantics are stable, the mechanism is not.',
|
|
908
844
|
required: ['conversationId', 'userId'],
|
|
@@ -913,8 +849,7 @@ const add_member_input = {
|
|
|
913
849
|
},
|
|
914
850
|
};
|
|
915
851
|
const add_member_result = {
|
|
916
|
-
description: 'Targets needing policy approval
|
|
917
|
-
+ 'pending group_invite routed to the target or agent owner.',
|
|
852
|
+
description: 'Targets needing policy approval yield an exact pending group invite.',
|
|
918
853
|
oneOf: [
|
|
919
854
|
{
|
|
920
855
|
type: 'object',
|
|
@@ -924,12 +859,11 @@ const add_member_result = {
|
|
|
924
859
|
},
|
|
925
860
|
{
|
|
926
861
|
type: 'object',
|
|
927
|
-
required: ['status', 'requestId'
|
|
862
|
+
required: ['status', 'requestId'],
|
|
928
863
|
additionalProperties: true,
|
|
929
864
|
properties: {
|
|
930
865
|
status: { const: 'pending' },
|
|
931
866
|
requestId: { type: 'string' },
|
|
932
|
-
requirements: REF('groupInviteRequirements'),
|
|
933
867
|
},
|
|
934
868
|
},
|
|
935
869
|
],
|
|
@@ -996,72 +930,6 @@ const list_contacts_result = {
|
|
|
996
930
|
},
|
|
997
931
|
},
|
|
998
932
|
};
|
|
999
|
-
const list_contact_requests_input = {
|
|
1000
|
-
type: 'object',
|
|
1001
|
-
additionalProperties: false,
|
|
1002
|
-
properties: {
|
|
1003
|
-
direction: { enum: ['inbound', 'outbound'] },
|
|
1004
|
-
includeResolved: { type: 'boolean' },
|
|
1005
|
-
limit: { type: 'integer', minimum: 1, maximum: 100 },
|
|
1006
|
-
},
|
|
1007
|
-
};
|
|
1008
|
-
const list_contact_requests_result = {
|
|
1009
|
-
type: 'object',
|
|
1010
|
-
description: 'Contact requests, newest first, capped at 100. Defaults to pending inbound; '
|
|
1011
|
-
+ 'requesters use direction=outbound with includeResolved=true to recover lifecycle state. '
|
|
1012
|
-
+ 'Items are SerializedContactRequest (backend-contracts contactRequest.ts).',
|
|
1013
|
-
required: ['requests'],
|
|
1014
|
-
additionalProperties: true,
|
|
1015
|
-
properties: {
|
|
1016
|
-
requests: {
|
|
1017
|
-
type: 'array',
|
|
1018
|
-
items: {
|
|
1019
|
-
type: 'object',
|
|
1020
|
-
required: ['id', 'requesterId', 'targetId', 'status', 'kind', 'phase'],
|
|
1021
|
-
additionalProperties: true,
|
|
1022
|
-
properties: {
|
|
1023
|
-
id: { type: 'string' },
|
|
1024
|
-
requesterId: { type: 'string' },
|
|
1025
|
-
requesterName: { type: 'string' },
|
|
1026
|
-
targetId: { type: 'string' },
|
|
1027
|
-
status: { enum: ['pending', 'approved', 'rejected', 'expired', 'cancelled'] },
|
|
1028
|
-
kind: { enum: ['dm', 'group_invite'] },
|
|
1029
|
-
phase: {
|
|
1030
|
-
enum: [
|
|
1031
|
-
'awaiting_owner',
|
|
1032
|
-
'starting',
|
|
1033
|
-
'connected',
|
|
1034
|
-
'rejected',
|
|
1035
|
-
'expired',
|
|
1036
|
-
'cancelled',
|
|
1037
|
-
'failed',
|
|
1038
|
-
],
|
|
1039
|
-
},
|
|
1040
|
-
message: { type: ['string', 'null'] },
|
|
1041
|
-
createdAt: { type: ['string', 'null'] },
|
|
1042
|
-
expiresAt: { type: ['string', 'null'] },
|
|
1043
|
-
},
|
|
1044
|
-
},
|
|
1045
|
-
},
|
|
1046
|
-
},
|
|
1047
|
-
};
|
|
1048
|
-
const cancel_contact_request_input = {
|
|
1049
|
-
type: 'object',
|
|
1050
|
-
required: ['requestId'],
|
|
1051
|
-
additionalProperties: false,
|
|
1052
|
-
properties: {
|
|
1053
|
-
requestId: { type: 'string', pattern: VERB_ID_PATTERNS.runtimeId },
|
|
1054
|
-
},
|
|
1055
|
-
};
|
|
1056
|
-
const cancel_contact_request_result = {
|
|
1057
|
-
type: 'object',
|
|
1058
|
-
required: ['status', 'requestId'],
|
|
1059
|
-
additionalProperties: true,
|
|
1060
|
-
properties: {
|
|
1061
|
-
status: { const: 'cancelled' },
|
|
1062
|
-
requestId: { type: 'string' },
|
|
1063
|
-
},
|
|
1064
|
-
};
|
|
1065
933
|
const list_conversations_input = {
|
|
1066
934
|
type: 'object',
|
|
1067
935
|
additionalProperties: false,
|
|
@@ -1155,7 +1023,6 @@ export const CANON_VERBS_JSON_SCHEMA = {
|
|
|
1155
1023
|
+ 'deliberately NOT verbs — they stay host-mediated.',
|
|
1156
1024
|
$defs: {
|
|
1157
1025
|
messageId: messageIdDef,
|
|
1158
|
-
groupInviteRequirements: groupInviteRequirementsDef,
|
|
1159
1026
|
selfContext: selfContextDef,
|
|
1160
1027
|
sessionSelection: sessionSelectionDef,
|
|
1161
1028
|
mediaAttachment: mediaAttachmentDef,
|
|
@@ -1168,7 +1035,6 @@ export const CANON_VERBS_JSON_SCHEMA = {
|
|
|
1168
1035
|
sessionRule: sessionRuleDef,
|
|
1169
1036
|
runtimeCard: runtimeCardDef,
|
|
1170
1037
|
native: VERB_NATIVE_METADATA_JSON_SCHEMA,
|
|
1171
|
-
sessionConfig: VERB_SESSION_CONFIG_JSON_SCHEMA,
|
|
1172
1038
|
send_to_input,
|
|
1173
1039
|
send_to_result,
|
|
1174
1040
|
request_input_input,
|
|
@@ -1197,12 +1063,8 @@ export const CANON_VERBS_JSON_SCHEMA = {
|
|
|
1197
1063
|
leave_conversation_result,
|
|
1198
1064
|
list_contacts_input,
|
|
1199
1065
|
list_contacts_result,
|
|
1200
|
-
list_contact_requests_input,
|
|
1201
|
-
list_contact_requests_result,
|
|
1202
1066
|
list_conversations_input,
|
|
1203
1067
|
list_conversations_result,
|
|
1204
|
-
cancel_contact_request_input,
|
|
1205
|
-
cancel_contact_request_result,
|
|
1206
1068
|
no_reply_input,
|
|
1207
1069
|
no_reply_result,
|
|
1208
1070
|
},
|
package/dist/verbWire.d.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* cards, prompts, questions, tool names/summaries, details, diffs, and
|
|
26
26
|
* self-contexts are body.
|
|
27
27
|
*/
|
|
28
|
-
import { type CanonVerbName, type VerbNativeMetadata, type
|
|
28
|
+
import { type CanonVerbName, type VerbNativeMetadata, type VerbSessionSelection } from './verbContract.js';
|
|
29
29
|
export declare const CANON_VERB_WIRE_SCHEMA_VERSION = "canon.verb-wire.v1";
|
|
30
30
|
export declare const CANON_VERB_WIRE_SCHEMA_ID = "https://canonmsg.com/schemas/canon.verb-wire.v1.json";
|
|
31
31
|
export type VerbWireBody = {
|
|
@@ -40,8 +40,6 @@ export type VerbWireBody = {
|
|
|
40
40
|
/** Turn-protocol keys the server enforces on (subset of TurnMetadata). */
|
|
41
41
|
export interface VerbWireTurn {
|
|
42
42
|
turnId?: string | null;
|
|
43
|
-
/** Trusted message that initiated a host-bound owner turn. */
|
|
44
|
-
sourceMessageId?: string;
|
|
45
43
|
turnSemantics?: 'progress' | 'turn_complete' | 'control';
|
|
46
44
|
deliveryIntent?: 'queue' | 'interrupt' | 'interleave' | 'stop';
|
|
47
45
|
replyBehavior?: 'allow_auto_reply' | 'suppress_auto_reply';
|
|
@@ -55,8 +53,7 @@ export interface VerbWireTurn {
|
|
|
55
53
|
* Documented leak decisions (see e2ee-mls.md §10): `mentions` stays
|
|
56
54
|
* plaintext for routing + mention-piercing pushes (D3); `contactUserId` on
|
|
57
55
|
* share_contact reveals who was shared (explicitly accepted for v1);
|
|
58
|
-
* `
|
|
59
|
-
* typed correlation ids. Paths, labels, prompts, summaries, and other free
|
|
56
|
+
* `native` carries only typed correlation ids. Paths, labels, prompts, summaries, and other free
|
|
60
57
|
* text belong in the body or owner-local runtime state.
|
|
61
58
|
*/
|
|
62
59
|
export interface CanonVerbWireEnvelope {
|
|
@@ -77,7 +74,6 @@ export interface CanonVerbWireEnvelope {
|
|
|
77
74
|
risk?: 'low' | 'normal' | 'high' | 'destructive';
|
|
78
75
|
category?: 'command' | 'file' | 'network' | 'browser' | 'mcp' | 'plugin' | 'canon' | 'tool';
|
|
79
76
|
sessionSelection?: VerbSessionSelection;
|
|
80
|
-
sessionConfig?: VerbSessionConfig | null;
|
|
81
77
|
idempotencyKey?: string;
|
|
82
78
|
/** Target-message reference for react/forward — routing, not content. */
|
|
83
79
|
messageId?: string;
|
|
@@ -139,7 +135,7 @@ export declare const CANON_VERB_WIRE_JSON_SCHEMA: {
|
|
|
139
135
|
readonly const: "canon.verb-wire.v1";
|
|
140
136
|
};
|
|
141
137
|
readonly verb: {
|
|
142
|
-
readonly enum: readonly ["send_to", "request_input", "request_approval", "check_approval", "send_card", "request_card", "share_contact", "react", "forward", "create_group", "add_member", "remove_member", "leave_conversation", "list_contacts", "
|
|
138
|
+
readonly enum: readonly ["send_to", "request_input", "request_approval", "check_approval", "send_card", "request_card", "share_contact", "react", "forward", "create_group", "add_member", "remove_member", "leave_conversation", "list_contacts", "list_conversations", "no_reply"];
|
|
143
139
|
};
|
|
144
140
|
readonly envelope: {
|
|
145
141
|
readonly $ref: "#/$defs/envelope";
|
|
@@ -270,55 +266,6 @@ export declare const CANON_VERB_WIRE_JSON_SCHEMA: {
|
|
|
270
266
|
};
|
|
271
267
|
}];
|
|
272
268
|
};
|
|
273
|
-
readonly sessionConfig: {
|
|
274
|
-
readonly oneOf: readonly [{
|
|
275
|
-
readonly type: "object";
|
|
276
|
-
readonly description: string;
|
|
277
|
-
readonly additionalProperties: false;
|
|
278
|
-
readonly properties: {
|
|
279
|
-
readonly model: {
|
|
280
|
-
readonly type: "string";
|
|
281
|
-
readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$";
|
|
282
|
-
readonly maxLength: 256;
|
|
283
|
-
};
|
|
284
|
-
readonly permissionMode: {
|
|
285
|
-
readonly type: "string";
|
|
286
|
-
readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$";
|
|
287
|
-
readonly maxLength: 256;
|
|
288
|
-
};
|
|
289
|
-
readonly effort: {
|
|
290
|
-
readonly type: "string";
|
|
291
|
-
readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$";
|
|
292
|
-
readonly maxLength: 256;
|
|
293
|
-
};
|
|
294
|
-
readonly workspaceId: {
|
|
295
|
-
readonly type: "string";
|
|
296
|
-
readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
|
|
297
|
-
readonly maxLength: 256;
|
|
298
|
-
};
|
|
299
|
-
readonly executionMode: {
|
|
300
|
-
readonly enum: readonly ["worktree", "locked"];
|
|
301
|
-
};
|
|
302
|
-
readonly runtimeControlValues: {
|
|
303
|
-
readonly type: "object";
|
|
304
|
-
readonly maxProperties: 24;
|
|
305
|
-
readonly propertyNames: {
|
|
306
|
-
readonly pattern: "^[A-Za-z0-9_-]{1,80}$";
|
|
307
|
-
readonly not: {
|
|
308
|
-
readonly enum: readonly ["model", "workspace", "executionMode", "permissionMode", "effort", "interrupt", "runtimeControlValues", "updatedAt", "updatedBy"];
|
|
309
|
-
};
|
|
310
|
-
};
|
|
311
|
-
readonly additionalProperties: {
|
|
312
|
-
readonly type: "string";
|
|
313
|
-
readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$";
|
|
314
|
-
readonly maxLength: 256;
|
|
315
|
-
};
|
|
316
|
-
};
|
|
317
|
-
};
|
|
318
|
-
}, {
|
|
319
|
-
readonly type: "null";
|
|
320
|
-
}];
|
|
321
|
-
};
|
|
322
269
|
readonly idempotencyKey: {
|
|
323
270
|
readonly type: "string";
|
|
324
271
|
readonly pattern: "^[A-Za-z0-9_.:-]{1,160}$";
|
|
@@ -466,10 +413,6 @@ export declare const CANON_VERB_WIRE_JSON_SCHEMA: {
|
|
|
466
413
|
readonly turnId: {
|
|
467
414
|
readonly type: readonly ["string", "null"];
|
|
468
415
|
};
|
|
469
|
-
readonly sourceMessageId: {
|
|
470
|
-
readonly type: "string";
|
|
471
|
-
readonly minLength: 1;
|
|
472
|
-
};
|
|
473
416
|
readonly turnSemantics: {
|
|
474
417
|
readonly enum: readonly ["progress", "turn_complete", "control"];
|
|
475
418
|
};
|
|
@@ -515,7 +458,7 @@ export declare const CANON_VERB_WIRE_JSON_SCHEMA: {
|
|
|
515
458
|
readonly const: "canon.verb-wire.v1";
|
|
516
459
|
};
|
|
517
460
|
readonly verb: {
|
|
518
|
-
readonly enum: readonly ["send_to", "request_input", "request_approval", "check_approval", "send_card", "request_card", "share_contact", "react", "forward", "create_group", "add_member", "remove_member", "leave_conversation", "list_contacts", "
|
|
461
|
+
readonly enum: readonly ["send_to", "request_input", "request_approval", "check_approval", "send_card", "request_card", "share_contact", "react", "forward", "create_group", "add_member", "remove_member", "leave_conversation", "list_contacts", "list_conversations", "no_reply"];
|
|
519
462
|
};
|
|
520
463
|
readonly result: {
|
|
521
464
|
readonly $ref: "#/$defs/body";
|
package/dist/verbWire.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* self-contexts are body.
|
|
27
27
|
*/
|
|
28
28
|
import { CANON_VERB_NAMES, VERB_ID_PATTERNS, VERB_LIMITS, } from './verbContract.js';
|
|
29
|
-
import { VERB_NATIVE_METADATA_JSON_SCHEMA
|
|
29
|
+
import { VERB_NATIVE_METADATA_JSON_SCHEMA } from './verbSchemas.js';
|
|
30
30
|
export const CANON_VERB_WIRE_SCHEMA_VERSION = 'canon.verb-wire.v1';
|
|
31
31
|
export const CANON_VERB_WIRE_SCHEMA_ID = 'https://canonmsg.com/schemas/canon.verb-wire.v1.json';
|
|
32
32
|
// ---------------------------------------------------------------------------
|
|
@@ -41,7 +41,6 @@ export const VERB_WIRE_ENVELOPE_FIELDS = {
|
|
|
41
41
|
'canonContactId',
|
|
42
42
|
'sourceConversationId',
|
|
43
43
|
'sessionSelection',
|
|
44
|
-
'sessionConfig',
|
|
45
44
|
'idempotencyKey',
|
|
46
45
|
'replyTo',
|
|
47
46
|
'replyToPosition',
|
|
@@ -110,9 +109,7 @@ export const VERB_WIRE_ENVELOPE_FIELDS = {
|
|
|
110
109
|
optional: [],
|
|
111
110
|
},
|
|
112
111
|
list_contacts: { required: [], optional: [] },
|
|
113
|
-
list_contact_requests: { required: [], optional: [] },
|
|
114
112
|
list_conversations: { required: [], optional: ['limit'] },
|
|
115
|
-
cancel_contact_request: { required: ['requestId'], optional: [] },
|
|
116
113
|
no_reply: { required: [], optional: ['conversationId', 'messageId'] },
|
|
117
114
|
};
|
|
118
115
|
// ---------------------------------------------------------------------------
|
|
@@ -154,7 +151,6 @@ const wireTurnDef = {
|
|
|
154
151
|
additionalProperties: false,
|
|
155
152
|
properties: {
|
|
156
153
|
turnId: { type: ['string', 'null'] },
|
|
157
|
-
sourceMessageId: { type: 'string', minLength: 1 },
|
|
158
154
|
turnSemantics: { enum: ['progress', 'turn_complete', 'control'] },
|
|
159
155
|
deliveryIntent: { enum: ['queue', 'interrupt', 'interleave', 'stop'] },
|
|
160
156
|
replyBehavior: { enum: ['allow_auto_reply', 'suppress_auto_reply'] },
|
|
@@ -202,9 +198,6 @@ const wireEnvelopeDef = {
|
|
|
202
198
|
},
|
|
203
199
|
],
|
|
204
200
|
},
|
|
205
|
-
sessionConfig: {
|
|
206
|
-
oneOf: [VERB_SESSION_CONFIG_JSON_SCHEMA, { type: 'null' }],
|
|
207
|
-
},
|
|
208
201
|
idempotencyKey: {
|
|
209
202
|
type: 'string',
|
|
210
203
|
pattern: VERB_ID_PATTERNS.runtimeId,
|
|
@@ -280,13 +273,7 @@ export const CANON_VERB_WIRE_JSON_SCHEMA = {
|
|
|
280
273
|
// ---------------------------------------------------------------------------
|
|
281
274
|
// Intent <-> wire projection (json codec)
|
|
282
275
|
// ---------------------------------------------------------------------------
|
|
283
|
-
const TURN_KEYS = [
|
|
284
|
-
'turnId',
|
|
285
|
-
'sourceMessageId',
|
|
286
|
-
'turnSemantics',
|
|
287
|
-
'deliveryIntent',
|
|
288
|
-
'replyBehavior',
|
|
289
|
-
];
|
|
276
|
+
const TURN_KEYS = ['turnId', 'turnSemantics', 'deliveryIntent', 'replyBehavior'];
|
|
290
277
|
function splitTurnMetadata(metadata) {
|
|
291
278
|
if (!metadata || typeof metadata !== 'object')
|
|
292
279
|
return { turn: undefined, rest: undefined };
|
|
@@ -344,7 +331,6 @@ export function projectVerbIntentToWire(verb, intent, options) {
|
|
|
344
331
|
canonContactId: input.canonContactId,
|
|
345
332
|
sourceConversationId: input.sourceConversationId,
|
|
346
333
|
sessionSelection: input.sessionSelection,
|
|
347
|
-
sessionConfig: input.sessionConfig,
|
|
348
334
|
idempotencyKey: messageOptions.messageId,
|
|
349
335
|
replyTo: messageOptions.replyTo,
|
|
350
336
|
replyToPosition: messageOptions.replyToPosition,
|
|
@@ -474,22 +460,10 @@ export function projectVerbIntentToWire(verb, intent, options) {
|
|
|
474
460
|
case 'list_contacts': {
|
|
475
461
|
break;
|
|
476
462
|
}
|
|
477
|
-
case 'list_contact_requests': {
|
|
478
|
-
value = compact({
|
|
479
|
-
direction: input.direction,
|
|
480
|
-
includeResolved: input.includeResolved,
|
|
481
|
-
limit: input.limit,
|
|
482
|
-
});
|
|
483
|
-
break;
|
|
484
|
-
}
|
|
485
463
|
case 'list_conversations': {
|
|
486
464
|
envelope = compact({ limit: input.limit });
|
|
487
465
|
break;
|
|
488
466
|
}
|
|
489
|
-
case 'cancel_contact_request': {
|
|
490
|
-
envelope = compact({ requestId: input.requestId });
|
|
491
|
-
break;
|
|
492
|
-
}
|
|
493
467
|
case 'no_reply': {
|
|
494
468
|
envelope = compact({ conversationId: input.conversationId, messageId: input.messageId });
|
|
495
469
|
value = compact({ reason: input.reason });
|
|
@@ -535,7 +509,6 @@ export function mergeVerbWireToIntent(request) {
|
|
|
535
509
|
canonContactId: envelope.canonContactId,
|
|
536
510
|
sourceConversationId: envelope.sourceConversationId,
|
|
537
511
|
sessionSelection: envelope.sessionSelection,
|
|
538
|
-
sessionConfig: envelope.sessionConfig,
|
|
539
512
|
text: value.text,
|
|
540
513
|
selfContext: value.selfContext,
|
|
541
514
|
requestMessage: value.requestMessage,
|
|
@@ -629,16 +602,8 @@ export function mergeVerbWireToIntent(request) {
|
|
|
629
602
|
return compact({ conversationId: envelope.conversationId });
|
|
630
603
|
case 'list_contacts':
|
|
631
604
|
return {};
|
|
632
|
-
case 'list_contact_requests':
|
|
633
|
-
return compact({
|
|
634
|
-
direction: value.direction,
|
|
635
|
-
includeResolved: value.includeResolved,
|
|
636
|
-
limit: value.limit,
|
|
637
|
-
});
|
|
638
605
|
case 'list_conversations':
|
|
639
606
|
return compact({ limit: envelope.limit });
|
|
640
|
-
case 'cancel_contact_request':
|
|
641
|
-
return compact({ requestId: envelope.requestId });
|
|
642
607
|
case 'no_reply':
|
|
643
608
|
return compact({ conversationId: envelope.conversationId, messageId: envelope.messageId, reason: value.reason });
|
|
644
609
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonmsg/backend-contracts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Canon backend contract helpers shared by Functions and stream-service",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@canonmsg/rich-cards": "^0.10.
|
|
46
|
+
"@canonmsg/rich-cards": "^0.10.3",
|
|
47
47
|
"@types/node": "^22.0.0",
|
|
48
48
|
"ajv": "^8.20.0",
|
|
49
49
|
"typescript": "~5.7.0",
|
package/dist/accessPolicy.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** The canonical access triplet's policy values (`inboundPolicy`, `groupJoinPolicy`). */
|
|
2
|
-
export type CanonicalPolicy = 'open' | 'approval-required' | 'owner-only';
|
|
3
|
-
/**
|
|
4
|
-
* Read a stored policy field, defaulting to the value Canon assigns on account
|
|
5
|
-
* creation. Anything unrecognized — missing, misspelled, or the retired
|
|
6
|
-
* `'private'` enum — reads as 'approval-required'. This must never widen to
|
|
7
|
-
* 'open'.
|
|
8
|
-
*/
|
|
9
|
-
export declare function readCanonicalPolicy(value: unknown): CanonicalPolicy;
|
package/dist/accessPolicy.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Read a stored policy field, defaulting to the value Canon assigns on account
|
|
3
|
-
* creation. Anything unrecognized — missing, misspelled, or the retired
|
|
4
|
-
* `'private'` enum — reads as 'approval-required'. This must never widen to
|
|
5
|
-
* 'open'.
|
|
6
|
-
*/
|
|
7
|
-
export function readCanonicalPolicy(value) {
|
|
8
|
-
if (value === 'open' || value === 'approval-required' || value === 'owner-only') {
|
|
9
|
-
return value;
|
|
10
|
-
}
|
|
11
|
-
return 'approval-required';
|
|
12
|
-
}
|
package/dist/cjs/accessPolicy.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readCanonicalPolicy = readCanonicalPolicy;
|
|
4
|
-
/**
|
|
5
|
-
* Read a stored policy field, defaulting to the value Canon assigns on account
|
|
6
|
-
* creation. Anything unrecognized — missing, misspelled, or the retired
|
|
7
|
-
* `'private'` enum — reads as 'approval-required'. This must never widen to
|
|
8
|
-
* 'open'.
|
|
9
|
-
*/
|
|
10
|
-
function readCanonicalPolicy(value) {
|
|
11
|
-
if (value === 'open' || value === 'approval-required' || value === 'owner-only') {
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
return 'approval-required';
|
|
15
|
-
}
|