@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.
- package/CHANGELOG.md +1 -2
- package/ROADMAP.md +68 -66
- package/dist/{InvisibleWallet-BB6tFvRA.d.cts → InvisibleWallet-EFiuaLn3.d.cts} +1 -1
- package/dist/{OrchestratorAgent-BvWgf9uw.d.cts → OrchestratorAgent-CrLDGNL6.d.cts} +1 -1
- package/dist/agents/index.cjs +11 -10
- package/dist/agents/index.d.cts +4 -16
- package/dist/ai/index.cjs +2 -2
- package/dist/behavior.cjs +10 -0
- package/dist/economy/index.cjs +4 -4
- package/dist/economy/index.d.cts +2 -2
- package/dist/index.cjs +33 -11
- package/dist/index.d.cts +3 -3
- package/dist/swarm/index.cjs +3 -0
- package/package.json +14 -9
- package/src/__tests__/bounty-marketplace.test.ts +53 -21
- package/src/__tests__/delegation.test.ts +1 -4
- package/src/__tests__/done-log-audit.test.ts +38 -46
- package/src/__tests__/framework.test.ts +172 -53
- package/src/__tests__/goal-synthesizer.test.ts +9 -6
- package/src/__tests__/presence.test.ts +1 -1
- package/src/__tests__/protocol-agent.test.ts +12 -11
- package/src/__tests__/revenue-splitter.test.ts +22 -15
- package/src/__tests__/scenario-driven-todo.test.ts +55 -35
- package/src/__tests__/self-improve.test.ts +28 -9
- package/src/__tests__/service-lifecycle.test.ts +9 -3
- package/src/__tests__/skill-router.test.ts +3 -3
- package/src/agents/CulturalMemory.ts +6 -6
- package/src/agents/DelegationTraceHooks.ts +560 -0
- package/src/agents/FederatedRegistryAdapter.ts +1 -1
- package/src/agents/NormEngine.ts +3 -8
- package/src/agents/OrchestratorAgent.ts +1 -1
- package/src/agents/TaskDelegationService.ts +5 -9
- package/src/agents/__tests__/AgentWalletRegistry.test.ts +5 -4
- package/src/agents/__tests__/CrossRealityHandoff.test.ts +9 -3
- package/src/agents/__tests__/DelegationTraceHooks.test.ts +390 -0
- package/src/agents/__tests__/TaskDelegationService.test.ts +4 -2
- package/src/agents/spatial-comms/Layer1RealTime.ts +36 -19
- package/src/agents/spatial-comms/Layer2A2A.ts +1 -3
- package/src/agents/spatial-comms/Layer3MCP.ts +13 -4
- package/src/agents/spatial-comms/ProtocolTypes.ts +5 -2
- package/src/agents/spatial-comms/examples/multi-agent-world-creation.ts +2 -2
- package/src/ai/HoloScriptGenerator.ts +2 -2
- package/src/ai/__tests__/PerceptionSystem.prod.test.ts +1 -1
- package/src/ai/__tests__/PerceptionSystem.test.ts +14 -14
- package/src/ai/__tests__/SteeringBehaviors.prod.test.ts +1 -1
- package/src/ai/index.ts +5 -1
- package/src/board/audit.ts +17 -6
- package/src/board/board-ops.ts +45 -15
- package/src/board/board-types.ts +94 -20
- package/src/delegation.ts +5 -3
- package/src/distributed-claimer.ts +13 -2
- package/src/economy/BountyManager.ts +40 -18
- package/src/economy/KnowledgeMarketplace.ts +27 -8
- package/src/economy/PaymentWebhookService.ts +0 -1
- package/src/economy/RevenueSplitter.ts +2 -4
- package/src/economy/UnifiedBudgetOptimizer.ts +8 -9
- package/src/economy/_core-stubs.ts +1 -1
- package/src/economy/x402-facilitator.ts +17 -8
- package/src/index.ts +16 -12
- package/src/knowledge/__tests__/knowledge-consolidator.test.ts +138 -89
- package/src/knowledge/__tests__/knowledge-store-vector.test.ts +59 -16
- package/src/knowledge/brain.ts +7 -7
- package/src/knowledge/consolidation.ts +16 -16
- package/src/knowledge/knowledge-consolidator.ts +60 -30
- package/src/knowledge/knowledge-store.ts +83 -45
- package/src/learning/ProceduralCompiler.ts +6 -1
- package/src/learning/learning/MemoryConsolidator.ts +102 -0
- package/src/learning/learning/MemoryScorer.ts +69 -0
- package/src/learning/learning/ProceduralCompiler.ts +45 -0
- package/src/learning/learning/SemanticClusterer.ts +66 -0
- package/src/llm/llm-adapter.ts +24 -10
- package/src/mesh/index.ts +37 -17
- package/src/protocol/goal-synthesizer.ts +24 -34
- package/src/protocol/implementations.ts +91 -22
- package/src/protocol/micro-phase-decomposer.ts +25 -17
- package/src/protocol/micro-step-decomposer.test.ts +104 -39
- package/src/protocol-agent.test.ts +17 -7
- package/src/protocol-agent.ts +45 -42
- package/src/self-improve/absorb-scanner.ts +9 -6
- package/src/self-improve/evolution-engine.ts +36 -18
- package/src/self-improve/framework-absorber.ts +21 -16
- package/src/self-improve/index.ts +2 -10
- package/src/self-improve/prompt-optimizer.ts +31 -19
- package/src/self-improve/test-generator.ts +16 -12
- package/src/skill-router.ts +7 -6
- package/src/swarm/messaging/GossipProtocol.ts +1 -1
- package/src/swarm/messaging/__tests__/BroadcastChannel.prod.test.ts +31 -9
- package/src/swarm/messaging/__tests__/GossipProtocol.prod.test.ts +21 -7
- package/src/swarm/messaging/__tests__/SwarmEventBus.prod.test.ts +24 -8
- package/src/swarm/messaging/__tests__/SwarmEventBus.test.ts +6 -2
- package/src/team.ts +277 -122
- package/src/training/scripts/generate-spatial-dataset.ts +1 -1
- package/src/training/training/LRScheduler.ts +377 -0
- package/src/training/training/QualityScoringPipeline.ts +139 -0
- package/src/training/training/SoftDedup.ts +461 -0
- package/src/training/training/SparsityMonitor.ts +685 -0
- package/src/training/training/SparsityMonitorTypes.ts +209 -0
- package/src/training/training/SpatialTrainingDataGenerator.ts +1526 -0
- package/src/training/training/SpatialTrainingDataTypes.ts +216 -0
- package/src/training/training/TrainingPipelineConfig.ts +215 -0
- package/src/training/training/__tests__/CorpusValidation.test.ts +87 -0
- package/src/training/training/__tests__/LRScheduler.test.ts +592 -0
- package/src/training/training/__tests__/SoftDedup.test.ts +415 -0
- package/src/training/training/__tests__/SparsityMonitor.test.ts +1623 -0
- package/src/training/training/__tests__/SpatialCorpusValidation.test.ts +72 -0
- package/src/training/training/__tests__/SpatialTrainingDataGenerator.test.ts +1244 -0
- package/src/training/training/__tests__/TrainingMonkeyIntegration.test.ts +897 -0
- package/src/training/training/__tests__/TrainingPipelineConfig.test.ts +202 -0
- package/src/training/training/__tests__/schema.test.ts +72 -0
- package/src/training/training/__tests__/training-constants.test.ts +106 -0
- package/src/training/training/__tests__/trait-mappings.test.ts +81 -0
- package/src/training/training/constants.ts +94 -0
- package/src/training/training/index.ts +17 -0
- package/src/training/training/schema.ts +147 -0
- package/src/training/training/scripts/generate-novel-use-cases-dataset.ts +272 -0
- package/src/training/training/scripts/generate-spatial-dataset.ts +521 -0
- package/src/training/training/trainingmonkey/TrainingMonkeyIntegration.ts +477 -0
- package/src/training/training/trainingmonkey/TrainingMonkeyTypes.ts +230 -0
- package/src/training/training/trainingmonkey/index.ts +26 -0
- package/src/training/training/trait-mappings.ts +157 -0
- package/src/types.ts +2 -7
- package/ALL-test-results.json +0 -1
- package/LICENSE +0 -21
- package/dist/AgentManifest-CB4xM-Ma.d.ts +0 -704
- package/dist/BehaviorTree-BrBFECv5.d.ts +0 -103
- package/dist/InvisibleWallet-rtRrBOA8.d.ts +0 -1732
- package/dist/OrchestratorAgent-Q_CbVTmO.d.ts +0 -798
- package/dist/agents/index.d.ts +0 -1788
- package/dist/agents/index.js +0 -4695
- package/dist/ai/index.d.ts +0 -1753
- package/dist/ai/index.js +0 -5244
- package/dist/behavior.d.ts +0 -130
- package/dist/behavior.js +0 -407
- package/dist/economy/index.d.ts +0 -747
- package/dist/economy/index.js +0 -3617
- package/dist/implementations-D9T3un9D.d.ts +0 -236
- package/dist/index.d.ts +0 -1729
- package/dist/index.js +0 -24277
- package/dist/learning/index.d.ts +0 -104
- package/dist/learning/index.js +0 -189
- package/dist/negotiation/index.d.ts +0 -610
- package/dist/negotiation/index.js +0 -931
- package/dist/skills/index.d.ts +0 -289
- package/dist/skills/index.js +0 -1079
- package/dist/swarm/index.d.ts +0 -2433
- package/dist/swarm/index.js +0 -5221
- package/dist/training/index.d.ts +0 -1734
- package/dist/training/index.js +0 -2687
- package/extract-failures.js +0 -10
- package/src/training/training/data/novel-use-cases.jsonl +0 -153
- package/src/training/training/data/spatial-reasoning-10k.jsonl +0 -9354
- package/src/types/core-stubs.d.ts +0 -113
- package/test-output.txt +0 -0
- package/test-result.json +0 -1
- package/tsc-errors.txt +0 -4
- package/tsc_output.txt +0 -0
- package/typescript-errors-2.txt +0 -0
- package/typescript-errors.txt +0 -22
- package/vitest-log-utf8.txt +0 -268
- package/vitest-log.txt +0 -0
|
@@ -75,12 +75,7 @@ export class BountyManager {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/** Create a bounty for a board task. */
|
|
78
|
-
createBounty(
|
|
79
|
-
taskId: string,
|
|
80
|
-
reward: BountyReward,
|
|
81
|
-
createdBy: string,
|
|
82
|
-
deadline?: number,
|
|
83
|
-
): Bounty {
|
|
78
|
+
createBounty(taskId: string, reward: BountyReward, createdBy: string, deadline?: number): Bounty {
|
|
84
79
|
if (reward.amount <= 0) throw new Error('Bounty reward must be positive');
|
|
85
80
|
|
|
86
81
|
const id = `bounty_${String(this.nextId++).padStart(4, '0')}`;
|
|
@@ -93,9 +88,9 @@ export class BountyManager {
|
|
|
93
88
|
status: 'open',
|
|
94
89
|
createdBy,
|
|
95
90
|
createdAt: new Date().toISOString(),
|
|
96
|
-
deadline:
|
|
97
|
-
|
|
98
|
-
: undefined),
|
|
91
|
+
deadline:
|
|
92
|
+
deadline ??
|
|
93
|
+
(this.config.defaultDeadlineMs ? now + this.config.defaultDeadlineMs : undefined),
|
|
99
94
|
};
|
|
100
95
|
|
|
101
96
|
this.bounties.set(id, bounty);
|
|
@@ -106,7 +101,8 @@ export class BountyManager {
|
|
|
106
101
|
claimBounty(bountyId: string, agentId: string): ClaimResult {
|
|
107
102
|
const bounty = this.bounties.get(bountyId);
|
|
108
103
|
if (!bounty) return { success: false, bountyId, error: 'Bounty not found' };
|
|
109
|
-
if (bounty.status !== 'open')
|
|
104
|
+
if (bounty.status !== 'open')
|
|
105
|
+
return { success: false, bountyId, error: `Bounty is ${bounty.status}, not open` };
|
|
110
106
|
|
|
111
107
|
// Check deadline
|
|
112
108
|
if (bounty.deadline && Date.now() > bounty.deadline) {
|
|
@@ -122,11 +118,34 @@ export class BountyManager {
|
|
|
122
118
|
/** Complete a bounty with proof of work and trigger payout. */
|
|
123
119
|
completeBounty(bountyId: string, proof: CompletionProof): PayoutResult {
|
|
124
120
|
const bounty = this.bounties.get(bountyId);
|
|
125
|
-
if (!bounty)
|
|
126
|
-
|
|
121
|
+
if (!bounty)
|
|
122
|
+
return {
|
|
123
|
+
success: false,
|
|
124
|
+
bountyId,
|
|
125
|
+
amount: 0,
|
|
126
|
+
currency: 'credits',
|
|
127
|
+
settlement: 'ledger',
|
|
128
|
+
error: 'Bounty not found',
|
|
129
|
+
};
|
|
130
|
+
if (bounty.status !== 'claimed')
|
|
131
|
+
return {
|
|
132
|
+
success: false,
|
|
133
|
+
bountyId,
|
|
134
|
+
amount: 0,
|
|
135
|
+
currency: bounty.reward.currency,
|
|
136
|
+
settlement: 'ledger',
|
|
137
|
+
error: `Bounty is ${bounty.status}, not claimed`,
|
|
138
|
+
};
|
|
127
139
|
|
|
128
140
|
if (!proof.summary || proof.summary.trim().length === 0) {
|
|
129
|
-
return {
|
|
141
|
+
return {
|
|
142
|
+
success: false,
|
|
143
|
+
bountyId,
|
|
144
|
+
amount: 0,
|
|
145
|
+
currency: bounty.reward.currency,
|
|
146
|
+
settlement: 'ledger',
|
|
147
|
+
error: 'Completion proof requires a summary',
|
|
148
|
+
};
|
|
130
149
|
}
|
|
131
150
|
|
|
132
151
|
bounty.status = 'completed';
|
|
@@ -134,8 +153,11 @@ export class BountyManager {
|
|
|
134
153
|
|
|
135
154
|
// Determine settlement method
|
|
136
155
|
const settlement: 'ledger' | 'on_chain' =
|
|
137
|
-
bounty.reward.currency === 'credits'
|
|
138
|
-
|
|
156
|
+
bounty.reward.currency === 'credits'
|
|
157
|
+
? 'ledger'
|
|
158
|
+
: bounty.reward.amount < 0.1
|
|
159
|
+
? 'ledger'
|
|
160
|
+
: 'on_chain';
|
|
139
161
|
|
|
140
162
|
return {
|
|
141
163
|
success: true,
|
|
@@ -155,12 +177,12 @@ export class BountyManager {
|
|
|
155
177
|
list(status?: BountyStatus): Bounty[] {
|
|
156
178
|
const all = Array.from(this.bounties.values());
|
|
157
179
|
if (!status) return all;
|
|
158
|
-
return all.filter(b => b.status === status);
|
|
180
|
+
return all.filter((b) => b.status === status);
|
|
159
181
|
}
|
|
160
182
|
|
|
161
183
|
/** List bounties for a specific task. */
|
|
162
184
|
byTask(taskId: string): Bounty[] {
|
|
163
|
-
return Array.from(this.bounties.values()).filter(b => b.taskId === taskId);
|
|
185
|
+
return Array.from(this.bounties.values()).filter((b) => b.taskId === taskId);
|
|
164
186
|
}
|
|
165
187
|
|
|
166
188
|
/** Expire bounties past their deadline. Returns count expired. */
|
|
@@ -179,7 +201,7 @@ export class BountyManager {
|
|
|
179
201
|
/** Total open bounty value in a given currency. */
|
|
180
202
|
totalOpen(currency?: BountyCurrency): number {
|
|
181
203
|
return this.list('open')
|
|
182
|
-
.filter(b => !currency || b.reward.currency === currency)
|
|
204
|
+
.filter((b) => !currency || b.reward.currency === currency)
|
|
183
205
|
.reduce((sum, b) => sum + b.reward.amount, 0);
|
|
184
206
|
}
|
|
185
207
|
}
|
|
@@ -80,12 +80,12 @@ export class KnowledgeMarketplace {
|
|
|
80
80
|
|
|
81
81
|
// Confidence boost
|
|
82
82
|
if (entry.confidence >= 0.8) {
|
|
83
|
-
price *=
|
|
83
|
+
price *= this.pricingFactors.confidenceMultiplier ?? 1.5;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
// Reuse boost — popular entries are worth more
|
|
87
87
|
if (entry.reuseCount >= 5) {
|
|
88
|
-
price *=
|
|
88
|
+
price *= this.pricingFactors.reuseMultiplier ?? 2.0;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// Query frequency boost
|
|
@@ -98,7 +98,12 @@ export class KnowledgeMarketplace {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/** List a knowledge entry for sale. */
|
|
101
|
-
sellKnowledge(
|
|
101
|
+
sellKnowledge(
|
|
102
|
+
entry: StoredEntry,
|
|
103
|
+
price: number,
|
|
104
|
+
seller: string,
|
|
105
|
+
currency: 'USDC' | 'credits' = 'USDC'
|
|
106
|
+
): ListingResult {
|
|
102
107
|
if (price <= 0) return { success: false, listingId: '', error: 'Price must be positive' };
|
|
103
108
|
|
|
104
109
|
// Prevent duplicate listings for same entry
|
|
@@ -133,8 +138,22 @@ export class KnowledgeMarketplace {
|
|
|
133
138
|
buyKnowledge(listingId: string, buyer: string): PurchaseResult {
|
|
134
139
|
const listing = this.listings.get(listingId);
|
|
135
140
|
if (!listing) return { success: false, listingId, buyer, price: 0, error: 'Listing not found' };
|
|
136
|
-
if (listing.status !== 'active')
|
|
137
|
-
|
|
141
|
+
if (listing.status !== 'active')
|
|
142
|
+
return {
|
|
143
|
+
success: false,
|
|
144
|
+
listingId,
|
|
145
|
+
buyer,
|
|
146
|
+
price: listing.price,
|
|
147
|
+
error: `Listing is ${listing.status}`,
|
|
148
|
+
};
|
|
149
|
+
if (listing.seller === buyer)
|
|
150
|
+
return {
|
|
151
|
+
success: false,
|
|
152
|
+
listingId,
|
|
153
|
+
buyer,
|
|
154
|
+
price: listing.price,
|
|
155
|
+
error: 'Cannot buy your own listing',
|
|
156
|
+
};
|
|
138
157
|
|
|
139
158
|
listing.status = 'sold';
|
|
140
159
|
|
|
@@ -161,7 +180,7 @@ export class KnowledgeMarketplace {
|
|
|
161
180
|
|
|
162
181
|
/** List all active listings. */
|
|
163
182
|
activeListings(): KnowledgeListing[] {
|
|
164
|
-
return Array.from(this.listings.values()).filter(l => l.status === 'active');
|
|
183
|
+
return Array.from(this.listings.values()).filter((l) => l.status === 'active');
|
|
165
184
|
}
|
|
166
185
|
|
|
167
186
|
/** Get purchase history for a buyer. */
|
|
@@ -180,14 +199,14 @@ export class KnowledgeMarketplace {
|
|
|
180
199
|
/** Total revenue for a seller across all sold listings. */
|
|
181
200
|
sellerRevenue(seller: string): number {
|
|
182
201
|
return Array.from(this.listings.values())
|
|
183
|
-
.filter(l => l.seller === seller && l.status === 'sold')
|
|
202
|
+
.filter((l) => l.seller === seller && l.status === 'sold')
|
|
184
203
|
.reduce((sum, l) => sum + l.price, 0);
|
|
185
204
|
}
|
|
186
205
|
|
|
187
206
|
/** Total marketplace volume (all completed sales). */
|
|
188
207
|
totalVolume(): number {
|
|
189
208
|
return Array.from(this.listings.values())
|
|
190
|
-
.filter(l => l.status === 'sold')
|
|
209
|
+
.filter((l) => l.status === 'sold')
|
|
191
210
|
.reduce((sum, l) => sum + l.price, 0);
|
|
192
211
|
}
|
|
193
212
|
}
|
|
@@ -132,7 +132,6 @@ interface RetryEntry {
|
|
|
132
132
|
function computeHmac(payload: string, secret: string): string {
|
|
133
133
|
// Use dynamic import pattern to work in both Node and test environments
|
|
134
134
|
try {
|
|
135
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
136
135
|
const crypto = require('crypto');
|
|
137
136
|
return crypto.createHmac('sha256', secret).update(payload).digest('hex');
|
|
138
137
|
} catch {
|
|
@@ -66,9 +66,7 @@ export class RevenueSplitter {
|
|
|
66
66
|
|
|
67
67
|
const sum = recipients.reduce((acc, r) => acc + r.basisPoints, 0);
|
|
68
68
|
if (sum !== TOTAL_BASIS_POINTS) {
|
|
69
|
-
throw new Error(
|
|
70
|
-
`Basis points must sum to ${TOTAL_BASIS_POINTS} (got ${sum})`
|
|
71
|
-
);
|
|
69
|
+
throw new Error(`Basis points must sum to ${TOTAL_BASIS_POINTS} (got ${sum})`);
|
|
72
70
|
}
|
|
73
71
|
|
|
74
72
|
for (const r of recipients) {
|
|
@@ -78,7 +76,7 @@ export class RevenueSplitter {
|
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
// Check for duplicate IDs
|
|
81
|
-
const ids = new Set(recipients.map(r => r.id));
|
|
79
|
+
const ids = new Set(recipients.map((r) => r.id));
|
|
82
80
|
if (ids.size !== recipients.length) {
|
|
83
81
|
throw new Error('Duplicate recipient IDs');
|
|
84
82
|
}
|
|
@@ -228,11 +228,11 @@ export const DEFAULT_TRAIT_UTILITIES: Record<string, Omit<TraitUtility, 'trait'>
|
|
|
228
228
|
* Powerful platforms (desktop-vr) degrade slowly, preserving quality.
|
|
229
229
|
*/
|
|
230
230
|
export const PLATFORM_LOD_SCALING: Record<string, number[]> = {
|
|
231
|
-
|
|
232
|
-
'mobile-ar':
|
|
233
|
-
|
|
234
|
-
'desktop-vr': [1.0, 0.85, 0.6, 0.3, 0.1],
|
|
235
|
-
|
|
231
|
+
quest3: [1.0, 0.6, 0.3, 0.12, 0.04], // Aggressive — tight budget
|
|
232
|
+
'mobile-ar': [1.0, 0.5, 0.2, 0.08, 0.02], // Most aggressive — tightest budget
|
|
233
|
+
webgpu: [1.0, 0.7, 0.4, 0.18, 0.06], // Moderate — matches default
|
|
234
|
+
'desktop-vr': [1.0, 0.85, 0.6, 0.3, 0.1], // Gentle — plenty of headroom
|
|
235
|
+
visionos: [1.0, 0.8, 0.5, 0.25, 0.08], // Moderate-gentle — good hardware
|
|
236
236
|
};
|
|
237
237
|
|
|
238
238
|
/**
|
|
@@ -282,9 +282,8 @@ export class UnifiedBudgetOptimizer {
|
|
|
282
282
|
this.platform = config.platform;
|
|
283
283
|
this.costFloor = config.costFloor;
|
|
284
284
|
// Use platform-specific LOD scaling if available, fall back to default perceptual curve
|
|
285
|
-
this.lodScaling =
|
|
286
|
-
?? PLATFORM_LOD_SCALING[config.platform]
|
|
287
|
-
?? DEFAULT_LOD_SCALING;
|
|
285
|
+
this.lodScaling =
|
|
286
|
+
config.lodScaling ?? PLATFORM_LOD_SCALING[config.platform] ?? DEFAULT_LOD_SCALING;
|
|
288
287
|
this.economicBudget = config.economicBudget ?? 0;
|
|
289
288
|
this.economicSpent = config.economicSpent ?? 0;
|
|
290
289
|
|
|
@@ -321,7 +320,7 @@ export class UnifiedBudgetOptimizer {
|
|
|
321
320
|
}
|
|
322
321
|
|
|
323
322
|
// Start with everything at LOD 0
|
|
324
|
-
|
|
323
|
+
const allocations = this.flattenToAllocations(nodes, 0);
|
|
325
324
|
|
|
326
325
|
// Check if we're within budget
|
|
327
326
|
let pressure = this.computeResourcePressure(allocations, limits);
|
|
@@ -17,7 +17,7 @@ export interface TelemetryCollector {
|
|
|
17
17
|
type: string,
|
|
18
18
|
agentId: string,
|
|
19
19
|
data?: Record<string, unknown>,
|
|
20
|
-
severity?: string
|
|
20
|
+
severity?: string
|
|
21
21
|
): unknown;
|
|
22
22
|
recordError(agentId: string, error: Error, context?: Record<string, unknown>): unknown;
|
|
23
23
|
startSpan(name: string, options?: Record<string, unknown>): unknown;
|
|
@@ -805,7 +805,7 @@ export class X402Facilitator {
|
|
|
805
805
|
}
|
|
806
806
|
|
|
807
807
|
let settled = 0;
|
|
808
|
-
|
|
808
|
+
const failed = 0;
|
|
809
809
|
let totalVolume = 0;
|
|
810
810
|
|
|
811
811
|
for (const [_payer, entries] of byPayer) {
|
|
@@ -1039,7 +1039,12 @@ export const creditTraitHandler: TraitHandler<CreditTraitConfig> = {
|
|
|
1039
1039
|
delete node.__creditState;
|
|
1040
1040
|
},
|
|
1041
1041
|
|
|
1042
|
-
onUpdate(
|
|
1042
|
+
onUpdate(
|
|
1043
|
+
node: HSPlusNode,
|
|
1044
|
+
_config: CreditTraitConfig,
|
|
1045
|
+
context: TraitContext,
|
|
1046
|
+
_delta: number
|
|
1047
|
+
): void {
|
|
1043
1048
|
const state = node.__creditState as CreditTraitState | undefined;
|
|
1044
1049
|
if (!state) return;
|
|
1045
1050
|
|
|
@@ -1053,7 +1058,12 @@ export const creditTraitHandler: TraitHandler<CreditTraitConfig> = {
|
|
|
1053
1058
|
}
|
|
1054
1059
|
},
|
|
1055
1060
|
|
|
1056
|
-
onEvent(
|
|
1061
|
+
onEvent(
|
|
1062
|
+
node: HSPlusNode,
|
|
1063
|
+
config: CreditTraitConfig,
|
|
1064
|
+
context: TraitContext,
|
|
1065
|
+
event: TraitEvent
|
|
1066
|
+
): void {
|
|
1057
1067
|
const state = node.__creditState as CreditTraitState | undefined;
|
|
1058
1068
|
if (!state) return;
|
|
1059
1069
|
|
|
@@ -1685,11 +1695,11 @@ export class PaymentGateway {
|
|
|
1685
1695
|
|
|
1686
1696
|
// Check if the original was a micro-payment by looking in the ledger
|
|
1687
1697
|
const ledger = this.facilitator.getLedger();
|
|
1688
|
-
const
|
|
1698
|
+
const _allEntries = ledger.getEntriesForPayer(''); // We need to search all entries
|
|
1689
1699
|
|
|
1690
1700
|
// Try to find the original ledger entry by checking if transaction matches
|
|
1691
|
-
let
|
|
1692
|
-
const
|
|
1701
|
+
let _originalEntry: LedgerEntry | undefined;
|
|
1702
|
+
const _ledgerStats = ledger.getStats();
|
|
1693
1703
|
|
|
1694
1704
|
// For micro-payments, the transaction ID starts with "micro_"
|
|
1695
1705
|
// For on-chain, we check the settlement results
|
|
@@ -1698,7 +1708,7 @@ export class PaymentGateway {
|
|
|
1698
1708
|
|
|
1699
1709
|
if (settlement.mode === 'in_memory' && settlement.transaction) {
|
|
1700
1710
|
// It was a micro-payment -- record a reverse entry
|
|
1701
|
-
const
|
|
1711
|
+
const _refundAmount =
|
|
1702
1712
|
(partialAmount ?? settlement.transaction)
|
|
1703
1713
|
? '0' // We'll try to find the amount from the ledger
|
|
1704
1714
|
: '0';
|
|
@@ -1975,4 +1985,3 @@ export class PaymentGateway {
|
|
|
1975
1985
|
this.eventCounter = 0;
|
|
1976
1986
|
}
|
|
1977
1987
|
}
|
|
1978
|
-
|
package/src/index.ts
CHANGED
|
@@ -132,12 +132,7 @@ export type {
|
|
|
132
132
|
ServiceConfig,
|
|
133
133
|
} from './types';
|
|
134
134
|
|
|
135
|
-
export {
|
|
136
|
-
ProtocolPhase,
|
|
137
|
-
isPattern,
|
|
138
|
-
isWisdom,
|
|
139
|
-
isGotcha,
|
|
140
|
-
} from './types';
|
|
135
|
+
export { ProtocolPhase, isPattern, isWisdom, isGotcha } from './types';
|
|
141
136
|
|
|
142
137
|
// Protocol agent (7-phase lifecycle backed by LLM)
|
|
143
138
|
export {
|
|
@@ -168,10 +163,7 @@ export type { GoalContext, SynthesizedGoal } from './protocol/goal-synthesizer';
|
|
|
168
163
|
export { GENERIC_GOALS, DOMAIN_GOALS } from './protocol/goal-synthesizer';
|
|
169
164
|
|
|
170
165
|
// Smart micro-phase decomposer (FW-0.2 — LLM-powered parallel task decomposition)
|
|
171
|
-
export {
|
|
172
|
-
SmartMicroPhaseDecomposer,
|
|
173
|
-
createLLMAdapter,
|
|
174
|
-
} from './protocol/micro-phase-decomposer';
|
|
166
|
+
export { SmartMicroPhaseDecomposer, createLLMAdapter } from './protocol/micro-phase-decomposer';
|
|
175
167
|
export type {
|
|
176
168
|
TaskDescription,
|
|
177
169
|
MicroPhase,
|
|
@@ -273,7 +265,11 @@ export {
|
|
|
273
265
|
|
|
274
266
|
// Distributed claiming (FW-0.6)
|
|
275
267
|
export { DistributedClaimer } from './distributed-claimer';
|
|
276
|
-
export type {
|
|
268
|
+
export type {
|
|
269
|
+
ClaimResult as DistributedClaimResult,
|
|
270
|
+
ClaimRecord,
|
|
271
|
+
DistributedClaimerConfig,
|
|
272
|
+
} from './distributed-claimer';
|
|
277
273
|
|
|
278
274
|
// Skill-based routing (FW-0.6)
|
|
279
275
|
export { SkillRouter } from './skill-router';
|
|
@@ -281,7 +277,12 @@ export type { RoutingResult, ScoredCandidate, RoutingPolicy } from './skill-rout
|
|
|
281
277
|
|
|
282
278
|
// Cross-team delegation (FW-0.6)
|
|
283
279
|
export { DelegationManager, InProcessBoardAdapter } from './delegation';
|
|
284
|
-
export type {
|
|
280
|
+
export type {
|
|
281
|
+
DelegationResult,
|
|
282
|
+
DelegationRecord,
|
|
283
|
+
DelegationPolicy,
|
|
284
|
+
TeamBoardAdapter,
|
|
285
|
+
} from './delegation';
|
|
285
286
|
|
|
286
287
|
// Bounty types (FW-0.6)
|
|
287
288
|
export type {
|
|
@@ -346,3 +347,6 @@ export * from './learning';
|
|
|
346
347
|
|
|
347
348
|
// Resolve ambiguous exports between swarm and negotiation
|
|
348
349
|
export type { Vote, VotingResult } from './negotiation';
|
|
350
|
+
|
|
351
|
+
export * from './training/index.js';
|
|
352
|
+
export * from './learning/index.js';
|