@canonmsg/backend-contracts 7.0.0 → 8.0.1
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 +2 -2
- package/dist/agentBehaviorPolicy.d.ts +12 -20
- package/dist/agentBehaviorPolicy.js +19 -23
- package/dist/canon-verb-wire.schema.json +0 -67
- package/dist/canon-verbs.limits.json +0 -5
- package/dist/canon-verbs.schema.json +7 -176
- package/dist/cjs/agentBehaviorPolicy.js +20 -24
- package/dist/cjs/communication.js +0 -4
- package/dist/cjs/firestoreValues.js +1 -1
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/replyAuthority.js +2 -0
- package/dist/cjs/verbContract.js +1 -16
- package/dist/cjs/verbSchemas.js +11 -115
- package/dist/cjs/verbWire.js +1 -10
- package/dist/communication.d.ts +22 -4
- package/dist/communication.js +0 -4
- package/dist/firestoreValues.d.ts +1 -1
- package/dist/firestoreValues.js +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/replyAuthority.d.ts +12 -0
- package/dist/replyAuthority.js +1 -0
- package/dist/verbContract.d.ts +4 -48
- package/dist/verbContract.js +0 -15
- package/dist/verbSchemas.d.ts +3 -171
- package/dist/verbSchemas.js +10 -114
- package/dist/verbWire.d.ts +4 -55
- package/dist/verbWire.js +2 -11
- package/package.json +1 -1
- 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 -114
- package/dist/contactRequest.d.ts +0 -36
- package/dist/contactRequest.js +0 -110
package/dist/cjs/verbContract.js
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
* canon-verbs.limits.json) after schema validation.
|
|
45
45
|
*/
|
|
46
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
-
exports.CANON_VERB_LIMITS_ARTIFACT = exports.NO_REPLY_ACK_NOTE = exports.
|
|
47
|
+
exports.CANON_VERB_LIMITS_ARTIFACT = exports.NO_REPLY_ACK_NOTE = exports.CREATE_GROUP_NO_ADDABLE_MEMBERS_CODE = exports.VERB_NATIVE_METADATA_KEYS = exports.CANON_VERB_NAMES = exports.SELF_CONTEXT_TYPE = exports.VERB_RATE_LIMITS = exports.VERB_LIMITS = exports.VERB_ID_PATTERNS = exports.CANON_CARD_SCHEMA_ID = exports.CANON_VERB_NAMESPACE = exports.CANON_VERBS_SCHEMA_ID = exports.CANON_VERBS_SCHEMA_VERSION = void 0;
|
|
48
48
|
exports.normalizeVerbNativeMetadata = normalizeVerbNativeMetadata;
|
|
49
49
|
exports.canonVerbToolName = canonVerbToolName;
|
|
50
50
|
exports.findVerbByteLimitViolations = findVerbByteLimitViolations;
|
|
@@ -78,10 +78,7 @@ exports.VERB_ID_PATTERNS = {
|
|
|
78
78
|
sessionRuleToolPattern: '^[\\w.*:-]{1,128}$',
|
|
79
79
|
runtimeCorrelationValue: '^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$',
|
|
80
80
|
runtimeMethod: '^[A-Za-z0-9_][A-Za-z0-9_./:\\-]{0,255}$',
|
|
81
|
-
runtimeOptionValue: '^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$',
|
|
82
|
-
workspaceOptionId: '^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$',
|
|
83
81
|
runtimeHandleKey: '^[A-Za-z0-9_.:-]{1,80}$',
|
|
84
|
-
runtimeControlId: '^[A-Za-z0-9_-]{1,80}$',
|
|
85
82
|
/** UUID issued by Canon's resumable-media session endpoint. */
|
|
86
83
|
resumableUploadId: '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$',
|
|
87
84
|
};
|
|
@@ -151,9 +148,6 @@ exports.VERB_LIMITS = {
|
|
|
151
148
|
nativeKeys: 24,
|
|
152
149
|
nativeValueChars: 256,
|
|
153
150
|
nativeHandles: 16,
|
|
154
|
-
/** Initial agent-session setup carried by send_to. */
|
|
155
|
-
sessionConfigValues: 24,
|
|
156
|
-
sessionConfigValueChars: 256,
|
|
157
151
|
/** Deadlines (functions/src/utils/runtimeRequestHelpers.ts). */
|
|
158
152
|
minTimeoutMs: 1000,
|
|
159
153
|
/** input/card/plan ceiling (30 minutes). */
|
|
@@ -204,7 +198,6 @@ exports.CANON_VERB_NAMES = [
|
|
|
204
198
|
'remove_member',
|
|
205
199
|
'leave_conversation',
|
|
206
200
|
'list_contacts',
|
|
207
|
-
'list_contact_requests',
|
|
208
201
|
'list_conversations',
|
|
209
202
|
'no_reply',
|
|
210
203
|
];
|
|
@@ -273,14 +266,6 @@ function normalizeVerbNativeMetadata(value) {
|
|
|
273
266
|
* invite is allowed; the error detail carries the attempted partition.
|
|
274
267
|
*/
|
|
275
268
|
exports.CREATE_GROUP_NO_ADDABLE_MEMBERS_CODE = 'CREATE_GROUP_NO_ADDABLE_MEMBERS';
|
|
276
|
-
/**
|
|
277
|
-
* Error code on the 403 a create_group receives when the CREATOR itself is
|
|
278
|
-
* a coding agent requiring explicit session setup: the group helper prepares
|
|
279
|
-
* session configs for every coding-agent member including the creator, and
|
|
280
|
-
* only the agent's human owner may provide them (v1 scoping — the owner
|
|
281
|
-
* creates the group from the app instead).
|
|
282
|
-
*/
|
|
283
|
-
exports.CREATE_GROUP_CREATOR_SETUP_REQUIRED_CODE = 'CREATE_GROUP_CREATOR_SETUP_REQUIRED';
|
|
284
269
|
/**
|
|
285
270
|
* The `note` the server returns on a `no_reply` ack — the model's closure
|
|
286
271
|
* sentence. It lives here, not in a host, because every binding surfaces the
|
package/dist/cjs/verbSchemas.js
CHANGED
|
@@ -29,23 +29,11 @@
|
|
|
29
29
|
* endpoints validate against these schemas directly).
|
|
30
30
|
*/
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.CANON_VERB_SCHEMA_REFS = exports.CANON_VERBS_JSON_SCHEMA = exports.
|
|
32
|
+
exports.CANON_VERB_SCHEMA_REFS = exports.CANON_VERBS_JSON_SCHEMA = exports.VERB_NATIVE_METADATA_JSON_SCHEMA = void 0;
|
|
33
33
|
exports.getVerbInputSchema = getVerbInputSchema;
|
|
34
34
|
exports.getVerbResultSchema = getVerbResultSchema;
|
|
35
35
|
const verbContract_js_1 = require("./verbContract.js");
|
|
36
36
|
const REF = (def) => ({ $ref: `#/$defs/${def}` });
|
|
37
|
-
const groupInviteRequirementsDef = {
|
|
38
|
-
type: 'object',
|
|
39
|
-
description: 'Independent gates on a pending group invite. policyApproval is social '
|
|
40
|
-
+ 'consent; ownerSessionSetup means the agent owner must choose the '
|
|
41
|
-
+ 'runtime session configuration before membership is activated.',
|
|
42
|
-
required: ['policyApproval', 'ownerSessionSetup'],
|
|
43
|
-
additionalProperties: false,
|
|
44
|
-
properties: {
|
|
45
|
-
policyApproval: { type: 'boolean' },
|
|
46
|
-
ownerSessionSetup: { type: 'boolean' },
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
37
|
const selfContextDef = {
|
|
50
38
|
type: 'object',
|
|
51
39
|
description: 'Private note-to-self attached to a cross-conversation send. Visible only to the '
|
|
@@ -315,50 +303,6 @@ exports.VERB_NATIVE_METADATA_JSON_SCHEMA = {
|
|
|
315
303
|
},
|
|
316
304
|
},
|
|
317
305
|
};
|
|
318
|
-
const sessionConfigValueDef = {
|
|
319
|
-
type: 'string',
|
|
320
|
-
pattern: verbContract_js_1.VERB_ID_PATTERNS.runtimeOptionValue,
|
|
321
|
-
maxLength: verbContract_js_1.VERB_LIMITS.sessionConfigValueChars,
|
|
322
|
-
};
|
|
323
|
-
exports.VERB_SESSION_CONFIG_JSON_SCHEMA = {
|
|
324
|
-
type: 'object',
|
|
325
|
-
description: 'Typed setup policy for an agent target. Values are stable runtime-advertised '
|
|
326
|
-
+ 'option ids and are validated against the target descriptor before session creation; '
|
|
327
|
-
+ 'labels, prompts, workspace paths, and arbitrary fields are not permitted.',
|
|
328
|
-
additionalProperties: false,
|
|
329
|
-
properties: {
|
|
330
|
-
model: sessionConfigValueDef,
|
|
331
|
-
permissionMode: sessionConfigValueDef,
|
|
332
|
-
effort: sessionConfigValueDef,
|
|
333
|
-
workspaceId: {
|
|
334
|
-
type: 'string',
|
|
335
|
-
pattern: verbContract_js_1.VERB_ID_PATTERNS.workspaceOptionId,
|
|
336
|
-
maxLength: verbContract_js_1.VERB_LIMITS.sessionConfigValueChars,
|
|
337
|
-
},
|
|
338
|
-
executionMode: { enum: ['worktree', 'locked'] },
|
|
339
|
-
runtimeControlValues: {
|
|
340
|
-
type: 'object',
|
|
341
|
-
maxProperties: verbContract_js_1.VERB_LIMITS.sessionConfigValues,
|
|
342
|
-
propertyNames: {
|
|
343
|
-
pattern: verbContract_js_1.VERB_ID_PATTERNS.runtimeControlId,
|
|
344
|
-
not: {
|
|
345
|
-
enum: [
|
|
346
|
-
'model',
|
|
347
|
-
'workspace',
|
|
348
|
-
'executionMode',
|
|
349
|
-
'permissionMode',
|
|
350
|
-
'effort',
|
|
351
|
-
'interrupt',
|
|
352
|
-
'runtimeControlValues',
|
|
353
|
-
'updatedAt',
|
|
354
|
-
'updatedBy',
|
|
355
|
-
],
|
|
356
|
-
},
|
|
357
|
-
},
|
|
358
|
-
additionalProperties: sessionConfigValueDef,
|
|
359
|
-
},
|
|
360
|
-
},
|
|
361
|
-
};
|
|
362
306
|
const timeoutFields = (maxMs, ceilingNote) => ({
|
|
363
307
|
timeoutMs: {
|
|
364
308
|
type: 'integer',
|
|
@@ -388,7 +332,7 @@ const send_to_input = {
|
|
|
388
332
|
+ 'sends -> admission resolve + create + send (the core reachOut composite). User '
|
|
389
333
|
+ 'targets resolve admission first: open targets get the message, approval-required '
|
|
390
334
|
+ 'targets get a contact request (send deferred and auto-fulfilled on approval), '
|
|
391
|
-
+ "
|
|
335
|
+
+ "closed targets surface as status 'unavailable' with reason closed.",
|
|
392
336
|
additionalProperties: false,
|
|
393
337
|
properties: {
|
|
394
338
|
targetConversationId: { type: 'string', pattern: verbContract_js_1.VERB_ID_PATTERNS.runtimeId },
|
|
@@ -412,11 +356,6 @@ const send_to_input = {
|
|
|
412
356
|
+ `truncate to ${verbContract_js_1.VERB_LIMITS.contactRequestNoteChars} chars.`,
|
|
413
357
|
},
|
|
414
358
|
sessionSelection: REF('sessionSelection'),
|
|
415
|
-
sessionConfig: {
|
|
416
|
-
oneOf: [REF('sessionConfig'), { type: 'null' }],
|
|
417
|
-
description: 'Coding-agent session setup (model/permissionMode/effort/workspaceId/executionMode); '
|
|
418
|
-
+ 'only applied to agent targets, stripped for humans.',
|
|
419
|
-
},
|
|
420
359
|
messageOptions: REF('messageOptions'),
|
|
421
360
|
},
|
|
422
361
|
oneOf: [
|
|
@@ -843,11 +782,9 @@ const create_group_input = {
|
|
|
843
782
|
description: "Create a group conversation. Each target's groupJoinPolicy is enforced "
|
|
844
783
|
+ 'server-side with staged admission: directly-addable members join at '
|
|
845
784
|
+ 'creation, approval-required members become pending group_invite '
|
|
846
|
-
+ 'requests;
|
|
847
|
-
+ 'owner requests; hard-denied members are skipped (see the result). A '
|
|
785
|
+
+ 'requests; hard-denied members are skipped (see the result). A '
|
|
848
786
|
+ 'creator-only group is valid when at least one requested member has a '
|
|
849
|
-
+ 'pending invite.
|
|
850
|
-
+ 'groups (403 CREATE_GROUP_CREATOR_SETUP_REQUIRED). Under MLS, membership '
|
|
787
|
+
+ 'pending invite. Under MLS, membership '
|
|
851
788
|
+ 'changes are Add/Remove proposals + Commit — a group operation is a '
|
|
852
789
|
+ 'cryptographic state change, not a codec swap.',
|
|
853
790
|
required: ['name', 'memberIds'],
|
|
@@ -866,8 +803,8 @@ const create_group_input = {
|
|
|
866
803
|
const create_group_result = {
|
|
867
804
|
type: 'object',
|
|
868
805
|
description: 'Staged admission: the group exists with the directly-added members; '
|
|
869
|
-
+ '`pending` lists group_invite requests awaiting policy approval
|
|
870
|
-
+ '
|
|
806
|
+
+ '`pending` lists group_invite requests awaiting policy approval; '
|
|
807
|
+
+ '`skipped` lists hard-denied targets.',
|
|
871
808
|
required: ['status', 'conversationId', 'added', 'pending', 'skipped'],
|
|
872
809
|
additionalProperties: true,
|
|
873
810
|
properties: {
|
|
@@ -881,12 +818,11 @@ const create_group_result = {
|
|
|
881
818
|
type: 'array',
|
|
882
819
|
items: {
|
|
883
820
|
type: 'object',
|
|
884
|
-
required: ['userId', 'requestId'
|
|
821
|
+
required: ['userId', 'requestId'],
|
|
885
822
|
additionalProperties: true,
|
|
886
823
|
properties: {
|
|
887
824
|
userId: { type: 'string' },
|
|
888
825
|
requestId: { type: 'string' },
|
|
889
|
-
requirements: REF('groupInviteRequirements'),
|
|
890
826
|
},
|
|
891
827
|
},
|
|
892
828
|
},
|
|
@@ -906,8 +842,8 @@ const create_group_result = {
|
|
|
906
842
|
};
|
|
907
843
|
const add_member_input = {
|
|
908
844
|
type: 'object',
|
|
909
|
-
description: 'A target needing policy approval
|
|
910
|
-
+ '
|
|
845
|
+
description: 'A target needing policy approval yields one pending group_invite. '
|
|
846
|
+
+ 'Under MLS an add is an Add proposal '
|
|
911
847
|
+ '+ Commit (new epoch), not a server-side membership write — the verb '
|
|
912
848
|
+ 'semantics are stable, the mechanism is not.',
|
|
913
849
|
required: ['conversationId', 'userId'],
|
|
@@ -918,8 +854,7 @@ const add_member_input = {
|
|
|
918
854
|
},
|
|
919
855
|
};
|
|
920
856
|
const add_member_result = {
|
|
921
|
-
description: 'Targets needing policy approval
|
|
922
|
-
+ 'pending group_invite routed to the target or agent owner.',
|
|
857
|
+
description: 'Targets needing policy approval yield an exact pending group invite.',
|
|
923
858
|
oneOf: [
|
|
924
859
|
{
|
|
925
860
|
type: 'object',
|
|
@@ -929,12 +864,11 @@ const add_member_result = {
|
|
|
929
864
|
},
|
|
930
865
|
{
|
|
931
866
|
type: 'object',
|
|
932
|
-
required: ['status', 'requestId'
|
|
867
|
+
required: ['status', 'requestId'],
|
|
933
868
|
additionalProperties: true,
|
|
934
869
|
properties: {
|
|
935
870
|
status: { const: 'pending' },
|
|
936
871
|
requestId: { type: 'string' },
|
|
937
|
-
requirements: REF('groupInviteRequirements'),
|
|
938
872
|
},
|
|
939
873
|
},
|
|
940
874
|
],
|
|
@@ -1001,40 +935,6 @@ const list_contacts_result = {
|
|
|
1001
935
|
},
|
|
1002
936
|
},
|
|
1003
937
|
};
|
|
1004
|
-
const list_contact_requests_input = {
|
|
1005
|
-
type: 'object',
|
|
1006
|
-
additionalProperties: false,
|
|
1007
|
-
properties: {},
|
|
1008
|
-
};
|
|
1009
|
-
const list_contact_requests_result = {
|
|
1010
|
-
type: 'object',
|
|
1011
|
-
description: 'Pending inbound requests, newest first, capped at 100. Items are '
|
|
1012
|
-
+ 'SerializedContactRequest (backend-contracts contactRequest.ts). Read-only awareness: '
|
|
1013
|
-
+ "approval routes to the owner; agents cannot approve/reject.",
|
|
1014
|
-
required: ['requests'],
|
|
1015
|
-
additionalProperties: true,
|
|
1016
|
-
properties: {
|
|
1017
|
-
requests: {
|
|
1018
|
-
type: 'array',
|
|
1019
|
-
items: {
|
|
1020
|
-
type: 'object',
|
|
1021
|
-
required: ['id', 'requesterId', 'targetId', 'status', 'kind'],
|
|
1022
|
-
additionalProperties: true,
|
|
1023
|
-
properties: {
|
|
1024
|
-
id: { type: 'string' },
|
|
1025
|
-
requesterId: { type: 'string' },
|
|
1026
|
-
requesterName: { type: 'string' },
|
|
1027
|
-
targetId: { type: 'string' },
|
|
1028
|
-
status: { enum: ['pending', 'approved', 'rejected', 'expired'] },
|
|
1029
|
-
kind: { enum: ['dm', 'group_invite'] },
|
|
1030
|
-
message: { type: ['string', 'null'] },
|
|
1031
|
-
createdAt: { type: ['string', 'null'] },
|
|
1032
|
-
expiresAt: { type: ['string', 'null'] },
|
|
1033
|
-
},
|
|
1034
|
-
},
|
|
1035
|
-
},
|
|
1036
|
-
},
|
|
1037
|
-
};
|
|
1038
938
|
const list_conversations_input = {
|
|
1039
939
|
type: 'object',
|
|
1040
940
|
additionalProperties: false,
|
|
@@ -1128,7 +1028,6 @@ exports.CANON_VERBS_JSON_SCHEMA = {
|
|
|
1128
1028
|
+ 'deliberately NOT verbs — they stay host-mediated.',
|
|
1129
1029
|
$defs: {
|
|
1130
1030
|
messageId: messageIdDef,
|
|
1131
|
-
groupInviteRequirements: groupInviteRequirementsDef,
|
|
1132
1031
|
selfContext: selfContextDef,
|
|
1133
1032
|
sessionSelection: sessionSelectionDef,
|
|
1134
1033
|
mediaAttachment: mediaAttachmentDef,
|
|
@@ -1141,7 +1040,6 @@ exports.CANON_VERBS_JSON_SCHEMA = {
|
|
|
1141
1040
|
sessionRule: sessionRuleDef,
|
|
1142
1041
|
runtimeCard: runtimeCardDef,
|
|
1143
1042
|
native: exports.VERB_NATIVE_METADATA_JSON_SCHEMA,
|
|
1144
|
-
sessionConfig: exports.VERB_SESSION_CONFIG_JSON_SCHEMA,
|
|
1145
1043
|
send_to_input,
|
|
1146
1044
|
send_to_result,
|
|
1147
1045
|
request_input_input,
|
|
@@ -1170,8 +1068,6 @@ exports.CANON_VERBS_JSON_SCHEMA = {
|
|
|
1170
1068
|
leave_conversation_result,
|
|
1171
1069
|
list_contacts_input,
|
|
1172
1070
|
list_contacts_result,
|
|
1173
|
-
list_contact_requests_input,
|
|
1174
|
-
list_contact_requests_result,
|
|
1175
1071
|
list_conversations_input,
|
|
1176
1072
|
list_conversations_result,
|
|
1177
1073
|
no_reply_input,
|
package/dist/cjs/verbWire.js
CHANGED
|
@@ -47,7 +47,6 @@ exports.VERB_WIRE_ENVELOPE_FIELDS = {
|
|
|
47
47
|
'canonContactId',
|
|
48
48
|
'sourceConversationId',
|
|
49
49
|
'sessionSelection',
|
|
50
|
-
'sessionConfig',
|
|
51
50
|
'idempotencyKey',
|
|
52
51
|
'replyTo',
|
|
53
52
|
'replyToPosition',
|
|
@@ -116,7 +115,6 @@ exports.VERB_WIRE_ENVELOPE_FIELDS = {
|
|
|
116
115
|
optional: [],
|
|
117
116
|
},
|
|
118
117
|
list_contacts: { required: [], optional: [] },
|
|
119
|
-
list_contact_requests: { required: [], optional: [] },
|
|
120
118
|
list_conversations: { required: [], optional: ['limit'] },
|
|
121
119
|
no_reply: { required: [], optional: ['conversationId', 'messageId'] },
|
|
122
120
|
};
|
|
@@ -206,9 +204,6 @@ const wireEnvelopeDef = {
|
|
|
206
204
|
},
|
|
207
205
|
],
|
|
208
206
|
},
|
|
209
|
-
sessionConfig: {
|
|
210
|
-
oneOf: [verbSchemas_js_1.VERB_SESSION_CONFIG_JSON_SCHEMA, { type: 'null' }],
|
|
211
|
-
},
|
|
212
207
|
idempotencyKey: {
|
|
213
208
|
type: 'string',
|
|
214
209
|
pattern: verbContract_js_1.VERB_ID_PATTERNS.runtimeId,
|
|
@@ -342,7 +337,6 @@ function projectVerbIntentToWire(verb, intent, options) {
|
|
|
342
337
|
canonContactId: input.canonContactId,
|
|
343
338
|
sourceConversationId: input.sourceConversationId,
|
|
344
339
|
sessionSelection: input.sessionSelection,
|
|
345
|
-
sessionConfig: input.sessionConfig,
|
|
346
340
|
idempotencyKey: messageOptions.messageId,
|
|
347
341
|
replyTo: messageOptions.replyTo,
|
|
348
342
|
replyToPosition: messageOptions.replyToPosition,
|
|
@@ -469,8 +463,7 @@ function projectVerbIntentToWire(verb, intent, options) {
|
|
|
469
463
|
envelope = compact({ conversationId: input.conversationId });
|
|
470
464
|
break;
|
|
471
465
|
}
|
|
472
|
-
case 'list_contacts':
|
|
473
|
-
case 'list_contact_requests': {
|
|
466
|
+
case 'list_contacts': {
|
|
474
467
|
break;
|
|
475
468
|
}
|
|
476
469
|
case 'list_conversations': {
|
|
@@ -522,7 +515,6 @@ function mergeVerbWireToIntent(request) {
|
|
|
522
515
|
canonContactId: envelope.canonContactId,
|
|
523
516
|
sourceConversationId: envelope.sourceConversationId,
|
|
524
517
|
sessionSelection: envelope.sessionSelection,
|
|
525
|
-
sessionConfig: envelope.sessionConfig,
|
|
526
518
|
text: value.text,
|
|
527
519
|
selfContext: value.selfContext,
|
|
528
520
|
requestMessage: value.requestMessage,
|
|
@@ -615,7 +607,6 @@ function mergeVerbWireToIntent(request) {
|
|
|
615
607
|
case 'leave_conversation':
|
|
616
608
|
return compact({ conversationId: envelope.conversationId });
|
|
617
609
|
case 'list_contacts':
|
|
618
|
-
case 'list_contact_requests':
|
|
619
610
|
return {};
|
|
620
611
|
case 'list_conversations':
|
|
621
612
|
return compact({ limit: envelope.limit });
|
package/dist/communication.d.ts
CHANGED
|
@@ -32,6 +32,17 @@ export type CommunicateInput = {
|
|
|
32
32
|
targetConversationId: string;
|
|
33
33
|
messageId: string;
|
|
34
34
|
text?: string;
|
|
35
|
+
} | {
|
|
36
|
+
action: 'share_contact';
|
|
37
|
+
conversationId: string;
|
|
38
|
+
contactUserId: string;
|
|
39
|
+
text?: string;
|
|
40
|
+
messageId?: string;
|
|
41
|
+
} | {
|
|
42
|
+
action: 'manage_group_members';
|
|
43
|
+
conversationId: string;
|
|
44
|
+
userId: string;
|
|
45
|
+
operation: 'add' | 'remove';
|
|
35
46
|
};
|
|
36
47
|
export type CommunicateResult = {
|
|
37
48
|
status: 'messaged';
|
|
@@ -49,10 +60,6 @@ export type CommunicateResult = {
|
|
|
49
60
|
pending: Array<{
|
|
50
61
|
userId: string;
|
|
51
62
|
requestId: string;
|
|
52
|
-
requirements: {
|
|
53
|
-
policyApproval: boolean;
|
|
54
|
-
ownerSessionSetup: boolean;
|
|
55
|
-
};
|
|
56
63
|
}>;
|
|
57
64
|
skipped: Array<{
|
|
58
65
|
userId: string;
|
|
@@ -62,6 +69,17 @@ export type CommunicateResult = {
|
|
|
62
69
|
status: 'forwarded';
|
|
63
70
|
messageId: string;
|
|
64
71
|
targetConversationId: string;
|
|
72
|
+
} | {
|
|
73
|
+
status: 'shared';
|
|
74
|
+
conversationId: string;
|
|
75
|
+
messageId: string;
|
|
76
|
+
} | {
|
|
77
|
+
status: 'added' | 'removed';
|
|
78
|
+
conversationId: string;
|
|
79
|
+
userId: string;
|
|
80
|
+
} | {
|
|
81
|
+
status: 'approval_required';
|
|
82
|
+
reason: string;
|
|
65
83
|
} | {
|
|
66
84
|
status: 'blocked' | 'unavailable';
|
|
67
85
|
reason: string;
|
package/dist/communication.js
CHANGED
|
@@ -3,10 +3,6 @@ export function readCommunicationRule(value) {
|
|
|
3
3
|
if (value === 'open' || value === 'approval-required' || value === 'closed') {
|
|
4
4
|
return value;
|
|
5
5
|
}
|
|
6
|
-
// Existing owner-only records have the same outsider-facing meaning as
|
|
7
|
-
// closed; the agent owner bypass remains a separate server-side rule.
|
|
8
|
-
if (value === 'owner-only')
|
|
9
|
-
return 'closed';
|
|
10
6
|
return 'approval-required';
|
|
11
7
|
}
|
|
12
8
|
export function parseDirectConversationSelection(value) {
|
|
@@ -3,7 +3,7 @@ export declare function normalizeStoredString(value: unknown): string | null;
|
|
|
3
3
|
/**
|
|
4
4
|
* Firestore Timestamp-like -> ISO 8601, or null. Accepts only objects exposing
|
|
5
5
|
* `toDate()`. A raw `Date` is deliberately NOT accepted: that matches both call
|
|
6
|
-
* sites this replaced. `message.ts`
|
|
6
|
+
* sites this replaced. `message.ts` keeps its own
|
|
7
7
|
* Date-tolerant normalizers — a different contract, not this one.
|
|
8
8
|
*/
|
|
9
9
|
export declare function firestoreTimestampToISOString(value: unknown): string | null;
|
package/dist/firestoreValues.js
CHANGED
|
@@ -10,7 +10,7 @@ export function normalizeStoredString(value) {
|
|
|
10
10
|
/**
|
|
11
11
|
* Firestore Timestamp-like -> ISO 8601, or null. Accepts only objects exposing
|
|
12
12
|
* `toDate()`. A raw `Date` is deliberately NOT accepted: that matches both call
|
|
13
|
-
* sites this replaced. `message.ts`
|
|
13
|
+
* sites this replaced. `message.ts` keeps its own
|
|
14
14
|
* Date-tolerant normalizers — a different contract, not this one.
|
|
15
15
|
*/
|
|
16
16
|
export function firestoreTimestampToISOString(value) {
|
package/dist/index.d.ts
CHANGED
|
@@ -8,13 +8,12 @@ export * from './runtimeCardStorage.js';
|
|
|
8
8
|
export * from './turnProtocol.js';
|
|
9
9
|
export * from './agentBehaviorPolicy.js';
|
|
10
10
|
export * from './agentSearch.js';
|
|
11
|
-
export * from './contactRequest.js';
|
|
12
11
|
export * from './verbContract.js';
|
|
13
12
|
export * from './verbSchemas.js';
|
|
14
13
|
export * from './verbWire.js';
|
|
15
|
-
export * from './accessPolicy.js';
|
|
16
14
|
export * from './communication.js';
|
|
17
15
|
export * from './apiErrors.js';
|
|
18
16
|
export * from './firestoreValues.js';
|
|
19
17
|
export * from './moderation.js';
|
|
20
18
|
export * from './selfContext.js';
|
|
19
|
+
export * from './replyAuthority.js';
|
package/dist/index.js
CHANGED
|
@@ -8,13 +8,12 @@ export * from './runtimeCardStorage.js';
|
|
|
8
8
|
export * from './turnProtocol.js';
|
|
9
9
|
export * from './agentBehaviorPolicy.js';
|
|
10
10
|
export * from './agentSearch.js';
|
|
11
|
-
export * from './contactRequest.js';
|
|
12
11
|
export * from './verbContract.js';
|
|
13
12
|
export * from './verbSchemas.js';
|
|
14
13
|
export * from './verbWire.js';
|
|
15
|
-
export * from './accessPolicy.js';
|
|
16
14
|
export * from './communication.js';
|
|
17
15
|
export * from './apiErrors.js';
|
|
18
16
|
export * from './firestoreValues.js';
|
|
19
17
|
export * from './moderation.js';
|
|
20
18
|
export * from './selfContext.js';
|
|
19
|
+
export * from './replyAuthority.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opaque, server-issued authority for one agent reply to one inbound message.
|
|
3
|
+
*
|
|
4
|
+
* The stream delivers this beside the triggering message. Runtimes keep it out
|
|
5
|
+
* of model-visible schemas and return it only on the ordinary reply path.
|
|
6
|
+
*/
|
|
7
|
+
export interface AgentReplyAuthorityV1 {
|
|
8
|
+
schema: 'canon.agent-reply-authority.v1';
|
|
9
|
+
sourceMessageId: string;
|
|
10
|
+
token: string;
|
|
11
|
+
expiresAt: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/verbContract.d.ts
CHANGED
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
* `findVerbByteLimitViolations()` (or equivalent checks from the emitted
|
|
43
43
|
* canon-verbs.limits.json) after schema validation.
|
|
44
44
|
*/
|
|
45
|
-
import type { GroupInviteRequirements } from './contactRequest.js';
|
|
46
45
|
/** Identifier for this contract document. */
|
|
47
46
|
export declare const CANON_VERBS_SCHEMA_VERSION = "canon.verbs.v1";
|
|
48
47
|
/** $id of the emitted JSON Schema bundle. */
|
|
@@ -73,10 +72,7 @@ export declare const VERB_ID_PATTERNS: {
|
|
|
73
72
|
readonly sessionRuleToolPattern: "^[\\w.*:-]{1,128}$";
|
|
74
73
|
readonly runtimeCorrelationValue: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
|
|
75
74
|
readonly runtimeMethod: "^[A-Za-z0-9_][A-Za-z0-9_./:\\-]{0,255}$";
|
|
76
|
-
readonly runtimeOptionValue: "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$";
|
|
77
|
-
readonly workspaceOptionId: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
|
|
78
75
|
readonly runtimeHandleKey: "^[A-Za-z0-9_.:-]{1,80}$";
|
|
79
|
-
readonly runtimeControlId: "^[A-Za-z0-9_-]{1,80}$";
|
|
80
76
|
/** UUID issued by Canon's resumable-media session endpoint. */
|
|
81
77
|
readonly resumableUploadId: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$";
|
|
82
78
|
};
|
|
@@ -146,9 +142,6 @@ export declare const VERB_LIMITS: {
|
|
|
146
142
|
readonly nativeKeys: 24;
|
|
147
143
|
readonly nativeValueChars: 256;
|
|
148
144
|
readonly nativeHandles: 16;
|
|
149
|
-
/** Initial agent-session setup carried by send_to. */
|
|
150
|
-
readonly sessionConfigValues: 24;
|
|
151
|
-
readonly sessionConfigValueChars: 256;
|
|
152
145
|
/** Deadlines (functions/src/utils/runtimeRequestHelpers.ts). */
|
|
153
146
|
readonly minTimeoutMs: 1000;
|
|
154
147
|
/** input/card/plan ceiling (30 minutes). */
|
|
@@ -184,7 +177,7 @@ export declare const VERB_RATE_LIMITS: {
|
|
|
184
177
|
/** The one self-context type the platform accepts today. */
|
|
185
178
|
export declare const SELF_CONTEXT_TYPE = "cross_session";
|
|
186
179
|
/** Canonical verb names. */
|
|
187
|
-
export declare const CANON_VERB_NAMES: 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", "
|
|
180
|
+
export declare const CANON_VERB_NAMES: 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"];
|
|
188
181
|
export type CanonVerbName = (typeof CANON_VERB_NAMES)[number];
|
|
189
182
|
/** Private note-to-self attached to a cross-conversation send. */
|
|
190
183
|
export interface VerbSelfContext {
|
|
@@ -202,20 +195,6 @@ export type VerbSessionSelection = {
|
|
|
202
195
|
mode: 'specific';
|
|
203
196
|
conversationId: string;
|
|
204
197
|
};
|
|
205
|
-
/**
|
|
206
|
-
* Public setup policy for the target agent session. Every value is a stable
|
|
207
|
-
* runtime-advertised option id, never a label, prompt, path, or other free
|
|
208
|
-
* text. The server also validates each selection against the target's live
|
|
209
|
-
* descriptor before creating a session.
|
|
210
|
-
*/
|
|
211
|
-
export interface VerbSessionConfig {
|
|
212
|
-
model?: string;
|
|
213
|
-
permissionMode?: string;
|
|
214
|
-
effort?: string;
|
|
215
|
-
runtimeControlValues?: Record<string, string>;
|
|
216
|
-
workspaceId?: string;
|
|
217
|
-
executionMode?: 'worktree' | 'locked';
|
|
218
|
-
}
|
|
219
198
|
/**
|
|
220
199
|
* Bounded runtime correlation carried in the public wire envelope. These are
|
|
221
200
|
* opaque identifiers only; workspace paths, commands, prompts, summaries,
|
|
@@ -311,8 +290,6 @@ export interface SendToInput {
|
|
|
311
290
|
requestMessage?: string;
|
|
312
291
|
/** Only meaningful for user targets that are agents. Default: continue_or_create. */
|
|
313
292
|
sessionSelection?: VerbSessionSelection;
|
|
314
|
-
/** Coding-agent session setup; only applied when the target is an agent. */
|
|
315
|
-
sessionConfig?: VerbSessionConfig | null;
|
|
316
293
|
messageOptions?: VerbMessageOptions;
|
|
317
294
|
}
|
|
318
295
|
export type SendToResult = {
|
|
@@ -613,17 +590,16 @@ export interface CreateGroupInput {
|
|
|
613
590
|
export interface PendingGroupInviteResult {
|
|
614
591
|
userId: string;
|
|
615
592
|
requestId: string;
|
|
616
|
-
requirements: GroupInviteRequirements;
|
|
617
593
|
}
|
|
618
594
|
export interface CreateGroupResult {
|
|
619
595
|
status: 'created';
|
|
620
596
|
conversationId: string;
|
|
621
597
|
/** Members admitted synchronously during creation. */
|
|
622
598
|
added: string[];
|
|
623
|
-
/** group_invite requests awaiting policy approval
|
|
599
|
+
/** group_invite requests awaiting exact policy approval. */
|
|
624
600
|
pending: PendingGroupInviteResult[];
|
|
625
601
|
/** Members the staged create could not admit: hard policy denials
|
|
626
|
-
* (
|
|
602
|
+
* (closed, blocked, inactive, not-found, …). */
|
|
627
603
|
skipped: Array<{
|
|
628
604
|
userId: string;
|
|
629
605
|
reason: string;
|
|
@@ -635,25 +611,16 @@ export interface CreateGroupResult {
|
|
|
635
611
|
* invite is allowed; the error detail carries the attempted partition.
|
|
636
612
|
*/
|
|
637
613
|
export declare const CREATE_GROUP_NO_ADDABLE_MEMBERS_CODE = "CREATE_GROUP_NO_ADDABLE_MEMBERS";
|
|
638
|
-
/**
|
|
639
|
-
* Error code on the 403 a create_group receives when the CREATOR itself is
|
|
640
|
-
* a coding agent requiring explicit session setup: the group helper prepares
|
|
641
|
-
* session configs for every coding-agent member including the creator, and
|
|
642
|
-
* only the agent's human owner may provide them (v1 scoping — the owner
|
|
643
|
-
* creates the group from the app instead).
|
|
644
|
-
*/
|
|
645
|
-
export declare const CREATE_GROUP_CREATOR_SETUP_REQUIRED_CODE = "CREATE_GROUP_CREATOR_SETUP_REQUIRED";
|
|
646
614
|
export interface AddMemberInput {
|
|
647
615
|
conversationId: string;
|
|
648
616
|
userId: string;
|
|
649
617
|
}
|
|
650
|
-
/** Policy approval
|
|
618
|
+
/** Policy approval yields one exact pending group invite. */
|
|
651
619
|
export type AddMemberResult = {
|
|
652
620
|
status: 'added';
|
|
653
621
|
} | {
|
|
654
622
|
status: 'pending';
|
|
655
623
|
requestId: string;
|
|
656
|
-
requirements: GroupInviteRequirements;
|
|
657
624
|
};
|
|
658
625
|
export interface RemoveMemberInput {
|
|
659
626
|
conversationId: string;
|
|
@@ -680,11 +647,6 @@ export interface VerbContact {
|
|
|
680
647
|
export interface ListContactsResult {
|
|
681
648
|
contacts: VerbContact[];
|
|
682
649
|
}
|
|
683
|
-
export type ListContactRequestsInput = Record<string, never>;
|
|
684
|
-
/** Items are SerializedContactRequest (contactRequest.ts) — pending inbound only, newest first, capped at 100. */
|
|
685
|
-
export interface ListContactRequestsResult {
|
|
686
|
-
requests: unknown[];
|
|
687
|
-
}
|
|
688
650
|
export interface ListConversationsInput {
|
|
689
651
|
/** Optional client-side cap; the REST endpoint returns all memberships. */
|
|
690
652
|
limit?: number;
|
|
@@ -811,9 +773,6 @@ export declare const CANON_VERB_LIMITS_ARTIFACT: {
|
|
|
811
773
|
readonly nativeKeys: 24;
|
|
812
774
|
readonly nativeValueChars: 256;
|
|
813
775
|
readonly nativeHandles: 16;
|
|
814
|
-
/** Initial agent-session setup carried by send_to. */
|
|
815
|
-
readonly sessionConfigValues: 24;
|
|
816
|
-
readonly sessionConfigValueChars: 256;
|
|
817
776
|
/** Deadlines (functions/src/utils/runtimeRequestHelpers.ts). */
|
|
818
777
|
readonly minTimeoutMs: 1000;
|
|
819
778
|
/** input/card/plan ceiling (30 minutes). */
|
|
@@ -849,10 +808,7 @@ export declare const CANON_VERB_LIMITS_ARTIFACT: {
|
|
|
849
808
|
readonly sessionRuleToolPattern: "^[\\w.*:-]{1,128}$";
|
|
850
809
|
readonly runtimeCorrelationValue: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
|
|
851
810
|
readonly runtimeMethod: "^[A-Za-z0-9_][A-Za-z0-9_./:\\-]{0,255}$";
|
|
852
|
-
readonly runtimeOptionValue: "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$";
|
|
853
|
-
readonly workspaceOptionId: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
|
|
854
811
|
readonly runtimeHandleKey: "^[A-Za-z0-9_.:-]{1,80}$";
|
|
855
|
-
readonly runtimeControlId: "^[A-Za-z0-9_-]{1,80}$";
|
|
856
812
|
/** UUID issued by Canon's resumable-media session endpoint. */
|
|
857
813
|
readonly resumableUploadId: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$";
|
|
858
814
|
};
|
package/dist/verbContract.js
CHANGED
|
@@ -72,10 +72,7 @@ export const VERB_ID_PATTERNS = {
|
|
|
72
72
|
sessionRuleToolPattern: '^[\\w.*:-]{1,128}$',
|
|
73
73
|
runtimeCorrelationValue: '^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$',
|
|
74
74
|
runtimeMethod: '^[A-Za-z0-9_][A-Za-z0-9_./:\\-]{0,255}$',
|
|
75
|
-
runtimeOptionValue: '^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$',
|
|
76
|
-
workspaceOptionId: '^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$',
|
|
77
75
|
runtimeHandleKey: '^[A-Za-z0-9_.:-]{1,80}$',
|
|
78
|
-
runtimeControlId: '^[A-Za-z0-9_-]{1,80}$',
|
|
79
76
|
/** UUID issued by Canon's resumable-media session endpoint. */
|
|
80
77
|
resumableUploadId: '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$',
|
|
81
78
|
};
|
|
@@ -145,9 +142,6 @@ export const VERB_LIMITS = {
|
|
|
145
142
|
nativeKeys: 24,
|
|
146
143
|
nativeValueChars: 256,
|
|
147
144
|
nativeHandles: 16,
|
|
148
|
-
/** Initial agent-session setup carried by send_to. */
|
|
149
|
-
sessionConfigValues: 24,
|
|
150
|
-
sessionConfigValueChars: 256,
|
|
151
145
|
/** Deadlines (functions/src/utils/runtimeRequestHelpers.ts). */
|
|
152
146
|
minTimeoutMs: 1000,
|
|
153
147
|
/** input/card/plan ceiling (30 minutes). */
|
|
@@ -198,7 +192,6 @@ export const CANON_VERB_NAMES = [
|
|
|
198
192
|
'remove_member',
|
|
199
193
|
'leave_conversation',
|
|
200
194
|
'list_contacts',
|
|
201
|
-
'list_contact_requests',
|
|
202
195
|
'list_conversations',
|
|
203
196
|
'no_reply',
|
|
204
197
|
];
|
|
@@ -267,14 +260,6 @@ export function normalizeVerbNativeMetadata(value) {
|
|
|
267
260
|
* invite is allowed; the error detail carries the attempted partition.
|
|
268
261
|
*/
|
|
269
262
|
export const CREATE_GROUP_NO_ADDABLE_MEMBERS_CODE = 'CREATE_GROUP_NO_ADDABLE_MEMBERS';
|
|
270
|
-
/**
|
|
271
|
-
* Error code on the 403 a create_group receives when the CREATOR itself is
|
|
272
|
-
* a coding agent requiring explicit session setup: the group helper prepares
|
|
273
|
-
* session configs for every coding-agent member including the creator, and
|
|
274
|
-
* only the agent's human owner may provide them (v1 scoping — the owner
|
|
275
|
-
* creates the group from the app instead).
|
|
276
|
-
*/
|
|
277
|
-
export const CREATE_GROUP_CREATOR_SETUP_REQUIRED_CODE = 'CREATE_GROUP_CREATOR_SETUP_REQUIRED';
|
|
278
263
|
/**
|
|
279
264
|
* The `note` the server returns on a `no_reply` ack — the model's closure
|
|
280
265
|
* sentence. It lives here, not in a host, because every binding surfaces the
|