v2.2.15: Astra Office Refactor & Multi-Service Integration
This commit is contained in:
@@ -602,6 +602,52 @@ export async function handleChatMessage(provider: SidebarChatProvider, data: any
|
||||
if (result.ok) await provider._sendCompanyPipelines();
|
||||
return true;
|
||||
}
|
||||
case 'setCompanyScopePreset': {
|
||||
// 스코프 프리셋 클릭 — templateId (plan-only / dev-only / full-product-dev) 받아서:
|
||||
// 1) suggestedPipelineId 의 pipeline 이 state.pipelines 에 없으면 template stamp
|
||||
// 2) activePipelineId 를 그 id 로 설정
|
||||
// 이미 stamp 된 pipeline 이라면 stage 사용자 편집을 *유지* (활성화만).
|
||||
const { getPipelineTemplate, upsertPipeline, setActivePipeline, readCompanyState } =
|
||||
await import('../features/company');
|
||||
const tplId = typeof data.templateId === 'string' ? data.templateId : '';
|
||||
const tpl = getPipelineTemplate(tplId);
|
||||
if (!tpl) {
|
||||
provider._view?.webview.postMessage({
|
||||
type: 'setCompanyScopePresetResult',
|
||||
value: { ok: false, reason: `알 수 없는 템플릿: ${tplId}` },
|
||||
});
|
||||
return true;
|
||||
}
|
||||
const state = readCompanyState(provider._context);
|
||||
if (!state.pipelines || !state.pipelines[tpl.suggestedPipelineId]) {
|
||||
const stampDef = {
|
||||
id: tpl.suggestedPipelineId,
|
||||
name: tpl.suggestedPipelineName,
|
||||
// stage 는 deep clone — 템플릿 read-only 원본 보호.
|
||||
stages: tpl.stages.map((s) => ({ ...s })),
|
||||
};
|
||||
const stamp = await upsertPipeline(provider._context, stampDef);
|
||||
if (!stamp.ok) {
|
||||
provider._view?.webview.postMessage({
|
||||
type: 'setCompanyScopePresetResult',
|
||||
value: { ok: false, reason: stamp.reason },
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
const activate = await setActivePipeline(provider._context, tpl.suggestedPipelineId);
|
||||
provider._view?.webview.postMessage({
|
||||
type: 'setCompanyScopePresetResult',
|
||||
value: activate.ok
|
||||
? { ok: true, pipelineId: tpl.suggestedPipelineId, templateId: tplId }
|
||||
: { ok: false, reason: activate.reason },
|
||||
});
|
||||
if (activate.ok) {
|
||||
await provider._sendCompanyStatus();
|
||||
await provider._sendCompanyPipelines();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case 'proactiveTrigger':
|
||||
await provider._handleProactiveSuggestion(data.context);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user