Host & test runtime
Register definitions and validate local instances and actions. This entry is for hosts and tests.
Generated from the reviewed SDK 0.1.0 contract snapshot. Unreviewed workspace changes are not included.
Public exports
Import from @scape/sdk/runtime.
GizmoFailure, OBJECT_STATE_BYTE_LIMIT, ObjectRegistry, isObjectConfiguration, isObjectEnvelope.
Type declarations
These declarations preserve source comments and related types. Import only the public exports listed above; module-relative paths below describe how the package is organized.
ts
import { type GizmoReaction } from './reaction.js';
import { type GizmoPreview } from './soundBank.js';
import { type ObjectConfiguration, type ObjectAction, type ObjectContext, type ObjectDefinition, type ObjectInstance } from './api.js';
export declare const OBJECT_STATE_BYTE_LIMIT = 32768;
/** Validate an opaque saved envelope without activating an uninstalled definition. */
export declare function isObjectEnvelope(value: unknown): value is ObjectInstance;
/** Account libraries may preserve configuration for a currently uninstalled gizmo. */
export declare function isObjectConfiguration(value: unknown): value is ObjectConfiguration;
/** A disabled trusted definition, retained for host diagnostics without touching saved state. */
export interface GizmoFailure {
type: string;
emoji: string;
label: string;
message: string;
}
export declare class ObjectRegistry {
private definitions;
private emojis;
private disabled;
/** Isolation is for trusted bundled catalogs only. Uploaded projects must remain atomic. */
constructor(definitions: readonly ObjectDefinition[], options?: {
isolateInvalidDefinitions?: boolean;
});
failures(): readonly GizmoFailure[];
private recordFailure;
/** Host preparation may reject one model without revalidating unrelated definitions. */
disable(definition: ObjectDefinition, message: string): void;
/** Atomically install a complete catalog while preserving host references. */
reset(definitions: readonly ObjectDefinition[]): void;
/** A separate host catalog keeps unavailable built-ins and their placement guard. */
fork(additional?: readonly ObjectDefinition[]): ObjectRegistry;
all(): ObjectDefinition[];
forEmoji(emoji: string): ObjectDefinition | undefined;
definition(instance: ObjectInstance): ObjectDefinition;
validate(value: unknown): value is ObjectInstance;
create(emoji: string, id: string): ObjectInstance | undefined;
/** Copy declared configuration only, never unrelated runtime state. */
configuration(instance: ObjectInstance): ObjectConfiguration | undefined;
/** Restore portable values through the normal reducer and host-derived editing authority. */
configure(instance: ObjectInstance, configuration: unknown, context: ObjectContext): ObjectInstance;
/** Evaluate local audition data without applying state or sending any network action. */
preview(instance: ObjectInstance, action: ObjectAction, viewer: {
actorId: string;
canEdit: boolean;
}): GizmoPreview;
act(instance: ObjectInstance, action: ObjectAction, context: ObjectContext): ObjectInstance;
execute(instance: ObjectInstance, action: ObjectAction, context: ObjectContext): {
instance: ObjectInstance;
reaction: GizmoReaction | null;
};
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Usage and limits
See Gizmo guides, working examples, and limits for lifecycle, validation and host behavior.
