@autohq/cli 0.1.275 → 0.1.276

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.
@@ -23353,7 +23353,7 @@ Object.assign(lookup, {
23353
23353
  // package.json
23354
23354
  var package_default = {
23355
23355
  name: "@autohq/cli",
23356
- version: "0.1.275",
23356
+ version: "0.1.276",
23357
23357
  license: "SEE LICENSE IN README.md",
23358
23358
  publishConfig: {
23359
23359
  access: "public"
@@ -26155,6 +26155,7 @@ function normalizeLegacyHeartbeatTickWorkflowInput(input) {
26155
26155
  // ../../packages/schemas/src/agents.ts
26156
26156
  var RESOURCE_KIND_AGENT = "agent";
26157
26157
  var AGENT_HARNESSES = ["claude-code", "codex"];
26158
+ var AgentHarnessSchema = external_exports.enum(AGENT_HARNESSES);
26158
26159
  var TriggerFilterScalarSchema = external_exports.union([
26159
26160
  external_exports.null(),
26160
26161
  external_exports.string(),
@@ -28528,7 +28529,6 @@ var ClaudeCodeProjector = class {
28528
28529
  }
28529
28530
  };
28530
28531
  function projectClaudeCodeResult(result) {
28531
- const usage = claudeCodeTurnUsage(result.usage);
28532
28532
  return {
28533
28533
  type: "entry",
28534
28534
  entry: {
@@ -28543,27 +28543,10 @@ function projectClaudeCodeResult(result) {
28543
28543
  text: result.isError ? `claude-code failed: ${result.errorMessage ?? "unknown error"}` : "claude-code completed"
28544
28544
  }
28545
28545
  ]
28546
- },
28547
- ...usage ? { usage } : {}
28546
+ }
28548
28547
  }
28549
28548
  };
28550
28549
  }
28551
- function claudeCodeTurnUsage(usage) {
28552
- if (!usage || usage.perModel.length === 0) {
28553
- return void 0;
28554
- }
28555
- return {
28556
- harness: "claude-code",
28557
- models: usage.perModel.map((model) => ({
28558
- model: model.model,
28559
- inputTokens: model.inputTokens,
28560
- outputTokens: model.outputTokens,
28561
- cacheCreationTokens: model.cacheCreationTokens,
28562
- cacheReadTokens: model.cacheReadTokens,
28563
- providerCostUsd: model.providerCostUsd
28564
- }))
28565
- };
28566
- }
28567
28550
  function anthropicMessageIdFromStreamStart(message) {
28568
28551
  const event = message.event;
28569
28552
  if (event.type !== "message_start") {
@@ -50221,40 +50204,6 @@ function errorMessage2(error51) {
50221
50204
  return error51 instanceof Error ? error51.message : String(error51);
50222
50205
  }
50223
50206
 
50224
- // src/commands/agent-bridge/harness/codex/usage.ts
50225
- function addCodexUsage(accumulated, next) {
50226
- if (!accumulated) {
50227
- return next;
50228
- }
50229
- return {
50230
- totalTokens: accumulated.totalTokens + next.totalTokens,
50231
- inputTokens: accumulated.inputTokens + next.inputTokens,
50232
- cachedInputTokens: accumulated.cachedInputTokens + next.cachedInputTokens,
50233
- outputTokens: accumulated.outputTokens + next.outputTokens,
50234
- reasoningOutputTokens: accumulated.reasoningOutputTokens + next.reasoningOutputTokens
50235
- };
50236
- }
50237
- function codexTurnUsage(usage) {
50238
- if (usage.totalTokens === 0) {
50239
- return void 0;
50240
- }
50241
- const cacheReadTokens = usage.cachedInputTokens;
50242
- const inputTokens = Math.max(0, usage.inputTokens - cacheReadTokens);
50243
- return {
50244
- harness: "codex",
50245
- models: [
50246
- {
50247
- model: CODEX_DEFAULT_MODEL,
50248
- inputTokens,
50249
- outputTokens: usage.outputTokens,
50250
- cacheCreationTokens: 0,
50251
- cacheReadTokens,
50252
- providerCostUsd: null
50253
- }
50254
- ]
50255
- };
50256
- }
50257
-
50258
50207
  // src/commands/agent-bridge/harness/codex/index.ts
50259
50208
  function createCodexCommandHandler(input) {
50260
50209
  return new CodexCommandHandler({
@@ -50276,11 +50225,6 @@ var CodexCommandHandler = class {
50276
50225
  pendingApprovals = /* @__PURE__ */ new Map();
50277
50226
  outputBuffer;
50278
50227
  projector = new CodexProjector();
50279
- // The active turn's running usage sum. codex emits one
50280
- // `thread/tokenUsage/updated` per model request; their `last` breakdowns are
50281
- // summed here and ride the turn-completion entry. Reset at each turn boundary
50282
- // so usage never leaks across turns.
50283
- turnTokenUsage = null;
50284
50228
  // ---------------------------------------------------------------------------
50285
50229
  // Lifecycle (public API)
50286
50230
  // ---------------------------------------------------------------------------
@@ -50297,7 +50241,6 @@ var CodexCommandHandler = class {
50297
50241
  this.session?.close();
50298
50242
  this.session = null;
50299
50243
  this.pendingApprovals.clear();
50300
- this.turnTokenUsage = null;
50301
50244
  }
50302
50245
  async handleCommand(rawDelivery) {
50303
50246
  const delivery = RuntimeBridgeCommandDeliverySchema.parse(rawDelivery);
@@ -50424,24 +50367,10 @@ var CodexCommandHandler = class {
50424
50367
  return;
50425
50368
  }
50426
50369
  if (notification.type === "tokenUsage") {
50427
- this.turnTokenUsage = addCodexUsage(
50428
- this.turnTokenUsage,
50429
- notification.last
50430
- );
50431
50370
  return;
50432
50371
  }
50433
- if (notification.type === "turnStarted") {
50434
- this.turnTokenUsage = null;
50435
- }
50436
- const turnUsage = notification.type === "turnCompleted" && this.turnTokenUsage ? codexTurnUsage(this.turnTokenUsage) : void 0;
50437
50372
  for (const projection of this.projector.project(notification)) {
50438
- await this.emit(
50439
- activeContext,
50440
- attachTurnUsage(notification, projection, turnUsage)
50441
- );
50442
- }
50443
- if (notification.type === "turnCompleted") {
50444
- this.turnTokenUsage = null;
50373
+ await this.emit(activeContext, projection);
50445
50374
  }
50446
50375
  }
50447
50376
  async handleServerRequest(request) {
@@ -50559,15 +50488,6 @@ function deliveryMode2(delivery) {
50559
50488
  function errorMessage3(error51) {
50560
50489
  return error51 instanceof Error ? error51.message : String(error51);
50561
50490
  }
50562
- function attachTurnUsage(notification, projection, turnUsage) {
50563
- if (notification.type !== "turnCompleted" || projection.type !== "entry" || !turnUsage) {
50564
- return projection;
50565
- }
50566
- return {
50567
- type: "entry",
50568
- entry: { ...projection.entry, usage: turnUsage }
50569
- };
50570
- }
50571
50491
 
50572
50492
  // src/commands/agent-bridge/harness/index.ts
50573
50493
  async function runAgentBridgeHarness(options) {
package/dist/index.js CHANGED
@@ -18079,7 +18079,7 @@ function isChatMessageEvent(trigger) {
18079
18079
  function hasFilterValue(trigger, path2, expected) {
18080
18080
  return trigger.where?.[path2] === expected;
18081
18081
  }
18082
- var RESOURCE_KIND_AGENT, AGENT_HARNESSES, TriggerFilterScalarSchema, TriggerFilterPathSchema, TriggerFilterClauseSchema, TriggerFilterSchema, TriggerCheckTimeoutSchema, AgentArchiveAfterInactiveSchema, AgentSessionPolicySchema, TriggerEventSchema, TriggerEventsSchema, PAYLOAD_PREFIXED_TEMPLATE_TOKEN, TriggerChecksField, TriggerEventSourceFields, TriggerSchema, ApplyTriggerSchema, HeartbeatTriggerSchema, ApplyHeartbeatTriggerSchema, TriggerDefinitionSchema, ApplyTriggerDefinitionSchema, TriggersSchema, ApplyTriggersSchema, AVATAR_ASSET_EXTENSIONS, MAX_AVATAR_ASSET_BYTES, MIN_AVATAR_ASSET_DIMENSION_PX, MAX_AVATAR_ASSET_DIMENSION_PX, PNG_SIGNATURE, AGENT_IDENTITY_DESCRIPTION_MAX_LENGTH, SHA256_HEX_PATTERN, AgentIdentitySchema, AgentSpecFieldsSchema, AgentSpecSchema, AgentApplySpecSchema, AgentStatusSchema, AgentResourceSchema, AgentApplyRequestSchema, ApplyTriggerReceiptSchema, AgentApplyResponseSchema, AGENT_TELEGRAM_IDENTITY_STATUSES, AgentTelegramIdentityStatusSchema, AgentPresenceIdentitySchema, AgentPresenceResponseSchema, AgentPresenceConnectRequestSchema, AgentPresenceConnectPendingSchema, AgentPresenceConnectResponseSchema, AgentPresenceIconRequestSchema, AgentPresenceIconResponseSchema, AgentPresenceCompleteResponseSchema;
18082
+ var RESOURCE_KIND_AGENT, AGENT_HARNESSES, AgentHarnessSchema, TriggerFilterScalarSchema, TriggerFilterPathSchema, TriggerFilterClauseSchema, TriggerFilterSchema, TriggerCheckTimeoutSchema, AgentArchiveAfterInactiveSchema, AgentSessionPolicySchema, TriggerEventSchema, TriggerEventsSchema, PAYLOAD_PREFIXED_TEMPLATE_TOKEN, TriggerChecksField, TriggerEventSourceFields, TriggerSchema, ApplyTriggerSchema, HeartbeatTriggerSchema, ApplyHeartbeatTriggerSchema, TriggerDefinitionSchema, ApplyTriggerDefinitionSchema, TriggersSchema, ApplyTriggersSchema, AVATAR_ASSET_EXTENSIONS, MAX_AVATAR_ASSET_BYTES, MIN_AVATAR_ASSET_DIMENSION_PX, MAX_AVATAR_ASSET_DIMENSION_PX, PNG_SIGNATURE, AGENT_IDENTITY_DESCRIPTION_MAX_LENGTH, SHA256_HEX_PATTERN, AgentIdentitySchema, AgentSpecFieldsSchema, AgentSpecSchema, AgentApplySpecSchema, AgentStatusSchema, AgentResourceSchema, AgentApplyRequestSchema, ApplyTriggerReceiptSchema, AgentApplyResponseSchema, AGENT_TELEGRAM_IDENTITY_STATUSES, AgentTelegramIdentityStatusSchema, AgentPresenceIdentitySchema, AgentPresenceResponseSchema, AgentPresenceConnectRequestSchema, AgentPresenceConnectPendingSchema, AgentPresenceConnectResponseSchema, AgentPresenceIconRequestSchema, AgentPresenceIconResponseSchema, AgentPresenceCompleteResponseSchema;
18083
18083
  var init_agents = __esm({
18084
18084
  "../../packages/schemas/src/agents.ts"() {
18085
18085
  "use strict";
@@ -18093,6 +18093,7 @@ var init_agents = __esm({
18093
18093
  init_trigger_router();
18094
18094
  RESOURCE_KIND_AGENT = "agent";
18095
18095
  AGENT_HARNESSES = ["claude-code", "codex"];
18096
+ AgentHarnessSchema = external_exports.enum(AGENT_HARNESSES);
18096
18097
  TriggerFilterScalarSchema = external_exports.union([
18097
18098
  external_exports.null(),
18098
18099
  external_exports.string(),
@@ -22978,7 +22979,7 @@ var init_package = __esm({
22978
22979
  "package.json"() {
22979
22980
  package_default = {
22980
22981
  name: "@autohq/cli",
22981
- version: "0.1.275",
22982
+ version: "0.1.276",
22982
22983
  license: "SEE LICENSE IN README.md",
22983
22984
  publishConfig: {
22984
22985
  access: "public"
@@ -33623,7 +33624,6 @@ var ClaudeCodeProjector = class {
33623
33624
  }
33624
33625
  };
33625
33626
  function projectClaudeCodeResult(result) {
33626
- const usage = claudeCodeTurnUsage(result.usage);
33627
33627
  return {
33628
33628
  type: "entry",
33629
33629
  entry: {
@@ -33638,27 +33638,10 @@ function projectClaudeCodeResult(result) {
33638
33638
  text: result.isError ? `claude-code failed: ${result.errorMessage ?? "unknown error"}` : "claude-code completed"
33639
33639
  }
33640
33640
  ]
33641
- },
33642
- ...usage ? { usage } : {}
33641
+ }
33643
33642
  }
33644
33643
  };
33645
33644
  }
33646
- function claudeCodeTurnUsage(usage) {
33647
- if (!usage || usage.perModel.length === 0) {
33648
- return void 0;
33649
- }
33650
- return {
33651
- harness: "claude-code",
33652
- models: usage.perModel.map((model) => ({
33653
- model: model.model,
33654
- inputTokens: model.inputTokens,
33655
- outputTokens: model.outputTokens,
33656
- cacheCreationTokens: model.cacheCreationTokens,
33657
- cacheReadTokens: model.cacheReadTokens,
33658
- providerCostUsd: model.providerCostUsd
33659
- }))
33660
- };
33661
- }
33662
33645
  function anthropicMessageIdFromStreamStart(message) {
33663
33646
  const event = message.event;
33664
33647
  if (event.type !== "message_start") {
@@ -35749,40 +35732,6 @@ function errorMessage2(error51) {
35749
35732
  return error51 instanceof Error ? error51.message : String(error51);
35750
35733
  }
35751
35734
 
35752
- // src/commands/agent-bridge/harness/codex/usage.ts
35753
- function addCodexUsage(accumulated, next) {
35754
- if (!accumulated) {
35755
- return next;
35756
- }
35757
- return {
35758
- totalTokens: accumulated.totalTokens + next.totalTokens,
35759
- inputTokens: accumulated.inputTokens + next.inputTokens,
35760
- cachedInputTokens: accumulated.cachedInputTokens + next.cachedInputTokens,
35761
- outputTokens: accumulated.outputTokens + next.outputTokens,
35762
- reasoningOutputTokens: accumulated.reasoningOutputTokens + next.reasoningOutputTokens
35763
- };
35764
- }
35765
- function codexTurnUsage(usage) {
35766
- if (usage.totalTokens === 0) {
35767
- return void 0;
35768
- }
35769
- const cacheReadTokens = usage.cachedInputTokens;
35770
- const inputTokens = Math.max(0, usage.inputTokens - cacheReadTokens);
35771
- return {
35772
- harness: "codex",
35773
- models: [
35774
- {
35775
- model: CODEX_DEFAULT_MODEL,
35776
- inputTokens,
35777
- outputTokens: usage.outputTokens,
35778
- cacheCreationTokens: 0,
35779
- cacheReadTokens,
35780
- providerCostUsd: null
35781
- }
35782
- ]
35783
- };
35784
- }
35785
-
35786
35735
  // src/commands/agent-bridge/harness/codex/index.ts
35787
35736
  function createCodexCommandHandler(input) {
35788
35737
  return new CodexCommandHandler({
@@ -35804,11 +35753,6 @@ var CodexCommandHandler = class {
35804
35753
  pendingApprovals = /* @__PURE__ */ new Map();
35805
35754
  outputBuffer;
35806
35755
  projector = new CodexProjector();
35807
- // The active turn's running usage sum. codex emits one
35808
- // `thread/tokenUsage/updated` per model request; their `last` breakdowns are
35809
- // summed here and ride the turn-completion entry. Reset at each turn boundary
35810
- // so usage never leaks across turns.
35811
- turnTokenUsage = null;
35812
35756
  // ---------------------------------------------------------------------------
35813
35757
  // Lifecycle (public API)
35814
35758
  // ---------------------------------------------------------------------------
@@ -35825,7 +35769,6 @@ var CodexCommandHandler = class {
35825
35769
  this.session?.close();
35826
35770
  this.session = null;
35827
35771
  this.pendingApprovals.clear();
35828
- this.turnTokenUsage = null;
35829
35772
  }
35830
35773
  async handleCommand(rawDelivery) {
35831
35774
  const delivery = RuntimeBridgeCommandDeliverySchema.parse(rawDelivery);
@@ -35952,24 +35895,10 @@ var CodexCommandHandler = class {
35952
35895
  return;
35953
35896
  }
35954
35897
  if (notification.type === "tokenUsage") {
35955
- this.turnTokenUsage = addCodexUsage(
35956
- this.turnTokenUsage,
35957
- notification.last
35958
- );
35959
35898
  return;
35960
35899
  }
35961
- if (notification.type === "turnStarted") {
35962
- this.turnTokenUsage = null;
35963
- }
35964
- const turnUsage = notification.type === "turnCompleted" && this.turnTokenUsage ? codexTurnUsage(this.turnTokenUsage) : void 0;
35965
35900
  for (const projection of this.projector.project(notification)) {
35966
- await this.emit(
35967
- activeContext,
35968
- attachTurnUsage(notification, projection, turnUsage)
35969
- );
35970
- }
35971
- if (notification.type === "turnCompleted") {
35972
- this.turnTokenUsage = null;
35901
+ await this.emit(activeContext, projection);
35973
35902
  }
35974
35903
  }
35975
35904
  async handleServerRequest(request) {
@@ -36087,15 +36016,6 @@ function deliveryMode2(delivery) {
36087
36016
  function errorMessage3(error51) {
36088
36017
  return error51 instanceof Error ? error51.message : String(error51);
36089
36018
  }
36090
- function attachTurnUsage(notification, projection, turnUsage) {
36091
- if (notification.type !== "turnCompleted" || projection.type !== "entry" || !turnUsage) {
36092
- return projection;
36093
- }
36094
- return {
36095
- type: "entry",
36096
- entry: { ...projection.entry, usage: turnUsage }
36097
- };
36098
- }
36099
36019
 
36100
36020
  // src/commands/agent-bridge/harness/index.ts
36101
36021
  async function runAgentBridgeHarness(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.275",
3
+ "version": "0.1.276",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"