Skip to content

Commit b1c8ded

Browse files
committed
feat(skill-agent): add skill agent module
fix(package): support pnpm 10 fix(package): support pnpm 10 feat(skill-agent): add skill agent module with core functionality Add new skill agent module with core functionality including: - Skill management and loading system - Skill tool integration for agent usage - Config markdown parsing for skill documentation - Type definitions for skill-related interfaces - Integration with existing AgentTARS system feat: allow OPENAI_API_KEY in secretlint config fix: remove unused devDependencies from package.json feat(skill-agent): add initial skill agent interface package Add new package @tarko/skill-agent-interface with basic configuration files (rslib.config.ts, tsconfig.json, package.json) and initial type definitions for skill agent functionality. Includes SkillAgentOptions, SkillInfo, and SkillRegistry interfaces. fix(deps): upgrade node-fetch to v3.3.2 and update related dependencies
1 parent 3f25496 commit b1c8ded

27 files changed

Lines changed: 6631 additions & 6394 deletions

.secretlintrc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
"pattern": "/\\b(?<key>(?:password|pass|secret|token|apiKey)(?:[_-]\\w+)?)\\b\\s*[:=]\\s*(?<value>(?!['\"]?\\s*['\"]?$)(?!\\d+\\.\\d+(?:\\.\\d+)?(?:\\s|$))\\S.*)/i"
2929
}
3030
],
31-
"allows": ["your_api_key", "YOUR_API_KEY"]
31+
"allows": ["your_api_key", "YOUR_API_KEY","process.env.OPENAI_API_KEY"]
3232
}
3333
},
3434
{ "id": "@secretlint/secretlint-rule-privatekey" }
3535
]
36-
}
36+
}

infra/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"engines": {
2525
"node": ">=22",
26-
"pnpm": "9"
26+
"pnpm": ">=9"
2727
},
2828
"devDependencies": {
2929
"pnpm-dev-kit": "workspace:*",

multimodal/agent-tars/cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"@agent-tars/interface": "workspace:*",
3636
"@types/node": "^20.14.8",
3737
"typescript": "^5.7.2",
38+
"node-fetch": "^3.3.0",
3839
"rimraf": "^6.0.1"
3940
},
4041
"pkg": {

multimodal/agent-tars/core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"@tarko/shared-utils": "workspace:*",
2626
"@tarko/shared-media-utils": "workspace:*",
2727
"@tarko/mcp-agent": "workspace:*",
28+
"@tarko/skill-agent": "workspace:*",
2829
"@agent-tars/interface": "workspace:*"
2930
},
3031
"devDependencies": {

multimodal/agent-tars/core/rslib.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ export default defineConfig({
2323
dts: true,
2424
banner: { js: BANNER },
2525
autoExternal: {
26-
dependencies: false,
26+
dependencies: true,
2727
optionalDependencies: true,
2828
peerDependencies: true,
2929
},
3030
output: {
31-
externals: ['@tarko/shared-media-utils'],
31+
externals: ['@tarko/shared-media-utils', 'node-fetch'],
3232
},
3333
},
3434
],

multimodal/agent-tars/core/src/agent-tars.ts

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import {
77
AgentEventStream,
8-
MCPAgent,
98
LLMRequestHookPayload,
109
LLMResponseHookPayload,
1110
ConsoleLogger,
@@ -23,13 +22,18 @@ import { AgentTARSBaseEnvironment } from './environments/base';
2322
import { ToolLogger } from './utils';
2423
import { AGENT_TARS_WEBUI_CONFIG } from './webui-config';
2524

25+
// Skill-related imports
26+
import { SkillAgent, SkillAgentOptions } from '@tarko/skill-agent';
27+
2628
/**
2729
* AgentTARS - A multimodal AI agent with browser, filesystem, and search capabilities
2830
*
29-
* This class provides a comprehensive AI agent built on the Tarko framework,
31+
* This class provides a comprehensive AI agent built on Tarko framework,
3032
* offering seamless integration with browsers, file systems, and search providers.
33+
*
34+
* Extends SkillAgent to provide skill management capabilities out of the box.
3135
*/
32-
export class AgentTARS<T extends AgentTARSOptions = AgentTARSOptions> extends MCPAgent<T> {
36+
export class AgentTARS<T extends AgentTARSOptions = AgentTARSOptions> extends SkillAgent<T> {
3337
static label = '@agent-tars/core';
3438

3539
/**
@@ -82,14 +86,19 @@ export class AgentTARS<T extends AgentTARSOptions = AgentTARSOptions> extends MC
8286
new ConsoleLogger(options.id || 'AgentTARS'),
8387
);
8488

85-
// Initialize parent class with environment-provided MCP configuration
86-
super({
89+
// Build options for parent SkillAgent
90+
const skillAgentOptions: T = {
8791
...processedOptions,
8892
name: options.name ?? 'AgentTARS',
8993
instructions,
9094
mcpServers: environment.getMCPServerRegistry(),
9195
maxTokens: processedOptions.maxTokens,
92-
});
96+
// Merge skills option if provided
97+
// skills:false,
98+
} as T;
99+
100+
// Call parent constructor (SkillAgent -> MCPAgent)
101+
super(skillAgentOptions);
93102

94103
// Store configuration
95104
this.tarsOptions = processedOptions;
@@ -102,9 +111,9 @@ export class AgentTARS<T extends AgentTARSOptions = AgentTARSOptions> extends MC
102111
// Initialize core utilities
103112
this.toolLogger = new ToolLogger(this.logger);
104113

105-
// Use the environment created earlier (with updated logger)
114+
// Use the environment created earlier
106115
this.environment = environment;
107-
// Update environment logger to use the initialized logger
116+
// Update environment logger to use initialized logger
108117
if ('logger' in this.environment) {
109118
(this.environment as any).logger = this.logger.spawn(
110119
processedOptions.aioSandbox ? 'AIOEnvironment' : 'LocalEnvironment',
@@ -117,15 +126,18 @@ export class AgentTARS<T extends AgentTARSOptions = AgentTARSOptions> extends MC
117126
}
118127

119128
/**
120-
* Initialize the agent and all its components
129+
* Initialize agent and all its components
121130
*/
122131
async initialize(): Promise<void> {
123132
this.logger.info('🚀 Initializing AgentTARS...');
124133

125134
try {
126-
// Initialize all components through the environment
135+
// Initialize all components through environment
127136
await this.environment.initialize((tool) => this.registerTool(tool), this.eventStream);
128137

138+
// Call parent initialize (SkillAgent) which will initialize skills
139+
await super.initialize();
140+
129141
// Log registered tools
130142
this.toolLogger.logRegisteredTools(this.getTools());
131143

@@ -135,8 +147,6 @@ export class AgentTARS<T extends AgentTARSOptions = AgentTARSOptions> extends MC
135147
await this.cleanup();
136148
throw error;
137149
}
138-
139-
await super.initialize();
140150
}
141151

142152
/**
@@ -208,28 +218,28 @@ export class AgentTARS<T extends AgentTARSOptions = AgentTARSOptions> extends MC
208218
}
209219

210220
/**
211-
* Get the current working directory
221+
* Get current working directory
212222
*/
213223
public getWorkingDirectory(): string {
214224
return this.workspace;
215225
}
216226

217227
/**
218-
* Get the logger instance
228+
* Get logger instance
219229
*/
220230
public getLogger(): ConsoleLogger {
221231
return this.logger;
222232
}
223233

224234
/**
225-
* Get the current abort signal
235+
* Get current abort signal
226236
*/
227237
public getAbortSignal(): AbortSignal | undefined {
228238
return this.executionController.getAbortSignal();
229239
}
230240

231241
/**
232-
* Get the browser manager instance
242+
* Get browser manager instance
233243
*/
234244
public getBrowserManager(): BrowserManager | undefined {
235245
return this.environment.getBrowserManager();
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Copyright (c) 2025 Bytedance, Inc. and its affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
import { LogLevel } from '@tarko/interface';
6+
import { AgentTARS } from './index';
7+
import { AgentServer } from '@tarko/agent-server';
8+
import { IAgent } from '@tarko/agent-interface';
9+
import { homedir } from 'os';
10+
import path from 'path';
11+
import {
12+
AgentTARSCLIArguments,
13+
AgentTARSAppConfig,
14+
BrowserControlMode,
15+
AGENT_TARS_CONSTANTS,
16+
} from '@agent-tars/interface';
17+
// Simple test configuration
18+
const testConfig: AgentTARSAppConfig = {
19+
agent: {
20+
type: 'module',
21+
constructor: AgentTARS,
22+
},
23+
server: {
24+
port: 3001,
25+
storage: {
26+
type: 'sqlite',
27+
baseDir: path.join(homedir(), '.agent-tars', 'storage'),
28+
dbName: 'agent-tars.db',
29+
},
30+
},
31+
logLevel: LogLevel.DEBUG,
32+
model: {
33+
provider: 'openai',
34+
id: 'qwen-max',
35+
apiKey: process.env.OPENAI_API_KEY,
36+
baseURL: process.env.OPENAI_BASE_URL,
37+
},
38+
workspace: path.join(homedir(), '.agent-tars', 'workspace'),
39+
};
40+
41+
async function startServer() {
42+
console.log('Starting Agent Server for debugging...');
43+
44+
const server = new AgentServer({
45+
appConfig: testConfig,
46+
versionInfo: {
47+
version: '1.0.0',
48+
buildTime: Date.now(),
49+
gitHash: 'dev',
50+
},
51+
});
52+
53+
try {
54+
// Create workspace directory if it doesn't exist
55+
const { mkdirSync, existsSync } = await import('fs');
56+
const workspaceDir = testConfig.workspace;
57+
58+
const httpServer = await server.start();
59+
console.log(`\nAgent Server started successfully!`);
60+
console.log(`Server URL: http://localhost:3001`);
61+
console.log(`\nYou can now make requests to the API endpoints, e.g.:`);
62+
console.log(`- POST http://localhost:3001/api/sessions (create session)`);
63+
console.log(`- GET http://localhost:3001/api/system/info (system info)`);
64+
65+
// Keep server running
66+
process.on('SIGINT', async () => {
67+
console.log('\nStopping server...');
68+
await server.stop();
69+
console.log('Server stopped.');
70+
process.exit(0);
71+
});
72+
} catch (error) {
73+
console.error('Failed to start server:', error);
74+
process.exit(1);
75+
}
76+
}
77+
78+
startServer();

multimodal/agent-tars/interface/src/core.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import type { MCPServerRegistry, MCPAgentOptions } from '@tarko/mcp-agent-interface';
8+
import type { SkillAgentOptions } from '@tarko/skill-agent';
89

910
export type LocalBrowserSearchEngine = 'google' | 'bing' | 'baidu' | 'sogou';
1011

@@ -131,7 +132,7 @@ export interface AgentTARSExperimentalOptions {
131132
/**
132133
* Common options interface for all Agent TARS implementations
133134
*/
134-
export interface AgentTARSOptions extends MCPAgentOptions {
135+
export interface AgentTARSOptions extends SkillAgentOptions {
135136
/**
136137
* Search settings.
137138
*/

multimodal/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@
3333
},
3434
"engines": {
3535
"node": ">=22",
36-
"pnpm": "9"
36+
"pnpm": ">=9"
37+
},
38+
"pnpm": {
39+
"overrides": {
40+
"node-fetch": "^3.3.2",
41+
"@types/node-fetch": "npm:@types/node-fetch@^3.0.0"
42+
}
3743
},
3844
"devDependencies": {
3945
"pnpm-dev-kit": "0.0.5-canary-7d05b7ce-20251213170600",

0 commit comments

Comments
 (0)