@codeam/shared 2.75.4 → 2.75.5

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.ts CHANGED
@@ -142,14 +142,6 @@ declare function tryGetContextWindow(model: string | null): number | undefined;
142
142
 
143
143
  type AgentId = 'claude' | 'codex' | 'copilot' | 'coderabbit' | 'cursor' | 'aider' | 'gemini' | 'kimi' | 'opencode';
144
144
  type AgentAuthKind = 'oauth_token' | 'api_key' | 'setup_token';
145
- /**
146
- * The agent kinds Headroom (the token-compression proxy) can actually
147
- * wrap/route — the exact subcommands `headroom init --global <kind>`
148
- * accepts. NOT an alias of {@link AgentId}: cursor / gemini / aider run
149
- * native (Headroom disabled) because `headroom init` has no recipe that
150
- * routes them.
151
- */
152
- type HeadroomKind = 'claude' | 'codex' | 'copilot';
153
145
  interface AgentAuth {
154
146
  kind: AgentAuthKind;
155
147
  /** API key plain, or JSON serialized for oauth_token. Interpretation depends on the agent. */
@@ -201,20 +193,6 @@ interface AgentMetadata {
201
193
  enabled: boolean;
202
194
  supportedAuthKinds: AgentAuthKind[];
203
195
  preferredAuthKind: AgentAuthKind;
204
- /**
205
- * Whether Headroom can wrap/route this agent (claude / codex / copilot
206
- * only). Canonical truth previously scattered across two prefix-matching
207
- * predicates: `isHeadroomSupportedAgent` (CLI `host-agent.ts`) and
208
- * `isHeadroomWrappableAgent` (api-v2 `codespaces/headroom.ts`). When
209
- * false the agent MUST run native — wrapping an unsupported agent
210
- * mislaunches it as Claude (the 2026-06 Cursor incident).
211
- */
212
- headroomWrappable: boolean;
213
- /**
214
- * The `headroom init --global <kind>` subcommand for this agent.
215
- * Present iff {@link headroomWrappable} is true.
216
- */
217
- headroomKind?: HeadroomKind;
218
196
  /**
219
197
  * Whether the agent runs over ACP (Agent Client Protocol) in the CLI —
220
198
  * mirrors which agents have an entry in the CLI's ACP adapter registry
@@ -330,31 +308,6 @@ declare const TERMINAL_AGENT_PREFIX = "__terminal__:";
330
308
  * - fall back to anything. Unknown in → `null` out.
331
309
  */
332
310
  declare function normalizeAgentId(raw: string): AgentId | null;
333
- /**
334
- * The `headroom init --global <kind>` subcommand for an agent id, derived
335
- * from the registry's `headroomKind` flags — or `null` for unknown or
336
- * non-wrappable agents (cursor / gemini / aider / anything else).
337
- *
338
- * ⚠️ NEVER falls back to `'claude'`. The historical CLI fallback is how
339
- * the 2026-06 Cursor incident happened: an unsupported agent slipped
340
- * through, defaulted to `claude`, and `headroom wrap claude` launched
341
- * Claude Code instead of the user's agent. Callers that genuinely need a
342
- * default (e.g. picking an init subcommand AFTER the wrappable gate has
343
- * already passed) apply it themselves — see the CLI's
344
- * `agentIdToHeadroomKind` wrapper.
345
- *
346
- * Matching mirrors the historical predicates on BOTH sides (CLI
347
- * `isHeadroomSupportedAgent`, api-v2 `isHeadroomWrappableAgent`):
348
- * case-insensitive, `_`/`-` tolerant, prefix match — so `claude_code`,
349
- * `Claude-Code`, `codex_cli`, `copilot-cli` all resolve.
350
- */
351
- declare function headroomKindFor(agentId: string): HeadroomKind | null;
352
- /**
353
- * Registry-derived replacement for the two scattered predicates
354
- * (`isHeadroomSupportedAgent` in the CLI, `isHeadroomWrappableAgent` in
355
- * api-v2). Accepts both id spaces (`claude_code` and `claude`).
356
- */
357
- declare function isHeadroomWrappable(agentId: string): boolean;
358
311
 
359
312
  /**
360
313
  * Canonical per-agent CLI **install** snippets.
@@ -1713,148 +1666,6 @@ interface BeadsActionRequest {
1713
1666
  projectKey?: string;
1714
1667
  }
1715
1668
 
1716
- /**
1717
- * Headroom budget configuration and command types.
1718
- * Used by the CLI to enable/disable cost-saving Headroom token compression
1719
- * and track spending against configured budgets.
1720
- *
1721
- * CANONICAL WIRE OWNER: this file (`@codeam/shared`) owns the wire
1722
- * protocol, per the cross-repo rule. The backend repo keeps hand-synced
1723
- * MIRRORS (`codeagent-mobile/packages/shared/src/types/headroom.ts` for
1724
- * mobile/landing, `codeagent-mobile/apps/api-v2/src/common/types/headroom.ts`
1725
- * for the backend); a drift-check script at
1726
- * `codeagent-mobile/scripts/check-shared-drift` compares them.
1727
- */
1728
- type HeadroomBudgetPeriod = 'hourly' | 'daily' | 'monthly';
1729
- /**
1730
- * Install-progress milestone emitted on the `headroom_progress` SSE event while
1731
- * a session is provisioning Headroom on-demand. Must stay byte-for-byte aligned
1732
- * with the backend's `HEADROOM_STEPS` validator
1733
- * (`apps/api-v2/src/headroom/headroom.controller.ts`) and the mobile store —
1734
- * the backend 400s (`INVALID_STEP`) on any value outside this set. Note
1735
- * `'provisioning'` is a `HeadroomStatus['state']`, NOT a step.
1736
- */
1737
- type HeadroomStep = 'pip' | 'model' | 'init' | 'proxy' | 'ready';
1738
- /**
1739
- * Command sent via relay to enable/disable/configure Headroom budget settings.
1740
- * The `agentId` field is included because PairedSession has no agentId server-side,
1741
- * so the relay command carries it for the CLI handler to guard on.
1742
- */
1743
- interface HeadroomBudgetCommand {
1744
- budgetEnabled: boolean;
1745
- budgetUsd?: number;
1746
- budgetPeriod?: HeadroomBudgetPeriod;
1747
- agentId?: string;
1748
- }
1749
- /**
1750
- * Budget usage fields appended to the savings payload that the Headroom reporter
1751
- * sends to the backend. Tracks spending in the current budget period.
1752
- */
1753
- interface HeadroomBudgetUsage {
1754
- periodSpendUsd?: number;
1755
- budgetUsd?: number;
1756
- budgetPeriod?: HeadroomBudgetPeriod;
1757
- /** True iff this turn pushed periodSpendUsd to or past budgetUsd. */
1758
- budgetReached?: boolean;
1759
- }
1760
- /**
1761
- * Headroom cost-saving state for a session — carried on the `headroom_status`
1762
- * SSE event and snapshotted by the backend into Redis `headroom:<sessionId>`.
1763
- * Mirrored byte-for-byte in `apps/api-v2/src/common/types/headroom.ts`.
1764
- */
1765
- interface HeadroomStatus {
1766
- state: 'enabled' | 'disabled' | 'error' | 'provisioning';
1767
- running?: boolean;
1768
- agent?: string;
1769
- savings?: number;
1770
- error?: string;
1771
- }
1772
- /** One provider/model slice inside a rollup bucket. */
1773
- interface HeadroomUsageSlice {
1774
- /** Tokens Headroom removed in this bucket (a DELTA, not cumulative). */
1775
- tokens_saved: number;
1776
- compression_savings_usd_delta: number;
1777
- total_input_tokens_delta: number;
1778
- total_input_cost_usd_delta: number;
1779
- }
1780
- /**
1781
- * One rollup bucket. ⚠️ The `*_delta` fields (and `tokens_saved`) are
1782
- * PER-BUCKET; the bare `total_*` fields are the CUMULATIVE value at the
1783
- * bucket's end. Chart the deltas, show the totals as headline figures.
1784
- */
1785
- interface HeadroomUsageBucket {
1786
- /** Bucket start, UTC ISO-8601. */
1787
- timestamp: string;
1788
- tokens_saved: number;
1789
- compression_savings_usd_delta: number;
1790
- total_tokens_saved: number;
1791
- compression_savings_usd: number;
1792
- total_input_tokens_delta: number;
1793
- total_input_tokens: number;
1794
- total_input_cost_usd_delta: number;
1795
- total_input_cost_usd: number;
1796
- by_provider: Record<string, HeadroomUsageSlice>;
1797
- by_model: Record<string, HeadroomUsageSlice>;
1798
- }
1799
- type HeadroomUsageGranularity = 'hourly' | 'daily' | 'weekly' | 'monthly';
1800
- /** Lifetime / current-window totals. */
1801
- interface HeadroomUsageTotals {
1802
- requests: number;
1803
- tokens_saved: number;
1804
- compression_savings_usd: number;
1805
- total_input_tokens: number;
1806
- total_input_cost_usd: number;
1807
- }
1808
- /**
1809
- * The token-usage report the CLI relays for the `headroom_usage` command — a
1810
- * TRIMMED projection of the proxy's `GET /stats-history` (schema_version 3,
1811
- * verified live against headroom 0.27.0).
1812
- *
1813
- * ⚠️ Trimmed ON THE BOX before it ever leaves, for three reasons:
1814
- * - the raw response is ~150 KB (and `history_mode=full` is ~1.1 MB) — too
1815
- * heavy for the command relay; dropping the raw `history[]` and capping the
1816
- * hourly series brings it to ~23 KB.
1817
- * - `history[]` carries CUMULATIVE counters that would have to be diffed,
1818
- * while `series[]` already provides per-bucket deltas AND the
1819
- * `by_model` / `by_provider` breakdown (richer than Headroom's own CSV
1820
- * export, which has no model column).
1821
- * - the proxy's `storage_path` leaks a local filesystem path (including the
1822
- * OS username) and is stripped.
1823
- */
1824
- interface HeadroomUsageReport {
1825
- /** Headroom's own payload schema version (3 at time of writing). */
1826
- schemaVersion: number;
1827
- /** When the proxy generated the snapshot (UTC ISO-8601). */
1828
- generatedAt: string;
1829
- /** Proxy version that produced it, when known. */
1830
- proxyVersion?: string;
1831
- /** Durable, all-time totals across proxy restarts. */
1832
- lifetime: HeadroomUsageTotals;
1833
- /** The proxy's current display session (rolls over after inactivity). */
1834
- currentSession?: HeadroomUsageTotals & {
1835
- savings_percent?: number;
1836
- started_at?: string | null;
1837
- last_activity_at?: string | null;
1838
- };
1839
- /** Rollups. `hourly` is capped to the most recent buckets to bound size. */
1840
- series: Partial<Record<HeadroomUsageGranularity, HeadroomUsageBucket[]>>;
1841
- /** The proxy's retention policy, so the UI can state the window honestly. */
1842
- retention?: {
1843
- max_history_points?: number;
1844
- max_history_age_days?: number;
1845
- };
1846
- }
1847
- /** Result of the `headroom_usage` relay command. */
1848
- interface HeadroomUsageResult {
1849
- /** False when the proxy isn't reachable / Headroom isn't active here. */
1850
- available: boolean;
1851
- report?: HeadroomUsageReport;
1852
- /** Human-readable reason when `available` is false. */
1853
- error?: string;
1854
- }
1855
- /** Relay command type for pulling the token-usage report. */
1856
- declare const HEADROOM_USAGE_COMMAND = "headroom_usage";
1857
-
1858
1669
  /**
1859
1670
  * Session agent switch — wire types for the `switch_agent` relay command and
1860
1671
  * its progress/status SSE events.
@@ -2035,84 +1846,6 @@ interface SquadStatsResult {
2035
1846
  /** Per-agent specialty blurbs for the team preamble. Copy, not routing. */
2036
1847
  declare const SQUAD_SPECIALTIES: Readonly<Partial<Record<AgentId, string>>>;
2037
1848
 
2038
- /**
2039
- * Headroom provisioning manifest — the SINGLE source of truth for what a
2040
- * Headroom install consists of, rendered by every provisioning surface:
2041
- *
2042
- * - codespace bootstrap (bash composer in the backend repo,
2043
- * `apps/api-v2/src/codespaces/github-ssh.service.ts` — adopts in PR-2),
2044
- * - self-hosted deploy (TS installer, CLI `commands/host-agent.ts`
2045
- * `setupHeadroomForSelfHosted`),
2046
- * - on-demand local sessions ("Session add-ons → Cost-saving", CLI
2047
- * `services/headroom/configure.ts`).
2048
- *
2049
- * Values are DATA-first (arrays/records, plus tiny pure renderers) so both
2050
- * the TS installer and a bash composer can interpolate from them. Renderers
2051
- * are byte-exact with the literals they replaced — guarded by
2052
- * `packages/shared/__tests__/headroom-manifest.test.ts`.
2053
- *
2054
- * ⚠️ The extras matter: `[proxy,code]` pulls the ONNX compression engines
2055
- * (Kompress + tree-sitter CodeCompressor). NEVER add `[ml]` — that's
2056
- * multi-GB PyTorch, and a broken/cold torch wedges every prompt at
2057
- * "Thinking…". The models are pre-downloaded at provision time because the
2058
- * proxy eager-loads with `allow_download=False` and a cold cache defers the
2059
- * ~840 MB download to the first prompt (blowing the agent's ~90 s idle
2060
- * timeout).
2061
- */
2062
- /** Local proxy port the agent's config is routed to. */
2063
- declare const HEADROOM_PROXY_PORT = 8787;
2064
- /**
2065
- * Env that pins the ONNX backend on the proxy process — never imports
2066
- * torch. Spread into the proxy launch env on every surface.
2067
- */
2068
- declare const HEADROOM_BACKEND_ENV: {
2069
- readonly HEADROOM_KOMPRESS_BACKEND: "onnx_cpu";
2070
- };
2071
- /**
2072
- * The proxy's HTTP/server companion packages, installed alongside the
2073
- * `headroom-ai[...]` package. The COMPRESSION ENGINES come from the
2074
- * headroom-ai extras — NOT this list.
2075
- */
2076
- declare const HEADROOM_PIP_COMPANIONS: readonly string[];
2077
- /** The three provisioning surfaces (see module doc). */
2078
- type HeadroomSurface = 'codespace' | 'selfHosted' | 'onDemand';
2079
- /**
2080
- * pip extras per surface. `onDemand` additionally ships `image`
2081
- * (image-compression support, added with the Session add-ons path in
2082
- * codeam-cli@2.49.0); the older codespace/self-hosted install strings
2083
- * remain `[proxy,code]` byte-for-byte.
2084
- */
2085
- declare const HEADROOM_EXTRAS_BY_SURFACE: Readonly<Record<HeadroomSurface, readonly string[]>>;
2086
- /** `headroom-ai[<extras>]` — the pip requirement string. */
2087
- declare function headroomPipPackage(extras: readonly string[]): string;
2088
- /** One HuggingFace repo to pre-warm into the HF cache at provision time. */
2089
- interface HeadroomModelSpec {
2090
- repo: string;
2091
- /** `snapshot_download(..., allow_patterns=[…])` filter. */
2092
- allowPatterns: readonly string[];
2093
- }
2094
- /**
2095
- * The two HF repos Kompress needs. kompress-v2-base is the ONNX model
2096
- * (skip its .pt/.safetensors torch artifacts); ModernBERT-base is the
2097
- * TOKENIZER ONLY (skip its model weights).
2098
- */
2099
- declare const HEADROOM_MODELS: readonly HeadroomModelSpec[];
2100
- /** Formatting knob so each surface can stay byte-identical to its
2101
- * historical literal (the CLI joins patterns with `,`, the codespace
2102
- * bash composer with `, `). */
2103
- interface HeadroomPythonRenderOpts {
2104
- /** Put a space after the commas between allow_patterns entries. */
2105
- spaceAfterComma?: boolean;
2106
- }
2107
- /** Render one `snapshot_download(...)` python line for a model. */
2108
- declare function headroomSnapshotDownloadLine(model: HeadroomModelSpec, opts?: HeadroomPythonRenderOpts): string;
2109
- /**
2110
- * The full model pre-download python snippet (import + one
2111
- * `snapshot_download` per model), newline-joined — what the surfaces pass
2112
- * to `python -c` / a heredoc.
2113
- */
2114
- declare function headroomModelPredownloadScript(opts?: HeadroomPythonRenderOpts): string;
2115
-
2116
1849
  /**
2117
1850
  * Canonical names of the per-user SSE bus events (`/api/users/me/stream`).
2118
1851
  *
@@ -2157,7 +1890,6 @@ declare const USER_EVENTS: {
2157
1890
  readonly CREDENTIAL_INVALID: "credential_invalid";
2158
1891
  readonly CODESPACE_WAKING: "codespace_waking";
2159
1892
  readonly CODESPACE_BILLING_BLOCKED: "codespace_billing_blocked";
2160
- readonly COST_SAVING_UPDATED: "cost_saving_updated";
2161
1893
  readonly COMMAND_COMPLETED: "command_completed";
2162
1894
  readonly AI_SUMMARY_PENDING: "ai_summary_pending";
2163
1895
  readonly AI_SUMMARY_READY: "ai_summary_ready";
@@ -2199,10 +1931,7 @@ declare const USER_EVENTS: {
2199
1931
  * a box never creates. */
2200
1932
  readonly FLEET_BOX_READY: "fleet_box_ready";
2201
1933
  readonly REFERRAL_REWARD_EARNED: "referral_reward_earned";
2202
- readonly HEADROOM_PROGRESS: "headroom_progress";
2203
- readonly HEADROOM_STATUS: "headroom_status";
2204
1934
  readonly BEADS_STATUS: "beads_status";
2205
- readonly LINKED_AGENT_HEADROOM_BUDGET_UPDATED: "linked_agent_headroom_budget_updated";
2206
1935
  readonly CLI_UPDATE_AVAILABLE: "cli_update_available";
2207
1936
  readonly AGENT_INSTALL_PROGRESS: "agent_install_progress";
2208
1937
  readonly AGENT_INSTALL_FAILED: "agent_install_failed";
@@ -2237,6 +1966,14 @@ declare const USER_EVENTS: {
2237
1966
  * debits: those are one per agent hop, and the client already walks its
2238
1967
  * own balance down as metered usage streams in. */
2239
1968
  readonly CREDITS_CHANGED: "credits_changed";
1969
+ /** La recarga automatica NO se hizo, y el motivo significa algo para el
1970
+ * usuario (enfriamiento, tope diario o mensual, pausada, apagada).
1971
+ * ⚠️ Existe porque antes el saldo llegaba a cero EN SILENCIO: la sesion se
1972
+ * paraba y no habia una sola pista de por que no se habia recargado sola
1973
+ * (2026-09-17). Los motivos internos —`duplicate_intent` y compañia— no se
1974
+ * publican: no dicen nada a quien los lee. El CLI no lo consume; vive aqui
1975
+ * porque este fichero es la fuente del espejo que valida `shared-type-drift`. */
1976
+ readonly AUTO_RECHARGE_BLOCKED: "auto_recharge_blocked";
2240
1977
  };
2241
1978
  type UserEventName = (typeof USER_EVENTS)[keyof typeof USER_EVENTS];
2242
1979
 
@@ -2252,4 +1989,4 @@ type UserEventName = (typeof USER_EVENTS)[keyof typeof USER_EVENTS];
2252
1989
  */
2253
1990
  declare const PREVIEW_DETECT_PROMPT: string;
2254
1991
 
2255
- export { AGENT_REGISTRY, AGENT_STANDARD_BLOCK, AGENT_STANDARD_MARKER, AGENT_STANDARD_TEXT, type AgentAuth, type AgentAuthKind, type AgentId, type AgentMetadata, type AgentMode, type AgentModel, type AgentReviewFinding, type AgentReviewPlan, type AgentReviewReport, type AnswerResolvedEvent, type AwaitingAnswerEvent, type AwaitingAnswerOption, type BeadsActionCommand, type BeadsActionKind, type BeadsActionPayload, type BeadsActionRequest, type BeadsActionType, type BeadsConfigureAction, type BeadsDependencyDto, type BeadsDependencyKind, type BeadsIngestPayload, type BeadsIssueDto, type BeadsIssueStatus, type BeadsMemoryDto, type BeadsProjectDto, type BeadsProvisioningPayload, type BeadsProvisioningStatus, type BeadsSnapshotDto, type BeadsStatus, type BeadsStatusState, type BeadsStatusSummary, type BlameLineWire, type BrokeredIntegrationToken, CODER_PROMPT, type ChromeStep, type ChromeToolType, type CommitEntryWire, DEFAULT_API_BASE_URL, DEFAULT_GUARDRAIL_POLICY, DEP_TO_INTEGRATION, DEV_API_BASE_URL, type DerivedCredentialSource, type EnvVar, type FileBlameEvent, type FileChangeStatus, type FileChangedEvent, type FileHistoryEvent, type FileReviewStatus, GUARDRAIL_CATEGORIES, GUARDRAIL_CATEGORY_META, GUARDRAIL_CONFIGURE_COMMAND, GUARDRAIL_DISPOSITIONS, type GuardrailCategory, type GuardrailCategoryMeta, type GuardrailDisposition, type GuardrailPolicy, HANDOFF_FENCE_TAG, HEADROOM_BACKEND_ENV, HEADROOM_EXTRAS_BY_SURFACE, HEADROOM_MODELS, HEADROOM_PIP_COMPANIONS, HEADROOM_PROXY_PORT, HEADROOM_USAGE_COMMAND, HEARTBEAT_INTERVAL_MS_DEFAULT, HOUSE_AGENT_ID, HOUSE_AGENT_NAME, HOUSE_AGENT_PROVIDER, HOUSE_AGENT_SUBTITLE, HOUSE_AGENT_VENDOR, type HandoffProposal, type HandoffResolution, type HeadroomBudgetCommand, type HeadroomBudgetPeriod, type HeadroomBudgetUsage, type HeadroomKind, type HeadroomModelSpec, type HeadroomPythonRenderOpts, type HeadroomStatus, type HeadroomStep, type HeadroomSurface, type HeadroomUsageBucket, type HeadroomUsageGranularity, type HeadroomUsageReport, type HeadroomUsageResult, type HeadroomUsageSlice, type HeadroomUsageTotals, type HunkLineType, INSTALL_SNIPPETS, INTEGRATION_BRANDING, INTEGRATION_REGISTRY, INTERNAL_TO_PUBLIC, type InputSuggestionChunk, type IntegrationApiKeyField, type IntegrationAuthKind, type IntegrationBranding, type IntegrationCategory, type IntegrationDefinition, type IntegrationDelivery, type IntegrationHealth, type IntegrationId, type IntegrationMcpDelivery, type IntegrationStatus, type IntegrationsManifest, type IntegrationsManifestEntry, LINKED_AGENT_IDS, type LinkedAgentId, MANAGED_AGENT_ENV, MANAGED_AGENT_SUBTITLE, MANAGED_PROVIDER_DISPLAY_NAMES, MANAGED_PROVIDER_IDS, MODEL_CONTEXT_WINDOW, MODEL_PRICING, type ManagedProviderId, type MissingService, type ModelPricing, type NormalizedMessage, OBSERVER_BRIDGE_PORT, PACK_ACTION_COMMAND, PACK_REGISTRY, PACK_START_COMMAND, PACK_STATUS_COMMAND, PACK_WORKFLOW_ARTICLE, PREVIEW_DETECT_PROMPT, PROTOCOL_VERSION, PUBLIC_TO_INTERNAL, type PackActionKind, type PackActionPayload, type PackDefinition, type PackHandoffRecord, type PackId, type PackRunState, type PackRunStatus, type PackStageDef, type PackStageState, type PackStageStatus, type PackStartPayload, type PendingReviewHunkEvent, type PendingReviewHunkLine, type PrCheck, type PrRef, type PrReviewEntry, type PrReviewVerdict, type PreviewDetection, type PreviewErrorStage, type PreviewState, type PreviewStatus, type PullRequestDetail, type PullRequestSummary, QA_PROMPT, REVIEWER_PROMPT, type RemoteCommand, type RepoStack, type RepoStackDetection, SKILL_REGISTRY, SPECIFIER_PROMPT, SQUAD_CONFIGURE_COMMAND, SQUAD_HOP_BUDGET_DEFAULT, SQUAD_HOP_BUDGET_MAX, SQUAD_HOP_BUDGET_MIN, SQUAD_SPECIALTIES, SQUAD_STATS_COMMAND, SSE_SOCKET_TIMEOUT_MS, STACK_TO_RECOMMENDED, SWITCH_AGENT_COMMAND, type SelectPrompt, type SkillDefinition, type SkillDelivery, type SkillFileDelivery, type SkillId, type SkillRail, type SkillsManifest, type SkillsManifestEntry, type SquadAutoConfig, type SquadConfigurePayload, type SquadConfigureResult, type SquadMemberActivity, type SquadRosterAgent, type SquadRosterData, type SquadStatsResult, type StartTaskFailedResult, type StartTaskPayload, type StreamingChunkEvent, type StreamingChunkKind, type SwitchAgentCommand, type SwitchAgentResult, type SwitchAgentStatus, type SwitchAgentStep, TERMINAL_AGENT_PREFIX, UNKNOWN_MODEL_PRICING, UPCOMING_INTEGRATION_IDS, USER_EVENTS, type UserEventName, clampHopBudget, classifyStack, detectedIntegrationsFromDeps, getAgent, getContextWindow, getEnabledAgents, getEnabledIntegrations, getIntegration, getIntegrationBranding, getIntegrationsByCategory, getPackDefinition, getPricing, getSkillDefinition, headroomKindFor, headroomModelPredownloadScript, headroomPipPackage, headroomSnapshotDownloadLine, installableAgentIds, internalToPublic, isGuardrailDisposition, isHeadroomWrappable, isKnownAgentId, isKnownIntegrationId, isKnownModel, isLinkedAgentId, isManagedProviderId, isNoopInstallSnippet, isPackId, isSkillId, normalizeAgentId, normalizeGuardrailPolicy, publicToInternal, recommendForDeps, renderToLines, resolveApiBaseUrl, skillHasRail, toRemoteCommand, tryGetContextWindow };
1992
+ export { AGENT_REGISTRY, AGENT_STANDARD_BLOCK, AGENT_STANDARD_MARKER, AGENT_STANDARD_TEXT, type AgentAuth, type AgentAuthKind, type AgentId, type AgentMetadata, type AgentMode, type AgentModel, type AgentReviewFinding, type AgentReviewPlan, type AgentReviewReport, type AnswerResolvedEvent, type AwaitingAnswerEvent, type AwaitingAnswerOption, type BeadsActionCommand, type BeadsActionKind, type BeadsActionPayload, type BeadsActionRequest, type BeadsActionType, type BeadsConfigureAction, type BeadsDependencyDto, type BeadsDependencyKind, type BeadsIngestPayload, type BeadsIssueDto, type BeadsIssueStatus, type BeadsMemoryDto, type BeadsProjectDto, type BeadsProvisioningPayload, type BeadsProvisioningStatus, type BeadsSnapshotDto, type BeadsStatus, type BeadsStatusState, type BeadsStatusSummary, type BlameLineWire, type BrokeredIntegrationToken, CODER_PROMPT, type ChromeStep, type ChromeToolType, type CommitEntryWire, DEFAULT_API_BASE_URL, DEFAULT_GUARDRAIL_POLICY, DEP_TO_INTEGRATION, DEV_API_BASE_URL, type DerivedCredentialSource, type EnvVar, type FileBlameEvent, type FileChangeStatus, type FileChangedEvent, type FileHistoryEvent, type FileReviewStatus, GUARDRAIL_CATEGORIES, GUARDRAIL_CATEGORY_META, GUARDRAIL_CONFIGURE_COMMAND, GUARDRAIL_DISPOSITIONS, type GuardrailCategory, type GuardrailCategoryMeta, type GuardrailDisposition, type GuardrailPolicy, HANDOFF_FENCE_TAG, HEARTBEAT_INTERVAL_MS_DEFAULT, HOUSE_AGENT_ID, HOUSE_AGENT_NAME, HOUSE_AGENT_PROVIDER, HOUSE_AGENT_SUBTITLE, HOUSE_AGENT_VENDOR, type HandoffProposal, type HandoffResolution, type HunkLineType, INSTALL_SNIPPETS, INTEGRATION_BRANDING, INTEGRATION_REGISTRY, INTERNAL_TO_PUBLIC, type InputSuggestionChunk, type IntegrationApiKeyField, type IntegrationAuthKind, type IntegrationBranding, type IntegrationCategory, type IntegrationDefinition, type IntegrationDelivery, type IntegrationHealth, type IntegrationId, type IntegrationMcpDelivery, type IntegrationStatus, type IntegrationsManifest, type IntegrationsManifestEntry, LINKED_AGENT_IDS, type LinkedAgentId, MANAGED_AGENT_ENV, MANAGED_AGENT_SUBTITLE, MANAGED_PROVIDER_DISPLAY_NAMES, MANAGED_PROVIDER_IDS, MODEL_CONTEXT_WINDOW, MODEL_PRICING, type ManagedProviderId, type MissingService, type ModelPricing, type NormalizedMessage, OBSERVER_BRIDGE_PORT, PACK_ACTION_COMMAND, PACK_REGISTRY, PACK_START_COMMAND, PACK_STATUS_COMMAND, PACK_WORKFLOW_ARTICLE, PREVIEW_DETECT_PROMPT, PROTOCOL_VERSION, PUBLIC_TO_INTERNAL, type PackActionKind, type PackActionPayload, type PackDefinition, type PackHandoffRecord, type PackId, type PackRunState, type PackRunStatus, type PackStageDef, type PackStageState, type PackStageStatus, type PackStartPayload, type PendingReviewHunkEvent, type PendingReviewHunkLine, type PrCheck, type PrRef, type PrReviewEntry, type PrReviewVerdict, type PreviewDetection, type PreviewErrorStage, type PreviewState, type PreviewStatus, type PullRequestDetail, type PullRequestSummary, QA_PROMPT, REVIEWER_PROMPT, type RemoteCommand, type RepoStack, type RepoStackDetection, SKILL_REGISTRY, SPECIFIER_PROMPT, SQUAD_CONFIGURE_COMMAND, SQUAD_HOP_BUDGET_DEFAULT, SQUAD_HOP_BUDGET_MAX, SQUAD_HOP_BUDGET_MIN, SQUAD_SPECIALTIES, SQUAD_STATS_COMMAND, SSE_SOCKET_TIMEOUT_MS, STACK_TO_RECOMMENDED, SWITCH_AGENT_COMMAND, type SelectPrompt, type SkillDefinition, type SkillDelivery, type SkillFileDelivery, type SkillId, type SkillRail, type SkillsManifest, type SkillsManifestEntry, type SquadAutoConfig, type SquadConfigurePayload, type SquadConfigureResult, type SquadMemberActivity, type SquadRosterAgent, type SquadRosterData, type SquadStatsResult, type StartTaskFailedResult, type StartTaskPayload, type StreamingChunkEvent, type StreamingChunkKind, type SwitchAgentCommand, type SwitchAgentResult, type SwitchAgentStatus, type SwitchAgentStep, TERMINAL_AGENT_PREFIX, UNKNOWN_MODEL_PRICING, UPCOMING_INTEGRATION_IDS, USER_EVENTS, type UserEventName, clampHopBudget, classifyStack, detectedIntegrationsFromDeps, getAgent, getContextWindow, getEnabledAgents, getEnabledIntegrations, getIntegration, getIntegrationBranding, getIntegrationsByCategory, getPackDefinition, getPricing, getSkillDefinition, installableAgentIds, internalToPublic, isGuardrailDisposition, isKnownAgentId, isKnownIntegrationId, isKnownModel, isLinkedAgentId, isManagedProviderId, isNoopInstallSnippet, isPackId, isSkillId, normalizeAgentId, normalizeGuardrailPolicy, publicToInternal, recommendForDeps, renderToLines, resolveApiBaseUrl, skillHasRail, toRemoteCommand, tryGetContextWindow };
package/dist/index.js CHANGED
@@ -34,12 +34,6 @@ __export(index_exports, {
34
34
  GUARDRAIL_CONFIGURE_COMMAND: () => GUARDRAIL_CONFIGURE_COMMAND,
35
35
  GUARDRAIL_DISPOSITIONS: () => GUARDRAIL_DISPOSITIONS,
36
36
  HANDOFF_FENCE_TAG: () => HANDOFF_FENCE_TAG,
37
- HEADROOM_BACKEND_ENV: () => HEADROOM_BACKEND_ENV,
38
- HEADROOM_EXTRAS_BY_SURFACE: () => HEADROOM_EXTRAS_BY_SURFACE,
39
- HEADROOM_MODELS: () => HEADROOM_MODELS,
40
- HEADROOM_PIP_COMPANIONS: () => HEADROOM_PIP_COMPANIONS,
41
- HEADROOM_PROXY_PORT: () => HEADROOM_PROXY_PORT,
42
- HEADROOM_USAGE_COMMAND: () => HEADROOM_USAGE_COMMAND,
43
37
  HEARTBEAT_INTERVAL_MS_DEFAULT: () => HEARTBEAT_INTERVAL_MS_DEFAULT,
44
38
  HOUSE_AGENT_ID: () => HOUSE_AGENT_ID,
45
39
  HOUSE_AGENT_NAME: () => HOUSE_AGENT_NAME,
@@ -96,14 +90,9 @@ __export(index_exports, {
96
90
  getPackDefinition: () => getPackDefinition,
97
91
  getPricing: () => getPricing,
98
92
  getSkillDefinition: () => getSkillDefinition,
99
- headroomKindFor: () => headroomKindFor,
100
- headroomModelPredownloadScript: () => headroomModelPredownloadScript,
101
- headroomPipPackage: () => headroomPipPackage,
102
- headroomSnapshotDownloadLine: () => headroomSnapshotDownloadLine,
103
93
  installableAgentIds: () => installableAgentIds,
104
94
  internalToPublic: () => internalToPublic,
105
95
  isGuardrailDisposition: () => isGuardrailDisposition,
106
- isHeadroomWrappable: () => isHeadroomWrappable,
107
96
  isKnownAgentId: () => isKnownAgentId,
108
97
  isKnownIntegrationId: () => isKnownIntegrationId,
109
98
  isKnownModel: () => isKnownModel,
@@ -356,8 +345,6 @@ var AGENT_REGISTRY = {
356
345
  // `claude setup-token` → delivered via CLAUDE_CODE_OAUTH_TOKEN.
357
346
  supportedAuthKinds: ["setup_token", "oauth_token", "api_key"],
358
347
  preferredAuthKind: "setup_token",
359
- headroomWrappable: true,
360
- headroomKind: "claude",
361
348
  // npm adapter `@agentclientprotocol/claude-agent-acp`.
362
349
  acp: true
363
350
  },
@@ -368,8 +355,6 @@ var AGENT_REGISTRY = {
368
355
  enabled: true,
369
356
  supportedAuthKinds: ["oauth_token", "api_key"],
370
357
  preferredAuthKind: "oauth_token",
371
- headroomWrappable: true,
372
- headroomKind: "codex",
373
358
  // npm adapter `@agentclientprotocol/codex-acp`.
374
359
  acp: true,
375
360
  // OAuth device-code flow; the user_code on the OpenAI page IS a real
@@ -384,10 +369,7 @@ var AGENT_REGISTRY = {
384
369
  enabled: false,
385
370
  supportedAuthKinds: ["oauth_token"],
386
371
  preferredAuthKind: "oauth_token",
387
- // `headroom init --global copilot` exists even though the agent is
388
372
  // still disabled here (no runtime builder yet).
389
- headroomWrappable: true,
390
- headroomKind: "copilot",
391
373
  acp: false
392
374
  },
393
375
  coderabbit: {
@@ -403,7 +385,6 @@ var AGENT_REGISTRY = {
403
385
  // user's own machine, so linking is always CLI-mediated.
404
386
  supportedAuthKinds: ["oauth_token", "api_key"],
405
387
  preferredAuthKind: "oauth_token",
406
- headroomWrappable: false,
407
388
  // Legacy PTY runtime — no ACP adapter registered.
408
389
  acp: false
409
390
  },
@@ -419,9 +400,7 @@ var AGENT_REGISTRY = {
419
400
  // no longer offers api_key.
420
401
  supportedAuthKinds: ["oauth_token"],
421
402
  preferredAuthKind: "oauth_token",
422
- // `headroom wrap cursor` is "manual/print-only" (IDE settings; the
423
403
  // headless cursor-agent CLI has no base-URL override) — runs native.
424
- headroomWrappable: false,
425
404
  // Native ACP server: `cursor-agent acp`.
426
405
  acp: true,
427
406
  // Reverse-engineered device/poll flow; `userCode` is the secret PKCE
@@ -439,7 +418,6 @@ var AGENT_REGISTRY = {
439
418
  // this via the existing --api-key escape hatch in commands/link.ts.
440
419
  supportedAuthKinds: ["api_key"],
441
420
  preferredAuthKind: "api_key",
442
- headroomWrappable: false,
443
421
  // Legacy PTY runtime — no ACP adapter registered.
444
422
  acp: false
445
423
  },
@@ -476,8 +454,6 @@ var AGENT_REGISTRY = {
476
454
  // provider, where the ineligible-tier message already explains why.
477
455
  supportedAuthKinds: ["api_key"],
478
456
  preferredAuthKind: "api_key",
479
- // Not listed by `headroom wrap --help` — runs native.
480
- headroomWrappable: false,
481
457
  // Native ACP server: `gemini --skip-trust --acp`.
482
458
  acp: true
483
459
  },
@@ -493,8 +469,6 @@ var AGENT_REGISTRY = {
493
469
  // that blob server-side is a separate reverse-engineering spike (phase 2).
494
470
  supportedAuthKinds: ["api_key", "oauth_token"],
495
471
  preferredAuthKind: "api_key",
496
- // Moonshot's `kimi` is not listed by `headroom wrap --help` — runs native.
497
- headroomWrappable: false,
498
472
  // Native ACP server: `kimi acp` (stdio JSON-RPC, answers `initialize`).
499
473
  acp: true
500
474
  },
@@ -509,8 +483,6 @@ var AGENT_REGISTRY = {
509
483
  // the matching env var (detected by prefix) at deploy. api_key only.
510
484
  supportedAuthKinds: ["api_key"],
511
485
  preferredAuthKind: "api_key",
512
- // Not listed by `headroom init --global` (claude/codex/copilot only) — native.
513
- headroomWrappable: false,
514
486
  // Native ACP server: `opencode acp` (stdio JSON-RPC).
515
487
  acp: true
516
488
  }
@@ -642,19 +614,6 @@ function normalizeAgentId(raw) {
642
614
  if (isKnownAgentId(unprefixed)) return unprefixed;
643
615
  return AGENT_ID_ALIASES[unprefixed] ?? null;
644
616
  }
645
- function headroomKindFor(agentId) {
646
- const normalized = (agentId ?? "").toLowerCase().replace(/[_-]/g, "");
647
- if (!normalized) return null;
648
- for (const meta of Object.values(AGENT_REGISTRY)) {
649
- if (meta.headroomKind !== void 0 && normalized.startsWith(meta.id)) {
650
- return meta.headroomKind;
651
- }
652
- }
653
- return null;
654
- }
655
- function isHeadroomWrappable(agentId) {
656
- return headroomKindFor(agentId) !== null;
657
- }
658
617
 
659
618
  // src/agents/install-snippets.ts
660
619
  var CODEX = `
@@ -2906,9 +2865,6 @@ function resolveApiBaseUrl() {
2906
2865
  return DEFAULT_API_BASE_URL;
2907
2866
  }
2908
2867
 
2909
- // src/types/headroom.ts
2910
- var HEADROOM_USAGE_COMMAND = "headroom_usage";
2911
-
2912
2868
  // src/types/agent-switch.ts
2913
2869
  var SWITCH_AGENT_COMMAND = "switch_agent";
2914
2870
 
@@ -2932,48 +2888,6 @@ var SQUAD_SPECIALTIES = {
2932
2888
  opencode: "general implementation tasks"
2933
2889
  };
2934
2890
 
2935
- // src/headroom/manifest.ts
2936
- var HEADROOM_PROXY_PORT = 8787;
2937
- var HEADROOM_BACKEND_ENV = {
2938
- HEADROOM_KOMPRESS_BACKEND: "onnx_cpu"
2939
- };
2940
- var HEADROOM_PIP_COMPANIONS = [
2941
- "fastapi",
2942
- "uvicorn",
2943
- "httpx[http2]",
2944
- "websockets",
2945
- "zstandard"
2946
- ];
2947
- var HEADROOM_EXTRAS_BY_SURFACE = {
2948
- codespace: ["proxy", "code"],
2949
- selfHosted: ["proxy", "code"],
2950
- onDemand: ["proxy", "code", "image"]
2951
- };
2952
- function headroomPipPackage(extras) {
2953
- return `headroom-ai[${extras.join(",")}]`;
2954
- }
2955
- var HEADROOM_MODELS = [
2956
- {
2957
- repo: "chopratejas/kompress-v2-base",
2958
- allowPatterns: ["*.json", "onnx/*.onnx", "kompress-int8-wo.onnx"]
2959
- },
2960
- {
2961
- repo: "answerdotai/ModernBERT-base",
2962
- allowPatterns: ["*.json", "tokenizer*", "*.txt", "vocab*", "merges*"]
2963
- }
2964
- ];
2965
- function headroomSnapshotDownloadLine(model, opts = {}) {
2966
- const sep = opts.spaceAfterComma ? ", " : ",";
2967
- const patterns = model.allowPatterns.map((p) => `"${p}"`).join(sep);
2968
- return `snapshot_download("${model.repo}", allow_patterns=[${patterns}])`;
2969
- }
2970
- function headroomModelPredownloadScript(opts = {}) {
2971
- return [
2972
- "from huggingface_hub import snapshot_download",
2973
- ...HEADROOM_MODELS.map((m) => headroomSnapshotDownloadLine(m, opts))
2974
- ].join("\n");
2975
- }
2976
-
2977
2891
  // src/types/events.ts
2978
2892
  var USER_EVENTS = {
2979
2893
  PAIRED_SESSION_STATUS: "paired_session_status",
@@ -3005,7 +2919,6 @@ var USER_EVENTS = {
3005
2919
  CREDENTIAL_INVALID: "credential_invalid",
3006
2920
  CODESPACE_WAKING: "codespace_waking",
3007
2921
  CODESPACE_BILLING_BLOCKED: "codespace_billing_blocked",
3008
- COST_SAVING_UPDATED: "cost_saving_updated",
3009
2922
  COMMAND_COMPLETED: "command_completed",
3010
2923
  AI_SUMMARY_PENDING: "ai_summary_pending",
3011
2924
  AI_SUMMARY_READY: "ai_summary_ready",
@@ -3047,10 +2960,7 @@ var USER_EVENTS = {
3047
2960
  * a box never creates. */
3048
2961
  FLEET_BOX_READY: "fleet_box_ready",
3049
2962
  REFERRAL_REWARD_EARNED: "referral_reward_earned",
3050
- HEADROOM_PROGRESS: "headroom_progress",
3051
- HEADROOM_STATUS: "headroom_status",
3052
2963
  BEADS_STATUS: "beads_status",
3053
- LINKED_AGENT_HEADROOM_BUDGET_UPDATED: "linked_agent_headroom_budget_updated",
3054
2964
  CLI_UPDATE_AVAILABLE: "cli_update_available",
3055
2965
  AGENT_INSTALL_PROGRESS: "agent_install_progress",
3056
2966
  AGENT_INSTALL_FAILED: "agent_install_failed",
@@ -3100,7 +3010,15 @@ var USER_EVENTS = {
3100
3010
  * balance, so nothing has to be fetched to render it. ⚠️ NOT published on
3101
3011
  * debits: those are one per agent hop, and the client already walks its
3102
3012
  * own balance down as metered usage streams in. */
3103
- CREDITS_CHANGED: "credits_changed"
3013
+ CREDITS_CHANGED: "credits_changed",
3014
+ /** La recarga automatica NO se hizo, y el motivo significa algo para el
3015
+ * usuario (enfriamiento, tope diario o mensual, pausada, apagada).
3016
+ * ⚠️ Existe porque antes el saldo llegaba a cero EN SILENCIO: la sesion se
3017
+ * paraba y no habia una sola pista de por que no se habia recargado sola
3018
+ * (2026-09-17). Los motivos internos —`duplicate_intent` y compañia— no se
3019
+ * publican: no dicen nada a quien los lee. El CLI no lo consume; vive aqui
3020
+ * porque este fichero es la fuente del espejo que valida `shared-type-drift`. */
3021
+ AUTO_RECHARGE_BLOCKED: "auto_recharge_blocked"
3104
3022
  };
3105
3023
 
3106
3024
  // src/preview-prompts.ts
@@ -3165,12 +3083,6 @@ OUTPUT JSON ONLY. NO MARKDOWN. NO COMMENTARY.
3165
3083
  GUARDRAIL_CONFIGURE_COMMAND,
3166
3084
  GUARDRAIL_DISPOSITIONS,
3167
3085
  HANDOFF_FENCE_TAG,
3168
- HEADROOM_BACKEND_ENV,
3169
- HEADROOM_EXTRAS_BY_SURFACE,
3170
- HEADROOM_MODELS,
3171
- HEADROOM_PIP_COMPANIONS,
3172
- HEADROOM_PROXY_PORT,
3173
- HEADROOM_USAGE_COMMAND,
3174
3086
  HEARTBEAT_INTERVAL_MS_DEFAULT,
3175
3087
  HOUSE_AGENT_ID,
3176
3088
  HOUSE_AGENT_NAME,
@@ -3227,14 +3139,9 @@ OUTPUT JSON ONLY. NO MARKDOWN. NO COMMENTARY.
3227
3139
  getPackDefinition,
3228
3140
  getPricing,
3229
3141
  getSkillDefinition,
3230
- headroomKindFor,
3231
- headroomModelPredownloadScript,
3232
- headroomPipPackage,
3233
- headroomSnapshotDownloadLine,
3234
3142
  installableAgentIds,
3235
3143
  internalToPublic,
3236
3144
  isGuardrailDisposition,
3237
- isHeadroomWrappable,
3238
3145
  isKnownAgentId,
3239
3146
  isKnownIntegrationId,
3240
3147
  isKnownModel,