@cuylabs/agent-core 0.8.0 → 0.10.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.
Files changed (127) hide show
  1. package/README.md +33 -17
  2. package/dist/chunk-2O4MCSQS.js +780 -0
  3. package/dist/chunk-2TTOLHBT.js +198 -0
  4. package/dist/chunk-5FMSGQVX.js +281 -0
  5. package/dist/chunk-5NVVNXPQ.js +288 -0
  6. package/dist/{chunk-CAA7FHIH.js → chunk-6HZBHFOL.js} +3 -103
  7. package/dist/chunk-CJI7PVS2.js +58 -0
  8. package/dist/{chunk-N6HWIEEA.js → chunk-CMYN2RCB.js} +278 -61
  9. package/dist/chunk-FII65CN7.js +117 -0
  10. package/dist/{chunk-IVUJDISU.js → chunk-GFTW23FV.js} +5 -14
  11. package/dist/chunk-I6PKJ7XQ.js +292 -0
  12. package/dist/{chunk-BDBZ3SLK.js → chunk-ICZ66572.js} +48 -4
  13. package/dist/chunk-KYLPMBHD.js +316 -0
  14. package/dist/chunk-MXAP4UG6.js +2956 -0
  15. package/dist/{chunk-RZITT45F.js → chunk-N3VX7FEE.js} +39 -6
  16. package/dist/{chunk-YSLSEQ6B.js → chunk-NDZWXCBZ.js} +218 -95
  17. package/dist/{chunk-P6YF7USR.js → chunk-Q742PSH3.js} +23 -38
  18. package/dist/chunk-QAL3OMI3.js +943 -0
  19. package/dist/{chunk-RFEKJKTO.js → chunk-RN6WZEUF.js} +330 -280
  20. package/dist/{chunk-ZXAKHMWH.js → chunk-ROTGCYDW.js} +22 -84
  21. package/dist/chunk-SPBFQXOT.js +0 -0
  22. package/dist/{chunk-LRHOS4ZN.js → chunk-SPILYYDF.js} +3 -2
  23. package/dist/chunk-SSFBF3US.js +602 -0
  24. package/dist/chunk-SZ2XBPTW.js +8 -0
  25. package/dist/chunk-T4UIX5D7.js +115 -0
  26. package/dist/chunk-TIHPYVAJ.js +102 -0
  27. package/dist/{chunk-YUUJK53A.js → chunk-TOTDGK3P.js} +1 -1
  28. package/dist/chunk-V4RFNEET.js +563 -0
  29. package/dist/chunk-VOUEJSW6.js +0 -0
  30. package/dist/{chunk-4BDA7DQY.js → chunk-WBPOZ7CL.js} +673 -273
  31. package/dist/chunk-X4VN4GIJ.js +185 -0
  32. package/dist/dispatch/index.d.ts +93 -0
  33. package/dist/dispatch/index.js +37 -0
  34. package/dist/events/index.d.ts +93 -0
  35. package/dist/events/index.js +6 -0
  36. package/dist/{runtime → execution}/index.d.ts +120 -34
  37. package/dist/{runtime → execution}/index.js +18 -13
  38. package/dist/index-BCqEGzBj.d.ts +251 -0
  39. package/dist/index.d.ts +490 -122
  40. package/dist/index.js +2104 -615
  41. package/dist/{errors → inference/errors}/index.d.ts +2 -2
  42. package/dist/{errors → inference/errors}/index.js +1 -1
  43. package/dist/inference/index.d.ts +16 -23
  44. package/dist/inference/index.js +45 -16
  45. package/dist/instance-BqV2D5pc.d.ts +5723 -0
  46. package/dist/logger/index.d.ts +50 -0
  47. package/dist/logger/index.js +11 -0
  48. package/dist/mcp/index.d.ts +5 -9
  49. package/dist/mcp/index.js +2 -3
  50. package/dist/middleware/index.d.ts +10 -149
  51. package/dist/middleware/index.js +11 -3
  52. package/dist/model-messages-B4nK9D1-.d.ts +13 -0
  53. package/dist/models/index.d.ts +23 -18
  54. package/dist/models/index.js +48 -11
  55. package/dist/models/reasoning/index.d.ts +4 -0
  56. package/dist/{reasoning → models/reasoning}/index.js +3 -3
  57. package/dist/plugin/index.d.ts +458 -0
  58. package/dist/plugin/index.js +32 -0
  59. package/dist/profiles/index.d.ts +55 -0
  60. package/dist/profiles/index.js +30 -0
  61. package/dist/prompt/index.d.ts +8 -12
  62. package/dist/prompt/index.js +3 -2
  63. package/dist/safety/index.d.ts +109 -14
  64. package/dist/safety/index.js +59 -3
  65. package/dist/sandbox/index.d.ts +81 -0
  66. package/dist/sandbox/index.js +1 -0
  67. package/dist/skill/index.d.ts +10 -8
  68. package/dist/skill/index.js +3 -3
  69. package/dist/storage/index.d.ts +12 -4
  70. package/dist/storage/index.js +1 -1
  71. package/dist/subagents/index.d.ts +177 -0
  72. package/dist/subagents/index.js +78 -0
  73. package/dist/team/index.d.ts +544 -0
  74. package/dist/team/index.js +41 -0
  75. package/dist/tool/host/index.d.ts +41 -0
  76. package/dist/tool/host/index.js +10 -0
  77. package/dist/tool/index.d.ts +125 -21
  78. package/dist/tool/index.js +20 -13
  79. package/dist/{types-VQgymC1N.d.ts → types-Bj_J8u_W.d.ts} +44 -64
  80. package/dist/{types-CHiPh8U2.d.ts → types-C_LCeYNg.d.ts} +7 -7
  81. package/dist/types-RSCv7nQ4.d.ts +59 -0
  82. package/package.json +58 -53
  83. package/dist/builder-UpOWQMW3.d.ts +0 -34
  84. package/dist/chunk-7MUFEN4K.js +0 -559
  85. package/dist/chunk-7VKQ4WPB.js +0 -73
  86. package/dist/chunk-BFM2YHNM.js +0 -222
  87. package/dist/chunk-DWYX7ASF.js +0 -26
  88. package/dist/chunk-KUVSERLJ.js +0 -50
  89. package/dist/chunk-N7P4PN3O.js +0 -84
  90. package/dist/chunk-SDSBEQXG.js +0 -157
  91. package/dist/chunk-SQU2AJHO.js +0 -305
  92. package/dist/chunk-VBWWUHWI.js +0 -724
  93. package/dist/chunk-VEKUXUVF.js +0 -41
  94. package/dist/chunk-VNQBHPCT.js +0 -398
  95. package/dist/chunk-WWYYNWEW.js +0 -259
  96. package/dist/context/index.d.ts +0 -259
  97. package/dist/context/index.js +0 -26
  98. package/dist/events-CE72w8W4.d.ts +0 -149
  99. package/dist/host/index.d.ts +0 -45
  100. package/dist/host/index.js +0 -8
  101. package/dist/index-CWSchSql.d.ts +0 -1058
  102. package/dist/messages-BYWGn8TY.d.ts +0 -110
  103. package/dist/presets/index.d.ts +0 -53
  104. package/dist/presets/index.js +0 -28
  105. package/dist/reasoning/index.d.ts +0 -116
  106. package/dist/registry-DwYqsQkX.d.ts +0 -164
  107. package/dist/runner-e2YRcUoX.d.ts +0 -786
  108. package/dist/scope/index.d.ts +0 -10
  109. package/dist/scope/index.js +0 -14
  110. package/dist/session-manager-B_CWGTsl.d.ts +0 -274
  111. package/dist/signal/index.d.ts +0 -28
  112. package/dist/signal/index.js +0 -6
  113. package/dist/sub-agent/index.d.ts +0 -23
  114. package/dist/sub-agent/index.js +0 -15
  115. package/dist/tool-BHbyUAy3.d.ts +0 -150
  116. package/dist/tool-DLXAR9Ce.d.ts +0 -145
  117. package/dist/tracker-DClqYqTj.d.ts +0 -96
  118. package/dist/tracking/index.d.ts +0 -111
  119. package/dist/tracking/index.js +0 -20
  120. package/dist/types-BfNpU8NS.d.ts +0 -270
  121. package/dist/types-BnpEOYV-.d.ts +0 -50
  122. package/dist/types-CQL-SvTn.d.ts +0 -29
  123. package/dist/types-CWm-7rvB.d.ts +0 -55
  124. package/dist/types-KKDrdU9Y.d.ts +0 -325
  125. package/dist/types-QA4WhEfz.d.ts +0 -138
  126. package/dist/types-QKHHQLLq.d.ts +0 -336
  127. package/dist/types-YuWV4ag7.d.ts +0 -72
@@ -1,16 +1,16 @@
1
- import { T as Tool } from '../tool-BHbyUAy3.js';
2
- export { C as CompatibleSchema, I as InferSchemaOutput, d as defineTool } from '../tool-BHbyUAy3.js';
3
- import { a as ToolReplayPolicy, F as FileOperationMeta, N as NormalizedToolReplayPolicy, d as TurnTrackerContext } from '../tool-DLXAR9Ce.js';
4
- import { T as ToolHost } from '../types-CHiPh8U2.js';
5
- import { M as MiddlewareRunner } from '../runner-e2YRcUoX.js';
6
- import 'zod';
7
- import '../types-CQL-SvTn.js';
1
+ import { dq as ToolReplayPolicy, F as FileOperationMeta, bN as NormalizedToolReplayPolicy, T as Tool, H as HumanInputController, a as TurnTrackerContext, b as MiddlewareRunner, A as AgentEvent, dn as ToolMetadata, dj as ToolCapabilities } from '../instance-BqV2D5pc.js';
2
+ export { az as CompatibleSchema, bo as InferSchemaOutput, bp as InputCheckResult, dL as getRequiredToolHost, dR as resolveCapability } from '../instance-BqV2D5pc.js';
3
+ import { T as ToolHost } from '../types-C_LCeYNg.js';
4
+ export { D as DirEntry, E as ExecOptions, a as ExecResult, F as FileStat } from '../types-C_LCeYNg.js';
5
+ export { ToolHostProvider, ToolHostProviderSummary, ToolHostRegistry, defaultToolHostRegistry, localHost } from './host/index.js';
8
6
  import 'ai';
9
- import '@ai-sdk/provider-utils';
10
- import '../events-CE72w8W4.js';
11
- import '../messages-BYWGn8TY.js';
12
- import '../types-BfNpU8NS.js';
7
+ import '../types-RSCv7nQ4.js';
8
+ import 'zod';
13
9
  import '../types-CQaXbRsS.js';
10
+ import '../types-Bj_J8u_W.js';
11
+ import '@ai-sdk/provider-utils';
12
+ import '../sandbox/index.js';
13
+ import '../llm-error-D93FNNLY.js';
14
14
 
15
15
  /**
16
16
  * Normalize a tool replay policy into explicit, infrastructure-agnostic
@@ -97,6 +97,33 @@ declare class ToolRegistry {
97
97
  hasGroup(name: string): boolean;
98
98
  /** List all group names. */
99
99
  listGroups(): string[];
100
+ /**
101
+ * Partition registered tools into eager and deferred sets.
102
+ *
103
+ * Eager tools have their full schemas sent to the LLM on turn 1.
104
+ * Deferred tools are held back — the model discovers them via a
105
+ * search mechanism when needed, saving context window space.
106
+ *
107
+ * @returns `{ eager, deferred }` arrays of tool infos.
108
+ */
109
+ partition(): {
110
+ eager: Tool.AnyInfo[];
111
+ deferred: Tool.AnyInfo[];
112
+ };
113
+ /**
114
+ * Search deferred tools by keyword with multi-signal weighted scoring.
115
+ *
116
+ * Scoring per term:
117
+ * - Exact tool ID match: +10
118
+ * - Partial tool ID match (substring): +5
119
+ * - Keyword word-boundary match: +4
120
+ * - Keyword substring match: +2
121
+ *
122
+ * @param query - Space-separated search terms
123
+ * @param maxResults - Maximum results to return (default: 5)
124
+ * @returns Matching deferred tools sorted by relevance (highest score first)
125
+ */
126
+ searchDeferred(query: string, maxResults?: number): Tool.AnyInfo[];
100
127
  /**
101
128
  * Resolve a `ToolSpec` to an array of tools.
102
129
  *
@@ -118,9 +145,62 @@ declare class ToolRegistry {
118
145
  /**
119
146
  * Default tool registry instance.
120
147
  * Shared across the application — register tools here for global access.
148
+ *
149
+ * **Single-process only.** In multi-agent or multi-tenant setups where
150
+ * agents share a process, create a dedicated `new ToolRegistry()` per
151
+ * agent to avoid cross-contamination of tool registrations.
121
152
  */
122
153
  declare const defaultRegistry: ToolRegistry;
123
154
 
155
+ /**
156
+ * Tool Search — lets the model discover deferred tools at runtime.
157
+ *
158
+ * When an agent has many tools, sending all schemas on turn 1 wastes
159
+ * context window. Tools marked `deferred: true` are held back. The
160
+ * model calls `tool_search` to find them by keyword, and the matching
161
+ * schemas are added to subsequent turns.
162
+ *
163
+ * The search tool itself is always eager (never deferred).
164
+ */
165
+
166
+ /**
167
+ * Options for creating a tool_search tool.
168
+ */
169
+ interface ToolSearchOptions {
170
+ /** Registry to search. Falls back to the default registry if not provided. */
171
+ registry: ToolRegistry;
172
+ /** Maximum results per search (default: 5). */
173
+ maxResults?: number;
174
+ /**
175
+ * Callback invoked with the matched tools after each search.
176
+ *
177
+ * The agent setup should use this to add the discovered tools
178
+ * to the active tool set for subsequent model calls.
179
+ */
180
+ onMatch: (tools: Tool.AnyInfo[]) => void;
181
+ }
182
+ /**
183
+ * Create a `tool_search` tool that the model can call to discover
184
+ * deferred tools by keyword.
185
+ *
186
+ * @example
187
+ * ```typescript
188
+ * import { createToolSearchTool, ToolRegistry } from "@cuylabs/agent-core";
189
+ *
190
+ * const registry = new ToolRegistry();
191
+ * // ... register tools including deferred ones ...
192
+ *
193
+ * const activeTools = new Map<string, Tool.AnyInfo>();
194
+ * const search = createToolSearchTool({
195
+ * registry,
196
+ * onMatch: (tools) => {
197
+ * for (const t of tools) activeTools.set(t.id, t);
198
+ * },
199
+ * });
200
+ * ```
201
+ */
202
+ declare function createToolSearchTool(options: ToolSearchOptions): Tool.Info;
203
+
124
204
  /**
125
205
  * Output truncation utilities for @cuylabs/agent-core
126
206
  */
@@ -128,10 +208,6 @@ declare const defaultRegistry: ToolRegistry;
128
208
  declare const MAX_LINES = 2000;
129
209
  /** Maximum bytes before truncation */
130
210
  declare const MAX_BYTES = 100000;
131
- /** Directory for storing truncated outputs */
132
- declare const TRUNCATE_DIR: string;
133
- /** Glob pattern for truncation directory */
134
- declare const TRUNCATE_GLOB: string;
135
211
  interface TruncateResult {
136
212
  /** The (possibly truncated) content */
137
213
  content: string;
@@ -141,40 +217,68 @@ interface TruncateResult {
141
217
  outputPath?: string;
142
218
  }
143
219
  /**
144
- * Truncate output if it exceeds limits
220
+ * Truncate output if it exceeds limits.
221
+ *
222
+ * When truncation occurs the full output is written to a temp file
223
+ * **synchronously** so the path is valid immediately.
145
224
  */
146
225
  declare function truncateOutput(output: string, options?: {
147
226
  maxLines?: number;
148
227
  maxBytes?: number;
149
228
  }): TruncateResult;
150
- /**
151
- * Format file size for display
152
- */
153
- declare function formatSize(bytes: number): string;
154
229
 
155
230
  interface ExecuteAgentToolCallOptions {
156
231
  toolName: string;
157
232
  tool: Tool.Info;
233
+ toolCallId?: string;
158
234
  params: unknown;
159
235
  cwd: string;
160
236
  abort: AbortSignal;
161
237
  sessionID: string;
238
+ turnID?: string;
162
239
  messageID: string;
163
240
  agent?: string;
164
241
  host?: ToolHost;
242
+ humanInputController?: HumanInputController;
165
243
  turnTracker?: TurnTrackerContext;
166
244
  middleware?: MiddlewareRunner;
245
+ onEvent?: (event: AgentEvent) => void | Promise<void>;
246
+ /**
247
+ * Pre-initialized tool result. When provided the executor skips
248
+ * `tool.init()` and uses this directly, avoiding double-init when
249
+ * the caller (e.g. `buildToolSet`) has already initialized the tool.
250
+ */
251
+ initialized?: Awaited<ReturnType<Tool.Info["init"]>>;
167
252
  }
168
253
  interface ExecuteAgentToolCallResult {
169
254
  output: string;
255
+ /** Short title for display (populated when middleware preserves it). */
256
+ title?: string;
257
+ /** Tool metadata (populated when middleware preserves it). */
258
+ metadata?: ToolMetadata;
259
+ /**
260
+ * Capabilities declared by the tool after initialization.
261
+ * Exposed so callers (e.g. tool-batch dispatch) can use them
262
+ * for parallelism and approval decisions without re-initializing.
263
+ */
264
+ capabilities?: ToolCapabilities;
170
265
  }
171
266
  /**
172
267
  * Execute one initialized framework tool with the same semantics used by the
173
268
  * standard AI SDK path.
174
269
  *
270
+ * Execution pipeline (in order):
271
+ * 1. Init — resolve tool description, schema, capabilities
272
+ * 2. Schema validation — parse params against Zod schema (handled by Tool.define wrapper)
273
+ * 3. Input validation — tool-specific `validate()` check (fail-fast, no side effects)
274
+ * 4. Middleware pre-hook — `beforeToolCall` (approval, gating, arg rewriting)
275
+ * 5. Baseline capture — turn tracker snapshots files before writes
276
+ * 6. Execute — run the tool (with potentially rewritten args from step 4)
277
+ * 7. Middleware post-hook — `afterToolCall` (transform output, add supplements)
278
+ *
175
279
  * This keeps middleware, baseline capture, and output normalization in one
176
280
  * place so resumable runtimes do not need a second tool execution stack.
177
281
  */
178
282
  declare function executeAgentToolCall(options: ExecuteAgentToolCallOptions): Promise<ExecuteAgentToolCallResult>;
179
283
 
180
- export { type ExecuteAgentToolCallOptions, type ExecuteAgentToolCallResult, MAX_BYTES, MAX_LINES, TRUNCATE_DIR, TRUNCATE_GLOB, Tool, ToolRegistry, type ToolSpec, type TruncateResult, defaultRegistry, executeAgentToolCall, formatSize, normalizeToolReplayPolicy, truncateOutput };
284
+ export { type ExecuteAgentToolCallOptions, type ExecuteAgentToolCallResult, MAX_BYTES, MAX_LINES, Tool, ToolCapabilities, ToolHost, ToolRegistry, type ToolSearchOptions, type ToolSpec, type TruncateResult, createToolSearchTool, defaultRegistry, executeAgentToolCall, normalizeToolReplayPolicy, truncateOutput };
@@ -1,34 +1,41 @@
1
1
  import {
2
2
  ToolRegistry,
3
+ createToolSearchTool,
3
4
  defaultRegistry
4
- } from "../chunk-SDSBEQXG.js";
5
+ } from "../chunk-KYLPMBHD.js";
6
+ import {
7
+ ToolHostRegistry,
8
+ defaultToolHostRegistry,
9
+ localHost
10
+ } from "../chunk-X4VN4GIJ.js";
5
11
  import {
6
12
  MAX_BYTES,
7
13
  MAX_LINES,
8
- TRUNCATE_DIR,
9
- TRUNCATE_GLOB,
10
14
  Tool,
11
- defineTool,
12
- formatSize,
13
15
  normalizeToolReplayPolicy,
14
16
  truncateOutput
15
- } from "../chunk-P6YF7USR.js";
17
+ } from "../chunk-Q742PSH3.js";
16
18
  import {
17
19
  executeAgentToolCall
18
- } from "../chunk-7VKQ4WPB.js";
19
- import "../chunk-VEKUXUVF.js";
20
- import "../chunk-N7P4PN3O.js";
20
+ } from "../chunk-5NVVNXPQ.js";
21
+ import "../chunk-V4RFNEET.js";
22
+ import {
23
+ getRequiredToolHost,
24
+ resolveCapability
25
+ } from "../chunk-FII65CN7.js";
21
26
  export {
22
27
  MAX_BYTES,
23
28
  MAX_LINES,
24
- TRUNCATE_DIR,
25
- TRUNCATE_GLOB,
26
29
  Tool,
30
+ ToolHostRegistry,
27
31
  ToolRegistry,
32
+ createToolSearchTool,
28
33
  defaultRegistry,
29
- defineTool,
34
+ defaultToolHostRegistry,
30
35
  executeAgentToolCall,
31
- formatSize,
36
+ getRequiredToolHost,
37
+ localHost,
32
38
  normalizeToolReplayPolicy,
39
+ resolveCapability,
33
40
  truncateOutput
34
41
  };
@@ -21,35 +21,67 @@ interface StdioTransportConfig {
21
21
  cwd?: string;
22
22
  }
23
23
  /**
24
- * HTTP transport configuration for remote MCP servers.
24
+ * HTTP/SSE transport configuration for remote MCP servers.
25
+ *
26
+ * Supports all options from the AI SDK's `MCPTransportConfig` so that
27
+ * agents can leverage OAuth, custom fetch, and redirect control.
25
28
  */
26
- interface HttpTransportConfig {
27
- transport: "http";
29
+ interface RemoteTransportConfig {
30
+ transport: "http" | "sse";
28
31
  /** Server URL */
29
32
  url: string;
30
33
  /** HTTP headers (e.g. Authorization) */
31
34
  headers?: Record<string, string>;
35
+ /**
36
+ * OAuth client provider for authenticated MCP servers.
37
+ * Pass an `OAuthClientProvider` from `@ai-sdk/mcp` when the server
38
+ * requires OAuth authentication.
39
+ */
40
+ authProvider?: any;
41
+ /**
42
+ * How HTTP redirects are handled.
43
+ * - `'follow'` — follow automatically
44
+ * - `'error'` — reject redirects
45
+ * @default 'error'
46
+ */
47
+ redirect?: "follow" | "error";
48
+ /**
49
+ * Custom fetch implementation (useful for runtimes with
50
+ * request-scoped fetch or test doubles).
51
+ */
52
+ fetch?: any;
32
53
  }
33
54
  /**
34
- * SSE transport configuration for remote MCP servers.
55
+ * @deprecated Use `RemoteTransportConfig` with `transport: "http"`.
56
+ */
57
+ type HttpTransportConfig = RemoteTransportConfig & {
58
+ transport: "http";
59
+ };
60
+ /**
61
+ * @deprecated Use `RemoteTransportConfig` with `transport: "sse"`.
35
62
  */
36
- interface SseTransportConfig {
63
+ type SseTransportConfig = RemoteTransportConfig & {
37
64
  transport: "sse";
38
- /** Server URL */
39
- url: string;
40
- /** HTTP headers (e.g. Authorization) */
41
- headers?: Record<string, string>;
42
- }
65
+ };
43
66
  /**
44
67
  * MCP server configuration.
45
68
  */
46
- type MCPServerConfig = (StdioTransportConfig | HttpTransportConfig | SseTransportConfig) & {
69
+ type MCPServerConfig = (StdioTransportConfig | RemoteTransportConfig) & {
47
70
  /** Whether this server is enabled (default: true) */
48
71
  enabled?: boolean;
49
72
  /** Connection timeout in ms (default: 30000) */
50
73
  timeout?: number;
51
74
  /** Human-readable name for the server */
52
75
  name?: string;
76
+ /**
77
+ * Client capabilities to advertise during MCP initialization.
78
+ * Enables features like elicitation when the server supports them.
79
+ */
80
+ capabilities?: Record<string, unknown>;
81
+ /**
82
+ * Callback for uncaught transport errors.
83
+ */
84
+ onUncaughtError?: (error: unknown) => void;
53
85
  };
54
86
  /**
55
87
  * MCP manager configuration - map of server name to config.
@@ -71,29 +103,6 @@ type MCPServerStatus = {
71
103
  } | {
72
104
  status: "disabled";
73
105
  };
74
- /**
75
- * MCP resource descriptor.
76
- */
77
- interface MCPResource {
78
- uri: string;
79
- name: string;
80
- description?: string;
81
- mimeType?: string;
82
- server: string;
83
- }
84
- /**
85
- * MCP prompt descriptor.
86
- */
87
- interface MCPPrompt {
88
- name: string;
89
- description?: string;
90
- arguments?: Array<{
91
- name: string;
92
- description?: string;
93
- required?: boolean;
94
- }>;
95
- server: string;
96
- }
97
106
  /**
98
107
  * MCP manager - handles connections to multiple MCP servers.
99
108
  */
@@ -114,35 +123,6 @@ interface MCPManager {
114
123
  * Get status of all servers.
115
124
  */
116
125
  getAllStatus(): Map<string, MCPServerStatus>;
117
- /**
118
- * List available resources from all connected servers.
119
- */
120
- listResources(): Promise<MCPResource[]>;
121
- /**
122
- * Read a resource by URI.
123
- */
124
- readResource(uri: string): Promise<{
125
- contents: Array<{
126
- uri: string;
127
- text?: string;
128
- blob?: string;
129
- mimeType?: string;
130
- }>;
131
- }>;
132
- /**
133
- * List available prompts from all connected servers.
134
- */
135
- listPrompts(): Promise<MCPPrompt[]>;
136
- /**
137
- * Get a prompt with optional arguments.
138
- */
139
- getPrompt(serverName: string, promptName: string, args?: Record<string, unknown>): Promise<{
140
- description?: string;
141
- messages: Array<{
142
- role: string;
143
- content: unknown;
144
- }>;
145
- }>;
146
126
  /**
147
127
  * Close all connections.
148
128
  */
@@ -153,4 +133,4 @@ interface MCPManager {
153
133
  isConnected(): boolean;
154
134
  }
155
135
 
156
- export type { HttpTransportConfig as H, MCPConfig as M, SseTransportConfig as S, MCPManager as a, MCPPrompt as b, MCPResource as c, MCPServerConfig as d, MCPServerStatus as e, StdioTransportConfig as f };
136
+ export type { HttpTransportConfig as H, MCPConfig as M, RemoteTransportConfig as R, SseTransportConfig as S, MCPManager as a, MCPServerConfig as b, MCPServerStatus as c, StdioTransportConfig as d };
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * ToolHost — execution environment abstraction for agent tools.
3
3
  *
4
- * A ToolHost defines *where* tools execute: local machine, Docker container,
5
- * SSH remote, etc. Every host provides two surfaces:
4
+ * A ToolHost defines *where* tools execute: local machine, container,
5
+ * remote workspace, etc. Every host provides two surfaces:
6
6
  *
7
7
  * 1. **File system** — read, write, stat, list, check existence
8
8
  * 2. **Process execution** — spawn commands, kill processes
@@ -15,8 +15,8 @@
15
15
  * // Default: runs everything locally
16
16
  * const agent = createAgent({ host: localHost() });
17
17
  *
18
- * // Future: run tools inside a Docker container
19
- * const agent = createAgent({ host: dockerHost("my-container") });
18
+ * // Swap in a custom host package when needed
19
+ * const agent = createAgent({ host: workspaceHost() });
20
20
  * ```
21
21
  */
22
22
  /** Options for spawning a process. */
@@ -69,10 +69,10 @@ interface DirEntry {
69
69
  * The execution environment for agent tools.
70
70
  *
71
71
  * Abstracts filesystem and process operations so tools work identically
72
- * whether running locally, in Docker, over SSH, or in any other environment.
72
+ * whether running locally, in a container, over SSH, or in any other environment.
73
73
  */
74
74
  interface ToolHost {
75
- /** Human-readable host identifier (e.g. "local", "docker:my-container"). */
75
+ /** Human-readable host identifier (e.g. "local", "container:workspace"). */
76
76
  readonly name: string;
77
77
  /** Read a file as a UTF-8 string. Throws if the file doesn't exist. */
78
78
  readFile(path: string): Promise<string>;
@@ -92,7 +92,7 @@ interface ToolHost {
92
92
  * Execute a shell command.
93
93
  *
94
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).
95
+ * `$SHELL`, a container host uses its runtime entrypoint, an SSH host uses a remote shell).
96
96
  */
97
97
  exec(command: string, options?: ExecOptions): Promise<ExecResult>;
98
98
  }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Logger type definitions for @cuylabs/agent-core.
3
+ *
4
+ * The logger is intentionally minimal — four levels, optional structured
5
+ * metadata, and a child-logger factory for namespace scoping.
6
+ *
7
+ * By default agents use a silent (no-op) logger. Consumers opt into
8
+ * output by supplying a concrete logger via `createAgent({ logger })`.
9
+ */
10
+ /** Structured metadata bag attached to log entries. */
11
+ type LogMeta = Record<string, unknown>;
12
+ /** Log severity levels, lowest to highest. */
13
+ type LogLevel = "debug" | "info" | "warn" | "error";
14
+ /**
15
+ * Core logger contract.
16
+ *
17
+ * Every internal module that needs to log accepts a `Logger` instance.
18
+ * The interface is intentionally compatible with `RuntimeLogger` from
19
+ * `@cuylabs/agent-runtime` so the same object can serve both roles.
20
+ */
21
+ interface Logger {
22
+ debug(message: string, meta?: LogMeta): void;
23
+ info(message: string, meta?: LogMeta): void;
24
+ warn(message: string, meta?: LogMeta): void;
25
+ error(message: string, meta?: LogMeta): void;
26
+ /**
27
+ * Create a child logger that prepends a namespace prefix.
28
+ *
29
+ * ```ts
30
+ * const child = logger.child("mcp");
31
+ * child.warn("timeout"); // → "[mcp] timeout"
32
+ * ```
33
+ *
34
+ * Implementations that don't support children can return `this`.
35
+ */
36
+ child(namespace: string): Logger;
37
+ }
38
+ /**
39
+ * Options accepted by the built-in console logger factory.
40
+ */
41
+ interface ConsoleLoggerOptions {
42
+ /** Minimum level to emit. Messages below this are discarded. Default: `"warn"`. */
43
+ level?: LogLevel;
44
+ /** Prefix prepended to every line. Default: `"agent-core"`. */
45
+ prefix?: string;
46
+ }
47
+ /**
48
+ * Options for the file-backed logger factory.
49
+ */
50
+ interface FileLoggerOptions {
51
+ /** Absolute path to the log file. Created (with parents) if it doesn't exist. */
52
+ filePath: string;
53
+ /** Minimum level to emit. Default: `"debug"`. */
54
+ level?: LogLevel;
55
+ /** Prefix prepended to every line. Default: `"agent-core"`. */
56
+ prefix?: string;
57
+ }
58
+
59
+ export type { ConsoleLoggerOptions as C, FileLoggerOptions as F, Logger as L, LogLevel as a, LogMeta as b };