labgate 0.5.31 → 0.5.33
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/README.md +50 -2
- package/dist/cli.js +533 -0
- package/dist/cli.js.map +1 -1
- package/dist/lib/config.d.ts +11 -0
- package/dist/lib/config.js +45 -4
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/container.d.ts +3 -3
- package/dist/lib/container.js +144 -12
- package/dist/lib/container.js.map +1 -1
- package/dist/lib/display-mcp.d.ts +10 -0
- package/dist/lib/display-mcp.js +160 -0
- package/dist/lib/display-mcp.js.map +1 -0
- package/dist/lib/display-store.d.ts +24 -0
- package/dist/lib/display-store.js +150 -0
- package/dist/lib/display-store.js.map +1 -0
- package/dist/lib/explorer-autopilot.d.ts +16 -0
- package/dist/lib/explorer-autopilot.js +573 -0
- package/dist/lib/explorer-autopilot.js.map +1 -0
- package/dist/lib/explorer-claude.d.ts +16 -0
- package/dist/lib/explorer-claude.js +361 -0
- package/dist/lib/explorer-claude.js.map +1 -0
- package/dist/lib/explorer-compare.d.ts +9 -0
- package/dist/lib/explorer-compare.js +190 -0
- package/dist/lib/explorer-compare.js.map +1 -0
- package/dist/lib/explorer-eval.d.ts +23 -0
- package/dist/lib/explorer-eval.js +161 -0
- package/dist/lib/explorer-eval.js.map +1 -0
- package/dist/lib/explorer-gc.d.ts +11 -0
- package/dist/lib/explorer-gc.js +304 -0
- package/dist/lib/explorer-gc.js.map +1 -0
- package/dist/lib/explorer-git.d.ts +14 -0
- package/dist/lib/explorer-git.js +136 -0
- package/dist/lib/explorer-git.js.map +1 -0
- package/dist/lib/explorer-lock.d.ts +5 -0
- package/dist/lib/explorer-lock.js +100 -0
- package/dist/lib/explorer-lock.js.map +1 -0
- package/dist/lib/explorer-mcp.d.ts +11 -0
- package/dist/lib/explorer-mcp.js +611 -0
- package/dist/lib/explorer-mcp.js.map +1 -0
- package/dist/lib/explorer-retention.d.ts +4 -0
- package/dist/lib/explorer-retention.js +58 -0
- package/dist/lib/explorer-retention.js.map +1 -0
- package/dist/lib/explorer-store.d.ts +77 -0
- package/dist/lib/explorer-store.js +950 -0
- package/dist/lib/explorer-store.js.map +1 -0
- package/dist/lib/explorer-types.d.ts +161 -0
- package/dist/lib/explorer-types.js +3 -0
- package/dist/lib/explorer-types.js.map +1 -0
- package/dist/lib/explorer.d.ts +31 -0
- package/dist/lib/explorer.js +247 -0
- package/dist/lib/explorer.js.map +1 -0
- package/dist/lib/results-store.js +37 -3
- package/dist/lib/results-store.js.map +1 -1
- package/dist/lib/test/integration-harness.js +1 -1
- package/dist/lib/test/integration-harness.js.map +1 -1
- package/dist/lib/ui.html +5115 -2052
- package/dist/lib/ui.js +906 -39
- package/dist/lib/ui.js.map +1 -1
- package/dist/lib/web-terminal.js +4 -3
- package/dist/lib/web-terminal.js.map +1 -1
- package/dist/mcp-bundles/dataset-mcp.bundle.mjs +0 -8
- package/dist/mcp-bundles/display-mcp.bundle.mjs +30209 -0
- package/dist/mcp-bundles/explorer-mcp.bundle.mjs +40036 -0
- package/dist/mcp-bundles/results-mcp.bundle.mjs +30 -4
- package/package.json +3 -2
- package/templates/tsp-lab/API_CONTRACT.md +20 -0
- package/templates/tsp-lab/EVAL.md +20 -0
- package/templates/tsp-lab/PROBLEM.md +18 -0
- package/templates/tsp-lab/data/generate_instances.py +51 -0
- package/templates/tsp-lab/data/instances.jsonl +12 -0
- package/templates/tsp-lab/eval.py +148 -0
- package/templates/tsp-lab/solver.py +88 -0
- package/templates/tsp-lab/stub-patches/enable_two_opt.patch +14 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultRetentionPolicy = defaultRetentionPolicy;
|
|
4
|
+
exports.normalizeRetentionPolicy = normalizeRetentionPolicy;
|
|
5
|
+
exports.mergeRetentionPolicy = mergeRetentionPolicy;
|
|
6
|
+
const DEFAULT_RETENTION_POLICY = {
|
|
7
|
+
keep_worktrees: false,
|
|
8
|
+
artifacts: 'minimal',
|
|
9
|
+
keep_last_n: 50,
|
|
10
|
+
keep_best: true,
|
|
11
|
+
keep_failed_last_n: 20,
|
|
12
|
+
max_delete_runs: 200,
|
|
13
|
+
};
|
|
14
|
+
function clampInt(value, fallback, min, max) {
|
|
15
|
+
const parsed = Number(value);
|
|
16
|
+
if (!Number.isFinite(parsed))
|
|
17
|
+
return fallback;
|
|
18
|
+
return Math.max(min, Math.min(max, Math.floor(parsed)));
|
|
19
|
+
}
|
|
20
|
+
function normalizeArtifactMode(value) {
|
|
21
|
+
const mode = String(value || '').trim().toLowerCase();
|
|
22
|
+
if (mode === 'all' || mode === 'minimal' || mode === 'none') {
|
|
23
|
+
return mode;
|
|
24
|
+
}
|
|
25
|
+
return DEFAULT_RETENTION_POLICY.artifacts;
|
|
26
|
+
}
|
|
27
|
+
function defaultRetentionPolicy() {
|
|
28
|
+
return { ...DEFAULT_RETENTION_POLICY };
|
|
29
|
+
}
|
|
30
|
+
function normalizeRetentionPolicy(input) {
|
|
31
|
+
const obj = input && typeof input === 'object' && !Array.isArray(input)
|
|
32
|
+
? input
|
|
33
|
+
: {};
|
|
34
|
+
const pruneAfterRaw = obj.prune_artifacts_after_days;
|
|
35
|
+
const pruneAfterParsed = Number(pruneAfterRaw);
|
|
36
|
+
const pruneAfter = Number.isFinite(pruneAfterParsed)
|
|
37
|
+
? Math.max(1, Math.min(3650, Math.floor(pruneAfterParsed)))
|
|
38
|
+
: undefined;
|
|
39
|
+
return {
|
|
40
|
+
keep_worktrees: obj.keep_worktrees === true,
|
|
41
|
+
artifacts: normalizeArtifactMode(obj.artifacts),
|
|
42
|
+
keep_last_n: clampInt(obj.keep_last_n, DEFAULT_RETENTION_POLICY.keep_last_n, 0, 100_000),
|
|
43
|
+
keep_best: obj.keep_best !== false,
|
|
44
|
+
keep_failed_last_n: clampInt(obj.keep_failed_last_n, DEFAULT_RETENTION_POLICY.keep_failed_last_n, 0, 100_000),
|
|
45
|
+
prune_artifacts_after_days: pruneAfter,
|
|
46
|
+
max_delete_runs: clampInt(obj.max_delete_runs, DEFAULT_RETENTION_POLICY.max_delete_runs || 200, 1, 10_000),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function mergeRetentionPolicy(base, override) {
|
|
50
|
+
if (!override)
|
|
51
|
+
return { ...base };
|
|
52
|
+
const merged = {
|
|
53
|
+
...base,
|
|
54
|
+
...override,
|
|
55
|
+
};
|
|
56
|
+
return normalizeRetentionPolicy(merged);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=explorer-retention.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explorer-retention.js","sourceRoot":"","sources":["../../src/lib/explorer-retention.ts"],"names":[],"mappings":";;AAyBA,wDAEC;AAED,4DAoBC;AAED,oDAOC;AAxDD,MAAM,wBAAwB,GAAoB;IAChD,cAAc,EAAE,KAAK;IACrB,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,EAAE;IACf,SAAS,EAAE,IAAI;IACf,kBAAkB,EAAE,EAAE;IACtB,eAAe,EAAE,GAAG;CACrB,CAAC;AAEF,SAAS,QAAQ,CAAC,KAAc,EAAE,QAAgB,EAAE,GAAW,EAAE,GAAW;IAC1E,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC9C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAc;IAC3C,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,IA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AAC,eAAe,EAAE,wBAAwB,CAAC,eAAe,IAAI,GAAG,EAAE,CAAC,EAAE,MAAM,CAAC;KAC3G,CAAC;AACJ,CAAC;AAED,SAAgB,oBAAoB,CAAC,IAAqB,EAAE,QAA0C;IACpG,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;IAClC,MAAM,MAAM,GAA4B;QACtC,GAAG,IAAI;QACP,GAAG,QAAQ;KACZ,CAAC;IACF,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ArtifactRetentionMode, EventType, ExperimentStatus, ExplorerEvent, ExplorerExperiment, ExplorerRun, ExperimentOverview, LeaderboardRow, RunStatus, TreeView } from './explorer-types.js';
|
|
2
|
+
export interface CreateExperimentInput {
|
|
3
|
+
id?: string;
|
|
4
|
+
name: string;
|
|
5
|
+
repo_path: string;
|
|
6
|
+
base_ref: string;
|
|
7
|
+
eval_command: string;
|
|
8
|
+
eval_timeout_sec?: number;
|
|
9
|
+
policy_json?: string;
|
|
10
|
+
constraints_json?: string;
|
|
11
|
+
prompt_preamble?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CreateRunInput {
|
|
14
|
+
id?: string;
|
|
15
|
+
experiment_id: string;
|
|
16
|
+
parent_run_id?: string | null;
|
|
17
|
+
parent_commit_sha: string;
|
|
18
|
+
branch_name: string;
|
|
19
|
+
worktree_path: string;
|
|
20
|
+
model?: string;
|
|
21
|
+
artifact_dir: string;
|
|
22
|
+
}
|
|
23
|
+
export interface RecordRunResultInput {
|
|
24
|
+
status: RunStatus;
|
|
25
|
+
score?: number | null;
|
|
26
|
+
metrics_json?: string | null;
|
|
27
|
+
summary_md?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ListRunsOptions {
|
|
30
|
+
limit?: number;
|
|
31
|
+
offset?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface ListEventsOptions {
|
|
34
|
+
limit?: number;
|
|
35
|
+
offset?: number;
|
|
36
|
+
}
|
|
37
|
+
export declare function makeExplorerExperimentId(): string;
|
|
38
|
+
export declare function makeExplorerRunId(): string;
|
|
39
|
+
export declare class ExplorerStore {
|
|
40
|
+
private readonly dbPath;
|
|
41
|
+
private db;
|
|
42
|
+
private useJsonFallback;
|
|
43
|
+
private jsonPath;
|
|
44
|
+
private jsonStore;
|
|
45
|
+
constructor(dbPath?: string);
|
|
46
|
+
getPath(): string;
|
|
47
|
+
createExperiment(input: CreateExperimentInput): ExplorerExperiment;
|
|
48
|
+
listExperiments(limit?: number, offset?: number): ExplorerExperiment[];
|
|
49
|
+
getExperiment(experimentId: string): ExplorerExperiment | null;
|
|
50
|
+
setExperimentStatus(experimentId: string, status: ExperimentStatus): boolean;
|
|
51
|
+
createRun(input: CreateRunInput): ExplorerRun;
|
|
52
|
+
markRunStarted(runId: string): boolean;
|
|
53
|
+
recordRunCommit(runId: string, commitSha: string): boolean;
|
|
54
|
+
recordRunResult(runId: string, result: RecordRunResultInput): boolean;
|
|
55
|
+
getRun(runId: string): ExplorerRun | null;
|
|
56
|
+
listRuns(experimentId: string, opts?: ListRunsOptions): ExplorerRun[];
|
|
57
|
+
getBestRun(experimentId: string): ExplorerRun | null;
|
|
58
|
+
hasActiveRun(experimentId: string): boolean;
|
|
59
|
+
listActiveRuns(experimentId: string): ExplorerRun[];
|
|
60
|
+
getRunCount(experimentId: string): number;
|
|
61
|
+
getRunStatusCounts(experimentId: string): Record<RunStatus, number>;
|
|
62
|
+
getLatestRun(experimentId: string): ExplorerRun | null;
|
|
63
|
+
getExperimentOverview(experimentId: string): ExperimentOverview | null;
|
|
64
|
+
getRetentionPolicy(experimentId: string): import("./explorer-types.js").RetentionPolicy;
|
|
65
|
+
setRetentionPolicy(experimentId: string, retention: unknown): boolean;
|
|
66
|
+
setRunWorktreePruned(runId: string, prunedAt?: string): boolean;
|
|
67
|
+
setRunArtifactsPruned(runId: string, modeKept: ArtifactRetentionMode, prunedAt?: string): boolean;
|
|
68
|
+
listFinishedRuns(experimentId: string): ExplorerRun[];
|
|
69
|
+
createEvent(experimentId: string, type: EventType, payload: Record<string, unknown>, runId?: string | null): ExplorerEvent;
|
|
70
|
+
listEvents(experimentId: string, opts?: ListEventsOptions): ExplorerEvent[];
|
|
71
|
+
getLeaderboard(experimentId: string, topK?: number): LeaderboardRow[];
|
|
72
|
+
getTree(experimentId: string, mode?: 'best_path' | 'full'): TreeView;
|
|
73
|
+
close(): void;
|
|
74
|
+
private getAllRunsForTree;
|
|
75
|
+
private loadJson;
|
|
76
|
+
private flushJson;
|
|
77
|
+
}
|