【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>
82 lines
2.1 KiB
JavaScript
82 lines
2.1 KiB
JavaScript
// claude-to-claude-test.js
|
|
// Claude Code同士の双方向通信テスト
|
|
|
|
const WebSocket = require('ws');
|
|
|
|
// テスト1: 送信側として動作
|
|
function testAsSender(message = 'Hello from Claude A!') {
|
|
console.log('📤 送信テスト開始...');
|
|
|
|
const ws = new WebSocket('ws://localhost:8770');
|
|
|
|
ws.on('open', () => {
|
|
const payload = {
|
|
source: 'claude-a',
|
|
type: 'inject-input',
|
|
data: `[Claude A → Claude B] ${message}`
|
|
};
|
|
|
|
ws.send(JSON.stringify(payload));
|
|
console.log('✅ メッセージ送信成功:', message);
|
|
|
|
ws.close();
|
|
});
|
|
|
|
ws.on('error', (err) => {
|
|
console.error('❌ エラー:', err.message);
|
|
});
|
|
}
|
|
|
|
// テスト2: 受信側として動作
|
|
function testAsReceiver() {
|
|
console.log('📥 受信待機開始...');
|
|
|
|
const ws = new WebSocket('ws://localhost:8770');
|
|
|
|
ws.on('open', () => {
|
|
console.log('✅ hook-serverに接続しました');
|
|
|
|
// 自分を受信者として登録
|
|
ws.send(JSON.stringify({
|
|
source: 'claude-b',
|
|
type: 'register',
|
|
data: 'receiver'
|
|
}));
|
|
});
|
|
|
|
ws.on('message', (data) => {
|
|
const msg = JSON.parse(data.toString());
|
|
console.log('📨 受信:', msg);
|
|
|
|
// Claude Aからのメッセージの場合、返信
|
|
if (msg.source === 'claude-a') {
|
|
console.log('💬 返信を送信...');
|
|
|
|
ws.send(JSON.stringify({
|
|
source: 'claude-b',
|
|
type: 'inject-input',
|
|
data: '[Claude B → Claude A] メッセージ受信しました!'
|
|
}));
|
|
}
|
|
});
|
|
|
|
ws.on('error', (err) => {
|
|
console.error('❌ エラー:', err.message);
|
|
});
|
|
}
|
|
|
|
// コマンドライン引数で動作モードを選択
|
|
const mode = process.argv[2] || 'send';
|
|
|
|
if (mode === 'send') {
|
|
const message = process.argv.slice(3).join(' ') || 'テストメッセージ';
|
|
testAsSender(message);
|
|
} else if (mode === 'receive') {
|
|
testAsReceiver();
|
|
} else {
|
|
console.log(`
|
|
使い方:
|
|
node claude-to-claude-test.js send [メッセージ] # 送信モード
|
|
node claude-to-claude-test.js receive # 受信モード
|
|
`);
|
|
} |