@agentims/sdk 0.0.0-stage → 0.3.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.
Files changed (113) hide show
  1. package/README.md +73 -2
  2. package/dist/api/client.d.ts +36 -0
  3. package/dist/api/client.js +54 -0
  4. package/dist/api/errors.d.ts +52 -0
  5. package/dist/api/errors.js +43 -0
  6. package/dist/api/options.d.ts +12 -0
  7. package/dist/api/options.js +1 -0
  8. package/dist/api/request-data.d.ts +10 -0
  9. package/dist/api/request-data.js +43 -0
  10. package/dist/features/contacts/client.d.ts +9 -0
  11. package/dist/features/contacts/client.js +12 -0
  12. package/dist/features/contacts/index.d.ts +1 -0
  13. package/dist/features/contacts/index.js +1 -0
  14. package/dist/features/contacts/types.d.ts +19 -0
  15. package/dist/features/contacts/types.js +3 -0
  16. package/dist/features/conversations/client.d.ts +20 -0
  17. package/dist/features/conversations/client.js +42 -0
  18. package/dist/features/conversations/index.d.ts +1 -0
  19. package/dist/features/conversations/index.js +1 -0
  20. package/dist/features/conversations/types.d.ts +64 -0
  21. package/dist/features/conversations/types.js +3 -0
  22. package/dist/features/deliveries/client.d.ts +17 -0
  23. package/dist/features/deliveries/client.js +31 -0
  24. package/dist/features/deliveries/index.d.ts +1 -0
  25. package/dist/features/deliveries/index.js +1 -0
  26. package/dist/features/deliveries/types.d.ts +54 -0
  27. package/dist/features/deliveries/types.js +1 -0
  28. package/dist/features/devices/client.d.ts +11 -0
  29. package/dist/features/devices/client.js +18 -0
  30. package/dist/features/devices/index.d.ts +1 -0
  31. package/dist/features/devices/index.js +1 -0
  32. package/dist/features/devices/types.d.ts +29 -0
  33. package/dist/features/devices/types.js +3 -0
  34. package/dist/features/discovery/client.d.ts +9 -0
  35. package/dist/features/discovery/client.js +9 -0
  36. package/dist/features/discovery/index.d.ts +1 -0
  37. package/dist/features/discovery/index.js +1 -0
  38. package/dist/features/discovery/types.d.ts +6 -0
  39. package/dist/features/discovery/types.js +3 -0
  40. package/dist/features/encryption/client.d.ts +16 -0
  41. package/dist/features/encryption/client.js +30 -0
  42. package/dist/features/encryption/index.d.ts +1 -0
  43. package/dist/features/encryption/index.js +1 -0
  44. package/dist/features/encryption/types.d.ts +54 -0
  45. package/dist/features/encryption/types.js +3 -0
  46. package/dist/features/identity/client.d.ts +21 -0
  47. package/dist/features/identity/client.js +43 -0
  48. package/dist/features/identity/index.d.ts +3 -0
  49. package/dist/features/identity/index.js +1 -0
  50. package/dist/features/identity/types.d.ts +105 -0
  51. package/dist/features/identity/types.js +1 -0
  52. package/dist/features/messages/client.d.ts +18 -0
  53. package/dist/features/messages/client.js +35 -0
  54. package/dist/features/messages/index.d.ts +1 -0
  55. package/dist/features/messages/index.js +1 -0
  56. package/dist/features/messages/types.d.ts +54 -0
  57. package/dist/features/messages/types.js +3 -0
  58. package/dist/features/outbox/client.d.ts +14 -0
  59. package/dist/features/outbox/client.js +25 -0
  60. package/dist/features/outbox/index.d.ts +1 -0
  61. package/dist/features/outbox/index.js +1 -0
  62. package/dist/features/outbox/types.d.ts +41 -0
  63. package/dist/features/outbox/types.js +3 -0
  64. package/dist/features/pairing/client.d.ts +11 -0
  65. package/dist/features/pairing/client.js +16 -0
  66. package/dist/features/pairing/index.d.ts +1 -0
  67. package/dist/features/pairing/index.js +1 -0
  68. package/dist/features/pairing/types.d.ts +21 -0
  69. package/dist/features/pairing/types.js +3 -0
  70. package/dist/features/profiles/client.d.ts +10 -0
  71. package/dist/features/profiles/client.js +15 -0
  72. package/dist/features/profiles/index.d.ts +1 -0
  73. package/dist/features/profiles/index.js +1 -0
  74. package/dist/features/profiles/types.d.ts +23 -0
  75. package/dist/features/profiles/types.js +3 -0
  76. package/dist/features/reliability/client.d.ts +9 -0
  77. package/dist/features/reliability/client.js +12 -0
  78. package/dist/features/reliability/index.d.ts +1 -0
  79. package/dist/features/reliability/index.js +1 -0
  80. package/dist/features/reliability/types.d.ts +27 -0
  81. package/dist/features/reliability/types.js +3 -0
  82. package/dist/features/timeline/client.d.ts +12 -0
  83. package/dist/features/timeline/client.js +21 -0
  84. package/dist/features/timeline/index.d.ts +1 -0
  85. package/dist/features/timeline/index.js +1 -0
  86. package/dist/features/timeline/types.d.ts +60 -0
  87. package/dist/features/timeline/types.js +3 -0
  88. package/dist/features/verification/client.d.ts +11 -0
  89. package/dist/features/verification/client.js +18 -0
  90. package/dist/features/verification/index.d.ts +1 -0
  91. package/dist/features/verification/index.js +1 -0
  92. package/dist/features/verification/types.d.ts +20 -0
  93. package/dist/features/verification/types.js +3 -0
  94. package/dist/index.d.ts +27 -0
  95. package/dist/index.js +4 -0
  96. package/dist/internal/protocol/codec.d.ts +4 -0
  97. package/dist/internal/protocol/codec.js +69 -0
  98. package/dist/internal/protocol/input.d.ts +2 -0
  99. package/dist/internal/protocol/input.js +38 -0
  100. package/dist/internal/protocol/operations.json +88 -0
  101. package/dist/internal/protocol/registry.d.ts +17 -0
  102. package/dist/internal/protocol/registry.js +72 -0
  103. package/dist/internal/protocol/schema.d.ts +23 -0
  104. package/dist/internal/protocol/schema.js +105 -0
  105. package/dist/internal/transport/client.d.ts +8 -0
  106. package/dist/internal/transport/client.js +102 -0
  107. package/dist/internal/transport/error-diagnostics.d.ts +3 -0
  108. package/dist/internal/transport/error-diagnostics.js +50 -0
  109. package/dist/internal/transport/request.d.ts +9 -0
  110. package/dist/internal/transport/request.js +55 -0
  111. package/dist/internal/transport/response.d.ts +2 -0
  112. package/dist/internal/transport/response.js +85 -0
  113. package/package.json +34 -4
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { RequestOptions } from "../../api/options.js";
2
+ import type { Transport } from "../../internal/transport/client.js";
3
+ import type { DeleteDevicesRequest, DeviceAuthResult, DevicesPage, RenameDeviceRequest } from "./types.js";
4
+ export declare class DevicesClient {
5
+ private readonly transport;
6
+ constructor(transport: Transport);
7
+ list(options?: RequestOptions): Promise<DevicesPage>;
8
+ trust(userId: string, options?: RequestOptions): Promise<DevicesPage>;
9
+ delete(body: DeleteDevicesRequest, options?: RequestOptions): Promise<DeviceAuthResult>;
10
+ rename(deviceId: string, body: RenameDeviceRequest, options?: RequestOptions): Promise<DeviceAuthResult>;
11
+ }
@@ -0,0 +1,18 @@
1
+ export class DevicesClient {
2
+ transport;
3
+ constructor(transport) {
4
+ this.transport = transport;
5
+ }
6
+ list(options = {}) {
7
+ return this.transport.call("listOwnDevices", { timeoutMs: 180000, ...options });
8
+ }
9
+ trust(userId, options = {}) {
10
+ return this.transport.call("listUserDeviceTrust", { timeoutMs: 180000, ...options, path: { user_id: userId } });
11
+ }
12
+ delete(body, options = {}) {
13
+ return this.transport.call("deleteDevices", { timeoutMs: 180000, ...options, body });
14
+ }
15
+ rename(deviceId, body, options = {}) {
16
+ return this.transport.call("renameDevice", { timeoutMs: 180000, ...options, path: { device_id: deviceId }, body });
17
+ }
18
+ }
@@ -0,0 +1 @@
1
+ export type { DeleteDevicesRequest, DeviceAuthResult, DeviceInfo, DevicesPage, RenameDeviceRequest } from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ export interface DeleteDevicesRequest {
2
+ readonly device_ids: readonly (string)[];
3
+ readonly allow_current?: boolean;
4
+ readonly auth_session?: string;
5
+ readonly password?: string;
6
+ }
7
+ export interface DeviceAuthResult {
8
+ readonly completed: boolean;
9
+ readonly auth_session: string | null;
10
+ readonly auth_stages: readonly (string)[];
11
+ }
12
+ export interface DeviceInfo {
13
+ readonly user_id: string;
14
+ readonly device_id: string;
15
+ readonly display_name: string | null;
16
+ readonly last_seen_ip: string | null;
17
+ readonly last_seen_ts: number | bigint | null;
18
+ readonly current: boolean;
19
+ readonly verified: boolean;
20
+ readonly cross_signed: boolean;
21
+ readonly ed25519: string | null;
22
+ readonly curve25519: string | null;
23
+ }
24
+ export interface DevicesPage {
25
+ readonly devices: readonly (DeviceInfo)[];
26
+ }
27
+ export interface RenameDeviceRequest {
28
+ readonly display_name: string;
29
+ }
@@ -0,0 +1,3 @@
1
+ // @generated by scripts/checks/generate_sdk_protocol.py; DO NOT EDIT.
2
+ // Source: contracts/local-api/v1, agent-profile/v1, shared/v1 (offline refs).
3
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { RequestOptions } from "../../api/options.js";
2
+ import type { Transport } from "../../internal/transport/client.js";
3
+ import type { ProfilePage } from "../profiles/index.js";
4
+ import type { DiscoveryQuery } from "./types.js";
5
+ export declare class DiscoveryClient {
6
+ private readonly transport;
7
+ constructor(transport: Transport);
8
+ search(query?: DiscoveryQuery, options?: RequestOptions): Promise<ProfilePage>;
9
+ }
@@ -0,0 +1,9 @@
1
+ export class DiscoveryClient {
2
+ transport;
3
+ constructor(transport) {
4
+ this.transport = transport;
5
+ }
6
+ search(query = {}, options = {}) {
7
+ return this.transport.call("localDiscoverAgents", { ...options, query });
8
+ }
9
+ }
@@ -0,0 +1 @@
1
+ export type { DiscoveryQuery, } from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface DiscoveryQuery {
2
+ readonly query?: string;
3
+ readonly capability?: string;
4
+ readonly after?: string;
5
+ readonly limit?: number | bigint;
6
+ }
@@ -0,0 +1,3 @@
1
+ // @generated by scripts/checks/generate_sdk_protocol.py; DO NOT EDIT.
2
+ // Source: contracts/local-api/v1, agent-profile/v1, shared/v1 (offline refs).
3
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { BackupStatus, BootstrapSigningRequest, CrossSigningStatus, EnableBackupRequest, RecoverBackupRequest, SigningAuthResult, WaitBackupRequest } from "./types.js";
2
+ import type { RequestOptions } from "../../api/options.js";
3
+ import type { Transport } from "../../internal/transport/client.js";
4
+ import type { ExportChatKeysRequest, ImportChatKeysRequest, ChatKeyBackup, ChatKeyImportResult } from "./types.js";
5
+ export declare class EncryptionClient {
6
+ private readonly transport;
7
+ constructor(transport: Transport);
8
+ exportKeys(body: ExportChatKeysRequest, options?: RequestOptions): Promise<ChatKeyBackup>;
9
+ importKeys(body: ImportChatKeysRequest, options?: RequestOptions): Promise<ChatKeyImportResult>;
10
+ crossSigning(options?: RequestOptions): Promise<CrossSigningStatus>;
11
+ bootstrapSigning(body: BootstrapSigningRequest, options?: RequestOptions): Promise<SigningAuthResult>;
12
+ backupStatus(options?: RequestOptions): Promise<BackupStatus>;
13
+ enableBackup(body: EnableBackupRequest, options?: RequestOptions): Promise<BackupStatus>;
14
+ recoverBackup(body: RecoverBackupRequest, options?: RequestOptions): Promise<BackupStatus>;
15
+ waitBackup(body: WaitBackupRequest, options?: RequestOptions): Promise<BackupStatus>;
16
+ }
@@ -0,0 +1,30 @@
1
+ export class EncryptionClient {
2
+ transport;
3
+ constructor(transport) {
4
+ this.transport = transport;
5
+ }
6
+ exportKeys(body, options = {}) {
7
+ return this.transport.call("exportChatKeys", { timeoutMs: 180000, ...options, body });
8
+ }
9
+ importKeys(body, options = {}) {
10
+ return this.transport.call("importChatKeys", { timeoutMs: 180000, ...options, body });
11
+ }
12
+ crossSigning(options = {}) {
13
+ return this.transport.call("getCrossSigning", { timeoutMs: 180000, ...options });
14
+ }
15
+ bootstrapSigning(body, options = {}) {
16
+ return this.transport.call("bootstrapCrossSigning", { timeoutMs: 180000, ...options, body });
17
+ }
18
+ backupStatus(options = {}) {
19
+ return this.transport.call("getBackupStatus", { timeoutMs: 180000, ...options });
20
+ }
21
+ enableBackup(body, options = {}) {
22
+ return this.transport.call("enableOnlineBackup", { timeoutMs: 180000, ...options, body });
23
+ }
24
+ recoverBackup(body, options = {}) {
25
+ return this.transport.call("recoverOnlineBackup", { timeoutMs: 180000, ...options, body });
26
+ }
27
+ waitBackup(body, options = {}) {
28
+ return this.transport.call("waitOnlineBackup", { timeoutMs: 180000, ...options, body });
29
+ }
30
+ }
@@ -0,0 +1 @@
1
+ export type { BackupStatus, BootstrapSigningRequest, ChatKeyBackup, ChatKeyImportResult, CrossSigningStatus, EnableBackupRequest, ExportChatKeysRequest, ImportChatKeysRequest, RecoverBackupRequest, SigningAuthResult, WaitBackupRequest } from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,54 @@
1
+ export interface BackupStatus {
2
+ readonly enabled: boolean;
3
+ readonly exists_on_server: boolean;
4
+ readonly backup_state: string;
5
+ readonly recovery_state: string;
6
+ readonly total_keys: number | bigint | null;
7
+ readonly backed_up_keys: number | bigint | null;
8
+ readonly pending_keys: number | bigint | null;
9
+ readonly counts_observed_at_ms: number | bigint | null;
10
+ }
11
+ export interface BootstrapSigningRequest {
12
+ readonly auth_session?: string;
13
+ readonly password?: string;
14
+ }
15
+ export interface ChatKeyBackup {
16
+ readonly homeserver: string;
17
+ readonly user_id: string;
18
+ readonly encrypted_keys: string;
19
+ }
20
+ export interface ChatKeyImportResult {
21
+ readonly imported_count: number | bigint;
22
+ readonly total_count: number | bigint;
23
+ }
24
+ export interface CrossSigningStatus {
25
+ readonly user_id: string;
26
+ readonly has_master: boolean;
27
+ readonly has_self_signing: boolean;
28
+ readonly has_user_signing: boolean;
29
+ readonly verified: boolean;
30
+ }
31
+ export interface EnableBackupRequest {
32
+ readonly recovery_key_file: string;
33
+ }
34
+ export interface ExportChatKeysRequest {
35
+ readonly recovery_secret: string;
36
+ }
37
+ export interface ImportChatKeysRequest {
38
+ readonly homeserver: string;
39
+ readonly expected_user_id: string;
40
+ readonly encrypted_keys: string;
41
+ readonly recovery_secret: string;
42
+ }
43
+ export interface RecoverBackupRequest {
44
+ readonly recovery_key: string;
45
+ readonly room_id?: string;
46
+ }
47
+ export interface SigningAuthResult {
48
+ readonly completed: boolean;
49
+ readonly auth_session: string | null;
50
+ readonly auth_stages: readonly (string)[];
51
+ }
52
+ export interface WaitBackupRequest {
53
+ readonly timeout_seconds?: number | bigint;
54
+ }
@@ -0,0 +1,3 @@
1
+ // @generated by scripts/checks/generate_sdk_protocol.py; DO NOT EDIT.
2
+ // Source: contracts/local-api/v1, agent-profile/v1, shared/v1 (offline refs).
3
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { RequestOptions } from "../../api/options.js";
2
+ import type { Transport } from "../../internal/transport/client.js";
3
+ import type { CredentialRevokeRequest, CredentialRevocation } from "./types.js";
4
+ import type { AccountCredentialFile, AccountCredentialState, AccountLoginRequest, AuthorizedDeviceLoginRequest, IdentityLoginStatus, ClientStatus, IdentityStatus, LoginRequest, RegisterRequest, PublicRegisterRequest, ShutdownClientResponse } from "./types.js";
5
+ export declare class IdentityClient {
6
+ private readonly transport;
7
+ constructor(transport: Transport);
8
+ replaceCredential(body: AccountLoginRequest, options?: RequestOptions): Promise<AccountCredentialState>;
9
+ revokeCredential(body: CredentialRevokeRequest, options?: RequestOptions): Promise<CredentialRevocation>;
10
+ recoverAccount(body: AccountLoginRequest, options?: RequestOptions): Promise<IdentityStatus>;
11
+ loginAuthorized(body: AuthorizedDeviceLoginRequest, options?: RequestOptions): Promise<IdentityStatus>;
12
+ loginStatus(options?: RequestOptions): Promise<IdentityLoginStatus>;
13
+ ensureCredential(options?: RequestOptions): Promise<AccountCredentialState>;
14
+ exportCredential(options?: RequestOptions): Promise<AccountCredentialFile>;
15
+ status(options?: RequestOptions): Promise<ClientStatus>;
16
+ register(body: RegisterRequest, options?: RequestOptions): Promise<IdentityStatus>;
17
+ registerPublic(body: PublicRegisterRequest, options?: RequestOptions): Promise<IdentityStatus>;
18
+ login(body: LoginRequest, options?: RequestOptions): Promise<IdentityStatus>;
19
+ /** Explicit process shutdown; close() never calls this operation. */
20
+ shutdownDaemon(options?: RequestOptions): Promise<ShutdownClientResponse>;
21
+ }
@@ -0,0 +1,43 @@
1
+ export class IdentityClient {
2
+ transport;
3
+ constructor(transport) {
4
+ this.transport = transport;
5
+ }
6
+ replaceCredential(body, options = {}) {
7
+ return this.transport.call("replaceAccountCredential", { ...options, body });
8
+ }
9
+ revokeCredential(body, options = {}) {
10
+ return this.transport.call("revokeAccountCredential", { ...options, body });
11
+ }
12
+ recoverAccount(body, options = {}) {
13
+ return this.transport.call("recoverAccountIdentity", { ...options, body });
14
+ }
15
+ loginAuthorized(body, options = {}) {
16
+ return this.transport.call("loginAuthorizedDevice", { ...options, body });
17
+ }
18
+ loginStatus(options = {}) {
19
+ return this.transport.call("getIdentityLoginStatus", options);
20
+ }
21
+ ensureCredential(options = {}) {
22
+ return this.transport.call("ensureAccountCredential", { ...options, body: {} });
23
+ }
24
+ exportCredential(options = {}) {
25
+ return this.transport.call("exportAccountCredential", options);
26
+ }
27
+ status(options = {}) {
28
+ return this.transport.call("getClientStatus", options);
29
+ }
30
+ register(body, options = {}) {
31
+ return this.transport.call("registerAgentIdentity", { ...options, body });
32
+ }
33
+ registerPublic(body, options = {}) {
34
+ return this.transport.call("registerPublicAgentIdentity", { timeoutMs: 120_000, ...options, body });
35
+ }
36
+ login(body, options = {}) {
37
+ return this.transport.call("loginWithToken", { ...options, body });
38
+ }
39
+ /** Explicit process shutdown; close() never calls this operation. */
40
+ shutdownDaemon(options = {}) {
41
+ return this.transport.call("shutdownClient", { ...options, body: {} });
42
+ }
43
+ }
@@ -0,0 +1,3 @@
1
+ export type { ClientStatus, IdentityStatus, LoginRequest, OperationResult, RegisterRequest, PublicRegisterRequest, ShutdownClientRequest, ShutdownClientResponse, } from "./types.js";
2
+ export type { AccountCredentialFile, AccountCredentialState, AccountLoginRequest, AuthorizedDeviceLoginRequest, IdentityLoginStatus } from "./types.js";
3
+ export type { CredentialRevokeRequest, CredentialRevocation } from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,105 @@
1
+ import type { Conversation } from "../conversations/index.js";
2
+ export interface AccountCredentialFile {
3
+ readonly version: 1;
4
+ readonly kind: "agentim-account-credential";
5
+ readonly homeserver: string;
6
+ readonly user_id: string;
7
+ readonly credential_id: string;
8
+ readonly credential_secret: string;
9
+ }
10
+ export interface AccountCredentialState {
11
+ readonly credential_id: string;
12
+ readonly user_id: string;
13
+ readonly saved_locally: boolean;
14
+ }
15
+ export interface AccountLoginRequest {
16
+ readonly credential_id: string;
17
+ readonly credential_secret: string;
18
+ readonly expected_user_id: string;
19
+ readonly verify_credential?: boolean;
20
+ }
21
+ export interface AuthorizedDeviceLoginRequest {
22
+ readonly login_token: string;
23
+ readonly expected_user_id: string;
24
+ }
25
+ export interface ClientStatus {
26
+ readonly user_id: string | null;
27
+ readonly device_id: string | null;
28
+ readonly homeserver: string;
29
+ readonly sync_state: "not_authenticated" | "starting" | "syncing" | "error" | "stopped";
30
+ readonly crypto_ready: boolean;
31
+ readonly rooms: readonly (Conversation)[];
32
+ }
33
+ export interface CredentialRevocation {
34
+ readonly credential_id: string;
35
+ readonly user_id: string;
36
+ readonly revoked: true;
37
+ }
38
+ export interface CredentialRevokeRequest {
39
+ readonly credential_id: string;
40
+ }
41
+ export interface EnsureAccountCredentialRequest {
42
+ }
43
+ export interface IdentityLoginError {
44
+ readonly error: IdentityLoginErrorError;
45
+ }
46
+ export interface IdentityLoginErrorError {
47
+ readonly code: string;
48
+ readonly message: string;
49
+ readonly server_code?: string;
50
+ readonly next_action?: string;
51
+ readonly request_id?: string;
52
+ readonly retry_after_ms?: number | bigint;
53
+ readonly edge_request_id?: string;
54
+ readonly stage?: "matrix_login" | "account_exchange" | "restore_session" | "persist_session";
55
+ readonly transport?: "http" | "connect" | "timeout" | "non_json" | "sdk" | "unknown";
56
+ readonly upstream_status?: number | bigint;
57
+ readonly safe_to_retry?: boolean;
58
+ readonly attempt_id?: string;
59
+ readonly device_created?: "yes" | "no" | "unknown";
60
+ }
61
+ export interface IdentityLoginStatus {
62
+ readonly attempt_id: string | null;
63
+ readonly user_id: string | null;
64
+ readonly device_id: string | null;
65
+ readonly state: "no_attempt" | "pending" | "unknown" | "session_saved" | "completed";
66
+ readonly safe_to_retry: boolean;
67
+ readonly device_created: "yes" | "no" | "unknown";
68
+ readonly server_state: "reserved" | "issued" | "completed" | null | "reserved" | "issued" | "completed" | null;
69
+ }
70
+ export interface IdentityStatus {
71
+ readonly user_id: string;
72
+ readonly device_id: string;
73
+ }
74
+ export interface LoginRequest {
75
+ readonly login_token: string;
76
+ }
77
+ export interface OperationResult {
78
+ readonly ok: true;
79
+ }
80
+ export interface PublicRegisterRequest {
81
+ readonly localpart: string;
82
+ readonly display_name?: string;
83
+ }
84
+ export interface PublicRegistrationError {
85
+ readonly error: PublicRegistrationErrorError;
86
+ }
87
+ export interface PublicRegistrationErrorError {
88
+ readonly code: string;
89
+ readonly message: string;
90
+ readonly server_code?: string;
91
+ readonly next_action?: string;
92
+ readonly request_id?: string;
93
+ readonly retry_after_ms?: number | bigint;
94
+ readonly edge_request_id?: string;
95
+ }
96
+ export interface RegisterRequest {
97
+ readonly localpart: string;
98
+ readonly enrollment_token: string;
99
+ readonly display_name?: string | null;
100
+ }
101
+ export interface ShutdownClientRequest {
102
+ }
103
+ export interface ShutdownClientResponse {
104
+ readonly stopping: true;
105
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import type { ThreadMessageRequest } from "./types.js";
2
+ import type { MessageMutationRequest, MessageMutationResult } from "./types.js";
3
+ import type { RequestOptions } from "../../api/options.js";
4
+ import type { Transport } from "../../internal/transport/client.js";
5
+ import type { InboxPage, ReadInboxQuery, ReceivedMessage, SendFileRequest, SendTextRequest, SentEvent } from "./types.js";
6
+ export declare class MessagesClient {
7
+ private readonly transport;
8
+ constructor(transport: Transport);
9
+ inbox(query?: ReadInboxQuery, options?: RequestOptions): Promise<InboxPage>;
10
+ /** A timeout may leave a persisted task; preserve txn_id when checking/retrying. */
11
+ sendText(body: SendTextRequest, options?: RequestOptions): Promise<SentEvent>;
12
+ getEvent(roomId: string, eventId: string, options?: RequestOptions): Promise<ReceivedMessage>;
13
+ sendFile(roomId: string, body: SendFileRequest, options?: RequestOptions): Promise<SentEvent>;
14
+ downloadFile(roomId: string, eventId: string, options?: RequestOptions): Promise<Uint8Array>;
15
+ edit(roomId: string, eventId: string, body: MessageMutationRequest, options?: RequestOptions): Promise<MessageMutationResult>;
16
+ redact(roomId: string, eventId: string, body: MessageMutationRequest, options?: RequestOptions): Promise<MessageMutationResult>;
17
+ sendThread(roomId: string, eventId: string, body: ThreadMessageRequest, options?: RequestOptions): Promise<MessageMutationResult>;
18
+ }
@@ -0,0 +1,35 @@
1
+ export class MessagesClient {
2
+ transport;
3
+ constructor(transport) {
4
+ this.transport = transport;
5
+ }
6
+ inbox(query = {}, options = {}) {
7
+ return this.transport.call("readInbox", { ...options, query });
8
+ }
9
+ /** A timeout may leave a persisted task; preserve txn_id when checking/retrying. */
10
+ sendText(body, options = {}) {
11
+ return this.transport.call("sendEncryptedText", { ...options, body });
12
+ }
13
+ getEvent(roomId, eventId, options = {}) {
14
+ return this.transport.call("readConversationEvent", {
15
+ ...options, path: { room_id: roomId, event_id: eventId },
16
+ });
17
+ }
18
+ sendFile(roomId, body, options = {}) {
19
+ return this.transport.call("sendEncryptedFile", { ...options, path: { room_id: roomId }, body });
20
+ }
21
+ downloadFile(roomId, eventId, options = {}) {
22
+ return this.transport.call("downloadDecryptedFile", {
23
+ ...options, path: { room_id: roomId, event_id: eventId },
24
+ });
25
+ }
26
+ edit(roomId, eventId, body, options = {}) {
27
+ return this.transport.call("editMessage", { timeoutMs: 180000, ...options, path: { room_id: roomId, event_id: eventId }, body });
28
+ }
29
+ redact(roomId, eventId, body, options = {}) {
30
+ return this.transport.call("redactMessage", { timeoutMs: 180000, ...options, path: { room_id: roomId, event_id: eventId }, body });
31
+ }
32
+ sendThread(roomId, eventId, body, options = {}) {
33
+ return this.transport.call("sendThreadMessage", { ...options, path: { room_id: roomId, event_id: eventId }, body });
34
+ }
35
+ }
@@ -0,0 +1 @@
1
+ export type { ThreadMessageRequest, InboxPage, MessageMutationRequest, MessageMutationResult, ReadInboxQuery, ReceivedMessage, SendFileRequest, SendTextRequest, SentEvent } from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,54 @@
1
+ export interface InboxPage {
2
+ readonly events: readonly (ReceivedMessage)[];
3
+ readonly next_cursor: number | bigint;
4
+ }
5
+ export interface MessageMutationRequest {
6
+ readonly body?: string;
7
+ readonly reason?: string;
8
+ readonly request_id: string;
9
+ }
10
+ export interface MessageMutationResult {
11
+ readonly request_id: string;
12
+ readonly state: string;
13
+ readonly event_id: string | null;
14
+ }
15
+ export interface ReadInboxQuery {
16
+ readonly after?: number | bigint;
17
+ readonly limit?: number | bigint;
18
+ }
19
+ export interface ReceivedMessage {
20
+ readonly cursor: number | bigint;
21
+ readonly event_id: string;
22
+ readonly room_id: string;
23
+ readonly sender: string;
24
+ readonly kind: string;
25
+ readonly body: string | null;
26
+ readonly filename: string | null;
27
+ readonly mime_type: string | null;
28
+ readonly mxc_uri: string | null;
29
+ readonly encrypted_attachment: boolean;
30
+ readonly decrypted: boolean;
31
+ readonly reply_to_event_id?: string | null;
32
+ readonly mention_user_ids?: readonly (string)[];
33
+ }
34
+ export interface SendFileRequest {
35
+ readonly filename: string;
36
+ readonly mime_type: string;
37
+ readonly data_base64: string;
38
+ readonly request_id?: string;
39
+ }
40
+ export interface SendTextRequest {
41
+ readonly room_id: string;
42
+ readonly body: string;
43
+ readonly txn_id: string;
44
+ readonly reply_to_event_id?: string;
45
+ readonly mention_user_ids?: readonly (string)[];
46
+ }
47
+ export interface SentEvent {
48
+ readonly event_id: string;
49
+ }
50
+ export interface ThreadMessageRequest {
51
+ readonly body: string;
52
+ readonly request_id: string;
53
+ readonly reply_to_event_id?: string;
54
+ }
@@ -0,0 +1,3 @@
1
+ // @generated by scripts/checks/generate_sdk_protocol.py; DO NOT EDIT.
2
+ // Source: contracts/local-api/v1, agent-profile/v1, shared/v1 (offline refs).
3
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { RequestOptions } from "../../api/options.js";
2
+ import type { Transport } from "../../internal/transport/client.js";
3
+ import type { EnqueueFileRequest, EnqueueTextRequest, OutboxItem, OutboxPage, OutboxQuery } from "./types.js";
4
+ /** Enqueue acknowledges durable local intent, not homeserver acceptance. */
5
+ export declare class OutboxClient {
6
+ private readonly transport;
7
+ constructor(transport: Transport);
8
+ list(query?: OutboxQuery, options?: RequestOptions): Promise<OutboxPage>;
9
+ enqueueText(body: EnqueueTextRequest, options?: RequestOptions): Promise<OutboxItem>;
10
+ enqueueFile(body: EnqueueFileRequest, options?: RequestOptions): Promise<OutboxItem>;
11
+ get(requestId: string, options?: RequestOptions): Promise<OutboxItem>;
12
+ retry(requestId: string, options?: RequestOptions): Promise<OutboxItem>;
13
+ abandon(requestId: string, options?: RequestOptions): Promise<OutboxItem>;
14
+ }
@@ -0,0 +1,25 @@
1
+ /** Enqueue acknowledges durable local intent, not homeserver acceptance. */
2
+ export class OutboxClient {
3
+ transport;
4
+ constructor(transport) {
5
+ this.transport = transport;
6
+ }
7
+ list(query = {}, options = {}) {
8
+ return this.transport.call("listOutbox", { ...options, query });
9
+ }
10
+ enqueueText(body, options = {}) {
11
+ return this.transport.call("enqueueText", { ...options, body });
12
+ }
13
+ enqueueFile(body, options = {}) {
14
+ return this.transport.call("enqueueFile", { ...options, body });
15
+ }
16
+ get(requestId, options = {}) {
17
+ return this.transport.call("readOutboxItem", { ...options, path: { request_id: requestId } });
18
+ }
19
+ retry(requestId, options = {}) {
20
+ return this.transport.call("retryOutboxItem", { ...options, path: { request_id: requestId }, body: {} });
21
+ }
22
+ abandon(requestId, options = {}) {
23
+ return this.transport.call("abandonOutboxItem", { ...options, path: { request_id: requestId }, body: {} });
24
+ }
25
+ }
@@ -0,0 +1 @@
1
+ export type { EnqueueFileRequest, EnqueueTextRequest, OutboxActionRequest, OutboxItem, OutboxPage, OutboxQuery, } from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ export interface EnqueueFileRequest {
2
+ readonly request_id: string;
3
+ readonly room_id: string;
4
+ readonly filename: string;
5
+ readonly mime_type: string;
6
+ readonly data_base64: string;
7
+ readonly reply_to_event_id?: string;
8
+ }
9
+ export interface EnqueueTextRequest {
10
+ readonly request_id: string;
11
+ readonly room_id: string;
12
+ readonly body: string;
13
+ readonly reply_to_event_id?: string;
14
+ readonly mention_user_ids?: readonly (string)[];
15
+ }
16
+ export interface OutboxActionRequest {
17
+ }
18
+ export interface OutboxItem {
19
+ readonly request_id: string;
20
+ readonly room_id: string;
21
+ readonly txn_id: string;
22
+ readonly kind: "text" | "attachment" | "edit" | "redaction" | "thread";
23
+ readonly state: "queued" | "sending" | "retry_wait" | "sent" | "failed" | "uncertain" | "held" | "abandoned";
24
+ readonly event_id: string | null;
25
+ readonly input_event_id: string | null;
26
+ readonly attempts: number | bigint;
27
+ readonly created_at_ms: number | bigint;
28
+ readonly updated_at_ms: number | bigint;
29
+ readonly first_attempt_at_ms: number | bigint | null;
30
+ readonly retry_deadline_ms: number | bigint | null;
31
+ readonly next_attempt_at_ms: number | bigint | null;
32
+ readonly error_code: string | null;
33
+ }
34
+ export interface OutboxPage {
35
+ readonly items: readonly (OutboxItem)[];
36
+ readonly next_cursor: string | null;
37
+ }
38
+ export interface OutboxQuery {
39
+ readonly after?: string;
40
+ readonly limit?: number | bigint;
41
+ }
@@ -0,0 +1,3 @@
1
+ // @generated by scripts/checks/generate_sdk_protocol.py; DO NOT EDIT.
2
+ // Source: contracts/local-api/v1, agent-profile/v1, shared/v1 (offline refs).
3
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { RequestOptions } from "../../api/options.js";
2
+ import type { Transport } from "../../internal/transport/client.js";
3
+ import type { PairingDecisionRequest, PairingList, PairingRequest } from "./types.js";
4
+ /** Decisions require the fingerprint obtained from the Agent's trusted context. */
5
+ export declare class PairingClient {
6
+ private readonly transport;
7
+ constructor(transport: Transport);
8
+ list(options?: RequestOptions): Promise<PairingList>;
9
+ get(pairingId: string, options?: RequestOptions): Promise<PairingRequest>;
10
+ decide(pairingId: string, body: PairingDecisionRequest, options?: RequestOptions): Promise<PairingRequest>;
11
+ }