@oscharko-dev/keiko 1.1.11 → 1.1.12
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/ui/csp-hashes.json +7 -7
- package/dist/ui/static/404.html +1 -1
- package/dist/ui/static/__next.__PAGE__.txt +1 -1
- package/dist/ui/static/__next._full.txt +1 -1
- package/dist/ui/static/__next._tree.txt +1 -1
- package/dist/ui/static/_not-found/__next._full.txt +1 -1
- package/dist/ui/static/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/ui/static/_not-found/__next._tree.txt +1 -1
- package/dist/ui/static/_not-found.html +1 -1
- package/dist/ui/static/_not-found.txt +1 -1
- package/dist/ui/static/atlassian-connectors/__next._full.txt +1 -1
- package/dist/ui/static/atlassian-connectors/__next._tree.txt +1 -1
- package/dist/ui/static/atlassian-connectors/__next.atlassian-connectors.__PAGE__.txt +1 -1
- package/dist/ui/static/atlassian-connectors.html +1 -1
- package/dist/ui/static/atlassian-connectors.txt +1 -1
- package/dist/ui/static/index.html +1 -1
- package/dist/ui/static/index.txt +1 -1
- package/dist/ui/static/launch/__next._full.txt +1 -1
- package/dist/ui/static/launch/__next._tree.txt +1 -1
- package/dist/ui/static/launch/__next.launch.__PAGE__.txt +1 -1
- package/dist/ui/static/launch.html +1 -1
- package/dist/ui/static/launch.txt +1 -1
- package/dist/ui/static/local-knowledge/__next._full.txt +1 -1
- package/dist/ui/static/local-knowledge/__next._tree.txt +1 -1
- package/dist/ui/static/local-knowledge/__next.local-knowledge.__PAGE__.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule/__next._full.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule/__next._tree.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule/__next.local-knowledge.capsule.__PAGE__.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule.html +1 -1
- package/dist/ui/static/local-knowledge/capsule.txt +1 -1
- package/dist/ui/static/local-knowledge.html +1 -1
- package/dist/ui/static/local-knowledge.txt +1 -1
- package/node_modules/@oscharko-dev/keiko-activity-log/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-cli/package.json +15 -15
- package/node_modules/@oscharko-dev/keiko-connectors/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-connectors/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-connectors/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-failure-class-contracts.d.ts +45 -5
- package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-failure-class-contracts.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-failure-class-contracts.js +86 -5
- package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-registry.generated.d.ts +811 -5
- package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-registry.generated.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-registry.generated.js +921 -5
- package/node_modules/@oscharko-dev/keiko-contracts/dist/context-engineering.js +1 -1
- package/node_modules/@oscharko-dev/keiko-contracts/dist/version.d.ts +2 -2
- package/node_modules/@oscharko-dev/keiko-contracts/dist/version.js +2 -2
- package/node_modules/@oscharko-dev/keiko-contracts/package.json +1 -1
- package/node_modules/@oscharko-dev/keiko-evaluations/package.json +9 -9
- package/node_modules/@oscharko-dev/keiko-evidence/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-evidence/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-evidence/package.json +4 -4
- package/node_modules/@oscharko-dev/keiko-git/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-git/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-git/package.json +1 -1
- package/node_modules/@oscharko-dev/keiko-harness/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-harness/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-harness/package.json +7 -7
- package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-local-knowledge/package.json +5 -5
- package/node_modules/@oscharko-dev/keiko-memory-capture/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-capture/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-capture/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-memory-governance/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-governance/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-governance/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-memory-retrieval/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-retrieval/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-retrieval/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-memory-vault/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-vault/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-vault/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/config.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/config.js +6 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/gateway-prompt-admission.d.ts +34 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/gateway-prompt-admission.d.ts.map +1 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/gateway-prompt-admission.js +165 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/gateway.d.ts +4 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/gateway.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/gateway.js +85 -42
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/observability.d.ts +23 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/observability.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/observability.js +27 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/prompt-admission.d.ts +7 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/prompt-admission.d.ts.map +1 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/prompt-admission.js +151 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/prompt-token-accounting.d.ts +12 -4
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/prompt-token-accounting.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/prompt-token-accounting.js +42 -9
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/provider-token-counter.d.ts +13 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/provider-token-counter.d.ts.map +1 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/provider-token-counter.js +121 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/toolCatalogBridge.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/toolCatalogBridge.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/toolCatalogBridge.js +13 -12
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/types.d.ts +2 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/types.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-model-gateway/package.json +4 -4
- package/node_modules/@oscharko-dev/keiko-quality-intelligence/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-sandbox/package.json +2 -2
- package/node_modules/@oscharko-dev/keiko-sdk/package.json +9 -9
- package/node_modules/@oscharko-dev/keiko-security/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-security/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-security/package.json +2 -2
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-activity.d.ts +3 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-activity.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-activity.js +57 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-handlers.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-handlers.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-handlers.js +29 -29
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-prompt-budget-token-summary.d.ts +6 -12
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-prompt-budget-token-summary.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-prompt-budget-token-summary.js +42 -64
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-prompt-budget.d.ts +1 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-prompt-budget.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-prompt-budget.js +16 -10
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-stream-handlers.js +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/conversation-compaction.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/conversation-compaction.js +37 -24
- package/node_modules/@oscharko-dev/keiko-server/dist/conversation-gateway.d.ts +3 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/conversation-gateway.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/conversation-gateway.js +14 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/deps.d.ts +3 -2
- package/node_modules/@oscharko-dev/keiko-server/dist/deps.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/gateway-discovery-log.d.ts +11 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/gateway-discovery-log.d.ts.map +1 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/gateway-discovery-log.js +49 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/gateway-setup.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/gateway-setup.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/gateway-setup.js +138 -27
- package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/commitDraftQuality.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/commitDraftQuality.js +2 -5
- package/node_modules/@oscharko-dev/keiko-server/dist/process-log-sink.d.ts +4 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/process-log-sink.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/process-log-sink.js +3 -29
- package/node_modules/@oscharko-dev/keiko-server/package.json +23 -23
- package/node_modules/@oscharko-dev/keiko-tool-catalog/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-tools/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-tools/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-tools/package.json +7 -7
- package/node_modules/@oscharko-dev/keiko-verification/package.json +5 -5
- package/node_modules/@oscharko-dev/keiko-workflows/package.json +10 -10
- package/node_modules/@oscharko-dev/keiko-workspace/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-workspace/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-workspace/package.json +3 -3
- package/package.json +27 -27
- package/release-impact.catalog.json +62 -0
- package/vendor/{oscharko-dev-keiko-activity-log-1.1.11.tgz → oscharko-dev-keiko-activity-log-1.1.12.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-cli-1.1.11.tgz → oscharko-dev-keiko-cli-1.1.12.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-connectors-1.1.11.tgz → oscharko-dev-keiko-connectors-1.1.12.tgz} +0 -0
- package/vendor/oscharko-dev-keiko-contracts-1.1.12.tgz +0 -0
- package/vendor/{oscharko-dev-keiko-evaluations-1.1.11.tgz → oscharko-dev-keiko-evaluations-1.1.12.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-evidence-1.1.11.tgz → oscharko-dev-keiko-evidence-1.1.12.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-git-1.1.11.tgz → oscharko-dev-keiko-git-1.1.12.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-harness-1.1.11.tgz → oscharko-dev-keiko-harness-1.1.12.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-local-knowledge-1.1.11.tgz → oscharko-dev-keiko-local-knowledge-1.1.12.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-memory-capture-1.1.11.tgz → oscharko-dev-keiko-memory-capture-1.1.12.tgz} +0 -0
- package/vendor/oscharko-dev-keiko-memory-consolidation-1.1.12.tgz +0 -0
- package/vendor/{oscharko-dev-keiko-memory-governance-1.1.11.tgz → oscharko-dev-keiko-memory-governance-1.1.12.tgz} +0 -0
- package/vendor/oscharko-dev-keiko-memory-retrieval-1.1.12.tgz +0 -0
- package/vendor/{oscharko-dev-keiko-memory-vault-1.1.11.tgz → oscharko-dev-keiko-memory-vault-1.1.12.tgz} +0 -0
- package/vendor/oscharko-dev-keiko-model-gateway-1.1.12.tgz +0 -0
- package/vendor/{oscharko-dev-keiko-quality-intelligence-1.1.11.tgz → oscharko-dev-keiko-quality-intelligence-1.1.12.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-sandbox-1.1.11.tgz → oscharko-dev-keiko-sandbox-1.1.12.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-sdk-1.1.11.tgz → oscharko-dev-keiko-sdk-1.1.12.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-security-1.1.11.tgz → oscharko-dev-keiko-security-1.1.12.tgz} +0 -0
- package/vendor/oscharko-dev-keiko-server-1.1.12.tgz +0 -0
- package/vendor/{oscharko-dev-keiko-tool-catalog-1.1.11.tgz → oscharko-dev-keiko-tool-catalog-1.1.12.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-tools-1.1.11.tgz → oscharko-dev-keiko-tools-1.1.12.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-verification-1.1.11.tgz → oscharko-dev-keiko-verification-1.1.12.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-workflows-1.1.11.tgz → oscharko-dev-keiko-workflows-1.1.12.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-workspace-1.1.11.tgz → oscharko-dev-keiko-workspace-1.1.12.tgz} +0 -0
- package/vendor/oscharko-dev-keiko-contracts-1.1.11.tgz +0 -0
- package/vendor/oscharko-dev-keiko-memory-consolidation-1.1.11.tgz +0 -0
- package/vendor/oscharko-dev-keiko-memory-retrieval-1.1.11.tgz +0 -0
- package/vendor/oscharko-dev-keiko-model-gateway-1.1.11.tgz +0 -0
- package/vendor/oscharko-dev-keiko-server-1.1.11.tgz +0 -0
- /package/dist/ui/static/_next/static/{GX41Kg0XC2e1CF4PEQCfA → __kGQcCW6ht5xSodXZZBj}/_buildManifest.js +0 -0
- /package/dist/ui/static/_next/static/{GX41Kg0XC2e1CF4PEQCfA → __kGQcCW6ht5xSodXZZBj}/_clientMiddlewareManifest.js +0 -0
- /package/dist/ui/static/_next/static/{GX41Kg0XC2e1CF4PEQCfA → __kGQcCW6ht5xSodXZZBj}/_ssgManifest.js +0 -0
|
@@ -7,8 +7,9 @@ import { activityLogEvent, defineActivityLogOperation, } from "@oscharko-dev/kei
|
|
|
7
7
|
import { canonicalise, sha256Hex } from "@oscharko-dev/keiko-security/hashing";
|
|
8
8
|
import { CancelledError, ConfigInvalidError, ContextOverflowError, GatewayError, MalformedToolCallError, ProviderEmptyAnswerError, ProviderOutputExhaustedError, TransportError, UnknownModelError, } from "@oscharko-dev/keiko-security/errors/gateway";
|
|
9
9
|
import { deriveContextProfileFromCapability } from "@oscharko-dev/keiko-contracts/runtime/context-engineering";
|
|
10
|
+
import { GatewayPromptAdmission, ProviderPromptCounter } from "./gateway-prompt-admission.js";
|
|
10
11
|
import { findConfiguredCapability } from "./model-selection.js";
|
|
11
|
-
import { activityLogErrorKind, logEndpointHost, logLevelEnabled, logModelId, logTimer, resolveLogSink, } from "./observability.js";
|
|
12
|
+
import { activityLogErrorKind, logEndpointHost, logLevelEnabled, logModelId, logTimer, resolveLogSink, withCorrelationId, } from "./observability.js";
|
|
12
13
|
import { OpenAiAdapter } from "./openai-adapter.js";
|
|
13
14
|
import { countGatewayPromptTokens } from "./prompt-token-accounting.js";
|
|
14
15
|
import { createGatewayToolCatalogBridge, GatewayToolCatalogError } from "./toolCatalogBridge.js";
|
|
@@ -597,6 +598,7 @@ function streamUsageIfSupplied(usage) {
|
|
|
597
598
|
export class Gateway {
|
|
598
599
|
config;
|
|
599
600
|
spendBudget;
|
|
601
|
+
promptCounter;
|
|
600
602
|
clock;
|
|
601
603
|
random;
|
|
602
604
|
adapter;
|
|
@@ -609,6 +611,7 @@ export class Gateway {
|
|
|
609
611
|
this.config = config;
|
|
610
612
|
this.spendBudget = deps.spendBudget;
|
|
611
613
|
this.clock = deps.clock ?? systemClock;
|
|
614
|
+
this.promptCounter = new ProviderPromptCounter(() => this.clock.now());
|
|
612
615
|
this.random = deps.random ?? Math.random;
|
|
613
616
|
this.adapter = deps.adapter;
|
|
614
617
|
this.fetchImpl = deps.fetchImpl;
|
|
@@ -619,9 +622,22 @@ export class Gateway {
|
|
|
619
622
|
}
|
|
620
623
|
prepareRequest(request, capability) {
|
|
621
624
|
assertValidGatewaySamplingParameters(request);
|
|
622
|
-
if (
|
|
625
|
+
if (request.maxOutputTokens !== undefined || this.spendBudget === undefined)
|
|
623
626
|
return request;
|
|
624
|
-
return {
|
|
627
|
+
return {
|
|
628
|
+
...request,
|
|
629
|
+
maxOutputTokens: deriveContextProfileFromCapability(capability).reservedOutputTokens,
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
promptAdmission(route, ids) {
|
|
633
|
+
return new GatewayPromptAdmission({
|
|
634
|
+
...route,
|
|
635
|
+
correlationId: ids.correlationId,
|
|
636
|
+
log: this.log,
|
|
637
|
+
now: () => this.clock.now(),
|
|
638
|
+
counter: this.promptCounter,
|
|
639
|
+
fetchImpl: this.fetchImpl,
|
|
640
|
+
});
|
|
625
641
|
}
|
|
626
642
|
// ONE-TIME configuration snapshot, written once per Gateway construction (the process-wide
|
|
627
643
|
// instance cache in keiko-server constructs exactly one Gateway per distinct GatewayConfig, so
|
|
@@ -648,7 +664,6 @@ export class Gateway {
|
|
|
648
664
|
async chat(request) {
|
|
649
665
|
const route = this.routeForCall(request);
|
|
650
666
|
request = this.prepareRequest(request, route.capability);
|
|
651
|
-
const breaker = this.breakerFor(route.provider);
|
|
652
667
|
const requestId = randomUUID();
|
|
653
668
|
const ids = callIds(requestId, request);
|
|
654
669
|
const start = this.clock.now();
|
|
@@ -656,9 +671,10 @@ export class Gateway {
|
|
|
656
671
|
const adapter = this.adapterFor(requestId, route, ids.correlationId);
|
|
657
672
|
const attempt = {
|
|
658
673
|
route,
|
|
659
|
-
breaker,
|
|
674
|
+
breaker: this.breakerFor(route.provider),
|
|
660
675
|
adapter,
|
|
661
676
|
originalRequest: request,
|
|
677
|
+
promptAdmission: this.promptAdmission(route, ids),
|
|
662
678
|
correlationId: ids.correlationId,
|
|
663
679
|
state: { request, attemptNumber: 0 },
|
|
664
680
|
};
|
|
@@ -692,36 +708,37 @@ export class Gateway {
|
|
|
692
708
|
...(attemptTimeoutMs === undefined ? {} : { timeoutMs: attemptTimeoutMs }),
|
|
693
709
|
};
|
|
694
710
|
try {
|
|
695
|
-
return await this.invoke(attempt
|
|
711
|
+
return await this.invoke(attempt, provider, streamedReadBounds(attempt, remainingBudgetMs));
|
|
696
712
|
}
|
|
697
713
|
catch (error) {
|
|
698
714
|
if (attempt.state.attemptNumber <= attempt.route.provider.maxRetries) {
|
|
699
|
-
attempt.state.
|
|
715
|
+
attempt.state.repair = error instanceof GatewayToolCatalogError ? error.repair : undefined;
|
|
716
|
+
attempt.state.request = this.requestAfterToolSchemaRejection(attempt.originalRequest, attempt.state.request, attempt.route.capability, error);
|
|
700
717
|
}
|
|
701
718
|
throw error;
|
|
702
719
|
}
|
|
703
720
|
}
|
|
704
|
-
requestAfterToolSchemaRejection(original, current, capability,
|
|
721
|
+
requestAfterToolSchemaRejection(original, current, capability, error) {
|
|
705
722
|
const candidate = repairedRequest(original, error);
|
|
706
723
|
if (candidate === undefined)
|
|
707
724
|
return current;
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
const
|
|
716
|
-
const
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
+
return this.prepareRequest(candidate, capability);
|
|
726
|
+
}
|
|
727
|
+
logAttemptRepair(attempt, state) {
|
|
728
|
+
if (attempt.state.repair === undefined)
|
|
729
|
+
return;
|
|
730
|
+
const request = attempt.state.request;
|
|
731
|
+
const profile = deriveContextProfileFromCapability(attempt.route.capability);
|
|
732
|
+
const maxOutputTokens = request.maxOutputTokens ?? profile.reservedOutputTokens;
|
|
733
|
+
const tools = createGatewayToolCatalogBridge(request, () => this.clock.now(), withCorrelationId(this.log, attempt.correlationId), false).tools;
|
|
734
|
+
this.logToolSchemaRepair(attempt.correlationId, attempt.state.repair, state, {
|
|
735
|
+
promptTokens: countGatewayPromptTokens({ ...request, tools }, profile.tokenAccounting, {
|
|
736
|
+
contextWindow: profile.maxInputTokens,
|
|
737
|
+
}),
|
|
738
|
+
maxOutputTokens,
|
|
739
|
+
safetyMarginTokens: profile.safetyMarginTokens,
|
|
740
|
+
maxPromptTokens: Math.max(0, profile.maxInputTokens - maxOutputTokens - profile.safetyMarginTokens),
|
|
741
|
+
});
|
|
725
742
|
}
|
|
726
743
|
logToolSchemaRepair(correlationId, repair, state, budget) {
|
|
727
744
|
if (repair === undefined)
|
|
@@ -749,16 +766,8 @@ export class Gateway {
|
|
|
749
766
|
// retry would replay already-emitted tokens and is never permitted. An adapter without a
|
|
750
767
|
// streaming variant falls back to a single delta+done synthesised from its buffered call().
|
|
751
768
|
async *chatStream(request) {
|
|
752
|
-
const route = this.
|
|
753
|
-
request =
|
|
754
|
-
const breaker = this.breakerFor(route.provider);
|
|
755
|
-
const ids = callIds(randomUUID(), request);
|
|
756
|
-
const start = this.clock.now();
|
|
757
|
-
const elapsed = logTimer();
|
|
758
|
-
const adapter = this.adapterFor(ids.requestId, route, ids.correlationId);
|
|
759
|
-
const admission = breaker.assertAllowed(ids.correlationId);
|
|
760
|
-
// streamFrom degrades to its buffered fallback without a native stream (#3591, PR #3602
|
|
761
|
-
// review); the started line must report the bound that branch actually applies.
|
|
769
|
+
const { route, ids, start, elapsed, adapter, admission, promptAdmission, prepared } = this.prepareStream(request);
|
|
770
|
+
request = prepared;
|
|
762
771
|
const usesNativeStream = adapter.callStream !== undefined;
|
|
763
772
|
let chunkCount = 0;
|
|
764
773
|
// The moment the caller saw its first actual content, timed off the same `elapsed()` as every
|
|
@@ -770,7 +779,7 @@ export class Gateway {
|
|
|
770
779
|
let settled = false;
|
|
771
780
|
try {
|
|
772
781
|
this.logCallStarted(ids, route, true, request.reasoningEffort, usesNativeStream);
|
|
773
|
-
for await (const chunk of this.streamFrom(adapter, request, route, ids, admission)) {
|
|
782
|
+
for await (const chunk of this.streamFrom(adapter, request, route, ids, admission, promptAdmission)) {
|
|
774
783
|
chunkCount += 1;
|
|
775
784
|
firstTokenMs ??= firstNonEmptyDeltaMs(chunk, elapsed);
|
|
776
785
|
if (chunk.type === "done") {
|
|
@@ -806,6 +815,25 @@ export class Gateway {
|
|
|
806
815
|
yield this.enrichDone(terminalResponse, ids.requestId, start, route);
|
|
807
816
|
}
|
|
808
817
|
}
|
|
818
|
+
prepareStream(request) {
|
|
819
|
+
const route = this.routeForCall(request);
|
|
820
|
+
const prepared = this.prepareRequest(request, route.capability);
|
|
821
|
+
const ids = callIds(randomUUID(), prepared);
|
|
822
|
+
const start = this.clock.now();
|
|
823
|
+
const elapsed = logTimer();
|
|
824
|
+
const adapter = this.adapterFor(ids.requestId, route, ids.correlationId);
|
|
825
|
+
const admission = this.breakerFor(route.provider).assertAllowed(ids.correlationId);
|
|
826
|
+
return {
|
|
827
|
+
route,
|
|
828
|
+
prepared,
|
|
829
|
+
ids,
|
|
830
|
+
start,
|
|
831
|
+
elapsed,
|
|
832
|
+
adapter,
|
|
833
|
+
admission,
|
|
834
|
+
promptAdmission: this.promptAdmission(route, ids),
|
|
835
|
+
};
|
|
836
|
+
}
|
|
809
837
|
failStream(ids, route, chunkCount, durationMs, error) {
|
|
810
838
|
attachGatewayRequestId(error, ids.requestId);
|
|
811
839
|
this.logStreamFailed(ids, route, chunkCount, durationMs, error);
|
|
@@ -920,7 +948,7 @@ export class Gateway {
|
|
|
920
948
|
streaming: false,
|
|
921
949
|
}));
|
|
922
950
|
}
|
|
923
|
-
async *streamFrom(adapter, request, route, ids, initialAdmission) {
|
|
951
|
+
async *streamFrom(adapter, request, route, ids, initialAdmission, promptAdmission) {
|
|
924
952
|
const breaker = this.breakerFor(route.provider);
|
|
925
953
|
const maxRetries = initialAdmission.halfOpen ? 0 : route.provider.maxRetries;
|
|
926
954
|
let admission = initialAdmission;
|
|
@@ -928,7 +956,7 @@ export class Gateway {
|
|
|
928
956
|
const opened = await executeWithRetry(async (_attemptMs, remainingMs) => {
|
|
929
957
|
if (attempt++ > 0)
|
|
930
958
|
admission = breaker.assertAllowed(ids.correlationId);
|
|
931
|
-
return this.openStreamAttempt(adapter, request, route, ids, remainingMs, admission);
|
|
959
|
+
return this.openStreamAttempt(adapter, request, route, ids, remainingMs, admission, promptAdmission);
|
|
932
960
|
}, {
|
|
933
961
|
...providerRetryConfig(route.provider),
|
|
934
962
|
maxRetries,
|
|
@@ -944,13 +972,13 @@ export class Gateway {
|
|
|
944
972
|
await opened.iterator.return(undefined);
|
|
945
973
|
}
|
|
946
974
|
}
|
|
947
|
-
async openStreamAttempt(adapter, request, route, ids, remainingMs, admission) {
|
|
975
|
+
async openStreamAttempt(adapter, request, route, ids, remainingMs, admission, promptAdmission) {
|
|
948
976
|
const bounds = chatStreamBounds(route.provider);
|
|
949
977
|
const budgetMs = Math.min(bounds.budgetMs, remainingMs ?? bounds.budgetMs);
|
|
950
978
|
const iterator = this.reservedStreamAttempt(adapter, request, route, ids, {
|
|
951
979
|
budgetMs,
|
|
952
980
|
silenceMs: Math.min(bounds.silenceMs, budgetMs),
|
|
953
|
-
}, admission);
|
|
981
|
+
}, admission, promptAdmission);
|
|
954
982
|
try {
|
|
955
983
|
let first = await iterator.next();
|
|
956
984
|
while (!first.done && first.value.type === "delta" && first.value.token.length === 0) {
|
|
@@ -965,13 +993,18 @@ export class Gateway {
|
|
|
965
993
|
throw error;
|
|
966
994
|
}
|
|
967
995
|
}
|
|
968
|
-
async *reservedStreamAttempt(adapter, request, route, ids, bounds, admission) {
|
|
996
|
+
async *reservedStreamAttempt(adapter, request, route, ids, bounds, admission, promptAdmission) {
|
|
969
997
|
let reservation;
|
|
970
998
|
let admitted = false;
|
|
971
999
|
let usage;
|
|
972
1000
|
let received = false;
|
|
973
1001
|
let terminal;
|
|
974
1002
|
try {
|
|
1003
|
+
const attemptBudget = adapter.callStream === undefined
|
|
1004
|
+
? Math.min(bounds.budgetMs, effectiveBufferedAttemptMs(route.provider))
|
|
1005
|
+
: bounds.budgetMs;
|
|
1006
|
+
const remaining = await promptAdmission.admit(request, attemptBudget);
|
|
1007
|
+
bounds = { budgetMs: remaining, silenceMs: Math.min(bounds.silenceMs, remaining) };
|
|
975
1008
|
reservation = this.spendBudget?.reserve(route.capability, request, ids.correlationId);
|
|
976
1009
|
admitted = true;
|
|
977
1010
|
for await (const chunk of this.readProviderStream(adapter, request, route.provider, ids, bounds)) {
|
|
@@ -1051,12 +1084,20 @@ export class Gateway {
|
|
|
1051
1084
|
openedAt: null,
|
|
1052
1085
|
});
|
|
1053
1086
|
}
|
|
1054
|
-
async invoke(
|
|
1087
|
+
async invoke(attempt, provider, bounds) {
|
|
1088
|
+
const { breaker, adapter, correlationId } = attempt;
|
|
1089
|
+
const { capability } = attempt.route;
|
|
1090
|
+
const request = attempt.state.request;
|
|
1055
1091
|
const admission = breaker.assertAllowed(correlationId);
|
|
1056
1092
|
let reservation;
|
|
1057
1093
|
let admitted = false;
|
|
1058
1094
|
let usage;
|
|
1059
1095
|
try {
|
|
1096
|
+
const remaining = await attempt.promptAdmission.admit(request, bounds?.budgetMs ?? provider.timeoutMs);
|
|
1097
|
+
provider = { ...provider, timeoutMs: Math.min(provider.timeoutMs, remaining) };
|
|
1098
|
+
if (bounds !== undefined)
|
|
1099
|
+
bounds = { budgetMs: remaining, silenceMs: Math.min(bounds.silenceMs, remaining) };
|
|
1100
|
+
this.logAttemptRepair(attempt, "scheduled");
|
|
1060
1101
|
reservation = this.spendBudget?.reserve(capability, request, correlationId);
|
|
1061
1102
|
admitted = true;
|
|
1062
1103
|
const response = await readAnswer(adapter, request, provider, bounds);
|
|
@@ -1065,6 +1106,8 @@ export class Gateway {
|
|
|
1065
1106
|
return response;
|
|
1066
1107
|
}
|
|
1067
1108
|
catch (error) {
|
|
1109
|
+
if (error instanceof ContextOverflowError)
|
|
1110
|
+
this.logAttemptRepair(attempt, "denied");
|
|
1068
1111
|
usage = measuredCatalogFailureUsage(error, capability, correlationId);
|
|
1069
1112
|
// A client-initiated cancel is not a provider fault — skip the breaker.
|
|
1070
1113
|
recordProviderFailure(admission, error, admitted);
|
|
@@ -11,7 +11,30 @@ export interface ModelGatewayLogEvent {
|
|
|
11
11
|
readonly errorKind?: string | undefined;
|
|
12
12
|
readonly extra?: Readonly<Record<string, unknown>> | undefined;
|
|
13
13
|
}
|
|
14
|
+
export interface GatewayFailureEvidence {
|
|
15
|
+
readonly frames: readonly string[];
|
|
16
|
+
readonly causeChain: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
export declare const GATEWAY_FAILURE_EVIDENCE_FIELDS: {
|
|
19
|
+
readonly frames: {
|
|
20
|
+
readonly type: "string-array";
|
|
21
|
+
readonly dataClass: "opaque-id";
|
|
22
|
+
readonly required: false;
|
|
23
|
+
readonly maxLength: 512;
|
|
24
|
+
readonly maxItems: 8;
|
|
25
|
+
};
|
|
26
|
+
readonly causeChain: {
|
|
27
|
+
readonly type: "string-array";
|
|
28
|
+
readonly dataClass: "error-kind";
|
|
29
|
+
readonly required: false;
|
|
30
|
+
readonly maxLength: 128;
|
|
31
|
+
readonly maxItems: 5;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare function gatewayFailureEvidence(log: ModelGatewayLogSink, error: unknown): GatewayFailureEvidence;
|
|
14
35
|
export interface ModelGatewayLogSink {
|
|
36
|
+
/** The composition root supplies the existing body-free stack/cause reducers. */
|
|
37
|
+
readonly errorEvidence?: ((error: unknown) => GatewayFailureEvidence) | undefined;
|
|
15
38
|
readonly write: (event: ModelGatewayLogEvent) => void;
|
|
16
39
|
readonly correlationId?: string | undefined;
|
|
17
40
|
readonly enabled?: ((level: ModelGatewayLogLevel) => boolean) | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../src/observability.ts"],"names":[],"mappings":"AAwBA,OAAO,EAML,KAAK,oBAAoB,EAC1B,MAAM,qDAAqD,CAAC;AAG7D,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAIvE,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;AAEvE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAClD,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;IAC3C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;CAChE;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACtD,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAgB5C,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,oBAAoB,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;CAC3E;AAKD,wBAAgB,eAAe,CAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAE/F;AAKD,eAAO,MAAM,uBAAuB,EAAE,mBAQpC,CAAC;AASH,wBAAgB,cAAc,CAAC,IAAI,EAAE,mBAAmB,GAAG,SAAS,GAAG,mBAAmB,CAEzF;
|
|
1
|
+
{"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../src/observability.ts"],"names":[],"mappings":"AAwBA,OAAO,EAML,KAAK,oBAAoB,EAC1B,MAAM,qDAAqD,CAAC;AAG7D,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAIvE,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;AAEvE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAClD,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;IAC3C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;CAChE;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED,eAAO,MAAM,+BAA+B;aAC1C,MAAM;iBACJ,IAAI,EAAE,cAAc;iBACpB,SAAS,EAAE,WAAW;iBACtB,QAAQ;iBACR,SAAS,EAAE,GAAG;iBACd,QAAQ,EAAE,CAAC;;aAEb,UAAU;iBACR,IAAI,EAAE,cAAc;iBACpB,SAAS,EAAE,YAAY;iBACvB,QAAQ;iBACR,SAAS,EAAE,GAAG;iBACd,QAAQ,EAAE,CAAC;;CAEL,CAAC;AAEX,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,mBAAmB,EACxB,KAAK,EAAE,OAAO,GACb,sBAAsB,CAOxB;AAED,MAAM,WAAW,mBAAmB;IAClC,iFAAiF;IACjF,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,sBAAsB,CAAC,GAAG,SAAS,CAAC;IAClF,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACtD,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAgB5C,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,oBAAoB,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;CAC3E;AAKD,wBAAgB,eAAe,CAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAE/F;AAKD,eAAO,MAAM,uBAAuB,EAAE,mBAQpC,CAAC;AASH,wBAAgB,cAAc,CAAC,IAAI,EAAE,mBAAmB,GAAG,SAAS,GAAG,mBAAmB,CAEzF;AA2GD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7C;AAiBD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,mBAAmB,EACzB,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,mBAAmB,CAcrB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,GAAG,SAAS,CAE9E;AAUD,wBAAgB,QAAQ,IAAI,MAAM,MAAM,CAGvC;AA8BD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKnD;AAoBD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAIzE;AAOD,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD;AAKD,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAUjF"}
|
|
@@ -23,6 +23,31 @@
|
|
|
23
23
|
// labels only.
|
|
24
24
|
import { activityLogEvent, classifyErrorKind, defineActivityLogOperation, recordActivityLogLoss, withActivityLogCorrelation, } from "@oscharko-dev/keiko-contracts/runtime/observability";
|
|
25
25
|
import { sha256Hex } from "@oscharko-dev/keiko-security/hashing";
|
|
26
|
+
export const GATEWAY_FAILURE_EVIDENCE_FIELDS = {
|
|
27
|
+
frames: {
|
|
28
|
+
type: "string-array",
|
|
29
|
+
dataClass: "opaque-id",
|
|
30
|
+
required: false,
|
|
31
|
+
maxLength: 512,
|
|
32
|
+
maxItems: 8,
|
|
33
|
+
},
|
|
34
|
+
causeChain: {
|
|
35
|
+
type: "string-array",
|
|
36
|
+
dataClass: "error-kind",
|
|
37
|
+
required: false,
|
|
38
|
+
maxLength: 128,
|
|
39
|
+
maxItems: 5,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export function gatewayFailureEvidence(log, error) {
|
|
43
|
+
try {
|
|
44
|
+
return log.errorEvidence?.(error) ?? { frames: [], causeChain: [] };
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
recordActivityLogLoss("port-sink-failed");
|
|
48
|
+
return { frames: [], causeChain: [] };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
26
51
|
// True when the sink might accept an event at this level. A sink without a predicate accepts
|
|
27
52
|
// everything (fail OPEN, deliberately: a missing hint must never silence instrumentation — the
|
|
28
53
|
// whole point of the log is that it is on by default).
|
|
@@ -102,6 +127,7 @@ function isolateLogSink(sink) {
|
|
|
102
127
|
return true;
|
|
103
128
|
}
|
|
104
129
|
},
|
|
130
|
+
errorEvidence: (error) => gatewayFailureEvidence(sink, error),
|
|
105
131
|
...(sink.correlationId === undefined ? {} : { correlationId: sink.correlationId }),
|
|
106
132
|
};
|
|
107
133
|
}
|
|
@@ -161,6 +187,7 @@ export function withCorrelationId(sink, correlationId) {
|
|
|
161
187
|
return logLevelEnabled(sink, level);
|
|
162
188
|
},
|
|
163
189
|
correlationId,
|
|
190
|
+
errorEvidence: (error) => gatewayFailureEvidence(sink, error),
|
|
164
191
|
};
|
|
165
192
|
}
|
|
166
193
|
export function logCorrelationId(sink) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GatewayCallRequest } from "./gateway.js";
|
|
2
|
+
import type { ModelCapability } from "./types.js";
|
|
3
|
+
import { type ModelGatewayLogSink } from "./observability.js";
|
|
4
|
+
import { type GatewayPromptTokenInput } from "./prompt-token-accounting.js";
|
|
5
|
+
import type { ProviderTokenCount } from "./provider-token-counter.js";
|
|
6
|
+
export declare function admitGatewayPrompt(request: GatewayCallRequest & GatewayPromptTokenInput, capability: ModelCapability, log: ModelGatewayLogSink, correlationId: string, measured?: ProviderTokenCount, retainedTokens?: number): GatewayCallRequest;
|
|
7
|
+
//# sourceMappingURL=prompt-admission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-admission.d.ts","sourceRoot":"","sources":["../src/prompt-admission.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAiEtE,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,kBAAkB,GAAG,uBAAuB,EACrD,UAAU,EAAE,eAAe,EAC3B,GAAG,EAAE,mBAAmB,EACxB,aAAa,EAAE,MAAM,EACrB,QAAQ,GAAE,kBAAqC,EAC/C,cAAc,CAAC,EAAE,MAAM,GACtB,kBAAkB,CAoCpB"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { deriveContextProfileFromCapability, } from "@oscharko-dev/keiko-contracts/runtime/context-engineering";
|
|
2
|
+
import { activityLogEvent, defineActivityLogOperation, } from "@oscharko-dev/keiko-contracts/runtime/observability";
|
|
3
|
+
import { ContextOverflowError } from "@oscharko-dev/keiko-security/errors/gateway";
|
|
4
|
+
import { GATEWAY_FAILURE_EVIDENCE_FIELDS, gatewayFailureEvidence, } from "./observability.js";
|
|
5
|
+
import { countGatewayPromptTokens, countGatewayResponseFormatTokens, } from "./prompt-token-accounting.js";
|
|
6
|
+
const PROMPT_ADMISSION = defineActivityLogOperation({
|
|
7
|
+
contractKind: "activity-log-operation",
|
|
8
|
+
schemaVersion: 1,
|
|
9
|
+
op: "gateway.prompt.admission",
|
|
10
|
+
category: "gateway",
|
|
11
|
+
owner: "keiko-model-gateway",
|
|
12
|
+
emitter: "prompt-admission.admitGatewayPrompt",
|
|
13
|
+
fields: {
|
|
14
|
+
...GATEWAY_FAILURE_EVIDENCE_FIELDS,
|
|
15
|
+
state: {
|
|
16
|
+
type: "string",
|
|
17
|
+
dataClass: "closed-enum",
|
|
18
|
+
required: true,
|
|
19
|
+
values: ["admitted", "overflow"],
|
|
20
|
+
},
|
|
21
|
+
counterSource: {
|
|
22
|
+
type: "string",
|
|
23
|
+
dataClass: "closed-enum",
|
|
24
|
+
required: true,
|
|
25
|
+
values: ["calibrated", "fallback-estimated", "gateway-reported", "retained-measurement"],
|
|
26
|
+
},
|
|
27
|
+
counterStatus: {
|
|
28
|
+
type: "string",
|
|
29
|
+
dataClass: "closed-enum",
|
|
30
|
+
required: true,
|
|
31
|
+
values: ["disabled", "available", "unavailable", "invalid"],
|
|
32
|
+
},
|
|
33
|
+
tokenizer: {
|
|
34
|
+
type: "string",
|
|
35
|
+
dataClass: "closed-enum",
|
|
36
|
+
required: true,
|
|
37
|
+
values: ["openai", "huggingface", "other", "unknown"],
|
|
38
|
+
},
|
|
39
|
+
promptTokens: { type: "integer", dataClass: "count", required: true },
|
|
40
|
+
imageCount: { type: "integer", dataClass: "count", required: true },
|
|
41
|
+
imageAccounting: {
|
|
42
|
+
type: "string",
|
|
43
|
+
dataClass: "closed-enum",
|
|
44
|
+
required: true,
|
|
45
|
+
values: ["none", "fallback-estimated", "provider-measured", "retained-measurement"],
|
|
46
|
+
},
|
|
47
|
+
imageReserveTokens: { type: "integer", dataClass: "count", required: true },
|
|
48
|
+
localPromptTokens: { type: "integer", dataClass: "count", required: true },
|
|
49
|
+
fallbackPromptTokens: { type: "integer", dataClass: "count", required: true },
|
|
50
|
+
reportedPromptTokens: { type: "integer", dataClass: "count", required: false },
|
|
51
|
+
providerPromptTokens: { type: "integer", dataClass: "count", required: false },
|
|
52
|
+
retainedPromptTokens: { type: "integer", dataClass: "count", required: false },
|
|
53
|
+
inputBudget: { type: "integer", dataClass: "count", required: true },
|
|
54
|
+
outputBudget: { type: "integer", dataClass: "count", required: true },
|
|
55
|
+
contextWindow: { type: "integer", dataClass: "count", required: true },
|
|
56
|
+
completeness: { type: "string", dataClass: "completeness-state", required: true },
|
|
57
|
+
loss: { type: "string", dataClass: "loss-state", required: true },
|
|
58
|
+
},
|
|
59
|
+
causal: "correlation",
|
|
60
|
+
lifecycle: "state",
|
|
61
|
+
analyzerProjection: "timeline",
|
|
62
|
+
failureClasses: ["gateway-context-admission"],
|
|
63
|
+
proofIds: ["gateway.prompt.admission.bounds"],
|
|
64
|
+
releaseImpact: "patch",
|
|
65
|
+
});
|
|
66
|
+
const DISABLED_COUNTER = { status: "disabled" };
|
|
67
|
+
export function admitGatewayPrompt(request, capability, log, correlationId, measured = DISABLED_COUNTER, retainedTokens) {
|
|
68
|
+
const profile = deriveContextProfileFromCapability(capability);
|
|
69
|
+
const outputBudget = outputAllocation(request.maxOutputTokens, profile.reservedOutputTokens);
|
|
70
|
+
const inputBudget = Math.max(0, profile.maxInputTokens - outputBudget - profile.safetyMarginTokens);
|
|
71
|
+
const evidence = promptTokenEvidence(request, profile, measured, retainedTokens);
|
|
72
|
+
const promptTokens = Math.max(evidence.localPromptTokens, evidence.providerPromptTokens ?? 0, evidence.retainedPromptTokens ?? 0);
|
|
73
|
+
const refusal = promptRefusal(promptTokens, inputBudget, outputBudget, capability);
|
|
74
|
+
log.write(activityLogEvent(PROMPT_ADMISSION, { correlationId, ...(refusal === undefined ? {} : { errorKind: "invalid-request" }) }, {
|
|
75
|
+
...(refusal === undefined ? {} : gatewayFailureEvidence(log, refusal)),
|
|
76
|
+
state: refusal === undefined ? "admitted" : "overflow",
|
|
77
|
+
counterSource: selectedCounterSource(evidence, profile.tokenAccounting?.source),
|
|
78
|
+
counterStatus: measured.status,
|
|
79
|
+
tokenizer: measured.tokenizer ?? "unknown",
|
|
80
|
+
...evidence,
|
|
81
|
+
promptTokens,
|
|
82
|
+
inputBudget,
|
|
83
|
+
outputBudget,
|
|
84
|
+
contextWindow: profile.maxInputTokens,
|
|
85
|
+
completeness: "complete",
|
|
86
|
+
loss: "none",
|
|
87
|
+
}));
|
|
88
|
+
if (refusal !== undefined)
|
|
89
|
+
throw refusal;
|
|
90
|
+
return request;
|
|
91
|
+
}
|
|
92
|
+
function promptTokenEvidence(request, profile, measured, retainedTokens) {
|
|
93
|
+
const imageCount = request.messages.reduce((count, message) => count + (message.contentParts?.filter((part) => part.type === "image_url").length ?? 0), 0);
|
|
94
|
+
const imageAccounting = imageAccountingSource(imageCount, measured.tokens, retainedTokens);
|
|
95
|
+
const options = { contextWindow: profile.maxInputTokens };
|
|
96
|
+
const fallbackPromptTokens = countGatewayPromptTokens(request, profile.tokenAccounting, options);
|
|
97
|
+
const textFloor = imageCount === 0
|
|
98
|
+
? fallbackPromptTokens
|
|
99
|
+
: countGatewayPromptTokens(request, profile.tokenAccounting, {
|
|
100
|
+
...options,
|
|
101
|
+
imageTokensMeasured: true,
|
|
102
|
+
});
|
|
103
|
+
const localPromptTokens = imageAccounting === "fallback-estimated" ? fallbackPromptTokens : textFloor;
|
|
104
|
+
const providerPromptTokens = completeMeasuredTokens(request, measured.tokens, profile.tokenAccounting);
|
|
105
|
+
const retainedPromptTokens = completeMeasuredTokens(request, retainedTokens, profile.tokenAccounting);
|
|
106
|
+
return {
|
|
107
|
+
imageCount,
|
|
108
|
+
imageAccounting,
|
|
109
|
+
imageReserveTokens: localPromptTokens - textFloor,
|
|
110
|
+
localPromptTokens,
|
|
111
|
+
fallbackPromptTokens,
|
|
112
|
+
...(measured.tokens === undefined ? {} : { reportedPromptTokens: measured.tokens }),
|
|
113
|
+
...(providerPromptTokens === undefined ? {} : { providerPromptTokens }),
|
|
114
|
+
...(retainedPromptTokens === undefined ? {} : { retainedPromptTokens }),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function imageAccountingSource(imageCount, current, retained) {
|
|
118
|
+
if (imageCount === 0)
|
|
119
|
+
return "none";
|
|
120
|
+
if ((current ?? 0) > 0)
|
|
121
|
+
return "provider-measured";
|
|
122
|
+
return (retained ?? 0) > 0 ? "retained-measurement" : "fallback-estimated";
|
|
123
|
+
}
|
|
124
|
+
function promptRefusal(promptTokens, inputBudget, outputBudget, capability) {
|
|
125
|
+
if (promptTokens <= inputBudget && !outputExceedsCapability(outputBudget, capability))
|
|
126
|
+
return undefined;
|
|
127
|
+
return new ContextOverflowError("complete provider prompt and output allocation exceed the model context budget");
|
|
128
|
+
}
|
|
129
|
+
function completeMeasuredTokens(request, tokens, accounting) {
|
|
130
|
+
return tokens === undefined
|
|
131
|
+
? undefined
|
|
132
|
+
: tokens + countGatewayResponseFormatTokens(request, accounting);
|
|
133
|
+
}
|
|
134
|
+
function outputExceedsCapability(output, capability) {
|
|
135
|
+
return (!Number.isSafeInteger(output) ||
|
|
136
|
+
output <= 0 ||
|
|
137
|
+
(capability.maxOutputTokens > 0 && output > capability.maxOutputTokens));
|
|
138
|
+
}
|
|
139
|
+
function outputAllocation(requested, fallback) {
|
|
140
|
+
const output = requested ?? fallback;
|
|
141
|
+
return Number.isSafeInteger(output) && output > 0 ? output : 0;
|
|
142
|
+
}
|
|
143
|
+
function selectedCounterSource(evidence, source) {
|
|
144
|
+
const measured = evidence.providerPromptTokens;
|
|
145
|
+
const retained = evidence.retainedPromptTokens ?? 0;
|
|
146
|
+
if (retained > Math.max(evidence.localPromptTokens, measured ?? 0))
|
|
147
|
+
return "retained-measurement";
|
|
148
|
+
return measured !== undefined && measured >= evidence.localPromptTokens
|
|
149
|
+
? "gateway-reported"
|
|
150
|
+
: (source ?? "fallback-estimated");
|
|
151
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ContextTokenAccounting } from "@oscharko-dev/keiko-contracts/runtime/context-engineering";
|
|
2
|
+
import type { ChatMessage, ToolDefinition, ResponseFormat } from "./types.js";
|
|
2
3
|
export type { ModelTokenAccounting } from "./types.js";
|
|
3
4
|
export interface GatewayPromptTokenInput {
|
|
4
5
|
readonly messages: readonly ChatMessage[];
|
|
5
6
|
readonly tools?: readonly ToolDefinition[] | undefined;
|
|
7
|
+
readonly responseFormat?: ResponseFormat | undefined;
|
|
6
8
|
}
|
|
7
9
|
type ProviderMessageContentParts = readonly ({
|
|
8
10
|
readonly type: "text";
|
|
@@ -28,7 +30,13 @@ export interface OpenAiCompatiblePromptMessage {
|
|
|
28
30
|
}
|
|
29
31
|
export declare function openAiCompatiblePromptMessage(message: ChatMessage): OpenAiCompatiblePromptMessage;
|
|
30
32
|
export declare function openAiCompatiblePromptTools(tools: readonly ToolDefinition[]): readonly Record<string, unknown>[];
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
export interface GatewayPromptTokenOptions {
|
|
34
|
+
readonly contextWindow?: number | undefined;
|
|
35
|
+
/** A positive provider count already includes the image contribution. Keep the local text floor. */
|
|
36
|
+
readonly imageTokensMeasured?: boolean | undefined;
|
|
37
|
+
}
|
|
38
|
+
/** The LiteLLM counter receives messages/tools, but not the generation response schema. */
|
|
39
|
+
export declare function countGatewayResponseFormatTokens(input: GatewayPromptTokenInput, accounting?: ContextTokenAccounting): number;
|
|
40
|
+
/** Counts the complete provider projection; image bytes are never treated as text tokens. */
|
|
41
|
+
export declare function countGatewayPromptTokens(input: GatewayPromptTokenInput, accounting?: ContextTokenAccounting, options?: GatewayPromptTokenOptions): number;
|
|
34
42
|
//# sourceMappingURL=prompt-token-accounting.d.ts.map
|
package/node_modules/@oscharko-dev/keiko-model-gateway/dist/prompt-token-accounting.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-token-accounting.d.ts","sourceRoot":"","sources":["../src/prompt-token-accounting.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompt-token-accounting.d.ts","sourceRoot":"","sources":["../src/prompt-token-accounting.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,2DAA2D,CAAC;AAEnE,OAAO,KAAK,EACV,WAAW,EAEX,cAAc,EACd,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,cAAc,EAAE,GAAG,SAAS,CAAC;IACvD,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;CACtD;AAED,KAAK,2BAA2B,GAAG,SAAS,CACxC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAC/E,EAAE,CAAC;AAEJ,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,2BAA2B,GAAG,IAAI,CAAC;IAC9D,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAChB,SAAS;QACP,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;QAC1B,QAAQ,CAAC,QAAQ,EAAE;YAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;SAAE,CAAC;KAC1E,EAAE,GACH,SAAS,CAAC;CACf;AAqBD,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,WAAW,GAAG,6BAA6B,CAejG;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,SAAS,cAAc,EAAE,GAC/B,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CASpC;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,oGAAoG;IACpG,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACpD;AAyCD,2FAA2F;AAC3F,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,uBAAuB,EAC9B,UAAU,CAAC,EAAE,sBAAsB,GAClC,MAAM,CAIR;AAED,6FAA6F;AAC7F,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,uBAAuB,EAC9B,UAAU,CAAC,EAAE,sBAAsB,EACnC,OAAO,GAAE,yBAA8B,GACtC,MAAM,CAcR"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { countContextTokensForSegments } from "@oscharko-dev/keiko-contracts/runtime/context-engineering";
|
|
1
|
+
import { countContextTokens, countContextTokensForSegments, } from "@oscharko-dev/keiko-contracts/runtime/context-engineering";
|
|
2
2
|
function providerContentParts(parts) {
|
|
3
3
|
return parts.map((part) => part.type === "text"
|
|
4
4
|
? { type: "text", text: part.text }
|
|
@@ -37,12 +37,45 @@ export function openAiCompatiblePromptTools(tools) {
|
|
|
37
37
|
},
|
|
38
38
|
}));
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
// A context-scaled fallback estimate, not a model-independent vision bound. Encoded byte length
|
|
41
|
+
// does not describe provider patches/tiles. Text calibration must not scale the image allowance.
|
|
42
|
+
function fallbackImageTokens(options) {
|
|
43
|
+
if (options.imageTokensMeasured === true)
|
|
44
|
+
return 0;
|
|
45
|
+
const window = options.contextWindow;
|
|
46
|
+
return window !== undefined && Number.isSafeInteger(window) && window > 0
|
|
47
|
+
? Math.min(8_192, Math.max(1, Math.floor(window / 4)))
|
|
48
|
+
: 8_192;
|
|
49
|
+
}
|
|
50
|
+
function countMessageTokens(message, accounting, options) {
|
|
51
|
+
const projected = openAiCompatiblePromptMessage(message);
|
|
52
|
+
const parts = typeof projected.content === "string" || projected.content === null
|
|
53
|
+
? undefined
|
|
54
|
+
: projected.content;
|
|
55
|
+
const imageCount = parts?.filter((part) => part.type === "image_url").length ?? 0;
|
|
56
|
+
const content = parts?.map((part) => (part.type === "text" ? part : { type: "image_url" })) ??
|
|
57
|
+
projected.content;
|
|
58
|
+
const text = parts
|
|
59
|
+
?.filter((part) => part.type === "text")
|
|
60
|
+
.map((part) => part.text)
|
|
61
|
+
.join("\n") ?? (typeof content === "string" ? content : "");
|
|
62
|
+
// Preserve the dense-text floor when the JSON projection escapes literal newlines.
|
|
63
|
+
return (Math.max(countContextTokens(text, accounting), countContextTokens(JSON.stringify({ ...projected, content }), accounting)) +
|
|
64
|
+
imageCount * fallbackImageTokens(options));
|
|
65
|
+
}
|
|
66
|
+
/** The LiteLLM counter receives messages/tools, but not the generation response schema. */
|
|
67
|
+
export function countGatewayResponseFormatTokens(input, accounting) {
|
|
68
|
+
return input.responseFormat?.type === "json_schema"
|
|
69
|
+
? countContextTokens(JSON.stringify(input.responseFormat), accounting)
|
|
70
|
+
: 0;
|
|
71
|
+
}
|
|
72
|
+
/** Counts the complete provider projection; image bytes are never treated as text tokens. */
|
|
73
|
+
export function countGatewayPromptTokens(input, accounting, options = {}) {
|
|
74
|
+
const messageTokens = input.messages.reduce((sum, message) => sum + countMessageTokens(message, accounting, options), 0);
|
|
75
|
+
const segments = input.tools !== undefined && input.tools.length > 0
|
|
76
|
+
? [JSON.stringify(openAiCompatiblePromptTools(input.tools))]
|
|
77
|
+
: [];
|
|
78
|
+
return (messageTokens +
|
|
79
|
+
countContextTokensForSegments(segments, accounting) +
|
|
80
|
+
countGatewayResponseFormatTokens(input, accounting));
|
|
48
81
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ModelGatewayLogSink } from "./observability.js";
|
|
2
|
+
import { type GatewayPromptTokenInput } from "./prompt-token-accounting.js";
|
|
3
|
+
import type { GatewayCallRequest } from "./gateway.js";
|
|
4
|
+
import type { ModelProviderConfig } from "./types.js";
|
|
5
|
+
export interface ProviderTokenCount {
|
|
6
|
+
readonly status: "disabled" | "available" | "unavailable" | "invalid";
|
|
7
|
+
readonly tokens?: number | undefined;
|
|
8
|
+
readonly tokenizer?: "openai" | "huggingface" | "other" | "unknown" | undefined;
|
|
9
|
+
}
|
|
10
|
+
/** Counting uses the same configured host, credentials, cancellation and HTTP egress policy as
|
|
11
|
+
* generation. LiteLLM can itself fall back to a tokenizer; this is reported, never called exact. */
|
|
12
|
+
export declare function countProviderPromptTokens(request: GatewayCallRequest & GatewayPromptTokenInput, provider: ModelProviderConfig, log: ModelGatewayLogSink, fetchImpl?: typeof fetch): Promise<ProviderTokenCount>;
|
|
13
|
+
//# sourceMappingURL=provider-token-counter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-token-counter.d.ts","sourceRoot":"","sources":["../src/provider-token-counter.ts"],"names":[],"mappings":"AAKA,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CAAC;IACtE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;CACjF;AAuBD;oGACoG;AACpG,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,kBAAkB,GAAG,uBAAuB,EACrD,QAAQ,EAAE,mBAAmB,EAC7B,GAAG,EAAE,mBAAmB,EACxB,SAAS,CAAC,EAAE,OAAO,KAAK,GACvB,OAAO,CAAC,kBAAkB,CAAC,CA0B7B"}
|