Add Hipocap security middleware for prompt and tool call analysis, integrates Laminar observability for tracing and token usage, and introduces a Hipocap management tool. Updates configuration schemas, onboarding wizard, and system prompt Enhances agent run and reply flows with security checks and observability spans.
84 lines
2.4 KiB
TypeScript
84 lines
2.4 KiB
TypeScript
import {
|
|
confirm as clackConfirm,
|
|
intro as clackIntro,
|
|
outro as clackOutro,
|
|
select as clackSelect,
|
|
text as clackText,
|
|
} from "@clack/prompts";
|
|
|
|
import { stylePromptHint, stylePromptMessage, stylePromptTitle } from "../terminal/prompt-style.js";
|
|
|
|
export const CONFIGURE_WIZARD_SECTIONS = [
|
|
"workspace",
|
|
"model",
|
|
"web",
|
|
"gateway",
|
|
"daemon",
|
|
"channels",
|
|
"skills",
|
|
"health",
|
|
"hipocap",
|
|
] as const;
|
|
|
|
export type WizardSection = (typeof CONFIGURE_WIZARD_SECTIONS)[number];
|
|
|
|
export type ChannelsWizardMode = "configure" | "remove";
|
|
|
|
export type ConfigureWizardParams = {
|
|
command: "configure" | "update";
|
|
sections?: WizardSection[];
|
|
};
|
|
|
|
export const CONFIGURE_SECTION_OPTIONS: Array<{
|
|
value: WizardSection;
|
|
label: string;
|
|
hint: string;
|
|
}> = [
|
|
{ value: "workspace", label: "Workspace", hint: "Set workspace + sessions" },
|
|
{ value: "model", label: "Model", hint: "Pick provider + credentials" },
|
|
{ value: "web", label: "Web tools", hint: "Configure Brave search + fetch" },
|
|
{ value: "gateway", label: "Gateway", hint: "Port, bind, auth, tailscale" },
|
|
{
|
|
value: "daemon",
|
|
label: "Daemon",
|
|
hint: "Install/manage the background service",
|
|
},
|
|
{
|
|
value: "channels",
|
|
label: "Channels",
|
|
hint: "Link WhatsApp/Telegram/etc and defaults",
|
|
},
|
|
{ value: "skills", label: "Skills", hint: "Install/enable workspace skills" },
|
|
{
|
|
value: "health",
|
|
label: "Health check",
|
|
hint: "Run gateway + channel checks",
|
|
},
|
|
{
|
|
value: "hipocap",
|
|
label: "Hipocap Security",
|
|
hint: "AI Security Policy and Observability",
|
|
},
|
|
];
|
|
|
|
export const intro = (message: string) => clackIntro(stylePromptTitle(message) ?? message);
|
|
export const outro = (message: string) => clackOutro(stylePromptTitle(message) ?? message);
|
|
export const text = (params: Parameters<typeof clackText>[0]) =>
|
|
clackText({
|
|
...params,
|
|
message: stylePromptMessage(params.message),
|
|
});
|
|
export const confirm = (params: Parameters<typeof clackConfirm>[0]) =>
|
|
clackConfirm({
|
|
...params,
|
|
message: stylePromptMessage(params.message),
|
|
});
|
|
export const select = <T>(params: Parameters<typeof clackSelect<T>>[0]) =>
|
|
clackSelect({
|
|
...params,
|
|
message: stylePromptMessage(params.message),
|
|
options: params.options.map((opt) =>
|
|
opt.hint === undefined ? opt : { ...opt, hint: stylePromptHint(opt.hint) },
|
|
),
|
|
});
|