Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Unity/Assets/_SecondSpawn/Scripts/AI/AgentContextDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ public sealed class AgentContextDto
public BodyProfileDto body;
}

[Serializable]
public sealed class ActorProfileDto
{
public string actor_id;
public string actor_type;
public string owner_player_id;
public string display_name;
public BodyProfileDto body;
public MemoryRecordDto[] memory;
public AgentRuntimeDto agent_runtime;
public AgentActivityRecordDto[] agent_activity;
Comment on lines +20 to +22
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The ActorProfileDto contains memory, agent_runtime, and agent_activity fields at the root level, but these fields also exist within the BodyProfileDto (lines 47-49). This duplication creates inconsistency between the player profile (which uses body.memory) and the actor profile. It is recommended to move these behavioral state fields into the body object for actors as well, ensuring a consistent interface for all entities.

public string created_at;
public string updated_at;
}

[Serializable]
public sealed class PlayerProfileDto
{
Expand Down Expand Up @@ -165,6 +180,32 @@ public sealed class UpdateSoulRequestDto
public AgentPolicyDto agent_policy;
}

[Serializable]
public sealed class ActorProfileRequestDto
{
public string actor_id;
public string actor_type = "npc";
public string display_name;
public string archetype_id;
public string visual_prefab_key;
public CharacterStatsDto stats;
public CharacterTraitsDto characteristics;
public BodyTimeDto time;
public CultivationDto cultivation;
public SoulProfileDto soul;
public AgentPolicyDto agent_policy;
}

[Serializable]
public sealed class ActorMemoryAddRequestDto
{
public string actor_id;
public string id;
public string kind = "system";
public string summary;
public int importance = 5;
}

[Serializable]
public sealed class AgentDecisionRequestDto
{
Expand Down
15 changes: 15 additions & 0 deletions Unity/Assets/_SecondSpawn/Scripts/AI/SecondSpawnGatewayClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,21 @@ public IEnumerator AddNakamaMemory(MemoryRecordDto memory, Action<AgentContextDt
yield return SendNakamaRpc("secondspawn_memory_add", memory, onSuccess, onError);
}

public IEnumerator GetNakamaActorProfile(string actorId, Action<ActorProfileDto> onSuccess, Action<string> onError = null)
{
yield return GetNakamaActorProfile(new ActorProfileRequestDto { actor_id = actorId }, onSuccess, onError);
}

public IEnumerator GetNakamaActorProfile(ActorProfileRequestDto request, Action<ActorProfileDto> onSuccess, Action<string> onError = null)
{
yield return SendNakamaRpc("secondspawn_actor_profile_get", request, onSuccess, onError);
}

public IEnumerator AddNakamaActorMemory(ActorMemoryAddRequestDto memory, Action<ActorProfileDto> onSuccess = null, Action<string> onError = null)
{
yield return SendNakamaRpc("secondspawn_actor_memory_add", memory, onSuccess, onError);
}

public IEnumerator AddNakamaAgentActivity(AgentActivityRecordDto activity, Action<AgentContextDto> onSuccess = null, Action<string> onError = null)
{
yield return SendNakamaRpc("secondspawn_agent_activity_add", activity, onSuccess, onError);
Expand Down
Loading
Loading