@mfittko/repo-wiki 0.2.1
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/.llmwiki/schema.md +107 -0
- package/AGENTS.md +42 -0
- package/CHANGELOG.md +91 -0
- package/LICENSE +21 -0
- package/README.md +254 -0
- package/dist/bin/repo-wiki.d.ts +2 -0
- package/dist/bin/repo-wiki.js +7 -0
- package/dist/bin/repo-wiki.js.map +1 -0
- package/dist/src/cli.d.ts +1 -0
- package/dist/src/cli.js +404 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/compiler.d.ts +55 -0
- package/dist/src/compiler.js +2046 -0
- package/dist/src/compiler.js.map +1 -0
- package/dist/src/config.d.ts +63 -0
- package/dist/src/config.js +86 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/context-assembler.d.ts +68 -0
- package/dist/src/context-assembler.js +378 -0
- package/dist/src/context-assembler.js.map +1 -0
- package/dist/src/data-model-signals.d.ts +1 -0
- package/dist/src/data-model-signals.js +13 -0
- package/dist/src/data-model-signals.js.map +1 -0
- package/dist/src/docs-ingestor.d.ts +138 -0
- package/dist/src/docs-ingestor.js +844 -0
- package/dist/src/docs-ingestor.js.map +1 -0
- package/dist/src/docs-linter.d.ts +14 -0
- package/dist/src/docs-linter.js +164 -0
- package/dist/src/docs-linter.js.map +1 -0
- package/dist/src/docs-validation.d.ts +36 -0
- package/dist/src/docs-validation.js +297 -0
- package/dist/src/docs-validation.js.map +1 -0
- package/dist/src/extractors.d.ts +50 -0
- package/dist/src/extractors.js +2275 -0
- package/dist/src/extractors.js.map +1 -0
- package/dist/src/frontmatter.d.ts +46 -0
- package/dist/src/frontmatter.js +377 -0
- package/dist/src/frontmatter.js.map +1 -0
- package/dist/src/index.d.ts +26 -0
- package/dist/src/index.js +18 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/init.d.ts +12 -0
- package/dist/src/init.js +121 -0
- package/dist/src/init.js.map +1 -0
- package/dist/src/language.d.ts +2 -0
- package/dist/src/language.js +62 -0
- package/dist/src/language.js.map +1 -0
- package/dist/src/linter.d.ts +33 -0
- package/dist/src/linter.js +398 -0
- package/dist/src/linter.js.map +1 -0
- package/dist/src/llm-provider.d.ts +267 -0
- package/dist/src/llm-provider.js +474 -0
- package/dist/src/llm-provider.js.map +1 -0
- package/dist/src/page-ownership.d.ts +38 -0
- package/dist/src/page-ownership.js +96 -0
- package/dist/src/page-ownership.js.map +1 -0
- package/dist/src/planner.d.ts +55 -0
- package/dist/src/planner.js +422 -0
- package/dist/src/planner.js.map +1 -0
- package/dist/src/prompts.d.ts +103 -0
- package/dist/src/prompts.js +344 -0
- package/dist/src/prompts.js.map +1 -0
- package/dist/src/publisher.d.ts +68 -0
- package/dist/src/publisher.js +662 -0
- package/dist/src/publisher.js.map +1 -0
- package/dist/src/repository-analysis.d.ts +88 -0
- package/dist/src/repository-analysis.js +485 -0
- package/dist/src/repository-analysis.js.map +1 -0
- package/dist/src/scanner.d.ts +122 -0
- package/dist/src/scanner.js +309 -0
- package/dist/src/scanner.js.map +1 -0
- package/dist/src/search.d.ts +71 -0
- package/dist/src/search.js +410 -0
- package/dist/src/search.js.map +1 -0
- package/dist/src/secret-patterns.d.ts +3 -0
- package/dist/src/secret-patterns.js +14 -0
- package/dist/src/secret-patterns.js.map +1 -0
- package/dist/src/utils/args.d.ts +2 -0
- package/dist/src/utils/args.js +19 -0
- package/dist/src/utils/args.js.map +1 -0
- package/dist/src/utils/dotenv.d.ts +7 -0
- package/dist/src/utils/dotenv.js +73 -0
- package/dist/src/utils/dotenv.js.map +1 -0
- package/dist/src/utils/fs.d.ts +22 -0
- package/dist/src/utils/fs.js +83 -0
- package/dist/src/utils/fs.js.map +1 -0
- package/dist/src/utils/git.d.ts +13 -0
- package/dist/src/utils/git.js +39 -0
- package/dist/src/utils/git.js.map +1 -0
- package/dist/src/wiki-graph.d.ts +74 -0
- package/dist/src/wiki-graph.js +335 -0
- package/dist/src/wiki-graph.js.map +1 -0
- package/dist/src/wiki-patch.d.ts +152 -0
- package/dist/src/wiki-patch.js +489 -0
- package/dist/src/wiki-patch.js.map +1 -0
- package/dist/src/wiki-query.d.ts +63 -0
- package/dist/src/wiki-query.js +255 -0
- package/dist/src/wiki-query.js.map +1 -0
- package/dist/test/cli.test.d.ts +1 -0
- package/dist/test/cli.test.js +514 -0
- package/dist/test/cli.test.js.map +1 -0
- package/dist/test/compiler-eval.test.d.ts +1 -0
- package/dist/test/compiler-eval.test.js +234 -0
- package/dist/test/compiler-eval.test.js.map +1 -0
- package/dist/test/compiler.test.d.ts +1 -0
- package/dist/test/compiler.test.js +2537 -0
- package/dist/test/compiler.test.js.map +1 -0
- package/dist/test/context-assembler.test.d.ts +1 -0
- package/dist/test/context-assembler.test.js +379 -0
- package/dist/test/context-assembler.test.js.map +1 -0
- package/dist/test/docs-linter.test.d.ts +1 -0
- package/dist/test/docs-linter.test.js +900 -0
- package/dist/test/docs-linter.test.js.map +1 -0
- package/dist/test/dotenv.test.d.ts +1 -0
- package/dist/test/dotenv.test.js +77 -0
- package/dist/test/dotenv.test.js.map +1 -0
- package/dist/test/extractors-go.test.d.ts +1 -0
- package/dist/test/extractors-go.test.js +393 -0
- package/dist/test/extractors-go.test.js.map +1 -0
- package/dist/test/extractors-rust.test.d.ts +1 -0
- package/dist/test/extractors-rust.test.js +219 -0
- package/dist/test/extractors-rust.test.js.map +1 -0
- package/dist/test/extractors-utils.test.d.ts +1 -0
- package/dist/test/extractors-utils.test.js +786 -0
- package/dist/test/extractors-utils.test.js.map +1 -0
- package/dist/test/fixtures/compiler-e2e/basic-node-service/repo/infra/deploy.d.ts +1 -0
- package/dist/test/fixtures/compiler-e2e/basic-node-service/repo/infra/deploy.js +4 -0
- package/dist/test/fixtures/compiler-e2e/basic-node-service/repo/infra/deploy.js.map +1 -0
- package/dist/test/frontmatter.test.d.ts +1 -0
- package/dist/test/frontmatter.test.js +287 -0
- package/dist/test/frontmatter.test.js.map +1 -0
- package/dist/test/init-planner.test.d.ts +1 -0
- package/dist/test/init-planner.test.js +688 -0
- package/dist/test/init-planner.test.js.map +1 -0
- package/dist/test/linter.test.d.ts +1 -0
- package/dist/test/linter.test.js +426 -0
- package/dist/test/linter.test.js.map +1 -0
- package/dist/test/llm-provider.test.d.ts +1 -0
- package/dist/test/llm-provider.test.js +783 -0
- package/dist/test/llm-provider.test.js.map +1 -0
- package/dist/test/page-ownership.test.d.ts +1 -0
- package/dist/test/page-ownership.test.js +247 -0
- package/dist/test/page-ownership.test.js.map +1 -0
- package/dist/test/publisher.test.d.ts +1 -0
- package/dist/test/publisher.test.js +1297 -0
- package/dist/test/publisher.test.js.map +1 -0
- package/dist/test/repository-analysis.test.d.ts +1 -0
- package/dist/test/repository-analysis.test.js +182 -0
- package/dist/test/repository-analysis.test.js.map +1 -0
- package/dist/test/run-compiled-tests.d.ts +1 -0
- package/dist/test/run-compiled-tests.js +48 -0
- package/dist/test/run-compiled-tests.js.map +1 -0
- package/dist/test/scanner.test.d.ts +1 -0
- package/dist/test/scanner.test.js +551 -0
- package/dist/test/scanner.test.js.map +1 -0
- package/dist/test/search.test.d.ts +1 -0
- package/dist/test/search.test.js +92 -0
- package/dist/test/search.test.js.map +1 -0
- package/dist/test/update-changelog.test.d.ts +1 -0
- package/dist/test/update-changelog.test.js +125 -0
- package/dist/test/update-changelog.test.js.map +1 -0
- package/dist/test/wiki-graph.test.d.ts +1 -0
- package/dist/test/wiki-graph.test.js +164 -0
- package/dist/test/wiki-graph.test.js.map +1 -0
- package/dist/test/wiki-patch.test.d.ts +1 -0
- package/dist/test/wiki-patch.test.js +610 -0
- package/dist/test/wiki-patch.test.js.map +1 -0
- package/dist/test/wiki-query.test.d.ts +1 -0
- package/dist/test/wiki-query.test.js +163 -0
- package/dist/test/wiki-query.test.js.map +1 -0
- package/docs/PLAN.md +993 -0
- package/docs/WHY.md +61 -0
- package/docs/plans/agent-integration.md +85 -0
- package/docs/plans/ci-publishing.md +111 -0
- package/docs/plans/doc-validation.md +92 -0
- package/docs/plans/github-action.md +113 -0
- package/docs/plans/incremental-mode.md +98 -0
- package/docs/plans/karpathy-llm-wiki-alignment.md +84 -0
- package/docs/plans/llm-compiler.md +160 -0
- package/docs/plans/production-scanner.md +104 -0
- package/docs/plans/query-and-file-back.md +103 -0
- package/docs/plans/search-index.md +118 -0
- package/docs/plans/trust-hardening.md +74 -0
- package/docs/plans/wiki-graph.md +183 -0
- package/docs/plans/wiki-health.md +76 -0
- package/package.json +83 -0
- package/prompts/compiler.md +16 -0
- package/prompts/lint.md +18 -0
- package/prompts/page-templates.md +25 -0
- package/skills/repo-wiki-cli/SKILL.md +139 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM provider boundary for wiki synthesis.
|
|
3
|
+
*
|
|
4
|
+
* Defines provider request/response interfaces, structured error handling,
|
|
5
|
+
* a deterministic mock provider for tests and local CI, and a factory that
|
|
6
|
+
* selects the correct provider from configuration.
|
|
7
|
+
*
|
|
8
|
+
* Usage (tests / CI without network):
|
|
9
|
+
* const provider = createProvider(); // defaults to mock
|
|
10
|
+
* const provider = createProvider({ provider: 'mock' });
|
|
11
|
+
*
|
|
12
|
+
* Usage (OpenAI-compatible hosted provider):
|
|
13
|
+
* const provider = createProvider({ provider: 'openai-compatible', apiKey: '...', model: '...' });
|
|
14
|
+
*/
|
|
15
|
+
import { type PageArchetype, type PromptContext } from './prompts.js';
|
|
16
|
+
export declare const LLM_DEFAULTS: {
|
|
17
|
+
readonly provider: "mock";
|
|
18
|
+
readonly hostedProvider: "openai-compatible";
|
|
19
|
+
readonly model: "gpt-4.1-mini";
|
|
20
|
+
readonly baseUrl: "https://api.openai.com/v1";
|
|
21
|
+
readonly apiKeyEnv: "LLMWIKI_LLM_API_KEY";
|
|
22
|
+
readonly systemPrompt: "You compile source-grounded GitHub Wiki pages.";
|
|
23
|
+
readonly temperature: 0.1;
|
|
24
|
+
readonly maxOutputTokens: 4000;
|
|
25
|
+
readonly timeoutMs: 60000;
|
|
26
|
+
readonly retries: 2;
|
|
27
|
+
readonly validationRetries: 1;
|
|
28
|
+
readonly reasoningEffort: any;
|
|
29
|
+
};
|
|
30
|
+
export type { PageArchetype };
|
|
31
|
+
export type { PromptContext };
|
|
32
|
+
/** Input sent to an LLM provider for a single wiki page synthesis. */
|
|
33
|
+
export interface LLMRequest {
|
|
34
|
+
/** Page archetype that selected the prompt template. */
|
|
35
|
+
archetype: PageArchetype;
|
|
36
|
+
/** Wiki page slug/filename without .md (e.g. "Module-Auth"). */
|
|
37
|
+
pageName: string;
|
|
38
|
+
/** Human-readable page title (e.g. "Auth"). */
|
|
39
|
+
pageTitle: string;
|
|
40
|
+
/** System-level instructions (authority rules, output contract). */
|
|
41
|
+
systemPrompt: string;
|
|
42
|
+
/** Page-specific user prompt including source cards and context. */
|
|
43
|
+
userPrompt: string;
|
|
44
|
+
/** Source commit for generated-page provenance. */
|
|
45
|
+
sourceCommit?: string;
|
|
46
|
+
/** Source repository remote for generated-page provenance. */
|
|
47
|
+
sourceRepo?: string;
|
|
48
|
+
/** Source paths cited by the assembled prompt context. */
|
|
49
|
+
sourcePaths?: string[];
|
|
50
|
+
/** Optional token budget for the completion. */
|
|
51
|
+
maxTokens?: number;
|
|
52
|
+
/** Optional sampling temperature. */
|
|
53
|
+
temperature?: number;
|
|
54
|
+
/** Optional reasoning effort for supported reasoning-family models. */
|
|
55
|
+
reasoningEffort?: ReasoningEffort;
|
|
56
|
+
}
|
|
57
|
+
/** Output returned by an LLM provider after synthesis. */
|
|
58
|
+
export interface LLMResponse {
|
|
59
|
+
/** Generated markdown page content. */
|
|
60
|
+
content: string;
|
|
61
|
+
/** Identifier of the provider that produced the response. */
|
|
62
|
+
provider: string;
|
|
63
|
+
/** Prompt tokens consumed (informational; may be undefined for mock). */
|
|
64
|
+
promptTokens?: number;
|
|
65
|
+
/** Completion tokens consumed (informational; may be undefined for mock). */
|
|
66
|
+
completionTokens?: number;
|
|
67
|
+
}
|
|
68
|
+
/** Common interface every LLM backend must implement. */
|
|
69
|
+
export interface LLMProvider {
|
|
70
|
+
/** Stable identifier for logging and frontmatter. */
|
|
71
|
+
readonly name: string;
|
|
72
|
+
/**
|
|
73
|
+
* Synthesise wiki page content for the given request.
|
|
74
|
+
* Throws `LLMProviderError` on unrecoverable failure.
|
|
75
|
+
*/
|
|
76
|
+
complete(request: LLMRequest): Promise<LLMResponse>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Thrown by providers and the factory for all LLM-related failures.
|
|
80
|
+
*
|
|
81
|
+
* try { … } catch (err) {
|
|
82
|
+
* if (err instanceof LLMProviderError && err.retryable) { … }
|
|
83
|
+
* }
|
|
84
|
+
*/
|
|
85
|
+
export declare class LLMProviderError extends Error {
|
|
86
|
+
/** Identifier of the provider that raised the error. */
|
|
87
|
+
readonly provider: string;
|
|
88
|
+
/** Machine-readable code (e.g. 'MISSING_API_KEY', 'RATE_LIMIT'). */
|
|
89
|
+
readonly code: string | undefined;
|
|
90
|
+
/** True when the call may be retried after a short back-off. */
|
|
91
|
+
readonly retryable: boolean;
|
|
92
|
+
constructor(message: string, provider: string, code?: string, retryable?: boolean);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Deterministic provider for tests and local CI.
|
|
96
|
+
* Returns a minimal, reproducible markdown page for any request without
|
|
97
|
+
* making network calls or requiring API credentials.
|
|
98
|
+
*/
|
|
99
|
+
export declare class MockLLMProvider implements LLMProvider {
|
|
100
|
+
readonly name = "mock";
|
|
101
|
+
complete(request: LLMRequest): Promise<LLMResponse>;
|
|
102
|
+
}
|
|
103
|
+
export declare class OpenAICompatibleProvider implements LLMProvider {
|
|
104
|
+
readonly name = "openai-compatible";
|
|
105
|
+
readonly baseUrl: string;
|
|
106
|
+
readonly model: string;
|
|
107
|
+
readonly timeoutMs: number;
|
|
108
|
+
readonly retries: number;
|
|
109
|
+
private readonly apiKey;
|
|
110
|
+
constructor(config: Required<Pick<LLMProviderConfig, 'apiKey' | 'model' | 'baseUrl' | 'timeoutMs' | 'retries'>>);
|
|
111
|
+
complete(request: LLMRequest): Promise<LLMResponse>;
|
|
112
|
+
private postWithRetries;
|
|
113
|
+
private post;
|
|
114
|
+
}
|
|
115
|
+
export type ReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
116
|
+
/** Per-archetype LLM overrides for architecture synthesis requests. */
|
|
117
|
+
export interface ArchitecturePageBudget {
|
|
118
|
+
/** Model override for architecture synthesis. */
|
|
119
|
+
model?: string;
|
|
120
|
+
/** Output-token budget override for architecture synthesis. */
|
|
121
|
+
max_output_tokens?: number;
|
|
122
|
+
/** Timeout override for architecture synthesis. */
|
|
123
|
+
timeout_ms?: number;
|
|
124
|
+
/** Reasoning effort override for architecture synthesis. */
|
|
125
|
+
reasoning_effort?: ReasoningEffort;
|
|
126
|
+
}
|
|
127
|
+
/** Per-archetype LLM override configuration. */
|
|
128
|
+
export interface PageBudgets {
|
|
129
|
+
/** Overrides applied when synthesizing the Architecture page. */
|
|
130
|
+
architecture?: ArchitecturePageBudget;
|
|
131
|
+
}
|
|
132
|
+
/** Configuration passed to `createProvider`. */
|
|
133
|
+
export interface LLMProviderConfig {
|
|
134
|
+
/**
|
|
135
|
+
* Provider identifier.
|
|
136
|
+
* Defaults to `"mock"` so that tests and non-LLM runs work without any
|
|
137
|
+
* further configuration.
|
|
138
|
+
*/
|
|
139
|
+
provider?: string;
|
|
140
|
+
/** API key required by hosted providers. Not used by the mock provider. */
|
|
141
|
+
apiKey?: string;
|
|
142
|
+
/** Environment variable that contains the hosted provider API key. */
|
|
143
|
+
apiKeyEnv?: string;
|
|
144
|
+
/** JSON config alias for `apiKeyEnv`. */
|
|
145
|
+
api_key_env?: string;
|
|
146
|
+
/** Model identifier passed to hosted providers. */
|
|
147
|
+
model?: string;
|
|
148
|
+
/** Optional base URL override for self-hosted or proxy endpoints. */
|
|
149
|
+
baseUrl?: string;
|
|
150
|
+
/** JSON config alias for `baseUrl`. */
|
|
151
|
+
base_url?: string;
|
|
152
|
+
/** Optional system prompt override. */
|
|
153
|
+
systemPrompt?: string;
|
|
154
|
+
/** JSON config alias for `systemPrompt`. */
|
|
155
|
+
system_prompt?: string;
|
|
156
|
+
/** Optional file containing a system prompt override. */
|
|
157
|
+
systemPromptFile?: string;
|
|
158
|
+
/** JSON config alias for `systemPromptFile`. */
|
|
159
|
+
system_prompt_file?: string;
|
|
160
|
+
/** Optional sampling temperature. */
|
|
161
|
+
temperature?: number;
|
|
162
|
+
/** Optional output-token budget. */
|
|
163
|
+
maxOutputTokens?: number;
|
|
164
|
+
/** JSON config alias for `maxOutputTokens`. */
|
|
165
|
+
max_output_tokens?: number;
|
|
166
|
+
/** Hosted provider request timeout in milliseconds. */
|
|
167
|
+
timeoutMs?: number;
|
|
168
|
+
/** JSON config alias for `timeoutMs`. */
|
|
169
|
+
timeout_ms?: number;
|
|
170
|
+
/** Optional reasoning effort for supported reasoning-family models. */
|
|
171
|
+
reasoningEffort?: ReasoningEffort;
|
|
172
|
+
/** JSON config alias for `reasoningEffort`. */
|
|
173
|
+
reasoning_effort?: ReasoningEffort;
|
|
174
|
+
/** Number of retries for retryable hosted provider failures. */
|
|
175
|
+
retries?: number;
|
|
176
|
+
/** Number of corrective retries after wiki patch validation failures. */
|
|
177
|
+
validationRetries?: number;
|
|
178
|
+
/** JSON config alias for `validationRetries`. */
|
|
179
|
+
validation_retries?: number;
|
|
180
|
+
/** Compiler mode alias used when callers pass the whole compiler config. */
|
|
181
|
+
mode?: string;
|
|
182
|
+
/** Nested LLM settings used when callers pass the whole compiler config. */
|
|
183
|
+
llm?: LLMProviderConfig;
|
|
184
|
+
/** Per-archetype LLM overrides (model, output budget, timeout, reasoning effort). */
|
|
185
|
+
page_budgets?: PageBudgets;
|
|
186
|
+
}
|
|
187
|
+
export interface ResolvedLLMProviderConfig extends LLMProviderConfig {
|
|
188
|
+
provider: string;
|
|
189
|
+
model: string;
|
|
190
|
+
baseUrl: string;
|
|
191
|
+
apiKeyEnv: string;
|
|
192
|
+
systemPrompt: string;
|
|
193
|
+
temperature: number;
|
|
194
|
+
maxOutputTokens: number;
|
|
195
|
+
timeoutMs: number;
|
|
196
|
+
reasoningEffort: ReasoningEffort | undefined;
|
|
197
|
+
retries: number;
|
|
198
|
+
validationRetries: number;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Create an `LLMProvider` from configuration resolved with environment overrides.
|
|
202
|
+
*
|
|
203
|
+
* - Omitting `config` returns the mock provider unless `LLMWIKI_LLM_PROVIDER`
|
|
204
|
+
* or `LLMWIKI_COMPILER_MODE` selects a hosted provider.
|
|
205
|
+
* - Explicit `provider: "mock"` remains mock unless `LLMWIKI_LLM_PROVIDER` overrides it.
|
|
206
|
+
* - Specifying an OpenAI-compatible provider without an API key throws
|
|
207
|
+
* `LLMProviderError` with `code: "MISSING_API_KEY"`.
|
|
208
|
+
* - Specifying an unknown provider name throws
|
|
209
|
+
* `LLMProviderError` with `code: "UNKNOWN_PROVIDER"`.
|
|
210
|
+
*
|
|
211
|
+
* This makes missing configuration fail loudly rather than silently falling
|
|
212
|
+
* back to an unexpected behaviour.
|
|
213
|
+
*/
|
|
214
|
+
export declare function createProvider(config?: LLMProviderConfig): LLMProvider;
|
|
215
|
+
/**
|
|
216
|
+
* Create an `LLMProvider` from an already-resolved config without re-reading
|
|
217
|
+
* environment variables. Use this when a caller has applied page/archetype
|
|
218
|
+
* overrides that must not be superseded by global env resolution a second time.
|
|
219
|
+
*/
|
|
220
|
+
export declare function createProviderFromResolvedConfig(resolved: ResolvedLLMProviderConfig): LLMProvider;
|
|
221
|
+
/** Resolve provider configuration from defaults, explicit config, and env vars. */
|
|
222
|
+
export declare function resolveProviderConfig(config?: LLMProviderConfig, env?: NodeJS.ProcessEnv): ResolvedLLMProviderConfig;
|
|
223
|
+
export interface BuildRequestOptions extends Pick<LLMProviderConfig, 'systemPrompt' | 'temperature' | 'maxOutputTokens' | 'reasoningEffort'> {
|
|
224
|
+
/** Optional completion-token budget for the provider. */
|
|
225
|
+
maxTokens?: number;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Assemble an `LLMRequest` from a `PromptContext` using the standard prompt
|
|
229
|
+
* templates. Callers can then pass the result directly to
|
|
230
|
+
* `provider.complete(request)`.
|
|
231
|
+
*
|
|
232
|
+
* @param archetype - Page archetype that selects the prompt template.
|
|
233
|
+
* @param context - Assembled page context (source cards, doc cards, etc.).
|
|
234
|
+
* @param options - Optional request-level prompt and generation settings.
|
|
235
|
+
*/
|
|
236
|
+
export declare function buildRequest(archetype: PageArchetype, context: PromptContext, options?: BuildRequestOptions): LLMRequest;
|
|
237
|
+
export declare function buildRequest(archetype: PageArchetype, context: PromptContext, maxTokens?: number, config?: Pick<LLMProviderConfig, 'systemPrompt' | 'temperature' | 'maxOutputTokens' | 'reasoningEffort'>): LLMRequest;
|
|
238
|
+
/**
|
|
239
|
+
* Resolved per-architecture overrides for model, output token budget, timeout,
|
|
240
|
+
* and reasoning effort. These supplement (not replace) the global provider
|
|
241
|
+
* config.
|
|
242
|
+
*/
|
|
243
|
+
export interface ResolvedArchitectureOverrides {
|
|
244
|
+
/** Architecture-specific model override, or undefined if not set. */
|
|
245
|
+
model: string | undefined;
|
|
246
|
+
/** Architecture-specific max output tokens override, or undefined if not set. */
|
|
247
|
+
maxOutputTokens: number | undefined;
|
|
248
|
+
/** Architecture-specific timeout override, or undefined if not set. */
|
|
249
|
+
timeoutMs: number | undefined;
|
|
250
|
+
/** Architecture-specific reasoning effort override, or undefined if not set. */
|
|
251
|
+
reasoningEffort: ReasoningEffort | undefined;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Resolve architecture-specific model, output-token, timeout, and
|
|
255
|
+
* reasoning-effort overrides.
|
|
256
|
+
*
|
|
257
|
+
* Precedence (highest to lowest):
|
|
258
|
+
* 1. Architecture-specific env vars (`LLMWIKI_LLM_ARCHITECTURE_*`)
|
|
259
|
+
* 2. Global env vars for the same setting (already applied by resolveProviderConfig)
|
|
260
|
+
* 3. `.llmwiki/config.json` `compiler.llm.page_budgets.architecture` overrides
|
|
261
|
+
* 4. Global config defaults (already applied by resolveProviderConfig)
|
|
262
|
+
* 5. Built-in defaults
|
|
263
|
+
*
|
|
264
|
+
* Returns only the fields that are explicitly overridden; callers fall back to
|
|
265
|
+
* the global resolved config for fields that are not set.
|
|
266
|
+
*/
|
|
267
|
+
export declare function resolveArchitectureOverrides(config?: LLMProviderConfig, env?: NodeJS.ProcessEnv): ResolvedArchitectureOverrides;
|