{
+ it("keeps an AWS workspace's saved files unless asked", () => {
+ const onConfirm = vi.fn();
+ render();
+ const box = screen.getByRole("checkbox", { name: /saved files \(EFS\)/ });
+ expect(box).not.toBeChecked();
+ fireEvent.click(screen.getByRole("button", { name: "Remove" }));
+ fireEvent.click(box);
+ fireEvent.click(screen.getByRole("button", { name: "Remove" }));
+ expect(onConfirm.mock.calls).toEqual([[{ discardData: false }], [{ discardData: true }]]);
+ });
+
+ it("offers no EFS choice for a local project", () => {
+ render();
+ expect(screen.queryByRole("checkbox")).toBeNull();
+ expect(screen.getByText(/mounted in, not copied/)).toBeInTheDocument();
+ });
+
+ it("says what is left in AWS when the connection is gone", () => {
+ const onConfirm = vi.fn();
+ render(
+ ,
+ );
+ expect(screen.getByText(/task definitions, its secret and its saved files/)).toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "Remove and leave them in AWS" }));
+ expect(onConfirm).toHaveBeenCalled();
+ });
+});
diff --git a/app/src/components/projects/ConfirmRemoveModal.tsx b/app/src/components/projects/ConfirmRemoveModal.tsx
index 1fc53b4..f081606 100644
--- a/app/src/components/projects/ConfirmRemoveModal.tsx
+++ b/app/src/components/projects/ConfirmRemoveModal.tsx
@@ -1,13 +1,20 @@
+import { useState } from "react";
import Modal from "../ui/Modal";
import Button from "../ui/Button";
interface Props {
projectName: string;
- onConfirm: () => void;
+ /** An AWS project: its task, task definitions and secret go instead of Docker state. */
+ aws?: boolean;
+ onConfirm: (opts: { discardData: boolean }) => void;
onCancel: () => void;
}
-export default function ConfirmRemoveModal({ projectName, onConfirm, onCancel }: Props) {
+const REMOVE_CLASS =
+ "bg-[var(--error-emphasis)] text-white border border-transparent hover:opacity-90";
+
+export default function ConfirmRemoveModal({ projectName, aws = false, onConfirm, onCancel }: Props) {
+ const [discardData, setDiscardData] = useState(false);
return (
Cancel
-
+ );
+}
+
+/** The second confirm when an AWS project's connection is gone. */
+export function ConfirmForgetAwsModal({
+ projectName,
+ reason,
+ onConfirm,
+ onCancel,
+}: {
+ projectName: string;
+ reason: string;
+ onConfirm: () => void;
+ onCancel: () => void;
+}) {
+ return (
+
+
+ Cancel
+
+
+ Remove and leave them in AWS
+
+ >
+ }
+ >
+
{reason}
- Your project folders on this machine are mounted in, not copied, and are left
- untouched.
+ Removing {projectName} now
+ leaves its AWS resources in the account: the task (which may still be running and
+ billed), its task definitions, its secret and its saved files. You would have to
+ remove them in AWS yourself.
+ Push to WIP branch saves a snapshot of each repository to a{" "}
+ triple-c/wip/… branch on its remote, without
+ touching your branches. If the push fails, the workspace keeps running.
+
+ >
+ ) : (
+ <>
+
+ Triple-C could not check{" "}
+ {projectName} for unsaved
+ work, so it can’t push it to a WIP branch first.
+
+ {work.error && (
+
+ {work.error}
+
+ )}
+
+ Uncommitted or unpushed work in the workspace may be lost if you stop it now.
+
+ >
+ )}
+
+ );
+}
diff --git a/app/src/components/projects/home/ConfigTab.tsx b/app/src/components/projects/home/ConfigTab.tsx
index 037f228..e478f58 100644
--- a/app/src/components/projects/home/ConfigTab.tsx
+++ b/app/src/components/projects/home/ConfigTab.tsx
@@ -6,6 +6,8 @@ import ModelSection from "./config/ModelSection";
import AccessSection from "./config/AccessSection";
import RuntimeSection from "./config/RuntimeSection";
import MarketplaceSection from "./config/MarketplaceSection";
+import HostSection from "./config/HostSection";
+import { isAwsProject } from "../../../lib/awsWorkspace";
interface Props {
project: Project;
@@ -40,6 +42,9 @@ export default function ConfigTab({ project, save, saveState }: Props) {
+ {isAwsProject(project) && (
+
+ )}
(null);
const [confirmReset, setConfirmReset] = useState(false);
const [showMigration, setShowMigration] = useState(false);
const { runningSince, progress } = useAppState(
@@ -99,6 +103,7 @@ export default function ProjectHome({ projectId, active }: Props) {
);
}
+ const aws = isAwsProject(project);
const isRunning = project.status === "running";
const isTransitioning =
project.status === "starting" || project.status === "stopping";
@@ -120,6 +125,41 @@ export default function ProjectHome({ projectId, active }: Props) {
migration.probeSettled &&
!!project.container_id;
+ /** Remove the project; an AWS project whose connection is gone asks again. */
+ const removeProject = async (opts: RemoveProjectOptions) => {
+ try {
+ const report = await remove(project.id, opts);
+ if (!projectRemovalIsClean(report)) {
+ const verb = leftoverVerb(report);
+ if (report.retry_scheduled) {
+ useAppState.getState().pushToast({
+ kind: "info",
+ message: `“${project.name}” was removed, but Triple-C could not confirm all its Docker resources were removed`,
+ detail: `Triple-C could not confirm ${describeLeftovers(report)} ${verb} removed. It will check again the next time it starts.`,
+ });
+ } else {
+ // The pending-cleanup record itself failed to save — no
+ // retry will happen, so this must not promise one.
+ useAppState.getState().pushToast({
+ kind: "error",
+ message: `“${project.name}” was removed, but Triple-C could not confirm its Docker resources were removed`,
+ detail: `Triple-C could not confirm ${describeLeftovers(report)} ${verb} removed, and could not record this for a retry. You may need to remove ${leftoverPronoun(report)} manually (\`docker rm\` / \`docker rmi\` / \`docker volume rm\`).`,
+ });
+ }
+ }
+ } catch (e) {
+ if (aws && !opts.forgetAwsResources && /connection no longer exists/i.test(String(e))) {
+ setForgetAws({ reason: String(e), discardData: !!opts.discardData });
+ return;
+ }
+ useAppState.getState().pushToast({
+ kind: "error",
+ message: `Could not remove “${project.name}”`,
+ detail: String(e),
+ });
+ }
+ };
+
return (
{/* Header */}
@@ -188,12 +228,13 @@ export default function ProjectHome({ projectId, active }: Props) {
{
label: "Update container base…",
onSelect: () => setShowMigration(true),
- disabled: !canMigrate,
+ // Docker-only: the backend refuses both for an AWS project.
+ disabled: aws || !canMigrate,
},
{
label: "Reset container…",
onSelect: () => setConfirmReset(true),
- disabled: !isStopped || actions.busy,
+ disabled: aws || !isStopped || actions.busy,
danger: true,
},
{
@@ -280,39 +321,33 @@ export default function ProjectHome({ projectId, active }: Props) {
}}
/>
)}
+ {actions.stopGuard && (
+
+ )}
+ {forgetAws && (
+ setForgetAws(null)}
+ onConfirm={() => {
+ const { discardData } = forgetAws;
+ setForgetAws(null);
+ void removeProject({ discardData, forgetAwsResources: true });
+ }}
+ />
+ )}
{confirmRemove && (
setConfirmRemove(false)}
- onConfirm={async () => {
+ onConfirm={({ discardData }) => {
setConfirmRemove(false);
- try {
- const report = await remove(project.id);
- if (!projectRemovalIsClean(report)) {
- const verb = leftoverVerb(report);
- if (report.retry_scheduled) {
- useAppState.getState().pushToast({
- kind: "info",
- message: `“${project.name}” was removed, but Triple-C could not confirm all its Docker resources were removed`,
- detail: `Triple-C could not confirm ${describeLeftovers(report)} ${verb} removed. It will check again the next time it starts.`,
- });
- } else {
- // The pending-cleanup record itself failed to save — no
- // retry will happen, so this must not promise one.
- useAppState.getState().pushToast({
- kind: "error",
- message: `“${project.name}” was removed, but Triple-C could not confirm its Docker resources were removed`,
- detail: `Triple-C could not confirm ${describeLeftovers(report)} ${verb} removed, and could not record this for a retry. You may need to remove ${leftoverPronoun(report)} manually (\`docker rm\` / \`docker rmi\` / \`docker volume rm\`).`,
- });
- }
- }
- } catch (e) {
- useAppState.getState().pushToast({
- kind: "error",
- message: `Could not remove “${project.name}”`,
- detail: String(e),
- });
- }
+ void removeProject({ discardData });
}}
/>
)}
diff --git a/app/src/components/projects/home/config/AccessSection.tsx b/app/src/components/projects/home/config/AccessSection.tsx
index 85c7f42..9676698 100644
--- a/app/src/components/projects/home/config/AccessSection.tsx
+++ b/app/src/components/projects/home/config/AccessSection.tsx
@@ -7,6 +7,7 @@ import Field, { ConfigGroup, inputClass } from "../../../ui/Field";
import CaCertPathInput from "../../../settings/CaCertPathInput";
import EnvVarsEditor from "../../EnvVarsEditor";
import PortMappingsEditor from "../../PortMappingsEditor";
+import { NOT_ON_AWS, isAwsProject } from "../../../../lib/awsWorkspace";
interface Props {
project: Project;
@@ -161,16 +162,22 @@ export default function AccessSection({
Port mappings
-
- Expose container ports on the host so you can reach dev servers running inside
- the sandbox.
-
+ Removes {project.name}’s
+ task definitions and secret from AWS (the secret after a 7-day recovery window) and
+ keeps the project, so it can run somewhere else. Its next start on AWS sets them up
+ again.
+
+
+ {error && (
+
+ {error}
+
+ )}
+
+ );
+}
diff --git a/app/src/components/projects/home/config/ModelSection.tsx b/app/src/components/projects/home/config/ModelSection.tsx
index e43e6a1..302afe5 100644
--- a/app/src/components/projects/home/config/ModelSection.tsx
+++ b/app/src/components/projects/home/config/ModelSection.tsx
@@ -16,6 +16,11 @@ import Field, {
selectClass,
} from "../../../ui/Field";
import Toggle from "../../../ui/Toggle";
+import { NOT_ON_AWS, isAwsProject } from "../../../../lib/awsWorkspace";
+
+/** P6: an AWS workspace can reach a local model only over the network. */
+const LOCAL_MODEL_ON_AWS =
+ "This project runs on AWS: the URL must be reachable from the AWS task, so host.docker.internal and this machine's LAN addresses will not work.";
/** Bedrock fields held in the OS keychain, never serialized back to us. */
const BEDROCK_SECRET_KEYS = [
@@ -181,6 +186,8 @@ export default function ModelSection({ project, save, disabled }: Props) {
// that predates it, should still pick the shared token up.
const useSharedToken = project.use_shared_auth_token !== false;
+ const aws = isAwsProject(project);
+
const handleBackendChange = (mode: Backend) => {
const patch: Partial = { backend: mode };
if (mode === "bedrock" && !project.bedrock_config)
@@ -212,10 +219,25 @@ export default function ModelSection({ project, save, disabled }: Props) {
-
+
)}
+ {aws && project.backend === "open_ai_compatible" && (
+
+ OpenAI Compatible (gateway): {NOT_ON_AWS}. Choose another backend.
+