@autohq/cli 0.1.274 → 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.274",
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(),
@@ -27223,8 +27224,16 @@ var SESSION_STATUSES = [
27223
27224
  "failed",
27224
27225
  "stopped"
27225
27226
  ];
27227
+ var SESSION_RUNTIME_PHASES = [
27228
+ "building_image",
27229
+ "booting_container",
27230
+ "preparing_environment",
27231
+ "starting_runtime",
27232
+ "running"
27233
+ ];
27226
27234
  var SESSION_DISPLAY_TITLE_MAX_LENGTH = 64;
27227
27235
  var SessionStatusSchema = external_exports.enum(SESSION_STATUSES);
27236
+ var SessionRuntimePhaseSchema = external_exports.enum(SESSION_RUNTIME_PHASES);
27228
27237
  var RunDisplayTitleSchema = external_exports.string().trim().max(SESSION_DISPLAY_TITLE_MAX_LENGTH);
27229
27238
  var AmbientStatusSchema = external_exports.string().trim().min(1);
27230
27239
  var SESSION_CHECK_STATUSES = [
@@ -27257,6 +27266,7 @@ var SessionRecordSchema = external_exports.object({
27257
27266
  agentId: AgentIdSchema,
27258
27267
  runtimeId: RuntimeIdSchema2.nullable(),
27259
27268
  status: SessionStatusSchema,
27269
+ runtimePhase: SessionRuntimePhaseSchema.nullable(),
27260
27270
  idempotencyKey: external_exports.string().min(1).nullable(),
27261
27271
  correlationKey: external_exports.string().nullable(),
27262
27272
  workflowId: external_exports.string().min(1),
@@ -27292,6 +27302,7 @@ var SessionListItemSchema = external_exports.object({
27292
27302
  id: SessionIdSchema2,
27293
27303
  agentId: AgentIdSchema,
27294
27304
  status: SessionStatusSchema,
27305
+ runtimePhase: SessionRuntimePhaseSchema.nullable(),
27295
27306
  displayTitle: RunDisplayTitleSchema,
27296
27307
  summary: external_exports.string(),
27297
27308
  agent: SessionListItemAgentSchema,
@@ -28518,7 +28529,6 @@ var ClaudeCodeProjector = class {
28518
28529
  }
28519
28530
  };
28520
28531
  function projectClaudeCodeResult(result) {
28521
- const usage = claudeCodeTurnUsage(result.usage);
28522
28532
  return {
28523
28533
  type: "entry",
28524
28534
  entry: {
@@ -28533,27 +28543,10 @@ function projectClaudeCodeResult(result) {
28533
28543
  text: result.isError ? `claude-code failed: ${result.errorMessage ?? "unknown error"}` : "claude-code completed"
28534
28544
  }
28535
28545
  ]
28536
- },
28537
- ...usage ? { usage } : {}
28546
+ }
28538
28547
  }
28539
28548
  };
28540
28549
  }
28541
- function claudeCodeTurnUsage(usage) {
28542
- if (!usage || usage.perModel.length === 0) {
28543
- return void 0;
28544
- }
28545
- return {
28546
- harness: "claude-code",
28547
- models: usage.perModel.map((model) => ({
28548
- model: model.model,
28549
- inputTokens: model.inputTokens,
28550
- outputTokens: model.outputTokens,
28551
- cacheCreationTokens: model.cacheCreationTokens,
28552
- cacheReadTokens: model.cacheReadTokens,
28553
- providerCostUsd: model.providerCostUsd
28554
- }))
28555
- };
28556
- }
28557
28550
  function anthropicMessageIdFromStreamStart(message) {
28558
28551
  const event = message.event;
28559
28552
  if (event.type !== "message_start") {
@@ -50211,40 +50204,6 @@ function errorMessage2(error51) {
50211
50204
  return error51 instanceof Error ? error51.message : String(error51);
50212
50205
  }
50213
50206
 
50214
- // src/commands/agent-bridge/harness/codex/usage.ts
50215
- function addCodexUsage(accumulated, next) {
50216
- if (!accumulated) {
50217
- return next;
50218
- }
50219
- return {
50220
- totalTokens: accumulated.totalTokens + next.totalTokens,
50221
- inputTokens: accumulated.inputTokens + next.inputTokens,
50222
- cachedInputTokens: accumulated.cachedInputTokens + next.cachedInputTokens,
50223
- outputTokens: accumulated.outputTokens + next.outputTokens,
50224
- reasoningOutputTokens: accumulated.reasoningOutputTokens + next.reasoningOutputTokens
50225
- };
50226
- }
50227
- function codexTurnUsage(usage) {
50228
- if (usage.totalTokens === 0) {
50229
- return void 0;
50230
- }
50231
- const cacheReadTokens = usage.cachedInputTokens;
50232
- const inputTokens = Math.max(0, usage.inputTokens - cacheReadTokens);
50233
- return {
50234
- harness: "codex",
50235
- models: [
50236
- {
50237
- model: CODEX_DEFAULT_MODEL,
50238
- inputTokens,
50239
- outputTokens: usage.outputTokens,
50240
- cacheCreationTokens: 0,
50241
- cacheReadTokens,
50242
- providerCostUsd: null
50243
- }
50244
- ]
50245
- };
50246
- }
50247
-
50248
50207
  // src/commands/agent-bridge/harness/codex/index.ts
50249
50208
  function createCodexCommandHandler(input) {
50250
50209
  return new CodexCommandHandler({
@@ -50266,11 +50225,6 @@ var CodexCommandHandler = class {
50266
50225
  pendingApprovals = /* @__PURE__ */ new Map();
50267
50226
  outputBuffer;
50268
50227
  projector = new CodexProjector();
50269
- // The active turn's running usage sum. codex emits one
50270
- // `thread/tokenUsage/updated` per model request; their `last` breakdowns are
50271
- // summed here and ride the turn-completion entry. Reset at each turn boundary
50272
- // so usage never leaks across turns.
50273
- turnTokenUsage = null;
50274
50228
  // ---------------------------------------------------------------------------
50275
50229
  // Lifecycle (public API)
50276
50230
  // ---------------------------------------------------------------------------
@@ -50287,7 +50241,6 @@ var CodexCommandHandler = class {
50287
50241
  this.session?.close();
50288
50242
  this.session = null;
50289
50243
  this.pendingApprovals.clear();
50290
- this.turnTokenUsage = null;
50291
50244
  }
50292
50245
  async handleCommand(rawDelivery) {
50293
50246
  const delivery = RuntimeBridgeCommandDeliverySchema.parse(rawDelivery);
@@ -50414,24 +50367,10 @@ var CodexCommandHandler = class {
50414
50367
  return;
50415
50368
  }
50416
50369
  if (notification.type === "tokenUsage") {
50417
- this.turnTokenUsage = addCodexUsage(
50418
- this.turnTokenUsage,
50419
- notification.last
50420
- );
50421
50370
  return;
50422
50371
  }
50423
- if (notification.type === "turnStarted") {
50424
- this.turnTokenUsage = null;
50425
- }
50426
- const turnUsage = notification.type === "turnCompleted" && this.turnTokenUsage ? codexTurnUsage(this.turnTokenUsage) : void 0;
50427
50372
  for (const projection of this.projector.project(notification)) {
50428
- await this.emit(
50429
- activeContext,
50430
- attachTurnUsage(notification, projection, turnUsage)
50431
- );
50432
- }
50433
- if (notification.type === "turnCompleted") {
50434
- this.turnTokenUsage = null;
50373
+ await this.emit(activeContext, projection);
50435
50374
  }
50436
50375
  }
50437
50376
  async handleServerRequest(request) {
@@ -50549,15 +50488,6 @@ function deliveryMode2(delivery) {
50549
50488
  function errorMessage3(error51) {
50550
50489
  return error51 instanceof Error ? error51.message : String(error51);
50551
50490
  }
50552
- function attachTurnUsage(notification, projection, turnUsage) {
50553
- if (notification.type !== "turnCompleted" || projection.type !== "entry" || !turnUsage) {
50554
- return projection;
50555
- }
50556
- return {
50557
- type: "entry",
50558
- entry: { ...projection.entry, usage: turnUsage }
50559
- };
50560
- }
50561
50491
 
50562
50492
  // src/commands/agent-bridge/harness/index.ts
50563
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(),
@@ -18987,7 +18988,7 @@ function isSessionTerminalStatus(status) {
18987
18988
  (terminalStatus) => terminalStatus === status
18988
18989
  );
18989
18990
  }
18990
- var SESSION_STATUSES, SESSION_TERMINAL_STATUSES, SESSION_DISPLAY_TITLE_MAX_LENGTH, SessionStatusSchema, RunDisplayTitleSchema, AmbientStatusSchema, SESSION_CHECK_STATUSES, SESSION_CHECK_CONCLUSIONS, SESSION_CHECK_TIMEOUT_PHASES, SessionCheckStatusSchema, SessionCheckConclusionSchema, SessionCheckTimeoutPhaseSchema, ManualSessionRequestSchema, SessionArchiveRequestSchema, SessionsArchiveRequestSchema, SessionRecordSchema, SessionListItemAgentSchema, SessionListItemSchema, SessionListResponseSchema, SessionsArchiveResponseSchema;
18991
+ var SESSION_STATUSES, SESSION_RUNTIME_PHASES, SESSION_TERMINAL_STATUSES, SESSION_DISPLAY_TITLE_MAX_LENGTH, SessionStatusSchema, SessionRuntimePhaseSchema, RunDisplayTitleSchema, AmbientStatusSchema, SESSION_CHECK_STATUSES, SESSION_CHECK_CONCLUSIONS, SESSION_CHECK_TIMEOUT_PHASES, SessionCheckStatusSchema, SessionCheckConclusionSchema, SessionCheckTimeoutPhaseSchema, ManualSessionRequestSchema, SessionArchiveRequestSchema, SessionsArchiveRequestSchema, SessionRecordSchema, SessionListItemAgentSchema, SessionListItemSchema, SessionListResponseSchema, SessionsArchiveResponseSchema;
18991
18992
  var init_sessions = __esm({
18992
18993
  "../../packages/schemas/src/sessions.ts"() {
18993
18994
  "use strict";
@@ -19005,9 +19006,17 @@ var init_sessions = __esm({
19005
19006
  "failed",
19006
19007
  "stopped"
19007
19008
  ];
19009
+ SESSION_RUNTIME_PHASES = [
19010
+ "building_image",
19011
+ "booting_container",
19012
+ "preparing_environment",
19013
+ "starting_runtime",
19014
+ "running"
19015
+ ];
19008
19016
  SESSION_TERMINAL_STATUSES = ["failed", "stopped"];
19009
19017
  SESSION_DISPLAY_TITLE_MAX_LENGTH = 64;
19010
19018
  SessionStatusSchema = external_exports.enum(SESSION_STATUSES);
19019
+ SessionRuntimePhaseSchema = external_exports.enum(SESSION_RUNTIME_PHASES);
19011
19020
  RunDisplayTitleSchema = external_exports.string().trim().max(SESSION_DISPLAY_TITLE_MAX_LENGTH);
19012
19021
  AmbientStatusSchema = external_exports.string().trim().min(1);
19013
19022
  SESSION_CHECK_STATUSES = [
@@ -19040,6 +19049,7 @@ var init_sessions = __esm({
19040
19049
  agentId: AgentIdSchema,
19041
19050
  runtimeId: RuntimeIdSchema.nullable(),
19042
19051
  status: SessionStatusSchema,
19052
+ runtimePhase: SessionRuntimePhaseSchema.nullable(),
19043
19053
  idempotencyKey: external_exports.string().min(1).nullable(),
19044
19054
  correlationKey: external_exports.string().nullable(),
19045
19055
  workflowId: external_exports.string().min(1),
@@ -19075,6 +19085,7 @@ var init_sessions = __esm({
19075
19085
  id: SessionIdSchema,
19076
19086
  agentId: AgentIdSchema,
19077
19087
  status: SessionStatusSchema,
19088
+ runtimePhase: SessionRuntimePhaseSchema.nullable(),
19078
19089
  displayTitle: RunDisplayTitleSchema,
19079
19090
  summary: external_exports.string(),
19080
19091
  agent: SessionListItemAgentSchema,
@@ -22968,7 +22979,7 @@ var init_package = __esm({
22968
22979
  "package.json"() {
22969
22980
  package_default = {
22970
22981
  name: "@autohq/cli",
22971
- version: "0.1.274",
22982
+ version: "0.1.276",
22972
22983
  license: "SEE LICENSE IN README.md",
22973
22984
  publishConfig: {
22974
22985
  access: "public"
@@ -33613,7 +33624,6 @@ var ClaudeCodeProjector = class {
33613
33624
  }
33614
33625
  };
33615
33626
  function projectClaudeCodeResult(result) {
33616
- const usage = claudeCodeTurnUsage(result.usage);
33617
33627
  return {
33618
33628
  type: "entry",
33619
33629
  entry: {
@@ -33628,27 +33638,10 @@ function projectClaudeCodeResult(result) {
33628
33638
  text: result.isError ? `claude-code failed: ${result.errorMessage ?? "unknown error"}` : "claude-code completed"
33629
33639
  }
33630
33640
  ]
33631
- },
33632
- ...usage ? { usage } : {}
33641
+ }
33633
33642
  }
33634
33643
  };
33635
33644
  }
33636
- function claudeCodeTurnUsage(usage) {
33637
- if (!usage || usage.perModel.length === 0) {
33638
- return void 0;
33639
- }
33640
- return {
33641
- harness: "claude-code",
33642
- models: usage.perModel.map((model) => ({
33643
- model: model.model,
33644
- inputTokens: model.inputTokens,
33645
- outputTokens: model.outputTokens,
33646
- cacheCreationTokens: model.cacheCreationTokens,
33647
- cacheReadTokens: model.cacheReadTokens,
33648
- providerCostUsd: model.providerCostUsd
33649
- }))
33650
- };
33651
- }
33652
33645
  function anthropicMessageIdFromStreamStart(message) {
33653
33646
  const event = message.event;
33654
33647
  if (event.type !== "message_start") {
@@ -35739,40 +35732,6 @@ function errorMessage2(error51) {
35739
35732
  return error51 instanceof Error ? error51.message : String(error51);
35740
35733
  }
35741
35734
 
35742
- // src/commands/agent-bridge/harness/codex/usage.ts
35743
- function addCodexUsage(accumulated, next) {
35744
- if (!accumulated) {
35745
- return next;
35746
- }
35747
- return {
35748
- totalTokens: accumulated.totalTokens + next.totalTokens,
35749
- inputTokens: accumulated.inputTokens + next.inputTokens,
35750
- cachedInputTokens: accumulated.cachedInputTokens + next.cachedInputTokens,
35751
- outputTokens: accumulated.outputTokens + next.outputTokens,
35752
- reasoningOutputTokens: accumulated.reasoningOutputTokens + next.reasoningOutputTokens
35753
- };
35754
- }
35755
- function codexTurnUsage(usage) {
35756
- if (usage.totalTokens === 0) {
35757
- return void 0;
35758
- }
35759
- const cacheReadTokens = usage.cachedInputTokens;
35760
- const inputTokens = Math.max(0, usage.inputTokens - cacheReadTokens);
35761
- return {
35762
- harness: "codex",
35763
- models: [
35764
- {
35765
- model: CODEX_DEFAULT_MODEL,
35766
- inputTokens,
35767
- outputTokens: usage.outputTokens,
35768
- cacheCreationTokens: 0,
35769
- cacheReadTokens,
35770
- providerCostUsd: null
35771
- }
35772
- ]
35773
- };
35774
- }
35775
-
35776
35735
  // src/commands/agent-bridge/harness/codex/index.ts
35777
35736
  function createCodexCommandHandler(input) {
35778
35737
  return new CodexCommandHandler({
@@ -35794,11 +35753,6 @@ var CodexCommandHandler = class {
35794
35753
  pendingApprovals = /* @__PURE__ */ new Map();
35795
35754
  outputBuffer;
35796
35755
  projector = new CodexProjector();
35797
- // The active turn's running usage sum. codex emits one
35798
- // `thread/tokenUsage/updated` per model request; their `last` breakdowns are
35799
- // summed here and ride the turn-completion entry. Reset at each turn boundary
35800
- // so usage never leaks across turns.
35801
- turnTokenUsage = null;
35802
35756
  // ---------------------------------------------------------------------------
35803
35757
  // Lifecycle (public API)
35804
35758
  // ---------------------------------------------------------------------------
@@ -35815,7 +35769,6 @@ var CodexCommandHandler = class {
35815
35769
  this.session?.close();
35816
35770
  this.session = null;
35817
35771
  this.pendingApprovals.clear();
35818
- this.turnTokenUsage = null;
35819
35772
  }
35820
35773
  async handleCommand(rawDelivery) {
35821
35774
  const delivery = RuntimeBridgeCommandDeliverySchema.parse(rawDelivery);
@@ -35942,24 +35895,10 @@ var CodexCommandHandler = class {
35942
35895
  return;
35943
35896
  }
35944
35897
  if (notification.type === "tokenUsage") {
35945
- this.turnTokenUsage = addCodexUsage(
35946
- this.turnTokenUsage,
35947
- notification.last
35948
- );
35949
35898
  return;
35950
35899
  }
35951
- if (notification.type === "turnStarted") {
35952
- this.turnTokenUsage = null;
35953
- }
35954
- const turnUsage = notification.type === "turnCompleted" && this.turnTokenUsage ? codexTurnUsage(this.turnTokenUsage) : void 0;
35955
35900
  for (const projection of this.projector.project(notification)) {
35956
- await this.emit(
35957
- activeContext,
35958
- attachTurnUsage(notification, projection, turnUsage)
35959
- );
35960
- }
35961
- if (notification.type === "turnCompleted") {
35962
- this.turnTokenUsage = null;
35901
+ await this.emit(activeContext, projection);
35963
35902
  }
35964
35903
  }
35965
35904
  async handleServerRequest(request) {
@@ -36077,15 +36016,6 @@ function deliveryMode2(delivery) {
36077
36016
  function errorMessage3(error51) {
36078
36017
  return error51 instanceof Error ? error51.message : String(error51);
36079
36018
  }
36080
- function attachTurnUsage(notification, projection, turnUsage) {
36081
- if (notification.type !== "turnCompleted" || projection.type !== "entry" || !turnUsage) {
36082
- return projection;
36083
- }
36084
- return {
36085
- type: "entry",
36086
- entry: { ...projection.entry, usage: turnUsage }
36087
- };
36088
- }
36089
36019
 
36090
36020
  // src/commands/agent-bridge/harness/index.ts
36091
36021
  async function runAgentBridgeHarness(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.274",
3
+ "version": "0.1.276",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"