frontend/packages/arch/idl/README.md
Interface Definition Language (IDL) package providing TypeScript type definitions and API client services for the Coze platform ecosystem.
@coze-arch/idl is a comprehensive package that contains auto-generated TypeScript interfaces, types, and service clients derived from Thrift IDL definitions. It serves as the central type system for the Coze platform, providing strongly-typed API contracts for over 60+ services including bot management, workflow orchestration, plugin systems, evaluation frameworks, and more.
# Install the package
rush update
# Or using workspace protocol
npm install @coze-arch/idl@workspace:*
Import specific service types and clients:
// Import specific service types
import { SuggestReplyMode } from '@coze-arch/idl';
import { TaskType as CopyTaskType } from '@coze-arch/idl';
import { ModelInfo as BotCommonModelInfo } from '@coze-arch/idl';
// Import service-specific types
import * as AppBuilderAPI from '@coze-arch/idl/app_builder';
import * as FornaxAPI from '@coze-arch/idl/fornax_api';
import * as BotConnectorAPI from '@coze-arch/idl/bot_connector';
import AppBuilderService from '@coze-arch/idl/app_builder';
// Initialize service client
const appBuilder = new AppBuilderService({
baseURL: 'https://api.coze.com',
request: async (params, options) => {
// Your HTTP client implementation
return fetch(params.url, {
method: params.method,
headers: params.headers,
body: params.data ? JSON.stringify(params.data) : undefined,
}).then(res => res.json());
}
});
// Use the service
const response = await appBuilder.GetPackage({
package_name: 'my-package',
version_name: '1.0.0'
});
import * as BotAPI from '@coze-arch/idl/bot_open_api';
// Use interface types
const botRequest: BotAPI.CreateBotRequest = {
bot_name: 'My Assistant',
description: 'AI assistant for customer support',
model_config: {
model_id: 'gpt-4',
temperature: 0.7
}
};
// Use enum types
const taskType: BotAPI.TaskType = BotAPI.TaskType.ChatCompletion;
// Use response types
async function createBot(request: BotAPI.CreateBotRequest): Promise<BotAPI.CreateBotResponse> {
// Implementation
}
The package exports 66+ service modules. Key services include:
app_builder - Agent application building and managementbot_open_api - Public bot APIs for external integrationbot_connector - Bot connector managementintelligence_api - Core intelligence and bot runtime servicesfornax_api / fornax_api2 - Workflow orchestration engineworkflow_api - Workflow definition and executionautomation - Automated task executionplugin_develop - Plugin development toolsplugin_operation - Plugin marketplace operationsplugin_impl_api - Plugin implementation APIsknowledge - Knowledge base managementmemory - Conversation memory systemsxmemory_api - Extended memory APIsevaluation_api - Model and bot evaluationevaluation_lite - Lightweight evaluation toolsdevops_evaluation - DevOps integration for evaluationdebugger_api - Debugging and development toolsplayground_api - Testing playground servicesdeveloper_api - Developer platform APIsAll service clients follow a consistent pattern:
class ServiceName<T> {
constructor(options?: {
baseURL?: string | ((path: string) => string);
request?<R>(params: {
url: string;
method: 'GET' | 'DELETE' | 'POST' | 'PUT' | 'PATCH';
data?: any;
params?: any;
headers?: any;
}, options?: T): Promise<R>;
});
// Service methods with typed parameters and responses
MethodName(req: RequestType, options?: T): Promise<ResponseType>;
}
The main index provides convenient re-exports:
export { SuggestReplyMode } from './auto-generated/developer_api/namespaces/developer_api';
export { TaskType as CopyTaskType } from './auto-generated/intelligence_api/namespaces/method_struct';
export { ModelInfo as BotCommonModelInfo } from './auto-generated/intelligence_api/namespaces/bot_common';
export { Scene as CreateRoomScene } from './auto-generated/playground_api/namespaces/playground';
src/
├── index.ts # Main exports and re-exports
└── auto-generated/ # Generated from Thrift IDL
├── app_builder/ # App builder service
├── bot_open_api/ # Bot public APIs
├── fornax_api/ # Workflow engine
├── plugin_develop/ # Plugin development
└── [60+ other services] # Additional service modules
The package uses TypeScript project references:
tsconfig.build.json - Build configuration extending @coze-arch/ts-configtsconfig.misc.json - Additional configurationsThis package contains auto-generated code from Thrift IDL definitions. The source files are marked with:
/* eslint-disable */
/* tslint:disable */
// @ts-nocheck
Important: Do not manually edit files in the auto-generated directory as they will be overwritten during the next generation cycle.
@coze-arch/eslint-config@workspace:* - Shared ESLint configuration@coze-arch/ts-config@workspace:* - Shared TypeScript configuration@types/node - Node.js type definitionsThis package has no runtime dependencies and is designed to be lightweight with only type definitions and client templates.
Apache-2.0
Note: This package contains auto-generated code derived from Thrift IDL definitions. The types and interfaces are automatically maintained and should not be manually modified.