@holoscript/std 3.1.1 → 6.0.3

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 (106) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/dist/__tests__/EconomicPrimitives.test.d.ts +2 -0
  4. package/dist/__tests__/EconomicTraits.test.d.ts +2 -0
  5. package/dist/__tests__/SimulationLabPrimitives.test.d.ts +2 -0
  6. package/dist/__tests__/collections.test.d.ts +2 -0
  7. package/dist/__tests__/events.test.d.ts +2 -0
  8. package/dist/__tests__/index.test.d.ts +2 -0
  9. package/dist/__tests__/index.test.d.ts.map +1 -0
  10. package/dist/__tests__/materials.test.d.ts +2 -0
  11. package/dist/__tests__/math.test.d.ts +2 -0
  12. package/dist/__tests__/physics.test.d.ts +2 -0
  13. package/dist/__tests__/spatial.test.d.ts +2 -0
  14. package/dist/__tests__/standard-library-fundamentals.test.d.ts +2 -0
  15. package/dist/__tests__/standard-library-fundamentals.test.d.ts.map +1 -0
  16. package/dist/__tests__/string-and-time-utilities.test.d.ts +2 -0
  17. package/dist/__tests__/string-and-time-utilities.test.d.ts.map +1 -0
  18. package/dist/__tests__/string-decoupled.test.d.ts +2 -0
  19. package/dist/__tests__/string.test.d.ts +2 -0
  20. package/dist/__tests__/time.test.d.ts +2 -0
  21. package/dist/chunk-7HVUYGPS.js +679 -0
  22. package/dist/chunk-7HVUYGPS.js.map +1 -0
  23. package/dist/chunk-P4O3WNG2.js +287 -0
  24. package/dist/chunk-P4O3WNG2.js.map +1 -0
  25. package/dist/chunk-PFX2JM4X.js +683 -0
  26. package/dist/chunk-PFX2JM4X.js.map +1 -0
  27. package/dist/chunk-W2Q3LUCM.js +348 -0
  28. package/dist/chunk-W2Q3LUCM.js.map +1 -0
  29. package/dist/chunk-WS6W35YC.js +443 -0
  30. package/dist/chunk-WS6W35YC.js.map +1 -0
  31. package/dist/chunk-ZXVZAQCZ.js +470 -0
  32. package/dist/chunk-ZXVZAQCZ.js.map +1 -0
  33. package/dist/collections.cjs +715 -0
  34. package/dist/collections.cjs.map +1 -0
  35. package/dist/collections.d.ts +177 -0
  36. package/dist/collections.js +17 -0
  37. package/dist/collections.js.map +1 -0
  38. package/dist/events.d.ts +32 -0
  39. package/dist/index.cjs +4101 -0
  40. package/dist/index.cjs.map +1 -0
  41. package/dist/index.d.ts +101 -0
  42. package/dist/index.js +1270 -190
  43. package/dist/index.js.map +1 -0
  44. package/dist/materials.d.ts +50 -0
  45. package/dist/math.cjs +591 -0
  46. package/dist/math.cjs.map +1 -0
  47. package/dist/math.d.ts +162 -0
  48. package/dist/math.js +53 -0
  49. package/dist/math.js.map +1 -0
  50. package/dist/physics.d.ts +59 -0
  51. package/dist/spatial.d.ts +82 -0
  52. package/dist/string.basic.test.d.ts +5 -0
  53. package/dist/string.basic.test.d.ts.map +1 -0
  54. package/dist/string.cjs +422 -0
  55. package/dist/string.cjs.map +1 -0
  56. package/dist/string.d.ts +212 -0
  57. package/dist/string.d.ts.map +1 -1
  58. package/dist/string.js +107 -0
  59. package/dist/string.js.map +1 -0
  60. package/dist/string.test.d.ts +5 -0
  61. package/dist/string.test.d.ts.map +1 -0
  62. package/dist/time.cjs +512 -0
  63. package/dist/time.cjs.map +1 -0
  64. package/dist/time.d.ts +215 -0
  65. package/dist/time.js +43 -0
  66. package/dist/time.js.map +1 -0
  67. package/dist/traits/ARTraits.d.ts +14 -0
  68. package/dist/traits/EconomicPrimitives.cjs +335 -0
  69. package/dist/traits/EconomicPrimitives.cjs.map +1 -0
  70. package/dist/traits/EconomicPrimitives.d.ts +345 -0
  71. package/dist/traits/EconomicPrimitives.js +55 -0
  72. package/dist/traits/EconomicPrimitives.js.map +1 -0
  73. package/dist/traits/EconomicTraits.cjs +471 -0
  74. package/dist/traits/EconomicTraits.cjs.map +1 -0
  75. package/dist/traits/EconomicTraits.d.ts +71 -0
  76. package/dist/traits/EconomicTraits.js +17 -0
  77. package/dist/traits/EconomicTraits.js.map +1 -0
  78. package/dist/traits/IoTTraits.d.ts +14 -0
  79. package/dist/traits/SimulationLabPrimitives.d.ts +187 -0
  80. package/dist/traits/SimulationLabTraits.d.ts +42 -0
  81. package/dist/traits/VRRTraits.d.ts +150 -0
  82. package/dist/traits/__tests__/ARTraits.test.d.ts +2 -0
  83. package/dist/traits/__tests__/ARTraits.test.d.ts.map +1 -0
  84. package/dist/traits/__tests__/EconomicPrimitives.test.d.ts +2 -0
  85. package/dist/traits/__tests__/EconomicPrimitives.test.d.ts.map +1 -0
  86. package/dist/traits/__tests__/EconomicTraits.test.d.ts +2 -0
  87. package/dist/traits/__tests__/EconomicTraits.test.d.ts.map +1 -0
  88. package/dist/types.d.ts +202 -0
  89. package/error-utf8.log +6 -0
  90. package/error.log +0 -0
  91. package/package.json +30 -18
  92. package/src/__tests__/index.test.ts +14 -0
  93. package/src/__tests__/{Sprint33.test.ts → standard-library-fundamentals.test.ts} +70 -70
  94. package/src/__tests__/{Sprint56.test.ts → string-and-time-utilities.test.ts} +64 -64
  95. package/src/__tests__/string-decoupled.test.ts +0 -2
  96. package/src/string.basic.test.ts +1 -1
  97. package/src/string.test.ts +4 -4
  98. package/src/string.ts +30 -15
  99. package/src/time.ts +1 -1
  100. package/src/traits/__tests__/ARTraits.test.ts +14 -0
  101. package/src/traits/__tests__/EconomicPrimitives.test.ts +14 -0
  102. package/src/traits/__tests__/EconomicTraits.test.ts +14 -0
  103. package/std_error.log +5 -0
  104. package/tsup.config.ts +17 -0
  105. package/dist/__tests__/Sprint33.test.d.ts.map +0 -1
  106. package/dist/__tests__/Sprint56.test.d.ts.map +0 -1
@@ -0,0 +1,443 @@
1
+ // src/traits/EconomicTraits.ts
2
+ var EconomicTraits = {
3
+ // ---------------------------------------------------------------------------
4
+ // 1. TRADEABLE
5
+ // ---------------------------------------------------------------------------
6
+ tradeable: {
7
+ name: "@tradeable",
8
+ description: "Makes a composition or node transferable between agents. Tracks ownership history with transaction hashes for integrity verification (P.030.04). Supports lock/unlock for escrow patterns and auction integration.",
9
+ params: {
10
+ initial_owner: {
11
+ type: "AgentID",
12
+ required: true,
13
+ description: "The agent who initially owns this entity."
14
+ },
15
+ transferable: {
16
+ type: "boolean",
17
+ required: false,
18
+ default: true,
19
+ description: "Whether transfers are currently allowed."
20
+ },
21
+ min_price: {
22
+ type: "number",
23
+ required: false,
24
+ default: 0,
25
+ description: "Minimum trade price (prevents value manipulation)."
26
+ },
27
+ max_history: {
28
+ type: "number",
29
+ required: false,
30
+ default: 50,
31
+ description: "Maximum ownership history entries retained."
32
+ },
33
+ requires_presence: {
34
+ type: "boolean",
35
+ required: false,
36
+ default: false,
37
+ description: "VR-specific: require spatial co-location for trade (anti-exploit, Layer 7)."
38
+ },
39
+ presence_radius: {
40
+ type: "number",
41
+ required: false,
42
+ default: 5,
43
+ description: "Maximum distance in meters for presence-based trades."
44
+ }
45
+ },
46
+ validator: (params) => {
47
+ if (!params.initial_owner || typeof params.initial_owner !== "string") return false;
48
+ if (params.min_price !== void 0 && params.min_price < 0) return false;
49
+ return true;
50
+ },
51
+ requiredPermissions: ["economy.trade"],
52
+ economicLayer: 0,
53
+ // Layer 0: Integrity
54
+ composesWith: ["@depreciating", "@bonding_curved", "@taxable_wealth"],
55
+ compiler_hints: {
56
+ requires_runtime: ["EconomicRuntime.executeTrade", "EconomicRuntime.verifyOwnership"],
57
+ thread_safety: "any"
58
+ }
59
+ },
60
+ // ---------------------------------------------------------------------------
61
+ // 2. DEPRECIATING
62
+ // ---------------------------------------------------------------------------
63
+ depreciating: {
64
+ name: "@depreciating",
65
+ description: "Applies time-based value decay to an entity (hard sink mechanic). Uses exponential decay: condition(t) = condition(0) * e^(-rate * t). When condition reaches destroy_threshold, the entity is consumed -- removing currency/value from circulation permanently (W.031).",
66
+ params: {
67
+ decay_rate: {
68
+ type: "number",
69
+ required: true,
70
+ description: "Per-second decay rate (0.0 - 1.0). E.g., 0.001 = 0.1% per second."
71
+ },
72
+ initial_condition: {
73
+ type: "number",
74
+ required: false,
75
+ default: 1,
76
+ description: "Starting condition (1.0 = mint, 0.0 = destroyed)."
77
+ },
78
+ destroy_threshold: {
79
+ type: "number",
80
+ required: false,
81
+ default: 0.01,
82
+ description: "Condition level at which the entity is destroyed."
83
+ },
84
+ repairable: {
85
+ type: "boolean",
86
+ required: false,
87
+ default: true,
88
+ description: "Whether the entity can be repaired to restore condition."
89
+ },
90
+ repair_cost_multiplier: {
91
+ type: "number",
92
+ required: false,
93
+ default: 0.5,
94
+ description: "Repair cost as a fraction of base value per unit condition."
95
+ },
96
+ emit_on_destroy: {
97
+ type: "string",
98
+ required: false,
99
+ default: "on_entity_destroyed",
100
+ description: "Event emitted when condition reaches destroy threshold."
101
+ }
102
+ },
103
+ validator: (params) => {
104
+ if (params.decay_rate === void 0 || params.decay_rate < 0 || params.decay_rate > 1)
105
+ return false;
106
+ if (params.initial_condition !== void 0 && (params.initial_condition < 0 || params.initial_condition > 1))
107
+ return false;
108
+ if (params.destroy_threshold !== void 0 && (params.destroy_threshold < 0 || params.destroy_threshold > 1))
109
+ return false;
110
+ return true;
111
+ },
112
+ requiredPermissions: ["economy.burn"],
113
+ economicLayer: 1,
114
+ // Layer 1: Flow Control (sink side)
115
+ composesWith: ["@tradeable", "@bonding_curved"],
116
+ compiler_hints: {
117
+ requires_runtime: ["EconomicRuntime.updateDepreciation", "EconomicRuntime.destroyEntity"],
118
+ thread_safety: "worker_thread",
119
+ performance_budget_ms: 0.1
120
+ // Must be fast -- called every tick
121
+ }
122
+ },
123
+ // ---------------------------------------------------------------------------
124
+ // 3. BONDING_CURVED
125
+ // ---------------------------------------------------------------------------
126
+ bonding_curved: {
127
+ name: "@bonding_curved",
128
+ description: "Attaches a bonding curve to a marketplace or item category for autonomous price discovery. Price is determined by P = f(supply) where f depends on curve_type. Provides continuous liquidity via reserve pool without order books (W.035, P.030.02). Supports spatial pricing for VR trade geography.",
129
+ params: {
130
+ curve_type: {
131
+ type: "string",
132
+ required: false,
133
+ default: "exponential",
134
+ description: "Curve shape: linear | exponential | logarithmic | sigmoid.",
135
+ validation: (val) => ["linear", "exponential", "logarithmic", "sigmoid"].includes(val)
136
+ },
137
+ reserve_ratio: {
138
+ type: "number",
139
+ required: true,
140
+ description: "Base price multiplier (R in the price formula)."
141
+ },
142
+ curve_steepness: {
143
+ type: "number",
144
+ required: false,
145
+ default: 2,
146
+ description: "Controls price sensitivity to supply changes (n in P = R * S^(1/n))."
147
+ },
148
+ transaction_fee: {
149
+ type: "number",
150
+ required: false,
151
+ default: 0.02,
152
+ description: "Fee percentage per transaction (hard sink). Range: 0.0 - 0.5."
153
+ },
154
+ initial_supply: {
155
+ type: "number",
156
+ required: false,
157
+ default: 0,
158
+ description: "Initial token/item supply on the curve."
159
+ },
160
+ initial_reserve: {
161
+ type: "number",
162
+ required: false,
163
+ default: 0,
164
+ description: "Initial reserve pool balance backing the curve."
165
+ },
166
+ sigmoid_k: {
167
+ type: "number",
168
+ required: false,
169
+ default: 100,
170
+ description: "Half-saturation constant for sigmoid curves."
171
+ },
172
+ spatial_distance_factor: {
173
+ type: "number",
174
+ required: false,
175
+ default: 0,
176
+ description: "VR spatial pricing: price multiplier per unit distance from hub. 0.0 = no spatial effect. Creates emergent trade routes (P.030.02 ENRICHED)."
177
+ }
178
+ },
179
+ validator: (params) => {
180
+ if (params.reserve_ratio === void 0 || params.reserve_ratio <= 0) return false;
181
+ if (params.curve_steepness !== void 0 && params.curve_steepness <= 0) return false;
182
+ if (params.transaction_fee !== void 0 && (params.transaction_fee < 0 || params.transaction_fee > 0.5))
183
+ return false;
184
+ if (params.curve_type !== void 0) {
185
+ if (!["linear", "exponential", "logarithmic", "sigmoid"].includes(params.curve_type))
186
+ return false;
187
+ }
188
+ return true;
189
+ },
190
+ requiredPermissions: ["economy.set_price", "economy.trade"],
191
+ economicLayer: 2,
192
+ // Layer 2: Price Discovery
193
+ composesWith: ["@tradeable", "@depreciating", "@pid_controlled"],
194
+ compiler_hints: {
195
+ requires_runtime: [
196
+ "EconomicRuntime.bondingCurveBuy",
197
+ "EconomicRuntime.bondingCurveSell",
198
+ "EconomicRuntime.getSpotPrice"
199
+ ],
200
+ thread_safety: "any",
201
+ performance_budget_ms: 1
202
+ }
203
+ },
204
+ // ---------------------------------------------------------------------------
205
+ // 4. TAXABLE_WEALTH
206
+ // ---------------------------------------------------------------------------
207
+ taxable_wealth: {
208
+ name: "@taxable_wealth",
209
+ description: "Applies progressive logarithmic wealth taxation with optional redistribution to the lowest-wealth quintile (P.030.03, W.034). Tax = 0 below threshold, then rate = min(max_rate, log(wealth/threshold) * base_rate). Collected taxes are partially redistributed (UBI) and partially burned (hard sink).",
210
+ params: {
211
+ threshold: {
212
+ type: "number",
213
+ required: true,
214
+ description: "Wealth level below which no tax is levied."
215
+ },
216
+ base_rate: {
217
+ type: "number",
218
+ required: false,
219
+ default: 0.01,
220
+ description: "Base tax rate multiplied by log(wealth/threshold). Range: 0.0 - 0.1."
221
+ },
222
+ max_effective_rate: {
223
+ type: "number",
224
+ required: false,
225
+ default: 0.05,
226
+ description: "Maximum effective tax rate cap (prevents punishing engagement)."
227
+ },
228
+ collection_interval: {
229
+ type: "string",
230
+ required: false,
231
+ default: "daily",
232
+ description: "How often taxes are collected: hourly | daily | weekly.",
233
+ validation: (val) => ["hourly", "daily", "weekly"].includes(val)
234
+ },
235
+ enable_redistribution: {
236
+ type: "boolean",
237
+ required: false,
238
+ default: true,
239
+ description: "Whether collected tax is redistributed to lowest-wealth players."
240
+ },
241
+ redistribution_fraction: {
242
+ type: "number",
243
+ required: false,
244
+ default: 0.7,
245
+ description: "Fraction of tax redistributed (remainder burned as hard sink). Range: 0.0 - 1.0."
246
+ },
247
+ emit_on_collection: {
248
+ type: "string",
249
+ required: false,
250
+ default: "on_tax_collected",
251
+ description: "Event emitted when taxes are collected."
252
+ },
253
+ public_ledger: {
254
+ type: "boolean",
255
+ required: false,
256
+ default: true,
257
+ description: "Whether tax collections and redistribution are visible in the economy dashboard (Layer 6: Transparency, W.038)."
258
+ }
259
+ },
260
+ validator: (params) => {
261
+ if (params.threshold === void 0 || params.threshold < 0) return false;
262
+ if (params.base_rate !== void 0 && (params.base_rate < 0 || params.base_rate > 0.1))
263
+ return false;
264
+ if (params.max_effective_rate !== void 0 && (params.max_effective_rate < 0 || params.max_effective_rate > 1))
265
+ return false;
266
+ if (params.redistribution_fraction !== void 0 && (params.redistribution_fraction < 0 || params.redistribution_fraction > 1))
267
+ return false;
268
+ return true;
269
+ },
270
+ requiredPermissions: ["economy.tax", "economy.redistribute"],
271
+ economicLayer: 4,
272
+ // Layer 4: Redistribution
273
+ composesWith: ["@tradeable", "@pid_controlled"],
274
+ compiler_hints: {
275
+ requires_runtime: [
276
+ "EconomicRuntime.collectTax",
277
+ "EconomicRuntime.redistribute",
278
+ "EconomicRuntime.getGiniCoefficient"
279
+ ],
280
+ thread_safety: "worker_thread",
281
+ performance_budget_ms: 5
282
+ // Runs on collection interval, not per-frame
283
+ }
284
+ },
285
+ // ---------------------------------------------------------------------------
286
+ // 5. PID_CONTROLLED
287
+ // ---------------------------------------------------------------------------
288
+ pid_controlled: {
289
+ name: "@pid_controlled",
290
+ description: "Attaches a dual-loop PID feedback controller to regulate economic flow (P.030.01, W.032). Inner loop adjusts per-source faucet rates (fast). Outer loop adjusts inner setpoint based on total money supply (slow). Achieves <10% currency variance long-term while preserving gameplay variance.",
291
+ params: {
292
+ target_per_capita: {
293
+ type: "number",
294
+ required: true,
295
+ description: "Target currency per active player (outer loop setpoint)."
296
+ },
297
+ inner_kp: {
298
+ type: "number",
299
+ required: false,
300
+ default: 0.5,
301
+ description: "Inner loop proportional gain."
302
+ },
303
+ inner_ki: {
304
+ type: "number",
305
+ required: false,
306
+ default: 0.01,
307
+ description: "Inner loop integral gain."
308
+ },
309
+ inner_kd: {
310
+ type: "number",
311
+ required: false,
312
+ default: 0.1,
313
+ description: "Inner loop derivative gain."
314
+ },
315
+ outer_kp: {
316
+ type: "number",
317
+ required: false,
318
+ default: 0.3,
319
+ description: "Outer loop proportional gain."
320
+ },
321
+ outer_ki: {
322
+ type: "number",
323
+ required: false,
324
+ default: 5e-3,
325
+ description: "Outer loop integral gain."
326
+ },
327
+ outer_kd: {
328
+ type: "number",
329
+ required: false,
330
+ default: 0.05,
331
+ description: "Outer loop derivative gain."
332
+ },
333
+ update_interval: {
334
+ type: "number",
335
+ required: false,
336
+ default: 1,
337
+ description: "Controller update interval in seconds."
338
+ },
339
+ faucet_min_multiplier: {
340
+ type: "number",
341
+ required: false,
342
+ default: 0.1,
343
+ description: "Minimum faucet rate multiplier (never fully stop rewards)."
344
+ },
345
+ faucet_max_multiplier: {
346
+ type: "number",
347
+ required: false,
348
+ default: 2,
349
+ description: "Maximum faucet rate multiplier."
350
+ },
351
+ track_faucet_sink_ratio: {
352
+ type: "boolean",
353
+ required: false,
354
+ default: true,
355
+ description: "Whether to track and emit faucet/sink ratio metrics (W.031)."
356
+ },
357
+ emit_on_adjustment: {
358
+ type: "string",
359
+ required: false,
360
+ default: "on_faucet_adjusted",
361
+ description: "Event emitted when faucet rate is adjusted."
362
+ }
363
+ },
364
+ validator: (params) => {
365
+ if (params.target_per_capita === void 0 || params.target_per_capita <= 0) return false;
366
+ const gains = [
367
+ params.inner_kp,
368
+ params.inner_ki,
369
+ params.inner_kd,
370
+ params.outer_kp,
371
+ params.outer_ki,
372
+ params.outer_kd
373
+ ];
374
+ for (const g of gains) {
375
+ if (g !== void 0 && (typeof g !== "number" || isNaN(g))) return false;
376
+ }
377
+ if (params.update_interval !== void 0 && params.update_interval <= 0) return false;
378
+ return true;
379
+ },
380
+ requiredPermissions: ["economy.tune_pid", "economy.mint", "economy.burn"],
381
+ economicLayer: 1,
382
+ // Layer 1: Flow Control
383
+ composesWith: ["@bonding_curved", "@taxable_wealth"],
384
+ compiler_hints: {
385
+ requires_runtime: [
386
+ "EconomicRuntime.updatePID",
387
+ "EconomicRuntime.getFaucetMultiplier",
388
+ "EconomicRuntime.getFaucetSinkMetrics"
389
+ ],
390
+ thread_safety: "worker_thread",
391
+ performance_budget_ms: 0.5
392
+ }
393
+ }
394
+ };
395
+ function getEconomicTraitNames() {
396
+ return Object.keys(EconomicTraits).map((k) => EconomicTraits[k].name);
397
+ }
398
+ function getEconomicTrait(name) {
399
+ const key = name.startsWith("@") ? name.slice(1) : name;
400
+ return EconomicTraits[key];
401
+ }
402
+ function validateTraitComposition(traitNames) {
403
+ for (const name of traitNames) {
404
+ const trait = getEconomicTrait(name);
405
+ if (!trait) {
406
+ return `Unknown economic trait: ${name}`;
407
+ }
408
+ }
409
+ for (const name of traitNames) {
410
+ const trait = getEconomicTrait(name);
411
+ for (const other of traitNames) {
412
+ if (other === name) continue;
413
+ const otherPrefixed = other.startsWith("@") ? other : `@${other}`;
414
+ if (!trait.composesWith.includes(otherPrefixed)) {
415
+ return `Trait ${trait.name} does not compose with ${otherPrefixed}`;
416
+ }
417
+ }
418
+ }
419
+ return null;
420
+ }
421
+ function getRequiredPermissions(traitNames) {
422
+ const permissions = /* @__PURE__ */ new Set();
423
+ for (const name of traitNames) {
424
+ const trait = getEconomicTrait(name);
425
+ if (trait) {
426
+ for (const perm of trait.requiredPermissions) {
427
+ permissions.add(perm);
428
+ }
429
+ }
430
+ }
431
+ return Array.from(permissions).sort();
432
+ }
433
+ var EconomicTraits_default = EconomicTraits;
434
+
435
+ export {
436
+ EconomicTraits,
437
+ getEconomicTraitNames,
438
+ getEconomicTrait,
439
+ validateTraitComposition,
440
+ getRequiredPermissions,
441
+ EconomicTraits_default
442
+ };
443
+ //# sourceMappingURL=chunk-WS6W35YC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/traits/EconomicTraits.ts"],"sourcesContent":["/**\n * @fileoverview Economic Trait Definitions for HoloScript\n * @module @holoscript/std/traits\n *\n * Defines five economic primitive traits that compose with existing VR traits\n * and leverage RBAC for economic permission enforcement:\n *\n * 1. @tradeable - Ownership, transfer, and trade settlement\n * 2. @depreciating - Time-based value decay (hard sink mechanic)\n * 3. @bonding_curved - Autonomous price discovery via bonding curves\n * 4. @taxable_wealth - Progressive wealth taxation with redistribution\n * 5. @pid_controlled - Dual-loop PID feedback for faucet/sink regulation\n *\n * These traits implement the research-proven mechanisms from:\n * - P.030.01 Dual-Loop PID Economy Controller\n * - P.030.02 Bonding Curve Marketplace\n * - P.030.03 Progressive Wealth Recycling\n * - W.031 Faucet-Sink Ratio as Master Variable\n * - W.032 Dual-Loop Feedback Control\n * - W.034 Wealth Tax > Income Tax for Gini Reduction\n * - W.035 Bonding Curves for Price Discovery\n *\n * RBAC Integration:\n * Each trait declares required permissions from the economy.* permission\n * category. The HoloScript compiler enforces these at compile time via\n * the existing AgentRBAC system.\n *\n * @version 1.0.0\n * @category economic\n */\n\nimport type { TraitDefinition } from '../types.js';\n\n/**\n * Extended trait definition with economic-specific metadata.\n */\nexport interface EconomicTraitDefinition extends TraitDefinition {\n /** RBAC permissions required to use this trait */\n requiredPermissions: string[];\n /** Economic layer this trait operates at (from 9-layer architecture) */\n economicLayer: number;\n /** Composability: which other economic traits this one works with */\n composesWith: string[];\n /** Compiler hints for code generation */\n compiler_hints?: {\n requires_runtime?: string[];\n thread_safety?: 'main_thread' | 'worker_thread' | 'any';\n performance_budget_ms?: number;\n };\n}\n\n// =============================================================================\n// TRAIT DEFINITIONS\n// =============================================================================\n\n/**\n * The five economic primitive traits.\n */\nexport const EconomicTraits: Record<string, EconomicTraitDefinition> = {\n // ---------------------------------------------------------------------------\n // 1. TRADEABLE\n // ---------------------------------------------------------------------------\n tradeable: {\n name: '@tradeable',\n description:\n 'Makes a composition or node transferable between agents. Tracks ownership ' +\n 'history with transaction hashes for integrity verification (P.030.04). ' +\n 'Supports lock/unlock for escrow patterns and auction integration.',\n params: {\n initial_owner: {\n type: 'AgentID',\n required: true,\n description: 'The agent who initially owns this entity.',\n },\n transferable: {\n type: 'boolean',\n required: false,\n default: true,\n description: 'Whether transfers are currently allowed.',\n },\n min_price: {\n type: 'number',\n required: false,\n default: 0,\n description: 'Minimum trade price (prevents value manipulation).',\n },\n max_history: {\n type: 'number',\n required: false,\n default: 50,\n description: 'Maximum ownership history entries retained.',\n },\n requires_presence: {\n type: 'boolean',\n required: false,\n default: false,\n description: 'VR-specific: require spatial co-location for trade (anti-exploit, Layer 7).',\n },\n presence_radius: {\n type: 'number',\n required: false,\n default: 5.0,\n description: 'Maximum distance in meters for presence-based trades.',\n },\n },\n validator: (params) => {\n if (!params.initial_owner || typeof params.initial_owner !== 'string') return false;\n if (params.min_price !== undefined && params.min_price < 0) return false;\n return true;\n },\n requiredPermissions: ['economy.trade'],\n economicLayer: 0, // Layer 0: Integrity\n composesWith: ['@depreciating', '@bonding_curved', '@taxable_wealth'],\n compiler_hints: {\n requires_runtime: ['EconomicRuntime.executeTrade', 'EconomicRuntime.verifyOwnership'],\n thread_safety: 'any',\n },\n },\n\n // ---------------------------------------------------------------------------\n // 2. DEPRECIATING\n // ---------------------------------------------------------------------------\n depreciating: {\n name: '@depreciating',\n description:\n 'Applies time-based value decay to an entity (hard sink mechanic). ' +\n 'Uses exponential decay: condition(t) = condition(0) * e^(-rate * t). ' +\n 'When condition reaches destroy_threshold, the entity is consumed -- ' +\n 'removing currency/value from circulation permanently (W.031).',\n params: {\n decay_rate: {\n type: 'number',\n required: true,\n description: 'Per-second decay rate (0.0 - 1.0). E.g., 0.001 = 0.1% per second.',\n },\n initial_condition: {\n type: 'number',\n required: false,\n default: 1.0,\n description: 'Starting condition (1.0 = mint, 0.0 = destroyed).',\n },\n destroy_threshold: {\n type: 'number',\n required: false,\n default: 0.01,\n description: 'Condition level at which the entity is destroyed.',\n },\n repairable: {\n type: 'boolean',\n required: false,\n default: true,\n description: 'Whether the entity can be repaired to restore condition.',\n },\n repair_cost_multiplier: {\n type: 'number',\n required: false,\n default: 0.5,\n description: 'Repair cost as a fraction of base value per unit condition.',\n },\n emit_on_destroy: {\n type: 'string',\n required: false,\n default: 'on_entity_destroyed',\n description: 'Event emitted when condition reaches destroy threshold.',\n },\n },\n validator: (params) => {\n if (params.decay_rate === undefined || params.decay_rate < 0 || params.decay_rate > 1)\n return false;\n if (\n params.initial_condition !== undefined &&\n (params.initial_condition < 0 || params.initial_condition > 1)\n )\n return false;\n if (\n params.destroy_threshold !== undefined &&\n (params.destroy_threshold < 0 || params.destroy_threshold > 1)\n )\n return false;\n return true;\n },\n requiredPermissions: ['economy.burn'],\n economicLayer: 1, // Layer 1: Flow Control (sink side)\n composesWith: ['@tradeable', '@bonding_curved'],\n compiler_hints: {\n requires_runtime: ['EconomicRuntime.updateDepreciation', 'EconomicRuntime.destroyEntity'],\n thread_safety: 'worker_thread',\n performance_budget_ms: 0.1, // Must be fast -- called every tick\n },\n },\n\n // ---------------------------------------------------------------------------\n // 3. BONDING_CURVED\n // ---------------------------------------------------------------------------\n bonding_curved: {\n name: '@bonding_curved',\n description:\n 'Attaches a bonding curve to a marketplace or item category for autonomous ' +\n 'price discovery. Price is determined by P = f(supply) where f depends on ' +\n 'curve_type. Provides continuous liquidity via reserve pool without order ' +\n 'books (W.035, P.030.02). Supports spatial pricing for VR trade geography.',\n params: {\n curve_type: {\n type: 'string',\n required: false,\n default: 'exponential',\n description: 'Curve shape: linear | exponential | logarithmic | sigmoid.',\n validation: (val: any) => ['linear', 'exponential', 'logarithmic', 'sigmoid'].includes(val),\n },\n reserve_ratio: {\n type: 'number',\n required: true,\n description: 'Base price multiplier (R in the price formula).',\n },\n curve_steepness: {\n type: 'number',\n required: false,\n default: 2.0,\n description: 'Controls price sensitivity to supply changes (n in P = R * S^(1/n)).',\n },\n transaction_fee: {\n type: 'number',\n required: false,\n default: 0.02,\n description: 'Fee percentage per transaction (hard sink). Range: 0.0 - 0.5.',\n },\n initial_supply: {\n type: 'number',\n required: false,\n default: 0,\n description: 'Initial token/item supply on the curve.',\n },\n initial_reserve: {\n type: 'number',\n required: false,\n default: 0,\n description: 'Initial reserve pool balance backing the curve.',\n },\n sigmoid_k: {\n type: 'number',\n required: false,\n default: 100,\n description: 'Half-saturation constant for sigmoid curves.',\n },\n spatial_distance_factor: {\n type: 'number',\n required: false,\n default: 0.0,\n description:\n 'VR spatial pricing: price multiplier per unit distance from hub. ' +\n '0.0 = no spatial effect. Creates emergent trade routes (P.030.02 ENRICHED).',\n },\n },\n validator: (params) => {\n if (params.reserve_ratio === undefined || params.reserve_ratio <= 0) return false;\n if (params.curve_steepness !== undefined && params.curve_steepness <= 0) return false;\n if (\n params.transaction_fee !== undefined &&\n (params.transaction_fee < 0 || params.transaction_fee > 0.5)\n )\n return false;\n if (params.curve_type !== undefined) {\n if (!['linear', 'exponential', 'logarithmic', 'sigmoid'].includes(params.curve_type))\n return false;\n }\n return true;\n },\n requiredPermissions: ['economy.set_price', 'economy.trade'],\n economicLayer: 2, // Layer 2: Price Discovery\n composesWith: ['@tradeable', '@depreciating', '@pid_controlled'],\n compiler_hints: {\n requires_runtime: [\n 'EconomicRuntime.bondingCurveBuy',\n 'EconomicRuntime.bondingCurveSell',\n 'EconomicRuntime.getSpotPrice',\n ],\n thread_safety: 'any',\n performance_budget_ms: 1.0,\n },\n },\n\n // ---------------------------------------------------------------------------\n // 4. TAXABLE_WEALTH\n // ---------------------------------------------------------------------------\n taxable_wealth: {\n name: '@taxable_wealth',\n description:\n 'Applies progressive logarithmic wealth taxation with optional redistribution ' +\n 'to the lowest-wealth quintile (P.030.03, W.034). Tax = 0 below threshold, ' +\n 'then rate = min(max_rate, log(wealth/threshold) * base_rate). Collected taxes ' +\n 'are partially redistributed (UBI) and partially burned (hard sink).',\n params: {\n threshold: {\n type: 'number',\n required: true,\n description: 'Wealth level below which no tax is levied.',\n },\n base_rate: {\n type: 'number',\n required: false,\n default: 0.01,\n description: 'Base tax rate multiplied by log(wealth/threshold). Range: 0.0 - 0.1.',\n },\n max_effective_rate: {\n type: 'number',\n required: false,\n default: 0.05,\n description: 'Maximum effective tax rate cap (prevents punishing engagement).',\n },\n collection_interval: {\n type: 'string',\n required: false,\n default: 'daily',\n description: 'How often taxes are collected: hourly | daily | weekly.',\n validation: (val: any) => ['hourly', 'daily', 'weekly'].includes(val),\n },\n enable_redistribution: {\n type: 'boolean',\n required: false,\n default: true,\n description: 'Whether collected tax is redistributed to lowest-wealth players.',\n },\n redistribution_fraction: {\n type: 'number',\n required: false,\n default: 0.7,\n description:\n 'Fraction of tax redistributed (remainder burned as hard sink). Range: 0.0 - 1.0.',\n },\n emit_on_collection: {\n type: 'string',\n required: false,\n default: 'on_tax_collected',\n description: 'Event emitted when taxes are collected.',\n },\n public_ledger: {\n type: 'boolean',\n required: false,\n default: true,\n description:\n 'Whether tax collections and redistribution are visible in the ' +\n 'economy dashboard (Layer 6: Transparency, W.038).',\n },\n },\n validator: (params) => {\n if (params.threshold === undefined || params.threshold < 0) return false;\n if (params.base_rate !== undefined && (params.base_rate < 0 || params.base_rate > 0.1))\n return false;\n if (\n params.max_effective_rate !== undefined &&\n (params.max_effective_rate < 0 || params.max_effective_rate > 1.0)\n )\n return false;\n if (\n params.redistribution_fraction !== undefined &&\n (params.redistribution_fraction < 0 || params.redistribution_fraction > 1.0)\n )\n return false;\n return true;\n },\n requiredPermissions: ['economy.tax', 'economy.redistribute'],\n economicLayer: 4, // Layer 4: Redistribution\n composesWith: ['@tradeable', '@pid_controlled'],\n compiler_hints: {\n requires_runtime: [\n 'EconomicRuntime.collectTax',\n 'EconomicRuntime.redistribute',\n 'EconomicRuntime.getGiniCoefficient',\n ],\n thread_safety: 'worker_thread',\n performance_budget_ms: 5.0, // Runs on collection interval, not per-frame\n },\n },\n\n // ---------------------------------------------------------------------------\n // 5. PID_CONTROLLED\n // ---------------------------------------------------------------------------\n pid_controlled: {\n name: '@pid_controlled',\n description:\n 'Attaches a dual-loop PID feedback controller to regulate economic flow ' +\n '(P.030.01, W.032). Inner loop adjusts per-source faucet rates (fast). ' +\n 'Outer loop adjusts inner setpoint based on total money supply (slow). ' +\n 'Achieves <10% currency variance long-term while preserving gameplay variance.',\n params: {\n target_per_capita: {\n type: 'number',\n required: true,\n description: 'Target currency per active player (outer loop setpoint).',\n },\n inner_kp: {\n type: 'number',\n required: false,\n default: 0.5,\n description: 'Inner loop proportional gain.',\n },\n inner_ki: {\n type: 'number',\n required: false,\n default: 0.01,\n description: 'Inner loop integral gain.',\n },\n inner_kd: {\n type: 'number',\n required: false,\n default: 0.1,\n description: 'Inner loop derivative gain.',\n },\n outer_kp: {\n type: 'number',\n required: false,\n default: 0.3,\n description: 'Outer loop proportional gain.',\n },\n outer_ki: {\n type: 'number',\n required: false,\n default: 0.005,\n description: 'Outer loop integral gain.',\n },\n outer_kd: {\n type: 'number',\n required: false,\n default: 0.05,\n description: 'Outer loop derivative gain.',\n },\n update_interval: {\n type: 'number',\n required: false,\n default: 1.0,\n description: 'Controller update interval in seconds.',\n },\n faucet_min_multiplier: {\n type: 'number',\n required: false,\n default: 0.1,\n description: 'Minimum faucet rate multiplier (never fully stop rewards).',\n },\n faucet_max_multiplier: {\n type: 'number',\n required: false,\n default: 2.0,\n description: 'Maximum faucet rate multiplier.',\n },\n track_faucet_sink_ratio: {\n type: 'boolean',\n required: false,\n default: true,\n description: 'Whether to track and emit faucet/sink ratio metrics (W.031).',\n },\n emit_on_adjustment: {\n type: 'string',\n required: false,\n default: 'on_faucet_adjusted',\n description: 'Event emitted when faucet rate is adjusted.',\n },\n },\n validator: (params) => {\n if (params.target_per_capita === undefined || params.target_per_capita <= 0) return false;\n // PID gains can be any real number, but should be reasonable\n const gains = [\n params.inner_kp,\n params.inner_ki,\n params.inner_kd,\n params.outer_kp,\n params.outer_ki,\n params.outer_kd,\n ];\n for (const g of gains) {\n if (g !== undefined && (typeof g !== 'number' || isNaN(g))) return false;\n }\n if (params.update_interval !== undefined && params.update_interval <= 0) return false;\n return true;\n },\n requiredPermissions: ['economy.tune_pid', 'economy.mint', 'economy.burn'],\n economicLayer: 1, // Layer 1: Flow Control\n composesWith: ['@bonding_curved', '@taxable_wealth'],\n compiler_hints: {\n requires_runtime: [\n 'EconomicRuntime.updatePID',\n 'EconomicRuntime.getFaucetMultiplier',\n 'EconomicRuntime.getFaucetSinkMetrics',\n ],\n thread_safety: 'worker_thread',\n performance_budget_ms: 0.5,\n },\n },\n};\n\n// =============================================================================\n// TRAIT UTILITIES\n// =============================================================================\n\n/**\n * Get all trait names as an array.\n */\nexport function getEconomicTraitNames(): string[] {\n return Object.keys(EconomicTraits).map((k) => EconomicTraits[k].name);\n}\n\n/**\n * Look up a trait definition by its @-prefixed name.\n */\nexport function getEconomicTrait(name: string): EconomicTraitDefinition | undefined {\n const key = name.startsWith('@') ? name.slice(1) : name;\n return EconomicTraits[key];\n}\n\n/**\n * Validate that a set of composed traits are compatible.\n * Returns an error message if incompatible, or null if valid.\n */\nexport function validateTraitComposition(traitNames: string[]): string | null {\n for (const name of traitNames) {\n const trait = getEconomicTrait(name);\n if (!trait) {\n return `Unknown economic trait: ${name}`;\n }\n }\n\n // Check that all traits compose with each other\n for (const name of traitNames) {\n const trait = getEconomicTrait(name)!;\n for (const other of traitNames) {\n if (other === name) continue;\n const otherPrefixed = other.startsWith('@') ? other : `@${other}`;\n if (!trait.composesWith.includes(otherPrefixed)) {\n return `Trait ${trait.name} does not compose with ${otherPrefixed}`;\n }\n }\n }\n\n return null;\n}\n\n/**\n * Get all RBAC permissions required by a set of economic traits.\n */\nexport function getRequiredPermissions(traitNames: string[]): string[] {\n const permissions = new Set<string>();\n for (const name of traitNames) {\n const trait = getEconomicTrait(name);\n if (trait) {\n for (const perm of trait.requiredPermissions) {\n permissions.add(perm);\n }\n }\n }\n return Array.from(permissions).sort();\n}\n\nexport default EconomicTraits;\n"],"mappings":";AA0DO,IAAM,iBAA0D;AAAA;AAAA;AAAA;AAAA,EAIrE,WAAW;AAAA,IACT,MAAM;AAAA,IACN,aACE;AAAA,IAGF,QAAQ;AAAA,MACN,eAAe;AAAA,QACb,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACf;AAAA,MACA,cAAc;AAAA,QACZ,MAAM;AAAA,QACN,UAAU;AAAA,QACV,SAAS;AAAA,QACT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