@awareness-sdk/local 0.1.10 → 0.1.12
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/bin/awareness-local.mjs +13 -0
- package/package.json +1 -1
- package/src/core/cloud-sync.mjs +3 -5
- package/src/daemon.mjs +7 -2
package/bin/awareness-local.mjs
CHANGED
|
@@ -237,6 +237,19 @@ async function cmdStart(flags) {
|
|
|
237
237
|
console.log(` MCP endpoint: http://localhost:${port}/mcp`);
|
|
238
238
|
console.log(` Dashboard: http://localhost:${port}/`);
|
|
239
239
|
console.log(` Log file: ${logPath}`);
|
|
240
|
+
|
|
241
|
+
// Auto-open dashboard on first daemon start
|
|
242
|
+
const firstRunFlag = path.join(awarenessDir, '.first-run-done');
|
|
243
|
+
if (!fs.existsSync(firstRunFlag)) {
|
|
244
|
+
try {
|
|
245
|
+
fs.writeFileSync(firstRunFlag, new Date().toISOString());
|
|
246
|
+
const url = `http://localhost:${port}/`;
|
|
247
|
+
const { exec } = await import('node:child_process');
|
|
248
|
+
if (process.platform === 'darwin') exec(`open "${url}"`);
|
|
249
|
+
else if (process.platform === 'linux') exec(`xdg-open "${url}"`);
|
|
250
|
+
else if (process.platform === 'win32') exec(`start "" "${url}"`);
|
|
251
|
+
} catch { /* ignore open failures */ }
|
|
252
|
+
}
|
|
240
253
|
} else {
|
|
241
254
|
console.error('Failed to start daemon. Check log file:');
|
|
242
255
|
console.error(` ${logPath}`);
|
package/package.json
CHANGED
package/src/core/cloud-sync.mjs
CHANGED
|
@@ -300,13 +300,11 @@ export class CloudSync {
|
|
|
300
300
|
|
|
301
301
|
for (const memory of unsynced) {
|
|
302
302
|
try {
|
|
303
|
-
// Read the
|
|
303
|
+
// Read the markdown content from disk, strip YAML front matter
|
|
304
304
|
let content = '';
|
|
305
305
|
try {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
'utf-8'
|
|
309
|
-
);
|
|
306
|
+
const raw = fs.readFileSync(memory.filepath, 'utf-8');
|
|
307
|
+
content = raw.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, '').trim();
|
|
310
308
|
} catch {
|
|
311
309
|
// File may have been deleted — skip
|
|
312
310
|
console.warn(`${LOG_PREFIX} File not found, skipping: ${memory.filepath}`);
|
package/src/daemon.mjs
CHANGED
|
@@ -1422,14 +1422,19 @@ export class AwarenessLocalDaemon {
|
|
|
1422
1422
|
return { error: 'items array is required for remember_batch' };
|
|
1423
1423
|
}
|
|
1424
1424
|
|
|
1425
|
+
// Batch-level insights go to the last item (summary item)
|
|
1426
|
+
const batchInsights = params.insights || null;
|
|
1427
|
+
|
|
1425
1428
|
const results = [];
|
|
1426
|
-
for (
|
|
1429
|
+
for (let i = 0; i < items.length; i++) {
|
|
1430
|
+
const item = items[i];
|
|
1431
|
+
const isLast = i === items.length - 1;
|
|
1427
1432
|
const result = await this._remember({
|
|
1428
1433
|
content: item.content,
|
|
1429
1434
|
title: item.title,
|
|
1430
1435
|
event_type: item.event_type,
|
|
1431
1436
|
tags: item.tags,
|
|
1432
|
-
insights: item.insights,
|
|
1437
|
+
insights: item.insights || (isLast ? batchInsights : null),
|
|
1433
1438
|
session_id: params.session_id,
|
|
1434
1439
|
agent_role: params.agent_role,
|
|
1435
1440
|
});
|