@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,1788 +0,0 @@
1
- export { a as AgentCapability, c as AgentCategory, d as AgentConfig, e as AgentEndpoint, f as AgentLifespanContext, A as AgentManifest, g as AgentManifestBuilder, h as AgentMessage, i as AgentPhase, j as AgentPosition, k as AgentResponse, l as AgentSection, m as AgentState, n as AgentTraitContext, o as AgentValidationResult, p as AnyPhaseResult, q as ArchitectureAwareness, r as AssistantLifespanContext, B as BoundingBox, s as BudgetConfig, b as CapabilityDomain, C as CapabilityType, t as CompressResult, u as CuriosityConfig, v as CycleMetric, w as CycleResult, D as DEFAULT_PHASE_TIMINGS, E as EndpointProtocol, x as EvolveResult, y as ExecuteResult, G as GotchaEntry, z as GrowResult, I as IntakeResult, F as LATENCY_THRESHOLDS, L as LatencyProfile, M as MessagePriority, P as PHASE_ORDER, H as PatternEntry, J as PhaseConfig, K as PhaseResult, R as ReflectResult, N as ReintakeResult, O as ResourceCost, S as SpatialScope, T as TrustLevel, V as Vector3, Q as VerificationStatus, W as WisdomEntry, U as createAgentManifest, X as validateManifest } from '../AgentManifest-CB4xM-Ma.js';
2
- export { A as A2AAgentCard, a as A2ASkill, b as A2ATransportAdapter, c as AgentMatch, d as AgentRegistry, R as AgentRegistryConfig, C as CapabilityMatch, e as CapabilityMatcher, f as CapabilityQuery, D as DEFAULT_REGISTRY_CONFIG, g as DelegationRequest, h as DelegationResult, i as DelegationTraceEvent, j as DelegationTracePhase, k as DiscoveryMode, F as FederatedRegistryAdapter, l as FederatedRegistryConfig, O as OrchestratorAgent, m as OrchestratorConfig, P as ProgressCallback, n as RegistryEvents, S as SkillExecutor, o as SkillWorkflowEngine, p as SpatialQuery, T as TaskDelegationConfig, q as TaskDelegationService, W as WorkflowDefinition, r as WorkflowInput, s as WorkflowResult, t as WorkflowStep, u as WorkflowStepResult, v as WorkflowValidation, w as defaultMatcher, x as findAgents, y as findBestAgent, z as getDefaultRegistry, B as resetDefaultRegistry } from '../OrchestratorAgent-Q_CbVTmO.js';
3
- import { CulturalNorm, NormEnforcement } from '@holoscript/core';
4
- export { CulturalNorm, NormCategory, NormEnforcement, NormScope } from '@holoscript/core';
5
- import { EventEmitter } from 'events';
6
- import '../implementations-D9T3un9D.js';
7
-
8
- /**
9
- * @fileoverview Agent Wallet Registry
10
- * @module @holoscript/core
11
- *
12
- * PURPOSE:
13
- * Bridges autonomous agents spawned via uaa2-service with Base L2 wallets.
14
- * Allows agents to securely hold funds and autonomously purchase logic traits
15
- * on the HoloScript marketplace. Signing is delegated to a Web3Connector
16
- * implementation (see @holoscript/marketplace-api for the viem-based connector).
17
- */
18
- interface AgentWallet {
19
- agentId: string;
20
- walletAddress: string;
21
- networkId: number;
22
- balanceThreshold: number;
23
- }
24
- declare class AgentWalletRegistry {
25
- private static instance;
26
- private wallets;
27
- private constructor();
28
- static getInstance(): AgentWalletRegistry;
29
- /**
30
- * Registers a new agent wallet mapping
31
- */
32
- registerWallet(agentId: string, walletAddress: string, networkId?: number): AgentWallet;
33
- /**
34
- * Retrieves an agent's registered wallet
35
- */
36
- getWallet(agentId: string): AgentWallet | undefined;
37
- /**
38
- * Removes an agent's wallet from the registry
39
- */
40
- unregisterWallet(agentId: string): boolean;
41
- /**
42
- * Authorizes an agent transaction using EIP-712 signature fallback
43
- * (Placeholder for Coinbase AgentKit KMS signing)
44
- */
45
- authorizeTransaction(agentId: string, payload: unknown): Promise<string>;
46
- }
47
-
48
- /**
49
- * @fileoverview Authenticated CRDTs — DID-Signed Conflict-Free State Sync
50
- * @module @holoscript/core/agents
51
- *
52
- * CRDTs (Conflict-free Replicated Data Types) for cross-device agent state.
53
- * Every operation is DID-signed, enabling trustworthy decentralized sync.
54
- *
55
- * Merge functions reject untrusted, revoked, or out-of-scope operations.
56
- * Overhead: ~0.1ms per merge operation.
57
- *
58
- * Implements:
59
- * - LWW-Register: Last-Writer-Wins for atomic values
60
- * - G-Counter: Grow-only counter for monotonic metrics
61
- * - OR-Set: Observed-Remove set for collections
62
- *
63
- * @version 1.0.0
64
- */
65
- /** A DID (Decentralized Identifier) for agent identity */
66
- interface DID {
67
- /** The DID string (e.g., "did:key:z6Mk...") */
68
- id: string;
69
- /** Device ID that generated this signature */
70
- deviceId: string;
71
- /** Capability scope (what this DID is allowed to modify) */
72
- scope: string[];
73
- /** Whether this DID has been revoked */
74
- revoked: boolean;
75
- }
76
- /** A signed operation */
77
- interface SignedOperation<T> {
78
- /** The operation payload */
79
- payload: T;
80
- /** Signer DID */
81
- signer: DID;
82
- /** Timestamp (Lamport logical clock) */
83
- timestamp: number;
84
- /** Signature hash (hex string) */
85
- signature: string;
86
- /** Scope tag for capability checking */
87
- scopeTag: string;
88
- }
89
- /**
90
- * Sign an operation with a DID.
91
- */
92
- declare function signOperation<T>(payload: T, signer: DID, scopeTag: string, timestamp: number): SignedOperation<T>;
93
- /**
94
- * Verify a signed operation: check non-revoked and scope.
95
- */
96
- declare function verifyOperation<T>(op: SignedOperation<T>): {
97
- valid: boolean;
98
- reason?: string;
99
- };
100
- /** A last-writer-wins register for a single value */
101
- declare class LWWRegister<T> {
102
- private value;
103
- private timestamp;
104
- private lastSigner;
105
- private history;
106
- constructor(initialValue: T);
107
- /** Get current value */
108
- get(): T;
109
- /** Get last write timestamp */
110
- getTimestamp(): number;
111
- /** Set value with a signed operation */
112
- set(op: SignedOperation<T>): {
113
- accepted: boolean;
114
- reason?: string;
115
- };
116
- /** Merge with another register (LWW semantics) */
117
- merge(other: LWWRegister<T>): void;
118
- /** Get operation history */
119
- getHistory(): SignedOperation<T>[];
120
- }
121
- /** A grow-only counter (each node can only increment) */
122
- declare class GCounter {
123
- private counts;
124
- /** Increment for a specific node */
125
- increment(nodeId: string, amount?: number): void;
126
- /** Get the total value */
127
- value(): number;
128
- /** Get the count for a specific node */
129
- nodeValue(nodeId: string): number;
130
- /** Merge with another counter (take max per node) */
131
- merge(other: GCounter): void;
132
- /** Export state */
133
- toJSON(): Record<string, number>;
134
- /** Import state */
135
- static fromJSON(data: Record<string, number>): GCounter;
136
- }
137
- /** An observed-remove set: concurrent adds always win over removes */
138
- declare class ORSet<T> {
139
- private elements;
140
- private tombstones;
141
- private tagCounter;
142
- /** Add an element with a signed operation */
143
- add(value: T, signer: DID, timestamp: number): string;
144
- /** Remove an element by value (removes all copies) */
145
- remove(value: T, _signer: DID): number;
146
- /** Check if the set contains a value */
147
- has(value: T): boolean;
148
- /** Get all current values (deduplicated) */
149
- values(): T[];
150
- /** Size of the set (unique values) */
151
- get size(): number;
152
- /** Merge with another OR-Set (adds win over concurrent removes) */
153
- merge(other: ORSet<T>): void;
154
- private valueEquals;
155
- }
156
- /** A complete authenticated agent state document */
157
- interface AuthenticatedAgentState {
158
- /** Agent DID */
159
- agentDID: string;
160
- /** State registers (key-value pairs) */
161
- registers: Map<string, LWWRegister<unknown>>;
162
- /** Counters */
163
- counters: Map<string, GCounter>;
164
- /** Sets */
165
- sets: Map<string, ORSet<unknown>>;
166
- /** Last sync timestamp */
167
- lastSync: number;
168
- }
169
- /**
170
- * Create a new authenticated agent state.
171
- */
172
- declare function createAgentState(agentDID: string): AuthenticatedAgentState;
173
- /**
174
- * Set a register value with authentication.
175
- */
176
- declare function setRegister(state: AuthenticatedAgentState, key: string, value: unknown, signer: DID, timestamp: number): {
177
- accepted: boolean;
178
- reason?: string;
179
- };
180
- /**
181
- * Get a register value.
182
- */
183
- declare function getRegister<T>(state: AuthenticatedAgentState, key: string): T | undefined;
184
- /**
185
- * Increment a counter.
186
- */
187
- declare function incrementCounter(state: AuthenticatedAgentState, key: string, nodeId: string, amount?: number): void;
188
- /**
189
- * Get a counter value.
190
- */
191
- declare function getCounter(state: AuthenticatedAgentState, key: string): number;
192
- /**
193
- * Merge two agent states (CRDT merge — always converges).
194
- */
195
- declare function mergeStates(local: AuthenticatedAgentState, remote: AuthenticatedAgentState): void;
196
-
197
- /**
198
- * @fileoverview Cross-Reality Agent Handoff Protocol
199
- * @module @holoscript/core/agents
200
- *
201
- * Implements the Minimum Viable Continuity (MVC) handoff schema:
202
- * exactly 5 typed objects transferred during cross-device agent handoff.
203
- * Payload is <10KB. Full context is lazy-loaded after transition.
204
- *
205
- * The handoff protocol:
206
- * 1. Capability negotiation (source → target)
207
- * 2. MVC transfer (<10KB payload)
208
- * 3. Embodiment adaptation (Avatar3D ↔ VoiceHUD ↔ UI2D etc.)
209
- * 4. Lazy context loading (background)
210
- *
211
- * Geospatial coordinates (WGS84) are the universal spatial anchor.
212
- *
213
- * @version 1.0.0
214
- */
215
- type PlatformTarget = string;
216
- type PlatformCapabilities = {
217
- spatialTracking?: boolean;
218
- handTracking?: boolean;
219
- eyeTracking?: boolean;
220
- haptics?: boolean;
221
- spatialAudio?: boolean;
222
- gpu3D?: boolean;
223
- arCamera?: boolean;
224
- gps?: boolean;
225
- npu?: boolean;
226
- webxrSupport?: boolean;
227
- [key: string]: boolean | undefined;
228
- };
229
- type EmbodimentType = 'Avatar3D' | 'VoiceHUD' | 'UI2D' | 'DataStream' | string;
230
- declare const PLATFORM_CAPABILITIES: Record<string, PlatformCapabilities>;
231
- declare const embodimentFor: (platform: PlatformTarget) => EmbodimentType;
232
- declare const platformCategory: (platform: PlatformTarget) => string;
233
- /** A decision the agent has made */
234
- interface DecisionEntry {
235
- id: string;
236
- /** What was decided */
237
- action: string;
238
- /** Why (reasoning trace) */
239
- reasoning: string;
240
- /** When (ISO timestamp) */
241
- timestamp: string;
242
- /** Confidence (0-1) */
243
- confidence: number;
244
- /** Outcome if known */
245
- outcome?: 'success' | 'failure' | 'pending';
246
- }
247
- /** Active task state */
248
- interface TaskState {
249
- /** Current task ID */
250
- taskId: string;
251
- /** Task description */
252
- description: string;
253
- /** Progress (0-1) */
254
- progress: number;
255
- /** Sub-tasks remaining */
256
- subtasks: {
257
- id: string;
258
- label: string;
259
- done: boolean;
260
- }[];
261
- /** Blocked on */
262
- blockedOn?: string;
263
- /** Priority */
264
- priority: 'critical' | 'high' | 'medium' | 'low';
265
- }
266
- /** User preferences */
267
- interface UserPreferences {
268
- /** Agent personality setting */
269
- personality: 'professional' | 'casual' | 'minimal' | 'verbose';
270
- /** Preferred interaction modality */
271
- modality: 'voice' | 'text' | 'gesture' | 'gaze' | 'auto';
272
- /** Language */
273
- language: string;
274
- /** Accessibility needs */
275
- accessibility: {
276
- highContrast?: boolean;
277
- screenReader?: boolean;
278
- reducedMotion?: boolean;
279
- };
280
- /** Custom key-value preferences */
281
- custom: Record<string, string>;
282
- }
283
- /** Spatial context summary (WGS84 universal anchor) */
284
- interface SpatialContext {
285
- /** WGS84 latitude */
286
- latitude: number;
287
- /** WGS84 longitude */
288
- longitude: number;
289
- /** Altitude in meters (WGS84 ellipsoid height) */
290
- altitude: number;
291
- /** Heading (degrees, 0=north) */
292
- heading: number;
293
- /** Indoor location hint (if available) */
294
- indoor?: {
295
- buildingId: string;
296
- floor: number;
297
- roomId?: string;
298
- };
299
- /** Spatial anchor IDs (platform-specific, for lazy resolution) */
300
- anchorIds?: string[];
301
- /** Timestamp of last spatial fix */
302
- fixTimestamp: string;
303
- /** Accuracy in meters */
304
- accuracy: number;
305
- }
306
- /** Evidence trail entry */
307
- interface EvidenceEntry {
308
- /** What was observed/received */
309
- type: 'observation' | 'user_input' | 'api_response' | 'sensor_data' | 'agent_message';
310
- /** Summary (keep brief for <10KB budget) */
311
- summary: string;
312
- /** Timestamp */
313
- timestamp: string;
314
- /** Source */
315
- source: string;
316
- /** Relevance score (0-1) */
317
- relevance: number;
318
- }
319
- /**
320
- * Minimum Viable Continuity payload — the 5 typed objects.
321
- * Total serialized size MUST be <10KB.
322
- */
323
- interface MVCPayload {
324
- /** Schema version */
325
- version: '1.0';
326
- /** Agent identity (DID) */
327
- agentDID: string;
328
- /** Session ID for continuity tracking */
329
- sessionId: string;
330
- /** 1. Decision history (last N decisions) */
331
- decisions: DecisionEntry[];
332
- /** 2. Active task state */
333
- task: TaskState;
334
- /** 3. User preferences */
335
- preferences: UserPreferences;
336
- /** 4. Spatial context (WGS84) */
337
- spatial: SpatialContext;
338
- /** 5. Evidence trail (most relevant entries) */
339
- evidence: EvidenceEntry[];
340
- /** Handoff metadata */
341
- handoff: {
342
- sourceDevice: string;
343
- sourcePlatform: PlatformTarget;
344
- sourceEmbodiment: EmbodimentType;
345
- timestamp: string;
346
- };
347
- }
348
- /** Device capabilities for handoff negotiation */
349
- interface DeviceCapabilities {
350
- deviceId: string;
351
- platform: PlatformTarget;
352
- capabilities: PlatformCapabilities;
353
- embodiment: EmbodimentType;
354
- available: boolean;
355
- }
356
- /** Handoff negotiation result */
357
- interface HandoffNegotiation {
358
- sourceDevice: DeviceCapabilities;
359
- targetDevice: DeviceCapabilities;
360
- /** Capabilities gained in transition */
361
- gained: string[];
362
- /** Capabilities lost in transition */
363
- lost: string[];
364
- /** Embodiment transition pair */
365
- transition: {
366
- from: EmbodimentType;
367
- to: EmbodimentType;
368
- };
369
- /** Estimated transition latency (ms) */
370
- estimatedLatencyMs: number;
371
- /** Whether the handoff is feasible */
372
- feasible: boolean;
373
- /** Reason if not feasible */
374
- reason?: string;
375
- }
376
- /**
377
- * Negotiate a handoff between two devices.
378
- */
379
- declare function negotiateHandoff(source: DeviceCapabilities, target: DeviceCapabilities): HandoffNegotiation;
380
- /**
381
- * Create an MVC payload for handoff.
382
- */
383
- declare function createMVCPayload(agentDID: string, sessionId: string, source: {
384
- deviceId: string;
385
- platform: PlatformTarget;
386
- }, data: {
387
- decisions: DecisionEntry[];
388
- task: TaskState;
389
- preferences: UserPreferences;
390
- spatial: SpatialContext;
391
- evidence: EvidenceEntry[];
392
- }): MVCPayload;
393
- /**
394
- * Estimate the serialized size of an MVC payload in bytes.
395
- */
396
- declare function estimatePayloadSize(payload: MVCPayload): number;
397
- /**
398
- * Validate that an MVC payload is within the 10KB budget.
399
- */
400
- declare function validatePayloadBudget(payload: MVCPayload): {
401
- valid: boolean;
402
- sizeBytes: number;
403
- budgetBytes: number;
404
- };
405
-
406
- /**
407
- * @fileoverview Cultural Memory — Dual Memory Architecture
408
- * @module @holoscript/core/agents
409
- *
410
- * Implements the dual memory model for emergent agent culture:
411
- * - Episodic Memory: Personal experiences with temporal decay
412
- * - Stigmergic Memory: Environmental traces visible to all agents
413
- *
414
- * Memory consolidation converts repeated episodic patterns into
415
- * Semantic SOPs (Standard Operating Procedures) — the mechanism
416
- * by which culture persists across sessions.
417
- *
418
- * Based on:
419
- * - P.025.03: Lifelong Team Memory Pattern
420
- * - MemAgents (ICLR 2026): Memory for LLM-Based Agentic Systems
421
- * - CRSEC Framework: Norm spreading through shared memory
422
- *
423
- * @version 1.0.0
424
- */
425
- /** An episodic memory entry — a single experience */
426
- interface EpisodicMemory {
427
- id: string;
428
- agentId: string;
429
- /** What happened */
430
- event: string;
431
- /** Who was involved */
432
- participants: string[];
433
- /** Emotional valence (-1 = negative, 0 = neutral, 1 = positive) */
434
- valence: number;
435
- /** Importance score (0-1) */
436
- importance: number;
437
- /** When it happened (tick number) */
438
- timestamp: number;
439
- /** Current strength (decays over time) */
440
- strength: number;
441
- /** Associated norm (if this experience relates to a norm) */
442
- normId?: string;
443
- /** Tags for retrieval */
444
- tags: string[];
445
- }
446
- /** A stigmergic trace — environmental memory visible to all */
447
- interface StigmergicTrace {
448
- id: string;
449
- /** Creator */
450
- creatorId: string;
451
- /** Spatial position */
452
- position: {
453
- x: number;
454
- y: number;
455
- z: number;
456
- };
457
- /** Zone the trace belongs to */
458
- zoneId: string;
459
- /** Type of trace */
460
- type: 'marker' | 'path' | 'signal' | 'artifact' | 'boundary';
461
- /** What this trace communicates */
462
- label: string;
463
- /** Current intensity (decays toward 0) */
464
- intensity: number;
465
- /** Initial intensity */
466
- initialIntensity: number;
467
- /** Decay rate per tick */
468
- decayRate: number;
469
- /** Perception radius */
470
- radius: number;
471
- /** When created */
472
- timestamp: number;
473
- /** Reinforcement count (how many agents have "validated" this trace) */
474
- reinforcements: number;
475
- }
476
- /** A semantic SOP — consolidated cultural knowledge */
477
- interface SemanticSOP {
478
- id: string;
479
- /** The norm or convention this SOP encodes */
480
- normId: string;
481
- /** Human-readable description */
482
- description: string;
483
- /** Conditions under which this SOP applies */
484
- conditions: string[];
485
- /** Recommended actions */
486
- actions: string[];
487
- /** Confidence (0-1, increases with more supporting episodes) */
488
- confidence: number;
489
- /** Number of episodes that contributed to this SOP */
490
- episodeCount: number;
491
- /** When consolidated */
492
- createdAt: number;
493
- /** Last updated */
494
- updatedAt: number;
495
- }
496
- interface CulturalMemoryConfig {
497
- /** Max episodic memories per agent */
498
- episodicCapacity: number;
499
- /** Decay rate per tick (0-1) */
500
- episodicDecayRate: number;
501
- /** Max stigmergic traces per zone */
502
- stigmergicCapacity: number;
503
- /** Default trace decay rate */
504
- traceDecayRate: number;
505
- /** Min episodes before SOP consolidation */
506
- consolidationThreshold: number;
507
- /** Min confidence for SOP retention */
508
- sopRetentionThreshold: number;
509
- }
510
- /**
511
- * CulturalMemory — dual memory system for emergent agent culture.
512
- *
513
- * Manages three memory tiers:
514
- * 1. Episodic (per-agent, decaying personal experiences)
515
- * 2. Stigmergic (spatial, shared environmental traces)
516
- * 3. Semantic (consolidated SOPs from repeated patterns)
517
- */
518
- declare class CulturalMemory {
519
- private config;
520
- private episodic;
521
- private stigmergic;
522
- private sops;
523
- private currentTick;
524
- constructor(config?: Partial<CulturalMemoryConfig>);
525
- /**
526
- * Record an episodic memory for an agent.
527
- */
528
- record(agentId: string, event: string, opts?: Partial<Omit<EpisodicMemory, 'id' | 'agentId' | 'event' | 'strength' | 'timestamp'>>): EpisodicMemory;
529
- /**
530
- * Recall memories for an agent, optionally filtered.
531
- */
532
- recall(agentId: string, filter?: {
533
- normId?: string;
534
- tags?: string[];
535
- minStrength?: number;
536
- }): EpisodicMemory[];
537
- /**
538
- * Get the number of memories for an agent.
539
- */
540
- memoryCount(agentId: string): number;
541
- /**
542
- * Leave a stigmergic trace in the environment.
543
- */
544
- leaveTrace(creatorId: string, zoneId: string, label: string, position: {
545
- x: number;
546
- y: number;
547
- z: number;
548
- }, opts?: Partial<Omit<StigmergicTrace, 'id' | 'creatorId' | 'zoneId' | 'label' | 'position' | 'timestamp' | 'reinforcements'>>): StigmergicTrace;
549
- /**
550
- * Perceive nearby traces from a position.
551
- */
552
- perceiveTraces(zoneId: string, position: {
553
- x: number;
554
- y: number;
555
- z: number;
556
- }): StigmergicTrace[];
557
- /**
558
- * Reinforce a trace (another agent validates it).
559
- * Increases intensity and slows decay.
560
- */
561
- reinforceTrace(traceId: string, zoneId: string): boolean;
562
- /**
563
- * Get all traces in a zone.
564
- */
565
- zoneTraces(zoneId: string): StigmergicTrace[];
566
- /**
567
- * Attempt to consolidate episodic memories into a semantic SOP.
568
- * Finds repeated patterns (same normId, high frequency) and forms SOPs.
569
- */
570
- consolidate(agentId: string): SemanticSOP[];
571
- /**
572
- * Get all SOPs for an agent.
573
- */
574
- getSOPs(agentId: string): SemanticSOP[];
575
- /**
576
- * Get a specific SOP by agent and norm.
577
- */
578
- getSOP(agentId: string, normId: string): SemanticSOP | undefined;
579
- /**
580
- * Advance one tick: decay memories and traces, prune dead entries.
581
- */
582
- tick(): {
583
- decayedMemories: number;
584
- evaporatedTraces: number;
585
- };
586
- /**
587
- * Get current tick.
588
- */
589
- getTick(): number;
590
- /**
591
- * Get global statistics.
592
- */
593
- stats(): {
594
- agents: number;
595
- totalMemories: number;
596
- totalTraces: number;
597
- totalSOPs: number;
598
- zones: number;
599
- };
600
- /**
601
- * Export full state for persistence / cross-session continuity.
602
- */
603
- exportState(): {
604
- episodic: Record<string, EpisodicMemory[]>;
605
- stigmergic: Record<string, StigmergicTrace[]>;
606
- sops: SemanticSOP[];
607
- tick: number;
608
- };
609
- /**
610
- * Import state from persistence.
611
- */
612
- importState(state: ReturnType<CulturalMemory['exportState']>): void;
613
- }
614
-
615
- /**
616
- * @fileoverview Norm Engine — CRSEC Norm Lifecycle Manager
617
- * @module @holoscript/core/agents
618
- *
619
- * Implements the complete CRSEC norm lifecycle:
620
- * C - Creation: Agents propose new norms
621
- * R - Representation: Norms stored as structured objects
622
- * S - Spreading: Norms propagate through agent populations
623
- * E - Evaluation: Agents assess norm compliance
624
- * C - Compliance: Enforcement and feedback loops
625
- *
626
- * Key research findings implemented:
627
- * - Critical mass dynamics: 2% (weak) to 25-67% (strong) for norm change
628
- * - Metanorms: norms about enforcing norms (cultural ratchet)
629
- * - Model identity as cultural DNA (different base models → different cultures)
630
- * - The Governance Goldilocks Zone: structure without content
631
- *
632
- * @version 1.0.0
633
- */
634
-
635
- declare const BUILTIN_NORMS: CulturalNorm[];
636
- declare function criticalMassForChange(norm: CulturalNorm, populationSize: number): number;
637
-
638
- type VREffect = string;
639
- declare class EffectRow {
640
- private effects;
641
- constructor(effects: string[]);
642
- has(effect: string): boolean;
643
- }
644
- /** Per-agent norm adoption state */
645
- interface AgentNormState {
646
- agentId: string;
647
- /** Norms this agent has adopted */
648
- adopted: Set<string>;
649
- /** Compliance score per norm (0-1) */
650
- compliance: Map<string, number>;
651
- /** Norms this agent is currently violating */
652
- violations: Set<string>;
653
- /** Norms this agent has proposed */
654
- proposed: Set<string>;
655
- /** Number of times this agent has enforced norms on others */
656
- enforcementCount: number;
657
- }
658
- /** A norm violation event */
659
- interface NormViolation {
660
- normId: string;
661
- agentId: string;
662
- effect: VREffect;
663
- timestamp: number;
664
- severity: NormEnforcement;
665
- witnessed: string[];
666
- }
667
- /** A norm proposal from an agent */
668
- interface NormProposal {
669
- id: string;
670
- proposerId: string;
671
- norm: CulturalNorm;
672
- votes: Map<string, boolean>;
673
- timestamp: number;
674
- status: 'pending' | 'adopted' | 'rejected';
675
- }
676
- interface NormEngineConfig {
677
- /** Minimum adoption rate for a norm to be "active" (0-1) */
678
- activationThreshold: number;
679
- /** Compliance score increase per compliant action */
680
- complianceReward: number;
681
- /** Compliance score decrease per violation */
682
- violationPenalty: number;
683
- /** Minimum vote ratio for a proposal to be adopted */
684
- proposalThreshold: number;
685
- /** Enable metanorm tracking */
686
- enableMetanorms: boolean;
687
- }
688
- /**
689
- * NormEngine — manages the full CRSEC lifecycle for cultural norms.
690
- */
691
- declare class NormEngine {
692
- private config;
693
- private norms;
694
- private agents;
695
- private proposals;
696
- private violationLog;
697
- private adoptionHistory;
698
- private currentTick;
699
- constructor(config?: Partial<NormEngineConfig>);
700
- /**
701
- * Register a custom norm.
702
- */
703
- registerNorm(norm: CulturalNorm): void;
704
- /**
705
- * Agent proposes a new norm.
706
- */
707
- proposeNorm(proposerId: string, norm: CulturalNorm): NormProposal;
708
- /**
709
- * Vote on a pending proposal.
710
- */
711
- vote(proposalId: string, agentId: string, approve: boolean): boolean;
712
- /**
713
- * Get a norm by ID.
714
- */
715
- getNorm(normId: string): CulturalNorm | undefined;
716
- /**
717
- * List all registered norms.
718
- */
719
- listNorms(): CulturalNorm[];
720
- /**
721
- * Agent adopts a norm.
722
- */
723
- adopt(agentId: string, normId: string): boolean;
724
- /**
725
- * Agent abandons a norm.
726
- */
727
- abandon(agentId: string, normId: string): boolean;
728
- /**
729
- * Get adoption rate for a norm (0-1).
730
- */
731
- adoptionRate(normId: string): number;
732
- /**
733
- * Check if a norm is active (adoption > threshold).
734
- */
735
- isActive(normId: string): boolean;
736
- /**
737
- * Check if an agent's intended effects comply with active norms.
738
- * Returns violations found.
739
- */
740
- evaluate(agentId: string, effects: VREffect[], zoneId?: string): NormViolation[];
741
- /**
742
- * Record that an agent complied with a norm.
743
- */
744
- recordCompliance(agentId: string, normId: string): void;
745
- /**
746
- * Record that an agent violated a norm.
747
- */
748
- recordViolation(violation: NormViolation): void;
749
- /**
750
- * Get compliance score for an agent on a norm.
751
- */
752
- getCompliance(agentId: string, normId: string): number;
753
- /**
754
- * Register an agent in the norm engine.
755
- */
756
- registerAgent(agentId: string, adoptNorms?: string[]): AgentNormState;
757
- /**
758
- * Advance one tick: record adoption history, snapshot state.
759
- */
760
- tick(): void;
761
- /**
762
- * Get adoption curve data for a norm.
763
- */
764
- adoptionCurve(normId: string): {
765
- tick: number;
766
- rate: number;
767
- }[];
768
- /**
769
- * Get the cultural health score for the whole population (0-1).
770
- * High = norms well-adopted, low violations. Low = cultural breakdown.
771
- */
772
- culturalHealth(): number;
773
- /**
774
- * Get statistics.
775
- */
776
- stats(): {
777
- norms: number;
778
- agents: number;
779
- activeNorms: number;
780
- violations: number;
781
- proposals: number;
782
- culturalHealth: number;
783
- };
784
- private getOrCreateAgent;
785
- private witnessesIn;
786
- }
787
-
788
- /**
789
- * @holoscript/core - Spatial Agent Communication Protocol Types
790
- *
791
- * Three-layer communication stack for multi-agent VR world creation:
792
- * - Layer 1: Real-Time Layer (UDP/WebRTC) - <1ms latency, 90fps coordination
793
- * - Layer 2: Coordination Layer (A2A over HTTP/2) - Task assignment, conflict resolution
794
- * - Layer 3: Metadata Layer (MCP) - Tool access, high-level commands
795
- */
796
- /**
797
- * Real-time message types for 90fps coordination
798
- */
799
- type RealTimeMessageType = 'position_sync' | 'frame_budget' | 'spatial_conflict' | 'performance_metric';
800
- /**
801
- * Position synchronization message (90 messages/second per agent)
802
- */
803
- interface PositionSyncMessage {
804
- type: 'position_sync';
805
- agent_id: string;
806
- timestamp: number;
807
- position: [number, number, number];
808
- rotation: [number, number, number, number];
809
- scale: [number, number, number];
810
- velocity?: [number, number, number];
811
- }
812
- /**
813
- * Frame budget status message
814
- */
815
- interface FrameBudgetMessage {
816
- type: 'frame_budget';
817
- agent_id: string;
818
- timestamp: number;
819
- frame_time_ms: number;
820
- budget_remaining_ms: number;
821
- target_fps: number;
822
- actual_fps: number;
823
- quality_level: 'high' | 'medium' | 'low' | 'minimal';
824
- }
825
- /**
826
- * Spatial conflict alert message
827
- */
828
- interface SpatialConflictMessage {
829
- type: 'spatial_conflict';
830
- agent_id: string;
831
- timestamp: number;
832
- conflict_type: 'overlap' | 'boundary_violation' | 'resource_contention' | 'performance_impact';
833
- affected_region: {
834
- center: [number, number, number];
835
- radius: number;
836
- };
837
- conflicting_agents: string[];
838
- severity: 'low' | 'medium' | 'high' | 'critical';
839
- suggested_action?: 'pause' | 'relocate' | 'reduce_quality' | 'defer';
840
- }
841
- /**
842
- * Performance metric message
843
- */
844
- interface PerformanceMetricMessage {
845
- type: 'performance_metric';
846
- agent_id: string;
847
- timestamp: number;
848
- metric_name: string;
849
- value: number;
850
- unit: 'ms' | 'fps' | 'percent' | 'count' | 'bytes';
851
- }
852
- /**
853
- * Union type for all real-time messages
854
- */
855
- type RealTimeMessage = PositionSyncMessage | FrameBudgetMessage | SpatialConflictMessage | PerformanceMetricMessage;
856
- /**
857
- * Real-time message body — strips auto-generated fields for the `send()` method.
858
- */
859
- type RealTimeMessageBody = DistributiveOmit<RealTimeMessage, 'agent_id' | 'timestamp'>;
860
- /**
861
- * Binary protocol configuration for minimal overhead
862
- */
863
- interface RealTimeProtocolConfig {
864
- /** Use binary encoding (vs JSON) */
865
- binary: boolean;
866
- /** Maximum message size in bytes */
867
- maxMessageSize: number;
868
- /** Target latency in milliseconds */
869
- targetLatency: number;
870
- /** Messages per second per agent */
871
- messagesPerSecond: number;
872
- /** Enable message compression */
873
- compression: boolean;
874
- /** UDP port for real-time messages */
875
- udpPort?: number;
876
- /** WebRTC configuration */
877
- webrtc?: {
878
- iceServers: RTCIceServer[];
879
- dataChannelOptions?: RTCDataChannelInit;
880
- };
881
- }
882
- /**
883
- * Default real-time protocol configuration
884
- */
885
- declare const DEFAULT_REALTIME_CONFIG: RealTimeProtocolConfig;
886
- /**
887
- * A2A message types for agent collaboration
888
- */
889
- type A2AMessageType = 'task_assignment' | 'task_complete' | 'spatial_claim' | 'conflict_resolution' | 'resource_request' | 'resource_release' | 'agent_handshake' | 'agent_disconnect';
890
- /**
891
- * Task specification for task assignment
892
- */
893
- interface TaskSpec {
894
- task_id: string;
895
- task_type: 'terrain' | 'assets' | 'physics' | 'lighting' | 'audio' | 'custom';
896
- priority: 'low' | 'medium' | 'high' | 'critical';
897
- parameters: Record<string, unknown>;
898
- spatial_region?: {
899
- center: [number, number, number];
900
- size: [number, number, number];
901
- };
902
- frame_budget_ms?: number;
903
- dependencies?: string[];
904
- deadline?: number;
905
- }
906
- /**
907
- * Task assignment message
908
- */
909
- interface TaskAssignmentMessage {
910
- type: 'task_assignment';
911
- message_id: string;
912
- from_agent: string;
913
- to_agent: string;
914
- timestamp: number;
915
- task: TaskSpec;
916
- }
917
- /**
918
- * Task completion message
919
- */
920
- interface TaskCompleteMessage {
921
- type: 'task_complete';
922
- message_id: string;
923
- from_agent: string;
924
- timestamp: number;
925
- task_id: string;
926
- success: boolean;
927
- result?: unknown;
928
- error?: string;
929
- performance_metrics?: {
930
- duration_ms: number;
931
- frame_time_avg_ms: number;
932
- frame_time_max_ms: number;
933
- quality_level: 'high' | 'medium' | 'low' | 'minimal';
934
- };
935
- }
936
- /**
937
- * Spatial claim message
938
- */
939
- interface SpatialClaimMessage {
940
- type: 'spatial_claim';
941
- message_id: string;
942
- from_agent: string;
943
- timestamp: number;
944
- claim_id: string;
945
- bounding_box: {
946
- min: [number, number, number];
947
- max: [number, number, number];
948
- };
949
- priority: 'low' | 'medium' | 'high' | 'critical';
950
- duration_ms?: number;
951
- exclusive: boolean;
952
- }
953
- /**
954
- * Conflict resolution strategy
955
- */
956
- type ConflictResolutionStrategy = 'priority_based' | 'time_slicing' | 'spatial_partitioning' | 'quality_reduction' | 'agent_relocation';
957
- /**
958
- * Conflict resolution message
959
- */
960
- interface ConflictResolutionMessage {
961
- type: 'conflict_resolution';
962
- message_id: string;
963
- from_agent: string;
964
- timestamp: number;
965
- conflict_id: string;
966
- strategy: ConflictResolutionStrategy;
967
- involved_agents: string[];
968
- resolution_params?: Record<string, unknown>;
969
- }
970
- /**
971
- * Resource request message
972
- */
973
- interface ResourceRequestMessage {
974
- type: 'resource_request';
975
- message_id: string;
976
- from_agent: string;
977
- timestamp: number;
978
- resource_id: string;
979
- resource_type: 'mesh' | 'texture' | 'material' | 'audio' | 'compute' | 'memory';
980
- amount?: number;
981
- priority: 'low' | 'medium' | 'high' | 'critical';
982
- }
983
- /**
984
- * Resource release message
985
- */
986
- interface ResourceReleaseMessage {
987
- type: 'resource_release';
988
- message_id: string;
989
- from_agent: string;
990
- timestamp: number;
991
- resource_id: string;
992
- }
993
- /**
994
- * Agent handshake message
995
- */
996
- interface AgentHandshakeMessage {
997
- type: 'agent_handshake';
998
- message_id: string;
999
- from_agent: string;
1000
- to_agent: string;
1001
- timestamp: number;
1002
- capabilities: string[];
1003
- protocol_version: string;
1004
- }
1005
- /**
1006
- * Agent disconnect message
1007
- */
1008
- interface AgentDisconnectMessage {
1009
- type: 'agent_disconnect';
1010
- message_id: string;
1011
- from_agent: string;
1012
- timestamp: number;
1013
- reason?: string;
1014
- }
1015
- /**
1016
- * Union type for all A2A messages
1017
- */
1018
- type A2AMessage = TaskAssignmentMessage | TaskCompleteMessage | SpatialClaimMessage | ConflictResolutionMessage | ResourceRequestMessage | ResourceReleaseMessage | AgentHandshakeMessage | AgentDisconnectMessage;
1019
- /**
1020
- * Distributive Omit for discriminated unions — removes keys from each member individually.
1021
- */
1022
- type DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never;
1023
- /**
1024
- * A2A message body type for the `send()` method.
1025
- * Strips auto-generated fields so callers only provide the domain payload.
1026
- */
1027
- type A2AMessageBody = DistributiveOmit<A2AMessage, 'message_id' | 'from_agent' | 'timestamp'>;
1028
- /**
1029
- * A2A protocol configuration
1030
- */
1031
- interface A2AProtocolConfig {
1032
- /** HTTP/2 endpoint */
1033
- endpoint: string;
1034
- /** Request timeout in milliseconds */
1035
- timeout: number;
1036
- /** Maximum retry attempts */
1037
- maxRetries: number;
1038
- /** Exponential backoff base (ms) */
1039
- retryBackoffBase: number;
1040
- /** Enable acknowledgments */
1041
- requireAck: boolean;
1042
- /** Enable request batching */
1043
- enableBatching: boolean;
1044
- /** Batch size */
1045
- batchSize: number;
1046
- }
1047
- /**
1048
- * Default A2A protocol configuration
1049
- */
1050
- declare const DEFAULT_A2A_CONFIG: A2AProtocolConfig;
1051
- /**
1052
- * A2A response
1053
- */
1054
- interface A2AResponse {
1055
- message_id: string;
1056
- success: boolean;
1057
- data?: unknown;
1058
- error?: string;
1059
- timestamp: number;
1060
- }
1061
- /**
1062
- * MCP command types for high-level operations
1063
- */
1064
- type MCPCommandType = 'create_world' | 'get_world_status' | 'export_world' | 'get_agent_registry' | 'get_performance_metrics' | 'set_global_config' | 'trigger_event';
1065
- /**
1066
- * World specification for world creation
1067
- */
1068
- interface WorldSpec {
1069
- world_id?: string;
1070
- name: string;
1071
- template?: 'blank' | 'office' | 'gallery' | 'playground' | 'analytics' | 'collaboration';
1072
- dimensions: {
1073
- width: number;
1074
- height: number;
1075
- depth: number;
1076
- };
1077
- target_fps: number;
1078
- max_agents: number;
1079
- features?: {
1080
- terrain?: boolean;
1081
- physics?: boolean;
1082
- lighting?: boolean;
1083
- audio?: boolean;
1084
- networking?: boolean;
1085
- };
1086
- agent_roles?: {
1087
- role: string;
1088
- agent_type: string;
1089
- spatial_region?: {
1090
- center: [number, number, number];
1091
- size: [number, number, number];
1092
- };
1093
- }[];
1094
- }
1095
- /**
1096
- * World status
1097
- */
1098
- interface WorldStatus {
1099
- world_id: string;
1100
- name: string;
1101
- status: 'initializing' | 'active' | 'paused' | 'error' | 'stopped';
1102
- active_agents: {
1103
- agent_id: string;
1104
- role: string;
1105
- status: 'online' | 'offline' | 'degraded';
1106
- }[];
1107
- performance: {
1108
- current_fps: number;
1109
- target_fps: number;
1110
- frame_time_avg_ms: number;
1111
- frame_time_max_ms: number;
1112
- quality_level: 'high' | 'medium' | 'low' | 'minimal';
1113
- };
1114
- spatial_conflicts: number;
1115
- resource_utilization: {
1116
- cpu_percent: number;
1117
- memory_mb: number;
1118
- gpu_percent: number;
1119
- };
1120
- uptime_ms: number;
1121
- created_at: string;
1122
- }
1123
- /**
1124
- * Export format options
1125
- */
1126
- type ExportFormat = 'gltf' | 'fbx' | 'usdz' | 'vrm' | 'json' | 'holoscript';
1127
- /**
1128
- * Performance metrics
1129
- */
1130
- interface PerformanceMetrics {
1131
- timestamp: number;
1132
- agents: {
1133
- agent_id: string;
1134
- role: string;
1135
- frame_time_avg_ms: number;
1136
- frame_time_max_ms: number;
1137
- messages_sent: number;
1138
- messages_received: number;
1139
- spatial_conflicts: number;
1140
- }[];
1141
- system: {
1142
- total_fps: number;
1143
- target_fps: number;
1144
- frame_time_avg_ms: number;
1145
- frame_time_max_ms: number;
1146
- quality_level: 'high' | 'medium' | 'low' | 'minimal';
1147
- cpu_percent: number;
1148
- memory_mb: number;
1149
- gpu_percent: number;
1150
- };
1151
- }
1152
- /**
1153
- * MCP command request
1154
- */
1155
- interface MCPCommandRequest {
1156
- command: MCPCommandType;
1157
- params: Record<string, unknown>;
1158
- }
1159
- /**
1160
- * MCP command response
1161
- */
1162
- interface MCPCommandResponse {
1163
- success: boolean;
1164
- data?: unknown;
1165
- error?: string;
1166
- timestamp: number;
1167
- }
1168
- /**
1169
- * MCP protocol configuration
1170
- */
1171
- interface MCPProtocolConfig {
1172
- /** MCP orchestrator endpoint */
1173
- endpoint: string;
1174
- /** API key for authentication */
1175
- apiKey: string;
1176
- /** Request timeout */
1177
- timeout: number;
1178
- }
1179
- /**
1180
- * Default MCP protocol configuration
1181
- */
1182
- declare const DEFAULT_MCP_CONFIG: MCPProtocolConfig;
1183
- /**
1184
- * Complete three-layer protocol configuration
1185
- */
1186
- interface SpatialCommProtocolConfig {
1187
- layer1: RealTimeProtocolConfig;
1188
- layer2: A2AProtocolConfig;
1189
- layer3: MCPProtocolConfig;
1190
- }
1191
- /**
1192
- * Default unified protocol configuration
1193
- */
1194
- declare const DEFAULT_SPATIAL_COMM_CONFIG: SpatialCommProtocolConfig;
1195
- /**
1196
- * Protocol version
1197
- */
1198
- declare const PROTOCOL_VERSION = "1.0.0";
1199
- /**
1200
- * Protocol compatibility
1201
- */
1202
- interface ProtocolCompatibility {
1203
- version: string;
1204
- minVersion: string;
1205
- maxVersion: string;
1206
- }
1207
- declare const PROTOCOL_COMPATIBILITY: ProtocolCompatibility;
1208
-
1209
- /**
1210
- * @holoscript/core - Layer 1: Real-Time Communication Layer
1211
- *
1212
- * UDP/WebRTC-based real-time communication for 90fps agent coordination.
1213
- * Features:
1214
- * - <1ms latency for position sync and frame budget updates
1215
- * - Binary protocol for minimal overhead
1216
- * - 90 messages/second per agent capability
1217
- * - Spatial conflict detection and alerts
1218
- */
1219
-
1220
- /**
1221
- * Encode real-time message to binary format
1222
- */
1223
- declare function encodeRealTimeMessage(message: RealTimeMessage): Buffer;
1224
- /**
1225
- * Decode binary message to RealTimeMessage
1226
- */
1227
- declare function decodeRealTimeMessage(buffer: Buffer): RealTimeMessage;
1228
- /**
1229
- * Real-time transport interface
1230
- */
1231
- interface RealTimeTransport {
1232
- send(buffer: Buffer, targetAgent?: string): Promise<void>;
1233
- broadcast(buffer: Buffer): Promise<void>;
1234
- close(): Promise<void>;
1235
- }
1236
- /**
1237
- * UDP-based real-time transport (Node.js environment)
1238
- */
1239
- declare class UDPRealTimeTransport implements RealTimeTransport {
1240
- private socket?;
1241
- private port;
1242
- private targetHost;
1243
- constructor(port: number);
1244
- init(): Promise<void>;
1245
- send(buffer: Buffer, _targetAgent?: string): Promise<void>;
1246
- broadcast(buffer: Buffer): Promise<void>;
1247
- close(): Promise<void>;
1248
- onMessage(callback: (buffer: Buffer, rinfo: unknown) => void): void;
1249
- }
1250
- /**
1251
- * WebRTC-based real-time transport (Browser environment)
1252
- */
1253
- declare class WebRTCRealTimeTransport implements RealTimeTransport {
1254
- private config;
1255
- private dataChannel?;
1256
- private peerConnection?;
1257
- constructor(config: RTCConfiguration);
1258
- init(remoteDescription?: RTCSessionDescriptionInit): Promise<void>;
1259
- send(buffer: Buffer, _targetAgent?: string): Promise<void>;
1260
- broadcast(buffer: Buffer): Promise<void>;
1261
- close(): Promise<void>;
1262
- onMessage(callback: (buffer: Buffer) => void): void;
1263
- createOffer(): Promise<RTCSessionDescriptionInit>;
1264
- createAnswer(): Promise<RTCSessionDescriptionInit>;
1265
- }
1266
- /**
1267
- * Layer 1 Real-Time Communication Client
1268
- */
1269
- declare class Layer1RealTimeClient extends EventEmitter {
1270
- private config;
1271
- private transport?;
1272
- private agentId;
1273
- private messageCount;
1274
- private lastMessageTime;
1275
- private readonly _messageBuffer;
1276
- constructor(agentId: string, config?: Partial<RealTimeProtocolConfig>);
1277
- /**
1278
- * Initialize transport and start listening
1279
- */
1280
- init(useWebRTC?: boolean): Promise<void>;
1281
- /**
1282
- * Send real-time message
1283
- */
1284
- send(message: RealTimeMessageBody, targetAgent?: string): Promise<void>;
1285
- /**
1286
- * Send position sync message
1287
- */
1288
- sendPositionSync(position: [number, number, number], rotation: [number, number, number, number], scale: [number, number, number], velocity?: [number, number, number]): Promise<void>;
1289
- /**
1290
- * Send frame budget message
1291
- */
1292
- sendFrameBudget(frameTimeMs: number, budgetRemainingMs: number, targetFps: number, actualFps: number, qualityLevel: 'high' | 'medium' | 'low' | 'minimal'): Promise<void>;
1293
- /**
1294
- * Close transport
1295
- */
1296
- close(): Promise<void>;
1297
- /**
1298
- * Handle incoming message
1299
- */
1300
- private handleIncomingMessage;
1301
- /**
1302
- * Enforce rate limiting
1303
- */
1304
- private enforceRateLimit;
1305
- /**
1306
- * Get current time in microseconds
1307
- */
1308
- private getMicroseconds;
1309
- }
1310
-
1311
- /**
1312
- * @holoscript/core - Layer 2: A2A Coordination Layer
1313
- *
1314
- * JSON-RPC over HTTP/2 for agent-to-agent collaboration.
1315
- * Features:
1316
- * - Task assignment and completion tracking
1317
- * - Spatial region claims and conflict resolution
1318
- * - Resource request/release management
1319
- * - Request/response with acknowledgments
1320
- * - Retry with exponential backoff
1321
- */
1322
-
1323
- interface SpatialClaim {
1324
- claim_id: string;
1325
- agent_id: string;
1326
- bounding_box: {
1327
- min: [number, number, number];
1328
- max: [number, number, number];
1329
- };
1330
- priority: 'low' | 'medium' | 'high' | 'critical';
1331
- exclusive: boolean;
1332
- expires_at?: number;
1333
- }
1334
- /**
1335
- * Layer 2 A2A Coordination Client
1336
- */
1337
- declare class Layer2A2AClient extends EventEmitter {
1338
- private config;
1339
- private agentId;
1340
- private messageQueue;
1341
- private claimManager;
1342
- private messageHandlers;
1343
- private batchBuffer;
1344
- private batchTimer?;
1345
- constructor(agentId: string, config?: Partial<A2AProtocolConfig>);
1346
- /**
1347
- * Send A2A message with retry
1348
- */
1349
- send(message: A2AMessageBody): Promise<A2AResponse>;
1350
- /**
1351
- * Send task assignment
1352
- */
1353
- assignTask(toAgent: string, task: TaskSpec): Promise<A2AResponse>;
1354
- /**
1355
- * Send task completion
1356
- */
1357
- completeTask(taskId: string, success: boolean, result?: unknown, error?: string, performanceMetrics?: {
1358
- duration_ms: number;
1359
- frame_time_avg_ms: number;
1360
- frame_time_max_ms: number;
1361
- quality_level: 'high' | 'medium' | 'low' | 'minimal';
1362
- }): Promise<A2AResponse>;
1363
- /**
1364
- * Claim spatial region
1365
- */
1366
- claimSpatialRegion(claimId: string, boundingBox: {
1367
- min: [number, number, number];
1368
- max: [number, number, number];
1369
- }, priority: 'low' | 'medium' | 'high' | 'critical', durationMs?: number, exclusive?: boolean): Promise<A2AResponse>;
1370
- /**
1371
- * Resolve spatial conflict
1372
- */
1373
- resolveConflict(conflictId: string, involvedAgents: string[], strategy: ConflictResolutionStrategy, resolutionParams?: Record<string, unknown>): Promise<A2AResponse>;
1374
- /**
1375
- * Request resource
1376
- */
1377
- requestResource(resourceId: string, resourceType: 'mesh' | 'texture' | 'material' | 'audio' | 'compute' | 'memory', amount?: number, priority?: 'low' | 'medium' | 'high' | 'critical'): Promise<A2AResponse>;
1378
- /**
1379
- * Release resource
1380
- */
1381
- releaseResource(resourceId: string): Promise<A2AResponse>;
1382
- /**
1383
- * Perform agent handshake
1384
- */
1385
- handshake(toAgent: string, capabilities: string[], protocolVersion: string): Promise<A2AResponse>;
1386
- /**
1387
- * Register message handler
1388
- */
1389
- onMessage(messageType: string, handler: (message: A2AMessage) => Promise<A2AResponse>): void;
1390
- /**
1391
- * Handle incoming message
1392
- */
1393
- handleIncoming(message: A2AMessage): Promise<A2AResponse>;
1394
- /**
1395
- * Get spatial claims for this agent
1396
- */
1397
- getMyClaims(): SpatialClaim[];
1398
- /**
1399
- * Get all spatial claims
1400
- */
1401
- getAllClaims(): SpatialClaim[];
1402
- /**
1403
- * Send message with retry logic
1404
- */
1405
- private sendMessage;
1406
- /**
1407
- * Attempt to send message
1408
- */
1409
- private attemptSend;
1410
- /**
1411
- * HTTP/2 request
1412
- */
1413
- private httpRequest;
1414
- /**
1415
- * Add message to batch
1416
- */
1417
- private addToBatch;
1418
- /**
1419
- * Flush batch of messages
1420
- */
1421
- private flushBatch;
1422
- /**
1423
- * Generate unique message ID
1424
- */
1425
- private generateMessageId;
1426
- /**
1427
- * Get queue statistics
1428
- */
1429
- getQueueStats(): {
1430
- queueSize: number;
1431
- claimCount: number;
1432
- };
1433
- /**
1434
- * Shutdown client
1435
- */
1436
- shutdown(): Promise<void>;
1437
- }
1438
-
1439
- /**
1440
- * @holoscript/core - Layer 3: MCP Metadata Layer
1441
- *
1442
- * Model Context Protocol integration for high-level commands and tool access.
1443
- * Features:
1444
- * - World creation and management
1445
- * - Agent registry queries
1446
- * - Performance metrics collection
1447
- * - Global configuration
1448
- * - System event triggering
1449
- */
1450
-
1451
- /**
1452
- * MCP tool definition
1453
- */
1454
- interface MCPTool {
1455
- name: string;
1456
- description: string;
1457
- parameters: {
1458
- type: 'object';
1459
- properties: Record<string, any>;
1460
- required?: string[];
1461
- };
1462
- }
1463
- /**
1464
- * Available MCP tools for spatial agent communication
1465
- */
1466
- declare const SPATIAL_MCP_TOOLS: MCPTool[];
1467
- /**
1468
- * Layer 3 MCP Metadata Client
1469
- */
1470
- declare class Layer3MCPClient extends EventEmitter {
1471
- private config;
1472
- private agentId;
1473
- constructor(agentId: string, config?: Partial<MCPProtocolConfig>);
1474
- /**
1475
- * Execute MCP command
1476
- */
1477
- execute(command: MCPCommandType, params: Record<string, any>): Promise<MCPCommandResponse>;
1478
- /**
1479
- * Create new VR world
1480
- */
1481
- createWorld(worldSpec: WorldSpec): Promise<{
1482
- world_id: string;
1483
- status: WorldStatus;
1484
- }>;
1485
- /**
1486
- * Get world status
1487
- */
1488
- getWorldStatus(worldId: string): Promise<WorldStatus>;
1489
- /**
1490
- * Export world
1491
- */
1492
- exportWorld(worldId: string, format: ExportFormat): Promise<{
1493
- url: string;
1494
- size: number;
1495
- }>;
1496
- /**
1497
- * Get agent registry
1498
- */
1499
- getAgentRegistry(filter?: {
1500
- status?: 'online' | 'offline' | 'degraded';
1501
- role?: string;
1502
- world_id?: string;
1503
- }): Promise<{
1504
- agents: Array<{
1505
- agent_id: string;
1506
- role: string;
1507
- status: 'online' | 'offline' | 'degraded';
1508
- world_id?: string;
1509
- capabilities: string[];
1510
- }>;
1511
- total: number;
1512
- }>;
1513
- /**
1514
- * Get performance metrics
1515
- */
1516
- getPerformanceMetrics(options?: {
1517
- world_id?: string;
1518
- agent_id?: string;
1519
- }): Promise<PerformanceMetrics>;
1520
- /**
1521
- * Set global configuration
1522
- */
1523
- setGlobalConfig(config: {
1524
- target_fps?: number;
1525
- max_agents?: number;
1526
- quality_level?: 'high' | 'medium' | 'low' | 'minimal';
1527
- enable_spatial_audio?: boolean;
1528
- enable_physics?: boolean;
1529
- }): Promise<void>;
1530
- /**
1531
- * Trigger system event
1532
- */
1533
- triggerEvent(eventType: string, eventData?: Record<string, any>): Promise<void>;
1534
- /**
1535
- * Call MCP tool directly
1536
- */
1537
- callTool(server: string, tool: string, args: Record<string, any>): Promise<MCPCommandResponse>;
1538
- /**
1539
- * Get available MCP tools
1540
- */
1541
- getAvailableTools(): MCPTool[];
1542
- /**
1543
- * Send MCP request
1544
- */
1545
- private sendMCPRequest;
1546
- /**
1547
- * Call MCP tool via orchestrator
1548
- */
1549
- private mcpToolCall;
1550
- }
1551
- /**
1552
- * MCP command handler
1553
- */
1554
- type MCPCommandHandler = (params: Record<string, any>, context: {
1555
- agent_id: string;
1556
- }) => Promise<any>;
1557
- /**
1558
- * Layer 3 MCP Server
1559
- * Handles incoming MCP commands from agents
1560
- */
1561
- declare class Layer3MCPServer extends EventEmitter {
1562
- private handlers;
1563
- private worlds;
1564
- constructor();
1565
- /**
1566
- * Register command handler
1567
- */
1568
- registerHandler(command: MCPCommandType, handler: MCPCommandHandler): void;
1569
- /**
1570
- * Handle incoming MCP request
1571
- */
1572
- handleRequest(request: MCPCommandRequest, context: {
1573
- agent_id: string;
1574
- }): Promise<MCPCommandResponse>;
1575
- /**
1576
- * Register default handlers
1577
- */
1578
- private registerDefaultHandlers;
1579
- /**
1580
- * Get all worlds
1581
- */
1582
- getWorlds(): WorldStatus[];
1583
- /**
1584
- * Update world status
1585
- */
1586
- updateWorld(worldId: string, updates: Partial<WorldStatus>): void;
1587
- }
1588
-
1589
- /**
1590
- * Frame budget tracker for graceful degradation
1591
- */
1592
- declare class FrameBudgetTracker {
1593
- private targetFps;
1594
- private targetFrameTimeMs;
1595
- private frameTimeSamples;
1596
- private maxSamples;
1597
- private qualityLevel;
1598
- constructor(targetFps?: number);
1599
- /**
1600
- * Record frame time
1601
- */
1602
- recordFrameTime(frameTimeMs: number): void;
1603
- /**
1604
- * Get average frame time
1605
- */
1606
- getAverageFrameTime(): number;
1607
- /**
1608
- * Get maximum frame time
1609
- */
1610
- getMaxFrameTime(): number;
1611
- /**
1612
- * Get current FPS
1613
- */
1614
- getCurrentFps(): number;
1615
- /**
1616
- * Get budget remaining for current frame
1617
- */
1618
- getBudgetRemaining(): number;
1619
- /**
1620
- * Check if within budget
1621
- */
1622
- isWithinBudget(): boolean;
1623
- /**
1624
- * Get current quality level
1625
- */
1626
- getQualityLevel(): 'high' | 'medium' | 'low' | 'minimal';
1627
- /**
1628
- * Set quality level
1629
- */
1630
- setQualityLevel(level: 'high' | 'medium' | 'low' | 'minimal'): void;
1631
- /**
1632
- * Auto-adjust quality based on performance
1633
- */
1634
- private autoAdjustQuality;
1635
- /**
1636
- * Get frame budget stats
1637
- */
1638
- getStats(): {
1639
- targetFps: number;
1640
- currentFps: number;
1641
- avgFrameTimeMs: number;
1642
- maxFrameTimeMs: number;
1643
- budgetRemainingMs: number;
1644
- qualityLevel: 'high' | 'medium' | 'low' | 'minimal';
1645
- withinBudget: boolean;
1646
- };
1647
- /**
1648
- * Reset tracker
1649
- */
1650
- reset(): void;
1651
- }
1652
- /**
1653
- * Unified spatial communication client
1654
- */
1655
- declare class SpatialCommClient extends EventEmitter {
1656
- private agentId;
1657
- private config;
1658
- private layer1?;
1659
- private layer2?;
1660
- private layer3?;
1661
- private frameBudget;
1662
- private initialized;
1663
- private currentWorldId?;
1664
- constructor(agentId: string, config?: Partial<SpatialCommProtocolConfig>);
1665
- /**
1666
- * Initialize all layers
1667
- */
1668
- init(options?: {
1669
- useWebRTC?: boolean;
1670
- }): Promise<void>;
1671
- /**
1672
- * Send position sync (Layer 1)
1673
- */
1674
- syncPosition(position: [number, number, number], rotation: [number, number, number, number], scale: [number, number, number], velocity?: [number, number, number]): Promise<void>;
1675
- /**
1676
- * Send frame budget update (Layer 1)
1677
- */
1678
- sendFrameBudget(): Promise<void>;
1679
- /**
1680
- * Record frame time (updates budget tracker)
1681
- */
1682
- recordFrameTime(frameTimeMs: number): void;
1683
- /**
1684
- * Get frame budget stats
1685
- */
1686
- getFrameBudgetStats(): {
1687
- targetFps: number;
1688
- currentFps: number;
1689
- avgFrameTimeMs: number;
1690
- maxFrameTimeMs: number;
1691
- budgetRemainingMs: number;
1692
- qualityLevel: "high" | "medium" | "low" | "minimal";
1693
- withinBudget: boolean;
1694
- };
1695
- /**
1696
- * Assign task to agent (Layer 2)
1697
- */
1698
- assignTask(toAgent: string, task: TaskSpec): Promise<A2AResponse>;
1699
- /**
1700
- * Complete task (Layer 2)
1701
- */
1702
- completeTask(taskId: string, success: boolean, result?: unknown, error?: string): Promise<A2AResponse>;
1703
- /**
1704
- * Claim spatial region (Layer 2)
1705
- */
1706
- claimSpatialRegion(claimId: string, boundingBox: {
1707
- min: [number, number, number];
1708
- max: [number, number, number];
1709
- }, priority: 'low' | 'medium' | 'high' | 'critical', durationMs?: number, exclusive?: boolean): Promise<A2AResponse>;
1710
- /**
1711
- * Request resource (Layer 2)
1712
- */
1713
- requestResource(resourceId: string, resourceType: 'mesh' | 'texture' | 'material' | 'audio' | 'compute' | 'memory', amount?: number, priority?: 'low' | 'medium' | 'high' | 'critical'): Promise<A2AResponse>;
1714
- /**
1715
- * Release resource (Layer 2)
1716
- */
1717
- releaseResource(resourceId: string): Promise<A2AResponse>;
1718
- /**
1719
- * Get spatial claims (Layer 2)
1720
- */
1721
- getMyClaims(): SpatialClaim[];
1722
- /**
1723
- * Create world (Layer 3)
1724
- */
1725
- createWorld(worldSpec: WorldSpec): Promise<{
1726
- world_id: string;
1727
- status: WorldStatus;
1728
- }>;
1729
- /**
1730
- * Get world status (Layer 3)
1731
- */
1732
- getWorldStatus(worldId?: string): Promise<WorldStatus>;
1733
- /**
1734
- * Export world (Layer 3)
1735
- */
1736
- exportWorld(format: ExportFormat, worldId?: string): Promise<{
1737
- url: string;
1738
- size: number;
1739
- }>;
1740
- /**
1741
- * Get agent registry (Layer 3)
1742
- */
1743
- getAgentRegistry(filter?: {
1744
- status?: 'online' | 'offline' | 'degraded';
1745
- role?: string;
1746
- world_id?: string;
1747
- }): Promise<{
1748
- agents: Array<{
1749
- agent_id: string;
1750
- role: string;
1751
- status: "online" | "offline" | "degraded";
1752
- world_id?: string;
1753
- capabilities: string[];
1754
- }>;
1755
- total: number;
1756
- }>;
1757
- /**
1758
- * Get performance metrics (Layer 3)
1759
- */
1760
- getPerformanceMetrics(options?: {
1761
- world_id?: string;
1762
- agent_id?: string;
1763
- }): Promise<PerformanceMetrics>;
1764
- /**
1765
- * Set global configuration (Layer 3)
1766
- */
1767
- setGlobalConfig(config: {
1768
- target_fps?: number;
1769
- max_agents?: number;
1770
- quality_level?: 'high' | 'medium' | 'low' | 'minimal';
1771
- }): Promise<void>;
1772
- /**
1773
- * Shutdown client
1774
- */
1775
- shutdown(): Promise<void>;
1776
- /**
1777
- * Get client status
1778
- */
1779
- getStatus(): {
1780
- agentId: string;
1781
- initialized: boolean;
1782
- currentWorldId?: string;
1783
- frameBudget: ReturnType<FrameBudgetTracker['getStats']>;
1784
- queueStats: ReturnType<Layer2A2AClient['getQueueStats']>;
1785
- };
1786
- }
1787
-
1788
- export { type A2AMessage, type A2AMessageBody, type A2AMessageType, type A2AProtocolConfig, type A2AResponse, type AgentDisconnectMessage, type AgentHandshakeMessage, type AgentNormState, type AgentWallet, AgentWalletRegistry, type AuthenticatedAgentState, BUILTIN_NORMS, type ConflictResolutionMessage, type ConflictResolutionStrategy, CulturalMemory, type CulturalMemoryConfig, DEFAULT_A2A_CONFIG, DEFAULT_MCP_CONFIG, DEFAULT_REALTIME_CONFIG, DEFAULT_SPATIAL_COMM_CONFIG, type DID, type DecisionEntry, type DeviceCapabilities, EffectRow, type EmbodimentType, type EpisodicMemory, type EvidenceEntry, type ExportFormat, type FrameBudgetMessage, FrameBudgetTracker, GCounter, type HandoffNegotiation, LWWRegister, Layer1RealTimeClient, Layer2A2AClient, Layer3MCPClient, Layer3MCPServer, type MCPCommandHandler, type MCPCommandRequest, type MCPCommandResponse, type MCPCommandType, type MCPProtocolConfig, type MCPTool, type MVCPayload, NormEngine, type NormEngineConfig, type NormProposal, type NormViolation, ORSet, PLATFORM_CAPABILITIES, PROTOCOL_COMPATIBILITY, PROTOCOL_VERSION, type PerformanceMetricMessage, type PerformanceMetrics, type PlatformCapabilities, type PlatformTarget, type PositionSyncMessage, type ProtocolCompatibility, type RealTimeMessage, type RealTimeMessageBody, type RealTimeMessageType, type RealTimeProtocolConfig, type RealTimeTransport, type ResourceReleaseMessage, type ResourceRequestMessage, SPATIAL_MCP_TOOLS, type SemanticSOP, type SignedOperation, type SpatialClaimMessage, SpatialCommClient, type SpatialCommProtocolConfig, type SpatialConflictMessage, type SpatialContext, type StigmergicTrace, type TaskAssignmentMessage, type TaskCompleteMessage, type TaskSpec, type TaskState, UDPRealTimeTransport, type UserPreferences, type VREffect, WebRTCRealTimeTransport, type WorldSpec, type WorldStatus, createAgentState, createMVCPayload, criticalMassForChange, decodeRealTimeMessage, embodimentFor, encodeRealTimeMessage, estimatePayloadSize, getCounter, getRegister, incrementCounter, mergeStates, negotiateHandoff, platformCategory, setRegister, signOperation, validatePayloadBudget, verifyOperation };