@xelth/eck-snapshot 5.8.6 → 5.9.0
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/package.json +1 -1
- package/setup.json +64 -60
- package/src/cli/cli.js +23 -3
- package/src/cli/commands/createSnapshot.js +104 -99
- package/src/cli/commands/updateSnapshot.js +7 -0
- package/src/templates/opencode/coder.template.md +8 -1
- package/src/templates/opencode/junior-architect.template.md +29 -46
- package/src/utils/aiHeader.js +18 -18
- package/src/utils/claudeMdGenerator.js +101 -119
- package/src/utils/opencodeAgentsGenerator.js +21 -224
- package/src/utils/telemetry.js +98 -0
- package/src/utils/tokenEstimator.js +42 -0
|
@@ -117,6 +117,48 @@ export async function addTrainingPoint(projectType, fileSizeInBytes, estimatedTo
|
|
|
117
117
|
console.log(` Estimated: ${estimatedTokens} tokens`);
|
|
118
118
|
console.log(` Actual: ${actualTokens} tokens`);
|
|
119
119
|
console.log(` Error: ${Math.abs(actualTokens - estimatedTokens)} tokens (${Math.round(Math.abs(actualTokens - estimatedTokens) / actualTokens * 100)}%)`);
|
|
120
|
+
|
|
121
|
+
// Push training point to Telemetry Hub
|
|
122
|
+
try {
|
|
123
|
+
const res = await fetch('https://xelth.com/T/tokens/train', {
|
|
124
|
+
method: 'POST',
|
|
125
|
+
headers: { 'Content-Type': 'application/json' },
|
|
126
|
+
body: JSON.stringify({
|
|
127
|
+
project_type: projectType,
|
|
128
|
+
file_size_bytes: fileSizeInBytes,
|
|
129
|
+
actual_tokens: actualTokens
|
|
130
|
+
})
|
|
131
|
+
});
|
|
132
|
+
if (res.ok) {
|
|
133
|
+
console.log(' Training point pushed to Telemetry Hub');
|
|
134
|
+
}
|
|
135
|
+
} catch (e) {
|
|
136
|
+
// Fail silently, network might be down
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Fetch global token weights from Telemetry Hub and merge them into local training data
|
|
142
|
+
*/
|
|
143
|
+
export async function syncTokenWeights() {
|
|
144
|
+
try {
|
|
145
|
+
console.log('Fetching global token weights from Telemetry Hub...');
|
|
146
|
+
const res = await fetch('https://xelth.com/T/tokens/weights');
|
|
147
|
+
if (!res.ok) throw new Error(res.statusText);
|
|
148
|
+
const data = await res.json();
|
|
149
|
+
|
|
150
|
+
if (data && data.coefficients && Object.keys(data.coefficients).length > 0) {
|
|
151
|
+
const localData = await loadTrainingData();
|
|
152
|
+
// Global coefficients override local ones
|
|
153
|
+
localData.coefficients = { ...localData.coefficients, ...data.coefficients };
|
|
154
|
+
await saveTrainingData(localData);
|
|
155
|
+
console.log('Global token weights synchronized successfully.');
|
|
156
|
+
} else {
|
|
157
|
+
console.log('No global weights available yet.');
|
|
158
|
+
}
|
|
159
|
+
} catch (e) {
|
|
160
|
+
console.log('Failed to sync token weights: ' + e.message);
|
|
161
|
+
}
|
|
120
162
|
}
|
|
121
163
|
|
|
122
164
|
/**
|