diff --git a/.github/.licenserc.yaml b/.github/.licenserc.yaml new file mode 100644 index 0000000..6f04df3 --- /dev/null +++ b/.github/.licenserc.yaml @@ -0,0 +1,19 @@ +header: + license: + spdx-id: MIT + pattern: | + Copyright (c) \d{4} Bytedance Ltd. and/or its affiliates + SPDX-License-Identifier: MIT + + paths: + - packages/*/{src,__tests__}/**/*.{ts,tsx,less,css} + + paths-ignore: + - 'node_modules' + - 'dist' + - 'coverage' + - 'licenses' + - '**/*.md' + - '**/__mock__/**' + + comment: on-failure diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yaml similarity index 96% rename from .github/workflows/ci.yml rename to .github/workflows/ci.yaml index 024b404..3cf67b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yaml @@ -1,12 +1,15 @@ name: CI + on: push: - branches: ['ci/**'] + branches: ['ci/**', 'main'] pull_request: branches: ['main'] workflow_dispatch: + jobs: build: + name: Build and Test runs-on: ubuntu-latest env: NODE_VERSION: '18' diff --git a/.github/workflows/issue-sync.yaml b/.github/workflows/issue-sync.yaml new file mode 100644 index 0000000..bfa93e3 --- /dev/null +++ b/.github/workflows/issue-sync.yaml @@ -0,0 +1,35 @@ +name: Issue Notification + +on: + issues: + types: ['opened', 'reopened', 'closed'] + +jobs: + sync: + name: Sync Issues + runs-on: ubuntu-latest + env: + NODE_VERSION: '18' + LARK_APP_ID: ${{ secrets.COZELOOP_LARK_APP_ID }} + LARK_APP_SECRET: ${{ secrets.COZELOOP_LARK_APP_SECRET }} + ISSUE_ACTION: ${{ github.event.action }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + ISSUE_URL: ${{ github.event.issue.html_url }} + ISSUE_TITLE: ${{ github.event.issue.title }} + ISSUE_BODY: ${{ github.event.issue.body }} + REPO_NAME: ${{ github.repository }} + + steps: + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Install ci-tools + run: | + npm install -g @cozeloop/ci-tools@0.0.1 + + - name: Notify via lark + run: | + cozeloop-ci lark sync-issue \ + --email qihai@bytedance.com diff --git a/.github/workflows/license-check.yaml b/.github/workflows/license-check.yaml new file mode 100644 index 0000000..78cd8d0 --- /dev/null +++ b/.github/workflows/license-check.yaml @@ -0,0 +1,24 @@ +name: License Check + +on: + push: + branches: ['ci/**', 'main'] + pull_request: + branches: ['main'] + workflow_dispatch: + +jobs: + license-check: + name: License Check + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Check License Header + uses: apache/skywalking-eyes/header@v0.7.0 + with: + config: .github/.licenserc.yaml + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/semantic-pull-request.yaml b/.github/workflows/semantic-pull-request.yaml new file mode 100644 index 0000000..92f7865 --- /dev/null +++ b/.github/workflows/semantic-pull-request.yaml @@ -0,0 +1,52 @@ +name: Semantic Pull Request + +on: + pull_request: + types: + - opened + - reopened + - edited + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }} + cancel-in-progress: true + +jobs: + main: + name: Check Pull Request Title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5.5.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # see https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#type + types: | + build + ci + docs + feat + fix + perf + refactor + style + test + chore + # sdk: cozeloop-ai, cozeloop-langchain, etc + # infra: rush update, {eslint,ts,vitest}-config, prettier etc + # tools: ci-tools, etc + # workflow: gh workflow + scopes: | + sdk + infra + tools + workflow + # The pull request's title should be fulfilled the following pattern: + # + # [][] + # + # ... where valid types and scopes can be found above; for example: + # + # [fix][test] flaky test V1_ProxyAuthenticationTest.anonymousSocketTest + headerPattern: '^\[(\w*?)\](?:\[(.*?)\])?(?:\s*)(.*)$' + headerPatternCorrespondence: type, scope, subject diff --git a/README.md b/README.md index 96b9505..6b497ed 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ This monorepo contains the following packages: | Package | Description | Version | |---------|------------|---------| | [@cozeloop/ai](./packages/cozeloop-ai) | CozeLoop API SDK | [![npm](https://img.shields.io/npm/v/@cozeloop/ai.svg)](https://www.npmjs.com/package/@cozeloop/ai) | +| [@cozeloop/langchain](./packages/cozeloop-langchain) | CozeLoop LangChain Integration | [![npm](https://img.shields.io/npm/v/@cozeloop/langchain.svg)](https://www.npmjs.com/package/@cozeloop/langchain) | ## ๐ŸŽฎ Examples diff --git a/README.zh-CN.md b/README.zh-CN.md index f354f69..e5129b2 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -12,6 +12,7 @@ | ๅŒ…ๅ | ๆ่ฟฐ | ็‰ˆๆœฌ | |---------|------------|---------| | [@cozeloop/ai](./packages/cozeloop-ai) | CozeLoop API SDK | [![npm](https://img.shields.io/npm/v/@cozeloop/ai.svg)](https://www.npmjs.com/package/@cozeloop/ai) | +| [@cozeloop/langchain](./packages/cozeloop-langchain) | CozeLoop LangChain Integration | [![npm](https://img.shields.io/npm/v/@cozeloop/langchain.svg)](https://www.npmjs.com/package/@cozeloop/langchain) | ## ๐ŸŽฎ ็คบไพ‹ diff --git a/codecov.yml b/codecov.yml index 308101a..0e22e8a 100644 --- a/codecov.yml +++ b/codecov.yml @@ -17,6 +17,9 @@ coverage: target: 80% threshold: 5% +github_checks: + annotations: false + comment: layout: 'header, diff, components, files' # show component info in the PR comment require_changes: false # if true: only post the comment if coverage changes diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index c984d85..d3982a0 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -92,7 +92,7 @@ importers: version: 9.14.0 eslint-config-airbnb: specifier: ^18.0.1 - version: 18.2.1(eslint-plugin-import@2.31.0(eslint@9.14.0))(eslint-plugin-jsx-a11y@6.10.2(eslint@9.14.0))(eslint-plugin-react-hooks@5.1.0-beta-26f2496093-20240514(eslint@9.14.0))(eslint-plugin-react@7.37.4(eslint@9.14.0))(eslint@9.14.0) + version: 18.2.1(eslint-plugin-import@2.31.0(eslint@9.14.0))(eslint-plugin-jsx-a11y@6.10.2(eslint@9.14.0))(eslint-plugin-react-hooks@5.2.0(eslint@9.14.0))(eslint-plugin-react@7.37.4(eslint@9.14.0))(eslint@9.14.0) eslint-config-prettier: specifier: ~9.1.0 version: 9.1.0(eslint@9.14.0) @@ -130,11 +130,8 @@ importers: specifier: ~7.37.1 version: 7.37.4(eslint@9.14.0) eslint-plugin-react-hooks: - specifier: 5.1.0-beta-26f2496093-20240514 - version: 5.1.0-beta-26f2496093-20240514(eslint@9.14.0) - eslint-plugin-redux-saga: - specifier: ^1.1.0 - version: 1.3.2(eslint@9.14.0) + specifier: ^5.2.0 + version: 5.2.0(eslint@9.14.0) eslint-plugin-risxss: specifier: ~2.1.0 version: 2.1.0 @@ -2922,8 +2919,8 @@ packages: peerDependencies: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 - eslint-plugin-react-hooks@5.1.0-beta-26f2496093-20240514: - resolution: {integrity: sha512-nCZD93/KYY5hNAWGhfvvrEXvLFIXJCMu2St7ciHeiWUp/lnS2RVgWawp2kNQamr9Y23C9lUA03TmDRNgbm05vg==} + eslint-plugin-react-hooks@5.2.0: + resolution: {integrity: sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==} engines: {node: '>=10'} peerDependencies: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 @@ -2940,12 +2937,6 @@ packages: peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7 - eslint-plugin-redux-saga@1.3.2: - resolution: {integrity: sha512-cqkzrmXhp9DEPnjqSb1dL89+0FQPydnLNsEb6MDie2tQWkYZqxq/OjUpOpT6IWJ9+weG4i/MBfbLFpP6zW+g4g==} - peerDependencies: - eslint: '>= 6.7.0' - redux-saga: '>= 0.11.1 < 1 || >= 1.0.0' - eslint-plugin-risxss@2.1.0: resolution: {integrity: sha512-r28MzBnC/Rk/jv/P42d4GS516yMi9Ev22VAZc25YVM21izAvzGQriDOewqTsSeZlBZGxP2ebEGolp2cosz67Yg==} engines: {node: '>=6'} @@ -7494,14 +7485,14 @@ snapshots: object.assign: 4.1.7 object.entries: 1.1.8 - eslint-config-airbnb@18.2.1(eslint-plugin-import@2.31.0(eslint@9.14.0))(eslint-plugin-jsx-a11y@6.10.2(eslint@9.14.0))(eslint-plugin-react-hooks@5.1.0-beta-26f2496093-20240514(eslint@9.14.0))(eslint-plugin-react@7.37.4(eslint@9.14.0))(eslint@9.14.0): + eslint-config-airbnb@18.2.1(eslint-plugin-import@2.31.0(eslint@9.14.0))(eslint-plugin-jsx-a11y@6.10.2(eslint@9.14.0))(eslint-plugin-react-hooks@5.2.0(eslint@9.14.0))(eslint-plugin-react@7.37.4(eslint@9.14.0))(eslint@9.14.0): dependencies: eslint: 9.14.0 eslint-config-airbnb-base: 14.2.1(eslint-plugin-import@2.31.0(eslint@9.14.0))(eslint@9.14.0) eslint-plugin-import: 2.31.0(eslint@9.14.0) eslint-plugin-jsx-a11y: 6.10.2(eslint@9.14.0) eslint-plugin-react: 7.37.4(eslint@9.14.0) - eslint-plugin-react-hooks: 5.1.0-beta-26f2496093-20240514(eslint@9.14.0) + eslint-plugin-react-hooks: 5.2.0(eslint@9.14.0) object.assign: 4.1.7 object.entries: 1.1.8 @@ -7660,7 +7651,7 @@ snapshots: dependencies: eslint: 9.14.0 - eslint-plugin-react-hooks@5.1.0-beta-26f2496093-20240514(eslint@9.14.0): + eslint-plugin-react-hooks@5.2.0(eslint@9.14.0): dependencies: eslint: 9.14.0 @@ -7704,10 +7695,6 @@ snapshots: string.prototype.matchall: 4.0.12 string.prototype.repeat: 1.0.0 - eslint-plugin-redux-saga@1.3.2(eslint@9.14.0): - dependencies: - eslint: 9.14.0 - eslint-plugin-risxss@2.1.0: dependencies: import-modules: 1.1.0 diff --git a/config/eslint-config/package.json b/config/eslint-config/package.json index f4d9e93..746f8b6 100644 --- a/config/eslint-config/package.json +++ b/config/eslint-config/package.json @@ -55,8 +55,7 @@ "eslint-plugin-prettier": "~5.2.1", "eslint-plugin-promise": "^5.1.0", "eslint-plugin-react": "~7.37.1", - "eslint-plugin-react-hooks": "5.1.0-beta-26f2496093-20240514", - "eslint-plugin-redux-saga": "^1.1.0", + "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-risxss": "~2.1.0", "eslint-plugin-security": "3.0.1", "eslint-plugin-unicorn": "48.0.1", diff --git a/packages/cozeloop-ai/__tests__/tracer/propagation.test.ts b/packages/cozeloop-ai/__tests__/tracer/propagation.test.ts index e9ebd3e..8affa42 100644 --- a/packages/cozeloop-ai/__tests__/tracer/propagation.test.ts +++ b/packages/cozeloop-ai/__tests__/tracer/propagation.test.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT /* eslint-disable security/detect-object-injection -- skip */ import { cozeLoopGetter, diff --git a/packages/cozeloop-ai/__tests__/tracer/tags.test.ts b/packages/cozeloop-ai/__tests__/tracer/tags.test.ts index ebaf760..9779d02 100644 --- a/packages/cozeloop-ai/__tests__/tracer/tags.test.ts +++ b/packages/cozeloop-ai/__tests__/tracer/tags.test.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { type ReadableSpan } from '@opentelemetry/sdk-trace-base'; import { SpanStatusCode, type Span } from '@opentelemetry/api';