@cuylabs/agent-core 0.6.0 → 0.7.0
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 +5 -1
- package/dist/{builder-BKkipazh.d.ts → builder-BRvqCcIk.d.ts} +2 -2
- package/dist/{resolver-DOfZ-xuk.d.ts → capability-resolver-CgRGsWVX.d.ts} +1 -1
- package/dist/{chunk-3C4VKG4P.js → chunk-3HNO5SVI.js} +273 -807
- package/dist/chunk-5K7AQVOU.js +619 -0
- package/dist/{chunk-QAQADS4X.js → chunk-BNSHUWCV.js} +1 -0
- package/dist/{chunk-O2ZCFQL6.js → chunk-CDTV2UYU.js} +86 -1
- package/dist/chunk-IEFIQENH.js +73 -0
- package/dist/chunk-N7P4PN3O.js +84 -0
- package/dist/{chunk-QWFMX226.js → chunk-QGOGIP7T.js} +148 -15
- package/dist/chunk-VNQBHPCT.js +398 -0
- package/dist/{chunk-X635CM2F.js → chunk-ZPMACVZK.js} +1 -1
- package/dist/context/index.js +1 -1
- package/dist/host/index.d.ts +45 -0
- package/dist/host/index.js +8 -0
- package/dist/{index-DZQJD_hp.d.ts → index-C33hlD6H.d.ts} +12 -7
- package/dist/{index-ipP3_ztp.d.ts → index-CfBGYrpd.d.ts} +121 -2
- package/dist/index.d.ts +107 -126
- package/dist/index.js +321 -601
- package/dist/inference/index.d.ts +59 -0
- package/dist/inference/index.js +25 -0
- package/dist/middleware/index.d.ts +7 -4
- package/dist/middleware/index.js +5 -3
- package/dist/models/index.d.ts +104 -2
- package/dist/models/index.js +40 -6
- package/dist/prompt/index.d.ts +9 -6
- package/dist/reasoning/index.d.ts +54 -8
- package/dist/reasoning/index.js +2 -3
- package/dist/{registry-CuRWWtcT.d.ts → registry-BDLIHOQB.d.ts} +1 -1
- package/dist/{runner-G1wxEgac.d.ts → runner-DSKaEz3z.d.ts} +35 -8
- package/dist/runtime/index.d.ts +41 -7
- package/dist/runtime/index.js +15 -6
- package/dist/scope/index.d.ts +10 -0
- package/dist/scope/index.js +14 -0
- package/dist/{session-manager-Uawm2Le7.d.ts → session-manager-B_CWGTsl.d.ts} +1 -1
- package/dist/skill/index.d.ts +7 -5
- package/dist/storage/index.d.ts +2 -2
- package/dist/sub-agent/index.d.ts +12 -8
- package/dist/tool/index.d.ts +7 -4
- package/dist/tool/index.js +4 -3
- package/dist/{tool-pFAnJc5Y.d.ts → tool-Db1Ue-1U.d.ts} +1 -1
- package/dist/{tool-DYp6-cC3.d.ts → tool-HUtkiVBx.d.ts} +5 -99
- package/dist/tracking/index.d.ts +3 -1
- package/dist/types-9jGQUjqW.d.ts +29 -0
- package/dist/types-CHiPh8U2.d.ts +100 -0
- package/dist/types-CqDZTh4d.d.ts +335 -0
- package/dist/types-FRpzzg_9.d.ts +355 -0
- package/package.json +19 -8
- package/dist/capabilities/index.d.ts +0 -97
- package/dist/capabilities/index.js +0 -46
- package/dist/chunk-6TDTQJ4P.js +0 -116
- package/dist/chunk-DWYX7ASF.js +0 -26
- package/dist/chunk-FG4MD5MU.js +0 -54
- package/dist/config-D2xeGEHK.d.ts +0 -52
- package/dist/identifiers-BLUxFqV_.d.ts +0 -12
- package/dist/network-D76DS5ot.d.ts +0 -5
- package/dist/types-BWo810L_.d.ts +0 -648
|
@@ -271,4 +271,4 @@ declare class SessionManager {
|
|
|
271
271
|
getStorage(): SessionStorage;
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
export { type BranchEntry as B, type CompactionEntry as C, type EntryBase as E, type FileEntry as F, type MessageEntry as M,
|
|
274
|
+
export { type BranchEntry as B, type CompactionEntry as C, type EntryBase as E, type FileEntry as F, type MessageEntry as M, SessionManager as S, type ConfigChangeEntry as a, type CreateSessionOptions as b, type MetadataEntry as c, STORAGE_VERSION as d, type SerializedMessage as e, type SessionContext as f, type SessionEntry as g, type SessionHeader as h, type SessionInfo as i, type SessionStorage as j };
|
package/dist/skill/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { h as SkillScope, i as SkillSource, a as SkillMetadata, g as SkillResourceType, c as SkillResource, b as SkillContent, d as SkillConfig, S as SkillDiscoveryResult, T as Tool } from '../tool-
|
|
2
|
-
export { R as RemoteSkillEntry, e as RemoteSkillIndex, f as SkillDiscoveryError, j as SkillSourceType } from '../tool-
|
|
3
|
-
import { S as SkillRegistry } from '../registry-
|
|
4
|
-
export { c as createSkillRegistry, e as emptySkillRegistry } from '../registry-
|
|
1
|
+
import { h as SkillScope, i as SkillSource, a as SkillMetadata, g as SkillResourceType, c as SkillResource, b as SkillContent, d as SkillConfig, S as SkillDiscoveryResult, T as Tool } from '../tool-Db1Ue-1U.js';
|
|
2
|
+
export { R as RemoteSkillEntry, e as RemoteSkillIndex, f as SkillDiscoveryError, j as SkillSourceType } from '../tool-Db1Ue-1U.js';
|
|
3
|
+
import { S as SkillRegistry } from '../registry-BDLIHOQB.js';
|
|
4
|
+
export { c as createSkillRegistry, e as emptySkillRegistry } from '../registry-BDLIHOQB.js';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import '../tool-
|
|
6
|
+
import '../tool-HUtkiVBx.js';
|
|
7
|
+
import '../types-CHiPh8U2.js';
|
|
8
|
+
import '../types-9jGQUjqW.js';
|
|
7
9
|
|
|
8
10
|
declare const SKILL_FILENAME = "SKILL.md";
|
|
9
11
|
declare const DEFAULT_SKILL_MAX_SIZE = 102400;
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FileEntry,
|
|
2
|
-
export { B as BranchEntry, C as CompactionEntry,
|
|
1
|
+
import { F as FileEntry, g as SessionEntry, M as MessageEntry, c as MetadataEntry, e as SerializedMessage, i as SessionInfo, j as SessionStorage, h as SessionHeader, S as SessionManager } from '../session-manager-B_CWGTsl.js';
|
|
2
|
+
export { B as BranchEntry, C as CompactionEntry, a as ConfigChangeEntry, b as CreateSessionOptions, E as EntryBase, d as STORAGE_VERSION, f as SessionContext } from '../session-manager-B_CWGTsl.js';
|
|
3
3
|
import { M as Message } from '../messages-BYWGn8TY.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
export { c as AgentProfile, D as DEFAULT_MAX_CONCURRENT, d as DEFAULT_MAX_SPAWN_DEPTH, e as DEFAULT_SESSION_TITLE_PREFIX, S as SubAgentCompletedResult,
|
|
1
|
+
export { c as AgentProfile, D as DEFAULT_MAX_CONCURRENT, d as DEFAULT_MAX_SPAWN_DEPTH, e as DEFAULT_SESSION_TITLE_PREFIX, S as SubAgentCompletedResult, g as SubAgentHandle, h as SubAgentStatus, i as SubAgentToolConfig, j as SubAgentTracker, k as SubAgentUsage, m as createSubAgentTools } from '../index-C33hlD6H.js';
|
|
2
2
|
import 'ai';
|
|
3
3
|
import '../types-CQaXbRsS.js';
|
|
4
|
-
import '../tool-
|
|
4
|
+
import '../tool-Db1Ue-1U.js';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import '../tool-
|
|
7
|
-
import '../
|
|
6
|
+
import '../tool-HUtkiVBx.js';
|
|
7
|
+
import '../types-CHiPh8U2.js';
|
|
8
|
+
import '../types-9jGQUjqW.js';
|
|
9
|
+
import '../runner-DSKaEz3z.js';
|
|
10
|
+
import '@ai-sdk/provider-utils';
|
|
8
11
|
import '../messages-BYWGn8TY.js';
|
|
9
|
-
import '../session-manager-
|
|
12
|
+
import '../session-manager-B_CWGTsl.js';
|
|
10
13
|
import '../types-VQgymC1N.js';
|
|
11
14
|
import '../tracker-DClqYqTj.js';
|
|
12
|
-
import '../builder-
|
|
13
|
-
import '../registry-
|
|
14
|
-
import '../types-
|
|
15
|
+
import '../builder-BRvqCcIk.js';
|
|
16
|
+
import '../registry-BDLIHOQB.js';
|
|
17
|
+
import '../types-FRpzzg_9.js';
|
|
18
|
+
import '../types-CqDZTh4d.js';
|
package/dist/tool/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { T as Tool } from '../tool-
|
|
2
|
-
export { C as CompatibleSchema, I as InferSchemaOutput, k as defineTool } from '../tool-
|
|
3
|
-
import { a as ToolReplayPolicy, F as FileOperationMeta, N as NormalizedToolReplayPolicy, d as
|
|
4
|
-
import {
|
|
1
|
+
import { T as Tool } from '../tool-Db1Ue-1U.js';
|
|
2
|
+
export { C as CompatibleSchema, I as InferSchemaOutput, k as defineTool } from '../tool-Db1Ue-1U.js';
|
|
3
|
+
import { a as ToolReplayPolicy, F as FileOperationMeta, N as NormalizedToolReplayPolicy, d as TurnTrackerContext } from '../tool-HUtkiVBx.js';
|
|
4
|
+
import { T as ToolHost } from '../types-CHiPh8U2.js';
|
|
5
|
+
import { M as MiddlewareRunner } from '../runner-DSKaEz3z.js';
|
|
5
6
|
import 'zod';
|
|
7
|
+
import '../types-9jGQUjqW.js';
|
|
6
8
|
import 'ai';
|
|
9
|
+
import '@ai-sdk/provider-utils';
|
|
7
10
|
import '../messages-BYWGn8TY.js';
|
|
8
11
|
import '../types-CQaXbRsS.js';
|
|
9
12
|
|
package/dist/tool/index.js
CHANGED
|
@@ -2,9 +2,6 @@ import {
|
|
|
2
2
|
ToolRegistry,
|
|
3
3
|
defaultRegistry
|
|
4
4
|
} from "../chunk-SDSBEQXG.js";
|
|
5
|
-
import {
|
|
6
|
-
executeAgentToolCall
|
|
7
|
-
} from "../chunk-FG4MD5MU.js";
|
|
8
5
|
import {
|
|
9
6
|
MAX_BYTES,
|
|
10
7
|
MAX_LINES,
|
|
@@ -16,6 +13,10 @@ import {
|
|
|
16
13
|
normalizeToolReplayPolicy,
|
|
17
14
|
truncateOutput
|
|
18
15
|
} from "../chunk-P6YF7USR.js";
|
|
16
|
+
import {
|
|
17
|
+
executeAgentToolCall
|
|
18
|
+
} from "../chunk-IEFIQENH.js";
|
|
19
|
+
import "../chunk-N7P4PN3O.js";
|
|
19
20
|
import "../chunk-VEKUXUVF.js";
|
|
20
21
|
export {
|
|
21
22
|
MAX_BYTES,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { T as ToolMetadata, a as ToolReplayPolicy, b as ToolContext, F as FileOperationMeta, c as ToolResult } from './tool-
|
|
2
|
+
import { T as ToolMetadata, a as ToolReplayPolicy, b as ToolContext, F as FileOperationMeta, c as ToolResult } from './tool-HUtkiVBx.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Skill System Types
|
|
@@ -1,101 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* A ToolHost defines *where* tools execute: local machine, Docker container,
|
|
5
|
-
* SSH remote, etc. Every host provides two surfaces:
|
|
6
|
-
*
|
|
7
|
-
* 1. **File system** — read, write, stat, list, check existence
|
|
8
|
-
* 2. **Process execution** — spawn commands, kill processes
|
|
9
|
-
*
|
|
10
|
-
* Tools call `ctx.host.readFile()` / `ctx.host.exec()` instead of importing
|
|
11
|
-
* `fs` and `child_process` directly. The host implementation handles the rest.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* // Default: runs everything locally
|
|
16
|
-
* const agent = createAgent({ host: localHost() });
|
|
17
|
-
*
|
|
18
|
-
* // Future: run tools inside a Docker container
|
|
19
|
-
* const agent = createAgent({ host: dockerHost("my-container") });
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
/** Options for spawning a process. */
|
|
23
|
-
interface ExecOptions {
|
|
24
|
-
/** Working directory for the command. */
|
|
25
|
-
cwd?: string;
|
|
26
|
-
/** Environment variables (merged with host defaults). */
|
|
27
|
-
env?: Record<string, string | undefined>;
|
|
28
|
-
/** Abort signal for cancellation. */
|
|
29
|
-
signal?: AbortSignal;
|
|
30
|
-
/** Timeout in milliseconds. 0 = no timeout. */
|
|
31
|
-
timeout?: number;
|
|
32
|
-
/** Callback for stdout data as it arrives. */
|
|
33
|
-
onStdout?: (data: Buffer) => void;
|
|
34
|
-
/** Callback for stderr data as it arrives. */
|
|
35
|
-
onStderr?: (data: Buffer) => void;
|
|
36
|
-
}
|
|
37
|
-
/** Result of a process execution. */
|
|
38
|
-
interface ExecResult {
|
|
39
|
-
/** Combined stdout output. */
|
|
40
|
-
stdout: string;
|
|
41
|
-
/** Combined stderr output. */
|
|
42
|
-
stderr: string;
|
|
43
|
-
/** Exit code (null if killed by signal). */
|
|
44
|
-
exitCode: number | null;
|
|
45
|
-
/** Whether the process was killed due to timeout. */
|
|
46
|
-
timedOut: boolean;
|
|
47
|
-
}
|
|
48
|
-
/** Minimal stat result — only the fields tools actually need. */
|
|
49
|
-
interface FileStat {
|
|
50
|
-
/** File size in bytes. */
|
|
51
|
-
size: number;
|
|
52
|
-
/** Last modification time. */
|
|
53
|
-
mtime: Date;
|
|
54
|
-
/** Whether this entry is a directory. */
|
|
55
|
-
isDirectory: boolean;
|
|
56
|
-
/** Whether this entry is a regular file. */
|
|
57
|
-
isFile: boolean;
|
|
58
|
-
}
|
|
59
|
-
/** A directory entry returned by `readdir`. */
|
|
60
|
-
interface DirEntry {
|
|
61
|
-
/** Entry name (not full path). */
|
|
62
|
-
name: string;
|
|
63
|
-
/** Whether this entry is a directory. */
|
|
64
|
-
isDirectory: boolean;
|
|
65
|
-
/** Whether this entry is a regular file. */
|
|
66
|
-
isFile: boolean;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* The execution environment for agent tools.
|
|
70
|
-
*
|
|
71
|
-
* Abstracts filesystem and process operations so tools work identically
|
|
72
|
-
* whether running locally, in Docker, over SSH, or in any other environment.
|
|
73
|
-
*/
|
|
74
|
-
interface ToolHost {
|
|
75
|
-
/** Human-readable host identifier (e.g. "local", "docker:my-container"). */
|
|
76
|
-
readonly name: string;
|
|
77
|
-
/** Read a file as a UTF-8 string. Throws if the file doesn't exist. */
|
|
78
|
-
readFile(path: string): Promise<string>;
|
|
79
|
-
/** Read raw bytes from a file. Throws if the file doesn't exist. */
|
|
80
|
-
readBytes(path: string, offset: number, length: number): Promise<Buffer>;
|
|
81
|
-
/** Write a UTF-8 string to a file. Creates parent directories as needed. */
|
|
82
|
-
writeFile(path: string, content: string): Promise<void>;
|
|
83
|
-
/** Check if a path exists. Never throws. */
|
|
84
|
-
exists(path: string): Promise<boolean>;
|
|
85
|
-
/** Get file metadata. Throws if the path doesn't exist. */
|
|
86
|
-
stat(path: string): Promise<FileStat>;
|
|
87
|
-
/** List directory entries. Throws if the path is not a directory. */
|
|
88
|
-
readdir(path: string): Promise<DirEntry[]>;
|
|
89
|
-
/** Create directories recursively. No-op if they already exist. */
|
|
90
|
-
mkdir(path: string): Promise<void>;
|
|
91
|
-
/**
|
|
92
|
-
* Execute a shell command.
|
|
93
|
-
*
|
|
94
|
-
* The host decides which shell to use (e.g. local host uses the user's
|
|
95
|
-
* `$SHELL`, Docker host uses `docker exec`, SSH host uses remote shell).
|
|
96
|
-
*/
|
|
97
|
-
exec(command: string, options?: ExecOptions): Promise<ExecResult>;
|
|
98
|
-
}
|
|
1
|
+
import { T as ToolHost } from './types-CHiPh8U2.js';
|
|
2
|
+
import { b as ScopeSnapshot } from './types-9jGQUjqW.js';
|
|
99
3
|
|
|
100
4
|
/**
|
|
101
5
|
* Tool-related types for @cuylabs/agent-core
|
|
@@ -128,6 +32,8 @@ interface ToolContext {
|
|
|
128
32
|
messageID: string;
|
|
129
33
|
/** Agent name */
|
|
130
34
|
agent: string;
|
|
35
|
+
/** Active execution scope snapshot for this tool call. */
|
|
36
|
+
scope?: ScopeSnapshot;
|
|
131
37
|
/**
|
|
132
38
|
* Execution environment for file and process operations.
|
|
133
39
|
*
|
|
@@ -236,4 +142,4 @@ interface ToolMetadata {
|
|
|
236
142
|
[key: string]: unknown;
|
|
237
143
|
}
|
|
238
144
|
|
|
239
|
-
export type {
|
|
145
|
+
export type { FileOperationMeta as F, NormalizedToolReplayPolicy as N, ToolMetadata as T, ToolReplayPolicy as a, ToolContext as b, ToolResult as c, TurnTrackerContext as d, ToolReplayMode as e, ToolSideEffectLevel as f };
|
package/dist/tracking/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { T as TurnChangeTracker } from '../tracker-DClqYqTj.js';
|
|
2
2
|
export { F as FileBaseline, a as TurnFileChange, b as TurnSummary, c as TurnTrackerConfig, U as UndoResult, d as createTurnTracker } from '../tracker-DClqYqTj.js';
|
|
3
|
-
import { F as FileOperationMeta } from '../tool-
|
|
3
|
+
import { F as FileOperationMeta } from '../tool-HUtkiVBx.js';
|
|
4
|
+
import '../types-CHiPh8U2.js';
|
|
5
|
+
import '../types-9jGQUjqW.js';
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Checkpoint system contracts for @cuylabs/agent-core.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type ScopeKind = "task" | "turn" | "model" | "tool" | "commit" | "sub-agent" | "activity";
|
|
2
|
+
type ScopeAttributeValue = string | number | boolean | null;
|
|
3
|
+
type ScopeAttributes = Record<string, ScopeAttributeValue | undefined>;
|
|
4
|
+
interface Scope {
|
|
5
|
+
id: string;
|
|
6
|
+
rootId: string;
|
|
7
|
+
kind: ScopeKind;
|
|
8
|
+
name: string;
|
|
9
|
+
parentId?: string;
|
|
10
|
+
depth: number;
|
|
11
|
+
startedAt: string;
|
|
12
|
+
sessionId?: string;
|
|
13
|
+
taskId?: string;
|
|
14
|
+
step?: number;
|
|
15
|
+
attributes: ScopeAttributes;
|
|
16
|
+
}
|
|
17
|
+
type ScopeSnapshot = Scope;
|
|
18
|
+
interface ScopeOptions {
|
|
19
|
+
id?: string;
|
|
20
|
+
kind: ScopeKind;
|
|
21
|
+
name: string;
|
|
22
|
+
parent?: ScopeSnapshot | null;
|
|
23
|
+
sessionId?: string;
|
|
24
|
+
taskId?: string;
|
|
25
|
+
step?: number;
|
|
26
|
+
attributes?: ScopeAttributes;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type { ScopeOptions as S, Scope as a, ScopeSnapshot as b, ScopeAttributeValue as c, ScopeAttributes as d, ScopeKind as e };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolHost — execution environment abstraction for agent tools.
|
|
3
|
+
*
|
|
4
|
+
* A ToolHost defines *where* tools execute: local machine, Docker container,
|
|
5
|
+
* SSH remote, etc. Every host provides two surfaces:
|
|
6
|
+
*
|
|
7
|
+
* 1. **File system** — read, write, stat, list, check existence
|
|
8
|
+
* 2. **Process execution** — spawn commands, kill processes
|
|
9
|
+
*
|
|
10
|
+
* Tools call `ctx.host.readFile()` / `ctx.host.exec()` instead of importing
|
|
11
|
+
* `fs` and `child_process` directly. The host implementation handles the rest.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Default: runs everything locally
|
|
16
|
+
* const agent = createAgent({ host: localHost() });
|
|
17
|
+
*
|
|
18
|
+
* // Future: run tools inside a Docker container
|
|
19
|
+
* const agent = createAgent({ host: dockerHost("my-container") });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
/** Options for spawning a process. */
|
|
23
|
+
interface ExecOptions {
|
|
24
|
+
/** Working directory for the command. */
|
|
25
|
+
cwd?: string;
|
|
26
|
+
/** Environment variables (merged with host defaults). */
|
|
27
|
+
env?: Record<string, string | undefined>;
|
|
28
|
+
/** Abort signal for cancellation. */
|
|
29
|
+
signal?: AbortSignal;
|
|
30
|
+
/** Timeout in milliseconds. 0 = no timeout. */
|
|
31
|
+
timeout?: number;
|
|
32
|
+
/** Callback for stdout data as it arrives. */
|
|
33
|
+
onStdout?: (data: Buffer) => void;
|
|
34
|
+
/** Callback for stderr data as it arrives. */
|
|
35
|
+
onStderr?: (data: Buffer) => void;
|
|
36
|
+
}
|
|
37
|
+
/** Result of a process execution. */
|
|
38
|
+
interface ExecResult {
|
|
39
|
+
/** Combined stdout output. */
|
|
40
|
+
stdout: string;
|
|
41
|
+
/** Combined stderr output. */
|
|
42
|
+
stderr: string;
|
|
43
|
+
/** Exit code (null if killed by signal). */
|
|
44
|
+
exitCode: number | null;
|
|
45
|
+
/** Whether the process was killed due to timeout. */
|
|
46
|
+
timedOut: boolean;
|
|
47
|
+
}
|
|
48
|
+
/** Minimal stat result — only the fields tools actually need. */
|
|
49
|
+
interface FileStat {
|
|
50
|
+
/** File size in bytes. */
|
|
51
|
+
size: number;
|
|
52
|
+
/** Last modification time. */
|
|
53
|
+
mtime: Date;
|
|
54
|
+
/** Whether this entry is a directory. */
|
|
55
|
+
isDirectory: boolean;
|
|
56
|
+
/** Whether this entry is a regular file. */
|
|
57
|
+
isFile: boolean;
|
|
58
|
+
}
|
|
59
|
+
/** A directory entry returned by `readdir`. */
|
|
60
|
+
interface DirEntry {
|
|
61
|
+
/** Entry name (not full path). */
|
|
62
|
+
name: string;
|
|
63
|
+
/** Whether this entry is a directory. */
|
|
64
|
+
isDirectory: boolean;
|
|
65
|
+
/** Whether this entry is a regular file. */
|
|
66
|
+
isFile: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The execution environment for agent tools.
|
|
70
|
+
*
|
|
71
|
+
* Abstracts filesystem and process operations so tools work identically
|
|
72
|
+
* whether running locally, in Docker, over SSH, or in any other environment.
|
|
73
|
+
*/
|
|
74
|
+
interface ToolHost {
|
|
75
|
+
/** Human-readable host identifier (e.g. "local", "docker:my-container"). */
|
|
76
|
+
readonly name: string;
|
|
77
|
+
/** Read a file as a UTF-8 string. Throws if the file doesn't exist. */
|
|
78
|
+
readFile(path: string): Promise<string>;
|
|
79
|
+
/** Read raw bytes from a file. Throws if the file doesn't exist. */
|
|
80
|
+
readBytes(path: string, offset: number, length: number): Promise<Buffer>;
|
|
81
|
+
/** Write a UTF-8 string to a file. Creates parent directories as needed. */
|
|
82
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
83
|
+
/** Check if a path exists. Never throws. */
|
|
84
|
+
exists(path: string): Promise<boolean>;
|
|
85
|
+
/** Get file metadata. Throws if the path doesn't exist. */
|
|
86
|
+
stat(path: string): Promise<FileStat>;
|
|
87
|
+
/** List directory entries. Throws if the path is not a directory. */
|
|
88
|
+
readdir(path: string): Promise<DirEntry[]>;
|
|
89
|
+
/** Create directories recursively. No-op if they already exist. */
|
|
90
|
+
mkdir(path: string): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Execute a shell command.
|
|
93
|
+
*
|
|
94
|
+
* The host decides which shell to use (e.g. local host uses the user's
|
|
95
|
+
* `$SHELL`, Docker host uses `docker exec`, SSH host uses remote shell).
|
|
96
|
+
*/
|
|
97
|
+
exec(command: string, options?: ExecOptions): Promise<ExecResult>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type { DirEntry as D, ExecOptions as E, FileStat as F, ToolHost as T, ExecResult as a };
|