Merge e31764fed1 into 09be5d45d5
This commit is contained in:
commit
fda6e3f9e0
@ -302,7 +302,7 @@ export async function processDiscordMessage(ctx: DiscordMessagePreflightContext)
|
|||||||
ctx: ctxPayload,
|
ctx: ctxPayload,
|
||||||
updateLastRoute: isDirectMessage
|
updateLastRoute: isDirectMessage
|
||||||
? {
|
? {
|
||||||
sessionKey: route.mainSessionKey,
|
sessionKey: route.sessionKey,
|
||||||
channel: "discord",
|
channel: "discord",
|
||||||
to: `user:${author.id}`,
|
to: `user:${author.id}`,
|
||||||
accountId: route.accountId,
|
accountId: route.accountId,
|
||||||
|
|||||||
@ -664,12 +664,25 @@ export function attachGatewayWsMessageHandler(params: {
|
|||||||
requestId: pairing.request.requestId,
|
requestId: pairing.request.requestId,
|
||||||
reason,
|
reason,
|
||||||
});
|
});
|
||||||
|
const helpMessage =
|
||||||
|
`Device pairing required. ` +
|
||||||
|
`On the OpenClaw server machine, run: ` +
|
||||||
|
`'openclaw devices list' to see pending requests, then ` +
|
||||||
|
`'openclaw devices approve ${pairing.request.requestId}' to approve this device. ` +
|
||||||
|
`Alternatively, access the Control UI from the server's localhost to approve.`;
|
||||||
send({
|
send({
|
||||||
type: "res",
|
type: "res",
|
||||||
id: frame.id,
|
id: frame.id,
|
||||||
ok: false,
|
ok: false,
|
||||||
error: errorShape(ErrorCodes.NOT_PAIRED, "pairing required", {
|
error: errorShape(ErrorCodes.NOT_PAIRED, helpMessage, {
|
||||||
details: { requestId: pairing.request.requestId },
|
details: {
|
||||||
|
requestId: pairing.request.requestId,
|
||||||
|
deviceId: device.id,
|
||||||
|
instructions: {
|
||||||
|
list: "openclaw devices list",
|
||||||
|
approve: `openclaw devices approve ${pairing.request.requestId}`,
|
||||||
|
}
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
close(1008, "pairing required");
|
close(1008, "pairing required");
|
||||||
|
|||||||
@ -510,7 +510,7 @@ export async function monitorIMessageProvider(opts: MonitorIMessageOpts = {}): P
|
|||||||
updateLastRoute:
|
updateLastRoute:
|
||||||
!isGroup && updateTarget
|
!isGroup && updateTarget
|
||||||
? {
|
? {
|
||||||
sessionKey: route.mainSessionKey,
|
sessionKey: route.sessionKey,
|
||||||
channel: "imessage",
|
channel: "imessage",
|
||||||
to: updateTarget,
|
to: updateTarget,
|
||||||
accountId: route.accountId,
|
accountId: route.accountId,
|
||||||
|
|||||||
@ -282,7 +282,7 @@ export async function buildLineMessageContext(params: BuildLineMessageContextPar
|
|||||||
if (!isGroup) {
|
if (!isGroup) {
|
||||||
await updateLastRoute({
|
await updateLastRoute({
|
||||||
storePath,
|
storePath,
|
||||||
sessionKey: route.mainSessionKey,
|
sessionKey: route.sessionKey,
|
||||||
deliveryContext: {
|
deliveryContext: {
|
||||||
channel: "line",
|
channel: "line",
|
||||||
to: userId ?? peerId,
|
to: userId ?? peerId,
|
||||||
@ -432,7 +432,7 @@ export async function buildLinePostbackContext(params: {
|
|||||||
if (!isGroup) {
|
if (!isGroup) {
|
||||||
await updateLastRoute({
|
await updateLastRoute({
|
||||||
storePath,
|
storePath,
|
||||||
sessionKey: route.mainSessionKey,
|
sessionKey: route.sessionKey,
|
||||||
deliveryContext: {
|
deliveryContext: {
|
||||||
channel: "line",
|
channel: "line",
|
||||||
to: userId ?? peerId,
|
to: userId ?? peerId,
|
||||||
|
|||||||
@ -156,7 +156,7 @@ export function createSignalEventHandler(deps: SignalEventHandlerDeps) {
|
|||||||
ctx: ctxPayload,
|
ctx: ctxPayload,
|
||||||
updateLastRoute: !entry.isGroup
|
updateLastRoute: !entry.isGroup
|
||||||
? {
|
? {
|
||||||
sessionKey: route.mainSessionKey,
|
sessionKey: route.sessionKey,
|
||||||
channel: "signal",
|
channel: "signal",
|
||||||
to: entry.senderRecipient,
|
to: entry.senderRecipient,
|
||||||
accountId: route.accountId,
|
accountId: route.accountId,
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export async function dispatchPreparedSlackMessage(prepared: PreparedSlackMessag
|
|||||||
});
|
});
|
||||||
await updateLastRoute({
|
await updateLastRoute({
|
||||||
storePath,
|
storePath,
|
||||||
sessionKey: route.mainSessionKey,
|
sessionKey: route.sessionKey,
|
||||||
deliveryContext: {
|
deliveryContext: {
|
||||||
channel: "slack",
|
channel: "slack",
|
||||||
to: `user:${message.user}`,
|
to: `user:${message.user}`,
|
||||||
|
|||||||
@ -533,7 +533,7 @@ export async function prepareSlackMessage(params: {
|
|||||||
ctx: ctxPayload,
|
ctx: ctxPayload,
|
||||||
updateLastRoute: isDirectMessage
|
updateLastRoute: isDirectMessage
|
||||||
? {
|
? {
|
||||||
sessionKey: route.mainSessionKey,
|
sessionKey: route.sessionKey,
|
||||||
channel: "slack",
|
channel: "slack",
|
||||||
to: `user:${message.user}`,
|
to: `user:${message.user}`,
|
||||||
accountId: route.accountId,
|
accountId: route.accountId,
|
||||||
|
|||||||
@ -617,7 +617,7 @@ export const buildTelegramMessageContext = async ({
|
|||||||
ctx: ctxPayload,
|
ctx: ctxPayload,
|
||||||
updateLastRoute: !isGroup
|
updateLastRoute: !isGroup
|
||||||
? {
|
? {
|
||||||
sessionKey: route.mainSessionKey,
|
sessionKey: route.sessionKey,
|
||||||
channel: "telegram",
|
channel: "telegram",
|
||||||
to: String(chatId),
|
to: String(chatId),
|
||||||
accountId: route.accountId,
|
accountId: route.accountId,
|
||||||
|
|||||||
@ -6,21 +6,22 @@
|
|||||||
* Returns true if the provider requires reasoning to be wrapped in tags
|
* Returns true if the provider requires reasoning to be wrapped in tags
|
||||||
* (e.g. <think> and <final>) in the text stream, rather than using native
|
* (e.g. <think> and <final>) in the text stream, rather than using native
|
||||||
* API fields for reasoning/thinking.
|
* API fields for reasoning/thinking.
|
||||||
|
*
|
||||||
|
* NOTE: Only include providers that NATIVELY use <think> and <final> tags.
|
||||||
|
* Standard Gemini 2.0 (google-gemini-cli, google-generative-ai) does NOT use
|
||||||
|
* these tags natively, but Google Antigravity (Gemini 3.0) does.
|
||||||
*/
|
*/
|
||||||
export function isReasoningTagProvider(provider: string | undefined | null): boolean {
|
export function isReasoningTagProvider(provider: string | undefined | null): boolean {
|
||||||
if (!provider) return false;
|
if (!provider) return false;
|
||||||
const normalized = provider.trim().toLowerCase();
|
const normalized = provider.trim().toLowerCase();
|
||||||
|
|
||||||
// Check for exact matches or known prefixes/substrings for reasoning providers
|
// Check for exact matches or known prefixes/substrings for reasoning providers
|
||||||
if (
|
if (normalized === "ollama") {
|
||||||
normalized === "ollama" ||
|
|
||||||
normalized === "google-gemini-cli" ||
|
|
||||||
normalized === "google-generative-ai"
|
|
||||||
) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle google-antigravity and its model variations (e.g. google-antigravity/gemini-3)
|
// Handle google-antigravity and its model variations (e.g. google-antigravity/gemini-3)
|
||||||
|
// This is Gemini 3.0 which DOES use reasoning tags natively.
|
||||||
if (normalized.includes("google-antigravity")) {
|
if (normalized.includes("google-antigravity")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -295,7 +295,7 @@ export async function processMessage(params: {
|
|||||||
cfg: params.cfg,
|
cfg: params.cfg,
|
||||||
backgroundTasks: params.backgroundTasks,
|
backgroundTasks: params.backgroundTasks,
|
||||||
storeAgentId: params.route.agentId,
|
storeAgentId: params.route.agentId,
|
||||||
sessionKey: params.route.mainSessionKey,
|
sessionKey: params.route.sessionKey,
|
||||||
channel: "whatsapp",
|
channel: "whatsapp",
|
||||||
to: dmRouteTarget,
|
to: dmRouteTarget,
|
||||||
accountId: params.route.accountId,
|
accountId: params.route.accountId,
|
||||||
|
|||||||
@ -219,11 +219,13 @@ export class GatewayBrowserClient {
|
|||||||
this.backoffMs = 800;
|
this.backoffMs = 800;
|
||||||
this.opts.onHello?.(hello);
|
this.opts.onHello?.(hello);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((err) => {
|
||||||
if (canFallbackToShared && deviceIdentity) {
|
if (canFallbackToShared && deviceIdentity) {
|
||||||
clearDeviceAuthToken({ deviceId: deviceIdentity.deviceId, role });
|
clearDeviceAuthToken({ deviceId: deviceIdentity.deviceId, role });
|
||||||
}
|
}
|
||||||
this.ws?.close(CONNECT_FAILED_CLOSE_CODE, "connect failed");
|
// Extract the error message to pass to onClose handler
|
||||||
|
const errorMessage = err instanceof Error ? err.message : "connect failed";
|
||||||
|
this.ws?.close(CONNECT_FAILED_CLOSE_CODE, errorMessage);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user