open-multi-agent-kit 0.94.1 → 0.95.0
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/CHANGELOG.md +33 -1
- package/README.md +100 -647
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +11 -11
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +27 -2
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +239 -56
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/context-budget-v2-cache-invalidation.d.ts.map +1 -1
- package/dist/core/context-budget-v2-cache-invalidation.js +1 -1
- package/dist/core/context-budget-v2-cache-invalidation.js.map +1 -1
- package/dist/core/context-budget-v2-cache-provider.d.ts +5 -1
- package/dist/core/context-budget-v2-cache-provider.d.ts.map +1 -1
- package/dist/core/context-budget-v2-cache-provider.js +37 -7
- package/dist/core/context-budget-v2-cache-provider.js.map +1 -1
- package/dist/core/context-budget-v2-cache-telemetry.d.ts +1 -1
- package/dist/core/context-budget-v2-cache-telemetry.d.ts.map +1 -1
- package/dist/core/context-budget-v2-cache-telemetry.js +2 -1
- package/dist/core/context-budget-v2-cache-telemetry.js.map +1 -1
- package/dist/core/context-budget-v2-cache.d.ts.map +1 -1
- package/dist/core/context-budget-v2-cache.js +3 -0
- package/dist/core/context-budget-v2-cache.js.map +1 -1
- package/dist/core/context-budget-v2-representation-cache.d.ts.map +1 -1
- package/dist/core/context-budget-v2-representation-cache.js +4 -3
- package/dist/core/context-budget-v2-representation-cache.js.map +1 -1
- package/dist/core/context-budget-v2-selection.d.ts.map +1 -1
- package/dist/core/context-budget-v2-selection.js +4 -0
- package/dist/core/context-budget-v2-selection.js.map +1 -1
- package/dist/core/context-budget-v2-types.d.ts +3 -0
- package/dist/core/context-budget-v2-types.d.ts.map +1 -1
- package/dist/core/context-budget-v2-types.js.map +1 -1
- package/dist/core/extensions/types.d.ts +2 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/github-repository.d.ts +3 -0
- package/dist/core/github-repository.d.ts.map +1 -0
- package/dist/core/github-repository.js +3 -0
- package/dist/core/github-repository.js.map +1 -0
- package/dist/core/model-registry.d.ts +3 -3
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +9 -8
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/provider-usage.d.ts +48 -0
- package/dist/core/provider-usage.d.ts.map +1 -0
- package/dist/core/provider-usage.js +780 -0
- package/dist/core/provider-usage.js.map +1 -0
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +10 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-termination.d.ts.map +1 -1
- package/dist/core/session-termination.js +8 -1
- package/dist/core/session-termination.js.map +1 -1
- package/dist/core/settings-manager.d.ts +1 -5
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +15 -17
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills-catalog-cache.d.ts +1 -0
- package/dist/core/skills-catalog-cache.d.ts.map +1 -1
- package/dist/core/skills-catalog-cache.js +42 -11
- package/dist/core/skills-catalog-cache.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -4
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/read.d.ts +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +5 -3
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-account-selector.d.ts +16 -0
- package/dist/modes/interactive/components/oauth-account-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-account-selector.js +61 -0
- package/dist/modes/interactive/components/oauth-account-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +25 -4
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/status-sidebar.d.ts +21 -1
- package/dist/modes/interactive/components/status-sidebar.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-sidebar.js +165 -6
- package/dist/modes/interactive/components/status-sidebar.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +89 -60
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js +2 -2
- package/dist/utils/image-resize-core.js.map +1 -1
- package/docs/development.md +3 -2
- package/docs/providers.md +19 -4
- package/docs/settings.md +9 -20
- package/docs/usage.md +10 -10
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +24 -24
- package/package.json +6 -6
- package/dist/core/github-star-nudge.d.ts +0 -15
- package/dist/core/github-star-nudge.d.ts.map +0 -1
- package/dist/core/github-star-nudge.js +0 -21
- package/dist/core/github-star-nudge.js.map +0 -1
|
@@ -136,16 +136,19 @@ export interface ContextBudgetCacheProviderV2 {
|
|
|
136
136
|
readonly key: string;
|
|
137
137
|
readonly entry: ContextBudgetRepresentationCacheEntryV2;
|
|
138
138
|
}): void;
|
|
139
|
+
deleteRepresentation?(key: string): void;
|
|
139
140
|
readNegativeRepresentation(key: string): ContextBudgetNegativeCacheEntryV2 | undefined;
|
|
140
141
|
writeNegativeRepresentation(input: {
|
|
141
142
|
readonly key: string;
|
|
142
143
|
readonly reason: string;
|
|
143
144
|
}): void;
|
|
145
|
+
deleteNegativeRepresentation?(key: string): void;
|
|
144
146
|
readPlan(key: string): ContextBudgetPlanCacheReadV2 | undefined;
|
|
145
147
|
writePlan(input: {
|
|
146
148
|
readonly key: string;
|
|
147
149
|
readonly entry: ContextBudgetPlanCacheEntryV2;
|
|
148
150
|
}): void;
|
|
151
|
+
deletePlan?(key: string): void;
|
|
149
152
|
}
|
|
150
153
|
export interface ContextBudgetPlanCacheTelemetryV2 {
|
|
151
154
|
readonly hit: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-budget-v2-types.d.ts","sourceRoot":"","sources":["../../src/core/context-budget-v2-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,mBAAmB,EACnB,mBAAmB,EACnB,oCAAoC,EACpC,gCAAgC,EAChC,2BAA2B,EAC3B,kBAAkB,EAClB,uBAAuB,EACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAElG,eAAO,MAAM,gCAAgC,sBAAsB,CAAC;AAIpE,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,CAAC,WAAW,EAAE,wBAAwB,CAAC;IAC/C,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;IACvB,QAAQ,CAAC,4BAA4B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ContextRepresentationCacheMetadataV2,\n\tContextRepresentationCandidateV2,\n\tContextRepresentationKindV2,\n\tContextSourceRefV2,\n\tHeadroomQualityPolicyV2,\n} from \"./context-budget-headroom.ts\";\nimport type { TokenCounterAdapter } from \"./context-budget-token-counter.ts\";\nimport type { ContextCacheInvalidationSnapshot } from \"./context-budget-v2-cache-invalidation.ts\";\n\nexport const CONTEXT_BUDGET_POLICY_VERSION_V2 = \"context-budget-v2\";\n\n// Inlined from the deleted token-optimizer.ts (legacy quarantine-compatibility\n// status; legacy-token-optimizer itself no longer exists as a module).\nexport interface TokenOptimizerRuntimeStatus {\n\treadonly optimizerId: \"legacy-token-optimizer\";\n\treadonly status: \"quarantined_compatibility\";\n\treadonly active: false;\n\treadonly activeContextBudgetOptimizer: \"context-budget-v2\";\n\treadonly compatibilityOnly: true;\n}\n\nexport interface TierBudgetPolicyV2 {\n\treadonly floorPct: number;\n\treadonly ceilingPct: number;\n}\n\nexport const DEFAULT_TIER_POLICY_V2: Readonly<Record<ContextBudgetTierV2, TierBudgetPolicyV2>> = {\n\tsystem: { floorPct: 0.25, ceilingPct: 0.45 },\n\t\"active-goal\": { floorPct: 0.1, ceilingPct: 0.25 },\n\t\"current-files\": { floorPct: 0.08, ceilingPct: 0.2 },\n\ttools: { floorPct: 0.04, ceilingPct: 0.12 },\n\tskills: { floorPct: 0.03, ceilingPct: 0.12 },\n\tmcp: { floorPct: 0.02, ceilingPct: 0.08 },\n\thistory: { floorPct: 0.1, ceilingPct: 0.3 },\n\tevidence: { floorPct: 0.08, ceilingPct: 0.25 },\n\tscratch: { floorPct: 0, ceilingPct: 0.05 },\n};\n\nexport const ALL_TIERS_V2: readonly ContextBudgetTierV2[] = [\n\t\"system\",\n\t\"active-goal\",\n\t\"current-files\",\n\t\"tools\",\n\t\"skills\",\n\t\"mcp\",\n\t\"history\",\n\t\"evidence\",\n\t\"scratch\",\n];\n\nexport interface PromptContextBudgetInputV2 {\n\treadonly maxTokens: number;\n\treadonly responseReserveTokens?: number;\n\treadonly safetyMarginTokens?: number;\n\treadonly modelId?: string;\n\treadonly tokenizerId?: string;\n\treadonly policyVersion?: string;\n\treadonly promptHash?: string;\n\treadonly query?: string;\n\treadonly items: readonly ContextBudgetItemV2[];\n\treadonly tokenCounter?: TokenCounterAdapter;\n\treadonly tierPolicy?: Partial<Record<ContextBudgetTierV2, TierBudgetPolicyV2>>;\n\treadonly qualityPolicy?: HeadroomQualityPolicyV2;\n\treadonly cacheProvider?: ContextBudgetCacheProviderV2;\n\treadonly cacheNamespace?: string;\n\treadonly queryIntentHash?: string;\n\treadonly cacheBudgetBucket?: string;\n\treadonly redactionPolicyHash?: string;\n\treadonly safetyProfileHash?: string;\n\treadonly cacheNowEpochMs?: number;\n\treadonly cacheTtlMs?: number;\n\treadonly cacheInvalidationSnapshot?: ContextCacheInvalidationSnapshot;\n}\n\nexport interface SelectedRepresentationV2 {\n\treadonly itemId: string;\n\treadonly kind: ContextRepresentationKindV2;\n\treadonly text: string;\n\treadonly estimatedTokens: number;\n\treadonly fidelity: ContextRepresentationCandidateV2[\"fidelity\"];\n\treadonly sourceRef?: ContextSourceRefV2;\n\treadonly summaryHash?: string;\n\treadonly compressorId?: string;\n\treadonly cache?: ContextRepresentationCacheMetadataV2;\n}\n\nexport interface TierBudgetAllocationV2 {\n\treadonly tier: ContextBudgetTierV2;\n\treadonly floorTokens: number;\n\treadonly ceilingTokens: number;\n\treadonly allocatedTokens: number;\n\treadonly usedTokens: number;\n\treadonly hardTokens: number;\n}\n\nexport type QualityDiagnosticReasonV2 =\n\t| \"omitted_high_priority\"\n\t| \"retrieval_miss_risk\"\n\t| \"restore_on_demand_hint\"\n\t| \"hard_pin_over_capacity\"\n\t| \"coverage_gap\"\n\t| \"tier_ceiling_exceeded\"\n\t| \"invalid_budget\";\n\nexport interface QualityDiagnosticV2 {\n\treadonly reason: QualityDiagnosticReasonV2;\n\treadonly itemId?: string;\n\treadonly detail: string;\n}\n\nexport interface ContextBudgetObservabilityCountsV2 {\n\treadonly selected: number;\n\treadonly omitted: number;\n\treadonly pointer: number;\n\treadonly compressed: number;\n\treadonly full: number;\n\treadonly retrievalFallback: number;\n}\n\nexport interface ContextBudgetObservabilityTokensV2 {\n\treadonly available: number;\n\treadonly used: number;\n\treadonly raw: number;\n\treadonly omitted: number;\n\treadonly tokenSavings: number;\n}\n\nexport type ContextBudgetCacheLayerV2 = \"turn\" | \"session\" | \"workspace\" | \"shared\";\n\nexport type ContextBudgetRepresentationCacheRejectReasonV2 =\n\t| \"fingerprint_mismatch\"\n\t| \"kind_mismatch\"\n\t| \"model_mismatch\"\n\t| \"negative\"\n\t| \"policy_mismatch\"\n\t| \"poisoned\"\n\t| \"source_hash_mismatch\"\n\t| \"stale\"\n\t| \"token_invalid\"\n\t| \"tokenizer_mismatch\";\n\nexport type ContextBudgetRepresentationCacheKeyKindV2 = \"exact\" | \"materialized\";\n\nexport interface ContextBudgetMaterializedVerificationV2 {\n\treadonly queryCoverage?: number;\n\treadonly sourceCoverage?: number;\n\treadonly secretLeakScore?: number;\n\treadonly poisonScore?: number;\n\treadonly validatorVersion?: string;\n}\n\nexport interface ContextBudgetRepresentationCacheEntryV2 {\n\treadonly kind: ContextRepresentationKindV2;\n\treadonly text: string;\n\treadonly estimatedTokens: number;\n\treadonly fidelity: ContextRepresentationCandidateV2[\"fidelity\"];\n\treadonly sourceHash: string;\n\treadonly representationFingerprint: string;\n\treadonly keyKind?: ContextBudgetRepresentationCacheKeyKindV2;\n\treadonly modelId: string;\n\treadonly tokenizerId: string;\n\treadonly policyVersion: string;\n\treadonly sourceRef?: ContextSourceRefV2;\n\treadonly summaryHash?: string;\n\treadonly compressorId?: string;\n\treadonly compressorPolicyHash?: string;\n\treadonly qualityPolicyHash?: string;\n\treadonly queryIntentCluster?: string;\n\treadonly outputTextHash?: string;\n\treadonly targetTokenBucket?: number;\n\treadonly verification?: ContextBudgetMaterializedVerificationV2;\n\treadonly createdAtEpochMs?: number;\n}\n\nexport interface ContextBudgetRepresentationCacheReadV2 {\n\treadonly entry: ContextBudgetRepresentationCacheEntryV2;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n}\n\nexport interface ContextBudgetNegativeCacheEntryV2 {\n\treadonly reason: string;\n\treadonly createdAtEpochMs?: number;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n}\n\nexport interface ContextBudgetPlanCacheEntryV2 {\n\treadonly plan: PromptContextBudgetPlanV2;\n\treadonly sourceHashes: Readonly<Record<string, string>>;\n\treadonly createdAtEpochMs?: number;\n}\n\nexport interface ContextBudgetPlanCacheReadV2 {\n\treadonly entry: ContextBudgetPlanCacheEntryV2;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n}\n\nexport interface ContextBudgetCacheProviderV2 {\n\tgetInvalidationSnapshot?(): ContextCacheInvalidationSnapshot | undefined;\n\tsetInvalidationSnapshot?(snapshot: ContextCacheInvalidationSnapshot): void;\n\treadRepresentation(key: string): ContextBudgetRepresentationCacheReadV2 | undefined;\n\twriteRepresentation(input: { readonly key: string; readonly entry: ContextBudgetRepresentationCacheEntryV2 }): void;\n\treadNegativeRepresentation(key: string): ContextBudgetNegativeCacheEntryV2 | undefined;\n\twriteNegativeRepresentation(input: { readonly key: string; readonly reason: string }): void;\n\treadPlan(key: string): ContextBudgetPlanCacheReadV2 | undefined;\n\twritePlan(input: { readonly key: string; readonly entry: ContextBudgetPlanCacheEntryV2 }): void;\n}\n\nexport interface ContextBudgetPlanCacheTelemetryV2 {\n\treadonly hit: boolean;\n\treadonly key: string;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n\treadonly rejectedReason?: string;\n}\n\nexport interface ContextBudgetRepresentationCacheTelemetryV2 {\n\treadonly exactHits: number;\n\treadonly semanticHits: number;\n\treadonly pointerHits: number;\n\treadonly misses: number;\n\treadonly staleRejects: number;\n\treadonly poisonRejects: number;\n\treadonly negativeHits: number;\n\treadonly writes: number;\n}\n\nexport interface ContextBudgetCacheTokenTelemetryV2 {\n\treadonly raw: number;\n\treadonly rendered: number;\n\treadonly savedByCache: number;\n\treadonly savedByCompression: number;\n\treadonly savedByOmission: number;\n}\n\nexport interface TokenCacheTelemetryV2 {\n\treadonly planCache: ContextBudgetPlanCacheTelemetryV2;\n\treadonly representationCache: ContextBudgetRepresentationCacheTelemetryV2;\n\treadonly tokens: ContextBudgetCacheTokenTelemetryV2;\n}\n\nexport interface PromptContextBudgetObservabilityV2 {\n\treadonly counts: ContextBudgetObservabilityCountsV2;\n\treadonly diagnosticReasons: readonly QualityDiagnosticReasonV2[];\n\treadonly tokens: ContextBudgetObservabilityTokensV2;\n\treadonly planHash: string;\n\treadonly cache: TokenCacheTelemetryV2;\n\treadonly tokenOptimizer: TokenOptimizerRuntimeStatus;\n}\n\nexport interface PromptContextBudgetPlanV2 {\n\treadonly policyVersion: string;\n\treadonly promptHash?: string;\n\treadonly planHash: string;\n\treadonly maxTokens: number;\n\treadonly responseReserveTokens: number;\n\treadonly safetyMarginTokens: number;\n\treadonly availableTokens: number;\n\treadonly usedTokens: number;\n\treadonly omittedTokens: number;\n\treadonly rawTokens: number;\n\treadonly tokenSavingsRatio: number;\n\treadonly emergency: boolean;\n\treadonly omittedHighPriority: boolean;\n\treadonly tierAllocations: readonly TierBudgetAllocationV2[];\n\treadonly selectedRepresentations: readonly SelectedRepresentationV2[];\n\treadonly includedItemIds: readonly string[];\n\treadonly omittedItemIds: readonly string[];\n\treadonly diagnostics: readonly QualityDiagnosticV2[];\n\treadonly retrievalFallbacks: readonly ContextSourceRefV2[];\n\treadonly observability: PromptContextBudgetObservabilityV2;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"context-budget-v2-types.d.ts","sourceRoot":"","sources":["../../src/core/context-budget-v2-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,mBAAmB,EACnB,mBAAmB,EACnB,oCAAoC,EACpC,gCAAgC,EAChC,2BAA2B,EAC3B,kBAAkB,EAClB,uBAAuB,EACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAA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OAAO,CAAC;IAC5B,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,QAAQ,CAAC,eAAe,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC5D,QAAQ,CAAC,uBAAuB,EAAE,SAAS,wBAAwB,EAAE,CAAC;IACtE,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,WAAW,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACrD,QAAQ,CAAC,kBAAkB,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC3D,QAAQ,CAAC,aAAa,EAAE,kCAAkC,CAAC;CAC3D","sourcesContent":["import type {\n\tContextBudgetItemV2,\n\tContextBudgetTierV2,\n\tContextRepresentationCacheMetadataV2,\n\tContextRepresentationCandidateV2,\n\tContextRepresentationKindV2,\n\tContextSourceRefV2,\n\tHeadroomQualityPolicyV2,\n} from \"./context-budget-headroom.ts\";\nimport type { TokenCounterAdapter } from \"./context-budget-token-counter.ts\";\nimport type { ContextCacheInvalidationSnapshot } from \"./context-budget-v2-cache-invalidation.ts\";\n\nexport const CONTEXT_BUDGET_POLICY_VERSION_V2 = \"context-budget-v2\";\n\n// Inlined from the deleted token-optimizer.ts (legacy quarantine-compatibility\n// status; legacy-token-optimizer itself no longer exists as a module).\nexport interface TokenOptimizerRuntimeStatus {\n\treadonly optimizerId: \"legacy-token-optimizer\";\n\treadonly status: \"quarantined_compatibility\";\n\treadonly active: false;\n\treadonly activeContextBudgetOptimizer: \"context-budget-v2\";\n\treadonly compatibilityOnly: true;\n}\n\nexport interface TierBudgetPolicyV2 {\n\treadonly floorPct: number;\n\treadonly ceilingPct: number;\n}\n\nexport const DEFAULT_TIER_POLICY_V2: Readonly<Record<ContextBudgetTierV2, TierBudgetPolicyV2>> = {\n\tsystem: { floorPct: 0.25, ceilingPct: 0.45 },\n\t\"active-goal\": { floorPct: 0.1, ceilingPct: 0.25 },\n\t\"current-files\": { floorPct: 0.08, ceilingPct: 0.2 },\n\ttools: { floorPct: 0.04, ceilingPct: 0.12 },\n\tskills: { floorPct: 0.03, ceilingPct: 0.12 },\n\tmcp: { floorPct: 0.02, ceilingPct: 0.08 },\n\thistory: { floorPct: 0.1, ceilingPct: 0.3 },\n\tevidence: { floorPct: 0.08, ceilingPct: 0.25 },\n\tscratch: { floorPct: 0, ceilingPct: 0.05 },\n};\n\nexport const ALL_TIERS_V2: readonly ContextBudgetTierV2[] = [\n\t\"system\",\n\t\"active-goal\",\n\t\"current-files\",\n\t\"tools\",\n\t\"skills\",\n\t\"mcp\",\n\t\"history\",\n\t\"evidence\",\n\t\"scratch\",\n];\n\nexport interface PromptContextBudgetInputV2 {\n\treadonly maxTokens: number;\n\treadonly responseReserveTokens?: number;\n\treadonly safetyMarginTokens?: number;\n\treadonly modelId?: string;\n\treadonly tokenizerId?: string;\n\treadonly policyVersion?: string;\n\treadonly promptHash?: string;\n\treadonly query?: string;\n\treadonly items: readonly ContextBudgetItemV2[];\n\treadonly tokenCounter?: TokenCounterAdapter;\n\treadonly tierPolicy?: Partial<Record<ContextBudgetTierV2, TierBudgetPolicyV2>>;\n\treadonly qualityPolicy?: HeadroomQualityPolicyV2;\n\treadonly cacheProvider?: ContextBudgetCacheProviderV2;\n\treadonly cacheNamespace?: string;\n\treadonly queryIntentHash?: string;\n\treadonly cacheBudgetBucket?: string;\n\treadonly redactionPolicyHash?: string;\n\treadonly safetyProfileHash?: string;\n\treadonly cacheNowEpochMs?: number;\n\treadonly cacheTtlMs?: number;\n\treadonly cacheInvalidationSnapshot?: ContextCacheInvalidationSnapshot;\n}\n\nexport interface SelectedRepresentationV2 {\n\treadonly itemId: string;\n\treadonly kind: ContextRepresentationKindV2;\n\treadonly text: string;\n\treadonly estimatedTokens: number;\n\treadonly fidelity: ContextRepresentationCandidateV2[\"fidelity\"];\n\treadonly sourceRef?: ContextSourceRefV2;\n\treadonly summaryHash?: string;\n\treadonly compressorId?: string;\n\treadonly cache?: ContextRepresentationCacheMetadataV2;\n}\n\nexport interface TierBudgetAllocationV2 {\n\treadonly tier: ContextBudgetTierV2;\n\treadonly floorTokens: number;\n\treadonly ceilingTokens: number;\n\treadonly allocatedTokens: number;\n\treadonly usedTokens: number;\n\treadonly hardTokens: number;\n}\n\nexport type QualityDiagnosticReasonV2 =\n\t| \"omitted_high_priority\"\n\t| \"retrieval_miss_risk\"\n\t| \"restore_on_demand_hint\"\n\t| \"hard_pin_over_capacity\"\n\t| \"coverage_gap\"\n\t| \"tier_ceiling_exceeded\"\n\t| \"invalid_budget\";\n\nexport interface QualityDiagnosticV2 {\n\treadonly reason: QualityDiagnosticReasonV2;\n\treadonly itemId?: string;\n\treadonly detail: string;\n}\n\nexport interface ContextBudgetObservabilityCountsV2 {\n\treadonly selected: number;\n\treadonly omitted: number;\n\treadonly pointer: number;\n\treadonly compressed: number;\n\treadonly full: number;\n\treadonly retrievalFallback: number;\n}\n\nexport interface ContextBudgetObservabilityTokensV2 {\n\treadonly available: number;\n\treadonly used: number;\n\treadonly raw: number;\n\treadonly omitted: number;\n\treadonly tokenSavings: number;\n}\n\nexport type ContextBudgetCacheLayerV2 = \"turn\" | \"session\" | \"workspace\" | \"shared\";\n\nexport type ContextBudgetRepresentationCacheRejectReasonV2 =\n\t| \"fingerprint_mismatch\"\n\t| \"kind_mismatch\"\n\t| \"model_mismatch\"\n\t| \"negative\"\n\t| \"policy_mismatch\"\n\t| \"poisoned\"\n\t| \"source_hash_mismatch\"\n\t| \"stale\"\n\t| \"token_invalid\"\n\t| \"tokenizer_mismatch\";\n\nexport type ContextBudgetRepresentationCacheKeyKindV2 = \"exact\" | \"materialized\";\n\nexport interface ContextBudgetMaterializedVerificationV2 {\n\treadonly queryCoverage?: number;\n\treadonly sourceCoverage?: number;\n\treadonly secretLeakScore?: number;\n\treadonly poisonScore?: number;\n\treadonly validatorVersion?: string;\n}\n\nexport interface ContextBudgetRepresentationCacheEntryV2 {\n\treadonly kind: ContextRepresentationKindV2;\n\treadonly text: string;\n\treadonly estimatedTokens: number;\n\treadonly fidelity: ContextRepresentationCandidateV2[\"fidelity\"];\n\treadonly sourceHash: string;\n\treadonly representationFingerprint: string;\n\treadonly keyKind?: ContextBudgetRepresentationCacheKeyKindV2;\n\treadonly modelId: string;\n\treadonly tokenizerId: string;\n\treadonly policyVersion: string;\n\treadonly sourceRef?: ContextSourceRefV2;\n\treadonly summaryHash?: string;\n\treadonly compressorId?: string;\n\treadonly compressorPolicyHash?: string;\n\treadonly qualityPolicyHash?: string;\n\treadonly queryIntentCluster?: string;\n\treadonly outputTextHash?: string;\n\treadonly targetTokenBucket?: number;\n\treadonly verification?: ContextBudgetMaterializedVerificationV2;\n\treadonly createdAtEpochMs?: number;\n}\n\nexport interface ContextBudgetRepresentationCacheReadV2 {\n\treadonly entry: ContextBudgetRepresentationCacheEntryV2;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n}\n\nexport interface ContextBudgetNegativeCacheEntryV2 {\n\treadonly reason: string;\n\treadonly createdAtEpochMs?: number;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n}\n\nexport interface ContextBudgetPlanCacheEntryV2 {\n\treadonly plan: PromptContextBudgetPlanV2;\n\treadonly sourceHashes: Readonly<Record<string, string>>;\n\treadonly createdAtEpochMs?: number;\n}\n\nexport interface ContextBudgetPlanCacheReadV2 {\n\treadonly entry: ContextBudgetPlanCacheEntryV2;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n}\n\nexport interface ContextBudgetCacheProviderV2 {\n\tgetInvalidationSnapshot?(): ContextCacheInvalidationSnapshot | undefined;\n\tsetInvalidationSnapshot?(snapshot: ContextCacheInvalidationSnapshot): void;\n\treadRepresentation(key: string): ContextBudgetRepresentationCacheReadV2 | undefined;\n\twriteRepresentation(input: { readonly key: string; readonly entry: ContextBudgetRepresentationCacheEntryV2 }): void;\n\tdeleteRepresentation?(key: string): void;\n\treadNegativeRepresentation(key: string): ContextBudgetNegativeCacheEntryV2 | undefined;\n\twriteNegativeRepresentation(input: { readonly key: string; readonly reason: string }): void;\n\tdeleteNegativeRepresentation?(key: string): void;\n\treadPlan(key: string): ContextBudgetPlanCacheReadV2 | undefined;\n\twritePlan(input: { readonly key: string; readonly entry: ContextBudgetPlanCacheEntryV2 }): void;\n\tdeletePlan?(key: string): void;\n}\n\nexport interface ContextBudgetPlanCacheTelemetryV2 {\n\treadonly hit: boolean;\n\treadonly key: string;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n\treadonly rejectedReason?: string;\n}\n\nexport interface ContextBudgetRepresentationCacheTelemetryV2 {\n\treadonly exactHits: number;\n\treadonly semanticHits: number;\n\treadonly pointerHits: number;\n\treadonly misses: number;\n\treadonly staleRejects: number;\n\treadonly poisonRejects: number;\n\treadonly negativeHits: number;\n\treadonly writes: number;\n}\n\nexport interface ContextBudgetCacheTokenTelemetryV2 {\n\treadonly raw: number;\n\treadonly rendered: number;\n\treadonly savedByCache: number;\n\treadonly savedByCompression: number;\n\treadonly savedByOmission: number;\n}\n\nexport interface TokenCacheTelemetryV2 {\n\treadonly planCache: ContextBudgetPlanCacheTelemetryV2;\n\treadonly representationCache: ContextBudgetRepresentationCacheTelemetryV2;\n\treadonly tokens: ContextBudgetCacheTokenTelemetryV2;\n}\n\nexport interface PromptContextBudgetObservabilityV2 {\n\treadonly counts: ContextBudgetObservabilityCountsV2;\n\treadonly diagnosticReasons: readonly QualityDiagnosticReasonV2[];\n\treadonly tokens: ContextBudgetObservabilityTokensV2;\n\treadonly planHash: string;\n\treadonly cache: TokenCacheTelemetryV2;\n\treadonly tokenOptimizer: TokenOptimizerRuntimeStatus;\n}\n\nexport interface PromptContextBudgetPlanV2 {\n\treadonly policyVersion: string;\n\treadonly promptHash?: string;\n\treadonly planHash: string;\n\treadonly maxTokens: number;\n\treadonly responseReserveTokens: number;\n\treadonly safetyMarginTokens: number;\n\treadonly availableTokens: number;\n\treadonly usedTokens: number;\n\treadonly omittedTokens: number;\n\treadonly rawTokens: number;\n\treadonly tokenSavingsRatio: number;\n\treadonly emergency: boolean;\n\treadonly omittedHighPriority: boolean;\n\treadonly tierAllocations: readonly TierBudgetAllocationV2[];\n\treadonly selectedRepresentations: readonly SelectedRepresentationV2[];\n\treadonly includedItemIds: readonly string[];\n\treadonly omittedItemIds: readonly string[];\n\treadonly diagnostics: readonly QualityDiagnosticV2[];\n\treadonly retrievalFallbacks: readonly ContextSourceRefV2[];\n\treadonly observability: PromptContextBudgetObservabilityV2;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-budget-v2-types.js","sourceRoot":"","sources":["../../src/core/context-budget-v2-types.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,gCAAgC,GAAG,mBAAmB,CAAC;AAiBpE,MAAM,CAAC,MAAM,sBAAsB,GAA8D;IAChG,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5C,aAAa,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE;IAClD,eAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE;IACpD,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;IAC3C,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5C,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;IACzC,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE;IAC3C,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;IAC9C,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;CAC1C,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAmC;IAC3D,QAAQ;IACR,aAAa;IACb,eAAe;IACf,OAAO;IACP,QAAQ;IACR,KAAK;IACL,SAAS;IACT,UAAU;IACV,SAAS;CACT,CAAC","sourcesContent":["import type {\n\tContextBudgetItemV2,\n\tContextBudgetTierV2,\n\tContextRepresentationCacheMetadataV2,\n\tContextRepresentationCandidateV2,\n\tContextRepresentationKindV2,\n\tContextSourceRefV2,\n\tHeadroomQualityPolicyV2,\n} from \"./context-budget-headroom.ts\";\nimport type { TokenCounterAdapter } from \"./context-budget-token-counter.ts\";\nimport type { ContextCacheInvalidationSnapshot } from \"./context-budget-v2-cache-invalidation.ts\";\n\nexport const CONTEXT_BUDGET_POLICY_VERSION_V2 = \"context-budget-v2\";\n\n// Inlined from the deleted token-optimizer.ts (legacy quarantine-compatibility\n// status; legacy-token-optimizer itself no longer exists as a module).\nexport interface TokenOptimizerRuntimeStatus {\n\treadonly optimizerId: \"legacy-token-optimizer\";\n\treadonly status: \"quarantined_compatibility\";\n\treadonly active: false;\n\treadonly activeContextBudgetOptimizer: \"context-budget-v2\";\n\treadonly compatibilityOnly: true;\n}\n\nexport interface TierBudgetPolicyV2 {\n\treadonly floorPct: number;\n\treadonly ceilingPct: number;\n}\n\nexport const DEFAULT_TIER_POLICY_V2: Readonly<Record<ContextBudgetTierV2, TierBudgetPolicyV2>> = {\n\tsystem: { floorPct: 0.25, ceilingPct: 0.45 },\n\t\"active-goal\": { floorPct: 0.1, ceilingPct: 0.25 },\n\t\"current-files\": { floorPct: 0.08, ceilingPct: 0.2 },\n\ttools: { floorPct: 0.04, ceilingPct: 0.12 },\n\tskills: { floorPct: 0.03, ceilingPct: 0.12 },\n\tmcp: { floorPct: 0.02, ceilingPct: 0.08 },\n\thistory: { floorPct: 0.1, ceilingPct: 0.3 },\n\tevidence: { floorPct: 0.08, ceilingPct: 0.25 },\n\tscratch: { floorPct: 0, ceilingPct: 0.05 },\n};\n\nexport const ALL_TIERS_V2: readonly ContextBudgetTierV2[] = [\n\t\"system\",\n\t\"active-goal\",\n\t\"current-files\",\n\t\"tools\",\n\t\"skills\",\n\t\"mcp\",\n\t\"history\",\n\t\"evidence\",\n\t\"scratch\",\n];\n\nexport interface PromptContextBudgetInputV2 {\n\treadonly maxTokens: number;\n\treadonly responseReserveTokens?: number;\n\treadonly safetyMarginTokens?: number;\n\treadonly modelId?: string;\n\treadonly tokenizerId?: string;\n\treadonly policyVersion?: string;\n\treadonly promptHash?: string;\n\treadonly query?: string;\n\treadonly items: readonly ContextBudgetItemV2[];\n\treadonly tokenCounter?: TokenCounterAdapter;\n\treadonly tierPolicy?: Partial<Record<ContextBudgetTierV2, TierBudgetPolicyV2>>;\n\treadonly qualityPolicy?: HeadroomQualityPolicyV2;\n\treadonly cacheProvider?: ContextBudgetCacheProviderV2;\n\treadonly cacheNamespace?: string;\n\treadonly queryIntentHash?: string;\n\treadonly cacheBudgetBucket?: string;\n\treadonly redactionPolicyHash?: string;\n\treadonly safetyProfileHash?: string;\n\treadonly cacheNowEpochMs?: number;\n\treadonly cacheTtlMs?: number;\n\treadonly cacheInvalidationSnapshot?: ContextCacheInvalidationSnapshot;\n}\n\nexport interface SelectedRepresentationV2 {\n\treadonly itemId: string;\n\treadonly kind: ContextRepresentationKindV2;\n\treadonly text: string;\n\treadonly estimatedTokens: number;\n\treadonly fidelity: ContextRepresentationCandidateV2[\"fidelity\"];\n\treadonly sourceRef?: ContextSourceRefV2;\n\treadonly summaryHash?: string;\n\treadonly compressorId?: string;\n\treadonly cache?: ContextRepresentationCacheMetadataV2;\n}\n\nexport interface TierBudgetAllocationV2 {\n\treadonly tier: ContextBudgetTierV2;\n\treadonly floorTokens: number;\n\treadonly ceilingTokens: number;\n\treadonly allocatedTokens: number;\n\treadonly usedTokens: number;\n\treadonly hardTokens: number;\n}\n\nexport type QualityDiagnosticReasonV2 =\n\t| \"omitted_high_priority\"\n\t| \"retrieval_miss_risk\"\n\t| \"restore_on_demand_hint\"\n\t| \"hard_pin_over_capacity\"\n\t| \"coverage_gap\"\n\t| \"tier_ceiling_exceeded\"\n\t| \"invalid_budget\";\n\nexport interface QualityDiagnosticV2 {\n\treadonly reason: QualityDiagnosticReasonV2;\n\treadonly itemId?: string;\n\treadonly detail: string;\n}\n\nexport interface ContextBudgetObservabilityCountsV2 {\n\treadonly selected: number;\n\treadonly omitted: number;\n\treadonly pointer: number;\n\treadonly compressed: number;\n\treadonly full: number;\n\treadonly retrievalFallback: number;\n}\n\nexport interface ContextBudgetObservabilityTokensV2 {\n\treadonly available: number;\n\treadonly used: number;\n\treadonly raw: number;\n\treadonly omitted: number;\n\treadonly tokenSavings: number;\n}\n\nexport type ContextBudgetCacheLayerV2 = \"turn\" | \"session\" | \"workspace\" | \"shared\";\n\nexport type ContextBudgetRepresentationCacheRejectReasonV2 =\n\t| \"fingerprint_mismatch\"\n\t| \"kind_mismatch\"\n\t| \"model_mismatch\"\n\t| \"negative\"\n\t| \"policy_mismatch\"\n\t| \"poisoned\"\n\t| \"source_hash_mismatch\"\n\t| \"stale\"\n\t| \"token_invalid\"\n\t| \"tokenizer_mismatch\";\n\nexport type ContextBudgetRepresentationCacheKeyKindV2 = \"exact\" | \"materialized\";\n\nexport interface ContextBudgetMaterializedVerificationV2 {\n\treadonly queryCoverage?: number;\n\treadonly sourceCoverage?: number;\n\treadonly secretLeakScore?: number;\n\treadonly poisonScore?: number;\n\treadonly validatorVersion?: string;\n}\n\nexport interface ContextBudgetRepresentationCacheEntryV2 {\n\treadonly kind: ContextRepresentationKindV2;\n\treadonly text: string;\n\treadonly estimatedTokens: number;\n\treadonly fidelity: ContextRepresentationCandidateV2[\"fidelity\"];\n\treadonly sourceHash: string;\n\treadonly representationFingerprint: string;\n\treadonly keyKind?: ContextBudgetRepresentationCacheKeyKindV2;\n\treadonly modelId: string;\n\treadonly tokenizerId: string;\n\treadonly policyVersion: string;\n\treadonly sourceRef?: ContextSourceRefV2;\n\treadonly summaryHash?: string;\n\treadonly compressorId?: string;\n\treadonly compressorPolicyHash?: string;\n\treadonly qualityPolicyHash?: string;\n\treadonly queryIntentCluster?: string;\n\treadonly outputTextHash?: string;\n\treadonly targetTokenBucket?: number;\n\treadonly verification?: ContextBudgetMaterializedVerificationV2;\n\treadonly createdAtEpochMs?: number;\n}\n\nexport interface ContextBudgetRepresentationCacheReadV2 {\n\treadonly entry: ContextBudgetRepresentationCacheEntryV2;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n}\n\nexport interface ContextBudgetNegativeCacheEntryV2 {\n\treadonly reason: string;\n\treadonly createdAtEpochMs?: number;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n}\n\nexport interface ContextBudgetPlanCacheEntryV2 {\n\treadonly plan: PromptContextBudgetPlanV2;\n\treadonly sourceHashes: Readonly<Record<string, string>>;\n\treadonly createdAtEpochMs?: number;\n}\n\nexport interface ContextBudgetPlanCacheReadV2 {\n\treadonly entry: ContextBudgetPlanCacheEntryV2;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n}\n\nexport interface ContextBudgetCacheProviderV2 {\n\tgetInvalidationSnapshot?(): ContextCacheInvalidationSnapshot | undefined;\n\tsetInvalidationSnapshot?(snapshot: ContextCacheInvalidationSnapshot): void;\n\treadRepresentation(key: string): ContextBudgetRepresentationCacheReadV2 | undefined;\n\twriteRepresentation(input: { readonly key: string; readonly entry: ContextBudgetRepresentationCacheEntryV2 }): void;\n\treadNegativeRepresentation(key: string): ContextBudgetNegativeCacheEntryV2 | undefined;\n\twriteNegativeRepresentation(input: { readonly key: string; readonly reason: string }): void;\n\treadPlan(key: string): ContextBudgetPlanCacheReadV2 | undefined;\n\twritePlan(input: { readonly key: string; readonly entry: ContextBudgetPlanCacheEntryV2 }): void;\n}\n\nexport interface ContextBudgetPlanCacheTelemetryV2 {\n\treadonly hit: boolean;\n\treadonly key: string;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n\treadonly rejectedReason?: string;\n}\n\nexport interface ContextBudgetRepresentationCacheTelemetryV2 {\n\treadonly exactHits: number;\n\treadonly semanticHits: number;\n\treadonly pointerHits: number;\n\treadonly misses: number;\n\treadonly staleRejects: number;\n\treadonly poisonRejects: number;\n\treadonly negativeHits: number;\n\treadonly writes: number;\n}\n\nexport interface ContextBudgetCacheTokenTelemetryV2 {\n\treadonly raw: number;\n\treadonly rendered: number;\n\treadonly savedByCache: number;\n\treadonly savedByCompression: number;\n\treadonly savedByOmission: number;\n}\n\nexport interface TokenCacheTelemetryV2 {\n\treadonly planCache: ContextBudgetPlanCacheTelemetryV2;\n\treadonly representationCache: ContextBudgetRepresentationCacheTelemetryV2;\n\treadonly tokens: ContextBudgetCacheTokenTelemetryV2;\n}\n\nexport interface PromptContextBudgetObservabilityV2 {\n\treadonly counts: ContextBudgetObservabilityCountsV2;\n\treadonly diagnosticReasons: readonly QualityDiagnosticReasonV2[];\n\treadonly tokens: ContextBudgetObservabilityTokensV2;\n\treadonly planHash: string;\n\treadonly cache: TokenCacheTelemetryV2;\n\treadonly tokenOptimizer: TokenOptimizerRuntimeStatus;\n}\n\nexport interface PromptContextBudgetPlanV2 {\n\treadonly policyVersion: string;\n\treadonly promptHash?: string;\n\treadonly planHash: string;\n\treadonly maxTokens: number;\n\treadonly responseReserveTokens: number;\n\treadonly safetyMarginTokens: number;\n\treadonly availableTokens: number;\n\treadonly usedTokens: number;\n\treadonly omittedTokens: number;\n\treadonly rawTokens: number;\n\treadonly tokenSavingsRatio: number;\n\treadonly emergency: boolean;\n\treadonly omittedHighPriority: boolean;\n\treadonly tierAllocations: readonly TierBudgetAllocationV2[];\n\treadonly selectedRepresentations: readonly SelectedRepresentationV2[];\n\treadonly includedItemIds: readonly string[];\n\treadonly omittedItemIds: readonly string[];\n\treadonly diagnostics: readonly QualityDiagnosticV2[];\n\treadonly retrievalFallbacks: readonly ContextSourceRefV2[];\n\treadonly observability: PromptContextBudgetObservabilityV2;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"context-budget-v2-types.js","sourceRoot":"","sources":["../../src/core/context-budget-v2-types.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,gCAAgC,GAAG,mBAAmB,CAAC;AAiBpE,MAAM,CAAC,MAAM,sBAAsB,GAA8D;IAChG,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5C,aAAa,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE;IAClD,eAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE;IACpD,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;IAC3C,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5C,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;IACzC,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE;IAC3C,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;IAC9C,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;CAC1C,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAmC;IAC3D,QAAQ;IACR,aAAa;IACb,eAAe;IACf,OAAO;IACP,QAAQ;IACR,KAAK;IACL,SAAS;IACT,UAAU;IACV,SAAS;CACT,CAAC","sourcesContent":["import type {\n\tContextBudgetItemV2,\n\tContextBudgetTierV2,\n\tContextRepresentationCacheMetadataV2,\n\tContextRepresentationCandidateV2,\n\tContextRepresentationKindV2,\n\tContextSourceRefV2,\n\tHeadroomQualityPolicyV2,\n} from \"./context-budget-headroom.ts\";\nimport type { TokenCounterAdapter } from \"./context-budget-token-counter.ts\";\nimport type { ContextCacheInvalidationSnapshot } from \"./context-budget-v2-cache-invalidation.ts\";\n\nexport const CONTEXT_BUDGET_POLICY_VERSION_V2 = \"context-budget-v2\";\n\n// Inlined from the deleted token-optimizer.ts (legacy quarantine-compatibility\n// status; legacy-token-optimizer itself no longer exists as a module).\nexport interface TokenOptimizerRuntimeStatus {\n\treadonly optimizerId: \"legacy-token-optimizer\";\n\treadonly status: \"quarantined_compatibility\";\n\treadonly active: false;\n\treadonly activeContextBudgetOptimizer: \"context-budget-v2\";\n\treadonly compatibilityOnly: true;\n}\n\nexport interface TierBudgetPolicyV2 {\n\treadonly floorPct: number;\n\treadonly ceilingPct: number;\n}\n\nexport const DEFAULT_TIER_POLICY_V2: Readonly<Record<ContextBudgetTierV2, TierBudgetPolicyV2>> = {\n\tsystem: { floorPct: 0.25, ceilingPct: 0.45 },\n\t\"active-goal\": { floorPct: 0.1, ceilingPct: 0.25 },\n\t\"current-files\": { floorPct: 0.08, ceilingPct: 0.2 },\n\ttools: { floorPct: 0.04, ceilingPct: 0.12 },\n\tskills: { floorPct: 0.03, ceilingPct: 0.12 },\n\tmcp: { floorPct: 0.02, ceilingPct: 0.08 },\n\thistory: { floorPct: 0.1, ceilingPct: 0.3 },\n\tevidence: { floorPct: 0.08, ceilingPct: 0.25 },\n\tscratch: { floorPct: 0, ceilingPct: 0.05 },\n};\n\nexport const ALL_TIERS_V2: readonly ContextBudgetTierV2[] = [\n\t\"system\",\n\t\"active-goal\",\n\t\"current-files\",\n\t\"tools\",\n\t\"skills\",\n\t\"mcp\",\n\t\"history\",\n\t\"evidence\",\n\t\"scratch\",\n];\n\nexport interface PromptContextBudgetInputV2 {\n\treadonly maxTokens: number;\n\treadonly responseReserveTokens?: number;\n\treadonly safetyMarginTokens?: number;\n\treadonly modelId?: string;\n\treadonly tokenizerId?: string;\n\treadonly policyVersion?: string;\n\treadonly promptHash?: string;\n\treadonly query?: string;\n\treadonly items: readonly ContextBudgetItemV2[];\n\treadonly tokenCounter?: TokenCounterAdapter;\n\treadonly tierPolicy?: Partial<Record<ContextBudgetTierV2, TierBudgetPolicyV2>>;\n\treadonly qualityPolicy?: HeadroomQualityPolicyV2;\n\treadonly cacheProvider?: ContextBudgetCacheProviderV2;\n\treadonly cacheNamespace?: string;\n\treadonly queryIntentHash?: string;\n\treadonly cacheBudgetBucket?: string;\n\treadonly redactionPolicyHash?: string;\n\treadonly safetyProfileHash?: string;\n\treadonly cacheNowEpochMs?: number;\n\treadonly cacheTtlMs?: number;\n\treadonly cacheInvalidationSnapshot?: ContextCacheInvalidationSnapshot;\n}\n\nexport interface SelectedRepresentationV2 {\n\treadonly itemId: string;\n\treadonly kind: ContextRepresentationKindV2;\n\treadonly text: string;\n\treadonly estimatedTokens: number;\n\treadonly fidelity: ContextRepresentationCandidateV2[\"fidelity\"];\n\treadonly sourceRef?: ContextSourceRefV2;\n\treadonly summaryHash?: string;\n\treadonly compressorId?: string;\n\treadonly cache?: ContextRepresentationCacheMetadataV2;\n}\n\nexport interface TierBudgetAllocationV2 {\n\treadonly tier: ContextBudgetTierV2;\n\treadonly floorTokens: number;\n\treadonly ceilingTokens: number;\n\treadonly allocatedTokens: number;\n\treadonly usedTokens: number;\n\treadonly hardTokens: number;\n}\n\nexport type QualityDiagnosticReasonV2 =\n\t| \"omitted_high_priority\"\n\t| \"retrieval_miss_risk\"\n\t| \"restore_on_demand_hint\"\n\t| \"hard_pin_over_capacity\"\n\t| \"coverage_gap\"\n\t| \"tier_ceiling_exceeded\"\n\t| \"invalid_budget\";\n\nexport interface QualityDiagnosticV2 {\n\treadonly reason: QualityDiagnosticReasonV2;\n\treadonly itemId?: string;\n\treadonly detail: string;\n}\n\nexport interface ContextBudgetObservabilityCountsV2 {\n\treadonly selected: number;\n\treadonly omitted: number;\n\treadonly pointer: number;\n\treadonly compressed: number;\n\treadonly full: number;\n\treadonly retrievalFallback: number;\n}\n\nexport interface ContextBudgetObservabilityTokensV2 {\n\treadonly available: number;\n\treadonly used: number;\n\treadonly raw: number;\n\treadonly omitted: number;\n\treadonly tokenSavings: number;\n}\n\nexport type ContextBudgetCacheLayerV2 = \"turn\" | \"session\" | \"workspace\" | \"shared\";\n\nexport type ContextBudgetRepresentationCacheRejectReasonV2 =\n\t| \"fingerprint_mismatch\"\n\t| \"kind_mismatch\"\n\t| \"model_mismatch\"\n\t| \"negative\"\n\t| \"policy_mismatch\"\n\t| \"poisoned\"\n\t| \"source_hash_mismatch\"\n\t| \"stale\"\n\t| \"token_invalid\"\n\t| \"tokenizer_mismatch\";\n\nexport type ContextBudgetRepresentationCacheKeyKindV2 = \"exact\" | \"materialized\";\n\nexport interface ContextBudgetMaterializedVerificationV2 {\n\treadonly queryCoverage?: number;\n\treadonly sourceCoverage?: number;\n\treadonly secretLeakScore?: number;\n\treadonly poisonScore?: number;\n\treadonly validatorVersion?: string;\n}\n\nexport interface ContextBudgetRepresentationCacheEntryV2 {\n\treadonly kind: ContextRepresentationKindV2;\n\treadonly text: string;\n\treadonly estimatedTokens: number;\n\treadonly fidelity: ContextRepresentationCandidateV2[\"fidelity\"];\n\treadonly sourceHash: string;\n\treadonly representationFingerprint: string;\n\treadonly keyKind?: ContextBudgetRepresentationCacheKeyKindV2;\n\treadonly modelId: string;\n\treadonly tokenizerId: string;\n\treadonly policyVersion: string;\n\treadonly sourceRef?: ContextSourceRefV2;\n\treadonly summaryHash?: string;\n\treadonly compressorId?: string;\n\treadonly compressorPolicyHash?: string;\n\treadonly qualityPolicyHash?: string;\n\treadonly queryIntentCluster?: string;\n\treadonly outputTextHash?: string;\n\treadonly targetTokenBucket?: number;\n\treadonly verification?: ContextBudgetMaterializedVerificationV2;\n\treadonly createdAtEpochMs?: number;\n}\n\nexport interface ContextBudgetRepresentationCacheReadV2 {\n\treadonly entry: ContextBudgetRepresentationCacheEntryV2;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n}\n\nexport interface ContextBudgetNegativeCacheEntryV2 {\n\treadonly reason: string;\n\treadonly createdAtEpochMs?: number;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n}\n\nexport interface ContextBudgetPlanCacheEntryV2 {\n\treadonly plan: PromptContextBudgetPlanV2;\n\treadonly sourceHashes: Readonly<Record<string, string>>;\n\treadonly createdAtEpochMs?: number;\n}\n\nexport interface ContextBudgetPlanCacheReadV2 {\n\treadonly entry: ContextBudgetPlanCacheEntryV2;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n}\n\nexport interface ContextBudgetCacheProviderV2 {\n\tgetInvalidationSnapshot?(): ContextCacheInvalidationSnapshot | undefined;\n\tsetInvalidationSnapshot?(snapshot: ContextCacheInvalidationSnapshot): void;\n\treadRepresentation(key: string): ContextBudgetRepresentationCacheReadV2 | undefined;\n\twriteRepresentation(input: { readonly key: string; readonly entry: ContextBudgetRepresentationCacheEntryV2 }): void;\n\tdeleteRepresentation?(key: string): void;\n\treadNegativeRepresentation(key: string): ContextBudgetNegativeCacheEntryV2 | undefined;\n\twriteNegativeRepresentation(input: { readonly key: string; readonly reason: string }): void;\n\tdeleteNegativeRepresentation?(key: string): void;\n\treadPlan(key: string): ContextBudgetPlanCacheReadV2 | undefined;\n\twritePlan(input: { readonly key: string; readonly entry: ContextBudgetPlanCacheEntryV2 }): void;\n\tdeletePlan?(key: string): void;\n}\n\nexport interface ContextBudgetPlanCacheTelemetryV2 {\n\treadonly hit: boolean;\n\treadonly key: string;\n\treadonly layer?: ContextBudgetCacheLayerV2;\n\treadonly rejectedReason?: string;\n}\n\nexport interface ContextBudgetRepresentationCacheTelemetryV2 {\n\treadonly exactHits: number;\n\treadonly semanticHits: number;\n\treadonly pointerHits: number;\n\treadonly misses: number;\n\treadonly staleRejects: number;\n\treadonly poisonRejects: number;\n\treadonly negativeHits: number;\n\treadonly writes: number;\n}\n\nexport interface ContextBudgetCacheTokenTelemetryV2 {\n\treadonly raw: number;\n\treadonly rendered: number;\n\treadonly savedByCache: number;\n\treadonly savedByCompression: number;\n\treadonly savedByOmission: number;\n}\n\nexport interface TokenCacheTelemetryV2 {\n\treadonly planCache: ContextBudgetPlanCacheTelemetryV2;\n\treadonly representationCache: ContextBudgetRepresentationCacheTelemetryV2;\n\treadonly tokens: ContextBudgetCacheTokenTelemetryV2;\n}\n\nexport interface PromptContextBudgetObservabilityV2 {\n\treadonly counts: ContextBudgetObservabilityCountsV2;\n\treadonly diagnosticReasons: readonly QualityDiagnosticReasonV2[];\n\treadonly tokens: ContextBudgetObservabilityTokensV2;\n\treadonly planHash: string;\n\treadonly cache: TokenCacheTelemetryV2;\n\treadonly tokenOptimizer: TokenOptimizerRuntimeStatus;\n}\n\nexport interface PromptContextBudgetPlanV2 {\n\treadonly policyVersion: string;\n\treadonly promptHash?: string;\n\treadonly planHash: string;\n\treadonly maxTokens: number;\n\treadonly responseReserveTokens: number;\n\treadonly safetyMarginTokens: number;\n\treadonly availableTokens: number;\n\treadonly usedTokens: number;\n\treadonly omittedTokens: number;\n\treadonly rawTokens: number;\n\treadonly tokenSavingsRatio: number;\n\treadonly emergency: boolean;\n\treadonly omittedHighPriority: boolean;\n\treadonly tierAllocations: readonly TierBudgetAllocationV2[];\n\treadonly selectedRepresentations: readonly SelectedRepresentationV2[];\n\treadonly includedItemIds: readonly string[];\n\treadonly omittedItemIds: readonly string[];\n\treadonly diagnostics: readonly QualityDiagnosticV2[];\n\treadonly retrievalFallbacks: readonly ContextSourceRefV2[];\n\treadonly observability: PromptContextBudgetObservabilityV2;\n}\n"]}
|
|
@@ -982,6 +982,8 @@ export interface ProviderConfig {
|
|
|
982
982
|
refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;
|
|
983
983
|
/** Convert credentials to API key string for the provider. */
|
|
984
984
|
getApiKey(credentials: OAuthCredentials): string;
|
|
985
|
+
/** Optional: derive a human-readable account label from stored credentials. */
|
|
986
|
+
getAccountLabel?(credentials: OAuthCredentials): string | undefined;
|
|
985
987
|
/** Optional: modify models for this provider (e.g., update baseUrl based on credentials). */
|
|
986
988
|
modifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];
|
|
987
989
|
};
|