@lobehub/cli 0.0.162 → 0.0.164

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
@@ -7018,7 +7018,7 @@ var init_heterogeneousAgent = __esmMin((() => {
7018
7018
 
7019
7019
  //#endregion
7020
7020
  //#region ../../packages/types/src/agent/heteroSelectorCapabilities.ts
7021
- var HETEROGENEOUS_AGENT_DEFAULT_SELECTION, AMP_AGENT_MODES, CLAUDE_CODE_REASONING_EFFORT_LEVELS, GROK_BUILD_REASONING_EFFORT_LEVELS, GROK_BUILD_REASONING_EFFORT_FLAGS, CODEX_COMMON_REASONING_EFFORT_LEVELS, CODEX_REASONING_EFFORT_LEVELS, CODEX_REASONING_EFFORT_CONFIG_KEY$1, CODEX_DEEPSEEK_V4_REASONING_EFFORT_LEVELS, CODEX_GLM_5_2_REASONING_EFFORT_LEVELS, CODEX_MAX_REASONING_EFFORT_LEVELS, CODEX_ULTRA_REASONING_MODELS, CODEX_MAX_REASONING_MODELS, QODER_REASONING_EFFORT_LEVELS, QODER_REASONING_EFFORT_FLAG, COPILOT_REASONING_EFFORT_LEVELS, COPILOT_REASONING_EFFORT_FLAG, CODEX_SERVICE_TIER_CONFIG_KEY$1, toCodexServiceTier, CODEX_FAST_SERVICE_TIER_VALUES, isAmpAgentMode, isClaudeCodeReasoningEffort, isCodexReasoningEffort, isGrokBuildReasoningEffort, isQoderReasoningEffort, isCopilotReasoningEffort, isCodexFastServiceTier, getCodexReasoningEffortLevels, resolveAmpAgentMode, CODEX_MODEL_FLAGS$2, resolveClaudeCodeModel, resolveClaudeCodeReasoningEffort, resolveCodexModel, resolveCodexReasoningEffort, resolveCodexSpeedMode, resolveGrokBuildReasoningEffort, resolveQoderReasoningEffort, resolveCopilotReasoningEffort, resolvePersistedModel, parseModelTuple, MODEL_FLAGS_ENCODING, HETERO_SELECTOR_CAPABILITIES, modelFlagsOf, COPILOT_MODEL_FLAGS, GROK_BUILD_MODEL_FLAGS, KIMI_CODE_MODEL_FLAGS, OPENCODE_MODEL_FLAGS, PI_MODEL_FLAGS, QODER_MODEL_FLAGS;
7021
+ var HETEROGENEOUS_AGENT_DEFAULT_SELECTION, AMP_AGENT_MODES, CLAUDE_CODE_REASONING_EFFORT_LEVELS, ANTIGRAVITY_REASONING_EFFORT_LEVELS, GROK_BUILD_REASONING_EFFORT_LEVELS, GROK_BUILD_REASONING_EFFORT_FLAGS, CODEX_COMMON_REASONING_EFFORT_LEVELS, CODEX_REASONING_EFFORT_LEVELS, CODEX_REASONING_EFFORT_CONFIG_KEY$1, CODEX_DEEPSEEK_V4_REASONING_EFFORT_LEVELS, CODEX_GLM_5_2_REASONING_EFFORT_LEVELS, CODEX_MAX_REASONING_EFFORT_LEVELS, CODEX_ULTRA_REASONING_MODELS, CODEX_MAX_REASONING_MODELS, QODER_REASONING_EFFORT_LEVELS, QODER_REASONING_EFFORT_FLAG, COPILOT_REASONING_EFFORT_LEVELS, COPILOT_REASONING_EFFORT_FLAG, CODEX_SERVICE_TIER_CONFIG_KEY$1, toCodexServiceTier, CODEX_FAST_SERVICE_TIER_VALUES, isAmpAgentMode, isClaudeCodeReasoningEffort, isCodexReasoningEffort, isGrokBuildReasoningEffort, isQoderReasoningEffort, isCopilotReasoningEffort, isCodexFastServiceTier, getCodexReasoningEffortLevels, resolveAmpAgentMode, CODEX_MODEL_FLAGS$2, resolveClaudeCodeModel, resolveClaudeCodeReasoningEffort, resolveCodexModel, resolveCodexReasoningEffort, resolveCodexSpeedMode, resolveGrokBuildReasoningEffort, resolveQoderReasoningEffort, resolveCopilotReasoningEffort, resolvePersistedModel, parseModelTuple, MODEL_FLAGS_ENCODING, HETERO_SELECTOR_CAPABILITIES, modelFlagsOf, COPILOT_MODEL_FLAGS, GROK_BUILD_MODEL_FLAGS, KIMI_CODE_MODEL_FLAGS, OPENCODE_MODEL_FLAGS, PI_MODEL_FLAGS, QODER_MODEL_FLAGS;
7022
7022
  var init_heteroSelectorCapabilities = __esmMin((() => {
7023
7023
  init_heteroCliArgs();
7024
7024
  HETEROGENEOUS_AGENT_DEFAULT_SELECTION = "default";
@@ -7035,6 +7035,13 @@ var init_heteroSelectorCapabilities = __esmMin((() => {
7035
7035
  "xhigh",
7036
7036
  "max"
7037
7037
  ];
7038
+ ANTIGRAVITY_REASONING_EFFORT_LEVELS = [
7039
+ "low",
7040
+ "medium",
7041
+ "high",
7042
+ "xhigh",
7043
+ "max"
7044
+ ];
7038
7045
  GROK_BUILD_REASONING_EFFORT_LEVELS = [
7039
7046
  "low",
7040
7047
  "medium",
@@ -7158,14 +7165,24 @@ var init_heteroSelectorCapabilities = __esmMin((() => {
7158
7165
  kind: "flag"
7159
7166
  };
7160
7167
  HETERO_SELECTOR_CAPABILITIES = {
7161
- "antigravity": { model: {
7162
- encodings: [{
7163
- flags: ["--model"],
7164
- kind: "flag"
7165
- }],
7166
- resolve: resolvePersistedModel,
7167
- source: "catalog"
7168
- } },
7168
+ "antigravity": {
7169
+ effort: {
7170
+ encodings: [{
7171
+ flags: ["--effort"],
7172
+ kind: "flag"
7173
+ }],
7174
+ levels: (model, models) => models ? models.find((entry) => entry.id === model)?.effortLevels ?? [] : ANTIGRAVITY_REASONING_EFFORT_LEVELS,
7175
+ resolve: resolveClaudeCodeReasoningEffort
7176
+ },
7177
+ model: {
7178
+ encodings: [{
7179
+ flags: ["--model"],
7180
+ kind: "flag"
7181
+ }],
7182
+ resolve: resolveClaudeCodeModel,
7183
+ source: "catalog"
7184
+ }
7185
+ },
7169
7186
  "amp": { mode: {
7170
7187
  encodings: [{
7171
7188
  flags: ["--mode"],
@@ -60934,7 +60951,7 @@ const fetchAntigravityQuota = async (params = {}) => {
60934
60951
  "--print-timeout",
60935
60952
  "15s"
60936
60953
  ], env);
60937
- const { stdout } = await execFilePromise$1(plan.command, plan.args, {
60954
+ const query = execFilePromise$1(plan.command, plan.args, {
60938
60955
  cwd: tmpdir(),
60939
60956
  encoding: "utf8",
60940
60957
  env,
@@ -60943,6 +60960,10 @@ const fetchAntigravityQuota = async (params = {}) => {
60943
60960
  timeout: 2e4,
60944
60961
  windowsHide: true
60945
60962
  });
60963
+ query.child?.stderr?.on("data", (chunk) => {
60964
+ if (String(chunk).includes("Authentication required. Please visit the URL to log in:")) query.child.kill("SIGKILL");
60965
+ });
60966
+ const { stdout } = await query;
60946
60967
  let payload;
60947
60968
  try {
60948
60969
  payload = JSON.parse(stdout);
@@ -60964,7 +60985,7 @@ const fetchAntigravityQuota = async (params = {}) => {
60964
60985
  } catch (error) {
60965
60986
  const record = isRecord$8(error) ? error : {};
60966
60987
  const detail = `${record.stderr ?? ""} ${record.message ?? ""}`;
60967
- return failure(record.code === "ENOENT" ? "cli_not_found" : record.killed || record.code === "ETIMEDOUT" ? "timeout" : isHeterogeneousAgentAuthRequired("antigravity", detail) ? "auth_required" : "command_failed");
60988
+ return failure(record.code === "ENOENT" ? "cli_not_found" : isHeterogeneousAgentAuthRequired("antigravity", detail) ? "auth_required" : record.killed || record.code === "ETIMEDOUT" ? "timeout" : "command_failed");
60968
60989
  }
60969
60990
  };
60970
60991
 
@@ -65937,27 +65958,36 @@ const stringifyOutput = (value) => typeof value === "string" ? value : value ===
65937
65958
  /**
65938
65959
  * Native agy NDJSON protocol, not the Gemini/Claude stream-json protocol.
65939
65960
  * https://antigravity.google/docs/cli/headless/
65940
- * LobeHub uses one process per turn and --conversation to resume. The native
65941
- * protocol also supports multiple turns while stdin remains open.
65961
+ * Supports both one-shot turns and multi-turn liveInput steering while stdin remains open.
65942
65962
  */
65943
65963
  var AntigravityAdapter = class {
65944
65964
  sessionId;
65945
65965
  completedSteps = /* @__PURE__ */ new Set();
65946
65966
  flushed = false;
65947
65967
  hasResponseText = false;
65968
+ latestTurnCompleted = false;
65948
65969
  model;
65949
65970
  pendingTools = /* @__PURE__ */ new Map();
65950
65971
  resultReceived = false;
65951
65972
  completionValidated = false;
65952
65973
  responseStep;
65974
+ runtimeEndStrategy;
65975
+ seenInitialUserInput = false;
65976
+ seenUserInputSteps = /* @__PURE__ */ new Set();
65953
65977
  stepIndex = 0;
65954
65978
  stepTools = [];
65955
65979
  streamOpen = false;
65980
+ takeNextSteerUuid;
65956
65981
  toolSinceResponse = false;
65957
65982
  usageByStep = /* @__PURE__ */ new Map();
65983
+ constructor(options = {}) {
65984
+ this.runtimeEndStrategy = options.runtimeEndStrategy ?? "on-result";
65985
+ this.takeNextSteerUuid = options.takeNextSteerUuid;
65986
+ }
65958
65987
  adapt(raw) {
65959
65988
  if (this.flushed || this.resultReceived || !isRecord$8(raw)) return [];
65960
65989
  if (raw.event === "init") {
65990
+ this.latestTurnCompleted = false;
65961
65991
  this.sessionId = pickString$1(raw.conversation_id);
65962
65992
  this.model = pickString$1(toRecord(raw.init)?.model);
65963
65993
  return this.openStream();
@@ -65971,8 +66001,24 @@ var AntigravityAdapter = class {
65971
66001
  if (this.sessionId && conversationId && conversationId !== this.sessionId) return [];
65972
66002
  this.sessionId ??= conversationId;
65973
66003
  if (this.completedSteps.has(index)) return [];
66004
+ this.latestTurnCompleted = false;
65974
66005
  const events = [];
65975
- if (step.step_type === "agent_response") {
66006
+ if (step.step_type === "user_input") {
66007
+ if (!this.seenUserInputSteps.has(index)) {
66008
+ this.seenUserInputSteps.add(index);
66009
+ if (!this.seenInitialUserInput) this.seenInitialUserInput = true;
66010
+ else {
66011
+ const uuid = this.takeNextSteerUuid?.();
66012
+ if (uuid) {
66013
+ events.push(...this.closeStream());
66014
+ events.push(this.event("step_complete", {
66015
+ phase: "user_message",
66016
+ uuid
66017
+ }));
66018
+ }
66019
+ }
66020
+ }
66021
+ } else if (step.step_type === "agent_response") {
65976
66022
  if (this.toolSinceResponse || this.responseStep !== void 0 && this.responseStep !== index) {
65977
66023
  events.push(...this.closeStream());
65978
66024
  this.stepIndex += 1;
@@ -66003,7 +66049,7 @@ var AntigravityAdapter = class {
66003
66049
  return [...this.settlePendingTools("Antigravity ended before this tool returned a result."), ...this.closeStream()];
66004
66050
  }
66005
66051
  validateCompletion() {
66006
- if (this.resultReceived || this.completionValidated) return [];
66052
+ if (this.resultReceived || this.latestTurnCompleted || this.completionValidated) return [];
66007
66053
  this.completionValidated = true;
66008
66054
  return [this.event("error", {
66009
66055
  agentType: IDENTIFIER,
@@ -66115,7 +66161,9 @@ var AntigravityAdapter = class {
66115
66161
  return events;
66116
66162
  }
66117
66163
  handleResult(result) {
66118
- this.resultReceived = true;
66164
+ const keepOpenForMoreTurns = this.runtimeEndStrategy === "on-transport-close" && result.status === "SUCCESS";
66165
+ if (!keepOpenForMoreTurns) this.resultReceived = true;
66166
+ this.latestTurnCompleted = true;
66119
66167
  this.sessionId ??= pickString$1(result.conversation_id);
66120
66168
  const hasPendingTools = this.pendingTools.size > 0;
66121
66169
  const events = this.settlePendingTools("Antigravity ended before this tool returned a result.");
@@ -66147,6 +66195,13 @@ var AntigravityAdapter = class {
66147
66195
  }));
66148
66196
  }
66149
66197
  events.push(...this.closeStream());
66198
+ if (keepOpenForMoreTurns) {
66199
+ this.hasResponseText = false;
66200
+ this.responseStep = void 0;
66201
+ this.toolSinceResponse = false;
66202
+ this.stepTools = [];
66203
+ this.stepIndex += 1;
66204
+ }
66150
66205
  return events;
66151
66206
  }
66152
66207
  event(type, data, stepIndex = this.stepIndex) {
@@ -71641,6 +71696,11 @@ const ANTIGRAVITY_BASE_ARGS = [
71641
71696
  "stream-json",
71642
71697
  "--dangerously-skip-permissions"
71643
71698
  ];
71699
+ const FULL_ACCESS_SETTINGS = JSON.stringify({
71700
+ agentMode: "",
71701
+ allowNonWorkspaceAccess: true,
71702
+ enableTerminalSandbox: false
71703
+ });
71644
71704
  const MANAGED_FLAGS = new Set([
71645
71705
  "--",
71646
71706
  "--input-format",
@@ -71658,13 +71718,175 @@ const MANAGED_FLAGS = new Set([
71658
71718
  const buildAntigravityArgs = ({ extraArgs = [], resumeSessionId }) => {
71659
71719
  const conflicting = extraArgs.find((arg) => MANAGED_FLAGS.has(arg.split("=")[0]));
71660
71720
  if (conflicting) throw new Error(`LobeHub manages Antigravity's prompt, output and session flags: ${conflicting}`);
71721
+ const hasCustomPermissionSettings = extraArgs.some((arg) => [
71722
+ "--mode",
71723
+ "--sandbox",
71724
+ "--settings"
71725
+ ].includes(arg.split("=")[0]));
71661
71726
  return [
71662
71727
  ...ANTIGRAVITY_BASE_ARGS,
71728
+ ...hasCustomPermissionSettings ? [] : ["--settings", FULL_ACCESS_SETTINGS],
71663
71729
  ...resumeSessionId ? ["--conversation", resumeSessionId] : [],
71664
71730
  ...extraArgs
71665
71731
  ];
71666
71732
  };
71667
71733
 
71734
+ //#endregion
71735
+ //#region ../../packages/heterogeneous-agents/src/spawn/antigravityLiveInput.ts
71736
+ /**
71737
+ * How long a live Antigravity session may sit between turns with no stdout
71738
+ * before stdin is closed anyway.
71739
+ */
71740
+ const DEFAULT_IDLE_CLOSE_MS$1 = 1800 * 1e3;
71741
+ const readIdleCloseMs$1 = () => {
71742
+ const value = Number(process.env.LOBE_ANTIGRAVITY_LIVE_INPUT_IDLE_MS);
71743
+ return Number.isFinite(value) && value > 0 ? value : DEFAULT_IDLE_CLOSE_MS$1;
71744
+ };
71745
+ /**
71746
+ * The runtime end a live Antigravity session (stdin kept open, see
71747
+ * `AntigravityLiveInput`) reports once, at process exit.
71748
+ */
71749
+ const resolveAntigravityLiveRuntimeEnd = (lastTurn, exit) => {
71750
+ if (!lastTurn?.ok || exit.killedByHost || exit.sawError) return;
71751
+ if (exit.code !== 0) return;
71752
+ return {
71753
+ reason: "complete",
71754
+ transport: "cli-live"
71755
+ };
71756
+ };
71757
+ /**
71758
+ * Keeps an Antigravity (`--input-format stream-json --output-format stream-json`)
71759
+ * stdin open while a turn is active or steered follow-ups remain unconsumed,
71760
+ * then closes stdin as soon as the session becomes idle so the process exits cleanly.
71761
+ */
71762
+ var AntigravityLiveInput = class {
71763
+ closed = false;
71764
+ idleCloseMs;
71765
+ idleTimer;
71766
+ initialUserInputSeen = false;
71767
+ lastOutcome;
71768
+ lineBuffer = "";
71769
+ pendingAdapterUuids = [];
71770
+ seenUserInputSteps = /* @__PURE__ */ new Set();
71771
+ sessionId;
71772
+ turnOpen = false;
71773
+ unconsumed = [];
71774
+ constructor(stdin, options = {}) {
71775
+ this.stdin = stdin;
71776
+ this.idleCloseMs = options.idleCloseMs ?? readIdleCloseMs$1();
71777
+ stdin.on?.("close", () => this.markClosed());
71778
+ stdin.on?.("error", () => this.markClosed());
71779
+ }
71780
+ get isOpen() {
71781
+ return !this.closed && !this.stdin.destroyed && !this.stdin.writableEnded;
71782
+ }
71783
+ get lastTurn() {
71784
+ return this.lastOutcome;
71785
+ }
71786
+ /**
71787
+ * Write one stream-json `user` line into the session. When `uuid` is given
71788
+ * (a steered follow-up), stdin stays open across turn boundaries until `agy`
71789
+ * picks up that message and finishes its turn.
71790
+ */
71791
+ send(stdinLine, uuid) {
71792
+ if (!this.isOpen) return false;
71793
+ if (uuid) {
71794
+ this.unconsumed.push(uuid);
71795
+ this.pendingAdapterUuids.push(uuid);
71796
+ }
71797
+ this.stdin.write(stdinLine);
71798
+ this.clearIdleTimer();
71799
+ return true;
71800
+ }
71801
+ /** Pop the next steered message UUID for `AntigravityAdapter` to confirm. */
71802
+ takeSteerUuid() {
71803
+ return this.pendingAdapterUuids.shift();
71804
+ }
71805
+ /** Feed raw stdout bytes from the child process. */
71806
+ observe(chunk) {
71807
+ this.lineBuffer += typeof chunk === "string" ? chunk : chunk.toString("utf8");
71808
+ for (;;) {
71809
+ const newline = this.lineBuffer.indexOf("\n");
71810
+ if (newline === -1) break;
71811
+ const line = this.lineBuffer.slice(0, newline).trim();
71812
+ this.lineBuffer = this.lineBuffer.slice(newline + 1);
71813
+ if (!line) continue;
71814
+ try {
71815
+ this.observeMessage(JSON.parse(line));
71816
+ } catch {}
71817
+ }
71818
+ if (this.closed) return;
71819
+ if (this.turnOpen) this.clearIdleTimer();
71820
+ else this.armIdleTimer();
71821
+ }
71822
+ /** stdout ended: flush any trailing partial line and close stdin. */
71823
+ finish() {
71824
+ if (this.lineBuffer.trim()) this.observe("\n");
71825
+ this.close();
71826
+ }
71827
+ close() {
71828
+ if (this.closed) return;
71829
+ this.markClosed();
71830
+ this.stdin.end();
71831
+ }
71832
+ observeMessage(message) {
71833
+ if (!message || typeof message !== "object") return;
71834
+ if (message.event === "init") {
71835
+ if (typeof message.conversation_id === "string" && message.conversation_id) this.sessionId = message.conversation_id;
71836
+ this.openTurn();
71837
+ return;
71838
+ }
71839
+ if (message.event === "step_update" && message.step_update && typeof message.step_update === "object") {
71840
+ const step = message.step_update;
71841
+ const conversationId = typeof step.conversation_id === "string" && step.conversation_id ? step.conversation_id : void 0;
71842
+ if (this.sessionId && conversationId && conversationId !== this.sessionId) return;
71843
+ this.sessionId ??= conversationId;
71844
+ if (step.step_type === "user_input") {
71845
+ const index = typeof step.step_index === "number" ? step.step_index : void 0;
71846
+ if (index === void 0 || !this.seenUserInputSteps.has(index)) {
71847
+ if (index !== void 0) this.seenUserInputSteps.add(index);
71848
+ if (this.initialUserInputSeen) this.unconsumed.shift();
71849
+ else this.initialUserInputSeen = true;
71850
+ }
71851
+ }
71852
+ this.openTurn();
71853
+ return;
71854
+ }
71855
+ if (message.event === "result" && message.result && typeof message.result === "object") {
71856
+ this.turnOpen = false;
71857
+ const status = typeof message.result.status === "string" ? message.result.status : void 0;
71858
+ this.lastOutcome = {
71859
+ ok: status === "SUCCESS",
71860
+ status
71861
+ };
71862
+ if (status !== "SUCCESS") this.close();
71863
+ else this.closeIfIdle();
71864
+ }
71865
+ }
71866
+ openTurn() {
71867
+ this.turnOpen = true;
71868
+ this.lastOutcome = void 0;
71869
+ }
71870
+ closeIfIdle() {
71871
+ if (this.turnOpen || this.unconsumed.length > 0) return;
71872
+ this.close();
71873
+ }
71874
+ armIdleTimer() {
71875
+ this.clearIdleTimer();
71876
+ this.idleTimer = setTimeout(() => this.close(), this.idleCloseMs);
71877
+ this.idleTimer.unref?.();
71878
+ }
71879
+ clearIdleTimer() {
71880
+ if (!this.idleTimer) return;
71881
+ clearTimeout(this.idleTimer);
71882
+ this.idleTimer = void 0;
71883
+ }
71884
+ markClosed() {
71885
+ this.closed = true;
71886
+ this.clearIdleTimer();
71887
+ }
71888
+ };
71889
+
71668
71890
  //#endregion
71669
71891
  //#region ../../packages/heterogeneous-agents/src/spawn/classifyProcessFailure.ts
71670
71892
  init_config();
@@ -75907,16 +76129,17 @@ const spawnAgent = async (options) => {
75907
76129
  };
75908
76130
  /** One-shot JSONL CLI spawn; `spawnAgent` owns the Codex JWT file around it. */
75909
76131
  const spawnCliAgent = async (options, command, cwd, inputPlan, childEnv, codexJwtFile) => {
75910
- const liveInput = options.agentType === "claude-code" && options.liveInput === true;
76132
+ const claudeLiveInput = options.agentType === "claude-code" && options.liveInput === true;
76133
+ const antigravityLiveInput = options.agentType === "antigravity" && options.liveInput === true;
75911
76134
  const permissionMode = options.agentType === "claude-code" ? options.permissionMode : void 0;
75912
- const permissionPrompts = liveInput && !!options.askUserBridge;
76135
+ const permissionPrompts = claudeLiveInput && !!options.askUserBridge;
75913
76136
  const args = buildSpawnArgs({
75914
76137
  agentType: options.agentType,
75915
76138
  configArgs: options.agentType === "codex" ? [...buildCodexLobeHubContextArgs(childEnv), ...codexJwtFile?.args ?? []] : void 0,
75916
76139
  extraArgs: options.extraArgs ?? [],
75917
76140
  includePartialMessages: options.includePartialMessages ?? false,
75918
76141
  inputArgs: inputPlan.args,
75919
- liveInput,
76142
+ liveInput: claudeLiveInput,
75920
76143
  permissionMode,
75921
76144
  permissionPrompts,
75922
76145
  resumeSessionId: options.resumeSessionId
@@ -75945,10 +76168,16 @@ const spawnCliAgent = async (options, command, cwd, inputPlan, childEnv, codexJw
75945
76168
  "pipe"
75946
76169
  ]
75947
76170
  });
76171
+ const claudeLive = claudeLiveInput && proc.stdin ? new ClaudeCodeLiveInput(proc.stdin) : void 0;
76172
+ const antigravityLive = antigravityLiveInput && proc.stdin ? new AntigravityLiveInput(proc.stdin) : void 0;
76173
+ const live = claudeLive ?? antigravityLive;
75948
76174
  const pipeline = new AgentStreamPipeline({
75949
- adapter: liveInput ? new ClaudeCodeAdapter({
76175
+ adapter: claudeLive ? new ClaudeCodeAdapter({
75950
76176
  runtimeEndStrategy: "on-transport-close",
75951
76177
  signalBackgroundTaskCompletion: true
76178
+ }) : antigravityLive ? new AntigravityAdapter({
76179
+ runtimeEndStrategy: "on-transport-close",
76180
+ takeNextSteerUuid: () => antigravityLive.takeSteerUuid()
75952
76181
  }) : void 0,
75953
76182
  agentType: options.agentType,
75954
76183
  cwd,
@@ -75994,21 +76223,20 @@ const spawnCliAgent = async (options, command, cwd, inputPlan, childEnv, codexJw
75994
76223
  const removeJwtFile = () => codexJwtFile.cleanup();
75995
76224
  exit.then(removeJwtFile, removeJwtFile);
75996
76225
  }
75997
- const live = liveInput && proc.stdin ? new ClaudeCodeLiveInput(proc.stdin) : void 0;
75998
- if (live && permissionMode && permissionPrompts && options.askUserBridge) {
76226
+ if (claudeLive && permissionMode && permissionPrompts && options.askUserBridge) {
75999
76227
  const bridge = options.askUserBridge;
76000
76228
  const isRoot = isRunningAsRoot();
76001
- attachClaudeCodePermissionResponder(live, {
76229
+ attachClaudeCodePermissionResponder(claudeLive, {
76002
76230
  ask: askThroughBridge(bridge),
76003
76231
  cancel: (toolCallId) => bridge.cancel(toolCallId, "session_ended"),
76004
76232
  isRoot
76005
76233
  });
76006
76234
  const reporter = new PermissionModeReporter(options.operationId, resolveClaudeCodePermissionMode(permissionMode, isRoot).fallback);
76007
- live.onControlRequestSent((request, meta) => {
76235
+ claudeLive.onControlRequestSent((request, meta) => {
76008
76236
  const requestedMode = meta?.requestedMode;
76009
76237
  if (request.subtype === "set_permission_mode" && isHeteroPermissionMode(requestedMode)) reporter.requested(requestedMode, isRoot);
76010
76238
  });
76011
- live.subscribe((message) => {
76239
+ claudeLive.subscribe((message) => {
76012
76240
  const event = reporter.observe(message);
76013
76241
  if (!event) return;
76014
76242
  queue.push(event);
@@ -76043,12 +76271,17 @@ const spawnCliAgent = async (options, command, cwd, inputPlan, childEnv, codexJw
76043
76271
  if (code === 0 && !killedByUs) events.push(...pipeline.validateCompletion());
76044
76272
  sawErrorEvent ||= events.some((event) => event.type === "error");
76045
76273
  for (const event of events) queue.push(event);
76046
- const liveEnd = resolveClaudeCodeLiveRuntimeEnd(live?.lastTurn, {
76274
+ const liveEnd = claudeLive ? resolveClaudeCodeLiveRuntimeEnd(claudeLive.lastTurn, {
76047
76275
  code,
76048
76276
  killedByHost: killedByUs,
76049
76277
  sawError: sawErrorEvent,
76050
76278
  signal
76051
- });
76279
+ }) : antigravityLive ? resolveAntigravityLiveRuntimeEnd(antigravityLive.lastTurn, {
76280
+ code,
76281
+ killedByHost: killedByUs,
76282
+ sawError: sawErrorEvent,
76283
+ signal
76284
+ }) : void 0;
76052
76285
  if (liveEnd) for (const event of pipeline.completeRuntime(liveEnd)) queue.push(event);
76053
76286
  for (const event of await pipeline.collectPostRunUsage({ env: childEnv })) queue.push(event);
76054
76287
  } catch (err) {
@@ -76094,16 +76327,24 @@ const spawnCliAgent = async (options, command, cwd, inputPlan, childEnv, codexJw
76094
76327
  } };
76095
76328
  } },
76096
76329
  exit,
76097
- ...live && {
76098
- interruptTurn: () => live.interrupt(),
76099
- sendControlRequest: (request) => live.sendControlRequest(request),
76330
+ ...claudeLive && {
76331
+ interruptTurn: () => claudeLive.interrupt(),
76332
+ sendControlRequest: (request) => claudeLive.sendControlRequest(request),
76100
76333
  sendUserMessage: async (prompt, sendOptions) => {
76101
- if (!live.isOpen) return false;
76334
+ if (!claudeLive.isOpen) return false;
76102
76335
  const plan = await buildAgentInput("claude-code", prompt, options.inputOptions);
76103
- return live.send(plan.stdin, sendOptions?.uuid);
76336
+ return claudeLive.send(plan.stdin, sendOptions?.uuid);
76104
76337
  },
76105
76338
  supportsSteerImageAttachments: true
76106
76339
  },
76340
+ ...antigravityLive && {
76341
+ sendUserMessage: async (prompt, sendOptions) => {
76342
+ if (!antigravityLive.isOpen) return false;
76343
+ const plan = await buildAgentInput("antigravity", prompt, options.inputOptions);
76344
+ return antigravityLive.send(plan.stdin, sendOptions?.uuid);
76345
+ },
76346
+ supportsSteerImages: false
76347
+ },
76107
76348
  kill: (signal = "SIGINT") => {
76108
76349
  killedByUs = true;
76109
76350
  live?.close();
@@ -305730,6 +305971,7 @@ const listCodexModels = async ({ args = [], commandPath, cwd, env, timeoutMs })
305730
305971
  //#endregion
305731
305972
  //#region ../../packages/heterogeneous-agents/src/models/listHeterogeneousAgentModels.ts
305732
305973
  init_object$1();
305974
+ init_config();
305733
305975
  init_cliSpawn();
305734
305976
  init_resolveCliCommand();
305735
305977
  const execFilePromise = promisify(execFile);
@@ -305951,6 +306193,7 @@ const classifyCatalogError = (error) => {
305951
306193
  };
305952
306194
  const getCatalogErrorMessage = (code, type) => {
305953
306195
  const name = getHeterogeneousTypeLabel(type) ?? type;
306196
+ if (code === "auth_required") return `Sign in to the ${name} CLI on the execution device`;
305954
306197
  if (code === "cli_not_found") return `${name} CLI was not found`;
305955
306198
  if (code === "timeout") return `${name} model discovery timed out`;
305956
306199
  return `${name} model discovery failed`;
@@ -306086,7 +306329,8 @@ const listHeterogeneousAgentModels = async (params) => {
306086
306329
  updatedAt
306087
306330
  };
306088
306331
  } catch (error) {
306089
- const code = classifyCatalogError(error);
306332
+ const { stderr } = getErrorRecord(error);
306333
+ const code = params.type === "antigravity" && isHeterogeneousAgentAuthRequired(params.type, String(stderr ?? "")) ? "auth_required" : classifyCatalogError(error);
306090
306334
  return {
306091
306335
  error: {
306092
306336
  code,
@@ -584453,7 +584697,7 @@ async function* withHeteroSteer(handle, context) {
584453
584697
  const res = await client.aiAgent.waitHeteroSteer.mutate({
584454
584698
  ...acceptsControl && { acceptsControl: true },
584455
584699
  ...handle.supportsSteerImageAttachments && { acceptsImageAttachments: true },
584456
- acceptsImages: true,
584700
+ ...handle.supportsSteerImages !== false && { acceptsImages: true },
584457
584701
  ...!answered && { blockMs: 1 },
584458
584702
  ...waitingForUser() && { holdSteer: true },
584459
584703
  operationId
@@ -585501,7 +585745,7 @@ const exec = async (options) => {
585501
585745
  extraArgs,
585502
585746
  includePartialMessages: options.type === "claude-code",
585503
585747
  initialModel: usesHeterogeneousSessionInitialModel(options.type) ? options.model : void 0,
585504
- liveInput: options.type === "claude-code",
585748
+ liveInput: options.type === "claude-code" || options.type === "antigravity",
585505
585749
  operationId,
585506
585750
  ...options.type === "claude-code" && resolved.permissionMode && { permissionMode: resolved.permissionMode },
585507
585751
  uploadImage
package/man/man1/lh.1 CHANGED
@@ -1,6 +1,6 @@
1
1
  .\" Code generated by `npm run man:generate`; DO NOT EDIT.
2
2
  .\" Manual command details come from the Commander command tree.
3
- .TH LH 1 "" "@lobehub/cli 0.0.162" "User Commands"
3
+ .TH LH 1 "" "@lobehub/cli 0.0.164" "User Commands"
4
4
  .SH NAME
5
5
  lh \- LobeHub CLI \- manage and connect to LobeHub services
6
6
  .SH SYNOPSIS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/cli",
3
- "version": "0.0.162",
3
+ "version": "0.0.164",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/lobehub/lobehub",
@@ -83,5 +83,5 @@
83
83
  "access": "public",
84
84
  "registry": "https://registry.npmjs.org"
85
85
  },
86
- "gitHead": "c5d79a355d4a88645136711a7b14a49dc94cc8a8"
86
+ "gitHead": "3bdcf55a4329e37e6ffb060c2d63214a2cdab38f"
87
87
  }