@warmdrift/kgauto-compiler 2.0.0-alpha.28 → 2.0.0-alpha.29
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 +42 -0
- package/dist/glassbox/index.d.mts +3 -3
- package/dist/glassbox/index.d.ts +3 -3
- package/dist/glassbox-routes/index.d.mts +31 -2
- package/dist/glassbox-routes/index.d.ts +31 -2
- package/dist/glassbox-routes/index.js +39 -0
- package/dist/glassbox-routes/index.mjs +39 -0
- package/dist/index.d.mts +292 -13
- package/dist/index.d.ts +292 -13
- package/dist/index.js +385 -8
- package/dist/index.mjs +380 -8
- package/dist/{ir-5W0efxt9.d.ts → ir-BIAT9gJk.d.ts} +110 -1
- package/dist/{ir-MXCJA8L7.d.mts → ir-De2AQtlr.d.mts} +110 -1
- package/dist/profiles.d.mts +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{types-sDZQzPM6.d.mts → types-BjrIFPGe.d.mts} +1 -1
- package/dist/{types-CiZ9HLIU.d.ts → types-D_JAhCv4.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -40,7 +40,41 @@ interface PromptSection {
|
|
|
40
40
|
* Defaults to insertion order.
|
|
41
41
|
*/
|
|
42
42
|
weight?: number;
|
|
43
|
+
/**
|
|
44
|
+
* alpha.29+ — declares the section's semantic kind so kgauto can apply
|
|
45
|
+
* model-aware rewrites at compile time. Default `'arbitrary'` (when
|
|
46
|
+
* unset) for full back-compat — pre-alpha.29 sections continue working
|
|
47
|
+
* unchanged.
|
|
48
|
+
*
|
|
49
|
+
* alpha.29 ships rewrites for `tool_call_contract` only. Other kinds are
|
|
50
|
+
* type-accepted but pass through. alpha.30+ will add rewrites for
|
|
51
|
+
* `narration_contract`, `role_intro`, etc.
|
|
52
|
+
*
|
|
53
|
+
* See `translator.ts` for the rewrite engine that consumes this field.
|
|
54
|
+
*/
|
|
55
|
+
kind?: SectionKind;
|
|
43
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* alpha.29+ — semantic kind tag for a `PromptSection`. The translator
|
|
59
|
+
* (`v2/src/translator.ts`) consumes this to apply model-aware rewrites at
|
|
60
|
+
* compile time. CLOSED union; future kinds extend it explicitly in named
|
|
61
|
+
* alpha releases.
|
|
62
|
+
*
|
|
63
|
+
* alpha.29 ships rewrites for `tool_call_contract` only. Other kinds are
|
|
64
|
+
* type-accepted but pass through.
|
|
65
|
+
*
|
|
66
|
+
* - `role_intro` — "You are a helpful assistant", persona blocks
|
|
67
|
+
* - `tool_call_contract` — tool-use rules ("call X then Y"); the alpha.29
|
|
68
|
+
* translator rewrites this for models with a
|
|
69
|
+
* sequential-tool cliff on the active archetype
|
|
70
|
+
* - `narration_contract` — output-format rules ("don't narrate your steps");
|
|
71
|
+
* alpha.30+ candidate
|
|
72
|
+
* - `user_turn` — when sections carry user content rather than
|
|
73
|
+
* system context (rare)
|
|
74
|
+
* - `reference` — supporting reference data the model may consult
|
|
75
|
+
* - `arbitrary` — explicit pass-through (default when unset)
|
|
76
|
+
*/
|
|
77
|
+
type SectionKind = 'role_intro' | 'tool_call_contract' | 'narration_contract' | 'user_turn' | 'reference' | 'arbitrary';
|
|
44
78
|
interface ToolDefinition {
|
|
45
79
|
name: string;
|
|
46
80
|
description?: string;
|
|
@@ -262,6 +296,18 @@ type CompiledRequest = {
|
|
|
262
296
|
}>;
|
|
263
297
|
tools?: unknown[];
|
|
264
298
|
max_tokens?: number;
|
|
299
|
+
/**
|
|
300
|
+
* alpha.29 — emitted only when the translator's wire-overrides set
|
|
301
|
+
* `parallelToolCalls = false`. Shape per Anthropic Messages API docs:
|
|
302
|
+
* `{ type: 'auto', disable_parallel_tool_use: true }`. kgauto defaults
|
|
303
|
+
* to omitting `tool_choice` entirely (Anthropic defaults to auto + parallel),
|
|
304
|
+
* so this field's presence signals an explicit override.
|
|
305
|
+
*/
|
|
306
|
+
tool_choice?: {
|
|
307
|
+
type: 'auto' | 'any' | 'tool' | 'none';
|
|
308
|
+
disable_parallel_tool_use?: boolean;
|
|
309
|
+
name?: string;
|
|
310
|
+
};
|
|
265
311
|
} | {
|
|
266
312
|
provider: 'google';
|
|
267
313
|
model: string;
|
|
@@ -288,6 +334,12 @@ type CompiledRequest = {
|
|
|
288
334
|
tools?: unknown[];
|
|
289
335
|
response_format?: unknown;
|
|
290
336
|
reasoning_effort?: string;
|
|
337
|
+
/**
|
|
338
|
+
* alpha.29 — emitted only when the translator's wire-overrides set
|
|
339
|
+
* `parallelToolCalls = false`. OpenAI defaults parallel_tool_calls=true
|
|
340
|
+
* server-side; we explicit-set to false only when overriding.
|
|
341
|
+
*/
|
|
342
|
+
parallel_tool_calls?: boolean;
|
|
291
343
|
} | {
|
|
292
344
|
provider: 'deepseek';
|
|
293
345
|
model: string;
|
|
@@ -397,6 +449,40 @@ type Adapter = {
|
|
|
397
449
|
value: 'sequential';
|
|
398
450
|
consequence: string;
|
|
399
451
|
};
|
|
452
|
+
/**
|
|
453
|
+
* alpha.29+ — record of a single section rewrite fired by the translator at
|
|
454
|
+
* compile time. Surfaces on `CompileResult.sectionRewritesApplied` and (in
|
|
455
|
+
* scrubbed wire form, without original/transformed text) on
|
|
456
|
+
* `TraceDetail.sectionRewritesApplied` for Glass-Box Coaching-card rendering.
|
|
457
|
+
*
|
|
458
|
+
* `originalText` / `transformedText` stay package-internal — they may carry
|
|
459
|
+
* consumer PII. The wire-shape variant (`TraceSectionRewrite` in
|
|
460
|
+
* `glassbox-routes/types.ts`) carries only `summary` for renderer use.
|
|
461
|
+
*/
|
|
462
|
+
interface SectionRewrite {
|
|
463
|
+
/** Stable id of the `PromptSection` that was rewritten. */
|
|
464
|
+
sectionId: string;
|
|
465
|
+
/** The `kind` discriminator that matched the rewrite rule. */
|
|
466
|
+
kind: SectionKind;
|
|
467
|
+
/**
|
|
468
|
+
* Stable identifier of the rule that fired (e.g.
|
|
469
|
+
* `'sequential-tool-cliff-below-floor'`). Future rules add named ids; the
|
|
470
|
+
* brain aggregates by this value for cross-app learning.
|
|
471
|
+
*/
|
|
472
|
+
rule: string;
|
|
473
|
+
/** The section's text BEFORE the rewrite fired. */
|
|
474
|
+
originalText: string;
|
|
475
|
+
/** The text the translator emitted into the IR for this section. */
|
|
476
|
+
transformedText: string;
|
|
477
|
+
/**
|
|
478
|
+
* Wire-level overrides emitted alongside the text rewrite. Merged into
|
|
479
|
+
* `CompileResult.wireOverrides` by `applySectionRewrites`. alpha.29 ships
|
|
480
|
+
* `parallelToolCalls`; the union extends as more wire-overrides surface.
|
|
481
|
+
*/
|
|
482
|
+
wireOverrides?: {
|
|
483
|
+
parallelToolCalls?: boolean;
|
|
484
|
+
};
|
|
485
|
+
}
|
|
400
486
|
interface CompileResult {
|
|
401
487
|
/** Unique handle for this call — pass to record() to correlate the outcome. */
|
|
402
488
|
handle: string;
|
|
@@ -419,6 +505,29 @@ interface CompileResult {
|
|
|
419
505
|
* array when no rules fired. alpha.6 Phase 1.
|
|
420
506
|
*/
|
|
421
507
|
advisories: BestPracticeAdvisory[];
|
|
508
|
+
/**
|
|
509
|
+
* alpha.29+ — per-section rewrites applied by the translator at compile
|
|
510
|
+
* time. Empty array means no rewrites fired (or pre-alpha.29 behavior —
|
|
511
|
+
* all sections default `kind: 'arbitrary'`, which is pass-through).
|
|
512
|
+
*
|
|
513
|
+
* Surfaces to:
|
|
514
|
+
* - Glass-Box Coaching card (via `TraceDetail.sectionRewritesApplied`,
|
|
515
|
+
* scrubbed of original/transformed text)
|
|
516
|
+
* - brain `compile_outcomes.section_rewrites_applied` (migration 019)
|
|
517
|
+
* for cross-app learning
|
|
518
|
+
*/
|
|
519
|
+
sectionRewritesApplied: SectionRewrite[];
|
|
520
|
+
/**
|
|
521
|
+
* alpha.29+ — wire-level overrides emitted by translator rewrites. The
|
|
522
|
+
* provider lowering pass threads these through to the wire request before
|
|
523
|
+
* emit. Today only `parallelToolCalls: boolean`; the type extends as more
|
|
524
|
+
* wire-overrides surface.
|
|
525
|
+
*
|
|
526
|
+
* Undefined when no rewrite emitted overrides — the common case.
|
|
527
|
+
*/
|
|
528
|
+
wireOverrides?: {
|
|
529
|
+
parallelToolCalls?: boolean;
|
|
530
|
+
};
|
|
422
531
|
/** Diagnostics for caller-side logging. */
|
|
423
532
|
diagnostics: {
|
|
424
533
|
sectionsKept: number;
|
|
@@ -919,4 +1028,4 @@ interface PerAxisMetrics {
|
|
|
919
1028
|
/** Per-axis metrics keyed by model — used for chain-comparison views. */
|
|
920
1029
|
type PerAxisMetricsByModel = Record<string, PerAxisMetrics>;
|
|
921
1030
|
|
|
922
|
-
export { type ApiKeys as A, type BestPracticeAdvisory as B, type CompilePolicy as C, 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 ToolCall as T, type CompiledRequest as a, type PromptIR as b, type CallOptions as c, type CallResult as d, type RecordOutcomeInput as e, type OracleScore as f, type CompileResult as g, type Adapter as h, type PerAxisMetrics as i, type Provider as j, type ChainEntry as k, type CallAttempt as l, CallError as m, type ChainWithGrounding as n, type Constraints as o, type MutationApplied as p, type NormalizedTokens as q, type OutcomeKind as r, type PerAxisMetricsByModel as s, type PromptSection as t, type
|
|
1031
|
+
export { type ApiKeys as A, type BestPracticeAdvisory as B, type CompilePolicy as C, 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 SectionRewrite as S, type ToolCall as T, type CompiledRequest as a, type PromptIR as b, type CallOptions as c, type CallResult as d, type RecordOutcomeInput as e, type OracleScore as f, type CompileResult as g, type Adapter as h, type PerAxisMetrics as i, type Provider as j, type ChainEntry as k, type CallAttempt as l, CallError as m, type ChainWithGrounding as n, type Constraints as o, type MutationApplied as p, type NormalizedTokens as q, type OutcomeKind as r, type PerAxisMetricsByModel as s, type PromptSection as t, type SectionKind as u, type ToolDefinition as v };
|
package/dist/profiles.d.mts
CHANGED
package/dist/profiles.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, l as CallAttempt } from './ir-
|
|
1
|
+
import { p as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, l as CallAttempt } from './ir-De2AQtlr.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Glass-Box observability types (alpha.17).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, l as CallAttempt } from './ir-
|
|
1
|
+
import { p as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, l as CallAttempt } from './ir-BIAT9gJk.js';
|
|
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.29",
|
|
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",
|