openmerit 0.1.4 → 0.1.6-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +121 -386
- package/dist/core/src/index.d.ts +101 -0
- package/dist/core/src/index.js +1649 -0
- package/dist/core/src/store.d.ts +35 -0
- package/dist/core/src/store.js +102 -0
- package/dist/pi/src/index.d.ts +32 -0
- package/dist/pi/src/index.js +794 -0
- package/dist/pi/src/scheduler.d.ts +11 -0
- package/dist/pi/src/scheduler.js +137 -0
- package/dist/pi/src/wakeup.d.ts +2 -0
- package/dist/pi/src/wakeup.js +108 -0
- package/dist/protocol/src/index.d.ts +484 -0
- package/dist/protocol/src/index.js +47 -0
- package/dist/protocol/src/schemas.d.ts +576 -0
- package/dist/protocol/src/schemas.js +280 -0
- package/dist/terminal/public/app.js +297 -0
- package/dist/terminal/public/brands/anthropic.png +0 -0
- package/dist/terminal/public/brands/baai.png +0 -0
- package/dist/terminal/public/brands/baseten.png +0 -0
- package/dist/terminal/public/brands/cerebras.png +0 -0
- package/dist/terminal/public/brands/cohere.png +0 -0
- package/dist/terminal/public/brands/deepseek.ico +0 -0
- package/dist/terminal/public/brands/google.png +0 -0
- package/dist/terminal/public/brands/groq.ico +0 -0
- package/dist/terminal/public/brands/lm-studio.png +0 -0
- package/dist/terminal/public/brands/meta.ico +0 -0
- package/dist/terminal/public/brands/mistral.png +0 -0
- package/dist/terminal/public/brands/nomic.png +0 -0
- package/dist/terminal/public/brands/ollama.png +0 -0
- package/dist/terminal/public/brands/openai.png +0 -0
- package/dist/terminal/public/brands/openrouter.png +0 -0
- package/dist/terminal/public/brands/qwen.png +0 -0
- package/dist/terminal/public/brands/vllm.ico +0 -0
- package/dist/terminal/public/brands/vllm.png +0 -0
- package/dist/terminal/public/favicon.svg +1 -0
- package/dist/terminal/public/flow.css +1 -0
- package/dist/terminal/public/flow.js +770 -0
- package/dist/terminal/public/index.html +21 -0
- package/dist/terminal/public/styles.css +779 -0
- package/dist/terminal/src/activity-merge.mjs +64 -0
- package/dist/terminal/src/browser.mjs +29 -0
- package/dist/terminal/src/cli.mjs +60 -0
- package/dist/terminal/src/collect.mjs +311 -0
- package/dist/terminal/src/discovery.mjs +93 -0
- package/dist/terminal/src/hardware.mjs +57 -0
- package/dist/terminal/src/project-activity.mjs +156 -0
- package/dist/terminal/src/sample.mjs +171 -0
- package/dist/terminal/src/server.mjs +56 -0
- package/dist/terminal/src/services.mjs +62 -0
- package/dist/terminal/src/topology.mjs +30 -0
- package/docs/adapter-guide.md +189 -0
- package/docs/architecture.md +59 -0
- package/docs/automation.md +74 -0
- package/docs/budgets.md +37 -0
- package/docs/commands.md +85 -0
- package/docs/demo-backfill.md +29 -0
- package/docs/demo-fieldkit.md +47 -0
- package/docs/demo-placement.md +30 -0
- package/docs/demo-spam.md +15 -0
- package/docs/demo-support.md +42 -0
- package/docs/demo.md +57 -0
- package/docs/first-trial.md +60 -0
- package/docs/getting-started.md +65 -0
- package/docs/index.md +40 -0
- package/docs/inference-terminal.md +439 -0
- package/docs/lifecycle.md +30 -0
- package/docs/memo.md +126 -0
- package/docs/metrics-and-evidence.md +48 -0
- package/docs/operations.md +40 -0
- package/docs/pareto-spec.md +76 -0
- package/docs/pi-extension.md +54 -0
- package/docs/roadmap.md +28 -0
- package/docs/security.md +37 -0
- package/docs/site-artwork-linocut.md +23 -0
- package/docs/site-artwork-miniature-diverse.md +28 -0
- package/docs/site-artwork-miniature.md +26 -0
- package/docs/site-demo.md +177 -0
- package/docs/site-design.md +94 -0
- package/docs/site-documentation.md +83 -0
- package/docs/site-dynamic-og.md +35 -0
- package/docs/site-faq-maintenance.md +115 -0
- package/docs/site-hero-resolution.md +60 -0
- package/docs/site-illustration-sequences.md +227 -0
- package/docs/site-inference-terminal.md +203 -0
- package/docs/site-memo.md +39 -0
- package/docs/site-og-image.md +38 -0
- package/docs/site-og-workshop.md +21 -0
- package/docs/site-section-artwork.md +56 -0
- package/docs/site-skill-review.md +57 -0
- package/docs/site-terminal-preview.md +85 -0
- package/docs/testing.md +118 -0
- package/docs/troubleshooting.md +55 -0
- package/docs/ux-reference.md +32 -0
- package/package.json +74 -42
- package/benchmark/invoice_ocr/data/invoice_01_ground_truth.json +0 -38
- package/benchmark/invoice_ocr/data/invoice_01_row_2.jpg +0 -0
- package/benchmark/invoice_ocr/data/invoice_02_ground_truth.json +0 -32
- package/benchmark/invoice_ocr/data/invoice_02_row_5.jpg +0 -0
- package/benchmark/invoice_ocr/data/invoice_03_ground_truth.json +0 -26
- package/benchmark/invoice_ocr/data/invoice_03_row_6.jpg +0 -0
- package/benchmark/invoice_ocr/data/invoice_04_ground_truth.json +0 -26
- package/benchmark/invoice_ocr/data/invoice_04_row_7.jpg +0 -0
- package/benchmark/invoice_ocr/data/invoice_05_ground_truth.json +0 -38
- package/benchmark/invoice_ocr/data/invoice_05_row_947.jpg +0 -0
- package/benchmark/invoice_ocr/data/invoice_06_ground_truth.json +0 -38
- package/benchmark/invoice_ocr/data/invoice_06_row_948.jpg +0 -0
- package/benchmark/invoice_ocr/data/invoice_07_ground_truth.json +0 -20
- package/benchmark/invoice_ocr/data/invoice_07_row_949.jpg +0 -0
- package/benchmark/invoice_ocr/data/invoice_08_ground_truth.json +0 -38
- package/benchmark/invoice_ocr/data/invoice_08_row_1888.jpg +0 -0
- package/benchmark/invoice_ocr/data/invoice_09_ground_truth.json +0 -26
- package/benchmark/invoice_ocr/data/invoice_09_row_1890.jpg +0 -0
- package/benchmark/invoice_ocr/data/invoice_10_ground_truth.json +0 -20
- package/benchmark/invoice_ocr/data/invoice_10_row_1892.jpg +0 -0
- package/benchmark/invoice_ocr/data/manifest.json +0 -97
- package/dist/benchmarks.js +0 -98
- package/dist/catalog.js +0 -61
- package/dist/cli.js +0 -188
- package/dist/daemon.js +0 -407
- package/dist/diagnostics.js +0 -227
- package/dist/frontier.js +0 -56
- package/dist/harness.js +0 -1
- package/dist/integrations.js +0 -19
- package/dist/invoice-eval.js +0 -33
- package/dist/invoice-score.js +0 -124
- package/dist/judge.js +0 -43
- package/dist/llm.js +0 -207
- package/dist/pi-config.js +0 -46
- package/dist/pi-trials.js +0 -373
- package/dist/policy.js +0 -185
- package/dist/providers.js +0 -1
- package/dist/recommend.js +0 -76
- package/dist/routes.js +0 -74
- package/dist/standalone.js +0 -224
- package/dist/store.js +0 -89
- package/dist/strategist.js +0 -68
- package/dist/task-input.js +0 -54
- package/dist/traces.js +0 -127
- package/dist/trials.js +0 -140
- package/dist/types.js +0 -2
- package/examples/invoice-prompt.txt +0 -19
- package/examples/task.example.json +0 -7
- package/extension/openmerit.ts +0 -947
- package/instructions/OPENMERIT.md +0 -63
- package/instructions/openmerit.policy.json +0 -37
- package/rules.md +0 -43
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { EvidenceManifest, OpenMeritAuditEvent, OpenMeritProjectConfig, OpenMeritProjectState } from "../../protocol/src/index.ts";
|
|
2
|
+
export declare const OPENMERIT_DIRECTORY = ".openmerit";
|
|
3
|
+
export interface OpenMeritStore {
|
|
4
|
+
initialize(config: OpenMeritProjectConfig, state: OpenMeritProjectState): Promise<void>;
|
|
5
|
+
readConfig(): Promise<OpenMeritProjectConfig | undefined>;
|
|
6
|
+
writeConfig(config: OpenMeritProjectConfig): Promise<void>;
|
|
7
|
+
readState(): Promise<OpenMeritProjectState | undefined>;
|
|
8
|
+
writeState(state: OpenMeritProjectState): Promise<void>;
|
|
9
|
+
appendEvent(event: OpenMeritAuditEvent): Promise<void>;
|
|
10
|
+
writeEvidenceManifest(manifest: EvidenceManifest): Promise<string>;
|
|
11
|
+
}
|
|
12
|
+
export interface AuditEventExporter {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
export(event: OpenMeritAuditEvent): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export interface ProjectStoreOptions {
|
|
17
|
+
readonly eventExporters?: readonly AuditEventExporter[];
|
|
18
|
+
}
|
|
19
|
+
export declare class ProjectStore implements OpenMeritStore {
|
|
20
|
+
readonly directory: string;
|
|
21
|
+
readonly configPath: string;
|
|
22
|
+
readonly statePath: string;
|
|
23
|
+
readonly eventsPath: string;
|
|
24
|
+
readonly exportErrorsPath: string;
|
|
25
|
+
readonly evidenceDirectory: string;
|
|
26
|
+
private readonly eventExporters;
|
|
27
|
+
constructor(projectRoot: string, options?: ProjectStoreOptions);
|
|
28
|
+
initialize(config: OpenMeritProjectConfig, state: OpenMeritProjectState): Promise<void>;
|
|
29
|
+
readConfig(): Promise<OpenMeritProjectConfig | undefined>;
|
|
30
|
+
writeConfig(config: OpenMeritProjectConfig): Promise<void>;
|
|
31
|
+
readState(): Promise<OpenMeritProjectState | undefined>;
|
|
32
|
+
writeState(state: OpenMeritProjectState): Promise<void>;
|
|
33
|
+
appendEvent(event: OpenMeritAuditEvent): Promise<void>;
|
|
34
|
+
writeEvidenceManifest(manifest: EvidenceManifest): Promise<string>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { appendFile, mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
export const OPENMERIT_DIRECTORY = ".openmerit";
|
|
4
|
+
export class ProjectStore {
|
|
5
|
+
directory;
|
|
6
|
+
configPath;
|
|
7
|
+
statePath;
|
|
8
|
+
eventsPath;
|
|
9
|
+
exportErrorsPath;
|
|
10
|
+
evidenceDirectory;
|
|
11
|
+
eventExporters;
|
|
12
|
+
constructor(projectRoot, options = {}) {
|
|
13
|
+
this.directory = join(projectRoot, OPENMERIT_DIRECTORY);
|
|
14
|
+
this.configPath = join(this.directory, "config.json");
|
|
15
|
+
this.statePath = join(this.directory, "state.json");
|
|
16
|
+
this.eventsPath = join(this.directory, "events.jsonl");
|
|
17
|
+
this.exportErrorsPath = join(this.directory, "audit-export-errors.jsonl");
|
|
18
|
+
this.evidenceDirectory = join(this.directory, "evidence");
|
|
19
|
+
this.eventExporters = options.eventExporters ?? [];
|
|
20
|
+
}
|
|
21
|
+
async initialize(config, state) {
|
|
22
|
+
await mkdir(this.evidenceDirectory, { recursive: true });
|
|
23
|
+
await this.writeConfig(config);
|
|
24
|
+
await this.writeState(state);
|
|
25
|
+
}
|
|
26
|
+
async readConfig() {
|
|
27
|
+
return readJsonIfPresent(this.configPath);
|
|
28
|
+
}
|
|
29
|
+
async writeConfig(config) {
|
|
30
|
+
await atomicWriteJson(this.configPath, config);
|
|
31
|
+
}
|
|
32
|
+
async readState() {
|
|
33
|
+
return readJsonIfPresent(this.statePath);
|
|
34
|
+
}
|
|
35
|
+
async writeState(state) {
|
|
36
|
+
await atomicWriteJson(this.statePath, state);
|
|
37
|
+
}
|
|
38
|
+
async appendEvent(event) {
|
|
39
|
+
await mkdir(dirname(this.eventsPath), { recursive: true });
|
|
40
|
+
const safeEvent = redactSensitive(event);
|
|
41
|
+
await appendFile(this.eventsPath, `${JSON.stringify(safeEvent)}\n`, { encoding: "utf8", mode: 0o600 });
|
|
42
|
+
const results = await Promise.allSettled(this.eventExporters.map((exporter) => exporter.export(safeEvent)));
|
|
43
|
+
for (const [index, result] of results.entries()) {
|
|
44
|
+
if (result.status === "fulfilled")
|
|
45
|
+
continue;
|
|
46
|
+
await appendFile(this.exportErrorsPath, `${JSON.stringify({
|
|
47
|
+
occurredAt: new Date().toISOString(),
|
|
48
|
+
eventId: safeEvent.id,
|
|
49
|
+
exporterId: this.eventExporters[index]?.id ?? "unknown",
|
|
50
|
+
error: safeErrorMessage(result.reason),
|
|
51
|
+
})}\n`, { encoding: "utf8", mode: 0o600 });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async writeEvidenceManifest(manifest) {
|
|
55
|
+
const path = join(this.evidenceDirectory, `${safeFileComponent(manifest.id)}.json`);
|
|
56
|
+
await atomicWriteJson(path, redactSensitive(manifest));
|
|
57
|
+
return path;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const SENSITIVE_KEY = /(?:authorization|api[_-]?key|token|secret|password|cookie)/i;
|
|
61
|
+
const SECRET_VALUE = /\b(?:sk-[a-zA-Z0-9_-]{12,}|apikey_[a-zA-Z0-9_-]{12,})\b/g;
|
|
62
|
+
function redactSensitive(value, key) {
|
|
63
|
+
if (key && SENSITIVE_KEY.test(key))
|
|
64
|
+
return "[REDACTED]";
|
|
65
|
+
if (typeof value === "string")
|
|
66
|
+
return value.replaceAll(SECRET_VALUE, "[REDACTED]");
|
|
67
|
+
if (Array.isArray(value))
|
|
68
|
+
return value.map((item) => redactSensitive(item));
|
|
69
|
+
if (value && typeof value === "object") {
|
|
70
|
+
return Object.fromEntries(Object.entries(value).map(([childKey, child]) => [
|
|
71
|
+
childKey,
|
|
72
|
+
redactSensitive(child, childKey),
|
|
73
|
+
]));
|
|
74
|
+
}
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
function safeErrorMessage(reason) {
|
|
78
|
+
const message = reason instanceof Error ? reason.message : String(reason);
|
|
79
|
+
return redactSensitive(message);
|
|
80
|
+
}
|
|
81
|
+
function safeFileComponent(value) {
|
|
82
|
+
const safe = value.replaceAll(/[^a-zA-Z0-9._-]/g, "-");
|
|
83
|
+
if (!safe || safe === "." || safe === "..")
|
|
84
|
+
throw new Error("Evidence manifest ID is not file-safe.");
|
|
85
|
+
return safe;
|
|
86
|
+
}
|
|
87
|
+
async function readJsonIfPresent(path) {
|
|
88
|
+
try {
|
|
89
|
+
return JSON.parse(await readFile(path, "utf8"));
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (error.code === "ENOENT")
|
|
93
|
+
return undefined;
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async function atomicWriteJson(path, value) {
|
|
98
|
+
await mkdir(dirname(path), { recursive: true });
|
|
99
|
+
const temporaryPath = `${path}.${process.pid}.${crypto.randomUUID()}.tmp`;
|
|
100
|
+
await writeFile(temporaryPath, `${JSON.stringify(value, null, 2)}\n`, { encoding: "utf8", mode: 0o600 });
|
|
101
|
+
await rename(temporaryPath, path);
|
|
102
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { type HarnessDescriptor, type ImprovementStage } from "../../protocol/src/index.ts";
|
|
3
|
+
export declare const PI_HARNESS_DESCRIPTOR: HarnessDescriptor;
|
|
4
|
+
export interface OpenMeritUiState {
|
|
5
|
+
proactiveNudgesPaused: boolean;
|
|
6
|
+
applicationTarget: "not_detected" | "detected" | "confirmed";
|
|
7
|
+
taskProfile: "not_configured" | "pending" | "configured";
|
|
8
|
+
metricReadiness: "not_assessed" | "pending" | "assessed";
|
|
9
|
+
evaluationReadiness: "not_assessed" | "pending" | "assessed";
|
|
10
|
+
activeIntent: string | null;
|
|
11
|
+
nextAssessment: string | null;
|
|
12
|
+
lifecycleStage: ImprovementStage | "not_initialized";
|
|
13
|
+
incumbentCandidate: string | null;
|
|
14
|
+
candidateCount: number;
|
|
15
|
+
assessmentCount: number;
|
|
16
|
+
evaluationSpend: number;
|
|
17
|
+
proposedCandidate: string | null;
|
|
18
|
+
}
|
|
19
|
+
export declare function createInitialUiState(): OpenMeritUiState;
|
|
20
|
+
export declare function renderStatus(state: OpenMeritUiState): string;
|
|
21
|
+
export interface DetectedApplicationLlmTarget {
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly kind: "application_llm_call";
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly applicationId: string;
|
|
26
|
+
readonly callSites: readonly string[];
|
|
27
|
+
readonly routeKey: string;
|
|
28
|
+
readonly configuredModelId?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Bounded, adapter-local detection. It requires an actual application call pattern, not only an SDK dependency. */
|
|
31
|
+
export declare function detectApplicationLlmTargets(projectRoot: string): readonly DetectedApplicationLlmTarget[];
|
|
32
|
+
export default function openMeritExtension(pi: ExtensionAPI): void;
|