Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@lightbase/lightbot
Advanced tools
Lightbot.js is a client javascript SDK
It allows the developer to easily communicate with any lightbot agent.
import { LightbotMessenger } from "lightbot";
const lightbotMessenger = new LightbotMessenger({
hostURL: "http://localhost:9000",
agentId: "agent-id",
});
lightbotMessenger.toggleMessenger();
lightbotMessenger.sendMessage({
type: "plain",
sender: "human",
label: "Hello, I need some help!",
});
Property | Description | Type |
---|---|---|
messages | Message history | Message |
sendMessage | Sends a message to the bot | Function(message: Message): void |
toggleMessenger | Toggles messenger open state | Function() |
isMessengerOpen | Current open state | Boolean |
onChange | Called when any primitive property gets updated | Function(): void |
resetAgent | Resets all in memory and local storage data related to the bot agent. e.g.: messages, agent data, etc. | Function(): void |
Property | Description | Value |
---|---|---|
sender | Message sender identification | "bot" | "human" |
type | Type of message | "plain" | "link" | "jump" |
when type: "plain"
:
Property | Description | Type |
---|---|---|
label | Plain text message | string |
when type: "link"
:
Property | Description | Type |
---|---|---|
label | Representative link label | string |
link | link | string |
when type: "jump"
:
Property | Description | Type |
---|---|---|
label | Representative jump label | string |
jumps | link | Array<{ label: string; event: string; }> |
withLightbotMessenger
HOCLightbot.js provides a React HOC which can be used to provide a communication interface to your React components.
withLightbotMessenger<ComponentProps>(options: { agentId: string; hostURL: string; })(Component)
React components are exported from lib/lightbot-react
.
import {
LightbotMessage,
LightbotMessengerDecoratedProps,
withLightbotMessenger
} from "lightbot/lib/lightbot-react";
type AppProps = LightbotMessengerDecoratedProps & {
children: any;
}
class AppDisconnected extends Component<AppProps, {}> {
public render() {
const { messages, isMessengerOpen, toggleMessenger } = this.props;
return (
<>
{
isMessengerOpen ?
(<ChatWindow
messages={messages}
onMessageSend={this.sendMessage}
/>) :
null
}
<button onClick={toggleMessenger}>
{isMessengerOpen ? "close" : "open"}
</button>
</>
);
}
private sendMessage = (message: string) => {
this.props.sendMessage({ type: "plain", label: message });
}
}
export const App = withLightbotMessenger<AppProps>({
hostURL: "https://localhost:9000",
agentId: "agent-id"
})(AppDisconnected);
withLightbotMessenger
injects the same props as the one defined by the Lightbot API except the onChange is implemented in order to update your React components when any update is available.
FAQs
Javascript Client for Lightbot API
We found that @lightbase/lightbot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.