@madebyentropy/tnl 0.0.0-stage → 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.
Files changed (198) hide show
  1. package/LICENSE +28 -0
  2. package/NOTICE +5 -0
  3. package/THIRD_PARTY_LICENSES.txt +3297 -0
  4. package/dist/adapters/ioredis.d.ts +7 -0
  5. package/dist/adapters/ioredis.js +87 -0
  6. package/dist/adapters/node-postgres.d.ts +8 -0
  7. package/dist/adapters/node-postgres.js +41 -0
  8. package/dist/adapters/postgres-js.d.ts +7 -0
  9. package/dist/adapters/postgres-js.js +55 -0
  10. package/dist/bin/tnl.d.ts +2 -0
  11. package/dist/bin/tnl.js +16 -0
  12. package/dist/browser.d.ts +18 -0
  13. package/dist/browser.js +43 -0
  14. package/dist/bun.d.ts +9 -0
  15. package/dist/bun.js +6 -0
  16. package/dist/cloudflare.d.ts +9 -0
  17. package/dist/cloudflare.js +16 -0
  18. package/dist/config.d.ts +107 -0
  19. package/dist/config.gen.d.ts +1185 -0
  20. package/dist/config.gen.js +2 -0
  21. package/dist/config.js +3 -0
  22. package/dist/control.d.ts +5 -0
  23. package/dist/control.js +9 -0
  24. package/dist/durable-object.d.ts +51 -0
  25. package/dist/durable-object.js +374 -0
  26. package/dist/durable-object.worker.d.ts +5 -0
  27. package/dist/durable-object.worker.js +11 -0
  28. package/dist/errors.d.ts +17 -0
  29. package/dist/errors.js +230 -0
  30. package/dist/index.d.ts +10 -0
  31. package/dist/index.js +2 -0
  32. package/dist/internal/connector/cancellation.d.ts +7 -0
  33. package/dist/internal/connector/cancellation.js +30 -0
  34. package/dist/internal/connector/client.d.ts +62 -0
  35. package/dist/internal/connector/client.js +504 -0
  36. package/dist/internal/connector/client_factory.d.ts +6 -0
  37. package/dist/internal/connector/client_factory.js +123 -0
  38. package/dist/internal/connector/connection.d.ts +39 -0
  39. package/dist/internal/connector/connection.js +739 -0
  40. package/dist/internal/connector/connection_ipc.d.ts +12 -0
  41. package/dist/internal/connector/connection_ipc.js +198 -0
  42. package/dist/internal/connector/context.d.ts +28 -0
  43. package/dist/internal/connector/context.js +19 -0
  44. package/dist/internal/connector/contract.d.ts +392 -0
  45. package/dist/internal/connector/contract.js +56 -0
  46. package/dist/internal/connector/deployment_types.d.ts +27 -0
  47. package/dist/internal/connector/deployment_types.js +1 -0
  48. package/dist/internal/connector/driver_socket.d.ts +21 -0
  49. package/dist/internal/connector/driver_socket.js +129 -0
  50. package/dist/internal/connector/management.d.ts +29 -0
  51. package/dist/internal/connector/management.js +118 -0
  52. package/dist/internal/connector/native_operations.d.ts +16 -0
  53. package/dist/internal/connector/native_operations.js +30 -0
  54. package/dist/internal/connector/native_stream.d.ts +7 -0
  55. package/dist/internal/connector/native_stream.js +219 -0
  56. package/dist/internal/connector/operation_handles.d.ts +9 -0
  57. package/dist/internal/connector/operation_handles.js +18 -0
  58. package/dist/internal/connector/portable_operations.d.ts +13 -0
  59. package/dist/internal/connector/portable_operations.js +25 -0
  60. package/dist/internal/connector/snapshot.d.ts +183 -0
  61. package/dist/internal/connector/snapshot.js +47 -0
  62. package/dist/internal/connector/wasm_abi.d.ts +76 -0
  63. package/dist/internal/connector/wasm_abi.js +5 -0
  64. package/dist/internal/connector/wasm_client.d.ts +58 -0
  65. package/dist/internal/connector/wasm_client.js +545 -0
  66. package/dist/internal/connector/wasm_loader.d.ts +15 -0
  67. package/dist/internal/connector/wasm_loader.js +99 -0
  68. package/dist/internal/connector/wasm_stream.d.ts +4 -0
  69. package/dist/internal/connector/wasm_stream.js +177 -0
  70. package/dist/internal/connector/workload/contract.d.ts +54 -0
  71. package/dist/internal/connector/workload/contract.js +14 -0
  72. package/dist/internal/connector/workload/provider.d.ts +24 -0
  73. package/dist/internal/connector/workload/provider.js +130 -0
  74. package/dist/internal/enrollment_source.d.ts +4 -0
  75. package/dist/internal/enrollment_source.js +34 -0
  76. package/dist/internal/management/client/client.gen.d.ts +2 -0
  77. package/dist/internal/management/client/client.gen.js +216 -0
  78. package/dist/internal/management/client/index.d.ts +10 -0
  79. package/dist/internal/management/client/index.js +6 -0
  80. package/dist/internal/management/client/types.gen.d.ts +120 -0
  81. package/dist/internal/management/client/types.gen.js +2 -0
  82. package/dist/internal/management/client/utils.gen.d.ts +37 -0
  83. package/dist/internal/management/client/utils.gen.js +228 -0
  84. package/dist/internal/management/client.gen.d.ts +12 -0
  85. package/dist/internal/management/client.gen.js +3 -0
  86. package/dist/internal/management/core/auth.gen.d.ts +25 -0
  87. package/dist/internal/management/core/auth.gen.js +14 -0
  88. package/dist/internal/management/core/bodySerializer.gen.d.ts +25 -0
  89. package/dist/internal/management/core/bodySerializer.gen.js +57 -0
  90. package/dist/internal/management/core/params.gen.d.ts +43 -0
  91. package/dist/internal/management/core/params.gen.js +109 -0
  92. package/dist/internal/management/core/pathSerializer.gen.d.ts +33 -0
  93. package/dist/internal/management/core/pathSerializer.gen.js +106 -0
  94. package/dist/internal/management/core/queryKeySerializer.gen.d.ts +18 -0
  95. package/dist/internal/management/core/queryKeySerializer.gen.js +92 -0
  96. package/dist/internal/management/core/serverSentEvents.gen.d.ts +71 -0
  97. package/dist/internal/management/core/serverSentEvents.gen.js +132 -0
  98. package/dist/internal/management/core/types.gen.d.ts +83 -0
  99. package/dist/internal/management/core/types.gen.js +2 -0
  100. package/dist/internal/management/core/utils.gen.d.ts +19 -0
  101. package/dist/internal/management/core/utils.gen.js +87 -0
  102. package/dist/internal/management/index.d.ts +2 -0
  103. package/dist/internal/management/index.js +2 -0
  104. package/dist/internal/management/sdk.gen.d.ts +73 -0
  105. package/dist/internal/management/sdk.gen.js +191 -0
  106. package/dist/internal/management/types.gen.d.ts +464 -0
  107. package/dist/internal/management/types.gen.js +2 -0
  108. package/dist/internal/management/zod.gen.d.ts +850 -0
  109. package/dist/internal/management/zod.gen.js +252 -0
  110. package/dist/internal/native/launcher.d.ts +8 -0
  111. package/dist/internal/native/launcher.js +75 -0
  112. package/dist/internal/native/native-targets.d.ts +9 -0
  113. package/dist/internal/native/native-targets.js +8 -0
  114. package/dist/internal/portable/cloudflare-publisher-client.d.ts +54 -0
  115. package/dist/internal/portable/cloudflare-publisher-client.js +91 -0
  116. package/dist/internal/portable/cloudflare-publisher.d.ts +19 -0
  117. package/dist/internal/portable/cloudflare-publisher.js +210 -0
  118. package/dist/internal/portable/durable-deployment.d.ts +10 -0
  119. package/dist/internal/portable/durable-deployment.js +22 -0
  120. package/dist/internal/portable/enrollment.d.ts +26 -0
  121. package/dist/internal/portable/enrollment.js +196 -0
  122. package/dist/internal/portable/publication.d.ts +54 -0
  123. package/dist/internal/portable/publication.js +304 -0
  124. package/dist/internal/portable/request.d.ts +1 -0
  125. package/dist/internal/portable/request.js +20 -0
  126. package/dist/internal/portable/storage-browser.d.ts +9 -0
  127. package/dist/internal/portable/storage-browser.js +115 -0
  128. package/dist/internal/portable/storage-durable-object.d.ts +11 -0
  129. package/dist/internal/portable/storage-durable-object.js +110 -0
  130. package/dist/internal/portable/storage-host.d.ts +8 -0
  131. package/dist/internal/portable/storage-host.js +142 -0
  132. package/dist/internal/portable/storage.d.ts +15 -0
  133. package/dist/internal/portable/storage.js +29 -0
  134. package/dist/internal/project/native_runtime.d.ts +24 -0
  135. package/dist/internal/project/native_runtime.js +23 -0
  136. package/dist/internal/project/runtime.d.ts +467 -0
  137. package/dist/internal/project/runtime.js +183 -0
  138. package/dist/internal/project/service_metadata.d.ts +3 -0
  139. package/dist/internal/project/service_metadata.js +12 -0
  140. package/dist/internal/publication_certificate.d.ts +28 -0
  141. package/dist/internal/publication_certificate.js +32 -0
  142. package/dist/internal/publication_run.d.ts +8 -0
  143. package/dist/internal/publication_run.js +19 -0
  144. package/dist/internal/publisher/app.d.ts +33 -0
  145. package/dist/internal/publisher/app.js +317 -0
  146. package/dist/internal/publisher/fetch.d.ts +6 -0
  147. package/dist/internal/publisher/fetch.js +135 -0
  148. package/dist/internal/publisher/fetch_types.d.ts +1 -0
  149. package/dist/internal/publisher/fetch_types.js +1 -0
  150. package/dist/internal/publisher/framework.d.ts +27 -0
  151. package/dist/internal/publisher/framework.js +82 -0
  152. package/dist/internal/publisher/local.d.ts +39 -0
  153. package/dist/internal/publisher/local.js +312 -0
  154. package/dist/internal/publisher/native_publisher.d.ts +25 -0
  155. package/dist/internal/publisher/native_publisher.js +228 -0
  156. package/dist/internal/publisher/port.d.ts +2 -0
  157. package/dist/internal/publisher/port.js +15 -0
  158. package/dist/internal/publisher/publication.d.ts +88 -0
  159. package/dist/internal/publisher/publication.js +627 -0
  160. package/dist/internal/publisher/register.d.ts +31 -0
  161. package/dist/internal/publisher/register.js +136 -0
  162. package/dist/internal/publisher/registration.d.ts +385 -0
  163. package/dist/internal/publisher/registration.js +223 -0
  164. package/dist/internal/publisher/status.d.ts +47 -0
  165. package/dist/internal/publisher/status.js +137 -0
  166. package/dist/internal/publisher/target.d.ts +6 -0
  167. package/dist/internal/publisher/target.js +44 -0
  168. package/dist/internal/runtime_resources.d.ts +38 -0
  169. package/dist/internal/runtime_resources.js +52 -0
  170. package/dist/internal/tracing.d.ts +10 -0
  171. package/dist/internal/tracing.js +78 -0
  172. package/dist/internal/validation.d.ts +3 -0
  173. package/dist/internal/validation.js +9 -0
  174. package/dist/internal/values.d.ts +27 -0
  175. package/dist/internal/values.js +54 -0
  176. package/dist/next.d.ts +12 -0
  177. package/dist/next.js +82 -0
  178. package/dist/node.d.ts +9 -0
  179. package/dist/node.js +6 -0
  180. package/dist/project.d.ts +173 -0
  181. package/dist/project.js +1 -0
  182. package/dist/response.d.ts +1 -0
  183. package/dist/response.js +34 -0
  184. package/dist/third-party-licenses.txt +1537 -0
  185. package/dist/vite.d.ts +5 -0
  186. package/dist/vite.js +200 -0
  187. package/dist/wasm/build.json +16 -0
  188. package/dist/wasm/connector.wasm +0 -0
  189. package/dist/wasm/go-license.txt +27 -0
  190. package/dist/wasm/publisher.wasm +0 -0
  191. package/dist/wasm/third-party-licenses.txt +3297 -0
  192. package/dist/wasm/wasm_exec.d.ts +1 -0
  193. package/dist/wasm/wasm_exec.js +575 -0
  194. package/dist/workload.d.ts +11 -0
  195. package/dist/workload.js +4 -0
  196. package/package.json +159 -4
  197. package/readme.md +13 -0
  198. package/README.md +0 -3
@@ -0,0 +1,12 @@
1
+ import { TnlError } from "../../errors.js";
2
+ import type { SelectionOptions, WorkloadRequest } from "./workload/contract.js";
3
+ export interface OwnerIPC {
4
+ readonly expiresAt: number;
5
+ prepare(service: string, assertion?: string, selection?: SelectionOptions, expected?: ProjectDeploymentSelection): Promise<unknown>;
6
+ workload(service: string, request: WorkloadRequest): Promise<unknown>;
7
+ close(reason?: TnlError): void;
8
+ }
9
+ type ProjectDeploymentSelection = Pick<NonNullable<SelectionOptions["deployment"]>, "project" | "name">;
10
+ /** private capability loading mirrors connector ownership/symlink/size checks. */
11
+ export declare function ownerIPC(filename: string): Promise<OwnerIPC>;
12
+ export {};
@@ -0,0 +1,198 @@
1
+ import { constants } from "node:fs";
2
+ import { lstat, open } from "node:fs/promises";
3
+ import { Agent, request } from "node:http";
4
+ import * as path from "node:path";
5
+ import { isDeepStrictEqual } from "node:util";
6
+ import { TnlError } from "../../errors.js";
7
+ import { connectionHandleSchema } from "./contract.js";
8
+ import { operation, traceHeaders } from "../tracing.js";
9
+ /** initial reads and renewal reads enforce the same private-file boundary. */
10
+ async function readHandle(filename) {
11
+ if (!path.isAbsolute(filename) ||
12
+ filename.includes("\0") ||
13
+ filename.length > 4096 ||
14
+ process.getuid === undefined)
15
+ throw new Error("invalid handle path");
16
+ const parent = path.dirname(filename);
17
+ for (let directory = parent;; directory = path.dirname(directory)) {
18
+ const info = await lstat(directory);
19
+ if (!info.isDirectory() ||
20
+ info.isSymbolicLink() ||
21
+ ((info.mode & 0o022) !== 0 && (info.mode & 0o1000) === 0))
22
+ throw new Error("unsafe handle ancestor");
23
+ if (directory === parent && ((info.mode & 0o777) !== 0o700 || info.uid !== process.getuid()))
24
+ throw new Error("unowned handle directory");
25
+ if (directory === path.dirname(directory))
26
+ break;
27
+ }
28
+ const file = await open(filename, constants.O_RDONLY | constants.O_NONBLOCK | constants.O_NOFOLLOW);
29
+ let data;
30
+ try {
31
+ const info = await file.stat();
32
+ if (!info.isFile() ||
33
+ (info.mode & 0o777) !== 0o600 ||
34
+ info.uid !== process.getuid() ||
35
+ info.size > 128 * 1024)
36
+ throw new Error("unowned handle");
37
+ const buffer = Buffer.alloc(128 * 1024 + 1);
38
+ let total = 0;
39
+ while (total < buffer.length) {
40
+ const { bytesRead } = await file.read(buffer, total, buffer.length - total, null);
41
+ if (bytesRead === 0)
42
+ break;
43
+ total += bytesRead;
44
+ }
45
+ if (total > 128 * 1024)
46
+ throw new Error("oversized handle");
47
+ data = buffer.subarray(0, total);
48
+ }
49
+ finally {
50
+ await file.close();
51
+ }
52
+ return connectionHandleSchema.parse(JSON.parse(data.toString("utf8")));
53
+ }
54
+ /** private capability loading mirrors connector ownership/symlink/size checks. */
55
+ export async function ownerIPC(filename) {
56
+ try {
57
+ const handle = await readHandle(filename);
58
+ const { expires_at: initialExpiry, ...identity } = handle;
59
+ const endpoint = new URL(handle.url);
60
+ const key = handle.key;
61
+ const scope = { schema: 1, directory: handle.directory, config_digest: handle.config_digest };
62
+ let expires = initialExpiry;
63
+ const agent = new Agent({ keepAlive: true, maxSockets: 4, maxFreeSockets: 4 });
64
+ let pending = 0;
65
+ let closed = false;
66
+ let closeReason = new TnlError("sdk.connection_unavailable");
67
+ let expiry;
68
+ let refreshing;
69
+ const close = (reason) => {
70
+ if (reason !== undefined)
71
+ closeReason = reason;
72
+ closed = true;
73
+ clearTimeout(expiry);
74
+ agent.destroy();
75
+ };
76
+ const scheduleExpiry = () => {
77
+ clearTimeout(expiry);
78
+ expiry = setTimeout(() => {
79
+ if (Date.now() < expires)
80
+ scheduleExpiry();
81
+ else
82
+ void current().catch(() => { });
83
+ }, Math.max(1, Math.min(expires - Date.now(), 2 ** 31 - 1)));
84
+ expiry.unref();
85
+ };
86
+ // renewal can advance only this exact capability. it never retargets an
87
+ // adapter or replays a request already sent to the native owner.
88
+ const current = async () => {
89
+ if (closed)
90
+ throw closeReason;
91
+ if (Date.now() < expires)
92
+ return;
93
+ refreshing ??= (async () => {
94
+ try {
95
+ const { expires_at: next, ...nextIdentity } = await readHandle(filename);
96
+ if (!isDeepStrictEqual(identity, nextIdentity) || next <= Date.now())
97
+ throw new TnlError("sdk.connection_unavailable");
98
+ if (!closed) {
99
+ expires = next;
100
+ scheduleExpiry();
101
+ }
102
+ }
103
+ catch {
104
+ close();
105
+ throw new TnlError("sdk.connection_unavailable");
106
+ }
107
+ finally {
108
+ refreshing = undefined;
109
+ }
110
+ })();
111
+ await refreshing;
112
+ if (closed)
113
+ throw closeReason;
114
+ if (Date.now() >= expires)
115
+ throw new TnlError("sdk.connection_unavailable");
116
+ };
117
+ scheduleExpiry();
118
+ const send = (operationName, service, assertion, selection, expected) => {
119
+ return operation("sdk.native.request", async () => {
120
+ if (closed)
121
+ throw closeReason;
122
+ if (pending >= 64)
123
+ throw new TnlError("sdk.connection_unavailable");
124
+ pending++;
125
+ try {
126
+ await current();
127
+ return await new Promise((resolve, reject) => {
128
+ const body = JSON.stringify({
129
+ ...scope,
130
+ service,
131
+ ...(assertion === undefined ? {} : { assertion }),
132
+ ...selection,
133
+ ...(expected === undefined ? {} : { selection: expected }),
134
+ });
135
+ const req = request(new URL(`/v1/connections/${operationName}`, endpoint), {
136
+ method: "POST",
137
+ agent,
138
+ headers: {
139
+ ...traceHeaders(),
140
+ authorization: `Bearer ${key}`,
141
+ "content-type": "application/json",
142
+ "content-length": Buffer.byteLength(body),
143
+ },
144
+ }, (response) => {
145
+ const chunks = [];
146
+ let size = 0;
147
+ response.on("data", (chunk) => {
148
+ size += chunk.length;
149
+ if (size > 128 * 1024) {
150
+ response.destroy();
151
+ reject(new TnlError("sdk.response_invalid"));
152
+ }
153
+ else
154
+ chunks.push(chunk);
155
+ });
156
+ response.on("error", () => reject(closed ? closeReason : new TnlError("sdk.connection_unavailable")));
157
+ response.on("end", () => {
158
+ if ((response.statusCode !== 200 && operationName === "prepare") ||
159
+ response.headers["content-type"]?.split(";")[0] !== "application/json") {
160
+ reject(new TnlError("sdk.connection_unavailable"));
161
+ return;
162
+ }
163
+ try {
164
+ const value = JSON.parse(Buffer.concat(chunks).toString("utf8"));
165
+ resolve(value);
166
+ }
167
+ catch {
168
+ reject(new TnlError("sdk.response_invalid"));
169
+ }
170
+ });
171
+ });
172
+ const timer = setTimeout(() => req.destroy(new Error("owner IPC deadline")), 35_000);
173
+ req.once("close", () => clearTimeout(timer));
174
+ req.once("error", () => reject(closed ? closeReason : new TnlError("sdk.connection_unavailable")));
175
+ req.end(body);
176
+ });
177
+ }
178
+ catch (cause) {
179
+ throw cause instanceof TnlError ? cause : new TnlError("sdk.connection_unavailable");
180
+ }
181
+ finally {
182
+ pending--;
183
+ }
184
+ });
185
+ };
186
+ return Object.freeze({
187
+ get expiresAt() {
188
+ return expires;
189
+ },
190
+ prepare: (service, assertion, selection, expected) => send(selection === undefined ? "prepare" : "sdk-prepare", service, assertion, selection, expected),
191
+ workload: (service, request) => send("sdk-workload", service, undefined, { sdk_workload: request }),
192
+ close,
193
+ });
194
+ }
195
+ catch {
196
+ throw new TnlError("sdk.connection_unavailable");
197
+ }
198
+ }
@@ -0,0 +1,28 @@
1
+ import type { WorkloadConfiguration } from "./workload/provider.js";
2
+ import { TnlError } from "../../errors.js";
3
+ import type { OwnerIPC } from "./connection_ipc.js";
4
+ import type { SelectionOptions, WorkloadRequest } from "./workload/contract.js";
5
+ export interface NativeScope {
6
+ readonly directory: string;
7
+ readonly registry: string;
8
+ readonly binary: string;
9
+ readonly signal?: AbortSignal;
10
+ readonly environment: Pick<NodeJS.ProcessEnv, "TNL_STATE_DIR" | "TNL_SERVER" | "TNL_CONNECTION_HANDLE">;
11
+ open(file: string): Promise<OwnerIPC>;
12
+ select(args: string[], input: unknown, name: string, assertion: string | undefined, options: SelectionOptions): Promise<unknown>;
13
+ workload(name: string, request: WorkloadRequest): Promise<unknown>;
14
+ close?(until?: number, reason?: TnlError): Promise<void>;
15
+ entry?: {
16
+ readonly file: string;
17
+ readonly ipc: Promise<OwnerIPC>;
18
+ };
19
+ }
20
+ interface ConnectorContext {
21
+ readonly workloads: Map<string, WorkloadConfiguration>;
22
+ }
23
+ declare global {
24
+ var __tnlConnectorContextV2: ConnectorContext | undefined;
25
+ }
26
+ export declare const context: ConnectorContext;
27
+ export declare function contextKey(): string;
28
+ export {};
@@ -0,0 +1,19 @@
1
+ import { realpathSync } from "node:fs";
2
+ import { TnlError } from "../../errors.js";
3
+ // copies share only workload setup. each deployment owns its IPC and cleanup.
4
+ export const context = (globalThis.__tnlConnectorContextV2 ??= {
5
+ workloads: new Map(),
6
+ });
7
+ export function contextKey() {
8
+ try {
9
+ return JSON.stringify([
10
+ realpathSync(process.cwd()),
11
+ process.env.TNL_STATE_DIR,
12
+ process.env.TNL_SERVER,
13
+ process.env.TNL_CONNECTION_HANDLE,
14
+ ]);
15
+ }
16
+ catch {
17
+ throw new TnlError("sdk.configuration_invalid");
18
+ }
19
+ }
@@ -0,0 +1,392 @@
1
+ import * as z from "zod";
2
+ export declare const preparedConnectionSchema: z.ZodObject<{
3
+ schema: z.ZodLiteral<1>;
4
+ project_runtime: z.ZodReadonly<z.ZodObject<{
5
+ namespace: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
6
+ services: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodReadonly<z.ZodDiscriminatedUnion<[z.ZodObject<{
7
+ namespace: z.ZodString;
8
+ hostname: z.ZodString;
9
+ port: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodInt]>;
10
+ public: z.ZodBoolean;
11
+ protocol: z.ZodLiteral<"http">;
12
+ url: z.ZodTemplateLiteral<`https://${string}`>;
13
+ paths: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodTemplateLiteral<`/${string}`>, z.ZodReadonly<z.ZodObject<{
14
+ service: z.ZodString;
15
+ url: z.ZodTemplateLiteral<`https://${string}`>;
16
+ stripPrefix: z.ZodBoolean;
17
+ }, z.core.$strict>>>, z.ZodTransform<Readonly<Record<string, Readonly<{
18
+ service: string;
19
+ url: `https://${string}`;
20
+ stripPrefix: boolean;
21
+ }> | undefined>>, Record<`/${string}`, Readonly<{
22
+ service: string;
23
+ url: `https://${string}`;
24
+ stripPrefix: boolean;
25
+ }>>>>>;
26
+ }, z.core.$strict>, z.ZodObject<{
27
+ namespace: z.ZodString;
28
+ hostname: z.ZodString;
29
+ port: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodInt]>;
30
+ public: z.ZodBoolean;
31
+ protocol: z.ZodLiteral<"kubernetes">;
32
+ url: z.ZodTemplateLiteral<`https://${string}`>;
33
+ }, z.core.$strict>, z.ZodObject<{
34
+ namespace: z.ZodString;
35
+ hostname: z.ZodString;
36
+ port: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodInt]>;
37
+ public: z.ZodBoolean;
38
+ protocol: z.ZodLiteral<"postgres">;
39
+ }, z.core.$strict>, z.ZodObject<{
40
+ namespace: z.ZodString;
41
+ hostname: z.ZodString;
42
+ port: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodInt]>;
43
+ public: z.ZodBoolean;
44
+ protocol: z.ZodLiteral<"mysql">;
45
+ }, z.core.$strict>, z.ZodObject<{
46
+ namespace: z.ZodString;
47
+ hostname: z.ZodString;
48
+ port: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodInt]>;
49
+ public: z.ZodBoolean;
50
+ protocol: z.ZodLiteral<"tcp">;
51
+ }, z.core.$strict>], "protocol">>>, z.ZodTransform<Readonly<Record<string, Readonly<{
52
+ namespace: string;
53
+ hostname: string;
54
+ port: number;
55
+ public: boolean;
56
+ protocol: "http";
57
+ url: `https://${string}`;
58
+ paths?: Readonly<Record<string, Readonly<{
59
+ service: string;
60
+ url: `https://${string}`;
61
+ stripPrefix: boolean;
62
+ }> | undefined>> | undefined;
63
+ }> | Readonly<{
64
+ namespace: string;
65
+ hostname: string;
66
+ port: number;
67
+ public: boolean;
68
+ protocol: "kubernetes";
69
+ url: `https://${string}`;
70
+ }> | Readonly<{
71
+ namespace: string;
72
+ hostname: string;
73
+ port: number;
74
+ public: boolean;
75
+ protocol: "postgres";
76
+ }> | Readonly<{
77
+ namespace: string;
78
+ hostname: string;
79
+ port: number;
80
+ public: boolean;
81
+ protocol: "mysql";
82
+ }> | Readonly<{
83
+ namespace: string;
84
+ hostname: string;
85
+ port: number;
86
+ public: boolean;
87
+ protocol: "tcp";
88
+ }> | undefined>>, Record<string, Readonly<{
89
+ namespace: string;
90
+ hostname: string;
91
+ port: number;
92
+ public: boolean;
93
+ protocol: "http";
94
+ url: `https://${string}`;
95
+ paths?: Readonly<Record<string, Readonly<{
96
+ service: string;
97
+ url: `https://${string}`;
98
+ stripPrefix: boolean;
99
+ }> | undefined>> | undefined;
100
+ }> | Readonly<{
101
+ namespace: string;
102
+ hostname: string;
103
+ port: number;
104
+ public: boolean;
105
+ protocol: "kubernetes";
106
+ url: `https://${string}`;
107
+ }> | Readonly<{
108
+ namespace: string;
109
+ hostname: string;
110
+ port: number;
111
+ public: boolean;
112
+ protocol: "postgres";
113
+ }> | Readonly<{
114
+ namespace: string;
115
+ hostname: string;
116
+ port: number;
117
+ public: boolean;
118
+ protocol: "mysql";
119
+ }> | Readonly<{
120
+ namespace: string;
121
+ hostname: string;
122
+ port: number;
123
+ public: boolean;
124
+ protocol: "tcp";
125
+ }>>>>;
126
+ worktree: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
127
+ label: z.ZodReadonly<z.ZodObject<{
128
+ project: z.ZodString;
129
+ checkout: z.ZodExactOptional<z.ZodString>;
130
+ id: z.ZodString;
131
+ fullLabel: z.ZodString;
132
+ }, z.core.$strict>>;
133
+ }, z.core.$strict>>>;
134
+ oauth: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
135
+ hostname: z.ZodString;
136
+ url: z.ZodTemplateLiteral<`https://${string}`>;
137
+ }, z.core.$strict>>>;
138
+ webhooks: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodReadonly<z.ZodObject<{
139
+ hostname: z.ZodString;
140
+ url: z.ZodTemplateLiteral<`https://${string}`>;
141
+ service: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
142
+ path: z.ZodTemplateLiteral<`/${string}`>;
143
+ methods: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
144
+ DELETE: "DELETE";
145
+ GET: "GET";
146
+ HEAD: "HEAD";
147
+ OPTIONS: "OPTIONS";
148
+ PATCH: "PATCH";
149
+ POST: "POST";
150
+ PUT: "PUT";
151
+ }>>>;
152
+ }, z.core.$strict>>>, z.ZodTransform<Readonly<Record<string, Readonly<{
153
+ hostname: string;
154
+ url: `https://${string}`;
155
+ service: string;
156
+ path: `/${string}`;
157
+ methods: readonly ("DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT")[];
158
+ }> | undefined>>, Record<string, Readonly<{
159
+ hostname: string;
160
+ url: `https://${string}`;
161
+ service: string;
162
+ path: `/${string}`;
163
+ methods: readonly ("DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT")[];
164
+ }>>>>>;
165
+ aliases: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodReadonly<z.ZodObject<{
166
+ hostname: z.ZodString;
167
+ url: z.ZodTemplateLiteral<`https://${string}`>;
168
+ service: z.ZodString;
169
+ }, z.core.$strict>>>, z.ZodTransform<Readonly<Record<string, Readonly<{
170
+ hostname: string;
171
+ url: `https://${string}`;
172
+ service: string;
173
+ }> | undefined>>, Record<string, Readonly<{
174
+ hostname: string;
175
+ url: `https://${string}`;
176
+ service: string;
177
+ }>>>>>;
178
+ dev: z.ZodBoolean;
179
+ }, z.core.$strict>>;
180
+ connection: z.ZodReadonly<z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject<{
181
+ schema: z.ZodLiteral<1>;
182
+ host: z.ZodLiteral<"127.0.0.1">;
183
+ port: z.ZodInt;
184
+ expires_at: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
185
+ transport_id: z.core.$ZodBranded<z.ZodTemplateLiteral<`ctg_${string}`>, "TransportID", "out">;
186
+ protocol: z.ZodLiteral<"tcp">;
187
+ }, z.core.$strict>, z.ZodObject<{
188
+ schema: z.ZodLiteral<1>;
189
+ host: z.ZodLiteral<"127.0.0.1">;
190
+ port: z.ZodInt;
191
+ expires_at: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
192
+ transport_id: z.core.$ZodBranded<z.ZodTemplateLiteral<`ctg_${string}`>, "TransportID", "out">;
193
+ protocol: z.ZodLiteral<"postgres">;
194
+ ssl: z.ZodReadonly<z.ZodObject<{
195
+ servername: z.ZodString;
196
+ rejectUnauthorized: z.ZodLiteral<true>;
197
+ ca: z.ZodExactOptional<z.ZodString>;
198
+ }, z.core.$strict>>;
199
+ }, z.core.$strict>, z.ZodObject<{
200
+ schema: z.ZodLiteral<1>;
201
+ host: z.ZodLiteral<"127.0.0.1">;
202
+ port: z.ZodInt;
203
+ expires_at: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
204
+ transport_id: z.core.$ZodBranded<z.ZodTemplateLiteral<`ctg_${string}`>, "TransportID", "out">;
205
+ protocol: z.ZodLiteral<"mysql">;
206
+ ssl: z.ZodReadonly<z.ZodObject<{
207
+ servername: z.ZodString;
208
+ rejectUnauthorized: z.ZodLiteral<true>;
209
+ ca: z.ZodExactOptional<z.ZodString>;
210
+ }, z.core.$strict>>;
211
+ }, z.core.$strict>, z.ZodObject<{
212
+ schema: z.ZodLiteral<1>;
213
+ host: z.ZodLiteral<"127.0.0.1">;
214
+ port: z.ZodInt;
215
+ expires_at: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
216
+ transport_id: z.core.$ZodBranded<z.ZodTemplateLiteral<`ctg_${string}`>, "TransportID", "out">;
217
+ ssl: z.ZodReadonly<z.ZodObject<{
218
+ servername: z.ZodString;
219
+ rejectUnauthorized: z.ZodLiteral<true>;
220
+ ca: z.ZodExactOptional<z.ZodString>;
221
+ }, z.core.$strict>>;
222
+ url: z.ZodTemplateLiteral<`https://${string}`>;
223
+ protocol: z.ZodLiteral<"http">;
224
+ }, z.core.$strict>, z.ZodObject<{
225
+ schema: z.ZodLiteral<1>;
226
+ host: z.ZodLiteral<"127.0.0.1">;
227
+ port: z.ZodInt;
228
+ expires_at: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
229
+ transport_id: z.core.$ZodBranded<z.ZodTemplateLiteral<`ctg_${string}`>, "TransportID", "out">;
230
+ ssl: z.ZodReadonly<z.ZodObject<{
231
+ servername: z.ZodString;
232
+ rejectUnauthorized: z.ZodLiteral<true>;
233
+ ca: z.ZodExactOptional<z.ZodString>;
234
+ }, z.core.$strict>>;
235
+ url: z.ZodTemplateLiteral<`https://${string}`>;
236
+ protocol: z.ZodLiteral<"kubernetes">;
237
+ kubeconfig: z.ZodString;
238
+ context: z.ZodTemplateLiteral<`tnl:${string}`>;
239
+ }, z.core.$strict>], "protocol">, z.ZodTransform<{
240
+ host: "127.0.0.1";
241
+ port: number;
242
+ protocol: "tcp";
243
+ expires: number;
244
+ transportID: `ctg_${string}` & z.$brand<"TransportID">;
245
+ } | {
246
+ host: "127.0.0.1";
247
+ port: number;
248
+ protocol: "postgres";
249
+ ssl: Readonly<{
250
+ servername: string;
251
+ rejectUnauthorized: true;
252
+ ca?: string;
253
+ }>;
254
+ expires: number;
255
+ transportID: `ctg_${string}` & z.$brand<"TransportID">;
256
+ } | {
257
+ host: "127.0.0.1";
258
+ port: number;
259
+ protocol: "mysql";
260
+ ssl: Readonly<{
261
+ servername: string;
262
+ rejectUnauthorized: true;
263
+ ca?: string;
264
+ }>;
265
+ expires: number;
266
+ transportID: `ctg_${string}` & z.$brand<"TransportID">;
267
+ } | {
268
+ host: "127.0.0.1";
269
+ port: number;
270
+ ssl: Readonly<{
271
+ servername: string;
272
+ rejectUnauthorized: true;
273
+ ca?: string;
274
+ }>;
275
+ url: `https://${string}`;
276
+ protocol: "http";
277
+ expires: number;
278
+ transportID: `ctg_${string}` & z.$brand<"TransportID">;
279
+ } | {
280
+ host: "127.0.0.1";
281
+ port: number;
282
+ ssl: Readonly<{
283
+ servername: string;
284
+ rejectUnauthorized: true;
285
+ ca?: string;
286
+ }>;
287
+ url: `https://${string}`;
288
+ protocol: "kubernetes";
289
+ kubeconfig: string;
290
+ context: `tnl:${string}`;
291
+ expires: number;
292
+ transportID: `ctg_${string}` & z.$brand<"TransportID">;
293
+ }, {
294
+ schema: 1;
295
+ host: "127.0.0.1";
296
+ port: number;
297
+ expires_at: number;
298
+ transport_id: `ctg_${string}` & z.$brand<"TransportID">;
299
+ protocol: "tcp";
300
+ } | {
301
+ schema: 1;
302
+ host: "127.0.0.1";
303
+ port: number;
304
+ expires_at: number;
305
+ transport_id: `ctg_${string}` & z.$brand<"TransportID">;
306
+ protocol: "postgres";
307
+ ssl: Readonly<{
308
+ servername: string;
309
+ rejectUnauthorized: true;
310
+ ca?: string;
311
+ }>;
312
+ } | {
313
+ schema: 1;
314
+ host: "127.0.0.1";
315
+ port: number;
316
+ expires_at: number;
317
+ transport_id: `ctg_${string}` & z.$brand<"TransportID">;
318
+ protocol: "mysql";
319
+ ssl: Readonly<{
320
+ servername: string;
321
+ rejectUnauthorized: true;
322
+ ca?: string;
323
+ }>;
324
+ } | {
325
+ schema: 1;
326
+ host: "127.0.0.1";
327
+ port: number;
328
+ expires_at: number;
329
+ transport_id: `ctg_${string}` & z.$brand<"TransportID">;
330
+ ssl: Readonly<{
331
+ servername: string;
332
+ rejectUnauthorized: true;
333
+ ca?: string;
334
+ }>;
335
+ url: `https://${string}`;
336
+ protocol: "http";
337
+ } | {
338
+ schema: 1;
339
+ host: "127.0.0.1";
340
+ port: number;
341
+ expires_at: number;
342
+ transport_id: `ctg_${string}` & z.$brand<"TransportID">;
343
+ ssl: Readonly<{
344
+ servername: string;
345
+ rejectUnauthorized: true;
346
+ ca?: string;
347
+ }>;
348
+ url: `https://${string}`;
349
+ protocol: "kubernetes";
350
+ kubeconfig: string;
351
+ context: `tnl:${string}`;
352
+ }>>>;
353
+ verification: z.ZodExactOptional<z.ZodReadonly<z.ZodPipe<z.ZodObject<{
354
+ digest: z.ZodString;
355
+ binding: z.ZodString;
356
+ expires_at: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
357
+ }, z.core.$strict>, z.ZodTransform<{
358
+ digest: string;
359
+ binding: string;
360
+ expires: number;
361
+ }, {
362
+ digest: string;
363
+ binding: string;
364
+ expires_at: number;
365
+ }>>>>;
366
+ }, z.core.$strict>;
367
+ export declare const sdkPreparationSchema: z.ZodUnion<readonly [z.ZodObject<{
368
+ schema: z.ZodLiteral<1>;
369
+ owner: z.ZodObject<{
370
+ expires_at: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
371
+ connection_handle: z.ZodString;
372
+ executable: z.ZodString;
373
+ }, z.core.$strict>;
374
+ prepared: z.ZodNonOptional<z.ZodUnknown>;
375
+ }, z.core.$strict>, z.ZodObject<{
376
+ schema: z.ZodLiteral<1>;
377
+ reason: z.ZodString;
378
+ sdk_retained_start_failure: z.ZodExactOptional<z.ZodBoolean>;
379
+ sdk_failure_handle: z.ZodExactOptional<z.ZodString>;
380
+ sdk_owner_handle: z.ZodExactOptional<z.ZodString>;
381
+ }, z.core.$strict>]>;
382
+ export declare const connectionHandleSchema: z.ZodObject<{
383
+ schema: z.ZodLiteral<1>;
384
+ url: z.ZodTemplateLiteral<`http://127.0.0.1:${string}`>;
385
+ key: z.ZodString;
386
+ directory: z.ZodString;
387
+ config_digest: z.ZodString;
388
+ expires_at: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
389
+ executable: z.ZodNonOptional<z.ZodUnknown>;
390
+ workload: z.ZodOptional<z.ZodUnknown>;
391
+ team_id: z.ZodOptional<z.ZodUnknown>;
392
+ }, z.core.$strict>;