Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4337,6 +4337,7 @@ export default function App() {
...nextDraft,
deployment: {
...(nextDraft.deployment ?? { feishuEnabled: false }),
network: capability.runtime.network,
envValues: {
...runtimeEnvValues,
...(nextDraft.deployment?.envValues ?? {}),
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/adk/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
TRANSFER_REQUEST_TIMEOUT_MS,
} from "./timeout";
import type { AgentProject } from "../create/project";
import type { AgentDraft } from "../create/types";
import type { AgentDraft, NetworkConfig } from "../create/types";
import type { IssueFeedbackReport } from "./issueFeedback";

/** An ADK event as serialised over `/run_sse` (camelCase, by_alias=True). */
Expand Down Expand Up @@ -2469,6 +2469,7 @@ export interface RuntimeUpdateCapability {
region: string;
currentVersion?: number | null;
envs: { key: string; value: string }[];
network: NetworkConfig;
};
agent?: {
appName: string;
Expand Down
2 changes: 2 additions & 0 deletions frontend/tests/agentWorkspace.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ test("runtime refresh preserves agent order and detail loading uses an overlay",
test("runtime updates use the Agent selected in management instead of the active chat connection", () => {
assert.match(clientSource, /export interface RuntimeUpdateCapability/);
assert.match(clientSource, /envs: \{ key: string; value: string \}\[\]/);
assert.match(clientSource, /network: NetworkConfig/);
assert.match(clientSource, /agent\?:\s*\{[\s\S]*?\}\s*\| null/);
assert.match(clientSource, /export async function getRuntimeUpdateCapability/);
assert.match(clientSource, /\/web\/runtime-update-capability\?\$\{params\.toString\(\)\}/);
Expand Down Expand Up @@ -453,6 +454,7 @@ test("runtime updates use the Agent selected in management instead of the active
handler,
/envValues:\s*\{[\s\S]*?\.\.\.runtimeEnvValues,[\s\S]*?\.\.\.\(nextDraft\.deployment\?\.envValues \?\? \{\}\)/,
);
assert.match(handler, /network:\s*capability\.runtime\.network/);
});

test("runtime update capability checks ignore aborted and stale selections", () => {
Expand Down
5 changes: 5 additions & 0 deletions frontend/tests/deploymentConfigUi.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,11 @@ test("requires explicit confirmation before starting deployment", () => {
/disabled=\{deploying \|\| isRuntimeUpdate \|\| !onNetworkChange\}/,
);
assert.match(projectPreviewSource, /现有 Runtime 的区域与网络模式保持不变。/);
assert.match(projectPreviewSource, /const networkMode = network\?\.mode \?\? "public"/);
assert.match(
projectPreviewSource,
/checked=\{networkMode === mode\}[\s\S]*?disabled=\{deploying \|\| isRuntimeUpdate \|\| !onNetworkChange\}/,
);
});

test("creates feedback evaluation sets by default and sends the deployment choice", () => {
Expand Down
17 changes: 17 additions & 0 deletions tests/cli/test_studio_rbac.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,17 @@ def test_runtime_update_capability_supports_owned_unmanaged_runtime(
_runtime("runtime-unmanaged", "developer", managed=False)
)
runtime.current_version_number = 7
runtime.network_configurations.append(
SimpleNamespace(
endpoint="https://runtime.internal.example.com",
network_type="private",
vpc_configuration=SimpleNamespace(
vpc_id="vpc-existing",
subnet_ids=["subnet-a", "subnet-b"],
enable_shared_internet_access=True,
),
)
)
requested_paths: list[str] = []

def get_runtime(_self: Any, request: Any) -> SimpleNamespace:
Expand Down Expand Up @@ -1003,6 +1014,12 @@ async def request(
"currentVersion": 7,
"managed": False,
"envs": [],
"network": {
"mode": "both",
"vpcId": "vpc-existing",
"subnetIds": "subnet-a,subnet-b",
"enableSharedInternetAccess": True,
},
},
"agent": {
"appName": "selected-agent",
Expand Down
45 changes: 45 additions & 0 deletions veadk/cli/cli_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -5268,6 +5268,50 @@ async def _runtime_json_request(
raise RuntimeError("Runtime returned an invalid JSON response")
return data

def _runtime_network_payload(runtime: Any) -> dict[str, Any]:
network_configurations = list(
getattr(runtime, "network_configurations", None) or []
)
network_types = {
str(getattr(item, "network_type", "") or "").strip().lower()
for item in network_configurations
}
private_network = next(
(
item
for item in network_configurations
if str(getattr(item, "network_type", "") or "").strip().lower()
== "private"
),
None,
)
mode = (
"both"
if "public" in network_types and private_network is not None
else "private"
if private_network is not None
else "public"
)
payload: dict[str, Any] = {"mode": mode}
vpc_configuration = getattr(private_network, "vpc_configuration", None)
if vpc_configuration is None:
return payload

vpc_id = str(getattr(vpc_configuration, "vpc_id", "") or "").strip()
if vpc_id:
payload["vpcId"] = vpc_id
subnet_ids = getattr(vpc_configuration, "subnet_ids", None) or []
if subnet_ids:
payload["subnetIds"] = ",".join(str(item) for item in subnet_ids)
shared_internet = getattr(
vpc_configuration,
"enable_shared_internet_access",
None,
)
if shared_internet is not None:
payload["enableSharedInternetAccess"] = bool(shared_internet)
return payload

def _runtime_update_payload(runtime: Any, region: str) -> dict[str, Any]:
tags = _runtime_tags(runtime)
return {
Expand All @@ -5285,6 +5329,7 @@ def _runtime_update_payload(runtime: Any, region: str) -> dict[str, Any]:
for item in (getattr(runtime, "envs", None) or [])
if getattr(item, "key", None)
],
"network": _runtime_network_payload(runtime),
}

def _runtime_update_result(
Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading