@mitralab.io/sdk-core 0.2.12-beta.1 → 0.2.13

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
@@ -1029,7 +1029,8 @@ var TURN_USAGE_COUNTS = [
1029
1029
  "cacheReadTokens",
1030
1030
  "cacheCreationTokens",
1031
1031
  "requestCount",
1032
- "durationMs"
1032
+ "durationMs",
1033
+ "contextTokens"
1033
1034
  ];
1034
1035
  var TURN_USAGE_COSTS = ["costUsd", "costUsdRaw"];
1035
1036
  var TURN_USAGE_STRINGS = [
@@ -1057,6 +1058,8 @@ function agentTurnUsageOf(value) {
1057
1058
  const item = value[field];
1058
1059
  if (isCount(item)) usage[field] = item;
1059
1060
  }
1061
+ const { contextWindow } = value;
1062
+ if (isInteger(contextWindow) && contextWindow > 0) usage.contextWindow = contextWindow;
1060
1063
  for (const field of TURN_USAGE_COSTS) {
1061
1064
  const item = value[field];
1062
1065
  if (isFiniteNumber(item)) usage[field] = item;
package/dist/index.d.cts CHANGED
@@ -1137,6 +1137,18 @@ interface AgentTurnUsage {
1137
1137
  * the history and in a recovered turn, never in the live `turnEnd`.
1138
1138
  */
1139
1139
  requestMessageId?: string;
1140
+ /**
1141
+ * Tokens occupying the chat's context window at the end of the turn: the prompt of the last
1142
+ * request of the main conversation, cache included, subagents excluded. Sent by the box in
1143
+ * `stepFinish`: live in `turnEnd` and in the history. Absent from older boxes and older turns.
1144
+ */
1145
+ contextTokens?: number;
1146
+ /**
1147
+ * Size of the model's context window, in tokens, always positive. Sent by the box in
1148
+ * `stepFinish`: live in `turnEnd` and in the history. Absent when the box does not know it, and
1149
+ * from older boxes and older turns.
1150
+ */
1151
+ contextWindow?: number;
1140
1152
  }
1141
1153
  interface AgentMessage {
1142
1154
  id: string;
package/dist/index.d.ts CHANGED
@@ -1137,6 +1137,18 @@ interface AgentTurnUsage {
1137
1137
  * the history and in a recovered turn, never in the live `turnEnd`.
1138
1138
  */
1139
1139
  requestMessageId?: string;
1140
+ /**
1141
+ * Tokens occupying the chat's context window at the end of the turn: the prompt of the last
1142
+ * request of the main conversation, cache included, subagents excluded. Sent by the box in
1143
+ * `stepFinish`: live in `turnEnd` and in the history. Absent from older boxes and older turns.
1144
+ */
1145
+ contextTokens?: number;
1146
+ /**
1147
+ * Size of the model's context window, in tokens, always positive. Sent by the box in
1148
+ * `stepFinish`: live in `turnEnd` and in the history. Absent when the box does not know it, and
1149
+ * from older boxes and older turns.
1150
+ */
1151
+ contextWindow?: number;
1140
1152
  }
1141
1153
  interface AgentMessage {
1142
1154
  id: string;
package/dist/index.js CHANGED
@@ -957,7 +957,8 @@ var TURN_USAGE_COUNTS = [
957
957
  "cacheReadTokens",
958
958
  "cacheCreationTokens",
959
959
  "requestCount",
960
- "durationMs"
960
+ "durationMs",
961
+ "contextTokens"
961
962
  ];
962
963
  var TURN_USAGE_COSTS = ["costUsd", "costUsdRaw"];
963
964
  var TURN_USAGE_STRINGS = [
@@ -985,6 +986,8 @@ function agentTurnUsageOf(value) {
985
986
  const item = value[field];
986
987
  if (isCount(item)) usage[field] = item;
987
988
  }
989
+ const { contextWindow } = value;
990
+ if (isInteger(contextWindow) && contextWindow > 0) usage.contextWindow = contextWindow;
988
991
  for (const field of TURN_USAGE_COSTS) {
989
992
  const item = value[field];
990
993
  if (isFiniteNumber(item)) usage[field] = item;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mitralab.io/sdk-core",
3
- "version": "0.2.12-beta.1",
3
+ "version": "0.2.13",
4
4
  "description": "Environment-neutral contracts and modules shared by Mitra JavaScript SDKs",
5
5
  "type": "module",
6
6
  "sideEffects": false,