Keep reconnect on the existing run id so a dropped stream does not start a second task. Co-authored-by: Cursor <cursoragent@cursor.com>
16 lines
758 B
TypeScript
16 lines
758 B
TypeScript
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import test from 'node:test';
|
|
|
|
test('chat and task attempts live in one hook', () => {
|
|
const app = readFileSync(new URL('../App.tsx', import.meta.url), 'utf8');
|
|
const hook = readFileSync(new URL('./useTaskRunAttempts.ts', import.meta.url), 'utf8');
|
|
assert.equal((app.match(/useTaskRunAttempts\(/g) || []).length, 1);
|
|
assert.equal(app.includes('streamChat('), false);
|
|
assert.equal(app.includes('createTaskRun('), false);
|
|
assert.equal(hook.includes('streamChat'), true);
|
|
assert.equal(hook.includes('createTaskRun'), true);
|
|
assert.equal(hook.includes('shouldSubscribeExistingRun'), true);
|
|
assert.equal(hook.includes('禁止无条件 setRunId(null)'), true);
|
|
});
|