@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.
Files changed (41) hide show
  1. package/dist/cli.js +2 -2
  2. package/dist/commands/index.js +2 -2
  3. package/dist/commands/init.js +1 -1
  4. package/dist/components/MessageItem.d.ts +1 -1
  5. package/dist/components/MessageItem.js +1 -1
  6. package/dist/components/SlashCommandMenu.d.ts +1 -1
  7. package/dist/components/StatusBar.js +1 -1
  8. package/dist/components/StreamingText.js +1 -1
  9. package/dist/components/WelcomeHeader.js +1 -1
  10. package/dist/config/constants.js +3 -3
  11. package/dist/core/QueryEngine.d.ts +1 -1
  12. package/dist/core/QueryEngine.js +7 -7
  13. package/dist/core/WorkerBridge.d.ts +2 -2
  14. package/dist/core/hint.js +4 -4
  15. package/dist/core/query.js +3 -3
  16. package/dist/hooks/useSlashMenu.d.ts +5 -5
  17. package/dist/hooks/useSlashMenu.js +4 -4
  18. package/dist/hooks/useStreamThrottle.d.ts +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/screens/repl.js +18 -18
  21. package/dist/screens/slashCommands.d.ts +1 -1
  22. package/dist/screens/slashCommands.js +5 -5
  23. package/dist/services/api/llm.d.ts +2 -2
  24. package/dist/services/api/llm.js +5 -5
  25. package/dist/services/api/mock.d.ts +1 -1
  26. package/dist/skills/index.d.ts +2 -2
  27. package/dist/skills/index.js +2 -2
  28. package/dist/tools/createSkill.d.ts +1 -1
  29. package/dist/tools/createSkill.js +3 -3
  30. package/dist/tools/index.d.ts +8 -8
  31. package/dist/tools/index.js +8 -8
  32. package/dist/tools/listDirectory.d.ts +1 -1
  33. package/dist/tools/readFile.d.ts +1 -1
  34. package/dist/tools/runCommand.d.ts +1 -1
  35. package/dist/tools/runCommand.js +1 -1
  36. package/dist/tools/searchFiles.d.ts +1 -1
  37. package/dist/tools/semanticSearch.d.ts +1 -1
  38. package/dist/tools/semanticSearch.js +1 -1
  39. package/dist/tools/writeFile.d.ts +1 -1
  40. package/dist/tools/writeFile.js +1 -1
  41. 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);
@@ -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)
@@ -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) {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Message } from '../types/index';
2
+ import { Message } from '../types/index.js';
3
3
  declare function MessageItem({ msg, showDetails }: {
4
4
  msg: Message;
5
5
  showDetails?: boolean;
@@ -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,5 +1,5 @@
1
1
  import React from 'react';
2
- import { SlashCommand } from '../commands/index';
2
+ import { SlashCommand } from '../commands/index.js';
3
3
  interface SlashCommandMenuProps {
4
4
  commands: SlashCommand[];
5
5
  selectedIndex: number;
@@ -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;
@@ -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;
@@ -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 {
@@ -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
  *
@@ -1,4 +1,4 @@
1
- import { Message } from '../types/index';
1
+ import { Message } from '../types/index.js';
2
2
  /**
3
3
  * 流式文本 + thinking 文本节流 hook
4
4
  *
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { render } from 'ink';
3
- import REPL from './screens/repl';
3
+ import REPL from './screens/repl.js';
4
4
  export function startJarvis() {
5
5
  render(_jsx(REPL, {}), { exitOnCtrlC: false });
6
6
  }
@@ -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,4 +1,4 @@
1
- import { Message } from '../types/index';
1
+ import { Message } from '../types/index.js';
2
2
  /**
3
3
  * 斜杠命令执行器
4
4
  *
@@ -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;
@@ -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
  */
@@ -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 */
@@ -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;
@@ -4,5 +4,5 @@
4
4
  * 根据用户需求,调用 LLM 基于 SKILL_INSTRUCTIONS.md 规范自动生成 skill,
5
5
  * 并写入 ~/.jarvis/skills/ 目录。
6
6
  */
7
- import { Tool } from '../types/index';
7
+ import { Tool } from '../types/index.js';
8
8
  export declare const createSkill: Tool;
@@ -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 = [
@@ -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[];
@@ -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;
@@ -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;
@@ -1,5 +1,5 @@
1
1
  import { exec } from 'child_process';
2
- import { sanitizeOutput } from '../core/safeguard';
2
+ import { sanitizeOutput } from '../core/safeguard.js';
3
3
  /**
4
4
  * 异步执行命令,支持通过 abortSignal 中断子进程
5
5
  */
@@ -1,2 +1,2 @@
1
- import { Tool } from '../types/index';
1
+ import { Tool } from '../types/index.js';
2
2
  export declare const searchFiles: Tool;
@@ -5,5 +5,5 @@
5
5
  * 再用扩展后的词集合在文件中进行匹配搜索,实现"相似搜索"能力。
6
6
  * 未配置大模型时降级为普通关键词搜索。
7
7
  */
8
- import { Tool } from '../types/index';
8
+ import { Tool } from '../types/index.js';
9
9
  export declare const semanticSearch: 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;
@@ -1,6 +1,6 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import { detectSensitiveContent } from '../core/safeguard';
3
+ import { detectSensitiveContent } from '../core/safeguard.js';
4
4
  /**
5
5
  * 将 unified diff 补丁应用到原始文本上。
6
6
  * 支持标准 unified diff 格式(@@ -a,b +c,d @@ 开头的 hunk)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code4bug/jarvis-agent",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "基于 React + TypeScript + Ink 构建的命令行智能体交互界面",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",