goose2 distribution bundling (#8911)

This commit is contained in:
Jack Amadeo
2026-05-05 11:20:49 -04:00
committed by GitHub
parent fbb5e3685d
commit 9f3fe88afa
25 changed files with 589 additions and 29 deletions
+6
View File
@@ -0,0 +1,6 @@
import { invoke } from "@tauri-apps/api/core";
import type { DistroBundleInfo } from "@/shared/types/distro";
export async function getDistroBundle(): Promise<DistroBundleInfo> {
return invoke("get_distro_bundle");
}
+1
View File
@@ -1,4 +1,5 @@
export * from "./agents";
export * from "./acp";
export * from "./distro";
export * from "./git";
export * from "./pathResolver";
+7
View File
@@ -0,0 +1,7 @@
export interface DistroBundleInfo {
present: boolean;
appVersion?: string;
featureToggles?: Record<string, boolean>;
extensionAllowlist?: string;
providerAllowlist?: string;
}
+1
View File
@@ -1,3 +1,4 @@
export * from "./distro";
export * from "./messages";
export * from "./agents";
export * from "./chat";
@@ -12,6 +12,7 @@ import type { ComponentProps } from "react";
import { createContext, useContext, useMemo } from "react";
import { useTranslation } from "react-i18next";
import { getUsage } from "tokenlens";
import { useDistroStore } from "@/features/settings/stores/distroStore";
const PERCENT_MAX = 100;
const ICON_RADIUS = 10;
@@ -61,6 +62,13 @@ export const Context = ({
);
};
function useCostTrackingEnabled() {
const featureToggles = useDistroStore(
(state) => state.manifest.featureToggles,
);
return featureToggles?.costTracking !== false;
}
const ContextIcon = () => {
const { t } = useTranslation("common");
const { usedTokens, maxTokens } = useContextValue();
@@ -199,6 +207,7 @@ export const ContextContentFooter = ({
className,
...props
}: ContextContentFooterProps) => {
const costTrackingEnabled = useCostTrackingEnabled();
const { t } = useTranslation("common");
const { formatNumber } = useLocaleFormatting();
const { modelId, usage } = useContextValue();
@@ -216,6 +225,10 @@ export const ContextContentFooter = ({
style: "currency",
});
if (!costTrackingEnabled) {
return null;
}
return (
<div
className={cn(
@@ -241,6 +254,7 @@ const TokensWithCost = ({
tokens?: number;
costText?: string;
}) => {
const costTrackingEnabled = useCostTrackingEnabled();
const { formatNumber } = useLocaleFormatting();
return (
@@ -250,7 +264,7 @@ const TokensWithCost = ({
: formatNumber(tokens, {
notation: "compact",
})}
{costText ? (
{costTrackingEnabled && costText ? (
<span className="ml-2 text-muted-foreground"> {costText}</span>
) : null}
</span>