@autohq/cli 0.1.505 → 0.1.506
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 +49 -1
- package/dist/index.js +50 -2
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -30866,7 +30866,7 @@ Object.assign(lookup, {
|
|
|
30866
30866
|
// package.json
|
|
30867
30867
|
var package_default = {
|
|
30868
30868
|
name: "@autohq/cli",
|
|
30869
|
-
version: "0.1.
|
|
30869
|
+
version: "0.1.506",
|
|
30870
30870
|
license: "SEE LICENSE IN README.md",
|
|
30871
30871
|
publishConfig: {
|
|
30872
30872
|
access: "public"
|
|
@@ -38731,6 +38731,22 @@ var ProjectUsageSubscriptionSliceSchema = external_exports.object({
|
|
|
38731
38731
|
}),
|
|
38732
38732
|
subscriptions: external_exports.array(ProjectUsageSubscriptionSummarySchema)
|
|
38733
38733
|
});
|
|
38734
|
+
var ProjectUsageRequesterAttributionSchema = external_exports.object({
|
|
38735
|
+
requesterKey: external_exports.string().trim().min(1).nullable(),
|
|
38736
|
+
requesterDisplayName: external_exports.string().trim().min(1).nullable(),
|
|
38737
|
+
attributionEpochIds: external_exports.array(SessionAttributionEpochIdSchema),
|
|
38738
|
+
attributionGrades: external_exports.array(AttributionGradeSchema)
|
|
38739
|
+
});
|
|
38740
|
+
var ProjectUsageRequesterSummarySchema = UsageTotalsSchema.extend({
|
|
38741
|
+
...ProjectUsageRequesterAttributionSchema.shape,
|
|
38742
|
+
sessionCount: NonNegativeTokenCountSchema
|
|
38743
|
+
});
|
|
38744
|
+
var ProjectUsageSharedSessionRequesterSchema = UsageTotalsSchema.extend(ProjectUsageRequesterAttributionSchema.shape);
|
|
38745
|
+
var ProjectUsageSharedSessionSchema = external_exports.object({
|
|
38746
|
+
sessionId: SessionIdSchema2,
|
|
38747
|
+
totals: UsageTotalsSchema,
|
|
38748
|
+
requesters: external_exports.array(ProjectUsageSharedSessionRequesterSchema).min(2)
|
|
38749
|
+
});
|
|
38734
38750
|
var ProjectUsageDayAgentSliceSchema = external_exports.object({
|
|
38735
38751
|
agentResourceId: external_exports.string().trim().min(1),
|
|
38736
38752
|
billedCostUsd: NonNegativeUsdSchema2
|
|
@@ -38757,8 +38773,40 @@ var ProjectUsageResponseSchema = external_exports.object({
|
|
|
38757
38773
|
byModel: external_exports.array(ProjectUsageModelSummarySchema),
|
|
38758
38774
|
byFundingSource: external_exports.array(UsageFundingSummarySchema),
|
|
38759
38775
|
subscriptionUsage: ProjectUsageSubscriptionSliceSchema,
|
|
38776
|
+
byRequester: external_exports.array(ProjectUsageRequesterSummarySchema),
|
|
38777
|
+
sharedSessions: external_exports.array(ProjectUsageSharedSessionSchema),
|
|
38760
38778
|
daily: external_exports.array(ProjectUsageDayPointSchema)
|
|
38779
|
+
}).superRefine((usage, context) => {
|
|
38780
|
+
if (!billedCostUsdReconciles(usage.byRequester, usage.totals.billedCostUsd)) {
|
|
38781
|
+
context.addIssue({
|
|
38782
|
+
code: "custom",
|
|
38783
|
+
message: "Requester spend must reconcile to project spend",
|
|
38784
|
+
path: ["byRequester"]
|
|
38785
|
+
});
|
|
38786
|
+
}
|
|
38787
|
+
usage.sharedSessions.forEach((session, index) => {
|
|
38788
|
+
if (!billedCostUsdReconciles(
|
|
38789
|
+
session.requesters,
|
|
38790
|
+
session.totals.billedCostUsd
|
|
38791
|
+
)) {
|
|
38792
|
+
context.addIssue({
|
|
38793
|
+
code: "custom",
|
|
38794
|
+
message: "Requester spend must reconcile to shared-session spend",
|
|
38795
|
+
path: ["sharedSessions", index, "requesters"]
|
|
38796
|
+
});
|
|
38797
|
+
}
|
|
38798
|
+
});
|
|
38761
38799
|
});
|
|
38800
|
+
var USD_RECONCILIATION_TOLERANCE = 1e-8;
|
|
38801
|
+
function billedCostUsdReconciles(rows, expectedTotal) {
|
|
38802
|
+
return Math.abs(sumBilledCostUsd(rows) - roundUsd(expectedTotal)) <= USD_RECONCILIATION_TOLERANCE;
|
|
38803
|
+
}
|
|
38804
|
+
function sumBilledCostUsd(rows) {
|
|
38805
|
+
return roundUsd(rows.reduce((total, row) => total + row.billedCostUsd, 0));
|
|
38806
|
+
}
|
|
38807
|
+
function roundUsd(value2) {
|
|
38808
|
+
return Number(value2.toFixed(10));
|
|
38809
|
+
}
|
|
38762
38810
|
|
|
38763
38811
|
// ../../packages/schemas/src/user-subscriptions.ts
|
|
38764
38812
|
var USER_SUBSCRIPTION_PROVIDERS = ["openai"];
|
package/dist/index.js
CHANGED
|
@@ -60612,7 +60612,16 @@ var init_temporal = __esm({
|
|
|
60612
60612
|
});
|
|
60613
60613
|
|
|
60614
60614
|
// ../../packages/schemas/src/usage.ts
|
|
60615
|
-
|
|
60615
|
+
function billedCostUsdReconciles(rows, expectedTotal) {
|
|
60616
|
+
return Math.abs(sumBilledCostUsd(rows) - roundUsd(expectedTotal)) <= USD_RECONCILIATION_TOLERANCE;
|
|
60617
|
+
}
|
|
60618
|
+
function sumBilledCostUsd(rows) {
|
|
60619
|
+
return roundUsd(rows.reduce((total, row) => total + row.billedCostUsd, 0));
|
|
60620
|
+
}
|
|
60621
|
+
function roundUsd(value) {
|
|
60622
|
+
return Number(value.toFixed(10));
|
|
60623
|
+
}
|
|
60624
|
+
var UsageHarnessSchema, NonNegativeTokenCountSchema, NonNegativeUsdSchema2, UsageEventSchema, UsageEventRecordSchema, UsageTotalsSchema, SessionUsageModelSummarySchema, UsageFundingSummarySchema, SessionModelFundingStateSchema, SessionUsageResponseSchema, PROJECT_USAGE_RANGE_KEYS, ProjectUsageRangeKeySchema, UtcDateSchema, ProjectUsageTotalsSchema, ProjectUsageAgentSummarySchema, ProjectUsageModelSummarySchema, ProjectUsageSubscriptionSummarySchema, ProjectUsageSubscriptionSliceSchema, ProjectUsageRequesterAttributionSchema, ProjectUsageRequesterSummarySchema, ProjectUsageSharedSessionRequesterSchema, ProjectUsageSharedSessionSchema, ProjectUsageDayAgentSliceSchema, ProjectUsageDayModelSliceSchema, ProjectUsageDayPointSchema, ProjectUsageResponseSchema, USD_RECONCILIATION_TOLERANCE;
|
|
60616
60625
|
var init_usage = __esm({
|
|
60617
60626
|
"../../packages/schemas/src/usage.ts"() {
|
|
60618
60627
|
"use strict";
|
|
@@ -60735,6 +60744,22 @@ var init_usage = __esm({
|
|
|
60735
60744
|
}),
|
|
60736
60745
|
subscriptions: external_exports.array(ProjectUsageSubscriptionSummarySchema)
|
|
60737
60746
|
});
|
|
60747
|
+
ProjectUsageRequesterAttributionSchema = external_exports.object({
|
|
60748
|
+
requesterKey: external_exports.string().trim().min(1).nullable(),
|
|
60749
|
+
requesterDisplayName: external_exports.string().trim().min(1).nullable(),
|
|
60750
|
+
attributionEpochIds: external_exports.array(SessionAttributionEpochIdSchema),
|
|
60751
|
+
attributionGrades: external_exports.array(AttributionGradeSchema)
|
|
60752
|
+
});
|
|
60753
|
+
ProjectUsageRequesterSummarySchema = UsageTotalsSchema.extend({
|
|
60754
|
+
...ProjectUsageRequesterAttributionSchema.shape,
|
|
60755
|
+
sessionCount: NonNegativeTokenCountSchema
|
|
60756
|
+
});
|
|
60757
|
+
ProjectUsageSharedSessionRequesterSchema = UsageTotalsSchema.extend(ProjectUsageRequesterAttributionSchema.shape);
|
|
60758
|
+
ProjectUsageSharedSessionSchema = external_exports.object({
|
|
60759
|
+
sessionId: SessionIdSchema,
|
|
60760
|
+
totals: UsageTotalsSchema,
|
|
60761
|
+
requesters: external_exports.array(ProjectUsageSharedSessionRequesterSchema).min(2)
|
|
60762
|
+
});
|
|
60738
60763
|
ProjectUsageDayAgentSliceSchema = external_exports.object({
|
|
60739
60764
|
agentResourceId: external_exports.string().trim().min(1),
|
|
60740
60765
|
billedCostUsd: NonNegativeUsdSchema2
|
|
@@ -60761,8 +60786,31 @@ var init_usage = __esm({
|
|
|
60761
60786
|
byModel: external_exports.array(ProjectUsageModelSummarySchema),
|
|
60762
60787
|
byFundingSource: external_exports.array(UsageFundingSummarySchema),
|
|
60763
60788
|
subscriptionUsage: ProjectUsageSubscriptionSliceSchema,
|
|
60789
|
+
byRequester: external_exports.array(ProjectUsageRequesterSummarySchema),
|
|
60790
|
+
sharedSessions: external_exports.array(ProjectUsageSharedSessionSchema),
|
|
60764
60791
|
daily: external_exports.array(ProjectUsageDayPointSchema)
|
|
60792
|
+
}).superRefine((usage, context) => {
|
|
60793
|
+
if (!billedCostUsdReconciles(usage.byRequester, usage.totals.billedCostUsd)) {
|
|
60794
|
+
context.addIssue({
|
|
60795
|
+
code: "custom",
|
|
60796
|
+
message: "Requester spend must reconcile to project spend",
|
|
60797
|
+
path: ["byRequester"]
|
|
60798
|
+
});
|
|
60799
|
+
}
|
|
60800
|
+
usage.sharedSessions.forEach((session, index) => {
|
|
60801
|
+
if (!billedCostUsdReconciles(
|
|
60802
|
+
session.requesters,
|
|
60803
|
+
session.totals.billedCostUsd
|
|
60804
|
+
)) {
|
|
60805
|
+
context.addIssue({
|
|
60806
|
+
code: "custom",
|
|
60807
|
+
message: "Requester spend must reconcile to shared-session spend",
|
|
60808
|
+
path: ["sharedSessions", index, "requesters"]
|
|
60809
|
+
});
|
|
60810
|
+
}
|
|
60811
|
+
});
|
|
60765
60812
|
});
|
|
60813
|
+
USD_RECONCILIATION_TOLERANCE = 1e-8;
|
|
60766
60814
|
}
|
|
60767
60815
|
});
|
|
60768
60816
|
|
|
@@ -63738,7 +63786,7 @@ var init_package = __esm({
|
|
|
63738
63786
|
"package.json"() {
|
|
63739
63787
|
package_default = {
|
|
63740
63788
|
name: "@autohq/cli",
|
|
63741
|
-
version: "0.1.
|
|
63789
|
+
version: "0.1.506",
|
|
63742
63790
|
license: "SEE LICENSE IN README.md",
|
|
63743
63791
|
publishConfig: {
|
|
63744
63792
|
access: "public"
|