@autohq/cli 0.1.230 → 0.1.232

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.
@@ -23340,7 +23340,7 @@ Object.assign(lookup, {
23340
23340
  // package.json
23341
23341
  var package_default = {
23342
23342
  name: "@autohq/cli",
23343
- version: "0.1.230",
23343
+ version: "0.1.232",
23344
23344
  license: "SEE LICENSE IN README.md",
23345
23345
  publishConfig: {
23346
23346
  access: "public"
@@ -24885,6 +24885,21 @@ var CodexTurnEnvelopeSchema = external_exports.object({
24885
24885
  error: external_exports.object({ message: external_exports.string() }).passthrough().nullish()
24886
24886
  }).passthrough()
24887
24887
  }).passthrough();
24888
+ var CodexTokenUsageSchema = external_exports.object({
24889
+ totalTokens: external_exports.number().int().nonnegative(),
24890
+ inputTokens: external_exports.number().int().nonnegative(),
24891
+ cachedInputTokens: external_exports.number().int().nonnegative(),
24892
+ outputTokens: external_exports.number().int().nonnegative(),
24893
+ reasoningOutputTokens: external_exports.number().int().nonnegative()
24894
+ }).passthrough();
24895
+ var CodexTokenUsageEnvelopeSchema = external_exports.object({
24896
+ threadId: external_exports.string(),
24897
+ turnId: external_exports.string(),
24898
+ tokenUsage: external_exports.object({
24899
+ total: CodexTokenUsageSchema,
24900
+ last: CodexTokenUsageSchema
24901
+ }).passthrough()
24902
+ }).passthrough();
24888
24903
  var CodexFrameSchema = external_exports.object({
24889
24904
  id: CodexRequestIdSchema.optional(),
24890
24905
  method: external_exports.string().optional(),
@@ -25024,6 +25039,16 @@ function parseNotification(method, params) {
25024
25039
  item: parsed.data.item
25025
25040
  };
25026
25041
  }
25042
+ case "thread/tokenUsage/updated": {
25043
+ const parsed = CodexTokenUsageEnvelopeSchema.safeParse(params);
25044
+ return parsed.success ? {
25045
+ type: "tokenUsage",
25046
+ threadId: parsed.data.threadId,
25047
+ turnId: parsed.data.turnId,
25048
+ total: parsed.data.tokenUsage.total,
25049
+ last: parsed.data.tokenUsage.last
25050
+ } : null;
25051
+ }
25027
25052
  case "item/agentMessage/delta": {
25028
25053
  const parsed = external_exports.object({ itemId: external_exports.string(), delta: external_exports.string() }).passthrough().safeParse(params);
25029
25054
  return parsed.success ? {
@@ -26631,7 +26656,17 @@ var RATE_CARD_2026_06_23 = {
26631
26656
  "claude-sonnet-4-6": tier(3, 15),
26632
26657
  "claude-haiku-4-5": tier(1, 5),
26633
26658
  "claude-haiku-4-5-20251001": tier(1, 5),
26634
- "claude-fable-5": tier(10, 50)
26659
+ "claude-fable-5": tier(10, 50),
26660
+ // OpenAI gpt-5.3-codex, standard tier: input $1.75/Mtok, cached input
26661
+ // $0.175/Mtok, output $14.00/Mtok. Source (verified 2026-06-23):
26662
+ // https://developers.openai.com/api/docs/models/gpt-5.3-codex and
26663
+ // https://developers.openai.com/api/docs/pricing (priority tier is 2x; we
26664
+ // bill standard).
26665
+ "gpt-5.3-codex": openAiTier({
26666
+ input: 1.75,
26667
+ cachedInput: 0.175,
26668
+ output: 14
26669
+ })
26635
26670
  }
26636
26671
  };
26637
26672
  var PRICING_RATE_CARDS = {
@@ -26649,6 +26684,14 @@ function tier(inputUsdPerMtok, outputUsdPerMtok) {
26649
26684
  function opusTier() {
26650
26685
  return tier(5, 25);
26651
26686
  }
26687
+ function openAiTier(rates) {
26688
+ return {
26689
+ inputUsdPerMtok: rates.input,
26690
+ outputUsdPerMtok: rates.output,
26691
+ cacheWrite5mUsdPerMtok: rates.input,
26692
+ cacheReadUsdPerMtok: rates.cachedInput
26693
+ };
26694
+ }
26652
26695
 
26653
26696
  // ../../packages/schemas/src/project-service-accounts.ts
26654
26697
  var ProjectServiceAccountSchema = external_exports.object({
@@ -49588,6 +49631,40 @@ function errorMessage2(error51) {
49588
49631
  return error51 instanceof Error ? error51.message : String(error51);
49589
49632
  }
49590
49633
 
49634
+ // src/commands/agent-bridge/harness/codex/usage.ts
49635
+ function addCodexUsage(accumulated, next) {
49636
+ if (!accumulated) {
49637
+ return next;
49638
+ }
49639
+ return {
49640
+ totalTokens: accumulated.totalTokens + next.totalTokens,
49641
+ inputTokens: accumulated.inputTokens + next.inputTokens,
49642
+ cachedInputTokens: accumulated.cachedInputTokens + next.cachedInputTokens,
49643
+ outputTokens: accumulated.outputTokens + next.outputTokens,
49644
+ reasoningOutputTokens: accumulated.reasoningOutputTokens + next.reasoningOutputTokens
49645
+ };
49646
+ }
49647
+ function codexTurnUsage(usage) {
49648
+ if (usage.totalTokens === 0) {
49649
+ return void 0;
49650
+ }
49651
+ const cacheReadTokens = usage.cachedInputTokens;
49652
+ const inputTokens = Math.max(0, usage.inputTokens - cacheReadTokens);
49653
+ return {
49654
+ harness: "codex",
49655
+ models: [
49656
+ {
49657
+ model: CODEX_DEFAULT_MODEL,
49658
+ inputTokens,
49659
+ outputTokens: usage.outputTokens,
49660
+ cacheCreationTokens: 0,
49661
+ cacheReadTokens,
49662
+ providerCostUsd: null
49663
+ }
49664
+ ]
49665
+ };
49666
+ }
49667
+
49591
49668
  // src/commands/agent-bridge/harness/codex/index.ts
49592
49669
  function createCodexCommandHandler(input) {
49593
49670
  return new CodexCommandHandler({
@@ -49609,6 +49686,11 @@ var CodexCommandHandler = class {
49609
49686
  pendingApprovals = /* @__PURE__ */ new Map();
49610
49687
  outputBuffer;
49611
49688
  projector = new CodexProjector();
49689
+ // The active turn's running usage sum. codex emits one
49690
+ // `thread/tokenUsage/updated` per model request; their `last` breakdowns are
49691
+ // summed here and ride the turn-completion entry. Reset at each turn boundary
49692
+ // so usage never leaks across turns.
49693
+ turnTokenUsage = null;
49612
49694
  // ---------------------------------------------------------------------------
49613
49695
  // Lifecycle (public API)
49614
49696
  // ---------------------------------------------------------------------------
@@ -49625,6 +49707,7 @@ var CodexCommandHandler = class {
49625
49707
  this.session?.close();
49626
49708
  this.session = null;
49627
49709
  this.pendingApprovals.clear();
49710
+ this.turnTokenUsage = null;
49628
49711
  }
49629
49712
  async handleCommand(rawDelivery) {
49630
49713
  const delivery = RuntimeBridgeCommandDeliverySchema.parse(rawDelivery);
@@ -49750,8 +49833,25 @@ var CodexCommandHandler = class {
49750
49833
  if (!activeContext) {
49751
49834
  return;
49752
49835
  }
49836
+ if (notification.type === "tokenUsage") {
49837
+ this.turnTokenUsage = addCodexUsage(
49838
+ this.turnTokenUsage,
49839
+ notification.last
49840
+ );
49841
+ return;
49842
+ }
49843
+ if (notification.type === "turnStarted") {
49844
+ this.turnTokenUsage = null;
49845
+ }
49846
+ const turnUsage = notification.type === "turnCompleted" && this.turnTokenUsage ? codexTurnUsage(this.turnTokenUsage) : void 0;
49753
49847
  for (const projection of this.projector.project(notification)) {
49754
- await this.emit(activeContext, projection);
49848
+ await this.emit(
49849
+ activeContext,
49850
+ attachTurnUsage(notification, projection, turnUsage)
49851
+ );
49852
+ }
49853
+ if (notification.type === "turnCompleted") {
49854
+ this.turnTokenUsage = null;
49755
49855
  }
49756
49856
  }
49757
49857
  async handleServerRequest(request) {
@@ -49869,6 +49969,15 @@ function deliveryMode2(delivery) {
49869
49969
  function errorMessage3(error51) {
49870
49970
  return error51 instanceof Error ? error51.message : String(error51);
49871
49971
  }
49972
+ function attachTurnUsage(notification, projection, turnUsage) {
49973
+ if (notification.type !== "turnCompleted" || projection.type !== "entry" || !turnUsage) {
49974
+ return projection;
49975
+ }
49976
+ return {
49977
+ type: "entry",
49978
+ entry: { ...projection.entry, usage: turnUsage }
49979
+ };
49980
+ }
49872
49981
 
49873
49982
  // src/commands/agent-bridge/harness/index.ts
49874
49983
  async function runAgentBridgeHarness(options) {
package/dist/index.js CHANGED
@@ -16385,6 +16385,16 @@ function parseNotification(method, params) {
16385
16385
  item: parsed.data.item
16386
16386
  };
16387
16387
  }
16388
+ case "thread/tokenUsage/updated": {
16389
+ const parsed = CodexTokenUsageEnvelopeSchema.safeParse(params);
16390
+ return parsed.success ? {
16391
+ type: "tokenUsage",
16392
+ threadId: parsed.data.threadId,
16393
+ turnId: parsed.data.turnId,
16394
+ total: parsed.data.tokenUsage.total,
16395
+ last: parsed.data.tokenUsage.last
16396
+ } : null;
16397
+ }
16388
16398
  case "item/agentMessage/delta": {
16389
16399
  const parsed = external_exports.object({ itemId: external_exports.string(), delta: external_exports.string() }).passthrough().safeParse(params);
16390
16400
  return parsed.success ? {
@@ -16497,7 +16507,7 @@ function textContent2(text) {
16497
16507
  function isFailedStatus(status) {
16498
16508
  return status === "failed" || status === "declined";
16499
16509
  }
16500
- var CodexRequestIdSchema, CodexTurnStatusSchema, CodexUserMessageItemSchema, CodexAgentMessageItemSchema, CodexReasoningItemSchema, CodexCommandExecutionItemSchema, CodexFileChangeItemSchema, CodexMcpToolCallItemSchema, CodexItemSchema, OptionalCodexItemSchema, CodexItemEnvelopeSchema, CodexTurnEnvelopeSchema, CodexFrameSchema, APPROVE_OPTION_LABEL, DECLINE_OPTION_LABEL;
16510
+ var CodexRequestIdSchema, CodexTurnStatusSchema, CodexUserMessageItemSchema, CodexAgentMessageItemSchema, CodexReasoningItemSchema, CodexCommandExecutionItemSchema, CodexFileChangeItemSchema, CodexMcpToolCallItemSchema, CodexItemSchema, OptionalCodexItemSchema, CodexItemEnvelopeSchema, CodexTurnEnvelopeSchema, CodexTokenUsageSchema, CodexTokenUsageEnvelopeSchema, CodexFrameSchema, APPROVE_OPTION_LABEL, DECLINE_OPTION_LABEL;
16501
16511
  var init_codex = __esm({
16502
16512
  "../../packages/schemas/src/codex.ts"() {
16503
16513
  "use strict";
@@ -16571,6 +16581,21 @@ var init_codex = __esm({
16571
16581
  error: external_exports.object({ message: external_exports.string() }).passthrough().nullish()
16572
16582
  }).passthrough()
16573
16583
  }).passthrough();
16584
+ CodexTokenUsageSchema = external_exports.object({
16585
+ totalTokens: external_exports.number().int().nonnegative(),
16586
+ inputTokens: external_exports.number().int().nonnegative(),
16587
+ cachedInputTokens: external_exports.number().int().nonnegative(),
16588
+ outputTokens: external_exports.number().int().nonnegative(),
16589
+ reasoningOutputTokens: external_exports.number().int().nonnegative()
16590
+ }).passthrough();
16591
+ CodexTokenUsageEnvelopeSchema = external_exports.object({
16592
+ threadId: external_exports.string(),
16593
+ turnId: external_exports.string(),
16594
+ tokenUsage: external_exports.object({
16595
+ total: CodexTokenUsageSchema,
16596
+ last: CodexTokenUsageSchema
16597
+ }).passthrough()
16598
+ }).passthrough();
16574
16599
  CodexFrameSchema = external_exports.object({
16575
16600
  id: CodexRequestIdSchema.optional(),
16576
16601
  method: external_exports.string().optional(),
@@ -18336,6 +18361,14 @@ function tier(inputUsdPerMtok, outputUsdPerMtok) {
18336
18361
  function opusTier() {
18337
18362
  return tier(5, 25);
18338
18363
  }
18364
+ function openAiTier(rates) {
18365
+ return {
18366
+ inputUsdPerMtok: rates.input,
18367
+ outputUsdPerMtok: rates.output,
18368
+ cacheWrite5mUsdPerMtok: rates.input,
18369
+ cacheReadUsdPerMtok: rates.cachedInput
18370
+ };
18371
+ }
18339
18372
  var RATE_CARD_2026_06_23, PRICING_RATE_CARDS, CURRENT_PRICING_VERSION;
18340
18373
  var init_pricing = __esm({
18341
18374
  "../../packages/schemas/src/pricing.ts"() {
@@ -18350,7 +18383,17 @@ var init_pricing = __esm({
18350
18383
  "claude-sonnet-4-6": tier(3, 15),
18351
18384
  "claude-haiku-4-5": tier(1, 5),
18352
18385
  "claude-haiku-4-5-20251001": tier(1, 5),
18353
- "claude-fable-5": tier(10, 50)
18386
+ "claude-fable-5": tier(10, 50),
18387
+ // OpenAI gpt-5.3-codex, standard tier: input $1.75/Mtok, cached input
18388
+ // $0.175/Mtok, output $14.00/Mtok. Source (verified 2026-06-23):
18389
+ // https://developers.openai.com/api/docs/models/gpt-5.3-codex and
18390
+ // https://developers.openai.com/api/docs/pricing (priority tier is 2x; we
18391
+ // bill standard).
18392
+ "gpt-5.3-codex": openAiTier({
18393
+ input: 1.75,
18394
+ cachedInput: 0.175,
18395
+ output: 14
18396
+ })
18354
18397
  }
18355
18398
  };
18356
18399
  PRICING_RATE_CARDS = {
@@ -22296,7 +22339,7 @@ var init_package = __esm({
22296
22339
  "package.json"() {
22297
22340
  package_default = {
22298
22341
  name: "@autohq/cli",
22299
- version: "0.1.230",
22342
+ version: "0.1.232",
22300
22343
  license: "SEE LICENSE IN README.md",
22301
22344
  publishConfig: {
22302
22345
  access: "public"
@@ -34741,6 +34784,40 @@ function errorMessage2(error51) {
34741
34784
  return error51 instanceof Error ? error51.message : String(error51);
34742
34785
  }
34743
34786
 
34787
+ // src/commands/agent-bridge/harness/codex/usage.ts
34788
+ function addCodexUsage(accumulated, next) {
34789
+ if (!accumulated) {
34790
+ return next;
34791
+ }
34792
+ return {
34793
+ totalTokens: accumulated.totalTokens + next.totalTokens,
34794
+ inputTokens: accumulated.inputTokens + next.inputTokens,
34795
+ cachedInputTokens: accumulated.cachedInputTokens + next.cachedInputTokens,
34796
+ outputTokens: accumulated.outputTokens + next.outputTokens,
34797
+ reasoningOutputTokens: accumulated.reasoningOutputTokens + next.reasoningOutputTokens
34798
+ };
34799
+ }
34800
+ function codexTurnUsage(usage) {
34801
+ if (usage.totalTokens === 0) {
34802
+ return void 0;
34803
+ }
34804
+ const cacheReadTokens = usage.cachedInputTokens;
34805
+ const inputTokens = Math.max(0, usage.inputTokens - cacheReadTokens);
34806
+ return {
34807
+ harness: "codex",
34808
+ models: [
34809
+ {
34810
+ model: CODEX_DEFAULT_MODEL,
34811
+ inputTokens,
34812
+ outputTokens: usage.outputTokens,
34813
+ cacheCreationTokens: 0,
34814
+ cacheReadTokens,
34815
+ providerCostUsd: null
34816
+ }
34817
+ ]
34818
+ };
34819
+ }
34820
+
34744
34821
  // src/commands/agent-bridge/harness/codex/index.ts
34745
34822
  function createCodexCommandHandler(input) {
34746
34823
  return new CodexCommandHandler({
@@ -34762,6 +34839,11 @@ var CodexCommandHandler = class {
34762
34839
  pendingApprovals = /* @__PURE__ */ new Map();
34763
34840
  outputBuffer;
34764
34841
  projector = new CodexProjector();
34842
+ // The active turn's running usage sum. codex emits one
34843
+ // `thread/tokenUsage/updated` per model request; their `last` breakdowns are
34844
+ // summed here and ride the turn-completion entry. Reset at each turn boundary
34845
+ // so usage never leaks across turns.
34846
+ turnTokenUsage = null;
34765
34847
  // ---------------------------------------------------------------------------
34766
34848
  // Lifecycle (public API)
34767
34849
  // ---------------------------------------------------------------------------
@@ -34778,6 +34860,7 @@ var CodexCommandHandler = class {
34778
34860
  this.session?.close();
34779
34861
  this.session = null;
34780
34862
  this.pendingApprovals.clear();
34863
+ this.turnTokenUsage = null;
34781
34864
  }
34782
34865
  async handleCommand(rawDelivery) {
34783
34866
  const delivery = RuntimeBridgeCommandDeliverySchema.parse(rawDelivery);
@@ -34903,8 +34986,25 @@ var CodexCommandHandler = class {
34903
34986
  if (!activeContext) {
34904
34987
  return;
34905
34988
  }
34989
+ if (notification.type === "tokenUsage") {
34990
+ this.turnTokenUsage = addCodexUsage(
34991
+ this.turnTokenUsage,
34992
+ notification.last
34993
+ );
34994
+ return;
34995
+ }
34996
+ if (notification.type === "turnStarted") {
34997
+ this.turnTokenUsage = null;
34998
+ }
34999
+ const turnUsage = notification.type === "turnCompleted" && this.turnTokenUsage ? codexTurnUsage(this.turnTokenUsage) : void 0;
34906
35000
  for (const projection of this.projector.project(notification)) {
34907
- await this.emit(activeContext, projection);
35001
+ await this.emit(
35002
+ activeContext,
35003
+ attachTurnUsage(notification, projection, turnUsage)
35004
+ );
35005
+ }
35006
+ if (notification.type === "turnCompleted") {
35007
+ this.turnTokenUsage = null;
34908
35008
  }
34909
35009
  }
34910
35010
  async handleServerRequest(request) {
@@ -35022,6 +35122,15 @@ function deliveryMode2(delivery) {
35022
35122
  function errorMessage3(error51) {
35023
35123
  return error51 instanceof Error ? error51.message : String(error51);
35024
35124
  }
35125
+ function attachTurnUsage(notification, projection, turnUsage) {
35126
+ if (notification.type !== "turnCompleted" || projection.type !== "entry" || !turnUsage) {
35127
+ return projection;
35128
+ }
35129
+ return {
35130
+ type: "entry",
35131
+ entry: { ...projection.entry, usage: turnUsage }
35132
+ };
35133
+ }
35025
35134
 
35026
35135
  // src/commands/agent-bridge/harness/index.ts
35027
35136
  async function runAgentBridgeHarness(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.230",
3
+ "version": "0.1.232",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"