@runuai/host 0.9.122 → 0.9.124

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.
@@ -24,6 +24,7 @@ import {
24
24
  runtimeProviderStatePath,
25
25
  type RuntimeProviderStateStore,
26
26
  } from "./runtime-provider-state";
27
+ import { sidecarMode } from "./sidecar";
27
28
 
28
29
  export type RuntimePreference = "auto" | "docker" | "apple-container";
29
30
 
@@ -282,6 +283,8 @@ export function pinnedContainerRuntimeMachineIdentity(): {
282
283
  /** Failure message for TEARDOWN admission: only a truly absent/unpinned
283
284
  * runtime refuses teardown. `checking` with a pin admits it. */
284
285
  export function containerRuntimeTeardownProblem(): string | null {
286
+ // ADR-133 sidecar mode: teardown is the cloud terminating this machine.
287
+ if (sidecarMode()) return null;
285
288
  if (state.status === "no-runtime") return state.message;
286
289
  if (pinnedContainerRuntimeMachineIdentity() === null) {
287
290
  return (
@@ -1347,6 +1350,11 @@ export function resetContainerRuntimeSelectionForTests(): void {
1347
1350
 
1348
1351
  /** Human-facing task failure, or null while the host can attempt Docker work. */
1349
1352
  export function containerRuntimeProblem(): string | null {
1353
+ // ADR-133 sidecar mode: the task runs on this machine, not in a container;
1354
+ // there is no runtime to be ready. Live 2026-09-10: the first hostless
1355
+ // task-up reached its machine and was refused with the Docker-context
1356
+ // message below, because this gate never knew the machine had no Docker.
1357
+ if (sidecarMode()) return null;
1350
1358
  if (state.status === "no-runtime") return state.message;
1351
1359
  if (state.status !== "ready" || !operational) {
1352
1360
  return (
@@ -38,6 +38,11 @@ export const AWS_MACHINE_TAG = "com.uai.machine";
38
38
  * UAI_MACHINE_IMAGE resolves the newest published payload in its region. */
39
39
  export const PAYLOAD_AMI_OWNER = "277057415208";
40
40
  export const PAYLOAD_AMI_NAME_PREFIX = "uai-machine-payload";
41
+ /** Regions the payload AMI is published to (build-ami.sh bakes in the first
42
+ * and copies to the rest). A BYO-AWS runner elsewhere would find no image
43
+ * and fail every launch, so setup refuses other regions up front (owner,
44
+ * 2026-09-10: "only show the available ones for now"). */
45
+ export const PAYLOAD_AMI_REGIONS: readonly string[] = ["us-west-2", "us-east-1"];
41
46
  /** Name of the security group auto-created in the default VPC when the host
42
47
  * config names none. Inbound: all TCP from the HOST's egress /32 only —
43
48
  * code-server runs auth-none and preview ports are plain HTTP, so exposure
@@ -230,7 +230,15 @@ export function reconstructTaskEnvironment(
230
230
  export async function reconstructPersistedTaskEnvironment(
231
231
  task: HostTask,
232
232
  ): Promise<TaskEnvironmentHandle<TaskDownResult> | null> {
233
- const locator = persistedTaskEnvironmentLocator(task, requireMachineIdentity());
233
+ // ADR-133: a machine or sidecar row carries its own locator and never
234
+ // needs the container runtime's identity — on a task machine there is
235
+ // none, and demanding it here would strand every session after task-up.
236
+ const locator = persistedTaskEnvironmentLocator(
237
+ task,
238
+ isEnvironmentTransportProvider(task.environmentProvider)
239
+ ? null
240
+ : requireMachineIdentity(),
241
+ );
234
242
  if (locator === null) return null;
235
243
  const handle = await registry.reconstruct(locator);
236
244
  if (handle.descriptor.taskId !== task.taskId) {
@@ -255,7 +263,9 @@ export function persistedTaskEnvironmentLocator(
255
263
  | "codeServerPort"
256
264
  | "previewPorts"
257
265
  >,
258
- machine: HostMachineIdentity,
266
+ /** Null only for rows whose provider is reached over the environment
267
+ * transport (machine, self): their locator is self-contained. */
268
+ machine: HostMachineIdentity | null,
259
269
  ): TaskEnvironmentLocator | null {
260
270
  const provider = task.environmentProvider;
261
271
  const raw = task.environmentLocator;
@@ -273,6 +283,9 @@ export function persistedTaskEnvironmentLocator(
273
283
  if (task.composeProject === null || task.worktreePath === null) {
274
284
  throw new Error("legacy task runtime persistence is incomplete");
275
285
  }
286
+ if (machine === null) {
287
+ throw new Error("legacy task runtime cannot be adopted on a task machine");
288
+ }
276
289
  throw new Error(
277
290
  machine.backend === "docker"
278
291
  ? "legacy Docker resources have not passed safe adoption"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runuai/host",
3
- "version": "0.9.122",
3
+ "version": "0.9.124",
4
4
  "description": "Uai host — runs ephemeral AI tasks in containers on a machine you control.",
5
5
  "license": "MIT",
6
6
  "author": "Uai Tech <team@runuai.com>",
package/src/cli.ts CHANGED
@@ -109,6 +109,7 @@ import {
109
109
  TasksResponse,
110
110
  } from "./ui/types";
111
111
  import type { InstallContext, Installer } from "../scripts/install/types";
112
+ import { PAYLOAD_AMI_REGIONS } from "../lib/machine-provider-aws";
112
113
 
113
114
  // --- tiny ANSI (no chalk) ---------------------------------------------------
114
115
 
@@ -636,6 +637,14 @@ async function cmdAwsSetup(rest: string[]): Promise<void> {
636
637
  process.exitCode = 1;
637
638
  return;
638
639
  }
640
+ if (!PAYLOAD_AMI_REGIONS.includes(region)) {
641
+ console.error(
642
+ red(`task machines are not available in ${region} yet — Uai's machine image is published in ${PAYLOAD_AMI_REGIONS.join(", ")}`),
643
+ );
644
+ console.error(dim("pass --region with one of those; more regions are coming."));
645
+ process.exitCode = 1;
646
+ return;
647
+ }
639
648
 
640
649
  const identity = awsAdmin(["sts", "get-caller-identity"], region);
641
650
  if (identity.status !== 0) {
package/src/index.ts CHANGED
@@ -185,7 +185,7 @@ export type {
185
185
  PreviewPortRuntime,
186
186
  } from "../lib/preview-ports";
187
187
  import { isEnvironmentTransportProvider } from "../lib/task-environment/types";
188
- import { awaitSidecarReady } from "../lib/sidecar";
188
+ import { awaitSidecarReady, sidecarMode } from "../lib/sidecar";
189
189
 
190
190
  export const hostEvents: HostEventStream = {
191
191
  subscribe(handler) {
@@ -1638,6 +1638,10 @@ const RUNTIME_TASK_ADMISSION_WAIT_MS = 3_000;
1638
1638
  async function prepareContainerRuntimeForTask(): Promise<
1639
1639
  HostCommandResult<never> | null
1640
1640
  > {
1641
+ // ADR-133 sidecar mode: the task runs on this machine; there is no
1642
+ // container runtime to prepare (live 2026-09-10, hostless smoke 3: this
1643
+ // step answered with the no-runtime message before the gated check ran).
1644
+ if (sidecarMode()) return null;
1641
1645
  let prepared:
1642
1646
  | Awaited<ReturnType<typeof ensureContainerRuntimeForTask>>
1643
1647
  | null;