hub-proposal-review-hints-job.mjs
27 lines 1.3 KB
Raw
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf mirror: GitHub Phase A durable MCP OAuth (#270) Human minor ⚠ breaking 10 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 4 commits
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf mirror: GitHub Phase A durable MCP OAuth (#270) Human minor 10 days ago
sha256:d8c648b20a4d53b2673c5c082ee7edfa7b2fc9b11080832da1f38807b6bf940b fix(7C-L1b): route hosted delegation proposals through cani… Human minor 30 days ago
sha256:2827ba9e7632a4b141c50caf1e8f7d77abbc3515be20e7465f2bccb0ac4edf91 fix: repair endpoint now sets has_active_subscription when … Human minor 49 days ago