@autohq/cli 0.1.135 → 0.1.137
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 +22 -5
- package/dist/index.js +163 -26
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -19793,7 +19793,8 @@ var SERVICE_ACCOUNT_READ_ONLY_SCOPES = [
|
|
|
19793
19793
|
"environments:read",
|
|
19794
19794
|
"tools:read",
|
|
19795
19795
|
"sessions:read",
|
|
19796
|
-
"runs:read"
|
|
19796
|
+
"runs:read",
|
|
19797
|
+
"provider_grants:read"
|
|
19797
19798
|
];
|
|
19798
19799
|
var SERVICE_ACCOUNT_SCOPE_PRESETS = {
|
|
19799
19800
|
"read-only": SERVICE_ACCOUNT_READ_ONLY_SCOPES,
|
|
@@ -19801,7 +19802,8 @@ var SERVICE_ACCOUNT_SCOPE_PRESETS = {
|
|
|
19801
19802
|
...SERVICE_ACCOUNT_READ_ONLY_SCOPES,
|
|
19802
19803
|
"environments:write",
|
|
19803
19804
|
"tools:write",
|
|
19804
|
-
"sessions:write"
|
|
19805
|
+
"sessions:write",
|
|
19806
|
+
"provider_grants:use"
|
|
19805
19807
|
]
|
|
19806
19808
|
};
|
|
19807
19809
|
var ServiceAccountScopePresetSchema = external_exports.enum(["read-only", "applier"]);
|
|
@@ -20623,11 +20625,18 @@ function resourceApplyDocumentSchema(kind, spec) {
|
|
|
20623
20625
|
}
|
|
20624
20626
|
|
|
20625
20627
|
// ../../packages/schemas/src/connections.ts
|
|
20628
|
+
var RESOURCE_KIND_CONNECTION = "connection";
|
|
20626
20629
|
var ConnectionNameSchema = ResourceNameSchema;
|
|
20627
20630
|
var ProviderConnectionReferenceSchema = external_exports.object({
|
|
20628
20631
|
provider: ProviderNameSchema,
|
|
20629
20632
|
connection: ConnectionNameSchema
|
|
20630
20633
|
});
|
|
20634
|
+
var ProjectConnectionAllocationSpecSchema = external_exports.object({
|
|
20635
|
+
provider: ProviderNameSchema
|
|
20636
|
+
});
|
|
20637
|
+
var ProjectConnectionAllocationResourceSchema = resourceEnvelopeSchema(
|
|
20638
|
+
ProjectConnectionAllocationSpecSchema
|
|
20639
|
+
);
|
|
20631
20640
|
var GithubConnectionAccountSchema = external_exports.object({
|
|
20632
20641
|
login: external_exports.string().trim().min(1),
|
|
20633
20642
|
type: external_exports.enum(["User", "Organization"])
|
|
@@ -21909,18 +21918,24 @@ var ProjectApplyResourceSchema = external_exports.preprocess(
|
|
|
21909
21918
|
])
|
|
21910
21919
|
);
|
|
21911
21920
|
var PROJECT_RESOURCE_APPLY_ORDER = [
|
|
21912
|
-
|
|
21921
|
+
RESOURCE_KIND_CONNECTION,
|
|
21913
21922
|
RESOURCE_KIND_IDENTITY,
|
|
21923
|
+
RESOURCE_KIND_ENVIRONMENT,
|
|
21914
21924
|
RESOURCE_KIND_SESSION
|
|
21915
21925
|
];
|
|
21916
21926
|
var PROJECT_RESOURCE_KINDS = PROJECT_RESOURCE_APPLY_ORDER;
|
|
21927
|
+
var PROJECT_APPLY_RESOURCE_KINDS = [
|
|
21928
|
+
RESOURCE_KIND_IDENTITY,
|
|
21929
|
+
RESOURCE_KIND_ENVIRONMENT,
|
|
21930
|
+
RESOURCE_KIND_SESSION
|
|
21931
|
+
];
|
|
21917
21932
|
var ProjectDeleteResourceBaseSchema = external_exports.object({
|
|
21918
21933
|
name: external_exports.string().trim().min(1)
|
|
21919
21934
|
});
|
|
21920
21935
|
var ProjectDeleteResourceSchema = external_exports.preprocess(
|
|
21921
21936
|
normalizeLegacySessionKind,
|
|
21922
21937
|
ProjectDeleteResourceBaseSchema.extend({
|
|
21923
|
-
kind: external_exports.enum(
|
|
21938
|
+
kind: external_exports.enum(PROJECT_APPLY_RESOURCE_KINDS)
|
|
21924
21939
|
})
|
|
21925
21940
|
);
|
|
21926
21941
|
var AVATAR_ASSET_CONTENT_TYPES = ["image/png", "image/jpeg"];
|
|
@@ -21959,6 +21974,7 @@ var ProjectApplySystemConfigSchema = external_exports.object({
|
|
|
21959
21974
|
spec: ProjectApplyRequestSchema
|
|
21960
21975
|
});
|
|
21961
21976
|
var ProjectAppliedResourceSchema = external_exports.union([
|
|
21977
|
+
ProjectConnectionAllocationResourceSchema,
|
|
21962
21978
|
EnvironmentResourceSchema,
|
|
21963
21979
|
IdentityResourceSchema,
|
|
21964
21980
|
SessionResourceSchema
|
|
@@ -21970,6 +21986,7 @@ var ProjectApplyDiagnosticSchema = external_exports.object({
|
|
|
21970
21986
|
message: external_exports.string().min(1),
|
|
21971
21987
|
action: external_exports.enum(["create", "update", "unchanged"]),
|
|
21972
21988
|
kind: external_exports.enum([
|
|
21989
|
+
RESOURCE_KIND_CONNECTION,
|
|
21973
21990
|
RESOURCE_KIND_ENVIRONMENT,
|
|
21974
21991
|
RESOURCE_KIND_IDENTITY,
|
|
21975
21992
|
RESOURCE_KIND_SESSION
|
|
@@ -26273,7 +26290,7 @@ Object.assign(lookup, {
|
|
|
26273
26290
|
// package.json
|
|
26274
26291
|
var package_default = {
|
|
26275
26292
|
name: "@autohq/cli",
|
|
26276
|
-
version: "0.1.
|
|
26293
|
+
version: "0.1.137",
|
|
26277
26294
|
license: "SEE LICENSE IN README.md",
|
|
26278
26295
|
publishConfig: {
|
|
26279
26296
|
access: "public"
|
package/dist/index.js
CHANGED
|
@@ -16191,7 +16191,8 @@ var init_auth = __esm({
|
|
|
16191
16191
|
"environments:read",
|
|
16192
16192
|
"tools:read",
|
|
16193
16193
|
"sessions:read",
|
|
16194
|
-
"runs:read"
|
|
16194
|
+
"runs:read",
|
|
16195
|
+
"provider_grants:read"
|
|
16195
16196
|
];
|
|
16196
16197
|
SERVICE_ACCOUNT_SCOPE_PRESETS = {
|
|
16197
16198
|
"read-only": SERVICE_ACCOUNT_READ_ONLY_SCOPES,
|
|
@@ -16199,7 +16200,8 @@ var init_auth = __esm({
|
|
|
16199
16200
|
...SERVICE_ACCOUNT_READ_ONLY_SCOPES,
|
|
16200
16201
|
"environments:write",
|
|
16201
16202
|
"tools:write",
|
|
16202
|
-
"sessions:write"
|
|
16203
|
+
"sessions:write",
|
|
16204
|
+
"provider_grants:use"
|
|
16203
16205
|
]
|
|
16204
16206
|
};
|
|
16205
16207
|
ServiceAccountScopePresetSchema = external_exports.enum(["read-only", "applier"]);
|
|
@@ -17159,7 +17161,7 @@ var init_resources = __esm({
|
|
|
17159
17161
|
});
|
|
17160
17162
|
|
|
17161
17163
|
// ../../packages/schemas/src/connections.ts
|
|
17162
|
-
var ConnectionNameSchema, ProviderConnectionReferenceSchema, GithubConnectionAccountSchema, GithubConnectionRepositorySchema, GITHUB_CONNECTION_EVENTS, GithubConnectionEventSchema, GithubConnectionSpecSchema, ConnectionSpecSchema, ConnectionResourceSchema, ConnectionApplyRequestSchema, ConnectionStartRequestSchema, ConnectionProviderDescriptorSchema, ConnectionProviderListResponseSchema, ConnectionStartResponseSchema, TelegramConnectionCreateRequestSchema, TelegramManagerBotSummarySchema, TelegramConnectionCreateResponseSchema, ConnectionAllowRequestSchema, SlackConfigTokenRegisterRequestSchema, SlackConfigTokenRegisterResponseSchema, ConnectionAllowResponseSchema, ConnectionRemoveRequestSchema, ConnectionRemoveResponseSchema;
|
|
17164
|
+
var RESOURCE_KIND_CONNECTION, ConnectionNameSchema, ProviderConnectionReferenceSchema, ProjectConnectionAllocationSpecSchema, ProjectConnectionAllocationResourceSchema, GithubConnectionAccountSchema, GithubConnectionRepositorySchema, GITHUB_CONNECTION_EVENTS, GithubConnectionEventSchema, GithubConnectionSpecSchema, ConnectionSpecSchema, ConnectionResourceSchema, ConnectionApplyRequestSchema, ConnectionStartRequestSchema, ConnectionProviderDescriptorSchema, ConnectionProviderListResponseSchema, ConnectionStartResponseSchema, TelegramConnectionCreateRequestSchema, TelegramManagerBotSummarySchema, TelegramConnectionCreateResponseSchema, ConnectionAllowRequestSchema, SlackConfigTokenRegisterRequestSchema, SlackConfigTokenRegisterResponseSchema, ConnectionAllowResponseSchema, ConnectionRemoveRequestSchema, ConnectionRemoveResponseSchema;
|
|
17163
17165
|
var init_connections = __esm({
|
|
17164
17166
|
"../../packages/schemas/src/connections.ts"() {
|
|
17165
17167
|
"use strict";
|
|
@@ -17167,11 +17169,18 @@ var init_connections = __esm({
|
|
|
17167
17169
|
init_ids();
|
|
17168
17170
|
init_provider_grants();
|
|
17169
17171
|
init_resources();
|
|
17172
|
+
RESOURCE_KIND_CONNECTION = "connection";
|
|
17170
17173
|
ConnectionNameSchema = ResourceNameSchema;
|
|
17171
17174
|
ProviderConnectionReferenceSchema = external_exports.object({
|
|
17172
17175
|
provider: ProviderNameSchema,
|
|
17173
17176
|
connection: ConnectionNameSchema
|
|
17174
17177
|
});
|
|
17178
|
+
ProjectConnectionAllocationSpecSchema = external_exports.object({
|
|
17179
|
+
provider: ProviderNameSchema
|
|
17180
|
+
});
|
|
17181
|
+
ProjectConnectionAllocationResourceSchema = resourceEnvelopeSchema(
|
|
17182
|
+
ProjectConnectionAllocationSpecSchema
|
|
17183
|
+
);
|
|
17175
17184
|
GithubConnectionAccountSchema = external_exports.object({
|
|
17176
17185
|
login: external_exports.string().trim().min(1),
|
|
17177
17186
|
type: external_exports.enum(["User", "Organization"])
|
|
@@ -18595,11 +18604,12 @@ function normalizeLegacySessionKind(value) {
|
|
|
18595
18604
|
function isRecord(value) {
|
|
18596
18605
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
18597
18606
|
}
|
|
18598
|
-
var EnvironmentApplyDocumentSchema, IdentityApplyDocumentSchema, SessionApplyDocumentSchema, ProjectApplyResourceSchema, PROJECT_RESOURCE_APPLY_ORDER, PROJECT_RESOURCE_KINDS, ProjectDeleteResourceBaseSchema, ProjectDeleteResourceSchema, AVATAR_ASSET_CONTENT_TYPES, MAX_AVATAR_ASSET_BASE64_LENGTH, ProjectApplyAssetSchema, ProjectApplyAssetsSchema, AvatarAssetUploadRequestSchema, AvatarAssetUploadResponseSchema, ProjectApplyRequestSchema, ProjectApplySystemConfigSchema, ProjectAppliedResourceSchema, ProjectApplyDiagnosticSchema, ProjectApplyResponseResourceKindSchema, ProjectApplyResponseSchema;
|
|
18607
|
+
var EnvironmentApplyDocumentSchema, IdentityApplyDocumentSchema, SessionApplyDocumentSchema, ProjectApplyResourceSchema, PROJECT_RESOURCE_APPLY_ORDER, PROJECT_RESOURCE_KINDS, PROJECT_APPLY_RESOURCE_KINDS, ProjectDeleteResourceBaseSchema, ProjectDeleteResourceSchema, AVATAR_ASSET_CONTENT_TYPES, MAX_AVATAR_ASSET_BASE64_LENGTH, ProjectApplyAssetSchema, ProjectApplyAssetsSchema, AvatarAssetUploadRequestSchema, AvatarAssetUploadResponseSchema, ProjectApplyRequestSchema, ProjectApplySystemConfigSchema, ProjectAppliedResourceSchema, ProjectApplyDiagnosticSchema, ProjectApplyResponseResourceKindSchema, ProjectApplyResponseSchema;
|
|
18599
18608
|
var init_project_resources = __esm({
|
|
18600
18609
|
"../../packages/schemas/src/project-resources.ts"() {
|
|
18601
18610
|
"use strict";
|
|
18602
18611
|
init_zod();
|
|
18612
|
+
init_connections();
|
|
18603
18613
|
init_environments();
|
|
18604
18614
|
init_identities();
|
|
18605
18615
|
init_resources();
|
|
@@ -18625,18 +18635,24 @@ var init_project_resources = __esm({
|
|
|
18625
18635
|
])
|
|
18626
18636
|
);
|
|
18627
18637
|
PROJECT_RESOURCE_APPLY_ORDER = [
|
|
18628
|
-
|
|
18638
|
+
RESOURCE_KIND_CONNECTION,
|
|
18629
18639
|
RESOURCE_KIND_IDENTITY,
|
|
18640
|
+
RESOURCE_KIND_ENVIRONMENT,
|
|
18630
18641
|
RESOURCE_KIND_SESSION
|
|
18631
18642
|
];
|
|
18632
18643
|
PROJECT_RESOURCE_KINDS = PROJECT_RESOURCE_APPLY_ORDER;
|
|
18644
|
+
PROJECT_APPLY_RESOURCE_KINDS = [
|
|
18645
|
+
RESOURCE_KIND_IDENTITY,
|
|
18646
|
+
RESOURCE_KIND_ENVIRONMENT,
|
|
18647
|
+
RESOURCE_KIND_SESSION
|
|
18648
|
+
];
|
|
18633
18649
|
ProjectDeleteResourceBaseSchema = external_exports.object({
|
|
18634
18650
|
name: external_exports.string().trim().min(1)
|
|
18635
18651
|
});
|
|
18636
18652
|
ProjectDeleteResourceSchema = external_exports.preprocess(
|
|
18637
18653
|
normalizeLegacySessionKind,
|
|
18638
18654
|
ProjectDeleteResourceBaseSchema.extend({
|
|
18639
|
-
kind: external_exports.enum(
|
|
18655
|
+
kind: external_exports.enum(PROJECT_APPLY_RESOURCE_KINDS)
|
|
18640
18656
|
})
|
|
18641
18657
|
);
|
|
18642
18658
|
AVATAR_ASSET_CONTENT_TYPES = ["image/png", "image/jpeg"];
|
|
@@ -18675,6 +18691,7 @@ var init_project_resources = __esm({
|
|
|
18675
18691
|
spec: ProjectApplyRequestSchema
|
|
18676
18692
|
});
|
|
18677
18693
|
ProjectAppliedResourceSchema = external_exports.union([
|
|
18694
|
+
ProjectConnectionAllocationResourceSchema,
|
|
18678
18695
|
EnvironmentResourceSchema,
|
|
18679
18696
|
IdentityResourceSchema,
|
|
18680
18697
|
SessionResourceSchema
|
|
@@ -18686,6 +18703,7 @@ var init_project_resources = __esm({
|
|
|
18686
18703
|
message: external_exports.string().min(1),
|
|
18687
18704
|
action: external_exports.enum(["create", "update", "unchanged"]),
|
|
18688
18705
|
kind: external_exports.enum([
|
|
18706
|
+
RESOURCE_KIND_CONNECTION,
|
|
18689
18707
|
RESOURCE_KIND_ENVIRONMENT,
|
|
18690
18708
|
RESOURCE_KIND_IDENTITY,
|
|
18691
18709
|
RESOURCE_KIND_SESSION
|
|
@@ -21208,7 +21226,7 @@ var init_package = __esm({
|
|
|
21208
21226
|
"package.json"() {
|
|
21209
21227
|
package_default = {
|
|
21210
21228
|
name: "@autohq/cli",
|
|
21211
|
-
version: "0.1.
|
|
21229
|
+
version: "0.1.137",
|
|
21212
21230
|
license: "SEE LICENSE IN README.md",
|
|
21213
21231
|
publishConfig: {
|
|
21214
21232
|
access: "public"
|
|
@@ -21389,7 +21407,7 @@ import { parseAllDocuments as parseYamlDocuments, stringify } from "yaml";
|
|
|
21389
21407
|
function compileAgentFile(path2) {
|
|
21390
21408
|
const context = { graph: /* @__PURE__ */ new Map(), removals: [] };
|
|
21391
21409
|
const document = readSingleDocument(path2);
|
|
21392
|
-
const compiled =
|
|
21410
|
+
const compiled = finalizeAgentApplyShape(
|
|
21393
21411
|
compileAgentDocument(document, path2, [], context)
|
|
21394
21412
|
);
|
|
21395
21413
|
const parsed = ProjectApplyResourceSchema.safeParse(compiled);
|
|
@@ -21409,7 +21427,7 @@ function compileAgentFile(path2) {
|
|
|
21409
21427
|
}
|
|
21410
21428
|
function compileAgentDocumentValue(document, path2) {
|
|
21411
21429
|
const context = { graph: /* @__PURE__ */ new Map(), removals: [] };
|
|
21412
|
-
const compiled =
|
|
21430
|
+
const compiled = finalizeAgentApplyShape(
|
|
21413
21431
|
compileAgentDocument(document, path2, [], context)
|
|
21414
21432
|
);
|
|
21415
21433
|
const parsed = ProjectApplyResourceSchema.safeParse(compiled);
|
|
@@ -21577,7 +21595,11 @@ function compileAgentDocument(document, path2, stack, context) {
|
|
|
21577
21595
|
merged = applyRemoval(merged, removal);
|
|
21578
21596
|
context.removals.push(removal);
|
|
21579
21597
|
}
|
|
21580
|
-
return mergeValues2(
|
|
21598
|
+
return mergeValues2(
|
|
21599
|
+
merged,
|
|
21600
|
+
authoringDocumentApplyShape(document, resolvedPath),
|
|
21601
|
+
[]
|
|
21602
|
+
);
|
|
21581
21603
|
}
|
|
21582
21604
|
function readSingleDocument(path2) {
|
|
21583
21605
|
const documents = readDocuments(path2);
|
|
@@ -21629,11 +21651,97 @@ function sanitizedAgentDocument(document) {
|
|
|
21629
21651
|
}
|
|
21630
21652
|
return next;
|
|
21631
21653
|
}
|
|
21632
|
-
function
|
|
21633
|
-
|
|
21654
|
+
function authoringDocumentApplyShape(document, path2) {
|
|
21655
|
+
const sanitized = sanitizedAgentDocument(document);
|
|
21656
|
+
const kind = typeof sanitized.kind === "string" ? sanitized.kind : RESOURCE_KIND_SESSION;
|
|
21657
|
+
const metadata = isRecord2(sanitized.metadata) ? { ...sanitized.metadata } : {};
|
|
21658
|
+
const spec = isRecord2(sanitized.spec) ? { ...sanitized.spec } : {};
|
|
21659
|
+
for (const [key, value] of Object.entries(sanitized)) {
|
|
21660
|
+
if (key === "kind" || key === "metadata" || key === "spec" || value === void 0) {
|
|
21661
|
+
continue;
|
|
21662
|
+
}
|
|
21663
|
+
if (AGENT_METADATA_FIELDS.has(key)) {
|
|
21664
|
+
const metadataKey = key === "name" ? "name" : key;
|
|
21665
|
+
assertNoDuplicateFacadeField({
|
|
21666
|
+
path: path2,
|
|
21667
|
+
field: key,
|
|
21668
|
+
target: `metadata.${metadataKey}`,
|
|
21669
|
+
targetValue: metadata[metadataKey]
|
|
21670
|
+
});
|
|
21671
|
+
metadata[metadataKey] = value;
|
|
21672
|
+
continue;
|
|
21673
|
+
}
|
|
21674
|
+
if (AGENT_SPEC_FIELDS.has(key)) {
|
|
21675
|
+
assertNoDuplicateFacadeField({
|
|
21676
|
+
path: path2,
|
|
21677
|
+
field: key,
|
|
21678
|
+
target: `spec.${key}`,
|
|
21679
|
+
targetValue: spec[key]
|
|
21680
|
+
});
|
|
21681
|
+
spec[key] = value;
|
|
21682
|
+
}
|
|
21683
|
+
}
|
|
21684
|
+
return {
|
|
21685
|
+
kind,
|
|
21686
|
+
metadata,
|
|
21687
|
+
spec: resolveFileBackedFields(spec, path2)
|
|
21688
|
+
};
|
|
21689
|
+
}
|
|
21690
|
+
function finalizeAgentApplyShape(document) {
|
|
21691
|
+
if (!isRecord2(document) || !isRecord2(document.spec)) {
|
|
21634
21692
|
return document;
|
|
21635
21693
|
}
|
|
21636
|
-
|
|
21694
|
+
const next = structuredClone(document);
|
|
21695
|
+
const spec = next.spec;
|
|
21696
|
+
if (Array.isArray(spec.triggers)) {
|
|
21697
|
+
spec.triggers = spec.triggers.map((trigger) => {
|
|
21698
|
+
if (!isRecord2(trigger) || !("name" in trigger)) {
|
|
21699
|
+
return trigger;
|
|
21700
|
+
}
|
|
21701
|
+
const compiledTrigger = { ...trigger };
|
|
21702
|
+
delete compiledTrigger.name;
|
|
21703
|
+
return compiledTrigger;
|
|
21704
|
+
});
|
|
21705
|
+
}
|
|
21706
|
+
return next;
|
|
21707
|
+
}
|
|
21708
|
+
function assertNoDuplicateFacadeField(input) {
|
|
21709
|
+
if (input.targetValue !== void 0) {
|
|
21710
|
+
throw new Error(
|
|
21711
|
+
`Invalid agent authoring file ${input.path}: ${input.field} duplicates ${input.target}`
|
|
21712
|
+
);
|
|
21713
|
+
}
|
|
21714
|
+
}
|
|
21715
|
+
function resolveFileBackedFields(spec, path2) {
|
|
21716
|
+
return {
|
|
21717
|
+
...spec,
|
|
21718
|
+
systemPrompt: resolveFileBackedString(spec.systemPrompt, {
|
|
21719
|
+
path: path2,
|
|
21720
|
+
field: "systemPrompt"
|
|
21721
|
+
}),
|
|
21722
|
+
initialPrompt: resolveFileBackedString(spec.initialPrompt, {
|
|
21723
|
+
path: path2,
|
|
21724
|
+
field: "initialPrompt"
|
|
21725
|
+
})
|
|
21726
|
+
};
|
|
21727
|
+
}
|
|
21728
|
+
function resolveFileBackedString(value, input) {
|
|
21729
|
+
if (!isRecord2(value) || !("file" in value)) {
|
|
21730
|
+
return value;
|
|
21731
|
+
}
|
|
21732
|
+
const file2 = value.file;
|
|
21733
|
+
if (typeof file2 !== "string" || file2.trim().length === 0) {
|
|
21734
|
+
throw new Error(
|
|
21735
|
+
`Invalid agent authoring file ${input.path}: ${input.field}.file must be a non-empty string`
|
|
21736
|
+
);
|
|
21737
|
+
}
|
|
21738
|
+
const filePath = file2.trim();
|
|
21739
|
+
if (isAbsolute(filePath) || /^[A-Za-z]+:\/\//.test(filePath)) {
|
|
21740
|
+
throw new Error(
|
|
21741
|
+
`Invalid agent authoring file ${input.path}: ${input.field}.file must be a relative path`
|
|
21742
|
+
);
|
|
21743
|
+
}
|
|
21744
|
+
return readFileSync3(resolve(dirname4(input.path), filePath), "utf8");
|
|
21637
21745
|
}
|
|
21638
21746
|
function removalDirectives(document, path2) {
|
|
21639
21747
|
const raw = mergeValues2(
|
|
@@ -21673,8 +21781,7 @@ function applyRemoval(value, removal) {
|
|
|
21673
21781
|
const spec = { ...next.spec };
|
|
21674
21782
|
next.spec = spec;
|
|
21675
21783
|
switch (removal.target) {
|
|
21676
|
-
case "tools":
|
|
21677
|
-
case "env": {
|
|
21784
|
+
case "tools": {
|
|
21678
21785
|
if (!isRecord2(spec[removal.target])) {
|
|
21679
21786
|
return next;
|
|
21680
21787
|
}
|
|
@@ -21687,7 +21794,6 @@ function applyRemoval(value, removal) {
|
|
|
21687
21794
|
spec[removal.target] = collection;
|
|
21688
21795
|
return next;
|
|
21689
21796
|
}
|
|
21690
|
-
case "mounts":
|
|
21691
21797
|
case "triggers": {
|
|
21692
21798
|
const value2 = spec[removal.target];
|
|
21693
21799
|
if (!Array.isArray(value2)) {
|
|
@@ -21703,7 +21809,7 @@ function applyRemoval(value, removal) {
|
|
|
21703
21809
|
}
|
|
21704
21810
|
default:
|
|
21705
21811
|
throw new Error(
|
|
21706
|
-
`Unsupported agent remove target "${removal.target}"; supported targets are tools,
|
|
21812
|
+
`Unsupported agent remove target "${removal.target}"; supported targets are tools, triggers`
|
|
21707
21813
|
);
|
|
21708
21814
|
}
|
|
21709
21815
|
}
|
|
@@ -21725,8 +21831,8 @@ function mergeValues2(base, override, path2) {
|
|
|
21725
21831
|
}
|
|
21726
21832
|
function mergeArrays(base, override, path2) {
|
|
21727
21833
|
const pathKey = path2.join(".");
|
|
21728
|
-
if (pathKey
|
|
21729
|
-
return
|
|
21834
|
+
if (!isNamedArrayMergePath(pathKey)) {
|
|
21835
|
+
return override;
|
|
21730
21836
|
}
|
|
21731
21837
|
const merged = [...base];
|
|
21732
21838
|
const indexByKey = /* @__PURE__ */ new Map();
|
|
@@ -21753,6 +21859,9 @@ function mergeArrays(base, override, path2) {
|
|
|
21753
21859
|
}
|
|
21754
21860
|
return merged;
|
|
21755
21861
|
}
|
|
21862
|
+
function isNamedArrayMergePath(path2) {
|
|
21863
|
+
return path2 === "spec.mounts" || path2 === "spec.triggers";
|
|
21864
|
+
}
|
|
21756
21865
|
function collectionItemKey(collection, item) {
|
|
21757
21866
|
if (!isRecord2(item)) {
|
|
21758
21867
|
return void 0;
|
|
@@ -21789,12 +21898,25 @@ function isAgentFile(path2) {
|
|
|
21789
21898
|
function isRecord2(value) {
|
|
21790
21899
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21791
21900
|
}
|
|
21792
|
-
var AGENT_FILE_EXTENSIONS;
|
|
21901
|
+
var AGENT_FILE_EXTENSIONS, AGENT_SPEC_FIELDS, AGENT_METADATA_FIELDS;
|
|
21793
21902
|
var init_authoring = __esm({
|
|
21794
21903
|
"src/commands/agents/authoring.ts"() {
|
|
21795
21904
|
"use strict";
|
|
21796
21905
|
init_src();
|
|
21797
21906
|
AGENT_FILE_EXTENSIONS = [".yaml", ".yml", ".json"];
|
|
21907
|
+
AGENT_SPEC_FIELDS = /* @__PURE__ */ new Set([
|
|
21908
|
+
"harness",
|
|
21909
|
+
"systemPrompt",
|
|
21910
|
+
"environment",
|
|
21911
|
+
"identity",
|
|
21912
|
+
"initialPrompt",
|
|
21913
|
+
"env",
|
|
21914
|
+
"mounts",
|
|
21915
|
+
"triggers",
|
|
21916
|
+
"workingDirectory",
|
|
21917
|
+
"tools"
|
|
21918
|
+
]);
|
|
21919
|
+
AGENT_METADATA_FIELDS = /* @__PURE__ */ new Set(["name", "labels", "annotations"]);
|
|
21798
21920
|
}
|
|
21799
21921
|
});
|
|
21800
21922
|
|
|
@@ -21878,7 +22000,7 @@ function mcpOAuthSessionToolConnectionsFromAppliedResources(resources) {
|
|
|
21878
22000
|
}
|
|
21879
22001
|
function applyFiles(root) {
|
|
21880
22002
|
const files = [];
|
|
21881
|
-
for (const kind of
|
|
22003
|
+
for (const kind of PROJECT_APPLY_RESOURCE_KINDS) {
|
|
21882
22004
|
const kindFiles = [];
|
|
21883
22005
|
for (const directory of applyDirectories(kind)) {
|
|
21884
22006
|
const path2 = join4(root, directory);
|
|
@@ -22087,9 +22209,11 @@ function applyCandidate(document) {
|
|
|
22087
22209
|
}
|
|
22088
22210
|
};
|
|
22089
22211
|
}
|
|
22090
|
-
if (!
|
|
22212
|
+
if (!PROJECT_APPLY_RESOURCE_KINDS.includes(
|
|
22213
|
+
document.kind
|
|
22214
|
+
)) {
|
|
22091
22215
|
throw new Error(
|
|
22092
|
-
`Unsupported apply resource kind "${String(document.kind)}"; supported kinds are ${
|
|
22216
|
+
`Unsupported apply resource kind "${String(document.kind)}"; supported kinds are ${PROJECT_APPLY_RESOURCE_KINDS.map((kind2) => `"${kind2}"`).join(", ")} (legacy alias "session" is also accepted)`
|
|
22093
22217
|
);
|
|
22094
22218
|
}
|
|
22095
22219
|
const kind = document.kind;
|
|
@@ -22436,15 +22560,20 @@ function parseProjectResourceReference(resource) {
|
|
|
22436
22560
|
if (!kind || !name || extra) {
|
|
22437
22561
|
throw new Error('Resource must be formatted as "kind/name"');
|
|
22438
22562
|
}
|
|
22439
|
-
if (!
|
|
22563
|
+
if (!PROJECT_APPLY_RESOURCE_KINDS.includes(
|
|
22564
|
+
kind
|
|
22565
|
+
)) {
|
|
22440
22566
|
if (kind === LEGACY_RESOURCE_KIND_SESSION) {
|
|
22441
22567
|
return { kind: RESOURCE_KIND_SESSION, name };
|
|
22442
22568
|
}
|
|
22443
22569
|
throw new Error(
|
|
22444
|
-
`Unsupported resource kind "${kind}"; supported kinds are ${
|
|
22570
|
+
`Unsupported resource kind "${kind}"; supported kinds are ${PROJECT_APPLY_RESOURCE_KINDS.map((value) => `"${value}"`).join(", ")} (legacy alias "session" is also accepted)`
|
|
22445
22571
|
);
|
|
22446
22572
|
}
|
|
22447
|
-
return {
|
|
22573
|
+
return {
|
|
22574
|
+
kind,
|
|
22575
|
+
name
|
|
22576
|
+
};
|
|
22448
22577
|
}
|
|
22449
22578
|
async function listProjectResources2(client, kind, options) {
|
|
22450
22579
|
switch (kind) {
|
|
@@ -22454,6 +22583,8 @@ async function listProjectResources2(client, kind, options) {
|
|
|
22454
22583
|
return (await client.listIdentities(options)).identities;
|
|
22455
22584
|
case RESOURCE_KIND_SESSION:
|
|
22456
22585
|
return (await client.listSessions(options)).sessions;
|
|
22586
|
+
default:
|
|
22587
|
+
throw new Error(`Resource kind "${kind}" cannot be listed directly.`);
|
|
22457
22588
|
}
|
|
22458
22589
|
}
|
|
22459
22590
|
async function requireProjectResource(client, reference, options) {
|
|
@@ -27828,6 +27959,9 @@ async function launch(opts) {
|
|
|
27828
27959
|
}
|
|
27829
27960
|
}
|
|
27830
27961
|
async function refreshEditedResource(input) {
|
|
27962
|
+
if (!isRefreshableResourceKind(input.kind)) {
|
|
27963
|
+
return;
|
|
27964
|
+
}
|
|
27831
27965
|
const definition = RESOURCE_REFRESH_DEFINITIONS[input.kind];
|
|
27832
27966
|
input.queryClient.setQueryData(
|
|
27833
27967
|
definition.queryKey(input.apiUrl),
|
|
@@ -27842,6 +27976,9 @@ function sortByResourceName(resources) {
|
|
|
27842
27976
|
function isEditSelection(selection) {
|
|
27843
27977
|
return "action" in selection && selection.action === "editResource";
|
|
27844
27978
|
}
|
|
27979
|
+
function isRefreshableResourceKind(kind) {
|
|
27980
|
+
return kind in RESOURCE_REFRESH_DEFINITIONS;
|
|
27981
|
+
}
|
|
27845
27982
|
var RESOURCE_REFRESH_DEFINITIONS;
|
|
27846
27983
|
var init_launcher = __esm({
|
|
27847
27984
|
"src/tui/launcher.ts"() {
|