@vietor/agent-core 0.7.0 → 0.7.2

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/README.md CHANGED
@@ -787,6 +787,18 @@ interface ProcessResult {
787
787
  }
788
788
  ```
789
789
 
790
+ ### `findCommands`
791
+
792
+ **`findCommands(commands: string[]): string[]`**
793
+
794
+ Return the subset of commands that exist on the PATH (uses `where` on Windows, `command -v` elsewhere). Useful for picking an available interpreter, e.g. `node` vs `bun`.
795
+
796
+ ```ts
797
+ import { findCommands } from "@vietor/agent-core/util";
798
+
799
+ findCommands(["python", "python3"]); // e.g. ["python"]
800
+ ```
801
+
790
802
  ## File
791
803
 
792
804
  ### `tryReadFileText`
@@ -839,7 +851,7 @@ const data = await res.json();
839
851
 
840
852
  ## Constants
841
853
 
842
- Default values mirrored by `LLMConfig` — exported so host config types can reference the same defaults.
854
+ Default values mirrored by `LLMConfig` — exported so host config types can reference the same defaults. Tool-call timeouts and empty results also share constants here:
843
855
 
844
856
  | Constant | Value | Meaning |
845
857
  |---|---|---|
@@ -847,3 +859,5 @@ Default values mirrored by `LLMConfig` — exported so host config types can ref
847
859
  | `DEFAULT_BACKEND` | `"completions"` | Default `LLMConfig.backend` |
848
860
  | `DEFAULT_MAX_INPUT_TOKENS` | `1_000_000` | Default `LLMConfig.maxInputTokens` |
849
861
  | `DEFAULT_MAX_OUTPUT_TOKENS` | `128_000` | Default `LLMConfig.maxOutputTokens` |
862
+ | `CALL_TIMEOUT_MS` | `300_000` | Default tool-call timeout (Shell, MCP tools) |
863
+ | `NO_OUTPUT` | `"(no output)"` | Content placeholder for empty tool results |
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { INITIAL_RUN_METRICS, type SessionEvent, type TimelineEvent, type RunMet
5
5
  export type { Tool, ToolContext, ToolSchema, Todo, TodoStatus, TextResult } from "./tools/types.js";
6
6
  export { toolError } from "./tools/types.js";
7
7
  export type { BuiltinToolsOptions } from "./tools/registry.js";
8
- export type { Skill } from "./skills/loader.js";
8
+ export type { Skill } from "./skills/types.js";
9
9
  export { tryLoadSkills } from "./skills/loader.js";
10
10
  export type { MCPClientInfo, MCPServerConfig, MCPServerInfo } from "./mcp/types.js";
11
11
  export type { LLMConfig, LLMThinkingEffort, LLMBackend } from "./llm/types.js";
@@ -1,7 +1,7 @@
1
1
  import type { LLMClient } from "../llm/types.js";
2
2
  import { SessionMessages, type SessionMessage } from "./session-messages.js";
3
3
  import type { SessionEvent } from "./events.js";
4
- import type { Skill } from "../skills/loader.js";
4
+ import type { Skill } from "../skills/types.js";
5
5
  import type { ToolRegistry } from "../tools/registry.js";
6
6
  import type { Todo } from "../tools/types.js";
7
7
  export type RunStatus = "ok" | "aborted" | "error" | "stalled" | "maxTurns";
@@ -1,7 +1,7 @@
1
1
  import type { LLMClient, LLMConfig } from "../llm/types.js";
2
2
  import type { MCPServerManager } from "../mcp/manager.js";
3
3
  import type { MCPServerConfig, MCPServerInfo } from "../mcp/types.js";
4
- import type { Skill } from "../skills/loader.js";
4
+ import type { Skill } from "../skills/types.js";
5
5
  import { type BuiltinToolsOptions, type ToolRegistry } from "../tools/registry.js";
6
6
  import type { Todo, Tool } from "../tools/types.js";
7
7
  import { type SessionEvent, type TimelineEvent } from "./events.js";
@@ -1,6 +1,2 @@
1
- export interface Skill {
2
- name: string;
3
- description?: string;
4
- prompt: string;
5
- }
1
+ import { type Skill } from "./types.js";
6
2
  export declare function tryLoadSkills(path: string): Skill[] | undefined;
@@ -1,6 +1,7 @@
1
1
  import { existsSync, readdirSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { tryReadFileText } from "../util/file.js";
4
+ import {} from "./types.js";
4
5
  function parseSkillFile(skillName, skillFile) {
5
6
  const content = tryReadFileText(skillFile);
6
7
  if (!content)
@@ -0,0 +1,5 @@
1
+ export interface Skill {
2
+ name: string;
3
+ description?: string;
4
+ prompt: string;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,6 @@
1
1
  import type { Tool, ToolContext, ToolSchema, Todo } from "./types.js";
2
2
  import { type SubAgentToolDeps } from "./sub-agent.js";
3
- import type { Skill } from "../skills/loader.js";
3
+ import type { Skill } from "../skills/types.js";
4
4
  import type { TextResult } from "./types.js";
5
5
  export declare class ToolRegistry {
6
6
  private tools;
@@ -1,3 +1,3 @@
1
- import type { Skill } from "../skills/loader.js";
1
+ import type { Skill } from "../skills/types.js";
2
2
  import type { Tool } from "./types.js";
3
3
  export declare function createSkillTool(resolve: (name: string) => Skill | undefined): Tool;
@@ -1,7 +1,7 @@
1
1
  export { AbortedError, backoffDelay, isAbortError, mapWithConcurrency, withAbort, withRetry, withTimeout, withTimeoutFn, type RetryOptions } from "./async.js";
2
- export { DEFAULT_BACKEND, DEFAULT_MAX_INPUT_TOKENS, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_THINKING_EFFORT } from "./constants.js";
2
+ export { DEFAULT_BACKEND, DEFAULT_MAX_INPUT_TOKENS, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_THINKING_EFFORT, CALL_TIMEOUT_MS, NO_OUTPUT } from "./constants.js";
3
3
  export { tryReadFileText } from "./file.js";
4
4
  export { htmlToMarkdown } from "./html.js";
5
5
  export { netFetch } from "./net.js";
6
- export { type ProcessResult, runProcess } from "./subprocess.js";
6
+ export { type ProcessResult, runProcess, findCommands } from "./subprocess.js";
7
7
  export { formatCompactNumber, formatDuration, getTextBytes, summarizeText, toErrorMessage } from "./text.js";
@@ -1,7 +1,7 @@
1
1
  export { AbortedError, backoffDelay, isAbortError, mapWithConcurrency, withAbort, withRetry, withTimeout, withTimeoutFn } from "./async.js";
2
- export { DEFAULT_BACKEND, DEFAULT_MAX_INPUT_TOKENS, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_THINKING_EFFORT } from "./constants.js";
2
+ export { DEFAULT_BACKEND, DEFAULT_MAX_INPUT_TOKENS, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_THINKING_EFFORT, CALL_TIMEOUT_MS, NO_OUTPUT } from "./constants.js";
3
3
  export { tryReadFileText } from "./file.js";
4
4
  export { htmlToMarkdown } from "./html.js";
5
5
  export { netFetch } from "./net.js";
6
- export { runProcess } from "./subprocess.js";
6
+ export { runProcess, findCommands } from "./subprocess.js";
7
7
  export { formatCompactNumber, formatDuration, getTextBytes, summarizeText, toErrorMessage } from "./text.js";
@@ -13,3 +13,4 @@ export declare function runProcess(cmd: string, args: string[], opts?: {
13
13
  cwd?: string;
14
14
  timeout?: number;
15
15
  }, signal?: AbortSignal): Promise<ProcessResult>;
16
+ export declare function findCommands(commands: string[]): string[];
@@ -1,4 +1,4 @@
1
- import { spawn, spawnSync } from "node:child_process";
1
+ import { spawn, spawnSync, execSync } from "node:child_process";
2
2
  import { MAX_PROCESS_BUFFER_MB, mbToBytes } from "./constants.js";
3
3
  const KILL_GRACE_MS = 2000;
4
4
  const MAX_PROCESS_BUFFER = mbToBytes(MAX_PROCESS_BUFFER_MB);
@@ -111,3 +111,16 @@ export function runProcess(cmd, args, opts = {}, signal) {
111
111
  });
112
112
  });
113
113
  }
114
+ export function findCommands(commands) {
115
+ const isWindows = process.platform === 'win32';
116
+ return commands.filter((cmd) => {
117
+ try {
118
+ const checkCmd = isWindows ? `where ${cmd}` : `command -v ${cmd}`;
119
+ execSync(checkCmd, { stdio: 'ignore' });
120
+ return true;
121
+ }
122
+ catch {
123
+ return false;
124
+ }
125
+ });
126
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vietor/agent-core",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,10 +24,10 @@
24
24
  "url": "https://github.com/vietor/easy-agent.git"
25
25
  },
26
26
  "dependencies": {
27
- "@anthropic-ai/sdk": "^0.115.0",
27
+ "@anthropic-ai/sdk": "^0.117.1",
28
28
  "@modelcontextprotocol/sdk": "^1.30.0",
29
29
  "@vscode/ripgrep": "^1.18.0",
30
- "openai": "^7.4.0",
30
+ "openai": "^7.5.0",
31
31
  "turndown": "^7.2.4",
32
32
  "undici": "^8.10.0"
33
33
  },