diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5eb5779..73310aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,27 +1,46 @@ name: CI on: push: - branches: [ "main" ] + branches: ['ci/**'] pull_request: - branches: [ "main" ] + branches: ['main'] + workflow_dispatch: jobs: build: runs-on: ubuntu-latest + env: + NODE_VERSION: '18' + GIT_USER_NAME: 'mocayo' + GIT_USER_EMAIL: 'qihai@bytedance.com' steps: - uses: actions/checkout@v3 with: - fetch-depth: 2 - - name: Git config user - uses: snow-actions/git-config-user@v1.0.0 - with: - name: # Service Account's Name - email: # Service Account's Email Address + fetch-depth: 1 + + - name: Config Git User + # should be turn to ci user + run: | + git config --local user.name ${{ env.GIT_USER_NAME }} + git config --local user.email ${{ env.GIT_USER_EMAIL }} + - uses: actions/setup-node@v3 with: - node-version: 16 - - name: Verify Change Logs - run: node common/scripts/install-run-rush.js change --verify - - name: Rush Install + node-version: ${{ env.NODE_VERSION }} + + - name: Cache + uses: actions/cache@v4 + with: + path: | + common/temp/pnpm-local + common/temp/pnpm-store + common/temp/install-run + key: ${{ runner.os }}-rush-store-${{ hashFiles('common/config/rush/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-rush-store-main + ${{ runner.os }}-rush-store + + - name: Install Dependencies run: node common/scripts/install-run-rush.js install + - name: Rush rebuild - run: node common/scripts/install-run-rush.js rebuild --verbose --production + run: node common/scripts/install-run-rush.js rebuild --verbose --timeline diff --git a/.gitignore b/.gitignore index 4595fb9..d3012be 100644 --- a/.gitignore +++ b/.gitignore @@ -103,6 +103,7 @@ common/temp/ common/autoinstallers/*/.npmrc **/.rush/temp/ *.lock +rush-logs # Common toolchain intermediate files temp/ diff --git a/README.md b/README.md index eb2f25b..8fcf597 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # CozeLoop Monorepo +[![CI](https://github.com/coze-dev/cozeloop-js/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/coze-dev/cozeloop-js/actions/workflows/ci.yml) + English | [简体中文](./README.zh-CN.md) ## 📦 Packages diff --git a/README.zh-CN.md b/README.zh-CN.md index f9b00f7..6443fb7 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,5 +1,7 @@ # CozeLoop Monorepo +[![CI](https://github.com/coze-dev/cozeloop-js/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/coze-dev/cozeloop-js/actions/workflows/ci.yml) + [English](./README.md) | 简体中文 ## 📦 包列表 diff --git a/examples/cozeloop-ai-node/package.json b/examples/cozeloop-ai-node/package.json index ba31620..8077192 100644 --- a/examples/cozeloop-ai-node/package.json +++ b/examples/cozeloop-ai-node/package.json @@ -4,6 +4,7 @@ "description": "@cozeloop/ai node examples", "author": "qihai ", "scripts": { + "build": "tsc -b tsconfig.json", "lint": "eslint ./ --cache", "ready": "rush rebuild -T .", "run:all": "tsx ./src/index.ts", diff --git a/examples/cozeloop-ai-node/tsconfig.json b/examples/cozeloop-ai-node/tsconfig.json index 3a089b1..b5db64d 100644 --- a/examples/cozeloop-ai-node/tsconfig.json +++ b/examples/cozeloop-ai-node/tsconfig.json @@ -3,6 +3,7 @@ "extends": "@loop-infra/ts-config/tsconfig.node.json", "compilerOptions": { "outDir": "./dist", + "rootDir": "./src", "moduleResolution": "node", "module": "ES2022", "lib": ["es2015", "dom"], diff --git a/packages/cozeloop-ai/CHANGELOG.md b/packages/cozeloop-ai/CHANGELOG.md index 3d8f94c..8ca9808 100644 --- a/packages/cozeloop-ai/CHANGELOG.md +++ b/packages/cozeloop-ai/CHANGELOG.md @@ -1,9 +1,9 @@ # 🕗 Change Log - @cozeloop/ai -## 1.0.0 -🌱 Initial version +## 0.0.1 ~ 0.0.4 +🌱 Early version -- PromptHub: pull prompts from CozeLoop +- PromptHub: pull prompts from CozeLoop and format prompts - Auth: support OAuth JWT flow - Trace - initialize: init trace report diff --git a/packages/cozeloop-ai/__tests__/auth/oauth-jwt.test.ts b/packages/cozeloop-ai/__tests__/auth/oauth-jwt.test.ts index a055494..b7fc239 100644 --- a/packages/cozeloop-ai/__tests__/auth/oauth-jwt.test.ts +++ b/packages/cozeloop-ai/__tests__/auth/oauth-jwt.test.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { setupJwtAuthMock } from '../mock/jwt-auth'; import { simpleConsoleLogger } from '../../src/utils/logger'; import { OAuthJWTFlow } from '../../src/auth'; diff --git a/packages/cozeloop-ai/__tests__/error/common-error.test.ts b/packages/cozeloop-ai/__tests__/error/common-error.test.ts index 264756c..f1e7f8e 100644 --- a/packages/cozeloop-ai/__tests__/error/common-error.test.ts +++ b/packages/cozeloop-ai/__tests__/error/common-error.test.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { PropertyUnprovidedError, type PropertyUnprovidedErrorDetail, diff --git a/packages/cozeloop-ai/__tests__/error/http-error.test.ts b/packages/cozeloop-ai/__tests__/error/http-error.test.ts index f4d98a1..ea6b94a 100644 --- a/packages/cozeloop-ai/__tests__/error/http-error.test.ts +++ b/packages/cozeloop-ai/__tests__/error/http-error.test.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { AxiosError, AxiosHeaders } from 'axios'; import { HttpStatusCode, InternalApiStatusCode } from '../../src/error/types'; diff --git a/packages/cozeloop-ai/__tests__/http.test.ts b/packages/cozeloop-ai/__tests__/http.test.ts index 1271621..44372c9 100644 --- a/packages/cozeloop-ai/__tests__/http.test.ts +++ b/packages/cozeloop-ai/__tests__/http.test.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { simpleConsoleLogger } from '../src/utils/logger'; import { ApiClient } from '../src/api/api-client'; import { setupBaseHttpMock } from './mock/base-http'; diff --git a/packages/cozeloop-ai/__tests__/mock/base-http.ts b/packages/cozeloop-ai/__tests__/mock/base-http.ts index 2433c49..a2097b6 100644 --- a/packages/cozeloop-ai/__tests__/mock/base-http.ts +++ b/packages/cozeloop-ai/__tests__/mock/base-http.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { join } from 'node:path'; import { setupServer } from 'msw/node'; diff --git a/packages/cozeloop-ai/__tests__/mock/jwt-auth.ts b/packages/cozeloop-ai/__tests__/mock/jwt-auth.ts index fc87f6c..40b6cfd 100644 --- a/packages/cozeloop-ai/__tests__/mock/jwt-auth.ts +++ b/packages/cozeloop-ai/__tests__/mock/jwt-auth.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { setupServer } from 'msw/node'; import { http, HttpResponse } from 'msw'; diff --git a/packages/cozeloop-ai/__tests__/mock/loop-tracer.ts b/packages/cozeloop-ai/__tests__/mock/loop-tracer.ts index fcd701b..a59afe9 100644 --- a/packages/cozeloop-ai/__tests__/mock/loop-tracer.ts +++ b/packages/cozeloop-ai/__tests__/mock/loop-tracer.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { setupServer } from 'msw/node'; import { http } from 'msw'; diff --git a/packages/cozeloop-ai/__tests__/mock/prompt-hub.ts b/packages/cozeloop-ai/__tests__/mock/prompt-hub.ts index 28363df..237563e 100644 --- a/packages/cozeloop-ai/__tests__/mock/prompt-hub.ts +++ b/packages/cozeloop-ai/__tests__/mock/prompt-hub.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { setupServer } from 'msw/node'; import { http } from 'msw'; diff --git a/packages/cozeloop-ai/__tests__/mock/utils.ts b/packages/cozeloop-ai/__tests__/mock/utils.ts index 654ddcb..c4b753b 100644 --- a/packages/cozeloop-ai/__tests__/mock/utils.ts +++ b/packages/cozeloop-ai/__tests__/mock/utils.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { readFile } from 'node:fs/promises'; import { type SetupServerApi } from 'msw/lib/node'; diff --git a/packages/cozeloop-ai/__tests__/prompt/hub.test.ts b/packages/cozeloop-ai/__tests__/prompt/hub.test.ts index e594c79..04854fc 100644 --- a/packages/cozeloop-ai/__tests__/prompt/hub.test.ts +++ b/packages/cozeloop-ai/__tests__/prompt/hub.test.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { setupPromptHubMock } from '../mock/prompt-hub'; import { PromptCache } from '../../src/prompt/cache'; import { PromptHub, type PromptVariables } from '../../src/prompt'; diff --git a/packages/cozeloop-ai/__tests__/prompt/utils.test.ts b/packages/cozeloop-ai/__tests__/prompt/utils.test.ts index a6a0843..719a795 100644 --- a/packages/cozeloop-ai/__tests__/prompt/utils.test.ts +++ b/packages/cozeloop-ai/__tests__/prompt/utils.test.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { cacheKeyToQuery, formatPromptTemplate, diff --git a/packages/cozeloop-ai/__tests__/tracer/traceable.test.ts b/packages/cozeloop-ai/__tests__/tracer/traceable.test.ts index ab31f3f..4bd7f1e 100644 --- a/packages/cozeloop-ai/__tests__/tracer/traceable.test.ts +++ b/packages/cozeloop-ai/__tests__/tracer/traceable.test.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { setTimeout } from 'node:timers/promises'; import { config } from 'dotenv'; diff --git a/packages/cozeloop-ai/__tests__/utils/common.test.ts b/packages/cozeloop-ai/__tests__/utils/common.test.ts index 4600287..2c4295a 100644 --- a/packages/cozeloop-ai/__tests__/utils/common.test.ts +++ b/packages/cozeloop-ai/__tests__/utils/common.test.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT /* eslint-disable @typescript-eslint/no-empty-function -- skip for test */ import { compareVersions, diff --git a/packages/cozeloop-ai/__tests__/utils/env.test.ts b/packages/cozeloop-ai/__tests__/utils/env.test.ts index bb3429b..e8c4cac 100644 --- a/packages/cozeloop-ai/__tests__/utils/env.test.ts +++ b/packages/cozeloop-ai/__tests__/utils/env.test.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { ensureProperty, EnvKeys, diff --git a/packages/cozeloop-ai/__tests__/utils/logger.test.ts b/packages/cozeloop-ai/__tests__/utils/logger.test.ts index 6e52c1d..c8007e0 100644 --- a/packages/cozeloop-ai/__tests__/utils/logger.test.ts +++ b/packages/cozeloop-ai/__tests__/utils/logger.test.ts @@ -1,3 +1,5 @@ +// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +// SPDX-License-Identifier: MIT import { createLoopLogger, LoopLoggable } from '../../src/utils/logger'; describe.only('Test utils/logger.ts', () => { diff --git a/packages/cozeloop-ai/package.json b/packages/cozeloop-ai/package.json index 7d400c7..64a4a20 100644 --- a/packages/cozeloop-ai/package.json +++ b/packages/cozeloop-ai/package.json @@ -1,6 +1,6 @@ { "name": "@cozeloop/ai", - "version": "0.0.3-beta.1", + "version": "0.0.3", "description": "Official Node.js SDK of CozeLoop | 扣子罗盘官方 Node.js SDK", "keywords": [ "cozeloop", @@ -24,6 +24,7 @@ "dist", "LICENSE", "README.md", + "CHANGELOG.md", "README.zh-CN.md" ], "scripts": {