@warmdrift/kgauto-compiler 2.0.0-alpha.91 → 2.0.0-alpha.93
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/dist/chunk-BTP5WK3B.mjs +3448 -0
- package/dist/{chunk-BVEXV5KC.mjs → chunk-FEMPY6EC.mjs} +5 -1
- package/dist/{chunk-54IXD5BT.mjs → chunk-S4PA2BDB.mjs} +8 -3
- package/dist/{chunk-AUZTO6Q5.mjs → chunk-WFLDRRY7.mjs} +1 -1
- package/dist/{chunk-T53ISC2F.mjs → chunk-YO2ZLPSD.mjs} +10 -0
- package/dist/compile-BlMXv6QT.d.ts +53 -0
- package/dist/compile-C2IfAGV1.d.mts +53 -0
- package/dist/dialect.d.mts +11 -1
- package/dist/dialect.d.ts +11 -1
- package/dist/dialect.js +7 -2
- package/dist/dialect.mjs +5 -3
- package/dist/glassbox/index.d.mts +3 -3
- package/dist/glassbox/index.d.ts +3 -3
- package/dist/glassbox-routes/format.d.mts +2 -2
- package/dist/glassbox-routes/format.d.ts +2 -2
- package/dist/glassbox-routes/index.d.mts +4 -4
- package/dist/glassbox-routes/index.d.ts +4 -4
- package/dist/glassbox-routes/index.js +7 -2
- package/dist/glassbox-routes/index.mjs +2 -2
- package/dist/glassbox-routes/react/index.d.mts +2 -2
- package/dist/glassbox-routes/react/index.d.ts +2 -2
- package/dist/index.d.mts +13 -49
- package/dist/index.d.ts +13 -49
- package/dist/index.js +95 -11
- package/dist/index.mjs +197 -3425
- package/dist/{ir-CTx026t0.d.ts → ir-DbvOFKF-.d.ts} +96 -2
- package/dist/{ir-DeYMLWge.d.mts → ir-DyMJ84je.d.mts} +96 -2
- package/dist/key-health.js +1 -1
- package/dist/key-health.mjs +1 -1
- package/dist/probe.d.mts +46 -0
- package/dist/probe.d.ts +46 -0
- package/dist/probe.js +5767 -0
- package/dist/probe.mjs +45 -0
- package/dist/profiles.d.mts +30 -2
- package/dist/profiles.d.ts +30 -2
- package/dist/profiles.js +11 -0
- package/dist/profiles.mjs +3 -1
- package/dist/{types-Cp9ot1HV.d.ts → types-5TqjBeZD.d.ts} +1 -1
- package/dist/{types-BKbRtmUb.d.ts → types-BlrbNQfj.d.ts} +1 -1
- package/dist/{types-DD36cCbZ.d.mts → types-D441T-KC.d.mts} +1 -1
- package/dist/{types-cBzinzUR.d.mts → types-_myk4bxn.d.mts} +1 -1
- package/package.json +7 -2
package/dist/probe.mjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
compile
|
|
3
|
+
} from "./chunk-BTP5WK3B.mjs";
|
|
4
|
+
import "./chunk-S4PA2BDB.mjs";
|
|
5
|
+
import "./chunk-FEMPY6EC.mjs";
|
|
6
|
+
import {
|
|
7
|
+
deriveCliffEvidenceClass,
|
|
8
|
+
getProfile
|
|
9
|
+
} from "./chunk-YO2ZLPSD.mjs";
|
|
10
|
+
|
|
11
|
+
// src/probe.ts
|
|
12
|
+
function compileSuppressing(ir, opts) {
|
|
13
|
+
const { suppress, profileResolver, ...rest } = opts;
|
|
14
|
+
const base = profileResolver ?? getProfile;
|
|
15
|
+
for (const sel of suppress) {
|
|
16
|
+
const p = base(sel.model);
|
|
17
|
+
const hit = p.cliffs.some(
|
|
18
|
+
(c) => c.metric === sel.metric && (sel.whenIntent === void 0 || c.whenIntent === sel.whenIntent)
|
|
19
|
+
);
|
|
20
|
+
if (!hit) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
`compileSuppressing: no cliff {metric: ${sel.metric}${sel.whenIntent ? `, whenIntent: ${sel.whenIntent}` : ""}} on ${sel.model} \u2014 refusing to "suppress" a guard that does not exist`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const toolRelevanceThreshold = rest.toolRelevanceThreshold ?? 0;
|
|
27
|
+
const resolver = (id) => {
|
|
28
|
+
const p = base(id);
|
|
29
|
+
const sels = suppress.filter((s) => s.model === id || s.model === p.id);
|
|
30
|
+
if (sels.length === 0) return p;
|
|
31
|
+
return {
|
|
32
|
+
...p,
|
|
33
|
+
cliffs: p.cliffs.filter(
|
|
34
|
+
(c) => !sels.some(
|
|
35
|
+
(s) => s.metric === c.metric && (s.whenIntent === void 0 || c.whenIntent === s.whenIntent)
|
|
36
|
+
)
|
|
37
|
+
)
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
return compile(ir, { ...rest, toolRelevanceThreshold, profileResolver: resolver });
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
compileSuppressing,
|
|
44
|
+
deriveCliffEvidenceClass
|
|
45
|
+
};
|
package/dist/profiles.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as Provider } from './ir-
|
|
1
|
+
import { l as Provider } from './ir-DyMJ84je.mjs';
|
|
2
2
|
import { IntentArchetypeName } from './dialect.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -41,7 +41,35 @@ interface CliffRule {
|
|
|
41
41
|
whenIntent?: IntentArchetypeName;
|
|
42
42
|
/** Human-readable reason for digest reporting. */
|
|
43
43
|
reason: string;
|
|
44
|
+
/**
|
|
45
|
+
* alpha.93 (guard-probe-suite Phase 1) — the evidence trail behind this
|
|
46
|
+
* guard. Provenance classes: 'observed' (a measured incident), 'assumed'
|
|
47
|
+
* (inherited from a sibling model), 'asserted' (stated without evidence),
|
|
48
|
+
* 'probed' (the probe suite exercised the bad shape deliberately).
|
|
49
|
+
* ABSENT renders as 'asserted' — absence is the worst class, deliberately
|
|
50
|
+
* (see deriveCliffEvidenceClass, which also reads legacy reason prose).
|
|
51
|
+
* Rides the cliffs JSONB verbatim through every transport layer.
|
|
52
|
+
*/
|
|
53
|
+
evidence?: CliffEvidence;
|
|
54
|
+
}
|
|
55
|
+
/** See {@link CliffRule.evidence}. */
|
|
56
|
+
interface CliffEvidence {
|
|
57
|
+
class: 'observed' | 'assumed' | 'asserted' | 'probed';
|
|
58
|
+
/** ISO date of the newest probe run touching this guard. */
|
|
59
|
+
lastProbed?: string;
|
|
60
|
+
verdict?: 'confirmed' | 'flagged' | 'knee-moved';
|
|
61
|
+
/** FK into kgauto_guard_probe_runs. */
|
|
62
|
+
probeRunId?: number;
|
|
44
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* alpha.93 — evidence class for a guard, derived when the rule predates the
|
|
66
|
+
* explicit field. Explicit `evidence.class` always wins; the legacy
|
|
67
|
+
* derivation reads the reason prose the rules have carried since birth
|
|
68
|
+
* (mechanical keyword classes, pinned by a sweep test over every bundled
|
|
69
|
+
* cliff — that sweep IS the Phase-1 backfill audit, executable). Anything
|
|
70
|
+
* unmatched is 'asserted': the worst class, deliberately.
|
|
71
|
+
*/
|
|
72
|
+
declare function deriveCliffEvidenceClass(rule: CliffRule): CliffEvidence['class'];
|
|
45
73
|
/**
|
|
46
74
|
* alpha.43 — per-family-per-archetype prompt-shape convention.
|
|
47
75
|
*
|
|
@@ -349,4 +377,4 @@ declare function allProfiles(): readonly ModelProfile[];
|
|
|
349
377
|
declare function allProfilesRaw(): readonly ModelProfile[];
|
|
350
378
|
declare function profilesByProvider(provider: Provider): readonly ModelProfile[];
|
|
351
379
|
|
|
352
|
-
export { ALIASES, type ArchetypeConvention, type CacheStrategy, type CliffRule, LATENCY_TIER_MS, type LatencyTier, type LoweringSpec, type ModelProfile, type RecoveryRule, type StructuredOutputCapability, type SystemPromptMode, _setProfileBrainHook, _testClearConsumerProfiles, allProfiles, allProfilesRaw, bestEffortProfile, getProfile, inferProviderFromId, latencyTierOf, profilesByProvider, registerProfiles, resolveModelAlias, tryGetProfile };
|
|
380
|
+
export { ALIASES, type ArchetypeConvention, type CacheStrategy, type CliffEvidence, type CliffRule, LATENCY_TIER_MS, type LatencyTier, type LoweringSpec, type ModelProfile, type RecoveryRule, type StructuredOutputCapability, type SystemPromptMode, _setProfileBrainHook, _testClearConsumerProfiles, allProfiles, allProfilesRaw, bestEffortProfile, deriveCliffEvidenceClass, getProfile, inferProviderFromId, latencyTierOf, profilesByProvider, registerProfiles, resolveModelAlias, tryGetProfile };
|
package/dist/profiles.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as Provider } from './ir-
|
|
1
|
+
import { l as Provider } from './ir-DbvOFKF-.js';
|
|
2
2
|
import { IntentArchetypeName } from './dialect.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -41,7 +41,35 @@ interface CliffRule {
|
|
|
41
41
|
whenIntent?: IntentArchetypeName;
|
|
42
42
|
/** Human-readable reason for digest reporting. */
|
|
43
43
|
reason: string;
|
|
44
|
+
/**
|
|
45
|
+
* alpha.93 (guard-probe-suite Phase 1) — the evidence trail behind this
|
|
46
|
+
* guard. Provenance classes: 'observed' (a measured incident), 'assumed'
|
|
47
|
+
* (inherited from a sibling model), 'asserted' (stated without evidence),
|
|
48
|
+
* 'probed' (the probe suite exercised the bad shape deliberately).
|
|
49
|
+
* ABSENT renders as 'asserted' — absence is the worst class, deliberately
|
|
50
|
+
* (see deriveCliffEvidenceClass, which also reads legacy reason prose).
|
|
51
|
+
* Rides the cliffs JSONB verbatim through every transport layer.
|
|
52
|
+
*/
|
|
53
|
+
evidence?: CliffEvidence;
|
|
54
|
+
}
|
|
55
|
+
/** See {@link CliffRule.evidence}. */
|
|
56
|
+
interface CliffEvidence {
|
|
57
|
+
class: 'observed' | 'assumed' | 'asserted' | 'probed';
|
|
58
|
+
/** ISO date of the newest probe run touching this guard. */
|
|
59
|
+
lastProbed?: string;
|
|
60
|
+
verdict?: 'confirmed' | 'flagged' | 'knee-moved';
|
|
61
|
+
/** FK into kgauto_guard_probe_runs. */
|
|
62
|
+
probeRunId?: number;
|
|
44
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* alpha.93 — evidence class for a guard, derived when the rule predates the
|
|
66
|
+
* explicit field. Explicit `evidence.class` always wins; the legacy
|
|
67
|
+
* derivation reads the reason prose the rules have carried since birth
|
|
68
|
+
* (mechanical keyword classes, pinned by a sweep test over every bundled
|
|
69
|
+
* cliff — that sweep IS the Phase-1 backfill audit, executable). Anything
|
|
70
|
+
* unmatched is 'asserted': the worst class, deliberately.
|
|
71
|
+
*/
|
|
72
|
+
declare function deriveCliffEvidenceClass(rule: CliffRule): CliffEvidence['class'];
|
|
45
73
|
/**
|
|
46
74
|
* alpha.43 — per-family-per-archetype prompt-shape convention.
|
|
47
75
|
*
|
|
@@ -349,4 +377,4 @@ declare function allProfiles(): readonly ModelProfile[];
|
|
|
349
377
|
declare function allProfilesRaw(): readonly ModelProfile[];
|
|
350
378
|
declare function profilesByProvider(provider: Provider): readonly ModelProfile[];
|
|
351
379
|
|
|
352
|
-
export { ALIASES, type ArchetypeConvention, type CacheStrategy, type CliffRule, LATENCY_TIER_MS, type LatencyTier, type LoweringSpec, type ModelProfile, type RecoveryRule, type StructuredOutputCapability, type SystemPromptMode, _setProfileBrainHook, _testClearConsumerProfiles, allProfiles, allProfilesRaw, bestEffortProfile, getProfile, inferProviderFromId, latencyTierOf, profilesByProvider, registerProfiles, resolveModelAlias, tryGetProfile };
|
|
380
|
+
export { ALIASES, type ArchetypeConvention, type CacheStrategy, type CliffEvidence, type CliffRule, LATENCY_TIER_MS, type LatencyTier, type LoweringSpec, type ModelProfile, type RecoveryRule, type StructuredOutputCapability, type SystemPromptMode, _setProfileBrainHook, _testClearConsumerProfiles, allProfiles, allProfilesRaw, bestEffortProfile, deriveCliffEvidenceClass, getProfile, inferProviderFromId, latencyTierOf, profilesByProvider, registerProfiles, resolveModelAlias, tryGetProfile };
|
package/dist/profiles.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(profiles_exports, {
|
|
|
27
27
|
allProfiles: () => allProfiles,
|
|
28
28
|
allProfilesRaw: () => allProfilesRaw,
|
|
29
29
|
bestEffortProfile: () => bestEffortProfile,
|
|
30
|
+
deriveCliffEvidenceClass: () => deriveCliffEvidenceClass,
|
|
30
31
|
getProfile: () => getProfile,
|
|
31
32
|
inferProviderFromId: () => inferProviderFromId,
|
|
32
33
|
latencyTierOf: () => latencyTierOf,
|
|
@@ -36,6 +37,15 @@ __export(profiles_exports, {
|
|
|
36
37
|
tryGetProfile: () => tryGetProfile
|
|
37
38
|
});
|
|
38
39
|
module.exports = __toCommonJS(profiles_exports);
|
|
40
|
+
function deriveCliffEvidenceClass(rule) {
|
|
41
|
+
if (rule.evidence?.class) return rule.evidence.class;
|
|
42
|
+
const r = rule.reason.toLowerCase();
|
|
43
|
+
if (/inherited|conservative|assume|likely degrades|preemptive|starter hypothesis|same drain risk/.test(r)) {
|
|
44
|
+
return "assumed";
|
|
45
|
+
}
|
|
46
|
+
if (/observed|measured|\d+\/\d+ empty|replayed into/.test(r)) return "observed";
|
|
47
|
+
return "asserted";
|
|
48
|
+
}
|
|
39
49
|
var LATENCY_TIER_MS = {
|
|
40
50
|
fast: 4e3,
|
|
41
51
|
medium: 11e3,
|
|
@@ -2035,6 +2045,7 @@ function profilesByProvider(provider) {
|
|
|
2035
2045
|
allProfiles,
|
|
2036
2046
|
allProfilesRaw,
|
|
2037
2047
|
bestEffortProfile,
|
|
2048
|
+
deriveCliffEvidenceClass,
|
|
2038
2049
|
getProfile,
|
|
2039
2050
|
inferProviderFromId,
|
|
2040
2051
|
latencyTierOf,
|
package/dist/profiles.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
allProfiles,
|
|
7
7
|
allProfilesRaw,
|
|
8
8
|
bestEffortProfile,
|
|
9
|
+
deriveCliffEvidenceClass,
|
|
9
10
|
getProfile,
|
|
10
11
|
inferProviderFromId,
|
|
11
12
|
latencyTierOf,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
registerProfiles,
|
|
14
15
|
resolveModelAlias,
|
|
15
16
|
tryGetProfile
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-YO2ZLPSD.mjs";
|
|
17
18
|
export {
|
|
18
19
|
ALIASES,
|
|
19
20
|
LATENCY_TIER_MS,
|
|
@@ -22,6 +23,7 @@ export {
|
|
|
22
23
|
allProfiles,
|
|
23
24
|
allProfilesRaw,
|
|
24
25
|
bestEffortProfile,
|
|
26
|
+
deriveCliffEvidenceClass,
|
|
25
27
|
getProfile,
|
|
26
28
|
inferProviderFromId,
|
|
27
29
|
latencyTierOf,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, n as CallAttempt } from './ir-
|
|
1
|
+
import { t as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, n as CallAttempt } from './ir-DbvOFKF-.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Glass-Box observability types (alpha.17).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, n as CallAttempt } from './ir-
|
|
1
|
+
import { t as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, n as CallAttempt } from './ir-DyMJ84je.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Glass-Box observability types (alpha.17).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warmdrift/kgauto-compiler",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.93",
|
|
4
4
|
"description": "Prompt compiler with executable provider knowledge for multi-model AI apps: normalized multi-provider transport with fallback chains, compile-time cliff guards, a curated model registry, and a telemetry flight recorder. Swap models without rewriting prompts.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -46,6 +46,11 @@
|
|
|
46
46
|
"import": "./dist/glassbox-routes/format.mjs",
|
|
47
47
|
"require": "./dist/glassbox-routes/format.js"
|
|
48
48
|
},
|
|
49
|
+
"./probe": {
|
|
50
|
+
"types": "./dist/probe.d.ts",
|
|
51
|
+
"import": "./dist/probe.mjs",
|
|
52
|
+
"require": "./dist/probe.js"
|
|
53
|
+
},
|
|
49
54
|
"./glassbox-routes/react": {
|
|
50
55
|
"types": "./dist/glassbox-routes/react/index.d.ts",
|
|
51
56
|
"import": "./dist/glassbox-routes/react/index.mjs",
|
|
@@ -57,7 +62,7 @@
|
|
|
57
62
|
"README.md"
|
|
58
63
|
],
|
|
59
64
|
"scripts": {
|
|
60
|
-
"build": "tsup src/index.ts src/dialect.ts src/profiles.ts src/brain-proxy.ts src/key-health.ts src/glassbox/index.ts src/glassbox-routes/index.ts src/glassbox-routes/format.ts src/glassbox-routes/react/index.ts --format cjs,esm --dts --clean --external react --external react-dom",
|
|
65
|
+
"build": "tsup src/index.ts src/dialect.ts src/profiles.ts src/brain-proxy.ts src/key-health.ts src/probe.ts src/glassbox/index.ts src/glassbox-routes/index.ts src/glassbox-routes/format.ts src/glassbox-routes/react/index.ts --format cjs,esm --dts --clean --external react --external react-dom",
|
|
61
66
|
"test": "vitest run",
|
|
62
67
|
"test:watch": "vitest",
|
|
63
68
|
"test:stress": "node scripts/stress-test.mjs",
|