@rulvar/core 1.27.0 → 1.28.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.
Files changed (2) hide show
  1. package/dist/index.js +7 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8026,10 +8026,6 @@ async function streamTurn(adapter, req, options) {
8026
8026
  break;
8027
8027
  }
8028
8028
  case "usage": {
8029
- if (sawFinish) {
8030
- usageViolation ??= "a usage event arrived after the finish event";
8031
- break;
8032
- }
8033
8029
  const cleaned = {};
8034
8030
  for (const field of [
8035
8031
  "inputTokens",
@@ -8062,10 +8058,6 @@ async function streamTurn(adapter, req, options) {
8062
8058
  break;
8063
8059
  }
8064
8060
  case "finish":
8065
- if (sawFinish) {
8066
- usageViolation ??= "a second finish event arrived on one stream";
8067
- break;
8068
- }
8069
8061
  sawFinish = true;
8070
8062
  finish = event.finish;
8071
8063
  usage = event.usage;
@@ -8075,7 +8067,7 @@ async function streamTurn(adapter, req, options) {
8075
8067
  wireError = event.error;
8076
8068
  break;
8077
8069
  }
8078
- if (wireError !== void 0) break;
8070
+ if (sawFinish || wireError !== void 0) break;
8079
8071
  }
8080
8072
  } catch (thrown) {
8081
8073
  if (!combined.aborted) wireError = {
@@ -8100,6 +8092,12 @@ async function streamTurn(adapter, req, options) {
8100
8092
  if (usageViolation !== void 0) outcome.usageViolation = usageViolation;
8101
8093
  return outcome;
8102
8094
  }
8095
+ if (!sawFinish && wireError === void 0) wireError = {
8096
+ code: "agent",
8097
+ message: `adapter '${adapter.id}' stream ended without a terminal finish or error event; the adapter contract requires exactly one per stream, so the partial turn is discarded as a retryable transport fault`,
8098
+ retryable: true,
8099
+ data: { kind: "transport" }
8100
+ };
8103
8101
  const outcome = {
8104
8102
  turn,
8105
8103
  usage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.27.0",
3
+ "version": "1.28.0",
4
4
  "description": "Rulvar core: L0 contracts, journal kernel, ctx primitives, agent runtime, model router, tool system, dynamic orchestrator, InMemory and JSONL stores, event stream.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",