@runuai/host 0.2.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/protocol.ts CHANGED
@@ -68,6 +68,10 @@ export interface HostCapabilities {
68
68
  kind: string;
69
69
  availableVersions: string[];
70
70
  }>;
71
+ // ADR-033: cloud user ids that currently have a GitHub token ON THIS HOST —
72
+ // the per-host gh-connected state shown on the host detail page. Re-advertised
73
+ // whenever a token is added/removed. Optional: older hosts omit it.
74
+ githubUsers?: string[];
71
75
  }
72
76
 
73
77
  export interface TaskUpResult {
@@ -111,6 +115,14 @@ export interface TaskCommandTask {
111
115
  globalContext?: string;
112
116
  reviewerOrder?: string[];
113
117
  agents: TaskAgent[];
118
+ /**
119
+ * Cloud-computed PUBLIC preview URLs to inject into the container env at
120
+ * task-up, keyed by the operator-chosen var name (e.g.
121
+ * `EXPO_PACKAGER_PROXY_URL`). Non-secret — written literally into the task's
122
+ * compose file. Only present on task-up commands, when a preview port set
123
+ * `urlEnv` and the cloud has a preview base domain configured.
124
+ */
125
+ previewEnv?: Record<string, string>;
114
126
  }
115
127
 
116
128
  /**
@@ -295,6 +307,11 @@ export type CloudToHost =
295
307
  target: TunnelTarget;
296
308
  taskId: string;
297
309
  name?: string;
310
+ // The in-container port to reach for a preview (ADR-036). The cloud
311
+ // resolves it from the task's declared + ad-hoc preview ports; the host
312
+ // proxies to <container-ip>:<containerPort> over the Docker network.
313
+ // Absent for the editor target (which uses the published codeServerPort).
314
+ containerPort?: number;
298
315
  reqLine: TunnelReqLine;
299
316
  upgrade: boolean;
300
317
  }
@@ -305,18 +322,25 @@ export type CloudToHost =
305
322
  // never responds, so the cloud never sends an ack. (HTTP tunnels only.)
306
323
  | { kind: "tunnel.requestEnd"; tunnelId: string }
307
324
  | { kind: "tunnel.close"; tunnelId: string; reason?: string }
308
- // GitHub App connect lifecycle (ADR-027). The cloud forwards the user's
309
- // refresh token to the host, which encrypts + persists it; the per-task
310
- // access-token exchange is a host→cloud HTTP POST, not a frame.
325
+ // GitHub App connect lifecycle (ADR-027 / ADR-033). The cloud forwards the
326
+ // user's token to the host, which encrypts + persists it. Exactly one token
327
+ // is present:
328
+ // - `accessToken` → non-expiring per-host token (ADR-033). Injected into
329
+ // containers directly; no exchange, no refresh.
330
+ // - `refreshToken` → legacy expiring token (ADR-027). The host exchanges it
331
+ // for short-lived access tokens (host→cloud HTTP POST).
311
332
  | {
312
333
  kind: "gh.connect.set";
313
334
  userId: string;
314
335
  installationId: number;
315
336
  githubLogin: string;
316
337
  targetType: "User" | "Organization";
317
- refreshToken: string;
338
+ accessToken?: string;
339
+ refreshToken?: string;
318
340
  refreshTokenExpiresAt?: number;
319
341
  }
342
+ // Delete the user's token on the host. ADR-033: the host first POSTs the
343
+ // token to the cloud's /api/github/revoke (kill it at GitHub) before deleting.
320
344
  | { kind: "gh.connect.clear"; userId: string }
321
345
  // Per-user SSH key lifecycle (ADR-029). Keys are generated + stored on the
322
346
  // host; only the public key crosses the bridge (ssh.key.ack). `get` fetches