arcane-os 0.92.0 → 0.94.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +1 -1
- package/browser-runtime/ai/twin-cloud.mjs +109 -46
- package/browser-runtime/core/client.mjs +20 -0
- package/browser-runtime/core/contracts.mjs +20 -0
- package/browser-runtime/core/native-diagnostics.mjs +217 -0
- package/docs/reference/ai/twin-cloud.md +35 -14
- package/docs/reference/availability-and-normalization.md +1 -1
- package/docs/reference/core/arcane-api.md +32 -0
- package/docs/reference/core/arcane-events.md +25 -0
- package/docs/reference/core-client.md +99 -0
- package/docs/reference/inventory/package-api.json +97 -13
- package/docs/reference/local-ai.md +81 -5
- package/docs/reference/native-diagnostics.md +167 -0
- package/docs/reference/native-speech.md +220 -11
- package/docs/reference/runtime-modules.md +21 -18
- package/docs/reference/sdk-api.md +152 -11
- package/package.json +4 -1
- package/schemas/arcane-app.schema.json +2 -2
- package/schemas/arcane-package.schema.json +2 -2
- package/src/core/app-control.mjs +1 -0
- package/src/core/hosts/windows/ArcaneAppControl.cs +1 -1
- package/src/core/hosts/windows/ArcaneHost.cs +167 -0
- package/src/core/hosts/windows/ArcaneLauncher.cs +1 -0
- package/src/core/hosts/windows/ArcaneNativeDiagnostics.cs +137 -0
- package/src/core/hosts/windows/ArcaneNotifications.cs +822 -0
- package/src/core/hosts/windows/ArcaneWindowControl.cs +3 -2
- package/src/core/services/speech.mjs +85 -23
- package/src/core-native-diagnostics-source.mjs +13 -0
- package/src/import-map.mjs +1 -0
- package/src/local-ai/config.mjs +12 -1
- package/src/local-ai/dev.mjs +71 -4
- package/src/local-ai/install.mjs +113 -5
- package/src/local-ai/kokoro/frontend.mjs +219 -0
- package/src/local-ai/kokoro/helper.mjs +168 -0
- package/src/local-ai/kokoro/index.mjs +645 -0
- package/src/local-ai/kokoro/native/CMakeLists.txt +45 -0
- package/src/local-ai/kokoro/native/main.cpp +249 -0
- package/src/native/portable-layout.mjs +67 -9
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.IO;
|
|
4
|
+
using System.Runtime.InteropServices;
|
|
5
|
+
|
|
6
|
+
namespace Arcane.Core.Hosts.Windows
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
/// One host-session ledger, independent of Core and renderer readiness.
|
|
10
|
+
/// The dedicated document-start ingress acknowledges only retained records.
|
|
11
|
+
/// Diagnostic property graphs are data; the host never evaluates their fields.
|
|
12
|
+
/// </summary>
|
|
13
|
+
[ComVisible(true)]
|
|
14
|
+
[ClassInterface(ClassInterfaceType.AutoDual)]
|
|
15
|
+
public sealed class ArcaneNativeDiagnostics
|
|
16
|
+
{
|
|
17
|
+
private readonly object stateLock = new object();
|
|
18
|
+
private readonly string sessionId = Guid.NewGuid().ToString();
|
|
19
|
+
private readonly string captureStartedAt = DateTime.UtcNow.ToString("o");
|
|
20
|
+
private readonly List<Dictionary<string, object>> records = new List<Dictionary<string, object>>();
|
|
21
|
+
private readonly Dictionary<string, Dictionary<string, object>> documents =
|
|
22
|
+
new Dictionary<string, Dictionary<string, object>>();
|
|
23
|
+
private readonly Action<Exception> onFailure;
|
|
24
|
+
private long sequence;
|
|
25
|
+
private bool captureInstalled;
|
|
26
|
+
private bool stopped;
|
|
27
|
+
|
|
28
|
+
internal ArcaneNativeDiagnostics(Action<Exception> onFailure) { this.onFailure = onFailure; }
|
|
29
|
+
|
|
30
|
+
public string Send(string json)
|
|
31
|
+
{
|
|
32
|
+
try
|
|
33
|
+
{
|
|
34
|
+
Dictionary<string, object> frame = ArcaneHost.Serializer().DeserializeObject(json) as Dictionary<string, object>;
|
|
35
|
+
if (frame == null || Text(frame, "protocol") != "arcane.native-diagnostics/1")
|
|
36
|
+
throw new InvalidDataException("Expected an Arcane native diagnostic envelope.");
|
|
37
|
+
string type = Text(frame, "type");
|
|
38
|
+
string documentId = Text(frame, "documentId");
|
|
39
|
+
string documentUrl = Text(frame, "documentUrl");
|
|
40
|
+
string time = Text(frame, "time");
|
|
41
|
+
if (documentId == null || documentUrl == null || time == null)
|
|
42
|
+
throw new InvalidDataException("The diagnostic envelope needs its document identity, URL and time.");
|
|
43
|
+
object value;
|
|
44
|
+
Dictionary<string, object> record = frame.TryGetValue("record", out value)
|
|
45
|
+
? value as Dictionary<string, object> : null;
|
|
46
|
+
if (type != "document" && (type != "error" || record == null))
|
|
47
|
+
throw new InvalidDataException("Expected a document announcement or an error record.");
|
|
48
|
+
|
|
49
|
+
Dictionary<string, object> result = new Dictionary<string, object>
|
|
50
|
+
{
|
|
51
|
+
{ "accepted", true }, { "sessionId", sessionId }
|
|
52
|
+
};
|
|
53
|
+
lock (stateLock)
|
|
54
|
+
{
|
|
55
|
+
if (stopped) throw new InvalidOperationException("The native diagnostic session is closing.");
|
|
56
|
+
string receivedAt = DateTime.UtcNow.ToString("o");
|
|
57
|
+
if (!documents.ContainsKey(documentId))
|
|
58
|
+
documents.Add(documentId, new Dictionary<string, object>
|
|
59
|
+
{
|
|
60
|
+
{ "documentId", documentId }, { "documentUrl", documentUrl },
|
|
61
|
+
{ "time", time }, { "receivedAt", receivedAt }
|
|
62
|
+
});
|
|
63
|
+
if (type == "error")
|
|
64
|
+
{
|
|
65
|
+
Dictionary<string, object> retained = new Dictionary<string, object>(record);
|
|
66
|
+
retained["sequence"] = ++sequence;
|
|
67
|
+
retained["receivedAt"] = receivedAt;
|
|
68
|
+
retained["documentId"] = documentId;
|
|
69
|
+
retained["documentUrl"] = documentUrl;
|
|
70
|
+
retained["time"] = time;
|
|
71
|
+
records.Add(retained);
|
|
72
|
+
result["sequence"] = sequence;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return ArcaneHost.Serializer().Serialize(result);
|
|
76
|
+
}
|
|
77
|
+
catch (Exception error)
|
|
78
|
+
{
|
|
79
|
+
onFailure(error);
|
|
80
|
+
return ArcaneHost.Serializer().Serialize(new Dictionary<string, object>
|
|
81
|
+
{
|
|
82
|
+
{ "accepted", false },
|
|
83
|
+
{ "error", ArcaneHost.ErrorRecord(error, "ARCANE_NATIVE_DIAGNOSTIC_CAPTURE_FAILED") }
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
internal object Snapshot(Dictionary<string, object> parameters)
|
|
89
|
+
{
|
|
90
|
+
object selected;
|
|
91
|
+
long afterSequence = 0;
|
|
92
|
+
if (parameters.TryGetValue("afterSequence", out selected))
|
|
93
|
+
{
|
|
94
|
+
if (!(selected is int || selected is long || selected is decimal || selected is double))
|
|
95
|
+
throw new ArgumentException("afterSequence must be a nonnegative integer.");
|
|
96
|
+
afterSequence = Convert.ToInt64(selected);
|
|
97
|
+
if (afterSequence < 0 || Convert.ToDouble(selected) != afterSequence)
|
|
98
|
+
throw new ArgumentException("afterSequence must be a nonnegative integer.");
|
|
99
|
+
}
|
|
100
|
+
string documentId = null;
|
|
101
|
+
if (parameters.TryGetValue("documentId", out selected))
|
|
102
|
+
{
|
|
103
|
+
documentId = selected as string;
|
|
104
|
+
if (documentId == null) throw new ArgumentException("documentId must be a string.");
|
|
105
|
+
}
|
|
106
|
+
lock (stateLock)
|
|
107
|
+
{
|
|
108
|
+
List<object> found = new List<object>();
|
|
109
|
+
foreach (Dictionary<string, object> record in records)
|
|
110
|
+
{
|
|
111
|
+
if ((long)record["sequence"] <= afterSequence) continue;
|
|
112
|
+
if (documentId != null && (string)record["documentId"] != documentId) continue;
|
|
113
|
+
found.Add(record);
|
|
114
|
+
}
|
|
115
|
+
List<object> observedDocuments = new List<object>();
|
|
116
|
+
foreach (KeyValuePair<string, Dictionary<string, object>> document in documents)
|
|
117
|
+
if (documentId == null || document.Key == documentId) observedDocuments.Add(document.Value);
|
|
118
|
+
return new Dictionary<string, object>
|
|
119
|
+
{
|
|
120
|
+
{ "sessionId", sessionId }, { "captureStartedAt", captureStartedAt },
|
|
121
|
+
{ "captureInstalled", captureInstalled }, { "latestSequence", sequence },
|
|
122
|
+
{ "documents", observedDocuments }, { "records", found }
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
internal void Installed() { lock (stateLock) captureInstalled = true; }
|
|
128
|
+
|
|
129
|
+
internal void Stop() { lock (stateLock) stopped = true; }
|
|
130
|
+
|
|
131
|
+
private static string Text(Dictionary<string, object> record, string key)
|
|
132
|
+
{
|
|
133
|
+
object value;
|
|
134
|
+
return record.TryGetValue(key, out value) ? value as string : null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|