skydive-cli 0.5.0-beta.31 → 0.5.0-beta.32

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 (35) hide show
  1. package/dist/js/api-DQCaztBg.mjs +315 -0
  2. package/dist/js/{billing-blocked-Dgu5-oDy.mjs → billing-blocked-SE6tySLd.mjs} +1 -1
  3. package/dist/js/bin.mjs +34 -29
  4. package/dist/js/{boot-iaVSnd7h.mjs → boot-yyXrIeVy.mjs} +15 -11
  5. package/dist/js/chunk-BbwQpWto.mjs +33 -0
  6. package/dist/js/{client-DbqRBquD.mjs → client-d6K9qm6B.mjs} +70 -2
  7. package/dist/js/client-yz3zrpAS.mjs +5 -0
  8. package/dist/js/daemon-Btd2436i.mjs +7 -0
  9. package/dist/js/{daemon-BTyg329O.mjs → daemon-CxFxH36O.mjs} +4 -2
  10. package/dist/js/daemon-client-1Qfc_Y3J.mjs +8 -0
  11. package/dist/js/{daemon-client--A_yMKq6.mjs → daemon-client-Br1NlkRp.mjs} +1 -1
  12. package/dist/js/dist-CRtjM7ba.mjs +1750 -0
  13. package/dist/js/{forward-DL6DYqyc.mjs → forward-zwB55Bls.mjs} +25 -4
  14. package/dist/js/localhost-cert-Bn-UBUmj.mjs +67 -0
  15. package/dist/js/{print-DACzRUwQ.mjs → print-B9djx8GU.mjs} +3 -3
  16. package/dist/js/{print-C_TnQSPg.mjs → print-Clgq46GU.mjs} +3 -3
  17. package/dist/js/{print-share-BH9gvCls.mjs → print-share-BBy3OTno.mjs} +6 -2
  18. package/dist/js/{profiler-BVbYs_Yg.mjs → profiler-CJMnC90G.mjs} +2 -2
  19. package/dist/js/{raw-pty-DY4KelZW.mjs → raw-pty-B9Bue8gg.mjs} +1 -1
  20. package/dist/js/raw-pty-g3kATVQe.mjs +5 -0
  21. package/dist/js/{rest-CgfbKXst.mjs → rest-C6E4mS2A.mjs} +2 -2
  22. package/dist/js/rest-CaWUSrnH.mjs +6 -0
  23. package/dist/js/tls-cert-CLgSQALB.mjs +4 -0
  24. package/dist/js/tls-cert-CV-pwxVN.mjs +67 -0
  25. package/package.json +1 -1
  26. package/dist/js/api-DG5W6iwx.mjs +0 -131
  27. package/dist/js/client-hH2PJL8y.mjs +0 -5
  28. package/dist/js/daemon-SPQgtsbW.mjs +0 -6
  29. package/dist/js/daemon-client-C7emKKlj.mjs +0 -7
  30. package/dist/js/raw-pty-DmdUf4_w.mjs +0 -5
  31. package/dist/js/rest-VV5nc-Mn.mjs +0 -6
  32. /package/dist/js/{billing-blocked-2wju4gC_.mjs → billing-blocked-D3l5kJlX.mjs} +0 -0
  33. /package/dist/js/{client-c4c5MmgN.mjs → client-BTQ1fwzM.mjs} +0 -0
  34. /package/dist/js/{http-error-DzyrsLAZ.mjs → http-error-UHH3mVBF.mjs} +0 -0
  35. /package/dist/js/{output-DYzzdXYV.mjs → output-wY0VQDea.mjs} +0 -0
@@ -0,0 +1,315 @@
1
+ #!/usr/bin/env node
2
+ import { t as HttpError } from "./http-error-UHH3mVBF.mjs";
3
+ import { z } from "zod";
4
+ import http from "node:http";
5
+ import http2 from "node:http2";
6
+
7
+ //#region ../portal-daemon/src/tls-forward.ts
8
+ const TLS_PORT_OFFSET = 1e4;
9
+ const STRIP_HEADERS = new Set([
10
+ "connection",
11
+ "keep-alive",
12
+ "proxy-authenticate",
13
+ "proxy-authorization",
14
+ "proxy-connection",
15
+ "te",
16
+ "trailer",
17
+ "transfer-encoding",
18
+ "upgrade",
19
+ "http2-settings"
20
+ ]);
21
+ /**
22
+ * The opt-in TLS+h2 origin for a forwarded/exposed port (ANY-6872, additive
23
+ * next to the plain listener — never a replacement). Browsers only negotiate
24
+ * h2 over TLS, and h2's stream multiplexing is what lifts the
25
+ * 6-connections-per-origin cap that makes unbundled dev servers crawl through
26
+ * the tunnel; each h2 stream is converted here to an h1 request over a tunnel
27
+ * from `acquireTunnel`. Used by BOTH tunnel surfaces: the CLI's
28
+ * `skydive portal forward` and the desktop daemon's `platform portal expose`.
29
+ *
30
+ * The dev server keeps seeing `Host: localhost:<port>` — the browser's
31
+ * authority is a public name it would reject (Vite 403s unknown hosts), and
32
+ * "looks exactly like localhost" is the product contract. The original
33
+ * authority travels in x-forwarded-host / x-forwarded-proto for apps that
34
+ * want it.
35
+ */
36
+ async function startTlsForward({ cert, localPort, targetPort, acquireTunnel, log }) {
37
+ const connectionShims = {
38
+ setNoDelay: () => {},
39
+ setKeepAlive: () => {},
40
+ setTimeout: () => {},
41
+ ref: () => {},
42
+ unref: () => {}
43
+ };
44
+ /**
45
+ * node's http client drives the tunnel: the agent's keep-alive free list
46
+ * gives request→request socket reuse on top of the pool's pre-paid dials,
47
+ * and a tunnel the daemon/dev-server side reaps while idle is evicted from
48
+ * the free list by its 'close' — the next request just adopts a fresh one.
49
+ * maxSockets mirrors the pool cap: every socket here holds an edge WS open,
50
+ * and ANY-6873 is the honest fix for wanting more concurrency than that.
51
+ *
52
+ * The base signature allows synchronous implementations to return the
53
+ * socket; this one is asynchronous, so it always uses the callback and
54
+ * returns undefined (the documented async contract). The agent core always
55
+ * passes the callback — the error branch below guards the contract anyway
56
+ * rather than assuming it.
57
+ */
58
+ class TunnelAgent extends http.Agent {
59
+ createConnection(_options, callback) {
60
+ if (!callback) throw new Error("TunnelAgent.createConnection requires the async callback");
61
+ (async () => {
62
+ let tunnel;
63
+ try {
64
+ tunnel = await acquireTunnel();
65
+ } catch (error) {
66
+ callback(error instanceof Error ? error : new Error(String(error)));
67
+ return;
68
+ }
69
+ Object.assign(tunnel.stream, connectionShims);
70
+ tunnel.stream.resume();
71
+ callback(null, tunnel.stream);
72
+ })();
73
+ }
74
+ }
75
+ const agent = new TunnelAgent({
76
+ keepAlive: true,
77
+ maxSockets: 16
78
+ });
79
+ const server = http2.createSecureServer({
80
+ key: cert.key,
81
+ cert: cert.cert,
82
+ allowHTTP1: true
83
+ });
84
+ const liveSessions = /* @__PURE__ */ new Set();
85
+ server.on("session", (session) => {
86
+ liveSessions.add(session);
87
+ session.once("close", () => liveSessions.delete(session));
88
+ });
89
+ server.on("secureConnection", (socket) => {
90
+ liveSessions.add(socket);
91
+ socket.once("close", () => liveSessions.delete(socket));
92
+ });
93
+ server.on("request", (req, res) => {
94
+ const headers = {};
95
+ for (const [name, value] of Object.entries(req.headers)) {
96
+ if (name.startsWith(":") || STRIP_HEADERS.has(name)) continue;
97
+ if (value !== void 0) headers[name] = value;
98
+ }
99
+ headers.host = `localhost:${targetPort}`;
100
+ headers["x-forwarded-proto"] = "https";
101
+ headers["x-forwarded-host"] = cert.hostname;
102
+ const upstream = http.request({
103
+ host: "localhost",
104
+ port: targetPort,
105
+ method: req.method,
106
+ path: req.url,
107
+ headers,
108
+ agent
109
+ }, (upstreamRes) => {
110
+ const resHeaders = {};
111
+ for (const [name, value] of Object.entries(upstreamRes.headers)) {
112
+ if (STRIP_HEADERS.has(name)) continue;
113
+ if (value !== void 0) resHeaders[name] = value;
114
+ }
115
+ res.writeHead(upstreamRes.statusCode ?? 502, resHeaders);
116
+ upstreamRes.pipe(res);
117
+ upstreamRes.on("error", () => res.destroy());
118
+ });
119
+ upstream.on("error", (err) => {
120
+ log(`forward(tls): upstream request failed: ${err.message}`);
121
+ if (!res.headersSent) {
122
+ res.writeHead(502, { "content-type": "text/plain" });
123
+ res.end("portal forward: tunnel request failed");
124
+ } else res.destroy();
125
+ });
126
+ req.pipe(upstream);
127
+ req.on("error", () => upstream.destroy());
128
+ });
129
+ server.on("upgrade", (req, socket, head) => {
130
+ socket.pause();
131
+ (async () => {
132
+ let tunnel;
133
+ try {
134
+ tunnel = await acquireTunnel();
135
+ } catch (err) {
136
+ log(`forward(tls): upgrade tunnel failed: ${err instanceof Error ? err.message : String(err)}`);
137
+ socket.destroy();
138
+ return;
139
+ }
140
+ const lines = [`${req.method} ${req.url} HTTP/1.1`];
141
+ for (let i = 0; i < req.rawHeaders.length; i += 2) {
142
+ const name = req.rawHeaders[i];
143
+ const value = name?.toLowerCase() === "host" ? `localhost:${targetPort}` : req.rawHeaders[i + 1];
144
+ lines.push(`${name}: ${value}`);
145
+ }
146
+ tunnel.stream.write(lines.join("\r\n") + "\r\n\r\n");
147
+ if (head.length > 0) tunnel.stream.write(head);
148
+ tunnel.stream.on("error", () => socket.destroy());
149
+ tunnel.stream.on("close", () => socket.destroy());
150
+ socket.on("error", () => tunnel.stream.destroy());
151
+ socket.on("close", () => tunnel.stream.destroy());
152
+ socket.pipe(tunnel.stream).pipe(socket);
153
+ socket.resume();
154
+ })();
155
+ });
156
+ server.on("tlsClientError", (err, tlsSocket) => {
157
+ tlsSocket.destroy();
158
+ log(`forward(tls): handshake failed: ${err.message}`);
159
+ });
160
+ const preferredPort = localPort + TLS_PORT_OFFSET <= 65535 ? localPort + TLS_PORT_OFFSET : 0;
161
+ return {
162
+ port: await new Promise((resolve, reject) => {
163
+ const onError = (err) => {
164
+ if (err.code === "EADDRINUSE" && preferredPort !== 0) {
165
+ server.listen(0, "127.0.0.1");
166
+ return;
167
+ }
168
+ server.removeListener("error", onError);
169
+ reject(err);
170
+ };
171
+ server.on("error", onError);
172
+ server.on("listening", () => {
173
+ server.removeListener("error", onError);
174
+ const addr = server.address();
175
+ resolve(addr && typeof addr === "object" ? addr.port : preferredPort);
176
+ });
177
+ server.listen(preferredPort, "127.0.0.1");
178
+ }),
179
+ hostname: cert.hostname,
180
+ close: () => new Promise((resolve) => {
181
+ agent.destroy();
182
+ server.close(() => resolve());
183
+ for (const live of liveSessions) live.destroy();
184
+ })
185
+ };
186
+ }
187
+
188
+ //#endregion
189
+ //#region ../portal-daemon/src/api.ts
190
+ /**
191
+ * The portal's session-authed REST surface, shared by `PortalClient` (the
192
+ * TUI/`portal open` connection) and the `skydive portal` management
193
+ * commands, so the endpoint contracts and response schemas live in exactly
194
+ * one place.
195
+ */
196
+ const deviceSchema = z.object({
197
+ id: z.string(),
198
+ machineName: z.string(),
199
+ friendlyName: z.string(),
200
+ connected: z.boolean(),
201
+ lastSeen: z.string().nullable(),
202
+ grantedAgentIds: z.array(z.string())
203
+ });
204
+ const devicesResponseSchema = z.object({
205
+ devices: z.array(deviceSchema),
206
+ agents: z.array(z.object({
207
+ id: z.string(),
208
+ name: z.string()
209
+ }))
210
+ });
211
+ const deviceTokenSchema = z.object({ token: z.string().min(1) });
212
+ async function portalFetch(auth, path, init) {
213
+ const res = await fetch(`${auth.appUrl}${path}`, {
214
+ method: init.method,
215
+ headers: {
216
+ authorization: `Bearer ${auth.sessionToken}`,
217
+ accept: "application/json",
218
+ ...init.body ? { "content-type": "application/json" } : {}
219
+ },
220
+ ...init.body ? { body: init.body } : {}
221
+ });
222
+ if (!res.ok) {
223
+ const body = await res.text().catch(() => "");
224
+ throw new HttpError(res.status, body);
225
+ }
226
+ return res.json();
227
+ }
228
+ async function fetchPortalDevices(auth) {
229
+ const json = await portalFetch(auth, "/api/v1/portal/devices", { method: "GET" });
230
+ return devicesResponseSchema.parse(json);
231
+ }
232
+ const registerResponseSchema = z.object({ device: z.object({ id: z.string() }) });
233
+ /**
234
+ * Register this machine's device row without connecting. Connecting registers
235
+ * as a side effect; this covers granting an agent on a machine that has never
236
+ * shared yet (the grant references the device row).
237
+ */
238
+ async function registerPortalDevice(auth, { machineName, friendlyName }) {
239
+ const json = await portalFetch(auth, "/api/v1/portal/devices", {
240
+ method: "POST",
241
+ body: JSON.stringify({
242
+ machineName,
243
+ friendlyName
244
+ })
245
+ });
246
+ return registerResponseSchema.parse(json).device;
247
+ }
248
+ /** Short-lived token the machine presents when dialing the portal WebSocket. */
249
+ async function mintPortalDeviceToken(auth) {
250
+ const json = await portalFetch(auth, "/api/v1/portal/device-token", { method: "POST" });
251
+ return deviceTokenSchema.parse(json).token;
252
+ }
253
+ const forwardTargetSchema = z.object({
254
+ daemonOrigin: z.string().min(1),
255
+ token: z.string().min(1),
256
+ expiresInSeconds: z.number()
257
+ });
258
+ /**
259
+ * Everything `portal forward` needs to dial an agent's sandbox daemon through
260
+ * the agent-webserver edge Worker: the daemon's stable public origin and a
261
+ * daemon auth token (canUse-gated server-side).
262
+ */
263
+ async function fetchForwardTarget(auth, agentId) {
264
+ const json = await portalFetch(auth, "/api/v1/portal/forward-target", {
265
+ method: "POST",
266
+ body: JSON.stringify({ agentId })
267
+ });
268
+ return forwardTargetSchema.parse(json);
269
+ }
270
+ async function grantPortalAccess(auth, { deviceId, agentId, conversationId }) {
271
+ await portalFetch(auth, `/api/v1/portal/devices/${encodeURIComponent(deviceId)}/grants`, {
272
+ method: "POST",
273
+ body: JSON.stringify({
274
+ agentId,
275
+ conversationId
276
+ })
277
+ });
278
+ }
279
+ async function revokePortalAccess(auth, { deviceId, agentId }) {
280
+ await portalFetch(auth, `/api/v1/portal/devices/${encodeURIComponent(deviceId)}/grants/${encodeURIComponent(agentId)}`, { method: "DELETE" });
281
+ }
282
+ /**
283
+ * The device row for a given machine identity. Matching is by `machineName`
284
+ * equality — the stable handle the machine registers under, not the display
285
+ * label.
286
+ */
287
+ function findThisDevice(devices, machineName) {
288
+ return devices.find((device) => device.machineName === machineName) ?? null;
289
+ }
290
+ /**
291
+ * One-time grant migration onto the merged device. Earlier CLI builds
292
+ * registered a separate `<machineName>-cli` device, so a user's existing
293
+ * approvals hang off that row; the merged device would start with zero grants
294
+ * and every already-authorized agent would ask again. Copy any grant the
295
+ * merged device is missing (the grant endpoint upserts, so re-runs are
296
+ * no-ops). The legacy row is left in place — an old CLI build may still
297
+ * connect under it. Returns how many grants were copied.
298
+ */
299
+ async function unifyLegacyCliGrants(auth, machineName) {
300
+ const { devices } = await fetchPortalDevices(auth);
301
+ const merged = findThisDevice(devices, machineName);
302
+ const legacy = findThisDevice(devices, `${machineName}-cli`);
303
+ if (!merged || !legacy) return 0;
304
+ const have = new Set(merged.grantedAgentIds);
305
+ const missing = legacy.grantedAgentIds.filter((id) => !have.has(id));
306
+ for (const agentId of missing) await grantPortalAccess(auth, {
307
+ deviceId: merged.id,
308
+ agentId,
309
+ conversationId: null
310
+ });
311
+ return missing.length;
312
+ }
313
+
314
+ //#endregion
315
+ export { mintPortalDeviceToken as a, unifyLegacyCliGrants as c, grantPortalAccess as i, startTlsForward as l, fetchPortalDevices as n, registerPortalDevice as o, findThisDevice as r, revokePortalAccess as s, fetchForwardTarget as t };
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { a as billingBlockedOutcomeSchema, i as billingBlockedOutcomeFromSendResponse, n as BillingBlockedError, r as billingBlockedJsonResult, t as BILLING_BLOCKED_EXIT_CODE } from "./billing-blocked-2wju4gC_.mjs";
2
+ import { a as billingBlockedOutcomeSchema, i as billingBlockedOutcomeFromSendResponse, n as BillingBlockedError, r as billingBlockedJsonResult, t as BILLING_BLOCKED_EXIT_CODE } from "./billing-blocked-D3l5kJlX.mjs";
3
3
 
4
4
  export { BILLING_BLOCKED_EXIT_CODE, BillingBlockedError, billingBlockedJsonResult };
package/dist/js/bin.mjs CHANGED
@@ -1,14 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import { A as takenAliasNames, B as name, D as dedupeAliasName, E as aliasActivationHint, F as getActiveWorkspaceId, I as getSessionIdentity, L as listWorkspaces, M as defaultInstallEnv, N as detectShell, O as installAgentAlias, P as ensureActiveOrganization, R as resolveWorkspaceId, S as themes, T as machineOsFromPlatform, V as version, a as installCrashHandler, j as SUPPORTED_SHELLS, k as slugifyAliasName, t as maybeStartProfiling, u as brandHelpArt, w as buildImportSeedPrompt, z as setActiveWorkspace } from "./profiler-BVbYs_Yg.mjs";
3
- import { A as getShareMachineDefault, C as getConfigPath, D as getPromptHistoryPath, E as getPreference, F as resolveAppUrl, H as saveSession, I as resolveChatAuth, L as resolveConfig, M as getStoredApiKeyWorkspaceName, N as getUpdateCheckDisabled, R as resolveManagementAuth, S as deleteConfig, T as getLastSeenVersion, V as saveConfig, W as setLastSeenVersion, _ as API_KEY_FAMILY_PREFIX, g as API_KEYS_URL, i as resolveAgent$1, j as getStoredApiKeyId, v as API_KEY_PREFIX, w as getDefaultAgent, x as PREFERENCES, y as DEFAULT_API_URL, z as resolveSession } from "./print-C_TnQSPg.mjs";
4
- import { n as printError, r as printTable, t as output } from "./output-DYzzdXYV.mjs";
5
- import { t as HttpError } from "./http-error-DzyrsLAZ.mjs";
6
- import { t as createRestClient } from "./rest-CgfbKXst.mjs";
7
- import "./billing-blocked-2wju4gC_.mjs";
8
- import { r as resolveMachineIdentity } from "./client-DbqRBquD.mjs";
9
- import { i as queryDaemonStatus, l as PORTAL_DAEMON_FLAG, n as ensureDaemonRunning, s as stopDaemon, u as daemonPaths } from "./daemon-BTyg329O.mjs";
10
- import { i as grantPortalAccess, n as fetchPortalDevices, o as registerPortalDevice, r as findThisDevice, s as revokePortalAccess } from "./api-DG5W6iwx.mjs";
11
- import { t as SandboxStream } from "./client-c4c5MmgN.mjs";
2
+ import { A as takenAliasNames, B as name, D as dedupeAliasName, E as aliasActivationHint, F as getActiveWorkspaceId, I as getSessionIdentity, L as listWorkspaces, M as defaultInstallEnv, N as detectShell, O as installAgentAlias, P as ensureActiveOrganization, R as resolveWorkspaceId, S as themes, T as machineOsFromPlatform, V as version, a as installCrashHandler, j as SUPPORTED_SHELLS, k as slugifyAliasName, t as maybeStartProfiling, u as brandHelpArt, w as buildImportSeedPrompt, z as setActiveWorkspace } from "./profiler-CJMnC90G.mjs";
3
+ import { A as getShareMachineDefault, C as getConfigPath, D as getPromptHistoryPath, E as getPreference, F as resolveAppUrl, H as saveSession, I as resolveChatAuth, L as resolveConfig, M as getStoredApiKeyWorkspaceName, N as getUpdateCheckDisabled, R as resolveManagementAuth, S as deleteConfig, T as getLastSeenVersion, V as saveConfig, W as setLastSeenVersion, _ as API_KEY_FAMILY_PREFIX, g as API_KEYS_URL, i as resolveAgent$1, j as getStoredApiKeyId, v as API_KEY_PREFIX, w as getDefaultAgent, x as PREFERENCES, y as DEFAULT_API_URL, z as resolveSession } from "./print-Clgq46GU.mjs";
4
+ import { n as printError, r as printTable, t as output } from "./output-wY0VQDea.mjs";
5
+ import { t as HttpError } from "./http-error-UHH3mVBF.mjs";
6
+ import { t as createRestClient } from "./rest-C6E4mS2A.mjs";
7
+ import "./billing-blocked-D3l5kJlX.mjs";
8
+ import { r as resolveMachineIdentity } from "./client-d6K9qm6B.mjs";
9
+ import { i as queryDaemonStatus, l as PORTAL_DAEMON_FLAG, n as ensureDaemonRunning, s as stopDaemon, u as daemonPaths } from "./daemon-CxFxH36O.mjs";
10
+ import "./tls-cert-CV-pwxVN.mjs";
11
+ import { i as grantPortalAccess, n as fetchPortalDevices, o as registerPortalDevice, r as findThisDevice, s as revokePortalAccess } from "./api-DQCaztBg.mjs";
12
+ import { t as SandboxStream } from "./client-BTQ1fwzM.mjs";
12
13
  import { hideBin } from "yargs/helpers";
13
14
  import yargs from "yargs";
14
15
  import { hostname, tmpdir } from "node:os";
@@ -1584,7 +1585,7 @@ const importCommand = {
1584
1585
  process.exit(1);
1585
1586
  }
1586
1587
  }
1587
- const { runChat } = await import("./boot-iaVSnd7h.mjs");
1588
+ const { runChat } = await import("./boot-yyXrIeVy.mjs");
1588
1589
  await runChat({
1589
1590
  appUrl,
1590
1591
  sessionToken: session.value.sessionToken,
@@ -1614,7 +1615,7 @@ async function runImportPrintMode({ argv, appUrl }) {
1614
1615
  printError(`${session.error.message} For non-interactive use, run \`skydive auth login --web\` first, or set SKYDIVE_SESSION_TOKEN.`);
1615
1616
  process.exit(1);
1616
1617
  }
1617
- const { connectMachineShare } = await import("./print-share-BH9gvCls.mjs");
1618
+ const { connectMachineShare } = await import("./print-share-BBy3OTno.mjs");
1618
1619
  const machineShare = await connectMachineShare({
1619
1620
  appUrl,
1620
1621
  sessionToken: session.value.sessionToken,
@@ -1622,7 +1623,7 @@ async function runImportPrintMode({ argv, appUrl }) {
1622
1623
  });
1623
1624
  const extra = (argv.print ?? "").trim();
1624
1625
  const prompt = buildImportSeedPrompt(process.cwd(), machineOsFromPlatform(process.platform)) + (extra ? `\n\nAdditional instructions: ${extra}` : "");
1625
- const { runPrint } = await import("./print-DACzRUwQ.mjs");
1626
+ const { runPrint } = await import("./print-B9djx8GU.mjs");
1626
1627
  try {
1627
1628
  const result = await runPrint({
1628
1629
  appUrl,
@@ -2029,7 +2030,7 @@ const chatCommand = {
2029
2030
  sessionToken: auth.value.token,
2030
2031
  agentSelector: argv.agent ?? null
2031
2032
  });
2032
- const { runChat } = await import("./boot-iaVSnd7h.mjs");
2033
+ const { runChat } = await import("./boot-yyXrIeVy.mjs");
2033
2034
  await runChat({
2034
2035
  appUrl: auth.value.appUrl,
2035
2036
  sessionToken: auth.value.token,
@@ -2113,7 +2114,7 @@ async function runPrintMode({ argv, appUrl }) {
2113
2114
  printError(`${auth.error.message} For non-interactive use, run \`skydive auth login\` first, or set SKYDIVE_API_KEY / SKYDIVE_SESSION_TOKEN.`);
2114
2115
  process.exit(1);
2115
2116
  }
2116
- const { runPrint, readStdin } = await import("./print-DACzRUwQ.mjs");
2117
+ const { runPrint, readStdin } = await import("./print-B9djx8GU.mjs");
2117
2118
  const workspaceId = await resolveWorkspaceFlag({
2118
2119
  appUrl,
2119
2120
  sessionToken: auth.value.token,
@@ -2143,7 +2144,7 @@ async function runPrintMode({ argv, appUrl }) {
2143
2144
  process.exit(1);
2144
2145
  }
2145
2146
  } else {
2146
- const { connectMachineShare } = await import("./print-share-BH9gvCls.mjs");
2147
+ const { connectMachineShare } = await import("./print-share-BBy3OTno.mjs");
2147
2148
  machineShare = await connectMachineShare({
2148
2149
  appUrl: auth.value.appUrl,
2149
2150
  sessionToken: auth.value.token,
@@ -2164,7 +2165,7 @@ async function runPrintMode({ argv, appUrl }) {
2164
2165
  });
2165
2166
  if (argv.json) output(argv, result);
2166
2167
  } catch (error) {
2167
- const { BillingBlockedError, BILLING_BLOCKED_EXIT_CODE, billingBlockedJsonResult } = await import("./billing-blocked-Dgu5-oDy.mjs");
2168
+ const { BillingBlockedError, BILLING_BLOCKED_EXIT_CODE, billingBlockedJsonResult } = await import("./billing-blocked-SE6tySLd.mjs");
2168
2169
  if (error instanceof BillingBlockedError) {
2169
2170
  if (argv.json) output(argv, billingBlockedJsonResult(error, null));
2170
2171
  printError(error.message);
@@ -2208,7 +2209,7 @@ const getCommand$1 = {
2208
2209
  printError(`${auth.error.message} Run \`skydive auth login\` first, or set SKYDIVE_API_KEY / SKYDIVE_SESSION_TOKEN.`);
2209
2210
  process.exit(1);
2210
2211
  }
2211
- const { messageGet } = await import("./print-DACzRUwQ.mjs");
2212
+ const { messageGet } = await import("./print-B9djx8GU.mjs");
2212
2213
  try {
2213
2214
  const result = await messageGet({
2214
2215
  appUrl: auth.value.appUrl,
@@ -2218,7 +2219,7 @@ const getCommand$1 = {
2218
2219
  });
2219
2220
  if (argv.json) output(argv, result);
2220
2221
  } catch (error) {
2221
- const { BillingBlockedError, BILLING_BLOCKED_EXIT_CODE, billingBlockedJsonResult } = await import("./billing-blocked-Dgu5-oDy.mjs");
2222
+ const { BillingBlockedError, BILLING_BLOCKED_EXIT_CODE, billingBlockedJsonResult } = await import("./billing-blocked-SE6tySLd.mjs");
2222
2223
  if (error instanceof BillingBlockedError) {
2223
2224
  if (argv.json) output(argv, billingBlockedJsonResult(error, argv["message-id"]));
2224
2225
  printError(error.message);
@@ -2411,7 +2412,7 @@ const switchCommand = {
2411
2412
  printError("The workspace picker needs the Bun runtime and it could not be set up automatically. Pass a workspace slug instead, or install Bun and retry.");
2412
2413
  process.exit(1);
2413
2414
  }
2414
- const { runWorkspacePicker } = await import("./boot-iaVSnd7h.mjs");
2415
+ const { runWorkspacePicker } = await import("./boot-yyXrIeVy.mjs");
2415
2416
  await runWorkspacePicker(session);
2416
2417
  return;
2417
2418
  }
@@ -2490,7 +2491,7 @@ const openCommand = {
2490
2491
  const agent = argv.agent ? resolveAgent$1((await fetchPortalDevices(session)).agents, argv.agent) : null;
2491
2492
  const cwd = argv.cwd ? path.resolve(argv.cwd) : process.cwd();
2492
2493
  const { machineName } = await resolveMachineIdentity(null);
2493
- const { PortalDaemonClient } = await import("./daemon-client-C7emKKlj.mjs");
2494
+ const { PortalDaemonClient } = await import("./daemon-client-1Qfc_Y3J.mjs");
2494
2495
  let lastLine = "";
2495
2496
  let signalConnected;
2496
2497
  const connected = new Promise((resolve) => {
@@ -2736,15 +2737,19 @@ const forwardCommand = {
2736
2737
  const agent = resolveAgent$1((await fetchPortalDevices(session)).agents, argv.agent ?? null);
2737
2738
  const targetPort = argv.port;
2738
2739
  const localPort = argv["local-port"] ?? targetPort;
2739
- const { startForward } = await import("./forward-DL6DYqyc.mjs");
2740
+ const { startForward } = await import("./forward-zwB55Bls.mjs");
2741
+ const { defaultTlsCertSource } = await import("./tls-cert-CLgSQALB.mjs");
2742
+ const log = (msg) => console.error(msg);
2740
2743
  const listener = await startForward({
2741
2744
  auth: session,
2742
2745
  agentId: agent.id,
2743
2746
  localPort,
2744
2747
  targetPort,
2745
- log: (msg) => console.error(msg)
2748
+ tlsCertSource: defaultTlsCertSource(process.env, log),
2749
+ log
2746
2750
  });
2747
2751
  console.log(`Forwarding http://localhost:${listener.port} -> ${agent.name}'s sandbox port ${targetPort}. ctrl+c to stop.`);
2752
+ if (listener.tls) console.log(` https://${listener.tls.hostname}:${listener.tls.port} (TLS — browsers negotiate HTTP/2 here, which loads module-heavy dev servers much faster)`);
2748
2753
  await new Promise((resolve) => {
2749
2754
  process.once("SIGINT", () => resolve());
2750
2755
  process.once("SIGTERM", () => resolve());
@@ -2800,8 +2805,8 @@ const sandboxCommand = {
2800
2805
  }).example("skydive sandbox --agent grace", "Live terminal (Ctrl-] detaches)").example("skydive sandbox --agent grace -- tail -n 50 /tmp/harness.log", "One-shot command (use `--` so its flags reach the sandbox)").example("skydive sandbox --agent grace -- sh -c 'ls /tmp | wc -l'", "Shell features go through an explicit `sh -c`"),
2801
2806
  handler: async (argv) => {
2802
2807
  const session = requireSession(argv);
2803
- const { createRestClient } = await import("./rest-VV5nc-Mn.mjs");
2804
- const { resolveAgent } = await import("./print-DACzRUwQ.mjs");
2808
+ const { createRestClient } = await import("./rest-CaWUSrnH.mjs");
2809
+ const { resolveAgent } = await import("./print-B9djx8GU.mjs");
2805
2810
  const client = createRestClient({
2806
2811
  appUrl: session.appUrl,
2807
2812
  sessionToken: session.sessionToken
@@ -2870,7 +2875,7 @@ async function runPty({ session, agentId, agentName }) {
2870
2875
  return 1;
2871
2876
  }
2872
2877
  console.error(`Connecting to ${agentName}'s sandbox… (Ctrl-] detaches)`);
2873
- const { runRawPtyPassthrough } = await import("./raw-pty-DmdUf4_w.mjs");
2878
+ const { runRawPtyPassthrough } = await import("./raw-pty-g3kATVQe.mjs");
2874
2879
  const result = await runRawPtyPassthrough({
2875
2880
  stdin: process.stdin,
2876
2881
  stdout: process.stdout,
@@ -2958,8 +2963,8 @@ const fsEditCommand = {
2958
2963
  handler: async (argv) => {
2959
2964
  const session = requireSession(argv);
2960
2965
  const remotePath = argv.path;
2961
- const { createRestClient } = await import("./rest-VV5nc-Mn.mjs");
2962
- const { resolveAgent } = await import("./print-DACzRUwQ.mjs");
2966
+ const { createRestClient } = await import("./rest-CaWUSrnH.mjs");
2967
+ const { resolveAgent } = await import("./print-B9djx8GU.mjs");
2963
2968
  const client = createRestClient({
2964
2969
  appUrl: session.appUrl,
2965
2970
  sessionToken: session.sessionToken
@@ -4336,7 +4341,7 @@ if (process.argv.includes(UPDATE_WORKER_FLAG)) {
4336
4341
  process.exit(0);
4337
4342
  }
4338
4343
  if (process.argv.includes(PORTAL_DAEMON_FLAG)) {
4339
- const { runPortalDaemon } = await import("./daemon-SPQgtsbW.mjs");
4344
+ const { runPortalDaemon } = await import("./daemon-Btd2436i.mjs");
4340
4345
  runPortalDaemon(process.argv);
4341
4346
  } else runCli();
4342
4347
  function runCli() {
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env node
2
- import { A as takenAliasNames, C as themesForMode, D as dedupeAliasName, E as aliasActivationHint, F as getActiveWorkspaceId, L as listWorkspaces, N as detectShell, O as installAgentAlias, T as machineOsFromPlatform, _ as theme, a as installCrashHandler, b as themeModeFromColorFgBg, c as MARK_CELLS, d as splashFitsWidth, f as DEFAULT_THEME_ID, g as noColorRequested, h as monoTheme, i as writeArtifact, k as slugifyAliasName, l as WORDMARK, m as findTheme, n as profilingEnabled, o as buildCrashReport, p as applyTheme, r as record, s as writeCrashReport, v as themeForMode, x as themeVersion, y as themeMode, z as setActiveWorkspace } from "./profiler-BVbYs_Yg.mjs";
3
- import { B as resolveWebUrl, C as getConfigPath, O as getReviewStateDir, P as recordDefaultAgent, U as saveTheme, b as DEFAULT_APP_URL, c as cardActionErrorMessage, d as reconcileMaskedInput, f as resolveConnectUrl, h as specKeyFor, i as resolveAgent, k as getSavedTheme, l as parseExternalOauthConnectParams, m as parseConnectCard, p as computeSettledLabel, s as MASK_CHAR, u as parseOauthConnectParams, y as DEFAULT_API_URL } from "./print-C_TnQSPg.mjs";
4
- import { t as HttpError } from "./http-error-DzyrsLAZ.mjs";
5
- import { a as isRecord, i as errorMessage, n as errorDetail, r as sendErrorMessage, t as createRestClient } from "./rest-CgfbKXst.mjs";
6
- import { i as billingBlockedOutcomeFromSendResponse } from "./billing-blocked-2wju4gC_.mjs";
7
- import { t as PortalClient } from "./client-DbqRBquD.mjs";
8
- import "./daemon-BTyg329O.mjs";
9
- import "./api-DG5W6iwx.mjs";
10
- import { t as SandboxStream } from "./client-c4c5MmgN.mjs";
11
- import { t as PortalDaemonClient } from "./daemon-client--A_yMKq6.mjs";
12
- import { t as runRawPtyPassthrough } from "./raw-pty-DY4KelZW.mjs";
2
+ import { A as takenAliasNames, C as themesForMode, D as dedupeAliasName, E as aliasActivationHint, F as getActiveWorkspaceId, L as listWorkspaces, N as detectShell, O as installAgentAlias, T as machineOsFromPlatform, _ as theme, a as installCrashHandler, b as themeModeFromColorFgBg, c as MARK_CELLS, d as splashFitsWidth, f as DEFAULT_THEME_ID, g as noColorRequested, h as monoTheme, i as writeArtifact, k as slugifyAliasName, l as WORDMARK, m as findTheme, n as profilingEnabled, o as buildCrashReport, p as applyTheme, r as record, s as writeCrashReport, v as themeForMode, x as themeVersion, y as themeMode, z as setActiveWorkspace } from "./profiler-CJMnC90G.mjs";
3
+ import { B as resolveWebUrl, C as getConfigPath, O as getReviewStateDir, P as recordDefaultAgent, U as saveTheme, b as DEFAULT_APP_URL, c as cardActionErrorMessage, d as reconcileMaskedInput, f as resolveConnectUrl, h as specKeyFor, i as resolveAgent, k as getSavedTheme, l as parseExternalOauthConnectParams, m as parseConnectCard, p as computeSettledLabel, s as MASK_CHAR, u as parseOauthConnectParams, y as DEFAULT_API_URL } from "./print-Clgq46GU.mjs";
4
+ import { t as HttpError } from "./http-error-UHH3mVBF.mjs";
5
+ import { a as isRecord, i as errorMessage, n as errorDetail, r as sendErrorMessage, t as createRestClient } from "./rest-C6E4mS2A.mjs";
6
+ import { i as billingBlockedOutcomeFromSendResponse } from "./billing-blocked-D3l5kJlX.mjs";
7
+ import { t as PortalClient } from "./client-d6K9qm6B.mjs";
8
+ import "./daemon-CxFxH36O.mjs";
9
+ import { t as defaultTlsCertSource } from "./tls-cert-CV-pwxVN.mjs";
10
+ import "./api-DQCaztBg.mjs";
11
+ import { t as SandboxStream } from "./client-BTQ1fwzM.mjs";
12
+ import { t as PortalDaemonClient } from "./daemon-client-Br1NlkRp.mjs";
13
+ import { t as runRawPtyPassthrough } from "./raw-pty-B9Bue8gg.mjs";
13
14
  import * as os$1 from "node:os";
14
15
  import { homedir, platform, release, tmpdir } from "node:os";
15
16
  import path, { basename, extname, isAbsolute, join, win32 } from "node:path";
@@ -396,6 +397,9 @@ function createPortalClient(opts) {
396
397
  deviceToken: null
397
398
  }),
398
399
  resolveCwd: () => process.cwd(),
400
+ tlsCertSource: defaultTlsCertSource(process.env, (msg) => {
401
+ console.error(msg);
402
+ }),
399
403
  persistedMachineName: null,
400
404
  onMachineName: () => {},
401
405
  onState: (state) => opts.onState({
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from "node:module";
3
+
4
+ //#region \0rolldown/runtime.js
5
+ var __create = Object.create;
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) {
17
+ __defProp(to, key, {
18
+ get: ((k) => from[k]).bind(null, key),
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ }
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
27
+ value: mod,
28
+ enumerable: true
29
+ }) : target, mod));
30
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
31
+
32
+ //#endregion
33
+ export { __require as n, __toESM as r, __commonJSMin as t };