@casual-simulation/aux-runtime 3.2.7-alpha.6385045848 → 3.2.7-alpha.6777319727

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casual-simulation/aux-runtime",
3
- "version": "3.2.7-alpha.6385045848",
3
+ "version": "3.2.7-alpha.6777319727",
4
4
  "description": "Runtime for AUX projects",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -32,8 +32,8 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@casual-simulation/aux-common": "^3.2.7-alpha.6385045848",
36
- "@casual-simulation/aux-records": "^3.2.7-alpha.6385045848",
35
+ "@casual-simulation/aux-common": "^3.2.7-alpha.6777319727",
36
+ "@casual-simulation/aux-records": "^3.2.7-alpha.6777319727",
37
37
  "@casual-simulation/crypto": "^3.2.0",
38
38
  "@casual-simulation/engine262": "0.0.1-4de2170374e22761996e46eb1362f4496ee57f8f",
39
39
  "@casual-simulation/error-stack-parser": "^2.0.7",
@@ -75,5 +75,5 @@
75
75
  "**/*.d.ts",
76
76
  "**/*.def"
77
77
  ],
78
- "gitHead": "2d6d8b2d8764aba957d36158f186a5d90ef4e536"
78
+ "gitHead": "cb79f312a97a8425a573a851f99f1774f50589ff"
79
79
  }
@@ -20,6 +20,10 @@ export interface AuxDevice {
20
20
  * For example, setting isCollaborative to false would make the shared partition act like a tempLocal partition.
21
21
  */
22
22
  isCollaborative: boolean;
23
+ /**
24
+ * Whether this device can enable collaboration features after the simulation has started.
25
+ */
26
+ allowCollaborationUpgrade: boolean;
23
27
  /**
24
28
  * The URL that AB-1 should be bootstraped from.
25
29
  */
@@ -2140,6 +2140,7 @@ export declare function createDefaultLibrary(context: AuxGlobalContext): {
2140
2140
  version: () => AuxVersion;
2141
2141
  device: () => AuxDevice;
2142
2142
  isCollaborative: () => boolean;
2143
+ enableCollaboration: () => Promise<void>;
2143
2144
  getAB1BootstrapURL: () => string;
2144
2145
  enableAR: (options?: EnableXROptions) => EnableARAction;
2145
2146
  disableAR: () => EnableARAction;
@@ -2332,6 +2333,7 @@ export declare function createDefaultLibrary(context: AuxGlobalContext): {
2332
2333
  };
2333
2334
  listBuiltinTags: () => string[];
2334
2335
  requestAuthBot: () => Promise<Bot>;
2336
+ requestAuthBotInBackground: () => Promise<Bot>;
2335
2337
  getPublicRecordKey: (name: string) => Promise<CreatePublicRecordKeyResult>;
2336
2338
  getSubjectlessPublicRecordKey: (name: string) => Promise<CreatePublicRecordKeyResult>;
2337
2339
  grantRecordMarkerPermission: (recordName: string, marker: string, permission: AvailablePermissions, options?: RecordActionOptions) => Promise<GrantMarkerPermissionResult>;
@@ -19,7 +19,7 @@ var __rest = (this && this.__rest) || function (s, e) {
19
19
  return t;
20
20
  };
21
21
  import { DEBUG_STRING, debugStringifyFunction, } from './AuxGlobalContext';
22
- import { hasValue, trimTag, isBot, BOT_SPACE_TAG, toast as toastMessage, tip as tipMessage, hideTips as hideTipMessages, showJoinCode as calcShowJoinCode, requestFullscreen, exitFullscreen, html as htmlMessage, hideHtml as hideHtmlMessage, setClipboard as calcSetClipboard, tweenTo as calcTweenTo, showChat as calcShowChat, hideChat as calcHideChat, runScript, getMediaPermission as calcGetMediaPermission, getAverageFrameRate as calcGetAverageFrameRate, enableAR as calcEnableAR, disableAR as calcDisableAR, enableVR as calcEnableVR, disableVR as calcDisableVR, arSupported as calcARSupported, vrSupported as calcVRSupported, showUploadAuxFile as calcShowUploadAuxFile, openQRCodeScanner as calcOpenQRCodeScanner, showQRCode as calcShowQRCode, openBarcodeScanner as calcOpenBarcodeScanner, showBarcode as calcShowBarcode, importAUX as calcImportAUX, showInputForTag as calcShowInputForTag, showInput as calcShowInput, showConfirm as calcShowConfirm, replaceDragBot as calcReplaceDragBot, goToDimension as calcGoToDimension, goToURL as calcGoToURL, openURL as calcOpenURL, playSound as calcPlaySound, bufferSound as calcBufferSound, cancelSound as calcCancelSound, shell as calcShell, reject as calcReject, localFormAnimation as calcLocalFormAnimation, webhook as calcWebhook, superShout as calcSuperShout, share as calcShare, registerPrefix as calcRegisterPrefix, localPositionTween as calcLocalPositionTween, localRotationTween as calcLocalRotationTween, showUploadFiles as calcShowUploadFiles, download, loadSimulation, unloadSimulation, getUploadState, addState, getPortalTag, KNOWN_PORTALS, openConsole, tagsOnBot, getOriginalObject, getBotSpace, trimEvent, CREATE_ACTION_NAME, CREATE_ANY_ACTION_NAME, DESTROY_ACTION_NAME, ORIGINAL_OBJECT, getRemoteCount, getRemotes, listInstUpdates as calcListInstUpdates, getInstStateFromUpdates as calcGetInstStateFromUpdates, action, calculateAnchorPoint, calculateAnchorPointOffset, getBotPosition as calcGetBotPosition, getBotRotation as calcGetBotRotation, isRuntimeBot, SET_TAG_MASK_SYMBOL, CLEAR_TAG_MASKS_SYMBOL, getBotScale, EDIT_TAG_SYMBOL, EDIT_TAG_MASK_SYMBOL, circleWipe, addDropSnap as calcAddDropSnap, addDropGrid as calcAddDropGrid, animateToPosition, beginAudioRecording as calcBeginAudioRecording, endAudioRecording as calcEndAudioRecording, beginRecording as calcBeginRecording, endRecording as calcEndRecording, speakText as calcSpeakText, getVoices as calcGetVoices, getGeolocation as calcGetGeolocation, cancelAnimation, disablePOV, enablePOV, enableCustomDragging as calcEnableCustomDragging, MINI_PORTAL, registerCustomApp, setAppOutput, unregisterCustomApp, requestAuthData as calcRequestAuthData, createBot, defineGlobalBot as calcDefineGlobalBot, TEMPORARY_BOT_PARTITION_ID, convertToString, GET_TAG_MASKS_SYMBOL, isBotLink, parseBotLink, createBotLink, convertGeolocationToWhat3Words as calcConvertGeolocationToWhat3Words, meetCommand as calcMeetCommand, meetFunction as calcMeetFunction, openImageClassifier as calcOpenImageClassifier, isBotDate, DATE_TAG_PREFIX, parseBotDate, realNumberOrDefault, raycastFromCamera as calcRaycastFromCamera, raycastInPortal as calcRaycastInPortal, calculateRayFromCamera as calcCalculateRayFromCamera, bufferFormAddressGltf, startFormAnimation as calcStartFormAnimation, stopFormAnimation as calcStopFormAnimation, listFormAnimations as calcListFormAnimations, calculateStringTagValue, createInitializationUpdate as calcCreateInitalizationUpdate, applyUpdatesToInst as calcApplyUpdatesToInst, configureWakeLock, getWakeLockConfiguration as calcGetWakeLockConfiguration, analyticsRecordEvent as calcAnalyticsRecordEvent, KNOWN_TAGS, isStoredVersion2, getCurrentInstUpdate as calcGetCurrentInstUpdate, openPhotoCamera as calcOpenPhotoCamera, getEasing, } from '@casual-simulation/aux-common/bots';
22
+ import { hasValue, trimTag, isBot, BOT_SPACE_TAG, toast as toastMessage, tip as tipMessage, hideTips as hideTipMessages, showJoinCode as calcShowJoinCode, requestFullscreen, exitFullscreen, html as htmlMessage, hideHtml as hideHtmlMessage, setClipboard as calcSetClipboard, tweenTo as calcTweenTo, showChat as calcShowChat, hideChat as calcHideChat, runScript, getMediaPermission as calcGetMediaPermission, getAverageFrameRate as calcGetAverageFrameRate, enableAR as calcEnableAR, disableAR as calcDisableAR, enableVR as calcEnableVR, disableVR as calcDisableVR, arSupported as calcARSupported, vrSupported as calcVRSupported, showUploadAuxFile as calcShowUploadAuxFile, openQRCodeScanner as calcOpenQRCodeScanner, showQRCode as calcShowQRCode, openBarcodeScanner as calcOpenBarcodeScanner, showBarcode as calcShowBarcode, importAUX as calcImportAUX, showInputForTag as calcShowInputForTag, showInput as calcShowInput, showConfirm as calcShowConfirm, replaceDragBot as calcReplaceDragBot, goToDimension as calcGoToDimension, goToURL as calcGoToURL, openURL as calcOpenURL, playSound as calcPlaySound, bufferSound as calcBufferSound, cancelSound as calcCancelSound, shell as calcShell, reject as calcReject, localFormAnimation as calcLocalFormAnimation, webhook as calcWebhook, superShout as calcSuperShout, share as calcShare, registerPrefix as calcRegisterPrefix, localPositionTween as calcLocalPositionTween, localRotationTween as calcLocalRotationTween, showUploadFiles as calcShowUploadFiles, download, loadSimulation, unloadSimulation, getUploadState, addState, getPortalTag, KNOWN_PORTALS, openConsole, tagsOnBot, getOriginalObject, getBotSpace, trimEvent, CREATE_ACTION_NAME, CREATE_ANY_ACTION_NAME, DESTROY_ACTION_NAME, ORIGINAL_OBJECT, getRemoteCount, getRemotes, listInstUpdates as calcListInstUpdates, getInstStateFromUpdates as calcGetInstStateFromUpdates, action, calculateAnchorPoint, calculateAnchorPointOffset, getBotPosition as calcGetBotPosition, getBotRotation as calcGetBotRotation, isRuntimeBot, SET_TAG_MASK_SYMBOL, CLEAR_TAG_MASKS_SYMBOL, getBotScale, EDIT_TAG_SYMBOL, EDIT_TAG_MASK_SYMBOL, circleWipe, addDropSnap as calcAddDropSnap, addDropGrid as calcAddDropGrid, animateToPosition, beginAudioRecording as calcBeginAudioRecording, endAudioRecording as calcEndAudioRecording, beginRecording as calcBeginRecording, endRecording as calcEndRecording, speakText as calcSpeakText, getVoices as calcGetVoices, getGeolocation as calcGetGeolocation, cancelAnimation, disablePOV, enablePOV, enableCustomDragging as calcEnableCustomDragging, MINI_PORTAL, registerCustomApp, setAppOutput, unregisterCustomApp, requestAuthData as calcRequestAuthData, createBot, defineGlobalBot as calcDefineGlobalBot, TEMPORARY_BOT_PARTITION_ID, convertToString, GET_TAG_MASKS_SYMBOL, isBotLink, parseBotLink, createBotLink, convertGeolocationToWhat3Words as calcConvertGeolocationToWhat3Words, meetCommand as calcMeetCommand, meetFunction as calcMeetFunction, openImageClassifier as calcOpenImageClassifier, isBotDate, DATE_TAG_PREFIX, parseBotDate, realNumberOrDefault, raycastFromCamera as calcRaycastFromCamera, raycastInPortal as calcRaycastInPortal, calculateRayFromCamera as calcCalculateRayFromCamera, bufferFormAddressGltf, startFormAnimation as calcStartFormAnimation, stopFormAnimation as calcStopFormAnimation, listFormAnimations as calcListFormAnimations, calculateStringTagValue, createInitializationUpdate as calcCreateInitalizationUpdate, applyUpdatesToInst as calcApplyUpdatesToInst, configureWakeLock, getWakeLockConfiguration as calcGetWakeLockConfiguration, analyticsRecordEvent as calcAnalyticsRecordEvent, KNOWN_TAGS, isStoredVersion2, getCurrentInstUpdate as calcGetCurrentInstUpdate, openPhotoCamera as calcOpenPhotoCamera, getEasing, enableCollaboration as calcEnableCollaboration, } from '@casual-simulation/aux-common/bots';
23
23
  import { aiChat, aiGenerateSkybox, aiGenerateImage, grantRecordMarkerPermission as calcGrantRecordMarkerPermission, revokeRecordMarkerPermission as calcRevokeRecordMarkerPermission, grantInstAdminPermission as calcGrantInstAdminPermission, grantUserRole as calcGrantUserRole, revokeUserRole as calcRevokeUserRole, grantInstRole as calcGrantInstRole, revokeInstRole as calcRevokeInstRole, listUserStudios as calcListUserStudios, joinRoom as calcJoinRoom, leaveRoom as calcLeaveRoom, setRoomOptions as calcSetRoomOptions, getRoomOptions as calcGetRoomOptions, getRoomTrackOptions as calcGetRoomTrackOptions, setRoomTrackOptions as calcSetRoomTrackOptions, getRoomRemoteOptions as calcGetRoomRemoteOptions, listDataRecord, recordEvent as calcRecordEvent, getEventCount as calcGetEventCount, getFile as calcGetFile, eraseFile as calcEraseFile, getPublicRecordKey as calcGetPublicRecordKey, recordData as calcRecordData, getRecordData, eraseRecordData, recordFile as calcRecordFile, } from './RecordsEvents';
24
24
  import { sortBy, every, cloneDeep, union, isEqual, flatMap, } from 'lodash';
25
25
  import { remote as calcRemote, DEFAULT_BRANCH_NAME, } from '@casual-simulation/aux-common';
@@ -350,6 +350,7 @@ export function createDefaultLibrary(context) {
350
350
  version,
351
351
  device,
352
352
  isCollaborative,
353
+ enableCollaboration,
353
354
  getAB1BootstrapURL,
354
355
  enableAR,
355
356
  disableAR,
@@ -527,6 +528,7 @@ export function createDefaultLibrary(context) {
527
528
  appHooks: Object.assign(Object.assign({}, hooks), { render }),
528
529
  listBuiltinTags,
529
530
  requestAuthBot,
531
+ requestAuthBotInBackground,
530
532
  getPublicRecordKey,
531
533
  getSubjectlessPublicRecordKey,
532
534
  grantRecordMarkerPermission,
@@ -2394,6 +2396,7 @@ export function createDefaultLibrary(context) {
2394
2396
  supportsAR: null,
2395
2397
  supportsVR: null,
2396
2398
  isCollaborative: null,
2399
+ allowCollaborationUpgrade: null,
2397
2400
  ab1BootstrapUrl: null,
2398
2401
  };
2399
2402
  }
@@ -2417,6 +2420,29 @@ export function createDefaultLibrary(context) {
2417
2420
  }
2418
2421
  return true;
2419
2422
  }
2423
+ /**
2424
+ * Attempts to enable collaboration features on the device.
2425
+ *
2426
+ * @example Enable collaboration on this device.
2427
+ * await os.enableCollaboration();
2428
+ *
2429
+ * @dochash actions/os
2430
+ * @docname os.enableCollaboration
2431
+ * @docgroup 10-os-info
2432
+ */
2433
+ function enableCollaboration() {
2434
+ if (context.device) {
2435
+ if (!context.device.isCollaborative) {
2436
+ if (!context.device.allowCollaborationUpgrade) {
2437
+ return Promise.reject(new Error('Collaboration cannot be enabled on this device'));
2438
+ }
2439
+ const task = context.createTask();
2440
+ const event = calcEnableCollaboration(task.taskId);
2441
+ return addAsyncAction(task, event);
2442
+ }
2443
+ }
2444
+ return Promise.resolve();
2445
+ }
2420
2446
  /**
2421
2447
  * Gets the URL that AB1 should be bootstrapped from.
2422
2448
  */
@@ -4418,6 +4444,8 @@ export function createDefaultLibrary(context) {
4418
4444
  *
4419
4445
  * See [Auth Bot Tags](page:tags#auth-bot-tags) for more information.
4420
4446
  *
4447
+ * See {@link os.requestAuthBotInBackground} for a version of this function that does not show a popup if the user is not signed in.
4448
+ *
4421
4449
  * @example Request an auth bot for the user
4422
4450
  * await os.requestAuthBot();
4423
4451
  * os.toast("Logged in!");
@@ -4430,8 +4458,44 @@ export function createDefaultLibrary(context) {
4430
4458
  * @docname os.requestAuthBot
4431
4459
  */
4432
4460
  function requestAuthBot() {
4461
+ return _requestAuthBot(false);
4462
+ }
4463
+ /**
4464
+ * Requests that an "authentication" bot be added to the inst for the current browser tab.
4465
+ * Works similarly to {@link os.requestAuthBot}, except that the request will not show a popup if the user is not signed in.
4466
+ *
4467
+ * Auth bots are useful for discovering general information about the logged in user and are typically associated with a [https://publicos.link](https://publicos.link) user account.
4468
+ *
4469
+ * Returns a promise that resolves with a bot that contains information about the signed in user session.
4470
+ * Resolves with `null` if the user is not already signed in.
4471
+ *
4472
+ * On success, the `authBot` global variable will reference the bot that was returned by the promise.
4473
+ *
4474
+ * See [Auth Bot Tags](page:tags#auth-bot-tags) for more information.
4475
+ *
4476
+ * See {@link os.requestAuthBot} for a version of this function that shows a popup if the user is not signed in.
4477
+ *
4478
+ * @example Request the auth bot in the background.
4479
+ * const authBot = await os.requestAuthBotInBackground();
4480
+ * if (authBot) {
4481
+ * os.toast("Logged in!");
4482
+ * } else {
4483
+ * os.toast("Not logged in.");
4484
+ * }
4485
+ *
4486
+ * @dochash actions/records
4487
+ * @doctitle Records Actions
4488
+ * @docsidebar Records
4489
+ * @docdescription Records are a way to store permenent data in CasualOS.
4490
+ * @docgroup 01-records
4491
+ * @docname os.requestAuthBotInBackground
4492
+ */
4493
+ function requestAuthBotInBackground() {
4494
+ return _requestAuthBot(true);
4495
+ }
4496
+ function _requestAuthBot(background) {
4433
4497
  return __awaiter(this, void 0, void 0, function* () {
4434
- const data = yield requestAuthData();
4498
+ const data = yield requestAuthData(background);
4435
4499
  if (!data) {
4436
4500
  return null;
4437
4501
  }
@@ -4449,9 +4513,9 @@ export function createDefaultLibrary(context) {
4449
4513
  return bot;
4450
4514
  });
4451
4515
  }
4452
- function requestAuthData() {
4516
+ function requestAuthData(background) {
4453
4517
  const task = context.createTask();
4454
- const event = calcRequestAuthData(task.taskId);
4518
+ const event = calcRequestAuthData(background, task.taskId);
4455
4519
  return addAsyncAction(task, event);
4456
4520
  }
4457
4521
  function defineGlobalBot(name, botId) {