more fixes for testing

This commit is contained in:
Jacob Dubin
2026-04-16 07:18:33 -05:00
parent b1069805bf
commit 500b54a6b6
8 changed files with 292 additions and 19 deletions

View File

@@ -48,11 +48,10 @@ public sealed class ResponsePlanToSocketMessagesMapper
messages.Add(new SocketReplyPlan(JsonSerializer.Serialize(new
{
type = "EOS",
data = new
{
sessionId = plan.SessionId,
transID = transId
}
ts = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
msgID = CreateHubMessageId(),
transID = transId,
data = new { }
})));
if (emitSkillActions && speak is not null)
@@ -99,11 +98,10 @@ public sealed class ResponsePlanToSocketMessagesMapper
new SocketReplyPlan(JsonSerializer.Serialize(new
{
type = "EOS",
data = new
{
sessionId = session.SessionId,
transID = transId
}
ts = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
msgID = CreateHubMessageId(),
transID = transId,
data = new { }
})),
new SocketReplyPlan(JsonSerializer.Serialize(BuildGenericFallbackSkillPayload(transId)), DelayMs: 75)
];
@@ -138,7 +136,7 @@ public sealed class ResponsePlanToSocketMessagesMapper
{
type = "SKILL_ACTION",
ts = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
msgID = $"msg-{Guid.NewGuid():N}",
msgID = CreateHubMessageId(),
transID = transId,
data = new
{
@@ -163,9 +161,7 @@ public sealed class ResponsePlanToSocketMessagesMapper
prompt_id = "RUNTIME_PROMPT",
prompt_sub_category = "AN",
mim_id = mimId,
mim_type = "announcement",
intent = plan.IntentName ?? "unknown",
transcript = turn.NormalizedTranscript ?? turn.RawTranscript ?? string.Empty
mim_type = "announcement"
}
}
}
@@ -184,7 +180,7 @@ public sealed class ResponsePlanToSocketMessagesMapper
{
type = "SKILL_ACTION",
ts = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
msgID = $"msg-{Guid.NewGuid():N}",
msgID = CreateHubMessageId(),
transID = transId,
data = new
{
@@ -209,9 +205,7 @@ public sealed class ResponsePlanToSocketMessagesMapper
prompt_id = "RUNTIME_PROMPT",
prompt_sub_category = "AN",
mim_id = "runtime-chat",
mim_type = "announcement",
intent = "unknown",
transcript = string.Empty
mim_type = "announcement"
}
}
}
@@ -234,5 +228,10 @@ public sealed class ResponsePlanToSocketMessagesMapper
.Replace("'", "'", StringComparison.Ordinal);
}
private static string CreateHubMessageId()
{
return $"mid-{Guid.NewGuid()}";
}
public sealed record SocketReplyPlan(string Text, int DelayMs = 0);
}

View File

@@ -9,4 +9,9 @@ Current fixture groups:
- `websocket/`
Sanitized Neo-Hub turn-flow examples used to replay `LISTEN`, `CONTEXT`, `CLIENT_NLU`, `CLIENT_ASR`, buffered-audio accumulation, pending/finalize states, and synthetic `EOS` / `SKILL_ACTION` behavior against the .NET implementation.
Current websocket fixture depth is uneven on purpose:
- `neo-hub-client-asr-joke.flow.json` now asserts a richer vertical slice than reply types alone. It captures the observed Node-oriented `CLIENT_ASR -> LISTEN -> EOS -> delayed SKILL_ACTION` joke turn with payload-shape expectations for `EOS` and joke `SKILL_ACTION`.
- The other websocket fixtures are still mainly sequencing fixtures. They are useful for replay and guardrails, but they should not be read as proof of broader payload parity.
Expand this folder whenever new robot traffic is captured and cleaned.

View File

@@ -36,6 +36,70 @@
"LISTEN",
"EOS",
"SKILL_ACTION"
],
"expectedReplies": [
{
"type": "LISTEN",
"jsonSubset": {
"type": "LISTEN",
"transID": "fixture-trans-joke",
"data": {
"asr": {
"text": "tell me a joke"
},
"nlu": {
"intent": "joke",
"rules": [
"wake-word"
]
},
"match": {
"intent": "joke",
"rule": "wake-word"
}
}
}
},
{
"type": "EOS",
"jsonSubset": {
"type": "EOS",
"transID": "fixture-trans-joke",
"data": {}
}
},
{
"type": "SKILL_ACTION",
"delayMs": 75,
"jsonSubset": {
"type": "SKILL_ACTION",
"transID": "fixture-trans-joke",
"data": {
"skill": {
"id": "@be/joke"
},
"action": {
"config": {
"jcp": {
"type": "SLIM",
"config": {
"play": {
"meta": {
"prompt_id": "RUNTIME_PROMPT",
"prompt_sub_category": "AN",
"mim_id": "runtime-joke",
"mim_type": "announcement"
}
}
}
}
}
},
"analytics": {},
"final": true
}
}
}
]
}
]