Skip to content

Commit 3702e47

Browse files
authored
Merge branch 'main' into alix/msteams-file-consent-upload-timeouts
2 parents 47508a7 + ecd7d6c commit 3702e47

45 files changed

Lines changed: 2963 additions & 632 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/platforms/windows.md‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,21 @@ Linux-compatible Gateway runtime.
1616
## Recommended: Windows Hub
1717

1818
Windows Hub is the native WinUI companion app for Windows 10 20H2+ and
19-
Windows 11. It installs without administrator privileges and ships as signed
20-
x64 and ARM64 installers on OpenClaw releases.
19+
Windows 11. It installs without administrator privileges and ships signed x64
20+
and ARM64 installers from its own release page.
2121

22-
Download the latest stable installer from the
23-
[OpenClaw releases page](https://github.com/openclaw/openclaw/releases) or
24-
directly via `releases/latest/download`:
22+
Windows Hub publishes independently from the OpenClaw CLI and Gateway. Download
23+
the latest stable Hub installer from the
24+
[Windows Hub releases page](https://github.com/openclaw/openclaw-windows-node/releases/latest)
25+
or directly via `releases/latest/download`:
2526

26-
- [OpenClawCompanion-Setup-x64.exe](https://github.com/openclaw/openclaw/releases/latest/download/OpenClawCompanion-Setup-x64.exe)
27-
- [OpenClawCompanion-Setup-arm64.exe](https://github.com/openclaw/openclaw/releases/latest/download/OpenClawCompanion-Setup-arm64.exe)
28-
- [Checksums](https://github.com/openclaw/openclaw/releases/latest/download/OpenClawCompanion-SHA256SUMS.txt)
27+
- [OpenClawCompanion-Setup-x64.exe](https://github.com/openclaw/openclaw-windows-node/releases/latest/download/OpenClawCompanion-Setup-x64.exe)
28+
- [OpenClawCompanion-Setup-arm64.exe](https://github.com/openclaw/openclaw-windows-node/releases/latest/download/OpenClawCompanion-Setup-arm64.exe)
2929

30-
If a link above 404s, visit the [releases page](https://github.com/openclaw/openclaw/releases)
31-
and look for `OpenClawCompanion-Setup-*` assets on the latest release.
30+
If a link above 404s, visit the [Windows Hub releases page](https://github.com/openclaw/openclaw-windows-node/releases)
31+
and open the newest stable Windows Hub release. Regular OpenClaw stable releases
32+
also mirror a pinned, release-validated Windows Hub build; that mirror can lag a
33+
newer standalone Hub release.
3234

3335
After install, launch **OpenClaw Companion** from the Start menu or system
3436
tray. The installer also adds shortcuts for Gateway Setup, Chat, Settings,

‎docs/tools/btw.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ disappears after reload.
5656

5757
## Surface behavior
5858

59-
| Surface | Behavior |
60-
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
61-
| TUI | Rendered inline in the chat log, visibly distinct from a normal reply, dismissible with `Enter` or `Esc`. |
62-
| External channels | Delivered as a clearly labeled one-off reply (Telegram, WhatsApp, Discord have no local ephemeral overlay). |
63-
| Control UI / web | Rendered as a dismissible BTW card above the composer, with a pending placeholder while the side question runs. Dismiss with the close button or `Esc`. |
59+
| Surface | Behavior |
60+
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61+
| TUI | Rendered inline in the chat log, visibly distinct from a normal reply, dismissible with `Enter` or `Esc`. |
62+
| External channels | Delivered as a clearly labeled one-off reply (Telegram, WhatsApp, Discord have no local ephemeral overlay). |
63+
| Control UI / web | Rendered as a floating "Side chat" panel pinned to the thread. Answers accumulate as turns and a "Follow up" input asks the next side question. Close (`Esc` or the X) keeps the conversation and reopens on the next answer; the trash button discards it and stops a pending run. |
6464

6565
## Selection popup (Control UI)
6666

@@ -69,7 +69,7 @@ selection popup with two actions:
6969

7070
- **More details** immediately sends an implicit `/btw` question asking the
7171
model to explain the highlighted text in the context of the current
72-
session. The answer arrives as a live side result above the composer.
72+
session. The answer arrives in the floating side chat panel.
7373
- **Ask in side chat** pre-fills the composer with a `/btw` draft quoting the
7474
highlighted text so you can type your own question about it.
7575

‎extensions/telegram/src/bot.fetch-abort.test.ts‎

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,25 +116,28 @@ describe("createTelegramBot fetch abort", () => {
116116
vi.useRealTimers();
117117
});
118118

119-
it("uses the longer outbound text timeout for sendMessage", async () => {
120-
vi.useFakeTimers();
121-
const fetchSpy = vi.fn(
122-
(_input: RequestInfo | URL, init?: RequestInit) =>
123-
new Promise<AbortSignal>((resolve) => {
124-
const signal = init?.signal as AbortSignal;
125-
signal.addEventListener("abort", () => resolve(signal), { once: true });
126-
}),
127-
);
128-
const { clientFetch } = createWrappedTelegramClientFetch(fetchSpy as unknown as typeof fetch);
119+
it.each(["sendMessage", "answerCallbackQuery"])(
120+
"uses the 60-second outbound guard for %s",
121+
async (method) => {
122+
vi.useFakeTimers();
123+
const fetchSpy = vi.fn(
124+
(_input: RequestInfo | URL, init?: RequestInit) =>
125+
new Promise<AbortSignal>((resolve) => {
126+
const signal = init?.signal as AbortSignal;
127+
signal.addEventListener("abort", () => resolve(signal), { once: true });
128+
}),
129+
);
130+
const { clientFetch } = createWrappedTelegramClientFetch(fetchSpy as unknown as typeof fetch);
129131

130-
const observedSignalPromise = clientFetch("https://api.telegram.org/bot123456:ABC/sendMessage");
131-
await vi.advanceTimersByTimeAsync(60_000);
132-
const observedSignal = (await observedSignalPromise) as AbortSignal;
132+
const observedSignalPromise = clientFetch(`https://api.telegram.org/bot123456:ABC/${method}`);
133+
await vi.advanceTimersByTimeAsync(60_000);
134+
const observedSignal = (await observedSignalPromise) as AbortSignal;
133135

134-
expect(observedSignal).toBeInstanceOf(AbortSignal);
135-
expect(observedSignal.aborted).toBe(true);
136-
vi.useRealTimers();
137-
});
136+
expect(observedSignal).toBeInstanceOf(AbortSignal);
137+
expect(observedSignal.aborted).toBe(true);
138+
vi.useRealTimers();
139+
},
140+
);
138141

139142
it("lets configured timeoutSeconds extend outbound method guards", async () => {
140143
vi.useFakeTimers();

‎extensions/telegram/src/bot.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ async function writeDirectTelegramTranscriptMessages(params: {
240240
content: message.text,
241241
timestamp: message.timestamp,
242242
},
243+
eventId: message.id,
243244
});
244245
}
245246
}

‎extensions/telegram/src/request-timeouts.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,13 @@ describe("resolveTelegramRequestTimeoutMs", () => {
4949
expect(resolveTelegramRequestTimeoutMs("getme", 10)).toBe(15_000);
5050
});
5151

52-
it("does not assign hard timeouts to unrelated Telegram methods", () => {
53-
expect(resolveTelegramRequestTimeoutMs("answercallbackquery")).toBeUndefined();
52+
it("uses the outbound guard for unlisted Telegram methods", () => {
53+
expect(resolveTelegramRequestTimeoutMs("answercallbackquery")).toBe(60_000);
54+
expect(resolveTelegramRequestTimeoutMs("answercallbackquery", 10)).toBe(60_000);
55+
expect(resolveTelegramRequestTimeoutMs("answercallbackquery", 90)).toBe(90_000);
56+
});
57+
58+
it("does not assign a timeout when no Telegram method can be identified", () => {
5459
expect(resolveTelegramRequestTimeoutMs(null)).toBeUndefined();
5560
});
5661
});

‎extensions/telegram/src/request-timeouts.ts‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
} from "openclaw/plugin-sdk/number-runtime";
66

77
export const TELEGRAM_GET_UPDATES_REQUEST_TIMEOUT_MS = 45_000;
8-
const TELEGRAM_OUTBOUND_TEXT_REQUEST_TIMEOUT_MS = 60_000;
8+
const TELEGRAM_DEFAULT_REQUEST_TIMEOUT_MS = 60_000;
99
const TELEGRAM_DEFAULT_LONG_POLL_TIMEOUT_SECONDS = 30;
1010
const TELEGRAM_LONG_POLL_ABORT_MARGIN_SECONDS = 5;
1111

@@ -24,10 +24,10 @@ const TELEGRAM_REQUEST_TIMEOUTS_MS = {
2424
pinchatmessage: 15_000,
2525
sendanimation: 30_000,
2626
sendaudio: 30_000,
27-
sendchataction: TELEGRAM_OUTBOUND_TEXT_REQUEST_TIMEOUT_MS,
27+
sendchataction: TELEGRAM_DEFAULT_REQUEST_TIMEOUT_MS,
2828
senddocument: 30_000,
29-
sendmessage: TELEGRAM_OUTBOUND_TEXT_REQUEST_TIMEOUT_MS,
30-
sendmessagedraft: TELEGRAM_OUTBOUND_TEXT_REQUEST_TIMEOUT_MS,
29+
sendmessage: TELEGRAM_DEFAULT_REQUEST_TIMEOUT_MS,
30+
sendmessagedraft: TELEGRAM_DEFAULT_REQUEST_TIMEOUT_MS,
3131
sendphoto: 30_000,
3232
sendvideo: 30_000,
3333
sendvoice: 30_000,
@@ -54,11 +54,12 @@ export function resolveTelegramRequestTimeoutMs(
5454
if (!method) {
5555
return undefined;
5656
}
57-
const baseTimeoutMs =
58-
TELEGRAM_REQUEST_TIMEOUTS_MS[method as keyof typeof TELEGRAM_REQUEST_TIMEOUTS_MS];
59-
if (baseTimeoutMs === undefined || method === "getupdates") {
60-
return baseTimeoutMs;
57+
if (method === "getupdates") {
58+
return TELEGRAM_REQUEST_TIMEOUTS_MS.getupdates;
6159
}
60+
const baseTimeoutMs =
61+
TELEGRAM_REQUEST_TIMEOUTS_MS[method as keyof typeof TELEGRAM_REQUEST_TIMEOUTS_MS] ??
62+
TELEGRAM_DEFAULT_REQUEST_TIMEOUT_MS;
6263
return Math.max(baseTimeoutMs, resolveConfiguredTelegramRequestTimeoutMs(timeoutSeconds) ?? 0);
6364
}
6465

‎packages/ai/src/providers/clean-for-gemini.test.ts‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,77 @@ describe("cleanSchemaForGemini", () => {
225225

226226
expect(cleaned.properties?.agentId?.type).toBe("string");
227227
});
228+
229+
it.each([
230+
{
231+
name: "integer enum",
232+
schema: { type: "integer", enum: [1, 2, 3] },
233+
expected: { type: "integer", enum: ["1", "2", "3"] },
234+
},
235+
{
236+
name: "integer enum before type",
237+
schema: { enum: [1, 2, 3], type: "integer" },
238+
expected: { enum: ["1", "2", "3"], type: "integer" },
239+
},
240+
{
241+
name: "boolean enum",
242+
schema: { type: "boolean", enum: [true, false] },
243+
expected: { type: "boolean", enum: ["true", "false"] },
244+
},
245+
{
246+
name: "string enum",
247+
schema: { type: "string", enum: ["a", "b", "c"] },
248+
expected: { type: "string", enum: ["a", "b", "c"] },
249+
},
250+
{
251+
name: "integer const before type",
252+
schema: { const: 42, type: "integer" },
253+
expected: { enum: ["42"], type: "integer" },
254+
},
255+
])("stringifies $name values without changing the schema type", ({ schema, expected }) => {
256+
expect(cleanSchemaForGemini(schema)).toStrictEqual(expected);
257+
});
258+
259+
it("drops null/undefined enum entries and de-duplicates", () => {
260+
const cleaned = cleanSchemaForGemini({
261+
type: "integer",
262+
enum: [1, 2, 2, null, undefined, 3],
263+
}) as { enum?: unknown };
264+
265+
expect(cleaned.enum).toStrictEqual(["1", "2", "3"]);
266+
});
267+
268+
it("stringifies nested numeric enums while preserving their number type", () => {
269+
const cleaned = cleanSchemaForGemini({
270+
type: "object",
271+
properties: {
272+
outer: {
273+
type: "array",
274+
items: {
275+
type: "object",
276+
properties: {
277+
score: { type: "number", enum: [1, 2, 3, 4, 5] },
278+
},
279+
},
280+
},
281+
},
282+
}) as {
283+
properties?: {
284+
outer?: { items?: { properties?: { score?: { type?: unknown; enum?: unknown } } } };
285+
};
286+
};
287+
288+
const score = cleaned.properties?.outer?.items?.properties?.score;
289+
expect(score?.type).toBe("number");
290+
expect(score?.enum).toStrictEqual(["1", "2", "3", "4", "5"]);
291+
});
292+
293+
it("returns no enum key when array becomes empty after coercion", () => {
294+
const cleaned = cleanSchemaForGemini({
295+
type: "integer",
296+
enum: [null, undefined, {}],
297+
}) as { enum?: unknown };
298+
299+
expect(cleaned.enum).toBeUndefined();
300+
});
228301
});

‎packages/ai/src/providers/clean-for-gemini.ts‎

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,33 @@ function copySchemaMeta(from: Record<string, unknown>, to: Record<string, unknow
4646
}
4747
}
4848

49+
// Google requires enum entries as strings even when the declared schema type is numeric or
50+
// boolean. Keep the type intact so tool argument generation and runtime validation still agree.
51+
function stringifyGeminiEnumValue(value: unknown): string | undefined {
52+
if (typeof value === "string") {
53+
return value;
54+
}
55+
if (typeof value === "number" && Number.isFinite(value)) {
56+
return String(value);
57+
}
58+
if (typeof value === "boolean") {
59+
return String(value);
60+
}
61+
return undefined;
62+
}
63+
64+
function cleanGeminiEnumValues(value: unknown): string[] | undefined {
65+
if (!Array.isArray(value)) {
66+
return undefined;
67+
}
68+
const values = value.flatMap((entry) => {
69+
const stringified = stringifyGeminiEnumValue(entry);
70+
return stringified === undefined ? [] : [stringified];
71+
});
72+
const unique = [...new Set(values)];
73+
return unique.length > 0 ? unique : undefined;
74+
}
75+
4976
// Check if an anyOf/oneOf array contains only literal values that can be flattened.
5077
// TypeBox Type.Literal generates { const: "value", type: "string" }.
5178
// Some schemas may use { enum: ["value"], type: "string" }.
@@ -325,7 +352,18 @@ function cleanSchemaForGeminiWithDefs(
325352
}
326353

327354
if (key === "const") {
328-
cleaned.enum = [value];
355+
const enumValues = cleanGeminiEnumValues([value]);
356+
if (enumValues) {
357+
cleaned.enum = enumValues;
358+
}
359+
continue;
360+
}
361+
362+
if (key === "enum") {
363+
const enumValues = cleanGeminiEnumValues(value);
364+
if (enumValues) {
365+
cleaned.enum = enumValues;
366+
}
329367
continue;
330368
}
331369

0 commit comments

Comments
 (0)