planting runtime seeds

This commit is contained in:
Jacob Dubin
2026-03-23 07:51:32 -05:00
parent 8381b401a7
commit 34178c71f1
38 changed files with 330 additions and 1 deletions

View File

@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Jibo/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -2,5 +2,8 @@
<Folder Name="/Solution Items/">
<File Path="README.md" />
</Folder>
<Project Path="Playground/Playground.csproj" />
<Folder Name="/src/">
<Project Path="src/Jibo.Runtime.Abstractions/Jibo.Runtime.Abstractions.csproj" Id="41abf805-373e-4e71-b1bf-2cab6dbf892e" />
<Project Path="src/Playground/Playground.csproj" />
</Folder>
</Solution>

View File

@@ -0,0 +1,8 @@
namespace Jibo.Runtime.Abstractions;
public sealed class AnimateAction : PlanAction
{
public override PlanActionType Type => PlanActionType.Animate;
public string AnimationId { get; init; } = string.Empty;
public IDictionary<string, object?> Parameters { get; init; } = new Dictionary<string, object?>();
}

View File

@@ -0,0 +1,14 @@
namespace Jibo.Runtime.Abstractions;
public sealed class BrainDecision
{
public BrainRoute Route { get; init; }
public string IntentName { get; init; } = string.Empty;
public float Confidence { get; init; }
public string? CapabilityName { get; init; }
public string? NativeSkillName { get; init; }
public IDictionary<string, object?> Slots { get; init; } = new Dictionary<string, object?>();
public IDictionary<string, object?> ContextUpdates { get; init; } = new Dictionary<string, object?>();
}

View File

@@ -0,0 +1,10 @@
namespace Jibo.Runtime.Abstractions;
public enum BrainRoute
{
Rules = 0,
NativeSkill = 1,
LocalAi = 2,
CloudAi = 3,
Hybrid = 4
}

View File

@@ -0,0 +1,15 @@
namespace Jibo.Runtime.Abstractions;
public sealed class ConversationSession
{
public string SessionId { get; init; } = Guid.NewGuid().ToString("N");
public DateTimeOffset StartedUtc { get; init; } = DateTimeOffset.UtcNow;
public DateTimeOffset LastActivityUtc { get; set; } = DateTimeOffset.UtcNow;
public string? ActiveTopic { get; set; }
public string? LastIntent { get; set; }
public IDictionary<string, object?> Slots { get; } = new Dictionary<string, object?>();
public DateTimeOffset? FollowUpExpiresUtc { get; set; }
public bool FollowUpOpen => FollowUpExpiresUtc.HasValue && FollowUpExpiresUtc > DateTimeOffset.UtcNow;
}

View File

@@ -0,0 +1,11 @@
namespace Jibo.Runtime.Abstractions;
public sealed class FollowUpPolicy
{
public static FollowUpPolicy None => new() { KeepMicOpen = false, Timeout = TimeSpan.Zero };
public bool KeepMicOpen { get; init; }
public TimeSpan Timeout { get; init; }
public string? ExpectedTopic { get; init; }
public IDictionary<string, object?> Hints { get; init; } = new Dictionary<string, object?>();
}

View File

@@ -0,0 +1,11 @@
namespace Jibo.Runtime.Abstractions;
public interface IBrainStrategy
{
string Name { get; }
bool CanHandle(TurnContext turn, ConversationSession session);
Task<BrainDecision> DecideAsync(
TurnContext turn,
ConversationSession session,
CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,9 @@
namespace Jibo.Runtime.Abstractions;
public interface IBrainStrategySelector
{
Task<IBrainStrategy> SelectAsync(
TurnContext turn,
ConversationSession session,
CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,6 @@
namespace Jibo.Runtime.Abstractions;
public interface ICapability
{
string Name { get; }
}

View File

@@ -0,0 +1,6 @@
namespace Jibo.Runtime.Abstractions;
public interface ICapabilityRegistry
{
TCapability? Get<TCapability>(string name) where TCapability : class, ICapability;
}

View File

@@ -0,0 +1,6 @@
namespace Jibo.Runtime.Abstractions;
public interface IConversationBroker
{
Task<ResponsePlan> HandleTurnAsync(TurnContext turn, CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,10 @@
namespace Jibo.Runtime.Abstractions;
public interface IResponsePlanner
{
Task<ResponsePlan> BuildPlanAsync(
TurnContext turn,
ConversationSession session,
BrainDecision decision,
CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,6 @@
namespace Jibo.Runtime.Abstractions;
public interface IRobotAdapter
{
Task PublishPlanAsync(ResponsePlan plan, CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,6 @@
namespace Jibo.Runtime.Abstractions;
public interface IRobotEventMapper
{
Task<TurnContext> MapToTurnContextAsync(RobotEvent robotEvent, CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,6 @@
namespace Jibo.Runtime.Abstractions;
public interface IRobotEventSource
{
IAsyncEnumerable<RobotEvent> ReadEventsAsync(CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,8 @@
namespace Jibo.Runtime.Abstractions;
public interface ISttStrategy
{
string Name { get; }
bool CanHandle(TurnContext turn);
Task<SttResult> TranscribeAsync(TurnContext turn, CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,6 @@
namespace Jibo.Runtime.Abstractions;
public interface ISttStrategySelector
{
Task<ISttStrategy> SelectAsync(TurnContext turn, CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,6 @@
namespace Jibo.Runtime.Abstractions;
public interface IWeatherCapability : ICapability
{
Task<WeatherResult> GetWeatherAsync(WeatherRequest request, CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,8 @@
namespace Jibo.Runtime.Abstractions;
public sealed class InvokeNativeSkillAction : PlanAction
{
public override PlanActionType Type => PlanActionType.InvokeNativeSkill;
public string SkillName { get; init; } = string.Empty;
public IDictionary<string, object?> Payload { get; init; } = new Dictionary<string, object?>();
}

View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,8 @@
namespace Jibo.Runtime.Abstractions;
public sealed class ListenAction : PlanAction
{
public override PlanActionType Type => PlanActionType.Listen;
public TimeSpan Timeout { get; init; }
public string? Mode { get; init; } // follow-up, open-mic, command
}

View File

@@ -0,0 +1,7 @@
namespace Jibo.Runtime.Abstractions;
public abstract class PlanAction
{
public abstract PlanActionType Type { get; }
public int Sequence { get; init; }
}

View File

@@ -0,0 +1,12 @@
namespace Jibo.Runtime.Abstractions;
public enum PlanActionType
{
Speak = 0,
Listen = 1,
ShowVisual = 2,
Animate = 3,
InvokeNativeSkill = 4,
SetContext = 5,
EmitEvent = 6
}

View File

@@ -0,0 +1,18 @@
namespace Jibo.Runtime.Abstractions;
public sealed class ResponsePlan
{
public string PlanId { get; init; } = Guid.NewGuid().ToString("N");
public string SessionId { get; init; } = string.Empty;
public ResponseStatus Status { get; init; } = ResponseStatus.Succeeded;
public string? IntentName { get; init; }
public string? Topic { get; init; }
public IList<PlanAction> Actions { get; init; } = new List<PlanAction>();
public FollowUpPolicy FollowUp { get; init; } = FollowUpPolicy.None;
public IDictionary<string, object?> ContextUpdates { get; init; } = new Dictionary<string, object?>();
public string? DebugRoute { get; init; }
public IDictionary<string, object?> Diagnostics { get; init; } = new Dictionary<string, object?>();
}

View File

@@ -0,0 +1,9 @@
namespace Jibo.Runtime.Abstractions;
public enum ResponseStatus
{
Succeeded = 0,
Failed = 1,
Escalated = 2,
NoMatch = 3
}

View File

@@ -0,0 +1,14 @@
namespace Jibo.Runtime.Abstractions;
public sealed class RobotEvent
{
public string EventId { get; init; } = Guid.NewGuid().ToString("N");
public DateTimeOffset TimestampUtc { get; init; } = DateTimeOffset.UtcNow;
public string EventType { get; init; } = string.Empty;
public string? SessionId { get; init; }
public string? Transcript { get; init; }
public string? WakePhrase { get; init; }
public IDictionary<string, object?> Payload { get; init; } = new Dictionary<string, object?>();
}

View File

@@ -0,0 +1,7 @@
namespace Jibo.Runtime.Abstractions;
public sealed class SetContextAction : PlanAction
{
public override PlanActionType Type => PlanActionType.SetContext;
public IDictionary<string, object?> Values { get; init; } = new Dictionary<string, object?>();
}

View File

@@ -0,0 +1,8 @@
namespace Jibo.Runtime.Abstractions;
public sealed class ShowVisualAction : PlanAction
{
public override PlanActionType Type => PlanActionType.ShowVisual;
public string VisualId { get; init; } = string.Empty;
public IDictionary<string, object?> Parameters { get; init; } = new Dictionary<string, object?>();
}

View File

@@ -0,0 +1,10 @@
namespace Jibo.Runtime.Abstractions;
public sealed class SpeakAction : PlanAction
{
public override PlanActionType Type => PlanActionType.Speak;
public string Text { get; init; } = string.Empty;
public string? Voice { get; init; }
public string? Style { get; init; }
public bool CanBeInterrupted { get; init; } = true;
}

View File

@@ -0,0 +1,10 @@
namespace Jibo.Runtime.Abstractions;
public sealed class SttResult
{
public string Text { get; init; } = string.Empty;
public string? Provider { get; init; }
public float? Confidence { get; init; }
public string? Locale { get; init; }
public IDictionary<string, object?> Metadata { get; init; } = new Dictionary<string, object?>();
}

View File

@@ -0,0 +1,21 @@
namespace Jibo.Runtime.Abstractions;
public sealed class TurnContext
{
public string TurnId { get; init; } = Guid.NewGuid().ToString("N");
public string SessionId { get; init; } = string.Empty;
public DateTimeOffset TimestampUtc { get; init; } = DateTimeOffset.UtcNow;
public TurnInputMode InputMode { get; init; }
public TurnSourceKind SourceKind { get; init; }
public string? WakePhrase { get; init; }
public string? RawTranscript { get; init; }
public string? NormalizedTranscript { get; init; }
public string? Locale { get; init; } = "en-US";
public string? TimeZone { get; init; }
public bool IsFollowUpEligible { get; init; }
public IDictionary<string, object?> Attributes { get; init; } = new Dictionary<string, object?>();
}

View File

@@ -0,0 +1,9 @@
namespace Jibo.Runtime.Abstractions;
public enum TurnInputMode
{
WakeWord = 0,
FollowUp = 1,
DirectText = 2,
System = 3
}

View File

@@ -0,0 +1,9 @@
namespace Jibo.Runtime.Abstractions;
public enum TurnSourceKind
{
NativeJibo = 0,
Simulator = 1,
TestHarness = 2,
Api = 3
}

View File

@@ -0,0 +1,9 @@
namespace Jibo.Runtime.Abstractions;
public sealed class WeatherRequest
{
public string? LocationName { get; init; }
public string? TimeZone { get; init; }
public bool IncludeHourly { get; init; }
public bool IncludeDaily { get; init; }
}

View File

@@ -0,0 +1,12 @@
namespace Jibo.Runtime.Abstractions;
public sealed class WeatherResult
{
public string Summary { get; init; } = string.Empty;
public int? CurrentTemperatureF { get; init; }
public int? HighTodayF { get; init; }
public int? LowTonightF { get; init; }
public string? Conditions { get; init; }
public string? LocationLabel { get; init; }
public IDictionary<string, object?> Raw { get; init; } = new Dictionary<string, object?>();
}