Files
hakorune/tools/codex-tmux-driver/claude-tmux-controller.js
Moe Charm 4e1b595796 AI協調開発研究ドキュメントの完成と Phase 10.9-β 進捗
【AI協調開発研究】
- AI二重化モデルの学術論文draft完成(workshop_paper_draft.md)
- 「隠れた危機」分析とbirthの原則哲学化
- TyEnv「唯一の真実」協調会話を保存・研究資料に統合
- papers管理構造の整備(wip/under-review/published分離)

【Phase 10.9-β HostCall進捗】
- JitConfigBox: relax_numeric フラグ追加(i64→f64コアーション制御)
- HostcallRegistryBox: 署名検証・白黒リスト・コアーション対応
- JitHostcallRegistryBox: Nyash側レジストリ操作API
- Lower統合: env直読 → jit::config::current() 参照に統一
- 数値緩和設定: NYASH_JIT_HOSTCALL_RELAX_NUMERIC/Config.set_flag

【検証サンプル拡充】
- math.sin/cos/abs/min/max 関数スタイル(examples/jit_math_function_style_*.nyash)
- 境界ケース: 署名不一致・コアーション許可・mutating拒否サンプル
- E2E実証: String.length→allow, Array.push→fallback, math関数の署名一致観測

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-28 12:09:09 +09:00

67 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// claude-tmux-controller.js
// Claudeもtmuxで制御完璧な双方向通信
const { spawn } = require('child_process');
class ClaudeTmuxController {
constructor(sessionName = 'claude-8771') {
this.sessionName = sessionName;
}
// tmuxセッションでClaudeを起動
async start() {
console.log('🤖 Starting Claude in tmux...');
// 既存セッションを削除
await this.exec('tmux', ['kill-session', '-t', this.sessionName]).catch(() => {});
// 新しいセッションでclaude cliを起動
const cmd = [
'new-session', '-d', '-s', this.sessionName,
'claude' // claude CLI仮定
];
await this.exec('tmux', cmd);
console.log(`✅ Claude started in tmux session: ${this.sessionName}`);
await this.sleep(2000);
}
// tmux経由でテキストとEnterを送信
async sendMessage(text) {
console.log(`📤 Sending to Claude: "${text}"`);
await this.exec('tmux', ['send-keys', '-t', this.sessionName, text, 'Enter']);
}
// 画面をキャプチャ
async capture() {
const result = await this.exec('tmux', ['capture-pane', '-t', this.sessionName, '-p']);
return result.stdout;
}
// ヘルパー関数
exec(command, args) {
return new Promise((resolve, reject) => {
const proc = spawn(command, args);
let stdout = '';
let stderr = '';
proc.stdout.on('data', (data) => stdout += data);
proc.stderr.on('data', (data) => stderr += data);
proc.on('close', (code) => {
if (code !== 0) {
reject(new Error(`${command} exited with code ${code}: ${stderr}`));
} else {
resolve({ stdout, stderr });
}
});
});
}
sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
}
module.exports = ClaudeTmuxController;