@tomflow/proflow-agent-gateway 0.1.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.
@@ -0,0 +1,77 @@
1
+ export declare const descriptor: {
2
+ readonly contract: "module";
3
+ readonly contractVersion: "1.0.0";
4
+ readonly moduleRef: "agent-gateway";
5
+ readonly packageName: "@tomflow/proflow-agent-gateway";
6
+ readonly moduleVersion: "0.1.0";
7
+ readonly kind: "service";
8
+ readonly templateVersion: "1.0.0";
9
+ readonly platformCompatibility: ">=1.0.0 <2.0.0";
10
+ readonly installClass: "core";
11
+ readonly identity: {
12
+ readonly domain: "agent-runtime-collaboration";
13
+ readonly summary: "The sole Custom GPT Actions HTTP ingress and OpenAI transport anti-corruption layer.";
14
+ };
15
+ readonly provides: readonly [{
16
+ readonly contractRef: "custom-gpt-actions-gateway";
17
+ readonly version: "1.0.0";
18
+ }];
19
+ readonly requires: readonly [{
20
+ readonly contractRef: "agent-runtime";
21
+ readonly versionRange: ">=1.0.0 <2.0.0";
22
+ }, {
23
+ readonly contractRef: "task-orchestration";
24
+ readonly versionRange: ">=1.0.0 <2.0.0";
25
+ }, {
26
+ readonly contractRef: "execution";
27
+ readonly versionRange: ">=1.0.0 <2.0.0";
28
+ }];
29
+ readonly requirements: readonly [{
30
+ readonly kind: "runtime";
31
+ readonly runtime: "node";
32
+ readonly versionRange: ">=24.19.0";
33
+ }];
34
+ readonly configSlots: readonly [{
35
+ readonly key: "localBaseUrl";
36
+ readonly type: "url";
37
+ readonly required: true;
38
+ readonly description: "Loopback HTTP listener URL owned by Agent Gateway and targeted by the public ingress resource";
39
+ }, {
40
+ readonly key: "publicBaseUrl";
41
+ readonly type: "url";
42
+ readonly required: true;
43
+ readonly description: "Public HTTPS URL supplied by the dev-tunnel resource";
44
+ }, {
45
+ readonly key: "downstreamCredentialFile";
46
+ readonly type: "path";
47
+ readonly required: true;
48
+ readonly sensitive: true;
49
+ readonly description: "File containing the dedicated Gateway-to-platform-host transport credential";
50
+ }, {
51
+ readonly key: "publicIngressModuleRef";
52
+ readonly type: "moduleRef";
53
+ readonly required: false;
54
+ readonly description: "External resource module governing the public ingress";
55
+ readonly default: "dev-tunnel";
56
+ }];
57
+ readonly lifecycle: {
58
+ readonly supported: readonly ["describe", "preflight", "status", "verify", "doctor", "start", "stop", "restart", "uninstall"];
59
+ };
60
+ readonly verification: {
61
+ readonly checks: readonly [{
62
+ readonly id: "gateway-readiness";
63
+ readonly description: "Gateway dependencies and transport guards are ready";
64
+ readonly lifecycle: "verify";
65
+ }];
66
+ };
67
+ readonly effects: readonly [{
68
+ readonly kind: "process";
69
+ readonly description: "Manage the declared service process";
70
+ readonly retention: "remove";
71
+ }];
72
+ readonly documentation: readonly [{
73
+ readonly id: "overview";
74
+ readonly path: "./README.md";
75
+ readonly description: "Agent Gateway package overview";
76
+ }];
77
+ };
@@ -0,0 +1,88 @@
1
+ export const descriptor = {
2
+ contract: "module",
3
+ contractVersion: "1.0.0",
4
+ moduleRef: "agent-gateway",
5
+ packageName: "@tomflow/proflow-agent-gateway",
6
+ moduleVersion: "0.1.0",
7
+ kind: "service",
8
+ templateVersion: "1.0.0",
9
+ platformCompatibility: ">=1.0.0 <2.0.0",
10
+ installClass: "core",
11
+ identity: {
12
+ domain: "agent-runtime-collaboration",
13
+ summary: "The sole Custom GPT Actions HTTP ingress and OpenAI transport anti-corruption layer.",
14
+ },
15
+ provides: [{ contractRef: "custom-gpt-actions-gateway", version: "1.0.0" }],
16
+ requires: [
17
+ { contractRef: "agent-runtime", versionRange: ">=1.0.0 <2.0.0" },
18
+ { contractRef: "task-orchestration", versionRange: ">=1.0.0 <2.0.0" },
19
+ { contractRef: "execution", versionRange: ">=1.0.0 <2.0.0" },
20
+ ],
21
+ requirements: [
22
+ { kind: "runtime", runtime: "node", versionRange: ">=24.19.0" },
23
+ ],
24
+ configSlots: [
25
+ {
26
+ key: "localBaseUrl",
27
+ type: "url",
28
+ required: true,
29
+ description: "Loopback HTTP listener URL owned by Agent Gateway and targeted by the public ingress resource",
30
+ },
31
+ {
32
+ key: "publicBaseUrl",
33
+ type: "url",
34
+ required: true,
35
+ description: "Public HTTPS URL supplied by the dev-tunnel resource",
36
+ },
37
+ {
38
+ key: "downstreamCredentialFile",
39
+ type: "path",
40
+ required: true,
41
+ sensitive: true,
42
+ description: "File containing the dedicated Gateway-to-platform-host transport credential",
43
+ },
44
+ {
45
+ key: "publicIngressModuleRef",
46
+ type: "moduleRef",
47
+ required: false,
48
+ description: "External resource module governing the public ingress",
49
+ default: "dev-tunnel",
50
+ },
51
+ ],
52
+ lifecycle: {
53
+ supported: [
54
+ "describe",
55
+ "preflight",
56
+ "status",
57
+ "verify",
58
+ "doctor",
59
+ "start",
60
+ "stop",
61
+ "restart",
62
+ "uninstall",
63
+ ],
64
+ },
65
+ verification: {
66
+ checks: [
67
+ {
68
+ id: "gateway-readiness",
69
+ description: "Gateway dependencies and transport guards are ready",
70
+ lifecycle: "verify",
71
+ },
72
+ ],
73
+ },
74
+ effects: [
75
+ {
76
+ kind: "process",
77
+ description: "Manage the declared service process",
78
+ retention: "remove",
79
+ },
80
+ ],
81
+ documentation: [
82
+ {
83
+ id: "overview",
84
+ path: "./README.md",
85
+ description: "Agent Gateway package overview",
86
+ },
87
+ ],
88
+ };
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from "node:child_process";
3
+ import { createAgentGatewayProcess, loadAgentGatewayProcessConfig, } from "./process.js";
4
+ function installSelf() {
5
+ const executable = process.platform === "win32" ? "npx.cmd" : "npx";
6
+ const result = spawnSync(executable, [
7
+ "--yes",
8
+ "@tomflow/proflow-platform-cli",
9
+ "install",
10
+ "@tomflow/proflow-agent-gateway",
11
+ ], { cwd: process.cwd(), env: process.env, stdio: "inherit" });
12
+ if (result.error)
13
+ throw result.error;
14
+ process.exit(result.status ?? 1);
15
+ }
16
+ async function main() {
17
+ const [command, configPath] = process.argv.slice(2);
18
+ if (command === "--help" || command === "-h") {
19
+ process.stdout.write("Usage: proflow-agent-gateway install | start /absolute/config.json\\n");
20
+ process.exit(0);
21
+ }
22
+ if (command === "install") {
23
+ if (configPath)
24
+ throw new Error("Usage: proflow-agent-gateway install");
25
+ installSelf();
26
+ }
27
+ if (command !== "start" || !configPath)
28
+ throw new Error("Usage: proflow-agent-gateway start /absolute/config.json");
29
+ const config = await loadAgentGatewayProcessConfig(configPath);
30
+ if (!config.downstreamCredentialFile)
31
+ throw new Error("agent-gateway requires downstreamCredentialFile for authenticated platform-host transport");
32
+ const processService = await createAgentGatewayProcess({
33
+ config,
34
+ log: (entry) => process.stderr.write(`${JSON.stringify(entry)}\n`),
35
+ });
36
+ const address = await processService.start();
37
+ process.stdout.write(`${JSON.stringify({ status: "RUNNING", ...address })}\n`);
38
+ let stopping = false;
39
+ const stop = () => {
40
+ if (stopping)
41
+ return;
42
+ stopping = true;
43
+ void processService.stop().finally(() => process.exit(0));
44
+ };
45
+ process.on("SIGINT", stop);
46
+ process.on("SIGTERM", stop);
47
+ await new Promise(() => { });
48
+ }
49
+ if (import.meta.main) {
50
+ await main();
51
+ }
@@ -0,0 +1,99 @@
1
+ import { z } from "zod";
2
+ export interface ExternalFileMaterializationInput {
3
+ name: string;
4
+ provenanceRef: string;
5
+ declaredMimeType: string;
6
+ sourceUrl: string;
7
+ }
8
+ export type GatewayOwnerPorts = {
9
+ authenticateBearer(credential: string): Promise<string>;
10
+ route(operationId: string, authenticatedRoleRef: string, input: unknown, context?: {
11
+ signal: AbortSignal;
12
+ fileMaterializationInputs?: readonly ExternalFileMaterializationInput[];
13
+ }): Promise<unknown>;
14
+ lookupResult?(operationId: string, authenticatedRoleRef: string, input: unknown): Promise<unknown>;
15
+ readiness(): Promise<Record<string, boolean>>;
16
+ };
17
+ export type GatewayOptions = {
18
+ owners: GatewayOwnerPorts;
19
+ relayBaseUrl: string;
20
+ host?: string;
21
+ port?: number;
22
+ now?: () => number;
23
+ actionTimeoutMs?: number;
24
+ };
25
+ export declare class AgentGatewayError extends Error {
26
+ readonly code: string;
27
+ constructor(code: string, message?: string);
28
+ }
29
+ declare const fileInputSchema: z.ZodObject<{
30
+ name: z.ZodString;
31
+ id: z.ZodString;
32
+ mime_type: z.ZodString;
33
+ download_link: z.ZodURL;
34
+ }, z.core.$strict>;
35
+ type FileInput = z.infer<typeof fileInputSchema>;
36
+ type RelayArtifact = {
37
+ artifactRef: string;
38
+ name: string;
39
+ mimeType: string;
40
+ bytes: Buffer;
41
+ };
42
+ declare const ownerFileBridgeArtifactSchema: z.ZodObject<{
43
+ artifactRef: z.ZodString;
44
+ name: z.ZodString;
45
+ mimeType: z.ZodString;
46
+ content: z.ZodString;
47
+ }, z.core.$strip>;
48
+ export type OwnerFileBridgeArtifact = z.infer<typeof ownerFileBridgeArtifactSchema>;
49
+ declare const ownerFileBridgeOutputSchema: z.ZodObject<{
50
+ fileArtifacts: z.ZodArray<z.ZodObject<{
51
+ artifactRef: z.ZodString;
52
+ name: z.ZodString;
53
+ mimeType: z.ZodString;
54
+ content: z.ZodString;
55
+ }, z.core.$strip>>;
56
+ }, z.core.$strip>;
57
+ export type OwnerFileBridgeOutput = z.infer<typeof ownerFileBridgeOutputSchema>;
58
+ export declare function createAgentGateway(options: GatewayOptions): Promise<Readonly<{
59
+ start: () => Promise<{
60
+ host: string;
61
+ port: number;
62
+ }>;
63
+ stop: () => Promise<void>;
64
+ restart: () => Promise<{
65
+ host: string;
66
+ port: number;
67
+ }>;
68
+ readiness: () => Promise<{
69
+ status: "NOT_READY" | "READY";
70
+ checks: {
71
+ ingress: boolean;
72
+ relay: boolean;
73
+ };
74
+ }>;
75
+ status: () => {
76
+ process: "DRAINING" | "RUNNING" | "STOPPED";
77
+ liveness: "DOWN" | "UP";
78
+ accepting: boolean;
79
+ inFlight: number;
80
+ };
81
+ assertSafeRemoteUrl: (raw: string) => URL;
82
+ normalizeFileInputs: (raw: unknown) => FileInput[];
83
+ createRelay: (artifact: RelayArtifact) => {
84
+ token: string;
85
+ url: string;
86
+ };
87
+ readRelay: (token: string, method: string, artifactRef?: string) => Promise<{
88
+ body: Buffer<ArrayBufferLike>;
89
+ headers: {
90
+ "content-type": string;
91
+ "content-disposition": string;
92
+ };
93
+ }>;
94
+ serializeFileResponse: (raw: RelayArtifact[]) => {
95
+ openaiFileResponse: Record<string, string>[];
96
+ };
97
+ businessPersistence: readonly never[];
98
+ }>>;
99
+ export {};