@lobehub/cli 0.0.202 → 0.0.204

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),
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.202" "User Commands"
3
+ .TH LH 1 "" "@lobehub/cli 0.0.204" "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.202",
3
+ "version": "0.0.204",
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": "12d3156bbed7d79ed2c16d3c9fe3a70ce1c6cd11"
86
+ "gitHead": "9df9d682c042f3b0854cca100ee2750bcdeed520"
87
87
  }