@holoscript/framework 6.0.3 → 6.0.4

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 (160) hide show
  1. package/CHANGELOG.md +1 -2
  2. package/ROADMAP.md +68 -66
  3. package/dist/{InvisibleWallet-BB6tFvRA.d.cts → InvisibleWallet-EFiuaLn3.d.cts} +1 -1
  4. package/dist/{OrchestratorAgent-BvWgf9uw.d.cts → OrchestratorAgent-CrLDGNL6.d.cts} +1 -1
  5. package/dist/agents/index.cjs +11 -10
  6. package/dist/agents/index.d.cts +4 -16
  7. package/dist/ai/index.cjs +2 -2
  8. package/dist/behavior.cjs +10 -0
  9. package/dist/economy/index.cjs +4 -4
  10. package/dist/economy/index.d.cts +2 -2
  11. package/dist/index.cjs +33 -11
  12. package/dist/index.d.cts +3 -3
  13. package/dist/swarm/index.cjs +3 -0
  14. package/package.json +14 -9
  15. package/src/__tests__/bounty-marketplace.test.ts +53 -21
  16. package/src/__tests__/delegation.test.ts +1 -4
  17. package/src/__tests__/done-log-audit.test.ts +38 -46
  18. package/src/__tests__/framework.test.ts +172 -53
  19. package/src/__tests__/goal-synthesizer.test.ts +9 -6
  20. package/src/__tests__/presence.test.ts +1 -1
  21. package/src/__tests__/protocol-agent.test.ts +12 -11
  22. package/src/__tests__/revenue-splitter.test.ts +22 -15
  23. package/src/__tests__/scenario-driven-todo.test.ts +55 -35
  24. package/src/__tests__/self-improve.test.ts +28 -9
  25. package/src/__tests__/service-lifecycle.test.ts +9 -3
  26. package/src/__tests__/skill-router.test.ts +3 -3
  27. package/src/agents/CulturalMemory.ts +6 -6
  28. package/src/agents/DelegationTraceHooks.ts +560 -0
  29. package/src/agents/FederatedRegistryAdapter.ts +1 -1
  30. package/src/agents/NormEngine.ts +3 -8
  31. package/src/agents/OrchestratorAgent.ts +1 -1
  32. package/src/agents/TaskDelegationService.ts +5 -9
  33. package/src/agents/__tests__/AgentWalletRegistry.test.ts +5 -4
  34. package/src/agents/__tests__/CrossRealityHandoff.test.ts +9 -3
  35. package/src/agents/__tests__/DelegationTraceHooks.test.ts +390 -0
  36. package/src/agents/__tests__/TaskDelegationService.test.ts +4 -2
  37. package/src/agents/spatial-comms/Layer1RealTime.ts +36 -19
  38. package/src/agents/spatial-comms/Layer2A2A.ts +1 -3
  39. package/src/agents/spatial-comms/Layer3MCP.ts +13 -4
  40. package/src/agents/spatial-comms/ProtocolTypes.ts +5 -2
  41. package/src/agents/spatial-comms/examples/multi-agent-world-creation.ts +2 -2
  42. package/src/ai/HoloScriptGenerator.ts +2 -2
  43. package/src/ai/__tests__/PerceptionSystem.prod.test.ts +1 -1
  44. package/src/ai/__tests__/PerceptionSystem.test.ts +14 -14
  45. package/src/ai/__tests__/SteeringBehaviors.prod.test.ts +1 -1
  46. package/src/ai/index.ts +5 -1
  47. package/src/board/audit.ts +17 -6
  48. package/src/board/board-ops.ts +45 -15
  49. package/src/board/board-types.ts +94 -20
  50. package/src/delegation.ts +5 -3
  51. package/src/distributed-claimer.ts +13 -2
  52. package/src/economy/BountyManager.ts +40 -18
  53. package/src/economy/KnowledgeMarketplace.ts +27 -8
  54. package/src/economy/PaymentWebhookService.ts +0 -1
  55. package/src/economy/RevenueSplitter.ts +2 -4
  56. package/src/economy/UnifiedBudgetOptimizer.ts +8 -9
  57. package/src/economy/_core-stubs.ts +1 -1
  58. package/src/economy/x402-facilitator.ts +17 -8
  59. package/src/index.ts +16 -12
  60. package/src/knowledge/__tests__/knowledge-consolidator.test.ts +138 -89
  61. package/src/knowledge/__tests__/knowledge-store-vector.test.ts +59 -16
  62. package/src/knowledge/brain.ts +7 -7
  63. package/src/knowledge/consolidation.ts +16 -16
  64. package/src/knowledge/knowledge-consolidator.ts +60 -30
  65. package/src/knowledge/knowledge-store.ts +83 -45
  66. package/src/learning/ProceduralCompiler.ts +6 -1
  67. package/src/learning/learning/MemoryConsolidator.ts +102 -0
  68. package/src/learning/learning/MemoryScorer.ts +69 -0
  69. package/src/learning/learning/ProceduralCompiler.ts +45 -0
  70. package/src/learning/learning/SemanticClusterer.ts +66 -0
  71. package/src/llm/llm-adapter.ts +24 -10
  72. package/src/mesh/index.ts +37 -17
  73. package/src/protocol/goal-synthesizer.ts +24 -34
  74. package/src/protocol/implementations.ts +91 -22
  75. package/src/protocol/micro-phase-decomposer.ts +25 -17
  76. package/src/protocol/micro-step-decomposer.test.ts +104 -39
  77. package/src/protocol-agent.test.ts +17 -7
  78. package/src/protocol-agent.ts +45 -42
  79. package/src/self-improve/absorb-scanner.ts +9 -6
  80. package/src/self-improve/evolution-engine.ts +36 -18
  81. package/src/self-improve/framework-absorber.ts +21 -16
  82. package/src/self-improve/index.ts +2 -10
  83. package/src/self-improve/prompt-optimizer.ts +31 -19
  84. package/src/self-improve/test-generator.ts +16 -12
  85. package/src/skill-router.ts +7 -6
  86. package/src/swarm/messaging/GossipProtocol.ts +1 -1
  87. package/src/swarm/messaging/__tests__/BroadcastChannel.prod.test.ts +31 -9
  88. package/src/swarm/messaging/__tests__/GossipProtocol.prod.test.ts +21 -7
  89. package/src/swarm/messaging/__tests__/SwarmEventBus.prod.test.ts +24 -8
  90. package/src/swarm/messaging/__tests__/SwarmEventBus.test.ts +6 -2
  91. package/src/team.ts +277 -122
  92. package/src/training/scripts/generate-spatial-dataset.ts +1 -1
  93. package/src/training/training/LRScheduler.ts +377 -0
  94. package/src/training/training/QualityScoringPipeline.ts +139 -0
  95. package/src/training/training/SoftDedup.ts +461 -0
  96. package/src/training/training/SparsityMonitor.ts +685 -0
  97. package/src/training/training/SparsityMonitorTypes.ts +209 -0
  98. package/src/training/training/SpatialTrainingDataGenerator.ts +1526 -0
  99. package/src/training/training/SpatialTrainingDataTypes.ts +216 -0
  100. package/src/training/training/TrainingPipelineConfig.ts +215 -0
  101. package/src/training/training/__tests__/CorpusValidation.test.ts +87 -0
  102. package/src/training/training/__tests__/LRScheduler.test.ts +592 -0
  103. package/src/training/training/__tests__/SoftDedup.test.ts +415 -0
  104. package/src/training/training/__tests__/SparsityMonitor.test.ts +1623 -0
  105. package/src/training/training/__tests__/SpatialCorpusValidation.test.ts +72 -0
  106. package/src/training/training/__tests__/SpatialTrainingDataGenerator.test.ts +1244 -0
  107. package/src/training/training/__tests__/TrainingMonkeyIntegration.test.ts +897 -0
  108. package/src/training/training/__tests__/TrainingPipelineConfig.test.ts +202 -0
  109. package/src/training/training/__tests__/schema.test.ts +72 -0
  110. package/src/training/training/__tests__/training-constants.test.ts +106 -0
  111. package/src/training/training/__tests__/trait-mappings.test.ts +81 -0
  112. package/src/training/training/constants.ts +94 -0
  113. package/src/training/training/index.ts +17 -0
  114. package/src/training/training/schema.ts +147 -0
  115. package/src/training/training/scripts/generate-novel-use-cases-dataset.ts +272 -0
  116. package/src/training/training/scripts/generate-spatial-dataset.ts +521 -0
  117. package/src/training/training/trainingmonkey/TrainingMonkeyIntegration.ts +477 -0
  118. package/src/training/training/trainingmonkey/TrainingMonkeyTypes.ts +230 -0
  119. package/src/training/training/trainingmonkey/index.ts +26 -0
  120. package/src/training/training/trait-mappings.ts +157 -0
  121. package/src/types.ts +2 -7
  122. package/ALL-test-results.json +0 -1
  123. package/LICENSE +0 -21
  124. package/dist/AgentManifest-CB4xM-Ma.d.ts +0 -704
  125. package/dist/BehaviorTree-BrBFECv5.d.ts +0 -103
  126. package/dist/InvisibleWallet-rtRrBOA8.d.ts +0 -1732
  127. package/dist/OrchestratorAgent-Q_CbVTmO.d.ts +0 -798
  128. package/dist/agents/index.d.ts +0 -1788
  129. package/dist/agents/index.js +0 -4695
  130. package/dist/ai/index.d.ts +0 -1753
  131. package/dist/ai/index.js +0 -5244
  132. package/dist/behavior.d.ts +0 -130
  133. package/dist/behavior.js +0 -407
  134. package/dist/economy/index.d.ts +0 -747
  135. package/dist/economy/index.js +0 -3617
  136. package/dist/implementations-D9T3un9D.d.ts +0 -236
  137. package/dist/index.d.ts +0 -1729
  138. package/dist/index.js +0 -24277
  139. package/dist/learning/index.d.ts +0 -104
  140. package/dist/learning/index.js +0 -189
  141. package/dist/negotiation/index.d.ts +0 -610
  142. package/dist/negotiation/index.js +0 -931
  143. package/dist/skills/index.d.ts +0 -289
  144. package/dist/skills/index.js +0 -1079
  145. package/dist/swarm/index.d.ts +0 -2433
  146. package/dist/swarm/index.js +0 -5221
  147. package/dist/training/index.d.ts +0 -1734
  148. package/dist/training/index.js +0 -2687
  149. package/extract-failures.js +0 -10
  150. package/src/training/training/data/novel-use-cases.jsonl +0 -153
  151. package/src/training/training/data/spatial-reasoning-10k.jsonl +0 -9354
  152. package/src/types/core-stubs.d.ts +0 -113
  153. package/test-output.txt +0 -0
  154. package/test-result.json +0 -1
  155. package/tsc-errors.txt +0 -4
  156. package/tsc_output.txt +0 -0
  157. package/typescript-errors-2.txt +0 -0
  158. package/typescript-errors.txt +0 -22
  159. package/vitest-log-utf8.txt +0 -268
  160. package/vitest-log.txt +0 -0
@@ -1,104 +0,0 @@
1
- interface EpisodicMemory {
2
- id: string;
3
- timestamp: number;
4
- action: string;
5
- outcome: string;
6
- entitiesInvolved: string[];
7
- semanticVector?: number[];
8
- }
9
- interface SemanticFact {
10
- id: string;
11
- fact: string;
12
- confidence: number;
13
- sourceEpisodes: string[];
14
- }
15
- /**
16
- * MemoryConsolidator
17
- *
18
- * Compresses raw episodic events into structured semantic facts
19
- * via idle background cycles, mirroring human sleep consolidation.
20
- */
21
- declare class MemoryConsolidator {
22
- /**
23
- * Identifies conceptually similar episodic memories based on shared entities and actions.
24
- */
25
- private static clusterEpisodes;
26
- /**
27
- * Mocks an LLM-based summarization pass converting a cluster of raw events
28
- * into a single concrete semantic truth.
29
- */
30
- private static summarizeCluster;
31
- /**
32
- * Executes the background consolidation pass.
33
- * Takes raw episodes, clusters them, extracts truths, and returns the facts
34
- * while reporting which raw episodes can be safely garbage collected.
35
- */
36
- static compressEpisodes(rawEpisodes: EpisodicMemory[]): {
37
- newFacts: SemanticFact[];
38
- prunedEpisodes: string[];
39
- };
40
- }
41
-
42
- /**
43
- * MemoryScorer
44
- *
45
- * Generates an 'importance' dimensional scalar for Episodic memories.
46
- * Allows the aggregation engine to aggressively prune trivial loops (like 'Idle')
47
- * and permanently archive high-value bounds (like 'Combat' or 'Crafting').
48
- */
49
- interface EpisodicEvent {
50
- agentId: string;
51
- timestamp: number;
52
- action: string;
53
- context: Record<string, any>;
54
- outcome: string;
55
- }
56
- declare class MemoryScorer {
57
- /**
58
- * Scores an event from -100 (Absolute Noise) to 100 (Critical Experience).
59
- */
60
- static computeImportance(event: EpisodicEvent): number;
61
- /**
62
- * Filters arrays natively discarding negative arrays
63
- */
64
- static cullLowImportance(events: EpisodicEvent[], threshold?: number): EpisodicEvent[];
65
- }
66
-
67
- interface ProceduralSkill {
68
- id: string;
69
- name: string;
70
- description?: string;
71
- code?: string;
72
- }
73
- /**
74
- * ProceduralCompiler
75
- *
76
- * Takes JSON-based AI logic trees extracted from temporal LLM generation natively
77
- * and compiles them strictly down into raw executable `.holo` syntax bounds.
78
- */
79
- declare class ProceduralCompiler {
80
- /**
81
- * Translates an Abstract Skill representation into native text executing within the VM.
82
- */
83
- static compile(skill: ProceduralSkill): string;
84
- }
85
-
86
- /**
87
- * SemanticClusterer
88
- *
89
- * Compresses raw temporal Episodic buffers into distilled arrays.
90
- * Native distillation drops repeating trivial structures mapping them into aggregated
91
- * density nodes explicitly reducing database storage loads across vector boundaries.
92
- */
93
- declare class SemanticClusterer {
94
- /**
95
- * Actively squash sequentially repeating abstract patterns mapping out semantic arrays.
96
- */
97
- static distill(events: EpisodicEvent[]): EpisodicEvent[];
98
- /**
99
- * Determines heuristic thresholds to squash logic natively offline without LLM.
100
- */
101
- private static isSimilar;
102
- }
103
-
104
- export { type EpisodicEvent, type EpisodicMemory, MemoryConsolidator, MemoryScorer, ProceduralCompiler, type ProceduralSkill, SemanticClusterer, type SemanticFact };
@@ -1,189 +0,0 @@
1
- // src/learning/MemoryConsolidator.ts
2
- var logger = { info: console.info, error: console.error };
3
- var MemoryConsolidator = class {
4
- /**
5
- * Identifies conceptually similar episodic memories based on shared entities and actions.
6
- */
7
- static clusterEpisodes(episodes) {
8
- const clusters = {};
9
- for (const ep of episodes) {
10
- const key = `${ep.action}_${ep.entitiesInvolved[0] || "generic"}`;
11
- if (!clusters[key]) clusters[key] = [];
12
- clusters[key].push(ep);
13
- }
14
- return Object.values(clusters);
15
- }
16
- /**
17
- * Mocks an LLM-based summarization pass converting a cluster of raw events
18
- * into a single concrete semantic truth.
19
- */
20
- static summarizeCluster(cluster) {
21
- if (cluster.length < 3) return null;
22
- const sample = cluster[0];
23
- const successCount = cluster.filter((ep) => ep.outcome.includes("success")).length;
24
- const successRate = successCount / cluster.length;
25
- let rule = "";
26
- if (successRate > 0.7) {
27
- rule = `${sample.action} applied to ${sample.entitiesInvolved[0]} is generally effective.`;
28
- } else {
29
- rule = `${sample.action} applied to ${sample.entitiesInvolved[0]} has high failure risk.`;
30
- }
31
- return {
32
- id: `fact_${Date.now()}_${Math.random().toString(36).substring(7)}`,
33
- fact: rule,
34
- confidence: successRate,
35
- sourceEpisodes: cluster.map((c) => c.id)
36
- };
37
- }
38
- /**
39
- * Executes the background consolidation pass.
40
- * Takes raw episodes, clusters them, extracts truths, and returns the facts
41
- * while reporting which raw episodes can be safely garbage collected.
42
- */
43
- static compressEpisodes(rawEpisodes) {
44
- if (rawEpisodes.length < 5) return { newFacts: [], prunedEpisodes: [] };
45
- logger.info(
46
- `[Consolidation] Running idle memory compression on ${rawEpisodes.length} episodes.`
47
- );
48
- const clusters = this.clusterEpisodes(rawEpisodes);
49
- const newFacts = [];
50
- const prunedEpisodes = [];
51
- for (const cluster of clusters) {
52
- const fact = this.summarizeCluster(cluster);
53
- if (fact) {
54
- newFacts.push(fact);
55
- prunedEpisodes.push(...fact.sourceEpisodes);
56
- }
57
- }
58
- logger.info(
59
- `[Consolidation] Distilled ${prunedEpisodes.length} raw episodes into ${newFacts.length} semantic facts.`
60
- );
61
- return { newFacts, prunedEpisodes };
62
- }
63
- };
64
-
65
- // src/learning/MemoryScorer.ts
66
- var MemoryScorer = class {
67
- /**
68
- * Scores an event from -100 (Absolute Noise) to 100 (Critical Experience).
69
- */
70
- static computeImportance(event) {
71
- let score = 0;
72
- const action = event.action.toLowerCase();
73
- if (action.includes("idle") || action.includes("wait") || action.includes("sleep")) {
74
- score -= 50;
75
- } else if (action.includes("move") || action.includes("look") || action.includes("walk")) {
76
- score -= 10;
77
- } else if (action.includes("craft") || action.includes("build") || action.includes("analyze")) {
78
- score += 30;
79
- } else if (action.includes("combat") || action.includes("attack") || action.includes("defense") || action.includes("damage")) {
80
- score += 50;
81
- }
82
- const contextKeys = Object.keys(event.context || {}).length;
83
- score += Math.min(20, contextKeys * 2);
84
- const outcome = event.outcome.toLowerCase();
85
- if (outcome.includes("failed") || outcome.includes("error")) {
86
- score += 25;
87
- } else if (outcome.includes("success") || outcome.includes("crafted") || outcome.includes("killed")) {
88
- score += 25;
89
- } else if (outcome.includes("nothing") || outcome.includes("none")) {
90
- score -= 20;
91
- }
92
- return Math.max(-100, Math.min(100, score));
93
- }
94
- /**
95
- * Filters arrays natively discarding negative arrays
96
- */
97
- static cullLowImportance(events, threshold = 0) {
98
- return events.filter((e) => this.computeImportance(e) >= threshold);
99
- }
100
- };
101
-
102
- // src/learning/ProceduralCompiler.ts
103
- var ProceduralCompiler = class {
104
- /**
105
- * Translates an Abstract Skill representation into native text executing within the VM.
106
- */
107
- static compile(skill) {
108
- let compiled = `// Auto-generated skill: ${skill.name}
109
- `;
110
- compiled += `// Desc: ${skill.description || "N/A"}
111
-
112
- `;
113
- compiled += `agent ${skill.id.replace(/-/g, "_")} {
114
- `;
115
- compiled += ` behavior execute() {
116
- `;
117
- const codeBlock = skill.code || "";
118
- const parsedLines = codeBlock.split("\n");
119
- for (let line of parsedLines) {
120
- line = line.trim();
121
- if (!line) continue;
122
- if (line.includes("move(") || line.includes("attack(") || line.includes("craft(")) {
123
- compiled += ` ensure_safety() {
124
- ${line}
125
- }
126
- `;
127
- } else {
128
- compiled += ` ${line}
129
- `;
130
- }
131
- }
132
- compiled += ` }
133
- `;
134
- compiled += `}
135
- `;
136
- return compiled;
137
- }
138
- };
139
-
140
- // src/learning/SemanticClusterer.ts
141
- var SemanticClusterer = class {
142
- /**
143
- * Actively squash sequentially repeating abstract patterns mapping out semantic arrays.
144
- */
145
- static distill(events) {
146
- if (events.length === 0) return [];
147
- const distilled = [];
148
- let currentSequence = { ...events[0] };
149
- let repetitonCount = 1;
150
- for (let i = 1; i < events.length; i++) {
151
- const ev = events[i];
152
- if (this.isSimilar(currentSequence, ev)) {
153
- repetitonCount++;
154
- currentSequence.outcome = `Repeated action successfully (${repetitonCount} times)`;
155
- if (!currentSequence.context.timeSpanStarted) {
156
- currentSequence.context.timeSpanStarted = currentSequence.timestamp;
157
- }
158
- currentSequence.context.timeSpanEnded = ev.timestamp;
159
- } else {
160
- if (repetitonCount > 1) {
161
- currentSequence.action = `${currentSequence.action}_Aggregated`;
162
- }
163
- distilled.push({ ...currentSequence });
164
- currentSequence = { ...ev };
165
- repetitonCount = 1;
166
- }
167
- }
168
- if (repetitonCount > 1) {
169
- currentSequence.action = `${currentSequence.action}_Aggregated`;
170
- }
171
- distilled.push(currentSequence);
172
- return distilled;
173
- }
174
- /**
175
- * Determines heuristic thresholds to squash logic natively offline without LLM.
176
- */
177
- static isSimilar(a, b) {
178
- if (a.action !== b.action) return false;
179
- const aTarget = a.context?.target || a.context?.location;
180
- const bTarget = b.context?.target || b.context?.location;
181
- return aTarget === bTarget;
182
- }
183
- };
184
- export {
185
- MemoryConsolidator,
186
- MemoryScorer,
187
- ProceduralCompiler,
188
- SemanticClusterer
189
- };