@getaegis/cli 0.8.1 → 0.9.1
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/README.md +38 -14
- package/dist/agent/agent.d.ts +1 -1
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/cli/commands/config.d.ts.map +1 -1
- package/dist/cli/commands/config.js +1 -1
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/dashboard.d.ts.map +1 -1
- package/dist/cli/commands/dashboard.js +8 -2
- package/dist/cli/commands/dashboard.js.map +1 -1
- package/dist/cli/commands/db.d.ts +6 -0
- package/dist/cli/commands/db.d.ts.map +1 -0
- package/dist/cli/commands/db.js +139 -0
- package/dist/cli/commands/db.js.map +1 -0
- package/dist/cli/commands/gate.d.ts.map +1 -1
- package/dist/cli/commands/gate.js +8 -2
- package/dist/cli/commands/gate.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +90 -24
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/key.d.ts +6 -0
- package/dist/cli/commands/key.d.ts.map +1 -0
- package/dist/cli/commands/key.js +49 -0
- package/dist/cli/commands/key.js.map +1 -0
- package/dist/cli/commands/vault-manager.js +1 -1
- package/dist/cli/commands/vault-manager.js.map +1 -1
- package/dist/cli/commands/vault.d.ts.map +1 -1
- package/dist/cli/commands/vault.js +27 -3
- package/dist/cli/commands/vault.js.map +1 -1
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli.js +9 -2
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +54 -8
- package/dist/config.js.map +1 -1
- package/dist/dashboard/public/assets/{index-DkHiw9_f.js → index-Cah0_BKk.js} +1 -1
- package/dist/dashboard/public/index.html +1 -1
- package/dist/db.d.ts +13 -1
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +68 -49
- package/dist/db.js.map +1 -1
- package/dist/doctor.d.ts +1 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +20 -0
- package/dist/doctor.js.map +1 -1
- package/dist/gate/gate.d.ts +24 -2
- package/dist/gate/gate.d.ts.map +1 -1
- package/dist/gate/gate.js +289 -62
- package/dist/gate/gate.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/key-storage/credential-manager-windows.d.ts +19 -0
- package/dist/key-storage/credential-manager-windows.d.ts.map +1 -0
- package/dist/key-storage/credential-manager-windows.js +87 -0
- package/dist/key-storage/credential-manager-windows.js.map +1 -0
- package/dist/key-storage/file-fallback.d.ts +21 -0
- package/dist/key-storage/file-fallback.d.ts.map +1 -0
- package/dist/key-storage/file-fallback.js +62 -0
- package/dist/key-storage/file-fallback.js.map +1 -0
- package/dist/key-storage/index.d.ts +6 -0
- package/dist/key-storage/index.d.ts.map +1 -0
- package/dist/key-storage/index.js +6 -0
- package/dist/key-storage/index.js.map +1 -0
- package/dist/key-storage/key-storage.d.ts +41 -0
- package/dist/key-storage/key-storage.d.ts.map +1 -0
- package/dist/key-storage/key-storage.js +70 -0
- package/dist/key-storage/key-storage.js.map +1 -0
- package/dist/key-storage/keychain-macos.d.ts +19 -0
- package/dist/key-storage/keychain-macos.d.ts.map +1 -0
- package/dist/key-storage/keychain-macos.js +51 -0
- package/dist/key-storage/keychain-macos.js.map +1 -0
- package/dist/key-storage/secret-service-linux.d.ts +19 -0
- package/dist/key-storage/secret-service-linux.d.ts.map +1 -0
- package/dist/key-storage/secret-service-linux.js +55 -0
- package/dist/key-storage/secret-service-linux.js.map +1 -0
- package/dist/ledger/ledger.d.ts +1 -1
- package/dist/ledger/ledger.d.ts.map +1 -1
- package/dist/metrics/metrics.d.ts +1 -1
- package/dist/metrics/metrics.d.ts.map +1 -1
- package/dist/metrics/metrics.js.map +1 -1
- package/dist/user/user.d.ts +1 -1
- package/dist/user/user.d.ts.map +1 -1
- package/dist/vault/crypto.js +1 -1
- package/dist/vault/vault-manager.d.ts +3 -3
- package/dist/vault/vault-manager.d.ts.map +1 -1
- package/dist/vault/vault-manager.js +14 -4
- package/dist/vault/vault-manager.js.map +1 -1
- package/dist/vault/vault.d.ts +1 -1
- package/dist/vault/vault.d.ts.map +1 -1
- package/dist/webhook/webhook.d.ts +1 -1
- package/dist/webhook/webhook.d.ts.map +1 -1
- package/package.json +12 -4
package/dist/config.js
CHANGED
|
@@ -2,6 +2,7 @@ import * as fs from 'node:fs';
|
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { parse as parseYaml } from 'yaml';
|
|
5
|
+
import { getKeyStorage } from './key-storage/index.js';
|
|
5
6
|
// ─── Defaults ─────────────────────────────────────────────────────
|
|
6
7
|
const DEFAULTS = {
|
|
7
8
|
port: 3100,
|
|
@@ -11,12 +12,15 @@ const DEFAULTS = {
|
|
|
11
12
|
logLevel: 'info',
|
|
12
13
|
logFormat: 'json',
|
|
13
14
|
vaultName: 'default',
|
|
14
|
-
requireAgentAuth:
|
|
15
|
+
requireAgentAuth: true,
|
|
15
16
|
policyMode: 'enforce',
|
|
16
17
|
metricsEnabled: true,
|
|
17
18
|
dashboard: { enabled: false, port: 3200 },
|
|
18
19
|
mcp: { transport: 'stdio', port: 3200 },
|
|
19
20
|
webhooks: [],
|
|
21
|
+
maxBodySize: 1_048_576, // 1 MB
|
|
22
|
+
requestTimeout: 30_000, // 30 seconds
|
|
23
|
+
maxConnectionsPerAgent: 50,
|
|
20
24
|
};
|
|
21
25
|
// ─── Config File Discovery ────────────────────────────────────────
|
|
22
26
|
/** Search order for config file, relative to CWD. */
|
|
@@ -115,6 +119,28 @@ export function validateConfigFile(config) {
|
|
|
115
119
|
if (config.gate.policies_dir !== undefined && typeof config.gate.policies_dir !== 'string') {
|
|
116
120
|
errors.push({ path: 'gate.policies_dir', message: 'Must be a string path.' });
|
|
117
121
|
}
|
|
122
|
+
if (config.gate.max_body_size !== undefined) {
|
|
123
|
+
if (typeof config.gate.max_body_size !== 'number' || config.gate.max_body_size < 1) {
|
|
124
|
+
errors.push({ path: 'gate.max_body_size', message: 'Must be a positive number (bytes).' });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (config.gate.request_timeout !== undefined) {
|
|
128
|
+
if (typeof config.gate.request_timeout !== 'number' || config.gate.request_timeout < 1000) {
|
|
129
|
+
errors.push({
|
|
130
|
+
path: 'gate.request_timeout',
|
|
131
|
+
message: 'Must be a number >= 1000 (milliseconds).',
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (config.gate.max_connections_per_agent !== undefined) {
|
|
136
|
+
if (typeof config.gate.max_connections_per_agent !== 'number' ||
|
|
137
|
+
config.gate.max_connections_per_agent < 1) {
|
|
138
|
+
errors.push({
|
|
139
|
+
path: 'gate.max_connections_per_agent',
|
|
140
|
+
message: 'Must be a positive number.',
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
118
144
|
}
|
|
119
145
|
if (config.vault !== undefined) {
|
|
120
146
|
if (config.vault.name !== undefined && typeof config.vault.name !== 'string') {
|
|
@@ -281,12 +307,23 @@ export function getConfig() {
|
|
|
281
307
|
if (!fs.existsSync(dataDir)) {
|
|
282
308
|
fs.mkdirSync(dataDir, { recursive: true });
|
|
283
309
|
}
|
|
284
|
-
// Master key resolution: env → config file → unseal key file → empty
|
|
310
|
+
// Master key resolution: env → config file → OS keychain → unseal key file → empty
|
|
285
311
|
let masterKey = getEnv('AEGIS_MASTER_KEY') ?? fileConfig.vault?.master_key ?? '';
|
|
286
312
|
if (!masterKey) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
masterKey =
|
|
313
|
+
try {
|
|
314
|
+
const keyStorage = getKeyStorage(dataDir);
|
|
315
|
+
masterKey = keyStorage.getKey() ?? '';
|
|
316
|
+
}
|
|
317
|
+
catch {
|
|
318
|
+
// Key storage not available — continue without key
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
// Validate master key format: must be 64 hex chars (256-bit key)
|
|
322
|
+
if (masterKey && !/^[0-9a-f]{64}$/i.test(masterKey)) {
|
|
323
|
+
// Warn but don't reject — legacy keys or test keys may differ
|
|
324
|
+
if (typeof process !== 'undefined' && process.stderr) {
|
|
325
|
+
process.stderr.write('⚠ Master key format warning: expected 64 hex characters (256-bit key).\n' +
|
|
326
|
+
' Decryption may fail if the key is invalid.\n');
|
|
290
327
|
}
|
|
291
328
|
}
|
|
292
329
|
// Resolve port: env → config file → default
|
|
@@ -307,9 +344,11 @@ export function getConfig() {
|
|
|
307
344
|
const salt = getEnv('AEGIS_SALT') ?? DEFAULTS.salt;
|
|
308
345
|
// Resolve TLS: config file
|
|
309
346
|
const tls = fileConfig.gate?.tls;
|
|
310
|
-
// Resolve agent auth: env → config file → default
|
|
311
|
-
const
|
|
312
|
-
|
|
347
|
+
// Resolve agent auth: env → config file → default (on by default since v0.8.2)
|
|
348
|
+
const envAgentAuth = getEnv('AEGIS_REQUIRE_AGENT_AUTH');
|
|
349
|
+
const requireAgentAuth = envAgentAuth !== undefined
|
|
350
|
+
? envAgentAuth === 'true'
|
|
351
|
+
: (fileConfig.gate?.require_agent_auth ?? DEFAULTS.requireAgentAuth);
|
|
313
352
|
// Resolve policy mode: env → config file → default
|
|
314
353
|
const policyMode = (getEnv('AEGIS_POLICY_MODE') ??
|
|
315
354
|
fileConfig.gate?.policy_mode ??
|
|
@@ -333,6 +372,10 @@ export function getConfig() {
|
|
|
333
372
|
};
|
|
334
373
|
// Webhooks from config file
|
|
335
374
|
const webhooks = fileConfig.webhooks ?? DEFAULTS.webhooks;
|
|
375
|
+
// Resolve Gate hardening: config file → defaults
|
|
376
|
+
const maxBodySize = fileConfig.gate?.max_body_size ?? DEFAULTS.maxBodySize;
|
|
377
|
+
const requestTimeout = fileConfig.gate?.request_timeout ?? DEFAULTS.requestTimeout;
|
|
378
|
+
const maxConnectionsPerAgent = fileConfig.gate?.max_connections_per_agent ?? DEFAULTS.maxConnectionsPerAgent;
|
|
336
379
|
return {
|
|
337
380
|
port,
|
|
338
381
|
masterKey,
|
|
@@ -349,6 +392,9 @@ export function getConfig() {
|
|
|
349
392
|
dashboard,
|
|
350
393
|
mcp,
|
|
351
394
|
webhooks,
|
|
395
|
+
maxBodySize,
|
|
396
|
+
requestTimeout,
|
|
397
|
+
maxConnectionsPerAgent,
|
|
352
398
|
configFilePath: configFilePath ?? undefined,
|
|
353
399
|
};
|
|
354
400
|
}
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AA6E1C,qEAAqE;AAErE,MAAM,QAAQ,GAAgB;IAC5B,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,EAAE;IACb,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC;IAC3C,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,SAAS;IACpB,gBAAgB,EAAE,KAAK;IACvB,UAAU,EAAE,SAAS;IACrB,cAAc,EAAE,IAAI;IACpB,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE;IACzC,GAAG,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE;IACvC,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,CAAC,SAAS,CAAC,OAAO;QACnF,IAAI,EAAE,UAAU,CAAC,aAAa,EAAE,SAAS,EAAE,IAAI,IAAI,QAAQ,CAAC,SAAS,CAAC,IAAI;KAC3E,CAAC;IAEF,sCAAsC;IACtC,MAAM,GAAG,GAAG;QACV,SAAS,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,SAAS;YACnC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAoC;QAC5D,IAAI,EAAE,UAAU,CAAC,GAAG,EAAE,IAAI,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI;KAChD,CAAC;IAEF,4BAA4B;IAC5B,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC;IAE1D,iDAAiD;IACjD,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,EAAE,aAAa,IAAI,QAAQ,CAAC,WAAW,CAAC;IAC3E,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,EAAE,eAAe,IAAI,QAAQ,CAAC,cAAc,CAAC;IACnF,MAAM,sBAAsB,GAC1B,UAAU,CAAC,IAAI,EAAE,yBAAyB,IAAI,QAAQ,CAAC,sBAAsB,CAAC;IAEhF,OAAO;QACL,IAAI;QACJ,SAAS;QACT,IAAI;QACJ,OAAO;QACP,QAAQ;QACR,SAAS;QACT,SAAS;QACT,GAAG;QACH,gBAAgB;QAChB,UAAU;QACV,WAAW;QACX,cAAc;QACd,SAAS;QACT,GAAG;QACH,QAAQ;QACR,WAAW;QACX,cAAc;QACd,sBAAsB;QACtB,cAAc,EAAE,cAAc,IAAI,SAAS;KAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -144,5 +144,5 @@ and limitations under the License.
|
|
|
144
144
|
* by Pedro Ladaria <pedro.ladaria@gmail.com>
|
|
145
145
|
* https://github.com/pladaria/reconnecting-websocket
|
|
146
146
|
* License MIT
|
|
147
|
-
*/var Tg=function(){if(typeof WebSocket<"u")return WebSocket},Ng=function(c){return typeof c<"u"&&!!c&&c.CLOSING===2},Ea={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0},Ag=(function(){function c(i,f,r){var h=this;r===void 0&&(r={}),this._listeners={error:[],message:[],open:[],close:[]},this._retryCount=-1,this._shouldReconnect=!0,this._connectLock=!1,this._binaryType="blob",this._closeCalled=!1,this._messageQueue=[],this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this._handleOpen=function(y){h._debug("open event");var T=h._options.minUptime,j=T===void 0?Ea.minUptime:T;clearTimeout(h._connectTimeout),h._uptimeTimeout=setTimeout(function(){return h._acceptOpen()},j),h._ws.binaryType=h._binaryType,h._messageQueue.forEach(function(A){return h._ws.send(A)}),h._messageQueue=[],h.onopen&&h.onopen(y),h._listeners.open.forEach(function(A){return h._callEventListener(y,A)})},this._handleMessage=function(y){h._debug("message event"),h.onmessage&&h.onmessage(y),h._listeners.message.forEach(function(T){return h._callEventListener(y,T)})},this._handleError=function(y){h._debug("error event",y.message),h._disconnect(void 0,y.message==="TIMEOUT"?"timeout":void 0),h.onerror&&h.onerror(y),h._debug("exec error listeners"),h._listeners.error.forEach(function(T){return h._callEventListener(y,T)}),h._connect()},this._handleClose=function(y){h._debug("close event"),h._clearTimeouts(),h._shouldReconnect&&h._connect(),h.onclose&&h.onclose(y),h._listeners.close.forEach(function(T){return h._callEventListener(y,T)})},this._url=i,this._protocols=f,this._options=r,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}return Object.defineProperty(c,"CONNECTING",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(c,"OPEN",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(c,"CLOSING",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(c,"CLOSED",{get:function(){return 3},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"CONNECTING",{get:function(){return c.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"OPEN",{get:function(){return c.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"CLOSING",{get:function(){return c.CLOSING},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"CLOSED",{get:function(){return c.CLOSED},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"binaryType",{get:function(){return this._ws?this._ws.binaryType:this._binaryType},set:function(i){this._binaryType=i,this._ws&&(this._ws.binaryType=i)},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"retryCount",{get:function(){return Math.max(this._retryCount,0)},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"bufferedAmount",{get:function(){var i=this._messageQueue.reduce(function(f,r){return typeof r=="string"?f+=r.length:r instanceof Blob?f+=r.size:f+=r.byteLength,f},0);return i+(this._ws?this._ws.bufferedAmount:0)},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"extensions",{get:function(){return this._ws?this._ws.extensions:""},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"protocol",{get:function(){return this._ws?this._ws.protocol:""},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"readyState",{get:function(){return this._ws?this._ws.readyState:this._options.startClosed?c.CLOSED:c.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"url",{get:function(){return this._ws?this._ws.url:""},enumerable:!0,configurable:!0}),c.prototype.close=function(i,f){if(i===void 0&&(i=1e3),this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(i,f)},c.prototype.reconnect=function(i,f){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(i,f),this._connect())},c.prototype.send=function(i){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",i),this._ws.send(i);else{var f=this._options.maxEnqueuedMessages,r=f===void 0?Ea.maxEnqueuedMessages:f;this._messageQueue.length<r&&(this._debug("enqueue",i),this._messageQueue.push(i))}},c.prototype.addEventListener=function(i,f){this._listeners[i]&&this._listeners[i].push(f)},c.prototype.dispatchEvent=function(i){var f,r,h=this._listeners[i.type];if(h)try{for(var y=bg(h),T=y.next();!T.done;T=y.next()){var j=T.value;this._callEventListener(i,j)}}catch(A){f={error:A}}finally{try{T&&!T.done&&(r=y.return)&&r.call(y)}finally{if(f)throw f.error}}return!0},c.prototype.removeEventListener=function(i,f){this._listeners[i]&&(this._listeners[i]=this._listeners[i].filter(function(r){return r!==f}))},c.prototype._debug=function(){for(var i=[],f=0;f<arguments.length;f++)i[f]=arguments[f];this._options.debug&&console.log.apply(console,Sg(["RWS>"],i))},c.prototype._getNextDelay=function(){var i=this._options,f=i.reconnectionDelayGrowFactor,r=f===void 0?Ea.reconnectionDelayGrowFactor:f,h=i.minReconnectionDelay,y=h===void 0?Ea.minReconnectionDelay:h,T=i.maxReconnectionDelay,j=T===void 0?Ea.maxReconnectionDelay:T,A=0;return this._retryCount>0&&(A=y*Math.pow(r,this._retryCount-1),A>j&&(A=j)),this._debug("next delay",A),A},c.prototype._wait=function(){var i=this;return new Promise(function(f){setTimeout(f,i._getNextDelay())})},c.prototype._getNextUrl=function(i){if(typeof i=="string")return Promise.resolve(i);if(typeof i=="function"){var f=i();if(typeof f=="string")return Promise.resolve(f);if(f.then)return f}throw Error("Invalid URL")},c.prototype._connect=function(){var i=this;if(!(this._connectLock||!this._shouldReconnect)){this._connectLock=!0;var f=this._options,r=f.maxRetries,h=r===void 0?Ea.maxRetries:r,y=f.connectionTimeout,T=y===void 0?Ea.connectionTimeout:y,j=f.WebSocket,A=j===void 0?Tg():j;if(this._retryCount>=h){this._debug("max retries reached",this._retryCount,">=",h);return}if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),!Ng(A))throw Error("No valid WebSocket class provided");this._wait().then(function(){return i._getNextUrl(i._url)}).then(function(x){i._closeCalled||(i._debug("connect",{url:x,protocols:i._protocols}),i._ws=i._protocols?new A(x,i._protocols):new A(x),i._ws.binaryType=i._binaryType,i._connectLock=!1,i._addListeners(),i._connectTimeout=setTimeout(function(){return i._handleTimeout()},T))})}},c.prototype._handleTimeout=function(){this._debug("timeout event"),this._handleError(new _g(Error("TIMEOUT"),this))},c.prototype._disconnect=function(i,f){if(i===void 0&&(i=1e3),this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(i,f),this._handleClose(new Eg(i,f,this))}catch{}}},c.prototype._acceptOpen=function(){this._debug("accept open"),this._retryCount=0},c.prototype._callEventListener=function(i,f){"handleEvent"in f?f.handleEvent(i):f(i)},c.prototype._removeListeners=function(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))},c.prototype._addListeners=function(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))},c.prototype._clearTimeouts=function(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)},c})();const jg=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;function Og(c={}){const{onMessage:i,enabled:f=!0}=c,[r,h]=ft.useState("connecting"),y=ft.useRef(null),T=ft.useRef(i);T.current=i,ft.useEffect(()=>{if(!f){h("disconnected");return}const A=new Ag(jg,[],{maxReconnectionDelay:15e3,minReconnectionDelay:1e3,reconnectionDelayGrowFactor:2,maxRetries:10});y.current=A;let x=!1;return A.addEventListener("open",()=>{x=!0,h("connected")}),A.addEventListener("close",()=>{A.readyState===WebSocket.CLOSED?h("disconnected"):h("reconnecting")}),A.addEventListener("message",H=>{var R;try{const X=JSON.parse(H.data);(R=T.current)==null||R.call(T,X)}catch{}}),()=>{A.close(),y.current=null,h("disconnected")}},[f]);const j=ft.useCallback(()=>{var A;(A=y.current)==null||A.reconnect()},[]);return{status:r,reconnect:j}}const zg={status:"",service:"",method:"",pathSearch:"",timeRange:"all"};function Dg(c,i){return!(!hy(c.timestamp,i.timeRange)||i.status&&c.status!==i.status||i.service&&c.service!==i.service||i.method&&c.method!==i.method||i.pathSearch&&!c.path.toLowerCase().includes(i.pathSearch.toLowerCase()))}function Cg({entry:c}){return d.jsx("div",{className:"border-t border-border-sub bg-surface-2 px-4 py-3 text-[12px]",children:d.jsxs("div",{className:"grid grid-cols-2 gap-x-6 gap-y-1",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-tertiary",children:"Target Domain: "}),d.jsx("span",{className:"font-mono text-primary",children:c.targetDomain})]}),d.jsxs("div",{children:[d.jsx("span",{className:"text-tertiary",children:"Response: "}),d.jsx("span",{className:"font-mono text-primary",children:c.responseCode??"—"})]}),c.credentialName&&d.jsxs("div",{children:[d.jsx("span",{className:"text-tertiary",children:"Credential: "}),d.jsx("span",{className:"font-mono text-primary",children:c.credentialName})]}),c.agentName&&d.jsxs("div",{children:[d.jsx("span",{className:"text-tertiary",children:"Agent: "}),d.jsx("span",{className:"font-mono text-primary",children:c.agentName}),c.agentTokenPrefix&&d.jsxs("span",{className:"ml-1 text-tertiary",children:["(",c.agentTokenPrefix,"...)"]})]}),c.channel==="mcp"&&d.jsxs("div",{children:[d.jsx("span",{className:"text-tertiary",children:"Channel: "}),d.jsx("span",{className:"font-mono text-gold",children:"MCP"})]}),c.blockedReason&&d.jsxs("div",{className:"col-span-2",children:[d.jsx("span",{className:"text-tertiary",children:"Block Reason: "}),d.jsx("span",{className:"font-mono text-blocked",children:c.blockedReason})]})]})})}function Mg(){const[c,i]=ft.useState([]),[f,r]=ft.useState(zg),[h,y]=ft.useState(!1),[T,j]=ft.useState(null),A=ft.useRef(null),{data:x}=fr({limit:200,refetchInterval:3e3});ft.useEffect(()=>{x&&x.length>0&&i(U=>{const $=new Set(U.map(Q=>Q.id)),K=x.filter(Q=>!$.has(Q.id));return K.length===0?U:[...K,...U].sort((Q,pt)=>new Date(pt.timestamp).getTime()-new Date(Q.timestamp).getTime()).slice(0,500)})},[x]);const H=ft.useCallback(U=>{i($=>$.some(K=>K.id===U.id)?$:[U,...$].slice(0,500))},[]),{status:R,reconnect:X}=Og({onMessage:H,enabled:!0});ft.useEffect(()=>{!h&&A.current&&(A.current.scrollTop=0)},[c.length,h]);const V=ft.useCallback(()=>{A.current&&A.current.scrollTop>50&&y(!0)},[]),at=c.filter(U=>Dg(U,f)),F=[...new Set(c.map(U=>U.service))].sort(),I=[...new Set(c.map(U=>U.method))].sort();return d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsx(vg,{status:R,onReconnect:X}),d.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[d.jsx(my,{value:f.timeRange,onChange:U=>r($=>({...$,timeRange:U}))}),d.jsxs("select",{className:"appearance-none rounded-md border border-border bg-surface-0 bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%239ca3af%22%20stroke-width%3D%222.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m6%209%206%206%206-6%22%2F%3E%3C%2Fsvg%3E')] bg-[length:12px] bg-[right_8px_center] bg-no-repeat pl-3 pr-8 py-1.5 text-[13px] text-primary focus:border-gold focus:outline-none",value:f.status,onChange:U=>r($=>({...$,status:U.target.value})),"aria-label":"Filter by status",children:[d.jsx("option",{value:"",children:"All Status"}),d.jsx("option",{value:"allowed",children:"Allowed"}),d.jsx("option",{value:"blocked",children:"Blocked"})]}),d.jsxs("select",{className:"appearance-none rounded-md border border-border bg-surface-0 bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%239ca3af%22%20stroke-width%3D%222.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m6%209%206%206%206-6%22%2F%3E%3C%2Fsvg%3E')] bg-[length:12px] bg-[right_8px_center] bg-no-repeat pl-3 pr-8 py-1.5 text-[13px] text-primary focus:border-gold focus:outline-none",value:f.service,onChange:U=>r($=>({...$,service:U.target.value})),"aria-label":"Filter by service",children:[d.jsx("option",{value:"",children:"All Services"}),F.map(U=>d.jsx("option",{value:U,children:U},U))]}),d.jsxs("select",{className:"appearance-none rounded-md border border-border bg-surface-0 bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%239ca3af%22%20stroke-width%3D%222.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m6%209%206%206%206-6%22%2F%3E%3C%2Fsvg%3E')] bg-[length:12px] bg-[right_8px_center] bg-no-repeat pl-3 pr-8 py-1.5 text-[13px] text-primary focus:border-gold focus:outline-none",value:f.method,onChange:U=>r($=>({...$,method:U.target.value})),"aria-label":"Filter by method",children:[d.jsx("option",{value:"",children:"All Methods"}),I.map(U=>d.jsx("option",{value:U,children:U},U))]}),d.jsx("input",{type:"text",placeholder:"Search path...",className:"rounded-md border border-border bg-surface-0 px-3 py-1.5 font-mono text-[13px] text-primary placeholder:text-tertiary focus:border-gold focus:outline-none",value:f.pathSearch,onChange:U=>r($=>({...$,pathSearch:U.target.value})),"aria-label":"Search by path"}),d.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[h&&d.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wider text-warning",children:"Paused"}),d.jsxs("button",{type:"button",onClick:()=>y(U=>!U),className:"flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-[13px] font-medium text-primary hover:bg-surface-3","aria-label":h?"Resume auto-scroll":"Pause auto-scroll",children:[h?d.jsx(tg,{size:14}):d.jsx(Ip,{size:14}),h?"Resume":"Pause"]})]})]}),d.jsx(Je,{children:d.jsx("div",{ref:A,className:"max-h-[calc(100vh-240px)] overflow-y-auto",onScroll:V,"aria-live":"polite","aria-label":"Request feed",children:at.length===0?d.jsx(Gu,{icon:ry,title:"No requests",description:"Requests will appear here in real-time"}):d.jsxs("table",{className:"w-full table-fixed","aria-label":"Request feed table",children:[d.jsx("thead",{className:"sticky top-0 z-10",children:d.jsxs("tr",{className:"bg-surface-2",children:[d.jsx("th",{className:"w-[100px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Time"}),d.jsx("th",{className:"w-[80px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Method"}),d.jsx("th",{className:"px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Path"}),d.jsx("th",{className:"w-[110px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Service"}),d.jsx("th",{className:"w-[60px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Source"}),d.jsx("th",{className:"w-[90px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Status"})]})}),d.jsx("tbody",{children:at.map((U,$)=>d.jsxs($m.Fragment,{children:[d.jsxs("tr",{className:`cursor-pointer border-t border-border-sub transition-colors duration-100 ${U.status==="blocked"?"bg-blocked-bg hover:bg-surface-3":$%2===0?"bg-surface-1 hover:bg-surface-3":"bg-surface-0 hover:bg-surface-3"}`,onClick:()=>j(T===U.id?null:U.id),onKeyDown:K=>{(K.key==="Enter"||K.key===" ")&&(K.preventDefault(),j(T===U.id?null:U.id))},tabIndex:0,role:"button","aria-expanded":T===U.id,children:[d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] text-tertiary",children:dy(U.timestamp)}),d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] font-medium text-primary",children:U.method}),d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] text-secondary",title:U.path,children:U.path}),d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] text-secondary",title:U.service,children:U.service}),d.jsx("td",{className:"px-3 py-2 text-[11px] uppercase tracking-wider text-tertiary",children:U.channel==="mcp"?d.jsx("span",{className:"rounded bg-surface-3 px-1.5 py-0.5 text-[10px] font-medium text-gold",children:"MCP"}):d.jsx("span",{className:"text-tertiary",children:"gate"})}),d.jsx("td",{className:"px-3 py-2",children:d.jsx(wn,{variant:U.status==="allowed"?"allowed":U.status==="system"?"system":"blocked"})})]}),T===U.id&&d.jsx("tr",{children:d.jsx("td",{colSpan:6,className:"p-0",children:d.jsx(Cg,{entry:U})})})]},U.id))})]})})})]})}function Bm(c){if(!c.expiresAt)return"active";const i=new Date(c.expiresAt).getTime(),f=Date.now();return i<f?"expired":i-f<10080*60*1e3?"expiring":"active"}function Rg(c){if(!c.expiresAt)return null;const i=new Date(c.expiresAt).getTime(),f=Date.now();if(i<f)return"Expired";const r=Math.ceil((i-f)/(1440*60*1e3));return r<=1?"Expires today":`Expires in ${r}d`}function Ug(){const{data:c,isLoading:i}=cr(),{data:f}=sr(),r=c??[],h=new Map;if(f)for(const j of f)for(const A of j.grants)h.set(A,(h.get(A)??0)+1);const y={active:0,expiring:0,expired:0};for(const j of r)y[Bm(j)]++;const T=r.length;return d.jsxs("div",{className:i?"opacity-60":"",children:[T>0&&d.jsxs(Je,{className:"mb-4",children:[d.jsxs("div",{className:"flex h-3 gap-0.5 overflow-hidden rounded-sm",children:[y.active>0&&d.jsx("div",{className:"bg-allowed",style:{width:`${y.active/T*100}%`}}),y.expiring>0&&d.jsx("div",{className:"bg-warning",style:{width:`${y.expiring/T*100}%`}}),y.expired>0&&d.jsx("div",{className:"bg-blocked",style:{width:`${y.expired/T*100}%`}})]}),d.jsxs("div",{className:"mt-2 flex gap-4 text-[12px]",children:[d.jsxs("span",{className:"text-allowed",children:[y.active," active"]}),y.expiring>0&&d.jsxs("span",{className:"text-warning",children:[y.expiring," expiring"]}),y.expired>0&&d.jsxs("span",{className:"text-blocked",children:[y.expired," expired"]})]})]}),r.length===0?d.jsx(Gu,{icon:nr,title:"No credentials stored",description:"Add credentials via the CLI to see them here"}):d.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(320px,1fr))] gap-4",children:r.map(j=>{const A=Bm(j),x=Rg(j),H=h.get(j.id)??0;return d.jsxs(Je,{children:[d.jsxs("div",{className:"flex items-start justify-between",children:[d.jsxs("div",{children:[d.jsx("h4",{className:"font-mono text-[14px] font-medium text-primary",children:j.name}),d.jsx("p",{className:"mt-0.5 text-[12px] text-secondary",children:j.service})]}),d.jsx(wn,{variant:A})]}),d.jsxs("div",{className:"mt-3 flex flex-col gap-1.5 text-[12px]",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Jp,{size:14,className:"text-tertiary","aria-hidden":"true"}),d.jsx("span",{className:"font-mono text-secondary",children:j.domains.length>0?j.domains.join(", "):"No domains"})]}),d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("span",{className:"text-tertiary",children:[j.authType," · ",H," agent",H!==1?"s":""]}),x&&d.jsx("span",{className:A==="expired"?"text-blocked":A==="expiring"?"text-warning":"text-tertiary",children:x})]}),d.jsxs("div",{className:"text-tertiary",children:["Created ",rr(j.createdAt)]})]})]},j.id)})})]})}function qg({agent:c}){return d.jsxs("div",{className:"border-t border-border-sub bg-surface-2 px-4 py-3 text-[12px]",children:[d.jsx("div",{className:"mb-2 text-[11px] font-medium uppercase tracking-wider text-secondary",children:"Granted Credentials"}),c.grants.length>0?d.jsx("div",{className:"flex flex-wrap gap-2",children:c.grants.map(i=>d.jsx("span",{className:"rounded-sm bg-surface-3 px-2 py-0.5 font-mono text-[12px] text-primary",children:i},i))}):d.jsx("span",{className:"text-tertiary",children:"No credential grants"}),c.rateLimit&&d.jsxs("div",{className:"mt-2",children:[d.jsx("span",{className:"text-tertiary",children:"Rate Limit: "}),d.jsx("span",{className:"font-mono text-primary",children:c.rateLimit})]})]})}function wg(){const{data:c,isLoading:i}=sr(),[f,r]=ft.useState(null),h=c??[];return!i&&h.length===0?d.jsx(Gu,{icon:ir,title:"No agents registered",description:"Register agents via the CLI to see them here"}):d.jsx(Je,{className:i?"opacity-60":"",children:d.jsx("div",{className:"overflow-x-auto",children:d.jsxs("table",{className:"w-full table-fixed border-collapse","aria-label":"Registered agents",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"bg-surface-2",children:[d.jsx("th",{className:"w-[180px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Agent"}),d.jsx("th",{className:"w-[140px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Token Prefix"}),d.jsx("th",{className:"w-[90px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Status"}),d.jsx("th",{className:"w-[80px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Grants"}),d.jsx("th",{className:"px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Created"})]})}),d.jsx("tbody",{children:h.map((y,T)=>d.jsxs($m.Fragment,{children:[d.jsxs("tr",{className:`cursor-pointer border-t border-border-sub transition-colors duration-100 ${T%2===0?"bg-surface-1 hover:bg-surface-3":"bg-surface-0 hover:bg-surface-3"}`,onClick:()=>r(f===y.id?null:y.id),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),r(f===y.id?null:y.id))},tabIndex:0,role:"button","aria-expanded":f===y.id,children:[d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[13px] font-medium text-primary",title:y.name,children:y.name}),d.jsxs("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] text-tertiary",children:[y.tokenPrefix,"..."]}),d.jsx("td",{className:"px-3 py-2",children:d.jsx(wn,{variant:"active"})}),d.jsx("td",{className:"px-3 py-2 text-[13px] text-secondary",children:y.grants.length}),d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 text-[12px] text-tertiary",children:rr(y.createdAt)})]}),f===y.id&&d.jsx("tr",{children:d.jsx("td",{colSpan:5,className:"p-0",children:d.jsx(qg,{agent:y})})})]},y.id))})]})})})}const Hg={domain_guard:"Domain Guard",rate_limit:"Rate Limit",body_inspection:"Body Scan",policy:"Policy",no_grant:"No Grant",no_credential:"No Credential",auth_failed:"Auth Failed"};function Bg({reason:c}){const i=Hg[c]??c;return d.jsx(wn,{variant:"warning",label:i})}function py(c,i,f){const r=new Blob([c],{type:f}),h=URL.createObjectURL(r),y=document.createElement("a");y.href=h,y.download=i,y.click(),URL.revokeObjectURL(h)}function Qg(c){const i=["timestamp","agent","service","method","path","block_reason","target_domain"],f=c.map(r=>[r.timestamp,r.agentName??"",r.service,r.method,r.path,r.blockedReason??"",r.targetDomain].join(","));py([i.join(","),...f].join(`
|
|
147
|
+
*/var Tg=function(){if(typeof WebSocket<"u")return WebSocket},Ng=function(c){return typeof c<"u"&&!!c&&c.CLOSING===2},Ea={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0},Ag=(function(){function c(i,f,r){var h=this;r===void 0&&(r={}),this._listeners={error:[],message:[],open:[],close:[]},this._retryCount=-1,this._shouldReconnect=!0,this._connectLock=!1,this._binaryType="blob",this._closeCalled=!1,this._messageQueue=[],this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this._handleOpen=function(y){h._debug("open event");var T=h._options.minUptime,j=T===void 0?Ea.minUptime:T;clearTimeout(h._connectTimeout),h._uptimeTimeout=setTimeout(function(){return h._acceptOpen()},j),h._ws.binaryType=h._binaryType,h._messageQueue.forEach(function(A){return h._ws.send(A)}),h._messageQueue=[],h.onopen&&h.onopen(y),h._listeners.open.forEach(function(A){return h._callEventListener(y,A)})},this._handleMessage=function(y){h._debug("message event"),h.onmessage&&h.onmessage(y),h._listeners.message.forEach(function(T){return h._callEventListener(y,T)})},this._handleError=function(y){h._debug("error event",y.message),h._disconnect(void 0,y.message==="TIMEOUT"?"timeout":void 0),h.onerror&&h.onerror(y),h._debug("exec error listeners"),h._listeners.error.forEach(function(T){return h._callEventListener(y,T)}),h._connect()},this._handleClose=function(y){h._debug("close event"),h._clearTimeouts(),h._shouldReconnect&&h._connect(),h.onclose&&h.onclose(y),h._listeners.close.forEach(function(T){return h._callEventListener(y,T)})},this._url=i,this._protocols=f,this._options=r,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}return Object.defineProperty(c,"CONNECTING",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(c,"OPEN",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(c,"CLOSING",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(c,"CLOSED",{get:function(){return 3},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"CONNECTING",{get:function(){return c.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"OPEN",{get:function(){return c.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"CLOSING",{get:function(){return c.CLOSING},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"CLOSED",{get:function(){return c.CLOSED},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"binaryType",{get:function(){return this._ws?this._ws.binaryType:this._binaryType},set:function(i){this._binaryType=i,this._ws&&(this._ws.binaryType=i)},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"retryCount",{get:function(){return Math.max(this._retryCount,0)},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"bufferedAmount",{get:function(){var i=this._messageQueue.reduce(function(f,r){return typeof r=="string"?f+=r.length:r instanceof Blob?f+=r.size:f+=r.byteLength,f},0);return i+(this._ws?this._ws.bufferedAmount:0)},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"extensions",{get:function(){return this._ws?this._ws.extensions:""},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"protocol",{get:function(){return this._ws?this._ws.protocol:""},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"readyState",{get:function(){return this._ws?this._ws.readyState:this._options.startClosed?c.CLOSED:c.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"url",{get:function(){return this._ws?this._ws.url:""},enumerable:!0,configurable:!0}),c.prototype.close=function(i,f){if(i===void 0&&(i=1e3),this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(i,f)},c.prototype.reconnect=function(i,f){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(i,f),this._connect())},c.prototype.send=function(i){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",i),this._ws.send(i);else{var f=this._options.maxEnqueuedMessages,r=f===void 0?Ea.maxEnqueuedMessages:f;this._messageQueue.length<r&&(this._debug("enqueue",i),this._messageQueue.push(i))}},c.prototype.addEventListener=function(i,f){this._listeners[i]&&this._listeners[i].push(f)},c.prototype.dispatchEvent=function(i){var f,r,h=this._listeners[i.type];if(h)try{for(var y=bg(h),T=y.next();!T.done;T=y.next()){var j=T.value;this._callEventListener(i,j)}}catch(A){f={error:A}}finally{try{T&&!T.done&&(r=y.return)&&r.call(y)}finally{if(f)throw f.error}}return!0},c.prototype.removeEventListener=function(i,f){this._listeners[i]&&(this._listeners[i]=this._listeners[i].filter(function(r){return r!==f}))},c.prototype._debug=function(){for(var i=[],f=0;f<arguments.length;f++)i[f]=arguments[f];this._options.debug&&console.log.apply(console,Sg(["RWS>"],i))},c.prototype._getNextDelay=function(){var i=this._options,f=i.reconnectionDelayGrowFactor,r=f===void 0?Ea.reconnectionDelayGrowFactor:f,h=i.minReconnectionDelay,y=h===void 0?Ea.minReconnectionDelay:h,T=i.maxReconnectionDelay,j=T===void 0?Ea.maxReconnectionDelay:T,A=0;return this._retryCount>0&&(A=y*Math.pow(r,this._retryCount-1),A>j&&(A=j)),this._debug("next delay",A),A},c.prototype._wait=function(){var i=this;return new Promise(function(f){setTimeout(f,i._getNextDelay())})},c.prototype._getNextUrl=function(i){if(typeof i=="string")return Promise.resolve(i);if(typeof i=="function"){var f=i();if(typeof f=="string")return Promise.resolve(f);if(f.then)return f}throw Error("Invalid URL")},c.prototype._connect=function(){var i=this;if(!(this._connectLock||!this._shouldReconnect)){this._connectLock=!0;var f=this._options,r=f.maxRetries,h=r===void 0?Ea.maxRetries:r,y=f.connectionTimeout,T=y===void 0?Ea.connectionTimeout:y,j=f.WebSocket,A=j===void 0?Tg():j;if(this._retryCount>=h){this._debug("max retries reached",this._retryCount,">=",h);return}if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),!Ng(A))throw Error("No valid WebSocket class provided");this._wait().then(function(){return i._getNextUrl(i._url)}).then(function(x){i._closeCalled||(i._debug("connect",{url:x,protocols:i._protocols}),i._ws=i._protocols?new A(x,i._protocols):new A(x),i._ws.binaryType=i._binaryType,i._connectLock=!1,i._addListeners(),i._connectTimeout=setTimeout(function(){return i._handleTimeout()},T))})}},c.prototype._handleTimeout=function(){this._debug("timeout event"),this._handleError(new _g(Error("TIMEOUT"),this))},c.prototype._disconnect=function(i,f){if(i===void 0&&(i=1e3),this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(i,f),this._handleClose(new Eg(i,f,this))}catch{}}},c.prototype._acceptOpen=function(){this._debug("accept open"),this._retryCount=0},c.prototype._callEventListener=function(i,f){"handleEvent"in f?f.handleEvent(i):f(i)},c.prototype._removeListeners=function(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))},c.prototype._addListeners=function(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))},c.prototype._clearTimeouts=function(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)},c})();const jg=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;function Og(c={}){const{onMessage:i,enabled:f=!0}=c,[r,h]=ft.useState("connecting"),y=ft.useRef(null),T=ft.useRef(i);T.current=i,ft.useEffect(()=>{if(!f){h("disconnected");return}const A=new Ag(jg,[],{maxReconnectionDelay:15e3,minReconnectionDelay:1e3,reconnectionDelayGrowFactor:2,maxRetries:10});y.current=A;let x=!1;return A.addEventListener("open",()=>{x=!0,h("connected")}),A.addEventListener("close",()=>{A.readyState===WebSocket.CLOSED?h("disconnected"):h("reconnecting")}),A.addEventListener("message",H=>{var R;try{const X=JSON.parse(H.data);(R=T.current)==null||R.call(T,X)}catch{}}),()=>{A.close(),y.current=null,h("disconnected")}},[f]);const j=ft.useCallback(()=>{var A;(A=y.current)==null||A.reconnect()},[]);return{status:r,reconnect:j}}const zg={status:"",service:"",method:"",pathSearch:"",timeRange:"all"};function Dg(c,i){return!(!hy(c.timestamp,i.timeRange)||i.status&&c.status!==i.status||i.service&&c.service!==i.service||i.method&&c.method!==i.method||i.pathSearch&&!c.path.toLowerCase().includes(i.pathSearch.toLowerCase()))}function Cg({entry:c}){return d.jsx("div",{className:"border-t border-border-sub bg-surface-2 px-4 py-3 text-[12px]",children:d.jsxs("div",{className:"grid grid-cols-2 gap-x-6 gap-y-1",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-tertiary",children:"Target Domain: "}),d.jsx("span",{className:"font-mono text-primary",children:c.targetDomain})]}),d.jsxs("div",{children:[d.jsx("span",{className:"text-tertiary",children:"Response: "}),d.jsx("span",{className:"font-mono text-primary",children:c.responseCode??"—"})]}),c.credentialName&&d.jsxs("div",{children:[d.jsx("span",{className:"text-tertiary",children:"Credential: "}),d.jsx("span",{className:"font-mono text-primary",children:c.credentialName})]}),c.agentName&&d.jsxs("div",{children:[d.jsx("span",{className:"text-tertiary",children:"Agent: "}),d.jsx("span",{className:"font-mono text-primary",children:c.agentName}),c.agentTokenPrefix&&d.jsxs("span",{className:"ml-1 text-tertiary",children:["(",c.agentTokenPrefix,"...)"]})]}),c.channel==="mcp"&&d.jsxs("div",{children:[d.jsx("span",{className:"text-tertiary",children:"Channel: "}),d.jsx("span",{className:"font-mono text-gold",children:"MCP"})]}),c.blockedReason&&d.jsxs("div",{className:"col-span-2",children:[d.jsx("span",{className:"text-tertiary",children:"Block Reason: "}),d.jsx("span",{className:"font-mono text-blocked",children:c.blockedReason})]})]})})}function Mg(){const[c,i]=ft.useState([]),[f,r]=ft.useState(zg),[h,y]=ft.useState(!1),[T,j]=ft.useState(null),A=ft.useRef(null),{data:x}=fr({limit:200,refetchInterval:3e3});ft.useEffect(()=>{x&&x.length>0&&i(U=>{const $=new Set(U.map(Q=>Q.id)),K=x.filter(Q=>!$.has(Q.id));return K.length===0?U:[...K,...U].sort((Q,pt)=>new Date(pt.timestamp).getTime()-new Date(Q.timestamp).getTime()).slice(0,500)})},[x]);const H=ft.useCallback(U=>{i($=>$.some(K=>K.id===U.id)?$:[U,...$].slice(0,500))},[]),{status:R,reconnect:X}=Og({onMessage:H,enabled:!0});ft.useEffect(()=>{!h&&A.current&&(A.current.scrollTop=0)},[c.length,h]);const V=ft.useCallback(()=>{A.current&&A.current.scrollTop>50&&y(!0)},[]),at=c.filter(U=>Dg(U,f)),F=[...new Set(c.map(U=>U.service))].sort(),I=[...new Set(c.map(U=>U.method))].sort();return d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsx(vg,{status:R,onReconnect:X}),d.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[d.jsx(my,{value:f.timeRange,onChange:U=>r($=>({...$,timeRange:U}))}),d.jsxs("select",{className:"appearance-none rounded-md border border-border bg-surface-0 bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%239ca3af%22%20stroke-width%3D%222.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m6%209%206%206%206-6%22%2F%3E%3C%2Fsvg%3E')] bg-[length:12px] bg-[right_8px_center] bg-no-repeat pl-3 pr-8 py-1.5 text-[13px] text-primary focus:border-gold focus:outline-none",value:f.status,onChange:U=>r($=>({...$,status:U.target.value})),"aria-label":"Filter by status",children:[d.jsx("option",{value:"",children:"All Status"}),d.jsx("option",{value:"allowed",children:"Allowed"}),d.jsx("option",{value:"blocked",children:"Blocked"})]}),d.jsxs("select",{className:"appearance-none rounded-md border border-border bg-surface-0 bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%239ca3af%22%20stroke-width%3D%222.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m6%209%206%206%206-6%22%2F%3E%3C%2Fsvg%3E')] bg-[length:12px] bg-[right_8px_center] bg-no-repeat pl-3 pr-8 py-1.5 text-[13px] text-primary focus:border-gold focus:outline-none",value:f.service,onChange:U=>r($=>({...$,service:U.target.value})),"aria-label":"Filter by service",children:[d.jsx("option",{value:"",children:"All Services"}),F.map(U=>d.jsx("option",{value:U,children:U},U))]}),d.jsxs("select",{className:"appearance-none rounded-md border border-border bg-surface-0 bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%239ca3af%22%20stroke-width%3D%222.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m6%209%206%206%206-6%22%2F%3E%3C%2Fsvg%3E')] bg-[length:12px] bg-[right_8px_center] bg-no-repeat pl-3 pr-8 py-1.5 text-[13px] text-primary focus:border-gold focus:outline-none",value:f.method,onChange:U=>r($=>({...$,method:U.target.value})),"aria-label":"Filter by method",children:[d.jsx("option",{value:"",children:"All Methods"}),I.map(U=>d.jsx("option",{value:U,children:U},U))]}),d.jsx("input",{type:"text",placeholder:"Search path...",className:"rounded-md border border-border bg-surface-0 px-3 py-1.5 font-mono text-[13px] text-primary placeholder:text-tertiary focus:border-gold focus:outline-none",value:f.pathSearch,onChange:U=>r($=>({...$,pathSearch:U.target.value})),"aria-label":"Search by path"}),d.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[h&&d.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wider text-warning",children:"Paused"}),d.jsxs("button",{type:"button",onClick:()=>y(U=>!U),className:"flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-[13px] font-medium text-primary hover:bg-surface-3","aria-label":h?"Resume auto-scroll":"Pause auto-scroll",children:[h?d.jsx(tg,{size:14}):d.jsx(Ip,{size:14}),h?"Resume":"Pause"]})]})]}),d.jsx(Je,{children:d.jsx("div",{ref:A,className:"max-h-[calc(100vh-240px)] overflow-y-auto",onScroll:V,"aria-live":"polite","aria-label":"Request feed",children:at.length===0?d.jsx(Gu,{icon:ry,title:"No requests",description:"Requests will appear here in real-time"}):d.jsxs("table",{className:"w-full table-fixed","aria-label":"Request feed table",children:[d.jsx("thead",{className:"sticky top-0 z-10",children:d.jsxs("tr",{className:"bg-surface-2",children:[d.jsx("th",{className:"w-[100px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Time"}),d.jsx("th",{className:"w-[80px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Method"}),d.jsx("th",{className:"px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Path"}),d.jsx("th",{className:"w-[110px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Service"}),d.jsx("th",{className:"w-[60px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Source"}),d.jsx("th",{className:"w-[90px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Status"})]})}),d.jsx("tbody",{children:at.map((U,$)=>d.jsxs($m.Fragment,{children:[d.jsxs("tr",{className:`cursor-pointer border-t border-border-sub transition-colors duration-100 ${U.status==="blocked"?"bg-blocked-bg hover:bg-surface-3":$%2===0?"bg-surface-1 hover:bg-surface-3":"bg-surface-0 hover:bg-surface-3"}`,onClick:()=>j(T===U.id?null:U.id),onKeyDown:K=>{(K.key==="Enter"||K.key===" ")&&(K.preventDefault(),j(T===U.id?null:U.id))},tabIndex:0,role:"button","aria-expanded":T===U.id,children:[d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] text-tertiary",children:dy(U.timestamp)}),d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] font-medium text-primary",children:U.method}),d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] text-secondary",title:U.path,children:U.path}),d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] text-secondary",title:U.service,children:U.service}),d.jsx("td",{className:"px-3 py-2 text-[11px] uppercase tracking-wider text-tertiary",children:U.channel==="mcp"?d.jsx("span",{className:"rounded bg-surface-3 px-1.5 py-0.5 text-[10px] font-medium text-gold",children:"MCP"}):d.jsx("span",{className:"text-tertiary",children:"gate"})}),d.jsx("td",{className:"px-3 py-2",children:d.jsx(wn,{variant:U.status==="allowed"?"allowed":U.status==="system"?"system":"blocked"})})]}),T===U.id&&d.jsx("tr",{children:d.jsx("td",{colSpan:6,className:"p-0",children:d.jsx(Cg,{entry:U})})})]},U.id))})]})})})]})}function Bm(c){if(!c.expiresAt)return"active";const i=new Date(c.expiresAt).getTime(),f=Date.now();return i<f?"expired":i-f<10080*60*1e3?"expiring":"active"}function Rg(c){if(!c.expiresAt)return null;const i=new Date(c.expiresAt).getTime(),f=Date.now();if(i<f)return"Expired";const r=Math.ceil((i-f)/(1440*60*1e3));return r<=1?"Expires today":`Expires in ${r}d`}function Ug(){const{data:c,isLoading:i}=cr(),{data:f}=sr(),r=c??[],h=new Map;if(f)for(const j of f)for(const A of j.grants)h.set(A,(h.get(A)??0)+1);const y={active:0,expiring:0,expired:0};for(const j of r)y[Bm(j)]++;const T=r.length;return d.jsxs("div",{className:i?"opacity-60":"",children:[T>0&&d.jsxs(Je,{className:"mb-4",children:[d.jsxs("div",{className:"flex h-3 gap-0.5 overflow-hidden rounded-sm",children:[y.active>0&&d.jsx("div",{className:"bg-allowed",style:{width:`${y.active/T*100}%`}}),y.expiring>0&&d.jsx("div",{className:"bg-warning",style:{width:`${y.expiring/T*100}%`}}),y.expired>0&&d.jsx("div",{className:"bg-blocked",style:{width:`${y.expired/T*100}%`}})]}),d.jsxs("div",{className:"mt-2 flex gap-4 text-[12px]",children:[d.jsxs("span",{className:"text-allowed",children:[y.active," active"]}),y.expiring>0&&d.jsxs("span",{className:"text-warning",children:[y.expiring," expiring"]}),y.expired>0&&d.jsxs("span",{className:"text-blocked",children:[y.expired," expired"]})]})]}),r.length===0?d.jsx(Gu,{icon:nr,title:"No credentials stored",description:"Add credentials via the CLI to see them here"}):d.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(320px,1fr))] gap-4",children:r.map(j=>{const A=Bm(j),x=Rg(j),H=h.get(j.id)??0;return d.jsxs(Je,{children:[d.jsxs("div",{className:"flex items-start justify-between",children:[d.jsxs("div",{children:[d.jsx("h4",{className:"font-mono text-[14px] font-medium text-primary",children:j.name}),d.jsx("p",{className:"mt-0.5 text-[12px] text-secondary",children:j.service})]}),d.jsx(wn,{variant:A})]}),d.jsxs("div",{className:"mt-3 flex flex-col gap-1.5 text-[12px]",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Jp,{size:14,className:"text-tertiary","aria-hidden":"true"}),d.jsx("span",{className:"font-mono text-secondary",children:j.domains.length>0?j.domains.join(", "):"No domains"})]}),d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("span",{className:"text-tertiary",children:[j.authType," · ",H," agent",H!==1?"s":""]}),x&&d.jsx("span",{className:A==="expired"?"text-blocked":A==="expiring"?"text-warning":"text-tertiary",children:x})]}),d.jsxs("div",{className:"text-tertiary",children:["Created ",rr(j.createdAt)]})]})]},j.id)})})]})}function qg({agent:c}){return d.jsxs("div",{className:"border-t border-border-sub bg-surface-2 px-4 py-3 text-[12px]",children:[d.jsx("div",{className:"mb-2 text-[11px] font-medium uppercase tracking-wider text-secondary",children:"Granted Credentials"}),c.grants.length>0?d.jsx("div",{className:"flex flex-wrap gap-2",children:c.grants.map(i=>d.jsx("span",{className:"rounded-sm bg-surface-3 px-2 py-0.5 font-mono text-[12px] text-primary",children:i},i))}):d.jsx("span",{className:"text-tertiary",children:"No credential grants"}),c.rateLimit&&d.jsxs("div",{className:"mt-2",children:[d.jsx("span",{className:"text-tertiary",children:"Rate Limit: "}),d.jsx("span",{className:"font-mono text-primary",children:c.rateLimit})]})]})}function wg(){const{data:c,isLoading:i}=sr(),[f,r]=ft.useState(null),h=c??[];return!i&&h.length===0?d.jsx(Gu,{icon:ir,title:"No agents registered",description:"Register agents via the CLI to see them here"}):d.jsx(Je,{className:i?"opacity-60":"",children:d.jsx("div",{className:"overflow-x-auto",children:d.jsxs("table",{className:"w-full table-fixed border-collapse","aria-label":"Registered agents",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"bg-surface-2",children:[d.jsx("th",{className:"w-[180px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Agent"}),d.jsx("th",{className:"w-[140px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Token Prefix"}),d.jsx("th",{className:"w-[90px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Status"}),d.jsx("th",{className:"w-[80px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Grants"}),d.jsx("th",{className:"px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Created"})]})}),d.jsx("tbody",{children:h.map((y,T)=>d.jsxs($m.Fragment,{children:[d.jsxs("tr",{className:`cursor-pointer border-t border-border-sub transition-colors duration-100 ${T%2===0?"bg-surface-1 hover:bg-surface-3":"bg-surface-0 hover:bg-surface-3"}`,onClick:()=>r(f===y.id?null:y.id),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),r(f===y.id?null:y.id))},tabIndex:0,role:"button","aria-expanded":f===y.id,children:[d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[13px] font-medium text-primary",title:y.name,children:y.name}),d.jsxs("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] text-tertiary",children:[y.tokenPrefix,"..."]}),d.jsx("td",{className:"px-3 py-2",children:d.jsx(wn,{variant:"active"})}),d.jsx("td",{className:"px-3 py-2 text-[13px] text-secondary",children:y.grants.length}),d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 text-[12px] text-tertiary",children:rr(y.createdAt)})]}),f===y.id&&d.jsx("tr",{children:d.jsx("td",{colSpan:5,className:"p-0",children:d.jsx(qg,{agent:y})})})]},y.id))})]})})})}const Hg={no_credential:"No Credential",credential_expired:"Expired",credential_scope:"Scope Denied",agent_auth_missing:"No Auth",agent_auth_invalid:"Auth Failed",agent_scope:"No Grant",policy_violation:"Policy",policy_rate_limit:"Policy Rate Limit",agent_rate_limit:"Agent Rate Limit",credential_rate_limit:"Rate Limit",domain_guard:"Domain Guard",body_inspection:"Body Scan",body_too_large:"Body Too Large",agent_connection_limit:"Connection Limit"};function Bg({reason:c}){const i=Hg[c]??c;return d.jsx(wn,{variant:"warning",label:i})}function py(c,i,f){const r=new Blob([c],{type:f}),h=URL.createObjectURL(r),y=document.createElement("a");y.href=h,y.download=i,y.click(),URL.revokeObjectURL(h)}function Qg(c){const i=["timestamp","agent","service","method","path","block_reason","target_domain"],f=c.map(r=>[r.timestamp,r.agentName??"",r.service,r.method,r.path,r.blockedReason??"",r.targetDomain].join(","));py([i.join(","),...f].join(`
|
|
148
148
|
`),"aegis-blocked.csv","text/csv")}function Lg(c){py(JSON.stringify(c,null,2),"aegis-blocked.json","application/json")}function Gg(){const{data:c,isLoading:i}=fr({status:"blocked",limit:200,refetchInterval:1e4}),[f,r]=ft.useState(""),[h,y]=ft.useState("all"),T=c??[],j=T.filter(x=>hy(x.timestamp,h)).filter(x=>!f||x.service===f),A=[...new Set(T.map(x=>x.service))].sort();return d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[d.jsx(my,{value:h,onChange:y}),d.jsxs("select",{className:"appearance-none rounded-md border border-border bg-surface-0 bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%239ca3af%22%20stroke-width%3D%222.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m6%209%206%206%206-6%22%2F%3E%3C%2Fsvg%3E')] bg-[length:12px] bg-[right_8px_center] bg-no-repeat pl-3 pr-8 py-1.5 text-[13px] text-primary focus:border-gold focus:outline-none",value:f,onChange:x=>r(x.target.value),"aria-label":"Filter by service",children:[d.jsx("option",{value:"",children:"All Services"}),A.map(x=>d.jsx("option",{value:x,children:x},x))]}),d.jsxs("span",{className:"text-[13px] text-secondary",children:[j.length," blocked request",j.length!==1?"s":""]}),d.jsxs("div",{className:"ml-auto flex gap-2",children:[d.jsxs("button",{type:"button",onClick:()=>Qg(j),disabled:j.length===0,className:"flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-[13px] font-medium text-primary hover:bg-surface-3 disabled:text-disabled disabled:hover:bg-transparent","aria-label":"Export as CSV",children:[d.jsx(wm,{size:14,"aria-hidden":"true"}),"CSV"]}),d.jsxs("button",{type:"button",onClick:()=>Lg(j),disabled:j.length===0,className:"flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-[13px] font-medium text-primary hover:bg-surface-3 disabled:text-disabled disabled:hover:bg-transparent","aria-label":"Export as JSON",children:[d.jsx(wm,{size:14,"aria-hidden":"true"}),"JSON"]})]})]}),d.jsx(Je,{className:i?"opacity-60":"",children:j.length===0?d.jsx(Gu,{icon:ur,title:"No blocked requests",description:"Blocked requests will appear here when Gate denies a request"}):d.jsx("div",{className:"overflow-x-auto",children:d.jsxs("table",{className:"w-full table-fixed border-collapse","aria-label":"Blocked requests",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"bg-surface-2",children:[d.jsx("th",{className:"w-[140px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Time"}),d.jsx("th",{className:"w-[100px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Agent"}),d.jsx("th",{className:"w-[100px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Service"}),d.jsx("th",{className:"w-[80px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Method"}),d.jsx("th",{className:"px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Path"}),d.jsx("th",{className:"w-[160px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Reason"})]})}),d.jsx("tbody",{children:j.map((x,H)=>d.jsxs("tr",{className:`border-t border-border-sub transition-colors duration-100 ${H%2===0?"bg-blocked-bg hover:bg-surface-3":"bg-surface-0 hover:bg-surface-3"}`,children:[d.jsx("td",{className:"overflow-hidden truncate whitespace-nowrap px-3 py-2 font-mono text-[12px] text-tertiary",children:dy(x.timestamp,!0)}),d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] text-secondary",children:x.agentName??"—"}),d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] text-secondary",title:x.service,children:x.service}),d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] font-medium text-primary",children:x.method}),d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] text-secondary",title:x.path,children:x.path}),d.jsx("td",{className:"px-3 py-2",children:x.blockedReason?d.jsx(Bg,{reason:x.blockedReason}):d.jsx("span",{className:"text-[12px] text-tertiary",children:"—"})})]},x.id))})]})})})]})}function Yg(){return Rn({queryKey:qn.users.all,queryFn:()=>Un.users(),refetchInterval:3e4})}const Qm={admin:{variant:"warning",label:"ADMIN"},operator:{variant:"info",label:"OPERATOR"},viewer:{variant:"allowed",label:"VIEWER"}};function Xg(){const{data:c,isLoading:i}=Yg(),f=c??[];return!i&&f.length===0?d.jsx(Gu,{icon:oy,title:"No users registered",description:"RBAC is in bootstrap mode — add a user via the CLI to enable access control"}):d.jsx(Je,{className:i?"opacity-60":"",children:d.jsx("div",{className:"overflow-x-auto",children:d.jsxs("table",{className:"w-full table-fixed border-collapse","aria-label":"RBAC users",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"bg-surface-2",children:[d.jsx("th",{className:"w-[180px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Name"}),d.jsx("th",{className:"w-[120px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Role"}),d.jsx("th",{className:"w-[160px] px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Token Prefix"}),d.jsx("th",{className:"px-3 py-2 text-left text-[12px] font-normal uppercase tracking-wider text-secondary",children:"Created"})]})}),d.jsx("tbody",{children:f.map((r,h)=>d.jsxs("tr",{className:`border-t border-border-sub transition-colors duration-100 ${h%2===0?"bg-surface-1 hover:bg-surface-3":"bg-surface-0 hover:bg-surface-3"}`,children:[d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[13px] font-medium text-primary",title:r.name,children:r.name}),d.jsx("td",{className:"px-3 py-2",children:d.jsx(wn,{variant:Qm[r.role].variant,label:Qm[r.role].label})}),d.jsxs("td",{className:"overflow-hidden truncate px-3 py-2 font-mono text-[12px] text-tertiary",children:[r.tokenPrefix,"..."]}),d.jsx("td",{className:"overflow-hidden truncate px-3 py-2 text-[12px] text-tertiary",children:rr(r.createdAt)})]},r.id))})]})})})}function Zg(){const[c,i]=ft.useState("overview");function f(){switch(c){case"overview":return d.jsx(yg,{});case"requests":return d.jsx(Mg,{});case"credentials":return d.jsx(Ug,{});case"agents":return d.jsx(wg,{});case"users":return d.jsx(Xg,{});case"blocked":return d.jsx(Gg,{})}}return d.jsxs("div",{className:"flex h-screen bg-surface-0 text-primary",children:[d.jsx(ig,{currentView:c,onNavigate:i}),d.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[d.jsx(rg,{currentView:c}),d.jsx("main",{className:"flex-1 overflow-y-auto p-6",children:d.jsx("div",{className:"mx-auto",style:{maxWidth:"var(--content-max-width)"},children:f()})})]})]})}const Lm=document.getElementById("root");Lm&&$v.createRoot(Lm).render(d.jsx(ft.StrictMode,{children:d.jsx(Ep,{client:qp,children:d.jsx(Zg,{})})}));
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Aegis Dashboard</title>
|
|
7
7
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-Cah0_BKk.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-CpMruPNh.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body class="bg-surface-0 text-primary antialiased">
|
package/dist/db.d.ts
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import Database from 'better-sqlite3';
|
|
1
|
+
import Database from 'better-sqlite3-multiple-ciphers';
|
|
2
2
|
import type { AegisConfig } from './config.js';
|
|
3
|
+
/**
|
|
4
|
+
* Derive a 256-bit database encryption key from the master key and salt.
|
|
5
|
+
* Uses a separate derivation context ("-db" suffix on salt) so the DB key
|
|
6
|
+
* is independent from the credential encryption key, even though both
|
|
7
|
+
* originate from the same master secret.
|
|
8
|
+
*/
|
|
9
|
+
export declare function deriveDbKey(masterKey: string, salt: string): Buffer;
|
|
3
10
|
/**
|
|
4
11
|
* Open the SQLite database for the active vault.
|
|
5
12
|
* Uses VaultManager to resolve vault name → database path.
|
|
6
13
|
* Falls back to `.aegis/aegis.db` only if no vaults exist (pre-init state).
|
|
14
|
+
*
|
|
15
|
+
* When a master key is available, the database is encrypted at rest using
|
|
16
|
+
* ChaCha20-Poly1305 (sqleet cipher via SQLite3MultipleCiphers). The encryption
|
|
17
|
+
* key is derived from the master key using PBKDF2-SHA512 with a separate
|
|
18
|
+
* salt context ("-db") to isolate it from credential encryption keys.
|
|
7
19
|
*/
|
|
8
20
|
export declare function getDb(config: AegisConfig): Database.Database;
|
|
9
21
|
/**
|
package/dist/db.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM/C;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAC,QAAQ,CAyC5D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAIxD;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CA2BnD"}
|
package/dist/db.js
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
|
+
import * as crypto from 'node:crypto';
|
|
1
2
|
import * as fs from 'node:fs';
|
|
2
3
|
import * as path from 'node:path';
|
|
3
|
-
import Database from 'better-sqlite3';
|
|
4
|
+
import Database from 'better-sqlite3-multiple-ciphers';
|
|
4
5
|
import { VaultManager } from './vault/vault-manager.js';
|
|
6
|
+
const DB_KEY_LENGTH = 32;
|
|
7
|
+
const DB_KEY_ITERATIONS = 210_000;
|
|
8
|
+
/**
|
|
9
|
+
* Derive a 256-bit database encryption key from the master key and salt.
|
|
10
|
+
* Uses a separate derivation context ("-db" suffix on salt) so the DB key
|
|
11
|
+
* is independent from the credential encryption key, even though both
|
|
12
|
+
* originate from the same master secret.
|
|
13
|
+
*/
|
|
14
|
+
export function deriveDbKey(masterKey, salt) {
|
|
15
|
+
return crypto.pbkdf2Sync(masterKey, `${salt}-db`, DB_KEY_ITERATIONS, DB_KEY_LENGTH, 'sha512');
|
|
16
|
+
}
|
|
5
17
|
/**
|
|
6
18
|
* Open the SQLite database for the active vault.
|
|
7
19
|
* Uses VaultManager to resolve vault name → database path.
|
|
8
20
|
* Falls back to `.aegis/aegis.db` only if no vaults exist (pre-init state).
|
|
21
|
+
*
|
|
22
|
+
* When a master key is available, the database is encrypted at rest using
|
|
23
|
+
* ChaCha20-Poly1305 (sqleet cipher via SQLite3MultipleCiphers). The encryption
|
|
24
|
+
* key is derived from the master key using PBKDF2-SHA512 with a separate
|
|
25
|
+
* salt context ("-db") to isolate it from credential encryption keys.
|
|
9
26
|
*/
|
|
10
27
|
export function getDb(config) {
|
|
11
28
|
const manager = new VaultManager(config.dataDir);
|
|
@@ -24,6 +41,14 @@ export function getDb(config) {
|
|
|
24
41
|
}
|
|
25
42
|
try {
|
|
26
43
|
const db = new Database(dbPath);
|
|
44
|
+
// Encrypt the database when a master key is available.
|
|
45
|
+
// Pre-init commands (doctor, init) run without a master key — those
|
|
46
|
+
// databases remain unencrypted (and are replaced during init anyway).
|
|
47
|
+
if (config.masterKey) {
|
|
48
|
+
const salt = info ? info.salt : config.salt;
|
|
49
|
+
const dbKey = deriveDbKey(config.masterKey, salt);
|
|
50
|
+
db.pragma(`key="x'${dbKey.toString('hex')}'"`);
|
|
51
|
+
}
|
|
27
52
|
db.pragma('journal_mode = WAL');
|
|
28
53
|
return db;
|
|
29
54
|
}
|
|
@@ -46,7 +71,42 @@ export function getVaultSalt(config) {
|
|
|
46
71
|
return info ? info.salt : config.salt;
|
|
47
72
|
}
|
|
48
73
|
export function migrate(db) {
|
|
74
|
+
// ── Schema versioning ────────────────────────────────────────────
|
|
75
|
+
// Create the version table if it doesn't exist. This is always safe
|
|
76
|
+
// because CREATE TABLE IF NOT EXISTS is idempotent.
|
|
49
77
|
db.exec(`
|
|
78
|
+
CREATE TABLE IF NOT EXISTS schema_version (
|
|
79
|
+
version INTEGER PRIMARY KEY,
|
|
80
|
+
applied_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
81
|
+
);
|
|
82
|
+
`);
|
|
83
|
+
const currentVersion = db.prepare('SELECT COALESCE(MAX(version), 0) AS v FROM schema_version').get().v;
|
|
84
|
+
// Run all migrations that haven't been applied yet
|
|
85
|
+
const pending = MIGRATIONS.filter((m) => m.version > currentVersion);
|
|
86
|
+
if (pending.length === 0)
|
|
87
|
+
return;
|
|
88
|
+
const runMigrations = db.transaction(() => {
|
|
89
|
+
for (const migration of pending) {
|
|
90
|
+
db.exec(migration.sql);
|
|
91
|
+
db.prepare('INSERT INTO schema_version (version) VALUES (?)').run(migration.version);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
runMigrations();
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Ordered list of schema migrations. Each migration is applied exactly once.
|
|
98
|
+
* The version number must be strictly increasing.
|
|
99
|
+
*
|
|
100
|
+
* To add a new migration:
|
|
101
|
+
* 1. Add a new entry with the next version number
|
|
102
|
+
* 2. Write the SQL (ALTER TABLE, CREATE TABLE, CREATE INDEX, etc.)
|
|
103
|
+
* 3. Run `yarn build && yarn test` to verify
|
|
104
|
+
*/
|
|
105
|
+
const MIGRATIONS = [
|
|
106
|
+
{
|
|
107
|
+
// v1: Baseline schema — all tables from v0.1 through v0.8
|
|
108
|
+
version: 1,
|
|
109
|
+
sql: `
|
|
50
110
|
CREATE TABLE IF NOT EXISTS credentials (
|
|
51
111
|
id TEXT PRIMARY KEY,
|
|
52
112
|
name TEXT NOT NULL UNIQUE,
|
|
@@ -88,6 +148,8 @@ export function migrate(db) {
|
|
|
88
148
|
status TEXT NOT NULL DEFAULT 'allowed',
|
|
89
149
|
blocked_reason TEXT,
|
|
90
150
|
response_code INTEGER,
|
|
151
|
+
agent_name TEXT,
|
|
152
|
+
agent_token_prefix TEXT,
|
|
91
153
|
channel TEXT NOT NULL DEFAULT 'gate'
|
|
92
154
|
);
|
|
93
155
|
|
|
@@ -139,52 +201,9 @@ export function migrate(db) {
|
|
|
139
201
|
);
|
|
140
202
|
|
|
141
203
|
CREATE INDEX IF NOT EXISTS idx_users_token_hash ON users(token_hash);
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
db.exec('ALTER TABLE credentials ADD COLUMN expires_at TEXT');
|
|
148
|
-
}
|
|
149
|
-
if (!colNames.includes('rate_limit')) {
|
|
150
|
-
db.exec('ALTER TABLE credentials ADD COLUMN rate_limit TEXT');
|
|
151
|
-
}
|
|
152
|
-
if (!colNames.includes('body_inspection')) {
|
|
153
|
-
db.exec("ALTER TABLE credentials ADD COLUMN body_inspection TEXT NOT NULL DEFAULT 'block'");
|
|
154
|
-
}
|
|
155
|
-
// Migration: add agent identity columns to audit_log (for pre-v0.3 databases)
|
|
156
|
-
const auditCols = db.prepare('PRAGMA table_info(audit_log)').all();
|
|
157
|
-
const auditColNames = auditCols.map((c) => c.name);
|
|
158
|
-
if (!auditColNames.includes('agent_name')) {
|
|
159
|
-
db.exec('ALTER TABLE audit_log ADD COLUMN agent_name TEXT');
|
|
160
|
-
}
|
|
161
|
-
if (!auditColNames.includes('agent_token_prefix')) {
|
|
162
|
-
db.exec('ALTER TABLE audit_log ADD COLUMN agent_token_prefix TEXT');
|
|
163
|
-
}
|
|
164
|
-
if (!auditColNames.includes('channel')) {
|
|
165
|
-
db.exec("ALTER TABLE audit_log ADD COLUMN channel TEXT NOT NULL DEFAULT 'gate'");
|
|
166
|
-
}
|
|
167
|
-
// Migration: drop encrypted token columns from agents table (v0.3 security hardening)
|
|
168
|
-
// SQLite 3.35.0+ supports DROP COLUMN. For older versions, we recreate the table.
|
|
169
|
-
const agentCols = db.prepare('PRAGMA table_info(agents)').all();
|
|
170
|
-
const agentColNames = agentCols.map((c) => c.name);
|
|
171
|
-
if (agentColNames.includes('encrypted_token')) {
|
|
172
|
-
db.exec(`
|
|
173
|
-
CREATE TABLE IF NOT EXISTS agents_new (
|
|
174
|
-
id TEXT PRIMARY KEY,
|
|
175
|
-
name TEXT NOT NULL UNIQUE,
|
|
176
|
-
token_hash TEXT NOT NULL,
|
|
177
|
-
token_prefix TEXT NOT NULL,
|
|
178
|
-
rate_limit TEXT,
|
|
179
|
-
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
180
|
-
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
181
|
-
);
|
|
182
|
-
INSERT OR IGNORE INTO agents_new (id, name, token_hash, token_prefix, rate_limit, created_at, updated_at)
|
|
183
|
-
SELECT id, name, token_hash, token_prefix, rate_limit, created_at, updated_at FROM agents;
|
|
184
|
-
DROP TABLE agents;
|
|
185
|
-
ALTER TABLE agents_new RENAME TO agents;
|
|
186
|
-
CREATE INDEX IF NOT EXISTS idx_agents_token_hash ON agents(token_hash);
|
|
187
|
-
`);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
204
|
+
`,
|
|
205
|
+
},
|
|
206
|
+
// Future migrations go here:
|
|
207
|
+
// { version: 2, sql: `ALTER TABLE ...` },
|
|
208
|
+
];
|
|
190
209
|
//# sourceMappingURL=db.js.map
|
package/dist/db.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAElC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,SAAiB,EAAE,IAAY;IACzD,OAAO,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,GA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AC,SAAS,CAAC,GAAG,CAAC,CAAC;YACvB,EAAE,CAAC,OAAO,CAAC,iDAAiD,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACvF,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,aAAa,EAAE,CAAC;AAClB,CAAC;AASD;;;;;;;;GAQG;AACH,MAAM,UAAU,GAAgB;IAC9B;QACE,0DAA0D;QAC1D,OAAO,EAAE,CAAC;QACV,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+FJ;KACF;IACD,6BAA6B;IAC7B,0CAA0C;CAC3C,CAAC"}
|
package/dist/doctor.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Returns a structured list of check results that the CLI can render.
|
|
11
11
|
*/
|
|
12
|
-
import type Database from 'better-sqlite3';
|
|
12
|
+
import type Database from 'better-sqlite3-multiple-ciphers';
|
|
13
13
|
import type { AegisConfig } from './config.js';
|
|
14
14
|
export interface CheckResult {
|
|
15
15
|
label: string;
|
package/dist/doctor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,QAAQ,MAAM,iCAAiC,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,MAAM,EAAE,WAAW,CAAC;IACpB,qEAAqE;IACrE,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;CAC9B;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,aAAa,GAAG,YAAY,CA4L3D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAiB5D"}
|
package/dist/doctor.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Returns a structured list of check results that the CLI can render.
|
|
11
11
|
*/
|
|
12
12
|
import { getVaultSalt, migrate } from './db.js';
|
|
13
|
+
import { getKeyStorage } from './key-storage/index.js';
|
|
13
14
|
import { Vault } from './vault/index.js';
|
|
14
15
|
/**
|
|
15
16
|
* Run all Aegis health checks and return a structured report.
|
|
@@ -42,6 +43,25 @@ export function runDoctor(opts) {
|
|
|
42
43
|
else {
|
|
43
44
|
checks.push({ label: 'Master key', status: 'pass', detail: 'AEGIS_MASTER_KEY is set' });
|
|
44
45
|
}
|
|
46
|
+
// ── 1b. Key storage backend ────────────────────────────────────
|
|
47
|
+
try {
|
|
48
|
+
const keyStorage = getKeyStorage(config.dataDir);
|
|
49
|
+
const hasKeyInStore = keyStorage.getKey() !== undefined;
|
|
50
|
+
checks.push({
|
|
51
|
+
label: 'Key storage',
|
|
52
|
+
status: hasKeyInStore ? 'pass' : 'warn',
|
|
53
|
+
detail: hasKeyInStore
|
|
54
|
+
? `Backend: ${keyStorage.name} (${keyStorage.backend}) — key present`
|
|
55
|
+
: `Backend: ${keyStorage.name} (${keyStorage.backend}) — no key stored`,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
checks.push({
|
|
60
|
+
label: 'Key storage',
|
|
61
|
+
status: 'warn',
|
|
62
|
+
detail: 'Could not detect key storage backend',
|
|
63
|
+
});
|
|
64
|
+
}
|
|
45
65
|
// ── 2. Verify database accessibility and schema ────────────────
|
|
46
66
|
const { db } = opts;
|
|
47
67
|
const effectiveSalt = db ? getVaultSalt(config) : config.salt;
|