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): entitlement store + Settings License section

enes9cbe7d2f63af
diff --git a/src/renderer/components/SettingsPanel.tsx b/src/renderer/components/SettingsPanel.tsx
index 374d4d3e2..1d1fa8bc1 100644
--- a/src/renderer/components/SettingsPanel.tsx
+++ b/src/renderer/components/SettingsPanel.tsx
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react'
import { createPortal } from 'react-dom'
import { useSettings } from '../state/settings'
+import { useEntitlement } from '../state/entitlement'
import { NODE_COLORS } from '../state/workspace'
import type { CustomAgent } from '@shared/types'
import type { PromptInjectionMode } from '@shared/agents/config'
@@ -19,6 +20,12 @@ export function SettingsPanel({ onClose }: SettingsPanelProps) {
void window.nodeTerminal.updates.getVersion().then(setVersion)
}, [])
+ const ent = useEntitlement()
+ const [licenseKey, setLicenseKey] = useState('')
+ useEffect(() => {
+ void ent.hydrate()
+ }, [])
+
const customAgents = settings.customAgents
const patchAgent = (id: string, patch: Partial<CustomAgent>) =>
update({ customAgents: customAgents.map((a) => (a.id === id ? { ...a, ...patch } : a)) })
@@ -317,6 +324,51 @@ export function SettingsPanel({ onClose }: SettingsPanelProps) {
</button>
<p className="set-note">Results appear in the update card at the bottom-right.</p>
</section>
+
+ <section>
+ <h3>License</h3>
+ {ent.isPremium ? (
+ <>
+ <p className="set-note">
+ Pro — active
+ {ent.status.expiresAt
+ ? ` until ${new Date(ent.status.expiresAt * 1000).toLocaleDateString()}`
+ : ''}
+ .
+ </p>
+ <button className="set-btn" onClick={() => void ent.deactivate()}>
+ Deactivate on this device
+ </button>
+ </>
+ ) : (
+ <>
+ <label className="set-row">
+ <span>License key</span>
+ <input
+ type="text"
+ placeholder="paste your key"
+ value={licenseKey}
+ onChange={(e) => setLicenseKey(e.target.value)}
+ />
+ </label>
+ <button
+ className="set-btn"
+ onClick={() => {
+ if (licenseKey.trim()) void ent.activate(licenseKey.trim())
+ }}
+ >
+ Activate
+ </button>
+ {ent.status.error ? (
+ <p className="set-note" style={{ color: '#ff9f0a' }}>
+ Could not activate ({ent.status.error}).
+ </p>
+ ) : (
+ <p className="set-note">Enter a key to unlock Pro features.</p>
+ )}
+ </>
+ )}
+ </section>
</div>
</aside>
</div>,
diff --git a/src/renderer/state/entitlement.ts b/src/renderer/state/entitlement.ts
new file mode 100644
index 000000000..4e2aaa03b
--- /dev/null
+++ b/src/renderer/state/entitlement.ts
@@ -0,0 +1,32 @@
+import { create } from 'zustand'
+import type { LicenseStatus } from '@shared/types'
+
+interface EntitlementState {
+ status: LicenseStatus
+ /** True when an active Pro entitlement is present — features gate on this. */
+ isPremium: boolean
+ hydrate(): Promise<void>
+ activate(key: string): Promise<void>
+ deactivate(): Promise<void>
+}
+
+const EMPTY: LicenseStatus = { tier: null, active: false, expiresAt: null, error: null }
+
+export const useEntitlement = create<EntitlementState>((set) => {
+ const apply = (status: LicenseStatus) => set({ status, isPremium: status.active })
+ // Live updates from the main process (launch refresh, offline grace).
+ window.nodeTerminal.license.onChange(apply)
+ return {
+ status: EMPTY,
+ isPremium: false,
+ async hydrate() {
+ apply(await window.nodeTerminal.license.getStatus())
+ },
+ async activate(key) {
+ apply(await window.nodeTerminal.license.activate(key))
+ },
+ async deactivate() {
+ apply(await window.nodeTerminal.license.deactivate())
+ }
+ }
+})