@code4bug/jarvis-agent 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +2 -2
- package/dist/commands/index.js +2 -2
- package/dist/commands/init.js +1 -1
- package/dist/components/MessageItem.d.ts +1 -1
- package/dist/components/MessageItem.js +1 -1
- package/dist/components/SlashCommandMenu.d.ts +1 -1
- package/dist/components/StatusBar.js +1 -1
- package/dist/components/StreamingText.js +1 -1
- package/dist/components/WelcomeHeader.js +1 -1
- package/dist/config/constants.js +3 -3
- package/dist/core/QueryEngine.d.ts +1 -1
- package/dist/core/QueryEngine.js +7 -7
- package/dist/core/WorkerBridge.d.ts +2 -2
- package/dist/core/hint.js +4 -4
- package/dist/core/query.js +3 -3
- package/dist/hooks/useSlashMenu.d.ts +5 -5
- package/dist/hooks/useSlashMenu.js +4 -4
- package/dist/hooks/useStreamThrottle.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/screens/repl.js +18 -18
- package/dist/screens/slashCommands.d.ts +1 -1
- package/dist/screens/slashCommands.js +5 -5
- package/dist/services/api/llm.d.ts +2 -2
- package/dist/services/api/llm.js +5 -5
- package/dist/services/api/mock.d.ts +1 -1
- package/dist/skills/index.d.ts +2 -2
- package/dist/skills/index.js +2 -2
- package/dist/tools/createSkill.d.ts +1 -1
- package/dist/tools/createSkill.js +3 -3
- package/dist/tools/index.d.ts +8 -8
- package/dist/tools/index.js +8 -8
- package/dist/tools/listDirectory.d.ts +1 -1
- package/dist/tools/readFile.d.ts +1 -1
- package/dist/tools/runCommand.d.ts +1 -1
- package/dist/tools/runCommand.js +1 -1
- package/dist/tools/searchFiles.d.ts +1 -1
- package/dist/tools/semanticSearch.d.ts +1 -1
- package/dist/tools/semanticSearch.js +1 -1
- package/dist/tools/writeFile.d.ts +1 -1
- package/dist/tools/writeFile.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { APP_VERSION } from './config/constants';
|
|
3
|
-
import { startJarvis } from './index';
|
|
2
|
+
import { APP_VERSION } from './config/constants.js';
|
|
3
|
+
import { startJarvis } from './index.js';
|
|
4
4
|
const arg = process.argv[2];
|
|
5
5
|
if (arg === '--version' || arg === '-v' || arg === 'version') {
|
|
6
6
|
console.log(APP_VERSION);
|
package/dist/commands/index.js
CHANGED
|
@@ -26,8 +26,8 @@ const toolCommands = [
|
|
|
26
26
|
{ name: 'create_skill', description: '创建新的 Skill 到 ~/.jarvis/skills/', category: 'builtin' },
|
|
27
27
|
];
|
|
28
28
|
/** 智能体子命令:从 agents 目录动态加载(二级菜单) */
|
|
29
|
-
import { loadAllAgents } from '../agents/index';
|
|
30
|
-
import { listSkills } from '../skills/index';
|
|
29
|
+
import { loadAllAgents } from '../agents/index.js';
|
|
30
|
+
import { listSkills } from '../skills/index.js';
|
|
31
31
|
let _agentSubCommands = null;
|
|
32
32
|
export function getAgentSubCommands() {
|
|
33
33
|
if (_agentSubCommands)
|
package/dist/commands/init.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
import path from 'path';
|
|
9
9
|
import { execSync } from 'child_process';
|
|
10
|
-
import { APP_NAME, APP_VERSION } from '../config/constants';
|
|
10
|
+
import { APP_NAME, APP_VERSION } from '../config/constants.js';
|
|
11
11
|
// ===== 辅助函数 =====
|
|
12
12
|
/** 安全执行命令 */
|
|
13
13
|
function safeExec(cmd) {
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Box, Text } from 'ink';
|
|
4
4
|
import Spinner from 'ink-spinner';
|
|
5
|
-
import MarkdownText from './MarkdownText';
|
|
5
|
+
import MarkdownText from './MarkdownText.js';
|
|
6
6
|
// 状态圆点 icon,根据消息类型 + 状态决定颜色
|
|
7
7
|
// reasoning 完成 → 白色 / tool_exec 成功 → 绿色 / error → 红色 / aborted → 黄色 / pending → 黄色
|
|
8
8
|
function statusDot(status, type) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Box, Text } from 'ink';
|
|
4
|
-
import { MODEL_NAME, PROJECT_NAME, ENABLE_THINKING_MODE_TOGGLE, CONTEXT_TOKEN_LIMIT } from '../config/constants';
|
|
4
|
+
import { MODEL_NAME, PROJECT_NAME, ENABLE_THINKING_MODE_TOGGLE, CONTEXT_TOKEN_LIMIT } from '../config/constants.js';
|
|
5
5
|
/** 生成 token 用量进度条 */
|
|
6
6
|
function tokenProgressBar(used, limit, barWidth) {
|
|
7
7
|
const ratio = Math.min(used / limit, 1);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Box, Text } from 'ink';
|
|
4
|
-
import MarkdownText from './MarkdownText';
|
|
4
|
+
import MarkdownText from './MarkdownText.js';
|
|
5
5
|
function StreamingText({ text }) {
|
|
6
6
|
if (!text)
|
|
7
7
|
return null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Box, Text } from 'ink';
|
|
4
|
-
import { APP_NAME, APP_VERSION, MODEL_NAME } from '../config/constants';
|
|
4
|
+
import { APP_NAME, APP_VERSION, MODEL_NAME } from '../config/constants.js';
|
|
5
5
|
function truncatePath(p, max) {
|
|
6
6
|
if (p.length <= max)
|
|
7
7
|
return p;
|
package/dist/config/constants.js
CHANGED
|
@@ -24,7 +24,7 @@ export const SESSIONS_DIR = path.join(os.homedir(), '.jarvis', 'sessions');
|
|
|
24
24
|
/** 输入后是否隐藏 WelcomeHeader,默认 false(不隐藏) */
|
|
25
25
|
export const HIDE_WELCOME_AFTER_INPUT = false;
|
|
26
26
|
/** 从配置文件获取当前模型名称 */
|
|
27
|
-
import { loadConfig, getActiveModel } from './loader';
|
|
27
|
+
import { loadConfig, getActiveModel } from './loader.js';
|
|
28
28
|
const _cfg = loadConfig();
|
|
29
29
|
function resolveModelName() {
|
|
30
30
|
try {
|
|
@@ -50,8 +50,8 @@ export const DEFAULT_AGENT_COLOR = 'green';
|
|
|
50
50
|
/** 智能体默认标识符 */
|
|
51
51
|
export const DEFAULT_AGENT_EMOJI = '>';
|
|
52
52
|
// ===== 动态应用名称(跟随激活智能体) =====
|
|
53
|
-
import { getAgent } from '../agents/index';
|
|
54
|
-
import { getActiveAgent } from './agentState';
|
|
53
|
+
import { getAgent } from '../agents/index.js';
|
|
54
|
+
import { getActiveAgent } from './agentState.js';
|
|
55
55
|
/** 当前激活的智能体名称 — 启动时从 ~/.jarvis/agent.json 读取,运行时可切换 */
|
|
56
56
|
export const DEFAULT_AGENT = getActiveAgent(DEFAULT_AGENT_FALLBACK);
|
|
57
57
|
function resolveAppName() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Message, Session, LoopState } from '../types/index.js';
|
|
2
|
-
import { DangerConfirmResult } from './query';
|
|
2
|
+
import { DangerConfirmResult } from './query.js';
|
|
3
3
|
export interface EngineCallbacks {
|
|
4
4
|
onMessage: (msg: Message) => void;
|
|
5
5
|
onUpdateMessage: (id: string, updates: Partial<Message>) => void;
|
package/dist/core/QueryEngine.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { v4 as uuid } from 'uuid';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
import { WorkerBridge } from './WorkerBridge';
|
|
5
|
-
import { MockService } from '../services/api/mock';
|
|
6
|
-
import { LLMServiceImpl } from '../services/api/llm';
|
|
7
|
-
import { loadConfig, getActiveModel } from '../config/loader';
|
|
8
|
-
import { SESSIONS_DIR } from '../config/constants';
|
|
9
|
-
import { setActiveAgent } from '../config/agentState';
|
|
10
|
-
import { clearAuthorizations } from './safeguard';
|
|
4
|
+
import { WorkerBridge } from './WorkerBridge.js';
|
|
5
|
+
import { MockService } from '../services/api/mock.js';
|
|
6
|
+
import { LLMServiceImpl } from '../services/api/llm.js';
|
|
7
|
+
import { loadConfig, getActiveModel } from '../config/loader.js';
|
|
8
|
+
import { SESSIONS_DIR } from '../config/constants.js';
|
|
9
|
+
import { setActiveAgent } from '../config/agentState.js';
|
|
10
|
+
import { clearAuthorizations } from './safeguard.js';
|
|
11
11
|
export class QueryEngine {
|
|
12
12
|
service;
|
|
13
13
|
session;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TranscriptMessage } from '../types/index';
|
|
2
|
-
import { EngineCallbacks } from './QueryEngine';
|
|
1
|
+
import { TranscriptMessage } from '../types/index.js';
|
|
2
|
+
import { EngineCallbacks } from './QueryEngine.js';
|
|
3
3
|
export declare class WorkerBridge {
|
|
4
4
|
private worker;
|
|
5
5
|
/** 在独立 Worker 线程中执行查询,返回更新后的 transcript */
|
package/dist/core/hint.js
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
import path from 'path';
|
|
9
|
-
import { getAgent } from '../agents/index';
|
|
10
|
-
import { DEFAULT_AGENT } from '../config/constants';
|
|
11
|
-
import { loadConfig, getActiveModel } from '../config/loader';
|
|
12
|
-
import { getDefaultConfig } from '../services/api/llm';
|
|
9
|
+
import { getAgent } from '../agents/index.js';
|
|
10
|
+
import { DEFAULT_AGENT } from '../config/constants.js';
|
|
11
|
+
import { loadConfig, getActiveModel } from '../config/loader.js';
|
|
12
|
+
import { getDefaultConfig } from '../services/api/llm.js';
|
|
13
13
|
/** 安全读取 JSON 文件 */
|
|
14
14
|
function readJsonSafe(filePath) {
|
|
15
15
|
try {
|
package/dist/core/query.js
CHANGED
|
@@ -2,9 +2,9 @@ import { v4 as uuid } from 'uuid';
|
|
|
2
2
|
import { Worker } from 'worker_threads';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
import path from 'path';
|
|
5
|
-
import { findToolMerged as findTool } from '../tools/index';
|
|
6
|
-
import { MAX_ITERATIONS } from '../config/constants';
|
|
7
|
-
import { sanitizeOutput, validateCommand, authorizeCommand, authorizeRule } from './safeguard';
|
|
5
|
+
import { findToolMerged as findTool } from '../tools/index.js';
|
|
6
|
+
import { MAX_ITERATIONS } from '../config/constants.js';
|
|
7
|
+
import { sanitizeOutput, validateCommand, authorizeCommand, authorizeRule } from './safeguard.js';
|
|
8
8
|
// 兼容 ESM __dirname
|
|
9
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
10
|
const __dirname = path.dirname(__filename);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Message } from '../types/index';
|
|
2
|
-
import { QueryEngine } from '../core/QueryEngine';
|
|
3
|
-
import { SlashCommand } from '../commands/index';
|
|
1
|
+
import { Message } from '../types/index.js';
|
|
2
|
+
import { QueryEngine } from '../core/QueryEngine.js';
|
|
3
|
+
import { SlashCommand } from '../commands/index.js';
|
|
4
4
|
interface UseSlashMenuOptions {
|
|
5
5
|
engineRef: React.RefObject<QueryEngine | null>;
|
|
6
|
-
sessionRef: React.MutableRefObject<import('../types/index').Session>;
|
|
6
|
+
sessionRef: React.MutableRefObject<import('../types/index.js').Session>;
|
|
7
7
|
tokenCountRef: React.MutableRefObject<number>;
|
|
8
8
|
setMessages: React.Dispatch<React.SetStateAction<Message[]>>;
|
|
9
9
|
setDisplayTokens: (n: number) => void;
|
|
10
|
-
setLoopState: React.Dispatch<React.SetStateAction<import('../types/index').LoopState | null>>;
|
|
10
|
+
setLoopState: React.Dispatch<React.SetStateAction<import('../types/index.js').LoopState | null>>;
|
|
11
11
|
setIsProcessing: React.Dispatch<React.SetStateAction<boolean>>;
|
|
12
12
|
setShowWelcome: React.Dispatch<React.SetStateAction<boolean>>;
|
|
13
13
|
setInput: React.Dispatch<React.SetStateAction<string>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useState, useCallback } from 'react';
|
|
2
|
-
import { QueryEngine } from '../core/QueryEngine';
|
|
3
|
-
import { filterCommands, filterAgentCommands } from '../commands/index';
|
|
4
|
-
import { setActiveAgent } from '../config/agentState';
|
|
5
|
-
import { executeSlashCommand } from '../screens/slashCommands';
|
|
2
|
+
import { QueryEngine } from '../core/QueryEngine.js';
|
|
3
|
+
import { filterCommands, filterAgentCommands } from '../commands/index.js';
|
|
4
|
+
import { setActiveAgent } from '../config/agentState.js';
|
|
5
|
+
import { executeSlashCommand } from '../screens/slashCommands.js';
|
|
6
6
|
/**
|
|
7
7
|
* 斜杠命令菜单状态管理 hook
|
|
8
8
|
*
|
package/dist/index.js
CHANGED
package/dist/screens/repl.js
CHANGED
|
@@ -2,24 +2,24 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useCallback, useRef, useEffect } from 'react';
|
|
3
3
|
import { Box, Text, useInput, useApp } from 'ink';
|
|
4
4
|
import Spinner from 'ink-spinner';
|
|
5
|
-
import MultilineInput from '../components/MultilineInput';
|
|
6
|
-
import WelcomeHeader from '../components/WelcomeHeader';
|
|
7
|
-
import MessageItem from '../components/MessageItem';
|
|
8
|
-
import StreamingText from '../components/StreamingText';
|
|
9
|
-
import StatusBar from '../components/StatusBar';
|
|
10
|
-
import SlashCommandMenu from '../components/SlashCommandMenu';
|
|
11
|
-
import DangerConfirm from '../components/DangerConfirm';
|
|
12
|
-
import { useWindowFocus } from '../hooks/useFocus';
|
|
13
|
-
import { useInputHistory } from '../hooks/useInputHistory';
|
|
14
|
-
import { useDoubleCtrlCExit } from '../hooks/useDoubleCtrlCExit';
|
|
15
|
-
import { useTerminalWidth } from '../hooks/useTerminalWidth';
|
|
16
|
-
import { useStreamThrottle } from '../hooks/useStreamThrottle';
|
|
17
|
-
import { useTokenDisplay } from '../hooks/useTokenDisplay';
|
|
18
|
-
import { useSlashMenu } from '../hooks/useSlashMenu';
|
|
19
|
-
import { executeSlashCommand } from './slashCommands';
|
|
20
|
-
import { QueryEngine } from '../core/QueryEngine';
|
|
21
|
-
import { HIDE_WELCOME_AFTER_INPUT } from '../config/constants';
|
|
22
|
-
import { generateAgentHint } from '../core/hint';
|
|
5
|
+
import MultilineInput from '../components/MultilineInput.js';
|
|
6
|
+
import WelcomeHeader from '../components/WelcomeHeader.js';
|
|
7
|
+
import MessageItem from '../components/MessageItem.js';
|
|
8
|
+
import StreamingText from '../components/StreamingText.js';
|
|
9
|
+
import StatusBar from '../components/StatusBar.js';
|
|
10
|
+
import SlashCommandMenu from '../components/SlashCommandMenu.js';
|
|
11
|
+
import DangerConfirm from '../components/DangerConfirm.js';
|
|
12
|
+
import { useWindowFocus } from '../hooks/useFocus.js';
|
|
13
|
+
import { useInputHistory } from '../hooks/useInputHistory.js';
|
|
14
|
+
import { useDoubleCtrlCExit } from '../hooks/useDoubleCtrlCExit.js';
|
|
15
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
16
|
+
import { useStreamThrottle } from '../hooks/useStreamThrottle.js';
|
|
17
|
+
import { useTokenDisplay } from '../hooks/useTokenDisplay.js';
|
|
18
|
+
import { useSlashMenu } from '../hooks/useSlashMenu.js';
|
|
19
|
+
import { executeSlashCommand } from './slashCommands.js';
|
|
20
|
+
import { QueryEngine } from '../core/QueryEngine.js';
|
|
21
|
+
import { HIDE_WELCOME_AFTER_INPUT } from '../config/constants.js';
|
|
22
|
+
import { generateAgentHint } from '../core/hint.js';
|
|
23
23
|
export default function REPL() {
|
|
24
24
|
const { exit } = useApp();
|
|
25
25
|
const width = useTerminalWidth();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { executeInit } from '../commands/init';
|
|
2
|
-
import { APP_VERSION } from '../config/constants';
|
|
3
|
-
import { allTools } from '../tools/index';
|
|
4
|
-
import { listSkills } from '../skills/index';
|
|
5
|
-
import { getExternalSkillsDir } from '../skills/loader';
|
|
1
|
+
import { executeInit } from '../commands/init.js';
|
|
2
|
+
import { APP_VERSION } from '../config/constants.js';
|
|
3
|
+
import { allTools } from '../tools/index.js';
|
|
4
|
+
import { listSkills } from '../skills/index.js';
|
|
5
|
+
import { getExternalSkillsDir } from '../skills/loader.js';
|
|
6
6
|
import { listPermanentAuthorizations, DANGER_RULES, } from '../core/safeguard.js';
|
|
7
7
|
/**
|
|
8
8
|
* 斜杠命令执行器
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* 2. ~/.jarvis/config.json
|
|
7
7
|
* 3. ./.jarvis/config.json
|
|
8
8
|
*/
|
|
9
|
-
import { LLMService, StreamCallbacks, TranscriptMessage, Tool, AbortSignal as AppAbortSignal } from '../../types/index';
|
|
10
|
-
import { ModelConfig } from '../../config/loader';
|
|
9
|
+
import { LLMService, StreamCallbacks, TranscriptMessage, Tool, AbortSignal as AppAbortSignal } from '../../types/index.js';
|
|
10
|
+
import { ModelConfig } from '../../config/loader.js';
|
|
11
11
|
export interface LLMConfig {
|
|
12
12
|
apiKey: string;
|
|
13
13
|
model: string;
|
package/dist/services/api/llm.js
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* 2. ~/.jarvis/config.json
|
|
7
7
|
* 3. ./.jarvis/config.json
|
|
8
8
|
*/
|
|
9
|
-
import { loadConfig, getActiveModel } from '../../config/loader';
|
|
10
|
-
import { getAgent } from '../../agents/index';
|
|
11
|
-
import { DEFAULT_AGENT } from '../../config/constants';
|
|
12
|
-
import { getActiveAgent } from '../../config/agentState';
|
|
13
|
-
import { getSystemInfoPrompt } from '../../config/systemInfo';
|
|
9
|
+
import { loadConfig, getActiveModel } from '../../config/loader.js';
|
|
10
|
+
import { getAgent } from '../../agents/index.js';
|
|
11
|
+
import { DEFAULT_AGENT } from '../../config/constants.js';
|
|
12
|
+
import { getActiveAgent } from '../../config/agentState.js';
|
|
13
|
+
import { getSystemInfoPrompt } from '../../config/systemInfo.js';
|
|
14
14
|
/** 从配置文件构建 LLMConfig,找不到则回退环境变量 */
|
|
15
15
|
export function getDefaultConfig() {
|
|
16
16
|
const jarvisCfg = loadConfig();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LLMService, StreamCallbacks, TranscriptMessage, Tool, AbortSignal as AppAbortSignal } from '../../types/index';
|
|
1
|
+
import { LLMService, StreamCallbacks, TranscriptMessage, Tool, AbortSignal as AppAbortSignal } from '../../types/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Mock LLM 服务 - 模拟智能体行为,支持工具调用
|
|
4
4
|
*/
|
package/dist/skills/index.d.ts
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* 如果 skill 目录下存在 skill.py,execute 时直接调用 Python 脚本获取真实结果;
|
|
10
10
|
* 否则回退为返回 skill 指令文本(由 LLM 解释执行)。
|
|
11
11
|
*/
|
|
12
|
-
import { Tool } from '../types/index';
|
|
13
|
-
import { SkillDefinition } from './loader';
|
|
12
|
+
import { Tool } from '../types/index.js';
|
|
13
|
+
import { SkillDefinition } from './loader.js';
|
|
14
14
|
/** 加载所有外部 skills(带缓存) */
|
|
15
15
|
export declare function loadExternalSkills(): SkillDefinition[];
|
|
16
16
|
/** 获取合并后的所有工具:内置 tools + 外部 skills */
|
package/dist/skills/index.js
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
import { exec } from 'child_process';
|
|
13
13
|
import fs from 'fs';
|
|
14
14
|
import path from 'path';
|
|
15
|
-
import { scanExternalSkills, getExternalSkillsDir } from './loader';
|
|
16
|
-
import { allTools as builtinTools } from '../tools/index';
|
|
15
|
+
import { scanExternalSkills, getExternalSkillsDir } from './loader.js';
|
|
16
|
+
import { allTools as builtinTools } from '../tools/index.js';
|
|
17
17
|
// ===== 缓存 =====
|
|
18
18
|
let _skillCache = null;
|
|
19
19
|
let _mergedTools = null;
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
import path from 'path';
|
|
9
9
|
import os from 'os';
|
|
10
|
-
import { getExternalSkillsDir } from '../skills/loader';
|
|
11
|
-
import { reloadSkills } from '../skills/index';
|
|
12
|
-
import { LLMServiceImpl, getDefaultConfig } from '../services/api/llm';
|
|
10
|
+
import { getExternalSkillsDir } from '../skills/loader.js';
|
|
11
|
+
import { reloadSkills } from '../skills/index.js';
|
|
12
|
+
import { LLMServiceImpl, getDefaultConfig } from '../services/api/llm.js';
|
|
13
13
|
// SKILL_INSTRUCTIONS.md 查找路径:项目根目录 > 用户主目录
|
|
14
14
|
function loadSkillInstructions() {
|
|
15
15
|
const candidates = [
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Tool } from '../types/index';
|
|
2
|
-
import { readFile } from './readFile';
|
|
3
|
-
import { writeFile } from './writeFile';
|
|
4
|
-
import { runCommand } from './runCommand';
|
|
5
|
-
import { listDirectory } from './listDirectory';
|
|
6
|
-
import { searchFiles } from './searchFiles';
|
|
7
|
-
import { semanticSearch } from './semanticSearch';
|
|
8
|
-
import { createSkill } from './createSkill';
|
|
1
|
+
import { Tool } from '../types/index.js';
|
|
2
|
+
import { readFile } from './readFile.js';
|
|
3
|
+
import { writeFile } from './writeFile.js';
|
|
4
|
+
import { runCommand } from './runCommand.js';
|
|
5
|
+
import { listDirectory } from './listDirectory.js';
|
|
6
|
+
import { searchFiles } from './searchFiles.js';
|
|
7
|
+
import { semanticSearch } from './semanticSearch.js';
|
|
8
|
+
import { createSkill } from './createSkill.js';
|
|
9
9
|
export { readFile, writeFile, runCommand, listDirectory, searchFiles, semanticSearch, createSkill };
|
|
10
10
|
/** 所有内置工具 */
|
|
11
11
|
export declare const allTools: Tool[];
|
package/dist/tools/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { readFile } from './readFile';
|
|
2
|
-
import { writeFile } from './writeFile';
|
|
3
|
-
import { runCommand } from './runCommand';
|
|
4
|
-
import { listDirectory } from './listDirectory';
|
|
5
|
-
import { searchFiles } from './searchFiles';
|
|
6
|
-
import { semanticSearch } from './semanticSearch';
|
|
7
|
-
import { createSkill } from './createSkill';
|
|
1
|
+
import { readFile } from './readFile.js';
|
|
2
|
+
import { writeFile } from './writeFile.js';
|
|
3
|
+
import { runCommand } from './runCommand.js';
|
|
4
|
+
import { listDirectory } from './listDirectory.js';
|
|
5
|
+
import { searchFiles } from './searchFiles.js';
|
|
6
|
+
import { semanticSearch } from './semanticSearch.js';
|
|
7
|
+
import { createSkill } from './createSkill.js';
|
|
8
8
|
export { readFile, writeFile, runCommand, listDirectory, searchFiles, semanticSearch, createSkill };
|
|
9
9
|
/** 所有内置工具 */
|
|
10
10
|
export const allTools = [readFile, writeFile, runCommand, listDirectory, searchFiles, semanticSearch, createSkill];
|
|
@@ -13,7 +13,7 @@ export function findTool(name) {
|
|
|
13
13
|
return allTools.find((t) => t.name === name);
|
|
14
14
|
}
|
|
15
15
|
// ===== 合并工具(内置 + 外部 Skills)=====
|
|
16
|
-
import { getMergedTools, findMergedTool } from '../skills/index';
|
|
16
|
+
import { getMergedTools, findMergedTool } from '../skills/index.js';
|
|
17
17
|
/** 获取所有工具(内置 + 外部 skills),供 QueryEngine 使用 */
|
|
18
18
|
export function getAllTools() {
|
|
19
19
|
return getMergedTools();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Tool } from '../types/index';
|
|
1
|
+
import { Tool } from '../types/index.js';
|
|
2
2
|
export declare const listDirectory: Tool;
|
package/dist/tools/readFile.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Tool } from '../types/index';
|
|
1
|
+
import { Tool } from '../types/index.js';
|
|
2
2
|
export declare const readFile: Tool;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Tool } from '../types/index';
|
|
1
|
+
import { Tool } from '../types/index.js';
|
|
2
2
|
export declare const runCommand: Tool;
|
package/dist/tools/runCommand.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Tool } from '../types/index';
|
|
1
|
+
import { Tool } from '../types/index.js';
|
|
2
2
|
export declare const searchFiles: Tool;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import fs from 'fs';
|
|
9
9
|
import path from 'path';
|
|
10
|
-
import { loadConfig, getActiveModel } from '../config/loader';
|
|
10
|
+
import { loadConfig, getActiveModel } from '../config/loader.js';
|
|
11
11
|
/** 通过 LLM 扩展关键词,返回扩展后的词列表(含原始关键词) */
|
|
12
12
|
async function expandKeywords(keyword) {
|
|
13
13
|
const config = loadConfig();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Tool } from '../types/index';
|
|
1
|
+
import { Tool } from '../types/index.js';
|
|
2
2
|
export declare const writeFile: Tool;
|
package/dist/tools/writeFile.js
CHANGED