openmates 0.8.0-alpha.3 → 0.9.0-alpha.10
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-XNONURHY.js → chunk-IZYE5MAJ.js} +116 -44
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -730,6 +730,49 @@ var OpenMatesWsClient = class {
|
|
|
730
730
|
this.socket.on("close", onClose);
|
|
731
731
|
});
|
|
732
732
|
}
|
|
733
|
+
/**
|
|
734
|
+
* Collect all frames until `terminatorType` arrives (or timeout).
|
|
735
|
+
* Returns every frame received before the terminator, in order.
|
|
736
|
+
* Used by ensureSynced to consume the full phased-sync event stream.
|
|
737
|
+
*/
|
|
738
|
+
collectMessages(terminatorType, timeoutMs = 9e4) {
|
|
739
|
+
return new Promise((resolve4, reject) => {
|
|
740
|
+
const collected = [];
|
|
741
|
+
const onMessage = (rawData) => {
|
|
742
|
+
try {
|
|
743
|
+
const parsed = JSON.parse(rawData.toString());
|
|
744
|
+
if (parsed.type === terminatorType) {
|
|
745
|
+
cleanup();
|
|
746
|
+
resolve4(collected);
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
collected.push(parsed);
|
|
750
|
+
} catch {
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
const onError = (error) => {
|
|
754
|
+
cleanup();
|
|
755
|
+
reject(error);
|
|
756
|
+
};
|
|
757
|
+
const onClose = () => {
|
|
758
|
+
cleanup();
|
|
759
|
+
resolve4(collected);
|
|
760
|
+
};
|
|
761
|
+
const timeout = setTimeout(() => {
|
|
762
|
+
cleanup();
|
|
763
|
+
reject(new Error(`Timeout waiting for '${terminatorType}'`));
|
|
764
|
+
}, timeoutMs);
|
|
765
|
+
const cleanup = () => {
|
|
766
|
+
clearTimeout(timeout);
|
|
767
|
+
this.socket.off("message", onMessage);
|
|
768
|
+
this.socket.off("error", onError);
|
|
769
|
+
this.socket.off("close", onClose);
|
|
770
|
+
};
|
|
771
|
+
this.socket.on("message", onMessage);
|
|
772
|
+
this.socket.on("error", onError);
|
|
773
|
+
this.socket.on("close", onClose);
|
|
774
|
+
});
|
|
775
|
+
}
|
|
733
776
|
/**
|
|
734
777
|
* Collect the AI response for a sent message.
|
|
735
778
|
*
|
|
@@ -902,10 +945,11 @@ var OpenMatesWsClient = class {
|
|
|
902
945
|
|
|
903
946
|
// src/mentions.ts
|
|
904
947
|
var MODEL_ALIASES = {
|
|
905
|
-
best: "claude-opus-4-
|
|
948
|
+
best: "claude-opus-4-7",
|
|
906
949
|
fast: "qwen3-235b-a22b-2507"
|
|
907
950
|
};
|
|
908
951
|
var CHAT_MODELS = [
|
|
952
|
+
{ id: "claude-opus-4-7", name: "Claude Opus 4.7" },
|
|
909
953
|
{ id: "claude-opus-4-6", name: "Claude Opus 4.6" },
|
|
910
954
|
{ id: "claude-sonnet-4-6", name: "Claude Sonnet 4.6" },
|
|
911
955
|
{ id: "claude-haiku-4-5-20251001", name: "Claude Haiku 4.5" },
|
|
@@ -914,9 +958,11 @@ var CHAT_MODELS = [
|
|
|
914
958
|
{ id: "gemini-3-flash-preview", name: "Gemini 3 Flash" },
|
|
915
959
|
{ id: "gemini-3-pro-image-preview", name: "Gemini 3 Pro" },
|
|
916
960
|
{ id: "gemini-3.1-pro-preview", name: "Gemini 3.1 Pro" },
|
|
917
|
-
{ id: "deepseek-
|
|
961
|
+
{ id: "deepseek-v4-pro", name: "DeepSeek V4 Pro" },
|
|
962
|
+
{ id: "deepseek-v4-flash", name: "DeepSeek V4 Flash" },
|
|
918
963
|
{ id: "qwen3-235b-a22b-2507", name: "Qwen 3 256b" },
|
|
919
964
|
{ id: "kimi-k2.5", name: "Kimi K2.5" },
|
|
965
|
+
{ id: "kimi-k2.6", name: "Kimi K2.6" },
|
|
920
966
|
{ id: "zai-glm-4.7", name: "GLM 4.7" },
|
|
921
967
|
{ id: "mistral-medium-latest", name: "Mistral Medium" },
|
|
922
968
|
{ id: "mistral-small-2506", name: "Mistral Small 3.2" },
|
|
@@ -1642,6 +1688,7 @@ var MATE_NAMES = {
|
|
|
1642
1688
|
onboarding_support: "Suki"
|
|
1643
1689
|
};
|
|
1644
1690
|
var DEFAULT_API_URL = process.env.OPENMATES_API_URL ?? "https://api.openmates.org";
|
|
1691
|
+
var SETTINGS_GET_RATE_LIMIT_RETRY_MS = 61e3;
|
|
1645
1692
|
function deriveAppUrl(apiUrl) {
|
|
1646
1693
|
if (process.env.OPENMATES_APP_URL) {
|
|
1647
1694
|
return process.env.OPENMATES_APP_URL.replace(/\/$/, "");
|
|
@@ -2572,10 +2619,18 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
2572
2619
|
async settingsGet(path) {
|
|
2573
2620
|
this.requireSession();
|
|
2574
2621
|
const normalizedPath = this.normalizePath(path);
|
|
2575
|
-
|
|
2622
|
+
let response = await this.http.get(
|
|
2576
2623
|
normalizedPath,
|
|
2577
2624
|
this.getCliRequestHeaders()
|
|
2578
2625
|
);
|
|
2626
|
+
if (response.status === 429) {
|
|
2627
|
+
process.stderr.write(
|
|
2628
|
+
`Rate limited by settings API; retrying in ${Math.ceil(SETTINGS_GET_RATE_LIMIT_RETRY_MS / 1e3)}s...
|
|
2629
|
+
`
|
|
2630
|
+
);
|
|
2631
|
+
await new Promise((resolve4) => setTimeout(resolve4, SETTINGS_GET_RATE_LIMIT_RETRY_MS));
|
|
2632
|
+
response = await this.http.get(normalizedPath, this.getCliRequestHeaders());
|
|
2633
|
+
}
|
|
2579
2634
|
if (!response.ok) {
|
|
2580
2635
|
throw new Error(`Settings GET failed with HTTP ${response.status}`);
|
|
2581
2636
|
}
|
|
@@ -3229,41 +3284,53 @@ Required: ${schema.required.join(", ")}`
|
|
|
3229
3284
|
let totalChatCount = 0;
|
|
3230
3285
|
try {
|
|
3231
3286
|
ws.send("phased_sync_request", {
|
|
3232
|
-
phase: "
|
|
3287
|
+
phase: "all",
|
|
3233
3288
|
client_chat_versions: clientChatVersions,
|
|
3234
3289
|
client_chat_ids: clientChatIds,
|
|
3235
3290
|
client_embed_ids: clientEmbedIds
|
|
3236
3291
|
});
|
|
3237
|
-
const
|
|
3238
|
-
const
|
|
3239
|
-
const
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3292
|
+
const frames = await ws.collectMessages("phased_sync_complete", 9e4);
|
|
3293
|
+
const messagesByChatId = /* @__PURE__ */ new Map();
|
|
3294
|
+
for (const frame of frames) {
|
|
3295
|
+
if (frame.type === "phase_1_last_chat_ready") {
|
|
3296
|
+
const p = frame.payload;
|
|
3297
|
+
newChatSuggestions = p.new_chat_suggestions ?? [];
|
|
3298
|
+
} else if (frame.type === "phase_1b_chat_content_ready") {
|
|
3299
|
+
const p = frame.payload;
|
|
3300
|
+
for (const c of p.chats ?? []) {
|
|
3301
|
+
if (c.chat_id && Array.isArray(c.messages) && c.messages.length > 0) {
|
|
3302
|
+
messagesByChatId.set(c.chat_id, c.messages);
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
if (p.embeds) embeds.push(...p.embeds);
|
|
3306
|
+
if (p.embed_keys) embedKeys.push(...p.embed_keys);
|
|
3307
|
+
} else if (frame.type === "phase_2_last_20_chats_ready") {
|
|
3308
|
+
const p = frame.payload;
|
|
3309
|
+
totalChatCount = p.total_chat_count ?? 0;
|
|
3310
|
+
for (const wrapper of p.chats ?? []) {
|
|
3311
|
+
const details = wrapper.chat_details;
|
|
3312
|
+
if (!details || typeof details.id !== "string") continue;
|
|
3313
|
+
chats.push({ details, messages: [] });
|
|
3314
|
+
}
|
|
3315
|
+
} else if (frame.type === "background_message_sync") {
|
|
3316
|
+
const p = frame.payload;
|
|
3317
|
+
for (const c of p.chats ?? []) {
|
|
3318
|
+
if (c.chat_id && Array.isArray(c.messages) && c.messages.length > 0) {
|
|
3319
|
+
messagesByChatId.set(c.chat_id, c.messages);
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
if (p.embeds) embeds.push(...p.embeds);
|
|
3323
|
+
if (p.embed_keys) embedKeys.push(...p.embed_keys);
|
|
3261
3324
|
}
|
|
3262
|
-
if (payload.embeds) embeds.push(...payload.embeds);
|
|
3263
|
-
if (payload.embed_keys) embedKeys.push(...payload.embed_keys);
|
|
3264
|
-
offset += batch.length;
|
|
3265
|
-
if (!payload.has_more || batch.length === 0) break;
|
|
3266
3325
|
}
|
|
3326
|
+
for (const chat of chats) {
|
|
3327
|
+
const id = typeof chat.details.id === "string" ? chat.details.id : "";
|
|
3328
|
+
const msgs = messagesByChatId.get(id);
|
|
3329
|
+
if (msgs && msgs.length > 0) {
|
|
3330
|
+
chat.messages = msgs;
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
if (totalChatCount === 0) totalChatCount = chats.length;
|
|
3267
3334
|
} finally {
|
|
3268
3335
|
ws.close();
|
|
3269
3336
|
}
|
|
@@ -3524,8 +3591,8 @@ function getSecretSuffix(match, n = 3) {
|
|
|
3524
3591
|
if (cleaned.length <= n) return cleaned;
|
|
3525
3592
|
return cleaned.slice(-n);
|
|
3526
3593
|
}
|
|
3527
|
-
function generatePlaceholder(prefix, match, suffixLength = 3) {
|
|
3528
|
-
return `[${prefix}_${getSecretSuffix(match, suffixLength)}]`;
|
|
3594
|
+
function generatePlaceholder(prefix, match, suffixLength = 3, counter = 1) {
|
|
3595
|
+
return `[${prefix}_${counter}_${getSecretSuffix(match, suffixLength)}]`;
|
|
3529
3596
|
}
|
|
3530
3597
|
var SECRET_PATTERNS = [
|
|
3531
3598
|
{
|
|
@@ -3983,6 +4050,7 @@ var SecretScanner = class {
|
|
|
3983
4050
|
allMappings.push(mapping);
|
|
3984
4051
|
}
|
|
3985
4052
|
}
|
|
4053
|
+
const typeCounts = {};
|
|
3986
4054
|
if (this.options.enablePatternDetection) {
|
|
3987
4055
|
for (const pattern of SECRET_PATTERNS) {
|
|
3988
4056
|
pattern.regex.lastIndex = 0;
|
|
@@ -3998,10 +4066,12 @@ var SecretScanner = class {
|
|
|
3998
4066
|
if (pattern.validate && !pattern.validate(matchText)) continue;
|
|
3999
4067
|
const existing = this.registry.get(matchText);
|
|
4000
4068
|
if (existing) continue;
|
|
4069
|
+
typeCounts[pattern.type] = (typeCounts[pattern.type] || 0) + 1;
|
|
4001
4070
|
const placeholder = generatePlaceholder(
|
|
4002
4071
|
pattern.placeholderPrefix,
|
|
4003
4072
|
matchText,
|
|
4004
|
-
this.options.suffixLength
|
|
4073
|
+
this.options.suffixLength,
|
|
4074
|
+
typeCounts[pattern.type]
|
|
4005
4075
|
);
|
|
4006
4076
|
allMappings.push({
|
|
4007
4077
|
placeholder,
|
|
@@ -4081,7 +4151,7 @@ var OutputRedactor = class {
|
|
|
4081
4151
|
}
|
|
4082
4152
|
/**
|
|
4083
4153
|
* Initialize the redactor by loading personal data entries from
|
|
4084
|
-
* the user's encrypted
|
|
4154
|
+
* the user's encrypted Memories.
|
|
4085
4155
|
*
|
|
4086
4156
|
* Safe to call without a session — silently skips if not logged in.
|
|
4087
4157
|
*
|
|
@@ -6377,7 +6447,7 @@ async function main() {
|
|
|
6377
6447
|
apiUrl: typeof parsed.flags["api-url"] === "string" ? parsed.flags["api-url"] : void 0
|
|
6378
6448
|
});
|
|
6379
6449
|
const redactor = new OutputRedactor();
|
|
6380
|
-
if (client.hasSession()) {
|
|
6450
|
+
if (client.hasSession() && shouldInitializeRedactor(command, subcommand)) {
|
|
6381
6451
|
try {
|
|
6382
6452
|
const memories = await client.listMemories();
|
|
6383
6453
|
redactor.initializeFromMemories(memories);
|
|
@@ -6485,6 +6555,9 @@ async function main() {
|
|
|
6485
6555
|
}
|
|
6486
6556
|
throw new Error(`Unknown command '${command}'. Run 'openmates help'.`);
|
|
6487
6557
|
}
|
|
6558
|
+
function shouldInitializeRedactor(command, subcommand) {
|
|
6559
|
+
return command === "chats" && ["new", "send", "incognito"].includes(subcommand ?? "");
|
|
6560
|
+
}
|
|
6488
6561
|
async function handleChats(client, subcommand, rest, flags, redactor) {
|
|
6489
6562
|
if (!subcommand || subcommand === "help" || flags.help === true) {
|
|
6490
6563
|
printChatsHelp();
|
|
@@ -9132,7 +9205,7 @@ async function handleMentions(client, subcommand, _rest, flags) {
|
|
|
9132
9205
|
mate: "Mates",
|
|
9133
9206
|
skill: "Skills",
|
|
9134
9207
|
focus_mode: "Focus Modes",
|
|
9135
|
-
settings_memory: "
|
|
9208
|
+
settings_memory: "Memories"
|
|
9136
9209
|
};
|
|
9137
9210
|
for (const [type, items] of grouped) {
|
|
9138
9211
|
const label = typeLabels[type] || type;
|
|
@@ -9302,7 +9375,7 @@ Types:
|
|
|
9302
9375
|
mate AI mates/personas (@Sophia, @Finn)
|
|
9303
9376
|
skill App skills (@Web-Search, @Code-Get-Docs)
|
|
9304
9377
|
focus_mode Focus modes (@Web-Research)
|
|
9305
|
-
settings_memory
|
|
9378
|
+
settings_memory Memories (@Code-Projects)
|
|
9306
9379
|
|
|
9307
9380
|
Use @mentions in chat messages:
|
|
9308
9381
|
openmates chats new "@Sophia tell me about React hooks"
|
|
@@ -9321,7 +9394,7 @@ Commands:
|
|
|
9321
9394
|
openmates apps [--help] App skill commands (list, run, ...)
|
|
9322
9395
|
openmates mentions [--help] List available @mentions
|
|
9323
9396
|
openmates embeds [--help] Embed commands (show)
|
|
9324
|
-
openmates settings [--help]
|
|
9397
|
+
openmates settings [--help] Memories
|
|
9325
9398
|
openmates inspirations [--lang <code>] [--json] Daily inspirations
|
|
9326
9399
|
openmates newchatsuggestions [--limit <n>] [--json] Personalized new chat suggestions
|
|
9327
9400
|
openmates server [--help] Server management (install, start, stop, ...)
|
|
@@ -9386,7 +9459,7 @@ Options for 'delete':
|
|
|
9386
9459
|
@Claude-Opus-4.6 Specific model
|
|
9387
9460
|
@Sophia AI mate/persona
|
|
9388
9461
|
@Web-Search App skill
|
|
9389
|
-
@Code-Projects
|
|
9462
|
+
@Code-Projects Memories
|
|
9390
9463
|
@/path/to/file.ts Attach local file (secrets auto-redacted)
|
|
9391
9464
|
|
|
9392
9465
|
Sensitive files (.env) use zero-knowledge mode (only names + last 3 chars).
|
|
@@ -9503,7 +9576,6 @@ ${h("Billing")}
|
|
|
9503
9576
|
\x1B[2mGift cards (buy/manage): ${s("billing/gift-cards")}\x1B[0m
|
|
9504
9577
|
${h("Privacy")}
|
|
9505
9578
|
openmates settings post auto-delete-chats --data '{"period":"90d"}'
|
|
9506
|
-
openmates settings post auto-delete-usage --data '{"period":"1y"}'
|
|
9507
9579
|
\x1B[2mHide personal data / anonymization: ${s("privacy/hide-personal-data")}\x1B[0m
|
|
9508
9580
|
${h("Notifications")}
|
|
9509
9581
|
openmates settings get reminders [--json] Active reminders
|
|
@@ -9513,8 +9585,8 @@ ${h("Interface")}
|
|
|
9513
9585
|
openmates settings post user/language --data '{"language":"en"}'
|
|
9514
9586
|
openmates settings post user/darkmode --data '{"dark_mode":true}'
|
|
9515
9587
|
openmates settings post ai-model-defaults --data '{"simple":"...","complex":"..."}'
|
|
9516
|
-
${h("
|
|
9517
|
-
openmates apps list Same as
|
|
9588
|
+
${h("Apps")}
|
|
9589
|
+
openmates apps list Same as Apps
|
|
9518
9590
|
openmates apps <app-id> App details
|
|
9519
9591
|
\x1B[2mWeb: ${s("app_store")}\x1B[0m
|
|
9520
9592
|
${h("Mates")}
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED