@warmdrift/kgauto-compiler 2.0.0-alpha.3 → 2.0.0-alpha.31

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.
@@ -1,2 +1,137 @@
1
- export { f as ALIASES, g as CacheStrategy, j as CliffRule, L as LoweringSpec, M as ModelProfile, q as RecoveryRule, S as StructuredOutputCapability, r as SystemPromptMode, t as allProfiles, u as getProfile, v as profilesByProvider, w as tryGetProfile } from './profiles-BiyrF36f.mjs';
2
- import './dialect.mjs';
1
+ import { j as Provider } from './ir-De2AQtlr.mjs';
2
+ import { IntentArchetypeName } from './dialect.mjs';
3
+
4
+ /**
5
+ * Model profiles — executable knowledge about each provider/model.
6
+ *
7
+ * Unlike v1 which carried `known_failures` as prose strings, v2 makes them
8
+ * executable: cliffs trigger guards, lowering describes the wire format,
9
+ * recovery handlers describe what to do after specific failures.
10
+ *
11
+ * Each profile is the answer to "if I want to call THIS model with THIS
12
+ * shape of work, what does it need from me, and what should I do when it
13
+ * fails?"
14
+ */
15
+
16
+ type StructuredOutputCapability = 'native' | 'grammar' | 'none';
17
+ type SystemPromptMode = 'inline' | 'separate' | 'as_developer' | 'unsupported';
18
+ type CacheStrategy = 'cache_control' | 'cachedContent' | 'unsupported';
19
+ interface CliffRule {
20
+ /** What metric triggers this cliff. */
21
+ metric: 'input_tokens' | 'tool_count' | 'history_turns' | 'thinking_with_short_output';
22
+ /** Threshold — meaning depends on metric. */
23
+ threshold: number;
24
+ /** What action to take when triggered. */
25
+ action: 'downgrade_quality_warning' | 'drop_to_top_relevant' | 'force_thinking_budget_zero' | 'force_terse_output' | 'escalate_target' | 'strip_tools';
26
+ /**
27
+ * Optional: only fire this cliff when the IR's intent.archetype matches.
28
+ * Used for archetype-specific failure modes (e.g. Gemini Flash returns
29
+ * empty when summarize is offered tools).
30
+ */
31
+ whenIntent?: IntentArchetypeName;
32
+ /** Human-readable reason for digest reporting. */
33
+ reason: string;
34
+ }
35
+ interface RecoveryRule {
36
+ /** What signal triggers recovery. */
37
+ signal: 'empty_response_after_tool' | 'empty_response' | 'malformed_function_call' | 'rate_limit' | 'model_not_found' | 'context_overflow';
38
+ /** Action: retry with adjusted params, or escalate to next fallback. */
39
+ action: 'retry_with_params' | 'escalate' | 'log_only';
40
+ /** When action=retry_with_params, the param adjustments to apply. */
41
+ retryParams?: Record<string, unknown>;
42
+ /** Max retries with this rule. */
43
+ maxRetries?: number;
44
+ /** Human-readable reason for digest reporting. */
45
+ reason: string;
46
+ }
47
+ interface LoweringSpec {
48
+ /** Where the system prompt goes. */
49
+ system: {
50
+ mode: SystemPromptMode;
51
+ field?: string;
52
+ };
53
+ /** Cache strategy + parameters. */
54
+ cache: {
55
+ strategy: CacheStrategy;
56
+ /** Min tokens before caching is worth it (provider rules). */
57
+ minTokens?: number;
58
+ /** Discount factor on cached input (0.1 = 10% of normal price). */
59
+ discount?: number;
60
+ /** TTL hint in seconds. */
61
+ ttlSeconds?: number;
62
+ };
63
+ /** Tool format identifier — see lower.ts for supported formats. */
64
+ tools?: {
65
+ format: 'anthropic' | 'google' | 'openai' | 'deepseek';
66
+ };
67
+ /** Thinking config — present iff this model has a thinking knob. */
68
+ thinking?: {
69
+ /** Field path on the request. */
70
+ field: string;
71
+ /** Default value when caller hasn't specified. */
72
+ default?: number | 'auto' | 'off';
73
+ };
74
+ }
75
+ interface ModelProfile {
76
+ id: string;
77
+ provider: Provider;
78
+ status: 'current' | 'preview' | 'legacy';
79
+ maxContextTokens: number;
80
+ maxOutputTokens: number;
81
+ maxTools: number;
82
+ parallelToolCalls: boolean;
83
+ structuredOutput: StructuredOutputCapability;
84
+ systemPromptMode: SystemPromptMode;
85
+ streaming: boolean;
86
+ cliffs: CliffRule[];
87
+ costInputPer1m: number;
88
+ costOutputPer1m: number;
89
+ lowering: LoweringSpec;
90
+ recovery: RecoveryRule[];
91
+ strengths: string[];
92
+ weaknesses: string[];
93
+ notes?: string;
94
+ verifiedAgainstDocs?: string;
95
+ /**
96
+ * Hand-curated per-archetype performance score on a 0-10 scale.
97
+ *
98
+ * 10 = frontier on this archetype (e.g. Opus 4.7 on critique)
99
+ * 8 = strong second tier (Sonnet on plan, Pro on extract)
100
+ * 7 = competent (Haiku on classify, Flash on hunt)
101
+ * 5 = acceptable for tolerant archetypes (Flash-Lite on classify)
102
+ * 3 = degraded (Flash on critique, DeepSeek on hunt)
103
+ *
104
+ * Missing archetypes default to `5` (no data, neutral). Each non-default
105
+ * value should carry a one-line rationale in the profile's note or inline
106
+ * comment citing brain evidence, family prior, or "starter hypothesis —
107
+ * verify with telemetry."
108
+ *
109
+ * Source today: hand-curated from master plan §3.3 + §6.2 starter tables.
110
+ * Source tomorrow (alpha.10+): brain `archetype_model_evidence` view.
111
+ *
112
+ * Anti-hallucination guardrail (master plan §2.5): when the watcher's
113
+ * `--audit-fields` flag flags a profile stale (>90 days since
114
+ * verifiedAgainstDocs), the archetypePerf values get re-audited
115
+ * alongside capability fields. AI-trained intuition is NOT a valid
116
+ * source — only docs or brain evidence.
117
+ *
118
+ * alpha.9.
119
+ */
120
+ archetypePerf?: Partial<Record<IntentArchetypeName, number>>;
121
+ }
122
+ declare const ALIASES: Record<string, string>;
123
+ interface ProfileBrainHook {
124
+ getProfile?: (canonicalId: string) => ModelProfile | undefined;
125
+ resolveAlias?: (id: string) => string | undefined;
126
+ }
127
+ /** @internal — called by models-brain.ts at module load. */
128
+ declare function _setProfileBrainHook(hook: ProfileBrainHook): void;
129
+ declare function getProfile(id: string): ModelProfile;
130
+ declare function tryGetProfile(id: string): ModelProfile | undefined;
131
+ declare function allProfiles(): readonly ModelProfile[];
132
+ /** @internal — bundled-only access for adapters that need a non-brain
133
+ * fallback baseline (avoids a brain → profiles → brain re-entry). */
134
+ declare function allProfilesRaw(): readonly ModelProfile[];
135
+ declare function profilesByProvider(provider: Provider): readonly ModelProfile[];
136
+
137
+ export { ALIASES, type CacheStrategy, type CliffRule, type LoweringSpec, type ModelProfile, type RecoveryRule, type StructuredOutputCapability, type SystemPromptMode, _setProfileBrainHook, allProfiles, allProfilesRaw, getProfile, profilesByProvider, tryGetProfile };
@@ -1,2 +1,137 @@
1
- export { f as ALIASES, g as CacheStrategy, j as CliffRule, L as LoweringSpec, M as ModelProfile, q as RecoveryRule, S as StructuredOutputCapability, r as SystemPromptMode, t as allProfiles, u as getProfile, v as profilesByProvider, w as tryGetProfile } from './profiles-C5lVqF8_.js';
2
- import './dialect.js';
1
+ import { j as Provider } from './ir-BIAT9gJk.js';
2
+ import { IntentArchetypeName } from './dialect.js';
3
+
4
+ /**
5
+ * Model profiles — executable knowledge about each provider/model.
6
+ *
7
+ * Unlike v1 which carried `known_failures` as prose strings, v2 makes them
8
+ * executable: cliffs trigger guards, lowering describes the wire format,
9
+ * recovery handlers describe what to do after specific failures.
10
+ *
11
+ * Each profile is the answer to "if I want to call THIS model with THIS
12
+ * shape of work, what does it need from me, and what should I do when it
13
+ * fails?"
14
+ */
15
+
16
+ type StructuredOutputCapability = 'native' | 'grammar' | 'none';
17
+ type SystemPromptMode = 'inline' | 'separate' | 'as_developer' | 'unsupported';
18
+ type CacheStrategy = 'cache_control' | 'cachedContent' | 'unsupported';
19
+ interface CliffRule {
20
+ /** What metric triggers this cliff. */
21
+ metric: 'input_tokens' | 'tool_count' | 'history_turns' | 'thinking_with_short_output';
22
+ /** Threshold — meaning depends on metric. */
23
+ threshold: number;
24
+ /** What action to take when triggered. */
25
+ action: 'downgrade_quality_warning' | 'drop_to_top_relevant' | 'force_thinking_budget_zero' | 'force_terse_output' | 'escalate_target' | 'strip_tools';
26
+ /**
27
+ * Optional: only fire this cliff when the IR's intent.archetype matches.
28
+ * Used for archetype-specific failure modes (e.g. Gemini Flash returns
29
+ * empty when summarize is offered tools).
30
+ */
31
+ whenIntent?: IntentArchetypeName;
32
+ /** Human-readable reason for digest reporting. */
33
+ reason: string;
34
+ }
35
+ interface RecoveryRule {
36
+ /** What signal triggers recovery. */
37
+ signal: 'empty_response_after_tool' | 'empty_response' | 'malformed_function_call' | 'rate_limit' | 'model_not_found' | 'context_overflow';
38
+ /** Action: retry with adjusted params, or escalate to next fallback. */
39
+ action: 'retry_with_params' | 'escalate' | 'log_only';
40
+ /** When action=retry_with_params, the param adjustments to apply. */
41
+ retryParams?: Record<string, unknown>;
42
+ /** Max retries with this rule. */
43
+ maxRetries?: number;
44
+ /** Human-readable reason for digest reporting. */
45
+ reason: string;
46
+ }
47
+ interface LoweringSpec {
48
+ /** Where the system prompt goes. */
49
+ system: {
50
+ mode: SystemPromptMode;
51
+ field?: string;
52
+ };
53
+ /** Cache strategy + parameters. */
54
+ cache: {
55
+ strategy: CacheStrategy;
56
+ /** Min tokens before caching is worth it (provider rules). */
57
+ minTokens?: number;
58
+ /** Discount factor on cached input (0.1 = 10% of normal price). */
59
+ discount?: number;
60
+ /** TTL hint in seconds. */
61
+ ttlSeconds?: number;
62
+ };
63
+ /** Tool format identifier — see lower.ts for supported formats. */
64
+ tools?: {
65
+ format: 'anthropic' | 'google' | 'openai' | 'deepseek';
66
+ };
67
+ /** Thinking config — present iff this model has a thinking knob. */
68
+ thinking?: {
69
+ /** Field path on the request. */
70
+ field: string;
71
+ /** Default value when caller hasn't specified. */
72
+ default?: number | 'auto' | 'off';
73
+ };
74
+ }
75
+ interface ModelProfile {
76
+ id: string;
77
+ provider: Provider;
78
+ status: 'current' | 'preview' | 'legacy';
79
+ maxContextTokens: number;
80
+ maxOutputTokens: number;
81
+ maxTools: number;
82
+ parallelToolCalls: boolean;
83
+ structuredOutput: StructuredOutputCapability;
84
+ systemPromptMode: SystemPromptMode;
85
+ streaming: boolean;
86
+ cliffs: CliffRule[];
87
+ costInputPer1m: number;
88
+ costOutputPer1m: number;
89
+ lowering: LoweringSpec;
90
+ recovery: RecoveryRule[];
91
+ strengths: string[];
92
+ weaknesses: string[];
93
+ notes?: string;
94
+ verifiedAgainstDocs?: string;
95
+ /**
96
+ * Hand-curated per-archetype performance score on a 0-10 scale.
97
+ *
98
+ * 10 = frontier on this archetype (e.g. Opus 4.7 on critique)
99
+ * 8 = strong second tier (Sonnet on plan, Pro on extract)
100
+ * 7 = competent (Haiku on classify, Flash on hunt)
101
+ * 5 = acceptable for tolerant archetypes (Flash-Lite on classify)
102
+ * 3 = degraded (Flash on critique, DeepSeek on hunt)
103
+ *
104
+ * Missing archetypes default to `5` (no data, neutral). Each non-default
105
+ * value should carry a one-line rationale in the profile's note or inline
106
+ * comment citing brain evidence, family prior, or "starter hypothesis —
107
+ * verify with telemetry."
108
+ *
109
+ * Source today: hand-curated from master plan §3.3 + §6.2 starter tables.
110
+ * Source tomorrow (alpha.10+): brain `archetype_model_evidence` view.
111
+ *
112
+ * Anti-hallucination guardrail (master plan §2.5): when the watcher's
113
+ * `--audit-fields` flag flags a profile stale (>90 days since
114
+ * verifiedAgainstDocs), the archetypePerf values get re-audited
115
+ * alongside capability fields. AI-trained intuition is NOT a valid
116
+ * source — only docs or brain evidence.
117
+ *
118
+ * alpha.9.
119
+ */
120
+ archetypePerf?: Partial<Record<IntentArchetypeName, number>>;
121
+ }
122
+ declare const ALIASES: Record<string, string>;
123
+ interface ProfileBrainHook {
124
+ getProfile?: (canonicalId: string) => ModelProfile | undefined;
125
+ resolveAlias?: (id: string) => string | undefined;
126
+ }
127
+ /** @internal — called by models-brain.ts at module load. */
128
+ declare function _setProfileBrainHook(hook: ProfileBrainHook): void;
129
+ declare function getProfile(id: string): ModelProfile;
130
+ declare function tryGetProfile(id: string): ModelProfile | undefined;
131
+ declare function allProfiles(): readonly ModelProfile[];
132
+ /** @internal — bundled-only access for adapters that need a non-brain
133
+ * fallback baseline (avoids a brain → profiles → brain re-entry). */
134
+ declare function allProfilesRaw(): readonly ModelProfile[];
135
+ declare function profilesByProvider(provider: Provider): readonly ModelProfile[];
136
+
137
+ export { ALIASES, type CacheStrategy, type CliffRule, type LoweringSpec, type ModelProfile, type RecoveryRule, type StructuredOutputCapability, type SystemPromptMode, _setProfileBrainHook, allProfiles, allProfilesRaw, getProfile, profilesByProvider, tryGetProfile };