planting runtime seeds
This commit is contained in:
2
OpenJibo/OpenJibo.sln.DotSettings
Normal file
2
OpenJibo/OpenJibo.sln.DotSettings
Normal 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>
|
||||||
@@ -2,5 +2,8 @@
|
|||||||
<Folder Name="/Solution Items/">
|
<Folder Name="/Solution Items/">
|
||||||
<File Path="README.md" />
|
<File Path="README.md" />
|
||||||
</Folder>
|
</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>
|
</Solution>
|
||||||
|
|||||||
8
OpenJibo/src/Jibo.Runtime.Abstractions/AnimateAction.cs
Normal file
8
OpenJibo/src/Jibo.Runtime.Abstractions/AnimateAction.cs
Normal 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?>();
|
||||||
|
}
|
||||||
14
OpenJibo/src/Jibo.Runtime.Abstractions/BrainDecision.cs
Normal file
14
OpenJibo/src/Jibo.Runtime.Abstractions/BrainDecision.cs
Normal 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?>();
|
||||||
|
}
|
||||||
10
OpenJibo/src/Jibo.Runtime.Abstractions/BrainRoute.cs
Normal file
10
OpenJibo/src/Jibo.Runtime.Abstractions/BrainRoute.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public enum BrainRoute
|
||||||
|
{
|
||||||
|
Rules = 0,
|
||||||
|
NativeSkill = 1,
|
||||||
|
LocalAi = 2,
|
||||||
|
CloudAi = 3,
|
||||||
|
Hybrid = 4
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
11
OpenJibo/src/Jibo.Runtime.Abstractions/FollowUpPolicy.cs
Normal file
11
OpenJibo/src/Jibo.Runtime.Abstractions/FollowUpPolicy.cs
Normal 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?>();
|
||||||
|
}
|
||||||
11
OpenJibo/src/Jibo.Runtime.Abstractions/IBrainStrategy.cs
Normal file
11
OpenJibo/src/Jibo.Runtime.Abstractions/IBrainStrategy.cs
Normal 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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public interface IBrainStrategySelector
|
||||||
|
{
|
||||||
|
Task<IBrainStrategy> SelectAsync(
|
||||||
|
TurnContext turn,
|
||||||
|
ConversationSession session,
|
||||||
|
CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
6
OpenJibo/src/Jibo.Runtime.Abstractions/ICapability.cs
Normal file
6
OpenJibo/src/Jibo.Runtime.Abstractions/ICapability.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public interface ICapability
|
||||||
|
{
|
||||||
|
string Name { get; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public interface ICapabilityRegistry
|
||||||
|
{
|
||||||
|
TCapability? Get<TCapability>(string name) where TCapability : class, ICapability;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public interface IConversationBroker
|
||||||
|
{
|
||||||
|
Task<ResponsePlan> HandleTurnAsync(TurnContext turn, CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
10
OpenJibo/src/Jibo.Runtime.Abstractions/IResponsePlanner.cs
Normal file
10
OpenJibo/src/Jibo.Runtime.Abstractions/IResponsePlanner.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public interface IResponsePlanner
|
||||||
|
{
|
||||||
|
Task<ResponsePlan> BuildPlanAsync(
|
||||||
|
TurnContext turn,
|
||||||
|
ConversationSession session,
|
||||||
|
BrainDecision decision,
|
||||||
|
CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
6
OpenJibo/src/Jibo.Runtime.Abstractions/IRobotAdapter.cs
Normal file
6
OpenJibo/src/Jibo.Runtime.Abstractions/IRobotAdapter.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public interface IRobotAdapter
|
||||||
|
{
|
||||||
|
Task PublishPlanAsync(ResponsePlan plan, CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public interface IRobotEventMapper
|
||||||
|
{
|
||||||
|
Task<TurnContext> MapToTurnContextAsync(RobotEvent robotEvent, CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public interface IRobotEventSource
|
||||||
|
{
|
||||||
|
IAsyncEnumerable<RobotEvent> ReadEventsAsync(CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
8
OpenJibo/src/Jibo.Runtime.Abstractions/ISttStrategy.cs
Normal file
8
OpenJibo/src/Jibo.Runtime.Abstractions/ISttStrategy.cs
Normal 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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public interface ISttStrategySelector
|
||||||
|
{
|
||||||
|
Task<ISttStrategy> SelectAsync(TurnContext turn, CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public interface IWeatherCapability : ICapability
|
||||||
|
{
|
||||||
|
Task<WeatherResult> GetWeatherAsync(WeatherRequest request, CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
@@ -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?>();
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
8
OpenJibo/src/Jibo.Runtime.Abstractions/ListenAction.cs
Normal file
8
OpenJibo/src/Jibo.Runtime.Abstractions/ListenAction.cs
Normal 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
|
||||||
|
}
|
||||||
7
OpenJibo/src/Jibo.Runtime.Abstractions/PlanAction.cs
Normal file
7
OpenJibo/src/Jibo.Runtime.Abstractions/PlanAction.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public abstract class PlanAction
|
||||||
|
{
|
||||||
|
public abstract PlanActionType Type { get; }
|
||||||
|
public int Sequence { get; init; }
|
||||||
|
}
|
||||||
12
OpenJibo/src/Jibo.Runtime.Abstractions/PlanActionType.cs
Normal file
12
OpenJibo/src/Jibo.Runtime.Abstractions/PlanActionType.cs
Normal 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
|
||||||
|
}
|
||||||
18
OpenJibo/src/Jibo.Runtime.Abstractions/ResponsePlan.cs
Normal file
18
OpenJibo/src/Jibo.Runtime.Abstractions/ResponsePlan.cs
Normal 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?>();
|
||||||
|
}
|
||||||
9
OpenJibo/src/Jibo.Runtime.Abstractions/ResponseStatus.cs
Normal file
9
OpenJibo/src/Jibo.Runtime.Abstractions/ResponseStatus.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public enum ResponseStatus
|
||||||
|
{
|
||||||
|
Succeeded = 0,
|
||||||
|
Failed = 1,
|
||||||
|
Escalated = 2,
|
||||||
|
NoMatch = 3
|
||||||
|
}
|
||||||
14
OpenJibo/src/Jibo.Runtime.Abstractions/RobotEvent.cs
Normal file
14
OpenJibo/src/Jibo.Runtime.Abstractions/RobotEvent.cs
Normal 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?>();
|
||||||
|
}
|
||||||
@@ -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?>();
|
||||||
|
}
|
||||||
@@ -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?>();
|
||||||
|
}
|
||||||
10
OpenJibo/src/Jibo.Runtime.Abstractions/SpeakAction.cs
Normal file
10
OpenJibo/src/Jibo.Runtime.Abstractions/SpeakAction.cs
Normal 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;
|
||||||
|
}
|
||||||
10
OpenJibo/src/Jibo.Runtime.Abstractions/SttResult.cs
Normal file
10
OpenJibo/src/Jibo.Runtime.Abstractions/SttResult.cs
Normal 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?>();
|
||||||
|
}
|
||||||
21
OpenJibo/src/Jibo.Runtime.Abstractions/TurnContext.cs
Normal file
21
OpenJibo/src/Jibo.Runtime.Abstractions/TurnContext.cs
Normal 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?>();
|
||||||
|
}
|
||||||
9
OpenJibo/src/Jibo.Runtime.Abstractions/TurnInputMode.cs
Normal file
9
OpenJibo/src/Jibo.Runtime.Abstractions/TurnInputMode.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public enum TurnInputMode
|
||||||
|
{
|
||||||
|
WakeWord = 0,
|
||||||
|
FollowUp = 1,
|
||||||
|
DirectText = 2,
|
||||||
|
System = 3
|
||||||
|
}
|
||||||
9
OpenJibo/src/Jibo.Runtime.Abstractions/TurnSourceKind.cs
Normal file
9
OpenJibo/src/Jibo.Runtime.Abstractions/TurnSourceKind.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Jibo.Runtime.Abstractions;
|
||||||
|
|
||||||
|
public enum TurnSourceKind
|
||||||
|
{
|
||||||
|
NativeJibo = 0,
|
||||||
|
Simulator = 1,
|
||||||
|
TestHarness = 2,
|
||||||
|
Api = 3
|
||||||
|
}
|
||||||
9
OpenJibo/src/Jibo.Runtime.Abstractions/WeatherRequest.cs
Normal file
9
OpenJibo/src/Jibo.Runtime.Abstractions/WeatherRequest.cs
Normal 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; }
|
||||||
|
}
|
||||||
12
OpenJibo/src/Jibo.Runtime.Abstractions/WeatherResult.cs
Normal file
12
OpenJibo/src/Jibo.Runtime.Abstractions/WeatherResult.cs
Normal 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?>();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user