devchain-cli 0.20.1 → 0.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/modules/events/catalog/broadcast-registry.js +31 -0
- package/dist/server/modules/events/catalog/broadcast-registry.js.map +1 -1
- package/dist/server/modules/projects/controllers/projects.controller.d.ts +22 -8
- package/dist/server/modules/projects/controllers/projects.controller.js +74 -40
- package/dist/server/modules/projects/controllers/projects.controller.js.map +1 -1
- package/dist/server/modules/projects/dtos/template-upgrade.dto.d.ts +19 -0
- package/dist/server/modules/projects/dtos/template-upgrade.dto.js +60 -0
- package/dist/server/modules/projects/dtos/template-upgrade.dto.js.map +1 -1
- package/dist/server/modules/projects/helpers/project-export.d.ts +1 -0
- package/dist/server/modules/projects/helpers/project-export.js +2 -2
- package/dist/server/modules/projects/helpers/project-export.js.map +1 -1
- package/dist/server/modules/projects/helpers/project-import-sessions.d.ts +3 -0
- package/dist/server/modules/projects/helpers/project-import-sessions.js +11 -6
- package/dist/server/modules/projects/helpers/project-import-sessions.js.map +1 -1
- package/dist/server/modules/projects/helpers/project-import.d.ts +83 -8
- package/dist/server/modules/projects/helpers/project-import.js +161 -44
- package/dist/server/modules/projects/helpers/project-import.js.map +1 -1
- package/dist/server/modules/projects/services/project-template-upgrade.service.d.ts +16 -3
- package/dist/server/modules/projects/services/project-template-upgrade.service.js +115 -56
- package/dist/server/modules/projects/services/project-template-upgrade.service.js.map +1 -1
- package/dist/server/modules/projects/services/projects.service.d.ts +22 -8
- package/dist/server/modules/projects/services/projects.service.js +1 -1
- package/dist/server/modules/projects/services/projects.service.js.map +1 -1
- package/dist/server/modules/projects/template-codec/codecs/statuses.codec.js +4 -2
- package/dist/server/modules/projects/template-codec/codecs/statuses.codec.js.map +1 -1
- package/dist/server/modules/skills/adapters/community-skill-source.adapter.d.ts +2 -8
- package/dist/server/modules/skills/adapters/community-skill-source.adapter.js +3 -167
- package/dist/server/modules/skills/adapters/community-skill-source.adapter.js.map +1 -1
- package/dist/server/modules/skills/adapters/github-directory-skill-source.adapter.d.ts +21 -0
- package/dist/server/modules/skills/adapters/github-directory-skill-source.adapter.js +231 -0
- package/dist/server/modules/skills/adapters/github-directory-skill-source.adapter.js.map +1 -0
- package/dist/server/modules/skills/adapters/github-skill-source.base.d.ts +1 -0
- package/dist/server/modules/skills/adapters/github-skill-source.base.js +4 -4
- package/dist/server/modules/skills/adapters/github-skill-source.base.js.map +1 -1
- package/dist/server/modules/skills/adapters/skill-parsing.utils.d.ts +1 -0
- package/dist/server/modules/skills/adapters/skill-parsing.utils.js +41 -0
- package/dist/server/modules/skills/adapters/skill-parsing.utils.js.map +1 -1
- package/dist/server/modules/skills/skills.module.js +15 -1
- package/dist/server/modules/skills/skills.module.js.map +1 -1
- package/dist/server/templates/teams-dev.json +30 -21
- package/dist/server/tsconfig.tsbuildinfo +1 -1
- package/dist/server/ui/assets/{ReviewDetailPage-BZoAe0G2.js → ReviewDetailPage-BXLlZvPO.js} +1 -1
- package/dist/server/ui/assets/{ReviewsPage-J3XZDw7k.js → ReviewsPage-CmFUc6IP.js} +1 -1
- package/dist/server/ui/assets/{index-DoKUmi74.js → index-LNBfBNWF.js} +243 -248
- package/dist/server/ui/assets/index-NypjSmlZ.css +32 -0
- package/dist/server/ui/assets/{useReviewSubscription-CNUx-AWQ.js → useReviewSubscription-Ch8K_5xz.js} +1 -1
- package/dist/server/ui/index.html +2 -2
- package/dist/templates/teams-dev.json +30 -21
- package/package.json +8 -1
- package/dist/server/ui/assets/index-CxmSxl5f.css +0 -32
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-export.js","sourceRoot":"","sources":["../../../../src/modules/projects/helpers/project-export.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"project-export.js","sourceRoot":"","sources":["../../../../src/modules/projects/helpers/project-export.ts"],"names":[],"mappings":";;AAyEA,0DAsFC;AAsED,wCAYC;AAhPD,2DAA8D;AAG9D,uEAAiE;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AI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;QAC7D,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI;QACxC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,IAAI,OAAO;QACtD,GAAG,iBAAiB;QACpB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACtC,CAAC;AACJ,CAAC"}
|
|
@@ -2,6 +2,9 @@ import type { StorageService } from '../../storage/interfaces/storage.interface'
|
|
|
2
2
|
export declare function ensureNoDuplicateAgentNames(templateAgents: Array<{
|
|
3
3
|
name: string;
|
|
4
4
|
}>): void;
|
|
5
|
+
export declare function findDuplicateAgentNames(templateAgents: Array<{
|
|
6
|
+
name: string;
|
|
7
|
+
}>): string[];
|
|
5
8
|
export declare function planAndApplySessionPreservation(parkedByOldAgentId: Map<string, string[]>, oldAgents: Array<{
|
|
6
9
|
id: string;
|
|
7
10
|
name: string;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ensureNoDuplicateAgentNames = ensureNoDuplicateAgentNames;
|
|
4
|
+
exports.findDuplicateAgentNames = findDuplicateAgentNames;
|
|
4
5
|
exports.planAndApplySessionPreservation = planAndApplySessionPreservation;
|
|
5
6
|
const error_types_1 = require("../../../common/errors/error-types");
|
|
6
7
|
function ensureNoDuplicateAgentNames(templateAgents) {
|
|
8
|
+
const duplicates = findDuplicateAgentNames(templateAgents);
|
|
9
|
+
if (duplicates.length > 0) {
|
|
10
|
+
throw new error_types_1.ValidationError('Template has duplicate agent names', {
|
|
11
|
+
duplicates,
|
|
12
|
+
hint: 'Template agent names (case-insensitive) must be unique for session preservation to work deterministically.',
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function findDuplicateAgentNames(templateAgents) {
|
|
7
17
|
const seen = new Map();
|
|
8
18
|
const duplicates = [];
|
|
9
19
|
for (const a of templateAgents) {
|
|
@@ -13,12 +23,7 @@ function ensureNoDuplicateAgentNames(templateAgents) {
|
|
|
13
23
|
else
|
|
14
24
|
seen.set(lower, a.name);
|
|
15
25
|
}
|
|
16
|
-
|
|
17
|
-
throw new error_types_1.ValidationError('Template has duplicate agent names', {
|
|
18
|
-
duplicates,
|
|
19
|
-
hint: 'Template agent names (case-insensitive) must be unique for session preservation to work deterministically.',
|
|
20
|
-
});
|
|
21
|
-
}
|
|
26
|
+
return duplicates;
|
|
22
27
|
}
|
|
23
28
|
async function planAndApplySessionPreservation(parkedByOldAgentId, oldAgents, newAgentNameToId, storage) {
|
|
24
29
|
const oldAgentIdToNameLower = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-import-sessions.js","sourceRoot":"","sources":["../../../../src/modules/projects/helpers/project-import-sessions.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"project-import-sessions.js","sourceRoot":"","sources":["../../../../src/modules/projects/helpers/project-import-sessions.ts"],"names":[],"mappings":";;AAGA,kEAQC;AAED,0DASC;AAED,0EA4BC;AApDD,oEAAqE;AAGrE,SAAgB,2BAA2B,CAAC,cAAuC;IACjF,MAAM,UAAU,GAAG,uBAAuB,CAAC,cAAc,CAAC,CAAC;IAC3D,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,6BAAe,CAAC,oCAAoC,EAAE;YAC9D,UAAU;YACV,IAAI,EAAE,4GAA4G;SACnH,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,SAAgB,uBAAuB,CAAC,cAAuC;IAC7E,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvC,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,KAAK,MAAM,CAAC,IAAI,cAAc,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAA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U,EAAE,QAAQ,CAAC,CAAC;IACrD,OAAO,EAAE,cAAc,EAAE,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;AAC9E,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ExportSchema } from '@devchain/shared';
|
|
2
|
+
import { type PromptReferenceIssue, type PromptReferenceValidationFailure } from '../../../common/prompt-references';
|
|
2
3
|
import { type PromptTransferCounts, type PromptTransferPolicy } from '../../../common/prompt-transfer';
|
|
3
4
|
import type { SettingsService } from '../../settings/services/settings.service';
|
|
4
5
|
import type { StorageService } from '../../storage/interfaces/storage.interface';
|
|
@@ -14,6 +15,53 @@ type UnmatchedStatus = {
|
|
|
14
15
|
color: string;
|
|
15
16
|
epicCount: number;
|
|
16
17
|
};
|
|
18
|
+
export type ActiveSessionSummary = {
|
|
19
|
+
id: string;
|
|
20
|
+
agentId: string | null;
|
|
21
|
+
};
|
|
22
|
+
export type ImportReadinessIssue = {
|
|
23
|
+
code: 'prompt_reference_validation';
|
|
24
|
+
message: string;
|
|
25
|
+
details: PromptReferenceValidationFailure['promptReferenceValidation'];
|
|
26
|
+
} | {
|
|
27
|
+
code: 'selected_providers_not_installed';
|
|
28
|
+
message: string;
|
|
29
|
+
details: {
|
|
30
|
+
providerNames: string[];
|
|
31
|
+
};
|
|
32
|
+
} | {
|
|
33
|
+
code: 'preset_not_found';
|
|
34
|
+
message: string;
|
|
35
|
+
details: {
|
|
36
|
+
presetName: string;
|
|
37
|
+
};
|
|
38
|
+
} | {
|
|
39
|
+
code: 'provider_mapping_required';
|
|
40
|
+
message: string;
|
|
41
|
+
details: ReturnType<typeof buildProviderMappingRequired>;
|
|
42
|
+
} | {
|
|
43
|
+
code: 'selected_profiles_unavailable';
|
|
44
|
+
message: string;
|
|
45
|
+
details: {
|
|
46
|
+
providerNames: string[];
|
|
47
|
+
};
|
|
48
|
+
} | {
|
|
49
|
+
code: 'active_sessions';
|
|
50
|
+
message: string;
|
|
51
|
+
details: {
|
|
52
|
+
activeSessions: ActiveSessionSummary[];
|
|
53
|
+
};
|
|
54
|
+
} | {
|
|
55
|
+
code: 'duplicate_agent_names';
|
|
56
|
+
message: string;
|
|
57
|
+
details: {
|
|
58
|
+
agentNames: string[];
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export interface ImportReadiness {
|
|
62
|
+
ready: boolean;
|
|
63
|
+
issues: ImportReadinessIssue[];
|
|
64
|
+
}
|
|
17
65
|
export interface ImportProjectInputLike {
|
|
18
66
|
projectId: string;
|
|
19
67
|
payload: unknown;
|
|
@@ -21,6 +69,7 @@ export interface ImportProjectInputLike {
|
|
|
21
69
|
promptTransferPolicy?: PromptTransferPolicy;
|
|
22
70
|
statusMappings?: Record<string, string>;
|
|
23
71
|
familyProviderMappings?: Record<string, string>;
|
|
72
|
+
presetName?: string;
|
|
24
73
|
agentOverrides?: PresetAgentConfig[];
|
|
25
74
|
selectedProviderNames?: string[];
|
|
26
75
|
teamOverrides?: Array<{
|
|
@@ -79,6 +128,13 @@ interface ImportProjectDeps {
|
|
|
79
128
|
applied: number;
|
|
80
129
|
warnings: string[];
|
|
81
130
|
}>;
|
|
131
|
+
applyPreset: (projectId: string, presetName: string, nameMaps: {
|
|
132
|
+
agentNameToId: Map<string, string>;
|
|
133
|
+
configLookupMap: Map<string, string>;
|
|
134
|
+
}) => Promise<{
|
|
135
|
+
applied: number;
|
|
136
|
+
warnings: string[];
|
|
137
|
+
}>;
|
|
82
138
|
teamsService?: {
|
|
83
139
|
createTeam: (data: {
|
|
84
140
|
projectId: string;
|
|
@@ -104,8 +160,13 @@ interface ImportProjectDeps {
|
|
|
104
160
|
};
|
|
105
161
|
computeNextRunAt?: (cronExpression: string, timezone: string) => Date | null;
|
|
106
162
|
}
|
|
107
|
-
export declare function importProjectWithHelper(input: ImportProjectInputLike, deps: ImportProjectDeps): Promise<
|
|
163
|
+
export declare function importProjectWithHelper(input: ImportProjectInputLike, deps: ImportProjectDeps): Promise<{
|
|
108
164
|
dryRun: true;
|
|
165
|
+
success?: false;
|
|
166
|
+
mutationStarted?: false;
|
|
167
|
+
error?: string;
|
|
168
|
+
readiness: ImportReadiness;
|
|
169
|
+
promptReferenceValidation?: PromptReferenceValidationFailure["promptReferenceValidation"];
|
|
109
170
|
missingProviders: string[];
|
|
110
171
|
unmatchedStatuses: UnmatchedStatus[];
|
|
111
172
|
templateStatuses: {
|
|
@@ -138,6 +199,21 @@ export declare function importProjectWithHelper(input: ImportProjectInputLike, d
|
|
|
138
199
|
};
|
|
139
200
|
};
|
|
140
201
|
promptTransfer: PromptTransferCounts;
|
|
202
|
+
} | {
|
|
203
|
+
readiness: ImportReadiness;
|
|
204
|
+
promptReferenceValidation?: {
|
|
205
|
+
code: typeof import("../../../common/prompt-references").PROMPT_REFERENCE_VALIDATION_CODE;
|
|
206
|
+
promptTitles: string[];
|
|
207
|
+
issues: PromptReferenceIssue[];
|
|
208
|
+
} | undefined;
|
|
209
|
+
providerMappingRequired?: {
|
|
210
|
+
missingProviders: string[];
|
|
211
|
+
familyAlternatives: FamilyAlternative[];
|
|
212
|
+
canImport: boolean;
|
|
213
|
+
} | undefined;
|
|
214
|
+
success: false;
|
|
215
|
+
mutationStarted: false;
|
|
216
|
+
error: string;
|
|
141
217
|
} | {
|
|
142
218
|
success: boolean;
|
|
143
219
|
mode: string;
|
|
@@ -184,14 +260,13 @@ export declare function importProjectWithHelper(input: ImportProjectInputLike, d
|
|
|
184
260
|
removedCount: number;
|
|
185
261
|
};
|
|
186
262
|
message: string;
|
|
187
|
-
} | {
|
|
188
|
-
success: boolean;
|
|
189
|
-
providerMappingRequired: {
|
|
190
|
-
missingProviders: string[];
|
|
191
|
-
familyAlternatives: FamilyAlternative[];
|
|
192
|
-
canImport: boolean;
|
|
193
|
-
};
|
|
194
263
|
}>;
|
|
264
|
+
declare function buildProviderMappingRequired(familyResult: FamilyAlternativesResult): {
|
|
265
|
+
missingProviders: string[];
|
|
266
|
+
familyAlternatives: FamilyAlternative[];
|
|
267
|
+
canImport: boolean;
|
|
268
|
+
};
|
|
269
|
+
export declare function buildActiveSessionReadiness(activeSessions: ActiveSessionSummary[]): ImportReadiness;
|
|
195
270
|
export declare function createImportedTeams(projectId: string, exportedTeams: Array<{
|
|
196
271
|
name: string;
|
|
197
272
|
description?: string | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.importProjectWithHelper = importProjectWithHelper;
|
|
4
|
+
exports.buildActiveSessionReadiness = buildActiveSessionReadiness;
|
|
4
5
|
exports.createImportedTeams = createImportedTeams;
|
|
5
6
|
exports.pruneUnavailableTeamProfileSelections = pruneUnavailableTeamProfileSelections;
|
|
6
7
|
exports.createImportedScheduledEpics = createImportedScheduledEpics;
|
|
@@ -22,23 +23,16 @@ async function importProjectWithHelper(input, deps) {
|
|
|
22
23
|
promptTransferPolicy: input.promptTransferPolicy ?? prompt_transfer_1.PROMPT_TRANSFER_POLICY.Template,
|
|
23
24
|
}, 'importProject');
|
|
24
25
|
const context = await prepareImportContext(input, deps);
|
|
25
|
-
const promptReferenceFailure = (0, prompt_references_1.buildPromptReferenceValidationFailure)(context.promptReferenceIssues);
|
|
26
|
-
if (promptReferenceFailure) {
|
|
27
|
-
return promptReferenceFailure;
|
|
28
|
-
}
|
|
29
26
|
if (context.isDryRun) {
|
|
30
27
|
return buildDryRunResponse(context);
|
|
31
28
|
}
|
|
32
|
-
if (context.
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
if (!context.readiness.ready) {
|
|
30
|
+
return buildReadinessFailure(context.readiness, context.providerMappingRequired);
|
|
31
|
+
}
|
|
32
|
+
const lateActiveSessions = getActiveSessions(input.projectId, deps);
|
|
33
|
+
if (lateActiveSessions.length > 0) {
|
|
34
|
+
return buildReadinessFailure(buildActiveSessionReadiness(lateActiveSessions), null);
|
|
37
35
|
}
|
|
38
|
-
ensureFamilyCanImport(context.familyResult);
|
|
39
|
-
ensureSelectedProvidersAvailable(context.selectedProfilesByFamily, context.installedProviders);
|
|
40
|
-
ensureNoActiveSessions(input.projectId, deps);
|
|
41
|
-
(0, project_import_sessions_1.ensureNoDuplicateAgentNames)(context.payload.agents);
|
|
42
36
|
try {
|
|
43
37
|
const oldAgentIdToName = buildOldAgentIdToNameMap(context.existing.agents.items);
|
|
44
38
|
const oldAgentIds = context.existing.agents.items.map((a) => a.id);
|
|
@@ -74,6 +68,8 @@ async function importProjectWithHelper(input, deps) {
|
|
|
74
68
|
const promptSectionResults = await pipeline.applySections(['statuses', 'prompts'], context.payload, pipelineCtx, 'replace', codecRuntime);
|
|
75
69
|
const statusIdMap = pipelineCtx.get('statusIdMap');
|
|
76
70
|
const promptIdMap = pipelineCtx.get('promptIdMap');
|
|
71
|
+
const statusesDeleted = promptSectionResults.find((result) => result.section === 'statuses')?.log
|
|
72
|
+
?.statusesDeleted ?? 0;
|
|
77
73
|
const appliedPrompts = getPromptApplyCounts(promptSectionResults);
|
|
78
74
|
await pipeline.applySections(['profiles', 'agents'], context.payload, pipelineCtx, 'replace', codecRuntime);
|
|
79
75
|
const profileIdMap = pipelineCtx.get('profileIdMap');
|
|
@@ -100,6 +96,12 @@ async function importProjectWithHelper(input, deps) {
|
|
|
100
96
|
const initialPromptSet = settingsResults.find((r) => r.section === 'projectSettings')?.log?.initialPromptSet ?? false;
|
|
101
97
|
await updateTemplateMetadata(input.projectId, context.payload, deps);
|
|
102
98
|
await pipeline.applySections(['presets'], context.payload, pipelineCtx, 'replace', codecRuntime);
|
|
99
|
+
if (input.presetName) {
|
|
100
|
+
await deps.applyPreset(input.projectId, input.presetName, {
|
|
101
|
+
agentNameToId: new Map(Object.entries(agentNameToId)),
|
|
102
|
+
configLookupMap: pipelineCtx.get('selectionEligibleConfigLookupMap'),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
103
105
|
await pipeline.applySections(['providerSettings', 'providerModels', 'providerEfforts'], context.payload, pipelineCtx, 'replace', codecRuntime);
|
|
104
106
|
return buildImportSuccessResponse({
|
|
105
107
|
payload: context.payload,
|
|
@@ -117,6 +119,7 @@ async function importProjectWithHelper(input, deps) {
|
|
|
117
119
|
teamsImported,
|
|
118
120
|
scheduledEpicsImported,
|
|
119
121
|
sessionPreservation,
|
|
122
|
+
statusesDeleted,
|
|
120
123
|
promptTransfer: {
|
|
121
124
|
...appliedPrompts,
|
|
122
125
|
...clearedPrompts,
|
|
@@ -134,10 +137,24 @@ async function prepareImportContext(input, deps) {
|
|
|
134
137
|
const promptTransferPolicy = input.promptTransferPolicy ?? prompt_transfer_1.PROMPT_TRANSFER_POLICY.Template;
|
|
135
138
|
const payload = shared_1.ExportSchema.parse(input.payload ?? {});
|
|
136
139
|
const familyResult = await deps.computeFamilyAlternatives(payload.profiles, payload.agents, input.selectedProviderNames);
|
|
137
|
-
const needsMapping = familyResult.alternatives.some((alt) => !alt.defaultProviderAvailable);
|
|
138
140
|
const referencedProviderNames = (0, profile_mapping_helpers_1.collectReferencedProviderNames)(payload.profiles);
|
|
139
141
|
const { installed, selected, missing: missingProviders, } = await (0, profile_mapping_helpers_1.resolveProvidersFromStorage)(deps.storage, referencedProviderNames, input.selectedProviderNames);
|
|
140
|
-
const
|
|
142
|
+
const selectedPreset = input.presetName
|
|
143
|
+
? payload.presets.find((preset) => preset.name === input.presetName)
|
|
144
|
+
: undefined;
|
|
145
|
+
const presetCoverage = selectedPreset
|
|
146
|
+
? (0, profile_mapping_helpers_1.derivePresetProviderCoverage)(payload.presets, payload.profiles, payload.agents, new Set(selected.keys()), { selectedPresetName: input.presetName })[0]
|
|
147
|
+
: undefined;
|
|
148
|
+
const presetCoversAllAgents = presetCoverage?.coversAllAgents ?? false;
|
|
149
|
+
const providerMappingRequired = hasUnresolvedFamilySelection(familyResult, input.familyProviderMappings, presetCoversAllAgents)
|
|
150
|
+
? buildProviderMappingRequired(familyResult)
|
|
151
|
+
: null;
|
|
152
|
+
const selectedProfilesByFamily = (0, profile_mapping_helpers_1.selectProfilesForFamilies)(payload.profiles, payload.agents, input.familyProviderMappings, installed, presetCoverage
|
|
153
|
+
? {
|
|
154
|
+
presetCoveredAgentNames: presetCoverage.coveredAgentNames,
|
|
155
|
+
presetAgentResolvedProviders: presetCoverage.agentResolvedProviders,
|
|
156
|
+
}
|
|
157
|
+
: undefined);
|
|
141
158
|
const existing = await loadExistingProjectData(input.projectId, deps.storage);
|
|
142
159
|
const incomingPromptPartition = (0, prompt_transfer_1.partitionPromptsForTransfer)(payload.prompts, promptTransferPolicy);
|
|
143
160
|
const promptReferenceIssues = promptTransferPolicy === prompt_transfer_1.PROMPT_TRANSFER_POLICY.Template
|
|
@@ -145,6 +162,20 @@ async function prepareImportContext(input, deps) {
|
|
|
145
162
|
: [];
|
|
146
163
|
const promptReplacementPlan = (0, prompt_transfer_1.planPromptReplacement)(payload.prompts, existing.prompts.items, promptTransferPolicy);
|
|
147
164
|
const unmatchedStatuses = await collectUnmatchedStatuses(payload.statuses, existing.statuses.items, deps.storage);
|
|
165
|
+
const activeSessions = getActiveSessions(input.projectId, deps);
|
|
166
|
+
const unavailableSelectedProviderNames = (input.selectedProviderNames ?? []).filter((name) => !installed.has(name.trim().toLowerCase()));
|
|
167
|
+
const unavailableSelectedProfiles = getUnavailableSelectedProfileProviders(selectedProfilesByFamily, installed);
|
|
168
|
+
const duplicateAgentNames = (0, project_import_sessions_1.findDuplicateAgentNames)(payload.agents);
|
|
169
|
+
const readiness = buildImportReadiness({
|
|
170
|
+
promptReferenceIssues,
|
|
171
|
+
unavailableSelectedProviderNames,
|
|
172
|
+
presetName: input.presetName,
|
|
173
|
+
presetFound: !input.presetName || Boolean(selectedPreset),
|
|
174
|
+
providerMappingRequired,
|
|
175
|
+
unavailableSelectedProfiles,
|
|
176
|
+
activeSessions,
|
|
177
|
+
duplicateAgentNames,
|
|
178
|
+
});
|
|
148
179
|
return {
|
|
149
180
|
isDryRun,
|
|
150
181
|
promptTransferPolicy,
|
|
@@ -158,13 +189,14 @@ async function prepareImportContext(input, deps) {
|
|
|
158
189
|
},
|
|
159
190
|
payload,
|
|
160
191
|
familyResult,
|
|
161
|
-
|
|
192
|
+
providerMappingRequired,
|
|
162
193
|
installedProviders: installed,
|
|
163
194
|
selectedProviders: selected,
|
|
164
195
|
missingProviders,
|
|
165
196
|
selectedProfilesByFamily,
|
|
166
197
|
existing,
|
|
167
198
|
unmatchedStatuses,
|
|
199
|
+
readiness,
|
|
168
200
|
};
|
|
169
201
|
}
|
|
170
202
|
async function loadExistingProjectData(projectId, storage) {
|
|
@@ -202,6 +234,7 @@ async function collectUnmatchedStatuses(templateStatuses, existingStatuses, stor
|
|
|
202
234
|
function buildDryRunResponse(context) {
|
|
203
235
|
const response = {
|
|
204
236
|
dryRun: true,
|
|
237
|
+
readiness: context.readiness,
|
|
205
238
|
missingProviders: context.missingProviders,
|
|
206
239
|
unmatchedStatuses: context.unmatchedStatuses,
|
|
207
240
|
templateStatuses: context.payload.statuses.map((status) => ({
|
|
@@ -222,7 +255,7 @@ function buildDryRunResponse(context) {
|
|
|
222
255
|
prompts: context.promptTransfer.deleted,
|
|
223
256
|
profiles: context.existing.profiles.total,
|
|
224
257
|
agents: context.existing.agents.total,
|
|
225
|
-
statuses: context.
|
|
258
|
+
statuses: context.unmatchedStatuses.length,
|
|
226
259
|
watchers: context.existing.watchers.length,
|
|
227
260
|
subscribers: context.existing.subscribers.length,
|
|
228
261
|
scheduledEpics: context.existing.scheduledEpics?.total ?? 0,
|
|
@@ -230,8 +263,11 @@ function buildDryRunResponse(context) {
|
|
|
230
263
|
},
|
|
231
264
|
promptTransfer: context.promptTransfer,
|
|
232
265
|
};
|
|
233
|
-
if (context.
|
|
234
|
-
response.providerMappingRequired =
|
|
266
|
+
if (context.providerMappingRequired) {
|
|
267
|
+
response.providerMappingRequired = context.providerMappingRequired;
|
|
268
|
+
}
|
|
269
|
+
if (!context.readiness.ready) {
|
|
270
|
+
Object.assign(response, buildReadinessFailureProperties(context.readiness, context.providerMappingRequired));
|
|
235
271
|
}
|
|
236
272
|
return response;
|
|
237
273
|
}
|
|
@@ -242,36 +278,117 @@ function buildProviderMappingRequired(familyResult) {
|
|
|
242
278
|
canImport: familyResult.canImport,
|
|
243
279
|
};
|
|
244
280
|
}
|
|
245
|
-
function
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
281
|
+
function getUnavailableSelectedProfileProviders(selectedProfilesByFamily, available) {
|
|
282
|
+
const selectedProviderNames = new Set(selectedProfilesByFamily.profilesToCreate.map((profile) => profile.provider.name.trim().toLowerCase()));
|
|
283
|
+
return Array.from(selectedProviderNames).filter((name) => !available.has(name));
|
|
284
|
+
}
|
|
285
|
+
function hasUnresolvedFamilySelection(familyResult, mappings, presetCoversAllAgents) {
|
|
286
|
+
if (presetCoversAllAgents)
|
|
287
|
+
return false;
|
|
288
|
+
if (!familyResult.canImport)
|
|
289
|
+
return true;
|
|
290
|
+
const alternativesByFamily = new Map(familyResult.alternatives.map((alternative) => [alternative.familySlug, alternative]));
|
|
291
|
+
for (const [familySlug, providerName] of Object.entries(mappings ?? {})) {
|
|
292
|
+
const alternative = alternativesByFamily.get(familySlug);
|
|
293
|
+
const normalizedProvider = providerName.trim().toLowerCase();
|
|
294
|
+
if (!alternative || !alternative.availableProviders.includes(normalizedProvider)) {
|
|
295
|
+
return true;
|
|
296
|
+
}
|
|
252
297
|
}
|
|
298
|
+
for (const alternative of familyResult.alternatives) {
|
|
299
|
+
if (alternative.defaultProviderAvailable)
|
|
300
|
+
continue;
|
|
301
|
+
const mappedProvider = mappings?.[alternative.familySlug]?.trim().toLowerCase();
|
|
302
|
+
if (!mappedProvider || !alternative.availableProviders.includes(mappedProvider)) {
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return false;
|
|
253
307
|
}
|
|
254
|
-
function
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
308
|
+
function getActiveSessions(projectId, deps) {
|
|
309
|
+
return deps.sessions.getActiveSessionsForProject(projectId).map((session) => ({
|
|
310
|
+
id: session.id,
|
|
311
|
+
agentId: session.agentId,
|
|
312
|
+
}));
|
|
313
|
+
}
|
|
314
|
+
function buildImportReadiness(input) {
|
|
315
|
+
const issues = [];
|
|
316
|
+
const promptFailure = (0, prompt_references_1.buildPromptReferenceValidationFailure)(input.promptReferenceIssues);
|
|
317
|
+
if (promptFailure) {
|
|
318
|
+
issues.push({
|
|
319
|
+
code: 'prompt_reference_validation',
|
|
320
|
+
message: promptFailure.error,
|
|
321
|
+
details: promptFailure.promptReferenceValidation,
|
|
261
322
|
});
|
|
262
323
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
324
|
+
if (input.unavailableSelectedProviderNames.length > 0) {
|
|
325
|
+
issues.push({
|
|
326
|
+
code: 'selected_providers_not_installed',
|
|
327
|
+
message: `Selected providers are not installed: ${input.unavailableSelectedProviderNames.join(', ')}`,
|
|
328
|
+
details: { providerNames: input.unavailableSelectedProviderNames },
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
if (input.presetName && !input.presetFound) {
|
|
332
|
+
issues.push({
|
|
333
|
+
code: 'preset_not_found',
|
|
334
|
+
message: `Selected preset "${input.presetName}" was not found in the template`,
|
|
335
|
+
details: { presetName: input.presetName },
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
if (input.providerMappingRequired) {
|
|
339
|
+
issues.push({
|
|
340
|
+
code: 'provider_mapping_required',
|
|
341
|
+
message: input.providerMappingRequired.canImport
|
|
342
|
+
? 'Provider selection requires a complete family mapping'
|
|
343
|
+
: 'Cannot import: some profile families have no available providers',
|
|
344
|
+
details: input.providerMappingRequired,
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
if (input.unavailableSelectedProfiles.length > 0) {
|
|
348
|
+
issues.push({
|
|
349
|
+
code: 'selected_profiles_unavailable',
|
|
350
|
+
message: `Import requires unavailable providers: ${input.unavailableSelectedProfiles.join(', ')}`,
|
|
351
|
+
details: { providerNames: input.unavailableSelectedProfiles },
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
if (input.activeSessions.length > 0) {
|
|
355
|
+
issues.push(buildActiveSessionIssue(input.activeSessions));
|
|
356
|
+
}
|
|
357
|
+
if (input.duplicateAgentNames.length > 0) {
|
|
358
|
+
issues.push({
|
|
359
|
+
code: 'duplicate_agent_names',
|
|
360
|
+
message: 'Template has duplicate agent names',
|
|
361
|
+
details: { agentNames: input.duplicateAgentNames },
|
|
273
362
|
});
|
|
274
363
|
}
|
|
364
|
+
return { ready: issues.length === 0, issues };
|
|
365
|
+
}
|
|
366
|
+
function buildActiveSessionIssue(activeSessions) {
|
|
367
|
+
return {
|
|
368
|
+
code: 'active_sessions',
|
|
369
|
+
message: 'Import aborted: active agent sessions detected',
|
|
370
|
+
details: { activeSessions },
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
function buildActiveSessionReadiness(activeSessions) {
|
|
374
|
+
return { ready: false, issues: [buildActiveSessionIssue(activeSessions)] };
|
|
375
|
+
}
|
|
376
|
+
function buildReadinessFailure(readiness, providerMappingRequired) {
|
|
377
|
+
return {
|
|
378
|
+
...buildReadinessFailureProperties(readiness, providerMappingRequired),
|
|
379
|
+
readiness,
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
function buildReadinessFailureProperties(readiness, providerMappingRequired) {
|
|
383
|
+
const firstIssue = readiness.issues[0];
|
|
384
|
+
const promptIssue = readiness.issues.find((issue) => issue.code === 'prompt_reference_validation');
|
|
385
|
+
return {
|
|
386
|
+
success: false,
|
|
387
|
+
mutationStarted: false,
|
|
388
|
+
error: firstIssue?.message ?? 'Import readiness check failed',
|
|
389
|
+
...(providerMappingRequired ? { providerMappingRequired } : {}),
|
|
390
|
+
...(promptIssue ? { promptReferenceValidation: promptIssue.details } : {}),
|
|
391
|
+
};
|
|
275
392
|
}
|
|
276
393
|
function buildOldAgentIdToNameMap(existingAgents) {
|
|
277
394
|
const oldAgentIdToName = new Map();
|
|
@@ -608,7 +725,7 @@ function buildImportSuccessResponse(args) {
|
|
|
608
725
|
prompts: args.promptTransfer.deleted,
|
|
609
726
|
profiles: args.existing.profiles.total,
|
|
610
727
|
agents: args.existing.agents.total,
|
|
611
|
-
statuses:
|
|
728
|
+
statuses: args.statusesDeleted,
|
|
612
729
|
watchers: args.existing.watchers.length,
|
|
613
730
|
subscribers: args.existing.subscribers.length,
|
|
614
731
|
scheduledEpics: args.existing.scheduledEpics?.total ?? 0,
|