feat(web): add notebook chat panel (#8)
This commit is contained in:
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{"type":"system","subtype":"init","session_id":"11111111-1111-4111-8111-111111111111"}
|
||||
{"type":"stream_event","event":{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello notebook"}}}
|
||||
{"type":"assistant","message":{"content":[{"type":"text","text":"Hello notebook"},{"type":"tool_use","id":"tool-1","name":"Edit","input":{"file_path":"notebooks/setup/nginx.md","old_string":"private contents","new_string":"other contents"}}]}}
|
||||
{"type":"result","subtype":"success","is_error":false,"session_id":"11111111-1111-4111-8111-111111111111","total_cost_usd":0.002,"duration_ms":1234,"result":"Hello notebook"}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// Test-only executable. No external network or real CLI calls.
|
||||
const fs = require('node:fs');
|
||||
let input = '';
|
||||
process.stdin.on('data', chunk => input += chunk);
|
||||
process.stdin.on('end', () => {
|
||||
const message = JSON.parse(input).message.content;
|
||||
if (message === 'hang') { setInterval(() => {}, 1000); return; }
|
||||
if (message === 'login') { console.log(JSON.stringify({ type: 'result', subtype: 'error_during_execution', is_error: true, result: 'Not logged in · Please run /login' })); process.exitCode = 1; return; }
|
||||
if (message === 'stderr-login') { process.stderr.write('Authentication required'); process.exitCode = 1; return; }
|
||||
if (message === 'bad') { console.log('not JSON'); return; }
|
||||
if (message === 'huge') { process.stdout.write('x'.repeat(1024 * 1024 + 1)); return; }
|
||||
if (message === 'failed') { process.exitCode = 2; return; }
|
||||
const lines = fs.readFileSync(__dirname + '/chat.jsonl', 'utf8');
|
||||
process.stdout.write(lines);
|
||||
});
|
||||
Reference in New Issue
Block a user