@guilz-dev/belay 0.1.1 → 0.3.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/README.md +55 -15
- package/dist/adapters/shared/gate-runtime.js +25 -9
- package/dist/bundle/claude-runtime.mjs +1786 -379
- package/dist/bundle/codex-runtime.mjs +1785 -379
- package/dist/bundle/cursor-runtime.mjs +1786 -379
- package/dist/cli.js +201 -11
- package/dist/commands/approve.js +11 -0
- package/dist/commands/classify-for-report.js +3 -3
- package/dist/commands/config.d.ts +70 -0
- package/dist/commands/config.js +494 -0
- package/dist/commands/doctor.js +3 -2
- package/dist/commands/explain.js +14 -14
- package/dist/commands/health-snapshot.d.ts +6 -0
- package/dist/commands/health-snapshot.js +34 -0
- package/dist/commands/judge.d.ts +90 -0
- package/dist/commands/judge.js +285 -0
- package/dist/commands/recover.js +2 -2
- package/dist/commands/status.js +2 -2
- package/dist/commands/stdin-key.d.ts +1 -0
- package/dist/commands/stdin-key.js +8 -0
- package/dist/conformance/guarantee-table.js +12 -0
- package/dist/conformance/types.d.ts +2 -0
- package/dist/core/approval.d.ts +3 -0
- package/dist/core/approval.js +18 -3
- package/dist/core/audit-io.d.ts +2 -0
- package/dist/core/audit-io.js +14 -0
- package/dist/core/audit-query.js +5 -1
- package/dist/core/capability/index.d.ts +2 -2
- package/dist/core/capability/index.js +2 -2
- package/dist/core/capability/paths.d.ts +1 -0
- package/dist/core/capability/paths.js +74 -6
- package/dist/core/capability/reasons.d.ts +3 -0
- package/dist/core/capability/reasons.js +8 -0
- package/dist/core/classify-tool.js +97 -27
- package/dist/core/config-layers.js +2 -1
- package/dist/core/config.d.ts +23 -3
- package/dist/core/config.js +112 -13
- package/dist/core/credential-store.d.ts +11 -0
- package/dist/core/credential-store.js +60 -0
- package/dist/core/gate-contract.d.ts +1 -1
- package/dist/core/gate-contract.js +1 -1
- package/dist/core/gate-engine.js +105 -14
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +2 -2
- package/dist/core/integrity.d.ts +2 -0
- package/dist/core/integrity.js +13 -0
- package/dist/core/judge-api-key.d.ts +19 -0
- package/dist/core/judge-api-key.js +74 -0
- package/dist/core/judge-cloud-consent.d.ts +13 -0
- package/dist/core/judge-cloud-consent.js +38 -0
- package/dist/core/judge-config.d.ts +45 -4
- package/dist/core/judge-config.js +266 -44
- package/dist/core/judge-doctor.d.ts +6 -1
- package/dist/core/judge-doctor.js +148 -97
- package/dist/core/judge-model-discovery.d.ts +24 -0
- package/dist/core/judge-model-discovery.js +168 -0
- package/dist/core/judge-model-policy.d.ts +5 -0
- package/dist/core/judge-model-policy.js +21 -0
- package/dist/core/judge-runtime-detection.d.ts +9 -0
- package/dist/core/judge-runtime-detection.js +68 -0
- package/dist/core/transactional/diff-evaluator.js +1 -19
- package/dist/core/types.d.ts +7 -3
- package/dist/core/{v2 → verdict}/adapter.d.ts +1 -0
- package/dist/core/{v2 → verdict}/adapter.js +16 -4
- package/dist/core/{v2 → verdict}/containment.d.ts +5 -0
- package/dist/core/{v2 → verdict}/containment.js +32 -2
- package/dist/core/{v2 → verdict}/egress-classify.js +3 -0
- package/dist/core/verdict/judge-catalog.d.ts +40 -0
- package/dist/core/verdict/judge-catalog.js +148 -0
- package/dist/core/verdict/judge-cli.d.ts +23 -0
- package/dist/core/verdict/judge-cli.js +280 -0
- package/dist/core/{v2 → verdict}/judge-factory.d.ts +15 -4
- package/dist/core/verdict/judge-factory.js +178 -0
- package/dist/core/{v2 → verdict}/judge.d.ts +20 -1
- package/dist/core/{v2 → verdict}/judge.js +85 -18
- package/dist/core/{v2 → verdict}/launcher-resolve.js +72 -1
- package/dist/core/verdict/persistent-paths.d.ts +8 -0
- package/dist/core/verdict/persistent-paths.js +52 -0
- package/dist/core/{v2 → verdict}/types.d.ts +6 -2
- package/dist/core/{v2 → verdict}/verdict.js +176 -46
- package/dist/corpus/evaluate.js +2 -2
- package/dist/installer.js +66 -14
- package/dist/types.d.ts +8 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -1
- package/skills/belay/SKILL.md +8 -7
- package/dist/commands/init-wizard.d.ts +0 -16
- package/dist/commands/init-wizard.js +0 -50
- package/dist/core/v2/judge-factory.js +0 -75
- /package/dist/core/{v2 → verdict}/egress-classify.d.ts +0 -0
- /package/dist/core/{v2 → verdict}/fingerprint.d.ts +0 -0
- /package/dist/core/{v2 → verdict}/fingerprint.js +0 -0
- /package/dist/core/{v2 → verdict}/index.d.ts +0 -0
- /package/dist/core/{v2 → verdict}/index.js +0 -0
- /package/dist/core/{v2 → verdict}/judge-audit.d.ts +0 -0
- /package/dist/core/{v2 → verdict}/judge-audit.js +0 -0
- /package/dist/core/{v2 → verdict}/judge-outbound.d.ts +0 -0
- /package/dist/core/{v2 → verdict}/judge-outbound.js +0 -0
- /package/dist/core/{v2 → verdict}/launcher-resolve.d.ts +0 -0
- /package/dist/core/{v2 → verdict}/overrides.d.ts +0 -0
- /package/dist/core/{v2 → verdict}/overrides.js +0 -0
- /package/dist/core/{v2 → verdict}/parser.d.ts +0 -0
- /package/dist/core/{v2 → verdict}/parser.js +0 -0
- /package/dist/core/{v2 → verdict}/types.js +0 -0
- /package/dist/core/{v2 → verdict}/verdict.d.ts +0 -0
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { normalizeJudgeProvider, scrubOptionsFromConfig } from '../config.js';
|
|
4
|
-
import { createDeterministicJudgeStub, createFailClosedJudge, createOllamaJudge, createOpenAiCompatibleJudge, } from './judge.js';
|
|
5
|
-
const FIXTURE_MODELS_URL = new URL('../../../fixtures/judge-models.json', import.meta.url);
|
|
6
|
-
let cachedPinnedModels = null;
|
|
7
|
-
export function resetPinnedJudgeModelsCache() {
|
|
8
|
-
cachedPinnedModels = null;
|
|
9
|
-
}
|
|
10
|
-
export async function loadPinnedJudgeModels() {
|
|
11
|
-
if (cachedPinnedModels) {
|
|
12
|
-
return cachedPinnedModels;
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
const raw = await readFile(fileURLToPath(FIXTURE_MODELS_URL), 'utf8');
|
|
16
|
-
cachedPinnedModels = JSON.parse(raw);
|
|
17
|
-
return cachedPinnedModels;
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
cachedPinnedModels = {
|
|
21
|
-
'openai-compatible': { autoResolved: 'composer-2.5' },
|
|
22
|
-
ollama: { ciPin: 'gemma4:e2b' },
|
|
23
|
-
};
|
|
24
|
-
return cachedPinnedModels;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export function resolveCloudModel(requested, pinned) {
|
|
28
|
-
if (requested === 'auto') {
|
|
29
|
-
const envResolved = process.env.BELAY_JUDGE_MODEL_RESOLVED?.trim();
|
|
30
|
-
return {
|
|
31
|
-
requested,
|
|
32
|
-
resolved: envResolved || pinned.autoResolved,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
return { requested, resolved: requested };
|
|
36
|
-
}
|
|
37
|
-
/** @deprecated Use resolveCloudModel */
|
|
38
|
-
export const resolveCursorModel = resolveCloudModel;
|
|
39
|
-
export function createJudgeFromConfig(config, options = {}) {
|
|
40
|
-
const judgeConfig = config.judge;
|
|
41
|
-
const provider = normalizeJudgeProvider(judgeConfig.provider);
|
|
42
|
-
if (provider === 'openai-compatible') {
|
|
43
|
-
const endpoint = judgeConfig.endpoint?.trim();
|
|
44
|
-
if (!endpoint) {
|
|
45
|
-
return createFailClosedJudge({
|
|
46
|
-
reason: 'openai_compatible_endpoint_missing',
|
|
47
|
-
fallbackReason: 'missing_endpoint',
|
|
48
|
-
modelRequested: judgeConfig.model,
|
|
49
|
-
modelResolved: judgeConfig.model,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
const pinned = options.pinnedModels ?? { autoResolved: 'composer-2.5' };
|
|
53
|
-
const { resolved } = resolveCloudModel(judgeConfig.model, pinned);
|
|
54
|
-
return createOpenAiCompatibleJudge({
|
|
55
|
-
endpoint,
|
|
56
|
-
modelRequested: judgeConfig.model,
|
|
57
|
-
modelResolved: resolved,
|
|
58
|
-
timeoutMs: judgeConfig.timeoutMs,
|
|
59
|
-
sensitivePaths: config.classifier.sensitivePaths,
|
|
60
|
-
scrubOptions: scrubOptionsFromConfig(config),
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
if (provider === 'ollama') {
|
|
64
|
-
return createOllamaJudge({
|
|
65
|
-
model: judgeConfig.model,
|
|
66
|
-
baseUrl: judgeConfig.endpoint ?? 'http://127.0.0.1:11434',
|
|
67
|
-
timeoutMs: judgeConfig.timeoutMs,
|
|
68
|
-
keepAlive: judgeConfig.keepAlive,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return createDeterministicJudgeStub();
|
|
72
|
-
}
|
|
73
|
-
export function judgeConfigSummary(judge) {
|
|
74
|
-
return `${judge.provider}/${judge.model}`;
|
|
75
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|