@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/db/migrations/0007_host_github_token_kind.sql +7 -0
- package/db/migrations/meta/_journal.json +7 -0
- package/db/schema.ts +4 -0
- package/lib/agents/claude.ts +8 -0
- package/lib/agents/codex.ts +11 -0
- package/lib/agents/registry.ts +11 -1
- package/lib/command-db.ts +6 -2
- package/lib/git-diff.ts +67 -16
- package/lib/github-tokens.ts +149 -32
- package/lib/orchestrator.ts +59 -16
- package/lib/preview-sidecar.ts +157 -0
- package/lib/task-diff.ts +75 -20
- package/package.json +1 -1
- package/scripts/agent/task-up.sh +22 -26
- package/src/main.ts +148 -25
- package/src/protocol.ts +28 -4
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
|
|
309
|
-
//
|
|
310
|
-
//
|
|
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
|
-
|
|
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
|