{"repo": "barretlee/agent-pulse", "files": {".github/workflows/monitor.yml": {"40cb4e6e541de4349d2f078a1c4e8d1ab9e67a63": {"t": 1785747013.9836748, "n": 7203, "h": "d944e1c9cb38bfa1", "c": "name: Monitor system health\n\non:\n schedule:\n # Monday 08:17 Asia/Shanghai, after the weekly refresh and Pages deployment.\n - cron: \"17 0 * * 1\"\n workflow_dispatch:\n inputs:\n allow_notification:\n description: Allow this manual run to update the monitor incident after all gates pass\n required: false\n default: false\n type: boolean\n\npermissions:\n actions: read\n contents: read\n issues: write\n\nconcurrency:\n group: agent-pulse-monitor-main\n cancel-in-progress: true\n\nenv:\n DATABASE_URL: sqlite:./var/monitor-check.db\n PUBLIC_SITE_URL: https://barretlee.github.io/agent-pulse/\n\njobs:\n check:\n runs-on: ubuntu-latest\n timeout-minutes: 10\n steps:\n - name: Check out main\n uses: actions/checkout@v7\n with:\n ref: main\n\n - name: Set up Node.js\n uses: actions/setup-node@v6\n with:\n node-version: 24\n cache: npm\n\n - name: Install locked dependencies\n run: npm ci\n\n - name: Restore auditable repository snapshot\n run: npm run db:snapshot -- restore\n\n - name: Check source audit and health issue liveness\n env:\n GH_TOKEN: ${{ github.token }}\n shell: bash\n run: |\n set -euo pipefail\n latest_success=\"$(gh run list --workflow source-audit.yml --status success --limit 1 --json updatedAt --jq '.[0].updatedAt // empty')\"\n issue_json=\"$(gh issue view 4 --json state,updatedAt,body)\"\n issue_state=\"$(jq -r '.state' <<< \"$issue_json\")\"\n issue_updated=\"$(jq -r '.updatedAt' <<< \"$issue_json\")\"\n issue_body=\"$(jq -r '.body' <<< \"$issue_json\")\"\n test \"$issue_state\" = \"OPEN\"\n grep -F '' <<< \"$issue_body\" >/dev/null\n LATEST_SUCCESS=\"$latest_success\" ISSUE_UPDATED=\"$issue_updated\" node --input-type=module <<'NODE'\n const maximumAgeMs = 9 * 24 * 60 * 60 * 1000;\n const now = Date.now();\n for (const [label, value] of Object.entries({\n \"source audit success\": process.env.LATEST_SUCCESS,\n \"source health issue\": process.env.ISSUE_UPDATED,\n })) {\n const timestamp = Date.parse(value ?? \"\");\n if (!Number.isFinite(timestamp) || now - timestamp > maximumAgeMs) {\n throw new Error(`${label} is stale or missing: ${value ?? \"missing\"}`);\n }\n }\n NODE\n\n - name: Run monitor check\n id: monitor\n shell: bash\n run: |\n set -euo pipefail\n npm run --silent monitor:check > \"$RUNNER_TEMP/monitor.json\" || true\n jq -e . \"$RUNNER_TEMP/monitor.json\" >/dev/null\n status=\"$(jq -r '.status // \"critical\"' \"$RUNNER_TEMP/monitor.json\")\"\n echo \"status=$status\" >> \"$GITHUB_OUTPUT\"\n jq . \"$RUNNER_TEMP/monitor.json\"\n\n - name: Read the current monitor incident\n env:\n GH_TOKEN: ${{ github.token }}\n shell: bash\n run: |\n set -euo pipefail\n gh issue list --state open --label 'monitor:critical' --limit 1 --json number,updatedAt,body,url > \"$RUNNER_TEMP/monitor-incident.json\"\n jq -e 'type == \"array\"' \"$RUNNER_TEMP/monitor-incident.json\" >/dev/null\n\n - name: Decide whether this run deserves a notification\n id: decision\n env:\n ALLOW_NOTIFICATION: ${{ inputs.allow_notification || 'false' }}\n DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}\n DEEPSEEK_MODEL: deepseek-v4-flash\n shell: bash\n run: |\n set -euo pipefail\n args=(--report \"$RUNNER_TEMP/monitor.json\" --incident \"$RUNNER_TEMP/monitor-incident.json\")\n if [[ -n \"${DEEPSEEK_API_KEY:-}\" ]]; then\n args+=(--ai)\n fi\n if [[ \"$GITHUB_EVENT_NAME\" == \"workflow_dispatch\" && \"$ALLOW_NOTIFICATION\" != \"true\" ]]; then\n args+=(--dry-run)\n fi\n npm run --silent monitor:decide -- \"${args[@]}\" > \"$RUNNER_TEMP/monitor-decision.json\"\n jq -e '.decision and (.notify | type == \"boolean\") and .fingerprint and .reasonCode' \"$RUNNER_TEMP/monitor-decision.json\" >/dev/null\n echo \"notify=$(jq -r '.notify' \"$RUNNER_TEMP/monitor-decision.json\")\" >> \"$GITHUB_OUTPUT\"\n echo \"fingerprint=$(jq -r '.fingerprint' \"$RUNNER_TEMP/monitor-decision.json\")\" >> \"$GITHUB_OUTPUT\"\n jq . \"$RUNNER_TEMP/monitor-decision.json\"\n {\n echo '### Monitor alert decision'\n echo\n echo \"- Decision: $(jq -r '.decision' \"$RUNNER_TEMP/monitor-decision.json\")\"\n echo \"- Notification: $(jq -r '.notify' \"$RUNNER_TEMP/monitor-decision.json\")\"\n echo \"- Source: $(jq -r '.decisionSource' \"$RUNNER_TEMP/monitor-decision.json\")\"\n echo \"- Reason: $(jq -r '.reasonCode' \"$RUNNER_TEMP/monitor-decision.json\")\"\n echo \"- Fingerprint: $(jq -r '.fingerprint' \"$RUNNER_TEMP/monitor-decision.json\")\"\n echo \"- Rationale: $(jq -r '.rationale | gsub(\"[\\\\r\\\\n]\"; \" \")' \"$RUNNER_TEMP/monitor-decision.json\")\"\n } >> \"$GITHUB_STEP_SUMMARY\"\n\n - name: Upload monitor evidence\n if: always()\n uses: actions/upload-artifact@v7\n with:\n name: monitor-${{ github.run_id }}\n path: |\n ${{ runner.temp }}/monitor.json\n ${{ runner.temp }}/monitor-decision.json\n retention-days: 7\n\n - name: Update the single monitor incident\n if: steps.decision.outputs.notify == 'true'\n env:\n GH_TOKEN: ${{ github.token }}\n shell: bash\n run: |\n set -euo pipefail\n report=\"$RUNNER_TEMP/monitor.json\"\n body=\"$RUNNER_TEMP/monitor-issue.md\"\n decision=\"$RUNNER_TEMP/monitor-decision.json\"\n {\n echo \"\"\n echo '# Agent Pulse 自动监控告警'\n echo\n echo \"- 时间:$(jq -r '.timestamp' \"$report\")\"\n echo \"- 系统分:$(jq -r '.systemScore' \"$report\") / 100\"\n echo \"- 状态:$(jq -r '.status' \"$report\")\"\n echo \"- 告警门禁:$(jq -r '.decisionSource' \"$decision\") · $(jq -r '.reasonCode' \"$decision\")\"\n echo\n echo '## 问题'\n jq -r '.issues[]? | \"- \" + .' \"$report\"\n echo\n echo '## 本次告警判断'\n echo \"$(jq -r '.rationale' \"$decision\")\"\n echo\n echo '## 建议动作'\n echo \"- $(jq -r '.suggestedAction' \"$decision\")\"\n echo\n echo \"[查看本次 Actions 运行](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})\"\n } > \"$body\"\n gh label create \"monitor:critical\" --color d73a4a --description \"AI-gated critical monitor incident\" --force\n issue=\"$(gh issue list --state open --label 'monitor:critical' --limit 1 --json number --jq '.[0].number // empty')\"\n if [[ -n \"$issue\" ]]; then\n gh issue edit \"$issue\" --body-file \"$body\"\n else\n gh issue create --title \"[Monitor] Agent Pulse critical health incident\" --label \"monitor:critical\" --body-file \"$body\"\n fi\n"}, "6d25e12a8c738f477076036c9ef32be9857255c4": {"t": 1785769827.3776455, "n": 7203, "h": "d944e1c9cb38bfa1", "c": "name: Monitor system health\n\non:\n schedule:\n # Monday 08:17 Asia/Shanghai, after the weekly refresh and Pages deployment.\n - cron: \"17 0 * * 1\"\n workflow_dispatch:\n inputs:\n allow_notification:\n description: Allow this manual run to update the monitor incident after all gates pass\n required: false\n default: false\n type: boolean\n\npermissions:\n actions: read\n contents: read\n issues: write\n\nconcurrency:\n group: agent-pulse-monitor-main\n cancel-in-progress: true\n\nenv:\n DATABASE_URL: sqlite:./var/monitor-check.db\n PUBLIC_SITE_URL: https://barretlee.github.io/agent-pulse/\n\njobs:\n check:\n runs-on: ubuntu-latest\n timeout-minutes: 10\n steps:\n - name: Check out main\n uses: actions/checkout@v7\n with:\n ref: main\n\n - name: Set up Node.js\n uses: actions/setup-node@v6\n with:\n node-version: 24\n cache: npm\n\n - name: Install locked dependencies\n run: npm ci\n\n - name: Restore auditable repository snapshot\n run: npm run db:snapshot -- restore\n\n - name: Check source audit and health issue liveness\n env:\n GH_TOKEN: ${{ github.token }}\n shell: bash\n run: |\n set -euo pipefail\n latest_success=\"$(gh run list --workflow source-audit.yml --status success --limit 1 --json updatedAt --jq '.[0].updatedAt // empty')\"\n issue_json=\"$(gh issue view 4 --json state,updatedAt,body)\"\n issue_state=\"$(jq -r '.state' <<< \"$issue_json\")\"\n issue_updated=\"$(jq -r '.updatedAt' <<< \"$issue_json\")\"\n issue_body=\"$(jq -r '.body' <<< \"$issue_json\")\"\n test \"$issue_state\" = \"OPEN\"\n grep -F '' <<< \"$issue_body\" >/dev/null\n LATEST_SUCCESS=\"$latest_success\" ISSUE_UPDATED=\"$issue_updated\" node --input-type=module <<'NODE'\n const maximumAgeMs = 9 * 24 * 60 * 60 * 1000;\n const now = Date.now();\n for (const [label, value] of Object.entries({\n \"source audit success\": process.env.LATEST_SUCCESS,\n \"source health issue\": process.env.ISSUE_UPDATED,\n })) {\n const timestamp = Date.parse(value ?? \"\");\n if (!Number.isFinite(timestamp) || now - timestamp > maximumAgeMs) {\n throw new Error(`${label} is stale or missing: ${value ?? \"missing\"}`);\n }\n }\n NODE\n\n - name: Run monitor check\n id: monitor\n shell: bash\n run: |\n set -euo pipefail\n npm run --silent monitor:check > \"$RUNNER_TEMP/monitor.json\" || true\n jq -e . \"$RUNNER_TEMP/monitor.json\" >/dev/null\n status=\"$(jq -r '.status // \"critical\"' \"$RUNNER_TEMP/monitor.json\")\"\n echo \"status=$status\" >> \"$GITHUB_OUTPUT\"\n jq . \"$RUNNER_TEMP/monitor.json\"\n\n - name: Read the current monitor incident\n env:\n GH_TOKEN: ${{ github.token }}\n shell: bash\n run: |\n set -euo pipefail\n gh issue list --state open --label 'monitor:critical' --limit 1 --json number,updatedAt,body,url > \"$RUNNER_TEMP/monitor-incident.json\"\n jq -e 'type == \"array\"' \"$RUNNER_TEMP/monitor-incident.json\" >/dev/null\n\n - name: Decide whether this run deserves a notification\n id: decision\n env:\n ALLOW_NOTIFICATION: ${{ inputs.allow_notification || 'false' }}\n DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}\n DEEPSEEK_MODEL: deepseek-v4-flash\n shell: bash\n run: |\n set -euo pipefail\n args=(--report \"$RUNNER_TEMP/monitor.json\" --incident \"$RUNNER_TEMP/monitor-incident.json\")\n if [[ -n \"${DEEPSEEK_API_KEY:-}\" ]]; then\n args+=(--ai)\n fi\n if [[ \"$GITHUB_EVENT_NAME\" == \"workflow_dispatch\" && \"$ALLOW_NOTIFICATION\" != \"true\" ]]; then\n args+=(--dry-run)\n fi\n npm run --silent monitor:decide -- \"${args[@]}\" > \"$RUNNER_TEMP/monitor-decision.json\"\n jq -e '.decision and (.notify | type == \"boolean\") and .fingerprint and .reasonCode' \"$RUNNER_TEMP/monitor-decision.json\" >/dev/null\n echo \"notify=$(jq -r '.notify' \"$RUNNER_TEMP/monitor-decision.json\")\" >> \"$GITHUB_OUTPUT\"\n echo \"fingerprint=$(jq -r '.fingerprint' \"$RUNNER_TEMP/monitor-decision.json\")\" >> \"$GITHUB_OUTPUT\"\n jq . \"$RUNNER_TEMP/monitor-decision.json\"\n {\n echo '### Monitor alert decision'\n echo\n echo \"- Decision: $(jq -r '.decision' \"$RUNNER_TEMP/monitor-decision.json\")\"\n echo \"- Notification: $(jq -r '.notify' \"$RUNNER_TEMP/monitor-decision.json\")\"\n echo \"- Source: $(jq -r '.decisionSource' \"$RUNNER_TEMP/monitor-decision.json\")\"\n echo \"- Reason: $(jq -r '.reasonCode' \"$RUNNER_TEMP/monitor-decision.json\")\"\n echo \"- Fingerprint: $(jq -r '.fingerprint' \"$RUNNER_TEMP/monitor-decision.json\")\"\n echo \"- Rationale: $(jq -r '.rationale | gsub(\"[\\\\r\\\\n]\"; \" \")' \"$RUNNER_TEMP/monitor-decision.json\")\"\n } >> \"$GITHUB_STEP_SUMMARY\"\n\n - name: Upload monitor evidence\n if: always()\n uses: actions/upload-artifact@v7\n with:\n name: monitor-${{ github.run_id }}\n path: |\n ${{ runner.temp }}/monitor.json\n ${{ runner.temp }}/monitor-decision.json\n retention-days: 7\n\n - name: Update the single monitor incident\n if: steps.decision.outputs.notify == 'true'\n env:\n GH_TOKEN: ${{ github.token }}\n shell: bash\n run: |\n set -euo pipefail\n report=\"$RUNNER_TEMP/monitor.json\"\n body=\"$RUNNER_TEMP/monitor-issue.md\"\n decision=\"$RUNNER_TEMP/monitor-decision.json\"\n {\n echo \"\"\n echo '# Agent Pulse 自动监控告警'\n echo\n echo \"- 时间:$(jq -r '.timestamp' \"$report\")\"\n echo \"- 系统分:$(jq -r '.systemScore' \"$report\") / 100\"\n echo \"- 状态:$(jq -r '.status' \"$report\")\"\n echo \"- 告警门禁:$(jq -r '.decisionSource' \"$decision\") · $(jq -r '.reasonCode' \"$decision\")\"\n echo\n echo '## 问题'\n jq -r '.issues[]? | \"- \" + .' \"$report\"\n echo\n echo '## 本次告警判断'\n echo \"$(jq -r '.rationale' \"$decision\")\"\n echo\n echo '## 建议动作'\n echo \"- $(jq -r '.suggestedAction' \"$decision\")\"\n echo\n echo \"[查看本次 Actions 运行](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})\"\n } > \"$body\"\n gh label create \"monitor:critical\" --color d73a4a --description \"AI-gated critical monitor incident\" --force\n issue=\"$(gh issue list --state open --label 'monitor:critical' --limit 1 --json number --jq '.[0].number // empty')\"\n if [[ -n \"$issue\" ]]; then\n gh issue edit \"$issue\" --body-file \"$body\"\n else\n gh issue create --title \"[Monitor] Agent Pulse critical health incident\" --label \"monitor:critical\" --body-file \"$body\"\n fi\n"}, "8a46ed8641d9c345460fb073968deb622c938ea2": {"t": 1785769828.709721, "n": 4355, "h": "874ffc81f0b862c0", "c": "name: Monitor system health\n\non:\n schedule:\n # Monday 08:17 Asia/Shanghai, after the weekly refresh and Pages deployment.\n - cron: \"17 0 * * 1\"\n workflow_dispatch:\n\npermissions:\n actions: read\n contents: read\n issues: write\n\nconcurrency:\n group: agent-pulse-monitor-main\n cancel-in-progress: true\n\nenv:\n DATABASE_URL: sqlite:./var/monitor-check.db\n PUBLIC_SITE_URL: https://barretlee.github.io/agent-pulse/\n\njobs:\n check:\n runs-on: ubuntu-latest\n timeout-minutes: 10\n steps:\n - name: Check out main\n uses: actions/checkout@v7\n with:\n ref: main\n\n - name: Set up Node.js\n uses: actions/setup-node@v6\n with:\n node-version: 24\n cache: npm\n\n - name: Install locked dependencies\n run: npm ci\n\n - name: Restore auditable repository snapshot\n run: npm run db:snapshot -- restore\n\n - name: Check source audit and health issue liveness\n env:\n GH_TOKEN: ${{ github.token }}\n shell: bash\n run: |\n set -euo pipefail\n latest_success=\"$(gh run list --workflow source-audit.yml --status success --limit 1 --json updatedAt --jq '.[0].updatedAt // empty')\"\n issue_json=\"$(gh issue view 4 --json state,updatedAt,body)\"\n issue_state=\"$(jq -r '.state' <<< \"$issue_json\")\"\n issue_updated=\"$(jq -r '.updatedAt' <<< \"$issue_json\")\"\n issue_body=\"$(jq -r '.body' <<< \"$issue_json\")\"\n test \"$issue_state\" = \"OPEN\"\n grep -F '' <<< \"$issue_body\" >/dev/null\n LATEST_SUCCESS=\"$latest_success\" ISSUE_UPDATED=\"$issue_updated\" node --input-type=module <<'NODE'\n const maximumAgeMs = 9 * 24 * 60 * 60 * 1000;\n const now = Date.now();\n for (const [label, value] of Object.entries({\n \"source audit success\": process.env.LATEST_SUCCESS,\n \"source health issue\": process.env.ISSUE_UPDATED,\n })) {\n const timestamp = Date.parse(value ?? \"\");\n if (!Number.isFinite(timestamp) || now - timestamp > maximumAgeMs) {\n throw new Error(`${label} is stale or missing: ${value ?? \"missing\"}`);\n }\n }\n NODE\n\n - name: Run monitor check\n id: monitor\n shell: bash\n run: |\n set -euo pipefail\n npm run --silent monitor:check > \"$RUNNER_TEMP/monitor.json\" || true\n jq -e . \"$RUNNER_TEMP/monitor.json\" >/dev/null\n status=\"$(jq -r '.status // \"critical\"' \"$RUNNER_TEMP/monitor.json\")\"\n echo \"status=$status\" >> \"$GITHUB_OUTPUT\"\n jq . \"$RUNNER_TEMP/monitor.json\"\n\n - name: Upload monitor evidence\n uses: actions/upload-artifact@v7\n with:\n name: monitor-${{ github.run_id }}\n path: ${{ runner.temp }}/monitor.json\n retention-days: 7\n\n - name: Update the single monitor incident\n if: steps.monitor.outputs.status == 'critical'\n env:\n GH_TOKEN: ${{ github.token }}\n shell: bash\n run: |\n set -euo pipefail\n report=\"$RUNNER_TEMP/monitor.json\"\n body=\"$RUNNER_TEMP/monitor-issue.md\"\n {\n echo ''\n echo '# Agent Pulse 自动监控告警'\n echo\n echo \"- 时间:$(jq -r '.timestamp' \"$report\")\"\n echo \"- 系统分:$(jq -r '.systemScore' \"$report\") / 100\"\n echo \"- 状态:$(jq -r '.status' \"$report\")\"\n echo\n echo '## 问题'\n jq -r '.issues[]? | \"- \" + .' \"$report\"\n echo\n echo '## 建议动作'\n jq -r '.recommendations[]? | \"- \" + .' \"$report\"\n echo\n echo \"[查看本次 Actions 运行](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})\"\n } > \"$body\"\n gh label create \"monitor:critical\" --color d73a4a --description \"Automated critical monitor incident\" --force\n issue=\"$(gh issue list --state open --label 'monitor:critical' --limit 1 --json number --jq '.[0].number // empty')\"\n if [[ -n \"$issue\" ]]; then\n gh issue edit \"$issue\" --body-file \"$body\"\n else\n gh issue create --title \"[Monitor] Agent Pulse critical health incident\" --label \"monitor:critical\" --body-file \"$body\"\n fi\n"}, "33536fd2d0eaf18fa37196a9d43eebf79d199b0e": {"t": 1785769830.9625046, "n": 4272, "h": "6b0f2656dd6e4608", "c": "name: Monitor system health\n\non:\n schedule:\n - cron: \"*/30 * * * *\"\n workflow_dispatch:\n\npermissions:\n actions: read\n contents: read\n issues: write\n\nconcurrency:\n group: agent-pulse-monitor-main\n cancel-in-progress: true\n\nenv:\n DATABASE_URL: sqlite:./var/monitor-check.db\n PUBLIC_SITE_URL: https://barretlee.github.io/agent-pulse/\n\njobs:\n check:\n runs-on: ubuntu-latest\n timeout-minutes: 10\n steps:\n - name: Check out main\n uses: actions/checkout@v7\n with:\n ref: main\n\n - name: Set up Node.js\n uses: actions/setup-node@v6\n with:\n node-version: 24\n cache: npm\n\n - name: Install locked dependencies\n run: npm ci\n\n - name: Restore auditable repository snapshot\n run: npm run db:snapshot -- restore\n\n - name: Check source audit and health issue liveness\n env:\n GH_TOKEN: ${{ github.token }}\n shell: bash\n run: |\n set -euo pipefail\n latest_success=\"$(gh run list --workflow source-audit.yml --status success --limit 1 --json updatedAt --jq '.[0].updatedAt // empty')\"\n issue_json=\"$(gh issue view 4 --json state,updatedAt,body)\"\n issue_state=\"$(jq -r '.state' <<< \"$issue_json\")\"\n issue_updated=\"$(jq -r '.updatedAt' <<< \"$issue_json\")\"\n issue_body=\"$(jq -r '.body' <<< \"$issue_json\")\"\n test \"$issue_state\" = \"OPEN\"\n grep -F '' <<< \"$issue_body\" >/dev/null\n LATEST_SUCCESS=\"$latest_success\" ISSUE_UPDATED=\"$issue_updated\" node --input-type=module <<'NODE'\n const maximumAgeMs = 14 * 60 * 60 * 1000;\n const now = Date.now();\n for (const [label, value] of Object.entries({\n \"source audit success\": process.env.LATEST_SUCCESS,\n \"source health issue\": process.env.ISSUE_UPDATED,\n })) {\n const timestamp = Date.parse(value ?? \"\");\n if (!Number.isFinite(timestamp) || now - timestamp > maximumAgeMs) {\n throw new Error(`${label} is stale or missing: ${value ?? \"missing\"}`);\n }\n }\n NODE\n\n - name: Run monitor check\n id: monitor\n shell: bash\n run: |\n set -euo pipefail\n npm run --silent monitor:check > \"$RUNNER_TEMP/monitor.json\" || true\n jq -e . \"$RUNNER_TEMP/monitor.json\" >/dev/null\n status=\"$(jq -r '.status // \"critical\"' \"$RUNNER_TEMP/monitor.json\")\"\n echo \"status=$status\" >> \"$GITHUB_OUTPUT\"\n jq . \"$RUNNER_TEMP/monitor.json\"\n\n - name: Upload monitor evidence\n uses: actions/upload-artifact@v7\n with:\n name: monitor-${{ github.run_id }}\n path: ${{ runner.temp }}/monitor.json\n retention-days: 7\n\n - name: Update the single monitor incident\n if: steps.monitor.outputs.status == 'critical'\n env:\n GH_TOKEN: ${{ github.token }}\n shell: bash\n run: |\n set -euo pipefail\n report=\"$RUNNER_TEMP/monitor.json\"\n body=\"$RUNNER_TEMP/monitor-issue.md\"\n {\n echo ''\n echo '# Agent Pulse 自动监控告警'\n echo\n echo \"- 时间:$(jq -r '.timestamp' \"$report\")\"\n echo \"- 系统分:$(jq -r '.systemScore' \"$report\") / 100\"\n echo \"- 状态:$(jq -r '.status' \"$report\")\"\n echo\n echo '## 问题'\n jq -r '.issues[]? | \"- \" + .' \"$report\"\n echo\n echo '## 建议动作'\n jq -r '.recommendations[]? | \"- \" + .' \"$report\"\n echo\n echo \"[查看本次 Actions 运行](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})\"\n } > \"$body\"\n gh label create \"monitor:critical\" --color d73a4a --description \"Automated critical monitor incident\" --force\n issue=\"$(gh issue list --state open --label 'monitor:critical' --limit 1 --json number --jq '.[0].number // empty')\"\n if [[ -n \"$issue\" ]]; then\n gh issue edit \"$issue\" --body-file \"$body\"\n else\n gh issue create --title \"[Monitor] Agent Pulse critical health incident\" --label \"monitor:critical\" --body-file \"$body\"\n fi\n"}, "454042afe03e1138f6e71d0cb4db9c5618ad3f68": {"t": 1785769832.5219512, "n": 2892, "h": "4f739a8b92fa3e97", "c": "name: Monitor system health\n\non:\n schedule:\n - cron: \"*/30 * * * *\"\n workflow_dispatch:\n\npermissions:\n contents: read\n issues: write\n\nconcurrency:\n group: agent-pulse-monitor-main\n cancel-in-progress: true\n\nenv:\n DATABASE_URL: sqlite:./var/monitor-check.db\n PUBLIC_SITE_URL: https://barretlee.github.io/agent-pulse/\n\njobs:\n check:\n runs-on: ubuntu-latest\n timeout-minutes: 10\n steps:\n - name: Check out main\n uses: actions/checkout@v7\n with:\n ref: main\n\n - name: Set up Node.js\n uses: actions/setup-node@v6\n with:\n node-version: 24\n cache: npm\n\n - name: Install locked dependencies\n run: npm ci\n\n - name: Restore auditable repository snapshot\n run: npm run db:snapshot -- restore\n\n - name: Run monitor check\n id: monitor\n shell: bash\n run: |\n set -euo pipefail\n npm run --silent monitor:check > \"$RUNNER_TEMP/monitor.json\" || true\n jq -e . \"$RUNNER_TEMP/monitor.json\" >/dev/null\n status=\"$(jq -r '.status // \"critical\"' \"$RUNNER_TEMP/monitor.json\")\"\n echo \"status=$status\" >> \"$GITHUB_OUTPUT\"\n jq . \"$RUNNER_TEMP/monitor.json\"\n\n - name: Upload monitor evidence\n uses: actions/upload-artifact@v7\n with:\n name: monitor-${{ github.run_id }}\n path: ${{ runner.temp }}/monitor.json\n retention-days: 7\n\n - name: Update the single monitor incident\n if: steps.monitor.outputs.status == 'critical'\n env:\n GH_TOKEN: ${{ github.token }}\n shell: bash\n run: |\n set -euo pipefail\n report=\"$RUNNER_TEMP/monitor.json\"\n body=\"$RUNNER_TEMP/monitor-issue.md\"\n {\n echo ''\n echo '# Agent Pulse 自动监控告警'\n echo\n echo \"- 时间:$(jq -r '.timestamp' \"$report\")\"\n echo \"- 系统分:$(jq -r '.systemScore' \"$report\") / 100\"\n echo \"- 状态:$(jq -r '.status' \"$report\")\"\n echo\n echo '## 问题'\n jq -r '.issues[]? | \"- \" + .' \"$report\"\n echo\n echo '## 建议动作'\n jq -r '.recommendations[]? | \"- \" + .' \"$report\"\n echo\n echo \"[查看本次 Actions 运行](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})\"\n } > \"$body\"\n gh label create \"monitor:critical\" --color d73a4a --description \"Automated critical monitor incident\" --force\n issue=\"$(gh issue list --state open --label 'monitor:critical' --limit 1 --json number --jq '.[0].number // empty')\"\n if [[ -n \"$issue\" ]]; then\n gh issue edit \"$issue\" --body-file \"$body\"\n else\n gh issue create --title \"[Monitor] Agent Pulse critical health incident\" --label \"monitor:critical\" --body-file \"$body\"\n fi\n"}}}}