@exulu/backend 5.4.0 → 5.5.1

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.
@@ -464,6 +464,30 @@ async function resolvePythonVenvPath(): Promise<string | undefined> {
464
464
  }
465
465
  }
466
466
 
467
+ /**
468
+ * Re-installs the given skills into an existing session sandbox regardless of
469
+ * the versions already present — the "reload skills" action after a skill was
470
+ * created or updated in the same conversation. Without a sandbox for the
471
+ * session there is nothing to refresh: the next turn builds one from scratch.
472
+ */
473
+ export async function refreshSessionSkills(
474
+ sessionId: string,
475
+ skills: SkillRef[],
476
+ config: ExuluConfig,
477
+ ): Promise<{ refreshed: number; sandbox: boolean }> {
478
+ const cached = sandboxCache.get(sessionId)
479
+ if (!cached) return { refreshed: 0, sandbox: false }
480
+ const skillsDirectory = join(cached.handle.sessionDir, 'skills')
481
+ let refreshed = 0
482
+ for (const skill of skills) {
483
+ await rm(join(skillsDirectory, skill.name), { recursive: true, force: true })
484
+ await downloadSkill(skill, skillsDirectory, config)
485
+ cached.installedSkills.set(skill.id, skill.current_version)
486
+ refreshed++
487
+ }
488
+ return { refreshed, sandbox: true }
489
+ }
490
+
467
491
  export async function createSessionSandbox(
468
492
  sessionId: string,
469
493
  skills: SkillRef[],
package/ee/workers.ts CHANGED
@@ -1731,6 +1731,19 @@ export const processUiMessagesFlow = async ({
1731
1731
  const stream = result.stream.toUIMessageStream({
1732
1732
  messageMetadata: ({ part }) => {
1733
1733
  console.log("[EXULU] part", part.type);
1734
+ // Per-step usage, same as the chat route: the context gate
1735
+ // (contextOccupancy) prefers lastStepInputTokens and falls
1736
+ // back to the summed inputTokens, which counts every step's
1737
+ // full prompt. Without this a 14-step routine turn with a
1738
+ // ~75k-token prompt reported ~1.07M input tokens and the next
1739
+ // step was refused with CONTEXT_COMPACTION_REQUIRED
1740
+ // (ALGI, 2026-10-21). Last write wins across steps.
1741
+ if (part.type === "finish-step") {
1742
+ return {
1743
+ lastStepInputTokens: part.usage.inputTokens,
1744
+ lastStepOutputTokens: part.usage.outputTokens,
1745
+ };
1746
+ }
1734
1747
  if (part.type === "finish") {
1735
1748
  return finishTurnMetadata({ totalUsage: part.totalUsage, startedAt: startTime });
1736
1749
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@exulu/backend",
3
3
  "author": "Qventu B.V.",
4
- "version": "5.4.0",
4
+ "version": "5.5.1",
5
5
  "main": "./dist/index.js",
6
6
  "private": false,
7
7
  "publishConfig": {
@@ -25,6 +25,8 @@
25
25
  "scripts": {
26
26
  "preinstall": "node -e \"if (process.version !== 'v22.18.0') { console.error('❌ Wrong Node.js version. Expected v22.18.0, got ' + process.version); process.exit(1); }\"",
27
27
  "postinstall": "node scripts/postinstall.cjs",
28
+ "generate:bundled-skills": "tsx scripts/generate-bundled-skills.ts",
29
+ "prebuild": "npm run generate:bundled-skills",
28
30
  "build": "tsup",
29
31
  "dev": "npm link && tsup --watch",
30
32
  "prepare": "husky",