Search docs
Search guides, modules and symbols
Modules

Docs / API / Modules / interfaces

Interfaces

Platform

@s2script/sdk/interfaces

Protocol 2 contract types: Notification, Hook, Transform, Subscription, AttachmentScope. Name-inferred publish / use, bindForwards, and watchOptional. Protocol 2 on returns an idempotent Subscription (not a numeric id).

Import

import { PublishHandle } from "@s2script/sdk/interfaces";

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.

interface
PublishHandle

Handle returned by publish(name, impl): lets the producer emit forwarded events to every plugin subscribed to this interface via its on(event, …).

emit(event: string, payload: unknown): void

Emit a forwarded event to all consumers subscribed via interface.on(event, …). The payload is structured-copied across the context boundary (JSON, EntityRef-aware — never a live reference).

import type { PublishHandle } from "@s2script/sdk/interfaces";
// plugins/zones/src/plugin.ts:30 — notify consumers a zone was created
iface.emit("created", { zone: z.name, min: z.min, max: z.max, tags: z.tags });
interface
Notification

Type-only protocol 2 descriptor. Payloads must belong to the supported wire algebra.

readonly __notificationPayload: P
interface
Hook

Synchronous decision forward. Changed does not imply payload mutation.

readonly __hookPayload: P
interface
Transform

Synchronous shallow transformation; only W fields may be patched.

readonly __transformPayload: P
readonly __transformWritable: W
type
TransformResponse
interface
InterfaceContracts

CLI-generated association; an authored augmentation cannot authorize a build.

type
ContractMethods
type
ContractForwards
type
NotificationPayload
type
ForwardPayload
type
ForwardResponse
type
DispatchResponse
type
TypedPublishHandle
emit<K extends ForwardNames<C, Notification<unknown>>>(event: K, payload: ForwardPayload<ContractForwards<C>[K]>): void
dispatch<K extends ForwardNames<
      C,
      Hook<unknown> | { readonly __transformPayload: object }
    >>(event: K, payload: ForwardPayload<ContractForwards<C>[K]>): DispatchResponse<ContractForwards<C>[K]>
type
ForwardHandlers

Provider forward names mapped to handlers with their exact payload and result types.

type
ExactForwardHandlers

Rejects keys and transform response fields outside the selected provider contract.

type
TypedInterfaceHandle
interface
Subscription

A consumer-owned registration. Repeated disposal is a no-op.

dispose(): void
interface
AttachmentScope

Resources owned by one synchronous optional-provider attachment.

own<T extends { dispose(): void }>(resource: T): T
— Return the resource and retain its disposer for this attachment.
Back to modules All packages