@kernl-sdk/protocol 0.2.1 → 0.2.5

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.
@@ -1,4 +1,5 @@
1
-
2
- > @kernl-sdk/protocol@0.2.1 build /Users/andjones/Documents/projects/kernl/packages/protocol
3
- > tsc && tsc-alias
4
-
1
+
2
+ 
3
+ > @kernl-sdk/protocol@0.2.4 build /Users/andjones/Documents/projects/kernl/packages/protocol
4
+ > tsc && tsc-alias --resolve-full-paths
5
+
@@ -0,0 +1,4 @@
1
+
2
+ > @kernl-sdk/protocol@0.2.2 check-types /Users/andjones/Documents/projects/kernl/packages/protocol
3
+ > tsc --noEmit
4
+
package/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # @kernl/protocol
2
2
 
3
+ ## 0.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix ESM compatibility by adding --resolve-full-paths to tsc-alias build
8
+ - Updated dependencies
9
+ - @kernl-sdk/shared@0.1.6
10
+
11
+ ## 0.2.4
12
+
13
+ ### Patch Changes
14
+
15
+ - Migrate packages from GitHub Packages to npm registry.
16
+
17
+ **Breaking change for `kernl` (formerly `@kernl-sdk/core`):**
18
+
19
+ The core package has been renamed from `@kernl-sdk/core` to `kernl`. Update your imports:
20
+
21
+ ```diff
22
+ - import { Agent, Kernl } from "@kernl-sdk/core";
23
+ + import { Agent, Kernl } from "kernl";
24
+ ```
25
+
26
+ All other packages remain under the `@kernl-sdk` scope and are now publicly available on npm.
27
+
28
+ - Updated dependencies
29
+ - @kernl-sdk/shared@0.1.5
30
+
31
+ ## 0.2.3
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies
36
+ - @kernl-sdk/shared@0.1.4
37
+
38
+ ## 0.2.2
39
+
40
+ ### Patch Changes
41
+
42
+ - 2c62c0a: Migrate from @kernl to @kernl-sdk scope
43
+
44
+ All packages have been migrated to the @kernl-sdk scope for publishing to GitHub Packages under the kernl-sdk organization.
45
+
46
+ - Updated dependencies [2c62c0a]
47
+ - @kernl-sdk/shared@0.1.3
48
+
3
49
  ## 0.2.1
4
50
 
5
51
  ### Patch Changes
package/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright [yyyy] [name of copyright owner]
189
+ Copyright 2025 Andrew Jones
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Defines the standard interface for embedding model providers in Kernl.
5
5
  */
6
- import { Usage } from "../language-model";
6
+ import { Usage } from "../language-model/index.js";
7
7
  /**
8
8
  * A request to an embedding model.
9
9
  */
@@ -1,3 +1,3 @@
1
- export * from "./model";
2
- export * from "./request";
1
+ export * from "./model.js";
2
+ export * from "./request.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from "./model";
2
- export * from "./request";
1
+ export * from "./model.js";
2
+ export * from "./request.js";
@@ -1,5 +1,5 @@
1
- import { SharedProviderMetadata } from "../provider";
2
- import { EmbeddingModelRequest } from "./request";
1
+ import { SharedProviderMetadata } from "../provider/index.js";
2
+ import { EmbeddingModelRequest } from "./request.js";
3
3
  export type Embedding = number[];
4
4
  /**
5
5
  * Embedding model interface.
@@ -1,4 +1,4 @@
1
- import { SharedProviderOptions } from "../provider";
1
+ import { SharedProviderOptions } from "../provider/index.js";
2
2
  export interface EmbeddingModelRequest<TValue = string> {
3
3
  /**
4
4
  * Values to embed.
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * kernl Provider Protocol
2
+ * kernl - Protocol
3
3
  *
4
4
  * Standard interfaces and types for AI model providers.
5
5
  */
6
- export * from "./constants";
7
- export * from "./language-model";
8
- export * from "./embedding-model";
9
- export * from "./provider";
10
- export * from "./codec";
6
+ export * from "./constants.js";
7
+ export * from "./language-model/index.js";
8
+ export * from "./embedding-model/index.js";
9
+ export * from "./provider/index.js";
10
+ export * from "./json.js";
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC"}
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * kernl Provider Protocol
2
+ * kernl - Protocol
3
3
  *
4
4
  * Standard interfaces and types for AI model providers.
5
5
  */
6
- export * from "./constants";
7
- export * from "./language-model";
8
- export * from "./embedding-model";
9
- export * from "./provider";
10
- export * from "./codec";
6
+ export * from "./constants.js";
7
+ export * from "./language-model/index.js";
8
+ export * from "./embedding-model/index.js";
9
+ export * from "./provider/index.js";
10
+ export * from "./json.js";
@@ -1,5 +1,5 @@
1
- import { SharedProviderMetadata } from "../provider/metadata";
2
- import { JSONValue } from "../json";
1
+ import { SharedProviderMetadata } from "../provider/metadata.js";
2
+ import { JSONValue } from "../json.js";
3
3
  export type LanguageModelContent = LanguageModelText | LanguageModelReasoning | LanguageModelFile | LanguageModelSource | LanguageModelToolCall | LanguageModelToolResult;
4
4
  /**
5
5
  * Text that the model has generated.
@@ -1,7 +1,7 @@
1
- export * from "./item";
2
- export * from "./model";
3
- export * from "./request";
4
- export * from "./stream";
5
- export * from "./tool";
6
- export * from "./utils";
1
+ export * from "./item.js";
2
+ export * from "./model.js";
3
+ export * from "./request.js";
4
+ export * from "./stream.js";
5
+ export * from "./tool.js";
6
+ export * from "./utils.js";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
- export * from "./item";
2
- export * from "./model";
3
- export * from "./request";
4
- export * from "./stream";
5
- export * from "./tool";
6
- export * from "./utils";
1
+ export * from "./item.js";
2
+ export * from "./model.js";
3
+ export * from "./request.js";
4
+ export * from "./stream.js";
5
+ export * from "./tool.js";
6
+ export * from "./utils.js";
@@ -1,6 +1,6 @@
1
- import { SharedProviderMetadata } from "../provider";
2
- import { JSONValue } from "../json";
3
- import { IN_PROGRESS, COMPLETED, FAILED, INTERRUPTIBLE, UNINTERRUPTIBLE } from "../constants";
1
+ import { SharedProviderMetadata } from "../provider/index.js";
2
+ import { JSONValue } from "../json.js";
3
+ import { IN_PROGRESS, COMPLETED, FAILED, INTERRUPTIBLE, UNINTERRUPTIBLE } from "../constants.js";
4
4
  export type LanguageModelItem = Message | Reasoning | ToolCall | ToolResult;
5
5
  /**
6
6
  * A subset of LanguageModelItem that excludes items that wouldn't
@@ -40,11 +40,9 @@ export interface TextPart extends PartBase {
40
40
  text: string;
41
41
  }
42
42
  /**
43
- * A file that has been generated by the model.
44
- *
45
- * May be base64 encoded strings or binary data.
43
+ * Base properties for file parts.
46
44
  */
47
- export interface FilePart extends PartBase {
45
+ interface FilePartBase extends PartBase {
48
46
  readonly kind: "file";
49
47
  /**
50
48
  * The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
@@ -53,14 +51,40 @@ export interface FilePart extends PartBase {
53
51
  */
54
52
  mimeType: string;
55
53
  /**
56
- * Generated file data as base64 encoded strings or binary data.
54
+ * Optional filename for the file
55
+ */
56
+ filename?: string;
57
+ }
58
+ /**
59
+ * A file with inline data (base64 string or binary).
60
+ */
61
+ export interface FilePartWithData extends FilePartBase {
62
+ /**
63
+ * File data as base64 encoded string or binary data.
57
64
  */
58
65
  data: string | Uint8Array;
59
66
  /**
60
- * Optional filename for the file
67
+ * The `uri` property must be absent when `data` is present.
61
68
  */
62
- filename?: string;
69
+ uri?: never;
63
70
  }
71
+ /**
72
+ * A file referenced by URI.
73
+ */
74
+ export interface FilePartWithUri extends FilePartBase {
75
+ /**
76
+ * A URL pointing to the file's content.
77
+ */
78
+ uri: string;
79
+ /**
80
+ * The `data` property must be absent when `uri` is present.
81
+ */
82
+ data?: never;
83
+ }
84
+ /**
85
+ * A file that has been generated by the model or referenced by URI.
86
+ */
87
+ export type FilePart = FilePartWithData | FilePartWithUri;
64
88
  /**
65
89
  * Represents a structured data segment (e.g., JSON) within a message or artifact.
66
90
  */
@@ -158,7 +182,7 @@ export interface ToolResult extends LanguageModelItemBase {
158
182
  /**
159
183
  * Result of the tool call. This is a JSON-serializable object.
160
184
  */
161
- result: NonNullable<JSONValue>;
185
+ result: JSONValue | null;
162
186
  /**
163
187
  * Error message if the tool call failed
164
188
  */
@@ -168,4 +192,5 @@ export interface ToolResult extends LanguageModelItemBase {
168
192
  * State of a tool call execution.
169
193
  */
170
194
  export type ToolCallState = typeof IN_PROGRESS | typeof COMPLETED | typeof FAILED | typeof INTERRUPTIBLE | typeof UNINTERRUPTIBLE;
195
+ export {};
171
196
  //# sourceMappingURL=item.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../src/language-model/item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EACL,WAAW,EACX,SAAS,EACT,MAAM,EACN,aAAa,EACb,eAAe,EAChB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE5E;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GACjC,gBAAgB,GAChB,SAAS,GACT,QAAQ,GACR,UAAU,CAAC;AAEf,MAAM,WAAW,UAAU;IACzB;;OAEG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AMrE;;GAEG;AACH,MAAM,WAAW,QAAS,SAAQ,qBAAqB;IACrD,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IAErB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,qBAAqB;IACvD,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAE7B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IAErB;;OAEG;IACH,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,OAAO,WAAW,GAClB,OAAO,SAAS,GAChB,OAAO,MAAM,GACb,OAAO,aAAa,GACpB,OAAO,eAAe,CAAC"}
@@ -1,8 +1,8 @@
1
- import { SharedProviderMetadata } from "../provider";
2
- import { LanguageModelResponseItem } from "./item";
3
- import { LanguageModelRequest } from "./request";
4
- import { LanguageModelStreamEvent } from "./stream";
5
- import { LanguageModelFunctionTool, LanguageModelProviderTool } from "./tool";
1
+ import { SharedProviderMetadata } from "../provider/index.js";
2
+ import { LanguageModelResponseItem } from "./item.js";
3
+ import { LanguageModelRequest } from "./request.js";
4
+ import { LanguageModelStreamEvent } from "./stream.js";
5
+ import { LanguageModelFunctionTool, LanguageModelProviderTool } from "./tool.js";
6
6
  /**
7
7
  * Defines the standard interface for language model providers in kernl.
8
8
  */
@@ -1,7 +1,7 @@
1
1
  import type { JSONSchema7 } from "json-schema";
2
- import { SharedProviderOptions } from "../provider";
3
- import { LanguageModelItem } from "./item";
4
- import { LanguageModelFunctionTool, LanguageModelProviderTool } from "./tool";
2
+ import { SharedProviderOptions } from "../provider/index.js";
3
+ import { LanguageModelItem } from "./item.js";
4
+ import { LanguageModelFunctionTool, LanguageModelProviderTool } from "./tool.js";
5
5
  export type LanguageModelTool = LanguageModelFunctionTool | LanguageModelProviderTool;
6
6
  /**
7
7
  * A request to a large language model.
@@ -1,6 +1,6 @@
1
- import { SharedProviderMetadata } from "../provider";
2
- import type { LanguageModelFinishReason, LanguageModelUsage, LanguageModelWarning } from "./model";
3
- import type { Message, Reasoning, ToolCall, ToolResult } from "./item";
1
+ import { SharedProviderMetadata } from "../provider/index.js";
2
+ import type { LanguageModelFinishReason, LanguageModelUsage, LanguageModelWarning } from "./model.js";
3
+ import type { Message, Reasoning, ToolCall, ToolResult } from "./item.js";
4
4
  /**
5
5
  * Union of all language model stream events.
6
6
  */
@@ -1,5 +1,5 @@
1
1
  import type { JSONSchema7 } from "json-schema";
2
- import type { SharedProviderOptions } from "../provider";
2
+ import type { SharedProviderOptions } from "../provider/index.js";
3
3
  /**
4
4
  * A tool has a name, a description, and a set of parameters.
5
5
  *
@@ -1,5 +1,5 @@
1
- import { SharedProviderMetadata } from "../provider";
2
- import { Message, Reasoning } from "./item";
1
+ import { SharedProviderMetadata } from "../provider/index.js";
2
+ import { Message, Reasoning } from "./item.js";
3
3
  /**
4
4
  * Create a message with text content
5
5
  */
@@ -1,2 +1,2 @@
1
- export * from "./provider";
1
+ export * from "./provider.js";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- export * from "./provider";
1
+ export * from "./provider.js";
@@ -1,4 +1,4 @@
1
- import { JSONObject } from "../json";
1
+ import { JSONObject } from "../json.js";
2
2
  /**
3
3
  * Additional provider-specific metadata.
4
4
  *
@@ -1,6 +1,6 @@
1
- import { EmbeddingModel } from "../embedding-model";
2
- import { LanguageModel } from "../language-model";
3
- import { JSONObject } from "../json";
1
+ import { EmbeddingModel } from "../embedding-model/index.js";
2
+ import { LanguageModel } from "../language-model/index.js";
3
+ import { JSONObject } from "../json.js";
4
4
  /**
5
5
  * Provider for language, text embedding, and image generation models.
6
6
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kernl-sdk/protocol",
3
- "version": "0.2.1",
3
+ "version": "0.2.5",
4
4
  "description": "Protocol specification for kernl",
5
5
  "keywords": [
6
6
  "kernl",
@@ -12,14 +12,17 @@
12
12
  "license": "MIT",
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "https://github.com/dremnik/kernl.git",
15
+ "url": "https://github.com/kernl-sdk/kernl.git",
16
16
  "directory": "packages/protocol"
17
17
  },
18
- "homepage": "https://github.com/dremnik/kernl#readme",
18
+ "homepage": "https://github.com/kernl-sdk/kernl#readme",
19
19
  "bugs": {
20
- "url": "https://github.com/dremnik/kernl/issues"
20
+ "url": "https://github.com/kernl-sdk/kernl/issues"
21
21
  },
22
22
  "type": "module",
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
23
26
  "exports": {
24
27
  ".": {
25
28
  "types": "./dist/index.d.ts",
@@ -27,7 +30,7 @@
27
30
  }
28
31
  },
29
32
  "dependencies": {
30
- "@kernl-sdk/shared": "0.1.2"
33
+ "@kernl-sdk/shared": "0.1.6"
31
34
  },
32
35
  "devDependencies": {
33
36
  "@types/json-schema": "^7.0.15",
@@ -36,7 +39,7 @@
36
39
  "typescript": "5.9.2"
37
40
  },
38
41
  "scripts": {
39
- "build": "tsc && tsc-alias",
42
+ "build": "tsc && tsc-alias --resolve-full-paths",
40
43
  "dev": "tsc --watch",
41
44
  "lint": "eslint src/",
42
45
  "check-types": "tsc --noEmit"
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * kernl Provider Protocol
2
+ * kernl - Protocol
3
3
  *
4
4
  * Standard interfaces and types for AI model providers.
5
5
  */
@@ -8,4 +8,4 @@ export * from "./constants";
8
8
  export * from "./language-model";
9
9
  export * from "./embedding-model";
10
10
  export * from "./provider";
11
- export * from "./codec";
11
+ export * from "./json";
@@ -62,11 +62,9 @@ export interface TextPart extends PartBase {
62
62
  }
63
63
 
64
64
  /**
65
- * A file that has been generated by the model.
66
- *
67
- * May be base64 encoded strings or binary data.
65
+ * Base properties for file parts.
68
66
  */
69
- export interface FilePart extends PartBase {
67
+ interface FilePartBase extends PartBase {
70
68
  readonly kind: "file";
71
69
 
72
70
  /**
@@ -77,16 +75,46 @@ export interface FilePart extends PartBase {
77
75
  mimeType: string;
78
76
 
79
77
  /**
80
- * Generated file data as base64 encoded strings or binary data.
78
+ * Optional filename for the file
79
+ */
80
+ filename?: string;
81
+ }
82
+
83
+ /**
84
+ * A file with inline data (base64 string or binary).
85
+ */
86
+ export interface FilePartWithData extends FilePartBase {
87
+ /**
88
+ * File data as base64 encoded string or binary data.
81
89
  */
82
90
  data: string | Uint8Array;
83
91
 
84
92
  /**
85
- * Optional filename for the file
93
+ * The `uri` property must be absent when `data` is present.
86
94
  */
87
- filename?: string;
95
+ uri?: never;
96
+ }
97
+
98
+ /**
99
+ * A file referenced by URI.
100
+ */
101
+ export interface FilePartWithUri extends FilePartBase {
102
+ /**
103
+ * A URL pointing to the file's content.
104
+ */
105
+ uri: string;
106
+
107
+ /**
108
+ * The `data` property must be absent when `uri` is present.
109
+ */
110
+ data?: never;
88
111
  }
89
112
 
113
+ /**
114
+ * A file that has been generated by the model or referenced by URI.
115
+ */
116
+ export type FilePart = FilePartWithData | FilePartWithUri;
117
+
90
118
  /**
91
119
  * Represents a structured data segment (e.g., JSON) within a message or artifact.
92
120
  */
@@ -214,7 +242,7 @@ export interface ToolResult extends LanguageModelItemBase {
214
242
  /**
215
243
  * Result of the tool call. This is a JSON-serializable object.
216
244
  */
217
- result: NonNullable<JSONValue>;
245
+ result: JSONValue | null;
218
246
 
219
247
  /**
220
248
  * Error message if the tool call failed
package/src/codec.ts DELETED
@@ -1,22 +0,0 @@
1
- /**
2
- * Bidirectional codec for converting between kernl protocol types and provider-specific types.
3
- *
4
- * @example
5
- * ```typescript
6
- * const tools: Codec<LanguageModelTool[], ProviderTool[]> = {
7
- * encode: (tools: Tool[]) => tools.map(convertToProvider),
8
- * decode: () => { throw new Error("codec:unimplemented"); },
9
- * };
10
- * ```
11
- */
12
- export interface Codec<TKernl, TProvider> {
13
- /**
14
- * Transform from kernl protocol format to provider format.
15
- */
16
- encode: (value: TKernl) => TProvider;
17
-
18
- /**
19
- * Transform from provider format to kernl protocol format.
20
- */
21
- decode: (value: TProvider) => TKernl;
22
- }