This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { mkdirSync, writeFileSync, renameSync, unlinkSync, realpathSync, cpSync, rmSync, existsSync, readdirSync, lstatSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { join, isAbsolute, resolve } from 'path';
|
||||
import type { ToolDef } from '../../llm/openai-compat.js';
|
||||
import type { ToolContext, ToolResult } from './core.js';
|
||||
import { VALID_SKILL_NAME } from '../skills.js';
|
||||
@@ -99,7 +99,7 @@ export const TOOL_DEFS: Record<string, ToolDef> = {
|
||||
type: 'function',
|
||||
function: {
|
||||
name: 'InstallSkill',
|
||||
description: 'スキル(参照知識: 手順書・ガイド)をインストール。Piece(実行テンプレート)とは異なる。通常は content に SKILL.md 全文を渡す。workspace 内にスキルディレクトリを構築済みの場合のみ sourcePath を使用。',
|
||||
description: 'スキル(参照知識: 手順書・ガイド)をインストール。Piece(実行テンプレート)とは異なる。通常は content に SKILL.md 全文を渡し、workspace 内にディレクトリを構築済みの場合のみ sourcePath を使う。詳細は ReadToolDoc({ name: "InstallSkill" })。',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@@ -116,7 +116,7 @@ export const TOOL_DEFS: Record<string, ToolDef> = {
|
||||
type: 'function',
|
||||
function: {
|
||||
name: 'ReadSkill',
|
||||
description: 'スキル(参照知識: 手順書・ガイド・規約)の全文を取得する。Piece の定義取得には GetPiece を使うこと。利用可能なスキル一覧はシステムプロンプトの Skills Index を参照。',
|
||||
description: 'スキル(参照知識: 手順書・ガイド・規約)の全文を取得する(ディレクトリ型は scripts 等を workspace の skills/ にコピーして実行可能にする)。一覧はシステムプロンプトの Skills Index を参照。詳細は ReadToolDoc({ name: "ReadSkill" })。',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@@ -130,7 +130,7 @@ export const TOOL_DEFS: Record<string, ToolDef> = {
|
||||
type: 'function',
|
||||
function: {
|
||||
name: 'ListSkills',
|
||||
description: 'インストール済みスキル(参照知識)の一覧を返す。Piece(実行テンプレート)の一覧は ListPieces を使うこと。',
|
||||
description: 'インストール済みスキル(参照知識)の一覧を返す。Piece(実行テンプレート)の一覧は ListPieces を使うこと。詳細は ReadToolDoc({ name: "ListSkills" })。',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {},
|
||||
@@ -192,10 +192,20 @@ function executeInstallSkill(
|
||||
|
||||
// --- sourcePath mode: copy directory from workspace ---
|
||||
if (sourcePath) {
|
||||
if (typeof sourcePath !== 'string') {
|
||||
return { output: 'InstallSkill: "sourcePath" must be a string', isError: true };
|
||||
}
|
||||
let realSource: string;
|
||||
let realWorkspace: string;
|
||||
try {
|
||||
realSource = realpathSync(sourcePath);
|
||||
// Resolve relative paths against the workspace root, mirroring
|
||||
// resolveAndGuard() used by Read/Write/Edit. Without this, a natural
|
||||
// workspace-relative path (e.g. "output/my-skill") would resolve against
|
||||
// the orchestrator's process cwd and get wrongly rejected as outside the
|
||||
// workspace. Kept inside try so any path-resolution error returns a
|
||||
// friendly result instead of crashing the task.
|
||||
const absSource = isAbsolute(sourcePath) ? sourcePath : resolve(ctx.workspacePath, sourcePath);
|
||||
realSource = realpathSync(absSource);
|
||||
realWorkspace = realpathSync(ctx.workspacePath);
|
||||
} catch (e) {
|
||||
return { output: `InstallSkill: sourcePath does not exist or is not accessible. Use "content" parameter instead to pass SKILL.md text directly.`, isError: true };
|
||||
|
||||
Reference in New Issue
Block a user