@agent-vm/gateway-interface 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.d.ts +169 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/package.json +38 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Shravan Sunder
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
//#region src/gateway-runtime-contract.d.ts
|
|
2
|
+
declare const gatewayTypeValues: readonly ["openclaw", "worker"];
|
|
3
|
+
type GatewayType = (typeof gatewayTypeValues)[number];
|
|
4
|
+
declare function buildGatewaySessionLabel(projectNamespace: string, zoneId: string): string;
|
|
5
|
+
declare function buildToolSessionLabel(projectNamespace: string, zoneId: string, tcpSlot: number): string;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region ../gondolin-adapter/dist/index.d.ts
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/types.d.ts
|
|
11
|
+
interface SecretSpec {
|
|
12
|
+
readonly hosts: readonly string[];
|
|
13
|
+
readonly value: string;
|
|
14
|
+
}
|
|
15
|
+
type SecretRef = {
|
|
16
|
+
readonly source: '1password';
|
|
17
|
+
readonly ref: string;
|
|
18
|
+
} | {
|
|
19
|
+
readonly source: 'environment';
|
|
20
|
+
readonly ref: string;
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/secret-resolver.d.ts
|
|
24
|
+
|
|
25
|
+
interface SecretResolver {
|
|
26
|
+
resolve(ref: SecretRef): Promise<string>;
|
|
27
|
+
resolveAll(refs: Record<string, SecretRef>): Promise<Record<string, string>>;
|
|
28
|
+
}
|
|
29
|
+
interface VfsMountSpec {
|
|
30
|
+
readonly kind: 'realfs' | 'realfs-readonly' | 'memory' | 'shadow';
|
|
31
|
+
readonly hostPath?: string;
|
|
32
|
+
readonly shadowConfig?: {
|
|
33
|
+
readonly deny: readonly string[];
|
|
34
|
+
readonly tmpfs: readonly string[];
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/gateway-process-spec.d.ts
|
|
39
|
+
type GatewayHealthCheck = {
|
|
40
|
+
readonly type: 'http';
|
|
41
|
+
readonly port: number;
|
|
42
|
+
readonly path: string;
|
|
43
|
+
} | {
|
|
44
|
+
readonly type: 'command';
|
|
45
|
+
readonly command: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Everything about the process running inside the VM.
|
|
49
|
+
* Retained by the running gateway handle for logs, health, restart.
|
|
50
|
+
*/
|
|
51
|
+
interface GatewayProcessSpec {
|
|
52
|
+
readonly bootstrapCommand: string;
|
|
53
|
+
readonly startCommand: string;
|
|
54
|
+
readonly healthCheck: GatewayHealthCheck;
|
|
55
|
+
readonly guestListenPort: number;
|
|
56
|
+
readonly logPath: string;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/gateway-vm-spec.d.ts
|
|
60
|
+
/**
|
|
61
|
+
* Everything the controller needs to create the Gondolin VM.
|
|
62
|
+
* Lifecycle implementations own the full Gondolin-facing contract.
|
|
63
|
+
*/
|
|
64
|
+
interface GatewayVmSpec {
|
|
65
|
+
readonly environment: Record<string, string>;
|
|
66
|
+
readonly vfsMounts: Record<string, VfsMountSpec>;
|
|
67
|
+
readonly mediatedSecrets: Record<string, SecretSpec>;
|
|
68
|
+
readonly tcpHosts: Record<string, string>;
|
|
69
|
+
readonly allowedHosts: readonly string[];
|
|
70
|
+
readonly rootfsMode: 'readonly' | 'memory' | 'cow';
|
|
71
|
+
readonly sessionLabel: string;
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/gateway-lifecycle.d.ts
|
|
75
|
+
/**
|
|
76
|
+
* Describes how to run interactive auth for a gateway type.
|
|
77
|
+
* Static property — available without a running VM.
|
|
78
|
+
*/
|
|
79
|
+
interface GatewayAuthConfig {
|
|
80
|
+
/**
|
|
81
|
+
* Shell command to list available auth providers inside the VM.
|
|
82
|
+
* Should output one provider name per line to stdout.
|
|
83
|
+
*/
|
|
84
|
+
readonly listProvidersCommand: string;
|
|
85
|
+
/**
|
|
86
|
+
* Build the shell command for interactive auth login.
|
|
87
|
+
* The CLI passes this as the SSH remote command with -t (TTY).
|
|
88
|
+
*/
|
|
89
|
+
readonly buildLoginCommand: (provider: string) => string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Zone config as the lifecycle sees it.
|
|
93
|
+
* Decoupled from SystemConfig — the controller maps into this shape.
|
|
94
|
+
*/
|
|
95
|
+
interface GatewayZoneConfig {
|
|
96
|
+
readonly id: string;
|
|
97
|
+
readonly gateway: {
|
|
98
|
+
readonly type: GatewayType;
|
|
99
|
+
readonly memory: string;
|
|
100
|
+
readonly cpus: number;
|
|
101
|
+
readonly port: number;
|
|
102
|
+
readonly config: string;
|
|
103
|
+
readonly stateDir: string;
|
|
104
|
+
readonly workspaceDir: string;
|
|
105
|
+
readonly authProfilesRef?: {
|
|
106
|
+
readonly source: '1password';
|
|
107
|
+
readonly ref: string;
|
|
108
|
+
} | {
|
|
109
|
+
readonly source: 'environment';
|
|
110
|
+
readonly envVar: string;
|
|
111
|
+
} | undefined;
|
|
112
|
+
};
|
|
113
|
+
readonly secrets: Record<string, {
|
|
114
|
+
readonly source: '1password';
|
|
115
|
+
readonly ref: string;
|
|
116
|
+
readonly injection: 'env' | 'http-mediation';
|
|
117
|
+
readonly hosts?: readonly string[] | undefined;
|
|
118
|
+
} | {
|
|
119
|
+
readonly source: 'environment';
|
|
120
|
+
readonly envVar: string;
|
|
121
|
+
readonly injection: 'env' | 'http-mediation';
|
|
122
|
+
readonly hosts?: readonly string[] | undefined;
|
|
123
|
+
}>;
|
|
124
|
+
readonly allowedHosts: readonly string[];
|
|
125
|
+
readonly websocketBypass: readonly string[];
|
|
126
|
+
readonly toolProfile?: string;
|
|
127
|
+
}
|
|
128
|
+
interface BuildGatewayVmSpecOptions {
|
|
129
|
+
readonly controllerPort: number;
|
|
130
|
+
readonly projectNamespace: string;
|
|
131
|
+
readonly resolvedSecrets: Record<string, string>;
|
|
132
|
+
readonly tcpPool: {
|
|
133
|
+
readonly basePort: number;
|
|
134
|
+
readonly size: number;
|
|
135
|
+
};
|
|
136
|
+
readonly zone: GatewayZoneConfig;
|
|
137
|
+
}
|
|
138
|
+
interface GatewayLifecycle {
|
|
139
|
+
/**
|
|
140
|
+
* How to run interactive auth for this gateway type.
|
|
141
|
+
* Absent means the gateway type does not support interactive auth.
|
|
142
|
+
*/
|
|
143
|
+
readonly authConfig?: GatewayAuthConfig | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Build the full VM spec — everything Gondolin needs to create the VM.
|
|
146
|
+
* Pure data assembly — no side effects.
|
|
147
|
+
*/
|
|
148
|
+
buildVmSpec(options: BuildGatewayVmSpecOptions): GatewayVmSpec;
|
|
149
|
+
/**
|
|
150
|
+
* Build the process spec — everything about startup, health, and logging.
|
|
151
|
+
* Pure data assembly — no side effects.
|
|
152
|
+
*/
|
|
153
|
+
buildProcessSpec(zone: GatewayZoneConfig, resolvedSecrets: Record<string, string>): GatewayProcessSpec;
|
|
154
|
+
/**
|
|
155
|
+
* Optional hook to prepare host-side state before the VM boots.
|
|
156
|
+
* Example: writing auth-profiles.json from 1Password.
|
|
157
|
+
*/
|
|
158
|
+
prepareHostState?(zone: GatewayZoneConfig, secretResolver: SecretResolver): Promise<void>;
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/split-resolved-gateway-secrets.d.ts
|
|
162
|
+
interface SplitResolvedGatewaySecretsResult {
|
|
163
|
+
readonly environmentSecrets: Record<string, string>;
|
|
164
|
+
readonly mediatedSecrets: Record<string, SecretSpec>;
|
|
165
|
+
}
|
|
166
|
+
declare function splitResolvedGatewaySecrets(zone: GatewayZoneConfig, resolvedSecrets: Record<string, string>): SplitResolvedGatewaySecretsResult;
|
|
167
|
+
//#endregion
|
|
168
|
+
export { type BuildGatewayVmSpecOptions, type GatewayAuthConfig, type GatewayHealthCheck, type GatewayLifecycle, type GatewayProcessSpec, type GatewayType, type GatewayVmSpec, type GatewayZoneConfig, type SplitResolvedGatewaySecretsResult, buildGatewaySessionLabel, buildToolSessionLabel, gatewayTypeValues, splitResolvedGatewaySecrets };
|
|
169
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["BuildConfig","BuildConfig$1","getDefaultBuildConfig","BuildImageOptions","BuildImageResult","BuildPipelineDependencies","Promise","computeBuildFingerprint","buildImage","parseMinimumZigVersion","resolveGondolinPackageJsonPath","resolveGondolinPackageSpec","ResolveGondolinMinimumZigVersionOptions","resolveGondolinMinimumZigVersion","WritableMountPolicy","RuntimeMountPolicyConfig","Record","Readonly","resolveGuestMountPath","validateWritableMount","validateRuntimeMountPolicy","PolicySources","normalizeHostname","dedupeStable","compilePolicy","SecretSpec","SecretRef","SecretResolverClient","SecretResolver","TokenSource","ExecFileOptions","ExecFileResult","resolveServiceAccountToken","CreateSecretResolverDependencies","createSecretResolver","createOpCliSecretResolver","Pick","ExecResult","IngressRoute","SshAccess","IngressAccess","ManagedVmInstance","ManagedVmDependencies","Request","Response","VfsMountSpec","CreateVmOptions","ManagedVm","createManagedVm","VolumeConfigEntry","ResolvedVolume","ensureVolumeDir","resolveVolumeDirs","writeFileAtomically"],"sources":["../src/gateway-runtime-contract.ts","../../gondolin-adapter/dist/index.d.ts","../src/gateway-process-spec.ts","../src/gateway-vm-spec.ts","../src/gateway-lifecycle.ts","../src/split-resolved-gateway-secrets.ts"],"sourcesContent":["import { BuildConfig, BuildConfig as BuildConfig$1, getDefaultBuildConfig } from \"@earendil-works/gondolin\";\n\n//#region src/build-pipeline.d.ts\ninterface BuildImageOptions {\n readonly buildConfig: BuildConfig$1;\n readonly cacheDir: string;\n /** Directory to resolve relative paths in buildConfig (e.g. postBuild.copy.src).\n * Defaults to process.cwd() if not provided. */\n readonly configDir?: string;\n readonly fullReset?: boolean;\n readonly fingerprintInput?: unknown;\n}\ninterface BuildImageResult {\n readonly built: boolean;\n readonly fingerprint: string;\n readonly imagePath: string;\n}\ninterface BuildPipelineDependencies {\n readonly buildAssets?: (buildConfig: BuildConfig$1, outputDirectory: string, configDir?: string) => Promise<unknown>;\n readonly gondolinVersion?: string;\n}\ndeclare function computeBuildFingerprint(buildConfig: BuildConfig$1, gondolinVersion?: string, fingerprintInput?: unknown): string;\ndeclare function buildImage(options: BuildImageOptions, dependencies?: BuildPipelineDependencies): Promise<BuildImageResult>;\n//#endregion\n//#region src/gondolin-package.d.ts\ndeclare function parseMinimumZigVersion(rawContents: string): string;\ndeclare function resolveGondolinPackageJsonPath(): string;\ndeclare function resolveGondolinPackageSpec(): Promise<string>;\ninterface ResolveGondolinMinimumZigVersionOptions {\n readonly buildZigZonPath?: string;\n}\ndeclare function resolveGondolinMinimumZigVersion(options?: ResolveGondolinMinimumZigVersionOptions): Promise<string>;\n//#endregion\n//#region src/mount-policy.d.ts\ninterface WritableMountPolicy {\n readonly allowAuthWrite: boolean;\n readonly writableAllowedGuestPrefixes: readonly string[];\n}\ninterface RuntimeMountPolicyConfig {\n readonly extraMounts: Readonly<Record<string, string>>;\n readonly mountControls: WritableMountPolicy;\n}\ndeclare function resolveGuestMountPath(guestPath: string, workDir: string): string;\ndeclare function validateWritableMount(guestPath: string, policy: WritableMountPolicy, options: {\n readonly workDir: string;\n}): void;\ndeclare function validateRuntimeMountPolicy(config: RuntimeMountPolicyConfig, options: {\n readonly hostHome: string;\n readonly workDir: string;\n}): Promise<void>;\n//#endregion\n//#region src/policy-compiler.d.ts\ninterface PolicySources {\n readonly base: readonly string[];\n readonly profile: readonly string[];\n readonly extra: readonly string[];\n}\ndeclare function normalizeHostname(rawHostname: string): string;\ndeclare function dedupeStable(values: readonly string[]): string[];\ndeclare function compilePolicy(sources: PolicySources): string[];\n//#endregion\n//#region src/types.d.ts\ninterface SecretSpec {\n readonly hosts: readonly string[];\n readonly value: string;\n}\ntype SecretRef = {\n readonly source: '1password';\n readonly ref: string;\n} | {\n readonly source: 'environment';\n readonly ref: string;\n};\n//#endregion\n//#region src/secret-resolver.d.ts\ninterface SecretResolverClient {\n readonly secrets: {\n resolve(secretReference: string): Promise<string>;\n resolveAll(secretReferences: readonly string[]): Promise<unknown>;\n };\n}\ninterface SecretResolver {\n resolve(ref: SecretRef): Promise<string>;\n resolveAll(refs: Record<string, SecretRef>): Promise<Record<string, string>>;\n}\ntype TokenSource = {\n readonly type: 'op-cli';\n readonly ref: string;\n} | {\n readonly type: 'env';\n readonly envVar?: string | undefined;\n} | {\n readonly type: 'keychain';\n readonly service: string;\n readonly account: string;\n};\ninterface ExecFileOptions {\n readonly env?: Readonly<Record<string, string | undefined>>;\n}\ninterface ExecFileResult {\n readonly stdout: string;\n readonly stderr: string;\n}\ndeclare function resolveServiceAccountToken(source: TokenSource, dependencies?: {\n readonly execFileAsync?: (command: string, args: readonly string[], options?: ExecFileOptions) => Promise<ExecFileResult>;\n}): Promise<string>;\ninterface CreateSecretResolverDependencies {\n readonly createClient?: (config: {\n auth: string;\n integrationName: string;\n integrationVersion: string;\n }) => Promise<SecretResolverClient>;\n readonly execFileAsync?: (command: string, args: readonly string[], options?: ExecFileOptions) => Promise<ExecFileResult>;\n readonly integrationName?: string;\n readonly integrationVersion?: string;\n}\ndeclare function createSecretResolver(options: {\n readonly serviceAccountToken: string;\n}, dependencies?: CreateSecretResolverDependencies): Promise<SecretResolver>;\ndeclare function createOpCliSecretResolver(options: {\n readonly serviceAccountToken: string;\n}, dependencies?: Pick<CreateSecretResolverDependencies, 'execFileAsync'>): Promise<SecretResolver>;\n//#endregion\n//#region src/vm-adapter.d.ts\ninterface ExecResult {\n readonly exitCode: number;\n readonly stdout: string;\n readonly stderr: string;\n}\ninterface IngressRoute {\n readonly prefix: string;\n readonly port: number;\n readonly stripPrefix?: boolean;\n}\ninterface SshAccess {\n readonly host: string;\n readonly command?: string;\n readonly identityFile?: string;\n readonly port: number;\n readonly user?: string;\n}\ninterface IngressAccess {\n readonly host: string;\n readonly port: number;\n}\ninterface ManagedVmInstance {\n readonly id: string;\n exec(command: string): Promise<{\n readonly exitCode: number;\n readonly stdout?: string;\n readonly stderr?: string;\n }>;\n enableSsh(options?: unknown): Promise<SshAccess>;\n enableIngress(options?: unknown): Promise<IngressAccess>;\n setIngressRoutes(routes: readonly IngressRoute[]): void;\n close(): Promise<void>;\n}\ninterface ManagedVmDependencies {\n createVm(vmOptions: unknown): Promise<ManagedVmInstance>;\n createHttpHooks(options: {\n readonly allowedHosts: readonly string[];\n readonly secrets: Record<string, SecretSpec>;\n readonly onRequest?: (request: Request) => Promise<Request | Response | void>;\n readonly onResponse?: (response: Response) => Promise<Response | void>;\n }): {\n readonly env: Record<string, string>;\n readonly httpHooks: unknown;\n };\n createRealFsProvider(hostPath: string): unknown;\n createReadonlyProvider(provider: unknown): unknown;\n createMemoryProvider(): unknown;\n createShadowProvider(provider: unknown, options: unknown): unknown;\n createShadowPathPredicate(paths: readonly string[]): unknown;\n}\ninterface VfsMountSpec {\n readonly kind: 'realfs' | 'realfs-readonly' | 'memory' | 'shadow';\n readonly hostPath?: string;\n readonly shadowConfig?: {\n readonly deny: readonly string[];\n readonly tmpfs: readonly string[];\n };\n}\ninterface CreateVmOptions {\n readonly imagePath: string;\n readonly memory: string;\n readonly cpus: number;\n readonly rootfsMode: 'readonly' | 'memory' | 'cow';\n readonly allowedHosts: readonly string[];\n readonly secrets: Record<string, SecretSpec>;\n readonly vfsMounts: Record<string, VfsMountSpec>;\n readonly tcpHosts?: Record<string, string>;\n readonly env?: Record<string, string>;\n readonly sessionLabel?: string;\n readonly onRequest?: (request: Request) => Promise<Request | Response | void>;\n readonly onResponse?: (response: Response) => Promise<Response | void>;\n}\ninterface ManagedVm {\n readonly id: string;\n exec(command: string): Promise<ExecResult>;\n enableSsh(options?: unknown): Promise<SshAccess>;\n enableIngress(options?: unknown): Promise<IngressAccess>;\n getVmInstance(): ManagedVmInstance;\n setIngressRoutes(routes: readonly IngressRoute[]): void;\n close(): Promise<void>;\n}\ndeclare function createManagedVm(options: CreateVmOptions, dependencies?: ManagedVmDependencies): Promise<ManagedVm>;\n//#endregion\n//#region src/volume-manager.d.ts\ninterface VolumeConfigEntry {\n readonly guestPath: string;\n}\ninterface ResolvedVolume {\n readonly hostDir: string;\n readonly guestPath: string;\n}\ndeclare function ensureVolumeDir(cacheBase: string, workspaceHash: string, volumeName: string): Promise<string>;\ndeclare function resolveVolumeDirs(cacheBase: string, workspaceHash: string, volumes: Readonly<Record<string, VolumeConfigEntry>>): Promise<Record<string, ResolvedVolume>>;\n//#endregion\n//#region src/write-file-atomically.d.ts\ndeclare function writeFileAtomically(filePath: string, content: string, options?: {\n readonly mode?: number;\n}): Promise<void>;\n//#endregion\nexport { type BuildConfig, BuildImageOptions, BuildImageResult, CreateSecretResolverDependencies, CreateVmOptions, ExecFileOptions, ExecFileResult, ExecResult, IngressAccess, IngressRoute, ManagedVm, ManagedVmDependencies, ManagedVmInstance, PolicySources, ResolveGondolinMinimumZigVersionOptions, ResolvedVolume, RuntimeMountPolicyConfig, SecretRef, SecretResolver, SecretResolverClient, SecretSpec, SshAccess, TokenSource, VfsMountSpec, VolumeConfigEntry, WritableMountPolicy, buildImage, compilePolicy, computeBuildFingerprint, createManagedVm, createOpCliSecretResolver, createSecretResolver, dedupeStable, ensureVolumeDir, getDefaultBuildConfig, normalizeHostname, parseMinimumZigVersion, resolveGondolinMinimumZigVersion, resolveGondolinPackageJsonPath, resolveGondolinPackageSpec, resolveGuestMountPath, resolveServiceAccountToken, resolveVolumeDirs, validateRuntimeMountPolicy, validateWritableMount, writeFileAtomically };\n//# sourceMappingURL=index.d.ts.map"],"mappings":";cAAa;AAAA,KAED,WAAA,GAFoD,CAAA,OAE9B,iBAF8B,CAAA,CAAA,MAAA,CAAA;AAEpD,iBAEI,wBAAA,CAFmC,gBAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AAEnC,iBAIA,qBAAA,CAJwB,gBAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;;AKKxC;;UJqDUyB,UAAAA,CInDQ;EACf,SAAA,KAAA,EAAA,SAAA,MAAA,EAAA;EAAiC,SAAA,KAAA,EAAA,MAAA;;KJsD/BC,SAAAA;;;;;;;;;;UAeKE,cAAAA;eACKF,YAAYpB;mBAC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|
|
3
|
+
function buildGatewaySessionLabel(projectNamespace, zoneId) {
|
|
4
|
+
return `${projectNamespace}:${zoneId}:gateway`;
|
|
5
|
+
}
|
|
6
|
+
function buildToolSessionLabel(projectNamespace, zoneId, tcpSlot) {
|
|
7
|
+
return `${projectNamespace}:${zoneId}:tool:${tcpSlot}`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/split-resolved-gateway-secrets.ts
|
|
12
|
+
function splitResolvedGatewaySecrets(zone, resolvedSecrets) {
|
|
13
|
+
const environmentSecrets = {};
|
|
14
|
+
const mediatedSecrets = {};
|
|
15
|
+
for (const [secretName, secretValue] of Object.entries(resolvedSecrets)) {
|
|
16
|
+
const secretConfig = zone.secrets[secretName];
|
|
17
|
+
if (!secretConfig) {
|
|
18
|
+
process.stderr.write(`[split-resolved-gateway-secrets] Secret '${secretName}' was resolved but has no matching zone secret config.\n`);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (secretConfig.injection === "http-mediation" && secretConfig.hosts) {
|
|
22
|
+
mediatedSecrets[secretName] = {
|
|
23
|
+
hosts: [...secretConfig.hosts],
|
|
24
|
+
value: secretValue
|
|
25
|
+
};
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
environmentSecrets[secretName] = secretValue;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
environmentSecrets,
|
|
32
|
+
mediatedSecrets
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { buildGatewaySessionLabel, buildToolSessionLabel, gatewayTypeValues, splitResolvedGatewaySecrets };
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["environmentSecrets: Record<string, string>","mediatedSecrets: Record<string, SecretSpec>"],"sources":["../src/gateway-runtime-contract.ts","../src/split-resolved-gateway-secrets.ts"],"sourcesContent":["export const gatewayTypeValues = ['openclaw', 'worker'] as const;\n\nexport type GatewayType = (typeof gatewayTypeValues)[number];\n\nexport function buildGatewaySessionLabel(projectNamespace: string, zoneId: string): string {\n\treturn `${projectNamespace}:${zoneId}:gateway`;\n}\n\nexport function buildToolSessionLabel(\n\tprojectNamespace: string,\n\tzoneId: string,\n\ttcpSlot: number,\n): string {\n\treturn `${projectNamespace}:${zoneId}:tool:${tcpSlot}`;\n}\n","import type { SecretSpec } from '@agent-vm/gondolin-adapter';\n\nimport type { GatewayZoneConfig } from './gateway-lifecycle.js';\n\nexport interface SplitResolvedGatewaySecretsResult {\n\treadonly environmentSecrets: Record<string, string>;\n\treadonly mediatedSecrets: Record<string, SecretSpec>;\n}\n\nexport function splitResolvedGatewaySecrets(\n\tzone: GatewayZoneConfig,\n\tresolvedSecrets: Record<string, string>,\n): SplitResolvedGatewaySecretsResult {\n\tconst environmentSecrets: Record<string, string> = {};\n\tconst mediatedSecrets: Record<string, SecretSpec> = {};\n\n\tfor (const [secretName, secretValue] of Object.entries(resolvedSecrets)) {\n\t\tconst secretConfig = zone.secrets[secretName];\n\t\tif (!secretConfig) {\n\t\t\tprocess.stderr.write(\n\t\t\t\t`[split-resolved-gateway-secrets] Secret '${secretName}' was resolved but has no matching zone secret config.\\n`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (secretConfig.injection === 'http-mediation' && secretConfig.hosts) {\n\t\t\tmediatedSecrets[secretName] = {\n\t\t\t\thosts: [...secretConfig.hosts],\n\t\t\t\tvalue: secretValue,\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\n\t\tenvironmentSecrets[secretName] = secretValue;\n\t}\n\n\treturn { environmentSecrets, mediatedSecrets };\n}\n"],"mappings":";AAAA,MAAa,oBAAoB,CAAC,YAAY,SAAS;AAIvD,SAAgB,yBAAyB,kBAA0B,QAAwB;AAC1F,QAAO,GAAG,iBAAiB,GAAG,OAAO;;AAGtC,SAAgB,sBACf,kBACA,QACA,SACS;AACT,QAAO,GAAG,iBAAiB,GAAG,OAAO,QAAQ;;;;;ACJ9C,SAAgB,4BACf,MACA,iBACoC;CACpC,MAAMA,qBAA6C,EAAE;CACrD,MAAMC,kBAA8C,EAAE;AAEtD,MAAK,MAAM,CAAC,YAAY,gBAAgB,OAAO,QAAQ,gBAAgB,EAAE;EACxE,MAAM,eAAe,KAAK,QAAQ;AAClC,MAAI,CAAC,cAAc;AAClB,WAAQ,OAAO,MACd,4CAA4C,WAAW,0DACvD;AACD;;AAGD,MAAI,aAAa,cAAc,oBAAoB,aAAa,OAAO;AACtE,mBAAgB,cAAc;IAC7B,OAAO,CAAC,GAAG,aAAa,MAAM;IAC9B,OAAO;IACP;AACD;;AAGD,qBAAmB,cAAc;;AAGlC,QAAO;EAAE;EAAoB;EAAiB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agent-vm/gateway-interface",
|
|
3
|
+
"version": "0.0.20",
|
|
4
|
+
"description": "Shared TypeScript interfaces for VM gateway lifecycles, VmSpec, and ProcessSpec.",
|
|
5
|
+
"homepage": "https://github.com/ShravanSunder/agent-vm#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/ShravanSunder/agent-vm/issues"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "Shravan Sunder <ShravanSunder@users.noreply.github.com>",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/ShravanSunder/agent-vm.git",
|
|
14
|
+
"directory": "packages/gateway-interface"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@agent-vm/gondolin-adapter": "0.0.20"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsdown",
|
|
36
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
37
|
+
}
|
|
38
|
+
}
|