mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
Extract subprocess execution and process contracts into @orca/process-host with explicit public entry points, independent checks, and one Node 18 compatible CommonJS runtime. Migrate application consumers and integrate package builds, dependency selection, import enforcement, and runtime resource staging. Preserve daemon startup ownership and profile isolation, and qualify development rebuild recovery and concurrent output publication. Remove unnecessary aliases, test forwarding exports, and a duplicate output scan. Validation: full typechecks, changed-code quality, package and artifact checks, native Windows builds/types plus 306 runtime tests, and independent native reviews. Matched full E2E controls on original main and unchanged reviewed head both pass all 17 applicable tests (nine skips). Earlier intermittent E2E failures are documented in the PR; no assertions were weakened. The final combined-tree audit preserves both branches with no import-boundary violations.
29 lines
1.3 KiB
TypeScript
29 lines
1.3 KiB
TypeScript
import { mkdtempSync, rmSync } from 'node:fs'
|
|
import { tmpdir } from 'node:os'
|
|
import path from 'node:path'
|
|
import { expect, it } from 'vitest'
|
|
import { runProcess } from '@orca/process-host'
|
|
import { writeSustainedAgentLoadScript } from './sustained-agent-typing-load-scripts'
|
|
|
|
it('paces the generated Unicode stream in bytes without splitting UTF-8 characters', async () => {
|
|
const directory = mkdtempSync(path.join(tmpdir(), 'orca-typing-stream-test-'))
|
|
try {
|
|
const script = path.join(directory, 'load.mjs')
|
|
writeSustainedAgentLoadScript(script, 'rate-test', directory)
|
|
const result = await runProcess({
|
|
program: process.execPath,
|
|
args: [script, '0', '4', '2', '0'],
|
|
timeoutMs: 10_000
|
|
})
|
|
expect(result.code, result.stderr).toBe(0)
|
|
expect(result.stdout).toContain('MWT_LOAD_DONE_rate-test_0')
|
|
expect(result.stdout).not.toContain('\uFFFD')
|
|
// Readiness/completion control sequences are outside the stream-byte budget.
|
|
expect(Buffer.byteLength(result.stdout)).toBeLessThanOrEqual(4 * 1024 * 2 + 512)
|
|
// Lower bound too: without it a generator that emits no stream bytes still passes.
|
|
expect(Buffer.byteLength(result.stdout)).toBeGreaterThan(4 * 1024 * 2 * 0.8)
|
|
} finally {
|
|
rmSync(directory, { recursive: true, force: true })
|
|
}
|
|
}, 15_000)
|