@casual-simulation/aux-runtime 3.4.0-alpha.14070378151 → 3.4.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.
Files changed (48) hide show
  1. package/LICENSE.txt +12 -17
  2. package/index.d.ts +0 -24
  3. package/index.js +12 -19
  4. package/index.js.map +1 -1
  5. package/package.json +8 -8
  6. package/runtime/AuxCompiler.js +17 -0
  7. package/runtime/AuxCompiler.js.map +1 -1
  8. package/runtime/AuxDevice.d.ts +0 -9
  9. package/runtime/AuxDevice.js +17 -0
  10. package/runtime/AuxDevice.js.map +1 -1
  11. package/runtime/AuxGlobalContext.js.map +1 -1
  12. package/runtime/AuxLibrary.d.ts +5 -1
  13. package/runtime/AuxLibrary.js +85 -2
  14. package/runtime/AuxLibrary.js.map +1 -1
  15. package/runtime/AuxLibraryDefinitions.def +203 -0
  16. package/runtime/AuxPartitionRealtimeEditModeProvider.js.map +1 -1
  17. package/runtime/AuxRealtimeEditModeProvider.js +17 -0
  18. package/runtime/AuxRealtimeEditModeProvider.js.map +1 -1
  19. package/runtime/AuxResults.js.map +1 -1
  20. package/runtime/AuxRuntime.js +17 -7
  21. package/runtime/AuxRuntime.js.map +1 -1
  22. package/runtime/AuxRuntimeDynamicImports.js +17 -0
  23. package/runtime/AuxRuntimeDynamicImports.js.map +1 -1
  24. package/runtime/AuxVersion.d.ts +0 -5
  25. package/runtime/AuxVersion.js +17 -0
  26. package/runtime/AuxVersion.js.map +1 -1
  27. package/runtime/CasualOSError.d.ts +0 -6
  28. package/runtime/CasualOSError.js +17 -0
  29. package/runtime/CasualOSError.js.map +1 -1
  30. package/runtime/CompiledBot.js.map +1 -1
  31. package/runtime/PerformanceNowPolyfill.js +17 -0
  32. package/runtime/PerformanceNowPolyfill.js.map +1 -1
  33. package/runtime/RecordsEvents.d.ts +9 -0
  34. package/runtime/RecordsEvents.js +22 -0
  35. package/runtime/RecordsEvents.js.map +1 -1
  36. package/runtime/RuntimeBot.js.map +1 -1
  37. package/runtime/RuntimeEvents.js.map +1 -1
  38. package/runtime/RuntimeStateVersion.js.map +1 -1
  39. package/runtime/Transpiler.js +17 -0
  40. package/runtime/Transpiler.js.map +1 -1
  41. package/runtime/TranspilerUtils.d.ts +0 -3
  42. package/runtime/TranspilerUtils.js +17 -0
  43. package/runtime/TranspilerUtils.js.map +1 -1
  44. package/runtime/Utils.js +17 -0
  45. package/runtime/Utils.js.map +1 -1
  46. package/runtime/index.js +17 -0
  47. package/runtime/index.js.map +1 -1
  48. package/runtime/test/TestScriptBotFactory.js.map +1 -1
@@ -10476,6 +10476,192 @@ export interface AISloydGenerateModelOptions {
10476
10476
  }
10477
10477
  }
10478
10478
 
10479
+
10480
+ /**
10481
+ * Defines a request to create a new realtime session.
10482
+ *
10483
+ * @dochash types/ai
10484
+ * @docname RealtimeSessionRequest
10485
+ */
10486
+ export interface CreateRealtimeSessionTokenRequest {
10487
+ /**
10488
+ * The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.
10489
+ *
10490
+ * Note that the server sets default instructions which will be used if this field is not set and are visible in the session.created event at the start of the session.
10491
+ */
10492
+ instructions?: string;
10493
+
10494
+ /**
10495
+ * The Realtime model used for this session.
10496
+ */
10497
+ model: string;
10498
+
10499
+ /**
10500
+ * The set of modalities the model can respond with. To disable audio, set this to ["text"].
10501
+ */
10502
+ modalities?: ('audio' | 'text')[];
10503
+
10504
+ /**
10505
+ * Maximum number of output tokens for a single assistant response, inclusive of tool calls. Provide an integer between 1 and 4096 to limit output tokens, or inf for the maximum available tokens for a given model. Defaults to inf.
10506
+ */
10507
+ maxResponseOutputTokens?: number;
10508
+
10509
+ /**
10510
+ * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel (mono), and little-endian byte order.
10511
+ */
10512
+ inputAudioFormat?: 'pcm16' | 'g711_ulaw' | 'g711_alaw';
10513
+
10514
+ /**
10515
+ * Configuration for input audio noise reduction. This can be set to null to turn off. Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.
10516
+ */
10517
+ inputAudioNoiseReduction?: {
10518
+ /**
10519
+ * Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.
10520
+ */
10521
+ type?: 'near_field' | 'far_field';
10522
+ } | null;
10523
+
10524
+ /**
10525
+ * Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through the /audio/transcriptions endpoint and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.
10526
+ */
10527
+ inputAudioTranscription?: {
10528
+ /**
10529
+ * The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format will improve accuracy and latency.
10530
+ */
10531
+ language?: string;
10532
+
10533
+ /**
10534
+ * The model to use for transcription, current options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `whisper-1`.
10535
+ */
10536
+ model?: string;
10537
+
10538
+ /**
10539
+ * An optional text to guide the model's style or continue a previous audio segment. For `whisper-1`, the prompt is a list of keywords. For `gpt-4o-transcribe` models, the prompt is a free text string, for example "expect words related to technology".
10540
+ */
10541
+ prompt?: string;
10542
+ } | null;
10543
+
10544
+ /**
10545
+ * The format of output audio. Options are pcm16, g711_ulaw, or g711_alaw. For pcm16, output audio is sampled at a rate of 24kHz.
10546
+ */
10547
+ outputAudioFormat?: 'pcm16' | 'g711_ulaw' | 'g711_alaw';
10548
+
10549
+ /**
10550
+ * Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a temperature of 0.8 is highly recommended for best performance.
10551
+ */
10552
+ temperature?: number;
10553
+
10554
+ /**
10555
+ * How the model chooses tools. Options are `auto`, `none`, `required`, or specify a function.
10556
+ */
10557
+ toolChoice?: string;
10558
+
10559
+ /**
10560
+ * Tools (functions) available to the model.
10561
+ */
10562
+ tools?: {
10563
+ /**
10564
+ * The description of the function, including guidance on when and how to call it, and guidance about what to tell the user when calling (if anything).
10565
+ */
10566
+ description?: string;
10567
+
10568
+ /**
10569
+ * The name of the function.
10570
+ */
10571
+ name?: string;
10572
+
10573
+ /**
10574
+ * Parameters of the function in JSON Schema.
10575
+ */
10576
+ parameters?: any;
10577
+
10578
+ /**
10579
+ * The type of the tool, i.e. `function`.
10580
+ */
10581
+ type?: 'function';
10582
+ }[];
10583
+
10584
+ /**
10585
+ * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response. Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech. Semantic VAD is more advanced and uses a turn detection model (in conjuction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.
10586
+ */
10587
+ turnDetection?: {
10588
+ /**
10589
+ * Whether or not to automatically generate a response when a VAD stop event occurs.
10590
+ */
10591
+ createResponse?: boolean;
10592
+
10593
+ /**
10594
+ * Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`.
10595
+ */
10596
+ eagerness?: 'low' | 'medium' | 'high';
10597
+
10598
+ /**
10599
+ * Whether or not to automatically interrupt any ongoing response with output to the default conversation (i.e. `conversation` of `auto`) when a VAD start event occurs.
10600
+ */
10601
+ interruptResponse?: boolean;
10602
+
10603
+ /**
10604
+ * Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in milliseconds). Defaults to 300ms.
10605
+ */
10606
+ prefixPaddingMs?: number;
10607
+
10608
+ /**
10609
+ * Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. With shorter values the model will respond more quickly, but may jump in on short pauses from the user.
10610
+ */
10611
+ silenceDurationMs?: number;
10612
+
10613
+ /**
10614
+ * Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher threshold will require louder audio to activate the model, and thus might perform better in noisy environments.
10615
+ */
10616
+ threshold?: number;
10617
+
10618
+ /**
10619
+ * Type of turn detection.
10620
+ */
10621
+ type?: 'server_vad' | 'semantic_vad';
10622
+ } | null;
10623
+
10624
+ /**
10625
+ * The voice the model uses to respond. Voice cannot be changed during the session once the model has responded with audio at least once. Current voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, and `verse`.
10626
+ */
10627
+ voice?: string;
10628
+ }
10629
+
10630
+ /**
10631
+ * The response to a request to create a realtime session token using the OpenAI interface.
10632
+ * @dochash types/ai
10633
+ * @docname AICreateOpenAIRealtimeSessionTokenResult
10634
+ */
10635
+ export type AICreateOpenAIRealtimeSessionTokenResult =
10636
+ | AICreateOpenAIRealtimeSessionTokenSuccess
10637
+ | AICreateOpenAIRealtimeSessionTokenFailure;
10638
+
10639
+ /**
10640
+ * A successful response to a request to create a realtime session token using the OpenAI interface.
10641
+ * @dochash types/ai
10642
+ * @docname AICreateOpenAIRealtimeSessionTokenSuccess
10643
+ */
10644
+ export interface AICreateOpenAIRealtimeSessionTokenSuccess {
10645
+ success: true;
10646
+ sessionId: string;
10647
+ clientSecret: {
10648
+ value: string;
10649
+ expiresAt: number;
10650
+ };
10651
+ }
10652
+
10653
+ /**
10654
+ * A unsuccessful response to a request to create a realtime session token using the OpenAI interface.
10655
+ * @dochash types/ai
10656
+ * @docname AICreateOpenAIRealtimeSessionTokenFailure
10657
+ */
10658
+ export interface AICreateOpenAIRealtimeSessionTokenFailure {
10659
+ success: false;
10660
+ errorCode: KnownErrorCodes;
10661
+ errorMessage: string;
10662
+ }
10663
+
10664
+
10479
10665
  /**
10480
10666
  * Defines an interface for a generic HTTP response.
10481
10667
  */
@@ -11859,6 +12045,23 @@ interface Ai {
11859
12045
  generateModel(request: AISloydGenerateModelOptions, options?: RecordActionOptions): Promise<AISloydGenerateModelResponse>;
11860
12046
  }
11861
12047
 
12048
+ openai: {
12049
+ /**
12050
+ * Creates a new OpenAI Realtime Session.
12051
+ * @param recordName The name of the record that the session is for.
12052
+ * @param request The request options for the session.
12053
+ * @param options The options for the records request.
12054
+ *
12055
+ * @dochash actions/ai
12056
+ * @docname ai.openai.createRealtimeSession
12057
+ */
12058
+ createRealtimeSession(
12059
+ recordName: string,
12060
+ request: CreateRealtimeSessionTokenRequest,
12061
+ options?: RecordActionOptions
12062
+ ): Promise<AICreateOpenAIRealtimeSessionTokenResult>;
12063
+ }
12064
+
11862
12065
  stream: {
11863
12066
  /**
11864
12067
  * Sends a chat message to the AI and streams the response back.
@@ -1 +1 @@
1
- {"version":3,"file":"AuxPartitionRealtimeEditModeProvider.js","sourceRoot":"","sources":["AuxPartitionRealtimeEditModeProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAE,kCAAkC,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,OAAO,oCAAoC;IAK7C,YAAY,UAAyB;QACjC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,CAAC;IAED,WAAW,CAAC,KAAa;QACrB,IAAI,KAAK,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YAC5B,OAAO,kCAAkC,CACrC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAC3C,CAAC;QACN,CAAC;QACD,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;YACxB,OAAO,gBAAgB,CAAC,IAAI,CAAC;QACjC,CAAC;aAAM,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;YAC/B,OAAO,gBAAgB,CAAC,IAAI,CAAC;QACjC,CAAC;QACD,OAAO,0BAA0B,CAAC;IACtC,CAAC;CACJ"}
1
+ {"version":3,"file":"AuxPartitionRealtimeEditModeProvider.js","sourceRoot":"","sources":["AuxPartitionRealtimeEditModeProvider.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAE,kCAAkC,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,OAAO,oCAAoC;IAK7C,YAAY,UAAyB;QACjC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,CAAC;IAED,WAAW,CAAC,KAAa;QACrB,IAAI,KAAK,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YAC5B,OAAO,kCAAkC,CACrC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAC3C,CAAC;QACN,CAAC;QACD,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;YACxB,OAAO,gBAAgB,CAAC,IAAI,CAAC;QACjC,CAAC;aAAM,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;YAC/B,OAAO,gBAAgB,CAAC,IAAI,CAAC;QACjC,CAAC;QACD,OAAO,0BAA0B,CAAC;IACtC,CAAC;CACJ"}
@@ -1,3 +1,20 @@
1
+ /* CasualOS is a set of web-based tools designed to facilitate the creation of real-time, multi-user, context-aware interactive experiences.
2
+ *
3
+ * Copyright (c) 2019-2025 Casual Simulation, Inc.
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU Affero General Public License as
7
+ * published by the Free Software Foundation, either version 3 of the
8
+ * License, or (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+ */
1
18
  import { RealtimeEditMode } from './RuntimeBot';
2
19
  /**
3
20
  * The default realtime edit mode.
@@ -1 +1 @@
1
- {"version":3,"file":"AuxRealtimeEditModeProvider.js","sourceRoot":"","sources":["AuxRealtimeEditModeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GACnC,gBAAgB,CAAC,SAAS,CAAC;AAO/B;;GAEG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAC7C,IAAI,GAAG,CAAC;IACJ,CAAC,QAAQ,EAAE,gBAAgB,CAAC,SAAS,CAAC;IACtC,CAAC,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC;IACrC,CAAC,WAAW,EAAE,gBAAgB,CAAC,SAAS,CAAC;IACzC,CAAC,SAAS,EAAE,gBAAgB,CAAC,OAAO,CAAC;IACrC,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC;IACnC,CAAC,WAAW,EAAE,gBAAgB,CAAC,IAAI,CAAC;IACpC,CAAC,WAAW,EAAE,gBAAgB,CAAC,IAAI,CAAC;CACvC,CAAC,CAAC;AAEP;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAC/B,GAA6B,EAC7B,KAAa;IAEb,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,0BAA0B,CAAC;AACxD,CAAC;AAaD,MAAM,OAAO,+BAA+B;IAKxC,YACI,MAAgC,oCAAoC;QAEpE,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IACpB,CAAC;IAED,WAAW,CAAC,KAAa;QACrB,OAAO,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;CACJ"}
1
+ {"version":3,"file":"AuxRealtimeEditModeProvider.js","sourceRoot":"","sources":["AuxRealtimeEditModeProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GACnC,gBAAgB,CAAC,SAAS,CAAC;AAO/B;;GAEG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAC7C,IAAI,GAAG,CAAC;IACJ,CAAC,QAAQ,EAAE,gBAAgB,CAAC,SAAS,CAAC;IACtC,CAAC,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC;IACrC,CAAC,WAAW,EAAE,gBAAgB,CAAC,SAAS,CAAC;IACzC,CAAC,SAAS,EAAE,gBAAgB,CAAC,OAAO,CAAC;IACrC,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC;IACnC,CAAC,WAAW,EAAE,gBAAgB,CAAC,IAAI,CAAC;IACpC,CAAC,WAAW,EAAE,gBAAgB,CAAC,IAAI,CAAC;CACvC,CAAC,CAAC;AAEP;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAC/B,GAA6B,EAC7B,KAAa;IAEb,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,0BAA0B,CAAC;AACxD,CAAC;AAaD,MAAM,OAAO,+BAA+B;IAKxC,YACI,MAAgC,oCAAoC;QAEpE,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IACpB,CAAC;IAED,WAAW,CAAC,KAAa;QACrB,OAAO,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"AuxResults.js","sourceRoot":"","sources":["AuxResults.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC1C;QACI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC/B,CAAC;CACJ"}
1
+ {"version":3,"file":"AuxResults.js","sourceRoot":"","sources":["AuxResults.ts"],"names":[],"mappings":"AAqBA,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC1C;QACI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC/B,CAAC;CACJ"}
@@ -1,10 +1,20 @@
1
- // CasualOS has several key components:
2
- //
3
- // 1. Simulations - These are wrapper objects that manage creating and interfacing with AUX virtual machines.
4
- // 2. VM - AUX Virtual Machines provide a security boundary to keep user scripts separate across multiple virtual machines.
5
- // 3. Channel - These are manager objects which handle the persistence and runtime aspects of an AUX.
6
- // 4. Partitions - These are services which manage the persistence and realtime sync of the AUX data model.
7
- // 5. Runtimes - These are services which manage script execution and formula precalculation.
1
+ /* CasualOS is a set of web-based tools designed to facilitate the creation of real-time, multi-user, context-aware interactive experiences.
2
+ *
3
+ * Copyright (c) 2019-2025 Casual Simulation, Inc.
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU Affero General Public License as
7
+ * published by the Free Software Foundation, either version 3 of the
8
+ * License, or (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+ */
8
18
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
19
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
20
  return new (P || (P = Promise))(function (resolve, reject) {