govyn 0.0.1 → 0.2.6
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/LICENSE +21 -0
- package/README.md +284 -1
- package/configs/multi-provider.yaml +68 -0
- package/configs/openai-only.yaml +45 -0
- package/configs/team-setup.yaml +88 -0
- package/dist/action-logger.d.ts +128 -0
- package/dist/action-logger.js +356 -0
- package/dist/action-logger.js.map +1 -0
- package/dist/admin-cli.d.ts +2 -0
- package/dist/admin-cli.js +36 -0
- package/dist/admin-cli.js.map +1 -0
- package/dist/agents.d.ts +23 -0
- package/dist/agents.js +59 -0
- package/dist/agents.js.map +1 -0
- package/dist/alert-api.d.ts +14 -0
- package/dist/alert-api.js +355 -0
- package/dist/alert-api.js.map +1 -0
- package/dist/alert-manager.d.ts +77 -0
- package/dist/alert-manager.js +267 -0
- package/dist/alert-manager.js.map +1 -0
- package/dist/approval-api.d.ts +19 -0
- package/dist/approval-api.js +82 -0
- package/dist/approval-api.js.map +1 -0
- package/dist/approval-timeout.d.ts +29 -0
- package/dist/approval-timeout.js +45 -0
- package/dist/approval-timeout.js.map +1 -0
- package/dist/approval.d.ts +78 -0
- package/dist/approval.js +101 -0
- package/dist/approval.js.map +1 -0
- package/dist/auth.d.ts +47 -0
- package/dist/auth.js +335 -0
- package/dist/auth.js.map +1 -0
- package/dist/budget-api.d.ts +20 -0
- package/dist/budget-api.js +85 -0
- package/dist/budget-api.js.map +1 -0
- package/dist/budget-enforcer.d.ts +102 -0
- package/dist/budget-enforcer.js +294 -0
- package/dist/budget-enforcer.js.map +1 -0
- package/dist/cli.d.ts +15 -0
- package/dist/cli.js +200 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.js +267 -0
- package/dist/config.js.map +1 -0
- package/dist/cost-aggregator.d.ts +69 -0
- package/dist/cost-aggregator.js +305 -0
- package/dist/cost-aggregator.js.map +1 -0
- package/dist/cost-api.d.ts +29 -0
- package/dist/cost-api.js +128 -0
- package/dist/cost-api.js.map +1 -0
- package/dist/database-url.d.ts +6 -0
- package/dist/database-url.js +47 -0
- package/dist/database-url.js.map +1 -0
- package/dist/db-retention.d.ts +53 -0
- package/dist/db-retention.js +82 -0
- package/dist/db-retention.js.map +1 -0
- package/dist/db-schema.d.ts +17 -0
- package/dist/db-schema.js +167 -0
- package/dist/db-schema.js.map +1 -0
- package/dist/db-writer.d.ts +55 -0
- package/dist/db-writer.js +115 -0
- package/dist/db-writer.js.map +1 -0
- package/dist/db.d.ts +33 -0
- package/dist/db.js +78 -0
- package/dist/db.js.map +1 -0
- package/dist/events.d.ts +77 -0
- package/dist/events.js +12 -0
- package/dist/events.js.map +1 -0
- package/dist/health.d.ts +14 -0
- package/dist/health.js +49 -0
- package/dist/health.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/init-wizard.d.ts +12 -0
- package/dist/init-wizard.js +206 -0
- package/dist/init-wizard.js.map +1 -0
- package/dist/log-api.d.ts +20 -0
- package/dist/log-api.js +371 -0
- package/dist/log-api.js.map +1 -0
- package/dist/log-rotator.d.ts +55 -0
- package/dist/log-rotator.js +157 -0
- package/dist/log-rotator.js.map +1 -0
- package/dist/loop-detector.d.ts +71 -0
- package/dist/loop-detector.js +122 -0
- package/dist/loop-detector.js.map +1 -0
- package/dist/message-content.d.ts +15 -0
- package/dist/message-content.js +41 -0
- package/dist/message-content.js.map +1 -0
- package/dist/persistence-types.d.ts +165 -0
- package/dist/persistence-types.js +2 -0
- package/dist/persistence-types.js.map +1 -0
- package/dist/persistence.d.ts +185 -0
- package/dist/persistence.js +785 -0
- package/dist/persistence.js.map +1 -0
- package/dist/policy-api.d.ts +25 -0
- package/dist/policy-api.js +347 -0
- package/dist/policy-api.js.map +1 -0
- package/dist/policy-engine.d.ts +76 -0
- package/dist/policy-engine.js +830 -0
- package/dist/policy-engine.js.map +1 -0
- package/dist/policy-file.d.ts +10 -0
- package/dist/policy-file.js +52 -0
- package/dist/policy-file.js.map +1 -0
- package/dist/policy-parser.d.ts +21 -0
- package/dist/policy-parser.js +560 -0
- package/dist/policy-parser.js.map +1 -0
- package/dist/policy-types.d.ts +216 -0
- package/dist/policy-types.js +8 -0
- package/dist/policy-types.js.map +1 -0
- package/dist/policy-watcher.d.ts +54 -0
- package/dist/policy-watcher.js +116 -0
- package/dist/policy-watcher.js.map +1 -0
- package/dist/pricing.d.ts +69 -0
- package/dist/pricing.js +93 -0
- package/dist/pricing.js.map +1 -0
- package/dist/prompt.d.ts +6 -0
- package/dist/prompt.js +47 -0
- package/dist/prompt.js.map +1 -0
- package/dist/providers/anthropic.d.ts +18 -0
- package/dist/providers/anthropic.js +61 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/custom.d.ts +19 -0
- package/dist/providers/custom.js +54 -0
- package/dist/providers/custom.js.map +1 -0
- package/dist/providers/openai.d.ts +17 -0
- package/dist/providers/openai.js +48 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/proxy.d.ts +57 -0
- package/dist/proxy.js +477 -0
- package/dist/proxy.js.map +1 -0
- package/dist/router.d.ts +23 -0
- package/dist/router.js +89 -0
- package/dist/router.js.map +1 -0
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +139 -0
- package/dist/runtime.js.map +1 -0
- package/dist/safe-regex.d.ts +37 -0
- package/dist/safe-regex.js +73 -0
- package/dist/safe-regex.js.map +1 -0
- package/dist/security.d.ts +81 -0
- package/dist/security.js +512 -0
- package/dist/security.js.map +1 -0
- package/dist/server.d.ts +33 -0
- package/dist/server.js +1147 -0
- package/dist/server.js.map +1 -0
- package/dist/sqlite-schema.d.ts +6 -0
- package/dist/sqlite-schema.js +134 -0
- package/dist/sqlite-schema.js.map +1 -0
- package/dist/streaming.d.ts +24 -0
- package/dist/streaming.js +63 -0
- package/dist/streaming.js.map +1 -0
- package/dist/tokens.d.ts +45 -0
- package/dist/tokens.js +237 -0
- package/dist/tokens.js.map +1 -0
- package/dist/types.d.ts +344 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +67 -2
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core type definitions for the Govyn proxy server.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Supported provider types for routing.
|
|
6
|
+
*/
|
|
7
|
+
export type ProviderType = 'openai' | 'anthropic' | 'custom';
|
|
8
|
+
/**
|
|
9
|
+
* Configuration for an upstream API provider.
|
|
10
|
+
*/
|
|
11
|
+
export interface ProviderConfig {
|
|
12
|
+
/** Unique name identifier for this provider */
|
|
13
|
+
name: string;
|
|
14
|
+
/** Base URL for the upstream API (e.g. https://api.openai.com) */
|
|
15
|
+
baseUrl: string;
|
|
16
|
+
/** Environment variable name to read the API key from, or null if not needed */
|
|
17
|
+
apiKeyEnv: string | null;
|
|
18
|
+
/** The type of provider */
|
|
19
|
+
providerType: ProviderType;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Result of matching a URL route to a provider.
|
|
23
|
+
*/
|
|
24
|
+
export interface RouteMatch {
|
|
25
|
+
/** The resolved provider configuration */
|
|
26
|
+
provider: ProviderConfig;
|
|
27
|
+
/** The upstream path to forward to (e.g. /v1/chat/completions) */
|
|
28
|
+
upstreamPath: string;
|
|
29
|
+
/** The type of provider matched */
|
|
30
|
+
providerType: ProviderType;
|
|
31
|
+
}
|
|
32
|
+
/** Per-agent loop detection configuration from YAML */
|
|
33
|
+
export interface LoopDetectionConfig {
|
|
34
|
+
/** Number of identical calls to trigger loop detection (default: 10) */
|
|
35
|
+
threshold: number;
|
|
36
|
+
/** Time window in seconds to count identical calls (default: 60) */
|
|
37
|
+
windowSeconds: number;
|
|
38
|
+
/** Cooldown period in seconds after loop detected (default: 300 = 5 min) */
|
|
39
|
+
cooldownSeconds: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Configuration for a named agent that can send requests through the proxy.
|
|
43
|
+
*/
|
|
44
|
+
export interface AgentConfig {
|
|
45
|
+
/** Human-readable name for this agent */
|
|
46
|
+
name: string;
|
|
47
|
+
/** Optional list of API keys scoped to this agent */
|
|
48
|
+
apiKeys?: string[];
|
|
49
|
+
/** Per-agent loop detection overrides */
|
|
50
|
+
loopDetection?: LoopDetectionConfig;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolved identity of the agent making a request.
|
|
54
|
+
*/
|
|
55
|
+
export interface AgentIdentity {
|
|
56
|
+
/** The agent's identifier (e.g. "research-agent" or "unknown") */
|
|
57
|
+
agentId: string;
|
|
58
|
+
/** How the agent was identified */
|
|
59
|
+
source: 'header' | 'api-key' | 'default';
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Token usage extracted from a provider response.
|
|
63
|
+
*/
|
|
64
|
+
export interface TokenUsage {
|
|
65
|
+
/** Number of input/prompt tokens used */
|
|
66
|
+
inputTokens: number;
|
|
67
|
+
/** Number of output/completion tokens generated */
|
|
68
|
+
outputTokens: number;
|
|
69
|
+
/** Total tokens (input + output) */
|
|
70
|
+
totalTokens: number;
|
|
71
|
+
/** The model that was used */
|
|
72
|
+
model: string;
|
|
73
|
+
/** The provider type */
|
|
74
|
+
provider: ProviderType;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A single cost record for one proxied request.
|
|
78
|
+
* Stored in the CostAggregator after every proxied request.
|
|
79
|
+
*/
|
|
80
|
+
export interface CostRecord {
|
|
81
|
+
/** The agent that made the request */
|
|
82
|
+
agentId: string;
|
|
83
|
+
/** The model used (as returned by the upstream) */
|
|
84
|
+
model: string;
|
|
85
|
+
/** The provider type */
|
|
86
|
+
provider: ProviderType;
|
|
87
|
+
/** Number of input tokens */
|
|
88
|
+
inputTokens: number;
|
|
89
|
+
/** Number of output tokens */
|
|
90
|
+
outputTokens: number;
|
|
91
|
+
/** Cost for input tokens (USD) */
|
|
92
|
+
inputCost: number;
|
|
93
|
+
/** Cost for output tokens (USD) */
|
|
94
|
+
outputCost: number;
|
|
95
|
+
/** Total cost (USD) */
|
|
96
|
+
totalCost: number;
|
|
97
|
+
/** Whether the model was found in the pricing table */
|
|
98
|
+
priced: boolean;
|
|
99
|
+
/** Unix timestamp (ms) when the record was created */
|
|
100
|
+
timestamp: number;
|
|
101
|
+
/** Original model requested by the agent (before model routing). Undefined if no routing occurred. */
|
|
102
|
+
requestedModel?: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Aggregated cost summary for a single agent over a time period.
|
|
106
|
+
*/
|
|
107
|
+
export interface CostSummary {
|
|
108
|
+
/** The agent identifier */
|
|
109
|
+
agentId: string;
|
|
110
|
+
/** Total cost (USD) */
|
|
111
|
+
totalCost: number;
|
|
112
|
+
/** Total input token cost (USD) */
|
|
113
|
+
inputCost: number;
|
|
114
|
+
/** Total output token cost (USD) */
|
|
115
|
+
outputCost: number;
|
|
116
|
+
/** Total input tokens across all requests */
|
|
117
|
+
totalInputTokens: number;
|
|
118
|
+
/** Total output tokens across all requests */
|
|
119
|
+
totalOutputTokens: number;
|
|
120
|
+
/** Number of requests attributed to this agent */
|
|
121
|
+
requestCount: number;
|
|
122
|
+
/** Per-model cost and token breakdown */
|
|
123
|
+
models: Record<string, {
|
|
124
|
+
cost: number;
|
|
125
|
+
requests: number;
|
|
126
|
+
inputTokens: number;
|
|
127
|
+
outputTokens: number;
|
|
128
|
+
}>;
|
|
129
|
+
}
|
|
130
|
+
export type CostTimeSeriesBucket = 'hour' | 'day' | 'month';
|
|
131
|
+
export interface CostTimeSeriesPoint {
|
|
132
|
+
/** Start timestamp for this bucket (UTC ISO 8601). */
|
|
133
|
+
timestamp: string;
|
|
134
|
+
/** Human-readable label for charts. */
|
|
135
|
+
label: string;
|
|
136
|
+
/** Total spend across all agents in this bucket. */
|
|
137
|
+
total: number;
|
|
138
|
+
/** Per-agent spend in this bucket. */
|
|
139
|
+
agents: Record<string, number>;
|
|
140
|
+
}
|
|
141
|
+
export interface CostTimeSeriesResult {
|
|
142
|
+
/** Bucket resolution used for this query. */
|
|
143
|
+
bucket: CostTimeSeriesBucket;
|
|
144
|
+
/** Ordered series of chart points. */
|
|
145
|
+
points: CostTimeSeriesPoint[];
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Time period for cost aggregation queries.
|
|
149
|
+
* - 'hour': last 60 minutes
|
|
150
|
+
* - 'day': current calendar day (midnight UTC to now)
|
|
151
|
+
* - 'month': current calendar month (1st UTC to now)
|
|
152
|
+
* - 'all': all records
|
|
153
|
+
*/
|
|
154
|
+
export type TimePeriod = 'hour' | 'day' | 'week' | 'month' | 'all';
|
|
155
|
+
/** Per-agent budget configuration from YAML */
|
|
156
|
+
export interface BudgetConfig {
|
|
157
|
+
/** Daily spending limit in USD (null = no daily limit) */
|
|
158
|
+
dailyLimit: number | null;
|
|
159
|
+
/** Monthly spending limit in USD (null = no monthly limit) */
|
|
160
|
+
monthlyLimit: number | null;
|
|
161
|
+
/** Hard or soft limit behavior */
|
|
162
|
+
limitType: 'hard' | 'soft';
|
|
163
|
+
/** Soft warning threshold as a percentage (0-100), default 80 */
|
|
164
|
+
softWarningPercent: number;
|
|
165
|
+
}
|
|
166
|
+
/** Result of a budget check before proxying a request */
|
|
167
|
+
export interface BudgetCheckResult {
|
|
168
|
+
/** Whether the request is allowed to proceed */
|
|
169
|
+
allowed: boolean;
|
|
170
|
+
/** If blocked, the reason code */
|
|
171
|
+
code?: 'budget_exceeded_daily' | 'budget_exceeded_monthly' | 'loop_detected';
|
|
172
|
+
/** If blocked or warning, the limit that was hit */
|
|
173
|
+
limitAmount?: number;
|
|
174
|
+
/** Current spend in the relevant period */
|
|
175
|
+
currentSpend?: number;
|
|
176
|
+
/** ISO timestamp when the budget resets */
|
|
177
|
+
resetTime?: string;
|
|
178
|
+
/** Whether a soft warning should be emitted */
|
|
179
|
+
warning?: boolean;
|
|
180
|
+
/** Percentage of budget used (for warnings) */
|
|
181
|
+
percentUsed?: number;
|
|
182
|
+
}
|
|
183
|
+
/** Budget status for a single agent */
|
|
184
|
+
export interface BudgetStatus {
|
|
185
|
+
agentId: string;
|
|
186
|
+
daily: {
|
|
187
|
+
limit: number | null;
|
|
188
|
+
spent: number;
|
|
189
|
+
remaining: number | null;
|
|
190
|
+
percentUsed: number | null;
|
|
191
|
+
resetsAt: string;
|
|
192
|
+
};
|
|
193
|
+
monthly: {
|
|
194
|
+
limit: number | null;
|
|
195
|
+
spent: number;
|
|
196
|
+
remaining: number | null;
|
|
197
|
+
percentUsed: number | null;
|
|
198
|
+
resetsAt: string;
|
|
199
|
+
};
|
|
200
|
+
limitType: 'hard' | 'soft';
|
|
201
|
+
blocked: boolean;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Logging mode for an agent.
|
|
205
|
+
* - 'metadata': log summary fields only (default)
|
|
206
|
+
* - 'full-payload': log full request/response bodies as separate files
|
|
207
|
+
*/
|
|
208
|
+
export type LoggingMode = 'metadata' | 'full-payload';
|
|
209
|
+
/**
|
|
210
|
+
* A structured log entry for a single proxied request.
|
|
211
|
+
*/
|
|
212
|
+
export interface LogEntry {
|
|
213
|
+
/** Unique identifier for this log entry */
|
|
214
|
+
id: string;
|
|
215
|
+
/** ISO 8601 timestamp when the request was completed */
|
|
216
|
+
timestamp: string;
|
|
217
|
+
/** The agent that made the request */
|
|
218
|
+
agent_id: string;
|
|
219
|
+
/** The upstream provider type */
|
|
220
|
+
provider: ProviderType;
|
|
221
|
+
/** The upstream path that was forwarded to */
|
|
222
|
+
target: string;
|
|
223
|
+
/** The model used (if extractable from the response) */
|
|
224
|
+
model: string | null;
|
|
225
|
+
/** Number of input/prompt tokens (if extractable) */
|
|
226
|
+
input_tokens: number | null;
|
|
227
|
+
/** Number of output/completion tokens (if extractable) */
|
|
228
|
+
output_tokens: number | null;
|
|
229
|
+
/** Calculated cost in USD (if priced) */
|
|
230
|
+
cost: number | null;
|
|
231
|
+
/** Whether the model was found in the pricing table */
|
|
232
|
+
priced: boolean;
|
|
233
|
+
/** Request latency in milliseconds (request start to upstream response end) */
|
|
234
|
+
latency_ms: number;
|
|
235
|
+
/** HTTP status code of the upstream response */
|
|
236
|
+
status: number;
|
|
237
|
+
/** Whether a full payload file was stored for this request */
|
|
238
|
+
has_payload: boolean;
|
|
239
|
+
/** Reference ID to the payload file (null if metadata-only) */
|
|
240
|
+
payload_id: string | null;
|
|
241
|
+
/** Storage region where this log entry is stored */
|
|
242
|
+
storage_region: 'eu' | 'us' | 'auto';
|
|
243
|
+
/** Original model requested by the agent (before routing rewrite) */
|
|
244
|
+
requested_model?: string | null;
|
|
245
|
+
/** Actual model used after routing (same as model if no routing) */
|
|
246
|
+
actual_model?: string | null;
|
|
247
|
+
/** Policy evaluation result summary (null if no policies loaded) */
|
|
248
|
+
policy_result?: {
|
|
249
|
+
allowed: boolean;
|
|
250
|
+
evaluated_count: number;
|
|
251
|
+
matched_count: number;
|
|
252
|
+
denied_by?: string;
|
|
253
|
+
evaluation_time_ms: number;
|
|
254
|
+
} | null;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Configuration for the action logging system.
|
|
258
|
+
*/
|
|
259
|
+
export interface LoggingConfig {
|
|
260
|
+
/** Whether logging is enabled (default: true) */
|
|
261
|
+
enabled: boolean;
|
|
262
|
+
/** Directory for log files (default: './logs') */
|
|
263
|
+
directory: string;
|
|
264
|
+
/** Default logging mode for all agents (default: 'metadata') */
|
|
265
|
+
defaultMode: LoggingMode;
|
|
266
|
+
/** Write log lines to stdout (default: true) */
|
|
267
|
+
stdout: boolean;
|
|
268
|
+
/** Write log lines to JSONL file (default: true) */
|
|
269
|
+
file: boolean;
|
|
270
|
+
/** Max body size in bytes before truncation (default: 1048576 = 1MB) */
|
|
271
|
+
maxBodySize: number;
|
|
272
|
+
/** File rotation trigger: max size in MB (default: 50) */
|
|
273
|
+
rotationMaxSizeMb: number;
|
|
274
|
+
/** File rotation trigger: hours between rotations (default: 24) */
|
|
275
|
+
rotationIntervalHours: number;
|
|
276
|
+
/** Auto-delete log files after N days (default: 30) */
|
|
277
|
+
retentionDays: number;
|
|
278
|
+
/** Auto-delete payload files after N days (default: 7) */
|
|
279
|
+
payloadRetentionDays: number;
|
|
280
|
+
/** Per-agent logging mode overrides */
|
|
281
|
+
agentModes: Map<string, LoggingMode>;
|
|
282
|
+
/** Storage region for GDPR compliance: 'eu', 'us', or 'auto' (default: 'auto') */
|
|
283
|
+
storageRegion: 'eu' | 'us' | 'auto';
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Database persistence configuration.
|
|
287
|
+
* Govyn uses SQLite by default for self-hosted OSS installs and can be switched
|
|
288
|
+
* to PostgreSQL for larger or multi-instance deployments.
|
|
289
|
+
*/
|
|
290
|
+
export interface DatabaseConfig {
|
|
291
|
+
/** Database connection URL: sqlite:./govyn.db or postgres://... */
|
|
292
|
+
url: string;
|
|
293
|
+
/** Whether to continue proxying when DB is unavailable (default: true) */
|
|
294
|
+
failOpen: boolean;
|
|
295
|
+
/** Days to retain cost records and policy evaluations before cleanup (default: 90) */
|
|
296
|
+
retentionDays: number;
|
|
297
|
+
/** Days to retain approval request records before cleanup (default: 365) */
|
|
298
|
+
approvalRetentionDays: number;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Security controls for the management API and browser-based dashboard access.
|
|
302
|
+
*/
|
|
303
|
+
export interface SecurityConfig {
|
|
304
|
+
/** Env var name that stores the admin API key for remote management access. */
|
|
305
|
+
adminApiKeyEnv: string;
|
|
306
|
+
/** Exact browser origins allowed to call /api/* cross-origin. */
|
|
307
|
+
allowedOrigins: string[];
|
|
308
|
+
/** Whether loopback/localhost requests may access the management API without an admin key. */
|
|
309
|
+
allowLocalAdmin: boolean;
|
|
310
|
+
/** Whether proxied model requests must present a configured agent API key. */
|
|
311
|
+
requireAgentApiKey: boolean;
|
|
312
|
+
/** Path to the local single-admin auth store for the OSS dashboard. */
|
|
313
|
+
authFile?: string;
|
|
314
|
+
/** Dashboard session lifetime in hours (defaults applied if missing). */
|
|
315
|
+
sessionTtlHours?: number;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Overall proxy server configuration.
|
|
319
|
+
*/
|
|
320
|
+
export interface ProxyConfig {
|
|
321
|
+
/** TCP port to listen on */
|
|
322
|
+
port: number;
|
|
323
|
+
/** Host/address to bind to (e.g. 127.0.0.1 for local-only or 0.0.0.0 for remote access) */
|
|
324
|
+
host: string;
|
|
325
|
+
/** Map of provider name to provider configuration */
|
|
326
|
+
providers: Map<string, ProviderConfig>;
|
|
327
|
+
/** Map of agent name to agent configuration */
|
|
328
|
+
agents: Map<string, AgentConfig>;
|
|
329
|
+
/** Pricing table for cost calculation */
|
|
330
|
+
pricing: Map<string, {
|
|
331
|
+
inputPricePerMillion: number;
|
|
332
|
+
outputPricePerMillion: number;
|
|
333
|
+
}>;
|
|
334
|
+
/** Per-agent budget configuration */
|
|
335
|
+
budgets: Map<string, BudgetConfig>;
|
|
336
|
+
/** Action logging configuration (optional, defaults applied if missing) */
|
|
337
|
+
logging?: LoggingConfig;
|
|
338
|
+
/** Path to the YAML policy file (optional — no policies if not set) */
|
|
339
|
+
policiesFile?: string;
|
|
340
|
+
/** Database persistence configuration */
|
|
341
|
+
database?: DatabaseConfig;
|
|
342
|
+
/** Management API and CORS security configuration */
|
|
343
|
+
security?: SecurityConfig;
|
|
344
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "govyn",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "AI agent governance proxy",
|
|
5
|
-
"license": "MIT"
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"homepage": "https://github.com/govynAI/govyn",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/govynAI/govyn/issues"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/govynAI/govyn.git"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"ai",
|
|
19
|
+
"governance",
|
|
20
|
+
"proxy",
|
|
21
|
+
"security",
|
|
22
|
+
"self-hosted"
|
|
23
|
+
],
|
|
24
|
+
"bin": {
|
|
25
|
+
"govyn": "dist/cli.js"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist/**/*.js",
|
|
29
|
+
"dist/**/*.d.ts",
|
|
30
|
+
"dist/**/*.js.map",
|
|
31
|
+
"configs/*.yaml"
|
|
32
|
+
],
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=20"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "node ./scripts/clean-dist.mjs && tsc",
|
|
38
|
+
"build:python": "node ./scripts/clean-python-build.mjs && python -m build python-sdk --outdir python-sdk/dist",
|
|
39
|
+
"clean:dist": "node ./scripts/clean-dist.mjs",
|
|
40
|
+
"clean:python-build": "node ./scripts/clean-python-build.mjs",
|
|
41
|
+
"dev": "tsx watch src/index.ts",
|
|
42
|
+
"lint": "eslint src/ tests/",
|
|
43
|
+
"package:check": "node ./scripts/check-package-surface.mjs",
|
|
44
|
+
"release:check": "npm test && npm run lint && npm run typecheck && npm run build && npm --prefix dashboard run build && python -m pytest python-sdk/tests -q && npm run security:scan && npm run build:python",
|
|
45
|
+
"security:scan": "npm audit && npm --prefix dashboard audit && python -m pip_audit python-sdk && python -m bandit -r python-sdk/govynai && npm run package:check",
|
|
46
|
+
"typecheck": "tsc --noEmit",
|
|
47
|
+
"test": "vitest run",
|
|
48
|
+
"test:watch": "vitest",
|
|
49
|
+
"start": "node dist/cli.js"
|
|
50
|
+
},
|
|
51
|
+
"overrides": {
|
|
52
|
+
"flatted": "^3.4.0",
|
|
53
|
+
"minimatch": "^3.1.4"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"better-sqlite3": "^12.8.0",
|
|
57
|
+
"ipaddr.js": "^2.3.0",
|
|
58
|
+
"postgres": "^3.4.8",
|
|
59
|
+
"yaml": "^2.8.2"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@eslint/js": "^9.18.0",
|
|
63
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
64
|
+
"@types/node": "^22.10.0",
|
|
65
|
+
"eslint": "^9.18.0",
|
|
66
|
+
"tsx": "^4.19.2",
|
|
67
|
+
"typescript": "^5.7.3",
|
|
68
|
+
"typescript-eslint": "^8.56.1",
|
|
69
|
+
"vitest": "^3.0.4"
|
|
70
|
+
}
|
|
6
71
|
}
|