UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

77 lines (76 loc) • 2.78 kB
import "./logger-kwZIqwuw.js"; import "./paths-ViKUYWUK.js"; import "./tmp-openclaw-dir-idKIOMmb.js"; import "./theme-CdOoMzRk.js"; import "./globals-DBUMOBZ8.js"; import "./subsystem-DISldKSB.js"; import "./ansi-BEJF8NKS.js"; import "./boolean-C3GkJetE.js"; import "./utils-CS0Ikux6.js"; import { m as resolveDefaultAgentId, p as resolveAgentWorkspaceDir } from "./agent-scope-bjWqU22i.js"; import "./boundary-path-Dm0QJ7-y.js"; import "./boundary-file-read-DcZxlWD8.js"; import "./logger-BmpSCz93.js"; import "./exec-B5_AYfQG.js"; import "./workspace-D4K6QX9X.js"; import "./version-CD3oP1-d.js"; import "./registry-C5UkPpaO.js"; import "./config-state-Br0ucqMb.js"; import "./min-host-version-RMBWtIAR.js"; import "./manifest-registry-B5JNQdOM.js"; import "./runtime-guard-PhQ6PwQa.js"; import { t as formatCliCommand } from "./command-format-DBQUhADm.js"; import "./frontmatter-CP5371Rm.js"; import "./frontmatter-AzDGezO7.js"; import "./config-Bnl_ZCTo.js"; import "./workspace-TnJmCeZO.js"; import { t as buildWorkspaceHookStatus } from "./hooks-status-De8AeNWx.js"; //#region src/commands/onboard-hooks.ts async function setupInternalHooks(cfg, runtime, prompter) { await prompter.note([ "Hooks let you automate actions when agent commands are issued.", "Example: Save session context to memory when you issue /new or /reset.", "", "Learn more: https://docs.openclaw.ai/automation/hooks" ].join("\n"), "Hooks"); const eligibleHooks = buildWorkspaceHookStatus(resolveAgentWorkspaceDir(cfg, resolveDefaultAgentId(cfg)), { config: cfg }).hooks.filter((h) => h.loadable); if (eligibleHooks.length === 0) { await prompter.note("No eligible hooks found. You can configure hooks later in your config.", "No Hooks Available"); return cfg; } const selected = (await prompter.multiselect({ message: "Enable hooks?", options: [{ value: "__skip__", label: "Skip for now" }, ...eligibleHooks.map((hook) => ({ value: hook.name, label: `${hook.emoji ?? "🔗"} ${hook.name}`, hint: hook.description }))] })).filter((name) => name !== "__skip__"); if (selected.length === 0) return cfg; const entries = { ...cfg.hooks?.internal?.entries }; for (const name of selected) entries[name] = { enabled: true }; const next = { ...cfg, hooks: { ...cfg.hooks, internal: { enabled: true, entries } } }; await prompter.note([ `Enabled ${selected.length} hook${selected.length > 1 ? "s" : ""}: ${selected.join(", ")}`, "", "You can manage hooks later with:", ` ${formatCliCommand("openclaw hooks list")}`, ` ${formatCliCommand("openclaw hooks enable <name>")}`, ` ${formatCliCommand("openclaw hooks disable <name>")}` ].join("\n"), "Hooks Configured"); return next; } //#endregion export { setupInternalHooks };