@autohq/cli 0.1.218 → 0.1.220

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/index.js CHANGED
@@ -17509,7 +17509,7 @@ var init_agents = __esm({
17509
17509
  init_tools();
17510
17510
  init_trigger_router();
17511
17511
  RESOURCE_KIND_AGENT = "agent";
17512
- AGENT_HARNESSES = ["claude-code"];
17512
+ AGENT_HARNESSES = ["claude-code", "codex"];
17513
17513
  TriggerFilterScalarSchema = external_exports.union([
17514
17514
  external_exports.null(),
17515
17515
  external_exports.string(),
@@ -17935,6 +17935,42 @@ var init_mcp = __esm({
17935
17935
  }
17936
17936
  });
17937
17937
 
17938
+ // ../../packages/schemas/src/pricing.ts
17939
+ function tier(inputUsdPerMtok, outputUsdPerMtok) {
17940
+ return {
17941
+ inputUsdPerMtok,
17942
+ outputUsdPerMtok,
17943
+ cacheWrite5mUsdPerMtok: inputUsdPerMtok * 1.25,
17944
+ cacheReadUsdPerMtok: inputUsdPerMtok * 0.1
17945
+ };
17946
+ }
17947
+ function opusTier() {
17948
+ return tier(5, 25);
17949
+ }
17950
+ var RATE_CARD_2026_06_23, PRICING_RATE_CARDS, CURRENT_PRICING_VERSION;
17951
+ var init_pricing = __esm({
17952
+ "../../packages/schemas/src/pricing.ts"() {
17953
+ "use strict";
17954
+ RATE_CARD_2026_06_23 = {
17955
+ version: "2026-06-23",
17956
+ effectiveAt: "2026-06-23T00:00:00.000Z",
17957
+ models: {
17958
+ "claude-opus-4-8": opusTier(),
17959
+ "claude-opus-4-7": opusTier(),
17960
+ "claude-opus-4-6": opusTier(),
17961
+ "claude-sonnet-4-6": tier(3, 15),
17962
+ "claude-haiku-4-5": tier(1, 5),
17963
+ "claude-haiku-4-5-20251001": tier(1, 5),
17964
+ "claude-fable-5": tier(10, 50)
17965
+ }
17966
+ };
17967
+ PRICING_RATE_CARDS = {
17968
+ [RATE_CARD_2026_06_23.version]: RATE_CARD_2026_06_23
17969
+ };
17970
+ CURRENT_PRICING_VERSION = RATE_CARD_2026_06_23.version;
17971
+ }
17972
+ });
17973
+
17938
17974
  // ../../packages/schemas/src/project-service-accounts.ts
17939
17975
  var ProjectServiceAccountSchema, ProjectServiceAccountCreateRequestSchema, ProjectServiceAccountUpdateRequestSchema, ProjectServiceAccountTokenResponseSchema, ProjectServiceAccountUpdateResponseSchema, ProjectServiceAccountRemoveResponseSchema, ProjectServiceAccountListResponseSchema;
17940
17976
  var init_project_service_accounts = __esm({
@@ -19105,6 +19141,49 @@ var init_temporal = __esm({
19105
19141
  }
19106
19142
  });
19107
19143
 
19144
+ // ../../packages/schemas/src/usage.ts
19145
+ var UsageHarnessSchema, NonNegativeTokenCountSchema, NonNegativeUsdSchema, UsageEventSchema, UsageEventRecordSchema;
19146
+ var init_usage = __esm({
19147
+ "../../packages/schemas/src/usage.ts"() {
19148
+ "use strict";
19149
+ init_zod();
19150
+ init_agents();
19151
+ init_ids();
19152
+ UsageHarnessSchema = external_exports.enum(AGENT_HARNESSES);
19153
+ NonNegativeTokenCountSchema = external_exports.number().int().nonnegative();
19154
+ NonNegativeUsdSchema = external_exports.number().nonnegative();
19155
+ UsageEventSchema = external_exports.object({
19156
+ // Tenant + lineage attribution. projectId is nullable because a resource can
19157
+ // belong directly to an organization with no project.
19158
+ organizationId: OrganizationIdSchema,
19159
+ projectId: ProjectIdSchema.nullable(),
19160
+ sessionId: SessionIdSchema,
19161
+ agentResourceId: external_exports.string().trim().min(1),
19162
+ harness: UsageHarnessSchema,
19163
+ // The concrete model id the call billed against (e.g. "claude-opus-4-8"),
19164
+ // taken from the response rather than any selection layer — a single run can
19165
+ // touch multiple models, so this is per-call, never per-run.
19166
+ model: external_exports.string().trim().min(1),
19167
+ inputTokens: NonNegativeTokenCountSchema,
19168
+ outputTokens: NonNegativeTokenCountSchema,
19169
+ cacheCreationTokens: NonNegativeTokenCountSchema,
19170
+ cacheReadTokens: NonNegativeTokenCountSchema,
19171
+ // The provider's own cost when it reports one, kept only for reconciliation.
19172
+ // Nullable/absent because it can be 0 or missing — never the billing source.
19173
+ providerCostUsd: NonNegativeUsdSchema.nullable(),
19174
+ // Platform-derived cost and the rate-card version it was derived under, so a
19175
+ // later rate-card change never silently rewrites historical cost.
19176
+ derivedCostUsd: NonNegativeUsdSchema,
19177
+ pricingVersion: external_exports.string().trim().min(1),
19178
+ occurredAt: external_exports.string().datetime()
19179
+ });
19180
+ UsageEventRecordSchema = UsageEventSchema.extend({
19181
+ id: external_exports.string().trim().min(1),
19182
+ createdAt: external_exports.string().datetime()
19183
+ });
19184
+ }
19185
+ });
19186
+
19108
19187
  // ../../packages/schemas/src/index.ts
19109
19188
  var init_src = __esm({
19110
19189
  "../../packages/schemas/src/index.ts"() {
@@ -19124,6 +19203,7 @@ var init_src = __esm({
19124
19203
  init_environments();
19125
19204
  init_mcp();
19126
19205
  init_mounts();
19206
+ init_pricing();
19127
19207
  init_provider_grants();
19128
19208
  init_project_service_accounts();
19129
19209
  init_project_resources();
@@ -19145,6 +19225,7 @@ var init_src = __esm({
19145
19225
  init_temporal();
19146
19226
  init_tools();
19147
19227
  init_trigger_router();
19228
+ init_usage();
19148
19229
  }
19149
19230
  });
19150
19231
 
@@ -21829,7 +21910,7 @@ var init_package = __esm({
21829
21910
  "package.json"() {
21830
21911
  package_default = {
21831
21912
  name: "@autohq/cli",
21832
- version: "0.1.218",
21913
+ version: "0.1.220",
21833
21914
  license: "SEE LICENSE IN README.md",
21834
21915
  publishConfig: {
21835
21916
  access: "public"
@@ -31296,20 +31377,33 @@ var AgentBridgeMcpServerConfigSchema = external_exports.object({
31296
31377
  url: external_exports.string().trim().min(1),
31297
31378
  headers: external_exports.record(external_exports.string().trim().min(1), external_exports.string()).optional()
31298
31379
  });
31299
- var AgentBridgeClaudeConfigSchema = external_exports.object({
31380
+ var AgentBridgeHarnessBaseConfigSchema = external_exports.object({
31300
31381
  cwd: external_exports.string().trim().min(1).optional(),
31301
31382
  env: external_exports.record(external_exports.string().trim().min(1), external_exports.string()),
31302
31383
  mcpServers: external_exports.record(external_exports.string().trim().min(1), AgentBridgeMcpServerConfigSchema).optional(),
31303
- // Profile instructions, delivered as a system-prompt append (the Claude
31304
- // Agent SDK's `{ type: "preset", preset: "claude_code", append }`) so an
31305
- // agent's identity is part of its frame rather than its first user message.
31306
- // Optional and strip-tolerant per the bootstrap-skew contract above.
31384
+ // Profile instructions, delivered as additive agent identity guidance (the
31385
+ // Claude Agent SDK's `{ type: "preset", preset: "claude_code", append }`;
31386
+ // future harnesses layer their own equivalent on top of their built-in base
31387
+ // prompt) so an agent's identity is part of its frame rather than its first
31388
+ // user message. Optional and strip-tolerant per the skew contract.
31307
31389
  systemPromptAppend: external_exports.string().trim().min(1).optional()
31308
31390
  });
31391
+ var AgentBridgeClaudeConfigSchema = AgentBridgeHarnessBaseConfigSchema;
31392
+ var AgentBridgeHarnessConfigSchema = external_exports.discriminatedUnion("kind", [
31393
+ AgentBridgeHarnessBaseConfigSchema.extend({
31394
+ kind: external_exports.literal("claude-code")
31395
+ })
31396
+ ]);
31309
31397
  var RuntimeBridgeBootstrapPlaintextSchema = external_exports.object({
31310
31398
  version: external_exports.literal(1),
31311
31399
  outputSeqStart: external_exports.number().int().nonnegative(),
31312
31400
  claude: AgentBridgeClaudeConfigSchema,
31401
+ // Runtime-generic harness selection + config. Additive and optional: a worker
31402
+ // that does not emit it (or a CLI old enough to strip it) falls back to the
31403
+ // legacy `claude` field as a claude-code harness. A worker only starts
31404
+ // emitting `harness` once a CLI release that parses it has reached sandboxes,
31405
+ // per the bootstrap/CLI rollout-ordering contract above.
31406
+ harness: AgentBridgeHarnessConfigSchema.optional(),
31313
31407
  // Endpoint + session token for the git credential broker. Present only when
31314
31408
  // the session has GitHub App git mounts; rides the encrypted bootstrap so the
31315
31409
  // token lives in agent-bridge memory, never on disk.
@@ -31453,28 +31547,6 @@ var RuntimeBridgeOutputAckSchema = external_exports.object({
31453
31547
  at: external_exports.string().datetime()
31454
31548
  }).strict();
31455
31549
 
31456
- // src/commands/agent-bridge/harness/claude-code/index.ts
31457
- init_src();
31458
-
31459
- // src/commands/agent-bridge/command-ack.ts
31460
- function commandAck(input) {
31461
- return RuntimeBridgeCommandAckSchema.parse({
31462
- type: "command.ack",
31463
- deliveryId: input.delivery.deliveryId,
31464
- commandId: input.delivery.commandId,
31465
- sessionId: input.delivery.sessionId,
31466
- runtimeId: input.delivery.runtimeId,
31467
- bridgeLeaseId: input.delivery.bridgeLeaseId,
31468
- status: input.status,
31469
- socketId: input.socketId ?? null,
31470
- ...input.error ? { error: input.error } : {},
31471
- at: now()
31472
- });
31473
- }
31474
- function now() {
31475
- return (/* @__PURE__ */ new Date()).toISOString();
31476
- }
31477
-
31478
31550
  // ../../packages/protocol/src/bootstrap-crypto.ts
31479
31551
  init_zod();
31480
31552
  import {
@@ -31538,6 +31610,27 @@ function bootstrapAdditionalData(input) {
31538
31610
  // src/commands/agent-bridge/socket.ts
31539
31611
  init_version();
31540
31612
  import { io } from "socket.io-client";
31613
+
31614
+ // src/commands/agent-bridge/command-ack.ts
31615
+ function commandAck(input) {
31616
+ return RuntimeBridgeCommandAckSchema.parse({
31617
+ type: "command.ack",
31618
+ deliveryId: input.delivery.deliveryId,
31619
+ commandId: input.delivery.commandId,
31620
+ sessionId: input.delivery.sessionId,
31621
+ runtimeId: input.delivery.runtimeId,
31622
+ bridgeLeaseId: input.delivery.bridgeLeaseId,
31623
+ status: input.status,
31624
+ socketId: input.socketId ?? null,
31625
+ ...input.error ? { error: input.error } : {},
31626
+ at: now()
31627
+ });
31628
+ }
31629
+ function now() {
31630
+ return (/* @__PURE__ */ new Date()).toISOString();
31631
+ }
31632
+
31633
+ // src/commands/agent-bridge/socket.ts
31541
31634
  var AGENT_BRIDGE_TERMINAL_AUTH_EXIT_CODE = 78;
31542
31635
  var TERMINAL_AUTH_ERROR_MESSAGES = /* @__PURE__ */ new Set([
31543
31636
  "Bridge token is invalid or expired"
@@ -31601,7 +31694,7 @@ async function runAgentBridgeSocket(options) {
31601
31694
  onBootstrap: options.onBootstrap,
31602
31695
  createHandler: (bootstrap) => options.createHandler({
31603
31696
  emitOutput: (output) => emitOutputWithAck(socket, output),
31604
- claude: bootstrap.claude,
31697
+ bootstrap,
31605
31698
  outputSeqStart: bootstrap.outputSeqStart,
31606
31699
  socketId: () => socket.id,
31607
31700
  writeOutput: options.writeOutput
@@ -31824,8 +31917,11 @@ function isNgrokFreeUrl(url2) {
31824
31917
  }
31825
31918
  }
31826
31919
 
31827
- // src/commands/agent-bridge/harness/claude-code/buffer.ts
31828
- var ClaudeCodeOutputBuffer = class {
31920
+ // src/commands/agent-bridge/harness/claude-code/index.ts
31921
+ init_src();
31922
+
31923
+ // src/commands/agent-bridge/harness/output-buffer.ts
31924
+ var AgentBridgeOutputBuffer = class {
31829
31925
  constructor(input) {
31830
31926
  this.input = input;
31831
31927
  this.outputSeq = input.outputSeqStart ?? 0;
@@ -31835,9 +31931,9 @@ var ClaudeCodeOutputBuffer = class {
31835
31931
  pendingOutputs = /* @__PURE__ */ new Map();
31836
31932
  drainBlocked = false;
31837
31933
  drainPromise = null;
31838
- // -----------------------------------------------------------------------------
31934
+ // ---------------------------------------------------------------------------
31839
31935
  // Public API
31840
- // -----------------------------------------------------------------------------
31936
+ // ---------------------------------------------------------------------------
31841
31937
  async emitProjection(context, projection) {
31842
31938
  this.outputSeq += 1;
31843
31939
  this.pendingOutputs.set(
@@ -31849,9 +31945,9 @@ var ClaudeCodeOutputBuffer = class {
31849
31945
  async replayPendingOutputs() {
31850
31946
  await this.drainPendingOutputs({ force: true });
31851
31947
  }
31852
- // -----------------------------------------------------------------------------
31948
+ // ---------------------------------------------------------------------------
31853
31949
  // Transport emit
31854
- // -----------------------------------------------------------------------------
31950
+ // ---------------------------------------------------------------------------
31855
31951
  async drainPendingOutputs(options = {}) {
31856
31952
  if (this.drainPromise && options.force) {
31857
31953
  try {
@@ -32026,42 +32122,6 @@ function partialTextDeltaPayload(message, messageId) {
32026
32122
  };
32027
32123
  }
32028
32124
 
32029
- // src/commands/agent-bridge/harness/claude-code/resume-store.ts
32030
- import { existsSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
32031
- import { dirname as dirname3 } from "path";
32032
- var AGENT_BRIDGE_RUNTIME_DIR = "/tmp/auto-bridge-runtime";
32033
- var CLAUDE_SESSION_RESUME_PATH = `${AGENT_BRIDGE_RUNTIME_DIR}/claude-session-id`;
32034
- function fileClaudeSessionResumeStore(path2 = CLAUDE_SESSION_RESUME_PATH) {
32035
- return {
32036
- read(sessionId) {
32037
- if (!existsSync(path2)) {
32038
- return null;
32039
- }
32040
- const record2 = parseResumeRecord(readFileSync2(path2, "utf8"));
32041
- if (!record2 || record2.sessionId !== sessionId) {
32042
- return null;
32043
- }
32044
- return record2.agentId;
32045
- },
32046
- write(record2) {
32047
- mkdirSync2(dirname3(path2), { recursive: true });
32048
- writeFileSync2(path2, `${JSON.stringify(record2)}
32049
- `, "utf8");
32050
- }
32051
- };
32052
- }
32053
- function parseResumeRecord(raw) {
32054
- try {
32055
- const value = JSON.parse(raw);
32056
- if (value !== null && typeof value === "object" && "sessionId" in value && "agentId" in value && typeof value.sessionId === "string" && typeof value.agentId === "string" && value.agentId.length > 0) {
32057
- return { sessionId: value.sessionId, agentId: value.agentId };
32058
- }
32059
- return null;
32060
- } catch {
32061
- return null;
32062
- }
32063
- }
32064
-
32065
32125
  // src/commands/agent-bridge/harness/claude-code/session.ts
32066
32126
  import {
32067
32127
  startup as startupClaudeAgent
@@ -32795,21 +32855,50 @@ function contentBlocks(content) {
32795
32855
  );
32796
32856
  }
32797
32857
 
32798
- // src/commands/agent-bridge/harness/claude-code/index.ts
32799
- async function runAgentBridgeClaudeCode(options) {
32800
- const sessionResume = fileClaudeSessionResumeStore();
32801
- await runAgentBridgeSocket({
32802
- ...options,
32803
- createHandler: (input) => createClaudeCodeCommandHandler({ ...input, sessionResume })
32804
- });
32858
+ // src/commands/agent-bridge/harness/claude-code/resume-store.ts
32859
+ import { existsSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
32860
+ import { dirname as dirname3 } from "path";
32861
+ var AGENT_BRIDGE_RUNTIME_DIR = "/tmp/auto-bridge-runtime";
32862
+ var CLAUDE_SESSION_RESUME_PATH = `${AGENT_BRIDGE_RUNTIME_DIR}/claude-session-id`;
32863
+ function fileClaudeSessionResumeStore(path2 = CLAUDE_SESSION_RESUME_PATH) {
32864
+ return {
32865
+ read(sessionId) {
32866
+ if (!existsSync(path2)) {
32867
+ return null;
32868
+ }
32869
+ const record2 = parseResumeRecord(readFileSync2(path2, "utf8"));
32870
+ if (!record2 || record2.sessionId !== sessionId) {
32871
+ return null;
32872
+ }
32873
+ return record2.agentId;
32874
+ },
32875
+ write(record2) {
32876
+ mkdirSync2(dirname3(path2), { recursive: true });
32877
+ writeFileSync2(path2, `${JSON.stringify(record2)}
32878
+ `, "utf8");
32879
+ }
32880
+ };
32805
32881
  }
32882
+ function parseResumeRecord(raw) {
32883
+ try {
32884
+ const value = JSON.parse(raw);
32885
+ if (value !== null && typeof value === "object" && "sessionId" in value && "agentId" in value && typeof value.sessionId === "string" && typeof value.agentId === "string" && value.agentId.length > 0) {
32886
+ return { sessionId: value.sessionId, agentId: value.agentId };
32887
+ }
32888
+ return null;
32889
+ } catch {
32890
+ return null;
32891
+ }
32892
+ }
32893
+
32894
+ // src/commands/agent-bridge/harness/claude-code/index.ts
32806
32895
  function createClaudeCodeCommandHandler(input) {
32807
32896
  return new ClaudeCodeCommandHandler(input);
32808
32897
  }
32809
32898
  var ClaudeCodeCommandHandler = class {
32810
32899
  constructor(input) {
32811
32900
  this.input = input;
32812
- this.outputBuffer = new ClaudeCodeOutputBuffer(input);
32901
+ this.outputBuffer = new AgentBridgeOutputBuffer(input);
32813
32902
  }
32814
32903
  input;
32815
32904
  context = null;
@@ -33156,6 +33245,36 @@ function deliveryMode(delivery) {
33156
33245
  return "interrupt";
33157
33246
  }
33158
33247
 
33248
+ // src/commands/agent-bridge/harness/index.ts
33249
+ async function runAgentBridgeHarness(options) {
33250
+ await runAgentBridgeSocket({
33251
+ ...options,
33252
+ createHandler: createHarnessCommandHandler
33253
+ });
33254
+ }
33255
+ function createHarnessCommandHandler(input) {
33256
+ const config2 = resolveHarnessConfig(input.bootstrap);
33257
+ const base = {
33258
+ emitOutput: input.emitOutput,
33259
+ ...input.outputSeqStart !== void 0 ? { outputSeqStart: input.outputSeqStart } : {},
33260
+ socketId: input.socketId,
33261
+ ...input.writeOutput ? { writeOutput: input.writeOutput } : {}
33262
+ };
33263
+ switch (config2.kind) {
33264
+ case "claude-code": {
33265
+ const { kind, ...claude } = config2;
33266
+ return createClaudeCodeCommandHandler({
33267
+ ...base,
33268
+ claude,
33269
+ sessionResume: fileClaudeSessionResumeStore()
33270
+ });
33271
+ }
33272
+ }
33273
+ }
33274
+ function resolveHarnessConfig(bootstrap) {
33275
+ return bootstrap.harness ?? { kind: "claude-code", ...bootstrap.claude };
33276
+ }
33277
+
33159
33278
  // src/commands/agent-bridge/runtime-log.ts
33160
33279
  init_src();
33161
33280
  var RUNTIME_LOG_COMPONENT = "runtime-cli";
@@ -33197,7 +33316,7 @@ function replaceErrors(_key, value) {
33197
33316
 
33198
33317
  // src/commands/agent-bridge/entrypoint.ts
33199
33318
  async function runAgentBridgeProcess(input) {
33200
- const runAgentBridge = input.runAgentBridge ?? runAgentBridgeClaudeCode;
33319
+ const runAgentBridge = input.runAgentBridge ?? runAgentBridgeHarness;
33201
33320
  const log = createRuntimeLogger(input.env);
33202
33321
  log.info("agent bridge process starting", {
33203
33322
  bridge_url_host: bridgeUrlHost(input.env.AUTO_BRIDGE_URL),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.218",
3
+ "version": "0.1.220",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"