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.
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.29.0
// source: agent_available_agents.sql
package store
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const getAgentSponsor = `-- name: GetAgentSponsor :one
SELECT registration.created_by_actor_id AS sponsor_actor_id
FROM agent_registrations registration
JOIN actors sponsor
ON sponsor.id=registration.created_by_actor_id
AND sponsor.tenant_id=registration.tenant_id
AND sponsor.kind='human'
AND sponsor.account_id IS NOT NULL
WHERE registration.tenant_id=$1::text
AND registration.actor_id=$2::text
AND registration.agent_management_id=$3::text
AND registration.status='active'
AND registration.agent_type IN ('general','anotherme')
FOR SHARE OF registration
`
type GetAgentSponsorParams struct {
TenantID string `json:"tenant_id"`
AgentActorID string `json:"agent_actor_id"`
AgentManagementID string `json:"agent_management_id"`
}
func (q *Queries) GetAgentSponsor(ctx context.Context, arg GetAgentSponsorParams) (string, error) {
row := q.db.QueryRow(ctx, getAgentSponsor, arg.TenantID, arg.AgentActorID, arg.AgentManagementID)
var sponsor_actor_id string
err := row.Scan(&sponsor_actor_id)
return sponsor_actor_id, err
}
const listAgentSponsorAvailableAgents = `-- name: ListAgentSponsorAvailableAgents :many
SELECT registration.actor_id,
actor.display_name AS name,
registration.description,
registration.created_at
FROM agent_registrations registration
JOIN actors actor
ON actor.id=registration.actor_id
AND actor.tenant_id=registration.tenant_id
AND actor.kind='agent'
WHERE registration.tenant_id=$1::text
AND registration.status='active'
AND registration.agent_type='general'
AND (
registration.visibility_scope='workspace' OR
registration.created_by_actor_id=$2::text OR
EXISTS (
SELECT 1
FROM active_room_members sponsor_membership
JOIN active_room_members agent_membership
ON agent_membership.tenant_id=sponsor_membership.tenant_id
AND agent_membership.room_id=sponsor_membership.room_id
AND agent_membership.actor_id=registration.actor_id
WHERE sponsor_membership.tenant_id=registration.tenant_id
AND sponsor_membership.actor_id=$2::text
)
)
AND (
$3::text='' OR
(registration.created_at,registration.actor_id)>(
SELECT cursor_registration.created_at,cursor_registration.actor_id
FROM agent_registrations cursor_registration
WHERE cursor_registration.tenant_id=$1::text
AND cursor_registration.actor_id=$3::text
AND cursor_registration.status='active'
AND cursor_registration.agent_type='general'
AND (
cursor_registration.visibility_scope='workspace' OR
cursor_registration.created_by_actor_id=$2::text OR
EXISTS (
SELECT 1
FROM active_room_members sponsor_membership
JOIN active_room_members agent_membership
ON agent_membership.tenant_id=sponsor_membership.tenant_id
AND agent_membership.room_id=sponsor_membership.room_id
AND agent_membership.actor_id=cursor_registration.actor_id
WHERE sponsor_membership.tenant_id=cursor_registration.tenant_id
AND sponsor_membership.actor_id=$2::text
)
)
)
)
ORDER BY registration.created_at,registration.actor_id
LIMIT $4::int
`
type ListAgentSponsorAvailableAgentsParams struct {
TenantID string `json:"tenant_id"`
SponsorActorID string `json:"sponsor_actor_id"`
Cursor string `json:"cursor"`
PageLimit int32 `json:"page_limit"`
}
type ListAgentSponsorAvailableAgentsRow struct {
ActorID string `json:"actor_id"`
Name string `json:"name"`
Description string `json:"description"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
func (q *Queries) ListAgentSponsorAvailableAgents(ctx context.Context, arg ListAgentSponsorAvailableAgentsParams) ([]ListAgentSponsorAvailableAgentsRow, error) {
rows, err := q.db.Query(ctx, listAgentSponsorAvailableAgents,
arg.TenantID,
arg.SponsorActorID,
arg.Cursor,
arg.PageLimit,
)
if err != nil {
return nil, err
}
defer rows.Close()
items := []ListAgentSponsorAvailableAgentsRow{}
for rows.Next() {
var i ListAgentSponsorAvailableAgentsRow
if err := rows.Scan(
&i.ActorID,
&i.Name,
&i.Description,
&i.CreatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}