feat(coding): add PI-105 product file host API
This commit is contained in:
@@ -95,6 +95,10 @@ import {
|
||||
} from '../image-workspace/local-workspace';
|
||||
import { WorksSquareDesignWorkspace } from '../image-workspace/works-square-workspace';
|
||||
import type { DesignWorkspaceModule } from '../image-workspace/module';
|
||||
import { CodingAttachmentStore } from '../coding-projects/attachment-store';
|
||||
import { PiProductTools } from '../coding-runtime/pi/product-tools';
|
||||
import { resolveBundledCodingSkillsDir } from '../coding-runtime/pi/resource-loader';
|
||||
import { createCodingProductHost } from '../api/coding-product-services';
|
||||
|
||||
// Diagnostic package: force Chromium networking onto HTTP/1.1 for transport A/B testing.
|
||||
app.commandLine.appendSwitch('disable-http2');
|
||||
@@ -549,6 +553,29 @@ async function initialize(): Promise<void> {
|
||||
window.webContents.send('release-job:status', status);
|
||||
}
|
||||
});
|
||||
const codingAttachments = new CodingAttachmentStore(
|
||||
join(app.getPath('userData'), 'coding-runtime', 'attachments'),
|
||||
);
|
||||
const piProductTools = new PiProductTools({
|
||||
browser: agentBrowser,
|
||||
attachments: codingAttachments,
|
||||
bundledSkillsDir: resolveBundledCodingSkillsDir({
|
||||
isPackaged: app.isPackaged,
|
||||
resourcesPath: process.resourcesPath,
|
||||
appPath: app.getAppPath(),
|
||||
}),
|
||||
});
|
||||
const codingProducts = {
|
||||
attachments: codingAttachments,
|
||||
productTools: piProductTools,
|
||||
host: createCodingProductHost({
|
||||
productTools: piProductTools,
|
||||
getActiveProject: async () => {
|
||||
const project = await opencodeProjectStore.getActiveProject();
|
||||
return project ? { id: project.id, path: project.path } : null;
|
||||
},
|
||||
}),
|
||||
};
|
||||
const hostApiContext: HostApiContext = {
|
||||
opencodeManager,
|
||||
opencodeProjectStore,
|
||||
@@ -559,6 +586,7 @@ async function initialize(): Promise<void> {
|
||||
imageWorkspace,
|
||||
lifecycle: backgroundLifecycle,
|
||||
releaseJobs,
|
||||
codingProducts,
|
||||
};
|
||||
registerIpcHandlers(undefined, opencodeManager, undefined, window, backgroundLifecycle, hostApiContext);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user