@autohq/cli 0.1.416 → 0.1.418
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 +4 -2
- package/dist/index.js +85 -4
- 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.418",
|
|
30824
30824
|
license: "SEE LICENSE IN README.md",
|
|
30825
30825
|
publishConfig: {
|
|
30826
30826
|
access: "public"
|
|
@@ -34018,6 +34018,7 @@ var SESSION_BINDING_RELEASED_BY = [
|
|
|
34018
34018
|
];
|
|
34019
34019
|
var BINDING_TRANSITION_CAUSES = [
|
|
34020
34020
|
"manual_bind",
|
|
34021
|
+
"manual_unbind",
|
|
34021
34022
|
"manual_update",
|
|
34022
34023
|
"attributed_event",
|
|
34023
34024
|
"mention",
|
|
@@ -36413,7 +36414,8 @@ var ProjectApplySourceLocationSchema = external_exports.object({
|
|
|
36413
36414
|
name: external_exports.string().min(1),
|
|
36414
36415
|
path: external_exports.string().min(1),
|
|
36415
36416
|
file: external_exports.string().min(1),
|
|
36416
|
-
line: external_exports.number().int().positive()
|
|
36417
|
+
line: external_exports.number().int().positive(),
|
|
36418
|
+
displayPath: external_exports.string().min(1).optional()
|
|
36417
36419
|
});
|
|
36418
36420
|
var ProjectApplyRequestSchema = external_exports.object({
|
|
36419
36421
|
delete: external_exports.array(ProjectDeleteResourceSchema).default([]),
|
package/dist/index.js
CHANGED
|
@@ -18007,6 +18007,7 @@ var init_session_bindings = __esm({
|
|
|
18007
18007
|
];
|
|
18008
18008
|
BINDING_TRANSITION_CAUSES = [
|
|
18009
18009
|
"manual_bind",
|
|
18010
|
+
"manual_unbind",
|
|
18010
18011
|
"manual_update",
|
|
18011
18012
|
"attributed_event",
|
|
18012
18013
|
"mention",
|
|
@@ -20656,7 +20657,8 @@ var init_project_resources = __esm({
|
|
|
20656
20657
|
name: external_exports.string().min(1),
|
|
20657
20658
|
path: external_exports.string().min(1),
|
|
20658
20659
|
file: external_exports.string().min(1),
|
|
20659
|
-
line: external_exports.number().int().positive()
|
|
20660
|
+
line: external_exports.number().int().positive(),
|
|
20661
|
+
displayPath: external_exports.string().min(1).optional()
|
|
20660
20662
|
});
|
|
20661
20663
|
ProjectApplyRequestSchema = external_exports.object({
|
|
20662
20664
|
delete: external_exports.array(ProjectDeleteResourceSchema).default([]),
|
|
@@ -38668,7 +38670,7 @@ var init_package = __esm({
|
|
|
38668
38670
|
"package.json"() {
|
|
38669
38671
|
package_default = {
|
|
38670
38672
|
name: "@autohq/cli",
|
|
38671
|
-
version: "0.1.
|
|
38673
|
+
version: "0.1.418",
|
|
38672
38674
|
license: "SEE LICENSE IN README.md",
|
|
38673
38675
|
publishConfig: {
|
|
38674
38676
|
access: "public"
|
|
@@ -40891,6 +40893,7 @@ function readApplyDocument(path2, document, fileIndex, contextVariables) {
|
|
|
40891
40893
|
resource,
|
|
40892
40894
|
primaryResource: result.resource,
|
|
40893
40895
|
draftLocations: result.sourceLocations,
|
|
40896
|
+
authoredTriggers: result.authoredTriggers,
|
|
40894
40897
|
generatedLocation
|
|
40895
40898
|
})
|
|
40896
40899
|
};
|
|
@@ -40898,7 +40901,11 @@ function readApplyDocument(path2, document, fileIndex, contextVariables) {
|
|
|
40898
40901
|
}
|
|
40899
40902
|
function sourceLocationsForCompiledResource(input) {
|
|
40900
40903
|
if (input.resource === input.primaryResource) {
|
|
40901
|
-
|
|
40904
|
+
const draftLocations = projectCompiledTriggerSourceLocations(
|
|
40905
|
+
input.draftLocations,
|
|
40906
|
+
input.authoredTriggers
|
|
40907
|
+
);
|
|
40908
|
+
return Object.values(draftLocations).map((location) => ({
|
|
40902
40909
|
...location,
|
|
40903
40910
|
kind: input.resource.kind,
|
|
40904
40911
|
name: input.resource.metadata.name
|
|
@@ -40916,6 +40923,78 @@ function sourceLocationsForCompiledResource(input) {
|
|
|
40916
40923
|
}
|
|
40917
40924
|
];
|
|
40918
40925
|
}
|
|
40926
|
+
function projectCompiledTriggerSourceLocations(locations, authoredTriggers) {
|
|
40927
|
+
if (!Array.isArray(authoredTriggers)) {
|
|
40928
|
+
return locations;
|
|
40929
|
+
}
|
|
40930
|
+
const projected = Object.fromEntries(
|
|
40931
|
+
Object.entries(locations).filter(
|
|
40932
|
+
([path2]) => !path2.startsWith("spec.triggers[")
|
|
40933
|
+
)
|
|
40934
|
+
);
|
|
40935
|
+
let compiledIndex = 0;
|
|
40936
|
+
for (const [authoredIndex, trigger] of authoredTriggers.entries()) {
|
|
40937
|
+
if (!isRecord2(trigger)) {
|
|
40938
|
+
continue;
|
|
40939
|
+
}
|
|
40940
|
+
const events = authoredTriggerEvents(trigger);
|
|
40941
|
+
const displayName = authoredTriggerDisplayName(trigger, events);
|
|
40942
|
+
const authoredPrefix = `spec.triggers[${authoredIndex}]`;
|
|
40943
|
+
const triggerLocations = Object.entries(locations).filter(
|
|
40944
|
+
([path2]) => path2 === authoredPrefix || path2.startsWith(`${authoredPrefix}.`)
|
|
40945
|
+
);
|
|
40946
|
+
for (const [eventIndex] of events.entries()) {
|
|
40947
|
+
const compiledPrefix = `spec.triggers[${compiledIndex}]`;
|
|
40948
|
+
for (const [path2, location] of triggerLocations) {
|
|
40949
|
+
if (path2.startsWith(`${authoredPrefix}.events`)) {
|
|
40950
|
+
continue;
|
|
40951
|
+
}
|
|
40952
|
+
const suffix = path2.slice(authoredPrefix.length);
|
|
40953
|
+
projected[`${compiledPrefix}${suffix}`] = {
|
|
40954
|
+
...location,
|
|
40955
|
+
path: `${compiledPrefix}${suffix}`,
|
|
40956
|
+
displayPath: `triggers.${displayName}${suffix}`
|
|
40957
|
+
};
|
|
40958
|
+
}
|
|
40959
|
+
const eventLocation = locations[`${authoredPrefix}.events[${eventIndex}]`] ?? locations[`${authoredPrefix}.event`] ?? locations[`${authoredPrefix}.events`];
|
|
40960
|
+
if (eventLocation) {
|
|
40961
|
+
projected[`${compiledPrefix}.event`] = {
|
|
40962
|
+
...eventLocation,
|
|
40963
|
+
path: `${compiledPrefix}.event`,
|
|
40964
|
+
displayPath: `triggers.${displayName}.event`
|
|
40965
|
+
};
|
|
40966
|
+
}
|
|
40967
|
+
compiledIndex += 1;
|
|
40968
|
+
}
|
|
40969
|
+
}
|
|
40970
|
+
return projected;
|
|
40971
|
+
}
|
|
40972
|
+
function authoredTriggerEvents(trigger) {
|
|
40973
|
+
if (trigger.kind === "heartbeat") {
|
|
40974
|
+
return ["heartbeat"];
|
|
40975
|
+
}
|
|
40976
|
+
if (typeof trigger.event === "string") {
|
|
40977
|
+
return [trigger.event];
|
|
40978
|
+
}
|
|
40979
|
+
if (Array.isArray(trigger.events)) {
|
|
40980
|
+
return trigger.events.filter(
|
|
40981
|
+
(event) => typeof event === "string"
|
|
40982
|
+
);
|
|
40983
|
+
}
|
|
40984
|
+
return [];
|
|
40985
|
+
}
|
|
40986
|
+
function authoredTriggerDisplayName(trigger, events) {
|
|
40987
|
+
if (typeof trigger.name === "string") {
|
|
40988
|
+
return trigger.name;
|
|
40989
|
+
}
|
|
40990
|
+
if (events.length > 0) {
|
|
40991
|
+
return events.join(" + ");
|
|
40992
|
+
}
|
|
40993
|
+
if (typeof trigger.cron === "string") {
|
|
40994
|
+
return `cron ${trigger.cron}`;
|
|
40995
|
+
}
|
|
40996
|
+
return "trigger";
|
|
40997
|
+
}
|
|
40919
40998
|
function validateAgentFragmentDocument(document, path2, context) {
|
|
40920
40999
|
const normalizedPath = normalizeSourcePath(path2);
|
|
40921
41000
|
if (context.stack.includes(normalizedPath)) {
|
|
@@ -40979,9 +41058,11 @@ function compileAgentDocumentValue(document, path2, fileIndex, contextVariables)
|
|
|
40979
41058
|
variables: /* @__PURE__ */ new Map(),
|
|
40980
41059
|
...contextVariables && Object.keys(contextVariables).length > 0 ? { contextVariables: new Map(Object.entries(contextVariables)) } : {}
|
|
40981
41060
|
});
|
|
41061
|
+
const authoredTriggers = structuredClone(draft.spec.triggers);
|
|
40982
41062
|
return {
|
|
40983
41063
|
...compileAgentDraftResources(draft, path2),
|
|
40984
|
-
sourceLocations: draft.sourceLocations
|
|
41064
|
+
sourceLocations: draft.sourceLocations,
|
|
41065
|
+
authoredTriggers
|
|
40985
41066
|
};
|
|
40986
41067
|
}
|
|
40987
41068
|
function compileAgentDocument2(document, path2, context) {
|