arcane-os 0.57.0 → 0.59.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 +37 -0
- package/README.md +6 -2
- package/browser-runtime/ai/core-onnx.mjs +96 -0
- package/browser-runtime/ai/onnx-tensors.mjs +85 -0
- package/browser-runtime/core/client.mjs +152 -17
- package/docs/architecture.md +5 -2
- package/docs/platform-targets.md +30 -13
- package/docs/reference/README.md +22 -3
- package/docs/reference/availability-and-normalization.md +14 -7
- package/docs/reference/cli.md +22 -10
- package/docs/reference/core-client.md +87 -0
- package/docs/reference/core-native-packaging.md +129 -9
- package/docs/reference/core-preferences.md +49 -0
- package/docs/reference/diarization.md +206 -0
- package/docs/reference/git-text-snapshot.md +104 -0
- package/docs/reference/inventory/package-api.json +205 -23
- package/docs/reference/local-ai.md +145 -11
- package/docs/reference/protocols.md +28 -19
- package/docs/reference/pwa.md +74 -4
- package/docs/reference/sdk-api.md +589 -39
- package/package.json +11 -3
- package/schemas/arcane-app.schema.json +3 -3
- package/schemas/arcane-package.schema.json +2 -2
- package/schemas/native-build-plan.schema.json +27 -1
- package/schemas/target-adapter.schema.json +2 -0
- package/src/app-descriptor.mjs +1 -1
- package/src/cli/main.mjs +14 -4
- package/src/constants.mjs +2 -0
- package/src/core/host.mjs +14 -5
- package/src/core/hosts/macos/ArcaneHost.h +86 -0
- package/src/core/hosts/macos/ArcaneHost.m +455 -0
- package/src/core/hosts/macos/ArcaneLauncher.m +432 -0
- package/src/core/hosts/windows/ArcaneLauncher.cs +4 -1
- package/src/core/services/local-ai.mjs +82 -4
- package/src/core/services/packaged-web.mjs +89 -0
- package/src/core/services/preferences.mjs +201 -0
- package/src/core-classic-source.mjs +2 -2
- package/src/dev-server.mjs +2 -5
- package/src/diarization/build.mjs +35 -0
- package/src/diarization/index.mjs +432 -0
- package/src/diarization/native/CMakeLists.txt +9 -0
- package/src/diarization/native/main.cpp +269 -0
- package/src/diarization/service.mjs +129 -0
- package/src/git-text-snapshot.mjs +265 -0
- package/src/import-map.mjs +9 -4
- package/src/index.mjs +1 -0
- package/src/local-ai/config.mjs +1 -1
- package/src/local-ai/install.mjs +134 -19
- package/src/local-ai/onnx-worker.mjs +85 -0
- package/src/local-ai/onnx.mjs +368 -0
- package/src/native/macos-provider.mjs +291 -0
- package/src/native/portable-layout.mjs +10 -2
- package/src/native/portable-provider.mjs +10 -5
- package/src/native-plan.mjs +9 -1
- package/src/native-provider-loader.mjs +3 -1
- package/src/process.mjs +123 -17
- package/src/scaffold.mjs +1 -1
- package/src/targets/index.mjs +11 -1
- package/src/templates/workspace-template.mjs +6 -5
- package/src/toolchain.mjs +42 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arcane-os",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.0",
|
|
4
4
|
"description": "Arcane OS JavaScript SDK, project-local CLI, browser runtime, and repository-portable application packager.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.mjs",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"./speech-text": "./browser-runtime/speech-text.mjs",
|
|
41
41
|
"./ai/browser-wasm": "./browser-runtime/ai/browser-wasm.mjs",
|
|
42
42
|
"./ai/core-local": "./browser-runtime/ai/core-local.mjs",
|
|
43
|
+
"./ai/core-onnx": "./browser-runtime/ai/core-onnx.mjs",
|
|
43
44
|
"./ai/browser-decisions": "./browser-runtime/ai/browser-decisions.mjs",
|
|
44
45
|
"./ai/tool-text-stream": "./browser-runtime/ai/tool-text-stream.mjs",
|
|
45
46
|
"./ai/twin-cloud": "./browser-runtime/ai/twin-cloud.mjs",
|
|
@@ -51,14 +52,21 @@
|
|
|
51
52
|
"./native-provider": "./src/native-provider-loader.mjs",
|
|
52
53
|
"./native/portable-provider": "./src/native/portable-provider.mjs",
|
|
53
54
|
"./native/windows-provider": "./src/native/windows-provider.mjs",
|
|
55
|
+
"./native/macos-provider": "./src/native/macos-provider.mjs",
|
|
54
56
|
"./core/client": "./browser-runtime/core/client.mjs",
|
|
55
57
|
"./core/contracts": "./browser-runtime/core/contracts.mjs",
|
|
56
58
|
"./core/classic-source": "./src/core-classic-source.mjs",
|
|
57
59
|
"./core/runtime": "./src/core/runtime.mjs",
|
|
58
60
|
"./core/stdio": "./src/core/stdio.mjs",
|
|
59
61
|
"./core/host": "./src/core/host.mjs",
|
|
62
|
+
"./core/packaged-web": "./src/core/services/packaged-web.mjs",
|
|
63
|
+
"./core/preferences": "./src/core/services/preferences.mjs",
|
|
64
|
+
"./core/diarization": "./src/diarization/service.mjs",
|
|
60
65
|
"./core/local-ai": "./src/core/services/local-ai.mjs",
|
|
66
|
+
"./diarization": "./src/diarization/index.mjs",
|
|
67
|
+
"./diarization/build": "./src/diarization/build.mjs",
|
|
61
68
|
"./local-ai": "./src/local-ai/install.mjs",
|
|
69
|
+
"./local-ai/onnx": "./src/local-ai/onnx.mjs",
|
|
62
70
|
"./integrated-provider": "./src/integrated-provider-loader.mjs",
|
|
63
71
|
"./packager": "./src/packager/core.mjs",
|
|
64
72
|
"./release-bundle": "./src/release-bundle.mjs",
|
|
@@ -100,8 +108,8 @@
|
|
|
100
108
|
"test": "npm run test:unit && npm run test:functional && npm run test:integration && npm run test:regression",
|
|
101
109
|
"test:release": "node ./bin/arcane-test.mjs test/npm-release.test.mjs",
|
|
102
110
|
"test:unit": "node ./bin/arcane-test.mjs test/app-descriptor.test.mjs test/app-schema.test.mjs test/app-selection.test.mjs test/contracts.test.mjs test/conversation-closing-report.test.mjs test/doctor.test.mjs test/mail-credentials.test.mjs test/mail-outbox.test.mjs test/mail-public-api.test.mjs test/mail-send.test.mjs test/mail-transport.test.mjs test/targets.test.mjs test/workspace-operation-lock.test.mjs",
|
|
103
|
-
"test:functional": "node ./bin/arcane-test.mjs test/ai-request-model.test.mjs test/ai-request-retry.test.mjs test/ai-stream-cancellation.test.mjs test/browser-decisions.test.mjs test/browser-speech-providers.test.mjs test/browser-wasm-gpu-notice.test.mjs test/browser-wasm-download-resume.test.mjs test/chat-input.test.mjs test/chat-stream-speech.test.mjs test/chat-transcript-scroll.test.mjs test/chat-transient-retention.test.mjs test/cli.test.mjs test/continuous-voice-capture.test.mjs test/core-classic-source.test.mjs test/core-client.test.mjs test/core-host.test.mjs test/core-runtime.test.mjs test/core-stdio.test.mjs test/dbopfs-document-library.test.mjs test/dbopfs-png.test.mjs test/dbopfs.test.mjs test/dev-server.test.mjs test/dev-pwa.test.mjs test/dom-event-instrumentation.test.mjs test/event-manager.test.mjs test/events.test.mjs test/file-preview.test.mjs test/import-map.test.mjs test/mail-cli.test.mjs test/mail-runtime.test.mjs test/mail-server.test.mjs test/markdown-editor.test.mjs test/markdown-media.test.mjs test/markdown-source-map.test.mjs test/modal.test.mjs test/native-module-packaging.test.mjs test/native-module-resource-references.test.mjs test/packaging.test.mjs test/pwa-packaging.test.mjs test/pwa-client.test.mjs test/pwa-install.test.mjs test/pwa-worker.test.mjs test/persistent-ai-chat-session.test.mjs test/reference-completeness.test.mjs test/rendered-print.test.mjs test/runtime-api-behavior.test.mjs test/runtime.test.mjs test/scaffold.test.mjs test/speech-playback.test.mjs test/site.test.mjs test/theme-manager.test.mjs test/twin-cloud-images.test.mjs test/twin-cloud.test.mjs test/websocket-client-import-map.test.mjs test/websocket.test.mjs test/update-check.test.mjs test/user-explicit-updates.test.mjs",
|
|
104
|
-
"test:integration": "node ./bin/arcane-test.mjs test/installed-package-runtime.test.mjs test/root-app-layout.test.mjs test/integrated-shared.test.mjs test/integrated-workspace.test.mjs test/mail-browser.test.mjs test/native-plan.test.mjs test/native-portable-provider.test.mjs test/native-provider-loader.test.mjs test/npm-release.test.mjs test/release-bundle.test.mjs test/release-capability-smoke.test.mjs test/shared-payload-batch.test.mjs test/tarball.test.mjs test/browser-wasm-cpu.test.mjs test/wllama-webgpu-runtime.test.mjs",
|
|
111
|
+
"test:functional": "node ./bin/arcane-test.mjs test/ai-request-model.test.mjs test/ai-request-retry.test.mjs test/ai-stream-cancellation.test.mjs test/browser-decisions.test.mjs test/browser-speech-providers.test.mjs test/browser-wasm-gpu-notice.test.mjs test/browser-wasm-download-resume.test.mjs test/chat-input.test.mjs test/chat-stream-speech.test.mjs test/chat-transcript-scroll.test.mjs test/chat-transient-retention.test.mjs test/cli.test.mjs test/continuous-voice-capture.test.mjs test/core-classic-source.test.mjs test/core-client.test.mjs test/core-host.test.mjs test/core-packaged-web.test.mjs test/core-runtime.test.mjs test/core-stdio.test.mjs test/dbopfs-document-library.test.mjs test/dbopfs-png.test.mjs test/dbopfs.test.mjs test/dev-server.test.mjs test/dev-pwa.test.mjs test/dom-event-instrumentation.test.mjs test/event-manager.test.mjs test/events.test.mjs test/file-preview.test.mjs test/import-map.test.mjs test/mail-cli.test.mjs test/mail-runtime.test.mjs test/mail-server.test.mjs test/markdown-editor.test.mjs test/markdown-media.test.mjs test/markdown-source-map.test.mjs test/modal.test.mjs test/native-module-packaging.test.mjs test/native-module-resource-references.test.mjs test/packaging.test.mjs test/pwa-packaging.test.mjs test/pwa-client.test.mjs test/pwa-install.test.mjs test/pwa-worker.test.mjs test/persistent-ai-chat-session.test.mjs test/reference-completeness.test.mjs test/rendered-print.test.mjs test/runtime-api-behavior.test.mjs test/runtime.test.mjs test/scaffold.test.mjs test/speech-playback.test.mjs test/site.test.mjs test/theme-manager.test.mjs test/twin-cloud-images.test.mjs test/twin-cloud.test.mjs test/websocket-client-import-map.test.mjs test/websocket.test.mjs test/update-check.test.mjs test/user-explicit-updates.test.mjs",
|
|
112
|
+
"test:integration": "node ./bin/arcane-test.mjs test/installed-package-runtime.test.mjs test/root-app-layout.test.mjs test/integrated-shared.test.mjs test/integrated-workspace.test.mjs test/mail-browser.test.mjs test/native-macos-provider.test.mjs test/native-plan.test.mjs test/native-portable-provider.test.mjs test/native-provider-loader.test.mjs test/npm-release.test.mjs test/release-bundle.test.mjs test/release-capability-smoke.test.mjs test/shared-payload-batch.test.mjs test/tarball.test.mjs test/browser-wasm-cpu.test.mjs test/wllama-webgpu-runtime.test.mjs",
|
|
105
113
|
"test:regression": "node ./bin/arcane-test.mjs test/channel-workflows.test.mjs test/html-import-registration.test.mjs test/html-import-packaged-script.test.mjs test/logging-regression.test.mjs test/markdown-speech.test.mjs test/prepared-speech.test.mjs test/native-provider-generation.test.mjs test/speech-queue-regression.test.mjs test/testing.test.mjs test/test-sets.test.mjs",
|
|
106
114
|
"check": "node tools/check-source.mjs && npm test",
|
|
107
115
|
"check:release": "node tools/check-source.mjs --package-only && npm run test:release",
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
"minItems": 1,
|
|
181
181
|
"uniqueItems": true,
|
|
182
182
|
"items": {
|
|
183
|
-
"enum": ["android-arm64", "browser", "linux-arm64", "linux-x64", "portable", "windows-x64"]
|
|
183
|
+
"enum": ["android-arm64", "browser", "linux-arm64", "linux-x64", "macos-arm64", "macos-x64", "portable", "windows-x64"]
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
},
|
|
@@ -262,12 +262,12 @@
|
|
|
262
262
|
"type": "array",
|
|
263
263
|
"items": {
|
|
264
264
|
"oneOf": [
|
|
265
|
-
{ "enum": ["llama.cpp", "ollama"] },
|
|
265
|
+
{ "enum": ["llama.cpp", "ollama", "onnx"] },
|
|
266
266
|
{
|
|
267
267
|
"type": "object",
|
|
268
268
|
"required": ["id"],
|
|
269
269
|
"properties": {
|
|
270
|
-
"id": { "enum": ["llama.cpp", "ollama"] },
|
|
270
|
+
"id": { "enum": ["llama.cpp", "ollama", "onnx"] },
|
|
271
271
|
"version": { "type": "string" },
|
|
272
272
|
"url": { "type": "string" }
|
|
273
273
|
}
|
|
@@ -156,12 +156,12 @@
|
|
|
156
156
|
"type": "array",
|
|
157
157
|
"items": {
|
|
158
158
|
"oneOf": [
|
|
159
|
-
{ "enum": ["llama.cpp", "ollama"] },
|
|
159
|
+
{ "enum": ["llama.cpp", "ollama", "onnx"] },
|
|
160
160
|
{
|
|
161
161
|
"type": "object",
|
|
162
162
|
"required": ["id"],
|
|
163
163
|
"properties": {
|
|
164
|
-
"id": { "enum": ["llama.cpp", "ollama"] },
|
|
164
|
+
"id": { "enum": ["llama.cpp", "ollama", "onnx"] },
|
|
165
165
|
"version": { "type": "string" },
|
|
166
166
|
"url": { "type": "string" }
|
|
167
167
|
}
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
{
|
|
118
118
|
"properties": {
|
|
119
119
|
"target": { "const": "portable" },
|
|
120
|
-
"platform": { "enum": ["windows", "linux"] },
|
|
120
|
+
"platform": { "enum": ["windows", "linux", "macos"] },
|
|
121
121
|
"architecture": { "enum": ["x64", "arm64"] },
|
|
122
122
|
"format": { "const": "portable" }
|
|
123
123
|
}
|
|
@@ -163,6 +163,32 @@
|
|
|
163
163
|
}
|
|
164
164
|
]
|
|
165
165
|
},
|
|
166
|
+
{
|
|
167
|
+
"allOf": [
|
|
168
|
+
{ "$ref": "#/$defs/unsignedTargetRequest" },
|
|
169
|
+
{
|
|
170
|
+
"properties": {
|
|
171
|
+
"target": { "const": "macos-arm64" },
|
|
172
|
+
"platform": { "const": "macos" },
|
|
173
|
+
"architecture": { "const": "arm64" },
|
|
174
|
+
"format": { "const": "app" }
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"allOf": [
|
|
181
|
+
{ "$ref": "#/$defs/unsignedTargetRequest" },
|
|
182
|
+
{
|
|
183
|
+
"properties": {
|
|
184
|
+
"target": { "const": "macos-x64" },
|
|
185
|
+
"platform": { "const": "macos" },
|
|
186
|
+
"architecture": { "const": "x64" },
|
|
187
|
+
"format": { "const": "app" }
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
},
|
|
166
192
|
{
|
|
167
193
|
"type": "object",
|
|
168
194
|
"required": ["target", "platform", "architecture", "format", "signing", "signingProfileId"],
|
package/src/app-descriptor.mjs
CHANGED
|
@@ -449,7 +449,7 @@ function synthesizedDescriptor(packageManifest,nativeDescriptor){
|
|
|
449
449
|
features:[]
|
|
450
450
|
},
|
|
451
451
|
targets:nativeDescriptor!==undefined
|
|
452
|
-
?['android-arm64','browser','linux-arm64','linux-x64','portable','windows-x64']
|
|
452
|
+
?['android-arm64','browser','linux-arm64','linux-x64','macos-arm64','macos-x64','portable','windows-x64']
|
|
453
453
|
:['browser']
|
|
454
454
|
},{appId:packageManifest.id});
|
|
455
455
|
}
|
package/src/cli/main.mjs
CHANGED
|
@@ -67,7 +67,7 @@ Usage:
|
|
|
67
67
|
${CLI_NAME} upgrade [--workspace <directory>] [--app <id>]
|
|
68
68
|
${CLI_NAME} doctor [--workspace <directory>] [--arcane-root <directory>]
|
|
69
69
|
${CLI_NAME} import-map [--workspace <directory>] [--app <id>]
|
|
70
|
-
${CLI_NAME} dev [--app <id>] [--public] [--http | --https] [--cert <pem>] [--key <pem>] [--host <address>] [--port 8000] [--http-port 0] [--sdk-runtime-source <sdk-root>] [--local-ai llama.cpp,ollama]
|
|
70
|
+
${CLI_NAME} dev [--app <id>] [--public] [--http | --https] [--cert <pem>] [--key <pem>] [--host <address>] [--port 8000] [--http-port 0] [--sdk-runtime-source <sdk-root>] [--local-ai llama.cpp,ollama,onnx]
|
|
71
71
|
${CLI_NAME} test [--app <id>] [--scope app]
|
|
72
72
|
${CLI_NAME} test --scope shared --test-file <repo-relative.test.mjs>
|
|
73
73
|
${CLI_NAME} check [--app <id>] [--scope app] [--skip-tests]
|
|
@@ -738,6 +738,16 @@ function operationOptions(command,parsed,cwd){
|
|
|
738
738
|
}
|
|
739
739
|
|
|
740
740
|
const NATIVE_REQUESTS={
|
|
741
|
+
'macos-arm64':{
|
|
742
|
+
platform:'macos',architecture:'arm64',defaultFormat:'app',formats:new Set(['app']),
|
|
743
|
+
defaultSigning:'unsigned-local-test',defaultProfileId:null,
|
|
744
|
+
signingModes:new Set(['unsigned-local-test'])
|
|
745
|
+
},
|
|
746
|
+
'macos-x64':{
|
|
747
|
+
platform:'macos',architecture:'x64',defaultFormat:'app',formats:new Set(['app']),
|
|
748
|
+
defaultSigning:'unsigned-local-test',defaultProfileId:null,
|
|
749
|
+
signingModes:new Set(['unsigned-local-test'])
|
|
750
|
+
},
|
|
741
751
|
'windows-x64':{
|
|
742
752
|
platform:'windows',architecture:'x64',defaultFormat:'exe',formats:new Set(['exe']),
|
|
743
753
|
defaultSigning:'unsigned-local-test',defaultProfileId:null,
|
|
@@ -761,9 +771,9 @@ const NATIVE_REQUESTS={
|
|
|
761
771
|
};
|
|
762
772
|
|
|
763
773
|
function portableRequestDefinition(){
|
|
764
|
-
const platform=process.platform==='win32'?'windows':process.platform;
|
|
774
|
+
const platform=process.platform==='win32'?'windows':process.platform==='darwin'?'macos':process.platform;
|
|
765
775
|
const architecture=process.arch==='x64'?'x64':process.arch==='arm64'?'arm64':process.arch;
|
|
766
|
-
if(!['windows','linux'].includes(platform)||!['x64','arm64'].includes(architecture)){
|
|
776
|
+
if(!['windows','linux','macos'].includes(platform)||!['x64','arm64'].includes(architecture)){
|
|
767
777
|
throw new ArcaneError(
|
|
768
778
|
ERROR_CODES.targetUnavailable,
|
|
769
779
|
`The portable native provider does not support ${process.platform}/${process.arch}.`
|
|
@@ -817,7 +827,7 @@ async function pairNativeProvider(command,options,loadProvider,{signal,onEvent}=
|
|
|
817
827
|
usage(`${command} requires one native target.`);
|
|
818
828
|
}
|
|
819
829
|
const targetRequest=createNativeTargetRequest(options);
|
|
820
|
-
if(!options.arcaneRoot&&!['portable','windows-x64'].includes(options.target)){
|
|
830
|
+
if(!options.arcaneRoot&&!['portable','windows-x64','macos-arm64','macos-x64'].includes(options.target)){
|
|
821
831
|
usage(`${command} for target ${options.target} requires --arcane-root <directory>.`);
|
|
822
832
|
}
|
|
823
833
|
const loaded=await loadProvider({
|
package/src/constants.mjs
CHANGED
package/src/core/host.mjs
CHANGED
|
@@ -6,13 +6,22 @@ import {startCoreStdio} from './stdio.mjs';
|
|
|
6
6
|
const is = new Is(false);
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* field meanings belong to the launch owner and individual services.
|
|
9
|
+
* The host's separate state-root argument supplies a launch-context default.
|
|
10
|
+
* Every field in an explicitly selected launch JSON object takes precedence
|
|
11
|
+
* unchanged; field meanings belong to the launch owner and individual services.
|
|
12
12
|
*/
|
|
13
13
|
export async function readCoreLaunchContext({argv = process.argv.slice(2)} = {}) {
|
|
14
|
+
const stateFlag = argv.indexOf('--arcane-host-state-root');
|
|
15
|
+
const defaults = {};
|
|
16
|
+
if (stateFlag !== -1) {
|
|
17
|
+
const stateRoot = argv[stateFlag + 1];
|
|
18
|
+
if (stateRoot === undefined || stateRoot === '') {
|
|
19
|
+
throw new TypeError('--arcane-host-state-root requires a directory.');
|
|
20
|
+
}
|
|
21
|
+
defaults.stateRoot = stateRoot;
|
|
22
|
+
}
|
|
14
23
|
const flag = argv.indexOf('--arcane-launch-config');
|
|
15
|
-
if (flag === -1) return
|
|
24
|
+
if (flag === -1) return defaults;
|
|
16
25
|
const filename = argv[flag + 1];
|
|
17
26
|
if (filename === undefined || filename === '') {
|
|
18
27
|
throw new TypeError('--arcane-launch-config requires a filename.');
|
|
@@ -21,7 +30,7 @@ export async function readCoreLaunchContext({argv = process.argv.slice(2)} = {})
|
|
|
21
30
|
if (context === null || !is.object(context) || is.array(context)) {
|
|
22
31
|
throw new TypeError('Core launch configuration must be a JSON object.');
|
|
23
32
|
}
|
|
24
|
-
return context;
|
|
33
|
+
return {...defaults, ...context};
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
/** Compose app services with the shared dispatcher and draining transport. */
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#import <AppKit/AppKit.h>
|
|
2
|
+
#import <WebKit/WebKit.h>
|
|
3
|
+
#import "ArcaneCoreProcess.h"
|
|
4
|
+
|
|
5
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
6
|
+
|
|
7
|
+
@class ArcaneHost;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Main-thread callbacks. Return promptly; process readers never wait for these
|
|
11
|
+
* callbacks. Output and frame callbacks expose complete native diagnostics,
|
|
12
|
+
* including responses whose original document activation has retired.
|
|
13
|
+
* The delegate is retained until the host finishes closing.
|
|
14
|
+
* Bridge failures preserve NSError domain/code and full nested userInfo;
|
|
15
|
+
* NSURL and NSData use explicit reversible transport records. If an actual
|
|
16
|
+
* native value cannot cross WebKit, the bridge reports that representation
|
|
17
|
+
* failure and the delegate retains the complete original diagnostic.
|
|
18
|
+
*/
|
|
19
|
+
@protocol ArcaneHostDelegate <NSObject>
|
|
20
|
+
- (void)host:(ArcaneHost *)host didLaunchCoreProcess:(pid_t)processIdentifier;
|
|
21
|
+
- (void)host:(ArcaneHost *)host receivedOutputData:(NSData *)data stream:(ArcaneCoreOutputStream)stream;
|
|
22
|
+
- (void)host:(ArcaneHost *)host receivedFrameData:(NSData *)data;
|
|
23
|
+
- (void)host:(ArcaneHost *)host didEncounterError:(NSError *)error;
|
|
24
|
+
- (void)host:(ArcaneHost *)host didExitCoreProcessWithStatus:(int)status reason:(NSTaskTerminationReason)reason;
|
|
25
|
+
- (void)host:(ArcaneHost *)host coreDidCompleteWithErrors:(NSArray<NSError *> *)errors;
|
|
26
|
+
@end
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Generic AppKit/WebKit composition. Compile with Objective-C ARC and blocks,
|
|
30
|
+
* linking only AppKit, WebKit and Foundation plus ArcaneCoreProcess.
|
|
31
|
+
* Public methods and properties belong to the main thread.
|
|
32
|
+
*/
|
|
33
|
+
API_AVAILABLE(macos(11.0))
|
|
34
|
+
@interface ArcaneHost : NSWindowController
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Opens immediately while the explicit Core executable starts on its own queue.
|
|
38
|
+
* Supply an already-serving applicationURL to load immediately, or nil and call
|
|
39
|
+
* loadApplicationURL: when the serving owner's listener-ready result arrives.
|
|
40
|
+
* Process creation is not listener readiness. The caller owns NSApplication,
|
|
41
|
+
* its menus/delegate, actual serving origin, selected start URL and website
|
|
42
|
+
* data store. Navigation keeps Core and accepted service-lifetime work alive.
|
|
43
|
+
*
|
|
44
|
+
* Supply canonical createCoreClassicSource({eventOwnerModuleURL,
|
|
45
|
+
* replayRuntimeState:true,webKitDocumentLifecycle:true}) output. It is installed
|
|
46
|
+
* unchanged at document start in the main frame's page world, before app code.
|
|
47
|
+
* No file/custom-scheme serving, application client copy or certificate policy
|
|
48
|
+
* is provided here. Arguments exclude argv[0]; Core inherits the environment.
|
|
49
|
+
* Events broadcast to the current document; periods without one remain fully
|
|
50
|
+
* observable through native diagnostics. The shared client replays current
|
|
51
|
+
* runtime state after activation instead of replaying old transient events.
|
|
52
|
+
*/
|
|
53
|
+
+ (instancetype)openApplicationURL:(NSURL * _Nullable)applicationURL
|
|
54
|
+
websiteDataStore:(WKWebsiteDataStore *)websiteDataStore
|
|
55
|
+
title:(NSString *)title
|
|
56
|
+
contentFrame:(NSRect)contentFrame
|
|
57
|
+
classicSource:(NSString *)classicSource
|
|
58
|
+
executableURL:(NSURL *)executableURL
|
|
59
|
+
arguments:(NSArray<NSString *> *)arguments
|
|
60
|
+
workingDirectoryURL:(NSURL *)workingDirectoryURL
|
|
61
|
+
delegate:(id<ArcaneHostDelegate>)delegate;
|
|
62
|
+
|
|
63
|
+
@property(nonatomic, readonly) WKWebView *webView;
|
|
64
|
+
|
|
65
|
+
/** True after a host/window close requests the existing Core drain. */
|
|
66
|
+
@property(nonatomic, readonly, getter=isClosing) BOOL closing;
|
|
67
|
+
|
|
68
|
+
/** Loads the selected app URL after its serving owner is ready. */
|
|
69
|
+
- (WKNavigation * _Nullable)loadApplicationURL:(NSURL *)applicationURL;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Idempotent, nonblocking shutdown: stop accepting writes, send ordered stdin
|
|
73
|
+
* EOF, drain process output/exit and pending native deliveries, then close the
|
|
74
|
+
* window. Direct NSWindow.close is also observed and drains while hidden.
|
|
75
|
+
* Each supplied completion runs once on the main thread with all host errors.
|
|
76
|
+
* The caller can use this completion with NSApplicationTerminateLater and its
|
|
77
|
+
* own replyToApplicationShouldTerminate:, without replacing its app delegate.
|
|
78
|
+
*/
|
|
79
|
+
- (void)closeWithCompletion:(void (^ _Nullable)(NSArray<NSError *> *errors))completion;
|
|
80
|
+
- (void)close;
|
|
81
|
+
|
|
82
|
+
- (instancetype)init NS_UNAVAILABLE;
|
|
83
|
+
+ (instancetype)new NS_UNAVAILABLE;
|
|
84
|
+
@end
|
|
85
|
+
|
|
86
|
+
NS_ASSUME_NONNULL_END
|