aquaman-proxy 0.12.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/dist/cli/index.js +325 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/types.d.ts +25 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/utils/config.d.ts +8 -0
- package/dist/core/utils/config.d.ts.map +1 -1
- package/dist/core/utils/config.js +49 -1
- package/dist/core/utils/config.js.map +1 -1
- package/dist/core/utils/index.d.ts +1 -1
- package/dist/core/utils/index.d.ts.map +1 -1
- package/dist/core/utils/index.js +1 -1
- package/dist/core/utils/index.js.map +1 -1
- package/dist/daemon.d.ts +26 -0
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +104 -6
- package/dist/daemon.js.map +1 -1
- package/dist/hermes/config-writer.d.ts +61 -0
- package/dist/hermes/config-writer.d.ts.map +1 -0
- package/dist/hermes/config-writer.js +112 -0
- package/dist/hermes/config-writer.js.map +1 -0
- package/dist/hermes/integration.d.ts +53 -0
- package/dist/hermes/integration.d.ts.map +1 -0
- package/dist/hermes/integration.js +85 -0
- package/dist/hermes/integration.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment configuration generator for Hermes integration (v0.13.0+)
|
|
3
|
+
*
|
|
4
|
+
* Hermes is a Python agent host that builds its own HTTP client
|
|
5
|
+
* internally and exposes no transport/socket hook — so the aquaman UDS proxy
|
|
6
|
+
* can't be injected the way it is for OpenClaw. Instead the proxy runs an
|
|
7
|
+
* opt-in loopback TCP listener and Hermes is pointed at it via the SAME
|
|
8
|
+
* provider env vars it already understands (`ANTHROPIC_BASE_URL`,
|
|
9
|
+
* `OPENAI_BASE_URL`) plus a placeholder api_key that equals the loopback token.
|
|
10
|
+
*
|
|
11
|
+
* Hermes path conventions (verified against hermes_cli/runtime_provider.py and
|
|
12
|
+
* agent/anthropic_adapter.py):
|
|
13
|
+
* - Anthropic: base_url must end with `/anthropic`. Hermes special-cases that
|
|
14
|
+
* suffix into `anthropic_messages` api_mode; the Anthropic SDK then appends
|
|
15
|
+
* `/v1/messages`, yielding `/anthropic/v1/messages` at the proxy.
|
|
16
|
+
* - OpenAI: base_url ends with `/openai/v1`; the OpenAI SDK appends
|
|
17
|
+
* `/chat/completions`, yielding `/openai/v1/chat/completions`. The proxy's
|
|
18
|
+
* `openai` upstream is `https://api.openai.com` (no `/v1`), so there's no
|
|
19
|
+
* double-`/v1`.
|
|
20
|
+
*
|
|
21
|
+
* First cut covers LLM-provider isolation only (anthropic, openai). Channels /
|
|
22
|
+
* "platforms" are deferred — they have no base_url lever and hit the same
|
|
23
|
+
* can't-intercept-a-foreign-client wall.
|
|
24
|
+
*/
|
|
25
|
+
import * as fs from 'node:fs';
|
|
26
|
+
import * as path from 'node:path';
|
|
27
|
+
/** Matches the SAFE_SERVICE_NAME pattern from daemon.ts. */
|
|
28
|
+
const SAFE_SERVICE_NAME = /^[a-z0-9][a-z0-9._-]*$/;
|
|
29
|
+
/** Providers Hermes can be pointed at the loopback listener today. */
|
|
30
|
+
export const HERMES_SUPPORTED_SERVICES = ['anthropic', 'openai'];
|
|
31
|
+
/**
|
|
32
|
+
* Generate the env vars that point Hermes at the aquaman loopback listener.
|
|
33
|
+
* For each supported provider in `services`, emits both the base URL and a
|
|
34
|
+
* placeholder api_key set to the loopback token. The proxy strips the
|
|
35
|
+
* placeholder and injects the real vault-stored credential.
|
|
36
|
+
*/
|
|
37
|
+
export function generateHermesEnv(config) {
|
|
38
|
+
const host = config.host || '127.0.0.1';
|
|
39
|
+
const base = `http://${host}:${config.port}`;
|
|
40
|
+
const env = {};
|
|
41
|
+
for (const service of config.services) {
|
|
42
|
+
if (!SAFE_SERVICE_NAME.test(service))
|
|
43
|
+
continue;
|
|
44
|
+
switch (service) {
|
|
45
|
+
case 'anthropic':
|
|
46
|
+
env['ANTHROPIC_BASE_URL'] = `${base}/anthropic`;
|
|
47
|
+
env['ANTHROPIC_API_KEY'] = config.token;
|
|
48
|
+
break;
|
|
49
|
+
case 'openai':
|
|
50
|
+
env['OPENAI_BASE_URL'] = `${base}/openai/v1`;
|
|
51
|
+
env['OPENAI_API_KEY'] = config.token;
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
// Unsupported for Hermes today (channels/other providers). Skip
|
|
55
|
+
// silently — the caller surfaces which services were wired.
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return env;
|
|
60
|
+
}
|
|
61
|
+
/** Services in the input list that this integration knows how to wire for Hermes. */
|
|
62
|
+
export function hermesWiredServices(services) {
|
|
63
|
+
return services.filter(s => HERMES_SUPPORTED_SERVICES.includes(s));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Default path to the Hermes dotenv file (`~/.hermes/.env`). Honors the
|
|
67
|
+
* `HERMES_HOME` override — the same var the Hermes CLI itself uses to relocate
|
|
68
|
+
* its config dir (verified against `hermes config env-path`) — else falls back
|
|
69
|
+
* to `~/.hermes`.
|
|
70
|
+
*/
|
|
71
|
+
export function getHermesEnvPath(homeDir) {
|
|
72
|
+
const stateDir = process.env['HERMES_HOME'] || path.join(homeDir, '.hermes');
|
|
73
|
+
return path.join(stateDir, '.env');
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Write/merge the aquaman-managed block into `~/.hermes/.env`. Existing
|
|
77
|
+
* non-aquaman lines are preserved; the managed block is delimited by markers
|
|
78
|
+
* and rewritten in place on re-run (idempotent). File mode 0o600.
|
|
79
|
+
*/
|
|
80
|
+
export function writeHermesEnv(env, filePath) {
|
|
81
|
+
const marker = '# >>> aquaman managed >>>';
|
|
82
|
+
const endMarker = '# <<< aquaman managed <<<';
|
|
83
|
+
let content = '';
|
|
84
|
+
if (fs.existsSync(filePath)) {
|
|
85
|
+
content = fs.readFileSync(filePath, 'utf-8');
|
|
86
|
+
}
|
|
87
|
+
// Strip any prior aquaman block.
|
|
88
|
+
const start = content.indexOf(marker);
|
|
89
|
+
const end = content.indexOf(endMarker);
|
|
90
|
+
if (start !== -1 && end !== -1 && end > start) {
|
|
91
|
+
content = content.slice(0, start).replace(/\n+$/, '') + content.slice(end + endMarker.length);
|
|
92
|
+
}
|
|
93
|
+
const body = Object.entries(env)
|
|
94
|
+
.map(([k, v]) => `${k}=${v}`)
|
|
95
|
+
.join('\n');
|
|
96
|
+
const block = `${marker}\n${body}\n${endMarker}\n`;
|
|
97
|
+
const merged = content.trim().length > 0
|
|
98
|
+
? content.replace(/\n+$/, '') + '\n\n' + block
|
|
99
|
+
: block;
|
|
100
|
+
const dir = path.dirname(filePath);
|
|
101
|
+
if (!fs.existsSync(dir)) {
|
|
102
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
103
|
+
}
|
|
104
|
+
fs.writeFileSync(filePath, merged, { mode: 0o600 });
|
|
105
|
+
}
|
|
106
|
+
/** Format env vars for display (dry-run / export output). */
|
|
107
|
+
export function formatHermesEnvForDisplay(env) {
|
|
108
|
+
return Object.entries(env)
|
|
109
|
+
.map(([k, v]) => ` ${k}=${v}`)
|
|
110
|
+
.join('\n');
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=config-writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-writer.js","sourceRoot":"","sources":["../../src/hermes/config-writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,4DAA4D;AAC5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AI,EAAE,CAAC,MAAM,GAAG,CAAC;QACtC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,KAAK;QAC9C,CAAC,CAAC,KAAK,CAAC;IAEV,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACtD,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,yBAAyB,CAAC,GAA2B;IACnE,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;SACvB,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;SAC9B,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hermes integration (v0.13.0+)
|
|
3
|
+
*
|
|
4
|
+
* Detects a local Hermes install and wires it to the aquaman
|
|
5
|
+
* loopback listener by writing provider base-URL + placeholder-key env vars
|
|
6
|
+
* into `~/.hermes/.env`. Unlike the OpenClaw path there is no in-process
|
|
7
|
+
* plugin doing fetch interception — Hermes is a foreign (Python) host, so the
|
|
8
|
+
* contract is purely: loopback listener on the proxy side + native env vars on
|
|
9
|
+
* the Hermes side. See config-writer.ts for the path/auth rationale.
|
|
10
|
+
*/
|
|
11
|
+
import type { HermesConfig } from '../core/index.js';
|
|
12
|
+
export interface HermesInfo {
|
|
13
|
+
installed: boolean;
|
|
14
|
+
version?: string;
|
|
15
|
+
path?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface HermesIntegrationOptions {
|
|
18
|
+
/** Loopback listener port the env vars should point at. */
|
|
19
|
+
port: number;
|
|
20
|
+
/** Loopback token used as the placeholder api_key. */
|
|
21
|
+
token: string;
|
|
22
|
+
/** Loopback host. Defaults to 127.0.0.1. */
|
|
23
|
+
host?: string;
|
|
24
|
+
/** Services to wire (only anthropic/openai are emitted today). */
|
|
25
|
+
services: string[];
|
|
26
|
+
/** Hermes integration config (configMethod, binaryPath). */
|
|
27
|
+
config?: HermesConfig;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Detect whether the Hermes CLI is installed and parse its version.
|
|
31
|
+
* Parses lines like "Hermes Agent v0.16.0 (2026.6.5)".
|
|
32
|
+
*/
|
|
33
|
+
export declare function detectHermes(binaryPath?: string): Promise<HermesInfo>;
|
|
34
|
+
export declare class HermesIntegration {
|
|
35
|
+
private options;
|
|
36
|
+
constructor(options: HermesIntegrationOptions);
|
|
37
|
+
/** Build the env vars that point Hermes at the loopback listener. */
|
|
38
|
+
configureHermes(): Record<string, string>;
|
|
39
|
+
/** Which of the requested services actually get wired (anthropic/openai today). */
|
|
40
|
+
wiredServices(): string[];
|
|
41
|
+
/** Path to the Hermes dotenv file this integration writes. */
|
|
42
|
+
envPath(): string;
|
|
43
|
+
/**
|
|
44
|
+
* Write the configuration. `dotenv` merges into ~/.hermes/.env; `env`
|
|
45
|
+
* returns a display string for manual export. Returns the destination path
|
|
46
|
+
* (dotenv) or the formatted block (env).
|
|
47
|
+
*/
|
|
48
|
+
writeConfiguration(env: Record<string, string>): string;
|
|
49
|
+
getEnvForDisplay(): string;
|
|
50
|
+
detect(): Promise<HermesInfo>;
|
|
51
|
+
}
|
|
52
|
+
export declare function createHermesIntegration(options: HermesIntegrationOptions): HermesIntegration;
|
|
53
|
+
//# sourceMappingURL=integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/hermes/integration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAWH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,UAAU,SAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAoB7E;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAA2B;gBAE9B,OAAO,EAAE,wBAAwB;IAI7C,qEAAqE;IACrE,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IASzC,mFAAmF;IACnF,aAAa,IAAI,MAAM,EAAE;IAIzB,8DAA8D;IAC9D,OAAO,IAAI,MAAM;IAIjB;;;;OAIG;IACH,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAUvD,gBAAgB,IAAI,MAAM;IAIpB,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC;CAGpC;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,wBAAwB,GAAG,iBAAiB,CAE5F"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hermes integration (v0.13.0+)
|
|
3
|
+
*
|
|
4
|
+
* Detects a local Hermes install and wires it to the aquaman
|
|
5
|
+
* loopback listener by writing provider base-URL + placeholder-key env vars
|
|
6
|
+
* into `~/.hermes/.env`. Unlike the OpenClaw path there is no in-process
|
|
7
|
+
* plugin doing fetch interception — Hermes is a foreign (Python) host, so the
|
|
8
|
+
* contract is purely: loopback listener on the proxy side + native env vars on
|
|
9
|
+
* the Hermes side. See config-writer.ts for the path/auth rationale.
|
|
10
|
+
*/
|
|
11
|
+
import * as os from 'node:os';
|
|
12
|
+
import { spawn } from 'node:child_process';
|
|
13
|
+
import { generateHermesEnv, writeHermesEnv, formatHermesEnvForDisplay, getHermesEnvPath, hermesWiredServices, } from './config-writer.js';
|
|
14
|
+
/**
|
|
15
|
+
* Detect whether the Hermes CLI is installed and parse its version.
|
|
16
|
+
* Parses lines like "Hermes Agent v0.16.0 (2026.6.5)".
|
|
17
|
+
*/
|
|
18
|
+
export async function detectHermes(binaryPath = 'hermes') {
|
|
19
|
+
return new Promise((resolve) => {
|
|
20
|
+
const proc = spawn(binaryPath, ['--version'], { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
21
|
+
let stdout = '';
|
|
22
|
+
proc.stdout?.on('data', (d) => { stdout += d.toString(); });
|
|
23
|
+
proc.on('error', () => resolve({ installed: false }));
|
|
24
|
+
proc.on('close', (code) => {
|
|
25
|
+
if (code === 0 && stdout) {
|
|
26
|
+
const match = stdout.match(/Hermes(?:\s+Agent)?\s+v?(\d+\.\d+\.\d+)/i);
|
|
27
|
+
resolve({
|
|
28
|
+
installed: true,
|
|
29
|
+
version: match ? match[1] : stdout.trim().split('\n')[0],
|
|
30
|
+
path: binaryPath,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
resolve({ installed: false });
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export class HermesIntegration {
|
|
40
|
+
options;
|
|
41
|
+
constructor(options) {
|
|
42
|
+
this.options = options;
|
|
43
|
+
}
|
|
44
|
+
/** Build the env vars that point Hermes at the loopback listener. */
|
|
45
|
+
configureHermes() {
|
|
46
|
+
return generateHermesEnv({
|
|
47
|
+
port: this.options.port,
|
|
48
|
+
token: this.options.token,
|
|
49
|
+
host: this.options.host,
|
|
50
|
+
services: this.options.services,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/** Which of the requested services actually get wired (anthropic/openai today). */
|
|
54
|
+
wiredServices() {
|
|
55
|
+
return hermesWiredServices(this.options.services);
|
|
56
|
+
}
|
|
57
|
+
/** Path to the Hermes dotenv file this integration writes. */
|
|
58
|
+
envPath() {
|
|
59
|
+
return getHermesEnvPath(os.homedir());
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Write the configuration. `dotenv` merges into ~/.hermes/.env; `env`
|
|
63
|
+
* returns a display string for manual export. Returns the destination path
|
|
64
|
+
* (dotenv) or the formatted block (env).
|
|
65
|
+
*/
|
|
66
|
+
writeConfiguration(env) {
|
|
67
|
+
const method = this.options.config?.configMethod ?? 'dotenv';
|
|
68
|
+
if (method === 'dotenv') {
|
|
69
|
+
const dest = this.envPath();
|
|
70
|
+
writeHermesEnv(env, dest);
|
|
71
|
+
return dest;
|
|
72
|
+
}
|
|
73
|
+
return formatHermesEnvForDisplay(env);
|
|
74
|
+
}
|
|
75
|
+
getEnvForDisplay() {
|
|
76
|
+
return formatHermesEnvForDisplay(this.configureHermes());
|
|
77
|
+
}
|
|
78
|
+
async detect() {
|
|
79
|
+
return detectHermes(this.options.config?.binaryPath || 'hermes');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export function createHermesIntegration(options) {
|
|
83
|
+
return new HermesIntegration(options);
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../src/hermes/integration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAA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AC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,IAAI,QAAQ,CAAC,CAAC;IACnE,CAAC;CACF;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAiC;IACvE,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export { type AuthMode, type OAuthConfig, type ServiceRegistryOptions, ServiceRe
|
|
|
12
12
|
export { OAuthTokenCache, createOAuthTokenCache } from './oauth-token-cache.js';
|
|
13
13
|
export { type EnvConfig, generateOpenClawEnv, writeEnvFile, appendToShellRc, formatEnvForDisplay } from './openclaw/env-writer.js';
|
|
14
14
|
export { type OpenClawInfo, type LaunchOptions, OpenClawIntegration, createOpenClawIntegration, parseCalendarVersion, authProfilesAreSqliteOnly } from './openclaw/integration.js';
|
|
15
|
+
export { type HermesEnvConfig, HERMES_SUPPORTED_SERVICES, generateHermesEnv, hermesWiredServices, getHermesEnvPath, writeHermesEnv, formatHermesEnvForDisplay } from './hermes/config-writer.js';
|
|
16
|
+
export { type HermesInfo, type HermesIntegrationOptions, HermesIntegration, createHermesIntegration, detectHermes } from './hermes/integration.js';
|
|
15
17
|
export { type PolicyRule, type ServicePolicy, type PolicyConfig, matchPathPattern, matchPolicy, loadPolicyFromConfig, validatePolicyConfig, getDefaultPolicyPresets } from './request-policy.js';
|
|
16
18
|
export * from './core/index.js';
|
|
17
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAChB,eAAe,EACf,qBAAqB,EACrB,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,eAAe,EACf,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,eAAe,EACf,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,KAAK,SAAS,EACd,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAG7B,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAChB,eAAe,EACf,qBAAqB,EACrB,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,eAAe,EACf,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,eAAe,EACf,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,KAAK,SAAS,EACd,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,KAAK,eAAe,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,yBAAyB,EAC1B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,KAAK,UAAU,EACf,KAAK,wBAAwB,EAC7B,iBAAiB,EACjB,uBAAuB,EACvB,YAAY,EACb,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAG7B,cAAc,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,9 @@ export { OAuthTokenCache, createOAuthTokenCache } from './oauth-token-cache.js';
|
|
|
16
16
|
// OpenClaw Integration
|
|
17
17
|
export { generateOpenClawEnv, writeEnvFile, appendToShellRc, formatEnvForDisplay } from './openclaw/env-writer.js';
|
|
18
18
|
export { OpenClawIntegration, createOpenClawIntegration, parseCalendarVersion, authProfilesAreSqliteOnly } from './openclaw/integration.js';
|
|
19
|
+
// Hermes Integration (v0.13.0+)
|
|
20
|
+
export { HERMES_SUPPORTED_SERVICES, generateHermesEnv, hermesWiredServices, getHermesEnvPath, writeHermesEnv, formatHermesEnvForDisplay } from './hermes/config-writer.js';
|
|
21
|
+
export { HermesIntegration, createHermesIntegration, detectHermes } from './hermes/integration.js';
|
|
19
22
|
// Request Policy
|
|
20
23
|
export { matchPathPattern, matchPolicy, loadPolicyFromConfig, validatePolicyConfig, getDefaultPolicyPresets } from './request-policy.js';
|
|
21
24
|
// Core (merged from aquaman-core)
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,SAAS;AACT,OAAO,EAGL,eAAe,EACf,qBAAqB,EAEtB,MA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ACjB,uBAAuB,EACvB,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC,iBAAiB;AACjB,OAAO,EAIL,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAE7B,kCAAkC;AAClC,cAAc,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aquaman-proxy",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "API key protection for
|
|
3
|
+
"version": "0.13.0",
|
|
4
|
+
"description": "🔱 API key protection for AI agents. Bring your own vault. Credentials stay where you already keep them, never in the agent's memory.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|