@holoscript/core 1.0.0-alpha.1 → 1.0.0-alpha.2

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 (55) hide show
  1. package/package.json +9 -8
  2. package/src/HoloScriptRuntime.ts +240 -0
  3. package/LICENSE +0 -21
  4. package/dist/chunk-3X2EGU7Z.cjs +0 -52
  5. package/dist/chunk-3X2EGU7Z.cjs.map +0 -1
  6. package/dist/chunk-723TPVHD.js +0 -1074
  7. package/dist/chunk-723TPVHD.js.map +0 -1
  8. package/dist/chunk-EOKNAVDO.cjs +0 -424
  9. package/dist/chunk-EOKNAVDO.cjs.map +0 -1
  10. package/dist/chunk-HQZ3HUMY.js +0 -1087
  11. package/dist/chunk-HQZ3HUMY.js.map +0 -1
  12. package/dist/chunk-KWYIVRIH.js +0 -344
  13. package/dist/chunk-KWYIVRIH.js.map +0 -1
  14. package/dist/chunk-LKH4ZAN6.js +0 -421
  15. package/dist/chunk-LKH4ZAN6.js.map +0 -1
  16. package/dist/chunk-SATNCODL.js +0 -45
  17. package/dist/chunk-SATNCODL.js.map +0 -1
  18. package/dist/chunk-VMZN4EVR.cjs +0 -347
  19. package/dist/chunk-VMZN4EVR.cjs.map +0 -1
  20. package/dist/chunk-VV3UUUYP.cjs +0 -1089
  21. package/dist/chunk-VV3UUUYP.cjs.map +0 -1
  22. package/dist/chunk-XRYTSQHZ.cjs +0 -1076
  23. package/dist/chunk-XRYTSQHZ.cjs.map +0 -1
  24. package/dist/debugger.cjs +0 -19
  25. package/dist/debugger.cjs.map +0 -1
  26. package/dist/debugger.d.cts +0 -171
  27. package/dist/debugger.d.ts +0 -171
  28. package/dist/debugger.js +0 -6
  29. package/dist/debugger.js.map +0 -1
  30. package/dist/index.cjs +0 -755
  31. package/dist/index.cjs.map +0 -1
  32. package/dist/index.d.cts +0 -169
  33. package/dist/index.d.ts +0 -169
  34. package/dist/index.js +0 -699
  35. package/dist/index.js.map +0 -1
  36. package/dist/parser.cjs +0 -13
  37. package/dist/parser.cjs.map +0 -1
  38. package/dist/parser.d.cts +0 -154
  39. package/dist/parser.d.ts +0 -154
  40. package/dist/parser.js +0 -4
  41. package/dist/parser.js.map +0 -1
  42. package/dist/runtime.cjs +0 -13
  43. package/dist/runtime.cjs.map +0 -1
  44. package/dist/runtime.d.cts +0 -147
  45. package/dist/runtime.d.ts +0 -147
  46. package/dist/runtime.js +0 -4
  47. package/dist/runtime.js.map +0 -1
  48. package/dist/type-checker.cjs +0 -16
  49. package/dist/type-checker.cjs.map +0 -1
  50. package/dist/type-checker.d.cts +0 -105
  51. package/dist/type-checker.d.ts +0 -105
  52. package/dist/type-checker.js +0 -3
  53. package/dist/type-checker.js.map +0 -1
  54. package/dist/types-WQSk1Qs2.d.cts +0 -238
  55. package/dist/types-WQSk1Qs2.d.ts +0 -238
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holoscript/core",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.2",
4
4
  "description": "Core HoloScript language - parser, runtime, and AST types",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,6 +34,12 @@
34
34
  "require": "./dist/debugger.js"
35
35
  }
36
36
  },
37
+ "scripts": {
38
+ "build": "tsup",
39
+ "dev": "tsup --watch",
40
+ "test": "vitest run",
41
+ "test:watch": "vitest"
42
+ },
37
43
  "keywords": [
38
44
  "holoscript",
39
45
  "vr",
@@ -54,13 +60,8 @@
54
60
  },
55
61
  "devDependencies": {
56
62
  "tsup": "^8.0.1",
63
+ "typedoc": "^0.28.16",
57
64
  "typescript": "^5.3.3",
58
65
  "vitest": "^1.0.0"
59
- },
60
- "scripts": {
61
- "build": "tsup",
62
- "dev": "tsup --watch",
63
- "test": "vitest run",
64
- "test:watch": "vitest"
65
66
  }
66
- }
67
+ }
@@ -24,6 +24,7 @@ import type {
24
24
  StreamNode,
25
25
  SpatialPosition,
26
26
  HologramProperties,
27
+ HologramShape,
27
28
  RuntimeContext,
28
29
  ExecutionResult,
29
30
  ParticleSystem,
@@ -316,6 +317,9 @@ export class HoloScriptRuntime {
316
317
  case 'return':
317
318
  result = await this.executeReturn(node as ASTNode & { value: unknown });
318
319
  break;
320
+ case 'generic':
321
+ result = await this.executeGeneric(node);
322
+ break;
319
323
  default:
320
324
  result = {
321
325
  success: false,
@@ -939,6 +943,242 @@ export class HoloScriptRuntime {
939
943
  };
940
944
  }
941
945
 
946
+ /**
947
+ * Execute generic voice commands
948
+ * Handles commands like: show, hide, animate, pulse, create
949
+ */
950
+ private async executeGeneric(_node: ASTNode): Promise<ExecutionResult> {
951
+ const genericNode = _node as any;
952
+ const command = String(genericNode.command || '').trim().toLowerCase();
953
+ const tokens = command.split(/\s+/);
954
+ const action = tokens[0];
955
+ const target = tokens[1];
956
+
957
+ logger.info('Executing generic command', { command, action, target });
958
+
959
+ try {
960
+ let result: any;
961
+
962
+ switch (action) {
963
+ case 'show':
964
+ result = await this.executeShowCommand(target, genericNode);
965
+ break;
966
+ case 'hide':
967
+ result = await this.executeHideCommand(target, genericNode);
968
+ break;
969
+ case 'create':
970
+ case 'summon':
971
+ result = await this.executeCreateCommand(tokens.slice(1), genericNode);
972
+ break;
973
+ case 'animate':
974
+ result = await this.executeAnimateCommand(target, tokens.slice(2), genericNode);
975
+ break;
976
+ case 'pulse':
977
+ result = await this.executePulseCommand(target, tokens.slice(2), genericNode);
978
+ break;
979
+ case 'move':
980
+ result = await this.executeMoveCommand(target, tokens.slice(2), genericNode);
981
+ break;
982
+ case 'delete':
983
+ case 'remove':
984
+ result = await this.executeDeleteCommand(target, genericNode);
985
+ break;
986
+ default:
987
+ // Default: create visual representation of the generic command
988
+ logger.warn('Unknown voice command action', { action, command });
989
+ result = {
990
+ executed: false,
991
+ message: `Unknown command: ${action}`,
992
+ };
993
+ }
994
+
995
+ return {
996
+ success: true,
997
+ output: result,
998
+ };
999
+ } catch (error) {
1000
+ return {
1001
+ success: false,
1002
+ error: `Generic command execution failed: ${String(error)}`,
1003
+ };
1004
+ }
1005
+ }
1006
+
1007
+ /**
1008
+ * Execute 'show' command
1009
+ */
1010
+ private async executeShowCommand(target: string, _node: any): Promise<any> {
1011
+ // Create or show orb for this target
1012
+ const hologram = _node.hologram || {
1013
+ shape: 'orb',
1014
+ color: '#00ffff',
1015
+ size: 0.8,
1016
+ glow: true,
1017
+ interactive: true,
1018
+ };
1019
+
1020
+ const position = _node.position || { x: 0, y: 0, z: 0 };
1021
+ this.context.spatialMemory.set(target, position);
1022
+ this.createParticleEffect(`${target}_show`, position, hologram.color, 15);
1023
+
1024
+ logger.info('Show command executed', { target, position });
1025
+
1026
+ return {
1027
+ showed: target,
1028
+ hologram,
1029
+ position,
1030
+ };
1031
+ }
1032
+
1033
+ /**
1034
+ * Execute 'hide' command
1035
+ */
1036
+ private async executeHideCommand(target: string, _node: any): Promise<any> {
1037
+ const position = this.context.spatialMemory.get(target) || { x: 0, y: 0, z: 0 };
1038
+ this.createParticleEffect(`${target}_hide`, position, '#ff0000', 10);
1039
+
1040
+ logger.info('Hide command executed', { target });
1041
+
1042
+ return {
1043
+ hidden: target,
1044
+ };
1045
+ }
1046
+
1047
+ /**
1048
+ * Execute 'create' command
1049
+ */
1050
+ private async executeCreateCommand(tokens: string[], _node: any): Promise<any> {
1051
+ if (tokens.length < 2) {
1052
+ return { error: 'Create command requires shape and name' };
1053
+ }
1054
+
1055
+ const shape = tokens[0];
1056
+ const name = tokens[1];
1057
+ const position = _node.position || { x: 0, y: 0, z: 0 };
1058
+
1059
+ const hologram: HologramProperties = {
1060
+ shape: shape as HologramShape,
1061
+ color: _node.hologram?.color || '#00ffff',
1062
+ size: _node.hologram?.size || 1,
1063
+ glow: _node.hologram?.glow !== false,
1064
+ interactive: _node.hologram?.interactive !== false,
1065
+ };
1066
+
1067
+ this.context.spatialMemory.set(name, position);
1068
+ this.createParticleEffect(`${name}_create`, position, hologram.color, 20);
1069
+
1070
+ logger.info('Create command executed', { shape, name, position });
1071
+
1072
+ return {
1073
+ created: name,
1074
+ shape,
1075
+ hologram,
1076
+ position,
1077
+ };
1078
+ }
1079
+
1080
+ /**
1081
+ * Execute 'animate' command
1082
+ */
1083
+ private async executeAnimateCommand(target: string, tokens: string[], _node: any): Promise<any> {
1084
+ const property = tokens[0] || 'position.y';
1085
+ const duration = parseInt(tokens[1] || '1000', 10);
1086
+
1087
+ const animation: Animation = {
1088
+ target,
1089
+ property,
1090
+ from: 0,
1091
+ to: 1,
1092
+ duration,
1093
+ startTime: Date.now(),
1094
+ easing: 'ease-in-out',
1095
+ };
1096
+
1097
+ this.animations.set(`${target}_${property}`, animation);
1098
+
1099
+ logger.info('Animate command executed', { target, property, duration });
1100
+
1101
+ return {
1102
+ animating: target,
1103
+ animation,
1104
+ };
1105
+ }
1106
+
1107
+ /**
1108
+ * Execute 'pulse' command
1109
+ */
1110
+ private async executePulseCommand(target: string, tokens: string[], _node: any): Promise<any> {
1111
+ const duration = parseInt(tokens[0] || '500', 10);
1112
+ const position = this.context.spatialMemory.get(target) || { x: 0, y: 0, z: 0 };
1113
+
1114
+ // Create pulsing particle effect
1115
+ this.createParticleEffect(`${target}_pulse`, position, '#ffff00', 30);
1116
+
1117
+ // Create animation for scale
1118
+ const animation: Animation = {
1119
+ target,
1120
+ property: 'scale',
1121
+ from: 1,
1122
+ to: 1.5,
1123
+ duration,
1124
+ startTime: Date.now(),
1125
+ easing: 'sine',
1126
+ yoyo: true,
1127
+ loop: true,
1128
+ };
1129
+
1130
+ this.animations.set(`${target}_pulse`, animation);
1131
+
1132
+ logger.info('Pulse command executed', { target, duration });
1133
+
1134
+ return {
1135
+ pulsing: target,
1136
+ duration,
1137
+ };
1138
+ }
1139
+
1140
+ /**
1141
+ * Execute 'move' command
1142
+ */
1143
+ private async executeMoveCommand(target: string, tokens: string[], _node: any): Promise<any> {
1144
+ const x = parseFloat(tokens[0] || '0');
1145
+ const y = parseFloat(tokens[1] || '0');
1146
+ const z = parseFloat(tokens[2] || '0');
1147
+ const position: SpatialPosition = { x, y, z };
1148
+
1149
+ const current = this.context.spatialMemory.get(target);
1150
+ if (current) {
1151
+ this.context.spatialMemory.set(target, position);
1152
+ this.createConnectionStream(target, `${target}_move`, current, position, 'movement');
1153
+ } else {
1154
+ this.context.spatialMemory.set(target, position);
1155
+ }
1156
+
1157
+ logger.info('Move command executed', { target, position });
1158
+
1159
+ return {
1160
+ moved: target,
1161
+ to: position,
1162
+ };
1163
+ }
1164
+
1165
+ /**
1166
+ * Execute 'delete' command
1167
+ */
1168
+ private async executeDeleteCommand(target: string, _node: any): Promise<any> {
1169
+ const position = this.context.spatialMemory.get(target);
1170
+ if (position) {
1171
+ this.createParticleEffect(`${target}_delete`, position, '#ff0000', 15);
1172
+ this.context.spatialMemory.delete(target);
1173
+ }
1174
+
1175
+ logger.info('Delete command executed', { target });
1176
+
1177
+ return {
1178
+ deleted: target,
1179
+ };
1180
+ }
1181
+
942
1182
  private async executeStructure(node: ASTNode): Promise<ExecutionResult> {
943
1183
  // Handle nexus, building, and other structural elements
944
1184
  const hologram: HologramProperties = node.hologram || {
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025-2026 HoloScript Contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,52 +0,0 @@
1
- 'use strict';
2
-
3
- // src/logger.ts
4
- var NoOpLogger = class {
5
- debug() {
6
- }
7
- info() {
8
- }
9
- warn() {
10
- }
11
- error() {
12
- }
13
- };
14
- var ConsoleLogger = class {
15
- debug(message, meta) {
16
- console.debug(`[HoloScript:DEBUG] ${message}`, meta ?? "");
17
- }
18
- info(message, meta) {
19
- console.info(`[HoloScript:INFO] ${message}`, meta ?? "");
20
- }
21
- warn(message, meta) {
22
- console.warn(`[HoloScript:WARN] ${message}`, meta ?? "");
23
- }
24
- error(message, meta) {
25
- console.error(`[HoloScript:ERROR] ${message}`, meta ?? "");
26
- }
27
- };
28
- var currentLogger = new NoOpLogger();
29
- function setHoloScriptLogger(logger2) {
30
- currentLogger = logger2;
31
- }
32
- function enableConsoleLogging() {
33
- currentLogger = new ConsoleLogger();
34
- }
35
- function resetLogger() {
36
- currentLogger = new NoOpLogger();
37
- }
38
- var logger = {
39
- debug: (msg, meta) => currentLogger.debug(msg, meta),
40
- info: (msg, meta) => currentLogger.info(msg, meta),
41
- warn: (msg, meta) => currentLogger.warn(msg, meta),
42
- error: (msg, meta) => currentLogger.error(msg, meta)
43
- };
44
-
45
- exports.ConsoleLogger = ConsoleLogger;
46
- exports.NoOpLogger = NoOpLogger;
47
- exports.enableConsoleLogging = enableConsoleLogging;
48
- exports.logger = logger;
49
- exports.resetLogger = resetLogger;
50
- exports.setHoloScriptLogger = setHoloScriptLogger;
51
- //# sourceMappingURL=chunk-3X2EGU7Z.cjs.map
52
- //# sourceMappingURL=chunk-3X2EGU7Z.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/logger.ts"],"names":["logger"],"mappings":";;;AAaA,IAAM,aA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AAA,EAAK,SAAS,aAAA,CAAc,IAAA,CAAK,KAAK,IAAI,CAAA;AAAA,EACjD,MAAM,CAAC,GAAA,EAAK,SAAS,aAAA,CAAc,IAAA,CAAK,KAAK,IAAI,CAAA;AAAA,EACjD,OAAO,CAAC,GAAA,EAAK,SAAS,aAAA,CAAc,KAAA,CAAM,KAAK,IAAI;AACrD","file":"chunk-3X2EGU7Z.cjs","sourcesContent":["/**\n * @holoscript/core Logger\n *\n * Simple pluggable logger for HoloScript\n */\n\nexport interface HoloScriptLogger {\n debug(message: string, meta?: Record<string, unknown>): void;\n info(message: string, meta?: Record<string, unknown>): void;\n warn(message: string, meta?: Record<string, unknown>): void;\n error(message: string, meta?: Record<string, unknown>): void;\n}\n\nclass NoOpLogger implements HoloScriptLogger {\n debug(): void {}\n info(): void {}\n warn(): void {}\n error(): void {}\n}\n\nclass ConsoleLogger implements HoloScriptLogger {\n debug(message: string, meta?: Record<string, unknown>): void {\n console.debug(`[HoloScript:DEBUG] ${message}`, meta ?? '');\n }\n info(message: string, meta?: Record<string, unknown>): void {\n console.info(`[HoloScript:INFO] ${message}`, meta ?? '');\n }\n warn(message: string, meta?: Record<string, unknown>): void {\n console.warn(`[HoloScript:WARN] ${message}`, meta ?? '');\n }\n error(message: string, meta?: Record<string, unknown>): void {\n console.error(`[HoloScript:ERROR] ${message}`, meta ?? '');\n }\n}\n\nlet currentLogger: HoloScriptLogger = new NoOpLogger();\n\nexport function setHoloScriptLogger(logger: HoloScriptLogger): void {\n currentLogger = logger;\n}\n\nexport function enableConsoleLogging(): void {\n currentLogger = new ConsoleLogger();\n}\n\nexport function resetLogger(): void {\n currentLogger = new NoOpLogger();\n}\n\nexport const logger: HoloScriptLogger = {\n debug: (msg, meta) => currentLogger.debug(msg, meta),\n info: (msg, meta) => currentLogger.info(msg, meta),\n warn: (msg, meta) => currentLogger.warn(msg, meta),\n error: (msg, meta) => currentLogger.error(msg, meta),\n};\n\nexport { NoOpLogger, ConsoleLogger };\n"]}