Skip to content

Commit e502c2e

Browse files
author
Shaw
committed
Commit remaining local agent updates
1 parent 466482e commit e502c2e

7 files changed

Lines changed: 52 additions & 719 deletions

File tree

packages/ui/src/App.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ function lazyNamedView<
9999
});
100100
}
101101

102-
import { InventoryView } from "@elizaos/app-wallet";
103102
import { fetchWithCsrf } from "./api/csrf-client";
104103
import {
105104
type AppShellPageRegistration,
@@ -448,6 +447,21 @@ function DynamicPluginPage({ resolved }: { resolved: ResolvedDynamicPage }) {
448447
);
449448
}
450449

450+
function WalletInventoryPage() {
451+
const registration = listAppShellPages().find(
452+
(entry) => entry.id === "wallet.inventory" || entry.path === "/inventory",
453+
);
454+
if (!registration) {
455+
return (
456+
<div className="flex flex-1 min-h-0 min-w-0 items-center justify-center text-sm text-muted">
457+
Wallet is not registered in this build.
458+
</div>
459+
);
460+
}
461+
const Component = registration.Component;
462+
return <Component />;
463+
}
464+
451465
function ViewRouter({
452466
onCharacterHeaderActionsChange,
453467
}: {
@@ -537,7 +551,7 @@ function ViewRouter({
537551
chatScope="page-wallet"
538552
pageScopedChatPaneProps={buildWalletPageScopedChatPaneProps()}
539553
>
540-
<InventoryView />
554+
<WalletInventoryPage />
541555
</TabScrollView>
542556
);
543557
case "connectors":
@@ -1075,7 +1089,7 @@ export function App() {
10751089
main={
10761090
<div className="flex flex-col flex-1 min-h-0 min-w-0 overflow-hidden">
10771091
<LazyViewBoundary>
1078-
<InventoryView />
1092+
<WalletInventoryPage />
10791093
</LazyViewBoundary>
10801094
</div>
10811095
}

packages/ui/src/api/client-cloud.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,14 @@ function resolveDirectCloudClientApiBase(client: ElizaClient): string | null {
251251
}
252252

253253
function readDirectCloudToken(client: ElizaClient): string | null {
254-
const token =
255-
((globalThis as Record<string, unknown>)
256-
.__ELIZA_CLOUD_AUTH_TOKEN__ as unknown) ?? client.getRestAuthToken();
257-
return typeof token === "string" && token.trim() ? token.trim() : null;
254+
const globalToken = (globalThis as Record<string, unknown>)
255+
.__ELIZA_CLOUD_AUTH_TOKEN__;
256+
if (typeof globalToken === "string" && globalToken.trim()) {
257+
return globalToken.trim();
258+
}
259+
260+
const clientToken = client.getRestAuthToken()?.trim();
261+
return clientToken || null;
258262
}
259263

260264
function isNativeDirectCloudAuthMissing(client: ElizaClient): boolean {

packages/ui/src/components/shell/RuntimeGate.tsx

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -329,20 +329,6 @@ async function probeCloudAgentReachable(
329329
}
330330
}
331331

332-
function readCloudControlToken(): string | undefined {
333-
if (typeof globalThis === "undefined") return undefined;
334-
const globalToken = (
335-
globalThis as typeof globalThis & {
336-
__ELIZA_CLOUD_AUTH_TOKEN__?: unknown;
337-
}
338-
).__ELIZA_CLOUD_AUTH_TOKEN__;
339-
if (typeof globalToken === "string" && globalToken.trim()) {
340-
return globalToken.trim();
341-
}
342-
343-
return client.getRestAuthToken()?.trim() || undefined;
344-
}
345-
346332
// TODO: replace with real onboarding artwork per runtime choice
347333
// const CHOICE_IMAGE_PATH: Record<RuntimeChoice, string> = {
348334
// cloud: "app-heroes/agentDOD.png",
@@ -600,21 +586,16 @@ export function RuntimeGate() {
600586
label = launchRes.data.agentName;
601587
}
602588
} catch (err) {
603-
const controlToken = readCloudControlToken();
604-
if (controlToken?.startsWith("agent_")) {
605-
accessToken = controlToken;
606-
} else {
607-
setError(
608-
displayErrorMessage(
609-
err,
610-
t("runtimegate.cloudLaunchFailed", {
611-
defaultValue: "Cloud agent launch failed. Please retry.",
612-
}),
613-
),
614-
);
615-
setCloudStage("retry");
616-
return;
617-
}
589+
setError(
590+
displayErrorMessage(
591+
err,
592+
t("runtimegate.cloudLaunchFailed", {
593+
defaultValue: "Cloud agent launch failed. Please retry.",
594+
}),
595+
),
596+
);
597+
setCloudStage("retry");
598+
return;
618599
}
619600

620601
savePersistedActiveServer({

packages/ui/src/desktop-runtime/AppWindowRenderer.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* The renderer never mounts the main shell (sidebars, header, chat panes).
1010
*/
1111

12-
import { InventoryView } from "@elizaos/app-wallet";
1312
import {
1413
type JSX,
1514
Suspense,
@@ -18,6 +17,7 @@ import {
1817
useRef,
1918
useState,
2019
} from "react";
20+
import { listAppShellPages } from "../app-shell-registry";
2121
import {
2222
type AppLaunchResult,
2323
type AppRunSummary,
@@ -85,6 +85,17 @@ function AppWindowSuspense({
8585
);
8686
}
8787

88+
function RegisteredWalletInventoryView(): JSX.Element {
89+
const registration = listAppShellPages().find(
90+
(entry) => entry.id === "wallet.inventory" || entry.path === "/inventory",
91+
);
92+
if (!registration) {
93+
return <AppWindowError message="Wallet is not registered in this build." />;
94+
}
95+
const Component = registration.Component;
96+
return <Component />;
97+
}
98+
8899
/** Render a built-in tab component bare (no chat pane / sidebar). */
89100
function renderInternalToolTab(tab: Tab): JSX.Element | null {
90101
switch (tab) {
@@ -108,7 +119,7 @@ function renderInternalToolTab(tab: Tab): JSX.Element | null {
108119
case "advanced":
109120
return <FineTuningView />;
110121
case "inventory":
111-
return <InventoryView />;
122+
return <RegisteredWalletInventoryView />;
112123
case "tasks":
113124
return <TasksPageView />;
114125
case "chat":

0 commit comments

Comments
 (0)