refactor: remove context awareness documentation and related code; streamline tool registration and context detection
This commit is contained in:
@@ -7,7 +7,6 @@ import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
||||
import { jsonResult } from "openclaw/plugin-sdk";
|
||||
import type { ToolContext } from "../types.js";
|
||||
import { isPluginConfigured, hasWorkspaceFiles, buildOnboardToolContext, buildReconfigContext } from "../onboarding.js";
|
||||
import { detectContext, generateGuardrails } from "../context-guard.js";
|
||||
|
||||
export function createOnboardTool(api: OpenClawPluginApi) {
|
||||
return (ctx: ToolContext) => ({
|
||||
@@ -22,17 +21,6 @@ export function createOnboardTool(api: OpenClawPluginApi) {
|
||||
},
|
||||
|
||||
async execute(_id: string, params: Record<string, unknown>) {
|
||||
const devClawAgentIds = ((api.pluginConfig as Record<string, unknown>)?.devClawAgentIds as string[] | undefined) ?? [];
|
||||
const context = await detectContext(ctx, devClawAgentIds);
|
||||
|
||||
if (context.type === "group") {
|
||||
return jsonResult({
|
||||
success: false, error: "Onboarding should not be done in group chats.",
|
||||
recommendation: "Use a direct message instead.",
|
||||
contextGuidance: generateGuardrails(context),
|
||||
});
|
||||
}
|
||||
|
||||
const configured = isPluginConfigured(api.pluginConfig as Record<string, unknown>);
|
||||
const hasWorkspace = await hasWorkspaceFiles(ctx.workspaceDir);
|
||||
const mode = params.mode ? (params.mode as "first-run" | "reconfigure")
|
||||
@@ -42,7 +30,6 @@ export function createOnboardTool(api: OpenClawPluginApi) {
|
||||
|
||||
return jsonResult({
|
||||
success: true, mode, configured, instructions,
|
||||
contextGuidance: generateGuardrails(context),
|
||||
nextSteps: ["Follow instructions above", "Call setup with collected answers", mode === "first-run" ? "Register a project afterward" : null].filter(Boolean),
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user