@holoscript/std 7.0.0 → 7.0.1
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/README.md +8 -0
- package/dist/chunk-DGUM43GV.js +11 -0
- package/dist/{chunk-PFX2JM4X.js → chunk-FAMOLKH3.js} +2 -1
- package/dist/{chunk-PFX2JM4X.js.map → chunk-FAMOLKH3.js.map} +1 -1
- package/dist/{chunk-DZHAVOCH.js → chunk-SOKH6FJ7.js} +31 -6
- package/dist/chunk-SOKH6FJ7.js.map +1 -0
- package/dist/collections.cjs +1 -0
- package/dist/collections.cjs.map +1 -1
- package/dist/collections.js +2 -2
- package/dist/fs/fs.d.ts.map +1 -1
- package/dist/fs/index.cjs +221 -8510
- package/dist/fs/index.cjs.map +1 -1
- package/dist/fs/index.js +832 -118
- package/dist/fs/index.js.map +1 -1
- package/dist/fs/sandbox.d.ts +49 -0
- package/dist/fs/sandbox.d.ts.map +1 -0
- package/dist/index.cjs +3494 -12672
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/dist/math.cjs +18 -3
- package/dist/math.cjs.map +1 -1
- package/dist/math.js +2 -2
- package/dist/string.js +1 -1
- package/dist/time.js +1 -1
- package/dist/traits/EconomicPrimitives.js +1 -1
- package/dist/traits/EconomicTraits.js +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +19 -9
- package/dist/__tests__/EconomicPrimitives.test.d.ts +0 -2
- package/dist/__tests__/EconomicPrimitives.test.d.ts.map +0 -1
- package/dist/__tests__/EconomicTraits.test.d.ts +0 -2
- package/dist/__tests__/EconomicTraits.test.d.ts.map +0 -1
- package/dist/__tests__/SimulationLabPrimitives.test.d.ts +0 -2
- package/dist/__tests__/SimulationLabPrimitives.test.d.ts.map +0 -1
- package/dist/__tests__/collections.test.d.ts +0 -2
- package/dist/__tests__/collections.test.d.ts.map +0 -1
- package/dist/__tests__/events.test.d.ts +0 -2
- package/dist/__tests__/events.test.d.ts.map +0 -1
- package/dist/__tests__/index.test.d.ts +0 -2
- package/dist/__tests__/index.test.d.ts.map +0 -1
- package/dist/__tests__/materials.test.d.ts +0 -2
- package/dist/__tests__/materials.test.d.ts.map +0 -1
- package/dist/__tests__/math.test.d.ts +0 -2
- package/dist/__tests__/math.test.d.ts.map +0 -1
- package/dist/__tests__/physics.test.d.ts +0 -2
- package/dist/__tests__/physics.test.d.ts.map +0 -1
- package/dist/__tests__/spatial.test.d.ts +0 -2
- package/dist/__tests__/spatial.test.d.ts.map +0 -1
- package/dist/__tests__/standard-library-fundamentals.test.d.ts +0 -2
- package/dist/__tests__/standard-library-fundamentals.test.d.ts.map +0 -1
- package/dist/__tests__/string-and-time-utilities.test.d.ts +0 -2
- package/dist/__tests__/string-and-time-utilities.test.d.ts.map +0 -1
- package/dist/__tests__/string-decoupled.test.d.ts +0 -2
- package/dist/__tests__/string-decoupled.test.d.ts.map +0 -1
- package/dist/__tests__/string.test.d.ts +0 -2
- package/dist/__tests__/string.test.d.ts.map +0 -1
- package/dist/__tests__/time.test.d.ts +0 -2
- package/dist/__tests__/time.test.d.ts.map +0 -1
- package/dist/chunk-DZHAVOCH.js.map +0 -1
- package/dist/chunk-PR4QN5HX.js +0 -43
- package/dist/chunk-XBA4ARST.js +0 -9313
- package/dist/chunk-XBA4ARST.js.map +0 -1
- package/dist/fs/__tests__/file-watch-system.test.d.ts +0 -2
- package/dist/fs/__tests__/file-watch-system.test.d.ts.map +0 -1
- package/dist/fs/__tests__/path-utilities.test.d.ts +0 -2
- package/dist/fs/__tests__/path-utilities.test.d.ts.map +0 -1
- package/dist/fs/__tests__/path.test.d.ts +0 -2
- package/dist/fs/__tests__/path.test.d.ts.map +0 -1
- package/dist/string.basic.test.d.ts +0 -5
- package/dist/string.basic.test.d.ts.map +0 -1
- package/dist/string.test.d.ts +0 -5
- package/dist/string.test.d.ts.map +0 -1
- package/dist/traits/__tests__/ARTraits.test.d.ts +0 -2
- package/dist/traits/__tests__/ARTraits.test.d.ts.map +0 -1
- package/dist/traits/__tests__/EconomicPrimitives.test.d.ts +0 -2
- package/dist/traits/__tests__/EconomicPrimitives.test.d.ts.map +0 -1
- package/dist/traits/__tests__/EconomicTraits.test.d.ts +0 -2
- package/dist/traits/__tests__/EconomicTraits.test.d.ts.map +0 -1
- package/error-utf8.log +0 -6
- package/error.log +0 -0
- package/src/__tests__/EconomicPrimitives.test.ts +0 -690
- package/src/__tests__/EconomicTraits.test.ts +0 -425
- package/src/__tests__/SimulationLabPrimitives.test.ts +0 -415
- package/src/__tests__/collections.test.ts +0 -182
- package/src/__tests__/events.test.ts +0 -135
- package/src/__tests__/index.test.ts +0 -14
- package/src/__tests__/materials.test.ts +0 -84
- package/src/__tests__/math.test.ts +0 -246
- package/src/__tests__/physics.test.ts +0 -83
- package/src/__tests__/spatial.test.ts +0 -333
- package/src/__tests__/standard-library-fundamentals.test.ts +0 -1318
- package/src/__tests__/string-and-time-utilities.test.ts +0 -1070
- package/src/__tests__/string-decoupled.test.ts +0 -13
- package/src/__tests__/string.test.ts +0 -164
- package/src/__tests__/time.test.ts +0 -110
- package/src/collections.ts +0 -850
- package/src/events.ts +0 -88
- package/src/fs/__tests__/file-watch-system.test.ts +0 -675
- package/src/fs/__tests__/path-utilities.test.ts +0 -375
- package/src/fs/__tests__/path.test.ts +0 -287
- package/src/fs/fs.ts +0 -692
- package/src/fs/index.ts +0 -194
- package/src/fs/path.ts +0 -310
- package/src/fs/watch.ts +0 -413
- package/src/index.ts +0 -476
- package/src/materials.ts +0 -109
- package/src/math.ts +0 -674
- package/src/physics.ts +0 -141
- package/src/spatial.ts +0 -320
- package/src/string.basic.test.ts +0 -14
- package/src/string.test.ts +0 -335
- package/src/string.ts +0 -531
- package/src/time.ts +0 -621
- package/src/traits/ARTraits.ts +0 -103
- package/src/traits/EconomicPrimitives.ts +0 -755
- package/src/traits/EconomicTraits.ts +0 -552
- package/src/traits/IoTTraits.ts +0 -102
- package/src/traits/SimulationLabPrimitives.ts +0 -650
- package/src/traits/SimulationLabTraits.ts +0 -191
- package/src/traits/VRRTraits.ts +0 -326
- package/src/traits/__tests__/ARTraits.test.ts +0 -8
- package/src/traits/__tests__/EconomicPrimitives.test.ts +0 -14
- package/src/traits/__tests__/EconomicTraits.test.ts +0 -16
- package/src/types.ts +0 -418
- package/std_error.log +0 -5
- package/tsconfig.json +0 -18
- package/tsup.config.ts +0 -20
- package/vitest.config.ts +0 -10
- /package/dist/{chunk-PR4QN5HX.js.map → chunk-DGUM43GV.js.map} +0 -0
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview SimulationLab Trait Definition for HoloScript
|
|
3
|
-
* @module @holoscript/std/traits
|
|
4
|
-
*
|
|
5
|
-
* Defines the @simulation_lab trait that enables hypothesis testing
|
|
6
|
-
* on any HoloScript composition. Attach this trait to run parameter sweeps,
|
|
7
|
-
* collect metrics across N epochs, and produce statistical results.
|
|
8
|
-
*
|
|
9
|
-
* Composes with all economic traits for economy stress testing.
|
|
10
|
-
*
|
|
11
|
-
* @version 1.0.0
|
|
12
|
-
* @category simulation
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import type { TraitDefinition } from '../types.js';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Extended trait definition with simulation-specific metadata.
|
|
19
|
-
*/
|
|
20
|
-
export interface SimulationTraitDefinition extends TraitDefinition {
|
|
21
|
-
/** Compiler hints for batch execution */
|
|
22
|
-
compiler_hints?: {
|
|
23
|
-
requires_runtime?: string[];
|
|
24
|
-
thread_safety?: 'main_thread' | 'worker_thread' | 'any';
|
|
25
|
-
performance_budget_ms?: number;
|
|
26
|
-
batch_mode?: boolean;
|
|
27
|
-
};
|
|
28
|
-
/** Which economic/VR traits this composes with */
|
|
29
|
-
composesWith: string[];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// =============================================================================
|
|
33
|
-
// TRAIT DEFINITION
|
|
34
|
-
// =============================================================================
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The SimulationLab trait.
|
|
38
|
-
*/
|
|
39
|
-
export const SimulationLabTraits: Record<string, SimulationTraitDefinition> = {
|
|
40
|
-
simulation_lab: {
|
|
41
|
-
name: '@simulation_lab',
|
|
42
|
-
description:
|
|
43
|
-
'Attaches scientific hypothesis testing to any HoloScript composition. ' +
|
|
44
|
-
'Enables parameter sweeps, multi-epoch execution, statistical analysis, ' +
|
|
45
|
-
'and exportable results. The universe gets one sample — HoloScript gives ' +
|
|
46
|
-
'you infinite. Results are marketplace-sellable as verified simulation data.',
|
|
47
|
-
params: {
|
|
48
|
-
hypothesis: {
|
|
49
|
-
type: 'string',
|
|
50
|
-
required: true,
|
|
51
|
-
description: 'Human-readable hypothesis description.',
|
|
52
|
-
},
|
|
53
|
-
null_hypothesis: {
|
|
54
|
-
type: 'string',
|
|
55
|
-
required: false,
|
|
56
|
-
default: '',
|
|
57
|
-
description: 'Formal null hypothesis (H0). Auto-generated if empty.',
|
|
58
|
-
},
|
|
59
|
-
alternative_hypothesis: {
|
|
60
|
-
type: 'string',
|
|
61
|
-
required: false,
|
|
62
|
-
default: '',
|
|
63
|
-
description: 'Formal alternative hypothesis (H1). Auto-generated if empty.',
|
|
64
|
-
},
|
|
65
|
-
direction: {
|
|
66
|
-
type: 'string',
|
|
67
|
-
required: false,
|
|
68
|
-
default: 'different',
|
|
69
|
-
description: 'Expected direction of effect: greater | less | different | equal.',
|
|
70
|
-
},
|
|
71
|
-
epochs: {
|
|
72
|
-
type: 'number',
|
|
73
|
-
required: false,
|
|
74
|
-
default: 1000,
|
|
75
|
-
description: 'Number of simulation runs per parameter combination. More = higher power.',
|
|
76
|
-
},
|
|
77
|
-
seed_start: {
|
|
78
|
-
type: 'number',
|
|
79
|
-
required: false,
|
|
80
|
-
default: 0,
|
|
81
|
-
description: 'Starting seed for reproducibility. Seeds increment per epoch.',
|
|
82
|
-
},
|
|
83
|
-
confidence_level: {
|
|
84
|
-
type: 'number',
|
|
85
|
-
required: false,
|
|
86
|
-
default: 0.95,
|
|
87
|
-
description: 'Confidence level for statistical tests (0.0 - 1.0). Default 0.95 = α=0.05.',
|
|
88
|
-
},
|
|
89
|
-
metrics: {
|
|
90
|
-
type: 'string[]',
|
|
91
|
-
required: true,
|
|
92
|
-
description:
|
|
93
|
-
'List of metric names to collect each epoch. Must match emitted metric events.',
|
|
94
|
-
},
|
|
95
|
-
statistical_test: {
|
|
96
|
-
type: 'string',
|
|
97
|
-
required: false,
|
|
98
|
-
default: 'auto',
|
|
99
|
-
description:
|
|
100
|
-
'Statistical test to use: t_test | mann_whitney_u | chi_squared | auto. ' +
|
|
101
|
-
'Auto selects based on data distribution.',
|
|
102
|
-
},
|
|
103
|
-
export_training_data: {
|
|
104
|
-
type: 'boolean',
|
|
105
|
-
required: false,
|
|
106
|
-
default: false,
|
|
107
|
-
description: 'Whether to export results as training data for DataForge pipeline.',
|
|
108
|
-
},
|
|
109
|
-
marketplace_publishable: {
|
|
110
|
-
type: 'boolean',
|
|
111
|
-
required: false,
|
|
112
|
-
default: false,
|
|
113
|
-
description:
|
|
114
|
-
'Whether to package results for marketplace listing as verified simulation data.',
|
|
115
|
-
},
|
|
116
|
-
max_duration_ms: {
|
|
117
|
-
type: 'number',
|
|
118
|
-
required: false,
|
|
119
|
-
default: 300000,
|
|
120
|
-
description:
|
|
121
|
-
'Maximum wall-clock time for the entire experiment (5 min default). ' +
|
|
122
|
-
'Prevents runaway simulations.',
|
|
123
|
-
},
|
|
124
|
-
worker_count: {
|
|
125
|
-
type: 'number',
|
|
126
|
-
required: false,
|
|
127
|
-
default: 4,
|
|
128
|
-
description: 'Number of parallel workers for epoch execution.',
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
validator: (params) => {
|
|
132
|
-
if (!params.hypothesis || typeof params.hypothesis !== 'string') return false;
|
|
133
|
-
if (!params.metrics || !Array.isArray(params.metrics) || params.metrics.length === 0)
|
|
134
|
-
return false;
|
|
135
|
-
if (params.epochs !== undefined && (params.epochs < 1 || params.epochs > 1000000))
|
|
136
|
-
return false;
|
|
137
|
-
if (
|
|
138
|
-
params.confidence_level !== undefined &&
|
|
139
|
-
(params.confidence_level <= 0 || params.confidence_level >= 1)
|
|
140
|
-
)
|
|
141
|
-
return false;
|
|
142
|
-
if (params.direction !== undefined) {
|
|
143
|
-
if (!['greater', 'less', 'different', 'equal'].includes(params.direction)) return false;
|
|
144
|
-
}
|
|
145
|
-
if (params.statistical_test !== undefined) {
|
|
146
|
-
if (!['t_test', 'mann_whitney_u', 'chi_squared', 'auto'].includes(params.statistical_test))
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
return true;
|
|
150
|
-
},
|
|
151
|
-
composesWith: [
|
|
152
|
-
'@tradeable',
|
|
153
|
-
'@depreciating',
|
|
154
|
-
'@bonding_curved',
|
|
155
|
-
'@taxable_wealth',
|
|
156
|
-
'@pid_controlled',
|
|
157
|
-
],
|
|
158
|
-
compiler_hints: {
|
|
159
|
-
requires_runtime: [
|
|
160
|
-
'SimulationRuntime.runExperiment',
|
|
161
|
-
'SimulationRuntime.collectMetrics',
|
|
162
|
-
'SimulationRuntime.runStatisticalTest',
|
|
163
|
-
'SimulationRuntime.exportResults',
|
|
164
|
-
],
|
|
165
|
-
thread_safety: 'worker_thread',
|
|
166
|
-
performance_budget_ms: 300000, // Experiment budget, not per-frame
|
|
167
|
-
batch_mode: true,
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
// =============================================================================
|
|
173
|
-
// TRAIT UTILITIES
|
|
174
|
-
// =============================================================================
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Get all simulation trait names.
|
|
178
|
-
*/
|
|
179
|
-
export function getSimulationTraitNames(): string[] {
|
|
180
|
-
return Object.keys(SimulationLabTraits).map((k) => SimulationLabTraits[k].name);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Look up a simulation trait definition by name.
|
|
185
|
-
*/
|
|
186
|
-
export function getSimulationTrait(name: string): SimulationTraitDefinition | undefined {
|
|
187
|
-
const key = name.startsWith('@') ? name.slice(1) : name;
|
|
188
|
-
return SimulationLabTraits[key];
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export default SimulationLabTraits;
|
package/src/traits/VRRTraits.ts
DELETED
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview VRR (Virtual Reality Reality) Trait Definitions
|
|
3
|
-
* @module @holoscript/std/traits
|
|
4
|
-
*
|
|
5
|
-
* HIGH - Define VRR Trait Library for 1:1 Digital Twins
|
|
6
|
-
*
|
|
7
|
-
* PURPOSE:
|
|
8
|
-
* Define standard HoloScript traits for VRR (Virtual Reality Reality) features:
|
|
9
|
-
* 1:1 real-world mirroring, geo-anchoring, real-time sync (weather, events,
|
|
10
|
-
* inventory), business quests, layer transitions, and x402 payments.
|
|
11
|
-
*
|
|
12
|
-
* VISION:
|
|
13
|
-
* Developers annotate HoloScript compositions with @vrr_twin, @weather_sync,
|
|
14
|
-
* @inventory_sync, and VRRCompiler auto-generates Three.js code with real-time
|
|
15
|
-
* API integration. Example: @weather_sync → auto-generates weather.gov API calls
|
|
16
|
-
* and scene fog/precipitation updates.
|
|
17
|
-
*
|
|
18
|
-
* REQUIREMENTS:
|
|
19
|
-
* 1. Core VRR Traits: @vrr_twin, @reality_mirror, @geo_anchor
|
|
20
|
-
* 2. Real-Time Sync Traits: @weather_sync, @event_sync, @inventory_sync, @traffic_sync
|
|
21
|
-
* 3. Business Traits: @quest_hub, @business_marker, @coupon_reward
|
|
22
|
-
* 4. Layer Transition Traits: @layer_shift, @ar_portal, @vr_portal
|
|
23
|
-
* 5. Payment Traits: @x402_paywall, @subscription, @revenue_share
|
|
24
|
-
* 6. Geo-Location Traits: @geo_coords, @geo_sync, @geo_fence
|
|
25
|
-
*
|
|
26
|
-
* EXAMPLE USAGE:
|
|
27
|
-
* ```holoscript
|
|
28
|
-
* composition "PhoenixDowntownVRR" {
|
|
29
|
-
* zone#phoenix_downtown @vrr_twin @reality_mirror @geo_sync("phoenix_az_center") {
|
|
30
|
-
* geo_coords: { lat: 33.4484, lng: -112.0740 }
|
|
31
|
-
* weather_sync: @weather_sync { provider: "weather.gov", refresh: 5_minutes }
|
|
32
|
-
* event_sync: @event_sync { provider: "eventbrite", refresh: 5_minutes }
|
|
33
|
-
*
|
|
34
|
-
* business#phoenix_brew @quest_hub @inventory_sync @x402_paywall {
|
|
35
|
-
* geo_coords: { lat: 33.4484, lng: -112.0740 }
|
|
36
|
-
* inventory_api: @inventory_sync { provider: "square_pos", refresh: 1_minute }
|
|
37
|
-
* paywall: @x402_paywall { price: 5_usdc, asset: "USDC", network: "base" }
|
|
38
|
-
*
|
|
39
|
-
* quest "LatteLegend" @quest_hub {
|
|
40
|
-
* steps: [
|
|
41
|
-
* @ar_scan { location: "storefront_window" },
|
|
42
|
-
* @vrr_find_item { item: "oat_milk", hint: "Check the fridge" },
|
|
43
|
-
* @vr_taste_menu { menu_item: "oat_milk_latte" }
|
|
44
|
-
* ]
|
|
45
|
-
* reward: @coupon_reward { value: "Buy1Get1Free", expiry: 30_days }
|
|
46
|
-
* }
|
|
47
|
-
* }
|
|
48
|
-
* }
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* TRAIT DEFINITIONS:
|
|
53
|
-
*
|
|
54
|
-
* 1. @vrr_twin - Marks composition as VRR digital twin (1:1 real-world mirror)
|
|
55
|
-
* - Example: @vrr_twin { mirror: "phoenix_downtown" }
|
|
56
|
-
* - Compiler: Generates geo-anchored Three.js scene
|
|
57
|
-
*
|
|
58
|
-
* 2. @reality_mirror - Enables real-world synchronization
|
|
59
|
-
* - Example: @reality_mirror { sync: ["weather", "events", "inventory"] }
|
|
60
|
-
* - Compiler: Generates API integration code
|
|
61
|
-
*
|
|
62
|
-
* 3. @geo_anchor - Geo-location anchoring (lat/lng)
|
|
63
|
-
* - Example: @geo_anchor { lat: 33.4484, lng: -112.0740 }
|
|
64
|
-
* - Compiler: Converts lat/lng to scene coordinates
|
|
65
|
-
*
|
|
66
|
-
* 4. @weather_sync - Real-time weather synchronization
|
|
67
|
-
* - Example: @weather_sync { provider: "weather.gov", refresh: 5_minutes }
|
|
68
|
-
* - Compiler: Generates weather API polling code
|
|
69
|
-
* - Runtime: Updates scene fog, precipitation, temperature
|
|
70
|
-
*
|
|
71
|
-
* 5. @event_sync - Real-time event synchronization
|
|
72
|
-
* - Example: @event_sync { provider: "eventbrite", refresh: 5_minutes }
|
|
73
|
-
* - Compiler: Generates event API polling code
|
|
74
|
-
* - Runtime: Spawns NPC crowds, triggers quests on festivals
|
|
75
|
-
*
|
|
76
|
-
* 6. @inventory_sync - Real-time inventory synchronization
|
|
77
|
-
* - Example: @inventory_sync { provider: "square_pos", refresh: 1_minute }
|
|
78
|
-
* - Compiler: Generates POS API integration code
|
|
79
|
-
* - Runtime: Enables/disables quests based on stock
|
|
80
|
-
*
|
|
81
|
-
* 7. @quest_hub - Marks business as quest starting point
|
|
82
|
-
* - Example: @quest_hub { quests: ["latte_legend", "espresso_challenge"] }
|
|
83
|
-
* - Compiler: Generates quest NPC, interaction prompts
|
|
84
|
-
*
|
|
85
|
-
* 8. @layer_shift - AR/VRR/VR layer transitions
|
|
86
|
-
* - Example: @layer_shift { from: "ar", to: "vrr", price: 5_usdc }
|
|
87
|
-
* - Compiler: Generates x402 payment + redirect logic
|
|
88
|
-
* - Runtime: Persists state across layers (IndexedDB → Supabase)
|
|
89
|
-
*
|
|
90
|
-
* 9. @x402_paywall - HTTP 402 payment requirement
|
|
91
|
-
* - Example: @x402_paywall { price: 5, asset: "USDC", network: "base" }
|
|
92
|
-
* - Compiler: Generates 402 response + payment verification
|
|
93
|
-
* - Runtime: Grants access after payment confirmed
|
|
94
|
-
*
|
|
95
|
-
* 10. @geo_sync - Geographic data synchronization
|
|
96
|
-
* - Example: @geo_sync { center: "phoenix_az_center", radius: 5000 } // 5km
|
|
97
|
-
* - Compiler: Fetches nearby POIs, traffic, events
|
|
98
|
-
*
|
|
99
|
-
* INTEGRATION POINTS:
|
|
100
|
-
* - VRRCompiler.ts (trait parsing, code generation)
|
|
101
|
-
* - VRRRuntime.ts (real-time sync implementation)
|
|
102
|
-
* - x402PaymentService.ts (payment verification)
|
|
103
|
-
* - BusinessQuestTools.ts (quest builder uses traits)
|
|
104
|
-
*
|
|
105
|
-
* RESEARCH REFERENCES:
|
|
106
|
-
* - HOLOLAND_INTEGRATION_TASKS.md (VRRTraits section)
|
|
107
|
-
* - VRRCompiler.ts (trait requirements)
|
|
108
|
-
* - uAA2++_Protocol/5.GROW P.029: "Machine Customers for VR Platforms"
|
|
109
|
-
*
|
|
110
|
-
* IMPLEMENTATION TASKS:
|
|
111
|
-
* [x] Define VRRTrait interface
|
|
112
|
-
* [ ] Implement @vrr_twin trait definition
|
|
113
|
-
* [ ] Implement @reality_mirror trait definition
|
|
114
|
-
* [ ] Implement @geo_anchor trait definition
|
|
115
|
-
* [ ] Implement @weather_sync trait definition
|
|
116
|
-
* [ ] Implement @event_sync trait definition
|
|
117
|
-
* [ ] Implement @inventory_sync trait definition
|
|
118
|
-
* [ ] Implement @quest_hub trait definition
|
|
119
|
-
* [ ] Implement @layer_shift trait definition
|
|
120
|
-
* [ ] Implement @x402_paywall trait definition
|
|
121
|
-
* [ ] Implement @geo_sync trait definition
|
|
122
|
-
* [ ] Add trait validation (ensure required params present)
|
|
123
|
-
* [ ] Add trait composition (combine multiple traits)
|
|
124
|
-
* [ ] Add tests (VRRTraits.test.ts)
|
|
125
|
-
* [ ] Add documentation (trait usage examples)
|
|
126
|
-
*
|
|
127
|
-
* ESTIMATED COMPLEXITY: 6/10 (medium - trait definitions, validation)
|
|
128
|
-
* ESTIMATED TIME: 1 week (includes testing, documentation)
|
|
129
|
-
* PRIORITY: HIGH (blocks VRRCompiler implementation)
|
|
130
|
-
*
|
|
131
|
-
* BLOCKED BY:
|
|
132
|
-
* - Nothing (can implement now)
|
|
133
|
-
*
|
|
134
|
-
* UNBLOCKS:
|
|
135
|
-
* - VRRCompiler.ts (trait parsing)
|
|
136
|
-
* - VRRRuntime.ts (trait-driven initialization)
|
|
137
|
-
* - BusinessQuestTools.ts (trait-based quest builder)
|
|
138
|
-
*/
|
|
139
|
-
|
|
140
|
-
import type { TraitDefinition } from '../types.js';
|
|
141
|
-
|
|
142
|
-
export interface VRRTrait extends TraitDefinition {
|
|
143
|
-
name: string;
|
|
144
|
-
params: Record<string, any>;
|
|
145
|
-
validator?: (params: Record<string, any>) => boolean;
|
|
146
|
-
compiler_hints?: {
|
|
147
|
-
requires_runtime?: string[];
|
|
148
|
-
generates_api_calls?: string[];
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export const VRRTraits: Record<string, VRRTrait> = {
|
|
153
|
-
vrr_twin: {
|
|
154
|
-
name: '@vrr_twin',
|
|
155
|
-
description: 'Marks composition as VRR digital twin (1:1 real-world mirror)',
|
|
156
|
-
params: {
|
|
157
|
-
mirror: { type: 'string', required: true, description: 'Real-world location to mirror' },
|
|
158
|
-
},
|
|
159
|
-
validator: (params) => !!params.mirror,
|
|
160
|
-
compiler_hints: {
|
|
161
|
-
generates_api_calls: ['geo_location'],
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
reality_mirror: {
|
|
166
|
-
name: '@reality_mirror',
|
|
167
|
-
description: 'Enables real-world synchronization (weather, events, inventory)',
|
|
168
|
-
params: {
|
|
169
|
-
sync: { type: 'array', required: true, description: 'List of sync types' },
|
|
170
|
-
},
|
|
171
|
-
validator: (params) => Array.isArray(params.sync) && params.sync.length > 0,
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
geo_anchor: {
|
|
175
|
-
name: '@geo_anchor',
|
|
176
|
-
description: 'Geo-location anchoring (lat/lng positioning)',
|
|
177
|
-
params: {
|
|
178
|
-
lat: { type: 'number', required: true, description: 'Latitude' },
|
|
179
|
-
lng: { type: 'number', required: true, description: 'Longitude' },
|
|
180
|
-
},
|
|
181
|
-
validator: (params) => {
|
|
182
|
-
return (
|
|
183
|
-
typeof params.lat === 'number' &&
|
|
184
|
-
typeof params.lng === 'number' &&
|
|
185
|
-
params.lat >= -90 &&
|
|
186
|
-
params.lat <= 90 &&
|
|
187
|
-
params.lng >= -180 &&
|
|
188
|
-
params.lng <= 180
|
|
189
|
-
);
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
weather_sync: {
|
|
194
|
-
name: '@weather_sync',
|
|
195
|
-
description: 'Real-time weather synchronization',
|
|
196
|
-
params: {
|
|
197
|
-
provider: { type: 'string', required: true, description: 'weather.gov | openweathermap' },
|
|
198
|
-
refresh: {
|
|
199
|
-
type: 'duration',
|
|
200
|
-
required: false,
|
|
201
|
-
default: '5_minutes',
|
|
202
|
-
description: 'Refresh interval',
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
validator: (params) => ['weather.gov', 'openweathermap'].includes(params.provider),
|
|
206
|
-
compiler_hints: {
|
|
207
|
-
requires_runtime: ['VRRRuntime.syncWeather'],
|
|
208
|
-
generates_api_calls: ['weather.gov', 'openweathermap'],
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
event_sync: {
|
|
213
|
-
name: '@event_sync',
|
|
214
|
-
description: 'Real-time event synchronization (festivals, concerts)',
|
|
215
|
-
params: {
|
|
216
|
-
provider: { type: 'string', required: true, description: 'eventbrite | ticketmaster' },
|
|
217
|
-
refresh: {
|
|
218
|
-
type: 'duration',
|
|
219
|
-
required: false,
|
|
220
|
-
default: '5_minutes',
|
|
221
|
-
description: 'Refresh interval',
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
validator: (params) => ['eventbrite', 'ticketmaster'].includes(params.provider),
|
|
225
|
-
compiler_hints: {
|
|
226
|
-
requires_runtime: ['VRRRuntime.syncEvents'],
|
|
227
|
-
generates_api_calls: ['eventbrite', 'ticketmaster'],
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
|
|
231
|
-
inventory_sync: {
|
|
232
|
-
name: '@inventory_sync',
|
|
233
|
-
description: 'Real-time inventory synchronization (Square POS, Shopify)',
|
|
234
|
-
params: {
|
|
235
|
-
provider: {
|
|
236
|
-
type: 'string',
|
|
237
|
-
required: true,
|
|
238
|
-
description: 'square_pos | shopify | woocommerce',
|
|
239
|
-
},
|
|
240
|
-
refresh: {
|
|
241
|
-
type: 'duration',
|
|
242
|
-
required: false,
|
|
243
|
-
default: '1_minute',
|
|
244
|
-
description: 'Refresh interval',
|
|
245
|
-
},
|
|
246
|
-
websocket: {
|
|
247
|
-
type: 'boolean',
|
|
248
|
-
required: false,
|
|
249
|
-
default: false,
|
|
250
|
-
description: 'Use WebSocket for real-time',
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
validator: (params) => ['square_pos', 'shopify', 'woocommerce'].includes(params.provider),
|
|
254
|
-
compiler_hints: {
|
|
255
|
-
requires_runtime: ['VRRRuntime.syncInventory'],
|
|
256
|
-
generates_api_calls: ['square_pos', 'shopify', 'woocommerce'],
|
|
257
|
-
},
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
quest_hub: {
|
|
261
|
-
name: '@quest_hub',
|
|
262
|
-
description: 'Marks business as quest starting point',
|
|
263
|
-
params: {
|
|
264
|
-
quests: { type: 'array', required: true, description: 'List of quest IDs' },
|
|
265
|
-
},
|
|
266
|
-
validator: (params) => Array.isArray(params.quests) && params.quests.length > 0,
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
layer_shift: {
|
|
270
|
-
name: '@layer_shift',
|
|
271
|
-
description: 'AR/VRR/VR layer transitions with state persistence',
|
|
272
|
-
params: {
|
|
273
|
-
from: { type: 'string', required: true, description: 'ar | vrr | vr' },
|
|
274
|
-
to: { type: 'string', required: true, description: 'ar | vrr | vr' },
|
|
275
|
-
price: { type: 'number', required: false, description: 'USDC price for transition' },
|
|
276
|
-
persist_state: {
|
|
277
|
-
type: 'boolean',
|
|
278
|
-
required: false,
|
|
279
|
-
default: true,
|
|
280
|
-
description: 'Persist state across layers',
|
|
281
|
-
},
|
|
282
|
-
},
|
|
283
|
-
validator: (params) => {
|
|
284
|
-
const validLayers = ['ar', 'vrr', 'vr'];
|
|
285
|
-
return validLayers.includes(params.from) && validLayers.includes(params.to);
|
|
286
|
-
},
|
|
287
|
-
compiler_hints: {
|
|
288
|
-
requires_runtime: ['VRRRuntime.persistState', 'ARRuntime.createARPortal'],
|
|
289
|
-
},
|
|
290
|
-
},
|
|
291
|
-
|
|
292
|
-
x402_paywall: {
|
|
293
|
-
name: '@x402_paywall',
|
|
294
|
-
description: 'HTTP 402 payment requirement for content access',
|
|
295
|
-
params: {
|
|
296
|
-
price: { type: 'number', required: true, description: 'Price in USDC' },
|
|
297
|
-
asset: { type: 'string', required: false, default: 'USDC', description: 'USDC | ETH | SOL' },
|
|
298
|
-
network: {
|
|
299
|
-
type: 'string',
|
|
300
|
-
required: false,
|
|
301
|
-
default: 'base',
|
|
302
|
-
description: 'base | ethereum | solana',
|
|
303
|
-
},
|
|
304
|
-
},
|
|
305
|
-
validator: (params) => {
|
|
306
|
-
return (
|
|
307
|
-
params.price > 0 &&
|
|
308
|
-
['USDC', 'ETH', 'SOL'].includes(params.asset || 'USDC') &&
|
|
309
|
-
['base', 'ethereum', 'solana'].includes(params.network || 'base')
|
|
310
|
-
);
|
|
311
|
-
},
|
|
312
|
-
compiler_hints: {
|
|
313
|
-
generates_api_calls: ['x402_payment_service'],
|
|
314
|
-
},
|
|
315
|
-
},
|
|
316
|
-
|
|
317
|
-
geo_sync: {
|
|
318
|
-
name: '@geo_sync',
|
|
319
|
-
description: 'Geographic data synchronization (POIs, traffic, events)',
|
|
320
|
-
params: {
|
|
321
|
-
center: { type: 'string', required: true, description: 'Center point identifier' },
|
|
322
|
-
radius: { type: 'number', required: false, default: 5000, description: 'Radius in meters' },
|
|
323
|
-
},
|
|
324
|
-
validator: (params) => !!params.center && (params.radius || 0) >= 0,
|
|
325
|
-
},
|
|
326
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import * as ecPrims from '../EconomicPrimitives.js';
|
|
3
|
-
|
|
4
|
-
describe('EconomicPrimitives', () => {
|
|
5
|
-
it('should have calculating helpers', () => {
|
|
6
|
-
expect(ecPrims.calculateDepreciation).toBeDefined();
|
|
7
|
-
expect(ecPrims.calculateDepreciation(1.0, 0.0001, 0)).toBe(1.0);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('should export bonding curve formulas', () => {
|
|
11
|
-
expect(ecPrims.bondingCurvePrice).toBeDefined();
|
|
12
|
-
expect(ecPrims.bondingCurvePrice(10, 1.0, 2.0, 'linear')).toBe(10);
|
|
13
|
-
});
|
|
14
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { EconomicTraits, getEconomicTraitNames } from '../EconomicTraits.js';
|
|
3
|
-
|
|
4
|
-
describe('EconomicTraits', () => {
|
|
5
|
-
it('should export standard economic traits', () => {
|
|
6
|
-
expect(EconomicTraits).toBeDefined();
|
|
7
|
-
expect(EconomicTraits.tradeable).toBeDefined();
|
|
8
|
-
expect(EconomicTraits.depreciating).toBeDefined();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('should allow getting trait names', () => {
|
|
12
|
-
const names = getEconomicTraitNames();
|
|
13
|
-
expect(names).toContain('@tradeable');
|
|
14
|
-
expect(names.length).toBeGreaterThan(0);
|
|
15
|
-
});
|
|
16
|
-
});
|