@autohq/cli 0.1.218 → 0.1.219

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(),
@@ -21829,7 +21829,7 @@ var init_package = __esm({
21829
21829
  "package.json"() {
21830
21830
  package_default = {
21831
21831
  name: "@autohq/cli",
21832
- version: "0.1.218",
21832
+ version: "0.1.219",
21833
21833
  license: "SEE LICENSE IN README.md",
21834
21834
  publishConfig: {
21835
21835
  access: "public"
@@ -31296,20 +31296,33 @@ var AgentBridgeMcpServerConfigSchema = external_exports.object({
31296
31296
  url: external_exports.string().trim().min(1),
31297
31297
  headers: external_exports.record(external_exports.string().trim().min(1), external_exports.string()).optional()
31298
31298
  });
31299
- var AgentBridgeClaudeConfigSchema = external_exports.object({
31299
+ var AgentBridgeHarnessBaseConfigSchema = external_exports.object({
31300
31300
  cwd: external_exports.string().trim().min(1).optional(),
31301
31301
  env: external_exports.record(external_exports.string().trim().min(1), external_exports.string()),
31302
31302
  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.
31303
+ // Profile instructions, delivered as additive agent identity guidance (the
31304
+ // Claude Agent SDK's `{ type: "preset", preset: "claude_code", append }`;
31305
+ // future harnesses layer their own equivalent on top of their built-in base
31306
+ // prompt) so an agent's identity is part of its frame rather than its first
31307
+ // user message. Optional and strip-tolerant per the skew contract.
31307
31308
  systemPromptAppend: external_exports.string().trim().min(1).optional()
31308
31309
  });
31310
+ var AgentBridgeClaudeConfigSchema = AgentBridgeHarnessBaseConfigSchema;
31311
+ var AgentBridgeHarnessConfigSchema = external_exports.discriminatedUnion("kind", [
31312
+ AgentBridgeHarnessBaseConfigSchema.extend({
31313
+ kind: external_exports.literal("claude-code")
31314
+ })
31315
+ ]);
31309
31316
  var RuntimeBridgeBootstrapPlaintextSchema = external_exports.object({
31310
31317
  version: external_exports.literal(1),
31311
31318
  outputSeqStart: external_exports.number().int().nonnegative(),
31312
31319
  claude: AgentBridgeClaudeConfigSchema,
31320
+ // Runtime-generic harness selection + config. Additive and optional: a worker
31321
+ // that does not emit it (or a CLI old enough to strip it) falls back to the
31322
+ // legacy `claude` field as a claude-code harness. A worker only starts
31323
+ // emitting `harness` once a CLI release that parses it has reached sandboxes,
31324
+ // per the bootstrap/CLI rollout-ordering contract above.
31325
+ harness: AgentBridgeHarnessConfigSchema.optional(),
31313
31326
  // Endpoint + session token for the git credential broker. Present only when
31314
31327
  // the session has GitHub App git mounts; rides the encrypted bootstrap so the
31315
31328
  // token lives in agent-bridge memory, never on disk.
@@ -31453,28 +31466,6 @@ var RuntimeBridgeOutputAckSchema = external_exports.object({
31453
31466
  at: external_exports.string().datetime()
31454
31467
  }).strict();
31455
31468
 
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
31469
  // ../../packages/protocol/src/bootstrap-crypto.ts
31479
31470
  init_zod();
31480
31471
  import {
@@ -31538,6 +31529,27 @@ function bootstrapAdditionalData(input) {
31538
31529
  // src/commands/agent-bridge/socket.ts
31539
31530
  init_version();
31540
31531
  import { io } from "socket.io-client";
31532
+
31533
+ // src/commands/agent-bridge/command-ack.ts
31534
+ function commandAck(input) {
31535
+ return RuntimeBridgeCommandAckSchema.parse({
31536
+ type: "command.ack",
31537
+ deliveryId: input.delivery.deliveryId,
31538
+ commandId: input.delivery.commandId,
31539
+ sessionId: input.delivery.sessionId,
31540
+ runtimeId: input.delivery.runtimeId,
31541
+ bridgeLeaseId: input.delivery.bridgeLeaseId,
31542
+ status: input.status,
31543
+ socketId: input.socketId ?? null,
31544
+ ...input.error ? { error: input.error } : {},
31545
+ at: now()
31546
+ });
31547
+ }
31548
+ function now() {
31549
+ return (/* @__PURE__ */ new Date()).toISOString();
31550
+ }
31551
+
31552
+ // src/commands/agent-bridge/socket.ts
31541
31553
  var AGENT_BRIDGE_TERMINAL_AUTH_EXIT_CODE = 78;
31542
31554
  var TERMINAL_AUTH_ERROR_MESSAGES = /* @__PURE__ */ new Set([
31543
31555
  "Bridge token is invalid or expired"
@@ -31601,7 +31613,7 @@ async function runAgentBridgeSocket(options) {
31601
31613
  onBootstrap: options.onBootstrap,
31602
31614
  createHandler: (bootstrap) => options.createHandler({
31603
31615
  emitOutput: (output) => emitOutputWithAck(socket, output),
31604
- claude: bootstrap.claude,
31616
+ bootstrap,
31605
31617
  outputSeqStart: bootstrap.outputSeqStart,
31606
31618
  socketId: () => socket.id,
31607
31619
  writeOutput: options.writeOutput
@@ -31824,8 +31836,11 @@ function isNgrokFreeUrl(url2) {
31824
31836
  }
31825
31837
  }
31826
31838
 
31827
- // src/commands/agent-bridge/harness/claude-code/buffer.ts
31828
- var ClaudeCodeOutputBuffer = class {
31839
+ // src/commands/agent-bridge/harness/claude-code/index.ts
31840
+ init_src();
31841
+
31842
+ // src/commands/agent-bridge/harness/output-buffer.ts
31843
+ var AgentBridgeOutputBuffer = class {
31829
31844
  constructor(input) {
31830
31845
  this.input = input;
31831
31846
  this.outputSeq = input.outputSeqStart ?? 0;
@@ -31835,9 +31850,9 @@ var ClaudeCodeOutputBuffer = class {
31835
31850
  pendingOutputs = /* @__PURE__ */ new Map();
31836
31851
  drainBlocked = false;
31837
31852
  drainPromise = null;
31838
- // -----------------------------------------------------------------------------
31853
+ // ---------------------------------------------------------------------------
31839
31854
  // Public API
31840
- // -----------------------------------------------------------------------------
31855
+ // ---------------------------------------------------------------------------
31841
31856
  async emitProjection(context, projection) {
31842
31857
  this.outputSeq += 1;
31843
31858
  this.pendingOutputs.set(
@@ -31849,9 +31864,9 @@ var ClaudeCodeOutputBuffer = class {
31849
31864
  async replayPendingOutputs() {
31850
31865
  await this.drainPendingOutputs({ force: true });
31851
31866
  }
31852
- // -----------------------------------------------------------------------------
31867
+ // ---------------------------------------------------------------------------
31853
31868
  // Transport emit
31854
- // -----------------------------------------------------------------------------
31869
+ // ---------------------------------------------------------------------------
31855
31870
  async drainPendingOutputs(options = {}) {
31856
31871
  if (this.drainPromise && options.force) {
31857
31872
  try {
@@ -32026,42 +32041,6 @@ function partialTextDeltaPayload(message, messageId) {
32026
32041
  };
32027
32042
  }
32028
32043
 
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
32044
  // src/commands/agent-bridge/harness/claude-code/session.ts
32066
32045
  import {
32067
32046
  startup as startupClaudeAgent
@@ -32795,21 +32774,50 @@ function contentBlocks(content) {
32795
32774
  );
32796
32775
  }
32797
32776
 
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
- });
32777
+ // src/commands/agent-bridge/harness/claude-code/resume-store.ts
32778
+ import { existsSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
32779
+ import { dirname as dirname3 } from "path";
32780
+ var AGENT_BRIDGE_RUNTIME_DIR = "/tmp/auto-bridge-runtime";
32781
+ var CLAUDE_SESSION_RESUME_PATH = `${AGENT_BRIDGE_RUNTIME_DIR}/claude-session-id`;
32782
+ function fileClaudeSessionResumeStore(path2 = CLAUDE_SESSION_RESUME_PATH) {
32783
+ return {
32784
+ read(sessionId) {
32785
+ if (!existsSync(path2)) {
32786
+ return null;
32787
+ }
32788
+ const record2 = parseResumeRecord(readFileSync2(path2, "utf8"));
32789
+ if (!record2 || record2.sessionId !== sessionId) {
32790
+ return null;
32791
+ }
32792
+ return record2.agentId;
32793
+ },
32794
+ write(record2) {
32795
+ mkdirSync2(dirname3(path2), { recursive: true });
32796
+ writeFileSync2(path2, `${JSON.stringify(record2)}
32797
+ `, "utf8");
32798
+ }
32799
+ };
32805
32800
  }
32801
+ function parseResumeRecord(raw) {
32802
+ try {
32803
+ const value = JSON.parse(raw);
32804
+ if (value !== null && typeof value === "object" && "sessionId" in value && "agentId" in value && typeof value.sessionId === "string" && typeof value.agentId === "string" && value.agentId.length > 0) {
32805
+ return { sessionId: value.sessionId, agentId: value.agentId };
32806
+ }
32807
+ return null;
32808
+ } catch {
32809
+ return null;
32810
+ }
32811
+ }
32812
+
32813
+ // src/commands/agent-bridge/harness/claude-code/index.ts
32806
32814
  function createClaudeCodeCommandHandler(input) {
32807
32815
  return new ClaudeCodeCommandHandler(input);
32808
32816
  }
32809
32817
  var ClaudeCodeCommandHandler = class {
32810
32818
  constructor(input) {
32811
32819
  this.input = input;
32812
- this.outputBuffer = new ClaudeCodeOutputBuffer(input);
32820
+ this.outputBuffer = new AgentBridgeOutputBuffer(input);
32813
32821
  }
32814
32822
  input;
32815
32823
  context = null;
@@ -33156,6 +33164,36 @@ function deliveryMode(delivery) {
33156
33164
  return "interrupt";
33157
33165
  }
33158
33166
 
33167
+ // src/commands/agent-bridge/harness/index.ts
33168
+ async function runAgentBridgeHarness(options) {
33169
+ await runAgentBridgeSocket({
33170
+ ...options,
33171
+ createHandler: createHarnessCommandHandler
33172
+ });
33173
+ }
33174
+ function createHarnessCommandHandler(input) {
33175
+ const config2 = resolveHarnessConfig(input.bootstrap);
33176
+ const base = {
33177
+ emitOutput: input.emitOutput,
33178
+ ...input.outputSeqStart !== void 0 ? { outputSeqStart: input.outputSeqStart } : {},
33179
+ socketId: input.socketId,
33180
+ ...input.writeOutput ? { writeOutput: input.writeOutput } : {}
33181
+ };
33182
+ switch (config2.kind) {
33183
+ case "claude-code": {
33184
+ const { kind, ...claude } = config2;
33185
+ return createClaudeCodeCommandHandler({
33186
+ ...base,
33187
+ claude,
33188
+ sessionResume: fileClaudeSessionResumeStore()
33189
+ });
33190
+ }
33191
+ }
33192
+ }
33193
+ function resolveHarnessConfig(bootstrap) {
33194
+ return bootstrap.harness ?? { kind: "claude-code", ...bootstrap.claude };
33195
+ }
33196
+
33159
33197
  // src/commands/agent-bridge/runtime-log.ts
33160
33198
  init_src();
33161
33199
  var RUNTIME_LOG_COMPONENT = "runtime-cli";
@@ -33197,7 +33235,7 @@ function replaceErrors(_key, value) {
33197
33235
 
33198
33236
  // src/commands/agent-bridge/entrypoint.ts
33199
33237
  async function runAgentBridgeProcess(input) {
33200
- const runAgentBridge = input.runAgentBridge ?? runAgentBridgeClaudeCode;
33238
+ const runAgentBridge = input.runAgentBridge ?? runAgentBridgeHarness;
33201
33239
  const log = createRuntimeLogger(input.env);
33202
33240
  log.info("agent bridge process starting", {
33203
33241
  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.219",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"