feat: auto-wire telemetry in initSquadTelemetry() (#281)#501
Merged
bradygaster merged 1 commit intodevfrom Mar 22, 2026
Merged
Conversation
initSquadTelemetry() now auto-creates EventBus + CostTracker internally, so users just call it once and everything lights up: const telemetry = initSquadTelemetry(); // EventBus, CostTracker, OTel bridge — all wired. console.log(telemetry.costTracker.formatSummary()); Changes: - Auto-create EventBus when none provided (otel-init.ts) - Auto-wire CostTracker to EventBus on init (otel-init.ts) - Expose eventBus + costTracker on SquadTelemetryHandle - Add model pricing table to MODEL_CATALOG (models.ts) - Add estimateCost() helper for token-based cost estimation - SquadClient.sendMessage() now calls recordTokenUsage() (not just span attrs) - Add SquadClient.sendAndWait() with OTel tracing + metric recording - SquadClient accepts optional eventBus for auto-forwarding usage events - createSession() auto-wires usage event forwarding to EventBus - Add subpath exports: ./runtime/otel-init, ./config/models - 16 new tests covering auto-wiring, pricing, and unwiring Closes #281 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
chrislomonico
pushed a commit
to clomonico/squad
that referenced
this pull request
Mar 26, 2026
…radygaster#540) Wires 5 ghost commands: hire→init, heartbeat→doctor, shell→REPL, loop→triage, run→stub with redirect. Closes bradygaster#501, Closes bradygaster#503, Closes bradygaster#504, Closes bradygaster#507, Closes bradygaster#509 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
initSquadTelemetry()now auto-creates EventBus and CostTracker so users just call:Changes
Tests
16 new tests covering auto-wiring, pricing, cost accumulation, and unwiring. All 107 related tests pass.
Files Changed
Closes #281
Credit: Brady Gaster (issue author), Squad IRL samples (discovery source)
Working as EECOM (Core Dev)