Fix: stringEnum import path#33
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a runtime plugin registration failure caused by importing stringEnum from the wrong OpenClaw SDK entry point, updating the import to use openclaw/plugin-sdk/core where stringEnum is actually exported.
Changes:
- Update imports in
tools/store.tsto pullstringEnum(andOpenClawPluginApi) fromopenclaw/plugin-sdk/coreto avoid the runtimeTypeError.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tools/store.ts
Outdated
| import { Type } from "@sinclair/typebox" | ||
| import type { OpenClawPluginApi } from "openclaw/plugin-sdk" | ||
| import { stringEnum } from "openclaw/plugin-sdk" | ||
| import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core" |
There was a problem hiding this comment.
OpenClawPluginApi is now imported from openclaw/plugin-sdk/core, but this repo’s local type shim only declares module "openclaw/plugin-sdk" (see types/openclaw.d.ts). With openclaw as a peerDependency, tsc --noEmit will likely fail with “Cannot find module 'openclaw/plugin-sdk/core' or its corresponding type declarations.” Consider keeping the type-only import from openclaw/plugin-sdk (it doesn’t affect runtime) and only switching the runtime stringEnum import to /core, or add a matching declare module "openclaw/plugin-sdk/core" type shim.
| import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core" | |
| import type { OpenClawPluginApi } from "openclaw/plugin-sdk" |
stringEnum is exported from openclaw/plugin-sdk/core, not openclaw/plugin-sdk. This was causing TypeError: (0 , _pluginSdk.stringEnum) is not a function when the plugin tried to register.
e0ef458 to
a268e6b
Compare
|
@claude can you review this PR |
Prompt: Fix TypeError where stringEnum is not a function by correcting the import path from "openclaw/plugin-sdk" to "openclaw/plugin-sdk/core"
Problem:
```
TypeError: (0 , _pluginSdk.stringEnum) is not a function
```
The plugin fails to register because `stringEnum` is not exported from the main `openclaw/plugin-sdk` entry point. It's available in `openclaw/plugin-sdk/core`.
Fix:
Changed both imports in `tools/store.ts` to use `openclaw/plugin-sdk/core`.
Testing:
Verified the plugin now loads successfully without the TypeError.