feat: manually mirror opencoze's code from bytedance
Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
This commit is contained in:
31
frontend/packages/agent-ide/tool-config/.storybook/main.js
Normal file
31
frontend/packages/agent-ide/tool-config/.storybook/main.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import { mergeConfig } from 'vite';
|
||||
import svgr from 'vite-plugin-svgr';
|
||||
|
||||
/** @type { import('@storybook/react-vite').StorybookConfig } */
|
||||
const config = {
|
||||
stories: ['../stories/**/*.mdx', '../stories/**/*.stories.tsx'],
|
||||
addons: [
|
||||
'@storybook/addon-links',
|
||||
'@storybook/addon-essentials',
|
||||
'@storybook/addon-onboarding',
|
||||
'@storybook/addon-interactions',
|
||||
],
|
||||
framework: {
|
||||
name: '@storybook/react-vite',
|
||||
options: {},
|
||||
},
|
||||
docs: {
|
||||
autodocs: 'tag',
|
||||
},
|
||||
viteFinal: config =>
|
||||
mergeConfig(config, {
|
||||
plugins: [
|
||||
svgr({
|
||||
svgrOptions: {
|
||||
native: false,
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
};
|
||||
export default config;
|
||||
@@ -0,0 +1,14 @@
|
||||
/** @type { import('@storybook/react').Preview } */
|
||||
const preview = {
|
||||
parameters: {
|
||||
actions: { argTypesRegex: "^on[A-Z].*" },
|
||||
controls: {
|
||||
matchers: {
|
||||
color: /(background|color)$/i,
|
||||
date: /Date$/i,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default preview;
|
||||
5
frontend/packages/agent-ide/tool-config/.stylelintrc.js
Normal file
5
frontend/packages/agent-ide/tool-config/.stylelintrc.js
Normal file
@@ -0,0 +1,5 @@
|
||||
const { defineConfig } = require('@coze-arch/stylelint-config');
|
||||
|
||||
module.exports = defineConfig({
|
||||
extends: [],
|
||||
});
|
||||
8
frontend/packages/agent-ide/tool-config/README.md
Normal file
8
frontend/packages/agent-ide/tool-config/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# @coze-agent-ide/tool-config
|
||||
Tool 区域配置文件
|
||||
|
||||
## Features
|
||||
|
||||
- 新接入的 tool,需要在 types 文件中新增枚举值
|
||||
- 新接入的 tool,需要在 constants 文件中配置 TOOL_KEY_STORE_MAP、AGENT_SKILL_KEY_MAP,用于为 ToolKey 和 /api/draftbot/update 接口的入参字段名做映射
|
||||
- 新接入的 tool,需要在 constants 文件中配置 TOOL_KEY_TO_API_STATUS_KEY_MAP,用于为 ToolKey 和 /api/draftbot/update_display_info 接口的字段名做映射
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* 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 { describe, expect, it } from 'vitest';
|
||||
import { ToolType } from '@coze-arch/bot-api/playground_api';
|
||||
import type { ShortcutCommand } from '@coze-arch/bot-api/playground_api';
|
||||
|
||||
import { getStrictShortcuts } from '../../src/shortcut-config/get-strict-shortcuts';
|
||||
|
||||
describe('getStrictShortcuts', () => {
|
||||
it('should return undefined when shortcuts is undefined', () => {
|
||||
expect(getStrictShortcuts(undefined)).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should filter out shortcuts without command_id', () => {
|
||||
const shortcuts: Partial<ShortcutCommand>[] = [
|
||||
{
|
||||
command_id: '1',
|
||||
tool_type: ToolType.ToolTypeWorkFlow,
|
||||
plugin_id: 'plugin1',
|
||||
},
|
||||
{
|
||||
// 没有 command_id
|
||||
tool_type: ToolType.ToolTypeWorkFlow,
|
||||
plugin_id: 'plugin2',
|
||||
},
|
||||
];
|
||||
|
||||
const result = getStrictShortcuts(shortcuts);
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result?.[0].command_id).toBe('1');
|
||||
});
|
||||
|
||||
it('should filter out workflow shortcuts without plugin_id', () => {
|
||||
const shortcuts: Partial<ShortcutCommand>[] = [
|
||||
{
|
||||
command_id: '1',
|
||||
tool_type: ToolType.ToolTypeWorkFlow,
|
||||
plugin_id: 'plugin1',
|
||||
},
|
||||
{
|
||||
command_id: '2',
|
||||
tool_type: ToolType.ToolTypeWorkFlow,
|
||||
// 没有 plugin_id
|
||||
},
|
||||
];
|
||||
|
||||
const result = getStrictShortcuts(shortcuts);
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result?.[0].command_id).toBe('1');
|
||||
});
|
||||
|
||||
it('should filter out plugin shortcuts without plugin_id', () => {
|
||||
const shortcuts: Partial<ShortcutCommand>[] = [
|
||||
{
|
||||
command_id: '1',
|
||||
tool_type: ToolType.ToolTypePlugin,
|
||||
plugin_id: 'plugin1',
|
||||
},
|
||||
{
|
||||
command_id: '2',
|
||||
tool_type: ToolType.ToolTypePlugin,
|
||||
// 没有 plugin_id
|
||||
},
|
||||
];
|
||||
|
||||
const result = getStrictShortcuts(shortcuts);
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result?.[0].command_id).toBe('1');
|
||||
});
|
||||
|
||||
it('should keep valid shortcuts', () => {
|
||||
const shortcuts: Partial<ShortcutCommand>[] = [
|
||||
{
|
||||
command_id: '1',
|
||||
tool_type: ToolType.ToolTypeWorkFlow,
|
||||
plugin_id: 'plugin1',
|
||||
},
|
||||
{
|
||||
command_id: '2',
|
||||
tool_type: ToolType.ToolTypePlugin,
|
||||
plugin_id: 'plugin2',
|
||||
},
|
||||
{
|
||||
command_id: '3',
|
||||
// 使用其他工具类型
|
||||
tool_type: ToolType.ToolTypeNone,
|
||||
},
|
||||
];
|
||||
|
||||
const result = getStrictShortcuts(shortcuts);
|
||||
expect(result).toHaveLength(3);
|
||||
expect(result?.map(item => item.command_id)).toEqual(['1', '2', '3']);
|
||||
});
|
||||
|
||||
it('should handle empty array', () => {
|
||||
const shortcuts: Partial<ShortcutCommand>[] = [];
|
||||
const result = getStrictShortcuts(shortcuts);
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"operationSettings": [
|
||||
{
|
||||
"operationName": "test:cov",
|
||||
"outputFolderNames": ["coverage"]
|
||||
},
|
||||
{
|
||||
"operationName": "ts-check",
|
||||
"outputFolderNames": ["./dist"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"codecov": {
|
||||
"coverage": 0,
|
||||
"incrementCoverage": 0
|
||||
}
|
||||
}
|
||||
7
frontend/packages/agent-ide/tool-config/eslint.config.js
Normal file
7
frontend/packages/agent-ide/tool-config/eslint.config.js
Normal file
@@ -0,0 +1,7 @@
|
||||
const { defineConfig } = require('@coze-arch/eslint-config');
|
||||
|
||||
module.exports = defineConfig({
|
||||
packageRoot: __dirname,
|
||||
preset: 'web',
|
||||
rules: {},
|
||||
});
|
||||
42
frontend/packages/agent-ide/tool-config/package.json
Normal file
42
frontend/packages/agent-ide/tool-config/package.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "@coze-agent-ide/tool-config",
|
||||
"version": "0.0.1",
|
||||
"description": "tool core ",
|
||||
"license": "Apache-2.0",
|
||||
"author": "jinhui.0617@bytedance.com",
|
||||
"maintainers": [],
|
||||
"main": "src/index.tsx",
|
||||
"scripts": {
|
||||
"build": "exit 0",
|
||||
"lint": "eslint ./ --cache",
|
||||
"test": "vitest --run --passWithNoTests",
|
||||
"test:cov": "npm run test -- --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@coze-arch/bot-api": "workspace:*",
|
||||
"classnames": "^2.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@coze-arch/bot-typings": "workspace:*",
|
||||
"@coze-arch/eslint-config": "workspace:*",
|
||||
"@coze-arch/stylelint-config": "workspace:*",
|
||||
"@coze-arch/ts-config": "workspace:*",
|
||||
"@coze-arch/vitest-config": "workspace:*",
|
||||
"@testing-library/jest-dom": "^6.1.5",
|
||||
"@testing-library/react": "^14.1.2",
|
||||
"@testing-library/react-hooks": "^8.0.1",
|
||||
"@types/react": "18.2.37",
|
||||
"@types/react-dom": "18.2.15",
|
||||
"@vitest/coverage-v8": "~3.0.5",
|
||||
"react": "~18.2.0",
|
||||
"react-dom": "~18.2.0",
|
||||
"stylelint": "^15.11.0",
|
||||
"vite-plugin-svgr": "~3.3.0",
|
||||
"vitest": "~3.0.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=18.2.0",
|
||||
"react-dom": ">=18.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
65
frontend/packages/agent-ide/tool-config/src/constants.ts
Normal file
65
frontend/packages/agent-ide/tool-config/src/constants.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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 TabDisplayItems } from '@coze-arch/bot-api/developer_api';
|
||||
|
||||
import { ToolKey, AgentSkillKey, ToolGroupKey } from './types';
|
||||
|
||||
export const TOOL_KEY_STORE_MAP = {
|
||||
[ToolKey.PLUGIN]: 'pluginApis',
|
||||
[ToolKey.SHORTCUT]: 'shortcut',
|
||||
[ToolKey.DEV_HOOKS]: 'devHooks',
|
||||
};
|
||||
|
||||
export const AGENT_SKILL_KEY_MAP = {
|
||||
[AgentSkillKey.PLUGIN]: 'pluginApis',
|
||||
};
|
||||
|
||||
export const TOOL_KEY_TO_API_STATUS_KEY_MAP: {
|
||||
[key in ToolKey]: keyof TabDisplayItems;
|
||||
} = {
|
||||
[ToolKey.PLUGIN]: 'plugin_tab_status',
|
||||
[ToolKey.WORKFLOW]: 'workflow_tab_status',
|
||||
[ToolKey.IMAGEFLOW]: 'imageflow_tab_status',
|
||||
[ToolKey.DATABASE]: 'database_tab_status',
|
||||
[ToolKey.FILE_BOX]: 'filebox_tab_status',
|
||||
[ToolKey.KNOWLEDGE]: 'knowledge_tab_status',
|
||||
[ToolKey.ONBOARDING]: 'opening_dialog_tab_status',
|
||||
[ToolKey.SUGGEST]: 'suggestion_tab_status',
|
||||
[ToolKey.TRIGGER]: 'scheduled_task_tab_status',
|
||||
[ToolKey.VARIABLE]: 'variable_tab_status',
|
||||
[ToolKey.VOICE]: 'tts_tab_status',
|
||||
[ToolKey.LONG_TERM_MEMORY]: 'long_term_memory_tab_status',
|
||||
[ToolKey.BACKGROUND]: 'background_image_tab_status',
|
||||
[ToolKey.TABLE]: 'knowledge_table_tab_status',
|
||||
[ToolKey.DOCUMENT]: 'knowledge_text_tab_status',
|
||||
[ToolKey.PHOTO]: 'knowledge_photo_tab_status',
|
||||
[ToolKey.SHORTCUT]: 'shortcut_tab_status',
|
||||
[ToolKey.DEV_HOOKS]: 'hook_info_tab_status',
|
||||
[ToolKey.USER_INPUT]: 'default_user_input_tab_status',
|
||||
};
|
||||
|
||||
/**
|
||||
* 这里的顺序 决定展示的顺序 请注意
|
||||
*/
|
||||
export const TOOL_GROUP_CONFIG = {
|
||||
[ToolGroupKey.SKILL]: 'Skill',
|
||||
[ToolGroupKey.KNOWLEDGE]: 'Knowledge',
|
||||
[ToolGroupKey.MEMORY]: 'Memory',
|
||||
[ToolGroupKey.DIALOG]: 'Dialog',
|
||||
[ToolGroupKey.CHARACTER]: 'Character',
|
||||
[ToolGroupKey.HOOKS]: 'Hooks',
|
||||
};
|
||||
39
frontend/packages/agent-ide/tool-config/src/index.tsx
Normal file
39
frontend/packages/agent-ide/tool-config/src/index.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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 {
|
||||
AbilityScope,
|
||||
ToolKey,
|
||||
AgentSkillKey,
|
||||
AgentModalTabKey,
|
||||
AbilityKey,
|
||||
ToolGroupKey,
|
||||
SkillKeyEnum,
|
||||
} from './types';
|
||||
export {
|
||||
TOOL_KEY_STORE_MAP,
|
||||
AGENT_SKILL_KEY_MAP,
|
||||
TOOL_KEY_TO_API_STATUS_KEY_MAP,
|
||||
TOOL_GROUP_CONFIG,
|
||||
} from './constants';
|
||||
export {
|
||||
ShortCutCommand,
|
||||
TemplateShortCutForWorkFlow,
|
||||
QueryShortCut,
|
||||
TemplateShortCutForPlugin,
|
||||
} from './shortcut-config/type';
|
||||
export { getStrictShortcuts } from './shortcut-config/get-strict-shortcuts';
|
||||
export { ShortCutStruct } from './shortcut-config/type';
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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 ShortcutCommand as ShortcutCommandFromService,
|
||||
ToolType,
|
||||
} from '@coze-arch/bot-api/playground_api';
|
||||
|
||||
import type { ShortCutCommand } from './type';
|
||||
|
||||
export function getStrictShortcuts(shortcuts?: ShortcutCommandFromService[]) {
|
||||
return shortcuts?.filter((shortcut): shortcut is ShortCutCommand => {
|
||||
const { tool_type } = shortcut;
|
||||
const withoutCommandId = !shortcut.command_id;
|
||||
// const panelWithoutCardSchema =
|
||||
// send_type === SendType.SendTypePanel && !shortcut.card_schema;
|
||||
const workflowWithoutWorkflowId =
|
||||
tool_type === ToolType.ToolTypeWorkFlow && !shortcut.plugin_id;
|
||||
const pluginWithoutPluginId =
|
||||
tool_type === ToolType.ToolTypePlugin && !shortcut.plugin_id;
|
||||
|
||||
return !(
|
||||
withoutCommandId ||
|
||||
// panelWithoutCardSchema ||
|
||||
workflowWithoutWorkflowId ||
|
||||
pluginWithoutPluginId
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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 {
|
||||
SendType,
|
||||
ShortcutCommand as ShortcutCommandFromService,
|
||||
ToolType,
|
||||
ShortcutStruct as ShortcutStructFromService,
|
||||
} from '@coze-arch/bot-api/playground_api';
|
||||
|
||||
export type ShortCutStruct = Pick<
|
||||
ShortcutStructFromService,
|
||||
'shortcut_sort'
|
||||
> & {
|
||||
shortcut_list?: ShortCutCommand[];
|
||||
};
|
||||
|
||||
export type ShortCutCommand =
|
||||
| TemplateShortCutForWorkFlow
|
||||
| TemplateShortCutForPlugin
|
||||
| QueryShortCut;
|
||||
|
||||
type BaseShortCutInfo = Pick<
|
||||
ShortcutCommandFromService,
|
||||
'command_name' | 'template_query' | 'description' | 'send_type'
|
||||
> & {
|
||||
command_id: string;
|
||||
object_id: string;
|
||||
bot_info: {
|
||||
icon_url?: string;
|
||||
name?: string;
|
||||
};
|
||||
};
|
||||
|
||||
type WorkflowTool = Pick<
|
||||
ShortcutCommandFromService,
|
||||
'tool_type' | 'work_flow_id'
|
||||
> & {
|
||||
tool_type: ToolType.ToolTypeWorkFlow;
|
||||
work_flow_id: string;
|
||||
};
|
||||
|
||||
type PluginTool = Pick<
|
||||
ShortcutCommandFromService,
|
||||
'tool_type' | 'plugin_id' | 'plugin_api_name'
|
||||
> & {
|
||||
tool_type: ToolType.ToolTypePlugin;
|
||||
plugin_id: string;
|
||||
plugin_api_name: string;
|
||||
plugin_api_id: string;
|
||||
};
|
||||
|
||||
export type TemplateShortCutForWorkFlow = BaseShortCutInfo &
|
||||
Omit<
|
||||
ShortcutCommandFromService,
|
||||
'send_type' | 'tool_type' | 'work_flow_id' | 'components_list'
|
||||
> & {
|
||||
send_type: SendType.SendTypePanel;
|
||||
} & {
|
||||
components_list: ShortcutCommandFromService['components_list'];
|
||||
} & WorkflowTool;
|
||||
|
||||
export type TemplateShortCutForPlugin = BaseShortCutInfo &
|
||||
Omit<
|
||||
ShortcutCommandFromService,
|
||||
'send_type' | 'tool_type' | 'plugin_id' | 'plugin_api_name'
|
||||
> & {
|
||||
send_type: SendType.SendTypePanel;
|
||||
} & {
|
||||
components_list: ShortcutCommandFromService['components_list'];
|
||||
} & PluginTool;
|
||||
|
||||
export type QueryShortCut = BaseShortCutInfo &
|
||||
Omit<ShortcutCommandFromService, 'send_type'> & {
|
||||
send_type: SendType.SendTypeQuery;
|
||||
};
|
||||
91
frontend/packages/agent-ide/tool-config/src/types.ts
Normal file
91
frontend/packages/agent-ide/tool-config/src/types.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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 enum AbilityScope {
|
||||
TOOL = 'tool',
|
||||
AGENT_SKILL = 'agentSkill',
|
||||
}
|
||||
|
||||
export type AbilityKey = ToolKey | AgentSkillKey;
|
||||
|
||||
/**
|
||||
* ToolKey为了项目临时给大家起了一个名称,如果觉得名称不好可以全局替换一下
|
||||
*/
|
||||
export const enum ToolKey {
|
||||
PLUGIN = 'plugin',
|
||||
WORKFLOW = 'workflow',
|
||||
IMAGEFLOW = 'imageflow',
|
||||
KNOWLEDGE = 'knowledge',
|
||||
VARIABLE = 'variable',
|
||||
DATABASE = 'database',
|
||||
LONG_TERM_MEMORY = 'longTermMemory',
|
||||
FILE_BOX = 'fileBox',
|
||||
TRIGGER = 'trigger',
|
||||
ONBOARDING = 'onboarding',
|
||||
SUGGEST = 'suggest',
|
||||
VOICE = 'voice',
|
||||
BACKGROUND = 'background',
|
||||
DOCUMENT = 'document',
|
||||
TABLE = 'table',
|
||||
PHOTO = 'photo',
|
||||
SHORTCUT = 'shortcut',
|
||||
DEV_HOOKS = 'devHooks',
|
||||
USER_INPUT = 'userInput',
|
||||
}
|
||||
|
||||
export const enum AgentSkillKey {
|
||||
PLUGIN = 'plugin',
|
||||
WORKFLOW = 'workflow',
|
||||
KNOWLEDGE = 'knowledge',
|
||||
}
|
||||
|
||||
export const enum AgentModalTabKey {
|
||||
TOOLS = 'tools',
|
||||
WORKFLOW = 'workflow',
|
||||
DATASETS = 'datasets',
|
||||
}
|
||||
|
||||
export const enum ToolGroupKey {
|
||||
SKILL = 'skill',
|
||||
KNOWLEDGE = 'knowledge',
|
||||
MEMORY = 'memory',
|
||||
DIALOG = 'dialog',
|
||||
HOOKS = 'hooks',
|
||||
CHARACTER = 'character',
|
||||
}
|
||||
|
||||
/**
|
||||
* 模块主键
|
||||
* @deprecated 该使用方式已废弃, 请使用: `import { ToolKey } from '@coze-agent-ide/tool-config'`;
|
||||
*/
|
||||
export enum SkillKeyEnum {
|
||||
/** Skills */
|
||||
PLUGIN_API_BLOCK = 'plugin',
|
||||
WORKFLOW_BLOCK = 'workflow',
|
||||
IMAGE_BLOCK = 'imageflow',
|
||||
/** Memory */
|
||||
DATA_SET_BLOCK = 'knowledge',
|
||||
DATA_MEMORY_BLOCK = 'variable',
|
||||
TABLE_MEMORY_BLOCK = 'database',
|
||||
TIME_CAPSULE_BLOCK = 'time_capsule',
|
||||
FILEBOX_BLOCK = 'filebox',
|
||||
/** Advanced */
|
||||
TASK_MANAGE_BLOCK = 'scheduled_task',
|
||||
ONBORDING_MESSAGE_BLOCK = 'opening_dialog',
|
||||
AUTO_SUGGESTION = 'suggestion',
|
||||
TEXT_TO_SPEECH = 'tts',
|
||||
BACKGROUND_IMAGE_BLOCK = 'background_image',
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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 { DemoComponent } from '../src';
|
||||
|
||||
export default {
|
||||
title: 'Example/Demo',
|
||||
component: DemoComponent,
|
||||
parameters: {
|
||||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
||||
layout: 'centered',
|
||||
},
|
||||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
||||
tags: ['autodocs'],
|
||||
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
||||
argTypes: {},
|
||||
};
|
||||
|
||||
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
||||
export const Base = {
|
||||
args: {
|
||||
name: 'tecvan',
|
||||
},
|
||||
};
|
||||
34
frontend/packages/agent-ide/tool-config/stories/hello.mdx
Normal file
34
frontend/packages/agent-ide/tool-config/stories/hello.mdx
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Meta } from "@storybook/blocks";
|
||||
|
||||
<Meta title="Hello world" />
|
||||
|
||||
<div className="sb-container">
|
||||
<div className='sb-section-title'>
|
||||
# Hello world
|
||||
|
||||
Hello world
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
{`
|
||||
.sb-container {
|
||||
margin-bottom: 48px;
|
||||
}
|
||||
|
||||
.sb-section {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
img {
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.sb-section-title {
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
33
frontend/packages/agent-ide/tool-config/tsconfig.build.json
Normal file
33
frontend/packages/agent-ide/tool-config/tsconfig.build.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"extends": "@coze-arch/ts-config/tsconfig.web.json",
|
||||
"compilerOptions": {
|
||||
"types": [],
|
||||
"strictNullChecks": true,
|
||||
"noImplicitAny": true,
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist",
|
||||
"tsBuildInfoFile": "dist/tsconfig.build.tsbuildinfo"
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../arch/bot-api/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../../arch/bot-typings/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../../../config/eslint-config/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../../../config/stylelint-config/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../../../config/ts-config/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../../../config/vitest-config/tsconfig.build.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
15
frontend/packages/agent-ide/tool-config/tsconfig.json
Normal file
15
frontend/packages/agent-ide/tool-config/tsconfig.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"compilerOptions": {
|
||||
"composite": true
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.misc.json"
|
||||
}
|
||||
],
|
||||
"exclude": ["**/*"]
|
||||
}
|
||||
18
frontend/packages/agent-ide/tool-config/tsconfig.misc.json
Normal file
18
frontend/packages/agent-ide/tool-config/tsconfig.misc.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": "@coze-arch/ts-config/tsconfig.web.json",
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"include": ["__tests__", "stories", "vitest.config.ts", "tailwind.config.ts"],
|
||||
"exclude": ["./dist"],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.build.json"
|
||||
}
|
||||
],
|
||||
"compilerOptions": {
|
||||
"rootDir": "./",
|
||||
"outDir": "./dist",
|
||||
"types": ["vitest/globals"],
|
||||
"strictNullChecks": true,
|
||||
"noImplicitAny": true
|
||||
}
|
||||
}
|
||||
22
frontend/packages/agent-ide/tool-config/vitest.config.ts
Normal file
22
frontend/packages/agent-ide/tool-config/vitest.config.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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 { defineConfig } from '@coze-arch/vitest-config';
|
||||
|
||||
export default defineConfig({
|
||||
dirname: __dirname,
|
||||
preset: 'web',
|
||||
});
|
||||
Reference in New Issue
Block a user