Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/sync-from-base-std/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* LLM_GATEWAY_API_KEY required when any "claude" transformer fires
* DRY_RUN=1 optional — don't write files, just log
* CLAUDE_MODEL optional — defaults to claude-sonnet-5-5
* CLAUDE_MAX_TOKENS optional — defaults to 4096
* CLAUDE_MAX_TOKENS optional — defaults to 16384
* LLM_GATEWAY_BASE_URL optional — overrides the LLM gateway origin
* GUIDELINE_ROUTING optional — "propose" (default) surfaces a guideline-
* derived placement for unrouted source files in the
Expand Down
13 changes: 11 additions & 2 deletions scripts/sync-from-base-std/llm/client.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,17 @@ const GATEWAY_BASE_URL =
/** Default model — Sonnet 5.5. Override with CLAUDE_MODEL env. */
export const DEFAULT_MODEL = process.env.CLAUDE_MODEL || "claude-sonnet-5-5";

/** Default max output tokens. Override with CLAUDE_MAX_TOKENS env. */
export const DEFAULT_MAX_TOKENS = Number(process.env.CLAUDE_MAX_TOKENS || 4096);
/**
* Default max output tokens. Override with CLAUDE_MAX_TOKENS env.
*
* Each page call returns the whole regenerated page, so this cap bounds the
* largest page the sync can edit. 4096 was too small for Sonnet 5.5: its
* tokenizer spends more tokens per char, and an 8,955-char page
* (seize-and-cancel-units.mdx) was truncated and rejected. 16384 fits pages
* of roughly 36k chars. Output is billed per generated token, not per cap,
* and the response is streamed, so a higher cap costs nothing on short pages.
*/
export const DEFAULT_MAX_TOKENS = Number(process.env.CLAUDE_MAX_TOKENS || 16384);

/**
* Haiku model name. Used by the pre-pass that extracts a structured change
Expand Down
12 changes: 7 additions & 5 deletions scripts/sync-from-base-std/release-utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -555,12 +555,14 @@ export function firstHeading(markdown) {
// ------------------------------------------------------------ call decision

/**
* Largest page (chars) a full regeneration can return inside the 4096-token
* output budget. Measured: 4096 tokens came back as 10.7k–14k chars depending
* on how table-heavy the page is. Above this, the completion is cut off and
* refused, so the call is pointless; skip it before it starts.
* Largest page (chars) a full regeneration can return inside the default
* 16384-token output budget (DEFAULT_MAX_TOKENS in llm/client.mjs). Measured
* on Sonnet 5.5: an 8,955-char page overflowed 4096 tokens, so budget about
* 2.2 chars per token, roughly 36k chars at 16384. Keep a margin below that.
* Above this, the completion is cut off and refused, so the call is
* pointless; skip it before it starts.
*/
export const MAX_REGENERABLE_CHARS = 10000;
export const MAX_REGENERABLE_CHARS = 32000;

/** Manifest kinds that change an interface's member inventory. */
const INVENTORY_KINDS = new Set([
Expand Down
Loading