openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
100 lines (99 loc) • 2.93 kB
JavaScript
import { a as READ_SCOPE } from "./operator-scopes-CULmYfyY.mjs";
import { o as roleScopesAllow } from "./operator-scope-compat-CpFHu-FC.mjs";
//#region src/gateway/events.ts
const GATEWAY_EVENT_DEVICE_PAIR_CHANGED = "device.pair.changed";
const GATEWAY_EVENT_NODE_RUNNER_INVENTORY_CHANGED = "node.runnerInventory.changed";
const GATEWAY_EVENT_UPDATE_AVAILABLE = "update.available";
/** Active update ledger progress; detailed records remain admin-scoped. */
const GATEWAY_EVENT_UPDATE_RUN_CHANGED = "update.run.changed";
/** Gateway event names that clients can subscribe to or receive over the wire. */
const GATEWAY_EVENTS = [
"connect.challenge",
"agent",
"agent.identity.changed",
"chat",
"chat.metadata.changed",
"models.snapshot",
"ui.command",
"session.approval",
"session.message",
"session.narration",
"session.observer",
"session.operation",
"session.sharing",
"session.sharing.evidence",
"session.suggestion",
"session.reaction",
"session.typing",
"session.tool",
"sessions.changed",
"sessions.processes.changed",
"socket.drain",
"controlUi.sessionPullRequests.changed",
"plugins.controlUi.changed",
"presence",
"tick",
"talk.mode",
"talk.event",
"talk.voice.change",
"shutdown",
"gateway.suspension",
"health",
"heartbeat",
"cron",
"cron.inventory.changed",
"task.suggestion",
"node.pair.requested",
"node.pair.resolved",
"node.presence",
"node.hostStats",
GATEWAY_EVENT_NODE_RUNNER_INVENTORY_CHANGED,
"node.invoke.cancel",
"node.invoke.input",
"node.invoke.request",
GATEWAY_EVENT_DEVICE_PAIR_CHANGED,
"device.pair.requested",
"device.pair.resolved",
"device.pair.setup.completed",
"device.pair.setup.deliveryUncertain",
"users.prefs.changed",
"skills.changed",
"plugins.changed",
"plugins.install.progress",
"voicewake.changed",
"voicewake.routing.changed",
"exec.approval.requested",
"exec.approval.resolved",
"question.requested",
"question.resolved",
"plugin.approval.requested",
"plugin.approval.resolved",
"openclaw.approval.requested",
"openclaw.approval.resolved",
"terminal.data",
"terminal.exit",
GATEWAY_EVENT_UPDATE_AVAILABLE,
GATEWAY_EVENT_UPDATE_RUN_CHANGED,
"portal.changed",
"progressCard.changed",
"mentions.changed",
"mentions.failed"
];
function canReadDetailedUpdateMetadata(e, t) {
return roleScopesAllow({
role: e,
requestedScopes: [READ_SCOPE],
allowedScopes: t
});
}
/** Projects update availability to the pre-detail wire shape for clients without read access. */
function projectUpdateAvailable(e, t) {
if (!e || t) return e;
return {
currentVersion: e.currentVersion,
latestVersion: e.latestVersion,
channel: e.channel
};
}
//#endregion
export { GATEWAY_EVENT_UPDATE_RUN_CHANGED as a, GATEWAY_EVENT_UPDATE_AVAILABLE as i, GATEWAY_EVENT_DEVICE_PAIR_CHANGED as n, canReadDetailedUpdateMetadata as o, GATEWAY_EVENT_NODE_RUNNER_INVENTORY_CHANGED as r, projectUpdateAvailable as s, GATEWAY_EVENTS as t };