ui(sandbox): rename settings to skill sandbox and fix skill install (#2792)
* ui(sandbox): rename settings to code sandbox and simplify cards "Sandbox backend" leaked implementation jargon into the settings nav. Call the page what users configure — an isolated runtime for skill scripts — and only surface incomplete-config warnings on the cards. * fix(sandbox): type the card overflow menu options vue-tsc rejected pushing a themed delete item onto an untyped options array; name the option shape so the menu still marks delete as danger. * fix(sandbox): keep the editor wizard moving into skills Saving on the runtime step used to close the drawer when editing, so step 4 was only reachable from the rail. Continue after save, move full verification off the runtime form, and stop treating "using the base template" as the empty value for every image field. * fix(sandbox): store skill bundles on the workspace default backend Skill install passed a stub tenant with no default storage, so saving the zip failed with empty provider and the 500 hid the real cause. * ui(sandbox): regroup skill install and rename to skill sandbox Show install vs installed groups, fold long descriptions in the list, and call the settings surface a skill sandbox. * ui(sandbox): show skill install transcript in a compact popup Keep the card from growing; the run opens beside the history button with a capped height and its own scroll. * ui(sandbox): show installed skills on config cards Cube/E2B tiles now list skill names so the list reads as skill sandboxes; a click opens the editor on the skills step. * ui(sandbox): show finished skill installs as static history A completed run already has durable messages; replaying the event log would animate the whole install again. Hide chat answer actions in this transcript. * style(frontend): enhance compact skill timeline display with improved font sizes Updated the CSS for the compact skill timeline to adjust font sizes for various elements, ensuring better readability in the popup interface. This includes specific adjustments for embedded agent streams and markdown content. * ui(sandbox): refactor header structure in SandboxConfigEditorDrawer and SettingDrawer Updated the header structure in both SandboxConfigEditorDrawer and SettingDrawer components to improve layout and organization. Added a new slot for extra header content in SettingDrawer and adjusted CSS for better alignment and spacing in both components. * ui(sandbox): enhance skill loading feedback and improve deep check logic Updated the SandboxConfigEditorDrawer to refine the logic for deep checks based on the current step. Enhanced the SkillInstallTimeline component to manage in-flight live loops and provide better feedback for skill loading failures. Adjusted the SandboxSettings view to display error messages for failed skill loads, ensuring users are informed of any issues during the skill installation process.main
parent
18d22b014b
commit
01ec6c0509
|
|
@ -4,7 +4,7 @@
|
|||
:visible="visible"
|
||||
:title="record ? $t('settings.sandbox.editTitle') : $t('settings.sandbox.createTitle')"
|
||||
:description="stepDescription"
|
||||
icon="server"
|
||||
icon="code"
|
||||
width="680px"
|
||||
:min-width="560"
|
||||
:max-width="920"
|
||||
|
|
@ -20,30 +20,41 @@
|
|||
<t-button v-if="wizardStep > 0" variant="outline" @click="previousStep">
|
||||
{{ $t('settings.sandbox.back') }}
|
||||
</t-button>
|
||||
<t-popconfirm
|
||||
v-if="canDeepCheck"
|
||||
:content="$t('settings.sandbox.deepCheckConfirm')"
|
||||
@confirm="runCheck(true)"
|
||||
>
|
||||
<t-button variant="outline" :loading="checking">
|
||||
{{ lastCheckWasDeep ? $t('settings.sandbox.recheck') : $t('settings.sandbox.deepCheck') }}
|
||||
</t-button>
|
||||
</t-popconfirm>
|
||||
</template>
|
||||
|
||||
<nav class="sandbox-steps" :aria-label="$t('settings.sandbox.setupProgress')">
|
||||
<component
|
||||
:is="canJumpTo(index) ? 'button' : 'div'"
|
||||
v-for="(item, index) in wizardSteps"
|
||||
:key="item.key"
|
||||
:type="canJumpTo(index) ? 'button' : undefined"
|
||||
:class="['sandbox-step', {
|
||||
'is-active': wizardStep === index,
|
||||
'is-done': wizardStep > index,
|
||||
'is-clickable': canJumpTo(index),
|
||||
}]"
|
||||
:aria-current="wizardStep === index ? 'step' : undefined"
|
||||
@click="goToStep(index)"
|
||||
>
|
||||
<span class="sandbox-step__marker">
|
||||
<t-icon v-if="wizardStep > index" name="check" />
|
||||
<template v-else>{{ index + 1 }}</template>
|
||||
</span>
|
||||
<span class="sandbox-step__title">{{ item.title }}</span>
|
||||
<span v-if="index < wizardSteps.length - 1" class="sandbox-step__line" aria-hidden="true" />
|
||||
</component>
|
||||
</nav>
|
||||
<template #header-extra>
|
||||
<nav class="sandbox-steps" :aria-label="$t('settings.sandbox.setupProgress')">
|
||||
<component
|
||||
:is="canJumpTo(index) ? 'button' : 'div'"
|
||||
v-for="(item, index) in wizardSteps"
|
||||
:key="item.key"
|
||||
:type="canJumpTo(index) ? 'button' : undefined"
|
||||
:class="['sandbox-step', {
|
||||
'is-active': wizardStep === index,
|
||||
'is-done': wizardStep > index,
|
||||
'is-clickable': canJumpTo(index),
|
||||
}]"
|
||||
:aria-current="wizardStep === index ? 'step' : undefined"
|
||||
@click="goToStep(index)"
|
||||
>
|
||||
<span class="sandbox-step__marker">
|
||||
<t-icon v-if="wizardStep > index" name="check" />
|
||||
<template v-else>{{ index + 1 }}</template>
|
||||
</span>
|
||||
<span class="sandbox-step__title">{{ item.title }}</span>
|
||||
<span v-if="index < wizardSteps.length - 1" class="sandbox-step__line" aria-hidden="true" />
|
||||
</component>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
<!--
|
||||
Identity-change refusals must sit at the top: the form is long and the
|
||||
|
|
@ -388,19 +399,16 @@
|
|||
<p v-else class="skills-locked">{{ $t('settings.sandbox.stepSkillsLocked') }}</p>
|
||||
</template>
|
||||
|
||||
<div v-if="checkResult && currentStepKey !== 'template' && currentStepKey !== 'skills'"
|
||||
ref="checkResultRef" class="check-result">
|
||||
<div :class="['check-result__summary', checkResult.ok ? 'is-success' : 'is-error']">
|
||||
<span class="check-result__summary-icon">
|
||||
<t-icon :name="checkResult.ok ? 'check-circle-filled' : 'close-circle-filled'" />
|
||||
</span>
|
||||
<div>
|
||||
<p class="check-result__title">
|
||||
{{ checkResult.ok ? $t('settings.sandbox.checkPassed') : $t('settings.sandbox.checkFailed') }}
|
||||
</p>
|
||||
<p class="check-result__subtitle">{{ checkScopeHint }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="checkResult && showCheckResult"
|
||||
ref="checkResultRef"
|
||||
class="check-result"
|
||||
>
|
||||
<p :class="['check-result__title', checkResult.ok ? 'is-success' : 'is-error']">
|
||||
<t-icon :name="checkResult.ok ? 'check-circle-filled' : 'close-circle-filled'" />
|
||||
{{ checkResult.ok ? $t('settings.sandbox.checkPassed') : $t('settings.sandbox.checkFailed') }}
|
||||
</p>
|
||||
<p class="check-result__subtitle">{{ checkScopeHint }}</p>
|
||||
<ul class="check-list">
|
||||
<li v-for="item in reportedChecks" :key="item.name" class="check-item">
|
||||
<t-icon :name="item.ok === true ? 'check-circle-filled'
|
||||
|
|
@ -411,42 +419,14 @@
|
|||
<span v-if="checkDetail(item)" class="check-message">{{ checkDetail(item) }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<!--
|
||||
Probes that need a live sandbox used to be listed as three grey "not
|
||||
checked" rows, which made a passing connection test read as half broken
|
||||
and never said how to run them. They are one sentence plus the action
|
||||
that performs them instead. The action stays put even once nothing is
|
||||
pending, because a failed run is precisely when it has to be repeatable.
|
||||
-->
|
||||
<div class="check-pending">
|
||||
<p v-if="pendingCheckNames.length" class="check-pending__text">
|
||||
{{ $t('settings.sandbox.checkPendingHint', { names: pendingCheckNames.join('、') }) }}
|
||||
</p>
|
||||
<t-popconfirm :content="$t('settings.sandbox.deepCheckConfirm')" @confirm="runCheck(true)">
|
||||
<t-button variant="outline" size="small" :loading="checking">
|
||||
{{ lastCheckWasDeep ? $t('settings.sandbox.recheck') : $t('settings.sandbox.deepCheck') }}
|
||||
</t-button>
|
||||
</t-popconfirm>
|
||||
</div>
|
||||
<p v-if="pendingCheckNames.length" class="check-result__hint">
|
||||
{{ $t('settings.sandbox.checkPendingHint', { names: pendingCheckNames.join('、') }) }}
|
||||
</p>
|
||||
<t-alert v-if="checkResult.capabilities && checkResult.capabilities.supports_volumes === false" theme="warning"
|
||||
class="compact-alert"
|
||||
:message="$t('settings.sandbox.noVolumeSupport')" />
|
||||
</div>
|
||||
|
||||
<!--
|
||||
Without a result on screen there is nothing for the pending row above to
|
||||
hang off, so the same offer stands alone. Editing a field discards the
|
||||
previous result, which is exactly when this reappears.
|
||||
-->
|
||||
<div v-else-if="currentStepKey === 'runtime'" class="check-pending check-pending--standalone">
|
||||
<p class="check-pending__text">{{ $t('settings.sandbox.deepCheckIntro') }}</p>
|
||||
<t-popconfirm :content="$t('settings.sandbox.deepCheckConfirm')" @confirm="runCheck(true)">
|
||||
<t-button variant="outline" size="small" :loading="checking">
|
||||
{{ $t('settings.sandbox.deepCheck') }}
|
||||
</t-button>
|
||||
</t-popconfirm>
|
||||
</div>
|
||||
|
||||
</SettingDrawer>
|
||||
</template>
|
||||
|
||||
|
|
@ -568,8 +548,21 @@ const primaryText = computed(() => {
|
|||
// Nothing on the skills step is pending a save — each install, toggle and
|
||||
// removal already went to the server on its own.
|
||||
if (currentStepKey.value === 'skills') return t('common.finish')
|
||||
// Runtime is the last page of settings. If skills follow, keep the wizard
|
||||
// going after the save; otherwise this press closes the drawer.
|
||||
if (wizardSteps.value.some((step) => step.key === 'skills')) {
|
||||
return t('settings.sandbox.saveAndContinue')
|
||||
}
|
||||
return t('common.save')
|
||||
})
|
||||
// Deep check needs the fields that actually get probed. Docker/local collect
|
||||
// the image on the connection step; Cube/E2B still have an empty template_id
|
||||
// there, so the action waits until the template step.
|
||||
const canDeepCheck = computed(() => {
|
||||
if (currentStepKey.value === 'template') return true
|
||||
return currentStepKey.value === 'connection' && !isRemoteBackend.value
|
||||
})
|
||||
const showCheckResult = computed(() => canDeepCheck.value)
|
||||
const primaryDisabled = computed(() => (
|
||||
currentStepKey.value === 'template'
|
||||
&& (!selectedTemplate.value || !isTemplateSelectable(selectedTemplate.value))
|
||||
|
|
@ -935,6 +928,7 @@ async function handlePrimaryAction() {
|
|||
if (!validateName() || !validateRequiredFields(false)) return
|
||||
if (!(await runCheck(false))) return
|
||||
if (isRemoteBackend.value) {
|
||||
invalidateCheck()
|
||||
wizardStep.value += 1
|
||||
await loadTemplates(true)
|
||||
return
|
||||
|
|
@ -944,6 +938,7 @@ async function handlePrimaryAction() {
|
|||
if (backend.value === 'docker') {
|
||||
void loadTemplates(true)
|
||||
}
|
||||
invalidateCheck()
|
||||
wizardStep.value += 1
|
||||
return
|
||||
}
|
||||
|
|
@ -993,9 +988,7 @@ async function save() {
|
|||
const saved = res?.data
|
||||
if (saved) savedRecord.value = saved
|
||||
const skillsStep = wizardSteps.value.findIndex((step) => step.key === 'skills')
|
||||
if (!existing && skillsStep >= 0 && savedRecord.value) {
|
||||
// A config created a moment ago has an empty image; walking into the
|
||||
// skills step is the whole reason the wizard has a fourth page.
|
||||
if (skillsStep >= 0 && savedRecord.value) {
|
||||
wizardStep.value = skillsStep
|
||||
return
|
||||
}
|
||||
|
|
@ -1079,7 +1072,7 @@ onUnmounted(stopTemplatePolling)
|
|||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin: 0 0 18px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sandbox-step {
|
||||
|
|
@ -1614,55 +1607,39 @@ onUnmounted(stopTemplatePolling)
|
|||
}
|
||||
|
||||
.check-result {
|
||||
margin-top: 12px;
|
||||
margin-top: 16px;
|
||||
padding-top: 14px;
|
||||
border-top: 1px solid var(--td-component-stroke);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.check-result__summary {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--td-component-stroke);
|
||||
border-radius: 8px;
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
|
||||
&.is-success .check-result__summary-icon {
|
||||
color: var(--td-brand-color);
|
||||
}
|
||||
|
||||
&.is-error .check-result__summary-icon {
|
||||
color: var(--td-error-color);
|
||||
}
|
||||
}
|
||||
|
||||
.check-result__summary-icon {
|
||||
flex-shrink: 0;
|
||||
padding-top: 1px;
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.check-result__title,
|
||||
.check-result__subtitle {
|
||||
margin: 0;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.check-result__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin: 0;
|
||||
color: var(--td-text-color-primary);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 1.45;
|
||||
|
||||
&.is-success {
|
||||
color: var(--td-success-color);
|
||||
}
|
||||
|
||||
&.is-error {
|
||||
color: var(--td-error-color);
|
||||
}
|
||||
}
|
||||
|
||||
.check-result__subtitle {
|
||||
margin-top: 2px;
|
||||
.check-result__subtitle,
|
||||
.check-result__hint {
|
||||
margin: 0;
|
||||
color: var(--td-text-color-secondary);
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.check-list {
|
||||
|
|
@ -1704,29 +1681,6 @@ onUnmounted(stopTemplatePolling)
|
|||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
|
||||
.check-pending {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
padding: 10px 12px;
|
||||
border: 1px dashed var(--td-component-stroke);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.check-pending--standalone {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.check-pending__text {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
color: var(--td-text-color-secondary);
|
||||
font-size: 12px;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.footer-check-ok {
|
||||
color: var(--td-success-color);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,29 +3,38 @@
|
|||
<t-loading :loading="loading" size="small">
|
||||
<section class="setting-drawer__section">
|
||||
<h4 class="setting-drawer__section-title">{{ $t('settings.sandbox.imageInfoTitle') }}</h4>
|
||||
<p v-if="!hasSkillSnapshot" class="image-info-note">
|
||||
{{ $t('settings.sandbox.imageInfoUsingBase') }}
|
||||
</p>
|
||||
<ul class="image-info">
|
||||
<li>
|
||||
<span class="image-info__label">{{ $t('settings.sandbox.imageInfoBaseTemplate') }}</span>
|
||||
<template v-if="hasSkillSnapshot">
|
||||
<li>
|
||||
<span class="image-info__label">{{ $t('settings.sandbox.imageInfoBaseTemplate') }}</span>
|
||||
<span class="image-info__value image-info__value--id">
|
||||
{{ skillImage?.base_template_id || runtimeTemplateId || $t('settings.sandbox.imageInfoUnset') }}
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="image-info__label">{{ $t('settings.sandbox.imageInfoSnapshot') }}</span>
|
||||
<span class="image-info__value image-info__value--id">{{ skillImage?.snapshot_id }}</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="image-info__label">{{ $t('settings.sandbox.imageInfoGeneration') }}</span>
|
||||
<span class="image-info__value">
|
||||
{{ skillImage?.generation ? String(skillImage.generation) : $t('settings.sandbox.imageInfoUnset') }}
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="image-info__label">{{ $t('settings.sandbox.imageInfoBuiltAt') }}</span>
|
||||
<span class="image-info__value">{{ formatBuiltAt(skillImage?.built_at) }}</span>
|
||||
</li>
|
||||
</template>
|
||||
<li v-else>
|
||||
<span class="image-info__label">{{ $t('settings.sandbox.imageInfoRuntimeTemplate') }}</span>
|
||||
<span class="image-info__value image-info__value--id">
|
||||
{{ skillImage?.base_template_id || $t('settings.sandbox.imageInfoEmpty') }}
|
||||
{{ runtimeTemplateId || $t('settings.sandbox.imageInfoUnset') }}
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="image-info__label">{{ $t('settings.sandbox.imageInfoSnapshot') }}</span>
|
||||
<span class="image-info__value image-info__value--id">
|
||||
{{ skillImage?.snapshot_id || $t('settings.sandbox.imageInfoEmpty') }}
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="image-info__label">{{ $t('settings.sandbox.imageInfoGeneration') }}</span>
|
||||
<span class="image-info__value">
|
||||
{{ skillImage?.generation ? String(skillImage.generation) : $t('settings.sandbox.imageInfoEmpty') }}
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="image-info__label">{{ $t('settings.sandbox.imageInfoBuiltAt') }}</span>
|
||||
<span class="image-info__value">{{ formatBuiltAt(skillImage?.built_at) }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
@ -55,6 +64,7 @@
|
|||
</section>
|
||||
|
||||
<section class="setting-drawer__section">
|
||||
<h4 class="setting-drawer__section-title">{{ $t('settings.sandbox.skillInstallGroup') }}</h4>
|
||||
<input
|
||||
ref="fileInputRef"
|
||||
type="file"
|
||||
|
|
@ -72,7 +82,7 @@
|
|||
@drop.prevent="onFileDrop"
|
||||
>
|
||||
<div class="file-upload-content">
|
||||
<t-icon name="upload" size="32px" class="upload-icon" />
|
||||
<t-icon name="upload" size="28px" class="upload-icon" />
|
||||
<div class="upload-text">
|
||||
<span v-if="uploading" class="upload-file-name">
|
||||
{{ $t('settings.sandbox.skillUploading', { percent: uploadPercent }) }}
|
||||
|
|
@ -86,7 +96,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<p class="upload-hint">{{ uploadHint }}</p>
|
||||
</section>
|
||||
|
||||
<section class="setting-drawer__section">
|
||||
<h4 class="setting-drawer__section-title">{{ $t('settings.sandbox.skillInstalledGroup') }}</h4>
|
||||
<p v-if="!loading && skills.length === 0" class="skill-empty">
|
||||
{{ $t('settings.sandbox.skillEmpty') }}
|
||||
</p>
|
||||
|
|
@ -98,134 +111,146 @@
|
|||
v-if="isBusy(skill)"
|
||||
theme="circle"
|
||||
:percentage="progressOf(skill)"
|
||||
:size="32"
|
||||
:size="16"
|
||||
/>
|
||||
<t-icon
|
||||
v-else-if="skill.status === 'failed'"
|
||||
name="close-circle-filled"
|
||||
size="16px"
|
||||
class="skill-status-ring__failed"
|
||||
/>
|
||||
<t-icon
|
||||
v-else
|
||||
name="check-circle-filled"
|
||||
size="16px"
|
||||
class="skill-status-ring__ready"
|
||||
/>
|
||||
</div>
|
||||
<div class="skill-item__body">
|
||||
<div class="skill-item__title">{{ skill.name || skill.id }}</div>
|
||||
<p v-if="skill.description" class="skill-item__desc">{{ skill.description }}</p>
|
||||
<p class="skill-item__meta">
|
||||
<span>{{ statusLabel(skill) }}</span>
|
||||
<span v-if="isBusy(skill)"> · {{ progressOf(skill) }}%</span>
|
||||
</p>
|
||||
<p v-if="skill.status === 'failed' && (skill.error || progressLog(skill))" class="skill-item__error">
|
||||
{{ skill.error || progressLog(skill) }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="skill-item__actions">
|
||||
<t-tooltip :content="$t('settings.sandbox.skillDisableHint')" placement="top">
|
||||
<t-switch
|
||||
:value="skill.enabled"
|
||||
:disabled="isBusy(skill)"
|
||||
:loading="togglingId === skill.id"
|
||||
@change="(v: any) => toggleEnabled(skill, Boolean(v))"
|
||||
/>
|
||||
</t-tooltip>
|
||||
<t-tooltip
|
||||
v-if="hasTranscript(skill)"
|
||||
:content="
|
||||
expandedSkillId === skill.id
|
||||
? $t('settings.sandbox.skillTranscriptHide')
|
||||
: $t('settings.sandbox.skillTranscript')
|
||||
"
|
||||
placement="top"
|
||||
>
|
||||
<t-button
|
||||
variant="text"
|
||||
shape="square"
|
||||
size="small"
|
||||
:class="{ 'skill-transcript-toggle--on': expandedSkillId === skill.id }"
|
||||
@click="toggleTranscript(skill)"
|
||||
>
|
||||
<template #icon>
|
||||
<t-icon :name="expandedSkillId === skill.id ? 'chevron-up' : 'chat-bubble-history'" />
|
||||
</template>
|
||||
</t-button>
|
||||
</t-tooltip>
|
||||
<t-tooltip :content="$t('settings.sandbox.skillView')" placement="top">
|
||||
<t-button
|
||||
variant="text"
|
||||
shape="square"
|
||||
size="small"
|
||||
@click="openView(skill)"
|
||||
>
|
||||
<template #icon><t-icon name="browse" /></template>
|
||||
</t-button>
|
||||
</t-tooltip>
|
||||
<t-popconfirm
|
||||
theme="warning"
|
||||
:content="deleteHint"
|
||||
:confirm-btn="{ content: $t('common.delete'), theme: 'danger' }"
|
||||
:cancel-btn="{ content: $t('common.cancel') }"
|
||||
placement="top-right"
|
||||
@confirm="removeSkill(skill)"
|
||||
>
|
||||
<t-tooltip :content="$t('common.delete')" placement="top">
|
||||
<t-button
|
||||
theme="danger"
|
||||
variant="text"
|
||||
shape="square"
|
||||
size="small"
|
||||
:disabled="isBusy(skill)"
|
||||
:loading="deletingId === skill.id"
|
||||
<div class="skill-item__header">
|
||||
<div class="skill-item__heading">
|
||||
<div class="skill-item__title">{{ skill.name || skill.id }}</div>
|
||||
<p class="skill-item__meta">
|
||||
<span v-if="skill.version">{{ skill.version }} · </span>
|
||||
<span>{{ statusLabel(skill) }}</span>
|
||||
<span v-if="isBusy(skill)"> · {{ progressOf(skill) }}%</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="skill-item__actions">
|
||||
<t-tooltip :content="$t('settings.sandbox.skillDisableHint')" placement="top">
|
||||
<t-switch
|
||||
size="small"
|
||||
:value="skill.enabled"
|
||||
:disabled="isBusy(skill)"
|
||||
:loading="togglingId === skill.id"
|
||||
@change="(v: any) => toggleEnabled(skill, Boolean(v))"
|
||||
/>
|
||||
</t-tooltip>
|
||||
<t-popup
|
||||
v-if="hasTranscript(skill)"
|
||||
:visible="expandedSkillId === skill.id"
|
||||
trigger="click"
|
||||
placement="bottom-right"
|
||||
attach="body"
|
||||
destroy-on-close
|
||||
overlay-class-name="skill-transcript-popup"
|
||||
:z-index="3200"
|
||||
:overlay-inner-style="{ padding: '0' }"
|
||||
@visible-change="(visible: boolean) => onTranscriptVisible(skill, visible)"
|
||||
>
|
||||
<template #icon><t-icon name="delete" /></template>
|
||||
</t-button>
|
||||
</t-tooltip>
|
||||
</t-popconfirm>
|
||||
<t-button
|
||||
variant="text"
|
||||
shape="square"
|
||||
class="skill-item__icon-btn"
|
||||
:class="{ 'skill-transcript-toggle--on': expandedSkillId === skill.id }"
|
||||
:title="$t('settings.sandbox.skillTranscript')"
|
||||
>
|
||||
<template #icon>
|
||||
<t-icon name="chat-bubble-history" size="16px" />
|
||||
</template>
|
||||
</t-button>
|
||||
<template #content>
|
||||
<div class="skill-transcript-popup__panel">
|
||||
<header class="skill-transcript-popup__head">
|
||||
<div class="skill-transcript-popup__head-text">
|
||||
<div class="skill-transcript-popup__title">{{ skill.name || skill.id }}</div>
|
||||
<div class="skill-transcript-popup__meta">
|
||||
<span
|
||||
class="skill-transcript-popup__status"
|
||||
:data-status="skill.status"
|
||||
>{{ statusLabel(skill) }}</span>
|
||||
<span>{{ $t('settings.sandbox.skillTranscriptTitle') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<t-button
|
||||
variant="text"
|
||||
shape="square"
|
||||
size="small"
|
||||
class="skill-transcript-popup__close"
|
||||
:title="$t('common.close')"
|
||||
@click.stop="onTranscriptVisible(skill, false)"
|
||||
>
|
||||
<template #icon><t-icon name="close" size="16px" /></template>
|
||||
</t-button>
|
||||
</header>
|
||||
<div class="skill-transcript-popup__body">
|
||||
<SkillInstallTimeline
|
||||
:key="`${skill.id}-${skill.install_session_id || ''}-${transcriptEpoch}`"
|
||||
compact
|
||||
:config-id="record?.id || ''"
|
||||
:skill-id="skill.id"
|
||||
:session-id="skill.install_session_id || ''"
|
||||
:message-id="skill.install_message_id || ''"
|
||||
:live="skill.status === 'installing'"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</t-popup>
|
||||
<t-popconfirm
|
||||
theme="warning"
|
||||
:content="deleteHint"
|
||||
:confirm-btn="{ content: $t('common.delete'), theme: 'danger' }"
|
||||
:cancel-btn="{ content: $t('common.cancel') }"
|
||||
placement="top-right"
|
||||
@confirm="removeSkill(skill)"
|
||||
>
|
||||
<t-tooltip :content="$t('common.delete')" placement="top">
|
||||
<t-button
|
||||
theme="danger"
|
||||
variant="text"
|
||||
shape="square"
|
||||
class="skill-item__icon-btn"
|
||||
:disabled="isBusy(skill)"
|
||||
:loading="deletingId === skill.id"
|
||||
>
|
||||
<template #icon><t-icon name="delete" size="16px" /></template>
|
||||
</t-button>
|
||||
</t-tooltip>
|
||||
</t-popconfirm>
|
||||
</div>
|
||||
</div>
|
||||
<p
|
||||
v-if="skill.description"
|
||||
class="skill-item__desc"
|
||||
:class="{ 'skill-item__desc--expanded': isCopyExpanded(skill.id) }"
|
||||
>
|
||||
{{ skill.description }}
|
||||
</p>
|
||||
<button
|
||||
v-if="canToggleCopy(skill)"
|
||||
type="button"
|
||||
class="skill-item__toggle"
|
||||
@click="toggleCopy(skill.id)"
|
||||
>
|
||||
{{ isCopyExpanded(skill.id) ? $t('common.collapse') : $t('common.expand') }}
|
||||
</button>
|
||||
<p v-if="failedError(skill)" class="skill-item__error">{{ failedError(skill) }}</p>
|
||||
</div>
|
||||
|
||||
<SkillInstallTimeline
|
||||
v-if="expandedSkillId === skill.id"
|
||||
:key="`${skill.id}-${skill.install_session_id || ''}-${transcriptEpoch}`"
|
||||
class="skill-item__timeline"
|
||||
:config-id="record?.id || ''"
|
||||
:skill-id="skill.id"
|
||||
:session-id="skill.install_session_id || ''"
|
||||
:message-id="skill.install_message_id || ''"
|
||||
:live="skill.status === 'installing'"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</t-loading>
|
||||
|
||||
<t-dialog
|
||||
v-model:visible="showView"
|
||||
:header="viewing?.name || $t('settings.sandbox.skillView')"
|
||||
:footer="false"
|
||||
width="520px"
|
||||
attach="body"
|
||||
>
|
||||
<ul v-if="viewing" class="skill-view">
|
||||
<li>
|
||||
<span class="skill-view__label">{{ $t('settings.sandbox.skillVersion') }}</span>
|
||||
<span class="skill-view__value">{{ viewing.version || $t('settings.sandbox.skillVersionEmpty') }}</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="skill-view__label">{{ $t('settings.sandbox.skillStatusLabel') }}</span>
|
||||
<span class="skill-view__value">{{ statusLabel(viewing) }}</span>
|
||||
</li>
|
||||
<li v-if="viewing.description">
|
||||
<span class="skill-view__label">{{ $t('settings.sandbox.configDescription') }}</span>
|
||||
<span class="skill-view__value">{{ viewing.description }}</span>
|
||||
</li>
|
||||
<li v-if="viewing.error">
|
||||
<span class="skill-view__label">{{ $t('settings.sandbox.skillError') }}</span>
|
||||
<span class="skill-view__value skill-view__error">{{ viewing.error }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</t-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -277,11 +302,10 @@ const skills = ref<ConfigSkill[]>([])
|
|||
const skillImage = ref<SandboxSkillImage | null>(null)
|
||||
const togglingId = ref('')
|
||||
const deletingId = ref('')
|
||||
const showView = ref(false)
|
||||
const viewing = ref<ConfigSkill | null>(null)
|
||||
// Only one install timeline is open at a time: each one holds an SSE
|
||||
// connection, and two runs' worth of agent steps in a drawer is unreadable.
|
||||
const expandedSkillId = ref('')
|
||||
const expandedCopyIds = ref<Set<string>>(new Set())
|
||||
const transcriptEpoch = ref(0)
|
||||
const fileInputRef = ref<HTMLInputElement | null>(null)
|
||||
const progressById = ref<Record<string, ConfigSkillInstallEvent>>({})
|
||||
|
|
@ -312,6 +336,11 @@ const deleteHint = computed(() =>
|
|||
? t('settings.sandbox.skillDeleteHintNewSession')
|
||||
: t('settings.sandbox.skillDeleteHint'),
|
||||
)
|
||||
const runtimeTemplateId = computed(() => {
|
||||
const cfg = props.record?.config
|
||||
return cfg?.cube?.template_id?.trim() || cfg?.e2b?.template_id?.trim() || ''
|
||||
})
|
||||
const hasSkillSnapshot = computed(() => Boolean(skillImage.value?.snapshot_id?.trim()))
|
||||
|
||||
function readLastChatModelID(): string {
|
||||
try {
|
||||
|
|
@ -322,10 +351,10 @@ function readLastChatModelID(): string {
|
|||
}
|
||||
|
||||
function formatBuiltAt(value?: string): string {
|
||||
if (!value) return t('settings.sandbox.imageInfoEmpty')
|
||||
if (!value) return t('settings.sandbox.imageInfoUnset')
|
||||
const date = new Date(value)
|
||||
if (Number.isNaN(date.getTime()) || date.getFullYear() <= 1) {
|
||||
return t('settings.sandbox.imageInfoEmpty')
|
||||
return t('settings.sandbox.imageInfoUnset')
|
||||
}
|
||||
return date.toLocaleString(locale.value)
|
||||
}
|
||||
|
|
@ -355,16 +384,19 @@ function hasTranscript(skill: ConfigSkill): boolean {
|
|||
return Boolean(skill.install_session_id && skill.install_message_id)
|
||||
}
|
||||
|
||||
function toggleTranscript(skill: ConfigSkill) {
|
||||
if (expandedSkillId.value === skill.id) {
|
||||
expandedSkillId.value = ''
|
||||
function onTranscriptVisible(skill: ConfigSkill, visible: boolean) {
|
||||
if (visible) {
|
||||
if (expandedSkillId.value !== skill.id) {
|
||||
expandedSkillId.value = skill.id
|
||||
// A run that finished while the popup was closed was tailed from the
|
||||
// event log; reopening it should read the run again from the top.
|
||||
transcriptEpoch.value += 1
|
||||
}
|
||||
return
|
||||
}
|
||||
expandedSkillId.value = skill.id
|
||||
// A run that finished while the timeline was open was tailed from the event
|
||||
// log; reopening it should read the run again from the top rather than show
|
||||
// whatever the closed stream left behind.
|
||||
transcriptEpoch.value += 1
|
||||
if (expandedSkillId.value === skill.id) {
|
||||
expandedSkillId.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
function progressOf(skill: ConfigSkill): number {
|
||||
|
|
@ -379,6 +411,31 @@ function progressLog(skill: ConfigSkill): string {
|
|||
return progressById.value[skill.id]?.log || ''
|
||||
}
|
||||
|
||||
function failedError(skill: ConfigSkill): string {
|
||||
if (skill.status !== 'failed') return ''
|
||||
return skill.error || progressLog(skill)
|
||||
}
|
||||
|
||||
function isCopyExpanded(skillId: string): boolean {
|
||||
return expandedCopyIds.value.has(skillId)
|
||||
}
|
||||
|
||||
function descriptionNeedsToggle(skill: ConfigSkill): boolean {
|
||||
const desc = skill.description?.trim() || ''
|
||||
return desc.length > 80 || desc.includes('\n')
|
||||
}
|
||||
|
||||
function canToggleCopy(skill: ConfigSkill): boolean {
|
||||
return descriptionNeedsToggle(skill) || isCopyExpanded(skill.id)
|
||||
}
|
||||
|
||||
function toggleCopy(skillId: string) {
|
||||
const next = new Set(expandedCopyIds.value)
|
||||
if (next.has(skillId)) next.delete(skillId)
|
||||
else next.add(skillId)
|
||||
expandedCopyIds.value = next
|
||||
}
|
||||
|
||||
function stopFollow(skillId: string) {
|
||||
const controller = abortBySkill.get(skillId)
|
||||
if (controller) {
|
||||
|
|
@ -643,11 +700,6 @@ async function removeSkill(skill: ConfigSkill) {
|
|||
}
|
||||
}
|
||||
|
||||
function openView(skill: ConfigSkill) {
|
||||
viewing.value = skill
|
||||
showView.value = true
|
||||
}
|
||||
|
||||
// The panel is mounted only while its wizard step is showing, so switching
|
||||
// steps tears the follows down and coming back re-reads the list.
|
||||
watch(
|
||||
|
|
@ -661,8 +713,7 @@ watch(
|
|||
stopPoll()
|
||||
skills.value = []
|
||||
progressById.value = {}
|
||||
showView.value = false
|
||||
viewing.value = null
|
||||
expandedCopyIds.value = new Set()
|
||||
installerAgent.value = null
|
||||
installerModelId.value = ''
|
||||
},
|
||||
|
|
@ -676,6 +727,13 @@ onUnmounted(() => {
|
|||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.image-info-note {
|
||||
margin: 0 0 10px;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
|
||||
.image-info {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
|
@ -808,13 +866,13 @@ onUnmounted(() => {
|
|||
}
|
||||
|
||||
.skill-empty {
|
||||
margin: 12px 0 0;
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
}
|
||||
|
||||
.skill-list {
|
||||
margin: 12px 0 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
|
|
@ -822,11 +880,10 @@ onUnmounted(() => {
|
|||
gap: 8px;
|
||||
}
|
||||
|
||||
// A grid rather than a flex row so the expanded install timeline can span the
|
||||
// full width underneath the three columns of the row it belongs to.
|
||||
// The install timeline opens in a popup, so the card stays a two-column row.
|
||||
.skill-item {
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr) auto;
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
padding: 12px;
|
||||
|
|
@ -835,54 +892,60 @@ onUnmounted(() => {
|
|||
background: var(--td-bg-color-container);
|
||||
}
|
||||
|
||||
.skill-item__timeline {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.skill-transcript-toggle--on {
|
||||
color: var(--td-brand-color);
|
||||
}
|
||||
|
||||
.skill-status-ring {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-top: 3px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
color: var(--td-text-color-secondary);
|
||||
|
||||
:deep(.t-progress) {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
:deep(.t-progress),
|
||||
:deep(.t-icon) {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
&__ready {
|
||||
color: var(--td-success-color);
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
&__failed {
|
||||
color: var(--td-error-color);
|
||||
font-size: 22px;
|
||||
}
|
||||
}
|
||||
|
||||
.skill-item__body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.skill-item__header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.skill-item__heading {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.skill-item__title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
line-height: 22px;
|
||||
color: var(--td-text-color-primary);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.skill-item__desc,
|
||||
.skill-item__meta {
|
||||
margin: 2px 0 0;
|
||||
font-size: 12px;
|
||||
|
|
@ -890,54 +953,149 @@ onUnmounted(() => {
|
|||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
|
||||
.skill-item__desc,
|
||||
.skill-item__error {
|
||||
margin: 6px 0 0;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.skill-item__desc {
|
||||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
|
||||
.skill-item__desc:not(.skill-item__desc--expanded) {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.skill-item__error {
|
||||
margin: 4px 0 0;
|
||||
font-size: 12px;
|
||||
line-height: 1.45;
|
||||
color: var(--td-error-color);
|
||||
}
|
||||
|
||||
.skill-item__toggle {
|
||||
margin-top: 4px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: none;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
color: var(--td-brand-color);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.skill-item__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
gap: 4px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.skill-view {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
.skill-item__icon-btn {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
|
||||
.skill-view li {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.skill-view__label {
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
|
||||
.skill-view__value {
|
||||
font-size: 13px;
|
||||
color: var(--td-text-color-primary);
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.skill-view__error {
|
||||
color: var(--td-error-color);
|
||||
:deep(.t-button__icon) {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="less">
|
||||
.skill-transcript-popup {
|
||||
z-index: 3200 !important;
|
||||
|
||||
.t-popup__content {
|
||||
padding: 0 !important;
|
||||
width: 420px;
|
||||
max-width: min(420px, calc(100vw - 32px));
|
||||
border-radius: 10px !important;
|
||||
background: var(--td-bg-color-container) !important;
|
||||
border: 1px solid var(--td-component-stroke) !important;
|
||||
box-shadow:
|
||||
0 0 0 0.5px rgba(0, 0, 0, 0.04),
|
||||
0 8px 24px rgba(0, 0, 0, 0.12) !important;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&__panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&__head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
padding: 10px 8px 10px 14px;
|
||||
border-bottom: 1px solid var(--td-component-stroke);
|
||||
}
|
||||
|
||||
&__head-text {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 1.35;
|
||||
color: var(--td-text-color-primary);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-top: 2px;
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
color: var(--td-text-color-placeholder);
|
||||
}
|
||||
|
||||
&__status {
|
||||
color: var(--td-text-color-secondary);
|
||||
|
||||
&[data-status='installing'],
|
||||
&[data-status='removing'] {
|
||||
color: var(--td-brand-color);
|
||||
}
|
||||
|
||||
&[data-status='failed'] {
|
||||
color: var(--td-error-color);
|
||||
}
|
||||
|
||||
&[data-status='ready'] {
|
||||
color: var(--td-success-color);
|
||||
}
|
||||
}
|
||||
|
||||
&__close {
|
||||
flex-shrink: 0;
|
||||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
|
||||
&__body {
|
||||
max-height: min(360px, 52vh);
|
||||
overflow: auto;
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: var(--td-bg-color-component-disabled);
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<section class="skill-timeline" :aria-busy="loading">
|
||||
<section class="skill-timeline" :class="{ 'skill-timeline--compact': compact }" :aria-busy="loading">
|
||||
<t-loading v-if="loading && messages.length === 0" size="small" />
|
||||
<p v-else-if="messages.length === 0" class="skill-timeline__empty">
|
||||
{{ live
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
:session="msg"
|
||||
:session-id="sessionId"
|
||||
:user-query="''"
|
||||
embedded-mode
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -41,6 +42,7 @@ const props = defineProps<{
|
|||
// after the installer sandbox is up, so a 404 here means "not yet" rather
|
||||
// than "gone" and the stream is retried.
|
||||
live?: boolean
|
||||
compact?: boolean
|
||||
}>()
|
||||
|
||||
const messages = reactive<any[]>([])
|
||||
|
|
@ -51,6 +53,9 @@ const fullContent = ref('')
|
|||
|
||||
let controller: AbortController | null = null
|
||||
let closed = false
|
||||
// stop() / a newer open() bump this so an in-flight live loop cannot keep
|
||||
// calling follow() after closed is reset — that would replay a finished run.
|
||||
let openRun = 0
|
||||
|
||||
// The timeline grows inside the drawer's own scroll container, so following the
|
||||
// tail would mean scrolling the whole drawer under a reader who is inspecting
|
||||
|
|
@ -76,16 +81,18 @@ function applyPrompt(content: string) {
|
|||
messages.unshift({ id: `${props.messageId}-prompt`, role: 'user', content })
|
||||
}
|
||||
|
||||
async function loadPersisted() {
|
||||
async function loadPersisted(run: number) {
|
||||
const res: any = await getMessageList({
|
||||
session_id: props.sessionId,
|
||||
limit: 100,
|
||||
created_at: '',
|
||||
})
|
||||
if (run !== openRun) return
|
||||
handleMsgList(res?.data || [])
|
||||
}
|
||||
|
||||
function stop() {
|
||||
openRun += 1
|
||||
closed = true
|
||||
if (controller) {
|
||||
controller.abort()
|
||||
|
|
@ -96,11 +103,16 @@ function stop() {
|
|||
// follow tails the transcript endpoint. It resolves when the stream ends, and
|
||||
// reports whether it ever produced anything: a 404 means the event log has
|
||||
// expired and the durable history is the only remaining source.
|
||||
async function follow(): Promise<boolean> {
|
||||
async function follow(run: number): Promise<boolean> {
|
||||
const url = `${getApiBaseUrl()}${configSkillTranscriptUrl(props.configId, props.skillId)}`
|
||||
const token = localStorage.getItem('weknora_token')
|
||||
const tenantId = localStorage.getItem('weknora_selected_tenant_id')
|
||||
controller = new AbortController()
|
||||
const ac = new AbortController()
|
||||
controller = ac
|
||||
if (run !== openRun) {
|
||||
ac.abort()
|
||||
return false
|
||||
}
|
||||
let served = false
|
||||
|
||||
await fetchEventSource(url, {
|
||||
|
|
@ -111,7 +123,7 @@ async function follow(): Promise<boolean> {
|
|||
'X-Request-ID': generateRandomString(12),
|
||||
...(tenantId ? { 'X-Tenant-ID': tenantId } : {}),
|
||||
},
|
||||
signal: controller.signal,
|
||||
signal: ac.signal,
|
||||
openWhenHidden: true,
|
||||
onopen: async (response) => {
|
||||
if (response.ok) {
|
||||
|
|
@ -123,6 +135,7 @@ async function follow(): Promise<boolean> {
|
|||
throw new Error(`transcript stream refused: ${response.status}`)
|
||||
},
|
||||
onmessage(ev) {
|
||||
if (run !== openRun || !props.live) return
|
||||
if (!ev.data) return
|
||||
let frame: any
|
||||
try {
|
||||
|
|
@ -152,28 +165,41 @@ function wait(ms: number): Promise<void> {
|
|||
}
|
||||
|
||||
async function open() {
|
||||
const run = ++openRun
|
||||
closed = false
|
||||
messages.splice(0, messages.length)
|
||||
loading.value = true
|
||||
const stale = () => run !== openRun || closed
|
||||
try {
|
||||
// Locators land after the installer sandbox is up. Keep asking until the
|
||||
// stream answers or this run is no longer live; falling through to the
|
||||
// empty state on the first 404 would flash "no record" during setup.
|
||||
for (;;) {
|
||||
const served = await follow().catch(() => false)
|
||||
if (closed || served) return
|
||||
if (props.sessionId && props.messageId) {
|
||||
await loadPersisted()
|
||||
if (messages.length > 0 || closed) return
|
||||
// A finished install already has durable rows. Replaying the event log
|
||||
// through processStreamChunk would animate every tool call again, which
|
||||
// is what "view the run" must not do.
|
||||
if (!props.live) {
|
||||
if (props.sessionId) {
|
||||
await loadPersisted(run)
|
||||
}
|
||||
if (!props.live || closed) return
|
||||
return
|
||||
}
|
||||
|
||||
// Locators land after the installer sandbox is up. Keep asking until the
|
||||
// stream answers; falling through to the empty state on the first 404
|
||||
// would flash "no record" during setup.
|
||||
for (;;) {
|
||||
if (stale() || !props.live) return
|
||||
const served = await follow(run).catch(() => false)
|
||||
if (stale() || !props.live || served) return
|
||||
if (props.sessionId && props.messageId) {
|
||||
await loadPersisted(run)
|
||||
if (stale() || messages.length > 0) return
|
||||
}
|
||||
if (stale() || !props.live) return
|
||||
await wait(1000)
|
||||
if (!props.live || closed) return
|
||||
if (stale() || !props.live) return
|
||||
}
|
||||
} catch {
|
||||
// Both sources are gone; the empty state says so.
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (!stale()) loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -220,4 +246,50 @@ onUnmounted(stop)
|
|||
color: var(--td-text-color-placeholder, #999);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.skill-timeline--compact {
|
||||
padding: 10px 12px 12px;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.skill-timeline--compact .skill-timeline__prompt {
|
||||
max-height: 72px;
|
||||
padding: 6px 8px;
|
||||
font-size: 11px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.skill-timeline--compact .skill-timeline__empty {
|
||||
margin: 4px 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.skill-timeline--compact :deep(.agent-stream-display.is-embedded) {
|
||||
font-size: 12px;
|
||||
--agent-step-text-size: 12px;
|
||||
--agent-step-summary-size: 12px;
|
||||
}
|
||||
|
||||
.skill-timeline--compact :deep(.agent-stream-display.is-embedded .tree-root .action-name) {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
// Chat answer Markdown is 16px. That is the right size in a conversation and
|
||||
// too loud in this 420px popup, where the prompt and step summary are 11–13px.
|
||||
.skill-timeline--compact :deep(.agent-stream-display .answer-content.markdown-content) {
|
||||
font-size: 12px;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.skill-timeline--compact :deep(.agent-stream-display .answer-content.markdown-content h1) {
|
||||
font-size: 13px;
|
||||
margin-bottom: 0.35em;
|
||||
}
|
||||
|
||||
.skill-timeline--compact :deep(.agent-stream-display .answer-content.markdown-content h2),
|
||||
.skill-timeline--compact :deep(.agent-stream-display .answer-content.markdown-content h3) {
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -18,17 +18,22 @@
|
|||
so we don't need a redundant X button.
|
||||
-->
|
||||
<template #header>
|
||||
<div class="setting-drawer__header">
|
||||
<div v-if="$slots.headerIcon || icon" class="setting-drawer__header-icon">
|
||||
<slot name="headerIcon">
|
||||
<t-icon v-if="icon" :name="icon" />
|
||||
</slot>
|
||||
</div>
|
||||
<div class="setting-drawer__header-text">
|
||||
<div class="setting-drawer__title">{{ title }}</div>
|
||||
<div v-if="description || $slots.subtitle" class="setting-drawer__subtitle">
|
||||
<slot name="subtitle">{{ description }}</slot>
|
||||
<div class="setting-drawer__header-block">
|
||||
<div class="setting-drawer__header">
|
||||
<div v-if="$slots.headerIcon || icon" class="setting-drawer__header-icon">
|
||||
<slot name="headerIcon">
|
||||
<t-icon v-if="icon" :name="icon" />
|
||||
</slot>
|
||||
</div>
|
||||
<div class="setting-drawer__header-text">
|
||||
<div class="setting-drawer__title">{{ title }}</div>
|
||||
<div v-if="description || $slots.subtitle" class="setting-drawer__subtitle">
|
||||
<slot name="subtitle">{{ description }}</slot>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="$slots['header-extra']" class="setting-drawer__header-extra">
|
||||
<slot name="header-extra" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -258,6 +263,15 @@ const handleCancel = () => {
|
|||
|
||||
<style lang="less" scoped>
|
||||
/* ---------- Header ---------- */
|
||||
.setting-drawer__header-block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.setting-drawer__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
|
|||
|
|
@ -1018,15 +1018,15 @@ export default {
|
|||
selectSkills: 'Select Skills',
|
||||
selectSkillsDesc: 'Choose which Skills to enable',
|
||||
noSkillsAvailable: 'No preloaded Skills available',
|
||||
sandboxConfig: 'Sandbox backend',
|
||||
sandboxConfigDesc: 'Choose which sandbox backend this agent\'s skill scripts execute in.',
|
||||
sandboxBackend: 'Sandbox backend',
|
||||
sandboxConfig: 'Skill sandbox',
|
||||
sandboxConfigDesc: 'Choose which sandbox this agent\'s skill scripts run in.',
|
||||
sandboxBackend: 'Sandbox config',
|
||||
sandboxBackendDefault: 'Disable sandbox',
|
||||
sandboxBackendHint: 'Only applies while skill execution is enabled. If the selected config is deleted, this agent\'s skill execution will fail.',
|
||||
sandboxBackendMissing: 'Config deleted',
|
||||
sandboxNoConfigs: 'This workspace has no sandbox backend yet, so skill scripts will not run. Add one under Settings - Sandbox Backend.',
|
||||
sandboxInfoTitle: 'Why choose a backend?',
|
||||
sandboxInfoContent: 'Backends differ in account, region and quota. Once a session\'s sandbox exists, its attachments, artifacts and teardown stay pinned to the config it was created on — changing this only affects sandboxes created afterwards.',
|
||||
sandboxNoConfigs: 'This workspace has no sandbox yet, so skill scripts will not run. Add one under Settings - Skill Sandbox.',
|
||||
sandboxInfoTitle: 'Why pick a config?',
|
||||
sandboxInfoContent: 'Configs differ in account, region and quota. Once a session\'s sandbox exists, its attachments, artifacts and teardown stay pinned to the config it was created on — changing this only affects sandboxes created afterwards.',
|
||||
skillsInfoTitle: 'What are Skills?',
|
||||
skillsInfoContent: 'Skills are preloaded professional knowledge modules that provide domain-specific instructions, workflows, and tool support for the Agent. When enabled, the Agent will automatically load relevant knowledge when needed.'
|
||||
},
|
||||
|
|
@ -1058,8 +1058,10 @@ export default {
|
|||
parserEngine: 'Parser Engine',
|
||||
storageEngine: 'Storage Engine',
|
||||
sandbox: {
|
||||
title: 'Sandbox Backend',
|
||||
description: 'Manage the sandbox runtimes used by agent skills. Each agent can select one workspace backend.',
|
||||
title: 'Skill Sandbox',
|
||||
description: 'Manage isolated runtimes for agent skill scripts. Each agent can pick one workspace config.',
|
||||
pageHintTitle: 'What is a skill sandbox?',
|
||||
pageHint: 'A skill sandbox is the isolated environment where agent skill scripts run. A workspace can have several configs (Docker, E2B, CubeSandbox, or a local process); each agent picks one. Scripts stay disabled until a config is selected.',
|
||||
editorDescription: 'Configure a workspace runtime. Docker, Local process, CubeSandbox, and E2B use the same management flow.',
|
||||
stepConnection: 'Connect',
|
||||
stepTemplate: 'Template',
|
||||
|
|
@ -1077,7 +1079,7 @@ export default {
|
|||
connectAndContinue: 'Connect and continue',
|
||||
loading: 'Loading sandbox configuration...',
|
||||
loadFailed: 'Failed to load sandbox configuration',
|
||||
backend: 'Sandbox backend',
|
||||
backend: 'Sandbox',
|
||||
backendType: 'Sandbox type',
|
||||
backendTypePlaceholder: 'Select a sandbox type',
|
||||
scriptPolicyLabel: 'Allow skill scripts to run in sandboxes',
|
||||
|
|
@ -1088,22 +1090,22 @@ export default {
|
|||
docker: 'Keep a long-lived container per session on this WeKnora host; scripts and files stay in that container',
|
||||
local: 'Run scripts directly in the WeKnora server process environment',
|
||||
},
|
||||
addConfig: 'Add sandbox backend',
|
||||
addConfig: 'Add sandbox',
|
||||
viewClusterGuide: 'Cluster setup guide',
|
||||
configName: 'Config name',
|
||||
configNamePlaceholder: 'e.g. Production E2B',
|
||||
configNameRequired: 'Please enter a config name',
|
||||
configDescription: 'Description',
|
||||
configDescriptionPlaceholder: 'Optional, helps tell several configs of the same type apart',
|
||||
createTitle: 'Add sandbox backend',
|
||||
editTitle: 'Edit sandbox backend',
|
||||
createTitle: 'Add sandbox',
|
||||
editTitle: 'Edit sandbox',
|
||||
sectionBasic: 'Basic information',
|
||||
sectionConnection: 'Cluster connection',
|
||||
sectionRuntimeEnvironment: 'Runtime environment',
|
||||
sectionTemplate: 'Runtime template',
|
||||
sectionRuntime: 'Execution settings',
|
||||
sectionEnvironment: 'Environment variables',
|
||||
noConfigs: 'No sandbox backend yet. Agents without a workspace configuration will not run skill scripts.',
|
||||
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.',
|
||||
viewSandboxes: 'View sandbox usage',
|
||||
inventoryTitle: 'Sandbox usage',
|
||||
|
|
@ -1118,8 +1120,8 @@ export default {
|
|||
unverifiableSaveHint: 'Restore connectivity first; if the backend is gone for good, create a second config and point the agents at it.',
|
||||
affectedSessions: '{count} session(s) affected.',
|
||||
affectedAgents: 'Agents using this config: {names}',
|
||||
confirmDelete: 'Delete sandbox backend "{name}"?',
|
||||
confirmDeleteWithAgents: 'Delete sandbox backend "{name}"? {agents}They will fail on their next skill execution.',
|
||||
confirmDelete: 'Delete sandbox "{name}"?',
|
||||
confirmDeleteWithAgents: 'Delete sandbox "{name}"? {agents}They will fail on their next skill execution.',
|
||||
deleteFailed: 'Failed to delete',
|
||||
deleted: 'Deleted',
|
||||
forceDeleteTitle: 'Sandbox usage cannot be verified',
|
||||
|
|
@ -1231,12 +1233,13 @@ export default {
|
|||
addRow: 'Add variable',
|
||||
removeRow: 'Remove',
|
||||
save: 'Save',
|
||||
saveAndContinue: 'Save and continue',
|
||||
saved: 'Saved. Applies to new sessions.',
|
||||
saveFailed: 'Failed to save',
|
||||
testConnection: 'Test connection',
|
||||
deepCheck: 'Full verification',
|
||||
recheck: 'Verify again',
|
||||
deepCheckIntro: 'Before saving you can run a full verification: it creates a throwaway sandbox, runs one script, checks outbound access and destroys it.',
|
||||
deepCheckIntro: 'Full verification creates a throwaway sandbox, runs one script, checks outbound access, and destroys it.',
|
||||
deepCheckConfirm: 'Full verification runs a throwaway script. Remote backends also create and destroy a real sandbox and may consume a small amount of sandbox time. Continue?',
|
||||
checkPassed: 'All checks passed',
|
||||
checkFailed: 'Some checks failed',
|
||||
|
|
@ -1261,6 +1264,8 @@ export default {
|
|||
egress_available: 'Outbound network',
|
||||
},
|
||||
manageSkills: 'Manage skills',
|
||||
cardSkillsNone: 'No skills installed',
|
||||
cardSkillsMore: '+{count}',
|
||||
skillInstallerModel: 'Installer model',
|
||||
skillInstallerModelHint: 'Used by the built-in installer agent. Choose a chat model that supports tool calls.',
|
||||
skillInstallerModelRequired: 'Select an installer model first',
|
||||
|
|
@ -1270,6 +1275,8 @@ export default {
|
|||
skillRolloutNextTurn: 'Rebuild open sessions on the next chat turn',
|
||||
skillRolloutNewSession: 'Keep open sessions on their current sandbox; only new sessions use the new image',
|
||||
skillRolloutSaveFailed: 'Failed to save the rollout setting',
|
||||
skillInstallGroup: 'Install a new skill',
|
||||
skillInstalledGroup: 'Installed',
|
||||
skillUploadClick: 'Click to upload a skill bundle',
|
||||
skillUploadDrag: 'or drop a .zip file here',
|
||||
skillUploadHint: 'Upload installs the skill onto the current image and takes a new snapshot. This can take several minutes. The current chat turn is not interrupted; open sessions rebuild their sandbox on the next turn, which clears the session workspace scratch.',
|
||||
|
|
@ -1290,9 +1297,12 @@ export default {
|
|||
imageInfoGeneration: 'Version',
|
||||
imageInfoBuiltAt: 'Built at',
|
||||
imageInfoBaseTemplate: 'Base template',
|
||||
imageInfoRuntimeTemplate: 'Runtime template',
|
||||
imageInfoUsingBase: 'No skills are installed yet. Sessions boot from the selected runtime template.',
|
||||
imageInfoEmpty: 'Using the base template',
|
||||
skillView: 'View',
|
||||
imageInfoUnset: 'Not set',
|
||||
skillTranscript: 'View install run',
|
||||
skillTranscriptTitle: 'Install run',
|
||||
skillTranscriptHide: 'Hide install run',
|
||||
skillTranscriptEmpty: 'This install left no transcript.',
|
||||
skillTranscriptWaiting: 'Install has started. Waiting for the process log…',
|
||||
|
|
|
|||
|
|
@ -4897,8 +4897,10 @@ export default {
|
|||
parserEngine: '파싱 엔진',
|
||||
storageEngine: '스토리지 엔진',
|
||||
sandbox: {
|
||||
title: 'Sandbox Backend',
|
||||
description: 'Manage the sandbox runtimes used by agent skills. Each agent can select one workspace backend.',
|
||||
title: '스킬 샌드박스',
|
||||
description: '에이전트 스킬 스크립트의 격리 실행 환경을 관리합니다. 각 에이전트는 워크스페이스 설정을 하나 선택할 수 있습니다.',
|
||||
pageHintTitle: '스킬 샌드박스란?',
|
||||
pageHint: '스킬 샌드박스는 에이전트 스킬 스크립트가 실행되는 격리 환경입니다. 워크스페이스에 Docker, E2B, CubeSandbox 또는 로컬 프로세스 설정을 여러 개 둘 수 있고, 각 에이전트가 하나를 선택합니다. 선택하지 않으면 스크립트는 실행되지 않습니다.',
|
||||
editorDescription: 'Configure a workspace runtime. Docker, Local process, CubeSandbox, and E2B use the same management flow.',
|
||||
stepConnection: 'Connect',
|
||||
stepTemplate: 'Template',
|
||||
|
|
@ -4916,7 +4918,7 @@ export default {
|
|||
connectAndContinue: 'Connect and continue',
|
||||
loading: 'Loading sandbox configuration...',
|
||||
loadFailed: 'Failed to load sandbox configuration',
|
||||
backend: 'Sandbox backend',
|
||||
backend: '샌드박스',
|
||||
backendType: '샌드박스 유형',
|
||||
backendTypePlaceholder: '샌드박스 유형 선택',
|
||||
scriptPolicyLabel: '샌드박스에서 스킬 스크립트 실행 허용',
|
||||
|
|
@ -4927,22 +4929,22 @@ export default {
|
|||
docker: '이 WeKnora 호스트의 Docker에서 세션마다 장수명 컨테이너를 유지합니다. 스크립트와 파일이 같은 컨테이너에 남습니다',
|
||||
local: 'Run scripts directly in the WeKnora server process environment',
|
||||
},
|
||||
addConfig: 'Add sandbox backend',
|
||||
addConfig: '샌드박스 추가',
|
||||
viewClusterGuide: 'Cluster setup guide',
|
||||
configName: 'Config name',
|
||||
configNamePlaceholder: 'e.g. Production E2B',
|
||||
configNameRequired: 'Please enter a config name',
|
||||
configDescription: 'Description',
|
||||
configDescriptionPlaceholder: 'Optional, helps tell several configs of the same type apart',
|
||||
createTitle: 'Add sandbox backend',
|
||||
editTitle: 'Edit sandbox backend',
|
||||
createTitle: '샌드박스 추가',
|
||||
editTitle: '샌드박스 편집',
|
||||
sectionBasic: 'Basic information',
|
||||
sectionConnection: 'Cluster connection',
|
||||
sectionRuntimeEnvironment: 'Runtime environment',
|
||||
sectionTemplate: 'Runtime template',
|
||||
sectionRuntime: 'Execution settings',
|
||||
sectionEnvironment: 'Environment variables',
|
||||
noConfigs: 'No sandbox backend yet. Agents without a workspace configuration will not run skill scripts.',
|
||||
noConfigs: '아직 샌드박스가 없습니다. 워크스페이스 설정을 선택하지 않은 에이전트는 스킬 스크립트를 실행하지 않습니다.',
|
||||
identityFieldHint: 'While this config owns sandboxes, these cannot be changed: backend type, API endpoint, API key, sandbox domain, proxy endpoint.',
|
||||
viewSandboxes: 'View sandbox usage',
|
||||
inventoryTitle: 'Sandbox usage',
|
||||
|
|
@ -4957,8 +4959,8 @@ export default {
|
|||
unverifiableSaveHint: 'Restore connectivity first; if the backend is gone for good, create a second config and point the agents at it.',
|
||||
affectedSessions: '{count} session(s) affected.',
|
||||
affectedAgents: 'Agents using this config: {names}',
|
||||
confirmDelete: 'Delete sandbox backend "{name}"?',
|
||||
confirmDeleteWithAgents: 'Delete sandbox backend "{name}"? {agents}They will fail on their next skill execution.',
|
||||
confirmDelete: '샌드박스 "{name}"을(를) 삭제할까요?',
|
||||
confirmDeleteWithAgents: '샌드박스 "{name}"을(를) 삭제할까요? {agents}다음 스킬 실행에서 실패합니다.',
|
||||
deleteFailed: 'Failed to delete',
|
||||
deleted: 'Deleted',
|
||||
forceDeleteTitle: 'Sandbox usage cannot be verified',
|
||||
|
|
@ -5070,12 +5072,13 @@ export default {
|
|||
addRow: 'Add variable',
|
||||
removeRow: 'Remove',
|
||||
save: 'Save',
|
||||
saveAndContinue: '저장 후 계속',
|
||||
saved: 'Saved. Applies to new sessions.',
|
||||
saveFailed: 'Failed to save',
|
||||
testConnection: 'Test connection',
|
||||
deepCheck: 'Full verification',
|
||||
recheck: '다시 검증',
|
||||
deepCheckIntro: '저장하기 전에 전체 검증을 한 번 실행할 수 있습니다. 임시 샌드박스를 만들어 스크립트를 실행하고 외부 통신까지 확인한 뒤 삭제합니다.',
|
||||
deepCheckIntro: '전체 검증은 임시 샌드박스를 만들어 스크립트를 실행하고 외부 통신까지 확인한 뒤 삭제합니다.',
|
||||
deepCheckConfirm: 'Full verification runs a throwaway script. Remote backends also create and destroy a real sandbox and may consume a small amount of sandbox time. Continue?',
|
||||
checkPassed: 'All checks passed',
|
||||
checkFailed: 'Some checks failed',
|
||||
|
|
@ -5099,7 +5102,9 @@ export default {
|
|||
sandbox_exec: 'In-sandbox execution',
|
||||
egress_available: 'Outbound network',
|
||||
},
|
||||
manageSkills: 'Manage skills',
|
||||
manageSkills: '스킬 관리',
|
||||
cardSkillsNone: '아직 설치된 스킬이 없습니다',
|
||||
cardSkillsMore: '+{count}',
|
||||
skillInstallerModel: 'Installer model',
|
||||
skillInstallerModelHint: 'Used by the built-in installer agent. Choose a chat model that supports tool calls.',
|
||||
skillInstallerModelRequired: 'Select an installer model first',
|
||||
|
|
@ -5109,6 +5114,8 @@ export default {
|
|||
skillRolloutNextTurn: '이미 열린 세션은 다음 대화 턴에서 샌드박스를 다시 만듭니다',
|
||||
skillRolloutNewSession: '이미 열린 세션은 기존 샌드박스를 유지하고, 새 세션만 새 이미지를 사용합니다',
|
||||
skillRolloutSaveFailed: '적용 방식 저장에 실패했습니다',
|
||||
skillInstallGroup: '새 스킬 설치',
|
||||
skillInstalledGroup: '설치됨',
|
||||
skillUploadClick: 'Click to upload a skill bundle',
|
||||
skillUploadDrag: 'or drop a .zip file here',
|
||||
skillUploadHint: '업로드하면 현재 이미지에 스킬을 설치하고 새 스냅샷을 만듭니다. 몇 분이 걸릴 수 있습니다. 현재 대화 턴은 중단되지 않으며, 이미 열린 세션은 다음 턴에서 새 이미지로 샌드박스를 다시 만들고 그때 세션 작업 공간 초안이 지워집니다.',
|
||||
|
|
@ -5129,9 +5136,12 @@ export default {
|
|||
imageInfoGeneration: 'Version',
|
||||
imageInfoBuiltAt: 'Built at',
|
||||
imageInfoBaseTemplate: 'Base template',
|
||||
imageInfoRuntimeTemplate: '런타임 템플릿',
|
||||
imageInfoUsingBase: '아직 설치된 스킬이 없습니다. 세션은 선택한 런타임 템플릿으로 시작됩니다.',
|
||||
imageInfoEmpty: 'Using the base template',
|
||||
skillView: 'View',
|
||||
imageInfoUnset: '설정되지 않음',
|
||||
skillTranscript: 'View install run',
|
||||
skillTranscriptTitle: '설치 과정',
|
||||
skillTranscriptHide: 'Hide install run',
|
||||
skillTranscriptEmpty: 'This install left no transcript.',
|
||||
skillTranscriptWaiting: 'Install has started. Waiting for the process log…',
|
||||
|
|
@ -5542,15 +5552,15 @@ export default {
|
|||
selectSkills: 'Skills 선택',
|
||||
selectSkillsDesc: '활성화할 Skills 선택',
|
||||
noSkillsAvailable: '사전 설치된 Skills가 없습니다',
|
||||
sandboxConfig: 'Sandbox backend',
|
||||
sandboxConfigDesc: 'Choose which sandbox backend this agent\'s skill scripts execute in.',
|
||||
sandboxBackend: 'Sandbox backend',
|
||||
sandboxBackendDefault: 'Disable sandbox',
|
||||
sandboxBackendHint: 'Only applies while skill execution is enabled. If the selected config is deleted, this agent\'s skill execution will fail.',
|
||||
sandboxBackendMissing: 'Config deleted',
|
||||
sandboxNoConfigs: 'This workspace has no sandbox backend yet, so skill scripts will not run. Add one under Settings - Sandbox Backend.',
|
||||
sandboxInfoTitle: 'Why choose a backend?',
|
||||
sandboxInfoContent: 'Backends differ in account, region and quota. Once a session\'s sandbox exists, its attachments, artifacts and teardown stay pinned to the config it was created on — changing this only affects sandboxes created afterwards.',
|
||||
sandboxConfig: '스킬 샌드박스',
|
||||
sandboxConfigDesc: '이 에이전트의 스킬 스크립트가 실행될 샌드박스를 선택하세요.',
|
||||
sandboxBackend: '샌드박스 설정',
|
||||
sandboxBackendDefault: '샌드박스 사용 안 함',
|
||||
sandboxBackendHint: '스킬 실행이 켜져 있을 때만 적용됩니다. 선택한 설정이 삭제되면 이 에이전트의 스킬 실행이 실패합니다.',
|
||||
sandboxBackendMissing: '설정이 삭제됨',
|
||||
sandboxNoConfigs: '이 워크스페이스에 샌드박스가 없어 스킬 스크립트가 실행되지 않습니다. 설정 - 스킬 샌드박스에서 추가하세요.',
|
||||
sandboxInfoTitle: '왜 설정을 고르나요?',
|
||||
sandboxInfoContent: '설정마다 계정, 리전, 할당량이 다릅니다. 세션의 샌드박스가 한 번 만들어지면 첨부 파일, 산출물, 회수는 그 설정에 고정됩니다. 여기서 바꾸면 이후에 새로 만들어지는 샌드박스에만 영향을 줍니다.',
|
||||
skillsInfoTitle: 'Skills란 무엇인가요?',
|
||||
skillsInfoContent: 'Skills는 Agent에 특정 도메인의 지침, 워크플로 및 도구 지원을 제공하는 사전 설치된 전문 지식 모듈입니다. 활성화되면 Agent는 필요할 때 자동으로 관련 지식을 로드합니다.'
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4897,8 +4897,10 @@ export default {
|
|||
parserEngine: 'Движок парсинга',
|
||||
storageEngine: 'Движок хранения',
|
||||
sandbox: {
|
||||
title: 'Sandbox Backend',
|
||||
description: 'Manage the sandbox runtimes used by agent skills. Each agent can select one workspace backend.',
|
||||
title: 'Песочница навыков',
|
||||
description: 'Управление изолированными средами для скриптов навыков агента. Каждый агент может выбрать одну конфигурацию пространства.',
|
||||
pageHintTitle: 'Что такое песочница навыков?',
|
||||
pageHint: 'Песочница навыков — изолированная среда, в которой выполняются скрипты навыков агента. В пространстве можно создать несколько конфигураций (Docker, E2B, CubeSandbox или локальный процесс); каждый агент выбирает одну. Пока конфигурация не выбрана, скрипты не выполняются.',
|
||||
editorDescription: 'Configure a workspace runtime. Docker, Local process, CubeSandbox, and E2B use the same management flow.',
|
||||
stepConnection: 'Connect',
|
||||
stepTemplate: 'Template',
|
||||
|
|
@ -4916,7 +4918,7 @@ export default {
|
|||
connectAndContinue: 'Connect and continue',
|
||||
loading: 'Loading sandbox configuration...',
|
||||
loadFailed: 'Failed to load sandbox configuration',
|
||||
backend: 'Sandbox backend',
|
||||
backend: 'Песочница',
|
||||
backendType: 'Тип песочницы',
|
||||
backendTypePlaceholder: 'Выберите тип песочницы',
|
||||
scriptPolicyLabel: 'Разрешить выполнение скриптов навыков в песочницах',
|
||||
|
|
@ -4927,22 +4929,22 @@ export default {
|
|||
docker: 'Держит долгоживущий контейнер на каждую сессию на этом хосте WeKnora; скрипты и файлы остаются в том же контейнере',
|
||||
local: 'Run scripts directly in the WeKnora server process environment',
|
||||
},
|
||||
addConfig: 'Add sandbox backend',
|
||||
addConfig: 'Добавить песочницу',
|
||||
viewClusterGuide: 'Cluster setup guide',
|
||||
configName: 'Config name',
|
||||
configNamePlaceholder: 'e.g. Production E2B',
|
||||
configNameRequired: 'Please enter a config name',
|
||||
configDescription: 'Description',
|
||||
configDescriptionPlaceholder: 'Optional, helps tell several configs of the same type apart',
|
||||
createTitle: 'Add sandbox backend',
|
||||
editTitle: 'Edit sandbox backend',
|
||||
createTitle: 'Добавить песочницу',
|
||||
editTitle: 'Изменить песочницу',
|
||||
sectionBasic: 'Basic information',
|
||||
sectionConnection: 'Cluster connection',
|
||||
sectionRuntimeEnvironment: 'Runtime environment',
|
||||
sectionTemplate: 'Runtime template',
|
||||
sectionRuntime: 'Execution settings',
|
||||
sectionEnvironment: 'Environment variables',
|
||||
noConfigs: 'No sandbox backend yet. Agents without a workspace configuration will not run skill scripts.',
|
||||
noConfigs: 'Песочниц пока нет. Агенты без конфигурации пространства не выполняют скрипты навыков.',
|
||||
identityFieldHint: 'While this config owns sandboxes, these cannot be changed: backend type, API endpoint, API key, sandbox domain, proxy endpoint.',
|
||||
viewSandboxes: 'View sandbox usage',
|
||||
inventoryTitle: 'Sandbox usage',
|
||||
|
|
@ -4957,8 +4959,8 @@ export default {
|
|||
unverifiableSaveHint: 'Restore connectivity first; if the backend is gone for good, create a second config and point the agents at it.',
|
||||
affectedSessions: '{count} session(s) affected.',
|
||||
affectedAgents: 'Agents using this config: {names}',
|
||||
confirmDelete: 'Delete sandbox backend "{name}"?',
|
||||
confirmDeleteWithAgents: 'Delete sandbox backend "{name}"? {agents}They will fail on their next skill execution.',
|
||||
confirmDelete: 'Удалить песочницу «{name}»?',
|
||||
confirmDeleteWithAgents: 'Удалить песочницу «{name}»? {agents}При следующем выполнении навыка они завершатся ошибкой.',
|
||||
deleteFailed: 'Failed to delete',
|
||||
deleted: 'Deleted',
|
||||
forceDeleteTitle: 'Sandbox usage cannot be verified',
|
||||
|
|
@ -5070,12 +5072,13 @@ export default {
|
|||
addRow: 'Add variable',
|
||||
removeRow: 'Remove',
|
||||
save: 'Save',
|
||||
saveAndContinue: 'Сохранить и продолжить',
|
||||
saved: 'Saved. Applies to new sessions.',
|
||||
saveFailed: 'Failed to save',
|
||||
testConnection: 'Test connection',
|
||||
deepCheck: 'Full verification',
|
||||
recheck: 'Проверить снова',
|
||||
deepCheckIntro: 'Перед сохранением можно выполнить полную проверку: она создаёт временную песочницу, запускает скрипт, проверяет исходящую сеть и удаляет её.',
|
||||
deepCheckIntro: 'Полная проверка создаёт временную песочницу, запускает скрипт, проверяет исходящую сеть и удаляет её.',
|
||||
deepCheckConfirm: 'Full verification runs a throwaway script. Remote backends also create and destroy a real sandbox and may consume a small amount of sandbox time. Continue?',
|
||||
checkPassed: 'All checks passed',
|
||||
checkFailed: 'Some checks failed',
|
||||
|
|
@ -5099,7 +5102,9 @@ export default {
|
|||
sandbox_exec: 'In-sandbox execution',
|
||||
egress_available: 'Outbound network',
|
||||
},
|
||||
manageSkills: 'Manage skills',
|
||||
manageSkills: 'Управление навыками',
|
||||
cardSkillsNone: 'Навыки ещё не установлены',
|
||||
cardSkillsMore: '+{count}',
|
||||
skillInstallerModel: 'Installer model',
|
||||
skillInstallerModelHint: 'Used by the built-in installer agent. Choose a chat model that supports tool calls.',
|
||||
skillInstallerModelRequired: 'Select an installer model first',
|
||||
|
|
@ -5109,6 +5114,8 @@ export default {
|
|||
skillRolloutNextTurn: 'Пересоздать песочницу открытых сессий на следующем ходе диалога',
|
||||
skillRolloutNewSession: 'Оставить открытые сессии на текущей песочнице; новый образ только у новых сессий',
|
||||
skillRolloutSaveFailed: 'Не удалось сохранить способ применения',
|
||||
skillInstallGroup: 'Установить навык',
|
||||
skillInstalledGroup: 'Установленные',
|
||||
skillUploadClick: 'Click to upload a skill bundle',
|
||||
skillUploadDrag: 'or drop a .zip file here',
|
||||
skillUploadHint: 'Загрузка устанавливает навык в текущий образ и создаёт новый снимок. Это может занять несколько минут. Текущий ход диалога не прерывается; открытые сессии пересоздадут песочницу при следующем сообщении, и тогда черновики рабочей области сессии будут очищены.',
|
||||
|
|
@ -5129,9 +5136,12 @@ export default {
|
|||
imageInfoGeneration: 'Version',
|
||||
imageInfoBuiltAt: 'Built at',
|
||||
imageInfoBaseTemplate: 'Base template',
|
||||
imageInfoRuntimeTemplate: 'Шаблон среды',
|
||||
imageInfoUsingBase: 'Навыки ещё не установлены. Сессии запускаются с выбранного шаблона среды.',
|
||||
imageInfoEmpty: 'Using the base template',
|
||||
skillView: 'View',
|
||||
imageInfoUnset: 'Не задано',
|
||||
skillTranscript: 'View install run',
|
||||
skillTranscriptTitle: 'Ход установки',
|
||||
skillTranscriptHide: 'Hide install run',
|
||||
skillTranscriptEmpty: 'This install left no transcript.',
|
||||
skillTranscriptWaiting: 'Install has started. Waiting for the process log…',
|
||||
|
|
@ -5542,15 +5552,15 @@ export default {
|
|||
selectSkills: 'Выбрать Skills',
|
||||
selectSkillsDesc: 'Выберите Skills для активации',
|
||||
noSkillsAvailable: 'Нет доступных предустановленных Skills',
|
||||
sandboxConfig: 'Sandbox backend',
|
||||
sandboxConfigDesc: 'Choose which sandbox backend this agent\'s skill scripts execute in.',
|
||||
sandboxBackend: 'Sandbox backend',
|
||||
sandboxBackendDefault: 'Disable sandbox',
|
||||
sandboxBackendHint: 'Only applies while skill execution is enabled. If the selected config is deleted, this agent\'s skill execution will fail.',
|
||||
sandboxBackendMissing: 'Config deleted',
|
||||
sandboxNoConfigs: 'This workspace has no sandbox backend yet, so skill scripts will not run. Add one under Settings - Sandbox Backend.',
|
||||
sandboxInfoTitle: 'Why choose a backend?',
|
||||
sandboxInfoContent: 'Backends differ in account, region and quota. Once a session\'s sandbox exists, its attachments, artifacts and teardown stay pinned to the config it was created on — changing this only affects sandboxes created afterwards.',
|
||||
sandboxConfig: 'Песочница навыков',
|
||||
sandboxConfigDesc: 'Выберите песочницу, в которой будут выполняться скрипты навыков этого агента.',
|
||||
sandboxBackend: 'Конфигурация песочницы',
|
||||
sandboxBackendDefault: 'Не использовать песочницу',
|
||||
sandboxBackendHint: 'Действует только при включённом выполнении навыков. Если выбранная конфигурация будет удалена, выполнение навыков этого агента завершится ошибкой.',
|
||||
sandboxBackendMissing: 'Конфигурация удалена',
|
||||
sandboxNoConfigs: 'В этом пространстве ещё нет песочницы, поэтому скрипты навыков не будут выполняться. Добавьте её в «Настройки — Песочница навыков».',
|
||||
sandboxInfoTitle: 'Зачем выбирать конфигурацию?',
|
||||
sandboxInfoContent: 'Конфигурации отличаются аккаунтом, регионом и квотой. Когда песочница сессии уже создана, вложения, артефакты и удаление остаются привязаны к той конфигурации. Изменение здесь влияет только на песочницы, созданные позже.',
|
||||
skillsInfoTitle: 'Что такое Skills?',
|
||||
skillsInfoContent: 'Skills — это предустановленные модули профессиональных знаний, которые предоставляют агенту инструкции, рабочие процессы и инструменты для конкретных областей. При активации агент автоматически загружает соответствующие знания по мере необходимости.'
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4899,8 +4899,10 @@ export default {
|
|||
parserEngine: '解析引擎',
|
||||
storageEngine: '存储引擎',
|
||||
sandbox: {
|
||||
title: '沙箱后端',
|
||||
description: '管理智能体技能使用的沙箱运行环境,每个智能体可以选择一份空间后端配置。',
|
||||
title: '技能沙箱',
|
||||
description: '管理智能体技能脚本的隔离运行环境,每个智能体可以选择一份空间配置。',
|
||||
pageHintTitle: '什么是技能沙箱?',
|
||||
pageHint: '技能沙箱是智能体执行技能脚本的隔离环境。一个空间可以添加多份配置(Docker、E2B、CubeSandbox 或本地进程),每个智能体选择一份;未选择时不会执行技能脚本。',
|
||||
editorDescription: '配置空间运行环境,Docker、本地进程、CubeSandbox 和 E2B 使用同一套管理流程。',
|
||||
stepConnection: '连接',
|
||||
stepTemplate: '模板',
|
||||
|
|
@ -4918,7 +4920,7 @@ export default {
|
|||
connectAndContinue: '连接并继续',
|
||||
loading: '加载沙箱配置...',
|
||||
loadFailed: '加载沙箱配置失败',
|
||||
backend: '沙箱后端',
|
||||
backend: '沙箱',
|
||||
backendType: '沙箱类型',
|
||||
backendTypePlaceholder: '选择沙箱类型',
|
||||
scriptPolicyLabel: '允许在沙箱中执行技能脚本',
|
||||
|
|
@ -4929,22 +4931,22 @@ export default {
|
|||
docker: '在本机 Docker 上为每个会话保留一个长驻容器,脚本和文件都落在同一容器里',
|
||||
local: '直接在 WeKnora 服务进程所在环境执行脚本',
|
||||
},
|
||||
addConfig: '添加沙箱后端',
|
||||
addConfig: '添加沙箱',
|
||||
viewClusterGuide: '集群搭建指南',
|
||||
configName: '配置名称',
|
||||
configNamePlaceholder: '如:生产 E2B',
|
||||
configNameRequired: '请填写配置名称',
|
||||
configDescription: '描述',
|
||||
configDescriptionPlaceholder: '选填,用于区分多份同类型配置',
|
||||
createTitle: '添加沙箱后端',
|
||||
editTitle: '编辑沙箱后端',
|
||||
createTitle: '添加沙箱',
|
||||
editTitle: '编辑沙箱',
|
||||
sectionBasic: '基本信息',
|
||||
sectionConnection: '集群连接',
|
||||
sectionRuntimeEnvironment: '运行环境',
|
||||
sectionTemplate: '运行模板',
|
||||
sectionRuntime: '执行设置',
|
||||
sectionEnvironment: '环境变量',
|
||||
noConfigs: '还没有沙箱后端配置。智能体未选择空间配置时不会执行技能脚本。',
|
||||
noConfigs: '还没有沙箱配置。智能体未选择空间配置时不会执行技能脚本。',
|
||||
identityFieldHint: '该配置下有沙箱运行时,以下项无法修改:后端类型、API 端点、API Key、沙箱域名、Proxy 端点。',
|
||||
viewSandboxes: '查看沙箱占用',
|
||||
inventoryTitle: '沙箱占用',
|
||||
|
|
@ -4959,20 +4961,20 @@ export default {
|
|||
unverifiableSaveHint: '请先恢复该后端的连通性;若已废弃,可新建一份配置并把智能体指过去。',
|
||||
affectedSessions: '影响 {count} 个会话。',
|
||||
affectedAgents: '以下智能体正在使用该配置:{names}',
|
||||
confirmDelete: '确定删除沙箱后端「{name}」吗?',
|
||||
confirmDeleteWithAgents: '确定删除沙箱后端「{name}」吗?{agents}它们将在下次执行技能时报错。',
|
||||
confirmDelete: '确定删除沙箱「{name}」吗?',
|
||||
confirmDeleteWithAgents: '确定删除沙箱「{name}」吗?{agents}它们将在下次执行技能时报错。',
|
||||
deleteFailed: '删除失败',
|
||||
deleted: '已删除',
|
||||
forceDeleteTitle: '无法核实沙箱占用',
|
||||
forceDeleteConfirm: '无法连接该后端核实是否仍有沙箱。若该后端已废弃,可强制删除这份配置;若只是暂时不可达,强制删除会让残留沙箱无人回收。仍要强制删除吗?',
|
||||
forceDelete: '强制删除',
|
||||
disableScripts: '禁用沙盒执行',
|
||||
enableScripts: '启用沙盒执行',
|
||||
disableScripts: '禁用沙箱执行',
|
||||
enableScripts: '启用沙箱执行',
|
||||
disableScriptsConfirm:
|
||||
'禁用后,本空间内所有智能体将无法在沙盒中执行技能脚本;仍可阅读技能内容。已在运行中的远端沙盒不会自动销毁,需结束或删除相关会话后才会释放。是否继续?',
|
||||
scriptsDisabled: '已禁用本空间沙盒执行',
|
||||
scriptsEnabled: '已恢复本空间沙盒执行',
|
||||
policySaveFailed: '更新沙盒执行策略失败',
|
||||
'禁用后,本空间内所有智能体将无法在沙箱中执行技能脚本;仍可阅读技能内容。已在运行中的远端沙箱不会自动销毁,需结束或删除相关会话后才会释放。是否继续?',
|
||||
scriptsDisabled: '已禁用本空间沙箱执行',
|
||||
scriptsEnabled: '已恢复本空间沙箱执行',
|
||||
policySaveFailed: '更新沙箱执行策略失败',
|
||||
legacyConfig: '已废弃',
|
||||
namedBackendHint: '空间配置是唯一运行时来源;智能体没有选择配置时不会执行技能脚本。',
|
||||
weknoraTemplateTitle: 'WeKnora 标准模板',
|
||||
|
|
@ -5045,7 +5047,7 @@ export default {
|
|||
apiKey: 'API Key',
|
||||
templateId: '模板 ID',
|
||||
httpTimeout: 'HTTP 超时(秒)',
|
||||
httpTimeoutHelp: '调用沙箱后端管理接口的等待上限,超过即视为端点不可用。留空按 30 秒。',
|
||||
httpTimeoutHelp: '调用沙箱管理接口的等待上限,超过即视为端点不可用。留空按 30 秒。',
|
||||
sandboxTtl: '沙箱 TTL(秒)',
|
||||
sandboxTtlHelp: '沙箱空闲多久后被远端回收。设得太短,会话继续时要重建沙箱;设得太长,闲置实例会一直计费。留空按后端默认值。',
|
||||
dockerImage: 'Docker 镜像',
|
||||
|
|
@ -5072,12 +5074,13 @@ export default {
|
|||
addRow: '添加变量',
|
||||
removeRow: '删除',
|
||||
save: '保存',
|
||||
saveAndContinue: '保存并继续',
|
||||
saved: '已保存,对新建会话生效',
|
||||
saveFailed: '保存失败',
|
||||
testConnection: '测试连接',
|
||||
deepCheck: '完整验证',
|
||||
recheck: '重新验证',
|
||||
deepCheckIntro: '保存前可以跑一次「完整验证」:真实创建一个临时沙箱、执行一次脚本并检查出网,随后自动销毁。',
|
||||
deepCheckIntro: '完整验证会真实创建一个临时沙箱、执行一次脚本并检查出网,随后自动销毁。',
|
||||
deepCheckConfirm: '完整验证会执行一次临时脚本;远端后端还会真实创建并销毁一个沙箱,可能消耗少量沙箱时长。是否继续?',
|
||||
checkPassed: '检测通过',
|
||||
checkFailed: '检测未通过',
|
||||
|
|
@ -5102,19 +5105,23 @@ export default {
|
|||
egress_available: '出网可用',
|
||||
},
|
||||
manageSkills: '管理技能',
|
||||
cardSkillsNone: '尚未安装技能',
|
||||
cardSkillsMore: '+{count}',
|
||||
skillInstallerModel: '安装模型',
|
||||
skillInstallerModelHint: '安装技能时由内置安装智能体调用。请选择支持工具调用的对话模型。',
|
||||
skillInstallerModelRequired: '请先选择安装模型',
|
||||
skillInstallerModelSaveFailed: '保存安装模型失败',
|
||||
skillRollout: '技能镜像如何生效',
|
||||
skillRolloutHint: '安装或删除技能会生成新镜像。这里决定已经打开的会话要不要换到新镜像。',
|
||||
skillRolloutNextTurn: '已有会话在下一轮提问时重建沙盒',
|
||||
skillRolloutNewSession: '已有会话保持原沙盒,仅新会话使用新镜像',
|
||||
skillRolloutNextTurn: '已有会话在下一轮提问时重建沙箱',
|
||||
skillRolloutNewSession: '已有会话保持原沙箱,仅新会话使用新镜像',
|
||||
skillRolloutSaveFailed: '保存生效方式失败',
|
||||
skillInstallGroup: '安装新技能',
|
||||
skillInstalledGroup: '已安装',
|
||||
skillUploadClick: '点击上传技能压缩包',
|
||||
skillUploadDrag: '或将 .zip 拖到此处',
|
||||
skillUploadHint: '上传后会在当前镜像上安装该技能并生成新快照,可能需要数分钟。当前这一轮对话不会中断;下一轮提问时才会按新镜像重建沙盒,会话工作区草稿会在那时清空。',
|
||||
skillUploadHintNewSession: '上传后会在当前镜像上安装该技能并生成新快照,可能需要数分钟。已打开的会话继续使用原沙盒,直到该会话结束;只有新打开的会话才会带上这次安装的技能。',
|
||||
skillUploadHint: '上传后会在当前镜像上安装该技能并生成新快照,可能需要数分钟。当前这一轮对话不会中断;下一轮提问时才会按新镜像重建沙箱,会话工作区草稿会在那时清空。',
|
||||
skillUploadHintNewSession: '上传后会在当前镜像上安装该技能并生成新快照,可能需要数分钟。已打开的会话继续使用原沙箱,直到该会话结束;只有新打开的会话才会带上这次安装的技能。',
|
||||
skillUploadFailed: '技能上传失败',
|
||||
skillUploading: '正在上传 {percent}%',
|
||||
skillUploadAccepted: '已开始安装技能',
|
||||
|
|
@ -5124,16 +5131,19 @@ export default {
|
|||
skillStatusRemoving: '删除中',
|
||||
skillStatusLabel: '状态',
|
||||
skillDisableHint: '禁用后该技能对智能体不可见,文件仍保留在镜像中。变更将在会话下一次执行时生效。',
|
||||
skillDeleteHint: '删除会从镜像中移除该技能目录并生成新快照。当前这一轮对话不会中断;下一轮提问时才会按新镜像重建沙盒,会话工作区草稿会在那时清空。',
|
||||
skillDeleteHintNewSession: '删除会从镜像中移除该技能目录并生成新快照。已打开的会话继续使用原沙盒,直到该会话结束;只有新打开的会话才会去掉该技能。',
|
||||
skillDeleteHint: '删除会从镜像中移除该技能目录并生成新快照。当前这一轮对话不会中断;下一轮提问时才会按新镜像重建沙箱,会话工作区草稿会在那时清空。',
|
||||
skillDeleteHintNewSession: '删除会从镜像中移除该技能目录并生成新快照。已打开的会话继续使用原沙箱,直到该会话结束;只有新打开的会话才会去掉该技能。',
|
||||
imageInfoTitle: '当前镜像',
|
||||
imageInfoSnapshot: '快照 ID',
|
||||
imageInfoGeneration: '版本',
|
||||
imageInfoBuiltAt: '构建时间',
|
||||
imageInfoBaseTemplate: '基础模板',
|
||||
imageInfoRuntimeTemplate: '运行模板',
|
||||
imageInfoUsingBase: '尚未安装技能,会话使用所选运行模板启动。',
|
||||
imageInfoEmpty: '使用基础模板',
|
||||
skillView: '查看',
|
||||
imageInfoUnset: '未设置',
|
||||
skillTranscript: '查看安装过程',
|
||||
skillTranscriptTitle: '安装过程',
|
||||
skillTranscriptHide: '收起安装过程',
|
||||
skillTranscriptEmpty: '这次安装没有留下记录。',
|
||||
skillTranscriptWaiting: '安装已开始,正在等待过程记录…',
|
||||
|
|
@ -5544,15 +5554,15 @@ export default {
|
|||
selectSkills: '选择 Skills',
|
||||
selectSkillsDesc: '选择要启用的 Skills',
|
||||
noSkillsAvailable: '暂无预装 Skills',
|
||||
sandboxConfig: '沙箱后端',
|
||||
sandboxConfigDesc: '选择该智能体的技能脚本在哪个沙箱后端中执行。',
|
||||
sandboxBackend: '沙箱后端',
|
||||
sandboxConfig: '技能沙箱',
|
||||
sandboxConfigDesc: '选择该智能体的技能脚本在哪个沙箱中执行。',
|
||||
sandboxBackend: '沙箱配置',
|
||||
sandboxBackendDefault: '不启用沙箱',
|
||||
sandboxBackendHint: '仅在启用技能执行时生效。所选配置被删除后,该智能体的技能执行会失败。',
|
||||
sandboxBackendMissing: '配置已删除',
|
||||
sandboxNoConfigs: '当前空间还没有沙箱后端配置,技能脚本不会执行。可在「设置 - 沙箱后端」中添加。',
|
||||
sandboxInfoTitle: '为什么要选后端?',
|
||||
sandboxInfoContent: '不同后端对应不同的账号、区域与配额。同一会话的沙箱一旦创建,后续的附件、产物与销毁都会锁定在创建时那份配置上,改这里只影响之后新建的沙箱。',
|
||||
sandboxNoConfigs: '当前空间还没有沙箱配置,技能脚本不会执行。可在「设置 - 技能沙箱」中添加。',
|
||||
sandboxInfoTitle: '为什么要选配置?',
|
||||
sandboxInfoContent: '不同配置对应不同的账号、区域与配额。同一会话的沙箱一旦创建,后续的附件、产物与销毁都会锁定在创建时那份配置上,改这里只影响之后新建的沙箱。',
|
||||
skillsInfoTitle: '什么是 Skills?',
|
||||
skillsInfoContent: 'Skills 是预装的专业知识模块,可以为 Agent 提供特定领域的指令、工作流程和工具支持。启用 Skills 后,Agent 会在需要时自动加载相关知识。'
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1321,7 +1321,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 沙箱后端配置(仅 Agent 模式):技能脚本的运行环境 -->
|
||||
<!-- 技能沙箱(仅 Agent 模式):技能脚本的运行环境 -->
|
||||
<div v-show="currentSection === 'sandbox' && isAgentMode" class="section">
|
||||
<div class="section-header">
|
||||
<h2>{{ $t('agent.editor.sandboxConfig') }}</h2>
|
||||
|
|
@ -1352,7 +1352,7 @@
|
|||
</div>
|
||||
|
||||
<div class="skill-info-box">
|
||||
<t-icon name="cloud" class="info-icon" />
|
||||
<t-icon name="code" class="info-icon" />
|
||||
<div class="info-content">
|
||||
<p><strong>{{ $t('agent.editor.sandboxInfoTitle') }}</strong></p>
|
||||
<p>{{ $t('agent.editor.sandboxInfoContent') }}</p>
|
||||
|
|
@ -2323,7 +2323,7 @@ const navItems = computed(() => {
|
|||
items.push({ key: 'tools', icon: 'tools', label: t('agent.editor.toolsConfig') });
|
||||
items.push({ key: 'mcp', icon: 'server', label: t('agentEditor.mcp.label') });
|
||||
items.push({ key: 'skills', icon: 'lightbulb', label: t('agent.editor.skillsConfig') });
|
||||
items.push({ key: 'sandbox', icon: 'cloud', label: t('agent.editor.sandboxConfig') });
|
||||
items.push({ key: 'sandbox', icon: 'code', label: t('agent.editor.sandboxConfig') });
|
||||
}
|
||||
// 发布(仅编辑模式)
|
||||
if (editorMode.value === 'edit' && editorAgent.value?.id && !editorAgent.value?.is_builtin && !authStore.isLiteMode) {
|
||||
|
|
|
|||
|
|
@ -5,21 +5,15 @@
|
|||
<div>
|
||||
<div class="section-header__titlewrap">
|
||||
<h2>{{ $t('settings.sandbox.title') }}</h2>
|
||||
<!--
|
||||
The standard-template explainer used to be a permanent note block
|
||||
above the list, where it pushed the actual configs below the fold.
|
||||
It is reference material, so it belongs behind the title's hint.
|
||||
-->
|
||||
<t-popup placement="bottom-start" trigger="hover" :overlay-inner-style="{ maxWidth: '380px' }">
|
||||
<button type="button" class="hint-trigger"
|
||||
:aria-label="$t('settings.sandbox.weknoraTemplateTitle')">
|
||||
:aria-label="$t('settings.sandbox.pageHintTitle')">
|
||||
<t-icon name="info-circle" size="16px" />
|
||||
</button>
|
||||
<template #content>
|
||||
<div class="hint-popover">
|
||||
<p class="hint-popover__title">{{ $t('settings.sandbox.weknoraTemplateTitle') }}</p>
|
||||
<p class="hint-popover__text">{{ $t('settings.sandbox.weknoraTemplateOverview') }}</p>
|
||||
<p class="hint-popover__text">{{ $t('settings.sandbox.namedBackendHint') }}</p>
|
||||
<p class="hint-popover__title">{{ $t('settings.sandbox.pageHintTitle') }}</p>
|
||||
<p class="hint-popover__text">{{ $t('settings.sandbox.pageHint') }}</p>
|
||||
</div>
|
||||
</template>
|
||||
</t-popup>
|
||||
|
|
@ -75,53 +69,61 @@
|
|||
:class="[`sandbox-card--${record.sandbox_type}`, { 'sandbox-card--clickable': !isLegacyRecord(record) }]"
|
||||
:role="isLegacyRecord(record) ? undefined : 'button'"
|
||||
:tabindex="isLegacyRecord(record) ? undefined : 0"
|
||||
@click="openEdit(record)" @keydown.enter="openEdit(record)">
|
||||
@click="openCard(record)" @keydown.enter="openCard(record)">
|
||||
<SandboxBackendBadge :type="record.sandbox_type" />
|
||||
<div class="sandbox-card__body">
|
||||
<div class="sandbox-card__header">
|
||||
<h3 class="sandbox-card__title">{{ record.name }}</h3>
|
||||
<h3 class="sandbox-card__title" :title="record.name">{{ record.name }}</h3>
|
||||
<t-tag v-if="isLegacyRecord(record)" theme="warning" variant="light" size="small">
|
||||
{{ $t('settings.sandbox.legacyConfig') }}
|
||||
</t-tag>
|
||||
<div class="sandbox-card__actions" @click.stop>
|
||||
<t-dropdown v-if="!isLegacyRecord(record)" :options="cardMenu(record)" trigger="click" attach="body"
|
||||
<t-dropdown :options="cardMenu(record)" trigger="click" attach="body"
|
||||
placement="bottom-right" @click="(data: any) => onMenuAction(data.value, record)">
|
||||
<t-button variant="text" shape="square" size="small" class="sandbox-card__action-btn">
|
||||
<t-button variant="text" shape="square" size="small" class="sandbox-card__more">
|
||||
<t-icon name="ellipsis" />
|
||||
</t-button>
|
||||
</t-dropdown>
|
||||
<t-popconfirm theme="warning" :content="deleteConfirmText(record)"
|
||||
:confirm-btn="{ content: $t('common.delete'), theme: 'danger' }"
|
||||
:cancel-btn="{ content: $t('common.cancel') }" placement="bottom-right"
|
||||
@visible-change="(visible: boolean) => onDeleteConfirmOpen(visible, record)"
|
||||
@confirm="removeRecord(record)">
|
||||
<t-tooltip :content="$t('common.delete')" placement="top">
|
||||
<t-button theme="danger" shape="square" variant="text" size="small"
|
||||
class="sandbox-card__action-btn" @click.stop>
|
||||
<template #icon><t-icon name="delete" /></template>
|
||||
</t-button>
|
||||
</t-tooltip>
|
||||
</t-popconfirm>
|
||||
</div>
|
||||
</div>
|
||||
<p class="sandbox-card__subtitle">
|
||||
<span>{{ backendLabel(record.sandbox_type) }}</span>
|
||||
<t-tag v-if="isLegacyRecord(record)" theme="warning" variant="light" size="small" class="legacy-tag">
|
||||
{{ $t('settings.sandbox.legacyConfig') }}
|
||||
</t-tag>
|
||||
<template v-if="targetSummary(record)">
|
||||
<div class="sandbox-card__subtitle">
|
||||
<span class="sandbox-card__type">{{ backendLabel(record.sandbox_type) }}</span>
|
||||
<template v-if="record.description">
|
||||
<span class="sandbox-card__sep">·</span>
|
||||
<span class="sandbox-card__target" :title="targetSummary(record)">{{ targetSummary(record) }}</span>
|
||||
<span class="sandbox-card__desc" :title="record.description">{{ record.description }}</span>
|
||||
</template>
|
||||
</p>
|
||||
<p v-if="record.description" class="sandbox-card__desc">{{ record.description }}</p>
|
||||
<!--
|
||||
The card used to spell out the raw template ID, which nobody can
|
||||
read or act on. What an admin needs when scanning the list is
|
||||
whether the config is complete and how it will behave at runtime.
|
||||
-->
|
||||
<ul v-if="cardFacts[record.id]?.length" class="sandbox-card__facts">
|
||||
<li v-for="fact in cardFacts[record.id]" :key="fact.key" class="sandbox-card__fact"
|
||||
:class="{ 'is-warning': fact.tone === 'warning' }" :title="fact.title">
|
||||
<t-icon :name="fact.icon" size="12px" />
|
||||
<span>{{ fact.text }}</span>
|
||||
</div>
|
||||
<div v-if="targetSummary(record)" class="sandbox-card__url" :title="targetSummary(record)">
|
||||
{{ targetSummary(record) }}
|
||||
</div>
|
||||
<div
|
||||
v-if="supportsSkills(record) && (skillsOf(record) || skillsFailed(record))"
|
||||
class="sandbox-card__skills"
|
||||
>
|
||||
<template v-if="(skillsOf(record) || []).length">
|
||||
<t-tag
|
||||
v-for="skill in visibleSkills(record)"
|
||||
:key="skill.id"
|
||||
size="small"
|
||||
variant="light"
|
||||
:theme="skillTagTheme(skill)"
|
||||
:title="skill.name"
|
||||
>{{ skill.name }}</t-tag>
|
||||
<span v-if="extraSkillCount(record)" class="sandbox-card__skills-more">
|
||||
{{ $t('settings.sandbox.cardSkillsMore', { count: extraSkillCount(record) }) }}
|
||||
</span>
|
||||
</template>
|
||||
<span v-else-if="skillsFailed(record)" class="sandbox-card__skills-empty">
|
||||
{{ $t('settings.sandbox.skillLoadFailed') }}
|
||||
</span>
|
||||
<span v-else class="sandbox-card__skills-empty">
|
||||
{{ $t('settings.sandbox.cardSkillsNone') }}
|
||||
</span>
|
||||
</div>
|
||||
<ul v-if="cardWarnings[record.id]?.length" class="sandbox-card__warnings">
|
||||
<li v-for="item in cardWarnings[record.id]" :key="item.key">
|
||||
<t-icon name="error-circle" size="12px" />
|
||||
<span>{{ item.text }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -145,7 +147,7 @@
|
|||
toast or a cramped dialog.
|
||||
-->
|
||||
<SettingDrawer v-model:visible="showInventory" :title="$t('settings.sandbox.inventoryTitle')"
|
||||
:description="$t('settings.sandbox.inventoryDrawerDesc')" icon="server"
|
||||
:description="$t('settings.sandbox.inventoryDrawerDesc')" icon="code"
|
||||
width="480px" storage-key="setting-drawer:width:sandbox-inventory" hide-footer>
|
||||
<t-loading :loading="inventoryLoading" size="small">
|
||||
<section class="setting-drawer__section">
|
||||
|
|
@ -208,20 +210,24 @@ import { useI18n } from 'vue-i18n'
|
|||
import SandboxConfigEditorDrawer from '@/components/SandboxConfigEditorDrawer.vue'
|
||||
import SandboxBackendBadge from '@/components/settings/SandboxBackendBadge.vue'
|
||||
import SettingDrawer from '@/components/settings/SettingDrawer.vue'
|
||||
import { useConfirmDelete } from '@/components/settings/useConfirmDelete'
|
||||
import {
|
||||
checkSandboxConfig,
|
||||
deleteSandboxConfig,
|
||||
getSandboxConfigInventory,
|
||||
isNamedSandboxBackend,
|
||||
listConfigSkills,
|
||||
listSandboxConfigs,
|
||||
NAMED_SANDBOX_BACKEND_TYPES,
|
||||
parseSandboxConflict,
|
||||
setSandboxWorkspacePolicy,
|
||||
type ConfigSkill,
|
||||
type SandboxConfigRecord,
|
||||
type SandboxInventory,
|
||||
} from '@/api/system'
|
||||
|
||||
const { t } = useI18n()
|
||||
const confirmDelete = useConfirmDelete()
|
||||
|
||||
const sandboxGuideUrl = 'https://github.com/Tencent/WeKnora/blob/main/docs/sandbox-cluster.md'
|
||||
|
||||
|
|
@ -232,6 +238,12 @@ const policySaving = ref(false)
|
|||
const workspaceScriptsDisabled = ref(false)
|
||||
const records = ref<SandboxConfigRecord[]>([])
|
||||
const activeType = ref<string>('all')
|
||||
// Skill names on cube/e2b cards. Missing until the per-config list returns, so
|
||||
// the empty hint does not flash on first paint. A failed fetch is tracked
|
||||
// separately so it is not shown as "no skills installed".
|
||||
const skillsByConfig = ref<Record<string, ConfigSkill[]>>({})
|
||||
const skillsLoadFailed = ref<Record<string, boolean>>({})
|
||||
const SKILL_TAG_LIMIT = 3
|
||||
|
||||
const showEditor = ref(false)
|
||||
const editingRecord = ref<SandboxConfigRecord | null>(null)
|
||||
|
|
@ -252,6 +264,34 @@ const backendLabel = (value: string) => t(`settings.sandbox.backends.${value}`)
|
|||
|
||||
const isLegacyRecord = (record: SandboxConfigRecord) => !isNamedSandboxBackend(record.sandbox_type)
|
||||
|
||||
// Skills are baked into the remote snapshot image. Docker and local configs
|
||||
// have no skills step, so their cards stay a connection summary.
|
||||
function supportsSkills(record: SandboxConfigRecord) {
|
||||
return record.sandbox_type === 'cube' || record.sandbox_type === 'e2b'
|
||||
}
|
||||
|
||||
function skillsOf(record: SandboxConfigRecord): ConfigSkill[] | undefined {
|
||||
return skillsByConfig.value[record.id]
|
||||
}
|
||||
|
||||
function skillsFailed(record: SandboxConfigRecord): boolean {
|
||||
return skillsLoadFailed.value[record.id] === true
|
||||
}
|
||||
|
||||
function visibleSkills(record: SandboxConfigRecord): ConfigSkill[] {
|
||||
return (skillsOf(record) || []).slice(0, SKILL_TAG_LIMIT)
|
||||
}
|
||||
|
||||
function extraSkillCount(record: SandboxConfigRecord): number {
|
||||
return Math.max(0, (skillsOf(record) || []).length - SKILL_TAG_LIMIT)
|
||||
}
|
||||
|
||||
function skillTagTheme(skill: ConfigSkill): 'default' | 'warning' | 'primary' {
|
||||
if (skill.status === 'failed') return 'warning'
|
||||
if (skill.status === 'installing' || skill.status === 'removing') return 'primary'
|
||||
return 'default'
|
||||
}
|
||||
|
||||
const filteredRecords = computed(() => {
|
||||
const base = activeType.value === 'all'
|
||||
? records.value
|
||||
|
|
@ -262,10 +302,13 @@ const filteredRecords = computed(() => {
|
|||
const countByType = (type: string) =>
|
||||
records.value.filter((r) => r.sandbox_type === type && isNamedSandboxBackend(r.sandbox_type)).length
|
||||
|
||||
// Legacy rows can only be deleted, and that action has its own button, so they
|
||||
// get no menu at all.
|
||||
const cardMenu = (record: SandboxConfigRecord) => {
|
||||
const options = [
|
||||
type CardMenuOption = { content: string; value: string; theme?: 'error' }
|
||||
|
||||
const cardMenu = (record: SandboxConfigRecord): CardMenuOption[] => {
|
||||
if (isLegacyRecord(record)) {
|
||||
return [{ content: t('common.delete'), value: 'delete', theme: 'error' }]
|
||||
}
|
||||
const options: CardMenuOption[] = [
|
||||
{ content: t('common.edit'), value: 'edit' },
|
||||
{ content: t('settings.sandbox.testConnection'), value: 'check' },
|
||||
]
|
||||
|
|
@ -273,6 +316,7 @@ const cardMenu = (record: SandboxConfigRecord) => {
|
|||
options.push({ content: t('settings.sandbox.viewSandboxes'), value: 'inventory' })
|
||||
options.push({ content: t('settings.sandbox.manageSkills'), value: 'skills' })
|
||||
}
|
||||
options.push({ content: t('common.delete'), value: 'delete', theme: 'error' })
|
||||
return options
|
||||
}
|
||||
|
||||
|
|
@ -326,6 +370,23 @@ function openEdit(record: SandboxConfigRecord) {
|
|||
showEditor.value = true
|
||||
}
|
||||
|
||||
function openSkills(record: SandboxConfigRecord) {
|
||||
if (isLegacyRecord(record) || !supportsSkills(record)) return
|
||||
editingRecord.value = record
|
||||
editorStep.value = 'skills'
|
||||
showEditor.value = true
|
||||
}
|
||||
|
||||
// Cube/e2b cards now lead with installed skills, so a click lands on that
|
||||
// step. Connection and runtime stay behind the card menu's edit action.
|
||||
function openCard(record: SandboxConfigRecord) {
|
||||
if (supportsSkills(record)) {
|
||||
openSkills(record)
|
||||
return
|
||||
}
|
||||
openEdit(record)
|
||||
}
|
||||
|
||||
// What this config actually points at: the remote host, the container image, or
|
||||
// the local runtime. Two configs of the same backend are told apart by it.
|
||||
function targetSummary(record: SandboxConfigRecord): string {
|
||||
|
|
@ -338,111 +399,73 @@ function targetSummary(record: SandboxConfigRecord): string {
|
|||
return endpointHost(record)
|
||||
}
|
||||
|
||||
interface CardFact {
|
||||
interface CardWarning {
|
||||
key: string
|
||||
icon: string
|
||||
text: string
|
||||
/** Full value for opaque identifiers we only summarise on the card. */
|
||||
title?: string
|
||||
tone?: 'warning'
|
||||
}
|
||||
|
||||
const REMOTE_BACKENDS = new Set(['cube', 'e2b'])
|
||||
|
||||
// Facts are derived from the config we already hold, so the list stays cheap:
|
||||
// nothing here probes a provider. Anything that would need a remote call
|
||||
// (liveness, running sandboxes) stays behind the card menu.
|
||||
const cardFacts = computed<Record<string, CardFact[]>>(() => {
|
||||
const map: Record<string, CardFact[]> = {}
|
||||
// Cards only surface blockers: healthy defaults (template present, timeout,
|
||||
// TTL, env count) belong in the editor, not on every tile. Nothing here
|
||||
// probes a provider; liveness stays behind the card menu.
|
||||
const cardWarnings = computed<Record<string, CardWarning[]>>(() => {
|
||||
const map: Record<string, CardWarning[]> = {}
|
||||
for (const record of records.value) {
|
||||
map[record.id] = buildCardFacts(record)
|
||||
map[record.id] = buildCardWarnings(record)
|
||||
}
|
||||
return map
|
||||
})
|
||||
|
||||
function buildCardFacts(record: SandboxConfigRecord): CardFact[] {
|
||||
const facts: CardFact[] = []
|
||||
function buildCardWarnings(record: SandboxConfigRecord): CardWarning[] {
|
||||
const warnings: CardWarning[] = []
|
||||
const config = record.config || {}
|
||||
const remote = config.cube || config.e2b
|
||||
|
||||
// Incomplete configs come first: they are why a skill fails at runtime.
|
||||
if (REMOTE_BACKENDS.has(record.sandbox_type)) {
|
||||
const templateID = remote?.template_id?.trim() || ''
|
||||
facts.push(templateID
|
||||
? {
|
||||
if (!remote?.template_id?.trim()) {
|
||||
warnings.push({
|
||||
key: 'template',
|
||||
icon: 'code',
|
||||
text: t('settings.sandbox.cardTemplateConfigured'),
|
||||
title: templateID,
|
||||
}
|
||||
: {
|
||||
key: 'template',
|
||||
icon: 'error-circle',
|
||||
text: t('settings.sandbox.templateNotConfigured'),
|
||||
tone: 'warning',
|
||||
})
|
||||
if (!remote?.api_key?.trim()) {
|
||||
facts.push({
|
||||
}
|
||||
// Cube API keys are optional; only E2B fails at runtime without one.
|
||||
if (record.sandbox_type === 'e2b' && !remote?.api_key?.trim()) {
|
||||
warnings.push({
|
||||
key: 'credential',
|
||||
icon: 'error-circle',
|
||||
text: t('settings.sandbox.cardCredentialMissing'),
|
||||
tone: 'warning',
|
||||
})
|
||||
}
|
||||
}
|
||||
if (record.sandbox_type === 'docker' && !config.docker?.image?.trim()) {
|
||||
facts.push({
|
||||
warnings.push({
|
||||
key: 'image',
|
||||
icon: 'error-circle',
|
||||
text: t('settings.sandbox.imageNotConfigured'),
|
||||
tone: 'warning',
|
||||
})
|
||||
}
|
||||
return warnings
|
||||
}
|
||||
|
||||
if (config.default_timeout_sec) {
|
||||
facts.push({
|
||||
key: 'timeout',
|
||||
icon: 'time',
|
||||
text: t('settings.sandbox.cardTimeout', { sec: config.default_timeout_sec }),
|
||||
})
|
||||
async function loadSkills(configs: SandboxConfigRecord[]) {
|
||||
const remotes = configs.filter(supportsSkills)
|
||||
const remoteIDs = new Set(remotes.map((record) => record.id))
|
||||
const next: Record<string, ConfigSkill[]> = {}
|
||||
for (const [id, skills] of Object.entries(skillsByConfig.value)) {
|
||||
if (remoteIDs.has(id)) next[id] = skills
|
||||
}
|
||||
const ttl = record.config?.cube?.cube_sandbox_ttl_seconds
|
||||
|| record.config?.e2b?.e2b_sandbox_ttl_seconds
|
||||
if (ttl) {
|
||||
facts.push({
|
||||
key: 'ttl',
|
||||
icon: 'hourglass',
|
||||
text: t('settings.sandbox.cardTtl', { sec: ttl }),
|
||||
})
|
||||
}
|
||||
if (config.volume_mount?.enabled) {
|
||||
facts.push({
|
||||
key: 'volume',
|
||||
icon: 'folder',
|
||||
text: config.volume_mount.volume_name?.trim()
|
||||
|| config.volume_mount.mount_path?.trim()
|
||||
|| t('settings.sandbox.cardVolumeMounted'),
|
||||
})
|
||||
}
|
||||
const envCount = Object.keys(config.env_vars || {}).length
|
||||
if (envCount) {
|
||||
facts.push({
|
||||
key: 'env',
|
||||
icon: 'code-1',
|
||||
text: t('settings.sandbox.cardEnvVars', { count: envCount }),
|
||||
})
|
||||
}
|
||||
// A config allowed to reach private addresses widens the workspace's SSRF
|
||||
// surface, so it is called out rather than buried in the form.
|
||||
if (config.allow_private_endpoints) {
|
||||
facts.push({
|
||||
key: 'private',
|
||||
icon: 'lock-on',
|
||||
text: t('settings.sandbox.cardPrivateEndpoints'),
|
||||
tone: 'warning',
|
||||
})
|
||||
}
|
||||
return facts
|
||||
const failed: Record<string, boolean> = {}
|
||||
await Promise.all(remotes.map(async (record) => {
|
||||
try {
|
||||
const res = await listConfigSkills(record.id)
|
||||
next[record.id] = (res?.data || []).filter((skill) => skill.status !== 'removed')
|
||||
} catch {
|
||||
// Keep a previous successful list. Only the first-load miss is an error
|
||||
// row; replacing it with [] would read as "no skills installed".
|
||||
if (next[record.id] === undefined) failed[record.id] = true
|
||||
}
|
||||
}))
|
||||
skillsByConfig.value = next
|
||||
skillsLoadFailed.value = failed
|
||||
}
|
||||
|
||||
async function load() {
|
||||
|
|
@ -456,6 +479,7 @@ async function load() {
|
|||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
await loadSkills(records.value)
|
||||
}
|
||||
|
||||
async function setScriptsDisabled(disabled: boolean) {
|
||||
|
|
@ -475,8 +499,7 @@ async function setScriptsDisabled(disabled: boolean) {
|
|||
|
||||
async function onMenuAction(action: string, record: SandboxConfigRecord) {
|
||||
if (action === 'edit') {
|
||||
editingRecord.value = record
|
||||
showEditor.value = true
|
||||
openEdit(record)
|
||||
return
|
||||
}
|
||||
if (action === 'check') {
|
||||
|
|
@ -488,10 +511,20 @@ async function onMenuAction(action: string, record: SandboxConfigRecord) {
|
|||
return
|
||||
}
|
||||
if (action === 'skills') {
|
||||
editingRecord.value = record
|
||||
editorStep.value = 'skills'
|
||||
showEditor.value = true
|
||||
openSkills(record)
|
||||
return
|
||||
}
|
||||
if (action === 'delete') {
|
||||
void confirmRemove(record)
|
||||
}
|
||||
}
|
||||
|
||||
async function confirmRemove(record: SandboxConfigRecord) {
|
||||
await onDeleteConfirmOpen(true, record)
|
||||
confirmDelete({
|
||||
body: deleteConfirmText(record),
|
||||
onConfirm: () => removeRecord(record),
|
||||
})
|
||||
}
|
||||
|
||||
// A card-level probe answers "is this backend still alive" without opening the
|
||||
|
|
@ -776,21 +809,21 @@ onMounted(load)
|
|||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
padding: 14px 16px;
|
||||
padding: 14px 14px 14px 12px;
|
||||
border: 1px solid var(--td-component-stroke);
|
||||
border-radius: 10px;
|
||||
background: var(--td-bg-color-container);
|
||||
transition: border-color 0.18s ease, box-shadow 0.18s ease;
|
||||
min-width: 0;
|
||||
|
||||
&:hover {
|
||||
border-color: var(--td-brand-color-3, var(--td-brand-color));
|
||||
box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
|
||||
}
|
||||
|
||||
&--clickable {
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
border-color: var(--td-brand-color-3, var(--td-brand-color));
|
||||
box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 2px solid var(--td-brand-color);
|
||||
outline-offset: 2px;
|
||||
|
|
@ -847,8 +880,7 @@ onMounted(load)
|
|||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 2px;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.sandbox-card__header {
|
||||
|
|
@ -871,88 +903,112 @@ onMounted(load)
|
|||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sandbox-card__subtitle,
|
||||
.sandbox-card__desc {
|
||||
margin: 2px 0 0;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
color: var(--td-text-color-secondary);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sandbox-card__desc {
|
||||
color: var(--td-text-color-placeholder);
|
||||
}
|
||||
|
||||
.sandbox-card__target {
|
||||
font-family: var(--td-font-family-medium, inherit);
|
||||
}
|
||||
|
||||
.sandbox-card__facts {
|
||||
.sandbox-card__subtitle {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px 6px;
|
||||
margin: 8px 0 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
color: var(--td-text-color-secondary);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.sandbox-card__fact {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
padding: 2px 7px;
|
||||
border-radius: 5px;
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-text-color-secondary);
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
|
||||
span {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&.is-warning {
|
||||
background: color-mix(in srgb, var(--td-warning-color) 12%, transparent);
|
||||
color: var(--td-warning-color-7, var(--td-warning-color));
|
||||
}
|
||||
.sandbox-card__type {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.sandbox-card__sep {
|
||||
margin: 0 4px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
}
|
||||
|
||||
.legacy-tag {
|
||||
margin-left: 6px;
|
||||
vertical-align: middle;
|
||||
.sandbox-card__desc {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.sandbox-card__url {
|
||||
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
color: var(--td-text-color-placeholder);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.sandbox-card__skills {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-top: 2px;
|
||||
min-width: 0;
|
||||
|
||||
:deep(.t-tag) {
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
.sandbox-card__skills-empty,
|
||||
.sandbox-card__skills-more {
|
||||
color: var(--td-text-color-placeholder);
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.sandbox-card__skills-empty:hover,
|
||||
.sandbox-card__skills:hover .sandbox-card__skills-more {
|
||||
color: var(--td-brand-color);
|
||||
}
|
||||
|
||||
.sandbox-card__warnings {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px 8px;
|
||||
margin: 2px 0 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
|
||||
li {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
color: var(--td-warning-color-7, var(--td-warning-color));
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
}
|
||||
|
||||
.sandbox-card__actions {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.sandbox-card__action-btn {
|
||||
.sandbox-card__more {
|
||||
flex-shrink: 0;
|
||||
padding: 2px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
transition: color 0.15s ease, background-color 0.15s ease;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
color: var(--td-text-color-primary);
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
}
|
||||
}
|
||||
|
||||
.sandbox-card:hover .sandbox-card__more,
|
||||
.sandbox-card:focus-within .sandbox-card__more,
|
||||
.sandbox-card__actions:focus-within .sandbox-card__more {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sandbox-empty-hint {
|
||||
margin: 16px 0 0;
|
||||
font-size: 13px;
|
||||
|
|
|
|||
|
|
@ -44,6 +44,15 @@
|
|||
<path d="M4.5 5.5L6.5 12.5L9 7.5L11.5 12.5L13.5 5.5" stroke="currentColor" stroke-width="1.3"
|
||||
stroke-linecap="round" stroke-linejoin="round" fill="none" />
|
||||
</svg>
|
||||
<!-- 技能沙箱:隔离运行窗口,避免和 Ollama / 系统设置共用 server -->
|
||||
<svg v-else-if="item.key === 'sandbox'" width="17" height="17" viewBox="0 0 18 18" fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg" class="nav-icon">
|
||||
<rect x="2.5" y="3" width="13" height="12" rx="2" stroke="currentColor" stroke-width="1.2"
|
||||
fill="none" />
|
||||
<path d="M2.5 6.5h13" stroke="currentColor" stroke-width="1.2" />
|
||||
<path d="M5.5 10h4M5.5 12.5h2.5" stroke="currentColor" stroke-width="1.2"
|
||||
stroke-linecap="round" />
|
||||
</svg>
|
||||
<span v-else-if="item.emoji" class="nav-icon nav-icon-emoji">{{ item.emoji }}</span>
|
||||
<t-icon v-else :name="item.icon" class="nav-icon" />
|
||||
<span class="nav-label">{{ item.label }}</span>
|
||||
|
|
@ -139,7 +148,7 @@
|
|||
<StorageEngineSettings />
|
||||
</div>
|
||||
|
||||
<!-- 沙箱后端 -->
|
||||
<!-- 技能沙箱 -->
|
||||
<div v-if="currentSection === 'sandbox'" class="section">
|
||||
<SandboxSettings />
|
||||
</div>
|
||||
|
|
@ -362,7 +371,7 @@ const navItems = computed(() => {
|
|||
{ key: 'vectorstore', icon: 'data-base', label: t('settings.vectorStoreEngine') },
|
||||
{ key: 'parser', icon: 'file-search', label: t('settings.parserEngine') },
|
||||
{ key: 'storage', icon: 'cloud', label: t('settings.storageEngine') },
|
||||
{ key: 'sandbox', icon: 'server', label: t('settings.sandbox.title') },
|
||||
{ key: 'sandbox', icon: 'code', label: t('settings.sandbox.title') },
|
||||
{ key: 'mcp', icon: 'tools', label: t('settings.mcpService') },
|
||||
{ key: 'system', icon: 'info-circle', label: t('settings.versionInfo') },
|
||||
{ key: 'system-global', icon: 'server', label: t('settings.system') },
|
||||
|
|
|
|||
|
|
@ -250,10 +250,53 @@ func (s *StorageBackendService) Test(ctx context.Context, backend *types.Storage
|
|||
}
|
||||
}
|
||||
|
||||
func storageBackendID(id *string) string {
|
||||
if id == nil {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(*id)
|
||||
}
|
||||
|
||||
func storageEngineDefaultProvider(sec *types.StorageEngineConfig) string {
|
||||
if sec == nil {
|
||||
return ""
|
||||
}
|
||||
return strings.ToLower(strings.TrimSpace(sec.DefaultProvider))
|
||||
}
|
||||
|
||||
// hydrateTenantStorage fills DefaultStorageBackendID / StorageEngineConfig from
|
||||
// the workspace row when the caller only passed a stub Tenant{ID: ...}. Skill
|
||||
// install and bundle cleanup do that, and without the default the factory
|
||||
// returns "empty provider".
|
||||
func (s *StorageBackendService) hydrateTenantStorage(ctx context.Context, tenant *types.Tenant) *types.Tenant {
|
||||
if tenant == nil || tenant.ID == 0 || s.db == nil {
|
||||
return tenant
|
||||
}
|
||||
if storageBackendID(tenant.DefaultStorageBackendID) != "" {
|
||||
return tenant
|
||||
}
|
||||
var stored types.Tenant
|
||||
if err := s.db.WithContext(ctx).
|
||||
Select("id", "default_storage_backend_id", "storage_engine_config").
|
||||
Where("id = ?", tenant.ID).
|
||||
Take(&stored).Error; err != nil {
|
||||
return tenant
|
||||
}
|
||||
out := *tenant
|
||||
if storageBackendID(out.DefaultStorageBackendID) == "" {
|
||||
out.DefaultStorageBackendID = stored.DefaultStorageBackendID
|
||||
}
|
||||
if out.StorageEngineConfig == nil {
|
||||
out.StorageEngineConfig = stored.StorageEngineConfig
|
||||
}
|
||||
return &out
|
||||
}
|
||||
|
||||
func (s *StorageBackendService) ResolveBackend(ctx context.Context, tenant *types.Tenant, backendID, provider string) (*types.StorageBackend, error) {
|
||||
if tenant == nil {
|
||||
return nil, fmt.Errorf("workspace context missing")
|
||||
}
|
||||
tenant = s.hydrateTenantStorage(ctx, tenant)
|
||||
backendID = strings.TrimSpace(backendID)
|
||||
provider = strings.ToLower(strings.TrimSpace(provider))
|
||||
if backendID == "" && provider != "" {
|
||||
|
|
@ -262,8 +305,8 @@ func (s *StorageBackendService) ResolveBackend(ctx context.Context, tenant *type
|
|||
return backend, err
|
||||
}
|
||||
}
|
||||
if backendID == "" && tenant.DefaultStorageBackendID != nil {
|
||||
backendID = strings.TrimSpace(*tenant.DefaultStorageBackendID)
|
||||
if backendID == "" {
|
||||
backendID = storageBackendID(tenant.DefaultStorageBackendID)
|
||||
}
|
||||
if backendID != "" {
|
||||
backend, err := s.repo.GetByID(ctx, tenant.ID, backendID)
|
||||
|
|
@ -282,6 +325,10 @@ func (s *StorageBackendService) ResolveBackend(ctx context.Context, tenant *type
|
|||
}
|
||||
|
||||
func (s *StorageBackendService) ResolveFileService(ctx context.Context, tenant *types.Tenant, backendID, provider, localBaseDir string) (interfaces.FileService, string, error) {
|
||||
if tenant == nil {
|
||||
return nil, "", fmt.Errorf("workspace context missing")
|
||||
}
|
||||
tenant = s.hydrateTenantStorage(ctx, tenant)
|
||||
backend, err := s.ResolveBackend(ctx, tenant, backendID, provider)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
|
|
@ -294,12 +341,18 @@ func (s *StorageBackendService) ResolveFileService(ctx context.Context, tenant *
|
|||
scoped := filesvc.NewBackendScopedFileService(backend.ID, inner)
|
||||
return filesvc.NewResourceCatalogFileService(scoped, s.resourceCatalog), provider, nil
|
||||
}
|
||||
if tenant == nil {
|
||||
return nil, "", fmt.Errorf("workspace context missing")
|
||||
sec := tenant.StorageEngineConfig
|
||||
if strings.TrimSpace(provider) == "" && storageEngineDefaultProvider(sec) == "" {
|
||||
if env := types.StorageBackendFromEnvironment(tenant.ID); env != nil {
|
||||
provider = env.Provider
|
||||
if sec == nil {
|
||||
sec = env.ToStorageEngineConfig()
|
||||
}
|
||||
}
|
||||
}
|
||||
inner, resolvedProvider, err := filesvc.NewFileServiceFromStorageConfig(
|
||||
provider,
|
||||
tenant.StorageEngineConfig,
|
||||
sec,
|
||||
localBaseDir,
|
||||
)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -40,3 +40,42 @@ func TestStorageBackendResolverScopesPathsAndTenant(t *testing.T) {
|
|||
_, _, err = resolver.ResolveFileService(context.Background(), &types.Tenant{ID: 8}, backend.ID, "local", t.TempDir())
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
func TestResolveFileServiceUsesWorkspaceDefaultForStubTenant(t *testing.T) {
|
||||
t.Setenv("STORAGE_TYPE", "local")
|
||||
db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, db.AutoMigrate(&types.Tenant{}, &types.StorageBackend{}))
|
||||
|
||||
tenantRepo := repository.NewTenantRepository(db)
|
||||
storageRepo := repository.NewStorageBackendRepository(db)
|
||||
tenant, err := service.NewTenantService(tenantRepo, storageRepo).CreateTenant(
|
||||
context.Background(), &types.Tenant{Name: "workspace"})
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, tenant.DefaultStorageBackendID)
|
||||
|
||||
resolver := service.NewStorageBackendService(storageRepo, db)
|
||||
svc, provider, err := resolver.ResolveFileService(
|
||||
context.Background(), &types.Tenant{ID: tenant.ID}, "", "", t.TempDir())
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "local", provider)
|
||||
|
||||
path, err := svc.SaveBytes(context.Background(), []byte("skill"), tenant.ID, "tenant-skills/sk.zip", false)
|
||||
require.NoError(t, err)
|
||||
assert.Contains(t, path, "storage://"+*tenant.DefaultStorageBackendID+"/")
|
||||
}
|
||||
|
||||
func TestResolveFileServiceFallsBackToEnvWhenWorkspaceHasNoBackend(t *testing.T) {
|
||||
t.Setenv("STORAGE_TYPE", "local")
|
||||
db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, db.AutoMigrate(&types.Tenant{}, &types.StorageBackend{}))
|
||||
require.NoError(t, db.Create(&types.Tenant{ID: 9, Name: "legacy"}).Error)
|
||||
|
||||
resolver := service.NewStorageBackendService(repository.NewStorageBackendRepository(db), db)
|
||||
svc, provider, err := resolver.ResolveFileService(
|
||||
context.Background(), &types.Tenant{ID: 9}, "", "", t.TempDir())
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "local", provider)
|
||||
require.NotNil(t, svc)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import (
|
|||
"github.com/Tencent/WeKnora/internal/models/chat"
|
||||
"github.com/Tencent/WeKnora/internal/sandbox"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -119,7 +120,10 @@ func (s *TenantSkillService) InstallSkill(
|
|||
if err != nil {
|
||||
failCtx, cancelFail := s.cleanupContext(ctx)
|
||||
defer cancelFail()
|
||||
s.failSkill(failCtx, tenantID, configID, skillID, bundle, fmt.Errorf("store bundle: %w", err))
|
||||
storeErr := fmt.Errorf("store bundle: %w", err)
|
||||
logger.Errorf(ctx, "[skill] store bundle failed tenant=%d config=%s skill=%s name=%s: %v",
|
||||
tenantID, configID, skillID, bundle.Name, err)
|
||||
s.failSkill(failCtx, tenantID, configID, skillID, bundle, storeErr)
|
||||
return "", fmt.Errorf("store bundle for skill %s: %w", skillID, err)
|
||||
}
|
||||
_ = s.updateSkillFields(ctx, tenantID, configID, skillID, func(e *types.TenantSkillEntity) {
|
||||
|
|
@ -735,19 +739,36 @@ func (s *TenantSkillService) execInstall(
|
|||
return res, nil
|
||||
}
|
||||
|
||||
func (s *TenantSkillService) tenantForStorage(ctx context.Context, tenantID uint64) *types.Tenant {
|
||||
if info, ok := types.TenantInfoFromContext(ctx); ok && info.ID == tenantID {
|
||||
return info
|
||||
}
|
||||
return &types.Tenant{ID: tenantID}
|
||||
}
|
||||
|
||||
func (s *TenantSkillService) fileServiceForTenant(
|
||||
ctx context.Context, tenantID uint64,
|
||||
) (interfaces.FileService, error) {
|
||||
if s.resolver == nil {
|
||||
return nil, errors.New("storage resolver is not configured")
|
||||
}
|
||||
fs, _, err := s.resolver.ResolveFileService(ctx, s.tenantForStorage(ctx, tenantID), "", "", "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if fs == nil {
|
||||
return nil, errors.New("file service is not configured")
|
||||
}
|
||||
return fs, nil
|
||||
}
|
||||
|
||||
func (s *TenantSkillService) saveBundle(
|
||||
ctx context.Context, tenantID uint64, skillID string, archive []byte,
|
||||
) (string, error) {
|
||||
if s.resolver == nil {
|
||||
return "", errors.New("storage resolver is not configured")
|
||||
}
|
||||
fs, _, err := s.resolver.ResolveFileService(ctx, &types.Tenant{ID: tenantID}, "", "", "")
|
||||
fs, err := s.fileServiceForTenant(ctx, tenantID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if fs == nil {
|
||||
return "", errors.New("file service is not configured")
|
||||
}
|
||||
return fs.SaveBytes(ctx, archive, tenantID, fmt.Sprintf("tenant-skills/%s.zip", skillID), false)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -310,6 +310,27 @@ func TestInstallSkillRefusesWhenBundleCannotBeStored(t *testing.T) {
|
|||
require.NotContains(t, fx.events, "create-session")
|
||||
}
|
||||
|
||||
func TestTenantForStoragePrefersMatchingContextTenant(t *testing.T) {
|
||||
svc := &TenantSkillService{}
|
||||
backendID := "backend-1"
|
||||
ctxTenant := &types.Tenant{ID: 7, DefaultStorageBackendID: &backendID}
|
||||
ctx := context.WithValue(context.Background(), types.TenantInfoContextKey, ctxTenant)
|
||||
|
||||
got := svc.tenantForStorage(ctx, 7)
|
||||
|
||||
require.Equal(t, ctxTenant, got)
|
||||
}
|
||||
|
||||
func TestTenantForStorageIgnoresMismatchedContextTenant(t *testing.T) {
|
||||
svc := &TenantSkillService{}
|
||||
ctx := context.WithValue(context.Background(), types.TenantInfoContextKey, &types.Tenant{ID: 8})
|
||||
|
||||
got := svc.tenantForStorage(ctx, 7)
|
||||
|
||||
require.Equal(t, uint64(7), got.ID)
|
||||
require.Nil(t, got.DefaultStorageBackendID)
|
||||
}
|
||||
|
||||
func TestRunInstallAbortsWhenANewerBundleOwnsTheRow(t *testing.T) {
|
||||
fx := newInstallFixture(t)
|
||||
newer := strings.Repeat("b", 64)
|
||||
|
|
|
|||
|
|
@ -473,10 +473,7 @@ func (s *TenantSkillService) removeStillOwnsTheRow(
|
|||
func (s *TenantSkillService) deleteBundleBestEffort(
|
||||
ctx context.Context, tenantID uint64, bundleRef string,
|
||||
) {
|
||||
if s.resolver == nil {
|
||||
return
|
||||
}
|
||||
fs, _, err := s.resolver.ResolveFileService(ctx, &types.Tenant{ID: tenantID}, "", "", "")
|
||||
fs, err := s.fileServiceForTenant(ctx, tenantID)
|
||||
if err != nil || fs == nil {
|
||||
logger.Warnf(ctx, "[skill] resolve file service to delete bundle %s failed: %v",
|
||||
bundleRef, err)
|
||||
|
|
|
|||
|
|
@ -244,6 +244,16 @@ func Logger() gin.HandlerFunc {
|
|||
if responseBodyStr != "" {
|
||||
logMsg = logMsg.WithField("response_body", secutils.SanitizeForLog(responseBodyStr))
|
||||
}
|
||||
logMsg.Info()
|
||||
if last := c.Errors.Last(); last != nil && last.Err != nil {
|
||||
logMsg = logMsg.WithField("error", secutils.SanitizeForLog(last.Err.Error()))
|
||||
}
|
||||
switch {
|
||||
case statusCode >= 500:
|
||||
logMsg.Error()
|
||||
case statusCode >= 400:
|
||||
logMsg.Warn()
|
||||
default:
|
||||
logMsg.Info()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue