chore: remove provably unused unexported Go helpers and dead web template files

This commit is contained in:
BaaRai
2026-11-20 21:43:43 +01:00
parent 42e8d3554d
commit 33e8d79426
9 changed files with 10 additions and 1275 deletions
-14
View File
@@ -281,20 +281,6 @@ func hostOf(rawURL string) string {
return u.Hostname()
}
func isBlank(v any) bool {
switch x := v.(type) {
case nil:
return true
case string:
return x == ""
case float64:
return x == 0
case int:
return x == 0
}
return false
}
func uniq(in []string) []string {
seen := map[string]struct{}{}
out := in[:0]
+9 -11
View File
@@ -193,20 +193,18 @@ func healthIDFor(prov llm.Provider, profileID int64) int64 {
return profileID
}
// current resolves the provider this role runs on, by precedence:
// Agent binding → task LLM profile chain → global/environment configuration.
// currentFor resolves the provider this role runs on, by precedence:
// Agent binding → task LLM profile chain → global/environment configuration,
// honoring a per-run profile pin set by the engine for per-intent rotation (#85).
// Binding wins over the task chain: a role explicitly assigned a model keeps running
// on that model; only when the binding is missing or fails to build does it fall back
// to the task chain, and to the global configuration when the chain is empty.
// The returned profile id is non-zero only on the task-chain path — streamTaskLLM uses it to decide whether a quota error should advance the task's failover state (binding/global paths leave the chain state untouched, preserving existing semantics).
func (r *taskLLMRuntime) current() (taskLLMSelection, error) {
return r.currentFor(context.Background())
}
// currentFor resolves like current, honoring a per-run profile pin set by the
// engine for per-intent rotation (#85). A pin is only a dispatch preference:
// the chain must still be in a ready state (an exhausted chain with no active
// head stays exhausted) and the pinned id must belong to the task's chain.
// A pin is only a dispatch preference: the chain must still be in a ready state
// (an exhausted chain with no active head stays exhausted) and the pinned id must
// belong to the task's chain. The returned profile id is non-zero only on the
// task-chain path — streamTaskLLM uses it to decide whether a quota error should
// advance the task's failover state (binding/global paths leave the chain state
// untouched, preserving existing semantics).
func (r *taskLLMRuntime) currentFor(ctx context.Context) (taskLLMSelection, error) {
taskNum, err := parseTaskID(r.taskID)
if err != nil {
+1 -1
View File
@@ -42,7 +42,7 @@ func (s *Server) resolutionFromProfile(p *db.LLMProfile, source string) taskLLMR
return result
}
// resolveTaskRoleLLM mirrors taskLLMRuntime.current without creating a provider:
// resolveTaskRoleLLM mirrors taskLLMRuntime.currentFor without creating a provider:
// role Agent binding -> explicit task chain -> active/global environment config.
// Database failures are returned rather than represented as an unavailable model.
func (s *Server) resolveTaskRoleLLM(t *Task, agentKey string) (taskLLMResolution, error) {
-10
View File
@@ -69,16 +69,6 @@ func workspacePathDenied(realRoot, realPath string) bool {
return false
}
// wsResolve maps a user-supplied relative path to an absolute path INSIDE the work
// dir. It returns ok=false if the path would escape the root (including via symlinks).
func (s *Server) wsResolve(rel string) (string, bool) {
cp, ok := s.wsResolveConfined(rel)
if !ok {
return "", false
}
return cp.realPath, true
}
// wsRel renders an absolute path back as a workspace-relative path (forward slashes).
func (s *Server) wsRel(abs string) string {
base, err := resolveRealRoot(s.m.dir)
@@ -1,84 +0,0 @@
"use client";
import { Ellipsis, Folder, Forward, type LucideIcon, Trash2 } from "lucide-react";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import {
SidebarGroup,
SidebarGroupLabel,
SidebarMenu,
SidebarMenuAction,
SidebarMenuButton,
SidebarMenuItem,
useSidebar,
} from "@/components/ui/sidebar";
import { t } from "@/i18n";
export function NavDocuments({
items,
}: {
readonly items: readonly {
readonly name: string;
readonly url: string;
readonly icon: LucideIcon;
}[];
}) {
const { isMobile } = useSidebar();
return (
<SidebarGroup className="group-data-[collapsible=icon]:hidden">
<SidebarGroupLabel>{t("Documents")}</SidebarGroupLabel>
<SidebarMenu>
{items.map((item) => (
<SidebarMenuItem key={item.name}>
<SidebarMenuButton asChild>
<a href={item.url}>
<item.icon />
<span>{item.name}</span>
</a>
</SidebarMenuButton>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<SidebarMenuAction showOnHover className="rounded-sm data-[state=open]:bg-accent">
<Ellipsis />
<span className="sr-only">{t("More")}</span>
</SidebarMenuAction>
</DropdownMenuTrigger>
<DropdownMenuContent
className="w-24 rounded-lg"
side={isMobile ? "bottom" : "right"}
align={isMobile ? "end" : "start"}
>
<DropdownMenuItem>
<Folder />
<span>{t("Open")}</span>
</DropdownMenuItem>
<DropdownMenuItem>
<Forward />
<span>{t("Share")}</span>
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem variant="destructive">
<Trash2 />
<span>{t("Delete")}</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</SidebarMenuItem>
))}
<SidebarMenuItem>
<SidebarMenuButton className="text-sidebar-foreground/70">
<Ellipsis className="text-sidebar-foreground/70" />
<span>{t("More")}</span>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroup>
);
}
@@ -1,43 +0,0 @@
"use client";
import type * as React from "react";
import type { LucideIcon } from "lucide-react";
import {
SidebarGroup,
SidebarGroupContent,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
} from "@/components/ui/sidebar";
export function NavSecondary({
items,
...props
}: {
items: {
title: string;
url: string;
icon: LucideIcon;
}[];
} & React.ComponentPropsWithoutRef<typeof SidebarGroup>) {
return (
<SidebarGroup {...props}>
<SidebarGroupContent>
<SidebarMenu>
{items.map((item) => (
<SidebarMenuItem key={item.title}>
<SidebarMenuButton asChild>
<a href={item.url}>
<item.icon />
<span>{item.title}</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
))}
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
);
}
-19
View File
@@ -1,19 +0,0 @@
import * as React from "react";
const LG_BREAKPOINT = 1024;
export function useIsLg() {
const [isLg, setIsLg] = React.useState<boolean | undefined>(undefined);
React.useEffect(() => {
const mql = window.matchMedia(`(min-width: ${LG_BREAKPOINT}px)`);
const onChange = () => {
setIsLg(window.innerWidth >= LG_BREAKPOINT);
};
mql.addEventListener("change", onChange);
setIsLg(window.innerWidth >= LG_BREAKPOINT);
return () => mql.removeEventListener("change", onChange);
}, []);
return !!isLg;
}
-25
View File
@@ -1,25 +0,0 @@
// Proxy disabled.
// Rename this file to `proxy.ts` to enable it.
import { type NextRequest, NextResponse } from "next/server";
/**
* Runs before requests complete.
* Use for rewrites, redirects, or header changes.
* Refer to Next.js Proxy docs for more examples.
*/
export function proxy(_req: NextRequest) {
// Example: redirect to dashboard if user is logged in
// const token = req.cookies.get("session_token")?.value;
// if (token && req.nextUrl.pathname === "/auth/login")
// return NextResponse.redirect(new URL("/dashboard", req.url));
return NextResponse.next();
}
/**
* Matcher runs for all routes.
* To skip assets or APIs, use a negative matcher from docs.
*/
export const config = {
matcher: "/:path*",
};
File diff suppressed because one or more lines are too long