Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,16 @@ jobs:
- name: Install Dependencies
run: node common/scripts/install-run-rush.js install

- name: Rush rebuild
- name: Build All
run: node common/scripts/install-run-rush.js rebuild --verbose --timeline

- name: Test:cov All
run: node common/scripts/install-run-rush.js test:cov --verbose --timeline

- name: Upload to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: coze-dev/cozeloop-js
fail_ci_if_error: false
verbose: true
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Spring (SG) Pte. Ltd.
Copyright (c) 2025 Bytedance Ltd. and/or its affiliates

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# CozeLoop Monorepo

[![codecov](https://codecov.io/gh/coze-dev/cozeloop-js/branch/main/graph/badge.svg)](https://codecov.io/gh/coze-dev/cozeloop-js)
[![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)
Expand Down
1 change: 1 addition & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# CozeLoop Monorepo

[![codecov](https://codecov.io/gh/coze-dev/cozeloop-js/branch/main/graph/badge.svg)](https://codecov.io/gh/coze-dev/cozeloop-js)
[![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) | 简体中文
Expand Down
48 changes: 8 additions & 40 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# valid this file: curl --data-binary @codecov.yml https://codecov.io/validate
# reference doc: https://docs.codecov.com/docs/common-recipe-list#set-project-coverage-checks-on-a-pull-request

# codecov:
# require_ci_to_pass: false
# notify:
# wait_for_ci: false
codecov:
require_ci_to_pass: true
notify:
wait_for_ci: true

# for overall project coverage
coverage:
status:
project:
Expand All @@ -16,7 +15,7 @@ coverage:
patch:
default:
target: 90%
threshold: 10%
threshold: 5%

comment:
layout: 'header, diff, components, files' # show component info in the PR comment
Expand All @@ -34,41 +33,10 @@ component_management:
threshold: 1%
- type: patch
target: 90%
threshold: 10%
threshold: 5%

individual_components:
- component_id: cozeloop-ai # this is an identifier that should not be changed
name: cozeloop-ai # this is a display name, and can be changed freely
- component_id: cozeloop-ai
name: '@cozeloop/ai'
paths:
- packages/cozeloop-ai/**
statuses:
- type: project
target: 90%
threshold: 1%
- type: patch
target: 90%
threshold: 10%

- component_id: realtime-api # this is an identifier that should not be changed
name: realtime-api # this is a display name, and can be changed freely
paths:
- packages/realtime-api/**
statuses:
- type: project
target: 90%
threshold: 1%
- type: patch
target: 90%
threshold: 10%

- component_id: chat-sdk # this is an identifier that should not be changed
name: chat-sdk # this is a display name, and can be changed freely
paths:
- packages/chat-sdk/**
statuses:
- type: project
target: 20%
threshold: 1%
- type: patch
target: 0%
threshold: 1%
21 changes: 21 additions & 0 deletions common/config/rush/command-line.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@
"safeForSimultaneousRushProcesses": true,
"autoinstallerName": "rush-commitlint",
"shellCommand": "commitlint"
},
{
"commandKind": "bulk",
"name": "test",
"description": "Executes automated tests.",
"allowWarningsInSuccessfulBuild": true,
"ignoreMissingScript": true,
"enableParallelism": true,
"summary": "⭐️️ Run test command for each package"
},
{
"commandKind": "bulk",
"name": "test:cov",
"allowWarningsInSuccessfulBuild": true,
"description": "Executes automated tests with coverage collection.",
"ignoreMissingScript": true,
"enableParallelism": true,
"incremental": true,
"ignoreDependencyOrder": true,
"safeForSimultaneousRushProcesses": true,
"summary": "⭐️️ Run coverage command for each package"
}
// {
// /**
Expand Down
14 changes: 7 additions & 7 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions config/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"build": "tsc -b tsconfig.json",
"dev": "npm run build -- -w",
"lint": "eslint ./ --cache --quiet",
"test": "exit",
"test:cov": "exit"
"test": "exit 0",
"test:cov": "exit 0"
},
"dependencies": {
"@babel/eslint-parser": "~7.25.8",
Expand All @@ -34,9 +34,9 @@
"@babel/plugin-syntax-jsx": "~7.23.3",
"@babel/preset-env": "~7.20.2",
"@babel/preset-react": "~7.13.13",
"@loop-infra/ts-config": "workspace:*",
"@eslint/compat": "~1.2.0",
"@eslint/eslintrc": "~3.1.0",
"@loop-infra/ts-config": "workspace:*",
"@rushstack/eslint-config": "~3.1.1",
"@stylistic/eslint-plugin-ts": "^2.8.0",
"@typescript-eslint/eslint-plugin": "^8.5.0",
Expand Down
4 changes: 3 additions & 1 deletion config/vitest-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"scripts": {
"build": "exit",
"dev": "npm run build -- -w",
"lint": "eslint ./ --cache --quiet"
"lint": "eslint ./ --cache --quiet",
"test": "exit 0",
"test:cov": "exit 0"
},
"dependencies": {
"vite-tsconfig-paths": "^4.2.1"
Expand Down
6 changes: 3 additions & 3 deletions config/vitest-config/src/define-config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { mergeConfig, type ViteUserConfig } from 'vitest/config';

import { webPreset } from './preset-web.ts';
import { nodePreset } from './preset-node.ts';
import { defaultVitestConfig } from './preset-default.ts';
import { webPreset } from './preset-web';
import { nodePreset } from './preset-node';
import { defaultVitestConfig } from './preset-default';

export interface VitestConfig extends ViteUserConfig {
/**
Expand Down
2 changes: 1 addition & 1 deletion config/vitest-config/src/preset-node.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mergeConfig } from 'vitest/config';

import { defaultVitestConfig } from './preset-default.ts';
import { defaultVitestConfig } from './preset-default';

export const nodePreset = mergeConfig(defaultVitestConfig, {});
2 changes: 1 addition & 1 deletion config/vitest-config/src/preset-web.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mergeConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';

import { defaultVitestConfig } from './preset-default.ts';
import { defaultVitestConfig } from './preset-default';

export const webPreset = mergeConfig(defaultVitestConfig, {
plugins: [react()],
Expand Down
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"Bytedance",
"cozeloop",
"Langsmith",
"loggable",
"packagejson",
"preinstall",
"traceparent",
Expand Down
5 changes: 3 additions & 2 deletions examples/cozeloop-ai-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
"lint": "eslint ./ --cache",
"ready": "rush rebuild -T .",
"run:all": "tsx ./src/index.ts",
"test": "echo \"skip test\"",
"test": "echo 0",
"test:cov": "exit 0",
"tsx": "tsx"
},
"dependencies": {
"@cozeloop/ai": "workspace:*",
"@opentelemetry/api": "~1.9.0",
"axios": "^1.7.7",
"axios": "^1.8.2",
"openai": "^4.92.0"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions packages/cozeloop-ai/__tests__/auth/oauth-jwt.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
// SPDX-License-Identifier: MIT
import { setupJwtAuthMock } from '../mock/jwt-auth';
import { setupJwtAuthMock } from '../__mock__/jwt-auth';
import { simpleConsoleLogger } from '../../src/utils/logger';
import { OAuthJWTFlow } from '../../src/auth';

// this is a FAKE private key, DO NOT USE IT EXCEPTE FOR TEST
const FAKE_PRAIVTE_KEY = `-----BEGIN PRIVATE KEY-----
// this is a FAKE private key, DO NOT USE IT EXCEPT FOR TEST
const FAKE_PRIVATE_KEY = `-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDe21/51r0YRcok
fvq6G8FnJtj7QyRXF5CzCENmdgQt4OhjvhzQX9t6J10n3y93q9yI283Y6hrShNAJ
RrpoGfwOmBGut3feF/shoDqes8ZrgpdDkhV0E4QFRySxmH8I6oSHFN2Mo/8Wvjz1
Expand Down Expand Up @@ -46,7 +46,7 @@ describe('Test oauth-jwt <JWT Authorization>', () => {
appId: 'fake_app_id',
aud: 'api.coze.cn',
keyid: 'mbt6VMdJ08b1UXN3Ju3NeFandJJ-E2csIany35A4QC0',
privateKey: FAKE_PRAIVTE_KEY,
privateKey: FAKE_PRIVATE_KEY,
logger: simpleConsoleLogger,
});

Expand Down
2 changes: 1 addition & 1 deletion packages/cozeloop-ai/__tests__/http.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
import { simpleConsoleLogger } from '../src/utils/logger';
import { ApiClient } from '../src/api/api-client';
import { setupBaseHttpMock } from './mock/base-http';
import { setupBaseHttpMock } from './__mock__/base-http';

interface BaseHttpResp {
method: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/cozeloop-ai/__tests__/prompt/hub.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { setTimeout } from 'node:timers/promises';

import { config } from 'dotenv';

import { setupPromptHubMock } from '../mock/prompt-hub';
import { setupPromptHubMock } from '../__mock__/prompt-hub';
import { simpleConsoleLogger } from '../../src/utils/logger';
import { cozeLoopTracer } from '../../src/tracer';
import { PromptCache } from '../../src/prompt/cache';
Expand Down Expand Up @@ -33,7 +33,7 @@ describe('Test Prompt Hub', () => {
});
afterEach(() => httpMock.reset());

it.only('#1 getPrompt and formatPrompt', async () => {
it('#1 getPrompt and formatPrompt', async () => {
const hub = new PromptHub({
traceable: true,
});
Expand Down
Loading