@codex-app-sdk/electron 0.16.9 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -176,7 +176,7 @@ function u(e) {
176
176
  deleteConversation: (e) => t.invoke(c.deleteConversation, e),
177
177
  deleteTurn: (e) => t.invoke(c.deleteTurn, e),
178
178
  deleteQueuedPrompt: (e) => t.invoke(c.deleteQueuedPrompt, e),
179
- editTurn: (e, n) => t.invoke(c.editTurn, e, n),
179
+ editTurn: (e, n, r) => t.invoke(c.editTurn, e, n, r),
180
180
  forkTurn: (e) => t.invoke(c.forkTurn, e),
181
181
  getSnapshot: () => t.invoke(c.getSnapshot),
182
182
  interrupt: () => t.invoke(c.interrupt),
@@ -211,10 +211,10 @@ function u(e) {
211
211
  startChatGptDeviceCodeLogin: () => t.invoke(c.startChatGptDeviceCodeLogin),
212
212
  startChatGptLogin: () => t.invoke(c.startChatGptLogin),
213
213
  steerMessage: (e, n) => t.invoke(c.steerMessage, e, n),
214
- steerQueuedPrompt: (e, n) => t.invoke(c.steerQueuedPrompt, e, n),
214
+ steerQueuedPrompt: (e, n, r) => t.invoke(c.steerQueuedPrompt, e, n, r),
215
215
  unarchiveConversation: (e) => t.invoke(c.unarchiveConversation, e),
216
216
  updateConversationSettings: (e) => t.invoke(c.updateConversationSettings, e),
217
- updateQueuedPrompt: (e, n) => t.invoke(c.updateQueuedPrompt, e, n)
217
+ updateQueuedPrompt: (e, n, r) => t.invoke(c.updateQueuedPrompt, e, n, r)
218
218
  };
219
219
  }
220
220
  //#endregion
@@ -271,4 +271,4 @@ function h(e, t, n) {
271
271
  //#endregion
272
272
  export { m as a, i as c, a as d, o as f, p as i, r as l, d as n, u as o, f as r, l as s, h as t, s as u };
273
273
 
274
- //# sourceMappingURL=codex-electron-preload-C6b3Tzd7.js.map
274
+ //# sourceMappingURL=codex-electron-preload-CUvnvKBU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-electron-preload-CUvnvKBU.js","names":[],"sources":["../../src/typed-ipc.ts","../../src/codex-surface-ipc.ts","../../src/codex-native-renderer.ts","../../src/codex-electron-preload.ts"],"sourcesContent":["import type { TypedEventBus } from '@codex-app-sdk/core/events';\n\nexport type IpcRequest<Arguments extends unknown[] = unknown[], Result = unknown> = {\n args: Arguments;\n result: Result;\n};\n\nexport type IpcRequestArguments<Request> = Request extends IpcRequest<infer Arguments, unknown>\n ? Arguments\n : never;\n\nexport type IpcRequestResult<Request> = Request extends IpcRequest<unknown[], infer Result>\n ? Result\n : never;\n\nexport type IpcRendererPort = {\n invoke(channel: string, ...args: unknown[]): Promise<unknown>;\n on(channel: string, listener: (event: unknown, payload: unknown) => void): void;\n off(channel: string, listener: (event: unknown, payload: unknown) => void): void;\n};\n\nexport type IpcMainPort = {\n handle(channel: string, handler: (event: unknown, ...args: unknown[]) => unknown): void;\n removeHandler(channel: string): void;\n};\n\nexport type IpcEventSender = {\n send(channel: string, payload: unknown): void;\n};\n\ntype RequestName<Requests> = keyof Requests & string;\ntype EventName<Events> = keyof Events & string;\n\nexport class TypedIpcRenderer<Requests extends object, Events extends object> {\n constructor(private readonly port: IpcRendererPort) {}\n\n invoke<Name extends RequestName<Requests>>(\n channel: Name,\n ...args: IpcRequestArguments<Requests[Name]>\n ): Promise<IpcRequestResult<Requests[Name]>> {\n return this.port.invoke(channel, ...args) as Promise<IpcRequestResult<Requests[Name]>>;\n }\n\n on<Name extends EventName<Events>>(channel: Name, listener: (payload: Events[Name]) => void): () => void {\n const handler = (_event: unknown, payload: unknown) => listener(payload as Events[Name]);\n this.port.on(channel, handler);\n return () => this.port.off(channel, handler);\n }\n}\n\nexport type IpcMainHandlers<Requests extends object> = {\n [Name in keyof Requests]: (\n event: unknown,\n ...args: IpcRequestArguments<Requests[Name]>\n ) => IpcRequestResult<Requests[Name]> | Promise<IpcRequestResult<Requests[Name]>>;\n};\n\nexport class TypedIpcMain<Requests extends object> {\n private readonly registeredChannels = new Set<RequestName<Requests>>();\n\n constructor(private readonly port: IpcMainPort) {}\n\n handle<Name extends RequestName<Requests>>(\n channel: Name,\n handler: IpcMainHandlers<Pick<Requests, Name>>[Name],\n ): void {\n this.port.handle(channel, (event, ...args) => handler(\n event,\n ...args as IpcRequestArguments<Requests[Name]>,\n ));\n this.registeredChannels.add(channel);\n }\n\n removeHandler<Name extends RequestName<Requests>>(channel: Name): void {\n this.port.removeHandler(channel);\n this.registeredChannels.delete(channel);\n }\n\n dispose(): void {\n for (const channel of this.registeredChannels) {\n this.port.removeHandler(channel);\n }\n this.registeredChannels.clear();\n }\n}\n\nexport type IpcSenderPolicy = {\n /** Rejects an invocation before its handler runs when this returns false. */\n isTrustedSender?: (event: unknown) => boolean;\n};\n\nexport function registerIpcMainHandlers<Requests extends object>(\n port: IpcMainPort,\n handlers: IpcMainHandlers<Requests>,\n policy: IpcSenderPolicy = {},\n): () => void {\n const main = new TypedIpcMain<Requests>(port);\n const channels = Object.keys(handlers) as Array<RequestName<Requests>>;\n const { isTrustedSender } = policy;\n for (const channel of channels) {\n const handler = handlers[channel];\n main.handle(channel, isTrustedSender\n ? (event, ...args) => {\n if (!isTrustedSender(event)) throw new Error(`Rejected ${channel} from an untrusted sender`);\n return handler(event, ...args);\n }\n : handler);\n }\n return () => main.dispose();\n}\n\nexport function sendIpcEvent<Events extends object, Name extends EventName<Events>>(\n sender: IpcEventSender,\n channel: Name,\n payload: Events[Name],\n): void {\n sender.send(channel, payload);\n}\n\nexport function connectIpcEventsToBus<Events extends object>(\n renderer: Pick<TypedIpcRenderer<object, Events>, 'on'>,\n bus: TypedEventBus<Events>,\n channels: ReadonlyArray<EventName<Events>>,\n): () => void {\n const unsubscribers = channels.map((channel) => renderer.on(channel, (payload) => bus.emit(channel, payload)));\n return () => {\n for (const unsubscribe of unsubscribers) {\n unsubscribe();\n }\n };\n}\n","import {\n invokeCodexSurfaceBridgeOperation,\n type CodexSurfaceBridgeOperation,\n type CodexSurfaceBridgeTarget,\n} from '@codex-app-sdk/core/surface-bridge';\nimport type {\n CodexConversationHistory,\n CodexConversationPromptHistory,\n CodexConversationSummary,\n CodexSurfaceApprovalDecision,\n CodexSurfaceApprovalScope,\n CodexSurfaceChatGptDeviceCodeLogin,\n CodexSurfaceChatGptLogin,\n CodexSurfaceClientRequestResponse,\n CodexSurfaceEvent,\n CodexSurfaceModel,\n CodexSurfaceRateLimits,\n CodexSurfaceAccountUsage,\n ReadCodexRateLimitsOptions,\n ConsumeCodexRateLimitResetCreditOptions,\n CodexSurfaceRateLimitResetCreditResult,\n CodexSurfaceRendererApi,\n CodexSurfaceSnapshot,\n CreateCodexRendererConversationOptions,\n ListCodexConversationsOptions,\n ListCodexModelsOptions,\n CodexRendererSendMessageOptions,\n StartCodexReviewOptions,\n StartCodexLiveChatOptions,\n UpdateCodexConversationSettings,\n CodexSurfaceStatePatch,\n CodexVersionedSurfaceSnapshot,\n} from '@codex-app-sdk/core/surface';\nimport {\n isCodexSurfaceStatePatchSource,\n subscribeCodexSurfaceState,\n type CodexSurfaceStatePatchSource,\n} from '@codex-app-sdk/core/surface-bridge';\nimport {\n registerIpcMainHandlers,\n TypedIpcRenderer,\n type IpcEventSender,\n type IpcMainPort,\n type IpcRendererPort,\n type IpcRequest,\n type IpcSenderPolicy,\n} from './typed-ipc';\n\nexport type CodexSurfaceIpcOptions = IpcSenderPolicy & {\n resolveAttachment?: import('@codex-app-sdk/core/surface-bridge').CodexSurfaceBridgeAttachmentResolver;\n};\n\nconst channels = {\n archiveConversation: 'codex-surface:archive-conversation',\n cancelLogin: 'codex-surface:cancel-login',\n clearGoal: 'codex-surface:clear-goal',\n compactConversation: 'codex-surface:compact-conversation',\n connect: 'codex-surface:connect',\n continueInterruptedTurn: 'codex-surface:continue-interrupted-turn',\n createConversation: 'codex-surface:create-conversation',\n deleteConversation: 'codex-surface:delete-conversation',\n deleteTurn: 'codex-surface:delete-turn',\n deleteQueuedPrompt: 'codex-surface:delete-queued-prompt',\n editTurn: 'codex-surface:edit-turn',\n forkTurn: 'codex-surface:fork-turn',\n getSnapshot: 'codex-surface:get-snapshot',\n getVersionedSnapshot: 'codex-surface:get-versioned-snapshot',\n interrupt: 'codex-surface:interrupt',\n listConversations: 'codex-surface:list-conversations',\n listModels: 'codex-surface:list-models',\n logout: 'codex-surface:logout',\n readConversationHistory: 'codex-surface:read-conversation-history',\n readConversationPromptHistory: 'codex-surface:read-conversation-prompt-history',\n loadOlderConversationHistory: 'codex-surface:load-older-conversation-history',\n refreshAccount: 'codex-surface:refresh-account',\n readRateLimits: 'codex-surface:read-rate-limits',\n readAccountUsage: 'codex-surface:read-account-usage',\n consumeRateLimitResetCredit: 'codex-surface:consume-rate-limit-reset-credit',\n refreshConversations: 'codex-surface:refresh-conversations',\n renameConversation: 'codex-surface:rename-conversation',\n respondToClientRequest: 'codex-surface:respond-to-client-request',\n resolveApproval: 'codex-surface:resolve-approval',\n retryTurn: 'codex-surface:retry-turn',\n setGoal: 'codex-surface:set-goal',\n selectConversation: 'codex-surface:select-conversation',\n sendMessage: 'codex-surface:send-message',\n startReview: 'codex-surface:start-review',\n startLiveChat: 'codex-surface:start-live-chat',\n stopLiveChat: 'codex-surface:stop-live-chat',\n startChatGptDeviceCodeLogin: 'codex-surface:start-chatgpt-device-code-login',\n startChatGptLogin: 'codex-surface:start-chatgpt-login',\n steerMessage: 'codex-surface:steer-message',\n steerQueuedPrompt: 'codex-surface:steer-queued-prompt',\n unarchiveConversation: 'codex-surface:unarchive-conversation',\n updateConversationSettings: 'codex-surface:update-conversation-settings',\n updateQueuedPrompt: 'codex-surface:update-queued-prompt',\n stateChanged: 'codex-surface:state-changed',\n statePatch: 'codex-surface:state-patch',\n event: 'codex-surface:event',\n} as const;\n\ntype SurfaceRequests = {\n [channels.archiveConversation]: IpcRequest<[conversationId: string], CodexSurfaceSnapshot>;\n [channels.cancelLogin]: IpcRequest<[loginId?: string], CodexSurfaceSnapshot>;\n [channels.clearGoal]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.compactConversation]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.connect]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.continueInterruptedTurn]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.createConversation]: IpcRequest<[options?: CreateCodexRendererConversationOptions], CodexSurfaceSnapshot>;\n [channels.deleteConversation]: IpcRequest<[conversationId: string], CodexSurfaceSnapshot>;\n [channels.deleteTurn]: IpcRequest<[turnId: string], CodexSurfaceSnapshot>;\n [channels.deleteQueuedPrompt]: IpcRequest<[promptId: string], CodexSurfaceSnapshot>;\n [channels.editTurn]: IpcRequest<[turnId: string, content: string, options?: CodexRendererSendMessageOptions], CodexSurfaceSnapshot>;\n [channels.forkTurn]: IpcRequest<[turnId: string], CodexSurfaceSnapshot>;\n [channels.getSnapshot]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.getVersionedSnapshot]: IpcRequest<[], CodexVersionedSurfaceSnapshot | null>;\n [channels.interrupt]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.listConversations]: IpcRequest<[\n options?: ListCodexConversationsOptions,\n ], CodexConversationSummary[]>;\n [channels.listModels]: IpcRequest<[options?: ListCodexModelsOptions], CodexSurfaceModel[]>;\n [channels.logout]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.readConversationHistory]: IpcRequest<[conversationId?: string], CodexConversationHistory>;\n [channels.readConversationPromptHistory]: IpcRequest<[\n conversationId?: string,\n ], CodexConversationPromptHistory>;\n [channels.loadOlderConversationHistory]: IpcRequest<[conversationId?: string], import('@codex-app-sdk/core/surface').CodexConversationHistoryPage>;\n [channels.refreshAccount]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.readRateLimits]: IpcRequest<[options?: ReadCodexRateLimitsOptions], CodexSurfaceRateLimits>;\n [channels.consumeRateLimitResetCredit]: IpcRequest<[options: ConsumeCodexRateLimitResetCreditOptions], CodexSurfaceRateLimitResetCreditResult>;\n [channels.readAccountUsage]: IpcRequest<[], CodexSurfaceAccountUsage>;\n [channels.refreshConversations]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.renameConversation]: IpcRequest<[title: string], CodexSurfaceSnapshot>;\n [channels.respondToClientRequest]: IpcRequest<[response: CodexSurfaceClientRequestResponse], CodexSurfaceSnapshot>;\n [channels.resolveApproval]: IpcRequest<[\n approvalId: string,\n decision: CodexSurfaceApprovalDecision,\n scope?: CodexSurfaceApprovalScope,\n ], CodexSurfaceSnapshot>;\n [channels.retryTurn]: IpcRequest<[turnId: string], CodexSurfaceSnapshot>;\n [channels.setGoal]: IpcRequest<[objective: string, tokenBudget?: number | null], CodexSurfaceSnapshot>;\n [channels.selectConversation]: IpcRequest<[conversationId: string], CodexSurfaceSnapshot>;\n [channels.sendMessage]: IpcRequest<[prompt: string, options?: CodexRendererSendMessageOptions], CodexSurfaceSnapshot>;\n [channels.startReview]: IpcRequest<[options?: StartCodexReviewOptions], CodexSurfaceSnapshot>;\n [channels.startLiveChat]: IpcRequest<[conversationId: string, options: StartCodexLiveChatOptions], { sdp: string }>;\n [channels.stopLiveChat]: IpcRequest<[conversationId: string], void>;\n [channels.startChatGptDeviceCodeLogin]: IpcRequest<[], CodexSurfaceChatGptDeviceCodeLogin>;\n [channels.startChatGptLogin]: IpcRequest<[], CodexSurfaceChatGptLogin>;\n [channels.steerMessage]: IpcRequest<[\n prompt: string,\n options?: CodexRendererSendMessageOptions,\n ], CodexSurfaceSnapshot>;\n [channels.steerQueuedPrompt]: IpcRequest<[promptId: string, prompt?: string, options?: CodexRendererSendMessageOptions], CodexSurfaceSnapshot>;\n [channels.unarchiveConversation]: IpcRequest<[conversationId: string], CodexSurfaceSnapshot>;\n [channels.updateConversationSettings]: IpcRequest<[settings: UpdateCodexConversationSettings], CodexSurfaceSnapshot>;\n [channels.updateQueuedPrompt]: IpcRequest<[promptId: string, prompt: string, options?: CodexRendererSendMessageOptions], CodexSurfaceSnapshot>;\n};\n\ntype SurfaceEvents = {\n [channels.stateChanged]: CodexSurfaceSnapshot;\n [channels.statePatch]: CodexSurfaceStatePatch;\n [channels.event]: CodexSurfaceEvent;\n};\n\nexport type { CodexSurfaceRendererApi } from '@codex-app-sdk/core/surface';\n\ntype OptionalSurfaceOperation = 'loadOlderConversationHistory' | 'startLiveChat' | 'stopLiveChat';\n\nexport function registerCodexSurfaceIpc(\n port: IpcMainPort,\n sender: IpcEventSender,\n surface: Omit<CodexSurfaceBridgeTarget, OptionalSurfaceOperation>\n & Partial<Pick<CodexSurfaceBridgeTarget, OptionalSurfaceOperation>>\n & Partial<CodexSurfaceStatePatchSource>,\n options: CodexSurfaceIpcOptions = {},\n): () => void {\n // State crosses IPC as full snapshots until a renderer asks for a versioned\n // base; from then on it streams small patches. Older renderers never ask, and\n // surfaces without native patch support decline, so both keep snapshots.\n const patchSource = isCodexSurfaceStatePatchSource(surface) ? surface : null;\n let streamingPatches = false;\n const invoke = <Name extends CodexSurfaceBridgeOperation>(name: Name, args: readonly unknown[]) => {\n if (name === 'loadOlderConversationHistory' && !surface.loadOlderConversationHistory) {\n return Promise.reject(new Error('Conversation history paging is not available.'));\n }\n if ((name === 'startLiveChat' || name === 'stopLiveChat') && !surface[name]) {\n return Promise.reject(new Error('Live chat is not available.'));\n }\n return invokeCodexSurfaceBridgeOperation(\n surface as CodexSurfaceBridgeTarget,\n name,\n args,\n {\n operationLabel: channels[name],\n ...(options.resolveAttachment === undefined\n ? {}\n : { resolveAttachment: options.resolveAttachment }),\n },\n );\n };\n const unregisterHandlers = registerIpcMainHandlers<SurfaceRequests>(port, {\n [channels.archiveConversation]: (_event, ...args) => invoke('archiveConversation', args),\n [channels.cancelLogin]: (_event, ...args) => invoke('cancelLogin', args),\n [channels.clearGoal]: (_event, ...args) => invoke('clearGoal', args),\n [channels.compactConversation]: (_event, ...args) => invoke('compactConversation', args),\n [channels.connect]: (_event, ...args) => invoke('connect', args),\n [channels.continueInterruptedTurn]: (_event, ...args) => invoke('continueInterruptedTurn', args),\n [channels.createConversation]: (_event, ...args) => invoke('createConversation', args),\n [channels.deleteConversation]: (_event, ...args) => invoke('deleteConversation', args),\n [channels.deleteTurn]: (_event, ...args) => invoke('deleteTurn', args),\n [channels.deleteQueuedPrompt]: (_event, ...args) => invoke('deleteQueuedPrompt', args),\n [channels.editTurn]: (_event, ...args) => invoke('editTurn', args),\n [channels.forkTurn]: (_event, ...args) => invoke('forkTurn', args),\n [channels.getSnapshot]: (_event, ...args) => invoke('getSnapshot', args),\n [channels.getVersionedSnapshot]: async () => {\n if (!patchSource) return null;\n streamingPatches = true;\n return patchSource.getVersionedSnapshot();\n },\n [channels.interrupt]: (_event, ...args) => invoke('interrupt', args),\n [channels.listConversations]: (_event, ...args) => invoke('listConversations', args),\n [channels.listModels]: (_event, ...args) => invoke('listModels', args),\n [channels.logout]: (_event, ...args) => invoke('logout', args),\n [channels.readConversationHistory]: (_event, ...args) => invoke('readConversationHistory', args),\n [channels.readConversationPromptHistory]: (_event, ...args) => invoke('readConversationPromptHistory', args),\n [channels.loadOlderConversationHistory]: (_event, ...args) => invoke('loadOlderConversationHistory', args),\n [channels.refreshAccount]: (_event, ...args) => invoke('refreshAccount', args),\n [channels.readRateLimits]: (_event, ...args) => invoke('readRateLimits', args),\n [channels.consumeRateLimitResetCredit]: (_event, ...args) => invoke('consumeRateLimitResetCredit', args),\n [channels.readAccountUsage]: (_event, ...args) => invoke('readAccountUsage', args),\n [channels.refreshConversations]: (_event, ...args) => invoke('refreshConversations', args),\n [channels.renameConversation]: (_event, ...args) => invoke('renameConversation', args),\n [channels.respondToClientRequest]: (_event, ...args) => invoke('respondToClientRequest', args),\n [channels.resolveApproval]: (_event, ...args) => invoke('resolveApproval', args),\n [channels.retryTurn]: (_event, ...args) => invoke('retryTurn', args),\n [channels.setGoal]: (_event, ...args) => invoke('setGoal', args),\n [channels.selectConversation]: (_event, ...args) => invoke('selectConversation', args),\n [channels.sendMessage]: (_event, ...args) => invoke('sendMessage', args),\n [channels.startReview]: (_event, ...args) => invoke('startReview', args),\n [channels.startLiveChat]: (_event, ...args) => invoke('startLiveChat', args),\n [channels.stopLiveChat]: (_event, ...args) => invoke('stopLiveChat', args),\n [channels.startChatGptDeviceCodeLogin]: (_event, ...args) => invoke('startChatGptDeviceCodeLogin', args),\n [channels.startChatGptLogin]: (_event, ...args) => invoke('startChatGptLogin', args),\n [channels.steerMessage]: (_event, ...args) => invoke('steerMessage', args),\n [channels.steerQueuedPrompt]: (_event, ...args) => invoke('steerQueuedPrompt', args),\n [channels.unarchiveConversation]: (_event, ...args) => invoke('unarchiveConversation', args),\n [channels.updateConversationSettings]: (_event, ...args) => invoke('updateConversationSettings', args),\n [channels.updateQueuedPrompt]: (_event, ...args) => invoke('updateQueuedPrompt', args),\n }, options);\n const unsubscribeSnapshots = surface.onStateChange((snapshot) => {\n if (!streamingPatches) sender.send(channels.stateChanged, snapshot);\n });\n const unsubscribePatches = patchSource?.onStatePatch((patch) => {\n if (streamingPatches) sender.send(channels.statePatch, patch);\n });\n const unsubscribeState = () => {\n unsubscribePatches?.();\n unsubscribeSnapshots();\n };\n const unsubscribeEvents = surface.onEvent((event) => sender.send(channels.event, event));\n return () => {\n unsubscribeEvents();\n unsubscribeState();\n unregisterHandlers();\n };\n}\n\nexport function createCodexSurfaceRendererApi(port: IpcRendererPort): CodexSurfaceRendererApi {\n const renderer = new TypedIpcRenderer<SurfaceRequests, SurfaceEvents>(port);\n const getVersionedSnapshot = () => renderer.invoke(channels.getVersionedSnapshot);\n const onStatePatch = (listener: (patch: CodexSurfaceStatePatch) => void) => renderer.on(channels.statePatch, listener);\n const stateSource = { getVersionedSnapshot, onStatePatch };\n return {\n // Mirror patches in the renderer's own world: contextBridge copies every\n // value it passes, so a mirror kept in the preload would lose identity.\n getVersionedSnapshot,\n onStatePatch,\n archiveConversation: (conversationId) => renderer.invoke(channels.archiveConversation, conversationId),\n cancelLogin: (loginId) => renderer.invoke(channels.cancelLogin, loginId),\n clearGoal: () => renderer.invoke(channels.clearGoal),\n compactConversation: () => renderer.invoke(channels.compactConversation),\n connect: () => renderer.invoke(channels.connect),\n continueInterruptedTurn: () => renderer.invoke(channels.continueInterruptedTurn),\n createConversation: (options) => renderer.invoke(channels.createConversation, options),\n deleteConversation: (conversationId) => renderer.invoke(channels.deleteConversation, conversationId),\n deleteTurn: (turnId) => renderer.invoke(channels.deleteTurn, turnId),\n deleteQueuedPrompt: (promptId) => renderer.invoke(channels.deleteQueuedPrompt, promptId),\n editTurn: (turnId, content, options) => renderer.invoke(channels.editTurn, turnId, content, options),\n forkTurn: (turnId) => renderer.invoke(channels.forkTurn, turnId),\n getSnapshot: () => renderer.invoke(channels.getSnapshot),\n interrupt: () => renderer.invoke(channels.interrupt),\n listConversations: (options) => renderer.invoke(channels.listConversations, options),\n listModels: (options) => renderer.invoke(channels.listModels, options),\n logout: () => renderer.invoke(channels.logout),\n onEvent: (listener) => renderer.on(channels.event, listener),\n onStateChange: (listener) => {\n // Snapshots arrive until the main process switches to patches; the\n // switch point's base was already delivered as a snapshot, so it stays silent.\n const unsubscribeSnapshots = renderer.on(channels.stateChanged, listener);\n const unsubscribePatches = subscribeCodexSurfaceState(stateSource, listener, { emitInitialSnapshot: false });\n return () => {\n unsubscribePatches();\n unsubscribeSnapshots();\n };\n },\n readConversationHistory: (conversationId) => renderer.invoke(channels.readConversationHistory, conversationId),\n readConversationPromptHistory: (conversationId) => (\n renderer.invoke(channels.readConversationPromptHistory, conversationId)\n ),\n loadOlderConversationHistory: (conversationId) => renderer.invoke(channels.loadOlderConversationHistory, conversationId),\n refreshAccount: () => renderer.invoke(channels.refreshAccount),\n readRateLimits: (options) => renderer.invoke(channels.readRateLimits, options),\n consumeRateLimitResetCredit: (options) => renderer.invoke(channels.consumeRateLimitResetCredit, options),\n readAccountUsage: () => renderer.invoke(channels.readAccountUsage),\n refreshConversations: () => renderer.invoke(channels.refreshConversations),\n renameConversation: (title) => renderer.invoke(channels.renameConversation, title),\n respondToClientRequest: (response) => renderer.invoke(channels.respondToClientRequest, response),\n resolveApproval: (approvalId, decision, scope) => renderer.invoke(channels.resolveApproval, approvalId, decision, scope),\n retryTurn: (turnId) => renderer.invoke(channels.retryTurn, turnId),\n setGoal: (objective, tokenBudget) => renderer.invoke(channels.setGoal, objective, tokenBudget),\n selectConversation: (conversationId) => renderer.invoke(channels.selectConversation, conversationId),\n sendMessage: (prompt, options) => renderer.invoke(channels.sendMessage, prompt, options),\n startReview: (options) => renderer.invoke(channels.startReview, options),\n startLiveChat: (conversationId, options) => renderer.invoke(channels.startLiveChat, conversationId, options),\n stopLiveChat: (conversationId) => renderer.invoke(channels.stopLiveChat, conversationId),\n startChatGptDeviceCodeLogin: () => renderer.invoke(channels.startChatGptDeviceCodeLogin),\n startChatGptLogin: () => renderer.invoke(channels.startChatGptLogin),\n steerMessage: (prompt, options) => renderer.invoke(channels.steerMessage, prompt, options),\n steerQueuedPrompt: (promptId, prompt, options) => renderer.invoke(channels.steerQueuedPrompt, promptId, prompt, options),\n unarchiveConversation: (conversationId) => renderer.invoke(channels.unarchiveConversation, conversationId),\n updateConversationSettings: (settings) => renderer.invoke(channels.updateConversationSettings, settings),\n updateQueuedPrompt: (promptId, prompt, options) => renderer.invoke(channels.updateQueuedPrompt, promptId, prompt, options),\n };\n}\n","import type {\n CodexNativeAttachment,\n CodexNativeAttachmentInput,\n CodexNativeClipboardContent,\n CodexNativeRendererApi,\n CodexSpeechTranscriptionResult,\n CodexSpeechSessionOptions,\n CodexSpeechSessionEvent,\n} from '@codex-app-sdk/core/native';\nimport {\n TypedIpcRenderer,\n type IpcRendererPort,\n type IpcRequest,\n} from './typed-ipc';\n\nexport const codexNativeChannels = {\n copyToClipboard: 'codex-native:copy-to-clipboard',\n ingestAttachments: 'codex-native:ingest-attachments',\n openExternal: 'codex-native:open-external',\n pickAttachments: 'codex-native:pick-attachments',\n readImagePreview: 'codex-native:read-image-preview',\n transcribeAudio: 'codex-native:transcribe-audio',\n startSpeech: 'codex-native:start-speech',\n appendSpeech: 'codex-native:append-speech',\n stopSpeech: 'codex-native:stop-speech',\n cancelSpeech: 'codex-native:cancel-speech',\n} as const;\nexport const codexSpeechEventChannel = 'codex-native:speech-event';\n\nexport type CodexNativeRequests = {\n [codexNativeChannels.startSpeech]: IpcRequest<[options: CodexSpeechSessionOptions], void>;\n [codexNativeChannels.appendSpeech]: IpcRequest<[sessionId: string, audio: ArrayBuffer], void>;\n [codexNativeChannels.stopSpeech]: IpcRequest<[sessionId: string], CodexSpeechTranscriptionResult>;\n [codexNativeChannels.cancelSpeech]: IpcRequest<[sessionId: string], void>;\n [codexNativeChannels.copyToClipboard]: IpcRequest<[content: CodexNativeClipboardContent], void>;\n [codexNativeChannels.ingestAttachments]: IpcRequest<[\n files: readonly CodexNativeAttachmentInput[],\n ], CodexNativeAttachment[]>;\n [codexNativeChannels.openExternal]: IpcRequest<[href: string], void>;\n [codexNativeChannels.pickAttachments]: IpcRequest<[], CodexNativeAttachment[]>;\n [codexNativeChannels.readImagePreview]: IpcRequest<[path: string], string | null>;\n [codexNativeChannels.transcribeAudio]: IpcRequest<[\n audioData: ArrayBuffer,\n options?: { locale?: string; live?: boolean },\n ], CodexSpeechTranscriptionResult>;\n};\n\nexport type CodexContextBridge = {\n exposeInMainWorld(key: string, api: unknown): void;\n};\n\nexport function createCodexNativeRendererApi(\n port: IpcRendererPort,\n options: { transcription?: boolean; streamingTranscription?: boolean } = {},\n): CodexNativeRendererApi {\n const renderer = new TypedIpcRenderer<CodexNativeRequests, { [codexSpeechEventChannel]: CodexSpeechSessionEvent }>(port);\n const transcription = options.transcription ?? process.platform === 'darwin';\n return {\n capabilities: {\n attachments: true,\n clipboard: true,\n externalLinks: true,\n transcription,\n },\n ...(transcription && (options.streamingTranscription ?? process.platform === 'darwin') ? {\n streamingTranscription: {\n start: (input: CodexSpeechSessionOptions) => renderer.invoke(codexNativeChannels.startSpeech, input),\n append: (id: string, audio: ArrayBuffer) => renderer.invoke(codexNativeChannels.appendSpeech, id, audio),\n stop: (id: string) => renderer.invoke(codexNativeChannels.stopSpeech, id),\n cancel: (id: string) => renderer.invoke(codexNativeChannels.cancelSpeech, id),\n onEvent: (listener: (event: CodexSpeechSessionEvent) => void) => renderer.on(codexSpeechEventChannel, listener),\n },\n } : {}),\n copyToClipboard: (content) => renderer.invoke(codexNativeChannels.copyToClipboard, content),\n ingestAttachments: (files) => renderer.invoke(codexNativeChannels.ingestAttachments, files),\n openExternal: (href) => renderer.invoke(codexNativeChannels.openExternal, href),\n pickAttachments: () => renderer.invoke(codexNativeChannels.pickAttachments),\n readImagePreview: (path) => renderer.invoke(codexNativeChannels.readImagePreview, path),\n transcribeAudio: (audioData, transcriptionOptions) => (\n renderer.invoke(codexNativeChannels.transcribeAudio, audioData, transcriptionOptions)\n ),\n };\n}\n\nexport function exposeCodexNativeRendererApi(\n contextBridge: CodexContextBridge,\n port: IpcRendererPort,\n options?: { transcription?: boolean; streamingTranscription?: boolean },\n): CodexNativeRendererApi {\n const api = createCodexNativeRendererApi(port, options);\n contextBridge.exposeInMainWorld('codexAppSdkNative', api);\n return api;\n}\n","import type { CodexNativeRendererApi } from '@codex-app-sdk/core/native';\nimport type { CodexSurfaceRendererApi } from '@codex-app-sdk/core/surface';\nimport {\n createCodexNativeRendererApi,\n type CodexContextBridge,\n} from './codex-native-renderer';\nimport { createCodexSurfaceRendererApi } from './codex-surface-ipc';\nimport type { IpcRendererPort } from './typed-ipc';\n\nexport type CodexElectronRendererApis = {\n native: CodexNativeRendererApi;\n surface: CodexSurfaceRendererApi;\n};\n\n/** Exposes the SDK-owned renderer APIs under stable, automatically detected names. */\nexport function exposeCodexElectronPreload(\n contextBridge: CodexContextBridge,\n ipcRenderer: IpcRendererPort,\n options?: { transcription?: boolean },\n): CodexElectronRendererApis {\n const surface = createCodexSurfaceRendererApi(ipcRenderer);\n const native = createCodexNativeRendererApi(ipcRenderer, options);\n contextBridge.exposeInMainWorld('codexSurface', surface);\n contextBridge.exposeInMainWorld('codexAppSdkNative', native);\n return { native, surface };\n}\n"],"mappings":";;AAiCA,IAAa,IA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,OAAO,EAAoB,cAAc,GAAI,CAAK;GACvG,OAAO,MAAe,EAAS,OAAO,EAAoB,YAAY,CAAE;GACxE,SAAS,MAAe,EAAS,OAAO,EAAoB,cAAc,CAAE;GAC5E,UAAU,MAAuD,EAAS,GAAG,GAAyB,CAAQ;EAChH,EACF,IAAI,CAAC;EACL,kBAAkB,MAAY,EAAS,OAAO,EAAoB,iBAAiB,CAAO;EAC1F,oBAAoB,MAAU,EAAS,OAAO,EAAoB,mBAAmB,CAAK;EAC1F,eAAe,MAAS,EAAS,OAAO,EAAoB,cAAc,CAAI;EAC9E,uBAAuB,EAAS,OAAO,EAAoB,eAAe;EAC1E,mBAAmB,MAAS,EAAS,OAAO,EAAoB,kBAAkB,CAAI;EACtF,kBAAkB,GAAW,MAC3B,EAAS,OAAO,EAAoB,iBAAiB,GAAW,CAAoB;CAExF;AACF;AAEA,SAAgB,EACd,GACA,GACA,GACwB;CACxB,IAAM,IAAM,EAA6B,GAAM,CAAO;CAEtD,OADA,EAAc,kBAAkB,qBAAqB,CAAG,GACjD;AACT;;;AC7EA,SAAgB,EACd,GACA,GACA,GAC2B;CAC3B,IAAM,IAAU,EAA8B,CAAW,GACnD,IAAS,EAA6B,GAAa,CAAO;CAGhE,OAFA,EAAc,kBAAkB,gBAAgB,CAAO,GACvD,EAAc,kBAAkB,qBAAqB,CAAM,GACpD;EAAE;EAAQ;CAAQ;AAC3B"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./chunks/codex-electron-preload-C6b3Tzd7.js";
1
+ import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./chunks/codex-electron-preload-CUvnvKBU.js";
2
2
  import { promises as f } from "node:fs";
3
3
  import p from "node:os";
4
4
  import m from "node:path";
package/dist/preload.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, i as t, l as n, o as r, t as i } from "./chunks/codex-electron-preload-C6b3Tzd7.js";
1
+ import { a as e, i as t, l as n, o as r, t as i } from "./chunks/codex-electron-preload-CUvnvKBU.js";
2
2
  export { n as TypedIpcRenderer, t as createCodexNativeRendererApi, r as createCodexSurfaceRendererApi, i as exposeCodexElectronPreload, e as exposeCodexNativeRendererApi };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codex-app-sdk/electron",
3
- "version": "0.16.9",
3
+ "version": "0.17.0",
4
4
  "description": "Electron main, preload, IPC, and native capability adapter for Codex applications.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -37,8 +37,8 @@
37
37
  "typecheck": "tsc -p tsconfig.json --noEmit"
38
38
  },
39
39
  "dependencies": {
40
- "@codex-app-sdk/backend": "0.16.9",
41
- "@codex-app-sdk/core": "0.16.9"
40
+ "@codex-app-sdk/backend": "0.17.0",
41
+ "@codex-app-sdk/core": "0.17.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "electron": ">=30"
@@ -1 +0,0 @@
1
- {"version":3,"file":"codex-electron-preload-C6b3Tzd7.js","names":[],"sources":["../../src/typed-ipc.ts","../../src/codex-surface-ipc.ts","../../src/codex-native-renderer.ts","../../src/codex-electron-preload.ts"],"sourcesContent":["import type { TypedEventBus } from '@codex-app-sdk/core/events';\n\nexport type IpcRequest<Arguments extends unknown[] = unknown[], Result = unknown> = {\n args: Arguments;\n result: Result;\n};\n\nexport type IpcRequestArguments<Request> = Request extends IpcRequest<infer Arguments, unknown>\n ? Arguments\n : never;\n\nexport type IpcRequestResult<Request> = Request extends IpcRequest<unknown[], infer Result>\n ? Result\n : never;\n\nexport type IpcRendererPort = {\n invoke(channel: string, ...args: unknown[]): Promise<unknown>;\n on(channel: string, listener: (event: unknown, payload: unknown) => void): void;\n off(channel: string, listener: (event: unknown, payload: unknown) => void): void;\n};\n\nexport type IpcMainPort = {\n handle(channel: string, handler: (event: unknown, ...args: unknown[]) => unknown): void;\n removeHandler(channel: string): void;\n};\n\nexport type IpcEventSender = {\n send(channel: string, payload: unknown): void;\n};\n\ntype RequestName<Requests> = keyof Requests & string;\ntype EventName<Events> = keyof Events & string;\n\nexport class TypedIpcRenderer<Requests extends object, Events extends object> {\n constructor(private readonly port: IpcRendererPort) {}\n\n invoke<Name extends RequestName<Requests>>(\n channel: Name,\n ...args: IpcRequestArguments<Requests[Name]>\n ): Promise<IpcRequestResult<Requests[Name]>> {\n return this.port.invoke(channel, ...args) as Promise<IpcRequestResult<Requests[Name]>>;\n }\n\n on<Name extends EventName<Events>>(channel: Name, listener: (payload: Events[Name]) => void): () => void {\n const handler = (_event: unknown, payload: unknown) => listener(payload as Events[Name]);\n this.port.on(channel, handler);\n return () => this.port.off(channel, handler);\n }\n}\n\nexport type IpcMainHandlers<Requests extends object> = {\n [Name in keyof Requests]: (\n event: unknown,\n ...args: IpcRequestArguments<Requests[Name]>\n ) => IpcRequestResult<Requests[Name]> | Promise<IpcRequestResult<Requests[Name]>>;\n};\n\nexport class TypedIpcMain<Requests extends object> {\n private readonly registeredChannels = new Set<RequestName<Requests>>();\n\n constructor(private readonly port: IpcMainPort) {}\n\n handle<Name extends RequestName<Requests>>(\n channel: Name,\n handler: IpcMainHandlers<Pick<Requests, Name>>[Name],\n ): void {\n this.port.handle(channel, (event, ...args) => handler(\n event,\n ...args as IpcRequestArguments<Requests[Name]>,\n ));\n this.registeredChannels.add(channel);\n }\n\n removeHandler<Name extends RequestName<Requests>>(channel: Name): void {\n this.port.removeHandler(channel);\n this.registeredChannels.delete(channel);\n }\n\n dispose(): void {\n for (const channel of this.registeredChannels) {\n this.port.removeHandler(channel);\n }\n this.registeredChannels.clear();\n }\n}\n\nexport type IpcSenderPolicy = {\n /** Rejects an invocation before its handler runs when this returns false. */\n isTrustedSender?: (event: unknown) => boolean;\n};\n\nexport function registerIpcMainHandlers<Requests extends object>(\n port: IpcMainPort,\n handlers: IpcMainHandlers<Requests>,\n policy: IpcSenderPolicy = {},\n): () => void {\n const main = new TypedIpcMain<Requests>(port);\n const channels = Object.keys(handlers) as Array<RequestName<Requests>>;\n const { isTrustedSender } = policy;\n for (const channel of channels) {\n const handler = handlers[channel];\n main.handle(channel, isTrustedSender\n ? (event, ...args) => {\n if (!isTrustedSender(event)) throw new Error(`Rejected ${channel} from an untrusted sender`);\n return handler(event, ...args);\n }\n : handler);\n }\n return () => main.dispose();\n}\n\nexport function sendIpcEvent<Events extends object, Name extends EventName<Events>>(\n sender: IpcEventSender,\n channel: Name,\n payload: Events[Name],\n): void {\n sender.send(channel, payload);\n}\n\nexport function connectIpcEventsToBus<Events extends object>(\n renderer: Pick<TypedIpcRenderer<object, Events>, 'on'>,\n bus: TypedEventBus<Events>,\n channels: ReadonlyArray<EventName<Events>>,\n): () => void {\n const unsubscribers = channels.map((channel) => renderer.on(channel, (payload) => bus.emit(channel, payload)));\n return () => {\n for (const unsubscribe of unsubscribers) {\n unsubscribe();\n }\n };\n}\n","import {\n invokeCodexSurfaceBridgeOperation,\n type CodexSurfaceBridgeOperation,\n type CodexSurfaceBridgeTarget,\n} from '@codex-app-sdk/core/surface-bridge';\nimport type {\n CodexConversationHistory,\n CodexConversationPromptHistory,\n CodexConversationSummary,\n CodexSurfaceApprovalDecision,\n CodexSurfaceApprovalScope,\n CodexSurfaceChatGptDeviceCodeLogin,\n CodexSurfaceChatGptLogin,\n CodexSurfaceClientRequestResponse,\n CodexSurfaceEvent,\n CodexSurfaceModel,\n CodexSurfaceRateLimits,\n CodexSurfaceAccountUsage,\n ReadCodexRateLimitsOptions,\n ConsumeCodexRateLimitResetCreditOptions,\n CodexSurfaceRateLimitResetCreditResult,\n CodexSurfaceRendererApi,\n CodexSurfaceSnapshot,\n CreateCodexRendererConversationOptions,\n ListCodexConversationsOptions,\n ListCodexModelsOptions,\n CodexRendererSendMessageOptions,\n StartCodexReviewOptions,\n StartCodexLiveChatOptions,\n UpdateCodexConversationSettings,\n CodexSurfaceStatePatch,\n CodexVersionedSurfaceSnapshot,\n} from '@codex-app-sdk/core/surface';\nimport {\n isCodexSurfaceStatePatchSource,\n subscribeCodexSurfaceState,\n type CodexSurfaceStatePatchSource,\n} from '@codex-app-sdk/core/surface-bridge';\nimport {\n registerIpcMainHandlers,\n TypedIpcRenderer,\n type IpcEventSender,\n type IpcMainPort,\n type IpcRendererPort,\n type IpcRequest,\n type IpcSenderPolicy,\n} from './typed-ipc';\n\nexport type CodexSurfaceIpcOptions = IpcSenderPolicy & {\n resolveAttachment?: import('@codex-app-sdk/core/surface-bridge').CodexSurfaceBridgeAttachmentResolver;\n};\n\nconst channels = {\n archiveConversation: 'codex-surface:archive-conversation',\n cancelLogin: 'codex-surface:cancel-login',\n clearGoal: 'codex-surface:clear-goal',\n compactConversation: 'codex-surface:compact-conversation',\n connect: 'codex-surface:connect',\n continueInterruptedTurn: 'codex-surface:continue-interrupted-turn',\n createConversation: 'codex-surface:create-conversation',\n deleteConversation: 'codex-surface:delete-conversation',\n deleteTurn: 'codex-surface:delete-turn',\n deleteQueuedPrompt: 'codex-surface:delete-queued-prompt',\n editTurn: 'codex-surface:edit-turn',\n forkTurn: 'codex-surface:fork-turn',\n getSnapshot: 'codex-surface:get-snapshot',\n getVersionedSnapshot: 'codex-surface:get-versioned-snapshot',\n interrupt: 'codex-surface:interrupt',\n listConversations: 'codex-surface:list-conversations',\n listModels: 'codex-surface:list-models',\n logout: 'codex-surface:logout',\n readConversationHistory: 'codex-surface:read-conversation-history',\n readConversationPromptHistory: 'codex-surface:read-conversation-prompt-history',\n loadOlderConversationHistory: 'codex-surface:load-older-conversation-history',\n refreshAccount: 'codex-surface:refresh-account',\n readRateLimits: 'codex-surface:read-rate-limits',\n readAccountUsage: 'codex-surface:read-account-usage',\n consumeRateLimitResetCredit: 'codex-surface:consume-rate-limit-reset-credit',\n refreshConversations: 'codex-surface:refresh-conversations',\n renameConversation: 'codex-surface:rename-conversation',\n respondToClientRequest: 'codex-surface:respond-to-client-request',\n resolveApproval: 'codex-surface:resolve-approval',\n retryTurn: 'codex-surface:retry-turn',\n setGoal: 'codex-surface:set-goal',\n selectConversation: 'codex-surface:select-conversation',\n sendMessage: 'codex-surface:send-message',\n startReview: 'codex-surface:start-review',\n startLiveChat: 'codex-surface:start-live-chat',\n stopLiveChat: 'codex-surface:stop-live-chat',\n startChatGptDeviceCodeLogin: 'codex-surface:start-chatgpt-device-code-login',\n startChatGptLogin: 'codex-surface:start-chatgpt-login',\n steerMessage: 'codex-surface:steer-message',\n steerQueuedPrompt: 'codex-surface:steer-queued-prompt',\n unarchiveConversation: 'codex-surface:unarchive-conversation',\n updateConversationSettings: 'codex-surface:update-conversation-settings',\n updateQueuedPrompt: 'codex-surface:update-queued-prompt',\n stateChanged: 'codex-surface:state-changed',\n statePatch: 'codex-surface:state-patch',\n event: 'codex-surface:event',\n} as const;\n\ntype SurfaceRequests = {\n [channels.archiveConversation]: IpcRequest<[conversationId: string], CodexSurfaceSnapshot>;\n [channels.cancelLogin]: IpcRequest<[loginId?: string], CodexSurfaceSnapshot>;\n [channels.clearGoal]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.compactConversation]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.connect]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.continueInterruptedTurn]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.createConversation]: IpcRequest<[options?: CreateCodexRendererConversationOptions], CodexSurfaceSnapshot>;\n [channels.deleteConversation]: IpcRequest<[conversationId: string], CodexSurfaceSnapshot>;\n [channels.deleteTurn]: IpcRequest<[turnId: string], CodexSurfaceSnapshot>;\n [channels.deleteQueuedPrompt]: IpcRequest<[promptId: string], CodexSurfaceSnapshot>;\n [channels.editTurn]: IpcRequest<[turnId: string, content: string], CodexSurfaceSnapshot>;\n [channels.forkTurn]: IpcRequest<[turnId: string], CodexSurfaceSnapshot>;\n [channels.getSnapshot]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.getVersionedSnapshot]: IpcRequest<[], CodexVersionedSurfaceSnapshot | null>;\n [channels.interrupt]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.listConversations]: IpcRequest<[\n options?: ListCodexConversationsOptions,\n ], CodexConversationSummary[]>;\n [channels.listModels]: IpcRequest<[options?: ListCodexModelsOptions], CodexSurfaceModel[]>;\n [channels.logout]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.readConversationHistory]: IpcRequest<[conversationId?: string], CodexConversationHistory>;\n [channels.readConversationPromptHistory]: IpcRequest<[\n conversationId?: string,\n ], CodexConversationPromptHistory>;\n [channels.loadOlderConversationHistory]: IpcRequest<[conversationId?: string], import('@codex-app-sdk/core/surface').CodexConversationHistoryPage>;\n [channels.refreshAccount]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.readRateLimits]: IpcRequest<[options?: ReadCodexRateLimitsOptions], CodexSurfaceRateLimits>;\n [channels.consumeRateLimitResetCredit]: IpcRequest<[options: ConsumeCodexRateLimitResetCreditOptions], CodexSurfaceRateLimitResetCreditResult>;\n [channels.readAccountUsage]: IpcRequest<[], CodexSurfaceAccountUsage>;\n [channels.refreshConversations]: IpcRequest<[], CodexSurfaceSnapshot>;\n [channels.renameConversation]: IpcRequest<[title: string], CodexSurfaceSnapshot>;\n [channels.respondToClientRequest]: IpcRequest<[response: CodexSurfaceClientRequestResponse], CodexSurfaceSnapshot>;\n [channels.resolveApproval]: IpcRequest<[\n approvalId: string,\n decision: CodexSurfaceApprovalDecision,\n scope?: CodexSurfaceApprovalScope,\n ], CodexSurfaceSnapshot>;\n [channels.retryTurn]: IpcRequest<[turnId: string], CodexSurfaceSnapshot>;\n [channels.setGoal]: IpcRequest<[objective: string, tokenBudget?: number | null], CodexSurfaceSnapshot>;\n [channels.selectConversation]: IpcRequest<[conversationId: string], CodexSurfaceSnapshot>;\n [channels.sendMessage]: IpcRequest<[prompt: string, options?: CodexRendererSendMessageOptions], CodexSurfaceSnapshot>;\n [channels.startReview]: IpcRequest<[options?: StartCodexReviewOptions], CodexSurfaceSnapshot>;\n [channels.startLiveChat]: IpcRequest<[conversationId: string, options: StartCodexLiveChatOptions], { sdp: string }>;\n [channels.stopLiveChat]: IpcRequest<[conversationId: string], void>;\n [channels.startChatGptDeviceCodeLogin]: IpcRequest<[], CodexSurfaceChatGptDeviceCodeLogin>;\n [channels.startChatGptLogin]: IpcRequest<[], CodexSurfaceChatGptLogin>;\n [channels.steerMessage]: IpcRequest<[\n prompt: string,\n options?: CodexRendererSendMessageOptions,\n ], CodexSurfaceSnapshot>;\n [channels.steerQueuedPrompt]: IpcRequest<[promptId: string, prompt?: string], CodexSurfaceSnapshot>;\n [channels.unarchiveConversation]: IpcRequest<[conversationId: string], CodexSurfaceSnapshot>;\n [channels.updateConversationSettings]: IpcRequest<[settings: UpdateCodexConversationSettings], CodexSurfaceSnapshot>;\n [channels.updateQueuedPrompt]: IpcRequest<[promptId: string, prompt: string], CodexSurfaceSnapshot>;\n};\n\ntype SurfaceEvents = {\n [channels.stateChanged]: CodexSurfaceSnapshot;\n [channels.statePatch]: CodexSurfaceStatePatch;\n [channels.event]: CodexSurfaceEvent;\n};\n\nexport type { CodexSurfaceRendererApi } from '@codex-app-sdk/core/surface';\n\ntype OptionalSurfaceOperation = 'loadOlderConversationHistory' | 'startLiveChat' | 'stopLiveChat';\n\nexport function registerCodexSurfaceIpc(\n port: IpcMainPort,\n sender: IpcEventSender,\n surface: Omit<CodexSurfaceBridgeTarget, OptionalSurfaceOperation>\n & Partial<Pick<CodexSurfaceBridgeTarget, OptionalSurfaceOperation>>\n & Partial<CodexSurfaceStatePatchSource>,\n options: CodexSurfaceIpcOptions = {},\n): () => void {\n // State crosses IPC as full snapshots until a renderer asks for a versioned\n // base; from then on it streams small patches. Older renderers never ask, and\n // surfaces without native patch support decline, so both keep snapshots.\n const patchSource = isCodexSurfaceStatePatchSource(surface) ? surface : null;\n let streamingPatches = false;\n const invoke = <Name extends CodexSurfaceBridgeOperation>(name: Name, args: readonly unknown[]) => {\n if (name === 'loadOlderConversationHistory' && !surface.loadOlderConversationHistory) {\n return Promise.reject(new Error('Conversation history paging is not available.'));\n }\n if ((name === 'startLiveChat' || name === 'stopLiveChat') && !surface[name]) {\n return Promise.reject(new Error('Live chat is not available.'));\n }\n return invokeCodexSurfaceBridgeOperation(\n surface as CodexSurfaceBridgeTarget,\n name,\n args,\n {\n operationLabel: channels[name],\n ...(options.resolveAttachment === undefined\n ? {}\n : { resolveAttachment: options.resolveAttachment }),\n },\n );\n };\n const unregisterHandlers = registerIpcMainHandlers<SurfaceRequests>(port, {\n [channels.archiveConversation]: (_event, ...args) => invoke('archiveConversation', args),\n [channels.cancelLogin]: (_event, ...args) => invoke('cancelLogin', args),\n [channels.clearGoal]: (_event, ...args) => invoke('clearGoal', args),\n [channels.compactConversation]: (_event, ...args) => invoke('compactConversation', args),\n [channels.connect]: (_event, ...args) => invoke('connect', args),\n [channels.continueInterruptedTurn]: (_event, ...args) => invoke('continueInterruptedTurn', args),\n [channels.createConversation]: (_event, ...args) => invoke('createConversation', args),\n [channels.deleteConversation]: (_event, ...args) => invoke('deleteConversation', args),\n [channels.deleteTurn]: (_event, ...args) => invoke('deleteTurn', args),\n [channels.deleteQueuedPrompt]: (_event, ...args) => invoke('deleteQueuedPrompt', args),\n [channels.editTurn]: (_event, ...args) => invoke('editTurn', args),\n [channels.forkTurn]: (_event, ...args) => invoke('forkTurn', args),\n [channels.getSnapshot]: (_event, ...args) => invoke('getSnapshot', args),\n [channels.getVersionedSnapshot]: async () => {\n if (!patchSource) return null;\n streamingPatches = true;\n return patchSource.getVersionedSnapshot();\n },\n [channels.interrupt]: (_event, ...args) => invoke('interrupt', args),\n [channels.listConversations]: (_event, ...args) => invoke('listConversations', args),\n [channels.listModels]: (_event, ...args) => invoke('listModels', args),\n [channels.logout]: (_event, ...args) => invoke('logout', args),\n [channels.readConversationHistory]: (_event, ...args) => invoke('readConversationHistory', args),\n [channels.readConversationPromptHistory]: (_event, ...args) => invoke('readConversationPromptHistory', args),\n [channels.loadOlderConversationHistory]: (_event, ...args) => invoke('loadOlderConversationHistory', args),\n [channels.refreshAccount]: (_event, ...args) => invoke('refreshAccount', args),\n [channels.readRateLimits]: (_event, ...args) => invoke('readRateLimits', args),\n [channels.consumeRateLimitResetCredit]: (_event, ...args) => invoke('consumeRateLimitResetCredit', args),\n [channels.readAccountUsage]: (_event, ...args) => invoke('readAccountUsage', args),\n [channels.refreshConversations]: (_event, ...args) => invoke('refreshConversations', args),\n [channels.renameConversation]: (_event, ...args) => invoke('renameConversation', args),\n [channels.respondToClientRequest]: (_event, ...args) => invoke('respondToClientRequest', args),\n [channels.resolveApproval]: (_event, ...args) => invoke('resolveApproval', args),\n [channels.retryTurn]: (_event, ...args) => invoke('retryTurn', args),\n [channels.setGoal]: (_event, ...args) => invoke('setGoal', args),\n [channels.selectConversation]: (_event, ...args) => invoke('selectConversation', args),\n [channels.sendMessage]: (_event, ...args) => invoke('sendMessage', args),\n [channels.startReview]: (_event, ...args) => invoke('startReview', args),\n [channels.startLiveChat]: (_event, ...args) => invoke('startLiveChat', args),\n [channels.stopLiveChat]: (_event, ...args) => invoke('stopLiveChat', args),\n [channels.startChatGptDeviceCodeLogin]: (_event, ...args) => invoke('startChatGptDeviceCodeLogin', args),\n [channels.startChatGptLogin]: (_event, ...args) => invoke('startChatGptLogin', args),\n [channels.steerMessage]: (_event, ...args) => invoke('steerMessage', args),\n [channels.steerQueuedPrompt]: (_event, ...args) => invoke('steerQueuedPrompt', args),\n [channels.unarchiveConversation]: (_event, ...args) => invoke('unarchiveConversation', args),\n [channels.updateConversationSettings]: (_event, ...args) => invoke('updateConversationSettings', args),\n [channels.updateQueuedPrompt]: (_event, ...args) => invoke('updateQueuedPrompt', args),\n }, options);\n const unsubscribeSnapshots = surface.onStateChange((snapshot) => {\n if (!streamingPatches) sender.send(channels.stateChanged, snapshot);\n });\n const unsubscribePatches = patchSource?.onStatePatch((patch) => {\n if (streamingPatches) sender.send(channels.statePatch, patch);\n });\n const unsubscribeState = () => {\n unsubscribePatches?.();\n unsubscribeSnapshots();\n };\n const unsubscribeEvents = surface.onEvent((event) => sender.send(channels.event, event));\n return () => {\n unsubscribeEvents();\n unsubscribeState();\n unregisterHandlers();\n };\n}\n\nexport function createCodexSurfaceRendererApi(port: IpcRendererPort): CodexSurfaceRendererApi {\n const renderer = new TypedIpcRenderer<SurfaceRequests, SurfaceEvents>(port);\n const getVersionedSnapshot = () => renderer.invoke(channels.getVersionedSnapshot);\n const onStatePatch = (listener: (patch: CodexSurfaceStatePatch) => void) => renderer.on(channels.statePatch, listener);\n const stateSource = { getVersionedSnapshot, onStatePatch };\n return {\n // Mirror patches in the renderer's own world: contextBridge copies every\n // value it passes, so a mirror kept in the preload would lose identity.\n getVersionedSnapshot,\n onStatePatch,\n archiveConversation: (conversationId) => renderer.invoke(channels.archiveConversation, conversationId),\n cancelLogin: (loginId) => renderer.invoke(channels.cancelLogin, loginId),\n clearGoal: () => renderer.invoke(channels.clearGoal),\n compactConversation: () => renderer.invoke(channels.compactConversation),\n connect: () => renderer.invoke(channels.connect),\n continueInterruptedTurn: () => renderer.invoke(channels.continueInterruptedTurn),\n createConversation: (options) => renderer.invoke(channels.createConversation, options),\n deleteConversation: (conversationId) => renderer.invoke(channels.deleteConversation, conversationId),\n deleteTurn: (turnId) => renderer.invoke(channels.deleteTurn, turnId),\n deleteQueuedPrompt: (promptId) => renderer.invoke(channels.deleteQueuedPrompt, promptId),\n editTurn: (turnId, content) => renderer.invoke(channels.editTurn, turnId, content),\n forkTurn: (turnId) => renderer.invoke(channels.forkTurn, turnId),\n getSnapshot: () => renderer.invoke(channels.getSnapshot),\n interrupt: () => renderer.invoke(channels.interrupt),\n listConversations: (options) => renderer.invoke(channels.listConversations, options),\n listModels: (options) => renderer.invoke(channels.listModels, options),\n logout: () => renderer.invoke(channels.logout),\n onEvent: (listener) => renderer.on(channels.event, listener),\n onStateChange: (listener) => {\n // Snapshots arrive until the main process switches to patches; the\n // switch point's base was already delivered as a snapshot, so it stays silent.\n const unsubscribeSnapshots = renderer.on(channels.stateChanged, listener);\n const unsubscribePatches = subscribeCodexSurfaceState(stateSource, listener, { emitInitialSnapshot: false });\n return () => {\n unsubscribePatches();\n unsubscribeSnapshots();\n };\n },\n readConversationHistory: (conversationId) => renderer.invoke(channels.readConversationHistory, conversationId),\n readConversationPromptHistory: (conversationId) => (\n renderer.invoke(channels.readConversationPromptHistory, conversationId)\n ),\n loadOlderConversationHistory: (conversationId) => renderer.invoke(channels.loadOlderConversationHistory, conversationId),\n refreshAccount: () => renderer.invoke(channels.refreshAccount),\n readRateLimits: (options) => renderer.invoke(channels.readRateLimits, options),\n consumeRateLimitResetCredit: (options) => renderer.invoke(channels.consumeRateLimitResetCredit, options),\n readAccountUsage: () => renderer.invoke(channels.readAccountUsage),\n refreshConversations: () => renderer.invoke(channels.refreshConversations),\n renameConversation: (title) => renderer.invoke(channels.renameConversation, title),\n respondToClientRequest: (response) => renderer.invoke(channels.respondToClientRequest, response),\n resolveApproval: (approvalId, decision, scope) => renderer.invoke(channels.resolveApproval, approvalId, decision, scope),\n retryTurn: (turnId) => renderer.invoke(channels.retryTurn, turnId),\n setGoal: (objective, tokenBudget) => renderer.invoke(channels.setGoal, objective, tokenBudget),\n selectConversation: (conversationId) => renderer.invoke(channels.selectConversation, conversationId),\n sendMessage: (prompt, options) => renderer.invoke(channels.sendMessage, prompt, options),\n startReview: (options) => renderer.invoke(channels.startReview, options),\n startLiveChat: (conversationId, options) => renderer.invoke(channels.startLiveChat, conversationId, options),\n stopLiveChat: (conversationId) => renderer.invoke(channels.stopLiveChat, conversationId),\n startChatGptDeviceCodeLogin: () => renderer.invoke(channels.startChatGptDeviceCodeLogin),\n startChatGptLogin: () => renderer.invoke(channels.startChatGptLogin),\n steerMessage: (prompt, options) => renderer.invoke(channels.steerMessage, prompt, options),\n steerQueuedPrompt: (promptId, prompt) => renderer.invoke(channels.steerQueuedPrompt, promptId, prompt),\n unarchiveConversation: (conversationId) => renderer.invoke(channels.unarchiveConversation, conversationId),\n updateConversationSettings: (settings) => renderer.invoke(channels.updateConversationSettings, settings),\n updateQueuedPrompt: (promptId, prompt) => renderer.invoke(channels.updateQueuedPrompt, promptId, prompt),\n };\n}\n","import type {\n CodexNativeAttachment,\n CodexNativeAttachmentInput,\n CodexNativeClipboardContent,\n CodexNativeRendererApi,\n CodexSpeechTranscriptionResult,\n CodexSpeechSessionOptions,\n CodexSpeechSessionEvent,\n} from '@codex-app-sdk/core/native';\nimport {\n TypedIpcRenderer,\n type IpcRendererPort,\n type IpcRequest,\n} from './typed-ipc';\n\nexport const codexNativeChannels = {\n copyToClipboard: 'codex-native:copy-to-clipboard',\n ingestAttachments: 'codex-native:ingest-attachments',\n openExternal: 'codex-native:open-external',\n pickAttachments: 'codex-native:pick-attachments',\n readImagePreview: 'codex-native:read-image-preview',\n transcribeAudio: 'codex-native:transcribe-audio',\n startSpeech: 'codex-native:start-speech',\n appendSpeech: 'codex-native:append-speech',\n stopSpeech: 'codex-native:stop-speech',\n cancelSpeech: 'codex-native:cancel-speech',\n} as const;\nexport const codexSpeechEventChannel = 'codex-native:speech-event';\n\nexport type CodexNativeRequests = {\n [codexNativeChannels.startSpeech]: IpcRequest<[options: CodexSpeechSessionOptions], void>;\n [codexNativeChannels.appendSpeech]: IpcRequest<[sessionId: string, audio: ArrayBuffer], void>;\n [codexNativeChannels.stopSpeech]: IpcRequest<[sessionId: string], CodexSpeechTranscriptionResult>;\n [codexNativeChannels.cancelSpeech]: IpcRequest<[sessionId: string], void>;\n [codexNativeChannels.copyToClipboard]: IpcRequest<[content: CodexNativeClipboardContent], void>;\n [codexNativeChannels.ingestAttachments]: IpcRequest<[\n files: readonly CodexNativeAttachmentInput[],\n ], CodexNativeAttachment[]>;\n [codexNativeChannels.openExternal]: IpcRequest<[href: string], void>;\n [codexNativeChannels.pickAttachments]: IpcRequest<[], CodexNativeAttachment[]>;\n [codexNativeChannels.readImagePreview]: IpcRequest<[path: string], string | null>;\n [codexNativeChannels.transcribeAudio]: IpcRequest<[\n audioData: ArrayBuffer,\n options?: { locale?: string; live?: boolean },\n ], CodexSpeechTranscriptionResult>;\n};\n\nexport type CodexContextBridge = {\n exposeInMainWorld(key: string, api: unknown): void;\n};\n\nexport function createCodexNativeRendererApi(\n port: IpcRendererPort,\n options: { transcription?: boolean; streamingTranscription?: boolean } = {},\n): CodexNativeRendererApi {\n const renderer = new TypedIpcRenderer<CodexNativeRequests, { [codexSpeechEventChannel]: CodexSpeechSessionEvent }>(port);\n const transcription = options.transcription ?? process.platform === 'darwin';\n return {\n capabilities: {\n attachments: true,\n clipboard: true,\n externalLinks: true,\n transcription,\n },\n ...(transcription && (options.streamingTranscription ?? process.platform === 'darwin') ? {\n streamingTranscription: {\n start: (input: CodexSpeechSessionOptions) => renderer.invoke(codexNativeChannels.startSpeech, input),\n append: (id: string, audio: ArrayBuffer) => renderer.invoke(codexNativeChannels.appendSpeech, id, audio),\n stop: (id: string) => renderer.invoke(codexNativeChannels.stopSpeech, id),\n cancel: (id: string) => renderer.invoke(codexNativeChannels.cancelSpeech, id),\n onEvent: (listener: (event: CodexSpeechSessionEvent) => void) => renderer.on(codexSpeechEventChannel, listener),\n },\n } : {}),\n copyToClipboard: (content) => renderer.invoke(codexNativeChannels.copyToClipboard, content),\n ingestAttachments: (files) => renderer.invoke(codexNativeChannels.ingestAttachments, files),\n openExternal: (href) => renderer.invoke(codexNativeChannels.openExternal, href),\n pickAttachments: () => renderer.invoke(codexNativeChannels.pickAttachments),\n readImagePreview: (path) => renderer.invoke(codexNativeChannels.readImagePreview, path),\n transcribeAudio: (audioData, transcriptionOptions) => (\n renderer.invoke(codexNativeChannels.transcribeAudio, audioData, transcriptionOptions)\n ),\n };\n}\n\nexport function exposeCodexNativeRendererApi(\n contextBridge: CodexContextBridge,\n port: IpcRendererPort,\n options?: { transcription?: boolean; streamingTranscription?: boolean },\n): CodexNativeRendererApi {\n const api = createCodexNativeRendererApi(port, options);\n contextBridge.exposeInMainWorld('codexAppSdkNative', api);\n return api;\n}\n","import type { CodexNativeRendererApi } from '@codex-app-sdk/core/native';\nimport type { CodexSurfaceRendererApi } from '@codex-app-sdk/core/surface';\nimport {\n createCodexNativeRendererApi,\n type CodexContextBridge,\n} from './codex-native-renderer';\nimport { createCodexSurfaceRendererApi } from './codex-surface-ipc';\nimport type { IpcRendererPort } from './typed-ipc';\n\nexport type CodexElectronRendererApis = {\n native: CodexNativeRendererApi;\n surface: CodexSurfaceRendererApi;\n};\n\n/** Exposes the SDK-owned renderer APIs under stable, automatically detected names. */\nexport function exposeCodexElectronPreload(\n contextBridge: CodexContextBridge,\n ipcRenderer: IpcRendererPort,\n options?: { transcription?: boolean },\n): CodexElectronRendererApis {\n const surface = createCodexSurfaceRendererApi(ipcRenderer);\n const native = createCodexNativeRendererApi(ipcRenderer, options);\n contextBridge.exposeInMainWorld('codexSurface', surface);\n contextBridge.exposeInMainWorld('codexAppSdkNative', native);\n return { native, surface };\n}\n"],"mappings":";;AAiCA,IAAa,IAAb,MAA8E;CAC/C;CAA7B,YAAY,GAAwC;EAAvB,KAAA,OAAA;CAAwB;CAErD,OACE,GACA,GAAG,GACwC;EAC3C,OAAO,KAAK,KAAK,OAAO,GAAS,GAAG,CAAI;CAC1C;CAEA,GAAmC,GAAe,GAAuD;EACvG,IAAM,KAAW,GAAiB,MAAqB,EAAS,CAAuB;EAEvF,OADA,KAAK,KAAK,GAAG,GAAS,CAAO,SAChB,KAAK,KAAK,IAAI,GAAS,CAAO;CAC7C;AACF,GASa,IAAb,MAAmD;CAGpB;CAF7B,qCAAsC,IAAI,IAA2B;CAErE,YAAY,GAAoC;EAAnB,KAAA,OAAA;CAAoB;CAEjD,OACE,GACA,GACM;EAKN,AAJA,KAAK,KAAK,OAAO,IAAU,GAAO,GAAG,MAAS,EAC5C,GACA,GAAG,CACL,CAAC,GACD,KAAK,mBAAmB,IAAI,CAAO;CACrC;CAEA,cAAkD,GAAqB;EAErE,AADA,KAAK,KAAK,cAAc,CAAO,GAC/B,KAAK,mBAAmB,OAAO,CAAO;C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