@kortyx/runtime 0.4.1 → 0.5.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.0](https://github.com/kortyx-io/kortyx/compare/runtime-v0.4.1...runtime-v0.5.0) (2026-02-17)
4
+
5
+
6
+ ### Features
7
+
8
+ * **agent:** strict createAgent and unify useReason streaming ([6725f97](https://github.com/kortyx-io/kortyx/commit/6725f976fc32083fb7d2590f1353d16a99afb46f))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **hooks:** move reason engine to internal subpath export ([b82f2f2](https://github.com/kortyx-io/kortyx/commit/b82f2f2a93067f91dd010334486eb0f3a3a547b8))
14
+
3
15
  ## [0.4.1](https://github.com/kortyx-io/kortyx/compare/runtime-v0.4.0...runtime-v0.4.1) (2026-02-15)
4
16
 
5
17
 
@@ -1 +1 @@
1
- {"version":3,"file":"create-langgraph.d.ts","sourceRoot":"","sources":["../../src/graph/create-langgraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAIV,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAQvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAI3E,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,KAAK,IAAI,CAAC;IACrE,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAKnC,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAsB,eAAe,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,MAAM,EAAE,kBAAkB,gBA2b3B"}
1
+ {"version":3,"file":"create-langgraph.d.ts","sourceRoot":"","sources":["../../src/graph/create-langgraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAIV,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAI3E,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,KAAK,IAAI,CAAC;IACrE,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAKnC,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAsB,eAAe,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,MAAM,EAAE,kBAAkB,gBA+Z3B"}
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createLangGraph = createLangGraph;
4
4
  const hooks_1 = require("@kortyx/hooks");
5
+ const internal_1 = require("@kortyx/hooks/internal");
5
6
  const utils_1 = require("@kortyx/utils");
6
- const messages_1 = require("@langchain/core/messages");
7
7
  const langgraph_1 = require("@langchain/langgraph");
8
8
  const checkpointer_1 = require("../checkpointer");
9
9
  const node_loader_1 = require("../node-loader");
@@ -131,46 +131,21 @@ async function createLangGraph(workflow, config) {
131
131
  if (!getProvider) {
132
132
  throw new Error("Runtime config is missing getProvider; wire a provider factory into @kortyx/runtime.");
133
133
  }
134
- const model = getProvider(providerId, modelName, {
134
+ const result = await (0, internal_1.runReasonEngine)({
135
+ getProvider,
136
+ model: {
137
+ providerId,
138
+ modelId: modelName,
139
+ },
140
+ input: args.user ?? "",
141
+ system: args.system,
135
142
  temperature,
136
- streaming: true,
143
+ stream: true,
144
+ emit: true,
145
+ nodeId,
146
+ emitEvent: ctx.emit,
137
147
  });
138
- const messages = [
139
- ...(args.system ? [new messages_1.SystemMessage(args.system)] : []),
140
- new messages_1.HumanMessage(args.user ?? ""),
141
- ];
142
- let final = "";
143
- const t0 = Date.now();
144
- let seenFirst = false;
145
- const isSilent = false;
146
- if (!isSilent)
147
- ctx.emit("text-start", { node: nodeId });
148
- const stream = await model.stream(messages);
149
- for await (const chunk of stream) {
150
- const part = (0, utils_1.contentToText)(chunk.content);
151
- if (!part)
152
- continue;
153
- if (!seenFirst) {
154
- seenFirst = true;
155
- const ttft = Date.now() - t0;
156
- ctx.emit("status", {
157
- node: nodeId,
158
- message: `⏱️ TTFT ${ttft}ms`,
159
- });
160
- }
161
- final += part;
162
- if (!isSilent)
163
- ctx.emit("text-delta", { node: nodeId, delta: part });
164
- }
165
- if (!isSilent)
166
- ctx.emit("text-end", { node: nodeId });
167
- const t1 = Date.now();
168
- if (seenFirst)
169
- ctx.emit("status", {
170
- node: nodeId,
171
- message: `✅ Stream done in ${t1 - t0}ms`,
172
- });
173
- return final;
148
+ return result.text;
174
149
  },
175
150
  };
176
151
  if (behavior.checkpoint && config?.onCheckpoint) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kortyx/runtime",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "description": "Runtime/orchestration wiring for Kortyx.",
6
6
  "keywords": [