openmates 0.18.0-alpha.55 → 0.18.0-alpha.56
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-RBHU2VQK.js → chunk-43YGX6HY.js} +42 -30
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -5774,7 +5774,7 @@ function toArrayBuffer3(input) {
|
|
|
5774
5774
|
var MAX_SPEECH_SEGMENTS = 20;
|
|
5775
5775
|
var MAX_SEGMENT_CHARACTERS = 2e3;
|
|
5776
5776
|
var FENCED_BLOCK = /^```[\s\S]*```$/;
|
|
5777
|
-
function projectAssistantSpeech(content) {
|
|
5777
|
+
function projectAssistantSpeech(content, language = "en") {
|
|
5778
5778
|
let nearestHeading = "";
|
|
5779
5779
|
const paragraphs = content.split(/(```[\s\S]*?```)/g).flatMap(
|
|
5780
5780
|
(block) => FENCED_BLOCK.test(block.trim()) ? [block] : block.split(/\n\n+/)
|
|
@@ -5786,10 +5786,10 @@ function projectAssistantSpeech(content) {
|
|
|
5786
5786
|
const heading = paragraph.split("\n").map((line) => line.match(/^#{1,6}\s+(.+?)\s*#*$/)?.[1]?.trim()).find(Boolean);
|
|
5787
5787
|
if (heading) nearestHeading = heading;
|
|
5788
5788
|
}
|
|
5789
|
-
const projected = projectParagraph(paragraph);
|
|
5789
|
+
const projected = projectParagraph(paragraph, language);
|
|
5790
5790
|
for (const speakableText of splitLongParagraph(projected.speakableText)) {
|
|
5791
5791
|
const semanticIdentity = `${projected.kind}:${speakableText}`;
|
|
5792
|
-
if (projected.kind === "embed_summary"
|
|
5792
|
+
if (projected.kind === "embed_summary") {
|
|
5793
5793
|
if (semanticSummaries.has(semanticIdentity)) continue;
|
|
5794
5794
|
semanticSummaries.add(semanticIdentity);
|
|
5795
5795
|
}
|
|
@@ -5824,7 +5824,19 @@ function splitLongParagraph(paragraph) {
|
|
|
5824
5824
|
if (remainder) chunks.push(remainder);
|
|
5825
5825
|
return chunks;
|
|
5826
5826
|
}
|
|
5827
|
-
function
|
|
5827
|
+
function fallback(text2, language) {
|
|
5828
|
+
if (!language.toLowerCase().startsWith("de")) return text2;
|
|
5829
|
+
const german = {
|
|
5830
|
+
"Search results are available.": "Suchergebnisse sind verf\xFCgbar.",
|
|
5831
|
+
"I used the News Search skill.": "Ich habe die News-Suche verwendet.",
|
|
5832
|
+
"App results are available.": "App-Ergebnisse sind verf\xFCgbar.",
|
|
5833
|
+
"Structured data is available.": "Strukturierte Daten sind verf\xFCgbar.",
|
|
5834
|
+
"A code example is available.": "Ein Codebeispiel ist verf\xFCgbar.",
|
|
5835
|
+
"A table is available.": "Eine Tabelle ist verf\xFCgbar."
|
|
5836
|
+
};
|
|
5837
|
+
return german[text2] ?? text2;
|
|
5838
|
+
}
|
|
5839
|
+
function projectFence(markdown, language) {
|
|
5828
5840
|
const body = markdown.replace(/^```[^\n]*\n|\n?```$/g, "").trim();
|
|
5829
5841
|
let payload = null;
|
|
5830
5842
|
try {
|
|
@@ -5833,24 +5845,24 @@ function projectFence(markdown) {
|
|
|
5833
5845
|
} catch {
|
|
5834
5846
|
}
|
|
5835
5847
|
if (payload?.type === "app_skill_use") {
|
|
5836
|
-
return { kind: "embed_summary", speakableText: payload.skill_id === "search" ? "Search results are available." : "App results are available." };
|
|
5848
|
+
return { kind: "embed_summary", speakableText: fallback(payload.skill_id === "search" ? payload.app_id === "news" ? "I used the News Search skill." : "Search results are available." : "App results are available.", language) };
|
|
5837
5849
|
}
|
|
5838
5850
|
if (payload && (payload.embed_id || ["website", "image", "audio", "video"].includes(String(payload.type)))) {
|
|
5839
|
-
return { kind: "embed_summary", speakableText: "Structured data is available." };
|
|
5851
|
+
return { kind: "embed_summary", speakableText: fallback("Structured data is available.", language) };
|
|
5840
5852
|
}
|
|
5841
|
-
return { kind: "code_summary", speakableText: "A code example is available." };
|
|
5853
|
+
return { kind: "code_summary", speakableText: fallback("A code example is available.", language) };
|
|
5842
5854
|
}
|
|
5843
|
-
function projectParagraph(markdown) {
|
|
5855
|
+
function projectParagraph(markdown, language) {
|
|
5844
5856
|
const trimmed = markdown.trim();
|
|
5845
|
-
if (/^```[\s\S]*```$/.test(trimmed)) return projectFence(trimmed);
|
|
5857
|
+
if (/^```[\s\S]*```$/.test(trimmed)) return projectFence(trimmed, language);
|
|
5846
5858
|
const lines = trimmed.split("\n").filter((line) => line.trim());
|
|
5847
5859
|
if (lines.length >= 2 && lines.every((line) => /^\s*\|.*\|\s*$/.test(line))) {
|
|
5848
|
-
return { kind: "table_summary", speakableText: "A table is available." };
|
|
5860
|
+
return { kind: "table_summary", speakableText: fallback("A table is available.", language) };
|
|
5849
5861
|
}
|
|
5850
5862
|
if (trimmed.startsWith("{") || trimmed.startsWith("[") && !/^\[[^\]]+\]\([^)]*\)/.test(trimmed)) {
|
|
5851
|
-
return { kind: "embed_summary", speakableText: "Structured data is available." };
|
|
5863
|
+
return { kind: "embed_summary", speakableText: fallback("Structured data is available.", language) };
|
|
5852
5864
|
}
|
|
5853
|
-
const speakableText = trimmed.replace(/```[\s\S]*?```/g, (fence) => ` ${projectFence(fence).speakableText} `).replace(/^\s*\|.*\|\s*$/gm, "
|
|
5865
|
+
const speakableText = trimmed.replace(/```[\s\S]*?```/g, (fence) => ` ${projectFence(fence, language).speakableText} `).replace(/^\s*\|.*\|\s*$/gm, ` ${fallback("A table is available.", language)} `).replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/`[^`]*`/g, "").replace(/(?:https?|ftp):\/\/[^\s)\]>]+|[a-z][a-z0-9+.-]*:\/\/[^\s)\]>]+/gi, "").replace(/(?:^|\s)[#>*_~]+|[_~]{1,3}/g, " ").replace(/\s+/g, " ").replace(/\s+([,.;:!?])/g, "$1").replace(/^[\s,;:-]+|[\s,;:-]+$/g, "");
|
|
5854
5866
|
return { kind: "prose_paragraph", speakableText };
|
|
5855
5867
|
}
|
|
5856
5868
|
|
|
@@ -7328,9 +7340,9 @@ function withAppSkillPromptInjectionOption(inputData, promptInjectionProtection)
|
|
|
7328
7340
|
}
|
|
7329
7341
|
};
|
|
7330
7342
|
}
|
|
7331
|
-
function normalizeUnixSeconds(value,
|
|
7343
|
+
function normalizeUnixSeconds(value, fallback2) {
|
|
7332
7344
|
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
7333
|
-
return
|
|
7345
|
+
return fallback2;
|
|
7334
7346
|
}
|
|
7335
7347
|
return value > 1e10 ? Math.floor(value / 1e3) : Math.floor(value);
|
|
7336
7348
|
}
|
|
@@ -15357,16 +15369,16 @@ Required: ${schema.required.join(", ")}`
|
|
|
15357
15369
|
}
|
|
15358
15370
|
return content;
|
|
15359
15371
|
}
|
|
15360
|
-
formatEmbedVersionError(data,
|
|
15372
|
+
formatEmbedVersionError(data, fallback2) {
|
|
15361
15373
|
if (data && typeof data === "object") {
|
|
15362
15374
|
const detail = data.detail;
|
|
15363
15375
|
const message = data.message;
|
|
15364
15376
|
if (typeof detail === "string" && detail.trim()) return detail;
|
|
15365
15377
|
if (typeof message === "string" && message.trim()) return message;
|
|
15366
15378
|
}
|
|
15367
|
-
return
|
|
15379
|
+
return fallback2;
|
|
15368
15380
|
}
|
|
15369
|
-
formatApplicationPreviewError(data,
|
|
15381
|
+
formatApplicationPreviewError(data, fallback2) {
|
|
15370
15382
|
if (data && typeof data === "object") {
|
|
15371
15383
|
const detail = data.detail;
|
|
15372
15384
|
const message = data.message;
|
|
@@ -15377,7 +15389,7 @@ Required: ${schema.required.join(", ")}`
|
|
|
15377
15389
|
}
|
|
15378
15390
|
if (typeof message === "string" && message.trim()) return message;
|
|
15379
15391
|
}
|
|
15380
|
-
return
|
|
15392
|
+
return fallback2;
|
|
15381
15393
|
}
|
|
15382
15394
|
async resolveEmbedId(embedIdOrShort) {
|
|
15383
15395
|
if (embedIdOrShort.length >= 32) return embedIdOrShort;
|
|
@@ -75295,8 +75307,8 @@ function replaceTask(state, task) {
|
|
|
75295
75307
|
if (index >= 0) state.tasks[index] = task;
|
|
75296
75308
|
else state.tasks.unshift(task);
|
|
75297
75309
|
}
|
|
75298
|
-
function taskError(error,
|
|
75299
|
-
return error instanceof Error ? `${
|
|
75310
|
+
function taskError(error, fallback2) {
|
|
75311
|
+
return error instanceof Error ? `${fallback2} ${error.message}` : fallback2;
|
|
75300
75312
|
}
|
|
75301
75313
|
async function openWorkflowList(params) {
|
|
75302
75314
|
const { state, client, render } = params;
|
|
@@ -75468,9 +75480,9 @@ async function cancelLatestWorkflowRun(params) {
|
|
|
75468
75480
|
render();
|
|
75469
75481
|
}
|
|
75470
75482
|
}
|
|
75471
|
-
function workflowError(error,
|
|
75483
|
+
function workflowError(error, fallback2) {
|
|
75472
75484
|
const details = error instanceof Error ? error.message : String(error);
|
|
75473
|
-
return `${
|
|
75485
|
+
return `${fallback2} ${details}`;
|
|
75474
75486
|
}
|
|
75475
75487
|
function toggleInterest(state) {
|
|
75476
75488
|
const interest = TUI_INTERESTS[state.selectedIndex];
|
|
@@ -78256,10 +78268,10 @@ function extractRecord(container, key) {
|
|
|
78256
78268
|
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`Workspace ask planning returned invalid ${key}.`);
|
|
78257
78269
|
return value;
|
|
78258
78270
|
}
|
|
78259
|
-
function requiredString(record2, key,
|
|
78271
|
+
function requiredString(record2, key, fallback2) {
|
|
78260
78272
|
const value = record2[key];
|
|
78261
78273
|
if (typeof value === "string" && value.trim()) return value.trim();
|
|
78262
|
-
return
|
|
78274
|
+
return fallback2;
|
|
78263
78275
|
}
|
|
78264
78276
|
function optionalString(record2, key) {
|
|
78265
78277
|
const value = record2[key];
|
|
@@ -80105,8 +80117,8 @@ function safeRelativeProjectPath(value) {
|
|
|
80105
80117
|
if (parts.some((part) => part === "..")) throw new CliContractError("invalid_path", "Project file paths cannot traverse outside the source.");
|
|
80106
80118
|
return normalized;
|
|
80107
80119
|
}
|
|
80108
|
-
function parseBoundedInteger(value, flag, minimum, maximum,
|
|
80109
|
-
if (value === void 0) return
|
|
80120
|
+
function parseBoundedInteger(value, flag, minimum, maximum, fallback2) {
|
|
80121
|
+
if (value === void 0) return fallback2;
|
|
80110
80122
|
if (typeof value !== "string" || !/^\d+$/.test(value)) throw new CliContractError("invalid_limit", `${flag} must be an integer.`);
|
|
80111
80123
|
const parsed = Number(value);
|
|
80112
80124
|
if (parsed < minimum || parsed > maximum) throw new CliContractError("invalid_limit", `${flag} must be between ${minimum} and ${maximum}.`);
|
|
@@ -84535,12 +84547,12 @@ function parseUsageOverviewGranularity(value) {
|
|
|
84535
84547
|
if (value === "daily" || value === "weekly" || value === "monthly") return value;
|
|
84536
84548
|
throw new Error("Invalid --granularity. Use daily, weekly, or monthly.");
|
|
84537
84549
|
}
|
|
84538
|
-
function parseOptionalNumber(value,
|
|
84539
|
-
if (value === void 0) return
|
|
84550
|
+
function parseOptionalNumber(value, fallback2, flag) {
|
|
84551
|
+
if (value === void 0) return fallback2;
|
|
84540
84552
|
return parseRequiredNumber(value, flag);
|
|
84541
84553
|
}
|
|
84542
|
-
function parseOptionalBoolean(value,
|
|
84543
|
-
if (value === void 0) return
|
|
84554
|
+
function parseOptionalBoolean(value, fallback2, label) {
|
|
84555
|
+
if (value === void 0) return fallback2;
|
|
84544
84556
|
if (typeof value === "boolean") return value;
|
|
84545
84557
|
return parseOnOff(value, label);
|
|
84546
84558
|
}
|
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ interface ProjectedAssistantSpeechSegment {
|
|
|
16
16
|
type: "code" | "table" | "structured";
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
declare function projectAssistantSpeech(content: string): ProjectedAssistantSpeechSegment[];
|
|
19
|
+
declare function projectAssistantSpeech(content: string, language?: string): ProjectedAssistantSpeechSegment[];
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Owner-side helpers for historical assistant speech generation.
|
package/dist/index.js
CHANGED