chat: register ConnectTarget + CEvtSimplexNameConflict in bot docs

Bot API docs generator failed with "Undefined type: ConnectTarget"
since f2394d121 (prior plan) flipped APIConnectPlan/Connect from
Maybe AConnectionLink to Maybe ConnectTarget without updating
bots/src/API/Docs/*. Also adds SimplexNameConflictEntity (new in
cd0de9659) and documents the CEvtSimplexNameConflict event for
peer-name displacement notifications. Regenerates the affected
markdown / TypeScript / Python artefacts.
This commit is contained in:
shum
2026-06-05 07:42:06 +00:00
parent 6c990696ca
commit 0d7ea80612
12 changed files with 210 additions and 27 deletions
+10 -10
View File
@@ -1363,28 +1363,28 @@ ChatCmdError: Command error (only used in WebSockets API).
### APIConnectPlan ### APIConnectPlan
Determine SimpleX link type and if the bot is already connected via this link. Determine SimpleX link type and if the bot is already connected via this link or name.
*Network usage*: interactive. *Network usage*: interactive.
**Parameters**: **Parameters**:
- userId: int64 - userId: int64
- connectionLink: string? - connectTarget: [ConnectTarget](./TYPES.md#connecttarget)?
- resolveKnown: bool - resolveKnown: bool
- linkOwnerSig: [LinkOwnerSig](./TYPES.md#linkownersig)? - linkOwnerSig: [LinkOwnerSig](./TYPES.md#linkownersig)?
**Syntax**: **Syntax**:
``` ```
/_connect plan <userId> <connectionLink> /_connect plan <userId> <connectTarget>
``` ```
```javascript ```javascript
'/_connect plan ' + userId + ' ' + connectionLink // JavaScript '/_connect plan ' + userId + ' ' + connectTarget // JavaScript
``` ```
```python ```python
'/_connect plan ' + str(userId) + ' ' + connectionLink # Python '/_connect plan ' + str(userId) + ' ' + str(connectTarget) # Python
``` ```
**Responses**: **Responses**:
@@ -1455,26 +1455,26 @@ ChatCmdError: Command error (only used in WebSockets API).
### Connect ### Connect
Connect via SimpleX link as string in the active user profile. Connect via SimpleX link or name as string in the active user profile.
*Network usage*: interactive. *Network usage*: interactive.
**Parameters**: **Parameters**:
- incognito: bool - incognito: bool
- connLink_: string? - connTarget_: [ConnectTarget](./TYPES.md#connecttarget)?
**Syntax**: **Syntax**:
``` ```
/connect[ <connLink_>] /connect[ <connTarget_>]
``` ```
```javascript ```javascript
'/connect' + (connLink_ ? ' ' + connLink_ : '') // JavaScript '/connect' + (connTarget_ ? ' ' + connTarget_ : '') // JavaScript
``` ```
```python ```python
'/connect' + ((' ' + connLink_) if connLink_ is not None else '') # Python '/connect' + ((' ' + str(connTarget_)) if connTarget_ is not None else '') # Python
``` ```
**Responses**: **Responses**:
+16
View File
@@ -10,6 +10,7 @@ This file is generated automatically.
- [ContactDeletedByContact](#contactdeletedbycontact) - [ContactDeletedByContact](#contactdeletedbycontact)
- [ReceivedContactRequest](#receivedcontactrequest) - [ReceivedContactRequest](#receivedcontactrequest)
- [NewMemberContactReceivedInv](#newmembercontactreceivedinv) - [NewMemberContactReceivedInv](#newmembercontactreceivedinv)
- [SimplexNameConflict](#simplexnameconflict)
- [ContactSndReady](#contactsndready) - [ContactSndReady](#contactsndready)
[Message events](#message-events) [Message events](#message-events)
@@ -160,6 +161,21 @@ This event only needs to be processed to associate contact with group, the conne
--- ---
### SimplexNameConflict
A peer's profile update claimed a SimpleX name (`#name.simplex` / `@name.simplex`) that was already held locally by another contact or group. The displaced row's `simplex_name` is set to NULL and the claim moves to the newer row; this event surfaces the displacement so the bot can warn the user about a possible impersonation.
**Record type**:
- type: "simplexNameConflict"
- user: [User](./TYPES.md#user)
- simplexName: [SimplexNameInfo](./TYPES.md#simplexnameinfo)
- entity: [SimplexNameConflictEntity](./TYPES.md#simplexnameconflictentity)
- claimedBy: string
- displacedFrom: string
---
### ContactSndReady ### ContactSndReady
Connecting via 1-time invitation or after accepting contact request. Connecting via 1-time invitation or after accepting contact request.
+46
View File
@@ -57,6 +57,7 @@ This file is generated automatically.
- [ComposedMessage](#composedmessage) - [ComposedMessage](#composedmessage)
- [ConnStatus](#connstatus) - [ConnStatus](#connstatus)
- [ConnType](#conntype) - [ConnType](#conntype)
- [ConnectTarget](#connecttarget)
- [Connection](#connection) - [Connection](#connection)
- [ConnectionEntity](#connectionentity) - [ConnectionEntity](#connectionentity)
- [ConnectionErrorType](#connectionerrortype) - [ConnectionErrorType](#connectionerrortype)
@@ -167,6 +168,7 @@ This file is generated automatically.
- [SecurityCode](#securitycode) - [SecurityCode](#securitycode)
- [SimplePreference](#simplepreference) - [SimplePreference](#simplepreference)
- [SimplexLinkType](#simplexlinktype) - [SimplexLinkType](#simplexlinktype)
- [SimplexNameConflictEntity](#simplexnameconflictentity)
- [SimplexNameDomain](#simplexnamedomain) - [SimplexNameDomain](#simplexnamedomain)
- [SimplexNameInfo](#simplexnameinfo) - [SimplexNameInfo](#simplexnameinfo)
- [SimplexNameType](#simplexnametype) - [SimplexNameType](#simplexnametype)
@@ -1055,6 +1057,18 @@ ChatStoreChanged:
InvalidConnReq: InvalidConnReq:
- type: "invalidConnReq" - type: "invalidConnReq"
SimplexNameNotFound:
- type: "simplexNameNotFound"
- simplexName: [SimplexNameInfo](#simplexnameinfo)
SimplexNameUnprepared:
- type: "simplexNameUnprepared"
- simplexName: [SimplexNameInfo](#simplexnameinfo)
SimplexNameResolverUnavailable:
- type: "simplexNameResolverUnavailable"
- simplexName: [SimplexNameInfo](#simplexnameinfo)
UnsupportedConnReq: UnsupportedConnReq:
- type: "unsupportedConnReq" - type: "unsupportedConnReq"
@@ -1588,6 +1602,23 @@ Failed:
- "user_contact" - "user_contact"
---
## ConnectTarget
Connect target: SimpleX link (`CTLink`) or SimpleX name (`CTName`). Wire form is the bare string returned by `strEncode``simplex:/...` for links, `#name.simplex` / `@name.simplex` for names.
**Discriminated union type**:
Link:
- type: "link"
- : string
Name:
- type: "name"
- : [SimplexNameInfo](#simplexnameinfo)
--- ---
## Connection ## Connection
@@ -1617,6 +1648,7 @@ Failed:
- authErrCounter: int - authErrCounter: int
- quotaErrCounter: int - quotaErrCounter: int
- createdAt: UTCTime - createdAt: UTCTime
- simplexName: [SimplexNameInfo](#simplexnameinfo)?
--- ---
@@ -1723,6 +1755,7 @@ Error:
- uiThemes: [UIThemeEntityOverrides](#uithemeentityoverrides)? - uiThemes: [UIThemeEntityOverrides](#uithemeentityoverrides)?
- chatDeleted: bool - chatDeleted: bool
- customData: JSONObject? - customData: JSONObject?
- simplexName: [SimplexNameInfo](#simplexnameinfo)?
--- ---
@@ -2270,6 +2303,7 @@ MemberSupport:
- membersRequireAttention: int - membersRequireAttention: int
- viaGroupLinkUri: string? - viaGroupLinkUri: string?
- groupKeys: [GroupKeys](#groupkeys)? - groupKeys: [GroupKeys](#groupkeys)?
- simplexName: [SimplexNameInfo](#simplexnameinfo)?
--- ---
@@ -2484,6 +2518,7 @@ UpdateRequired:
- description: string? - description: string?
- image: string? - image: string?
- publicGroup: [PublicGroupProfile](#publicgroupprofile)? - publicGroup: [PublicGroupProfile](#publicgroupprofile)?
- simplexName: [SimplexNameInfo](#simplexnameinfo)?
- groupPreferences: [GroupPreferences](#grouppreferences)? - groupPreferences: [GroupPreferences](#grouppreferences)?
- memberAdmission: [GroupMemberAdmission](#groupmemberadmission)? - memberAdmission: [GroupMemberAdmission](#groupmemberadmission)?
@@ -2680,6 +2715,7 @@ Unknown:
- shortDescr: string? - shortDescr: string?
- image: string? - image: string?
- contactLink: string? - contactLink: string?
- simplexName: [SimplexNameInfo](#simplexnameinfo)?
- preferences: [Preferences](#preferences)? - preferences: [Preferences](#preferences)?
- peerType: [ChatPeerType](#chatpeertype)? - peerType: [ChatPeerType](#chatpeertype)?
- localAlias: string - localAlias: string
@@ -3025,6 +3061,7 @@ count=<count>
- shortDescr: string? - shortDescr: string?
- image: string? - image: string?
- contactLink: string? - contactLink: string?
- simplexName: [SimplexNameInfo](#simplexnameinfo)?
- preferences: [Preferences](#preferences)? - preferences: [Preferences](#preferences)?
- peerType: [ChatPeerType](#chatpeertype)? - peerType: [ChatPeerType](#chatpeertype)?
@@ -3469,6 +3506,15 @@ A_QUEUE:
- "relay" - "relay"
---
## SimplexNameConflictEntity
**Enum type**:
- "contact"
- "group"
--- ---
## SimplexNameDomain ## SimplexNameDomain
+3 -3
View File
@@ -135,10 +135,10 @@ chatCommandsDocsData =
( "Connection commands", ( "Connection commands",
"These commands may be used to create connections. Most bots do not need to use them - bot users will connect via bot address with auto-accept enabled.", "These commands may be used to create connections. Most bots do not need to use them - bot users will connect via bot address with auto-accept enabled.",
[ ("APIAddContact", [], "Create 1-time invitation link.", ["CRInvitation", "CRChatCmdError"], [], Just UNInteractive, "/_connect " <> Param "userId" <> OnOffParam "incognito" "incognito" (Just False)), [ ("APIAddContact", [], "Create 1-time invitation link.", ["CRInvitation", "CRChatCmdError"], [], Just UNInteractive, "/_connect " <> Param "userId" <> OnOffParam "incognito" "incognito" (Just False)),
-- `Maybe` in `connectionLink :: Maybe AConnectionLink` is used to signal link parsing error to the runtime (the handler returns CEInvalidConnReq on Nothing); it is NOT API-level optionality. The parameter is required from callers. -- `Maybe` in `connectTarget :: Maybe ConnectTarget` is used to signal parse failure to the runtime (the handler returns CEInvalidConnReq on Nothing); it is NOT API-level optionality. The parameter is required from callers.
("APIConnectPlan", [], "Determine SimpleX link type and if the bot is already connected via this link.", ["CRConnectionPlan", "CRChatCmdError"], [], Just UNInteractive, "/_connect plan " <> Param "userId" <> " " <> Param "connectionLink"), ("APIConnectPlan", [], "Determine SimpleX link type and if the bot is already connected via this link or name.", ["CRConnectionPlan", "CRChatCmdError"], [], Just UNInteractive, "/_connect plan " <> Param "userId" <> " " <> Param "connectTarget"),
("APIConnect", [], "Connect via prepared SimpleX link. The link can be 1-time invitation link, contact address or group link.", ["CRSentConfirmation", "CRContactAlreadyExists", "CRSentInvitation", "CRChatCmdError"], [], Just UNInteractive, "/_connect " <> Param "userId" <> Optional "" (" " <> Param "$0") "preparedLink_"), ("APIConnect", [], "Connect via prepared SimpleX link. The link can be 1-time invitation link, contact address or group link.", ["CRSentConfirmation", "CRContactAlreadyExists", "CRSentInvitation", "CRChatCmdError"], [], Just UNInteractive, "/_connect " <> Param "userId" <> Optional "" (" " <> Param "$0") "preparedLink_"),
("Connect", [], "Connect via SimpleX link as string in the active user profile.", ["CRSentConfirmation", "CRContactAlreadyExists", "CRSentInvitation", "CRChatCmdError"], [], Just UNInteractive, "/connect" <> Optional "" (" " <> Param "$0") "connLink_"), ("Connect", [], "Connect via SimpleX link or name as string in the active user profile.", ["CRSentConfirmation", "CRContactAlreadyExists", "CRSentInvitation", "CRChatCmdError"], [], Just UNInteractive, "/connect" <> Optional "" (" " <> Param "$0") "connTarget_"),
("APIAcceptContact", ["incognito"], "Accept contact request.", ["CRAcceptingContactRequest", "CRChatCmdError"], [], Just UNInteractive, "/_accept " <> Param "contactReqId"), ("APIAcceptContact", ["incognito"], "Accept contact request.", ["CRAcceptingContactRequest", "CRChatCmdError"], [], Just UNInteractive, "/_accept " <> Param "contactReqId"),
("APIRejectContact", [], "Reject contact request. The user who sent the request is **not notified**.", ["CRContactRequestRejected", "CRChatCmdError"], [], Nothing, "/_reject " <> Param "contactReqId") ("APIRejectContact", [], "Reject contact request. The user who sent the request is **not notified**.", ["CRContactRequestRejected", "CRChatCmdError"], [], Nothing, "/_reject " <> Param "contactReqId")
] ]
+1
View File
@@ -67,6 +67,7 @@ chatEventsDocsData =
("CEvtContactDeletedByContact", "Bot user's connection with another contact is deleted (conversation is kept)."), ("CEvtContactDeletedByContact", "Bot user's connection with another contact is deleted (conversation is kept)."),
("CEvtReceivedContactRequest", "Contact request received.\n\nThis event is only sent when auto-accept is disabled.\n\nThe request needs to be accepted using [APIAcceptContact](./COMMANDS.md#apiacceptcontact) command"), ("CEvtReceivedContactRequest", "Contact request received.\n\nThis event is only sent when auto-accept is disabled.\n\nThe request needs to be accepted using [APIAcceptContact](./COMMANDS.md#apiacceptcontact) command"),
("CEvtNewMemberContactReceivedInv", "Received invitation to connect directly with a group member.\n\nThis event only needs to be processed to associate contact with group, the connection will proceed automatically."), ("CEvtNewMemberContactReceivedInv", "Received invitation to connect directly with a group member.\n\nThis event only needs to be processed to associate contact with group, the connection will proceed automatically."),
("CEvtSimplexNameConflict", "A peer's profile update claimed a SimpleX name (`#name.simplex` / `@name.simplex`) that was already held locally by another contact or group. The displaced row's `simplex_name` is set to NULL and the claim moves to the newer row; this event surfaces the displacement so the bot can warn the user about a possible impersonation."),
("CEvtContactSndReady", "Connecting via 1-time invitation or after accepting contact request.\n\nAfter this event bot can send messages to this contact.") -- JOINED ("CEvtContactSndReady", "Connecting via 1-time invitation or after accepting contact request.\n\nAfter this event bot can send messages to this contact.") -- JOINED
] ]
), ),
+4
View File
@@ -245,6 +245,7 @@ chatTypesDocsData =
(sti @ConnectionErrorType, STUnion, "", [], "", ""), (sti @ConnectionErrorType, STUnion, "", [], "", ""),
(sti @ConnectionMode, (STEnum' $ take 3 . consLower "CM"), "", [], "", ""), (sti @ConnectionMode, (STEnum' $ take 3 . consLower "CM"), "", [], "", ""),
(sti @ConnectionPlan, STUnion, "CP", [], "", ""), (sti @ConnectionPlan, STUnion, "CP", [], "", ""),
(sti @ConnectTarget, STUnion, "CT", [], "", "Connect target: SimpleX link (`CTLink`) or SimpleX name (`CTName`). Wire form is the bare string returned by `strEncode` — `simplex:/...` for links, `#name.simplex` / `@name.simplex` for names."),
(sti @ConnStatus, STUnion, "Conn", [], "", ""), (sti @ConnStatus, STUnion, "Conn", [], "", ""),
(sti @ConnType, (STEnum' $ consSep "Conn" '_'), "", [], "", ""), (sti @ConnType, (STEnum' $ consSep "Conn" '_'), "", [], "", ""),
(sti @Contact, STRecord, "", [], "", ""), (sti @Contact, STRecord, "", [], "", ""),
@@ -347,6 +348,7 @@ chatTypesDocsData =
(sti @SecurityCode, STRecord, "", [], "", ""), (sti @SecurityCode, STRecord, "", [], "", ""),
(sti @SimplePreference, STRecord, "", [], "", ""), (sti @SimplePreference, STRecord, "", [], "", ""),
(sti @SimplexLinkType, STEnum, "XL", [], "", ""), (sti @SimplexLinkType, STEnum, "XL", [], "", ""),
(sti @SimplexNameConflictEntity, STEnum, "SNCE", [], "", ""),
(sti @SimplexNameDomain, STRecord, "", [], "", ""), (sti @SimplexNameDomain, STRecord, "", [], "", ""),
(sti @SimplexNameInfo, STRecord, "", [], "", ""), (sti @SimplexNameInfo, STRecord, "", [], "", ""),
(sti @SimplexNameType, STEnum, "NT", [], "", ""), (sti @SimplexNameType, STEnum, "NT", [], "", ""),
@@ -460,6 +462,7 @@ deriving instance Generic ConnectionEntity
deriving instance Generic ConnectionErrorType deriving instance Generic ConnectionErrorType
deriving instance Generic ConnectionMode deriving instance Generic ConnectionMode
deriving instance Generic ConnectionPlan deriving instance Generic ConnectionPlan
deriving instance Generic ConnectTarget
deriving instance Generic ConnStatus deriving instance Generic ConnStatus
deriving instance Generic ConnType deriving instance Generic ConnType
deriving instance Generic Contact deriving instance Generic Contact
@@ -566,6 +569,7 @@ deriving instance Generic RelayStatus
deriving instance Generic ReportReason deriving instance Generic ReportReason
deriving instance Generic SecurityCode deriving instance Generic SecurityCode
deriving instance Generic SimplexLinkType deriving instance Generic SimplexLinkType
deriving instance Generic SimplexNameConflictEntity
deriving instance Generic SimplexNameDomain deriving instance Generic SimplexNameDomain
deriving instance Generic SimplexNameInfo deriving instance Generic SimplexNameInfo
deriving instance Generic SimplexNameType deriving instance Generic SimplexNameType
@@ -495,11 +495,11 @@ export namespace APIAddContact {
} }
} }
// Determine SimpleX link type and if the bot is already connected via this link. // Determine SimpleX link type and if the bot is already connected via this link or name.
// Network usage: interactive. // Network usage: interactive.
export interface APIConnectPlan { export interface APIConnectPlan {
userId: number // int64 userId: number // int64
connectionLink?: string connectTarget?: T.ConnectTarget
resolveKnown: boolean resolveKnown: boolean
linkOwnerSig?: T.LinkOwnerSig linkOwnerSig?: T.LinkOwnerSig
} }
@@ -508,7 +508,7 @@ export namespace APIConnectPlan {
export type Response = CR.ConnectionPlan | CR.ChatCmdError export type Response = CR.ConnectionPlan | CR.ChatCmdError
export function cmdString(self: APIConnectPlan): string { export function cmdString(self: APIConnectPlan): string {
return '/_connect plan ' + self.userId + ' ' + self.connectionLink return '/_connect plan ' + self.userId + ' ' + self.connectTarget
} }
} }
@@ -528,18 +528,18 @@ export namespace APIConnect {
} }
} }
// Connect via SimpleX link as string in the active user profile. // Connect via SimpleX link or name as string in the active user profile.
// Network usage: interactive. // Network usage: interactive.
export interface Connect { export interface Connect {
incognito: boolean incognito: boolean
connLink_?: string connTarget_?: T.ConnectTarget
} }
export namespace Connect { export namespace Connect {
export type Response = CR.SentConfirmation | CR.ContactAlreadyExists | CR.SentInvitation | CR.ChatCmdError export type Response = CR.SentConfirmation | CR.ContactAlreadyExists | CR.SentInvitation | CR.ChatCmdError
export function cmdString(self: Connect): string { export function cmdString(self: Connect): string {
return '/connect' + (self.connLink_ ? ' ' + self.connLink_ : '') return '/connect' + (self.connTarget_ ? ' ' + self.connTarget_ : '')
} }
} }
@@ -9,6 +9,7 @@ export type ChatEvent =
| CEvt.ContactDeletedByContact | CEvt.ContactDeletedByContact
| CEvt.ReceivedContactRequest | CEvt.ReceivedContactRequest
| CEvt.NewMemberContactReceivedInv | CEvt.NewMemberContactReceivedInv
| CEvt.SimplexNameConflict
| CEvt.ContactSndReady | CEvt.ContactSndReady
| CEvt.NewChatItems | CEvt.NewChatItems
| CEvt.ChatItemReaction | CEvt.ChatItemReaction
@@ -62,6 +63,7 @@ export namespace CEvt {
| "contactDeletedByContact" | "contactDeletedByContact"
| "receivedContactRequest" | "receivedContactRequest"
| "newMemberContactReceivedInv" | "newMemberContactReceivedInv"
| "simplexNameConflict"
| "contactSndReady" | "contactSndReady"
| "newChatItems" | "newChatItems"
| "chatItemReaction" | "chatItemReaction"
@@ -147,6 +149,15 @@ export namespace CEvt {
member: T.GroupMember member: T.GroupMember
} }
export interface SimplexNameConflict extends Interface {
type: "simplexNameConflict"
user: T.User
simplexName: T.SimplexNameInfo
entity: T.SimplexNameConflictEntity
claimedBy: string
displacedFrom: string
}
export interface ContactSndReady extends Interface { export interface ContactSndReady extends Interface {
type: "contactSndReady" type: "contactSndReady"
user: T.User user: T.User
@@ -1009,6 +1009,9 @@ export type ChatErrorType =
| ChatErrorType.ChatNotStopped | ChatErrorType.ChatNotStopped
| ChatErrorType.ChatStoreChanged | ChatErrorType.ChatStoreChanged
| ChatErrorType.InvalidConnReq | ChatErrorType.InvalidConnReq
| ChatErrorType.SimplexNameNotFound
| ChatErrorType.SimplexNameUnprepared
| ChatErrorType.SimplexNameResolverUnavailable
| ChatErrorType.UnsupportedConnReq | ChatErrorType.UnsupportedConnReq
| ChatErrorType.ConnReqMessageProhibited | ChatErrorType.ConnReqMessageProhibited
| ChatErrorType.ContactNotReady | ChatErrorType.ContactNotReady
@@ -1086,6 +1089,9 @@ export namespace ChatErrorType {
| "chatNotStopped" | "chatNotStopped"
| "chatStoreChanged" | "chatStoreChanged"
| "invalidConnReq" | "invalidConnReq"
| "simplexNameNotFound"
| "simplexNameUnprepared"
| "simplexNameResolverUnavailable"
| "unsupportedConnReq" | "unsupportedConnReq"
| "connReqMessageProhibited" | "connReqMessageProhibited"
| "contactNotReady" | "contactNotReady"
@@ -1240,6 +1246,21 @@ export namespace ChatErrorType {
type: "invalidConnReq" type: "invalidConnReq"
} }
export interface SimplexNameNotFound extends Interface {
type: "simplexNameNotFound"
simplexName: SimplexNameInfo
}
export interface SimplexNameUnprepared extends Interface {
type: "simplexNameUnprepared"
simplexName: SimplexNameInfo
}
export interface SimplexNameResolverUnavailable extends Interface {
type: "simplexNameResolverUnavailable"
simplexName: SimplexNameInfo
}
export interface UnsupportedConnReq extends Interface { export interface UnsupportedConnReq extends Interface {
type: "unsupportedConnReq" type: "unsupportedConnReq"
} }
@@ -1824,6 +1845,27 @@ export enum ConnType {
Member = "member", Member = "member",
User_contact = "user_contact", User_contact = "user_contact",
} }
// Connect target: SimpleX link (`CTLink`) or SimpleX name (`CTName`). Wire form is the bare string returned by `strEncode` — `simplex:/...` for links, `#name.simplex` / `@name.simplex` for names.
export type ConnectTarget = ConnectTarget.Link | ConnectTarget.Name
export namespace ConnectTarget {
export type Tag = "link" | "name"
interface Interface {
type: Tag
}
export interface Link extends Interface {
type: "link"
: string
}
export interface Name extends Interface {
type: "name"
: SimplexNameInfo
}
}
export interface Connection { export interface Connection {
connId: number // int64 connId: number // int64
@@ -1850,6 +1892,7 @@ export interface Connection {
authErrCounter: number // int authErrCounter: number // int
quotaErrCounter: number // int quotaErrCounter: number // int
createdAt: string // ISO-8601 timestamp createdAt: string // ISO-8601 timestamp
simplexName?: SimplexNameInfo
} }
export type ConnectionEntity = export type ConnectionEntity =
@@ -1981,6 +2024,7 @@ export interface Contact {
uiThemes?: UIThemeEntityOverrides uiThemes?: UIThemeEntityOverrides
chatDeleted: boolean chatDeleted: boolean
customData?: object customData?: object
simplexName?: SimplexNameInfo
} }
export type ContactAddressPlan = export type ContactAddressPlan =
@@ -2574,6 +2618,7 @@ export interface GroupInfo {
membersRequireAttention: number // int membersRequireAttention: number // int
viaGroupLinkUri?: string viaGroupLinkUri?: string
groupKeys?: GroupKeys groupKeys?: GroupKeys
simplexName?: SimplexNameInfo
} }
export interface GroupKeys { export interface GroupKeys {
@@ -2760,6 +2805,7 @@ export interface GroupProfile {
description?: string description?: string
image?: string image?: string
publicGroup?: PublicGroupProfile publicGroup?: PublicGroupProfile
simplexName?: SimplexNameInfo
groupPreferences?: GroupPreferences groupPreferences?: GroupPreferences
memberAdmission?: GroupMemberAdmission memberAdmission?: GroupMemberAdmission
} }
@@ -2941,6 +2987,7 @@ export interface LocalProfile {
shortDescr?: string shortDescr?: string
image?: string image?: string
contactLink?: string contactLink?: string
simplexName?: SimplexNameInfo
preferences?: Preferences preferences?: Preferences
peerType?: ChatPeerType peerType?: ChatPeerType
localAlias: string localAlias: string
@@ -3292,6 +3339,7 @@ export interface Profile {
shortDescr?: string shortDescr?: string
image?: string image?: string
contactLink?: string contactLink?: string
simplexName?: SimplexNameInfo
preferences?: Preferences preferences?: Preferences
peerType?: ChatPeerType peerType?: ChatPeerType
} }
@@ -3863,6 +3911,11 @@ export enum SimplexLinkType {
Relay = "relay", Relay = "relay",
} }
export enum SimplexNameConflictEntity {
Contact = "contact",
Group = "group",
}
export interface SimplexNameDomain { export interface SimplexNameDomain {
nameTLD: SimplexTLD nameTLD: SimplexTLD
domain: string domain: string
@@ -434,17 +434,17 @@ def APIAddContact_cmd_string(self: APIAddContact) -> str:
APIAddContact_Response = CR.Invitation | CR.ChatCmdError APIAddContact_Response = CR.Invitation | CR.ChatCmdError
# Determine SimpleX link type and if the bot is already connected via this link. # Determine SimpleX link type and if the bot is already connected via this link or name.
# Network usage: interactive. # Network usage: interactive.
class APIConnectPlan(TypedDict): class APIConnectPlan(TypedDict):
userId: int # int64 userId: int # int64
connectionLink: NotRequired[str] connectTarget: NotRequired["T.ConnectTarget"]
resolveKnown: bool resolveKnown: bool
linkOwnerSig: NotRequired["T.LinkOwnerSig"] linkOwnerSig: NotRequired["T.LinkOwnerSig"]
def APIConnectPlan_cmd_string(self: APIConnectPlan) -> str: def APIConnectPlan_cmd_string(self: APIConnectPlan) -> str:
return '/_connect plan ' + str(self['userId']) + ' ' + self.get('connectionLink') return '/_connect plan ' + str(self['userId']) + ' ' + str(self.get('connectTarget'))
APIConnectPlan_Response = CR.ConnectionPlan | CR.ChatCmdError APIConnectPlan_Response = CR.ConnectionPlan | CR.ChatCmdError
@@ -463,15 +463,15 @@ def APIConnect_cmd_string(self: APIConnect) -> str:
APIConnect_Response = CR.SentConfirmation | CR.ContactAlreadyExists | CR.SentInvitation | CR.ChatCmdError APIConnect_Response = CR.SentConfirmation | CR.ContactAlreadyExists | CR.SentInvitation | CR.ChatCmdError
# Connect via SimpleX link as string in the active user profile. # Connect via SimpleX link or name as string in the active user profile.
# Network usage: interactive. # Network usage: interactive.
class Connect(TypedDict): class Connect(TypedDict):
incognito: bool incognito: bool
connLink_: NotRequired[str] connTarget_: NotRequired["T.ConnectTarget"]
def Connect_cmd_string(self: Connect) -> str: def Connect_cmd_string(self: Connect) -> str:
return '/connect' + ((' ' + self.get('connLink_')) if self.get('connLink_') is not None else '') return '/connect' + ((' ' + str(self.get('connTarget_'))) if self.get('connTarget_') is not None else '')
Connect_Response = CR.SentConfirmation | CR.ContactAlreadyExists | CR.SentInvitation | CR.ChatCmdError Connect_Response = CR.SentConfirmation | CR.ContactAlreadyExists | CR.SentInvitation | CR.ChatCmdError
@@ -35,6 +35,14 @@ class NewMemberContactReceivedInv(TypedDict):
groupInfo: "T.GroupInfo" groupInfo: "T.GroupInfo"
member: "T.GroupMember" member: "T.GroupMember"
class SimplexNameConflict(TypedDict):
type: Literal["simplexNameConflict"]
user: "T.User"
simplexName: "T.SimplexNameInfo"
entity: "T.SimplexNameConflictEntity"
claimedBy: str
displacedFrom: str
class ContactSndReady(TypedDict): class ContactSndReady(TypedDict):
type: Literal["contactSndReady"] type: Literal["contactSndReady"]
user: "T.User" user: "T.User"
@@ -330,6 +338,7 @@ ChatEvent = (
| ContactDeletedByContact | ContactDeletedByContact
| ReceivedContactRequest | ReceivedContactRequest
| NewMemberContactReceivedInv | NewMemberContactReceivedInv
| SimplexNameConflict
| ContactSndReady | ContactSndReady
| NewChatItems | NewChatItems
| ChatItemReaction | ChatItemReaction
@@ -377,7 +386,7 @@ ChatEvent = (
| ChatErrors | ChatErrors
) )
ChatEvent_Tag = Literal["contactConnected", "contactUpdated", "contactDeletedByContact", "receivedContactRequest", "newMemberContactReceivedInv", "contactSndReady", "newChatItems", "chatItemReaction", "chatItemsDeleted", "chatItemUpdated", "groupChatItemsDeleted", "chatItemsStatusesUpdated", "receivedGroupInvitation", "userJoinedGroup", "groupUpdated", "joinedGroupMember", "memberRole", "deletedMember", "leftMember", "deletedMemberUser", "groupDeleted", "connectedToGroupMember", "memberAcceptedByOther", "memberBlockedForAll", "groupMemberUpdated", "groupLinkDataUpdated", "groupRelayUpdated", "rcvFileDescrReady", "rcvFileComplete", "sndFileCompleteXFTP", "rcvFileStart", "rcvFileSndCancelled", "rcvFileAccepted", "rcvFileError", "rcvFileWarning", "sndFileError", "sndFileWarning", "acceptingContactRequest", "acceptingBusinessRequest", "contactConnecting", "businessLinkConnecting", "joinedGroupMemberConnecting", "sentGroupInvitation", "groupLinkConnecting", "hostConnected", "hostDisconnected", "subscriptionStatus", "messageError", "chatError", "chatErrors"] ChatEvent_Tag = Literal["contactConnected", "contactUpdated", "contactDeletedByContact", "receivedContactRequest", "newMemberContactReceivedInv", "simplexNameConflict", "contactSndReady", "newChatItems", "chatItemReaction", "chatItemsDeleted", "chatItemUpdated", "groupChatItemsDeleted", "chatItemsStatusesUpdated", "receivedGroupInvitation", "userJoinedGroup", "groupUpdated", "joinedGroupMember", "memberRole", "deletedMember", "leftMember", "deletedMemberUser", "groupDeleted", "connectedToGroupMember", "memberAcceptedByOther", "memberBlockedForAll", "groupMemberUpdated", "groupLinkDataUpdated", "groupRelayUpdated", "rcvFileDescrReady", "rcvFileComplete", "sndFileCompleteXFTP", "rcvFileStart", "rcvFileSndCancelled", "rcvFileAccepted", "rcvFileError", "rcvFileWarning", "sndFileError", "sndFileWarning", "acceptingContactRequest", "acceptingBusinessRequest", "contactConnecting", "businessLinkConnecting", "joinedGroupMemberConnecting", "sentGroupInvitation", "groupLinkConnecting", "hostConnected", "hostDisconnected", "subscriptionStatus", "messageError", "chatError", "chatErrors"]
class OnEventDecorator(Protocol): class OnEventDecorator(Protocol):
@@ -418,6 +427,12 @@ class OnEventDecorator(Protocol):
Callable[["NewMemberContactReceivedInv"], Awaitable[None]], Callable[["NewMemberContactReceivedInv"], Awaitable[None]],
]: ... ]: ...
@overload
def __call__(self, event: Literal["simplexNameConflict"], /) -> Callable[
[Callable[["SimplexNameConflict"], Awaitable[None]]],
Callable[["SimplexNameConflict"], Awaitable[None]],
]: ...
@overload @overload
def __call__(self, event: Literal["contactSndReady"], /) -> Callable[ def __call__(self, event: Literal["contactSndReady"], /) -> Callable[
[Callable[["ContactSndReady"], Awaitable[None]]], [Callable[["ContactSndReady"], Awaitable[None]]],
@@ -769,6 +769,18 @@ class ChatErrorType_chatStoreChanged(TypedDict):
class ChatErrorType_invalidConnReq(TypedDict): class ChatErrorType_invalidConnReq(TypedDict):
type: Literal["invalidConnReq"] type: Literal["invalidConnReq"]
class ChatErrorType_simplexNameNotFound(TypedDict):
type: Literal["simplexNameNotFound"]
simplexName: "SimplexNameInfo"
class ChatErrorType_simplexNameUnprepared(TypedDict):
type: Literal["simplexNameUnprepared"]
simplexName: "SimplexNameInfo"
class ChatErrorType_simplexNameResolverUnavailable(TypedDict):
type: Literal["simplexNameResolverUnavailable"]
simplexName: "SimplexNameInfo"
class ChatErrorType_unsupportedConnReq(TypedDict): class ChatErrorType_unsupportedConnReq(TypedDict):
type: Literal["unsupportedConnReq"] type: Literal["unsupportedConnReq"]
@@ -999,6 +1011,9 @@ ChatErrorType = (
| ChatErrorType_chatNotStopped | ChatErrorType_chatNotStopped
| ChatErrorType_chatStoreChanged | ChatErrorType_chatStoreChanged
| ChatErrorType_invalidConnReq | ChatErrorType_invalidConnReq
| ChatErrorType_simplexNameNotFound
| ChatErrorType_simplexNameUnprepared
| ChatErrorType_simplexNameResolverUnavailable
| ChatErrorType_unsupportedConnReq | ChatErrorType_unsupportedConnReq
| ChatErrorType_connReqMessageProhibited | ChatErrorType_connReqMessageProhibited
| ChatErrorType_contactNotReady | ChatErrorType_contactNotReady
@@ -1055,7 +1070,7 @@ ChatErrorType = (
| ChatErrorType_exception | ChatErrorType_exception
) )
ChatErrorType_Tag = Literal["noActiveUser", "noConnectionUser", "noSndFileUser", "noRcvFileUser", "userUnknown", "userExists", "chatRelayExists", "differentActiveUser", "cantDeleteActiveUser", "cantDeleteLastUser", "cantHideLastUser", "hiddenUserAlwaysMuted", "emptyUserPassword", "userAlreadyHidden", "userNotHidden", "invalidDisplayName", "chatNotStarted", "chatNotStopped", "chatStoreChanged", "invalidConnReq", "unsupportedConnReq", "connReqMessageProhibited", "contactNotReady", "contactNotActive", "contactDisabled", "connectionDisabled", "groupUserRole", "groupMemberInitialRole", "contactIncognitoCantInvite", "groupIncognitoCantInvite", "groupContactRole", "groupDuplicateMember", "groupDuplicateMemberId", "groupNotJoined", "groupMemberNotActive", "cantBlockMemberForSelf", "groupMemberUserRemoved", "groupMemberNotFound", "groupCantResendInvitation", "groupInternal", "fileNotFound", "fileSize", "fileAlreadyReceiving", "fileCancelled", "fileCancel", "fileAlreadyExists", "fileWrite", "fileSend", "fileRcvChunk", "fileInternal", "fileImageType", "fileImageSize", "fileNotReceived", "fileNotApproved", "fallbackToSMPProhibited", "inlineFileProhibited", "invalidForward", "invalidChatItemUpdate", "invalidChatItemDelete", "hasCurrentCall", "noCurrentCall", "callContact", "directMessagesProhibited", "agentVersion", "agentNoSubResult", "commandError", "agentCommandError", "invalidFileDescription", "connectionIncognitoChangeProhibited", "connectionUserChangeProhibited", "peerChatVRangeIncompatible", "relayTestError", "internalError", "exception"] ChatErrorType_Tag = Literal["noActiveUser", "noConnectionUser", "noSndFileUser", "noRcvFileUser", "userUnknown", "userExists", "chatRelayExists", "differentActiveUser", "cantDeleteActiveUser", "cantDeleteLastUser", "cantHideLastUser", "hiddenUserAlwaysMuted", "emptyUserPassword", "userAlreadyHidden", "userNotHidden", "invalidDisplayName", "chatNotStarted", "chatNotStopped", "chatStoreChanged", "invalidConnReq", "simplexNameNotFound", "simplexNameUnprepared", "simplexNameResolverUnavailable", "unsupportedConnReq", "connReqMessageProhibited", "contactNotReady", "contactNotActive", "contactDisabled", "connectionDisabled", "groupUserRole", "groupMemberInitialRole", "contactIncognitoCantInvite", "groupIncognitoCantInvite", "groupContactRole", "groupDuplicateMember", "groupDuplicateMemberId", "groupNotJoined", "groupMemberNotActive", "cantBlockMemberForSelf", "groupMemberUserRemoved", "groupMemberNotFound", "groupCantResendInvitation", "groupInternal", "fileNotFound", "fileSize", "fileAlreadyReceiving", "fileCancelled", "fileCancel", "fileAlreadyExists", "fileWrite", "fileSend", "fileRcvChunk", "fileInternal", "fileImageType", "fileImageSize", "fileNotReceived", "fileNotApproved", "fallbackToSMPProhibited", "inlineFileProhibited", "invalidForward", "invalidChatItemUpdate", "invalidChatItemDelete", "hasCurrentCall", "noCurrentCall", "callContact", "directMessagesProhibited", "agentVersion", "agentNoSubResult", "commandError", "agentCommandError", "invalidFileDescription", "connectionIncognitoChangeProhibited", "connectionUserChangeProhibited", "peerChatVRangeIncompatible", "relayTestError", "internalError", "exception"]
ChatFeature = Literal["timedMessages", "fullDelete", "reactions", "voice", "files", "calls", "sessions"] ChatFeature = Literal["timedMessages", "fullDelete", "reactions", "voice", "files", "calls", "sessions"]
@@ -1273,6 +1288,20 @@ ConnStatus_Tag = Literal["new", "prepared", "joined", "requested", "accepted", "
ConnType = Literal["contact", "member", "user_contact"] ConnType = Literal["contact", "member", "user_contact"]
# Connect target: SimpleX link (`CTLink`) or SimpleX name (`CTName`). Wire form is the bare string returned by `strEncode` — `simplex:/...` for links, `#name.simplex` / `@name.simplex` for names.
class ConnectTarget_link(TypedDict):
type: Literal["link"]
: str
class ConnectTarget_name(TypedDict):
type: Literal["name"]
: "SimplexNameInfo"
ConnectTarget = ConnectTarget_link | ConnectTarget_name
ConnectTarget_Tag = Literal["link", "name"]
class Connection(TypedDict): class Connection(TypedDict):
connId: int # int64 connId: int # int64
agentConnId: str agentConnId: str
@@ -1298,6 +1327,7 @@ class Connection(TypedDict):
authErrCounter: int # int authErrCounter: int # int
quotaErrCounter: int # int quotaErrCounter: int # int
createdAt: str # ISO-8601 timestamp createdAt: str # ISO-8601 timestamp
simplexName: NotRequired["SimplexNameInfo"]
class ConnectionEntity_rcvDirectMsgConnection(TypedDict): class ConnectionEntity_rcvDirectMsgConnection(TypedDict):
type: Literal["rcvDirectMsgConnection"] type: Literal["rcvDirectMsgConnection"]
@@ -1398,6 +1428,7 @@ class Contact(TypedDict):
uiThemes: NotRequired["UIThemeEntityOverrides"] uiThemes: NotRequired["UIThemeEntityOverrides"]
chatDeleted: bool chatDeleted: bool
customData: NotRequired[dict[str, object]] customData: NotRequired[dict[str, object]]
simplexName: NotRequired["SimplexNameInfo"]
class ContactAddressPlan_ok(TypedDict): class ContactAddressPlan_ok(TypedDict):
type: Literal["ok"] type: Literal["ok"]
@@ -1809,6 +1840,7 @@ class GroupInfo(TypedDict):
membersRequireAttention: int # int membersRequireAttention: int # int
viaGroupLinkUri: NotRequired[str] viaGroupLinkUri: NotRequired[str]
groupKeys: NotRequired["GroupKeys"] groupKeys: NotRequired["GroupKeys"]
simplexName: NotRequired["SimplexNameInfo"]
class GroupKeys(TypedDict): class GroupKeys(TypedDict):
publicGroupId: str publicGroupId: str
@@ -1936,6 +1968,7 @@ class GroupProfile(TypedDict):
description: NotRequired[str] description: NotRequired[str]
image: NotRequired[str] image: NotRequired[str]
publicGroup: NotRequired["PublicGroupProfile"] publicGroup: NotRequired["PublicGroupProfile"]
simplexName: NotRequired["SimplexNameInfo"]
groupPreferences: NotRequired["GroupPreferences"] groupPreferences: NotRequired["GroupPreferences"]
memberAdmission: NotRequired["GroupMemberAdmission"] memberAdmission: NotRequired["GroupMemberAdmission"]
@@ -2062,6 +2095,7 @@ class LocalProfile(TypedDict):
shortDescr: NotRequired[str] shortDescr: NotRequired[str]
image: NotRequired[str] image: NotRequired[str]
contactLink: NotRequired[str] contactLink: NotRequired[str]
simplexName: NotRequired["SimplexNameInfo"]
preferences: NotRequired["Preferences"] preferences: NotRequired["Preferences"]
peerType: NotRequired["ChatPeerType"] peerType: NotRequired["ChatPeerType"]
localAlias: str localAlias: str
@@ -2313,6 +2347,7 @@ class Profile(TypedDict):
shortDescr: NotRequired[str] shortDescr: NotRequired[str]
image: NotRequired[str] image: NotRequired[str]
contactLink: NotRequired[str] contactLink: NotRequired[str]
simplexName: NotRequired["SimplexNameInfo"]
preferences: NotRequired["Preferences"] preferences: NotRequired["Preferences"]
peerType: NotRequired["ChatPeerType"] peerType: NotRequired["ChatPeerType"]
@@ -2700,6 +2735,8 @@ class SimplePreference(TypedDict):
SimplexLinkType = Literal["contact", "invitation", "group", "channel", "relay"] SimplexLinkType = Literal["contact", "invitation", "group", "channel", "relay"]
SimplexNameConflictEntity = Literal["contact", "group"]
class SimplexNameDomain(TypedDict): class SimplexNameDomain(TypedDict):
nameTLD: "SimplexTLD" nameTLD: "SimplexTLD"
domain: str domain: str