feat: manually mirror opencoze's code from bytedance

Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
This commit is contained in:
fanlv
2025-07-20 17:36:12 +08:00
commit 890153324f
14811 changed files with 1923430 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
/*
* Copyright 2025 coze-dev Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const IS_DEV_MODE =
(process.env.NODE_ENV as 'production' | 'development' | 'test') ===
'development';

View File

@@ -0,0 +1,40 @@
/*
* Copyright 2025 coze-dev Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* 支持筛选的query时间范围
*/
export const DATE_FILTERING_DAYS_NUMBER = 7;
export const FILTERING_OPTION_ALL = 'ALL';
/**
* query每次加载条数
*/
export const FILTERING_LIMIT = 30;
export const TRACES_ADVANCE_INFO_TIME_BUFFER = 1000;
export const TIME_MINUTE = 60;
/**
* query拉取默认偏移量
*/
export const INITIAL_OFFSET = '0';
export const EMPTY_TEXT = '-';
/**
* query拉取防抖时间
*/
export const QUERY_FILTER_DEBOUNCE_TIME = 300;
/**
* 调试台位置信息localStorage key
*/
export const DEBUG_PANEL_LAYOUT_KEY = 'coze_debug_panel_layout_config';

View File

@@ -0,0 +1,53 @@
/*
* Copyright 2025 coze-dev Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
spanCategoryConfigMap,
spanTypeConfigMap,
botEnvConfigMap,
} from '@coze-devops/common-modules/query-trace';
import { IconSuccess, IconError, IconWarningInfo } from '@coze-arch/bot-icons';
import { SpanStatus } from '@coze-arch/bot-api/ob_query_api';
import { type SpanStatusConfig } from '../typings';
export const SPAN_TYPE_CONFIG_MAP = spanTypeConfigMap;
export const SPAN_STATUS_CONFIG_MAP: Record<SpanStatus, SpanStatusConfig> = {
[SpanStatus.Success]: {
icon: <IconSuccess />,
className: 'query-execute-status_success',
label: 'query_status_success',
},
[SpanStatus.Broken]: {
icon: <IconWarningInfo />,
className: 'query-execute-status_broken',
label: 'query_status_broken',
},
[SpanStatus.Error]: {
icon: <IconError />,
className: 'query-execute-status_error',
label: 'query_status_error',
},
[SpanStatus.Unknown]: {
icon: <IconSuccess />,
className: 'query-execute-status_unknown',
label: 'query_status_unknown',
},
};
export const SPAN_CATEGORY_CONFIG_MAP = spanCategoryConfigMap;
export const BOT_ENV_CONFIG_MAP = botEnvConfigMap;

View File

@@ -0,0 +1,118 @@
/*
* Copyright 2025 coze-dev Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type ReactJsonViewProps } from 'react-json-view';
import { TopoType } from '@coze-arch/bot-api/dp_manage_api';
import { SpanStatus } from '@coze-arch/bot-api/debugger_api';
import {
DebugPanelLayout,
type DebugPanelLayoutConfig,
type DebugPanelLayoutTemplateConfig,
type QueryFilterItem,
} from '../typings';
import { FILTERING_OPTION_ALL } from '.';
export const EXECUTE_STATUS_FILTERING_OPTIONS: QueryFilterItem[] = [
{
id: FILTERING_OPTION_ALL,
name: 'query_status_all',
},
{
id: SpanStatus.Error,
name: 'query_status_failed',
},
{
id: SpanStatus.Success,
name: 'query_status_completed',
},
];
export enum GraphTabEnum {
RunTree = 'RunTree',
Flamethread = 'Flamethread',
}
export const DEBUG_PANEL_LAYOUT_DEFAULT_TEMPLATE_INFO: DebugPanelLayoutTemplateConfig =
{
side: {
[DebugPanelLayout.Overall]: {
width: {
min: 400,
max: 800,
},
height: {},
},
[DebugPanelLayout.Summary]: {
width: {},
height: {
min: 8,
max: 150,
},
},
[DebugPanelLayout.Chat]: {
width: {},
height: {
min: 1,
max: 500,
},
},
},
bottom: {
[DebugPanelLayout.Overall]: {
width: {},
height: {},
},
[DebugPanelLayout.Summary]: {
width: {},
height: {},
},
[DebugPanelLayout.Chat]: {
width: {},
height: {},
},
},
};
export const DEBUG_PANEL_LAYOUT_DEFAULT_INFO: DebugPanelLayoutConfig = {
side: {
[DebugPanelLayout.Overall]: 400,
[DebugPanelLayout.Summary]: 124,
[DebugPanelLayout.Chat]: 280,
},
bottom: {
[DebugPanelLayout.Overall]: 0,
[DebugPanelLayout.Summary]: 0,
[DebugPanelLayout.Chat]: 0,
},
};
export const REACT_JSON_VIEW_CONFIG: Partial<ReactJsonViewProps> = {
name: false,
displayDataTypes: false,
indentWidth: 2,
iconStyle: 'triangle',
enableClipboard: false,
collapsed: 5,
collapseStringsAfterLength: 300,
};
export const topologyTypeConfig: Record<TopoType, string> = {
[TopoType.Agent]: 'Agent',
[TopoType.AgentFlow]: 'AgentFlow',
[TopoType.Workflow]: 'Workflow',
};