Docs / API / Modules / contracts/workshop
Contracts/workshop
Platform @s2script/sdk/contracts/workshop
@s2script/sdk/contracts/workshop — the standard contract for a **workshop / UGC** plugin. TYPE-ONLY. The framework ships no implementation: subscribing to, downloading and mounting UGC is a Steam-services concern, not a Source 2 engine touchpoint. A community plugin implements this and publishes it; consumers depend on the one agreed shape. See contracts/README.md. Engine-generic on purpose — every Source 2 title has workshop content, so nothing here is CS2-specific. Game-specific economy lives in @s2script/cs2/econ. @example import type { WorkshopService } from "@s2script/sdk/contracts/workshop"; const ws = ctx.tryUse<WorkshopService>("workshop"); if (ws) { const map = await ws.currentMap(); console.log(map ? ${map.title} (${map.id}): "not a workshop map"); }
4 exports
Import
import { WorkshopItem } from "@s2script/sdk/contracts/workshop";
Author-time types ship in the npm package; the engine injects the runtime at plugin load.
Add @s2script/sdk to your plugin's dependencies.
API reference
Generated from the shipped type definitions.
A workshop item. id is a **decimal string**, never a number: published-file IDs are 64-bit and a
BigInt cannot cross the plugin boundary (it throws and drops the whole payload).
An installed workshop map, as reported by WorkshopService.currentMap.
Progress for an in-flight download.
The contract a workshop plugin publishes.
Everything that touches Steam is asynchronous — an implementation must not block the game frame.
Methods resolve to null/false rather than throwing when an item is unknown or Steam is
unreachable, so a consumer degrades instead of crashing (the framework's standing posture).