diff --git a/frontend/src/components/SandboxConfigEditorDrawer.vue b/frontend/src/components/SandboxConfigEditorDrawer.vue index bd0f927e..b7846ea8 100644 --- a/frontend/src/components/SandboxConfigEditorDrawer.vue +++ b/frontend/src/components/SandboxConfigEditorDrawer.vue @@ -86,7 +86,7 @@ @@ -117,29 +117,31 @@

{{ $t('settings.sandbox.sectionConnection') }}

+ @@ -163,7 +165,7 @@ + :disabled="retargetFrozen" @input="onConnectionInput('api_key')" />

{{ storedSecrets.e2b @@ -179,16 +181,16 @@

+ :disabled="retargetFrozen" @input="invalidateConnection" /> + :disabled="retargetFrozen" @input="invalidateConnection" />
+ :disabled="retargetFrozen" @input="invalidateConnection" />
@@ -198,7 +200,7 @@
@@ -220,19 +222,21 @@ -

- {{ $t('settings.sandbox.templateLockedBySkills') }} + :disabled="retargetFrozen" @input="onFieldInput('image')" /> +

+ {{ hasSkillSnapshot + ? $t('settings.sandbox.templateLockedBySkills') + : $t('settings.sandbox.templateLockedByInFlight') }}

+ :disabled="retargetFrozen" @input="onFieldInput('host')" /> + :disabled="retargetFrozen" @input="onFieldInput('tls_cert_path')" /> @@ -248,6 +252,8 @@ +
{{ $t('settings.sandbox.loadingTemplates') }} @@ -276,12 +282,12 @@ :class="{ 'is-active': currentTemplateId === item.id, 'is-pending': isTemplatePending(item), - 'is-disabled': !isTemplateSelectable(item) || (hasSkillSnapshot && currentTemplateId !== item.id), + 'is-disabled': !isTemplateSelectable(item) || (retargetFrozen && currentTemplateId !== item.id), }" role="radio" :aria-checked="currentTemplateId === item.id" - :aria-disabled="!isTemplateSelectable(item) || (hasSkillSnapshot && currentTemplateId !== item.id)" - :tabindex="isTemplateSelectable(item) && !(hasSkillSnapshot && currentTemplateId !== item.id) ? 0 : -1" + :aria-disabled="!isTemplateSelectable(item) || (retargetFrozen && currentTemplateId !== item.id)" + :tabindex="isTemplateSelectable(item) && !(retargetFrozen && currentTemplateId !== item.id) ? 0 : -1" @click="onTemplateCardClick(item)" @keydown.enter.prevent="onTemplateCardClick(item)" @keydown.space.prevent="onTemplateCardClick(item)" @@ -441,6 +447,7 @@ :record="effectiveRecord" @updated="onSkillsConfigUpdated" @skills-changed="emit('skillsChanged')" + @in-flight-change="inFlightFromPanel = $event" />

{{ $t('settings.sandbox.stepSkillsLocked') }}

@@ -511,6 +518,7 @@ const props = defineProps<{ // Which page to land on when opening an existing config, e.g. 'skills' from // the card's 管理技能 entry. Ignored while creating, where order is enforced. initialStep?: SandboxStepKey + hasInFlightSkill?: boolean }>() const emit = defineEmits<{ @@ -573,7 +581,7 @@ const currentTemplateId = computed(() => ( const selectedTemplate = computed(() => templates.value.find((item) => item.id === currentTemplateId.value)) const clusterStandardTemplate = computed(() => templates.value.find((item) => item.standard && item.id)) const canCreateStandard = computed(() => ( - isRemoteBackend.value && templatesLoaded.value && !clusterStandardTemplate.value && !hasSkillSnapshot.value + isRemoteBackend.value && templatesLoaded.value && !clusterStandardTemplate.value && !retargetFrozen.value )) const wizardSteps = computed>(() => { const steps: Array<{ key: SandboxStepKey; title: string }> = [ @@ -627,6 +635,9 @@ const effectiveRecord = computed(() => savedRecord.value || props.record) const hasSkillSnapshot = computed(() => ( Boolean(effectiveRecord.value?.config?.skill_image?.snapshot_id?.trim()) )) +const inFlightFromPanel = ref(false) +const hasInFlightSkill = computed(() => Boolean(props.hasInFlightSkill) || inFlightFromPanel.value) +const retargetFrozen = computed(() => hasSkillSnapshot.value || hasInFlightSkill.value) function onSkillsConfigUpdated(record: SandboxConfigRecord) { savedRecord.value = record @@ -785,6 +796,7 @@ function reset() { templatesLoaded.value = false templatesError.value = '' savedRecord.value = null + inFlightFromPanel.value = false wizardStep.value = 0 // "管理技能" opens this drawer straight on the skills step. It is a jump like // any other, so it only holds for a config that already exists. @@ -807,6 +819,7 @@ watch(() => props.visible, (open) => { if (open) { reset() } else { + inFlightFromPanel.value = false stopTemplatePolling() } }) @@ -840,13 +853,13 @@ function clearTemplateSelection() { } function onTemplateCardClick(item: SandboxTemplate) { - if (hasSkillSnapshot.value && item.id !== currentTemplateId.value) return + if (retargetFrozen.value && item.id !== currentTemplateId.value) return if (!isTemplateSelectable(item)) return selectTemplate(item.id) } function canRebuildTemplate(item: SandboxTemplate): boolean { - return Boolean(item.standard && item.id) && !isTemplatePending(item) && !hasSkillSnapshot.value + return Boolean(item.standard && item.id) && !isTemplatePending(item) && !retargetFrozen.value } function templateDisplayName(item: SandboxTemplate): string { @@ -987,7 +1000,7 @@ async function loadTemplates(ensureStandard = false, silent = false, replaceStan } else if ( currentTemplateId.value && (!current || (!isTemplateSelectable(current) && !isTemplatePending(current))) - && !hasSkillSnapshot.value + && !retargetFrozen.value ) { if (standardID) { const next = templates.value.find((item) => item.id === standardID) @@ -1023,7 +1036,7 @@ function createStandardTemplate() { } function replaceStandardTemplate() { - if (hasSkillSnapshot.value) return + if (retargetFrozen.value) return return loadTemplates(false, false, true) } diff --git a/frontend/src/components/SandboxSkillsPanel.vue b/frontend/src/components/SandboxSkillsPanel.vue index bde9c006..8fa76ad4 100644 --- a/frontend/src/components/SandboxSkillsPanel.vue +++ b/frontend/src/components/SandboxSkillsPanel.vue @@ -364,6 +364,7 @@ const props = defineProps<{ const emit = defineEmits<{ updated: [record: SandboxConfigRecord] skillsChanged: [] + inFlightChange: [busy: boolean] }>() const { t, locale } = useI18n() @@ -460,6 +461,12 @@ function isBusy(skill: ConfigSkill): boolean { return skill.status === 'installing' || skill.status === 'removing' } +watch( + () => skills.value.some(isBusy), + (busy) => emit('inFlightChange', busy), + { immediate: true }, +) + // The locators are written only after the installer sandbox is up and the // agent has a message to stream into. The row itself is already "installing" // the moment the upload is accepted, and that is when the button has to diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index bf8cab58..4146872d 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -1106,6 +1106,7 @@ export default { noConfigs: 'No sandbox yet. Agents without a workspace configuration will not run skill scripts.', identityFieldHint: 'While this config owns sandboxes, these cannot be changed: backend type, API endpoint, API key, sandbox domain, proxy endpoint.', connectionLockedBySkills: 'This sandbox already has skills. Connection, credentials, and DNS would retarget the skill snapshot, and DNS only applies after a template rebuild. Create a new sandbox instead.', + connectionLockedByInFlight: 'A skill is still installing or being removed. Connection, credentials, and DNS cannot change until that finishes.', viewSandboxes: 'View sandbox usage', inventoryTitle: 'Sandbox usage', inventoryDrawerDesc: 'Sandboxes this config still holds, plus the sessions and agents affected.', @@ -1173,8 +1174,9 @@ export default { createStandardTemplate: 'Create', createStandardTemplateHint: 'Built with the current connection settings, including DNS. After changing those settings, rebuild from the card.', replaceStandardTemplate: 'Rebuild', - replaceStandardTemplateConfirm: 'This deletes the WeKnora standard template on the cluster and rebuilds it with the current settings, including DNS. Sandboxes already using that template may no longer start.', + replaceStandardTemplateConfirm: 'Rebuild the WeKnora standard template with the current settings, including DNS. The previous spawnable template is not deleted until the replacement is ready.', templateLockedBySkills: 'This sandbox already has skills. The skill environment is bound to the current snapshot, so the runtime template cannot be changed or rebuilt. Create a new sandbox and install skills from the new template.', + templateLockedByInFlight: 'A skill is still installing or being removed. The runtime template cannot be changed or rebuilt until that finishes.', templateUnnamed: 'Unnamed template', templateFieldImage: 'Image', templateFieldVersion: 'Version', diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts index c0c6f1c1..b8cf617a 100755 --- a/frontend/src/i18n/locales/ko-KR.ts +++ b/frontend/src/i18n/locales/ko-KR.ts @@ -4959,6 +4959,7 @@ export default { noConfigs: '아직 샌드박스가 없습니다. 워크스페이스 설정을 선택하지 않은 에이전트는 스킬 스크립트를 실행하지 않습니다.', identityFieldHint: 'While this config owns sandboxes, these cannot be changed: backend type, API endpoint, API key, sandbox domain, proxy endpoint.', connectionLockedBySkills: '이 샌드박스에는 이미 Skill이 있습니다. 연결, 자격 증명, DNS를 바꾸면 스킬 스냅샷의 환경이 달라지고, DNS는 템플릿을 재구축해야 적용됩니다. 새 샌드박스를 만드세요.', + connectionLockedByInFlight: 'Skill을 설치하거나 제거하는 중입니다. 끝날 때까지 연결, 자격 증명, DNS를 바꿀 수 없습니다.', viewSandboxes: 'View sandbox usage', inventoryTitle: 'Sandbox usage', inventoryDrawerDesc: '이 설정이 아직 점유한 샌드박스와 영향을 받는 세션·에이전트입니다.', @@ -5026,8 +5027,9 @@ export default { createStandardTemplate: '만들기', createStandardTemplateHint: '현재 연결 설정(DNS 포함)으로 구축합니다. 설정을 바꾼 뒤에는 카드에서 재구축하세요.', replaceStandardTemplate: '재구축', - replaceStandardTemplateConfirm: '클러스터의 WeKnora 표준 템플릿을 삭제한 뒤 현재 설정(DNS 포함)으로 다시 만듭니다. 해당 템플릿을 쓰는 기존 샌드박스는 더 이상 시작되지 않을 수 있습니다.', + replaceStandardTemplateConfirm: '현재 설정(DNS 포함)으로 WeKnora 표준 템플릿을 다시 만듭니다. 새 템플릿이 준비되기 전에는 기존에 쓸 수 있는 템플릿을 삭제하지 않습니다.', templateLockedBySkills: '이 샌드박스에는 이미 Skill이 설치되어 있습니다. 스킬 환경이 현재 스냅샷에 묶여 있어 런타임 템플릿을 바꾸거나 재구축할 수 없습니다. 새 샌드박스를 만들고 새 템플릿에서 Skill을 다시 설치하세요.', + templateLockedByInFlight: 'Skill을 설치하거나 제거하는 중입니다. 끝날 때까지 런타임 템플릿을 바꾸거나 재구축할 수 없습니다.', templateUnnamed: '이름 없는 템플릿', templateFieldImage: '이미지', templateFieldVersion: '버전', diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts index bb72bb84..ca0b762a 100755 --- a/frontend/src/i18n/locales/ru-RU.ts +++ b/frontend/src/i18n/locales/ru-RU.ts @@ -4959,6 +4959,7 @@ export default { noConfigs: 'Песочниц пока нет. Агенты без конфигурации пространства не выполняют скрипты навыков.', identityFieldHint: 'While this config owns sandboxes, these cannot be changed: backend type, API endpoint, API key, sandbox domain, proxy endpoint.', connectionLockedBySkills: 'В этой песочнице уже установлены навыки. Смена подключения, учётных данных или DNS меняет среду снимка, а DNS применяется только после пересборки шаблона. Создайте новую песочницу.', + connectionLockedByInFlight: 'Навык ещё устанавливается или удаляется. Подключение, учётные данные и DNS нельзя менять, пока это не закончится.', viewSandboxes: 'View sandbox usage', inventoryTitle: 'Sandbox usage', inventoryDrawerDesc: 'Песочницы, которые всё ещё занимает эта конфигурация, а также затронутые сессии и агенты.', @@ -5026,8 +5027,9 @@ export default { createStandardTemplate: 'Создать', createStandardTemplateHint: 'Собирается с текущими настройками подключения, включая DNS. После их изменения пересоберите шаблон на карточке.', replaceStandardTemplate: 'Пересобрать', - replaceStandardTemplateConfirm: 'Стандартный шаблон WeKnora будет удалён из кластера и собран заново с текущими настройками, включая DNS. Песочницы, которые уже используют этот шаблон, могут больше не запускаться.', + replaceStandardTemplateConfirm: 'Стандартный шаблон WeKnora будет собран заново с текущими настройками, включая DNS. Предыдущий готовый шаблон не удаляется, пока замена не станет готовой к запуску.', templateLockedBySkills: 'В этой песочнице уже установлены навыки. Среда навыков привязана к текущему снимку, поэтому шаблон нельзя сменить или пересобрать. Создайте новую песочницу и установите навыки с нового шаблона.', + templateLockedByInFlight: 'Навык ещё устанавливается или удаляется. Шаблон нельзя сменить или пересобрать, пока это не закончится.', templateUnnamed: 'Шаблон без имени', templateFieldImage: 'Образ', templateFieldVersion: 'Версия', diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index 407179e6..1a16c369 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -4961,6 +4961,7 @@ export default { noConfigs: '还没有沙箱配置。智能体未选择空间配置时不会执行技能脚本。', identityFieldHint: '该配置下有沙箱运行时,以下项无法修改:后端类型、API 端点、API Key、沙箱域名、Proxy 端点。', connectionLockedBySkills: '该沙箱已安装 Skill。连接地址、凭据和 DNS 会改变技能快照所属环境,且 DNS 需重建模板才能生效;请新建一份沙箱。', + connectionLockedByInFlight: '该沙箱正在安装或移除 Skill,完成前不能更换连接、凭据或 DNS。', viewSandboxes: '查看沙箱占用', inventoryTitle: '沙箱占用', inventoryDrawerDesc: '该配置当前占用的沙箱,以及受影响的会话与智能体。', @@ -5028,8 +5029,9 @@ export default { createStandardTemplate: '创建', createStandardTemplateHint: '按当前连接配置构建,包含 DNS。之后改配置可在卡片上重建。', replaceStandardTemplate: '重建', - replaceStandardTemplateConfirm: '将删除集群上的 WeKnora 标准模板,并用当前配置(含 DNS)重新构建。使用该模板的存量沙箱可能无法再启动。', + replaceStandardTemplateConfirm: '将用当前配置(含 DNS)重建 WeKnora 标准模板。新模板就绪前不会删除仍可启动的旧模板。', templateLockedBySkills: '该沙箱已安装 Skill,技能环境绑在当前快照上,不能更换或重建运行模板。请新建一份沙箱,从新模板再装 Skill。', + templateLockedByInFlight: '该沙箱正在安装或移除 Skill,完成前不能更换或重建运行模板。', templateUnnamed: '未命名模板', templateFieldImage: '镜像', templateFieldVersion: '版本', diff --git a/frontend/src/views/settings/SandboxSettings.vue b/frontend/src/views/settings/SandboxSettings.vue index 31ffb161..df08020b 100644 --- a/frontend/src/views/settings/SandboxSettings.vue +++ b/frontend/src/views/settings/SandboxSettings.vue @@ -140,6 +140,7 @@