arcane-os 0.5.16 → 0.5.18
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 +44 -0
- package/README.md +42 -19
- package/bin/arcane-test.mjs +16 -13
- package/browser-runtime/ai/browser-speech-artifacts.mjs +41 -38
- package/browser-runtime/ai/browser-speech-providers.mjs +53 -46
- package/browser-runtime/ai/browser-wasm-llm-provider.mjs +127 -124
- package/browser-runtime/ai/browser-wasm.mjs +6 -3
- package/browser-runtime/ai/browser-wllama-runtime.mjs +26 -23
- package/browser-runtime/ai/model-controller.mjs +94 -91
- package/browser-runtime/ai/speech-worker-client.mjs +12 -9
- package/browser-runtime/ai/speech-worker-runtime.mjs +56 -53
- package/browser-runtime/dependencies/strong-type/index.js +207 -82
- package/browser-runtime/dependencies/strong-type/package.json +15 -6
- package/browser-runtime/dom-event-instrumentation.mjs +24 -20
- package/browser-runtime/event-manager.mjs +111 -108
- package/browser-runtime/speech-text.mjs +35 -0
- package/docs/architecture.md +1 -1
- package/docs/reference/README.md +8 -8
- package/docs/reference/ai/browser-speech.md +230 -16
- package/docs/reference/ai/twin-cloud.md +1 -1
- package/docs/reference/availability-and-normalization.md +42 -1
- package/docs/reference/cli.md +1 -1
- package/docs/reference/core/arcane-ai-contracts.md +1 -1
- package/docs/reference/inventory/package-api.json +60 -4
- package/docs/reference/inventory/runtime-components.json +2 -2
- package/docs/reference/inventory/runtime-modules.json +29 -31
- package/docs/reference/protocols.md +17 -13
- package/docs/reference/runtime-components.md +6 -5
- package/docs/reference/runtime-modules.md +212 -70
- package/docs/reference/sdk-api.md +197 -11
- package/examples/wasm-ai-demo/index.html +1 -0
- package/node_modules/event-pubsub/node_modules/strong-type/README.md +408 -0
- package/node_modules/event-pubsub/node_modules/strong-type/assets/strong-type-header.png +0 -0
- package/node_modules/event-pubsub/node_modules/strong-type/index.js +1151 -0
- package/node_modules/event-pubsub/node_modules/strong-type/licence +21 -0
- package/node_modules/event-pubsub/node_modules/strong-type/node.js +125 -0
- package/node_modules/event-pubsub/node_modules/strong-type/package.json +61 -0
- package/node_modules/strong-type/README.md +42 -24
- package/node_modules/strong-type/benchmark/core.js +324 -0
- package/node_modules/strong-type/index.js +207 -82
- package/node_modules/strong-type/package.json +14 -6
- package/package.json +4 -3
- package/runtime/arcane/components/app-bar.html +5 -2
- package/runtime/arcane/components/assistant-panel.html +5 -2
- package/runtime/arcane/components/chart.html +15 -12
- package/runtime/arcane/components/chat.html +118 -141
- package/runtime/arcane/components/dashboard-config.html +6 -3
- package/runtime/arcane/components/data-view.html +4 -1
- package/runtime/arcane/components/directory-picker.html +5 -2
- package/runtime/arcane/components/document-inspector.html +6 -3
- package/runtime/arcane/components/file-drop.html +5 -2
- package/runtime/arcane/components/file-inspector.html +9 -6
- package/runtime/arcane/components/file-manager.html +16 -13
- package/runtime/arcane/components/local-ai-status.html +5 -2
- package/runtime/arcane/components/markdown-document.html +14 -11
- package/runtime/arcane/components/markdown-editor.html +4 -1
- package/runtime/arcane/components/modal.html +4 -1
- package/runtime/arcane/components/output-panel.html +6 -3
- package/runtime/arcane/components/preferences-form.html +4 -1
- package/runtime/arcane/components/record-timeline.html +8 -5
- package/runtime/arcane/components/relationship-board.html +9 -6
- package/runtime/arcane/components/source-code-viewer.html +12 -9
- package/runtime/arcane/components/source-explanation.html +8 -5
- package/runtime/arcane/components/speech.html +24 -21
- package/runtime/arcane/components/summary-strip.html +4 -1
- package/runtime/arcane/components/task-progress.html +6 -3
- package/runtime/arcane/components/terminal-workspace.html +4 -1
- package/runtime/arcane/components/voice-transcription.html +11 -8
- package/runtime/arcane/components/web-navigator.html +5 -2
- package/runtime/arcane/entities/ApiModelRecord.js +5 -2
- package/runtime/arcane/entities/Calculation.js +5 -2
- package/runtime/arcane/entities/Chat.js +33 -33
- package/runtime/arcane/entities/CommunicationMessage.js +4 -1
- package/runtime/arcane/entities/CommunicationThread.js +4 -1
- package/runtime/arcane/entities/File.js +1 -1
- package/runtime/arcane/entities/Image.js +8 -5
- package/runtime/arcane/entities/IntentEnvelope.js +20 -17
- package/runtime/arcane/entities/Preference.js +9 -6
- package/runtime/arcane/entities/Theme.js +5 -2
- package/runtime/arcane/entities/User.js +11 -11
- package/runtime/arcane/entities/Weather.js +5 -2
- package/runtime/arcane/modules/AI.js +503 -187
- package/runtime/arcane/modules/AIPreferenceRuntime.js +5 -2
- package/runtime/arcane/modules/AIPreferenceTuple.js +9 -6
- package/runtime/arcane/modules/AIProviderRuntime.js +117 -92
- package/runtime/arcane/modules/AIResponseURLPolicy.js +148 -62
- package/runtime/arcane/modules/AIRuntimeState.js +29 -26
- package/runtime/arcane/modules/AnsiText.js +4 -1
- package/runtime/arcane/modules/ApiModelDatabase.js +22 -19
- package/runtime/arcane/modules/AppDataScope.js +8 -5
- package/runtime/arcane/modules/ArcaneCommunicationBridge.js +4 -1
- package/runtime/arcane/modules/ArcaneNavigationPolicy.js +8 -5
- package/runtime/arcane/modules/ArcaneNetworkPolicy.js +18 -15
- package/runtime/arcane/modules/AsyncBoundary.js +13 -10
- package/runtime/arcane/modules/BrowserTestSuite.js +19 -16
- package/runtime/arcane/modules/CalculatorEngine.js +5 -2
- package/runtime/arcane/modules/ChatRecords.js +18 -15
- package/runtime/arcane/modules/CommunicationAppController.js +9 -6
- package/runtime/arcane/modules/CommunicationHub.js +9 -6
- package/runtime/arcane/modules/CommunicationPreferences.js +4 -1
- package/runtime/arcane/modules/CommunicationProviderRegistry.js +4 -1
- package/runtime/arcane/modules/ComponentContracts.js +56 -53
- package/runtime/arcane/modules/ConfiguredAIChatSession.js +30 -27
- package/runtime/arcane/modules/ConversationActionItems.js +15 -12
- package/runtime/arcane/modules/ConversationClosingReport.js +11 -8
- package/runtime/arcane/modules/ConversationTimebox.js +28 -25
- package/runtime/arcane/modules/CoreLocalModelCatalog.js +17 -14
- package/runtime/arcane/modules/DBLS.js +7 -4
- package/runtime/arcane/modules/DBOPFS.js +7 -7
- package/runtime/arcane/modules/DBOPFSDocumentLibrary.js +34 -31
- package/runtime/arcane/modules/DevelopmentWorkspace.js +4 -1
- package/runtime/arcane/modules/DirectoryPicker.js +8 -5
- package/runtime/arcane/modules/DocumentLexicalSearch.js +11 -8
- package/runtime/arcane/modules/DocumentNavigation.js +7 -4
- package/runtime/arcane/modules/Errors.js +28 -25
- package/runtime/arcane/modules/HTMLImport.js +7 -4
- package/runtime/arcane/modules/IsolatedModelQuestionRunner.js +15 -12
- package/runtime/arcane/modules/LocalAIReadiness.js +21 -18
- package/runtime/arcane/modules/LocalAIReadinessController.js +6 -3
- package/runtime/arcane/modules/MD.js +1 -1
- package/runtime/arcane/modules/Mail.js +46 -43
- package/runtime/arcane/modules/MailOutbox.mjs +48 -45
- package/runtime/arcane/modules/MailTransport.mjs +29 -26
- package/runtime/arcane/modules/MarkdownSpeech.js +1 -50
- package/runtime/arcane/modules/MemoryRecords.js +7 -4
- package/runtime/arcane/modules/MessageAdvisory.js +6 -3
- package/runtime/arcane/modules/ModelDefinition.js +7 -4
- package/runtime/arcane/modules/Ollama.js +6 -3
- package/runtime/arcane/modules/OllamaModelIdentifier.js +4 -1
- package/runtime/arcane/modules/OpenMeteoWeatherProvider.js +18 -15
- package/runtime/arcane/modules/PersistentAIChatSession.js +33 -30
- package/runtime/arcane/modules/PreferenceStore.js +20 -17
- package/runtime/arcane/modules/PreparedSpeech.js +485 -0
- package/runtime/arcane/modules/Questionnaire.js +6 -3
- package/runtime/arcane/modules/RecordLinkIndex.js +4 -1
- package/runtime/arcane/modules/RecordPassageIndex.js +9 -6
- package/runtime/arcane/modules/RecordReviewStore.js +12 -9
- package/runtime/arcane/modules/RiskSignalAnalyzer.js +4 -1
- package/runtime/arcane/modules/ScopedOPFSCache.js +6 -3
- package/runtime/arcane/modules/ScreenCapture.js +20 -17
- package/runtime/arcane/modules/SpeechPlayback.js +61 -28
- package/runtime/arcane/modules/StaticDocumentCatalog.js +33 -30
- package/runtime/arcane/modules/SystemAppearance.js +5 -2
- package/runtime/arcane/modules/SystemToolRegistry.js +6 -3
- package/runtime/arcane/modules/TerminalClient.js +14 -11
- package/runtime/arcane/modules/TerminalCommandRegistry.js +4 -1
- package/runtime/arcane/modules/ThemeBootstrap.js +9 -6
- package/runtime/arcane/modules/ThemeManager.js +5 -2
- package/runtime/arcane/modules/TimeGuard.js +1 -1
- package/runtime/arcane/modules/ToolCallRouter.js +11 -8
- package/runtime/arcane/modules/WaitForComponent.js +19 -16
- package/runtime/arcane/modules/YouTubeMedia.js +4 -1
- package/runtime/strong-type/index.js +1276 -352
- package/runtime/strong-type/package.json +69 -45
- package/src/app-descriptor.mjs +17 -14
- package/src/application-tests.mjs +4 -1
- package/src/cli/main.mjs +8 -5
- package/src/constants.mjs +4 -1
- package/src/dev-server.mjs +8 -5
- package/src/doctor.mjs +5 -2
- package/src/dom-event-instrumentation.mjs +24 -20
- package/src/errors.mjs +7 -3
- package/src/event-manager.mjs +111 -108
- package/src/event-queue.mjs +8 -5
- package/src/events.mjs +12 -9
- package/src/import-map.mjs +36 -27
- package/src/installed-sdk-runtime.mjs +4 -1
- package/src/integrated-provider-loader.mjs +9 -6
- package/src/mail-credentials.mjs +16 -13
- package/src/mail-server.mjs +53 -50
- package/src/mail.mjs +18 -15
- package/src/native-plan.mjs +12 -9
- package/src/native-provider-loader.mjs +7 -4
- package/src/packager/core.mjs +18 -15
- package/src/process.mjs +6 -3
- package/src/release-bundle.mjs +14 -11
- package/src/runtime.mjs +4 -1
- package/src/scaffold.mjs +9 -6
- package/src/sdk-browser-runtime.mjs +4 -1
- package/src/source-server.mjs +17 -14
- package/src/targets/index.mjs +5 -2
- package/src/templates/workspace-template.mjs +13 -6
- package/src/testing-loader.mjs +7 -4
- package/src/testing.mjs +10 -7
- package/src/toolchain.mjs +13 -10
- package/src/update-check.mjs +9 -6
- package/src/workspace-operation-lock.mjs +14 -11
- package/src/workspace-runtime.mjs +4 -1
- package/src/workspace.mjs +17 -14
- package/runtime/arcane/modules/AIResponseLength.js +0 -32
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Is from "../dependencies/strong-type/index.js";
|
|
1
2
|
import {
|
|
2
3
|
completeValueText,
|
|
3
4
|
createModelController,
|
|
@@ -11,6 +12,8 @@ import {
|
|
|
11
12
|
} from "./browser-wasm-llm-provider.mjs";
|
|
12
13
|
import { BROWSER_WASM_RUNTIME_AUTHORITY } from "./browser-wllama-runtime.mjs";
|
|
13
14
|
|
|
15
|
+
const is = new Is(false);
|
|
16
|
+
|
|
14
17
|
/**
|
|
15
18
|
* Creates the public Arcane browser-local AI API module. The SDK owns lifecycle,
|
|
16
19
|
* cache, streaming, complete response projection, and structural tool visibility; applications
|
|
@@ -24,12 +27,12 @@ function createArcaneAI({
|
|
|
24
27
|
} = {}) {
|
|
25
28
|
const selected = llm ?? provider;
|
|
26
29
|
if (!selected) throw new TypeError("createArcaneAI requires an llm provider.");
|
|
27
|
-
if (selected
|
|
30
|
+
if (is.instanceCheck(selected, ModelController) && security !== undefined) {
|
|
28
31
|
throw new TypeError(
|
|
29
32
|
"createArcaneAI security must be configured when the existing ModelController is created.",
|
|
30
33
|
);
|
|
31
34
|
}
|
|
32
|
-
const controller = selected
|
|
35
|
+
const controller = is.instanceCheck(selected, ModelController)
|
|
33
36
|
? selected
|
|
34
37
|
: createModelController({ provider: selected, loadPolicy, security });
|
|
35
38
|
const api = {
|
|
@@ -46,7 +49,7 @@ function createArcaneAI({
|
|
|
46
49
|
};
|
|
47
50
|
|
|
48
51
|
async function createChatSession(options = {}) {
|
|
49
|
-
if (!options ||
|
|
52
|
+
if (!options || !is.object(options) || is.array(options)) {
|
|
50
53
|
throw new TypeError("createChatSession options must be a plain object.");
|
|
51
54
|
}
|
|
52
55
|
if (Object.getPrototypeOf(options) !== Object.prototype) {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import Is from "../dependencies/strong-type/index.js";
|
|
1
2
|
import { arcaneLogging } from '../logging.mjs';
|
|
2
3
|
import { Wllama } from "./wllama/index.mjs";
|
|
3
4
|
|
|
5
|
+
const is = new Is(false);
|
|
6
|
+
|
|
4
7
|
const completeValue = (value) => value;
|
|
5
8
|
|
|
6
9
|
const MODULE_URL = new URL("./wllama/index.mjs", import.meta.url).href;
|
|
@@ -63,15 +66,15 @@ function runtimeCapabilitySnapshot(evidence) {
|
|
|
63
66
|
const navigatorObject = globalThis.navigator;
|
|
64
67
|
const webgpuOperational = evidence?.state === "ready" && evidence?.webgpu?.observed === true;
|
|
65
68
|
return completeValue({
|
|
66
|
-
webAssembly:
|
|
67
|
-
opfs:
|
|
69
|
+
webAssembly: is.object(globalThis.WebAssembly),
|
|
70
|
+
opfs: is.function(navigatorObject?.storage?.getDirectory),
|
|
68
71
|
webgpu: webgpuOperational,
|
|
69
72
|
webgpuApiPresent: Boolean(navigatorObject?.gpu),
|
|
70
73
|
webgpuOperational,
|
|
71
74
|
webgpuEvidenceProtocol: RUNTIME_EVIDENCE_PROTOCOL,
|
|
72
75
|
crossOriginIsolated: globalThis.crossOriginIsolated === true,
|
|
73
76
|
secureContext: globalThis.isSecureContext === true,
|
|
74
|
-
hardwareConcurrency:
|
|
77
|
+
hardwareConcurrency: is.safeInteger(navigatorObject?.hardwareConcurrency)
|
|
75
78
|
? navigatorObject.hardwareConcurrency
|
|
76
79
|
: null,
|
|
77
80
|
});
|
|
@@ -80,7 +83,7 @@ function runtimeCapabilitySnapshot(evidence) {
|
|
|
80
83
|
function normalizePositiveInteger(value, fallback) {
|
|
81
84
|
if (value === undefined || value === null) return fallback;
|
|
82
85
|
const number = Number(value);
|
|
83
|
-
if (!
|
|
86
|
+
if (!is.safeInteger(number) || number < 1) {
|
|
84
87
|
throw new RangeError("Expected a positive safe integer.");
|
|
85
88
|
}
|
|
86
89
|
return number;
|
|
@@ -142,7 +145,7 @@ function createEvidenceLogger(logger) {
|
|
|
142
145
|
|
|
143
146
|
function observe(level, args) {
|
|
144
147
|
for (const value of args) {
|
|
145
|
-
if (
|
|
148
|
+
if (!is.string(value)) continue;
|
|
146
149
|
for (const line of value.split(/\r?\n/u)) observeLine(level, line);
|
|
147
150
|
}
|
|
148
151
|
}
|
|
@@ -151,7 +154,7 @@ function createEvidenceLogger(logger) {
|
|
|
151
154
|
for (const level of ["debug", "log", "warn", "error"]) {
|
|
152
155
|
wrapped[level] = (...args) => {
|
|
153
156
|
observe(level, args);
|
|
154
|
-
if (
|
|
157
|
+
if (is.function(logger?.[level])) logger[level](...args);
|
|
155
158
|
};
|
|
156
159
|
}
|
|
157
160
|
|
|
@@ -214,7 +217,7 @@ function createStructuredStreamCapture() {
|
|
|
214
217
|
|
|
215
218
|
function observe(value) {
|
|
216
219
|
chunks += 1;
|
|
217
|
-
if (!value ||
|
|
220
|
+
if (!value || !is.object(value) || !is.array(value.choices)) {
|
|
218
221
|
invalid = true;
|
|
219
222
|
return;
|
|
220
223
|
}
|
|
@@ -227,8 +230,8 @@ function createStructuredStreamCapture() {
|
|
|
227
230
|
if (
|
|
228
231
|
choice?.index !== 0
|
|
229
232
|
|| !delta
|
|
230
|
-
||
|
|
231
|
-
||
|
|
233
|
+
|| !is.object(delta)
|
|
234
|
+
|| is.array(delta)
|
|
232
235
|
|| (delta.role !== undefined && delta.role !== "assistant")
|
|
233
236
|
|| (choice.finish_reason !== undefined && choice.finish_reason !== null)
|
|
234
237
|
|| delta.tool_calls !== undefined
|
|
@@ -239,7 +242,7 @@ function createStructuredStreamCapture() {
|
|
|
239
242
|
return;
|
|
240
243
|
}
|
|
241
244
|
if (delta.content === undefined || delta.content === null) return;
|
|
242
|
-
if (
|
|
245
|
+
if (!is.string(delta.content)) {
|
|
243
246
|
invalid = true;
|
|
244
247
|
return;
|
|
245
248
|
}
|
|
@@ -296,7 +299,7 @@ export function createPackagedWllamaRuntime({ logger = arcaneLogging } = {}) {
|
|
|
296
299
|
}
|
|
297
300
|
|
|
298
301
|
function cancellationError(reason, fallback = "The Wllama operation was cancelled.") {
|
|
299
|
-
return reason
|
|
302
|
+
return is.error(reason) ? reason : new Error(reason ? String(reason) : fallback);
|
|
300
303
|
}
|
|
301
304
|
|
|
302
305
|
function trackOperation(rawOperation) {
|
|
@@ -380,7 +383,7 @@ export function createPackagedWllamaRuntime({ logger = arcaneLogging } = {}) {
|
|
|
380
383
|
});
|
|
381
384
|
next.setCompat(null);
|
|
382
385
|
for (const method of ["arcaneLoadModel", "arcaneTelemetry", "arcaneTerminate"]) {
|
|
383
|
-
if (
|
|
386
|
+
if (!is.function(next[method])) {
|
|
384
387
|
throw new Error(`The packaged Wllama projection is missing public ${method}().`);
|
|
385
388
|
}
|
|
386
389
|
}
|
|
@@ -401,10 +404,10 @@ export function createPackagedWllamaRuntime({ logger = arcaneLogging } = {}) {
|
|
|
401
404
|
}
|
|
402
405
|
|
|
403
406
|
async function load(files, options = {}) {
|
|
404
|
-
if (!
|
|
407
|
+
if (!is.array(files) || files.length === 0) {
|
|
405
408
|
throw new TypeError("Wllama load() requires at least one File or Blob.");
|
|
406
409
|
}
|
|
407
|
-
if (
|
|
410
|
+
if (!is.object(globalThis.WebAssembly)) {
|
|
408
411
|
throw new Error("WebAssembly is unavailable in this browser.");
|
|
409
412
|
}
|
|
410
413
|
if (!globalThis.navigator?.gpu) {
|
|
@@ -435,25 +438,25 @@ export function createPackagedWllamaRuntime({ logger = arcaneLogging } = {}) {
|
|
|
435
438
|
loadOptions.n_ubatch = normalizePositiveInteger(options.microBatchTokens, 128);
|
|
436
439
|
}
|
|
437
440
|
if (options.reasoning !== undefined) {
|
|
438
|
-
if (
|
|
441
|
+
if (!is.boolean(options.reasoning)) {
|
|
439
442
|
throw new TypeError("reasoning must be a boolean when provided.");
|
|
440
443
|
}
|
|
441
444
|
loadOptions.reasoning = options.reasoning;
|
|
442
445
|
}
|
|
443
446
|
if (options.chatTemplate !== undefined) {
|
|
444
|
-
if (
|
|
447
|
+
if (!is.string(options.chatTemplate)) {
|
|
445
448
|
throw new TypeError("chatTemplate must be a string when provided.");
|
|
446
449
|
}
|
|
447
450
|
loadOptions.chat_template = options.chatTemplate;
|
|
448
451
|
}
|
|
449
452
|
if (options.jinja !== undefined) {
|
|
450
|
-
if (
|
|
453
|
+
if (!is.boolean(options.jinja)) {
|
|
451
454
|
throw new TypeError("jinja must be a boolean when provided.");
|
|
452
455
|
}
|
|
453
456
|
loadOptions.jinja = options.jinja;
|
|
454
457
|
}
|
|
455
458
|
if (options.templateDefaults !== undefined) {
|
|
456
|
-
if (!options.templateDefaults ||
|
|
459
|
+
if (!options.templateDefaults || !is.object(options.templateDefaults) || is.array(options.templateDefaults)) {
|
|
457
460
|
throw new TypeError("templateDefaults must be a plain object when provided.");
|
|
458
461
|
}
|
|
459
462
|
loadOptions.default_template_kwargs = { ...options.templateDefaults };
|
|
@@ -482,7 +485,7 @@ export function createPackagedWllamaRuntime({ logger = arcaneLogging } = {}) {
|
|
|
482
485
|
try {
|
|
483
486
|
await loadOperation;
|
|
484
487
|
if (pending?.engine !== next) throw new Error("Wllama load was cancelled.");
|
|
485
|
-
if (
|
|
488
|
+
if (!is.function(next.isModelLoaded) || next.isModelLoaded() !== true) {
|
|
486
489
|
throw runtimeFailure(
|
|
487
490
|
"ARCANE_AI_LOAD_FAILED",
|
|
488
491
|
"Wllama did not confirm a successfully loaded model.",
|
|
@@ -553,13 +556,13 @@ export function createPackagedWllamaRuntime({ logger = arcaneLogging } = {}) {
|
|
|
553
556
|
lastObservedOperational: evidenceState.webgpu?.lastObservedOperational === true,
|
|
554
557
|
},
|
|
555
558
|
failure: completeValue({
|
|
556
|
-
code:
|
|
559
|
+
code: is.string(error?.code) ? error.code : "ARCANE_AI_RUNTIME_FAILED",
|
|
557
560
|
}),
|
|
558
561
|
});
|
|
559
562
|
}
|
|
560
563
|
|
|
561
564
|
async function inference(options, onData = null) {
|
|
562
|
-
if (!options ||
|
|
565
|
+
if (!options || !is.object(options) || is.array(options)) {
|
|
563
566
|
throw new TypeError("Wllama inference options must be an object.");
|
|
564
567
|
}
|
|
565
568
|
if (Object.hasOwn(options, "signal")) {
|
|
@@ -629,7 +632,7 @@ export function createPackagedWllamaRuntime({ logger = arcaneLogging } = {}) {
|
|
|
629
632
|
}
|
|
630
633
|
|
|
631
634
|
function stream(options, onData) {
|
|
632
|
-
if (
|
|
635
|
+
if (!is.function(onData)) {
|
|
633
636
|
throw new TypeError("Wllama stream() requires an onData callback.");
|
|
634
637
|
}
|
|
635
638
|
return inference({ ...options, stream: true }, onData);
|
|
@@ -653,7 +656,7 @@ export function createPackagedWllamaRuntime({ logger = arcaneLogging } = {}) {
|
|
|
653
656
|
|
|
654
657
|
async function probe({ args = ["-o", "ADD"] } = {}) {
|
|
655
658
|
if (engine) throw new Error("The no-model Wllama probe cannot run while a model is loaded.");
|
|
656
|
-
if (!
|
|
659
|
+
if (!is.array(args) || args.some((value) => !is.string(value))) {
|
|
657
660
|
throw new TypeError("Wllama probe args must be an array of strings.");
|
|
658
661
|
}
|
|
659
662
|
const temporary = newEngine();
|