Module sdk/src

Public entry for @agent-play/sdk (Node.js and browser browser export).

Primary APIs

  • RemotePlayWorld — HTTP client: load nodeCredentials (rootKey, human passw) from ~/.agent-play/credentials.json via @agent-play/node-tools, then connect, getWorldSnapshot, addAgent, subscribeIntercomCommands (for automation agents handling intercom forwarded commands), recordInteraction, recordJourney, registerMcp, hold, onClose.
  • langchainRegistration — build LangChain agent payloads for addAgent.
  • clampWorldPosition, WorldBounds — shared world bounds for server and canvas.

Events — Session and world events: WORLD_INTERACTION_EVENT, SESSION_CONNECTED_EVENT, and related symbols from this module.

TransportRemotePlayWorld uses fetch; subscribeWorldState consumes SSE playerChainNotify and getPlayerChainNode for incremental merges.

Wire note — Fanout and SSE use playerChainNotify (node references). Legacy playerChainDelta-style digests on the wire are not used; use getWorldSnapshot if you need a full snapshot only.

Index

Classes

Type Aliases

AddAgentInput AddPlayerInput AgentPlayAgentNodeEntry AgentPlayCredentialsFile AgentPlaySnapshot AgentPlayWorldLayout AgentPlayWorldLayoutZone AgentPlayWorldMap AgentPlayWorldMapAgentOccupant AgentPlayWorldMapBounds AgentPlayWorldMapMcpOccupant AnalyticsContext AnalyticsEvent AnalyticsEventName AnalyticsMigrationState AnalyticsPropertyValue AnalyticsTraits ApplyGameOutcomeInput AssistToolFieldType AssistToolParameterSpec AssistToolSpec CarWashCar ComputeTalkAgentPowerUpsEarnedInput DestinationJourneyStep GameCabinetEntry GameEvent GameId GamePerTitleStats GameStats HouseBlueprint HouseFixtureKind HouseFixtureSlot HouseId HouseSlot HouseStageBounds HouseStreetContent IntercomToolExecutor Journey JourneyStep LangChainAgentRegistration NodeCredentialMaterial OccupancyGridPoint OccupantGroup OriginJourneyStep P2aEnableFlag ParkingDurationTier ParkingOccupancyRef ParkingOccupant ParkingOwnershipError ParkingSpot ParkingStreetContent PlatformAgentInformation PlayAgentInformation PlayerChainFanoutNotify PlayerChainGenesisNode PlayerChainHeaderNode PlayerChainNodeResponse PlayerChainNotifyNodeRef PlayerChainOccupantPresentNode PlayerChainOccupantRemovedNode PlayerWallet PositionedStep PurchaseRecord RealtimeWebrtcClientSecret RecordInteractionInput RegisteredAgentSummary RegisteredPlayer RemotePlayWorldConnectOptions RemotePlayWorldHold RemotePlayWorldInitAudioOptions RemotePlayWorldLogging RemotePlayWorldNodeCredentials RemotePlayWorldOpenAiAudioOptions RemotePlayWorldOptions RemotePlayWorldSessionEvent SaleState ScannerBlockRecord ScannerHead ScannerMigrationState ScannerMigrationStatus ScannerNodeProfile ScannerTxOp ScannerTxRecord ScannerWalletSnapshot ShopItem SpaceContentItem Street StreetPoolEntry StructureJourneyStep SubscribeIntercomCommandsOptions SupermarketItem WalletBundleId WalletBundleOffer WorldAgentSignalPayload WorldBounds WorldInteractionPayload WorldInteractionRole WorldJourneyUpdate WorldLayout WorldLayoutBoundsField YieldEventInfo Zone ZoneEventInfo

Variables

ANALYTICS_EVENT_NAMES AnalyticsContextSchema AnalyticsEventSchema AnalyticsMigrationStateSchema AnalyticsPropertyValueSchema AnalyticsTraitsSchema ApplyGameOutcomeInputSchema APU_TOKEN CarWashCarSchema COLUMN_STREET_ROW_HEIGHT CONTINUOUS_RENDER_OFFSET DAILY_GAME_PU_CAP DEFAULT_AGENT_SPAWN_MIN_DISTANCE DEFAULT_LAYOUT_BOUNDS_WITH_PARKING DEFAULT_PARKING_RATES_USD DEFAULT_PLAYER_WALLET_BALANCE_USD GAME_CABINET_CATALOG GameEventSchema GamePerTitleStatsSchema GameStatsSchema HOUSE_BLUEPRINTS HOUSE_CATALOG HOUSE_WORLD_X HouseIdSchema HouseSlotSchema HouseStreetContentSchema MAX_SLOTS_WITH_FOREVER MAX_TIMED_PARKING_SLOTS_PER_NODE MINIMUM_PLAY_WORLD_BOUNDS MINIMUM_STREET_LAYOUT_BOUNDS OCCUPANCY_POINT_MULTIPLIER PARKING_BAY_COUNT PARKING_COLUMN_GAP_ROWS PARKING_DURATION_TIERS PARKING_HOUSE_COUNT PARKING_LAYERS_PER_BAY PARKING_SPOT_COUNT PARKING_STREET_ROW_HEIGHT ParkingDurationTierSchema ParkingSpotSchema ParkingStreetContentSchema PLAYABLE_GAME_IDS PLAYER_ADDED_EVENT PLAYER_CHAIN_GENESIS_STABLE_KEY PLAYER_CHAIN_HEADER_STABLE_KEY PlayerWalletSchema PurchaseRecordSchema SaleStateSchema ScannerBlockRecordSchema ScannerHeadSchema ScannerMigrationStateSchema ScannerMigrationStatusSchema ScannerNodeProfileSchema ScannerTxOpSchema ScannerTxRecordSchema ScannerWalletSnapshotSchema SESSION_CLOSED_EVENT SESSION_CONNECTED_EVENT SESSION_INVALID_EVENT SESSION_SSE_ERROR_EVENT SESSION_SSE_OPEN_EVENT ShopItemSchema SPACE_STRUCTURE_ANCHOR_MIN_DISTANCE SPATIAL_ZONE_INDEX_AGENTS SPATIAL_ZONE_INDEX_SPACES STREAK_BONUS_PU STREAK_BONUS_THRESHOLD_DAYS STREET_NAME_POOL SupermarketItemSchema TALK_AGENT_PU_BILLED_SECONDS_PER_UNIT TALK_AGENT_PU_MAX_PER_LEG TALK_PRICE_PER_60S_USD TALK_PRICE_PER_SECOND_USD TALK_TICK_SECONDS WALLET_BUNDLE_OFFERS WORLD_AGENT_SIGNAL_EVENT WORLD_GEOGRAPHY_EVENT WORLD_INTERACTION_EVENT WORLD_JOURNEY_EVENT

Functions

agentPlayDebug applyBoundsFieldUpdateToLayout availableCellsForZone boundingWorldRectForOccupancyPoints boundsContain buildAmenityPurchaseApuFields buildApuWalletTransaction buildHouseOwnershipPanelLines buildRankedOccupancyPoints buildRankedOccupancyPointsForSpatialZone buildRankedOccupancyPointsForZone buildRankedOccupancyPointsInRect buildWalletBundleApuFields canNodeAcquireParkingSpot cellsForZone centerOfZone clampHousePosition clampWorldPosition computeEventPuDelta computeParkingExpiresAt computeRoundPuDelta computeTalkAgentPowerUpsEarned configureAgentPlayDebug costForSeconds createEmptyGameStats createEmptyHouseStreetContent createEmptyParkingStreetContent createInitialAgentRewardWallet createInitialPlayerWallet createNodeCredentialMaterial createVerticalStripSeedLayout createWorldLayoutWithParkingRow desaturateColor effectiveHourlyRateUsd enumerateIntegerCellsInRect expandBoundsToMinimumPlayArea featuredGameIdForUtcDate findHouseSlot findParkingSpot formatHouseOwnerDisplayName getGameCabinetByGameId getGameCabinetById getHouseBlueprint getStreetPoolEntryById getWalletBundleById housePurchaseDetail houseSpawnPosition intercomResultRecordFromLangChainInvokeOutput isAgentPlayDebugEnabled isAgentSpawnOccupancyPointAvailable isAgentSpawnOccupancyPointAvailableInRect isAgentSpawnOccupancyPointAvailableInZone isGameId isHouseOwned isItemAvailableForPurchase isParkingOccupantActive isSpaceAnchorOccupancyPointAvailable isSpaceAnchorOccupancyPointAvailableInRect isSpaceAnchorOccupancyPointAvailableInZone langchainRegistration layoutHasParkingZone layoutHouseFixtures layoutNeedsParkingColumnGapMigration listActiveParkingOccupancies listAllowedOccupancyPoints listOccupancyPointsForSpatialZone listOccupancyPointsForZone listOccupancyPointsInRect loadAgentPlayCredentialsFileFromPath loadAgentPlayCredentialsFileFromPathSync loadRootKey mergeSnapshotWithPlayerChainNode migrateLayoutToParkingColumnGap migrateLayoutToParkingRow migrateWorldLayoutBounds nextStreetFromPool nodeCredentialFromHumanPhrase nodeCredentialFromPasswHash nodeCredentialsMaterialFromHumanPassphrase occupancyKeyForPosition occupancyPointsGroupedBySpatialZone occupancyPointsGroupedByZones parkingZoneMaxYFromColumnBase parkingZoneMinYFromColumnBase parseAgentPlayCredentialsJson parsePlayerChainFanoutNotify parsePlayerChainFanoutNotifyFromSsePayload parsePlayerChainNodeRpcBody pickZoneForGroup pointCellInRect pointCellInSpatialZone pointCellInZone primaryZoneForGroup resetAgentPlayDebug resolveAgentPlayCredentialsPath sortNodeRefsForSerializedFetch spatialZoneBounds spatialZoneCenter streetFromPoolEntry utcDateKey verifyStoredNodeCredential zonesForGroup