kernl 0.6.0 → 0.6.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 (91) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/CHANGELOG.md +15 -0
  3. package/dist/agent/__tests__/concurrency.test.js +4 -4
  4. package/dist/agent/__tests__/run.test.js +5 -5
  5. package/dist/agent.d.ts +14 -14
  6. package/dist/agent.js +3 -3
  7. package/dist/api/__tests__/cursor-page.test.js +1 -1
  8. package/dist/api/__tests__/offset-page.test.js +1 -1
  9. package/dist/api/__tests__/threads.test.js +4 -4
  10. package/dist/api/models/index.d.ts +1 -1
  11. package/dist/api/models/thread.d.ts +1 -1
  12. package/dist/api/pagination/cursor.d.ts +1 -1
  13. package/dist/api/pagination/cursor.js +1 -1
  14. package/dist/api/pagination/offset.d.ts +1 -1
  15. package/dist/api/pagination/offset.js +1 -1
  16. package/dist/api/resources/threads/events.d.ts +2 -2
  17. package/dist/api/resources/threads/events.js +1 -1
  18. package/dist/api/resources/threads/index.d.ts +3 -3
  19. package/dist/api/resources/threads/index.js +2 -2
  20. package/dist/api/resources/threads/threads.d.ts +5 -5
  21. package/dist/api/resources/threads/threads.js +5 -5
  22. package/dist/api/resources/threads/types.d.ts +3 -3
  23. package/dist/api/resources/threads/utils.d.ts +4 -4
  24. package/dist/guardrail.d.ts +4 -4
  25. package/dist/index.d.ts +12 -12
  26. package/dist/index.js +8 -8
  27. package/dist/internal.d.ts +3 -3
  28. package/dist/internal.js +2 -2
  29. package/dist/kernl/index.d.ts +2 -2
  30. package/dist/kernl/index.js +2 -2
  31. package/dist/kernl/kernl.d.ts +10 -10
  32. package/dist/kernl/kernl.js +3 -3
  33. package/dist/kernl/threads.d.ts +2 -2
  34. package/dist/kernl/threads.js +1 -1
  35. package/dist/kernl.d.ts +10 -19
  36. package/dist/kernl.d.ts.map +1 -1
  37. package/dist/kernl.js +3 -25
  38. package/dist/lib/error.d.ts +3 -3
  39. package/dist/lib/logger.js +1 -1
  40. package/dist/lifecycle.d.ts +5 -5
  41. package/dist/mcp/__tests__/base.test.js +2 -2
  42. package/dist/mcp/__tests__/fixtures/utils.d.ts +1 -1
  43. package/dist/mcp/__tests__/fixtures/utils.js +1 -1
  44. package/dist/mcp/__tests__/integration.test.js +8 -8
  45. package/dist/mcp/__tests__/stdio.test.js +2 -2
  46. package/dist/mcp/__tests__/utils.test.js +2 -2
  47. package/dist/mcp/base.d.ts +2 -2
  48. package/dist/mcp/http.d.ts +2 -2
  49. package/dist/mcp/http.js +2 -2
  50. package/dist/mcp/sse.d.ts +2 -2
  51. package/dist/mcp/sse.js +2 -2
  52. package/dist/mcp/stdio.d.ts +2 -2
  53. package/dist/mcp/stdio.js +2 -2
  54. package/dist/mcp/types.d.ts +3 -3
  55. package/dist/mcp/utils.d.ts +4 -4
  56. package/dist/mcp/utils.js +1 -1
  57. package/dist/storage/__tests__/in-memory.test.js +4 -4
  58. package/dist/storage/base.d.ts +2 -2
  59. package/dist/storage/in-memory.d.ts +4 -4
  60. package/dist/storage/in-memory.js +2 -2
  61. package/dist/storage/index.d.ts +3 -3
  62. package/dist/storage/index.js +1 -1
  63. package/dist/storage/thread.d.ts +3 -3
  64. package/dist/task.d.ts +3 -3
  65. package/dist/thread/__tests__/integration.test.js +4 -4
  66. package/dist/thread/__tests__/mock.d.ts +1 -1
  67. package/dist/thread/__tests__/namespace.test.js +5 -5
  68. package/dist/thread/__tests__/thread.test.js +6 -6
  69. package/dist/thread/index.d.ts +1 -1
  70. package/dist/thread/index.js +1 -1
  71. package/dist/thread/thread.d.ts +6 -6
  72. package/dist/thread/thread.js +3 -3
  73. package/dist/thread/utils.d.ts +3 -3
  74. package/dist/thread/utils.js +1 -1
  75. package/dist/tool/__tests__/fixtures.d.ts +8 -8
  76. package/dist/tool/__tests__/fixtures.js +2 -2
  77. package/dist/tool/__tests__/tool.test.js +2 -2
  78. package/dist/tool/__tests__/toolkit.test.js +2 -2
  79. package/dist/tool/index.d.ts +3 -3
  80. package/dist/tool/index.js +2 -2
  81. package/dist/tool/tool.d.ts +2 -2
  82. package/dist/tool/tool.js +2 -2
  83. package/dist/tool/toolkit.d.ts +4 -4
  84. package/dist/tool/toolkit.js +1 -1
  85. package/dist/tool/types.d.ts +4 -4
  86. package/dist/trace/traces.js +2 -2
  87. package/dist/types/agent.d.ts +4 -4
  88. package/dist/types/kernl.d.ts +2 -2
  89. package/dist/types/thread.d.ts +5 -5
  90. package/package.json +5 -5
  91. package/src/kernl.ts +0 -25
@@ -1,14 +1,14 @@
1
1
  import { describe, it, expect, beforeEach, afterEach } from "vitest";
2
2
  import path from "path";
3
- import { MCPServerStdio } from "../stdio";
4
- import { MCPToolkit } from "../../tool/toolkit";
5
- import { FunctionToolkit } from "../../tool/toolkit";
6
- import { Agent } from "../../agent";
7
- import { Context } from "../../context";
8
- import { tool } from "../../tool";
3
+ import { MCPServerStdio } from "../stdio.js";
4
+ import { MCPToolkit } from "../../tool/toolkit.js";
5
+ import { FunctionToolkit } from "../../tool/toolkit.js";
6
+ import { Agent } from "../../agent.js";
7
+ import { Context } from "../../context.js";
8
+ import { tool } from "../../tool/index.js";
9
9
  import { z } from "zod";
10
- import { createMCPToolStaticFilter } from "../utils";
11
- import { createMockModel } from "../../thread/__tests__/fixtures/mock-model";
10
+ import { createMCPToolStaticFilter } from "../utils.js";
11
+ import { createMockModel } from "../../thread/__tests__/fixtures/mock-model.js";
12
12
  const TEST_SERVER = path.join(__dirname, "fixtures", "server.ts");
13
13
  // Mock model for tests that only need toolkit functionality
14
14
  const mockModel = createMockModel(async () => ({
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { MCPServerStdio } from "../stdio";
3
- import { withMCPServer, createMCPServer } from "./fixtures/utils";
2
+ import { MCPServerStdio } from "../stdio.js";
3
+ import { withMCPServer, createMCPServer } from "./fixtures/utils.js";
4
4
  import path from "path";
5
5
  const TEST_SERVER = path.join(__dirname, "fixtures", "server.ts");
6
6
  describe("MCPServerStdio", () => {
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect, vi } from "vitest";
2
- import { mcpToFunctionTool, createMCPToolStaticFilter } from "../utils";
3
- import { Context } from "../../context";
2
+ import { mcpToFunctionTool, createMCPToolStaticFilter } from "../utils.js";
3
+ import { Context } from "../../context.js";
4
4
  describe("mcpToFunctionTool", () => {
5
5
  // Create a mock MCP server
6
6
  const createMockServer = () => ({
@@ -1,5 +1,5 @@
1
- import { Logger } from "../lib/logger";
2
- import { MCPTool, MCPToolFilter, CallToolResultContent } from "./types";
1
+ import { Logger } from "../lib/logger.js";
2
+ import { MCPTool, MCPToolFilter, CallToolResultContent } from "./types.js";
3
3
  export declare const DEFAULT_STDIO_MCP_CLIENT_LOGGER_NAME = "kernl:stdio-mcp-client";
4
4
  export declare const DEFAULT_SSE_MCP_CLIENT_LOGGER_NAME = "kernl:sse-mcp-client";
5
5
  export declare const DEFAULT_STREAMABLE_HTTP_MCP_CLIENT_LOGGER_NAME = "kernl:streamable-http-mcp-client";
@@ -1,6 +1,6 @@
1
1
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
- import { BaseMCPServer } from "./base";
3
- import type { MCPTool, CallToolResultContent, MCPServerStreamableHttpOptions, InitializeResult } from "./types";
2
+ import { BaseMCPServer } from "./base.js";
3
+ import type { MCPTool, CallToolResultContent, MCPServerStreamableHttpOptions, InitializeResult } from "./types.js";
4
4
  /**
5
5
  * MCP server client that communicates over streamable HTTP protocol.
6
6
  */
package/dist/mcp/http.js CHANGED
@@ -2,8 +2,8 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
2
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
3
3
  import { DEFAULT_REQUEST_TIMEOUT_MSEC } from "@modelcontextprotocol/sdk/shared/protocol.js";
4
4
  import { ListToolsResultSchema, CallToolResultSchema, } from "@modelcontextprotocol/sdk/types.js";
5
- import { getLogger } from "../lib/logger";
6
- import { BaseMCPServer, DEFAULT_STREAMABLE_HTTP_MCP_CLIENT_LOGGER_NAME, } from "./base";
5
+ import { getLogger } from "../lib/logger.js";
6
+ import { BaseMCPServer, DEFAULT_STREAMABLE_HTTP_MCP_CLIENT_LOGGER_NAME, } from "./base.js";
7
7
  /**
8
8
  * MCP server client that communicates over streamable HTTP protocol.
9
9
  */
package/dist/mcp/sse.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
- import { BaseMCPServer } from "./base";
3
- import type { MCPTool, CallToolResultContent, MCPServerSSEOptions, InitializeResult } from "./types";
2
+ import { BaseMCPServer } from "./base.js";
3
+ import type { MCPTool, CallToolResultContent, MCPServerSSEOptions, InitializeResult } from "./types.js";
4
4
  /**
5
5
  * MCP server client that communicates over Server-Sent Events (SSE).
6
6
  */
package/dist/mcp/sse.js CHANGED
@@ -2,8 +2,8 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
2
  import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
3
3
  import { DEFAULT_REQUEST_TIMEOUT_MSEC } from "@modelcontextprotocol/sdk/shared/protocol.js";
4
4
  import { ListToolsResultSchema, CallToolResultSchema, } from "@modelcontextprotocol/sdk/types.js";
5
- import { getLogger } from "../lib/logger";
6
- import { BaseMCPServer, DEFAULT_SSE_MCP_CLIENT_LOGGER_NAME } from "./base";
5
+ import { getLogger } from "../lib/logger.js";
6
+ import { BaseMCPServer, DEFAULT_SSE_MCP_CLIENT_LOGGER_NAME } from "./base.js";
7
7
  /**
8
8
  * MCP server client that communicates over Server-Sent Events (SSE).
9
9
  */
@@ -1,6 +1,6 @@
1
1
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
- import { BaseMCPServer } from "./base";
3
- import type { MCPTool, CallToolResultContent, MCPServerStdioOptions, InitializeResult } from "./types";
2
+ import { BaseMCPServer } from "./base.js";
3
+ import type { MCPTool, CallToolResultContent, MCPServerStdioOptions, InitializeResult } from "./types.js";
4
4
  /**
5
5
  * MCP server client that communicates over stdio (standard input/output).
6
6
  */
package/dist/mcp/stdio.js CHANGED
@@ -2,8 +2,8 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
2
  import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
3
3
  import { DEFAULT_REQUEST_TIMEOUT_MSEC } from "@modelcontextprotocol/sdk/shared/protocol.js";
4
4
  import { ListToolsResultSchema, CallToolResultSchema, } from "@modelcontextprotocol/sdk/types.js";
5
- import { getLogger } from "../lib/logger";
6
- import { BaseMCPServer, DEFAULT_STDIO_MCP_CLIENT_LOGGER_NAME } from "./base";
5
+ import { getLogger } from "../lib/logger.js";
6
+ import { BaseMCPServer, DEFAULT_STDIO_MCP_CLIENT_LOGGER_NAME } from "./base.js";
7
7
  /**
8
8
  * MCP server client that communicates over stdio (standard input/output).
9
9
  */
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import type { Tool } from "@modelcontextprotocol/sdk/types.js";
3
- import { Agent } from "../agent";
4
- import { Context, UnknownContext } from "../context";
5
- import { Logger } from "../lib/logger";
3
+ import { Agent } from "../agent.js";
4
+ import { Context, UnknownContext } from "../context.js";
5
+ import { Logger } from "../lib/logger.js";
6
6
  /**
7
7
  * MCP tool type from the SDK.
8
8
  * We use the SDK's type directly to avoid compatibility issues.
@@ -1,11 +1,11 @@
1
1
  import { z } from "zod";
2
- import { UnknownContext } from "../context";
3
- import { MCPServer } from "./base";
4
- import type { MCPTool, MCPToolFilter } from "./types";
2
+ import { UnknownContext } from "../context.js";
3
+ import { MCPServer } from "./base.js";
4
+ import type { MCPTool, MCPToolFilter } from "./types.js";
5
5
  /**
6
6
  * Converts an MCP tool definition into a function tool usable by the SDK.
7
7
  */
8
- export declare function mcpToFunctionTool(server: MCPServer, mcpTool: MCPTool): import("../tool").FunctionTool<unknown, z.ZodObject<{}, z.core.$strip>, {
8
+ export declare function mcpToFunctionTool(server: MCPServer, mcpTool: MCPTool): import("../tool/index.js").FunctionTool<unknown, z.ZodObject<{}, z.core.$strip>, {
9
9
  type: string;
10
10
  text: string;
11
11
  } | {
package/dist/mcp/utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { tool } from "../tool";
2
+ import { tool } from "../tool/index.js";
3
3
  /**
4
4
  * Converts an MCP tool definition into a function tool usable by the SDK.
5
5
  */
@@ -1,9 +1,9 @@
1
1
  import { describe, it, expect, beforeEach } from "vitest";
2
2
  import { STOPPED, RUNNING, DEAD, IN_PROGRESS } from "@kernl-sdk/protocol";
3
- import { InMemoryStorage, InMemoryThreadStore } from "../in-memory";
4
- import { Agent } from "../../agent";
5
- import { Thread } from "../../thread";
6
- import { createMockModel } from "../../thread/__tests__/fixtures/mock-model";
3
+ import { InMemoryStorage, InMemoryThreadStore } from "../in-memory.js";
4
+ import { Agent } from "../../agent.js";
5
+ import { Thread } from "../../thread/index.js";
6
+ import { createMockModel } from "../../thread/__tests__/fixtures/mock-model.js";
7
7
  describe("InMemoryThreadStore", () => {
8
8
  let store;
9
9
  let agent;
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Core storage contracts.
3
3
  */
4
- import type { AgentRegistry, ModelRegistry } from "../types/kernl";
5
- import type { ThreadStore } from "./thread";
4
+ import type { AgentRegistry, ModelRegistry } from "../types/kernl.js";
5
+ import type { ThreadStore } from "./thread.js";
6
6
  /**
7
7
  * The main storage interface for Kernl.
8
8
  *
@@ -5,10 +5,10 @@
5
5
  *
6
6
  * Defined here so that it can be used as default and for testing.
7
7
  */
8
- import { Thread } from "../thread";
9
- import type { KernlStorage, Transaction, ThreadStore, NewThread, ThreadUpdate, ThreadInclude, ThreadListOptions, ThreadHistoryOptions } from "../storage";
10
- import type { ThreadEvent } from "../types/thread";
11
- import type { AgentRegistry, ModelRegistry } from "../types/kernl";
8
+ import { Thread } from "../thread/index.js";
9
+ import type { KernlStorage, Transaction, ThreadStore, NewThread, ThreadUpdate, ThreadInclude, ThreadListOptions, ThreadHistoryOptions } from "../storage/index.js";
10
+ import type { ThreadEvent } from "../types/thread.js";
11
+ import type { AgentRegistry, ModelRegistry } from "../types/kernl.js";
12
12
  /**
13
13
  * In-memory storage implementation.
14
14
  */
@@ -5,8 +5,8 @@
5
5
  *
6
6
  * Defined here so that it can be used as default and for testing.
7
7
  */
8
- import { Thread } from "../thread";
9
- import { Context } from "../context";
8
+ import { Thread } from "../thread/index.js";
9
+ import { Context } from "../context.js";
10
10
  import { STOPPED } from "@kernl-sdk/protocol";
11
11
  import { UnimplementedError } from "@kernl-sdk/shared/lib";
12
12
  /**
@@ -4,7 +4,7 @@
4
4
  * Core owns these interfaces; storage packages implement them.
5
5
  * (must be defined here to avoid circular deps)
6
6
  */
7
- export type { NewThread, ThreadUpdate, ThreadFilter, ThreadHistoryOptions, ThreadInclude, SortOrder, ThreadListOptions, ThreadStore, } from "./thread";
8
- export type { Transaction, KernlStorage } from "./base";
9
- export { InMemoryStorage, InMemoryThreadStore } from "./in-memory";
7
+ export type { NewThread, ThreadUpdate, ThreadFilter, ThreadHistoryOptions, ThreadInclude, SortOrder, ThreadListOptions, ThreadStore, } from "./thread.js";
8
+ export type { Transaction, KernlStorage } from "./base.js";
9
+ export { InMemoryStorage, InMemoryThreadStore } from "./in-memory.js";
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,4 @@
4
4
  * Core owns these interfaces; storage packages implement them.
5
5
  * (must be defined here to avoid circular deps)
6
6
  */
7
- export { InMemoryStorage, InMemoryThreadStore } from "./in-memory";
7
+ export { InMemoryStorage, InMemoryThreadStore } from "./in-memory.js";
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Thread storage contracts.
3
3
  */
4
- import type { Thread } from "../thread";
5
- import type { Context } from "../context";
6
- import type { ThreadEvent, ThreadState } from "../types/thread";
4
+ import type { Thread } from "../thread/index.js";
5
+ import type { Context } from "../context.js";
6
+ import type { ThreadEvent, ThreadState } from "../types/thread.js";
7
7
  /**
8
8
  * Thread persistence store.
9
9
  */
package/dist/task.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { Agent } from "./agent";
2
- import type { Context, UnknownContext } from "./context";
3
- import type { Thread } from "./thread";
1
+ import type { Agent } from "./agent.js";
2
+ import type { Context, UnknownContext } from "./context.js";
3
+ import type { Thread } from "./thread/index.js";
4
4
  /**
5
5
  * A Task represents a unit of work scheduled by the kernl.
6
6
  * Analogous to task_struct in the Linux kernel.
@@ -2,10 +2,10 @@ import { describe, it, expect, beforeAll } from "vitest";
2
2
  import { z } from "zod";
3
3
  import { openai } from "@ai-sdk/openai";
4
4
  import { AISDKLanguageModel } from "@kernl-sdk/ai";
5
- import { Agent } from "../../agent";
6
- import { Kernl } from "../../kernl";
7
- import { tool, Toolkit } from "../../tool";
8
- import { Thread } from "../thread";
5
+ import { Agent } from "../../agent.js";
6
+ import { Kernl } from "../../kernl.js";
7
+ import { tool, Toolkit } from "../../tool/index.js";
8
+ import { Thread } from "../thread.js";
9
9
  /**
10
10
  * Integration tests for Thread streaming with real AI SDK providers.
11
11
  *
@@ -1,5 +1,5 @@
1
1
  import { LanguageModel, LanguageModelRequest, LanguageModelResponse } from "@kernl-sdk/protocol";
2
- import type { ThreadStreamEvent } from "../../types/thread";
2
+ import type { ThreadStreamEvent } from "../../types/thread.js";
3
3
  /**
4
4
  * A mock language model that echoes the user input back as an assistant message.
5
5
  * Useful for testing the execution flow without calling a real LLM.
@@ -1,9 +1,9 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { Thread } from "../thread";
3
- import { Agent } from "../../agent";
4
- import { Kernl } from "../../kernl";
5
- import { InMemoryStorage } from "../../storage/in-memory";
6
- import { createMockModel } from "./fixtures/mock-model";
2
+ import { Thread } from "../thread.js";
3
+ import { Agent } from "../../agent.js";
4
+ import { Kernl } from "../../kernl.js";
5
+ import { InMemoryStorage } from "../../storage/in-memory.js";
6
+ import { createMockModel } from "./fixtures/mock-model.js";
7
7
  // Helper to create user message input
8
8
  function userMessage(text) {
9
9
  return [
@@ -1,12 +1,12 @@
1
1
  import { describe, it, expect } from "vitest";
2
2
  import { z } from "zod";
3
3
  import { IN_PROGRESS, COMPLETED, FAILED } from "@kernl-sdk/protocol";
4
- import { Thread } from "../thread";
5
- import { Agent } from "../../agent";
6
- import { Kernl } from "../../kernl";
7
- import { tool, FunctionToolkit } from "../../tool";
8
- import { ModelBehaviorError } from "../../lib/error";
9
- import { createMockModel } from "./fixtures/mock-model";
4
+ import { Thread } from "../thread.js";
5
+ import { Agent } from "../../agent.js";
6
+ import { Kernl } from "../../kernl.js";
7
+ import { tool, FunctionToolkit } from "../../tool/index.js";
8
+ import { ModelBehaviorError } from "../../lib/error.js";
9
+ import { createMockModel } from "./fixtures/mock-model.js";
10
10
  // Helper to create user message input
11
11
  function userMessage(text) {
12
12
  return [
@@ -1,2 +1,2 @@
1
- export { Thread } from "./thread";
1
+ export { Thread } from "./thread.js";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- export { Thread } from "./thread";
1
+ export { Thread } from "./thread.js";
@@ -1,10 +1,10 @@
1
- import { Agent } from "../agent";
2
- import { Context } from "../context";
3
- import type { Task } from "../task";
4
- import type { ResolvedAgentResponse } from "../guardrail";
1
+ import { Agent } from "../agent.js";
2
+ import { Context } from "../context.js";
3
+ import type { Task } from "../task.js";
4
+ import type { ResolvedAgentResponse } from "../guardrail.js";
5
5
  import { LanguageModel } from "@kernl-sdk/protocol";
6
- import type { ThreadEvent, ThreadState, ThreadOptions, ThreadEventInner, ThreadStreamEvent, ThreadExecuteResult } from "../types/thread";
7
- import type { AgentResponseType } from "../types/agent";
6
+ import type { ThreadEvent, ThreadState, ThreadOptions, ThreadEventInner, ThreadStreamEvent, ThreadExecuteResult } from "../types/thread.js";
7
+ import type { AgentResponseType } from "../types/agent.js";
8
8
  /**
9
9
  * A thread drives the execution loop for an agent.
10
10
  *
@@ -1,9 +1,9 @@
1
1
  import assert from "assert";
2
- import { Context } from "../context";
3
- import { logger } from "../lib/logger";
2
+ import { Context } from "../context.js";
3
+ import { logger } from "../lib/logger.js";
4
4
  import { FAILED, RUNNING, STOPPED, message, } from "@kernl-sdk/protocol";
5
5
  import { randomID, filter } from "@kernl-sdk/shared/lib";
6
- import { tevent, notDelta, getIntentions, getFinalResponse, parseFinalResponse, } from "./utils";
6
+ import { tevent, notDelta, getIntentions, getFinalResponse, parseFinalResponse, } from "./utils.js";
7
7
  /**
8
8
  * A thread drives the execution loop for an agent.
9
9
  *
@@ -1,7 +1,7 @@
1
- import type { ResolvedAgentResponse } from "../guardrail";
1
+ import type { ResolvedAgentResponse } from "../guardrail.js";
2
2
  import { ToolCall, LanguageModelItem } from "@kernl-sdk/protocol";
3
- import type { AgentResponseType } from "../types/agent";
4
- import type { ThreadEvent, ThreadStreamEvent, ActionSet, PublicThreadEvent } from "../types/thread";
3
+ import type { AgentResponseType } from "../types/agent.js";
4
+ import type { ThreadEvent, ThreadStreamEvent, ActionSet, PublicThreadEvent } from "../types/thread.js";
5
5
  /**
6
6
  * Create a ThreadEvent from a LanguageModelItem with thread metadata.
7
7
  *
@@ -1,6 +1,6 @@
1
1
  /* lib */
2
2
  import { json, randomID } from "@kernl-sdk/shared/lib";
3
- import { ModelBehaviorError } from "../lib/error";
3
+ import { ModelBehaviorError } from "../lib/error.js";
4
4
  /**
5
5
  * Create a ThreadEvent from a LanguageModelItem with thread metadata.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { Context } from "../../context";
3
- import { HostedTool } from "../tool";
2
+ import { Context } from "../../context.js";
3
+ import { HostedTool } from "../tool.js";
4
4
  /**
5
5
  * Create a minimal mock context for testing
6
6
  */
@@ -8,30 +8,30 @@ export declare const mockContext: <T = any>(data?: T) => Context<T>;
8
8
  /**
9
9
  * Simple string tool with no parameters
10
10
  */
11
- export declare const simpleStringTool: import("..").FunctionTool<unknown, undefined, string>;
11
+ export declare const simpleStringTool: import("../index.js").FunctionTool<unknown, undefined, string>;
12
12
  /**
13
13
  * Tool with Zod schema validation
14
14
  */
15
- export declare const zodTool: import("..").FunctionTool<unknown, z.ZodObject<{
15
+ export declare const zodTool: import("../index.js").FunctionTool<unknown, z.ZodObject<{
16
16
  name: z.ZodString;
17
17
  age: z.ZodNumber;
18
18
  }, z.core.$strip>, string>;
19
19
  /**
20
20
  * Tool that always throws an error
21
21
  */
22
- export declare const errorTool: import("..").FunctionTool<unknown, undefined, never>;
22
+ export declare const errorTool: import("../index.js").FunctionTool<unknown, undefined, never>;
23
23
  /**
24
24
  * Tool with custom error handler
25
25
  */
26
- export declare const customErrorTool: import("..").FunctionTool<unknown, undefined, never>;
26
+ export declare const customErrorTool: import("../index.js").FunctionTool<unknown, undefined, never>;
27
27
  /**
28
28
  * Tool requiring approval (boolean)
29
29
  */
30
- export declare const approvalRequiredTool: import("..").FunctionTool<unknown, undefined, string>;
30
+ export declare const approvalRequiredTool: import("../index.js").FunctionTool<unknown, undefined, string>;
31
31
  /**
32
32
  * Tool with conditional approval (function)
33
33
  */
34
- export declare const conditionalApprovalTool: import("..").FunctionTool<unknown, z.ZodObject<{
34
+ export declare const conditionalApprovalTool: import("../index.js").FunctionTool<unknown, z.ZodObject<{
35
35
  dangerous: z.ZodBoolean;
36
36
  }, z.core.$strip>, string>;
37
37
  /**
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { Context } from "../../context";
3
- import { tool, HostedTool } from "../tool";
2
+ import { Context } from "../../context.js";
3
+ import { tool, HostedTool } from "../tool.js";
4
4
  /**
5
5
  * Create a minimal mock context for testing
6
6
  */
@@ -1,7 +1,7 @@
1
1
  import { describe, it, expect } from "vitest";
2
2
  import { COMPLETED, FAILED } from "@kernl-sdk/protocol";
3
- import { tool } from "../tool";
4
- import { mockContext, simpleStringTool, zodTool, errorTool, customErrorTool, approvalRequiredTool, conditionalApprovalTool, } from "./fixtures";
3
+ import { tool } from "../tool.js";
4
+ import { mockContext, simpleStringTool, zodTool, errorTool, customErrorTool, approvalRequiredTool, conditionalApprovalTool, } from "./fixtures.js";
5
5
  describe("FunctionTool", () => {
6
6
  describe("creation", () => {
7
7
  it("should create tool with required config", () => {
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { FunctionToolkit } from "../toolkit";
3
- import { simpleStringTool, zodTool, errorTool, mockHostedTool, anotherHostedTool, } from "./fixtures";
2
+ import { FunctionToolkit } from "../toolkit.js";
3
+ import { simpleStringTool, zodTool, errorTool, mockHostedTool, anotherHostedTool, } from "./fixtures.js";
4
4
  describe("FunctionToolkit", () => {
5
5
  describe("constructor", () => {
6
6
  it("should create empty toolkit with no tools", async () => {
@@ -1,4 +1,4 @@
1
- export { BaseTool, FunctionTool, HostedTool, tool } from "./tool";
2
- export { BaseToolkit, Toolkit, FunctionToolkit, MCPToolkit } from "./toolkit";
3
- export type { Tool, ToolResult, FunctionToolkitConfig, MCPToolkitConfig, ToolkitFilter, ToolkitFilterContext, } from "./types";
1
+ export { BaseTool, FunctionTool, HostedTool, tool } from "./tool.js";
2
+ export { BaseToolkit, Toolkit, FunctionToolkit, MCPToolkit } from "./toolkit.js";
3
+ export type { Tool, ToolResult, FunctionToolkitConfig, MCPToolkitConfig, ToolkitFilter, ToolkitFilterContext, } from "./types.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export { BaseTool, FunctionTool, HostedTool, tool } from "./tool";
2
- export { BaseToolkit, Toolkit, FunctionToolkit, MCPToolkit } from "./toolkit";
1
+ export { BaseTool, FunctionTool, HostedTool, tool } from "./tool.js";
2
+ export { BaseToolkit, Toolkit, FunctionToolkit, MCPToolkit } from "./toolkit.js";
@@ -1,6 +1,6 @@
1
- import { Context, UnknownContext } from "../context";
1
+ import { Context, UnknownContext } from "../context.js";
2
2
  import type { LanguageModelTool } from "@kernl-sdk/protocol";
3
- import type { ToolConfig, ToolApprovalFunction, ToolEnabledFunction, ToolErrorFunction, ToolInputParameters, ToolResult } from "./types";
3
+ import type { ToolConfig, ToolApprovalFunction, ToolEnabledFunction, ToolErrorFunction, ToolInputParameters, ToolResult } from "./types.js";
4
4
  /**
5
5
  * Exposes a function to the agent as a tool to be called
6
6
  *
package/dist/tool/tool.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { ModelBehaviorError } from "../lib/error";
3
- import { logger } from "../lib/logger";
2
+ import { ModelBehaviorError } from "../lib/error.js";
3
+ import { logger } from "../lib/logger.js";
4
4
  import { json } from "@kernl-sdk/shared/lib";
5
5
  import { FAILED, COMPLETED, INTERRUPTIBLE } from "@kernl-sdk/protocol";
6
6
  /**
@@ -1,7 +1,7 @@
1
- import type { Agent } from "../agent";
2
- import type { Context, UnknownContext } from "../context";
3
- import type { Tool } from ".";
4
- import type { FunctionToolkitConfig, MCPToolkitConfig } from "./types";
1
+ import type { Agent } from "../agent.js";
2
+ import type { Context, UnknownContext } from "../context.js";
3
+ import type { Tool } from "./index.js";
4
+ import type { FunctionToolkitConfig, MCPToolkitConfig } from "./types.js";
5
5
  /**
6
6
  * A toolkit is a collection of related tools that can be used by an agent.
7
7
  *
@@ -1,4 +1,4 @@
1
- import { mcpToFunctionTool } from "../mcp/utils";
1
+ import { mcpToFunctionTool } from "../mcp/utils.js";
2
2
  import { filter } from "@kernl-sdk/shared/lib";
3
3
  /**
4
4
  * A toolkit is a collection of related tools that can be used by an agent.
@@ -1,9 +1,9 @@
1
1
  import { z, type ZodType } from "zod";
2
- import { Agent } from "../agent";
3
- import { Context, UnknownContext } from "../context";
4
- import { MCPServer } from "../mcp/base";
2
+ import { Agent } from "../agent.js";
3
+ import { Context, UnknownContext } from "../context.js";
4
+ import { MCPServer } from "../mcp/base.js";
5
5
  import type { ToolCallState } from "@kernl-sdk/protocol";
6
- import type { FunctionTool, HostedTool } from "./tool";
6
+ import type { FunctionTool, HostedTool } from "./tool.js";
7
7
  /**
8
8
  * A tool that can be called by the model.
9
9
  * @template TContext The context passed to the tool
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- // import { defaultProcessor, TracingProcessor } from "./processor";
3
- // import { generateTraceId } from "./utils";
2
+ // import { defaultProcessor, TracingProcessor } from "./processor.js";
3
+ // import { generateTraceId } from "./utils.js";
4
4
  // export type TraceOptions = {
5
5
  // traceId?: string;
6
6
  // name?: string;
@@ -1,9 +1,9 @@
1
1
  import { type ZodType } from "zod";
2
- import { Context, UnknownContext } from "../context";
2
+ import { Context, UnknownContext } from "../context.js";
3
3
  import { LanguageModel, LanguageModelRequestSettings } from "@kernl-sdk/protocol";
4
- import { InputGuardrail, OutputGuardrail } from "../guardrail";
5
- import { BaseToolkit } from "../tool";
6
- import { TextResponse } from "./thread";
4
+ import { InputGuardrail, OutputGuardrail } from "../guardrail.js";
5
+ import { BaseToolkit } from "../tool/index.js";
6
+ import { TextResponse } from "./thread.js";
7
7
  /**
8
8
  * Configuration for an agent.
9
9
  */
@@ -1,6 +1,6 @@
1
1
  import { LanguageModel } from "@kernl-sdk/protocol";
2
- import { Agent } from "../agent";
3
- import { KernlStorage } from "../storage";
2
+ import { Agent } from "../agent.js";
3
+ import { KernlStorage } from "../storage/index.js";
4
4
  /**
5
5
  * Storage configuration for Kernl.
6
6
  */
@@ -1,9 +1,9 @@
1
1
  import { ToolCall, LanguageModel, LanguageModelItem, LanguageModelStreamEvent, RUNNING, STOPPED, INTERRUPTIBLE, UNINTERRUPTIBLE, ZOMBIE, DEAD } from "@kernl-sdk/protocol";
2
- import { Task } from "../task";
3
- import { Context } from "../context";
4
- import { Agent } from "../agent";
5
- import type { AgentResponseType } from "./agent";
6
- import type { ThreadStore } from "../storage";
2
+ import { Task } from "../task.js";
3
+ import { Context } from "../context.js";
4
+ import { Agent } from "../agent.js";
5
+ import type { AgentResponseType } from "./agent.js";
6
+ import type { ThreadStore } from "../storage/index.js";
7
7
  /**
8
8
  * Public/client-facing thread events (excludes internal system events).
9
9
  */