openmates 0.11.0-alpha.35 → 0.11.0-alpha.36
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-XIYO56TH.js → chunk-RQCEKYOW.js} +301 -14
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1132,6 +1132,7 @@ var OpenMatesWsClient = class {
|
|
|
1132
1132
|
const pendingMemoryRequestHandlers = /* @__PURE__ */ new Set();
|
|
1133
1133
|
const embeds = /* @__PURE__ */ new Map();
|
|
1134
1134
|
const processingEmbedIds = /* @__PURE__ */ new Set();
|
|
1135
|
+
let waitingForUserPayload = null;
|
|
1135
1136
|
let aiResponseDone = false;
|
|
1136
1137
|
let postProcessingDone = false;
|
|
1137
1138
|
const POST_PROCESSING_WINDOW_MS = 12e3;
|
|
@@ -1172,6 +1173,22 @@ var OpenMatesWsClient = class {
|
|
|
1172
1173
|
maybeResolve();
|
|
1173
1174
|
};
|
|
1174
1175
|
const maybeResolve = () => {
|
|
1176
|
+
if (waitingForUserPayload) {
|
|
1177
|
+
if (pendingSubChatHandlers.size > 0) return;
|
|
1178
|
+
cleanup();
|
|
1179
|
+
resolve5({
|
|
1180
|
+
status: "waiting_for_user",
|
|
1181
|
+
messageId,
|
|
1182
|
+
taskId,
|
|
1183
|
+
content: latestContent,
|
|
1184
|
+
category,
|
|
1185
|
+
modelName,
|
|
1186
|
+
followUpSuggestions,
|
|
1187
|
+
embeds: [...embeds.values()],
|
|
1188
|
+
subChatEvents
|
|
1189
|
+
});
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1175
1192
|
if (!aiResponseDone || !postProcessingDone) return;
|
|
1176
1193
|
if (pendingSubChatHandlers.size > 0) return;
|
|
1177
1194
|
if (pendingMemoryRequestHandlers.size > 0) return;
|
|
@@ -1179,6 +1196,7 @@ var OpenMatesWsClient = class {
|
|
|
1179
1196
|
asyncEmbedTimer = setTimeout(() => {
|
|
1180
1197
|
cleanup();
|
|
1181
1198
|
resolve5({
|
|
1199
|
+
status: "completed",
|
|
1182
1200
|
messageId,
|
|
1183
1201
|
taskId,
|
|
1184
1202
|
content: latestContent,
|
|
@@ -1194,6 +1212,7 @@ var OpenMatesWsClient = class {
|
|
|
1194
1212
|
if (processingEmbedIds.size > 0) return;
|
|
1195
1213
|
cleanup();
|
|
1196
1214
|
resolve5({
|
|
1215
|
+
status: "completed",
|
|
1197
1216
|
messageId,
|
|
1198
1217
|
taskId,
|
|
1199
1218
|
content: latestContent,
|
|
@@ -1206,10 +1225,17 @@ var OpenMatesWsClient = class {
|
|
|
1206
1225
|
};
|
|
1207
1226
|
const handleSubChatEvent = (type, p) => {
|
|
1208
1227
|
const eventPayload = p.payload && typeof p.payload === "object" && !Array.isArray(p.payload) ? p.payload : p;
|
|
1209
|
-
const eventChatId = typeof eventPayload.chat_id === "string" ? eventPayload.chat_id : typeof eventPayload.parent_id === "string" ? eventPayload.parent_id : null;
|
|
1228
|
+
const eventChatId = type === "awaiting_user_input" && typeof eventPayload.parent_id === "string" ? eventPayload.parent_id : typeof eventPayload.chat_id === "string" ? eventPayload.chat_id : typeof eventPayload.parent_id === "string" ? eventPayload.parent_id : null;
|
|
1210
1229
|
if (eventChatId && eventChatId !== chatId) return;
|
|
1211
1230
|
const event = { type, payload: eventPayload };
|
|
1212
1231
|
subChatEvents.push(event);
|
|
1232
|
+
if (type === "awaiting_user_input") {
|
|
1233
|
+
waitingForUserPayload = eventPayload;
|
|
1234
|
+
messageId = typeof eventPayload.message_id === "string" ? eventPayload.message_id : messageId;
|
|
1235
|
+
taskId = typeof eventPayload.task_id === "string" ? eventPayload.task_id : taskId;
|
|
1236
|
+
latestContent = typeof eventPayload.question === "string" ? eventPayload.question : latestContent;
|
|
1237
|
+
postProcessingDone = true;
|
|
1238
|
+
}
|
|
1213
1239
|
if (type === "awaiting_sub_chats_completion") {
|
|
1214
1240
|
awaitingSubChatsCompletion = true;
|
|
1215
1241
|
resetTimeout(SUB_CHAT_COMPLETION_TIMEOUT_MS);
|
|
@@ -1393,6 +1419,7 @@ var OpenMatesWsClient = class {
|
|
|
1393
1419
|
if (aiResponseDone) {
|
|
1394
1420
|
cleanup();
|
|
1395
1421
|
resolve5({
|
|
1422
|
+
status: "completed",
|
|
1396
1423
|
messageId,
|
|
1397
1424
|
taskId,
|
|
1398
1425
|
content: latestContent,
|
|
@@ -3130,18 +3157,18 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
3130
3157
|
}
|
|
3131
3158
|
const parentEmbedId = typeof embed.parent_embed_id === "string" ? embed.parent_embed_id : null;
|
|
3132
3159
|
if (parentEmbedId && parentEmbedId !== embedId) {
|
|
3133
|
-
const
|
|
3160
|
+
const parentEmbed2 = cache.embeds.find(
|
|
3134
3161
|
(e) => String(e.embed_id ?? e.id ?? "") === parentEmbedId
|
|
3135
3162
|
);
|
|
3136
|
-
if (
|
|
3163
|
+
if (parentEmbed2) {
|
|
3137
3164
|
const parentFullId = String(
|
|
3138
|
-
|
|
3165
|
+
parentEmbed2.embed_id ?? parentEmbed2.id ?? ""
|
|
3139
3166
|
);
|
|
3140
3167
|
const parentHashedId = createHash5("sha256").update(parentFullId).digest("hex");
|
|
3141
3168
|
const parentKey = await this.resolveEmbedKey(
|
|
3142
3169
|
cache,
|
|
3143
3170
|
masterKey,
|
|
3144
|
-
|
|
3171
|
+
parentEmbed2,
|
|
3145
3172
|
parentFullId,
|
|
3146
3173
|
parentHashedId,
|
|
3147
3174
|
visited
|
|
@@ -3501,6 +3528,20 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
3501
3528
|
category = resp.category;
|
|
3502
3529
|
modelName = resp.modelName;
|
|
3503
3530
|
subChatEvents = resp.subChatEvents;
|
|
3531
|
+
if (resp.status === "waiting_for_user") {
|
|
3532
|
+
return {
|
|
3533
|
+
status: resp.status,
|
|
3534
|
+
chatId,
|
|
3535
|
+
messageId: assistantMessageId,
|
|
3536
|
+
assistant,
|
|
3537
|
+
category,
|
|
3538
|
+
modelName,
|
|
3539
|
+
mateName: category ? MATE_NAMES[category] ?? null : null,
|
|
3540
|
+
followUpSuggestions,
|
|
3541
|
+
subChatEvents,
|
|
3542
|
+
appSettingsMemoryRequests
|
|
3543
|
+
};
|
|
3544
|
+
}
|
|
3504
3545
|
} finally {
|
|
3505
3546
|
ws.close();
|
|
3506
3547
|
}
|
|
@@ -3513,6 +3554,20 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
3513
3554
|
modelName = resp.modelName;
|
|
3514
3555
|
followUpSuggestions = resp.followUpSuggestions;
|
|
3515
3556
|
subChatEvents = resp.subChatEvents;
|
|
3557
|
+
if (resp.status === "waiting_for_user") {
|
|
3558
|
+
return {
|
|
3559
|
+
status: resp.status,
|
|
3560
|
+
chatId,
|
|
3561
|
+
messageId: assistantMessageId,
|
|
3562
|
+
assistant,
|
|
3563
|
+
category,
|
|
3564
|
+
modelName,
|
|
3565
|
+
mateName: category ? MATE_NAMES[category] ?? null : null,
|
|
3566
|
+
followUpSuggestions,
|
|
3567
|
+
subChatEvents,
|
|
3568
|
+
appSettingsMemoryRequests
|
|
3569
|
+
};
|
|
3570
|
+
}
|
|
3516
3571
|
if (chatKeyBytes && assistant) {
|
|
3517
3572
|
const completedAt = Math.floor(Date.now() / 1e3);
|
|
3518
3573
|
const encryptedAssistantContent = await encryptWithAesGcmCombined(
|
|
@@ -3563,7 +3618,9 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
3563
3618
|
}
|
|
3564
3619
|
const mateName = category ? MATE_NAMES[category] ?? null : null;
|
|
3565
3620
|
return {
|
|
3621
|
+
status: "completed",
|
|
3566
3622
|
chatId,
|
|
3623
|
+
messageId: assistantMessageId,
|
|
3567
3624
|
assistant,
|
|
3568
3625
|
category,
|
|
3569
3626
|
modelName,
|
|
@@ -4956,8 +5013,8 @@ Required: ${schema.required.join(", ")}`
|
|
|
4956
5013
|
}
|
|
4957
5014
|
const { ws } = await this.openWsClient();
|
|
4958
5015
|
const chats = [];
|
|
4959
|
-
|
|
4960
|
-
|
|
5016
|
+
const embeds = [];
|
|
5017
|
+
const embedKeys = [];
|
|
4961
5018
|
let newChatSuggestions = [];
|
|
4962
5019
|
let totalChatCount = 0;
|
|
4963
5020
|
try {
|
|
@@ -24207,6 +24264,142 @@ docx_model:
|
|
|
24207
24264
|
}
|
|
24208
24265
|
};
|
|
24209
24266
|
|
|
24267
|
+
// ../ui/src/demo_chats/data/example_chats/search-parent-preview-stress-test.ts
|
|
24268
|
+
var CHAT_ID = "example-search-parent-preview-stress-test";
|
|
24269
|
+
var BASE_TIMESTAMP = 17809e5;
|
|
24270
|
+
var TURN_COUNT = 40;
|
|
24271
|
+
var CHILDREN_PER_PARENT = 12;
|
|
24272
|
+
function deterministicId(kind, index, childIndex = 0) {
|
|
24273
|
+
const suffix = `${index.toString().padStart(6, "0")}${childIndex.toString().padStart(6, "0")}`;
|
|
24274
|
+
const kindCode = kind === "parent" ? "4000" : kind === "child" ? "4001" : "4002";
|
|
24275
|
+
return `00000000-0000-${kindCode}-8000-${suffix}`;
|
|
24276
|
+
}
|
|
24277
|
+
function jsonContent(value) {
|
|
24278
|
+
return JSON.stringify(value);
|
|
24279
|
+
}
|
|
24280
|
+
function parentEmbed(appId, turnIndex, childIds) {
|
|
24281
|
+
const previewResults = childIds.slice(0, 6).map((childId, childIndex) => {
|
|
24282
|
+
const title = `${appId === "web" ? "Article" : "Image"} ${turnIndex}-${childIndex}`;
|
|
24283
|
+
return appId === "web" ? {
|
|
24284
|
+
title,
|
|
24285
|
+
url: `https://example.com/stress/${turnIndex}/${childIndex}`,
|
|
24286
|
+
favicon_url: `https://example.com/favicon-${childIndex}.ico`,
|
|
24287
|
+
source: "example.com"
|
|
24288
|
+
} : {
|
|
24289
|
+
title,
|
|
24290
|
+
source_page_url: `https://images.example.com/stress/${turnIndex}/${childIndex}`,
|
|
24291
|
+
image_url: `https://images.example.com/full/${turnIndex}-${childIndex}.jpg`,
|
|
24292
|
+
thumbnail_url: `https://images.example.com/thumb/${turnIndex}-${childIndex}.jpg`,
|
|
24293
|
+
source: "images.example.com"
|
|
24294
|
+
};
|
|
24295
|
+
});
|
|
24296
|
+
const embedId = deterministicId("parent", turnIndex);
|
|
24297
|
+
return {
|
|
24298
|
+
embed_id: embedId,
|
|
24299
|
+
type: "app_skill_use",
|
|
24300
|
+
content: jsonContent({
|
|
24301
|
+
app_id: appId,
|
|
24302
|
+
skill_id: "search",
|
|
24303
|
+
status: "finished",
|
|
24304
|
+
embed_id: embedId,
|
|
24305
|
+
embed_ids: childIds,
|
|
24306
|
+
result_count: childIds.length,
|
|
24307
|
+
query: `${appId} stress query ${turnIndex}`,
|
|
24308
|
+
provider: "Synthetic Fixture",
|
|
24309
|
+
preview_results: previewResults,
|
|
24310
|
+
...appId === "images" ? { preview_results_json: JSON.stringify(previewResults) } : {}
|
|
24311
|
+
}),
|
|
24312
|
+
parent_embed_id: null,
|
|
24313
|
+
embed_ids: childIds
|
|
24314
|
+
};
|
|
24315
|
+
}
|
|
24316
|
+
function childEmbed(appId, turnIndex, childIndex, parentId) {
|
|
24317
|
+
const embedId = deterministicId("child", turnIndex, childIndex);
|
|
24318
|
+
const title = `${appId === "web" ? "Article" : "Image"} ${turnIndex}-${childIndex}`;
|
|
24319
|
+
return {
|
|
24320
|
+
embed_id: embedId,
|
|
24321
|
+
type: appId === "web" ? "website" : "image_result",
|
|
24322
|
+
content: jsonContent(
|
|
24323
|
+
appId === "web" ? {
|
|
24324
|
+
title,
|
|
24325
|
+
url: `https://example.com/stress/${turnIndex}/${childIndex}`,
|
|
24326
|
+
description: `Full synthetic child result ${turnIndex}-${childIndex}`,
|
|
24327
|
+
favicon_url: `https://example.com/favicon-${childIndex}.ico`,
|
|
24328
|
+
app_id: appId,
|
|
24329
|
+
skill_id: "search",
|
|
24330
|
+
embed_ref: `stress-web-${turnIndex}-${childIndex}`
|
|
24331
|
+
} : {
|
|
24332
|
+
title,
|
|
24333
|
+
source_page_url: `https://images.example.com/stress/${turnIndex}/${childIndex}`,
|
|
24334
|
+
image_url: `https://images.example.com/full/${turnIndex}-${childIndex}.jpg`,
|
|
24335
|
+
thumbnail_url: `https://images.example.com/thumb/${turnIndex}-${childIndex}.jpg`,
|
|
24336
|
+
app_id: appId,
|
|
24337
|
+
skill_id: "search",
|
|
24338
|
+
embed_ref: `stress-image-${turnIndex}-${childIndex}`
|
|
24339
|
+
}
|
|
24340
|
+
),
|
|
24341
|
+
parent_embed_id: parentId,
|
|
24342
|
+
embed_ids: null
|
|
24343
|
+
};
|
|
24344
|
+
}
|
|
24345
|
+
function buildStressData() {
|
|
24346
|
+
const messages = [];
|
|
24347
|
+
const embeds = [];
|
|
24348
|
+
for (let turnIndex = 0; turnIndex < TURN_COUNT; turnIndex++) {
|
|
24349
|
+
const appId = turnIndex % 2 === 0 ? "web" : "images";
|
|
24350
|
+
const childIds = Array.from(
|
|
24351
|
+
{ length: CHILDREN_PER_PARENT },
|
|
24352
|
+
(_, childIndex) => deterministicId("child", turnIndex, childIndex)
|
|
24353
|
+
);
|
|
24354
|
+
const parent = parentEmbed(appId, turnIndex, childIds);
|
|
24355
|
+
embeds.push(parent);
|
|
24356
|
+
for (let childIndex = 0; childIndex < CHILDREN_PER_PARENT; childIndex++) {
|
|
24357
|
+
embeds.push(childEmbed(appId, turnIndex, childIndex, parent.embed_id));
|
|
24358
|
+
}
|
|
24359
|
+
messages.push({
|
|
24360
|
+
id: deterministicId("message", turnIndex * 2),
|
|
24361
|
+
role: "user",
|
|
24362
|
+
content: `Run synthetic ${appId} search stress turn ${turnIndex}.`,
|
|
24363
|
+
created_at: BASE_TIMESTAMP + turnIndex * 60
|
|
24364
|
+
});
|
|
24365
|
+
messages.push({
|
|
24366
|
+
id: deterministicId("message", turnIndex * 2 + 1),
|
|
24367
|
+
role: "assistant",
|
|
24368
|
+
content: `Synthetic ${appId} search parent ${turnIndex}:
|
|
24369
|
+
|
|
24370
|
+
\`\`\`json
|
|
24371
|
+
${JSON.stringify({
|
|
24372
|
+
type: "app_skill_use",
|
|
24373
|
+
embed_id: parent.embed_id,
|
|
24374
|
+
app_id: appId,
|
|
24375
|
+
skill_id: "search"
|
|
24376
|
+
})}
|
|
24377
|
+
\`\`\``,
|
|
24378
|
+
created_at: BASE_TIMESTAMP + turnIndex * 60 + 30,
|
|
24379
|
+
category: "general_knowledge",
|
|
24380
|
+
model_name: "Synthetic Fixture"
|
|
24381
|
+
});
|
|
24382
|
+
}
|
|
24383
|
+
return { messages, embeds };
|
|
24384
|
+
}
|
|
24385
|
+
var stressData = buildStressData();
|
|
24386
|
+
var searchParentPreviewStressTestChat = {
|
|
24387
|
+
chat_id: CHAT_ID,
|
|
24388
|
+
slug: "search-parent-preview-stress-test",
|
|
24389
|
+
title: "Search Parent Preview Stress Test",
|
|
24390
|
+
summary: "Internal synthetic fixture with many messages, parent embeds, and child embeds for load testing.",
|
|
24391
|
+
icon: "search",
|
|
24392
|
+
category: "general_knowledge",
|
|
24393
|
+
keywords: ["internal", "stress", "embeds", "search", "performance"],
|
|
24394
|
+
follow_up_suggestions: [],
|
|
24395
|
+
messages: stressData.messages,
|
|
24396
|
+
embeds: stressData.embeds,
|
|
24397
|
+
metadata: {
|
|
24398
|
+
featured: false,
|
|
24399
|
+
order: 99999
|
|
24400
|
+
}
|
|
24401
|
+
};
|
|
24402
|
+
|
|
24210
24403
|
// ../ui/src/demo_chats/exampleChatData.ts
|
|
24211
24404
|
var ALL_EXAMPLE_CHATS = [
|
|
24212
24405
|
giganticAirplanesChat,
|
|
@@ -26848,6 +27041,9 @@ Only output the final Markdown table. Do NOT include explanations, notes, or any
|
|
|
26848
27041
|
new_chat: {
|
|
26849
27042
|
text: "New chat"
|
|
26850
27043
|
},
|
|
27044
|
+
interactive_question_failed: {
|
|
27045
|
+
text: "Failed to display question."
|
|
27046
|
+
},
|
|
26851
27047
|
share: {
|
|
26852
27048
|
text: "Share chat"
|
|
26853
27049
|
},
|
|
@@ -29452,6 +29648,9 @@ Only output the final Markdown table. Do NOT include explanations, notes, or any
|
|
|
29452
29648
|
search_no_results_for_query: {
|
|
29453
29649
|
text: 'No results found for "{query}"'
|
|
29454
29650
|
},
|
|
29651
|
+
search_preview_open_to_view_results: {
|
|
29652
|
+
text: "Open to view results"
|
|
29653
|
+
},
|
|
29455
29654
|
application_title: {
|
|
29456
29655
|
text: "Application"
|
|
29457
29656
|
},
|
|
@@ -41423,6 +41622,49 @@ function getExampleChatConversation(query) {
|
|
|
41423
41622
|
};
|
|
41424
41623
|
}
|
|
41425
41624
|
|
|
41625
|
+
// src/interactiveQuestions.ts
|
|
41626
|
+
var INTERACTIVE_QUESTION_RE = /```interactive_question\s*\n([\s\S]*?)\n```/;
|
|
41627
|
+
function parseInteractiveQuestionBlock(content) {
|
|
41628
|
+
const match = content.match(INTERACTIVE_QUESTION_RE);
|
|
41629
|
+
if (!match) return null;
|
|
41630
|
+
try {
|
|
41631
|
+
const parsed = JSON.parse(match[1]);
|
|
41632
|
+
return isInteractiveQuestionPayload(parsed) ? parsed : null;
|
|
41633
|
+
} catch {
|
|
41634
|
+
return null;
|
|
41635
|
+
}
|
|
41636
|
+
}
|
|
41637
|
+
function isInteractiveQuestionPayload(value) {
|
|
41638
|
+
if (!value || typeof value !== "object") return false;
|
|
41639
|
+
const payload = value;
|
|
41640
|
+
if (!isQuestionType(payload.type)) return false;
|
|
41641
|
+
if (typeof payload.id !== "string" || payload.id.trim().length === 0) return false;
|
|
41642
|
+
if (payload.type === "choice") {
|
|
41643
|
+
return typeof payload.question === "string" && payload.question.trim().length > 0 && Array.isArray(payload.options) && payload.options.length > 0;
|
|
41644
|
+
}
|
|
41645
|
+
if (payload.type === "input") return Array.isArray(payload.fields) && payload.fields.length > 0;
|
|
41646
|
+
if (payload.type === "slider") {
|
|
41647
|
+
return typeof payload.question === "string" && payload.question.trim().length > 0 && typeof payload.min === "number" && typeof payload.max === "number";
|
|
41648
|
+
}
|
|
41649
|
+
if (payload.type === "swipe") return Array.isArray(payload.cards) && payload.cards.length > 0;
|
|
41650
|
+
if (payload.type === "rating") {
|
|
41651
|
+
return typeof payload.question === "string" && payload.question.trim().length > 0 && (typeof payload.max === "number" || typeof payload.scale === "number");
|
|
41652
|
+
}
|
|
41653
|
+
return false;
|
|
41654
|
+
}
|
|
41655
|
+
function isQuestionType(value) {
|
|
41656
|
+
return value === "choice" || value === "input" || value === "slider" || value === "swipe" || value === "rating";
|
|
41657
|
+
}
|
|
41658
|
+
function toWaitingForUserResult(params) {
|
|
41659
|
+
return {
|
|
41660
|
+
status: "waiting_for_user",
|
|
41661
|
+
chat_id: params.chatId,
|
|
41662
|
+
message_id: params.messageId,
|
|
41663
|
+
parent_id: params.parentId,
|
|
41664
|
+
question: params.question
|
|
41665
|
+
};
|
|
41666
|
+
}
|
|
41667
|
+
|
|
41426
41668
|
// src/cli.ts
|
|
41427
41669
|
async function main() {
|
|
41428
41670
|
const parsed = parseArgs(process.argv.slice(2));
|
|
@@ -42842,7 +43084,11 @@ function findSettingsInfoCommand(tokens) {
|
|
|
42842
43084
|
}
|
|
42843
43085
|
async function printSettingsResult(resultPromise, flags) {
|
|
42844
43086
|
const result = await resultPromise;
|
|
42845
|
-
flags.json === true
|
|
43087
|
+
if (flags.json === true) {
|
|
43088
|
+
printJson2(result);
|
|
43089
|
+
} else {
|
|
43090
|
+
printGenericObject(result);
|
|
43091
|
+
}
|
|
42846
43092
|
}
|
|
42847
43093
|
async function printSettingsMutationResult(resultPromise, flags) {
|
|
42848
43094
|
const result = await resultPromise;
|
|
@@ -43341,7 +43587,11 @@ async function handleSettings(client, subcommand, rest, flags) {
|
|
|
43341
43587
|
}
|
|
43342
43588
|
if (matches(tokens, ["account", "info"])) {
|
|
43343
43589
|
const user = await client.whoAmI();
|
|
43344
|
-
flags.json === true
|
|
43590
|
+
if (flags.json === true) {
|
|
43591
|
+
printJson2(user);
|
|
43592
|
+
} else {
|
|
43593
|
+
printWhoAmI(user);
|
|
43594
|
+
}
|
|
43345
43595
|
return;
|
|
43346
43596
|
}
|
|
43347
43597
|
if (matches(tokens, ["account", "timezone", "set"])) {
|
|
@@ -43505,14 +43755,22 @@ async function handleSettings(client, subcommand, rest, flags) {
|
|
|
43505
43755
|
if (matches(tokens, ["billing", "buy-credits", "bank-transfer"])) {
|
|
43506
43756
|
const credits = parseRequiredNumber(flags.credits, "--credits");
|
|
43507
43757
|
const order = await client.createBankTransferOrder(credits);
|
|
43508
|
-
flags.json === true
|
|
43758
|
+
if (flags.json === true) {
|
|
43759
|
+
printJson2(order);
|
|
43760
|
+
} else {
|
|
43761
|
+
printBankTransferOrder(order, false);
|
|
43762
|
+
}
|
|
43509
43763
|
return;
|
|
43510
43764
|
}
|
|
43511
43765
|
if (matches(tokens, ["billing", "bank-transfer", "status"])) {
|
|
43512
43766
|
const orderId = rest[2];
|
|
43513
43767
|
if (!orderId) throw new Error("Missing order ID.");
|
|
43514
43768
|
const status = await client.getBankTransferStatus(orderId);
|
|
43515
|
-
flags.json === true
|
|
43769
|
+
if (flags.json === true) {
|
|
43770
|
+
printJson2(status);
|
|
43771
|
+
} else {
|
|
43772
|
+
printBankTransferStatus(status, false);
|
|
43773
|
+
}
|
|
43516
43774
|
return;
|
|
43517
43775
|
}
|
|
43518
43776
|
if (matches(tokens, ["billing", "bank-transfer", "list"])) {
|
|
@@ -43572,14 +43830,22 @@ async function handleSettings(client, subcommand, rest, flags) {
|
|
|
43572
43830
|
if (matches(tokens, ["billing", "gift-card", "buy", "bank-transfer"])) {
|
|
43573
43831
|
const credits = parseRequiredNumber(flags.credits, "--credits");
|
|
43574
43832
|
const order = await client.createGiftCardBankTransferOrder(credits);
|
|
43575
|
-
flags.json === true
|
|
43833
|
+
if (flags.json === true) {
|
|
43834
|
+
printJson2(order);
|
|
43835
|
+
} else {
|
|
43836
|
+
printBankTransferOrder(order, true);
|
|
43837
|
+
}
|
|
43576
43838
|
return;
|
|
43577
43839
|
}
|
|
43578
43840
|
if (matches(tokens, ["billing", "gift-card", "purchase-status"])) {
|
|
43579
43841
|
const orderId = rest[3];
|
|
43580
43842
|
if (!orderId) throw new Error("Missing order ID.");
|
|
43581
43843
|
const status = await client.getGiftCardPurchaseStatus(orderId);
|
|
43582
|
-
flags.json === true
|
|
43844
|
+
if (flags.json === true) {
|
|
43845
|
+
printJson2(status);
|
|
43846
|
+
} else {
|
|
43847
|
+
printBankTransferStatus(status, true);
|
|
43848
|
+
}
|
|
43583
43849
|
return;
|
|
43584
43850
|
}
|
|
43585
43851
|
if (matches(tokens, ["billing", "gift-card", "purchased"])) {
|
|
@@ -43606,7 +43872,11 @@ async function handleSettings(client, subcommand, rest, flags) {
|
|
|
43606
43872
|
backup_reminder_interval_days: user.backup_reminder_interval_days ?? null,
|
|
43607
43873
|
encrypted_notification_email_configured: Boolean(user.encrypted_notification_email)
|
|
43608
43874
|
};
|
|
43609
|
-
flags.json === true
|
|
43875
|
+
if (flags.json === true) {
|
|
43876
|
+
printJson2(status);
|
|
43877
|
+
} else {
|
|
43878
|
+
printGenericObject(status);
|
|
43879
|
+
}
|
|
43610
43880
|
return;
|
|
43611
43881
|
}
|
|
43612
43882
|
if (matches(tokens, ["notifications", "list"])) {
|
|
@@ -44326,6 +44596,23 @@ async function sendMessageStreaming(client, params, redactor) {
|
|
|
44326
44596
|
preparedEmbeds: preparedEmbeds.length > 0 ? preparedEmbeds : void 0
|
|
44327
44597
|
});
|
|
44328
44598
|
clearTyping();
|
|
44599
|
+
if (result.status === "waiting_for_user") {
|
|
44600
|
+
const question = parseInteractiveQuestionBlock(result.assistant);
|
|
44601
|
+
if (params.json && question) {
|
|
44602
|
+
return toWaitingForUserResult({
|
|
44603
|
+
chatId: result.chatId,
|
|
44604
|
+
messageId: result.messageId ?? "",
|
|
44605
|
+
parentId: result.chatId,
|
|
44606
|
+
question
|
|
44607
|
+
});
|
|
44608
|
+
}
|
|
44609
|
+
if (!params.json) {
|
|
44610
|
+
process.stderr.write(
|
|
44611
|
+
"\x1B[33mOpenMates needs more input to continue.\x1B[0m\nContinue in the web app, or rerun with --json to inspect the structured waiting state.\n"
|
|
44612
|
+
);
|
|
44613
|
+
}
|
|
44614
|
+
return result;
|
|
44615
|
+
}
|
|
44329
44616
|
if (!params.json) {
|
|
44330
44617
|
if (!headerPrinted) {
|
|
44331
44618
|
const mateBlock = ansiMateBlock(result.category, result.mateName);
|
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -590,7 +590,9 @@ declare class OpenMatesClient {
|
|
|
590
590
|
/** Prepared embeds to encrypt after the real chat/message IDs are known. */
|
|
591
591
|
preparedEmbeds?: PreparedEmbed[];
|
|
592
592
|
}): Promise<{
|
|
593
|
+
status: "completed" | "waiting_for_user";
|
|
593
594
|
chatId: string;
|
|
595
|
+
messageId: string | null;
|
|
594
596
|
assistant: string;
|
|
595
597
|
category: string | null;
|
|
596
598
|
modelName: string | null;
|
package/dist/index.js
CHANGED