@wujie-shell/sdk
v1.0.0
Published
`@wujie-shell/sdk` contains the renderer-facing TypeScript types and small helpers for product UI projects that consume `wujie-shell`.
Readme
@wujie-shell/sdk
@wujie-shell/sdk contains the renderer-facing TypeScript types and small
helpers for product UI projects that consume wujie-shell.
The actual runtime object is injected by Electron preload as
window.wujieShell. UI code imports this package for types and helpers, not for
direct IPC access.
Responsibility
- Define the public renderer API shape.
- Define common event/status types.
- Provide helpers for shell payloads.
- Keep UI code independent from Electron internals.
This package must stay product-agnostic. Product-specific Agent, Skill, Plugin,
and Workflow behavior belongs in apps/<product>.
Exported Types
import type {
ChatStreamEvent,
GatewayStatus,
ShellMediaItem,
ShellResult,
Unsubscribe,
WindowWujieShell,
} from '@wujie-shell/sdk'Exported Helpers
import { extractShellMedia } from '@wujie-shell/sdk'extractShellMedia(payload) reads OpenClaw payloads shaped like:
{
showInUI: true,
paths: Array<{ uri: string; mimeType: string }>
}and returns a normalized ShellMediaItem[].
Runtime Access
Use the global injected object:
const shell = window.wujieShell
const status = await shell.openclaw.gatewayStatus()Renderer code should not import ipcRenderer or use Electron APIs directly.
Desktop shell abilities are also consumed through the same global object:
await shell.window.openDevTools()
const off = shell.window.onDevToolsShortcut(event => {
console.log(event.accelerator)
})Model provider settings can be read and written through the injected shell API:
await shell.models.setSettings({
provider: 'wujieai',
apiKey: '...',
modelName: 'auto',
modelBaseUrl: 'https://model.example.com',
})React Hooks
React product UIs can import stateful wrappers from @wujie-shell/sdk/react:
import {
useAgents,
useChatHistory,
useChatStream,
useCronJobs,
useFilePicker,
useGatewayLogs,
useGatewayStatus,
useModelSettings,
useSessions,
useShellConfigSnapshot,
useSkillsStatus,
useWorkspace,
} from '@wujie-shell/sdk/react'Recommended hook boundaries:
- App/runtime status:
useShellAppInfo(),useRuntimeInfo(),useGatewayStatus(),useGatewayLogs(). - Product assets:
useAgents()anduseSkillsStatus(). - Session UI:
useSessions()anduseChatHistory(). - Streaming chat:
useChatStream()anduseAskUserQuestion(). - Desktop helpers:
useFilePicker(),useWorkspace(),useCronJobs(),useModelSettings(),useShellConfigSnapshot(). - Raw API access:
useShellFiles(),useShellWorkspace(),useShellCron(),useShellModels(),useShellConfig(),useShellEvents().
Hooks expose isLoading, error, and refresh where the underlying shell call
is stateful. Management actions such as session rename, pinning, skill updates,
and cron mutations refresh their list state after the shell call resolves.
API Groups
window.wujieShell.appwindow.wujieShell.windowwindow.wujieShell.openclawwindow.wujieShell.agentswindow.wujieShell.fileswindow.wujieShell.workspacewindow.wujieShell.skillswindow.wujieShell.sessionswindow.wujieShell.cronwindow.wujieShell.modelswindow.wujieShell.configwindow.wujieShell.chat
See docs/wujie-shell-sdk-api.md for the detailed API manual.
