@vinhnt-sdk/core 0.1.1 → 0.1.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.
Files changed (37) hide show
  1. package/README.md +194 -12
  2. package/dist/event-bus/global-bus.d.ts +8 -0
  3. package/dist/event-bus/global-bus.d.ts.map +1 -1
  4. package/dist/event-bus/global-bus.js +48 -0
  5. package/dist/event-bus/global-bus.js.map +1 -1
  6. package/dist/event-bus/in-memory-bus.d.ts +14 -0
  7. package/dist/event-bus/in-memory-bus.d.ts.map +1 -1
  8. package/dist/event-bus/in-memory-bus.js +53 -0
  9. package/dist/event-bus/in-memory-bus.js.map +1 -1
  10. package/dist/event-bus/types.d.ts +17 -0
  11. package/dist/event-bus/types.d.ts.map +1 -1
  12. package/dist/index.d.ts +222 -105
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +180 -63
  15. package/dist/index.js.map +1 -1
  16. package/dist/kernel/circuit-breaker.d.ts +19 -1
  17. package/dist/kernel/circuit-breaker.d.ts.map +1 -1
  18. package/dist/kernel/circuit-breaker.js +50 -9
  19. package/dist/kernel/circuit-breaker.js.map +1 -1
  20. package/dist/kernel/kernel-error.d.ts +4 -2
  21. package/dist/kernel/kernel-error.d.ts.map +1 -1
  22. package/dist/kernel/kernel-error.js +7 -7
  23. package/dist/kernel/kernel-error.js.map +1 -1
  24. package/dist/kernel/kernel-types.d.ts +76 -1
  25. package/dist/kernel/kernel-types.d.ts.map +1 -1
  26. package/dist/kernel/kernel-types.js.map +1 -1
  27. package/dist/kernel/kernel.d.ts +34 -4
  28. package/dist/kernel/kernel.d.ts.map +1 -1
  29. package/dist/kernel/kernel.js +181 -12
  30. package/dist/kernel/kernel.js.map +1 -1
  31. package/dist/kernel/model-caller.d.ts +2 -0
  32. package/dist/kernel/model-caller.d.ts.map +1 -1
  33. package/dist/kernel/model-caller.js +8 -8
  34. package/dist/kernel/model-caller.js.map +1 -1
  35. package/dist/system-context/sources/instructions-source.js +1 -1
  36. package/dist/system-context/sources/instructions-source.js.map +1 -1
  37. package/package.json +8 -61
package/dist/index.d.ts CHANGED
@@ -1,115 +1,232 @@
1
- export type { BrandedId, RunId, SessionId, AgentId, ToolCallId, MessageId, TraceId, RequestId, WorkspaceId, EnvironmentId, FilePatchId, RunEvent, KnownRunEvent, RunStartedData, StepStartedData, TokenStreamedData, ThinkingStartedData, ThinkingContentData, ThinkingCompletedData, ContextCompressedData, TokenCountedData, ToolInvokedData, ToolCompletedData, ToolFailedData, ToolSelfCorrectingData, StepCompletedData, RunCompletedData, PermissionRequestedData, PermissionRepliedData, StepTypeChangedData, RequestContext, RunStatus, Session, Message, MessageTokens, SessionStats, AgentProfile, AgentCapabilities, AgentConfig, AgentPermissions, AgentMode, AgentBehaviourMode, AgentRule, AgentRuleset, PromptTier, PromptAssembly, CompressionSummary, MemoryEntry, SessionNode, SessionTreeSnapshot, TreeCursor, SessionTreeEvent, SessionTreeEventType, ApprovalRequest, ApprovalCategory, ApprovalStatus, ApprovalContext, ApprovalPolicy, PolicyEffect, AgentStepType, Result, SkillManifest, SkillDefinition, SkillSource, SkillSourceType, SkillMode, SkillPermission, SkillPermissionValue, } from "@vinhnt-sdk/schema";
2
- export { isAgentId, isRunId, isSessionId, isMessageId, isToolCallId, isTraceId, isRequestId, isRecord, assertAgentId, assertRunId, assertSessionId, assertMessageId, VntError, AgentNotFoundError, AgentValidationError, AgentPermissionDenied, ToolNotFoundError, ToolExecutionError, ToolPermissionDenied, RunNotFoundError, RunAbortedError, RunTimeoutError, APPROVAL_CATEGORY_LABELS, AGENT_STEP_LABELS, inferStepType, ok, fail, wildcardMatch, } from "@vinhnt-sdk/schema";
3
- export type { ToolRisk, ToolDefinition, ToolDefinitionLike } from "@vinhnt-sdk/tools";
4
- export type { JsonSchema7Object, JsonSchemaProperty } from "@vinhnt-sdk/tools";
5
- export type { ChatMessage, MessageContentPart, ModelRequest, ModelResponse, ModelStreamEvent, ModelProvider, ModelPricing, ModelRegistry, ModelCapabilities } from "./model.js";
6
- export type { Tool, ToolConfig } from "@vinhnt-sdk/tools";
7
- export type { ToolFilter } from "@vinhnt-sdk/tools";
8
- export type { ToolContext, PermissionReply } from "@vinhnt-sdk/tools";
9
- export type { ApprovalStore, PermissionStore } from "./permission/saved.js";
10
- export type { PermissionEffect, PermissionRule, PermissionRuleset, PermissionRequest } from "./permission/permission.js";
11
- export type { PluginManifest, PluginContext, Plugin, PluginManager, PluginHooks, HookResult, HookName, HookPayload, HookReturn } from "./plugin.js";
12
- export { defineTool, toolToDefinition, zodSchemaToNestedJsonSchema } from "@vinhnt-sdk/tools";
13
- export { lintToolDescription, lintToolDefinitions } from "@vinhnt-sdk/tools";
14
- export type { ToolDescriptionReport, ToolDescriptionIssue, DescriptionIssueCode } from "@vinhnt-sdk/tools";
15
- export { ToolRegistry } from "@vinhnt-sdk/tools";
16
- export type { ToolPermissionRule, ToolMaterialization } from "@vinhnt-sdk/tools";
17
- export { ToolProviderRegistry } from "@vinhnt-sdk/tools";
18
- export type { ToolProvider } from "@vinhnt-sdk/tools";
19
- export { validateInput, ToolInputError } from "@vinhnt-sdk/tools";
20
- export { ToolSandbox, signalToToolContext, createSandbox } from "@vinhnt-sdk/tools";
21
- export type { SandboxConfig, SandboxScope, ProcessSandbox, SandboxResult } from "@vinhnt-sdk/tools";
22
- export { ToolRuntime } from "./tool/runtime.js";
23
- export type { ToolExecutionResult, ToolRuntimeConfig, ToolHook } from "./tool/runtime.js";
24
- export { createKernelTools, createPluginToolHook } from "./tool/bridge.js";
25
- export { FileReadTracker } from "@vinhnt-sdk/tools";
26
- export { InMemoryFileHistory } from "@vinhnt-sdk/tools";
27
- export type { FileHistory, FileVersion, UndoEntry } from "@vinhnt-sdk/tools";
28
- export { createFileHistoryHook } from "@vinhnt-sdk/tools";
29
- export { generateDiff } from "@vinhnt-sdk/tools";
30
- export type { UnifiedDiff } from "@vinhnt-sdk/tools";
31
- export { readImageToContentParts, createReadImageTool } from "@vinhnt-sdk/tools";
32
- export { createReadFileTool, createWriteFileTool, createEditFileTool, createApplyPatchTool, createListDirectoryTool, createShellTool, createGitStatusTool, createGitDiffTool, createGitLogTool, createGitCommitTool, createGlobFilesTool, createGrepFilesTool, createWebFetchTool, createQuestionTool, createWebSearchTool, createTodoWriteTool } from "@vinhnt-sdk/tools";
33
- export { createCodingDomain } from "@vinhnt-sdk/tools";
34
- export type { DomainManifest } from "@vinhnt-sdk/tools";
35
- export type { QuestionInput, QuestionHandler } from "@vinhnt-sdk/tools";
36
- export type { ShellToolConfig } from "@vinhnt-sdk/tools";
1
+ /**
2
+ * Core agent kernel for building AI coding agents.
3
+ *
4
+ * The kernel manages agent lifecycle, tool execution, permissions, and LLM interactions.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import { AgentKernel } from "@vinhnt-sdk/core";
9
+ *
10
+ * const kernel = new AgentKernel({
11
+ * workspaceRoot: "/path/to/project",
12
+ * maxConcurrent: 3,
13
+ * });
14
+ *
15
+ * await kernel.start();
16
+ * ```
17
+ */
18
+ /**
19
+ * Main agent kernel class - manages agent lifecycle and execution.
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const kernel = new AgentKernel({
24
+ * workspaceRoot: "/path/to/project",
25
+ * maxConcurrent: 3,
26
+ * toolRegistry: myToolRegistry,
27
+ * });
28
+ *
29
+ * const run = await kernel.startRun({
30
+ * agentId: "coder",
31
+ * prompt: "Write a hello world program",
32
+ * });
33
+ * ```
34
+ */
35
+ export { AgentKernel, KernelError } from "./kernel/kernel.js";
36
+ /**
37
+ * Configuration for the agent kernel.
38
+ */
39
+ export type { AgentKernelConfig, RunHandle, AgentRunHandle, AgentRunResult } from "./kernel/kernel-types.js";
40
+ /**
41
+ * Factory function for creating agent configurations.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const agent = createAgent({
46
+ * id: "coder",
47
+ * name: "Coder Agent",
48
+ * model: "gpt-4",
49
+ * systemPrompt: "You are a helpful coding assistant.",
50
+ * });
51
+ * ```
52
+ */
53
+ export { createAgent } from "./agent/agent-factory.js";
54
+ /**
55
+ * Parameters for creating an agent.
56
+ */
57
+ export type { CreateAgentParams } from "./agent/agent-factory.js";
58
+ /**
59
+ * In-memory event bus for publishing and subscribing to events.
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * const bus = new InMemoryEventBus();
64
+ *
65
+ * bus.on("tool.executed", (event) => {
66
+ * console.log("Tool executed:", event.toolId);
67
+ * });
68
+ *
69
+ * await bus.publish({
70
+ * type: "tool.executed",
71
+ * toolId: "read_file",
72
+ * timestamp: Date.now(),
73
+ * });
74
+ * ```
75
+ */
37
76
  export { InMemoryEventBus } from "./event-bus/in-memory-bus.js";
77
+ /**
78
+ * Event bus interface and types.
79
+ */
38
80
  export type { EventBus, EventHandler, Unsubscribe } from "./event-bus/types.js";
39
- export type { RunEventStore, RunEventListener, SessionStore, SessionUpdates, RunEventSnapshot } from "./session/store.js";
40
- export type { ConversationCompactor } from "./session/compaction.js";
41
- export type { SessionTree } from "./session/session-tree.js";
81
+ /**
82
+ * In-memory session state management.
83
+ */
42
84
  export { InMemorySessionState } from "./session/in-memory-session-state.js";
43
- export { restoreRunFromStore, findActiveSessionIds } from "./session/durable-reload.js";
44
- export type { RestoredRun } from "./session/durable-reload.js";
45
- export { NullRunEventStore, NullSessionStore } from "./session/null-store.js";
46
- export { InMemorySessionTree } from "./session/session-tree.js";
47
- export { createDefaultSessionTitleGenerator } from "./session/title.js";
48
- export { SessionRunCoordinator, kernelAsRunHandler } from "./session/run-coordinator.js";
49
- export type { SessionEvent, SessionEventType } from "./session/run-coordinator.js";
50
- export type { SessionRuntimeState, SessionRuntimeSnapshot } from "./session/session-state.js";
51
- export type { AgentRegistry, SourceDir } from "./agent/agent-registry.js";
85
+ /**
86
+ * Coordinates multiple runs within a session.
87
+ */
88
+ export { SessionRunCoordinator } from "./session/run-coordinator.js";
89
+ /**
90
+ * Session and run event store interfaces.
91
+ */
92
+ export type { RunEventStore, SessionStore } from "./session/store.js";
93
+ /**
94
+ * In-memory agent registry for managing agent configurations.
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * const registry = new InMemoryAgentRegistry();
99
+ * registry.register({
100
+ * id: "coder",
101
+ * name: "Coder Agent",
102
+ * model: "gpt-4",
103
+ * });
104
+ *
105
+ * const agent = registry.get("coder");
106
+ * ```
107
+ */
52
108
  export { InMemoryAgentRegistry } from "./agent/agent-registry.js";
53
- export type { AgentDefinition, AgentDefParser } from "./agent/agent-def.js";
54
- export { AgentParser } from "./agent/agent-parser.js";
55
- export { createAgent, createSubAgent, validateAgentConfig } from "./agent/agent-factory.js";
56
- export type { CreateAgentParams, SubAgentParams } from "./agent/agent-factory.js";
57
- export { ExecutionEngine } from "./agent/execution-engine.js";
58
- export { createSpawnAgentTool } from "./agent/spawn-agent-tool.js";
59
- export type { SpawnAgentInput } from "./agent/spawn-agent-tool.js";
60
- export { createDelegateTool } from "./agent/delegate-tool.js";
61
- export type { DelegateInput } from "./agent/delegate-tool.js";
62
- export { createDelegateBatchTool } from "./agent/delegate-batch-tool.js";
63
- export type { DelegateBatchInput } from "./agent/delegate-batch-tool.js";
64
- export { createListAgentsTool } from "./agent/list-agents-tool.js";
65
- export { createCreateAgentTool } from "./agent/create-agent-tool.js";
66
- export type { CreateAgentInput } from "./agent/create-agent-tool.js";
67
- export type { SkillDefRegistry, SkillDefParser } from "./skill/skill-def-registry.js";
68
- export { SkillParser } from "./skill/skill-parser.js";
69
- export { InMemorySkillDefRegistry } from "./skill/skill-def-registry.js";
70
- export { createSkillTool, createSkillSearchTool } from "./skill/skill-tool.js";
71
- export type { SkillToolInput } from "./skill/skill-tool.js";
72
- export { createCreateSkillTool } from "./skill/create-skill-tool.js";
73
- export type { CreateSkillInput } from "./skill/create-skill-tool.js";
74
- export { checkRiskAllowed, resolveEffectivePermissions, mergeRulesets, normalizePermissions, evaluatePermission } from "./permission/checker.js";
75
- export type { PermissionResult } from "./permission/checker.js";
76
- export { matchPermission, buildPermissionRules } from "./permission/evaluator.js";
77
- export type { ContextSourceKey, ContextSourceValue, ContextSnapshot, SystemContext, ReconcileResult, ContextRegistry } from "./system-context/types.js";
78
- export { createContextRegistry } from "./system-context/registry.js";
79
- export { createDateSource } from "./system-context/sources/date-source.js";
80
- export { createWorkspaceSource } from "./system-context/sources/workspace-source.js";
81
- export type { WorkspaceInfo } from "./system-context/sources/workspace-source.js";
82
- export { createInstructionsSource } from "./system-context/sources/instructions-source.js";
83
- export type { InstructionsInfo } from "./system-context/sources/instructions-source.js";
84
- export { createAgentSource } from "./system-context/sources/agent-source.js";
85
- export type { AgentContextInfo } from "./system-context/sources/agent-source.js";
86
- export { createSystemPromptSource } from "./system-context/prompts/system-prompt-source.js";
87
- export { createSkillGuidanceSource } from "./system-context/sources/skill-guidance-source.js";
88
- export type { SkillGuidanceInfo } from "./system-context/sources/skill-guidance-source.js";
89
- export { InMemoryMemoryStore, SessionMemory, BoundedMemory, ContextCompressor, LlmCompactor, WriteApprovalQueue, BackgroundReview, LearningEngine, createMemorySearchTool, buildPrompt } from "@vinhnt-sdk/knowledge";
90
- export type { MemoryItem, MemoryStore, MemoryTier, Skill, CompressorOptions, ReviewOptions, PromptBuilderOptions } from "@vinhnt-sdk/knowledge";
91
- export { AgentKernel, KernelError, CircuitBreaker, CircuitBreakerOpenError } from "./kernel/kernel.js";
92
- export type { RunState, KernelErrorCode, CircuitState, CircuitBreakerOptions } from "./kernel/kernel.js";
93
- export type { AgentKernelConfig, RunHandle, KernelSandboxConfig, PermissionConfig, ModelRoutingConfig, HookConfig } from "./kernel/kernel-types.js";
94
- export { normalizeConfig } from "./kernel/kernel-types.js";
95
- export { RunStateMachine } from "./kernel/run-state.js";
96
- export { PermissionGate } from "./kernel/permission-gate.js";
97
- export type { PermissionCheckResult, ApprovalDecision, DynamicRule } from "./kernel/permission-gate.js";
98
- export { ModelCaller } from "./kernel/model-caller.js";
99
- export { evaluateStopConditions, toToolCallOutcome } from "./kernel/termination.js";
100
- export type { StopCondition, TerminationPolicy, ToolCallOutcome, StepVerificationContext } from "./kernel/termination.js";
101
- export { LifecycleManager, type LifecycleResource, type LifecycleManagerConfig } from "./kernel/lifecycle-manager.js";
102
- export { canTransitionRun, terminalRunStatuses } from "./kernel/state-machine.js";
103
- export { ToolSaga } from "./kernel/tool-saga.js";
104
- export { DefaultPluginManager } from "./plugin/manager.js";
105
- export { WorkspaceManager } from "./workspace.js";
106
- export type { Workspace, WorkspaceEventType, WorkspaceEvent } from "./workspace.js";
109
+ /**
110
+ * Agent registry interface.
111
+ */
112
+ export type { AgentRegistry } from "./agent/agent-registry.js";
113
+ /**
114
+ * In-memory model registry for managing model providers.
115
+ *
116
+ * @example
117
+ * ```typescript
118
+ * const registry = new InMemoryModelRegistry();
119
+ * registry.register({
120
+ * id: "openai",
121
+ * name: "OpenAI",
122
+ * baseUrl: "https://api.openai.com",
123
+ * });
124
+ * ```
125
+ */
107
126
  export { InMemoryModelRegistry } from "./model.js";
127
+ /**
128
+ * Model provider interfaces and types.
129
+ */
130
+ export type { ModelProvider, ModelRequest, ModelResponse, ModelStreamEvent } from "./model.js";
131
+ /**
132
+ * In-memory approval store for managing permission approvals.
133
+ */
108
134
  export { InMemoryApprovalStore } from "./permission/saved.js";
135
+ /**
136
+ * Approval store interface.
137
+ */
138
+ export type { ApprovalStore } from "./permission/saved.js";
139
+ /**
140
+ * Workspace manager for handling file operations and workspace context.
141
+ */
142
+ export { WorkspaceManager } from "./workspace.js";
143
+ /**
144
+ * In-memory skill definition registry.
145
+ */
146
+ export { InMemorySkillDefRegistry } from "./skill/skill-def-registry.js";
147
+ /**
148
+ * Request tracing for monitoring and debugging.
149
+ */
109
150
  export { Tracer } from "./tracer.js";
110
- export type { Traceable } from "./tracer.js";
151
+ /**
152
+ * Set the global logger instance.
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * import { setLogger } from "@vinhnt-sdk/core";
157
+ *
158
+ * setLogger({
159
+ * info: (msg, ...args) => console.log(msg, ...args),
160
+ * warn: (msg, ...args) => console.warn(msg, ...args),
161
+ * error: (msg, ...args) => console.error(msg, ...args),
162
+ * debug: (msg, ...args) => console.debug(msg, ...args),
163
+ * });
164
+ * ```
165
+ */
111
166
  export { setLogger, setLogLevel, getLogger } from "./logger.js";
167
+ /**
168
+ * Logger interface and log level types.
169
+ */
112
170
  export type { Logger, LogLevel } from "./logger.js";
113
- export { sanitizeForLLM, validateToolOutput, detectInjectionPatterns } from "@vinhnt-sdk/security";
114
- export { redactSecrets, detectSecrets, createRedactingLogger } from "@vinhnt-sdk/security";
171
+ /**
172
+ * Plugin system interfaces and types.
173
+ */
174
+ export type { PluginManifest, PluginContext, PluginHooks, Plugin } from "./plugin.js";
175
+ /**
176
+ * System context types.
177
+ */
178
+ export type { ContextSourceValue, ContextSourceKey } from "./system-context/types.js";
179
+ /**
180
+ * Core type identifiers.
181
+ */
182
+ export type { RunId, SessionId, AgentId, TraceId, RequestId, RunStatus, RequestContext, AgentConfig, AgentProfile, Session, Message, } from "@vinhnt-sdk/schema";
183
+ /**
184
+ * Error classes for the SDK.
185
+ *
186
+ * All errors extend VntError and include error codes and retryable flags.
187
+ */
188
+ export { VntError, AgentNotFoundError, AgentValidationError, AgentPermissionDenied, ToolNotFoundError, ToolExecutionError, ToolPermissionDenied, RunNotFoundError, RunAbortedError, RunTimeoutError, CircuitBreakerOpenError, ToolInputError, PermissionDeniedError, ValidationError, TimeoutError, NetworkError, RateLimitError, AuthenticationError, ConfigurationError, PluginError, } from "@vinhnt-sdk/schema";
189
+ /**
190
+ * Error context type.
191
+ */
192
+ export type { VntErrorCtx } from "@vinhnt-sdk/schema";
193
+ /**
194
+ * Define a custom tool.
195
+ *
196
+ * @example
197
+ * ```typescript
198
+ * import { defineTool } from "@vinhnt-sdk/core";
199
+ * import { z } from "zod";
200
+ *
201
+ * const myTool = defineTool({
202
+ * name: "my_tool",
203
+ * description: "A custom tool",
204
+ * risk: "read",
205
+ * input: z.object({
206
+ * query: z.string(),
207
+ * }),
208
+ * async execute(input, ctx) {
209
+ * return `Result: ${input.query}`;
210
+ * },
211
+ * });
212
+ * ```
213
+ */
214
+ export { defineTool, ToolRegistry } from "@vinhnt-sdk/tools";
215
+ /**
216
+ * Tool system types.
217
+ */
218
+ export type { Tool, ToolConfig, ToolRisk, ToolDefinition } from "@vinhnt-sdk/tools";
219
+ export type { ToolContext, ToolHook, ToolProvider } from "@vinhnt-sdk/tools";
220
+ /**
221
+ * Bounded memory store with size limits.
222
+ */
223
+ export { BoundedMemory, ContextCompressor } from "@vinhnt-sdk/knowledge";
224
+ /**
225
+ * Memory system types.
226
+ */
227
+ export type { MemoryItem, MemoryStore } from "@vinhnt-sdk/knowledge";
228
+ /**
229
+ * Redact secrets from text.
230
+ */
231
+ export { redactSecrets, detectSecrets } from "@vinhnt-sdk/security";
115
232
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EACV,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EACxH,QAAQ,EAAE,aAAa,EACvB,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAClD,mBAAmB,EAAE,mBAAmB,EAAE,qBAAqB,EAC/D,qBAAqB,EAAE,gBAAgB,EACvC,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,sBAAsB,EAC1E,iBAAiB,EAAE,gBAAgB,EACnC,uBAAuB,EAAE,qBAAqB,EAAE,mBAAmB,EACnE,cAAc,EAAE,SAAS,EACzB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAC7C,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EACtH,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,WAAW,EA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AAC;AAIrE;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -1,77 +1,194 @@
1
1
  // @vinhnt-sdk/core
2
2
  // Core agent engine for building AI coding agents
3
- export { isAgentId, isRunId, isSessionId, isMessageId, isToolCallId, isTraceId, isRequestId, isRecord, assertAgentId, assertRunId, assertSessionId, assertMessageId, VntError, AgentNotFoundError, AgentValidationError, AgentPermissionDenied, ToolNotFoundError, ToolExecutionError, ToolPermissionDenied, RunNotFoundError, RunAbortedError, RunTimeoutError, APPROVAL_CATEGORY_LABELS, AGENT_STEP_LABELS, inferStepType, ok, fail, wildcardMatch, } from "@vinhnt-sdk/schema";
4
- // === Tool system ===
5
- export { defineTool, toolToDefinition, zodSchemaToNestedJsonSchema } from "@vinhnt-sdk/tools";
6
- export { lintToolDescription, lintToolDefinitions } from "@vinhnt-sdk/tools";
7
- export { ToolRegistry } from "@vinhnt-sdk/tools";
8
- export { ToolProviderRegistry } from "@vinhnt-sdk/tools";
9
- export { validateInput, ToolInputError } from "@vinhnt-sdk/tools";
10
- export { ToolSandbox, signalToToolContext, createSandbox } from "@vinhnt-sdk/tools";
11
- export { ToolRuntime } from "./tool/runtime.js";
12
- export { createKernelTools, createPluginToolHook } from "./tool/bridge.js";
13
- export { FileReadTracker } from "@vinhnt-sdk/tools";
14
- export { InMemoryFileHistory } from "@vinhnt-sdk/tools";
15
- export { createFileHistoryHook } from "@vinhnt-sdk/tools";
16
- export { generateDiff } from "@vinhnt-sdk/tools";
17
- export { readImageToContentParts, createReadImageTool } from "@vinhnt-sdk/tools";
18
- export { createReadFileTool, createWriteFileTool, createEditFileTool, createApplyPatchTool, createListDirectoryTool, createShellTool, createGitStatusTool, createGitDiffTool, createGitLogTool, createGitCommitTool, createGlobFilesTool, createGrepFilesTool, createWebFetchTool, createQuestionTool, createWebSearchTool, createTodoWriteTool } from "@vinhnt-sdk/tools";
19
- export { createCodingDomain } from "@vinhnt-sdk/tools";
3
+ //
4
+ // PUBLIC API - Only essential exports for users
5
+ // Internal implementation details are NOT exported here
6
+ /**
7
+ * Core agent kernel for building AI coding agents.
8
+ *
9
+ * The kernel manages agent lifecycle, tool execution, permissions, and LLM interactions.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { AgentKernel } from "@vinhnt-sdk/core";
14
+ *
15
+ * const kernel = new AgentKernel({
16
+ * workspaceRoot: "/path/to/project",
17
+ * maxConcurrent: 3,
18
+ * });
19
+ *
20
+ * await kernel.start();
21
+ * ```
22
+ */
23
+ // === Kernel (core runtime) ===
24
+ /**
25
+ * Main agent kernel class - manages agent lifecycle and execution.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const kernel = new AgentKernel({
30
+ * workspaceRoot: "/path/to/project",
31
+ * maxConcurrent: 3,
32
+ * toolRegistry: myToolRegistry,
33
+ * });
34
+ *
35
+ * const run = await kernel.startRun({
36
+ * agentId: "coder",
37
+ * prompt: "Write a hello world program",
38
+ * });
39
+ * ```
40
+ */
41
+ export { AgentKernel, KernelError } from "./kernel/kernel.js";
42
+ // === Agent system ===
43
+ /**
44
+ * Factory function for creating agent configurations.
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * const agent = createAgent({
49
+ * id: "coder",
50
+ * name: "Coder Agent",
51
+ * model: "gpt-4",
52
+ * systemPrompt: "You are a helpful coding assistant.",
53
+ * });
54
+ * ```
55
+ */
56
+ export { createAgent } from "./agent/agent-factory.js";
20
57
  // === Event bus ===
58
+ /**
59
+ * In-memory event bus for publishing and subscribing to events.
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * const bus = new InMemoryEventBus();
64
+ *
65
+ * bus.on("tool.executed", (event) => {
66
+ * console.log("Tool executed:", event.toolId);
67
+ * });
68
+ *
69
+ * await bus.publish({
70
+ * type: "tool.executed",
71
+ * toolId: "read_file",
72
+ * timestamp: Date.now(),
73
+ * });
74
+ * ```
75
+ */
21
76
  export { InMemoryEventBus } from "./event-bus/in-memory-bus.js";
77
+ // === Session management ===
78
+ /**
79
+ * In-memory session state management.
80
+ */
22
81
  export { InMemorySessionState } from "./session/in-memory-session-state.js";
23
- export { restoreRunFromStore, findActiveSessionIds } from "./session/durable-reload.js";
24
- export { NullRunEventStore, NullSessionStore } from "./session/null-store.js";
25
- export { InMemorySessionTree } from "./session/session-tree.js";
26
- export { createDefaultSessionTitleGenerator } from "./session/title.js";
27
- export { SessionRunCoordinator, kernelAsRunHandler } from "./session/run-coordinator.js";
82
+ /**
83
+ * Coordinates multiple runs within a session.
84
+ */
85
+ export { SessionRunCoordinator } from "./session/run-coordinator.js";
86
+ // === Agent registry ===
87
+ /**
88
+ * In-memory agent registry for managing agent configurations.
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * const registry = new InMemoryAgentRegistry();
93
+ * registry.register({
94
+ * id: "coder",
95
+ * name: "Coder Agent",
96
+ * model: "gpt-4",
97
+ * });
98
+ *
99
+ * const agent = registry.get("coder");
100
+ * ```
101
+ */
28
102
  export { InMemoryAgentRegistry } from "./agent/agent-registry.js";
29
- export { AgentParser } from "./agent/agent-parser.js";
30
- export { createAgent, createSubAgent, validateAgentConfig } from "./agent/agent-factory.js";
31
- export { ExecutionEngine } from "./agent/execution-engine.js";
32
- export { createSpawnAgentTool } from "./agent/spawn-agent-tool.js";
33
- export { createDelegateTool } from "./agent/delegate-tool.js";
34
- export { createDelegateBatchTool } from "./agent/delegate-batch-tool.js";
35
- export { createListAgentsTool } from "./agent/list-agents-tool.js";
36
- export { createCreateAgentTool } from "./agent/create-agent-tool.js";
37
- export { SkillParser } from "./skill/skill-parser.js";
38
- export { InMemorySkillDefRegistry } from "./skill/skill-def-registry.js";
39
- export { createSkillTool, createSkillSearchTool } from "./skill/skill-tool.js";
40
- export { createCreateSkillTool } from "./skill/create-skill-tool.js";
41
- // === Permission system ===
42
- export { checkRiskAllowed, resolveEffectivePermissions, mergeRulesets, normalizePermissions, evaluatePermission } from "./permission/checker.js";
43
- export { matchPermission, buildPermissionRules } from "./permission/evaluator.js";
44
- export { createContextRegistry } from "./system-context/registry.js";
45
- export { createDateSource } from "./system-context/sources/date-source.js";
46
- export { createWorkspaceSource } from "./system-context/sources/workspace-source.js";
47
- export { createInstructionsSource } from "./system-context/sources/instructions-source.js";
48
- export { createAgentSource } from "./system-context/sources/agent-source.js";
49
- export { createSystemPromptSource } from "./system-context/prompts/system-prompt-source.js";
50
- export { createSkillGuidanceSource } from "./system-context/sources/skill-guidance-source.js";
51
- // === Knowledge system ===
52
- export { InMemoryMemoryStore, SessionMemory, BoundedMemory, ContextCompressor, LlmCompactor, WriteApprovalQueue, BackgroundReview, LearningEngine, createMemorySearchTool, buildPrompt } from "@vinhnt-sdk/knowledge";
53
- // === Kernel (core runtime) ===
54
- export { AgentKernel, KernelError, CircuitBreaker, CircuitBreakerOpenError } from "./kernel/kernel.js";
55
- export { normalizeConfig } from "./kernel/kernel-types.js";
56
- export { RunStateMachine } from "./kernel/run-state.js";
57
- export { PermissionGate } from "./kernel/permission-gate.js";
58
- export { ModelCaller } from "./kernel/model-caller.js";
59
- export { evaluateStopConditions, toToolCallOutcome } from "./kernel/termination.js";
60
- export { LifecycleManager } from "./kernel/lifecycle-manager.js";
61
- export { canTransitionRun, terminalRunStatuses } from "./kernel/state-machine.js";
62
- export { ToolSaga } from "./kernel/tool-saga.js";
63
- export { DefaultPluginManager } from "./plugin/manager.js";
64
- // === Workspace ===
65
- export { WorkspaceManager } from "./workspace.js";
66
- // === Model ===
103
+ // === Model registry ===
104
+ /**
105
+ * In-memory model registry for managing model providers.
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * const registry = new InMemoryModelRegistry();
110
+ * registry.register({
111
+ * id: "openai",
112
+ * name: "OpenAI",
113
+ * baseUrl: "https://api.openai.com",
114
+ * });
115
+ * ```
116
+ */
67
117
  export { InMemoryModelRegistry } from "./model.js";
68
118
  // === Permission stores ===
119
+ /**
120
+ * In-memory approval store for managing permission approvals.
121
+ */
69
122
  export { InMemoryApprovalStore } from "./permission/saved.js";
123
+ // === Workspace ===
124
+ /**
125
+ * Workspace manager for handling file operations and workspace context.
126
+ */
127
+ export { WorkspaceManager } from "./workspace.js";
128
+ // === Skill system ===
129
+ /**
130
+ * In-memory skill definition registry.
131
+ */
132
+ export { InMemorySkillDefRegistry } from "./skill/skill-def-registry.js";
70
133
  // === Tracing ===
134
+ /**
135
+ * Request tracing for monitoring and debugging.
136
+ */
71
137
  export { Tracer } from "./tracer.js";
72
138
  // === Logger ===
139
+ /**
140
+ * Set the global logger instance.
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * import { setLogger } from "@vinhnt-sdk/core";
145
+ *
146
+ * setLogger({
147
+ * info: (msg, ...args) => console.log(msg, ...args),
148
+ * warn: (msg, ...args) => console.warn(msg, ...args),
149
+ * error: (msg, ...args) => console.error(msg, ...args),
150
+ * debug: (msg, ...args) => console.debug(msg, ...args),
151
+ * });
152
+ * ```
153
+ */
73
154
  export { setLogger, setLogLevel, getLogger } from "./logger.js";
74
- // === Security ===
75
- export { sanitizeForLLM, validateToolOutput, detectInjectionPatterns } from "@vinhnt-sdk/security";
76
- export { redactSecrets, detectSecrets, createRedactingLogger } from "@vinhnt-sdk/security";
155
+ /**
156
+ * Error classes for the SDK.
157
+ *
158
+ * All errors extend VntError and include error codes and retryable flags.
159
+ */
160
+ export { VntError, AgentNotFoundError, AgentValidationError, AgentPermissionDenied, ToolNotFoundError, ToolExecutionError, ToolPermissionDenied, RunNotFoundError, RunAbortedError, RunTimeoutError, CircuitBreakerOpenError, ToolInputError, PermissionDeniedError, ValidationError, TimeoutError, NetworkError, RateLimitError, AuthenticationError, ConfigurationError, PluginError, } from "@vinhnt-sdk/schema";
161
+ // === Re-export essential types from tools ===
162
+ /**
163
+ * Define a custom tool.
164
+ *
165
+ * @example
166
+ * ```typescript
167
+ * import { defineTool } from "@vinhnt-sdk/core";
168
+ * import { z } from "zod";
169
+ *
170
+ * const myTool = defineTool({
171
+ * name: "my_tool",
172
+ * description: "A custom tool",
173
+ * risk: "read",
174
+ * input: z.object({
175
+ * query: z.string(),
176
+ * }),
177
+ * async execute(input, ctx) {
178
+ * return `Result: ${input.query}`;
179
+ * },
180
+ * });
181
+ * ```
182
+ */
183
+ export { defineTool, ToolRegistry } from "@vinhnt-sdk/tools";
184
+ // === Re-export essential types from knowledge ===
185
+ /**
186
+ * Bounded memory store with size limits.
187
+ */
188
+ export { BoundedMemory, ContextCompressor } from "@vinhnt-sdk/knowledge";
189
+ // === Re-export essential types from security ===
190
+ /**
191
+ * Redact secrets from text.
192
+ */
193
+ export { redactSecrets, detectSecrets } from "@vinhnt-sdk/security";
77
194
  //# sourceMappingURL=index.js.map