updates
This commit is contained in:
parent
471371d90f
commit
1c2c27f725
@ -117,7 +117,7 @@ This is the actual config running on @steipete's Mac (`~/.warelay/warelay.json`)
|
|||||||
Peter trusts you with a lot of power. Don't betray that trust.`,
|
Peter trusts you with a lot of power. Don't betray that trust.`,
|
||||||
command: [
|
command: [
|
||||||
"claude",
|
"claude",
|
||||||
"--model", "claude-opus-4-5-20251101", // or claude-sonnet-4-5 for faster/cheaper
|
"--model", "claude-opus-4-5-20251101", // or claude-sonnet-4-5-20250929 for faster/cheaper
|
||||||
"-p",
|
"-p",
|
||||||
"--output-format", "json",
|
"--output-format", "json",
|
||||||
"--dangerously-skip-permissions", // lets Claude run commands freely
|
"--dangerously-skip-permissions", // lets Claude run commands freely
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
export type GetReplyOptions = {
|
export type GetReplyOptions = {
|
||||||
onReplyStart?: () => Promise<void> | void;
|
onReplyStart?: () => Promise<unknown> | void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ReplyPayload = {
|
export type ReplyPayload = {
|
||||||
|
|||||||
@ -14,18 +14,26 @@ type TwilioRequester = {
|
|||||||
request: (options: TwilioRequestOptions) => Promise<unknown>;
|
request: (options: TwilioRequestOptions) => Promise<unknown>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type TypingIndicatorResult = {
|
||||||
|
sent: boolean;
|
||||||
|
response?: unknown;
|
||||||
|
error?: unknown;
|
||||||
|
};
|
||||||
|
|
||||||
export async function sendTypingIndicator(
|
export async function sendTypingIndicator(
|
||||||
client: TwilioRequester,
|
client: TwilioRequester,
|
||||||
runtime: RuntimeEnv,
|
runtime: RuntimeEnv,
|
||||||
messageSid?: string,
|
messageSid?: string,
|
||||||
) {
|
): Promise<TypingIndicatorResult> {
|
||||||
// Best-effort WhatsApp typing indicator (public beta as of Nov 2025).
|
// Best-effort WhatsApp typing indicator (public beta as of Nov 2025).
|
||||||
|
// Note: This API also marks the referenced message as read automatically.
|
||||||
|
// The typing indicator disappears after 25 seconds or when a response is sent.
|
||||||
if (!messageSid) {
|
if (!messageSid) {
|
||||||
logVerbose("Skipping typing indicator: missing MessageSid");
|
logVerbose("Skipping typing indicator: missing MessageSid");
|
||||||
return;
|
return { sent: false };
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await client.request({
|
const response = await client.request({
|
||||||
method: "post",
|
method: "post",
|
||||||
uri: "https://messaging.twilio.com/v2/Indicators/Typing.json",
|
uri: "https://messaging.twilio.com/v2/Indicators/Typing.json",
|
||||||
form: {
|
form: {
|
||||||
@ -33,11 +41,21 @@ export async function sendTypingIndicator(
|
|||||||
channel: "whatsapp",
|
channel: "whatsapp",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
logVerbose(`Sent typing indicator for inbound ${messageSid}`);
|
logVerbose(
|
||||||
|
`Sent typing indicator for inbound ${messageSid} (response: ${JSON.stringify(response)})`,
|
||||||
|
);
|
||||||
|
return { sent: true, response };
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (isVerbose()) {
|
// Always log typing indicator failures (not just in verbose mode) since
|
||||||
runtime.error(warn("Typing indicator failed (continuing without it)"));
|
// this helps diagnose why read receipts/typing aren't working.
|
||||||
runtime.error(err as Error);
|
const errorMsg =
|
||||||
}
|
err instanceof Error ? err.message : JSON.stringify(err, null, 2);
|
||||||
|
runtime.error(
|
||||||
|
warn(`Typing indicator failed for ${messageSid}: ${errorMsg}`),
|
||||||
|
);
|
||||||
|
if (isVerbose() && err instanceof Error && err.stack) {
|
||||||
|
runtime.error(err.stack);
|
||||||
|
}
|
||||||
|
return { sent: false, error: err };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user