8 Commits

Author SHA1 Message Date
9f3d7dc6a9 Merge pull request 'docs: record live LiteLLM validation' (#55) from codex/issue-53-live-handoff into codex/production-intelligence-terminal
All checks were successful
Codex Template Compliance / template-compliance (push) Successful in 5s
Release Dry Run / release-dry-run (push) Successful in 17s
Build / test-and-image (push) Successful in 26s
Merge pull request #55: record live LiteLLM validation
2026-07-04 10:35:10 +00:00
f10bff9ba4 docs: record live LiteLLM validation
All checks were successful
Codex Template Compliance / template-compliance (pull_request) Successful in 9s
Build / test-and-image (pull_request) Successful in 22s
2026-07-04 12:34:09 +02:00
14d9276c30 Merge pull request 'fix: persist LLM predictions without stable ID shadowing' (#54) from codex/issue-53-prediction-stable-id into codex/production-intelligence-terminal
All checks were successful
Codex Template Compliance / template-compliance (push) Successful in 5s
Release Dry Run / release-dry-run (push) Successful in 17s
Build / test-and-image (push) Successful in 32s
Merge pull request #54: fix LLM prediction persistence
2026-07-04 10:29:42 +00:00
84b2c9ebc9 test: assert hashed prediction identifier format
All checks were successful
Codex Template Compliance / template-compliance (pull_request) Successful in 9s
Build / test-and-image (pull_request) Successful in 51s
2026-07-04 12:27:57 +02:00
9263157a9e fix: persist LLM predictions without stable ID shadowing
Some checks failed
Codex Template Compliance / template-compliance (pull_request) Successful in 5s
Build / test-and-image (pull_request) Failing after 22s
2026-07-04 12:25:58 +02:00
f7b527763d Merge pull request 'fix: respect configured LLM generation limits' (#52) from codex/issue-51-llm-timeout-config into codex/production-intelligence-terminal
All checks were successful
Codex Template Compliance / template-compliance (push) Successful in 5s
Release Dry Run / release-dry-run (push) Successful in 15s
Build / test-and-image (push) Successful in 32s
Merge pull request #52: respect configured LLM generation limits
2026-07-04 10:13:16 +00:00
dda1d23a30 fix: respect configured LLM generation limits
All checks were successful
Codex Template Compliance / template-compliance (pull_request) Successful in 7s
Build / test-and-image (pull_request) Successful in 55s
2026-07-04 12:11:28 +02:00
ebe2906d1c Merge pull request 'docs: synchronize README with production configuration' (#50) from codex/issue-46-readme-sync into codex/production-intelligence-terminal
All checks were successful
Codex Template Compliance / template-compliance (push) Successful in 5s
Release Dry Run / release-dry-run (push) Successful in 14s
Build / test-and-image (push) Successful in 30s
Merge pull request #50: synchronize README with production configuration
2026-07-03 21:56:32 +00:00
8 changed files with 110 additions and 6 deletions

View File

@@ -29,6 +29,7 @@ OPENROUTER_APP_NAME=Intelligence Terminal
# Local OpenAI-compatible examples # Local OpenAI-compatible examples
# LiteLLM: LLM_PROVIDER=litellm, LLM_BASE_URL=https://llm.example.com/v1, LLM_API_KEY=your-proxy-key, LLM_MODEL=your-model-alias # LiteLLM: LLM_PROVIDER=litellm, LLM_BASE_URL=https://llm.example.com/v1, LLM_API_KEY=your-proxy-key, LLM_MODEL=your-model-alias
# Local 20B+ models may need LLM_TIMEOUT_MS=300000 for full intelligence sweeps.
# LM Studio: LLM_PROVIDER=lmstudio, LLM_BASE_URL=http://host.docker.internal:1234/v1, LLM_MODEL=local-model # LM Studio: LLM_PROVIDER=lmstudio, LLM_BASE_URL=http://host.docker.internal:1234/v1, LLM_MODEL=local-model
# Ollama: LLM_PROVIDER=ollama, LLM_BASE_URL=http://host.docker.internal:11434, LLM_MODEL=llama3.1:8b # Ollama: LLM_PROVIDER=ollama, LLM_BASE_URL=http://host.docker.internal:11434, LLM_MODEL=llama3.1:8b
# Generic: LLM_PROVIDER=openai-compatible, LLM_BASE_URL=http://host.docker.internal:8000/v1, LLM_MODEL=your-model # Generic: LLM_PROVIDER=openai-compatible, LLM_BASE_URL=http://host.docker.internal:8000/v1, LLM_MODEL=your-model

View File

@@ -178,6 +178,7 @@ LLM_PROVIDER=litellm
LLM_BASE_URL=https://llm.example.com/v1 LLM_BASE_URL=https://llm.example.com/v1
LLM_API_KEY=your-litellm-api-key LLM_API_KEY=your-litellm-api-key
LLM_MODEL=your-model-alias LLM_MODEL=your-model-alias
LLM_TIMEOUT_MS=300000
# LM Studio # LM Studio
LLM_PROVIDER=lmstudio LLM_PROVIDER=lmstudio

View File

@@ -1,6 +1,6 @@
# Agent Handoff # Agent Handoff
Last updated: 2026-07-03 Last updated: 2026-07-04
## Latest Completed Work ## Latest Completed Work
@@ -12,7 +12,11 @@ Last updated: 2026-07-03
- The build workflow now targets `git.wilkensxl.de/code-inc/intelligence-terminal` and publishes only from the production branch, not from pull requests. - The build workflow now targets `git.wilkensxl.de/code-inc/intelligence-terminal` and publishes only from the production branch, not from pull requests.
- Gitea Actions runs 231-235 passed for the PR and production merge, including unit tests, Compose validation, Docker build, release dry-run, and template compliance. - Gitea Actions runs 231-235 passed for the PR and production merge, including unit tests, Compose validation, Docker build, release dry-run, and template compliance.
- The first `code-inc` registry publication was verified through the Gitea Package API on 2026-07-03. - The first `code-inc` registry publication was verified through the Gitea Package API on 2026-07-03.
- Related maintenance: issue #21 tracks the failing security scan, #45 tracks the dependency workflow, and #46 tracks remaining namespace/handoff cleanup. - PR #52 / issue #51 removed the hard-coded 90-second/4096-token idea-generation override. LLM ideas now respect `LLM_TIMEOUT_MS` and `LLM_MAX_TOKENS`.
- PR #54 / issue #53 fixed prediction persistence after successful LLM generation and added a SQLite-backed regression test.
- Live Dockge verification on 2026-07-04 used `LLM_TIMEOUT_MS=300000` and `LLM_MAX_TOKENS=4096` with the `heim-llm` LiteLLM alias. The completed sweep produced six parsed ideas, reported `ideasSource=llm`, persisted memory, and had no `lastSweepError`.
- Production implementation commit: `14d9276c30e06cafcaee8177ba7377fdf5f26277`.
- Issues #47, #51, and #53 are complete. Issue #21 tracks the failing security scan and #45 tracks the dependency workflow.
## Repository State ## Repository State

View File

@@ -205,7 +205,7 @@ export class IntelligenceStore {
_recordPredictions(data, timestamp) { _recordPredictions(data, timestamp) {
for (const idea of data.ideas || []) { for (const idea of data.ideas || []) {
const title = idea.title || 'Untitled idea'; const title = idea.title || 'Untitled idea';
const stableId = stableId('prediction', title, idea.type || '', idea.ticker || '', idea.horizon || ''); const predictionId = stableId('prediction', title, idea.type || '', idea.ticker || '', idea.horizon || '');
const evidence = Array.isArray(idea.signals) ? idea.signals : []; const evidence = Array.isArray(idea.signals) ? idea.signals : [];
this.db.prepare(`INSERT INTO predictions ( this.db.prepare(`INSERT INTO predictions (
stable_id, created_at, updated_at, title, type, hypothesis, evidence_json, confidence, stable_id, created_at, updated_at, title, type, hypothesis, evidence_json, confidence,
@@ -217,7 +217,7 @@ export class IntelligenceStore {
confidence=excluded.confidence, confidence=excluded.confidence,
evidence_json=excluded.evidence_json, evidence_json=excluded.evidence_json,
payload_json=excluded.payload_json`).run( payload_json=excluded.payload_json`).run(
stableId, predictionId,
timestamp, timestamp,
timestamp, timestamp,
title, title,

View File

@@ -43,7 +43,13 @@ Output ONLY valid JSON array. Each object:
}`; }`;
try { try {
const result = await provider.complete(systemPrompt, context, { maxTokens: 4096, timeout: 90000 }); const maxTokens = Number.isFinite(provider.maxTokens) && provider.maxTokens > 0
? provider.maxTokens
: 4096;
const timeout = Number.isFinite(provider.timeoutMs) && provider.timeoutMs > 0
? provider.timeoutMs
: 90000;
const result = await provider.complete(systemPrompt, context, { maxTokens, timeout });
const ideas = parseIdeasResponse(result.text); const ideas = parseIdeasResponse(result.text);
if (ideas && ideas.length > 0) { if (ideas && ideas.length > 0) {
return ideas; return ideas;

View File

@@ -12,7 +12,7 @@
"brief:save": "node apis/save-briefing.mjs", "brief:save": "node apis/save-briefing.mjs",
"diag": "node diag.mjs", "diag": "node diag.mjs",
"test": "npm run test:unit", "test": "npm run test:unit",
"test:unit": "node --test test/llm-openrouter.test.mjs test/llm-ollama.test.mjs test/llm-openai-compatible.test.mjs test/llm-litellm.test.mjs test/fetch-utils.test.mjs test/reddit-source.test.mjs test/acled-source.test.mjs test/mojibake-text.test.mjs test/adsb.test.mjs test/dashboard-geotagging.test.mjs", "test:unit": "node --test test/llm-openrouter.test.mjs test/llm-ollama.test.mjs test/llm-openai-compatible.test.mjs test/llm-litellm.test.mjs test/llm-ideas.test.mjs test/intelligence-store.test.mjs test/fetch-utils.test.mjs test/reddit-source.test.mjs test/acled-source.test.mjs test/mojibake-text.test.mjs test/adsb.test.mjs test/dashboard-geotagging.test.mjs",
"compose:config": "docker compose config", "compose:config": "docker compose config",
"clean": "node scripts/clean.mjs", "clean": "node scripts/clean.mjs",
"fresh-start": "npm run clean && npm start" "fresh-start": "npm run clean && npm start"

View File

@@ -0,0 +1,44 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { mkdtempSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { IntelligenceStore } from '../lib/intelligence-store.mjs';
test('records LLM ideas as stable predictions', async (t) => {
const directory = mkdtempSync(join(tmpdir(), 'intelligence-store-'));
t.after(() => rmSync(directory, { recursive: true, force: true }));
const store = await new IntelligenceStore(join(directory, 'intelligence.db')).init();
if (!store.available) {
t.skip(`node:sqlite unavailable: ${store.reason}`);
return;
}
store.recordRun({
meta: {
timestamp: '2026-07-04T10:17:51.011Z',
sourcesOk: 22,
sourcesDegraded: 7,
sourcesFailed: 0,
},
ideasSource: 'llm',
ideas: [{
title: 'Gold safe-haven hedge',
type: 'HEDGE',
ticker: 'GLD',
confidence: 'MEDIUM',
rationale: 'Geopolitical risk remains elevated.',
risk: 'Risk appetite recovers.',
horizon: 'Weeks',
signals: ['geopolitical escalation'],
source: 'llm',
}],
}, { summary: { direction: 'risk-off' } });
const result = store.listPredictions({ limit: 10 });
assert.equal(result.available, true);
assert.equal(result.predictions.length, 1);
assert.equal(result.predictions[0].title, 'Gold safe-haven hedge');
assert.match(result.predictions[0].stable_id, /^[a-f0-9]{24}$/);
});

48
test/llm-ideas.test.mjs Normal file
View File

@@ -0,0 +1,48 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { generateLLMIdeas } from '../lib/llm/ideas.mjs';
const response = JSON.stringify([{
title: 'Test idea',
type: 'WATCH',
ticker: 'SPY',
confidence: 'LOW',
rationale: 'Test rationale',
risk: 'Test risk',
horizon: 'Days',
signals: ['test'],
}]);
test('idea generation respects provider token and timeout configuration', async () => {
let capturedOptions;
const provider = {
isConfigured: true,
maxTokens: 2000,
timeoutMs: 300000,
async complete(_systemPrompt, _context, options) {
capturedOptions = options;
return { text: response };
},
};
const ideas = await generateLLMIdeas(provider, {}, null, []);
assert.deepEqual(capturedOptions, { maxTokens: 2000, timeout: 300000 });
assert.equal(ideas.length, 1);
assert.equal(ideas[0].source, 'llm');
});
test('idea generation keeps safe defaults for providers without limits', async () => {
let capturedOptions;
const provider = {
isConfigured: true,
async complete(_systemPrompt, _context, options) {
capturedOptions = options;
return { text: response };
},
};
await generateLLMIdeas(provider, {}, null, []);
assert.deepEqual(capturedOptions, { maxTokens: 4096, timeout: 90000 });
});