@warmdrift/kgauto-compiler 2.0.0-alpha.45 → 2.0.0-alpha.46
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/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +12 -2
- package/dist/index.mjs +12 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -363,6 +363,15 @@ interface ShadowProbeRecordInput {
|
|
|
363
363
|
tokensCurrentOut?: number;
|
|
364
364
|
tokensCandidateIn?: number;
|
|
365
365
|
tokensCandidateOut?: number;
|
|
366
|
+
/**
|
|
367
|
+
* Wall-clock latency of the served call, ms (alpha.46). The third swap-decision
|
|
368
|
+
* axis alongside quality + cost — a verdict needs to know the candidate is
|
|
369
|
+
* slower, not just better/cheaper. Served latency mirrors
|
|
370
|
+
* `compile_outcomes.latency_ms`; carried here so a probe row is self-contained.
|
|
371
|
+
*/
|
|
372
|
+
latencyCurrentMs?: number;
|
|
373
|
+
/** Wall-clock latency of the candidate replay call, ms (alpha.46). */
|
|
374
|
+
latencyCandidateMs?: number;
|
|
366
375
|
}
|
|
367
376
|
/**
|
|
368
377
|
* Pure builder for the `probe_outcomes` row written by the inline shadow-probe.
|
|
@@ -390,6 +399,8 @@ declare function buildShadowProbeRow(input: ShadowProbeRecordInput): {
|
|
|
390
399
|
tokens_current_out: number | null;
|
|
391
400
|
tokens_candidate_in: number | null;
|
|
392
401
|
tokens_candidate_out: number | null;
|
|
402
|
+
latency_current_ms: number | null;
|
|
403
|
+
latency_candidate_ms: number | null;
|
|
393
404
|
prompt_fidelity: number;
|
|
394
405
|
replay_source: 'inline-full-ir';
|
|
395
406
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -363,6 +363,15 @@ interface ShadowProbeRecordInput {
|
|
|
363
363
|
tokensCurrentOut?: number;
|
|
364
364
|
tokensCandidateIn?: number;
|
|
365
365
|
tokensCandidateOut?: number;
|
|
366
|
+
/**
|
|
367
|
+
* Wall-clock latency of the served call, ms (alpha.46). The third swap-decision
|
|
368
|
+
* axis alongside quality + cost — a verdict needs to know the candidate is
|
|
369
|
+
* slower, not just better/cheaper. Served latency mirrors
|
|
370
|
+
* `compile_outcomes.latency_ms`; carried here so a probe row is self-contained.
|
|
371
|
+
*/
|
|
372
|
+
latencyCurrentMs?: number;
|
|
373
|
+
/** Wall-clock latency of the candidate replay call, ms (alpha.46). */
|
|
374
|
+
latencyCandidateMs?: number;
|
|
366
375
|
}
|
|
367
376
|
/**
|
|
368
377
|
* Pure builder for the `probe_outcomes` row written by the inline shadow-probe.
|
|
@@ -390,6 +399,8 @@ declare function buildShadowProbeRow(input: ShadowProbeRecordInput): {
|
|
|
390
399
|
tokens_current_out: number | null;
|
|
391
400
|
tokens_candidate_in: number | null;
|
|
392
401
|
tokens_candidate_out: number | null;
|
|
402
|
+
latency_current_ms: number | null;
|
|
403
|
+
latency_candidate_ms: number | null;
|
|
393
404
|
prompt_fidelity: number;
|
|
394
405
|
replay_source: 'inline-full-ir';
|
|
395
406
|
};
|
package/dist/index.js
CHANGED
|
@@ -4494,6 +4494,8 @@ function buildShadowProbeRow(input) {
|
|
|
4494
4494
|
tokens_current_out: input.tokensCurrentOut ?? null,
|
|
4495
4495
|
tokens_candidate_in: input.tokensCandidateIn ?? null,
|
|
4496
4496
|
tokens_candidate_out: input.tokensCandidateOut ?? null,
|
|
4497
|
+
latency_current_ms: input.latencyCurrentMs ?? null,
|
|
4498
|
+
latency_candidate_ms: input.latencyCandidateMs ?? null,
|
|
4497
4499
|
// Full IR was replayed (not a truncated preview), so fidelity is 1.0 — the
|
|
4498
4500
|
// prompt-fidelity guard never fires on these rows.
|
|
4499
4501
|
prompt_fidelity: 1,
|
|
@@ -6014,7 +6016,8 @@ async function call(ir, opts = {}) {
|
|
|
6014
6016
|
ir,
|
|
6015
6017
|
opts,
|
|
6016
6018
|
servedModel: targetModel,
|
|
6017
|
-
servedResponse: validated.response
|
|
6019
|
+
servedResponse: validated.response,
|
|
6020
|
+
servedLatencyMs: latencyMs2
|
|
6018
6021
|
});
|
|
6019
6022
|
if (isBrainSync()) {
|
|
6020
6023
|
await probe;
|
|
@@ -6127,11 +6130,13 @@ async function runShadowProbe(args) {
|
|
|
6127
6130
|
},
|
|
6128
6131
|
args.opts
|
|
6129
6132
|
);
|
|
6133
|
+
const candStart = Date.now();
|
|
6130
6134
|
const exec = await execute(candCompile.request, {
|
|
6131
6135
|
apiKeys: args.opts.apiKeys,
|
|
6132
6136
|
fetchImpl: args.opts.fetchImpl,
|
|
6133
6137
|
providerOverrides: args.opts.providerOverrides
|
|
6134
6138
|
});
|
|
6139
|
+
const candidateLatencyMs = Date.now() - candStart;
|
|
6135
6140
|
if (!exec.ok) continue;
|
|
6136
6141
|
await recordShadowProbe({
|
|
6137
6142
|
appId: args.ir.appId,
|
|
@@ -6145,7 +6150,12 @@ async function runShadowProbe(args) {
|
|
|
6145
6150
|
tokensCurrentIn: args.servedResponse.tokens.input,
|
|
6146
6151
|
tokensCurrentOut: args.servedResponse.tokens.output,
|
|
6147
6152
|
tokensCandidateIn: exec.response.tokens.input,
|
|
6148
|
-
tokensCandidateOut: exec.response.tokens.output
|
|
6153
|
+
tokensCandidateOut: exec.response.tokens.output,
|
|
6154
|
+
// alpha.46 — speed is the third swap-decision axis. Served latency
|
|
6155
|
+
// mirrors the user's actual wait; candidate latency is measured only
|
|
6156
|
+
// here and stored nowhere else (irrecoverable if not captured now).
|
|
6157
|
+
latencyCurrentMs: args.servedLatencyMs,
|
|
6158
|
+
latencyCandidateMs: candidateLatencyMs
|
|
6149
6159
|
});
|
|
6150
6160
|
} catch {
|
|
6151
6161
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2844,6 +2844,8 @@ function buildShadowProbeRow(input) {
|
|
|
2844
2844
|
tokens_current_out: input.tokensCurrentOut ?? null,
|
|
2845
2845
|
tokens_candidate_in: input.tokensCandidateIn ?? null,
|
|
2846
2846
|
tokens_candidate_out: input.tokensCandidateOut ?? null,
|
|
2847
|
+
latency_current_ms: input.latencyCurrentMs ?? null,
|
|
2848
|
+
latency_candidate_ms: input.latencyCandidateMs ?? null,
|
|
2847
2849
|
// Full IR was replayed (not a truncated preview), so fidelity is 1.0 — the
|
|
2848
2850
|
// prompt-fidelity guard never fires on these rows.
|
|
2849
2851
|
prompt_fidelity: 1,
|
|
@@ -3649,7 +3651,8 @@ async function call(ir, opts = {}) {
|
|
|
3649
3651
|
ir,
|
|
3650
3652
|
opts,
|
|
3651
3653
|
servedModel: targetModel,
|
|
3652
|
-
servedResponse: validated.response
|
|
3654
|
+
servedResponse: validated.response,
|
|
3655
|
+
servedLatencyMs: latencyMs2
|
|
3653
3656
|
});
|
|
3654
3657
|
if (isBrainSync()) {
|
|
3655
3658
|
await probe;
|
|
@@ -3762,11 +3765,13 @@ async function runShadowProbe(args) {
|
|
|
3762
3765
|
},
|
|
3763
3766
|
args.opts
|
|
3764
3767
|
);
|
|
3768
|
+
const candStart = Date.now();
|
|
3765
3769
|
const exec = await execute(candCompile.request, {
|
|
3766
3770
|
apiKeys: args.opts.apiKeys,
|
|
3767
3771
|
fetchImpl: args.opts.fetchImpl,
|
|
3768
3772
|
providerOverrides: args.opts.providerOverrides
|
|
3769
3773
|
});
|
|
3774
|
+
const candidateLatencyMs = Date.now() - candStart;
|
|
3770
3775
|
if (!exec.ok) continue;
|
|
3771
3776
|
await recordShadowProbe({
|
|
3772
3777
|
appId: args.ir.appId,
|
|
@@ -3780,7 +3785,12 @@ async function runShadowProbe(args) {
|
|
|
3780
3785
|
tokensCurrentIn: args.servedResponse.tokens.input,
|
|
3781
3786
|
tokensCurrentOut: args.servedResponse.tokens.output,
|
|
3782
3787
|
tokensCandidateIn: exec.response.tokens.input,
|
|
3783
|
-
tokensCandidateOut: exec.response.tokens.output
|
|
3788
|
+
tokensCandidateOut: exec.response.tokens.output,
|
|
3789
|
+
// alpha.46 — speed is the third swap-decision axis. Served latency
|
|
3790
|
+
// mirrors the user's actual wait; candidate latency is measured only
|
|
3791
|
+
// here and stored nowhere else (irrecoverable if not captured now).
|
|
3792
|
+
latencyCurrentMs: args.servedLatencyMs,
|
|
3793
|
+
latencyCandidateMs: candidateLatencyMs
|
|
3784
3794
|
});
|
|
3785
3795
|
} catch {
|
|
3786
3796
|
}
|
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.46",
|
|
4
4
|
"description": "Prompt compiler + central learning brain for multi-model AI apps. Swap models without rewriting prompts.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|