Skip to content

[ts-sdk] Added stats handle#1827

Open
JBRS307 wants to merge 17 commits intomasterfrom
@jbrs/ts-sdk-stats
Open

[ts-sdk] Added stats handle#1827
JBRS307 wants to merge 17 commits intomasterfrom
@jbrs/ts-sdk-stats

Conversation

@JBRS307
Copy link
Collaborator

@JBRS307 JBRS307 commented Mar 18, 2026

Closes #1821

For now it is just a basic method that returns stats for all inputs and outputs.

@JBRS307 JBRS307 self-assigned this Mar 18, 2026
@JBRS307 JBRS307 changed the title [ts-sdk] Added stats handler [ts-sdk] Added stats Mar 18, 2026
@JBRS307 JBRS307 force-pushed the @jbrs/ts-sdk-stats branch 2 times, most recently from d247a21 to 032927f Compare March 18, 2026 14:15
@JBRS307 JBRS307 force-pushed the @jbrs/ts-sdk-stats branch 3 times, most recently from cac27f1 to 43e31b1 Compare March 19, 2026 14:29
@JBRS307 JBRS307 force-pushed the @jbrs/ts-sdk-stats branch from adbd4ad to 75dd486 Compare March 19, 2026 15:02
@JBRS307 JBRS307 changed the title [ts-sdk] Added stats [ts-sdk] Added stats handle Mar 19, 2026
@JBRS307 JBRS307 requested a review from Copilot March 19, 2026 15:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds /stats support across the TypeScript SDK stack so clients can fetch runtime statistics for all inputs and outputs (issue #1821).

Changes:

  • Introduces Rust StatsReport schema support (serde + JSON schema) and wires /stats into the generated schema tooling.
  • Adds a stats() method to core/web/node compositors and re-exports the related type(s).
  • Adds new TS stats type definitions and regenerates api.generated.ts to include stats models.

Reviewed changes

Copilot reviewed 20 out of 22 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
ts/smelter/src/types/stats/input.ts Adds TS input stats type definitions.
ts/smelter/src/types/stats/output.ts Adds TS output stats type definitions.
ts/smelter/src/types/stats.ts Adds a top-level TS StatsReport union model for inputs/outputs.
ts/smelter/src/api.generated.ts Regenerates API types to include StatsReport and nested report types.
ts/smelter-core/src/api.ts Adds ApiClient.stats() and new exported response type.
ts/smelter-core/src/live/compositor.ts Exposes stats() on live core compositor.
ts/smelter-core/src/offline/compositor.ts Exposes stats() on offline core compositor.
ts/smelter-core/src/index.ts Re-exports stats-related type from core API module.
ts/smelter-web-wasm/src/compositor/compositor.ts Exposes stats() in the web-wasm wrapper.
ts/smelter-web-client/src/smelter/live.ts Exposes stats() in the web live wrapper.
ts/smelter-web-client/src/smelter/offline.ts Exposes stats() in the web offline wrapper.
ts/smelter-web-client/src/api.ts Re-exports stats-related type from core.
ts/smelter-node/src/live/compositor.ts Exposes stats() in the node live wrapper.
ts/smelter-node/src/offline/compositor.ts Exposes stats() in the node offline wrapper.
ts/smelter-node/src/api.ts Re-exports stats-related type from core.
ts/examples/node-examples/src/audio.tsx Demonstrates periodic stats polling/printing.
tools/src/bin/generate_from_types.rs Adds StatsReport into schema-generation “type registry”.
smelter-core/src/stats/mod.rs Derives Deserialize/JsonSchema for StatsReport.
smelter-core/src/stats/input_reports.rs Derives Deserialize/JsonSchema for input report types.
smelter-core/src/stats/output_reports.rs Derives Deserialize/JsonSchema for output report types.
smelter-core/Cargo.toml Adds schemars dependency.
Cargo.lock Locks schemars.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@JBRS307 JBRS307 force-pushed the @jbrs/ts-sdk-stats branch 3 times, most recently from b7ee921 to 1a41103 Compare March 19, 2026 15:53
@JBRS307 JBRS307 requested a review from Copilot March 19, 2026 15:53
@JBRS307 JBRS307 force-pushed the @jbrs/ts-sdk-stats branch from 1a41103 to 184a3ac Compare March 19, 2026 15:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds initial /stats support across the TS SDK layers by introducing stats report types, wiring schema generation, and exposing stats() methods on compositors.

Changes:

  • Added new stats report type definitions in @swmansion/smelter and included StatsReport in generated API schema types.
  • Exposed stats(): Promise<StatsReport> on smelter compositors (core/web-client/node/web-wasm) and added a core GET /stats API client call.
  • Updated Rust stats report structs/enums to derive JsonSchema (and Deserialize) and added the schemars dependency.

Reviewed changes

Copilot reviewed 19 out of 21 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
ts/smelter/src/types/stats/output.ts Adds output stats report type definitions.
ts/smelter/src/types/stats/input.ts Adds input stats report type definitions.
ts/smelter/src/types/stats.ts Adds top-level StatsReport / union types for inputs/outputs.
ts/smelter/src/index.ts Exports StatsReport from the public package entrypoint.
ts/smelter/src/api.generated.ts Regenerates API schema types and includes stats types + ApiTypes union update.
ts/smelter-web-wasm/src/compositor/compositor.ts Adds stats() method to the web-wasm compositor wrapper.
ts/smelter-web-client/src/smelter/offline.ts Adds stats() method to offline web-client wrapper.
ts/smelter-web-client/src/smelter/live.ts Adds stats() method to live web-client wrapper.
ts/smelter-web-client/src/api.ts Re-exports StatsReport type from @swmansion/smelter.
ts/smelter-node/src/offline/compositor.ts Adds stats() method to offline node wrapper.
ts/smelter-node/src/live/compositor.ts Adds stats() method to live node wrapper.
ts/smelter-node/src/api.ts Re-exports StatsReport type from @swmansion/smelter.
ts/smelter-core/src/offline/compositor.ts Adds stats() method delegating to ApiClient.
ts/smelter-core/src/live/compositor.ts Adds stats() method delegating to ApiClient.
ts/smelter-core/src/index.ts Formatting-only export block change.
ts/smelter-core/src/api.ts Adds GET /stats call returning StatsReport.
tools/src/bin/generate_from_types.rs Adds StatsReport to schema generation enum.
smelter-core/src/stats/output_reports.rs Adds JsonSchema/Deserialize derives for output stats types.
smelter-core/src/stats/mod.rs Adds JsonSchema/Deserialize derives for StatsReport.
smelter-core/src/stats/input_reports.rs Adds JsonSchema/Deserialize derives for input stats types.
smelter-core/Cargo.toml Adds schemars dependency.
Cargo.lock Locks schemars dependency.
Comments suppressed due to low confidence (2)

ts/smelter-node/src/live/compositor.ts:190

  • stats() returns StatsReport from @swmansion/smelter, but coreSmelter.stats() returns the raw /stats JSON (snake_case). This method currently returns it unchanged, so the runtime shape will not match the camelCase StatsReport type. Either change the return type to Api.StatsReport (snake_case) or convert the payload before returning.
  }
}

ts/smelter-web-client/src/smelter/offline.ts:120

  • stats() returns StatsReport from @swmansion/smelter, but coreSmelter.stats() returns raw server JSON with snake_case keys. This method currently forwards the response unchanged, so the runtime object will not match the declared camelCase StatsReport type. Either return Api.StatsReport (snake_case) or map the response into the camelCase public type before returning.
    });
  }
}


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds initial /stats endpoint support across the TypeScript SDK stack (core + node/web clients) and updates Rust/TS schema generation so the stats types are included.

Changes:

  • Introduces new stats type definitions in @swmansion/smelter and adds StatsReport to generated API/schema types.
  • Adds stats(): Promise<StatsReport> methods to smelter-core, smelter-node, and smelter-web-client.
  • Extends Rust stats report structs/enums with JsonSchema/Deserialize and wires them into the schema generator.

Reviewed changes

Copilot reviewed 19 out of 21 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
ts/smelter/src/types/stats/input.ts Adds TS types for input stats (camelCase).
ts/smelter/src/types/stats/output.ts Adds TS types for output stats (camelCase).
ts/smelter/src/types/stats.ts Adds top-level StatsReport/union types for stats.
ts/smelter/src/index.ts Re-exports StatsReport from the SDK entrypoint.
ts/smelter/src/api.generated.ts Adds wire-format (snake_case) stats types + includes StatsReport in ApiTypes.
ts/smelter-core/src/api.ts Adds ApiClient.stats() performing GET /stats.
ts/smelter-core/src/live/compositor.ts Exposes stats() on live compositor wrapper.
ts/smelter-core/src/offline/compositor.ts Exposes stats() on offline compositor wrapper.
ts/smelter-web-client/src/smelter/live.ts Exposes stats() on web live client wrapper.
ts/smelter-web-client/src/smelter/offline.ts Exposes stats() on web offline client wrapper.
ts/smelter-web-client/src/api.ts Re-exports StatsReport from @swmansion/smelter.
ts/smelter-node/src/live/compositor.ts Exposes stats() on node live client wrapper.
ts/smelter-node/src/offline/compositor.ts Exposes stats() on node offline client wrapper.
ts/smelter-node/src/api.ts Re-exports StatsReport from @swmansion/smelter.
tools/src/bin/generate_from_types.rs Includes Rust StatsReport in ApiTypes schema generation.
smelter-core/src/stats/mod.rs Adds Deserialize/JsonSchema derives to StatsReport.
smelter-core/src/stats/input_reports.rs Adds Deserialize/JsonSchema derives to input stats reports.
smelter-core/src/stats/output_reports.rs Adds Deserialize/JsonSchema derives to output stats reports.
smelter-core/Cargo.toml Adds schemars dependency.
Cargo.lock Locks schemars addition.
ts/smelter-web-wasm/src/compositor/compositor.ts Formatting-only change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JBRS307 JBRS307 force-pushed the @jbrs/ts-sdk-stats branch from 0ff3cd8 to 52fe41a Compare March 20, 2026 09:25
@JBRS307 JBRS307 marked this pull request as ready for review March 20, 2026 09:32
@JBRS307 JBRS307 requested review from Copilot and wkozyra95 March 20, 2026 09:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 23 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ts-sdk] Add handling of /stats

2 participants