@lobehub/cli 0.0.201 → 0.0.203

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
@@ -73024,6 +73024,7 @@ var KimiCodeAdapter = class {
73024
73024
  init_config();
73025
73025
  const OPENCODE_IDENTIFIER = "opencode";
73026
73026
  const OPENCODE_TODO_WRITE_API = "todowrite";
73027
+ const WEB_SEARCH_INPUT_CANCELLED = "Cancelled a request for input this run cannot answer: Web Search";
73027
73028
  const OPENCODE_TOOL_ALIASES = { shell: "bash" };
73028
73029
  const OPENCODE_CLI_INSTALL_DOCS_URL = getHeterogeneousAgentConfigOrThrow(OPENCODE_IDENTIFIER).auth.docsUrl;
73029
73030
  const AUTH_REQUIRED_PATTERNS = [
@@ -73079,6 +73080,10 @@ var OpenCodeAdapter = class {
73079
73080
  stepIndex = 0;
73080
73081
  streamOpen = false;
73081
73082
  terminalErrorEmitted = false;
73083
+ cancelledWebSearchStep;
73084
+ textStep;
73085
+ completedReplyStep;
73086
+ recoveredWebSearchStep;
73082
73087
  adapt(raw) {
73083
73088
  if (!raw || typeof raw !== "object") return [];
73084
73089
  if (typeof raw.sessionID === "string") this.sessionId = raw.sessionID;
@@ -73097,6 +73102,9 @@ var OpenCodeAdapter = class {
73097
73102
  this.streamOpen = false;
73098
73103
  return [this.makeEvent("stream_end", {})];
73099
73104
  }
73105
+ resolveExitCode(code) {
73106
+ return code === 1 && this.recoveredWebSearchStep === this.stepIndex && !this.terminalErrorEmitted ? 0 : code;
73107
+ }
73100
73108
  handleStepStart(part) {
73101
73109
  if (!part || part.type !== "step-start" || !part.id || this.completedPartIds.has(part.id)) return [];
73102
73110
  this.completedPartIds.add(part.id);
@@ -73118,6 +73126,7 @@ var OpenCodeAdapter = class {
73118
73126
  if (!part || part.type !== type || !part.id || this.completedPartIds.has(part.id)) return [];
73119
73127
  this.completedPartIds.add(part.id);
73120
73128
  if (typeof part.text !== "string" || !part.text) return [];
73129
+ if (type === "text" && part.text.trim()) this.textStep = this.stepIndex;
73121
73130
  return [this.makeEvent("stream_chunk", type === "text" ? {
73122
73131
  chunkType: "text",
73123
73132
  content: part.text
@@ -73129,6 +73138,7 @@ var OpenCodeAdapter = class {
73129
73138
  handleStepFinish(part) {
73130
73139
  if (!part || part.type !== "step-finish" || !part.id || this.completedPartIds.has(part.id)) return [];
73131
73140
  this.completedPartIds.add(part.id);
73141
+ if (part.reason === "stop" && this.textStep === this.stepIndex && this.cancelledWebSearchStep !== void 0 && this.cancelledWebSearchStep < this.stepIndex) this.completedReplyStep = this.stepIndex;
73132
73142
  const data = {
73133
73143
  costUsd: finiteNumber$1(part.cost),
73134
73144
  phase: "turn_metadata",
@@ -73153,6 +73163,7 @@ var OpenCodeAdapter = class {
73153
73163
  type: "default"
73154
73164
  };
73155
73165
  const isError = state.status === "error";
73166
+ if (part.tool === "websearch" && isError && state.error === "Web search cancelled") this.cancelledWebSearchStep = this.stepIndex;
73156
73167
  const pluginState = !isError && part.tool === OPENCODE_TODO_WRITE_API ? synthesizeTodoWritePluginState(state.metadata?.todos ?? state.input?.todos) : void 0;
73157
73168
  const result = {
73158
73169
  content: isError ? String(state.error ?? "") : String(state.output ?? ""),
@@ -73174,8 +73185,12 @@ var OpenCodeAdapter = class {
73174
73185
  }
73175
73186
  handleError(error) {
73176
73187
  if (this.terminalErrorEmitted) return [];
73177
- this.terminalErrorEmitted = true;
73178
73188
  const message = errorMessage$1(error);
73189
+ if (error?.type === "unknown" && message === WEB_SEARCH_INPUT_CANCELLED && this.completedReplyStep === this.stepIndex) {
73190
+ this.recoveredWebSearchStep = this.stepIndex;
73191
+ return [];
73192
+ }
73193
+ this.terminalErrorEmitted = true;
73179
73194
  const authRequired = isAuthError(error, message);
73180
73195
  const data = {
73181
73196
  agentType: OPENCODE_IDENTIFIER,
@@ -74519,6 +74534,9 @@ var AgentStreamPipeline = class {
74519
74534
  validateCompletion() {
74520
74535
  return this.toStreamEvents(this.adapter.validateCompletion?.() ?? []);
74521
74536
  }
74537
+ resolveExitCode(code) {
74538
+ return this.adapter.resolveExitCode?.(code) ?? code;
74539
+ }
74522
74540
  async processPayloads(payloads) {
74523
74541
  const out = this.drainQueuedEvents();
74524
74542
  for (const raw of payloads) {
@@ -79415,7 +79433,21 @@ const spawnCliAgent = async (options, command, cwd, inputPlan, childEnv, codexJw
79415
79433
  }
79416
79434
  } };
79417
79435
  } },
79418
- exit,
79436
+ exit: options.agentType === "opencode" ? exit.then(async (status) => {
79437
+ if (status.code !== 1 || status.signal || killedByUs) return status;
79438
+ try {
79439
+ await finished(stdout, {
79440
+ cleanup: true,
79441
+ writable: false
79442
+ });
79443
+ await pipelineQueue;
79444
+ if (!streamError && !killedByUs) return {
79445
+ ...status,
79446
+ code: pipeline.resolveExitCode(status.code)
79447
+ };
79448
+ } catch {}
79449
+ return status;
79450
+ }) : exit,
79419
79451
  ...claudeLive && {
79420
79452
  interruptTurn: () => claudeLive.interrupt(),
79421
79453
  sendControlRequest: (request) => claudeLive.sendControlRequest(request),
@@ -558675,7 +558707,17 @@ const probeRemotePlatform = async (type) => {
558675
558707
  reason: status.error
558676
558708
  };
558677
558709
  };
558710
+ /**
558711
+ * Probe every known agent type on this machine.
558712
+ *
558713
+ * Each scan re-reads the login-shell PATH first. The scanner lives in a
558714
+ * long-running host (`lh connect`, Electron main) that otherwise keeps the PATH
558715
+ * it read at startup for the whole process, so a CLI installed afterwards —
558716
+ * the reason someone presses "Rescan device" — stayed invisible until the host
558717
+ * was restarted. All probes of one scan still share a single shell read.
558718
+ */
558678
558719
  const scanHeterogeneousAgentsOnHost = async () => {
558720
+ invalidateLoginShellPathCache();
558679
558721
  const entries = await Promise.all([...HETEROGENEOUS_AGENT_CONFIGS.map(async (config) => {
558680
558722
  const status = await detectHeterogeneousCliCommand(config.type, config.defaultCommand);
558681
558723
  return [config.type, {
@@ -560595,6 +560637,9 @@ async function runLocalSystemTool(apiName, args, { uploadImage } = {}) {
560595
560637
  /**
560596
560638
  * Probe every known heterogeneous agent type on this device in one pass.
560597
560639
  * Dispatched by the server via the `device.scanAgents` tRPC procedure.
560640
+ *
560641
+ * The scan re-reads the login-shell PATH on every call, so a CLI installed
560642
+ * after `lh connect` started shows up on the next scan without a restart.
560598
560643
  */
560599
560644
  async function scanHeterogeneousAgents() {
560600
560645
  return { agents: await scanHeterogeneousAgentsOnHost() };
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.201" "User Commands"
3
+ .TH LH 1 "" "@lobehub/cli 0.0.203" "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.201",
3
+ "version": "0.0.203",
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": "8c44304c8a14478f78df0b1696f98ddafca7949b"
86
+ "gitHead": "2d5beaa230e1b5ac707c73962615c4dfa4fe132e"
87
87
  }