Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/agent-tracing/claude.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './index';
export { ClaudeAgentTracer, TraceSession } from './src/ClaudeAgentTracer';
3 changes: 3 additions & 0 deletions core/agent-tracing/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './src/types';
export { AbstractOssClient } from './src/AbstractOssClient';
export { AbstractLogServiceClient } from './src/AbstractLogServiceClient';
2 changes: 2 additions & 0 deletions core/agent-tracing/langgraph.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './index';
export { LangGraphTracer } from './src/LangGraphTracer';
91 changes: 91 additions & 0 deletions core/agent-tracing/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"name": "@eggjs/agent-tracing",
"version": "3.72.0",
"description": "Tracing support for AI agents (LangGraph, Claude Agent SDK)",
"keywords": [
"agent",
"claude",
"egg",
"langchain",
"langgraph",
"tegg",
"tracing",
"typescript"
],
"main": "dist/index.js",
"files": [
"dist/**/*.js",
"dist/**/*.d.ts"
],
"typings": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./claude": {
"types": "./dist/claude.d.ts",
"default": "./dist/claude.js"
},
"./langgraph": {
"types": "./dist/langgraph.d.ts",
"default": "./dist/langgraph.js"
},
"./package.json": "./package.json"
},
"scripts": {
"test": "cross-env NODE_ENV=test NODE_OPTIONS='--no-deprecation' mocha",
"clean": "tsc -b --clean",
"tsc": "ut run clean && tsc -p ./tsconfig.json",
"tsc:pub": "ut run clean && tsc -p ./tsconfig.pub.json",
"prepublishOnly": "ut tsc:pub"
},
"homepage": "https://github.com/eggjs/tegg",
"bugs": {
"url": "https://github.com/eggjs/tegg/issues"
},
"repository": {
"type": "git",
"url": "git@github.com:eggjs/tegg.git",
"directory": "core/agent-tracing"
},
"engines": {
"node": ">=16.0.0"
},
"author": "killagu <killa123@126.com>",
"license": "MIT",
"dependencies": {
"@eggjs/tegg-background-task": "^3.72.0",
"@eggjs/core-decorator": "^3.72.0",
"@eggjs/tegg-types": "^3.72.0",
"onelogger": "^1.0.1"
},
"peerDependencies": {
"@anthropic-ai/claude-agent-sdk": ">=0.2.52",
"@langchain/core": ">=1.1.1"
},
"peerDependenciesMeta": {
"@anthropic-ai/claude-agent-sdk": {
"optional": true
},
"@langchain/core": {
"optional": true
}
},
"devDependencies": {
"@anthropic-ai/claude-agent-sdk": "^0.2.52",
"@anthropic-ai/sdk": "^0.78.0",
"@eggjs/tegg-common-util": "^3.72.0",
"@langchain/core": "^1.1.29",
"@langchain/langgraph": "^0.2.74",
"@types/mocha": "^10.0.1",
"@types/node": "^20.2.4",
"cross-env": "^7.0.3",
"mocha": "^10.2.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
},
"publishConfig": {
"access": "public"
}
}
31 changes: 31 additions & 0 deletions core/agent-tracing/src/AbstractLogServiceClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Abstract log service client for dependency injection.
*
* To enable log service syncing in TracingService, implement this class in your application
* and register it with Tegg IoC. The implementation class MUST be named `LogServiceClient`
* (or use `@SingletonProto({ name: 'logServiceClient' })`) so the container can resolve it.
*
* @example
* ```typescript
* import { SingletonProto } from '@eggjs/core-decorator';
* import { AccessLevel } from '@eggjs/tegg-types';
* import { AbstractLogServiceClient } from '@eggjs/agent-tracing';
*
* // Class name must be LogServiceClient (registers as 'logServiceClient' in the IoC container)
* @SingletonProto({ accessLevel: AccessLevel.PUBLIC })
* export class LogServiceClient extends AbstractLogServiceClient {
* async send(log: string): Promise<void> {
* await fetch('https://log.example.com/api', {
* method: 'POST',
* headers: { 'content-type': 'application/json' },
* body: JSON.stringify({ log }),
* });
* }
* }
* ```
*
* If no implementation is registered, log service syncing is silently skipped.
*/
export abstract class AbstractLogServiceClient {
abstract send(log: string): Promise<void>;
}
27 changes: 27 additions & 0 deletions core/agent-tracing/src/AbstractOssClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Abstract OSS client for dependency injection.
*
* To enable OSS uploads in TracingService, implement this class in your application
* and register it with Tegg IoC. The implementation class MUST be named `OssClient`
* (or use `@SingletonProto({ name: 'ossClient' })`) so the container can resolve it.
*
* @example
* ```typescript
* import { SingletonProto } from '@eggjs/core-decorator';
* import { AccessLevel } from '@eggjs/tegg-types';
* import { AbstractOssClient } from '@eggjs/agent-tracing';
*
* // Class name must be OssClient (registers as 'ossClient' in the IoC container)
* @SingletonProto({ accessLevel: AccessLevel.PUBLIC })
* export class OssClient extends AbstractOssClient {
* async put(key: string, content: string | Buffer): Promise<void> {
* // your OSS implementation here
* }
* }
* ```
*
* If no implementation is registered, OSS uploads are silently skipped.
*/
export abstract class AbstractOssClient {
abstract put(key: string, content: string | Buffer): Promise<void>;
}
Loading
Loading