fix(ipc): register credentials + oauth handlers in main runtime
The `registerCredentialIpcHandlers` and `registerOAuthIpcHandlers` entry points existed in `ipc-credentials-handlers.ts` and `ipc-oauth-handlers.ts` but were never called — `registerHandlers()` in `main-runtime-support.ts` only wired `registerCoreHandlers` and `registerDomainHandlers`. The result: every renderer call to `credentials:list` / `credentials:save` / `credentials:remove` / `credentials:test` / `oauth:start` / `oauth:cancel` / `oauth:prompt-response` / `oauth:manual-code-response` crashed with "No handler registered". Wire both handler families against the PiRuntimeServices container (credentialStore, credentialResolver, oauthLoginService) already exposed via `serviceGraph.getPiRuntime()`. The refreshConnectorHealth callback reuses the existing connectorHealthService so status badges flip between `ready` and `auth_required` immediately after a save/login. typecheck 0 / lint 0-0 / build 0-0 / test:unit 508/508 preserved.
This commit is contained in:
1 parent
e94939a562
commit
84a3520ea8
1 file changed
+27
@@ -9,6 +9,9 @@ import type { AppDatabase } from "./database";
|
||||
import { seedDefaultAutomationRules as seedDefaultAutomationRulesImpl } from "./default-automation-rules";
|
||||
import { registerCoreHandlers } from "./ipc-core-handlers";
|
||||
import { registerDomainHandlers } from "./ipc-domain-handlers";
|
||||
import { registerCredentialIpcHandlers } from "./ipc-credentials-handlers";
|
||||
import { registerOAuthIpcHandlers } from "./ipc-oauth-handlers";
|
||||
import { fail } from "./ipc-core-common";
|
||||
import type { ThreadIntegrationService } from "./thread-integration";
|
||||
|
||||
type BootstrapResult = Awaited<ReturnType<typeof bootstrapApplication>>;
|
||||
@@ -187,6 +190,30 @@ export function createMainRuntimeSupport(state: MainRuntimeState) {
|
||||
publishDomainChanged();
|
||||
},
|
||||
});
|
||||
|
||||
const piRuntime = requireServiceGraph().getPiRuntime();
|
||||
if (!piRuntime) {
|
||||
throw new Error("Pi-mono runtime services are not initialized.");
|
||||
}
|
||||
|
||||
registerCredentialIpcHandlers({
|
||||
store: piRuntime.credentialStore,
|
||||
resolver: piRuntime.credentialResolver,
|
||||
registerHandle: requireIpcSupport().registerHandle,
|
||||
emitEvent,
|
||||
refreshConnectorHealth: async (connectorId) => {
|
||||
await requireConnectorHealthService().checkConnector(connectorId as ConnectorId);
|
||||
},
|
||||
fail,
|
||||
logger: log,
|
||||
});
|
||||
|
||||
registerOAuthIpcHandlers({
|
||||
service: piRuntime.oauthLoginService,
|
||||
registerHandle: requireIpcSupport().registerHandle,
|
||||
fail,
|
||||
logger: log,
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user