@vinhnt-sdk/core 0.1.1 → 0.1.3
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 +194 -12
- package/dist/agent/agent-factory.d.ts +11 -0
- package/dist/agent/agent-factory.d.ts.map +1 -1
- package/dist/agent/agent-factory.js +11 -2
- package/dist/agent/agent-factory.js.map +1 -1
- package/dist/agent/agent-registry.d.ts +3 -0
- package/dist/agent/agent-registry.d.ts.map +1 -1
- package/dist/agent/agent-registry.js.map +1 -1
- package/dist/agent/create-agent-tool.d.ts +13 -13
- package/dist/agent/create-agent-tool.d.ts.map +1 -1
- package/dist/agent/delegate-batch-tool.d.ts.map +1 -1
- package/dist/agent/delegate-batch-tool.js +1 -1
- package/dist/agent/delegate-batch-tool.js.map +1 -1
- package/dist/agent/delegate-tool.js +1 -1
- package/dist/agent/delegate-tool.js.map +1 -1
- package/dist/agent/execution-engine.d.ts +1 -1
- package/dist/agent/execution-engine.d.ts.map +1 -1
- package/dist/agent/spawn-agent-tool.d.ts +10 -10
- package/dist/agent/spawn-agent-tool.d.ts.map +1 -1
- package/dist/event-bus/bridge.d.ts +2 -3
- package/dist/event-bus/bridge.d.ts.map +1 -1
- package/dist/event-bus/bridge.js +12 -5
- package/dist/event-bus/bridge.js.map +1 -1
- package/dist/event-bus/global-bus.d.ts +8 -0
- package/dist/event-bus/global-bus.d.ts.map +1 -1
- package/dist/event-bus/global-bus.js +48 -0
- package/dist/event-bus/global-bus.js.map +1 -1
- package/dist/event-bus/in-memory-bus.d.ts +14 -0
- package/dist/event-bus/in-memory-bus.d.ts.map +1 -1
- package/dist/event-bus/in-memory-bus.js +53 -0
- package/dist/event-bus/in-memory-bus.js.map +1 -1
- package/dist/event-bus/types.d.ts +17 -0
- package/dist/event-bus/types.d.ts.map +1 -1
- package/dist/fakes/fake-approval-store.d.ts +2 -2
- package/dist/fakes/fake-approval-store.d.ts.map +1 -1
- package/dist/fakes/fake-approval-store.js +28 -6
- package/dist/fakes/fake-approval-store.js.map +1 -1
- package/dist/fakes/fake-model.d.ts.map +1 -1
- package/dist/fakes/fake-model.js +2 -1
- package/dist/fakes/fake-model.js.map +1 -1
- package/dist/fakes/fake-store.d.ts +4 -1
- package/dist/fakes/fake-store.d.ts.map +1 -1
- package/dist/fakes/fake-store.js +33 -0
- package/dist/fakes/fake-store.js.map +1 -1
- package/dist/index.d.ts +232 -109
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +191 -66
- package/dist/index.js.map +1 -1
- package/dist/kernel/approval-handler.d.ts +1 -1
- package/dist/kernel/approval-handler.d.ts.map +1 -1
- package/dist/kernel/approval-handler.js +5 -1
- package/dist/kernel/approval-handler.js.map +1 -1
- package/dist/kernel/circuit-breaker.d.ts +19 -1
- package/dist/kernel/circuit-breaker.d.ts.map +1 -1
- package/dist/kernel/circuit-breaker.js +54 -10
- package/dist/kernel/circuit-breaker.js.map +1 -1
- package/dist/kernel/kernel-error.d.ts +3 -2
- package/dist/kernel/kernel-error.d.ts.map +1 -1
- package/dist/kernel/kernel-error.js +5 -6
- package/dist/kernel/kernel-error.js.map +1 -1
- package/dist/kernel/kernel-session.d.ts +13 -5
- package/dist/kernel/kernel-session.d.ts.map +1 -1
- package/dist/kernel/kernel-session.js +71 -13
- package/dist/kernel/kernel-session.js.map +1 -1
- package/dist/kernel/kernel-types.d.ts +82 -9
- package/dist/kernel/kernel-types.d.ts.map +1 -1
- package/dist/kernel/kernel-types.js.map +1 -1
- package/dist/kernel/kernel.d.ts +94 -20
- package/dist/kernel/kernel.d.ts.map +1 -1
- package/dist/kernel/kernel.js +591 -70
- package/dist/kernel/kernel.js.map +1 -1
- package/dist/kernel/model-caller.d.ts +30 -2
- package/dist/kernel/model-caller.d.ts.map +1 -1
- package/dist/kernel/model-caller.js +55 -20
- package/dist/kernel/model-caller.js.map +1 -1
- package/dist/kernel/permission-gate.d.ts +6 -4
- package/dist/kernel/permission-gate.d.ts.map +1 -1
- package/dist/kernel/permission-gate.js +16 -6
- package/dist/kernel/permission-gate.js.map +1 -1
- package/dist/kernel/run-context.d.ts +26 -0
- package/dist/kernel/run-context.d.ts.map +1 -0
- package/dist/kernel/run-context.js +13 -0
- package/dist/kernel/run-context.js.map +1 -0
- package/dist/kernel/run-loop.d.ts +35 -14
- package/dist/kernel/run-loop.d.ts.map +1 -1
- package/dist/kernel/run-loop.js +295 -87
- package/dist/kernel/run-loop.js.map +1 -1
- package/dist/kernel/self-correction.d.ts +2 -2
- package/dist/kernel/self-correction.d.ts.map +1 -1
- package/dist/kernel/self-correction.js +3 -2
- package/dist/kernel/self-correction.js.map +1 -1
- package/dist/kernel/state-machine.d.ts +2 -0
- package/dist/kernel/state-machine.d.ts.map +1 -1
- package/dist/kernel/state-machine.js +2 -0
- package/dist/kernel/state-machine.js.map +1 -1
- package/dist/kernel/step-executor.d.ts +11 -3
- package/dist/kernel/step-executor.d.ts.map +1 -1
- package/dist/kernel/step-executor.js +54 -24
- package/dist/kernel/step-executor.js.map +1 -1
- package/dist/kernel/sub-agent-runner.d.ts +10 -7
- package/dist/kernel/sub-agent-runner.d.ts.map +1 -1
- package/dist/kernel/sub-agent-runner.js +105 -31
- package/dist/kernel/sub-agent-runner.js.map +1 -1
- package/dist/kernel/tool-context-builder.d.ts +7 -2
- package/dist/kernel/tool-context-builder.d.ts.map +1 -1
- package/dist/kernel/tool-context-builder.js +23 -6
- package/dist/kernel/tool-context-builder.js.map +1 -1
- package/dist/kernel/tool-error-router.d.ts +1 -1
- package/dist/kernel/tool-error-router.d.ts.map +1 -1
- package/dist/kernel/tool-error-router.js +4 -3
- package/dist/kernel/tool-error-router.js.map +1 -1
- package/dist/logger.d.ts +5 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +3 -0
- package/dist/logger.js.map +1 -1
- package/dist/model.d.ts +3 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +2 -0
- package/dist/model.js.map +1 -1
- package/dist/plugin/manager.d.ts +3 -1
- package/dist/plugin/manager.d.ts.map +1 -1
- package/dist/plugin/manager.js +51 -3
- package/dist/plugin/manager.js.map +1 -1
- package/dist/plugin/plugin-file-loader.js +2 -2
- package/dist/plugin/plugin-file-loader.js.map +1 -1
- package/dist/plugin.d.ts +50 -4
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +14 -1
- package/dist/plugin.js.map +1 -1
- package/dist/session/null-store.d.ts +1 -0
- package/dist/session/null-store.d.ts.map +1 -1
- package/dist/session/null-store.js +7 -0
- package/dist/session/null-store.js.map +1 -1
- package/dist/session/run-coordinator.d.ts +9 -3
- package/dist/session/run-coordinator.d.ts.map +1 -1
- package/dist/session/run-coordinator.js +4 -0
- package/dist/session/run-coordinator.js.map +1 -1
- package/dist/skill/create-skill-tool.d.ts +5 -4
- package/dist/skill/create-skill-tool.d.ts.map +1 -1
- package/dist/skill/create-skill-tool.js +8 -5
- package/dist/skill/create-skill-tool.js.map +1 -1
- package/dist/skill/skill-def-registry.d.ts +6 -0
- package/dist/skill/skill-def-registry.d.ts.map +1 -1
- package/dist/skill/skill-def-registry.js +4 -0
- package/dist/skill/skill-def-registry.js.map +1 -1
- package/dist/system-context/sources/instructions-source.js +1 -1
- package/dist/system-context/sources/instructions-source.js.map +1 -1
- package/dist/tool/bridge.d.ts +7 -1
- package/dist/tool/bridge.d.ts.map +1 -1
- package/dist/tool/bridge.js +5 -0
- package/dist/tool/bridge.js.map +1 -1
- package/dist/tool/builtin-provider.d.ts +35 -0
- package/dist/tool/builtin-provider.d.ts.map +1 -0
- package/dist/tool/builtin-provider.js +75 -0
- package/dist/tool/builtin-provider.js.map +1 -0
- package/dist/tool/index.d.ts +21 -23
- package/dist/tool/index.d.ts.map +1 -1
- package/dist/tool/index.js +19 -18
- package/dist/tool/index.js.map +1 -1
- package/dist/tool/provider-helpers.d.ts.map +1 -1
- package/dist/tool/provider-helpers.js +3 -2
- package/dist/tool/provider-helpers.js.map +1 -1
- package/dist/tool/runtime.d.ts +23 -2
- package/dist/tool/runtime.d.ts.map +1 -1
- package/dist/tool/runtime.js +20 -16
- package/dist/tool/runtime.js.map +1 -1
- package/dist/tracer.d.ts +5 -0
- package/dist/tracer.d.ts.map +1 -1
- package/dist/tracer.js +4 -0
- package/dist/tracer.js.map +1 -1
- package/dist/workflow/agent-graph.js +3 -3
- package/dist/workflow/agent-graph.js.map +1 -1
- package/dist/workflow/workflow-helpers.js +2 -2
- package/dist/workflow/workflow-helpers.js.map +1 -1
- package/dist/workspace.d.ts +7 -0
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +4 -0
- package/dist/workspace.js.map +1 -1
- package/package.json +18 -62
package/dist/index.d.ts
CHANGED
|
@@ -1,115 +1,238 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export
|
|
36
|
-
export type { ShellToolConfig } from "@vinhnt-sdk/tools";
|
|
37
|
-
export { InMemoryEventBus } from "./event-bus/in-memory-bus.js";
|
|
38
|
-
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";
|
|
42
|
-
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";
|
|
52
|
-
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";
|
|
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";
|
|
102
36
|
export { canTransitionRun, terminalRunStatuses } from "./kernel/state-machine.js";
|
|
103
|
-
export {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
37
|
+
export { RunStateMachine } from "@vinhnt-sdk/step-executor";
|
|
38
|
+
/**
|
|
39
|
+
* Configuration for the agent kernel.
|
|
40
|
+
*/
|
|
41
|
+
export type { AgentKernelConfig, RunHandle, AgentRunHandle, AgentRunResult } from "./kernel/kernel-types.js";
|
|
42
|
+
/**
|
|
43
|
+
* Factory function for creating agent configurations.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const agent = createAgent({
|
|
48
|
+
* id: "coder",
|
|
49
|
+
* name: "Coder Agent",
|
|
50
|
+
* model: "gpt-4",
|
|
51
|
+
* systemPrompt: "You are a helpful coding assistant.",
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export { createAgent } from "./agent/agent-factory.js";
|
|
56
|
+
/**
|
|
57
|
+
* Parameters for creating an agent.
|
|
58
|
+
*/
|
|
59
|
+
export type { CreateAgentParams } from "./agent/agent-factory.js";
|
|
60
|
+
/**
|
|
61
|
+
* In-memory event bus for publishing and subscribing to events.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const bus = new InMemoryEventBus();
|
|
66
|
+
*
|
|
67
|
+
* bus.on("tool.executed", (event) => {
|
|
68
|
+
* console.log("Tool executed:", event.toolId);
|
|
69
|
+
* });
|
|
70
|
+
*
|
|
71
|
+
* await bus.publish({
|
|
72
|
+
* type: "tool.executed",
|
|
73
|
+
* toolId: "read_file",
|
|
74
|
+
* timestamp: Date.now(),
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export { InMemoryEventBus } from "@vinhnt-sdk/event";
|
|
79
|
+
/**
|
|
80
|
+
* Event bus interface and types.
|
|
81
|
+
*/
|
|
82
|
+
export type { EventBus, EventHandler, Unsubscribe } from "@vinhnt-sdk/event";
|
|
83
|
+
/**
|
|
84
|
+
* In-memory session state management.
|
|
85
|
+
*/
|
|
86
|
+
export { InMemorySessionState } from "@vinhnt-sdk/session";
|
|
87
|
+
/**
|
|
88
|
+
* Coordinates multiple runs within a session.
|
|
89
|
+
*/
|
|
90
|
+
export { SessionRunCoordinator } from "./session/run-coordinator.js";
|
|
91
|
+
/**
|
|
92
|
+
* Session and run event store interfaces.
|
|
93
|
+
*/
|
|
94
|
+
export type { RunEventStore, SessionStore } from "@vinhnt-sdk/session";
|
|
95
|
+
/**
|
|
96
|
+
* In-memory agent registry for managing agent configurations.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const registry = new InMemoryAgentRegistry();
|
|
101
|
+
* registry.register({
|
|
102
|
+
* id: "coder",
|
|
103
|
+
* name: "Coder Agent",
|
|
104
|
+
* model: "gpt-4",
|
|
105
|
+
* });
|
|
106
|
+
*
|
|
107
|
+
* const agent = registry.get("coder");
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export { InMemoryAgentRegistry } from "./agent/agent-registry.js";
|
|
111
|
+
/**
|
|
112
|
+
* Agent registry interface.
|
|
113
|
+
*/
|
|
114
|
+
export type { AgentRegistry } from "./agent/agent-registry.js";
|
|
115
|
+
/**
|
|
116
|
+
* In-memory model registry for managing model providers.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* const registry = new InMemoryModelRegistry();
|
|
121
|
+
* registry.register({
|
|
122
|
+
* id: "openai",
|
|
123
|
+
* name: "OpenAI",
|
|
124
|
+
* baseUrl: "https://api.openai.com",
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
107
128
|
export { InMemoryModelRegistry } from "./model.js";
|
|
108
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Model provider interfaces and types.
|
|
131
|
+
*/
|
|
132
|
+
export type { ModelProvider, ModelRequest, ModelResponse, ModelStreamEvent, ModelUsage, ContentPart, ToolCallResult } from "./model.js";
|
|
133
|
+
export { getTextContent } from "./model.js";
|
|
134
|
+
/**
|
|
135
|
+
* In-memory approval store for managing permission approvals.
|
|
136
|
+
*/
|
|
137
|
+
export { InMemoryApprovalStore } from "@vinhnt-sdk/permission";
|
|
138
|
+
/**
|
|
139
|
+
* Approval store interface.
|
|
140
|
+
*/
|
|
141
|
+
export type { ApprovalStore } from "@vinhnt-sdk/permission";
|
|
142
|
+
/**
|
|
143
|
+
* Workspace manager for handling file operations and workspace context.
|
|
144
|
+
*/
|
|
145
|
+
export { WorkspaceManager } from "./workspace.js";
|
|
146
|
+
/**
|
|
147
|
+
* In-memory skill definition registry.
|
|
148
|
+
*/
|
|
149
|
+
export { InMemorySkillDefRegistry } from "./skill/skill-def-registry.js";
|
|
150
|
+
/**
|
|
151
|
+
* Request tracing for monitoring and debugging.
|
|
152
|
+
*/
|
|
109
153
|
export { Tracer } from "./tracer.js";
|
|
110
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Set the global logger instance.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* import { setLogger } from "@vinhnt-sdk/core";
|
|
160
|
+
*
|
|
161
|
+
* setLogger({
|
|
162
|
+
* info: (msg, ...args) => console.log(msg, ...args),
|
|
163
|
+
* warn: (msg, ...args) => console.warn(msg, ...args),
|
|
164
|
+
* error: (msg, ...args) => console.error(msg, ...args),
|
|
165
|
+
* debug: (msg, ...args) => console.debug(msg, ...args),
|
|
166
|
+
* });
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
111
169
|
export { setLogger, setLogLevel, getLogger } from "./logger.js";
|
|
170
|
+
/**
|
|
171
|
+
* Logger interface and log level types.
|
|
172
|
+
*/
|
|
112
173
|
export type { Logger, LogLevel } from "./logger.js";
|
|
113
|
-
|
|
114
|
-
|
|
174
|
+
/**
|
|
175
|
+
* Plugin system interfaces and types.
|
|
176
|
+
*/
|
|
177
|
+
export type { PluginManifest, PluginContext, PluginHooks, Plugin, Disposable } from "./plugin.js";
|
|
178
|
+
export { createDisposable } from "./plugin.js";
|
|
179
|
+
/**
|
|
180
|
+
* System context types.
|
|
181
|
+
*/
|
|
182
|
+
export type { ContextSourceValue, ContextSourceKey } from "./system-context/types.js";
|
|
183
|
+
/**
|
|
184
|
+
* Core type identifiers.
|
|
185
|
+
*/
|
|
186
|
+
export type { RunId, SessionId, AgentId, TraceId, RequestId, RunStatus, RequestContext, AgentConfig, AgentProfile, Session, Message, } from "@vinhnt-sdk/schema";
|
|
187
|
+
/**
|
|
188
|
+
* Error classes for the SDK.
|
|
189
|
+
*
|
|
190
|
+
* All errors extend VntError and include error codes and retryable flags.
|
|
191
|
+
*/
|
|
192
|
+
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";
|
|
193
|
+
/**
|
|
194
|
+
* Error context type.
|
|
195
|
+
*/
|
|
196
|
+
export type { VntErrorCtx } from "@vinhnt-sdk/schema";
|
|
197
|
+
/**
|
|
198
|
+
* Define a custom tool.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* import { defineTool } from "@vinhnt-sdk/core";
|
|
203
|
+
* import { z } from "zod";
|
|
204
|
+
*
|
|
205
|
+
* const myTool = defineTool({
|
|
206
|
+
* name: "my_tool",
|
|
207
|
+
* description: "A custom tool",
|
|
208
|
+
* risk: "read",
|
|
209
|
+
* input: z.object({
|
|
210
|
+
* query: z.string(),
|
|
211
|
+
* }),
|
|
212
|
+
* async execute(input, ctx) {
|
|
213
|
+
* return `Result: ${input.query}`;
|
|
214
|
+
* },
|
|
215
|
+
* });
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
export { ToolRegistry, LazyToolRegistry, ToolProviderRegistry, defineTool, toolToDefinition, zodSchemaToNestedJsonSchema, createCodingDomain, generateDiff, createReadFileTool, createWriteFileTool, createEditFileTool, createApplyPatchTool, createListDirectoryTool, createReadImageTool, readImageToContentParts, FileReadTracker, InMemoryFileHistory, createFileHistoryHook, createShellTool, ToolSandbox, signalToToolContext, createSandbox, createWebFetchTool, createWebSearchTool, TavilySearchProvider, SerperSearchProvider, createGitStatusTool, createGitDiffTool, createGitLogTool, createGitCommitTool, createGlobFilesTool, createGrepFilesTool, createToolSearchTool, createQuestionTool, createTodoWriteTool, AgentToolProvider, SkillToolProvider, ToolFileProvider, ToolFileLoader, } from "@vinhnt-sdk/tools";
|
|
219
|
+
export type { Tool, ToolConfig, ToolRisk, ToolDefinition, ToolDefinitionLike, ToolContext, ToolHook, PermissionReply, ToolExecutionResult, ToolPermissionRule, ToolMaterialization, DomainManifest, LazyToolEntry, ApprovalHandler, UnifiedDiff, ToolProvider, ShellToolConfig, FileHistory, FileVersion, UndoEntry, WebSearchToolConfig, WebSearchProvider, ToolSearchInput, ToolSearchResult, QuestionInput, QuestionHandler, } from "@vinhnt-sdk/tools";
|
|
220
|
+
export { BuiltinToolProvider } from "./tool/builtin-provider.js";
|
|
221
|
+
export type { BuiltinToolConfig } from "./tool/builtin-provider.js";
|
|
222
|
+
export { ToolRuntime } from "./tool/runtime.js";
|
|
223
|
+
export type { ToolRuntimeConfig } from "./tool/runtime.js";
|
|
224
|
+
export { createKernelTools, createPluginToolHook } from "./tool/bridge.js";
|
|
225
|
+
export { createToolProviderRegistry, createToolProvider, registerProviderTools } from "./tool/provider-helpers.js";
|
|
226
|
+
/**
|
|
227
|
+
* Bounded memory store with size limits.
|
|
228
|
+
*/
|
|
229
|
+
export { BoundedMemory, ContextCompressor } from "@vinhnt-sdk/knowledge";
|
|
230
|
+
/**
|
|
231
|
+
* Memory system types.
|
|
232
|
+
*/
|
|
233
|
+
export type { MemoryItem, MemoryStore } from "@vinhnt-sdk/knowledge";
|
|
234
|
+
/**
|
|
235
|
+
* Redact secrets from text.
|
|
236
|
+
*/
|
|
237
|
+
export { redactSecrets, detectSecrets } from "@vinhnt-sdk/security";
|
|
115
238
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;GAgBG;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D;;GAEG;AACH,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI7G;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;GAEG;AACH,YAAY,EAAE,iBAAiB,EAA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