feat(coding-runtime): add managed Pi extension host

This commit is contained in:
2026-08-23 09:39:12 +08:00
parent 47159b3cbd
commit 3861c3286a
22 changed files with 1673 additions and 16 deletions

View File

@@ -127,6 +127,19 @@ export class PiRpcClient {
throw lastError;
}
async send(command: PiRpcCommand): Promise<void> {
if (!command.type) throw new Error('Pi RPC command type is required');
if (this.invalidated) throw this.invalidated;
try {
await this.write(`${JSON.stringify(command)}\n`);
} catch (error) {
throw new PiProcessError('PI_RPC_WRITE_FAILED', `Could not write Pi RPC ${command.type}`, {
cause: error,
generation: this.generation,
});
}
}
accept(value: unknown): void {
if (!recordValue(value) || typeof value.type !== 'string') {
throw new PiProcessError('PI_RPC_PROTOCOL_ERROR', 'Pi RPC record must be an object with a type');