u
This commit is contained in:
@@ -4,6 +4,7 @@ import { defineTool, ToolError } from 'libllmorbiter';
|
||||
import { isReadOnlyDatabasePath } from './vfs.js';
|
||||
import { isSkillPath, renderSkill, parseSkill, SKILL_EXT, skillFileName } from './skill.js';
|
||||
import { prepareVfs, syncVfsToDb } from './vfs.js';
|
||||
import { TOOL_DESCRIPTIONS, PATCH_PARAMETER_DESCRIPTIONS } from './prompts.js';
|
||||
|
||||
/**
|
||||
* patch — applies edit operations to files in the virtual filesystem (VFS).
|
||||
@@ -66,11 +67,7 @@ function toLines(text) {
|
||||
export function createPatchTool({ googleAuthId }) {
|
||||
return defineTool({
|
||||
name: 'patch',
|
||||
description:
|
||||
'Create, overwrite, or search-and-replace text in VFS files. Operations apply in order. ' +
|
||||
'Mode: search null/omitted = create or overwrite (directories auto-created). ' +
|
||||
'search provided = replace first verbatim occurrence (read file with read_file first). ' +
|
||||
'SKILL files: root-only "<slug>.SKILL" (line 1 is title, or provide title field).',
|
||||
description: TOOL_DESCRIPTIONS.patch,
|
||||
strict: false,
|
||||
parameters: {
|
||||
type: 'object',
|
||||
@@ -79,7 +76,7 @@ export function createPatchTool({ googleAuthId }) {
|
||||
properties: {
|
||||
operations: {
|
||||
type: 'array',
|
||||
description: 'Ordered patch operations.',
|
||||
description: PATCH_PARAMETER_DESCRIPTIONS.operations,
|
||||
items: {
|
||||
type: 'object',
|
||||
additionalProperties: false,
|
||||
@@ -87,23 +84,23 @@ export function createPatchTool({ googleAuthId }) {
|
||||
properties: {
|
||||
file: {
|
||||
type: 'string',
|
||||
description: 'VFS path (e.g. "notes.md", "pipeline.SKILL"). SKILL files must be root-level (no "/").',
|
||||
description: PATCH_PARAMETER_DESCRIPTIONS.file,
|
||||
},
|
||||
search: {
|
||||
type: ['string', 'null'],
|
||||
description: 'Exact text to replace. null/omitted = overwrite or create file.',
|
||||
description: PATCH_PARAMETER_DESCRIPTIONS.search,
|
||||
},
|
||||
replace: {
|
||||
type: 'string',
|
||||
description: 'Replacement text.',
|
||||
description: PATCH_PARAMETER_DESCRIPTIONS.replace,
|
||||
},
|
||||
title: {
|
||||
type: ['string', 'null'],
|
||||
description: 'Optional line-1 title for SKILL files or null.',
|
||||
description: PATCH_PARAMETER_DESCRIPTIONS.title,
|
||||
},
|
||||
skiplines: {
|
||||
type: ['integer', 'null'],
|
||||
description: 'Lines to skip before searching or null.',
|
||||
description: PATCH_PARAMETER_DESCRIPTIONS.skiplines,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user