n2-soul 6.0.2 → 6.0.3

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/index.js CHANGED
@@ -17,7 +17,7 @@ const { registerKVCacheTools } = require('./tools/kv-cache');
17
17
 
18
18
  const server = new McpServer({
19
19
  name: 'n2-soul',
20
- version: '6.0.2',
20
+ version: '6.0.3',
21
21
  });
22
22
 
23
23
  // ═══════════════════════════════════════════════════════
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n2-soul",
3
- "version": "6.0.2",
3
+ "version": "6.0.3",
4
4
  "description": "Multi-agent session orchestrator with KV-Cache and Ark for MCP (Model Context Protocol)",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/sequences/work.js CHANGED
@@ -7,6 +7,19 @@ const { SoulEngine } = require('../lib/soul-engine');
7
7
  // In-memory work session state per project
8
8
  const activeSessions = {};
9
9
 
10
+ // TTL: auto-expire stale sessions (24 hours, checked every hour)
11
+ const SESSION_TTL_MS = 24 * 60 * 60 * 1000;
12
+ const _sessionGcTimer = setInterval(() => {
13
+ const now = Date.now();
14
+ for (const [project, session] of Object.entries(activeSessions)) {
15
+ if (session._createdMs && (now - session._createdMs) > SESSION_TTL_MS) {
16
+ delete activeSessions[project];
17
+ logError('work:ttl', `Expired stale session: ${project} (agent: ${session.agent})`);
18
+ }
19
+ }
20
+ }, 60 * 60 * 1000);
21
+ _sessionGcTimer.unref(); // Don't prevent Node.js from exiting
22
+
10
23
  // ── Helper: recursively walk files in a directory ──
11
24
  function walkFiles(dir, callback, maxDepth, depth = 0) {
12
25
  if (depth > maxDepth) return;
@@ -45,6 +58,7 @@ function registerWorkSequence(server, z, config) {
45
58
  agent,
46
59
  task,
47
60
  startedAt: nowISO(),
61
+ _createdMs: Date.now(),
48
62
  filesCreated: [],
49
63
  filesModified: [],
50
64
  filesDeleted: [],
@@ -0,0 +1,5 @@
1
+ # tests/
2
+
3
+ Integration and unit tests for n2-soul.
4
+
5
+ Run: `node tests/test-ark-integration.js`
@@ -1,10 +1,10 @@
1
1
  // n2-ark + n2-soul integration test — pure last shield
2
2
  const path = require('path');
3
- const { createArk } = require('./lib/ark');
3
+ const { createArk } = require('../lib/ark');
4
4
 
5
5
  const ark = createArk({
6
- rulesDir: path.join(__dirname, 'rules'),
7
- auditDir: path.join(__dirname, 'data', 'ark-audit'),
6
+ rulesDir: path.join(__dirname, '..', 'rules'),
7
+ auditDir: path.join(__dirname, '..', 'data', 'ark-audit'),
8
8
  });
9
9
 
10
10
  let passed = 0;