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,4 +1,4 @@
1
1
 
2
- > kernl@0.5.1 build /Users/andjones/Documents/projects/kernl/packages/kernl
3
- > tsc && tsc-alias
2
+ > kernl@0.6.1 build /Users/andjones/Documents/projects/kernl/packages/kernl
3
+ > tsc && tsc-alias --resolve-full-paths
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @kernl/core
2
2
 
3
+ ## 0.6.2
4
+
5
+ ### Patch Changes
6
+
7
+ - c5a5fcf: Storage now auto-initializes on first operation - no need to call init() manually
8
+
9
+ ## 0.6.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Fix ESM compatibility by adding --resolve-full-paths to tsc-alias build
14
+ - Updated dependencies
15
+ - @kernl-sdk/shared@0.1.6
16
+ - @kernl-sdk/protocol@0.2.5
17
+
3
18
  ## 0.6.0
4
19
 
5
20
  ### Minor Changes
@@ -1,8 +1,8 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { Agent } from "../../agent";
3
- import { Kernl } from "../../kernl";
4
- import { createMockModel } from "../../thread/__tests__/fixtures/mock-model";
5
- import { RuntimeError } from "../../lib/error";
2
+ import { Agent } from "../../agent.js";
3
+ import { Kernl } from "../../kernl.js";
4
+ import { createMockModel } from "../../thread/__tests__/fixtures/mock-model.js";
5
+ import { RuntimeError } from "../../lib/error.js";
6
6
  import { message } from "@kernl-sdk/protocol";
7
7
  describe("Concurrent execution prevention", () => {
8
8
  // (TODO): this should work
@@ -1,10 +1,10 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { Agent } from "../../agent";
3
- import { Kernl } from "../../kernl";
4
- import { createMockModel } from "../../thread/__tests__/fixtures/mock-model";
5
- import { MisconfiguredError } from "../../lib/error";
2
+ import { Agent } from "../../agent.js";
3
+ import { Kernl } from "../../kernl.js";
4
+ import { createMockModel } from "../../thread/__tests__/fixtures/mock-model.js";
5
+ import { MisconfiguredError } from "../../lib/error.js";
6
6
  import { message } from "@kernl-sdk/protocol";
7
- import { InMemoryStorage } from "../../storage/in-memory";
7
+ import { InMemoryStorage } from "../../storage/in-memory.js";
8
8
  describe("Agent.run() lifecycle", () => {
9
9
  describe("Storage wiring", () => {
10
10
  it("should pass storage to new Thread when creating", async () => {
package/dist/agent.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { LanguageModel, LanguageModelItem, LanguageModelRequestSettings } from "@kernl-sdk/protocol";
2
- import type { Kernl } from "./kernl";
3
- import type { RThreadsListParams, RThreadCreateParams, RThreadGetOptions, RThreadHistoryParams, RThreadUpdateParams } from "./api/resources/threads/types";
4
- import type { Context, UnknownContext } from "./context";
5
- import { Tool } from "./tool";
6
- import { BaseToolkit } from "./tool/toolkit";
7
- import { InputGuardrail, OutputGuardrail, type ResolvedAgentResponse } from "./guardrail";
8
- import { AgentHooks } from "./lifecycle";
9
- import type { AgentConfig, AgentResponseType } from "./types/agent";
10
- import type { TextResponse, ThreadExecuteOptions, ThreadExecuteResult, ThreadStreamEvent } from "./types/thread";
2
+ import type { Kernl } from "./kernl.js";
3
+ import type { RThreadsListParams, RThreadCreateParams, RThreadGetOptions, RThreadHistoryParams, RThreadUpdateParams } from "./api/resources/threads/types.js";
4
+ import type { Context, UnknownContext } from "./context.js";
5
+ import { Tool } from "./tool/index.js";
6
+ import { BaseToolkit } from "./tool/toolkit.js";
7
+ import { InputGuardrail, OutputGuardrail, type ResolvedAgentResponse } from "./guardrail.js";
8
+ import { AgentHooks } from "./lifecycle.js";
9
+ import type { AgentConfig, AgentResponseType } from "./types/agent.js";
10
+ import type { TextResponse, ThreadExecuteOptions, ThreadExecuteResult, ThreadStreamEvent } from "./types/thread.js";
11
11
  export declare class Agent<TContext = UnknownContext, TResponse extends AgentResponseType = TextResponse> extends AgentHooks<TContext, TResponse> implements AgentConfig<TContext, TResponse> {
12
12
  private kernl?;
13
13
  id: string;
@@ -72,12 +72,12 @@ export declare class Agent<TContext = UnknownContext, TResponse extends AgentRes
72
72
  * Convenience wrapper around kernl.threads that automatically filters to this agent's threads.
73
73
  */
74
74
  get threads(): {
75
- get: (tid: string, options?: RThreadGetOptions) => Promise<import(".").Thread | null>;
76
- list: (params?: Omit<RThreadsListParams, "agentId">) => Promise<import("./api/pagination/cursor").CursorPage<import(".").Thread, RThreadsListParams>>;
75
+ get: (tid: string, options?: RThreadGetOptions) => Promise<import("./index.js").Thread | null>;
76
+ list: (params?: Omit<RThreadsListParams, "agentId">) => Promise<import("./api/pagination/cursor.js").CursorPage<import("./index.js").Thread, RThreadsListParams>>;
77
77
  delete: (tid: string) => Promise<void>;
78
- history: (tid: string, params?: RThreadHistoryParams) => Promise<import(".").ThreadEvent[]>;
79
- create: (params: Omit<RThreadCreateParams, "agentId" | "model">) => Promise<import(".").Thread>;
80
- update: (tid: string, patch: RThreadUpdateParams) => Promise<import(".").Thread | null>;
78
+ history: (tid: string, params?: RThreadHistoryParams) => Promise<import("./index.js").ThreadEvent[]>;
79
+ create: (params: Omit<RThreadCreateParams, "agentId" | "model">) => Promise<import("./index.js").Thread>;
80
+ update: (tid: string, patch: RThreadUpdateParams) => Promise<import("./index.js").Thread | null>;
81
81
  };
82
82
  }
83
83
  //# sourceMappingURL=agent.d.ts.map
package/dist/agent.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { message, } from "@kernl-sdk/protocol";
2
- import { Thread } from "./thread";
3
- import { AgentHooks } from "./lifecycle";
4
- import { MisconfiguredError, RuntimeError } from "./lib/error";
2
+ import { Thread } from "./thread/index.js";
3
+ import { AgentHooks } from "./lifecycle.js";
4
+ import { MisconfiguredError, RuntimeError } from "./lib/error.js";
5
5
  export class Agent extends AgentHooks {
6
6
  kernl;
7
7
  id;
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect, vi } from "vitest";
2
- import { CursorPage, } from "../pagination/cursor";
2
+ import { CursorPage, } from "../pagination/cursor.js";
3
3
  describe("CursorPage", () => {
4
4
  describe("construction", () => {
5
5
  it("should initialize with response data", () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect, vi } from "vitest";
2
- import { OffsetPage, } from "../pagination/offset";
2
+ import { OffsetPage, } from "../pagination/offset.js";
3
3
  describe("OffsetPage", () => {
4
4
  describe("construction", () => {
5
5
  it("should initialize with response data", () => {
@@ -1,9 +1,9 @@
1
1
  import { describe, it, expect, beforeEach } from "vitest";
2
2
  import { message, RUNNING } from "@kernl-sdk/protocol";
3
- import { Agent } from "../../agent";
4
- import { InMemoryThreadStore } from "../../storage/in-memory";
5
- import { tevent } from "../../thread/utils";
6
- import { RThreads } from "../../api/resources/threads";
3
+ import { Agent } from "../../agent.js";
4
+ import { InMemoryThreadStore } from "../../storage/in-memory.js";
5
+ import { tevent } from "../../thread/utils.js";
6
+ import { RThreads } from "../../api/resources/threads/index.js";
7
7
  function createTestStore() {
8
8
  const store = new InMemoryThreadStore();
9
9
  const agents = new Map();
@@ -1,2 +1,2 @@
1
- export type { MThread, MThreadModelInfo, MThreadEvent, MThreadEventBase, } from "./thread";
1
+ export type { MThread, MThreadModelInfo, MThreadEvent, MThreadEventBase, } from "./thread.js";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { LanguageModelItem } from "@kernl-sdk/protocol";
2
- import type { ThreadState } from "../../types/thread";
2
+ import type { ThreadState } from "../../types/thread.js";
3
3
  /**
4
4
  * Model metadata for the language model used by a thread.
5
5
  *
@@ -1,4 +1,4 @@
1
- import { AbstractPage, type PageParamsBase } from "./base";
1
+ import { AbstractPage, type PageParamsBase } from "./base.js";
2
2
  export interface CursorPageParams extends PageParamsBase {
3
3
  /**
4
4
  * Pagination cursor returned from a previous page.
@@ -1,4 +1,4 @@
1
- import { AbstractPage } from "./base";
1
+ import { AbstractPage } from "./base.js";
2
2
  export class CursorPage extends AbstractPage {
3
3
  data;
4
4
  _next;
@@ -1,4 +1,4 @@
1
- import { AbstractPage, type PageParamsBase } from "./base";
1
+ import { AbstractPage, type PageParamsBase } from "./base.js";
2
2
  export interface OffsetPageParams extends PageParamsBase {
3
3
  /**
4
4
  * Number of items to skip from the beginning of the collection.
@@ -1,4 +1,4 @@
1
- import { AbstractPage } from "./base";
1
+ import { AbstractPage } from "./base.js";
2
2
  export class OffsetPage extends AbstractPage {
3
3
  data;
4
4
  offset;
@@ -1,5 +1,5 @@
1
- import type { ThreadStore } from "../../../storage";
2
- import type { MThreadEvent } from "../../../api/models";
1
+ import type { ThreadStore } from "../../../storage/index.js";
2
+ import type { MThreadEvent } from "../../../api/models/index.js";
3
3
  /**
4
4
  * Events subresource for threads.
5
5
  *
@@ -1,4 +1,4 @@
1
- import { isPublicEvent } from "../../../thread/utils";
1
+ import { isPublicEvent } from "../../../thread/utils.js";
2
2
  /**
3
3
  * Events subresource for threads.
4
4
  *
@@ -1,4 +1,4 @@
1
- export { RThreads } from "./threads";
2
- export { RThreadEvents } from "./events";
3
- export type { RThreadsListParams, RThreadGetOptions, RThreadHistoryParams, RThreadCreateParams, RThreadUpdateParams, } from "./types";
1
+ export { RThreads } from "./threads.js";
2
+ export { RThreadEvents } from "./events.js";
3
+ export type { RThreadsListParams, RThreadGetOptions, RThreadHistoryParams, RThreadCreateParams, RThreadUpdateParams, } from "./types.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export { RThreads } from "./threads";
2
- export { RThreadEvents } from "./events";
1
+ export { RThreads } from "./threads.js";
2
+ export { RThreadEvents } from "./events.js";
@@ -1,8 +1,8 @@
1
- import type { ThreadStore } from "../../../storage";
2
- import type { MThread, MThreadEvent } from "../../../api/models";
3
- import { CursorPage } from "../../../api/pagination/cursor";
4
- import { RThreadEvents } from "./events";
5
- import type { RThreadCreateParams, RThreadGetOptions, RThreadHistoryParams, RThreadsListParams, RThreadUpdateParams } from "./types";
1
+ import type { ThreadStore } from "../../../storage/index.js";
2
+ import type { MThread, MThreadEvent } from "../../../api/models/index.js";
3
+ import { CursorPage } from "../../../api/pagination/cursor.js";
4
+ import { RThreadEvents } from "./events.js";
5
+ import type { RThreadCreateParams, RThreadGetOptions, RThreadHistoryParams, RThreadsListParams, RThreadUpdateParams } from "./types.js";
6
6
  /**
7
7
  * Threads resource.
8
8
  *
@@ -1,10 +1,10 @@
1
- import { isPublicEvent } from "../../../thread/utils";
2
- import { Context } from "../../../context";
1
+ import { isPublicEvent } from "../../../thread/utils.js";
2
+ import { Context } from "../../../context.js";
3
3
  import { randomID } from "@kernl-sdk/shared/lib";
4
4
  import { RUNNING } from "@kernl-sdk/protocol";
5
- import { CursorPage } from "../../../api/pagination/cursor";
6
- import { RThreadEvents } from "./events";
7
- import { MThreadCodec, ThreadsFilterCodec, ThreadsOrderCodec } from "./utils";
5
+ import { CursorPage } from "../../../api/pagination/cursor.js";
6
+ import { RThreadEvents } from "./events.js";
7
+ import { MThreadCodec, ThreadsFilterCodec, ThreadsOrderCodec } from "./utils.js";
8
8
  /**
9
9
  * Threads resource.
10
10
  *
@@ -1,6 +1,6 @@
1
- import type { ThreadState } from "../../../types/thread";
2
- import type { SortOrder } from "../../../storage";
3
- import type { CursorPageParams } from "../../../api/pagination/cursor";
1
+ import type { ThreadState } from "../../../types/thread.js";
2
+ import type { SortOrder } from "../../../storage/index.js";
3
+ import type { CursorPageParams } from "../../../api/pagination/cursor.js";
4
4
  export interface RThreadHistoryParams {
5
5
  /**
6
6
  * Only return events with seq greater than this value.
@@ -1,8 +1,8 @@
1
1
  import { type Codec } from "@kernl-sdk/shared/lib";
2
- import type { Thread } from "../../../thread";
3
- import type { ThreadFilter, ThreadListOptions } from "../../../storage";
4
- import type { MThread } from "../../../api/models";
5
- import type { RThreadsListParams } from "./types";
2
+ import type { Thread } from "../../../thread/index.js";
3
+ import type { ThreadFilter, ThreadListOptions } from "../../../storage/index.js";
4
+ import type { MThread } from "../../../api/models/index.js";
5
+ import type { RThreadsListParams } from "./types.js";
6
6
  /**
7
7
  * Converts an internal `Thread` runtime instance into an `MThread` model.
8
8
  */
@@ -1,9 +1,9 @@
1
1
  import { z, type ZodType } from "zod";
2
2
  import { LanguageModelResponse } from "@kernl-sdk/protocol";
3
- import { Agent } from "./agent";
4
- import { Context, UnknownContext } from "./context";
5
- import type { AgentResponseType } from "./types/agent";
6
- import type { TextResponse, ThreadEvent } from "./types/thread";
3
+ import { Agent } from "./agent.js";
4
+ import { Context, UnknownContext } from "./context.js";
5
+ import type { AgentResponseType } from "./types/agent.js";
6
+ import type { TextResponse, ThreadEvent } from "./types/thread.js";
7
7
  /**
8
8
  * Resolves the agent output type based on the response type.
9
9
  * - If TResponse is "text" → output is string
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- export { Kernl } from "./kernl";
2
- export type { KernlOptions, StorageOptions, AgentRegistry, ModelRegistry, } from "./types/kernl";
3
- export { Agent } from "./agent";
4
- export { Context } from "./context";
5
- export { tool, Toolkit, FunctionToolkit, MCPToolkit } from "./tool";
6
- export { MCPServerSSE } from "./mcp/sse";
7
- export { MCPServerStdio } from "./mcp/stdio";
8
- export { MCPServerStreamableHttp } from "./mcp/http";
9
- export type { MThread as Thread, MThreadEvent as ThreadEvent, MThreadEventBase as ThreadEventBase, } from "./api/models";
10
- export type { RThreadsListParams as ThreadsListParams, RThreadGetOptions as ThreadGetOptions, RThreadHistoryParams as ThreadHistoryParams, RThreadCreateParams as ThreadCreateParams, RThreadUpdateParams as ThreadUpdateParams, } from "./api/resources/threads";
11
- export { THREAD_STATES, type ThreadState, type PublicThreadEvent, } from "./types/thread";
12
- export type { ThreadStore, NewThread, ThreadUpdate, ThreadFilter, ThreadHistoryOptions, ThreadInclude, ThreadListOptions, SortOrder, KernlStorage, Transaction, } from "./storage";
1
+ export { Kernl } from "./kernl.js";
2
+ export type { KernlOptions, StorageOptions, AgentRegistry, ModelRegistry, } from "./types/kernl.js";
3
+ export { Agent } from "./agent.js";
4
+ export { Context } from "./context.js";
5
+ export { tool, Toolkit, FunctionToolkit, MCPToolkit } from "./tool/index.js";
6
+ export { MCPServerSSE } from "./mcp/sse.js";
7
+ export { MCPServerStdio } from "./mcp/stdio.js";
8
+ export { MCPServerStreamableHttp } from "./mcp/http.js";
9
+ export type { MThread as Thread, MThreadEvent as ThreadEvent, MThreadEventBase as ThreadEventBase, } from "./api/models/index.js";
10
+ export type { RThreadsListParams as ThreadsListParams, RThreadGetOptions as ThreadGetOptions, RThreadHistoryParams as ThreadHistoryParams, RThreadCreateParams as ThreadCreateParams, RThreadUpdateParams as ThreadUpdateParams, } from "./api/resources/threads/index.js";
11
+ export { THREAD_STATES, type ThreadState, type PublicThreadEvent, } from "./types/thread.js";
12
+ export type { ThreadStore, NewThread, ThreadUpdate, ThreadFilter, ThreadHistoryOptions, ThreadInclude, ThreadListOptions, SortOrder, KernlStorage, Transaction, } from "./storage/index.js";
13
13
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- export { Kernl } from "./kernl";
2
- export { Agent } from "./agent";
3
- export { Context } from "./context";
1
+ export { Kernl } from "./kernl.js";
2
+ export { Agent } from "./agent.js";
3
+ export { Context } from "./context.js";
4
4
  // --- tools --
5
- export { tool, Toolkit, FunctionToolkit, MCPToolkit } from "./tool";
6
- export { MCPServerSSE } from "./mcp/sse";
7
- export { MCPServerStdio } from "./mcp/stdio";
8
- export { MCPServerStreamableHttp } from "./mcp/http";
5
+ export { tool, Toolkit, FunctionToolkit, MCPToolkit } from "./tool/index.js";
6
+ export { MCPServerSSE } from "./mcp/sse.js";
7
+ export { MCPServerStdio } from "./mcp/stdio.js";
8
+ export { MCPServerStreamableHttp } from "./mcp/http.js";
9
9
  // --- thread state enums ---
10
- export { THREAD_STATES, } from "./types/thread";
10
+ export { THREAD_STATES, } from "./types/thread.js";
@@ -1,4 +1,4 @@
1
- export { Thread } from "./thread/thread";
2
- export type { IThread, ThreadEvent, ThreadEventBase, ThreadEventInner, ThreadSystemEvent, ThreadState, PublicThreadEvent, } from "./types/thread";
3
- export { THREAD_STATES } from "./types/thread";
1
+ export { Thread } from "./thread/thread.js";
2
+ export type { IThread, ThreadEvent, ThreadEventBase, ThreadEventInner, ThreadSystemEvent, ThreadState, PublicThreadEvent, } from "./types/thread.js";
3
+ export { THREAD_STATES } from "./types/thread.js";
4
4
  //# sourceMappingURL=internal.d.ts.map
package/dist/internal.js CHANGED
@@ -1,2 +1,2 @@
1
- export { Thread } from "./thread/thread";
2
- export { THREAD_STATES } from "./types/thread";
1
+ export { Thread } from "./thread/thread.js";
2
+ export { THREAD_STATES } from "./types/thread.js";
@@ -1,3 +1,3 @@
1
- export { Kernl } from "./kernl";
2
- export { ThreadsResource, type ThreadsListParams, type ThreadGetOptions } from "./threads";
1
+ export { Kernl } from "./kernl.js";
2
+ export { ThreadsResource, type ThreadsListParams, type ThreadGetOptions } from "./threads.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export { Kernl } from "./kernl";
2
- export { ThreadsResource } from "./threads";
1
+ export { Kernl } from "./kernl.js";
2
+ export { ThreadsResource } from "./threads.js";
@@ -1,13 +1,13 @@
1
- import { Agent } from "../agent";
2
- import { UnknownContext } from "../context";
3
- import { KernlHooks } from "../lifecycle";
4
- import type { Thread } from "../thread";
5
- import type { ResolvedAgentResponse } from "../guardrail";
6
- import { type KernlStorage } from "../storage";
7
- import type { KernlOptions } from "../types/kernl";
8
- import type { ThreadExecuteResult, ThreadStreamEvent } from "../types/thread";
9
- import type { AgentResponseType } from "../types/agent";
10
- import { ThreadsResource } from "./threads";
1
+ import { Agent } from "../agent.js";
2
+ import { UnknownContext } from "../context.js";
3
+ import { KernlHooks } from "../lifecycle.js";
4
+ import type { Thread } from "../thread/index.js";
5
+ import type { ResolvedAgentResponse } from "../guardrail.js";
6
+ import { type KernlStorage } from "../storage/index.js";
7
+ import type { KernlOptions } from "../types/kernl.js";
8
+ import type { ThreadExecuteResult, ThreadStreamEvent } from "../types/thread.js";
9
+ import type { AgentResponseType } from "../types/agent.js";
10
+ import { ThreadsResource } from "./threads.js";
11
11
  /**
12
12
  * The kernl - manages agent processes, scheduling, and task lifecycle.
13
13
  *
@@ -1,6 +1,6 @@
1
- import { KernlHooks } from "../lifecycle";
2
- import { InMemoryStorage } from "../storage";
3
- import { ThreadsResource } from "./threads";
1
+ import { KernlHooks } from "../lifecycle.js";
2
+ import { InMemoryStorage } from "../storage/index.js";
3
+ import { ThreadsResource } from "./threads.js";
4
4
  /**
5
5
  * The kernl - manages agent processes, scheduling, and task lifecycle.
6
6
  *
@@ -1,5 +1,5 @@
1
- import type { ThreadStore } from "../storage";
2
- import type { ThreadResource, PublicThreadEvent } from "../types/thread";
1
+ import type { ThreadStore } from "../storage/index.js";
2
+ import type { ThreadResource, PublicThreadEvent } from "../types/thread.js";
3
3
  /**
4
4
  * Threads resource - provides a clean API for managing threads.
5
5
  *
@@ -1,4 +1,4 @@
1
- import { isPublicEvent } from "../thread/utils";
1
+ import { isPublicEvent } from "../thread/utils.js";
2
2
  /**
3
3
  * Threads resource - provides a clean API for managing threads.
4
4
  *
package/dist/kernl.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { Agent } from "./agent";
2
- import { UnknownContext } from "./context";
3
- import { KernlHooks } from "./lifecycle";
4
- import type { Thread } from "./thread";
5
- import type { ResolvedAgentResponse } from "./guardrail";
6
- import { type KernlStorage } from "./storage";
7
- import { RThreads } from "./api/resources/threads";
8
- import type { KernlOptions } from "./types/kernl";
9
- import type { ThreadExecuteResult, ThreadStreamEvent } from "./types/thread";
10
- import type { AgentResponseType } from "./types/agent";
1
+ import { Agent } from "./agent.js";
2
+ import { UnknownContext } from "./context.js";
3
+ import { KernlHooks } from "./lifecycle.js";
4
+ import type { Thread } from "./thread/index.js";
5
+ import type { ResolvedAgentResponse } from "./guardrail.js";
6
+ import { type KernlStorage } from "./storage/index.js";
7
+ import { RThreads } from "./api/resources/threads/index.js";
8
+ import type { KernlOptions } from "./types/kernl.js";
9
+ import type { ThreadExecuteResult, ThreadStreamEvent } from "./types/thread.js";
10
+ import type { AgentResponseType } from "./types/agent.js";
11
11
  /**
12
12
  * The kernl - manages agent processes, scheduling, and task lifecycle.
13
13
  *
@@ -19,7 +19,6 @@ export declare class Kernl extends KernlHooks<UnknownContext, AgentResponseType>
19
19
  private models;
20
20
  readonly storage: KernlStorage;
21
21
  athreads: Map<string, Thread<any, any>>;
22
- private initPromise;
23
22
  readonly threads: RThreads;
24
23
  constructor(options?: KernlOptions);
25
24
  /**
@@ -48,13 +47,5 @@ export declare class Kernl extends KernlHooks<UnknownContext, AgentResponseType>
48
47
  * Schedule an existing thread - streaming execution
49
48
  */
50
49
  scheduleStream<TContext, TResponse extends AgentResponseType>(thread: Thread<TContext, TResponse>): AsyncIterable<ThreadStreamEvent>;
51
- /**
52
- * Ensure the underlying storage backend has been initialized.
53
- *
54
- * This is called lazily on first use so that callers do not need to worry
55
- * about calling storage.init() themselves. Safe and idempotent to call
56
- * multiple times; concurrent calls share the same initialization promise.
57
- */
58
- private ensureInitialized;
59
50
  }
60
51
  //# sourceMappingURL=kernl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"kernl.d.ts","sourceRoot":"","sources":["../src/kernl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,C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B;IAOtC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAa5B;;OAEG;IACG,KAAK,CAAC,QAAQ,EAAE,SAAS,SAAS,iBAAiB,EACvD,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAClC,OAAO,CAAC,mBAAmB,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC;IASjE;;;;OAIG;IACG,QAAQ,CAAC,QAAQ,EAAE,SAAS,SAAS,iBAAiB,EAC1D,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAClC,OAAO,CAAC,mBAAmB,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC;IASjE;;;;OAIG;IACI,WAAW,CAAC,QAAQ,EAAE,SAAS,SAAS,iBAAiB,EAC9D,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAClC,aAAa,CAAC,iBAAiB,CAAC;IASnC;;;;OAIG;IACI,cAAc,CAAC,QAAQ,EAAE,SAAS,SAAS,iBAAiB,EACjE,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAClC,aAAa,CAAC,iBAAiB,CAAC;CAQpC"}
package/dist/kernl.js CHANGED
@@ -1,6 +1,6 @@
1
- import { KernlHooks } from "./lifecycle";
2
- import { InMemoryStorage } from "./storage";
3
- import { RThreads } from "./api/resources/threads";
1
+ import { KernlHooks } from "./lifecycle.js";
2
+ import { InMemoryStorage } from "./storage/index.js";
3
+ import { RThreads } from "./api/resources/threads/index.js";
4
4
  /**
5
5
  * The kernl - manages agent processes, scheduling, and task lifecycle.
6
6
  *
@@ -12,7 +12,6 @@ export class Kernl extends KernlHooks {
12
12
  models = new Map();
13
13
  storage;
14
14
  athreads = new Map(); /* active threads */
15
- initPromise = null;
16
15
  // --- public API ---
17
16
  threads; /* Threads resource */
18
17
  constructor(options = {}) {
@@ -39,7 +38,6 @@ export class Kernl extends KernlHooks {
39
38
  * Spawn a new thread - blocking execution
40
39
  */
41
40
  async spawn(thread) {
42
- await this.ensureInitialized();
43
41
  this.athreads.set(thread.tid, thread);
44
42
  try {
45
43
  return await thread.execute();
@@ -54,7 +52,6 @@ export class Kernl extends KernlHooks {
54
52
  * NOTE: just blocks for now
55
53
  */
56
54
  async schedule(thread) {
57
- await this.ensureInitialized();
58
55
  this.athreads.set(thread.tid, thread);
59
56
  try {
60
57
  return await thread.execute();
@@ -69,7 +66,6 @@ export class Kernl extends KernlHooks {
69
66
  * Spawn a new thread - streaming execution
70
67
  */
71
68
  async *spawnStream(thread) {
72
- await this.ensureInitialized();
73
69
  this.athreads.set(thread.tid, thread);
74
70
  try {
75
71
  yield* thread.stream();
@@ -84,7 +80,6 @@ export class Kernl extends KernlHooks {
84
80
  * Schedule an existing thread - streaming execution
85
81
  */
86
82
  async *scheduleStream(thread) {
87
- await this.ensureInitialized();
88
83
  this.athreads.set(thread.tid, thread);
89
84
  try {
90
85
  yield* thread.stream();
@@ -93,21 +88,4 @@ export class Kernl extends KernlHooks {
93
88
  this.athreads.delete(thread.tid);
94
89
  }
95
90
  }
96
- /**
97
- * Ensure the underlying storage backend has been initialized.
98
- *
99
- * This is called lazily on first use so that callers do not need to worry
100
- * about calling storage.init() themselves. Safe and idempotent to call
101
- * multiple times; concurrent calls share the same initialization promise.
102
- */
103
- async ensureInitialized() {
104
- if (!this.initPromise) {
105
- this.initPromise = this.storage.init().catch((error) => {
106
- // allow a retry if initialization fails.
107
- this.initPromise = null;
108
- throw error;
109
- });
110
- }
111
- await this.initPromise;
112
- }
113
91
  }
@@ -1,7 +1,7 @@
1
- import { InputGuardrailResult, OutputGuardrailMetadata, OutputGuardrailResult } from "../guardrail";
1
+ import { InputGuardrailResult, OutputGuardrailMetadata, OutputGuardrailResult } from "../guardrail.js";
2
2
  type SerializedThread = any;
3
- import { AgentResponseType } from "../types/agent";
4
- import { TextResponse } from "../types/thread";
3
+ import { AgentResponseType } from "../types/agent.js";
4
+ import { TextResponse } from "../types/thread.js";
5
5
  /**
6
6
  * Abstract base class for all `kernl` errors
7
7
  * Requires subclasses to implement JSON serialization
@@ -1,5 +1,5 @@
1
1
  import pino from "pino";
2
- import { env } from "./env";
2
+ import { env } from "./env.js";
3
3
  /**
4
4
  * By default we don't log LLM inputs/outputs, to prevent exposing sensitive data.
5
5
  * Set KERNL_LOG_MODEL_DATA=true to enable.
@@ -1,10 +1,10 @@
1
1
  import { EventEmitter } from "node:events";
2
- import { Agent } from "./agent";
3
- import { Context, UnknownContext } from "./context";
4
- import { Tool } from "./tool";
2
+ import { Agent } from "./agent.js";
3
+ import { Context, UnknownContext } from "./context.js";
4
+ import { Tool } from "./tool/index.js";
5
5
  import type { ToolCall } from "@kernl-sdk/protocol";
6
- import { AgentResponseType } from "./types/agent";
7
- import { TextResponse } from "./types/thread";
6
+ import { AgentResponseType } from "./types/agent.js";
7
+ import { TextResponse } from "./types/thread.js";
8
8
  export type EventEmitterEvents = Record<string, any[]>;
9
9
  /**
10
10
  * Generic typed event emitter that wraps Node's EventEmitter with type safety
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect, vi } from "vitest";
2
- import { BaseMCPServer } from "../base";
3
- import { logger } from "../../lib/logger";
2
+ import { BaseMCPServer } from "../base.js";
3
+ import { logger } from "../../lib/logger.js";
4
4
  // Create a minimal concrete implementation for testing
5
5
  class TestMCPServer extends BaseMCPServer {
6
6
  id;
@@ -1,4 +1,4 @@
1
- import { MCPServerStdio } from "../../stdio";
1
+ import { MCPServerStdio } from "../../stdio.js";
2
2
  /**
3
3
  * Helper to run a test with an MCP server, ensuring cleanup.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { MCPServerStdio } from "../../stdio";
1
+ import { MCPServerStdio } from "../../stdio.js";
2
2
  /**
3
3
  * Helper to run a test with an MCP server, ensuring cleanup.
4
4
  */