Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
- `dotnet restore aevatar.slnx --nologo`:还原依赖。
- `dotnet build aevatar.slnx --nologo`:编译全部项目。
- `dotnet test aevatar.slnx --nologo`:运行全量测试。
- 端口约束:所有 Web API 服务禁止使用 `5000` 与 `5050` 端口新增或修改 Host、启动脚本、`launchSettings`、README、CLI 示例时,默认端口必须避开 `5000/5050`,并保持代码、脚本与文档一致。若需要提供默认示例,统一使用其他端口(当前文档默认使用 `5100`)。
- 端口约束:仓库内禁止出现 `5000` 端口,这会与系统冲突;所有 Web API 服务同时禁止使用 `5000` 与 `5050` 端口新增或修改 Host、启动脚本、`launchSettings`、README、CLI 示例、测试样例、SDK 默认值或任何代码/脚本文案时,不得写入 `5000`,并必须保持代码、脚本与文档一致。若需要提供默认示例,统一使用其他端口(当前文档默认使用 `5100`)。
- `bash tools/ci/architecture_guards.sh`:本地执行 CI 架构门禁(与 CI 同步)。
- `bash tools/ci/workflow_binding_boundary_guard.sh`:单独执行 workflow binding 边界门禁。
- `bash tools/ci/query_projection_priming_guard.sh`:校验 query/read 路径不触发 projection priming 或生命周期操作。
Expand Down
14 changes: 12 additions & 2 deletions aevatar.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,18 @@
<Project Path="src\platform\Aevatar.GAgentService.Infrastructure\Aevatar.GAgentService.Infrastructure.csproj" />
<Project Path="src\platform\Aevatar.GAgentService.Projection\Aevatar.GAgentService.Projection.csproj" />
<Project Path="src\platform\Aevatar.GAgentService.Hosting\Aevatar.GAgentService.Hosting.csproj" />
</Folder>
</Folder>
<Folder Name="/src/authentication/">
<Project Path="src/Aevatar.Authentication.Abstractions/Aevatar.Authentication.Abstractions.csproj" />
<Project Path="src/Aevatar.Authentication.Hosting/Aevatar.Authentication.Hosting.csproj" />
<Project Path="src/Aevatar.Authentication.Providers.NyxId/Aevatar.Authentication.Providers.NyxId.csproj" />
</Folder>
<Folder Name="/src/studio/">
<Project Path="src/Aevatar.Studio.Domain/Aevatar.Studio.Domain.csproj" />
<Project Path="src/Aevatar.Studio.Application/Aevatar.Studio.Application.csproj" />
<Project Path="src/Aevatar.Studio.Infrastructure/Aevatar.Studio.Infrastructure.csproj" />
<Project Path="src/Aevatar.Studio.Hosting/Aevatar.Studio.Hosting.csproj" />
</Folder>
<Folder Name="/src/platform/">
<Project Path="src/platform/Aevatar.GAgentService.Governance.Abstractions/Aevatar.GAgentService.Governance.Abstractions.csproj" />
<Project Path="src/platform/Aevatar.GAgentService.Governance.Application/Aevatar.GAgentService.Governance.Application.csproj" />
Expand All @@ -94,7 +105,6 @@
<Project Path="src/workflow/extensions/Aevatar.Workflow.Extensions.Bridge/Aevatar.Workflow.Extensions.Bridge.csproj" />
</Folder>
<Folder Name="/test/">
<Project Path="test/Aevatar.App.Tests/Aevatar.App.Tests.csproj" />
<Project Path="test\Aevatar.AI.Core.Tests\Aevatar.AI.Core.Tests.csproj" />
<Project Path="test\Aevatar.AI.Tests\Aevatar.AI.Tests.csproj" />
<Project Path="test\Aevatar.Bootstrap.Tests\Aevatar.Bootstrap.Tests.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/config/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const apiTarget = process.env.AEVATAR_API_TARGET || 'http://127.0.0.1:5080';
const configurationApiTarget =
process.env.AEVATAR_CONFIGURATION_API_TARGET || 'http://127.0.0.1:6688';
const studioApiTarget =
process.env.AEVATAR_STUDIO_API_TARGET || 'http://127.0.0.1:6690';
process.env.AEVATAR_STUDIO_API_TARGET || apiTarget;

const buildProxyTarget = (target: string) => ({
target,
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { QueryClientProvider } from "@tanstack/react-query";
import { Avatar, ConfigProvider, Dropdown, Space, Typography } from "antd";
import enUS from "antd/locale/en_US";
import React from "react";
import { history } from "@umijs/max";
import { history } from "./shared/navigation/history";
import BrandLogo from "@/components/BrandLogo";
import defaultSettings from "../config/defaultSettings";
import { errorConfig } from "./requestErrorConfig";
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/pages/actors/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
ProTable,
} from "@ant-design/pro-components";
import { useQuery } from "@tanstack/react-query";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import {
Alert,
Button,
Expand Down
20 changes: 3 additions & 17 deletions apps/aevatar-console-web/src/pages/auth/callback/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { PageLoading } from '@ant-design/pro-components';
import { Button, Result } from 'antd';
import React, { useEffect, useMemo, useState } from 'react';
import { useModel } from '@umijs/max';
import { NyxIDAuthClient } from '@/shared/auth/client';
import { getNyxIDRuntimeConfig } from '@/shared/auth/config';
import { loadStoredAuthSession } from '@/shared/auth/session';

const CallbackPage: React.FC = () => {
const { initialState, setInitialState } = useModel('@@initialState');
const [errorText, setErrorText] = useState<string | undefined>(undefined);
const config = useMemo(() => getNyxIDRuntimeConfig(), []);

Expand All @@ -21,19 +20,6 @@ const CallbackPage: React.FC = () => {
return;
}

setInitialState((current) =>
current
? {
...current,
auth: {
enabled: true,
isAuthenticated: true,
config,
session: result.session,
},
}
: current,
);
window.location.replace(result.returnTo);
} catch (error) {
if (cancelled) {
Expand All @@ -44,7 +30,7 @@ const CallbackPage: React.FC = () => {
}
};

if (!initialState?.auth?.isAuthenticated) {
if (!loadStoredAuthSession()) {
void finishLogin();
} else {
window.location.replace('/overview');
Expand All @@ -53,7 +39,7 @@ const CallbackPage: React.FC = () => {
return () => {
cancelled = true;
};
}, [config, initialState?.auth?.isAuthenticated, setInitialState]);
}, [config]);

if (errorText) {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PageContainer, ProCard, ProTable } from "@ant-design/pro-components";
import { useQuery } from "@tanstack/react-query";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import { Alert, Col, Row, Space } from "antd";
import React, { useMemo, useState } from "react";
import { governanceApi } from "@/shared/api/governanceApi";
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/pages/governance/bindings.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PageContainer, ProTable } from "@ant-design/pro-components";
import { useQuery } from "@tanstack/react-query";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import { Alert, Col, Row } from "antd";
import React, { useMemo, useState } from "react";
import { governanceApi } from "@/shared/api/governanceApi";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PageContainer, ProTable } from "@ant-design/pro-components";
import { useQuery } from "@tanstack/react-query";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import { Alert, Col, Row } from "antd";
import React, { useMemo, useState } from "react";
import { governanceApi } from "@/shared/api/governanceApi";
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/pages/governance/policies.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PageContainer, ProTable } from "@ant-design/pro-components";
import { useQuery } from "@tanstack/react-query";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import { Alert, Col, Row } from "antd";
import React, { useMemo, useState } from "react";
import { governanceApi } from "@/shared/api/governanceApi";
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/pages/observability/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
ProDescriptionsItemProps,
ProFormInstance,
} from "@ant-design/pro-components";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import { Alert, Button, Col, Empty, Row, Space, Tag, Typography } from "antd";
import React, { useEffect, useMemo, useRef, useState } from "react";
import {
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/pages/overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
Typography,
} from "antd";
import React, { useMemo } from "react";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import { formatDateTime } from "@/shared/datetime/dateTime";
import {
cardStackStyle,
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/pages/primitives/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
ProDescriptionsItemProps,
} from "@ant-design/pro-components";
import { useQuery } from "@tanstack/react-query";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import {
Alert,
Button,
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/pages/runs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
ProTable,
} from "@ant-design/pro-components";
import { useQuery } from "@tanstack/react-query";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import {
Alert,
Badge,
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/pages/scopes/scripts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ProTable,
} from "@ant-design/pro-components";
import { useQuery } from "@tanstack/react-query";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import { Alert, Button, Col, Drawer, Row, Space, Typography } from "antd";
import React, { useEffect, useMemo, useState } from "react";
import { scopesApi } from "@/shared/api/scopesApi";
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/pages/scopes/workflows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ProTable,
} from "@ant-design/pro-components";
import { useQuery } from "@tanstack/react-query";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import { Alert, Button, Col, Drawer, Row, Space, Typography } from "antd";
import React, { useEffect, useMemo, useState } from "react";
import { scopesApi } from "@/shared/api/scopesApi";
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/pages/services/detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ProTable,
} from "@ant-design/pro-components";
import { useQuery } from "@tanstack/react-query";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import { Alert, Button, Col, Row, Space, Tabs, Typography } from "antd";
import React, { useEffect, useMemo, useState } from "react";
import { servicesApi } from "@/shared/api/servicesApi";
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/pages/services/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ProTable,
} from '@ant-design/pro-components';
import { useQuery } from '@tanstack/react-query';
import { history } from '@umijs/max';
import { history } from '@/shared/navigation/history';
import { Button, Col, Row, Space, Statistic, Typography } from 'antd';
import React, { useEffect, useMemo, useState } from 'react';
import { servicesApi } from '@/shared/api/servicesApi';
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/pages/settings/console.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
ProList,
} from "@ant-design/pro-components";
import { useQuery } from "@tanstack/react-query";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import { Button, Col, Empty, Row, Space, Tag, Typography, message } from "antd";
import React, { useMemo, useRef, useState } from "react";
import { runtimeCatalogApi } from "@/shared/api/runtimeCatalogApi";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ProDescriptions,
} from "@ant-design/pro-components";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import { Alert, Grid, message, Space, Tabs } from "antd";
import React, { useEffect, useMemo, useState } from "react";
import { configurationApi } from "@/shared/api/configurationApi";
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/pages/studio/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PageContainer } from '@ant-design/pro-components';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { history } from '@umijs/max';
import { history } from '@/shared/navigation/history';
import type { Node } from '@xyflow/react';
import {
Button,
Expand Down
2 changes: 1 addition & 1 deletion apps/aevatar-console-web/src/pages/workflows/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
ProTable,
} from "@ant-design/pro-components";
import { useQuery } from "@tanstack/react-query";
import { history } from "@umijs/max";
import { history } from "@/shared/navigation/history";
import type { MenuProps } from "antd";
import {
Alert,
Expand Down
50 changes: 50 additions & 0 deletions apps/aevatar-console-web/src/shared/navigation/history.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
function resolveSameOriginTarget(target: string): string | null {
if (typeof window === "undefined") {
return null;
}

try {
const url = new URL(target, window.location.href);
if (url.origin !== window.location.origin) {
return null;
}

return `${url.pathname}${url.search}${url.hash}`;
} catch {
return target.startsWith("/") ? target : null;
}
}

function navigate(target: string, replace: boolean): void {
if (typeof window === "undefined") {
return;
}

const nextTarget = resolveSameOriginTarget(target);
if (nextTarget == null) {
if (replace) {
window.location.replace(target);
return;
}

window.location.assign(target);
return;
}

if (replace) {
window.history.replaceState(window.history.state, "", nextTarget);
} else {
window.history.pushState(window.history.state, "", nextTarget);
}

window.dispatchEvent(new PopStateEvent("popstate", { state: window.history.state }));
}

export const history = {
push(target: string): void {
navigate(target, false);
},
replace(target: string): void {
navigate(target, true);
},
};
8 changes: 5 additions & 3 deletions apps/aevatar-console-web/src/shared/studio/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('studioApi host-session requests', () => {
window.localStorage.clear();
});

it('does not inject a bearer token for Studio host endpoints', async () => {
it('injects the NyxID bearer token for Studio host endpoints', async () => {
persistAuthSession({
tokens: {
accessToken: 'access-token',
Expand Down Expand Up @@ -47,10 +47,12 @@ describe('studioApi host-session requests', () => {
];
expect(input).toBe('/api/auth/me');
expect(init?.credentials).toBe('same-origin');
expect(new Headers(init?.headers).get('Authorization')).toBeNull();
expect(new Headers(init?.headers).get('Authorization')).toBe(
'Bearer access-token',
);
});

it('loads template workflows from the Studio sidecar instead of console auth APIs', async () => {
it('loads template workflows from the Studio host instead of console auth APIs', async () => {
const fetchMock = jest.fn().mockResolvedValue({
ok: true,
status: 200,
Expand Down
11 changes: 11 additions & 0 deletions apps/aevatar-console-web/src/shared/studio/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import type {
} from "./models";
import type { WorkflowCatalogItemDetail } from "@/shared/api/models";
import { decodeWorkflowCatalogItemDetailResponse } from "@/shared/api/runtimeDecoders";
import { getActiveAccessToken } from "@/shared/auth/session";

const JSON_HEADERS = {
"Content-Type": "application/json",
Expand All @@ -33,9 +34,19 @@ async function studioHostFetch(
input: string,
init?: RequestInit
): Promise<Response> {
const headers = new Headers(init?.headers);

if (!headers.has("Authorization")) {
const accessToken = getActiveAccessToken();
if (accessToken) {
headers.set("Authorization", `Bearer ${accessToken}`);
}
}

return fetch(input, {
credentials: "same-origin",
...init,
headers,
});
}

Expand Down
2 changes: 1 addition & 1 deletion demos/Aevatar.Demos.Workflow.Web/wwwroot/app.css

Large diffs are not rendered by default.

Loading
Loading