Merge branch 'main' of github.com:NousResearch/hermes-agent into bb/gui
# Conflicts: # tui_gateway/server.py
This commit is contained in:
@@ -1,4 +1,21 @@
|
||||
const BASE = "";
|
||||
// The dashboard can be served either at the root of its host (e.g.
|
||||
// https://kanban.tilos.com/) or under a URL prefix when reverse-proxied
|
||||
// (e.g. https://mission-control.tilos.com/hermes/). The Python backend
|
||||
// injects ``window.__HERMES_BASE_PATH__`` into index.html based on the
|
||||
// incoming ``X-Forwarded-Prefix`` header so the SPA can address its own
|
||||
// ``/api/...`` and ``/dashboard-plugins/...`` URLs correctly without a
|
||||
// rebuild. Empty string means "served at root".
|
||||
function readBasePath(): string {
|
||||
if (typeof window === "undefined") return "";
|
||||
const raw = window.__HERMES_BASE_PATH__ ?? "";
|
||||
if (!raw) return "";
|
||||
// Normalise: ensure leading slash, strip trailing slash.
|
||||
const withLead = raw.startsWith("/") ? raw : `/${raw}`;
|
||||
return withLead.replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
export const HERMES_BASE_PATH = readBasePath();
|
||||
const BASE = HERMES_BASE_PATH;
|
||||
|
||||
import type { DashboardTheme } from "@/themes/types";
|
||||
|
||||
@@ -7,6 +24,7 @@ import type { DashboardTheme } from "@/themes/types";
|
||||
declare global {
|
||||
interface Window {
|
||||
__HERMES_SESSION_TOKEN__?: string;
|
||||
__HERMES_BASE_PATH__?: string;
|
||||
}
|
||||
}
|
||||
let _sessionToken: string | null = null;
|
||||
@@ -49,6 +67,10 @@ export const api = {
|
||||
fetchJSON<PaginatedSessions>(`/api/sessions?limit=${limit}&offset=${offset}`),
|
||||
getSessionMessages: (id: string) =>
|
||||
fetchJSON<SessionMessagesResponse>(`/api/sessions/${encodeURIComponent(id)}/messages`),
|
||||
getSessionLatestDescendant: (id: string) =>
|
||||
fetchJSON<SessionLatestDescendantResponse>(
|
||||
`/api/sessions/${encodeURIComponent(id)}/latest-descendant`,
|
||||
),
|
||||
deleteSession: (id: string) =>
|
||||
fetchJSON<{ ok: boolean }>(`/api/sessions/${encodeURIComponent(id)}`, {
|
||||
method: "DELETE",
|
||||
@@ -373,6 +395,14 @@ export interface SessionInfo {
|
||||
input_tokens: number;
|
||||
output_tokens: number;
|
||||
preview: string | null;
|
||||
parent_session_id?: string | null;
|
||||
}
|
||||
|
||||
export interface SessionLatestDescendantResponse {
|
||||
requested_session_id: string;
|
||||
session_id: string;
|
||||
path: string[];
|
||||
changed: boolean;
|
||||
}
|
||||
|
||||
export interface PaginatedSessions {
|
||||
|
||||
Reference in New Issue
Block a user