@codelia/runtime 0.1.41 → 0.1.42

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/dist/index.cjs CHANGED
@@ -8961,12 +8961,12 @@ var createRunHandlers = ({
8961
8961
  }) => {
8962
8962
  let activeRunAbort = null;
8963
8963
  let runStartQueue = Promise.resolve();
8964
- const normalizeRunHistoryAfterCancel = (runId, runtimeAgent) => {
8964
+ const normalizeRuntimeAgentHistory = (label, runtimeAgent) => {
8965
8965
  const currentMessages = runtimeAgent.getHistoryMessages();
8966
8966
  const normalizedMessages = normalizeToolCallHistory(currentMessages);
8967
8967
  if (normalizedMessages !== currentMessages) {
8968
8968
  runtimeAgent.replaceHistoryMessages(normalizedMessages);
8969
- log2(`run.cancel normalized history ${runId}`);
8969
+ log2(`${label} normalized history`);
8970
8970
  }
8971
8971
  };
8972
8972
  const normalizeRestoredSessionMessages = (messages, sessionId) => {
@@ -9037,6 +9037,7 @@ var createRunHandlers = ({
9037
9037
  });
9038
9038
  return;
9039
9039
  }
9040
+ normalizeRuntimeAgentHistory("run.start preflight", runtimeAgent);
9040
9041
  const requestedSessionId = params.session_id?.trim() || void 0;
9041
9042
  let resumeState = null;
9042
9043
  const previousSessionId = state.sessionId;
@@ -9343,7 +9344,7 @@ var createRunHandlers = ({
9343
9344
  maybeDebouncedSessionSave();
9344
9345
  }
9345
9346
  if (state.cancelRequested) {
9346
- normalizeRunHistoryAfterCancel(runId, runtimeAgent);
9347
+ normalizeRuntimeAgentHistory(`run.cancel ${runId}`, runtimeAgent);
9347
9348
  }
9348
9349
  await queueSessionSave("terminal");
9349
9350
  emitRunSummaryDiagnostics();
@@ -9357,7 +9358,7 @@ var createRunHandlers = ({
9357
9358
  } catch (error) {
9358
9359
  const err = error instanceof Error ? error : new Error(String(error));
9359
9360
  if (state.cancelRequested || isAbortLikeError(err)) {
9360
- normalizeRunHistoryAfterCancel(runId, runtimeAgent);
9361
+ normalizeRuntimeAgentHistory(`run.cancel ${runId}`, runtimeAgent);
9361
9362
  await queueSessionSave("cancelled");
9362
9363
  emitRunSummaryDiagnostics();
9363
9364
  emitRunStatus(runId, "cancelled", err.message || "cancelled");
@@ -9386,7 +9387,7 @@ var createRunHandlers = ({
9386
9387
  } finally {
9387
9388
  logRunDebug(log2, runId, "stream.finally");
9388
9389
  if (state.cancelRequested) {
9389
- normalizeRunHistoryAfterCancel(runId, runtimeAgent);
9390
+ normalizeRuntimeAgentHistory(`run.cancel ${runId}`, runtimeAgent);
9390
9391
  }
9391
9392
  await queueSessionSave("finally");
9392
9393
  if (activeRunAbort?.runId === runId) {
package/dist/index.js CHANGED
@@ -8991,12 +8991,12 @@ var createRunHandlers = ({
8991
8991
  }) => {
8992
8992
  let activeRunAbort = null;
8993
8993
  let runStartQueue = Promise.resolve();
8994
- const normalizeRunHistoryAfterCancel = (runId, runtimeAgent) => {
8994
+ const normalizeRuntimeAgentHistory = (label, runtimeAgent) => {
8995
8995
  const currentMessages = runtimeAgent.getHistoryMessages();
8996
8996
  const normalizedMessages = normalizeToolCallHistory(currentMessages);
8997
8997
  if (normalizedMessages !== currentMessages) {
8998
8998
  runtimeAgent.replaceHistoryMessages(normalizedMessages);
8999
- log2(`run.cancel normalized history ${runId}`);
8999
+ log2(`${label} normalized history`);
9000
9000
  }
9001
9001
  };
9002
9002
  const normalizeRestoredSessionMessages = (messages, sessionId) => {
@@ -9067,6 +9067,7 @@ var createRunHandlers = ({
9067
9067
  });
9068
9068
  return;
9069
9069
  }
9070
+ normalizeRuntimeAgentHistory("run.start preflight", runtimeAgent);
9070
9071
  const requestedSessionId = params.session_id?.trim() || void 0;
9071
9072
  let resumeState = null;
9072
9073
  const previousSessionId = state.sessionId;
@@ -9373,7 +9374,7 @@ var createRunHandlers = ({
9373
9374
  maybeDebouncedSessionSave();
9374
9375
  }
9375
9376
  if (state.cancelRequested) {
9376
- normalizeRunHistoryAfterCancel(runId, runtimeAgent);
9377
+ normalizeRuntimeAgentHistory(`run.cancel ${runId}`, runtimeAgent);
9377
9378
  }
9378
9379
  await queueSessionSave("terminal");
9379
9380
  emitRunSummaryDiagnostics();
@@ -9387,7 +9388,7 @@ var createRunHandlers = ({
9387
9388
  } catch (error) {
9388
9389
  const err = error instanceof Error ? error : new Error(String(error));
9389
9390
  if (state.cancelRequested || isAbortLikeError(err)) {
9390
- normalizeRunHistoryAfterCancel(runId, runtimeAgent);
9391
+ normalizeRuntimeAgentHistory(`run.cancel ${runId}`, runtimeAgent);
9391
9392
  await queueSessionSave("cancelled");
9392
9393
  emitRunSummaryDiagnostics();
9393
9394
  emitRunStatus(runId, "cancelled", err.message || "cancelled");
@@ -9416,7 +9417,7 @@ var createRunHandlers = ({
9416
9417
  } finally {
9417
9418
  logRunDebug(log2, runId, "stream.finally");
9418
9419
  if (state.cancelRequested) {
9419
- normalizeRunHistoryAfterCancel(runId, runtimeAgent);
9420
+ normalizeRuntimeAgentHistory(`run.cancel ${runId}`, runtimeAgent);
9420
9421
  }
9421
9422
  await queueSessionSave("finally");
9422
9423
  if (activeRunAbort?.runId === runId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codelia/runtime",
3
- "version": "0.1.41",
3
+ "version": "0.1.42",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20 <25"
@@ -23,14 +23,14 @@
23
23
  "typecheck": "tsc --noEmit"
24
24
  },
25
25
  "dependencies": {
26
- "@codelia/config": "0.1.41",
27
- "@codelia/config-loader": "0.1.41",
28
- "@codelia/core": "0.1.41",
29
- "@codelia/logger": "0.1.41",
30
- "@codelia/model-metadata": "0.1.41",
31
- "@codelia/protocol": "0.1.41",
32
- "@codelia/shared-types": "0.1.41",
33
- "@codelia/storage": "0.1.41",
26
+ "@codelia/config": "0.1.42",
27
+ "@codelia/config-loader": "0.1.42",
28
+ "@codelia/core": "0.1.42",
29
+ "@codelia/logger": "0.1.42",
30
+ "@codelia/model-metadata": "0.1.42",
31
+ "@codelia/protocol": "0.1.42",
32
+ "@codelia/shared-types": "0.1.42",
33
+ "@codelia/storage": "0.1.42",
34
34
  "eventsource-parser": "^3.0.6",
35
35
  "oauth4webapi": "^3.8.4",
36
36
  "zod": "^4.3.5"