openmates 0.12.0-alpha.2 → 0.12.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/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  getExtForLang,
4
4
  serializeToYaml
5
- } from "./chunk-UG4LLEOG.js";
5
+ } from "./chunk-REXWGRCR.js";
6
6
  import "./chunk-AXNRPVLE.js";
7
7
  export {
8
8
  getExtForLang,
package/dist/index.d.ts CHANGED
@@ -226,6 +226,41 @@ interface SubChatApprovalRequest {
226
226
  existingSubChats: number | null;
227
227
  remainingSubChats: number | null;
228
228
  }
229
+ interface ConnectedAccountDirectoryEntry {
230
+ connected_account_id: string;
231
+ app_id: string;
232
+ account_ref: string;
233
+ label: string;
234
+ capabilities: string[];
235
+ runtime_modes?: Record<string, string>;
236
+ }
237
+ interface ConnectedAccountTurnTokenRefInput {
238
+ connected_account_id: string;
239
+ app_id: string;
240
+ allowed_actions: string[];
241
+ refresh_token_envelope: Record<string, unknown>;
242
+ action_scope?: Record<string, unknown>;
243
+ }
244
+ interface ConnectedAccountTurnTokenRef {
245
+ connected_account_id: string;
246
+ app_id: string;
247
+ turn_token_ref: string;
248
+ allowed_actions: string[];
249
+ action_scope?: Record<string, unknown>;
250
+ expires_at: number;
251
+ }
252
+ type LearningModeAgeGroup = "under_10" | "10_12" | "13_15" | "16_18" | "adult";
253
+ interface LearningModeStatus {
254
+ enabled: boolean;
255
+ age_group: LearningModeAgeGroup | null;
256
+ failed_attempts: number;
257
+ deactivation_blocked_until: number | null;
258
+ }
259
+ interface LearningModeContext {
260
+ enabled: boolean;
261
+ ageGroup?: LearningModeAgeGroup | null;
262
+ source?: "anonymous_session";
263
+ }
229
264
  /** A single field definition within a memory type schema. */
230
265
  interface MemoryFieldDef {
231
266
  type: string;
@@ -266,6 +301,7 @@ interface SkillParam {
266
301
  description: string;
267
302
  required: boolean;
268
303
  default?: unknown;
304
+ inputShape?: "requests" | "flat";
269
305
  }
270
306
  interface ChatListPage {
271
307
  chats: ChatListItem[];
@@ -274,6 +310,23 @@ interface ChatListPage {
274
310
  limit: number;
275
311
  hasMore: boolean;
276
312
  }
313
+ interface BenchmarkMetadata {
314
+ source: "benchmark";
315
+ benchmark_run_id: string;
316
+ benchmark_suite: string;
317
+ benchmark_case: string;
318
+ benchmark_target_model: string;
319
+ benchmark_judge_model?: string;
320
+ }
321
+ interface BenchmarkHistoryMessage {
322
+ message_id: string;
323
+ role: "user" | "assistant" | "system";
324
+ sender_name: string;
325
+ content: string;
326
+ created_at: number;
327
+ chat_id?: string;
328
+ category?: string | null;
329
+ }
277
330
  /** Decrypted message for display */
278
331
  interface DecryptedMessage {
279
332
  id: string;
@@ -297,6 +350,35 @@ interface DecryptedEmbed {
297
350
  skillId: string | null;
298
351
  createdAt: number | null;
299
352
  }
353
+ interface EmbedVersionMeta {
354
+ version_number: number;
355
+ created_at: number;
356
+ has_snapshot: boolean;
357
+ has_patch: boolean;
358
+ encrypted_snapshot?: string | null;
359
+ encrypted_patch?: string | null;
360
+ }
361
+ interface EmbedVersionsResponse {
362
+ embed_id: string;
363
+ current_version: number;
364
+ versions: EmbedVersionMeta[];
365
+ readonly: boolean;
366
+ }
367
+ interface EmbedVersionContentResponse {
368
+ embed_id: string;
369
+ version_number: number;
370
+ current_version: number;
371
+ content?: string;
372
+ rows?: EmbedVersionMeta[];
373
+ readonly: boolean;
374
+ }
375
+ interface EmbedVersionRestoreResponse {
376
+ embed_id: string;
377
+ restored_from_version: number;
378
+ version_number: number;
379
+ content: string;
380
+ content_hash: string;
381
+ }
300
382
  /** Video metadata attached to a daily inspiration. */
301
383
  interface DailyInspirationVideo {
302
384
  youtube_id: string;
@@ -339,17 +421,11 @@ declare const MATE_NAMES: Record<string, string>;
339
421
  *
340
422
  * Mirrors the format used by NewChatSuggestions.svelte in the web app.
341
423
  * The `body` text is the plain text to insert into the message input.
342
- * The optional `appId` and `skillId` are parsed from the `[app-skill]` prefix
343
- * (e.g. "[web-search] What's the weather today?" → appId="web", skillId="search").
344
424
  */
345
425
  interface DecryptedNewChatSuggestion {
346
426
  id: string;
347
427
  chatId: string | null;
348
428
  body: string;
349
- /** App ID if the suggestion has an [app-skill] or [app] prefix. */
350
- appId: string | null;
351
- /** Skill ID if the suggestion has an [app-skill] prefix. */
352
- skillId: string | null;
353
429
  createdAt: number;
354
430
  }
355
431
  /** A decrypted memory entry as returned to CLI callers. */
@@ -436,6 +512,12 @@ interface BackupCodesResult {
436
512
  message: string;
437
513
  backup_codes: string[];
438
514
  }
515
+ interface AnonymousFreeUsageStatus {
516
+ active: boolean;
517
+ reason: string | null;
518
+ resetAt: string | null;
519
+ cta: string | null;
520
+ }
439
521
  /**
440
522
  * Derive the web app URL from the API URL so the pair token is always looked
441
523
  * up on the same backend the CLI created it on.
@@ -449,8 +531,51 @@ declare class OpenMatesClient {
449
531
  constructor(options?: OpenMatesClientOptions);
450
532
  static load(options?: OpenMatesClientOptions): OpenMatesClient;
451
533
  hasSession(): boolean;
534
+ getAnonymousFreeUsageStatus(): Promise<AnonymousFreeUsageStatus>;
535
+ sendAnonymousMessage(params: {
536
+ message: string;
537
+ learningMode?: LearningModeContext;
538
+ }): Promise<{
539
+ status: "completed";
540
+ chatId: string;
541
+ messageId: string;
542
+ assistant: string;
543
+ category: string | null;
544
+ modelName: string | null;
545
+ mateName: string | null;
546
+ followUpSuggestions: string[];
547
+ subChatEvents: SubChatEvent[];
548
+ appSettingsMemoryRequests: Array<{
549
+ requestId: string | null;
550
+ requestedKeys: string[];
551
+ approvedKeys: string[];
552
+ entryCount: number;
553
+ }>;
554
+ }>;
555
+ createTurnTokenRefs(params: {
556
+ chatId: string;
557
+ messageId: string;
558
+ refs: ConnectedAccountTurnTokenRefInput[];
559
+ }): Promise<ConnectedAccountTurnTokenRef[]>;
560
+ cancelConnectedAccountAction(params: {
561
+ actionId: string;
562
+ chatId: string;
563
+ messageId: string;
564
+ }): Promise<Record<string, unknown>>;
565
+ undoConnectedAccountAction(params: {
566
+ actionId: string;
567
+ chatId: string;
568
+ messageId: string;
569
+ turnTokenRef: string;
570
+ }): Promise<Record<string, unknown>>;
452
571
  loginWithPairAuth(): Promise<void>;
453
572
  whoAmI(): Promise<Record<string, unknown>>;
573
+ getLearningModeStatus(): Promise<LearningModeStatus>;
574
+ activateLearningMode(params: {
575
+ ageGroup: LearningModeAgeGroup;
576
+ passcode: string;
577
+ }): Promise<LearningModeStatus>;
578
+ deactivateLearningMode(passcode: string): Promise<LearningModeStatus>;
454
579
  logout(): Promise<void>;
455
580
  requestSignupEmailCode(params: {
456
581
  email: string;
@@ -589,6 +714,24 @@ declare class OpenMatesClient {
589
714
  encryptedEmbeds?: EncryptedEmbed[];
590
715
  /** Prepared embeds to encrypt after the real chat/message IDs are known. */
591
716
  preparedEmbeds?: PreparedEmbed[];
717
+ /** Placeholder-to-original PII mappings created before sending the user message. */
718
+ piiMappings?: Array<{
719
+ placeholder: string;
720
+ original: string;
721
+ type: string;
722
+ }>;
723
+ /** Redacted connected-account directory for AI-visible account selection. */
724
+ connectedAccountDirectory?: ConnectedAccountDirectoryEntry[];
725
+ /** Refresh-token envelopes to convert into short-lived token refs before send. */
726
+ connectedAccountTokenRefInputs?: ConnectedAccountTurnTokenRefInput[];
727
+ /** Non-sensitive CLI benchmark labels for usage-source grouping. */
728
+ benchmarkMetadata?: BenchmarkMetadata;
729
+ /** Full plaintext history for incognito benchmark turns. */
730
+ messageHistory?: BenchmarkHistoryMessage[];
731
+ /** Account-wide Learning Mode context when already known by the caller. */
732
+ learningMode?: LearningModeContext;
733
+ /** Start collecting before send for latency-sensitive benchmark turns. */
734
+ precollectResponse?: boolean;
592
735
  }): Promise<{
593
736
  status: "completed" | "waiting_for_user";
594
737
  chatId: string;
@@ -610,6 +753,7 @@ declare class OpenMatesClient {
610
753
  }>;
611
754
  }>;
612
755
  private persistStreamedEmbeds;
756
+ private persistPostProcessingMetadata;
613
757
  /**
614
758
  * Delete a chat by ID.
615
759
  *
@@ -823,6 +967,12 @@ declare class OpenMatesClient {
823
967
  * @returns Full share URL, e.g. https://openmates.org/share/embed/{id}#key={blob}
824
968
  */
825
969
  createEmbedShareLink(embedIdOrShort: string, durationSeconds?: ShareDuration, password?: string): Promise<string>;
970
+ listEmbedVersions(embedIdOrShort: string): Promise<EmbedVersionsResponse>;
971
+ getEmbedVersion(embedIdOrShort: string, version: number): Promise<EmbedVersionContentResponse>;
972
+ restoreEmbedVersion(embedIdOrShort: string, version: number): Promise<EmbedVersionRestoreResponse>;
973
+ private reconstructEncryptedEmbedVersion;
974
+ private formatEmbedVersionError;
975
+ private resolveEmbedId;
826
976
  /**
827
977
  * Build the context needed for CLI mention resolution.
828
978
  * Fetches apps (with skills, focus modes, memory categories) and
@@ -859,7 +1009,8 @@ declare class OpenMatesClient {
859
1009
  * The sync cache stores encrypted data — decryption is always on-demand.
860
1010
  * SECURITY: decrypted user content is NEVER written to disk.
861
1011
  */
862
- ensureSynced(forceRefresh?: boolean): Promise<SyncCache>;
1012
+ ensureSynced(forceRefresh?: boolean, refreshChatIds?: string[]): Promise<SyncCache>;
1013
+ private persistPendingAIResponsesFromSync;
863
1014
  private prompt;
864
1015
  private waitForPairAuthorization;
865
1016
  private installPairExitListener;
@@ -895,23 +1046,17 @@ interface DocsSearchResult {
895
1046
  title: string;
896
1047
  snippet: string;
897
1048
  }
898
- /**
899
- * Parse the [app-skill] or [app] prefix from a new-chat suggestion text.
900
- *
901
- * Mirrors parseSuggestion() in NewChatSuggestions.svelte (web app).
902
- *
903
- * Examples:
904
- * "[web-search] What's the weather today?" → { body: "What's the weather today?", appId: "web", skillId: "search" }
905
- * "[images-generate] Draw a cat" → { body: "Draw a cat", appId: "images", skillId: "generate" }
906
- * "[web] Open my bookmarks" → { body: "Open my bookmarks", appId: "web", skillId: null }
907
- * "How do I fix this bug?" → { body: "How do I fix this bug?", appId: null, skillId: null }
908
- */
909
- declare function parseNewChatSuggestionText(text: string): {
910
- body: string;
911
- appId: string | null;
912
- skillId: string | null;
913
- };
914
1049
 
915
1050
  declare function defaultCloneBranchForVersion(version: string): string | null;
916
1051
 
917
- export { type AuthMethodsStatus, type BackupCodesResult, type BankTransferOrderDetails, type BankTransferStatus, type CachedChat, type CachedNewChatSuggestion, type ChatListPage, type CliSignupResult, type DecryptedEmbed, type DecryptedMemoryEntry, type DecryptedMessage, type DecryptedNewChatSuggestion, type DocsFile, type DocsFolder, type DocsSearchResult, type DocsTree, type GiftCardBankTransferStatus, MATE_NAMES, MEMORY_TYPE_REGISTRY, type MemoryFieldDef, type MemoryTypeDef, OpenMatesClient, type OpenMatesClientOptions, type OpenMatesSession, type SyncCache, type TotpSetupStartResult, defaultCloneBranchForVersion, deriveAppUrl, parseNewChatSuggestionText };
1052
+ declare const ASSISTANT_FEEDBACK_THANKS = "Thanks for the feedback!";
1053
+ declare const ASSISTANT_FEEDBACK_REPORT_TITLE = "Assistant response quality bad:";
1054
+ type AssistantFeedbackDecision = {
1055
+ rating: number;
1056
+ action: "thanks" | "report_issue";
1057
+ message: string;
1058
+ reportTitle?: string;
1059
+ };
1060
+ declare function buildAssistantFeedbackDecision(rating: number): AssistantFeedbackDecision;
1061
+
1062
+ export { ASSISTANT_FEEDBACK_REPORT_TITLE, ASSISTANT_FEEDBACK_THANKS, type AssistantFeedbackDecision, type AuthMethodsStatus, type BackupCodesResult, type BankTransferOrderDetails, type BankTransferStatus, type CachedChat, type CachedNewChatSuggestion, type ChatListPage, type CliSignupResult, type DecryptedEmbed, type DecryptedMemoryEntry, type DecryptedMessage, type DecryptedNewChatSuggestion, type DocsFile, type DocsFolder, type DocsSearchResult, type DocsTree, type GiftCardBankTransferStatus, MATE_NAMES, MEMORY_TYPE_REGISTRY, type MemoryFieldDef, type MemoryTypeDef, OpenMatesClient, type OpenMatesClientOptions, type OpenMatesSession, type SyncCache, type TotpSetupStartResult, buildAssistantFeedbackDecision, defaultCloneBranchForVersion, deriveAppUrl };
package/dist/index.js CHANGED
@@ -1,21 +1,25 @@
1
1
  import {
2
+ ASSISTANT_FEEDBACK_REPORT_TITLE,
3
+ ASSISTANT_FEEDBACK_THANKS,
2
4
  MATE_NAMES,
3
5
  MEMORY_TYPE_REGISTRY,
4
6
  OpenMatesClient,
7
+ buildAssistantFeedbackDecision,
5
8
  defaultCloneBranchForVersion,
6
9
  deriveAppUrl,
7
10
  getExtForLang,
8
- parseNewChatSuggestionText,
9
11
  serializeToYaml
10
- } from "./chunk-UG4LLEOG.js";
12
+ } from "./chunk-REXWGRCR.js";
11
13
  import "./chunk-AXNRPVLE.js";
12
14
  export {
15
+ ASSISTANT_FEEDBACK_REPORT_TITLE,
16
+ ASSISTANT_FEEDBACK_THANKS,
13
17
  MATE_NAMES,
14
18
  MEMORY_TYPE_REGISTRY,
15
19
  OpenMatesClient,
20
+ buildAssistantFeedbackDecision,
16
21
  defaultCloneBranchForVersion,
17
22
  deriveAppUrl,
18
23
  getExtForLang,
19
- parseNewChatSuggestionText,
20
24
  serializeToYaml
21
25
  };
Binary file
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="1200" height="800" viewBox="0 0 1200 800">
3
+ <rect width="1200" height="800" fill="#d8ecff"/>
4
+ <rect y="560" width="1200" height="240" fill="#d7c39a"/>
5
+ <text x="600" y="88" text-anchor="middle" font-family="Arial, sans-serif" font-size="44" font-weight="700" fill="#23344d">Brandenburger Tor, Berlin</text>
6
+ <g transform="translate(160 170)" fill="#c9aa6a" stroke="#5d4522" stroke-width="8">
7
+ <rect x="80" y="160" width="800" height="58"/>
8
+ <rect x="120" y="218" width="720" height="48"/>
9
+ <rect x="150" y="266" width="660" height="42"/>
10
+ <g fill="#d9bd7d">
11
+ <rect x="170" y="308" width="54" height="250"/>
12
+ <rect x="285" y="308" width="54" height="250"/>
13
+ <rect x="400" y="308" width="54" height="250"/>
14
+ <rect x="515" y="308" width="54" height="250"/>
15
+ <rect x="630" y="308" width="54" height="250"/>
16
+ <rect x="745" y="308" width="54" height="250"/>
17
+ </g>
18
+ <rect x="130" y="558" width="700" height="50"/>
19
+ <path d="M480 30 C530 72 620 88 682 48 L720 84 C652 142 530 124 456 78 Z" fill="#3e6f5f"/>
20
+ <circle cx="510" cy="92" r="22" fill="#3e6f5f"/>
21
+ <circle cx="625" cy="92" r="22" fill="#3e6f5f"/>
22
+ <path d="M565 38 l26 78 h-52 z" fill="#3e6f5f"/>
23
+ </g>
24
+ <text x="600" y="740" text-anchor="middle" font-family="Arial, sans-serif" font-size="32" fill="#23344d">Neoclassical gate with Quadriga on top</text>
25
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmates",
3
- "version": "0.12.0-alpha.2",
3
+ "version": "0.12.0-alpha.21",
4
4
  "description": "OpenMates CLI and SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -9,7 +9,8 @@
9
9
  "openmates": "dist/cli.js"
10
10
  },
11
11
  "files": [
12
- "dist"
12
+ "dist",
13
+ "fixtures"
13
14
  ],
14
15
  "scripts": {
15
16
  "build": "tsup src/index.ts src/cli.ts --format esm --dts --clean",
@@ -28,7 +29,8 @@
28
29
  "test:unit:billing": "node --test tests/billing.test.ts",
29
30
  "test:unit:account-delete": "node --test tests/account-delete.test.ts",
30
31
  "test:unit:cli": "node --test tests/cli.test.ts",
31
- "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 --experimental-strip-types tests/embedRenderers.test.ts && node --test tests/cli.test.ts tests/billing.test.ts tests/account-delete.test.ts tests/signup.test.ts tests/security-setup.test.ts tests/e2e-provisioning.test.ts"
32
+ "test:unit:benchmark": "node --test --experimental-strip-types --loader ./tests/loader.mjs src/__tests__/benchmark.test.ts",
33
+ "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 src/__tests__/benchmark.test.ts && node --test --experimental-strip-types tests/embedRenderers.test.ts && node --test tests/cli.test.ts tests/billing.test.ts tests/account-delete.test.ts tests/signup.test.ts tests/security-setup.test.ts tests/e2e-provisioning.test.ts"
32
34
  },
33
35
  "keywords": [
34
36
  "openmates",