Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .aiox-core/core/config/config-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,16 @@ class ConfigCache {
* @returns {boolean} True if key exists and is valid
*/
has(key) {
return this.get(key) !== null;
if (!this.cache.has(key)) {
return false;
}
const timestamp = this.timestamps.get(key);
if (Date.now() - timestamp > this.ttl) {
this.cache.delete(key);
this.timestamps.delete(key);
return false;
}
return true;
}

/**
Expand Down
13 changes: 11 additions & 2 deletions .aiox-core/core/synapse/runtime/hook-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,24 @@ function resolveHookRuntime(input) {
if (!fs.existsSync(synapsePath)) return null;

try {
const { loadSession, cleanStaleSessions } = require(
const { loadSession, createSession, cleanStaleSessions } = require(
path.join(cwd, '.aiox-core', 'core', 'synapse', 'session', 'session-manager.js'),
);
const { SynapseEngine } = require(
path.join(cwd, '.aiox-core', 'core', 'synapse', 'engine.js'),
);

const sessionsDir = path.join(synapsePath, 'sessions');
const session = loadSession(sessionId, sessionsDir) || { prompt_count: 0 };

// Create session file on first prompt if it doesn't exist.
// Without this, updateSession() silently fails because loadSession() returns null.
let session = loadSession(sessionId, sessionsDir);
if (!session && sessionId) {
session = createSession(sessionId, cwd, sessionsDir);
}
if (!session) {
session = { prompt_count: 0 };
}
const engine = new SynapseEngine(synapsePath);

// AC3: Run cleanup on first prompt only (fire-and-forget)
Expand Down
Loading
Loading