hub-proposal-review-hints-job.mjs
27 lines 1.3 KB
Raw
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd feat(calendar): enforce agent context tiers in retrieval AP… Human minor ⚠ breaking 2 days ago
1 /**
2 * Optional async LLM text for human reviewers only (never merge authority).
3 * Env: KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS=1
4 */
5
6 import { completeChat } from './llm-complete.mjs';
7 import { getProposal, updateProposalReviewHints } from '../hub/proposals-store.mjs';
8
9 /**
10 * @param {{ data_dir: string, llm?: { openai_chat_model?: string, ollama_chat_model?: string } }} config
11 * @param {string} proposalId
12 */
13 export async function runProposalReviewHintsJob(config, proposalId) {
14 const p = getProposal(config.data_dir, proposalId);
15 if (!p || p.status !== 'proposed') return;
16 const system =
17 'You assist human proposal reviewers. Reply with plain text only: 2–6 short lines (risks, unclear scope, things to verify). Do not say pass/fail or approve; output is untrusted hints.';
18 const user = `Path: ${p.path}\nQueue: ${p.review_queue || '—'}\n---\n${String(p.body || '').slice(0, 12_000)}`;
19 const raw = await completeChat(config, { system, user, maxTokens: 400 });
20 const model = process.env.OPENAI_API_KEY
21 ? process.env.OPENAI_CHAT_MODEL || config.llm?.openai_chat_model || 'gpt-4o-mini'
22 : process.env.OLLAMA_CHAT_MODEL || config.llm?.ollama_chat_model || process.env.OLLAMA_MODEL || 'ollama';
23 updateProposalReviewHints(config.data_dir, proposalId, {
24 review_hints: raw.slice(0, 8000),
25 review_hints_model: String(model).slice(0, 128),
26 });
27 }
File History 2 commits
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd feat(calendar): enforce agent context tiers in retrieval AP… Human minor 2 days ago
sha256:9103f98c89257ed2b01c237cea895dabb3e85ea337dccb1161c175e4422355b6 docs: accept Calendar Events v0 spec with Phase 0 security … Human 3 days ago