@autohq/cli 0.1.206 → 0.1.208

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.
@@ -21397,14 +21397,17 @@ var EventRoutingWorkflowInputSchema = external_exports.discriminatedUnion("kind"
21397
21397
  commandId: SessionCommandIdSchema2
21398
21398
  }).strict()
21399
21399
  ]);
21400
- var HeartbeatTickWorkflowInputSchema = external_exports.object({
21401
- scheduleId: external_exports.string().trim().min(1),
21402
- organizationId: external_exports.string().trim().min(1),
21403
- projectId: external_exports.string().trim().min(1).nullable(),
21404
- agentResourceId: external_exports.string().trim().min(1),
21405
- triggerOrdinal: external_exports.number().int().nonnegative(),
21406
- event: external_exports.string().trim().min(1)
21407
- }).strict();
21400
+ var HeartbeatTickWorkflowInputSchema = external_exports.preprocess(
21401
+ normalizeLegacyHeartbeatTickWorkflowInput,
21402
+ external_exports.object({
21403
+ scheduleId: external_exports.string().trim().min(1),
21404
+ organizationId: external_exports.string().trim().min(1),
21405
+ projectId: external_exports.string().trim().min(1).nullable(),
21406
+ agentResourceId: external_exports.string().trim().min(1),
21407
+ triggerOrdinal: external_exports.number().int().nonnegative(),
21408
+ event: external_exports.string().trim().min(1)
21409
+ }).strict()
21410
+ );
21408
21411
  var GithubPullRequestMergeabilityWorkflowInputSchema = external_exports.object({
21409
21412
  organizationId: external_exports.string().trim().min(1),
21410
21413
  providerGrantId: external_exports.string().trim().min(1),
@@ -21441,6 +21444,19 @@ var EventRoutingTriggerResultSchema = external_exports.object({
21441
21444
  matchedTriggers: external_exports.number().int().nonnegative(),
21442
21445
  deliveries: external_exports.number().int().nonnegative()
21443
21446
  });
21447
+ function normalizeLegacyHeartbeatTickWorkflowInput(input) {
21448
+ if (!input || typeof input !== "object" || Array.isArray(input)) {
21449
+ return input;
21450
+ }
21451
+ if ("agentResourceId" in input || !("sessionResourceId" in input)) {
21452
+ return input;
21453
+ }
21454
+ const { sessionResourceId, ...rest } = input;
21455
+ return {
21456
+ ...rest,
21457
+ agentResourceId: sessionResourceId
21458
+ };
21459
+ }
21444
21460
 
21445
21461
  // ../../packages/schemas/src/agents.ts
21446
21462
  var RESOURCE_KIND_AGENT = "agent";
@@ -23000,6 +23016,24 @@ var SetupOnboardingPullRequestStatusResponseSchema = external_exports.object({
23000
23016
  ready: external_exports.boolean()
23001
23017
  });
23002
23018
 
23019
+ // ../../packages/schemas/src/runtime-log.ts
23020
+ var RUNTIME_LOG_LEVELS = ["debug", "info", "warn", "error"];
23021
+ var RuntimeLogLevelSchema = external_exports.enum(RUNTIME_LOG_LEVELS);
23022
+ var DEFAULT_RUNTIME_LOG_LEVEL = "info";
23023
+ var LEVEL_SEVERITY = {
23024
+ debug: 10,
23025
+ info: 20,
23026
+ warn: 30,
23027
+ error: 40
23028
+ };
23029
+ function parseRuntimeLogLevel(value2) {
23030
+ const parsed = RuntimeLogLevelSchema.safeParse(value2?.trim());
23031
+ return parsed.success ? parsed.data : DEFAULT_RUNTIME_LOG_LEVEL;
23032
+ }
23033
+ function runtimeLogLevelEnabled(configured, lineLevel) {
23034
+ return LEVEL_SEVERITY[lineLevel] >= LEVEL_SEVERITY[configured];
23035
+ }
23036
+
23003
23037
  // ../../packages/schemas/src/runtimes.ts
23004
23038
  var RuntimeRecordSchema = external_exports.object({
23005
23039
  id: RuntimeIdSchema2,
@@ -26660,7 +26694,7 @@ Object.assign(lookup, {
26660
26694
  // package.json
26661
26695
  var package_default = {
26662
26696
  name: "@autohq/cli",
26663
- version: "0.1.206",
26697
+ version: "0.1.208",
26664
26698
  license: "SEE LICENSE IN README.md",
26665
26699
  publishConfig: {
26666
26700
  access: "public"
@@ -47891,13 +47925,61 @@ function deliveryMode(delivery) {
47891
47925
  return "interrupt";
47892
47926
  }
47893
47927
 
47928
+ // src/commands/agent-bridge/runtime-log.ts
47929
+ var RUNTIME_LOG_COMPONENT = "runtime-cli";
47930
+ function createRuntimeLogger(env = process.env) {
47931
+ const level = parseRuntimeLogLevel(env.AUTO_RUNTIME_LOG_LEVEL);
47932
+ const emit = (lineLevel) => {
47933
+ return (message, context) => {
47934
+ if (!runtimeLogLevelEnabled(level, lineLevel)) {
47935
+ return;
47936
+ }
47937
+ writeRuntimeLogLine(lineLevel, message, context);
47938
+ };
47939
+ };
47940
+ return {
47941
+ level,
47942
+ debug: emit("debug"),
47943
+ info: emit("info"),
47944
+ warn: emit("warn"),
47945
+ error: emit("error")
47946
+ };
47947
+ }
47948
+ function writeRuntimeLogLine(level, message, context) {
47949
+ const payload = {
47950
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
47951
+ level,
47952
+ component: RUNTIME_LOG_COMPONENT,
47953
+ message,
47954
+ ...context ?? {}
47955
+ };
47956
+ process.stderr.write(`${JSON.stringify(payload, replaceErrors)}
47957
+ `);
47958
+ }
47959
+ function replaceErrors(_key, value2) {
47960
+ if (value2 instanceof Error) {
47961
+ return { name: value2.name, message: value2.message, stack: value2.stack };
47962
+ }
47963
+ return value2;
47964
+ }
47965
+
47894
47966
  // src/commands/agent-bridge/entrypoint.ts
47895
47967
  async function runAgentBridgeProcess(input) {
47896
47968
  const runAgentBridge = input.runAgentBridge ?? runAgentBridgeClaudeCode;
47897
- await runAgentBridge({
47898
- ...agentBridgeOptionsFromEnv(input),
47899
- onBootstrap: createGitCredentialRelayStarter(input.writeOutput)
47969
+ const log = createRuntimeLogger(input.env);
47970
+ log.info("agent bridge process starting", {
47971
+ bridge_url_host: bridgeUrlHost(input.env.AUTO_BRIDGE_URL),
47972
+ log_level: log.level
47900
47973
  });
47974
+ try {
47975
+ await runAgentBridge({
47976
+ ...agentBridgeOptionsFromEnv(input),
47977
+ onBootstrap: createGitCredentialRelayStarter(input.writeOutput, log)
47978
+ });
47979
+ } catch (error51) {
47980
+ log.error("agent bridge process failed", { error: error51 });
47981
+ throw error51;
47982
+ }
47901
47983
  }
47902
47984
  function agentBridgeOptionsFromEnv(input) {
47903
47985
  return {
@@ -47906,7 +47988,7 @@ function agentBridgeOptionsFromEnv(input) {
47906
47988
  writeOutput: input.writeOutput
47907
47989
  };
47908
47990
  }
47909
- function createGitCredentialRelayStarter(writeOutput) {
47991
+ function createGitCredentialRelayStarter(writeOutput, log) {
47910
47992
  let relay;
47911
47993
  let startup;
47912
47994
  return async (bootstrap) => {
@@ -47926,12 +48008,14 @@ function createGitCredentialRelayStarter(writeOutput) {
47926
48008
  startup = startGitCredentialRelay(gitCredentials).then((started) => {
47927
48009
  relay = started;
47928
48010
  writeOutput?.(`agent_bridge_git_credential_relay port=${started.port}`);
48011
+ log?.info("git credential relay started", { port: started.port });
47929
48012
  return started;
47930
48013
  }).catch((error51) => {
47931
48014
  startup = void 0;
47932
48015
  writeOutput?.(
47933
48016
  `agent_bridge_git_credential_relay_failed error=${error51 instanceof Error ? error51.message : String(error51)}`
47934
48017
  );
48018
+ log?.warn("git credential relay failed to start", { error: error51 });
47935
48019
  return void 0;
47936
48020
  });
47937
48021
  await startup;
@@ -47944,6 +48028,16 @@ function requiredEnv(env, key) {
47944
48028
  }
47945
48029
  return value2;
47946
48030
  }
48031
+ function bridgeUrlHost(bridgeUrl) {
48032
+ if (!bridgeUrl) {
48033
+ return void 0;
48034
+ }
48035
+ try {
48036
+ return new URL(bridgeUrl).host;
48037
+ } catch {
48038
+ return void 0;
48039
+ }
48040
+ }
47947
48041
 
47948
48042
  // src/lib/entrypoint.ts
47949
48043
  import { realpathSync as realpathSync2 } from "fs";
package/dist/index.js CHANGED
@@ -17034,6 +17034,19 @@ var init_tools = __esm({
17034
17034
  });
17035
17035
 
17036
17036
  // ../../packages/schemas/src/trigger-router.ts
17037
+ function normalizeLegacyHeartbeatTickWorkflowInput(input) {
17038
+ if (!input || typeof input !== "object" || Array.isArray(input)) {
17039
+ return input;
17040
+ }
17041
+ if ("agentResourceId" in input || !("sessionResourceId" in input)) {
17042
+ return input;
17043
+ }
17044
+ const { sessionResourceId, ...rest } = input;
17045
+ return {
17046
+ ...rest,
17047
+ agentResourceId: sessionResourceId
17048
+ };
17049
+ }
17037
17050
  var CANONICAL_ROUTE_BY_KINDS, LEGACY_ROUTE_BY_KINDS, CanonicalRouteBySchema, LegacyRouteBySchema, RouteBySchema, SingletonRouteBySchema, TriggerRoutingSchema, SourceEventRequestSchema, EventRoutingWorkflowInputSchema, HeartbeatTickWorkflowInputSchema, GithubPullRequestMergeabilityWorkflowInputSchema, GithubPullRequestMergeabilityWorkflowResultSchema, EventRoutingTriggerResultSchema;
17038
17051
  var init_trigger_router = __esm({
17039
17052
  "../../packages/schemas/src/trigger-router.ts"() {
@@ -17123,14 +17136,17 @@ var init_trigger_router = __esm({
17123
17136
  commandId: SessionCommandIdSchema
17124
17137
  }).strict()
17125
17138
  ]);
17126
- HeartbeatTickWorkflowInputSchema = external_exports.object({
17127
- scheduleId: external_exports.string().trim().min(1),
17128
- organizationId: external_exports.string().trim().min(1),
17129
- projectId: external_exports.string().trim().min(1).nullable(),
17130
- agentResourceId: external_exports.string().trim().min(1),
17131
- triggerOrdinal: external_exports.number().int().nonnegative(),
17132
- event: external_exports.string().trim().min(1)
17133
- }).strict();
17139
+ HeartbeatTickWorkflowInputSchema = external_exports.preprocess(
17140
+ normalizeLegacyHeartbeatTickWorkflowInput,
17141
+ external_exports.object({
17142
+ scheduleId: external_exports.string().trim().min(1),
17143
+ organizationId: external_exports.string().trim().min(1),
17144
+ projectId: external_exports.string().trim().min(1).nullable(),
17145
+ agentResourceId: external_exports.string().trim().min(1),
17146
+ triggerOrdinal: external_exports.number().int().nonnegative(),
17147
+ event: external_exports.string().trim().min(1)
17148
+ }).strict()
17149
+ );
17134
17150
  GithubPullRequestMergeabilityWorkflowInputSchema = external_exports.object({
17135
17151
  organizationId: external_exports.string().trim().min(1),
17136
17152
  providerGrantId: external_exports.string().trim().min(1),
@@ -18916,6 +18932,31 @@ var init_setup = __esm({
18916
18932
  }
18917
18933
  });
18918
18934
 
18935
+ // ../../packages/schemas/src/runtime-log.ts
18936
+ function parseRuntimeLogLevel(value) {
18937
+ const parsed = RuntimeLogLevelSchema.safeParse(value?.trim());
18938
+ return parsed.success ? parsed.data : DEFAULT_RUNTIME_LOG_LEVEL;
18939
+ }
18940
+ function runtimeLogLevelEnabled(configured, lineLevel) {
18941
+ return LEVEL_SEVERITY[lineLevel] >= LEVEL_SEVERITY[configured];
18942
+ }
18943
+ var RUNTIME_LOG_LEVELS, RuntimeLogLevelSchema, DEFAULT_RUNTIME_LOG_LEVEL, LEVEL_SEVERITY;
18944
+ var init_runtime_log = __esm({
18945
+ "../../packages/schemas/src/runtime-log.ts"() {
18946
+ "use strict";
18947
+ init_zod();
18948
+ RUNTIME_LOG_LEVELS = ["debug", "info", "warn", "error"];
18949
+ RuntimeLogLevelSchema = external_exports.enum(RUNTIME_LOG_LEVELS);
18950
+ DEFAULT_RUNTIME_LOG_LEVEL = "info";
18951
+ LEVEL_SEVERITY = {
18952
+ debug: 10,
18953
+ info: 20,
18954
+ warn: 30,
18955
+ error: 40
18956
+ };
18957
+ }
18958
+ });
18959
+
18919
18960
  // ../../packages/schemas/src/runtimes.ts
18920
18961
  var RuntimeRecordSchema, SessionCommandDispatchWorkflowInputSchema, SessionCommandDispatchSignalPayloadSchema, RealtimeRunCursorSchema;
18921
18962
  var init_runtimes = __esm({
@@ -18983,6 +19024,7 @@ var init_src = __esm({
18983
19024
  init_secrets();
18984
19025
  init_session_commands();
18985
19026
  init_setup();
19027
+ init_runtime_log();
18986
19028
  init_runtimes();
18987
19029
  init_sessions();
18988
19030
  init_agents();
@@ -21673,7 +21715,7 @@ var init_package = __esm({
21673
21715
  "package.json"() {
21674
21716
  package_default = {
21675
21717
  name: "@autohq/cli",
21676
- version: "0.1.206",
21718
+ version: "0.1.208",
21677
21719
  license: "SEE LICENSE IN README.md",
21678
21720
  publishConfig: {
21679
21721
  access: "public"
@@ -32966,13 +33008,62 @@ function deliveryMode(delivery) {
32966
33008
  return "interrupt";
32967
33009
  }
32968
33010
 
33011
+ // src/commands/agent-bridge/runtime-log.ts
33012
+ init_src();
33013
+ var RUNTIME_LOG_COMPONENT = "runtime-cli";
33014
+ function createRuntimeLogger(env = process.env) {
33015
+ const level = parseRuntimeLogLevel(env.AUTO_RUNTIME_LOG_LEVEL);
33016
+ const emit = (lineLevel) => {
33017
+ return (message, context) => {
33018
+ if (!runtimeLogLevelEnabled(level, lineLevel)) {
33019
+ return;
33020
+ }
33021
+ writeRuntimeLogLine(lineLevel, message, context);
33022
+ };
33023
+ };
33024
+ return {
33025
+ level,
33026
+ debug: emit("debug"),
33027
+ info: emit("info"),
33028
+ warn: emit("warn"),
33029
+ error: emit("error")
33030
+ };
33031
+ }
33032
+ function writeRuntimeLogLine(level, message, context) {
33033
+ const payload = {
33034
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
33035
+ level,
33036
+ component: RUNTIME_LOG_COMPONENT,
33037
+ message,
33038
+ ...context ?? {}
33039
+ };
33040
+ process.stderr.write(`${JSON.stringify(payload, replaceErrors)}
33041
+ `);
33042
+ }
33043
+ function replaceErrors(_key, value) {
33044
+ if (value instanceof Error) {
33045
+ return { name: value.name, message: value.message, stack: value.stack };
33046
+ }
33047
+ return value;
33048
+ }
33049
+
32969
33050
  // src/commands/agent-bridge/entrypoint.ts
32970
33051
  async function runAgentBridgeProcess(input) {
32971
33052
  const runAgentBridge = input.runAgentBridge ?? runAgentBridgeClaudeCode;
32972
- await runAgentBridge({
32973
- ...agentBridgeOptionsFromEnv(input),
32974
- onBootstrap: createGitCredentialRelayStarter(input.writeOutput)
33053
+ const log = createRuntimeLogger(input.env);
33054
+ log.info("agent bridge process starting", {
33055
+ bridge_url_host: bridgeUrlHost(input.env.AUTO_BRIDGE_URL),
33056
+ log_level: log.level
32975
33057
  });
33058
+ try {
33059
+ await runAgentBridge({
33060
+ ...agentBridgeOptionsFromEnv(input),
33061
+ onBootstrap: createGitCredentialRelayStarter(input.writeOutput, log)
33062
+ });
33063
+ } catch (error51) {
33064
+ log.error("agent bridge process failed", { error: error51 });
33065
+ throw error51;
33066
+ }
32976
33067
  }
32977
33068
  function agentBridgeOptionsFromEnv(input) {
32978
33069
  return {
@@ -32981,7 +33072,7 @@ function agentBridgeOptionsFromEnv(input) {
32981
33072
  writeOutput: input.writeOutput
32982
33073
  };
32983
33074
  }
32984
- function createGitCredentialRelayStarter(writeOutput) {
33075
+ function createGitCredentialRelayStarter(writeOutput, log) {
32985
33076
  let relay;
32986
33077
  let startup;
32987
33078
  return async (bootstrap) => {
@@ -33001,12 +33092,14 @@ function createGitCredentialRelayStarter(writeOutput) {
33001
33092
  startup = startGitCredentialRelay(gitCredentials).then((started) => {
33002
33093
  relay = started;
33003
33094
  writeOutput?.(`agent_bridge_git_credential_relay port=${started.port}`);
33095
+ log?.info("git credential relay started", { port: started.port });
33004
33096
  return started;
33005
33097
  }).catch((error51) => {
33006
33098
  startup = void 0;
33007
33099
  writeOutput?.(
33008
33100
  `agent_bridge_git_credential_relay_failed error=${error51 instanceof Error ? error51.message : String(error51)}`
33009
33101
  );
33102
+ log?.warn("git credential relay failed to start", { error: error51 });
33010
33103
  return void 0;
33011
33104
  });
33012
33105
  await startup;
@@ -33019,6 +33112,16 @@ function requiredEnv(env, key) {
33019
33112
  }
33020
33113
  return value;
33021
33114
  }
33115
+ function bridgeUrlHost(bridgeUrl) {
33116
+ if (!bridgeUrl) {
33117
+ return void 0;
33118
+ }
33119
+ try {
33120
+ return new URL(bridgeUrl).host;
33121
+ } catch {
33122
+ return void 0;
33123
+ }
33124
+ }
33022
33125
 
33023
33126
  // src/commands/agent-bridge/commands.ts
33024
33127
  function registerAgentBridgeCommands(program, context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.206",
3
+ "version": "0.1.208",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"