@idosgames/module-sdk 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +56 -2
- package/dist/index.d.ts +56 -2
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RealtimeSession, IDosGamesClient } from '@idosgames/core';
|
|
1
|
+
import { RealtimeSession, VoiceController, IDosGamesClient } from '@idosgames/core';
|
|
2
2
|
export { IDosGamesClient, SdkEvents } from '@idosgames/core';
|
|
3
3
|
import { ComponentType } from 'react';
|
|
4
4
|
|
|
@@ -345,6 +345,13 @@ interface MultiplayerRoom {
|
|
|
345
345
|
readonly lateJoin: boolean;
|
|
346
346
|
/** Leave the room for good: closes the session and the rooms screen forgets it. */
|
|
347
347
|
leave(): Promise<void>;
|
|
348
|
+
/**
|
|
349
|
+
* The room's voice chat, or `null` when the room has none. The rooms system owns it and draws its
|
|
350
|
+
* controls (the mic button over the game included); a game reads it for its own touches — who is
|
|
351
|
+
* speaking (`isSpeaking`, `on("change")`), a talking player's marker, proximity volume
|
|
352
|
+
* (`setPeerVolume` by distance).
|
|
353
|
+
*/
|
|
354
|
+
readonly voice: VoiceController | null;
|
|
348
355
|
}
|
|
349
356
|
/** What `ctx.features.open("multiplayer", args)` understands. */
|
|
350
357
|
interface MultiplayerScreenArgs {
|
|
@@ -525,6 +532,32 @@ interface AppNotifications {
|
|
|
525
532
|
dismiss(id: string): void;
|
|
526
533
|
}
|
|
527
534
|
|
|
535
|
+
/** The room's voices, as the recording takes them (the multiplayer system provides this). */
|
|
536
|
+
interface RecordingVoiceSource {
|
|
537
|
+
/** This player's microphone track (silent while not transmitting); null — mic off. */
|
|
538
|
+
mic(): MediaStreamTrack | null;
|
|
539
|
+
/** Other players' voice tracks. */
|
|
540
|
+
others(): MediaStreamTrack[];
|
|
541
|
+
/** The publisher allows other players' voices in videos (`Multiplayer.RecordVoices`). */
|
|
542
|
+
recordOthers(): boolean;
|
|
543
|
+
/** Called when tracks come or go (a player joined, the mic went on). */
|
|
544
|
+
subscribe(listener: () => void): () => void;
|
|
545
|
+
}
|
|
546
|
+
/** `ctx.clips`. */
|
|
547
|
+
interface ClipsRegistry {
|
|
548
|
+
/**
|
|
549
|
+
* A bright moment right now. `weight` 1–10 (default 5): how much it is worth showing — a boss
|
|
550
|
+
* kill 8, a level-up 4. Close marks merge into one clip (their weights add up).
|
|
551
|
+
*/
|
|
552
|
+
mark(name: string, weight?: number): void;
|
|
553
|
+
/** The multiplayer system registers the room's voices here; `null` when the room is gone. */
|
|
554
|
+
setVoiceSource(source: RecordingVoiceSource | null): void;
|
|
555
|
+
/** This player is making a long recording right now. */
|
|
556
|
+
isRecording(): boolean;
|
|
557
|
+
/** Called when `isRecording` changes. */
|
|
558
|
+
subscribe(listener: () => void): () => void;
|
|
559
|
+
}
|
|
560
|
+
|
|
528
561
|
/** What a module is, for catalog/UI purposes. Not every module is a game. */
|
|
529
562
|
type ModuleType = "game" | "app" | "ai-app";
|
|
530
563
|
/**
|
|
@@ -750,6 +783,12 @@ interface ModuleContext {
|
|
|
750
783
|
* one look, one queue, one sound for the whole app. The module's own id is the default `source`.
|
|
751
784
|
*/
|
|
752
785
|
notifications: AppNotifications;
|
|
786
|
+
/**
|
|
787
|
+
* The platform's video recording (see `ClipsRegistry`): a game marks bright moments
|
|
788
|
+
* (`ctx.clips.mark("boss_down", 8)`) — they become the player's "Best moments" clips on
|
|
789
|
+
* idosgames.com. A no-op anywhere else.
|
|
790
|
+
*/
|
|
791
|
+
clips: ClipsRegistry;
|
|
753
792
|
}
|
|
754
793
|
/**
|
|
755
794
|
* A module's debug surface for the agent: read its state, drive it with named actions.
|
|
@@ -842,6 +881,21 @@ interface EngineScene {
|
|
|
842
881
|
* host falls back to reading the canvas itself, which is correct for 2D canvases.
|
|
843
882
|
*/
|
|
844
883
|
capture?(): Promise<Blob | null>;
|
|
884
|
+
/**
|
|
885
|
+
* Where the action is right now, 0–1 on both axes of the canvas (the player, the explosion) — for
|
|
886
|
+
* the platform's video recording: a vertical (TikTok) cut of a landscape game follows this point
|
|
887
|
+
* instead of cutting the middle. Called a few times a second; keep it cheap. Omit — the centre.
|
|
888
|
+
*/
|
|
889
|
+
focus?(): {
|
|
890
|
+
x: number;
|
|
891
|
+
y: number;
|
|
892
|
+
} | null;
|
|
893
|
+
/**
|
|
894
|
+
* The game's own sound as a MediaStream, for the platform's video recording — e.g. a
|
|
895
|
+
* `MediaStreamAudioDestinationNode` your audio graph also feeds (Three.js: `listener.context`).
|
|
896
|
+
* Omit — videos carry the voices but not the game's sound.
|
|
897
|
+
*/
|
|
898
|
+
audio?(): MediaStream | null;
|
|
845
899
|
/** Permanent teardown — dispose GPU resources, remove listeners. */
|
|
846
900
|
destroy(): void;
|
|
847
901
|
}
|
|
@@ -930,4 +984,4 @@ interface SharedEventBus<Events extends Record<string, unknown> = Record<string,
|
|
|
930
984
|
/** Identity helper that pins a module literal to the `Module` type for editor help and errors. */
|
|
931
985
|
declare function defineModule(module: Module): Module;
|
|
932
986
|
|
|
933
|
-
export { type AppNotifications, type CapturedContent, type ContentFileData, type ContentRegistry, type ContentTypeHandler, type DownloadedContent, type EngineScene, type FeatureDefinition, type FeatureEntry, type FeatureGroup, type FeaturePresenter, type FeatureRegistry, type FeatureScreenProps, type InferShape, type LoadingReporter, type LoadingTask, type LobbyHeroAction, type LobbyHeroDefinition, type LobbyHeroStage, type LobbyHeroView, type LobbyRegistry, type LocalContentItem, type ModeEntry, type ModeRegistry, type Module, type ModuleAgentApi, type ModuleAuthor, type ModuleContext, type ModuleEngine, type ModuleEventEmit, type ModuleEventListen, type ModuleEvents, type ModuleEventsManifest, type ModuleManifest, type ModuleMedia, type ModuleMeta, type ModuleSharedUi, type ModuleType, type MultiplayerGame, type MultiplayerRegistry, type MultiplayerRoom, type MultiplayerScreenArgs, type MultiplayerSetting, type NotificationAction, type NotificationInput, type NotificationLevel, type PanelSlot, type RouteEntry, SHARED_UI_ROLES, type SceneMountContext, type Shape, type ShapeDescriptor, type ShapeLeaf, type ShapeLeafSpec, type SharedEventBus, type SharedUiContext, type SharedUiRole, type SurfaceAllocator, type SurfaceHandle, type SurfaceKind, TOPIC_NAME_RE, type Topic, type TopicName, type TopicPayload, type UiPanel, defineModule, defineTopic, hostTopics, isSharedUiRole, isTopicName, shape, topicNamespace };
|
|
987
|
+
export { type AppNotifications, type CapturedContent, type ClipsRegistry, type ContentFileData, type ContentRegistry, type ContentTypeHandler, type DownloadedContent, type EngineScene, type FeatureDefinition, type FeatureEntry, type FeatureGroup, type FeaturePresenter, type FeatureRegistry, type FeatureScreenProps, type InferShape, type LoadingReporter, type LoadingTask, type LobbyHeroAction, type LobbyHeroDefinition, type LobbyHeroStage, type LobbyHeroView, type LobbyRegistry, type LocalContentItem, type ModeEntry, type ModeRegistry, type Module, type ModuleAgentApi, type ModuleAuthor, type ModuleContext, type ModuleEngine, type ModuleEventEmit, type ModuleEventListen, type ModuleEvents, type ModuleEventsManifest, type ModuleManifest, type ModuleMedia, type ModuleMeta, type ModuleSharedUi, type ModuleType, type MultiplayerGame, type MultiplayerRegistry, type MultiplayerRoom, type MultiplayerScreenArgs, type MultiplayerSetting, type NotificationAction, type NotificationInput, type NotificationLevel, type PanelSlot, type RecordingVoiceSource, type RouteEntry, SHARED_UI_ROLES, type SceneMountContext, type Shape, type ShapeDescriptor, type ShapeLeaf, type ShapeLeafSpec, type SharedEventBus, type SharedUiContext, type SharedUiRole, type SurfaceAllocator, type SurfaceHandle, type SurfaceKind, TOPIC_NAME_RE, type Topic, type TopicName, type TopicPayload, type UiPanel, defineModule, defineTopic, hostTopics, isSharedUiRole, isTopicName, shape, topicNamespace };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RealtimeSession, IDosGamesClient } from '@idosgames/core';
|
|
1
|
+
import { RealtimeSession, VoiceController, IDosGamesClient } from '@idosgames/core';
|
|
2
2
|
export { IDosGamesClient, SdkEvents } from '@idosgames/core';
|
|
3
3
|
import { ComponentType } from 'react';
|
|
4
4
|
|
|
@@ -345,6 +345,13 @@ interface MultiplayerRoom {
|
|
|
345
345
|
readonly lateJoin: boolean;
|
|
346
346
|
/** Leave the room for good: closes the session and the rooms screen forgets it. */
|
|
347
347
|
leave(): Promise<void>;
|
|
348
|
+
/**
|
|
349
|
+
* The room's voice chat, or `null` when the room has none. The rooms system owns it and draws its
|
|
350
|
+
* controls (the mic button over the game included); a game reads it for its own touches — who is
|
|
351
|
+
* speaking (`isSpeaking`, `on("change")`), a talking player's marker, proximity volume
|
|
352
|
+
* (`setPeerVolume` by distance).
|
|
353
|
+
*/
|
|
354
|
+
readonly voice: VoiceController | null;
|
|
348
355
|
}
|
|
349
356
|
/** What `ctx.features.open("multiplayer", args)` understands. */
|
|
350
357
|
interface MultiplayerScreenArgs {
|
|
@@ -525,6 +532,32 @@ interface AppNotifications {
|
|
|
525
532
|
dismiss(id: string): void;
|
|
526
533
|
}
|
|
527
534
|
|
|
535
|
+
/** The room's voices, as the recording takes them (the multiplayer system provides this). */
|
|
536
|
+
interface RecordingVoiceSource {
|
|
537
|
+
/** This player's microphone track (silent while not transmitting); null — mic off. */
|
|
538
|
+
mic(): MediaStreamTrack | null;
|
|
539
|
+
/** Other players' voice tracks. */
|
|
540
|
+
others(): MediaStreamTrack[];
|
|
541
|
+
/** The publisher allows other players' voices in videos (`Multiplayer.RecordVoices`). */
|
|
542
|
+
recordOthers(): boolean;
|
|
543
|
+
/** Called when tracks come or go (a player joined, the mic went on). */
|
|
544
|
+
subscribe(listener: () => void): () => void;
|
|
545
|
+
}
|
|
546
|
+
/** `ctx.clips`. */
|
|
547
|
+
interface ClipsRegistry {
|
|
548
|
+
/**
|
|
549
|
+
* A bright moment right now. `weight` 1–10 (default 5): how much it is worth showing — a boss
|
|
550
|
+
* kill 8, a level-up 4. Close marks merge into one clip (their weights add up).
|
|
551
|
+
*/
|
|
552
|
+
mark(name: string, weight?: number): void;
|
|
553
|
+
/** The multiplayer system registers the room's voices here; `null` when the room is gone. */
|
|
554
|
+
setVoiceSource(source: RecordingVoiceSource | null): void;
|
|
555
|
+
/** This player is making a long recording right now. */
|
|
556
|
+
isRecording(): boolean;
|
|
557
|
+
/** Called when `isRecording` changes. */
|
|
558
|
+
subscribe(listener: () => void): () => void;
|
|
559
|
+
}
|
|
560
|
+
|
|
528
561
|
/** What a module is, for catalog/UI purposes. Not every module is a game. */
|
|
529
562
|
type ModuleType = "game" | "app" | "ai-app";
|
|
530
563
|
/**
|
|
@@ -750,6 +783,12 @@ interface ModuleContext {
|
|
|
750
783
|
* one look, one queue, one sound for the whole app. The module's own id is the default `source`.
|
|
751
784
|
*/
|
|
752
785
|
notifications: AppNotifications;
|
|
786
|
+
/**
|
|
787
|
+
* The platform's video recording (see `ClipsRegistry`): a game marks bright moments
|
|
788
|
+
* (`ctx.clips.mark("boss_down", 8)`) — they become the player's "Best moments" clips on
|
|
789
|
+
* idosgames.com. A no-op anywhere else.
|
|
790
|
+
*/
|
|
791
|
+
clips: ClipsRegistry;
|
|
753
792
|
}
|
|
754
793
|
/**
|
|
755
794
|
* A module's debug surface for the agent: read its state, drive it with named actions.
|
|
@@ -842,6 +881,21 @@ interface EngineScene {
|
|
|
842
881
|
* host falls back to reading the canvas itself, which is correct for 2D canvases.
|
|
843
882
|
*/
|
|
844
883
|
capture?(): Promise<Blob | null>;
|
|
884
|
+
/**
|
|
885
|
+
* Where the action is right now, 0–1 on both axes of the canvas (the player, the explosion) — for
|
|
886
|
+
* the platform's video recording: a vertical (TikTok) cut of a landscape game follows this point
|
|
887
|
+
* instead of cutting the middle. Called a few times a second; keep it cheap. Omit — the centre.
|
|
888
|
+
*/
|
|
889
|
+
focus?(): {
|
|
890
|
+
x: number;
|
|
891
|
+
y: number;
|
|
892
|
+
} | null;
|
|
893
|
+
/**
|
|
894
|
+
* The game's own sound as a MediaStream, for the platform's video recording — e.g. a
|
|
895
|
+
* `MediaStreamAudioDestinationNode` your audio graph also feeds (Three.js: `listener.context`).
|
|
896
|
+
* Omit — videos carry the voices but not the game's sound.
|
|
897
|
+
*/
|
|
898
|
+
audio?(): MediaStream | null;
|
|
845
899
|
/** Permanent teardown — dispose GPU resources, remove listeners. */
|
|
846
900
|
destroy(): void;
|
|
847
901
|
}
|
|
@@ -930,4 +984,4 @@ interface SharedEventBus<Events extends Record<string, unknown> = Record<string,
|
|
|
930
984
|
/** Identity helper that pins a module literal to the `Module` type for editor help and errors. */
|
|
931
985
|
declare function defineModule(module: Module): Module;
|
|
932
986
|
|
|
933
|
-
export { type AppNotifications, type CapturedContent, type ContentFileData, type ContentRegistry, type ContentTypeHandler, type DownloadedContent, type EngineScene, type FeatureDefinition, type FeatureEntry, type FeatureGroup, type FeaturePresenter, type FeatureRegistry, type FeatureScreenProps, type InferShape, type LoadingReporter, type LoadingTask, type LobbyHeroAction, type LobbyHeroDefinition, type LobbyHeroStage, type LobbyHeroView, type LobbyRegistry, type LocalContentItem, type ModeEntry, type ModeRegistry, type Module, type ModuleAgentApi, type ModuleAuthor, type ModuleContext, type ModuleEngine, type ModuleEventEmit, type ModuleEventListen, type ModuleEvents, type ModuleEventsManifest, type ModuleManifest, type ModuleMedia, type ModuleMeta, type ModuleSharedUi, type ModuleType, type MultiplayerGame, type MultiplayerRegistry, type MultiplayerRoom, type MultiplayerScreenArgs, type MultiplayerSetting, type NotificationAction, type NotificationInput, type NotificationLevel, type PanelSlot, type RouteEntry, SHARED_UI_ROLES, type SceneMountContext, type Shape, type ShapeDescriptor, type ShapeLeaf, type ShapeLeafSpec, type SharedEventBus, type SharedUiContext, type SharedUiRole, type SurfaceAllocator, type SurfaceHandle, type SurfaceKind, TOPIC_NAME_RE, type Topic, type TopicName, type TopicPayload, type UiPanel, defineModule, defineTopic, hostTopics, isSharedUiRole, isTopicName, shape, topicNamespace };
|
|
987
|
+
export { type AppNotifications, type CapturedContent, type ClipsRegistry, type ContentFileData, type ContentRegistry, type ContentTypeHandler, type DownloadedContent, type EngineScene, type FeatureDefinition, type FeatureEntry, type FeatureGroup, type FeaturePresenter, type FeatureRegistry, type FeatureScreenProps, type InferShape, type LoadingReporter, type LoadingTask, type LobbyHeroAction, type LobbyHeroDefinition, type LobbyHeroStage, type LobbyHeroView, type LobbyRegistry, type LocalContentItem, type ModeEntry, type ModeRegistry, type Module, type ModuleAgentApi, type ModuleAuthor, type ModuleContext, type ModuleEngine, type ModuleEventEmit, type ModuleEventListen, type ModuleEvents, type ModuleEventsManifest, type ModuleManifest, type ModuleMedia, type ModuleMeta, type ModuleSharedUi, type ModuleType, type MultiplayerGame, type MultiplayerRegistry, type MultiplayerRoom, type MultiplayerScreenArgs, type MultiplayerSetting, type NotificationAction, type NotificationInput, type NotificationLevel, type PanelSlot, type RecordingVoiceSource, type RouteEntry, SHARED_UI_ROLES, type SceneMountContext, type Shape, type ShapeDescriptor, type ShapeLeaf, type ShapeLeafSpec, type SharedEventBus, type SharedUiContext, type SharedUiRole, type SurfaceAllocator, type SurfaceHandle, type SurfaceKind, TOPIC_NAME_RE, type Topic, type TopicName, type TopicPayload, type UiPanel, defineModule, defineTopic, hostTopics, isSharedUiRole, isTopicName, shape, topicNamespace };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idosgames/module-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "The composable-module contract for the iDosGames host shell: Module / ModuleContext types plus tiny authoring helpers. Framework-neutral at runtime — a module can be a game (Three/Phaser), a plain app, or an AI app.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"//": "@idosgames/core is a real range, not '*': a published contract must name the version of core whose IDosGamesClient/SdkEvents shapes it references. Bump in step with core (see RELEASING.md). react is an OPTIONAL peer — the contract references React's ComponentType type only (a UI panel is a React component), which is erased at build, so a runtime-only module needs no React.",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@idosgames/core": "^0.
|
|
49
|
+
"@idosgames/core": "^0.22.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"react": "^18.3.1 || ^19.0.0"
|