Open-source, local-first AI agent for real work.
TypeScript agent-toolsai-agentbyokcoding-agentcross-platformdesktop-appdeveloper-toolselectronharnessknowledge-basellmwikilocal-firstmcpplugin-systemprivacy-firstskillstypescriptvettaworkflow-automation
import type { PluginContext } from "@vetta-org/plugin-sdk";
export const CONTENT_WORKSPACE_TAB_ID = "workspace";
export const CONTENT_TOOL_SCOPE_USE = ["conversation", "project"] as const;
export interface ContentProjectInput {
projectDir?: string;
}
export const CONTENT_PROJECT_DIR_PROPERTY = {
type: "string",
description: "Optional absolute project directory. Defaults to the active conversation cwd.",
} as const;
export const CONTENT_REVISION_PROPERTY = {
type: "number",
description:
"Current project revision returned by the inspect operation. Include it to reject concurrent changes instead of overwriting newer state.",
} as const;
export function resolveContentProjectCwd(input: ContentProjectInput, sessionCwd: string): string {
return input.projectDir?.trim() || sessionCwd;
}
/** 触发工具的会话;面板请求要按它寻址,与内容项目目录(可由 projectDir 指到别处)无关。 */
export interface ContentToolSession {
readonly id: string;
readonly cwd: string;
}
/**
* 工具改完画布后展开工作台。带上触发会话:用户同时开着别的会话时,后台会话不会在用户
* 眼前打开面板,宿主等用户切过去再打开(Plugin API 2.14.0)。
*/
export function openContentWorkspaceTab(ctx: PluginContext, session: ContentToolSession): void {
ctx.ui.openActivityTab(CONTENT_WORKSPACE_TAB_ID, { width: "max", cwd: session.cwd, sessionId: session.id });
}