fix(pi): resolve packaged proxy token lazily

This commit is contained in:
2026-08-24 21:41:29 +08:00
parent fa510c4976
commit f902edefd0
13 changed files with 934 additions and 30 deletions

View File

@@ -102,9 +102,11 @@ describe('PI-100 coding core Host contract', () => {
const projectPath = await mkdtemp(path.join(tmpdir(), 'makelore-pi-composition-project-'));
const userDataDir = await mkdtemp(path.join(tmpdir(), 'makelore-pi-composition-user-'));
roots.push(projectPath, userDataDir);
const getLocalProxyCredential = vi.fn(() => 'host-token-after-server-start');
const composition = createCodingComposition({
storage: createMemoryCodingProjectStorage(),
browser: { close: vi.fn(async () => undefined) } as unknown as AgentBrowserModule,
getLocalProxyCredential,
paths: {
executablePath: process.execPath,
cliPath: path.join(projectPath, 'unused-cli.js'),
@@ -131,10 +133,12 @@ describe('PI-100 coding core Host contract', () => {
title: 'Local only',
});
expect(composition.runtime.getDiagnostics().workers).toEqual([]);
expect(getLocalProxyCredential).not.toHaveBeenCalled();
expect(await composition.host.listCommands(conversation.id)).toEqual(
expect.arrayContaining([expect.objectContaining({ name: 'compact', source: 'makelore' })]),
);
expect(composition.runtime.getDiagnostics().workers).toEqual([]);
expect(getLocalProxyCredential).not.toHaveBeenCalled();
} finally {
await composition.shutdown();
}