osborn 0.9.264 → 0.9.265

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.
@@ -290,17 +290,6 @@ export declare class ClaudeLLM extends llm.LLM {
290
290
  noteTaskDispatch(toolUseId: string | undefined, subagentType: string | undefined): void;
291
291
  /** SubagentStart claim: pair this agent_id with the oldest unclaimed dispatch of its type. */
292
292
  claimTaskDispatch(agentId: string | undefined, subagentType: string | undefined): void;
293
- /**
294
- * Bounded-leak fix (0.9.264): drop a finished agent's pairing entries at
295
- * SubagentStop. BOTH maps must go together — #resolveTaskId deliberately
296
- * returns null when a pairing exists for an ended task (so a stale stop-click
297
- * can never retarget a DIFFERENT live agent of the same type); with both
298
- * entries deleted the resolve is null just the same, so behavior is unchanged
299
- * while the maps stay bounded (they previously grew one entry per sub-agent
300
- * for the life of the session, 200+ in heavy use). #dispatchedFor is NOT
301
- * cleared here: it IS the double-fire dedup for the SubagentStop hook itself.
302
- */
303
- releaseAgentTracking(agentId: string | undefined): void;
304
293
  /** Background consumer feed: track SDK task lifecycle messages. */
305
294
  trackTaskMessage(msg: any): void;
306
295
  /** Live background tasks (for truthful status/UX). */
@@ -1411,14 +1411,6 @@ export class ClaudeLLM extends llm.LLM {
1411
1411
  captureCheckpoint(checkpointId) {
1412
1412
  this.#checkpoints.push(checkpointId);
1413
1413
  this.#latestCheckpoint = checkpointId;
1414
- // Bounded-leak fix (0.9.264): a checkpoint lands on EVERY user-type SDK
1415
- // message (tool results included) — thousands over a long session, never
1416
- // pruned. Rewind only ever consumes the FIRST (getFirstCheckpoint →
1417
- // session start) and the LATEST (#latestCheckpoint, kept separately), so
1418
- // retain [0] + the most recent 500 and drop the middle.
1419
- if (this.#checkpoints.length > 600) {
1420
- this.#checkpoints.splice(1, this.#checkpoints.length - 501);
1421
- }
1422
1414
  console.log(`📍 Checkpoint captured: ${checkpointId.substring(0, 8)}...`);
1423
1415
  this.#eventEmitter.emit('checkpoint_captured', { checkpointId });
1424
1416
  }
@@ -1678,22 +1670,6 @@ export class ClaudeLLM extends llm.LLM {
1678
1670
  this.#toolUseByAgentId.set(agentId, toolUse);
1679
1671
  }
1680
1672
  }
1681
- /**
1682
- * Bounded-leak fix (0.9.264): drop a finished agent's pairing entries at
1683
- * SubagentStop. BOTH maps must go together — #resolveTaskId deliberately
1684
- * returns null when a pairing exists for an ended task (so a stale stop-click
1685
- * can never retarget a DIFFERENT live agent of the same type); with both
1686
- * entries deleted the resolve is null just the same, so behavior is unchanged
1687
- * while the maps stay bounded (they previously grew one entry per sub-agent
1688
- * for the life of the session, 200+ in heavy use). #dispatchedFor is NOT
1689
- * cleared here: it IS the double-fire dedup for the SubagentStop hook itself.
1690
- */
1691
- releaseAgentTracking(agentId) {
1692
- if (!agentId)
1693
- return;
1694
- this.#toolUseByAgentId.delete(agentId);
1695
- this.#typeByAgentId.delete(agentId);
1696
- }
1697
1673
  /** Background consumer feed: track SDK task lifecycle messages. */
1698
1674
  trackTaskMessage(msg) {
1699
1675
  if (msg?.type !== 'system')
@@ -2795,10 +2771,6 @@ class ClaudeLLMStream extends llm.LLMStream {
2795
2771
  console.warn('Pattern#1 chain push failed:', e);
2796
2772
  }
2797
2773
  }
2798
- // Bounded-leak fix (0.9.264): the agent is done — release its
2799
- // pairing entries (after the chain logic above has run).
2800
- if (input?.agent_id)
2801
- this.#llmRef.releaseAgentTracking(input.agent_id);
2802
2774
  return {};
2803
2775
  }]
2804
2776
  }],
package/dist/config.js CHANGED
@@ -1212,8 +1212,15 @@ function scanDirForArtifacts(dir) {
1212
1212
  scan(fullPath);
1213
1213
  }
1214
1214
  else {
1215
- // Skip internal index files
1216
- if (entry.startsWith('search-index'))
1215
+ // Skip internal index files, hidden files, and the session
1216
+ // transcript / recall store (JSONL + sqlite .db/-wal/-shm + subagent
1217
+ // .meta.json). These are NOT user-facing artifacts and were the bulk
1218
+ // of the 452-file resume payload that blew past the 49KB data-channel
1219
+ // limit (silently dropped). User research outputs — plans, diagrams,
1220
+ // notes, images, html, summaries — still pass through.
1221
+ if (entry.startsWith('search-index') || entry.startsWith('.'))
1222
+ continue;
1223
+ if (/\.(jsonl|db|db-wal|db-shm|sqlite)$/i.test(entry) || entry.endsWith('.meta.json'))
1217
1224
  continue;
1218
1225
  results.push({
1219
1226
  fileName: entry,
package/dist/embedder.js CHANGED
@@ -21,8 +21,19 @@
21
21
  * API honors the `dimensions` passthrough.
22
22
  */
23
23
  import { EMBED_DIM, EMBED_MODEL } from './session-store.js';
24
- const OPENROUTER_URL = process.env.OPENROUTER_EMBED_URL || 'https://openrouter.ai/api/v1/embeddings';
25
- const MODEL_ID = EMBED_MODEL;
24
+ // Provider switch: Fireworks when FIREWORKS_API_KEY is set, else OpenRouter.
25
+ // Fireworks hosts the SAME qwen3-embedding-8b model, so vectors land in the same
26
+ // space as previously-embedded rows — no re-embed. EMBED_MODEL stays the store's
27
+ // model IDENTITY (the cache-invalidation key in session-store); only the
28
+ // per-provider API id differs, mapped here.
29
+ const FIREWORKS = !!process.env.FIREWORKS_API_KEY;
30
+ const EMBED_URL = process.env.OPENROUTER_EMBED_URL ||
31
+ (FIREWORKS
32
+ ? 'https://api.fireworks.ai/inference/v1/embeddings'
33
+ : 'https://openrouter.ai/api/v1/embeddings');
34
+ const MODEL_ID = FIREWORKS && EMBED_MODEL === 'qwen/qwen3-embedding-8b'
35
+ ? 'accounts/fireworks/models/qwen3-embedding-8b'
36
+ : EMBED_MODEL;
26
37
  const MAX_BATCH = 64; // inputs per request (OpenAI-compatible arrays)
27
38
  const REQUEST_TIMEOUT_MS = Number(process.env.OSBORN_EMBED_TIMEOUT_MS || 20_000);
28
39
  let lastEmbedWarn = 0;
@@ -36,7 +47,9 @@ function embedWarn(msg) {
36
47
  }
37
48
  }
38
49
  function apiKey() {
39
- return process.env.OPENROUTER_API_KEY || process.env.OPENROUTER_WORKSPACE_API_KEY;
50
+ return (process.env.FIREWORKS_API_KEY ||
51
+ process.env.OPENROUTER_API_KEY ||
52
+ process.env.OPENROUTER_WORKSPACE_API_KEY);
40
53
  }
41
54
  /**
42
55
  * L2-normalize the first EMBED_DIM components of a float embedding, then quantize to
@@ -65,7 +78,7 @@ async function embedBatch(inputs, key, timeoutMs) {
65
78
  const controller = new AbortController();
66
79
  const timer = setTimeout(() => controller.abort(), timeoutMs);
67
80
  try {
68
- const res = await fetch(OPENROUTER_URL, {
81
+ const res = await fetch(EMBED_URL, {
69
82
  method: 'POST',
70
83
  headers: {
71
84
  Authorization: `Bearer ${key}`,
@@ -83,7 +96,7 @@ async function embedBatch(inputs, key, timeoutMs) {
83
96
  });
84
97
  if (!res.ok) {
85
98
  const body = await res.text().catch(() => '');
86
- embedWarn(`OpenRouter ${res.status} ${res.statusText}: ${body.slice(0, 200)}`);
99
+ embedWarn(`${FIREWORKS ? "Fireworks" : "OpenRouter"} ${res.status} ${res.statusText}: ${body.slice(0, 200)}`);
87
100
  return null;
88
101
  }
89
102
  const json = await res.json();
@@ -130,7 +143,7 @@ export async function getEmbedder(timeoutMs = REQUEST_TIMEOUT_MS) {
130
143
  // fresh per request — kept working. Re-reading recovers as soon as the key lands.
131
144
  const key = apiKey();
132
145
  if (!key) {
133
- embedWarn('no OPENROUTER_API_KEY in env yet — keyword-only for this call');
146
+ embedWarn('no FIREWORKS_API_KEY/OPENROUTER_API_KEY in env yet — keyword-only for this call');
134
147
  return null;
135
148
  }
136
149
  const embed = async (texts) => {
package/dist/env-keys.js CHANGED
@@ -21,6 +21,7 @@ export const AGENT_ENV_KEYS = [
21
21
  { key: 'DEEPGRAM_API_KEY', required: true, explicit: false, description: 'Deepgram STT (LiveKit plugin).' },
22
22
  { key: 'SONIOX_API_KEY', required: false, explicit: false, description: 'Soniox STT (LiveKit plugin).' },
23
23
  { key: 'GROQ_API_KEY', required: false, explicit: true, description: 'Groq fast-brain inference.' },
24
+ { key: 'FIREWORKS_API_KEY', required: false, explicit: true, description: 'Fireworks AI — fast-brain inference + embeddings (preferred over OpenRouter when set).' },
24
25
  { key: 'OPENAI_API_KEY', required: true, explicit: true, description: 'OpenAI realtime + pipeline.' },
25
26
  { key: 'GOOGLE_API_KEY', required: false, explicit: false, description: 'Google Gemini realtime (plugin).' },
26
27
  // LLM auth (Claude vs OpenRouter switch)
package/dist/index.js CHANGED
@@ -44,6 +44,7 @@ import { statusManager } from './status-manager.js';
44
44
  import { createSmitheryProxy, destroySmitheryProxy, parseSmitheryUrl, isSmitheryUrl, SmitheryAuthorizationError } from './smithery-proxy.js';
45
45
  import { DIRECT_MODE_PROMPT } from './prompts.js';
46
46
  import { MCP_CATALOG } from './config.js';
47
+ import { storeExists, openStore, recentRows } from './session-store.js';
47
48
  import { getRecallClient } from './recall-client.js';
48
49
  import { MeetingTranscriptPoller } from './meeting-transcript-poller.js';
49
50
  import { missingRequiredEnv } from './env-keys.js';
@@ -5229,38 +5230,83 @@ async function main() {
5229
5230
  if (currentLLM) {
5230
5231
  currentLLM.setResumeSessionId(preSelectedSessionId);
5231
5232
  console.log(`🔄 Session resume configured: ${preSelectedSessionId}`);
5232
- // Fetch context and greet with it
5233
- const summary = await getSessionSummary(preSelectedSessionId, workingDir);
5234
- await sendToFrontend({
5235
- type: 'session_resume_set',
5236
- sessionId: preSelectedSessionId,
5237
- success: true,
5238
- });
5239
- // Send existing workspace artifacts to frontend (session-scoped)
5240
- const preArtifacts = listWorkspaceArtifacts(workingDir, preSelectedSessionId);
5241
- if (preArtifacts.length > 0) {
5242
- console.log(`📁 Sending ${preArtifacts.length} workspace artifacts to frontend`);
5243
- await sendToFrontend({
5244
- type: 'session_artifacts',
5245
- sessionId: preSelectedSessionId,
5246
- artifacts: preArtifacts.map(a => ({
5247
- filePath: a.filePath,
5248
- fileName: a.fileName,
5249
- type: a.type,
5250
- updatedAt: a.updatedAt,
5251
- }))
5252
- });
5233
+ // DEAD-AIR FIX (0.9.264): greet IMMEDIATELY — the greeting is a static
5234
+ // string that needs nothing from the resume-prep. Previously it was
5235
+ // awaited AFTER getSessionSummary (slow on a 323MB session) + a 452-
5236
+ // artifact enumeration, so the user heard silence for ~13.7s after the
5237
+ // screen connected (measured). Now the first words play at session-
5238
+ // ready (~2s); the prep runs in the background and never blocks voice.
5239
+ try {
5240
+ await session.say("Welcome back! Ready to continue our previous conversation.");
5253
5241
  }
5254
- // Greet first, then point agent to session index (non-blocking)
5255
- if (summary) {
5242
+ catch (err) {
5243
+ console.log('⚠️ Pre-selected session greeting failed:', err);
5244
+ }
5245
+ // Resume-prep in the BACKGROUND: session summary → index injection +
5246
+ // artifact list to the UI. None of this gates the greeting or the
5247
+ // user's first turn (the real context comes from the primed JSONL
5248
+ // resume). Best-effort; failures are non-fatal.
5249
+ void (async () => {
5256
5250
  try {
5257
- await session.say("Welcome back! Ready to continue our previous conversation.");
5251
+ // OPTIMISTIC UX (0.9.265): push the last ~20 messages straight from
5252
+ // the per-session recall store (SQLite) so the UI can show prior
5253
+ // conversation during the connect wait instead of an empty orb.
5254
+ // recentRows reads the DB directly — NO JSONL replay. Best-effort.
5255
+ try {
5256
+ const dbPath = storeExists(preSelectedSessionId, workingDir);
5257
+ if (dbPath) {
5258
+ const db = openStore(dbPath, { readonly: true });
5259
+ try {
5260
+ const rows = recentRows(db, 20, ['user', 'assistant']); // newest-first
5261
+ const priorMessages = rows
5262
+ .reverse() // → chronological
5263
+ .map(r => ({ role: r.msgType === 'assistant' ? 'assistant' : 'user', content: (r.text || '').slice(0, 800) }))
5264
+ .filter(m => m.content.trim().length > 0);
5265
+ if (priorMessages.length > 0) {
5266
+ await sendToFrontend({ type: 'prior_messages', sessionId: preSelectedSessionId, messages: priorMessages });
5267
+ console.log(`💬 Sent ${priorMessages.length} prior messages from DB for optimistic UI`);
5268
+ }
5269
+ }
5270
+ finally {
5271
+ try {
5272
+ db.close();
5273
+ }
5274
+ catch { }
5275
+ }
5276
+ }
5277
+ }
5278
+ catch (e) {
5279
+ console.warn('⚠️ prior_messages (optimistic) failed:', e instanceof Error ? e.message : e);
5280
+ }
5281
+ const summary = await getSessionSummary(preSelectedSessionId, workingDir);
5282
+ await sendToFrontend({
5283
+ type: 'session_resume_set',
5284
+ sessionId: preSelectedSessionId,
5285
+ success: true,
5286
+ });
5287
+ const preArtifacts = listWorkspaceArtifacts(workingDir, preSelectedSessionId);
5288
+ if (preArtifacts.length > 0) {
5289
+ // Cap at 120 so the payload stays under the 49KB data-channel
5290
+ // limit (452 artifacts = 106KB was silently dropped before).
5291
+ console.log(`📁 Sending ${Math.min(preArtifacts.length, 120)}/${preArtifacts.length} workspace artifacts to frontend`);
5292
+ await sendToFrontend({
5293
+ type: 'session_artifacts',
5294
+ sessionId: preSelectedSessionId,
5295
+ artifacts: preArtifacts.slice(0, 120).map(a => ({
5296
+ filePath: a.filePath,
5297
+ fileName: a.fileName,
5298
+ type: a.type,
5299
+ updatedAt: a.updatedAt,
5300
+ })),
5301
+ });
5302
+ }
5303
+ if (summary)
5304
+ injectSessionIndexIntoChatCtx(currentAgent, preSelectedSessionId, workingDir);
5258
5305
  }
5259
5306
  catch (err) {
5260
- console.log('⚠️ Pre-selected session greeting failed:', err);
5307
+ console.warn('⚠️ resume-prep (background) failed:', err instanceof Error ? err.message : err);
5261
5308
  }
5262
- injectSessionIndexIntoChatCtx(currentAgent, preSelectedSessionId, workingDir);
5263
- }
5309
+ })();
5264
5310
  }
5265
5311
  }
5266
5312
  else if (!preSelectedSessionId && hasRecentSession) {
@@ -17,8 +17,17 @@
17
17
  // ============================================================
18
18
  // Model reads from env var (set by main process from getInferenceConfig) or DEFAULT_CONFIG default.
19
19
  // To switch model: update DEFAULT_CONFIG.inference.fastBrainModel in config.ts, or set OSBORN_FAST_BRAIN_MODEL env var.
20
- const OPENROUTER_MODEL = process.env.OSBORN_FAST_BRAIN_MODEL || 'deepseek/deepseek-chat';
21
- const OPENROUTER_URL = 'https://openrouter.ai/api/v1/chat/completions';
20
+ // Provider switch: Fireworks (OpenAI-compatible) when FIREWORKS_API_KEY is set, else
21
+ // OpenRouter. Default Fireworks model: deepseek-v4p1-flash — v3p1 is deprecated off
22
+ // Fireworks serverless (verified 2026-10-22 via the model page metadata); V4.1 Flash
23
+ // is the live successor in the same fast/cheap DeepSeek class (262K ctx, tool calls).
24
+ const FIREWORKS = !!process.env.FIREWORKS_API_KEY;
25
+ const PROVIDER_NAME = FIREWORKS ? 'Fireworks' : 'OpenRouter';
26
+ const OPENROUTER_MODEL = process.env.OSBORN_FAST_BRAIN_MODEL ||
27
+ (FIREWORKS ? 'accounts/fireworks/models/deepseek-v4p1-flash' : 'deepseek/deepseek-chat');
28
+ const OPENROUTER_URL = FIREWORKS
29
+ ? 'https://api.fireworks.ai/inference/v1/chat/completions'
30
+ : 'https://openrouter.ai/api/v1/chat/completions';
22
31
  const TIMEOUT_MS = 20_000;
23
32
  const MAX_TOOL_ROUNDS = 4;
24
33
  // ============================================================
@@ -317,7 +326,7 @@ async function callOpenRouter(messages, tools, apiKey) {
317
326
  });
318
327
  if (!resp.ok) {
319
328
  const body = await resp.text().catch(() => '');
320
- throw new Error(`OpenRouter ${resp.status}: ${body.substring(0, 200)}`);
329
+ throw new Error(`${PROVIDER_NAME} ${resp.status}: ${body.substring(0, 200)}`);
321
330
  }
322
331
  return resp.json();
323
332
  }
@@ -328,7 +337,7 @@ export async function askPipelineFastBrain(workingDir, sessionId, question, opts
328
337
  if (!sessionId || sessionId === 'pending') {
329
338
  return { script: 'Session is still initializing.', type: 'acknowledgment', toolsUsed: [] };
330
339
  }
331
- const apiKey = process.env.OPENROUTER_API_KEY;
340
+ const apiKey = process.env.FIREWORKS_API_KEY || process.env.OPENROUTER_API_KEY;
332
341
  if (!apiKey) {
333
342
  return { script: 'Search system not available right now.', type: 'acknowledgment', toolsUsed: [] };
334
343
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osborn",
3
- "version": "0.9.264",
3
+ "version": "0.9.265",
4
4
  "description": "Voice AI coding assistant - local agent that connects to Osborn frontend",
5
5
  "type": "module",
6
6
  "bin": {