@codeam/shared 2.76.19 → 2.76.20
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.mts +175 -1
- package/dist/index.d.ts +175 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2293,4 +2293,178 @@ interface PluginAgentReport {
|
|
|
2293
2293
|
status?: PluginAgentStatus;
|
|
2294
2294
|
}
|
|
2295
2295
|
|
|
2296
|
-
|
|
2296
|
+
/**
|
|
2297
|
+
* Wire types for the Smart Composer LLM service.
|
|
2298
|
+
* The mobile and web clients call POST /api/composer/structure with a
|
|
2299
|
+
* ComposerStructureRequest and consume a stream of ComposerStructureStreamEvent
|
|
2300
|
+
* over SSE. Attachments carry metadata only — never base64 — so the LLM
|
|
2301
|
+
* input stays bounded.
|
|
2302
|
+
*
|
|
2303
|
+
* Owned here since 2026-10-09 (epic codeagent-pi6): api-v2, mobile and web
|
|
2304
|
+
* import these instead of keeping hand-synced copies.
|
|
2305
|
+
*/
|
|
2306
|
+
interface ComposerAttachmentMeta {
|
|
2307
|
+
filename: string;
|
|
2308
|
+
mime: string;
|
|
2309
|
+
sizeBytes: number;
|
|
2310
|
+
/** Pixel width, only for images. */
|
|
2311
|
+
width?: number;
|
|
2312
|
+
/** Pixel height, only for images. */
|
|
2313
|
+
height?: number;
|
|
2314
|
+
/**
|
|
2315
|
+
* Improvement A (Unified Voice Command Phase 1) — for text attachments
|
|
2316
|
+
* (logs, code, etc.) the client sends a bounded excerpt of the file's
|
|
2317
|
+
* text content so the LLM can actually read it. Never set for images —
|
|
2318
|
+
* those are referenced by filename only (never base64) so the payload
|
|
2319
|
+
* stays bounded and the structured CONTEXT chips can still show them.
|
|
2320
|
+
*/
|
|
2321
|
+
textExcerpt?: string;
|
|
2322
|
+
}
|
|
2323
|
+
interface ComposerSessionContext {
|
|
2324
|
+
sessionId: string;
|
|
2325
|
+
/** Agent id from the paired session, e.g. 'claude-code', 'codex'. */
|
|
2326
|
+
agentId: string;
|
|
2327
|
+
/** Active model id, if known. Null when the agent hasn't reported one. */
|
|
2328
|
+
modelId: string | null;
|
|
2329
|
+
/** Up to 5 recent message ids from the current conversation, oldest first. */
|
|
2330
|
+
lastMessageIds: string[];
|
|
2331
|
+
/** Reserved for Eje B feature #5 (Saved Context Profiles). Always undefined in v1. */
|
|
2332
|
+
activeContextProfileId?: string | null;
|
|
2333
|
+
}
|
|
2334
|
+
interface ComposerStructureRequest {
|
|
2335
|
+
voiceTranscript: string;
|
|
2336
|
+
attachments: ComposerAttachmentMeta[];
|
|
2337
|
+
sessionContext: ComposerSessionContext;
|
|
2338
|
+
/** When true, the LLM also emits a 2–4 word title in its response. Sent only on the first prompt of a new conversation. */
|
|
2339
|
+
requestAutoTitle: boolean;
|
|
2340
|
+
}
|
|
2341
|
+
type ComposerErrorCode = 'rate_limited' | 'llm_error' | 'invalid_input';
|
|
2342
|
+
type ComposerStructureStreamEvent = {
|
|
2343
|
+
event: 'meta';
|
|
2344
|
+
data: {
|
|
2345
|
+
cacheHit: boolean;
|
|
2346
|
+
modelId: string;
|
|
2347
|
+
};
|
|
2348
|
+
} | {
|
|
2349
|
+
event: 'prompt-chunk';
|
|
2350
|
+
data: {
|
|
2351
|
+
text: string;
|
|
2352
|
+
};
|
|
2353
|
+
} | {
|
|
2354
|
+
event: 'auto-title';
|
|
2355
|
+
data: {
|
|
2356
|
+
title: string;
|
|
2357
|
+
};
|
|
2358
|
+
} | {
|
|
2359
|
+
event: 'done';
|
|
2360
|
+
data: {
|
|
2361
|
+
tokensIn: number;
|
|
2362
|
+
tokensOut: number;
|
|
2363
|
+
latencyMs: number;
|
|
2364
|
+
};
|
|
2365
|
+
} | {
|
|
2366
|
+
event: 'error';
|
|
2367
|
+
data: {
|
|
2368
|
+
code: ComposerErrorCode;
|
|
2369
|
+
message: string;
|
|
2370
|
+
};
|
|
2371
|
+
};
|
|
2372
|
+
|
|
2373
|
+
/**
|
|
2374
|
+
* Feature gates exposed to a client for the authenticated user.
|
|
2375
|
+
*
|
|
2376
|
+
* Every field defaults to `false` so an older client (or a transient
|
|
2377
|
+
* backend that can't resolve a gate) fails closed — the gated surface
|
|
2378
|
+
* stays hidden rather than flickering on.
|
|
2379
|
+
*/
|
|
2380
|
+
interface FeatureGates {
|
|
2381
|
+
/**
|
|
2382
|
+
* Beads-backed agent memory & task graph (read-only mirror + mobile
|
|
2383
|
+
* surface + action relay). Generally available — ON for every user
|
|
2384
|
+
* by default. The backend's `BEADS_ENABLED` env var is an emergency
|
|
2385
|
+
* kill-switch (set falsy to disable for everyone). Gates the
|
|
2386
|
+
* `/api/beads/*` ingest + read + action endpoints and the mobile/web
|
|
2387
|
+
* Beads surface.
|
|
2388
|
+
*/
|
|
2389
|
+
beads: boolean;
|
|
2390
|
+
}
|
|
2391
|
+
/** A single gate key — keep in sync with the `FeatureGates` fields. */
|
|
2392
|
+
type FeatureGateKey = keyof FeatureGates;
|
|
2393
|
+
/** Fail-closed defaults. Every gate is OFF unless the backend turns it on. */
|
|
2394
|
+
declare const DEFAULT_FEATURE_GATES: FeatureGates;
|
|
2395
|
+
|
|
2396
|
+
/**
|
|
2397
|
+
* Wire types for GET /api/admin/compression-savings (admin Token Savings tab).
|
|
2398
|
+
* Owned here since 2026-10-09 (epic codeagent-pi6).
|
|
2399
|
+
*/
|
|
2400
|
+
/**
|
|
2401
|
+
* Per-agent monthly savings row (or the aggregate 'all' row).
|
|
2402
|
+
* All token fields are raw counters. Derived ratios are computed
|
|
2403
|
+
* server-side from the SUMMED counters (not by averaging per-agent
|
|
2404
|
+
* ratios) so the totals row is arithmetically consistent.
|
|
2405
|
+
*/
|
|
2406
|
+
interface AgentSavings {
|
|
2407
|
+
agentId: string;
|
|
2408
|
+
rawTokensEst: number;
|
|
2409
|
+
sentTokensEst: number;
|
|
2410
|
+
cachedTokens: number;
|
|
2411
|
+
retrieveHops: number;
|
|
2412
|
+
turns: number;
|
|
2413
|
+
/** rawTokensEst - sentTokensEst */
|
|
2414
|
+
tokensSaved: number;
|
|
2415
|
+
/** rawTokensEst > 0 ? (raw - sent) / raw : 0 (0..1) */
|
|
2416
|
+
reductionPct: number;
|
|
2417
|
+
/** sentTokensEst > 0 ? cachedTokens / sentTokensEst : 0 (0..1) */
|
|
2418
|
+
cacheHitPct: number;
|
|
2419
|
+
/** Dollars saved vs. sending the full uncompressed request uncached.
|
|
2420
|
+
* Formula: baselineCost - actualCost, where
|
|
2421
|
+
* baselineCost = rawTokensEst * INPUT_RATE
|
|
2422
|
+
* actualCost = (sentTokensEst - cachedTokens) * INPUT_RATE + cachedTokens * CACHED_RATE
|
|
2423
|
+
* Rates: INPUT_RATE = 0.60 / 1_000_000, CACHED_RATE = 0.12 / 1_000_000 */
|
|
2424
|
+
dollarsSaved: number;
|
|
2425
|
+
/** PROMPT-CACHE dimension — distinct from `cachedTokens` above (which feeds
|
|
2426
|
+
* the compression dollar formula). For BYO agents (Claude Code etc.) the
|
|
2427
|
+
* dominant saving is provider prefix-caching, NOT token compression: the
|
|
2428
|
+
* proxy serves a large repeated prefix from cache at ~10% of input price.
|
|
2429
|
+
* `cacheReadTokens` is the cumulative cache-read token count (can exceed
|
|
2430
|
+
* sentTokensEst — the prefix is re-read every turn), so it is kept separate
|
|
2431
|
+
* from the compression math. */
|
|
2432
|
+
cacheReadTokens: number;
|
|
2433
|
+
/** Cost saved by prompt-caching, taken verbatim from the proxy's own
|
|
2434
|
+
* `/stats` (`summary.cost.breakdown.cache_savings_usd`), computed at the
|
|
2435
|
+
* real model price — NOT recomputed here, so it stays correct as model
|
|
2436
|
+
* pricing changes. Counterfactual list-price dollars for subscription
|
|
2437
|
+
* agents; the real value is usage-headroom within rate limits. */
|
|
2438
|
+
cacheSavingsUsd: number;
|
|
2439
|
+
}
|
|
2440
|
+
/** One day's aggregated compression savings (summed across all agents). */
|
|
2441
|
+
interface CompressionSavingsDaily {
|
|
2442
|
+
date: string;
|
|
2443
|
+
rawTokensEst: number;
|
|
2444
|
+
sentTokensEst: number;
|
|
2445
|
+
cachedTokens: number;
|
|
2446
|
+
tokensSaved: number;
|
|
2447
|
+
dollarsSaved: number;
|
|
2448
|
+
/** Prompt-cache dimension (see AgentSavings.cacheReadTokens/cacheSavingsUsd). */
|
|
2449
|
+
cacheReadTokens: number;
|
|
2450
|
+
cacheSavingsUsd: number;
|
|
2451
|
+
}
|
|
2452
|
+
/** Response body for GET /api/admin/compression-savings?month=YYYY-MM */
|
|
2453
|
+
interface CompressionSavingsData {
|
|
2454
|
+
/** YYYY-MM echoed back from the query parameter. */
|
|
2455
|
+
month: string;
|
|
2456
|
+
/** Rate constants used to compute dollarsSaved (for UI transparency). */
|
|
2457
|
+
rates: {
|
|
2458
|
+
inputPerMtok: number;
|
|
2459
|
+
cachedPerMtok: number;
|
|
2460
|
+
};
|
|
2461
|
+
/** Element-wise sum across all agents; agentId = 'all'. */
|
|
2462
|
+
totals: AgentSavings;
|
|
2463
|
+
/** One entry per enumerated agent (from the agent registry). */
|
|
2464
|
+
perAgent: AgentSavings[];
|
|
2465
|
+
/** One entry per calendar day ascending, incl. zero days, up to today
|
|
2466
|
+
* for the current month or through the last day for a past month. */
|
|
2467
|
+
dailyTrend: CompressionSavingsDaily[];
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
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 AgentSavings, 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, type ComposerAttachmentMeta, type ComposerErrorCode, type ComposerSessionContext, type ComposerStructureRequest, type ComposerStructureStreamEvent, type CompressionSavingsDaily, type CompressionSavingsData, DEFAULT_API_BASE_URL, DEFAULT_FEATURE_GATES, DEFAULT_GUARDRAIL_POLICY, DEPLOY_CHOICE_ORDER, DEP_TO_INTEGRATION, DEV_API_BASE_URL, type DeployChoice, type DerivedCredentialSource, type EnvVar, type FeatureGateKey, type FeatureGates, 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, MAX_PACK_FINDINGS, MODEL_CONTEXT_WINDOW, MODEL_PRICING, type ManagedProviderId, type MissingService, type ModelPricing, type NormalizedMessage, OBSERVER_BRIDGE_PORT, PACK_ACTION_COMMAND, PACK_FINDINGS_FILE, PACK_HANDOFF_HEADING, PACK_REGISTRY, PACK_START_COMMAND, PACK_STATUS_COMMAND, PACK_WORKFLOW_ARTICLE, PLUGIN_AGENT_STATUSES, PREVIEW_DETECT_PROMPT, PROTOCOL_VERSION, PUBLIC_TO_INTERNAL, type PackActionKind, type PackActionPayload, type PackDefinition, type PackFinding, type PackFindingResolution, type PackFindingSeverity, type PackFindingsParseResult, type PackHandoffRecord, type PackId, type PackPendingControl, type PackRunState, type PackRunStatus, type PackStageDef, type PackStageState, type PackStageStatus, type PackStartPayload, type ParsedPackFindings, type PendingReviewHunkEvent, type PendingReviewHunkLine, type PluginAgentReport, type PluginAgentStatus, type PrCheck, type PrRef, type PrReviewEntry, type PrReviewVerdict, type PreviewAgentHighlight, type PreviewDetection, type PreviewErrorCode, type PreviewErrorReason, type PreviewErrorStage, type PreviewOrigin, type PreviewScriptCandidate, type PreviewState, type PreviewStatus, type PullRequestDetail, type PullRequestSummary, QA_PROMPT, REVIEWER_PROMPT, type RemoteCommand, type RepoStack, type RepoStackDetection, SCRATCH_STARTER_PROMPTS, SCRATCH_ZIP_FREE_LIMIT_BYTES, SCRATCH_ZIP_WIFI_HINT_BYTES, SESSION_BLOCKER_KINDS, 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 ScratchExportResult, type ScratchProjectState, type ScratchSavedVia, type SelectPrompt, type SessionBlocker, type SessionBlockerKind, SessionBlockerSchema, 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 StarterPrompt, 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, extractHandoffSection, getAgent, getContextWindow, getEnabledAgents, getEnabledIntegrations, getIntegration, getIntegrationBranding, getIntegrationsByCategory, getPackDefinition, getPricing, getSkillDefinition, installableAgentIds, internalToPublic, isGuardrailDisposition, isKnownAgentId, isKnownIntegrationId, isKnownModel, isLinkedAgentId, isManagedProviderId, isNoopInstallSnippet, isPackId, isPluginAgentStatus, isSkillId, normalizeAgentId, normalizeGuardrailPolicy, orderDeployChoices, parsePackFindings, publicToInternal, recommendForDeps, renderToLines, resolveApiBaseUrl, skillHasRail, toRemoteCommand, toSessionBlocker, tryGetContextWindow };
|
package/dist/index.d.ts
CHANGED
|
@@ -2293,4 +2293,178 @@ interface PluginAgentReport {
|
|
|
2293
2293
|
status?: PluginAgentStatus;
|
|
2294
2294
|
}
|
|
2295
2295
|
|
|
2296
|
-
|
|
2296
|
+
/**
|
|
2297
|
+
* Wire types for the Smart Composer LLM service.
|
|
2298
|
+
* The mobile and web clients call POST /api/composer/structure with a
|
|
2299
|
+
* ComposerStructureRequest and consume a stream of ComposerStructureStreamEvent
|
|
2300
|
+
* over SSE. Attachments carry metadata only — never base64 — so the LLM
|
|
2301
|
+
* input stays bounded.
|
|
2302
|
+
*
|
|
2303
|
+
* Owned here since 2026-10-09 (epic codeagent-pi6): api-v2, mobile and web
|
|
2304
|
+
* import these instead of keeping hand-synced copies.
|
|
2305
|
+
*/
|
|
2306
|
+
interface ComposerAttachmentMeta {
|
|
2307
|
+
filename: string;
|
|
2308
|
+
mime: string;
|
|
2309
|
+
sizeBytes: number;
|
|
2310
|
+
/** Pixel width, only for images. */
|
|
2311
|
+
width?: number;
|
|
2312
|
+
/** Pixel height, only for images. */
|
|
2313
|
+
height?: number;
|
|
2314
|
+
/**
|
|
2315
|
+
* Improvement A (Unified Voice Command Phase 1) — for text attachments
|
|
2316
|
+
* (logs, code, etc.) the client sends a bounded excerpt of the file's
|
|
2317
|
+
* text content so the LLM can actually read it. Never set for images —
|
|
2318
|
+
* those are referenced by filename only (never base64) so the payload
|
|
2319
|
+
* stays bounded and the structured CONTEXT chips can still show them.
|
|
2320
|
+
*/
|
|
2321
|
+
textExcerpt?: string;
|
|
2322
|
+
}
|
|
2323
|
+
interface ComposerSessionContext {
|
|
2324
|
+
sessionId: string;
|
|
2325
|
+
/** Agent id from the paired session, e.g. 'claude-code', 'codex'. */
|
|
2326
|
+
agentId: string;
|
|
2327
|
+
/** Active model id, if known. Null when the agent hasn't reported one. */
|
|
2328
|
+
modelId: string | null;
|
|
2329
|
+
/** Up to 5 recent message ids from the current conversation, oldest first. */
|
|
2330
|
+
lastMessageIds: string[];
|
|
2331
|
+
/** Reserved for Eje B feature #5 (Saved Context Profiles). Always undefined in v1. */
|
|
2332
|
+
activeContextProfileId?: string | null;
|
|
2333
|
+
}
|
|
2334
|
+
interface ComposerStructureRequest {
|
|
2335
|
+
voiceTranscript: string;
|
|
2336
|
+
attachments: ComposerAttachmentMeta[];
|
|
2337
|
+
sessionContext: ComposerSessionContext;
|
|
2338
|
+
/** When true, the LLM also emits a 2–4 word title in its response. Sent only on the first prompt of a new conversation. */
|
|
2339
|
+
requestAutoTitle: boolean;
|
|
2340
|
+
}
|
|
2341
|
+
type ComposerErrorCode = 'rate_limited' | 'llm_error' | 'invalid_input';
|
|
2342
|
+
type ComposerStructureStreamEvent = {
|
|
2343
|
+
event: 'meta';
|
|
2344
|
+
data: {
|
|
2345
|
+
cacheHit: boolean;
|
|
2346
|
+
modelId: string;
|
|
2347
|
+
};
|
|
2348
|
+
} | {
|
|
2349
|
+
event: 'prompt-chunk';
|
|
2350
|
+
data: {
|
|
2351
|
+
text: string;
|
|
2352
|
+
};
|
|
2353
|
+
} | {
|
|
2354
|
+
event: 'auto-title';
|
|
2355
|
+
data: {
|
|
2356
|
+
title: string;
|
|
2357
|
+
};
|
|
2358
|
+
} | {
|
|
2359
|
+
event: 'done';
|
|
2360
|
+
data: {
|
|
2361
|
+
tokensIn: number;
|
|
2362
|
+
tokensOut: number;
|
|
2363
|
+
latencyMs: number;
|
|
2364
|
+
};
|
|
2365
|
+
} | {
|
|
2366
|
+
event: 'error';
|
|
2367
|
+
data: {
|
|
2368
|
+
code: ComposerErrorCode;
|
|
2369
|
+
message: string;
|
|
2370
|
+
};
|
|
2371
|
+
};
|
|
2372
|
+
|
|
2373
|
+
/**
|
|
2374
|
+
* Feature gates exposed to a client for the authenticated user.
|
|
2375
|
+
*
|
|
2376
|
+
* Every field defaults to `false` so an older client (or a transient
|
|
2377
|
+
* backend that can't resolve a gate) fails closed — the gated surface
|
|
2378
|
+
* stays hidden rather than flickering on.
|
|
2379
|
+
*/
|
|
2380
|
+
interface FeatureGates {
|
|
2381
|
+
/**
|
|
2382
|
+
* Beads-backed agent memory & task graph (read-only mirror + mobile
|
|
2383
|
+
* surface + action relay). Generally available — ON for every user
|
|
2384
|
+
* by default. The backend's `BEADS_ENABLED` env var is an emergency
|
|
2385
|
+
* kill-switch (set falsy to disable for everyone). Gates the
|
|
2386
|
+
* `/api/beads/*` ingest + read + action endpoints and the mobile/web
|
|
2387
|
+
* Beads surface.
|
|
2388
|
+
*/
|
|
2389
|
+
beads: boolean;
|
|
2390
|
+
}
|
|
2391
|
+
/** A single gate key — keep in sync with the `FeatureGates` fields. */
|
|
2392
|
+
type FeatureGateKey = keyof FeatureGates;
|
|
2393
|
+
/** Fail-closed defaults. Every gate is OFF unless the backend turns it on. */
|
|
2394
|
+
declare const DEFAULT_FEATURE_GATES: FeatureGates;
|
|
2395
|
+
|
|
2396
|
+
/**
|
|
2397
|
+
* Wire types for GET /api/admin/compression-savings (admin Token Savings tab).
|
|
2398
|
+
* Owned here since 2026-10-09 (epic codeagent-pi6).
|
|
2399
|
+
*/
|
|
2400
|
+
/**
|
|
2401
|
+
* Per-agent monthly savings row (or the aggregate 'all' row).
|
|
2402
|
+
* All token fields are raw counters. Derived ratios are computed
|
|
2403
|
+
* server-side from the SUMMED counters (not by averaging per-agent
|
|
2404
|
+
* ratios) so the totals row is arithmetically consistent.
|
|
2405
|
+
*/
|
|
2406
|
+
interface AgentSavings {
|
|
2407
|
+
agentId: string;
|
|
2408
|
+
rawTokensEst: number;
|
|
2409
|
+
sentTokensEst: number;
|
|
2410
|
+
cachedTokens: number;
|
|
2411
|
+
retrieveHops: number;
|
|
2412
|
+
turns: number;
|
|
2413
|
+
/** rawTokensEst - sentTokensEst */
|
|
2414
|
+
tokensSaved: number;
|
|
2415
|
+
/** rawTokensEst > 0 ? (raw - sent) / raw : 0 (0..1) */
|
|
2416
|
+
reductionPct: number;
|
|
2417
|
+
/** sentTokensEst > 0 ? cachedTokens / sentTokensEst : 0 (0..1) */
|
|
2418
|
+
cacheHitPct: number;
|
|
2419
|
+
/** Dollars saved vs. sending the full uncompressed request uncached.
|
|
2420
|
+
* Formula: baselineCost - actualCost, where
|
|
2421
|
+
* baselineCost = rawTokensEst * INPUT_RATE
|
|
2422
|
+
* actualCost = (sentTokensEst - cachedTokens) * INPUT_RATE + cachedTokens * CACHED_RATE
|
|
2423
|
+
* Rates: INPUT_RATE = 0.60 / 1_000_000, CACHED_RATE = 0.12 / 1_000_000 */
|
|
2424
|
+
dollarsSaved: number;
|
|
2425
|
+
/** PROMPT-CACHE dimension — distinct from `cachedTokens` above (which feeds
|
|
2426
|
+
* the compression dollar formula). For BYO agents (Claude Code etc.) the
|
|
2427
|
+
* dominant saving is provider prefix-caching, NOT token compression: the
|
|
2428
|
+
* proxy serves a large repeated prefix from cache at ~10% of input price.
|
|
2429
|
+
* `cacheReadTokens` is the cumulative cache-read token count (can exceed
|
|
2430
|
+
* sentTokensEst — the prefix is re-read every turn), so it is kept separate
|
|
2431
|
+
* from the compression math. */
|
|
2432
|
+
cacheReadTokens: number;
|
|
2433
|
+
/** Cost saved by prompt-caching, taken verbatim from the proxy's own
|
|
2434
|
+
* `/stats` (`summary.cost.breakdown.cache_savings_usd`), computed at the
|
|
2435
|
+
* real model price — NOT recomputed here, so it stays correct as model
|
|
2436
|
+
* pricing changes. Counterfactual list-price dollars for subscription
|
|
2437
|
+
* agents; the real value is usage-headroom within rate limits. */
|
|
2438
|
+
cacheSavingsUsd: number;
|
|
2439
|
+
}
|
|
2440
|
+
/** One day's aggregated compression savings (summed across all agents). */
|
|
2441
|
+
interface CompressionSavingsDaily {
|
|
2442
|
+
date: string;
|
|
2443
|
+
rawTokensEst: number;
|
|
2444
|
+
sentTokensEst: number;
|
|
2445
|
+
cachedTokens: number;
|
|
2446
|
+
tokensSaved: number;
|
|
2447
|
+
dollarsSaved: number;
|
|
2448
|
+
/** Prompt-cache dimension (see AgentSavings.cacheReadTokens/cacheSavingsUsd). */
|
|
2449
|
+
cacheReadTokens: number;
|
|
2450
|
+
cacheSavingsUsd: number;
|
|
2451
|
+
}
|
|
2452
|
+
/** Response body for GET /api/admin/compression-savings?month=YYYY-MM */
|
|
2453
|
+
interface CompressionSavingsData {
|
|
2454
|
+
/** YYYY-MM echoed back from the query parameter. */
|
|
2455
|
+
month: string;
|
|
2456
|
+
/** Rate constants used to compute dollarsSaved (for UI transparency). */
|
|
2457
|
+
rates: {
|
|
2458
|
+
inputPerMtok: number;
|
|
2459
|
+
cachedPerMtok: number;
|
|
2460
|
+
};
|
|
2461
|
+
/** Element-wise sum across all agents; agentId = 'all'. */
|
|
2462
|
+
totals: AgentSavings;
|
|
2463
|
+
/** One entry per enumerated agent (from the agent registry). */
|
|
2464
|
+
perAgent: AgentSavings[];
|
|
2465
|
+
/** One entry per calendar day ascending, incl. zero days, up to today
|
|
2466
|
+
* for the current month or through the last day for a past month. */
|
|
2467
|
+
dailyTrend: CompressionSavingsDaily[];
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
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 AgentSavings, 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, type ComposerAttachmentMeta, type ComposerErrorCode, type ComposerSessionContext, type ComposerStructureRequest, type ComposerStructureStreamEvent, type CompressionSavingsDaily, type CompressionSavingsData, DEFAULT_API_BASE_URL, DEFAULT_FEATURE_GATES, DEFAULT_GUARDRAIL_POLICY, DEPLOY_CHOICE_ORDER, DEP_TO_INTEGRATION, DEV_API_BASE_URL, type DeployChoice, type DerivedCredentialSource, type EnvVar, type FeatureGateKey, type FeatureGates, 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, MAX_PACK_FINDINGS, MODEL_CONTEXT_WINDOW, MODEL_PRICING, type ManagedProviderId, type MissingService, type ModelPricing, type NormalizedMessage, OBSERVER_BRIDGE_PORT, PACK_ACTION_COMMAND, PACK_FINDINGS_FILE, PACK_HANDOFF_HEADING, PACK_REGISTRY, PACK_START_COMMAND, PACK_STATUS_COMMAND, PACK_WORKFLOW_ARTICLE, PLUGIN_AGENT_STATUSES, PREVIEW_DETECT_PROMPT, PROTOCOL_VERSION, PUBLIC_TO_INTERNAL, type PackActionKind, type PackActionPayload, type PackDefinition, type PackFinding, type PackFindingResolution, type PackFindingSeverity, type PackFindingsParseResult, type PackHandoffRecord, type PackId, type PackPendingControl, type PackRunState, type PackRunStatus, type PackStageDef, type PackStageState, type PackStageStatus, type PackStartPayload, type ParsedPackFindings, type PendingReviewHunkEvent, type PendingReviewHunkLine, type PluginAgentReport, type PluginAgentStatus, type PrCheck, type PrRef, type PrReviewEntry, type PrReviewVerdict, type PreviewAgentHighlight, type PreviewDetection, type PreviewErrorCode, type PreviewErrorReason, type PreviewErrorStage, type PreviewOrigin, type PreviewScriptCandidate, type PreviewState, type PreviewStatus, type PullRequestDetail, type PullRequestSummary, QA_PROMPT, REVIEWER_PROMPT, type RemoteCommand, type RepoStack, type RepoStackDetection, SCRATCH_STARTER_PROMPTS, SCRATCH_ZIP_FREE_LIMIT_BYTES, SCRATCH_ZIP_WIFI_HINT_BYTES, SESSION_BLOCKER_KINDS, 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 ScratchExportResult, type ScratchProjectState, type ScratchSavedVia, type SelectPrompt, type SessionBlocker, type SessionBlockerKind, SessionBlockerSchema, 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 StarterPrompt, 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, extractHandoffSection, getAgent, getContextWindow, getEnabledAgents, getEnabledIntegrations, getIntegration, getIntegrationBranding, getIntegrationsByCategory, getPackDefinition, getPricing, getSkillDefinition, installableAgentIds, internalToPublic, isGuardrailDisposition, isKnownAgentId, isKnownIntegrationId, isKnownModel, isLinkedAgentId, isManagedProviderId, isNoopInstallSnippet, isPackId, isPluginAgentStatus, isSkillId, normalizeAgentId, normalizeGuardrailPolicy, orderDeployChoices, parsePackFindings, publicToInternal, recommendForDeps, renderToLines, resolveApiBaseUrl, skillHasRail, toRemoteCommand, toSessionBlocker, tryGetContextWindow };
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
AGENT_STANDARD_TEXT: () => AGENT_STANDARD_TEXT,
|
|
27
27
|
CODER_PROMPT: () => CODER_PROMPT,
|
|
28
28
|
DEFAULT_API_BASE_URL: () => DEFAULT_API_BASE_URL,
|
|
29
|
+
DEFAULT_FEATURE_GATES: () => DEFAULT_FEATURE_GATES,
|
|
29
30
|
DEFAULT_GUARDRAIL_POLICY: () => DEFAULT_GUARDRAIL_POLICY,
|
|
30
31
|
DEPLOY_CHOICE_ORDER: () => DEPLOY_CHOICE_ORDER,
|
|
31
32
|
DEP_TO_INTEGRATION: () => DEP_TO_INTEGRATION,
|
|
@@ -3311,6 +3312,11 @@ var PLUGIN_AGENT_STATUSES = ["ready", "not_installed", "not_signed_in", "failed"
|
|
|
3311
3312
|
function isPluginAgentStatus(x) {
|
|
3312
3313
|
return typeof x === "string" && PLUGIN_AGENT_STATUSES.includes(x);
|
|
3313
3314
|
}
|
|
3315
|
+
|
|
3316
|
+
// src/types/feature-gates.ts
|
|
3317
|
+
var DEFAULT_FEATURE_GATES = {
|
|
3318
|
+
beads: false
|
|
3319
|
+
};
|
|
3314
3320
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3315
3321
|
0 && (module.exports = {
|
|
3316
3322
|
AGENT_REGISTRY,
|
|
@@ -3319,6 +3325,7 @@ function isPluginAgentStatus(x) {
|
|
|
3319
3325
|
AGENT_STANDARD_TEXT,
|
|
3320
3326
|
CODER_PROMPT,
|
|
3321
3327
|
DEFAULT_API_BASE_URL,
|
|
3328
|
+
DEFAULT_FEATURE_GATES,
|
|
3322
3329
|
DEFAULT_GUARDRAIL_POLICY,
|
|
3323
3330
|
DEPLOY_CHOICE_ORDER,
|
|
3324
3331
|
DEP_TO_INTEGRATION,
|