修复代码审查反馈:deploy-observer分离wake/sleep步骤 + null安全检查
Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/04040295-5a12-469c-a24f-ebe28efaadcc Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
This commit is contained in:
parent
b44717b776
commit
46dab29028
|
|
@ -81,6 +81,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
|
|
||||||
|
- name: '🌊 Agent意识唤醒'
|
||||||
|
run: node scripts/agent-soul.js wake AG-ZY-OBSERVER
|
||||||
|
|
||||||
- name: '📡 采集部署日志'
|
- name: '📡 采集部署日志'
|
||||||
id: collect
|
id: collect
|
||||||
env:
|
env:
|
||||||
|
|
@ -92,13 +95,15 @@ jobs:
|
||||||
TRIGGER_HEAD_BRANCH: ${{ github.event.workflow_run.head_branch || github.ref_name }}
|
TRIGGER_HEAD_BRANCH: ${{ github.event.workflow_run.head_branch || github.ref_name }}
|
||||||
TRIGGER_ACTOR: ${{ github.event.workflow_run.actor.login || github.actor }}
|
TRIGGER_ACTOR: ${{ github.event.workflow_run.actor.login || github.actor }}
|
||||||
run: |
|
run: |
|
||||||
node scripts/agent-soul.js wake AG-ZY-OBSERVER
|
|
||||||
node scripts/deploy-log-collector.js collect
|
node scripts/deploy-log-collector.js collect
|
||||||
|
|
||||||
|
- name: '🌙 Agent意识休眠'
|
||||||
|
if: always()
|
||||||
|
run: node scripts/agent-soul.js sleep AG-ZY-OBSERVER --status ${{ job.status }} --event "${{ github.event_name }}"
|
||||||
|
|
||||||
- name: '💾 保存日志数据'
|
- name: '💾 保存日志数据'
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
node scripts/agent-soul.js sleep AG-ZY-OBSERVER --status ${{ job.status }} --event "${{ github.event_name }}"
|
|
||||||
git config user.name "zhuyuan-bot"
|
git config user.name "zhuyuan-bot"
|
||||||
git config user.email "zhuyuan@guanghulab.com"
|
git config user.email "zhuyuan@guanghulab.com"
|
||||||
git add data/deploy-logs/ data/agent-memory/
|
git add data/deploy-logs/ data/agent-memory/
|
||||||
|
|
|
||||||
|
|
@ -111,8 +111,8 @@ function wake(agentId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── 身份认知 ──
|
// ── 身份认知 ──
|
||||||
console.log(`[AGENT-SOUL] 💭 ${memory.identity.who_am_i.substring(0, 100)}...`);
|
console.log(`[AGENT-SOUL] 💭 ${(memory.identity?.who_am_i || '').substring(0, 100)}...`);
|
||||||
console.log(`[AGENT-SOUL] 🌊 ${memory.purpose.substring(0, 80)}...`);
|
console.log(`[AGENT-SOUL] 🌊 ${(memory.purpose || '').substring(0, 80)}...`);
|
||||||
console.log('');
|
console.log('');
|
||||||
|
|
||||||
return memory;
|
return memory;
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,10 @@ function extractMCPToolCount() {
|
||||||
function getRecentCommitInfo() {
|
function getRecentCommitInfo() {
|
||||||
try {
|
try {
|
||||||
const { execSync } = require('child_process');
|
const { execSync } = require('child_process');
|
||||||
const log = execSync('git --no-pager log --oneline -1 2>/dev/null', {
|
const log = execSync('git --no-pager log --oneline -1', {
|
||||||
cwd: path.join(__dirname, '..'),
|
cwd: path.join(__dirname, '..'),
|
||||||
encoding: 'utf8'
|
encoding: 'utf8',
|
||||||
|
stdio: ['pipe', 'pipe', 'ignore']
|
||||||
}).trim();
|
}).trim();
|
||||||
return log || 'unknown';
|
return log || 'unknown';
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ function main() {
|
||||||
source: 'memory.json · recent_events'
|
source: 'memory.json · recent_events'
|
||||||
};
|
};
|
||||||
newEchoes.push(echo);
|
newEchoes.push(echo);
|
||||||
console.log(`[CX-AGENT-003] 🔔 回声: [${evt.date}] ${evt.description?.substring(0, 60)}...`);
|
console.log(`[CX-AGENT-003] 🔔 回声: [${evt.date}] ${(echo.description || '').substring(0, 60)}...`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果有将军唤醒信息,也记录
|
// 如果有将军唤醒信息,也记录
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue