@cliphijack/santaclaude 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/santaclaude.js +11 -3
package/package.json
CHANGED
package/santaclaude.js
CHANGED
|
@@ -75,10 +75,18 @@ async function run(conf) {
|
|
|
75
75
|
post(api, '/api/heartbeat', { token, pane }).catch(() => {});
|
|
76
76
|
const d = await post(api, '/api/jobs/claim', { token });
|
|
77
77
|
for (const j of (d.jobs || [])) {
|
|
78
|
-
|
|
78
|
+
// 잡의 대상 세션 우선, 없으면 기본 pane. 대상 세션이 없으면 기본 pane으로 폴백
|
|
79
|
+
let tpane = (j.target && String(j.target).trim()) || pane;
|
|
80
|
+
if (!paneExists(tpane)) {
|
|
81
|
+
if (conf.spawn !== false && tpane !== pane) {
|
|
82
|
+
try { spawnClaude(String(tpane).split(':')[0], claudeCmd); console.log(` 🦌 대상 "${tpane}" 세션이 없어서 새로 띄웠어 (tmux attach 로 로그인 1회).`); }
|
|
83
|
+
catch (e) { tpane = pane; }
|
|
84
|
+
} else if (!paneExists(tpane)) { tpane = pane; }
|
|
85
|
+
}
|
|
86
|
+
if (!paneExists(tpane)) { if (!warned) { console.warn(` ⚠️ 주입할 세션 "${tpane}" 없음 — 보류`); warned = true; } continue; }
|
|
79
87
|
warned = false;
|
|
80
|
-
console.log(`[발사] ${new Date().toISOString()} → ${
|
|
81
|
-
inject(
|
|
88
|
+
console.log(`[발사] ${new Date().toISOString()} → ${tpane}: ${String(j.message).slice(0, 60)}`);
|
|
89
|
+
inject(tpane, '[SantaClaude] ' + j.message);
|
|
82
90
|
}
|
|
83
91
|
} catch (e) { console.error('[폴링 오류]', e.message); }
|
|
84
92
|
}
|