twilio-opencode

A lightweight express server to handle Twilio voice and messaging webhooks for prompting Opencode.
git clone https://unitehenry.com/git/twilio-opencode.git
Log | Files | Refs | README | LICENSE

commit ea152b158210f2fcd8cfb697c9b2609fe7847906
parent 9e613c786736e5193d75f5eac523d81014e0af16
Author: Henry Unite <unitehenry@gmail.com>
Date:   Thu, 26 Feb 2026 08:24:07 +0000

refactor: logs

Diffstat:
Mapp.ts | 2+-
Mprompt.ts | 12+++++++-----
2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/app.ts b/app.ts @@ -87,4 +87,4 @@ app.get("/health", (req, res) => res.sendStatus(200)); const port: number = parseInt(process.env.PORT || "3000", 10); -app.listen(port, (): void => log("INFO", `Server running on port ${port}`)); +app.listen(port, (): void => log("INFO", 'Server started', { port })); diff --git a/prompt.ts b/prompt.ts @@ -10,23 +10,25 @@ export async function prompt( message: string, sessionId: string | null, ): Promise<PromptResult> { - log("INFO", `Session ID Param: ${sessionId}`); + const baseUrl = "http://127.0.0.1:36967"; - const client = createOpencodeClient({ - baseUrl: "http://127.0.0.1:36967", - }); + log("INFO", 'Prompting agent', { sessionId, baseUrl, message }); + + const client = createOpencodeClient({ baseUrl }); const id: string = await (async (): Promise<string> => { if (sessionId) { return sessionId; } + log('INFO', 'Creating opencode session'); + const sessionResult = await client.session.create(); return sessionResult.data.id; })(); - log("INFO", `Session ID: ${id}`); + log("INFO", 'Session connected', { sessionId: id }); const result = await client.session.prompt({ path: { id },