Skip to content

Commit cb7d1f2

Browse files
authored
feat(agent): move aio client to core package, add unit test for parser (#1113)
1 parent 28ff271 commit cb7d1f2

18 files changed

Lines changed: 615 additions & 709 deletions

multimodal/omni-tars/code-agent/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
"dependencies": {
2929
"@tarko/agent": "workspace:*",
3030
"@omni-tars/core": "workspace:*",
31-
"@tarko/agent-interface": "workspace:*",
32-
"node-fetch": "3.3.2"
31+
"@tarko/agent-interface": "workspace:*"
3332
},
3433
"devDependencies": {
3534
"@rslib/core": "0.10.0",

multimodal/omni-tars/code-agent/src/CodeAgentPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { LLMRequestHookPayload, LLMResponseHookPayload } from '@tarko/agent';
88
import { ExcuteBashProvider } from './tools/ExcuteBash';
99
import { JupyterCIProvider } from './tools/JupyterCI';
1010
import { StrReplaceEditorProvider } from './tools/StrReplaceEditor';
11-
import { AioClient } from './tools/AioFetch';
11+
import { AioClient } from '@omni-tars/core';
1212
import assert from 'assert';
1313

1414
/**

multimodal/omni-tars/code-agent/src/tools/ExcuteBash.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
import { Tool, z } from '@tarko/agent';
6-
import { AioClient } from './AioFetch';
6+
import { AioClient } from '@omni-tars/core';
7+
78
export class ExcuteBashProvider {
89
private client: AioClient;
910

multimodal/omni-tars/code-agent/src/tools/JupyterCI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
import { Tool, z } from '@tarko/agent';
6-
import { AioClient } from './AioFetch';
6+
import { AioClient } from '@omni-tars/core';
77

88
export class JupyterCIProvider {
99
private client: AioClient;

multimodal/omni-tars/code-agent/src/tools/StrReplaceEditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
import { Tool, z } from '@tarko/agent';
6-
import { AioClient } from './AioFetch';
6+
import { AioClient } from '@omni-tars/core';
77

88
export class StrReplaceEditorProvider {
99
private client: AioClient;

multimodal/omni-tars/code-agent/examples/aio.ts renamed to multimodal/omni-tars/core/examples/aio.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import { AioClient } from '../src/tools/AioFetch';
1+
import { AioClient } from '../src/utils/aio';
22

33
async function main() {
44
const client = new AioClient({
55
baseUrl: process.env.AIO_SANDBOX_URL!,
66
});
77

8+
const a = await client.cdpVersion();
9+
10+
console.log(a);
11+
812
const c = await client.shellExecWithPolling({
913
command: 'ls -al',
1014
});

multimodal/omni-tars/core/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"dev": "rslib build --watch",
2424
"build": "rslib build",
2525
"test": "vitest",
26+
"coverage": "vitest run --coverage",
2627
"dev:agent": "tarko --agent ./"
2728
},
2829
"dependencies": {
@@ -35,6 +36,7 @@
3536
"devDependencies": {
3637
"@rslib/core": "0.10.0",
3738
"@types/node": "22.15.30",
39+
"@vitest/coverage-v8": "^1.0.0",
3840
"typescript": "^5.5.3",
3941
"vitest": "^1.0.0",
4042
"openai": "4.93.0",

multimodal/omni-tars/core/src/AgentBuilder.ts

Lines changed: 0 additions & 78 deletions
This file was deleted.

multimodal/omni-tars/core/src/ComposableAgent.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
} from '@tarko/agent';
1313
import { AgentComposer } from './AgentComposer';
1414
import { AgentPlugin } from './AgentPlugin';
15-
import { SYSTEM_PROMPT } from './environments/prompt';
1615

1716
export interface ComposableAgentOptions extends AgentOptions {
1817
/** Agent plugins to compose */

multimodal/omni-tars/core/src/index.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,14 @@
44
*/
55

66
export { ComposableAgent, ComposableAgentOptions } from './ComposableAgent';
7-
export { AgentBuilder } from './AgentBuilder';
8-
export { ComposableToolCallEngine } from './ComposableToolCallEngine';
9-
export {
10-
ComposableToolCallEngineFactory,
11-
createComposableToolCallEngineFactory,
12-
} from './ComposableToolCallEngineFactory';
13-
export {
14-
AgentCompositionConfig,
15-
EnvironmentSection,
16-
ToolCallEngineProvider,
17-
ToolCallEngineContext,
18-
ToolCallEngineCompositionConfig,
19-
} from './types';
7+
export { createComposableToolCallEngineFactory } from './ComposableToolCallEngineFactory';
8+
export { ToolCallEngineProvider, ToolCallEngineContext } from './types';
209

21-
// Export environment sections for use by agent plugins
2210
export { CODE_ENVIRONMENT } from './environments/code';
2311
export { MCP_ENVIRONMENT } from './environments/mcp';
2412
export { COMPUTER_USE_ENVIRONMENT } from './environments/computer';
2513

2614
export { SnapshotPlugin } from './plugins/snapshot';
2715
export { AgentPlugin } from './AgentPlugin';
28-
export * from './utils/parser';
16+
export { parseCodeContent, parseComputerContent, parseMcpContent } from './utils/parser';
17+
export { AioClient } from './utils/aio';

0 commit comments

Comments
 (0)