osborn 0.9.0 → 0.9.2
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/dist/fast-brain.js +7 -7
- package/dist/index.js +13 -26
- package/package.json +1 -1
package/dist/fast-brain.js
CHANGED
|
@@ -866,7 +866,7 @@ export async function askHaiku(workingDir, sessionId, question, researchContext,
|
|
|
866
866
|
initProvider();
|
|
867
867
|
// workspace uses workingDir for spec.md (under ~/.claude/projects/{slug}/osb/)
|
|
868
868
|
// workingDir is for JSONL access (matches Claude SDK cwd)
|
|
869
|
-
const wsDir =
|
|
869
|
+
const wsDir = workingDir;
|
|
870
870
|
const workspace = getSessionWorkspace(wsDir, sessionId);
|
|
871
871
|
// Primary: Gemini Flash (~1-2s) with pre-loaded JSONL context
|
|
872
872
|
// Fallback: Anthropic direct API or Agent SDK (slower but functional)
|
|
@@ -888,7 +888,7 @@ let researchTaskCounter = 0;
|
|
|
888
888
|
*/
|
|
889
889
|
export async function askFastBrain(workingDir, sessionId, question, opts) {
|
|
890
890
|
const { chatHistory, researchContext, callbacks } = opts;
|
|
891
|
-
const wsDir =
|
|
891
|
+
const wsDir = workingDir;
|
|
892
892
|
// Detect document generation requests
|
|
893
893
|
const docMatch = detectDocumentRequest(question);
|
|
894
894
|
if (docMatch) {
|
|
@@ -1058,7 +1058,7 @@ export async function processResearchChunk(workingDir, sessionId, task, contentC
|
|
|
1058
1058
|
return null;
|
|
1059
1059
|
}
|
|
1060
1060
|
specUpdateInProgress = true;
|
|
1061
|
-
const wsDir =
|
|
1061
|
+
const wsDir = workingDir;
|
|
1062
1062
|
try {
|
|
1063
1063
|
const workspace = getSessionWorkspace(wsDir, sessionId);
|
|
1064
1064
|
const specPath = `${workspace}/spec.md`;
|
|
@@ -1492,7 +1492,7 @@ export async function contextualizeResearchUpdate(workingDir, sessionId, task, b
|
|
|
1492
1492
|
initProvider();
|
|
1493
1493
|
if (provider === 'none')
|
|
1494
1494
|
return null;
|
|
1495
|
-
const wsDir =
|
|
1495
|
+
const wsDir = workingDir;
|
|
1496
1496
|
try {
|
|
1497
1497
|
const specContent = readSessionSpec(wsDir, sessionId);
|
|
1498
1498
|
const specTruncated = specContent ? specContent.substring(0, 1500) : '';
|
|
@@ -1558,7 +1558,7 @@ export async function generateProactivePrompt(workingDir, sessionId, task, resea
|
|
|
1558
1558
|
initProvider();
|
|
1559
1559
|
if (provider === 'none')
|
|
1560
1560
|
return null;
|
|
1561
|
-
const wsDir =
|
|
1561
|
+
const wsDir = workingDir;
|
|
1562
1562
|
try {
|
|
1563
1563
|
const specContent = readSessionSpec(wsDir, sessionId);
|
|
1564
1564
|
const specTruncated = specContent ? specContent.substring(0, 2000) : '';
|
|
@@ -1636,7 +1636,7 @@ export async function generateVisualDocument(workingDir, sessionId, request, doc
|
|
|
1636
1636
|
initProvider();
|
|
1637
1637
|
if (provider === 'none')
|
|
1638
1638
|
return null;
|
|
1639
|
-
const wsDir =
|
|
1639
|
+
const wsDir = workingDir;
|
|
1640
1640
|
try {
|
|
1641
1641
|
const workspace = getSessionWorkspace(wsDir, sessionId);
|
|
1642
1642
|
const specContent = readSessionSpec(wsDir, sessionId) || '';
|
|
@@ -1726,7 +1726,7 @@ export async function processResearchCompletion(workingDir, sessionId, task, age
|
|
|
1726
1726
|
initProvider();
|
|
1727
1727
|
if (provider === 'none')
|
|
1728
1728
|
return agentResult.substring(0, 500);
|
|
1729
|
-
const wsDir =
|
|
1729
|
+
const wsDir = workingDir;
|
|
1730
1730
|
try {
|
|
1731
1731
|
// Read spec for context
|
|
1732
1732
|
const specContent = readSessionSpec(wsDir, sessionId) || '';
|
package/dist/index.js
CHANGED
|
@@ -300,14 +300,6 @@ function startApiServer(workingDir, port) {
|
|
|
300
300
|
// GET /sessions/export — stream a gzipped tar of ~/.claude/projects/ to the client
|
|
301
301
|
// Optional ?workDir= query param: if present, export only that project's slug folder.
|
|
302
302
|
if (req.method === 'GET' && url.pathname === '/sessions/export') {
|
|
303
|
-
if (syncToken) {
|
|
304
|
-
const authHeader = req.headers['authorization'] ?? '';
|
|
305
|
-
if (authHeader !== `Bearer ${syncToken}`) {
|
|
306
|
-
res.writeHead(401, { 'Content-Type': 'application/json' });
|
|
307
|
-
res.end(JSON.stringify({ error: 'Unauthorized' }));
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
303
|
const projectsDir = join(homedir(), '.claude', 'projects');
|
|
312
304
|
const workDir = url.searchParams.get('workDir');
|
|
313
305
|
if (workDir) {
|
|
@@ -323,7 +315,8 @@ function startApiServer(workingDir, port) {
|
|
|
323
315
|
'Content-Disposition': `attachment; filename="claude-sessions-${slug}.tar.gz"`,
|
|
324
316
|
'Access-Control-Allow-Origin': '*',
|
|
325
317
|
});
|
|
326
|
-
|
|
318
|
+
// Use '--' to prevent tar from interpreting the leading-hyphen slug as flags
|
|
319
|
+
const tar = spawn('tar', ['-czf', '-', '-C', projectsDir, '--', slug]);
|
|
327
320
|
tar.stdout.pipe(res);
|
|
328
321
|
tar.stderr.on('data', (d) => console.error('[export]', d.toString()));
|
|
329
322
|
tar.on('close', (code) => { if (code !== 0)
|
|
@@ -1844,7 +1837,6 @@ async function main() {
|
|
|
1844
1837
|
chatHistory,
|
|
1845
1838
|
researchContext,
|
|
1846
1839
|
callbacks,
|
|
1847
|
-
sessionBaseDir,
|
|
1848
1840
|
});
|
|
1849
1841
|
haikuInFlight = null;
|
|
1850
1842
|
// Voice queue items may have been held while fast brain was in flight — retry now
|
|
@@ -2020,24 +2012,19 @@ async function main() {
|
|
|
2020
2012
|
}
|
|
2021
2013
|
// Read working directory override from frontend.
|
|
2022
2014
|
//
|
|
2023
|
-
//
|
|
2024
|
-
//
|
|
2025
|
-
//
|
|
2026
|
-
//
|
|
2027
|
-
//
|
|
2028
|
-
//
|
|
2029
|
-
// .../cli.js" error (see MEMORY bug fix #11). Fall back to defaultWorkingDir
|
|
2030
|
-
// (which is itself existsSync-verified at startup).
|
|
2015
|
+
// If the path doesn't exist yet (new project on first use, or freshly
|
|
2016
|
+
// imported sessions on a new sprite), create it with mkdirSync so the
|
|
2017
|
+
// agent can accept it. This is safe: recursive mkdirSync is a no-op when
|
|
2018
|
+
// the directory already exists, and project paths always live under the
|
|
2019
|
+
// workspace root. The Claude SDK child_process.spawn requires the cwd to
|
|
2020
|
+
// exist — mkdirSync satisfies that requirement without silently falling back.
|
|
2031
2021
|
if (metadata.workingDirectory && typeof metadata.workingDirectory === 'string' && metadata.workingDirectory.length > 0) {
|
|
2032
|
-
if (existsSync(metadata.workingDirectory)) {
|
|
2033
|
-
|
|
2034
|
-
console.log(
|
|
2035
|
-
}
|
|
2036
|
-
else {
|
|
2037
|
-
console.log(`⚠️ Frontend sent workingDirectory that does not exist: ${metadata.workingDirectory}`);
|
|
2038
|
-
console.log(` Falling back to default: ${defaultWorkingDir}`);
|
|
2039
|
-
workingDir = defaultWorkingDir;
|
|
2022
|
+
if (!existsSync(metadata.workingDirectory)) {
|
|
2023
|
+
mkdirSync(metadata.workingDirectory, { recursive: true });
|
|
2024
|
+
console.log(`📁 Created project directory: ${metadata.workingDirectory}`);
|
|
2040
2025
|
}
|
|
2026
|
+
workingDir = metadata.workingDirectory;
|
|
2027
|
+
console.log(`📂 Working directory from frontend: ${workingDir}`);
|
|
2041
2028
|
}
|
|
2042
2029
|
else {
|
|
2043
2030
|
// Reset to default for new connections (in case previous session changed it)
|