feat: add world voxel snapshot forwarding
Collect chunk voxel data from the bot world and stream snapshot, chunk, and unwatch messages through the forward protocol.
This commit is contained in:
+53
-1
@@ -41,7 +41,59 @@ export interface JoinReady {
|
||||
}
|
||||
|
||||
export type RelayMethod = 'bot.snapshot' | 'bot.logs' | 'bot.chat' | 'get_log_history' | 'tab_complete'
|
||||
| 'get_context_info' | 'execute_function' | 'get_data_file_list' | 'get_file_data' | keyof WorkflowPayloads;
|
||||
| 'get_context_info' | 'execute_function' | 'get_data_file_list' | 'get_file_data' | keyof WorkflowPayloads | keyof WorldPayloads;
|
||||
|
||||
export interface WorldRevision {x: number; z: number; revision: string}
|
||||
|
||||
export interface WorldPayloads {
|
||||
'world.snapshot': {radius: number; known: WorldRevision[]; world_generation?: string; watch_id?: string};
|
||||
'world.chunk': {x: number; z: number; world_generation: string; watch_id: string};
|
||||
'world.unwatch': {watch_id: string};
|
||||
}
|
||||
|
||||
export interface WorldVoxelChunk extends WorldRevision {
|
||||
world_generation: string;
|
||||
min_y: number;
|
||||
height: number;
|
||||
palette: Array<{name: string; color: number; properties: Record<string, string | number | boolean>; occluding: boolean}>;
|
||||
// y is an offset from min_y in units of 16, including when min_y is not aligned.
|
||||
// Each canonical base64 section holds 4096 UInt16LE indices at localY * 256 + z * 16 + x.
|
||||
sections: Array<{y: number; blocks: string}>;
|
||||
}
|
||||
|
||||
export interface WorldChunk extends WorldRevision {
|
||||
palette: Array<{name: string; color: number}>;
|
||||
// All arrays are canonical base64 of 256 UInt16LE values, indexed by z * 16 + x.
|
||||
heights: string;
|
||||
blocks: string;
|
||||
// Emitted together when a fluid is visible; heights of zero mean no entry.
|
||||
terrain?: {heights: string; blocks: string};
|
||||
fluids?: {heights: string; blocks: string; levels: string};
|
||||
// Bases mirror terrain ?? top except for fully sampled spike columns.
|
||||
spikes?: {heights: string; blocks: string; segments: Array<{
|
||||
index: number; height: number; direction: 'up' | 'down';
|
||||
thickness: 'tip' | 'tip_merge' | 'frustum' | 'middle' | 'base';
|
||||
}>};
|
||||
features?: {heights: string; blocks: string; entries: Array<{
|
||||
index: number; height: number; block: number; properties: Record<string, string | number | boolean>;
|
||||
}>};
|
||||
}
|
||||
|
||||
export interface WorldSnapshot {
|
||||
world_generation: string;
|
||||
context_generation: string;
|
||||
stream_id: string;
|
||||
watch_id: string;
|
||||
version: string;
|
||||
dimension: string;
|
||||
min_y: number;
|
||||
height: number;
|
||||
center: {x: number; z: number};
|
||||
position: {x: number; y: number; z: number; yaw: number};
|
||||
chunks: WorldChunk[];
|
||||
loaded: WorldRevision[];
|
||||
partial: boolean;
|
||||
}
|
||||
|
||||
export interface WorkflowPayloads {
|
||||
'workflow.start': {workflow_id: string; trigger?: Record<string, Json>};
|
||||
|
||||
Reference in New Issue
Block a user