@autohq/cli 0.1.410 → 0.1.411
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 +15 -2
- package/dist/index.js +245 -8
- 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.411",
|
|
30824
30824
|
license: "SEE LICENSE IN README.md",
|
|
30825
30825
|
publishConfig: {
|
|
30826
30826
|
access: "public"
|
|
@@ -33358,7 +33358,10 @@ var GithubConnectionSpecSchema = external_exports.object({
|
|
|
33358
33358
|
var ConnectionSpecSchema = GithubConnectionSpecSchema;
|
|
33359
33359
|
var ConnectionResourceSchema = resourceEnvelopeSchema(ConnectionSpecSchema);
|
|
33360
33360
|
var ConnectionApplyRequestSchema = resourceApplySchema(ConnectionSpecSchema);
|
|
33361
|
-
var ConnectionStartReturnToSchema = external_exports.enum([
|
|
33361
|
+
var ConnectionStartReturnToSchema = external_exports.enum([
|
|
33362
|
+
"onboarding",
|
|
33363
|
+
"connections"
|
|
33364
|
+
]);
|
|
33362
33365
|
var ConnectionStartRequestSchema = external_exports.object({
|
|
33363
33366
|
organizationId: OrganizationIdSchema.optional(),
|
|
33364
33367
|
provider: ProviderNameSchema,
|
|
@@ -35973,6 +35976,9 @@ var MIN_CREDIT_PURCHASE_USD = 5;
|
|
|
35973
35976
|
var MAX_CREDIT_PURCHASE_USD = 1e4;
|
|
35974
35977
|
var wholeCents = (value2) => Math.abs(value2 * 100 - Math.round(value2 * 100)) < 1e-6;
|
|
35975
35978
|
var ChargeableUsdSchema = PositiveUsdSchema.min(MIN_CREDIT_PURCHASE_USD).max(MAX_CREDIT_PURCHASE_USD).refine(wholeCents, "amount must be a whole number of cents");
|
|
35979
|
+
var AutoTopUpThresholdUsdSchema = NonNegativeUsdSchema.max(
|
|
35980
|
+
MAX_CREDIT_PURCHASE_USD
|
|
35981
|
+
).refine(wholeCents, "threshold must be a whole number of cents");
|
|
35976
35982
|
var CreditEventSchema = external_exports.object({
|
|
35977
35983
|
organizationId: OrganizationIdSchema,
|
|
35978
35984
|
type: CreditEventTypeSchema,
|
|
@@ -36056,6 +36062,13 @@ var CreateCreditPurchaseRequestSchema = external_exports.object({
|
|
|
36056
36062
|
amountUsd: ChargeableUsdSchema,
|
|
36057
36063
|
returnPath: ReturnPathSchema
|
|
36058
36064
|
}).strict();
|
|
36065
|
+
var AutoReloadSetupValuesSchema = external_exports.object({
|
|
36066
|
+
thresholdUsd: AutoTopUpThresholdUsdSchema,
|
|
36067
|
+
amountUsd: ChargeableUsdSchema
|
|
36068
|
+
}).strict();
|
|
36069
|
+
var CreateAutoReloadSetupRequestSchema = AutoReloadSetupValuesSchema.extend({
|
|
36070
|
+
returnPath: ReturnPathSchema
|
|
36071
|
+
}).strict();
|
|
36059
36072
|
var CreateBillingPortalSessionRequestSchema = external_exports.object({
|
|
36060
36073
|
returnPath: ReturnPathSchema
|
|
36061
36074
|
}).strict();
|
package/dist/index.js
CHANGED
|
@@ -17296,7 +17296,10 @@ var init_connections = __esm({
|
|
|
17296
17296
|
ConnectionSpecSchema = GithubConnectionSpecSchema;
|
|
17297
17297
|
ConnectionResourceSchema = resourceEnvelopeSchema(ConnectionSpecSchema);
|
|
17298
17298
|
ConnectionApplyRequestSchema = resourceApplySchema(ConnectionSpecSchema);
|
|
17299
|
-
ConnectionStartReturnToSchema = external_exports.enum([
|
|
17299
|
+
ConnectionStartReturnToSchema = external_exports.enum([
|
|
17300
|
+
"onboarding",
|
|
17301
|
+
"connections"
|
|
17302
|
+
]);
|
|
17300
17303
|
ConnectionStartRequestSchema = external_exports.object({
|
|
17301
17304
|
organizationId: OrganizationIdSchema.optional(),
|
|
17302
17305
|
provider: ProviderNameSchema,
|
|
@@ -20144,7 +20147,7 @@ var init_organization_settings = __esm({
|
|
|
20144
20147
|
});
|
|
20145
20148
|
|
|
20146
20149
|
// ../../packages/schemas/src/billing.ts
|
|
20147
|
-
var FEE_CARD_2026_07_06, BILLING_FEE_CARDS, CURRENT_BILLING_FEE_VERSION, CREDIT_EVENT_TYPES, CreditEventTypeSchema, UsdAmountSchema, NonNegativeUsdSchema, PositiveUsdSchema, MIN_CREDIT_PURCHASE_USD, MAX_CREDIT_PURCHASE_USD, wholeCents, ChargeableUsdSchema, CreditEventSchema, CreditEventRecordSchema, SPENDING_LIMIT_WINDOWS, SpendingLimitWindowSchema, BilledSpendWindowsSchema, OrganizationBillingSettingsSchema, UpdateOrganizationBillingSettingsRequestSchema, OrganizationCreditsResponseSchema, AddOrganizationCreditsRequestSchema, ReturnPathSchema, CreateCreditPurchaseRequestSchema, CreateBillingPortalSessionRequestSchema;
|
|
20150
|
+
var FEE_CARD_2026_07_06, BILLING_FEE_CARDS, CURRENT_BILLING_FEE_VERSION, CREDIT_EVENT_TYPES, CreditEventTypeSchema, UsdAmountSchema, NonNegativeUsdSchema, PositiveUsdSchema, MIN_CREDIT_PURCHASE_USD, MAX_CREDIT_PURCHASE_USD, wholeCents, ChargeableUsdSchema, AutoTopUpThresholdUsdSchema, CreditEventSchema, CreditEventRecordSchema, SPENDING_LIMIT_WINDOWS, SpendingLimitWindowSchema, BilledSpendWindowsSchema, OrganizationBillingSettingsSchema, UpdateOrganizationBillingSettingsRequestSchema, OrganizationCreditsResponseSchema, AddOrganizationCreditsRequestSchema, ReturnPathSchema, CreateCreditPurchaseRequestSchema, AutoReloadSetupValuesSchema, CreateAutoReloadSetupRequestSchema, CreateBillingPortalSessionRequestSchema;
|
|
20148
20151
|
var init_billing = __esm({
|
|
20149
20152
|
"../../packages/schemas/src/billing.ts"() {
|
|
20150
20153
|
"use strict";
|
|
@@ -20173,6 +20176,9 @@ var init_billing = __esm({
|
|
|
20173
20176
|
MAX_CREDIT_PURCHASE_USD = 1e4;
|
|
20174
20177
|
wholeCents = (value) => Math.abs(value * 100 - Math.round(value * 100)) < 1e-6;
|
|
20175
20178
|
ChargeableUsdSchema = PositiveUsdSchema.min(MIN_CREDIT_PURCHASE_USD).max(MAX_CREDIT_PURCHASE_USD).refine(wholeCents, "amount must be a whole number of cents");
|
|
20179
|
+
AutoTopUpThresholdUsdSchema = NonNegativeUsdSchema.max(
|
|
20180
|
+
MAX_CREDIT_PURCHASE_USD
|
|
20181
|
+
).refine(wholeCents, "threshold must be a whole number of cents");
|
|
20176
20182
|
CreditEventSchema = external_exports.object({
|
|
20177
20183
|
organizationId: OrganizationIdSchema,
|
|
20178
20184
|
type: CreditEventTypeSchema,
|
|
@@ -20256,6 +20262,13 @@ var init_billing = __esm({
|
|
|
20256
20262
|
amountUsd: ChargeableUsdSchema,
|
|
20257
20263
|
returnPath: ReturnPathSchema
|
|
20258
20264
|
}).strict();
|
|
20265
|
+
AutoReloadSetupValuesSchema = external_exports.object({
|
|
20266
|
+
thresholdUsd: AutoTopUpThresholdUsdSchema,
|
|
20267
|
+
amountUsd: ChargeableUsdSchema
|
|
20268
|
+
}).strict();
|
|
20269
|
+
CreateAutoReloadSetupRequestSchema = AutoReloadSetupValuesSchema.extend({
|
|
20270
|
+
returnPath: ReturnPathSchema
|
|
20271
|
+
}).strict();
|
|
20259
20272
|
CreateBillingPortalSessionRequestSchema = external_exports.object({
|
|
20260
20273
|
returnPath: ReturnPathSchema
|
|
20261
20274
|
}).strict();
|
|
@@ -37168,7 +37181,7 @@ var init_package = __esm({
|
|
|
37168
37181
|
"package.json"() {
|
|
37169
37182
|
package_default = {
|
|
37170
37183
|
name: "@autohq/cli",
|
|
37171
|
-
version: "0.1.
|
|
37184
|
+
version: "0.1.411",
|
|
37172
37185
|
license: "SEE LICENSE IN README.md",
|
|
37173
37186
|
publishConfig: {
|
|
37174
37187
|
access: "public"
|
|
@@ -38613,6 +38626,225 @@ var init_inline_resource = __esm({
|
|
|
38613
38626
|
}
|
|
38614
38627
|
});
|
|
38615
38628
|
|
|
38629
|
+
// ../../packages/schemas/src/project-apply-files/agent-fields/inline-bindings.ts
|
|
38630
|
+
function compileRoutingInlineBindings(input) {
|
|
38631
|
+
const bindings = input.bindings ? cloneBindings(input.bindings) : {};
|
|
38632
|
+
const compiledTriggers = [];
|
|
38633
|
+
for (const trigger of input.triggers) {
|
|
38634
|
+
if (!isRecord2(trigger) || trigger.kind === "heartbeat") {
|
|
38635
|
+
compiledTriggers.push(trigger);
|
|
38636
|
+
continue;
|
|
38637
|
+
}
|
|
38638
|
+
const routing = trigger.routing;
|
|
38639
|
+
if (!isRecord2(routing)) {
|
|
38640
|
+
compiledTriggers.push(trigger);
|
|
38641
|
+
continue;
|
|
38642
|
+
}
|
|
38643
|
+
const contribution = extractInlineContribution(routing, input.path);
|
|
38644
|
+
if (!contribution) {
|
|
38645
|
+
compiledTriggers.push(trigger);
|
|
38646
|
+
continue;
|
|
38647
|
+
}
|
|
38648
|
+
mergeContributionIntoBindings(bindings, contribution, input.path);
|
|
38649
|
+
compiledTriggers.push(stripInlineRoutingFields(trigger, routing));
|
|
38650
|
+
}
|
|
38651
|
+
return { triggers: compiledTriggers, bindings };
|
|
38652
|
+
}
|
|
38653
|
+
function extractInlineContribution(routing, path2) {
|
|
38654
|
+
switch (routing.kind) {
|
|
38655
|
+
case "deliver":
|
|
38656
|
+
return extractDeliverContribution(routing, path2);
|
|
38657
|
+
case "bind":
|
|
38658
|
+
return extractBindArmContribution(routing, path2);
|
|
38659
|
+
case "spawn":
|
|
38660
|
+
return extractSpawnArmContribution(routing, path2);
|
|
38661
|
+
default:
|
|
38662
|
+
return void 0;
|
|
38663
|
+
}
|
|
38664
|
+
}
|
|
38665
|
+
function extractDeliverContribution(routing, path2) {
|
|
38666
|
+
const bindBlock = routing.bind;
|
|
38667
|
+
if (bindBlock === void 0) {
|
|
38668
|
+
return void 0;
|
|
38669
|
+
}
|
|
38670
|
+
if (!isRecord2(bindBlock)) {
|
|
38671
|
+
throw inlineShapeError(
|
|
38672
|
+
path2,
|
|
38673
|
+
"deliver",
|
|
38674
|
+
"`bind` block must be an object with `target` and optional `lifecycle`/`continuity`"
|
|
38675
|
+
);
|
|
38676
|
+
}
|
|
38677
|
+
const target = parseTarget(bindBlock.target, path2, "deliver");
|
|
38678
|
+
if (!AUTO_BIND_LEGAL_TARGETS.onMention.has(target)) {
|
|
38679
|
+
const legal = [...AUTO_BIND_LEGAL_TARGETS.onMention].join(", ");
|
|
38680
|
+
throw new Error(
|
|
38681
|
+
`Invalid agent authoring file ${path2}: inline \`bind\` on a deliver trigger must target a chat-thread target ([${legal}]); got "${target}"`
|
|
38682
|
+
);
|
|
38683
|
+
}
|
|
38684
|
+
const lifecycle = parseLifecycle(bindBlock.lifecycle, path2);
|
|
38685
|
+
const continuity = parseContinuity(bindBlock.continuity, path2);
|
|
38686
|
+
return { target, lifecycle, continuity, bind: "onMention", arm: "deliver" };
|
|
38687
|
+
}
|
|
38688
|
+
function extractBindArmContribution(routing, path2) {
|
|
38689
|
+
if (routing.lifecycle === void 0 && routing.continuity === void 0) {
|
|
38690
|
+
return void 0;
|
|
38691
|
+
}
|
|
38692
|
+
const target = parseTarget(routing.target, path2, "bind");
|
|
38693
|
+
rejectSingletonTarget(target, path2, "bind");
|
|
38694
|
+
const lifecycle = parseLifecycle(routing.lifecycle, path2);
|
|
38695
|
+
const continuity = parseContinuity(routing.continuity, path2);
|
|
38696
|
+
return { target, lifecycle, continuity, arm: "bind" };
|
|
38697
|
+
}
|
|
38698
|
+
function extractSpawnArmContribution(routing, path2) {
|
|
38699
|
+
const bindBlock = routing.bind;
|
|
38700
|
+
if (!isRecord2(bindBlock)) {
|
|
38701
|
+
return void 0;
|
|
38702
|
+
}
|
|
38703
|
+
if (bindBlock.lifecycle === void 0 && bindBlock.continuity === void 0) {
|
|
38704
|
+
return void 0;
|
|
38705
|
+
}
|
|
38706
|
+
const target = parseTarget(bindBlock.target, path2, "spawn");
|
|
38707
|
+
rejectSingletonTarget(target, path2, "spawn");
|
|
38708
|
+
const lifecycle = parseLifecycle(bindBlock.lifecycle, path2);
|
|
38709
|
+
const continuity = parseContinuity(bindBlock.continuity, path2);
|
|
38710
|
+
return { target, lifecycle, continuity, arm: "spawn" };
|
|
38711
|
+
}
|
|
38712
|
+
function mergeContributionIntoBindings(bindings, contribution, path2) {
|
|
38713
|
+
const entry = ensureEntry(bindings, contribution.target);
|
|
38714
|
+
const fields = [
|
|
38715
|
+
{ key: "lifecycle", value: contribution.lifecycle },
|
|
38716
|
+
{ key: "continuity", value: contribution.continuity },
|
|
38717
|
+
{ key: "bind", value: contribution.bind }
|
|
38718
|
+
];
|
|
38719
|
+
for (const field of fields) {
|
|
38720
|
+
if (field.value === void 0) {
|
|
38721
|
+
continue;
|
|
38722
|
+
}
|
|
38723
|
+
const existing = entry[field.key];
|
|
38724
|
+
if (existing === void 0) {
|
|
38725
|
+
entry[field.key] = field.value;
|
|
38726
|
+
continue;
|
|
38727
|
+
}
|
|
38728
|
+
if (existing === field.value) {
|
|
38729
|
+
continue;
|
|
38730
|
+
}
|
|
38731
|
+
throw new Error(
|
|
38732
|
+
`Invalid agent authoring file ${path2}: inline binding declaration for "${contribution.target}" conflicts with an existing declaration: field "${field.key}" is "${String(existing)}" but the inline ${contribution.arm} arm declares "${field.value}"`
|
|
38733
|
+
);
|
|
38734
|
+
}
|
|
38735
|
+
}
|
|
38736
|
+
function ensureEntry(bindings, target) {
|
|
38737
|
+
const existing = bindings[target];
|
|
38738
|
+
if (isRecord2(existing)) {
|
|
38739
|
+
return existing;
|
|
38740
|
+
}
|
|
38741
|
+
const entry = {};
|
|
38742
|
+
bindings[target] = entry;
|
|
38743
|
+
return entry;
|
|
38744
|
+
}
|
|
38745
|
+
function stripInlineRoutingFields(trigger, routing) {
|
|
38746
|
+
switch (routing.kind) {
|
|
38747
|
+
case "deliver": {
|
|
38748
|
+
const { bind: _bind, ...canonicalRouting } = routing;
|
|
38749
|
+
return { ...trigger, routing: canonicalRouting };
|
|
38750
|
+
}
|
|
38751
|
+
case "bind": {
|
|
38752
|
+
const {
|
|
38753
|
+
lifecycle: _lifecycle,
|
|
38754
|
+
continuity: _continuity,
|
|
38755
|
+
...rest
|
|
38756
|
+
} = routing;
|
|
38757
|
+
return { ...trigger, routing: rest };
|
|
38758
|
+
}
|
|
38759
|
+
case "spawn": {
|
|
38760
|
+
if (!isRecord2(routing.bind)) {
|
|
38761
|
+
return trigger;
|
|
38762
|
+
}
|
|
38763
|
+
const {
|
|
38764
|
+
lifecycle: _lifecycle,
|
|
38765
|
+
continuity: _continuity,
|
|
38766
|
+
...bindRest
|
|
38767
|
+
} = routing.bind;
|
|
38768
|
+
const canonicalBind = Object.keys(bindRest).length > 0 ? bindRest : void 0;
|
|
38769
|
+
return {
|
|
38770
|
+
...trigger,
|
|
38771
|
+
routing: { ...routing, bind: canonicalBind }
|
|
38772
|
+
};
|
|
38773
|
+
}
|
|
38774
|
+
default:
|
|
38775
|
+
return trigger;
|
|
38776
|
+
}
|
|
38777
|
+
}
|
|
38778
|
+
function parseTarget(value, path2, arm) {
|
|
38779
|
+
const parsed = BindingTargetTypeSchema.safeParse(value);
|
|
38780
|
+
if (!parsed.success) {
|
|
38781
|
+
throw inlineShapeError(
|
|
38782
|
+
path2,
|
|
38783
|
+
arm,
|
|
38784
|
+
`target must be a valid binding target type, got ${formatValue(value)}`
|
|
38785
|
+
);
|
|
38786
|
+
}
|
|
38787
|
+
return parsed.data;
|
|
38788
|
+
}
|
|
38789
|
+
function parseLifecycle(value, path2) {
|
|
38790
|
+
if (value === void 0) {
|
|
38791
|
+
return void 0;
|
|
38792
|
+
}
|
|
38793
|
+
if (value !== "manual" && value !== "held") {
|
|
38794
|
+
throw inlineShapeError(
|
|
38795
|
+
path2,
|
|
38796
|
+
"deliver",
|
|
38797
|
+
`lifecycle must be "manual" or "held", got ${formatValue(value)}`
|
|
38798
|
+
);
|
|
38799
|
+
}
|
|
38800
|
+
return value;
|
|
38801
|
+
}
|
|
38802
|
+
function parseContinuity(value, path2) {
|
|
38803
|
+
if (value === void 0) {
|
|
38804
|
+
return void 0;
|
|
38805
|
+
}
|
|
38806
|
+
if (value !== "session" && value !== "agent") {
|
|
38807
|
+
throw inlineShapeError(
|
|
38808
|
+
path2,
|
|
38809
|
+
"deliver",
|
|
38810
|
+
`continuity must be "session" or "agent", got ${formatValue(value)}`
|
|
38811
|
+
);
|
|
38812
|
+
}
|
|
38813
|
+
return value;
|
|
38814
|
+
}
|
|
38815
|
+
function rejectSingletonTarget(target, path2, arm) {
|
|
38816
|
+
if (target === "agent.singleton") {
|
|
38817
|
+
throw new Error(
|
|
38818
|
+
`Invalid agent authoring file ${path2}: inline binding declarations on a ${arm} arm cannot target "agent.singleton"; the pool slot has its own release lifecycle`
|
|
38819
|
+
);
|
|
38820
|
+
}
|
|
38821
|
+
}
|
|
38822
|
+
function cloneBindings(bindings) {
|
|
38823
|
+
const clone2 = {};
|
|
38824
|
+
for (const [key, value] of Object.entries(bindings)) {
|
|
38825
|
+
clone2[key] = isRecord2(value) ? { ...value } : value;
|
|
38826
|
+
}
|
|
38827
|
+
return clone2;
|
|
38828
|
+
}
|
|
38829
|
+
function inlineShapeError(path2, arm, detail) {
|
|
38830
|
+
return new Error(
|
|
38831
|
+
`Invalid agent authoring file ${path2}: inline binding declaration on a ${arm} arm: ${detail}`
|
|
38832
|
+
);
|
|
38833
|
+
}
|
|
38834
|
+
function formatValue(value) {
|
|
38835
|
+
if (value === void 0) {
|
|
38836
|
+
return "undefined";
|
|
38837
|
+
}
|
|
38838
|
+
return JSON.stringify(value);
|
|
38839
|
+
}
|
|
38840
|
+
var init_inline_bindings = __esm({
|
|
38841
|
+
"../../packages/schemas/src/project-apply-files/agent-fields/inline-bindings.ts"() {
|
|
38842
|
+
"use strict";
|
|
38843
|
+
init_session_bindings();
|
|
38844
|
+
init_source();
|
|
38845
|
+
}
|
|
38846
|
+
});
|
|
38847
|
+
|
|
38616
38848
|
// ../../packages/schemas/src/project-apply-files/agent-fields/named-array.ts
|
|
38617
38849
|
function namedArrayField(options) {
|
|
38618
38850
|
const remove = options.removable === false ? void 0 : removeNamedArray;
|
|
@@ -38636,11 +38868,15 @@ function mountsField() {
|
|
|
38636
38868
|
function triggersField() {
|
|
38637
38869
|
return {
|
|
38638
38870
|
...namedArrayField({ itemKey: triggerItemKey }),
|
|
38639
|
-
compile: (value) => {
|
|
38640
|
-
|
|
38641
|
-
|
|
38642
|
-
|
|
38643
|
-
|
|
38871
|
+
compile: (value, context) => {
|
|
38872
|
+
const withNamesStripped = removeAuthoringTriggerNames(value);
|
|
38873
|
+
const { triggers, bindings } = compileRoutingInlineBindings({
|
|
38874
|
+
triggers: withNamesStripped,
|
|
38875
|
+
bindings: isRecord2(context.draft.spec.bindings) ? context.draft.spec.bindings : void 0,
|
|
38876
|
+
path: context.path
|
|
38877
|
+
});
|
|
38878
|
+
context.draft.spec.bindings = bindings;
|
|
38879
|
+
return { resources: [], value: triggers };
|
|
38644
38880
|
}
|
|
38645
38881
|
};
|
|
38646
38882
|
}
|
|
@@ -38723,6 +38959,7 @@ var init_named_array = __esm({
|
|
|
38723
38959
|
"use strict";
|
|
38724
38960
|
init_source();
|
|
38725
38961
|
init_helpers();
|
|
38962
|
+
init_inline_bindings();
|
|
38726
38963
|
}
|
|
38727
38964
|
});
|
|
38728
38965
|
|