diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000..c3f15e0 --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,59 @@ +name: Package Agent Loop + +on: + pull_request: + branches: [main] + types: [closed] + +permissions: + contents: read + +jobs: + package: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + env: + PACKAGE_NAME: agent-loop-pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.merge_commit_sha }}.tar.gz + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ github.event.pull_request.merge_commit_sha }} + persist-credentials: false + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24 + + - name: Build + run: | + npm ci + npm run build + + - name: Package and verify + shell: bash + run: | + stage="$RUNNER_TEMP/package/agent-loop" + mkdir -p "$stage/dist" "$stage/config" "$RUNNER_TEMP/unpacked" + cp -R dist/src "$stage/dist/" + cp -R prompts "$stage/" + cp config/example.json "$stage/config/" + cp package.json package-lock.json README.md "$stage/" + ( + cd "$stage" + npm pkg delete scripts + npm pkg set 'scripts.start=node dist/src/cli.js' + npm ci --omit=dev + ) + + tar -czf "$RUNNER_TEMP/$PACKAGE_NAME" -C "$(dirname "$stage")" agent-loop + tar -xzf "$RUNNER_TEMP/$PACKAGE_NAME" -C "$RUNNER_TEMP/unpacked" + cd "$RUNNER_TEMP/unpacked/agent-loop" + npm start -- --help + + - name: Upload package + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ runner.temp }}/${{ env.PACKAGE_NAME }} + archive: false + if-no-files-found: error + overwrite: true diff --git a/README.md b/README.md index 6e2f3e7..cf2fcc5 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,22 @@ Agent Loop 保存项目和任务的持续上下文。用户在项目协调群交办新需求,GitHub Issue 作为协调者证据。CLI 和机器人私聊不再接单。协调者决定是否派发 Worker,正式执行复用持续 Thread。Worker 默认无群,需要直接交流或点击审批时按需建群。Agent 选择技能、实现和交付流程,Runtime 保存关系、材料、原生请求与恢复记录。 +## 下载自动构建包 + +每个合入 `main` 的 PR 都会生成一个运行包。在对应运行记录的 **Artifacts** 下载 `agent-loop-pr--<提交 SHA>.tar.gz`。 [查看打包记录](https://github.com/mingtaojin/agent-loop/actions/workflows/package.yml) + +将包解压到新目录。运行包自带生产依赖。安装 Node.js 24、Git 和 Codex CLI 后,在解压出的 `agent-loop` 目录中复制示例配置。 + +```sh +cp config/example.json config.json +``` + +按下面的说明修改本机路径,并通过环境变量提供凭证。然后检查配置。 + +```sh +npm start -- doctor --config config.json +``` + ## 准备配置 安装 Node.js 24 或更高版本、Git 和支持 `codex app-server daemon` 的 Codex CLI。完成 Codex 登录后运行以下命令。