@oscharko-dev/keiko-model-gateway 0.2.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/dist/.tsbuildinfo +1 -0
- package/dist/capabilities.d.ts +26 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.data.d.ts +3 -0
- package/dist/capabilities.data.d.ts.map +1 -0
- package/dist/capabilities.data.js +5 -0
- package/dist/capabilities.js +169 -0
- package/dist/config.d.ts +34 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +733 -0
- package/dist/embedding.d.ts +38 -0
- package/dist/embedding.d.ts.map +1 -0
- package/dist/embedding.js +118 -0
- package/dist/gateway.d.ts +23 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +144 -0
- package/dist/http.d.ts +24 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +666 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/model-selection.d.ts +22 -0
- package/dist/model-selection.d.ts.map +1 -0
- package/dist/model-selection.js +59 -0
- package/dist/normalize.d.ts +9 -0
- package/dist/normalize.d.ts.map +1 -0
- package/dist/normalize.js +114 -0
- package/dist/openai-adapter.d.ts +22 -0
- package/dist/openai-adapter.d.ts.map +1 -0
- package/dist/openai-adapter.js +382 -0
- package/dist/openai-embedding-adapter.d.ts +46 -0
- package/dist/openai-embedding-adapter.d.ts.map +1 -0
- package/dist/openai-embedding-adapter.js +271 -0
- package/dist/promptEnhancer/__tests__/_support.d.ts +15 -0
- package/dist/promptEnhancer/__tests__/_support.d.ts.map +1 -0
- package/dist/promptEnhancer/__tests__/_support.js +28 -0
- package/dist/promptEnhancer/__tests__/fixtures.d.ts +8 -0
- package/dist/promptEnhancer/__tests__/fixtures.d.ts.map +1 -0
- package/dist/promptEnhancer/__tests__/fixtures.js +58 -0
- package/dist/promptEnhancer/__tests__/grounding-fixtures.d.ts +11 -0
- package/dist/promptEnhancer/__tests__/grounding-fixtures.d.ts.map +1 -0
- package/dist/promptEnhancer/__tests__/grounding-fixtures.js +84 -0
- package/dist/promptEnhancer/candidates.d.ts +32 -0
- package/dist/promptEnhancer/candidates.d.ts.map +1 -0
- package/dist/promptEnhancer/candidates.js +109 -0
- package/dist/promptEnhancer/critic.d.ts +22 -0
- package/dist/promptEnhancer/critic.d.ts.map +1 -0
- package/dist/promptEnhancer/critic.js +237 -0
- package/dist/promptEnhancer/generator.d.ts +15 -0
- package/dist/promptEnhancer/generator.d.ts.map +1 -0
- package/dist/promptEnhancer/generator.js +424 -0
- package/dist/promptEnhancer/index.d.ts +16 -0
- package/dist/promptEnhancer/index.d.ts.map +1 -0
- package/dist/promptEnhancer/index.js +15 -0
- package/dist/promptEnhancer/optimize.d.ts +27 -0
- package/dist/promptEnhancer/optimize.d.ts.map +1 -0
- package/dist/promptEnhancer/optimize.js +203 -0
- package/dist/promptEnhancer/planner.d.ts +36 -0
- package/dist/promptEnhancer/planner.d.ts.map +1 -0
- package/dist/promptEnhancer/planner.js +55 -0
- package/dist/promptEnhancer/profiles.d.ts +20 -0
- package/dist/promptEnhancer/profiles.d.ts.map +1 -0
- package/dist/promptEnhancer/profiles.js +126 -0
- package/dist/promptEnhancer/rendering.d.ts +15 -0
- package/dist/promptEnhancer/rendering.d.ts.map +1 -0
- package/dist/promptEnhancer/rendering.js +72 -0
- package/dist/promptEnhancer/validate.d.ts +31 -0
- package/dist/promptEnhancer/validate.d.ts.map +1 -0
- package/dist/promptEnhancer/validate.js +144 -0
- package/dist/qualityIntelligence/budget.d.ts +10 -0
- package/dist/qualityIntelligence/budget.d.ts.map +1 -0
- package/dist/qualityIntelligence/budget.js +38 -0
- package/dist/qualityIntelligence/cancellation.d.ts +7 -0
- package/dist/qualityIntelligence/cancellation.d.ts.map +1 -0
- package/dist/qualityIntelligence/cancellation.js +58 -0
- package/dist/qualityIntelligence/capabilityGate.d.ts +13 -0
- package/dist/qualityIntelligence/capabilityGate.d.ts.map +1 -0
- package/dist/qualityIntelligence/capabilityGate.js +51 -0
- package/dist/qualityIntelligence/capabilityMapping.d.ts +4 -0
- package/dist/qualityIntelligence/capabilityMapping.d.ts.map +1 -0
- package/dist/qualityIntelligence/capabilityMapping.js +21 -0
- package/dist/qualityIntelligence/circuitBreaker.d.ts +26 -0
- package/dist/qualityIntelligence/circuitBreaker.d.ts.map +1 -0
- package/dist/qualityIntelligence/circuitBreaker.js +78 -0
- package/dist/qualityIntelligence/dispatcher.d.ts +38 -0
- package/dist/qualityIntelligence/dispatcher.d.ts.map +1 -0
- package/dist/qualityIntelligence/dispatcher.js +116 -0
- package/dist/qualityIntelligence/index.d.ts +20 -0
- package/dist/qualityIntelligence/index.d.ts.map +1 -0
- package/dist/qualityIntelligence/index.js +15 -0
- package/dist/qualityIntelligence/promptSegmentation.d.ts +13 -0
- package/dist/qualityIntelligence/promptSegmentation.d.ts.map +1 -0
- package/dist/qualityIntelligence/promptSegmentation.js +70 -0
- package/dist/qualityIntelligence/replayCache.d.ts +11 -0
- package/dist/qualityIntelligence/replayCache.d.ts.map +1 -0
- package/dist/qualityIntelligence/replayCache.js +72 -0
- package/dist/qualityIntelligence/routing.d.ts +11 -0
- package/dist/qualityIntelligence/routing.d.ts.map +1 -0
- package/dist/qualityIntelligence/routing.js +25 -0
- package/dist/qualityIntelligence/safeError.d.ts +38 -0
- package/dist/qualityIntelligence/safeError.d.ts.map +1 -0
- package/dist/qualityIntelligence/safeError.js +63 -0
- package/dist/qualityIntelligence/taskProfiles.d.ts +15 -0
- package/dist/qualityIntelligence/taskProfiles.d.ts.map +1 -0
- package/dist/qualityIntelligence/taskProfiles.js +101 -0
- package/dist/resilience.d.ts +26 -0
- package/dist/resilience.d.ts.map +1 -0
- package/dist/resilience.js +182 -0
- package/dist/types.d.ts +59 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/package.json +47 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// Resilience primitives: a real-time Clock, a bounded exponential-backoff retry
|
|
2
|
+
// loop, and a per-(model,endpoint) circuit breaker. All time-dependent behaviour
|
|
3
|
+
// flows through the injectable Clock so tests are deterministic and instant.
|
|
4
|
+
import { CancelledError, CircuitOpenError, GatewayError, RateLimitError, } from "@oscharko-dev/keiko-security/errors/gateway";
|
|
5
|
+
const MAX_BACKOFF_MS = 30_000;
|
|
6
|
+
export const systemClock = {
|
|
7
|
+
now: () => Date.now(),
|
|
8
|
+
sleep: (ms, signal) => {
|
|
9
|
+
if (signal?.aborted === true) {
|
|
10
|
+
return Promise.reject(new DOMException("cancelled", "AbortError"));
|
|
11
|
+
}
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const timeout = setTimeout(() => {
|
|
14
|
+
signal?.removeEventListener("abort", onAbort);
|
|
15
|
+
resolve();
|
|
16
|
+
}, ms);
|
|
17
|
+
function onAbort() {
|
|
18
|
+
clearTimeout(timeout);
|
|
19
|
+
reject(new DOMException("cancelled", "AbortError"));
|
|
20
|
+
}
|
|
21
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
function backoffDelayMs(attempt, base) {
|
|
26
|
+
return Math.min(base * 2 ** (attempt - 1), MAX_BACKOFF_MS);
|
|
27
|
+
}
|
|
28
|
+
// A RateLimitError with an explicit retryAfterMs is honoured; otherwise the error's
|
|
29
|
+
// own `retryable` flag decides. Non-GatewayErrors are never retried.
|
|
30
|
+
function retryDelayMs(error, attempt, base) {
|
|
31
|
+
if (!(error instanceof GatewayError) || !error.retryable) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
if (error instanceof RateLimitError && error.retryAfterMs !== null && error.retryAfterMs > 0) {
|
|
35
|
+
return Math.min(error.retryAfterMs, MAX_BACKOFF_MS);
|
|
36
|
+
}
|
|
37
|
+
return backoffDelayMs(attempt, base);
|
|
38
|
+
}
|
|
39
|
+
function assertNotAborted(signal) {
|
|
40
|
+
if (signal?.aborted === true) {
|
|
41
|
+
throw new CancelledError("request cancelled during retry");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function remainingBudgetMs(start, timeoutMs, clock) {
|
|
45
|
+
if (timeoutMs === undefined) {
|
|
46
|
+
return Number.POSITIVE_INFINITY;
|
|
47
|
+
}
|
|
48
|
+
return Math.max(0, timeoutMs - (clock.now() - start));
|
|
49
|
+
}
|
|
50
|
+
function asError(error) {
|
|
51
|
+
if (error instanceof Error) {
|
|
52
|
+
return error;
|
|
53
|
+
}
|
|
54
|
+
return new Error(String(error));
|
|
55
|
+
}
|
|
56
|
+
async function sleepWithCancellation(clock, delayMs, signal) {
|
|
57
|
+
assertNotAborted(signal);
|
|
58
|
+
try {
|
|
59
|
+
await clock.sleep(delayMs, signal);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
if (signal?.aborted === true) {
|
|
63
|
+
throw new CancelledError("request cancelled during retry backoff");
|
|
64
|
+
}
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
assertNotAborted(signal);
|
|
68
|
+
}
|
|
69
|
+
export async function executeWithRetry(operation, config, clock, signal) {
|
|
70
|
+
let lastError;
|
|
71
|
+
const start = clock.now();
|
|
72
|
+
for (let attempt = 1; attempt <= config.maxRetries + 1; attempt += 1) {
|
|
73
|
+
assertNotAborted(signal);
|
|
74
|
+
const attemptBudget = remainingBudgetMs(start, config.timeoutMs, clock);
|
|
75
|
+
if (attemptBudget <= 0) {
|
|
76
|
+
if (lastError) {
|
|
77
|
+
throw lastError;
|
|
78
|
+
}
|
|
79
|
+
throw new CancelledError("request timeout budget exhausted before provider call");
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
return await operation(Number.isFinite(attemptBudget) ? Math.max(1, Math.floor(attemptBudget)) : undefined);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
lastError = asError(error);
|
|
86
|
+
const delay = attempt <= config.maxRetries
|
|
87
|
+
? retryDelayMs(lastError, attempt, config.retryBaseDelayMs)
|
|
88
|
+
: null;
|
|
89
|
+
if (delay === null) {
|
|
90
|
+
throw lastError;
|
|
91
|
+
}
|
|
92
|
+
const remaining = remainingBudgetMs(start, config.timeoutMs, clock);
|
|
93
|
+
if (remaining <= 0) {
|
|
94
|
+
throw lastError;
|
|
95
|
+
}
|
|
96
|
+
await sleepWithCancellation(clock, Math.min(delay, remaining), signal);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
throw lastError ?? new CancelledError("request timeout budget exhausted after retries");
|
|
100
|
+
}
|
|
101
|
+
export class CircuitBreaker {
|
|
102
|
+
modelId;
|
|
103
|
+
config;
|
|
104
|
+
clock;
|
|
105
|
+
state = "closed";
|
|
106
|
+
consecutiveFailures = 0;
|
|
107
|
+
openedAt = null;
|
|
108
|
+
probesRemaining = 0;
|
|
109
|
+
// Tracks how many half-open probe slots are currently in-flight.
|
|
110
|
+
probesInFlight = 0;
|
|
111
|
+
constructor(modelId, config, clock) {
|
|
112
|
+
this.modelId = modelId;
|
|
113
|
+
this.config = config;
|
|
114
|
+
this.clock = clock;
|
|
115
|
+
}
|
|
116
|
+
// Called before forwarding a request. Throws CircuitOpenError when the breaker is
|
|
117
|
+
// open and the cooldown has not elapsed; otherwise lets the call through (entering
|
|
118
|
+
// half-open as a side effect when cooldown has passed).
|
|
119
|
+
// In half-open, at most config.halfOpenProbes concurrent probes are admitted; excess
|
|
120
|
+
// callers receive CircuitOpenError until a probe slot is freed by recordSuccess/Failure.
|
|
121
|
+
assertAllowed() {
|
|
122
|
+
if (this.state === "open") {
|
|
123
|
+
if (this.openedAt !== null && this.clock.now() - this.openedAt >= this.config.cooldownMs) {
|
|
124
|
+
this.state = "half-open";
|
|
125
|
+
this.probesRemaining = this.config.halfOpenProbes;
|
|
126
|
+
this.probesInFlight = 0;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
throw new CircuitOpenError(`circuit open for model '${this.modelId}'`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (this.state === "half-open") {
|
|
133
|
+
if (this.probesInFlight >= this.config.halfOpenProbes) {
|
|
134
|
+
throw new CircuitOpenError(`circuit half-open for model '${this.modelId}'`);
|
|
135
|
+
}
|
|
136
|
+
this.probesInFlight += 1;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
recordSuccess() {
|
|
140
|
+
if (this.state === "half-open") {
|
|
141
|
+
this.probesInFlight = Math.max(0, this.probesInFlight - 1);
|
|
142
|
+
this.probesRemaining -= 1;
|
|
143
|
+
if (this.probesRemaining <= 0) {
|
|
144
|
+
this.close();
|
|
145
|
+
}
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
this.consecutiveFailures = 0;
|
|
149
|
+
}
|
|
150
|
+
recordFailure() {
|
|
151
|
+
if (this.state === "half-open") {
|
|
152
|
+
this.probesInFlight = Math.max(0, this.probesInFlight - 1);
|
|
153
|
+
this.open();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.consecutiveFailures += 1;
|
|
157
|
+
if (this.consecutiveFailures >= this.config.failureThreshold) {
|
|
158
|
+
this.open();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
status(modelId) {
|
|
162
|
+
return {
|
|
163
|
+
modelId,
|
|
164
|
+
state: this.state,
|
|
165
|
+
consecutiveFailures: this.consecutiveFailures,
|
|
166
|
+
openedAt: this.openedAt,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
open() {
|
|
170
|
+
this.state = "open";
|
|
171
|
+
this.openedAt = this.clock.now();
|
|
172
|
+
this.probesRemaining = 0;
|
|
173
|
+
this.probesInFlight = 0;
|
|
174
|
+
}
|
|
175
|
+
close() {
|
|
176
|
+
this.state = "closed";
|
|
177
|
+
this.consecutiveFailures = 0;
|
|
178
|
+
this.openedAt = null;
|
|
179
|
+
this.probesRemaining = 0;
|
|
180
|
+
this.probesInFlight = 0;
|
|
181
|
+
}
|
|
182
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ModelCapability, NormalizedResponse, GatewayRequest } from "@oscharko-dev/keiko-contracts";
|
|
2
|
+
import type { GroundingLimits } from "@oscharko-dev/keiko-contracts/bff-wire";
|
|
3
|
+
export type { ModelKind, CostClass, LatencyClass, InfillingAlignment, ModelCapability, CompletionInteractionMode, CompletionDegradeReason, CompletionModelSelection, ChatMessage, ChatMessageContentPart, ChatMessageImageUrlContentPart, ChatMessageTextContentPart, ToolDefinition, ResponseFormat, GatewayRequest, NormalizedToolCall, UsageMetadata, NormalizedResponse, FinishReason, StreamDelta, StreamEvent, } from "@oscharko-dev/keiko-contracts";
|
|
4
|
+
export { CONVERSATION_CAPABILITY_CONTRACT_VERSION } from "@oscharko-dev/keiko-contracts";
|
|
5
|
+
export interface ModelProviderConfig {
|
|
6
|
+
readonly modelId: string;
|
|
7
|
+
readonly baseUrl: string;
|
|
8
|
+
readonly apiKey: string;
|
|
9
|
+
readonly apiKeyHeaderName?: string | undefined;
|
|
10
|
+
readonly timeoutMs: number;
|
|
11
|
+
readonly maxRetries: number;
|
|
12
|
+
readonly retryBaseDelayMs: number;
|
|
13
|
+
readonly egress?: OutboundHttpEgressConfig | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface OutboundHttpEgressConfig {
|
|
16
|
+
readonly httpProxy?: string | undefined;
|
|
17
|
+
readonly httpsProxy?: string | undefined;
|
|
18
|
+
readonly noProxy?: readonly string[] | undefined;
|
|
19
|
+
readonly caBundlePath?: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface CircuitBreakerConfig {
|
|
22
|
+
readonly failureThreshold: number;
|
|
23
|
+
readonly cooldownMs: number;
|
|
24
|
+
readonly halfOpenProbes: number;
|
|
25
|
+
}
|
|
26
|
+
export interface FigmaConnectorConfig {
|
|
27
|
+
readonly accessToken?: string | undefined;
|
|
28
|
+
}
|
|
29
|
+
export interface GatewayConfig {
|
|
30
|
+
readonly providers: readonly ModelProviderConfig[];
|
|
31
|
+
readonly circuitBreaker: CircuitBreakerConfig;
|
|
32
|
+
readonly capabilities?: readonly ModelCapability[] | undefined;
|
|
33
|
+
readonly grounding?: Partial<GroundingLimits> | undefined;
|
|
34
|
+
readonly egress?: OutboundHttpEgressConfig | undefined;
|
|
35
|
+
readonly figma?: FigmaConnectorConfig | undefined;
|
|
36
|
+
}
|
|
37
|
+
export type GatewayStreamChunk = {
|
|
38
|
+
readonly type: "delta";
|
|
39
|
+
readonly token: string;
|
|
40
|
+
} | {
|
|
41
|
+
readonly type: "done";
|
|
42
|
+
readonly response: NormalizedResponse;
|
|
43
|
+
};
|
|
44
|
+
export interface ProviderAdapter {
|
|
45
|
+
readonly call: (request: GatewayRequest, config: ModelProviderConfig) => Promise<NormalizedResponse>;
|
|
46
|
+
readonly callStream?: (request: GatewayRequest, config: ModelProviderConfig) => AsyncIterable<GatewayStreamChunk>;
|
|
47
|
+
}
|
|
48
|
+
export interface Clock {
|
|
49
|
+
readonly now: () => number;
|
|
50
|
+
readonly sleep: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
export type CircuitState = "closed" | "open" | "half-open";
|
|
53
|
+
export interface CircuitBreakerStatus {
|
|
54
|
+
readonly modelId: string;
|
|
55
|
+
readonly state: CircuitState;
|
|
56
|
+
readonly consecutiveFailures: number;
|
|
57
|
+
readonly openedAt: number | null;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,cAAc,EACf,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,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C,CAAC;CACrE;AAID,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAE3D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Re-export shim: wire-safe gateway contract types live in @oscharko-dev/keiko-contracts
|
|
2
|
+
// (issue #158). Credential-bearing / port shapes (ModelProviderConfig, GatewayConfig,
|
|
3
|
+
// CircuitBreakerConfig, ProviderAdapter, Clock, CircuitState, CircuitBreakerStatus) STAY here
|
|
4
|
+
// so contracts never carries an apiKey-shaped surface (ADR-0019 direction 1 contracts-leaf).
|
|
5
|
+
// `verbatimModuleSyntax` is on, so type-only names use `export type`.
|
|
6
|
+
export { CONVERSATION_CAPABILITY_CONTRACT_VERSION } from "@oscharko-dev/keiko-contracts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B,EAAG,OAAgB,CAAC"}
|
package/dist/version.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@oscharko-dev/keiko-model-gateway",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"description": "Internal workspace package: Keiko model gateway — provider abstraction, OpenAI-compatible adapter, capability registry, routing, resilience, TLS handling. Not published independently.",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./internal/http": {
|
|
15
|
+
"types": "./dist/http.d.ts",
|
|
16
|
+
"import": "./dist/http.js"
|
|
17
|
+
},
|
|
18
|
+
"./internal/normalize": {
|
|
19
|
+
"types": "./dist/normalize.d.ts",
|
|
20
|
+
"import": "./dist/normalize.js"
|
|
21
|
+
},
|
|
22
|
+
"./internal/openai-adapter": {
|
|
23
|
+
"types": "./dist/openai-adapter.d.ts",
|
|
24
|
+
"import": "./dist/openai-adapter.js"
|
|
25
|
+
},
|
|
26
|
+
"./internal/resilience": {
|
|
27
|
+
"types": "./dist/resilience.d.ts",
|
|
28
|
+
"import": "./dist/resilience.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -b tsconfig.json",
|
|
33
|
+
"typecheck": "tsc -b tsconfig.json",
|
|
34
|
+
"test": "vitest run"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"sideEffects": false,
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=22"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@oscharko-dev/keiko-contracts": "0.2.0",
|
|
45
|
+
"@oscharko-dev/keiko-security": "0.2.0"
|
|
46
|
+
}
|
|
47
|
+
}
|