From bc82a55323dfd225db84d63a53ddddd36a737ba7 Mon Sep 17 00:00:00 2001 From: pikastech Date: Sat, 18 Jul 2026 04:42:06 +0200 Subject: [PATCH] fix: connect L1 Workbench directly to AgentRun --- config/hwlab-node-lanes.yaml | 21 +++++-- scripts/src/hwlab-native-development.test.ts | 15 +++-- scripts/src/hwlab-native-development.ts | 45 +++++++++++--- scripts/src/hwlab-node-lanes.ts | 65 +++++++++++++++----- 4 files changed, 113 insertions(+), 33 deletions(-) diff --git a/config/hwlab-node-lanes.yaml b/config/hwlab-node-lanes.yaml index 1f7f6285..4884c545 100644 --- a/config/hwlab-node-lanes.yaml +++ b/config/hwlab-node-lanes.yaml @@ -115,11 +115,22 @@ lanes: workbench: publicHostRef: config/unidesk-host-k8s.yaml#runtime.publicHost stateDir: .state/workbench-native/services - mode: temporal - cloudApiUrlRef: config/hwlab-node-lanes.yaml#lanes.v03.public.apiUrl - cloudApiAuthorization: - sourceRef: hwlab/nc01-v03-admin.env - sourceKey: HWLAB_API_KEY + mode: agentrun-native + temporal: + address: 10.43.145.243:7233 + namespace: unidesk + taskQueue: hwlab-v03-workbench + activity: + startToCloseTimeoutMs: 900000 + retryInitialIntervalMs: 1000 + retryMaximumIntervalMs: 10000 + retryMaximumAttempts: 1 + agentRun: + managerUrl: http://10.43.171.18:8080 + runtimeApiUrl: http://hwlab-cloud-api.hwlab-v03.svc.cluster.local:6667 + runtimeWebUrl: http://hwlab-cloud-web.hwlab-v03.svc.cluster.local:8080 + terminalTimeoutMs: 600000 + pollIntervalMs: 1000 api: bindHost: 0.0.0.0 probeHost: 127.0.0.1 diff --git a/scripts/src/hwlab-native-development.test.ts b/scripts/src/hwlab-native-development.test.ts index 9a6b5890..2f1cfe69 100644 --- a/scripts/src/hwlab-native-development.test.ts +++ b/scripts/src/hwlab-native-development.test.ts @@ -4,13 +4,18 @@ import { hwlabNativeDevelopmentEnvironment, hwlabNativeDevelopmentHelp } from ". import { hwlabRuntimeLaneSpecForNode } from "./hwlab-node-lanes"; test("L1 Workbench exposure uses YAML public IP and separate bind/probe addresses", () => { - const native = hwlabRuntimeLaneSpecForNode("v03", "NC01").nativeDevelopment?.workbench; + const spec = hwlabRuntimeLaneSpecForNode("v03", "NC01"); + const native = spec.nativeDevelopment?.workbench; expect(native).toBeDefined(); - const env = hwlabNativeDevelopmentEnvironment(native!); + const env = hwlabNativeDevelopmentEnvironment(native!, spec, "0123456789abcdef0123456789abcdef01234567"); expect(env.WORKBENCH_NATIVE_SERVICE_STATE_DIR).toBe(native!.stateDir); - expect(env.WORKBENCH_MODE).toBe("temporal"); - expect(env.WORKBENCH_CLOUD_API_URL).toBe(native!.cloudApiUrl); - expect(env.WORKBENCH_CLOUD_API_AUTHORIZATION).toMatch(/^Bearer hwl_live_/u); + expect(env.WORKBENCH_MODE).toBe("agentrun-native"); + expect(env.WORKBENCH_CLOUD_API_URL).toBeUndefined(); + expect(env.WORKBENCH_CLOUD_API_AUTHORIZATION).toBeUndefined(); + expect(env.AGENTRUN_MGR_URL).toBe(native!.agentRun.managerUrl); + expect(env.AGENTRUN_API_KEY).toMatch(/^hwl_live_/u); + expect(env.HWLAB_CODE_AGENT_DEFAULT_PROVIDER_PROFILE).toBe("gpt.pika"); + expect(env.HWLAB_CODE_AGENT_AGENTRUN_SOURCE_COMMIT).toBe("0123456789abcdef0123456789abcdef01234567"); expect(env.WORKBENCH_API_BIND_HOST).toBe(native!.api.bindHost); expect(env.WORKBENCH_API_PROBE_HOST).toBe(native!.api.probeHost); expect(env.WORKBENCH_API_PUBLIC_HOST).toBe(native!.publicHost); diff --git a/scripts/src/hwlab-native-development.ts b/scripts/src/hwlab-native-development.ts index 08a40126..730f723f 100644 --- a/scripts/src/hwlab-native-development.ts +++ b/scripts/src/hwlab-native-development.ts @@ -1,6 +1,6 @@ import { runCommand } from "./command"; import { readEnvSourceFile, requiredEnvValue } from "./secrets"; -import { hwlabRuntimeLaneConfigPath, hwlabRuntimeLaneSpecForNode, isHwlabRuntimeLane, type HwlabRuntimeNativeDevelopmentSpec } from "./hwlab-node-lanes"; +import { hwlabRuntimeLaneConfigPath, hwlabRuntimeLaneSpecForNode, isHwlabRuntimeLane, type HwlabRuntimeLaneSpec, type HwlabRuntimeNativeDevelopmentSpec } from "./hwlab-node-lanes"; type Service = "api" | "worker" | "web"; type Action = "start" | "stop" | "restart" | "status" | "logs"; @@ -29,7 +29,11 @@ export function runHwlabNativeDevelopmentCommand(args: string[]): Record, key: string, path: string): string { + const value = stringField(raw, key, path); + try { + const parsed = new URL(value); + if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new Error("unsupported protocol"); + } catch { + throw new Error(`${path}.${key} must be an http(s) URL`); + } + return value; +} + function sourceWorkspaceHostDependenciesConfig(value: unknown, path: string): HwlabRuntimeSourceWorkspaceHostDependenciesSpec | undefined { if (value === undefined) return undefined; const raw = asRecord(value, path);