openmates 0.11.0-alpha.2 → 0.11.0-alpha.21
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/dist/chunk-AXNRPVLE.js +242 -0
- package/dist/{chunk-N6QY7K6L.js → chunk-JQ5CPV6P.js} +2389 -748
- package/dist/cli.js +2 -1
- package/dist/index.d.ts +108 -9
- package/dist/index.js +4 -1
- package/dist/uploadService-S464XJRA.js +10 -0
- package/package.json +5 -3
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -7,17 +7,13 @@ interface OpenMatesSession {
|
|
|
7
7
|
wsToken: string | null;
|
|
8
8
|
cookies: Record<string, string>;
|
|
9
9
|
masterKeyExportedB64: string;
|
|
10
|
+
emailEncryptionKeyB64?: string | null;
|
|
10
11
|
hashedEmail: string;
|
|
11
12
|
userEmailSalt: string;
|
|
12
13
|
createdAt: number;
|
|
13
14
|
authorizerDeviceName: string | null;
|
|
14
15
|
autoLogoutMinutes: number | null;
|
|
15
16
|
}
|
|
16
|
-
interface IncognitoHistoryItem {
|
|
17
|
-
role: "user" | "assistant";
|
|
18
|
-
content: string;
|
|
19
|
-
createdAt: number;
|
|
20
|
-
}
|
|
21
17
|
/**
|
|
22
18
|
* Raw chat record from the WS phase3 payload.
|
|
23
19
|
* All encrypted_* fields are stored as-is (base64 ciphertext).
|
|
@@ -70,6 +66,11 @@ interface StreamEvent {
|
|
|
70
66
|
/** Human-readable model name. */
|
|
71
67
|
modelName: string | null;
|
|
72
68
|
}
|
|
69
|
+
type SubChatEventType = "spawn_sub_chats" | "sub_chat_progress" | "sub_chat_confirmation_required" | "sub_chat_confirmation_resolved" | "awaiting_sub_chats_completion" | "sub_chat_completed" | "awaiting_user_input";
|
|
70
|
+
interface SubChatEvent {
|
|
71
|
+
type: SubChatEventType;
|
|
72
|
+
payload: Record<string, unknown>;
|
|
73
|
+
}
|
|
73
74
|
|
|
74
75
|
/** Minimal model info needed for mention resolution */
|
|
75
76
|
interface ModelInfo {
|
|
@@ -109,6 +110,35 @@ interface MentionContext {
|
|
|
109
110
|
memoryEntries: MemoryEntryInfo[];
|
|
110
111
|
}
|
|
111
112
|
|
|
113
|
+
/**
|
|
114
|
+
* @file Embed creation pipeline for the CLI — generates encrypted embeds
|
|
115
|
+
* with proper key wrapping, matching the web app's zero-knowledge architecture.
|
|
116
|
+
*
|
|
117
|
+
* For each embed:
|
|
118
|
+
* 1. Content is TOON-encoded (or JSON-fallback)
|
|
119
|
+
* 2. A random AES-256 embed key is generated
|
|
120
|
+
* 3. Content, type, and text_preview are encrypted with the embed key
|
|
121
|
+
* 4. The embed key is wrapped with both master key and chat key
|
|
122
|
+
* 5. SHA-256 hashes are computed for all IDs
|
|
123
|
+
* 6. The encrypted embed + wrapped keys are attached to chat_message_added
|
|
124
|
+
*
|
|
125
|
+
* Mirrors: cryptoService.ts (encryptWithEmbedKey, wrapEmbedKeyWithMasterKey,
|
|
126
|
+
* wrapEmbedKeyWithChatKey, generateEmbedKey)
|
|
127
|
+
* chatSyncServiceSenders.ts (encrypted_embeds construction)
|
|
128
|
+
*
|
|
129
|
+
* Architecture: docs/architecture/embeds.md
|
|
130
|
+
*/
|
|
131
|
+
/** A prepared embed ready for encryption and sending */
|
|
132
|
+
interface PreparedEmbed {
|
|
133
|
+
embedId: string;
|
|
134
|
+
type: string;
|
|
135
|
+
content: string;
|
|
136
|
+
textPreview: string;
|
|
137
|
+
status: string;
|
|
138
|
+
filePath?: string;
|
|
139
|
+
contentHash?: string;
|
|
140
|
+
textLengthChars?: number;
|
|
141
|
+
}
|
|
112
142
|
/** A fully encrypted embed ready for the WebSocket payload */
|
|
113
143
|
interface EncryptedEmbed {
|
|
114
144
|
embed_id: string;
|
|
@@ -157,6 +187,23 @@ interface EmbedKeyWrapper {
|
|
|
157
187
|
*/
|
|
158
188
|
type ShareDuration = 0 | 60 | 3600 | 86400 | 604800 | 1209600 | 2592000 | 7776000;
|
|
159
189
|
|
|
190
|
+
interface CliSubChatRequest {
|
|
191
|
+
id?: string;
|
|
192
|
+
chat_id?: string;
|
|
193
|
+
user_message_id?: string;
|
|
194
|
+
message_id?: string;
|
|
195
|
+
prompt?: string;
|
|
196
|
+
wait_for_completion?: boolean;
|
|
197
|
+
}
|
|
198
|
+
interface SubChatApprovalRequest {
|
|
199
|
+
chatId: string;
|
|
200
|
+
taskId: string;
|
|
201
|
+
subChats: CliSubChatRequest[];
|
|
202
|
+
maxAutoSubChats: number | null;
|
|
203
|
+
maxDirectSubChats: number | null;
|
|
204
|
+
existingSubChats: number | null;
|
|
205
|
+
remainingSubChats: number | null;
|
|
206
|
+
}
|
|
160
207
|
/** A single field definition within a memory type schema. */
|
|
161
208
|
interface MemoryFieldDef {
|
|
162
209
|
type: string;
|
|
@@ -298,6 +345,23 @@ interface OpenMatesClientOptions {
|
|
|
298
345
|
apiUrl?: string;
|
|
299
346
|
session?: OpenMatesSession;
|
|
300
347
|
}
|
|
348
|
+
interface InvoiceListItem {
|
|
349
|
+
id: string;
|
|
350
|
+
order_id?: string | null;
|
|
351
|
+
date: string;
|
|
352
|
+
amount: string;
|
|
353
|
+
credits_purchased: number;
|
|
354
|
+
filename: string;
|
|
355
|
+
is_gift_card?: boolean;
|
|
356
|
+
refunded_at?: string | null;
|
|
357
|
+
refund_status?: string | null;
|
|
358
|
+
currency?: string | null;
|
|
359
|
+
provider?: string | null;
|
|
360
|
+
}
|
|
361
|
+
interface DownloadedDocument {
|
|
362
|
+
filename: string;
|
|
363
|
+
data: Uint8Array;
|
|
364
|
+
}
|
|
301
365
|
/**
|
|
302
366
|
* Derive the web app URL from the API URL so the pair token is always looked
|
|
303
367
|
* up on the same backend the CLI created it on.
|
|
@@ -409,8 +473,16 @@ declare class OpenMatesClient {
|
|
|
409
473
|
incognito?: boolean;
|
|
410
474
|
/** Streaming callback — fires for typing, chunk, and done events. */
|
|
411
475
|
onStream?: (event: StreamEvent) => void;
|
|
476
|
+
/** Sub-chat lifecycle callback for progress/status output. */
|
|
477
|
+
onSubChatEvent?: (event: SubChatEvent) => void;
|
|
478
|
+
/** Approval callback used when the server asks before starting a large sub-chat batch. */
|
|
479
|
+
onSubChatApprovalRequest?: (request: SubChatApprovalRequest) => boolean | Promise<boolean>;
|
|
480
|
+
/** Explicit opt-in for automatic sub-chat approval in non-interactive runs. */
|
|
481
|
+
autoApproveSubChats?: boolean;
|
|
412
482
|
/** Encrypted file embeds to attach to the message (code, images, PDFs). */
|
|
413
483
|
encryptedEmbeds?: EncryptedEmbed[];
|
|
484
|
+
/** Prepared embeds to encrypt after the real chat/message IDs are known. */
|
|
485
|
+
preparedEmbeds?: PreparedEmbed[];
|
|
414
486
|
}): Promise<{
|
|
415
487
|
chatId: string;
|
|
416
488
|
assistant: string;
|
|
@@ -419,9 +491,10 @@ declare class OpenMatesClient {
|
|
|
419
491
|
mateName: string | null;
|
|
420
492
|
/** Follow-up suggestions from post-processing (may be empty for incognito chats). */
|
|
421
493
|
followUpSuggestions: string[];
|
|
494
|
+
/** Sub-chat lifecycle frames observed while collecting the parent response. */
|
|
495
|
+
subChatEvents: SubChatEvent[];
|
|
422
496
|
}>;
|
|
423
|
-
|
|
424
|
-
clearIncognitoHistory(): void;
|
|
497
|
+
private persistStreamedEmbeds;
|
|
425
498
|
/**
|
|
426
499
|
* Delete a chat by ID.
|
|
427
500
|
*
|
|
@@ -465,7 +538,7 @@ declare class OpenMatesClient {
|
|
|
465
538
|
}>;
|
|
466
539
|
settingsGet(path: string): Promise<unknown>;
|
|
467
540
|
settingsPost(path: string, body: Record<string, unknown>): Promise<unknown>;
|
|
468
|
-
settingsDelete(path: string): Promise<unknown>;
|
|
541
|
+
settingsDelete(path: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
469
542
|
settingsPatch(path: string, body: Record<string, unknown>): Promise<unknown>;
|
|
470
543
|
redeemGiftCard(code: string): Promise<{
|
|
471
544
|
success: boolean;
|
|
@@ -474,6 +547,27 @@ declare class OpenMatesClient {
|
|
|
474
547
|
message: string;
|
|
475
548
|
}>;
|
|
476
549
|
listRedeemedGiftCards(): Promise<unknown>;
|
|
550
|
+
listInvoices(): Promise<{
|
|
551
|
+
invoices: InvoiceListItem[];
|
|
552
|
+
}>;
|
|
553
|
+
downloadInvoice(invoiceId: string): Promise<DownloadedDocument>;
|
|
554
|
+
downloadCreditNote(invoiceId: string): Promise<DownloadedDocument>;
|
|
555
|
+
requestRefund(invoiceId: string): Promise<unknown>;
|
|
556
|
+
updateUsername(username: string): Promise<unknown>;
|
|
557
|
+
updateProfileImage(filePath: string): Promise<unknown>;
|
|
558
|
+
getNewsletterCategories(): Promise<unknown>;
|
|
559
|
+
updateNewsletterCategories(categories: Record<string, boolean>): Promise<unknown>;
|
|
560
|
+
subscribeNewsletter(email: string, language?: string, darkmode?: boolean): Promise<unknown>;
|
|
561
|
+
confirmNewsletter(token: string): Promise<unknown>;
|
|
562
|
+
unsubscribeNewsletter(token: string): Promise<unknown>;
|
|
563
|
+
updateEmailNotificationSettings(payload: {
|
|
564
|
+
enabled: boolean;
|
|
565
|
+
email?: string | null;
|
|
566
|
+
preferences: Record<string, boolean>;
|
|
567
|
+
backup_reminder_interval_days?: number;
|
|
568
|
+
}): Promise<unknown>;
|
|
569
|
+
listNotifications(limit?: number): Promise<unknown>;
|
|
570
|
+
streamNotifications(): AsyncGenerator<unknown>;
|
|
477
571
|
/**
|
|
478
572
|
* Fetch today's daily inspirations.
|
|
479
573
|
*
|
|
@@ -607,6 +701,9 @@ declare class OpenMatesClient {
|
|
|
607
701
|
*/
|
|
608
702
|
buildMentionContext(): Promise<MentionContext>;
|
|
609
703
|
private normalizePath;
|
|
704
|
+
private downloadPaymentPdf;
|
|
705
|
+
private ensureEmailEncryptionKey;
|
|
706
|
+
private hydrateEmailEncryptionKey;
|
|
610
707
|
private requireSession;
|
|
611
708
|
private getMasterKeyBytes;
|
|
612
709
|
private getValidSessionFromDisk;
|
|
@@ -684,4 +781,6 @@ declare function parseNewChatSuggestionText(text: string): {
|
|
|
684
781
|
skillId: string | null;
|
|
685
782
|
};
|
|
686
783
|
|
|
687
|
-
|
|
784
|
+
declare function defaultCloneBranchForVersion(version: string): string | null;
|
|
785
|
+
|
|
786
|
+
export { type CachedChat, type CachedNewChatSuggestion, type ChatListPage, type DecryptedEmbed, type DecryptedMemoryEntry, type DecryptedMessage, type DecryptedNewChatSuggestion, type DocsFile, type DocsFolder, type DocsSearchResult, type DocsTree, MATE_NAMES, MEMORY_TYPE_REGISTRY, type MemoryFieldDef, type MemoryTypeDef, OpenMatesClient, type OpenMatesClientOptions, type OpenMatesSession, type SyncCache, defaultCloneBranchForVersion, deriveAppUrl, parseNewChatSuggestionText };
|
package/dist/index.js
CHANGED
|
@@ -2,15 +2,18 @@ import {
|
|
|
2
2
|
MATE_NAMES,
|
|
3
3
|
MEMORY_TYPE_REGISTRY,
|
|
4
4
|
OpenMatesClient,
|
|
5
|
+
defaultCloneBranchForVersion,
|
|
5
6
|
deriveAppUrl,
|
|
6
7
|
getExtForLang,
|
|
7
8
|
parseNewChatSuggestionText,
|
|
8
9
|
serializeToYaml
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JQ5CPV6P.js";
|
|
11
|
+
import "./chunk-AXNRPVLE.js";
|
|
10
12
|
export {
|
|
11
13
|
MATE_NAMES,
|
|
12
14
|
MEMORY_TYPE_REGISTRY,
|
|
13
15
|
OpenMatesClient,
|
|
16
|
+
defaultCloneBranchForVersion,
|
|
14
17
|
deriveAppUrl,
|
|
15
18
|
getExtForLang,
|
|
16
19
|
parseNewChatSuggestionText,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openmates",
|
|
3
|
-
"version": "0.11.0-alpha.
|
|
3
|
+
"version": "0.11.0-alpha.21",
|
|
4
4
|
"description": "OpenMates CLI and SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,9 +18,11 @@
|
|
|
18
18
|
"test:unit:crypto": "node --test --experimental-strip-types tests/crypto.test.ts",
|
|
19
19
|
"test:unit:storage": "node --test --experimental-strip-types --loader ./tests/loader.mjs tests/storage.test.ts",
|
|
20
20
|
"test:unit:keychain": "node --test --experimental-strip-types tests/keychain.test.ts",
|
|
21
|
+
"test:unit:ws": "node --test --experimental-strip-types tests/ws.test.ts",
|
|
22
|
+
"test:unit:url-embed": "node --test --experimental-strip-types --loader ./tests/loader.mjs tests/urlEmbed.test.ts",
|
|
21
23
|
"test:unit:server": "node --test --experimental-strip-types tests/server.test.ts",
|
|
22
24
|
"test:unit:cli": "node --test tests/cli.test.ts",
|
|
23
|
-
"test": "node --test --experimental-strip-types --loader ./tests/loader.mjs tests/crypto.test.ts tests/storage.test.ts tests/keychain.test.ts tests/mentions.test.ts tests/outputRedactor.test.ts tests/fileEmbed.test.ts tests/embedCreator.test.ts tests/shareEncryption.test.ts tests/server.test.ts && node --test tests/cli.test.ts"
|
|
25
|
+
"test": "node --test --experimental-strip-types --loader ./tests/loader.mjs tests/crypto.test.ts tests/storage.test.ts tests/keychain.test.ts tests/mentions.test.ts tests/outputRedactor.test.ts tests/fileEmbed.test.ts tests/embedCreator.test.ts tests/shareEncryption.test.ts tests/server.test.ts tests/ws.test.ts tests/urlEmbed.test.ts && node --test tests/cli.test.ts"
|
|
24
26
|
},
|
|
25
27
|
"keywords": [
|
|
26
28
|
"openmates",
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
"@toon-format/toon": "2.1.0",
|
|
44
46
|
"ahocorasick": "1.0.2",
|
|
45
47
|
"qrcode-terminal": "^0.12.0",
|
|
46
|
-
"ws": "
|
|
48
|
+
"ws": "8.20.1"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
49
51
|
"@types/node": "^24.5.0",
|