You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c4949e9
Browse filesBrowse the repository at this point in the historyBrowse files
Track context-window utilization from runtime and estimated token data, publish typed events and OpenTelemetry metrics, warn interactive-shell users at a configurable threshold, and report estimated utilization from `squad watch`.
|`SQUAD_CONTEXT_WARNING_THRESHOLD`| Interactive-shell context utilization warning threshold | Fraction greater than `0` and at most `1` (default: `0.8`) |
Copy file name to clipboardExpand all lines: docs/src/content/docs/reference/sdk.md
+22-1Lines changed: 22 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -317,7 +317,28 @@ await telemetry.shutdown();
317
317
awaitshutdownOTel();
318
318
```
319
319
320
-
The root package also exports streaming helpers, cost tracking, offline mode, runtime events, OpenTelemetry metrics, and internationalization helpers.
320
+
`StreamingPipeline` can also track the latest context-window occupancy for each attached session. Runtime `context_usage` events are exact; regular usage events provide an estimate when a model context-window resolver is configured.
console.warn(`${snapshot.sessionId} context is ${(snapshot.utilization*100).toFixed(1)}% full`);
335
+
}
336
+
});
337
+
```
338
+
339
+
Every accepted sample is also emitted as a typed `context:utilization` event and recorded in the `squad.context.utilization` OpenTelemetry gauge. Exact runtime samples take precedence over later estimates for the same session.
340
+
341
+
The root package also exports cost tracking, offline mode, runtime events, OpenTelemetry metrics, and internationalization helpers.
0 commit comments