import { type HelixEventDecl, type InteractableBudget } from '@hypersoniclabs/helix-manifest'; import { HelixApi } from './api'; import { type CliCredentials } from './config'; type JsonObject = Record; export type InteractablePlacementTransform = { position: [number, number, number]; yawDeg: number; scale: number; }; export type InteractableCapsReport = InteractableBudget & { phases: number; zones: number; events: number; actions: number; limits: Record; percentages: Record; }; export type InteractableCapName = 'rules' | 'roomVars' | 'playerVars' | 'timers' | 'phases' | 'zones' | 'events' | 'actions'; export type AddInteractableResult = { itemId: string; id: string; version: string; checksumSha256: string; destination: string; manifestPath: string; clientGluePath: string; moduleId?: string; bank?: string; namespace: string; grammarPrefix: string; caps: InteractableCapsReport; warnings: string[]; noOp: boolean; }; export type AddInteractableApi = Pick; export type AddInteractableDeps = { api?: AddInteractableApi; fetchBytes?: (url: string) => Promise; }; /** Stable public module id for one placement; long package ids retain a readable prefix plus a collision hash. */ export declare function interactableModuleId(id: string, instance: number): string; export declare function namespaceInteractableFragment(wrapperValue: unknown, slug: string, instance: number, placement: InteractablePlacementTransform): { multiplayer: JsonObject; namespace: string; grammarPrefix: string; actionNames: Record; ruleIds: string[]; warnings: string[]; }; export type InteractableModuleContribution = { moduleId: string; bank: string; module: JsonObject; minPlayers: number; namespace: string; grammarPrefix: string; actionNames: Record; ruleIds: string[]; caps: InteractableCapsReport; warnings: string[]; }; /** * Turn one verified package fragment into a module-v1 manifest entry. Rules stay in the immutable bank; * declarations remain bare/local and placement remains in installed.json for the trusted packer envelope. */ export declare function moduleInteractableFragment(wrapperValue: unknown, id: string, version: string, checksumSha256: string, instance: number): InteractableModuleContribution; /** Add/replace no flat declarations: one module entry is the entire server-side composition unit. */ export declare function composeInteractableModuleManifest(worldValue: unknown, contribution: InteractableModuleContribution, options?: { replace?: { moduleId: string; expected: JsonObject; }; }): { manifest: JsonObject; caps: InteractableCapsReport; warnings: string[]; }; export declare function composeInteractableManifest(worldValue: unknown, contribution: JsonObject, alreadyInstalled: number): { manifest: JsonObject; caps: InteractableCapsReport; warnings: string[]; }; /** The world-event contract a bank fragment depends on: the host's declared events and its export list. */ export type WorldEventContract = Record; type FragmentWorldImport = { from: string; event: string; as?: string; }; /** Every `from: "world"` import a fragment declares. Tolerant of malformed input: the validator reports shape. */ export declare function worldImportsOf(fragment: unknown): FragmentWorldImport[]; /** What a host world actually offers a bank: its declared `multiplayer.events` and the subset it `exports`. */ export declare function worldEventContractOf(world: unknown): { events: WorldEventContract; exports: string[]; }; /** * Validate a verified bank fragment against the world it is being installed into. * * `validateInteractableServerFragment` can only resolve a fragment's `from: "world"` imports when it * is told which events the host exports; called bare, every such import fails as "world does not * export …" and every `event.payload.*` reference as "declared fields: none" (helix-creator-cli#122). * At install time the real host is known, so the fragment is checked against what the world will * genuinely export, and a world that does not export an imported event is refused with the fix named. */ export declare function validateFragmentAgainstWorld(fragment: unknown, world: unknown): { valid: true; budget: InteractableBudget; multiplayer: import("@hypersoniclabs/helix-manifest").HelixMultiplayerConfig; } | { valid: false; errors: string[]; }; export declare function addInteractable(worldDir: string, ref: string, options?: { apiUrl?: string; credentials?: CliCredentials; placement?: Partial; onProgress?: (message: string) => void; deps?: AddInteractableDeps; }): Promise; export declare function parseInteractablePosition(value: string): [number, number, number]; /** The instance ordinal survives ONLY inside the conceptual namespace (`itx...`). */ export declare function instanceOrdinalOf(namespace: string): number; export declare function subtractInteractableContribution(worldValue: unknown, contribution: JsonObject): { world: JsonObject; missingRules: string[]; }; export type UpdateInteractableResult = { itemId: string; id: string; fromVersions: string[]; version: string; checksumSha256: string; destination: string; manifestPath: string; clientGluePath: string; /** How many placed instances moved (0 on a no-op). */ instances: number; moduleBudgets: Array<{ moduleId: string; bank: string; caps: InteractableCapsReport; }>; caps: InteractableCapsReport; warnings: string[]; noOp: boolean; }; export declare function updateInteractable(worldDir: string, ref: string, options?: { apiUrl?: string; credentials?: CliCredentials; onProgress?: (message: string) => void; deps?: AddInteractableDeps; }): Promise; export {};