sra-skills 0.14.2 → 0.14.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/lib.mjs +5 -1
- package/manage.mjs +8 -3
- package/package.json +1 -1
package/lib.mjs
CHANGED
|
@@ -198,8 +198,12 @@ export function reportEvent(eventName, repoPath, tools) {
|
|
|
198
198
|
if (!user && h.startsWith('coder-')) user = h.split('-')[1];
|
|
199
199
|
if (!user) user = userInfo().username || 'unknown';
|
|
200
200
|
|
|
201
|
-
|
|
201
|
+
let tsBase = Math.floor(Date.now() / 1000);
|
|
202
|
+
let tsSeq = 0;
|
|
202
203
|
for (const r of records) {
|
|
204
|
+
// Each record needs a unique nanosecond timestamp so Loki doesn't
|
|
205
|
+
// deduplicate entries that share the same stream labels.
|
|
206
|
+
const ts = `${tsBase}${String(tsSeq++).padStart(9, '0')}`;
|
|
203
207
|
try {
|
|
204
208
|
const body = JSON.stringify({ resourceLogs: [{ resource: { attributes: [
|
|
205
209
|
{ key: 'service.name', value: { stringValue: 'sra-toolkit-installer' } },
|
package/manage.mjs
CHANGED
|
@@ -111,6 +111,7 @@ export async function main() {
|
|
|
111
111
|
const skillsCache = new Map(); // repo name → discovered skills array
|
|
112
112
|
// track last rendered repo+search to preserve selection across re-renders
|
|
113
113
|
let lastSkillPanelKey = null;
|
|
114
|
+
let renderingRepos = false; // guard: suppress repo 'select item' side-effects during renderRepos
|
|
114
115
|
|
|
115
116
|
function getCachedSkills(repoPath, repoName) {
|
|
116
117
|
if (skillsCache.has(repoName)) return skillsCache.get(repoName);
|
|
@@ -152,11 +153,14 @@ export async function main() {
|
|
|
152
153
|
const enabled = (repo.skills || []).length;
|
|
153
154
|
return `${name} (${enabled}/${all.length})`;
|
|
154
155
|
});
|
|
155
|
-
//
|
|
156
|
-
//
|
|
156
|
+
// setItems resets blessed's selection to 0 and fires 'select item',
|
|
157
|
+
// which would clobber currentRepoName and pollute lastSkillPanelKey.
|
|
158
|
+
// Guard with renderingRepos to suppress event handler side-effects.
|
|
157
159
|
const prevIdx = currentRepoName ? names.indexOf(currentRepoName) : 0;
|
|
160
|
+
renderingRepos = true;
|
|
158
161
|
reposPanel.setItems(items);
|
|
159
162
|
if (prevIdx >= 0) reposPanel.select(prevIdx);
|
|
163
|
+
renderingRepos = false;
|
|
160
164
|
}
|
|
161
165
|
|
|
162
166
|
function renderSkills() {
|
|
@@ -451,8 +455,9 @@ export async function main() {
|
|
|
451
455
|
screen.render();
|
|
452
456
|
});
|
|
453
457
|
|
|
454
|
-
// Update skills when repo selection changes
|
|
458
|
+
// Update skills when repo selection changes (skip during programmatic renderRepos)
|
|
455
459
|
reposPanel.on('select item', (item, idx) => {
|
|
460
|
+
if (renderingRepos) return;
|
|
456
461
|
const names = Object.keys(manifest.repos);
|
|
457
462
|
currentRepoName = names[idx] || null;
|
|
458
463
|
searchQuery = '';
|