@kernl-sdk/ai 0.3.3 → 0.3.4

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,4 @@
1
1
 
2
- > @kernl-sdk/ai@0.3.3 build /home/runner/work/kernl/kernl/packages/providers/ai
2
+ > @kernl-sdk/ai@0.3.4 build /home/runner/work/kernl/kernl/packages/providers/ai
3
3
  > tsc && tsc-alias --resolve-full-paths
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @kernl/ai
2
2
 
3
+ ## 0.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - bb6ac60: Add lifecycle hooks for observing agent execution
8
+ - New events: `thread.start`, `thread.stop`, `model.call.start`, `model.call.end`, `tool.call.start`, `tool.call.end`
9
+ - Subscribe via `agent.on()` or `kernl.on()` for global hooks
10
+ - Fixed error propagation in thread execution
11
+ - Normalized `ErrorEvent.error` to always be an `Error` instance
12
+
13
+ - Updated dependencies [bb6ac60]
14
+ - @kernl-sdk/protocol@0.4.1
15
+ - @kernl-sdk/retrieval@0.1.7
16
+
3
17
  ## 0.3.3
4
18
 
5
19
  ### Patch Changes
@@ -267,7 +267,7 @@ describe("STREAM_PART codec", () => {
267
267
  const result = STREAM_PART.decode(part);
268
268
  expect(result).toEqual({
269
269
  kind: "error",
270
- error: "Connection failed",
270
+ error: new Error("Connection failed"),
271
271
  });
272
272
  });
273
273
  it("should decode raw event", () => {
@@ -428,7 +428,7 @@ describe("toUIMessageStream", () => {
428
428
  it("should handle errors in stream", async () => {
429
429
  const events = [
430
430
  { kind: "text-start", id: "text-1" },
431
- { kind: "error", error: "Network timeout" },
431
+ { kind: "error", error: new Error("Network timeout") },
432
432
  ];
433
433
  async function* generateEvents() {
434
434
  for (const event of events) {
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/convert/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,KAAK,wBAAwB,EAI9B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAIlE;;GAEG;AACH,wBAAuB,aAAa,CAClC,MAAM,EAAE,cAAc,CAAC,yBAAyB,CAAC,GAChD,aAAa,CAAC,wBAAwB,CAAC,CAgBzC;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAC7B,wBAAwB,GAAG,IAAI,EAC/B,yBAAyB,CAiJ1B,CAAC"}
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/convert/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,KAAK,wBAAwB,EAI9B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAIlE;;GAEG;AACH,wBAAuB,aAAa,CAClC,MAAM,EAAE,cAAc,CAAC,yBAAyB,CAAC,GAChD,aAAa,CAAC,wBAAwB,CAAC,CAgBzC;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAC7B,wBAAwB,GAAG,IAAI,EAC/B,yBAAyB,CAoJ1B,CAAC"}
@@ -129,7 +129,9 @@ export const STREAM_PART = {
129
129
  case "error":
130
130
  return {
131
131
  kind: "error",
132
- error: part.error,
132
+ error: part.error instanceof Error
133
+ ? part.error
134
+ : new Error(String(part.error)),
133
135
  };
134
136
  case "raw":
135
137
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kernl-sdk/ai",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Vercel AI SDK adapter for kernl",
5
5
  "keywords": [
6
6
  "kernl",
@@ -68,9 +68,9 @@
68
68
  "vitest": "^4.0.8"
69
69
  },
70
70
  "dependencies": {
71
- "@kernl-sdk/protocol": "0.4.0",
72
- "@kernl-sdk/shared": "^0.3.1",
73
- "@kernl-sdk/retrieval": "0.1.6"
71
+ "@kernl-sdk/protocol": "0.4.1",
72
+ "@kernl-sdk/retrieval": "0.1.7",
73
+ "@kernl-sdk/shared": "^0.3.1"
74
74
  },
75
75
  "scripts": {
76
76
  "build": "tsc && tsc-alias --resolve-full-paths",
@@ -317,7 +317,7 @@ describe("STREAM_PART codec", () => {
317
317
 
318
318
  expect(result).toEqual({
319
319
  kind: "error",
320
- error: "Connection failed",
320
+ error: new Error("Connection failed"),
321
321
  });
322
322
  });
323
323
 
@@ -520,7 +520,7 @@ describe("toUIMessageStream", () => {
520
520
  it("should handle errors in stream", async () => {
521
521
  const events: LanguageModelStreamEvent[] = [
522
522
  { kind: "text-start", id: "text-1" },
523
- { kind: "error", error: "Network timeout" },
523
+ { kind: "error", error: new Error("Network timeout") },
524
524
  ];
525
525
 
526
526
  async function* generateEvents() {
@@ -160,7 +160,10 @@ export const STREAM_PART: Codec<
160
160
  case "error":
161
161
  return {
162
162
  kind: "error",
163
- error: part.error,
163
+ error:
164
+ part.error instanceof Error
165
+ ? part.error
166
+ : new Error(String(part.error)),
164
167
  };
165
168
 
166
169
  case "raw":