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
45 changes: 32 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ common/temp/
common/autoinstallers/*/.npmrc
**/.rush/temp/
*.lock
rush-logs

# Common toolchain intermediate files
temp/
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -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) | 简体中文

## 📦 包列表
Expand Down
1 change: 1 addition & 0 deletions examples/cozeloop-ai-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "@cozeloop/ai node examples",
"author": "qihai <qihai@bytedance.com>",
"scripts": {
"build": "tsc -b tsconfig.json",
"lint": "eslint ./ --cache",
"ready": "rush rebuild -T .",
"run:all": "tsx ./src/index.ts",
Expand Down
1 change: 1 addition & 0 deletions examples/cozeloop-ai-node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"extends": "@loop-infra/ts-config/tsconfig.node.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"moduleResolution": "node",
"module": "ES2022",
"lib": ["es2015", "dom"],
Expand Down
6 changes: 3 additions & 3 deletions packages/cozeloop-ai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/auth/oauth-jwt.test.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/error/common-error.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
// SPDX-License-Identifier: MIT
import {
PropertyUnprovidedError,
type PropertyUnprovidedErrorDetail,
Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/error/http-error.test.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/http.test.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/mock/base-http.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/mock/jwt-auth.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/mock/loop-tracer.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/mock/prompt-hub.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/mock/utils.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/prompt/hub.test.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/prompt/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
// SPDX-License-Identifier: MIT
import {
cacheKeyToQuery,
formatPromptTemplate,
Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/tracer/traceable.test.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/utils/common.test.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/utils/env.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
// SPDX-License-Identifier: MIT
import {
ensureProperty,
EnvKeys,
Expand Down
2 changes: 2 additions & 0 deletions packages/cozeloop-ai/__tests__/utils/logger.test.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/cozeloop-ai/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -24,6 +24,7 @@
"dist",
"LICENSE",
"README.md",
"CHANGELOG.md",
"README.zh-CN.md"
],
"scripts": {
Expand Down