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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

## [1.9.1] — 2026-09-18

### Fixed

- `plugins:` (and `nli:`) declared under an agent's entry in the named `cortex:` map of `agent.yaml` now reach `CortexConfig`. `extractFromNamedCortexMap` lifted the provider fields and the tool list but not these two, so only the legacy flat `cortex:` block could name a plugin — the repo-shipped plugin path 1.9.0 opened with `trusted: true` could not be declared from the config that `fozikio init` writes (#114).

## [1.9.0] — 2026-09-18

### Added
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fozikio/cortex-engine",
"version": "1.9.0",
"version": "1.9.1",
"description": "Portable cognitive engine for AI agents — storage, embeddings, memory, FSRS, and MCP server",
"type": "module",
"main": "dist/index.js",
Expand Down
46 changes: 45 additions & 1 deletion src/bin/config-loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

import { describe, it, expect, vi, afterEach } from 'vitest';
import { mkdtempSync, rmSync } from 'node:fs';
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { DEFAULT_CONFIG } from '../core/config.js';
Expand Down Expand Up @@ -97,3 +97,47 @@ describe('loadConfig with no config file', () => {
}
});
});

describe('loadConfig over a named cortex map (agent.yaml)', () => {
afterEach(() => {
vi.restoreAllMocks();
});

it("lifts the primary entry's plugins and nli onto the config", () => {
const dir = mkdtempSync(join(tmpdir(), 'cortex-cfg-'));
try {
mkdirSync(join(dir, '.fozikio'));
writeFileSync(
join(dir, '.fozikio', 'agent.yaml'),
[
'agent:',
' name: ledger',
'agents:',
' ledger:',
' namespace: ledger',
'cortex:',
' ledger:',
' store: sqlite',
' embed: ollama',
' llm: ollama',
' primary: true',
' collections_prefix: ledger_',
' cognitive_tools: [query, observe]',
' plugins:',
' - ./.fozikio/plugins/codebase-mind/dist/index.js',
' nli:',
' enabled: true',
' url: http://127.0.0.1:11435',
'',
].join('\n'),
);
const config = loadConfig(dir, 'ledger');
expect(config.plugins).toEqual(['./.fozikio/plugins/codebase-mind/dist/index.js']);
expect(config.nli).toEqual({ enabled: true, url: 'http://127.0.0.1:11435' });
expect(config.namespaces.ledger?.collections_prefix).toBe('ledger_');
expect(config.namespaces.ledger?.cognitive_tools).toEqual(['query', 'observe']);
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
});
8 changes: 8 additions & 0 deletions src/bin/config-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ interface NamedCortexEntry {
llm_options?: CortexConfig['llm_options'];
embed_options?: CortexConfig['embed_options'];
store_options?: CortexConfig['store_options'];
/** Plugin packages or paths (see plugins/loader.ts); lifted onto the config like the provider fields. */
plugins?: CortexConfig['plugins'];
nli?: CortexConfig['nli'];
}

/**
Expand Down Expand Up @@ -72,6 +75,11 @@ function extractFromNamedCortexMap(cortexMap: Record<string, NamedCortexEntry>):
if (entry.llm_options) partial.llm_options = entry.llm_options;
if (entry.embed_options) partial.embed_options = entry.embed_options;
if (entry.store_options) partial.store_options = entry.store_options;
// `plugins` and `nli` sit on CortexConfig beside the provider fields, but until 1.9.1 only the
// legacy flat `cortex:` block carried them through: the named map dropped both, so a repo's own
// plugin listed under its agent's entry (the 1.9.0 `trusted` path's whole point) never loaded.
if (entry.plugins) partial.plugins = entry.plugins;
if (entry.nli) partial.nli = entry.nli;

if (entry.cognitive_tools || entry.collections_prefix) {
partial.namespaces = {
Expand Down
Loading