@warmdrift/kgauto-compiler 2.0.0-alpha.61 → 2.0.0-alpha.62
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 +30 -12
- package/dist/brain-proxy.js +5 -1
- package/dist/brain-proxy.mjs +1 -1
- package/dist/{chunk-5TI6PNSK.mjs → chunk-3KQAID63.mjs} +5 -0
- package/dist/{chunk-IUWFML6Z.mjs → chunk-65ZMX5OT.mjs} +5 -1
- package/dist/{chunk-3RMLZCUK.mjs → chunk-ABFXMO73.mjs} +1 -1
- package/dist/{chunk-IIMPJZNH.mjs → chunk-YZRPNSSQ.mjs} +10 -0
- package/dist/dialect.d.mts +14 -2
- package/dist/dialect.d.ts +14 -2
- package/dist/dialect.js +5 -0
- package/dist/dialect.mjs +1 -1
- 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 +10 -0
- package/dist/glassbox-routes/index.mjs +1 -1
- 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 +193 -6
- package/dist/index.d.ts +193 -6
- package/dist/index.js +681 -2
- package/dist/index.mjs +651 -4
- package/dist/{ir-DAKlQsVb.d.mts → ir-B2dRyJXO.d.mts} +74 -9
- package/dist/{ir-DmUuJsWc.d.ts → ir-ClU56aBc.d.ts} +74 -9
- package/dist/key-health.js +1 -1
- package/dist/key-health.mjs +1 -1
- package/dist/profiles.d.mts +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{types-B8X1Pyhx.d.ts → types-ByN3r0_7.d.ts} +1 -1
- package/dist/{types-DR62iPcO.d.ts → types-C-Wp7HpI.d.ts} +1 -1
- package/dist/{types-MRMBUqzY.d.mts → types-CSDweZsl.d.mts} +1 -1
- package/dist/{types-CssWqd0X.d.mts → types-axAX1Bg0.d.mts} +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,73 @@
|
|
|
1
1
|
import { IntentArchetypeName } from './dialect.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Golden-set capture (alpha.62, eval spine — design brief 2026-07-17).
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* The eval-driven self-improvement contract needs a replay corpus: 20–50 real
|
|
7
|
+
* historical IRs per (app, archetype), stored WITH the incumbent's output.
|
|
8
|
+
* This module is the capture side — a sampling gate on call()'s success path
|
|
9
|
+
* that stores the full PromptIR + served response to `kgauto_golden_irs`.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* ## Consent posture (s51 amendment, ratified 2026-07-17)
|
|
12
|
+
*
|
|
13
|
+
* Golden rows carry RAW prompts — a deliberate, documented departure from the
|
|
14
|
+
* s51 "brain holds no raw consumer prompts" rule. Capture is therefore
|
|
15
|
+
* strictly opt-in:
|
|
16
|
+
*
|
|
17
|
+
* - `KGAUTO_GOLDEN_CAPTURE=0.1` in the consumer's environment (the env var
|
|
18
|
+
* IS the consent act — the consumer's operator sets it knowingly), or
|
|
19
|
+
* - `CallOptions.goldenCapture.sampleRate` in consumer code.
|
|
20
|
+
*
|
|
21
|
+
* Default is 0 (off): absent flag, empty string, non-finite, or ≤0 all mean
|
|
22
|
+
* "never capture". Every stored row records its consent provenance in the
|
|
23
|
+
* `consent` column. Reads are strictly app-scoped (RLS) — a consumer can only
|
|
24
|
+
* ever see its own raw prompts.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** Consumer-facing capture options (CallOptions.goldenCapture). */
|
|
28
|
+
interface GoldenCaptureOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Probability [0..1] that a successful call's IR + output is stored as a
|
|
31
|
+
* golden row. Overrides the KGAUTO_GOLDEN_CAPTURE env var when set.
|
|
32
|
+
*/
|
|
33
|
+
sampleRate?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Optional free-text appended to the stored consent provenance (e.g. a
|
|
36
|
+
* ticket ref or the operator who approved capture for this surface).
|
|
37
|
+
*/
|
|
38
|
+
consentNote?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Parse a capture-rate env value. Mirrors the consumer-side
|
|
42
|
+
* `parseShadowProbeRate` semantics playbacksam established: undefined, empty,
|
|
43
|
+
* or non-finite → 0 (default-OFF); result clamped to [0, 1].
|
|
44
|
+
*/
|
|
45
|
+
declare function parseGoldenCaptureRate(raw: string | undefined): number;
|
|
46
|
+
/**
|
|
47
|
+
* Resolve the effective capture rate: explicit option wins; otherwise the
|
|
48
|
+
* KGAUTO_GOLDEN_CAPTURE env var (when a process env exists — Edge-safe).
|
|
14
49
|
*/
|
|
50
|
+
declare function resolveGoldenCaptureRate(optRate?: number): number;
|
|
51
|
+
/** Sampling gate. Injectable rng for tests (same shape as shouldSampleProbe). */
|
|
52
|
+
declare function shouldCaptureGolden(rate: number, rng?: () => number): boolean;
|
|
53
|
+
/** Everything call()'s success path has in scope when capture fires. */
|
|
54
|
+
interface GoldenCaptureContext {
|
|
55
|
+
ir: PromptIR;
|
|
56
|
+
servedModel: string;
|
|
57
|
+
response: NormalizedResponse;
|
|
58
|
+
latencyMs: number;
|
|
59
|
+
handle: string;
|
|
60
|
+
/** Compile-time shape key (peeked before record() popped the registry). */
|
|
61
|
+
shapeKey?: string;
|
|
62
|
+
/** How the rate was resolved — recorded as consent provenance. */
|
|
63
|
+
consent: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Store one golden row from a live served call. Fire-and-forget discipline is
|
|
67
|
+
* recordGoldenIr()'s (dead-letter, ledger, honors BrainConfig.sync); this
|
|
68
|
+
* wrapper only shapes the row. Never throws.
|
|
69
|
+
*/
|
|
70
|
+
declare function captureGoldenIr(ctx: GoldenCaptureContext): Promise<void>;
|
|
15
71
|
|
|
16
72
|
/**
|
|
17
73
|
* A semantically-named section of the system prompt. Sections enable
|
|
@@ -969,6 +1025,15 @@ interface CallOptions {
|
|
|
969
1025
|
* without engaging streaming wire format).
|
|
970
1026
|
*/
|
|
971
1027
|
noStream?: boolean;
|
|
1028
|
+
/**
|
|
1029
|
+
* alpha.62 (eval spine) — golden-set capture. When the resolved sample rate
|
|
1030
|
+
* is > 0, a successful non-empty call's FULL PromptIR + served output is
|
|
1031
|
+
* stored to the brain's `kgauto_golden_irs` replay corpus (raw prompt —
|
|
1032
|
+
* explicit opt-in; see golden.ts consent posture). `sampleRate` here
|
|
1033
|
+
* overrides the `KGAUTO_GOLDEN_CAPTURE` env var; when neither is set,
|
|
1034
|
+
* capture never fires.
|
|
1035
|
+
*/
|
|
1036
|
+
goldenCapture?: GoldenCaptureOptions;
|
|
972
1037
|
}
|
|
973
1038
|
interface CallAttempt {
|
|
974
1039
|
model: string;
|
|
@@ -1383,4 +1448,4 @@ interface PerAxisMetrics {
|
|
|
1383
1448
|
/** Per-axis metrics keyed by model — used for chain-comparison views. */
|
|
1384
1449
|
type PerAxisMetricsByModel = Record<string, PerAxisMetrics>;
|
|
1385
1450
|
|
|
1386
|
-
export { type ApiKeys as A, type BestPracticeAdvisory as B, type CompilePolicy as C, type EffortLevel as E, type FallbackReason as F, type Grounding as G, type HistoryCachePolicy as H, type IntentDeclaration as I, type Message as M, type NormalizedResponse as N, type OutcomeResult as O, type ProviderOverrides as P, type RecordInput as R, type SystemModelMessage as S, type ToolCall as T, type CompiledRequest as a, type PromptIR as b, type CallOptions as c, type CallResult as d, type CompileResult as e, type SectionRewrite as f, type RecordOutcomeInput as g, type OracleScore as h, type Adapter as i, type PerAxisMetrics as j, type Provider as k, type ChainEntry as l, type CallAttempt as m, CallError as n, type ChainModelEntry as o, type ChainWithGrounding as p, type Constraints as q, type
|
|
1451
|
+
export { type ApiKeys as A, type BestPracticeAdvisory as B, type CompilePolicy as C, captureGoldenIr as D, type EffortLevel as E, type FallbackReason as F, type Grounding as G, type HistoryCachePolicy as H, type IntentDeclaration as I, parseGoldenCaptureRate as J, resolveGoldenCaptureRate as K, shouldCaptureGolden as L, type Message as M, type NormalizedResponse as N, type OutcomeResult as O, type ProviderOverrides as P, type RecordInput as R, type SystemModelMessage as S, type ToolCall as T, type CompiledRequest as a, type PromptIR as b, type CallOptions as c, type CallResult as d, type CompileResult as e, type SectionRewrite as f, type RecordOutcomeInput as g, type OracleScore as h, type Adapter as i, type PerAxisMetrics as j, type Provider as k, type ChainEntry as l, type CallAttempt as m, CallError as n, type ChainModelEntry as o, type ChainWithGrounding as p, type Constraints as q, type GoldenCaptureOptions as r, type MutationApplied as s, type NormalizedTokens as t, type OutcomeKind as u, type PerAxisMetricsByModel as v, type PromptSection as w, type SectionKind as x, type ShadowProbeConfig as y, type ToolDefinition as z };
|
|
@@ -1,17 +1,73 @@
|
|
|
1
1
|
import { IntentArchetypeName } from './dialect.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Golden-set capture (alpha.62, eval spine — design brief 2026-07-17).
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* The eval-driven self-improvement contract needs a replay corpus: 20–50 real
|
|
7
|
+
* historical IRs per (app, archetype), stored WITH the incumbent's output.
|
|
8
|
+
* This module is the capture side — a sampling gate on call()'s success path
|
|
9
|
+
* that stores the full PromptIR + served response to `kgauto_golden_irs`.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* ## Consent posture (s51 amendment, ratified 2026-07-17)
|
|
12
|
+
*
|
|
13
|
+
* Golden rows carry RAW prompts — a deliberate, documented departure from the
|
|
14
|
+
* s51 "brain holds no raw consumer prompts" rule. Capture is therefore
|
|
15
|
+
* strictly opt-in:
|
|
16
|
+
*
|
|
17
|
+
* - `KGAUTO_GOLDEN_CAPTURE=0.1` in the consumer's environment (the env var
|
|
18
|
+
* IS the consent act — the consumer's operator sets it knowingly), or
|
|
19
|
+
* - `CallOptions.goldenCapture.sampleRate` in consumer code.
|
|
20
|
+
*
|
|
21
|
+
* Default is 0 (off): absent flag, empty string, non-finite, or ≤0 all mean
|
|
22
|
+
* "never capture". Every stored row records its consent provenance in the
|
|
23
|
+
* `consent` column. Reads are strictly app-scoped (RLS) — a consumer can only
|
|
24
|
+
* ever see its own raw prompts.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** Consumer-facing capture options (CallOptions.goldenCapture). */
|
|
28
|
+
interface GoldenCaptureOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Probability [0..1] that a successful call's IR + output is stored as a
|
|
31
|
+
* golden row. Overrides the KGAUTO_GOLDEN_CAPTURE env var when set.
|
|
32
|
+
*/
|
|
33
|
+
sampleRate?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Optional free-text appended to the stored consent provenance (e.g. a
|
|
36
|
+
* ticket ref or the operator who approved capture for this surface).
|
|
37
|
+
*/
|
|
38
|
+
consentNote?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Parse a capture-rate env value. Mirrors the consumer-side
|
|
42
|
+
* `parseShadowProbeRate` semantics playbacksam established: undefined, empty,
|
|
43
|
+
* or non-finite → 0 (default-OFF); result clamped to [0, 1].
|
|
44
|
+
*/
|
|
45
|
+
declare function parseGoldenCaptureRate(raw: string | undefined): number;
|
|
46
|
+
/**
|
|
47
|
+
* Resolve the effective capture rate: explicit option wins; otherwise the
|
|
48
|
+
* KGAUTO_GOLDEN_CAPTURE env var (when a process env exists — Edge-safe).
|
|
14
49
|
*/
|
|
50
|
+
declare function resolveGoldenCaptureRate(optRate?: number): number;
|
|
51
|
+
/** Sampling gate. Injectable rng for tests (same shape as shouldSampleProbe). */
|
|
52
|
+
declare function shouldCaptureGolden(rate: number, rng?: () => number): boolean;
|
|
53
|
+
/** Everything call()'s success path has in scope when capture fires. */
|
|
54
|
+
interface GoldenCaptureContext {
|
|
55
|
+
ir: PromptIR;
|
|
56
|
+
servedModel: string;
|
|
57
|
+
response: NormalizedResponse;
|
|
58
|
+
latencyMs: number;
|
|
59
|
+
handle: string;
|
|
60
|
+
/** Compile-time shape key (peeked before record() popped the registry). */
|
|
61
|
+
shapeKey?: string;
|
|
62
|
+
/** How the rate was resolved — recorded as consent provenance. */
|
|
63
|
+
consent: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Store one golden row from a live served call. Fire-and-forget discipline is
|
|
67
|
+
* recordGoldenIr()'s (dead-letter, ledger, honors BrainConfig.sync); this
|
|
68
|
+
* wrapper only shapes the row. Never throws.
|
|
69
|
+
*/
|
|
70
|
+
declare function captureGoldenIr(ctx: GoldenCaptureContext): Promise<void>;
|
|
15
71
|
|
|
16
72
|
/**
|
|
17
73
|
* A semantically-named section of the system prompt. Sections enable
|
|
@@ -969,6 +1025,15 @@ interface CallOptions {
|
|
|
969
1025
|
* without engaging streaming wire format).
|
|
970
1026
|
*/
|
|
971
1027
|
noStream?: boolean;
|
|
1028
|
+
/**
|
|
1029
|
+
* alpha.62 (eval spine) — golden-set capture. When the resolved sample rate
|
|
1030
|
+
* is > 0, a successful non-empty call's FULL PromptIR + served output is
|
|
1031
|
+
* stored to the brain's `kgauto_golden_irs` replay corpus (raw prompt —
|
|
1032
|
+
* explicit opt-in; see golden.ts consent posture). `sampleRate` here
|
|
1033
|
+
* overrides the `KGAUTO_GOLDEN_CAPTURE` env var; when neither is set,
|
|
1034
|
+
* capture never fires.
|
|
1035
|
+
*/
|
|
1036
|
+
goldenCapture?: GoldenCaptureOptions;
|
|
972
1037
|
}
|
|
973
1038
|
interface CallAttempt {
|
|
974
1039
|
model: string;
|
|
@@ -1383,4 +1448,4 @@ interface PerAxisMetrics {
|
|
|
1383
1448
|
/** Per-axis metrics keyed by model — used for chain-comparison views. */
|
|
1384
1449
|
type PerAxisMetricsByModel = Record<string, PerAxisMetrics>;
|
|
1385
1450
|
|
|
1386
|
-
export { type ApiKeys as A, type BestPracticeAdvisory as B, type CompilePolicy as C, type EffortLevel as E, type FallbackReason as F, type Grounding as G, type HistoryCachePolicy as H, type IntentDeclaration as I, type Message as M, type NormalizedResponse as N, type OutcomeResult as O, type ProviderOverrides as P, type RecordInput as R, type SystemModelMessage as S, type ToolCall as T, type CompiledRequest as a, type PromptIR as b, type CallOptions as c, type CallResult as d, type CompileResult as e, type SectionRewrite as f, type RecordOutcomeInput as g, type OracleScore as h, type Adapter as i, type PerAxisMetrics as j, type Provider as k, type ChainEntry as l, type CallAttempt as m, CallError as n, type ChainModelEntry as o, type ChainWithGrounding as p, type Constraints as q, type
|
|
1451
|
+
export { type ApiKeys as A, type BestPracticeAdvisory as B, type CompilePolicy as C, captureGoldenIr as D, type EffortLevel as E, type FallbackReason as F, type Grounding as G, type HistoryCachePolicy as H, type IntentDeclaration as I, parseGoldenCaptureRate as J, resolveGoldenCaptureRate as K, shouldCaptureGolden as L, type Message as M, type NormalizedResponse as N, type OutcomeResult as O, type ProviderOverrides as P, type RecordInput as R, type SystemModelMessage as S, type ToolCall as T, type CompiledRequest as a, type PromptIR as b, type CallOptions as c, type CallResult as d, type CompileResult as e, type SectionRewrite as f, type RecordOutcomeInput as g, type OracleScore as h, type Adapter as i, type PerAxisMetrics as j, type Provider as k, type ChainEntry as l, type CallAttempt as m, CallError as n, type ChainModelEntry as o, type ChainWithGrounding as p, type Constraints as q, type GoldenCaptureOptions as r, type MutationApplied as s, type NormalizedTokens as t, type OutcomeKind as u, type PerAxisMetricsByModel as v, type PromptSection as w, type SectionKind as x, type ShadowProbeConfig as y, type ToolDefinition as z };
|
package/dist/key-health.js
CHANGED
|
@@ -25,7 +25,7 @@ __export(key_health_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(key_health_exports);
|
|
26
26
|
|
|
27
27
|
// src/version.ts
|
|
28
|
-
var LIBRARY_VERSION = "2.0.0-alpha.
|
|
28
|
+
var LIBRARY_VERSION = "2.0.0-alpha.62";
|
|
29
29
|
|
|
30
30
|
// src/key-health.ts
|
|
31
31
|
var JSON_HEADERS = { "Content-Type": "application/json" };
|
package/dist/key-health.mjs
CHANGED
package/dist/profiles.d.mts
CHANGED
package/dist/profiles.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-ClU56aBc.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Glass-Box observability types (alpha.17).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-B2dRyJXO.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.62",
|
|
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",
|