feat(coding-runtime): add managed Pi extension host
This commit is contained in:
1 parent
47159b3cbd
commit
3861c3286a
22 files changed
+1673
-16
No files matched your search
@@ -26,6 +26,7 @@ import type {
|
||||
} from '../../electron/coding-runtime/pi/rpc-client';
|
||||
import type { PiWorkerProcessOptions } from '../../electron/coding-runtime/pi/worker-process';
|
||||
import type { PiRuntimeTelemetryEvent } from '../../electron/coding-runtime/pi/telemetry';
|
||||
import { PiManagedExtensionHost } from '../../electron/coding-runtime/pi/extension-host';
|
||||
|
||||
const roots: string[] = [];
|
||||
const NOW = '2026-08-22T16:00:00.000Z';
|
||||
@@ -54,6 +55,8 @@ class OpenerFakeProcess implements PiWorkerProcessAdapter {
|
||||
};
|
||||
}
|
||||
|
||||
async send(_command: PiRpcCommand): Promise<void> {}
|
||||
|
||||
subscribe(_listener: (event: PiRpcEvent) => void): () => void { return () => undefined; }
|
||||
subscribeInvalidation(_listener: (error: PiProcessError) => void): () => void { return () => undefined; }
|
||||
async stop() { return { mode: 'stdin-close' as const, code: 0, signal: null }; }
|
||||
@@ -118,12 +121,14 @@ describe('managed Pi worker opener', () => {
|
||||
const processOptions: PiWorkerProcessOptions[] = [];
|
||||
const telemetry: PiRuntimeTelemetryEvent[] = [];
|
||||
const registry = new PiSessionRegistry({ projectStore });
|
||||
const extensionHost = new PiManagedExtensionHost();
|
||||
const opener = createPiManagedWorkerOpener({
|
||||
registry,
|
||||
executablePath: 'electron.exe',
|
||||
cliPath: 'pi-cli.js',
|
||||
userDataDir,
|
||||
bundledSkillsDir: path.resolve('resources/coding-skills'),
|
||||
extensionHost,
|
||||
loadProviderInput: async () => ({ accounts: [account], modelSummaries: [] }),
|
||||
resolveCredential: async () => 'provider-secret-value',
|
||||
createSessionKey: () => 'session-key-a',
|
||||
@@ -155,10 +160,15 @@ describe('managed Pi worker opener', () => {
|
||||
expect(argv).toContain('--system-prompt');
|
||||
expect(argv).toContain('grilling');
|
||||
expect(argv).toContain('--session-id');
|
||||
expect(argv).toContain('--extension');
|
||||
expect(argv).toContain('makelore-runtime-v1.mjs');
|
||||
expect(options.additionalArgs?.filter((argument) => argument === '--extension')).toHaveLength(1);
|
||||
expect(argv).not.toContain('PRIVATE MANAGED PROMPT');
|
||||
expect(argv).not.toContain('provider-secret-value');
|
||||
expect(Object.values(options.env ?? {})).toContain('provider-secret-value');
|
||||
expect(options.sensitiveValues).toContain('provider-secret-value');
|
||||
expect(options.env?.MAKELORE_PI_BRIDGE_URL).toMatch(/^http:\/\/127\.0\.0\.1:/);
|
||||
expect(options.env?.MAKELORE_PI_CONTEXT_FILE).toContain('worker-');
|
||||
}
|
||||
const modelsFile = path.join(userDataDir, 'coding-runtime', 'pi', 'config', 'models.json');
|
||||
expect(await readFile(modelsFile, 'utf8')).not.toContain('provider-secret-value');
|
||||
@@ -169,5 +179,8 @@ describe('managed Pi worker opener', () => {
|
||||
expect(JSON.stringify(telemetry)).not.toContain(created.id);
|
||||
expect(JSON.stringify(telemetry)).not.toContain('PRIVATE MANAGED PROMPT');
|
||||
expect(JSON.stringify(telemetry)).not.toContain('provider-secret-value');
|
||||
await first.worker.stop();
|
||||
await reopened.worker.stop();
|
||||
await extensionHost.close();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user