UNPKG

@gguf/claw

Version:

Multi-channel AI gateway with extensible messaging integrations

62 lines (60 loc) 2.21 kB
import "./paths-B4BZAPZh.js"; import "./utils-CP9YLh6M.js"; import "./registry-B-j4DRfe.js"; import "./subsystem-BCQGGxdd.js"; import "./exec-DYqRzFbo.js"; import { c as resolveAgentWorkspaceDir, l as resolveDefaultAgentId } from "./agent-scope-BnZW9Gh2.js"; import { t as formatCliCommand } from "./command-format-DEKzLnLg.js"; import "./boolean-BsqeuxE6.js"; import "./frontmatter-6HZ0_y2V.js"; import "./workspace-DekXc039.js"; import { t as buildWorkspaceHookStatus } from "./hooks-status-CAZ4_QID.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.eligible); 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 };