Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

fix(teamhub): read the live browser's previous page, not the asking call's empty claim

muterCa54847eabb06
diff --git a/apps/teamhub/internal/store/queries/voice_live.sql b/apps/teamhub/internal/store/queries/voice_live.sql
index d2830cf7..fed68603 100644
--- a/apps/teamhub/internal/store/queries/voice_live.sql
+++ b/apps/teamhub/internal/store/queries/voice_live.sql
@@ -219,10 +219,12 @@ WHERE voice_session_id=sqlc.arg(voice_session_id)::text
AND turn_id=sqlc.arg(turn_id)::text AND name=sqlc.arg(name)::text;
-- name: GetLatestVoiceLiveToolOutput :one
--- The newest output this session returned for the tool, such as the page
--- the cloud browser showed last.
+-- The newest output this session returned for the tool before the call that
+-- asks, such as the page the browser showed last. The asking call is already
+-- claimed with no output, so it is left out.
SELECT output FROM voice_live_tool_calls
WHERE voice_session_id=sqlc.arg(voice_session_id)::text AND name=sqlc.arg(name)::text
+ AND call_id<>sqlc.arg(call_id)::text
ORDER BY created_at DESC LIMIT 1;
-- name: SearchVoiceLiveMessagesForAccount :many
diff --git a/apps/teamhub/internal/store/voice_live.sql.go b/apps/teamhub/internal/store/voice_live.sql.go
index b1744987..da439a3f 100644
--- a/apps/teamhub/internal/store/voice_live.sql.go
+++ b/apps/teamhub/internal/store/voice_live.sql.go
@@ -243,18 +243,21 @@ func (q *Queries) FindVoiceLiveRoomsForAccount(ctx context.Context, arg FindVoic
const getLatestVoiceLiveToolOutput = `-- name: GetLatestVoiceLiveToolOutput :one
SELECT output FROM voice_live_tool_calls
WHERE voice_session_id=$1::text AND name=$2::text
+ AND call_id<>$3::text
ORDER BY created_at DESC LIMIT 1
`
type GetLatestVoiceLiveToolOutputParams struct {
VoiceSessionID string `json:"voice_session_id"`
Name string `json:"name"`
+ CallID string `json:"call_id"`
}
-// The newest output this session returned for the tool, such as the page
-// the cloud browser showed last.
+// The newest output this session returned for the tool before the call that
+// asks, such as the page the browser showed last. The asking call is already
+// claimed with no output, so it is left out.
func (q *Queries) GetLatestVoiceLiveToolOutput(ctx context.Context, arg GetLatestVoiceLiveToolOutputParams) (string, error) {
- row := q.db.QueryRow(ctx, getLatestVoiceLiveToolOutput, arg.VoiceSessionID, arg.Name)
+ row := q.db.QueryRow(ctx, getLatestVoiceLiveToolOutput, arg.VoiceSessionID, arg.Name, arg.CallID)
var output string
err := row.Scan(&output)
return output, err