@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/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Node.js 18+. Ships both ESM and CommonJS builds — Cloud Functions consume the
|
|
|
16
16
|
|
|
17
17
|
## What is in it
|
|
18
18
|
|
|
19
|
-
**The verb contract.** `canon.verbs.v1` (`verbContract.ts`) is the plaintext *intent* schema —
|
|
19
|
+
**The verb contract.** `canon.verbs.v1` (`verbContract.ts`) is the plaintext *intent* schema — seventeen verbs, their input and result schemas, byte limits, and rate limits. `canon.verb-wire.v1` (`verbWire.ts`) is what actually crosses the network: a server-readable envelope plus a body that is either `{ encoding: 'json', value }` or `{ encoding: 'mls', … }`. `projectVerbIntentToWire` and `mergeVerbWireToIntent` are the two halves of that split, so bindings and the server never disagree about which fields are envelope and which are content.
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
22
|
import {
|
|
@@ -32,9 +32,9 @@ The JSON Schemas are also emitted as files for non-JavaScript consumers: `@canon
|
|
|
32
32
|
|
|
33
33
|
**Message and media serialization.** The canonical `SerializedContentType` union (`text | image | audio | video | file | contact_card | interaction`), attachment normalization, and the single runtime-card decoder that `@canonmsg/core` re-exports rather than reimplements.
|
|
34
34
|
|
|
35
|
-
**Behavior policy
|
|
35
|
+
**Behavior policy.** The participation evaluator the stream service runs before dispatching a turn.
|
|
36
36
|
|
|
37
|
-
**Server-side normalizers.** `
|
|
37
|
+
**Server-side normalizers.** `readCommunicationRule` resolves a stored communication-policy field to `open | approval-required | closed`, defaulting to `approval-required` rather than widening to `open`. `serializeSelfContext` is the agent-facing projection of a stored self-context. `readModerationStatus` is the single definition of an ejected account. All take plain document-shaped data — the package still performs no I/O.
|
|
38
38
|
|
|
39
39
|
**Environments.** `CANON_ENVIRONMENT_CONTRACTS` binds `canon-dev-v1` and `canon-prod-v1` to their project and region; `getCanonEnvironmentContract` rejects anything else rather than defaulting.
|
|
40
40
|
|
|
@@ -31,9 +31,7 @@
|
|
|
31
31
|
"remove_member",
|
|
32
32
|
"leave_conversation",
|
|
33
33
|
"list_contacts",
|
|
34
|
-
"list_contact_requests",
|
|
35
34
|
"list_conversations",
|
|
36
|
-
"cancel_contact_request",
|
|
37
35
|
"no_reply"
|
|
38
36
|
]
|
|
39
37
|
},
|
|
@@ -213,71 +211,6 @@
|
|
|
213
211
|
}
|
|
214
212
|
]
|
|
215
213
|
},
|
|
216
|
-
"sessionConfig": {
|
|
217
|
-
"oneOf": [
|
|
218
|
-
{
|
|
219
|
-
"type": "object",
|
|
220
|
-
"description": "Typed setup policy for an agent target. Values are stable runtime-advertised option ids and are validated against the target descriptor before session creation; labels, prompts, workspace paths, and arbitrary fields are not permitted.",
|
|
221
|
-
"additionalProperties": false,
|
|
222
|
-
"properties": {
|
|
223
|
-
"model": {
|
|
224
|
-
"type": "string",
|
|
225
|
-
"pattern": "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$",
|
|
226
|
-
"maxLength": 256
|
|
227
|
-
},
|
|
228
|
-
"permissionMode": {
|
|
229
|
-
"type": "string",
|
|
230
|
-
"pattern": "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$",
|
|
231
|
-
"maxLength": 256
|
|
232
|
-
},
|
|
233
|
-
"effort": {
|
|
234
|
-
"type": "string",
|
|
235
|
-
"pattern": "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$",
|
|
236
|
-
"maxLength": 256
|
|
237
|
-
},
|
|
238
|
-
"workspaceId": {
|
|
239
|
-
"type": "string",
|
|
240
|
-
"pattern": "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$",
|
|
241
|
-
"maxLength": 256
|
|
242
|
-
},
|
|
243
|
-
"executionMode": {
|
|
244
|
-
"enum": [
|
|
245
|
-
"worktree",
|
|
246
|
-
"locked"
|
|
247
|
-
]
|
|
248
|
-
},
|
|
249
|
-
"runtimeControlValues": {
|
|
250
|
-
"type": "object",
|
|
251
|
-
"maxProperties": 24,
|
|
252
|
-
"propertyNames": {
|
|
253
|
-
"pattern": "^[A-Za-z0-9_-]{1,80}$",
|
|
254
|
-
"not": {
|
|
255
|
-
"enum": [
|
|
256
|
-
"model",
|
|
257
|
-
"workspace",
|
|
258
|
-
"executionMode",
|
|
259
|
-
"permissionMode",
|
|
260
|
-
"effort",
|
|
261
|
-
"interrupt",
|
|
262
|
-
"runtimeControlValues",
|
|
263
|
-
"updatedAt",
|
|
264
|
-
"updatedBy"
|
|
265
|
-
]
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
"additionalProperties": {
|
|
269
|
-
"type": "string",
|
|
270
|
-
"pattern": "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$",
|
|
271
|
-
"maxLength": 256
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
"type": "null"
|
|
278
|
-
}
|
|
279
|
-
]
|
|
280
|
-
},
|
|
281
214
|
"idempotencyKey": {
|
|
282
215
|
"type": "string",
|
|
283
216
|
"pattern": "^[A-Za-z0-9_.:-]{1,160}$",
|
|
@@ -428,10 +361,6 @@
|
|
|
428
361
|
"null"
|
|
429
362
|
]
|
|
430
363
|
},
|
|
431
|
-
"sourceMessageId": {
|
|
432
|
-
"type": "string",
|
|
433
|
-
"minLength": 1
|
|
434
|
-
},
|
|
435
364
|
"turnSemantics": {
|
|
436
365
|
"enum": [
|
|
437
366
|
"progress",
|
|
@@ -511,9 +440,7 @@
|
|
|
511
440
|
"remove_member",
|
|
512
441
|
"leave_conversation",
|
|
513
442
|
"list_contacts",
|
|
514
|
-
"list_contact_requests",
|
|
515
443
|
"list_conversations",
|
|
516
|
-
"cancel_contact_request",
|
|
517
444
|
"no_reply"
|
|
518
445
|
]
|
|
519
446
|
},
|
|
@@ -38,8 +38,6 @@
|
|
|
38
38
|
"nativeKeys": 24,
|
|
39
39
|
"nativeValueChars": 256,
|
|
40
40
|
"nativeHandles": 16,
|
|
41
|
-
"sessionConfigValues": 24,
|
|
42
|
-
"sessionConfigValueChars": 256,
|
|
43
41
|
"minTimeoutMs": 1000,
|
|
44
42
|
"maxTimeoutMs": 1800000,
|
|
45
43
|
"maxApprovalTimeoutMs": 259200000,
|
|
@@ -61,10 +59,7 @@
|
|
|
61
59
|
"sessionRuleToolPattern": "^[\\w.*:-]{1,128}$",
|
|
62
60
|
"runtimeCorrelationValue": "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$",
|
|
63
61
|
"runtimeMethod": "^[A-Za-z0-9_][A-Za-z0-9_./:\\-]{0,255}$",
|
|
64
|
-
"runtimeOptionValue": "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$",
|
|
65
|
-
"workspaceOptionId": "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$",
|
|
66
62
|
"runtimeHandleKey": "^[A-Za-z0-9_.:-]{1,80}$",
|
|
67
|
-
"runtimeControlId": "^[A-Za-z0-9_-]{1,80}$",
|
|
68
63
|
"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}$"
|
|
69
64
|
},
|
|
70
65
|
"byteSemantics": {
|
|
@@ -13,23 +13,6 @@
|
|
|
13
13
|
},
|
|
14
14
|
"description": "Client idempotency key (<= 160 chars / 256 UTF-8 bytes; no slashes, control chars, '.', '..', __x__). Same id + identical payload replays idempotently; different payload -> 409 MESSAGE_ID_EXISTS."
|
|
15
15
|
},
|
|
16
|
-
"groupInviteRequirements": {
|
|
17
|
-
"type": "object",
|
|
18
|
-
"description": "Independent gates on a pending group invite. policyApproval is social consent; ownerSessionSetup means the agent owner must choose the runtime session configuration before membership is activated.",
|
|
19
|
-
"required": [
|
|
20
|
-
"policyApproval",
|
|
21
|
-
"ownerSessionSetup"
|
|
22
|
-
],
|
|
23
|
-
"additionalProperties": false,
|
|
24
|
-
"properties": {
|
|
25
|
-
"policyApproval": {
|
|
26
|
-
"type": "boolean"
|
|
27
|
-
},
|
|
28
|
-
"ownerSessionSetup": {
|
|
29
|
-
"type": "boolean"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
16
|
"selfContext": {
|
|
34
17
|
"type": "object",
|
|
35
18
|
"description": "Private note-to-self attached to a cross-conversation send. Visible only to the sending agent (surfaced back as provenance.activeSelfContext); never shown to recipients. Enforced by functions/src/utils/selfContexts.ts.",
|
|
@@ -557,67 +540,9 @@
|
|
|
557
540
|
}
|
|
558
541
|
}
|
|
559
542
|
},
|
|
560
|
-
"sessionConfig": {
|
|
561
|
-
"type": "object",
|
|
562
|
-
"description": "Typed setup policy for an agent target. Values are stable runtime-advertised option ids and are validated against the target descriptor before session creation; labels, prompts, workspace paths, and arbitrary fields are not permitted.",
|
|
563
|
-
"additionalProperties": false,
|
|
564
|
-
"properties": {
|
|
565
|
-
"model": {
|
|
566
|
-
"type": "string",
|
|
567
|
-
"pattern": "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$",
|
|
568
|
-
"maxLength": 256
|
|
569
|
-
},
|
|
570
|
-
"permissionMode": {
|
|
571
|
-
"type": "string",
|
|
572
|
-
"pattern": "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$",
|
|
573
|
-
"maxLength": 256
|
|
574
|
-
},
|
|
575
|
-
"effort": {
|
|
576
|
-
"type": "string",
|
|
577
|
-
"pattern": "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$",
|
|
578
|
-
"maxLength": 256
|
|
579
|
-
},
|
|
580
|
-
"workspaceId": {
|
|
581
|
-
"type": "string",
|
|
582
|
-
"pattern": "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$",
|
|
583
|
-
"maxLength": 256
|
|
584
|
-
},
|
|
585
|
-
"executionMode": {
|
|
586
|
-
"enum": [
|
|
587
|
-
"worktree",
|
|
588
|
-
"locked"
|
|
589
|
-
]
|
|
590
|
-
},
|
|
591
|
-
"runtimeControlValues": {
|
|
592
|
-
"type": "object",
|
|
593
|
-
"maxProperties": 24,
|
|
594
|
-
"propertyNames": {
|
|
595
|
-
"pattern": "^[A-Za-z0-9_-]{1,80}$",
|
|
596
|
-
"not": {
|
|
597
|
-
"enum": [
|
|
598
|
-
"model",
|
|
599
|
-
"workspace",
|
|
600
|
-
"executionMode",
|
|
601
|
-
"permissionMode",
|
|
602
|
-
"effort",
|
|
603
|
-
"interrupt",
|
|
604
|
-
"runtimeControlValues",
|
|
605
|
-
"updatedAt",
|
|
606
|
-
"updatedBy"
|
|
607
|
-
]
|
|
608
|
-
}
|
|
609
|
-
},
|
|
610
|
-
"additionalProperties": {
|
|
611
|
-
"type": "string",
|
|
612
|
-
"pattern": "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$",
|
|
613
|
-
"maxLength": 256
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
},
|
|
618
543
|
"send_to_input": {
|
|
619
544
|
"type": "object",
|
|
620
|
-
"description": "Message another conversation or user (admission-aware), optionally carrying a private self-context. Exactly one of targetConversationId / targetUserId / canonContactId. canonContactId is NOT a wire field: bindings resolve it via POST /admission/resolve to a targetUserId first. Projections: selfContext sends -> POST /messages/send-contextual (which requires sourceConversationId + selfContext); known-conversation sends without selfContext -> POST /messages/send; plain user sends -> admission resolve + create + send (the core reachOut composite). User targets resolve admission first: open targets get the message, approval-required targets get a contact request (send deferred and auto-fulfilled on approval),
|
|
545
|
+
"description": "Message another conversation or user (admission-aware), optionally carrying a private self-context. Exactly one of targetConversationId / targetUserId / canonContactId. canonContactId is NOT a wire field: bindings resolve it via POST /admission/resolve to a targetUserId first. Projections: selfContext sends -> POST /messages/send-contextual (which requires sourceConversationId + selfContext); known-conversation sends without selfContext -> POST /messages/send; plain user sends -> admission resolve + create + send (the core reachOut composite). User targets resolve admission first: open targets get the message, approval-required targets get a contact request (send deferred and auto-fulfilled on approval), closed targets surface as status 'unavailable' with reason closed.",
|
|
621
546
|
"additionalProperties": false,
|
|
622
547
|
"properties": {
|
|
623
548
|
"targetConversationId": {
|
|
@@ -653,17 +578,6 @@
|
|
|
653
578
|
"sessionSelection": {
|
|
654
579
|
"$ref": "#/$defs/sessionSelection"
|
|
655
580
|
},
|
|
656
|
-
"sessionConfig": {
|
|
657
|
-
"oneOf": [
|
|
658
|
-
{
|
|
659
|
-
"$ref": "#/$defs/sessionConfig"
|
|
660
|
-
},
|
|
661
|
-
{
|
|
662
|
-
"type": "null"
|
|
663
|
-
}
|
|
664
|
-
],
|
|
665
|
-
"description": "Coding-agent session setup (model/permissionMode/effort/workspaceId/executionMode); only applied to agent targets, stripped for humans."
|
|
666
|
-
},
|
|
667
581
|
"messageOptions": {
|
|
668
582
|
"$ref": "#/$defs/messageOptions"
|
|
669
583
|
}
|
|
@@ -1511,7 +1425,7 @@
|
|
|
1511
1425
|
},
|
|
1512
1426
|
"create_group_input": {
|
|
1513
1427
|
"type": "object",
|
|
1514
|
-
"description": "Create a group conversation. Each target's groupJoinPolicy is enforced server-side with staged admission: directly-addable members join at creation, approval-required members become pending group_invite requests;
|
|
1428
|
+
"description": "Create a group conversation. Each target's groupJoinPolicy is enforced server-side with staged admission: directly-addable members join at creation, approval-required members become pending group_invite requests; hard-denied members are skipped (see the result). A creator-only group is valid when at least one requested member has a pending invite. Under MLS, membership changes are Add/Remove proposals + Commit — a group operation is a cryptographic state change, not a codec swap.",
|
|
1515
1429
|
"required": [
|
|
1516
1430
|
"name",
|
|
1517
1431
|
"memberIds"
|
|
@@ -1537,7 +1451,7 @@
|
|
|
1537
1451
|
},
|
|
1538
1452
|
"create_group_result": {
|
|
1539
1453
|
"type": "object",
|
|
1540
|
-
"description": "Staged admission: the group exists with the directly-added members; `pending` lists group_invite requests awaiting policy approval
|
|
1454
|
+
"description": "Staged admission: the group exists with the directly-added members; `pending` lists group_invite requests awaiting policy approval; `skipped` lists hard-denied targets.",
|
|
1541
1455
|
"required": [
|
|
1542
1456
|
"status",
|
|
1543
1457
|
"conversationId",
|
|
@@ -1565,8 +1479,7 @@
|
|
|
1565
1479
|
"type": "object",
|
|
1566
1480
|
"required": [
|
|
1567
1481
|
"userId",
|
|
1568
|
-
"requestId"
|
|
1569
|
-
"requirements"
|
|
1482
|
+
"requestId"
|
|
1570
1483
|
],
|
|
1571
1484
|
"additionalProperties": true,
|
|
1572
1485
|
"properties": {
|
|
@@ -1575,9 +1488,6 @@
|
|
|
1575
1488
|
},
|
|
1576
1489
|
"requestId": {
|
|
1577
1490
|
"type": "string"
|
|
1578
|
-
},
|
|
1579
|
-
"requirements": {
|
|
1580
|
-
"$ref": "#/$defs/groupInviteRequirements"
|
|
1581
1491
|
}
|
|
1582
1492
|
}
|
|
1583
1493
|
}
|
|
@@ -1605,7 +1515,7 @@
|
|
|
1605
1515
|
},
|
|
1606
1516
|
"add_member_input": {
|
|
1607
1517
|
"type": "object",
|
|
1608
|
-
"description": "A target needing policy approval
|
|
1518
|
+
"description": "A target needing policy approval yields one pending group_invite. Under MLS an add is an Add proposal + Commit (new epoch), not a server-side membership write — the verb semantics are stable, the mechanism is not.",
|
|
1609
1519
|
"required": [
|
|
1610
1520
|
"conversationId",
|
|
1611
1521
|
"userId"
|
|
@@ -1623,7 +1533,7 @@
|
|
|
1623
1533
|
}
|
|
1624
1534
|
},
|
|
1625
1535
|
"add_member_result": {
|
|
1626
|
-
"description": "Targets needing policy approval
|
|
1536
|
+
"description": "Targets needing policy approval yield an exact pending group invite.",
|
|
1627
1537
|
"oneOf": [
|
|
1628
1538
|
{
|
|
1629
1539
|
"type": "object",
|
|
@@ -1641,8 +1551,7 @@
|
|
|
1641
1551
|
"type": "object",
|
|
1642
1552
|
"required": [
|
|
1643
1553
|
"status",
|
|
1644
|
-
"requestId"
|
|
1645
|
-
"requirements"
|
|
1554
|
+
"requestId"
|
|
1646
1555
|
],
|
|
1647
1556
|
"additionalProperties": true,
|
|
1648
1557
|
"properties": {
|
|
@@ -1651,9 +1560,6 @@
|
|
|
1651
1560
|
},
|
|
1652
1561
|
"requestId": {
|
|
1653
1562
|
"type": "string"
|
|
1654
|
-
},
|
|
1655
|
-
"requirements": {
|
|
1656
|
-
"$ref": "#/$defs/groupInviteRequirements"
|
|
1657
1563
|
}
|
|
1658
1564
|
}
|
|
1659
1565
|
}
|
|
@@ -1764,109 +1670,6 @@
|
|
|
1764
1670
|
}
|
|
1765
1671
|
}
|
|
1766
1672
|
},
|
|
1767
|
-
"list_contact_requests_input": {
|
|
1768
|
-
"type": "object",
|
|
1769
|
-
"additionalProperties": false,
|
|
1770
|
-
"properties": {
|
|
1771
|
-
"direction": {
|
|
1772
|
-
"enum": [
|
|
1773
|
-
"inbound",
|
|
1774
|
-
"outbound"
|
|
1775
|
-
]
|
|
1776
|
-
},
|
|
1777
|
-
"includeResolved": {
|
|
1778
|
-
"type": "boolean"
|
|
1779
|
-
},
|
|
1780
|
-
"limit": {
|
|
1781
|
-
"type": "integer",
|
|
1782
|
-
"minimum": 1,
|
|
1783
|
-
"maximum": 100
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
},
|
|
1787
|
-
"list_contact_requests_result": {
|
|
1788
|
-
"type": "object",
|
|
1789
|
-
"description": "Contact requests, newest first, capped at 100. Defaults to pending inbound; requesters use direction=outbound with includeResolved=true to recover lifecycle state. Items are SerializedContactRequest (backend-contracts contactRequest.ts).",
|
|
1790
|
-
"required": [
|
|
1791
|
-
"requests"
|
|
1792
|
-
],
|
|
1793
|
-
"additionalProperties": true,
|
|
1794
|
-
"properties": {
|
|
1795
|
-
"requests": {
|
|
1796
|
-
"type": "array",
|
|
1797
|
-
"items": {
|
|
1798
|
-
"type": "object",
|
|
1799
|
-
"required": [
|
|
1800
|
-
"id",
|
|
1801
|
-
"requesterId",
|
|
1802
|
-
"targetId",
|
|
1803
|
-
"status",
|
|
1804
|
-
"kind",
|
|
1805
|
-
"phase"
|
|
1806
|
-
],
|
|
1807
|
-
"additionalProperties": true,
|
|
1808
|
-
"properties": {
|
|
1809
|
-
"id": {
|
|
1810
|
-
"type": "string"
|
|
1811
|
-
},
|
|
1812
|
-
"requesterId": {
|
|
1813
|
-
"type": "string"
|
|
1814
|
-
},
|
|
1815
|
-
"requesterName": {
|
|
1816
|
-
"type": "string"
|
|
1817
|
-
},
|
|
1818
|
-
"targetId": {
|
|
1819
|
-
"type": "string"
|
|
1820
|
-
},
|
|
1821
|
-
"status": {
|
|
1822
|
-
"enum": [
|
|
1823
|
-
"pending",
|
|
1824
|
-
"approved",
|
|
1825
|
-
"rejected",
|
|
1826
|
-
"expired",
|
|
1827
|
-
"cancelled"
|
|
1828
|
-
]
|
|
1829
|
-
},
|
|
1830
|
-
"kind": {
|
|
1831
|
-
"enum": [
|
|
1832
|
-
"dm",
|
|
1833
|
-
"group_invite"
|
|
1834
|
-
]
|
|
1835
|
-
},
|
|
1836
|
-
"phase": {
|
|
1837
|
-
"enum": [
|
|
1838
|
-
"awaiting_owner",
|
|
1839
|
-
"starting",
|
|
1840
|
-
"connected",
|
|
1841
|
-
"rejected",
|
|
1842
|
-
"expired",
|
|
1843
|
-
"cancelled",
|
|
1844
|
-
"failed"
|
|
1845
|
-
]
|
|
1846
|
-
},
|
|
1847
|
-
"message": {
|
|
1848
|
-
"type": [
|
|
1849
|
-
"string",
|
|
1850
|
-
"null"
|
|
1851
|
-
]
|
|
1852
|
-
},
|
|
1853
|
-
"createdAt": {
|
|
1854
|
-
"type": [
|
|
1855
|
-
"string",
|
|
1856
|
-
"null"
|
|
1857
|
-
]
|
|
1858
|
-
},
|
|
1859
|
-
"expiresAt": {
|
|
1860
|
-
"type": [
|
|
1861
|
-
"string",
|
|
1862
|
-
"null"
|
|
1863
|
-
]
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
}
|
|
1869
|
-
},
|
|
1870
1673
|
"list_conversations_input": {
|
|
1871
1674
|
"type": "object",
|
|
1872
1675
|
"additionalProperties": false,
|
|
@@ -1977,35 +1780,6 @@
|
|
|
1977
1780
|
}
|
|
1978
1781
|
}
|
|
1979
1782
|
},
|
|
1980
|
-
"cancel_contact_request_input": {
|
|
1981
|
-
"type": "object",
|
|
1982
|
-
"required": [
|
|
1983
|
-
"requestId"
|
|
1984
|
-
],
|
|
1985
|
-
"additionalProperties": false,
|
|
1986
|
-
"properties": {
|
|
1987
|
-
"requestId": {
|
|
1988
|
-
"type": "string",
|
|
1989
|
-
"pattern": "^[A-Za-z0-9_.:-]{1,160}$"
|
|
1990
|
-
}
|
|
1991
|
-
}
|
|
1992
|
-
},
|
|
1993
|
-
"cancel_contact_request_result": {
|
|
1994
|
-
"type": "object",
|
|
1995
|
-
"required": [
|
|
1996
|
-
"status",
|
|
1997
|
-
"requestId"
|
|
1998
|
-
],
|
|
1999
|
-
"additionalProperties": true,
|
|
2000
|
-
"properties": {
|
|
2001
|
-
"status": {
|
|
2002
|
-
"const": "cancelled"
|
|
2003
|
-
},
|
|
2004
|
-
"requestId": {
|
|
2005
|
-
"type": "string"
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
},
|
|
2009
1783
|
"no_reply_input": {
|
|
2010
1784
|
"type": "object",
|
|
2011
1785
|
"description": "End this turn without posting anything to the conversation. Nothing is rendered and no other member or agent is triggered.",
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readCommunicationRule = readCommunicationRule;
|
|
4
|
+
exports.parseDirectConversationSelection = parseDirectConversationSelection;
|
|
5
|
+
/** Missing or invalid policy never widens access. */
|
|
6
|
+
function readCommunicationRule(value) {
|
|
7
|
+
if (value === 'open' || value === 'approval-required' || value === 'closed') {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
return 'approval-required';
|
|
11
|
+
}
|
|
12
|
+
function parseDirectConversationSelection(value) {
|
|
13
|
+
if (value == null)
|
|
14
|
+
return { mode: 'latest_or_new' };
|
|
15
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
16
|
+
throw new Error('selection must be an object');
|
|
17
|
+
}
|
|
18
|
+
const record = value;
|
|
19
|
+
if (record.mode === 'latest_or_new' || record.mode === 'new') {
|
|
20
|
+
return { mode: record.mode };
|
|
21
|
+
}
|
|
22
|
+
if (record.mode === 'specific') {
|
|
23
|
+
const conversationId = typeof record.conversationId === 'string'
|
|
24
|
+
? record.conversationId.trim()
|
|
25
|
+
: '';
|
|
26
|
+
if (!conversationId)
|
|
27
|
+
throw new Error('selection.conversationId is required');
|
|
28
|
+
return { mode: 'specific', conversationId };
|
|
29
|
+
}
|
|
30
|
+
throw new Error('selection.mode is invalid');
|
|
31
|
+
}
|
|
@@ -14,7 +14,7 @@ function normalizeStoredString(value) {
|
|
|
14
14
|
/**
|
|
15
15
|
* Firestore Timestamp-like -> ISO 8601, or null. Accepts only objects exposing
|
|
16
16
|
* `toDate()`. A raw `Date` is deliberately NOT accepted: that matches both call
|
|
17
|
-
* sites this replaced. `message.ts`
|
|
17
|
+
* sites this replaced. `message.ts` keeps its own
|
|
18
18
|
* Date-tolerant normalizers — a different contract, not this one.
|
|
19
19
|
*/
|
|
20
20
|
function firestoreTimestampToISOString(value) {
|
package/dist/cjs/index.js
CHANGED
|
@@ -24,12 +24,12 @@ __exportStar(require("./runtimeCardStorage.js"), exports);
|
|
|
24
24
|
__exportStar(require("./turnProtocol.js"), exports);
|
|
25
25
|
__exportStar(require("./agentBehaviorPolicy.js"), exports);
|
|
26
26
|
__exportStar(require("./agentSearch.js"), exports);
|
|
27
|
-
__exportStar(require("./contactRequest.js"), exports);
|
|
28
27
|
__exportStar(require("./verbContract.js"), exports);
|
|
29
28
|
__exportStar(require("./verbSchemas.js"), exports);
|
|
30
29
|
__exportStar(require("./verbWire.js"), exports);
|
|
31
|
-
__exportStar(require("./
|
|
30
|
+
__exportStar(require("./communication.js"), exports);
|
|
32
31
|
__exportStar(require("./apiErrors.js"), exports);
|
|
33
32
|
__exportStar(require("./firestoreValues.js"), exports);
|
|
34
33
|
__exportStar(require("./moderation.js"), exports);
|
|
35
34
|
__exportStar(require("./selfContext.js"), exports);
|
|
35
|
+
__exportStar(require("./replyAuthority.js"), exports);
|
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,9 +198,7 @@ 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
|
-
'cancel_contact_request',
|
|
210
202
|
'no_reply',
|
|
211
203
|
];
|
|
212
204
|
exports.VERB_NATIVE_METADATA_KEYS = [
|
|
@@ -274,14 +266,6 @@ function normalizeVerbNativeMetadata(value) {
|
|
|
274
266
|
* invite is allowed; the error detail carries the attempted partition.
|
|
275
267
|
*/
|
|
276
268
|
exports.CREATE_GROUP_NO_ADDABLE_MEMBERS_CODE = 'CREATE_GROUP_NO_ADDABLE_MEMBERS';
|
|
277
|
-
/**
|
|
278
|
-
* Error code on the 403 a create_group receives when the CREATOR itself is
|
|
279
|
-
* a coding agent requiring explicit session setup: the group helper prepares
|
|
280
|
-
* session configs for every coding-agent member including the creator, and
|
|
281
|
-
* only the agent's human owner may provide them (v1 scoping — the owner
|
|
282
|
-
* creates the group from the app instead).
|
|
283
|
-
*/
|
|
284
|
-
exports.CREATE_GROUP_CREATOR_SETUP_REQUIRED_CODE = 'CREATE_GROUP_CREATOR_SETUP_REQUIRED';
|
|
285
269
|
/**
|
|
286
270
|
* The `note` the server returns on a `no_reply` ack — the model's closure
|
|
287
271
|
* sentence. It lives here, not in a host, because every binding surfaces the
|