-
Notifications
You must be signed in to change notification settings - Fork 0
Add evidence-backed terminal outcome learning #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| const DEFAULT_DASHBOARD_PORT = 3000; | ||
|
|
||
| export function resolveDashboardPort(env: NodeJS.ProcessEnv = process.env): number { | ||
| const raw = env.PROMPT_REFINER_DASHBOARD_PORT || env.PORT; | ||
| if (!raw) return DEFAULT_DASHBOARD_PORT; | ||
| const parsed = Number(raw); | ||
| if (!Number.isInteger(parsed) || parsed < 1 || parsed > 65_535) { | ||
| throw new Error(`Invalid dashboard port: ${raw}`); | ||
| } | ||
| return parsed; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,6 +56,15 @@ CREATE TABLE IF NOT EXISTS executions ( | |
| artifacts_json TEXT NOT NULL DEFAULT '{}' | ||
| ); | ||
|
|
||
| CREATE TABLE IF NOT EXISTS terminal_outcomes ( | ||
| goal_id TEXT PRIMARY KEY, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the shared event store is used for multiple repositories, this primary key makes Useful? React with 👍 / 👎. |
||
| repo_id TEXT, | ||
| status TEXT NOT NULL, | ||
| evidence_json TEXT NOT NULL, | ||
| summary TEXT NOT NULL, | ||
| created_at TEXT NOT NULL | ||
| ); | ||
|
|
||
| CREATE TABLE IF NOT EXISTS tests ( | ||
| id TEXT PRIMARY KEY, | ||
| execution_id TEXT NOT NULL, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| import { resolveDashboardPort } from "../src/core/ports.js"; | ||
|
|
||
| describe("resolveDashboardPort", () => { | ||
| it("uses the dedicated port, generic fallback, and default in priority order", () => { | ||
| expect(resolveDashboardPort({ PROMPT_REFINER_DASHBOARD_PORT: "4100", PORT: "4200" })).toBe(4100); | ||
| expect(resolveDashboardPort({ PORT: "4200" })).toBe(4200); | ||
| expect(resolveDashboardPort({})).toBe(3000); | ||
| }); | ||
|
|
||
| it.each(["0", "65536", "not-a-number", "1.5"])("rejects invalid port %s", (value) => { | ||
| expect(() => resolveDashboardPort({ PROMPT_REFINER_DASHBOARD_PORT: value })).toThrow( | ||
| `Invalid dashboard port: ${value}`, | ||
| ); | ||
| }); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import * as fs from "fs"; | ||
| import * as os from "os"; | ||
| import * as path from "path"; | ||
|
|
||
| const isolationRoot = fs.mkdtempSync(path.join(os.tmpdir(), "prompt-refiner-tests-")); | ||
| const projectRoot = path.join(isolationRoot, "project"); | ||
|
|
||
| fs.mkdirSync(path.join(projectRoot, ".refiner"), { recursive: true }); | ||
| process.env.PROMPT_REFINER_PROJECT_DIR = projectRoot; | ||
| process.env.PROMPT_REFINER_GLOBAL_DIR = path.join(isolationRoot, "global"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new tool description says it can record an optional review-gated lesson candidate, and
recordTerminalOutcomeonly creates that pending lesson whenoutcome.candidateis present, but this dispatcher schema parses only goal/status/evidence/summary. As a result, clients using the advertised MCP surface have no way to submit the candidate, solist_learning_candidatesremains empty after terminal-outcome recording; include and validate the candidate fields here and in the advertised input schema if this tool is meant to seed review-gated lessons.Useful? React with 👍 / 👎.