arcane-os 0.13.3 → 0.15.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.
@@ -718,7 +718,7 @@ function deployDevelopmentServer(fileServer, signal, {tlsServer, host, port}) {
718
718
  if (!listeners.every(listener => ready.has(listener))) return;
719
719
  settled = true;
720
720
  cleanupDeployment();
721
- resolve(tlsServer ?? fileServer.secureServer);
721
+ resolve(tlsServer ?? fileServer.secureServer ?? fileServer.server);
722
722
  }
723
723
  try {
724
724
  throwIfAborted(signal);
@@ -804,6 +804,8 @@ async function startOwnedDevServer({
804
804
  host='127.0.0.1',
805
805
  port=0,
806
806
  httpPort=0,
807
+ http = false,
808
+ https: requestedHttps,
807
809
  tls,
808
810
  certPath,
809
811
  keyPath,
@@ -822,22 +824,33 @@ async function startOwnedDevServer({
822
824
  if (!is.integer(httpPort) || httpPort < 0 || httpPort > 65535) {
823
825
  fail('httpPort must be an integer from 0 through 65535.', 'ARCANE_USAGE');
824
826
  }
827
+ if (!is.boolean(http)) {
828
+ fail('http must be a boolean.', 'ARCANE_USAGE');
829
+ }
830
+ if (http && mode !== 'source') {
831
+ fail('HTTP serving is supported only in source development mode.', 'ARCANE_USAGE');
832
+ }
833
+ if (http && (requestedHttps === true || (tls !== undefined && tls !== null && tls !== false)
834
+ || certPath !== undefined || keyPath !== undefined || httpPort !== 0)) {
835
+ fail('HTTP development cannot combine TLS options or a separate httpPort; select its listener with port.', 'ARCANE_USAGE');
836
+ }
837
+ const protocol = http ? 'http:' : 'https:';
825
838
  const requestedRuntimeMode=mode==='source'&&sdkRuntimeSourceRoot!==undefined
826
839
  ?'sdk-source'
827
840
  :null;
828
841
  await events.send({
829
842
  type:'server.starting',
843
+ protocol,
830
844
  mode,
831
845
  host,
832
846
  port,
833
- httpPort,
847
+ httpPort: http ? port : httpPort,
834
848
  appId,
835
849
  ...(requestedRuntimeMode?{runtimeMode:requestedRuntimeMode}:{})
836
850
  });
837
- const selectedTls=await resolveDevelopmentTls({
838
- workspaceRoot,tls,certPath,keyPath,signal
839
- });
840
- const protocol = 'https:';
851
+ const selectedTls = http ? null : await resolveDevelopmentTls(
852
+ {workspaceRoot, tls, certPath, keyPath, signal}
853
+ );
841
854
  throwIfAborted(signal);
842
855
  const routeSet=mode==='source'
843
856
  ?await sourceRoutes(workspaceRoot,appId,{
@@ -1093,7 +1106,7 @@ async function startOwnedDevServer({
1093
1106
  async function serveDevelopmentRequest(request, response) {
1094
1107
  let task;
1095
1108
  async function routeDevelopmentRequest() {
1096
- if (!request.socket.encrypted) {
1109
+ if (!http && !request.socket.encrypted) {
1097
1110
  const address = (tlsServer ?? fileServer.secureServer).address();
1098
1111
  const authority = new URL(`http://${request.headers.host || browserHostname(host)}`);
1099
1112
  authority.protocol = 'https:';
@@ -1262,16 +1275,18 @@ async function startOwnedDevServer({
1262
1275
  {
1263
1276
  root: mappings[0].root,
1264
1277
  host,
1265
- port: httpPort,
1278
+ port: http ? port : httpPort,
1266
1279
  server: {noCache: false, timeout: 0},
1267
- https: {
1268
- only: false,
1269
- port,
1270
- ...(selectedTls.options ? {} : {
1271
- privateKey: selectedTls.privateKeyPath,
1272
- certificate: selectedTls.certificatePath
1273
- })
1274
- }
1280
+ ...(http ? {} : {
1281
+ https: {
1282
+ only: false,
1283
+ port,
1284
+ ...(selectedTls.options ? {} : {
1285
+ privateKey: selectedTls.privateKeyPath,
1286
+ certificate: selectedTls.certificatePath
1287
+ })
1288
+ }
1289
+ })
1275
1290
  }
1276
1291
  );
1277
1292
  fileServer.config.contentType = contentType;
@@ -1279,11 +1294,11 @@ async function startOwnedDevServer({
1279
1294
  // The module's public HTTPS configuration accepts PEM paths. Its HTTPS
1280
1295
  // guide leaves advanced TLS inputs to application code; preserve that
1281
1296
  // existing SDK input while the same public module methods serve all content.
1282
- const tlsServer = selectedTls.options
1297
+ const tlsServer = selectedTls?.options
1283
1298
  ? https.createServer(selectedTls.options, serveDevelopmentRequest)
1284
1299
  : null;
1285
1300
  const server = await deployDevelopmentServer(fileServer, signal, {tlsServer, host, port});
1286
- const listeners = [fileServer.server, server];
1301
+ const listeners = [...new Set([fileServer.server, server])];
1287
1302
  const address=server.address();
1288
1303
  if(!address||is.string(address)){
1289
1304
  await closeDevelopmentListeners(fileServer, tlsServer);
@@ -27,6 +27,7 @@ const SDK_BROWSER_SELF_IMPORTS=new Map([
27
27
  ['arcane-os/pwa','sdk/pwa.mjs'],
28
28
  ['arcane-os/speech-text','sdk/speech-text.mjs'],
29
29
  ['arcane-os/ai/browser-wasm',SDK_BROWSER_AI_ENTRY],
30
+ ['arcane-os/ai/tool-text-stream','sdk/ai/tool-text-stream.mjs'],
30
31
  ['arcane-os/ai/browser-speech',SDK_BROWSER_SPEECH_ENTRY]
31
32
  ]);
32
33
  function fail(message,code='ARCANE_IMPORT_MAP_INVALID'){
package/src/toolchain.mjs CHANGED
@@ -516,6 +516,7 @@ export async function developApplication(options = {}) {
516
516
  host:options.host,
517
517
  port:options.port,
518
518
  httpPort:options.httpPort,
519
+ http: options.http,
519
520
  https:options.https,
520
521
  tls:options.tls,
521
522
  certPath:options.certPath,