Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(license): client IPC/types/preload contract

enes8b04e5bac0b0
diff --git a/src/preload/index.ts b/src/preload/index.ts
index 5e9abe53f..9c939f7f1 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -109,6 +109,16 @@ const api: NodeTerminalApi = {
getPolicy: () => ipcRenderer.invoke(IPC.appUpdatePolicy),
restart: () => ipcRenderer.send(IPC.appRestartToUpdate)
},
+ license: {
+ activate: (key: string) => ipcRenderer.invoke(IPC.licenseActivate, key),
+ deactivate: () => ipcRenderer.invoke(IPC.licenseDeactivate),
+ getStatus: () => ipcRenderer.invoke(IPC.licenseStatus),
+ onChange: (listener) => {
+ const handler = (_e: unknown, s: Parameters<typeof listener>[0]) => listener(s)
+ ipcRenderer.on(IPC.licenseChanged, handler)
+ return () => ipcRenderer.removeListener(IPC.licenseChanged, handler)
+ }
+ },
announcements: {
fetch: () => ipcRenderer.invoke(IPC.announcementsFetch)
},
diff --git a/src/shared/ipc.ts b/src/shared/ipc.ts
index 4e90b2847..b835be281 100644
--- a/src/shared/ipc.ts
+++ b/src/shared/ipc.ts
@@ -29,6 +29,10 @@ export const IPC = {
appCheckForUpdates: 'app:check-for-updates',
appGetVersion: 'app:get-version',
appUpdatePolicy: 'app:update-policy',
+ licenseActivate: 'license:activate',
+ licenseDeactivate: 'license:deactivate',
+ licenseStatus: 'license:status',
+ licenseChanged: 'license:changed',
appRestartToUpdate: 'app:restart-to-update',
announcementsFetch: 'announcements:fetch',
usageFetch: 'usage:fetch',
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 89b9a41a2..34b2dd241 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -460,6 +460,27 @@ export interface ContextApi {
onUpdate(listener: (usage: ContextWindowUsage) => void): () => void
}
+export interface LicenseStatus {
+ /** 'pro' when entitled, else null. */
+ tier: string | null
+ active: boolean
+ /** Unix seconds when the entitlement expires, or null. */
+ expiresAt: number | null
+ /** Last activation/refresh error reason code, or null. */
+ error: string | null
+}
+
+export interface LicenseApi {
+ /** Activate a license key on this device. Returns the resulting status. */
+ activate(key: string): Promise<LicenseStatus>
+ /** Release this device's seat and clear the local license. */
+ deactivate(): Promise<LicenseStatus>
+ /** Current cached status (verifies the stored token offline). */
+ getStatus(): Promise<LicenseStatus>
+ /** Fires when the license status changes. Returns unsubscribe. */
+ onChange(listener: (s: LicenseStatus) => void): () => void
+}
+
export interface NodeTerminalApi {
pty: PtyApi
workspace: WorkspaceApi
@@ -471,6 +492,7 @@ export interface NodeTerminalApi {
fs: FsApi
updates: UpdateApi
announcements: AnnouncementsApi
+ license: LicenseApi
bridge: BridgeApi
usage: UsageApi
context: ContextApi