@autohq/cli 0.1.414 → 0.1.415
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/agent-bridge.js +20 -2
- package/dist/index.js +231 -21
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -30820,7 +30820,7 @@ Object.assign(lookup, {
|
|
|
30820
30820
|
// package.json
|
|
30821
30821
|
var package_default = {
|
|
30822
30822
|
name: "@autohq/cli",
|
|
30823
|
-
version: "0.1.
|
|
30823
|
+
version: "0.1.415",
|
|
30824
30824
|
license: "SEE LICENSE IN README.md",
|
|
30825
30825
|
publishConfig: {
|
|
30826
30826
|
access: "public"
|
|
@@ -36373,11 +36373,19 @@ var ProjectApplySourceRequestSchema = external_exports.object({
|
|
|
36373
36373
|
dryRun: external_exports.boolean().default(false),
|
|
36374
36374
|
prune: external_exports.boolean().default(true)
|
|
36375
36375
|
});
|
|
36376
|
+
var ProjectApplySourceLocationSchema = external_exports.object({
|
|
36377
|
+
kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
|
|
36378
|
+
name: external_exports.string().min(1),
|
|
36379
|
+
path: external_exports.string().min(1),
|
|
36380
|
+
file: external_exports.string().min(1),
|
|
36381
|
+
line: external_exports.number().int().positive()
|
|
36382
|
+
});
|
|
36376
36383
|
var ProjectApplyRequestSchema = external_exports.object({
|
|
36377
36384
|
delete: external_exports.array(ProjectDeleteResourceSchema).default([]),
|
|
36378
36385
|
dryRun: external_exports.boolean().default(false),
|
|
36379
36386
|
prune: external_exports.boolean().default(false),
|
|
36380
36387
|
resources: external_exports.array(ProjectApplyResourceSchema).default([]),
|
|
36388
|
+
sourceLocations: external_exports.array(ProjectApplySourceLocationSchema).default([]),
|
|
36381
36389
|
assets: ProjectApplyAssetsSchema.default({})
|
|
36382
36390
|
});
|
|
36383
36391
|
var ProjectApplySystemConfigSchema = external_exports.object({
|
|
@@ -36420,7 +36428,12 @@ var ProjectApplyResponsePrunedSchema = external_exports.object({
|
|
|
36420
36428
|
});
|
|
36421
36429
|
var ProjectApplyPlanDiffSchema = external_exports.object({
|
|
36422
36430
|
action: external_exports.enum(["add", "remove", "change"]),
|
|
36423
|
-
path: external_exports.string().min(1)
|
|
36431
|
+
path: external_exports.string().min(1),
|
|
36432
|
+
source: ProjectApplySourceLocationSchema.omit({
|
|
36433
|
+
kind: true,
|
|
36434
|
+
name: true,
|
|
36435
|
+
path: true
|
|
36436
|
+
}).optional()
|
|
36424
36437
|
});
|
|
36425
36438
|
var ProjectApplyResponseSchema = external_exports.object({
|
|
36426
36439
|
dryRun: external_exports.boolean().default(false),
|
|
@@ -36433,6 +36446,11 @@ var ProjectApplyResponseSchema = external_exports.object({
|
|
|
36433
36446
|
kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
|
|
36434
36447
|
name: external_exports.string().min(1),
|
|
36435
36448
|
uid: external_exports.string().min(1).optional(),
|
|
36449
|
+
source: ProjectApplySourceLocationSchema.omit({
|
|
36450
|
+
kind: true,
|
|
36451
|
+
name: true,
|
|
36452
|
+
path: true
|
|
36453
|
+
}).optional(),
|
|
36436
36454
|
diff: external_exports.array(ProjectApplyPlanDiffSchema).optional(),
|
|
36437
36455
|
diffOmitted: external_exports.number().int().positive().optional()
|
|
36438
36456
|
})
|
package/dist/index.js
CHANGED
|
@@ -20477,7 +20477,7 @@ var init_project_service_accounts = __esm({
|
|
|
20477
20477
|
function projectApplyBundleStorageKey(sha256) {
|
|
20478
20478
|
return `project-apply-bundles/${sha256}.json`;
|
|
20479
20479
|
}
|
|
20480
|
-
var EnvironmentApplyDocumentSchema, IdentityApplyDocumentSchema, AgentApplyDocumentSchema, ConfigApplyDocumentSchema, ProjectApplyResourceSchema, PROJECT_RESOURCE_APPLY_ORDER, PROJECT_RESOURCE_KINDS, PROJECT_APPLY_RESOURCE_KINDS, PROJECT_APPLY_BUNDLE_VERSION, MAX_PROJECT_APPLY_BUNDLE_BYTES, PROJECT_APPLY_BUNDLE_CONTENT_TYPE, ProjectDeleteResourceBaseSchema, ProjectDeleteResourceSchema, AVATAR_ASSET_CONTENT_TYPES, MAX_AVATAR_ASSET_BASE64_LENGTH, ProjectApplyAssetSchema, ProjectApplyAssetsSchema, AvatarAssetUploadResponseSchema, ApplyBundlePathSchema, ProjectApplyBundleFileSchema, ProjectApplyBundleSchema, ProjectApplyBundleRefSchema, ProjectApplyBundleUploadRequestSchema, ProjectApplyBundleUploadResponseSchema, ProjectApplyBundleDirectoryEntrypointSchema, ProjectApplyBundleFileEntrypointSchema, ProjectApplyBundleEntrypointSchema, ProjectApplySourceSchema, ProjectApplySourceRequestSchema, ProjectApplyRequestSchema, ProjectApplySystemConfigSchema, ProjectAppliedResourceSchema, ProjectApplyDiagnosticSchema, ProjectApplyResponsePrunedSchema, ProjectApplyPlanDiffSchema, ProjectApplyResponseSchema, ProjectResourceApplyResultSchema, ProjectResourceApplyAuditActionSchema, ProjectResourceApplyOperationIdSchema, ProjectResourceApplyTriggerArtifactSchema, ProjectResourceApplyWorkflowErrorSchema, ProjectResourceApplyWorkflowInputSchema, ProjectResourceApplyWorkflowResultSchema;
|
|
20480
|
+
var EnvironmentApplyDocumentSchema, IdentityApplyDocumentSchema, AgentApplyDocumentSchema, ConfigApplyDocumentSchema, ProjectApplyResourceSchema, PROJECT_RESOURCE_APPLY_ORDER, PROJECT_RESOURCE_KINDS, PROJECT_APPLY_RESOURCE_KINDS, PROJECT_APPLY_BUNDLE_VERSION, MAX_PROJECT_APPLY_BUNDLE_BYTES, PROJECT_APPLY_BUNDLE_CONTENT_TYPE, ProjectDeleteResourceBaseSchema, ProjectDeleteResourceSchema, AVATAR_ASSET_CONTENT_TYPES, MAX_AVATAR_ASSET_BASE64_LENGTH, ProjectApplyAssetSchema, ProjectApplyAssetsSchema, AvatarAssetUploadResponseSchema, ApplyBundlePathSchema, ProjectApplyBundleFileSchema, ProjectApplyBundleSchema, ProjectApplyBundleRefSchema, ProjectApplyBundleUploadRequestSchema, ProjectApplyBundleUploadResponseSchema, ProjectApplyBundleDirectoryEntrypointSchema, ProjectApplyBundleFileEntrypointSchema, ProjectApplyBundleEntrypointSchema, ProjectApplySourceSchema, ProjectApplySourceRequestSchema, ProjectApplySourceLocationSchema, ProjectApplyRequestSchema, ProjectApplySystemConfigSchema, ProjectAppliedResourceSchema, ProjectApplyDiagnosticSchema, ProjectApplyResponsePrunedSchema, ProjectApplyPlanDiffSchema, ProjectApplyResponseSchema, ProjectResourceApplyResultSchema, ProjectResourceApplyAuditActionSchema, ProjectResourceApplyOperationIdSchema, ProjectResourceApplyTriggerArtifactSchema, ProjectResourceApplyWorkflowErrorSchema, ProjectResourceApplyWorkflowInputSchema, ProjectResourceApplyWorkflowResultSchema;
|
|
20481
20481
|
var init_project_resources = __esm({
|
|
20482
20482
|
"../../packages/schemas/src/project-resources.ts"() {
|
|
20483
20483
|
"use strict";
|
|
@@ -20616,11 +20616,19 @@ var init_project_resources = __esm({
|
|
|
20616
20616
|
dryRun: external_exports.boolean().default(false),
|
|
20617
20617
|
prune: external_exports.boolean().default(true)
|
|
20618
20618
|
});
|
|
20619
|
+
ProjectApplySourceLocationSchema = external_exports.object({
|
|
20620
|
+
kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
|
|
20621
|
+
name: external_exports.string().min(1),
|
|
20622
|
+
path: external_exports.string().min(1),
|
|
20623
|
+
file: external_exports.string().min(1),
|
|
20624
|
+
line: external_exports.number().int().positive()
|
|
20625
|
+
});
|
|
20619
20626
|
ProjectApplyRequestSchema = external_exports.object({
|
|
20620
20627
|
delete: external_exports.array(ProjectDeleteResourceSchema).default([]),
|
|
20621
20628
|
dryRun: external_exports.boolean().default(false),
|
|
20622
20629
|
prune: external_exports.boolean().default(false),
|
|
20623
20630
|
resources: external_exports.array(ProjectApplyResourceSchema).default([]),
|
|
20631
|
+
sourceLocations: external_exports.array(ProjectApplySourceLocationSchema).default([]),
|
|
20624
20632
|
assets: ProjectApplyAssetsSchema.default({})
|
|
20625
20633
|
});
|
|
20626
20634
|
ProjectApplySystemConfigSchema = external_exports.object({
|
|
@@ -20663,7 +20671,12 @@ var init_project_resources = __esm({
|
|
|
20663
20671
|
});
|
|
20664
20672
|
ProjectApplyPlanDiffSchema = external_exports.object({
|
|
20665
20673
|
action: external_exports.enum(["add", "remove", "change"]),
|
|
20666
|
-
path: external_exports.string().min(1)
|
|
20674
|
+
path: external_exports.string().min(1),
|
|
20675
|
+
source: ProjectApplySourceLocationSchema.omit({
|
|
20676
|
+
kind: true,
|
|
20677
|
+
name: true,
|
|
20678
|
+
path: true
|
|
20679
|
+
}).optional()
|
|
20667
20680
|
});
|
|
20668
20681
|
ProjectApplyResponseSchema = external_exports.object({
|
|
20669
20682
|
dryRun: external_exports.boolean().default(false),
|
|
@@ -20676,6 +20689,11 @@ var init_project_resources = __esm({
|
|
|
20676
20689
|
kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
|
|
20677
20690
|
name: external_exports.string().min(1),
|
|
20678
20691
|
uid: external_exports.string().min(1).optional(),
|
|
20692
|
+
source: ProjectApplySourceLocationSchema.omit({
|
|
20693
|
+
kind: true,
|
|
20694
|
+
name: true,
|
|
20695
|
+
path: true
|
|
20696
|
+
}).optional(),
|
|
20679
20697
|
diff: external_exports.array(ProjectApplyPlanDiffSchema).optional(),
|
|
20680
20698
|
diffOmitted: external_exports.number().int().positive().optional()
|
|
20681
20699
|
})
|
|
@@ -38611,7 +38629,7 @@ var init_package = __esm({
|
|
|
38611
38629
|
"package.json"() {
|
|
38612
38630
|
package_default = {
|
|
38613
38631
|
name: "@autohq/cli",
|
|
38614
|
-
version: "0.1.
|
|
38632
|
+
version: "0.1.415",
|
|
38615
38633
|
license: "SEE LICENSE IN README.md",
|
|
38616
38634
|
publishConfig: {
|
|
38617
38635
|
access: "public"
|
|
@@ -39720,9 +39738,113 @@ var init_agent_document_merge = __esm({
|
|
|
39720
39738
|
}
|
|
39721
39739
|
});
|
|
39722
39740
|
|
|
39741
|
+
// ../../packages/schemas/src/project-apply-files/source-locations.ts
|
|
39742
|
+
import { LineCounter, isMap, isSeq, parseAllDocuments } from "yaml";
|
|
39743
|
+
function readProjectConfigSourceLocations(file2) {
|
|
39744
|
+
const locations = readYamlLocations(file2, "spec");
|
|
39745
|
+
return Object.values(locations).map((location) => ({
|
|
39746
|
+
...location,
|
|
39747
|
+
kind: RESOURCE_KIND_CONFIG,
|
|
39748
|
+
name: PROJECT_CONFIG_RESOURCE_NAME
|
|
39749
|
+
}));
|
|
39750
|
+
}
|
|
39751
|
+
function readAgentDraftSourceLocations(path2, fileIndex) {
|
|
39752
|
+
const normalizedPath = normalizeSourcePath(path2);
|
|
39753
|
+
if (normalizedPath.startsWith("packages/")) {
|
|
39754
|
+
return {};
|
|
39755
|
+
}
|
|
39756
|
+
const file2 = fileIndex.get(normalizedPath);
|
|
39757
|
+
if (!file2) {
|
|
39758
|
+
return {};
|
|
39759
|
+
}
|
|
39760
|
+
return readYamlLocations(file2, "");
|
|
39761
|
+
}
|
|
39762
|
+
function readYamlLocations(file2, rootPath) {
|
|
39763
|
+
const source = Buffer.from(file2.contentBase64, "base64").toString("utf8");
|
|
39764
|
+
const lineCounter = new LineCounter();
|
|
39765
|
+
const documents = parseAllDocuments(source, {
|
|
39766
|
+
keepSourceTokens: true,
|
|
39767
|
+
lineCounter
|
|
39768
|
+
});
|
|
39769
|
+
if (documents.length !== 1 || documents[0]?.errors.length) {
|
|
39770
|
+
return {};
|
|
39771
|
+
}
|
|
39772
|
+
const locations = {};
|
|
39773
|
+
collectNodeLocations(documents[0]?.contents, rootPath, locations, {
|
|
39774
|
+
file: normalizeSourcePath(file2.path),
|
|
39775
|
+
lineCounter
|
|
39776
|
+
});
|
|
39777
|
+
return locations;
|
|
39778
|
+
}
|
|
39779
|
+
function collectNodeLocations(node, path2, locations, context) {
|
|
39780
|
+
if (isMap(node)) {
|
|
39781
|
+
for (const pair of node.items) {
|
|
39782
|
+
const key = String(pair.key?.toJSON());
|
|
39783
|
+
if (["import", "imports", "remove", "variables"].includes(key)) {
|
|
39784
|
+
continue;
|
|
39785
|
+
}
|
|
39786
|
+
const childPath = propertyPath(path2, key);
|
|
39787
|
+
recordLocation(
|
|
39788
|
+
pair.key,
|
|
39789
|
+
childPath,
|
|
39790
|
+
locations,
|
|
39791
|
+
context
|
|
39792
|
+
);
|
|
39793
|
+
collectNodeLocations(pair.value, childPath, locations, context);
|
|
39794
|
+
}
|
|
39795
|
+
return;
|
|
39796
|
+
}
|
|
39797
|
+
if (isSeq(node)) {
|
|
39798
|
+
node.items.forEach((item, index) => {
|
|
39799
|
+
const childPath = `${path2}[${index}]`;
|
|
39800
|
+
recordLocation(
|
|
39801
|
+
item,
|
|
39802
|
+
childPath,
|
|
39803
|
+
locations,
|
|
39804
|
+
context
|
|
39805
|
+
);
|
|
39806
|
+
collectNodeLocations(item, childPath, locations, context);
|
|
39807
|
+
});
|
|
39808
|
+
}
|
|
39809
|
+
}
|
|
39810
|
+
function recordLocation(node, path2, locations, context) {
|
|
39811
|
+
const offset = node?.range?.[0];
|
|
39812
|
+
if (offset === void 0) {
|
|
39813
|
+
return;
|
|
39814
|
+
}
|
|
39815
|
+
const locationPath = path2.startsWith("spec.") ? path2 : compiledPath(path2);
|
|
39816
|
+
locations[locationPath] = {
|
|
39817
|
+
path: locationPath,
|
|
39818
|
+
file: context.file,
|
|
39819
|
+
line: context.lineCounter.linePos(offset).line
|
|
39820
|
+
};
|
|
39821
|
+
}
|
|
39822
|
+
function compiledPath(path2) {
|
|
39823
|
+
const topLevel = path2.match(/^[^.[]+/)?.[0];
|
|
39824
|
+
if (!topLevel) {
|
|
39825
|
+
return path2;
|
|
39826
|
+
}
|
|
39827
|
+
const target = ["name", "labels", "annotations"].includes(topLevel) ? "metadata" : "spec";
|
|
39828
|
+
return `${target}.${path2}`;
|
|
39829
|
+
}
|
|
39830
|
+
function propertyPath(parent, key) {
|
|
39831
|
+
const segment = /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? key : `[${JSON.stringify(key)}]`;
|
|
39832
|
+
if (!parent) {
|
|
39833
|
+
return segment;
|
|
39834
|
+
}
|
|
39835
|
+
return segment.startsWith("[") ? `${parent}${segment}` : `${parent}.${segment}`;
|
|
39836
|
+
}
|
|
39837
|
+
var init_source_locations = __esm({
|
|
39838
|
+
"../../packages/schemas/src/project-apply-files/source-locations.ts"() {
|
|
39839
|
+
"use strict";
|
|
39840
|
+
init_project_config();
|
|
39841
|
+
init_source();
|
|
39842
|
+
}
|
|
39843
|
+
});
|
|
39844
|
+
|
|
39723
39845
|
// ../../packages/schemas/src/project-apply-files/agent-fields/helpers.ts
|
|
39724
39846
|
function emptyAgentDraft() {
|
|
39725
|
-
return { metadata: {}, spec: {} };
|
|
39847
|
+
return { metadata: {}, spec: {}, sourceLocations: {} };
|
|
39726
39848
|
}
|
|
39727
39849
|
function cloneAgentDraft(draft) {
|
|
39728
39850
|
return structuredClone(draft);
|
|
@@ -40033,7 +40155,7 @@ function splitMetadataAndSpec(document) {
|
|
|
40033
40155
|
}
|
|
40034
40156
|
spec[key] = value;
|
|
40035
40157
|
}
|
|
40036
|
-
return { metadata, spec };
|
|
40158
|
+
return { metadata, spec, sourceLocations: {} };
|
|
40037
40159
|
}
|
|
40038
40160
|
function standaloneResourceError(kind, path2) {
|
|
40039
40161
|
if (kind === RESOURCE_KIND_ENVIRONMENT) {
|
|
@@ -40438,6 +40560,7 @@ function parseAgentDraft(document, path2, fileIndex) {
|
|
|
40438
40560
|
const sanitized = sanitizedAgentDocument2(document);
|
|
40439
40561
|
assertNoLegacyEnvelopeFields(sanitized, path2);
|
|
40440
40562
|
const draft = emptyAgentDraft();
|
|
40563
|
+
draft.sourceLocations = readAgentDraftSourceLocations(path2, fileIndex);
|
|
40441
40564
|
for (const [key, value] of Object.entries(sanitized)) {
|
|
40442
40565
|
if (value === void 0) {
|
|
40443
40566
|
continue;
|
|
@@ -40460,7 +40583,8 @@ function parseAgentDraft(document, path2, fileIndex) {
|
|
|
40460
40583
|
function mergeAgentDrafts(base, override) {
|
|
40461
40584
|
return {
|
|
40462
40585
|
metadata: mergeDraftTarget("metadata", base.metadata, override.metadata),
|
|
40463
|
-
spec: mergeDraftTarget("spec", base.spec, override.spec)
|
|
40586
|
+
spec: mergeDraftTarget("spec", base.spec, override.spec),
|
|
40587
|
+
sourceLocations: mergeSourceLocations(base, override)
|
|
40464
40588
|
};
|
|
40465
40589
|
}
|
|
40466
40590
|
function applyAgentDraftRemoval(draft, removal) {
|
|
@@ -40478,8 +40602,35 @@ function applyAgentDraftRemoval(draft, removal) {
|
|
|
40478
40602
|
if (updated !== void 0 || current !== void 0) {
|
|
40479
40603
|
target[removal.target] = updated;
|
|
40480
40604
|
}
|
|
40605
|
+
for (const name of removal.names) {
|
|
40606
|
+
const prefix = `spec.${removal.target}.${name}`;
|
|
40607
|
+
next.sourceLocations = Object.fromEntries(
|
|
40608
|
+
Object.entries(next.sourceLocations).filter(
|
|
40609
|
+
([path2]) => path2 !== prefix && !path2.startsWith(`${prefix}.`)
|
|
40610
|
+
)
|
|
40611
|
+
);
|
|
40612
|
+
}
|
|
40481
40613
|
return next;
|
|
40482
40614
|
}
|
|
40615
|
+
function mergeSourceLocations(base, override) {
|
|
40616
|
+
let merged = { ...base.sourceLocations };
|
|
40617
|
+
for (const target of ["metadata", "spec"]) {
|
|
40618
|
+
for (const [key, value] of Object.entries(override[target])) {
|
|
40619
|
+
if (value === void 0) {
|
|
40620
|
+
continue;
|
|
40621
|
+
}
|
|
40622
|
+
const prefix = `${target}.${key}`;
|
|
40623
|
+
if (!isRecord2(value)) {
|
|
40624
|
+
merged = Object.fromEntries(
|
|
40625
|
+
Object.entries(merged).filter(
|
|
40626
|
+
([path2]) => path2 !== prefix && !path2.startsWith(`${prefix}.`)
|
|
40627
|
+
)
|
|
40628
|
+
);
|
|
40629
|
+
}
|
|
40630
|
+
}
|
|
40631
|
+
}
|
|
40632
|
+
return { ...merged, ...override.sourceLocations };
|
|
40633
|
+
}
|
|
40483
40634
|
function assertSupportedAgentRemovalTarget(target) {
|
|
40484
40635
|
const supported = supportedRemovalTargets();
|
|
40485
40636
|
if (!supported.includes(target)) {
|
|
@@ -40549,6 +40700,8 @@ var AGENT_FIELDS;
|
|
|
40549
40700
|
var init_agent_fields = __esm({
|
|
40550
40701
|
"../../packages/schemas/src/project-apply-files/agent-fields/index.ts"() {
|
|
40551
40702
|
"use strict";
|
|
40703
|
+
init_source();
|
|
40704
|
+
init_source_locations();
|
|
40552
40705
|
init_file_backed_string();
|
|
40553
40706
|
init_helpers();
|
|
40554
40707
|
init_inline_resource();
|
|
@@ -40677,11 +40830,52 @@ function readApplyDocument(path2, document, fileIndex, contextVariables) {
|
|
|
40677
40830
|
fileIndex,
|
|
40678
40831
|
contextVariables
|
|
40679
40832
|
);
|
|
40680
|
-
return result.resources.map((resource) =>
|
|
40681
|
-
|
|
40682
|
-
|
|
40683
|
-
|
|
40684
|
-
|
|
40833
|
+
return result.resources.map((resource) => {
|
|
40834
|
+
let generatedField;
|
|
40835
|
+
switch (resource.kind) {
|
|
40836
|
+
case "environment":
|
|
40837
|
+
generatedField = "spec.environment";
|
|
40838
|
+
break;
|
|
40839
|
+
case "identity":
|
|
40840
|
+
generatedField = "spec.identity";
|
|
40841
|
+
break;
|
|
40842
|
+
default:
|
|
40843
|
+
generatedField = void 0;
|
|
40844
|
+
break;
|
|
40845
|
+
}
|
|
40846
|
+
const generatedLocation = generatedField ? result.sourceLocations[generatedField] : void 0;
|
|
40847
|
+
return {
|
|
40848
|
+
resource,
|
|
40849
|
+
generatedFromAgent: resource !== result.resource,
|
|
40850
|
+
sourcePath: normalizeSourcePath(path2),
|
|
40851
|
+
sourceLocations: sourceLocationsForCompiledResource({
|
|
40852
|
+
resource,
|
|
40853
|
+
primaryResource: result.resource,
|
|
40854
|
+
draftLocations: result.sourceLocations,
|
|
40855
|
+
generatedLocation
|
|
40856
|
+
})
|
|
40857
|
+
};
|
|
40858
|
+
});
|
|
40859
|
+
}
|
|
40860
|
+
function sourceLocationsForCompiledResource(input) {
|
|
40861
|
+
if (input.resource === input.primaryResource) {
|
|
40862
|
+
return Object.values(input.draftLocations).map((location) => ({
|
|
40863
|
+
...location,
|
|
40864
|
+
kind: input.resource.kind,
|
|
40865
|
+
name: input.resource.metadata.name
|
|
40866
|
+
}));
|
|
40867
|
+
}
|
|
40868
|
+
if (!input.generatedLocation) {
|
|
40869
|
+
return [];
|
|
40870
|
+
}
|
|
40871
|
+
return [
|
|
40872
|
+
{
|
|
40873
|
+
...input.generatedLocation,
|
|
40874
|
+
kind: input.resource.kind,
|
|
40875
|
+
name: input.resource.metadata.name,
|
|
40876
|
+
path: "$"
|
|
40877
|
+
}
|
|
40878
|
+
];
|
|
40685
40879
|
}
|
|
40686
40880
|
function validateAgentFragmentDocument(document, path2, context) {
|
|
40687
40881
|
const normalizedPath = normalizeSourcePath(path2);
|
|
@@ -40740,15 +40934,16 @@ function conflictingGeneratedResourceMessage(key, existing, record2) {
|
|
|
40740
40934
|
return `Conflicting generated resource "${key}" from agent authoring: ${location}. Inline generated resources must be identical when they share a name.`;
|
|
40741
40935
|
}
|
|
40742
40936
|
function compileAgentDocumentValue(document, path2, fileIndex, contextVariables) {
|
|
40743
|
-
|
|
40744
|
-
|
|
40745
|
-
|
|
40746
|
-
|
|
40747
|
-
|
|
40748
|
-
|
|
40749
|
-
|
|
40750
|
-
path2
|
|
40751
|
-
|
|
40937
|
+
const draft = compileAgentDocument2(document, path2, {
|
|
40938
|
+
fileIndex,
|
|
40939
|
+
stack: [],
|
|
40940
|
+
variables: /* @__PURE__ */ new Map(),
|
|
40941
|
+
...contextVariables && Object.keys(contextVariables).length > 0 ? { contextVariables: new Map(Object.entries(contextVariables)) } : {}
|
|
40942
|
+
});
|
|
40943
|
+
return {
|
|
40944
|
+
...compileAgentDraftResources(draft, path2),
|
|
40945
|
+
sourceLocations: draft.sourceLocations
|
|
40946
|
+
};
|
|
40752
40947
|
}
|
|
40753
40948
|
function compileAgentDocument2(document, path2, context) {
|
|
40754
40949
|
const normalizedPath = normalizeSourcePath(path2);
|
|
@@ -41101,11 +41296,18 @@ function readProjectApplyDirectorySource(input) {
|
|
|
41101
41296
|
...request.resources.map((resource) => ({
|
|
41102
41297
|
resource,
|
|
41103
41298
|
generatedFromAgent: resource.kind !== RESOURCE_KIND_AGENT,
|
|
41104
|
-
sourcePath: file2.path
|
|
41299
|
+
sourcePath: file2.path,
|
|
41300
|
+
sourceLocations: request.sourceLocations.filter(
|
|
41301
|
+
(location) => location.kind === resource.kind && location.name === resource.metadata.name
|
|
41302
|
+
)
|
|
41105
41303
|
}))
|
|
41106
41304
|
);
|
|
41107
41305
|
}
|
|
41306
|
+
const configFile = files.find(
|
|
41307
|
+
(file2) => ["config.yaml", "config.yml"].map((name) => sourcePathJoin(resourceRoot, name)).includes(normalizeSourcePath(file2.path))
|
|
41308
|
+
);
|
|
41108
41309
|
const configResource = readProjectConfigResource(files, resourceRoot);
|
|
41310
|
+
const configSourceLocations = configFile ? readProjectConfigSourceLocations(configFile) : [];
|
|
41109
41311
|
const resources = [
|
|
41110
41312
|
...dedupeGeneratedResources(resourceRecords),
|
|
41111
41313
|
...configResource ? [configResource] : []
|
|
@@ -41118,6 +41320,10 @@ function readProjectApplyDirectorySource(input) {
|
|
|
41118
41320
|
dryRun: input.dryRun ?? false,
|
|
41119
41321
|
prune: input.prune ?? true,
|
|
41120
41322
|
resources,
|
|
41323
|
+
sourceLocations: [
|
|
41324
|
+
...resourceRecords.flatMap((record2) => record2.sourceLocations),
|
|
41325
|
+
...configSourceLocations
|
|
41326
|
+
],
|
|
41121
41327
|
assets: readApplyAssets(resources, input.readAsset)
|
|
41122
41328
|
});
|
|
41123
41329
|
}
|
|
@@ -41155,6 +41361,9 @@ function readProjectApplyDocumentSourceFile(file2, options = {}) {
|
|
|
41155
41361
|
dryRun: false,
|
|
41156
41362
|
prune: false,
|
|
41157
41363
|
resources: dedupeGeneratedResources(resourceRecords),
|
|
41364
|
+
sourceLocations: resourceRecords.flatMap(
|
|
41365
|
+
(record2) => record2.sourceLocations
|
|
41366
|
+
),
|
|
41158
41367
|
assets: {}
|
|
41159
41368
|
});
|
|
41160
41369
|
}
|
|
@@ -41276,6 +41485,7 @@ var init_project_apply_files = __esm({
|
|
|
41276
41485
|
init_apply_result();
|
|
41277
41486
|
init_assets();
|
|
41278
41487
|
init_source();
|
|
41488
|
+
init_source_locations();
|
|
41279
41489
|
init_template_injection();
|
|
41280
41490
|
init_assets();
|
|
41281
41491
|
init_template_injection();
|